Browse Source

海康设备

魏熙美 6 years ago
parent
commit
3fdff1732d

+ 6
- 5
CODE/smart-community/app-api/src/main/java/com/community/huiju/feign/entity/AddFace.java View File

@@ -57,7 +57,7 @@ public class AddFace {
57 57
             private String appkey;
58 58
             private String openapi_ip_port_http;
59 59
             private String opUserUuid;
60
-            private String longNums;
60
+            private List<String> longNums;
61 61
             private List<Integer> personIds;
62 62
 
63 63
 
@@ -82,8 +82,8 @@ public class AddFace {
82 82
             private String openapi_ip_port_http;
83 83
             private String opUserUuid;
84 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,9 +153,10 @@ public class AddFace {
153 153
             private String appkey;
154 154
             private String openapi_ip_port_http;
155 155
             private String opUserUuid;
156
-            private String personId;
157
-            private String personNo;
156
+            private Integer personId;
157
+            private Long personNo;
158 158
             private String personName;
159
+            // 因为直接传输了图片流,就可以不用设置这个字段值
159 160
             private String facePhoto;
160 161
             private String cardNo;
161 162
         }

+ 113
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/feign/entity/UpdateFace.java View File

@@ -0,0 +1,113 @@
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 View File

@@ -87,6 +87,11 @@ public class TpEquipment {
87 87
      */
88 88
     private String image;
89 89
 
90
+    /**
91
+     * 厂家
92
+     */
93
+    private String factory;
94
+
90 95
     public Integer getId() {
91 96
         return id;
92 97
     }
@@ -270,4 +275,12 @@ public class TpEquipment {
270 275
     public void setImage(String image) {
271 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 View File

@@ -1,10 +1,10 @@
1 1
 package com.community.huiju.service;
2 2
 
3 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,6 +21,37 @@ public interface IEquipmentService {
21 21
      */
22 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 View File

@@ -4,15 +4,19 @@ import com.alibaba.fastjson.JSONObject;
4 4
 import com.community.commom.mode.ResponseBean;
5 5
 import com.community.huiju.exception.WisdomException;
6 6
 import com.community.huiju.feign.IHKServer;
7
+import com.community.huiju.feign.entity.AddFace;
7 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 11
 import com.community.huiju.service.IEquipmentService;
13 12
 import lombok.extern.slf4j.Slf4j;
13
+import org.apache.commons.collections.CollectionUtils;
14 14
 import org.springframework.beans.factory.annotation.Autowired;
15 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 21
 @Slf4j
18 22
 @Service
@@ -49,7 +53,149 @@ public class EquipmentServiceImpl implements IEquipmentService {
49 53
     }
50 54
 
51 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 View File

@@ -9,8 +9,10 @@ import com.community.commom.session.UserElement;
9 9
 import com.community.huiju.common.welcome.WelcomeProperties;
10 10
 import com.community.huiju.dao.*;
11 11
 import com.community.huiju.exception.WisdomException;
12
+import com.community.huiju.feign.IHKServer;
12 13
 import com.community.huiju.model.*;
13 14
 import com.community.huiju.service.FaceServiceI;
15
+import com.community.huiju.service.IEquipmentService;
14 16
 import com.community.huiju.service.IHKService;
15 17
 import com.community.huiju.service.ImageServiceI;
16 18
 import com.google.common.collect.Maps;
@@ -82,6 +84,9 @@ public class FaceServicelimpl implements FaceServiceI {
82 84
     @Autowired
83 85
     private TpUnitHkSettingMapper tpUnitHkSettingMapper;
84 86
 
87
+    @Autowired
88
+    private IEquipmentService iEquipmentService;
89
+
85 90
     @Override
86 91
     @Transactional(rollbackFor = Exception.class)
87 92
     public ResponseBean addFace(UserElement userElement, MultipartFile uploadFile, Integer otherUserId) {
@@ -232,42 +237,45 @@ public class FaceServicelimpl implements FaceServiceI {
232 237
             Integer type = (Integer) jsonObject.get("errno");
233 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 240
             // 等待 1s
239 241
             Thread.sleep(1000);
240 242
 
241 243
             /*boolean isA为true进行添加,为false进行修改*/
242 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 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 271
                     taFaceMapper.insertSelective(taFace);
255 272
                 } else {
256 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 277
                 responseBean.addSuccess(taFace);
263 278
 
264
-                // 下发门禁人脸权限
265
-                ihkService.downloadFaceAndFingerInfos(tpEquipmentTree, userVerify, taUserHk);
266
-
267
-
268
-                //可视对讲时 指定人员人脸权限下载
269
-                ihkService.visualIntercom(tpEquipmentTree, taUserHk, userVerify);
270
-
271 279
             } else {
272 280
                 responseBean.addError("请录入正确图片");
273 281
             }

+ 28
- 8
CODE/smart-community/app-api/src/main/resources/mapper/TpEquipmentMapper.xml View File

@@ -20,15 +20,13 @@
20 20
     <result column="op_user_uuid" property="opUserUuid" jdbcType="VARCHAR" />
21 21
     <result column="http_server" property="httpServer" jdbcType="VARCHAR" />
22 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 25
   </resultMap>
28 26
   <sql id="Base_Column_List" >
29 27
     id, url_id, community_id, security_guard_tel_id, security_room_tel_id, address_id,
30 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 30
   </sql>
33 31
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
34 32
     select
@@ -47,14 +45,16 @@
47 45
       update_time, update_user, uuid_id,
48 46
       equipment_type, equipment_tree_id, appkey,
49 47
       secret, op_user_uuid, http_server,
50
-      unit_uuids)
48
+      unit_uuids, factory, device
49
+      )
51 50
     values (#{id,jdbcType=INTEGER}, #{urlId,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER},
52 51
       #{securityGuardTelId,jdbcType=INTEGER}, #{securityRoomTelId,jdbcType=INTEGER},
53 52
       #{addressId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{createUser,jdbcType=INTEGER},
54 53
       #{updateTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}, #{uuidId,jdbcType=INTEGER},
55 54
       #{equipmentType,jdbcType=VARCHAR}, #{equipmentTreeId,jdbcType=INTEGER}, #{appkey,jdbcType=VARCHAR},
56 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 58
   </insert>
59 59
   <insert id="insertSelective" parameterType="com.community.huiju.model.TpEquipment" >
60 60
     insert into tp_equipment
@@ -113,6 +113,12 @@
113 113
       <if test="unitUuids != null" >
114 114
         unit_uuids,
115 115
       </if>
116
+      <if test="factory != null" >
117
+        factory,
118
+      </if>
119
+      <if test="device != null" >
120
+        device,
121
+      </if>
116 122
     </trim>
117 123
     <trim prefix="values (" suffix=")" suffixOverrides="," >
118 124
       <if test="id != null" >
@@ -169,6 +175,12 @@
169 175
       <if test="unitUuids != null" >
170 176
         #{unitUuids,jdbcType=VARCHAR},
171 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 184
     </trim>
173 185
   </insert>
174 186
   <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpEquipment" >
@@ -225,6 +237,12 @@
225 237
       <if test="unitUuids != null" >
226 238
         unit_uuids = #{unitUuids,jdbcType=VARCHAR},
227 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 246
     </set>
229 247
     where id = #{id,jdbcType=INTEGER}
230 248
   </update>
@@ -246,7 +264,9 @@
246 264
       secret = #{secret,jdbcType=VARCHAR},
247 265
       op_user_uuid = #{opUserUuid,jdbcType=VARCHAR},
248 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 270
     where id = #{id,jdbcType=INTEGER}
251 271
   </update>
252 272
 </mapper>

+ 16
- 4
CODE/smart-community/app-api/src/main/resources/mapper/TpEquipmentTreeMapper.xml View File

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