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;

/**
 * @author yuyang
 * @Date 2025-06-23 15:48
 */
@Service
public class AnalyzeTheMessageServiceImpl implements IAnalyzeTheMessageService {
    private static Map<String, String> 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) {

        Map<String,Object> jiexi =new HashMap<>();

        jiexi.put("name","充电桩登录认证（0x01）");
        jiexi.put("content",content);
        jiexi.put("response","通信中断后上电复位");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","桩编码");
        map.put("content",content.substring(12,26));
        list.add(map);

         idxStart = idxStart+14;
        int bmsVoltageRequest = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart));
        Map<String,Object> map1 =new LinkedHashMap<>();
        if(bmsVoltageRequest==0){
            map1.put("title","桩类型");
            map1.put("content","直流桩");
            list.add(map1);
        }else{
            map1.put("title","桩类型");
            map1.put("content","交流桩");
            list.add(map1);
        }

        idxStart = idxStart+2;
        int number = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart));
        Map<String,Object> map2 =new LinkedHashMap<>();
        map2.put("title","充电枪数量");
        map2.put("content",number);
        list.add(map2);

        idxStart = idxStart+2;
        int version = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart));
        Map<String,Object> map3 =new LinkedHashMap<>();
        map3.put("title","通讯协议版本");
        map3.put("content","V"+new BigDecimal(version).divide(new BigDecimal(10)).setScale(2,BigDecimal.ROUND_DOWN));
        list.add(map3);

        idxStart = idxStart+2;
        Map<String,Object> map4 =new LinkedHashMap<>();
        map4.put("title","程序版本");
        map4.put("content",new String(toBytes(content.substring(32, 48))));
        list.add(map4);

        idxStart = idxStart+16;
        int svcSrv = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart));
        Map<String,Object> map5 =new LinkedHashMap<>();
        if(svcSrv==0){
            map5.put("title","网络链接类型");
            map5.put("content","SIM 卡");
            list.add(map5);
        }else if(svcSrv==1){
            map5.put("title","网络链接类型");
            map5.put("content","LAN");
            list.add(map5);
        }else if(svcSrv==2){
            map5.put("title","网络链接类型");
            map5.put("content","WAN");
            list.add(map5);
        }else{
            map5.put("title","网络链接类型");
            map5.put("content","其 他");
            list.add(map5);
        }
        idxStart = idxStart+2;
        Map<String,Object> map6 =new LinkedHashMap<>();
        map6.put("title","Sim 卡");
        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;
        int operator = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart));
        Map<String,Object> map7 =new LinkedHashMap<>();
        if(operator==0){
            map7.put("title","运营商");
            map7.put("content","移动");
            list.add(map7);
        }else if(svcSrv==2){
            map7.put("title","运营商");
            map7.put("content","电信");
            list.add(map7);
        }else if(svcSrv==3){
            map7.put("title","运营商");
            map7.put("content","联通");
            list.add(map7);
        }else{
            map7.put("title","运营商");
            map7.put("content","其 他");
            list.add(map7);
        }
        jiexi.put("analysis",list);
        return R.ok(jiexi);
    }

    @Override
    public R getReplyRegisterLogic(String content) {

        Map<String,Object> jiexi =new HashMap<>();

        jiexi.put("name","充电桩登录认证应答（0x02）");
        jiexi.put("content",content);
        jiexi.put("response","应答发送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","桩编码");
        map.put("content",content.substring(12,26));
        list.add(map);

        idxStart = idxStart+14;
        int bmsVoltageRequest = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart));
        Map<String,Object> map1 =new LinkedHashMap<>();
        if(bmsVoltageRequest==0){
            map1.put("title","登录结果");
            map1.put("content","登录成功");
            list.add(map1);
        }else{
            map1.put("title","登录结果");
            map1.put("content","登录失败");
            list.add(map1);
        }
        jiexi.put("analysis",list);
        return R.ok(jiexi);
    }

    @Override
    public R getHBLogic(String content) {
        Map<String,Object> jiexi =new HashMap<>();

        jiexi.put("name","充电桩心跳包（0x03）");
        jiexi.put("content",content);
        jiexi.put("response","60 秒周期上送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","桩编码");
        map.put("content",content.substring(12,26));
        list.add(map);

        idxStart = idxStart+14;

        Map<String,Object> map1 =new LinkedHashMap<>();
        map1.put("title","抢号");
        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;

        int bmsVoltageRequest = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart));
        Map<String,Object> map2 =new LinkedHashMap<>();
        if(bmsVoltageRequest==0){
            map2.put("title","枪状态");
            map2.put("content","正常");
            list.add(map2);
        }else{
            map2.put("title","枪状态");
            map2.put("content","故障");
            list.add(map2);
        }
        jiexi.put("analysis",list);
        return R.ok(jiexi);
    }

    @Override
    public R getReplyHBLogic(String content) {
        Map<String,Object> jiexi =new HashMap<>();

        jiexi.put("name","充电桩心跳包应答（0x04）");
        jiexi.put("content",content);
        jiexi.put("response","应答发送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","桩编码");
        map.put("content",content.substring(12,26));
        list.add(map);

        idxStart = idxStart+14;
        Map<String,Object> map1 =new LinkedHashMap<>();
        map1.put("title","抢号");
        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));
        Map<String,Object> map2 =new LinkedHashMap<>();
        map2.put("title","心跳应答");
        map2.put("content","置零");
        list.add(map2);

        jiexi.put("analysis",list);
        return R.ok(jiexi);
    }

    @Override
    public R getRateModelValidateLogic(String content) {
        Map<String,Object> jiexi =new HashMap<>();

        jiexi.put("name","计费模型验证请求（0x05）");
        jiexi.put("content",content);
        jiexi.put("response","主动请求，直到成功");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","桩编码");
        map.put("content",content.substring(12,26));
        list.add(map);

        idxStart = idxStart+14;

        int bmsVoltageRequest = HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
        Map<String,Object> map2 =new LinkedHashMap<>();
        map2.put("title","计费模型编号");
        if(bmsVoltageRequest==0){
            map2.put("content","首次连接到平台时置零");
        }else{
            map2.put("content",bmsVoltageRequest);
        }
        list.add(map2);
        jiexi.put("analysis",list);
        return R.ok(jiexi);
    }

    @Override
    public R getReplyRateModelValidateLogic(String content) {
        Map<String,Object> jiexi =new HashMap<>();

        jiexi.put("name","计费模型验证请求应答（0x06）");
        jiexi.put("content",content);
        jiexi.put("response","应答发送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","桩编码");
        map.put("content",content.substring(12,26));
        list.add(map);

        idxStart = idxStart+14;

        int bmsVoltageRequest = HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
        Map<String,Object> map1 =new LinkedHashMap<>();
        map1.put("title","计费模型编号");
        map1.put("content",bmsVoltageRequest);
        list.add(map1);

        idxStart = idxStart+8;
        int result = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart));
        Map<String,Object> map2 =new LinkedHashMap<>();
        if(result==0){
            map2.put("title","验证结果");
            map2.put("content","桩计费模型与平台一致");
            list.add(map2);
        }else{
            map2.put("title","验证结果");
            map2.put("content","桩计费模型与平台不一致");
            list.add(map2);
        }
        jiexi.put("analysis",list);
        return R.ok(jiexi);
    }

    @Override
    public R getRateModelRequestLogic(String content) {
        Map<String,Object> jiexi =new HashMap<>();

        jiexi.put("name","充电桩计费模型请求（0x09）");
        jiexi.put("content",content);
        jiexi.put("response","主动请求，直到成功");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","桩编码");
        map.put("content",content.substring(12,26));
        list.add(map);

        jiexi.put("analysis",list);
        return R.ok(jiexi);
    }

    @Override
    public R getReplyRateModelRequestLogic(String content) {
        Map<String,Object> jiexi =new HashMap<>();

        jiexi.put("name","充电桩计费模型请求应答（0x0A）");
        jiexi.put("content",content);
        jiexi.put("response","应答发送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","桩编码");
        map.put("content",content.substring(12,26));
        list.add(map);

        idxStart = idxStart+14;

        int bmsVoltageRequest = HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
        Map<String,Object> 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<String,Object> map1 =new LinkedHashMap<>();
        map1.put("title","尖费电费费率");
        map1.put("content",new BigDecimal(t1).divide(bigDecimal).setScale(5,BigDecimal.ROUND_DOWN)+"元/度");
        list.add(map1);

        idxStart = idxStart+8;
        int t2= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
        Map<String,Object> map2 =new LinkedHashMap<>();
        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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();

        jiexi.put("name","上传实时数据（0x13）");
        jiexi.put("content",content);
        jiexi.put("response","周期上送、变位上送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","交易流水号");
        map.put("content",content.substring(12,44));
        list.add(map);
        idxStart = idxStart+32;

        Map<String,Object> map0 =new LinkedHashMap<>();
        map0.put("title","桩编号");
        map0.put("content",content.substring(idxStart,idxStart+14));
        list.add(map0);
        idxStart = idxStart+14;

        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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 <t18 ; i++) {

                Map<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","充电握手（0x15）");
        jiexi.put("content",content);
        jiexi.put("response","主动上送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","交易流水号");
        map.put("content",content.substring(idxStart,idxStart+32));
        list.add(map);

        idxStart = idxStart+32;
        Map<String,Object> map0 =new LinkedHashMap<>();
        map0.put("title","桩编号");
        map0.put("content",content.substring(idxStart,idxStart+14));
        list.add(map0);

        idxStart = idxStart+14;
        Map<String,Object> 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<String,Object> map1 =new LinkedHashMap<>();
        map1.put("title","BMS 通信协议版本号");
        map1.put("content",version);
        list.add(map1);

        int t2 = HexUtils.reverseHexInt(content.substring(idxStart, 2 + idxStart));
        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> map6 =new LinkedHashMap<>();
        map6.put("title","BMS 电池组序号");
        map6.put("content","根据不同的厂商解析");
        list.add(map6);

        idxStart = idxStart+8;

        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> map12=new LinkedHashMap<>();
        map12.put("title","预留位");
        map12.put("content",t12);
        list.add(map12);


        idxStart = idxStart+2;
        Map<String,Object> map13=new LinkedHashMap<>();
        map13.put("title","BMS 车辆识别码");
        map13.put("content",asciiToString(content.substring(idxStart, 34+ idxStart)));
        list.add(map13);

        idxStart = idxStart+34;
        Map<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","参数配置（0x17）");
        jiexi.put("content",content);
        jiexi.put("response","主动上送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","交易流水号");
        map.put("content",content.substring(12,44));
        list.add(map);
        idxStart = idxStart+32;

        Map<String,Object> map0 =new LinkedHashMap<>();
        map0.put("title","桩编号");
        map0.put("content",content.substring(idxStart,idxStart+14));
        list.add(map0);
        idxStart = idxStart+14;

        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","充电结束（0x19）");
        jiexi.put("content",content);
        jiexi.put("response","主动上送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","交易流水号");
        map.put("content",content.substring(12,44));
        list.add(map);
        idxStart = idxStart+32;

        Map<String,Object> map0 =new LinkedHashMap<>();
        map0.put("title","桩编号");
        map0.put("content",content.substring(idxStart,idxStart+14));
        list.add(map0);
        idxStart = idxStart+14;

        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","错误报文（0x1B）");
        jiexi.put("content",content);
        jiexi.put("response","主动上送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","交易流水号");
        map.put("content",content.substring(12,44));
        list.add(map);
        idxStart = idxStart+32;

        Map<String,Object> map0 =new LinkedHashMap<>();
        map0.put("title","桩编号");
        map0.put("content",content.substring(idxStart,idxStart+14));
        list.add(map0);
        idxStart = idxStart+14;

        Map<String,Object> 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<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收 SPN2560=0x00 的充电机辨识报文超时");
            map6.put("content","正常");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","接收 SPN2560=0xAA 的充电机辨识报文超时");
            map7.put("content","正常");
            list.add(map7);

            Map<String,Object> map8 =new LinkedHashMap<>();
            map8.put("title","预留位");
            map8.put("content","正常");
            list.add(map8);

        }else if(t3==1){
            Map<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收 SPN2560=0x00 的充电机辨识报文超时");
            map6.put("content","超时");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","接收 SPN2560=0xAA 的充电机辨识报文超时");
            map7.put("content","超时");
            list.add(map7);

            Map<String,Object> map8 =new LinkedHashMap<>();
            map8.put("title","预留位");
            map8.put("content","超时");
            list.add(map8);
        }else{
            Map<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收 SPN2560=0x00 的充电机辨识报文超时");
            map6.put("content","不可信状态");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","接收 SPN2560=0xAA 的充电机辨识报文超时");
            map7.put("content","不可信状态");
            list.add(map7);

            Map<String,Object> 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<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收充电机的时间同步和充电机最大输出能力报文超时");
            map6.put("content","正常");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","接收 SPN2560=0xAA 的充电机辨识报文超时");
            map7.put("content","正常");
            list.add(map7);

            Map<String,Object> map8 =new LinkedHashMap<>();
            map8.put("title","预留位");
            map8.put("content","正常");
            list.add(map8);
        }else if(t4==1){
            Map<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收充电机的时间同步和充电机最大输出能力报文超时");
            map6.put("content","超时");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","接收充电机完成充电准备报文超时");
            map7.put("content","超时");
            list.add(map7);

            Map<String,Object> map8 =new LinkedHashMap<>();
            map8.put("title","预留位");
            map8.put("content","超时");
            list.add(map8);
        }else{
            Map<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收充电机的时间同步和充电机最大输出能力报文超时");
            map6.put("content","不可信状态");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","接收充电机完成充电准备报文超时");
            map7.put("content","不可信状态");
            list.add(map7);

            Map<String,Object> 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<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收充电机充电状态报文超时");
            map6.put("content","正常");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","接收充电机中止充电报文超时");
            map7.put("content","正常");
            list.add(map7);

            Map<String,Object> map8 =new LinkedHashMap<>();
            map8.put("title","预留位");
            map8.put("content","正常");
            list.add(map8);
        }else if(t5==1){
            Map<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收充电机充电状态报文超时");
            map6.put("content","超时");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","接收充电机中止充电报文超时");
            map7.put("content","超时");
            list.add(map7);

            Map<String,Object> map8 =new LinkedHashMap<>();
            map8.put("title","预留位");
            map8.put("content","超时");
            list.add(map8);
        }else{
            Map<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收充电机充电状态报文超时");
            map6.put("content","不可信状态");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","接收充电机中止充电报文超时");
            map7.put("content","不可信状态");
            list.add(map7);

            Map<String,Object> 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<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收充电机充电统计报文超时");
            map6.put("content","正常");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","BMS 其他");
            map7.put("content","正常");
            list.add(map7);
        }else if(t6==1){
            Map<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收充电机充电统计报文超时");
            map6.put("content","超时");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","BMS 其他");
            map7.put("content","超时");
            list.add(map7);
        }else{
            Map<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收充电机充电统计报文超时");
            map6.put("content","不可信状态");
            list.add(map6);

            Map<String,Object> 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<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收 BMS 和车辆的辨识报文超时");
            map6.put("content","正常");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","预留位");
            map7.put("content","正常");
            list.add(map7);
        }else if(t7==1){
            Map<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收 BMS 和车辆的辨识报文超时");
            map6.put("content","超时");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","预留位");
            map7.put("content","超时");
            list.add(map7);
        }else{
            Map<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收 BMS 和车辆的辨识报文超时");
            map6.put("content","不可信状态");
            list.add(map6);

            Map<String,Object> 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<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收电池充电参数报文超时");
            map6.put("content","正常");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","接收 BMS 完成充电准备报文超时");
            map7.put("content","正常");
            list.add(map7);

            Map<String,Object> map8 =new LinkedHashMap<>();
            map8.put("title","预留位");
            map8.put("content","正常");
            list.add(map8);
        }else if(t8==1){
            Map<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收电池充电参数报文超时");
            map6.put("content","超时");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","接收 BMS 完成充电准备报文超时");
            map7.put("content","超时");
            list.add(map7);

            Map<String,Object> map8 =new LinkedHashMap<>();
            map8.put("title","预留位");
            map8.put("content","超时");
            list.add(map8);
        }else{
            Map<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收电池充电参数报文超时");
            map6.put("content","不可信状态");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","接收 BMS 完成充电准备报文超时");
            map7.put("content","不可信状态");
            list.add(map7);

            Map<String,Object> 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<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收电池充电总状态报文超时");
            map6.put("content","正常");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","接收电池充电要求报文超时");
            map7.put("content","正常");
            list.add(map7);

            Map<String,Object> map71 =new LinkedHashMap<>();
            map71.put("title","接收 BMS 中止充电报文超时");
            map71.put("content","正常");
            list.add(map71);

            Map<String,Object> map8 =new LinkedHashMap<>();
            map8.put("title","预留位");
            map8.put("content","正常");
            list.add(map8);
        }else if(t9==1){
            Map<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收电池充电总状态报文超时");
            map6.put("content","超时");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","接收电池充电要求报文超时");
            map7.put("content","超时");
            list.add(map7);

            Map<String,Object> map71 =new LinkedHashMap<>();
            map71.put("title","接收 BMS 中止充电报文超时");
            map71.put("content","超时");
            list.add(map71);

            Map<String,Object> map8 =new LinkedHashMap<>();
            map8.put("title","预留位");
            map8.put("content","超时");
            list.add(map8);
        }else{
            Map<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收电池充电总状态报文超时");
            map6.put("content","不可信状态");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","接收电池充电要求报文超时");
            map7.put("content","不可信状态");
            list.add(map7);

            Map<String,Object> map71 =new LinkedHashMap<>();
            map71.put("title","接收 BMS 中止充电报文超时");
            map71.put("content","不可信状态");
            list.add(map71);

            Map<String,Object> 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<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收 BMS 充电统计报文超时");
            map6.put("content","正常");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","充电机其他");
            map7.put("content","正常");
            list.add(map7);
        }else if(t6==1){
            Map<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收 BMS 充电统计报文超时");
            map6.put("content","超时");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","充电机其他");
            map7.put("content","超时");
            list.add(map7);
        }else{
            Map<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","接收 BMS 充电统计报文超时");
            map6.put("content","不可信状态");
            list.add(map6);

            Map<String,Object> 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<String,Object> jiexi =new HashMap<>();

        jiexi.put("name","充电阶段 BMS 中止（0x1D）");
        jiexi.put("content",content);
        jiexi.put("response","主动上送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","交易流水号");
        map.put("content",content.substring(12,44));
        list.add(map);

        idxStart = idxStart+32;
        Map<String,Object> map0 =new LinkedHashMap<>();
        map0.put("title","桩编号");
        map0.put("content",content.substring(idxStart,idxStart+14));
        list.add(map0);

        idxStart = idxStart+14;
        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();

        jiexi.put("name","充电过程 BMS 信息（0x21）");
        jiexi.put("content",content);
        jiexi.put("response","周期上送（15 秒）");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","交易流水号");
        map.put("content",content.substring(12,44));
        list.add(map);

        idxStart = idxStart+32;
        Map<String,Object> map0 =new LinkedHashMap<>();
        map0.put("title","桩编号");
        map0.put("content",content.substring(idxStart,idxStart+14));
        list.add(map0);

        idxStart = idxStart+14;
        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();

        jiexi.put("name","充电过程 BMS 需求与充电机输出（0x23）");
        jiexi.put("content",content);
        jiexi.put("response","周期上送（15 秒）");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","交易流水号");
        map.put("content",content.substring(12,44));
        list.add(map);

        idxStart = idxStart+32;
        Map<String,Object> map0 =new LinkedHashMap<>();
        map0.put("title","桩编号");
        map0.put("content",content.substring(idxStart,idxStart+14));
        list.add(map0);

        idxStart = idxStart+14;
        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();

        jiexi.put("name","充电过程 BMS 信息（0x25）");
        jiexi.put("content",content);
        jiexi.put("response","周期上送（15 秒）");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","交易流水号");
        map.put("content",content.substring(12,44));
        list.add(map);

        idxStart = idxStart+32;
        Map<String,Object> map0 =new LinkedHashMap<>();
        map0.put("title","桩编号");
        map0.put("content",content.substring(idxStart,idxStart+14));
        list.add(map0);

        idxStart = idxStart+14;
        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","BMS 单体动力蓄电池电压");
            map6.put("content","正常");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","BMS 整车动力蓄电池荷电状态SOC");
            map7.put("content","正常");
            list.add(map7);

            Map<String,Object> map8 =new LinkedHashMap<>();
            map8.put("title","BMS 动力蓄电池充电过电流");
            map8.put("content","正常");
            list.add(map8);

            Map<String,Object> map9 =new LinkedHashMap<>();
            map9.put("title","BMS 动力蓄电池温度");
            map9.put("content","正常");
            list.add(map9);
        }else if(t6==1){
            Map<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","BMS 单体动力蓄电池电压");
            map6.put("content","过高");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","BMS 整车动力蓄电池荷电状态SOC");
            map7.put("content","过高");
            list.add(map7);

            Map<String,Object> map8 =new LinkedHashMap<>();
            map8.put("title","BMS 动力蓄电池充电过电流");
            map8.put("content","过高");
            list.add(map8);

            Map<String,Object> map9 =new LinkedHashMap<>();
            map9.put("title","BMS 动力蓄电池温度");
            map9.put("content","过高");
            list.add(map9);
        }else{
            Map<String,Object> map6 =new LinkedHashMap<>();
            map6.put("title","BMS 单体动力蓄电池电压");
            map6.put("content","过低");
            list.add(map6);

            Map<String,Object> map7 =new LinkedHashMap<>();
            map7.put("title","BMS 整车动力蓄电池荷电状态SOC");
            map7.put("content","过低");
            list.add(map7);

            Map<String,Object> map8 =new LinkedHashMap<>();
            map8.put("title","BMS 动力蓄电池充电过电流");
            map8.put("content","过低");
            list.add(map8);

            Map<String,Object> 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<String,Object> map10 =new LinkedHashMap<>();
            map10.put("title","BMS 动力蓄电池绝缘状态");
            map10.put("content","正常");
            list.add(map10);

            Map<String,Object> map11 =new LinkedHashMap<>();
            map11.put("title","BMS 动力蓄电池组输出连接器连接状态");
            map11.put("content","正常");
            list.add(map11);

//            Map<String,Object> map8 =new LinkedHashMap<>();
//            map8.put("title","充电禁止");
//            map8.put("content","正常");
//            list.add(map8);
        }else if(t7==1){
            Map<String,Object> map10 =new LinkedHashMap<>();
            map10.put("title","BMS 动力蓄电池绝缘状态");
            map10.put("content","不正常");
            list.add(map10);

            Map<String,Object> map11 =new LinkedHashMap<>();
            map11.put("title","BMS 动力蓄电池组输出连接器连接状态");
            map11.put("content","不正常");
            list.add(map11);

//            Map<String,Object> 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<String,Object> jiexi =new HashMap<>();

        jiexi.put("name","充电桩主动申请启动充电（0x31）");
        jiexi.put("content",content);
        jiexi.put("response","按需发送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;

        Map<String,Object> map0 =new LinkedHashMap<>();
        map0.put("title","桩编号");
        map0.put("content",content.substring(idxStart,idxStart+14));
        list.add(map0);

        idxStart = idxStart+14;
        Map<String,Object> 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<String,Object> 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<String,Object> map2 =new LinkedHashMap<>();
        map2.put("title","是否需要密码");
        if(t2==0){
            map1.put("content","不需要");
        }else{
            map1.put("content","需要");
        }
        list.add(map2);

        idxStart = idxStart+2;
        Map<String,Object> map3 =new LinkedHashMap<>();
        map3.put("title","账号或者物理卡号（平台卡序列号，类似于桩号）");
        map3.put("content",content.substring(idxStart, 16 + idxStart));
        list.add(map3);

        idxStart = idxStart+16;
        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","运营平台确认启动充电（0x32）");
        jiexi.put("content",content);
        jiexi.put("response","应答");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","交易流水号");
        map.put("content",content.substring(12,44));
        list.add(map);
        idxStart = idxStart+32;

        Map<String,Object> map0 =new LinkedHashMap<>();
        map0.put("title","桩编号");
        map0.put("content",content.substring(idxStart,idxStart+14));
        list.add(map0);
        idxStart = idxStart+14;

        Map<String,Object> 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<String,Object> map3 =new LinkedHashMap<>();
        map3.put("title","逻辑卡号（平台卡序列号，类似于桩号）");
        map3.put("content",content.substring(idxStart, 16 + idxStart));
        list.add(map3);

        idxStart = idxStart+16;
        int t4= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","远程启动充电命令回复（0x33）");
        jiexi.put("content",content);
        jiexi.put("response","应答");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","交易流水号");
        map.put("content",content.substring(12,44));
        list.add(map);
        idxStart = idxStart+32;

        Map<String,Object> map0 =new LinkedHashMap<>();
        map0.put("title","桩编号");
        map0.put("content",content.substring(idxStart,idxStart+14));
        list.add(map0);
        idxStart = idxStart+14;

        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","运营平台远程控制启机（0x38）");
        jiexi.put("content",content);
        jiexi.put("response","按需发送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","交易流水号");
        map.put("content",content.substring(12,44));
        list.add(map);
        idxStart = idxStart+32;

        Map<String,Object> map0 =new LinkedHashMap<>();
        map0.put("title","桩编号");
        map0.put("content",content.substring(idxStart,idxStart+14));
        list.add(map0);
        idxStart = idxStart+14;

        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","远程停机命令回复（0x35）");
        jiexi.put("content",content);
        jiexi.put("response","应答");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","交易流水号");
        map.put("content",content.substring(12,44));
        list.add(map);
        idxStart = idxStart+32;

        Map<String,Object> map0 =new LinkedHashMap<>();
        map0.put("title","桩编号");
        map0.put("content",content.substring(idxStart,idxStart+14));
        list.add(map0);
        idxStart = idxStart+14;

        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","远程停机命令回复（0x36）");
        jiexi.put("content",content);
        jiexi.put("response","按需发送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;

        Map<String,Object> map0 =new LinkedHashMap<>();
        map0.put("title","桩编号");
        map0.put("content",content.substring(idxStart,idxStart+14));
        list.add(map0);

        idxStart = idxStart+14;
        Map<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","交易记录（0x3B）");
        jiexi.put("content",content);
        jiexi.put("response","应答");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> map =new LinkedHashMap<>();
        map.put("title","交易流水号");
        map.put("content",content.substring(12,44));
        list.add(map);
        idxStart = idxStart+32;

        Map<String,Object> map0 =new LinkedHashMap<>();
        map0.put("title","桩编号");
        map0.put("content",content.substring(idxStart,idxStart+14));
        list.add(map0);
        idxStart = idxStart+14;

        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> map5 =new LinkedHashMap<>();
        map5.put("title","尖单价");
        map5.put("content",new BigDecimal(t5).divide(new BigDecimal(100000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/分钟");
        list.add(map5);

        idxStart = idxStart+8;
        int t6= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
        Map<String,Object> map6 =new LinkedHashMap<>();
        map6.put("title","尖电量");
        map6.put("content",new BigDecimal(t6).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN));
        list.add(map6);

        idxStart = idxStart+8;
        int t7= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
        Map<String,Object> map7 =new LinkedHashMap<>();
        map7.put("title","计损尖电量");
        map7.put("content",new BigDecimal(t7).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN));
        list.add(map7);

        idxStart = idxStart+8;
        int t8= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
        Map<String,Object> 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<String,Object> map9 =new LinkedHashMap<>();
        map9.put("title","峰单价");
        map9.put("content",new BigDecimal(t9).divide(new BigDecimal(100000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/分钟");
        list.add(map9);

        idxStart = idxStart+8;
        int t10= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
        Map<String,Object> map10 =new LinkedHashMap<>();
        map10.put("title","峰电量");
        map10.put("content",new BigDecimal(t10).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN));
        list.add(map10);

        idxStart = idxStart+8;
        int t11= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
        Map<String,Object> map11 =new LinkedHashMap<>();
        map11.put("title","计损峰电量");
        map11.put("content",new BigDecimal(t11).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN));
        list.add(map11);

        idxStart = idxStart+8;
        int t12= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
        Map<String,Object> 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<String,Object> map13 =new LinkedHashMap<>();
        map13.put("title","平电价");
        map13.put("content",new BigDecimal(t13).divide(new BigDecimal(100000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/分钟");
        list.add(map13);

        idxStart = idxStart+8;
        int t14= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
        Map<String,Object> map14 =new LinkedHashMap<>();
        map14.put("title","平电量");
        map14.put("content",new BigDecimal(t14).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN));
        list.add(map14);

        idxStart = idxStart+8;
        int t15= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
        Map<String,Object> map15 =new LinkedHashMap<>();
        map15.put("title","计损平电量");
        map15.put("content",new BigDecimal(t15).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN));
        list.add(map15);

        idxStart = idxStart+8;
        int t16= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
        Map<String,Object> 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<String,Object> map17 =new LinkedHashMap<>();
        map17.put("title","谷单价");
        map17.put("content",new BigDecimal(t17).divide(new BigDecimal(100000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/分钟");
        list.add(map17);

        idxStart = idxStart+8;
        int t18= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
        Map<String,Object> map18=new LinkedHashMap<>();
        map18.put("title","谷电量");
        map18.put("content",new BigDecimal(t18).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN));
        list.add(map18);

        idxStart = idxStart+8;
        int t19= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
        Map<String,Object> map19 =new LinkedHashMap<>();
        map19.put("title","计损谷电量");
        map19.put("content",new BigDecimal(t19).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN));
        list.add(map19);

        idxStart = idxStart+8;
        int t20= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> map23 =new LinkedHashMap<>();
        map23.put("title","总电量");
        map23.put("content",new BigDecimal(t23).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN));
        list.add(map23);

        idxStart = idxStart+8;
        int t24= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
        Map<String,Object> 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<String,Object> map211 =new LinkedHashMap<>();
        map211.put("title","消费金额");
        map211.put("content",new BigDecimal(t211).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN)+"元");
        list.add(map211);

//        idxStart = idxStart+8;
//        Map<String,Object> map221 =new LinkedHashMap<>();
//        map221.put("title","占地费金额（不参与计算）");
//        map221.put("content","不参与计算");
//        list.add(map221);

        idxStart = idxStart+8;
        Map<String,Object> 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<String,Object> 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<String,Object> map27 =new LinkedHashMap<>();
        map27.put("title","交易日期、时间");
        map27.put("content", DateUtil.format(CP56Time2a.cp56toDate(content.substring(idxStart, 14 + idxStart)), NORM_DATETIME_FORMATTER));
        list.add(map27);

        idxStart = idxStart+14;
        Map<String,Object> map28=new LinkedHashMap<>();
        map28.put("title","停止原因");
        map28.put("content",translate(content.substring(idxStart, 2 + idxStart)));
        list.add(map28);

        idxStart = idxStart+2;
        Map<String,Object> map29 =new LinkedHashMap<>();
        map29.put("title","物理卡号");
        map29.put("content", content.substring(idxStart, 16 + idxStart));
        list.add(map29);


        jiexi.put("analysis",list);
        return R.ok(jiexi);
    }

    @Override
    public R getReplyOrderDataLogic(String content) {
        Map<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","交易记录确认（0x40）");
        jiexi.put("content",content);
        jiexi.put("response","应答");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;
        Map<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","余额更新应答（0x41）");
        jiexi.put("content",content);
        jiexi.put("response","应答");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;

        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","远程账户余额更新（0x42）");
        jiexi.put("content",content);
        jiexi.put("response","按需发送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;

        Map<String,Object> map0 =new LinkedHashMap<>();
        map0.put("title","桩编号");
        map0.put("content",content.substring(idxStart,idxStart+14));
        list.add(map0);

        idxStart = idxStart+14;
        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","充电桩工作参数设置（0x52）");
        jiexi.put("content",content);
        jiexi.put("response","按需发送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;

        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","充电桩工作参数设置应答（0x51）");
        jiexi.put("content",content);
        jiexi.put("response","按需发送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;

        Map<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","对时设置应答（0x55）");
        jiexi.put("content",content);
        jiexi.put("response","应答");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;

        Map<String,Object> map0 =new LinkedHashMap<>();
        map0.put("title","桩编号");
        map0.put("content",content.substring(idxStart,idxStart+14));
        list.add(map0);

        idxStart = idxStart+14;
        Map<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","对时设置（0x56）");
        jiexi.put("content",content);
        jiexi.put("response","应答");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;

        Map<String,Object> map0 =new LinkedHashMap<>();
        map0.put("title","桩编号");
        map0.put("content",content.substring(idxStart,idxStart+14));
        list.add(map0);

        idxStart = idxStart+14;
        Map<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","计费模型应答（0x57）");
        jiexi.put("content",content);
        jiexi.put("response","按需发送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;

        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","计费模型设置（0x58）");
        jiexi.put("content",content);
        jiexi.put("response","按需发送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;

        Map<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","远程重启应答（0x91）");
        jiexi.put("content",content);
        jiexi.put("response","按需发送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;

        Map<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","远程重启（0x92）");
        jiexi.put("content",content);
        jiexi.put("response","按需发送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;

        Map<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","远程更新应答（0x93）");
        jiexi.put("content",content);
        jiexi.put("response","按需发送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;

        Map<String,Object> 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<String,Object> 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<String,Object> jiexi =new HashMap<>();
        jiexi.put("name","远程更新（0x94）");
        jiexi.put("content",content);
        jiexi.put("response","按需发送");
        List<Map<String,Object>> list = new LinkedList<>();
        int idxStart = 12;

        Map<String,Object> 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<String,Object> 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<String,Object> map7 =new LinkedHashMap<>();
        map7.put("title","桩功率");
        map7.put("content",t7);

        idxStart = idxStart+4;
        Map<String,Object> 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<String,Object> map9 =new LinkedHashMap<>();
        map9.put("title","升级服务器端口");
        map9.put("content",t9);

        idxStart = idxStart+4;
        Map<String,Object> map10=new LinkedHashMap<>();
        map10.put("title","升级服务器地址");
        map10.put("content",asciiToString(content.substring(idxStart, 32+ idxStart)));
        list.add(map10);

        idxStart = idxStart+32;
        Map<String,Object> map11=new LinkedHashMap<>();
        map11.put("title","用户名");
        map11.put("content",asciiToString(content.substring(idxStart, 32+ idxStart)));
        list.add(map11);

        idxStart = idxStart+32;
        Map<String,Object> map12=new LinkedHashMap<>();
        map12.put("title","密码");
        map12.put("content",asciiToString(content.substring(idxStart, 32+ idxStart)));
        list.add(map12);

        idxStart = idxStart+32;
        Map<String,Object> 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<String,Object> 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<String,Object> 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"));

    }

}
