魏熙美 6 lat temu
rodzic
commit
f7a9dd2f2e

+ 6
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaUserHkMapper.java Wyświetl plik

@@ -6,6 +6,8 @@ import org.apache.ibatis.annotations.Param;
6 6
 import org.apache.ibatis.annotations.ResultMap;
7 7
 import org.apache.ibatis.annotations.Select;
8 8
 
9
+import java.util.List;
10
+
9 11
 @Mapper
10 12
 public interface TaUserHkMapper {
11 13
     int deleteByPrimaryKey(Integer id);
@@ -24,4 +26,8 @@ public interface TaUserHkMapper {
24 26
     @Select("select * from ta_user_hk where ta_user_id = #{userVerifyId} and community_id = #{communityId}")
25 27
     TaUserHk selectByUserVerifyIdAndCommunityId(@Param("userVerifyId") Integer userVerifyId, @Param("communityId") Integer communityId);
26 28
 
29
+    @ResultMap("BaseResultMap")
30
+    @Select("select * from ta_user_hk where community_id = #{communityId}")
31
+    List<TaUserHk> selectByCommunityId(@Param("communityId") Integer communityId);
32
+
27 33
 }

+ 34
- 6
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaUserVerifyMapper.java Wyświetl plik

@@ -100,7 +100,7 @@ public interface TaUserVerifyMapper {
100 100
 
101 101
     @ResultMap("BaseResultMap")
102 102
     @Select("select * from ta_user_verify where community_id=#{communityId}" +
103
-            " and verify_status =  1")
103
+            " and verify_status =  1 and id in (1120,1122,1128,1133,1134,1119)")
104 104
     List<TaUserVerify> selectByCommunityId(@Param("communityId") Integer communityId);
105 105
 
106 106
 
@@ -111,9 +111,13 @@ public interface TaUserVerifyMapper {
111 111
      */
112 112
     @ResultMap("BaseResultMap")
113 113
     @Select(
114
-            "SELECT *  " + "FROM " +
115
-            "ta_user_verify " +
116
-            "WHERE  id NOT IN (" +
114
+            "SELECT *  FROM " +
115
+            "ta_user_verify uv " +
116
+            "WHERE   uv.verify_status = \"1\" " +
117
+             "and " +
118
+               "uv.community_id = #{communityId} " +
119
+             "and " +
120
+              "uv.id NOT IN (" +
117 121
                 "SELECT " +
118 122
                     "tuv.id  " +
119 123
                 "FROM " +
@@ -121,7 +125,7 @@ public interface TaUserVerifyMapper {
121 125
                 "WHERE " +
122 126
                     "tm.uuid_type = \"1\" " +
123 127
                     "AND tuv.verify_status = \"1\" " +
124
-                    "AND tuv.community_id = 107 " +
128
+                    "AND tuv.community_id = #{communityId} " +
125 129
                     "AND tm.message_type = \"9\" " +
126 130
                     "AND tm.advice_type = \"1\" " +
127 131
                     "AND tm.model_type = \"1\" " +
@@ -131,6 +135,30 @@ public interface TaUserVerifyMapper {
131 135
                 "tuv.id  " +
132 136
             ") "
133 137
     )
134
-    List<TaUserVerify> selectNotMessage(Integer communityId);
138
+    List<TaUserVerify> selectNotMessage(@Param("communityId") Integer communityId);
135 139
 
140
+    /**
141
+     * 查询 这个审核id 是否已经推送过消息
142
+     * @param communityId
143
+     * @param userVerfiyId
144
+     */
145
+    @ResultMap("BaseResultMap")
146
+    @Select("SELECT " +
147
+            "* " +
148
+            "FROM " +
149
+            "ta_user_verify tuv " +
150
+            "LEFT JOIN tp_message tm ON tuv.id = tm.uuid  " +
151
+            "WHERE " +
152
+            "tm.uuid_type = \"1\"  " +
153
+            "AND tuv.verify_status = \"1\"  " +
154
+            "AND tuv.community_id = #{communityId}  " +
155
+            "AND tm.message_type = \"9\"  " +
156
+            "AND tm.advice_type = \"1\"  " +
157
+            "AND tm.model_type = \"1\"  " +
158
+            "AND tm.source = \"1\"  " +
159
+            "AND tm.`status` = \"1\"  " +
160
+            "and tm.uuid = #{userVerfiyId} " +
161
+            "GROUP BY " +
162
+            "tuv.id ")
163
+    TaUserVerify selectChcekNotMessage(@Param("communityId") Integer communityId, @Param("userVerfiyId") Integer userVerfiyId);
136 164
 }

+ 1
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaUserVerify.java Wyświetl plik

@@ -264,4 +264,5 @@ public class TaUserVerify {
264 264
     public void setLoginName(String loginName) {
265 265
         this.loginName = loginName;
266 266
     }
267
+
267 268
 }

+ 13
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/IHKService.java Wyświetl plik

@@ -23,6 +23,11 @@ public interface IHKService {
23 23
      */
24 24
     ResponseBean addAuthoritiesAnddownloadAuthorityByPersonIds(TaUserVerify userVerify, TaUserHk taUserHk, TpEquipmentTree tpEquipmentTree);
25 25
 
26
+    /**
27
+     * 下发门禁人脸权限 指定人员人脸/指纹权限下载
28
+     * @return
29
+     */
30
+    ResponseBean downloadFaceAndFingerInfos(TpEquipmentTree tpEquipmentTree, TaUserVerify userVerify, TaUserHk taUserHk);
26 31
 
27 32
     /**
28 33
      * 下发门禁权限(异动方式)
@@ -43,4 +48,12 @@ public interface IHKService {
43 48
      * @return
44 49
      */
45 50
     ResponseBean visualIntercomPermissions(TpUnitHkSetting unitHkSetting, TpEquipmentTree tpEquipmentTree, TaUserHk taUserHk, TaUserVerify userVerify, TaUser user);
51
+
52
+    /**
53
+     * 可视对讲时 指定人员人脸权限下载
54
+     * @return
55
+     */
56
+    ResponseBean visualIntercom(TpEquipmentTree tpEquipmentTree, TaUserHk taUserHk, TaUserVerify userVerify);
57
+
58
+
46 59
 }

+ 7
- 44
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/FaceServicelimpl.java Wyświetl plik

@@ -252,6 +252,9 @@ public class FaceServicelimpl implements FaceServiceI {
252 252
                     // 下发可是对讲卡权限
253 253
                     ihkService.visualIntercomPermissions(unitHkSetting, tpEquipmentTree, taUserHk, userVerify, user);
254 254
 
255
+                    // 下发门禁权限
256
+                    ihkService.addAuthoritiesAnddownloadAuthorityByPersonIds(userVerify, taUserHk, tpEquipmentTree);
257
+
255 258
                     taFaceMapper.insertSelective(taFace);
256 259
                 } else {
257 260
                     taFaceMapper.updateByPrimaryKeySelective(taFace);
@@ -262,53 +265,13 @@ public class FaceServicelimpl implements FaceServiceI {
262 265
 
263 266
                 responseBean.addSuccess(taFace);
264 267
 
265
-
266
-                // 所有设备
267
-                // List<TpEquipment> tpEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitId(communityId, unitId, 4);
268
-                List<TpEquipment> tpEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitIdAndFace(tpEquipmentTree.getCommunityId(), userVerify.getUnitId(), 4);
269
-                if (CollectionUtils.isNotEmpty(tpEquipments)) {
270
-                    List<Map<String, Object>> equipmentUUID = getEquipmentUUID(tpEquipments);
271
-                    StringBuilder doorUuids = new StringBuilder();
272
-                    StringBuilder deviceUuids = new StringBuilder();
273
-                    equipmentUUID.forEach(e-> {
274
-                        doorUuids.append(e.get("doorUuid"));
275
-                        doorUuids.append(",");
276
-                        deviceUuids.append(e.get("deviceUuid"));
277
-                        deviceUuids.append(",");
278
-                    });
279
-                    if (StringUtils.isBlank(deviceUuids)) {
280
-                        responseBean.addError("系统未配置设备!");
281
-                        throw new WisdomException("系统未配置设备!");
282
-                    }
283
-                    Map<String,Object> map = Maps.newHashMap();
284
-                    map.put("appkey", tpEquipmentTree.getAppkey());
285
-                    map.put("opUserUuid", tpEquipmentTree.getOpUserUuid());
286
-                    map.put("personIds", String.valueOf(taUserHk.getHkUserId()));
287
-                    map.put("deviceUuids", deviceUuids.substring(0, deviceUuids.lastIndexOf(",")));
288
-                    map.put("type", 1);
289
-                    map.put("openapi_ip_port_http", tpEquipmentTree.getHttpServer());
290
-                    HKOpenApi.downloadFaceAndFingerInfos(map);
291
-
292
-
293
-                }
268
+                // 下发门禁人脸权限
269
+                ihkService.downloadFaceAndFingerInfos(tpEquipmentTree, userVerify, taUserHk);
294 270
 
295 271
 
296 272
                 //可视对讲时 指定人员人脸权限下载
297
-                List<Integer> userIdList = new ArrayList<>();
298
-                userIdList.add(taUserHk.getHkUserId());
299
-                //临时设备编号
300
-                // TODO 根据期楼栋号,来查询出门口机
301
-
302
-                // 单元门口机
303
-                List<TpEquipment> visualEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitId(tpEquipmentTree.getCommunityId(), userVerify.getUnitId(), 3);
304
-                if (CollectionUtils.isNotEmpty(visualEquipments)) {
305
-                    List<String> visualList = visualEquipments.stream()
306
-                            .map(e-> tpConfigurationMapper.selectByPrimaryKey(e.getUuidId()).getConfigurationValue())
307
-                            .collect(Collectors.toList());
308
-//                List<String> visualList = new ArrayList<>();
309
-//                visualList.add("10010100000");
310
-                    HKOpenApi.visualIntercom(tpEquipmentTree.getOpUserUuid(), 1, userIdList, visualList, tpEquipmentTree.getAppkey(), tpEquipmentTree.getSecret(), tpEquipmentTree.getHttpServer());
311
-                }
273
+                ihkService.visualIntercom(tpEquipmentTree, taUserHk, userVerify);
274
+
312 275
             } else {
313 276
                 responseBean.addError("请录入正确图片");
314 277
             }

+ 69
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/HKServiceImpl.java Wyświetl plik

@@ -179,6 +179,42 @@ public class HKServiceImpl implements IHKService {
179 179
         return responseBean;
180 180
     }
181 181
 
182
+    @Override
183
+    public ResponseBean downloadFaceAndFingerInfos(TpEquipmentTree tpEquipmentTree, TaUserVerify userVerify, TaUserHk taUserHk) {
184
+
185
+        ResponseBean responseBean = new ResponseBean();
186
+
187
+        // 所有设备
188
+        // List<TpEquipment> tpEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitId(communityId, unitId, 4);
189
+        List<TpEquipment> tpEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitIdAndFace(tpEquipmentTree.getCommunityId(), userVerify.getUnitId(), 4);
190
+        if (CollectionUtils.isNotEmpty(tpEquipments)) {
191
+            List<Map<String, Object>> equipmentUUID = getEquipmentUUID(tpEquipments);
192
+            StringBuilder doorUuids = new StringBuilder();
193
+            StringBuilder deviceUuids = new StringBuilder();
194
+            equipmentUUID.forEach(e-> {
195
+                doorUuids.append(e.get("doorUuid"));
196
+                doorUuids.append(",");
197
+                deviceUuids.append(e.get("deviceUuid"));
198
+                deviceUuids.append(",");
199
+            });
200
+            if (org.apache.commons.lang3.StringUtils.isBlank(deviceUuids)) {
201
+                responseBean.addError("系统未配置设备!");
202
+                throw new WisdomException("系统未配置设备!");
203
+            }
204
+            Map<String,Object> map = Maps.newHashMap();
205
+            map.put("appkey", tpEquipmentTree.getAppkey());
206
+            map.put("opUserUuid", tpEquipmentTree.getOpUserUuid());
207
+            map.put("personIds", String.valueOf(taUserHk.getHkUserId()));
208
+            map.put("deviceUuids", deviceUuids.substring(0, deviceUuids.lastIndexOf(",")));
209
+            map.put("type", 1);
210
+            map.put("openapi_ip_port_http", tpEquipmentTree.getHttpServer());
211
+            HKOpenApi.downloadFaceAndFingerInfos(map);
212
+
213
+        }
214
+
215
+        return responseBean;
216
+    }
217
+
182 218
     @Override
183 219
     @Deprecated
184 220
     public ResponseBean downloadAuthorityByDeviceUuids() {
@@ -523,4 +559,37 @@ public class HKServiceImpl implements IHKService {
523 559
         responseBean.addError("操作失败");
524 560
         throw new RuntimeException(addCardsJsonObject.getString("errorMessage"));
525 561
     }
562
+
563
+
564
+    @Override
565
+    public ResponseBean visualIntercom(TpEquipmentTree tpEquipmentTree, TaUserHk taUserHk, TaUserVerify userVerify) {
566
+
567
+        ResponseBean responseBean = new ResponseBean();
568
+
569
+        //可视对讲时 指定人员人脸权限下载
570
+        List<Integer> userIdList = new ArrayList<>();
571
+        userIdList.add(taUserHk.getHkUserId());
572
+        //临时设备编号
573
+        // TODO 根据期楼栋号,来查询出门口机
574
+
575
+        // 单元门口机
576
+        List<TpEquipment> visualEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitId(tpEquipmentTree.getCommunityId(), userVerify.getUnitId(), 3);
577
+        if (CollectionUtils.isNotEmpty(visualEquipments)) {
578
+            List<String> visualList = visualEquipments.stream()
579
+                    .map(e-> tpConfigurationMapper.selectByPrimaryKey(e.getUuidId()).getConfigurationValue())
580
+                    .collect(Collectors.toList());
581
+//                List<String> visualList = new ArrayList<>();
582
+//                visualList.add("10010100000");
583
+            String visualIntercomJSON = HKOpenApi.visualIntercom(tpEquipmentTree.getOpUserUuid(), 1, userIdList, visualList, tpEquipmentTree.getAppkey(), tpEquipmentTree.getSecret(), tpEquipmentTree.getHttpServer());
584
+            JSONObject addCardsJsonObject = JSONObject.parseObject(visualIntercomJSON);
585
+            Integer addCardsResultCode = addCardsJsonObject.getInteger("errorCode");
586
+            if (0 == addCardsResultCode.intValue()) {
587
+                responseBean.addSuccess("操作成功!");
588
+                return responseBean;
589
+            }
590
+
591
+        }
592
+
593
+        return responseBean;
594
+    }
526 595
 }

+ 166
- 63
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/userDataHKsiteImpl.java Wyświetl plik

@@ -1,6 +1,7 @@
1 1
 package com.community.huiju.service.impl;
2 2
 
3 3
 import com.alibaba.fastjson.JSONObject;
4
+import com.beust.jcommander.internal.Lists;
4 5
 import com.beust.jcommander.internal.Maps;
5 6
 import com.community.commom.hk.HKOpenApi;
6 7
 import com.community.commom.mode.ResponseBean;
@@ -9,6 +10,7 @@ import com.community.huiju.common.messagePush;
9 10
 import com.community.huiju.dao.*;
10 11
 import com.community.huiju.exception.WisdomException;
11 12
 import com.community.huiju.model.*;
13
+import com.community.huiju.service.IHKService;
12 14
 import com.community.huiju.service.userDataHKsiteI;
13 15
 import lombok.extern.slf4j.Slf4j;
14 16
 import org.springframework.beans.factory.annotation.Autowired;
@@ -30,7 +32,7 @@ import java.util.stream.Collectors;
30 32
 
31 33
 @Service
32 34
 @Slf4j
33
-@Transactional
35
+@Transactional(rollbackFor = Exception.class)
34 36
 public class userDataHKsiteImpl  implements userDataHKsiteI {
35 37
 
36 38
     @Autowired
@@ -64,27 +66,35 @@ public class userDataHKsiteImpl  implements userDataHKsiteI {
64 66
     @Autowired
65 67
     private TpMessageMapper tpMessageMapper;
66 68
 
69
+    @Autowired
70
+    private IHKService ihkService;
71
+
67 72
     @Override
68 73
     public ResponseBean cleanHKdata(Integer communityId) {
69 74
         ResponseBean responseBean = new ResponseBean();
70 75
         //根据小区id查询审核数据
71 76
         List<TaUserVerify> userVerifyList = taUserVerifyMapper.selectByCommunityId(communityId);
72 77
 
78
+        int i = 1;
73 79
         for (TaUserVerify taUserVerify : userVerifyList){
80
+            log.info("当前编号:{}, 人员审核id:{}", i, taUserVerify.getId());
74 81
             //重新构建海康和我们的关系
75
-            buildHKData(taUserVerify);
82
+            TaUserHk taUserHk = taUserHkMapper.selectByUserVerifyIdAndCommunityId(taUserVerify.getId(), taUserVerify.getCommunityId());
83
+            if (null == taUserHk) {
84
+                buildHKData(taUserVerify);
85
+            }
76 86
         }
77 87
 
78 88
         return responseBean;
79 89
     }
80 90
 
81 91
     private void buildHKData(TaUserVerify taUserVerify) {
82
-        //查询人脸信息
83
-        TaFace taFace = taFaceMapper.getByUserVerifyId(taUserVerify.getId());
84 92
 
85 93
         TaUserHk taUserHk = new TaUserHk();
86 94
         taUserHk.setHkPersonNo(idGen.nextId());
87 95
 
96
+        //查询人脸信息
97
+        TaFace taFace = taFaceMapper.getByUserVerifyId(taUserVerify.getId());
88 98
 
89 99
         TaUser taUser = taUserMapper.selectByPrimaryKey(taUserVerify.getUserId());
90 100
 
@@ -192,50 +202,72 @@ public class userDataHKsiteImpl  implements userDataHKsiteI {
192 202
             }
193 203
         }
194 204
 
195
-        //=================== 下发可是对讲卡权限 =====================
196
-
197
-        //--------- 可视对讲 ----------
198
-
199
-        Map<String,Object> addOutDoorAuthMap = Maps.newHashMap();
200
-        // app用户权限勿动 unitHkSetting.getPermissionId()
201
-        addOutDoorAuthMap.put("authName", taUser.getUserName()+taUserVerify.getId());
202
-        addOutDoorAuthMap.put("personIds", Arrays.asList(taUserHk.getHkUserId()));
203
-        addOutDoorAuthMap.put("secret", tpEquipmentTree.getSecret());
204
-        addOutDoorAuthMap.put("appkey", tpEquipmentTree.getAppkey());
205
-        addOutDoorAuthMap.put("openapi_ip_port_http", tpEquipmentTree.getHttpServer());
206
-        addOutDoorAuthMap.put("opUserUuid", tpEquipmentTree.getOpUserUuid());
207
-
208
-        // 单元门口机
209
-        List<TpEquipment> visualEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitId(taUserVerify.getCommunityId(), taUserVerify.getUnitId(), 3);
210
-        // 可是对讲设备号
211
-        List<String> visualList = visualEquipments.stream()
212
-                .map(e-> tpConfigurationMapper.selectByPrimaryKey(e.getUuidId()).getConfigurationValue())
213
-                .collect(Collectors.toList());
214
-
215
-        addOutDoorAuthMap.put("longNums", visualList); // visualList
216
-        // 可视对讲下发 权限
217
-         String addOutDoorAuthJSONString = HKOpenApi.addOutDoorAuth(addOutDoorAuthMap);
218
-        JSONObject addOutDoorAuthJSON = JSONObject.parseObject(addOutDoorAuthJSONString);
219
-        int addOutDoorAuthJSONCode = (int) addOutDoorAuthJSON.get("errorCode");
220
-        if (addOutDoorAuthJSONCode != 0 ) {
221
-            String errorMessage = String.valueOf(addOutDoorAuthJSON.get("errorMessage"));
222
-            log.error("可视对讲下发 权限失败! {}", errorMessage);
223
-            throw new RuntimeException(errorMessage);
224
-        }
205
+        // 存在人脸的时候才下发人脸 卡权限/人脸权限
206
+        if (null != taFace) {
207
+
208
+            //=================== 下发可是对讲卡权限 =====================
209
+
210
+            //--------- 可视对讲 ----------
211
+
212
+            Map<String,Object> addOutDoorAuthMap = Maps.newHashMap();
213
+            // app用户权限勿动 unitHkSetting.getPermissionId()
214
+            addOutDoorAuthMap.put("authName", taUser.getUserName()+taUserVerify.getId());
215
+            addOutDoorAuthMap.put("personIds", Arrays.asList(taUserHk.getHkUserId()));
216
+            addOutDoorAuthMap.put("secret", tpEquipmentTree.getSecret());
217
+            addOutDoorAuthMap.put("appkey", tpEquipmentTree.getAppkey());
218
+            addOutDoorAuthMap.put("openapi_ip_port_http", tpEquipmentTree.getHttpServer());
219
+            addOutDoorAuthMap.put("opUserUuid", tpEquipmentTree.getOpUserUuid());
220
+
221
+            // 单元门口机
222
+            List<TpEquipment> visualEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitId(taUserVerify.getCommunityId(), taUserVerify.getUnitId(), 3);
223
+            // 可是对讲设备号
224
+            List<String> visualList = visualEquipments.stream()
225
+                    .map(e-> tpConfigurationMapper.selectByPrimaryKey(e.getUuidId()).getConfigurationValue())
226
+                    .collect(Collectors.toList());
227
+
228
+            addOutDoorAuthMap.put("longNums", visualList); // visualList
229
+            // 可视对讲下发 权限
230
+            String addOutDoorAuthJSONString = HKOpenApi.addOutDoorAuth(addOutDoorAuthMap);
231
+            JSONObject addOutDoorAuthJSON = JSONObject.parseObject(addOutDoorAuthJSONString);
232
+            int addOutDoorAuthJSONCode = (int) addOutDoorAuthJSON.get("errorCode");
233
+            if (addOutDoorAuthJSONCode != 0 ) {
234
+                String errorMessage = String.valueOf(addOutDoorAuthJSON.get("errorMessage"));
235
+                log.error("可视对讲下发 权限失败! {}", errorMessage);
236
+                throw new RuntimeException(errorMessage);
237
+            }
238
+
239
+            try {
240
+                Thread.sleep(2000);
241
+            } catch (InterruptedException e) {
242
+                e.printStackTrace();
243
+            }
244
+
245
+
246
+            //================ 可是对讲人脸权限下发 ==============
247
+
248
+            // 可视对讲时 指定人员人脸权限下载
249
+            List<Integer> userIdList = new ArrayList<>();
250
+            userIdList.add(taUserHk.getHkUserId());
251
+
252
+            HKOpenApi.visualIntercom(tpEquipmentTree.getOpUserUuid(), 1, userIdList, visualList, tpEquipmentTree.getAppkey(), tpEquipmentTree.getSecret(), tpEquipmentTree.getHttpServer());
253
+
254
+
255
+            // 下发门禁权限
256
+            ihkService.addAuthoritiesAnddownloadAuthorityByPersonIds(taUserVerify, taUserHk, tpEquipmentTree);
257
+
258
+            // 下发门禁人脸
259
+            ihkService.downloadFaceAndFingerInfos(tpEquipmentTree, taUserVerify, taUserHk);
225 260
 
226
-        try {
227
-            Thread.sleep(2000);
228
-        } catch (InterruptedException e) {
229
-            e.printStackTrace();
230 261
         }
231 262
 
232
-         //================ 可是对讲人脸权限下发 ==============
233 263
 
234
-        // 可视对讲时 指定人员人脸权限下载
235
-        List<Integer> userIdList = new ArrayList<>();
236
-        userIdList.add(taUserHk.getHkUserId());
264
+        TaUserVerify tempVerify = taUserVerifyMapper.selectChcekNotMessage(tpEquipmentTree.getCommunityId(), taUserVerify.getId());
265
+        if (null == tempVerify) {
266
+            // 推送默认消息
267
+            sendMessage(taUserVerify);
268
+        }
269
+
237 270
 
238
-        HKOpenApi.visualIntercom(tpEquipmentTree.getOpUserUuid(), 1, userIdList, visualList, tpEquipmentTree.getAppkey(), tpEquipmentTree.getSecret(), tpEquipmentTree.getHttpServer());
239 271
     }
240 272
 
241 273
     /**
@@ -294,30 +326,101 @@ public class userDataHKsiteImpl  implements userDataHKsiteI {
294 326
 
295 327
         // 查询所有没有关联消息的审核数据
296 328
 
297
-        List<TaUserVerify> userVerifyList = taUserVerifyMapper.selectNotMessage(communityId);
329
+         List<TaUserVerify> userVerifyList = taUserVerifyMapper.selectNotMessage(communityId);
330
+         // TaUserVerify tempUserVerify = taUserVerifyMapper.selectByPrimaryKey(1151);
331
+         // List<TaUserVerify> userVerifyList = Lists.newArrayList(tempUserVerify);
298 332
         for (TaUserVerify userVerify : userVerifyList) {
333
+            TaUserVerify tempVerify = taUserVerifyMapper.selectChcekNotMessage(userVerify.getCommunityId(), userVerify.getId());
334
+            if (null == tempVerify) {
335
+                // 推送默认消息
336
+                sendMessage(userVerify);
337
+            }
338
+        }
339
+
340
+        return responseBean;
341
+    }
342
+
343
+    /**
344
+     * 给人员推送默认消息
345
+     * @param userVerify
346
+     */
347
+    private void sendMessage(TaUserVerify userVerify) {
348
+
349
+        //审核通过后推送消息(临时数据)
350
+        String[] messageArr= new messagePush().messagePushAll();
351
+        Date createDate = new Date();
352
+        for (String count:messageArr) {
353
+            TpMessage message = new TpMessage();
354
+            message.setCommunityId(userVerify.getCommunityId());
355
+            message.setMessageType("9");
356
+            message.setAdviceType("1");
357
+            message.setModelType("1");
358
+            message.setUuid(userVerify.getId());
359
+            message.setUuidType("1");
360
+            message.setSource("1");
361
+            message.setMessageContent(count);
362
+            message.setStatus("1");
363
+            message.setResult("");
364
+            message.setMeaasgeTypeId("");
365
+            message.setReadStatus("0");
366
+            message.setCreateUser(userVerify.getUserId());
367
+            message.setCreateDate(createDate);
368
+            tpMessageMapper.insert(message);
369
+        }
370
+    }
371
+
372
+    @Override
373
+    public ResponseBean cleanCardPersionHk(Integer communityId) {
374
+        ResponseBean responseBean = new ResponseBean();
375
+
376
+        //根据小区id查询审核数据
377
+        List<TaUserHk> taUserHkList = taUserHkMapper.selectByCommunityId(communityId);
378
+        for (TaUserHk taUserHk : taUserHkList) {
299 379
 
300
-            //审核通过后推送消息(临时数据)
301
-            String[] messageArr= new messagePush().messagePushAll();
302
-            for (String count:messageArr) {
303
-                TpMessage message = new TpMessage();
304
-                message.setCommunityId(userVerify.getCommunityId());
305
-                message.setMessageType("9");
306
-                message.setAdviceType("1");
307
-                message.setModelType("1");
308
-                message.setUuid(userVerify.getId());
309
-                message.setUuidType("1");
310
-                message.setSource("1");
311
-                message.setMessageContent(count);
312
-                message.setStatus("1");
313
-                message.setResult("");
314
-                message.setMeaasgeTypeId("");
315
-                message.setReadStatus("0");
316
-                message.setCreateUser(userVerify.getUserId());
317
-                message.setCreateDate(new Date());
318
-                tpMessageMapper.insert(message);
380
+            TaUserVerify userVerify = taUserVerifyMapper.selectByPrimaryKey(taUserHk.getTaUserId());
381
+            if (null == userVerify){
382
+                continue;
383
+            }
384
+            TaUser taUser = taUserMapper.selectByPrimaryKey(userVerify.getUserId());
385
+
386
+            // 海康权限信息
387
+            TpUnitHkSetting unitHkSetting = getUnitHkSetting(userVerify.getCommunityId(), userVerify.getUnitId());
388
+            TpEquipmentTree tpEquipmentTree = tpEquipmentTreeMapper.selectByCommunityId(userVerify.getCommunityId());
389
+
390
+            //--------- 可视对讲 ----------
391
+
392
+            Map<String,Object> addOutDoorAuthMap = Maps.newHashMap();
393
+            // app用户权限勿动 unitHkSetting.getPermissionId()
394
+            addOutDoorAuthMap.put("authName", taUser.getUserName()+userVerify.getId());
395
+            addOutDoorAuthMap.put("personIds", Arrays.asList(taUserHk.getHkUserId()));
396
+            addOutDoorAuthMap.put("secret", tpEquipmentTree.getSecret());
397
+            addOutDoorAuthMap.put("appkey", tpEquipmentTree.getAppkey());
398
+            addOutDoorAuthMap.put("openapi_ip_port_http", tpEquipmentTree.getHttpServer());
399
+            addOutDoorAuthMap.put("opUserUuid", tpEquipmentTree.getOpUserUuid());
400
+
401
+            // 单元门口机
402
+            List<TpEquipment> visualEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitId(userVerify.getCommunityId(), userVerify.getUnitId(), 3);
403
+            // 可是对讲设备号
404
+            List<String> visualList = visualEquipments.stream()
405
+                    .map(e-> tpConfigurationMapper.selectByPrimaryKey(e.getUuidId()).getConfigurationValue())
406
+                    .collect(Collectors.toList());
407
+
408
+            addOutDoorAuthMap.put("longNums", visualList); // visualList
409
+            // 可视对讲下发 权限
410
+            String addOutDoorAuthJSONString = HKOpenApi.addOutDoorAuth(addOutDoorAuthMap);
411
+            JSONObject addOutDoorAuthJSON = JSONObject.parseObject(addOutDoorAuthJSONString);
412
+            int addOutDoorAuthJSONCode = (int) addOutDoorAuthJSON.get("errorCode");
413
+            if (addOutDoorAuthJSONCode != 0 ) {
414
+                String errorMessage = String.valueOf(addOutDoorAuthJSON.get("errorMessage"));
415
+                log.error("可视对讲下发 权限失败! {}", errorMessage);
416
+                throw new RuntimeException(errorMessage);
319 417
             }
320 418
 
419
+            try {
420
+                Thread.sleep(2000);
421
+            } catch (InterruptedException e) {
422
+                e.printStackTrace();
423
+            }
321 424
         }
322 425
 
323 426
         return responseBean;

+ 7
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/userDataHKsiteI.java Wyświetl plik

@@ -11,4 +11,11 @@ public interface userDataHKsiteI {
11 11
      * @return
12 12
      */
13 13
     ResponseBean cleanMessage(Integer communityId);
14
+
15
+    /**
16
+     * 清洗数据,人员可是对讲卡权限下发
17
+     * @param communityId
18
+     * @return
19
+     */
20
+    ResponseBean cleanCardPersionHk(Integer communityId);
14 21
 }

+ 8
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/siteutil/userDataHKsite.java Wyświetl plik

@@ -51,4 +51,12 @@ public class userDataHKsite {
51 51
         return responseBean;
52 52
     }
53 53
 
54
+    @ApiOperation(value = "清洗人员可是对讲卡权限", notes = "清洗人员可是对讲卡权限")
55
+    @ApiImplicitParams({
56
+            @ApiImplicitParam(paramType = "path", dataType = "Integer", name = "communityId", value = "小区ID") })
57
+    @RequestMapping(value = "/site/permission/{communityId}",method = RequestMethod.GET)
58
+    public ResponseBean cleanCardPermissionHk(@PathVariable("communityId") Integer communityId){
59
+        ResponseBean responseBean = userDataHKsite.cleanCardPersionHk(communityId);
60
+        return responseBean;
61
+    }
54 62
 }

+ 1
- 1
CODE/smart-community/community-common/src/main/java/com/community/commom/hk/HKOpenApi.java Wyświetl plik

@@ -803,7 +803,7 @@ public class HKOpenApi {
803 803
             log.error("可视对讲人脸下发错误:{}", e);
804 804
             throw new RuntimeException("下发错误!");
805 805
         }
806
-        return null;
806
+        return data;
807 807
     }
808 808
     /**
809 809
      * 可视对讲 根据人员 ID 集添加权限并下发

+ 33
- 1
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BuildingOwnerInfoServiceImpl.java Wyświetl plik

@@ -598,8 +598,40 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
598 598
         tpBuildingOwnerInfo.setTaUserVerifyId(taUserVerify.getId());
599 599
 
600 600
         tpBuildingOwnerInfoMapper.insert(tpBuildingOwnerInfo);
601
+
602
+        // 推送消息
603
+        sendMessage(taUserVerify);
601 604
     }
602
-    
605
+
606
+    /**
607
+     * 给人员推送默认消息
608
+     * @param userVerify
609
+     */
610
+    private void sendMessage(TaUserVerify userVerify) {
611
+
612
+        //审核通过后推送消息(临时数据)
613
+        String[] messageArr= new messagePush().messagePushAll();
614
+        LocalDateTime localDateTime = LocalDateTime.now();
615
+        for (String count:messageArr) {
616
+            Message message = new Message();
617
+            message.setCommunityId(userVerify.getCommunityId());
618
+            message.setMessageType("9");
619
+            message.setAdviceType("1");
620
+            message.setModelType("1");
621
+            message.setUuid(userVerify.getId());
622
+            message.setUuidType("1");
623
+            message.setSource("1");
624
+            message.setMessageContent(count);
625
+            message.setStatus("1");
626
+            message.setResult("");
627
+            message.setMeaasgeTypeId("");
628
+            message.setReadStatus("0");
629
+            message.setCreateUser(userVerify.getUserId());
630
+            message.setCreateDate(localDateTime);
631
+            messageMapper.insert(message);
632
+        }
633
+    }
634
+
603 635
     @Override
604 636
     public ResponseBean updataApprove(String paramets) {
605 637
         ResponseBean response = new ResponseBean();