密钥管理接口
This commit is contained in:
parent
74ddfcae3c
commit
b6ff674d0b
@ -72,9 +72,9 @@ public class CryptoServiceController {
|
|||||||
* @return 密码服务列表
|
* @return 密码服务列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/pageList")
|
@GetMapping("/pageList")
|
||||||
public R<Page<CryptoServiceDTO.View>> servicePageList(CryptoServiceDTO.Query query) {
|
public R<Page<CryptoServiceDTO.CSView>> servicePageList(CryptoServiceDTO.Query query) {
|
||||||
|
|
||||||
Page<CryptoServiceDTO.View> page = cryptoServiceService.selectPageList(query);
|
Page<CryptoServiceDTO.CSView> page = cryptoServiceService.selectPageList(query);
|
||||||
|
|
||||||
return R.data(page);
|
return R.data(page);
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ public class CryptoServiceController {
|
|||||||
* @return 密码服务id
|
* @return 密码服务id
|
||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public R<String> saveService(@Valid @RequestBody CryptoServiceDTO.Save 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,7 +98,7 @@ public class CryptoServiceController {
|
|||||||
* @return 密码服务id
|
* @return 密码服务id
|
||||||
*/
|
*/
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public R<Void> updateService(@Valid @RequestBody CryptoServiceDTO.Save 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();
|
||||||
|
@ -42,9 +42,9 @@ public class DeviceController {
|
|||||||
* @return 分页列表
|
* @return 分页列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/pageList")
|
@GetMapping("/pageList")
|
||||||
public R<Page<DeviceDTO.View>> servicePageList(DeviceDTO.Query query) {
|
public R<Page<DeviceDTO.DeviceView>> servicePageList(DeviceDTO.Query query) {
|
||||||
|
|
||||||
Page<DeviceDTO.View> page = deviceService.selectPageList(query);
|
Page<DeviceDTO.DeviceView> page = deviceService.selectPageList(query);
|
||||||
|
|
||||||
return R.data(page);
|
return R.data(page);
|
||||||
}
|
}
|
||||||
@ -55,9 +55,9 @@ public class DeviceController {
|
|||||||
* @return 列表
|
* @return 列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/ungrouped/list")
|
@GetMapping("/ungrouped/list")
|
||||||
public R<List<DeviceDTO.View>> getUngroupedList() {
|
public R<List<DeviceDTO.DeviceView>> getUngroupedList() {
|
||||||
|
|
||||||
List<DeviceDTO.View> res = deviceService.getUngroupedList();
|
List<DeviceDTO.DeviceView> res = deviceService.getUngroupedList();
|
||||||
return R.data(res);
|
return R.data(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ public class DeviceController {
|
|||||||
* @return id
|
* @return id
|
||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public R<String> save(@Valid @RequestBody DeviceDTO.Save 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,7 +123,7 @@ public class DeviceController {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public R<Void> update(@Valid @RequestBody DeviceDTO.Save update) {
|
public R<Void> update(@Valid @RequestBody DeviceDTO.DeviceSave update) {
|
||||||
deviceService.update(update);
|
deviceService.update(update);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
@ -35,9 +35,9 @@ public class DeviceGroupController {
|
|||||||
* @return 分页列表
|
* @return 分页列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/pageList")
|
@GetMapping("/pageList")
|
||||||
public R<Page<DeviceGroupDTO.View>> servicePageList(DeviceGroupDTO.Query query) {
|
public R<Page<DeviceGroupDTO.DGView>> servicePageList(DeviceGroupDTO.Query query) {
|
||||||
|
|
||||||
Page<DeviceGroupDTO.View> page = deviceGroupService.selectPageList(query);
|
Page<DeviceGroupDTO.DGView> page = deviceGroupService.selectPageList(query);
|
||||||
|
|
||||||
return R.data(page);
|
return R.data(page);
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ public class DeviceGroupController {
|
|||||||
* @return id
|
* @return id
|
||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public R<String> save(@Valid @RequestBody DeviceGroupDTO.Save 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,7 +61,7 @@ public class DeviceGroupController {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public R<Void> update(@Valid @RequestBody DeviceGroupDTO.Save update) {
|
public R<Void> update(@Valid @RequestBody DeviceGroupDTO.DGSave update) {
|
||||||
deviceGroupService.update(update);
|
deviceGroupService.update(update);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
@ -39,9 +39,9 @@ public class KeyInfoAsymController {
|
|||||||
* @return 分页列表
|
* @return 分页列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/pageList")
|
@GetMapping("/pageList")
|
||||||
public R<Page<KeyInfoDTO.View>> aymPageList(KeyInfoDTO.Query query) {
|
public R<Page<KeyInfoDTO.KeyView>> aymPageList(KeyInfoDTO.Query query) {
|
||||||
query.setKeyType(KeyCategory.ASYM_KEY.getCode());
|
query.setKeyType(KeyCategory.ASYM_KEY.getCode());
|
||||||
Page<KeyInfoDTO.View> page = keyInfoService.selectPageList(query);
|
Page<KeyInfoDTO.KeyView> page = keyInfoService.selectPageList(query);
|
||||||
return R.data(page);
|
return R.data(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public class KeyInfoController {
|
|||||||
* @return id
|
* @return id
|
||||||
*/
|
*/
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
public R<String> save(@Valid @RequestBody KeyInfoDTO.Save 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));
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@ public class KeyInfoController {
|
|||||||
* @return id
|
* @return id
|
||||||
*/
|
*/
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
public R<Void> save(@Valid @RequestBody KeyInfoDTO.Update update) {
|
public R<Void> save(@Valid @RequestBody KeyInfoDTO.KeyUpdate update) {
|
||||||
keyInfoService.update(update);
|
keyInfoService.update(update);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,9 @@ public class KeyInfoSymController {
|
|||||||
* @return 分页列表
|
* @return 分页列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/pageList")
|
@GetMapping("/pageList")
|
||||||
public R<Page<KeyInfoDTO.View>> symPageList(KeyInfoDTO.Query query) {
|
public R<Page<KeyInfoDTO.KeyView>> symPageList(KeyInfoDTO.Query query) {
|
||||||
query.setKeyType(KeyCategory.SYM_KEY.getCode());
|
query.setKeyType(KeyCategory.SYM_KEY.getCode());
|
||||||
Page<KeyInfoDTO.View> page = keyInfoService.selectPageList(query);
|
Page<KeyInfoDTO.KeyView> page = keyInfoService.selectPageList(query);
|
||||||
|
|
||||||
return R.data(page);
|
return R.data(page);
|
||||||
}
|
}
|
||||||
|
@ -34,9 +34,9 @@ public class KeyTemplateController {
|
|||||||
* @return 分页列表
|
* @return 分页列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/pageList")
|
@GetMapping("/pageList")
|
||||||
public R<Page<KeyTemplateDTO.View>> servicePageList(KeyTemplateDTO.Query query) {
|
public R<Page<KeyTemplateDTO.KTView>> servicePageList(KeyTemplateDTO.Query query) {
|
||||||
|
|
||||||
Page<KeyTemplateDTO.View> page = keyTemplateService.selectPageList(query);
|
Page<KeyTemplateDTO.KTView> page = keyTemplateService.selectPageList(query);
|
||||||
|
|
||||||
return R.data(page);
|
return R.data(page);
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ public class KeyTemplateController {
|
|||||||
* @return id
|
* @return id
|
||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public R<String> save(@Valid @RequestBody KeyTemplateDTO.Save 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,7 +60,7 @@ public class KeyTemplateController {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public R<Void> update(@Valid @RequestBody KeyTemplateDTO.Save update) {
|
public R<Void> update(@Valid @RequestBody KeyTemplateDTO.KTSave update) {
|
||||||
keyTemplateService.update(update);
|
keyTemplateService.update(update);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ public abstract class CryptoServiceDTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class Save {
|
public static class CSSave {
|
||||||
/**
|
/**
|
||||||
* 密码服务Id
|
* 密码服务Id
|
||||||
*/
|
*/
|
||||||
@ -54,7 +54,7 @@ public abstract class CryptoServiceDTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class View {
|
public static class CSView {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 密码服务Id
|
* 密码服务Id
|
||||||
|
@ -36,7 +36,7 @@ public abstract class DeviceDTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class Save {
|
public static class DeviceSave {
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
@ -58,7 +58,7 @@ public abstract class DeviceDTO {
|
|||||||
* 服务ip
|
* 服务ip
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "服务ip不能为空")
|
@NotBlank(message = "服务ip不能为空")
|
||||||
@Pattern(regexp = RegexConstant.DEVICE_IPV4, message = "ip格式错误")
|
@Pattern(regexp = RegexConstant.DEVICE_IPV4, message = "服务ip格式错误")
|
||||||
private String serviceIp;
|
private String serviceIp;
|
||||||
/**
|
/**
|
||||||
* 服务端口
|
* 服务端口
|
||||||
@ -68,7 +68,6 @@ public abstract class DeviceDTO {
|
|||||||
/**
|
/**
|
||||||
* 管理ip
|
* 管理ip
|
||||||
*/
|
*/
|
||||||
@Pattern(regexp = RegexConstant.DEVICE_IPV4, message = "ip格式错误")
|
|
||||||
private String manageIp;
|
private String manageIp;
|
||||||
/**
|
/**
|
||||||
* 管理端口
|
* 管理端口
|
||||||
@ -87,7 +86,7 @@ public abstract class DeviceDTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class View {
|
public static class DeviceView {
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 名称
|
* 名称
|
||||||
@ -132,7 +131,7 @@ public abstract class DeviceDTO {
|
|||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
public static class Detail extends View {
|
public static class Detail extends DeviceView {
|
||||||
|
|
||||||
private Double cpuRate;
|
private Double cpuRate;
|
||||||
private Double memoryRate;
|
private Double memoryRate;
|
||||||
|
@ -24,7 +24,7 @@ public abstract class DeviceGroupDTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class View {
|
public static class DGView {
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
@ -45,7 +45,7 @@ public abstract class DeviceGroupDTO {
|
|||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class Save {
|
public static class DGSave {
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 设备组名称
|
* 设备组名称
|
||||||
|
@ -25,7 +25,7 @@ public abstract class KeyInfoDTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class Save {
|
public static class KeySave {
|
||||||
|
|
||||||
private Long applicationId;
|
private Long applicationId;
|
||||||
/**
|
/**
|
||||||
@ -42,7 +42,7 @@ public abstract class KeyInfoDTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class View {
|
public static class KeyView {
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* KEY_ID
|
* KEY_ID
|
||||||
@ -87,7 +87,7 @@ public abstract class KeyInfoDTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class Update {
|
public static class KeyUpdate {
|
||||||
/**
|
/**
|
||||||
* 密钥id列表
|
* 密钥id列表
|
||||||
*/
|
*/
|
||||||
|
@ -27,7 +27,7 @@ public abstract class KeyTemplateDTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class View {
|
public static class KTView {
|
||||||
private Long id;
|
private Long id;
|
||||||
private String code;
|
private String code;
|
||||||
private String name;
|
private String name;
|
||||||
@ -49,7 +49,7 @@ public abstract class KeyTemplateDTO {
|
|||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class Save {
|
public static class KTSave {
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 模版编号
|
* 模版编号
|
||||||
|
@ -10,11 +10,11 @@ import com.sunyard.chsm.dto.CryptoServiceDTO;
|
|||||||
public interface CryptoServiceService {
|
public interface CryptoServiceService {
|
||||||
|
|
||||||
|
|
||||||
Page<CryptoServiceDTO.View> selectPageList(CryptoServiceDTO.Query query);
|
Page<CryptoServiceDTO.CSView> selectPageList(CryptoServiceDTO.Query query);
|
||||||
|
|
||||||
Long save(CryptoServiceDTO.Save save);
|
Long save(CryptoServiceDTO.CSSave save);
|
||||||
|
|
||||||
void update(CryptoServiceDTO.Save update);
|
void update(CryptoServiceDTO.CSSave update);
|
||||||
|
|
||||||
void delete(Long id);
|
void delete(Long id);
|
||||||
}
|
}
|
||||||
|
@ -9,11 +9,11 @@ import com.sunyard.chsm.dto.DeviceGroupDTO;
|
|||||||
*/
|
*/
|
||||||
public interface DeviceGroupService {
|
public interface DeviceGroupService {
|
||||||
|
|
||||||
Page<DeviceGroupDTO.View> selectPageList(DeviceGroupDTO.Query query);
|
Page<DeviceGroupDTO.DGView> selectPageList(DeviceGroupDTO.Query query);
|
||||||
|
|
||||||
Long save(DeviceGroupDTO.Save save);
|
Long save(DeviceGroupDTO.DGSave save);
|
||||||
|
|
||||||
void update(DeviceGroupDTO.Save update);
|
void update(DeviceGroupDTO.DGSave update);
|
||||||
|
|
||||||
void delete(Long id);
|
void delete(Long id);
|
||||||
}
|
}
|
||||||
|
@ -10,15 +10,15 @@ import java.util.List;
|
|||||||
* @since 2024/10/17
|
* @since 2024/10/17
|
||||||
*/
|
*/
|
||||||
public interface DeviceService {
|
public interface DeviceService {
|
||||||
Page<DeviceDTO.View> selectPageList(DeviceDTO.Query query);
|
Page<DeviceDTO.DeviceView> selectPageList(DeviceDTO.Query query);
|
||||||
|
|
||||||
List<DeviceDTO.View> getUngroupedList();
|
List<DeviceDTO.DeviceView> getUngroupedList();
|
||||||
|
|
||||||
DeviceDTO.Detail getDetailById(Long id);
|
DeviceDTO.Detail getDetailById(Long id);
|
||||||
|
|
||||||
Long save(DeviceDTO.Save save);
|
Long save(DeviceDTO.DeviceSave save);
|
||||||
|
|
||||||
void update(DeviceDTO.Save update);
|
void update(DeviceDTO.DeviceSave update);
|
||||||
|
|
||||||
void delete(Long id);
|
void delete(Long id);
|
||||||
}
|
}
|
||||||
|
@ -12,11 +12,11 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface KeyInfoService {
|
public interface KeyInfoService {
|
||||||
|
|
||||||
Page<KeyInfoDTO.View> selectPageList(KeyInfoDTO.Query query);
|
Page<KeyInfoDTO.KeyView> selectPageList(KeyInfoDTO.Query query);
|
||||||
|
|
||||||
Long save(KeyInfoDTO.Save save);
|
Long save(KeyInfoDTO.KeySave save);
|
||||||
|
|
||||||
void update(KeyInfoDTO.Update update);
|
void update(KeyInfoDTO.KeyUpdate update);
|
||||||
|
|
||||||
byte[] backupKey(KeyInfoDTO.Backup backup);
|
byte[] backupKey(KeyInfoDTO.Backup backup);
|
||||||
|
|
||||||
|
@ -9,11 +9,11 @@ import com.sunyard.chsm.dto.KeyTemplateDTO;
|
|||||||
*/
|
*/
|
||||||
public interface KeyTemplateService {
|
public interface KeyTemplateService {
|
||||||
|
|
||||||
Page<KeyTemplateDTO.View> selectPageList(KeyTemplateDTO.Query query);
|
Page<KeyTemplateDTO.KTView> selectPageList(KeyTemplateDTO.Query query);
|
||||||
|
|
||||||
Long save(KeyTemplateDTO.Save save);
|
Long save(KeyTemplateDTO.KTSave save);
|
||||||
|
|
||||||
void update(KeyTemplateDTO.Save update);
|
void update(KeyTemplateDTO.KTSave update);
|
||||||
|
|
||||||
void delete(Long id);
|
void delete(Long id);
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ public class CryptoServiceServiceImpl implements CryptoServiceService {
|
|||||||
private SpDeviceGroupMapper spDeviceGroupMapper;
|
private SpDeviceGroupMapper spDeviceGroupMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<CryptoServiceDTO.View> selectPageList(CryptoServiceDTO.Query query) {
|
public Page<CryptoServiceDTO.CSView> selectPageList(CryptoServiceDTO.Query query) {
|
||||||
|
|
||||||
LambdaQueryWrapper<CryptoService> wrapper = new LambdaQueryWrapper<CryptoService>()
|
LambdaQueryWrapper<CryptoService> wrapper = new LambdaQueryWrapper<CryptoService>()
|
||||||
.like(StringUtils.hasText(query.getName()), CryptoService::getName, query.getName())
|
.like(StringUtils.hasText(query.getName()), CryptoService::getName, query.getName())
|
||||||
@ -73,9 +73,9 @@ public class CryptoServiceServiceImpl implements CryptoServiceService {
|
|||||||
.collect(Collectors.groupingBy(CryptoServiceApi::getCryptoServiceId));
|
.collect(Collectors.groupingBy(CryptoServiceApi::getCryptoServiceId));
|
||||||
|
|
||||||
|
|
||||||
List<CryptoServiceDTO.View> viewList = records.stream()
|
List<CryptoServiceDTO.CSView> viewList = records.stream()
|
||||||
.map(it -> {
|
.map(it -> {
|
||||||
CryptoServiceDTO.View view = new CryptoServiceDTO.View();
|
CryptoServiceDTO.CSView view = new CryptoServiceDTO.CSView();
|
||||||
BeanUtils.copyProperties(it, view);
|
BeanUtils.copyProperties(it, view);
|
||||||
Optional.ofNullable(EnableStatus.of(it.getStatus()))
|
Optional.ofNullable(EnableStatus.of(it.getStatus()))
|
||||||
.map(EnableStatus::getDesc)
|
.map(EnableStatus::getDesc)
|
||||||
@ -96,13 +96,13 @@ public class CryptoServiceServiceImpl implements CryptoServiceService {
|
|||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
return new Page<CryptoServiceDTO.View>(servicePage.getCurrent(),
|
return new Page<CryptoServiceDTO.CSView>(servicePage.getCurrent(),
|
||||||
servicePage.getSize(), servicePage.getTotal()).setRecords(viewList);
|
servicePage.getSize(), servicePage.getTotal()).setRecords(viewList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public Long save(CryptoServiceDTO.Save save) {
|
public Long save(CryptoServiceDTO.CSSave save) {
|
||||||
|
|
||||||
checkName(save.getName());
|
checkName(save.getName());
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ public class CryptoServiceServiceImpl implements CryptoServiceService {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public void update(CryptoServiceDTO.Save update) {
|
public void update(CryptoServiceDTO.CSSave update) {
|
||||||
CryptoService exist = cryptoServiceMapper.selectById(update.getId());
|
CryptoService exist = cryptoServiceMapper.selectById(update.getId());
|
||||||
Assert.notNull(exist, "密码服务不存在");
|
Assert.notNull(exist, "密码服务不存在");
|
||||||
if (!Objects.equals(update.getName(), exist.getName())) {
|
if (!Objects.equals(update.getName(), exist.getName())) {
|
||||||
|
@ -41,7 +41,7 @@ public class DeviceGroupServiceImpl implements DeviceGroupService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<DeviceGroupDTO.View> selectPageList(DeviceGroupDTO.Query query) {
|
public Page<DeviceGroupDTO.DGView> selectPageList(DeviceGroupDTO.Query query) {
|
||||||
|
|
||||||
LambdaQueryWrapper<DeviceGroup> wrapper = new LambdaQueryWrapper<DeviceGroup>()
|
LambdaQueryWrapper<DeviceGroup> wrapper = new LambdaQueryWrapper<DeviceGroup>()
|
||||||
.like(StringUtils.hasText(query.getName()), DeviceGroup::getName, query.getName())
|
.like(StringUtils.hasText(query.getName()), DeviceGroup::getName, query.getName())
|
||||||
@ -61,9 +61,9 @@ public class DeviceGroupServiceImpl implements DeviceGroupService {
|
|||||||
.in(Device::getGroupId, ids)
|
.in(Device::getGroupId, ids)
|
||||||
).stream().collect(Collectors.groupingBy(Device::getGroupId));
|
).stream().collect(Collectors.groupingBy(Device::getGroupId));
|
||||||
|
|
||||||
List<DeviceGroupDTO.View> viewList = records.stream()
|
List<DeviceGroupDTO.DGView> viewList = records.stream()
|
||||||
.map(it -> {
|
.map(it -> {
|
||||||
DeviceGroupDTO.View view = new DeviceGroupDTO.View();
|
DeviceGroupDTO.DGView view = new DeviceGroupDTO.DGView();
|
||||||
BeanUtils.copyProperties(it, view);
|
BeanUtils.copyProperties(it, view);
|
||||||
|
|
||||||
Map<String, String> deviceNames = groupMap.getOrDefault(it.getId(), Collections.emptyList())
|
Map<String, String> deviceNames = groupMap.getOrDefault(it.getId(), Collections.emptyList())
|
||||||
@ -75,13 +75,13 @@ public class DeviceGroupServiceImpl implements DeviceGroupService {
|
|||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
return new Page<DeviceGroupDTO.View>(page.getCurrent(), page.getSize(), page.getTotal()).setRecords(viewList);
|
return new Page<DeviceGroupDTO.DGView>(page.getCurrent(), page.getSize(), page.getTotal()).setRecords(viewList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public Long save(DeviceGroupDTO.Save save) {
|
public Long save(DeviceGroupDTO.DGSave save) {
|
||||||
|
|
||||||
checkName(save.getName());
|
checkName(save.getName());
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ public class DeviceGroupServiceImpl implements DeviceGroupService {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public void update(DeviceGroupDTO.Save update) {
|
public void update(DeviceGroupDTO.DGSave update) {
|
||||||
Assert.notNull(update.getId(), "id不能为空");
|
Assert.notNull(update.getId(), "id不能为空");
|
||||||
DeviceGroup exist = spDeviceGroupMapper.selectById(update.getId());
|
DeviceGroup exist = spDeviceGroupMapper.selectById(update.getId());
|
||||||
Assert.notNull(exist, "id对应的设备组不存在");
|
Assert.notNull(exist, "id对应的设备组不存在");
|
||||||
|
@ -37,7 +37,7 @@ public class DeviceServiceImpl implements DeviceService {
|
|||||||
private SpDeviceMapper spDeviceMapper;
|
private SpDeviceMapper spDeviceMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<DeviceDTO.View> selectPageList(DeviceDTO.Query query) {
|
public Page<DeviceDTO.DeviceView> selectPageList(DeviceDTO.Query query) {
|
||||||
LambdaQueryWrapper<Device> wrapper = new LambdaQueryWrapper<Device>()
|
LambdaQueryWrapper<Device> wrapper = new LambdaQueryWrapper<Device>()
|
||||||
.eq(StringUtils.hasText(query.getManufacturers()), Device::getManufacturer, query.getManufacturers())
|
.eq(StringUtils.hasText(query.getManufacturers()), Device::getManufacturer, query.getManufacturers())
|
||||||
.eq(StringUtils.hasText(query.getModel()), Device::getManufacturerModel, query.getModel())
|
.eq(StringUtils.hasText(query.getModel()), Device::getManufacturerModel, query.getModel())
|
||||||
@ -51,9 +51,9 @@ public class DeviceServiceImpl implements DeviceService {
|
|||||||
if (CollectionUtils.isEmpty(records)) {
|
if (CollectionUtils.isEmpty(records)) {
|
||||||
return new Page<>(page.getCurrent(), page.getSize(), page.getTotal());
|
return new Page<>(page.getCurrent(), page.getSize(), page.getTotal());
|
||||||
}
|
}
|
||||||
List<DeviceDTO.View> viewList = records.stream()
|
List<DeviceDTO.DeviceView> viewList = records.stream()
|
||||||
.map(it -> {
|
.map(it -> {
|
||||||
DeviceDTO.View view = new DeviceDTO.View();
|
DeviceDTO.DeviceView view = new DeviceDTO.DeviceView();
|
||||||
BeanUtils.copyProperties(it, view);
|
BeanUtils.copyProperties(it, view);
|
||||||
Optional.ofNullable(ManufacturerEnum.of(it.getManufacturer()))
|
Optional.ofNullable(ManufacturerEnum.of(it.getManufacturer()))
|
||||||
.map(ManufacturerEnum::getName)
|
.map(ManufacturerEnum::getName)
|
||||||
@ -65,18 +65,18 @@ public class DeviceServiceImpl implements DeviceService {
|
|||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
return new Page<DeviceDTO.View>(page.getCurrent(), page.getSize(), page.getTotal()).setRecords(viewList);
|
return new Page<DeviceDTO.DeviceView>(page.getCurrent(), page.getSize(), page.getTotal()).setRecords(viewList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DeviceDTO.View> getUngroupedList() {
|
public List<DeviceDTO.DeviceView> getUngroupedList() {
|
||||||
|
|
||||||
LambdaQueryWrapper<Device> wrapper = new LambdaQueryWrapper<Device>()
|
LambdaQueryWrapper<Device> wrapper = new LambdaQueryWrapper<Device>()
|
||||||
.eq(Device::getGroupId, 0L);
|
.eq(Device::getGroupId, 0L);
|
||||||
List<Device> devices = spDeviceMapper.selectList(wrapper);
|
List<Device> devices = spDeviceMapper.selectList(wrapper);
|
||||||
return devices.stream()
|
return devices.stream()
|
||||||
.map(it -> {
|
.map(it -> {
|
||||||
DeviceDTO.View view = new DeviceDTO.View();
|
DeviceDTO.DeviceView view = new DeviceDTO.DeviceView();
|
||||||
BeanUtils.copyProperties(it, view);
|
BeanUtils.copyProperties(it, view);
|
||||||
Optional.ofNullable(ManufacturerEnum.of(it.getManufacturer()))
|
Optional.ofNullable(ManufacturerEnum.of(it.getManufacturer()))
|
||||||
.map(ManufacturerEnum::getName)
|
.map(ManufacturerEnum::getName)
|
||||||
@ -114,7 +114,7 @@ public class DeviceServiceImpl implements DeviceService {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public Long save(DeviceDTO.Save save) {
|
public Long save(DeviceDTO.DeviceSave save) {
|
||||||
ManufacturerEnum manufacturer = ManufacturerEnum.of(save.getManufacturer());
|
ManufacturerEnum manufacturer = ManufacturerEnum.of(save.getManufacturer());
|
||||||
Assert.notNull(manufacturer, "不支持的设备厂商: " + save.getManufacturer());
|
Assert.notNull(manufacturer, "不支持的设备厂商: " + save.getManufacturer());
|
||||||
ManufacturerModelEnum manufacturerModel = ManufacturerModelEnum.of(save.getManufacturerModel());
|
ManufacturerModelEnum manufacturerModel = ManufacturerModelEnum.of(save.getManufacturerModel());
|
||||||
@ -137,7 +137,7 @@ public class DeviceServiceImpl implements DeviceService {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public void update(DeviceDTO.Save update) {
|
public void update(DeviceDTO.DeviceSave update) {
|
||||||
Assert.notNull(update.getId(), "id不能为空");
|
Assert.notNull(update.getId(), "id不能为空");
|
||||||
Device exist = spDeviceMapper.selectById(update.getId());
|
Device exist = spDeviceMapper.selectById(update.getId());
|
||||||
Assert.notNull(exist, "id对应的设备不存在");
|
Assert.notNull(exist, "id对应的设备不存在");
|
||||||
|
@ -66,7 +66,7 @@ public class KeyInfoServiceImpl implements KeyInfoService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<KeyInfoDTO.View> selectPageList(KeyInfoDTO.Query query) {
|
public Page<KeyInfoDTO.KeyView> selectPageList(KeyInfoDTO.Query query) {
|
||||||
|
|
||||||
IPage<KeyInfo> page = keyInfoMapper.selectPage(
|
IPage<KeyInfo> page = keyInfoMapper.selectPage(
|
||||||
new Page<>(query.getPageNumber(), query.getPageSize()),
|
new Page<>(query.getPageNumber(), query.getPageSize()),
|
||||||
@ -79,9 +79,9 @@ public class KeyInfoServiceImpl implements KeyInfoService {
|
|||||||
if (CollectionUtils.isEmpty(records)) {
|
if (CollectionUtils.isEmpty(records)) {
|
||||||
return new Page<>(page.getCurrent(), page.getSize(), page.getTotal());
|
return new Page<>(page.getCurrent(), page.getSize(), page.getTotal());
|
||||||
}
|
}
|
||||||
List<KeyInfoDTO.View> viewList = records.stream()
|
List<KeyInfoDTO.KeyView> viewList = records.stream()
|
||||||
.map(it -> {
|
.map(it -> {
|
||||||
KeyInfoDTO.View view = new KeyInfoDTO.View();
|
KeyInfoDTO.KeyView view = new KeyInfoDTO.KeyView();
|
||||||
BeanUtils.copyProperties(it, view);
|
BeanUtils.copyProperties(it, view);
|
||||||
Optional.ofNullable(KeyCategory.of(it.getKeyType()))
|
Optional.ofNullable(KeyCategory.of(it.getKeyType()))
|
||||||
.map(KeyCategory::getDesc)
|
.map(KeyCategory::getDesc)
|
||||||
@ -99,12 +99,12 @@ public class KeyInfoServiceImpl implements KeyInfoService {
|
|||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
return new Page<KeyInfoDTO.View>(page.getCurrent(), page.getSize(), page.getTotal()).setRecords(viewList);
|
return new Page<KeyInfoDTO.KeyView>(page.getCurrent(), page.getSize(), page.getTotal()).setRecords(viewList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public Long save(KeyInfoDTO.Save save) {
|
public Long save(KeyInfoDTO.KeySave save) {
|
||||||
|
|
||||||
KeyTemplate keyTemplate = keyTemplateMapper.selectOne(
|
KeyTemplate keyTemplate = keyTemplateMapper.selectOne(
|
||||||
new LambdaQueryWrapper<KeyTemplate>()
|
new LambdaQueryWrapper<KeyTemplate>()
|
||||||
@ -149,7 +149,7 @@ public class KeyInfoServiceImpl implements KeyInfoService {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public void update(KeyInfoDTO.Update update) {
|
public void update(KeyInfoDTO.KeyUpdate update) {
|
||||||
List<Long> ids = update.getIds();
|
List<Long> ids = update.getIds();
|
||||||
if (CollectionUtils.isEmpty(ids)) {
|
if (CollectionUtils.isEmpty(ids)) {
|
||||||
return;
|
return;
|
||||||
|
@ -41,7 +41,7 @@ public class KeyTemplateServiceImpl implements KeyTemplateService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<KeyTemplateDTO.View> selectPageList(KeyTemplateDTO.Query query) {
|
public Page<KeyTemplateDTO.KTView> selectPageList(KeyTemplateDTO.Query query) {
|
||||||
LambdaQueryWrapper<KeyTemplate> wrapper = new LambdaQueryWrapper<KeyTemplate>()
|
LambdaQueryWrapper<KeyTemplate> wrapper = new LambdaQueryWrapper<KeyTemplate>()
|
||||||
.eq(StringUtils.hasText(query.getKeyType()), KeyTemplate::getKeyType, query.getKeyType())
|
.eq(StringUtils.hasText(query.getKeyType()), KeyTemplate::getKeyType, query.getKeyType())
|
||||||
.orderByDesc(KeyTemplate::getCreateTime);
|
.orderByDesc(KeyTemplate::getCreateTime);
|
||||||
@ -53,9 +53,9 @@ public class KeyTemplateServiceImpl implements KeyTemplateService {
|
|||||||
if (CollectionUtils.isEmpty(records)) {
|
if (CollectionUtils.isEmpty(records)) {
|
||||||
return new Page<>(page.getCurrent(), page.getSize(), page.getTotal());
|
return new Page<>(page.getCurrent(), page.getSize(), page.getTotal());
|
||||||
}
|
}
|
||||||
List<KeyTemplateDTO.View> viewList = records.stream()
|
List<KeyTemplateDTO.KTView> viewList = records.stream()
|
||||||
.map(it -> {
|
.map(it -> {
|
||||||
KeyTemplateDTO.View view = new KeyTemplateDTO.View();
|
KeyTemplateDTO.KTView view = new KeyTemplateDTO.KTView();
|
||||||
BeanUtils.copyProperties(it, view);
|
BeanUtils.copyProperties(it, view);
|
||||||
Optional.ofNullable(KeyCategory.of(it.getKeyType()))
|
Optional.ofNullable(KeyCategory.of(it.getKeyType()))
|
||||||
.map(KeyCategory::getDesc)
|
.map(KeyCategory::getDesc)
|
||||||
@ -69,12 +69,12 @@ public class KeyTemplateServiceImpl implements KeyTemplateService {
|
|||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
return new Page<KeyTemplateDTO.View>(page.getCurrent(), page.getSize(), page.getTotal()).setRecords(viewList);
|
return new Page<KeyTemplateDTO.KTView>(page.getCurrent(), page.getSize(), page.getTotal()).setRecords(viewList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long save(KeyTemplateDTO.Save save) {
|
public Long save(KeyTemplateDTO.KTSave save) {
|
||||||
|
|
||||||
checkEnum(save);
|
checkEnum(save);
|
||||||
checkCode(save.getCode());
|
checkCode(save.getCode());
|
||||||
@ -89,7 +89,7 @@ public class KeyTemplateServiceImpl implements KeyTemplateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(KeyTemplateDTO.Save update) {
|
public void update(KeyTemplateDTO.KTSave update) {
|
||||||
Assert.notNull(update.getId(), "id不能为空");
|
Assert.notNull(update.getId(), "id不能为空");
|
||||||
|
|
||||||
checkEnum(update);
|
checkEnum(update);
|
||||||
@ -116,7 +116,7 @@ public class KeyTemplateServiceImpl implements KeyTemplateService {
|
|||||||
keyTemplateMapper.deleteById(id);
|
keyTemplateMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyTemplate mapToEntity(KeyTemplateDTO.Save save) {
|
private KeyTemplate mapToEntity(KeyTemplateDTO.KTSave save) {
|
||||||
KeyTemplate entity = new KeyTemplate();
|
KeyTemplate entity = new KeyTemplate();
|
||||||
entity.setCode(save.getCode());
|
entity.setCode(save.getCode());
|
||||||
entity.setName(save.getName());
|
entity.setName(save.getName());
|
||||||
@ -133,7 +133,7 @@ public class KeyTemplateServiceImpl implements KeyTemplateService {
|
|||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkEnum(KeyTemplateDTO.Save save) {
|
private void checkEnum(KeyTemplateDTO.KTSave save) {
|
||||||
KeyCategory keyCategory = KeyCategory.of(save.getKeyType());
|
KeyCategory keyCategory = KeyCategory.of(save.getKeyType());
|
||||||
Assert.notNull(keyCategory, "不支持的密钥类型: " + save.getKeyType());
|
Assert.notNull(keyCategory, "不支持的密钥类型: " + save.getKeyType());
|
||||||
KeyAlg keyAlg = KeyAlg.of(save.getKeyAlg());
|
KeyAlg keyAlg = KeyAlg.of(save.getKeyAlg());
|
||||||
|
11
pom.xml
11
pom.xml
@ -106,17 +106,6 @@
|
|||||||
<updatePolicy>always</updatePolicy>
|
<updatePolicy>always</updatePolicy>
|
||||||
</snapshots>
|
</snapshots>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
|
||||||
<id>tencent</id>
|
|
||||||
<name>tencent maven</name>
|
|
||||||
<url>https://mirrors.cloud.tencent.com/nexus/repository/maven-public/</url>
|
|
||||||
<releases>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</releases>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</snapshots>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
</repositories>
|
||||||
<pluginRepositories>
|
<pluginRepositories>
|
||||||
<pluginRepository>
|
<pluginRepository>
|
||||||
|
Loading…
Reference in New Issue
Block a user