523096025 2 miesięcy temu
rodzic
commit
e4b73d160e

+ 1 - 5
huimv-env-admin/pom.xml

@@ -25,11 +25,7 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-            <optional>true</optional>
-        </dependency>
+
         <dependency>
             <groupId>mysql</groupId>
             <artifactId>mysql-connector-java</artifactId>

+ 3 - 4
huimv-env-admin/src/main/java/com/huimv/env/admin/controller/BasePigpenController.java

@@ -47,10 +47,9 @@ public class BasePigpenController {
         String stageCode = map.get("stageCode");
         BasePigpen parent = basePigpenService.getById(parentId);
         String parentIds = parent.getOther2() + "," + parentId;
-        int maxBuildNum = 0;
-        if (ObjectUtil.isNotEmpty(basePigpenMapper.getMaxBuildNum(parentId))) {
-            maxBuildNum = basePigpenMapper.getMaxBuildNum(parentId);
-        }
+
+         int   maxBuildNum = basePigpenMapper.getMaxBuildNum(parentId);
+
         List<BasePigpen> basePigpenList = new ArrayList<>();
         for (int i = 1; i <= buildNum; i++) {
             int num = maxBuildNum+i;

+ 12 - 20
huimv-env-admin/src/main/resources/application-prod.yml

@@ -6,33 +6,25 @@ spring:
     name: huimv-env-admin
 
   datasource:
-    url: jdbc:mysql://121.36.134.218/huimv-env-hylintech?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
-    username: hylintech
-    password: hm123456
+    url: jdbc:mysql://139.9.172.209:3309/huimv-env-hylintech?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    username: eartag
+    password: eartag@2022
     driver-class-name: com.mysql.cj.jdbc.Driver
-  jpa:
-    show-sql: true
-    database: mysql
-    hibernate:
-      ddl-auto: update
-    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
-    open-in-view: true
+#  jpa:
+#    show-sql: true
+#    database: mysql
+#    hibernate:
+#      ddl-auto: update
+#    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+#    open-in-view: true
 
-  #配置rabbitMq 服务器
-  #  rabbitmq:
-  #    host: 10.0.0.4
-  #    port: 5672
-  #    username: huimv
-  #    password: hm123456
-  #    #虚拟host 可以不设置,使用server默认host
-  #    virtual-host: /
   rabbitmq:
-    host: 121.36.134.218
+    host: 139.9.172.209
     port: 5672
     username: admin
     password: admin
     #虚拟host 可以不设置,使用server默认host
-    virtual-host: /env
+    virtual-host: /
 
     #确认消息已发送到交换机(Exchange)
     #    publisher-confirms: true #(过时、弃用)

+ 8 - 16
huimv-env-common/pom.xml

@@ -19,7 +19,7 @@
         <java.version>1.8</java.version>
         <maven.compile>1.8</maven.compile>
         <druid.version>1.1.14</druid.version>
-        <mysql.version>6.0.6</mysql.version>
+        <mysql.version>8.0.32</mysql.version>
         <junit.version>4.13.2</junit.version>
         <hutool.version>5.8.1</hutool.version>
         <velocity.version>2.0</velocity.version>
@@ -33,6 +33,7 @@
         <mybatisPlus.version>3.4.2</mybatisPlus.version>
         <huimvCommon.version>0.0.6-SNAPSHOT</huimvCommon.version>
         <huimvEnvCommon.version>0.0.1-SNAPSHOT</huimvEnvCommon.version>
+
         <junitPlatformCommons.version>1.8.2</junitPlatformCommons.version>
         <mybatisPlusGenerator.version>3.2.0</mybatisPlusGenerator.version>
         <mybatisPlusExtension.version>3.4.2</mybatisPlusExtension.version>
@@ -181,11 +182,11 @@
                 <version>${huimvCommon.version}</version>
             </dependency>
             <!-- 一方包统一版本管理 -->
-            <dependency>
-                <groupId>com.huimv</groupId>
-                <artifactId>huimv-env-common</artifactId>
-                <version>${huimvEnvCommon.version}</version>
-            </dependency>
+<!--            <dependency>-->
+<!--                <groupId>com.huimv</groupId>-->
+<!--                <artifactId>huimv-env-common</artifactId>-->
+<!--                <version>${huimvEnvCommon.version}</version>-->
+<!--            </dependency>-->
 
             <!--sftp文件上传-->
             <dependency>
@@ -193,10 +194,7 @@
                 <artifactId>jsch</artifactId>
                 <version>0.1.54</version>
             </dependency>
-            <dependency>
-                <groupId>junit</groupId>
-                <artifactId>junit</artifactId>
-            </dependency>
+
 
             <dependency>
                 <groupId>org.jxls</groupId>
@@ -242,12 +240,6 @@
                 <version>3.15</version>
             </dependency>
 
-            <dependency>
-                <groupId>org.projectlombok</groupId>
-                <artifactId>lombok</artifactId>
-                <version>1.18.12</version>
-                <scope>provided</scope>
-            </dependency>
 
 
             <dependency>

+ 3 - 0
huimv-env-common/src/main/java/com/huimv/env/common/entity/PigUnit.java

@@ -1,5 +1,7 @@
 package com.huimv.env.common.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -26,6 +28,7 @@ public class PigUnit implements Serializable {
     /**
      * 单元id
      */
+    @TableId(value = "unit_id", type = IdType.AUTO)
     private Integer unitId;
 
     /**

+ 1 - 0
huimv-env-common/src/main/java/com/huimv/env/common/service/impl/AuthorizeServiceImpl.java

@@ -46,6 +46,7 @@ public class AuthorizeServiceImpl implements IAuthorizeService {
          * Step1:先删除原先的账号关联权限组数据;
          * Step2:再添加新的账号关联权限组数据;
          */
+
         if (accountId == null||"".equals(accountId)){
 
             accountGroupMapper.removeAccountGroup(groupIds);

+ 1 - 4
huimv-env-common/src/main/java/com/huimv/env/common/service/impl/EnergyEnvDeviceServiceImpl.java

@@ -14,7 +14,6 @@ import com.huimv.env.common.entity.EnergyEnvDevice;
 import com.huimv.env.common.entity.EnergyWater;
 import com.huimv.env.common.entity.vo.*;
 import com.huimv.env.common.mapper.*;
-import com.huimv.env.common.service.IEnergyElectricityService;
 import com.huimv.env.common.service.IEnergyEnvDeviceService;
 import com.huimv.env.common.utils.ExcelImportSheet;
 import com.huimv.env.common.utils.Print;
@@ -22,7 +21,6 @@ import com.huimv.env.common.utils.Result;
 import com.huimv.env.common.utils.ResultCode;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
-import org.hibernate.engine.jdbc.batch.spi.Batch;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -49,8 +47,7 @@ public class EnergyEnvDeviceServiceImpl extends ServiceImpl<EnergyEnvDeviceMappe
     private EnergyEnvDeviceMapper energyEnvDeviceMapper;
     @Autowired
     private BaseFarmMapper farmMapper;
-    @Autowired
-    private BasePigpenMapper basePigpenMapper;
+
     @Autowired
     private IEnergyEnvDeviceService envDeviceService;
     @Autowired

+ 3 - 3
huimv-env-common/src/main/java/com/huimv/env/common/service/impl/EnvDeviceServiceImpl.java

@@ -6,8 +6,8 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.huimv.common.utils.DataUill;
 
+import com.huimv.common.utils.DataUill;
 import com.huimv.env.common.entity.BasePigpen;
 import com.huimv.env.common.entity.EnvData;
 import com.huimv.env.common.entity.EnvDevice;
@@ -398,8 +398,8 @@ public class EnvDeviceServiceImpl extends ServiceImpl<EnvDeviceMapper, EnvDevice
         QueryWrapper<EnvWarningInfo> warningInfoQueryWrapper = new QueryWrapper<>();
         warningInfoQueryWrapper.eq("farm_id", farmId);
         Integer warnCount = warningInfoMapper.selectCount(warningInfoQueryWrapper);//全年报警数量
-        Date timesmorning = DataUill.getTimesmorning();
-        warningInfoQueryWrapper.ge("date", timesmorning);
+//        Date timesmorning = DataUill.getTimesmorning();
+//        warningInfoQueryWrapper.ge("date", timesmorning);
         Integer warningCountToday = warningInfoMapper.selectCount(warningInfoQueryWrapper);//今日报警数量
         //得到监测保障天数
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

+ 0 - 7
huimv-env-common/src/main/java/com/huimv/env/common/utils/Const.java

@@ -9,15 +9,8 @@ package com.huimv.env.common.utils;
  * @Create : 2020-12-25
  **/
 public class Const {
-
-
-
     //水表
     public final static String QUEUE_ENV_SHUI_HUIMV_DATA = "topic.env.shui.huimv.data.queue";
     public final static String ROUTING_KEY_ENV_SHUI_HUIMV_DATA = "topic.env.shui.huimv.data.key";
     public final static String EXCHANGE_ENV_SHUI_HUIMV_DATA = "topic.env.shui.huimv.data.exchange";
-
-
-
-
 }

+ 9 - 0
huimv-env-common/src/main/java/resources/com/huimv/env/common/mapper/AccountGroupMapper.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.huimv.env.common.mapper.AccountGroupMapper">
+
+
+    <delete id="removeAccountGroup">
+        DELETE FROM sys_account_group WHERE account_id=#{accountId}
+    </delete>
+</mapper>

+ 4 - 4
huimv-env-device/src/main/resources/application-prod.yml

@@ -6,9 +6,9 @@ spring:
     name: huimv-env-device
 
   datasource:
-    url: jdbc:mysql://121.36.134.218/huimv-env-hylintech?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
-    username: hylintech
-    password: hm123456
+    url: jdbc:mysql://139.9.172.209:3309/huimv-env-hylintech?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    username: eartag
+    password: eartag@2022
     driver-class-name: com.mysql.cj.jdbc.Driver
   jpa:
     show-sql: true
@@ -32,7 +32,7 @@ spring:
     username: admin
     password: admin
     #虚拟host 可以不设置,使用server默认host
-    virtual-host: /env
+    virtual-host: /
     listener:
       simple:
         acknowledge-mode: none  #消费端不需要确认

+ 1 - 0
huimv-env-input/src/main/java/com/huimv/env/input/producer/Producer.java

@@ -27,6 +27,7 @@ public class Producer {
     public String sendShuiBiaoData(String askText) {
         Map map = new HashMap();
         map.put("askText",askText);
+        System.out.println(map);
         rabbitTemplate.convertAndSend(Const.EXCHANGE_ENV_SHUI_HUIMV_DATA, Const.ROUTING_KEY_ENV_SHUI_HUIMV_DATA, map);
         return "ok";
     }

+ 135 - 247
huimv-env-input/src/main/java/com/huimv/env/input/server/EnvInputServerHandler.java

@@ -4,8 +4,9 @@ import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.http.HttpRequest;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-//import com.huimv.env.common.service.IRawDataService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.huimv.env.common.entity.JinghongWater;
+import com.huimv.env.common.service.IJinghongWaterService;
 import com.huimv.env.common.utils.RegexUtil;
 import com.huimv.env.input.producer.Producer;
 //import com.huimv.env.input.service.ICommandProcessorService;
@@ -26,7 +27,9 @@ import org.springframework.stereotype.Component;
 import org.springframework.web.client.RestTemplate;
 
 import java.io.IOException;
+import java.nio.charset.Charset;
 import java.text.ParseException;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.regex.Matcher;
@@ -102,22 +105,65 @@ public class EnvInputServerHandler extends ChannelInboundHandlerAdapter {
      * @Date : 2022/3/28
      * @Time : 17:36
      */
+    @Autowired
+    private IJinghongWaterService jinghongWaterService;
+
     private void handleClientAskCmd(String clientAskText, ChannelHandlerContext ctx) throws ParseException, IOException {
 
-        askTextSb.delete(0, askTextSb.length());
-
-        System.out.println("接收到消息"+clientAskText);
-        if (clientAskText.length() > 10) {
-            HashMap<String, String> paramsMap = new HashMap<>();
-            JSONObject jsonObject = new JSONObject();
-            jsonObject.put("result", clientAskText);
-            System.out.println(jsonObject);
-            paramsMap.put("Content-Type", "application/json;charset=utf-8");
-            String post = HttpRequest.post("https://huatong.ifarmcloud.com/huatongApi/env-nh3-n/send")
-                    .headerMap(paramsMap, false).body(jsonObject.toJSONString()).timeout(30 * 1000).execute().body();
-            System.out.println(post);
+        System.out.println("接收到消息: " + clientAskText + "  时间: " + System.currentTimeMillis());
+
+            // 假设clientAskText是一个十六进制编码的字符串,需要转换为ByteBuf
+        if (clientAskText.length() == 15){
+            JinghongWater jinghongWater = new JinghongWater();
+            jinghongWater.setCreateTime(new Date());
+            jinghongWater.setDeviceId(clientAskText);
+            jinghongWater.setDeviceName(getDevice(clientAskText));
+            jinghongWaterService.save(jinghongWater);
+            ByteBuf bufff = Unpooled.buffer();
+            if ("861213058846640".equals(clientAskText)){
+                bufff.writeBytes(hexString2Bytes("01030004000285CA"));
+                ctx.writeAndFlush(bufff);
+            }else {
+                bufff.writeBytes(hexString2Bytes("010410180002F50C"));
+                ctx.writeAndFlush(bufff);
+            }
+
+        }else {
+            JinghongWater id = jinghongWaterService.getOne(new QueryWrapper<JinghongWater>().orderByDesc("id").last("limit 1"));
+
+            // 获取GBK字符集
+            Charset gbkCharset = Charset.forName("GBK");
+            // 将字符串转换为GBK编码的字节数组
+            byte[] gbkBytes = (clientAskText).getBytes(gbkCharset);
+            System.out.println("22222"  );
+            // 打印GBK编码的字节数组(以十六进制格式展示)
+            String raw = bytesToHex(gbkBytes);
+            System.out.println("GBK编码的字节数组(十六进制): " + raw);
+            id.setRaw(raw);
+            //0104040000243f213c
+            if(raw.startsWith("010304")){
+                id.setValueA(getFloat(raw.substring(6, 14)));
+            }else {
+                int i = Integer.parseInt(raw.substring(6, 14), 16);
+                id.setValueA(i+"");
+            }
+            jinghongWaterService.updateById(id);
+            ctx.writeAndFlush("");
         }
-        ctx.writeAndFlush(Unpooled.copiedBuffer("rok".getBytes()));
+
+//        askTextSb.delete(0, askTextSb.length());
+        //        if (clientAskText.length() > 10) {
+//            HashMap<String, String> paramsMap = new HashMap<>();
+//            JSONObject jsonObject = new JSONObject();
+//            jsonObject.put("result", clientAskText);
+//            System.out.println(jsonObject);
+//            paramsMap.put("Content-Type", "application/json;charset=utf-8");
+//            String post = HttpRequest.post("https://huatong.ifarmcloud.com/huatongApi/env-nh3-n/send")
+//                    .headerMap(paramsMap, false).body(jsonObject.toJSONString()).timeout(30 * 1000).execute().body();
+//            System.out.println(post);
+//        }
+
+
 
 //        clientAskText = clientAskText.replaceAll("\r", "").replaceAll("\n", "");
 ////        {处理非正常命令}
@@ -136,6 +182,79 @@ public class EnvInputServerHandler extends ChannelInboundHandlerAdapter {
 //        }
     }
 
+    private   String  getFloat(String hexString ) {
+
+
+        byte[] bytes = new byte[4];
+        for (int i = 0; i < 4; i++) {
+            // 每两个字符表示一个字节
+            String byteString = hexString.substring(i * 2, (i + 1) * 2);
+            // 将16进制字符串转换为整数,并强制转换为byte
+            bytes[i] = (byte) Integer.parseInt(byteString, 16);
+        }
+
+        // 使用ByteBuffer(或者你可以直接操作字节数组)
+        // 但由于我们只需要一个int来表示float,所以这里直接组合字节为int
+        int intValue = ((bytes[0] & 0xFF) << 24) |
+                ((bytes[1] & 0xFF) << 16) |
+                ((bytes[2] & 0xFF) << 8)  |
+                (bytes[3] & 0xFF);
+
+        // 将int值转换为float值
+        float floatValue = Float.intBitsToFloat(intValue);
+        return floatValue+"";
+        // 输出结果
+    }
+
+    public String getDevice(String deviceId){
+        switch (deviceId){
+            case "861213058846764":
+                return "庙贝";
+            case "861213058872158":
+                return "芙江";
+            case "861213058861409":
+                return "污水电磁流量计";
+            case "861213058829596":
+                return "凤行";
+            case "861213058846640":
+                return "凤行2";
+        }
+        return null;
+    }
+
+    private static String bytesToHex(byte[] bytes) {
+        StringBuilder sb = new StringBuilder();
+        for (byte b : bytes) {
+            sb.append(String.format("%02x", b));
+        }
+        return sb.toString();
+    }
+    public static String bytes2HexString(byte[] b) {
+        String r = "";
+        for (int i = 0; i < b.length; i++) {
+            String hex = Integer.toHexString(b[i] & 0xFF);
+            if (hex.length() == 1) {
+                hex = '0' + hex;
+            }
+            r += hex.toUpperCase() + " ";
+        }
+        return r;
+    }
+    public static byte[] hexString2Bytes(String src) {
+
+        int l = src.length() / 2;
+
+        byte[] ret = new byte[l];
+
+        for (int i = 0; i < l; i++) {
+
+            ret[i] = (byte) Integer.valueOf(src.substring(i * 2, i * 2 + 2), 16).byteValue();
+
+        }
+
+        return ret;
+
+    }
     /**
      * @Method : askCmdActuator
      * @Description :
@@ -403,238 +522,7 @@ public class EnvInputServerHandler extends ChannelInboundHandlerAdapter {
 //        }
 //        //TODO
 //        String answerText = "hm+23+0+8+end";
-//        log.info(">>CO2 等级上传请求-应答数据>>" + answerText);
-//        answerCmd(answerText, ctx);
-//        //发送湿度请求到消息队列
-//        producer.sendCo2(askText);
-//    }
-//
-//    private void uploadGainDayAgePeizhiuStatus(String[] dataArray,String askText, String idCode, ChannelHandlerContext ctx) {
-//        try {
-//            String originalValue =cmdProService.getDayAgePeiZhi(dataArray,idCode);
-//            String answerText ="hm+91+1+"+originalValue+"+0+end";
-//            if (StringUtils.isNotBlank(originalValue)){
-//                answerText = "hm+91+0+"+originalValue+"+0+end";
-//                log.info(">>获取日龄配置上传请求-应答数据>>" + answerText);
-//            }else {
-//                log.info("该设备没有设置日龄配置>>" );
-//            }
-//            answerCmd(answerText, ctx);
-//        }catch (Exception e){
-//            System.out.println(e);
-//        }
-//    }
-//
-//    private void uploadGainTongFengPeizhiuStatus(String[] dataArray,String askText, String idCode, ChannelHandlerContext ctx) {
-//        try {
-//            String originalValue = cmdProService.getFengPeiZhi(dataArray);
-//            String answerText ="hm+92+1"+originalValue+"+0+end";
-//            if (StringUtils.isNotBlank(originalValue)) {
-//                answerText = "hm+92+0+" + originalValue + "+0+end";
-//                log.info(">>获取通风等级配置上传请求-应答数据>>" + answerText);
-//            } else {
-//                log.info("该设备没有设置获取通风等级配置>>");
-//            }
-//            answerCmd(answerText, ctx);
-//        }catch (Exception e){
-//            System.out.println(e);
-//        }
-//    }
-//
-//
-//    //风机配置
-//    private void uploadTongFengPeizhiuStatus(String askText, String idCode, ChannelHandlerContext ctx) {
-//        String answerText = "hm+82+0+2+end";
-//        answerCmd(answerText, ctx);
-//        if (!cmdProService.isEffectiveDevice(idCode)) {
-//            System.out.println("##通风配置上传请求-未注册设备 idCode=" + idCode);
-//            return;
-//        }
-//        log.info(">>通风配置上传请求-应答数据>>" + answerText);
-//        producer.sendTongFengPeiZhi(askText);
-//    }
-//    //日龄温度配置上传
-//    private void uploadDayAgePeizhiuStatus(String askText, String idCode, ChannelHandlerContext ctx) {
-//        String answerText = "hm+81+0+2+end";
-//        answerCmd(answerText, ctx);
-//        if (!cmdProService.isEffectiveDevice(idCode)) {
-//            System.out.println("##日龄温度上传请求-未注册设备 idCode=" + idCode);
-//            return;
-//        }
-//        log.info(">>日龄温度上传请求-应答数据>>" + answerText);
-//        producer.sendDayAgePeiZhi(askText);
-//    }
-//
-//    //喷雾
-//    private void uploadPengWuStatus(String askText, String idCode, ChannelHandlerContext ctx) {
-//        if (!cmdProService.isEffectiveDevice(idCode)) {
-//            System.out.println("##喷雾状态上传请求-未注册设备 idCode=" + idCode);
-//            return;
-//        }
-//        String answerText = "hm+63+0+2+end";
-//        log.info(">>喷雾状态上传请求-应答数据>>" + answerText);
-//        answerCmd(answerText, ctx);
-//        producer.sendPengWuStatus(askText);
-//    }
-//
-//    //湿帘
-//    private void uploadShiLianStatus(String askText, String idCode, ChannelHandlerContext ctx) {
-//        if (!cmdProService.isEffectiveDevice(idCode)) {
-//            System.out.println("##湿帘状态上传请求-未注册设备 idCode=" + idCode);
-//            return;
-//        }
-//        String answerText = "hm+62+0+2+end";
-//        log.info(">>湿帘状态上传请求-应答数据>>" + answerText);
-//        answerCmd(answerText, ctx);
-//        //湿帘状态请求到消息队列
-//        producer.sendShiLianStatus(askText);
-//    }
-//
-//    //获取远程设备编码
-//    private void getDeviceCode(String askText, String idCode, ChannelHandlerContext ctx) {
-//        System.out.println("==>获取远程设备编码请求:" + askText.trim());
-//        //{读取设备编码}
-//        String deviceCode = cmdProService.getDeviceCodeByChipId(idCode);
-//        log.info("获取远程设备编码请求,芯片id>>" + idCode + " ,deviceCode>>" + deviceCode);
-//        if (deviceCode == null) {
-//            log.error("该设备未注册,已舍弃请求.");
-//            return;
-//        }
-//        String answerText = "hm+1+0+" + deviceCode + "+0+end";
-//        log.info("<<获取远程设备编码请求-应答数据:" + answerText);
-////        //{应答指令}
-//        answerCmd(answerText, ctx);
-//        cmdProService.updateStatus(idCode);
-//    }
-//    //时间同步请求
-//    private void getServerTime(String askText, String deviceCode, ChannelHandlerContext ctx) throws ParseException {
-//        System.out.println("==>时间同步请求:" + askText);
-//        String answerText = "hm+2+" + dateUtil.getNowText() + "+4+end";
-//        log.info(">>时间同步请求-应答数据>>" + answerText);
-//        answerCmd(answerText, ctx);
-//    }
-//
-//    //日龄
-//    private void uploadDayAge(String askText, String idCode, ChannelHandlerContext ctx) {
-//        if (!cmdProService.isEffectiveDevice(idCode)) {
-//            System.out.println("##日龄上传请求-未注册设备 idCode=" + idCode);
-//            return;
-//        }
-//        String answerText = "hm+3+0+4+end";
-//        log.info(">>日龄上传请求-应答数据>>" + answerText);
-//        answerCmd(answerText, ctx);
-//        //发送湿度请求到消息队列
-//        producer.sendDayAge(askText);
-//    }
-//
-//    private void uploadFeng(String askText, String idCode, ChannelHandlerContext ctx) {
-//        if (!cmdProService.isEffectiveDevice(idCode)) {
-//            System.out.println("##通风等级上传请求-未注册设备 idCode=" + idCode);
-//            return;
-//        }
-//        String answerText = "hm+4+0+4+end";
-//        log.info(">>通风等级上传请求-应答数据>>" + answerText);
-//        answerCmd(answerText, ctx);
-//        //发送湿度请求到消息队列
-//        producer.sendFeng(askText);
-//    }
-//
-//    private void uploadOutTemp(String askText, String idCode, ChannelHandlerContext ctx) {
-//        if (!cmdProService.isEffectiveDevice(idCode)) {
-//            System.out.println("##舍外温度上传请求-未注册设备 idCode=" + idCode);
-//            return;
-//        }
-//        String answerText = "hm+5+0+4+end";
-//        log.info(">>舍外温度上传请求-应答数据>>" + answerText);
-//        answerCmd(answerText, ctx);
-//        //发送湿度请求到消息队列
-//        producer.sendOutTemp(askText);
-//    }
-//
-//    private void uploadInTemp(String askText, String idCode, ChannelHandlerContext ctx) {
-//        if (!cmdProService.isEffectiveDevice(idCode)) {
-//            System.out.println("##舍内温度上传请求-未注册设备 idCode=" + idCode);
-//            return;
-//        }
-//        String answerText = "hm+6+0+4+end";
-//        log.info(">>舍内温度上传请求-应答数据>>" + answerText);
-//        answerCmd(answerText, ctx);
-//        //发送湿度请求到消息队列
-//        producer.sendInTemp(askText);
-//    }
-//    private void uploadTargetnTemp(String askText, String idCode, ChannelHandlerContext ctx) {
-//        if (!cmdProService.isEffectiveDevice(idCode)) {
-//            System.out.println("##目标温度上传请求-未注册设备 idCode=" + idCode);
-//            return;
-//        }
-//        String answerText = "hm+7+0+4+end";
-//        log.info(">>目标温度上传请求-应答数据>>" + answerText);
-//        answerCmd(answerText, ctx);
-//        //发送湿度请求到消息队列
-//        producer.senTargetnTemp(askText);
-//    }
-//
-//    private void uploadTemp(String askText, String idCode, ChannelHandlerContext ctx) {
-//        if (!cmdProService.isEffectiveDevice(idCode)) {
-//            System.out.println("##温度上传请求-未注册设备 idCode=" + idCode);
-//            return;
-//        }
-//        String answerText = "hm+21+0+7+end";
-//        log.info(">>温度上传请求-应答数据>>" + answerText);
-//        answerCmd(answerText, ctx);
-//        //发送湿度请求到消息队列
-//        producer.sendTemp(askText);
-//    }
-//
-//    private void uploadHumi(String askText, String idCode, ChannelHandlerContext ctx) {
-//        if (!cmdProService.isEffectiveDevice(idCode)) {
-//            System.out.println("##湿度度上传请求-未注册设备 idCode=" + idCode);
-//            return;
-//        }
-//        String answerText = "hm+22+0+8+end";
-//        log.info(">>湿度上传请求-应答数据>>" + answerText);
-//        answerCmd(answerText, ctx);
-//        //发送湿度请求到消息队列
-//        producer.sendHumi(askText);
-//    }
-//
-//    private void uploadWarning(String askText, String idCode, ChannelHandlerContext ctx) {
-//        if (!cmdProService.isEffectiveDevice(idCode)) {
-//            System.out.println("##预警上传请求-未注册设备 idCode=" + idCode);
-//            return;
-//        }
-//        String answerText = "hm+41+0+2+end";
-//        log.info(">>预警上传请求-应答数据>>" + answerText);
-//        answerCmd(answerText, ctx);
-//        //发送湿度请求到消息队列
-//        producer.sendWarning(askText);
-//    }
-//    private void uploadFengStatus(String askText, String idCode, ChannelHandlerContext ctx) {
-//        if (!cmdProService.isEffectiveDevice(idCode)) {
-//            System.out.println("##风机状态上传请求-未注册设备 idCode=" + idCode);
-//            return;
-//        }
-//        String answerText = "hm+61+0+2+end";
-//        log.info(">>风机状态上传请求-应答数据>>" + answerText);
-//        answerCmd(answerText, ctx);
-//        //发送风机状态请求到消息队列
-//        producer.uploadFengStatus(askText);
-//    }
-//
-//    //应答
-//    public void answerCmd(String answerText, ChannelHandlerContext ctx) {
-//        ctx.writeAndFlush(Unpooled.copiedBuffer(answerText.getBytes()));
-//    }
-//
-//    //检查无效耳标
-//    public boolean checkValidEarmark(String earmark) {
-//        if (earmark.trim().equalsIgnoreCase("ffffffffffffffff") || earmark.trim().equalsIgnoreCase("0000000000000000")) {
-//            return true;
-//        } else {
-//            return false;
-//        }
-//    }
-//
+
 //    //拆分粘包数据
     public JSONArray parseAskCmdPackage(String text) {
         String key = "end";

+ 5 - 5
huimv-env-input/src/main/resources/application-prod.yml

@@ -6,9 +6,9 @@ spring:
     name: huimv-env-input
 
   datasource:
-    url: jdbc:mysql://121.36.134.218/huimv-env-hylintech?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
-    username: hylintech
-    password: hm123456
+    url: jdbc:mysql://139.9.172.209:3309/huimv-env-hylintech?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    username: eartag
+    password: eartag@2022
     driver-class-name: com.mysql.cj.jdbc.Driver
   jpa:
     show-sql: true
@@ -27,12 +27,12 @@ spring:
 #    #虚拟host 可以不设置,使用server默认host
 #    virtual-host: /
   rabbitmq:
-    host: 121.36.134.218
+    host: 139.9.172.209
     port: 5672
     username: admin
     password: admin
     #虚拟host 可以不设置,使用server默认host
-    virtual-host: /env
+    virtual-host: /
 
     #确认消息已发送到交换机(Exchange)
 #    publisher-confirms: true #(过时、弃用)