Merge branch 'feature/REQ-5865' into pre
This commit is contained in:
commit
d8d05db896
@ -48,6 +48,7 @@ public class CustomActivityTriggerCmd extends AbstractCommand<Void> implements S
|
||||
|
||||
@Override
|
||||
public Void execute(CommandContext commandContext) {
|
||||
log.info("CustomActivityTriggerCmd execute start, dto: {}", JSON.toJSONString(dto));
|
||||
ProcessEngineConfigurationImpl processEngineConfiguration =
|
||||
CommandContextUtil.getProcessEngineConfiguration(commandContext);
|
||||
|
||||
@ -66,8 +67,9 @@ public class CustomActivityTriggerCmd extends AbstractCommand<Void> implements S
|
||||
return null;
|
||||
}
|
||||
|
||||
addComment(commandContext, task, COMMENT_TYPE_OPERATION_DESC, "已同意");
|
||||
addComment(commandContext, task, COMMENT_TYPE_OPERATION_DESC, "已同意", true);
|
||||
RuntimeService runtimeService = processEngineConfiguration.getRuntimeService();
|
||||
log.info("CustomActivityTriggerCmd triggerAsync");
|
||||
runtimeService.triggerAsync(dto.getTriggerId());
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -283,6 +283,10 @@ public class CustomTaskHelper {
|
||||
}
|
||||
|
||||
public static void addComment(CommandContext commandContext, TaskEntity task, String type, String message) {
|
||||
addComment(commandContext, task, type, message, false);
|
||||
}
|
||||
|
||||
public static void addComment(CommandContext commandContext, TaskEntity task, String type, String message, boolean withVariableLocal) {
|
||||
if (!StringUtils.hasText(type) || !StringUtils.hasText(message)) {
|
||||
return;
|
||||
}
|
||||
@ -307,7 +311,11 @@ public class CustomTaskHelper {
|
||||
comment.setFullMessage(message);
|
||||
|
||||
processEngineConfiguration.getCommentEntityManager().insert(comment);
|
||||
task.setTransientVariableLocal(type, message);
|
||||
if (withVariableLocal) {
|
||||
task.setVariableLocal(type, message);
|
||||
} else {
|
||||
task.setTransientVariableLocal(type, message);
|
||||
}
|
||||
}
|
||||
|
||||
public static Attachment addAttachment(CommandContext commandContext, Task task, AttachmentDTO attachmentDto) {
|
||||
|
||||
@ -47,6 +47,7 @@ public class BpmnProcessActivityServiceImpl implements BpmnProcessActivityServic
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void trigger(BpmnActivityTriggerDTO dto) {
|
||||
log.info("processActivityService trigger called");
|
||||
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
|
||||
if (Boolean.TRUE.equals(dto.getAsync())) {
|
||||
commandExecutor.execute(new CustomActivityTriggerAsyncCmd(dto));
|
||||
|
||||
@ -81,6 +81,7 @@ public class BpmnProcessActivityController extends BasicPopulateAvatarController
|
||||
@Override
|
||||
@RepeatSubmit
|
||||
public CommonResponse<Boolean> trigger(@Validated @RequestBody BpmnActivityTriggerDTO dto) {
|
||||
log.info("businessNode trigger ===>>>参数:{}", JSON.toJSONString(dto));
|
||||
String header = request.getHeader(HEADER_SERVER_NAME);
|
||||
String remoteAddr = request.getRemoteAddr();
|
||||
log.info("业务节点唤醒 trigger ===>>>参数:{}, 请求来自微服务: {}, ip: {}", JSON.toJSONString(dto), header, remoteAddr);
|
||||
|
||||
@ -45,6 +45,7 @@ import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.AND_SIGN_EXPRESSION;
|
||||
@ -97,32 +98,35 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
|
||||
|
||||
@Override
|
||||
public void onCreate(TaskEntity taskEntity) {
|
||||
log.info("TaskEntityEventHandle#onCreate processInstanceId: {}, taskEntityId: {}", taskEntity.getProcessInstanceId(), taskEntity.getTaskDefinitionKey());
|
||||
// 记录发起人
|
||||
boolean isNodeStarter = Objects.equals(taskEntity.getTaskDefinitionKey(), NODE_STARTER.getType());
|
||||
|
||||
BpmnModel bpmnModel = ProcessDefinitionUtil.getBpmnModel(taskEntity.getProcessDefinitionId());
|
||||
FlowElement flowElement = bpmnModel.getFlowElement(taskEntity.getTaskDefinitionKey());
|
||||
|
||||
ExtAxProcessLog log = new ExtAxProcessLog();
|
||||
log.setProcessInstanceId(taskEntity.getProcessInstanceId());
|
||||
log.setTenantId(taskEntity.getTenantId());
|
||||
log.setActivityId(taskEntity.getTaskDefinitionKey());
|
||||
log.setActivityName(taskEntity.getName());
|
||||
log.setApprovalMethod((isNodeStarter ? nobody : getApprovalMethod(flowElement).orElse(nobody)).getType());
|
||||
log.setNodeType((getNodeType(flowElement).orElse(BpmnFlowNodeType.NODE_EMPTY)).getType());
|
||||
log.setNodeMode((isNodeStarter ? BpmnFlowNodeMode.GENERAL : getNodeMode(flowElement)).getType());
|
||||
log.setTaskId(taskEntity.getId());
|
||||
ExtAxProcessLog processLog = new ExtAxProcessLog();
|
||||
processLog.setProcessInstanceId(taskEntity.getProcessInstanceId());
|
||||
processLog.setTenantId(taskEntity.getTenantId());
|
||||
processLog.setActivityId(taskEntity.getTaskDefinitionKey());
|
||||
processLog.setActivityName(taskEntity.getName());
|
||||
processLog.setApprovalMethod((isNodeStarter ? nobody : getApprovalMethod(flowElement).orElse(nobody)).getType());
|
||||
processLog.setNodeType((getNodeType(flowElement).orElse(BpmnFlowNodeType.NODE_EMPTY)).getType());
|
||||
processLog.setNodeMode((isNodeStarter ? BpmnFlowNodeMode.GENERAL : getNodeMode(flowElement)).getType());
|
||||
processLog.setTaskId(taskEntity.getId());
|
||||
String operationDesc = taskEntity.getVariable(COMMENT_TYPE_OPERATION_DESC, String.class);
|
||||
log.setOperationDesc(StringUtils.hasText(operationDesc) ? operationDesc : HANDLING.getDesc());
|
||||
log.setStartTime(taskEntity.getCreateTime());
|
||||
log.setStatus(PROCESSING.getStatus());
|
||||
log.setSignature(getActivitySignature(flowElement));
|
||||
processLog.setOperationDesc(StringUtils.hasText(operationDesc) ? operationDesc : HANDLING.getDesc());
|
||||
processLog.setStartTime(taskEntity.getCreateTime());
|
||||
processLog.setStatus(PROCESSING.getStatus());
|
||||
processLog.setSignature(getActivitySignature(flowElement));
|
||||
|
||||
processLogService.insert(log);
|
||||
log.info("TaskEntityEventHandle#onCreate insert:{}", JSON.toJSONString(processLog));
|
||||
processLogService.insert(processLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitialized(TaskEntity taskEntity) {
|
||||
log.info("TaskEntityEventHandle#onInitialized processInstanceId: {}, taskEntityId: {}", taskEntity.getProcessInstanceId(), taskEntity.getTaskDefinitionKey());
|
||||
Process process = ProcessDefinitionUtil.getProcess(taskEntity.getProcessDefinitionId());
|
||||
ExtAxProcessLog queryLog = new ExtAxProcessLog();
|
||||
queryLog.setProcessInstanceId(taskEntity.getProcessInstanceId());
|
||||
@ -132,15 +136,18 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
|
||||
.ifPresent(updateLog::setButtonConf);
|
||||
BpmnMetaParserHelper.getFormFieldPermissionConf(process.getFlowElement(taskEntity.getTaskDefinitionKey()))
|
||||
.ifPresent(updateLog::setFormFieldPermissionConf);
|
||||
log.info("TaskEntityEventHandle#onInitialized update, queryLog: {}, updateLog: {}", JSON.toJSONString(queryLog), JSON.toJSONString(updateLog));
|
||||
processLogService.update(queryLog, updateLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdated(TaskEntity taskEntity) {
|
||||
log.info("TaskEntityEventHandle#onUpdated processInstanceId: {}, taskEntityId: {}", taskEntity.getProcessInstanceId(), taskEntity.getTaskDefinitionKey());
|
||||
if (Objects.equals(HIDDEN_ASSIGNEE_ID, taskEntity.getAssignee())) {
|
||||
ExtAxProcessLog queryLog = new ExtAxProcessLog();
|
||||
queryLog.setProcessInstanceId(taskEntity.getProcessInstanceId());
|
||||
queryLog.setTaskId(taskEntity.getId());
|
||||
log.info("TaskEntityEventHandle#onUpdated delete: {}", JSON.toJSONString(queryLog));
|
||||
processLogService.delete(queryLog);
|
||||
} else {
|
||||
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration();
|
||||
@ -157,6 +164,7 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
|
||||
// 快照审批人的组织架构信息
|
||||
OrgStructureSnapshotInfo snapshotInfo = buildApproverOrgStructureInfo(assignee, taskEntity);
|
||||
|
||||
log.info("TaskEntityEventHandle#onUpdated updateAssigneeAndSnapshot, queryLog: {}, assignee: {}, snapshotInfo: {}", JSON.toJSONString(queryLog), JSON.toJSONString(assignee), JSON.toJSONString(snapshotInfo));
|
||||
processLogService.updateAssigneeAndSnapshot(queryLog, assignee, snapshotInfo);
|
||||
});
|
||||
}
|
||||
@ -230,6 +238,7 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
|
||||
|
||||
@Override
|
||||
public void onDeleted(TaskEntity taskEntity) {
|
||||
log.info("TaskEntityEventHandle#onDeleted processInstanceId: {}, taskEntityId: {}", taskEntity.getProcessInstanceId(), taskEntity.getTaskDefinitionKey());
|
||||
ExtAxProcessLog queryLog = new ExtAxProcessLog();
|
||||
queryLog.setProcessInstanceId(taskEntity.getProcessInstanceId());
|
||||
queryLog.setTaskId(taskEntity.getId());
|
||||
@ -257,7 +266,8 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
|
||||
if (Objects.nonNull(advice) && StringUtils.hasText(advice.toString())) {
|
||||
update.setAdvice(advice.toString());
|
||||
}
|
||||
Object operationDesc = taskEntity.getTransientVariableLocal(COMMENT_TYPE_OPERATION_DESC);
|
||||
Object operationDesc = Optional.ofNullable(taskEntity.getTransientVariableLocal(COMMENT_TYPE_OPERATION_DESC)).orElse(taskEntity.getVariableLocal(COMMENT_TYPE_OPERATION_DESC));
|
||||
log.info("TaskEntityEventHandle#onDeleted processInstanceId: {}, operationDesc: {}", taskEntity.getProcessInstanceId(), operationDesc);
|
||||
if (Objects.nonNull(operationDesc) && StringUtils.hasText(operationDesc.toString())) {
|
||||
update.setOperationDesc(Objects.nonNull(assignee) ?
|
||||
(StringUtils.hasText(assignee.getAssignerName()) ? assignee.getAssignerName() : "") + operationDesc
|
||||
@ -267,6 +277,7 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
|
||||
(StringUtils.hasText(assignee.getAssignerName()) ? assignee.getAssignerName() : "")
|
||||
: "");
|
||||
}
|
||||
taskEntity.removeVariableLocal(COMMENT_TYPE_OPERATION_DESC);
|
||||
|
||||
|
||||
String completionType = taskEntity.getVariable(TASK_COMPLETE_OPERATION_TYPE + taskEntity.getId(), String.class);
|
||||
@ -289,6 +300,7 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
|
||||
update.setOperationDesc("抄送" + carbonCopies.size() + "人");
|
||||
}
|
||||
|
||||
log.info("TaskEntityEventHandle#onDeleted update, queryLog: {}, update: {}", JSON.toJSONString(queryLog), JSON.toJSONString(update));
|
||||
processLogService.update(queryLog, update);
|
||||
|
||||
if (needDelete) {
|
||||
@ -296,6 +308,7 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
|
||||
ExtAxProcessLog deleteLog = new ExtAxProcessLog();
|
||||
deleteLog.setProcessInstanceId(taskEntity.getProcessInstanceId());
|
||||
deleteLog.setTaskId(taskEntity.getId());
|
||||
log.info("TaskEntityEventHandle#onDeleted delete, deleteLog: {}", JSON.toJSONString(deleteLog));
|
||||
processLogService.delete(deleteLog);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user