|
@@ -98,147 +98,149 @@ public class ProEnergyData implements CommonTimerTaskRunner {
|
|
.eq(WarningRemind::getWarningTypeId, envWarning.getId())
|
|
.eq(WarningRemind::getWarningTypeId, envWarning.getId())
|
|
.eq(WarningRemind::getOrgId, orgId).eq(WarningRemind::getUnitId, pigpenId));
|
|
.eq(WarningRemind::getOrgId, orgId).eq(WarningRemind::getUnitId, pigpenId));
|
|
|
|
|
|
|
|
+
|
|
if (ObjectUtil.isNotEmpty(warningRemind)) {
|
|
if (ObjectUtil.isNotEmpty(warningRemind)) {
|
|
- if (warningRemind.getTodayNoRemind() != 1) {
|
|
|
|
- EnergyThreshold energyThreshold = energyThresholdMapper.selectOne(new QueryWrapper<EnergyThreshold>().lambda().eq(EnergyThreshold::getOrgId, orgId).eq(EnergyThreshold::getUnitId, pigpenId).eq(EnergyThreshold::getIsEnable, 1));
|
|
|
|
- if (ObjectUtil.isNotEmpty(energyThreshold)) {
|
|
|
|
- BigDecimal waterLower = energyThreshold.getWaterLower();
|
|
|
|
- if (water.compareTo(waterLower) < 0) {
|
|
|
|
- WarningInfo warningInfo = new WarningInfo();
|
|
|
|
- warningInfo.setWarningContent("用水" + water + "吨低于阈值");
|
|
|
|
- warningInfo.setUnitId(pigpenId);
|
|
|
|
- warningInfo.setWarningTime(now);
|
|
|
|
- warningInfo.setOrgId(orgId);
|
|
|
|
- warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
- WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getOrgId, orgId).eq(WarningManager::getType, 1));
|
|
|
|
- if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
- warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
- }
|
|
|
|
- warningInfoMapper.insert(warningInfo);
|
|
|
|
- this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
- }
|
|
|
|
- BigDecimal waterUpper = energyThreshold.getWaterUpper();
|
|
|
|
- if (water.compareTo(waterUpper) > 0) {
|
|
|
|
- WarningInfo warningInfo = new WarningInfo();
|
|
|
|
- warningInfo.setWarningContent("用水" + water + "吨高于阈值");
|
|
|
|
- warningInfo.setUnitId(pigpenId);
|
|
|
|
- warningInfo.setWarningTime(now);
|
|
|
|
- warningInfo.setOrgId(orgId);
|
|
|
|
- warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
- WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getOrgId, orgId).eq(WarningManager::getType, 1));
|
|
|
|
- if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
- warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
- }
|
|
|
|
- warningInfoMapper.insert(warningInfo);
|
|
|
|
- this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
- }
|
|
|
|
- BigDecimal electricityLower = energyThreshold.getElectricityLower();
|
|
|
|
- if (ele.compareTo(electricityLower) < 0) {
|
|
|
|
- WarningInfo warningInfo = new WarningInfo();
|
|
|
|
- warningInfo.setWarningContent("用电" + ele + "kw·h低于阈值");
|
|
|
|
- warningInfo.setUnitId(pigpenId);
|
|
|
|
- warningInfo.setWarningTime(now);
|
|
|
|
- warningInfo.setOrgId(orgId);
|
|
|
|
- warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
- WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getOrgId, orgId).eq(WarningManager::getType, 1));
|
|
|
|
- if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
- warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
- }
|
|
|
|
- warningInfoMapper.insert(warningInfo);
|
|
|
|
- this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
- }
|
|
|
|
- BigDecimal electricityUpper = energyThreshold.getElectricityUpper();
|
|
|
|
- if (ele.compareTo(electricityUpper) > 0) {
|
|
|
|
- WarningInfo warningInfo = new WarningInfo();
|
|
|
|
- warningInfo.setWarningContent("用电" + ele + "kw·h高于阈值");
|
|
|
|
- warningInfo.setUnitId(pigpenId);
|
|
|
|
- warningInfo.setWarningTime(now);
|
|
|
|
- warningInfo.setOrgId(orgId);
|
|
|
|
- warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
- WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getOrgId, orgId).eq(WarningManager::getType, 1));
|
|
|
|
- if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
- warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
- }
|
|
|
|
- warningInfoMapper.insert(warningInfo);
|
|
|
|
- this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
- }
|
|
|
|
- BigDecimal sevenDayEleTotal = electricityMapper.getSevenDayTotal(orgId, pigpenId);
|
|
|
|
- BigDecimal sevenDayWaterTotal = waterMapper.getSevenDayTotal(orgId, pigpenId);
|
|
|
|
-
|
|
|
|
- BigDecimal sevenDayWaterLower = energyThreshold.getSevenDayWaterLower();
|
|
|
|
- if (sevenDayWaterTotal.compareTo(sevenDayWaterLower) < 0) {
|
|
|
|
- WarningInfo warningInfo = new WarningInfo();
|
|
|
|
- warningInfo.setWarningContent("七日用水" + sevenDayWaterTotal + "吨低于阈值");
|
|
|
|
- warningInfo.setUnitId(pigpenId);
|
|
|
|
- warningInfo.setWarningTime(now);
|
|
|
|
- warningInfo.setOrgId(orgId);
|
|
|
|
- warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
- WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getOrgId, orgId).eq(WarningManager::getType, 1));
|
|
|
|
- if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
- warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
- }
|
|
|
|
- warningInfoMapper.insert(warningInfo);
|
|
|
|
- this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
- }
|
|
|
|
- BigDecimal sevenDayWaterUpper = energyThreshold.getSevenDayWaterUpper();
|
|
|
|
- if (sevenDayWaterTotal.compareTo(sevenDayWaterUpper) > 0) {
|
|
|
|
- WarningInfo warningInfo = new WarningInfo();
|
|
|
|
- warningInfo.setWarningContent("七日用水" + sevenDayWaterTotal + "吨高于阈值");
|
|
|
|
- warningInfo.setUnitId(pigpenId);
|
|
|
|
- warningInfo.setWarningTime(now);
|
|
|
|
- warningInfo.setOrgId(orgId);
|
|
|
|
- warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
- WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getOrgId, orgId).eq(WarningManager::getType, 1));
|
|
|
|
- if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
- warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
- }
|
|
|
|
- warningInfoMapper.insert(warningInfo);
|
|
|
|
- this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
- }
|
|
|
|
- BigDecimal sevenDayElectricityLower = energyThreshold.getSevenDayElectricityLower();
|
|
|
|
- if (sevenDayEleTotal.compareTo(sevenDayElectricityLower) < 0) {
|
|
|
|
- WarningInfo warningInfo = new WarningInfo();
|
|
|
|
- warningInfo.setWarningContent("七日用电" + sevenDayEleTotal + "kw·h低于阈值");
|
|
|
|
- warningInfo.setUnitId(pigpenId);
|
|
|
|
- warningInfo.setWarningTime(now);
|
|
|
|
- warningInfo.setOrgId(orgId);
|
|
|
|
- warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
- WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getOrgId, orgId).eq(WarningManager::getType, 1));
|
|
|
|
- if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
- warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
- }
|
|
|
|
- warningInfoMapper.insert(warningInfo);
|
|
|
|
- this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- BigDecimal sevenDayElectricityUpper = energyThreshold.getSevenDayElectricityUpper();
|
|
|
|
- if (sevenDayEleTotal.compareTo(sevenDayElectricityUpper) > 0) {
|
|
|
|
- WarningInfo warningInfo = new WarningInfo();
|
|
|
|
- warningInfo.setWarningContent("七日用电" + sevenDayEleTotal + "kw·h高于阈值");
|
|
|
|
- warningInfo.setUnitId(pigpenId);
|
|
|
|
- warningInfo.setWarningTime(now);
|
|
|
|
- warningInfo.setOrgId(orgId);
|
|
|
|
- warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
- WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getOrgId, orgId).eq(WarningManager::getType, 1));
|
|
|
|
- if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
- warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
- }
|
|
|
|
- warningInfoMapper.insert(warningInfo);
|
|
|
|
- this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
- }
|
|
|
|
|
|
+ if (warningRemind.getTodayNoRemind() == 1) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ EnergyThreshold energyThreshold = energyThresholdMapper.selectOne(new QueryWrapper<EnergyThreshold>().lambda().eq(EnergyThreshold::getOrgId, orgId).eq(EnergyThreshold::getUnitId, pigpenId).eq(EnergyThreshold::getIsEnable, 1));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(energyThreshold)) {
|
|
|
|
+ BigDecimal waterLower = energyThreshold.getWaterLower();
|
|
|
|
+ if (water.compareTo(waterLower) < 0) {
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ warningInfo.setWarningContent("用水" + water + "吨低于阈值");
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getOrgId, orgId).eq(WarningManager::getType, 1));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)) {
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+ this.generateInspection(warningManager, warningInfo, orgId);
|
|
|
|
+ }
|
|
|
|
+ BigDecimal waterUpper = energyThreshold.getWaterUpper();
|
|
|
|
+ if (water.compareTo(waterUpper) > 0) {
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ warningInfo.setWarningContent("用水" + water + "吨高于阈值");
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getOrgId, orgId).eq(WarningManager::getType, 1));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)) {
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+ this.generateInspection(warningManager, warningInfo, orgId);
|
|
|
|
+ }
|
|
|
|
+ BigDecimal electricityLower = energyThreshold.getElectricityLower();
|
|
|
|
+ if (ele.compareTo(electricityLower) < 0) {
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ warningInfo.setWarningContent("用电" + ele + "kw·h低于阈值");
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getOrgId, orgId).eq(WarningManager::getType, 1));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)) {
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+ this.generateInspection(warningManager, warningInfo, orgId);
|
|
|
|
+ }
|
|
|
|
+ BigDecimal electricityUpper = energyThreshold.getElectricityUpper();
|
|
|
|
+ if (ele.compareTo(electricityUpper) > 0) {
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ warningInfo.setWarningContent("用电" + ele + "kw·h高于阈值");
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getOrgId, orgId).eq(WarningManager::getType, 1));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)) {
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
}
|
|
}
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+ this.generateInspection(warningManager, warningInfo, orgId);
|
|
|
|
+ }
|
|
|
|
+ BigDecimal sevenDayEleTotal = electricityMapper.getSevenDayTotal(orgId, pigpenId);
|
|
|
|
+ BigDecimal sevenDayWaterTotal = waterMapper.getSevenDayTotal(orgId, pigpenId);
|
|
|
|
+
|
|
|
|
+ BigDecimal sevenDayWaterLower = energyThreshold.getSevenDayWaterLower();
|
|
|
|
+ if (sevenDayWaterTotal.compareTo(sevenDayWaterLower) < 0) {
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ warningInfo.setWarningContent("七日用水" + sevenDayWaterTotal + "吨低于阈值");
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getOrgId, orgId).eq(WarningManager::getType, 1));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)) {
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+ this.generateInspection(warningManager, warningInfo, orgId);
|
|
|
|
+ }
|
|
|
|
+ BigDecimal sevenDayWaterUpper = energyThreshold.getSevenDayWaterUpper();
|
|
|
|
+ if (sevenDayWaterTotal.compareTo(sevenDayWaterUpper) > 0) {
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ warningInfo.setWarningContent("七日用水" + sevenDayWaterTotal + "吨高于阈值");
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getOrgId, orgId).eq(WarningManager::getType, 1));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)) {
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+ this.generateInspection(warningManager, warningInfo, orgId);
|
|
|
|
+ }
|
|
|
|
+ BigDecimal sevenDayElectricityLower = energyThreshold.getSevenDayElectricityLower();
|
|
|
|
+ if (sevenDayEleTotal.compareTo(sevenDayElectricityLower) < 0) {
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ warningInfo.setWarningContent("七日用电" + sevenDayEleTotal + "kw·h低于阈值");
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getOrgId, orgId).eq(WarningManager::getType, 1));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)) {
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+ this.generateInspection(warningManager, warningInfo, orgId);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ BigDecimal sevenDayElectricityUpper = energyThreshold.getSevenDayElectricityUpper();
|
|
|
|
+ if (sevenDayEleTotal.compareTo(sevenDayElectricityUpper) > 0) {
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ warningInfo.setWarningContent("七日用电" + sevenDayEleTotal + "kw·h高于阈值");
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getOrgId, orgId).eq(WarningManager::getType, 1));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)) {
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+ this.generateInspection(warningManager, warningInfo, orgId);
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private void generateInspection(WarningManager warningManager, WarningInfo warningInfo,String orgId){
|
|
|
|
|
|
+ private void generateInspection(WarningManager warningManager, WarningInfo warningInfo, String orgId) {
|
|
TaskInspection taskInspection = new TaskInspection();
|
|
TaskInspection taskInspection = new TaskInspection();
|
|
- if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)) {
|
|
taskInspection.setNotifierId(warningManager.getSecondManagerId());
|
|
taskInspection.setNotifierId(warningManager.getSecondManagerId());
|
|
taskInspection.setWarningId(warningInfo.getId());
|
|
taskInspection.setWarningId(warningInfo.getId());
|
|
taskInspection.setOrgId(orgId);
|
|
taskInspection.setOrgId(orgId);
|