密码机管理修改

This commit is contained in:
liulu 2024-11-04 15:49:37 +08:00
parent 2a86c8b33f
commit 96e5f430fd
4 changed files with 20 additions and 3 deletions

View File

@ -122,6 +122,10 @@ public abstract class DeviceDTO {
* 访问凭证
*/
private String accessCredentials;
/**
* 设备是否已经分组
*/
private Boolean isGrouped;
/**
* 备注
*/

View File

@ -1,6 +1,7 @@
package com.sunyard.chsm.dto;
import com.sunyard.chsm.model.PageQuery;
import com.sunyard.chsm.model.entity.Device;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -31,6 +32,10 @@ public abstract class DeviceGroupDTO {
* 设备组名称
*/
private String name;
/**
* 已选设备列表
*/
private List<Device> checkedDevices;
/**
* 密码设备
*/

View File

@ -67,10 +67,17 @@ public class DeviceGroupServiceImpl implements DeviceGroupService {
DeviceGroupDTO.DGView view = new DeviceGroupDTO.DGView();
BeanUtils.copyProperties(it, view);
Map<String, String> deviceNames = groupMap.getOrDefault(it.getId(), Collections.emptyList())
Map<Long, String> deviceNames = groupMap.getOrDefault(it.getId(), Collections.emptyList())
.stream()
.collect(Collectors.toMap(it2 -> String.valueOf(it2.getId()), Device::getName));
.collect(Collectors.toMap(Device::getId, Device::getName));
List<Device> deviceList = deviceNames.entrySet()
.stream().map(entry -> {
Device d = new Device();
d.setId(entry.getKey());
d.setName(entry.getValue());
return d;
}).collect(Collectors.toList());
view.setCheckedDevices(deviceList);
view.setDeviceNames(String.join(",", deviceNames.values()));
return view;
})

View File

@ -56,6 +56,7 @@ public class DeviceServiceImpl implements DeviceService {
.map(it -> {
DeviceDTO.DeviceView view = new DeviceDTO.DeviceView();
BeanUtils.copyProperties(it, view);
view.setIsGrouped(it.getGroupId() > 0);
Optional.ofNullable(ManufacturerEnum.of(it.getManufacturer()))
.map(ManufacturerEnum::getName)
.ifPresent(view::setManufacturerText);