REQ-3502: 按钮排序

This commit is contained in:
yanglin 2025-01-15 17:20:47 +08:00
parent ed62a964e4
commit 8cf1b036bb
2 changed files with 15 additions and 1 deletions

View File

@ -43,6 +43,8 @@ import java.util.Optional;
@RequiredArgsConstructor
public class TodoSyncCardService {
private static final ThreadLocal<TodoUpdateMessage> TODO_MESSAGE = new ThreadLocal<>();
private static final String APP_CODE = "msg-center:todo";
private static final String TODO_IDENTITY_CODE_BIZ_PARAM_KEY = "todoIdentityCode";
private static final String TODO_TYPE_BIZ_PARAM_KEY = "todoType";
@ -60,13 +62,20 @@ public class TodoSyncCardService {
void onMessage(Event event, TodoUpdateMessage message) {
log.info("received TodoUpdateMessage: {}", message);
try {
TODO_MESSAGE.set(message);
sync(event, message);
} catch (Exception e) {
log.warn("onMessage error, message={}", message, e);
throw new RuntimeException(e);
} finally {
TODO_MESSAGE.remove();
}
}
public static Optional<TodoUpdateMessage> getTodoUpdateMessage() {
return Optional.ofNullable(TODO_MESSAGE.get());
}
private void sync(Event event, TodoUpdateMessage message) {
if (!message.isUpdateCard()) {
log.warn("not update card, message={}", message);

View File

@ -1,5 +1,6 @@
package cn.axzo.msg.center.message.service.todo.card.workflow;
import cn.axzo.msg.center.api.mq.TodoUpdateMessage;
import cn.axzo.msg.center.common.utils.BizAssertions;
import cn.axzo.msg.center.dal.TodoBusinessDao;
import cn.axzo.msg.center.dal.TodoDao;
@ -51,7 +52,11 @@ class WorkflowTodoCardButtonInterceptorFactory implements CardButtonInterceptorF
BpmnTaskButtonVo taskInfo = fetchWorkflowButtons(todo);
log.info("fetchWorkflowButtons, todoIdentityCode={}, workflowTaskInfo: {}",
todo.getIdentityCode(), JSON.toJSONString(taskInfo));
TodoRequestContext ctx = TodoRequestContext.create("syncWorkflowButtons", card)
String contextName = "syncWorkflowButtons";
TodoUpdateMessage todoMessage = TodoSyncCardService.getTodoUpdateMessage().orElse(null);
if (todoMessage != null)
contextName += ":" + todoMessage.getOperation();
TodoRequestContext ctx = TodoRequestContext.create(contextName, card)
.addLogContent("workflowTaskInfo", taskInfo);
todoLogger.logTodoUpdated(ctx, todo);
return new WorkflowTodoCardButtonInterceptor(todo, taskInfo);