feat: 年度制修订-主动上报
This commit is contained in:
+10
@@ -62,6 +62,16 @@ public class ActFlowCommonService {
|
||||
return processInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map工具
|
||||
* @param map
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
public void putIfNotNull(Map<String, Object> map, String key, Object value) {
|
||||
Optional.ofNullable(value).ifPresent(v -> map.put(key, v));
|
||||
}
|
||||
|
||||
/**
|
||||
* 循环设置流程变量
|
||||
* @param processInstanceId
|
||||
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
package com.jero.modules.activiti.process.esAnnualInit.listener;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.ProcessEsInitChange;
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.enums.ESPApplicationCategoryEnum;
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.enums.ESPChangeType;
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.enums.ESPProjectType;
|
||||
import com.jero.modules.activiti.process.esInitChange.service.ProcessEsInitChangeService;
|
||||
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardPlan;
|
||||
import com.jero.modules.laws.enterprise.service.EnterpriseStandardPlanService;
|
||||
import com.jero.modules.laws.enterprise.util.BeanCopyUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.engine.delegate.DelegateExecution;
|
||||
import org.activiti.engine.delegate.ExecutionListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Mzaxd
|
||||
* @Date: 2023/10/10 14:14
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ProcessESAnnualInitEndListener implements ExecutionListener {
|
||||
|
||||
@Resource
|
||||
private EnterpriseStandardPlanService espService;
|
||||
|
||||
@Resource
|
||||
private ProcessEsInitChangeService esInitChangeService;
|
||||
|
||||
/**
|
||||
* 企标立项变更流程结束之后需要把数据存入企标计划数据库 然后自动发起企标制修订流程
|
||||
* @param delegateExecution
|
||||
*/
|
||||
@Override
|
||||
public void notify(DelegateExecution delegateExecution) {
|
||||
// log.info("企标立项变更流程结束 监听执行器开始执行");
|
||||
// // 获取流程实例ID
|
||||
// String processInstanceId = delegateExecution.getProcessInstanceId();
|
||||
// // 根据流程实例Id找到所有流程业务数据
|
||||
// LambdaQueryWrapper<ProcessEsInitChange> esInitChangeWrapper = new LambdaQueryWrapper<>();
|
||||
// esInitChangeWrapper.eq(ProcessEsInitChange::getProcessInstanceId, processInstanceId);
|
||||
// List<ProcessEsInitChange> processEsInitChanges = esInitChangeService.list(esInitChangeWrapper);
|
||||
// String applicationCategory = processEsInitChanges.get(0).getApplicationCategory();
|
||||
// String projectType = processEsInitChanges.get(0).getProjectType();
|
||||
// List<EnterpriseStandardPlan> enterpriseStandardPlans;
|
||||
// if (ESPApplicationCategoryEnum.INITIATION.getValue().equals(applicationCategory)) {
|
||||
// // 立项新增-Id置空
|
||||
// for (ProcessEsInitChange processEsInitChange : processEsInitChanges) {
|
||||
// processEsInitChange.setId(null);
|
||||
// }
|
||||
// // 转换为企标计划数据并入库
|
||||
// enterpriseStandardPlans = BeanCopyUtils.copyBeanList(processEsInitChanges, EnterpriseStandardPlan.class);
|
||||
// espService.saveBatch(enterpriseStandardPlans);
|
||||
// } else {
|
||||
// // 将Id设为企标计划的Id
|
||||
// for (ProcessEsInitChange processEsInitChange : processEsInitChanges) {
|
||||
// processEsInitChange.setId(processEsInitChange.getEspId());
|
||||
// }
|
||||
//
|
||||
// // 完成时间变更
|
||||
// if (ESPProjectType.COMPLETE_TIME_CHANGE.getValue().equals(projectType)) {
|
||||
// enterpriseStandardPlans = BeanCopyUtils.copyBeanList(processEsInitChanges, EnterpriseStandardPlan.class);
|
||||
// espService.saveOrUpdateBatch(enterpriseStandardPlans);
|
||||
// }
|
||||
//
|
||||
// // 工作中止
|
||||
// if (ESPProjectType.WORK_TERMINATE.getValue().equals(projectType)) {
|
||||
// // 将企标计划变更状态设为取消
|
||||
// for (ProcessEsInitChange processEsInitChange : processEsInitChanges) {
|
||||
// processEsInitChange.setProjectStatus(ESPChangeType.CANCEL.getValue());
|
||||
// }
|
||||
// enterpriseStandardPlans = BeanCopyUtils.copyBeanList(processEsInitChanges, EnterpriseStandardPlan.class);
|
||||
// espService.saveOrUpdateBatch(enterpriseStandardPlans);
|
||||
// }
|
||||
//
|
||||
// // 责任部门变更
|
||||
// if (ESPProjectType.RESPONSIBLE_DEPT_CHANGE.getValue().equals(projectType)) {
|
||||
// // 将企标计划变更状态设为变更
|
||||
// for (ProcessEsInitChange processEsInitChange : processEsInitChanges) {
|
||||
// processEsInitChange.setProjectStatus(ESPChangeType.CHANGE.getValue());
|
||||
// }
|
||||
// enterpriseStandardPlans = BeanCopyUtils.copyBeanList(processEsInitChanges, EnterpriseStandardPlan.class);
|
||||
// espService.saveOrUpdateBatch(enterpriseStandardPlans);
|
||||
// }
|
||||
//
|
||||
// // 合并
|
||||
// if (ESPProjectType.MERGE.getValue().equals(projectType)) {
|
||||
// for (ProcessEsInitChange processEsInitChange : processEsInitChanges) {
|
||||
// processEsInitChange.setId(null);
|
||||
// }
|
||||
// // 删除两个老企标计划
|
||||
// espService.deleteById(processEsInitChanges.get(0).getStandardIdOne());
|
||||
// espService.deleteById(processEsInitChanges.get(0).getStandardIdTwo());
|
||||
// // 生成新企标计划
|
||||
// enterpriseStandardPlans = BeanCopyUtils.copyBeanList(processEsInitChanges, EnterpriseStandardPlan.class);
|
||||
// espService.saveOrUpdateBatch(enterpriseStandardPlans);
|
||||
// }
|
||||
// }
|
||||
// log.info("数据存入企标计划数据库");
|
||||
// // 软删除流程数据
|
||||
// esInitChangeService.removeByProcessInstanceId(processInstanceId);
|
||||
// log.info("软删除流程数据");
|
||||
// //TODO 发起制修订流程
|
||||
// log.info("自动发起企标制修订流程");
|
||||
}
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
package com.jero.modules.activiti.process.esAnnualReport.listener;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.ProcessEsInitChange;
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.enums.ESPApplicationCategoryEnum;
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.enums.ESPChangeType;
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.enums.ESPProjectType;
|
||||
import com.jero.modules.activiti.process.esInitChange.service.ProcessEsInitChangeService;
|
||||
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardPlan;
|
||||
import com.jero.modules.laws.enterprise.service.EnterpriseStandardPlanService;
|
||||
import com.jero.modules.laws.enterprise.util.BeanCopyUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.engine.delegate.DelegateExecution;
|
||||
import org.activiti.engine.delegate.ExecutionListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Mzaxd
|
||||
* @Date: 2023/10/10 14:14
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ProcessESAnnualReportEndListener implements ExecutionListener {
|
||||
|
||||
@Resource
|
||||
private EnterpriseStandardPlanService espService;
|
||||
|
||||
@Resource
|
||||
private ProcessEsInitChangeService esInitChangeService;
|
||||
|
||||
/**
|
||||
* 企标立项变更流程结束之后需要把数据存入企标计划数据库 然后自动发起企标制修订流程
|
||||
* @param delegateExecution
|
||||
*/
|
||||
@Override
|
||||
public void notify(DelegateExecution delegateExecution) {
|
||||
// log.info("企标立项变更流程结束 监听执行器开始执行");
|
||||
// // 获取流程实例ID
|
||||
// String processInstanceId = delegateExecution.getProcessInstanceId();
|
||||
// // 根据流程实例Id找到所有流程业务数据
|
||||
// LambdaQueryWrapper<ProcessEsInitChange> esInitChangeWrapper = new LambdaQueryWrapper<>();
|
||||
// esInitChangeWrapper.eq(ProcessEsInitChange::getProcessInstanceId, processInstanceId);
|
||||
// List<ProcessEsInitChange> processEsInitChanges = esInitChangeService.list(esInitChangeWrapper);
|
||||
// String applicationCategory = processEsInitChanges.get(0).getApplicationCategory();
|
||||
// String projectType = processEsInitChanges.get(0).getProjectType();
|
||||
// List<EnterpriseStandardPlan> enterpriseStandardPlans;
|
||||
// if (ESPApplicationCategoryEnum.INITIATION.getValue().equals(applicationCategory)) {
|
||||
// // 立项新增-Id置空
|
||||
// for (ProcessEsInitChange processEsInitChange : processEsInitChanges) {
|
||||
// processEsInitChange.setId(null);
|
||||
// }
|
||||
// // 转换为企标计划数据并入库
|
||||
// enterpriseStandardPlans = BeanCopyUtils.copyBeanList(processEsInitChanges, EnterpriseStandardPlan.class);
|
||||
// espService.saveBatch(enterpriseStandardPlans);
|
||||
// } else {
|
||||
// // 将Id设为企标计划的Id
|
||||
// for (ProcessEsInitChange processEsInitChange : processEsInitChanges) {
|
||||
// processEsInitChange.setId(processEsInitChange.getEspId());
|
||||
// }
|
||||
//
|
||||
// // 完成时间变更
|
||||
// if (ESPProjectType.COMPLETE_TIME_CHANGE.getValue().equals(projectType)) {
|
||||
// enterpriseStandardPlans = BeanCopyUtils.copyBeanList(processEsInitChanges, EnterpriseStandardPlan.class);
|
||||
// espService.saveOrUpdateBatch(enterpriseStandardPlans);
|
||||
// }
|
||||
//
|
||||
// // 工作中止
|
||||
// if (ESPProjectType.WORK_TERMINATE.getValue().equals(projectType)) {
|
||||
// // 将企标计划变更状态设为取消
|
||||
// for (ProcessEsInitChange processEsInitChange : processEsInitChanges) {
|
||||
// processEsInitChange.setProjectStatus(ESPChangeType.CANCEL.getValue());
|
||||
// }
|
||||
// enterpriseStandardPlans = BeanCopyUtils.copyBeanList(processEsInitChanges, EnterpriseStandardPlan.class);
|
||||
// espService.saveOrUpdateBatch(enterpriseStandardPlans);
|
||||
// }
|
||||
//
|
||||
// // 责任部门变更
|
||||
// if (ESPProjectType.RESPONSIBLE_DEPT_CHANGE.getValue().equals(projectType)) {
|
||||
// // 将企标计划变更状态设为变更
|
||||
// for (ProcessEsInitChange processEsInitChange : processEsInitChanges) {
|
||||
// processEsInitChange.setProjectStatus(ESPChangeType.CHANGE.getValue());
|
||||
// }
|
||||
// enterpriseStandardPlans = BeanCopyUtils.copyBeanList(processEsInitChanges, EnterpriseStandardPlan.class);
|
||||
// espService.saveOrUpdateBatch(enterpriseStandardPlans);
|
||||
// }
|
||||
//
|
||||
// // 合并
|
||||
// if (ESPProjectType.MERGE.getValue().equals(projectType)) {
|
||||
// for (ProcessEsInitChange processEsInitChange : processEsInitChanges) {
|
||||
// processEsInitChange.setId(null);
|
||||
// }
|
||||
// // 删除两个老企标计划
|
||||
// espService.deleteById(processEsInitChanges.get(0).getStandardIdOne());
|
||||
// espService.deleteById(processEsInitChanges.get(0).getStandardIdTwo());
|
||||
// // 生成新企标计划
|
||||
// enterpriseStandardPlans = BeanCopyUtils.copyBeanList(processEsInitChanges, EnterpriseStandardPlan.class);
|
||||
// espService.saveOrUpdateBatch(enterpriseStandardPlans);
|
||||
// }
|
||||
// }
|
||||
// log.info("数据存入企标计划数据库");
|
||||
// // 软删除流程数据
|
||||
// esInitChangeService.removeByProcessInstanceId(processInstanceId);
|
||||
// log.info("软删除流程数据");
|
||||
// //TODO 发起制修订流程
|
||||
// log.info("自动发起企标制修订流程");
|
||||
}
|
||||
}
|
||||
+51
-57
@@ -12,7 +12,6 @@ import com.jero.modules.activiti.entity.ProcessNode;
|
||||
import com.jero.modules.activiti.process.common.entity.CommonVO;
|
||||
import com.jero.modules.activiti.process.common.enums.ProcessType;
|
||||
import com.jero.modules.activiti.process.common.service.ActFlowCommonService;
|
||||
import com.jero.modules.activiti.process.common.service.ProcessDraftService;
|
||||
import com.jero.modules.activiti.process.esAnnualReport.entity.ProcessEsAnnualReport;
|
||||
import com.jero.modules.activiti.process.esAnnualReport.entity.vo.AnnualReportDataVO;
|
||||
import com.jero.modules.activiti.process.esAnnualReport.entity.vo.AnnualReportFlowUserVO;
|
||||
@@ -20,7 +19,6 @@ import com.jero.modules.activiti.process.esAnnualReport.mapper.ProcessEsAnnualRe
|
||||
import com.jero.modules.activiti.process.esAnnualReport.service.ProcessEsAnnualReportService;
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.enums.ESPProjectType;
|
||||
import com.jero.modules.activiti.service.ProcessAllService;
|
||||
import com.jero.modules.activiti.service.ProcessApprovalRecordService;
|
||||
import com.jero.modules.activiti.service.ProcessNodeLinkService;
|
||||
import com.jero.modules.activiti.service.ProcessNodeService;
|
||||
import com.jero.modules.activiti.util.ExcelUtils;
|
||||
@@ -67,26 +65,18 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
|
||||
@Resource
|
||||
private ActFlowCommonService actFlowCommonService;
|
||||
|
||||
@Resource
|
||||
private ProcessDraftService processDraftService;
|
||||
|
||||
@Resource
|
||||
private ProcessNodeLinkService processNodeLinkService;
|
||||
|
||||
@Resource
|
||||
private ProcessNodeService processNodeService;
|
||||
|
||||
@Resource
|
||||
private ProcessApprovalRecordService processApprovalRecordService;
|
||||
|
||||
@Resource
|
||||
private ProcessAllService processAllService;
|
||||
|
||||
@Resource
|
||||
private RuntimeService runtimeService;
|
||||
|
||||
|
||||
@Resource
|
||||
private TaskService taskService;
|
||||
|
||||
@@ -94,63 +84,63 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
public void startProcess(AnnualReportDataVO annualReportData) {
|
||||
// 流程Key
|
||||
String processDefinitionKey = ProcessType.ES_ANNUAL_REPORT.getProcessKey();
|
||||
String userId = UserUtils.getUserId();
|
||||
List<ProcessEsAnnualReport> annualReportList = annualReportData.getDataList();
|
||||
|
||||
// 当前用户Id
|
||||
String userId = UserUtils.getUserId();
|
||||
// 设置流程变量
|
||||
Map<String, Object> variables = setVariables(annualReportData);
|
||||
Map<String, Object> variables = this.setVariables(annualReportData);
|
||||
// 启动流程
|
||||
ProcessInstance processInstance = actFlowCommonService.startProcess(processDefinitionKey, variables);
|
||||
// 获取流程实例ID
|
||||
String processDefinitionId = processInstance.getProcessDefinitionId();
|
||||
String processInstanceId = processInstance.getId();
|
||||
runtimeService.setVariable(processInstanceId, "contactUserList", variables.get("contactUserList"));
|
||||
// 手动设置所有流程变量
|
||||
actFlowCommonService.setProcessVariables(processInstanceId, variables);
|
||||
// 自动完成第一个任务
|
||||
actFlowCommonService.autoCompleteFirstTask(userId, processInstanceId, processDefinitionId);
|
||||
// 设置流程实例Id
|
||||
for (ProcessEsAnnualReport annualReport : annualReportList) {
|
||||
annualReport.setProcessInstanceId(processInstance.getId());
|
||||
}
|
||||
annualReportList.forEach(annualReport -> annualReport.setProcessInstanceId(processInstanceId));
|
||||
// 保存选人信息
|
||||
processNodeLinkService.saveNodeUserLink(processDefinitionId, processInstanceId, this.getUserMap(variables));
|
||||
|
||||
// 根据流程实例id更新流程总表
|
||||
ProcessAll process = processAllService.getByProcessInstanceId(processInstanceId);
|
||||
process.setCreateUserId(userId);
|
||||
process.setPrcName(annualReportData.getCommonVO().getPrcName());
|
||||
process.setPrcMes(annualReportData.getCommonVO().getPrcMes());
|
||||
process.setDueTime(annualReportData.getCommonVO().getDueTime());
|
||||
processAllService.updateById(process);
|
||||
String prcName = annualReportData.getCommonVO().getPrcName();
|
||||
String prcMes = annualReportData.getCommonVO().getPrcMes();
|
||||
Date dueTime = annualReportData.getCommonVO().getDueTime();
|
||||
actFlowCommonService.updateProcessAll(processInstanceId, userId, prcName, prcMes, dueTime);
|
||||
// 执行流程发起前的操作
|
||||
this.startRunTask(annualReportData);
|
||||
}
|
||||
|
||||
private Map<String, Object> getUserMap(Map<String, Object> variables) {
|
||||
variables.remove("distribute");
|
||||
variables.remove("processDescription");
|
||||
return variables;
|
||||
}
|
||||
|
||||
public Map<String, Object> setVariables(AnnualReportDataVO annualReportData) {
|
||||
AnnualReportFlowUserVO annualReportFlowUserVO = annualReportData.getFlowUserVO();
|
||||
CommonVO commonVO = annualReportData.getCommonVO();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// 设置流程中各个节点的人
|
||||
map.put("standardEngineer", annualReportFlowUserVO.getStandardEngineer());
|
||||
if (!annualReportFlowUserVO.getContactUserList().isEmpty()) {
|
||||
map.put("contactUserList", Optional.of(annualReportFlowUserVO.getContactUserList()).map(s -> Arrays.asList(s.split(","))).orElse(Collections.emptyList()));
|
||||
}
|
||||
if (!annualReportFlowUserVO.getWorkGroupUserList().isEmpty()) {
|
||||
map.put("workGroupUserList", Optional.of(annualReportFlowUserVO.getWorkGroupUserList()).map(s -> Arrays.asList(s.split(","))).orElse(Collections.emptyList()));
|
||||
}
|
||||
map.put("collectUserLeader", annualReportFlowUserVO.getContactUserLeaderLeader());
|
||||
map.put("contactUserLeaderLeader", annualReportFlowUserVO.getContactUserLeaderLeader());
|
||||
Map<String, Object> map = new HashMap<>(this.setUserVariables(annualReportFlowUserVO));
|
||||
// 设置流程分支判断变量
|
||||
map.put("distribute", annualReportFlowUserVO.isDistribute());
|
||||
map.put("processDescription", commonVO.getProcessDescription());
|
||||
return map;
|
||||
}
|
||||
|
||||
public Map<String, Object> setUserVariables(AnnualReportFlowUserVO userVO) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
// 使用一个通用方法来只在不为空时添加键值对
|
||||
actFlowCommonService.putIfNotNull(map, "standardEngineer", userVO.getStandardEngineer());
|
||||
actFlowCommonService.putIfNotNull(map, "contactUserList", Optional.ofNullable(userVO.getContactUserList()).map(s -> Arrays.asList(s.split(","))).orElse(null));
|
||||
return map;
|
||||
}
|
||||
|
||||
private Map<String, Object> getUserMap(Map<String, Object> variables) {
|
||||
variables.remove("processDescription");
|
||||
// 转成逗号拼接
|
||||
variables.put("contactUserList", Optional.ofNullable((List<String>) variables.get("contactUserList"))
|
||||
.map(list -> String.join(",", list))
|
||||
.orElse(""));
|
||||
variables.put("workGroupUserList", Optional.ofNullable((List<String>) variables.get("workGroupUserList"))
|
||||
.map(list -> String.join(",", list))
|
||||
.orElse(""));
|
||||
return variables;
|
||||
}
|
||||
|
||||
public void startRunTask(AnnualReportDataVO annualReportDataVO) {
|
||||
// TODO info部长
|
||||
}
|
||||
@@ -168,19 +158,23 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
}
|
||||
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
|
||||
String taskName = task.getName();
|
||||
Map<String, Object> variables = new HashMap<>();
|
||||
String processInstanceId = actFlowCommonService.getProcessInstanceIdByTaskId(taskId);
|
||||
String processDefinitionId = actFlowCommonService.getProcessDefId(processInstanceId);
|
||||
switch (taskName) {
|
||||
case CONTACT_USER_DISTRIBUTE:
|
||||
boolean distribute = flowUserVO.isDistribute();
|
||||
taskService.setVariableLocal(taskId, "distribute", distribute);
|
||||
// 获取是否分发
|
||||
if (!flowUserVO.isDistribute()) {
|
||||
if (distribute) {
|
||||
// 设置流程变量
|
||||
taskService.setVariableLocal(taskId, "workGroupUserList", flowUserVO.getWorkGroupUserList());
|
||||
}else {
|
||||
// 保存联络人主管级上级领导
|
||||
dataList.forEach(data -> data.setContactUserLeaderLeader(flowUserVO.getContactUserLeaderLeader()));
|
||||
// 不分发,入库存表
|
||||
saveBatch(dataList);
|
||||
taskService.setVariableLocal(taskId, "contactUserLeaderLeader", flowUserVO.getContactUserLeaderLeader());
|
||||
}
|
||||
// 设置流程变量
|
||||
break;
|
||||
case WORK_GROUP_COLLECT:
|
||||
String executionId = task.getExecutionId();
|
||||
@@ -190,7 +184,8 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
dataList.forEach(data -> data.setCollectUserLeader(flowUserVO.getCollectUserLeader()));
|
||||
dataList.forEach(data -> data.setWorkGroupUser(UserUtils.getUserId()));
|
||||
saveBatch(dataList);
|
||||
// 设置流程变量
|
||||
// 设置下一个节点的审批人流程变量
|
||||
taskService.setVariableLocal(taskId, "collectUserLeader", flowUserVO.getCollectUserLeader());
|
||||
break;
|
||||
case CONTACT_USER_COLLECT:
|
||||
case CONTACT_USER_EDIT:
|
||||
@@ -202,22 +197,20 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
break;
|
||||
}
|
||||
if (pass) {
|
||||
// 更新业务流程数据
|
||||
variables = setVariables(annualReportDataVO);
|
||||
variables.put("pass", true);
|
||||
// 保存选人信息
|
||||
Map<String, Object> userMap = this.getUserMap(variables);
|
||||
processNodeLinkService.saveNodeUserLink(processDefinitionId, processInstanceId, userMap);
|
||||
if (flowUserVO != null) {
|
||||
Map<String, Object> userMap = new HashMap<>(this.setUserVariables(flowUserVO));
|
||||
processNodeLinkService.saveNodeUserLink(processDefinitionId, processInstanceId, userMap);
|
||||
Map<String, Object> variables = setUserVariables(flowUserVO);
|
||||
actFlowCommonService.setProcessVariables(processInstanceId, variables);
|
||||
}
|
||||
runtimeService.setVariable(processInstanceId, "pass", true);
|
||||
} else {
|
||||
// 设置流程变量
|
||||
variables.put("pass", false);
|
||||
runtimeService.setVariable(processInstanceId, "pass", false);
|
||||
}
|
||||
// 设置流程变量
|
||||
variables.put("pass", pass);
|
||||
|
||||
//更新审批表为完成,填充数据
|
||||
// 更新审批表为完成,填充数据
|
||||
actFlowCommonService.updateApprovalInfo(commonVO, taskId, pass);
|
||||
//审批节点
|
||||
// 审批节点
|
||||
actFlowCommonService.completeTask(taskId, userId);
|
||||
}
|
||||
|
||||
@@ -289,6 +282,7 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
}
|
||||
|
||||
private AnnualReportFlowUserVO getProcessUserInfo(String processDefinitionId, String processInstanceId) {
|
||||
//TODO 每个节点返回的人员信息应该是不同的
|
||||
List<ProcessNode> nodeList = processNodeService.getNodeList(processDefinitionId, processInstanceId);
|
||||
AnnualReportFlowUserVO annualReportFlowUserVO = new AnnualReportFlowUserVO();
|
||||
Map<String, ProcessNode> userMap = nodeList.stream().collect(Collectors.toMap(ProcessNode::getVariableName, node -> node));
|
||||
|
||||
-7
@@ -21,13 +21,6 @@ public interface ProcessEsInitChangeService extends IService<ProcessEsInitChange
|
||||
*/
|
||||
void startInitChange(InitChangeDataVO initChangeData);
|
||||
|
||||
/**
|
||||
* 转办
|
||||
* @param taskId
|
||||
* @param userId
|
||||
*/
|
||||
void transfer(String taskId, String userId);
|
||||
|
||||
/**
|
||||
* 审批
|
||||
* @param pass
|
||||
|
||||
+28
-77
@@ -7,10 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.enums.YesOrNoEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.modules.activiti.entity.ProcessAll;
|
||||
import com.jero.modules.activiti.entity.ProcessApprovalRecord;
|
||||
import com.jero.modules.activiti.entity.ProcessNode;
|
||||
import com.jero.modules.activiti.enums.CommitFlagEnum;
|
||||
import com.jero.modules.activiti.enums.FinishFlagEnum;
|
||||
import com.jero.modules.activiti.enums.ProcessTypeEnum;
|
||||
import com.jero.modules.activiti.process.common.entity.CommonVO;
|
||||
import com.jero.modules.activiti.process.common.entity.ProcessDraft;
|
||||
@@ -23,7 +20,6 @@ import com.jero.modules.activiti.process.esInitChange.entity.vo.InitChangeDataVO
|
||||
import com.jero.modules.activiti.process.esInitChange.service.ProcessEsInitChangeService;
|
||||
import com.jero.modules.activiti.process.esInitChange.mapper.ProcessEsInitChangeMapper;
|
||||
import com.jero.modules.activiti.service.ProcessAllService;
|
||||
import com.jero.modules.activiti.service.ProcessApprovalRecordService;
|
||||
import com.jero.modules.activiti.service.ProcessNodeLinkService;
|
||||
import com.jero.modules.activiti.service.ProcessNodeService;
|
||||
import com.jero.modules.laws.enterprise.service.ESSequenceNumberProvider;
|
||||
@@ -56,9 +52,6 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
|
||||
@Resource
|
||||
private ActFlowCommonService actFlowCommonService;
|
||||
|
||||
@Resource
|
||||
private ProcessApprovalRecordService processApprovalRecordService;
|
||||
|
||||
@Resource
|
||||
private EnterpriseStandardUtil esUtil;
|
||||
|
||||
@@ -112,42 +105,40 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
|
||||
public Map<String, Object> setVariables(InitChangeDataVO initChangeData) {
|
||||
InitChangeFlowUserVO initChangeFlowUserVO = initChangeData.getFlowUserInfoVO();
|
||||
ProcessEsInitChange initChange = initChangeData.getDataList().get(0);
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
// 使用一个通用方法来只在不为空时添加键值对
|
||||
putIfNotNull(map, "createUser", initChangeFlowUserVO.getCreateUser());
|
||||
putIfNotNull(map, "contactUser", initChangeFlowUserVO.getContactUser());
|
||||
List<String> standardExpertList = new ArrayList<>(Objects.requireNonNull(Optional.ofNullable(initChangeFlowUserVO.getStandardExpert()).map(s -> Arrays.asList(s.split(","))).orElse(null)));
|
||||
putIfNotNull(map, "standardExpertList", standardExpertList);
|
||||
putIfNotNull(map, "mainDraftUserLeader", initChangeFlowUserVO.getMainDraftUserLeader());
|
||||
putIfNotNull(map, "mainDraftUserLeaderLeader", initChangeFlowUserVO.getMainDraftUserLeaderLeader());
|
||||
putIfNotNull(map, "standardizationApprovalUser", initChangeFlowUserVO.getStandardizationApprovalUser());
|
||||
putIfNotNull(map, "newMainDraftUserLeaderLeader", initChangeFlowUserVO.getNewMainDraftUserLeaderLeader());
|
||||
putIfNotNull(map, "newMainDraftUserLeader", initChangeFlowUserVO.getNewMainDraftUserLeader());
|
||||
putIfNotNull(map, "relatedUserList", Optional.ofNullable(initChangeFlowUserVO.getRelatedUser()).map(s -> Arrays.asList(s.split(","))).orElse(null));
|
||||
putIfNotNull(map, "copyUser", initChangeFlowUserVO.getCopyUser());
|
||||
putIfNotNull(map, "applicationCategory", initChange.getApplicationCategory());
|
||||
putIfNotNull(map, "projectType", initChange.getProjectType());
|
||||
HashMap<String, Object> map = new HashMap<>(this.setUserVariables(initChangeFlowUserVO));
|
||||
actFlowCommonService.putIfNotNull(map, "applicationCategory", initChange.getApplicationCategory());
|
||||
actFlowCommonService.putIfNotNull(map, "projectType", initChange.getProjectType());
|
||||
return map;
|
||||
}
|
||||
|
||||
public Map<String, Object> setUserVariables(InitChangeFlowUserVO initChangeFlowUserVO) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
// 使用一个通用方法来只在不为空时添加键值对
|
||||
putIfNotNull(map, "createUser", initChangeFlowUserVO.getCreateUser());
|
||||
putIfNotNull(map, "contactUser", initChangeFlowUserVO.getContactUser());
|
||||
putIfNotNull(map, "standardExpertList", Optional.ofNullable(initChangeFlowUserVO.getStandardExpert()).map(s -> Arrays.asList(s.split(","))).orElse(null));
|
||||
putIfNotNull(map, "mainDraftUserLeader", initChangeFlowUserVO.getMainDraftUserLeader());
|
||||
putIfNotNull(map, "mainDraftUserLeaderLeader", initChangeFlowUserVO.getMainDraftUserLeaderLeader());
|
||||
putIfNotNull(map, "standardizationApprovalUser", initChangeFlowUserVO.getStandardizationApprovalUser());
|
||||
putIfNotNull(map, "newMainDraftUserLeaderLeader", initChangeFlowUserVO.getNewMainDraftUserLeaderLeader());
|
||||
putIfNotNull(map, "newMainDraftUserLeader", initChangeFlowUserVO.getNewMainDraftUserLeader());
|
||||
putIfNotNull(map, "relatedUserList", Optional.ofNullable(initChangeFlowUserVO.getRelatedUser()).map(s -> Arrays.asList(s.split(","))).orElse(null));
|
||||
putIfNotNull(map, "copyUser", initChangeFlowUserVO.getCopyUser());
|
||||
actFlowCommonService.putIfNotNull(map, "createUser", initChangeFlowUserVO.getCreateUser());
|
||||
actFlowCommonService.putIfNotNull(map, "contactUser", initChangeFlowUserVO.getContactUser());
|
||||
actFlowCommonService.putIfNotNull(map, "standardExpertList", Optional.ofNullable(initChangeFlowUserVO.getStandardExpert()).map(s -> Arrays.asList(s.split(","))).orElse(null));
|
||||
actFlowCommonService.putIfNotNull(map, "mainDraftUserLeader", initChangeFlowUserVO.getMainDraftUserLeader());
|
||||
actFlowCommonService.putIfNotNull(map, "mainDraftUserLeaderLeader", initChangeFlowUserVO.getMainDraftUserLeaderLeader());
|
||||
actFlowCommonService.putIfNotNull(map, "standardizationApprovalUser", initChangeFlowUserVO.getStandardizationApprovalUser());
|
||||
actFlowCommonService.putIfNotNull(map, "newMainDraftUserLeaderLeader", initChangeFlowUserVO.getNewMainDraftUserLeaderLeader());
|
||||
actFlowCommonService.putIfNotNull(map, "newMainDraftUserLeader", initChangeFlowUserVO.getNewMainDraftUserLeader());
|
||||
actFlowCommonService.putIfNotNull(map, "relatedUserList", Optional.ofNullable(initChangeFlowUserVO.getRelatedUser()).map(s -> Arrays.asList(s.split(","))).orElse(null));
|
||||
actFlowCommonService.putIfNotNull(map, "copyUser", initChangeFlowUserVO.getCopyUser());
|
||||
return map;
|
||||
}
|
||||
|
||||
private void putIfNotNull(Map<String, Object> map, String key, Object value) {
|
||||
Optional.ofNullable(value).ifPresent(v -> map.put(key, v));
|
||||
private Map<String, Object> getUserMap(Map<String, Object> variables) {
|
||||
variables.remove("pass");
|
||||
variables.remove("applicationCategory");
|
||||
variables.remove("projectType");
|
||||
// 转成逗号拼接
|
||||
variables.put("standardExpertList", Optional.ofNullable((List<String>) variables.get("standardExpertList"))
|
||||
.map(list -> String.join(",", list))
|
||||
.orElse(""));
|
||||
variables.put("relatedUserList", Optional.ofNullable((List<String>) variables.get("relatedUserList"))
|
||||
.map(list -> String.join(",", list))
|
||||
.orElse(""));
|
||||
return variables;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -195,11 +186,6 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
|
||||
return initChangeFlowUserVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transfer(String taskId, String userId) {
|
||||
actFlowCommonService.transfer(taskId, userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void approvalInitChange(InitChangeDataVO initChangeDataVO, boolean pass) {
|
||||
String userId = UserUtils.getUserId();
|
||||
@@ -213,8 +199,7 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
|
||||
if (pass) {
|
||||
InitChangeFlowUserVO flowUserInfoVO = initChangeDataVO.getFlowUserInfoVO();
|
||||
if (flowUserInfoVO != null) {
|
||||
Map<String, Object> userMap = new HashMap<>();
|
||||
this.setUserMap(userMap, flowUserInfoVO);
|
||||
Map<String, Object> userMap = new HashMap<>(this.setUserVariables(flowUserInfoVO));
|
||||
processNodeLinkService.saveNodeUserLink(processDefinitionId, processInstanceId, userMap);
|
||||
Map<String, Object> variables = setUserVariables(flowUserInfoVO);
|
||||
actFlowCommonService.setProcessVariables(processInstanceId, variables);
|
||||
@@ -224,46 +209,12 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
|
||||
// 设置流程变量
|
||||
runtimeService.setVariable(processInstanceId, "pass", false);
|
||||
}
|
||||
//更新审批表为完成,填充数据
|
||||
ProcessApprovalRecord approvalRecord = processApprovalRecordService.getToDoByTaskId(taskId);
|
||||
approvalRecord.setCommitFlag(pass ? CommitFlagEnum.PASS.getValue() : CommitFlagEnum.REJECT.getValue());
|
||||
approvalRecord.setCommitText(commonVO.getCommitText());
|
||||
approvalRecord.setCommitFile(commonVO.getCommitFile());
|
||||
approvalRecord.setFinishFlag(FinishFlagEnum.COMPLETE.getValue());
|
||||
approvalRecord.setEndTime(new Date());
|
||||
processApprovalRecordService.updateById(approvalRecord);
|
||||
// 更新审批表为完成,填充数据
|
||||
actFlowCommonService.updateApprovalInfo(commonVO, taskId, pass);
|
||||
//审批节点
|
||||
actFlowCommonService.completeTask(taskId, userId);
|
||||
}
|
||||
|
||||
private Map<String, Object> getUserMap(Map<String, Object> variables) {
|
||||
variables.remove("pass");
|
||||
variables.remove("applicationCategory");
|
||||
variables.remove("projectType");
|
||||
// 转成逗号拼接
|
||||
variables.put("standardExpertList", Optional.ofNullable((List<String>) variables.get("standardExpertList"))
|
||||
.map(list -> String.join(",", list))
|
||||
.orElse(""));
|
||||
variables.put("relatedUserList", Optional.ofNullable((List<String>) variables.get("relatedUserList"))
|
||||
.map(list -> String.join(",", list))
|
||||
.orElse(""));
|
||||
return variables;
|
||||
}
|
||||
|
||||
private void setUserMap(Map<String, Object> variables, InitChangeFlowUserVO initChangeFlowUserVO) {
|
||||
// 设置流程中各个节点的人
|
||||
putIfNotNull(variables, "createUser", initChangeFlowUserVO.getCreateUser());
|
||||
putIfNotNull(variables, "contactUser", initChangeFlowUserVO.getContactUser());
|
||||
putIfNotNull(variables, "standardExpertList", Optional.ofNullable(initChangeFlowUserVO.getStandardExpert()).map(s -> Arrays.asList(s.split(","))).orElse(null));
|
||||
putIfNotNull(variables, "mainDraftUserLeader", initChangeFlowUserVO.getMainDraftUserLeader());
|
||||
putIfNotNull(variables, "mainDraftUserLeaderLeader", initChangeFlowUserVO.getMainDraftUserLeaderLeader());
|
||||
putIfNotNull(variables, "standardizationApprovalUser", initChangeFlowUserVO.getStandardizationApprovalUser());
|
||||
putIfNotNull(variables, "newMainDraftUserLeaderLeader", initChangeFlowUserVO.getNewMainDraftUserLeaderLeader());
|
||||
putIfNotNull(variables, "newMainDraftUserLeader", initChangeFlowUserVO.getNewMainDraftUserLeader());
|
||||
putIfNotNull(variables, "relatedUserList", Optional.ofNullable(initChangeFlowUserVO.getRelatedUser()).map(s -> Arrays.asList(s.split(","))).orElse(null));
|
||||
putIfNotNull(variables, "copyUser", initChangeFlowUserVO.getCopyUser());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveToDraft(InitChangeDataVO initChangeData) {
|
||||
CommonVO commonVO = initChangeData.getCommonVO();
|
||||
|
||||
Reference in New Issue
Block a user