|  | @ -85,9 +85,20 @@ public class DeviceImpl implements DeviceService { | 
		
	
		
			
				|  |  |     public void updateDeseCabinet(DeviceInfoDto deviceInfoDto) { |  |  |     public void updateDeseCabinet(DeviceInfoDto deviceInfoDto) { | 
		
	
		
			
				|  |  |         DeviceInfo deviceInfo = deviceInfoMapper.toEntity(deviceInfoDto); |  |  |         DeviceInfo deviceInfo = deviceInfoMapper.toEntity(deviceInfoDto); | 
		
	
		
			
				|  |  |         List<DeviceInfo> deviceInfoList = deviceInfoRepository.findByAreaNoAndAndDeviceIpAndAndDevicePort(deviceInfo.getAreaNo(), deviceInfo.getDeviceIp(), deviceInfo.getDevicePort()); |  |  |         List<DeviceInfo> deviceInfoList = deviceInfoRepository.findByAreaNoAndAndDeviceIpAndAndDevicePort(deviceInfo.getAreaNo(), deviceInfo.getDeviceIp(), deviceInfo.getDevicePort()); | 
		
	
		
			
				|  |  |         if (!ObjectUtils.isEmpty(deviceInfoList)){ |  |  |  | 
		
	
		
			
				|  |  |  |  |  |         if (!ObjectUtils.isEmpty(deviceInfoList)) { | 
		
	
		
			
				|  |  |             throw new BaseException("区号IP端口不能重复添加设备"); |  |  |             throw new BaseException("区号IP端口不能重复添加设备"); | 
		
	
		
			
				|  |  |         } |  |  |         } | 
		
	
		
			
				|  |  |  |  |  |         DeviceInfo deviceInfo1 = deviceInfoRepository.findById(deviceInfo.getId()).orElseGet(DeviceInfo::new); | 
		
	
		
			
				|  |  |  |  |  |         if (ObjectUtils.isEmpty(deviceInfo1)) { | 
		
	
		
			
				|  |  |  |  |  |             throw new BaseException("数据不存在"); | 
		
	
		
			
				|  |  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |  |         deviceInfo1.setDeviceName(deviceInfo.getDeviceName()); | 
		
	
		
			
				|  |  |  |  |  |         deviceInfo1.setDeviceIp(deviceInfo.getDeviceIp()); | 
		
	
		
			
				|  |  |  |  |  |         deviceInfo1.setDevicePort(deviceInfo.getDevicePort()); | 
		
	
		
			
				|  |  |  |  |  |         deviceInfo1.setStoreroomCode(deviceInfo.getStoreroomCode()); | 
		
	
		
			
				|  |  |  |  |  |         IsLinkageState(deviceInfo); | 
		
	
		
			
				|  |  |  |  |  |         IsCallbackState(deviceInfo); | 
		
	
		
			
				|  |  |  |  |  |         deviceInfoRepository.save(deviceInfo1); | 
		
	
		
			
				|  |  | 
 |  |  | 
 | 
		
	
		
			
				|  |  |     } |  |  |     } | 
		
	
		
			
				|  |  | 
 |  |  | 
 | 
		
	
	
		
			
				|  | @ -108,25 +119,26 @@ public class DeviceImpl implements DeviceService { | 
		
	
		
			
				|  |  |      */ |  |  |      */ | 
		
	
		
			
				|  |  |     private void IsLinkageState(DeviceInfo deviceInfo) { |  |  |     private void IsLinkageState(DeviceInfo deviceInfo) { | 
		
	
		
			
				|  |  | 
 |  |  | 
 | 
		
	
		
			
				|  |  |         if (StringUtils.isEmpty(deviceInfo.getIsLinkage().getId())){ |  |  |  | 
		
	
		
			
				|  |  |             OperatingState operatingState = new OperatingState(); |  |  |  | 
		
	
		
			
				|  |  |             operatingState.setId(NanoIdUtils.randomNanoId()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState.setDeviceId(deviceInfo.getId()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState.setBorrow(deviceInfo.getIsLinkage().getBorrow()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState.setInBound(deviceInfo.getIsLinkage().getInBound()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState.setOutBound(deviceInfo.getIsLinkage().getOutBound()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState.setLend(deviceInfo.getIsLinkage().getLend()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState.setStateType(deviceInfo.getIsLinkage().getStateType()); |  |  |  | 
		
	
		
			
				|  |  |             operatingStateRepository.save(operatingState); |  |  |  | 
		
	
		
			
				|  |  |         }else { |  |  |  | 
		
	
		
			
				|  |  |             OperatingState operatingState1 = operatingStateRepository.findById(deviceInfo.getIsLinkage().getId()).orElseGet(OperatingState::new); |  |  |  | 
		
	
		
			
				|  |  |             operatingState1.setDeviceId(deviceInfo.getId()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState1.setBorrow(deviceInfo.getIsLinkage().getBorrow()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState1.setInBound(deviceInfo.getIsLinkage().getInBound()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState1.setOutBound(deviceInfo.getIsLinkage().getOutBound()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState1.setLend(deviceInfo.getIsLinkage().getLend()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState1.setStateType(deviceInfo.getIsLinkage().getStateType()); |  |  |  | 
		
	
		
			
				|  |  |             operatingStateRepository.save(operatingState1); |  |  |  | 
		
	
		
			
				|  |  |  |  |  |         if (StringUtils.isEmpty(deviceInfo.getIsLinkage().getId())) { | 
		
	
		
			
				|  |  |  |  |  |             OperatingState isLinkageState = new OperatingState(); | 
		
	
		
			
				|  |  |  |  |  |             isLinkageState.setId(NanoIdUtils.randomNanoId()); | 
		
	
		
			
				|  |  |  |  |  |             isLinkageState.setDeviceId(deviceInfo.getId()); | 
		
	
		
			
				|  |  |  |  |  |             isLinkageState.setBorrow(deviceInfo.getIsLinkage().getBorrow()); | 
		
	
		
			
				|  |  |  |  |  |             isLinkageState.setInBound(deviceInfo.getIsLinkage().getInBound()); | 
		
	
		
			
				|  |  |  |  |  |             isLinkageState.setOutBound(deviceInfo.getIsLinkage().getOutBound()); | 
		
	
		
			
				|  |  |  |  |  |             isLinkageState.setLend(deviceInfo.getIsLinkage().getLend()); | 
		
	
		
			
				|  |  |  |  |  |             isLinkageState.setStateType(deviceInfo.getIsLinkage().getStateType()); | 
		
	
		
			
				|  |  |  |  |  |             operatingStateRepository.save(isLinkageState); | 
		
	
		
			
				|  |  |  |  |  |         } else { | 
		
	
		
			
				|  |  |  |  |  |             OperatingState isLinkageState1 = operatingStateRepository.findById(deviceInfo.getIsLinkage().getId()).orElseGet(OperatingState::new); | 
		
	
		
			
				|  |  |  |  |  |             isLinkageState1.setId(isLinkageState1.getId()); | 
		
	
		
			
				|  |  |  |  |  |             isLinkageState1.setDeviceId(deviceInfo.getId()); | 
		
	
		
			
				|  |  |  |  |  |             isLinkageState1.setBorrow(deviceInfo.getIsLinkage().getBorrow()); | 
		
	
		
			
				|  |  |  |  |  |             isLinkageState1.setInBound(deviceInfo.getIsLinkage().getInBound()); | 
		
	
		
			
				|  |  |  |  |  |             isLinkageState1.setOutBound(deviceInfo.getIsLinkage().getOutBound()); | 
		
	
		
			
				|  |  |  |  |  |             isLinkageState1.setLend(deviceInfo.getIsLinkage().getLend()); | 
		
	
		
			
				|  |  |  |  |  |             isLinkageState1.setStateType(deviceInfo.getIsLinkage().getStateType()); | 
		
	
		
			
				|  |  |  |  |  |             operatingStateRepository.save(isLinkageState1); | 
		
	
		
			
				|  |  |         } |  |  |         } | 
		
	
		
			
				|  |  | 
 |  |  | 
 | 
		
	
		
			
				|  |  |     } |  |  |     } | 
		
	
	
		
			
				|  | @ -139,24 +151,25 @@ public class DeviceImpl implements DeviceService { | 
		
	
		
			
				|  |  |     private void IsCallbackState(DeviceInfo deviceInfo) { |  |  |     private void IsCallbackState(DeviceInfo deviceInfo) { | 
		
	
		
			
				|  |  | 
 |  |  | 
 | 
		
	
		
			
				|  |  |         if (StringUtils.isEmpty(deviceInfo.getIsCallback().getId())) { |  |  |         if (StringUtils.isEmpty(deviceInfo.getIsCallback().getId())) { | 
		
	
		
			
				|  |  |             OperatingState operatingState = new OperatingState(); |  |  |  | 
		
	
		
			
				|  |  |             operatingState.setId(NanoIdUtils.randomNanoId()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState.setDeviceId(deviceInfo.getId()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState.setBorrow(deviceInfo.getIsCallback().getBorrow()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState.setInBound(deviceInfo.getIsCallback().getInBound()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState.setOutBound(deviceInfo.getIsCallback().getOutBound()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState.setLend(deviceInfo.getIsCallback().getLend()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState.setStateType(deviceInfo.getIsCallback().getStateType()); |  |  |  | 
		
	
		
			
				|  |  |             operatingStateRepository.save(operatingState); |  |  |  | 
		
	
		
			
				|  |  |  |  |  |             OperatingState isCallbackState = new OperatingState(); | 
		
	
		
			
				|  |  |  |  |  |             isCallbackState.setId(NanoIdUtils.randomNanoId()); | 
		
	
		
			
				|  |  |  |  |  |             isCallbackState.setDeviceId(deviceInfo.getId()); | 
		
	
		
			
				|  |  |  |  |  |             isCallbackState.setBorrow(deviceInfo.getIsCallback().getBorrow()); | 
		
	
		
			
				|  |  |  |  |  |             isCallbackState.setInBound(deviceInfo.getIsCallback().getInBound()); | 
		
	
		
			
				|  |  |  |  |  |             isCallbackState.setOutBound(deviceInfo.getIsCallback().getOutBound()); | 
		
	
		
			
				|  |  |  |  |  |             isCallbackState.setLend(deviceInfo.getIsCallback().getLend()); | 
		
	
		
			
				|  |  |  |  |  |             isCallbackState.setStateType(deviceInfo.getIsCallback().getStateType()); | 
		
	
		
			
				|  |  |  |  |  |             operatingStateRepository.save(isCallbackState); | 
		
	
		
			
				|  |  |         } else { |  |  |         } else { | 
		
	
		
			
				|  |  |             OperatingState operatingState1 = operatingStateRepository.findById(deviceInfo.getIsLinkage().getId()).orElseGet(OperatingState::new); |  |  |  | 
		
	
		
			
				|  |  |             operatingState1.setDeviceId(deviceInfo.getId()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState1.setBorrow(deviceInfo.getIsCallback().getBorrow()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState1.setInBound(deviceInfo.getIsCallback().getInBound()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState1.setOutBound(deviceInfo.getIsCallback().getOutBound()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState1.setLend(deviceInfo.getIsCallback().getLend()); |  |  |  | 
		
	
		
			
				|  |  |             operatingState1.setStateType(deviceInfo.getIsCallback().getStateType()); |  |  |  | 
		
	
		
			
				|  |  |             operatingStateRepository.save(operatingState1); |  |  |  | 
		
	
		
			
				|  |  |  |  |  |             OperatingState isCallbackState1 = operatingStateRepository.findById(deviceInfo.getIsCallback().getId()).orElseGet(OperatingState::new); | 
		
	
		
			
				|  |  |  |  |  |             isCallbackState1.setId(isCallbackState1.getId()); | 
		
	
		
			
				|  |  |  |  |  |             isCallbackState1.setDeviceId(deviceInfo.getId()); | 
		
	
		
			
				|  |  |  |  |  |             isCallbackState1.setBorrow(deviceInfo.getIsCallback().getBorrow()); | 
		
	
		
			
				|  |  |  |  |  |             isCallbackState1.setInBound(deviceInfo.getIsCallback().getInBound()); | 
		
	
		
			
				|  |  |  |  |  |             isCallbackState1.setOutBound(deviceInfo.getIsCallback().getOutBound()); | 
		
	
		
			
				|  |  |  |  |  |             isCallbackState1.setLend(deviceInfo.getIsCallback().getLend()); | 
		
	
		
			
				|  |  |  |  |  |             isCallbackState1.setStateType(deviceInfo.getIsCallback().getStateType()); | 
		
	
		
			
				|  |  |  |  |  |             operatingStateRepository.save(isCallbackState1); | 
		
	
		
			
				|  |  |         } |  |  |         } | 
		
	
		
			
				|  |  |     } |  |  |     } | 
		
	
		
			
				|  |  | } |  |  | } |