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