fix(接口测试): 修复接口变更记录信息显示优化问题

--bug=1026200 --user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001026200
This commit is contained in:
guoyuqi 2023-05-17 12:02:32 +08:00 committed by f2c-ci-robot[bot]
parent 025b599ffd
commit 7789b9b8e4
2 changed files with 27 additions and 6 deletions

View File

@ -53,6 +53,9 @@ public class ApiDefinitionImportUtilService {
public static final String BODY = "body";
private static final String TIMING_SYNCHRONIZATION = "TIMING_SYNCHRONIZATION";
private static final String IMPORT_FILE = "IMPORT_FILE";
private final ThreadLocal<Long> currentApiOrder = new ThreadLocal<>();
private final ThreadLocal<Long> currentApiCaseOrder = new ThreadLocal<>();
@ -1320,14 +1323,14 @@ public class ApiDefinitionImportUtilService {
List<Schedule> list = scheduleMapper.selectByExample(schedule);
if (list.size() > 0) {
User user = baseUserService.getUserDTO(list.get(0).getUserId());
msOperLog.setOperUser(user.getName() + Translator.get("timing_synchronization"));
msOperLog.setOperUser(user.getName() + TIMING_SYNCHRONIZATION);
msOperLog.setCreateUser(user.getId());
} else {
msOperLog.setOperUser(Translator.get("timing_synchronization"));
msOperLog.setOperUser(TIMING_SYNCHRONIZATION);
}
} else {
SessionUser user = SessionUtils.getUser();
msOperLog.setOperUser(user.getName() + Translator.get("import_file"));
msOperLog.setOperUser(user.getName() + IMPORT_FILE);
msOperLog.setCreateUser(user.getId());
}
}

View File

@ -37,6 +37,9 @@ public class OperatingLogService {
@Resource
private SqlSessionFactory sqlSessionFactory;
private static final String TIMING_SYNCHRONIZATION = "TIMING_SYNCHRONIZATION";
private static final String IMPORT_FILE = "IMPORT_FILE";
public void create(OperatingLogWithBLOBs log, String sourceIds) {
log.setSourceId(StringUtils.EMPTY);
operatingLogMapper.insert(log);
@ -129,9 +132,7 @@ public class OperatingLogService {
if (CollectionUtils.isEmpty(logWithBLOB.getDetails().getColumns())) {
dtos.add(logWithBLOB);
}
if (StringUtils.isBlank(logWithBLOB.getUserName()) && StringUtils.isNotBlank(logWithBLOB.getOperUser())) {
logWithBLOB.setUserName(logWithBLOB.getOperUser());
}
setUserName(logWithBLOB);
}
}
if (CollectionUtils.isNotEmpty(dtos)) {
@ -139,4 +140,21 @@ public class OperatingLogService {
}
return logWithBLOBs;
}
private static void setUserName(OperatingLogDTO logWithBLOB) {
if (StringUtils.isBlank(logWithBLOB.getUserName()) && StringUtils.isNotBlank(logWithBLOB.getOperUser())) {
if (logWithBLOB.getOperUser().contains(TIMING_SYNCHRONIZATION)) {
int suffix = logWithBLOB.getOperUser().indexOf(TIMING_SYNCHRONIZATION);
String substring = logWithBLOB.getOperUser().substring(0, suffix);
logWithBLOB.setUserName(substring + Translator.get("timing_synchronization"));
} else if (logWithBLOB.getOperUser().contains(IMPORT_FILE)) {
int suffix = logWithBLOB.getOperUser().indexOf(IMPORT_FILE);
String substring = logWithBLOB.getOperUser().substring(0, suffix);
logWithBLOB.setUserName(substring + Translator.get("import_file"));
} else {
logWithBLOB.setUserName(logWithBLOB.getOperUser());
}
}
}
}