Merge remote-tracking branch 'origin/dev_20230912_Platform' into dev_20230912_Platform

This commit is contained in:
zyx.net
2023-09-18 16:26:36 +08:00
@@ -2811,10 +2811,14 @@ public class PlatformProjectCertificationInventoryEOServiceImpl extends ServiceI
ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class);
// 给认证工程师分配待办中心的任务
String certificationEngineer = projectLibraryBase.getCertificationEngineer();
if(StringUtils.isEmpty(certificationEngineer)){
throw new JeroBootException("该项目中认证工程师为空,请先维护认证工程师!");
}
// String certificationEngineer = projectLibraryBase.getCertificationEngineer();
// if(StringUtils.isEmpty(certificationEngineer)){
// throw new JeroBootException("该项目中认证工程师为空,请先维护认证工程师!");
// }
String lawsEngineer = projectLibraryBase.getCreateBy();
SysUser userByName = sysUserService.getUserByName(lawsEngineer);
for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) {
projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue());
@@ -2854,20 +2858,18 @@ public class PlatformProjectCertificationInventoryEOServiceImpl extends ServiceI
this.certificationInventoryEOListSortByInventoryVerifyEndTimeAsc(projectCertificationInventoryEOList);
List<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
List<String> certificationEngineerList = Arrays.asList(certificationEngineer.split(","));
// List<String> certificationEngineerList = Arrays.asList(certificationEngineer.split(","));
// 给认证工程师分配任务
for (String userId : certificationEngineerList) {
ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO();
processInfoDetailEO.setUserId(userId);
processInfoDetailEO.setTaskDefinitionKey(CertificationFlowNodeEnum.RZGCSJSRW.getKey());
processInfoDetailEO.setCreateTime(new Date());
processInfoDetailEO.setStatus(TaskStatusEnum.NOT_DONE.getValue());
processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId());
processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId());
processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue());
processInfoDetailEO.setEndTime(projectCertificationInventoryEOList.get(0).getInventoryVerifyEndTime());
processInfoDetailEOList.add(processInfoDetailEO);
}
ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO();
processInfoDetailEO.setUserId(userByName.getId());
processInfoDetailEO.setTaskDefinitionKey(CertificationFlowNodeEnum.RZGCSJSRW.getKey());
processInfoDetailEO.setCreateTime(new Date());
processInfoDetailEO.setStatus(TaskStatusEnum.NOT_DONE.getValue());
processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId());
processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId());
processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue());
processInfoDetailEO.setEndTime(projectCertificationInventoryEOList.get(0).getInventoryVerifyEndTime());
processInfoDetailEOList.add(processInfoDetailEO);
// 删除该项目数据的待办任务key为 认证工程师接受任务的数据
QueryWrapper<ProcessInfoDetailEO> deleteDetailWrap = new QueryWrapper<>();
@@ -2879,37 +2881,29 @@ public class PlatformProjectCertificationInventoryEOServiceImpl extends ServiceI
// 责任人接受任务将数据的状态更新为 结果待提交
this.updateBatchById(projectCertificationInventoryEOList);
List<SysUser> certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList);
try {
for (String userId : certificationEngineerList) {
String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineers,userId);
if(StringUtils.isNotEmpty(thirdId)){
// 根据结束时间进行排序获取最近的时间发消息时使用
if(ObjectUtils.isNotEmpty(userByName) && StringUtils.isNotBlank(userByName.getThirdId())){
// 根据结束时间进行排序获取最近的时间发消息时使用
// this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
Date endTime = projectCertificationInventoryEOList.get(0).getInventoryVerifyEndTime();
Date endTime = projectCertificationInventoryEOList.get(0).getInventoryVerifyEndTime();
JSONObject larkMesJson = new JSONObject();
larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE11.getValue());
larkMesJson.put("userIds",thirdId);
JSONObject larkMesJson = new JSONObject();
larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE11.getValue());
larkMesJson.put("userIds",userByName.getThirdId());
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("viewBtnUrlCnPhone",hrefFeishu_CN_P);
templateVariableMap.put("operateUserName",currentUser.getUsername());
larkMesJson.put("templateVariableMap",templateVariableMap);
this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson);
}
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("viewBtnUrlCnPhone",hrefFeishu_CN_P);
templateVariableMap.put("operateUserName",currentUser.getUsername());
larkMesJson.put("templateVariableMap",templateVariableMap);
this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson);
}
} catch (Exception e) {
log.error("飞书消息推送失败");
@@ -2921,6 +2915,142 @@ public class PlatformProjectCertificationInventoryEOServiceImpl extends ServiceI
}
return Result.OK("拒绝任务成功!");
}
// private Result<?> dutyPersonRejectTask(JSONObject json) {
// LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//
// String ids = json.getString("ids");
// if(StringUtils.isEmpty(ids)){
// throw new JeroBootException("至少选择一条数据进行操作!");
// }
// String reasonForReturn = json.getString("reasonForReturn");
//
// List<String> idList = Arrays.asList(ids.split(","));
//
// List<String> flowStatusList = new ArrayList<>();
// flowStatusList.add(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue());
//
// QueryWrapper<ProjectCertificationInventoryEO> queryWrapper = new QueryWrapper<>();
// queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,idList);
// queryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList);
// List<ProjectCertificationInventoryEO> projectCertificationInventoryEOList = this.list(queryWrapper);
//
// if(CollectionUtils.isEmpty(projectCertificationInventoryEOList)){
// throw new JeroBootException("至少选择一条数据流程状态为'任务待确认'的数据!");
// }
//
// ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class);
//
// // 给认证工程师分配待办中心的任务
// String certificationEngineer = projectLibraryBase.getCertificationEngineer();
// if(StringUtils.isEmpty(certificationEngineer)){
// throw new JeroBootException("该项目中认证工程师为空,请先维护认证工程师!");
// }
//
// for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) {
// projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue());
// projectCertificationInventoryEO.setReasonForReturn(reasonForReturn);
// processHistoryEOService.add(projectCertificationInventoryEO.getId(),CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(),currentUser.getId(),ReviewResultEnum.REJECTED.getValue(),reasonForReturn,null);
//
// }
//
// this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_REJECT_TASK.getValue());
//
// 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");
// String hrefFeishu_CN_P = (String) hrefFeishuMap.get("hrefFeishu_CN_P");
//
// Map<String, Object> standNameAndItemName = this.platformProjectCertificationInventoryEOService.getStandNameAndItemName(projectCertificationInventoryEOList);
// String standName = (String) standNameAndItemName.get("standName");
// String itemName = (String) standNameAndItemName.get("itemName");
//
// try {
// List<String> certificationIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getId).distinct().collect(Collectors.toList());
// // 将当前责任人的待办任务转为已办
// LambdaUpdateWrapper<ProcessInfoDetailEO> detailUpdateWrap = new LambdaUpdateWrapper<>();
// detailUpdateWrap.eq(ProcessInfoDetailEO::getProcessInfoId,projectLibraryBase.getId());
// detailUpdateWrap.eq(ProcessInfoDetailEO::getUserId,currentUser.getId());
// detailUpdateWrap.eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.ZRRJSRW.getKey());
// detailUpdateWrap.in(ProcessInfoDetailEO::getProjectLawsInventoryId,certificationIdList);
// detailUpdateWrap.set(ProcessInfoDetailEO::getStatus,TaskStatusEnum.HAVE_DONE.getValue());
// detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateTime,new Date());
// detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateBy,currentUser.getUsername());
// this.processInfoDetailEOService.update(detailUpdateWrap);
//
// this.certificationInventoryEOListSortByInventoryVerifyEndTimeAsc(projectCertificationInventoryEOList);
//
// List<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
// List<String> certificationEngineerList = Arrays.asList(certificationEngineer.split(","));
// // 给认证工程师分配任务
// for (String userId : certificationEngineerList) {
// ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO();
// processInfoDetailEO.setUserId(userId);
// processInfoDetailEO.setTaskDefinitionKey(CertificationFlowNodeEnum.RZGCSJSRW.getKey());
// processInfoDetailEO.setCreateTime(new Date());
// processInfoDetailEO.setStatus(TaskStatusEnum.NOT_DONE.getValue());
// processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId());
// processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId());
// processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue());
// processInfoDetailEO.setEndTime(projectCertificationInventoryEOList.get(0).getInventoryVerifyEndTime());
// processInfoDetailEOList.add(processInfoDetailEO);
// }
//
// // 删除该项目数据的待办任务key为 认证工程师接受任务的数据
// QueryWrapper<ProcessInfoDetailEO> deleteDetailWrap = new QueryWrapper<>();
// deleteDetailWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId,projectLibraryBase.getId());
// deleteDetailWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.RZGCSJSRW.getKey());
// deleteDetailWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue());
// this.processInfoDetailEOService.remove(deleteDetailWrap);
// this.processInfoDetailEOService.saveBatch(processInfoDetailEOList);
//
// // 责任人接受任务将数据的状态更新为 结果待提交
// this.updateBatchById(projectCertificationInventoryEOList);
//
// List<SysUser> certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList);
// try {
// for (String userId : certificationEngineerList) {
// String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineers,userId);
//
// if(StringUtils.isNotEmpty(thirdId)){
// // 根据结束时间进行排序获取最近的时间发消息时使用
//// this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
// Date endTime = projectCertificationInventoryEOList.get(0).getInventoryVerifyEndTime();
//
// JSONObject larkMesJson = new JSONObject();
// larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE11.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("viewBtnUrlCnPhone",hrefFeishu_CN_P);
//
// templateVariableMap.put("operateUserName",currentUser.getUsername());
//
// larkMesJson.put("templateVariableMap",templateVariableMap);
// this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson);
// }
// }
// } catch (Exception e) {
// log.error("飞书消息推送失败");
// }
// }catch (Exception ex){
// ex.printStackTrace();
// log.error("责任人-拒绝任务失败:" + ex.getMessage());
// throw new JeroBootException("拒绝任务失败!");
// }
// return Result.OK("拒绝任务成功!");
// }
/**
* 认证工程师退回至studio任务