67129 studio编辑项目库认证工程师,同步待办中心认证流程待办任务。

This commit is contained in:
wangzhijiang
2023-03-28 10:10:21 +08:00
parent 5e2137c61e
commit 6366e5a045
@@ -33,8 +33,11 @@ import com.jero.modules.system.service.ISysDictService;
import com.jero.modules.system.service.ISysUserService;
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
import com.jero.modules.system.util.StringUtils;
import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO;
import com.jero.modules.todoCenter.service.IProcessInfoDetailEOService;
import com.jero.modules.top.entity.TopProjectEO;
import com.jero.modules.top.service.ITopProjectEOService;
import com.jero.modules.wkflow.enums.FlowTypeEnum;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.poi.hssf.usermodel.HSSFSheet;
@@ -147,6 +150,9 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
@Autowired
private IProjectCertificationInventoryEOService projectCertificationInventoryEOService;
@Autowired
private IProcessInfoDetailEOService processInfoDetailEOService;
/**
* 保存
*
@@ -441,6 +447,8 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
}
}
}
setRzlcCertificationEngineerTask(projectLibraryBase);
checkExitData(projectLibraryBase);
saveOrUpdate(projectLibraryBase);
checkVersionOrder(projectLibraryBase.getParentId(),projectLibraryBase.getProjectVersion(),projectLibraryBase.getId());
@@ -666,6 +674,87 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
}
/**
* 重新设置认证工程师在待办中心的 认证流程的 待办任务。
* @param projectLibraryBase
*/
private void setRzlcCertificationEngineerTask(ProjectLibraryBase projectLibraryBase) {
if(org.apache.commons.lang3.StringUtils.isNotEmpty(projectLibraryBase.getCertificationEngineer())){
List<String> certificationEngineerIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","));
QueryWrapper<ProjectCertificationInventoryEO> pciQueryWrap = new QueryWrapper<>();
pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId, projectLibraryBase.getId());
List<ProjectCertificationInventoryEO> pciEOList = this.projectCertificationInventoryEOService.list(pciQueryWrap);
if(CollectionUtils.isNotEmpty(pciEOList)){
// 清单待校核的数据
List<ProjectCertificationInventoryEO> pciToBeCheckedList = pciEOList.stream().filter(pci -> {
boolean flag = false;
if(StringUtils.equals(pci.getFlowStatus(),CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue())){
flag = true;
}
return flag;
}).collect(Collectors.toList());
// 如果该项目下清单待校核的数据不为空,给这些认证工程师分配待办任务。
if(CollectionUtils.isNotEmpty(pciToBeCheckedList)){
// 删除待办中心(是这个项目库的 pre-Homo流程的待办任务, 认证工程师接受任务节点的数据)
QueryWrapper<ProcessInfoDetailEO> pidRemoveWrap = new QueryWrapper<>();
pidRemoveWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId, projectLibraryBase.getId());
pidRemoveWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.RZGCSJSRW.getKey());
pidRemoveWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue());
this.processInfoDetailEOService.remove(pidRemoveWrap);
// 给认证工程师分配任务
List<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
for (String userId : certificationEngineerIdList) {
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());
processInfoDetailEOList.add(processInfoDetailEO);
}
this.processInfoDetailEOService.saveBatch(processInfoDetailEOList);
}
// 结果待提交的数据
List<ProjectCertificationInventoryEO> pciToBeReviewEDList = pciEOList.stream().filter(pci -> {
boolean flag = false;
if(StringUtils.equals(pci.getFlowStatus(),CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue())){
flag = true;
}
return flag;
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(pciToBeReviewEDList)){
// 删除待办中心(是这个项目库的 pre-Homo流程的待办任务, 认证工程师审查 任务节点的数据)
QueryWrapper<ProcessInfoDetailEO> pidRemoveWrap = new QueryWrapper<>();
pidRemoveWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId, projectLibraryBase.getId());
pidRemoveWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.RZGCSSC.getKey());
pidRemoveWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue());
this.processInfoDetailEOService.remove(pidRemoveWrap);
// 给认证工程师分配任务
List<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
for (String userId : certificationEngineerIdList) {
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());
processInfoDetailEOList.add(processInfoDetailEO);
}
this.processInfoDetailEOService.saveBatch(processInfoDetailEOList);
}
}
}
}
/**
* 通过id删除
*