瀏覽代碼

海康设备

魏熙美 6 年之前
父節點
當前提交
3fdff1732d

+ 6
- 5
CODE/smart-community/app-api/src/main/java/com/community/huiju/feign/entity/AddFace.java 查看文件

57
             private String appkey;
57
             private String appkey;
58
             private String openapi_ip_port_http;
58
             private String openapi_ip_port_http;
59
             private String opUserUuid;
59
             private String opUserUuid;
60
-            private String longNums;
60
+            private List<String> longNums;
61
             private List<Integer> personIds;
61
             private List<Integer> personIds;
62
 
62
 
63
 
63
 
82
             private String openapi_ip_port_http;
82
             private String openapi_ip_port_http;
83
             private String opUserUuid;
83
             private String opUserUuid;
84
             private Integer opType;
84
             private Integer opType;
85
-            private String personIds;
86
-            private String longNums;
85
+            private List<Integer> personIds;
86
+            private List<String> longNums;
87
 
87
 
88
         }
88
         }
89
 
89
 
153
             private String appkey;
153
             private String appkey;
154
             private String openapi_ip_port_http;
154
             private String openapi_ip_port_http;
155
             private String opUserUuid;
155
             private String opUserUuid;
156
-            private String personId;
157
-            private String personNo;
156
+            private Integer personId;
157
+            private Long personNo;
158
             private String personName;
158
             private String personName;
159
+            // 因为直接传输了图片流,就可以不用设置这个字段值
159
             private String facePhoto;
160
             private String facePhoto;
160
             private String cardNo;
161
             private String cardNo;
161
         }
162
         }

+ 113
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/feign/entity/UpdateFace.java 查看文件

1
+package com.community.huiju.feign.entity;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Data;
5
+import lombok.NoArgsConstructor;
6
+
7
+import java.util.List;
8
+
9
+@Data
10
+@AllArgsConstructor
11
+@NoArgsConstructor
12
+public class UpdateFace {
13
+
14
+
15
+    /**
16
+     * type : 厂商
17
+     * face : {"doorPermissions":{"authName":"权限组","personIds":[],"secret":"服务器secret","appkey":"服务器appkey","openapi_ip_port_http":"服务器地址","opUserUuid":"服务器操作人员UUID","longNums":"门口机(可视对讲)编号"},"doorFace":{"secret":"服务器secret","appkey":"服务器appkey","openapi_ip_port_http":"服务器地址","opUserUuid":"服务器操作人员UUID","opType":"执行操作","personIds":"人员海康ID","longNums":"门口机(可视对讲)编号"},"entranceGuardPermissions":{"personIds":"人员海康ID","doorUuids":"门禁点UUID","secret":"服务器secret","appkey":"服务器appkey","openapi_ip_port_http":"服务器操地址","opUserUuid":"服务器操作人员UUID"},"entranceGuardFace":{"secret":"服务器secret","appkey":"服务器appkey","openapi_ip_port_http":"服务器操地址","opUserUuid":"服务器操作人员UUID","personIds":"人员海康ID","deviceUuids":"门禁设备UUID","type":"1"},"person":{"secret":"服务器secret","appkey":"服务器appkey","openapi_ip_port_http":"服务器操地址","opUserUuid":"服务器操作人员UUID","personId":"人员海康ID","personNo":"人员海康编号","personName":"人员名称","facePhoto":"人脸图片","cardNo":"卡号"}}
18
+     */
19
+
20
+    private String type;
21
+    private FaceBean face;
22
+
23
+    @Data
24
+    @AllArgsConstructor
25
+    @NoArgsConstructor
26
+    public static class FaceBean {
27
+        /**
28
+         * doorFace : {"secret":"服务器secret","appkey":"服务器appkey","openapi_ip_port_http":"服务器地址","opUserUuid":"服务器操作人员UUID","opType":"执行操作","personIds":"人员海康ID","longNums":"门口机(可视对讲)编号"}
29
+         * entranceGuardFace : {"secret":"服务器secret","appkey":"服务器appkey","openapi_ip_port_http":"服务器操地址","opUserUuid":"服务器操作人员UUID","personIds":"人员海康ID","deviceUuids":"门禁设备UUID","type":"1"}
30
+         * person : {"secret":"服务器secret","appkey":"服务器appkey","openapi_ip_port_http":"服务器操地址","opUserUuid":"服务器操作人员UUID","personId":"人员海康ID","personNo":"人员海康编号","personName":"人员名称","facePhoto":"人脸图片","cardNo":"卡号"}
31
+         */
32
+
33
+        private DoorFaceBean doorFace;
34
+        private EntranceGuardFaceBean entranceGuardFace;
35
+        private PersonBean person;
36
+
37
+        @Data
38
+        @AllArgsConstructor
39
+        @NoArgsConstructor
40
+        public static class DoorFaceBean {
41
+            /**
42
+             * secret : 服务器secret
43
+             * appkey : 服务器appkey
44
+             * openapi_ip_port_http : 服务器地址
45
+             * opUserUuid : 服务器操作人员UUID
46
+             * opType : 执行操作
47
+             * personIds : 人员海康ID
48
+             * longNums : 门口机(可视对讲)编号
49
+             */
50
+
51
+            private String secret;
52
+            private String appkey;
53
+            private String openapi_ip_port_http;
54
+            private String opUserUuid;
55
+            private Integer opType;
56
+            private List<Integer> personIds;
57
+            private List<String> longNums;
58
+
59
+        }
60
+
61
+        @Data
62
+        @AllArgsConstructor
63
+        @NoArgsConstructor
64
+        public static class EntranceGuardFaceBean {
65
+            /**
66
+             * secret : 服务器secret
67
+             * appkey : 服务器appkey
68
+             * openapi_ip_port_http : 服务器操地址
69
+             * opUserUuid : 服务器操作人员UUID
70
+             * personIds : 人员海康ID
71
+             * deviceUuids : 门禁设备UUID
72
+             * type : 1
73
+             */
74
+
75
+            private String secret;
76
+            private String appkey;
77
+            private String openapi_ip_port_http;
78
+            private String opUserUuid;
79
+            private String personIds;
80
+            private String deviceUuids;
81
+            private Integer type;
82
+
83
+        }
84
+
85
+        @Data
86
+        @AllArgsConstructor
87
+        @NoArgsConstructor
88
+        public static class PersonBean {
89
+            /**
90
+             * secret : 服务器secret
91
+             * appkey : 服务器appkey
92
+             * openapi_ip_port_http : 服务器操地址
93
+             * opUserUuid : 服务器操作人员UUID
94
+             * personId : 人员海康ID
95
+             * personNo : 人员海康编号
96
+             * personName : 人员名称
97
+             * facePhoto : 人脸图片
98
+             * cardNo : 卡号
99
+             */
100
+
101
+            private String secret;
102
+            private String appkey;
103
+            private String openapi_ip_port_http;
104
+            private String opUserUuid;
105
+            private Integer personId;
106
+            private Long personNo;
107
+            private String personName;
108
+            // 因为直接传输了图片流,就可以不用设置这个字段值
109
+            private String facePhoto;
110
+            private String cardNo;
111
+        }
112
+    }
113
+}

+ 13
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpEquipment.java 查看文件

87
      */
87
      */
88
     private String image;
88
     private String image;
89
 
89
 
90
+    /**
91
+     * 厂家
92
+     */
93
+    private String factory;
94
+
90
     public Integer getId() {
95
     public Integer getId() {
91
         return id;
96
         return id;
92
     }
97
     }
270
     public void setImage(String image) {
275
     public void setImage(String image) {
271
         this.image = image;
276
         this.image = image;
272
     }
277
     }
278
+
279
+    public String getFactory() {
280
+        return factory;
281
+    }
282
+
283
+    public void setFactory(String factory) {
284
+        this.factory = factory;
285
+    }
273
 }
286
 }

+ 36
- 5
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/IEquipmentService.java 查看文件

1
 package com.community.huiju.service;
1
 package com.community.huiju.service;
2
 
2
 
3
 import com.community.commom.mode.ResponseBean;
3
 import com.community.commom.mode.ResponseBean;
4
-import com.community.huiju.model.TaUser;
5
-import com.community.huiju.model.TaUserHk;
6
-import com.community.huiju.model.TpEquipmentTree;
7
-import com.community.huiju.model.TpUnitHkSetting;
4
+import com.community.huiju.model.*;
5
+import org.springframework.web.multipart.MultipartFile;
6
+
7
+import java.util.List;
8
 
8
 
9
 /**
9
 /**
10
  * 公共设备方法
10
  * 公共设备方法
21
      */
21
      */
22
     String pushPerson(TpEquipmentTree tpEquipmentTree, TpUnitHkSetting unitHkSetting, TaUser user, TaUserHk taUserHk, Integer expirationTime);
22
     String pushPerson(TpEquipmentTree tpEquipmentTree, TpUnitHkSetting unitHkSetting, TaUser user, TaUserHk taUserHk, Integer expirationTime);
23
 
23
 
24
-    String addFace();
24
+    /**
25
+     *
26
+     * @param faceImg 文件流
27
+     * @param unitHkSetting
28
+     * @param tpEquipmentTree
29
+     * @param taUserHk
30
+     * @param userVerify
31
+     * @param user
32
+     * @param visualList
33
+     * @param doorUuids 门禁点UUID
34
+     * @param deviceUuids 门禁设备UUID
35
+     * @return
36
+     */
37
+    String addFace(MultipartFile faceImg, TpUnitHkSetting unitHkSetting, TpEquipmentTree tpEquipmentTree,
38
+                   TaUserHk taUserHk, TaUserVerify userVerify, TaUser user, List<String> visualList,
39
+                   String doorUuids, String deviceUuids);
40
+
25
 
41
 
42
+    /**
43
+     *
44
+     * @param faceImg 文件流
45
+     * @param unitHkSetting
46
+     * @param tpEquipmentTree
47
+     * @param taUserHk
48
+     * @param userVerify
49
+     * @param user
50
+     * @param visualList
51
+     * @param deviceUuids 门禁设备UUID
52
+     * @return
53
+     */
54
+    String updateFace(MultipartFile faceImg, TpUnitHkSetting unitHkSetting, TpEquipmentTree tpEquipmentTree,
55
+                      TaUserHk taUserHk, TaUserVerify userVerify, TaUser user, List<String> visualList,
56
+                      String deviceUuids);
26
 }
57
 }

+ 152
- 6
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/EquipmentServiceImpl.java 查看文件

4
 import com.community.commom.mode.ResponseBean;
4
 import com.community.commom.mode.ResponseBean;
5
 import com.community.huiju.exception.WisdomException;
5
 import com.community.huiju.exception.WisdomException;
6
 import com.community.huiju.feign.IHKServer;
6
 import com.community.huiju.feign.IHKServer;
7
+import com.community.huiju.feign.entity.AddFace;
7
 import com.community.huiju.feign.entity.PushPerson;
8
 import com.community.huiju.feign.entity.PushPerson;
8
-import com.community.huiju.model.TaUser;
9
-import com.community.huiju.model.TaUserHk;
10
-import com.community.huiju.model.TpEquipmentTree;
11
-import com.community.huiju.model.TpUnitHkSetting;
9
+import com.community.huiju.feign.entity.UpdateFace;
10
+import com.community.huiju.model.*;
12
 import com.community.huiju.service.IEquipmentService;
11
 import com.community.huiju.service.IEquipmentService;
13
 import lombok.extern.slf4j.Slf4j;
12
 import lombok.extern.slf4j.Slf4j;
13
+import org.apache.commons.collections.CollectionUtils;
14
 import org.springframework.beans.factory.annotation.Autowired;
14
 import org.springframework.beans.factory.annotation.Autowired;
15
 import org.springframework.stereotype.Service;
15
 import org.springframework.stereotype.Service;
16
+import org.springframework.web.multipart.MultipartFile;
17
+
18
+import java.util.Arrays;
19
+import java.util.List;
16
 
20
 
17
 @Slf4j
21
 @Slf4j
18
 @Service
22
 @Service
49
     }
53
     }
50
 
54
 
51
     @Override
55
     @Override
52
-    public String addFace() {
53
-        return null;
56
+    public String addFace(MultipartFile faceImg, TpUnitHkSetting unitHkSetting, TpEquipmentTree tpEquipmentTree,
57
+                          TaUserHk taUserHk, TaUserVerify userVerify, TaUser user, List<String> visualList,
58
+                          String doorUuids, String deviceUuids) {
59
+
60
+
61
+        AddFace addFace = new AddFace();
62
+        AddFace.FaceBean faceBean = new AddFace.FaceBean();
63
+
64
+        // 人脸图片
65
+        AddFace.FaceBean.PersonBean person = new AddFace.FaceBean.PersonBean();
66
+        person.setAppkey(tpEquipmentTree.getSecret());
67
+        person.setSecret(tpEquipmentTree.getAppkey());
68
+        person.setOpenapi_ip_port_http(tpEquipmentTree.getHttpServer());
69
+        person.setOpUserUuid(tpEquipmentTree.getOpUserUuid());
70
+        person.setPersonId(taUserHk.getHkUserId());
71
+        person.setPersonNo(Long.valueOf(taUserHk.getHkCardNo()));
72
+        person.setPersonName(user.getUserName());
73
+        person.setCardNo(taUserHk.getHkCardNo());
74
+
75
+        faceBean.setPerson(person);
76
+
77
+
78
+        if (CollectionUtils.isNotEmpty(visualList)) {
79
+            // 门口机卡权限(可是对讲)
80
+            AddFace.FaceBean.DoorPermissionsBean doorPermissionsBean = new AddFace.FaceBean.DoorPermissionsBean();
81
+            doorPermissionsBean.setAppkey(tpEquipmentTree.getSecret());
82
+            doorPermissionsBean.setSecret(tpEquipmentTree.getAppkey());
83
+            doorPermissionsBean.setOpenapi_ip_port_http(tpEquipmentTree.getHttpServer());
84
+            doorPermissionsBean.setOpUserUuid(tpEquipmentTree.getOpUserUuid());
85
+            doorPermissionsBean.setAuthName(user.getUserName()+userVerify.getId());
86
+            doorPermissionsBean.setPersonIds(Arrays.asList(taUserHk.getHkUserId()));
87
+            doorPermissionsBean.setLongNums(visualList);
88
+
89
+            // 门口机人脸权限(可视对讲)
90
+            AddFace.FaceBean.DoorFaceBean doorFaceBean = new AddFace.FaceBean.DoorFaceBean();
91
+            doorFaceBean.setAppkey(tpEquipmentTree.getSecret());
92
+            doorFaceBean.setSecret(tpEquipmentTree.getAppkey());
93
+            doorFaceBean.setOpenapi_ip_port_http(tpEquipmentTree.getHttpServer());
94
+            doorFaceBean.setOpUserUuid(tpEquipmentTree.getOpUserUuid());
95
+            doorFaceBean.setOpType(1);
96
+            doorFaceBean.setLongNums(visualList);
97
+            doorFaceBean.setPersonIds(Arrays.asList(taUserHk.getHkUserId()));
98
+
99
+            faceBean.setDoorPermissions(doorPermissionsBean);
100
+            faceBean.setDoorFace(doorFaceBean);
101
+        }
102
+
103
+
104
+        if (org.apache.commons.lang3.StringUtils.isNotBlank(doorUuids)) {
105
+            // 门禁卡权限下发
106
+            AddFace.FaceBean.EntranceGuardPermissionsBean entranceGuardPermissionsBean = new AddFace.FaceBean.EntranceGuardPermissionsBean();
107
+            entranceGuardPermissionsBean.setAppkey(tpEquipmentTree.getSecret());
108
+            entranceGuardPermissionsBean.setSecret(tpEquipmentTree.getAppkey());
109
+            entranceGuardPermissionsBean.setOpenapi_ip_port_http(tpEquipmentTree.getHttpServer());
110
+            entranceGuardPermissionsBean.setOpUserUuid(tpEquipmentTree.getOpUserUuid());
111
+            entranceGuardPermissionsBean.setPersonIds(String.valueOf(taUserHk.getHkUserId()));
112
+            entranceGuardPermissionsBean.setDoorUuids(doorUuids.substring(0, doorUuids.lastIndexOf(",")));
113
+
114
+            faceBean.setEntranceGuardPermissions(entranceGuardPermissionsBean);
115
+        }
116
+
117
+        if (org.apache.commons.lang3.StringUtils.isNotBlank(deviceUuids)) {
118
+
119
+            // 门禁人脸权限下发
120
+            AddFace.FaceBean.EntranceGuardFaceBean entranceGuardFaceBean = new AddFace.FaceBean.EntranceGuardFaceBean();
121
+            entranceGuardFaceBean.setAppkey(tpEquipmentTree.getSecret());
122
+            entranceGuardFaceBean.setSecret(tpEquipmentTree.getAppkey());
123
+            entranceGuardFaceBean.setOpenapi_ip_port_http(tpEquipmentTree.getHttpServer());
124
+            entranceGuardFaceBean.setOpUserUuid(tpEquipmentTree.getOpUserUuid());
125
+            entranceGuardFaceBean.setDeviceUuids(deviceUuids.substring(0, deviceUuids.lastIndexOf(",")));
126
+            entranceGuardFaceBean.setType(1);
127
+            entranceGuardFaceBean.setPersonIds(String.valueOf(taUserHk.getHkUserId()));
128
+
129
+            faceBean.setEntranceGuardFace(entranceGuardFaceBean);
130
+        }
131
+
132
+        addFace.setType(tpEquipmentTree.getFactory());
133
+        addFace.setFace(faceBean);
134
+        // 添加人脸
135
+        ResponseBean responseBean = ihkServer.addFace(faceImg, JSONObject.toJSONString(addFace));
136
+        if ("1".equals(responseBean.getCode())) {
137
+            throw new WisdomException(responseBean.getMessage());
138
+        }
139
+        return JSONObject.toJSONString(responseBean.getData());
140
+    }
141
+
142
+    @Override
143
+    public String updateFace(MultipartFile faceImg, TpUnitHkSetting unitHkSetting, TpEquipmentTree tpEquipmentTree, TaUserHk taUserHk, TaUserVerify userVerify, TaUser user, List<String> visualList, String deviceUuids) {
144
+
145
+        UpdateFace addFace = new UpdateFace();
146
+        UpdateFace.FaceBean faceBean = new UpdateFace.FaceBean();
147
+
148
+        // 人脸图片
149
+        UpdateFace.FaceBean.PersonBean person = new UpdateFace.FaceBean.PersonBean();
150
+        person.setAppkey(tpEquipmentTree.getSecret());
151
+        person.setSecret(tpEquipmentTree.getAppkey());
152
+        person.setOpenapi_ip_port_http(tpEquipmentTree.getHttpServer());
153
+        person.setOpUserUuid(tpEquipmentTree.getOpUserUuid());
154
+        person.setPersonId(taUserHk.getHkUserId());
155
+        person.setPersonNo(Long.valueOf(taUserHk.getHkCardNo()));
156
+        person.setPersonName(user.getUserName());
157
+        person.setCardNo(taUserHk.getHkCardNo());
158
+
159
+        faceBean.setPerson(person);
160
+
161
+
162
+        if (CollectionUtils.isNotEmpty(visualList)) {
163
+
164
+            // 门口机人脸权限(可视对讲)
165
+            UpdateFace.FaceBean.DoorFaceBean doorFaceBean = new UpdateFace.FaceBean.DoorFaceBean();
166
+            doorFaceBean.setAppkey(tpEquipmentTree.getSecret());
167
+            doorFaceBean.setSecret(tpEquipmentTree.getAppkey());
168
+            doorFaceBean.setOpenapi_ip_port_http(tpEquipmentTree.getHttpServer());
169
+            doorFaceBean.setOpUserUuid(tpEquipmentTree.getOpUserUuid());
170
+            doorFaceBean.setOpType(1);
171
+            doorFaceBean.setLongNums(visualList);
172
+            doorFaceBean.setPersonIds(Arrays.asList(taUserHk.getHkUserId()));
173
+
174
+            faceBean.setDoorFace(doorFaceBean);
175
+        }
176
+
177
+        if (org.apache.commons.lang3.StringUtils.isNotBlank(deviceUuids)) {
178
+
179
+            // 门禁人脸权限下发
180
+            UpdateFace.FaceBean.EntranceGuardFaceBean entranceGuardFaceBean = new UpdateFace.FaceBean.EntranceGuardFaceBean();
181
+            entranceGuardFaceBean.setAppkey(tpEquipmentTree.getSecret());
182
+            entranceGuardFaceBean.setSecret(tpEquipmentTree.getAppkey());
183
+            entranceGuardFaceBean.setOpenapi_ip_port_http(tpEquipmentTree.getHttpServer());
184
+            entranceGuardFaceBean.setOpUserUuid(tpEquipmentTree.getOpUserUuid());
185
+            entranceGuardFaceBean.setDeviceUuids(deviceUuids.substring(0, deviceUuids.lastIndexOf(",")));
186
+            entranceGuardFaceBean.setType(1);
187
+            entranceGuardFaceBean.setPersonIds(String.valueOf(taUserHk.getHkUserId()));
188
+
189
+            faceBean.setEntranceGuardFace(entranceGuardFaceBean);
190
+        }
191
+
192
+        addFace.setType(tpEquipmentTree.getFactory());
193
+        addFace.setFace(faceBean);
194
+        // 添加人脸
195
+        ResponseBean responseBean = ihkServer.updateFace(faceImg, JSONObject.toJSONString(addFace));
196
+        if ("1".equals(responseBean.getCode())) {
197
+            throw new WisdomException(responseBean.getMessage());
198
+        }
199
+        return JSONObject.toJSONString(responseBean.getData());
54
     }
200
     }
55
 }
201
 }

+ 26
- 18
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/FaceServicelimpl.java 查看文件

9
 import com.community.huiju.common.welcome.WelcomeProperties;
9
 import com.community.huiju.common.welcome.WelcomeProperties;
10
 import com.community.huiju.dao.*;
10
 import com.community.huiju.dao.*;
11
 import com.community.huiju.exception.WisdomException;
11
 import com.community.huiju.exception.WisdomException;
12
+import com.community.huiju.feign.IHKServer;
12
 import com.community.huiju.model.*;
13
 import com.community.huiju.model.*;
13
 import com.community.huiju.service.FaceServiceI;
14
 import com.community.huiju.service.FaceServiceI;
15
+import com.community.huiju.service.IEquipmentService;
14
 import com.community.huiju.service.IHKService;
16
 import com.community.huiju.service.IHKService;
15
 import com.community.huiju.service.ImageServiceI;
17
 import com.community.huiju.service.ImageServiceI;
16
 import com.google.common.collect.Maps;
18
 import com.google.common.collect.Maps;
82
     @Autowired
84
     @Autowired
83
     private TpUnitHkSettingMapper tpUnitHkSettingMapper;
85
     private TpUnitHkSettingMapper tpUnitHkSettingMapper;
84
 
86
 
87
+    @Autowired
88
+    private IEquipmentService iEquipmentService;
89
+
85
     @Override
90
     @Override
86
     @Transactional(rollbackFor = Exception.class)
91
     @Transactional(rollbackFor = Exception.class)
87
     public ResponseBean addFace(UserElement userElement, MultipartFile uploadFile, Integer otherUserId) {
92
     public ResponseBean addFace(UserElement userElement, MultipartFile uploadFile, Integer otherUserId) {
232
             Integer type = (Integer) jsonObject.get("errno");
237
             Integer type = (Integer) jsonObject.get("errno");
233
             Integer faceNum = (Integer) jsonObject.get("face_num");
238
             Integer faceNum = (Integer) jsonObject.get("face_num");
234
 
239
 
235
-//            // 修改人脸操作
236
-//            String data = HKOpenApi.HKpersonGroupId(uploadFile, taUserHk.getHkUserId(), taUserHk.getHkPersonNo(), user.getUserName(), taUserHk.getHkCardNo(), tpEquipmentTree.getAppkey(), tpEquipmentTree.getSecret(), tpEquipmentTree.getHttpServer(), tpEquipmentTree.getOpUserUuid());
237
-
238
             // 等待 1s
240
             // 等待 1s
239
             Thread.sleep(1000);
241
             Thread.sleep(1000);
240
 
242
 
241
             /*boolean isA为true进行添加,为false进行修改*/
243
             /*boolean isA为true进行添加,为false进行修改*/
242
             if (0 == type && 1 == faceNum) {
244
             if (0 == type && 1 == faceNum) {
243
 
245
 
246
+                // 给用户添加 海康门禁权限
247
+                List<TpEquipment> doorEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitId(userVerify.getCommunityId(), userVerify.getUnitId(), 4);
248
+                List<Map<String, Object>> equipmentUUID = getEquipmentUUID(doorEquipments);
249
+                StringBuilder doorUuids = new StringBuilder();
250
+                StringBuilder deviceUuids = new StringBuilder();
251
+                equipmentUUID.forEach(e-> {
252
+                    doorUuids.append(e.get("doorUuid"));
253
+                    doorUuids.append(",");
254
+                    deviceUuids.append(e.get("deviceUuid"));
255
+                    deviceUuids.append(",");
256
+                });
257
+
258
+                // 单元门口机
259
+                List<TpEquipment> visualEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitId(userVerify.getCommunityId(), userVerify.getUnitId(), 3);
260
+                List<String> visualList = visualEquipments.stream()
261
+                        .map(e-> tpConfigurationMapper.selectByPrimaryKey(e.getUuidId()).getConfigurationValue())
262
+                        .collect(Collectors.toList());
263
+
264
+                // true 添加人脸, false 修改人脸
244
                 if (isA) {
265
                 if (isA) {
245
                     /**
266
                     /**
246
                      * 添加人脸的时候下发可视对讲卡权限,修改人脸的时候不下发卡权限
267
                      * 添加人脸的时候下发可视对讲卡权限,修改人脸的时候不下发卡权限
247
                      */
268
                      */
248
-                    // 下发可是对讲卡权限
249
-                    ihkService.visualIntercomPermissions(unitHkSetting, tpEquipmentTree, taUserHk, userVerify, user);
250
-
251
-                    // 下发门禁权限
252
-                    ihkService.addAuthoritiesAnddownloadAuthorityByPersonIds(userVerify, taUserHk, tpEquipmentTree);
269
+                    iEquipmentService.addFace(uploadFile, unitHkSetting, tpEquipmentTree, taUserHk, userVerify, user,visualList,doorUuids.toString(), deviceUuids.toString());
253
 
270
 
254
                     taFaceMapper.insertSelective(taFace);
271
                     taFaceMapper.insertSelective(taFace);
255
                 } else {
272
                 } else {
256
                     taFaceMapper.updateByPrimaryKeySelective(taFace);
273
                     taFaceMapper.updateByPrimaryKeySelective(taFace);
274
+                    iEquipmentService.updateFace(uploadFile, unitHkSetting, tpEquipmentTree, taUserHk, userVerify, user,visualList, deviceUuids.toString());
257
                 }
275
                 }
258
 
276
 
259
-                // 等待 1s
260
-                Thread.sleep(3000);
261
-
262
                 responseBean.addSuccess(taFace);
277
                 responseBean.addSuccess(taFace);
263
 
278
 
264
-                // 下发门禁人脸权限
265
-                ihkService.downloadFaceAndFingerInfos(tpEquipmentTree, userVerify, taUserHk);
266
-
267
-
268
-                //可视对讲时 指定人员人脸权限下载
269
-                ihkService.visualIntercom(tpEquipmentTree, taUserHk, userVerify);
270
-
271
             } else {
279
             } else {
272
                 responseBean.addError("请录入正确图片");
280
                 responseBean.addError("请录入正确图片");
273
             }
281
             }

+ 28
- 8
CODE/smart-community/app-api/src/main/resources/mapper/TpEquipmentMapper.xml 查看文件

20
     <result column="op_user_uuid" property="opUserUuid" jdbcType="VARCHAR" />
20
     <result column="op_user_uuid" property="opUserUuid" jdbcType="VARCHAR" />
21
     <result column="http_server" property="httpServer" jdbcType="VARCHAR" />
21
     <result column="http_server" property="httpServer" jdbcType="VARCHAR" />
22
     <result column="unit_uuids" property="unitUuids" jdbcType="VARCHAR" />
22
     <result column="unit_uuids" property="unitUuids" jdbcType="VARCHAR" />
23
-    <result column="monitoringUrl" property="monitoringUrl" />
24
-    <result column="securityGuardTel" property="securityGuardTel" />
25
-    <result column="securityRoomTel" property="securityRoomTel" />
26
-    <result column="monitoringAddress" property="monitoringAddress" />
23
+    <result column="factory" property="factory" jdbcType="VARCHAR" />
24
+    <result column="device" property="device" jdbcType="VARCHAR" />
27
   </resultMap>
25
   </resultMap>
28
   <sql id="Base_Column_List" >
26
   <sql id="Base_Column_List" >
29
     id, url_id, community_id, security_guard_tel_id, security_room_tel_id, address_id,
27
     id, url_id, community_id, security_guard_tel_id, security_room_tel_id, address_id,
30
     create_time, create_user, update_time, update_user, uuid_id, equipment_type, equipment_tree_id,
28
     create_time, create_user, update_time, update_user, uuid_id, equipment_type, equipment_tree_id,
31
-    appkey, secret, op_user_uuid, http_server, unit_uuids
29
+    appkey, secret, op_user_uuid, http_server, unit_uuids, factory, device
32
   </sql>
30
   </sql>
33
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
31
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
34
     select
32
     select
47
       update_time, update_user, uuid_id,
45
       update_time, update_user, uuid_id,
48
       equipment_type, equipment_tree_id, appkey,
46
       equipment_type, equipment_tree_id, appkey,
49
       secret, op_user_uuid, http_server,
47
       secret, op_user_uuid, http_server,
50
-      unit_uuids)
48
+      unit_uuids, factory, device
49
+      )
51
     values (#{id,jdbcType=INTEGER}, #{urlId,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER},
50
     values (#{id,jdbcType=INTEGER}, #{urlId,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER},
52
       #{securityGuardTelId,jdbcType=INTEGER}, #{securityRoomTelId,jdbcType=INTEGER},
51
       #{securityGuardTelId,jdbcType=INTEGER}, #{securityRoomTelId,jdbcType=INTEGER},
53
       #{addressId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{createUser,jdbcType=INTEGER},
52
       #{addressId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{createUser,jdbcType=INTEGER},
54
       #{updateTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}, #{uuidId,jdbcType=INTEGER},
53
       #{updateTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}, #{uuidId,jdbcType=INTEGER},
55
       #{equipmentType,jdbcType=VARCHAR}, #{equipmentTreeId,jdbcType=INTEGER}, #{appkey,jdbcType=VARCHAR},
54
       #{equipmentType,jdbcType=VARCHAR}, #{equipmentTreeId,jdbcType=INTEGER}, #{appkey,jdbcType=VARCHAR},
56
       #{secret,jdbcType=VARCHAR}, #{opUserUuid,jdbcType=VARCHAR}, #{httpServer,jdbcType=VARCHAR},
55
       #{secret,jdbcType=VARCHAR}, #{opUserUuid,jdbcType=VARCHAR}, #{httpServer,jdbcType=VARCHAR},
57
-      #{unitUuids,jdbcType=VARCHAR})
56
+      #{unitUuids,jdbcType=VARCHAR}, #{factory,jdbcType=VARCHAR}, #{device,jdbcType=VARCHAR}
57
+      )
58
   </insert>
58
   </insert>
59
   <insert id="insertSelective" parameterType="com.community.huiju.model.TpEquipment" >
59
   <insert id="insertSelective" parameterType="com.community.huiju.model.TpEquipment" >
60
     insert into tp_equipment
60
     insert into tp_equipment
113
       <if test="unitUuids != null" >
113
       <if test="unitUuids != null" >
114
         unit_uuids,
114
         unit_uuids,
115
       </if>
115
       </if>
116
+      <if test="factory != null" >
117
+        factory,
118
+      </if>
119
+      <if test="device != null" >
120
+        device,
121
+      </if>
116
     </trim>
122
     </trim>
117
     <trim prefix="values (" suffix=")" suffixOverrides="," >
123
     <trim prefix="values (" suffix=")" suffixOverrides="," >
118
       <if test="id != null" >
124
       <if test="id != null" >
169
       <if test="unitUuids != null" >
175
       <if test="unitUuids != null" >
170
         #{unitUuids,jdbcType=VARCHAR},
176
         #{unitUuids,jdbcType=VARCHAR},
171
       </if>
177
       </if>
178
+      <if test="factory != null" >
179
+        #{factory,jdbcType=VARCHAR},
180
+      </if>
181
+      <if test="device != null" >
182
+        #{device,jdbcType=VARCHAR},
183
+      </if>
172
     </trim>
184
     </trim>
173
   </insert>
185
   </insert>
174
   <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpEquipment" >
186
   <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpEquipment" >
225
       <if test="unitUuids != null" >
237
       <if test="unitUuids != null" >
226
         unit_uuids = #{unitUuids,jdbcType=VARCHAR},
238
         unit_uuids = #{unitUuids,jdbcType=VARCHAR},
227
       </if>
239
       </if>
240
+      <if test="factory != null" >
241
+        factory = #{factory,jdbcType=VARCHAR},
242
+      </if>
243
+      <if test="device != null" >
244
+        device = #{device,jdbcType=VARCHAR},
245
+      </if>
228
     </set>
246
     </set>
229
     where id = #{id,jdbcType=INTEGER}
247
     where id = #{id,jdbcType=INTEGER}
230
   </update>
248
   </update>
246
       secret = #{secret,jdbcType=VARCHAR},
264
       secret = #{secret,jdbcType=VARCHAR},
247
       op_user_uuid = #{opUserUuid,jdbcType=VARCHAR},
265
       op_user_uuid = #{opUserUuid,jdbcType=VARCHAR},
248
       http_server = #{httpServer,jdbcType=VARCHAR},
266
       http_server = #{httpServer,jdbcType=VARCHAR},
249
-      unit_uuids = #{unitUuids,jdbcType=VARCHAR}
267
+      unit_uuids = #{unitUuids,jdbcType=VARCHAR},
268
+      factory = #{factory,jdbcType=VARCHAR},
269
+      device = #{device,jdbcType=VARCHAR}
250
     where id = #{id,jdbcType=INTEGER}
270
     where id = #{id,jdbcType=INTEGER}
251
   </update>
271
   </update>
252
 </mapper>
272
 </mapper>

+ 16
- 4
CODE/smart-community/app-api/src/main/resources/mapper/TpEquipmentTreeMapper.xml 查看文件

16
     <result column="op_user_uuid" property="opUserUuid" jdbcType="VARCHAR" />
16
     <result column="op_user_uuid" property="opUserUuid" jdbcType="VARCHAR" />
17
     <result column="http_server" property="httpServer" jdbcType="VARCHAR" />
17
     <result column="http_server" property="httpServer" jdbcType="VARCHAR" />
18
     <result column="unit_uuids" property="unitUuids" jdbcType="VARCHAR" />
18
     <result column="unit_uuids" property="unitUuids" jdbcType="VARCHAR" />
19
-    <result column="factory" property="factory" />
19
+    <result column="factory" property="factory" jdbcType="VARCHAR" />
20
   </resultMap>
20
   </resultMap>
21
   <sql id="Base_Column_List" >
21
   <sql id="Base_Column_List" >
22
     id, community_id, equipment_name, pid, sort, create_time, create_user, update_time,
22
     id, community_id, equipment_name, pid, sort, create_time, create_user, update_time,
37
       pid, sort, create_time,
37
       pid, sort, create_time,
38
       create_user, update_time, update_user,
38
       create_user, update_time, update_user,
39
       appkey, secret, op_user_uuid,
39
       appkey, secret, op_user_uuid,
40
-      http_server, unit_uuids)
40
+      http_server, unit_uuids, factory
41
+      )
41
     values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{equipmentName,jdbcType=VARCHAR},
42
     values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{equipmentName,jdbcType=VARCHAR},
42
       #{pid,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
43
       #{pid,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
43
       #{createUser,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER},
44
       #{createUser,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER},
44
       #{appkey,jdbcType=VARCHAR}, #{secret,jdbcType=VARCHAR}, #{opUserUuid,jdbcType=VARCHAR},
45
       #{appkey,jdbcType=VARCHAR}, #{secret,jdbcType=VARCHAR}, #{opUserUuid,jdbcType=VARCHAR},
45
-      #{httpServer,jdbcType=VARCHAR}, #{unitUuids,jdbcType=VARCHAR})
46
+      #{httpServer,jdbcType=VARCHAR}, #{unitUuids,jdbcType=VARCHAR}, #{factory,jdbcType=VARCHAR}
47
+      )
46
   </insert>
48
   </insert>
47
   <insert id="insertSelective" parameterType="com.community.huiju.model.TpEquipmentTree" >
49
   <insert id="insertSelective" parameterType="com.community.huiju.model.TpEquipmentTree" >
48
     insert into tp_equipment_tree
50
     insert into tp_equipment_tree
89
       <if test="unitUuids != null" >
91
       <if test="unitUuids != null" >
90
         unit_uuids,
92
         unit_uuids,
91
       </if>
93
       </if>
94
+      <if test="factory != null" >
95
+        factory,
96
+      </if>
92
     </trim>
97
     </trim>
93
     <trim prefix="values (" suffix=")" suffixOverrides="," >
98
     <trim prefix="values (" suffix=")" suffixOverrides="," >
94
       <if test="id != null" >
99
       <if test="id != null" >
133
       <if test="unitUuids != null" >
138
       <if test="unitUuids != null" >
134
         #{unitUuids,jdbcType=VARCHAR},
139
         #{unitUuids,jdbcType=VARCHAR},
135
       </if>
140
       </if>
141
+      <if test="factory != null" >
142
+        #{factory,jdbcType=VARCHAR},
143
+      </if>
136
     </trim>
144
     </trim>
137
   </insert>
145
   </insert>
138
   <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpEquipmentTree" >
146
   <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpEquipmentTree" >
177
       <if test="unitUuids != null" >
185
       <if test="unitUuids != null" >
178
         unit_uuids = #{unitUuids,jdbcType=VARCHAR},
186
         unit_uuids = #{unitUuids,jdbcType=VARCHAR},
179
       </if>
187
       </if>
188
+      <if test="factory != null" >
189
+        factory = #{factory,jdbcType=VARCHAR},
190
+      </if>
180
     </set>
191
     </set>
181
     where id = #{id,jdbcType=INTEGER}
192
     where id = #{id,jdbcType=INTEGER}
182
   </update>
193
   </update>
194
       secret = #{secret,jdbcType=VARCHAR},
205
       secret = #{secret,jdbcType=VARCHAR},
195
       op_user_uuid = #{opUserUuid,jdbcType=VARCHAR},
206
       op_user_uuid = #{opUserUuid,jdbcType=VARCHAR},
196
       http_server = #{httpServer,jdbcType=VARCHAR},
207
       http_server = #{httpServer,jdbcType=VARCHAR},
197
-      unit_uuids = #{unitUuids,jdbcType=VARCHAR}
208
+      unit_uuids = #{unitUuids,jdbcType=VARCHAR},
209
+      factory = #{factory,jdbcType=VARCHAR}
198
     where id = #{id,jdbcType=INTEGER}
210
     where id = #{id,jdbcType=INTEGER}
199
   </update>
211
   </update>
200
 </mapper>
212
 </mapper>