feat: 企标立项变更流程接收参数变更为集合
This commit is contained in:
+5
-21
@@ -4,7 +4,6 @@ import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.activiti.process.common.entity.CenterQueryVO;
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.ProcessEsInitChange;
|
||||
import com.jero.modules.activiti.process.esInitChange.service.ProcessEsInitChangeService;
|
||||
import com.jero.modules.activiti.util.SpringContextUtil;
|
||||
import com.jero.modules.sys.utils.UserUtils;
|
||||
@@ -16,7 +15,6 @@ import org.activiti.engine.impl.identity.Authentication;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.activiti.engine.task.TaskQuery;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -49,15 +47,13 @@ public class ActFlowCommonService {
|
||||
/**
|
||||
* 启动流程实例
|
||||
*/
|
||||
public ProcessInstance startProcess(String formKey, String beanName, String businessKey, String id) {
|
||||
public ProcessInstance startProcess(String formKey, String beanName, String id) {
|
||||
IActFlowCustomService customService = (IActFlowCustomService) SpringContextUtil.getBean(beanName);
|
||||
// 修改业务的状态
|
||||
customService.startRunTask(id);
|
||||
Map<String, Object> variables = customService.setVariables(id);
|
||||
variables.put("businessKey", businessKey);
|
||||
// 启动流程
|
||||
log.info("【启动流程】,formKey :{},businessKey:{}", formKey, businessKey);
|
||||
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(formKey, businessKey, variables);
|
||||
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(formKey, variables);
|
||||
// 流程实例ID
|
||||
String processDefinitionId = processInstance.getProcessDefinitionId();
|
||||
log.info("【启动流程】- 成功,processDefinitionId:{}", processDefinitionId);
|
||||
@@ -118,7 +114,6 @@ public class ActFlowCommonService {
|
||||
map.put("category", task.getCategory());
|
||||
map.put("parentTaskId", task.getParentTaskId());
|
||||
map.put("tenantId", task.getTenantId());
|
||||
|
||||
listMap.add(map);
|
||||
}
|
||||
|
||||
@@ -148,20 +143,9 @@ public class ActFlowCommonService {
|
||||
.createProcessInstanceQuery()
|
||||
.processInstanceId(task.getProcessInstanceId())
|
||||
.singleResult();
|
||||
if (processInstance != null) {
|
||||
String businessKey = processInstance.getBusinessKey();
|
||||
if (!StringUtils.isBlank(businessKey)) {
|
||||
String type = businessKey.split(":")[0];
|
||||
String id = businessKey.split(":")[1];
|
||||
if (type.equals("intiChange")) {
|
||||
ProcessEsInitChange initChange = processEsInitChangeService.getById(id);
|
||||
LoginUser createUser = sysBaseAPI.getUserById(initChange.getCreateBy());
|
||||
map.put("createUser", createUser.getId());
|
||||
map.put("createUserText", createUser.getUsername());
|
||||
map.put("prcType", "企标立项/变更");
|
||||
}
|
||||
}
|
||||
}
|
||||
String prcId = processInstance.getId();
|
||||
//TODO 根据流程Id找到对应业务流程实体
|
||||
|
||||
listMap.add(map);
|
||||
}
|
||||
return listMap;
|
||||
|
||||
+7
-6
@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -77,13 +78,13 @@ public class ProcessESInitChangeController {
|
||||
/**
|
||||
* 新增立项变更申请
|
||||
*
|
||||
* @param esInitChange
|
||||
* @param esInitChangeList
|
||||
*/
|
||||
@AutoLog(value = "企标立项变更流程-新增立项变更申请")
|
||||
@ApiOperation(value="企标立项变更流程-新增立项变更申请", notes="企标立项变更流程-新增立项变更申请")
|
||||
@PostMapping("/add")
|
||||
public Result<?> addInitChange(@RequestBody ProcessEsInitChange esInitChange) {
|
||||
initChangeService.addInitChange(esInitChange);
|
||||
public Result<?> addInitChange(@RequestBody List<ProcessEsInitChange> esInitChangeList) {
|
||||
initChangeService.addInitChange(esInitChangeList);
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
@@ -92,14 +93,14 @@ public class ProcessESInitChangeController {
|
||||
* 审批(同意/驳回)
|
||||
*
|
||||
* @param taskId
|
||||
* @param esInitChange
|
||||
* @param esInitChangeList
|
||||
*/
|
||||
@AutoLog(value = "企标立项变更流程-审批(同意/驳回)")
|
||||
@ApiOperation(value="企标立项变更流程-审批(同意/驳回)", notes="企标立项变更流程-审批(同意/驳回)")
|
||||
@PostMapping("/approval")
|
||||
public Result<?> approval(@RequestParam("taskId") String taskId, @RequestBody ProcessEsInitChange esInitChange) {
|
||||
public Result<?> approval(@RequestParam("taskId") String taskId, @RequestBody List<ProcessEsInitChange> esInitChangeList) {
|
||||
//审批
|
||||
initChangeService.approvalInitChange(taskId, esInitChange);
|
||||
initChangeService.approvalInitChange(taskId, esInitChangeList);
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -3,6 +3,8 @@ package com.jero.modules.activiti.process.esInitChange.service;
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.ProcessEsInitChange;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【process_es_init_change(企标计划)】的数据库操作Service
|
||||
@@ -15,7 +17,7 @@ public interface ProcessEsInitChangeService extends IService<ProcessEsInitChange
|
||||
* @param esInitChange
|
||||
* @return
|
||||
*/
|
||||
void addInitChange(ProcessEsInitChange esInitChange);
|
||||
void addInitChange(List<ProcessEsInitChange> esInitChange);
|
||||
|
||||
/**
|
||||
* 转办
|
||||
@@ -29,7 +31,7 @@ public interface ProcessEsInitChangeService extends IService<ProcessEsInitChange
|
||||
* @param taskId
|
||||
* @param esInitChange
|
||||
*/
|
||||
void approvalInitChange(String taskId, ProcessEsInitChange esInitChange);
|
||||
void approvalInitChange(String taskId, List<ProcessEsInitChange> esInitChange);
|
||||
|
||||
/**
|
||||
* 保存到待办
|
||||
|
||||
+29
-11
@@ -5,6 +5,7 @@ import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.modules.activiti.process.common.service.ActFlowCommonService;
|
||||
import com.jero.modules.activiti.process.common.service.IActFlowCustomService;
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.ProcessEsInitChange;
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.enums.ESProjectType;
|
||||
import com.jero.modules.activiti.process.esInitChange.service.ProcessEsInitChangeService;
|
||||
import com.jero.modules.activiti.process.esInitChange.mapper.ProcessEsInitChangeMapper;
|
||||
import com.jero.modules.sys.utils.UserUtils;
|
||||
@@ -60,21 +61,30 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInitChange(ProcessEsInitChange esInitChange) {
|
||||
public void addInitChange(List<ProcessEsInitChange> esInitChangeList) {
|
||||
String userId = UserUtils.getUserId();
|
||||
// 保存到业务流程表
|
||||
saveOrUpdateBatch(esInitChangeList);
|
||||
String id;
|
||||
// 完成时间变更/工作中止
|
||||
if (isListApproval(esInitChangeList)) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (ProcessEsInitChange ic : esInitChangeList) {
|
||||
stringBuilder.append(ic.getId()).append(",");
|
||||
}
|
||||
// 去掉最后的逗号
|
||||
stringBuilder.deleteCharAt(stringBuilder.length() - 1);
|
||||
id = stringBuilder.toString();
|
||||
} else {
|
||||
id = esInitChangeList.get(0).getId();
|
||||
}
|
||||
|
||||
// TODO 根据业务需求设置流程状态
|
||||
// 对数据进行其他操作
|
||||
|
||||
// 保存到业务流程表
|
||||
save(esInitChange);
|
||||
String id = esInitChange.getId();
|
||||
String formKey = "initChange";
|
||||
String beanName = formKey + "Service";
|
||||
|
||||
// 使用流程变量设置字符串(格式 : XXX:id 的形式)
|
||||
String businessKey = formKey + ":" + id;
|
||||
|
||||
ProcessInstance processInstance = actFlowCommonService.startProcess(formKey, beanName, businessKey, id);
|
||||
ProcessInstance processInstance = actFlowCommonService.startProcess(formKey, beanName, id);
|
||||
|
||||
// 获取流程实例ID
|
||||
String processDefinitionId = processInstance.getProcessDefinitionId();
|
||||
@@ -100,10 +110,18 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
|
||||
actFlowCommonService.transfer(taskId, userId);
|
||||
}
|
||||
|
||||
private boolean isListApproval(List<ProcessEsInitChange> esInitChangeList) {
|
||||
ProcessEsInitChange initChange = esInitChangeList.get(0);
|
||||
return ESProjectType.COMPLETE_TIME_CHANGE.getValue().equals(initChange.getProjectType()) ||
|
||||
ESProjectType.WORK_TERMINATE.getValue().equals(initChange.getProjectType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void approvalInitChange(String taskId, ProcessEsInitChange esInitChange) {
|
||||
public void approvalInitChange(String taskId, List<ProcessEsInitChange> esInitChangeList) {
|
||||
String userId = UserUtils.getUserId();
|
||||
actFlowCommonService.completeTask(esInitChange.getRemarks(), taskId, userId);
|
||||
saveOrUpdateBatch(esInitChangeList);
|
||||
// TODO 保存流程审批信息
|
||||
actFlowCommonService.completeTask(esInitChangeList.get(0).getRemarks(), taskId, userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user