Newspaper 1 anno fa
parent
commit
512677ecb1

+ 1 - 1
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/controller/BizUserController.java

@@ -125,7 +125,7 @@ public class BizUserController {
                                      @RequestParam @ApiParam(value = "手机") String phone,
                                      @RequestParam @ApiParam(value = "紧急联系人电话") String emergencyPhone,
                                      @RequestParam @ApiParam(value = "入职日期") String entryDate,
-                                     @RequestParam @ApiParam(value = "员工照片") MultipartFile avatar) throws IOException {
+                                     @RequestParam(value = "avatar",required = false) @ApiParam(value = "员工照片") MultipartFile avatar) throws IOException {
         bizUserService.edit(id,empNo,account,name,orgId,departmentId,workLocationId,nickname,gender,homeAddress,detailAddress,idCardNumber,phone,emergencyPhone,entryDate,avatar);
         return CommonResult.ok();
     }

+ 6 - 4
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/service/impl/BizUserServiceImpl.java

@@ -257,13 +257,15 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
         bizUser.setPhone(phone);
         bizUser.setEmergencyPhone(emergencyPhone);
         bizUser.setEntryDate(entryDate);
+
         if (ObjectUtil.isNotEmpty(avatar)){
-            String avatarUrl = uploadImage.getImageCom(avatar);
-            if (avatarUrl.equals("上传失败")){
-                throw new CommonException("图片上传失败!");
+            String imageCom = uploadImage.getImageCom(avatar);
+            if ("上传失败".equals(imageCom)){
+                throw new CommonException("图片上传失败");
             }
-            bizUser.setAvatar(avatarUrl);
+            bizUser.setAvatar(imageCom);
         }
+
         this.updateById(bizUser);
 
         // 发布更新事件

+ 1 - 1
snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/user/controller/SysUserController.java

@@ -124,7 +124,7 @@ public class SysUserController {
                                      @RequestParam @ApiParam(value = "手机") String phone,
                                      @RequestParam @ApiParam(value = "紧急联系人电话") String emergencyPhone,
                                      @RequestParam @ApiParam(value = "入职日期") String entryDate,
-                                     @RequestParam @ApiParam(value = "员工照片") MultipartFile avatar) throws IOException {
+                                     @RequestParam(value = "avatar",required = false) @ApiParam(value = "员工照片") MultipartFile avatar) throws IOException {
         sysUserService.edit(id,empNo,account,name,orgId,departmentId,workLocationId,nickname,gender,homeAddress,detailAddress,idCardNumber,phone,emergencyPhone,entryDate,avatar);
         return CommonResult.ok();
     }

+ 361 - 10
snowy-web-app/src/main/java/vip/xiaonuo/Timer/ProEnvData.java

@@ -1,17 +1,37 @@
 package vip.xiaonuo.Timer;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import vip.xiaonuo.common.exception.CommonException;
 import vip.xiaonuo.common.timer.CommonTimerTaskRunner;
+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.param.BaseSeasonTypeParam;
+import vip.xiaonuo.modular.base.baseSeason.service.BaseSeasonService;
+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.mapper.EnvDataMapper;
 import vip.xiaonuo.modular.env.envdevice.entity.EnvDevice;
 import vip.xiaonuo.modular.env.envdevice.mapper.EnvDeviceMapper;
+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 java.math.BigDecimal;
+import java.text.ParseException;
 import java.util.Date;
 import java.util.List;
 
@@ -23,28 +43,359 @@ public class ProEnvData implements CommonTimerTaskRunner {
     private EnvDeviceMapper deviceMapper;
     @Autowired
     private EnvDataMapper dataMapper;
+    @Autowired
+    private BaseConfigMapper baseConfigMapper;
+    @Autowired
+    private WarningRemindMapper warningRemindMapper;
+    @Autowired
+    private BaseSeasonService baseSeasonService;
+    @Autowired
+    private EnvThresholdMapper envThresholdMapper;
+    @Autowired
+    private WarningManagerMapper warningManagerMapper;
+    @Autowired
+    private WarningInfoMapper warningInfoMapper;
+    @Autowired
+    private TaskInspectionMapper taskInspectionMapper;
+
     @Override
+    @Transactional
     public void action() {
         QueryWrapper<EnvDevice> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("org_id", "1543842934270394370").eq("delete_flag", "NOT_DELETE")
                 .eq("status", 1);
         List<EnvDevice> devices = deviceMapper.selectList(queryWrapper);
+
+        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()));
+
         for (EnvDevice device : devices) {
+            Date now = new Date();
+            Integer sea = 1 ;
             EnvData data = new EnvData();
-            data.setAskTime(new Date());
-            data.setUpdateTime(new Date());
+
+            String orgId = device.getOrgId();
+            String pigpenId = device.getInstallPosition();
+            data.setAskTime(now);
+            data.setUpdateTime(now);
             data.setChipCode(device.getId());
             data.setDeviceCode(device.getDeviceCode());
-            data.setPigpenId(device.getInstallPosition());
-            data.setOrgId(device.getOrgId());
+            data.setPigpenId(pigpenId);
+            data.setOrgId(orgId);
             data.setIsShow(0);
-            String tem = NumberUtils.getNumFloat(19.0, 21.0);
-            String hum = NumberUtils.getNumFloat(39.0, 41.0);
-            data.setTemHandleValue(new BigDecimal(tem));
-            data.setTemOriginalValue(new BigDecimal(tem));
-            data.setHumiHandleValue(new BigDecimal(hum));
-            data.setHumiOriginalValue(new BigDecimal(hum));
+            String tem1 = NumberUtils.getNumFloat(19.0, 21.0);
+            String hum1 = NumberUtils.getNumFloat(39.0, 41.0);
+            BigDecimal tem = new BigDecimal(tem1);
+            BigDecimal hum = new BigDecimal(hum1);
+            data.setTemHandleValue(tem);
+            data.setTemOriginalValue(tem);
+            data.setHumiHandleValue(hum);
+            data.setHumiOriginalValue(hum);
             dataMapper.insert(data);
+
+            WarningRemind warningRemind = warningRemindMapper.selectOne(new QueryWrapper<WarningRemind>().lambda()
+                    .eq(WarningRemind::getWarningTypeId, envWarning.getId())
+                    .eq(WarningRemind::getOrgId, orgId).eq(WarningRemind::getUnitId, pigpenId));
+
+            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 = new BaseSeason();
+            try{
+                season = baseSeasonService.getSeason(baseSeasonTypeParam);
+            } catch (ParseException e) {
+                throw new CommonException("定时任务获取当前季节失败!");
+            }
+
+
+            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 (envThreshold.getIsEnable() == 0){
+                    return;
+                }
+                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);
         }
     }
 }

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyElectricity/service/impl/EnergyElectricityServiceImpl.java

@@ -65,7 +65,7 @@ public class EnergyElectricityServiceImpl extends ServiceImpl<EnergyElectricityM
         BigDecimal thisTotal,lastTotal;
         BigDecimal qoq = BigDecimal.ZERO;
         String parentId = baseConfigMapper.selectOne(new QueryWrapper<BaseConfig>().eq("config_name", "栋舍阶段").eq("parent_id", 0)).getId();
-        List<BaseConfig> buildStage = baseConfigMapper.selectList(new QueryWrapper<BaseConfig>().eq("parent_id", parentId).orderByAsc("sort_code"));
+        List<BaseConfig> buildStage = baseConfigMapper.selectList(new QueryWrapper<BaseConfig>().eq("org_id",orgId).eq("parent_id", parentId).orderByAsc("sort_code"));
         List<String> stages = buildStage.stream().map(config -> config.getConfigName()).collect(Collectors.toList());
         List<EnergyElectricityRateVo> rateList = new ArrayList<>();
         if (type.equals("0")){

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/energy/energyWater/service/impl/EnergyWaterServiceImpl.java

@@ -62,7 +62,7 @@ public class EnergyWaterServiceImpl extends ServiceImpl<EnergyWaterMapper, Energ
         BigDecimal thisTotal,lastTotal;
         BigDecimal qoq = BigDecimal.ZERO;
         String parentId = baseConfigMapper.selectOne(new QueryWrapper<BaseConfig>().eq("config_name", "栋舍阶段").eq("parent_id", 0)).getId();
-        List<BaseConfig> buildStage = baseConfigMapper.selectList(new QueryWrapper<BaseConfig>().eq("parent_id", parentId).orderByAsc("sort_code"));
+        List<BaseConfig> buildStage = baseConfigMapper.selectList(new QueryWrapper<BaseConfig>().eq("parent_id", parentId).eq("org_id",orgId).orderByAsc("sort_code"));
         List<String> stages = buildStage.stream().map(config -> config.getConfigName()).collect(Collectors.toList());
         List<EnergyWaterRateVo> rateList = new ArrayList<>();
         if (type.equals("0")){

+ 1 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/env/envdata/entity/EnvData.java

@@ -38,7 +38,7 @@ public class EnvData implements TransPojo {
     /** ID */
     @TableId(value = "id", type = IdType.AUTO)
     @ApiModelProperty(value = "ID", position = 1)
-    private String id;
+    private Integer id;
 
     /** 芯片ID */
     @ApiModelProperty(value = "芯片ID", position = 2)