|
@@ -1,12 +1,5 @@
|
|
|
package com.szwl.service.impl;
|
|
|
|
|
|
-import cn.hutool.http.HttpUtil;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
-import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
-import com.fasterxml.jackson.databind.JsonNode;
|
|
|
-import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
-import com.szwl.model.bo.R;
|
|
|
import com.szwl.model.entity.TLocationCheck;
|
|
|
import com.szwl.mapper.TLocationCheckMapper;
|
|
|
import com.szwl.model.utils.YunPianSms;
|
|
@@ -15,13 +8,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
import java.io.IOException;
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
- * 服务实现类
|
|
|
+ * 服务实现类
|
|
|
* </p>
|
|
|
*
|
|
|
* @author wuhs
|
|
@@ -30,11 +21,6 @@ import java.util.Objects;
|
|
|
@Service
|
|
|
public class TLocationCheckServiceImpl extends ServiceImpl<TLocationCheckMapper, TLocationCheck> implements TLocationCheckService {
|
|
|
|
|
|
-// TLocationCheckService locationCheckService;
|
|
|
-//
|
|
|
-// public TLocationCheckServiceImpl(TLocationCheckService locationCheckService) {
|
|
|
-// this.locationCheckService = locationCheckService;
|
|
|
-// }
|
|
|
|
|
|
private static final String appid = "07784f5fedb508046c841b391005b7de";
|
|
|
|
|
@@ -69,30 +55,19 @@ public class TLocationCheckServiceImpl extends ServiceImpl<TLocationCheckMapper,
|
|
|
if (StringUtils.isEmpty(country)) {
|
|
|
return "国家不能为空";
|
|
|
}
|
|
|
-// ObjectMapper objectMapper = new ObjectMapper();
|
|
|
-// JsonNode jsonNode = objectMapper.readTree(s);
|
|
|
-// String addr = jsonNode.get("addr").asText();
|
|
|
|
|
|
// 如果 pro,city,addr 中都不包含 country 或者 location,就是异常,发短信通知
|
|
|
boolean containsUserInput = true;
|
|
|
// location 为空 / 不为空
|
|
|
// country 是中国 / 不是中国
|
|
|
if (StringUtils.isEmpty(location)) {
|
|
|
- if (country.equals("中国")) {
|
|
|
- return "国内必须精确到省市";
|
|
|
- } else {
|
|
|
- containsUserInput = addr.contains(country);
|
|
|
- }
|
|
|
+ containsUserInput = addr.contains(country);
|
|
|
} else {
|
|
|
- if (country.equals("中国")) {
|
|
|
- containsUserInput = addr.contains(location);
|
|
|
- } else {
|
|
|
- containsUserInput = addr.contains(country) || addr.contains(location) || location.contains(addr);
|
|
|
- }
|
|
|
+ containsUserInput = addr.contains(country) || addr.contains(location) || location.contains(addr);
|
|
|
}
|
|
|
|
|
|
String phone = "18620242721";
|
|
|
- String phone1 = "13631231970"; // 基哥
|
|
|
+// String phone1 = "13631231970"; // 基哥
|
|
|
String phone2 = "15018460394"; // 龙
|
|
|
|
|
|
String messages = "【申泽部门】设备编号:" + clientId + ",所在ip与设定位置不符,请及时查看。";
|
|
@@ -114,20 +89,12 @@ public class TLocationCheckServiceImpl extends ServiceImpl<TLocationCheckMapper,
|
|
|
}
|
|
|
|
|
|
boolean containsUserInput = true;
|
|
|
- // location 为空 / 不为空
|
|
|
- // country 是中国 / 不是中国
|
|
|
+ // location 地区为空 / 不为空
|
|
|
+ // country 国家是中国 / 不是中国
|
|
|
if (StringUtils.isEmpty(location)) {
|
|
|
- if (country.equals("中国")) {
|
|
|
- return "国内必须精确到省";
|
|
|
- } else {
|
|
|
- containsUserInput = addr.contains(country);
|
|
|
- }
|
|
|
+ containsUserInput = addr.contains(country);
|
|
|
} else {
|
|
|
- if (country.equals("中国")) {
|
|
|
- containsUserInput = addr.contains(location);
|
|
|
- } else {
|
|
|
- containsUserInput = addr.contains(country) || addr.contains(location) || location.contains(addr);
|
|
|
- }
|
|
|
+ containsUserInput = addr.contains(country) || addr.contains(location) || location.contains(addr);
|
|
|
}
|
|
|
|
|
|
if (!containsUserInput) { // 不包含,返回设备编号
|
|
@@ -140,12 +107,12 @@ public class TLocationCheckServiceImpl extends ServiceImpl<TLocationCheckMapper,
|
|
|
@Override
|
|
|
public void schSendMsg(String locErrorEq) throws IOException {
|
|
|
String phone = "18620242721";
|
|
|
- String phone1 = "13631231970"; // 基哥
|
|
|
- String phone2 = "15018460394"; // 龙
|
|
|
+// String phone1 = "13631231970"; // 基哥
|
|
|
+// String phone2 = "15018460394"; // 龙
|
|
|
String messages = "【申泽部门】设备编号:" + locErrorEq + ",所在ip与设定位置不符,请及时查看。";
|
|
|
YunPianSms.sendSms(appid, messages, phone);
|
|
|
- YunPianSms.sendSms(appid, messages, phone1);
|
|
|
- YunPianSms.sendSms(appid, messages, phone2);
|
|
|
+// YunPianSms.sendSms(appid, messages, phone1);
|
|
|
+// YunPianSms.sendSms(appid, messages, phone2);
|
|
|
}
|
|
|
|
|
|
|