认证清单-认证工程师发起流程,责任人收到消息
This commit is contained in:
+1
@@ -15,6 +15,7 @@ public enum TemplateInfoEnum2 {
|
||||
CERTIFICATION_MESSAGE7("认证清单-任务提醒,截止日期当天","ctp_AAuDmfXCHc1I"),
|
||||
CERTIFICATION_MESSAGE8("认证清单-任务提醒,已逾期","ctp_AAuDMwOPU71H"),
|
||||
//CERTIFICATION_MESSAGE9("认证清单-责任人分发(转办),第二责任人收到消息","ctp_AAuDM8YP6soc"),
|
||||
CERTIFICATION_MESSAGE10("认证工程师发起流程,责任人收到消息","ctp_AAuePL6rUK1L"),
|
||||
;
|
||||
|
||||
String name;
|
||||
|
||||
+70
@@ -1565,6 +1565,15 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
throw new JeroBootException("无法获取项目库信息");
|
||||
}
|
||||
|
||||
String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文
|
||||
String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文
|
||||
|
||||
// 获取认证清单 - 飞书跳转链接
|
||||
Map<String, Object> hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN);
|
||||
String hrefFeishu_CN = (String) hrefFeishuMap.get("hrefFeishu_CN");
|
||||
String hrefFeishu_EN = (String) hrefFeishuMap.get("hrefFeishu_EN");
|
||||
|
||||
Map<String, List<ProjectCertificationInventoryEO>> certifycationInventoryListByDutyPersonMap = projectCertificationInventoryEOList.stream().collect(Collectors.groupingBy(ProjectCertificationInventoryEO::getDutyPerson));
|
||||
try {
|
||||
List<ProjectCertificationInventoryLogEO> projectCertificationInventoryLogEOList = new ArrayList<>();
|
||||
// 给责任人分配待办中心的任务
|
||||
@@ -1600,6 +1609,51 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
// 更新该项目认证流程中,认证工程师的任务状态。
|
||||
// 如果还有 清单待校核、责任人拒绝 状态的数据,不做操作,如果没有 将这个项目认证流程的所有认证工程师待办任务转为已办
|
||||
this.updateProcessInfoDetailStatus(projectLibraryBase,CertificationFlowNodeEnum.RZGCSJSRW.getKey(),flowStatusList);
|
||||
|
||||
List<String> dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList());
|
||||
List<SysUser> dutyPersonList = this.sysUserService.querySysUserListByIdList(dutyPersonIdList);
|
||||
|
||||
for (Map.Entry<String, List<ProjectCertificationInventoryEO>> dataByDutyPersonMap : certifycationInventoryListByDutyPersonMap.entrySet()) {
|
||||
String dutyPersonUserId = dataByDutyPersonMap.getKey();
|
||||
List<ProjectCertificationInventoryEO> dutyPersonDataList = dataByDutyPersonMap.getValue();
|
||||
if(CollectionUtils.isEmpty(dutyPersonDataList)){
|
||||
continue;
|
||||
}
|
||||
|
||||
Map<String, Object> standNameAndItemName = this.projectCertificationInventoryEOService.getStandNameAndItemName(dutyPersonDataList);
|
||||
String standName = (String) standNameAndItemName.get("standName");
|
||||
String itemName = (String) standNameAndItemName.get("itemName");
|
||||
try {
|
||||
String thirdId = this.sysUserService.getUserThirdIdByUserId(dutyPersonList,dutyPersonUserId);
|
||||
|
||||
if(StringUtils.isNotEmpty(thirdId)){
|
||||
// 根据结束时间进行排序,获取最近的时间,发消息时使用。
|
||||
this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
|
||||
Date endTime = projectCertificationInventoryEOList.get(0).getEndTime();
|
||||
|
||||
JSONObject larkMesJson = new JSONObject();
|
||||
larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE10.getValue());
|
||||
larkMesJson.put("userIds",thirdId);
|
||||
|
||||
Map<String,Object> templateVariableMap = new HashMap<>();
|
||||
templateVariableMap.put("projectNameCn",PRN_CN);
|
||||
templateVariableMap.put("projectNameEn",PRN_EN);
|
||||
templateVariableMap.put("standName",standName);
|
||||
templateVariableMap.put("itemName",itemName);
|
||||
templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName());
|
||||
templateVariableMap.put("endTime",DateUtils.formatDate(endTime));
|
||||
templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN);
|
||||
templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN);
|
||||
templateVariableMap.put("certificationEngineer",currentUser.getUsername());
|
||||
|
||||
larkMesJson.put("templateVariableMap",templateVariableMap);
|
||||
this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("飞书消息推送失败");
|
||||
}
|
||||
}
|
||||
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
log.error("认证工程师-发起认证清单任务失败:" + ex.getMessage());
|
||||
@@ -1609,6 +1663,22 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
return Result.OK("发起任务成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 认证清单数据排序,根据截至时间顺序排序
|
||||
* @param projectCertificationInventoryEOList
|
||||
*/
|
||||
private void certificationInventoryEOListSortByEndTimeAsc(List<ProjectCertificationInventoryEO> projectCertificationInventoryEOList) {
|
||||
Collections.sort(projectCertificationInventoryEOList, new Comparator<ProjectCertificationInventoryEO>() {
|
||||
@Override
|
||||
public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) {
|
||||
if(p1.getEndTime() != null && p2.getEndTime() != null){
|
||||
return p1.getEndTime().compareTo(p2.getEndTime());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> saveBatch(JSONObject json) {
|
||||
if (!json.containsKey("dataList")) {
|
||||
|
||||
Reference in New Issue
Block a user