|
@@ -68,26 +68,34 @@ public class TLocationCheckController {
|
|
|
return R.fail("地区信息未录入");
|
|
|
}
|
|
|
|
|
|
-// @ApiOperation(value = "根据ip校验clientId设备位置")
|
|
|
-// @PostMapping("/ipCheck")
|
|
|
-// public ResponseModel<?> ipCheck(@RequestParam String clientId, @RequestParam String ip) throws IOException {
|
|
|
-// if (StringUtils.isBlank(clientId) || StringUtils.isBlank(ip)) {
|
|
|
-// return R.fail("参数不能为空");
|
|
|
-// }
|
|
|
-// // 根据 clientId 查设备的 location,country
|
|
|
-// LambdaQueryWrapper<TLocationCheck> lqw = Wrappers.lambdaQuery();
|
|
|
-// lqw.eq(TLocationCheck::getClientId, clientId);
|
|
|
-// TLocationCheck locationCheck = locationCheckService.getOne(lqw);
|
|
|
-// if (Objects.isNull(locationCheck)) {
|
|
|
-// return R.fail("生产部未录入改设备的位置信息");
|
|
|
-// }
|
|
|
-//
|
|
|
-// String s = WhoIsUtil.getLocByIp(ip);
|
|
|
-//
|
|
|
-// String result = locationCheckService.locCheckMsg(locationCheck, clientId, ip, s);
|
|
|
-//
|
|
|
-// return R.ok(result);
|
|
|
-// }
|
|
|
+ @ApiOperation(value = "根据ip校验clientId设备位置")
|
|
|
+ @PostMapping("/ipCheck")
|
|
|
+ public ResponseModel<?> ipCheck(@RequestParam String clientId, @RequestParam String ip) throws IOException {
|
|
|
+ if (StringUtils.isBlank(clientId) || StringUtils.isBlank(ip)) {
|
|
|
+ return R.fail("参数不能为空");
|
|
|
+ }
|
|
|
+ // 根据 clientId 查设备的 location,country
|
|
|
+ LambdaQueryWrapper<TLocationCheck> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq(TLocationCheck::getClientId, clientId);
|
|
|
+ TLocationCheck locationCheck = locationCheckService.getOne(lqw);
|
|
|
+ if (Objects.isNull(locationCheck)) {
|
|
|
+ return R.fail("生产部未录入改设备的位置信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ locationCheck.setIp(ip);
|
|
|
+ locationCheck.setModifyTime(new Date());
|
|
|
+
|
|
|
+ String addr = WhoIsUtil.getLocByIp(ip);
|
|
|
+
|
|
|
+// String result = locationCheckService.locCheckMsg(locationCheck, clientId, addr);
|
|
|
+ String result = locationCheckService.locCheckNoMsg(locationCheck, clientId, addr);
|
|
|
+
|
|
|
+ if ("fail".equals(result)) {
|
|
|
+ locationCheck.setErr("不匹配");
|
|
|
+ }
|
|
|
+ locationCheckService.updateById(locationCheck);
|
|
|
+ return R.ok(result);
|
|
|
+ }
|
|
|
|
|
|
@ApiOperation(value = "修改录入的位置信息")
|
|
|
@PostMapping("/updateLocInfo")
|