任务清单列表查询 - 使用stream使用流进行多字段排序(法规创建日期、法规号)。

流程中涉及到发送消息 - 去掉 (project name) 内容。
This commit is contained in:
wangzhijiang
2022-05-26 15:29:59 +08:00
parent 9c3445dad8
commit 4b1d2fca5c
9 changed files with 31 additions and 20 deletions
@@ -303,4 +303,8 @@ public class ProjectTaskInventoryEO implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "流程结束时间 最后的时间")
private Date processEndTime;
/**法规清单创建日期,任务清单中需要根据此字段进行倒序排序**/
@TableField(exist = false)
private Date lawsInventoryCreateTime;
}
@@ -10,6 +10,7 @@ public enum DesignComplianceStatusEnum {
TO_SUBMIT("待提交","To submit"),
TO_REVIEW("待审查","To approve"),
REVIEW_COMPLETED("审查完成","Complete"),
REVIEW_THE_RETURN("审查退回","Returned"),
;
@@ -119,7 +119,7 @@ public class InventoryAffirmJob implements Job {
// XXX .
String msgContentEN = "The remaining processing time for the regulation list confirmation of"
+ projectNameInfoEO.getProjectName()
+ "(project name) is 3 days. Please check and handle it in time.";
+ " is 3 days. Please check and handle it in time.";
//发送消息
projectLawsInventoryEOService.sendMessage(msgContentEN,threeDaysUserIdList,projectLibraryBase.getId());
}
@@ -130,7 +130,7 @@ public class InventoryAffirmJob implements Job {
/*String msgContentCN = "您" + projectLibraryBase.getProjectName() + "(项目名称)法规清单的任务今天即将结束,请及时查看处理*/
String msgContentEN = "The the regulation list confirmation of "
+ projectNameInfoEO.getProjectName()
+ "(project name) is coming to an end today. Please check and deal with it in time";
+ " is coming to an end today. Please check and deal with it in time";
//发送消息
projectLawsInventoryEOService.sendMessage(msgContentEN,currentDaysUserIdList,projectLibraryBase.getId());
}
@@ -125,7 +125,7 @@ public class PrehomoJob implements Job {
//The remaining processing time for the Pre-Homo confirmation of GB 7258 in XXX (project name) is 3 days. Please check and handle it in time.
String msgContentEN = "The remaining processing time for the Pre-Homo confirmation of "
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName()
+ " (project name) is 3 days. Please check and handle it in time.";
+ " is 3 days. Please check and handle it in time.";
//发送消息
projectLawsInventoryEOService.sendMessage(msgContentEN,threeDaysUserIdList,projectLawsInventoryEO.getId());
}
@@ -137,7 +137,7 @@ public class PrehomoJob implements Job {
//The the Pre-Homo confirmation of GB 7258 in XXX (project name) is coming to an end today. Please check and deal with it in time
String msgContentEN = "The the Pre-Homo confirmation of "
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName()
+ " (project name) is coming to an end today. Please check and deal with it in time.";
+ " is coming to an end today. Please check and deal with it in time.";
//发送消息
projectLawsInventoryEOService.sendMessage(msgContentEN,currentDaysUserIdList,projectLawsInventoryEO.getId());
}
@@ -125,7 +125,7 @@ public class VerifyComplianceJob implements Job {
//The remaining processing time for the Verify compliance confirmation of GB 7258 in XXX (project name) is 3 days. Please check and handle it in time.
String msgContentEN = "The remaining processing time for the Verify compliance confirmation of "
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName()
+ " (project name) is 3 days. Please check and handle it in time.";
+ " is 3 days. Please check and handle it in time.";
//发送消息
projectLawsInventoryEOService.sendMessage(msgContentEN,threeDaysUserIdList,projectLawsInventoryEO.getId());
}
@@ -137,7 +137,7 @@ public class VerifyComplianceJob implements Job {
//The the Verify compliance confirmation of GB 7258 in XXX (project name) is coming to an end today. Please check and deal with it in time
String msgContentEN = "The the Verify compliance confirmation of "
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName()
+ " (project name) is coming to an end today. Please check and deal with it in time.";
+ " is coming to an end today. Please check and deal with it in time.";
//发送消息
projectLawsInventoryEOService.sendMessage(msgContentEN,currentDaysUserIdList,projectLawsInventoryEO.getId());
}
@@ -121,7 +121,7 @@ public class designComplianceJob implements Job {
//您XXX(项目名称)中GB 7258的设计符合性确认剩余处理时间还有3天,请及时查看处理
String msgContentEN = "The remaining processing time for the design compliance confirmation of "
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName()
+ " (project name) is 3 days. Please check and handle it in time.";
+ " is 3 days. Please check and handle it in time.";
//发送消息
projectLawsInventoryEOService.sendMessage(msgContentEN,threeDaysUserIdList,projectLawsInventoryEO.getId());
}
@@ -132,7 +132,7 @@ public class designComplianceJob implements Job {
//您XXX(项目名称)中GB 7258的设计符合性确认任务今天即将结束,请及时查看处理
String msgContentEN = "The the design compliance confirmation of "
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName()
+ " (project name) is coming to an end today. Please check and deal with it in time.";
+ " is coming to an end today. Please check and deal with it in time.";
//发送消息
projectLawsInventoryEOService.sendMessage(msgContentEN,currentDaysUserIdList,projectLawsInventoryEO.getId());
}
@@ -981,7 +981,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
//消息内容
String msgContentEN = currentUser.getUsername() + " initiated the regulation list confirmation of " + projectNameInfoEO.getProjectName()
+ " (project name). The due date is" +inventoryAffirmDueDate+ ". Please check and deal with it in time.";
+ ". The due date is" +inventoryAffirmDueDate+ ". Please check and deal with it in time.";
//发送消息
sendMessage(msgContentEN,userIdList,projectLibraryId);
@@ -1411,20 +1411,20 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
if (StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_START_MSG.getValue())) {
userIdList.add(engineeringInterfacePerson);
msgContentEN = sysUser.getUsername() + " initiated the regulation list confirmation of " + projectNameInfoEO.getProjectName()
+ " (project name).The due date is" +taskAffirmDueDate+ " Please check and deal with it in time.";
+ ".The due date is" +taskAffirmDueDate+ " Please check and deal with it in time.";
} else if (StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_ISSUE_DRE_MSG.getValue())) {
String dreUserId = jsonObject.getString("dreUserId"); //dre用户id
userIdList.add(dreUserId);
msgContentEN = sysUser.getUsername() + " has distributed the regulation task confirmation of " + serialNumber + " in "+ projectNameInfoEO.getProjectName()
+ " (project name).to you. the due date is " +taskAffirmDueDate+ " Please check and handle it in time.";
+ ".to you. the due date is " +taskAffirmDueDate+ " Please check and handle it in time.";
} else if (StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_DRE_REJECTED.getValue())) {
userIdList.add(engineeringInterfacePerson);
msgContentEN = sysUser.getUsername() + " has returned the regulation task confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
+ " (project name).the due date is " +taskAffirmDueDate+ " Please check and handle it in time.";
+ ".the due date is " +taskAffirmDueDate+ " Please check and handle it in time.";
} else if (StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_DRE_ACCEPTED.getValue())) {
userIdList.add(engineeringInterfacePerson);
msgContentEN = sysUser.getUsername() + " has submitted the regulation task confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
+ " (project name).the due date is " +taskAffirmDueDate+ " Please check and handle it in time.";
+ ".the due date is " +taskAffirmDueDate+ " Please check and handle it in time.";
}
if(CollectionUtils.isNotEmpty(userIdList) && StringUtils.isNotEmpty(msgContentEN)){
@@ -255,17 +255,17 @@ public class ProjectTaskInventoryDetailEOServiceImpl extends ServiceImpl<Project
//XXX has distributed the design compliance confirmation process of GB 7258 in XXX (project name) to you. Please check and handle it in time.
msgContentEN = currentUser.getUsername() + " has distributed the design compliance confirmation process of "
+ projectLawsInventoryEO.getSerialNumber() + " in "+ projectNameInfoEO.getProjectName()
+ " (project name) to you. Please check and handle it in time.";
+ " to you. Please check and handle it in time.";
}else if(org.apache.commons.lang3.StringUtils.equals(projectTaskInventoryDetailEO.getMsgType(), MsgTypeEnum.PREHOMO_ISSUE_DRE_MSG.getValue())){
//XXX has distributed the Pre-Homo confirmation process of GB 7258 in XXX (project name) to you. Please check and handle it in time.
msgContentEN = currentUser.getUsername() + " has distributed the Pre-Homo confirmation process of "
+ projectLawsInventoryEO.getSerialNumber() + " in "+ projectNameInfoEO.getProjectName()
+ " (project name) to you. Please check and handle it in time.";
+ " to you. Please check and handle it in time.";
}else if(org.apache.commons.lang3.StringUtils.equals(projectTaskInventoryDetailEO.getMsgType(), MsgTypeEnum.VERIFY_ISSUE_DRE_MSG.getValue())){
//XXX has distributed the Verify compliance confirmation process of GB 7258 in XXX (project name) to you. Please check and handle it in time.
msgContentEN = currentUser.getUsername() + " has distributed the Verify compliance confirmation process of "
+ projectLawsInventoryEO.getSerialNumber() + " in "+ projectNameInfoEO.getProjectName()
+ " (project name) to you. Please check and handle it in time.";
+ " to you. Please check and handle it in time.";
}
if(CollectionUtils.isNotEmpty(userIdList) && org.apache.commons.lang3.StringUtils.isNotEmpty(msgContentEN)){
//发送消息
@@ -190,6 +190,7 @@ public class ProjectTaskInventoryEOServiceImpl extends ServiceImpl<ProjectTaskIn
projectTaskInventory.setDesignDueDate(projectLawsInventory.getDesignDueDate());
projectTaskInventory.setVerifyDueDate(projectLawsInventory.getVerifyDueDate());
projectTaskInventory.setPrehomoDueDate(projectLawsInventory.getPrehomoDueDate());
projectTaskInventory.setLawsInventoryCreateTime(projectLawsInventory.getCreateTime());
}
});
});
@@ -198,6 +199,11 @@ public class ProjectTaskInventoryEOServiceImpl extends ServiceImpl<ProjectTaskIn
}
}
if(CollectionUtils.isNotEmpty(result)){
//stream使用流进行多字段排序 方法:先对法规创建日期进行升序排序,升序结果进行反转,再对法规编号进行降序排序
result = result.stream().sorted(
Comparator.comparing(ProjectTaskInventoryEO::getLawsInventoryCreateTime).reversed()
.thenComparing(ProjectTaskInventoryEO::getSerialNumber, Comparator.reverseOrder())
).collect(Collectors.toList());
disposeData(result,projectTaskInventoryEO.getCut());
}
return result;
@@ -303,17 +309,17 @@ public class ProjectTaskInventoryEOServiceImpl extends ServiceImpl<ProjectTaskIn
//Please check and deal with the design compliance confirmation process of GB 7258 in XXX (project name) in time.
msgContentEN = "Please check and deal with the design compliance confirmation process of "
+ serialNumber + " in "+ projectNameInfoEO.getProjectName()
+ " (project name) in time.";
+ " in time.";
}else if(StringUtils.equals(msgType,MsgTypeEnum.PREHOMO_REMIND_MSG.getValue())){
//Please check and deal with the Pre-Homo confirmation process of GB 7258 in XXX (project name) in time.
msgContentEN = "Please check and deal with the Pre-Homo confirmation process of "
+ serialNumber + " in "+ projectNameInfoEO.getProjectName()
+ " (project name) in time.";
+ " in time.";
}else if(StringUtils.equals(msgType,MsgTypeEnum.VERIFY_REMIND_MSG.getValue())){
//Please check and deal with the Verify compliance confirmation process of GB 7258 in XXX (project name) in time.
msgContentEN = "Please check and deal with the Verify compliance confirmation process of "
+ serialNumber + " in "+ projectNameInfoEO.getProjectName()
+ " (project name) in time.";
+ " in time.";
}
if(CollectionUtils.isNotEmpty(userIdList) && StringUtils.isNotEmpty(msgContentEN)){
@@ -583,7 +589,7 @@ public class ProjectTaskInventoryEOServiceImpl extends ServiceImpl<ProjectTaskIn
if (StringUtils.equals(msgType, MsgTypeEnum.DESIGN_ISSUE_DRE_MSG.getValue())) {
msgContentEN = sysUser.getUsername() + "has distributed the design compliance confirmation process of " + serialNumber + " in "+ projectNameInfoEO.getProjectName()
+ " (project name) to you. Please check and handle it in time.";
+ " to you. Please check and handle it in time.";
}
if(CollectionUtils.isNotEmpty(userIdList) && StringUtils.isNotEmpty(msgContentEN)){