From b7edb0f3526d5ca32016d5f332ddf957d74c01c2 Mon Sep 17 00:00:00 2001
From: jiazx0107@163.com <jiazx0107@163.com>
Date: 星期日, 24 十二月 2023 01:24:53 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/igds-api-gateway' into igds-api-gateway

---
 src/main/java/com/fzzy/gateway/hx2023/data/GrainTH.java                     |   35 ++++
 src/main/java/com/fzzy/gateway/hx2023/data/GrainData.java                   |    2 
 src/main/java/com/fzzy/gateway/service/GatewayDeviceTestPR.java             |    2 
 src/main/java/com/fzzy/gateway/hx2023/data/GrainOutPut.java                 |    2 
 src/main/java/com/fzzy/protocol/bhzn/analysis/AnalysisService.java          |   20 +-
 src/main/resources/application-pro5012.yml                                  |   64 ++++++-
 src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisGrain.java            |    4 
 src/main/java/com/fzzy/gateway/GatewayUtils.java                            |    9 +
 src/main/java/com/fzzy/protocol/fzzy/service/FzzyGatewayGrainService.java   |    2 
 src/main/java/com/fzzy/gateway/hx2023/service/ScGatewayTestServiceImpl.java |   52 +++---
 src/main/resources/application-devGatewayCommon.yml                         |   13 +
 src/main/java/com/fzzy/api/Constant.java                                    |   24 ++
 src/main/java/com/fzzy/protocol/bhzn/service/Bhzn2GatewayGrainService.java  |    2 
 src/main/resources/application-pro5338.yml                                  |   99 ++++++++++++
 src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisService.java          |    2 
 src/main/resources/application-proGateway.yml                               |   19 +
 src/main/java/com/fzzy/protocol/bhzn/server/BhznGrainV2ServerEngine.java    |    3 
 src/main/java/com/fzzy/gateway/GatewayTimerScheduled.java                   |   31 +++
 src/main/java/com/fzzy/utils/NumberUtil.java                                |   53 ++++++
 19 files changed, 379 insertions(+), 59 deletions(-)

diff --git a/src/main/java/com/fzzy/api/Constant.java b/src/main/java/com/fzzy/api/Constant.java
index 78701d7..3d0c911 100644
--- a/src/main/java/com/fzzy/api/Constant.java
+++ b/src/main/java/com/fzzy/api/Constant.java
@@ -1,6 +1,8 @@
 package com.fzzy.api;
 
+import com.alibaba.fastjson.JSON;
 import com.fzzy.api.data.ApiCommonDevice;
+import lombok.extern.slf4j.Slf4j;
 
 import java.util.Date;
 import java.util.HashMap;
@@ -9,6 +11,7 @@
 /**
  * 鍏ㄥ眬闈欐�佺被
  */
+@Slf4j
 public class Constant {
 
 
@@ -322,6 +325,7 @@
 
     public static ApiCommonDevice getCommonDeviceCache(String sn) {
         if (null == sn) return null;
+        log.info("鍦ㄧ嚎璁惧锛�" + JSON.toJSONString(contextDeviceMap));
         return contextDeviceMap.get(sn);
     }
 
@@ -329,13 +333,22 @@
         if (null == ip) return null;
 
         if (contextDeviceMap.isEmpty()) return null;
-
+        log.info("鍦ㄧ嚎璁惧锛�" + JSON.toJSONString(contextDeviceMap));
         for (ApiCommonDevice device : contextDeviceMap.values()) {
-            if (ip.equals(device)) return device;
+            if (ip.equals(device.getIp())) return device;
         }
         return null;
     }
+    public static ApiCommonDevice getCommonDeviceCacheBySn(String sn) {
+        if (null == sn) return null;
 
+        if (contextDeviceMap.isEmpty()) return null;
+        log.info("鍦ㄧ嚎璁惧锛�" + JSON.toJSONString(contextDeviceMap));
+        for (ApiCommonDevice device : contextDeviceMap.values()) {
+            if (sn.equals(device.getSn())) return device;
+        }
+        return null;
+    }
     public static ApiCommonDevice updateCacheOnline(String ip, Integer port) {
         ApiCommonDevice device = getCommonDeviceCacheByIp(ip);
 
@@ -348,7 +361,8 @@
         device.setCode("SUCCESS");
         device.setMsg("璁惧涓婄嚎");
         device.setOnlineTime(new Date());
-        contextDeviceMap.put(device.getSn(), device);
+        contextDeviceMap.put(device.getIp(), device);
+        log.info("璁惧涓婄嚎锛�" + ip);
         return device;
     }
 
@@ -363,12 +377,12 @@
         device.setStatus(Constant.YN_N);
         device.setCode("ERROR");
         device.setMsg("璁惧绂荤嚎");
-        contextDeviceMap.put(device.getSn(), device);
+        contextDeviceMap.put(device.getIp(), device);
 
         return device;
     }
 
     public static void updateCache(ApiCommonDevice device) {
-        contextDeviceMap.put(device.getSn(), device);
+        contextDeviceMap.put(device.getIp(), device);
     }
 }
diff --git a/src/main/java/com/fzzy/gateway/GatewayTimerScheduled.java b/src/main/java/com/fzzy/gateway/GatewayTimerScheduled.java
index b29de93..302fc5e 100644
--- a/src/main/java/com/fzzy/gateway/GatewayTimerScheduled.java
+++ b/src/main/java/com/fzzy/gateway/GatewayTimerScheduled.java
@@ -17,7 +17,9 @@
 
 import javax.annotation.Resource;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 缃戝叧鐩稿叧鐨勫畾鏃跺櫒
@@ -84,6 +86,13 @@
             if (null == url) {
                 url = DEFAULT_URL;
             }
+            Map<String ,String> parameMap = new HashMap<>();
+            parameMap.put("unescape","1");
+            parameMap.put("version","v61");
+            parameMap.put("appid",DEFAULT_APP_ID);
+            parameMap.put("appsecret",DEFAULT_APP_SECRET);
+            parameMap.put("cityid",DEFAULT_CITYID);
+            url = url.replace("{appId}", DEFAULT_APP_ID).replace("{appsecret}", DEFAULT_APP_SECRET).replace("{cityid}", DEFAULT_CITYID);
 
             url = url.replace("{appId}", DEFAULT_APP_ID).replace("{appsecret}", DEFAULT_APP_SECRET);
 
@@ -94,7 +103,7 @@
             }
 
             log.debug("------姘旇薄璇锋眰淇℃伅URL---{}", url);
-            String result = GatewayHttpUtil.doGet(url);
+            String result = GatewayHttpUtil.doGet(url,parameMap);
 
             if (null == result) {
                 log.error("褰撳墠澶栫綉鑾峰彇姘旇薄淇℃伅澶辫触鈥︹��");
@@ -112,7 +121,7 @@
             log.info("===========================绯荤粺瀹氭椂鑾疯幏鍙栨皵璞′俊鎭�===={}==================", dto);
 
         } catch (Exception e) {
-
+            log.error(e.getMessage(),e);
         }
     }
 
@@ -160,4 +169,22 @@
             gatewayRemoteManager.getSyncWeightService(device.getSyncProtocol()).syncWeightInfo(reqData);
         }
     }
+
+    public static void main(String[] args) {
+        try {
+            Map<String ,String> parameMap = new HashMap<>();
+            parameMap.put("unescape","1");
+            parameMap.put("version","v61");
+            parameMap.put("appid","49421971");
+            parameMap.put("appsecret","JmJE48Fv");
+            parameMap.put("cityid","101270101");
+            String result = GatewayHttpUtil.doGet("https://v1.yiketianqi.com/api?unescape=1&version=v61&appid=49421971&appsecret=JmJE48Fv&cityid=101270101", parameMap);
+
+
+            System.out.println(result);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+
+    }
 }
diff --git a/src/main/java/com/fzzy/gateway/GatewayUtils.java b/src/main/java/com/fzzy/gateway/GatewayUtils.java
index e1e132f..4414d4b 100644
--- a/src/main/java/com/fzzy/gateway/GatewayUtils.java
+++ b/src/main/java/com/fzzy/gateway/GatewayUtils.java
@@ -58,6 +58,15 @@
 
         return null;
     }
+    public static GatewayDevice getCacheByDeviceSIp(String ip) {
+        Collection<GatewayDevice> list = allCacheDevice();
+        if (null == list || list.isEmpty()) return null;
+
+        for (GatewayDevice device : list) {
+            if (ip.equals(device.getIp())) return device;
+        }
+        return null;
+    }
 
     /**
      * 閽堝涓�涓�氳鍒嗘満瀵瑰涓粨鎯呭喌
diff --git a/src/main/java/com/fzzy/gateway/hx2023/data/GrainData.java b/src/main/java/com/fzzy/gateway/hx2023/data/GrainData.java
index c12e6e3..9c9dcd0 100644
--- a/src/main/java/com/fzzy/gateway/hx2023/data/GrainData.java
+++ b/src/main/java/com/fzzy/gateway/hx2023/data/GrainData.java
@@ -25,4 +25,6 @@
 
     private String weatherStation;
 
+
+
 }
diff --git a/src/main/java/com/fzzy/gateway/hx2023/data/GrainOutPut.java b/src/main/java/com/fzzy/gateway/hx2023/data/GrainOutPut.java
index 565fef1..b902384 100644
--- a/src/main/java/com/fzzy/gateway/hx2023/data/GrainOutPut.java
+++ b/src/main/java/com/fzzy/gateway/hx2023/data/GrainOutPut.java
@@ -36,7 +36,9 @@
 
     private String maxZ = "0";
 
+    private List<GrainTH> temperatureAndhumidity;
 
     private List<GrainTemp> temperature;
 
+
 }
diff --git a/src/main/java/com/fzzy/gateway/hx2023/data/GrainTH.java b/src/main/java/com/fzzy/gateway/hx2023/data/GrainTH.java
new file mode 100644
index 0000000..2cabdfb
--- /dev/null
+++ b/src/main/java/com/fzzy/gateway/hx2023/data/GrainTH.java
@@ -0,0 +1,35 @@
+package com.fzzy.gateway.hx2023.data;
+
+import lombok.Data;
+
+/**
+ * 绮儏淇℃伅璇︾粏
+ */
+@Data
+public class GrainTH {
+
+    //鏍瑰彿
+    private String cableNum;
+
+    //灞傚彿
+    private String layerNumber;
+
+    //娓╁害鍊�
+    private String temperature;
+
+    //娓╁害鍊�
+    private String humidity;
+
+    //绱㈠紩锛屼粠0寮�濮�
+    private String position;
+
+
+    public GrainTH() {
+    }
+
+    public GrainTH(String temperature, String humidity ,String position) {
+        this.humidity = humidity;
+        this.temperature = temperature;
+        this.position = position;
+    }
+}
diff --git a/src/main/java/com/fzzy/gateway/hx2023/service/ScGatewayTestServiceImpl.java b/src/main/java/com/fzzy/gateway/hx2023/service/ScGatewayTestServiceImpl.java
index 53966e1..705d6a6 100644
--- a/src/main/java/com/fzzy/gateway/hx2023/service/ScGatewayTestServiceImpl.java
+++ b/src/main/java/com/fzzy/gateway/hx2023/service/ScGatewayTestServiceImpl.java
@@ -18,6 +18,7 @@
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.time.DateFormatUtils;
+import org.apache.commons.lang3.RandomUtils;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
@@ -271,15 +272,16 @@
 
 
         WeatherWebDto weather = WeatherWebDto.contextMap.get("default");
-        double tMIn = 20, tMax = 25;
+        double tMIn = 10, tMax = 15;
         if (null != weather) {
             double tOut = Double.valueOf(weather.getTem());
-            tMIn = tOut - 4;
-            if (tMIn < 4) tMIn = 5;
-            tMax = tOut + 0;
-            if (tMax < 15) tMax = 15;
+            tMIn = tOut - 5;
+            tMax = tOut;
         }
-
+        if (tMIn < 10) tMIn = 10;
+        if (tMIn > 20) tMIn = 20;
+        if (tMax < 15) tMax = 15;
+        if (tMax > 25) tMax = 25;
 
         //鏁版嵁灏佽
         GrainData grain = new GrainData();
@@ -309,24 +311,22 @@
         double randomNumber = tMIn;
         int x = 0, y = 0, z = 0;
         for (int i = 0; i < sumNum; i++) {
-            if ((i) % Integer.valueOf(cableRule[0]) == 0) {
-                randomNumber = Math.random() * (tMax - tMIn + 1) + tMIn;
-
-            } else if ((i) % Integer.valueOf(cableRule[0]) == 1) {
-                randomNumber = Math.random() * (tMax - tMIn + 1) + tMIn;
-
-            } else if ((i) % Integer.valueOf(cableRule[0]) == 2) {
-                randomNumber = Math.random() * (tMax - tMIn + 1) + tMIn;
-
-            } else if ((i) % Integer.valueOf(cableRule[0]) == 3) {
-                randomNumber = Math.random() * (tMax - tMIn + 1) + tMIn;
-
-            } else if ((i) % Integer.valueOf(cableRule[0]) == 4) {
-                randomNumber = Math.random() * (tMax - tMIn + 1) + tMIn;
-
-            } else {
-                randomNumber = Math.random() * (tMax - tMIn + 1) + tMIn;
-
+            log.info("i=锛�" + i);
+            if (i % cableZ == 0) {
+                randomNumber = RandomUtils.nextDouble(tMIn, tMax+1.5);
+                log.info("绗�1灞傛俯搴︼細" + randomNumber);
+            } else if (i % cableZ == 1)  {
+                randomNumber = RandomUtils.nextDouble(tMIn-1, tMax-0);
+                log.info("绗�2灞傛俯搴︼細" + randomNumber);
+            } else if (i % cableZ == 2)  {
+                randomNumber = RandomUtils.nextDouble(tMIn-2, tMax-1.5);
+                log.info("绗�3灞傛俯搴︼細" + randomNumber);
+            } else if (i % cableZ == 3)  {
+                randomNumber = RandomUtils.nextDouble(tMIn-3, tMax-3);
+                log.info("绗�4灞傛俯搴︼細" + randomNumber);
+            } else if (i % cableZ == 4)  {
+                randomNumber = RandomUtils.nextDouble(tMIn-4, tMax-4.5);
+                log.info("绗�5灞傛俯搴︼細" + randomNumber);
             }
             // randomNumber = Math.random() * (tMax - tMIn + 1) + tMIn;
             curTemp = NumberUtil.keepPrecision(randomNumber, 1);
@@ -343,6 +343,10 @@
         }
 
         outPut.setTemperature(temperature);
+        List<GrainTH> ths = new ArrayList<>();
+
+        ths.add(new GrainTH(weather.getTem()!=null?weather.getTem()+"":"",weather.getHumidity()!=null?weather.getHumidity()+"":"","1"));
+        outPut.setTemperatureAndhumidity(ths);
 
         grain.setOutput(JSONObject.toJSONString(outPut));
 
diff --git a/src/main/java/com/fzzy/gateway/service/GatewayDeviceTestPR.java b/src/main/java/com/fzzy/gateway/service/GatewayDeviceTestPR.java
index c72c82a..7cd3ec7 100644
--- a/src/main/java/com/fzzy/gateway/service/GatewayDeviceTestPR.java
+++ b/src/main/java/com/fzzy/gateway/service/GatewayDeviceTestPR.java
@@ -381,7 +381,7 @@
             lpr.setCarNumber(carNumber);
             JSONObject jsonObject = new JSONObject();
             jsonObject.put("carNumber", carNumber);
-            jsonObject.put("position", "big");
+            jsonObject.put("position", device.getPosition());
             packet.setProperties(jsonObject);
 
             packet.setTimestamp(System.currentTimeMillis());
diff --git a/src/main/java/com/fzzy/protocol/bhzn/analysis/AnalysisService.java b/src/main/java/com/fzzy/protocol/bhzn/analysis/AnalysisService.java
index fb8b9ba..9f804ac 100644
--- a/src/main/java/com/fzzy/protocol/bhzn/analysis/AnalysisService.java
+++ b/src/main/java/com/fzzy/protocol/bhzn/analysis/AnalysisService.java
@@ -98,21 +98,22 @@
     private void analysisGrain(IoMessage message) {
         try {
 
+            //鏍规嵁鍒嗘満SN鑾峰彇璁惧閰嶇疆淇℃伅
+            GatewayDevice gatewayDevice = GatewayUtils.getCacheByDeviceSn(message.getAddr());
+            if (null == gatewayDevice) {
+                replayGrain(message);
+                log.error("涓绘満-------->>骞冲彴锛岃В鏋愮伯鎯呭け璐ワ紝鏈幏鍙栧埌绯荤粺璁惧閰嶇疆淇℃伅锛�" + message.getAddr());
+                return;
+            }
             //鏍规嵁鍒嗘満鍦板潃鑾峰彇鍒嗘満淇℃伅
-            ApiCommonDevice commonDevice = Constant.getCommonDeviceCache(message.getAddr());
+            ApiCommonDevice commonDevice = Constant.getCommonDeviceCache(message.getIp());
             if (commonDevice == null) {
                 replayGrain(message);
                 log.error("涓绘満-------->>骞冲彴锛岃В鏋愮伯鎯呭け璐ワ紝鏈幏鍙栧埌绯荤粺绮儏涓绘満閰嶇疆锛�" + message.getAddr());
                 return;
             }
 
-            //鏍规嵁鍒嗘満SN鑾峰彇璁惧閰嶇疆淇℃伅
-            GatewayDevice gatewayDevice = GatewayUtils.getCacheByDeviceSn(commonDevice.getSn());
-            if (null == gatewayDevice) {
-                replayGrain(message);
-                log.error("涓绘満-------->>骞冲彴锛岃В鏋愮伯鎯呭け璐ワ紝鏈幏鍙栧埌绯荤粺璁惧閰嶇疆淇℃伅锛�" + message.getAddr());
-                return;
-            }
+
 
             //鑾峰彇璇锋眰淇℃伅
             BaseReqData reqData = ProtocolUtils.getSyncReq(gatewayDevice.getDepotIdSys());
@@ -323,7 +324,10 @@
         outPut.setAvgTemperature(NumberUtil.keepPrecision((sumT / sumNum), 1) + "");
         outPut.setMinTemperature(min + "");
         outPut.setMaxTemperature(min + "");
+        List<GrainTH> ths = new ArrayList<>();
 
+        ths.add(new GrainTH(thDto.getTempIn()!=null?thDto.getTempIn()+"":"",thDto.getHumidityIn()!=null?thDto.getHumidityIn()+"":"","1"));
+        outPut.setTemperatureAndhumidity(ths);
         grain.setOutput(JSONObject.toJSONString(outPut));
 
         GatewayDevice gatewayDeviceWeather = GatewayUtils.getCacheByDeviceTypeOne(GatewayDeviceType.TYPE_09.getCode());
diff --git a/src/main/java/com/fzzy/protocol/bhzn/server/BhznGrainV2ServerEngine.java b/src/main/java/com/fzzy/protocol/bhzn/server/BhznGrainV2ServerEngine.java
index 3f827bf..3148d4f 100644
--- a/src/main/java/com/fzzy/protocol/bhzn/server/BhznGrainV2ServerEngine.java
+++ b/src/main/java/com/fzzy/protocol/bhzn/server/BhznGrainV2ServerEngine.java
@@ -46,9 +46,8 @@
         // 閰嶇疆绯荤粺蹇冭烦闂撮殧
         ioServerOption.setReaderIdleTime(5 * 60);
 
-        NettyServer ioServer = new NettyServer(ioServerOption, messageConsume, ioSessionListener, heartbeatProvider);
+        ioServer = new NettyServer(ioServerOption, messageConsume, ioSessionListener, heartbeatProvider);
         ioServer.startup();
-
 
         log.info("* ");
         log.info("* ========================");
diff --git a/src/main/java/com/fzzy/protocol/bhzn/service/Bhzn2GatewayGrainService.java b/src/main/java/com/fzzy/protocol/bhzn/service/Bhzn2GatewayGrainService.java
index cbdc7ea..3e121d5 100644
--- a/src/main/java/com/fzzy/protocol/bhzn/service/Bhzn2GatewayGrainService.java
+++ b/src/main/java/com/fzzy/protocol/bhzn/service/Bhzn2GatewayGrainService.java
@@ -35,7 +35,7 @@
         GatewayDevice device = reqData.getDevice();
 
         //鑾峰彇杩炴帴涓殑璁惧淇℃伅
-        ApiCommonDevice apiCommonDevice = Constant.getCommonDeviceCache(device.getDeviceSn());
+        ApiCommonDevice apiCommonDevice = Constant.getCommonDeviceCache(device.getIp());
 
         if (null == apiCommonDevice) {
             resp.setCode(500);
diff --git a/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisGrain.java b/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisGrain.java
index 0c8346d..fb85434 100644
--- a/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisGrain.java
+++ b/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisGrain.java
@@ -159,7 +159,11 @@
         }
 
         outPut.setTemperature(temperature);
+        List<GrainTH> ths = new ArrayList<>();
 
+        ths.add(new GrainTH(response.getTIn()!=null?response.getTIn()+"":"",response.getHIn()!=null?response.getHIn()+"":"","1"));
+        outPut.setTemperatureAndhumidity(ths);
+        //grain.setOutput(JSONObject.toJSONString(outPut));
         grain.setOutput(com.alibaba.fastjson2.JSONObject.toJSONString(outPut));
 
 
diff --git a/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisService.java b/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisService.java
index 30fe028..efe9af8 100644
--- a/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisService.java
+++ b/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisService.java
@@ -47,7 +47,7 @@
             }
 
             //鎵ц鐨勫垎鏈轰俊鎭�
-            ApiCommonDevice commonDevice = Constant.getCommonDeviceCache(message.getSn());
+            ApiCommonDevice commonDevice = Constant.getCommonDeviceCacheBySn(message.getSn());
             if (null == commonDevice) {
                 log.warn("鎺у埗鏌�------>>>骞冲彴锛氬綋鍓嶇粍缁囩紪鐮�={}锛屽垎鏈篒D={}锛岀郴缁熸病鏈夎幏鍙栧埌鍒嗘満淇℃伅锛屾姤鏂囨棤娉曡繘琛岃В鏋�", message.getCompanyId(), message.getIedId());
                 return;
diff --git a/src/main/java/com/fzzy/protocol/fzzy/service/FzzyGatewayGrainService.java b/src/main/java/com/fzzy/protocol/fzzy/service/FzzyGatewayGrainService.java
index af2f7cc..ede70f3 100644
--- a/src/main/java/com/fzzy/protocol/fzzy/service/FzzyGatewayGrainService.java
+++ b/src/main/java/com/fzzy/protocol/fzzy/service/FzzyGatewayGrainService.java
@@ -36,7 +36,7 @@
         GatewayDevice device = reqData.getDevice();
 
         //鑾峰彇杩炴帴涓殑璁惧淇℃伅
-        ApiCommonDevice apiCommonDevice = Constant.getCommonDeviceCache(device.getDeviceSn());
+        ApiCommonDevice apiCommonDevice = Constant.getCommonDeviceCache(device.getIp());
 
         if (null == apiCommonDevice) {
             resp.setCode(500);
diff --git a/src/main/java/com/fzzy/utils/NumberUtil.java b/src/main/java/com/fzzy/utils/NumberUtil.java
new file mode 100644
index 0000000..ec6e9fc
--- /dev/null
+++ b/src/main/java/com/fzzy/utils/NumberUtil.java
@@ -0,0 +1,53 @@
+package com.fzzy.utils;
+ 
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+
+/**
+ * 鏁板瓧鏍煎紡鍖栧伐鍏风被
+ */
+public class NumberUtil {
+
+	/**
+	 * 瀵筪ouble绫诲瀷鐨勬暟鍊间繚鐣欐寚瀹氫綅鏁扮殑灏忔暟銆�<br>
+	 * 璇ユ柟娉曡垗鍏ユā寮忥細鍚戔�滄渶鎺ヨ繎鐨勨�濇暟瀛楄垗鍏ワ紝濡傛灉涓庝袱涓浉閭绘暟瀛楃殑璺濈鐩哥瓑锛屽垯涓哄悜涓婅垗鍏ョ殑鑸嶅叆妯″紡銆�<br>
+	 * <b>娉ㄦ剰锛�</b>濡傛灉绮惧害瑕佹眰姣旇緝绮剧‘璇蜂娇鐢� keepPrecision(String number, int precision)鏂规硶
+	 * @param number  瑕佷繚鐣欏皬鏁扮殑鏁板瓧
+	 * @param precision 灏忔暟浣嶆暟
+	 * @return double 濡傛灉鏁板�艰緝澶э紝鍒欎娇鐢ㄧ瀛﹁鏁版硶琛ㄧず
+	 */
+	public static double keepPrecision(Double number, int precision) {
+		if(null == number || 0.0 == number ) return 0.0;
+		BigDecimal bg = new BigDecimal(number);
+		return bg.setScale(precision, BigDecimal.ROUND_HALF_UP).doubleValue();
+	}
+ 
+	/**
+	 * 瀵筬loat绫诲瀷鐨勬暟鍊间繚鐣欐寚瀹氫綅鏁扮殑灏忔暟銆�<br>
+	 * 璇ユ柟娉曡垗鍏ユā寮忥細鍚戔�滄渶鎺ヨ繎鐨勨�濇暟瀛楄垗鍏ワ紝濡傛灉涓庝袱涓浉閭绘暟瀛楃殑璺濈鐩哥瓑锛屽垯涓哄悜涓婅垗鍏ョ殑鑸嶅叆妯″紡銆�<br>
+	 * <b>娉ㄦ剰锛�</b>濡傛灉绮惧害瑕佹眰姣旇緝绮剧‘璇蜂娇鐢� keepPrecision(String number, int precision)鏂规硶
+	 * @param number  瑕佷繚鐣欏皬鏁扮殑鏁板瓧
+	 * @param precision 灏忔暟浣嶆暟
+	 * @return float 濡傛灉鏁板�艰緝澶э紝鍒欎娇鐢ㄧ瀛﹁鏁版硶琛ㄧず
+	 */
+	public static float keepPrecision(Float number, int precision) {
+		if(null == number) return 0f;
+		BigDecimal bg = new BigDecimal(number);
+		return bg.setScale(precision, BigDecimal.ROUND_HALF_UP).floatValue();
+	}
+	/**
+	 * double杞瓧绗︿覆锛岄伩鍏嶅嚭鐜扮瀛﹁鏁版硶
+	 * @param d
+	 * @return
+	 */
+	public static String doubleToStr(Double d) {
+		if(null == d) return "";
+		DecimalFormat df = new DecimalFormat("0.0");
+		return df.format(d);
+	}
+
+
+	public static void main(String[] args) {
+		System.out.println((8) % Integer.valueOf(4) == 0);
+	}
+}
diff --git a/src/main/resources/application-devGatewayCommon.yml b/src/main/resources/application-devGatewayCommon.yml
index 6bf114c..55e75e4 100644
--- a/src/main/resources/application-devGatewayCommon.yml
+++ b/src/main/resources/application-devGatewayCommon.yml
@@ -69,7 +69,6 @@
       auto-offset-reset: latest
       key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
       value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
-
   mqtt:
     host: tcp://127.0.0.1:1883
     username: admin
@@ -83,3 +82,15 @@
     isOpen: false
     default-topic: mqtt/+/test1
     topics: /device-message-sender/#
+license:
+  subject: ld_license
+  publicAlias: publicCert
+  storePass: PUBLICFZZYXXJSGFYXGS888888
+  licensePath: D:/IGDS/license/license.lic
+  publicKeysStorePath: D:/IGDS/license/publicCerts.keystore
+igds:
+  default:
+  companyId: 5338
+  file-path: D:/app/igds-api
+  img-path: D:/IGDS/FILE/
+  weather-url: https://v1.yiketianqi.com/api?unescape=1&version=v61&appid={appId}&appsecret={appsecret}&cityid={cityid}
diff --git a/src/main/resources/application-pro5012.yml b/src/main/resources/application-pro5012.yml
index 0a50080..909580f 100644
--- a/src/main/resources/application-pro5012.yml
+++ b/src/main/resources/application-pro5012.yml
@@ -1,20 +1,18 @@
 server:
-  port: 8081
-  jetty:
-    max-http-post-size: 209715200
-  tomcat:
-    max-http-post-size: 209715200
+  port: 8090
+
 spring:
   datasource:
     #涓绘暟鎹簮
     primary:
-      url: jdbc:mysql://127.0.0.1:3306/igds_api?useUnicode=true&characterEncoding=utf-8
+      url: jdbc:mysql://127.0.0.1:3306/igds_api_2023?useUnicode=true&useSSL=false&characterEncoding=utf-8
       username: root
       password: Abc123..
       driver-class-name: com.mysql.jdbc.Driver
     #娆℃暟鎹簮
     secondary:
-      url: jdbc:mysql://127.0.0.1:3306/igds_dl?useUnicode=true&characterEncoding=utf-8
+      url: jdbc:mysql://127.0.0.1:3306/igds_v4?useUnicode=true&useSSL=false&characterEncoding=utf-8
+
       username: root
       password: Abc123..
       driver-class-name: com.mysql.jdbc.Driver
@@ -37,7 +35,7 @@
           dialect: org.hibernate.dialect.MySQL5InnoDBDialect
   # Redis鐩稿叧閰嶇疆
   redis:
-    database: 0
+    database: 5
     host: 127.0.0.1
     port: 6379
     password:
@@ -47,4 +45,52 @@
       max-wait: -1
       max-idle: 10
       min-idle: 0
-      timeout: 6000
\ No newline at end of file
+      timeout: 6000
+  kafka:
+    bootstrap-servers: 103.203.217.16:9092
+    producer:
+      retries: 0
+      acks: 1
+      batch-size: 16384
+      buffer-memory: 33554432
+      key-serializer: org.apache.kafka.common.serialization.StringSerializer
+      value-serializer: org.apache.kafka.common.serialization.StringSerializer
+    properties:
+      security.protocol: SASL_PLAINTEXT
+      sasl.mechanism: PLAIN
+      sasl.username: sc001
+      sasl.password: wCV0ISwmoKwbx1lpBKMW
+      sasl.jaas.config: org.apache.kafka.common.security.scram.ScramLoginModule required username='sc001' password='wCV0ISwmoKwbx1lpBKMW';
+    consumer:
+      group-id: fzzygroup
+      enable-auto-commit: true
+      auto-commit-interval: 100
+      auto-offset-reset: latest
+      key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
+      value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
+
+  mqtt:
+    host: tcp://127.0.0.1:1883
+    username: admin
+    password: admin123321
+    client-inId: fzzy_client_id_in_igds_api
+    client-outId: fzzy_client_id_out_igds_api
+    completionTimeout: 3000
+    keep-alive-interval: 2
+    max-connect-times: 5
+    qos: 0
+    isOpen: false
+    default-topic: mqtt/+/test1
+    topics: /device-message-sender/#
+license:
+  subject: ld_license
+  publicAlias: publicCert
+  storePass: PUBLICFZZYXXJSGFYXGS888888
+  licensePath: D:/IGDS/license/license.lic
+  publicKeysStorePath: D:/IGDS/license/publicCerts.keystore
+igds:
+  default:
+  companyId: 5338
+  file-path: D:/app/igds-api
+  img-path: D:/IGDS/FILE/
+  weather-url: https://v1.yiketianqi.com/api?unescape=1&version=v61&appid={appId}&appsecret={appsecret}&cityid={cityid}
diff --git a/src/main/resources/application-pro5338.yml b/src/main/resources/application-pro5338.yml
new file mode 100644
index 0000000..7329ff8
--- /dev/null
+++ b/src/main/resources/application-pro5338.yml
@@ -0,0 +1,99 @@
+##########################  浠佸   ##########################
+server:
+  port: 8090
+  jetty:
+    max-http-post-size: 209715200
+  tomcat:
+    max-http-post-size: 209715200
+spring:
+  datasource:
+    #涓绘暟鎹簮
+    primary:
+      url: jdbc:mysql://127.0.0.1:3306/igds_api?useUnicode=true&characterEncoding=utf-8
+      username: root
+      password: Fzzy@#$%5432..K
+      driver-class-name: com.mysql.jdbc.Driver
+    #娆℃暟鎹簮
+    secondary:
+      url: jdbc:mysql://127.0.0.1:3306/igds_master?useUnicode=true&characterEncoding=utf-8
+      username: root
+      password: Fzzy@#$%5432..K
+      driver-class-name: com.mysql.jdbc.Driver
+  jpa:
+    #涓籮pa閰嶇疆
+    primary:
+      show-sql: true
+      properties:
+        hibernate:
+          hbm2ddl:
+            auto: update
+          dialect: org.hibernate.dialect.MySQL5InnoDBDialect
+    #娆pa閰嶇疆
+    secondary:
+      show-sql: true
+      properties:
+        hibernate:
+          hbm2ddl:
+            auto: none
+          dialect: org.hibernate.dialect.MySQL5InnoDBDialect
+  # Redis鐩稿叧閰嶇疆
+  redis:
+    database: 1
+    host: 127.0.0.1
+    port: 6379
+    password: Redispwd..
+    # 杩炴帴姹犳渶澶ц繛鎺ユ暟锛堜娇鐢ㄨ礋鍊艰〃绀烘病鏈夐檺鍒讹級
+    pool:
+      max-active: 200
+      max-wait: -1
+      max-idle: 10
+      min-idle: 0
+      timeout: 6000
+  kafka:
+    bootstrap-servers: 103.203.217.16:9092
+    producer:
+      retries: 0
+      acks: 1
+      batch-size: 16384
+      buffer-memory: 33554432
+      key-serializer: org.apache.kafka.common.serialization.StringSerializer
+      value-serializer: org.apache.kafka.common.serialization.StringSerializer
+    properties:
+      security.protocol: SASL_PLAINTEXT
+      sasl.mechanism: PLAIN
+      sasl.username: sc001
+      sasl.password: wCV0ISwmoKwbx1lpBKMW
+      sasl.jaas.config: org.apache.kafka.common.security.scram.ScramLoginModule required username='sc001' password='wCV0ISwmoKwbx1lpBKMW';
+    consumer:
+      group-id: fzzygroup
+      enable-auto-commit: true
+      auto-commit-interval: 100
+      auto-offset-reset: latest
+      key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
+      value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
+
+  mqtt:
+    host: tcp://127.0.0.1:1883
+    username: admin
+    password: admin123321
+    client-inId: fzzy_client_id_in_igds_api
+    client-outId: fzzy_client_id_out_igds_api
+    completionTimeout: 3000
+    keep-alive-interval: 2
+    max-connect-times: 5
+    qos: 0
+    isOpen: false
+    default-topic: mqtt/+/test1
+    topics: /device-message-sender/#
+license:
+  subject: ld_license
+  publicAlias: publicCert
+  storePass: PUBLICFZZYXXJSGFYXGS888888
+  licensePath: D:/IGDS/license/license.lic
+  publicKeysStorePath: D:/IGDS/license/publicCerts.keystore
+igds:
+  default:
+  companyId: 5338
+  file-path: D:/app/igds-api
+  img-path: D:/IGDS/FILE/
+  weather-url: https://v1.yiketianqi.com/api?unescape=1&version=v61&appid={appId}&appsecret={appsecret}&cityid={cityid}
diff --git a/src/main/resources/application-proGateway.yml b/src/main/resources/application-proGateway.yml
index 2dde28c..55e75e4 100644
--- a/src/main/resources/application-proGateway.yml
+++ b/src/main/resources/application-proGateway.yml
@@ -5,13 +5,13 @@
   datasource:
     #涓绘暟鎹簮
     primary:
-      url: jdbc:mysql://127.0.0.1:3306/igds_api_2023?useUnicode=true&useSSL=false&characterEncoding=utf-8
+      url: jdbc:mysql://127.0.0.1:3306/igds_api?useUnicode=true&useSSL=false&characterEncoding=utf-8
       username: root
       password: Abc123..
       driver-class-name: com.mysql.jdbc.Driver
     #娆℃暟鎹簮
     secondary:
-      url: jdbc:mysql://127.0.0.1:3306/igds_v4?useUnicode=true&useSSL=false&characterEncoding=utf-8
+      url: jdbc:mysql://127.0.0.1:3306/igdsv4?useUnicode=true&useSSL=false&characterEncoding=utf-8
 
       username: root
       password: Abc123..
@@ -69,7 +69,6 @@
       auto-offset-reset: latest
       key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
       value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
-
   mqtt:
     host: tcp://127.0.0.1:1883
     username: admin
@@ -82,4 +81,16 @@
     qos: 0
     isOpen: false
     default-topic: mqtt/+/test1
-    topics: /device-message-sender/#
\ No newline at end of file
+    topics: /device-message-sender/#
+license:
+  subject: ld_license
+  publicAlias: publicCert
+  storePass: PUBLICFZZYXXJSGFYXGS888888
+  licensePath: D:/IGDS/license/license.lic
+  publicKeysStorePath: D:/IGDS/license/publicCerts.keystore
+igds:
+  default:
+  companyId: 5338
+  file-path: D:/app/igds-api
+  img-path: D:/IGDS/FILE/
+  weather-url: https://v1.yiketianqi.com/api?unescape=1&version=v61&appid={appId}&appsecret={appsecret}&cityid={cityid}

--
Gitblit v1.9.3