fix(系统设置): 修改服务集成的日志类型显示创建

--bug=1018688 --user=李玉号 【系统设置】操作日志-修改服务集成的日志类型显示了“创建”
https://www.tapd.cn/55049933/s/1278804
This commit is contained in:
shiziyuan9527 2022-10-26 17:56:06 +08:00 committed by lyh
parent 5784cd9bf9
commit dc30efb75f
2 changed files with 14 additions and 6 deletions

View File

@ -20,7 +20,7 @@ public class ServiceIntegrationController {
private BaseIntegrationService baseIntegrationService; private BaseIntegrationService baseIntegrationService;
@PostMapping("/save") @PostMapping("/save")
@MsAuditLog(module = OperLogModule.WORKSPACE_SERVICE_INTEGRATION, type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#service.id)", msClass = BaseIntegrationService.class) @MsAuditLog(module = OperLogModule.WORKSPACE_SERVICE_INTEGRATION, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#service.workspaceId, #service.platform)", content = "#msClass.getLogDetails(#service.workspaceId, #service.platform)", msClass = BaseIntegrationService.class)
public ServiceIntegration save(@RequestBody ServiceIntegration service) { public ServiceIntegration save(@RequestBody ServiceIntegration service) {
return baseIntegrationService.save(service); return baseIntegrationService.save(service);
} }
@ -31,7 +31,7 @@ public class ServiceIntegrationController {
} }
@PostMapping("/delete") @PostMapping("/delete")
@MsAuditLog(module = OperLogModule.WORKSPACE_SERVICE_INTEGRATION, type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#request.id)", msClass = BaseIntegrationService.class) @MsAuditLog(module = OperLogModule.WORKSPACE_SERVICE_INTEGRATION, title = "#request.platform", type = OperLogConstants.DELETE, msClass = BaseIntegrationService.class)
public void delete(@RequestBody IntegrationRequest request) { public void delete(@RequestBody IntegrationRequest request) {
baseIntegrationService.delete(request); baseIntegrationService.delete(request);
} }

View File

@ -87,14 +87,22 @@ public class BaseIntegrationService {
return CollectionUtils.isEmpty(list) ? new ArrayList<>() : list; return CollectionUtils.isEmpty(list) ? new ArrayList<>() : list;
} }
public String getLogDetails(String id) { public String getLogDetails(String workspaceId, String platform) {
ServiceIntegration ser = serviceIntegrationMapper.selectByPrimaryKey(id); ServiceIntegrationExample example = new ServiceIntegrationExample();
if (ser != null) { example.createCriteria()
.andWorkspaceIdEqualTo(workspaceId)
.andPlatformEqualTo(platform);
List<ServiceIntegration> list = serviceIntegrationMapper.selectByExampleWithBLOBs(example);
if (!CollectionUtils.isEmpty(list)) {
ServiceIntegration ser = list.get(0);
List<DetailColumn> columns = ReflexObjectUtil.getColumns(ser, SystemReference.serverColumns); List<DetailColumn> columns = ReflexObjectUtil.getColumns(ser, SystemReference.serverColumns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(ser.getId()), null, ser.getPlatform(), null, columns); OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(ser.getId()), null, ser.getPlatform(), null, columns);
return JSON.toJSONString(details); return JSON.toJSONString(details);
} else {
List<DetailColumn> columns = ReflexObjectUtil.getColumns(new ServiceIntegration(), SystemReference.serverColumns);
OperatingLogDetails details = new OperatingLogDetails("", null, platform, null, columns);
return JSON.toJSONString(details);
} }
return null;
} }
public void authServiceIntegration(String workspaceId, String platform) { public void authServiceIntegration(String workspaceId, String platform) {