法规技术评估模块消息完毕

This commit is contained in:
CD
2022-10-27 10:30:23 +08:00
parent 103b287366
commit 835c005f6c
3 changed files with 88 additions and 10 deletions
@@ -2,6 +2,7 @@ package com.jero.modules.lawsTechnologyEvaluation.job;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.common.exception.JeroBootException;
import com.jero.modules.lawsOpinionGather.enums.GatherResultEnum;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationEO;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationFlowDetailEO;
@@ -52,14 +53,16 @@ public class LawsTechnologyEvaluationRemindJob implements Job {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//获取后一天的时间
Calendar calendar=new GregorianCalendar();
calendar.setTime(new Date());
calendar.add(Calendar.DATE,1);
Date nextDay = calendar.getTime();
//Calendar calendar=new GregorianCalendar();
//calendar.setTime(new Date());
//calendar.add(Calendar.DATE,1);
//Date nextDay = calendar.getTime();
String nextDayStr = sdf.format(nextDay);
//String nextDayStr = sdf.format(nextDay);
String now = sdf.format(new Date());
LawsTechnologyEvaluationEOList.forEach(lawsTechnologyEvaluationEO -> {
if(StringUtils.equals(nextDayStr,sdf.format(lawsTechnologyEvaluationEO.getEndTime()))){
/*if(StringUtils.equals(nextDayStr,sdf.format(lawsTechnologyEvaluationEO.getEndTime()))){
String actiProcInstIds = flowDetailList.stream().filter(flowDetail -> {
boolean flag = false;
@@ -80,6 +83,56 @@ public class LawsTechnologyEvaluationRemindJob implements Job {
this.lawsTechnologyEvaluationEOService.workFlowSendMsg(sendJsonObject);
}
}
}*/
String endTime = sdf.format(lawsTechnologyEvaluationEO.getEndTime());
int days = 0;
try {
days = (int) (sdf.parse(endTime).getTime() - sdf.parse(now).getTime()) / (24 * 60 * 60 * 1000);
} catch (Exception e) {
e.printStackTrace();
throw new JeroBootException("日期转换错误");
}
if (days == 3) {
//到期前3天
String actiProcInstIds = flowDetailList.stream().filter(flowDetail -> {
boolean flag = false;
if (StringUtils.equals(lawsTechnologyEvaluationEO.getId(), flowDetail.getLawsTechnologyEvaluationId())) {
flag = true;
}
return flag;
}).map(LawsTechnologyEvaluationFlowDetailEO::getActiProcInstId).distinct().collect(Collectors.joining(","));
if(StringUtils.isNotEmpty(actiProcInstIds)){
List<String> userIdList = this.workFlowFeignClient.getTaskAssigneeListByPrcIds(actiProcInstIds);
if(CollectionUtils.isNotEmpty(userIdList)){
JSONObject sendJsonObject = new JSONObject();
sendJsonObject.put("msgType", MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_THREE_DAYS_BEFORE_MSG.getValue());
sendJsonObject.put("lawsTechnologyEvaluationId",lawsTechnologyEvaluationEO.getId());
sendJsonObject.put("userIdList",userIdList);
this.lawsTechnologyEvaluationEOService.workFlowSendMsg(sendJsonObject);
}
}
} else if (endTime.equals(now)){
//当天
String actiProcInstIds = flowDetailList.stream().filter(flowDetail -> {
boolean flag = false;
if (StringUtils.equals(lawsTechnologyEvaluationEO.getId(), flowDetail.getLawsTechnologyEvaluationId())) {
flag = true;
}
return flag;
}).map(LawsTechnologyEvaluationFlowDetailEO::getActiProcInstId).distinct().collect(Collectors.joining(","));
if(StringUtils.isNotEmpty(actiProcInstIds)){
List<String> userIdList = this.workFlowFeignClient.getTaskAssigneeListByPrcIds(actiProcInstIds);
if(CollectionUtils.isNotEmpty(userIdList)){
JSONObject sendJsonObject = new JSONObject();
sendJsonObject.put("msgType", MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_TODAY_MSG.getValue());
sendJsonObject.put("lawsTechnologyEvaluationId",lawsTechnologyEvaluationEO.getId());
sendJsonObject.put("userIdList",userIdList);
this.lawsTechnologyEvaluationEOService.workFlowSendMsg(sendJsonObject);
}
}
}
});
}
@@ -708,20 +708,43 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
"\n标题: " + name +
"\n发起人: " + initiator +
"\n截止时间: " + endTime;
enContentUpper = "\n" +
"Hello! The assessment result you submitted has been rejected. Please check and address it in a timely manner";
enContentUpper = "Hello! The assessment result you submitted has been rejected. Please check and address it in a timely manner";
enContentLower = "Regulation No :" + number +
"\nTitle: " + name +
"\nInitiator: " + initiator +
"\nDue Date: " + endTime;
}/*else if(StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_MSG.getValue())){
} else if (StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_THREE_DAYS_BEFORE_MSG.getValue())) {
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
cnContentUpper = "您好,该任务将于3天后到期,请及时查看处理,谢谢!";
cnContentLower = "编号:" + number +
"\n标题: " + name +
"\n发起人: " + initiator;
enContentUpper = "Hello! This task will expire in 3 days. Please check and address the task in a timely manner. Thank you!";
enContentLower = "Regulation No :" + number +
"\nTitle: " + name +
"\nInitiator: " + initiator;
userIdList = (List<String>) jsonObject.get("userIdList");
} else if (StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_TODAY_MSG.getValue())) {
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
cnContentUpper = "您好,该任务将于今天到期,请尽快查看处理,谢谢!";
cnContentLower = "编号:" + number +
"\n标题: " + name +
"\n发起人: " + initiator;
enContentUpper = "Hello! This task will expire today. Please check and address the task ASAP. Thank you!";
enContentLower = "Regulation No :" + number +
"\nTitle: " + name +
"\nInitiator: " + initiator;
userIdList = (List<String>) jsonObject.get("userIdList");
} /*else if (StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_MSG.getValue())) {
userIdList = (List<String>) jsonObject.get("userIdList");
//您GB 7258的法规技术评估流程将于明天结束,请及时查看处理
//msgContentEN = "The the Regulatory and technical assessment of "+serialNumber+" will expire tomorrow. Please check and address it in time.";
//msgTitle = "You have a Regulatory and technical assessment task to complete";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
}*/
} */
List<String> thirdIdList = new ArrayList<>();
List<SysUser> sysUsers = sysUserService.listByIds(userIdList);
@@ -40,6 +40,8 @@ public enum MsgTypeEnum {
LAWS_TECHNOLOGY_EVALUATION_AUDIT_ACCEPTED_MSG("法规技术评估,发起人审核通过消息","lawsTechnologyEvaluationAuditAcceptedMsg"),
LAWS_TECHNOLOGY_EVALUATION_AUDIT_REJECTED_MSG("法规技术评估,发起人审核拒绝消息","lawsTechnologyEvaluationAuditRejectedMsg"),
LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_MSG("法规技术评估到期前一天消息","lawsTechnologyEvaluationExpireRemindMsg"),
LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_THREE_DAYS_BEFORE_MSG("法规技术评估到期前三天消息","lawsTechnologyEvaluationExpireRemindThreeDaysBeforeMsg"),
LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_TODAY_MSG("法规技术评估到期当天消息","lawsTechnologyEvaluationExpireRemindTodayMsg"),
;
String name;