|
@@ -17,15 +17,29 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import vip.xiaonuo.core.param.OrgIdParam;
|
|
|
|
+import vip.xiaonuo.modular.ai.taskInspection.entity.TaskInspection;
|
|
|
|
+import vip.xiaonuo.modular.ai.taskInspection.mapper.TaskInspectionMapper;
|
|
|
|
+import vip.xiaonuo.modular.ai.warningRemind.entity.WarningRemind;
|
|
|
|
+import vip.xiaonuo.modular.ai.warningRemind.mapper.WarningRemindMapper;
|
|
|
|
+import vip.xiaonuo.modular.base.baseConfig.entity.BaseConfig;
|
|
|
|
+import vip.xiaonuo.modular.base.baseConfig.mapper.BaseConfigMapper;
|
|
|
|
+import vip.xiaonuo.modular.base.baseSeason.entity.BaseSeason;
|
|
|
|
+import vip.xiaonuo.modular.base.baseSeason.mapper.BaseSeasonMapper;
|
|
|
|
+import vip.xiaonuo.modular.base.baseSeason.param.BaseSeasonTypeParam;
|
|
|
|
+import vip.xiaonuo.modular.base.baseSeason.service.BaseSeasonService;
|
|
import vip.xiaonuo.modular.base.pigpen.entity.BasePigpen;
|
|
import vip.xiaonuo.modular.base.pigpen.entity.BasePigpen;
|
|
import vip.xiaonuo.modular.base.pigpen.mapper.BasePigpenMapper;
|
|
import vip.xiaonuo.modular.base.pigpen.mapper.BasePigpenMapper;
|
|
import vip.xiaonuo.modular.env.entity.EnvDeviceEquipment;
|
|
import vip.xiaonuo.modular.env.entity.EnvDeviceEquipment;
|
|
|
|
+import vip.xiaonuo.modular.env.envThreshold.entity.EnvThreshold;
|
|
|
|
+import vip.xiaonuo.modular.env.envThreshold.mapper.EnvThresholdMapper;
|
|
import vip.xiaonuo.modular.env.envdata.entity.EnvData;
|
|
import vip.xiaonuo.modular.env.envdata.entity.EnvData;
|
|
import vip.xiaonuo.modular.env.envdata.entity.vo.EnvDataCarouselVo;
|
|
import vip.xiaonuo.modular.env.envdata.entity.vo.EnvDataCarouselVo;
|
|
import vip.xiaonuo.modular.env.envdata.entity.vo.EnvDataListVo;
|
|
import vip.xiaonuo.modular.env.envdata.entity.vo.EnvDataListVo;
|
|
import vip.xiaonuo.modular.env.envdata.entity.vo.EnvDataRecentVo;
|
|
import vip.xiaonuo.modular.env.envdata.entity.vo.EnvDataRecentVo;
|
|
import vip.xiaonuo.modular.env.envdata.entity.vo.EnvDataTrendVo;
|
|
import vip.xiaonuo.modular.env.envdata.entity.vo.EnvDataTrendVo;
|
|
import vip.xiaonuo.modular.env.envdata.mapper.EnvDataMapper;
|
|
import vip.xiaonuo.modular.env.envdata.mapper.EnvDataMapper;
|
|
|
|
+import vip.xiaonuo.modular.env.envdata.param.EnvDataAddParm;
|
|
import vip.xiaonuo.modular.env.envdata.param.EnvDataBuildNameParm;
|
|
import vip.xiaonuo.modular.env.envdata.param.EnvDataBuildNameParm;
|
|
import vip.xiaonuo.modular.env.envdata.param.EnvDataListParm;
|
|
import vip.xiaonuo.modular.env.envdata.param.EnvDataListParm;
|
|
import vip.xiaonuo.modular.env.envdata.param.EnvDataPigpenIdParm;
|
|
import vip.xiaonuo.modular.env.envdata.param.EnvDataPigpenIdParm;
|
|
@@ -33,9 +47,16 @@ import vip.xiaonuo.modular.env.envdata.service.EnvDataService;
|
|
import vip.xiaonuo.modular.env.envdevice.entity.EnvDevice;
|
|
import vip.xiaonuo.modular.env.envdevice.entity.EnvDevice;
|
|
import vip.xiaonuo.modular.env.envdevice.mapper.EnvDeviceMapper;
|
|
import vip.xiaonuo.modular.env.envdevice.mapper.EnvDeviceMapper;
|
|
import vip.xiaonuo.modular.env.mapper.EnvDeviceEquipmentMapper;
|
|
import vip.xiaonuo.modular.env.mapper.EnvDeviceEquipmentMapper;
|
|
|
|
+import vip.xiaonuo.modular.warning.warningInfo.entity.WarningInfo;
|
|
|
|
+import vip.xiaonuo.modular.warning.warningInfo.mapper.WarningInfoMapper;
|
|
|
|
+import vip.xiaonuo.modular.warning.warningManager.entity.WarningManager;
|
|
|
|
+import vip.xiaonuo.modular.warning.warningManager.mapper.WarningManagerMapper;
|
|
|
|
|
|
|
|
+import javax.validation.constraints.NotBlank;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
+import java.text.ParseException;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -56,6 +77,20 @@ public class EnvDataServiceImpl extends ServiceImpl<EnvDataMapper, EnvData> impl
|
|
private EnvDeviceEquipmentMapper envDeviceEquipmentMapper;
|
|
private EnvDeviceEquipmentMapper envDeviceEquipmentMapper;
|
|
@Autowired
|
|
@Autowired
|
|
private EnvDeviceMapper envDeviceMapper;
|
|
private EnvDeviceMapper envDeviceMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private EnvThresholdMapper envThresholdMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private BaseSeasonService baseSeasonService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private WarningManagerMapper warningManagerMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private BaseConfigMapper baseConfigMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private WarningInfoMapper warningInfoMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private TaskInspectionMapper taskInspectionMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private WarningRemindMapper warningRemindMapper;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<EnvDataRecentVo> getLastDataByPigpenId(EnvDataPigpenIdParm envDataPigpenIdParm) {
|
|
public List<EnvDataRecentVo> getLastDataByPigpenId(EnvDataPigpenIdParm envDataPigpenIdParm) {
|
|
@@ -139,4 +174,320 @@ public class EnvDataServiceImpl extends ServiceImpl<EnvDataMapper, EnvData> impl
|
|
return envDatas;
|
|
return envDatas;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void addData(EnvDataAddParm envDataAddParm) throws ParseException {
|
|
|
|
+ BigDecimal hum = envDataAddParm.getHum();
|
|
|
|
+ BigDecimal tem = envDataAddParm.getTem();
|
|
|
|
+ String pigpenId = envDataAddParm.getPigpenId();
|
|
|
|
+ String orgId = envDataAddParm.getOrgId();
|
|
|
|
+ BaseConfig baseConfig = baseConfigMapper.selectOne(new QueryWrapper<BaseConfig>().lambda().eq(BaseConfig::getConfigName, "预警类型").eq(BaseConfig::getParentId, 0));
|
|
|
|
+ BaseConfig envWarning = baseConfigMapper.selectOne(new QueryWrapper<BaseConfig>().lambda().eq(BaseConfig::getConfigName, "环控预警").eq(BaseConfig::getParentId, baseConfig.getId()));
|
|
|
|
+
|
|
|
|
+ WarningRemind warningRemind = warningRemindMapper.selectOne(new QueryWrapper<WarningRemind>().lambda()
|
|
|
|
+ .eq(WarningRemind::getWarningTypeId, envWarning.getId())
|
|
|
|
+ .eq(WarningRemind::getOrgId, orgId).eq(WarningRemind::getUnitId, pigpenId));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Date now = new Date();
|
|
|
|
+ Integer sea = 1 ;
|
|
|
|
+ EnvData envData = new EnvData();
|
|
|
|
+ envData.setAskTime(now);
|
|
|
|
+ envData.setUpdateTime(now);
|
|
|
|
+ envData.setHumiHandleValue(hum);
|
|
|
|
+ envData.setTemHandleValue(tem);
|
|
|
|
+ envData.setPigpenId(pigpenId);
|
|
|
|
+ this.save(envData);
|
|
|
|
+
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningRemind)){
|
|
|
|
+
|
|
|
|
+ System.out.println("warningRemind:"+warningRemind);
|
|
|
|
+ if (warningRemind.getTodayNoRemind() == 1){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ OrgIdParam orgIdParam = new OrgIdParam();
|
|
|
|
+ orgIdParam.setOrgId(orgId);
|
|
|
|
+ Integer seasonType = baseSeasonService.getEnableSeason(orgIdParam);
|
|
|
|
+
|
|
|
|
+ BaseSeasonTypeParam baseSeasonTypeParam = new BaseSeasonTypeParam();
|
|
|
|
+ baseSeasonTypeParam.setSeasonType(seasonType.toString());
|
|
|
|
+ baseSeasonTypeParam.setOrgId(orgId);
|
|
|
|
+ BaseSeason season = baseSeasonService.getSeason(baseSeasonTypeParam);
|
|
|
|
+
|
|
|
|
+ if (now.after(season.getSpringStartTime()) && now.before(season.getSpringEndTime())){
|
|
|
|
+ sea = 1;
|
|
|
|
+ }
|
|
|
|
+ if (now.after(season.getSummerStartTime()) && now.before(season.getSummerEndTime())){
|
|
|
|
+ sea = 2;
|
|
|
|
+ }
|
|
|
|
+ if (now.after(season.getAutumnStartTime()) && now.before(season.getAutumnEndTime())){
|
|
|
|
+ sea = 3;
|
|
|
|
+ }
|
|
|
|
+ if (now.after(season.getWinterStartTime()) && now.before(season.getWinterEndTime())){
|
|
|
|
+ sea = 4;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ EnvThreshold envThreshold = envThresholdMapper.selectOne(new QueryWrapper<EnvThreshold>().lambda().eq(EnvThreshold::getUnitId, pigpenId));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(envThreshold)){
|
|
|
|
+ if (sea == 1){
|
|
|
|
+ if ((tem.compareTo(envThreshold.getSpringTemLower()) < 0 )){
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getType, 0).eq(WarningManager::getOrgId, orgId));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningContent("温度"+ tem + "℃" +"低于阈值");
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+
|
|
|
|
+ this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if ((tem.compareTo(envThreshold.getSpringTemUpper()) > 0 )){
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getType, 0).eq(WarningManager::getOrgId, orgId));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningContent("温度"+ tem + "℃" +"高于阈值");
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+
|
|
|
|
+ this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
+ }
|
|
|
|
+ if ((hum.compareTo(envThreshold.getSpringHumiLower()) < 0 )){
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getType, 0).eq(WarningManager::getOrgId, orgId));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningContent("湿度"+ hum +"低于阈值");
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+
|
|
|
|
+ this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
+ }
|
|
|
|
+ if ((hum.compareTo(envThreshold.getSpringHumiUpper()) > 0 )){
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getType, 0).eq(WarningManager::getOrgId, orgId));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningContent("湿度"+ hum +"低于阈值");
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+
|
|
|
|
+ this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
+ }
|
|
|
|
+ }else if (sea == 2){
|
|
|
|
+ if ((tem.compareTo(envThreshold.getSummerTemLower()) < 0 )){
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getType, 0).eq(WarningManager::getOrgId, orgId));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningContent("温度"+ tem + "℃" +"低于阈值");
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+
|
|
|
|
+ this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
+ }
|
|
|
|
+ if ((tem.compareTo(envThreshold.getSummerTemUpper()) > 0 )){
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getType, 0).eq(WarningManager::getOrgId, orgId));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningContent("温度"+ tem + "℃" +"高于阈值");
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+
|
|
|
|
+ this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
+ }
|
|
|
|
+ if ((hum.compareTo(envThreshold.getSummerHumiLower()) < 0 )){
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getType, 0).eq(WarningManager::getOrgId, orgId));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningContent("湿度"+ hum +"低于阈值");
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+
|
|
|
|
+ this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
+ }
|
|
|
|
+ if ((hum.compareTo(envThreshold.getSummerHumiUpper()) > 0 )){
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getType, 0).eq(WarningManager::getOrgId, orgId));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningContent("湿度"+ hum +"低于阈值");
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+
|
|
|
|
+ this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
+ }
|
|
|
|
+ }else if (sea == 3){
|
|
|
|
+ if ((tem.compareTo(envThreshold.getAutumnTemLower()) < 0 )){
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getType, 0).eq(WarningManager::getOrgId, orgId));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningContent("温度"+ tem + "℃" +"低于阈值");
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+
|
|
|
|
+ this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
+ }
|
|
|
|
+ if ((tem.compareTo(envThreshold.getAutumnTemUpper()) > 0 )){
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getType, 0).eq(WarningManager::getOrgId, orgId));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningContent("温度"+ tem + "℃" +"高于阈值");
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+
|
|
|
|
+ this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
+ }
|
|
|
|
+ if ((hum.compareTo(envThreshold.getAutumnHumiLower()) < 0 )){
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getType, 0).eq(WarningManager::getOrgId, orgId));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningContent("湿度"+ hum +"低于阈值");
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+
|
|
|
|
+ this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
+ }
|
|
|
|
+ if ((hum.compareTo(envThreshold.getAutumnHumiUpper()) > 0 )){
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getType, 0).eq(WarningManager::getOrgId, orgId));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningContent("湿度"+ hum +"低于阈值");
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+
|
|
|
|
+ this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ if ((tem.compareTo(envThreshold.getWinterTemLower()) < 0 )){
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getType, 0).eq(WarningManager::getOrgId, orgId));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningContent("温度"+ tem + "℃" +"低于阈值");
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+
|
|
|
|
+ this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
+ }
|
|
|
|
+ if ((tem.compareTo(envThreshold.getWinterTemUpper()) > 0 )){
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getType, 0).eq(WarningManager::getOrgId, orgId));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningContent("温度"+ tem + "℃" +"高于阈值");
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+
|
|
|
|
+ this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
+ }
|
|
|
|
+ if ((hum.compareTo(envThreshold.getWinterHumiLower()) < 0 )){
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getType, 0).eq(WarningManager::getOrgId, orgId));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningContent("湿度"+ hum +"低于阈值");
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+
|
|
|
|
+ this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
+ }
|
|
|
|
+ if ((hum.compareTo(envThreshold.getWinterHumiUpper()) > 0 )){
|
|
|
|
+ WarningInfo warningInfo = new WarningInfo();
|
|
|
|
+ WarningManager warningManager = warningManagerMapper.selectOne(new QueryWrapper<WarningManager>().lambda().eq(WarningManager::getType, 0).eq(WarningManager::getOrgId, orgId));
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
+ warningInfo.setWarningNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ }
|
|
|
|
+ warningInfo.setUnitId(pigpenId);
|
|
|
|
+ warningInfo.setWarningTypeId(envWarning.getId());
|
|
|
|
+ warningInfo.setWarningTime(now);
|
|
|
|
+ warningInfo.setOrgId(orgId);
|
|
|
|
+ warningInfo.setWarningContent("湿度"+ hum +"低于阈值");
|
|
|
|
+ warningInfoMapper.insert(warningInfo);
|
|
|
|
+
|
|
|
|
+ this.generateInspection(warningManager,warningInfo,orgId);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ private void generateInspection(WarningManager warningManager, WarningInfo warningInfo,String orgId){
|
|
|
|
+ TaskInspection taskInspection = new TaskInspection();
|
|
|
|
+ if (ObjectUtil.isNotEmpty(warningManager)){
|
|
|
|
+ taskInspection.setNotifierId(warningManager.getSecondManagerId());
|
|
|
|
+ taskInspection.setWarningId(warningInfo.getId());
|
|
|
|
+ taskInspection.setOrgId(orgId);
|
|
|
|
+ taskInspectionMapper.insert(taskInspection);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|