feat(video): 添加消防会议最大人数限制以及提示信息
parent
b14bda36c5
commit
f4537dd7b6
|
|
@ -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<VideoPlatformConfigCO> getConfig() {
|
||||
|
|
@ -281,38 +283,51 @@ 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);
|
||||
if (relation != null) {
|
||||
co.setFireBrigadeId(relation.getFireBrigadeId());
|
||||
co.setFireBrigadeName(brigade == null ? meetingUser.getFireBrigadeName() : brigade.getBrigadeName());
|
||||
}
|
||||
|
||||
List<VideoPlatformMeetingParticipantCO> participants = buildParticipants(context, localUserId);
|
||||
co.setParticipants(participants);
|
||||
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())) {
|
||||
co.setAllowed(true);
|
||||
co.setOccupied(false);
|
||||
co.setReason("当前用户已在会议中");
|
||||
return SingleResponse.of(co);
|
||||
continue;
|
||||
}
|
||||
co.setAllowed(false);
|
||||
co.setOccupied(true);
|
||||
co.setOccupiedUserId(participant.getLocalUserId());
|
||||
co.setOccupiedUserName(participant.getLocalUserName());
|
||||
co.setOccupiedThirdUserName(participant.getThirdUserName());
|
||||
co.setReason("当前消防队伍已有成员在会议中");
|
||||
co.setReason("当前消防队伍已有成员在会议中,同队每次仅允许1人入会");
|
||||
return SingleResponse.of(co);
|
||||
}
|
||||
}
|
||||
|
||||
co.setAllowed(true);
|
||||
co.setOccupied(false);
|
||||
|
|
@ -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<VideoPlatformMeetingParticipantCO> participants) {
|
||||
List<VideoPlatformMeetingParticipantCO> safeParticipants = participants == null ? Collections.emptyList() : participants;
|
||||
co.setTotalCount(safeParticipants.size());
|
||||
co.setMaxTotalCount(MAX_MEETING_TOTAL_COUNT);
|
||||
}
|
||||
|
||||
private boolean isUserInMeeting(List<VideoPlatformMeetingParticipantCO> 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<VideoPlatformMeetingLogCO> buildRoomLogs(FixedRoomContext context, VideoPlatformMeetingMemberQry qry) {
|
||||
Map<String, Object> requestBody = new LinkedHashMap<>();
|
||||
requestBody.put("departId", resolveRoomLogDepartId(qry));
|
||||
|
|
|
|||
|
|
@ -24,4 +24,6 @@ public class VideoPlatformMeetingAccessCheckCO extends ClientObject {
|
|||
private String occupiedUserName;
|
||||
private String occupiedThirdUserName;
|
||||
private List<VideoPlatformMeetingParticipantCO> participants;
|
||||
private Integer totalCount;
|
||||
private Integer maxTotalCount;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<VideoPlatformMeetingParticipantCO> participants;
|
||||
private Boolean logQuerySuccess;
|
||||
private String logQueryMsg;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue