|
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
+import com.szwl.constant.ResponseCodesEnum;
|
|
import com.szwl.model.bo.R;
|
|
import com.szwl.model.bo.R;
|
|
import com.szwl.model.bo.ResponseModel;
|
|
import com.szwl.model.bo.ResponseModel;
|
|
import com.szwl.model.entity.TAdmin;
|
|
import com.szwl.model.entity.TAdmin;
|
|
@@ -22,9 +23,7 @@ import org.apache.commons.lang.StringUtils;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -100,29 +99,23 @@ public class TLocationCheckController {
|
|
// 售后部同事修改的信息:姓名,电话,username,clientId,国家
|
|
// 售后部同事修改的信息:姓名,电话,username,clientId,国家
|
|
String modUsername = locationCheck.getModUsername();
|
|
String modUsername = locationCheck.getModUsername();
|
|
if (!("shouhoumi".equals(modUsername)) && !("admin".equals(modUsername))) {
|
|
if (!("shouhoumi".equals(modUsername)) && !("admin".equals(modUsername))) {
|
|
- return R.fail("该账号无权操作");
|
|
|
|
|
|
+ return R.fail("该账号无权修改");
|
|
}
|
|
}
|
|
String modName = locationCheck.getModName();
|
|
String modName = locationCheck.getModName();
|
|
String modPhone = locationCheck.getModPhone();
|
|
String modPhone = locationCheck.getModPhone();
|
|
String clientId = locationCheck.getClientId();
|
|
String clientId = locationCheck.getClientId();
|
|
String location = locationCheck.getLocation();
|
|
String location = locationCheck.getLocation();
|
|
String country = locationCheck.getCountry();
|
|
String country = locationCheck.getCountry();
|
|
|
|
+ String message = locationCheck.getMessage();
|
|
|
|
|
|
if (Objects.isNull(clientId)) {
|
|
if (Objects.isNull(clientId)) {
|
|
return R.fail("设备唯一码不能为空");
|
|
return R.fail("设备唯一码不能为空");
|
|
}
|
|
}
|
|
|
|
|
|
- if (country.equals("中国")) {
|
|
|
|
- if (StringUtils.isEmpty(location)) {
|
|
|
|
- return R.fail("国内省市不能为空");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-// LambdaQueryWrapper<TAdmin> lqw = Wrappers.lambdaQuery();
|
|
|
|
-// lqw.eq(TAdmin::getUsername, modUsername);
|
|
|
|
-// TAdmin modAdmin = adminService.getOne(lqw);
|
|
|
|
-// if (Objects.isNull(modAdmin)) {
|
|
|
|
-// return R.fail("modAdmin账号不存在");
|
|
|
|
|
|
+// if (country.equals("中国")) {
|
|
|
|
+// if (StringUtils.isEmpty(location)) {
|
|
|
|
+// return R.fail("国内省市不能为空");
|
|
|
|
+// }
|
|
// }
|
|
// }
|
|
|
|
|
|
LambdaQueryWrapper<TLocationCheck> wrapper = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<TLocationCheck> wrapper = Wrappers.lambdaQuery();
|
|
@@ -130,24 +123,16 @@ public class TLocationCheckController {
|
|
List<TLocationCheck> checks = locationCheckService.list(wrapper);
|
|
List<TLocationCheck> checks = locationCheckService.list(wrapper);
|
|
TLocationCheck tLocationCheck = checks.get(0);
|
|
TLocationCheck tLocationCheck = checks.get(0);
|
|
|
|
|
|
-// Long modAdminId = modAdmin.getId();
|
|
|
|
-// String phone1 = modAdmin.getPhone();
|
|
|
|
-// String name1 = modAdmin.getName();
|
|
|
|
-// if (!Objects.equals(phone1, modPhone)) {
|
|
|
|
-// return R.fail("手机号码有误");
|
|
|
|
-// }
|
|
|
|
-// if (!Objects.equals(name1, modName)) {
|
|
|
|
-// return R.fail("姓名有误");
|
|
|
|
-// }
|
|
|
|
|
|
|
|
tLocationCheck.setModifyTime(new Date());
|
|
tLocationCheck.setModifyTime(new Date());
|
|
tLocationCheck.setModName(modName);
|
|
tLocationCheck.setModName(modName);
|
|
// tLocationCheck.setModAdminId(modAdminId);
|
|
// tLocationCheck.setModAdminId(modAdminId);
|
|
tLocationCheck.setModPhone(modPhone);
|
|
tLocationCheck.setModPhone(modPhone);
|
|
-// tLocationCheck.setModUsername(modUsername);
|
|
|
|
|
|
+ tLocationCheck.setModUsername(modUsername);
|
|
tLocationCheck.setLocation(location);
|
|
tLocationCheck.setLocation(location);
|
|
tLocationCheck.setClientId(clientId);
|
|
tLocationCheck.setClientId(clientId);
|
|
tLocationCheck.setCountry(country);
|
|
tLocationCheck.setCountry(country);
|
|
|
|
+ tLocationCheck.setMessage(message);
|
|
|
|
|
|
locationCheckService.updateById(tLocationCheck);
|
|
locationCheckService.updateById(tLocationCheck);
|
|
|
|
|
|
@@ -179,37 +164,17 @@ public class TLocationCheckController {
|
|
if (checks.size() > 0) {
|
|
if (checks.size() > 0) {
|
|
return R.fail("此设备信息已录入");
|
|
return R.fail("此设备信息已录入");
|
|
}
|
|
}
|
|
-// LambdaQueryWrapper<TAdmin> lqw = Wrappers.lambdaQuery();
|
|
|
|
-// lqw.eq(TAdmin::getUsername, username);
|
|
|
|
-// TAdmin admin = adminService.getOne(lqw);
|
|
|
|
-// if (Objects.isNull(admin)) {
|
|
|
|
-// return R.fail("adminId账号不存在");
|
|
|
|
-// }
|
|
|
|
-// Long adminId = admin.getId();
|
|
|
|
-// String phone1 = admin.getPhone();
|
|
|
|
-// if (!Objects.equals(phone1, phone)) {
|
|
|
|
-// return R.fail("手机号码有误");
|
|
|
|
-// }
|
|
|
|
- // 孙超,黄堪通
|
|
|
|
-// String sunPhone = "15546789003";
|
|
|
|
-// String huangPhone = "18320396362";
|
|
|
|
-// if (!Objects.equals(sunPhone, phone) || !Objects.equals(huangPhone, phone)) {
|
|
|
|
-// return R.fail("手机号有误");
|
|
|
|
-// }
|
|
|
|
-// String name1 = admin.getName();
|
|
|
|
- String adminStr = "admin";
|
|
|
|
- String sun = "sunchao";
|
|
|
|
- String huang = "huangkantong";
|
|
|
|
- if (!Objects.equals(sun, username) || !Objects.equals(huang, username) || !Objects.equals(adminStr, username)) {
|
|
|
|
|
|
+
|
|
|
|
+ Set<String> allowedUsers = new HashSet<>(Arrays.asList("admin", "sunchao", "huangkantong", "shouhou121", "shouhou369", "shouhou397", "shouhoumi"));
|
|
|
|
+ if (!allowedUsers.contains(username)) {
|
|
return R.fail("该账号无权操作");
|
|
return R.fail("该账号无权操作");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
TLocationCheck tLocationCheck = new TLocationCheck();
|
|
TLocationCheck tLocationCheck = new TLocationCheck();
|
|
-// String uuid = IdUtil.randomUUID();
|
|
|
|
String uuid = IdUtil.simpleUUID();
|
|
String uuid = IdUtil.simpleUUID();
|
|
tLocationCheck.setId(uuid);
|
|
tLocationCheck.setId(uuid);
|
|
tLocationCheck.setCreateTime(new Date());
|
|
tLocationCheck.setCreateTime(new Date());
|
|
-// tLocationCheck.setAdminId(adminId);
|
|
|
|
tLocationCheck.setPhone(phone);
|
|
tLocationCheck.setPhone(phone);
|
|
tLocationCheck.setUsername(username);
|
|
tLocationCheck.setUsername(username);
|
|
tLocationCheck.setClientId(clientId);
|
|
tLocationCheck.setClientId(clientId);
|