Skip to content

Commit 20de6cc

Browse files
committed
[app-builder] modify according to reviews
1 parent 488a136 commit 20de6cc

File tree

13 files changed

+30
-42
lines changed

13 files changed

+30
-42
lines changed

app-builder/plugins/aipp-plugin/src/main/java/modelengine/fit/jober/aipp/domains/task/TaskDecorator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ private Object invokeMethod(Method method, Object[] args, Object current)
111111
else {
112112
msg = localeService.localize(UI_WORD_KEY);
113113
}
114-
this.aippLogService.insertLogWithInterception(AippInstLogType.ERROR.name(),
114+
this.aippLogService.insertLog(AippInstLogType.ERROR.name(),
115115
AippLogData.builder().msg(msg).build(), ctx.getBusinessData());
116116
return null;
117117
}

app-builder/plugins/aipp-plugin/src/main/java/modelengine/fit/jober/aipp/domains/taskinstance/TaskInstanceDecorator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private Object wrapException(AppTaskInstanceService instanceService, AippLogServ
142142
.setStatus(MetaInstStatusEnum.ERROR.name())
143143
.build(), ctx.getOperationContext());
144144
// 更新日志类型为HIDDEN_FORM
145-
logService.insertLogWithInterception(AippInstLogType.ERROR.name(), AippLogData.builder().msg(e.getMessage()).build(),
145+
logService.insertLog(AippInstLogType.ERROR.name(), AippLogData.builder().msg(e.getMessage()).build(),
146146
ctx.getBusinessData());
147147
}
148148
return null;

app-builder/plugins/aipp-plugin/src/main/java/modelengine/fit/jober/aipp/fitable/AippFlowEndCallback.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ private String saveFormToLog(String appId, Map<String, Object> businessData, Str
186186
logData.setFormAppearance(JsonUtils.toJsonString(formDataMap.get(AippConst.FORM_APPEARANCE_KEY)));
187187
logData.setFormData(JsonUtils.toJsonString(formDataMap.get(AippConst.FORM_DATA_KEY)));
188188
// 子应用/工作流的结束节点表单不需要在历史记录展示
189-
return this.aippLogService.insertLogWithInterception((this.isExistParent(businessData)
189+
return this.aippLogService.insertLog((this.isExistParent(businessData)
190190
? AippInstLogType.HIDDEN_FORM
191191
: AippInstLogType.FORM).name(), logData, businessData);
192192
}
@@ -211,7 +211,7 @@ private void logFinalOutput(Map<String, Object> businessData, String aippInstId)
211211
if (!checkEnableLog(businessData)) {
212212
logType = AippInstLogType.HIDDEN_MSG;
213213
}
214-
this.aippLogService.insertLogWithInterception(logType.name(), AippLogData.builder().msg(logMsg).build(), businessData);
214+
this.aippLogService.insertLog(logType.name(), AippLogData.builder().msg(logMsg).build(), businessData);
215215
this.beanContainer.all(AppFlowFinishObserver.class)
216216
.stream()
217217
.<AppFlowFinishObserver>map(BeanFactory::get)

app-builder/plugins/aipp-plugin/src/main/java/modelengine/fit/jober/aipp/fitable/AippFlowSmartFormHandle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ private String insertFormLog(List<AppBuilderFormProperty> formProperties, String
179179
Object appearance = formDataMap.get(AippConst.FORM_APPEARANCE_KEY);
180180
logData.setFormAppearance(ObjectUtils.cast(JsonUtils.toJsonString(appearance)));
181181
logData.setFormData(ObjectUtils.cast(JsonUtils.toJsonString(formDataMap.get(AippConst.FORM_DATA_KEY))));
182-
return this.aippLogService.insertLogWithInterception(AippInstLogType.FORM.name(), logData, businessData);
182+
return this.aippLogService.insertLog(AippInstLogType.FORM.name(), logData, businessData);
183183
}
184184

185185
private void updateInstance(String sheetId, String nodeId, Map<String, Object> businessData) {

app-builder/plugins/aipp-plugin/src/main/java/modelengine/fit/jober/aipp/fitable/LlmComponent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ private void addAnswer(AippLlmMeta llmMeta, String answer, Map<String, Object> p
291291
llmOutput.put("output", output);
292292
Optional<ResponsibilityResult> formatOutput = this.formatterChain.handle(llmOutput);
293293
String logMsg = formatOutput.map(ResponsibilityResult::text).orElse(answer);
294-
this.aippLogService.insertLogWithInterception(AippInstLogType.META_MSG.name(),
294+
this.aippLogService.insertLog(AippInstLogType.META_MSG.name(),
295295
AippLogData.builder().msg(logMsg).build(),
296296
businessData);
297297
}

app-builder/plugins/aipp-plugin/src/main/java/modelengine/fit/jober/aipp/fitable/ReplyNode.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727
*/
2828
@Component
2929
public class ReplyNode implements FlowableService {
30-
private final AippLogService aippLogService;
31-
32-
private final TemplateService templateService;
33-
3430
private final static String TEMPLATE_KEY = "template";
3531

3632
private final static String VARIABLES_KEY = "variables";
3733

34+
private final AippLogService aippLogService;
35+
36+
private final TemplateService templateService;
37+
3838
public ReplyNode(AippLogService aippLogService, TemplateService templateService) {
3939
this.aippLogService = aippLogService;
4040
this.templateService = templateService;
@@ -52,7 +52,7 @@ public List<Map<String, Object>> handleTask(List<Map<String, Object>> flowData)
5252
}
5353

5454
private void sendMsg(String msg, Map<String, Object> businessData) {
55-
this.aippLogService.insertLogWithInterception(AippInstLogType.MSG.name(),
55+
this.aippLogService.insertLog(AippInstLogType.MSG.name(),
5656
AippLogData.builder().msg(msg).build(),
5757
businessData);
5858
}

app-builder/plugins/aipp-plugin/src/main/java/modelengine/fit/jober/aipp/service/AippLogService.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public interface AippLogService {
9393
* @param businessData 业务数据
9494
* @return 返回插入的日志id
9595
*/
96-
String insertLogWithInterception(String logType, AippLogData logData, Map<String, Object> businessData);
96+
String insertLog(String logType, AippLogData logData, Map<String, Object> businessData);
9797

9898
/**
9999
* 插入ERROR类型的历史记录
@@ -185,13 +185,4 @@ List<AippInstLogDataDto> queryAippRecentInstLogAfterSplice(String aippId, String
185185
* @param logIds 表示指定的日志 id 列表的 {@link List}{@code <}{@link Long}{@code >}。
186186
*/
187187
void deleteLogs(List<Long> logIds);
188-
189-
/**
190-
* 插入一条日志记录,但不触发发送逻辑。
191-
*
192-
* @param logType 表示日志类型的 {@link String}。
193-
* @param logData 表示日志主体数据的 {@link AippLogData} 实例。
194-
* @param businessData 表示业务数据的 {@link Map}{@code <}{@link String}{@code , }{@link Object}{@code >}。
195-
*/
196-
void insertLog(String logType, AippLogData logData, Map<String, Object> businessData);
197188
}

app-builder/plugins/aipp-plugin/src/main/java/modelengine/fit/jober/aipp/service/impl/AippLogServiceImpl.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ public void deleteAippPreviewLog(String previewAippId, OperationContext context)
362362
* @return 日志id
363363
*/
364364
@Override
365-
public String insertLogWithInterception(String logType, AippLogData logData, Map<String, Object> businessData) {
365+
public String insertLog(String logType, AippLogData logData, Map<String, Object> businessData) {
366366
AippLogCreateDto logCreateDto = this.buildAippLogCreateDto(logType, logData, businessData);
367367
if (logCreateDto == null) {
368368
return null;
@@ -416,7 +416,7 @@ private Boolean isEnableLog(Map<String, Object> businessData) {
416416
@Override
417417
public void insertErrorLog(String msg, List<Map<String, Object>> flowData) {
418418
AippLogData logData = AippLogData.builder().msg(msg).build();
419-
insertLogWithInterception(AippInstLogType.ERROR.name(), logData, DataUtils.getBusiness(flowData));
419+
this.insertLog(AippInstLogType.ERROR.name(), logData, DataUtils.getBusiness(flowData));
420420
}
421421

422422
/**
@@ -512,13 +512,4 @@ public void deleteLogs(List<Long> logIds) {
512512
}
513513
this.aippLogMapper.deleteInstanceLogs(logIds);
514514
}
515-
516-
@Override
517-
public void insertLog(String logType, AippLogData logData, Map<String, Object> businessData) {
518-
AippLogCreateDto logCreateDto = this.buildAippLogCreateDto(logType, logData, businessData);
519-
if (logCreateDto == null) {
520-
return;
521-
}
522-
this.aippLogMapper.insertOne(logCreateDto);
523-
}
524515
}

app-builder/plugins/aipp-plugin/src/test/java/modelengine/fit/jober/aipp/domains/task/TaskDecoratorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void testException() {
6666

6767
doNothing().when(this.appTaskInstanceService).update(any(), any());
6868
when(this.localeService.localize(any())).thenReturn("xxxxxxx");
69-
when(this.aippLogService.insertLogWithInterception(any(), any(), any())).thenReturn("xxxxxx");
69+
when(this.aippLogService.insertLog(any(), any(), any())).thenReturn("xxxxxx");
7070

7171
// when.
7272
RunContext runContext = new RunContext(businessData, new OperationContext());
@@ -84,6 +84,6 @@ public void testException() {
8484
Assertions.assertEquals(MetaInstStatusEnum.ERROR.name(), instance.getEntity().getStatus().get());
8585

8686
verify(this.localeService, times(1)).localize(eq("aipp.service.impl.AippRunTimeServiceImpl"));
87-
verify(this.aippLogService, times(1)).insertLogWithInterception(eq(AippInstLogType.ERROR.name()), any(), any());
87+
verify(this.aippLogService, times(1)).insertLog(eq(AippInstLogType.ERROR.name()), any(), any());
8888
}
8989
}

app-builder/plugins/aipp-plugin/src/test/java/modelengine/fit/jober/aipp/domains/taskinstance/TaskInstanceDecoratorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public void testExceptionLogWhenThrowException() {
109109
.exceptionLog(this.appTaskInstanceService, this.logService)
110110
.run(runContext, null);
111111
verify(this.appTaskInstanceService, times(1)).update(any(), any());
112-
verify(this.logService, times(1)).insertLogWithInterception(any(), any(), any());
112+
verify(this.logService, times(1)).insertLog(any(), any(), any());
113113
}
114114

115115
@Test
@@ -126,6 +126,6 @@ public void testChatAndExceptionLog() {
126126
verify(this.appChatSessionService, times(1)).addSession(any(), any());
127127
verify(this.appChatSSEService, times(2)).send(any(), any());
128128
verify(this.appTaskInstanceService, times(0)).update(any(), any());
129-
verify(this.logService, times(0)).insertLogWithInterception(any(), any(), any());
129+
verify(this.logService, times(0)).insertLog(any(), any(), any());
130130
}
131131
}

0 commit comments

Comments
 (0)