瀏覽代碼

东阳数据生成修改

wwh 1 年之前
父節點
當前提交
ff4bfee009

+ 1 - 1
huimv-admin/src/main/java/com/huimv/admin/service/impl/EnergyEnvDeviceServiceImpl.java

@@ -134,7 +134,7 @@ public class EnergyEnvDeviceServiceImpl extends ServiceImpl<EnergyEnvDeviceMappe
             jsonObject.put("OnDeviceRate", 0);
             jsonObject.put("OnDeviceRate", 0);
         } else {
         } else {
             QueryWrapper<EnergyEnvDevice> queryWrapper1 = new QueryWrapper<>();
             QueryWrapper<EnergyEnvDevice> queryWrapper1 = new QueryWrapper<>();
-            queryWrapper1.eq("device_status", 1);
+            queryWrapper1.eq("device_status", 1).eq("farm_id",farmId);
             Integer count1 = energyEnvDeviceMapper.selectCount(queryWrapper1);
             Integer count1 = energyEnvDeviceMapper.selectCount(queryWrapper1);
             Integer OffDeviceCount = count- count1;
             Integer OffDeviceCount = count- count1;
             //创建一个数值格式化对象
             //创建一个数值格式化对象

+ 1 - 1
huimv-admin/src/main/java/com/huimv/admin/service/impl/EnergyFeedServiceImpl.java

@@ -75,7 +75,7 @@ public class EnergyFeedServiceImpl extends ServiceImpl<EnergyFeedMapper, EnergyF
             } else {
             } else {
                 count = count + 0.00f;
                 count = count + 0.00f;
             }
             }
-            DecimalFormat df = new DecimalFormat("#.00");
+            DecimalFormat df = new DecimalFormat("0.00");
             jsonObject.put("value", df.format(count));
             jsonObject.put("value", df.format(count));
             jsonObject.put("buildName", basePigpen.getBuildName());
             jsonObject.put("buildName", basePigpen.getBuildName());
             jsonObject.put("id", basePigpen.getId());
             jsonObject.put("id", basePigpen.getId());

+ 13 - 3
huimv-admin/src/main/java/com/huimv/admin/service/impl/EnergyWarningInfoServiceImpl.java

@@ -3,6 +3,7 @@ package com.huimv.admin.service.impl;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.huimv.admin.common.utils.DataUill;
 import com.huimv.admin.common.utils.Result;
 import com.huimv.admin.common.utils.Result;
 import com.huimv.admin.common.utils.ResultCode;
 import com.huimv.admin.common.utils.ResultCode;
 import com.huimv.admin.entity.EnergyWarningInfo;
 import com.huimv.admin.entity.EnergyWarningInfo;
@@ -11,13 +12,15 @@ import com.huimv.admin.service.IEnergyWarningInfoService;
 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 javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
 /**
 /**
  * <p>
  * <p>
- *  服务实现类
+ * 服务实现类
  * </p>
  * </p>
  *
  *
  * @author author
  * @author author
@@ -36,7 +39,11 @@ public class EnergyWarningInfoServiceImpl extends ServiceImpl<EnergyWarningInfoM
         String pageSize = paramsMap.get("pageSize");
         String pageSize = paramsMap.get("pageSize");
         String pageNo = paramsMap.get("pageNo");
         String pageNo = paramsMap.get("pageNo");
         String userIds = paramsMap.get("userIds");
         String userIds = paramsMap.get("userIds");
+        String type = paramsMap.get("type");
 
 
+        if (type == null || type == "") {
+            type = "2";
+        }
         if (pageSize == null || pageSize == "") {
         if (pageSize == null || pageSize == "") {
             pageSize = "10";
             pageSize = "10";
         }
         }
@@ -44,11 +51,14 @@ public class EnergyWarningInfoServiceImpl extends ServiceImpl<EnergyWarningInfoM
             pageNo = "1";
             pageNo = "1";
         }
         }
 
 
+        Date timesmorning = DataUill.getTimesmorning();
         QueryWrapper<EnergyWarningInfo> queryWrapper = new QueryWrapper<>();
         QueryWrapper<EnergyWarningInfo> queryWrapper = new QueryWrapper<>();
         if ("1".equals(userIds)) {
         if ("1".equals(userIds)) {
-            queryWrapper.eq("farm_id", farmId).orderByDesc("date");
+            queryWrapper.eq("farm_id", farmId).orderByDesc("date")
+                    .eq("warning_type",type).ge("date",timesmorning);
         } else {
         } else {
-            queryWrapper.eq("farm_id", farmId).like("user_ids",userIds).orderByDesc("date");
+            queryWrapper.eq("farm_id", farmId).like("user_ids", userIds).orderByDesc("date")
+                    .eq("warning_type",type).ge("date",timesmorning);
         }
         }
         Page<EnergyWarningInfo> page = new Page<>(Integer.parseInt(pageNo), Integer.parseInt(pageSize));
         Page<EnergyWarningInfo> page = new Page<>(Integer.parseInt(pageNo), Integer.parseInt(pageSize));
         Page<EnergyWarningInfo> energyWarningInfoPage = energyWarningInfoMapper.selectPage(page, queryWrapper);
         Page<EnergyWarningInfo> energyWarningInfoPage = energyWarningInfoMapper.selectPage(page, queryWrapper);

+ 1 - 1
huimv-admin/src/main/java/com/huimv/admin/service/impl/EnvDeviceServiceImpl.java

@@ -78,7 +78,7 @@ public class EnvDeviceServiceImpl extends ServiceImpl<EnvDeviceMapper, EnvDevice
             jsonObject.put("OnDeviceRate", 0);
             jsonObject.put("OnDeviceRate", 0);
         } else {
         } else {
             QueryWrapper<EnvDevice> queryWrapper1 = new QueryWrapper<>();
             QueryWrapper<EnvDevice> queryWrapper1 = new QueryWrapper<>();
-            queryWrapper1.eq("device_status", 1);
+            queryWrapper1.eq("device_status", 1).eq("farm_id", farmId);
             Integer count1 = envDeviceMapper.selectCount(queryWrapper1);
             Integer count1 = envDeviceMapper.selectCount(queryWrapper1);
             Integer OffDeviceCount = count- count1;
             Integer OffDeviceCount = count- count1;
             //创建一个数值格式化对象
             //创建一个数值格式化对象

+ 33 - 12
huimv-admin/src/main/java/com/huimv/admin/timer/GasTimer.java

@@ -31,7 +31,7 @@ public class  GasTimer {
     private void getShenChan() throws Exception {
     private void getShenChan() throws Exception {
 
 
         String type = NumberUtils.getNum(1, 5, 0);//loc_type
         String type = NumberUtils.getNum(1, 5, 0);//loc_type
-        for (int i = 1; i < 5; i++) {
+        for (int i = 1; i < 9; i++) {
 
 
             String nh3n = NumberUtils.getNumFloat(0.0, 10.5);//NH3N
             String nh3n = NumberUtils.getNumFloat(0.0, 10.5);//NH3N
             String jlm = NumberUtils.getNumFloat(0.0, 10.5);//jlm
             String jlm = NumberUtils.getNumFloat(0.0, 10.5);//jlm
@@ -44,7 +44,6 @@ public class  GasTimer {
 
 
 
 
             GasData gasData = new GasData();
             GasData gasData = new GasData();
-            gasData.setLoctionType(i);
             gasData.setNh3N(nh3n);
             gasData.setNh3N(nh3n);
             gasData.setJlm(jlm);
             gasData.setJlm(jlm);
             gasData.setElht(elht);
             gasData.setElht(elht);
@@ -53,17 +52,26 @@ public class  GasTimer {
             gasData.setByx(byx);
             gasData.setByx(byx);
             gasData.setCh3sh(ch3);
             gasData.setCh3sh(ch3);
             gasData.setSja(sja);
             gasData.setSja(sja);
-            gasData.setFarmId(21);
+            if (i > 4) {
+                gasData.setLoctionType(i-4);
+                gasData.setFarmId(24);
+            } else {
+                gasData.setLoctionType(i);
+                gasData.setFarmId(21);
+            }
             gasData.setCreateTime(new Date());
             gasData.setCreateTime(new Date());
 
 
 
 
             QueryWrapper<GasThreshold> queryWrapper = new QueryWrapper<>();
             QueryWrapper<GasThreshold> queryWrapper = new QueryWrapper<>();
             GasWarningInfo warningInfo = new GasWarningInfo();
             GasWarningInfo warningInfo = new GasWarningInfo();
-            if (i==1) {
+            if (i==1||i==5) {
                 String cq = NumberUtils.getNumFloat(0.0, 1000.5);//cq
                 String cq = NumberUtils.getNumFloat(0.0, 1000.5);//cq
                 gasData.setCq(cq);
                 gasData.setCq(cq);
-
-                queryWrapper.eq("farm_id", 21).eq("gas_type", 1);
+                if (i == 1) {
+                    queryWrapper.eq("farm_id", 21).eq("gas_type", 1);
+                } else {
+                    queryWrapper.eq("farm_id", 24).eq("gas_type", 1);
+                }
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
                     warningInfo.setWarningContent("NH3N为"+nh3n + "超过阈值,系统预警提醒");
                     warningInfo.setWarningContent("NH3N为"+nh3n + "超过阈值,系统预警提醒");
@@ -147,11 +155,15 @@ public class  GasTimer {
                     warningInfoMapper.insert(warningInfo);
                     warningInfoMapper.insert(warningInfo);
                 }
                 }
 
 
-            } else if (i==2) {
+            } else if (i==2||i==6) {
                 String cq = NumberUtils.getNumFloat(0.0, 5000.5);//cq
                 String cq = NumberUtils.getNumFloat(0.0, 5000.5);//cq
                 gasData.setCq(cq);
                 gasData.setCq(cq);
 
 
-                queryWrapper.eq("farm_id", 21).eq("gas_type", 2);
+                if (i == 2) {
+                    queryWrapper.eq("farm_id", 21).eq("gas_type", 2);
+                } else {
+                    queryWrapper.eq("farm_id", 24).eq("gas_type", 2);
+                }
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
                     warningInfo.setWarningContent("NH3N为"+nh3n + "超过阈值,系统预警提醒");
                     warningInfo.setWarningContent("NH3N为"+nh3n + "超过阈值,系统预警提醒");
@@ -236,11 +248,16 @@ public class  GasTimer {
                     warningInfoMapper.insert(warningInfo);
                     warningInfoMapper.insert(warningInfo);
                 }
                 }
 
 
-            } else if (i==3) {
+            } else if (i==3||i==7) {
                 String cq = NumberUtils.getNumFloat(0.0, 1000.5);//cq
                 String cq = NumberUtils.getNumFloat(0.0, 1000.5);//cq
                 gasData.setCq(cq);
                 gasData.setCq(cq);
 
 
-                queryWrapper.eq("farm_id", 21).eq("gas_type", 3);
+                if (i == 3) {
+                    queryWrapper.eq("farm_id", 21).eq("gas_type", 3);
+                } else {
+                    queryWrapper.eq("farm_id", 24).eq("gas_type", 3);
+                }
+
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
                     warningInfo.setWarningContent("NH3N为"+nh3n + "超过阈值,系统预警提醒");
                     warningInfo.setWarningContent("NH3N为"+nh3n + "超过阈值,系统预警提醒");
@@ -325,11 +342,15 @@ public class  GasTimer {
                     warningInfoMapper.insert(warningInfo);
                     warningInfoMapper.insert(warningInfo);
                 }
                 }
 
 
-            } else if (i==4) {
+            } else if (i==4||i==8) {
                 String cq = NumberUtils.getNumFloat(0.0, 10000.5);//cq
                 String cq = NumberUtils.getNumFloat(0.0, 10000.5);//cq
                 gasData.setCq(cq);
                 gasData.setCq(cq);
 
 
-                queryWrapper.eq("farm_id", 21).eq("gas_type", 4);
+                if (i == 4) {
+                    queryWrapper.eq("farm_id", 21).eq("gas_type", 4);
+                } else {
+                    queryWrapper.eq("farm_id", 24).eq("gas_type", 4);
+                }
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
                     warningInfo.setWarningContent("NH3N为"+nh3n + "超过阈值,系统预警提醒");
                     warningInfo.setWarningContent("NH3N为"+nh3n + "超过阈值,系统预警提醒");

+ 25 - 9
huimv-admin/src/main/java/com/huimv/admin/timer/ProtTimer.java

@@ -31,18 +31,23 @@ public class ProtTimer {
     private void getShenChan() throws Exception {
     private void getShenChan() throws Exception {
 
 
 
 
-        for (int i = 1; i < 4; i++) {
+        for (int i = 1; i < 7; i++) {
             //假设已经拿到了数据
             //假设已经拿到了数据
             String num = NumberUtils.getNumFloat(6.4, 8.6);//ph
             String num = NumberUtils.getNumFloat(6.4, 8.6);//ph
 
 
             ProtData protData = new ProtData();
             ProtData protData = new ProtData();
             protData.setLoctionType(i);
             protData.setLoctionType(i);
             protData.setCreateDate(new Date());
             protData.setCreateDate(new Date());
-            protData.setFarmId(21);
+            if (i < 4) {
+                protData.setFarmId(21);
+            } else {
+                protData.setFarmId(24);
+            }
+
             protData.setPh(num);
             protData.setPh(num);
 
 
             QueryWrapper<ProtThreshold> queryWrapper = new QueryWrapper<>();
             QueryWrapper<ProtThreshold> queryWrapper = new QueryWrapper<>();
-            if (i == 1) {
+            if (i == 1||i==4) {
                 String num1 = NumberUtils.getNum(8000, 20001,0);//cod
                 String num1 = NumberUtils.getNum(8000, 20001,0);//cod
                 String num2 = NumberUtils.getNumFloat(1000.0, 1501.0);//nh3n
                 String num2 = NumberUtils.getNumFloat(1000.0, 1501.0);//nh3n
                 String num3 = NumberUtils.getNumFloat(100.0, 260.0);//tp
                 String num3 = NumberUtils.getNumFloat(100.0, 260.0);//tp
@@ -56,7 +61,11 @@ public class ProtTimer {
                 protData.setFlow(num5);
                 protData.setFlow(num5);
                 protDataMapper.insert(protData);
                 protDataMapper.insert(protData);
 
 
-                queryWrapper.eq("farm_id", 21).eq("prot_type", 1);
+                if (i==1) {
+                    queryWrapper.eq("farm_id", 21).eq("prot_type", 1);
+                } else {
+                    queryWrapper.eq("farm_id", 24).eq("prot_type", 1);
+                }
                 ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//进污口
                 ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//进污口
                 if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther3())) {
                 if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther3())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
@@ -192,7 +201,7 @@ public class ProtTimer {
                 }
                 }
 
 
             }
             }
-            if (i == 2) {
+            if (i == 2||i==5) {
                 String num1 = NumberUtils.getNum(0, 310,0);//cod
                 String num1 = NumberUtils.getNum(0, 310,0);//cod
                 String num2 = NumberUtils.getNumFloat(0.0, 31.0);//nh3n
                 String num2 = NumberUtils.getNumFloat(0.0, 31.0);//nh3n
                 String num3 = NumberUtils.getNumFloat(0.0, 3.6);//tp
                 String num3 = NumberUtils.getNumFloat(0.0, 3.6);//tp
@@ -206,7 +215,11 @@ public class ProtTimer {
                 protData.setFlow(num5);
                 protData.setFlow(num5);
                 protDataMapper.insert(protData);
                 protDataMapper.insert(protData);
 
 
-                queryWrapper.eq("farm_id", 21).eq("prot_type", 2);
+                if (i==2) {
+                    queryWrapper.eq("farm_id", 21).eq("prot_type", 2);
+                } else {
+                    queryWrapper.eq("farm_id", 24).eq("prot_type", 2);
+                }
                 ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//污口
                 ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//污口
                 if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther3())) {
                 if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther3())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
@@ -342,7 +355,7 @@ public class ProtTimer {
                 }
                 }
 
 
             }
             }
-            if (i == 3) {
+            if (i == 3||i==6) {
                 //排污口专用数据
                 //排污口专用数据
                 String ph = NumberUtils.getNumFloat(6.6, 8.4);//ph
                 String ph = NumberUtils.getNumFloat(6.6, 8.4);//ph
                 String cod = NumberUtils.getNum(0, 380, 0);//cod
                 String cod = NumberUtils.getNum(0, 380, 0);//cod
@@ -360,8 +373,11 @@ public class ProtTimer {
 
 
                 protDataMapper.insert(protData);
                 protDataMapper.insert(protData);
 
 
-
-                queryWrapper.eq("farm_id", 21).eq("prot_type", 3);
+                if (i==3) {
+                    queryWrapper.eq("farm_id", 21).eq("prot_type", 3);
+                } else {
+                    queryWrapper.eq("farm_id", 24).eq("prot_type", 3);
+                }
                 ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//进污口
                 ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//进污口
                 if (Double.parseDouble(ph) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(ph) < Double.parseDouble(protThreshold.getOther3())) {
                 if (Double.parseDouble(ph) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(ph) < Double.parseDouble(protThreshold.getOther3())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();

+ 31 - 0
huimv-admin/src/main/java/com/huimv/admin/timer/ShenChanTimer.java

@@ -99,6 +99,37 @@ public class ShenChanTimer {
 
 
             }
             }
         }
         }
+        for (List stock : stockData) {
+            if ("正康".equals(stock.get(0))){
+                if (ObjectUtil.isNotEmpty(prodStock)){
+                    prodStock.setZzcl(Integer.parseInt(stock.get(11).toString()));
+                    prodStock.setByzcl(Integer.parseInt(stock.get(13).toString()));
+                    prodStock.setYfzcl(Integer.parseInt(stock.get(14).toString()));
+                    prodStock.setZcl(Integer.parseInt(stock.get(15).toString()));
+                    prodStock.setCreatTime(new Date());
+                    prodStock.setFarmId(24);
+                    prodStockService.updateById(prodStock);
+                }else {
+                    prodStock = new ProdStock();
+                    prodStock.setZzcl(Integer.parseInt(stock.get(11).toString()));
+                    prodStock.setByzcl(Integer.parseInt(stock.get(13).toString()));
+                    prodStock.setYfzcl(Integer.parseInt(stock.get(14).toString()));
+                    prodStock.setZcl(Integer.parseInt(stock.get(15).toString()));
+                    prodStock.setMzcl(100);
+                    prodStock.setGzcl(200);
+                    prodStock.setBrzcl(452);
+                    prodStock.setHbzcl(100);
+                    prodStock.setRszcl(30);
+                    prodStock.setBrmzcl(20);
+                    prodStock.setKhzcl(212);
+                    prodStock.setSpzcl(1020);
+                    prodStock.setCreatTime(new Date());
+                    prodStock.setFarmId(24);
+                    prodStockService.save(prodStock);
+                }
+
+            }
+        }
 
 
     }
     }