张晓波
2023-10-19 0e026a54cc7f0029a4997a94a2b7b84b33585d7c
苏州配置文件简化
已修改4个文件
76 ■■■■ 文件已修改
hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/FaceController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/FaceServer.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/impl/FaceServerImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/service/impl/PlatUserServiceImpl.java 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
    }
}
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);
}
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) {
    }
}
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