Browse Source

feat(charging): 添加@JsonProperty注解以规范设备认证响应字段序列化

- 在EquipmentAuthResponseVO类添加@JsonAutoDetect注解
- 为每个成员变量添加@JsonProperty注解,指定序列化字段名称
- 保证序列化时字段名称符合接口规范
- 仍保留Swagger的Schema注释用于API文档生成
- 使用Lombok注解简化代码结构
SheepHy 1 week ago
parent
commit
c36119565f

+ 8 - 0
src/main/java/com/zsElectric/boot/charging/vo/EquipmentAuthResponseVO.java

@@ -1,6 +1,8 @@
 
 package com.zsElectric.boot.charging.vo;
 
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 import lombok.experimental.Accessors;
@@ -8,26 +10,32 @@ import lombok.experimental.Accessors;
 @Data
 @Accessors(chain = true)
 @Schema(description = "设备认证响应VO")
+@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE, setterVisibility = JsonAutoDetect.Visibility.NONE)
 public class EquipmentAuthResponseVO {
 
     @Schema(description = "设备认证流水号(格式:运营商ID+唯一编号)",
             example = "123456789201805071630123456")
+    @JsonProperty("EquipAuthSeq")
     private String EquipAuthSeq;
 
     @Schema(description = "充电设备接口编码",
             example = "3702120244102_1")
+    @JsonProperty("ConnectorID")
     private String ConnectorID;
 
     @Schema(description = "操作结果(0-成功,1-失败)",
             example = "0",
             allowableValues = {"0", "1"})
+    @JsonProperty("SuccStat")
     private Integer SuccStat;
 
     @Schema(description = "失败原因(0-无,1-此设备尚未插枪,2-设备检测失败,其它-自定义)",
             example = "0")
+    @JsonProperty("FailReason")
     private Integer FailReason;
 
     @Schema(description = "失败原因描述",
             example = "无错误")
+    @JsonProperty("FailReasonMsg")
     private String FailReasonMsg;
 }