fix(操作日志): 修改操作日志相关问题
This commit is contained in:
parent
782f6ddac4
commit
dc6746115f
|
@ -20,15 +20,15 @@
|
|||
LEFT JOIN project t2 ON t.project_id = t2.id
|
||||
LEFT JOIN workspace w on t2.workspace_id = w.id
|
||||
<where>
|
||||
t.project_id in
|
||||
<foreach collection="request.projectIds" item="projectId" separator="," open="(" close=")">
|
||||
#{projectId}
|
||||
</foreach>
|
||||
or t.project_id is null
|
||||
or t.project_id = ""
|
||||
( t.project_id in
|
||||
<foreach collection="request.projectIds" item="projectId" separator="," open="(" close=")">
|
||||
#{projectId}
|
||||
</foreach>
|
||||
or t.project_id is null
|
||||
or t.project_id = ""
|
||||
)
|
||||
<if test="request.operUser != null and request.operUser != ''">
|
||||
and t.oper_user like #{request.operUser, jdbcType=VARCHAR}
|
||||
or t1.NAME like #{request.operUser, jdbcType=VARCHAR}
|
||||
and (t.oper_user like #{request.operUser, jdbcType=VARCHAR} or t1.name like #{request.operUser, jdbcType=VARCHAR})
|
||||
</if>
|
||||
<if test="request.projectId != null and request.projectId !=''">
|
||||
and t.project_id = #{request.projectId}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class SystemParameterController {
|
|||
private SystemParameterService SystemParameterService;
|
||||
|
||||
@PostMapping("/edit/email")
|
||||
@MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, title = "邮件设置")
|
||||
@MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, title = "邮件设置",beforeEvent = "#msClass.getMailLogDetails()", content = "#msClass.getMailLogDetails()", msClass = SystemParameterService.class)
|
||||
public void editMail(@RequestBody List<SystemParameter> systemParameter) {
|
||||
SystemParameterService.editMail(systemParameter);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class SystemParameterController {
|
|||
}
|
||||
|
||||
@PostMapping("/save/base")
|
||||
@MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, title = "基本配置")
|
||||
@MsAuditLog(module = "system_parameter_setting", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getBaseLogDetails()", content = "#msClass.getBaseLogDetails()", msClass = SystemParameterService.class)
|
||||
public void saveBaseInfo(@RequestBody List<SystemParameter> systemParameter) {
|
||||
SystemParameterService.saveBaseInfo(systemParameter);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@ public class SystemReference {
|
|||
public static Map<String, String> environmentColumns = new LinkedHashMap<>();
|
||||
public static Map<String, String> licenseColumns = new LinkedHashMap<>();
|
||||
public static Map<String, String> ldapColumns = new LinkedHashMap<>();
|
||||
public static Map<String, String> mailColumns = new LinkedHashMap<>();
|
||||
public static Map<String, String> baseColumns = new LinkedHashMap<>();
|
||||
|
||||
static {
|
||||
|
||||
|
@ -37,6 +39,7 @@ public class SystemReference {
|
|||
environmentColumns.clear();
|
||||
licenseColumns.clear();
|
||||
ldapColumns.clear();
|
||||
mailColumns.clear();
|
||||
|
||||
userColumns.put("name", "用户名称");
|
||||
userColumns.put("createUser", "创建人");
|
||||
|
@ -127,5 +130,19 @@ public class SystemReference {
|
|||
ldapColumns.put("mapping", "LDAP属性映射");
|
||||
ldapColumns.put("open", "启用LDAP认证");
|
||||
|
||||
mailColumns.put("host","SMTP主机");
|
||||
mailColumns.put("port","SMTP端口");
|
||||
mailColumns.put("account","SMTP账号");
|
||||
mailColumns.put("password","SMTP密码");
|
||||
mailColumns.put("ssl","开启SSL");
|
||||
mailColumns.put("tls","开启TLS");
|
||||
mailColumns.put("recipient","测试接收人");
|
||||
|
||||
baseColumns.put("url","当前站点URL");
|
||||
baseColumns.put("concurrency","并发数");
|
||||
baseColumns.put("prometheusHost","Prometheus地址");
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -307,4 +307,25 @@ public class SystemParameterService {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getMailLogDetails() {
|
||||
MailInfo mailInfo = this.mailInfo(ParamConstants.Classify.MAIL.getValue());
|
||||
if (mailInfo != null) {
|
||||
List<DetailColumn> columns = ReflexObjectUtil.getColumns(mailInfo, SystemReference.mailColumns);
|
||||
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(mailInfo.getAccount()), null, "邮件设置", null, columns);
|
||||
return JSON.toJSONString(details);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getBaseLogDetails() {
|
||||
BaseSystemConfigDTO configDTO = this.getBaseInfo();
|
||||
if (configDTO != null) {
|
||||
List<DetailColumn> columns = ReflexObjectUtil.getColumns(configDTO, SystemReference.baseColumns);
|
||||
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(configDTO.getUrl()), null, "基本配置", null, columns);
|
||||
return JSON.toJSONString(details);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1171,7 +1171,7 @@ public class UserService {
|
|||
|
||||
DetailColumn detailColumn = new DetailColumn();
|
||||
detailColumn.setId(UUID.randomUUID().toString());
|
||||
detailColumn.setColumnTitle("成员:");
|
||||
detailColumn.setColumnTitle("成员");
|
||||
detailColumn.setColumnName("roles");
|
||||
detailColumn.setOriginalValue(nameBuilder.toString());
|
||||
columns.add(detailColumn);
|
||||
|
|
|
@ -867,7 +867,7 @@ public class TestPlanService {
|
|||
String returnStr = null;
|
||||
for (Map.Entry<String, Map<String, String>> entry : testPlanScenarioIdMap.entrySet()) {
|
||||
// String testPlanId = entry.getKey();
|
||||
Map<String,String> scenarioMap = entry.getValue();
|
||||
Map<String, String> scenarioMap = entry.getValue();
|
||||
|
||||
RunScenarioRequest request = new RunScenarioRequest();
|
||||
request.setReportId(planScenarioExecuteRequest.getReportId());
|
||||
|
@ -894,12 +894,12 @@ public class TestPlanService {
|
|||
if (request.getIds().size() > count) {
|
||||
MSException.throwException("并发数量过大,请重新选择!");
|
||||
}
|
||||
returnStr = apiAutomationService.modeRun(request);
|
||||
returnStr = apiAutomationService.modeRun(request);
|
||||
} else {
|
||||
returnStr = apiAutomationService.modeRun(request);
|
||||
returnStr = apiAutomationService.modeRun(request);
|
||||
}
|
||||
} else {
|
||||
returnStr = apiAutomationService.excute(request);
|
||||
returnStr = apiAutomationService.excute(request);
|
||||
}
|
||||
}
|
||||
return returnStr;
|
||||
|
@ -922,7 +922,7 @@ public class TestPlanService {
|
|||
Map<String, String> planScenarioIdMap = entry.getValue();
|
||||
|
||||
try {
|
||||
returnId = this.generateHashTreeByScenarioList(testPlan,planScenarioIdMap,request);
|
||||
returnId = this.generateHashTreeByScenarioList(testPlan, planScenarioIdMap, request);
|
||||
} catch (Exception ex) {
|
||||
MSException.throwException(ex.getMessage());
|
||||
}
|
||||
|
@ -936,7 +936,7 @@ public class TestPlanService {
|
|||
return returnId;
|
||||
}
|
||||
|
||||
private String generateHashTreeByScenarioList(MsTestPlan testPlan, Map<String, String> planScenarioIdMap,SchedulePlanScenarioExecuteRequest request) throws Exception {
|
||||
private String generateHashTreeByScenarioList(MsTestPlan testPlan, Map<String, String> planScenarioIdMap, SchedulePlanScenarioExecuteRequest request) throws Exception {
|
||||
String returnId = "";
|
||||
boolean isFirst = true;
|
||||
List<ApiScenarioWithBLOBs> apiScenarios = extApiScenarioMapper.selectIds(new ArrayList<>(planScenarioIdMap.keySet()));
|
||||
|
@ -997,11 +997,11 @@ public class TestPlanService {
|
|||
return returnId;
|
||||
}
|
||||
|
||||
public void run(String testPlanID, String projectID, String userId, String triggerMode,String apiRunConfig) {
|
||||
public void run(String testPlanID, String projectID, String userId, String triggerMode, String apiRunConfig) {
|
||||
Map<String, String> planScenarioIdMap;
|
||||
Map<String, String> apiTestCaseIdMap;
|
||||
Map<String, String> performanceIdMap;
|
||||
if(StringUtils.isEmpty(apiRunConfig)){
|
||||
if (StringUtils.isEmpty(apiRunConfig)) {
|
||||
apiRunConfig = "{\"mode\":\"parallel\",\"reportType\":\"iddReport\",\"onSampleError\":true,\"runWithinResourcePool\":true,\"resourcePoolId\":\"29773f4f-55e4-4bce-ad3d-b531b4eb59c2\"}";
|
||||
}
|
||||
planScenarioIdMap = new LinkedHashMap<>();
|
||||
|
@ -1146,20 +1146,11 @@ public class TestPlanService {
|
|||
}
|
||||
|
||||
public String getLogDetails(PlanCaseRelevanceRequest request) {
|
||||
List<String> testCaseIds = request.getTestCaseIds();
|
||||
List<String> names = null;
|
||||
if (testCaseIds.get(0).equals("all")) {
|
||||
List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInReview(request.getRequest());
|
||||
if (!testCases.isEmpty()) {
|
||||
names = testCases.stream().map(TestCase::getName).collect(Collectors.toList());
|
||||
testCaseIds = testCases.stream().map(testCase -> testCase.getId()).collect(Collectors.toList());
|
||||
}
|
||||
} else {
|
||||
TestCaseExample example = new TestCaseExample();
|
||||
example.createCriteria().andIdIn(testCaseIds);
|
||||
List<TestCase> cases = testCaseMapper.selectByExample(example);
|
||||
names = cases.stream().map(TestCase::getName).collect(Collectors.toList());
|
||||
}
|
||||
List<String> testCaseIds = request.getIds();
|
||||
TestCaseExample example = new TestCaseExample();
|
||||
example.createCriteria().andIdIn(testCaseIds);
|
||||
List<TestCase> cases = testCaseMapper.selectByExample(example);
|
||||
List<String> names = cases.stream().map(TestCase::getName).collect(Collectors.toList());
|
||||
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getPlanId());
|
||||
if (testPlan != null) {
|
||||
List<DetailColumn> columns = new LinkedList<>();
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit c678210fde8f9fb5c5d5c8781f6ce3d497134c73
|
||||
Subproject commit 8c27caa18dd0ce5e5d81c0efdbc5ab0b16e923e7
|
|
@ -17,35 +17,29 @@
|
|||
<div v-if="detail && detail.details && detail.details.columns" style="margin-left: 20px">
|
||||
<el-table :data="detail.details.columns">
|
||||
<el-table-column prop="columnTitle" :label="$t('operating_log.change_field')" width="150px" show-overflow-tooltip/>
|
||||
<!--<el-table-column prop="originalValue" :label="$t('operating_log.before_change')" width="400px">-->
|
||||
<!--<template v-slot:default="scope">-->
|
||||
<!--<span v-if="timeDates.indexOf(scope.row.columnName)!==-1">{{ scope.row.originalValue | timestampFormatDate }}</span>-->
|
||||
<!--<div v-else>{{ scope.row.originalValue }}</div>-->
|
||||
<!--</template>-->
|
||||
<!--</el-table-column>-->
|
||||
<el-table-column prop="newValue" :label="$t('operating_log.change_content')">
|
||||
<template v-slot:default="scope">
|
||||
<span v-if="timeDates.indexOf(scope.row.columnName)!==-1">{{ scope.row.newValue | timestampFormatDate }}</span>
|
||||
<pre v-html="getDiff(scope.row.originalValue,scope.row.newValue)" v-else></pre>
|
||||
<div v-html="getDiff(scope.row.originalValue,scope.row.newValue)" v-else></div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="detail && (detail.operType ==='DELETE' || detail.details === null || (detail.details && detail.details.columns && detail.details.columns.length === 0))">
|
||||
<pre style="overflow: auto">{{detail.operTitle}} </pre>
|
||||
<div>{{detail.operTitle}}</div>
|
||||
<span style="color: #409EFF">{{getType(detail.operType)}} </span>
|
||||
<span style="color: #409EFF"> {{$t('api_test.home_page.detail_card.success')}}</span>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div v-if="detail && detail.details && detail.details.columns" style="overflow: auto">
|
||||
<span v-for="n in detail.details.columns" :key="n.id">
|
||||
<pre v-if="timeDates.indexOf(n.columnName)!==-1">
|
||||
<div v-if="timeDates.indexOf(n.columnName)!==-1">
|
||||
{{n.columnTitle}}:{{ n.originalValue | timestampFormatDate }}
|
||||
</pre>
|
||||
<pre style="overflow: auto" v-else>
|
||||
</div>
|
||||
<div style="overflow: auto" v-else>
|
||||
{{n.columnTitle}}:{{n.originalValue}}
|
||||
</pre>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue