|
|
@@ -10,6 +10,7 @@ import com.lc.ibps.base.saas.token.ITenantTokenService;
|
|
|
import com.lc.ibps.base.web.context.ContextUtil;
|
|
|
import com.lc.ibps.bpmn.api.IBpmInstService;
|
|
|
import com.lc.ibps.cloud.entity.APIResult;
|
|
|
+import com.lc.ibps.cloud.message.util.MessageQueueProductorUtil;
|
|
|
import com.lc.ibps.org.party.persistence.dao.PartyUserCalendarDao;
|
|
|
import com.lc.ibps.org.party.persistence.entity.PartyUserCalendarPo;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@@ -385,6 +386,8 @@ public class EquipmentMaintenancePlanJob extends AbstractJob {
|
|
|
String str = "一年";
|
|
|
LocalDate createDate;
|
|
|
ArrayList<String> pushuser = new ArrayList<>();
|
|
|
+ ArrayList<Map<String, Object>> msgInnerList = new ArrayList<>();//推送首页未读消息
|
|
|
+
|
|
|
try{
|
|
|
year = Integer.parseInt(heChaXiaoZhun);
|
|
|
createDate = LocalDate.parse(chuChangRiQi, formatter);
|
|
|
@@ -392,13 +395,20 @@ public class EquipmentMaintenancePlanJob extends AbstractJob {
|
|
|
// logger.warn("出厂日期或使用年限格式错误,无法转换!设备id_:{},出厂日期:{}, 使用年限:{}",sourceId,chuChangRiQi,heChaXiaoZhun);
|
|
|
continue;
|
|
|
}
|
|
|
+
|
|
|
LocalDate futureDate = createDate.plusYears(year - 1);//原来的逻辑错误,提前一年应该是到期日的前一年
|
|
|
LocalDate futureDate2 = createDate.plusMonths(year * 12 - 1);
|
|
|
+ LocalDate currDate = LocalDate.now();
|
|
|
+ LocalDate dueDate = currDate;
|
|
|
+
|
|
|
if("深圳恒生医院".equals(getSetting())){
|
|
|
futureDate = futureDate2 ;
|
|
|
str = "一个月";
|
|
|
+ eqMap.put("dueDate", dueDate.plusMonths(1).toString());
|
|
|
+ }else{
|
|
|
+ eqMap.put("dueDate", dueDate.plusYears(1).toString());
|
|
|
}
|
|
|
- LocalDate currDate = LocalDate.now();
|
|
|
+ msgInnerList.add(eqMap);
|
|
|
|
|
|
String guanLiRen = StringUtil.defaultString(eqMap.get("guan_li_ren_").toString(),"");
|
|
|
String bianZhiBuMeng = StringUtil.defaultString(eqMap.get("bian_zhi_bu_men_").toString(),"");
|
|
|
@@ -439,10 +449,29 @@ public class EquipmentMaintenancePlanJob extends AbstractJob {
|
|
|
calendarPo.setCreateBy("1");
|
|
|
calendarPo.setType("EQUIP_OVERDUE");
|
|
|
calendarDao.create(calendarPo);
|
|
|
+ sendMessage(msgInnerList,zhanghao);
|
|
|
logger.warn("设备到期提醒"+yuanSheBeiBian +":" + sheBeiMingCheng);
|
|
|
}
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void sendMessage(List<Map<String, Object>> list,String userIDs){
|
|
|
+ if(BeanUtils.isNotEmpty(list) && BeanUtils.isNotEmpty(userIDs)){
|
|
|
+ //转换接收人
|
|
|
+ List<String> receiver = Arrays.asList(userIDs.split(","));
|
|
|
+ String title = "设备使用到期预提醒";
|
|
|
+ String neiRong ="以下设备即将过期:<br>";
|
|
|
+ for (Map<String,Object> item : list) {
|
|
|
+ //拼接内容
|
|
|
+ if(neiRong.equals("以下设备即将过期:<br>")){
|
|
|
+ neiRong = neiRong + "设备名称:" + item.get("she_bei_ming_cheng_").toString() + "-到期日期:" + item.get("dueDate").toString();
|
|
|
+ }else{
|
|
|
+ neiRong = neiRong + "<br>" + "设备名称:" + item.get("she_bei_ming_cheng_").toString() + "-到期日期:" + item.get("dueDate").toString();
|
|
|
}
|
|
|
}
|
|
|
+ MessageQueueProductorUtil.send("EquipmentMaintenancePlanJob", "system" , "inner", receiver,null , title, neiRong, null, null, null);
|
|
|
}
|
|
|
}
|
|
|
|