feat: 复审流程结束后自动发起立项修订流程
This commit is contained in:
+8
-17
@@ -84,10 +84,12 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
CommonVO commonVO = annualReportData.getCommonVO();
|
||||
// 当前用户Id
|
||||
String userId = UserUtils.getUserId();
|
||||
//
|
||||
// 人员数据
|
||||
Map<String, Object> variables = annualReportData.getFlowUser();
|
||||
// 设置流程变量
|
||||
Map<String, Object> actVariables = this.setVariables(annualReportData);
|
||||
// 删除草稿
|
||||
actFlowCommonService.getExistDraftAndRemove(commonVO, ProcessTypeEnum.ES_ANNUAL_REPORT);
|
||||
// 启动流程
|
||||
ProcessInstance processInstance = actFlowCommonService.startProcess(processDefinitionKey, actVariables);
|
||||
// 获取流程实例ID
|
||||
@@ -113,22 +115,11 @@ public class ProcessEsAnnualReportServiceImpl extends ServiceImpl<ProcessEsAnnua
|
||||
Map<String, Object> actVariables = new HashMap<>();
|
||||
CommonVO commonVO = annualReportData.getCommonVO();
|
||||
Map<String, Object> flowUser = annualReportData.getFlowUser();
|
||||
actFlowCommonService.putIfNotNull(actVariables, "contactUserList", Optional.ofNullable((String)flowUser.get("contactUserList")).map(s -> Arrays.asList(s.split(","))).orElse(null));
|
||||
if (flowUser.get("workGroupUserList") == null || StrUtil.isBlank((String)flowUser.get("workGroupUserList"))) {
|
||||
actFlowCommonService.putIfNotNull(actVariables, "distribute", false);
|
||||
} else {
|
||||
actFlowCommonService.putIfNotNull(actVariables, "distribute", true);
|
||||
String relatedUsers = (String) flowUser.get("relatedUserList");
|
||||
// 将relatedUserList从逗号拼接转为List
|
||||
List<String> relatedUserList = StrUtil.split(relatedUsers, ',');
|
||||
actFlowCommonService.putIfNotNull(actVariables, "relatedUserList", relatedUserList);
|
||||
}
|
||||
for (Map.Entry<String, Object> entry : flowUser.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (!key.equals("contactUserList") && !key.equals("workGroupUserList")) {
|
||||
actVariables.put(key, entry.getValue());
|
||||
}
|
||||
}
|
||||
actFlowCommonService.putIfNotNull(actVariables, "contactUserList",
|
||||
Optional.ofNullable((String)flowUser.get("contactUserList"))
|
||||
.map(s -> Arrays.asList(s.split(",")))
|
||||
.orElse(null));
|
||||
actVariables.put("standardEngineer", flowUser.get("standardEngineer"));
|
||||
actVariables.put("processDescription", commonVO.getProcessDescription());
|
||||
return actVariables;
|
||||
}
|
||||
|
||||
+5
@@ -55,4 +55,9 @@ public interface ProcessEsInitChangeService extends IService<ProcessEsInitChange
|
||||
*/
|
||||
InitChangeDataVO getDraftData(String draftId, String businessId);
|
||||
|
||||
/**
|
||||
* 复审-继续有效-自动发起立项变更流程
|
||||
* @param standNo
|
||||
*/
|
||||
void autoStartProcessByRecheck(String standardNo);
|
||||
}
|
||||
|
||||
+44
@@ -22,6 +22,8 @@ import com.jero.modules.activiti.process.esInitChange.mapper.ProcessEsInitChange
|
||||
import com.jero.modules.activiti.service.ProcessNodeLinkService;
|
||||
import com.jero.modules.laws.enterprise.service.ESSequenceNumberProvider;
|
||||
import com.jero.modules.laws.enterprise.util.EnterpriseStandardUtil;
|
||||
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
|
||||
import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService;
|
||||
import com.jero.modules.sys.utils.UserUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
@@ -61,6 +63,9 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
|
||||
@Resource
|
||||
private TaskService taskService;
|
||||
|
||||
@Resource
|
||||
private ILawsEnterpriseStandardService esService;
|
||||
|
||||
@Override
|
||||
public void startProcess(InitChangeDataVO initChangeData) {
|
||||
// 执行流程发起前的操作
|
||||
@@ -169,6 +174,45 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autoStartProcessByRecheck(String standardNo) {
|
||||
// 1. 根据企标编号找到对应企标的主起草人
|
||||
LambdaQueryWrapper<LawsEnterpriseStandard> esWrapper = new LambdaQueryWrapper<>();
|
||||
esWrapper.eq(LawsEnterpriseStandard::getStandardNumber, standardNo);
|
||||
esWrapper.eq(LawsEnterpriseStandard::getDelFlag, YesOrNoEnum.NO.getValue());
|
||||
LawsEnterpriseStandard es = esService.getOne(esWrapper);
|
||||
String mainDraftUser = es.getMainDraftingUser();
|
||||
if (StrUtil.isBlank(mainDraftUser)) {
|
||||
// TODO 企标主起草人为空,待定
|
||||
}
|
||||
// 流程Key
|
||||
String processDefinitionKey = ProcessType.ES_INIT_CHANGE.getProcessKey();
|
||||
// 设置流程变量
|
||||
Map<String, Object> variables = new HashMap<>();
|
||||
variables.put("mainDraftUser", mainDraftUser);
|
||||
// 启动流程
|
||||
ProcessInstance processInstance = actFlowCommonService.startProcess(processDefinitionKey, variables);
|
||||
ProcessEsInitChange initChange = new ProcessEsInitChange();
|
||||
// 获取流程实例ID
|
||||
String processDefinitionId = processInstance.getProcessDefinitionId();
|
||||
String processInstanceId = processInstance.getId();
|
||||
// 设置流程实例Id
|
||||
initChange.setProcessInstanceId(processInstanceId);
|
||||
// 生成唯一的businessId
|
||||
String newBusinessId = actFlowCommonService.getNewBusinessId();
|
||||
// 新增业务表数据
|
||||
initChange.setBusinessId(newBusinessId);
|
||||
// 保存到业务流程表
|
||||
save(initChange);
|
||||
// 保存选人信息
|
||||
// 人员
|
||||
processNodeLinkService.saveNodeUserLink(processDefinitionId, processInstanceId, variables);
|
||||
// 根据流程实例id更新流程总表
|
||||
String prcName = standardNo + "--立项";
|
||||
Integer prcType = ProcessTypeEnum.ES_INIT_CHANGE.getValue();
|
||||
actFlowCommonService.updateProcessAll(processInstanceId, mainDraftUser, prcName, null, prcType, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void approvalInitChange(InitChangeDataVO initChangeDataVO, boolean pass) {
|
||||
String userId = UserUtils.getUserId();
|
||||
|
||||
+17
-11
@@ -12,7 +12,9 @@ import com.jero.modules.activiti.process.esInitChange.service.ProcessEsInitChang
|
||||
import com.jero.modules.activiti.process.esRecheck.entity.ProcessEsRecheck;
|
||||
import com.jero.modules.activiti.process.esRecheck.service.ProcessEsRecheckService;
|
||||
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardPlan;
|
||||
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardRecheckPlan;
|
||||
import com.jero.modules.laws.enterprise.service.EnterpriseStandardPlanService;
|
||||
import com.jero.modules.laws.enterprise.service.EnterpriseStandardRecheckPlanService;
|
||||
import com.jero.modules.laws.enterprise.util.BeanCopyUtils;
|
||||
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
|
||||
import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService;
|
||||
@@ -46,7 +48,10 @@ public class ProcessESRecheckEndListener implements ExecutionListener {
|
||||
private ProcessEsRecheckService esRecheckService;
|
||||
|
||||
@Resource
|
||||
private ILawsEnterpriseStandardService esService;
|
||||
private EnterpriseStandardRecheckPlanService esRecheckPlanService;
|
||||
|
||||
@Resource
|
||||
private ProcessEsInitChangeService esInitChangeService;
|
||||
|
||||
@Override
|
||||
public void notify(DelegateExecution delegateExecution) {
|
||||
@@ -60,24 +65,25 @@ public class ProcessESRecheckEndListener implements ExecutionListener {
|
||||
String standNo = recheck.getStandardNumber();
|
||||
log.info("企标复审流程结束 监听执行器开始执行,企标编号为:{}", standNo);
|
||||
if (RECHECK_CONTINUE_VALID.equals(recheckAdvice)) {
|
||||
// TODO 继续有效
|
||||
// TODO 继续有效 更新下次复审时间,不做其他处理。 (复审时间更新的逻辑待定)
|
||||
}
|
||||
if (RECHECK_INIT_CHANGE.equals(recheckAdvice)) {
|
||||
// TODO 修订
|
||||
// 修订 自动发起企标立项/变更流程(修订模式)
|
||||
esInitChangeService.autoStartProcessByRecheck(standNo);
|
||||
}
|
||||
if (RECHECK_ABOLISH.equals(recheckAdvice)) {
|
||||
// 废止
|
||||
LambdaUpdateWrapper<LawsEnterpriseStandard> esWrapper = new LambdaUpdateWrapper<>();
|
||||
esWrapper.eq(LawsEnterpriseStandard::getStandardNumber, standNo);
|
||||
esWrapper.set(LawsEnterpriseStandard::getStandardState, StandardStateEnum.ABOLISH.getStateValue());
|
||||
esService.update(esWrapper);
|
||||
LambdaUpdateWrapper<EnterpriseStandardRecheckPlan> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.eq(EnterpriseStandardRecheckPlan::getStandardNo, standNo);
|
||||
wrapper.set(EnterpriseStandardRecheckPlan::getRecheckResult, RECHECK_ABOLISH);
|
||||
esRecheckPlanService.update(wrapper);
|
||||
}
|
||||
if (RECHECK_ARCHIVE.equals(recheckAdvice)) {
|
||||
// 封存
|
||||
LambdaUpdateWrapper<LawsEnterpriseStandard> esWrapper = new LambdaUpdateWrapper<>();
|
||||
esWrapper.eq(LawsEnterpriseStandard::getStandardNumber, standNo);
|
||||
esWrapper.set(LawsEnterpriseStandard::getStandardState, StandardStateEnum.ARCHIVE.getStateValue());
|
||||
esService.update(esWrapper);
|
||||
LambdaUpdateWrapper<EnterpriseStandardRecheckPlan> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.eq(EnterpriseStandardRecheckPlan::getStandardNo, standNo);
|
||||
wrapper.set(EnterpriseStandardRecheckPlan::getRecheckResult, RECHECK_ARCHIVE);
|
||||
esRecheckPlanService.update(wrapper);
|
||||
}
|
||||
log.info("企标复审流程监听执行器执行结束");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user