update - 调整工作流内部的一些关于人的逻辑
This commit is contained in:
parent
e83715ae84
commit
078cdf6045
@ -42,25 +42,4 @@ public class BpmnProcessInstanceCancelDTO {
|
||||
@NotNull(message = "审批流程的发起人不能为空")
|
||||
private BpmnTaskDelegateAssigner initiator;
|
||||
|
||||
// /**
|
||||
// * 租户 ID
|
||||
// */
|
||||
// @NotBlank(message = "租户不能为空")
|
||||
// @ApiModelProperty(value = "租户编号")
|
||||
// private String tenantId;
|
||||
//
|
||||
// /**
|
||||
// * 用户 ID
|
||||
// */
|
||||
// @NotBlank(message = "用户编号不能为空")
|
||||
// @ApiModelProperty(value = "操作人标识")
|
||||
// private String userId;
|
||||
//
|
||||
// /**
|
||||
// * 用户姓名
|
||||
// */
|
||||
// @ApiModelProperty(value = "操作人姓名")
|
||||
// @NotBlank(message = "用户姓名不能为空")
|
||||
// private String userName;
|
||||
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ public class BpmTransformUtil {
|
||||
public static StartEvent createStartEvent(String id, String formKey) {
|
||||
StartEvent startEvent = new StartEvent();
|
||||
startEvent.setId(id);
|
||||
startEvent.setInitiator("applyUserId");
|
||||
// startEvent.setInitiator("applyUserId");
|
||||
if (Objects.nonNull(formKey) && !formKey.trim().isEmpty()) {
|
||||
startEvent.setFormKey(formKey);
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ public class EngineExecutionStartListener implements ExecutionListener {
|
||||
execution.setVariable(variable, assigneeIdList);
|
||||
}
|
||||
// 将当次审批节点下计算出来的人存储起来,方便后续对 task 保持审批人快照
|
||||
execution.setVariable(INTERNAL_TASK_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT + currentActivityId,
|
||||
execution.setVariableLocal(INTERNAL_TASK_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT + currentActivityId,
|
||||
assigners);
|
||||
});
|
||||
}
|
||||
|
||||
@ -254,8 +254,8 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
}
|
||||
|
||||
// 创建流程实例
|
||||
// 设置流程实例的开始人,参考https://wenku.baidu.com/view/5538062e7a563c1ec5da50e2524de518964bd3f9.html
|
||||
Authentication.setAuthenticatedUserId(dto.getInitiator().buildAssigneeId());
|
||||
// 设置流程实例的开始人,参考 https://wenku.baidu.com/view/5538062e7a563c1ec5da50e2524de518964bd3f9.html
|
||||
// Authentication.setAuthenticatedUserId(dto.getInitiator().buildAssigneeId());
|
||||
String name = StringUtils.isNotBlank(dto.getCustomProcessInstanceName()) ?
|
||||
dto.getCustomProcessInstanceName()
|
||||
: definition.getName();
|
||||
|
||||
@ -298,7 +298,9 @@ public class BpmnTaskServiceImpl implements BpmnTaskService {
|
||||
Authentication.setAuthenticatedUserId(dto.getApprover().buildAssigneeId());
|
||||
taskService.addComment(dto.getTaskId(), instance.getId(), COMMENT_TYPE_ADVICE, dto.getAdvice());
|
||||
}
|
||||
runtimeService.setVariable(task.getExecutionId(), INTERNAL_SPECIFY_NEXT_APPROVER, dto.getNextApprover());
|
||||
if (Objects.nonNull(dto.getNextApprover())) {
|
||||
runtimeService.setVariable(task.getExecutionId(), INTERNAL_SPECIFY_NEXT_APPROVER, dto.getNextApprover());
|
||||
}
|
||||
// 主动设置下级审批人
|
||||
// 完成任务,审批通过
|
||||
// FIXME 如果 task 被重复删除会抛出异常
|
||||
@ -540,16 +542,12 @@ public class BpmnTaskServiceImpl implements BpmnTaskService {
|
||||
|
||||
if (Objects.isNull(dto.getTargetAssigner())) {
|
||||
taskService.setAssignee(task.getId(), "");
|
||||
runtimeService.removeVariable(task.getProcessInstanceId(), INTERNAL_SPECIFY_NEXT_APPROVER);
|
||||
runtimeService.removeVariable(task.getProcessInstanceId() + task.getId(),
|
||||
INTERNAL_TASK_RELATION_ASSIGNEE_INFO_SNAPSHOT);
|
||||
runtimeService.removeVariable(task.getProcessInstanceId(),
|
||||
INTERNAL_TASK_RELATION_ASSIGNEE_INFO_SNAPSHOT + task.getId());
|
||||
} else {
|
||||
runtimeService.setVariable(task.getProcessInstanceId(), INTERNAL_SPECIFY_NEXT_APPROVER,
|
||||
dto.getTargetAssigner());
|
||||
runtimeService.setVariable(task.getProcessInstanceId(),
|
||||
INTERNAL_TASK_RELATION_ASSIGNEE_INFO_SNAPSHOT + task.getId(),
|
||||
dto.getTargetAssigner());
|
||||
|
||||
taskService.setAssignee(task.getId(), dto.getTargetAssigner().buildAssigneeId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,10 +24,6 @@ import static cn.axzo.workflow.common.constant.BpmConstants.INTERNAL_TASK_RELATI
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CustomBpmTaskTaskEventListener implements BpmTaskEventListener {
|
||||
@Override
|
||||
public void onCreated(DelegateTask delegateTask) {
|
||||
log.info("task created...");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAssigned(DelegateTask delegateTask) {
|
||||
@ -45,18 +41,8 @@ public class CustomBpmTaskTaskEventListener implements BpmTaskEventListener {
|
||||
log.info("task assigned...");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted(DelegateTask delegateTask) {
|
||||
log.info("task completed...");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeleted(DelegateTask delegateTask) {
|
||||
log.info("task deleted...");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return 99;
|
||||
return Integer.MIN_VALUE + 1;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user