|
|
@ -4,12 +4,10 @@ import com.alibaba.fastjson2.JSON; |
|
|
|
import com.mh.common.utils.StringUtils; |
|
|
|
import com.mh.common.utils.StringUtils; |
|
|
|
import com.mh.user.constants.Constant; |
|
|
|
import com.mh.user.constants.Constant; |
|
|
|
import com.mh.user.entity.DeviceCodeParamEntity; |
|
|
|
import com.mh.user.entity.DeviceCodeParamEntity; |
|
|
|
|
|
|
|
import com.mh.user.entity.DeviceInstallEntity; |
|
|
|
import com.mh.user.entity.NowPublicDataEntity; |
|
|
|
import com.mh.user.entity.NowPublicDataEntity; |
|
|
|
import com.mh.user.entity.SysParamEntity; |
|
|
|
import com.mh.user.entity.SysParamEntity; |
|
|
|
import com.mh.user.service.BuildingService; |
|
|
|
import com.mh.user.service.*; |
|
|
|
import com.mh.user.service.NowDataService; |
|
|
|
|
|
|
|
import com.mh.user.service.NowPublicDataService; |
|
|
|
|
|
|
|
import com.mh.user.service.SysParamService; |
|
|
|
|
|
|
|
import com.mh.user.utils.ExchangeStringUtil; |
|
|
|
import com.mh.user.utils.ExchangeStringUtil; |
|
|
|
import com.mh.user.utils.SpringBeanUtil; |
|
|
|
import com.mh.user.utils.SpringBeanUtil; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
@ -39,6 +37,8 @@ public class WaterLevelSwitchStrategy implements DeviceStrategy { |
|
|
|
|
|
|
|
|
|
|
|
BuildingService buildingService = context.getBean(BuildingService.class); |
|
|
|
BuildingService buildingService = context.getBean(BuildingService.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DeviceInstallService deviceInstallService = context.getBean(DeviceInstallService.class); |
|
|
|
|
|
|
|
|
|
|
|
private static class SingletonHolder { |
|
|
|
private static class SingletonHolder { |
|
|
|
private static final WaterLevelSwitchStrategy INSTANCE = new WaterLevelSwitchStrategy(); |
|
|
|
private static final WaterLevelSwitchStrategy INSTANCE = new WaterLevelSwitchStrategy(); |
|
|
|
} |
|
|
|
} |
|
|
@ -525,7 +525,21 @@ public class WaterLevelSwitchStrategy implements DeviceStrategy { |
|
|
|
log.info("-----------------补水状态:" + l2 + "-----------------"); |
|
|
|
log.info("-----------------补水状态:" + l2 + "-----------------"); |
|
|
|
} |
|
|
|
} |
|
|
|
nowPublicDataService.saveNowHistoryPublicData(publicData); |
|
|
|
nowPublicDataService.saveNowHistoryPublicData(publicData); |
|
|
|
log.info("-----------------状态保存数据库成功!楼栋名称:" + buildingName + "-----------------"); |
|
|
|
log.info("地址:{},供回补水状态保存数据库成功!楼栋ID:{},名称:{}" ,addr, buildingId, buildingName); |
|
|
|
|
|
|
|
// 更新now_data表中对应的供水、回水、补水状态
|
|
|
|
|
|
|
|
DeviceInstallEntity deviceInstallEntity = deviceInstallService.selectDevice(addr, "水位开关", buildingId); |
|
|
|
|
|
|
|
if (deviceInstallEntity != null |
|
|
|
|
|
|
|
&& !StringUtils.isBlank(deviceInstallEntity.getDeviceName())) { |
|
|
|
|
|
|
|
if (deviceInstallEntity.getDeviceName().contains("低")) { |
|
|
|
|
|
|
|
log.info("更新now_data表中低区对应的供水、回水、补水状态,楼栋ID:{},供水状态:{},回水状态:{},补水状态:{}", buildingId, publicData.getUseWater(), publicData.getBackWater(), publicData.getUpWater()); |
|
|
|
|
|
|
|
nowDataService.updateNowDataByPumpName("低", buildingId, publicData.getUseWater(), publicData.getBackWater(), publicData.getUpWater()); |
|
|
|
|
|
|
|
} else if (deviceInstallEntity.getDeviceName().contains("高")) { |
|
|
|
|
|
|
|
log.info("更新now_data表中高区对应的供水、回水、补水状态,楼栋ID:{},供水状态:{},回水状态:{},补水状态:{}", buildingId, publicData.getUseWater(), publicData.getBackWater(), publicData.getUpWater()); |
|
|
|
|
|
|
|
nowDataService.updateNowDataByPumpName("高", buildingId, publicData.getUseWater(), publicData.getBackWater(), publicData.getUpWater()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
nowDataService.updateNowDataByPumpName(null, buildingId, publicData.getUseWater(), publicData.getBackWater(), publicData.getUpWater()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return Constant.FAIL; |
|
|
|
return Constant.FAIL; |
|
|
|