|
@@ -158,6 +158,8 @@ public class WaterMeterReplaceLogServiceImpl implements WaterMeterReplaceLogServ
|
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
LoginAssistantUser loginAssistantUser = AssistantUserUtil.getCurrentUser();
|
|
|
|
|
|
+ Boolean remoteMeterFlag = false;
|
|
|
+
|
|
|
String username = null;
|
|
|
String userPhone = null;
|
|
|
if(loginUser != null){
|
|
@@ -235,11 +237,18 @@ public class WaterMeterReplaceLogServiceImpl implements WaterMeterReplaceLogServ
|
|
|
newDevice.setWaterMeterNo(waterMeterReplaceInputDto.getNewElectronicNo());
|
|
|
}
|
|
|
if (waterMeterReplaceInputDto.getNewDeviceTypeId() != null && waterMeterReplaceInputDto.getNewDeviceTypeId()!=0) {
|
|
|
+ Integer channelId = null;
|
|
|
if(device.getSysId()!=-99){
|
|
|
ChannelDeviceTypeUse use = channelDeviceTypeUseMapper.findByDeviceId(waterMeterReplaceInputDto.getNewDeviceTypeId());
|
|
|
if (use != null) {
|
|
|
+ channelId = use.getChannelId();
|
|
|
newDevice.setSysId(use.getChannelId());
|
|
|
}
|
|
|
+ }else {
|
|
|
+ channelId = device.getSysId();
|
|
|
+ }
|
|
|
+ if(channelId!=null && channelId == 55){
|
|
|
+ remoteMeterFlag = true;
|
|
|
}
|
|
|
newDevice.setDeviceType(waterMeterReplaceInputDto.getNewDeviceTypeId());
|
|
|
|
|
@@ -256,18 +265,30 @@ public class WaterMeterReplaceLogServiceImpl implements WaterMeterReplaceLogServ
|
|
|
newDevice.setDateUpdate(LocalDateTime.now());
|
|
|
deviceMapper.updateByPrimaryKeySelective(newDevice);
|
|
|
|
|
|
- if (waterMeterReplaceInputDto.getConcentratorId() != null) {
|
|
|
+
|
|
|
+
|
|
|
+ if (remoteMeterFlag) {
|
|
|
+ //先删除再插入
|
|
|
+ waterRelatedDeviceMapper.realDelByDeviceId(waterMeterReplaceInputDto.getDeviceId());
|
|
|
+
|
|
|
WaterRelatedDevice waterRelatedDevice = new WaterRelatedDevice();
|
|
|
- waterRelatedDevice.setDeviceId(device.getId());
|
|
|
+ waterRelatedDevice.setDeviceId(waterMeterReplaceInputDto.getDeviceId());
|
|
|
waterRelatedDevice.setConcentratorId(waterMeterReplaceInputDto.getConcentratorId());
|
|
|
waterRelatedDevice.setCollectorId(waterMeterReplaceInputDto.getCollectorId());
|
|
|
waterRelatedDevice.setChannelNumberId(waterMeterReplaceInputDto.getChannelNumberId());
|
|
|
waterRelatedDevice.setPort(waterMeterReplaceInputDto.getPort());
|
|
|
+ waterRelatedDevice.setIssueStatus(0);
|
|
|
+ waterRelatedDevice.setStatus(1);
|
|
|
//waterRelatedDevice.setRemark();
|
|
|
+ waterRelatedDevice.setDateCreate(LocalDateTime.now());
|
|
|
waterRelatedDevice.setDateUpdate(LocalDateTime.now());
|
|
|
- waterRelatedDevice.setUpdateBy(UserUtil.getCurrentUser().getUsername());
|
|
|
- waterRelatedDeviceMapper.updateByPrimaryKeySelective(waterRelatedDevice);
|
|
|
+ waterRelatedDevice.setUpdateBy(username);
|
|
|
+ waterRelatedDevice.setCreateBy(username);
|
|
|
+ waterRelatedDeviceMapper.insertSelective(waterRelatedDevice);
|
|
|
|
|
|
+ }else {
|
|
|
+ //删除
|
|
|
+ waterRelatedDeviceMapper.realDelByDeviceId(waterMeterReplaceInputDto.getDeviceId());
|
|
|
}
|
|
|
|
|
|
// 3、推送换表信息
|