Explorar el Código

feat(charging): 新增充电站信息查询功能

- 在ChargingBusinessService中新增queryStationsInfo接口方法
- 在ChargingBusinessServiceImpl中实现充电站信息查询逻辑
- 新增ConnectivityConstants中的充电站相关常量定义
- 创建充电设备接口信息实体类ConnectorInfo
- 创建充电设备信息实体类EquipmentInfo
- 创建充电站信息实体类StationInfo- 新增查询充电站信息的VO类QueryStationsInfoVO
wzq hace 4 semanas
padre
commit
650de8fbc8

+ 55 - 0
src/main/java/com/zsElectric/boot/charging/entity/ConnectorInfo.java

@@ -0,0 +1,55 @@
+package com.zsElectric.boot.charging.entity;
+
+import jakarta.validation.constraints.*;
+import lombok.Data;
+
+
+/**
+ * 充电设备接口信息实体类 - 字段首字母大写格式
+ */
+@Data
+public class ConnectorInfo {
+    
+    /** 充电设备接口编码 - 同一运营商内唯一,≤64字符 */
+    @NotBlank(message = "接口编码不能为空")
+    @Size(max = 64, message = "接口编码长度不能超过64字符")
+    private String ConnectorID;
+    
+    /** 充电设备接口名称 - ≤64字符 */
+    @NotBlank(message = "接口名称不能为空")
+    @Size(max = 64, message = "接口名称长度不能超过64字符")
+    private String ConnectorName;
+    
+    /** 充电设备接口类型 */
+    @NotNull(message = "接口类型不能为空")
+    private Integer ConnectorType;
+    
+    /** 额定电压上限 - 单位:V */
+    @NotNull(message = "额定电压上限不能为空")
+    @Positive(message = "电压上限必须大于0")
+    private Integer VoltageUpperLimits;
+    
+    /** 额定电压下限 - 单位:V */
+    @NotNull(message = "额定电压下限不能为空")
+    @Positive(message = "电压下限必须大于0")
+    private Integer VoltageLowerLimits;
+    
+    /** 额定电流 - 单位:A */
+    @NotNull(message = "额定电流不能为空")
+    @Positive(message = "额定电流必须大于0")
+    private Integer Current;
+    
+    /** 额定功率 - 单位:kW,保留小数点后一位 */
+    @NotNull(message = "额定功率不能为空")
+    @Positive(message = "额定功率必须大于0")
+    @Digits(integer = 4, fraction = 1, message = "功率最多保留1位小数")
+    private Double Power;
+    
+    /** 车位号 - 停车场车位编号,10字符 */
+    @Size(max = 10, message = "车位号长度不能超过10字符")
+    private String ParkNo;
+    
+    /** 国家标准 - 1-2011,2-2015 */
+    @NotNull(message = "国家标准不能为空")
+    private Integer NationalStandard;
+}

+ 66 - 0
src/main/java/com/zsElectric/boot/charging/entity/EquipmentInfo.java

@@ -0,0 +1,66 @@
+package com.zsElectric.boot.charging.entity;
+
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.*;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 充电设备信息实体类 - 字段首字母大写格式
+ */
+@Data
+public class EquipmentInfo {
+    
+    /** 设备编码 - 对同一运营商保证唯一,≤64字符 */
+    @NotBlank(message = "设备编码不能为空")
+    @Size(max = 64, message = "设备编码长度不能超过64字符")
+    private String EquipmentID;
+    
+    /** 设备生产商组织机构代码 - 9字符 */
+    @Pattern(regexp = "\\d{0,9}", message = "设备生产商组织机构代码必须为9位数字")
+    private String ManufacturerID;
+    
+    /** 设备生产商名称 - ≤128字符 */
+    @Size(max = 128, message = "设备生产商名称长度不能超过128字符")
+    private String ManufacturerName;
+    
+    /** 设备型号 - ≤64字符 */
+    @Size(max = 64, message = "设备型号长度不能超过64字符")
+    private String EquipmentModel;
+    
+    /** 设备生产日期 - YYYY-MM-DD格式 */
+    @Pattern(regexp = "\\d{4}-\\d{2}-\\d{2}", message = "生产日期格式应为YYYY-MM-DD")
+    private String ProductionDate;
+    
+    /** 设备类型 - 1-直流设备,2-交流设备,3-交直流一体设备,4-无线设备,5-其他 */
+    @NotNull(message = "设备类型不能为空")
+    private Integer EquipmentType;
+    
+    /** 充电设备接口列表 */
+    @Valid
+    @NotEmpty(message = "充电设备接口信息不能为空")
+    private List<ConnectorInfo> ConnectorInfos;
+    
+    /** 充电设备经度 - GCJ-02坐标系 */
+    @DecimalMin(value = "-180.0", message = "经度范围无效")
+    @DecimalMax(value = "180.0", message = "经度范围无效")
+    @Digits(integer = 3, fraction = 6, message = "经度最多保留6位小数")
+    private Double EquipmentLng;
+    
+    /** 充电设备纬度 - GCJ-02坐标系 */
+    @DecimalMin(value = "-90.0", message = "纬度范围无效")
+    @DecimalMax(value = "90.0", message = "纬度范围无效")
+    @Digits(integer = 2, fraction = 6, message = "纬度最多保留6位小数")
+    private Double EquipmentLat;
+    
+    /** 充电设备总功率 - 单位:kW,保留小数点后1位 */
+    @NotNull(message = "设备总功率不能为空")
+    @Positive(message = "设备总功率必须大于0")
+    @Digits(integer = 4, fraction = 1, message = "功率最多保留1位小数")
+    private Double Power;
+    
+    /** 充电设备名称 - ≤128字符 */
+    @Size(max = 128, message = "设备名称长度不能超过128字符")
+    private String EquipmentName;
+}

+ 128 - 0
src/main/java/com/zsElectric/boot/charging/entity/StationInfo.java

@@ -0,0 +1,128 @@
+package com.zsElectric.boot.charging.entity;
+
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.*;
+import lombok.Data;
+import java.util.List;
+
+/**
+ * 充电站信息实体类 - 字段首字母大写格式
+ */
+@Data
+public class StationInfo {
+    
+    /** 充电站ID - 运营商自定义的唯一编码,≤64字符 */
+    @NotBlank(message = "充电站ID不能为空")
+    @Size(max = 64, message = "充电站ID长度不能超过64字符")
+    private String StationID;
+    
+    /** 运营商ID - 9字符 */
+    @NotBlank(message = "运营商ID不能为空")
+    @Pattern(regexp = "\\d{9}", message = "运营商ID必须为9位数字")
+    private String OperatorID;
+    
+    /** 设备所属方ID - 设备所属运营平台组织机构代码,9字符 */
+    @NotBlank(message = "设备所属方ID不能为空")
+    @Pattern(regexp = "\\d{9}", message = "设备所属方ID必须为9位数字")
+    private String EquipmentOwnerID;
+    
+    /** 充电站名称 - ≤128字符 */
+    @NotBlank(message = "充电站名称不能为空")
+    @Size(max = 128, message = "充电站名称长度不能超过128字符")
+    private String StationName;
+    
+    /** 充电站国家代码 - 比如CN,≤32字符 */
+    @NotBlank(message = "国家代码不能为空")
+    @Size(max = 32, message = "国家代码长度不能超过32字符")
+    private String CountryCode;
+    
+    /** 充电站省市辖区编码 - 参照GB/T2260-2015,20字符 */
+    @NotBlank(message = "区域编码不能为空")
+    @Size(max = 20, message = "区域编码长度不能超过20字符")
+    private String AreaCode;
+    
+    /** 详细地址 - ≤255字符 */
+    @NotBlank(message = "详细地址不能为空")
+    @Size(max = 255, message = "详细地址长度不能超过255字符")
+    private String Address;
+    
+    /** 站点电话 - ≤128字符 */
+    @Size(max = 128, message = "站点电话长度不能超过128字符")
+    private String StationTel;
+    
+    /** 服务电话 - 平台服务电话,≤128字符 */
+    @NotBlank(message = "服务电话不能为空")
+    @Size(max = 128, message = "服务电话长度不能超过128字符")
+    private String ServiceTel;
+    
+    /** 站点类型 */
+    @NotNull(message = "站点类型不能为空")
+    private Integer StationType;
+    
+    /** 站点状态 */
+    @NotNull(message = "站点状态不能为空")
+    private Integer StationStatus;
+    
+    /** 车位数量 - 可停放进行充电的车位总数 */
+    @Min(value = 0, message = "车位数量不能小于0")
+    private Integer ParkNums = 0;
+    
+    /** 经度 - GCJ-02坐标系,保留小数点后6位 */
+    @DecimalMin(value = "-180.0", message = "经度范围无效")
+    @DecimalMax(value = "180.0", message = "经度范围无效")
+    @Digits(integer = 3, fraction = 6, message = "经度最多保留6位小数")
+    private Double StationLng;
+    
+    /** 纬度 - GCJ-02坐标系,保留小数点后6位 */
+    @DecimalMin(value = "-90.0", message = "纬度范围无效")
+    @DecimalMax(value = "90.0", message = "纬度范围无效")
+    @Digits(integer = 2, fraction = 6, message = "纬度最多保留6位小数")
+    private Double StationLat;
+    
+    /** 站点引导 - ≤1024字符 */
+    @Size(max = 1024, message = "站点引导长度不能超过1024字符")
+    private String SiteGuide;
+    
+    /** 建设场所 */
+    @NotNull(message = "建设场所不能为空")
+    private Integer Construction;
+    
+    /** 站点照片URL列表 */
+    private List<@Size(max = 512) String> Pictures;
+    
+    /** 营业时间描述 - ≤128字符 */
+    @NotBlank(message = "营业时间不能为空")
+    @Size(max = 128, message = "营业时间描述长度不能超过128字符")
+    private String BusineHours;
+    
+    /** 充电电费率描述 - ≤255字符 */
+    @NotBlank(message = "充电电费率不能为空")
+    @Size(max = 255, message = "充电电费率描述长度不能超过255字符")
+    private String ElectricityFee;
+    
+    /** 服务费率描述 - ≤255字符 */
+    @NotBlank(message = "服务费率不能为空")
+    @Size(max = 255, message = "服务费率描述长度不能超过255字符")
+    private String ServiceFee;
+    
+    /** 停车费率描述 - ≤255字符 */
+    @NotBlank(message = "停车费不能为空")
+    @Size(max = 255, message = "停车费率描述长度不能超过255字符")
+    private String ParkFee;
+    
+    /** 支付方式描述 - ≤64字符 */
+    @Size(max = 64, message = "支付方式描述长度不能超过64字符")
+    private String Payment;
+    
+    /** 是否支持预约 - 0-不支持,1-支持 */
+    private Integer SupportOrder = 0;
+    
+    /** 备注信息 - ≤255字符 */
+    @Size(max = 255, message = "备注信息长度不能超过255字符")
+    private String Remark;
+    
+    /** 充电设备信息列表 */
+    @Valid
+    @NotEmpty(message = "充电设备信息不能为空")
+    private List<EquipmentInfo> EquipmentInfos;
+}

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

@@ -2,6 +2,7 @@ package com.zsElectric.boot.charging.service;
 
 import com.zsElectric.boot.charging.vo.ChargingPricePolicyVO;
 import com.zsElectric.boot.charging.vo.EquipmentAuthResponseVO;
+import com.zsElectric.boot.charging.vo.QueryStationsInfoVO;
 
 public interface ChargingBusinessService {
 
@@ -24,4 +25,15 @@ public interface ChargingBusinessService {
      *
      */
     EquipmentAuthResponseVO queryEquipAuth(String EquipAuthSeq, String ConnectorID);
+
+    /**
+     * <p>查询充电站信息</p>
+     * @author wzq
+     * @param LastQueryTime 最后一次查询时间
+     * @param PageNo 页码
+     * @param PageSize 页大小
+     * @return 充电站信息列表
+     *
+     */
+    QueryStationsInfoVO queryStationsInfo(String LastQueryTime, Integer PageNo, Integer PageSize);
 }

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

@@ -6,6 +6,7 @@ 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.charging.vo.QueryStationsInfoVO;
 import com.zsElectric.boot.common.constant.ConnectivityConstants;
 import com.zsElectric.boot.common.util.AESCryptoUtil;
 import com.zsElectric.boot.common.util.electric.ChargingUtil;
@@ -51,4 +52,18 @@ public class ChargingBusinessServiceImpl implements ChargingBusinessService {
         log.info("查询设备认证返回结果解密后:{}", responseDecode);
         return new Gson().fromJson(responseDecode, EquipmentAuthResponseVO.class);
     }
+
+    @Override
+    public QueryStationsInfoVO queryStationsInfo(String LastQueryTime, Integer PageNo, Integer PageSize) {
+        Map<String, Object> queryParms = new HashMap<>();
+        queryParms.put("LastQueryTime", LastQueryTime);
+        queryParms.put("PageNo", PageNo);
+        queryParms.put("PageSize", PageSize);
+        log.info("查询充电站信息请求参数:{}", queryParms);
+        JsonObject jsonObject = chargingUtil.chargingRequest(ConnectivityConstants.QUERY_STATIONS_INFO, queryParms, true);
+        log.info("查询充电站信息返回结果:{}", jsonObject);
+        JsonObject responseDecode = chargingUtil.responseDecode(jsonObject);
+        log.info("查询充电站信息返回结果解密后:{}", responseDecode);
+        return new Gson().fromJson(responseDecode, QueryStationsInfoVO.class);
+    }
 }

+ 32 - 0
src/main/java/com/zsElectric/boot/charging/vo/QueryStationsInfoVO.java

@@ -0,0 +1,32 @@
+package com.zsElectric.boot.charging.vo;
+
+import com.zsElectric.boot.charging.entity.StationInfo;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Min;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class QueryStationsInfoVO {
+
+    /** 当前页数 - 如果查询页码大于页码总数,返回查询页码数 */
+    @NotNull(message = "当前页数不能为空")
+    @Min(value = 1, message = "当前页数不能小于1")
+    private Integer PageNo;
+
+    /** 页码总数 - 总页数 */
+    @NotNull(message = "总页数不能为空")
+    @Min(value = 0, message = "总页数不能小于0")
+    private Integer PageCount;
+
+    /** 总记录条数 - 符合条件的电站总数 */
+    @NotNull(message = "总记录条数不能为空")
+    @Min(value = 0, message = "总记录条数不能小于0")
+    private Integer ItemSize;
+
+    /** 充电站信息列表 - 包含充电站的基本信息、服务信息、支付信息、设备信息等 */
+    @Valid
+    private List<StationInfo> StationInfos;
+}

+ 15 - 0
src/main/java/com/zsElectric/boot/common/constant/ConnectivityConstants.java

@@ -70,6 +70,21 @@ public interface ConnectivityConstants {
      * */
     String QUERY_TOKEN = "/evcs/v1/query_token";
 
+    /**
+     * 查询充电站信息
+     */
+    String QUERY_STATIONS_INFO = "/evcs/v1/query_stations_info";
+
+    /**
+     * 设备状态变化推送
+     */
+    String NOTIFICATION_STATIONSTATUS = "/evcs/v1/notification_stationStatus";
+
+    /**
+     * 设备接口状态查询 (选接)
+     */
+    String QUERY_STATION_STATUS = "/evcs/v1/query_station_status";
+
     /**
      * 查询业务策略信息
      * */