|
@@ -0,0 +1,46 @@
|
|
|
+package com.szwl.controller;
|
|
|
+
|
|
|
+import com.szwl.mapper.TLocationCheckMapper;
|
|
|
+import com.szwl.model.entity.TLocationCheck;
|
|
|
+import com.szwl.service.TLocationCheckService;
|
|
|
+import com.szwl.util.WhoIsUtil;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@Api(value = "/tTest", tags = {"测试"})
|
|
|
+@RestController
|
|
|
+@RequestMapping("/tTest")
|
|
|
+public class TestController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TLocationCheckMapper locationCheckMapper;
|
|
|
+ @Resource
|
|
|
+ TLocationCheckService locationCheckService;
|
|
|
+ @ApiOperation(value = "测试定时任务")
|
|
|
+ @PostMapping("/testSch")
|
|
|
+ public void test() throws IOException {
|
|
|
+ List<TLocationCheck> locationChecks = locationCheckMapper.selectNotNullIp();
|
|
|
+// String locErrorEq = null;
|
|
|
+ StringBuilder locErrorEq = new StringBuilder();
|
|
|
+ for (TLocationCheck locationChc : locationChecks) {
|
|
|
+ String clientId = locationChc.getClientId();
|
|
|
+ String ip = locationChc.getIp();
|
|
|
+ String addr = WhoIsUtil.getLocByIp(ip);
|
|
|
+ // 这里不需要更新ip,只需要校验有ip的设备位置对不对
|
|
|
+// locationCheckService.locCheckMsg(locationChc, clientId, addr);
|
|
|
+ String check = locationCheckService.schLocCheck(locationChc, clientId, addr);
|
|
|
+ locErrorEq.append(check);
|
|
|
+ }
|
|
|
+ locationCheckService.schSendMsg(locErrorEq.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+}
|