认证清单-催办接口完善。

This commit is contained in:
wangzhijiang
2023-03-10 10:45:42 +08:00
parent b01a1bf69f
commit b4f9099875
2 changed files with 98 additions and 45 deletions
@@ -12,12 +12,13 @@ public enum JumpLinkEnum {
* 103:跳转 项目库 - 任务清单
* 104:跳转 项目库 - 未符合项
* 105:跳转 项目库 - 认证参数收集
* 106:跳转 项目库 - 认证清单
*/
INVENTORY_AFFIRM_LINK("清单确认链接","1","/ProjectDetails?id=","&type=102"),
PREHOMO_AFFIRM_LINK("prehomo确认链接","2","/ProjectDetails?id=","&type=103"),
VERIFY_AFFIRM_LINK("验证符合性确认链接","3","/ProjectDetails?id=","&type=103"),
DESIGN_AFFIRM_LINK("设计符合性确认链接","4","/ProjectDetails?id=","&type=103"),
CERTIFICATION_INVENTORY_LINK("认证清单链接","5","/ProjectDetails?id=","&type=104"),
CERTIFICATION_INVENTORY_LINK("认证清单链接","5","/ProjectDetails?id=","&type=106"),
TASK_AFFIRM_LINK("任务确认链接","2","/ProcessCenter",""),
FGPG_TODO_CENTER_LINK("法规评估任务待办中心链接","88","/regulatoryAssessmentTasks",""),
XMCS_TODO_CENTER_LINK("项目参数任务待办中心链接","99","/projectParameterTasks",""),
@@ -1329,10 +1329,12 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
String projectLibraryId = json.getString("projectLibraryId");
ProjectLibraryBase projectLibraryBase = projectLibraryBaseService.queryById(projectLibraryId, CutEnum.EN.getValue()).get(0);
String PRN = projectLibraryBase.getProjectName();//项目名称
String PRN_EN = projectLibraryBase.getProjectName();//项目名称
if(ObjectUtils.isEmpty(projectLibraryBase)){
throw new JeroBootException("无法获取项目库信息,项目库id为:" + projectLibraryId + " 请联系管理员!");
}
// ProjectLibraryBase projectLibraryBaseCn = projectLibraryBaseService.queryById(projectLibraryId, CutEnum.CN.getValue()).get(0);
// String PRN_CN = projectLibraryBase.getProjectName();//项目名称
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> idList = Arrays.asList(ids.split(","));
@@ -1344,11 +1346,18 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){
//飞书跳转链接
String hrefFeishu = backUrl
String hrefFeishu_CN = backUrl
+ JumpLinkEnum.CERTIFICATION_INVENTORY_LINK.getLink()
+ projectLibraryId
+ JumpLinkEnum.CERTIFICATION_INVENTORY_LINK.getType()
+ "&" + PRN;
+ "&projectName=" + PRN_EN;
//飞书跳转链接
String hrefFeishu_EN = backUrl
+ JumpLinkEnum.CERTIFICATION_INVENTORY_LINK.getLink()
+ projectLibraryId
+ JumpLinkEnum.CERTIFICATION_INVENTORY_LINK.getType()
+ "&projectName=" + PRN_EN;
/**
* studio催办:除了 清单待发布、审查通过、认证退回 的 催办当前办理人
@@ -1363,45 +1372,72 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|| StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()));
}).collect(Collectors.toList());
String certificationEngineerIds = projectLibraryBase.getCertificationEngineer();
if(StringUtils.isNotEmpty(certificationEngineerIds)){
List<String> certificationEngineerIdList = Arrays.asList(certificationEngineerIds.split(","));
if(CollectionUtils.isNotEmpty(certificationInventoryEOList)){
String certificationEngineerIds = projectLibraryBase.getCertificationEngineer();
if(StringUtils.isNotEmpty(certificationEngineerIds)){
List<String> certificationEngineerIdList = Arrays.asList(certificationEngineerIds.split(","));
List<SysUser> certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList);
String standName = "";
String itemName = "";
List<SysUser> certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList);
StringBuilder standNameSb = new StringBuilder();
StringBuilder itemNameSb = new StringBuilder();
for (ProjectCertificationInventoryEO projectCertificationInventoryEO : certificationInventoryEOList) {
//TODO 处理数据,飞书卡片消息中展示的标准名称、条目名称 需求没有定如何展示,暂时无法处理。
}
// 根据结束时间进行排序,获取最近的时间,发消息时使用。
Collections.sort(certificationInventoryEOList, new Comparator<ProjectCertificationInventoryEO>() {
@Override
public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) {
return p1.getEndTime().compareTo(p2.getEndTime());
}
});
Date endTime = certificationInventoryEOList.get(0).getEndTime();
if(CollectionUtils.isNotEmpty(certificationEngineerList)){
for (String certificationEngineerId : certificationEngineerIdList) {
String thirdId = certificationEngineerList.stream().filter(certificationEngineer -> {
boolean flag = false;
if(StringUtils.equals(certificationEngineerId,certificationEngineer.getId())){
flag = true;
for (ProjectCertificationInventoryEO projectCertificationInventoryEO : certificationInventoryEOList) {
if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getInspectionItem())){
itemNameSb.append(projectCertificationInventoryEO.getInspectionItem()).append(",");
}
if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getSerialNumber())){
standNameSb.append(projectCertificationInventoryEO.getSerialNumber()).append(",");
}
}
String standName = "";
if(StringUtils.isNotEmpty(standNameSb.toString())){
standName = standNameSb.toString().substring(0,standNameSb.toString().length()-1);
}
String itemName = "";
if(StringUtils.isNotEmpty(itemNameSb.toString())){
itemName = itemNameSb.toString().substring(0,itemNameSb.toString().length()-1);
}
if(CollectionUtils.isNotEmpty(certificationEngineerList)){
for (String certificationEngineerId : certificationEngineerIdList) {
String thirdId = certificationEngineerList.stream().filter(certificationEngineer -> {
boolean flag = false;
if(StringUtils.equals(certificationEngineerId,certificationEngineer.getId())){
flag = true;
}
return flag;
}).collect(Collectors.toList()).get(0).getThirdId();
try {
JSONObject larkMesJson = new JSONObject();
larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE1.getValue());
larkMesJson.put("userIds",thirdId);
Map<String,Object> templateVariableMap = new HashMap<>();
templateVariableMap.put("projectNameCn",PRN_EN);
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);
larkMesJson.put("templateVariableMap",templateVariableMap);
this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson);
} catch (Exception e) {
log.error("飞书消息推送失败");
}
return flag;
}).collect(Collectors.toList()).get(0).getThirdId();
try {
JSONObject larkMesJson = new JSONObject();
larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE1.getValue());
larkMesJson.put("userIds",thirdId);
Map<String,Object> templateVariableMap = new HashMap<>();
templateVariableMap.put("projectName",PRN);
templateVariableMap.put("standName",standName);
templateVariableMap.put("itemName",itemName);
templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName());
templateVariableMap.put("endTime","");
templateVariableMap.put("back_url",hrefFeishu);
larkMesJson.put("templateVariableMap",templateVariableMap);
this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson);
} catch (Exception e) {
log.error("飞书消息推送失败");
}
}
}
@@ -1439,10 +1475,24 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
});
Date endTime = value.get(0).getEndTime();
String standName = "";
String itemName = "";
StringBuilder standNameSb = new StringBuilder();
StringBuilder itemNameSb = new StringBuilder();
for (ProjectCertificationInventoryEO projectCertificationInventoryEO : value) {
//TODO 处理数据,飞书卡片消息中展示的标准名称、条目名称 需求没有定如何展示,暂时无法处理。
if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getInspectionItem())){
itemNameSb.append(projectCertificationInventoryEO.getInspectionItem()).append(",");
}
if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getSerialNumber())){
standNameSb.append(projectCertificationInventoryEO.getSerialNumber()).append(",");
}
}
String standName = "";
if(StringUtils.isNotEmpty(standNameSb.toString())){
standName = standNameSb.toString().substring(0,standNameSb.toString().length()-1);
}
String itemName = "";
if(StringUtils.isNotEmpty(itemNameSb.toString())){
itemName = itemNameSb.toString().substring(0,itemNameSb.toString().length()-1);
}
try {
@@ -1451,12 +1501,14 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
larkMesJson.put("userIds",thirdId);
Map<String,Object> templateVariableMap = new HashMap<>();
templateVariableMap.put("projectName",PRN);
templateVariableMap.put("projectNameCn",PRN_EN);
templateVariableMap.put("projectNameEn",PRN_EN);
templateVariableMap.put("standName",standName);
templateVariableMap.put("itemName",standName);
templateVariableMap.put("itemName",itemName);
templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName());
templateVariableMap.put("endTime",DateUtils.formatDate(endTime));
templateVariableMap.put("back_url",hrefFeishu);
templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN);
templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN);
larkMesJson.put("templateVariableMap",templateVariableMap);
this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson);