添加日志
This commit is contained in:
parent
d8be35ed68
commit
6d6f3f1d6b
@ -0,0 +1,19 @@
|
|||||||
|
package com.sunyard.chsm.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author liulu
|
||||||
|
* @since 2024/11/1
|
||||||
|
*/
|
||||||
|
public interface AuditLogConst {
|
||||||
|
|
||||||
|
String ADD = "新增";
|
||||||
|
String UPDATE = "新增";
|
||||||
|
String DELETE = "删除";
|
||||||
|
String IMPORT = "导入";
|
||||||
|
String EXPORT = "导出";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,11 +1,13 @@
|
|||||||
package com.sunyard.chsm.controller;
|
package com.sunyard.chsm.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.sunyard.chsm.constant.AuditLogConst;
|
||||||
import com.sunyard.chsm.dto.AppQuery;
|
import com.sunyard.chsm.dto.AppQuery;
|
||||||
import com.sunyard.chsm.dto.AppSave;
|
import com.sunyard.chsm.dto.AppSave;
|
||||||
import com.sunyard.chsm.dto.AppView;
|
import com.sunyard.chsm.dto.AppView;
|
||||||
import com.sunyard.chsm.model.R;
|
import com.sunyard.chsm.model.R;
|
||||||
import com.sunyard.chsm.service.ApplicationService;
|
import com.sunyard.chsm.service.ApplicationService;
|
||||||
|
import com.sunyard.ssp.common.annotation.AuditControllerLog;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
@ -54,6 +56,7 @@ public class ApplicationController {
|
|||||||
* @return id
|
* @return id
|
||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
|
@AuditControllerLog(description = "创建应用", operateType = AuditLogConst.ADD)
|
||||||
public R<String> save(@Valid @RequestBody AppSave save) {
|
public R<String> save(@Valid @RequestBody AppSave save) {
|
||||||
Long id = applicationService.save(save);
|
Long id = applicationService.save(save);
|
||||||
return R.data(String.valueOf(id));
|
return R.data(String.valueOf(id));
|
||||||
@ -65,6 +68,7 @@ public class ApplicationController {
|
|||||||
* @param id 应用id
|
* @param id 应用id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@AuditControllerLog(description = "启用应用", operateType = AuditLogConst.UPDATE)
|
||||||
@PostMapping("/enable")
|
@PostMapping("/enable")
|
||||||
public R<Void> enable(Long id) {
|
public R<Void> enable(Long id) {
|
||||||
Assert.notNull(id, "应用id不能为空");
|
Assert.notNull(id, "应用id不能为空");
|
||||||
@ -78,6 +82,7 @@ public class ApplicationController {
|
|||||||
* @param id 应用id
|
* @param id 应用id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@AuditControllerLog(description = "停用应用", operateType = AuditLogConst.UPDATE)
|
||||||
@PostMapping("/disable")
|
@PostMapping("/disable")
|
||||||
public R<Void> disable(Long id) {
|
public R<Void> disable(Long id) {
|
||||||
Assert.notNull(id, "应用id不能为空");
|
Assert.notNull(id, "应用id不能为空");
|
||||||
@ -105,6 +110,7 @@ public class ApplicationController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
|
@AuditControllerLog(description = "删除应用", operateType = AuditLogConst.DELETE)
|
||||||
public R<Void> delete(Long id) {
|
public R<Void> delete(Long id) {
|
||||||
Assert.notNull(id, "应用id不能为空");
|
Assert.notNull(id, "应用id不能为空");
|
||||||
applicationService.delete(id);
|
applicationService.delete(id);
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package com.sunyard.chsm.controller;
|
package com.sunyard.chsm.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.sunyard.chsm.constant.AuditLogConst;
|
||||||
import com.sunyard.chsm.dto.ApiGroupDTO;
|
import com.sunyard.chsm.dto.ApiGroupDTO;
|
||||||
import com.sunyard.chsm.dto.CryptoServiceDTO;
|
import com.sunyard.chsm.dto.CryptoServiceDTO;
|
||||||
import com.sunyard.chsm.enums.ApiFunEnum;
|
import com.sunyard.chsm.enums.ApiFunEnum;
|
||||||
import com.sunyard.chsm.model.R;
|
import com.sunyard.chsm.model.R;
|
||||||
import com.sunyard.chsm.service.CryptoServiceService;
|
import com.sunyard.chsm.service.CryptoServiceService;
|
||||||
|
import com.sunyard.ssp.common.annotation.AuditControllerLog;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
@ -86,6 +88,7 @@ public class CryptoServiceController {
|
|||||||
* @return 密码服务id
|
* @return 密码服务id
|
||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
|
@AuditControllerLog(description = "创建密码服务", operateType = AuditLogConst.ADD)
|
||||||
public R<String> saveService(@Valid @RequestBody CryptoServiceDTO.CSSave save) {
|
public R<String> saveService(@Valid @RequestBody CryptoServiceDTO.CSSave save) {
|
||||||
Long id = cryptoServiceService.save(save);
|
Long id = cryptoServiceService.save(save);
|
||||||
return R.data(String.valueOf(id));
|
return R.data(String.valueOf(id));
|
||||||
@ -98,12 +101,41 @@ public class CryptoServiceController {
|
|||||||
* @return 密码服务id
|
* @return 密码服务id
|
||||||
*/
|
*/
|
||||||
@PutMapping
|
@PutMapping
|
||||||
|
@AuditControllerLog(description = "修改密码服务", operateType = AuditLogConst.UPDATE)
|
||||||
public R<Void> updateService(@Valid @RequestBody CryptoServiceDTO.CSSave update) {
|
public R<Void> updateService(@Valid @RequestBody CryptoServiceDTO.CSSave update) {
|
||||||
Assert.notNull(update.getId(), "密码服务id不能为空");
|
Assert.notNull(update.getId(), "密码服务id不能为空");
|
||||||
cryptoServiceService.update(update);
|
cryptoServiceService.update(update);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用密码服务
|
||||||
|
*
|
||||||
|
* @param id id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AuditControllerLog(description = "启用密码服务", operateType = AuditLogConst.UPDATE)
|
||||||
|
@PostMapping("/enable")
|
||||||
|
public R<Void> enable(Long id) {
|
||||||
|
Assert.notNull(id, "应用id不能为空");
|
||||||
|
cryptoServiceService.enable(id);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 停用密码服务
|
||||||
|
*
|
||||||
|
* @param id id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AuditControllerLog(description = "停用密码服务", operateType = AuditLogConst.UPDATE)
|
||||||
|
@PostMapping("/disable")
|
||||||
|
public R<Void> disable(Long id) {
|
||||||
|
Assert.notNull(id, "应用id不能为空");
|
||||||
|
cryptoServiceService.disable(id);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除密码服务
|
* 删除密码服务
|
||||||
*
|
*
|
||||||
@ -111,6 +143,7 @@ public class CryptoServiceController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
|
@AuditControllerLog(description = "删除密码服务", operateType = AuditLogConst.DELETE)
|
||||||
public R<Void> deleteService(Long id) {
|
public R<Void> deleteService(Long id) {
|
||||||
Assert.notNull(id, "密码服务id不能为空");
|
Assert.notNull(id, "密码服务id不能为空");
|
||||||
cryptoServiceService.delete(id);
|
cryptoServiceService.delete(id);
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package com.sunyard.chsm.controller;
|
package com.sunyard.chsm.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.sunyard.chsm.constant.AuditLogConst;
|
||||||
import com.sunyard.chsm.dto.DeviceDTO;
|
import com.sunyard.chsm.dto.DeviceDTO;
|
||||||
import com.sunyard.chsm.dto.ManufacturersDeviceDTO;
|
import com.sunyard.chsm.dto.ManufacturersDeviceDTO;
|
||||||
import com.sunyard.chsm.enums.ManufacturerModelEnum;
|
import com.sunyard.chsm.enums.ManufacturerModelEnum;
|
||||||
import com.sunyard.chsm.model.R;
|
import com.sunyard.chsm.model.R;
|
||||||
import com.sunyard.chsm.service.DeviceService;
|
import com.sunyard.chsm.service.DeviceService;
|
||||||
|
import com.sunyard.ssp.common.annotation.AuditControllerLog;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -111,6 +113,7 @@ public class DeviceController {
|
|||||||
* @return id
|
* @return id
|
||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
|
@AuditControllerLog(description = "添加密码设备", operateType = AuditLogConst.ADD)
|
||||||
public R<String> save(@Valid @RequestBody DeviceDTO.DeviceSave save) {
|
public R<String> save(@Valid @RequestBody DeviceDTO.DeviceSave save) {
|
||||||
Long id = deviceService.save(save);
|
Long id = deviceService.save(save);
|
||||||
return R.data(String.valueOf(id));
|
return R.data(String.valueOf(id));
|
||||||
@ -123,6 +126,7 @@ public class DeviceController {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@PutMapping
|
@PutMapping
|
||||||
|
@AuditControllerLog(description = "修改密码设备", operateType = AuditLogConst.UPDATE)
|
||||||
public R<Void> update(@Valid @RequestBody DeviceDTO.DeviceSave update) {
|
public R<Void> update(@Valid @RequestBody DeviceDTO.DeviceSave update) {
|
||||||
deviceService.update(update);
|
deviceService.update(update);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
@ -135,6 +139,7 @@ public class DeviceController {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
|
@AuditControllerLog(description = "删除密码设备", operateType = AuditLogConst.DELETE)
|
||||||
public R<Void> delete(Long id) {
|
public R<Void> delete(Long id) {
|
||||||
deviceService.delete(id);
|
deviceService.delete(id);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.sunyard.chsm.controller;
|
package com.sunyard.chsm.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.sunyard.chsm.constant.AuditLogConst;
|
||||||
import com.sunyard.chsm.dto.DeviceGroupDTO;
|
import com.sunyard.chsm.dto.DeviceGroupDTO;
|
||||||
import com.sunyard.chsm.model.R;
|
import com.sunyard.chsm.model.R;
|
||||||
import com.sunyard.chsm.service.DeviceGroupService;
|
import com.sunyard.chsm.service.DeviceGroupService;
|
||||||
|
import com.sunyard.ssp.common.annotation.AuditControllerLog;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@ -49,6 +51,7 @@ public class DeviceGroupController {
|
|||||||
* @return id
|
* @return id
|
||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
|
@AuditControllerLog(description = "添加设备组", operateType = AuditLogConst.ADD)
|
||||||
public R<String> save(@Valid @RequestBody DeviceGroupDTO.DGSave save) {
|
public R<String> save(@Valid @RequestBody DeviceGroupDTO.DGSave save) {
|
||||||
Long id = deviceGroupService.save(save);
|
Long id = deviceGroupService.save(save);
|
||||||
return R.data(String.valueOf(id));
|
return R.data(String.valueOf(id));
|
||||||
@ -61,6 +64,7 @@ public class DeviceGroupController {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@PutMapping
|
@PutMapping
|
||||||
|
@AuditControllerLog(description = "修改设备组", operateType = AuditLogConst.UPDATE)
|
||||||
public R<Void> update(@Valid @RequestBody DeviceGroupDTO.DGSave update) {
|
public R<Void> update(@Valid @RequestBody DeviceGroupDTO.DGSave update) {
|
||||||
deviceGroupService.update(update);
|
deviceGroupService.update(update);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
@ -73,6 +77,7 @@ public class DeviceGroupController {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
|
@AuditControllerLog(description = "删除设备组", operateType = AuditLogConst.DELETE)
|
||||||
public R<Void> delete(Long id) {
|
public R<Void> delete(Long id) {
|
||||||
deviceGroupService.delete(id);
|
deviceGroupService.delete(id);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package com.sunyard.chsm.controller;
|
package com.sunyard.chsm.controller;
|
||||||
|
|
||||||
|
import com.sunyard.chsm.constant.AuditLogConst;
|
||||||
import com.sunyard.chsm.dto.KeyInfoDTO;
|
import com.sunyard.chsm.dto.KeyInfoDTO;
|
||||||
import com.sunyard.chsm.enums.KeyStatus;
|
import com.sunyard.chsm.enums.KeyStatus;
|
||||||
import com.sunyard.chsm.model.Option;
|
import com.sunyard.chsm.model.Option;
|
||||||
import com.sunyard.chsm.model.R;
|
import com.sunyard.chsm.model.R;
|
||||||
import com.sunyard.chsm.service.KeyInfoService;
|
import com.sunyard.chsm.service.KeyInfoService;
|
||||||
|
import com.sunyard.ssp.common.annotation.AuditControllerLog;
|
||||||
import com.sunyard.ssp.common.exception.SspwebException;
|
import com.sunyard.ssp.common.exception.SspwebException;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@ -53,6 +55,7 @@ public class KeyInfoController {
|
|||||||
* @return id
|
* @return id
|
||||||
*/
|
*/
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
|
@AuditControllerLog(description = "创建密钥", operateType = AuditLogConst.ADD)
|
||||||
public R<String> save(@Valid @RequestBody KeyInfoDTO.KeySave save) {
|
public R<String> save(@Valid @RequestBody KeyInfoDTO.KeySave save) {
|
||||||
Long id = keyInfoService.save(save);
|
Long id = keyInfoService.save(save);
|
||||||
return R.data(String.valueOf(id));
|
return R.data(String.valueOf(id));
|
||||||
@ -65,6 +68,7 @@ public class KeyInfoController {
|
|||||||
* @return id
|
* @return id
|
||||||
*/
|
*/
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
|
@AuditControllerLog(description = "更新密钥", operateType = AuditLogConst.UPDATE)
|
||||||
public R<Void> save(@Valid @RequestBody KeyInfoDTO.KeyUpdate update) {
|
public R<Void> save(@Valid @RequestBody KeyInfoDTO.KeyUpdate update) {
|
||||||
keyInfoService.update(update);
|
keyInfoService.update(update);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
@ -93,6 +97,7 @@ public class KeyInfoController {
|
|||||||
* @return id
|
* @return id
|
||||||
*/
|
*/
|
||||||
@PostMapping("/enable")
|
@PostMapping("/enable")
|
||||||
|
@AuditControllerLog(description = "启用密钥", operateType = AuditLogConst.UPDATE)
|
||||||
public R<Void> enableKey(@Valid @RequestBody KeyInfoDTO.IDs param) {
|
public R<Void> enableKey(@Valid @RequestBody KeyInfoDTO.IDs param) {
|
||||||
keyInfoService.enableKey(param.getIds());
|
keyInfoService.enableKey(param.getIds());
|
||||||
return R.ok();
|
return R.ok();
|
||||||
@ -105,6 +110,7 @@ public class KeyInfoController {
|
|||||||
* @return id
|
* @return id
|
||||||
*/
|
*/
|
||||||
@PostMapping("/disable")
|
@PostMapping("/disable")
|
||||||
|
@AuditControllerLog(description = "停用密钥", operateType = AuditLogConst.UPDATE)
|
||||||
public R<Void> disableKey(@Valid @RequestBody KeyInfoDTO.IDs param) {
|
public R<Void> disableKey(@Valid @RequestBody KeyInfoDTO.IDs param) {
|
||||||
keyInfoService.disableKey(param.getIds());
|
keyInfoService.disableKey(param.getIds());
|
||||||
return R.ok();
|
return R.ok();
|
||||||
@ -117,6 +123,7 @@ public class KeyInfoController {
|
|||||||
* @return id
|
* @return id
|
||||||
*/
|
*/
|
||||||
@PostMapping("/archive")
|
@PostMapping("/archive")
|
||||||
|
@AuditControllerLog(description = "归档密钥", operateType = AuditLogConst.UPDATE)
|
||||||
public R<Void> archiveKey(@Valid @RequestBody KeyInfoDTO.IDs param) {
|
public R<Void> archiveKey(@Valid @RequestBody KeyInfoDTO.IDs param) {
|
||||||
keyInfoService.archiveKey(param.getIds());
|
keyInfoService.archiveKey(param.getIds());
|
||||||
return R.ok();
|
return R.ok();
|
||||||
@ -129,6 +136,7 @@ public class KeyInfoController {
|
|||||||
* @return id
|
* @return id
|
||||||
*/
|
*/
|
||||||
@PostMapping("/destroy")
|
@PostMapping("/destroy")
|
||||||
|
@AuditControllerLog(description = "销毁密钥", operateType = AuditLogConst.DELETE)
|
||||||
public R<Void> destroyKey(@Valid @RequestBody KeyInfoDTO.IDs param) {
|
public R<Void> destroyKey(@Valid @RequestBody KeyInfoDTO.IDs param) {
|
||||||
keyInfoService.destroyKey(param.getIds());
|
keyInfoService.destroyKey(param.getIds());
|
||||||
return R.ok();
|
return R.ok();
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.sunyard.chsm.controller;
|
package com.sunyard.chsm.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.sunyard.chsm.constant.AuditLogConst;
|
||||||
import com.sunyard.chsm.dto.KeyTemplateDTO;
|
import com.sunyard.chsm.dto.KeyTemplateDTO;
|
||||||
import com.sunyard.chsm.model.R;
|
import com.sunyard.chsm.model.R;
|
||||||
import com.sunyard.chsm.service.KeyTemplateService;
|
import com.sunyard.chsm.service.KeyTemplateService;
|
||||||
|
import com.sunyard.ssp.common.annotation.AuditControllerLog;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@ -17,6 +19,7 @@ import javax.validation.Valid;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 密钥模版管理接口
|
* 密钥模版管理接口
|
||||||
|
*
|
||||||
* @author liulu
|
* @author liulu
|
||||||
* @since 2024/10/22
|
* @since 2024/10/22
|
||||||
*/
|
*/
|
||||||
@ -48,6 +51,7 @@ public class KeyTemplateController {
|
|||||||
* @return id
|
* @return id
|
||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
|
@AuditControllerLog(description = "添加密钥模版", operateType = AuditLogConst.ADD)
|
||||||
public R<String> save(@Valid @RequestBody KeyTemplateDTO.KTSave save) {
|
public R<String> save(@Valid @RequestBody KeyTemplateDTO.KTSave save) {
|
||||||
Long id = keyTemplateService.save(save);
|
Long id = keyTemplateService.save(save);
|
||||||
return R.data(String.valueOf(id));
|
return R.data(String.valueOf(id));
|
||||||
@ -60,6 +64,7 @@ public class KeyTemplateController {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@PutMapping
|
@PutMapping
|
||||||
|
@AuditControllerLog(description = "修改密钥模版", operateType = AuditLogConst.UPDATE)
|
||||||
public R<Void> update(@Valid @RequestBody KeyTemplateDTO.KTSave update) {
|
public R<Void> update(@Valid @RequestBody KeyTemplateDTO.KTSave update) {
|
||||||
keyTemplateService.update(update);
|
keyTemplateService.update(update);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
@ -72,6 +77,7 @@ public class KeyTemplateController {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
|
@AuditControllerLog(description = "删除密钥模版", operateType = AuditLogConst.DELETE)
|
||||||
public R<Void> delete(Long id) {
|
public R<Void> delete(Long id) {
|
||||||
keyTemplateService.delete(id);
|
keyTemplateService.delete(id);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
|
@ -16,5 +16,9 @@ public interface CryptoServiceService {
|
|||||||
|
|
||||||
void update(CryptoServiceDTO.CSSave update);
|
void update(CryptoServiceDTO.CSSave update);
|
||||||
|
|
||||||
|
void enable(Long id);
|
||||||
|
|
||||||
|
void disable(Long id);
|
||||||
|
|
||||||
void delete(Long id);
|
void delete(Long id);
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ import javax.annotation.Resource;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
|
@Transactional
|
||||||
public class ApplicationServiceImpl implements ApplicationService {
|
public class ApplicationServiceImpl implements ApplicationService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -39,6 +39,7 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
|
@Transactional
|
||||||
public class CryptoServiceServiceImpl implements CryptoServiceService {
|
public class CryptoServiceServiceImpl implements CryptoServiceService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@ -100,7 +101,6 @@ public class CryptoServiceServiceImpl implements CryptoServiceService {
|
|||||||
servicePage.getSize(), servicePage.getTotal()).setRecords(viewList);
|
servicePage.getSize(), servicePage.getTotal()).setRecords(viewList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Override
|
@Override
|
||||||
public Long save(CryptoServiceDTO.CSSave save) {
|
public Long save(CryptoServiceDTO.CSSave save) {
|
||||||
|
|
||||||
@ -125,7 +125,6 @@ public class CryptoServiceServiceImpl implements CryptoServiceService {
|
|||||||
return service.getId();
|
return service.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Override
|
@Override
|
||||||
public void update(CryptoServiceDTO.CSSave update) {
|
public void update(CryptoServiceDTO.CSSave update) {
|
||||||
CryptoService exist = cryptoServiceMapper.selectById(update.getId());
|
CryptoService exist = cryptoServiceMapper.selectById(update.getId());
|
||||||
@ -155,7 +154,34 @@ public class CryptoServiceServiceImpl implements CryptoServiceService {
|
|||||||
saveApis(update.getApiList(), exist.getId());
|
saveApis(update.getApiList(), exist.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Override
|
||||||
|
public void enable(Long id) {
|
||||||
|
CryptoService cs = cryptoServiceMapper.selectById(id);
|
||||||
|
Assert.notNull(cs, "密码服务不存在");
|
||||||
|
Assert.isTrue(Objects.equals(EnableStatus.DISABLED.getCode(), cs.getStatus()),
|
||||||
|
"当前密码服务不是停用状态,不支持启用");
|
||||||
|
|
||||||
|
CryptoService upCs = new CryptoService();
|
||||||
|
upCs.setId(id);
|
||||||
|
upCs.setStatus(EnableStatus.ENABLED.getCode());
|
||||||
|
upCs.setUpdateTime(LocalDateTime.now());
|
||||||
|
cryptoServiceMapper.updateById(upCs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disable(Long id) {
|
||||||
|
CryptoService cs = cryptoServiceMapper.selectById(id);
|
||||||
|
Assert.notNull(cs, "密码服务不存在");
|
||||||
|
Assert.isTrue(Objects.equals(EnableStatus.ENABLED.getCode(), cs.getStatus()),
|
||||||
|
"当前密码服务不是停用状态,不支持启用");
|
||||||
|
|
||||||
|
CryptoService upCs = new CryptoService();
|
||||||
|
upCs.setId(id);
|
||||||
|
upCs.setStatus(EnableStatus.DISABLED.getCode());
|
||||||
|
upCs.setUpdateTime(LocalDateTime.now());
|
||||||
|
cryptoServiceMapper.updateById(upCs);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(Long id) {
|
public void delete(Long id) {
|
||||||
CryptoService exist = cryptoServiceMapper.selectById(id);
|
CryptoService exist = cryptoServiceMapper.selectById(id);
|
||||||
|
@ -32,6 +32,7 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service("sp_DeviceGroupServiceImpl")
|
@Service("sp_DeviceGroupServiceImpl")
|
||||||
|
@Transactional
|
||||||
public class DeviceGroupServiceImpl implements DeviceGroupService {
|
public class DeviceGroupServiceImpl implements DeviceGroupService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@ -79,7 +80,6 @@ public class DeviceGroupServiceImpl implements DeviceGroupService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Override
|
@Override
|
||||||
public Long save(DeviceGroupDTO.DGSave save) {
|
public Long save(DeviceGroupDTO.DGSave save) {
|
||||||
|
|
||||||
@ -108,7 +108,6 @@ public class DeviceGroupServiceImpl implements DeviceGroupService {
|
|||||||
return add.getId();
|
return add.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Override
|
@Override
|
||||||
public void update(DeviceGroupDTO.DGSave update) {
|
public void update(DeviceGroupDTO.DGSave update) {
|
||||||
Assert.notNull(update.getId(), "id不能为空");
|
Assert.notNull(update.getId(), "id不能为空");
|
||||||
@ -152,7 +151,6 @@ public class DeviceGroupServiceImpl implements DeviceGroupService {
|
|||||||
Assert.isNull(exist, "设备组名称已存在");
|
Assert.isNull(exist, "设备组名称已存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(Long id) {
|
public void delete(Long id) {
|
||||||
Assert.notNull(id, "id不能为空");
|
Assert.notNull(id, "id不能为空");
|
||||||
|
@ -31,6 +31,7 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service("sp_DeviceServiceImpl")
|
@Service("sp_DeviceServiceImpl")
|
||||||
|
@Transactional
|
||||||
public class DeviceServiceImpl implements DeviceService {
|
public class DeviceServiceImpl implements DeviceService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@ -112,7 +113,6 @@ public class DeviceServiceImpl implements DeviceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Override
|
@Override
|
||||||
public Long save(DeviceDTO.DeviceSave save) {
|
public Long save(DeviceDTO.DeviceSave save) {
|
||||||
ManufacturerEnum manufacturer = ManufacturerEnum.of(save.getManufacturer());
|
ManufacturerEnum manufacturer = ManufacturerEnum.of(save.getManufacturer());
|
||||||
@ -135,7 +135,6 @@ public class DeviceServiceImpl implements DeviceService {
|
|||||||
return device.getId();
|
return device.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Override
|
@Override
|
||||||
public void update(DeviceDTO.DeviceSave update) {
|
public void update(DeviceDTO.DeviceSave update) {
|
||||||
Assert.notNull(update.getId(), "id不能为空");
|
Assert.notNull(update.getId(), "id不能为空");
|
||||||
@ -154,7 +153,6 @@ public class DeviceServiceImpl implements DeviceService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(Long id) {
|
public void delete(Long id) {
|
||||||
spDeviceMapper.deleteById(id);
|
spDeviceMapper.deleteById(id);
|
||||||
|
@ -71,6 +71,7 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
|
@Transactional
|
||||||
public class KeyInfoServiceImpl implements KeyInfoService {
|
public class KeyInfoServiceImpl implements KeyInfoService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@ -151,7 +152,6 @@ public class KeyInfoServiceImpl implements KeyInfoService {
|
|||||||
return new Page<KeyInfoDTO.KeyView>(page.getCurrent(), page.getSize(), page.getTotal()).setRecords(viewList);
|
return new Page<KeyInfoDTO.KeyView>(page.getCurrent(), page.getSize(), page.getTotal()).setRecords(viewList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Override
|
@Override
|
||||||
public Long save(KeyInfoDTO.KeySave save) {
|
public Long save(KeyInfoDTO.KeySave save) {
|
||||||
|
|
||||||
@ -196,7 +196,6 @@ public class KeyInfoServiceImpl implements KeyInfoService {
|
|||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Override
|
@Override
|
||||||
public void update(KeyInfoDTO.KeyUpdate update) {
|
public void update(KeyInfoDTO.KeyUpdate update) {
|
||||||
List<Long> ids = update.getIds();
|
List<Long> ids = update.getIds();
|
||||||
|
@ -14,6 +14,7 @@ import com.sunyard.chsm.service.KeyTemplateService;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
@ -34,6 +35,7 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
|
@Transactional
|
||||||
public class KeyTemplateServiceImpl implements KeyTemplateService {
|
public class KeyTemplateServiceImpl implements KeyTemplateService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -17,7 +17,7 @@ import java.util.zip.ZipOutputStream;
|
|||||||
@Service
|
@Service
|
||||||
public class LogDownloadServiceImpl implements LogDownloadService {
|
public class LogDownloadServiceImpl implements LogDownloadService {
|
||||||
|
|
||||||
private static final String LOG_BASE_PATH = "./log/";
|
private static final String LOG_BASE_PATH = "logs/";
|
||||||
private static final DateTimeFormatter folderFormatter = DateTimeFormatter.ofPattern("yyyy-MM"); // 用于遍历月份的目录格式
|
private static final DateTimeFormatter folderFormatter = DateTimeFormatter.ofPattern("yyyy-MM"); // 用于遍历月份的目录格式
|
||||||
private static final DateTimeFormatter fileFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // 用于解析文件名中的日期格式
|
private static final DateTimeFormatter fileFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // 用于解析文件名中的日期格式
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ public class LogDownloadServiceImpl implements LogDownloadService {
|
|||||||
*/
|
*/
|
||||||
private boolean isRelevantLogFile(Path path, LocalDate startDate, LocalDate endDate) {
|
private boolean isRelevantLogFile(Path path, LocalDate startDate, LocalDate endDate) {
|
||||||
String fileName = path.getFileName().toString();
|
String fileName = path.getFileName().toString();
|
||||||
if (!fileName.endsWith(".log.gz")) {
|
if (!fileName.endsWith(".log")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user