523096025 преди 1 година
родител
ревизия
01b05a1071

+ 0 - 19
huimv-admin/src/main/java/com/huimv/guowei/admin/timer/NewEnvTimer.java

@@ -1,18 +1,12 @@
 package com.huimv.guowei.admin.timer;
 
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.http.Header;
-import cn.hutool.http.HttpRequest;
 import cn.hutool.http.HttpUtil;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.huimv.guowei.admin.common.utils.NumberUtils;
 import com.huimv.guowei.admin.entity.EnvData;
 import com.huimv.guowei.admin.entity.EnvDevice;
-import com.huimv.guowei.admin.entity.EnvWarningInfo;
-import com.huimv.guowei.admin.entity.EnvWarningThreshold;
 import com.huimv.guowei.admin.service.IEnvDataService;
 import com.huimv.guowei.admin.service.IEnvDeviceService;
 import com.huimv.guowei.admin.service.IEnvWarningInfoService;
@@ -20,17 +14,9 @@ import com.huimv.guowei.admin.service.IEnvWarningThresholdService;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.util.MultiValueMap;
-import org.springframework.web.client.RestTemplate;
 
-import java.math.BigDecimal;
 import java.text.DecimalFormat;
 import java.text.ParseException;
 import java.util.*;
@@ -46,11 +32,6 @@ public class NewEnvTimer {
     @Autowired
     private IEnvDataService envDataService;
 
-    @Autowired
-    private IEnvWarningThresholdService envWarningThresholdService;
-
-    @Autowired
-    private IEnvWarningInfoService envWarningInfoService;
 
 
 

+ 10 - 5
input/src/main/java/com/huimv/input/server/EnvInputServerHandler.java

@@ -375,8 +375,8 @@ public class EnvInputServerHandler extends ChannelInboundHandlerAdapter   {
         BigDecimal minWeight = new BigDecimal(99999);
         //检蛋
         if(currentTime.isAfter(jianStartTime) && currentTime.isBefore(jianEndTime)){
-            List<EnvRegularCallEgg> call_date = envRegularCallEggMapper.selectList(new QueryWrapper<EnvRegularCallEgg>().ge("call_date", DateUtil.beginOfDay(new Date())));
-            if (ObjectUtil.isEmpty(call_date)){
+            List<EnvRegularCallEgg> call_date = envRegularCallEggMapper.selectList(new QueryWrapper<EnvRegularCallEgg>().eq("call_code",decId).ge("call_date", DateUtil.beginOfDay(new Date())));
+            if (ObjectUtil.isNotEmpty(call_date)){
                 return;
             }
 
@@ -391,6 +391,11 @@ public class EnvInputServerHandler extends ChannelInboundHandlerAdapter   {
                 BigDecimal subtract = weight.subtract(lastWeight);
                 int i1 = subtract.intValue();
                 if(i1>500) {
+
+                    List<EnvRegularCallEgg> callEgg = envRegularCallEggMapper.selectList(new QueryWrapper<EnvRegularCallEgg>().eq("call_code",decId).ge("call_date", DateUtil.beginOfDay(new Date())));
+                    if (ObjectUtil.isNotEmpty(callEgg)  && callEgg.size() >1){
+                        continue;
+                    }
                     EnvRegularCallEgg envRegularCallEgg = new EnvRegularCallEgg();
                     envRegularCallEgg.setBattery(bat);
                     envRegularCallEgg.setCallDate(new Date());
@@ -404,9 +409,9 @@ public class EnvInputServerHandler extends ChannelInboundHandlerAdapter   {
                     envRegularCallEgg.setChiNum(baseDuckInfo.getChiNum());
                     envRegularCallEgg.setJiaoNum(baseDuckInfo.getJiaoNum());
                     envRegularCallEgg.setBatchNum(baseDuckInfo.getBatchNum());
-                    if (  i1 <700) {
+                    if (  i1 <1000) {
                         envRegularCallEgg.setEggNum(1);
-                    } else if (i1 >1100 && i1 <1400 ) {
+                    } else if (i1 >1400 && i1 <2000 ) {
                         envRegularCallEgg.setEggNum(2);
                      }else {
                         continue;
@@ -428,7 +433,7 @@ public class EnvInputServerHandler extends ChannelInboundHandlerAdapter   {
                 if(weight.compareTo(minWeight) <0){
                     minWeight = weight;
                 }
-//                lastWeight = weight;
+                lastWeight = weight;
             }
 
 //            //吃料