update 统一业务id参数
This commit is contained in:
parent
f10ba97c7a
commit
e9ed89a367
@ -25,7 +25,7 @@ public class ProcessEvent implements Serializable {
|
||||
/**
|
||||
* 业务id
|
||||
*/
|
||||
private String businessKey;
|
||||
private String businessId;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
|
@ -35,6 +35,6 @@ public class ProcessTaskEvent implements Serializable {
|
||||
/**
|
||||
* 业务id
|
||||
*/
|
||||
private String businessKey;
|
||||
private String businessId;
|
||||
|
||||
}
|
||||
|
@ -28,9 +28,9 @@ public interface WorkflowService {
|
||||
/**
|
||||
* 获取当前流程状态
|
||||
*
|
||||
* @param businessKey 业务id
|
||||
* @param businessId 业务id
|
||||
*/
|
||||
String getBusinessStatus(String businessKey);
|
||||
String getBusinessStatus(String businessId);
|
||||
|
||||
/**
|
||||
* 设置流程变量
|
||||
@ -43,8 +43,8 @@ public interface WorkflowService {
|
||||
/**
|
||||
* 按照业务id查询流程实例id
|
||||
*
|
||||
* @param businessKey 业务id
|
||||
* @param businessId 业务id
|
||||
* @return 结果
|
||||
*/
|
||||
Long getInstanceIdByBusinessKey(String businessKey);
|
||||
Long getInstanceIdByBusinessKey(String businessId);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public interface FlowConstant {
|
||||
/**
|
||||
* 业务id
|
||||
*/
|
||||
String BUSINESS_KEY = "businessKey";
|
||||
String BUSINESS_KEY = "businessId";
|
||||
|
||||
/**
|
||||
* 任务id
|
||||
|
@ -35,7 +35,7 @@ public class FlowInstanceBo implements Serializable {
|
||||
/**
|
||||
* 业务id
|
||||
*/
|
||||
private String businessKey;
|
||||
private String businessId;
|
||||
|
||||
/**
|
||||
* 模型分类
|
||||
|
@ -26,7 +26,7 @@ public class StartProcessBo implements Serializable {
|
||||
* 业务唯一值id
|
||||
*/
|
||||
@NotBlank(message = "业务ID不能为空", groups = {AddGroup.class})
|
||||
private String businessKey;
|
||||
private String businessId;
|
||||
|
||||
/**
|
||||
* 流程定义编码
|
||||
|
@ -20,15 +20,15 @@ public class FlowProcessEventHandler {
|
||||
* 总体流程监听(例如: 提交 退回 撤销 终止 作废等)
|
||||
*
|
||||
* @param flowCode 流程定义编码
|
||||
* @param businessKey 业务id
|
||||
* @param businessId 业务id
|
||||
* @param status 状态
|
||||
* @param submit 当为true时为申请人节点办理
|
||||
*/
|
||||
public void processHandler(String flowCode, String businessKey, String status, boolean submit) {
|
||||
log.info("发布流程事件,流程状态: {}, 流程编码: {}, 业务ID: {}", status, flowCode, businessKey);
|
||||
public void processHandler(String flowCode, String businessId, String status, boolean submit) {
|
||||
log.info("发布流程事件,流程状态: {}, 流程编码: {}, 业务ID: {}", status, flowCode, businessId);
|
||||
ProcessEvent processEvent = new ProcessEvent();
|
||||
processEvent.setFlowCode(flowCode);
|
||||
processEvent.setBusinessKey(businessKey);
|
||||
processEvent.setBusinessId(businessId);
|
||||
processEvent.setStatus(status);
|
||||
processEvent.setSubmit(submit);
|
||||
SpringUtils.context().publishEvent(processEvent);
|
||||
@ -40,15 +40,15 @@ public class FlowProcessEventHandler {
|
||||
* @param flowCode 流程定义编码
|
||||
* @param nodeCode 审批节点编码
|
||||
* @param taskId 任务id
|
||||
* @param businessKey 业务id
|
||||
* @param businessId 业务id
|
||||
*/
|
||||
public void processTaskHandler(String flowCode, String nodeCode, Long taskId, String businessKey) {
|
||||
log.info("发布流程任务事件, 流程编码: {}, 业务ID: {}", flowCode, businessKey);
|
||||
public void processTaskHandler(String flowCode, String nodeCode, Long taskId, String businessId) {
|
||||
log.info("发布流程任务事件, 流程编码: {}, 业务ID: {}", flowCode, businessId);
|
||||
ProcessTaskEvent processTaskEvent = new ProcessTaskEvent();
|
||||
processTaskEvent.setFlowCode(flowCode);
|
||||
processTaskEvent.setNodeCode(nodeCode);
|
||||
processTaskEvent.setTaskId(taskId);
|
||||
processTaskEvent.setBusinessKey(businessKey);
|
||||
processTaskEvent.setBusinessId(businessId);
|
||||
SpringUtils.context().publishEvent(processTaskEvent);
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
|
||||
queryWrapper.like(StringUtils.isNotBlank(flowInstanceBo.getFlowName()), "fd.flow_name", flowInstanceBo.getFlowName());
|
||||
queryWrapper.like(StringUtils.isNotBlank(flowInstanceBo.getFlowCode()), "fd.flow_code", flowInstanceBo.getFlowCode());
|
||||
queryWrapper.eq(StringUtils.isNotBlank(flowInstanceBo.getCategory()), "fd.category", flowInstanceBo.getCategory());
|
||||
queryWrapper.eq(StringUtils.isNotBlank(flowInstanceBo.getBusinessKey()), "fi.business_id", flowInstanceBo.getBusinessKey());
|
||||
queryWrapper.eq(StringUtils.isNotBlank(flowInstanceBo.getBusinessId()), "fi.business_id", flowInstanceBo.getBusinessId());
|
||||
queryWrapper.in(CollUtil.isNotEmpty(flowInstanceBo.getCreateByIds()), "fi.create_by", flowInstanceBo.getCreateByIds());
|
||||
queryWrapper.eq("fi.del_flag", "0");
|
||||
queryWrapper.orderByDesc("fi.create_time");
|
||||
|
@ -85,8 +85,8 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Map<String, Object> startWorkFlow(StartProcessBo startProcessBo) {
|
||||
String businessKey = startProcessBo.getBusinessKey();
|
||||
if (StringUtils.isBlank(businessKey)) {
|
||||
String businessId = startProcessBo.getBusinessId();
|
||||
if (StringUtils.isBlank(businessId)) {
|
||||
throw new ServiceException("启动工作流时必须包含业务ID");
|
||||
}
|
||||
// 启动流程实例(提交申请)
|
||||
@ -94,9 +94,9 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
// 流程发起人
|
||||
variables.put(INITIATOR, LoginHelper.getUserIdStr());
|
||||
// 业务id
|
||||
variables.put(BUSINESS_KEY, businessKey);
|
||||
variables.put(BUSINESS_KEY, businessId);
|
||||
FlowInstance flowInstance = flowInstanceMapper.selectOne(new LambdaQueryWrapper<>(FlowInstance.class)
|
||||
.eq(FlowInstance::getBusinessId, businessKey));
|
||||
.eq(FlowInstance::getBusinessId, businessId));
|
||||
if (ObjectUtil.isNotNull(flowInstance)) {
|
||||
BusinessStatusEnum.checkStartStatus(flowInstance.getFlowStatus());
|
||||
List<Task> taskList = taskService.list(new FlowTask().setInstanceId(flowInstance.getId()));
|
||||
@ -108,7 +108,7 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
flowParams.flowStatus(BusinessStatusEnum.DRAFT.getStatus());
|
||||
Instance instance;
|
||||
try {
|
||||
instance = insService.start(businessKey, flowParams);
|
||||
instance = insService.start(businessId, flowParams);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
||||
@EventListener(condition = "#processEvent.flowCode.startsWith('leave')")
|
||||
public void processHandler(ProcessEvent processEvent) {
|
||||
log.info("当前任务执行了{}", processEvent.toString());
|
||||
TestLeave testLeave = baseMapper.selectById(Long.valueOf(processEvent.getBusinessKey()));
|
||||
TestLeave testLeave = baseMapper.selectById(Long.valueOf(processEvent.getBusinessId()));
|
||||
testLeave.setStatus(processEvent.getStatus());
|
||||
if (processEvent.isSubmit()) {
|
||||
testLeave.setStatus(BusinessStatusEnum.WAITING.getStatus());
|
||||
@ -149,7 +149,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
||||
@EventListener(condition = "#processTaskEvent.flowCode=='leave'")
|
||||
public void processTaskHandler(ProcessTaskEvent processTaskEvent) {
|
||||
log.info("当前任务执行了{}", processTaskEvent.toString());
|
||||
TestLeave testLeave = baseMapper.selectById(Long.valueOf(processTaskEvent.getBusinessKey()));
|
||||
TestLeave testLeave = baseMapper.selectById(Long.valueOf(processTaskEvent.getBusinessId()));
|
||||
testLeave.setStatus(BusinessStatusEnum.WAITING.getStatus());
|
||||
baseMapper.updateById(testLeave);
|
||||
}
|
||||
|
@ -47,11 +47,11 @@ public class WorkflowServiceImpl implements WorkflowService {
|
||||
/**
|
||||
* 获取当前流程状态
|
||||
*
|
||||
* @param businessKey 业务id
|
||||
* @param businessId 业务id
|
||||
*/
|
||||
@Override
|
||||
public String getBusinessStatus(String businessKey) {
|
||||
FlowInstance flowInstance = flwInstanceService.selectInstByBusinessId(businessKey);
|
||||
public String getBusinessStatus(String businessId) {
|
||||
FlowInstance flowInstance = flwInstanceService.selectInstByBusinessId(businessId);
|
||||
return ObjectUtil.isNotNull(flowInstance) ? flowInstance.getFlowStatus() : StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
@ -69,12 +69,12 @@ public class WorkflowServiceImpl implements WorkflowService {
|
||||
/**
|
||||
* 按照业务id查询流程实例id
|
||||
*
|
||||
* @param businessKey 业务id
|
||||
* @param businessId 业务id
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Long getInstanceIdByBusinessKey(String businessKey) {
|
||||
FlowInstance flowInstance = flwInstanceService.selectInstByBusinessId(businessKey);
|
||||
public Long getInstanceIdByBusinessKey(String businessId) {
|
||||
FlowInstance flowInstance = flwInstanceService.selectInstByBusinessId(businessId);
|
||||
return ObjectUtil.isNotNull(flowInstance) ? flowInstance.getId() : null;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user