From f547f03e3fbd8372a23e2830738491f30edd2457 Mon Sep 17 00:00:00 2001 From: "2265829957@qq.com" <2265829957@qq.com> Date: Fri, 4 Jul 2025 16:22:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=A0=E4=BD=8D=E8=B4=B9?= =?UTF-8?q?=E5=92=8C=E5=A2=9E=E5=8A=A0=E6=8A=A5=E6=96=87=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../card/controller/AnalyzeTheMessage.java | 60 +- .../service/IAnalyzeTheMessageService.java | 59 + .../impl/AnalyzeTheMessageServiceImpl.java | 3767 ++++++++++++++++- .../java/com/xhpc/card/utils/CP56Time2a.java | 246 ++ .../XhpcTimingChargingModelServiceImpl.java | 24 +- .../mapper/XhpcTimingChargingModelMapper.xml | 10 +- .../logic/BmsReqChargerOutputDataLogic.java | 8 + .../user/api/XhpcInvoiceApiController.java | 16 + .../user/mapper/XhpcHistoryOrderMapper.java | 2 +- .../java/com/xhpc/user/pojo/XhpcInvoice.java | 2 +- .../service/impl/XhpcInvoiceServiceImpl.java | 82 +- .../mapper/XhpcHistoryOrderMapper.xml | 6 +- 12 files changed, 4233 insertions(+), 49 deletions(-) create mode 100644 xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/utils/CP56Time2a.java diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/controller/AnalyzeTheMessage.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/controller/AnalyzeTheMessage.java index a3b417f2..36bcefd4 100644 --- a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/controller/AnalyzeTheMessage.java +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/controller/AnalyzeTheMessage.java @@ -47,8 +47,64 @@ public class AnalyzeTheMessage extends BaseController { return analyzeTheMessageService.getRateModelRequestLogic(content); case "0A": return analyzeTheMessageService.getReplyRateModelRequestLogic(content); - - + case "13": + return analyzeTheMessageService.getRealtimeDataLogic(content); + case "15": + return analyzeTheMessageService.getBmsChargingHandshakeDataLogic(content); + case "17": + return analyzeTheMessageService.getBmsChargingConfigDataLogic(content); + case "19": + return analyzeTheMessageService.getBmsChargingCompletedDataLogic(content); + case "1B": + return analyzeTheMessageService.getBmsErrorDataLogic(content); + case "1D": + return analyzeTheMessageService.getBmsInterruptDataLogic(content); + case "21": + return analyzeTheMessageService.getBmsChargerInterruptDataLogic(content); + case "23": + return analyzeTheMessageService.getBmsReqChargerOutputDataLogic(content); + case "25": + return analyzeTheMessageService.getBmsChargingDataLogic(content); + case "31": + return analyzeTheMessageService.getPileStartChargingDataLogic(content); + case "32": + return analyzeTheMessageService.getReplyPileStartChargingDataLogic(content); + case "33": + return analyzeTheMessageService.getRemoteStartReplyDataLogic(content); + case "38": + return analyzeTheMessageService.getReplyRemoteStartReplyDataLogic(content); + case "35": + return analyzeTheMessageService.getRemoteStopReplyDataLogic(content); + case "36": + return analyzeTheMessageService.getReplyRemoteStopReplyDataLogic(content); + case "3B": + return analyzeTheMessageService.getOrderDataLogic(content); + case "40": + return analyzeTheMessageService.getReplyOrderDataLogic(content); + case "41": + return analyzeTheMessageService.getBalanceUpdateReplyDataLogic(content); + case "42": + return analyzeTheMessageService.getReplyBalanceUpdateReplyDataLogic(content); + case "51": + return analyzeTheMessageService.getPileConfigReplyDataLogic(content); + case "52": + return analyzeTheMessageService.getReplyPileConfigReplyDataLogic(content); + case "55": + return analyzeTheMessageService.getPileTimeConfigReplyDataLogic(content); + case "56": + return analyzeTheMessageService.getReplyPileTimeConfigReplyDataLogic(content); + case "57": + return analyzeTheMessageService.getRateModelConfigReplyDataLogic(content); + case "58": + return analyzeTheMessageService.getReplyRateModelConfigReplyDataLogic(content); + case "91": + return analyzeTheMessageService.getRemoteRebootReplyDataLogic(content); + case "92": + return analyzeTheMessageService.getReplyRemoteRebootReplyDataLogic(content); + case "93": + return analyzeTheMessageService.getRemoteUpgradeReplyDataLogic(content); + case "94": + return analyzeTheMessageService.getRemoteUpgradeDataLogic(content); default: return R.fail("请输入正确的报文"); diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/IAnalyzeTheMessageService.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/IAnalyzeTheMessageService.java index e9f66ea5..25bb8a11 100644 --- a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/IAnalyzeTheMessageService.java +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/IAnalyzeTheMessageService.java @@ -24,4 +24,63 @@ public interface IAnalyzeTheMessageService { R getRateModelRequestLogic(String content); R getReplyRateModelRequestLogic(String content); + + R getRealtimeDataLogic(String content); + + R getBmsChargingHandshakeDataLogic(String content); + + R getBmsChargingConfigDataLogic(String content); + + R getBmsChargingCompletedDataLogic(String content); + + R getBmsErrorDataLogic(String content); + + R getBmsInterruptDataLogic(String content); + + R getBmsChargerInterruptDataLogic(String content); + + R getBmsReqChargerOutputDataLogic(String content); + + R getBmsChargingDataLogic(String content); + + R getPileStartChargingDataLogic(String content); + + R getReplyPileStartChargingDataLogic(String content); + + R getRemoteStartReplyDataLogic(String content); + + R getReplyRemoteStartReplyDataLogic(String content); + + R getRemoteStopReplyDataLogic(String content); + + R getReplyRemoteStopReplyDataLogic(String content); + + R getOrderDataLogic(String content); + + R getReplyOrderDataLogic(String content); + + R getBalanceUpdateReplyDataLogic(String content); + + R getReplyBalanceUpdateReplyDataLogic(String content); + + R getPileConfigReplyDataLogic(String content); + + R getReplyPileConfigReplyDataLogic(String content); + + R getPileTimeConfigReplyDataLogic(String content); + + R getReplyPileTimeConfigReplyDataLogic(String content); + + R getRateModelConfigReplyDataLogic(String content); + + R getReplyRateModelConfigReplyDataLogic(String content); + + R getRemoteRebootReplyDataLogic(String content); + + R getReplyRemoteRebootReplyDataLogic(String content); + + R getRemoteUpgradeReplyDataLogic(String content); + + R getRemoteUpgradeDataLogic(String content); + } diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/AnalyzeTheMessageServiceImpl.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/AnalyzeTheMessageServiceImpl.java index 60820456..85002b99 100644 --- a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/AnalyzeTheMessageServiceImpl.java +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/AnalyzeTheMessageServiceImpl.java @@ -1,12 +1,18 @@ package com.xhpc.card.service.impl; +import cn.hutool.core.date.DateUtil; import com.xhpc.card.service.IAnalyzeTheMessageService; +import com.xhpc.card.utils.CP56Time2a; import com.xhpc.common.core.domain.R; +import com.xhpc.pp.utils.BMSCurrentParser; import com.xhpc.pp.utils.HexUtils; import org.springframework.stereotype.Service; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.*; +import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMATTER; import static com.xhpc.pp.utils.HexUtils.toBytes; /** @@ -15,8 +21,79 @@ import static com.xhpc.pp.utils.HexUtils.toBytes; */ @Service public class AnalyzeTheMessageServiceImpl implements IAnalyzeTheMessageService { - - + private static Map SM = new HashMap<>(); + static { + SM.put("40", "APP 远程停止(0X40)"); + SM.put("41", "SOC 达到 100%(0X41)"); + SM.put("42", "充电电量满足设定条件(0X42)"); + SM.put("43", "充电金额满足设定条件(0X43)"); + SM.put("44", "充电时间满足设定条件(0X44)"); + SM.put("45", "手动停止充电(0X45)"); + SM.put("4A", "充电桩控制系统故障(需要重启或自动恢复)(0X4A)"); + SM.put("4B", "控制导引断开(0X4B)"); + SM.put("4C", "断路器跳位(0X4C)"); + SM.put("4D", "电表通信中断(0X4D)"); + SM.put("4E", "余额不足(0X4E)"); + SM.put("4F", "充电模块故障(0X4F)"); + SM.put("50", "急停开入(0X50)"); + SM.put("51", "防雷器异常(0X5)"); + SM.put("52", "BMS 未就绪(0X52)"); + SM.put("53", "温度异常(0X53)"); + SM.put("54", "电池反接故障(0X54)"); + SM.put("55", "电子锁异常(0X55)"); + SM.put("56", "合闸失败(0X56)"); + SM.put("57", "绝缘异常(0X57)"); + SM.put("59", "接收 BMS 握手报文 BHM 超时(0X59)"); + SM.put("5A", "接收 BMS 和车辆的辨识报文超时 BRM(0X5A)"); + SM.put("5B", "接收电池充电参数报文超时 BCP(0X5B)"); + SM.put("5C", "接收 BMS 完成充电准备报文超时 BRO AA(0X5C)"); + SM.put("5D", "接收电池充电总状态报文超时 BCS(0X5D)"); + SM.put("5E", "接收电池充电要求报文超时 BCL(0X5E)"); + SM.put("5F", "接收电池状态信息报文超时 BSM(0X5F)"); + SM.put("60", "GB2015 电池在BHM 阶段有电压不允许充电(0X60)"); + SM.put("61", "GB2015 辨识阶段在 BRO_AA 时候电池实际电压与 BCP 报文电池电压差距大于 5%(0X61)"); + SM.put("62", "B2015 充电机在预充电阶段从 BRO_AA 变成BRO_00 状态(0X62)"); + SM.put("63", "接收主机配置报文超时(0X63)"); + SM.put("64", "充电机未准备就绪,我们没有回 CRO AA,对应老国标(0X64)"); + SM.put("6A", "系统闭锁(0X6A)"); + SM.put("6B", "导引断开(0X6B)"); + SM.put("6C", "断路器跳位(0X6C)"); + SM.put("6D", "电表通信中断(0X6D)"); + SM.put("6E", "余额不足(0X6E)"); + SM.put("6F", "交流保护动作(0X6F)"); + SM.put("70", "直流保护动作(0X70)"); + SM.put("71", "充电模块故障(0X71)"); + SM.put("72", "急停按钮停止充电(0X72)"); + SM.put("73", "防雷器异常(0X73)"); + SM.put("74", "温度异常(0X74)"); + SM.put("75", "输出异常(0X75)"); + SM.put("76", "充电无流(0X76)"); + SM.put("77", "电子锁异常(0X77)"); + SM.put("78", "预留(0X78)"); + SM.put("79", "总充电电压异常(0X79)"); + SM.put("7A", "总充电电流异常(0X7A)"); + SM.put("7B", "单体充电电压异常(0X7B)"); + SM.put("7C", "电池组过温(0X7C)"); + SM.put("7D", "最高单体充电电压异常(0X7D)"); + SM.put("7E", "最高电池组过温(0X7E)"); + SM.put("7F", "BMV 单体充电电压异常(0X7F)"); + SM.put("80", "BMT 电池组过温(0X80)"); + SM.put("81", "电池状态异常停止充电(0X81)"); + SM.put("82", "车辆发报文禁止充电(0X82)"); + SM.put("83", "充电桩断电(0X83)"); + SM.put("84", "接收电池充电总状态报文超时(0X84)"); + SM.put("85", "接收电池充电要求报文超时(0X85)"); + SM.put("86", "接收电池状态信息报文超时(0X86)"); + SM.put("87", "接收 BMS 中止充电报文超时(0X87)"); + SM.put("88", "接收 BMS 充电统计报文超时(0X88)"); + SM.put("89", "接收对侧 CCS 报文超时(0X89)"); + SM.put("90", "未知原因中止(0X90)"); + SM.put("91", "平台结算(0X91)"); + SM.put("92", "远程重启(0X92)"); + SM.put("93", "远程更新应答(0X93)"); + SM.put("94", "远程更新(0X94)"); + SM.put("199", "平台空订单(0X199)"); + } @Override public R getRegisterLogic(String content) { @@ -56,7 +133,7 @@ public class AnalyzeTheMessageServiceImpl implements IAnalyzeTheMessageService { int version = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); Map map3 =new LinkedHashMap<>(); map3.put("title","通讯协议版本"); - map3.put("content",version/10); + map3.put("content","V"+new BigDecimal(version).divide(new BigDecimal(10)).setScale(2,BigDecimal.ROUND_DOWN)); list.add(map3); idxStart = idxStart+2; @@ -88,7 +165,14 @@ public class AnalyzeTheMessageServiceImpl implements IAnalyzeTheMessageService { idxStart = idxStart+2; Map map6 =new LinkedHashMap<>(); map6.put("title","Sim 卡"); - map6.put("content",content.substring(idxStart,20+idxStart)); + String substring = content.substring(idxStart, 20 + idxStart); + + if("000000000000000000".equals(substring)){ + map6.put("content","无"); + }else{ + map6.put("content",substring); + } + list.add(map6); idxStart = idxStart+20; @@ -164,7 +248,12 @@ public class AnalyzeTheMessageServiceImpl implements IAnalyzeTheMessageService { Map map1 =new LinkedHashMap<>(); map1.put("title","抢号"); - map1.put("content",content.substring(28,30)); + String substring = content.substring(idxStart, 2 + idxStart); + if("01".equals(substring)){ + map1.put("content","A枪"); + }else{ + map1.put("content","B枪"); + } list.add(map1); idxStart = idxStart+2; @@ -201,15 +290,19 @@ public class AnalyzeTheMessageServiceImpl implements IAnalyzeTheMessageService { idxStart = idxStart+14; Map map1 =new LinkedHashMap<>(); map1.put("title","抢号"); - map1.put("content",content.substring(28,30)); - list.add(map1); + String substring = content.substring(idxStart, 2 + idxStart); + if("01".equals(substring)){ + map1.put("content","A枪"); + }else{ + map1.put("content","B枪"); + } idxStart = idxStart+2; - int bmsVoltageRequest = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + //int bmsVoltageRequest = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); Map map2 =new LinkedHashMap<>(); map2.put("title","心跳应答"); - map2.put("content",bmsVoltageRequest); + map2.put("content","置零"); list.add(map2); jiexi.put("analysis",list); @@ -235,9 +328,12 @@ public class AnalyzeTheMessageServiceImpl implements IAnalyzeTheMessageService { int bmsVoltageRequest = HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); Map map2 =new LinkedHashMap<>(); map2.put("title","计费模型编号"); - map2.put("content",bmsVoltageRequest); + if(bmsVoltageRequest==0){ + map2.put("content","首次连接到平台时置零"); + }else{ + map2.put("content",bmsVoltageRequest); + } list.add(map2); - jiexi.put("analysis",list); return R.ok(jiexi); } @@ -315,29 +411,3652 @@ public class AnalyzeTheMessageServiceImpl implements IAnalyzeTheMessageService { idxStart = idxStart+14; int bmsVoltageRequest = HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map0 =new LinkedHashMap<>(); + map0.put("title","计费模型编号"); + map0.put("content",bmsVoltageRequest); + list.add(map0); + + + BigDecimal bigDecimal = new BigDecimal(100000); + idxStart = idxStart+8; + int t1= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); Map map1 =new LinkedHashMap<>(); - map1.put("title","计费模型编号"); - map1.put("content",bmsVoltageRequest); + map1.put("title","尖费电费费率"); + map1.put("content",new BigDecimal(t1).divide(bigDecimal).setScale(5,BigDecimal.ROUND_DOWN)+"元/度"); list.add(map1); idxStart = idxStart+8; - int t1= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); - - - + int t2= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); Map map2 =new LinkedHashMap<>(); - if(t1==0){ - map2.put("title","验证结果"); - map2.put("content","桩计费模型与平台一致"); - list.add(map2); + map2.put("title","尖服务费费率"); + map2.put("content",new BigDecimal(t2).divide(bigDecimal).setScale(5,BigDecimal.ROUND_DOWN)+"元/度"); + list.add(map2); + + idxStart = idxStart+8; + int t3= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map3 =new LinkedHashMap<>(); + map3.put("title","峰电费费率"); + map3.put("content",new BigDecimal(t3).divide(bigDecimal).setScale(5,BigDecimal.ROUND_DOWN)+"元/度"); + list.add(map3); + + idxStart = idxStart+8; + int t4= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map4 =new LinkedHashMap<>(); + map4.put("title","峰服务费费率"); + map4.put("content",new BigDecimal(t4).divide(bigDecimal).setScale(5,BigDecimal.ROUND_DOWN)+"元/度"); + list.add(map4); + + idxStart = idxStart+8; + int t5= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map5 =new LinkedHashMap<>(); + map5.put("title","平电费费率"); + map5.put("content",new BigDecimal(t5).divide(bigDecimal).setScale(5,BigDecimal.ROUND_DOWN)+"元/度"); + list.add(map5); + + idxStart = idxStart+8; + int t6= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map6 =new LinkedHashMap<>(); + map6.put("title","平服务费费率"); + map6.put("content",new BigDecimal(t6).divide(bigDecimal).setScale(5,BigDecimal.ROUND_DOWN)+"元/度"); + list.add(map6); + + idxStart = idxStart+8; + int t7= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map7 =new LinkedHashMap<>(); + map7.put("title","谷电费费率"); + map7.put("content",new BigDecimal(t7).divide(bigDecimal).setScale(5,BigDecimal.ROUND_DOWN)+"元/度"); + list.add(map7); + + idxStart = idxStart+8; + int t8= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map8 =new LinkedHashMap<>(); + map8.put("title","谷服务费费率"); + map8.put("content",new BigDecimal(t8).divide(bigDecimal).setScale(5,BigDecimal.ROUND_DOWN)+"元/度"); + list.add(map8); + + idxStart = idxStart+8; + int t9= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map9 =new LinkedHashMap<>(); + map9.put("title","计损比例"); + map9.put("content",t9); + list.add(map9); + + idxStart = idxStart+2; + int rate0= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate0 =new LinkedHashMap<>(); + mapRate0.put("title","0:00~0:30 时段费率号"); + mapRate0.put("content",rateName(rate0)); + list.add(mapRate0); + + idxStart = idxStart+2; + int rate1= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate1 =new LinkedHashMap<>(); + mapRate1.put("title","0:30~1:00 时段费率号"); + mapRate1.put("content",rateName(rate1)); + list.add(mapRate1); + + idxStart = idxStart+2; + int rate2= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate2 =new LinkedHashMap<>(); + mapRate2.put("title","1:00~1:30 时段费率号"); + mapRate2.put("content",rateName(rate2)); + list.add(mapRate2); + + idxStart = idxStart+2; + int rate3= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate3 =new LinkedHashMap<>(); + mapRate3.put("title","1:30~2:00 时段费率号"); + mapRate3.put("content",rateName(rate3)); + list.add(mapRate3); + + idxStart = idxStart+2; + int rate4= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate4 =new LinkedHashMap<>(); + mapRate4.put("title","2:00~2:30 时段费率号"); + mapRate4.put("content",rateName(rate4)); + list.add(mapRate4); + + idxStart = idxStart+2; + int rate5= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate5 =new LinkedHashMap<>(); + mapRate5.put("title","2:30~3:00 时段费率号"); + mapRate5.put("content",rateName(rate5)); + list.add(mapRate5); + + idxStart = idxStart+2; + int rate6= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate6 =new LinkedHashMap<>(); + mapRate6.put("title","3:00~3:30 时段费率号"); + mapRate6.put("content",rateName(rate6)); + list.add(mapRate6); + + idxStart = idxStart+2; + int rate7= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate7 =new LinkedHashMap<>(); + mapRate7.put("title","3:30~4:00 时段费率号"); + mapRate7.put("content",rateName(rate7)); + list.add(mapRate7); + + idxStart = idxStart+2; + int rate8= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate8 =new LinkedHashMap<>(); + mapRate8.put("title","4:00~4:30 时段费率号"); + mapRate8.put("content",rateName(rate8)); + list.add(mapRate8); + + idxStart = idxStart+2; + int rate9= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate9 =new LinkedHashMap<>(); + mapRate9.put("title","4:30~5:00 时段费率号"); + mapRate9.put("content",rateName(rate9)); + list.add(mapRate9); + + idxStart = idxStart+2; + int rate10= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate10 =new LinkedHashMap<>(); + mapRate10.put("title","5:00~5:30 时段费率号"); + mapRate10.put("content",rateName(rate10)); + list.add(mapRate10); + + idxStart = idxStart+2; + int rate11= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate11 =new LinkedHashMap<>(); + mapRate11.put("title","5:30~6:00 时段费率号"); + mapRate11.put("content",rateName(rate11)); + list.add(mapRate11); + + idxStart = idxStart+2; + int rate12= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate12 =new LinkedHashMap<>(); + mapRate12.put("title","6:00~6:30 时段费率号"); + mapRate12.put("content",rateName(rate12)); + list.add(mapRate12); + + idxStart = idxStart+2; + int rate13= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate13 =new LinkedHashMap<>(); + mapRate13.put("title","6:30~7:00 时段费率号"); + mapRate13.put("content",rateName(rate13)); + list.add(mapRate13); + + idxStart = idxStart+2; + int rate14= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate14 =new LinkedHashMap<>(); + mapRate14.put("title","7:00~7:30 时段费率号"); + mapRate14.put("content",rateName(rate14)); + list.add(mapRate14); + + idxStart = idxStart+2; + int rate15= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate15 =new LinkedHashMap<>(); + mapRate15.put("title","7:30~8:00 时段费率号"); + mapRate15.put("content",rateName(rate15)); + list.add(mapRate15); + + idxStart = idxStart+2; + int rate16= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate16 =new LinkedHashMap<>(); + mapRate16.put("title","8:00~8:30 时段费率号"); + mapRate16.put("content",rateName(rate16)); + list.add(mapRate16); + + idxStart = idxStart+2; + int rate17= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate17 =new LinkedHashMap<>(); + mapRate17.put("title","8:30~9:00 时段费率号"); + mapRate17.put("content",rateName(rate17)); + list.add(mapRate17); + + idxStart = idxStart+2; + int rate18= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate18 =new LinkedHashMap<>(); + mapRate18.put("title","9:00~9:30 时段费率号"); + mapRate18.put("content",rateName(rate18)); + list.add(mapRate18); + + idxStart = idxStart+2; + int rate19= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate19 =new LinkedHashMap<>(); + mapRate19.put("title","9:30~10:00 时段费率号"); + mapRate19.put("content",rateName(rate19)); + list.add(mapRate19); + + idxStart = idxStart+2; + int rate20= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate20 =new LinkedHashMap<>(); + mapRate20.put("title","10:00~10:30 时段费率号"); + mapRate20.put("content",rateName(rate20)); + list.add(mapRate20); + + idxStart = idxStart+2; + int rate21= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate21 =new LinkedHashMap<>(); + mapRate21.put("title","10:30~11:00 时段费率号"); + mapRate21.put("content",rateName(rate21)); + list.add(mapRate21); + + idxStart = idxStart+2; + int rate22= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate22 =new LinkedHashMap<>(); + mapRate22.put("title","11:00~11:30 时段费率号"); + mapRate22.put("content",rateName(rate22)); + list.add(mapRate22); + + idxStart = idxStart+2; + int rate23= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate23 =new LinkedHashMap<>(); + mapRate23.put("title","11:30~12:00 时段费率号"); + mapRate23.put("content",rateName(rate23)); + list.add(mapRate23); + + idxStart = idxStart+2; + int rate24= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate24 =new LinkedHashMap<>(); + mapRate24.put("title","12:00~12:30 时段费率号"); + mapRate24.put("content",rateName(rate24)); + list.add(mapRate24); + + idxStart = idxStart+2; + int rate25= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate25 =new LinkedHashMap<>(); + mapRate25.put("title","12:30~13:00 时段费率号"); + mapRate25.put("content",rateName(rate25)); + list.add(mapRate25); + + idxStart = idxStart+2; + int rate26= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRat26 =new LinkedHashMap<>(); + mapRat26.put("title","13:00~13:30 时段费率号"); + mapRat26.put("content",rateName(rate26)); + list.add(mapRat26); + + idxStart = idxStart+2; + int rate27= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate27 =new LinkedHashMap<>(); + mapRate27.put("title","13:30~14:00 时段费率号"); + mapRate27.put("content",rateName(rate27)); + list.add(mapRate27); + + idxStart = idxStart+2; + int rate28= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate28 =new LinkedHashMap<>(); + mapRate28.put("title","14:00~14:30 时段费率号"); + mapRate28.put("content",rateName(rate28)); + list.add(mapRate28); + + idxStart = idxStart+2; + int rate29= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate29 =new LinkedHashMap<>(); + mapRate29.put("title","14:30~15:00 时段费率号"); + mapRate29.put("content",rateName(rate29)); + list.add(mapRate29); + + idxStart = idxStart+2; + int rate30= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate30 =new LinkedHashMap<>(); + mapRate30.put("title","15:00~15:30 时段费率号"); + mapRate30.put("content",rateName(rate30)); + list.add(mapRate30); + + idxStart = idxStart+2; + int rate31= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate31 =new LinkedHashMap<>(); + mapRate31.put("title","15:30~16:00 时段费率号"); + mapRate31.put("content",rateName(rate31)); + list.add(mapRate31); + + idxStart = idxStart+2; + int rate32= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate32 =new LinkedHashMap<>(); + mapRate32.put("title","16:00~16:30 时段费率号"); + mapRate32.put("content",rateName(rate32)); + list.add(mapRate32); + + idxStart = idxStart+2; + int rate33= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate33 =new LinkedHashMap<>(); + mapRate33.put("title","16:30~17:00 时段费率号"); + mapRate33.put("content",rateName(rate33)); + list.add(mapRate33); + + idxStart = idxStart+2; + int rate34= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate34 =new LinkedHashMap<>(); + mapRate34.put("title","17:00~17:30 时段费率号"); + mapRate34.put("content",rateName(rate34)); + list.add(mapRate34); + + idxStart = idxStart+2; + int rate35= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate35 =new LinkedHashMap<>(); + mapRate35.put("title","17:30~18:00 时段费率号"); + mapRate35.put("content",rateName(rate35)); + list.add(mapRate35); + + idxStart = idxStart+2; + int rate36= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate36 =new LinkedHashMap<>(); + mapRate36.put("title","18:00~18:30 时段费率号"); + mapRate36.put("content",rateName(rate36)); + list.add(mapRate36); + + idxStart = idxStart+2; + int rate37= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate37 =new LinkedHashMap<>(); + mapRate37.put("title","18:30~19:00 时段费率号"); + mapRate37.put("content",rateName(rate37)); + list.add(mapRate37); + + idxStart = idxStart+2; + int rate38= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate38 =new LinkedHashMap<>(); + mapRate38.put("title","19:00~19:30 时段费率号"); + mapRate38.put("content",rateName(rate38)); + list.add(mapRate38); + + idxStart = idxStart+2; + int rate39= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate39 =new LinkedHashMap<>(); + mapRate39.put("title","19:30~20:00 时段费率号"); + mapRate39.put("content",rateName(rate39)); + list.add(mapRate39); + + idxStart = idxStart+2; + int rate40= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate40 =new LinkedHashMap<>(); + mapRate40.put("title","20:00~20:30 时段费率号"); + mapRate40.put("content",rateName(rate40)); + list.add(mapRate40); + + idxStart = idxStart+2; + int rate41= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate41 =new LinkedHashMap<>(); + mapRate41.put("title","20:30~21:00 时段费率号"); + mapRate41.put("content",rateName(rate41)); + list.add(mapRate41); + + idxStart = idxStart+2; + int rate42= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate42 =new LinkedHashMap<>(); + mapRate42.put("title","21:00~21:30 时段费率号"); + mapRate42.put("content",rateName(rate42)); + list.add(mapRate42); + + idxStart = idxStart+2; + int rate43= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate43 =new LinkedHashMap<>(); + mapRate43.put("title","21:30~21:00 时段费率号"); + mapRate43.put("content",rateName(rate43)); + list.add(mapRate43); + + idxStart = idxStart+2; + int rate44= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate44 =new LinkedHashMap<>(); + mapRate44.put("title","22:00~22:30 时段费率号"); + mapRate44.put("content",rateName(rate44)); + list.add(mapRate44); + + idxStart = idxStart+2; + int rate45= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate45 =new LinkedHashMap<>(); + mapRate45.put("title","22:30~22:00 时段费率号"); + mapRate45.put("content",rateName(rate45)); + list.add(mapRate45); + + idxStart = idxStart+2; + int rate46= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate46 =new LinkedHashMap<>(); + mapRate46.put("title","23:00~23:30 时段费率号"); + mapRate46.put("content",rateName(rate46)); + list.add(mapRate46); + + idxStart = idxStart+2; + int rate47= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate47 =new LinkedHashMap<>(); + mapRate47.put("title","23:30~00:00 时段费率号"); + mapRate47.put("content",rateName(rate47)); + list.add(mapRate47); + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getRealtimeDataLogic(String content) { + Map jiexi =new HashMap<>(); + + jiexi.put("name","上传实时数据(0x13)"); + jiexi.put("content",content); + jiexi.put("response","周期上送、变位上送"); + List> list = new LinkedList<>(); + int idxStart = 12; + Map map =new LinkedHashMap<>(); + map.put("title","交易流水号"); + map.put("content",content.substring(12,44)); + list.add(map); + idxStart = idxStart+32; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + idxStart = idxStart+14; + + Map map001 =new LinkedHashMap<>(); + map001.put("title","抢号"); + String substring = content.substring(idxStart, 2 + idxStart); + if("01".equals(substring)){ + map001.put("content","A枪"); }else{ - map2.put("title","验证结果"); - map2.put("content","桩计费模型与平台不一致"); - list.add(map2); + map001.put("content","B枪"); + } + list.add(map001); + + idxStart = idxStart+2; + int t1= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map1 =new LinkedHashMap<>(); + map1.put("title","状态"); + if(t1==0){ + map1.put("content","离线"); + }else if(t1==1){ + map1.put("content","故障"); + }else if(t1==2){ + map1.put("content","空闲"); + }else if(t1==3){ + map1.put("content","充电"); + }else{ + map1.put("content","其他状态"); + } + list.add(map1); + + idxStart = idxStart+2; + int t2= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map2 =new LinkedHashMap<>(); + map2.put("title","枪是否归位"); + if(t2==0){ + map2.put("content","否"); + }else if(t2==1){ + map2.put("content","是"); + }else{ + map2.put("content","未知"); + } + list.add(map2); + + idxStart = idxStart+2; + int t3= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map3 =new LinkedHashMap<>(); + map3.put("title","是否插枪"); + if(t3==0){ + map3.put("content","否"); + }else{ + map3.put("content","是"); + } + list.add(map3); + + idxStart = idxStart+2; + int t4= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map4 =new LinkedHashMap<>(); + map4.put("title","输出电压"); + map4.put("content",new BigDecimal(t4).divide(new BigDecimal(10)).setScale(2,BigDecimal.ROUND_DOWN)); + list.add(map4); + + + idxStart = idxStart+4; + int t5= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map5 =new LinkedHashMap<>(); + map5.put("title","输出电流"); + map5.put("content",new BigDecimal(t5).divide(new BigDecimal(10)).setScale(2,BigDecimal.ROUND_DOWN)); + list.add(map5); + + idxStart = idxStart+4; + int t6= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map6 =new LinkedHashMap<>(); + map6.put("title","枪线温度"); + if(t6==0){ + map6.put("content","待机中"); + }else{ + map6.put("content",t6-50+"ºC"); + } + list.add(map6); + + idxStart = idxStart+2; + int t7= HexUtils.reverseHexInt(content.substring(idxStart, 16 + idxStart)); + Map map7 =new LinkedHashMap<>(); + map7.put("title","枪线编码"); + if("0000000000000000".equals(content.substring(idxStart, 16 + idxStart))){ + map7.put("content","无枪线编码"); + }else{ + map7.put("content",t7); + } + list.add(map7); + + idxStart = idxStart+16; + int t8= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map8 =new LinkedHashMap<>(); + map8.put("title","SOC"); + map8.put("content",t8); + list.add(map8); + + idxStart = idxStart+2; + int t9= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map9 =new LinkedHashMap<>(); + map9.put("title","电池组最高温度"); + if(t9>0){ + map9.put("content",t9-50+"ºC"); + }else{ + map9.put("content","待机中"); + } + list.add(map9); + + idxStart = idxStart+2; + int t10= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map10 =new LinkedHashMap<>(); + map10.put("title","累计充电时间"); + if(t10>0){ + map10.put("content",t10+"分钟"); + }else{ + map10.put("content","待机中"); + } + list.add(map10); + + idxStart = idxStart+4; + int t11= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map11 =new LinkedHashMap<>(); + map11.put("title","剩余时间"); + if(t11>0){ + map11.put("content",t11+"分钟"); + }else{ + map11.put("content","待机中"); + } + list.add(map11); + + + BigDecimal bigDecimal = new BigDecimal(10000); + idxStart = idxStart+4; + int t12= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map12 =new LinkedHashMap<>(); + map12.put("title","充电度数"); + map12.put("content",new BigDecimal(t12).divide(bigDecimal).setScale(4,BigDecimal.ROUND_DOWN)); + list.add(map12); + + idxStart = idxStart+8; + int t13= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map13 =new LinkedHashMap<>(); + map13.put("title","计损充电度数"); + map13.put("content",new BigDecimal(t13).divide(bigDecimal).setScale(4,BigDecimal.ROUND_DOWN)); + list.add(map13); + + idxStart = idxStart+8; + int t14= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map14 =new LinkedHashMap<>(); + map14.put("title","已充金额"); + map14.put("content",new BigDecimal(t14).divide(bigDecimal).setScale(4,BigDecimal.ROUND_DOWN)+"元"); + list.add(map14); + try{ + idxStart = idxStart+8; + Map map15 =new LinkedHashMap<>(); + map15.put("title","硬件故障"); + if(t1==1){ + String s = binCodeParser(Integer.parseInt(content.substring(idxStart, 1 + idxStart))); + map15.put("content",s); + }else{ + map15.put("content","无硬件故障"); + } + + list.add(map15); + }catch (Exception e){ + + } + + try{ + idxStart = idxStart+4; + Map map16 =new LinkedHashMap<>(); + map16.put("title","开始时间"); + map16.put("content", DateUtil.format(CP56Time2a.cp56toDate(content.substring(idxStart, 14 + idxStart)), NORM_DATETIME_FORMATTER)); + list.add(map16); + + idxStart = idxStart+14; + Map map17 =new LinkedHashMap<>(); + map17.put("title","结束时间"); + map17.put("content", DateUtil.format(CP56Time2a.cp56toDate(content.substring(idxStart, 14 + idxStart)), NORM_DATETIME_FORMATTER)); + list.add(map17); + + idxStart = idxStart+14; + Map map18 =new LinkedHashMap<>(); + int t18= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + map18.put("title","计费时段数"); + map18.put("content", t18); + list.add(map18); + + idxStart = idxStart+2; + Map map19 =new LinkedHashMap<>(); + int t19= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + map19.put("title","计费模型"); + map19.put("content", t19); + list.add(map19); + + idxStart = idxStart+8; + for (int i = 0; i map181 =new LinkedHashMap<>(); + int t181= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + map181.put("title","第"+(i+1)+"时段充电度数"); + map181.put("content", new BigDecimal(t181).divide(bigDecimal).setScale(4,BigDecimal.ROUND_DOWN)); + list.add(map181); + + idxStart = idxStart+8; + Map map191 =new LinkedHashMap<>(); + int t191= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + map191.put("title","第"+(i+1)+"时段金额"); + map191.put("content", new BigDecimal(t191).divide(bigDecimal).setScale(4,BigDecimal.ROUND_DOWN)+"元"); + list.add(map191); + + idxStart = idxStart+8; + + } + + }catch (Exception e){ + + } + + + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getBmsChargingHandshakeDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","充电握手(0x15)"); + jiexi.put("content",content); + jiexi.put("response","主动上送"); + List> list = new LinkedList<>(); + int idxStart = 12; + Map map =new LinkedHashMap<>(); + map.put("title","交易流水号"); + map.put("content",content.substring(idxStart,idxStart+32)); + list.add(map); + + idxStart = idxStart+32; + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + + idxStart = idxStart+14; + Map map001 =new LinkedHashMap<>(); + map001.put("title","抢号"); + String substring = content.substring(idxStart, 2 + idxStart); + if("01".equals(substring)){ + map001.put("content","A枪"); + }else{ + map001.put("content","B枪"); + } + list.add(map001); + + idxStart = idxStart+2; + + String version ="V"; + if(!"00".equals(content.substring(idxStart, 2 + idxStart))){ + int t1 = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + version = version+t1; + } + idxStart = idxStart+2; + if(!"00".equals(content.substring(idxStart, 2 + idxStart))){ + int t1 = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + version = version+"."+t1; + } + idxStart = idxStart+2; + if(!"00".equals(content.substring(idxStart, 2 + idxStart))){ + int t1 = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + version = version+"."+t1; + } + idxStart = idxStart+2; + + Map map1 =new LinkedHashMap<>(); + map1.put("title","BMS 通信协议版本号"); + map1.put("content",version); + list.add(map1); + + int t2 = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map2 =new LinkedHashMap<>(); + map2.put("title","BMS 电池类型"); + if(t2==1){ + map2.put("content","铅酸电池"); + }else if(t2==2){ + map2.put("content","氢电池"); + }else if(t2==3){ + map2.put("content","磷酸铁锂电池"); + }else if(t2==4){ + map2.put("content","锰酸锂电池"); + }else if(t2==5){ + map2.put("content","钴酸锂电池"); + }else if(t2==6){ + map2.put("content","三元材料电池"); + }else if(t2==7){ + map2.put("content","聚合物锂离子电池"); + }else if(t2==8){ + map2.put("content","钛酸锂电池"); + }else{ + map2.put("content","其他电池"); + } + list.add(map2); + + idxStart = idxStart+2; + int t3 = HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map3 =new LinkedHashMap<>(); + map3.put("title","BMS 整车动力蓄电池系统额定容量"); + map3.put("content",new BigDecimal(t3).divide(new BigDecimal(10)).setScale(2,BigDecimal.ROUND_DOWN)+"h"); + list.add(map3); + + idxStart = idxStart+4; + int t4= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map4 =new LinkedHashMap<>(); + map4.put("title","BMS 整车动力蓄电池系统额定总电压"); + map4.put("content",new BigDecimal(t4).divide(new BigDecimal(10)).setScale(2,BigDecimal.ROUND_DOWN)+"V"); + list.add(map4); + + idxStart = idxStart+4; + Map map5 =new LinkedHashMap<>(); + map5.put("title","BMS 电池生产厂商名称"); + if("FFFFFFFF".equals(content.substring(idxStart, 8 + idxStart))){ + map5.put("content","无"); + }else{ + String vinCode = asciiToString(content.substring(idxStart, 8 + idxStart)); + map5.put("content",vinCode); + } + list.add(map5); + + idxStart = idxStart+8; + Map map6 =new LinkedHashMap<>(); + map6.put("title","BMS 电池组序号"); + map6.put("content","根据不同的厂商解析"); + list.add(map6); + + idxStart = idxStart+8; + + Map map7 =new LinkedHashMap<>(); + map7.put("title","BMS 电池组生产日期年"); + if("FF".equals(content.substring(idxStart, 2 + idxStart))){ + map7.put("content","无"); + }else{ + int t7= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + if(t7==0){ + map7.put("content","无"); + }else{ + map7.put("content",1985+t7+"年"); + } + } + + list.add(map7); + + idxStart = idxStart+2; + Map map8=new LinkedHashMap<>(); + map8.put("title","BMS 电池组生产日期月"); + if("FF".equals(content.substring(idxStart, 2 + idxStart))){ + map8.put("content","无"); + }else{ + int t8= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + if(t8==0){ + map8.put("content","无"); + }else{ + map8.put("content",t8+"月"); + } + } + list.add(map8); + + idxStart = idxStart+2; + + Map map9=new LinkedHashMap<>(); + map9.put("title","BMS 电池组生产日期日"); + if("FF".equals(content.substring(idxStart, 2 + idxStart))){ + map9.put("content","无"); + }else{ + int t9= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + if(t9==0){ + map9.put("content","无"); + }else{ + map9.put("content",t9+"日"); + } + } + + list.add(map9); + + idxStart = idxStart+2; + + Map map10=new LinkedHashMap<>(); + map10.put("title","BMS 电池组充电次数"); + if("FFFFFF".equals(content.substring(idxStart, 6 + idxStart))){ + map10.put("content","无"); + }else{ + int t10= HexUtils.reverseHexInt(content.substring(idxStart, 6+ idxStart)); + if(t10==0){ + map10.put("content","无"); + }else{ + map10.put("content",t10+"次"); + } + } + + list.add(map10); + + idxStart = idxStart+6; + int t11= HexUtils.reverseHexInt(content.substring(idxStart, 2+ idxStart)); + Map map11=new LinkedHashMap<>(); + map11.put("title","BMS 电池组产权标识"); + + if(t11==0){ + map11.put("content","租赁"); + }else{ + map11.put("content","车自有"); + } + list.add(map11); + + idxStart = idxStart+2; + int t12= HexUtils.reverseHexInt(content.substring(idxStart, 2+ idxStart)); + Map map12=new LinkedHashMap<>(); + map12.put("title","预留位"); + map12.put("content",t12); + list.add(map12); + + + idxStart = idxStart+2; + Map map13=new LinkedHashMap<>(); + map13.put("title","BMS 车辆识别码"); + map13.put("content",asciiToString(content.substring(idxStart, 34+ idxStart))); + list.add(map13); + + idxStart = idxStart+34; + Map map14=new LinkedHashMap<>(); + map14.put("title","BMS 软件版本号"); + + if("0000".equals(content.substring(idxStart, 4+ idxStart))){ + map14.put("content","无"); + }else{ + idxStart = idxStart+6; + String year=""; + int t14= HexUtils.reverseHexInt(content.substring(idxStart, 4+ idxStart)); + year = year+t14+"年"; + idxStart = idxStart+4; + int t15= HexUtils.reverseHexInt(content.substring(idxStart, 2+ idxStart)); + year = year+t15+"月"; + idxStart = idxStart+2; + int t16= HexUtils.reverseHexInt(content.substring(idxStart, 2+ idxStart)); + year = year+t16+"日"; + idxStart = idxStart+2; + int t17= HexUtils.reverseHexInt(content.substring(idxStart, 2+ idxStart)); + year = year+t17; + map14.put("content",year); + list.add(map14); + } + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getBmsChargingConfigDataLogic(String content) { + + Map jiexi =new HashMap<>(); + jiexi.put("name","参数配置(0x17)"); + jiexi.put("content",content); + jiexi.put("response","主动上送"); + List> list = new LinkedList<>(); + int idxStart = 12; + Map map =new LinkedHashMap<>(); + map.put("title","交易流水号"); + map.put("content",content.substring(12,44)); + list.add(map); + idxStart = idxStart+32; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + idxStart = idxStart+14; + + Map map001 =new LinkedHashMap<>(); + map001.put("title","抢号"); + String substring = content.substring(idxStart, 2 + idxStart); + if("01".equals(substring)){ + map001.put("content","A枪"); + }else{ + map001.put("content","B枪"); + } + list.add(map001); + + idxStart = idxStart+2; + int t3 = HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map3 =new LinkedHashMap<>(); + map3.put("title","BMS 单体动力蓄电池最高允许充电电压"); + map3.put("content",new BigDecimal(t3).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_DOWN)+"V"); + list.add(map3); + + idxStart = idxStart+4; + double t2 = BMSCurrentParser.parseBmsCurrent(content.substring(idxStart, 4 + idxStart),400); + Map map2 =new LinkedHashMap<>(); + map2.put("title","BMS 最高允许充电电流"); + map2.put("content",new BigDecimal(t2).abs().setScale(2,RoundingMode.DOWN).doubleValue()+"A"); + list.add(map2); + + idxStart = idxStart+4; + int t4= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map4 =new LinkedHashMap<>(); + map4.put("title","BMS 动力蓄电池标称总能量"); + map4.put("content",new BigDecimal(t4).divide(new BigDecimal(10)).setScale(2,BigDecimal.ROUND_DOWN)+"kWh"); + list.add(map4); + + idxStart = idxStart+4; + int t5 = HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map5 =new LinkedHashMap<>(); + map5.put("title","BMS 最高允许充电总电压"); + map5.put("content",new BigDecimal(t5).divide(new BigDecimal(10)).setScale(2,RoundingMode.DOWN).doubleValue()+"V"); + list.add(map5); + + idxStart = idxStart+4; + int t6= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map6 =new LinkedHashMap<>(); + map6.put("title","BMS 最高允许温度"); + map6.put("content",t6-50+"ºC"); + list.add(map6); + + idxStart = idxStart+2; + int t7= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map7 =new LinkedHashMap<>(); + map7.put("title","BMS 整车动力蓄电池荷电状态(soc)"); + map7.put("content",new BigDecimal(t7).divide(new BigDecimal(10)).setScale(1,RoundingMode.DOWN)+"%"); + list.add(map7); + + idxStart = idxStart+4; + int t8= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map8 =new LinkedHashMap<>(); + map8.put("title","BMS 整车动力蓄电池当前电池电压"); + map8.put("content",t8); + list.add(map8); + + idxStart = idxStart+4; + int t9= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map9 =new LinkedHashMap<>(); + map9.put("title","电桩最高输出电压"); + map9.put("content",new BigDecimal(t9).divide(new BigDecimal(10)).setScale(1,BigDecimal.ROUND_DOWN)+"V"); + list.add(map9); + + idxStart = idxStart+4; + int t10= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map10 =new LinkedHashMap<>(); + map10.put("title","电桩最高输出电压"); + map10.put("content",new BigDecimal(t10).divide(new BigDecimal(10)).setScale(1,BigDecimal.ROUND_DOWN)+"V"); + list.add(map10); + + idxStart = idxStart+4; + double t11 = BMSCurrentParser.parseBmsCurrent(content.substring(idxStart, 4 + idxStart),400); + Map map11 =new LinkedHashMap<>(); + map11.put("title","BMS 最高允许充电总电压"); + map11.put("content",new BigDecimal(t11).abs().setScale(1,RoundingMode.DOWN).doubleValue()+"A"); + list.add(map11); + + idxStart = idxStart+4; + double t12 = BMSCurrentParser.parseBmsCurrent(content.substring(idxStart, 4 + idxStart),400); + Map map12 =new LinkedHashMap<>(); + map12.put("title","BMS 最高允许充电总电压"); + map12.put("content",new BigDecimal(t12).abs().setScale(1,RoundingMode.DOWN).doubleValue()+"A"); + list.add(map12); + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getBmsChargingCompletedDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","充电结束(0x19)"); + jiexi.put("content",content); + jiexi.put("response","主动上送"); + List> list = new LinkedList<>(); + int idxStart = 12; + Map map =new LinkedHashMap<>(); + map.put("title","交易流水号"); + map.put("content",content.substring(12,44)); + list.add(map); + idxStart = idxStart+32; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + idxStart = idxStart+14; + + Map map001 =new LinkedHashMap<>(); + map001.put("title","抢号"); + String substring = content.substring(idxStart, 2 + idxStart); + if("01".equals(substring)){ + map001.put("content","A枪"); + }else{ + map001.put("content","B枪"); + } + list.add(map001); + + idxStart = idxStart+2; + int t1= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map1 =new LinkedHashMap<>(); + map1.put("title","BMS 中止荷电状态 SOC"); + map1.put("content",t1+"%"); + list.add(map1); + + idxStart = idxStart+2; + int t3 = HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map3 =new LinkedHashMap<>(); + map3.put("title","BMS 动力蓄电池单体最低电压"); + map3.put("content",new BigDecimal(t3).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_DOWN)+"V"); + list.add(map3); + + idxStart = idxStart+4; + int t4 = HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map4 =new LinkedHashMap<>(); + map4.put("title","BMS 动力蓄电池单体最高电压"); + map4.put("content",new BigDecimal(t4).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_DOWN)+"V"); + list.add(map4); + + idxStart = idxStart+4; + int t5= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map5 =new LinkedHashMap<>(); + map5.put("title","BMS 动力蓄电池最低温度"); + map5.put("content",t5-50+"ºC"); + list.add(map5); + + idxStart = idxStart+2; + int t6= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map6 =new LinkedHashMap<>(); + map6.put("title","BMS 动力蓄电池最高温度"); + map6.put("content",t6-50+"ºC"); + list.add(map6); + + idxStart = idxStart+2; + int t7= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map7 =new LinkedHashMap<>(); + map7.put("title","电桩累计充电时间"); + map7.put("content",t7+"分钟"); + list.add(map7); + + idxStart = idxStart+4; + int t9= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map9 =new LinkedHashMap<>(); + map9.put("title","电桩输出能量"); + map9.put("content",new BigDecimal(t9).divide(new BigDecimal(10)).setScale(1,BigDecimal.ROUND_DOWN)+"kWh"); + list.add(map9); + + idxStart = idxStart+4; + int t10= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map10 =new LinkedHashMap<>(); + map10.put("title","电桩充电机编号"); + map10.put("content",t10); + list.add(map10); + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getBmsErrorDataLogic(String content) { + + Map jiexi =new HashMap<>(); + jiexi.put("name","错误报文(0x1B)"); + jiexi.put("content",content); + jiexi.put("response","主动上送"); + List> list = new LinkedList<>(); + int idxStart = 12; + Map map =new LinkedHashMap<>(); + map.put("title","交易流水号"); + map.put("content",content.substring(12,44)); + list.add(map); + idxStart = idxStart+32; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + idxStart = idxStart+14; + + Map map001 =new LinkedHashMap<>(); + map001.put("title","抢号"); + String substring = content.substring(idxStart, 2 + idxStart); + if("01".equals(substring)){ + map001.put("content","A枪"); + }else{ + map001.put("content","B枪"); + } + list.add(map001); + + idxStart = idxStart+2; + int t3 = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + + if(t3==0){ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收 SPN2560=0x00 的充电机辨识报文超时"); + map6.put("content","正常"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","接收 SPN2560=0xAA 的充电机辨识报文超时"); + map7.put("content","正常"); + list.add(map7); + + Map map8 =new LinkedHashMap<>(); + map8.put("title","预留位"); + map8.put("content","正常"); + list.add(map8); + + }else if(t3==1){ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收 SPN2560=0x00 的充电机辨识报文超时"); + map6.put("content","超时"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","接收 SPN2560=0xAA 的充电机辨识报文超时"); + map7.put("content","超时"); + list.add(map7); + + Map map8 =new LinkedHashMap<>(); + map8.put("title","预留位"); + map8.put("content","超时"); + list.add(map8); + }else{ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收 SPN2560=0x00 的充电机辨识报文超时"); + map6.put("content","不可信状态"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","接收 SPN2560=0xAA 的充电机辨识报文超时"); + map7.put("content","不可信状态"); + list.add(map7); + + Map map8 =new LinkedHashMap<>(); + map8.put("title","预留位"); + map8.put("content","不可信状态"); + list.add(map8); + } + + idxStart = idxStart+2; + int t4 = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + if(t4==0){ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收充电机的时间同步和充电机最大输出能力报文超时"); + map6.put("content","正常"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","接收 SPN2560=0xAA 的充电机辨识报文超时"); + map7.put("content","正常"); + list.add(map7); + + Map map8 =new LinkedHashMap<>(); + map8.put("title","预留位"); + map8.put("content","正常"); + list.add(map8); + }else if(t4==1){ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收充电机的时间同步和充电机最大输出能力报文超时"); + map6.put("content","超时"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","接收充电机完成充电准备报文超时"); + map7.put("content","超时"); + list.add(map7); + + Map map8 =new LinkedHashMap<>(); + map8.put("title","预留位"); + map8.put("content","超时"); + list.add(map8); + }else{ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收充电机的时间同步和充电机最大输出能力报文超时"); + map6.put("content","不可信状态"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","接收充电机完成充电准备报文超时"); + map7.put("content","不可信状态"); + list.add(map7); + + Map map8 =new LinkedHashMap<>(); + map8.put("title","预留位"); + map8.put("content","不可信状态"); + list.add(map8); + } + + + idxStart = idxStart+2; + int t5 = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + if(t5==0){ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收充电机充电状态报文超时"); + map6.put("content","正常"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","接收充电机中止充电报文超时"); + map7.put("content","正常"); + list.add(map7); + + Map map8 =new LinkedHashMap<>(); + map8.put("title","预留位"); + map8.put("content","正常"); + list.add(map8); + }else if(t5==1){ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收充电机充电状态报文超时"); + map6.put("content","超时"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","接收充电机中止充电报文超时"); + map7.put("content","超时"); + list.add(map7); + + Map map8 =new LinkedHashMap<>(); + map8.put("title","预留位"); + map8.put("content","超时"); + list.add(map8); + }else{ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收充电机充电状态报文超时"); + map6.put("content","不可信状态"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","接收充电机中止充电报文超时"); + map7.put("content","不可信状态"); + list.add(map7); + + Map map8 =new LinkedHashMap<>(); + map8.put("title","预留位"); + map8.put("content","不可信状态"); + list.add(map8); + } + + idxStart = idxStart+2; + int t6 = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + if(t6==0){ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收充电机充电统计报文超时"); + map6.put("content","正常"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","BMS 其他"); + map7.put("content","正常"); + list.add(map7); + }else if(t6==1){ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收充电机充电统计报文超时"); + map6.put("content","超时"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","BMS 其他"); + map7.put("content","超时"); + list.add(map7); + }else{ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收充电机充电统计报文超时"); + map6.put("content","不可信状态"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","BMS 其他"); + map7.put("content","不可信状态"); + list.add(map7); + } + + idxStart = idxStart+2; + int t7 = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + if(t7==0){ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收 BMS 和车辆的辨识报文超时"); + map6.put("content","正常"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","预留位"); + map7.put("content","正常"); + list.add(map7); + }else if(t7==1){ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收 BMS 和车辆的辨识报文超时"); + map6.put("content","超时"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","预留位"); + map7.put("content","超时"); + list.add(map7); + }else{ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收 BMS 和车辆的辨识报文超时"); + map6.put("content","不可信状态"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","预留位"); + map7.put("content","不可信状态"); + list.add(map7); + } + + idxStart = idxStart+2; + int t8 = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + if(t8==0){ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收电池充电参数报文超时"); + map6.put("content","正常"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","接收 BMS 完成充电准备报文超时"); + map7.put("content","正常"); + list.add(map7); + + Map map8 =new LinkedHashMap<>(); + map8.put("title","预留位"); + map8.put("content","正常"); + list.add(map8); + }else if(t8==1){ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收电池充电参数报文超时"); + map6.put("content","超时"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","接收 BMS 完成充电准备报文超时"); + map7.put("content","超时"); + list.add(map7); + + Map map8 =new LinkedHashMap<>(); + map8.put("title","预留位"); + map8.put("content","超时"); + list.add(map8); + }else{ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收电池充电参数报文超时"); + map6.put("content","不可信状态"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","接收 BMS 完成充电准备报文超时"); + map7.put("content","不可信状态"); + list.add(map7); + + Map map8 =new LinkedHashMap<>(); + map8.put("title","预留位"); + map8.put("content","不可信状态"); + list.add(map8); + } + + idxStart = idxStart+2; + int t9 = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + if(t9==0){ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收电池充电总状态报文超时"); + map6.put("content","正常"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","接收电池充电要求报文超时"); + map7.put("content","正常"); + list.add(map7); + + Map map71 =new LinkedHashMap<>(); + map71.put("title","接收 BMS 中止充电报文超时"); + map71.put("content","正常"); + list.add(map71); + + Map map8 =new LinkedHashMap<>(); + map8.put("title","预留位"); + map8.put("content","正常"); + list.add(map8); + }else if(t9==1){ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收电池充电总状态报文超时"); + map6.put("content","超时"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","接收电池充电要求报文超时"); + map7.put("content","超时"); + list.add(map7); + + Map map71 =new LinkedHashMap<>(); + map71.put("title","接收 BMS 中止充电报文超时"); + map71.put("content","超时"); + list.add(map71); + + Map map8 =new LinkedHashMap<>(); + map8.put("title","预留位"); + map8.put("content","超时"); + list.add(map8); + }else{ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收电池充电总状态报文超时"); + map6.put("content","不可信状态"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","接收电池充电要求报文超时"); + map7.put("content","不可信状态"); + list.add(map7); + + Map map71 =new LinkedHashMap<>(); + map71.put("title","接收 BMS 中止充电报文超时"); + map71.put("content","不可信状态"); + list.add(map71); + + Map map8 =new LinkedHashMap<>(); + map8.put("title","预留位"); + map8.put("content","不可信状态"); + list.add(map8); + } + + idxStart = idxStart+2; + int t10 = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + if(t10==0){ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收 BMS 充电统计报文超时"); + map6.put("content","正常"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","充电机其他"); + map7.put("content","正常"); + list.add(map7); + }else if(t6==1){ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收 BMS 充电统计报文超时"); + map6.put("content","超时"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","充电机其他"); + map7.put("content","超时"); + list.add(map7); + }else{ + Map map6 =new LinkedHashMap<>(); + map6.put("title","接收 BMS 充电统计报文超时"); + map6.put("content","不可信状态"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","充电机其他"); + map7.put("content","不可信状态"); + list.add(map7); + } + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getBmsInterruptDataLogic(String content) { + Map jiexi =new HashMap<>(); + + jiexi.put("name","充电阶段 BMS 中止(0x1D)"); + jiexi.put("content",content); + jiexi.put("response","主动上送"); + List> list = new LinkedList<>(); + int idxStart = 12; + Map map =new LinkedHashMap<>(); + map.put("title","交易流水号"); + map.put("content",content.substring(12,44)); + list.add(map); + + idxStart = idxStart+32; + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + + idxStart = idxStart+14; + Map map001 =new LinkedHashMap<>(); + map001.put("title","抢号"); + String substring = content.substring(idxStart, 2 + idxStart); + if("01".equals(substring)){ + map001.put("content","A枪"); + }else{ + map001.put("content","B枪"); + } + list.add(map001); + + idxStart = idxStart+2; + Map map1 =new LinkedHashMap<>(); + map1.put("title","BMS 中止充电原因"); + String reason1="达到所需求的SOC目标值"; + String reason2="达到总电压的设定值"; + String reason3="达到单体电压设定值"; + String reason4="充电机主动中止"; + map1.put("content",binCodeParser1(Integer.parseInt(content.substring(idxStart,idxStart+2),16),reason1,reason2,reason3,reason4)); + list.add(map1); + + idxStart = idxStart+2; + Map map2 =new LinkedHashMap<>(); + map2.put("title","BMS 中止充电故障原因"); + + String[] faults = { + "绝缘故障", // 1-2位 + "输出连接器过温故障", // 3-4位 + "BMS元件、输出连接器过温", // 5-6位 + "充电连接器故障", // 7-8位 + "电池组温度过高故障", // 9-10位 + "高压继电器故障", // 11-12位 + "检测点2电压检测故障", // 13-14位 + "其他故障" // 15-16位 + }; + map2.put("content",binCodeParser2(Integer.parseInt(content.substring(idxStart,idxStart+4),16),faults)); + list.add(map2); + String reason5="电流过大"; + String reason6="电压异常"; + idxStart = idxStart+4; + Map map3 =new LinkedHashMap<>(); + map3.put("title","BMS 中止充电故障原因"); + + map3.put("content",binCodeParser3(Integer.parseInt(content.substring(idxStart,idxStart+2),16),reason5,reason6)); + list.add(map3); + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getBmsChargerInterruptDataLogic(String content) { + Map jiexi =new HashMap<>(); + + jiexi.put("name","充电过程 BMS 信息(0x21)"); + jiexi.put("content",content); + jiexi.put("response","周期上送(15 秒)"); + List> list = new LinkedList<>(); + int idxStart = 12; + Map map =new LinkedHashMap<>(); + map.put("title","交易流水号"); + map.put("content",content.substring(12,44)); + list.add(map); + + idxStart = idxStart+32; + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + + idxStart = idxStart+14; + Map map001 =new LinkedHashMap<>(); + map001.put("title","抢号"); + String substring = content.substring(idxStart, 2 + idxStart); + if("01".equals(substring)){ + map001.put("content","A枪"); + }else{ + map001.put("content","B枪"); + } + list.add(map001); + + idxStart = idxStart+2; + Map map1 =new LinkedHashMap<>(); + map1.put("title","充电机中止充电原因"); + String reason1="达到充电机设定的条件中止"; + String reason2="人工中止"; + String reason3="异常中止"; + String reason4="BMS 主动中止"; + map1.put("content",binCodeParser1(Integer.parseInt(content.substring(idxStart,idxStart+2),16),reason1,reason2,reason3,reason4)); + list.add(map1); + + idxStart = idxStart+2; + Map map2 =new LinkedHashMap<>(); + map2.put("title","充电机中止充电故障原因"); + + String[] faults = { + "充电机过温故障", // 1-2位 + "充电连接器故障", // 3-4位 + "充电机内部过温故障", // 5-6位 + "所需电量不能传送", // 7-8位 + "充电机急停故障", // 9-10位 + "其他故障" // 11-12位 + }; + map2.put("content",binCodeParser2(Integer.parseInt(content.substring(idxStart,idxStart+4),16),faults)); + list.add(map2); + String reason5="电流过大"; + String reason6="电压异常"; + idxStart = idxStart+4; + Map map3 =new LinkedHashMap<>(); + map3.put("title","充电机中止充电错误原因"); + map3.put("content",binCodeParser3(Integer.parseInt(content.substring(idxStart,idxStart+2),16),reason5,reason6)); + list.add(map3); + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getBmsReqChargerOutputDataLogic(String content) { + + Map jiexi =new HashMap<>(); + + jiexi.put("name","充电过程 BMS 需求与充电机输出(0x23)"); + jiexi.put("content",content); + jiexi.put("response","周期上送(15 秒)"); + List> list = new LinkedList<>(); + int idxStart = 12; + Map map =new LinkedHashMap<>(); + map.put("title","交易流水号"); + map.put("content",content.substring(12,44)); + list.add(map); + + idxStart = idxStart+32; + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + + idxStart = idxStart+14; + Map map001 =new LinkedHashMap<>(); + map001.put("title","抢号"); + String substring = content.substring(idxStart, 2 + idxStart); + if("01".equals(substring)){ + map001.put("content","A枪"); + }else{ + map001.put("content","B枪"); + } + list.add(map001); + + idxStart = idxStart+2; + int t1= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map1 =new LinkedHashMap<>(); + map1.put("title","BMS 电压需求"); + map1.put("content",new BigDecimal(t1).divide(new BigDecimal(10)).setScale(2,BigDecimal.ROUND_DOWN)+"V"); + list.add(map1); + + idxStart = idxStart+4; + double t2 = BMSCurrentParser.parseBmsCurrent(content.substring(idxStart, 4 + idxStart),400); + Map map2 =new LinkedHashMap<>(); + map2.put("title","BMS 电流需求"); + map2.put("content",new BigDecimal(t2).abs().setScale(2,RoundingMode.DOWN).doubleValue()+"A"); + list.add(map2); + + idxStart = idxStart+4; + int t3= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map3 =new LinkedHashMap<>(); + map3.put("title","BMS 充电模式"); + map3.put("content",new BigDecimal(t1).divide(new BigDecimal(10)).setScale(2,BigDecimal.ROUND_DOWN)); + if(t3==1){ + map3.put("content","恒压充电"); + }else{ + map3.put("content","恒流充电"); + } + list.add(map3); + + idxStart = idxStart+2; + int t4= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map4 =new LinkedHashMap<>(); + map4.put("title","BMS 充电电压测量值"); + map4.put("content",new BigDecimal(t4).divide(new BigDecimal(10)).setScale(2,BigDecimal.ROUND_DOWN)+"V"); + list.add(map4); + + idxStart = idxStart+4; + double t5 = BMSCurrentParser.parseBmsCurrent(content.substring(idxStart, 4 + idxStart),400); + Map map5 =new LinkedHashMap<>(); + map5.put("title","BMS 充电电流测量值"); + map5.put("content",new BigDecimal(t5).abs().setScale(2,BigDecimal.ROUND_DOWN).doubleValue()+"A"); + list.add(map5); + + idxStart = idxStart+4; + int t6= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map6 =new LinkedHashMap<>(); + map6.put("title","BMS 最高单体动力蓄电池电压及组号"); + map6.put("content",t6); + list.add(map6); + + idxStart = idxStart+4; + int t7= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map7 =new LinkedHashMap<>(); + map7.put("title","BMS 当前荷电状态 SOC( %)"); + map7.put("content",t7+"%"); + list.add(map7); + + + idxStart = idxStart+2; + int t8= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map8 =new LinkedHashMap<>(); + map8.put("title","BMS 估算剩余充电时间(min)"); + map8.put("content",t8+"分钟"); + list.add(map8); + + idxStart = idxStart+4; + int t9= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map9 =new LinkedHashMap<>(); + map9.put("title","电桩电压输出值"); + map9.put("content",new BigDecimal(t9).divide(new BigDecimal(10)).setScale(2,BigDecimal.ROUND_DOWN)+"V"); + list.add(map9); + + idxStart = idxStart+4; + double t10 = BMSCurrentParser.parseBmsCurrent(content.substring(idxStart, 4 + idxStart),400); + Map map10 =new LinkedHashMap<>(); + map10.put("title","电桩电流输出值"); + map10.put("content",new BigDecimal(t10).abs().setScale(2,BigDecimal.ROUND_DOWN).doubleValue()+"A"); + list.add(map10); + + + idxStart = idxStart+4; + int t11= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map11 =new LinkedHashMap<>(); + map11.put("title","累计充电时间(min)"); + map11.put("content",t11+"分钟"); + list.add(map11); + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getBmsChargingDataLogic(String content) { + + Map jiexi =new HashMap<>(); + + jiexi.put("name","充电过程 BMS 信息(0x25)"); + jiexi.put("content",content); + jiexi.put("response","周期上送(15 秒)"); + List> list = new LinkedList<>(); + int idxStart = 12; + Map map =new LinkedHashMap<>(); + map.put("title","交易流水号"); + map.put("content",content.substring(12,44)); + list.add(map); + + idxStart = idxStart+32; + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + + idxStart = idxStart+14; + Map map001 =new LinkedHashMap<>(); + map001.put("title","抢号"); + String substring = content.substring(idxStart, 2 + idxStart); + if("01".equals(substring)){ + map001.put("content","A枪"); + }else{ + map001.put("content","B枪"); + } + list.add(map001); + + idxStart = idxStart+2; + int t1= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map1 =new LinkedHashMap<>(); + map1.put("title","BMS 最高单体动力蓄电池电压所在编号"); + map1.put("content",t1); + list.add(map1); + + idxStart = idxStart+2; + int t2= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map2 =new LinkedHashMap<>(); + map2.put("title","BMS 最高动力蓄电池温度"); + map2.put("content",t2-50+"ºC"); + list.add(map2); + + idxStart = idxStart+2; + int t3= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map3 =new LinkedHashMap<>(); + map3.put("title","最高温度检测点编号"); + map3.put("content",t3); + list.add(map3); + + idxStart = idxStart+2; + int t4= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map4 =new LinkedHashMap<>(); + map4.put("title","最低动力蓄电池温度"); + map4.put("content",t4-50+"ºC"); + list.add(map4); + + idxStart = idxStart+2; + int t5= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map5 =new LinkedHashMap<>(); + map5.put("title","最低动力蓄电池温度检测点编号"); + map5.put("content",t5); + list.add(map5); + + + idxStart = idxStart+2; + int t6= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + + if(t6==0){ + Map map6 =new LinkedHashMap<>(); + map6.put("title","BMS 单体动力蓄电池电压"); + map6.put("content","正常"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","BMS 整车动力蓄电池荷电状态SOC"); + map7.put("content","正常"); + list.add(map7); + + Map map8 =new LinkedHashMap<>(); + map8.put("title","BMS 动力蓄电池充电过电流"); + map8.put("content","正常"); + list.add(map8); + + Map map9 =new LinkedHashMap<>(); + map9.put("title","BMS 动力蓄电池温度"); + map9.put("content","正常"); + list.add(map9); + }else if(t6==1){ + Map map6 =new LinkedHashMap<>(); + map6.put("title","BMS 单体动力蓄电池电压"); + map6.put("content","过高"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","BMS 整车动力蓄电池荷电状态SOC"); + map7.put("content","过高"); + list.add(map7); + + Map map8 =new LinkedHashMap<>(); + map8.put("title","BMS 动力蓄电池充电过电流"); + map8.put("content","过高"); + list.add(map8); + + Map map9 =new LinkedHashMap<>(); + map9.put("title","BMS 动力蓄电池温度"); + map9.put("content","过高"); + list.add(map9); + }else{ + Map map6 =new LinkedHashMap<>(); + map6.put("title","BMS 单体动力蓄电池电压"); + map6.put("content","过低"); + list.add(map6); + + Map map7 =new LinkedHashMap<>(); + map7.put("title","BMS 整车动力蓄电池荷电状态SOC"); + map7.put("content","过低"); + list.add(map7); + + Map map8 =new LinkedHashMap<>(); + map8.put("title","BMS 动力蓄电池充电过电流"); + map8.put("content","过低"); + list.add(map8); + + Map map9 =new LinkedHashMap<>(); + map9.put("title","BMS 动力蓄电池温度"); + map9.put("content","过低"); + list.add(map9); + } + + idxStart = idxStart+2; + int t7= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + if(t7==0){ + Map map10 =new LinkedHashMap<>(); + map10.put("title","BMS 动力蓄电池绝缘状态"); + map10.put("content","正常"); + list.add(map10); + + Map map11 =new LinkedHashMap<>(); + map11.put("title","BMS 动力蓄电池组输出连接器连接状态"); + map11.put("content","正常"); + list.add(map11); + +// Map map8 =new LinkedHashMap<>(); +// map8.put("title","充电禁止"); +// map8.put("content","正常"); +// list.add(map8); + }else if(t7==1){ + Map map10 =new LinkedHashMap<>(); + map10.put("title","BMS 动力蓄电池绝缘状态"); + map10.put("content","不正常"); + list.add(map10); + + Map map11 =new LinkedHashMap<>(); + map11.put("title","BMS 动力蓄电池组输出连接器连接状态"); + map11.put("content","不正常"); + list.add(map11); + +// Map map8 =new LinkedHashMap<>(); +// map8.put("title","充电禁止"); +// map8.put("content","禁止"); +// list.add(map8); + } + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getPileStartChargingDataLogic(String content) { + Map jiexi =new HashMap<>(); + + jiexi.put("name","充电桩主动申请启动充电(0x31)"); + jiexi.put("content",content); + jiexi.put("response","按需发送"); + List> list = new LinkedList<>(); + int idxStart = 12; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + + idxStart = idxStart+14; + Map map001 =new LinkedHashMap<>(); + map001.put("title","抢号"); + String substring = content.substring(idxStart, 2 + idxStart); + if("01".equals(substring)){ + map001.put("content","A枪"); + }else{ + map001.put("content","B枪"); + } + list.add(map001); + + idxStart = idxStart+2; + int t1= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map1 =new LinkedHashMap<>(); + map1.put("title","启动方式"); + if(t1==1){ + map1.put("content","刷卡启动充电"); + }else if(t1==2){ + map1.put("content","帐号启动充电(暂不支持)"); + }else if(t1==3){ + map1.put("content","vin码启动充电"); + }else{ + map1.put("content","其他启动充电"); + } + map1.put("content",t1); + list.add(map1); + + idxStart = idxStart+2; + int t2= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map2 =new LinkedHashMap<>(); + map2.put("title","是否需要密码"); + if(t2==0){ + map1.put("content","不需要"); + }else{ + map1.put("content","需要"); + } + list.add(map2); + + idxStart = idxStart+2; + Map map3 =new LinkedHashMap<>(); + map3.put("title","账号或者物理卡号(平台卡序列号,类似于桩号)"); + map3.put("content",content.substring(idxStart, 16 + idxStart)); + list.add(map3); + + idxStart = idxStart+16; + Map map4 =new LinkedHashMap<>(); + map4.put("title","输入密码"); + if(t2==0){ + map4.put("content","没有密码"); + }else{ + map4.put("content",content.substring(idxStart, 32 + idxStart)); + } + list.add(map4); + + idxStart = idxStart+32; + Map map5 =new LinkedHashMap<>(); + map5.put("title","VIN码"); + map5.put("content",asciiToString(content.substring(idxStart, 34+ idxStart))); + list.add(map5); + + try{ + idxStart = idxStart+34; + int t6= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map6 =new LinkedHashMap<>(); + map6.put("title","计费模型id"); + map6.put("content",t6); + list.add(map6); + }catch (Exception e){ + + } + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getReplyPileStartChargingDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","运营平台确认启动充电(0x32)"); + jiexi.put("content",content); + jiexi.put("response","应答"); + List> list = new LinkedList<>(); + int idxStart = 12; + Map map =new LinkedHashMap<>(); + map.put("title","交易流水号"); + map.put("content",content.substring(12,44)); + list.add(map); + idxStart = idxStart+32; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + idxStart = idxStart+14; + + Map map001 =new LinkedHashMap<>(); + map001.put("title","抢号"); + String substring = content.substring(idxStart, 2 + idxStart); + if("01".equals(substring)){ + map001.put("content","A枪"); + }else{ + map001.put("content","B枪"); + } + list.add(map001); + + idxStart = idxStart+2; + int t3 = HexUtils.reverseHexInt(content.substring(idxStart, 16 + idxStart)); + Map map3 =new LinkedHashMap<>(); + map3.put("title","逻辑卡号(平台卡序列号,类似于桩号)"); + map3.put("content",t3); + list.add(map3); + + idxStart = idxStart+16; + int t4= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map4 =new LinkedHashMap<>(); + map4.put("title","账户余额"); + map4.put("content",new BigDecimal(t4).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_DOWN)); + list.add(map4); + + idxStart = idxStart+8; + int t6= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map6 =new LinkedHashMap<>(); + map6.put("title","鉴权成功标志"); + if(t6==0){ + map6.put("content","成功"); + }else{ + map6.put("content","失败"); + } + list.add(map6); + + idxStart = idxStart+2; + int t7= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map7 =new LinkedHashMap<>(); + map7.put("title","鉴权成功标志"); + if(t7==0){ + map7.put("content","成功"); + }else if(t7==1){ + map7.put("content","账户不存在"); + }else if(t7==2){ + map7.put("content","账户冻结"); + }else if(t7==3){ + map7.put("content","账户余额不足"); + }else if(t7==4){ + map7.put("content","该卡存在未结账记录"); + }else if(t7==5){ + map7.put("content","桩停用"); + }else if(t7==6){ + map7.put("content","该账户不能在此桩上充电"); + }else if(t7==7){ + map7.put("content","密码错误"); + }else if(t7==8){ + map7.put("content","电站电容不足"); + }else if(t7==9){ + map7.put("content","系统中 vin 码不存在"); + }else if(t7==10){ + map7.put("content","该桩存在未结账记录"); + }else if(t7==11){ + map7.put("content","该桩不支持刷卡"); + }else if(t7==12){ + map7.put("content","无效终端"); + }else if(t7==13){ + map7.put("content","无效卡"); + }else if(t7==14){ + map7.put("content","无效用户"); + }else if(t7==15){ + map7.put("content","离线卡"); + }else if(t7==16){ + map7.put("content","初始化卡,未发卡"); + }else if(t7==17){ + map7.put("content","锁卡"); + }else if(t7==18){ + map7.put("content","挂失卡"); + }else if(t7==19){ + map7.put("content","作废卡"); + }else if(t7==20){ + map7.put("content","退款订单在审核中"); + }else if(t7==21){ + map7.put("content","账号正在充电"); + }else if(t7==22){ + map7.put("content","离线终端"); + }else if(t7==23){ + map7.put("content","故障终端"); + }else if(t7==24){ + map7.put("content","终端正在充电"); + }else if(t7==25){ + map7.put("content","未知的枪"); + }else if(t7==26){ + map7.put("content","请插好充电枪"); + }else if(t7==27){ + map7.put("content","费率模型id为空"); + }else if(t7==28){ + map7.put("content","内部错误"); + }else{ + map7.put("content","未知原因"); + } + list.add(map7); + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getRemoteStartReplyDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","远程启动充电命令回复(0x33)"); + jiexi.put("content",content); + jiexi.put("response","应答"); + List> list = new LinkedList<>(); + int idxStart = 12; + Map map =new LinkedHashMap<>(); + map.put("title","交易流水号"); + map.put("content",content.substring(12,44)); + list.add(map); + idxStart = idxStart+32; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + idxStart = idxStart+14; + + Map map001 =new LinkedHashMap<>(); + map001.put("title","抢号"); + String substring = content.substring(idxStart, 2 + idxStart); + if("01".equals(substring)){ + map001.put("content","A枪"); + }else{ + map001.put("content","B枪"); + } + list.add(map001); + + idxStart = idxStart+2; + int t1= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map1 =new LinkedHashMap<>(); + map1.put("title","启动结果"); + if(t1==0){ + map1.put("content","成功"); + }else{ + map1.put("content","失败"); + } + list.add(map1); + + idxStart = idxStart+2; + int t7= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map7 =new LinkedHashMap<>(); + map7.put("title","失败原因"); + if(t7==0){ + map7.put("content","无"); + }else if(t7==1){ + map7.put("content","设备编号不匹配"); + }else if(t7==2){ + map7.put("content","枪已在充电"); + }else if(t7==3){ + map7.put("content","设备故障"); + }else if(t7==4){ + map7.put("content","设备离线"); + }else if(t7==5){ + map7.put("content","未插枪"); + }else{ + map7.put("content","未知原因"); + } + list.add(map7); + try{ + idxStart = idxStart+2; + int t8= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map8 =new LinkedHashMap<>(); + map8.put("title","计费模型id"); + map8.put("content",t8); + list.add(map8); + + idxStart = idxStart+8; + int t9= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map9 =new LinkedHashMap<>(); + map9.put("title","双枪启动标识"); + if(t9==0){ + map9.put("content","单枪"); + }else{ + map9.put("content","双枪"); + } + list.add(map9); + }catch (Exception e){ + } jiexi.put("analysis",list); return R.ok(jiexi); } + @Override + public R getReplyRemoteStartReplyDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","运营平台远程控制启机(0x38)"); + jiexi.put("content",content); + jiexi.put("response","按需发送"); + List> list = new LinkedList<>(); + int idxStart = 12; + Map map =new LinkedHashMap<>(); + map.put("title","交易流水号"); + map.put("content",content.substring(12,44)); + list.add(map); + idxStart = idxStart+32; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + idxStart = idxStart+14; + + Map map001 =new LinkedHashMap<>(); + map001.put("title","抢号"); + String substring = content.substring(idxStart, 2 + idxStart); + if("01".equals(substring)){ + map001.put("content","A枪"); + }else{ + map001.put("content","B枪"); + } + list.add(map001); + + idxStart = idxStart+2; + Map map1 =new LinkedHashMap<>(); + map1.put("title","逻辑卡号"); + map1.put("content",content.substring(idxStart, 16 + idxStart)); + list.add(map1); + + idxStart = idxStart+16; + int t7= HexUtils.reverseHexInt(content.substring(idxStart, 16 + idxStart)); + Map map7 =new LinkedHashMap<>(); + map7.put("title","物理卡号"); + map7.put("content",t7); + list.add(map7); + + idxStart = idxStart+16; + int t4= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map4 =new LinkedHashMap<>(); + map4.put("title","账户余额"); + map4.put("content",new BigDecimal(t4).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_DOWN)+"元"); + list.add(map4); + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getRemoteStopReplyDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","远程停机命令回复(0x35)"); + jiexi.put("content",content); + jiexi.put("response","应答"); + List> list = new LinkedList<>(); + int idxStart = 12; + Map map =new LinkedHashMap<>(); + map.put("title","交易流水号"); + map.put("content",content.substring(12,44)); + list.add(map); + idxStart = idxStart+32; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + idxStart = idxStart+14; + + Map map001 =new LinkedHashMap<>(); + map001.put("title","抢号"); + String substring = content.substring(idxStart, 2 + idxStart); + if("01".equals(substring)){ + map001.put("content","A枪"); + }else{ + map001.put("content","B枪"); + } + list.add(map001); + + idxStart = idxStart+2; + int t6= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map6 =new LinkedHashMap<>(); + map6.put("title","停止结果"); + if(t6==0){ + map6.put("content","成功"); + }else{ + map6.put("content","失败"); + } + list.add(map6); + + idxStart = idxStart+2; + int t7= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map7 =new LinkedHashMap<>(); + map7.put("title","停止结果"); + if(t7==0){ + map7.put("content","无"); + }else if(t7==2){ + map7.put("content","枪未处于充电状态"); + }else if(t7==1){ + map7.put("content","设备编号不匹配"); + }else{ + map7.put("content","其他"); + } + list.add(map7); + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getReplyRemoteStopReplyDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","远程停机命令回复(0x36)"); + jiexi.put("content",content); + jiexi.put("response","按需发送"); + List> list = new LinkedList<>(); + int idxStart = 12; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + + idxStart = idxStart+14; + Map map001 =new LinkedHashMap<>(); + map001.put("title","抢号"); + String substring = content.substring(idxStart, 2 + idxStart); + if("01".equals(substring)){ + map001.put("content","A枪"); + }else{ + map001.put("content","B枪"); + } + list.add(map001); + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getOrderDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","交易记录(0x3B)"); + jiexi.put("content",content); + jiexi.put("response","应答"); + List> list = new LinkedList<>(); + int idxStart = 12; + Map map =new LinkedHashMap<>(); + map.put("title","交易流水号"); + map.put("content",content.substring(12,44)); + list.add(map); + idxStart = idxStart+32; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + idxStart = idxStart+14; + + Map map001 =new LinkedHashMap<>(); + map001.put("title","抢号"); + String substring = content.substring(idxStart, 2 + idxStart); + if("01".equals(substring)){ + map001.put("content","A枪"); + }else{ + map001.put("content","B枪"); + } + list.add(map001); + + idxStart = idxStart+2; + Map map3 =new LinkedHashMap<>(); + map3.put("title","开始时间"); + map3.put("content", DateUtil.format(CP56Time2a.cp56toDate(content.substring(idxStart, 14 + idxStart)), NORM_DATETIME_FORMATTER)); + list.add(map3); + + idxStart = idxStart+14; + Map map4 =new LinkedHashMap<>(); + map4.put("title","结束时间"); + map4.put("content", DateUtil.format(CP56Time2a.cp56toDate(content.substring(idxStart, 14 + idxStart)), NORM_DATETIME_FORMATTER)); + list.add(map4); + + idxStart = idxStart+14; + int t5= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map5 =new LinkedHashMap<>(); + map5.put("title","尖单价"); + map5.put("content",new BigDecimal(t5).divide(new BigDecimal(10000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/分钟"); + list.add(map5); + + idxStart = idxStart+8; + int t6= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map6 =new LinkedHashMap<>(); + map6.put("title","尖电量"); + map6.put("content",new BigDecimal(t6).divide(new BigDecimal(100000)).setScale(4,BigDecimal.ROUND_DOWN)); + list.add(map6); + + idxStart = idxStart+8; + int t7= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map7 =new LinkedHashMap<>(); + map7.put("title","计损尖电量"); + map7.put("content",new BigDecimal(t7).divide(new BigDecimal(100000)).setScale(4,BigDecimal.ROUND_DOWN)); + list.add(map7); + + idxStart = idxStart+8; + int t8= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map8 =new LinkedHashMap<>(); + map8.put("title","尖金额"); + map8.put("content",new BigDecimal(t8).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN)+"元"); + list.add(map8); + + idxStart = idxStart+8; + int t9= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map9 =new LinkedHashMap<>(); + map9.put("title","峰单价"); + map9.put("content",new BigDecimal(t9).divide(new BigDecimal(10000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/分钟"); + list.add(map9); + + idxStart = idxStart+8; + int t10= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map10 =new LinkedHashMap<>(); + map10.put("title","峰电量"); + map10.put("content",new BigDecimal(t10).divide(new BigDecimal(100000)).setScale(4,BigDecimal.ROUND_DOWN)); + list.add(map10); + + idxStart = idxStart+8; + int t11= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map11 =new LinkedHashMap<>(); + map11.put("title","计损峰电量"); + map11.put("content",new BigDecimal(t11).divide(new BigDecimal(100000)).setScale(4,BigDecimal.ROUND_DOWN)); + list.add(map11); + + idxStart = idxStart+8; + int t12= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map12 =new LinkedHashMap<>(); + map12.put("title","峰金额"); + map12.put("content",new BigDecimal(t12).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN)+"元"); + list.add(map12); + + idxStart = idxStart+8; + int t13= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map13 =new LinkedHashMap<>(); + map13.put("title","平电价"); + map13.put("content",new BigDecimal(t13).divide(new BigDecimal(10000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/分钟"); + list.add(map13); + + idxStart = idxStart+8; + int t14= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map14 =new LinkedHashMap<>(); + map14.put("title","平电量"); + map14.put("content",new BigDecimal(t14).divide(new BigDecimal(100000)).setScale(4,BigDecimal.ROUND_DOWN)); + list.add(map14); + + idxStart = idxStart+8; + int t15= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map15 =new LinkedHashMap<>(); + map15.put("title","计损平电量"); + map15.put("content",new BigDecimal(t15).divide(new BigDecimal(100000)).setScale(4,BigDecimal.ROUND_DOWN)); + list.add(map15); + + idxStart = idxStart+8; + int t16= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map16 =new LinkedHashMap<>(); + map16.put("title","平金额"); + map16.put("content",new BigDecimal(t16).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN)+"元"); + list.add(map16); + + idxStart = idxStart+8; + int t17= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map17 =new LinkedHashMap<>(); + map17.put("title","谷单价"); + map17.put("content",new BigDecimal(t17).divide(new BigDecimal(10000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/分钟"); + list.add(map17); + + idxStart = idxStart+8; + int t18= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map18=new LinkedHashMap<>(); + map18.put("title","谷电量"); + map18.put("content",new BigDecimal(t18).divide(new BigDecimal(100000)).setScale(4,BigDecimal.ROUND_DOWN)); + list.add(map18); + + idxStart = idxStart+8; + int t19= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map19 =new LinkedHashMap<>(); + map19.put("title","计损谷电量"); + map19.put("content",new BigDecimal(t19).divide(new BigDecimal(100000)).setScale(4,BigDecimal.ROUND_DOWN)); + list.add(map19); + + idxStart = idxStart+8; + int t20= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map20 =new LinkedHashMap<>(); + map20.put("title","谷金额"); + map20.put("content",new BigDecimal(t20).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN)+"元"); + list.add(map20); + + + idxStart = idxStart+8; + int t21= HexUtils.reverseHexInt(content.substring(idxStart, 10 + idxStart)); + Map map21 =new LinkedHashMap<>(); + map21.put("title","电表总起值"); + map21.put("content",new BigDecimal(t21).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN)); + list.add(map21); + + idxStart = idxStart+10; + int t22= HexUtils.reverseHexInt(content.substring(idxStart, 10 + idxStart)); + Map map22 =new LinkedHashMap<>(); + map22.put("title","电表总止值"); + map22.put("content",new BigDecimal(t22).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN)); + list.add(map22); + + idxStart = idxStart+10; + int t23= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map23 =new LinkedHashMap<>(); + map23.put("title","总电量"); + map23.put("content",new BigDecimal(t23).divide(new BigDecimal(100000)).setScale(4,BigDecimal.ROUND_DOWN)); + list.add(map23); + + idxStart = idxStart+8; + int t24= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map24 =new LinkedHashMap<>(); + map24.put("title","计损总电量"); + map24.put("content",new BigDecimal(t24).divide(new BigDecimal(100000)).setScale(4,BigDecimal.ROUND_DOWN)); + list.add(map24); + + idxStart = idxStart+8; + int t211= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map211 =new LinkedHashMap<>(); + map211.put("title","消费金额"); + map211.put("content",new BigDecimal(t211).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN)+"元"); + list.add(map21); + +// idxStart = idxStart+8; +// Map map221 =new LinkedHashMap<>(); +// map221.put("title","占地费金额(不参与计算)"); +// map221.put("content","不参与计算"); +// list.add(map221); + + idxStart = idxStart+8; + Map map25=new LinkedHashMap<>(); + map25.put("title","电动汽车唯一标识"); + String sub = content.substring(idxStart, 34 + idxStart); + if("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF".equals(sub) || "0000000000000000000000000000000000".equals(sub)){ + map25.put("content","无"); + }else{ + map25.put("content",asciiToString(content.substring(idxStart, 34+ idxStart))); + } + + list.add(map25); + + idxStart = idxStart+34; + int t26= HexUtils.reverseHexInt(content.substring(idxStart, 2+ idxStart)); + Map map26=new LinkedHashMap<>(); + map26.put("title","交易标识"); + if(t26==1){ + map26.put("content","app 启动"); + }else if(t26==2){ + map26.put("content","卡启动"); + }else if(t26==4){ + map26.put("content","离线卡启动"); + }else{ + map26.put("content","vin 码启动充电"); + } + list.add(map26); + + idxStart = idxStart+2; + Map map27 =new LinkedHashMap<>(); + map27.put("title","交易日期、时间"); + map27.put("content", DateUtil.format(CP56Time2a.cp56toDate(content.substring(idxStart, 14 + idxStart)), NORM_DATETIME_FORMATTER)); + list.add(map3); + + idxStart = idxStart+14; + int t28= HexUtils.reverseHexInt(content.substring(idxStart, 2+ idxStart)); + Map map28=new LinkedHashMap<>(); + map28.put("title","交易标识"); + if(t28==1){ + map28.put("content","app 启动"); + }else if(t26==2){ + map28.put("content","卡启动"); + }else if(t26==4){ + map28.put("content","离线卡启动"); + }else{ + map28.put("content","vin 码启动充电"); + } + list.add(map28); + + idxStart = idxStart+2; + Map map29 =new LinkedHashMap<>(); + map29.put("title","停止原因"); + map29.put("content",translate(content.substring(idxStart, 2 + idxStart))); + list.add(map29); + + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getReplyOrderDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","交易记录确认(0x40)"); + jiexi.put("content",content); + jiexi.put("response","应答"); + List> list = new LinkedList<>(); + int idxStart = 12; + Map map =new LinkedHashMap<>(); + map.put("title","交易流水号"); + map.put("content",content.substring(12,44)); + list.add(map); + idxStart = idxStart+32; + + int t6= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map6 =new LinkedHashMap<>(); + map6.put("title","确认结果"); + if(t6==0){ + map6.put("content","上传成功"); + }else{ + map6.put("content","非法账单"); + } + list.add(map6); + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getBalanceUpdateReplyDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","余额更新应答(0x41)"); + jiexi.put("content",content); + jiexi.put("response","应答"); + List> list = new LinkedList<>(); + int idxStart = 12; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + idxStart = idxStart+14; + + int t2= HexUtils.reverseHexInt(content.substring(idxStart, 16 + idxStart)); + Map map2 =new LinkedHashMap<>(); + map2.put("title","物理卡号"); + map2.put("content",t2); + list.add(map2); + + idxStart = idxStart+16; + int t3= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map3 =new LinkedHashMap<>(); + map3.put("title","修改结果"); + if(t3==0){ + map3.put("content","修改成功"); + }else if(t3==1){ + map3.put("content","设备编号错误"); + }else{ + map3.put("content","卡号错误"); + } + list.add(map3); + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + + + @Override + public R getReplyBalanceUpdateReplyDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","远程账户余额更新(0x42)"); + jiexi.put("content",content); + jiexi.put("response","按需发送"); + List> list = new LinkedList<>(); + int idxStart = 12; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + + idxStart = idxStart+14; + Map map001 =new LinkedHashMap<>(); + map001.put("title","抢号"); + String substring = content.substring(idxStart, 2 + idxStart); + if("01".equals(substring)){ + map001.put("content","A枪"); + }else{ + map001.put("content","B枪"); + } + list.add(map001); + + idxStart = idxStart+2; + int t2= HexUtils.reverseHexInt(content.substring(idxStart, 16 + idxStart)); + Map map2 =new LinkedHashMap<>(); + map2.put("title","物理卡号"); + map2.put("content",t2); + list.add(map2); + + idxStart = idxStart+16; + int t3= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map3 =new LinkedHashMap<>(); + map3.put("title","修改后账户金额"); + map3.put("content",new BigDecimal(t3).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_DOWN)+"元"); + list.add(map3); + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getReplyPileConfigReplyDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","充电桩工作参数设置(0x52)"); + jiexi.put("content",content); + jiexi.put("response","按需发送"); + List> list = new LinkedList<>(); + int idxStart = 12; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + + idxStart = idxStart+14; + int t9= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map9 =new LinkedHashMap<>(); + map9.put("title","是否允许工作"); + if(t9==0){ + map9.put("content","允许正常工作"); + }else{ + map9.put("content","停止使用,锁定充电桩"); + } + list.add(map9); + + idxStart = idxStart+2; + int t10= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map10 =new LinkedHashMap<>(); + map10.put("title","充电桩最大允许输出功率"); + map10.put("content",t10); + list.add(map10); + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + + + @Override + public R getPileConfigReplyDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","充电桩工作参数设置应答(0x51)"); + jiexi.put("content",content); + jiexi.put("response","按需发送"); + List> list = new LinkedList<>(); + int idxStart = 12; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + + idxStart = idxStart+14; + int t9= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map9 =new LinkedHashMap<>(); + map9.put("title","设置结果"); + if(t9==0){ + map9.put("content","失败"); + }else{ + map9.put("content","成功"); + } + list.add(map9); + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getPileTimeConfigReplyDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","对时设置应答(0x55)"); + jiexi.put("content",content); + jiexi.put("response","应答"); + List> list = new LinkedList<>(); + int idxStart = 12; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + + idxStart = idxStart+14; + Map map3 =new LinkedHashMap<>(); + map3.put("title","当前时间"); + map3.put("content", DateUtil.format(CP56Time2a.cp56toDate(content.substring(idxStart, 14 + idxStart)), NORM_DATETIME_FORMATTER)); + list.add(map3); + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getReplyPileTimeConfigReplyDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","对时设置(0x56)"); + jiexi.put("content",content); + jiexi.put("response","应答"); + List> list = new LinkedList<>(); + int idxStart = 12; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + + idxStart = idxStart+14; + Map map3 =new LinkedHashMap<>(); + map3.put("title","当前时间"); + map3.put("content", DateUtil.format(CP56Time2a.cp56toDate(content.substring(idxStart, 14 + idxStart)), NORM_DATETIME_FORMATTER)); + list.add(map3); + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getRateModelConfigReplyDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","计费模型应答(0x57)"); + jiexi.put("content",content); + jiexi.put("response","按需发送"); + List> list = new LinkedList<>(); + int idxStart = 12; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + + idxStart = idxStart+14; + int t7= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map7 =new LinkedHashMap<>(); + map7.put("title","计费模型编码"); + map7.put("content",t7); + list.add(map7); + + idxStart = idxStart+8; + int t6= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map6 =new LinkedHashMap<>(); + map6.put("title","设置结果"); + if(t6==0){ + map6.put("content","失败"); + }else{ + map6.put("content","成功"); + } + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getReplyRateModelConfigReplyDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","计费模型设置(0x58)"); + jiexi.put("content",content); + jiexi.put("response","按需发送"); + List> list = new LinkedList<>(); + int idxStart = 12; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + + idxStart = idxStart+14; + int t1= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map1 =new LinkedHashMap<>(); + map1.put("title","计费模型编码"); + map1.put("content",t1); + list.add(map1); + + idxStart = idxStart+8; + int t5= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map5 =new LinkedHashMap<>(); + map5.put("title","尖费电费费率"); + map5.put("content",new BigDecimal(t5).divide(new BigDecimal(10000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/度"); + list.add(map5); + + idxStart = idxStart+8; + int t6= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map6 =new LinkedHashMap<>(); + map6.put("title","尖服务费费率"); + map6.put("content",new BigDecimal(t6).divide(new BigDecimal(10000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/度"); + list.add(map6); + + + idxStart = idxStart+8; + int t7= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map7 =new LinkedHashMap<>(); + map7.put("title","峰电费费率"); + map7.put("content",new BigDecimal(t7).divide(new BigDecimal(10000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/度"); + list.add(map7); + + idxStart = idxStart+8; + int t8= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map8 =new LinkedHashMap<>(); + map8.put("title","峰服务费费率"); + map8.put("content",new BigDecimal(t8).divide(new BigDecimal(10000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/度"); + list.add(map8); + + idxStart = idxStart+8; + int t9= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map9 =new LinkedHashMap<>(); + map9.put("title","平电费费率"); + map9.put("content",new BigDecimal(t9).divide(new BigDecimal(10000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/度"); + list.add(map9); + + idxStart = idxStart+8; + int t10= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map10 =new LinkedHashMap<>(); + map10.put("title","平服务费费率"); + map10.put("content",new BigDecimal(t10).divide(new BigDecimal(10000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/度"); + list.add(map10); + + + idxStart = idxStart+8; + int t11= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map11 =new LinkedHashMap<>(); + map11.put("title","谷电费费率"); + map11.put("content",new BigDecimal(t11).divide(new BigDecimal(10000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/度"); + list.add(map11); + + idxStart = idxStart+8; + int t12= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart)); + Map map12 =new LinkedHashMap<>(); + map12.put("title","谷服务费费率"); + map12.put("content",new BigDecimal(t12).divide(new BigDecimal(10000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/度"); + list.add(map8); + + idxStart = idxStart+8; + Map map13 =new LinkedHashMap<>(); + int t13= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + map13.put("title","计损比例"); + map13.put("content", t13); + list.add(map13); + + idxStart = idxStart+2; + int rate0= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate0 =new LinkedHashMap<>(); + mapRate0.put("title","0:00~0:30 时段费率号"); + mapRate0.put("content",rateName(rate0)); + list.add(mapRate0); + + idxStart = idxStart+2; + int rate1= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate1 =new LinkedHashMap<>(); + mapRate1.put("title","0:30~1:00 时段费率号"); + mapRate1.put("content",rateName(rate1)); + list.add(mapRate1); + + idxStart = idxStart+2; + int rate2= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate2 =new LinkedHashMap<>(); + mapRate2.put("title","1:00~1:30 时段费率号"); + mapRate2.put("content",rateName(rate2)); + list.add(mapRate2); + + idxStart = idxStart+2; + int rate3= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate3 =new LinkedHashMap<>(); + mapRate3.put("title","1:30~2:00 时段费率号"); + mapRate3.put("content",rateName(rate3)); + list.add(mapRate3); + + idxStart = idxStart+2; + int rate4= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate4 =new LinkedHashMap<>(); + mapRate4.put("title","2:00~2:30 时段费率号"); + mapRate4.put("content",rateName(rate4)); + list.add(mapRate4); + + idxStart = idxStart+2; + int rate5= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate5 =new LinkedHashMap<>(); + mapRate5.put("title","2:30~3:00 时段费率号"); + mapRate5.put("content",rateName(rate5)); + list.add(mapRate5); + + idxStart = idxStart+2; + int rate6= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate6 =new LinkedHashMap<>(); + mapRate6.put("title","3:00~3:30 时段费率号"); + mapRate6.put("content",rateName(rate6)); + list.add(mapRate6); + + idxStart = idxStart+2; + int rate7= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate7 =new LinkedHashMap<>(); + mapRate7.put("title","3:30~4:00 时段费率号"); + mapRate7.put("content",rateName(rate7)); + list.add(mapRate7); + + idxStart = idxStart+2; + int rate8= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate8 =new LinkedHashMap<>(); + mapRate8.put("title","4:00~4:30 时段费率号"); + mapRate8.put("content",rateName(rate8)); + list.add(mapRate8); + + idxStart = idxStart+2; + int rate9= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate9 =new LinkedHashMap<>(); + mapRate9.put("title","4:30~5:00 时段费率号"); + mapRate9.put("content",rateName(rate9)); + list.add(mapRate9); + + idxStart = idxStart+2; + int rate10= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate10 =new LinkedHashMap<>(); + mapRate10.put("title","5:00~5:30 时段费率号"); + mapRate10.put("content",rateName(rate10)); + list.add(mapRate10); + + idxStart = idxStart+2; + int rate11= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate11 =new LinkedHashMap<>(); + mapRate11.put("title","5:30~6:00 时段费率号"); + mapRate11.put("content",rateName(rate11)); + list.add(mapRate11); + + idxStart = idxStart+2; + int rate12= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate12 =new LinkedHashMap<>(); + mapRate12.put("title","6:00~6:30 时段费率号"); + mapRate12.put("content",rateName(rate12)); + list.add(mapRate12); + + idxStart = idxStart+2; + int rate13= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate13 =new LinkedHashMap<>(); + mapRate13.put("title","6:30~7:00 时段费率号"); + mapRate13.put("content",rateName(rate13)); + list.add(mapRate13); + + idxStart = idxStart+2; + int rate14= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate14 =new LinkedHashMap<>(); + mapRate14.put("title","7:00~7:30 时段费率号"); + mapRate14.put("content",rateName(rate14)); + list.add(mapRate14); + + idxStart = idxStart+2; + int rate15= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate15 =new LinkedHashMap<>(); + mapRate15.put("title","7:30~8:00 时段费率号"); + mapRate15.put("content",rateName(rate15)); + list.add(mapRate15); + + idxStart = idxStart+2; + int rate16= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate16 =new LinkedHashMap<>(); + mapRate16.put("title","8:00~8:30 时段费率号"); + mapRate16.put("content",rateName(rate16)); + list.add(mapRate16); + + idxStart = idxStart+2; + int rate17= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate17 =new LinkedHashMap<>(); + mapRate17.put("title","8:30~9:00 时段费率号"); + mapRate17.put("content",rateName(rate17)); + list.add(mapRate17); + + idxStart = idxStart+2; + int rate18= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate18 =new LinkedHashMap<>(); + mapRate18.put("title","9:00~9:30 时段费率号"); + mapRate18.put("content",rateName(rate18)); + list.add(mapRate18); + + idxStart = idxStart+2; + int rate19= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate19 =new LinkedHashMap<>(); + mapRate19.put("title","9:30~10:00 时段费率号"); + mapRate19.put("content",rateName(rate19)); + list.add(mapRate19); + + idxStart = idxStart+2; + int rate20= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate20 =new LinkedHashMap<>(); + mapRate20.put("title","10:00~10:30 时段费率号"); + mapRate20.put("content",rateName(rate20)); + list.add(mapRate20); + + idxStart = idxStart+2; + int rate21= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate21 =new LinkedHashMap<>(); + mapRate21.put("title","10:30~11:00 时段费率号"); + mapRate21.put("content",rateName(rate21)); + list.add(mapRate21); + + idxStart = idxStart+2; + int rate22= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate22 =new LinkedHashMap<>(); + mapRate22.put("title","11:00~11:30 时段费率号"); + mapRate22.put("content",rateName(rate22)); + list.add(mapRate22); + + idxStart = idxStart+2; + int rate23= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate23 =new LinkedHashMap<>(); + mapRate23.put("title","11:30~12:00 时段费率号"); + mapRate23.put("content",rateName(rate23)); + list.add(mapRate23); + + idxStart = idxStart+2; + int rate24= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate24 =new LinkedHashMap<>(); + mapRate24.put("title","12:00~12:30 时段费率号"); + mapRate24.put("content",rateName(rate24)); + list.add(mapRate24); + + idxStart = idxStart+2; + int rate25= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate25 =new LinkedHashMap<>(); + mapRate25.put("title","12:30~13:00 时段费率号"); + mapRate25.put("content",rateName(rate25)); + list.add(mapRate25); + + idxStart = idxStart+2; + int rate26= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRat26 =new LinkedHashMap<>(); + mapRat26.put("title","13:00~13:30 时段费率号"); + mapRat26.put("content",rateName(rate26)); + list.add(mapRat26); + + idxStart = idxStart+2; + int rate27= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate27 =new LinkedHashMap<>(); + mapRate27.put("title","13:30~14:00 时段费率号"); + mapRate27.put("content",rateName(rate27)); + list.add(mapRate27); + + idxStart = idxStart+2; + int rate28= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate28 =new LinkedHashMap<>(); + mapRate28.put("title","14:00~14:30 时段费率号"); + mapRate28.put("content",rateName(rate28)); + list.add(mapRate28); + + idxStart = idxStart+2; + int rate29= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate29 =new LinkedHashMap<>(); + mapRate29.put("title","14:30~15:00 时段费率号"); + mapRate29.put("content",rateName(rate29)); + list.add(mapRate29); + + idxStart = idxStart+2; + int rate30= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate30 =new LinkedHashMap<>(); + mapRate30.put("title","15:00~15:30 时段费率号"); + mapRate30.put("content",rateName(rate30)); + list.add(mapRate30); + + idxStart = idxStart+2; + int rate31= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate31 =new LinkedHashMap<>(); + mapRate31.put("title","15:30~16:00 时段费率号"); + mapRate31.put("content",rateName(rate31)); + list.add(mapRate31); + + idxStart = idxStart+2; + int rate32= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate32 =new LinkedHashMap<>(); + mapRate32.put("title","16:00~16:30 时段费率号"); + mapRate32.put("content",rateName(rate32)); + list.add(mapRate32); + + idxStart = idxStart+2; + int rate33= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate33 =new LinkedHashMap<>(); + mapRate33.put("title","16:30~17:00 时段费率号"); + mapRate33.put("content",rateName(rate33)); + list.add(mapRate33); + + idxStart = idxStart+2; + int rate34= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate34 =new LinkedHashMap<>(); + mapRate34.put("title","17:00~17:30 时段费率号"); + mapRate34.put("content",rateName(rate34)); + list.add(mapRate34); + + idxStart = idxStart+2; + int rate35= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate35 =new LinkedHashMap<>(); + mapRate35.put("title","17:30~18:00 时段费率号"); + mapRate35.put("content",rateName(rate35)); + list.add(mapRate35); + + idxStart = idxStart+2; + int rate36= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate36 =new LinkedHashMap<>(); + mapRate36.put("title","18:00~18:30 时段费率号"); + mapRate36.put("content",rateName(rate36)); + list.add(mapRate36); + + idxStart = idxStart+2; + int rate37= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate37 =new LinkedHashMap<>(); + mapRate37.put("title","18:30~19:00 时段费率号"); + mapRate37.put("content",rateName(rate37)); + list.add(mapRate37); + + idxStart = idxStart+2; + int rate38= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate38 =new LinkedHashMap<>(); + mapRate38.put("title","19:00~19:30 时段费率号"); + mapRate38.put("content",rateName(rate38)); + list.add(mapRate38); + + idxStart = idxStart+2; + int rate39= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate39 =new LinkedHashMap<>(); + mapRate39.put("title","19:30~20:00 时段费率号"); + mapRate39.put("content",rateName(rate39)); + list.add(mapRate39); + + idxStart = idxStart+2; + int rate40= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate40 =new LinkedHashMap<>(); + mapRate40.put("title","20:00~20:30 时段费率号"); + mapRate40.put("content",rateName(rate40)); + list.add(mapRate40); + + idxStart = idxStart+2; + int rate41= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate41 =new LinkedHashMap<>(); + mapRate41.put("title","20:30~21:00 时段费率号"); + mapRate41.put("content",rateName(rate41)); + list.add(mapRate41); + + idxStart = idxStart+2; + int rate42= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate42 =new LinkedHashMap<>(); + mapRate42.put("title","21:00~21:30 时段费率号"); + mapRate42.put("content",rateName(rate42)); + list.add(mapRate42); + + idxStart = idxStart+2; + int rate43= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate43 =new LinkedHashMap<>(); + mapRate43.put("title","21:30~21:00 时段费率号"); + mapRate43.put("content",rateName(rate43)); + list.add(mapRate43); + + idxStart = idxStart+2; + int rate44= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate44 =new LinkedHashMap<>(); + mapRate44.put("title","22:00~22:30 时段费率号"); + mapRate44.put("content",rateName(rate44)); + list.add(mapRate44); + + idxStart = idxStart+2; + int rate45= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate45 =new LinkedHashMap<>(); + mapRate45.put("title","22:30~22:00 时段费率号"); + mapRate45.put("content",rateName(rate45)); + list.add(mapRate45); + + idxStart = idxStart+2; + int rate46= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate46 =new LinkedHashMap<>(); + mapRate46.put("title","23:00~23:30 时段费率号"); + mapRate46.put("content",rateName(rate46)); + list.add(mapRate46); + + idxStart = idxStart+2; + int rate47= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map mapRate47 =new LinkedHashMap<>(); + mapRate47.put("title","23:30~00:00 时段费率号"); + mapRate47.put("content",rateName(rate47)); + list.add(mapRate47); + + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getRemoteRebootReplyDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","远程重启应答(0x91)"); + jiexi.put("content",content); + jiexi.put("response","按需发送"); + List> list = new LinkedList<>(); + int idxStart = 12; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + + idxStart = idxStart+14; + int t6= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map6 =new LinkedHashMap<>(); + map6.put("title","设置结果"); + if(t6==0){ + map6.put("content","失败"); + }else{ + map6.put("content","成功"); + } + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getReplyRemoteRebootReplyDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","远程重启(0x92)"); + jiexi.put("content",content); + jiexi.put("response","按需发送"); + List> list = new LinkedList<>(); + int idxStart = 12; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + + idxStart = idxStart+14; + int t6= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map6 =new LinkedHashMap<>(); + map6.put("title","执行控制"); + if(t6==1){ + map6.put("content","立即执行"); + }else{ + map6.put("content","空闲执行"); + } + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getRemoteUpgradeReplyDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","远程更新应答(0x93)"); + jiexi.put("content",content); + jiexi.put("response","按需发送"); + List> list = new LinkedList<>(); + int idxStart = 12; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + + idxStart = idxStart+14; + int t6= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map6 =new LinkedHashMap<>(); + map6.put("title","升级状态"); + if(t6==0){ + map6.put("content","成功"); + }else if(t6==1){ + map6.put("content","编号错误"); + }else if(t6==2){ + map6.put("content","程序与桩型号不符"); + }else{ + map6.put("content","下载更新文件超时"); + } + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + @Override + public R getRemoteUpgradeDataLogic(String content) { + Map jiexi =new HashMap<>(); + jiexi.put("name","远程更新(0x94)"); + jiexi.put("content",content); + jiexi.put("response","按需发送"); + List> list = new LinkedList<>(); + int idxStart = 12; + + Map map0 =new LinkedHashMap<>(); + map0.put("title","桩编号"); + map0.put("content",content.substring(idxStart,idxStart+14)); + list.add(map0); + + idxStart = idxStart+14; + int t6= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map6 =new LinkedHashMap<>(); + map6.put("title","桩型号"); + if(t6==1){ + map6.put("content","直流"); + }else{ + map6.put("content","交流"); + } + + idxStart = idxStart+2; + int t7= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map7 =new LinkedHashMap<>(); + map7.put("title","桩功率"); + map7.put("content",t7); + + idxStart = idxStart+4; + Map map8=new LinkedHashMap<>(); + map8.put("title","升级服务器地址"); + map8.put("content",asciiToString(content.substring(idxStart, 32+ idxStart))); + list.add(map8); + + + idxStart = idxStart+32; + int t9= HexUtils.reverseHexInt(content.substring(idxStart, 4 + idxStart)); + Map map9 =new LinkedHashMap<>(); + map9.put("title","升级服务器端口"); + map9.put("content",t9); + + idxStart = idxStart+4; + Map map10=new LinkedHashMap<>(); + map10.put("title","升级服务器地址"); + map10.put("content",asciiToString(content.substring(idxStart, 32+ idxStart))); + list.add(map10); + + idxStart = idxStart+32; + Map map11=new LinkedHashMap<>(); + map11.put("title","用户名"); + map11.put("content",asciiToString(content.substring(idxStart, 32+ idxStart))); + list.add(map11); + + idxStart = idxStart+32; + Map map12=new LinkedHashMap<>(); + map12.put("title","密码"); + map12.put("content",asciiToString(content.substring(idxStart, 32+ idxStart))); + list.add(map12); + + idxStart = idxStart+32; + Map map13=new LinkedHashMap<>(); + map13.put("title","文件路径"); + map13.put("content",asciiToString(content.substring(idxStart, 64+ idxStart))); + list.add(map13); + + idxStart = idxStart+64; + int t14= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map14 =new LinkedHashMap<>(); + map14.put("title","执行控制"); + if(t14==1){ + map6.put("content","立即执行"); + }else{ + map6.put("content","空闲执行"); + } + list.add(map14); + + idxStart = idxStart+2; + int t15= HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart)); + Map map15 =new LinkedHashMap<>(); + map6.put("title","下载超时时间"); + map14.put("content",t15+"分钟"); + list.add(map14); + + + jiexi.put("analysis",list); + return R.ok(jiexi); + } + + private String rateName(Integer status){ + + if(status==0){ + return "0"+status+" 尖费率"; + }else if(status==1){ + return "0"+status+" 峰费率"; + }else if(status==2){ + return "0"+status+" 平费率"; + }else{ + return "0"+status+" 谷费率"; + } + } + + + public static String asciiToString(String text) { + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < text.length(); i++) { + if (text.charAt(i) == '1' && i < text.length() - 2) { + int code = Integer.parseInt(text.substring(i, i + 3), 16); + builder.append((char) code); + i += 2; + } else if (i < text.length() - 1) { + int code = Integer.parseInt(text.substring(i, i + 2), 16); + builder.append((char) code); + i += 1; + } + } + return builder.toString(); + } + + + public static String binCodeParser(int code){ + StringBuilder st = new StringBuilder(""); + String[] faults = { + "急停按钮动作故障", // Bit1 (最低位) + "无可用整流模块", // Bit2 + "出风口温度过高", // Bit3 + "交流防雷故障", // Bit4 + "交直流模块 DC20 通信中断", // Bit5 + "绝缘检测模块 FC08 通信中断", // Bit6 + "电度表通信中断", // Bit7 + "读卡器通信中断", // Bit8 + "RC10 通信中断", // Bit9 + "风扇调速板故障", // Bit10 + "直流熔断器故障", // Bit11 + "高压接触器故障", // Bit12 + "门打开" // Bit13 (最高位) + }; + for (int i = 0; i < 13; i++) { + int bit = (code >> i) & 1; // 右移i位取最低位 + + if(bit == 1){ + st.append(faults[i]+":是"+"|"); + } + } + return st.toString(); + } + + + + public static String binCodeParser1(int code,String reason1,String reason2,String reason3,String reason4){ + StringBuilder st = new StringBuilder(""); + + // 提取每个位(从最低位LSB开始) + int bit1 = (code >> 0) & 1; // 最低位(第1位) + int bit2 = (code >> 1) & 1; // 第2位 + int bit3 = (code >> 2) & 1; // 第3位 + int bit4 = (code >> 3) & 1; // 第4位 + int bit5 = (code >> 4) & 1; // 第5位 + int bit6 = (code >> 5) & 1; // 第6位 + int bit7 = (code >> 6) & 1; // 第7位 + int bit8 = (code >> 7) & 1; // 最高位(第8位) + + if(bit1==1 || bit2==1){ + st.append(reason1+"|"); + } + if(bit3==1 || bit4==1){ + st.append(reason2+"|"); + } + if(bit5==1 || bit6==1){ + st.append(reason3+"|"); + } + if(bit7==1 || bit8==1){ + st.append(reason4+"|"); + } + if("".equals(st.toString())){ + return "无"; + } + + return st.toString(); + } + + + public static String binCodeParser2(int code,String [] faults){ + StringBuilder st = new StringBuilder(""); + + // 解析每组状态(从低位到高位) + for (int i = 0; i < 8; i++) { + int bitLow = (code >> (i * 2)) & 1; // 组内低位 + int bitHigh = (code >> (i * 2 + 1)) & 1; // 组内高位 + String status = bitHigh + "" + bitLow; // 组合状态(高位+低位) + + if(!"00".equals(status)){ + st.append(faults[i]+"|"); + } + } + if("".equals(st.toString())){ + return "无"; + } + return st.toString(); + } + + + public static String binCodeParser3(int code,String reason1,String reason2){ + StringBuilder st = new StringBuilder(""); + + // 提取每个位(从最低位LSB开始) + int bit1 = (code >> 0) & 1; // 最低位(第1位) + int bit2 = (code >> 1) & 1; // 第2位 + int bit3 = (code >> 2) & 1; // 第3位 + int bit4 = (code >> 3) & 1; // 第4位 + int bit5 = (code >> 4) & 1; // 第5位 + int bit6 = (code >> 5) & 1; // 第6位 + int bit7 = (code >> 6) & 1; // 第7位 + int bit8 = (code >> 7) & 1; // 最高位(第8位) + + if(bit1==1 || bit2==1){ + st.append(reason1+"|"); + } + if(bit3==1 || bit4==1){ + st.append(reason2+"|"); + } + if("".equals(st.toString())){ + return "无"; + } + return st.toString(); + } + + private String translate(String stopReason) { + + String sr = SM.get(stopReason); + if (sr == null) { + final Integer stopReasonInt = Integer.valueOf(stopReason, 16); + if (stopReasonInt <= 0x49) { +// if (stopReasonInt >= 0x40 && stopReasonInt <= 0x49) { // todo wi lh 0x40? + sr = "充电完成(0X".concat(stopReason).concat(")"); + } else if (stopReasonInt <= 0x69) { + sr = "充电启动失败(0X".concat(stopReason).concat(")"); + } else if (stopReasonInt < 0x90) { + sr = "充电异常中止(0X".concat(stopReason).concat(")"); + } else if (stopReasonInt == 0x90) { + sr = "未知原因中止(0X".concat(stopReason).concat(")"); + } else { + sr = "未知原因中止(UC_0X".concat(stopReason).concat(")"); + } + } + return sr; +// } + } + + + + public static void main(String[] args) { + String st="D0FB0100"; + + System.out.println(HexUtils.reverseHexInt("DF07")); + System.out.println(HexUtils.reverseHexInt("1D00")); + System.out.println(asciiToString("3030303030303030303030303030303030")); + + } } diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/utils/CP56Time2a.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/utils/CP56Time2a.java new file mode 100644 index 00000000..dee416f8 --- /dev/null +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/utils/CP56Time2a.java @@ -0,0 +1,246 @@ +package com.xhpc.card.utils; + +import cn.hutool.core.date.DateField; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import com.xhpc.pp.utils.HexUtils; + +import java.util.Calendar; +import java.util.Date; + +import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMATTER; + +public class CP56Time2a { + + public static final String DATE_FORMAT_DATE_TIME = "yyyy-MM-dd HH:mm:ss"; + public static Date cp56toDate(String hex) { + + byte[] bytes = HexUtils.toBytes(hex); + int milliseconds = HexUtils.reverseHexInt(hex.substring(0, 4)); + int minutes = bytes[2] & 0x3f; + int hours = bytes[3] & 0x1f; + int days = bytes[4] & 0x1f; + int months = bytes[5] & 0x0f; + int years = bytes[6] & 0x7f; + DateTime dt = new DateTime(); + dt.setField(DateField.MILLISECOND, 0); + dt.setField(DateField.SECOND, milliseconds / 1000); + dt.setField(DateField.MINUTE, minutes); + dt.setField(DateField.HOUR_OF_DAY, hours); + dt.setField(DateField.MONTH, months - 1); + dt.setField(DateField.DAY_OF_MONTH, days); + dt.setField(DateField.YEAR, years + 2000); + return dt.toCalendar().getTime(); + } + + public static String cp56toDateStr(String hex) { + + Date date = cp56toDate(hex); + return DateTime.of(date).toString(DATE_FORMAT_DATE_TIME); + } + + public static String cp56toDateTSStr(String hex) { + + byte[] bytes = hex.getBytes(); + int[] infoElements = new int[bytes.length]; + for (int i = 0; i < bytes.length; i++) { + infoElements[i] = bytes[i]; + } + return TimeScale(infoElements); + } + + public static String toCp56Hex(Date d) { + + byte[] result = new byte[7]; + Calendar date = Calendar.getInstance(); + date.setTime(d); + String milliSecond = String.format("%04X", (date.get(Calendar.SECOND) * 1000)); + String reversehilo = milliSecond.substring(2, 4).concat(milliSecond.substring(0, 2)); + result[0] = (byte) date.get(Calendar.MINUTE); + result[1] = (byte) (date.get(Calendar.HOUR_OF_DAY)); + result[2] = (byte) (date.get(Calendar.DAY_OF_MONTH)); + result[3] = (byte) (date.get(Calendar.MONTH) + 1); + result[4] = (byte) (date.get(Calendar.YEAR) % 100); + return reversehilo.concat(HexUtils.toHex(result)).substring(0, 14); + } + + public static String decode(byte[] b) { + + int year = b[6] & 0x7F; + int month = b[5] & 0x0F; + int day = b[4] & 0x1F; + int week = (b[4] & 0xE0) / 32; + // int week = (b[4] & 0xE0) >> 5; + int hour = b[3] & 0x1F; + int minute = b[2] & 0x3F; + int second = (b[1] << 8) + b[0]; + String str = "20" + year + "-" + + String.format("%02d", month) + "-" + + String.format("%02d", day) + "T" + + String.format("%02d", hour) + ":" + + String.format("%02d", minute) + ":" + + String.format("%02d", second / 1000) + "." + + String.format("%03d", second % 1000); + return str; + } + + public static String encode(Date date) { + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + StringBuilder builder = new StringBuilder(); + String milliSecond = String.format("%04X", (calendar.get(Calendar.SECOND) * 1000) + calendar.get(Calendar.MILLISECOND)); + builder.append(milliSecond, 2, 4); + builder.append(milliSecond, 0, 2); + builder.append(String.format("%02X", calendar.get(Calendar.MINUTE) & 0x3F)); + builder.append(String.format("%02X", calendar.get(Calendar.HOUR_OF_DAY) & 0x1F)); + int week = calendar.get(Calendar.DAY_OF_WEEK); + if (week == Calendar.SUNDAY) + week = 7; + else week--; + builder.append(String.format("%02X", (week << 5) + (calendar.get(Calendar.DAY_OF_MONTH) & 0x1F))); + builder.append(String.format("%02X", calendar.get(Calendar.MONTH) + 1)); + builder.append(String.format("%02X", calendar.get(Calendar.YEAR) - 2000)); + return builder.toString(); + } + + /** + * 时标CP56Time2a解析 + * + * @param b 时标CP56Time2a(长度为7 的int数组) + * @return 解析结果 + */ + public static String TimeScale(int[] b) { + + StringBuilder result = new StringBuilder(); + int year = b[6] & 0x7F; + int month = b[5] & 0x0F; + int day = b[4] & 0x1F; + int week = (b[4] & 0xE0) / 32; + int hour = b[3] & 0x1F; + int minute = b[2] & 0x3F; + int second = (b[1] << 8) + b[0]; + result.append("20"); + result.append(year).append("-"); + result.append(String.format("%02d", month)).append("-"); + result.append(String.format("%02d", day)).append(" "); + result.append(hour).append(":").append(minute).append(":"); + result.append(second / 1000 + "." + second % 1000); + return result.toString(); + } + + private static String TimeScale(byte[] bytes) { + + int[] b = new int[bytes.length]; + for (int i = 0; i < bytes.length; i++) { + b[i] = bytes[i]; + } + return TimeScale(b); + } + + /** + * 时间转16进制字符串 + */ + public static String date2HStr(Date date) { + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + StringBuilder builder = new StringBuilder(); + String milliSecond = String.format("%04X", (calendar.get(Calendar.SECOND) * 1000) + calendar.get(Calendar.MILLISECOND)); + builder.append(milliSecond, 2, 4); + builder.append(milliSecond, 0, 2); + builder.append(String.format("%02X", calendar.get(Calendar.MINUTE) & 0x3F)); + builder.append(String.format("%02X", calendar.get(Calendar.HOUR_OF_DAY) & 0x1F)); + int week = calendar.get(Calendar.DAY_OF_WEEK); + if (week == Calendar.SUNDAY) + week = 7; + else week--; + builder.append(String.format("%02X", (week << 5) + (calendar.get(Calendar.DAY_OF_MONTH) & 0x1F))); + builder.append(String.format("%02X", calendar.get(Calendar.MONTH) + 1)); + builder.append(String.format("%02X", calendar.get(Calendar.YEAR) - 2000)); + return builder.toString(); + } + + public static Date toDate(byte[] bytes) { + + int milliseconds1 = bytes[0] < 0 ? 256 + bytes[0] : bytes[0]; + int milliseconds2 = bytes[1] < 0 ? 256 + bytes[1] : bytes[1]; + int milliseconds = milliseconds1 + milliseconds2 * 256; + // 位于 0011 1111 + int minutes = bytes[2] & 0x3f; + // 位于 0001 1111 + int hours = bytes[3] & 0x1f; + // 位于 0000 1111 + int days = bytes[4] & 0x0f; + // 位于 0001 1111 + int months = bytes[5] & 0x0f; + // 位于 0111 1111 + int years = bytes[6] & 0x7f; + final Calendar aTime = Calendar.getInstance(); + aTime.set(Calendar.MILLISECOND, milliseconds); + aTime.set(Calendar.MINUTE, minutes); + aTime.set(Calendar.HOUR_OF_DAY, hours); + aTime.set(Calendar.DAY_OF_MONTH, days); + aTime.set(Calendar.MONTH, months); + aTime.set(Calendar.YEAR, years + 2000); + return aTime.getTime(); + } + + public static byte[] toBytes(Date aDate) { + + byte[] result = new byte[7]; + final Calendar aTime = Calendar.getInstance(); + aTime.setTime(aDate); + final int milliseconds = aTime.get(Calendar.MILLISECOND); + result[0] = (byte) (milliseconds % 256); + result[1] = (byte) (milliseconds / 256); + result[2] = (byte) aTime.get(Calendar.MINUTE); + result[3] = (byte) aTime.get(Calendar.HOUR_OF_DAY); + result[4] = (byte) aTime.get(Calendar.DAY_OF_MONTH); + result[5] = (byte) aTime.get(Calendar.MONTH); + result[6] = (byte) (aTime.get(Calendar.YEAR) % 100); + System.out.println("Year->" + aTime.get(Calendar.YEAR)); + return result; + } + + private static String getCP56time2a(String hex) { + + return "20" + String.format("%02d", Integer.parseInt(hex.substring(12, 14), 16)) + "-" + + String.format("%02d", Integer.parseInt(hex.substring(10, 12), 16)) + "-" + + String.format("%02d", Integer.parseInt(hex.substring(8, 10), 16)) + "T" + + String.format("%02d", Integer.parseInt(hex.substring(6, 8), 16)) + ":" + + String.format("%02d", Integer.parseInt(hex.substring(4, 6), 16)) + ":" + + String.format("%02d", Integer.parseInt(hex.substring(2, 4) + "" + hex.substring(0, 2), 16) / 1000); + } + + public static void main(String[] args) throws InterruptedException { +// Date time = Calendar.getInstance().getTime(); +// System.out.println(String.format("--未编码--: %s", time)); +// String hex = toCp56Hex(time); +// System.out.println("--编码1--:" + hex); +// System.out.println(HexUtils.toBinaryString("90E223133D0416")); + System.out.println("--下达1--:" + DateUtil.format(cp56toDate("E880380D170518"), NORM_DATETIME_FORMATTER)); + System.out.println("--下达2--:" + DateUtil.format(cp56toDate("A50F3A0D170518"), NORM_DATETIME_FORMATTER)); +// System.out.println("toCp56Hex = " + toCp56Hex(cp56toDate("C05D0D171F0116"))); +//// System.out.println("--下达2--:" + DateUtil.format(cp56toDate(""), NORM_DATETIME_FORMAT)); +// String dateStr = "2017-03-01 22:33:23"; +// Date date = DateUtil.parse(dateStr); +// Date newDate = DateUtil.offset(date, DateField.DAY_OF_MONTH, 2); +// System.out.println("--变为--:" + newDate.toString()); +// System.out.println("sudo date " + newDate.getTime()); +// System.out.println("--D0073211110815--:" + DateUtil.format(cp56toDate("D0073211110815"), NORM_DATETIME_FORMAT)); +// System.out.println("--A85B3411110815--:" + DateUtil.format(cp56toDate("A85B3411110815"), NORM_DATETIME_FORMAT)); +// String encode = encode(time); +// System.out.println(String.format("--编码2--:%s", encode)); +// System.out.println("--解码2--:" + decode(HexUtils.toBytes(encode))); + + String s = cp56toDateStr("81461009200A18"); + + System.out.println("-111-变为--:" + s); + + String s1 = cp56toDateStr("1AB42D09200A18"); + + System.out.println("-111-变为--:" + s1); + } + +} diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcTimingChargingModelServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcTimingChargingModelServiceImpl.java index b04d063d..e4bd8edb 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcTimingChargingModelServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcTimingChargingModelServiceImpl.java @@ -164,18 +164,22 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I xhpcTimingChargingModel.setChargingStationId(chargingStationId); xhpcTimingChargingModel.setPhone(xhpcTimingChargingModelDto.getPhone()); - Integer[] chargingPileIds = xhpcTimingChargingModelDto.getChargingPileIds(); - String PileIds =""; - for (int i = 0; i 1){ - PileIds =PileIds+chargingPileIds[i]; - }else if(chargingPileIds.length==1){ - PileIds =chargingPileIds[i]+""; - }else{ - PileIds =PileIds+","+chargingPileIds[i]; + if(xhpcTimingChargingModelDto.getChargingPileIds()!=null){ + Integer[] chargingPileIds = xhpcTimingChargingModelDto.getChargingPileIds(); + String PileIds =""; + for (int i = 0; i 1){ + PileIds =PileIds+chargingPileIds[i]; + }else if(chargingPileIds.length==1){ + PileIds =chargingPileIds[i]+""; + }else{ + PileIds =PileIds+","+chargingPileIds[i]; + } } + xhpcTimingChargingModel.setPileIds(PileIds); } - xhpcTimingChargingModel.setPileIds(PileIds); + + if(xhpcTimingChargingModelDto.getTimingChargingModelId() !=null){ xhpcTimingChargingModel.setTimingChargingModelId(xhpcTimingChargingModelDto.getTimingChargingModelId()); diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcTimingChargingModelMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcTimingChargingModelMapper.xml index 1dedd1a3..d1e1e575 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcTimingChargingModelMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcTimingChargingModelMapper.xml @@ -159,7 +159,10 @@ remark, - phone + phone, + + + pile_ids, @@ -197,7 +200,10 @@ #{remark}, - #{phone} + #{phone}, + + + #{pileIds}, diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsReqChargerOutputDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsReqChargerOutputDataLogic.java index 55ad73ae..9bc085be 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsReqChargerOutputDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/BmsReqChargerOutputDataLogic.java @@ -245,5 +245,13 @@ public class BmsReqChargerOutputDataLogic implements ServiceLogic { double current = BMSCurrentParser.parseBmsCurrent(bmsData,400); System.out.println("BMS电流需求: " + current + " A"); + + int t1 = HexUtils.reverseHexInt("B014");//电桩电流输出值 + System.out.println("BMS电压: " + t1 + " v"); + + + String bmsData1 = "8409"; // 从BMS获取的实际数据 + double current1 = BMSCurrentParser.parseBmsCurrent(bmsData1,400); + System.out.println("BMS电流需求: " + current1 + " A"); } } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/api/XhpcInvoiceApiController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/api/XhpcInvoiceApiController.java index cae51518..8f354c77 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/api/XhpcInvoiceApiController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/api/XhpcInvoiceApiController.java @@ -8,12 +8,23 @@ import com.xhpc.common.redis.service.RedisService; import com.xhpc.common.security.service.TokenService; import com.xhpc.common.util.DateUtil; import com.xhpc.common.util.UserTypeUtil; +import com.xhpc.user.constant.InvoiceMapHistoryOrderStatusConst; import com.xhpc.user.domain.*; +import com.xhpc.user.mapper.XhpcHistoryOrderMapper; +import com.xhpc.user.pojo.XhpcInvoiceMapHistoryOrder; import com.xhpc.user.service.XhpcInvoiceService; import com.xhpc.system.api.model.LoginUser; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; /** * 小程序的InvoiceController @@ -33,6 +44,9 @@ public class XhpcInvoiceApiController extends BaseController { @Resource RedisService redisService; + @Resource + XhpcHistoryOrderMapper xhpcHistoryOrderMapper; + /** * 查询用户显示小红点,即查询用户有几个未读的已开发票 * @@ -154,4 +168,6 @@ public class XhpcInvoiceApiController extends BaseController { return AjaxResult.success(titleResponse); } + + } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcHistoryOrderMapper.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcHistoryOrderMapper.java index 38a3e95e..2aa56378 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcHistoryOrderMapper.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcHistoryOrderMapper.java @@ -54,7 +54,7 @@ public interface XhpcHistoryOrderMapper { List> countOperatorOnHistoryOrderIds(@Param("historyOrderIds")List historyOrderIds); - List> findHistoryOrderIds(@Param("historyOrderIds")List historyOrderIds,@Param("operatorId")Long operatorId); + List> findHistoryOrderIds(@Param("historyOrderIds")List historyOrderIds,@Param("operatorId")String operatorId); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/pojo/XhpcInvoice.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/pojo/XhpcInvoice.java index bdd36fc7..57820b5a 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/pojo/XhpcInvoice.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/pojo/XhpcInvoice.java @@ -167,7 +167,7 @@ public class XhpcInvoice implements Serializable { /** * 充电订单运营商id */ - private Long orderOperatorId; + private String orderOperatorId; /** * 开票运营商id */ diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInvoiceServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInvoiceServiceImpl.java index e0b19ff0..bfa2c352 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInvoiceServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInvoiceServiceImpl.java @@ -35,9 +35,11 @@ import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; import java.math.BigDecimal; +import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; /** @@ -590,6 +592,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { xhpcInvoice.setCreatorType(saveInvoiceInfoRequest.getCreatorType()); xhpcInvoice.setCreator(saveInvoiceInfoRequest.getCreator()); xhpcInvoice.setCreateTime(DateUtils.parseDate(saveInvoiceInfoRequest.getCreateTime())); + xhpcInvoice.setStatus(0); xhpcInvoice.setInvoiceStatus(saveInvoiceInfoRequest.getInvoiceStatus()); xhpcInvoiceMapper.insertSelectiveAndReturnId(xhpcInvoice); @@ -665,13 +668,57 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { throw new Exception("该历史订单已被其他发票包含"); } - List> operatorIdList = xhpcHistoryOrderMapper.countOperatorOnHistoryOrderIds(historyOrderIds); - //该变量是用来计算内部存储的历史订单金额是否与传入的一致 - double totalActPrice = 0; + List> operatorIdList = xhpcHistoryOrderMapper.countOperatorOnHistoryOrderIds(historyOrderIds); + + List> list =new ArrayList<>(); + String operatorNames =""; + String operatorIds =""; for (int i = 0; i stringObjectMap = operatorIdList.get(i); - Long operatorId = Long.valueOf(stringObjectMap.get("operatorId").toString()); + Map map =new HashMap<>(); + String operatorId = stringObjectMap.get("operatorId").toString(); + int invoiceType = Integer.parseInt(stringObjectMap.get("invoiceType").toString()); + String operatorName = stringObjectMap.get("operatorName").toString(); + if(i==0){ + if(invoiceType==1){ + operatorNames = operatorName; + operatorIds = operatorId; + }else{ + map.put("operatorId",stringObjectMap.get("operatorId")); + map.put("invoiceType",invoiceType); + map.put("operatorName",operatorName); + list.add(map); + } + }else{ + if(invoiceType==1){ + operatorNames = operatorNames+","+operatorName; + operatorIds = operatorIds+","+operatorId; + }else{ + map.put("operatorId",stringObjectMap.get("operatorId")); + map.put("invoiceType",invoiceType); + map.put("operatorName",operatorName); + list.add(map); + } + } + } + if(!"".equals(operatorNames)){ + Map map =new HashMap<>(); + map.put("operatorId",operatorIds); + map.put("invoiceType",1); + map.put("operatorName",operatorNames); + list.add(map); + } + + + + //该变量是用来计算内部存储的历史订单金额是否与传入的一致 + double totalActPrice = 0; + for (int i = 0; i stringObjectMap = list.get(i); + String operatorId = stringObjectMap.get("operatorId").toString(); + Integer invoiceType = Integer.valueOf(stringObjectMap.get("operatorId").toString()); + String operatorName = stringObjectMap.get("operatorName").toString(); //将该发票记录放入数据库生成发票记录,除了所包含的历史订单的总电费,总服务费 XhpcInvoice xhpcInvoice = new XhpcInvoice(); xhpcInvoice.setReceiveEmail(saveInvoiceInfoRequest.getReceiveEmail()); @@ -717,7 +764,17 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { xhpcInvoiceMapHistoryOrder.setServicePriceTotal(BigDecimal.valueOf(new BigDecimal(map.get("servicePriceTotal").toString()).doubleValue() - new BigDecimal(map.get("promotionDiscount").toString()).doubleValue())); xhpcInvoiceMapHistoryOrder.setPromotionDiscount(new BigDecimal(map.get("promotionDiscount").toString())); xhpcInvoiceMapHistoryOrder.setHistoryActPrice(new BigDecimal(map.get("actPrice").toString())); - xhpcInvoiceMapHistoryOrder.setCreateTime(cn.hutool.core.date.DateUtil.parse(map.get("createTime").toString())); + + if(map.get("createTime").toString().length()==16){ + DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm"); + LocalDateTime localDateTime = LocalDateTime.parse(map.get("createTime").toString(), dateTimeFormatter); + xhpcInvoiceMapHistoryOrder.setCreateTime(Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant())); + }else if(map.get("createTime").toString().length()==19){ + DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"); + LocalDateTime localDateTime = LocalDateTime.parse(map.get("createTime").toString(), dateTimeFormatter); + xhpcInvoiceMapHistoryOrder.setCreateTime(Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant())); + } + xhpcInvoiceMapHistoryOrder.setChargingMode(map.get("chargingMode").toString()); xhpcInvoiceMapHistoryOrder.setChargingStationId(Long.valueOf(map.get("chargingStationId").toString())); xhpcInvoiceMapHistoryOrder.setTerminalId(Long.valueOf(map.get("terminalId").toString())); @@ -731,8 +788,15 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { xhpcInvoice.setInvoiceOrderEletricTotalMoney(BigDecimal.valueOf(totalPowerPrice)); xhpcInvoice.setInvoiceOrderServiceTotalMoney(BigDecimal.valueOf(totalServicePrice)); xhpcInvoice.setInvoiceMoney(BigDecimal.valueOf(totalPowerPrice).add(BigDecimal.valueOf(totalServicePrice))); - xhpcInvoice.setOrderOperatorId(operatorId); - xhpcInvoice.setInvoiceOperatorId(operatorId); + if(invoiceType==1){ + xhpcInvoice.setOrderOperatorId(operatorId); + xhpcInvoice.setInvoiceOperatorId(1L); + xhpcInvoice.setInvoiceOperatorName(operatorName); + }else{ + xhpcInvoice.setOrderOperatorId(operatorId); + xhpcInvoice.setInvoiceOperatorId(Long.valueOf(operatorId)); + xhpcInvoice.setInvoiceOperatorName(operatorName); + } xhpcInvoiceMapper.updateElectricAndServiceById(xhpcInvoice); } @@ -946,5 +1010,9 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { } + public static void main(String[] args) { + System.out.println("2024-01-02T12:11".length()); + System.out.println("2024-01-02T12:11:00".length()); + } } diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcHistoryOrderMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcHistoryOrderMapper.xml index 99bb58e7..576cbbde 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcHistoryOrderMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcHistoryOrderMapper.xml @@ -169,7 +169,9 @@