fix(系统设置): 缺陷模版操作日志

--bug=1008166 --user=郭雨琦 【系统设置】操作日志,缺陷模板没有记录字段设置
This commit is contained in:
guoyuqi 2021-11-26 15:30:17 +08:00 committed by xiaomeinvG
parent 6cb5dcdc5d
commit 5f85f815ce
2 changed files with 21 additions and 4 deletions

View File

@ -42,7 +42,7 @@ public class IssueTemplateController {
} }
@PostMapping("/update") @PostMapping("/update")
@MsAuditLog(module = "workspace_template_settings_issue", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", content = "#msClass.getLogDetails(#request)", msClass = IssueTemplateService.class) @MsAuditLog(module = "workspace_template_settings_issue", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id,#request.customFields)", content = "#msClass.getLogDetails(#request)", msClass = IssueTemplateService.class)
public void update(@RequestBody UpdateIssueTemplateRequest request) { public void update(@RequestBody UpdateIssueTemplateRequest request) {
issueTemplateService.update(request); issueTemplateService.update(request);
} }

View File

@ -231,7 +231,7 @@ public class IssueTemplateService extends TemplateBaseService {
return issueTemplateDao; return issueTemplateDao;
} }
public String getLogDetails(String id) { public String getLogDetails(String id, List<CustomFieldTemplate>newCustomFieldTemplates) {
List<DetailColumn> columns = new LinkedList<>(); List<DetailColumn> columns = new LinkedList<>();
IssueTemplate templateWithBLOBs = issueTemplateMapper.selectByPrimaryKey(id); IssueTemplate templateWithBLOBs = issueTemplateMapper.selectByPrimaryKey(id);
if(templateWithBLOBs==null){ if(templateWithBLOBs==null){
@ -241,6 +241,13 @@ public class IssueTemplateService extends TemplateBaseService {
example.createCriteria().andTemplateIdEqualTo(templateWithBLOBs.getId()); example.createCriteria().andTemplateIdEqualTo(templateWithBLOBs.getId());
example.createCriteria().andSceneEqualTo("ISSUE"); example.createCriteria().andSceneEqualTo("ISSUE");
List<CustomFieldTemplate> customFieldTemplates = customFieldTemplateMapper.selectByExample(example); List<CustomFieldTemplate> customFieldTemplates = customFieldTemplateMapper.selectByExample(example);
if(newCustomFieldTemplates.size()>customFieldTemplates.size()){
for (int i = 0; i < newCustomFieldTemplates.size()-customFieldTemplates.size(); i++) {
CustomFieldTemplate customFieldTemplate = new CustomFieldTemplate();
customFieldTemplates.add(customFieldTemplate);
}
}
return getCustomFieldColums(columns, templateWithBLOBs, customFieldTemplates); return getCustomFieldColums(columns, templateWithBLOBs, customFieldTemplates);
} }
@ -251,8 +258,18 @@ public class IssueTemplateService extends TemplateBaseService {
if(templateWithBLOBs==null){ if(templateWithBLOBs==null){
return null; return null;
} }
List<CustomFieldTemplate> customFields = request.getCustomFields(); List<CustomFieldTemplate> newCustomFieldTemplates = request.getCustomFields();
return getCustomFieldColums(columns, templateWithBLOBs, customFields); CustomFieldTemplateExample example = new CustomFieldTemplateExample();
example.createCriteria().andTemplateIdEqualTo(templateWithBLOBs.getId());
example.createCriteria().andSceneEqualTo("ISSUE");
List<CustomFieldTemplate> customFieldTemplates = customFieldTemplateMapper.selectByExample(example);
if(newCustomFieldTemplates.size()<customFieldTemplates.size()){
for (int i = 0; i < customFieldTemplates.size()-newCustomFieldTemplates.size(); i++) {
CustomFieldTemplate customFieldTemplate = new CustomFieldTemplate();
newCustomFieldTemplates.add(customFieldTemplate);
}
}
return getCustomFieldColums(columns, templateWithBLOBs, newCustomFieldTemplates);
} }
private String getCustomFieldColums(List<DetailColumn> columns, IssueTemplate templateWithBLOBs, List<CustomFieldTemplate> customFields) { private String getCustomFieldColums(List<DetailColumn> columns, IssueTemplate templateWithBLOBs, List<CustomFieldTemplate> customFields) {