fix(系统设置): 缺陷模板没有记录字段设置
--bug=1008166 --user=郭雨琦 【系统设置】操作日志,缺陷模板没有记录字段设置
This commit is contained in:
parent
035391c284
commit
bbed34b0a3
|
@ -30,5 +30,7 @@ public class CustomField implements Serializable {
|
|||
|
||||
private String options;
|
||||
|
||||
private String defaultValue;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -24,7 +24,7 @@ public class IssueTemplateController {
|
|||
private IssueTemplateService issueTemplateService;
|
||||
|
||||
@PostMapping("/add")
|
||||
@MsAuditLog(module = "workspace_template_settings_issue", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = IssueTemplateService.class)
|
||||
@MsAuditLog(module = "workspace_template_settings_issue", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request)", msClass = IssueTemplateService.class)
|
||||
public void add(@RequestBody UpdateIssueTemplateRequest request) {
|
||||
issueTemplateService.add(request);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class IssueTemplateController {
|
|||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@MsAuditLog(module = "workspace_template_settings_issue", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", content = "#msClass.getLogDetails(#request.id)", msClass = IssueTemplateService.class)
|
||||
@MsAuditLog(module = "workspace_template_settings_issue", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", content = "#msClass.getLogDetails(#request)", msClass = IssueTemplateService.class)
|
||||
public void update(@RequestBody UpdateIssueTemplateRequest request) {
|
||||
issueTemplateService.update(request);
|
||||
}
|
||||
|
|
|
@ -101,6 +101,11 @@ public class SystemReference {
|
|||
issueFieldColumns.put("title", "标题");
|
||||
issueFieldColumns.put("content", "缺陷内容");
|
||||
issueFieldColumns.put("description", "描述");
|
||||
issueFieldColumns.put("scene", "使用场景");
|
||||
issueFieldColumns.put("type", "属性类型");
|
||||
issueFieldColumns.put("system", "系统字段");
|
||||
issueFieldColumns.put("remark", "字段备注");
|
||||
issueFieldColumns.put("defaultValue", "字段值");
|
||||
|
||||
projectColumns.put("name", "名称");
|
||||
projectColumns.put("description", "描述");
|
||||
|
|
|
@ -2,6 +2,8 @@ package io.metersphere.service;
|
|||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.CustomFieldMapper;
|
||||
import io.metersphere.base.mapper.CustomFieldTemplateMapper;
|
||||
import io.metersphere.base.mapper.IssueTemplateMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtIssueTemplateMapper;
|
||||
import io.metersphere.commons.constants.TemplateConstants;
|
||||
|
@ -25,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -47,6 +50,12 @@ public class IssueTemplateService extends TemplateBaseService {
|
|||
@Resource
|
||||
ProjectService projectService;
|
||||
|
||||
@Resource
|
||||
CustomFieldMapper customFieldMapper;
|
||||
|
||||
@Resource
|
||||
CustomFieldTemplateMapper customFieldTemplateMapper;
|
||||
|
||||
public String add(UpdateIssueTemplateRequest request) {
|
||||
checkExist(request);
|
||||
IssueTemplate template = new IssueTemplate();
|
||||
|
@ -223,12 +232,39 @@ public class IssueTemplateService extends TemplateBaseService {
|
|||
}
|
||||
|
||||
public String getLogDetails(String id) {
|
||||
List<DetailColumn> columns = new LinkedList<>();
|
||||
IssueTemplate templateWithBLOBs = issueTemplateMapper.selectByPrimaryKey(id);
|
||||
if (templateWithBLOBs != null) {
|
||||
List<DetailColumn> columns = ReflexObjectUtil.getColumns(templateWithBLOBs, SystemReference.issueFieldColumns);
|
||||
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(templateWithBLOBs.getId()), null, templateWithBLOBs.getName(), templateWithBLOBs.getCreateUser(), columns);
|
||||
return JSON.toJSONString(details);
|
||||
if(templateWithBLOBs==null){
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
CustomFieldTemplateExample example = new CustomFieldTemplateExample();
|
||||
example.createCriteria().andTemplateIdEqualTo(templateWithBLOBs.getId());
|
||||
example.createCriteria().andSceneEqualTo("ISSUE");
|
||||
List<CustomFieldTemplate> customFieldTemplates = customFieldTemplateMapper.selectByExample(example);
|
||||
return getCustomFieldColums(columns, templateWithBLOBs, customFieldTemplates);
|
||||
|
||||
}
|
||||
|
||||
public String getLogDetails(UpdateIssueTemplateRequest request) {
|
||||
List<DetailColumn> columns = new LinkedList<>();
|
||||
IssueTemplate templateWithBLOBs = issueTemplateMapper.selectByPrimaryKey(request.getId());
|
||||
if(templateWithBLOBs==null){
|
||||
return null;
|
||||
}
|
||||
List<CustomFieldTemplate> customFields = request.getCustomFields();
|
||||
return getCustomFieldColums(columns, templateWithBLOBs, customFields);
|
||||
}
|
||||
|
||||
private String getCustomFieldColums(List<DetailColumn> columns, IssueTemplate templateWithBLOBs, List<CustomFieldTemplate> customFields) {
|
||||
for (CustomFieldTemplate customFieldTemplate : customFields) {
|
||||
CustomField customField = customFieldMapper.selectByPrimaryKey(customFieldTemplate.getFieldId());
|
||||
customField.setDefaultValue(customFieldTemplate.getDefaultValue());
|
||||
List<DetailColumn> columnsField = ReflexObjectUtil.getColumns(customField, SystemReference.issueFieldColumns);
|
||||
columns.addAll(columnsField);
|
||||
}
|
||||
List<DetailColumn> columnIssues = ReflexObjectUtil.getColumns(templateWithBLOBs, SystemReference.issueFieldColumns);
|
||||
columns.addAll(columnIssues);
|
||||
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(templateWithBLOBs.getId()), null, templateWithBLOBs.getName(), templateWithBLOBs.getCreateUser(), columns);
|
||||
return JSON.toJSONString(details);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue