From 406346ddc25e58717772fe70258d3f7a72b0e557 Mon Sep 17 00:00:00 2001
From: 张晓波 <bingbo1993@126.com>
Date: 星期五, 20 十月 2023 10:33:19 +0800
Subject: [PATCH] 苏州配置文件简 化

---
 hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/service/impl/PlatUserServiceImpl.java |   59 ++++++++++++++++++-----------------------------------------
 1 files changed, 18 insertions(+), 41 deletions(-)

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..c9fbf76 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
@@ -561,6 +537,7 @@
         map.put("doorUserList",list);
         PlatUserFace platUserFace = platUserMapper.queryFaceUserByJobNum(list.get(0).getJobNum());
         platUserFace.setPassTime(list.get(0).getCreateTime());
+        platUserFace.setRecordId(list.get(0).getId());
         map.put("firstUserInfo",platUserFace);
         return map;
     }

--
Gitblit v1.9.3