处理流程历史数据接口-清单确认、任务确认。

编辑法规清单-同步待办中心待办、已办人员信息。
This commit is contained in:
wangzhijiang
2022-10-24 17:58:41 +08:00
parent 2021905405
commit 657a5598c1
9 changed files with 322 additions and 5 deletions
@@ -9,10 +9,13 @@ import com.jero.common.system.vo.LoginUser;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
import com.jero.modules.system.entity.SysRole;
import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO;
import com.jero.modules.todoCenter.entity.ProcessInfoEO;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -149,4 +152,8 @@ public interface IProjectLawsInventoryEOService extends IService<ProjectLawsInve
Result<?> expediting(JSONObject json);
List<SysRole> getRoleByUserId(String projectLibraryId,String cut);
void addProcessInfo(ProcessInfoEO processInfoEO, String projectLibraryId, Date endTime);
void addProcessInfoDetail(String processInfoId, List<ProcessInfoDetailEO> processInfoDetailEOList, Date endTime);
}
@@ -576,9 +576,20 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
this.projectTaskInventoryDetailEOService.updateById(projectTaskInventoryDetailEO);
}
}
//更新待办中心流程信息明细表处理人
this.updateProcessInfoDetailAssignee(projectLawsInventoryEO,pId,flowType);
}
}
/**
* 更新待办中心流程信息明细表处理人
* @param projectLawsInventoryEO
* @param pId
* @param flowType
*/
public void updateProcessInfoDetailAssignee(ProjectLawsInventoryEO projectLawsInventoryEO,String pId,String flowType){
this.processInfoDetailEOService.updateProcessInfoDetailUserId(projectLawsInventoryEO,pId,flowType);
}
/**
* 通过id删除
*
@@ -8656,7 +8667,8 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
* @param projectLibraryId
* @param endTime
*/
public void addProcessInfo(ProcessInfoEO processInfoEO,String projectLibraryId,Date endTime){
@Override
public void addProcessInfo(ProcessInfoEO processInfoEO, String projectLibraryId, Date endTime){
String id = null;
//查询当前项目之前有没有启动过清单确认
QueryWrapper<ProcessInfoEO> processInfoQueryWrap = new QueryWrapper<>();
@@ -8689,7 +8701,8 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
* @param processInfoDetailEOList
* @param endTime
*/
public void addProcessInfoDetail(String processInfoId,List<ProcessInfoDetailEO> processInfoDetailEOList,Date endTime){
@Override
public void addProcessInfoDetail(String processInfoId, List<ProcessInfoDetailEO> processInfoDetailEOList, Date endTime){
processInfoDetailEOList.forEach(detail -> {
detail.setProcessInfoId(processInfoId);
detail.setFlowType(FlowTypeEnum.QDQR.getValue());
@@ -47,4 +47,11 @@ public class ProjectProcessTodoCenterController {
IPage page = this.processInfoEOService.projectProcessIssuedProcess(params);
return Result.OK(page);
}
@AutoLog(value = "待办中心-法规评估-初始化历史数据")
@ApiOperation(value="待办中心-法规评估-初始化历史数据", notes="待办中心-法规评估-初始化历史数据")
@GetMapping(value = "/initHistoryData")
public Result<?> initHistoryData(@RequestParam Map<String,Object> params) {
return this.processInfoEOService.initHistoryData(params);
}
}
@@ -2,6 +2,7 @@ package com.jero.modules.todoCenter.service;
import com.alibaba.fastjson.JSONObject;
import com.jero.common.api.vo.Result;
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
@@ -73,4 +74,12 @@ public interface IProcessInfoDetailEOService extends IService<ProcessInfoDetailE
* @param processInfoDetailEOList
*/
void batchInsertDreUserTask(List<ProcessInfoDetailEO> processInfoDetailEOList);
/**
* 更新待办中心流程信息明细表,处理人
* @param projectLawsInventoryEO
* @param pId
* @param flowType
*/
void updateProcessInfoDetailUserId(ProjectLawsInventoryEO projectLawsInventoryEO, String pId, String flowType);
}
@@ -117,4 +117,6 @@ public interface IProcessInfoEOService extends IService<ProcessInfoEO> {
* @return
*/
IPage lawsAssessIssuedProcess(Map<String, Object> params);
Result<?> initHistoryData(Map<String, Object> params);
}
@@ -6,11 +6,15 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.jero.common.api.vo.Result;
import com.jero.common.exception.JeroBootException;
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
import com.jero.modules.project.enums.OperatorTypeEnum;
import com.jero.modules.project.enums.RequestSourceEnum;
import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO;
import com.jero.modules.todoCenter.mapper.ProcessInfoDetailEOMapper;
import com.jero.modules.todoCenter.service.IProcessInfoDetailEOService;
import com.jero.modules.wkflow.enums.DesignComplianceNodeEnum;
import com.jero.modules.wkflow.enums.FlowTypeEnum;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@@ -175,4 +179,48 @@ public class ProcessInfoDetailEOServiceImpl extends ServiceImpl<ProcessInfoDetai
this.saveBatch(processInfoDetailEOList);
}
@Override
public void updateProcessInfoDetailUserId(ProjectLawsInventoryEO projectLawsInventoryEO, String pId, String flowType) {
QueryWrapper<ProcessInfoDetailEO> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ProcessInfoDetailEO::getActiProcInstId,pId);
queryWrapper.lambda().eq(ProcessInfoDetailEO::getFlowType,flowType);
List<ProcessInfoDetailEO> processInfoDetailEOList = this.list(queryWrapper);
if(CollectionUtils.isNotEmpty(processInfoDetailEOList)){
for (ProcessInfoDetailEO processInfoDetailEO : processInfoDetailEOList) {
if(StringUtils.equals(flowType, FlowTypeEnum.SJFHXSHLC.getValue())){
if(StringUtils.equals(processInfoDetailEO.getTaskDefinitionKey(), DesignComplianceNodeEnum.THE_RESPONSIBLE_PERSON_HANDLES_THE_TASK.getKey())){
//更新责任人的任务
processInfoDetailEO.setUserId(projectLawsInventoryEO.getDesignDutyId());
}
if(StringUtils.equals(processInfoDetailEO.getTaskDefinitionKey(), DesignComplianceNodeEnum.SPONSOR_REVIEW.getKey())){
//更新发起人的任务
processInfoDetailEO.setUserId(projectLawsInventoryEO.getDesignInitiatorId());
}
}
if(StringUtils.equals(flowType, FlowTypeEnum.PREHOMOQRLC.getValue())){
if(StringUtils.equals(processInfoDetailEO.getTaskDefinitionKey(), DesignComplianceNodeEnum.THE_RESPONSIBLE_PERSON_HANDLES_THE_TASK.getKey())){
//更新责任人的任务
processInfoDetailEO.setUserId(projectLawsInventoryEO.getPrehomoDutyId());
}
if(StringUtils.equals(processInfoDetailEO.getTaskDefinitionKey(), DesignComplianceNodeEnum.SPONSOR_REVIEW.getKey())){
//更新发起人的任务
processInfoDetailEO.setUserId(projectLawsInventoryEO.getPrehomoInitiatorId());
}
}
if(StringUtils.equals(flowType,FlowTypeEnum.YZFHXSCLC.getValue())){
if(StringUtils.equals(processInfoDetailEO.getTaskDefinitionKey(), DesignComplianceNodeEnum.THE_RESPONSIBLE_PERSON_HANDLES_THE_TASK.getKey())){
//更新责任人的任务
processInfoDetailEO.setUserId(projectLawsInventoryEO.getVerifyDutyId());
}
if(StringUtils.equals(processInfoDetailEO.getTaskDefinitionKey(), DesignComplianceNodeEnum.SPONSOR_REVIEW.getKey())){
//更新发起人的任务
processInfoDetailEO.setUserId(projectLawsInventoryEO.getVerifyInitiatorId());
}
}
this.baseMapper.updateById(processInfoDetailEO);
}
}
}
}
@@ -7,11 +7,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
import com.jero.modules.project.entity.ProjectLibraryBase;
import com.jero.modules.project.entity.ProjectTaskInventoryDetailEO;
import com.jero.modules.project.entity.ProjectTaskInventoryEO;
import com.jero.modules.project.enums.OperatorTypeEnum;
import com.jero.modules.project.enums.RequestSourceEnum;
import com.jero.modules.project.enums.TaskStatusEnum;
import com.jero.modules.project.enums.*;
import com.jero.modules.project.service.IProjectLawsInventoryEOService;
import com.jero.modules.project.service.IProjectLibraryBaseService;
import com.jero.modules.project.service.IProjectTaskInventoryDetailEOService;
import com.jero.modules.project.service.IProjectTaskInventoryEOService;
import com.jero.modules.system.entity.SysUser;
@@ -24,12 +26,15 @@ import com.jero.modules.todoCenter.service.IProcessInfoDetailEOService;
import com.jero.modules.todoCenter.service.IProcessInfoEOService;
import com.jero.modules.todoCenter.vo.ProcessInfoVO;
import com.jero.modules.wkflow.enums.FlowTypeEnum;
import com.jero.modules.wkflow.feginClient.impl.WorkFlowFeignClientImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -55,6 +60,12 @@ public class ProcessInfoEOServiceImpl extends ServiceImpl<ProcessInfoEOMapper, P
private IProjectTaskInventoryDetailEOService projectTaskInventoryDetailEOService;
@Autowired
private IProjectTaskInventoryEOService projectTaskInventoryEOService;
@Autowired
private IProjectLawsInventoryEOService projectLawsInventoryEOService;
@Autowired
private WorkFlowFeignClientImpl workFlowFeignClient;
@Autowired
private IProjectLibraryBaseService projectLibraryBaseService;
/**
* 保存
@@ -546,4 +557,207 @@ public class ProcessInfoEOServiceImpl extends ServiceImpl<ProcessInfoEOMapper, P
});
}
}
@Override
public Result<?> initHistoryData(Map<String, Object> params) {
/**
* disposeType:处理类型
* value:
* 10:清单确认
* 1:任务确认
* 2:设计符合性
* 3prehomo确认
* 4:验证符合性
* 5:法规意见收集
* 6:法规技术评估
* 多个之间使用英文逗号分隔.
*/
String disposeType = (String) params.get("disposeType");
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//查询出所有的法规清单数据
List<ProjectLawsInventoryEO> projectLawsInventoryEOList = this.projectLawsInventoryEOService.list();
//查询出所有项目库信息
List<ProjectLibraryBase> projectLibraryBaseList = this.projectLibraryBaseService.list();
//1、清单确认
if(StringUtils.contains(disposeType,FlowTypeEnum.QDQR.getValue())){
this.initQdqr(projectLawsInventoryEOList,projectLibraryBaseList);
}
//2.任务确认
if(StringUtils.contains(disposeType,FlowTypeEnum.RWQRLC.getValue())){
this.initRwqr(projectLawsInventoryEOList,projectLibraryBaseList);
}
return Result.OK("初始化数据成功",disposeType);
}
/**
* 初始化清单确认
* @param projectLawsInventoryEOList
* @param projectLibraryBaseList
*/
public void initQdqr(List<ProjectLawsInventoryEO> projectLawsInventoryEOList,List<ProjectLibraryBase> projectLibraryBaseList){
Map<String, List<ProjectLawsInventoryEO>> qdqrMap = projectLawsInventoryEOList.stream().filter(lawsInventory -> {
boolean flag = false;
if (StringUtils.equals(lawsInventory.getInventoryAffirmStatus(), InventoryAffirmStatusEnum.LIST_TO_CONFIRM.getValue())) {
flag = true;
}
return flag;
}).collect(Collectors.groupingBy(ProjectLawsInventoryEO::getProjectLibraryId));
if(!Objects.isNull(qdqrMap)){
for (Map.Entry<String, List<ProjectLawsInventoryEO>> map : qdqrMap.entrySet()) {
String projectLibraryId = map.getKey();
ProjectLibraryBase projectLibraryBaseEO = projectLibraryBaseList.stream().filter(projectLibraryBase -> {
boolean flag = false;
if(StringUtils.equals(projectLibraryId,projectLibraryBase.getId())){
flag = true;
}
return flag;
}).collect(Collectors.toList()).get(0);
List<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
List<ProjectLawsInventoryEO> qdqrLawsInventoryList = map.getValue();
if(CollectionUtils.isNotEmpty(qdqrLawsInventoryList)){
qdqrLawsInventoryList.forEach(projectLawsInventoryEO-> {
boolean homologationEngineerFlag = (
StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())
|| StringUtils.equals(projectLawsInventoryEO.getHomologationEngineerSubmitStatus(),"1")
);
boolean regulationOwnerFlag = (
StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())
|| StringUtils.equals(projectLawsInventoryEO.getRegulationOwnerSubmitStatus(),"1")
);
if(homologationEngineerFlag){
ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO();
processInfoDetailEO.setProjectLawsInventoryId(projectLawsInventoryEO.getId());
processInfoDetailEO.setUserId(projectLawsInventoryEO.getHomologationEngineerId());
processInfoDetailEO.setTaskDefinitionKey(InventoryAffirmNodeEnum.HOMOLOGATION_ENGINEER_AUDIT.getKey());
processInfoDetailEO.setEndTime(projectLawsInventoryEO.getInventoryAffirmDueDate());
processInfoDetailEO.setCreateTime(new Date());
processInfoDetailEO.setCreateBy(projectLibraryBaseEO.getStudioEngineer());
processInfoDetailEO.setStatus(TaskStatusEnum.NOT_DONE.getValue());
processInfoDetailEOList.add(processInfoDetailEO);
}
if(regulationOwnerFlag){
ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO();
processInfoDetailEO.setProjectLawsInventoryId(projectLawsInventoryEO.getId());
processInfoDetailEO.setUserId(projectLawsInventoryEO.getRegulationOwnerId());
processInfoDetailEO.setTaskDefinitionKey(InventoryAffirmNodeEnum.REGULATION_OWNER_AUDIT.getKey());
processInfoDetailEO.setEndTime(projectLawsInventoryEO.getInventoryAffirmDueDate());
processInfoDetailEO.setCreateTime(new Date());
processInfoDetailEO.setCreateBy(projectLibraryBaseEO.getStudioEngineer());
processInfoDetailEO.setStatus(TaskStatusEnum.NOT_DONE.getValue());
processInfoDetailEOList.add(processInfoDetailEO);
}
});
//往待办中心添加数据。
ProcessInfoEO processInfoEO = new ProcessInfoEO();
this.projectLawsInventoryEOService.addProcessInfo(processInfoEO,projectLibraryId,null);
this.projectLawsInventoryEOService.addProcessInfoDetail(processInfoEO.getId(),processInfoDetailEOList,null);
}
}
}
}
/**
* 初始化任务确认
* @param projectLawsInventoryEOList
* @param projectLibraryBaseList
*/
public void initRwqr(List<ProjectLawsInventoryEO> projectLawsInventoryEOList,List<ProjectLibraryBase> projectLibraryBaseList){
List<Map<String,Object>> rwqrResult = this.workFlowFeignClient.queryProcessInfoByPrcType(FlowTypeEnum.RWQRLC.getValue());
if(CollectionUtils.isNotEmpty(rwqrResult)){
for (Map<String, Object> rwqrMap : rwqrResult) {
List<ProjectLawsInventoryEO> lawsInventoryList = projectLawsInventoryEOList.stream().filter(projectLawsInventory -> {
boolean flag = false;
if (StringUtils.equals((String) rwqrMap.get("projectLawsInventoryId"), projectLawsInventory.getId())) {
flag = true;
}
return flag;
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(lawsInventoryList)){
ProjectLawsInventoryEO projectLawsInventoryEO = lawsInventoryList.get(0);
rwqrMap.put("projectLibraryId",projectLawsInventoryEO.getProjectLibraryId());
rwqrMap.put("projectLawsInventoryId",projectLawsInventoryEO.getId());
rwqrMap.put("standId",projectLawsInventoryEO.getStandId());
List<Map<String,Object>> taskMapList = (List<Map<String,Object>>)rwqrMap.get("taskMapList");
if(CollectionUtils.isNotEmpty(taskMapList)){
addProcessInfo(rwqrMap);
}
}
}
}
}
public void addProcessInfo(Map<String,Object> params){
String prcNum = (String) params.get("prcNum");
String prcName = (String) params.get("prcName");
String actiProcInstId = (String) params.get("actiProcInstId");
String flowType = (String) params.get("flowType");
String endTimeStr = "";
String projectLibraryId = "";
String projectLawsInventoryId = "";
String standId = "";
String createBy = (String) params.get("createBy");
if(StringUtils.equals(flowType,FlowTypeEnum.RWQRLC.getValue())){
projectLibraryId = (String) params.get("projectLibraryId");
projectLawsInventoryId = (String) params.get("projectLawsInventoryId");
standId = (String) params.get("standId");
endTimeStr = (String) params.get("endTime");
}
ProcessInfoEO processInfoEO = new ProcessInfoEO();
processInfoEO.setId(actiProcInstId);
processInfoEO.setProjectLibraryId(projectLibraryId);
processInfoEO.setProjectLawsInventoryId(projectLawsInventoryId);
processInfoEO.setActiProcInstId(actiProcInstId);
processInfoEO.setFlowType(flowType);
processInfoEO.setPrcNum(prcNum);
processInfoEO.setPrcName(prcName);
processInfoEO.setBussDocumentLibraryId(standId);
//截止日期
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date endTime = new Date();
try {
endTime = sdf.parse(endTimeStr);
} catch (ParseException e) {
e.printStackTrace();
}
processInfoEO.setEndTime(endTime);
processInfoEO.setStatus(TodoCenterStatusEnum.LIST_TO_CONFIRM.getValue());
processInfoEO.setCreateBy(createBy);
this.baseMapper.insert(processInfoEO);
List<Map<String,Object>> taskMapList = (List<Map<String,Object>>)params.get("taskMapList");
List<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
for (Map<String, Object> taskMap : taskMapList) {
ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO();
processInfoDetailEO.setActiProcInstId((String) taskMap.get("actiProcInstId"));
processInfoDetailEO.setTaskId((String) taskMap.get("taskId"));
processInfoDetailEO.setTaskDefinitionKey((String) taskMap.get("taskDefinitionKey"));
processInfoDetailEO.setUserId((String) taskMap.get("userId"));
processInfoDetailEO.setStatus(TaskStatusEnum.NOT_DONE.getValue());
processInfoDetailEO.setProcessInfoId(processInfoEO.getId());
processInfoDetailEO.setFlowType(flowType);
processInfoDetailEO.setProjectLawsInventoryId(projectLawsInventoryId);
processInfoDetailEO.setCreateTime(new Date());
processInfoDetailEO.setCreateBy(createBy);
processInfoDetailEOList.add(processInfoDetailEO);
}
this.processInfoDetailEOService.saveBatch(processInfoDetailEOList);
}
}
@@ -181,4 +181,12 @@ public interface WorkFlowFeignClient {
@RequestMapping(value = "/bat-wkflow/deleteProcessInstanceByPrcIds",method = RequestMethod.GET)
Result<String> deleteProcessInstanceByPrcIds(@RequestParam("prcIds") String prcIds);
/**
* 根据流程类型,查询未完成的流程信息
* @param prcType
* @return
*/
@RequestMapping(value = "/bat-wkflow/datas/bus-process-name/queryProcessInfoByPrcType",method = RequestMethod.GET)
List<Map<String, Object>> queryProcessInfoByPrcType(@RequestParam("prcType") String prcType);
}
@@ -196,4 +196,13 @@ public class WorkFlowFeignClientImpl{
public Result<String> deleteProcessInstanceByTaskId(@RequestParam("taskId")String taskId){
return workFlowFeignClient.deleteProcessInstance(taskId);
}
/**
* 根据流程类型,查询未完成的流程信息
* @param prcType
* @return
*/
public List<Map<String, Object>> queryProcessInfoByPrcType(String prcType) {
return workFlowFeignClient.queryProcessInfoByPrcType(prcType);
}
}