平台件-认证清单流程

This commit is contained in:
zhn
2023-09-18 13:44:25 +08:00
parent 2a1c567977
commit cbcd3bde70
@@ -2459,11 +2459,8 @@ 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 lawsEngineer = projectLibraryBase.getCreateBy();
SysUser userByName = sysUserService.getUserByName(lawsEngineer);
// 根据项目库id查询当前项目认证清单数据获取数据状态为 结果待审查的 截止时间 最早的一个时间
Date endTime = null;
@@ -2487,11 +2484,10 @@ public class PlatformProjectCertificationInventoryEOServiceImpl extends ServiceI
}
List<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
List<String> certificationEngineerList = Arrays.asList(certificationEngineer.split(","));
// 给认证工程师分配任务
for (String userId : certificationEngineerList) {
// 给法规工程师分配任务
if(ObjectUtils.isNotEmpty(userByName)){
ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO();
processInfoDetailEO.setUserId(userId);
processInfoDetailEO.setUserId(userByName.getId());
processInfoDetailEO.setTaskDefinitionKey(CertificationFlowNodeEnum.RZGCSSC.getKey());
processInfoDetailEO.setCreateTime(new Date());
processInfoDetailEO.setStatus(TaskStatusEnum.NOT_DONE.getValue());
@@ -2505,13 +2501,9 @@ public class PlatformProjectCertificationInventoryEOServiceImpl extends ServiceI
for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) {
projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue());
processHistoryEOService.add(projectCertificationInventoryEO.getId(),CertificationFlowNodeEnum.TASK_HANDLING.getKey(),currentUser.getId(),null,null,projectCertificationInventoryEO.getDeliveryResult());
}
this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_SUBMIT_TASK.getValue());
List<SysUser> certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList);
try {
this.updateBatchById(projectCertificationInventoryEOList);
@@ -2528,16 +2520,20 @@ public class PlatformProjectCertificationInventoryEOServiceImpl extends ServiceI
detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateBy,currentUser.getUsername());
this.processInfoDetailEOService.update(detailUpdateWrap);
// 认证工程师分配待办中心的任务 认证工程师审查
// 法规工程师分配待办中心的任务 认证工程师审查
this.addProcessInfoDetailEO(processInfoDetailEOList,projectLibraryBase.getId(),CertificationFlowNodeEnum.RZGCSSC.getKey());
List<SysUser> sysUserList = new ArrayList<>();
sysUserList.add(userByName);
this.sendMessageByTemplateId(
projectCertificationInventoryEOList,
TemplateInfoEnum2.CERTIFICATION_MESSAGE23.getValue(),
certificationEngineerList,
certificationEngineers,
Arrays.asList(userByName.getId().split(",")),
sysUserList,
endTime,
CertificationFlowNodeEnum.TASK_REVIEW.getKey()
);
}catch (Exception ex){
ex.printStackTrace();
log.error("责任人-提交任务失败:" + ex.getMessage());
@@ -2546,6 +2542,119 @@ public class PlatformProjectCertificationInventoryEOServiceImpl extends ServiceI
return Result.OK("提交任务成功!");
}
// private Result<?> dutyPersonSubmitTask(JSONObject json) {
// LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//
// String ids = json.getString("ids");
// if(StringUtils.isEmpty(ids)){
// throw new JeroBootException("至少选择一条数据进行操作!");
// }
// List<String> idList = Arrays.asList(ids.split(","));
//
// List<String> flowStatusList = new ArrayList<>();
// flowStatusList.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue());
// flowStatusList.add(CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue());
//
// QueryWrapper<ProjectCertificationInventoryEO> queryWrapper = new QueryWrapper<>();
// queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,idList);
// queryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList);
// List<ProjectCertificationInventoryEO> projectCertificationInventoryEOList = this.list(queryWrapper);
// this.disposeData(projectCertificationInventoryEOList,CutEnum.CN.getValue());
//
// if(CollectionUtils.isEmpty(projectCertificationInventoryEOList)){
// throw new JeroBootException("至少选择一条数据流程状态为'结果待提交 或 审查退回'的数据!");
// }
// this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
//
// ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class);
//
// // 给认证工程师分配待办中心的任务
// String certificationEngineer = projectLibraryBase.getCertificationEngineer();
// if(StringUtils.isEmpty(certificationEngineer)){
// throw new JeroBootException("该项目中认证工程师为空,请先维护认证工程师!");
// }
//
// // 根据项目库id查询当前项目认证清单数据获取数据状态为 结果待审查的 截止时间 最早的一个时间
// Date endTime = null;
// QueryWrapper<ProjectCertificationInventoryEO> pciQueryWrap = new QueryWrapper<>();
// pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryBase.getId());
// pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getFlowStatus,CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue());
// pciQueryWrap.lambda().isNotNull(ProjectCertificationInventoryEO::getEndTime);
// List<ProjectCertificationInventoryEO> pciEoList = this.list(pciQueryWrap);
// if(CollectionUtils.isNotEmpty(pciEoList) || CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){
// List<Date> endTimeList = new ArrayList<>();
// // 本次提交之前数据库里面存在的截止时间
// List<Date> oldEndTimeList = pciEoList.stream().map(ProjectCertificationInventoryEO::getEndTime).distinct().collect(Collectors.toList());
// endTimeList.addAll(oldEndTimeList);
// // 当前要提交的数据截止时间
// List<Date> newEndTimeList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getEndTime).distinct().collect(Collectors.toList());
// endTimeList.addAll(newEndTimeList);
//
// endTimeList = endTimeList.stream().distinct().collect(Collectors.toList());
// Collections.sort(endTimeList, (d1, d2) -> d1.compareTo(d2)); // 根据时间顺序排序
// endTime = endTimeList.get(0);
// }
//
// 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.RZGCSSC.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(endTime);
// processInfoDetailEOList.add(processInfoDetailEO);
// }
// // 数据更新为结果待审查
// for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) {
// projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue());
// processHistoryEOService.add(projectCertificationInventoryEO.getId(),CertificationFlowNodeEnum.TASK_HANDLING.getKey(),currentUser.getId(),null,null,projectCertificationInventoryEO.getDeliveryResult());
//
// }
//
// this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_DUTY_PERSON_SUBMIT_TASK.getValue());
//
// List<SysUser> certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList);
//
// try {
// this.updateBatchById(projectCertificationInventoryEOList);
//
// 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.ZRRTJRW.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.addProcessInfoDetailEO(processInfoDetailEOList,projectLibraryBase.getId(),CertificationFlowNodeEnum.RZGCSSC.getKey());
// this.sendMessageByTemplateId(
// projectCertificationInventoryEOList,
// TemplateInfoEnum2.CERTIFICATION_MESSAGE23.getValue(),
// certificationEngineerList,
// certificationEngineers,
// endTime,
// CertificationFlowNodeEnum.TASK_REVIEW.getKey()
// );
// }catch (Exception ex){
// ex.printStackTrace();
// log.error("责任人-提交任务失败:" + ex.getMessage());
// throw new JeroBootException("提交任务失败!");
// }
//
// return Result.OK("提交任务成功!");
// }
/**
* 责任人接受任务
@@ -2575,9 +2684,9 @@ 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("该项目中认证工程师为空,请先维护认证工程师!");
}
// if(StringUtils.isEmpty(certificationEngineer)){
// throw new JeroBootException("该项目中认证工程师为空,请先维护认证工程师!");
// }
List<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) {
@@ -2627,38 +2736,38 @@ public class PlatformProjectCertificationInventoryEOServiceImpl extends ServiceI
this.updateBatchById(projectCertificationInventoryEOList);
List<String> certificationEngineerList = Arrays.asList(certificationEngineer.split(","));
List<SysUser> certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList);
// List<String> certificationEngineerList = Arrays.asList(certificationEngineer.split(","));
// 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).getEndTime();
JSONObject larkMesJson = new JSONObject();
larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE12.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);
}
}
// for (String userId : certificationEngineerList) {
// String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineers,userId);
//
// if(StringUtils.isNotEmpty(thirdId)){
// // 根据结束时间进行排序获取最近的时间发消息时使用
// this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
// Date endTime = projectCertificationInventoryEOList.get(0).getEndTime();
//
// JSONObject larkMesJson = new JSONObject();
// larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE12.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("飞书消息推送失败");
}
@@ -3012,6 +3121,9 @@ public class PlatformProjectCertificationInventoryEOServiceImpl extends ServiceI
this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_INITIATING_TASK.getValue());
String projectLibraryId = json.getString("projectLibraryId");
ProcessInfoEO processInfoEO = new ProcessInfoEO();
this.addProcessInfoEO(processInfoEO,projectLibraryId);
this.addProcessInfoDetailEO(processInfoDetailEOList,projectLibraryBase.getId(),CertificationFlowNodeEnum.ZRRJSRW.getKey());
// 认证工程师发起任务将数据的状态更新为 任务待确认