fix(测试跟踪): 处理修改用例状态,变更记录没有国际化问题

--bug=1031034 --user=王旭 【测试跟踪】英文模式-修改Case Status-查看变更记录-还是中文 https://www.tapd.cn/55049933/s/1423108
This commit is contained in:
WangXu10 2023-10-08 15:17:19 +08:00 committed by fit2-zhao
parent abc3b0f6c6
commit 3aed2f00a9
5 changed files with 24 additions and 7 deletions

View File

@ -10,10 +10,8 @@ import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.JSON; import io.metersphere.commons.utils.JSON;
import io.metersphere.i18n.Translator; import io.metersphere.i18n.Translator;
import io.metersphere.log.constants.OperatorLevel; import io.metersphere.log.constants.OperatorLevel;
import io.metersphere.log.vo.DetailColumn; import io.metersphere.log.vo.*;
import io.metersphere.log.vo.OperatingLogDTO; import io.metersphere.log.vo.track.TestCaseReference;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.OperatingLogRequest;
import io.metersphere.service.ServiceUtils; import io.metersphere.service.ServiceUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -136,6 +134,10 @@ public class OperatingLogService {
List<DetailColumn> columns = logWithBLOB.getDetails().getColumns(); List<DetailColumn> columns = logWithBLOB.getDetails().getColumns();
columns.stream().forEach(column -> { columns.stream().forEach(column -> {
if (StringUtils.isNotEmpty(column.getColumnTitle())) { if (StringUtils.isNotEmpty(column.getColumnTitle())) {
if (StringUtils.equalsIgnoreCase(TestCaseReference.testCaseColumns.get(column.getColumnName()), column.getColumnTitle())) {
column.setOriginalValue(Translator.get(column.getOriginalValue().toString()).replace("Not Support Key:", ""));
column.setNewValue(Translator.get(column.getNewValue().toString()).replace("Not Support Key:", ""));
}
String columnsTitle = Translator.get(column.getColumnTitle()); String columnsTitle = Translator.get(column.getColumnTitle());
column.setColumnTitle(columnsTitle.replace("Not Support Key:", "")); column.setColumnTitle(columnsTitle.replace("Not Support Key:", ""));
} }

View File

@ -405,4 +405,7 @@ select_resource_error_and_check=Select the resource error, check it please
load_test_file_not_have_jmx=Load test not have jmx file load_test_file_not_have_jmx=Load test not have jmx file
load_test_file_is_not_jmx=Load test JMX file is illegal load_test_file_is_not_jmx=Load test JMX file is illegal
version_name_is_null=Version name is not null version_name_is_null=Version name is not null
current_version_already_exists=Current version already exists current_version_already_exists=Current version already exists
Prepare=Prepare
Underway=Underway
Completed=Completed

View File

@ -402,4 +402,7 @@ select_resource_error_and_check=查找资源出错,请检查资源是否存在
load_test_file_not_have_jmx=性能测试里的JMX文件不存在 load_test_file_not_have_jmx=性能测试里的JMX文件不存在
load_test_file_is_not_jmx=性能测试里的JMX文件不合法 load_test_file_is_not_jmx=性能测试里的JMX文件不合法
version_name_is_null=版本名称不能为空 version_name_is_null=版本名称不能为空
current_version_already_exists=当前版本已存在 current_version_already_exists=当前版本已存在
Prepare=未开始
Underway=进行中
Completed=已完成

View File

@ -401,4 +401,7 @@ select_resource_error_and_check=查找資源出錯,請檢查資源是否存在
load_test_file_not_have_jmx=性能測試文件中不包含JMX文件 load_test_file_not_have_jmx=性能測試文件中不包含JMX文件
load_test_file_is_not_jmx=性能測試里的JMX文件不合法 load_test_file_is_not_jmx=性能測試里的JMX文件不合法
version_name_is_null=版本名稱不能為空 version_name_is_null=版本名稱不能為空
current_version_already_exists=當前版本已存在 current_version_already_exists=當前版本已存在
Prepare=未開始
Underway=進行中
Completed=已完成

View File

@ -2699,6 +2699,12 @@ public class TestCaseService {
DetailColumn detailColumn = new DetailColumn("comment", "comment", String.join(StringUtils.LF, names), null); DetailColumn detailColumn = new DetailColumn("comment", "comment", String.join(StringUtils.LF, names), null);
columns.add(detailColumn); columns.add(detailColumn);
columns.stream().forEach(item -> {
if ("status".equals(item.getColumnName())) {
item.setOriginalValue(bloBs.getStatus());
}
});
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(id), bloBs.getProjectId(), bloBs.getName(), bloBs.getCreateUser(), columns); OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(id), bloBs.getProjectId(), bloBs.getName(), bloBs.getCreateUser(), columns);
return JSON.toJSONString(details); return JSON.toJSONString(details);
} }