|
|
@ -189,10 +189,6 @@ public class DeviceImpl implements DeviceService { |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void updateDeseCabinet(DeviceInfoDto deviceInfoDto) { |
|
|
|
DeviceInfo deviceInfo = deviceInfoMapper.toEntity(deviceInfoDto); |
|
|
|
// List<DeviceInfo> deviceInfoList = deviceInfoRepository.findByAreaNoAndAndDeviceIpAndAndDevicePort(deviceInfo.getAreaNo(), deviceInfo.getDeviceIp(), deviceInfo.getDevicePort()); |
|
|
|
// if (!ObjectUtils.isEmpty(deviceInfoList)) { |
|
|
|
// throw new BaseException("区号IP端口不能重复添加设备"); |
|
|
|
// } |
|
|
|
DeviceInfo deviceInfo1 = deviceInfoRepository.findById(deviceInfo.getId()).orElseGet(DeviceInfo::new); |
|
|
|
if (ObjectUtils.isEmpty(deviceInfo1)) { |
|
|
|
throw new BaseException("数据不存在"); |
|
|
@ -217,24 +213,24 @@ public class DeviceImpl implements DeviceService { |
|
|
|
|
|
|
|
deviceInfoDto.setId(NanoIdUtils.randomNanoId()); |
|
|
|
DeviceArchivesTag deviceArchivesTag = new DeviceArchivesTag(); |
|
|
|
for (int i = 1; i < deviceInfoDto.getCupboardNo(); i++) { |
|
|
|
for (int k = 1; k < deviceInfoDto.getRowNo(); k++) { |
|
|
|
for (int n = 1; n < deviceInfoDto.getColumnRowNo(); n++) { |
|
|
|
String position = i + "-" + k + "-" + n; |
|
|
|
String positionName = i + "柜" + k + "层" + n + "列"; |
|
|
|
// for (int i = 1; i < deviceInfoDto.getCupboardNo(); i++) { |
|
|
|
for (int k = 0; k < deviceInfoDto.getRowNo(); k++) { |
|
|
|
for (int n = 0; n < deviceInfoDto.getColumnRowNo(); n++) { |
|
|
|
String position = deviceInfoDto.getCupboardNo() + "-" + k + "-" + n; |
|
|
|
String positionName = deviceInfoDto.getCupboardNo() + "柜" + k + "层" + n + "列"; |
|
|
|
|
|
|
|
deviceArchivesTag.setId(NanoIdUtils.randomNanoId()); |
|
|
|
deviceArchivesTag.setPosition(position); |
|
|
|
deviceArchivesTag.setPosition_name(positionName); |
|
|
|
deviceArchivesTag.setDeviceInfoId(deviceInfoDto.getId()); |
|
|
|
deviceArchivesTag.setCupboardNo(i); |
|
|
|
deviceArchivesTag.setCupboardNo(deviceInfoDto.getCupboardNo()); |
|
|
|
deviceArchivesTag.setRowNo(k); |
|
|
|
deviceArchivesTag.setColumnRowNo(n); |
|
|
|
deviceArchivesTag.setStoreroomCode(deviceInfoDto.getStoreroomCode()); |
|
|
|
deviceArchivesTagRepository.save(deviceArchivesTag); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
Integer num = deviceInfoRepository.findByMax(); |
|
|
@ -251,10 +247,6 @@ public class DeviceImpl implements DeviceService { |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void updateRotaryCabinet(DeviceInfoDto deviceInfoDto) { |
|
|
|
// List<DeviceInfo> deviceInfoList = deviceInfoRepository.findByDeviceIpAndDevicePort(deviceInfoDto.getDeviceIp(), deviceInfoDto.getDevicePort()); |
|
|
|
// if (!ObjectUtils.isEmpty(deviceInfoList)) { |
|
|
|
// throw new BaseException("同一IP和端口号下不能重复添加设备"); |
|
|
|
// } |
|
|
|
DeviceInfo deviceInfo = deviceInfoRepository.findById(deviceInfoDto.getId()).orElseGet(DeviceInfo::new); |
|
|
|
if (ObjectUtils.isEmpty(deviceInfo)) { |
|
|
|
throw new BaseException("数据不存在"); |
|
|
@ -296,14 +288,7 @@ public class DeviceImpl implements DeviceService { |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void updateCamera(DeviceInfoDto deviceInfoDto) { |
|
|
|
// List<DeviceInfo> deviceInfoList = deviceInfoRepository.findByDeviceIpAndDevicePortAndVideoRouteAndDeviceTypeId(deviceInfoDto.getDeviceIp(), |
|
|
|
// deviceInfoDto.getDevicePort(), |
|
|
|
// deviceInfoDto.getVideoRoute(), |
|
|
|
// deviceInfoDto.getDeviceTypeId()); |
|
|
|
// |
|
|
|
// if (!ObjectUtils.isEmpty(deviceInfoList)) { |
|
|
|
// throw new BaseException("同一IP和端口号下不能重复添加设备"); |
|
|
|
// } |
|
|
|
|
|
|
|
DeviceInfo deviceInfo = deviceInfoMapper.toEntity(deviceInfoDto); |
|
|
|
DeviceInfo deviceInfo1 = deviceInfoRepository.findById(deviceInfo.getId()).orElseGet(DeviceInfo::new); |
|
|
|
deviceInfo1.setDeviceName(deviceInfo.getDeviceName()); |
|
|
@ -312,6 +297,7 @@ public class DeviceImpl implements DeviceService { |
|
|
|
deviceInfo1.setDeviceAccount(deviceInfo.getDeviceAccount()); |
|
|
|
deviceInfo1.setDevicePassword(deviceInfo.getDevicePassword()); |
|
|
|
deviceInfo1.setVideoRoute(deviceInfo.getVideoRoute()); |
|
|
|
deviceInfo1.setStoreroomCode(deviceInfoDto.getStoreroomCode()); |
|
|
|
deviceInfoRepository.save(deviceInfo1); |
|
|
|
|
|
|
|
} |
|
|
|