Sfoglia il codice sorgente

commit: face sign send netty msg

lihao16 1 anno fa
parent
commit
d781e9cacd

+ 5 - 3
inspur-admin/src/main/java/com/inspur/web/controller/partywork/PartyMeetingInfoController.java

@@ -20,7 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 /**
  * 党员会议Controller
- * 
+ *
  * @author inspur
  * @date 2022-09-21
  */
@@ -173,7 +173,9 @@ public class PartyMeetingInfoController extends BaseController
     }
 
     @PostMapping("/face/sign")
-    public AjaxResult recognizeFace(@RequestParam("meetingId") Long meetingId, @RequestBody MultipartFile file) {
-        return partyMeetingInfoService.recognizeFace(meetingId,file);
+    public AjaxResult recognizeFace(@RequestParam("meetingId") Long meetingId,
+                                    @RequestParam("mac") String mac,
+                                    @RequestBody MultipartFile file) {
+        return partyMeetingInfoService.recognizeFace(meetingId,mac,file);
     }
 }

+ 9 - 9
inspur-party/src/main/java/com/inspur/service/partywork/IPartyMeetingInfoService.java

@@ -12,15 +12,15 @@ import java.util.List;
 
 /**
  * 党员会议Service接口
- * 
+ *
  * @author inspur
  * @date 2022-09-21
  */
-public interface IPartyMeetingInfoService 
+public interface IPartyMeetingInfoService
 {
     /**
      * 查询党员会议
-     * 
+     *
      * @param id 党员会议主键
      * @return 党员会议
      */
@@ -36,7 +36,7 @@ public interface IPartyMeetingInfoService
 
     /**
      * 查询党员会议列表
-     * 
+     *
      * @param partyMeetingInfo 党员会议
      * @return 党员会议集合
      */
@@ -69,7 +69,7 @@ public interface IPartyMeetingInfoService
 
     /**
      * 新增党员会议
-     * 
+     *
      * @param partyMeetingInfo 党员会议
      * @return 结果
      */
@@ -77,7 +77,7 @@ public interface IPartyMeetingInfoService
 
     /**
      * 修改党员会议
-     * 
+     *
      * @param partyMeetingInfo 党员会议
      * @return 结果
      */
@@ -85,7 +85,7 @@ public interface IPartyMeetingInfoService
 
     /**
      * 批量删除党员会议
-     * 
+     *
      * @param ids 需要删除的党员会议主键集合
      * @return 结果
      */
@@ -93,7 +93,7 @@ public interface IPartyMeetingInfoService
 
     /**
      * 删除党员会议信息
-     * 
+     *
      * @param id 党员会议主键
      * @return 结果
      */
@@ -163,5 +163,5 @@ public interface IPartyMeetingInfoService
     public int meetingSign(PartyAppUser partyAppUser);
 
 
-    public AjaxResult recognizeFace(Long meetingId, MultipartFile file);
+    public AjaxResult recognizeFace(Long meetingId, String mac, MultipartFile file);
 }

+ 33 - 1
inspur-party/src/main/java/com/inspur/service/partywork/impl/PartyMeetingInfoServiceImpl.java

@@ -19,6 +19,7 @@ import com.inspur.common.utils.DateUtils;
 import com.inspur.common.utils.LibreOfficeConvertUtil;
 import com.inspur.common.utils.SecurityUtils;
 import com.inspur.common.utils.file.FileUploadUtils;
+import com.inspur.domain.PcDevice;
 import com.inspur.domain.app.PartyAppUser;
 import com.inspur.domain.partyscreen.PartyMenu;
 import com.inspur.domain.partywork.*;
@@ -30,6 +31,7 @@ import com.inspur.face.service.impl.CompreFaceServiceImpl;
 import com.inspur.framework.config.ServerConfig;
 import com.inspur.framework.manager.AsyncManager;
 import com.inspur.mapper.*;
+import com.inspur.netty.message.push.PushMessage;
 import com.inspur.netty.message.push.PushMessageType;
 import com.inspur.netty.server.PushMessageUtil;
 import com.inspur.service.app.IPartyAppUserService;
@@ -38,6 +40,7 @@ import com.inspur.service.partywork.IPartyAttendanceRecordService;
 import com.inspur.service.partywork.IPartyMeetingInfoService;
 import com.inspur.service.partywork.IPartyMeetingMsgRefService;
 import com.inspur.service.partywork.IPartyOrgManageService;
+import com.inspur.socket.WebSocketServer;
 import com.inspur.system.domain.SysTableList;
 import com.inspur.system.domain.SysUserTableRel;
 import com.inspur.system.domain.SysUserWxRel;
@@ -85,6 +88,10 @@ import static com.inspur.common.utils.PageUtils.startPage;
 public class PartyMeetingInfoServiceImpl implements IPartyMeetingInfoService
 {
     private static final Logger log = LoggerFactory.getLogger(PartyMeetingInfoServiceImpl.class);
+
+    @Value("${netty.controlUrl}")
+    private String controlUrl;
+
     @Autowired
     private PartyMeetingInfoMapper partyMeetingInfoMapper;
 
@@ -1089,7 +1096,7 @@ public class PartyMeetingInfoServiceImpl implements IPartyMeetingInfoService
     }
 
     @Override
-    public AjaxResult recognizeFace(Long meetingId, MultipartFile file) {
+    public AjaxResult recognizeFace(Long meetingId, String mac, MultipartFile file) {
 
         PartyFaceRecognition recognitionResult = recognizeFace2AI(meetingId,file);
         if (recognitionResult.getOpStatus() != 1 || com.inspur.common.utils.StringUtils.isEmpty(recognitionResult.getRspCode())
@@ -1152,9 +1159,34 @@ public class PartyMeetingInfoServiceImpl implements IPartyMeetingInfoService
         // 更新本次会议的签到人数
         recognitionResult.setNewAddNum(newAttendanceRecordList.size());
         partyFaceRecognitionMapper.updatePartyFaceRecognition(recognitionResult);
+        // 发送长连接消息
+        sendSign2Screen(meetingId,mac,newAttendanceRecordList);
         return AjaxResult.success(memberMap);
     }
 
+    private void sendSign2Screen(Long meetingId, String mac, List<PartyAttendanceRecord> newAttendanceRecordList) {
+        if (CollectionUtils.isEmpty(newAttendanceRecordList)) {
+            log.info("本次会议没有新增签到记录,meetingId:{},mac:{}");
+            return;
+        }
+        // 发送长连接消息
+        JSONObject msgJson = new JSONObject();
+        msgJson.put("meetingId",meetingId);
+        msgJson.put("mac",mac);
+        msgJson.put("newRecords",newAttendanceRecordList);
+
+
+        PushMessage pushMessage = new PushMessage();
+        pushMessage.setMessageType(PushMessageType.CONTROL_FACE_SIGN_RESULT.getValue());
+        pushMessage.setMessageData(msgJson);
+
+        String controlParam = JSON.toJSONString(pushMessage);
+
+        PushMessageUtil.remoteMeetingControl(mac, mac, controlUrl, controlParam);
+        log.info("远程控制开始,参数:{}", controlParam);
+
+    }
+
     private PartyFaceRecognition recognizeFace2AI(Long meetingId, MultipartFile file) {
         Long userId = SecurityUtils.getLoginUser().getUserId();
         Map<String,String> fileMap = uploadFile(file);

+ 6 - 1
inspur-pc/src/main/java/com/inspur/netty/message/push/PushMessageType.java

@@ -97,7 +97,12 @@ public enum PushMessageType {
     /**
      * 会议控制 - 图片缩放
      */
-    CONTROL_IMAGE_SCALE("2019");
+    CONTROL_IMAGE_SCALE("2019"),
+
+    /**
+     * 会议控制 - 人脸签到
+     */
+    CONTROL_FACE_SIGN_RESULT("2020");
 
     private String value;