魏熙美 6 vuotta sitten
vanhempi
commit
4f0052e0e3

+ 7
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/HkController.java Näytä tiedosto

@@ -49,4 +49,11 @@ public class HkController {
49 49
 		responseBean = ihkService.pushPerson(appUserId);
50 50
 		return responseBean;
51 51
 	}
52
+
53
+	@RequestMapping(value = "/downloadAuthorityByDeviceUuids", method = RequestMethod.POST)
54
+	public ResponseBean pushHKPerson() {
55
+		ResponseBean responseBean = new ResponseBean();
56
+		responseBean = ihkService.downloadAuthorityByDeviceUuids();
57
+		return responseBean;
58
+	}
52 59
 }

+ 6
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/IHKService.java Näytä tiedosto

@@ -15,4 +15,10 @@ public interface IHKService {
15 15
      */
16 16
     ResponseBean pushPerson(String appUserId);
17 17
 
18
+    /**
19
+     * 下发门禁权限
20
+     * @return
21
+     */
22
+    ResponseBean downloadAuthorityByDeviceUuids();
23
+
18 24
 }

+ 3
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/FaceServicelimpl.java Näytä tiedosto

@@ -241,9 +241,9 @@ public class FaceServicelimpl implements FaceServiceI {
241 241
         if (null == todUserVerify || todUserVerify.size() == 0) {
242 242
             throw new WisdomException("您输入的家属或租户ID有误或审核未通过!");
243 243
         }
244
-        if (!Constant.VERIFY_STATUS.equals(todUserVerify.get(0).getVerifyStatus())) {
245
-            throw new WisdomException("用户房产审核未通过!");
246
-        }
244
+//        if (!Constant.VERIFY_STATUS.equals(todUserVerify.get(0).getVerifyStatus())) {
245
+//            throw new WisdomException("用户房产审核未通过!");
246
+//        }
247 247
 
248 248
         return todUserVerify.get(0);
249 249
     }

+ 10
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/HKServiceImpl.java Näytä tiedosto

@@ -65,7 +65,7 @@ public class HKServiceImpl implements IHKService {
65 65
         HKOpenApi.addAuthoritiesByPersonIds(String.valueOf(user.getHkUserId()));
66 66
 
67 67
         // 下发门禁权限
68
-        HKOpenApi.downloadAuthorityByDeviceUuids();
68
+        downloadAuthorityByDeviceUuids();
69 69
 
70 70
         //--------- 可视对讲 ----------
71 71
         visualIntercom(user);
@@ -76,6 +76,15 @@ public class HKServiceImpl implements IHKService {
76 76
         throw new WisdomException("操作失败!");
77 77
     }
78 78
 
79
+    @Override
80
+    public ResponseBean downloadAuthorityByDeviceUuids() {
81
+        ResponseBean responseBean = new ResponseBean();
82
+        // 下发门禁权限
83
+        HKOpenApi.downloadAuthorityByDeviceUuids();
84
+        responseBean.addSuccess("操作成功!");
85
+        return responseBean;
86
+    }
87
+
79 88
     /**
80 89
      * 公共方法
81 90
      * 添加人员, 开卡

+ 5
- 0
CODE/smart-community/community-common/src/main/java/com/community/commom/hk/HKConstant.java Näytä tiedosto

@@ -124,6 +124,11 @@ public class HKConstant {
124 124
      */
125 125
     public static final String ITF_SELECT_USER ="/openapi/service/acs/auth/getAuthoritiesByPersonIds";
126 126
 
127
+    /**
128
+     * 人员异动
129
+     */
130
+    public static final String ITF_SELECT_USER_SDH="/openapi/service/acs/auth/downloadAuthorityByDeviceUuids";
131
+
127 132
     /**
128 133
      * 删除人员设备
129 134
      */

+ 36
- 7
CODE/smart-community/community-common/src/main/java/com/community/commom/hk/HKOpenApi.java Näytä tiedosto

@@ -498,7 +498,9 @@ public class HKOpenApi {
498 498
     public static String HKpersonGroupId(MultipartFile faceImg,Integer personId,Long personNo,String personName,String cardNo) {
499 499
         byte [] fileByte = new byte[0];
500 500
         try {
501
-            fileByte = faceImg.getBytes();
501
+            if (null!=faceImg) {
502
+                fileByte = faceImg.getBytes();
503
+            }
502 504
         } catch (IOException e) {
503 505
             e.printStackTrace();
504 506
         }
@@ -979,7 +981,7 @@ public class HKOpenApi {
979 981
         //设置时间参数
980 982
         parMap.put("time", System.currentTimeMillis());
981 983
         parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
982
-        parMap.put("personIds",2301+"");
984
+        parMap.put("personIds",opUserUuid+"");
983 985
         parMap.put("doorUuids","91b8ce635b634d468cde925af6e4274c,d40b23e316364bb5a276b99bb6327181,7f866e918ab8452f9eb1d8a25e481530,8b8256fc605d428c9dc797451e3dc432,84d619c5e84942f68047f0bca93fc041");
984 986
         String params =  JSON.toJSONString(parMap);
985 987
         log.info("删除人脸 请求参数:{}", params);
@@ -989,12 +991,12 @@ public class HKOpenApi {
989 991
             log.info("删除人脸 请求返回结果:{}",data);
990 992
         } catch (Exception e) {
991 993
             e.printStackTrace();
992
-            log.error("删除人脸失败!",e);
993
-            throw new RuntimeException("删除人脸失败!");
994
+            log.error("删除人脸失败!",e);
995
+            throw new RuntimeException("删除人脸失败!");
994 996
         }
995 997
         return data;
996 998
     }
997
-        // 查询当前人脸设备信息---(没通)
999
+        // 查询当前人脸设备信息
998 1000
     public static String selectUserFace(Integer opUserUuid) {
999 1001
         String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_SELECT_USER;
1000 1002
         Map<String, Object> parMap = new HashMap<String, Object>();
@@ -1002,8 +1004,8 @@ public class HKOpenApi {
1002 1004
         parMap.put("appkey", HKConstant.APPKEY);
1003 1005
         //设置时间参数
1004 1006
         parMap.put("time", System.currentTimeMillis());
1005
-        parMap.put("pageNo","1");
1006
-        parMap.put("pageSize","100");
1007
+        parMap.put("pageNo",1);
1008
+        parMap.put("pageSize",100);
1007 1009
         parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
1008 1010
         parMap.put("personIds",opUserUuid+"");
1009 1011
         String params =  JSON.toJSONString(parMap);
@@ -1020,4 +1022,31 @@ public class HKOpenApi {
1020 1022
         return data;
1021 1023
     }
1022 1024
 
1025
+    /**
1026
+     * 人员异动(同步硬件)
1027
+     * @return
1028
+     */
1029
+    public static String selectUserSynchronization() {
1030
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_SELECT_USER_SDH;
1031
+        Map<String, Object> parMap = new HashMap<String, Object>();
1032
+        //设置APPKEY
1033
+        parMap.put("appkey", HKConstant.APPKEY);
1034
+        //设置时间参数
1035
+        parMap.put("time", System.currentTimeMillis());
1036
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
1037
+        parMap.put("deviceUuids","91b8ce635b634d468cde925af6e4274c,d40b23e316364bb5a276b99bb6327181,7f866e918ab8452f9eb1d8a25e481530,8b8256fc605d428c9dc797451e3dc432,84d619c5e84942f68047f0bca93fc041");
1038
+        String params =  JSON.toJSONString(parMap);
1039
+        log.info("人员异动 请求参数:{}", params);
1040
+        String data = null;
1041
+        try {
1042
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
1043
+            log.info("人员异动 请求返回结果:{}",data);
1044
+        } catch (Exception e) {
1045
+            e.printStackTrace();
1046
+            log.error("人员异动失败!",e);
1047
+            throw new RuntimeException("人员异动失败!");
1048
+        }
1049
+        return data;
1050
+    }
1051
+
1023 1052
 }

+ 5
- 6
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/BuildingTreeController.java Näytä tiedosto

@@ -49,11 +49,11 @@ public class BuildingTreeController extends BaseController {
49 49
 	@GetMapping(value = "/trees")
50 50
 	@ApiImplicitParams({
51 51
 			@ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token"),
52
-			@ApiImplicitParam(paramType = "query", dataTypeClass = String.class, name = "id", value = "当前节点id(查期时ID为空)")
52
+			@ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "id", value = "当前节点id(查期时ID为空)"),
53
+			@ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "treeType", value = "phase:(期),building:(栋),unit:(单元),level:(楼层),roomNo:(房间号)")
53 54
 	})
54 55
 	public ResponseBean getTreeList(@RequestParam(value = "id", required = false) Integer id,@RequestParam("treeType") String treeType,HttpSession session){
55
-		ResponseBean responseBean = new ResponseBean();
56
-		UserElement userElement = getUserElement(session);
56
+		ResponseBean responseBean = new ResponseBean();UserElement userElement = getUserElement(session);
57 57
 
58 58
 		responseBean = buildingTreeService.getTreeList(userElement.getCommunityId(),id,treeType);
59 59
 		return responseBean;
@@ -62,7 +62,7 @@ public class BuildingTreeController extends BaseController {
62 62
 	@ApiOperation(value = "添加当前节点", notes = "添加当前节点")
63 63
 	@ApiImplicitParams({
64 64
 			@ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter", value = "id:当前节点;" +
65
-					"name:节点名称;type:类型,nodeNumber:输入的节点")
65
+					"name:节点名称;type:(phase:(期),building:(栋),unit:(单元),level:(楼层),roomNo:(房间号)), roomNonodeNumber:输入的节点")
66 66
 	})
67 67
 	@RequestMapping(value = "/addnode",method = RequestMethod.POST)
68 68
 	public ResponseBean addNode(@RequestBody String parameter, HttpSession session){
@@ -73,8 +73,7 @@ public class BuildingTreeController extends BaseController {
73 73
 
74 74
 	@ApiOperation(value = "删除当前节点", notes = "删除当前节点")
75 75
 	@ApiImplicitParams({
76
-			@ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter", value = "id:当前节点;" +
77
-					"name:节点名称;type:类型,nodeNumber:输入的节点")
76
+			@ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter", value = "id:当前节点;type:(end:(房间),roomNo:(楼层),level:(单元),unit:(楼栋),building:(期))")
78 77
 	})
79 78
 	@RequestMapping(value = "/deletenode",method = RequestMethod.POST)
80 79
 	public ResponseBean deletenode(@RequestBody String parameter, HttpSession session){

+ 8
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/feign/TaUserFeignService.java Näytä tiedosto

@@ -30,4 +30,12 @@ public interface TaUserFeignService {
30 30
     @RequestMapping(value = "/pushHKPerson/{appUserId}", method = RequestMethod.POST)
31 31
     ResponseBean pushHKPerson(@PathVariable("appUserId") Integer appUserId);
32 32
 
33
+    /**
34
+     * 异动下载门禁权限
35
+     * @return
36
+     */
37
+    @RequestMapping(value = "/downloadAuthorityByDeviceUuids", method = RequestMethod.POST)
38
+    ResponseBean downloadAuthorityByDeviceUuids();
39
+
40
+
33 41
 }

+ 5
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/feign/impl/TaUserFeignFallBack.java Näytä tiedosto

@@ -17,6 +17,11 @@ public class TaUserFeignFallBack implements TaUserFeignService {
17 17
         return back();
18 18
     }
19 19
 
20
+    @Override
21
+    public ResponseBean downloadAuthorityByDeviceUuids() {
22
+        return back();
23
+    }
24
+
20 25
     private ResponseBean back() {
21 26
         log.error("app-api 远端服务请求失败!");
22 27
         ResponseBean responseBean = new ResponseBean();

+ 0
- 3
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BuildingTreeServiceImpl.java Näytä tiedosto

@@ -294,7 +294,6 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
294 294
 		 //当前输入的节点内容
295 295
 		 String nodeNumber= object.getString("nodeNumber");
296 296
 
297
-		//楼栋
298 297
 		/*查询出期*/
299 298
 		if(type.equals("phase")) {
300 299
 			//是否存在同样的名字
@@ -333,7 +332,6 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
333 332
 						 .setCreateDate(LocalDateTime.now());
334 333
 			tpBuildingMapper.insert(tpBuilding);
335 334
 		}
336
-		//单元
337 335
 		//查询栋,维护单元
338 336
 		 TpBuilding selectTpBuilding= tpBuildingMapper.selectById(id);
339 337
 		if (type.equals("unit")){
@@ -359,7 +357,6 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
359 357
 		 	 tpUnitMapper.insert(tpUnit);
360 358
 		 }
361 359
 
362
-		//楼层
363 360
 		//查询单元,维护楼层
364 361
 		 TpUnit selectTpUnit= tpUnitMapper.selectById(id);
365 362
 		if(type.equals("level")){

+ 22
- 3
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/FaceServicelimpl.java Näytä tiedosto

@@ -13,6 +13,7 @@ import com.community.huiju.dao.TaSysRoleMapper;
13 13
 import com.community.huiju.dao.TaUserMapper;
14 14
 import com.community.huiju.dao.TaUserVerifyMapper;
15 15
 import com.community.huiju.exception.WisdomException;
16
+import com.community.huiju.feign.TaUserFeignService;
16 17
 import com.community.huiju.model.TaFace;
17 18
 import com.community.huiju.model.TaUser;
18 19
 import com.community.huiju.model.TaUserVerify;
@@ -59,6 +60,9 @@ public class FaceServicelimpl implements FaceServiceI {
59 60
     @Autowired
60 61
     private TaUserVerifyMapper taUserVerifyMapper;
61 62
 
63
+    @Autowired
64
+    private TaUserFeignService taUserFeignService;
65
+
62 66
     @Override
63 67
     @Transactional(rollbackFor = Exception.class)
64 68
     public ResponseBean addFace(UserElement userElement, MultipartFile uploadFile, Integer otherUserId,String phaseName,String buildingName,String unitName,String levelName,String roomNoName) {
@@ -201,12 +205,26 @@ public class FaceServicelimpl implements FaceServiceI {
201 205
 
202 206
     @Override
203 207
     public ResponseBean deleteFace(Integer otherUserId, String phaseName, String buildingName, String unitName, String levelName, String roomNoName) {
208
+        ResponseBean responseBean= new ResponseBean();
204 209
         TaUserVerify taUserVerify= infoExist(phaseName,buildingName,unitName,levelName, roomNoName,otherUserId);
205 210
         TaUser taUser= taUserMapper.selectById(taUserVerify.getUserId());
211
+
206 212
         // TODO 删除人脸,是否删除海康
207
-//        HKOpenApi.selectUser(taUser.getHkUserId());
208
-        HKOpenApi.deleteUser(taUser.getHkUserId());
209
-        return null;
213
+        // 修改人脸(图片为null时。海康删除人脸)
214
+        HKOpenApi.HKpersonGroupId(null, taUser.getHkUserId(), taUser.getHkPersonNo(), taUser.getUserName(), taUser.getHkCardNo());
215
+       // 删除 权限
216
+        HKOpenApi.selectUserFace(taUser.getHkUserId());
217
+        String data= HKOpenApi.deleteUser(taUser.getHkUserId());
218
+        JSONObject object= JSONObject.parseObject(data);
219
+        if (object.get("errorCode").equals(1)){
220
+            String errorMessage=  object.getString("errorMessage");
221
+            responseBean.addError(errorMessage);
222
+            return responseBean;
223
+        }
224
+        // 异动同步到设备
225
+         // HKOpenApi.selectUserSynchronization();
226
+        taUserFeignService.downloadAuthorityByDeviceUuids();
227
+        return responseBean;
210 228
     }
211 229
 
212 230
     /**
@@ -246,6 +264,7 @@ public class FaceServicelimpl implements FaceServiceI {
246 264
         TaUserVerify taUserVerify= taUserVerifyMapper.selectOne(queryTaUserVerify);
247 265
         return taUserVerify;
248 266
     }
267
+
249 268
 }
250 269
 
251 270