ソースを参照

Merge remote-tracking branch 'origin/V1' into V1

xiao547607 5 年 前
コミット
908301f869

+ 17 - 17
common/src/main/java/com/jpsoft/smart/modules/base/service/impl/PersonDeviceLogServiceImpl.java

@@ -131,23 +131,23 @@ public class PersonDeviceLogServiceImpl implements PersonDeviceLogService {
                 throw new Exception(personDeviceLog.getDeviceNo() + "设备不存在");
             }
             List<WarningPusher> warningPusherList = warningPusherService.findByCompanyId(personInfo.getCompanyId());
-            if (warningPusherList.size() <= 0) {
-                throw new Exception("对应公司没有体温报警监管者");
-            }
-
-            for (WarningPusher warningPusher : warningPusherList) {
-                Map<String, Object> searchParams = new HashMap<>();
-                searchParams.put("deviceNo", personDeviceLog.getDeviceNo());
-                searchParams.put("personId", personDeviceLog.getPersonId());
-                searchParams.put("minTemperature", warningPusher.getTemperature());
-                searchParams.put("beginTime", new Date(personDeviceLog.getRecordTime().getTime() - 300000));
-                List<Sort> sortList = new ArrayList<>();
-                sortList.add(new Sort("record_time", "desc"));
-                List<PersonDeviceLog> personDeviceLogList = personDeviceLogDAO.search(searchParams, sortList);
-
-                if (personDeviceLogList.size() >= warningPusher.getTimes()) {
-                    log.warn("开始发送模板消息");
-                    WechatMessageUtil.sendTemperatureAlarmInfo(warningPusher.getOpenId(), companyInfo.getName() + "_" + deviceInfo.getAliasName(), wxConfig.getAppId(), wxConfig.getAppSecret(),personDeviceLog.getId());
+            if (warningPusherList.size() > 0) {
+
+
+                for (WarningPusher warningPusher : warningPusherList) {
+                    Map<String, Object> searchParams = new HashMap<>();
+                    searchParams.put("deviceNo", personDeviceLog.getDeviceNo());
+                    searchParams.put("personId", personDeviceLog.getPersonId());
+                    searchParams.put("minTemperature", warningPusher.getTemperature());
+                    searchParams.put("beginTime", new Date(personDeviceLog.getRecordTime().getTime() - 300000));
+                    List<Sort> sortList = new ArrayList<>();
+                    sortList.add(new Sort("record_time", "desc"));
+                    List<PersonDeviceLog> personDeviceLogList = personDeviceLogDAO.search(searchParams, sortList);
+
+                    if (personDeviceLogList.size() >= warningPusher.getTimes()) {
+                        log.warn("开始发送模板消息");
+                        WechatMessageUtil.sendTemperatureAlarmInfo(warningPusher.getOpenId(), companyInfo.getName() + "_" + deviceInfo.getAliasName(), wxConfig.getAppId(), wxConfig.getAppSecret(), personDeviceLog.getId());
+                    }
                 }
             }
 

+ 24 - 17
common/src/main/java/com/jpsoft/smart/modules/common/utils/LApiUtil.java

@@ -144,26 +144,32 @@ public class LApiUtil {
     }
 
     public static Integer getPersonCode(cn.hutool.json.JSONObject libMatInfoListJson, cn.hutool.json.JSONObject matchPersonInfo){
-        if (!libMatInfoListJson.getStr("MatchPersonID").equals("0") && org.apache.commons.lang3.StringUtils.isNotBlank(matchPersonInfo.getStr("PersonCode"))){
-            return matchPersonInfo.getInt("PersonCode");
-
-        }else if (!libMatInfoListJson.getStr("MatchPersonID").equals("0") && org.apache.commons.lang3.StringUtils.isBlank(matchPersonInfo.getStr("PersonCode")) && StringUtils.isNotBlank(matchPersonInfo.getStr("PersonName"))){
-            String personName = matchPersonInfo.getStr("PersonName");
-            if (personName.contains("_")){
-                log.warn(personName+"校验成功但未找到personCode");
-                Integer personId =Integer.valueOf(personName.substring(personName.indexOf("_")+1)) ;
-                return personId;
-            }else {
-                log.warn(personName+"校验成功但姓名中无personCode后缀");
-                return 0;
-            }
+        if (org.apache.commons.lang.StringUtils.isNotBlank(libMatInfoListJson.getStr("MatchPersonID"))){
+            if (!libMatInfoListJson.getStr("MatchPersonID").equals("0") && org.apache.commons.lang3.StringUtils.isNotBlank(matchPersonInfo.getStr("PersonCode"))){
+                return matchPersonInfo.getInt("PersonCode");
+
+            }else if (!libMatInfoListJson.getStr("MatchPersonID").equals("0") && org.apache.commons.lang3.StringUtils.isBlank(matchPersonInfo.getStr("PersonCode")) && StringUtils.isNotBlank(matchPersonInfo.getStr("PersonName"))){
+                String personName = matchPersonInfo.getStr("PersonName");
+                if (personName.contains("_")){
+                    log.warn(personName+"校验成功但未找到personCode");
+                    Integer personId =Integer.valueOf(personName.substring(personName.indexOf("_")+1)) ;
+                    return personId;
+                }else {
+                    log.warn(personName+"校验成功但姓名中无personCode后缀");
+                    return 0;
+                }
 
 
-        }
+            }
 
-        else {
+            else {
+                return 0;
+            }
+        }else {
             return 0;
         }
+
+
     }
 
     public static boolean compareToInterval(BigDecimal bigDecimal, Integer min,Integer max){
@@ -185,8 +191,9 @@ public class LApiUtil {
       // long time = date.getTime();
      //   System.out.println(date);
       //  192.168.11.13:80/V1.0/PeopleLibraries/1584409665/People/1111?LastChange=1584428390872
-        boolean success = LApiUtil.compareToInterval(new BigDecimal(36.3),36,37);
-        System.out.println(success);
+        cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject();
+        Integer integer = getPersonCode(jsonObject,jsonObject);
+        System.out.println(integer);
 
     }
 

+ 6 - 0
common/src/main/java/com/jpsoft/smart/modules/common/utils/WeixinUtil.java

@@ -265,6 +265,12 @@ public class WeixinUtil {
 	}
 
 
+	/**
+	 * 创建微信菜单
+	 * @param appid
+	 * @param appSecret
+	 * @return
+	 */
 	public static String createMenu(String appid,String appSecret){
 		AccessToken token = WeixinUtil.getAccessToken(appid, appSecret);