From 2583d630205582822e2af3026b75c5f915352bfc Mon Sep 17 00:00:00 2001
From: CZT <czt18638530771@163.com>
Date: 星期六, 07 十月 2023 18:51:24 +0800
Subject: [PATCH] 贝博粮情解析6-温湿度解析

---
 igds-protocol-beibo/src/main/java/com/ld/igds/protocol/beibo/grainv1/analysis/AnalysisService.java |  371 ++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 253 insertions(+), 118 deletions(-)

diff --git a/igds-protocol-beibo/src/main/java/com/ld/igds/protocol/beibo/grainv1/analysis/AnalysisService.java b/igds-protocol-beibo/src/main/java/com/ld/igds/protocol/beibo/grainv1/analysis/AnalysisService.java
index f130495..a516d11 100644
--- a/igds-protocol-beibo/src/main/java/com/ld/igds/protocol/beibo/grainv1/analysis/AnalysisService.java
+++ b/igds-protocol-beibo/src/main/java/com/ld/igds/protocol/beibo/grainv1/analysis/AnalysisService.java
@@ -20,11 +20,13 @@
 import com.ld.igds.protocol.beibo.grainv1.util.BeiboGrainServerUtils;
 import com.ld.igds.util.BytesUtil;
 import com.ld.igds.util.ContextUtil;
+import com.ld.igds.util.NumberUtil;
 import com.ld.igds.warn.WarnUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+
 import java.util.*;
 
 /**
@@ -53,21 +55,16 @@
 
     public static String result = "";
 
-    public static Map<String, String> contextMap = new HashMap<>();
-
     public static double ERROR_CHECK_TAG = -100.0;
 
     public static double FAULT_CHECK_TAG = 85.0;
 
     public static double ERROR_CHECK_TAG2 = 50;
+    public static String ERROR_HEX = "FFFF";
 
     public static double MAX_TEMP = -50.0;
     public static double MIN_TEMP = 50.0;
 
-    public static void main(String[] args) {
-        String str = "00000000FFEB90FEAA41E821EC21EA21EC21ED21EC21E921E221E921E921E921EC21E921ED21F021E521E521E221E421E321E321E121DE21D721E021DD21DC21DF21FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF";
-        System.out.println(str.substring(9*2, 10*2));
-    }
     /**
      * 00000000FFEB90FEAA41E821EC21EA21EC21ED21EC21E921E221E921E921E921EC21E921ED21F021E521E521E221E421E321E321E121DE21D721E021DD21DC21DF21FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
      *
@@ -76,59 +73,66 @@
     public void analysis(String ip, int port, String hexStr) {
 
         result += hexStr;
-        if(result.length() < 1066*2){
+        if (result.length() < 1066 * 2) {
             log.info("鍒嗘満------->>骞冲彴锛屾姤鏂囬暱搴︿笉澶燂紝绛夊緟涓嬩竴鍖呮暟鎹�");
             return;
         }
 
-        //灏佽鏁版嵁
-        ReMessage reMessage = ReMessageBuilder.getInstance().buildMessage(hexStr);
-        reMessage.setIp(ip);
-        reMessage.setPort(port);
-        log.info("鍒嗘満------->>骞冲彴锛氱伯鎯呭畬鏁存姤鏂囦俊鎭�={}", reMessage);
+        try {
 
-        if (!BeiboGrainServerUtils.MSG_START.startsWith(reMessage.getStartStr())) {
-            log.error("鍒嗘満------->>骞冲彴锛岃В鏋愮伯鎯呭け璐ワ細鎶ユ枃璧峰绗�={}閿欒锛屼笉瑙f瀽", reMessage.getStartStr());
-            return;
+
+            //灏佽鏁版嵁
+            ReMessage reMessage = ReMessageBuilder.getInstance().buildMessage(result);
+            reMessage.setIp(ip);
+            reMessage.setPort(port);
+            log.info("鍒嗘満------->>骞冲彴锛氱伯鎯呭畬鏁存姤鏂囦俊鎭�={}", reMessage);
+            result = "";
+            if (!BeiboGrainServerUtils.MSG_START.startsWith(reMessage.getStartStr())) {
+                log.error("鍒嗘満------->>骞冲彴锛岃В鏋愮伯鎯呭け璐ワ細鎶ユ枃璧峰绗�={}閿欒锛屼笉瑙f瀽", reMessage.getStartStr());
+                return;
+            }
+
+            //鏍规嵁鍒嗘満鍦板潃鑾峰彇鍒嗘満淇℃伅
+            DeviceSer ser = coreSerService.getCacheSer(ContextUtil.getDefaultCompanyId(), reMessage.getSerId());
+            if (ser == null) {
+                log.error("鍒嗘満-------->>骞冲彴锛岃В鏋愮伯鎯呭け璐ワ紝鏈幏鍙栧埌绯荤粺绮儏涓绘満閰嶇疆锛�" + reMessage.getSerId());
+                return;
+            }
+
+            List<ExeRequest> list = exeOrderService.getInProgressOrderBySerId(BizType.GRAIN.getCode(), ser.getId());
+            if (null == list || list.isEmpty()) {
+                String info = "绮儏瑙f瀽澶辫触:鍒嗘満=" + ser.getName() + "娌℃湁鑾峰彇鍒版墍灞炰粨搴撲俊鎭��";
+                log.error("鍒嗘満------>>>骞冲彴锛�" + info);
+                notifyGrainInvoker.notifyWeb(ser.getCompanyId(), OrderRespEnum.MSG_ERROR, BizType.GRAIN, info);
+                return;
+            }
+
+            ExeRequest exeRequest = list.get(0);
+            log.info("鑾峰彇绮儏鍛戒护淇℃伅={}", exeRequest);
+            if (null == exeRequest) {
+                String info = "绮儏瑙f瀽澶辫触:鍒嗘満=" + ser.getName() + "娌℃湁鑾峰彇鍘嗗彶鍛戒护銆�";
+                log.error("璐濆崥鍒嗘満------>>>骞冲彴锛�" + info);
+                return;
+            }
+
+            DepotConf depotConf = commonService.getCacheDepotConf(exeRequest.getCompanyId(), exeRequest.getDepotId());
+            if (null == depotConf) {
+                String info = "绮儏瑙f瀽澶辫触:鍒嗘満=" + ser.getName() + "娌℃湁鑾峰彇鍒扮伯鎯呭弬鏁伴厤缃俊鎭��";
+                log.error("鍒嗘満------>>>骞冲彴锛�" + info);
+                notifyGrainInvoker.notifyWeb(ser.getCompanyId(),
+                        OrderRespEnum.MSG_ERROR, BizType.GRAIN, info);
+                return;
+            }
+
+            // 棣栧厛鑾峰彇鍒扮郴缁熷弬鏁帮紝鍒ゆ柇鏄惁闇�瑕佹壒娆¤嚜鍔ㄤ紭鍖�
+            DicSysConf sysConf = commonService.getCacheSysConf(ser.getCompanyId());
+
+            reMessage.setCompanyId(ser.getCompanyId());
+            analysisGrain(depotConf, reMessage, ser, exeRequest, sysConf);
+        } catch (Exception e) {
+            result = "";
+            log.error("鍒嗘満------->>骞冲彴锛岃В鏋愮伯鎯呭紓甯革細鍘熷洜={}", e.toString());
         }
-
-        //鏍规嵁鍒嗘満鍦板潃鑾峰彇鍒嗘満淇℃伅
-        DeviceSer ser = coreSerService.getCacheSer(ContextUtil.getDefaultCompanyId(), reMessage.getSerId());
-        if (ser == null) {
-            log.error("鍒嗘満-------->>骞冲彴锛岃В鏋愮伯鎯呭け璐ワ紝鏈幏鍙栧埌绯荤粺绮儏涓绘満閰嶇疆锛�" + reMessage.getSerId());
-            return;
-        }
-
-        List<ExeRequest> list = exeOrderService.getInProgressOrderBySerId(BizType.GRAIN.getCode(), ser.getId());
-        if (null == list || list.isEmpty()) {
-            String info = "绮儏瑙f瀽澶辫触:鍒嗘満=" + ser.getName() + "娌℃湁鑾峰彇鍒版墍灞炰粨搴撲俊鎭��";
-            log.error("鍒嗘満------>>>骞冲彴锛�" + info);
-            notifyGrainInvoker.notifyWeb(ser.getCompanyId(), OrderRespEnum.MSG_ERROR, BizType.GRAIN, info);
-            return;
-        }
-
-        ExeRequest exeRequest = list.get(0);
-        log.info("鑾峰彇绮儏鍛戒护淇℃伅={}", exeRequest);
-        if (null == exeRequest) {
-            String info = "绮儏瑙f瀽澶辫触:鍒嗘満=" + ser.getName() + "娌℃湁鑾峰彇鍘嗗彶鍛戒护銆�";
-            log.error("璐濆崥鍒嗘満------>>>骞冲彴锛�" + info);
-            return;
-        }
-
-        DepotConf depotConf = commonService.getCacheDepotConf(exeRequest.getCompanyId(), exeRequest.getDepotId());
-        if (null == depotConf) {
-            String info = "绮儏瑙f瀽澶辫触:鍒嗘満=" + ser.getName() + "娌℃湁鑾峰彇鍒扮伯鎯呭弬鏁伴厤缃俊鎭��";
-            log.error("鍒嗘満------>>>骞冲彴锛�" + info);
-            notifyGrainInvoker.notifyWeb(ser.getCompanyId(),
-                    OrderRespEnum.MSG_ERROR, BizType.GRAIN, info);
-            return;
-        }
-
-        // 棣栧厛鑾峰彇鍒扮郴缁熷弬鏁帮紝鍒ゆ柇鏄惁闇�瑕佹壒娆¤嚜鍔ㄤ紭鍖�
-        DicSysConf sysConf = commonService.getCacheSysConf(ser.getCompanyId());
-
-        reMessage.setCompanyId(ser.getCompanyId());
-        analysisGrain(depotConf, reMessage, ser, exeRequest, sysConf);
     }
 
 
@@ -170,23 +174,6 @@
         }
 
         // 涓�鍒嗗嚑澶氫粨鎯呭喌锛岃�冭檻鍗曚粨閲囬泦鍜屽浠撻噰闆�
-        // 鍗曚粨閲囬泦鏃跺�欐暟鎹粠0杩斿洖
-        if (StringUtils.isEmpty(exeRequest.getDepotIds())) {
-
-            depotConf.setCableEnd(depotConf.getCableEnd() - depotConf.getCableStart() + 1);
-            depotConf.setCableStart(ser.getCableStart());
-
-            if (DepotType.TYPE_02.getCode().equals(depotConf.getDepotType())) {
-                analysisStep2(depotConf, ser, exeRequest, reMessage, sysConf);
-            } else if (DepotType.TYPE_04.getCode().equals(depotConf.getDepotType())) {
-                analysisStep2(depotConf, ser, exeRequest, reMessage, sysConf);
-            } else {
-                analysisStep1(depotConf, ser, exeRequest, reMessage, sysConf);
-            }
-
-            return;
-
-        }
 
         // 鎵归噺閲囬泦鎵�鏈夊叧鑱斾竴璧烽噰闆嗭紝閬嶅巻鎵ц
         for (DepotConf depotConfTemp : depotConfs) {
@@ -249,6 +236,10 @@
             sumNum += Integer.valueOf(cableRuleAtt[i]);
         }
 
+        if(cableZ < ser.getCableZ()){
+            cableZ = ser.getCableZ();
+        }
+
         // 鏍规嵁灞傝鍒楄幏鍙栨寚瀹氶暱搴�
         int start = 4 * (depotConf.getCableStart() - ser.getCableStart()) * cableZ;
         int len = 4 * cableZ * sumNum;
@@ -260,16 +251,29 @@
         List<Double> temps = new ArrayList<>();
         double tempValue;
         String temp;
-        int curLay = 1;//鎵�鍦ㄥ眰浠�1寮�濮�
-        int curRoot = 1;//鎵�鍦ㄦ牴
-        int curCir = 1;//鎵�鍦ㄥ湀
-        int cirLay = 1;//褰撳墠鍦堢殑灞�
+        int symbol = 0; //绗﹀彿浣�
         for (int i = 0; i < strPoints.length() / 4; i++) {
             temp = strPoints.substring(i * 4, i * 4 + 4);
             if (temp == null) {
                 temp = "0000";
             }
-            tempValue = BytesUtil.hexToInt(BytesUtil.tran_LH(temp)) / 10.0;
+            //楂樹綆浣嶈浆鎹㈠悗杞负16浣嶄簩杩涘埗瀛楃涓�
+            temp = BytesUtil.tran_LH(temp);
+            if(ERROR_HEX.equals(temp)){
+                tempValue = Constant.ERROR_TEMP;
+            }else {
+                //10杩涘埗杞�16浣嶇殑2杩涘埗
+                temp = BytesUtil.hexString2binaryString(temp, 16);
+                //绗﹀彿浣�
+                symbol = Integer.valueOf(temp.substring(0, 1));
+                //鑾峰彇娓╁害鍊�
+                tempValue = BytesUtil.biannary2Decimal(temp.substring(6)) * 0.0625;
+                //鑻ヤ负璐燂紝鍒欒ˉ鐮侊細鍙栧弽鍔�1
+                if (symbol == 1) {
+                    tempValue = ((~BytesUtil.biannary2Decimal(temp.substring(6))) + 1) * 0.0625;
+                }
+                tempValue = NumberUtil.keepPrecision(tempValue, 1);
+            }
 
             //闈炴甯稿��
             if (tempValue > ERROR_CHECK_TAG2) {
@@ -280,38 +284,7 @@
             if (tempValue >= FAULT_CHECK_TAG) {
                 tempValue = Constant.FAULT_TEMP;
             }
-
-            // 澶囩敤鍊�
-            if (tempValue == ERROR_CHECK_TAG) {
-                tempValue = Constant.ERROR_TEMP;
-
-
-                //楠岃瘉鏄笉鏄敟褰粨琛ュ伩鍊�
-                curLay = (i % layMax) + 1;
-                curRoot = (i / layMax) + 1;
-                curCir = getCurCir(curRoot, cableRuleAtt);
-
-                cirLay = Integer.valueOf(cableCirAtt[curCir - 1]);
-
-                //姣斿閰嶇疆浜�5灞備絾鏄綋鍓嶆槸6灞傦紝璇存槑褰撳墠鐐逛负琛ュ伩鐐�
-                if (curLay > cirLay) {
-                    tempValue = Constant.ADD_TEMP;
-
-                    //鍒ゆ柇鏄笉鏄笂閿ュ舰锛屽皢琛ョ偣杞Щ鍒颁笂鏂�
-                    if (Constant.CABLE_CONE_1.equals(depotConf.getCableCone())) {
-                        int index = i - curLay - 1;
-                        temps.add(index, tempValue);
-                    } else {
-                        temps.add(tempValue);
-                    }
-
-                } else {
-                    temps.add(tempValue);
-                }
-
-            } else {
-                temps.add(tempValue);
-            }
+            temps.add(tempValue);
         }
 
         log.debug("-------CheckGrainRequest--={}", exeRequest.toString());
@@ -369,12 +342,29 @@
         List<Double> temps = new ArrayList<>();
         double tempValue;
         String temp;
+        int symbol = 0;
         for (int i = 0; i < strPoints.length() / 4; i++) {
             temp = strPoints.substring(i * 4, i * 4 + 4);
             if (temp == null) {
                 temp = "0000";
             }
-            tempValue = BytesUtil.hexToInt(BytesUtil.tran_LH(temp)) / 10.0;
+
+            if(ERROR_HEX.equals(temp)){
+                tempValue = Constant.ERROR_TEMP;
+            }else {
+                //10杩涘埗杞�16浣嶇殑2杩涘埗
+                temp = BytesUtil.hexString2binaryString(temp, 16);
+                //绗﹀彿浣�
+                symbol = Integer.valueOf(temp.substring(0, 1));
+                //鑾峰彇娓╁害鍊�
+                tempValue = BytesUtil.biannary2Decimal(temp.substring(6)) * 0.0625;
+                //鑻ヤ负璐燂紝鍒欒ˉ鐮侊細鍙栧弽鍔�1
+                if (symbol == 1) {
+                    tempValue = ((~BytesUtil.biannary2Decimal(temp.substring(6))) + 1) * 0.0625;
+                }
+                tempValue = NumberUtil.keepPrecision(tempValue, 1);
+            }
+
             // 璇存槑瑙f瀽鐨勬暟鎹湁闂
             if (tempValue == ERROR_CHECK_TAG || tempValue == ERROR_CHECK_TAG2) {
                 tempValue = Constant.ERROR_TEMP;
@@ -434,10 +424,40 @@
         grain.setCompanyId(depotConf.getCompanyId());
         grain.setCable(depotConf.getCableRule());
         grain.setBatchId(msg.getBatchId());
-        grain.setTempIn(Constant.ERROR_TEMP);
-        grain.setHumidityIn(Constant.ERROR_TEMP);
 
-        grain.setReceiveDate(msg.getReceiveDate());
+        int humidity = -100;
+        int tem = -100;
+        String substring = "";
+
+        //瑙f瀽澶栨箍澶栨俯
+        String thStr = msg.getThStr().substring(6, 12);
+        humidity = BytesUtil.hexToInt(thStr.substring(0, 2));
+        grain.setHumidityOut(humidity * 1.0);
+        substring = thStr.substring(2);
+        tem = BytesUtil.hexToInt(substring);
+        grain.setTempOut(tem * 1.0);
+        if(substring.startsWith("1")){
+            grain.setTempOut(tem * -1.0);
+        }
+
+        //瑙f瀽浠撳唴娓╀粨鍐呮箍
+        int thConf = Integer.valueOf(depotConf.getThConf());
+        int start = 0, end = 6;
+        if(thConf > 1){
+            start += 6*thConf; //12-18
+            end += start;
+        }
+        thStr = msg.getThStr().substring(start, end);
+        humidity = BytesUtil.hexToInt(thStr.substring(0, 2));
+        grain.setHumidityIn(humidity * 1.0);
+        substring = thStr.substring(2);
+        tem = BytesUtil.hexToInt(substring);
+        grain.setTempIn(tem * 1.0);
+        if(substring.startsWith("1")){
+            grain.setTempIn(tem * -1.0);
+        }
+
+        grain.setReceiveDate(new Date());
         grain.setRemark("绮俯姝e父");
 
         // 鑾峰彇缂撳瓨涓殑鍛戒护淇℃伅
@@ -516,10 +536,40 @@
         grain.setCable(depotConf.getCableRule());
         grain.setCableCir(depotConf.getCableCir());
         grain.setBatchId(msg.getBatchId());
-        grain.setTempIn(Constant.ERROR_TEMP);
-        grain.setHumidityIn(Constant.ERROR_TEMP);
 
-        grain.setReceiveDate(msg.getReceiveDate());
+        int humidity = -100;
+        int tem = -100;
+        String substring = "";
+
+        //瑙f瀽澶栨箍澶栨俯
+        String thStr = msg.getThStr().substring(6, 12);
+        humidity = BytesUtil.hexToInt(thStr.substring(0, 2));
+        grain.setHumidityOut(humidity * 1.0);
+        substring = thStr.substring(2);
+        tem = BytesUtil.hexToInt(substring);
+        grain.setTempOut(tem * 1.0);
+        if(substring.startsWith("1")){
+            grain.setTempOut(tem * -1.0);
+        }
+
+        //瑙f瀽浠撳唴娓╀粨鍐呮箍
+        int thConf = Integer.valueOf(depotConf.getThConf());
+        int start = 0, end = 6;
+        if(thConf > 1){
+            start += 6*thConf; //12-18
+            end += start;
+        }
+        thStr = msg.getThStr().substring(start, end);
+        humidity = BytesUtil.hexToInt(thStr.substring(0, 2));
+        grain.setHumidityIn(humidity * 1.0);
+        substring = thStr.substring(2);
+        tem = BytesUtil.hexToInt(substring);
+        grain.setTempIn(tem * 1.0);
+        if(substring.startsWith("1")){
+            grain.setTempIn(tem * -1.0);
+        }
+
+        grain.setReceiveDate(new Date());
         grain.setRemark("绮俯姝e父");
         grain.setCheckUser(exeRequest.getExeUser());
 
@@ -565,6 +615,17 @@
         grain.setTempMax(max);
         grain.setTempMin(min);
         grain.setPoints(StringUtils.join(temps, ","));
+        //鍒ゆ柇鏄惁鏄敟褰粨锛屾槸鐨勮瘽杩涜閿ュ舰浠撹ˉ鐐�
+        if(StringUtils.isNotEmpty(depotConf.getCableCone())){
+            //涓婇敟褰㈣ˉ鐐�
+            if(Constant.CABLE_CONE_1.equals(depotConf.getCableCone())){
+                grain.setPoints(upConePoints(depotConf, grain.getPoints()));
+            }
+            //涓嬮敟褰㈣ˉ鐐�
+            if(Constant.CABLE_CONE_2.equals(depotConf.getCableCone())){
+                grain.setPoints(downConePoints(depotConf, grain.getPoints()));
+            }
+        }
 
         String depotIds = exeRequest.getDepotIds();
         boolean notifyWeb = true;
@@ -656,11 +717,85 @@
         return temps;
     }
 
-    private String buildCurKey(ReMessage msg, int curPacket) {
-        return msg.getSerId() + "_" + curPacket;
+    /**
+     * 涓婇敟褰㈣ˉ鐐�(鐐逛綅浣嶇疆姝g‘锛岄渶瑕佽ˉ鐐逛负-102)
+     *
+     * @param depotConf
+     * @param points
+     * @return
+     */
+    private String upConePoints(DepotConf depotConf, String points){
+        String[] cableRuleAtt = depotConf.getCableRule().split("-");
+        String[] cableCirAtt = depotConf.getCableCir().split("-");
+        //鑾峰彇鏈�澶х殑灞傞厤缃�
+        int layMax = Integer.valueOf(cableCirAtt[0]);
+        for (int i = 0; i < cableCirAtt.length; i++) {
+            if (Integer.valueOf(cableCirAtt[i]) >= layMax) {
+                layMax = Integer.valueOf(cableCirAtt[i]);
+            }
+        }
+        //鎵�鍦ㄥ眰浠�1寮�濮�
+        int curLay = 1;
+        //鎵�鍦ㄦ牴
+        int curRoot = 1;
+        //鎵�鍦ㄥ湀
+        int curCir = 1;
+        //褰撳墠鍦堢殑灞�
+        int cirLay = 1;
+        String[] array = points.split(",");
+
+        for (int i = 0; i < array.length; i++) {
+            curLay = (i % layMax) + 1;
+            curRoot = (i / layMax) + 1;
+            curCir = getCurCir(curRoot, cableRuleAtt);
+            cirLay = Integer.valueOf(cableCirAtt[curCir - 1]);
+
+            //姣斿閰嶇疆浜�5灞備絾鏄綋鍓嶆槸6灞傦紝璇存槑褰撳墠鐐逛负琛ュ伩鐐�
+            if (curLay <= (layMax - cirLay)) {
+                array[i] = String.valueOf(Constant.ADD_TEMP);
+            }
+        }
+        return StringUtils.join(array, ",");
     }
 
-    private String buildContextKey(String companyId, String serId) {
-        return companyId + "_" + serId;
+    /**
+     * 涓嬮敟褰㈣ˉ鐐�(鐐逛綅浣嶇疆姝g‘锛岄渶瑕佽ˉ鐐逛负-102)
+     *
+     * @param depotConf
+     * @param points
+     * @return
+     */
+    private String downConePoints(DepotConf depotConf, String points){
+        String[] cableRuleAtt = depotConf.getCableRule().split("-");
+        String[] cableCirAtt = depotConf.getCableCir().split("-");
+        //鑾峰彇鏈�澶х殑灞傞厤缃�
+        int layMax = Integer.valueOf(cableCirAtt[0]);
+        for (int i = 0; i < cableCirAtt.length; i++) {
+            if (Integer.valueOf(cableCirAtt[i]) >= layMax) {
+                layMax = Integer.valueOf(cableCirAtt[i]);
+            }
+        }
+        //鎵�鍦ㄥ眰浠�1寮�濮�
+        int curLay = 1;
+        //鎵�鍦ㄦ牴
+        int curRoot = 1;
+        //鎵�鍦ㄥ湀
+        int curCir = 1;
+        //褰撳墠鍦堢殑灞�
+        int cirLay = 1;
+        String[] array = points.split(",");
+
+        for (int i = 0; i < array.length; i++) {
+            curLay = (i % layMax) + 1;
+            curRoot = (i / layMax) + 1;
+            curCir = getCurCir(curRoot, cableRuleAtt);
+            cirLay = Integer.valueOf(cableCirAtt[curCir - 1]);
+
+            //姣斿閰嶇疆浜�5灞備絾鏄綋鍓嶆槸6灞傦紝璇存槑褰撳墠鐐逛负琛ュ伩鐐�
+            if (curLay > cirLay) {
+                array[i] = String.valueOf(Constant.ADD_TEMP);
+            }
+        }
+        return StringUtils.join(array, ",");
     }
 }

--
Gitblit v1.9.3