From f4537dd7b671c84e42b77dea0088edb192aa7e03 Mon Sep 17 00:00:00 2001 From: lishiwei <3230787218@qq.com> Date: Wed, 22 Jul 2026 17:26:38 +0800 Subject: [PATCH] =?UTF-8?q?feat(video):=20=E6=B7=BB=E5=8A=A0=E6=B6=88?= =?UTF-8?q?=E9=98=B2=E4=BC=9A=E8=AE=AE=E6=9C=80=E5=A4=A7=E4=BA=BA=E6=95=B0?= =?UTF-8?q?=E9=99=90=E5=88=B6=E4=BB=A5=E5=8F=8A=E6=8F=90=E7=A4=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/VideoPlatformServiceImpl.java | 92 ++++++++++++++----- .../VideoPlatformMeetingAccessCheckCO.java | 2 + .../VideoPlatformMeetingMemberStatusCO.java | 2 + .../VideoPlatformMeetingParticipantCO.java | 2 + 4 files changed, 74 insertions(+), 24 deletions(-) diff --git a/web-app/src/main/java/com/zcloud/zcGbsServicer/service/VideoPlatformServiceImpl.java b/web-app/src/main/java/com/zcloud/zcGbsServicer/service/VideoPlatformServiceImpl.java index a4de807..ff3ba69 100644 --- a/web-app/src/main/java/com/zcloud/zcGbsServicer/service/VideoPlatformServiceImpl.java +++ b/web-app/src/main/java/com/zcloud/zcGbsServicer/service/VideoPlatformServiceImpl.java @@ -57,6 +57,7 @@ import java.util.stream.Collectors; public class VideoPlatformServiceImpl extends FireAlarmServiceSupport implements VideoPlatformServiceI { private static final int AUTH_STATUS_SUCCESS = 1; + private static final int MAX_MEETING_TOTAL_COUNT = 4; private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); private final HstVideoPlatformProperties properties; @@ -65,6 +66,7 @@ public class VideoPlatformServiceImpl extends FireAlarmServiceSupport implements private final FireAlarmMeetingUserRepository fireAlarmMeetingUserRepository; private final FireBrigadeRepository fireBrigadeRepository; private final FireBrigadeUserRepository fireBrigadeUserRepository; + private final FireAlarmUserResolver fireAlarmUserResolver; @Override public SingleResponse getConfig() { @@ -281,37 +283,50 @@ public class VideoPlatformServiceImpl extends FireAlarmServiceSupport implements if (meetingUser == null || StrUtil.isBlank(meetingUser.getThirdUserName())) { co.setReason("当前用户未配置视频会议账号"); co.setParticipants(buildParticipants(context, localUserId)); - return SingleResponse.of(co); - } - if (relation == null) { - co.setReason("当前用户未加入消防队伍"); - co.setParticipants(buildParticipants(context, localUserId)); + fillMeetingCapacity(co, co.getParticipants()); return SingleResponse.of(co); } - String fireBrigadeId = relation.getFireBrigadeId(); - co.setFireBrigadeId(fireBrigadeId); - co.setFireBrigadeName(brigade == null ? meetingUser.getFireBrigadeName() : brigade.getBrigadeName()); + if (relation != null) { + co.setFireBrigadeId(relation.getFireBrigadeId()); + co.setFireBrigadeName(brigade == null ? meetingUser.getFireBrigadeName() : brigade.getBrigadeName()); + } List participants = buildParticipants(context, localUserId); co.setParticipants(participants); - for (VideoPlatformMeetingParticipantCO participant : participants) { - if (!Objects.equals(fireBrigadeId, participant.getFireBrigadeId())) { - continue; - } - if (Objects.equals(localUserId, participant.getLocalUserId())) { - co.setAllowed(true); - co.setOccupied(false); - co.setReason("当前用户已在会议中"); + fillMeetingCapacity(co, participants); + + if (isUserInMeeting(participants, localUserId)) { + co.setAllowed(true); + co.setOccupied(false); + co.setReason("当前用户已在会议中"); + return SingleResponse.of(co); + } + + if (participants.size() >= MAX_MEETING_TOTAL_COUNT) { + co.setAllowed(false); + co.setOccupied(false); + co.setReason("当前参会人数已满,报警需要排队"); + return SingleResponse.of(co); + } + + if (relation != null) { + String fireBrigadeId = relation.getFireBrigadeId(); + for (VideoPlatformMeetingParticipantCO participant : participants) { + if (!Objects.equals(fireBrigadeId, participant.getFireBrigadeId())) { + continue; + } + if (Objects.equals(localUserId, participant.getLocalUserId())) { + continue; + } + co.setAllowed(false); + co.setOccupied(true); + co.setOccupiedUserId(participant.getLocalUserId()); + co.setOccupiedUserName(participant.getLocalUserName()); + co.setOccupiedThirdUserName(participant.getThirdUserName()); + co.setReason("当前消防队伍已有成员在会议中,同队每次仅允许1人入会"); return SingleResponse.of(co); } - co.setAllowed(false); - co.setOccupied(true); - co.setOccupiedUserId(participant.getLocalUserId()); - co.setOccupiedUserName(participant.getLocalUserName()); - co.setOccupiedThirdUserName(participant.getThirdUserName()); - co.setReason("当前消防队伍已有成员在会议中"); - return SingleResponse.of(co); } co.setAllowed(true); @@ -330,6 +345,8 @@ public class VideoPlatformServiceImpl extends FireAlarmServiceSupport implements co.setRoomId(context.roomId); co.setRoomName(context.roomName); co.setParticipantCount(participants.size()); + co.setTotalCount(participants.size()); + co.setMaxTotalCount(MAX_MEETING_TOTAL_COUNT); co.setParticipants(participants); if (Boolean.FALSE.equals(qry.getIncludeLogs())) { co.setLogQuerySuccess(true); @@ -417,7 +434,9 @@ public class VideoPlatformServiceImpl extends FireAlarmServiceSupport implements private FireAlarmMeetingUserDO resolveCurrentMeetingUser(Long localUserId, boolean required) { Long actualLocalUserId = localUserId == null ? currentUserId() : localUserId; - FireAlarmMeetingUserDO meetingUser = actualLocalUserId == null ? null : fireAlarmMeetingUserRepository.getByLocalUserId(actualLocalUserId); + FireAlarmMeetingUserDO meetingUser = actualLocalUserId == null ? null + : fireAlarmMeetingUserRepository.getByLocalUserId(actualLocalUserId, + fireAlarmUserResolver.resolveUserTenantId(actualLocalUserId)); if (required && meetingUser == null) { throw new BizException("当前用户未配置会议账号映射"); } @@ -482,12 +501,37 @@ public class VideoPlatformServiceImpl extends FireAlarmServiceSupport implements co.setLocalPhone(meetingUser == null ? null : meetingUser.getLocalPhone()); co.setFireBrigadeId(meetingUser == null ? null : meetingUser.getFireBrigadeId()); co.setFireBrigadeName(meetingUser == null ? null : meetingUser.getFireBrigadeName()); + co.setUserType(meetingUser == null ? null : meetingUser.getUserType()); + co.setUserTypeName(userTypeName(meetingUser == null ? null : meetingUser.getUserType())); co.setCurrentUser(currentLocalUserId != null && Objects.equals(currentLocalUserId, co.getLocalUserId())); result.add(co); } return result; } + private void fillMeetingCapacity(VideoPlatformMeetingAccessCheckCO co, List participants) { + List safeParticipants = participants == null ? Collections.emptyList() : participants; + co.setTotalCount(safeParticipants.size()); + co.setMaxTotalCount(MAX_MEETING_TOTAL_COUNT); + } + + private boolean isUserInMeeting(List participants, Long localUserId) { + if (participants == null || localUserId == null) { + return false; + } + return participants.stream().anyMatch(item -> Objects.equals(localUserId, item.getLocalUserId())); + } + + private String userTypeName(Integer userType) { + if (Integer.valueOf(1).equals(userType)) { + return "接警人"; + } + if (Integer.valueOf(2).equals(userType)) { + return "报警人"; + } + return null; + } + private List buildRoomLogs(FixedRoomContext context, VideoPlatformMeetingMemberQry qry) { Map requestBody = new LinkedHashMap<>(); requestBody.put("departId", resolveRoomLogDepartId(qry)); diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingAccessCheckCO.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingAccessCheckCO.java index ff25895..6817d36 100644 --- a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingAccessCheckCO.java +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingAccessCheckCO.java @@ -24,4 +24,6 @@ public class VideoPlatformMeetingAccessCheckCO extends ClientObject { private String occupiedUserName; private String occupiedThirdUserName; private List participants; + private Integer totalCount; + private Integer maxTotalCount; } diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingMemberStatusCO.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingMemberStatusCO.java index 0d297fa..f04a101 100644 --- a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingMemberStatusCO.java +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingMemberStatusCO.java @@ -12,6 +12,8 @@ public class VideoPlatformMeetingMemberStatusCO extends ClientObject { private String roomId; private String roomName; private Integer participantCount; + private Integer totalCount; + private Integer maxTotalCount; private List participants; private Boolean logQuerySuccess; private String logQueryMsg; diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingParticipantCO.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingParticipantCO.java index ee79548..333b89b 100644 --- a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingParticipantCO.java +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingParticipantCO.java @@ -12,5 +12,7 @@ public class VideoPlatformMeetingParticipantCO extends ClientObject { private String localPhone; private String fireBrigadeId; private String fireBrigadeName; + private Integer userType; + private String userTypeName; private Boolean currentUser; }