diff --git a/jsowell-common/src/main/java/com/jsowell/common/constant/Constants.java b/jsowell-common/src/main/java/com/jsowell/common/constant/Constants.java index e8628b792..8d34ccddd 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/constant/Constants.java +++ b/jsowell-common/src/main/java/com/jsowell/common/constant/Constants.java @@ -88,6 +88,8 @@ public class Constants { public static final int one = 1; + public static final int two = 2; + public static final int four = 4; public static final byte zeroByte = 0x00; diff --git a/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPartyOperatorIdEnum.java b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPartyOperatorIdEnum.java index d4f6dd444..a11367c99 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPartyOperatorIdEnum.java +++ b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPartyOperatorIdEnum.java @@ -15,7 +15,7 @@ public enum ThirdPartyOperatorIdEnum { YONG_CHENG_BO_CHE("4", "330205020"), NING_XIA_JIAO_TOU("5", "MA771QENX"), XIN_DIAN_TU("6", "MA25CNM38"), - HUA_WEI("7", ""), + HAI_NAN("7", "578725200"), ; private String type; diff --git a/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java index 6b4ebe8d0..42c6c4b1c 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java +++ b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java @@ -15,8 +15,8 @@ public enum ThirdPlatformTypeEnum { YONG_CHENG_BO_CHE("4", "甬城泊车平台"), NING_XIA_JIAO_TOU("5", "宁夏交投"), XIN_DIAN_TU("6", "新电途平台"), - HUA_WEI("7", "华为平台"), - HAI_NAN("8", "海南平台"), + HAI_NAN("7", "海南平台"), + HUA_WEI("8", "华为平台"), ; private String code; diff --git a/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/huawei/StartFailedReasonEnum.java b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/huawei/StartFailedReasonEnum.java new file mode 100644 index 000000000..82f264114 --- /dev/null +++ b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/huawei/StartFailedReasonEnum.java @@ -0,0 +1,126 @@ +package com.jsowell.common.enums.thirdparty.huawei; + + +/** + * 华为开始启动失败原因对应枚举 + * + * @author Lemon + * @Date 2024/1/26 15:00:56 + */ +public enum StartFailedReasonEnum { + DISCONNECT_WITH_PLATFORM_STOP(23000, "与平台断链停止"), + UNKNOWN_SYSTEM_TYPE(23001, "未知系统类型"), + THE_OWNER_ACTIVELY_UNLOCKS_AND_STOPS(23002, "车主主动解锁停止"), + STOP_CHARGING_BECAUSE_THE_TEMPERATURE_CONTROL_IS_ABNORMAL(23003, "温控异常需要停止充电"), + GUN_TEMPERATURE_ANOMALY(23004, "枪温度异常"), + HOST_SYSTEM_EXCEPTION(23005, "主机系统异常"), + GUN_HEAD_MOUNTED_ABNORMALLY(23006, "枪头安装异常"), + THE_ACCOUNTING_MODEL_DOES_NOT_EXIST(23007, "计费模型不存在"), + THE_DEVICE_IS_NOT_CONNECTED_TO_THE_VEHICLE(23066, "设备未连接车辆"), + EQUIPMENT_UPGRADING(23067, "设备升级中"), + EQUIPMENT_OUTAGE(23068, "设备停运"), + EQUIPMENT_RETURN(23069, "设备退运"), + EQUIPMENT_FREEZING(23070, "设备冻结"), + OTHER_REASONS_FOR_FAILURE(23072, "其他失败原因"), + MAIN_ENGINE_EMERGENCY_STOP(23008, "主机急停"), + MAIN_ENGINE_SIDE_DOOR_OPENING(23009, "主机侧开门"), + MAIN_ENGINE_FLOODING(23010, "主机水浸"), + PHASE_SEQUENCE_ANOMALY(23011, "相序异常"), + AC_SURGE_PROTECTION_1_IS_FAULTY(23012, "交流防雷1故障"), + AC_SURGE_PROTECTION_2_IS_FAULTY(23013, "交流防雷2故障"), + AC_SURGE_PROTECTION_3_IS_FAULTY(23014, "交流防雷3故障"), + AC_OUTAGE(23015, "交流停电"), + AC_OVERVOLTAGE(23016, "交流过压"), + AC_UNDERVOLTAGE(23017, "交流欠压"), + AC_L1_MISSING_PHASE(23018, "交流L1缺相"), + AC_L2_MISSING_PHASE(23019, "交流L2缺相"), + AC_L3_MISSING_PHASE(23020, "交流L3缺相"), + THE_AC_BRANCH_CURRENT_IS_ABNORMAL_PROCEDURE(23065, "交流支路电流异常"), + ALL_COMMUNICATION_BETWEEN_THE_DCDC_GROUP_FAILS(23021, "DCDC组所有通信失败"), + THE_DCDC_MODULE_IS_FAULTY(23022, "DCDC模块故障"), + THE_SYSTEM_TYPE_ON_THE_HOST_IS_UNKNOWN(23023, "主机上未知系统类型"), + PUMP_1_IDLING(23024, "水泵1空转"), + PUMP_2_IDLING(23025, "水泵2空转"), + PUMP_3_IDLING(23026, "水泵3空转"), + WATER_PUMP_1_OVERFLOWS(23027, "水泵1过流"), + WATER_PUMP_2_OVERFLOWS(23028, "水泵2过流"), + WATER_PUMP_3_OVERFLOWS(23029, "水泵3过流"), + PUMP_1_OVERHEATS(23030, "水泵1过温"), + PUMP_2_OVERHEATS(23031, "水泵2过温"), + PUMP_3_OVERHEATS(23032, "水泵3过温"), + WATER_PUMP_1_FAULTY(23033, "水泵1故障"), + WATER_PUMP_2_FAULTY(23034, "水泵2故障"), + WATER_PUMP_3_FAULTY(23035, "水泵3故障"), + PUMP_1_HAS_NO_FEEDBACK(23036, "水泵1无反馈"), + PUMP_2_HAS_NO_FEEDBACK(23037, "水泵2无反馈"), + PUMP_3_HAS_NO_FEEDBACK(23038, "水泵3无反馈"), + THE_TEMPERATURE_CONTROL_DETECTION_UNIT_IS_ABNORMAL(23039, "温控检测单元异常"), + THE_SELF_DESCRIPTION_FILE_IS_ABNORMAL(23040, "自描述文件异常"), + THE_MATRIX_CONTACTOR_IS_FAULTY(23041, "矩阵接触器故障"), + THE_CHARGING_PORT_OVERTEMPERATURE_IS_FAULTY(23042, "充电端口过温故障"), + AC_CIRCUIT_BREAKER_1_IS_FAULTY(23043, "交流断路器1故障"), + AC_CIRCUIT_BREAKER_2_IS_FAULTY(23044, "交流断路器2故障"), + AC_CIRCUIT_BREAKER_3_IS_FAULTY(23045, "交流断路器3故障"), + AC_CIRCUIT_BREAKER_4_IS_FAULTY(23046, "交流断路器4故障"), + AC_CIRCUIT_BREAKER_5_IS_FAULTY(23047, "交流断路器5故障"), + AC_CIRCUIT_BREAKER_6_IS_FAULTY(23048, "交流断路器6故障"), + INSULATION_DETECTION_FAULT(23049, "绝缘检测故障"), + TERMINAL_FLOODING(23050, "终端水浸"), + TOPPLE_AND_FALL(23051, "倾倒"), + EMERGENCY_STOP(23052, "急停"), + THE_DOOR_OPENS(23053, "门开"), + WATER_FLOODING(23054, "温控--水浸"), + ULTRALOW_TEMPERATURE(23055, "温控--超低温"), + CHARGING_CONTROLLER_COMMUNICATION_FAILED(23056, "充电控制器通信失败"), + THE_GUN_DRAW_CODE_ADDRESS_IS_ABNORMAL(23057, "枪拔码地址异常"), + GUN_DC_OUTPUT_CONTACTOR_IS_FAULTY(23058, "枪直流输出接触器故障"), + GOOSE_MESSAGE_TIMED_OUT(23059, "GOOSE报文超时"), + OPERATION_DISABLE(23060, "运营禁用"), + THE_CHARGING_PORT_IS_NOT_MATCHED(23061, "未匹配充电端口"), + GOOSE_REQUESTS_VOLTAGE_TIMEOUT(23062, "GOOSE请求电压超时(主机超时未收到GOOSE消息)"), + TERMINAL_HOT_RESET(23063, "终端热复位"), + SEND_SIGNAL_TIMEOUT(23064, "下发信号超时"), + TIMEOUT_BETWEEN_OPERATING_PLUGINS_AND_CHARGE_MANAGEMENT(23071, "运营插件和充电管理之间的超时"), + UNKNOWN_ERROR_CAUSE(23499, "未知错误原因"), + ; + + private Integer code; + + private String reason; + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + + StartFailedReasonEnum(Integer code, String reason) { + this.code = code; + this.reason = reason; + } + + /** + * 根据 code 获取 reason + * + * @param code 编码 + * @return reason + */ + public static String getReasonByCode(Integer code) { + for (StartFailedReasonEnum item : StartFailedReasonEnum.values()) { + if (item.getCode().equals(code)) { + return item.getReason(); + } + } + return null; + } +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/dto/huawei/QueryStartChargeDTO.java b/jsowell-pile/src/main/java/com/jsowell/pile/dto/huawei/HWQueryStartChargeDTO.java similarity index 95% rename from jsowell-pile/src/main/java/com/jsowell/pile/dto/huawei/QueryStartChargeDTO.java rename to jsowell-pile/src/main/java/com/jsowell/pile/dto/huawei/HWQueryStartChargeDTO.java index 6cecb0772..43f3831f9 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/dto/huawei/QueryStartChargeDTO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/dto/huawei/HWQueryStartChargeDTO.java @@ -12,7 +12,7 @@ import java.math.BigDecimal; * @Date 2024/1/23 14:34:58 */ @Data -public class QueryStartChargeDTO { +public class HWQueryStartChargeDTO { /** * 充电订单号 Y * 格式“运营商ID+唯一编号”(<=27字符)。 @@ -61,4 +61,7 @@ public class QueryStartChargeDTO { */ @JsonProperty(value = "SOCLimit") private BigDecimal socLimit; + + + private String operatorId; } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/dto/huawei/ReceiveStartChargeResultDTO.java b/jsowell-pile/src/main/java/com/jsowell/pile/dto/huawei/ReceiveStartChargeResultDTO.java new file mode 100644 index 000000000..51c77ba5f --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/dto/huawei/ReceiveStartChargeResultDTO.java @@ -0,0 +1,50 @@ +package com.jsowell.pile.dto.huawei; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +/** + * 接收启动充电结果DTO + * + * @author Lemon + * @Date 2024/1/26 14:23:23 + */ +@Data +public class ReceiveStartChargeResultDTO { + + /** + * 充电订单号 + */ + @JsonProperty(value = "StartChargeSeq") + private String startChargeSeq; + + /** + * 充电订单状态 + */ + @JsonProperty(value = "StartChargeSeqStat") + private Integer startChargeSeqStat; + + /** + * 充电设备接口编码 + */ + @JsonProperty(value = "ConnectorID") + private String connectorID; + + /** + * 充电启动时间 + */ + @JsonProperty(value = "StartTime") + private String startTime; + + /** + * 停止充电验证码 + */ + @JsonProperty(value = "IdentCode") + private String identCode; + + /** + * 启动失败原因 + */ + @JsonProperty(value = "FailReason") + private Integer failReason; +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/dto/huawei/requestEquipBusinessPolicyDTO.java b/jsowell-pile/src/main/java/com/jsowell/pile/dto/huawei/RequestEquipBusinessPolicyDTO.java similarity index 91% rename from jsowell-pile/src/main/java/com/jsowell/pile/dto/huawei/requestEquipBusinessPolicyDTO.java rename to jsowell-pile/src/main/java/com/jsowell/pile/dto/huawei/RequestEquipBusinessPolicyDTO.java index 579448578..29c4c6283 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/dto/huawei/requestEquipBusinessPolicyDTO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/dto/huawei/RequestEquipBusinessPolicyDTO.java @@ -10,7 +10,7 @@ import lombok.Data; * @Date 2024/1/23 15:32:25 */ @Data -public class requestEquipBusinessPolicyDTO { +public class RequestEquipBusinessPolicyDTO { /** * 业务策略查询流水号 */ diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/huawei/QueryChargeStatusVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/huawei/QueryChargeStatusVO.java new file mode 100644 index 000000000..2797fbf2a --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/huawei/QueryChargeStatusVO.java @@ -0,0 +1,173 @@ +package com.jsowell.pile.vo.huawei; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +import java.util.List; + +/** + * TODO + * + * @author Lemon + * @Date 2024/1/26 16:29:29 + */ +@Data +public class QueryChargeStatusVO { + + /** + * + */ + @JsonProperty(value = "StartChargeSeq") + private String startChargeSeq; + + /** + * + */ + @JsonProperty(value = "StartChargeSeqStat") + private String startChargeSeqStat; + + /** + * + */ + @JsonProperty(value = "ConnectorID") + private String connectorID; + + /** + * + */ + @JsonProperty(value = "ConnectorStatus") + private String connectorStatus; + + /** + * + */ + @JsonProperty(value = "CurrentA") + private String currentA; + + /** + * + */ + @JsonProperty(value = "CurrentB") + private String currentB; + + /** + * + */ + @JsonProperty(value = "CurrentC") + private String currentC; + + /** + * + */ + @JsonProperty(value = "VoltageA") + private String voltageA; + + /** + * + */ + @JsonProperty(value = "VoltageB") + private String voltageB; + + /** + * + */ + @JsonProperty(value = "VoltageC") + private String voltageC; + + /** + * + */ + @JsonProperty(value = "Soc") + private String soc; + + /** + * + */ + @JsonProperty(value = "StartTime") + private String startTime; + + /** + * + */ + @JsonProperty(value = "EndTime") + private String endTime; + + /** + * + */ + @JsonProperty(value = "TotalPower") + private String totalPower; + + /** + * + */ + @JsonProperty(value = "ElecMoney") + private String elecMoney; + + /** + * + */ + @JsonProperty(value = "SeviceMoney") + private String seviceMoney; + + /** + * + */ + @JsonProperty(value = "TotalMoney") + private String totalMoney; + + /** + * + */ + @JsonProperty(value = "SumPeriod") + private String sumPeriod; + + /** + * + */ + @JsonProperty(value = "ChargeDetails") + private List chargeDetails; + + + @Data + public static class ChargeDetail{ + /** + * + */ + @JsonProperty(value = "DetailStartTime") + private String detailStartTime; + + /** + * + */ + @JsonProperty(value = "DetailEndTime") + private String detailEndTime; + + /** + * + */ + @JsonProperty(value = "ElecPrice") + private String elecPrice; + + /** + * + */ + @JsonProperty(value = "SevicePrice") + private String sevicePrice; + + /** + * + */ + @JsonProperty(value = "DetailPower") + private String detailPower; + + /** + * + */ + @JsonProperty(value = "DetailElecMoney") + private String detailElecMoney; + + @JsonProperty(value = "DetailSeviceMoney") + private String detailSeviceMoney; + } +} diff --git a/jsowell-pile/src/main/resources/mapper/pile/ThirdPartyPlatformConfigMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/ThirdPartyPlatformConfigMapper.xml index 8bca90749..efc7f6251 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/ThirdPartyPlatformConfigMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/ThirdPartyPlatformConfigMapper.xml @@ -107,6 +107,7 @@ \ No newline at end of file diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java index 7fde92458..615108ec2 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java @@ -7,17 +7,22 @@ import com.google.common.collect.Maps; import com.jsowell.common.constant.Constants; import com.jsowell.common.core.redis.RedisCache; import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; +import com.jsowell.common.enums.thirdparty.huawei.StartFailedReasonEnum; +import com.jsowell.common.enums.ykc.OrderStatusEnum; +import com.jsowell.common.enums.ykc.ReturnCodeEnum; +import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.id.IdUtils; import com.jsowell.pile.domain.*; import com.jsowell.pile.domain.huawei.HWStationInfo; import com.jsowell.pile.dto.PushStationInfoDTO; +import com.jsowell.pile.dto.QueryStartChargeDTO; import com.jsowell.pile.dto.huawei.DeliverEquipBusinessDTO; -import com.jsowell.pile.dto.huawei.QueryStartChargeDTO; -import com.jsowell.pile.dto.huawei.requestEquipBusinessPolicyDTO; +import com.jsowell.pile.dto.huawei.HWQueryStartChargeDTO; +import com.jsowell.pile.dto.huawei.ReceiveStartChargeResultDTO; +import com.jsowell.pile.dto.huawei.RequestEquipBusinessPolicyDTO; import com.jsowell.pile.service.*; -import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO; import com.jsowell.pile.vo.huawei.QueryEquipAuthVO; import com.jsowell.pile.vo.huawei.QueryStartChargeVO; import com.jsowell.pile.vo.uniapp.BillingPriceVO; @@ -25,12 +30,10 @@ import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.thirdparty.lianlian.common.CommonResult; import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo; import com.jsowell.thirdparty.lianlian.domain.StationStatusInfo; -import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; import com.jsowell.thirdparty.lianlian.util.GBSignUtils; import com.jsowell.thirdparty.lianlian.util.HttpRequestUtil; -import com.jsowell.thirdparty.zhongdianlian.dto.ZDLGetTokenDTO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -71,6 +74,9 @@ public class HuaweiServiceV2 { @Autowired private PileBillingTemplateService pileBillingTemplateService; + @Autowired + private OrderBasicInfoService orderBasicInfoService; + @Autowired private ThirdPartyStationRelationService thirdPartyStationRelationService; @@ -327,7 +333,7 @@ public class HuaweiServiceV2 { * @param dto * @return */ - public Map requestEquipBusinessPolicy(requestEquipBusinessPolicyDTO dto) { + public Map requestEquipBusinessPolicy(RequestEquipBusinessPolicyDTO dto) { String pileConnectorCode = dto.getConnectorID(); String equipBizSeq = dto.getEquipBizSeq(); // 根据枪口号查询计费模板,并返回信息 @@ -498,7 +504,7 @@ public class HuaweiServiceV2 { * @param dto * @return QueryStartChargeVO */ - public QueryStartChargeVO queryStartCharge(QueryStartChargeDTO dto) { + public QueryStartChargeVO queryStartCharge(HWQueryStartChargeDTO dto) { String pileConnectorCode = dto.getConnectorID(); BigDecimal chargeAmount = dto.getMoneyLimit(); // 获取华为配置参数 @@ -513,12 +519,24 @@ public class HuaweiServiceV2 { String urlAddress = settingInfo.getUrlAddress(); String requestUrl = urlAddress + "query_start_charge"; - // 生成订单号 - String orderCode = IdUtils.getOrderCode(); + // 生成订单 + String orderCode = IdUtils.getOrderCode(); + String startChargeSeq = Constants.OPERATORID_JIANG_SU + "_C" + orderCode; + QueryStartChargeDTO startChargeDTO = new QueryStartChargeDTO(); + startChargeDTO.setOperatorId(dto.getOperatorId()); + startChargeDTO.setStartChargeSeq(startChargeSeq); + startChargeDTO.setConnectorID(dto.getConnectorID()); + startChargeDTO.setAccountBalance(dto.getMoneyLimit()); + Map map = orderBasicInfoService.generateOrderForThirdParty(startChargeDTO); + + if (map == null) { + log.error("华为平台生成订单 error"); + throw new BusinessException(ReturnCodeEnum.CODE_GENERATE_ORDER_ERROR); + } // 拼装参数 JSONObject jsonObject = new JSONObject(); - jsonObject.put("StartChargeSeq", Constants.OPERATORID_JIANG_SU + "_C" + orderCode); + jsonObject.put("StartChargeSeq", startChargeSeq); jsonObject.put("ConnectorID", pileConnectorCode); jsonObject.put("MoneyLimit", chargeAmount); @@ -549,7 +567,71 @@ public class HuaweiServiceV2 { /** * 接收启动充电结果 */ - public void receiveStartChargeResult() { + public void receiveStartChargeResult(ReceiveStartChargeResultDTO dto) { + String startChargeSeq = dto.getStartChargeSeq(); + Integer startChargeSeqStat = dto.getStartChargeSeqStat(); // 充电订单状态 + Integer failReason = dto.getFailReason(); + String startTime = dto.getStartTime(); + // 根据订单号查询订单信息 + OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(startChargeSeq); + // 判断订单状态 + if (startChargeSeqStat == Constants.two) { + // 充电中 + orderBasicInfo.setOrderStatus(OrderStatusEnum.IN_THE_CHARGING.getValue()); + // 设置开始时间 + orderBasicInfo.setChargeStartTime(DateUtils.parseDate(startTime)); + orderBasicInfoService.updateOrderBasicInfo(orderBasicInfo); + } + if (failReason != 0) { + // 启动失败, 将失败原因换成中文 + String reason = StartFailedReasonEnum.getReasonByCode(failReason); + // 给用户退款(执行0x33中启动失败的操作流程) + orderBasicInfoService.chargingPileFailedToStart(orderBasicInfo.getTransactionCode(), reason); + } + } + + /** + * 查询充电状态 + * @param startChargeSeq + */ + public void queryChargeStatus(String startChargeSeq) { + ThirdPartySettingInfo settingInfo = getHuaWeiSettingInfo(); + if (settingInfo == null) { + return; + } + String operatorSecret = settingInfo.getOperatorSecret(); + String dataSecret = settingInfo.getDataSecret(); + String dataSecretIv = settingInfo.getDataSecretIv(); + String signSecret = settingInfo.getSignSecret(); + String urlAddress = settingInfo.getUrlAddress(); + + String requestUrl = urlAddress + "query_equip_auth"; + + // 拼装参数 + JSONObject jsonObject = new JSONObject(); + jsonObject.put("StartChargeSeq", startChargeSeq); + + // 加密 + byte[] encryptText = Cryptos.aesEncrypt(jsonObject.toJSONString().getBytes(StandardCharsets.UTF_8), + dataSecret.getBytes(), dataSecretIv.getBytes()); + String strData = Encodes.encodeBase64(encryptText); + + // 向华为发送请求 + String response = sendRequest2HuaWei(strData, signSecret, requestUrl); + + CommonResult commonResult = JSONObject.parseObject(response, CommonResult.class); + if (commonResult.getRet() != 0) { + log.error("解析查询华为充电状态接口result error:{}, ", commonResult.getMsg()); + return; + } + // 解密data + byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64((String) commonResult.getData()), + dataSecret.getBytes(), dataSecretIv.getBytes()); + String dataStr = new String(plainText, StandardCharsets.UTF_8); + + // 转换成对应的对象 + + }