Просмотр исходного кода

[task-4854] 任务设备档案增加使用年限到期提醒开发
1.修改原来设备到期日提错误逻辑,业务是到期前一年提醒但是实际是到期才提醒
2.恒生医院到期前一个月提醒设备管理员,其他医院不变保持原来逻辑

xiexh 8 месяцев назад
Родитель
Сommit
8339a14411

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

@@ -201,6 +201,7 @@ public class EquipmentMaintenancePlanJob  extends AbstractJob {
             String heChaXiaoZhun = StringUtil.defaultString(eqMap.get("he_cha_xiao_zhun_").toString(),"");
             String chuChangRiQi = StringUtil.defaultString(eqMap.get("chu_chang_ri_qi_").toString(),"");
             int year;
+            String str = "一年";
             LocalDate createDate;
             try{
                 year = Integer.parseInt(heChaXiaoZhun);
@@ -209,7 +210,12 @@ public class EquipmentMaintenancePlanJob  extends AbstractJob {
                 // logger.warn("出厂日期或使用年限格式错误,无法转换!设备id_:{},出厂日期:{}, 使用年限:{}",sourceId,chuChangRiQi,heChaXiaoZhun);
                 continue;
             }
-            LocalDate futureDate = createDate.plusYears(year);
+            LocalDate futureDate = createDate.plusYears(year - 1);//原来的逻辑错误,提前一年应该是到期日的前一年
+            LocalDate futureDate2 = createDate.plusMonths(year * 12 - 1);
+            if("深圳恒生医院".equals(getSetting())){
+                futureDate = futureDate2 ;
+                str = "一个月";
+            }
             LocalDate currDate = LocalDate.now();
             // 比较 出厂日期 加上N年后是否小于等于 当前日期
             if (futureDate.isBefore(currDate) || futureDate.isEqual(currDate)) {
@@ -225,7 +231,7 @@ public class EquipmentMaintenancePlanJob  extends AbstractJob {
                     calendarPo.setDataInfo("t_sbdj");
                     calendarPo.setUserId(guanLiRen);
                     calendarPo.setTitle("设备使用到期预提醒");
-                    calendarPo.setContent("根据出厂日期和使用年限计算得知,\n设备:【"+yuanSheBeiBian +" "+ sheBeiMingCheng + "】 已达最大使用年限或将在一年后到期。\n出厂日期:"+chuChangRiQi+"。\n使用年限:"+heChaXiaoZhun+"年。");
+                    calendarPo.setContent("根据出厂日期和使用年限计算得知,\n设备:【"+yuanSheBeiBian +" "+ sheBeiMingCheng + "】 已达最大使用年限或将在"+str+"后到期。\n出厂日期:"+chuChangRiQi+"。\n使用年限:"+heChaXiaoZhun+"年。");
                     calendarPo.setStartTime(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
                     calendarPo.setEndTime(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
                     calendarPo.setEmergencyState("2");
@@ -259,4 +265,14 @@ public class EquipmentMaintenancePlanJob  extends AbstractJob {
         }
     }
 
+    public String getSetting() {
+        String sql = "select id_,dan_wei_ming_chen from t_ipcc where id_ = '1'";
+        List<Map<String, Object>> list = (List<Map<String, Object>>) commonDao.query(sql);
+        String danWeiMingChen = "";
+        if(list.size()>0 && BeanUtils.isNotEmpty(list.get(0).get("dan_wei_ming_chen"))){
+            danWeiMingChen = list.get(0).get("dan_wei_ming_chen").toString();
+        }
+        return danWeiMingChen;
+    }
+
 }