mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 17:21:53 +08:00
【代码评审】BPM:会签逻辑的实现
This commit is contained in:
parent
479d664a63
commit
b0fe72d735
@ -49,6 +49,7 @@ public class BpmSimpleModelNodeVO {
|
||||
*/
|
||||
@JsonIgnore
|
||||
private String attachNodeId;
|
||||
|
||||
// Map<String, Integer> formPermissions; 表单权限;仅发起、审批、抄送节点会使用
|
||||
// Integer approveMethod; 审批方式;仅审批节点会使用
|
||||
// TODO @jason 后面和前端一起调整一下
|
||||
|
@ -30,6 +30,8 @@ public class MultiInstanceServiceTaskDelegate implements JavaDelegate {
|
||||
// 获取会签任务是否被拒绝
|
||||
Boolean userTaskRejected = execution.getVariable(String.format("%s_reject", attachUserTaskId), Boolean.class);
|
||||
// 如果会签任务被拒绝, 终止流程
|
||||
// TODO @jason:【重要】需要测试下,如果基于 createChangeActivityStateBuilder()、changeState 到结束节点,实现审批不通过;
|
||||
// 注意:需要考虑 bpmn 的高亮问题;(不过这个,未来可能会废弃掉!)
|
||||
if (BooleanUtil.isTrue(userTaskRejected)) {
|
||||
processInstanceService.updateProcessInstanceReject(execution.getProcessInstanceId(),
|
||||
BpmCommentTypeEnum.REJECT.formatComment("会签任务拒绝人数满足条件"));
|
||||
|
@ -42,6 +42,7 @@ public class CompleteByRejectCountExpression {
|
||||
Integer approveMethod = NumberUtils.parseInt(BpmnModelUtils.parseExtensionElement(flowElement, USER_TASK_APPROVE_METHOD));
|
||||
Assert.notNull(approveMethod, "审批方式不能空");
|
||||
// 计算拒绝的人数
|
||||
// TODO @jason:CollUtil.filter().size();貌似可以更简洁
|
||||
Integer rejectCount = CollectionUtils.getSumValue(execution.getExecutions(),
|
||||
item -> Objects.equals(BpmTaskStatusEnum.REJECT.getStatus(), item.getVariableLocal(BpmConstants.TASK_VARIABLE_STATUS, Integer.class)) ? 1 : 0,
|
||||
Integer::sum, 0);
|
||||
@ -81,4 +82,5 @@ public class CompleteByRejectCountExpression {
|
||||
log.error("[completionCondition] 按拒绝人数计算会签的完成条件的审批方式[{}],配置有误", approveMethod);
|
||||
throw exception(GlobalErrorCodeConstants.ERROR_CONFIGURATION);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -353,6 +353,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
return;
|
||||
} else if (userTaskRejectHandlerType == BpmUserTaskRejectHandlerType.FINISH_PROCESS_BY_REJECT_NUMBER) {
|
||||
// 3.3 按拒绝人数终止流程
|
||||
// TODO @jason:建议抛出系统异常。类似 throw new IllegalStateException()
|
||||
if (!flowElement.hasMultiInstanceLoopCharacteristics()) {
|
||||
log.error("[rejectTask] 用户任务拒绝处理类型配置错误, 按拒绝人数终止流程只能用于会签任务");
|
||||
throw exception(GlobalErrorCodeConstants.ERROR_CONFIGURATION);
|
||||
|
Loading…
Reference in New Issue
Block a user