From 0e026a54cc7f0029a4997a94a2b7b84b33585d7c Mon Sep 17 00:00:00 2001 From: 张晓波 <bingbo1993@126.com> Date: 星期四, 19 十月 2023 10:49:45 +0800 Subject: [PATCH] 苏州配置文件简化 --- hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/service/impl/PlatUserServiceImpl.java | 58 ++++++++-------------------- hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/impl/FaceServerImpl.java | 5 ++ hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/FaceController.java | 11 +++++ hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/FaceServer.java | 2 + 4 files changed, 35 insertions(+), 41 deletions(-) diff --git a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/FaceController.java b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/FaceController.java index 189c337..9f08aa7 100644 --- a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/FaceController.java +++ b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/FaceController.java @@ -75,4 +75,15 @@ } + @RequestMapping("deleteNotify") + public JSONObject deleteNotify(@RequestBody String mess){ + faceServer.deleteNotify(mess); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("code",0); + jsonObject.put("msg","OK"); + jsonObject.put("success",true); + return jsonObject; + } + + } diff --git a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/FaceServer.java b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/FaceServer.java index efdb1a1..f161bb4 100644 --- a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/FaceServer.java +++ b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/FaceServer.java @@ -16,4 +16,6 @@ void record(String mess); void queryPer(String perId); + + void deleteNotify(String mess); } diff --git a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/impl/FaceServerImpl.java b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/impl/FaceServerImpl.java index c0f819b..d69dbd8 100644 --- a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/impl/FaceServerImpl.java +++ b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/impl/FaceServerImpl.java @@ -152,4 +152,9 @@ logger.info("查询人员"+perId+":"+content); MqUtils.createClient(emqxConfig,sns,content); } + + @Override + public void deleteNotify(String mess) { + + } } diff --git a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/service/impl/PlatUserServiceImpl.java b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/service/impl/PlatUserServiceImpl.java index 8425be2..7be6cd9 100644 --- a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/service/impl/PlatUserServiceImpl.java +++ b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/service/impl/PlatUserServiceImpl.java @@ -452,52 +452,28 @@ @Override @Transactional public void delFace(FaceDto faceDto) { - faceDto.setOp(2); String userIds = faceDto.getUserIds(); + if(StringUtils.isEmpty(userIds)){ + throw new BasicException(BasicStatus.ERROR); + } + List<String> sns = faceDeviceMapper.queryDevSn(); String[] userIdArray = new String[]{userIds}; if(userIds.contains(",")){ userIdArray = userIds.split(","); } - for(String userId : userIdArray){ - faceDto.setUserId(userId); - faceDto.setSyncToDevice(2); - platUserMapper.updateDelFace(faceDto); - - - FaceDto fd = platUserMapper.queryJobNumByUserId(faceDto.getUserId()); - //删除下发 - /*FaceDto fd = platUserMapper.queryJobNumByUserId(userId); - AcsMain.deleteFace(fd.getJobNum());*/ - /*CopyOnWriteArraySet<Session> SESSIONS = FaceServer.SESSIONS; - if(SESSIONS.size()<1){ - throw new BasicException(new BasicMessage("99991","与门禁一体机失去链接")); - } - SESSIONS.forEach(session ->{ - try { - if (session.isOpen()) { - faceDto.setPhoto(filePrefix+faceDto.getPhoto()); - session.getBasicRemote().sendText(JSON.toJSONString(faceDto)); - logger.info("成功推送消息到局域网段"+session.getId()+"___"+session.getRequestURI().getHost()); - } - } catch (IOException e) { - throw new RuntimeException(e); - } - });*/ - - CopyOnWriteArraySet<ChannelHandlerContext> CTXS= NettyServerHandler.CTXS; - if(CTXS.size()<1){ - throw new BasicException(new BasicMessage("99991","与门禁一体机失去链接")); - } - CTXS.forEach(ctx ->{ - if (!ctx.isRemoved()&&ctx.channel().isOpen()) { - faceDto.setJobNum(fd.getJobNum()); - faceDto.setPhoto("https://pipe.thhy-tj.com/"+faceDto.getPhoto()); - ctx.write(JSON.toJSONString(faceDto)); - ctx.flush(); - logger.info("删除人脸成功推送消息到局域网段"); - } - }); - } + JSONObject jsonObject = new JSONObject(); + jsonObject.put("method","delete_person"); + jsonObject.put("notify",faceConfig.getUrlPrefix()+"deleteNotify"); + JSONObject userIdJSON = new JSONObject(); + userIdJSON.put("userIds",userIdArray); + jsonObject.put("params",userIdJSON); + JSONObject dataJson = new JSONObject(); + dataJson.put("person_list",userIdArray); + dataJson.put("person_type","4"); + jsonObject.put("data",dataJson); + String content = jsonObject.toJSONString(); + logger.info("删除指令打印"+content); + MqUtils.createClient(emqxConfig,sns,content); } @Override -- Gitblit v1.9.3