浏览代码

refactor(hikiot): 重构海康门禁添加用户信息 DTO 并添加新字段

-重新组织 AddUserRequestDTO 类结构,提高可读性和可维护性
- 在 UserInfo 类中添加新字段:门禁计划列表、门编号列表、密码、最大开门时间
- 更新 HikiotTool 类中的 addUser 方法,使用新的 DTO 结构
- 删除 EvaluateMapper.xml 中的冗余注释
SheepHy 6 天之前
父节点
当前提交
be26a8347a

+ 15 - 8
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/hikiot/HikiotTool.java

@@ -162,13 +162,20 @@ public class HikiotTool {
      **/
     public static String addUser() throws IOException, InterruptedException {
         AddUserRequestDTO addUserRequestDTO = new AddUserRequestDTO();
+        List<AddUserRequestDTO.DoorRightPlan> doorRightPlans = new ArrayList<>();
+        AddUserRequestDTO.DoorRightPlan doorRightPlan = new AddUserRequestDTO.DoorRightPlan();
+        doorRightPlan.setDoorNo(1);
+        doorRightPlan.setPlanTemplateId(Collections.singletonList(1));
+        doorRightPlans.add(doorRightPlan);
         addUserRequestDTO.setDeviceSerial("FX0889961");
         addUserRequestDTO.setPayload(new AddUserRequestDTO.Payload()
-                .setUserInfo(new AddUserRequestDTO.Payload.UserInfo()
+                .setUserInfo(new AddUserRequestDTO.UserInfo()
                         .setUserType(VISITOR)
-                        .setEmployeeNo("000123")
-                        .setName("Sheep123")
-                        .setPermanentValid(true)
+                        .setEmployeeNo("00wm")
+                        .setName("王明")
+                        .setDoorRightPlan(doorRightPlans)
+                        .setDoorRight(Collections.singletonList(1))
+                        .setPermanentValid(true).setMaxOpenDoorTime(255)
                         .setEnableBeginTime(LocalDateTimeUtil.format(LocalDateTime.now().with(LocalTime.MIN), "yyyy-MM-dd'T'HH:mm:ss"))
                         .setEnableEndTime("2025-12-31T23:59:59")));
         return sendPostRequest(ADD_USER_URL, gson.toJson(addUserRequestDTO),setHeaders());
@@ -232,8 +239,8 @@ public class HikiotTool {
         AddFaceRequestDTO addFaceRequestDTO = new AddFaceRequestDTO();
         addFaceRequestDTO.setDeviceSerial("FX0889961");
         addFaceRequestDTO.setPayload(new AddFaceRequestDTO.Payload()
-                .setFaceInfo(new AddFaceRequestDTO.Payload.FaceInfo().setEmployeeNo("000123")
-                        .setFaceURL("https://dst-health.oss-cn-chengdu.aliyuncs.com/20250818/104a5d80d5da4dcaa0b836a9e826f533.jpg")));
+                .setFaceInfo(new AddFaceRequestDTO.Payload.FaceInfo().setEmployeeNo("00wm")
+                        .setFaceURL("https://dst-health.oss-cn-chengdu.aliyuncs.com/20250818/0e6f578209ba4eb995a73c6130ba9836.jpg")));
         return sendPostRequest(ADD_FACE_URL, gson.toJson(addFaceRequestDTO),setHeaders());
     }
 
@@ -422,8 +429,8 @@ public class HikiotTool {
     }
 
     public static void main(String[] args) throws IOException, InterruptedException {
-//        addUser();
-        addDoorWeekPlan();
+        addUser();
+//        addUserPlanTemplate();
 //        addFace();
 //        addUserWeekPlan();
 //        JsonObject root = JsonParser.parseString(HikiotTool.getAppAccessToken()).getAsJsonObject();

+ 52 - 33
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/hikiot/dto/AddUserRequestDTO.java

@@ -1,58 +1,77 @@
+
 package org.jeecg.modules.hikiot.dto;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
-import lombok.EqualsAndHashCode;
 import lombok.ToString;
 import lombok.experimental.Accessors;
 
-import java.util.Collections;
 import java.util.List;
 
 @Data
 @Accessors(chain = true)
-@EqualsAndHashCode(callSuper = false)
-@Schema(description="海康门禁添加用户信息DTO")
+@Schema(description = "海康门禁添加用户信息DTO")
 @ToString
 public class AddUserRequestDTO {
     @Schema(description = "设备序列号")
     private String deviceSerial;
+
     @Schema(description = "载荷")
     private Payload payload;
+
     @Data
     @Accessors(chain = true)
-    @EqualsAndHashCode(callSuper = false)
     @ToString
     public static class Payload {
         @Schema(description = "用户信息")
         private UserInfo userInfo;
-        @Data
-        @Accessors(chain = true)
-        @EqualsAndHashCode(callSuper = false)
-        @ToString
-        public static class UserInfo {
-            @Schema(description = "员工编号")
-            private String employeeNo;
-            @Schema(description = "姓名")
-            private String name;
-            @Schema(description = "用户类型")
-            private String userType;
-            @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
-            @Schema(description = "启用开始时间")
-            private String enableBeginTime;
-            @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
-            @Schema(description = "启用结束时间")
-            private String enableEndTime;
-            @Schema(description = "永是否久有效")
-            private boolean permanentValid;
-            private DoorRightPlan doorRightPlan;
-        }
-
-        @Data
-        public static class DoorRightPlan {
-            private int doorNo = 1;
-            private List<Integer> planTemplateId = Collections.singletonList(1);
-        }
     }
-}
+
+    @Data
+    @Accessors(chain = true)
+    @ToString
+    public static class UserInfo {
+        @Schema(description = "员工编号")
+        private String employeeNo;
+
+        @Schema(description = "姓名")
+        private String name;
+
+        @Schema(description = "用户类型")
+        private String userType;
+
+        @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
+        @Schema(description = "启用开始时间")
+        private String enableBeginTime;
+
+        @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
+        @Schema(description = "启用结束时间")
+        private String enableEndTime;
+
+        @Schema(description = "是否永久有效")
+        private boolean permanentValid;
+
+        @Schema(description = "门禁计划列表")
+        private List<DoorRightPlan> doorRightPlan;
+
+        @Schema(description = "门编号列表")
+        private List<Integer> doorRight;
+
+        @Schema(description = "密码")
+        private String password;
+
+        @Schema(description = "最大开门时间(秒)")
+        private int maxOpenDoorTime;
+    }
+
+    @Data
+    @Accessors(chain = true)
+    public static class DoorRightPlan {
+        @Schema(description = "门编号")
+        private int doorNo;
+
+        @Schema(description = "计划模板ID列表")
+        private List<Integer> planTemplateId;
+    }
+}

+ 0 - 3
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/EvaluateMapper.xml

@@ -20,9 +20,6 @@
         <if test="findEvaluateRequestDTO.score!=null">
             AND ne.score = #{findEvaluateRequestDTO.score}
         </if>
-<!--        <if test="findEvaluateRequestDTO.checkStatus!=null">-->
-<!--            AND ne.check_status = #{findEvaluateRequestDTO.checkStatus}-->
-<!--        </if>-->
         <if test="findEvaluateRequestDTO.replyStatus!=null">
             AND ne.reply_status = #{findEvaluateRequestDTO.replyStatus}
         </if>