Эх сурвалжийг харах

feat(charging): 调整VO类字段命名规范并新增业务服务接口

- 统一ChargeOrderDetailVO类中所有字段名为大驼峰命名- 统一ChargeOrderStatusVO类中所有字段名为大驼峰命名
- 新增ChargingBusinessService接口及其实现类
- 实现queryEquipBusinessPolicy和queryEquipAuth方法
- 统一ChargingPricePolicyVO类中所有字段名为大驼峰命名
- 统一EquipmentAuthResponseVO类中所有字段名为大驼峰命名
- 统一StopChargeResponseVO类中所有字段名为大驼峰命名
SheepHy 4 долоо хоног өмнө
parent
commit
0bdc3be550

+ 27 - 0
src/main/java/com/zsElectric/boot/charging/service/ChargingBusinessService.java

@@ -0,0 +1,27 @@
+package com.zsElectric.boot.charging.service;
+
+import com.zsElectric.boot.charging.vo.ChargingPricePolicyVO;
+import com.zsElectric.boot.charging.vo.EquipmentAuthResponseVO;
+
+public interface ChargingBusinessService {
+
+    /**
+     * <p>查询业务策略信息</p>
+     * @author SheepHy
+     * @param EquipBizSeq  设备业务流水号
+     * @param ConnectorID 充电设备接口编码
+     * @return 返回值描述,如无返回值则为void 返回值为类则包含{@link ChargingPricePolicyVO}
+     *
+     */
+    ChargingPricePolicyVO queryEquipBusinessPolicy(String EquipBizSeq, String ConnectorID) throws Exception;
+
+    /**
+     * <p>请求设备认证</p>
+     * @author SheepHy
+     * @param EquipAuthSeq 设备认证流水号
+     * @param ConnectorID 充电设备接口编码
+     * @return 返回值描述,如无返回值则为void 返回值为类则包含{@link EquipmentAuthResponseVO}
+     *
+     */
+    EquipmentAuthResponseVO queryEquipAuth(String EquipAuthSeq, String ConnectorID);
+}

+ 54 - 0
src/main/java/com/zsElectric/boot/charging/service/impl/ChargingBusinessServiceImpl.java

@@ -0,0 +1,54 @@
+package com.zsElectric.boot.charging.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import com.zsElectric.boot.charging.service.ChargingBusinessService;
+import com.zsElectric.boot.charging.vo.ChargingPricePolicyVO;
+import com.zsElectric.boot.charging.vo.EquipmentAuthResponseVO;
+import com.zsElectric.boot.common.constant.ConnectivityConstants;
+import com.zsElectric.boot.common.util.AESCryptoUtil;
+import com.zsElectric.boot.common.util.electric.ChargingUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.zsElectric.boot.common.constant.ConnectivityConstants.PLATFORM_DATA_SECRET;
+import static com.zsElectric.boot.common.constant.ConnectivityConstants.PLATFORM_DATA_SECRET_IV;
+
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class ChargingBusinessServiceImpl implements ChargingBusinessService {
+
+    private final ChargingUtil chargingUtil;
+
+    @Override
+    public ChargingPricePolicyVO queryEquipBusinessPolicy(String equipBizSeq, String connectorID){
+        Map<String, Object> queryTokenParms = new HashMap<>();
+        queryTokenParms.put("equipBizSeq", equipBizSeq);
+        queryTokenParms.put("connectorID", connectorID);
+        log.info("查询设备价格策略请求参数:{}", queryTokenParms);
+        JsonObject jsonObject = chargingUtil.chargingRequest(ConnectivityConstants.QUERY_EQUIP_BUSINESS_POLICY, queryTokenParms, false);
+        log.info("查询设备价格策略返回结果:{}", jsonObject);
+        JsonObject responseDecode = chargingUtil.responseDecode(jsonObject);
+        log.info("查询设备价格策略返回结果解密后:{}", responseDecode);
+        return new Gson().fromJson(responseDecode, ChargingPricePolicyVO.class);
+    }
+
+    @Override
+    public EquipmentAuthResponseVO queryEquipAuth(String EquipAuthSeq, String ConnectorID) {
+        Map<String, Object> queryTokenParms = new HashMap<>();
+        queryTokenParms.put("EquipAuthSeq", EquipAuthSeq);
+        queryTokenParms.put("ConnectorID", ConnectorID);
+        log.info("查询设备认证请求参数:{}", queryTokenParms);
+        JsonObject jsonObject = chargingUtil.chargingRequest(ConnectivityConstants.QUERY_EQUIP_AUTH, queryTokenParms, false);
+        log.info("查询设备认证返回结果:{}", jsonObject);
+        JsonObject responseDecode = chargingUtil.responseDecode(jsonObject);
+        log.info("查询设备认证返回结果解密后:{}", responseDecode);
+        return new Gson().fromJson(responseDecode, EquipmentAuthResponseVO.class);
+    }
+}

+ 26 - 26
src/main/java/com/zsElectric/boot/charging/vo/ChargeOrderDetailVO.java

@@ -14,64 +14,64 @@ public class ChargeOrderDetailVO {
 
     @Schema(description = "订单状态(1-启动中,2-启动成功,3-启动失败,4-结束)",
             example = "2")
-    private Integer startChargeSeqStat;
+    private Integer StartChargeSeqStat;
 
     @Schema(description = "充电订单号(格式:运营商ID+唯一编号)",
             example = "123456789201712121131011234")
-    private String startChargeSeq;
+    private String StartChargeSeq;
 
     @Schema(description = "充电设备接口编码",
             example = "3702120244401_1")
-    private String connectorID;
+    private String ConnectorID;
 
     @Schema(description = "设备接口状态(0-离网,1-空闲,2-占用(未充电),3-占用(充电中),4-占用(预约锁定),255-故障)",
             example = "3")
-    private Integer connectorStatus;
+    private Integer ConnectorStatus;
 
     @Schema(description = "A相电流", example = "78.1")
-    private BigDecimal currentA;
+    private BigDecimal CurrentA;
 
     @Schema(description = "B相电流", example = "0.0")
-    private BigDecimal currentB;
+    private BigDecimal CurrentB;
 
     @Schema(description = "C相电流", example = "0.0")
-    private BigDecimal currentC;
+    private BigDecimal CurrentC;
 
     @Schema(description = "A相电压", example = "575.3")
-    private BigDecimal voltageA;
+    private BigDecimal VoltageA;
 
     @Schema(description = "B相电压", example = "0.0")
-    private BigDecimal voltageB;
+    private BigDecimal VoltageB;
 
     @Schema(description = "C相电压", example = "0.0")
-    private BigDecimal voltageC;
+    private BigDecimal VoltageC;
 
     @Schema(description = "电池SOC(剩余电量百分比)", example = "5.0")
-    private BigDecimal soc;
+    private BigDecimal Soc;
 
     @Schema(description = "充电开始时间", example = "2018-02-06 16:54:38")
-    private String startTime;
+    private String StartTime;
 
     @Schema(description = "充电结束时间", example = "2018-02-06 17:25:00")
-    private String endTime;
+    private String EndTime;
 
     @Schema(description = "累计充电电量(单位:kWh)", example = "3.5438")
-    private BigDecimal totalPower;
+    private BigDecimal TotalPower;
 
     @Schema(description = "电费(单位:元)", example = "4.956")
-    private BigDecimal elecMoney;
+    private BigDecimal ElecMoney;
 
     @Schema(description = "服务费(单位:元)", example = "0.0")
-    private BigDecimal serviceMoney;
+    private BigDecimal ServiceMoney;
 
     @Schema(description = "总金额(单位:元)", example = "4.956")
-    private BigDecimal totalMoney;
+    private BigDecimal TotalMoney;
 
     @Schema(description = "总时段数", example = "1")
-    private Integer sumPeriod;
+    private Integer SumPeriod;
 
     @Schema(description = "充电明细列表")
-    private List<ChargeDetail> chargeDetails;
+    private List<ChargeDetail> ChargeDetails;
 
     @Data
     @Accessors(chain = true)
@@ -80,25 +80,25 @@ public class ChargeOrderDetailVO {
 
         @Schema(description = "开始时间(yyyy-MM-dd HH:mm:ss格式)",
                 example = "2018-02-06 16:54:38")
-        private String detailStartTime;
+        private String DetailStartTime;
 
         @Schema(description = "结束时间(yyyy-MM-dd HH:mm:ss格式)",
                 example = "2018-02-06 17:25:00")
-        private String detailEndTime;
+        private String DetailEndTime;
 
         @Schema(description = "时段电价(小数点后2位)", example = "0.70")
-        private BigDecimal elecPrice;
+        private BigDecimal ElecPrice;
 
         @Schema(description = "时段服务费价格(小数点后2位)", example = "0.30")
-        private BigDecimal servicePrice;
+        private BigDecimal ServicePrice;
 
         @Schema(description = "时段充电量(单位:度,小数点后2位)", example = "3.54")
-        private BigDecimal detailPower;
+        private BigDecimal DetailPower;
 
         @Schema(description = "时段电费(小数点后2位)", example = "2.48")
-        private BigDecimal detailElecMoney;
+        private BigDecimal DetailElecMoney;
 
         @Schema(description = "时段服务费(小数点后2位)", example = "1.06")
-        private BigDecimal detailServiceMoney;
+        private BigDecimal DetailServiceMoney;
     }
 }

+ 8 - 7
src/main/java/com/zsElectric/boot/charging/vo/ChargeOrderStatusVO.java

@@ -1,3 +1,4 @@
+
 package com.zsElectric.boot.charging.vo;
 
 import io.swagger.v3.oas.annotations.media.Schema;
@@ -11,27 +12,27 @@ public class ChargeOrderStatusVO {
 
     @Schema(description = "充电订单号(格式:运营商ID+唯一编号)",
             example = "123456789201805141125123456")
-    private String startChargeSeq;
+    private String StartChargeSeq;
 
     @Schema(description = "充电订单状态(1-启动中,2-充电中,3-停止中,4-已结束,5-未知)",
             example = "1",
             allowableValues = {"1", "2", "3", "4", "5"})
-    private Integer startChargeSeqStat;
+    private Integer StartChargeSeqStat;
 
     @Schema(description = "充电设备接口编码",
             example = "3702120244402_1")
-    private String connectorID;
+    private String ConnectorID;
 
     @Schema(description = "操作结果(0-成功,1-失败)",
             example = "0",
             allowableValues = {"0", "1"})
-    private Integer succStat;
+    private Integer SuccStat;
 
     @Schema(description = "失败原因(0-无,1-此设备不存在,2-此设备离线,其它-自定义)",
             example = "0")
-    private Integer failReason;
+    private Integer FailReason;
 
     @Schema(description = "失败原因描述",
             example = "无错误")
-    private String failReasonMsg;
-}
+    private String FailReasonMsg;
+}

+ 10 - 10
src/main/java/com/zsElectric/boot/charging/vo/ChargingPricePolicyVO.java

@@ -13,22 +13,22 @@ import java.util.List;
 public class ChargingPricePolicyVO {
 
     @Schema(description = "设备业务序列号", example = "123456789123456789123456789")
-    private String equipBizSeq;
+    private String EquipBizSeq;
 
     @Schema(description = "充电桩ID", example = "TEST0000901_1")
-    private String connectorID;
+    private String ConnectorID;
 
     @Schema(description = "成功状态(0-成功,1-失败)", example = "0")
-    private Integer succStat;
+    private Integer SuccStat;
 
     @Schema(description = "失败原因(0-无错误)", example = "0")
-    private Integer failReason;
+    private Integer FailReason;
 
     @Schema(description = "总时段数", example = "3")
-    private Integer sumPeriod;
+    private Integer SumPeriod;
 
     @Schema(description = "价格策略信息列表")
-    private List<PolicyInfo> policyInfos;
+    private List<PolicyInfo> PolicyInfos;
 
     @Data
     @Accessors(chain = true)
@@ -36,15 +36,15 @@ public class ChargingPricePolicyVO {
     public static class PolicyInfo {
 
         @Schema(description = "时段开始时间(HHmmss格式)", example = "000000")
-        private String startTime;
+        private String StartTime;
 
         @Schema(description = "电价(元/度)", example = "0.7")
-        private BigDecimal elecPrice;
+        private BigDecimal ElecPrice;
 
         @Schema(description = "服务费(元/度)", example = "1.0")
-        private BigDecimal servicePrice;
+        private BigDecimal ServicePrice;
 
         @Schema(description = "时段标志(平台扩展字段,1-尖,2-峰,3-平,4-谷)", example = "1")
-        private Integer periodFlag;
+        private Integer PeriodFlag;
     }
 }

+ 6 - 5
src/main/java/com/zsElectric/boot/charging/vo/EquipmentAuthResponseVO.java

@@ -1,3 +1,4 @@
+
 package com.zsElectric.boot.charging.vo;
 
 import io.swagger.v3.oas.annotations.media.Schema;
@@ -11,22 +12,22 @@ public class EquipmentAuthResponseVO {
 
     @Schema(description = "设备认证流水号(格式:运营商ID+唯一编号)",
             example = "123456789201805071630123456")
-    private String equipAuthSeq;
+    private String EquipAuthSeq;
 
     @Schema(description = "充电设备接口编码",
             example = "3702120244102_1")
-    private String connectorID;
+    private String ConnectorID;
 
     @Schema(description = "操作结果(0-成功,1-失败)",
             example = "0",
             allowableValues = {"0", "1"})
-    private Integer succStat;
+    private Integer SuccStat;
 
     @Schema(description = "失败原因(0-无,1-此设备尚未插枪,2-设备检测失败,其它-自定义)",
             example = "0")
-    private Integer failReason;
+    private Integer FailReason;
 
     @Schema(description = "失败原因描述",
             example = "无错误")
-    private String failReasonMsg;
+    private String FailReasonMsg;
 }

+ 5 - 4
src/main/java/com/zsElectric/boot/charging/vo/StopChargeResponseVO.java

@@ -1,3 +1,4 @@
+
 package com.zsElectric.boot.charging.vo;
 
 import io.swagger.v3.oas.annotations.media.Schema;
@@ -11,14 +12,14 @@ public class StopChargeResponseVO {
 
     @Schema(description = "充电订单号(格式:运营商ID+唯一编号)",
             example = "123456789201805141125123456")
-    private String startChargeSeq;
+    private String StartChargeSeq;
 
     @Schema(description = "操作结果(0:成功;1:失败)",
             example = "0",
             allowableValues = {"0", "1"})
-    private Integer succStat;
+    private Integer SuccStat;
 
     @Schema(description = "失败原因(0:无;1:接收失败)",
             example = "0")
-    private Integer failReason;
-}
+    private Integer FailReason;
+}