|
@@ -0,0 +1,441 @@
|
|
1
|
+package com.community.huiju.service.impl;
|
|
2
|
+
|
|
3
|
+import com.alibaba.fastjson.JSONObject;
|
|
4
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
5
|
+import com.community.commom.ailiyun.AESDecode;
|
|
6
|
+import com.community.commom.constant.Constant;
|
|
7
|
+import com.community.commom.hk.HKOpenApi;
|
|
8
|
+import com.community.commom.session.UserElement;
|
|
9
|
+import com.community.huiju.common.base.ResponseBean;
|
|
10
|
+import com.community.huiju.dao.*;
|
|
11
|
+import com.community.huiju.enums.ResponseErrorsMessages;
|
|
12
|
+import com.community.huiju.exception.WisdomException;
|
|
13
|
+import com.community.huiju.model.*;
|
|
14
|
+import com.community.huiju.service.FaceServiceI;
|
|
15
|
+import com.community.huiju.service.IHKService;
|
|
16
|
+import com.community.huiju.service.ImageServiceI;
|
|
17
|
+import com.google.common.collect.Maps;
|
|
18
|
+import lombok.extern.slf4j.Slf4j;
|
|
19
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
20
|
+import org.springframework.http.HttpEntity;
|
|
21
|
+import org.springframework.http.HttpHeaders;
|
|
22
|
+import org.springframework.http.HttpMethod;
|
|
23
|
+import org.springframework.http.MediaType;
|
|
24
|
+import org.springframework.stereotype.Service;
|
|
25
|
+import org.springframework.transaction.annotation.Transactional;
|
|
26
|
+import org.springframework.web.client.RestTemplate;
|
|
27
|
+import org.springframework.web.multipart.MultipartFile;
|
|
28
|
+
|
|
29
|
+import java.io.IOException;
|
|
30
|
+import java.util.ArrayList;
|
|
31
|
+import java.util.Date;
|
|
32
|
+import java.util.List;
|
|
33
|
+import java.util.Map;
|
|
34
|
+import java.util.stream.Collectors;
|
|
35
|
+
|
|
36
|
+@Service("faceServicel")
|
|
37
|
+@Transactional
|
|
38
|
+@Slf4j
|
|
39
|
+public class FaceServicelimpl extends ServiceImpl<TaFaceMapper, TaFace> implements FaceServiceI {
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+ @Autowired
|
|
43
|
+ private TaFaceMapper taFaceMapper;
|
|
44
|
+
|
|
45
|
+ @Autowired
|
|
46
|
+ private TaUserMapper taUserMapper;
|
|
47
|
+
|
|
48
|
+ @Autowired
|
|
49
|
+ private TaSysRoleMapper taSysRoleMapper;
|
|
50
|
+
|
|
51
|
+ @Autowired
|
|
52
|
+ private ImageServiceI imageServiceI;
|
|
53
|
+
|
|
54
|
+ @Autowired
|
|
55
|
+ private TaUserVerifyMapper taUserVerifyMapper;
|
|
56
|
+
|
|
57
|
+ @Autowired
|
|
58
|
+ private IHKService ihkService;
|
|
59
|
+
|
|
60
|
+ @Autowired
|
|
61
|
+ private TpEquipmentMapper tpEquipmentMapper;
|
|
62
|
+
|
|
63
|
+ @Autowired
|
|
64
|
+ private TpConfigurationMapper tpConfigurationMapper;
|
|
65
|
+
|
|
66
|
+ @Autowired
|
|
67
|
+ private TpEquipmentTreeMapper tpEquipmentTreeMapper;
|
|
68
|
+
|
|
69
|
+ @Override
|
|
70
|
+ @Transactional(rollbackFor = Exception.class)
|
|
71
|
+ public ResponseBean addFace(Integer userId, Integer userVerifyId, MultipartFile uploadFile) {
|
|
72
|
+ ResponseBean responseBean = new ResponseBean();
|
|
73
|
+ // 判断房产是否存在关联关系
|
|
74
|
+ TaUserVerify userVerify = taUserVerifyMapper.selectByUserIdAndUserVerifyId(userId, userVerifyId);
|
|
75
|
+ if (null == userVerify) {
|
|
76
|
+ responseBean.addError(ResponseErrorsMessages.NOT_USER_VERIFY.getCode(), ResponseErrorsMessages.NOT_USER_VERIFY.getMsg());
|
|
77
|
+ return responseBean;
|
|
78
|
+ }
|
|
79
|
+
|
|
80
|
+ TpEquipmentTree tpEquipmentTree = tpEquipmentTreeMapper.selectByCommunityId(userVerify.getCommunityId());
|
|
81
|
+
|
|
82
|
+ // 当前人脸图片url
|
|
83
|
+ String faceImg = img(uploadFile);
|
|
84
|
+
|
|
85
|
+ /**
|
|
86
|
+ * 删除的时候,将所有的海康设备的关联关系删除了,需要重新下发一次
|
|
87
|
+ */
|
|
88
|
+ // 下发门禁
|
|
89
|
+ ihkService.pushPerson(userId + "", userVerifyId);
|
|
90
|
+
|
|
91
|
+ TaUser user = taUserMapper.selectById(userId);
|
|
92
|
+ TaFace taFace = new TaFace();
|
|
93
|
+ taFace.setFaceImg(faceImg);
|
|
94
|
+ taFace.setCommunityId(user.getCommunityId());
|
|
95
|
+ taFace.setTaUserVerifyId(userVerifyId);
|
|
96
|
+ taFace.setCreateUser(userId);
|
|
97
|
+ taFace.setUpdateUser(userId);
|
|
98
|
+ taFace.setCreateDate(new Date());
|
|
99
|
+ taFace.setUpdateDate(new Date());
|
|
100
|
+
|
|
101
|
+ /*验证身份*/
|
|
102
|
+ responseBean = addVerify(userId, userVerifyId, uploadFile, faceImg, taFace, tpEquipmentTree);
|
|
103
|
+ return responseBean;
|
|
104
|
+ }
|
|
105
|
+
|
|
106
|
+ /**
|
|
107
|
+ * 修改人脸信息
|
|
108
|
+ *
|
|
109
|
+ * @param userElement 登入人ID
|
|
110
|
+ * @param uploadFile
|
|
111
|
+ * @param otherUserId 关联家属或者租客ID
|
|
112
|
+ * @return
|
|
113
|
+ */
|
|
114
|
+ @Override
|
|
115
|
+ @Transactional(rollbackFor = Exception.class)
|
|
116
|
+ public ResponseBean updateFace(Integer userId, Integer userVerifyId, MultipartFile uploadFile) {
|
|
117
|
+ ResponseBean responseBean = new ResponseBean();
|
|
118
|
+ // 判断房产是否存在关联关系
|
|
119
|
+ TaUserVerify userVerify = taUserVerifyMapper.selectByUserIdAndUserVerifyId(userId, userVerifyId);
|
|
120
|
+ if (null == userVerify) {
|
|
121
|
+ responseBean.addError(ResponseErrorsMessages.NOT_USER_VERIFY.getCode(), ResponseErrorsMessages.NOT_USER_VERIFY.getMsg());
|
|
122
|
+ return responseBean;
|
|
123
|
+ }
|
|
124
|
+
|
|
125
|
+ TpEquipmentTree tpEquipmentTree = tpEquipmentTreeMapper.selectByCommunityId(userVerify.getCommunityId());
|
|
126
|
+ // 人脸图片地址url
|
|
127
|
+ String faceImg = img(uploadFile);
|
|
128
|
+
|
|
129
|
+ /**
|
|
130
|
+ * 删除的时候,将所有的海康设备的关联关系删除了,需要重新下发一次
|
|
131
|
+ */
|
|
132
|
+ // 下发门禁
|
|
133
|
+ ihkService.pushPerson(userId + "", userVerifyId);
|
|
134
|
+
|
|
135
|
+ //当前修改的id否存在
|
|
136
|
+ TaFace face = taFaceMapper.getByUserVerifyId(userVerifyId);
|
|
137
|
+ if (null == face) {
|
|
138
|
+ responseBean.addError(ResponseErrorsMessages.NOT_USER_FACE.getCode(), ResponseErrorsMessages.NOT_USER_FACE.getMsg());
|
|
139
|
+ return responseBean;
|
|
140
|
+ }
|
|
141
|
+
|
|
142
|
+ face.setTaUserVerifyId(userVerifyId);
|
|
143
|
+ face.setFaceImg(faceImg);
|
|
144
|
+ face.setUpdateUser(userId);
|
|
145
|
+ face.setUpdateDate(new Date());
|
|
146
|
+ ResponseBean resps = checKout(faceImg, face, false, uploadFile, userId, userVerify.getCommunityId(), userVerify.getRoomNoId(), userVerify.getUnitId(), tpEquipmentTree.getAppkey(), tpEquipmentTree.getSecret(), tpEquipmentTree.getHttpServer());
|
|
147
|
+ if (resps.getCode().equals("0")) {
|
|
148
|
+ resps.addSuccess((Object) faceImg);
|
|
149
|
+ } else {
|
|
150
|
+ resps.addError(resps.getMessage());
|
|
151
|
+ }
|
|
152
|
+ return resps;
|
|
153
|
+ }
|
|
154
|
+
|
|
155
|
+ /**
|
|
156
|
+ * 验证图片是否为人脸,推送海康
|
|
157
|
+ * @param faceImg
|
|
158
|
+ * @param taFace
|
|
159
|
+ * @param isA
|
|
160
|
+ * @param uploadFile
|
|
161
|
+ * @param userId
|
|
162
|
+ * @param communityId
|
|
163
|
+ * @param roomNoId
|
|
164
|
+ * @param unitId
|
|
165
|
+ * @param appkey
|
|
166
|
+ * @param secret
|
|
167
|
+ * @param openapi_ip_port_http 海康服务器地址
|
|
168
|
+ * @return
|
|
169
|
+ */
|
|
170
|
+ public ResponseBean checKout(String faceImg, TaFace taFace, boolean isA, MultipartFile uploadFile, Integer userId, Integer communityId, Integer roomNoId, Integer unitId, String appkey, String secret, String openapi_ip_port_http) {
|
|
171
|
+ ResponseBean responseBean = new ResponseBean();
|
|
172
|
+ TaUser user = taUserMapper.selectById(userId);
|
|
173
|
+ if (user.getHkUserId() == null) {
|
|
174
|
+ log.error("本地库人员ID:{} 的海康人员ID不存在", userId);
|
|
175
|
+ throw new WisdomException(ResponseErrorsMessages.NOT_PUSH_FACE.getCode(), ResponseErrorsMessages.NOT_PUSH_FACE.getMsg());
|
|
176
|
+ return responseBean;
|
|
177
|
+ }
|
|
178
|
+ AESDecode aesd = new AESDecode();
|
|
179
|
+ String body = "{\"type\": \"0\", \"image_url\":\"" + faceImg + "\"}";
|
|
180
|
+ try {
|
|
181
|
+ com.community.commom.mode.ResponseBean send = aesd.send(body);
|
|
182
|
+ JSONObject jsonObject = JSONObject.parseObject(send.getMessage());
|
|
183
|
+ Integer type = (Integer) jsonObject.get("errno");
|
|
184
|
+ Integer faceNum = (Integer) jsonObject.get("face_num");
|
|
185
|
+
|
|
186
|
+ /*推送海康*/
|
|
187
|
+ String data = HKOpenApi.HKpersonGroupId(uploadFile, user.getHkUserId(), user.getHkPersonNo(), user.getUserName(), user.getHkCardNo(), appkey, secret, openapi_ip_port_http);
|
|
188
|
+ /*boolean isA为true进行添加,为false进行修改*/
|
|
189
|
+ if (0 == type && 1 == faceNum) {
|
|
190
|
+ if (null == data) {
|
|
191
|
+ log.error("未得到,海康数据反馈!");
|
|
192
|
+ throw new WisdomException(ResponseErrorsMessages.NOT_PUSH_FACE.getCode(), ResponseErrorsMessages.NOT_PUSH_FACE.getMsg());
|
|
193
|
+ }
|
|
194
|
+ if (isA) {
|
|
195
|
+ taFaceMapper.insert(taFace);
|
|
196
|
+ } else {
|
|
197
|
+ taFaceMapper.updateById(taFace);
|
|
198
|
+ }
|
|
199
|
+ responseBean.addSuccess("操作成功");
|
|
200
|
+
|
|
201
|
+ // 设备树
|
|
202
|
+ TpEquipmentTree tpEquipmentTree = tpEquipmentTreeMapper.selectByCommunityId(communityId);
|
|
203
|
+ // 所有设备
|
|
204
|
+ List<TpEquipment> tpEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitId(communityId, unitId, 4);
|
|
205
|
+ List<Map<String, Object>> equipmentUUID = getEquipmentUUID(tpEquipments);
|
|
206
|
+ StringBuilder doorUuids = new StringBuilder();
|
|
207
|
+ StringBuilder deviceUuids = new StringBuilder();
|
|
208
|
+ equipmentUUID.forEach(e-> {
|
|
209
|
+ doorUuids.append(e.get("doorUuid"));
|
|
210
|
+ doorUuids.append(",");
|
|
211
|
+ deviceUuids.append(e.get("deviceUuid"));
|
|
212
|
+ deviceUuids.append(",");
|
|
213
|
+ });
|
|
214
|
+ Map<String,Object> map = Maps.newHashMap();
|
|
215
|
+ map.put("appkey", tpEquipmentTree.getAppkey());
|
|
216
|
+ map.put("opUserUuid", tpEquipmentTree.getOpUserUuid());
|
|
217
|
+ map.put("personIds", String.valueOf(user.getHkUserId()));
|
|
218
|
+ map.put("deviceUuids", deviceUuids.substring(0, deviceUuids.lastIndexOf(",")));
|
|
219
|
+ map.put("type", 1);
|
|
220
|
+ map.put("openapi_ip_port_http", tpEquipmentTree.getHttpServer());
|
|
221
|
+ HKOpenApi.downloadFaceAndFingerInfos(map);
|
|
222
|
+
|
|
223
|
+ //可视对讲时 指定人员人脸权限下载
|
|
224
|
+ List<Integer> userIdList = new ArrayList<>();
|
|
225
|
+ userIdList.add(user.getHkUserId());
|
|
226
|
+ //临时设备编号
|
|
227
|
+ // TODO 根据期楼栋号,来查询出门口机
|
|
228
|
+
|
|
229
|
+ // 单元门口机
|
|
230
|
+ List<TpEquipment> visualEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitId(communityId, unitId, 3);
|
|
231
|
+ List<String> visualList = visualEquipments.stream()
|
|
232
|
+ .map(e-> tpConfigurationMapper.selectById(e.getUuidId()).getConfigurationValue())
|
|
233
|
+ .collect(Collectors.toList());
|
|
234
|
+// List<String> visualList = new ArrayList<>();
|
|
235
|
+// visualList.add("10010100000");
|
|
236
|
+ HKOpenApi.visualIntercom(tpEquipmentTree.getOpUserUuid(), 1, userIdList, visualList, tpEquipmentTree.getAppkey(), tpEquipmentTree.getSecret(), tpEquipmentTree.getHttpServer());
|
|
237
|
+ } else {
|
|
238
|
+ responseBean.addError("请录入正确图片");
|
|
239
|
+ }
|
|
240
|
+ } catch (Exception e) {
|
|
241
|
+ e.printStackTrace();
|
|
242
|
+ log.error("海康人脸推送失敗! {}", e);
|
|
243
|
+ throw new RuntimeException("海康人脸推送失敗!");
|
|
244
|
+ }
|
|
245
|
+ return responseBean;
|
|
246
|
+ }
|
|
247
|
+
|
|
248
|
+ /**
|
|
249
|
+ * 获取设备UUID
|
|
250
|
+ * @param equipmentList
|
|
251
|
+ * @return
|
|
252
|
+ */
|
|
253
|
+ private List<Map<String,Object>> getEquipmentUUID(List<TpEquipment> equipmentList) {
|
|
254
|
+ return equipmentList.stream().map(equipment -> {
|
|
255
|
+ TpConfiguration tpConfiguration = tpConfigurationMapper.selectById(equipment.getUuidId());
|
|
256
|
+ Map<String,Object> map = Maps.newHashMap();
|
|
257
|
+ map.put("doorUuid", tpConfiguration.getDoorUuid());
|
|
258
|
+ map.put("deviceUuid", tpConfiguration.getDeviceUuid());
|
|
259
|
+ return map;
|
|
260
|
+ }).collect(Collectors.toList());
|
|
261
|
+ }
|
|
262
|
+
|
|
263
|
+ /**
|
|
264
|
+ * 当前登入人是否有人脸信息
|
|
265
|
+ */
|
|
266
|
+ @Override
|
|
267
|
+ public ResponseBean getTaFaceByUserId(UserElement userElement, Integer otherUserId) {
|
|
268
|
+ ResponseBean responseBean = new ResponseBean();
|
|
269
|
+ Integer userVerifyId = userElement.getUserVerifyId();
|
|
270
|
+
|
|
271
|
+ /**当otherUserId不为空时判断它是否是业主下的租客或者家属*/
|
|
272
|
+ if (null != otherUserId) {
|
|
273
|
+ TaUserVerify userVerify = getTaFaceParentId(userElement, otherUserId);
|
|
274
|
+ userVerifyId = userVerify.getUserVerifyId();
|
|
275
|
+ }
|
|
276
|
+ TaFace face = taFaceMapper.getByUserVerifyId(userVerifyId);
|
|
277
|
+ if (null != face) {
|
|
278
|
+ responseBean.addSuccess(face);
|
|
279
|
+ return responseBean;
|
|
280
|
+ }
|
|
281
|
+ responseBean.addError("当前用户暂无人脸图片");
|
|
282
|
+ return responseBean;
|
|
283
|
+
|
|
284
|
+ }
|
|
285
|
+
|
|
286
|
+ /**
|
|
287
|
+ * 判断当前用户下的人员关系(家属,租客)
|
|
288
|
+ */
|
|
289
|
+ public TaUserVerify getTaFaceParentId(UserElement userElement, Integer otherUserId) {
|
|
290
|
+ // 根据 家属/租客 的id, 和 当前的房产信息进行查询是否有值,有值就说明是 家属/租客
|
|
291
|
+ List<TaUserVerify> todUserVerify = taUserVerifyMapper.selectCommunityAndAddressAndVerifyStatus(otherUserId, userElement.getCommunityId(), userElement.getPhaseId(), userElement.getBuildingId(), userElement.getUnitId(), userElement.getLevelId(), userElement.getRoomNoId(), 1);
|
|
292
|
+ // 判断 家属或者租客 属不属于这个业主的下面
|
|
293
|
+ if (null == todUserVerify || todUserVerify.size() == 0) {
|
|
294
|
+ throw new WisdomException("您输入的家属或租户ID有误或审核未通过!");
|
|
295
|
+ }
|
|
296
|
+// if (!Constant.VERIFY_STATUS.equals(todUserVerify.get(0).getVerifyStatus())) {
|
|
297
|
+// throw new WisdomException("用户房产审核未通过!");
|
|
298
|
+// }
|
|
299
|
+
|
|
300
|
+ return todUserVerify.get(0);
|
|
301
|
+ }
|
|
302
|
+
|
|
303
|
+ /**
|
|
304
|
+ * 得到当前图片
|
|
305
|
+ */
|
|
306
|
+ private String img(MultipartFile uploadFile) {
|
|
307
|
+ String faceImg = null;
|
|
308
|
+ try {
|
|
309
|
+ faceImg = imageServiceI.getImageUrl(uploadFile);
|
|
310
|
+ } catch (IOException e) {
|
|
311
|
+ e.printStackTrace();
|
|
312
|
+ }
|
|
313
|
+ return faceImg;
|
|
314
|
+ }
|
|
315
|
+
|
|
316
|
+ /**
|
|
317
|
+ * 各种身份校验
|
|
318
|
+ */
|
|
319
|
+ public ResponseBean addVerify(Integer userid, Integer userVerifyId, MultipartFile uploadFile, String faceImg, TaFace taFace, TpEquipmentTree tpEquipmentTree) {
|
|
320
|
+ ResponseBean response = new ResponseBean();
|
|
321
|
+
|
|
322
|
+ TaUserVerify userVerify = taUserVerifyMapper.selectById(userVerifyId);
|
|
323
|
+ if (null == userVerify) {
|
|
324
|
+ response.addError("当前房产审核记录不存在!");
|
|
325
|
+ return response;
|
|
326
|
+ }
|
|
327
|
+ TaUser taUser = taUserMapper.selectById(userid);
|
|
328
|
+
|
|
329
|
+ //身份为家属租客,状态为已停用
|
|
330
|
+ if (null != taUser && !Constant.EFFECTIVE_STATUS.equals(taUser.getStatus())) {
|
|
331
|
+ response.addError("9996", "您的身份已停用,请联系物业");
|
|
332
|
+ return response;
|
|
333
|
+ }
|
|
334
|
+
|
|
335
|
+ //查询当前用户是否有人脸记录
|
|
336
|
+ TaFace face = taFaceMapper.getByUserVerifyId(userVerifyId);
|
|
337
|
+ if (null == face) {
|
|
338
|
+ boolean isA = true;
|
|
339
|
+ if (Constant.EFFECTIVE_STATUS.equals(taUser.getStatus())) {
|
|
340
|
+ ResponseBean responseBean = checKout(faceImg, taFace, isA, uploadFile, userid, userVerify.getCommunityId(), userVerify.getRoomNoId(), userVerify.getUnitId(),tpEquipmentTree.getAppkey(), tpEquipmentTree.getSecret(), tpEquipmentTree.getHttpServer());
|
|
341
|
+ if (responseBean.getCode().equals("0")) {
|
|
342
|
+ responseBean.addSuccess("图片录入成功");
|
|
343
|
+ } else {
|
|
344
|
+ responseBean.addError(responseBean.getMessage());
|
|
345
|
+ }
|
|
346
|
+ return responseBean;
|
|
347
|
+ }
|
|
348
|
+ }
|
|
349
|
+ response.addError("您的信息已存在");
|
|
350
|
+ return response;
|
|
351
|
+ }
|
|
352
|
+
|
|
353
|
+ @Override
|
|
354
|
+ public ResponseBean deleteFace(UserElement userElement, Integer otherUserId, Integer verifyId) {
|
|
355
|
+ ResponseBean responseBean= new ResponseBean();
|
|
356
|
+ TaUserVerify taUserVerify= infoExist(userElement.getUserVerifyId());
|
|
357
|
+ if (null ==taUserVerify) {
|
|
358
|
+ responseBean.addError("房产审核未通过");
|
|
359
|
+ return responseBean;
|
|
360
|
+ }
|
|
361
|
+ TaUser taUser = taUserMapper.selectById(taUserVerify.getUserId());
|
|
362
|
+
|
|
363
|
+ // 设备树
|
|
364
|
+ TpEquipmentTree tpEquipmentTree = tpEquipmentTreeMapper.selectByCommunityId(taUserVerify.getCommunityId());
|
|
365
|
+ // 所有设备
|
|
366
|
+ List<TpEquipment> tpEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitId(taUserVerify.getCommunityId(), taUserVerify.getUnitId(), 4);
|
|
367
|
+ List<Map<String, Object>> equipmentUUID = getEquipmentUUID(tpEquipments);
|
|
368
|
+ StringBuilder doorUuids = new StringBuilder();
|
|
369
|
+ StringBuilder deviceUuids = new StringBuilder();
|
|
370
|
+ equipmentUUID.forEach(e-> {
|
|
371
|
+ doorUuids.append(e.get("doorUuid"));
|
|
372
|
+ doorUuids.append(",");
|
|
373
|
+ deviceUuids.append(e.get("deviceUuid"));
|
|
374
|
+ deviceUuids.append(",");
|
|
375
|
+ });
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+ // TODO 删除人脸,是否删除海康
|
|
379
|
+ // 修改人脸(图片为null时。海康删除人脸)
|
|
380
|
+// HKOpenApi.HKpersonGroupId(null, taUser.getHkUserId(), taUser.getHkPersonNo(), taUser.getUserName(), taUser.getHkCardNo(), tpEquipmentTree.getAppkey(), tpEquipmentTree.getSecret());
|
|
381
|
+ // 删除 权限
|
|
382
|
+ Map<String,Object> selectUserFaceMap = Maps.newHashMap();
|
|
383
|
+ selectUserFaceMap.put("personIds", taUser.getHkUserId()+"");
|
|
384
|
+ selectUserFaceMap.put("opUserUuid", tpEquipmentTree.getOpUserUuid());
|
|
385
|
+ selectUserFaceMap.put("appkey", tpEquipmentTree.getAppkey());
|
|
386
|
+ selectUserFaceMap.put("secret", tpEquipmentTree.getSecret());
|
|
387
|
+ selectUserFaceMap.put("openapi_ip_port_http", tpEquipmentTree.getHttpServer());
|
|
388
|
+ // 查询人脸信息
|
|
389
|
+ HKOpenApi.selectUserFace(selectUserFaceMap);
|
|
390
|
+
|
|
391
|
+ Map<String,Object> deleteUserMap = Maps.newHashMap();
|
|
392
|
+ deleteUserMap.put("personIds", taUser.getHkUserId()+"");
|
|
393
|
+ deleteUserMap.put("opUserUuid", tpEquipmentTree.getOpUserUuid());
|
|
394
|
+ deleteUserMap.put("doorUuids", doorUuids.substring(0, doorUuids.lastIndexOf(",")));
|
|
395
|
+ deleteUserMap.put("appkey", tpEquipmentTree.getAppkey());
|
|
396
|
+ deleteUserMap.put("secret", tpEquipmentTree.getSecret());
|
|
397
|
+ deleteUserMap.put("openapi_ip_port_http", tpEquipmentTree.getHttpServer());
|
|
398
|
+ // 删除当前人脸设备信息
|
|
399
|
+ String data= HKOpenApi.deleteUser(deleteUserMap);
|
|
400
|
+ JSONObject object= JSONObject.parseObject(data);
|
|
401
|
+
|
|
402
|
+ if (object.get("errorCode").equals(1)){
|
|
403
|
+ String errorMessage= object.getString("errorMessage");
|
|
404
|
+ responseBean.addError(errorMessage);
|
|
405
|
+ return responseBean;
|
|
406
|
+ }
|
|
407
|
+ Integer activeUser = otherUserId == null ? userElement.getUserVerifyId() : otherUserId;
|
|
408
|
+ taFaceMapper.deleteFace(activeUser);
|
|
409
|
+ // 异动同步到设备
|
|
410
|
+ Map<String,Object> appointJurisdictionMap = Maps.newHashMap();
|
|
411
|
+ appointJurisdictionMap.put("appkey", tpEquipmentTree.getAppkey());
|
|
412
|
+ appointJurisdictionMap.put("secret", tpEquipmentTree.getSecret());
|
|
413
|
+ appointJurisdictionMap.put("opUserUuid", tpEquipmentTree.getOpUserUuid());
|
|
414
|
+ appointJurisdictionMap.put("personIds", taUser.getHkUserId()+"" );
|
|
415
|
+ appointJurisdictionMap.put("doorUuids", doorUuids.substring(0, doorUuids.lastIndexOf(",")));
|
|
416
|
+ appointJurisdictionMap.put("operateType",3);
|
|
417
|
+ appointJurisdictionMap.put("includeFinger",0);
|
|
418
|
+ appointJurisdictionMap.put("openapi_ip_port_http", tpEquipmentTree.getHttpServer());
|
|
419
|
+
|
|
420
|
+ HKOpenApi.appointJurisdiction(appointJurisdictionMap);
|
|
421
|
+ // HKOpenApi.selectUserSynchronization();
|
|
422
|
+ // ihkService.downloadAuthorityByDeviceUuids();
|
|
423
|
+ return responseBean;
|
|
424
|
+
|
|
425
|
+ }
|
|
426
|
+
|
|
427
|
+ /*校验房产是否审核通过*/
|
|
428
|
+ public TaUserVerify infoExist(Integer verifyID){
|
|
429
|
+ /*查询当前的房产ID*/
|
|
430
|
+ TaUserVerify taUserVerify = null;
|
|
431
|
+ if (!"".equals(verifyID)) {
|
|
432
|
+ taUserVerify = taUserVerifyMapper.selectById(verifyID);
|
|
433
|
+ }
|
|
434
|
+ if (null!= taUserVerify && taUserVerify.getVerifyStatus().equals("1")) {
|
|
435
|
+ return taUserVerify;
|
|
436
|
+ }
|
|
437
|
+ return null;
|
|
438
|
+ }
|
|
439
|
+}
|
|
440
|
+
|
|
441
|
+
|