Преглед изворни кода

设备校准消息提醒,设备编号依据全局配置判断是原设备编号还是设别编号

WuYi пре 2 дана
родитељ
комит
02142d9d4c

+ 21 - 2
ibps-provider-root/modules/provider-platform/src/main/java/com/lc/ibps/platform/plan/job/DeviceToDoRemindJob.java

@@ -1,15 +1,18 @@
 package com.lc.ibps.platform.plan.job;
 
 import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.JsonNode;
 import com.lc.ibps.base.core.constants.StringPool;
 import com.lc.ibps.base.core.util.AppUtil;
 import com.lc.ibps.base.core.util.BeanUtils;
+import com.lc.ibps.base.core.util.Collections;
 import com.lc.ibps.base.core.util.JacksonUtil;
 import com.lc.ibps.base.framework.table.ICommonDao;
 import com.lc.ibps.base.web.context.ContextUtil;
 import com.lc.ibps.cloud.message.util.MessageQueueProductorUtil;
 import com.lc.ibps.components.quartz.BaseJob2;
 import org.apache.commons.lang3.StringUtils;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.quartz.JobDataMap;
 import org.quartz.JobExecutionContext;
 import org.slf4j.Logger;
@@ -116,10 +119,26 @@ public class DeviceToDoRemindJob extends BaseJob2 {
 
     private void executeCalibrationCheck() {
         //  设备检定校准到期提醒
-        String sshjSql = "SELECT she_bei_shi_bie_h,she_bei_ming_cheng_,xiao_zhun_you_xia,bian_zhi_bu_men_ FROM t_sbdj" +
+        String sshjSql = "SELECT yuan_she_bei_bian,she_bei_shi_bie_h,she_bei_ming_cheng_,xiao_zhun_you_xia,bian_zhi_bu_men_ FROM t_sbdj" +
                 " WHERE shi_fou_xiao_zhun ='是' AND TO_DAYS(xiao_zhun_you_xia) - TO_DAYS(NOW())   <= 30 AND she_bei_zhuang_ta='合格'" +
                 " AND id_ NOT IN (SELECT c.she_bei_bian_hao_ FROM t_mjsbjdxzjh p,t_mjsbjdxzjhzb c WHERE p.id_=c.parent_id_ AND p.shi_fou_guo_shen_='已完成')" +
                 " ORDER BY bian_zhi_bu_men_,xiao_zhun_you_xia DESC";
+        String sel = " select setting from t_ipcc where id_ = '1' ";
+        List<Map<String, Object>> mapSetting = (List<Map<String, Object>>)commonDao.query(sel);
+        boolean flg = false;
+        if(Collections.isNotEmpty(mapSetting) ){
+            ObjectMapper mapper = new ObjectMapper();
+            try {
+                String setting = mapSetting.get(0).get("setting").toString();
+                JsonNode root = mapper.readTree(setting);
+                flg = root.path("verificationTag")
+                        .path("tagData")
+                        .path("originalDevice")
+                        .asBoolean();
+            }catch (Exception e){
+              logger.warn("全局配置中没有配置是否取原设备编号");
+            }
+        }
         List<Map<String, Object>> mapList = (List<Map<String, Object>>)commonDao.query(sshjSql);
         if (BeanUtils.isNotEmpty(mapList)){
             String preBumen = null;
@@ -136,7 +155,7 @@ public class DeviceToDoRemindJob extends BaseJob2 {
                     preBumen = deptId;
                     content = new StringJoiner("<br />").add(headerString);
                 }
-                String code = map.get("she_bei_shi_bie_h").toString();
+                String code = flg ? map.get("yuan_she_bei_bian").toString() : map.get("she_bei_shi_bie_h").toString();
                 String name = map.get("she_bei_ming_cheng_").toString();
                 String expDate = map.get("xiao_zhun_you_xia").toString();
                 content.add(String.format(format,code,name,expDate));