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

[task-4854]
1.设备报废日提前一个月当天才推送首页通知

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

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

@@ -405,7 +405,8 @@ public class EquipmentMaintenancePlanJob  extends AbstractJob {
             //changeMessagePushUser(guanLiRen,pushuser);
 
             // 比较 出厂日期 加上N年后是否小于等于 当前日期
-            if (futureDate.isBefore(currDate) || futureDate.isEqual(currDate)) {
+            //if (futureDate.isBefore(currDate) || futureDate.isEqual(currDate)) {
+            if (futureDate.isEqual(currDate)) {
                 changeMessagePushUser2(bianZhiBuMeng,pushuser);
                 if(pushuser.isEmpty()){
                     //当保管人所在的所有组都没有专业组组长的时候推送给保管者
@@ -416,7 +417,9 @@ public class EquipmentMaintenancePlanJob  extends AbstractJob {
                             .collect(Collectors.toList());
                 }
                 for(String zhanghao : pushuser){
-                    Map<String, Object> rili = commonDao.queryOne("select id_ from ibps_party_user_calendar where type_='EQUIP_OVERDUE' and data_info_='t_sbdj' and data_source_id_='"+sourceId+"' and user_id_ = '"+zhanghao+"' limit 1");
+                    String nowDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
+                    Map<String, Object> rili = commonDao.queryOne("select id_ from ibps_party_user_calendar where type_='EQUIP_OVERDUE' and data_info_='t_sbdj' " +
+                            "and data_source_id_='"+sourceId+"' and user_id_ = '"+zhanghao+"' and start_time_='"+nowDate+"' limit 1");
                     // 已经 添加过的日程不再提醒
                     if (BeanUtils.isEmpty(rili)){
                         String yuanSheBeiBian = StringUtil.defaultString(eqMap.get("yuan_she_bei_bian").toString(),"");
@@ -429,8 +432,8 @@ public class EquipmentMaintenancePlanJob  extends AbstractJob {
                         calendarPo.setUserId(zhanghao);
                         calendarPo.setTitle("设备使用到期预提醒");
                         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.setStartTime(nowDate);
+                        calendarPo.setEndTime(nowDate);
                         calendarPo.setEmergencyState("2");
                         calendarPo.setId(UniqueIdUtil.getId());
                         calendarPo.setCreateBy("1");