From 9f6cecb671f6238057b076408e8b88b5ed88d0d6 Mon Sep 17 00:00:00 2001 From: lishiwei <3230787218@qq.com> Date: Thu, 16 Jul 2026 17:45:44 +0800 Subject: [PATCH] =?UTF-8?q?feat():=20=E6=B6=88=E9=98=B2=E9=98=9F=E5=9C=A8?= =?UTF-8?q?=E7=BA=BF=E7=8A=B6=E6=80=81=E6=9F=A5=E8=AF=A2=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E4=BC=9A=E8=AE=AE=E5=AE=A4=E5=88=9B=E5=BB=BA=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E5=BD=93=E5=89=8D=E7=B3=BB=E7=BB=9F=E6=88=90=E5=91=98?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E9=80=BB=E8=BE=91=EF=BC=8C=E9=9B=86=E6=88=90?= =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E8=A7=86=E9=A2=91=E4=BC=9A=E8=AE=AE?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/VideoPlatformController.java | 128 +++ .../service/AlarmRecordServiceImpl.java | 70 +- .../FireAlarmMeetingRoomServiceImpl.java | 108 ++- .../service/FireBrigadeMemberServiceImpl.java | 186 ++++- .../FireBrigadeOnlineStatusService.java | 175 ++++ .../service/FireBrigadeServiceImpl.java | 20 +- .../service/HstVideoPlatformClient.java | 199 +++++ .../service/HstVideoPlatformProperties.java | 68 ++ .../service/VideoPlatformServiceImpl.java | 772 ++++++++++++++++++ .../api/VideoPlatformServiceI.java | 56 ++ .../zcGbsServicer/dto/AlarmRecordPageQry.java | 3 + .../dto/VideoPlatformDepartmentQry.java | 24 + .../dto/VideoPlatformFixedRoomLeaveCmd.java | 15 + .../dto/VideoPlatformFixedRoomLoginCmd.java | 27 + .../dto/VideoPlatformFixedRoomQry.java | 15 + .../VideoPlatformMeetingAccessCheckQry.java | 18 + .../dto/VideoPlatformMeetingMemberQry.java | 24 + .../dto/VideoPlatformUserQry.java | 24 + .../dto/VideoRoomAuthRoomCmd.java | 19 + .../dto/VideoRoomAuthUserCmd.java | 23 + .../dto/VideoRoomCreateInstantCmd.java | 69 ++ .../dto/VideoRoomOnlineRoomQry.java | 18 + .../clientobject/VideoPlatformConfigCO.java | 18 + .../VideoPlatformCurrentMeetingCO.java | 24 + .../clientobject/VideoPlatformLoginCO.java | 27 + .../VideoPlatformMeetingAccessCheckCO.java | 27 + .../VideoPlatformMeetingLogCO.java | 20 + .../VideoPlatformMeetingMemberStatusCO.java | 19 + .../VideoPlatformMeetingParticipantCO.java | 16 + .../VideoPlatformOnlineRoomCO.java | 18 + .../VideoPlatformOnlineRoomPageCO.java | 16 + .../clientobject/VideoPlatformResultCO.java | 12 + .../clientobject/VideoPlatformTokenCO.java | 13 + .../dto/clientobject/VideoRoomInstantCO.java | 30 + .../mapper/FireAlarmInfoMapper.java | 6 +- .../FireAlarmMeetingRoomRepository.java | 2 + .../impl/FireAlarmInfoRepositoryImpl.java | 12 +- .../FireAlarmMeetingRoomRepositoryImpl.java | 8 + .../resources/mapper/FireAlarmInfoMapper.xml | 9 + 39 files changed, 2317 insertions(+), 21 deletions(-) create mode 100644 web-adapter/src/main/java/com/zcloud/zcGbsServicer/web/VideoPlatformController.java create mode 100644 web-app/src/main/java/com/zcloud/zcGbsServicer/service/FireBrigadeOnlineStatusService.java create mode 100644 web-app/src/main/java/com/zcloud/zcGbsServicer/service/HstVideoPlatformClient.java create mode 100644 web-app/src/main/java/com/zcloud/zcGbsServicer/service/HstVideoPlatformProperties.java create mode 100644 web-app/src/main/java/com/zcloud/zcGbsServicer/service/VideoPlatformServiceImpl.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/api/VideoPlatformServiceI.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformDepartmentQry.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformFixedRoomLeaveCmd.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformFixedRoomLoginCmd.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformFixedRoomQry.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformMeetingAccessCheckQry.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformMeetingMemberQry.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformUserQry.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoRoomAuthRoomCmd.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoRoomAuthUserCmd.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoRoomCreateInstantCmd.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoRoomOnlineRoomQry.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformConfigCO.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformCurrentMeetingCO.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformLoginCO.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingAccessCheckCO.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingLogCO.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingMemberStatusCO.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingParticipantCO.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformOnlineRoomCO.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformOnlineRoomPageCO.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformResultCO.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformTokenCO.java create mode 100644 web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoRoomInstantCO.java diff --git a/web-adapter/src/main/java/com/zcloud/zcGbsServicer/web/VideoPlatformController.java b/web-adapter/src/main/java/com/zcloud/zcGbsServicer/web/VideoPlatformController.java new file mode 100644 index 0000000..51d5505 --- /dev/null +++ b/web-adapter/src/main/java/com/zcloud/zcGbsServicer/web/VideoPlatformController.java @@ -0,0 +1,128 @@ +package com.zcloud.zcGbsServicer.web; + +import com.alibaba.cola.dto.SingleResponse; +import com.zcloud.zcGbsServicer.api.VideoPlatformServiceI; +import com.zcloud.zcGbsServicer.dto.VideoPlatformDepartmentQry; +import com.zcloud.zcGbsServicer.dto.VideoPlatformFixedRoomLeaveCmd; +import com.zcloud.zcGbsServicer.dto.VideoPlatformFixedRoomLoginCmd; +import com.zcloud.zcGbsServicer.dto.VideoPlatformFixedRoomQry; +import com.zcloud.zcGbsServicer.dto.VideoPlatformMeetingAccessCheckQry; +import com.zcloud.zcGbsServicer.dto.VideoPlatformMeetingMemberQry; +import com.zcloud.zcGbsServicer.dto.VideoPlatformUserQry; +import com.zcloud.zcGbsServicer.dto.VideoRoomAuthRoomCmd; +import com.zcloud.zcGbsServicer.dto.VideoRoomAuthUserCmd; +import com.zcloud.zcGbsServicer.dto.VideoRoomCreateInstantCmd; +import com.zcloud.zcGbsServicer.dto.VideoRoomOnlineRoomQry; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformConfigCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformCurrentMeetingCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformLoginCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformMeetingAccessCheckCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformMeetingMemberStatusCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformOnlineRoomPageCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformResultCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformTokenCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoRoomInstantCO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Collections; +import java.util.List; + +@Api(tags = "消防报警视频会议") +@RestController +@AllArgsConstructor +public class VideoPlatformController { + + private final VideoPlatformServiceI videoPlatformService; + + @ApiOperation("获取视频平台基础配置") + @GetMapping({"/${application.gateway}/video/platform/config", "/video/platform/config"}) + public SingleResponse getConfig() { + return videoPlatformService.getConfig(); + } + + @ApiOperation("生成视频平台调试令牌") + @PostMapping({"/${application.gateway}/api/v1/video/token/generate", "/api/v1/video/token/generate"}) + public SingleResponse generateToken() { + return videoPlatformService.generateToken(); + } + + @ApiOperation("创建即时会议") + @PostMapping({"/${application.gateway}/api/v1/room/createInstant", "/api/v1/room/createInstant"}) + public SingleResponse createInstant(@Validated @RequestBody(required = false) VideoRoomCreateInstantCmd cmd) { + return videoPlatformService.createInstant(cmd == null ? new VideoRoomCreateInstantCmd() : cmd); + } + + @ApiOperation("会议室授权用户") + @PostMapping({"/${application.gateway}/api/v1/room/authUser", "/api/v1/room/authUser"}) + public SingleResponse authUser(@Validated @RequestBody VideoRoomAuthUserCmd cmd) { + return videoPlatformService.authUser(cmd); + } + + @ApiOperation("用户授权会议室") + @PostMapping({"/${application.gateway}/api/v1/room/authRoom", "/api/v1/room/authRoom"}) + public SingleResponse authRoom(@Validated @RequestBody VideoRoomAuthRoomCmd cmd) { + return videoPlatformService.authRoom(cmd); + } + + @ApiOperation("获取视频平台登录地址") + @GetMapping({"/${application.gateway}/api/v1/room/loginAddr", "/api/v1/room/loginAddr"}) + public SingleResponse> getLoginAddr() { + List loginAddrList = videoPlatformService.getLoginAddr(); + return SingleResponse.of(loginAddrList == null ? Collections.emptyList() : loginAddrList); + } + + @ApiOperation("查询在线视频会议") + @PostMapping({"/${application.gateway}/api/v1/room/onlineRoom", "/api/v1/room/onlineRoom"}) + public SingleResponse onlineRoom(@RequestBody(required = false) VideoRoomOnlineRoomQry qry) { + return videoPlatformService.onlineRoom(qry == null ? new VideoRoomOnlineRoomQry() : qry); + } + + @ApiOperation("查询视频平台组织架构") + @PostMapping({"/${application.gateway}/video/platform/department/list", "/video/platform/department/list"}) + public SingleResponse departmentList(@RequestBody(required = false) VideoPlatformDepartmentQry qry) { + return videoPlatformService.departmentList(qry == null ? new VideoPlatformDepartmentQry() : qry); + } + + @ApiOperation("查询视频平台用户") + @PostMapping({"/${application.gateway}/video/platform/user/list", "/video/platform/user/list"}) + public SingleResponse userList(@RequestBody(required = false) VideoPlatformUserQry qry) { + return videoPlatformService.userList(qry == null ? new VideoPlatformUserQry() : qry); + } + + @ApiOperation("查看当前固定消防会议") + @PostMapping({"/${application.gateway}/video/platform/fixedRoom/current", "/video/platform/fixedRoom/current"}) + public SingleResponse currentFixedMeeting(@RequestBody(required = false) VideoPlatformFixedRoomQry qry) { + return videoPlatformService.currentFixedMeeting(qry == null ? new VideoPlatformFixedRoomQry() : qry); + } + + @ApiOperation("固定消防会议入会校验") + @PostMapping({"/${application.gateway}/video/platform/fixedRoom/access/check", "/video/platform/fixedRoom/access/check"}) + public SingleResponse checkFixedMeetingAccess(@RequestBody(required = false) VideoPlatformMeetingAccessCheckQry qry) { + return videoPlatformService.checkFixedMeetingAccess(qry == null ? new VideoPlatformMeetingAccessCheckQry() : qry); + } + + @ApiOperation("固定消防会议参会成员状态") + @PostMapping({"/${application.gateway}/video/platform/fixedRoom/members", "/video/platform/fixedRoom/members"}) + public SingleResponse fixedMeetingMembers(@RequestBody(required = false) VideoPlatformMeetingMemberQry qry) { + return videoPlatformService.fixedMeetingMembers(qry == null ? new VideoPlatformMeetingMemberQry() : qry); + } + + @ApiOperation("获取固定会议室入会参数") + @PostMapping({"/${application.gateway}/video/platform/fixedRoom/login", "/video/platform/fixedRoom/login"}) + public SingleResponse fixedRoomLogin(@RequestBody(required = false) VideoPlatformFixedRoomLoginCmd cmd) { + return videoPlatformService.fixedRoomLogin(cmd == null ? new VideoPlatformFixedRoomLoginCmd() : cmd); + } + + @ApiOperation("固定会议室离会回调") + @PostMapping({"/${application.gateway}/video/platform/fixedRoom/leave", "/video/platform/fixedRoom/leave"}) + public SingleResponse fixedRoomLeave(@RequestBody(required = false) VideoPlatformFixedRoomLeaveCmd cmd) { + return videoPlatformService.fixedRoomLeave(cmd == null ? new VideoPlatformFixedRoomLeaveCmd() : cmd); + } +} diff --git a/web-app/src/main/java/com/zcloud/zcGbsServicer/service/AlarmRecordServiceImpl.java b/web-app/src/main/java/com/zcloud/zcGbsServicer/service/AlarmRecordServiceImpl.java index ce2f3d0..112462b 100644 --- a/web-app/src/main/java/com/zcloud/zcGbsServicer/service/AlarmRecordServiceImpl.java +++ b/web-app/src/main/java/com/zcloud/zcGbsServicer/service/AlarmRecordServiceImpl.java @@ -14,6 +14,7 @@ import com.zcloud.zcGbsServicer.dto.AlarmRecordPageQry; import com.zcloud.zcGbsServicer.dto.clientobject.AlarmRecordCO; import com.zcloud.zcGbsServicer.persistence.dataobject.FireAlarmInfoDO; import com.zcloud.zcGbsServicer.persistence.dataobject.FireBrigadeDO; +import com.zcloud.zcGbsServicer.persistence.dataobject.FireBrigadeUserDO; import com.zcloud.zcGbsServicer.persistence.repository.FireAlarmInfoRepository; import com.zcloud.zcGbsServicer.persistence.repository.FireBrigadeRepository; import com.zcloud.zcGbsServicer.persistence.repository.FireBrigadeUserRepository; @@ -26,6 +27,7 @@ import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.UUID; import java.util.stream.Collectors; @@ -53,6 +55,14 @@ public class AlarmRecordServiceImpl extends FireAlarmServiceSupport implements A params.put("pageSize", qry.getPageSize()); params.put("fireBrigadeName", qry.getTeam()); params.put("alarmStatus", parseStatus(qry.getStatus())); + params.put("feedbackOnly", Boolean.TRUE.equals(qry.getMyFeedbackOnly())); + if (Boolean.TRUE.equals(qry.getMyFeedbackOnly())) { + List currentBrigadeIds = getCurrentUserBrigadeBizIds(); + if (currentBrigadeIds.isEmpty()) { + return PageResponse.of(Collections.emptyList(), 0, qry.getPageSize(), qry.getPageIndex()); + } + params.put("fireBrigadeIds", currentBrigadeIds); + } PageResponse page = fireAlarmInfoRepository.listPage(params); return PageResponse.of(page.getData().stream().map(this::buildCO).collect(Collectors.toList()), page.getTotalCount(), page.getPageSize(), page.getPageIndex()); @@ -80,7 +90,6 @@ public class AlarmRecordServiceImpl extends FireAlarmServiceSupport implements A record.setLatitude(BigDecimal.valueOf(cmd.getLat())); record.setAlarmStatus(ALARM_STATUS_ALARMING); record.setRecordTime(LocalDateTime.now()); - record.setMeetingNoticeStatus("INIT"); fireAlarmInfoRepository.save(record); return SingleResponse.of(buildCO(record)); } @@ -104,7 +113,9 @@ public class AlarmRecordServiceImpl extends FireAlarmServiceSupport implements A if (!Integer.valueOf(ALARM_STATUS_ALARMING).equals(record.getAlarmStatus())) { throw new BizException("仅报警中的记录可处置"); } - fillBrigade(record, cmd.getFireBrigadeId(), cmd.getFireBrigadeName()); + FireBrigadeDO brigade = resolveHandleBrigade(cmd); + record.setFireBrigadeId(brigade.getFireBrigadeId()); + record.setFireBrigadeName(selectText(brigade.getBrigadeName(), cmd.getFireBrigadeName())); record.setHandleUserId(currentUserId()); record.setHandleUserName(currentUserName()); record.setHandleTime(LocalDateTime.now()); @@ -126,7 +137,7 @@ public class AlarmRecordServiceImpl extends FireAlarmServiceSupport implements A if (!canClearByCurrentUser(record)) { throw new BizException("仅当前处置消防队成员可消警"); } - record.setClearReason(cmd.getDesc()); + record.setClearReason(cmd.getDesc().trim()); record.setClearId(currentUserId()); record.setClearName(currentUserName()); record.setClearTime(LocalDateTime.now()); @@ -135,16 +146,29 @@ public class AlarmRecordServiceImpl extends FireAlarmServiceSupport implements A fireAlarmInfoRepository.updateById(record); } - private void fillBrigade(FireAlarmInfoDO record, Long fireBrigadePkId, String fireBrigadeName) { - if (fireBrigadePkId == null) { - throw new BizException("请选择处置消防队伍"); + private FireBrigadeDO resolveHandleBrigade(AlarmRecordHandleCmd cmd) { + if (cmd.getFireBrigadeId() != null) { + FireBrigadeDO brigade = fireBrigadeRepository.getById(cmd.getFireBrigadeId()); + if (brigade == null) { + throw new BizException("处置消防队伍不存在"); + } + if (!isCurrentUserInBrigade(brigade.getFireBrigadeId())) { + throw new BizException("只能处置当前登录人所在的消防队报警"); + } + return brigade; } - FireBrigadeDO brigade = fireBrigadeRepository.getById(fireBrigadePkId); + List relations = currentUserRelations(); + if (relations.isEmpty()) { + throw new BizException("当前登录人不是消防队成员,不能执行处置"); + } + if (relations.size() > 1) { + throw new BizException("当前登录人存在多个消防队归属,请明确选择处置队伍"); + } + FireBrigadeDO brigade = fireBrigadeRepository.getByFireBrigadeId(relations.get(0).getFireBrigadeId()); if (brigade == null) { - throw new BizException("处置消防队伍不存在"); + throw new BizException("当前登录人所属消防队不存在"); } - record.setFireBrigadeId(brigade.getFireBrigadeId()); - record.setFireBrigadeName(StrUtil.isNotBlank(brigade.getBrigadeName()) ? brigade.getBrigadeName() : fireBrigadeName); + return brigade; } private AlarmRecordCO buildCO(FireAlarmInfoDO record) { @@ -226,6 +250,28 @@ public class AlarmRecordServiceImpl extends FireAlarmServiceSupport implements A return fireBrigadeUserRepository.existsRelation(record.getFireBrigadeId(), currentUserId(), null); } + private boolean isCurrentUserInBrigade(String fireBrigadeBizId) { + if (StrUtil.isBlank(fireBrigadeBizId) || currentUserId() == null) { + return false; + } + return fireBrigadeUserRepository.existsRelation(fireBrigadeBizId, currentUserId(), null); + } + + private List currentUserRelations() { + if (currentUserId() == null) { + return Collections.emptyList(); + } + return fireBrigadeUserRepository.listByUserId(currentUserId()); + } + + private List getCurrentUserBrigadeBizIds() { + return currentUserRelations().stream() + .map(FireBrigadeUserDO::getFireBrigadeId) + .filter(StrUtil::isNotBlank) + .distinct() + .collect(Collectors.toList()); + } + private boolean isValidLongitude(Double lng) { return lng != null && lng >= -180D && lng <= 180D; } @@ -234,6 +280,10 @@ public class AlarmRecordServiceImpl extends FireAlarmServiceSupport implements A return lat != null && lat >= -90D && lat <= 90D; } + private String selectText(String preferred, String fallback) { + return StrUtil.isNotBlank(preferred) ? preferred : fallback; + } + private long nextId() { return IdUtil.getSnowflake(1, 1).nextId(); } diff --git a/web-app/src/main/java/com/zcloud/zcGbsServicer/service/FireAlarmMeetingRoomServiceImpl.java b/web-app/src/main/java/com/zcloud/zcGbsServicer/service/FireAlarmMeetingRoomServiceImpl.java index d97d324..2b4e1ee 100644 --- a/web-app/src/main/java/com/zcloud/zcGbsServicer/service/FireAlarmMeetingRoomServiceImpl.java +++ b/web-app/src/main/java/com/zcloud/zcGbsServicer/service/FireAlarmMeetingRoomServiceImpl.java @@ -1,6 +1,7 @@ package com.zcloud.zcGbsServicer.service; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; import com.alibaba.cola.dto.PageResponse; import com.alibaba.cola.dto.SingleResponse; import com.alibaba.cola.exception.BizException; @@ -11,14 +12,24 @@ import com.zcloud.zcGbsServicer.dto.FireAlarmMeetingRoomPageQry; import com.zcloud.zcGbsServicer.dto.FireAlarmMeetingRoomUpdateCmd; import com.zcloud.zcGbsServicer.dto.clientobject.FireAlarmMeetingRoomCO; import com.zcloud.zcGbsServicer.persistence.dataobject.FireAlarmMeetingRoomDO; +import com.zcloud.zcGbsServicer.persistence.dataobject.FireAlarmMeetingUserDO; +import com.zcloud.zcGbsServicer.persistence.dataobject.FireBrigadeDO; +import com.zcloud.zcGbsServicer.persistence.dataobject.FireBrigadeUserDO; import com.zcloud.zcGbsServicer.persistence.repository.FireAlarmMeetingRoomRepository; +import com.zcloud.zcGbsServicer.persistence.repository.FireAlarmMeetingUserRepository; +import com.zcloud.zcGbsServicer.persistence.repository.FireBrigadeRepository; +import com.zcloud.zcGbsServicer.persistence.repository.FireBrigadeUserRepository; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; +import java.util.Set; import java.util.UUID; +import java.util.stream.Collectors; @Service @RequiredArgsConstructor @@ -26,6 +37,10 @@ public class FireAlarmMeetingRoomServiceImpl extends FireAlarmServiceSupport imp private final FireAlarmMeetingRoomRepository fireAlarmMeetingRoomRepository; private final FireAlarmMeetingRoomCoConvertor fireAlarmMeetingRoomCoConvertor; + private final HstVideoPlatformClient hstVideoPlatformClient; + private final FireBrigadeUserRepository fireBrigadeUserRepository; + private final FireBrigadeRepository fireBrigadeRepository; + private final FireAlarmMeetingUserRepository fireAlarmMeetingUserRepository; @Override public PageResponse listPage(FireAlarmMeetingRoomPageQry qry) { @@ -43,16 +58,35 @@ public class FireAlarmMeetingRoomServiceImpl extends FireAlarmServiceSupport imp @Override @Transactional(rollbackFor = Exception.class) public SingleResponse add(FireAlarmMeetingRoomAddCmd cmd) { - if (fireAlarmMeetingRoomRepository.existsByRoomCode(cmd.getRoomCode(), null)) { - throw new BizException("会议室编码已存在"); + List existingRooms = fireAlarmMeetingRoomRepository.listAll(); + if (existingRooms != null && !existingRooms.isEmpty()) { + throw new BizException("已有固定会议室,不能重复创建"); } + + Map requestBody = new LinkedHashMap<>(); + requestBody.put("roomName", cmd.getRoomName()); + if (StrUtil.isNotBlank(cmd.getRoomCode())) { + requestBody.put("roomCode", cmd.getRoomCode()); + } + if (StrUtil.isNotBlank(cmd.getRoomPasswordCipher())) { + requestBody.put("password", cmd.getRoomPasswordCipher()); + } + Map response = hstVideoPlatformClient.addRoomInfo(requestBody); + hstVideoPlatformClient.ensureSuccess(response, "创建第三方固定会议室"); + Map data = castMap(response.get("data")); + FireAlarmMeetingRoomDO room = new FireAlarmMeetingRoomDO(); room.setId(nextId()); room.setFireAlarmMeetingRoomId(nextBizId()); room.setRebuildCount(0); + room.setThirdRoomId(selectText(asText(data.get("roomId")), cmd.getThirdRoomId())); + room.setThirdRoomNo(selectText(asText(data.get("roomNo")), cmd.getThirdRoomNo())); fillCreateAudit(room); fillRoom(room, cmd); fireAlarmMeetingRoomRepository.save(room); + + syncAuthUsersForNewRoom(room); + return SingleResponse.of(fireAlarmMeetingRoomCoConvertor.converDOToCO(room)); } @@ -100,6 +134,76 @@ public class FireAlarmMeetingRoomServiceImpl extends FireAlarmServiceSupport imp room.setRemarks(cmd.getRemarks()); } + private void syncAuthUsersForNewRoom(FireAlarmMeetingRoomDO room) { + String roomId = selectText(room.getThirdRoomId(), room.getThirdRoomNo()); + if (StrUtil.isBlank(roomId)) { + return; + } + + List brigadeUsers = fireBrigadeUserRepository.listAll(); + if (brigadeUsers == null || brigadeUsers.isEmpty()) { + return; + } + + Map meetingUserMap = fireAlarmMeetingUserRepository.listAll() + .stream() + .filter(u -> u.getLocalUserId() != null && StrUtil.isNotBlank(u.getThirdUserName())) + .collect(Collectors.toMap(FireAlarmMeetingUserDO::getLocalUserId, u -> u, (a, b) -> a)); + + Set brigadeIds = brigadeUsers.stream() + .map(FireBrigadeUserDO::getFireBrigadeId) + .filter(StrUtil::isNotBlank) + .collect(Collectors.toSet()); + Map brigadeMap = new HashMap<>(); + for (String brigadeId : brigadeIds) { + FireBrigadeDO brigade = fireBrigadeRepository.getByFireBrigadeId(brigadeId); + if (brigade != null) { + brigadeMap.put(brigadeId, brigade); + } + } + + for (FireBrigadeUserDO brigadeUser : brigadeUsers) { + if (brigadeUser.getUserId() == null) { + continue; + } + FireAlarmMeetingUserDO meetingUser = meetingUserMap.get(brigadeUser.getUserId()); + if (meetingUser == null) { + continue; + } + + FireBrigadeDO brigade = brigadeMap.get(brigadeUser.getFireBrigadeId()); + boolean isLeader = brigade != null && brigade.getLeaderUserId() != null + && brigade.getLeaderUserId().equals(brigadeUser.getUserId()); + int permission = isLeader ? 3 : 2; + + Map authBody = new LinkedHashMap<>(); + authBody.put("roomUserStr", roomId + "," + permission); + authBody.put("userName", meetingUser.getThirdUserName()); + try { + Map authResp = hstVideoPlatformClient.authRoom(authBody); + hstVideoPlatformClient.ensureSuccess(authResp, "用户授权新会议室"); + } catch (BizException ex) { + throw new BizException("用户授权新会议室失败", ex); + } + } + } + + @SuppressWarnings("unchecked") + private Map castMap(Object value) { + if (!(value instanceof Map)) { + return new HashMap<>(); + } + return (Map) value; + } + + private String asText(Object value) { + return value == null ? null : String.valueOf(value); + } + + private String selectText(String preferred, String fallback) { + return StrUtil.isNotBlank(preferred) ? preferred : fallback; + } + private long nextId() { return IdUtil.getSnowflake(1, 1).nextId(); } diff --git a/web-app/src/main/java/com/zcloud/zcGbsServicer/service/FireBrigadeMemberServiceImpl.java b/web-app/src/main/java/com/zcloud/zcGbsServicer/service/FireBrigadeMemberServiceImpl.java index b7dccde..59f3705 100644 --- a/web-app/src/main/java/com/zcloud/zcGbsServicer/service/FireBrigadeMemberServiceImpl.java +++ b/web-app/src/main/java/com/zcloud/zcGbsServicer/service/FireBrigadeMemberServiceImpl.java @@ -12,14 +12,21 @@ import com.zcloud.zcGbsServicer.dto.FireBrigadeMemberAddCmd; import com.zcloud.zcGbsServicer.dto.FireBrigadeMemberPageQry; import com.zcloud.zcGbsServicer.dto.FireBrigadeMemberUpdateCmd; import com.zcloud.zcGbsServicer.dto.clientobject.FireBrigadeMemberCO; +import com.zcloud.zcGbsServicer.persistence.dataobject.FireAlarmMeetingRoomDO; +import com.zcloud.zcGbsServicer.persistence.dataobject.FireAlarmMeetingUserDO; import com.zcloud.zcGbsServicer.persistence.dataobject.FireBrigadeDO; import com.zcloud.zcGbsServicer.persistence.dataobject.FireBrigadeUserDO; +import com.zcloud.zcGbsServicer.persistence.repository.FireAlarmMeetingRoomRepository; +import com.zcloud.zcGbsServicer.persistence.repository.FireAlarmMeetingUserRepository; import com.zcloud.zcGbsServicer.persistence.repository.FireBrigadeRepository; import com.zcloud.zcGbsServicer.persistence.repository.FireBrigadeUserRepository; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Collections; import java.util.List; import java.util.Map; @@ -33,6 +40,10 @@ public class FireBrigadeMemberServiceImpl extends FireAlarmServiceSupport implem private final FireBrigadeRepository fireBrigadeRepository; private final FireBrigadeUserRepository fireBrigadeUserRepository; + private final FireAlarmMeetingRoomRepository fireAlarmMeetingRoomRepository; + private final FireAlarmMeetingUserRepository fireAlarmMeetingUserRepository; + private final HstVideoPlatformProperties hstVideoPlatformProperties; + private final HstVideoPlatformClient hstVideoPlatformClient; private final FireAlarmUserResolver fireAlarmUserResolver; private final FireBrigadeMemberCoConvertor fireBrigadeMemberCoConvertor; @@ -71,6 +82,7 @@ public class FireBrigadeMemberServiceImpl extends FireAlarmServiceSupport implem relation.setUserId(userId); fillMemberSnapshot(relation, cmd); fillCreateAudit(relation); + syncCreateMeetingUser(relation, brigade); fireBrigadeUserRepository.save(relation); return SingleResponse.of(buildCO(relation, brigade, fireAlarmUserResolver.getUserMap(Collections.singleton(userId)))); } @@ -121,6 +133,7 @@ public class FireBrigadeMemberServiceImpl extends FireAlarmServiceSupport implem } checkLeaderRelation(relation); fireBrigadeUserRepository.removeById(id); + syncDeleteMeetingUserIfUnused(relation); } @Override @@ -135,7 +148,13 @@ public class FireBrigadeMemberServiceImpl extends FireAlarmServiceSupport implem checkLeaderRelation(relation); } } - fireBrigadeUserRepository.removeByIds(java.util.Arrays.asList(ids)); + for (Long id : ids) { + FireBrigadeUserDO relation = fireBrigadeUserRepository.getById(id); + if (relation != null) { + fireBrigadeUserRepository.removeById(id); + syncDeleteMeetingUserIfUnused(relation); + } + } } private FireBrigadeDO getBrigade(Long id) { @@ -182,6 +201,171 @@ public class FireBrigadeMemberServiceImpl extends FireAlarmServiceSupport implem relation.setOrgName(cmd.getOrg()); } + private void syncCreateMeetingUser(FireBrigadeUserDO relation, FireBrigadeDO brigade) { + if (StrUtil.isBlank(hstVideoPlatformProperties.getDefaultUserPassword())) { + throw new BizException("视频平台默认用户密码未配置,不能创建消防会议账号"); + } + String thirdUserName = resolveThirdUserName(relation.getUserId()); + Map requestBody = new LinkedHashMap<>(); + requestBody.put("userName", thirdUserName); + requestBody.put("password", hstVideoPlatformProperties.getDefaultUserPassword()); + requestBody.put("passwordType", 0); + requestBody.put("mobile", relation.getPhone()); + requestBody.put("nickName", selectText(relation.getUserName(), thirdUserName)); + requestBody.put("sex", "女".equals(relation.getGender()) ? "1" : "0"); + requestBody.put("departId", StrUtil.blankToDefault(brigade.getThirdDepartId(), "0")); + requestBody.put("adminRole", 2); + + Map data = new HashMap<>(); + String syncMsg = "第三方账号创建成功"; + try { + Map response = hstVideoPlatformClient.addUser(requestBody); + hstVideoPlatformClient.ensureSuccess(response, "创建视频平台用户"); + data = castMap(response.get("data")); + syncMsg = selectText(asText(response.get("msg")), syncMsg); + } + catch (BizException ex) { + if (!isAlreadyExists(ex.getMessage())) { + throw new BizException("创建视频平台用户失败:" + ex.getMessage()); + } + syncMsg = "第三方账号已存在,已复用"; + } + + upsertMeetingUserMapping(relation, brigade, thirdUserName, data, syncMsg); + syncRoomAuth(thirdUserName, 2); + } + + private void upsertMeetingUserMapping(FireBrigadeUserDO relation, FireBrigadeDO brigade, + String thirdUserName, Map data, String syncMsg) { + FireAlarmMeetingUserDO meetingUser = fireAlarmMeetingUserRepository.getByLocalUserId(relation.getUserId()); + boolean isNew = meetingUser == null; + if (meetingUser == null) { + meetingUser = new FireAlarmMeetingUserDO(); + meetingUser.setId(nextId()); + meetingUser.setFireAlarmMeetingUserId(nextBizId()); + fillCreateAudit(meetingUser); + } + else { + fillUpdateAudit(meetingUser); + } + + FireAlarmMeetingRoomDO room = fireAlarmMeetingRoomRepository.getByRoomCode(hstVideoPlatformProperties.getDefaultRoomCode()); + LocalDateTime now = LocalDateTime.now(); + meetingUser.setLocalUserId(relation.getUserId()); + meetingUser.setLocalUserName(relation.getUserName()); + meetingUser.setLocalPhone(relation.getPhone()); + meetingUser.setUserType(1); + meetingUser.setFireBrigadeId(brigade.getFireBrigadeId()); + meetingUser.setFireBrigadeName(brigade.getBrigadeName()); + meetingUser.setThirdUserId(selectText(asText(data.get("userId")), meetingUser.getThirdUserId())); + meetingUser.setThirdUserName(selectText(asText(data.get("userName")), thirdUserName)); + meetingUser.setThirdNickName(selectText(asText(data.get("displayName")), relation.getUserName())); + meetingUser.setThirdDepartId(selectText(asText(data.get("departId")), brigade.getThirdDepartId())); + meetingUser.setThirdDepartName(brigade.getThirdDepartName()); + meetingUser.setAuthRoomId(room == null ? hstVideoPlatformProperties.getDefaultRoomNo() : selectText(room.getThirdRoomId(), room.getThirdRoomNo())); + meetingUser.setAuthRoomName(room == null ? "消防报警固定会议室" : room.getRoomName()); + meetingUser.setAuthStatus(1); + meetingUser.setAuthTime(now); + meetingUser.setSyncStatus(1); + meetingUser.setSyncMsg(syncMsg); + meetingUser.setLastSyncTime(now); + if (isNew) { + fireAlarmMeetingUserRepository.save(meetingUser); + } + else { + fireAlarmMeetingUserRepository.updateById(meetingUser); + } + } + + private void syncRoomAuth(String thirdUserName, int permission) { + if (StrUtil.isBlank(thirdUserName)) { + return; + } + FireAlarmMeetingRoomDO room = fireAlarmMeetingRoomRepository.getByRoomCode(hstVideoPlatformProperties.getDefaultRoomCode()); + String roomId = room == null ? hstVideoPlatformProperties.getDefaultRoomNo() + : selectText(room.getThirdRoomId(), room.getThirdRoomNo()); + if (StrUtil.isBlank(roomId)) { + return; + } + Map requestBody = new LinkedHashMap<>(); + requestBody.put("roomUserStr", roomId + "," + permission); + requestBody.put("userName", thirdUserName); + try { + Map response = hstVideoPlatformClient.authRoom(requestBody); + hstVideoPlatformClient.ensureSuccess(response, permission == 0 ? "解除用户会议室授权" : "用户授权会议室"); + } catch (BizException ex) { + throw new BizException("用户授权会议室失败:" + ex.getMessage()); + } + } + + private void syncDeleteMeetingUserIfUnused(FireBrigadeUserDO relation) { + if (relation == null || relation.getUserId() == null) { + return; + } + List activeRelations = fireBrigadeUserRepository.listByUserId(relation.getUserId()); + if (activeRelations != null && !activeRelations.isEmpty()) { + return; + } + FireAlarmMeetingUserDO meetingUser = fireAlarmMeetingUserRepository.getByLocalUserId(relation.getUserId()); + if (meetingUser == null) { + return; + } + if (StrUtil.isNotBlank(meetingUser.getThirdUserName())) { + syncRoomAuth(meetingUser.getThirdUserName(), 0); + Map requestBody = new LinkedHashMap<>(); + requestBody.put("userName", meetingUser.getThirdUserName()); + try { + Map response = hstVideoPlatformClient.deleteUser(requestBody); + hstVideoPlatformClient.ensureSuccess(response, "删除视频平台用户"); + } + catch (BizException ex) { + if (!isAlreadyMissing(ex.getMessage())) { + throw new BizException("删除视频平台用户失败:" + ex.getMessage()); + } + } + } + fillUpdateAudit(meetingUser); + meetingUser.setDeleteEnum("TRUE"); + meetingUser.setSyncStatus(1); + meetingUser.setSyncMsg("第三方账号已删除,会议账号映射已作废"); + meetingUser.setLastSyncTime(LocalDateTime.now()); + fireAlarmMeetingUserRepository.updateById(meetingUser); + } + + private String resolveThirdUserName(Long localUserId) { + FireAlarmMeetingUserDO meetingUser = fireAlarmMeetingUserRepository.getByLocalUserId(localUserId); + if (meetingUser != null && StrUtil.isNotBlank(meetingUser.getThirdUserName())) { + return meetingUser.getThirdUserName().trim(); + } + String userName = StrUtil.blankToDefault(hstVideoPlatformProperties.getFireUserPrefix(), "xfbj") + localUserId; + if (userName.length() > 32) { + return userName.substring(0, 32); + } + return userName; + } + + private boolean isAlreadyExists(String message) { + String msg = StrUtil.blankToDefault(message, "").toLowerCase(); + return msg.contains("存在") || msg.contains("exist") || msg.contains("duplicate"); + } + + private boolean isAlreadyMissing(String message) { + String msg = StrUtil.blankToDefault(message, "").toLowerCase(); + return msg.contains("不存在") || msg.contains("not exist") || msg.contains("not found"); + } + + @SuppressWarnings("unchecked") + private Map castMap(Object value) { + if (!(value instanceof Map)) { + return new HashMap<>(); + } + return (Map) value; + } + + private String asText(Object value) { + return value == null ? null : String.valueOf(value); + } + private String selectText(String preferred, String fallback) { return StrUtil.isNotBlank(preferred) ? preferred : fallback; } diff --git a/web-app/src/main/java/com/zcloud/zcGbsServicer/service/FireBrigadeOnlineStatusService.java b/web-app/src/main/java/com/zcloud/zcGbsServicer/service/FireBrigadeOnlineStatusService.java new file mode 100644 index 0000000..c55c0b0 --- /dev/null +++ b/web-app/src/main/java/com/zcloud/zcGbsServicer/service/FireBrigadeOnlineStatusService.java @@ -0,0 +1,175 @@ +package com.zcloud.zcGbsServicer.service; + +import cn.hutool.core.util.StrUtil; +import com.zcloud.zcGbsServicer.persistence.dataobject.FireAlarmMeetingUserDO; +import com.zcloud.zcGbsServicer.persistence.dataobject.FireBrigadeDO; +import com.zcloud.zcGbsServicer.persistence.dataobject.FireBrigadeUserDO; +import com.zcloud.zcGbsServicer.persistence.repository.FireAlarmMeetingUserRepository; +import com.zcloud.zcGbsServicer.persistence.repository.FireBrigadeUserRepository; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +@Slf4j +@Service +@RequiredArgsConstructor +public class FireBrigadeOnlineStatusService { + + private static final int USER_ONLINE_IN_MEETING = 1; + + private final FireBrigadeUserRepository fireBrigadeUserRepository; + private final FireAlarmMeetingUserRepository fireAlarmMeetingUserRepository; + private final HstVideoPlatformClient hstVideoPlatformClient; + + public Map calculateOnlineMap(List brigades) { + if (brigades == null || brigades.isEmpty()) { + return Collections.emptyMap(); + } + Set brigadeBizIds = brigades.stream() + .map(FireBrigadeDO::getFireBrigadeId) + .filter(StrUtil::isNotBlank) + .collect(Collectors.toCollection(LinkedHashSet::new)); + if (brigadeBizIds.isEmpty()) { + return Collections.emptyMap(); + } + + List allBrigadeUsers = fireBrigadeUserRepository.listAll(); + Map> brigadeUserMap = allBrigadeUsers.stream() + .filter(item -> item != null && brigadeBizIds.contains(item.getFireBrigadeId())) + .collect(Collectors.groupingBy(FireBrigadeUserDO::getFireBrigadeId, LinkedHashMap::new, Collectors.toList())); + if (brigadeUserMap.isEmpty()) { + return buildOfflineMap(brigadeBizIds); + } + + Set localUserIds = brigadeUserMap.values().stream() + .flatMap(List::stream) + .map(FireBrigadeUserDO::getUserId) + .filter(java.util.Objects::nonNull) + .collect(Collectors.toCollection(LinkedHashSet::new)); + if (localUserIds.isEmpty()) { + return buildOfflineMap(brigadeBizIds); + } + + Map meetingAccountMap = fireAlarmMeetingUserRepository.listAll().stream() + .filter(item -> item != null && item.getLocalUserId() != null) + .filter(item -> localUserIds.contains(item.getLocalUserId())) + .filter(item -> StrUtil.isNotBlank(item.getThirdUserName())) + .collect(Collectors.toMap(FireAlarmMeetingUserDO::getLocalUserId, + item -> item.getThirdUserName().trim(), + (left, right) -> left, + LinkedHashMap::new)); + if (meetingAccountMap.isEmpty()) { + return buildOfflineMap(brigadeBizIds); + } + + Set onlineMeetingAccounts = queryOnlineMeetingAccounts(new LinkedHashSet<>(meetingAccountMap.values())); + Map result = buildOfflineMap(brigadeBizIds); + if (onlineMeetingAccounts.isEmpty()) { + return result; + } + + for (Map.Entry> entry : brigadeUserMap.entrySet()) { + boolean online = entry.getValue().stream() + .map(FireBrigadeUserDO::getUserId) + .filter(java.util.Objects::nonNull) + .map(meetingAccountMap::get) + .filter(StrUtil::isNotBlank) + .anyMatch(onlineMeetingAccounts::contains); + result.put(entry.getKey(), online); + } + return result; + } + + private Set queryOnlineMeetingAccounts(Set meetingAccounts) { + if (meetingAccounts == null || meetingAccounts.isEmpty()) { + return Collections.emptySet(); + } + Set result = new LinkedHashSet<>(); + boolean authInvalid = false; + for (String meetingAccount : meetingAccounts) { + if (authInvalid) { + break; + } + try { + List> records = hstVideoPlatformClient.userOnline(meetingAccount); + if (isInMeeting(records)) { + result.add(meetingAccount); + } + } + catch (Exception ex) { + if (isInvalidAuth(ex)) { + authInvalid = true; + log.warn("查询视频平台用户在线状态失败,视频平台 HTTP API 鉴权无效,请检查 key/secret 是否为后台 HTTP API 分配的凭证,当前账号={}", + meetingAccount, ex); + continue; + } + log.warn("查询视频平台用户在线状态失败,userName={}", meetingAccount, ex); + } + } + return result; + } + + private boolean isInvalidAuth(Exception ex) { + String message = ex == null ? null : ex.getMessage(); + return StrUtil.contains(message, "无效认证信息") + || StrUtil.containsIgnoreCase(message, "1003"); + } + + private boolean isInMeeting(List> records) { + if (records == null || records.isEmpty()) { + return false; + } + for (Map record : records) { + if (record == null) { + continue; + } + Integer online = asInteger(record.get("online")); + Object roomId = record.get("roomId"); + if (hasRoomId(roomId)) { + return true; + } + if (Integer.valueOf(USER_ONLINE_IN_MEETING).equals(online)) { + return true; + } + } + return false; + } + + private boolean hasRoomId(Object roomId) { + if (roomId == null) { + return false; + } + return !(roomId instanceof String) || StrUtil.isNotBlank((String) roomId); + } + + private Integer asInteger(Object value) { + if (value == null) { + return null; + } + if (value instanceof Number) { + return ((Number) value).intValue(); + } + try { + return Integer.valueOf(String.valueOf(value)); + } + catch (Exception ex) { + return null; + } + } + + private Map buildOfflineMap(Set brigadeBizIds) { + Map result = new LinkedHashMap<>(); + for (String brigadeBizId : brigadeBizIds) { + result.put(brigadeBizId, Boolean.FALSE); + } + return result; + } +} diff --git a/web-app/src/main/java/com/zcloud/zcGbsServicer/service/FireBrigadeServiceImpl.java b/web-app/src/main/java/com/zcloud/zcGbsServicer/service/FireBrigadeServiceImpl.java index 259ffb3..d6dcd7a 100644 --- a/web-app/src/main/java/com/zcloud/zcGbsServicer/service/FireBrigadeServiceImpl.java +++ b/web-app/src/main/java/com/zcloud/zcGbsServicer/service/FireBrigadeServiceImpl.java @@ -35,6 +35,7 @@ public class FireBrigadeServiceImpl extends FireAlarmServiceSupport implements F private final FireBrigadeRepository fireBrigadeRepository; private final FireBrigadeUserRepository fireBrigadeUserRepository; private final FireAlarmUserResolver fireAlarmUserResolver; + private final FireBrigadeOnlineStatusService fireBrigadeOnlineStatusService; private final FireBrigadeCoConvertor fireBrigadeCoConvertor; @Override @@ -45,8 +46,9 @@ public class FireBrigadeServiceImpl extends FireAlarmServiceSupport implements F params.put("brigadeName", qry.getName()); PageResponse page = fireBrigadeRepository.listPage(params); Map userMap = getLeaderUserMap(page.getData()); + Map onlineMap = fireBrigadeOnlineStatusService.calculateOnlineMap(page.getData()); List data = page.getData().stream() - .map(item -> buildCO(item, userMap)) + .map(item -> buildCO(item, userMap, onlineMap)) .collect(Collectors.toList()); return PageResponse.of(data, page.getTotalCount(), page.getPageSize(), page.getPageIndex()); } @@ -67,7 +69,9 @@ public class FireBrigadeServiceImpl extends FireAlarmServiceSupport implements F fillBrigade(brigade, cmd); fireBrigadeRepository.save(brigade); ensureLeaderRelation(brigade); - return SingleResponse.of(buildCO(brigade, getLeaderUserMap(Collections.singletonList(brigade)))); + return SingleResponse.of(buildCO(brigade, + getLeaderUserMap(Collections.singletonList(brigade)), + fireBrigadeOnlineStatusService.calculateOnlineMap(Collections.singletonList(brigade)))); } @Override @@ -95,7 +99,9 @@ public class FireBrigadeServiceImpl extends FireAlarmServiceSupport implements F if (brigade == null) { throw new BizException("消防队伍不存在"); } - return buildCO(brigade, getLeaderUserMap(Collections.singletonList(brigade))); + return buildCO(brigade, + getLeaderUserMap(Collections.singletonList(brigade)), + fireBrigadeOnlineStatusService.calculateOnlineMap(Collections.singletonList(brigade))); } @Override @@ -159,15 +165,17 @@ public class FireBrigadeServiceImpl extends FireAlarmServiceSupport implements F relation.setOrgName(brigade.getLeaderDeptName()); } - private FireBrigadeCO buildCO(FireBrigadeDO brigade, Map userMap) { + private FireBrigadeCO buildCO(FireBrigadeDO brigade, Map userMap, + Map onlineMap) { FireBrigadeCO co = fireBrigadeCoConvertor.converDOToCO(brigade); ZcloudUserCo leader = brigade.getLeaderUserId() == null ? null : userMap.get(brigade.getLeaderUserId()); co.setLeaderDeptName(selectText(leader == null ? null : leader.getDepartmentName(), co.getLeaderDeptName())); co.setLeaderName(selectText(leader == null ? null : leader.getName(), co.getLeaderName())); co.setLeaderPhone(selectText(leader == null ? null : leader.getPhone(), co.getLeaderPhone())); co.setMemberCount(fireBrigadeUserRepository.listByFireBrigadeId(brigade.getFireBrigadeId()).size()); - co.setOnline(Boolean.FALSE); - co.setOnlineText("未统计"); + boolean online = onlineMap != null && Boolean.TRUE.equals(onlineMap.get(brigade.getFireBrigadeId())); + co.setOnline(online); + co.setOnlineText(online ? "在线" : "未在线"); return co; } diff --git a/web-app/src/main/java/com/zcloud/zcGbsServicer/service/HstVideoPlatformClient.java b/web-app/src/main/java/com/zcloud/zcGbsServicer/service/HstVideoPlatformClient.java new file mode 100644 index 0000000..7621c4d --- /dev/null +++ b/web-app/src/main/java/com/zcloud/zcGbsServicer/service/HstVideoPlatformClient.java @@ -0,0 +1,199 @@ +package com.zcloud.zcGbsServicer.service; + +import cn.hutool.core.util.StrUtil; +import com.alibaba.cola.exception.BizException; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.stereotype.Component; +import org.springframework.web.client.HttpStatusCodeException; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.util.UriUtils; + +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Base64; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +@Component +@RequiredArgsConstructor +@SuppressWarnings("unchecked") +public class HstVideoPlatformClient { + + private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + private final HstVideoPlatformProperties properties; + + public String generateToken() { + validateConfig(); + long timestamp = System.currentTimeMillis(); + String headerJson = "{\"alg\":\"" + StrUtil.blankToDefault(properties.getAlgorithm(), "SHA256") + "\"}"; + String payloadJson = "{\"key\":\"" + properties.getAuthKey() + "\",\"timestamp\":" + timestamp + "}"; + String header = Base64.getEncoder().encodeToString(headerJson.getBytes(StandardCharsets.UTF_8)); + String payload = Base64.getEncoder().encodeToString(payloadJson.getBytes(StandardCharsets.UTF_8)); + String signature = sha256Hex(header + payload + properties.getAuthSecret()); + return header + "." + payload + "." + signature; + } + + public String formatExpireTime() { + return TIME_FORMATTER.format(LocalDateTime.now().plusMinutes(10)); + } + + public Map createInstant(Map body) { + return post("/api/v1/room/createInstant", body); + } + + public Map authUser(Map body) { + return post("/api/v1/room/authUser", body); + } + + public Map authRoom(Map body) { + return post("/api/v1/room/authRoom", body); + } + + public Map addRoomInfo(Map body) { + return post("/api/v1/room/addRoomInfo", body); + } + + public Map onlineRoom(Map body) { + return post("/api/v1/room/onlineRoom", body); + } + + public Map departmentList(Map body) { + return post("/api/v1/department/list", body); + } + + public Map userList(Map body) { + return post("/api/v1/user/list", body); + } + + public Map addUser(Map body) { + return post("/api/v1/user/add", body); + } + + public Map deleteUser(Map body) { + return post("/api/v1/user/del", body); + } + + public Map participant(Map body) { + return post("/api/v1/room/participant", body); + } + + public Map roomLog(Map body) { + return post("/api/v1/room/roomLog", body); + } + + public Map userInRoom(Map body) { + return post("/api/v1/room/userInRoom", body); + } + + public List> userOnline(String userName) { + if (StrUtil.isBlank(userName)) { + return Collections.emptyList(); + } + Map response = get("/api/v1/user/online/" + + UriUtils.encodePathSegment(userName.trim(), StandardCharsets.UTF_8)); + ensureSuccess(response, "获取用户在线状态"); + Object data = response.get("data"); + if (!(data instanceof List)) { + return Collections.emptyList(); + } + return (List>) data; + } + + public Map loginAddr() { + return get("/api/v1/room/loginAddr"); + } + + public void ensureSuccess(Map response, String actionName) { + String code = response == null ? null : asText(response.get("code")); + if (StrUtil.isBlank(code) || "0".equals(code) || "200".equals(code)) { + return; + } + String msg = response == null ? null : asText(response.get("msg")); + throw new BizException(actionName + "失败" + (StrUtil.isBlank(msg) ? "" : ":" + msg)); + } + + private Map post(String path, Map body) { + return request(path, HttpMethod.POST, body == null ? Collections.emptyMap() : body); + } + + private Map get(String path) { + return request(path, HttpMethod.GET, null); + } + + private Map request(String path, HttpMethod method, Object body) { + validateConfig(); + RestTemplate restTemplate = createRestTemplate(); + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + headers.set("Authorization", generateToken()); + HttpEntity requestEntity = new HttpEntity<>(body, headers); + try { + ResponseEntity response = restTemplate.exchange(buildUrl(path), method, requestEntity, Map.class); + return response.getBody() == null ? new LinkedHashMap<>() : response.getBody(); + } + catch (HttpStatusCodeException ex) { + throw new BizException("调用视频平台失败:" + ex.getResponseBodyAsString()); + } + catch (Exception ex) { + throw new BizException("调用视频平台失败:" + ex.getMessage()); + } + } + + private RestTemplate createRestTemplate() { + SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); + requestFactory.setConnectTimeout(properties.getConnectTimeoutMs() == null ? 10000 : properties.getConnectTimeoutMs()); + requestFactory.setReadTimeout(properties.getReadTimeoutMs() == null ? 15000 : properties.getReadTimeoutMs()); + return new RestTemplate(requestFactory); + } + + private String buildUrl(String path) { + String baseUrl = StrUtil.blankToDefault(properties.getApiBaseUrl(), properties.getWebBaseUrl()); + if (StrUtil.isBlank(baseUrl)) { + throw new BizException("视频平台地址未配置"); + } + return StrUtil.removeSuffix(baseUrl.trim(), "/") + path; + } + + private void validateConfig() { + if (StrUtil.isBlank(properties.getAuthKey())) { + throw new BizException("视频平台 HTTP API key 未配置"); + } + if (StrUtil.isBlank(properties.getAuthSecret())) { + throw new BizException("视频平台 HTTP API secret 未配置"); + } + } + + private String sha256Hex(String source) { + try { + MessageDigest digest = MessageDigest.getInstance("SHA-256"); + byte[] bytes = digest.digest(source.getBytes(StandardCharsets.UTF_8)); + StringBuilder builder = new StringBuilder(); + for (byte item : bytes) { + String hex = Integer.toHexString(item & 0xFF); + if (hex.length() == 1) { + builder.append('0'); + } + builder.append(hex); + } + return builder.toString(); + } + catch (Exception ex) { + throw new BizException("生成视频平台令牌失败:" + ex.getMessage()); + } + } + + private String asText(Object value) { + return value == null ? null : String.valueOf(value); + } +} diff --git a/web-app/src/main/java/com/zcloud/zcGbsServicer/service/HstVideoPlatformProperties.java b/web-app/src/main/java/com/zcloud/zcGbsServicer/service/HstVideoPlatformProperties.java new file mode 100644 index 0000000..fbe89c7 --- /dev/null +++ b/web-app/src/main/java/com/zcloud/zcGbsServicer/service/HstVideoPlatformProperties.java @@ -0,0 +1,68 @@ +package com.zcloud.zcGbsServicer.service; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.util.List; + +@Data +@Component +public class HstVideoPlatformProperties { + + @Value("${video.platform.hst.api-base-url:https://5uw.haoshitong.com:28443}") + private String apiBaseUrl; + + @Value("${video.platform.hst.web-base-url:https://5uw.haoshitong.com:28443}") + private String webBaseUrl; + + @Value("${video.platform.hst.client-id:}") + private String clientId; + + @Value("${video.platform.hst.client-secret:}") + private String clientSecret; + + @Value("${video.platform.hst.key:}") + private String key; + + @Value("${video.platform.hst.secret:}") + private String secret; + + @Value("${video.platform.hst.algorithm:SHA256}") + private String algorithm; + + @Value("${video.platform.hst.default-room-code:DEFAULT_DUTY_ROOM}") + private String defaultRoomCode; + + @Value("${video.platform.hst.default-room-no:20708}") + private String defaultRoomNo; + + @Value("${video.platform.hst.default-user-password:}") + private String defaultUserPassword; + + @Value("${video.platform.hst.fire-user-prefix:xfbj}") + private String fireUserPrefix; + + @Value("${video.platform.hst.default-depart-id:1}") + private String defaultDepartId; + + @Value("${video.platform.hst.client-port:1089}") + private String clientPort; + + @Value("${video.platform.hst.connect-timeout-ms:10000}") + private Integer connectTimeoutMs; + + @Value("${video.platform.hst.read-timeout-ms:15000}") + private Integer readTimeoutMs; + + @Value("#{'${video.platform.hst.test-accounts:xfbj00,xfbj01,xfbj02,xfbj03,xfbj04,xfbj05,xfbj06,xfbj07,xfbj08,xfbj09}'.split(',')}") + private List testAccounts; + + public String getAuthKey() { + return org.springframework.util.StringUtils.hasText(key) ? key : clientId; + } + + public String getAuthSecret() { + return org.springframework.util.StringUtils.hasText(secret) ? secret : clientSecret; + } +} 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 new file mode 100644 index 0000000..aa6251e --- /dev/null +++ b/web-app/src/main/java/com/zcloud/zcGbsServicer/service/VideoPlatformServiceImpl.java @@ -0,0 +1,772 @@ +package com.zcloud.zcGbsServicer.service; + +import cn.hutool.core.util.StrUtil; +import com.alibaba.cola.dto.SingleResponse; +import com.alibaba.cola.exception.BizException; +import com.zcloud.zcGbsServicer.api.VideoPlatformServiceI; +import com.zcloud.zcGbsServicer.dto.VideoPlatformDepartmentQry; +import com.zcloud.zcGbsServicer.dto.VideoPlatformFixedRoomLeaveCmd; +import com.zcloud.zcGbsServicer.dto.VideoPlatformFixedRoomLoginCmd; +import com.zcloud.zcGbsServicer.dto.VideoPlatformFixedRoomQry; +import com.zcloud.zcGbsServicer.dto.VideoPlatformMeetingAccessCheckQry; +import com.zcloud.zcGbsServicer.dto.VideoPlatformMeetingMemberQry; +import com.zcloud.zcGbsServicer.dto.VideoPlatformUserQry; +import com.zcloud.zcGbsServicer.dto.VideoRoomAuthRoomCmd; +import com.zcloud.zcGbsServicer.dto.VideoRoomAuthUserCmd; +import com.zcloud.zcGbsServicer.dto.VideoRoomCreateInstantCmd; +import com.zcloud.zcGbsServicer.dto.VideoRoomOnlineRoomQry; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformConfigCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformCurrentMeetingCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformLoginCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformMeetingAccessCheckCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformMeetingLogCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformMeetingMemberStatusCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformMeetingParticipantCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformOnlineRoomCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformOnlineRoomPageCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformResultCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformTokenCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoRoomInstantCO; +import com.zcloud.zcGbsServicer.persistence.dataobject.FireAlarmMeetingRoomDO; +import com.zcloud.zcGbsServicer.persistence.dataobject.FireAlarmMeetingUserDO; +import com.zcloud.zcGbsServicer.persistence.dataobject.FireBrigadeDO; +import com.zcloud.zcGbsServicer.persistence.dataobject.FireBrigadeUserDO; +import com.zcloud.zcGbsServicer.persistence.repository.FireAlarmMeetingRoomRepository; +import com.zcloud.zcGbsServicer.persistence.repository.FireAlarmMeetingUserRepository; +import com.zcloud.zcGbsServicer.persistence.repository.FireBrigadeRepository; +import com.zcloud.zcGbsServicer.persistence.repository.FireBrigadeUserRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +@Service +@RequiredArgsConstructor +@SuppressWarnings("unchecked") +public class VideoPlatformServiceImpl extends FireAlarmServiceSupport implements VideoPlatformServiceI { + + private static final int AUTH_STATUS_SUCCESS = 1; + private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + private final HstVideoPlatformProperties properties; + private final HstVideoPlatformClient hstVideoPlatformClient; + private final FireAlarmMeetingRoomRepository fireAlarmMeetingRoomRepository; + private final FireAlarmMeetingUserRepository fireAlarmMeetingUserRepository; + private final FireBrigadeRepository fireBrigadeRepository; + private final FireBrigadeUserRepository fireBrigadeUserRepository; + + @Override + public SingleResponse getConfig() { + VideoPlatformConfigCO co = new VideoPlatformConfigCO(); + co.setApiBaseUrl(properties.getApiBaseUrl()); + co.setWebBaseUrl(properties.getWebBaseUrl()); + co.setClientPort(properties.getClientPort()); + co.setDefaultRoomCode(properties.getDefaultRoomCode()); + co.setDefaultRoomNo(properties.getDefaultRoomNo()); + co.setDefaultUserPassword(properties.getDefaultUserPassword()); + co.setTestAccounts(properties.getTestAccounts()); + return SingleResponse.of(co); + } + + @Override + public SingleResponse generateToken() { + VideoPlatformTokenCO co = new VideoPlatformTokenCO(); + co.setToken(hstVideoPlatformClient.generateToken()); + co.setExpireTime(hstVideoPlatformClient.formatExpireTime()); + co.setApiBaseUrl(properties.getApiBaseUrl()); + co.setWebBaseUrl(properties.getWebBaseUrl()); + return SingleResponse.of(co); + } + + @Override + public SingleResponse createInstant(VideoRoomCreateInstantCmd cmd) { + String meetingName = StrUtil.blankToDefault(cmd.getMeetingName(), "消防报警即时会议"); + String userName = StrUtil.blankToDefault(cmd.getUserName(), currentUserName()); + if (StrUtil.isBlank(userName)) { + userName = "消防报警"; + } + + Map requestBody = new LinkedHashMap<>(); + requestBody.put("meetingName", meetingName); + requestBody.put("userName", userName); + putIfNotNull(requestBody, "meetingTemplate", cmd.getMeetingTemplate()); + putIfNotNull(requestBody, "meetingType", cmd.getMeetingType()); + putIfNotNull(requestBody, "verifyMode", cmd.getVerifyMode()); + putIfNotNull(requestBody, "departId", cmd.getDepartId()); + putIfNotNull(requestBody, "maxUserCount", cmd.getMaxUserCount()); + putIfNotBlank(requestBody, "password", cmd.getPassword()); + putIfNotBlank(requestBody, "chairPassword", cmd.getChairPassword()); + putIfNotBlank(requestBody, "enableInvite", cmd.getEnableInvite()); + putIfNotBlank(requestBody, "enableChairPwd", cmd.getEnableChairPwd()); + putIfNotBlank(requestBody, "autoRecord", cmd.getAutoRecord()); + putIfNotBlank(requestBody, "roomMode", cmd.getRoomMode()); + putIfNotBlank(requestBody, "source", cmd.getSource()); + putIfNotBlank(requestBody, "menteeAdvance", cmd.getMenteeAdvance()); + + Map response = hstVideoPlatformClient.createInstant(requestBody); + hstVideoPlatformClient.ensureSuccess(response, "创建即时会议室"); + Map data = castMap(response.get("data")); + + VideoRoomInstantCO co = new VideoRoomInstantCO(); + co.setMeetingName(selectText(asText(data.get("meetingName")), meetingName)); + co.setRoomId(asText(data.get("roomId"))); + co.setPassword(selectText(asText(data.get("password")), cmd.getPassword())); + co.setUserName(userName); + co.setCesAddr(properties.getWebBaseUrl()); + co.setWebUrl(properties.getWebBaseUrl()); + co.setToken(hstVideoPlatformClient.generateToken()); + co.setUserPass(properties.getDefaultUserPassword()); + co.setGrantType("password"); + co.setExpireTime(hstVideoPlatformClient.formatExpireTime()); + co.setResultMsg(selectText(asText(response.get("msg")), "即时会议室创建成功")); + co.setInviteCode(asText(data.get("inviteCode"))); + co.setMaxUserCount(asInteger(data.get("maxUserCount"))); + co.setVerifyMode(asInteger(data.get("verifyMode"))); + co.setMeetingType(asInteger(data.get("meetingType"))); + co.setMeetingTemplate(asInteger(data.get("meetingTemplate"))); + co.setCreateTime(asText(data.get("createTime"))); + co.setCreatorId(asText(data.get("creatorId"))); + co.setLoginAddrList(safeGetLoginAddr()); + return SingleResponse.of(co); + } + + @Override + public SingleResponse authUser(VideoRoomAuthUserCmd cmd) { + Map requestBody = new LinkedHashMap<>(); + requestBody.put("roomId", toNumericOrText(String.valueOf(cmd.getRoomId()))); + requestBody.put("roomUserStr", cmd.getRoomUserStr().trim()); + requestBody.put("authType", cmd.getAuthType() == null ? 1 : cmd.getAuthType()); + Map response = hstVideoPlatformClient.authUser(requestBody); + hstVideoPlatformClient.ensureSuccess(response, "会议室授权用户"); + return SingleResponse.of(buildResultCO(response)); + } + + @Override + public SingleResponse authRoom(VideoRoomAuthRoomCmd cmd) { + Map requestBody = new LinkedHashMap<>(); + requestBody.put("roomUserStr", cmd.getRoomUserStr().trim()); + requestBody.put("userName", cmd.getUserName().trim()); + Map response = hstVideoPlatformClient.authRoom(requestBody); + hstVideoPlatformClient.ensureSuccess(response, "用户授权会议室"); + return SingleResponse.of(buildResultCO(response)); + } + + @Override + public List getLoginAddr() { + Map response = hstVideoPlatformClient.loginAddr(); + hstVideoPlatformClient.ensureSuccess(response, "获取登录地址"); + Object data = response.get("data"); + if (!(data instanceof List)) { + return Collections.emptyList(); + } + List result = new ArrayList<>(); + for (Object item : (List) data) { + if (item != null) { + result.add(String.valueOf(item)); + } + } + return result; + } + + @Override + public SingleResponse onlineRoom(VideoRoomOnlineRoomQry qry) { + Map requestBody = new LinkedHashMap<>(); + putIfNotNull(requestBody, "departId", qry.getDepartId()); + requestBody.put("pageNumber", qry.getPageNumber() == null || qry.getPageNumber() <= 0 ? 1 : qry.getPageNumber()); + requestBody.put("pageSize", qry.getPageSize() == null || qry.getPageSize() <= 0 ? 10 : qry.getPageSize()); + + Map response = hstVideoPlatformClient.onlineRoom(requestBody); + hstVideoPlatformClient.ensureSuccess(response, "查询在线会议"); + Map data = castMap(response.get("data")); + + VideoPlatformOnlineRoomPageCO co = new VideoPlatformOnlineRoomPageCO(); + co.setCurrent(asInteger(data.get("current"))); + co.setPages(asInteger(data.get("pages"))); + co.setSize(asInteger(data.get("size"))); + co.setTotal(asInteger(data.get("total"))); + co.setRecords(buildOnlineRoomRecords(data.get("records"))); + return SingleResponse.of(co); + } + + @Override + public SingleResponse departmentList(VideoPlatformDepartmentQry qry) { + Map requestBody = new LinkedHashMap<>(); + if (StrUtil.isNotBlank(qry.getDepartId())) { + requestBody.put("departId", toNumericOrText(qry.getDepartId())); + } + putIfNotBlank(requestBody, "departName", qry.getDepartName()); + putIfNotBlank(requestBody, "code", qry.getCode()); + requestBody.put("pageNumber", qry.getPageNumber() == null || qry.getPageNumber() <= 0 ? 1 : qry.getPageNumber()); + requestBody.put("pageSize", qry.getPageSize() == null || qry.getPageSize() <= 0 ? 100 : qry.getPageSize()); + + Map response = hstVideoPlatformClient.departmentList(requestBody); + hstVideoPlatformClient.ensureSuccess(response, "查询视频平台组织架构"); + return SingleResponse.of(buildResultCO(response)); + } + + @Override + public SingleResponse userList(VideoPlatformUserQry qry) { + Map requestBody = new LinkedHashMap<>(); + putIfNotBlank(requestBody, "searchKey", qry.getSearchKey()); + putIfNotBlank(requestBody, "searchType", qry.getSearchType()); + if (StrUtil.isNotBlank(qry.getDepartId())) { + requestBody.put("departId", toNumericOrText(qry.getDepartId())); + } + requestBody.put("pageNumber", qry.getPageNumber() == null || qry.getPageNumber() <= 0 ? 1 : qry.getPageNumber()); + requestBody.put("pageSize", qry.getPageSize() == null || qry.getPageSize() <= 0 ? 100 : qry.getPageSize()); + + Map response = hstVideoPlatformClient.userList(requestBody); + hstVideoPlatformClient.ensureSuccess(response, "查询视频平台用户"); + return SingleResponse.of(buildResultCO(response)); + } + + @Override + public SingleResponse currentFixedMeeting(VideoPlatformFixedRoomQry qry) { + FixedRoomContext context = resolveFixedRoom(qry.getRoomCode()); + VideoPlatformOnlineRoomCO onlineRoom = findOnlineFixedRoom(context); + FireAlarmMeetingUserDO currentMeetingUser = resolveCurrentMeetingUser(qry.getLocalUserId(), false); + + VideoPlatformCurrentMeetingCO co = new VideoPlatformCurrentMeetingCO(); + co.setRoomCode(context.roomCode); + co.setRoomId(context.roomId); + co.setRoomNo(context.roomNo); + co.setRoomName(onlineRoom == null ? context.roomName : selectText(onlineRoom.getRoomName(), context.roomName)); + co.setOnline(onlineRoom != null); + co.setCurUserCount(onlineRoom == null ? 0 : onlineRoom.getCurUserCount()); + co.setStatus(onlineRoom == null ? null : onlineRoom.getStatus()); + co.setStartTime(onlineRoom == null ? null : onlineRoom.getStartTime()); + co.setEndTime(onlineRoom == null ? null : onlineRoom.getEndTime()); + co.setThirdUserName(currentMeetingUser == null ? null : currentMeetingUser.getThirdUserName()); + co.setUserPass(properties.getDefaultUserPassword()); + co.setGrantType("password"); + co.setCesAddr(properties.getWebBaseUrl()); + co.setWebUrl(properties.getWebBaseUrl()); + co.setResultMsg(onlineRoom == null ? "固定会议当前未在线" : "固定会议正在进行"); + return SingleResponse.of(co); + } + + @Override + public SingleResponse checkFixedMeetingAccess(VideoPlatformMeetingAccessCheckQry qry) { + FixedRoomContext context = resolveFixedRoom(qry.getRoomCode()); + Long localUserId = qry.getLocalUserId() == null ? currentUserId() : qry.getLocalUserId(); + if (localUserId == null) { + throw new BizException("当前登录用户不存在"); + } + + FireAlarmMeetingUserDO meetingUser = resolveCurrentMeetingUser(localUserId, true); + FireBrigadeUserDO relation = resolveUserBrigadeRelation(localUserId, qry.getFireBrigadeBizId()); + FireBrigadeDO brigade = relation == null ? null : fireBrigadeRepository.getByFireBrigadeId(relation.getFireBrigadeId()); + + VideoPlatformMeetingAccessCheckCO co = new VideoPlatformMeetingAccessCheckCO(); + co.setAllowed(false); + co.setRoomCode(context.roomCode); + co.setRoomId(context.roomId); + co.setRoomName(context.roomName); + co.setLocalUserId(localUserId); + co.setLocalUserName(meetingUser == null ? null : meetingUser.getLocalUserName()); + co.setThirdUserName(meetingUser == null ? null : meetingUser.getThirdUserName()); + co.setUserPass(properties.getDefaultUserPassword()); + + 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)); + return SingleResponse.of(co); + } + + String fireBrigadeId = relation.getFireBrigadeId(); + co.setFireBrigadeId(fireBrigadeId); + 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("当前用户已在会议中"); + 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); + co.setOccupied(false); + co.setReason("允许入会"); + return SingleResponse.of(co); + } + + @Override + public SingleResponse fixedMeetingMembers(VideoPlatformMeetingMemberQry qry) { + FixedRoomContext context = resolveFixedRoom(qry.getRoomCode()); + List participants = buildParticipants(context, currentUserId()); + + VideoPlatformMeetingMemberStatusCO co = new VideoPlatformMeetingMemberStatusCO(); + co.setRoomCode(context.roomCode); + co.setRoomId(context.roomId); + co.setRoomName(context.roomName); + co.setParticipantCount(participants.size()); + co.setParticipants(participants); + if (Boolean.FALSE.equals(qry.getIncludeLogs())) { + co.setLogQuerySuccess(true); + co.setLogQueryMsg("未查询进退会日志"); + co.setLogs(Collections.emptyList()); + } + else { + try { + co.setLogs(buildRoomLogs(context, qry)); + co.setLogQuerySuccess(true); + co.setLogQueryMsg("查询成功"); + } + catch (BizException ex) { + co.setLogs(Collections.emptyList()); + co.setLogQuerySuccess(false); + co.setLogQueryMsg(ex.getMessage()); + } + } + return SingleResponse.of(co); + } + + @Override + public SingleResponse fixedRoomLogin(VideoPlatformFixedRoomLoginCmd cmd) { + VideoPlatformMeetingAccessCheckQry checkQry = new VideoPlatformMeetingAccessCheckQry(); + checkQry.setRoomCode(cmd.getRoomCode()); + checkQry.setLocalUserId(cmd.getLocalUserId()); + VideoPlatformMeetingAccessCheckCO access = checkFixedMeetingAccess(checkQry).getData(); + if (access == null || !Boolean.TRUE.equals(access.getAllowed())) { + throw new BizException(access == null ? "当前用户不允许入会" : access.getReason()); + } + + FixedRoomContext context = resolveFixedRoom(cmd.getRoomCode()); + String thirdUserName = StrUtil.blankToDefault(cmd.getThirdUserName(), access.getThirdUserName()); + if (StrUtil.isBlank(thirdUserName)) { + throw new BizException("当前用户未配置第三方会议账号"); + } + + VideoPlatformLoginCO co = new VideoPlatformLoginCO(); + co.setRoomCode(context.roomCode); + co.setRoomId(context.roomId); + co.setRoomNo(context.roomNo); + co.setMeetingName(context.roomName); + co.setPassword(context.roomPassword); + co.setThirdUserName(thirdUserName.trim()); + co.setToken(null); + co.setUserPass(properties.getDefaultUserPassword()); + co.setGrantType("password"); + co.setCesAddr(properties.getWebBaseUrl()); + co.setWebUrl(properties.getWebBaseUrl()); + co.setLoginAddrList(Collections.emptyList()); + co.setLoginUrl(properties.getWebBaseUrl()); + co.setAuthStatus(AUTH_STATUS_SUCCESS); + co.setAuthorizedUserCount(null); + co.setResultMsg("固定会议室入会参数获取成功"); + return SingleResponse.of(co); + } + + @Override + public SingleResponse fixedRoomLeave(VideoPlatformFixedRoomLeaveCmd cmd) { + VideoPlatformResultCO co = new VideoPlatformResultCO(); + co.setCode("200"); + co.setMsg("离会成功"); + Map data = new LinkedHashMap<>(); + data.put("localUserId", cmd.getLocalUserId() == null ? currentUserId() : cmd.getLocalUserId()); + data.put("alarmId", cmd.getAlarmId()); + data.put("traceMode", "frontend-sdk"); + co.setData(data); + return SingleResponse.of(co); + } + + private FixedRoomContext resolveFixedRoom(String roomCode) { + String actualRoomCode = StrUtil.blankToDefault(roomCode, properties.getDefaultRoomCode()); + FireAlarmMeetingRoomDO room = fireAlarmMeetingRoomRepository.getByRoomCode(actualRoomCode); + FixedRoomContext context = new FixedRoomContext(); + context.room = room; + context.roomCode = actualRoomCode; + context.roomId = resolveRoomId(room); + context.roomNo = resolveRoomNo(room); + context.roomName = resolveRoomName(room); + context.roomPassword = room == null ? null : room.getRoomPasswordCipher(); + return context; + } + + private FireAlarmMeetingUserDO resolveCurrentMeetingUser(Long localUserId, boolean required) { + Long actualLocalUserId = localUserId == null ? currentUserId() : localUserId; + FireAlarmMeetingUserDO meetingUser = actualLocalUserId == null ? null : fireAlarmMeetingUserRepository.getByLocalUserId(actualLocalUserId); + if (required && meetingUser == null) { + throw new BizException("当前用户未配置会议账号映射"); + } + return meetingUser; + } + + private FireBrigadeUserDO resolveUserBrigadeRelation(Long localUserId, String fireBrigadeBizId) { + List relations = fireBrigadeUserRepository.listByUserId(localUserId); + if (relations == null || relations.isEmpty()) { + return null; + } + if (StrUtil.isBlank(fireBrigadeBizId)) { + return relations.get(0); + } + return relations.stream() + .filter(item -> fireBrigadeBizId.trim().equals(item.getFireBrigadeId())) + .findFirst() + .orElse(null); + } + + private VideoPlatformOnlineRoomCO findOnlineFixedRoom(FixedRoomContext context) { + Map requestBody = new LinkedHashMap<>(); + requestBody.put("pageNumber", 1); + requestBody.put("pageSize", 100); + Map response = hstVideoPlatformClient.onlineRoom(requestBody); + hstVideoPlatformClient.ensureSuccess(response, "查询企业当前会议"); + List rooms = buildOnlineRoomRecords(castMap(response.get("data")).get("records")); + for (VideoPlatformOnlineRoomCO room : rooms) { + if (sameRoom(context, room.getRoomId())) { + return room; + } + } + return null; + } + + private List buildParticipants(FixedRoomContext context, Long currentLocalUserId) { + Map requestBody = new LinkedHashMap<>(); + requestBody.put("roomId", toNumericOrText(context.roomId)); + requestBody.put("pageNumber", 1); + requestBody.put("pageSize", 200); + Map response; + try { + response = hstVideoPlatformClient.participant(requestBody); + hstVideoPlatformClient.ensureSuccess(response, "获取会议当前用户列表"); + } + catch (BizException ex) { + if (isRoomNotOnline(ex.getMessage())) { + return Collections.emptyList(); + } + throw ex; + } + + Map meetingUserMap = buildMeetingUserMap(); + List thirdUserNames = extractUserNames(response.get("data")); + List result = new ArrayList<>(); + for (String thirdUserName : thirdUserNames) { + FireAlarmMeetingUserDO meetingUser = meetingUserMap.get(normalize(thirdUserName)); + VideoPlatformMeetingParticipantCO co = new VideoPlatformMeetingParticipantCO(); + co.setThirdUserName(thirdUserName); + co.setLocalUserId(meetingUser == null ? null : meetingUser.getLocalUserId()); + co.setLocalUserName(meetingUser == null ? null : meetingUser.getLocalUserName()); + co.setLocalPhone(meetingUser == null ? null : meetingUser.getLocalPhone()); + co.setFireBrigadeId(meetingUser == null ? null : meetingUser.getFireBrigadeId()); + co.setFireBrigadeName(meetingUser == null ? null : meetingUser.getFireBrigadeName()); + co.setCurrentUser(currentLocalUserId != null && Objects.equals(currentLocalUserId, co.getLocalUserId())); + result.add(co); + } + return result; + } + + private List buildRoomLogs(FixedRoomContext context, VideoPlatformMeetingMemberQry qry) { + Map requestBody = new LinkedHashMap<>(); + requestBody.put("departId", resolveRoomLogDepartId(qry)); + requestBody.put("startTime", selectText(qry.getStartTime(), TIME_FORMATTER.format(LocalDate.now().atStartOfDay()))); + requestBody.put("endTime", selectText(qry.getEndTime(), TIME_FORMATTER.format(LocalDateTime.now()))); + Map response = hstVideoPlatformClient.roomLog(requestBody); + hstVideoPlatformClient.ensureSuccess(response, "查询会议室参会人信息"); + + Map meetingUserMap = buildMeetingUserMap(); + List> rows = extractRows(response.get("data")); + List result = new ArrayList<>(); + for (Map row : rows) { + if (!sameRoom(context, asText(row.get("roomId")))) { + continue; + } + String thirdUserName = selectText(asText(row.get("userName")), asText(row.get("thirdUserName"))); + FireAlarmMeetingUserDO meetingUser = meetingUserMap.get(normalize(thirdUserName)); + VideoPlatformMeetingLogCO co = new VideoPlatformMeetingLogCO(); + co.setRoomId(asText(row.get("roomId"))); + co.setRoomName(asText(row.get("roomName"))); + co.setThirdUserName(thirdUserName); + co.setLocalUserId(meetingUser == null ? null : meetingUser.getLocalUserId()); + co.setLocalUserName(meetingUser == null ? null : meetingUser.getLocalUserName()); + co.setFireBrigadeId(meetingUser == null ? null : meetingUser.getFireBrigadeId()); + co.setFireBrigadeName(meetingUser == null ? null : meetingUser.getFireBrigadeName()); + co.setEnterTime(asText(row.get("enterTime"))); + co.setLeaveTime(asText(row.get("leaveTime"))); + co.setDuration(asText(row.get("duration"))); + co.setStatus(StrUtil.isBlank(co.getLeaveTime()) ? "IN_ROOM" : "LEFT"); + result.add(co); + } + return result; + } + + private Object resolveRoomLogDepartId(VideoPlatformMeetingMemberQry qry) { + if (StrUtil.isNotBlank(qry.getDepartId())) { + return toNumericOrText(qry.getDepartId()); + } + FireAlarmMeetingUserDO meetingUser = resolveCurrentMeetingUser(currentUserId(), false); + if (meetingUser != null && StrUtil.isNotBlank(meetingUser.getThirdUserName())) { + String departId = queryUserDepartId(meetingUser.getThirdUserName()); + if (StrUtil.isNotBlank(departId)) { + return toNumericOrText(departId); + } + } + return toNumericOrText(StrUtil.blankToDefault(properties.getDefaultDepartId(), "1")); + } + + private String queryUserDepartId(String thirdUserName) { + Map requestBody = new LinkedHashMap<>(); + requestBody.put("searchKey", thirdUserName.trim()); + requestBody.put("searchType", "1"); + requestBody.put("pageNumber", 1); + requestBody.put("pageSize", 20); + Map response = hstVideoPlatformClient.userList(requestBody); + hstVideoPlatformClient.ensureSuccess(response, "查询视频平台用户"); + Object data = response.get("data"); + if (!(data instanceof Map)) { + return null; + } + Object records = castMap(data).get("records"); + if (!(records instanceof List)) { + return null; + } + for (Object item : (List) records) { + if (!(item instanceof Map)) { + continue; + } + Map row = castMap(item); + if (thirdUserName.trim().equalsIgnoreCase(asText(row.get("userName")))) { + return asText(row.get("departId")); + } + } + return null; + } + + private Map buildMeetingUserMap() { + List users = fireAlarmMeetingUserRepository.listAll(); + if (users == null || users.isEmpty()) { + return Collections.emptyMap(); + } + return users.stream() + .filter(item -> StrUtil.isNotBlank(item.getThirdUserName())) + .collect(Collectors.toMap(item -> normalize(item.getThirdUserName()), item -> item, (first, second) -> first)); + } + + private List extractUserNames(Object data) { + Object records = extractRecords(data); + if (!(records instanceof List)) { + return Collections.emptyList(); + } + List result = new ArrayList<>(); + for (Object item : (List) records) { + String userName; + if (item instanceof Map) { + Map row = castMap(item); + userName = selectText(asText(row.get("userName")), selectText(asText(row.get("thirdUserName")), asText(row.get("name")))); + } + else { + userName = asText(item); + } + if (StrUtil.isNotBlank(userName)) { + result.add(userName.trim()); + } + } + return result; + } + + private List> extractRows(Object data) { + Object records = extractRecords(data); + if (!(records instanceof List)) { + return Collections.emptyList(); + } + List> result = new ArrayList<>(); + for (Object item : (List) records) { + if (item instanceof Map) { + result.add(castMap(item)); + } + } + return result; + } + + private Object extractRecords(Object data) { + if (data instanceof List) { + return data; + } + if (!(data instanceof Map)) { + return null; + } + Map map = castMap(data); + Object records = map.get("records"); + if (records == null) { + records = map.get("data"); + } + if (records == null) { + records = map.get("list"); + } + return records; + } + + private List safeGetLoginAddr() { + try { + return getLoginAddr(); + } + catch (Exception ex) { + return Collections.emptyList(); + } + } + + private List buildOnlineRoomRecords(Object records) { + if (!(records instanceof List)) { + return Collections.emptyList(); + } + List result = new ArrayList<>(); + for (Object item : (List) records) { + Map row = castMap(item); + VideoPlatformOnlineRoomCO co = new VideoPlatformOnlineRoomCO(); + co.setRoomId(asText(row.get("roomId"))); + co.setRoomName(asText(row.get("roomName"))); + co.setPassword(asText(row.get("password"))); + co.setCurUserCount(asInteger(row.get("curUserCount"))); + co.setStartTime(asText(row.get("startTime"))); + co.setEndTime(asText(row.get("endTime"))); + co.setStatus(asText(row.get("status"))); + co.setVerifyMode(asText(row.get("verifyMode"))); + co.setMaxUserCount(asInteger(row.get("maxUserCount"))); + result.add(co); + } + return result; + } + + private VideoPlatformResultCO buildResultCO(Map response) { + VideoPlatformResultCO co = new VideoPlatformResultCO(); + co.setCode(selectText(asText(response.get("code")), "200")); + co.setMsg(selectText(asText(response.get("msg")), "success")); + co.setData(response.get("data")); + return co; + } + + private boolean sameRoom(FixedRoomContext context, String thirdRoomId) { + if (StrUtil.isBlank(thirdRoomId)) { + return false; + } + String value = thirdRoomId.trim(); + return value.equals(context.roomId) || value.equals(context.roomNo); + } + + private String resolveRoomId(FireAlarmMeetingRoomDO room) { + if (room == null) { + return properties.getDefaultRoomNo(); + } + return selectText(room.getThirdRoomId(), selectText(room.getThirdRoomNo(), properties.getDefaultRoomNo())); + } + + private String resolveRoomNo(FireAlarmMeetingRoomDO room) { + if (room == null) { + return properties.getDefaultRoomNo(); + } + return selectText(room.getThirdRoomNo(), selectText(room.getThirdRoomId(), properties.getDefaultRoomNo())); + } + + private String resolveRoomName(FireAlarmMeetingRoomDO room) { + if (room == null || StrUtil.isBlank(room.getRoomName())) { + return "消防报警固定会议室"; + } + return room.getRoomName(); + } + + private void putIfNotNull(Map target, String key, Object value) { + if (value != null) { + target.put(key, value); + } + } + + private void putIfNotBlank(Map target, String key, String value) { + if (StrUtil.isNotBlank(value)) { + target.put(key, value.trim()); + } + } + + private Map castMap(Object value) { + if (!(value instanceof Map)) { + return new HashMap<>(); + } + return (Map) value; + } + + private String asText(Object value) { + return value == null ? null : String.valueOf(value); + } + + private Integer asInteger(Object value) { + if (value == null) { + return null; + } + if (value instanceof Number) { + return ((Number) value).intValue(); + } + try { + return Integer.parseInt(String.valueOf(value)); + } + catch (Exception ex) { + return null; + } + } + + private Object toNumericOrText(String value) { + if (StrUtil.isBlank(value)) { + return value; + } + if (StrUtil.isNumeric(value)) { + try { + return Long.parseLong(value); + } + catch (Exception ex) { + return value; + } + } + return value; + } + + private String selectText(String preferred, String fallback) { + return StrUtil.isNotBlank(preferred) ? preferred : fallback; + } + + private String normalize(String value) { + return StrUtil.blankToDefault(value, "").trim().toLowerCase(Locale.ROOT); + } + + private boolean isRoomNotOnline(String message) { + String msg = StrUtil.blankToDefault(message, "").toLowerCase(Locale.ROOT); + return msg.contains("不存在") || msg.contains("未开始") || msg.contains("未在线") + || msg.contains("not exist") || msg.contains("not found") || msg.contains("offline"); + } + + private static class FixedRoomContext { + private FireAlarmMeetingRoomDO room; + private String roomCode; + private String roomId; + private String roomNo; + private String roomName; + private String roomPassword; + } +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/api/VideoPlatformServiceI.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/api/VideoPlatformServiceI.java new file mode 100644 index 0000000..5a54322 --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/api/VideoPlatformServiceI.java @@ -0,0 +1,56 @@ +package com.zcloud.zcGbsServicer.api; + +import com.alibaba.cola.dto.SingleResponse; +import com.zcloud.zcGbsServicer.dto.VideoPlatformUserQry; +import com.zcloud.zcGbsServicer.dto.VideoPlatformFixedRoomLeaveCmd; +import com.zcloud.zcGbsServicer.dto.VideoPlatformFixedRoomLoginCmd; +import com.zcloud.zcGbsServicer.dto.VideoPlatformFixedRoomQry; +import com.zcloud.zcGbsServicer.dto.VideoPlatformDepartmentQry; +import com.zcloud.zcGbsServicer.dto.VideoPlatformMeetingAccessCheckQry; +import com.zcloud.zcGbsServicer.dto.VideoPlatformMeetingMemberQry; +import com.zcloud.zcGbsServicer.dto.VideoRoomAuthRoomCmd; +import com.zcloud.zcGbsServicer.dto.VideoRoomAuthUserCmd; +import com.zcloud.zcGbsServicer.dto.VideoRoomCreateInstantCmd; +import com.zcloud.zcGbsServicer.dto.VideoRoomOnlineRoomQry; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformConfigCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformCurrentMeetingCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformLoginCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformMeetingAccessCheckCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformMeetingMemberStatusCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformOnlineRoomPageCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformResultCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoPlatformTokenCO; +import com.zcloud.zcGbsServicer.dto.clientobject.VideoRoomInstantCO; + +import java.util.List; + +public interface VideoPlatformServiceI { + + SingleResponse getConfig(); + + SingleResponse generateToken(); + + SingleResponse createInstant(VideoRoomCreateInstantCmd cmd); + + SingleResponse authUser(VideoRoomAuthUserCmd cmd); + + SingleResponse authRoom(VideoRoomAuthRoomCmd cmd); + + List getLoginAddr(); + + SingleResponse onlineRoom(VideoRoomOnlineRoomQry qry); + + SingleResponse departmentList(VideoPlatformDepartmentQry qry); + + SingleResponse userList(VideoPlatformUserQry qry); + + SingleResponse currentFixedMeeting(VideoPlatformFixedRoomQry qry); + + SingleResponse checkFixedMeetingAccess(VideoPlatformMeetingAccessCheckQry qry); + + SingleResponse fixedMeetingMembers(VideoPlatformMeetingMemberQry qry); + + SingleResponse fixedRoomLogin(VideoPlatformFixedRoomLoginCmd cmd); + + SingleResponse fixedRoomLeave(VideoPlatformFixedRoomLeaveCmd cmd); +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/AlarmRecordPageQry.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/AlarmRecordPageQry.java index c3f360f..bca0123 100644 --- a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/AlarmRecordPageQry.java +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/AlarmRecordPageQry.java @@ -12,4 +12,7 @@ public class AlarmRecordPageQry extends PageQuery { @ApiModelProperty("报警状态") private String status; + + @ApiModelProperty("是否只查询当前登录人所在消防队的处置数据") // 预留暂未使用 + private Boolean myFeedbackOnly; } diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformDepartmentQry.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformDepartmentQry.java new file mode 100644 index 0000000..42edff2 --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformDepartmentQry.java @@ -0,0 +1,24 @@ +package com.zcloud.zcGbsServicer.dto; + +import com.alibaba.cola.dto.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class VideoPlatformDepartmentQry extends Query { + + @ApiModelProperty("第三方部门ID,精确查询时传") + private String departId; + + @ApiModelProperty("第三方部门名称,模糊查询时传") + private String departName; + + @ApiModelProperty("部门编码") + private String code; + + @ApiModelProperty("页码,默认 1") + private Integer pageNumber; + + @ApiModelProperty("每页条数,默认 100") + private Integer pageSize; +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformFixedRoomLeaveCmd.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformFixedRoomLeaveCmd.java new file mode 100644 index 0000000..16a3cac --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformFixedRoomLeaveCmd.java @@ -0,0 +1,15 @@ +package com.zcloud.zcGbsServicer.dto; + +import com.alibaba.cola.dto.Command; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class VideoPlatformFixedRoomLeaveCmd extends Command { + + @ApiModelProperty("消防报警记录主键ID,传空时默认按当前用户最近在线记录离会") + private Long alarmId; + + @ApiModelProperty("本地用户ID,默认取当前登录用户") + private Long localUserId; +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformFixedRoomLoginCmd.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformFixedRoomLoginCmd.java new file mode 100644 index 0000000..46feb4d --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformFixedRoomLoginCmd.java @@ -0,0 +1,27 @@ +package com.zcloud.zcGbsServicer.dto; + +import com.alibaba.cola.dto.Command; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class VideoPlatformFixedRoomLoginCmd extends Command { + + @ApiModelProperty("固定会议室编码,默认 DEFAULT_DUTY_ROOM") + private String roomCode; + + @ApiModelProperty("消防报警记录主键ID,用于回写当前入会状态") + private Long alarmId; + + @ApiModelProperty("本地用户ID,默认取当前登录用户") + private Long localUserId; + + @ApiModelProperty("第三方平台用户名,优先级高于会议用户映射") + private String thirdUserName; + + @ApiModelProperty("授权权限值,2 参会人,3 管理员,默认 2") + private Integer userRight; + + @ApiModelProperty("授权类型,0 全量授权,1 增量授权,默认 0") + private Integer authType; +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformFixedRoomQry.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformFixedRoomQry.java new file mode 100644 index 0000000..78a9628 --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformFixedRoomQry.java @@ -0,0 +1,15 @@ +package com.zcloud.zcGbsServicer.dto; + +import com.alibaba.cola.dto.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class VideoPlatformFixedRoomQry extends Query { + + @ApiModelProperty("固定会议室编码,默认 DEFAULT_DUTY_ROOM") + private String roomCode; + + @ApiModelProperty("本地用户ID,默认取当前登录用户") + private Long localUserId; +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformMeetingAccessCheckQry.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformMeetingAccessCheckQry.java new file mode 100644 index 0000000..6ce61ff --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformMeetingAccessCheckQry.java @@ -0,0 +1,18 @@ +package com.zcloud.zcGbsServicer.dto; + +import com.alibaba.cola.dto.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class VideoPlatformMeetingAccessCheckQry extends Query { + + @ApiModelProperty("固定会议室编码,默认 DEFAULT_DUTY_ROOM") + private String roomCode; + + @ApiModelProperty("本地用户ID,默认取当前登录用户") + private Long localUserId; + + @ApiModelProperty("消防队伍业务ID,不传时按当前用户所在队伍判断") + private String fireBrigadeBizId; +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformMeetingMemberQry.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformMeetingMemberQry.java new file mode 100644 index 0000000..85c688e --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformMeetingMemberQry.java @@ -0,0 +1,24 @@ +package com.zcloud.zcGbsServicer.dto; + +import com.alibaba.cola.dto.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class VideoPlatformMeetingMemberQry extends Query { + + @ApiModelProperty("固定会议室编码,默认 DEFAULT_DUTY_ROOM") + private String roomCode; + + @ApiModelProperty("第三方部门ID,不传默认取 video.platform.hst.default-depart-id") + private String departId; + + @ApiModelProperty("开始时间,格式 yyyy-MM-dd HH:mm:ss,不传默认查询当天") + private String startTime; + + @ApiModelProperty("结束时间,格式 yyyy-MM-dd HH:mm:ss,不传默认当前时间") + private String endTime; + + @ApiModelProperty("是否返回进退会日志,默认 true") + private Boolean includeLogs; +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformUserQry.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformUserQry.java new file mode 100644 index 0000000..8ed5895 --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoPlatformUserQry.java @@ -0,0 +1,24 @@ +package com.zcloud.zcGbsServicer.dto; + +import com.alibaba.cola.dto.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class VideoPlatformUserQry extends Query { + + @ApiModelProperty("用户名搜索") + private String searchKey; + + @ApiModelProperty("搜索类型,0 模糊,1 精确匹配") + private String searchType; + + @ApiModelProperty("第三方部门ID") + private String departId; + + @ApiModelProperty("页码,默认 1") + private Integer pageNumber; + + @ApiModelProperty("每页条数,默认 100") + private Integer pageSize; +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoRoomAuthRoomCmd.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoRoomAuthRoomCmd.java new file mode 100644 index 0000000..0920501 --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoRoomAuthRoomCmd.java @@ -0,0 +1,19 @@ +package com.zcloud.zcGbsServicer.dto; + +import com.alibaba.cola.dto.Command; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class VideoRoomAuthRoomCmd extends Command { + + @NotBlank(message = "授权会议室串不能为空") + @ApiModelProperty("授权会议室串,格式如 20708,2#20709,3") + private String roomUserStr; + + @NotBlank(message = "用户名不能为空") + @ApiModelProperty("三方平台用户名") + private String userName; +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoRoomAuthUserCmd.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoRoomAuthUserCmd.java new file mode 100644 index 0000000..86b855e --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoRoomAuthUserCmd.java @@ -0,0 +1,23 @@ +package com.zcloud.zcGbsServicer.dto; + +import com.alibaba.cola.dto.Command; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +@Data +public class VideoRoomAuthUserCmd extends Command { + + @NotNull(message = "会议室ID不能为空") + @ApiModelProperty("会议室ID") + private Long roomId; + + @NotBlank(message = "授权用户串不能为空") + @ApiModelProperty("授权用户串,格式如 mike,2#king,3") + private String roomUserStr; + + @ApiModelProperty("授权类型,0全量授权,1增量授权,默认1") + private Integer authType; +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoRoomCreateInstantCmd.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoRoomCreateInstantCmd.java new file mode 100644 index 0000000..de52ef9 --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoRoomCreateInstantCmd.java @@ -0,0 +1,69 @@ +package com.zcloud.zcGbsServicer.dto; + +import com.alibaba.cola.dto.Command; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class VideoRoomCreateInstantCmd extends Command { + + @ApiModelProperty("会议名称") + private String meetingName; + + @ApiModelProperty("会议室号,仅用于前端展示") + private String roomId; + + @ApiModelProperty("会议室密码") + private String password; + + @ApiModelProperty("入会用户名") + private String userName; + + @ApiModelProperty("平台地址,返回参数使用") + private String cesAddr; + + @ApiModelProperty("账号Token,返回参数使用") + private String token; + + @ApiModelProperty("账号密码,返回参数使用") + private String userPass; + + @ApiModelProperty("鉴权方式,返回参数使用") + private String grantType; + + @ApiModelProperty("会议模板,3表示讨论") + private Integer meetingTemplate; + + @ApiModelProperty("会议类型,0带会议室会议,1即时会议,2即时会议并立即开会") + private Integer meetingType; + + @ApiModelProperty("校验模式,1用户密码验证,2会议室密码验证,3匿名登录") + private Integer verifyMode; + + @ApiModelProperty("组织机构ID") + private Integer departId; + + @ApiModelProperty("最大参会人数") + private Integer maxUserCount; + + @ApiModelProperty("主席密码") + private String chairPassword; + + @ApiModelProperty("是否开启邀请") + private String enableInvite; + + @ApiModelProperty("是否开启主席密码") + private String enableChairPwd; + + @ApiModelProperty("是否自动录制") + private String autoRecord; + + @ApiModelProperty("会议模式") + private String roomMode; + + @ApiModelProperty("来源标识") + private String source; + + @ApiModelProperty("旁听提前入会配置") + private String menteeAdvance; +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoRoomOnlineRoomQry.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoRoomOnlineRoomQry.java new file mode 100644 index 0000000..0e8815b --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/VideoRoomOnlineRoomQry.java @@ -0,0 +1,18 @@ +package com.zcloud.zcGbsServicer.dto; + +import com.alibaba.cola.dto.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class VideoRoomOnlineRoomQry extends Query { + + @ApiModelProperty("组织机构ID") + private Integer departId; + + @ApiModelProperty("第三方页码") + private Integer pageNumber = 1; + + @ApiModelProperty("第三方每页条数") + private Integer pageSize = 10; +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformConfigCO.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformConfigCO.java new file mode 100644 index 0000000..8da2147 --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformConfigCO.java @@ -0,0 +1,18 @@ +package com.zcloud.zcGbsServicer.dto.clientobject; + +import com.alibaba.cola.dto.ClientObject; +import lombok.Data; + +import java.util.List; + +@Data +public class VideoPlatformConfigCO extends ClientObject { + + private String apiBaseUrl; + private String webBaseUrl; + private String clientPort; + private String defaultRoomCode; + private String defaultRoomNo; + private String defaultUserPassword; + private List testAccounts; +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformCurrentMeetingCO.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformCurrentMeetingCO.java new file mode 100644 index 0000000..fe7bfcb --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformCurrentMeetingCO.java @@ -0,0 +1,24 @@ +package com.zcloud.zcGbsServicer.dto.clientobject; + +import com.alibaba.cola.dto.ClientObject; +import lombok.Data; + +@Data +public class VideoPlatformCurrentMeetingCO extends ClientObject { + + private String roomCode; + private String roomId; + private String roomNo; + private String roomName; + private Boolean online; + private Integer curUserCount; + private String status; + private String startTime; + private String endTime; + private String thirdUserName; + private String userPass; + private String grantType; + private String cesAddr; + private String webUrl; + private String resultMsg; +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformLoginCO.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformLoginCO.java new file mode 100644 index 0000000..355b217 --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformLoginCO.java @@ -0,0 +1,27 @@ +package com.zcloud.zcGbsServicer.dto.clientobject; + +import com.alibaba.cola.dto.ClientObject; +import lombok.Data; + +import java.util.List; + +@Data +public class VideoPlatformLoginCO extends ClientObject { + + private String roomCode; + private String roomId; + private String roomNo; + private String meetingName; + private String password; + private String thirdUserName; + private String token; + private String userPass; + private String grantType; + private String cesAddr; + private String webUrl; + private String loginUrl; + private List loginAddrList; + private Integer authStatus; + private Integer authorizedUserCount; + private String resultMsg; +} 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 new file mode 100644 index 0000000..ff25895 --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingAccessCheckCO.java @@ -0,0 +1,27 @@ +package com.zcloud.zcGbsServicer.dto.clientobject; + +import com.alibaba.cola.dto.ClientObject; +import lombok.Data; + +import java.util.List; + +@Data +public class VideoPlatformMeetingAccessCheckCO extends ClientObject { + + private Boolean allowed; + private String reason; + private String roomCode; + private String roomId; + private String roomName; + private Long localUserId; + private String localUserName; + private String thirdUserName; + private String userPass; + private String fireBrigadeId; + private String fireBrigadeName; + private Boolean occupied; + private Long occupiedUserId; + private String occupiedUserName; + private String occupiedThirdUserName; + private List participants; +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingLogCO.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingLogCO.java new file mode 100644 index 0000000..5a74c2a --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingLogCO.java @@ -0,0 +1,20 @@ +package com.zcloud.zcGbsServicer.dto.clientobject; + +import com.alibaba.cola.dto.ClientObject; +import lombok.Data; + +@Data +public class VideoPlatformMeetingLogCO extends ClientObject { + + private String roomId; + private String roomName; + private String thirdUserName; + private Long localUserId; + private String localUserName; + private String fireBrigadeId; + private String fireBrigadeName; + private String enterTime; + private String leaveTime; + private String duration; + private String status; +} 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 new file mode 100644 index 0000000..0d297fa --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingMemberStatusCO.java @@ -0,0 +1,19 @@ +package com.zcloud.zcGbsServicer.dto.clientobject; + +import com.alibaba.cola.dto.ClientObject; +import lombok.Data; + +import java.util.List; + +@Data +public class VideoPlatformMeetingMemberStatusCO extends ClientObject { + + private String roomCode; + private String roomId; + private String roomName; + private Integer participantCount; + private List participants; + private Boolean logQuerySuccess; + private String logQueryMsg; + private List logs; +} 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 new file mode 100644 index 0000000..ee79548 --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformMeetingParticipantCO.java @@ -0,0 +1,16 @@ +package com.zcloud.zcGbsServicer.dto.clientobject; + +import com.alibaba.cola.dto.ClientObject; +import lombok.Data; + +@Data +public class VideoPlatformMeetingParticipantCO extends ClientObject { + + private String thirdUserName; + private Long localUserId; + private String localUserName; + private String localPhone; + private String fireBrigadeId; + private String fireBrigadeName; + private Boolean currentUser; +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformOnlineRoomCO.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformOnlineRoomCO.java new file mode 100644 index 0000000..0a66096 --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformOnlineRoomCO.java @@ -0,0 +1,18 @@ +package com.zcloud.zcGbsServicer.dto.clientobject; + +import com.alibaba.cola.dto.ClientObject; +import lombok.Data; + +@Data +public class VideoPlatformOnlineRoomCO extends ClientObject { + + private String roomId; + private String roomName; + private String password; + private Integer curUserCount; + private String startTime; + private String endTime; + private String status; + private String verifyMode; + private Integer maxUserCount; +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformOnlineRoomPageCO.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformOnlineRoomPageCO.java new file mode 100644 index 0000000..40c4b9e --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformOnlineRoomPageCO.java @@ -0,0 +1,16 @@ +package com.zcloud.zcGbsServicer.dto.clientobject; + +import com.alibaba.cola.dto.ClientObject; +import lombok.Data; + +import java.util.List; + +@Data +public class VideoPlatformOnlineRoomPageCO extends ClientObject { + + private Integer current; + private Integer pages; + private Integer size; + private Integer total; + private List records; +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformResultCO.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformResultCO.java new file mode 100644 index 0000000..ae87956 --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformResultCO.java @@ -0,0 +1,12 @@ +package com.zcloud.zcGbsServicer.dto.clientobject; + +import com.alibaba.cola.dto.ClientObject; +import lombok.Data; + +@Data +public class VideoPlatformResultCO extends ClientObject { + + private String code; + private String msg; + private Object data; +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformTokenCO.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformTokenCO.java new file mode 100644 index 0000000..c567613 --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoPlatformTokenCO.java @@ -0,0 +1,13 @@ +package com.zcloud.zcGbsServicer.dto.clientobject; + +import com.alibaba.cola.dto.ClientObject; +import lombok.Data; + +@Data +public class VideoPlatformTokenCO extends ClientObject { + + private String token; + private String expireTime; + private String apiBaseUrl; + private String webBaseUrl; +} diff --git a/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoRoomInstantCO.java b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoRoomInstantCO.java new file mode 100644 index 0000000..9c08380 --- /dev/null +++ b/web-client/src/main/java/com/zcloud/zcGbsServicer/dto/clientobject/VideoRoomInstantCO.java @@ -0,0 +1,30 @@ +package com.zcloud.zcGbsServicer.dto.clientobject; + +import com.alibaba.cola.dto.ClientObject; +import lombok.Data; + +import java.util.List; + +@Data +public class VideoRoomInstantCO extends ClientObject { + + private String meetingName; + private String roomId; + private String password; + private String userName; + private String cesAddr; + private String token; + private String userPass; + private String grantType; + private String expireTime; + private String resultMsg; + private String webUrl; + private String inviteCode; + private Integer maxUserCount; + private Integer verifyMode; + private Integer meetingType; + private Integer meetingTemplate; + private String createTime; + private String creatorId; + private List loginAddrList; +} diff --git a/web-infrastructure/src/main/java/com/zcloud/zcGbsServicer/persistence/mapper/FireAlarmInfoMapper.java b/web-infrastructure/src/main/java/com/zcloud/zcGbsServicer/persistence/mapper/FireAlarmInfoMapper.java index 1a36b72..4737946 100644 --- a/web-infrastructure/src/main/java/com/zcloud/zcGbsServicer/persistence/mapper/FireAlarmInfoMapper.java +++ b/web-infrastructure/src/main/java/com/zcloud/zcGbsServicer/persistence/mapper/FireAlarmInfoMapper.java @@ -6,11 +6,15 @@ import com.zcloud.zcGbsServicer.persistence.dataobject.FireAlarmInfoDO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + @Mapper public interface FireAlarmInfoMapper extends BaseMapper { IPage selectPageSql(IPage page, @Param("tenantId") Long tenantId, @Param("fireBrigadeName") String fireBrigadeName, - @Param("alarmStatus") Integer alarmStatus); + @Param("alarmStatus") Integer alarmStatus, + @Param("fireBrigadeIds") List fireBrigadeIds, + @Param("feedbackOnly") Boolean corpinfoId); } diff --git a/web-infrastructure/src/main/java/com/zcloud/zcGbsServicer/persistence/repository/FireAlarmMeetingRoomRepository.java b/web-infrastructure/src/main/java/com/zcloud/zcGbsServicer/persistence/repository/FireAlarmMeetingRoomRepository.java index 10eb22b..3fd5fd1 100644 --- a/web-infrastructure/src/main/java/com/zcloud/zcGbsServicer/persistence/repository/FireAlarmMeetingRoomRepository.java +++ b/web-infrastructure/src/main/java/com/zcloud/zcGbsServicer/persistence/repository/FireAlarmMeetingRoomRepository.java @@ -13,4 +13,6 @@ public interface FireAlarmMeetingRoomRepository extends BaseRepository listAll(); } diff --git a/web-infrastructure/src/main/java/com/zcloud/zcGbsServicer/persistence/repository/impl/FireAlarmInfoRepositoryImpl.java b/web-infrastructure/src/main/java/com/zcloud/zcGbsServicer/persistence/repository/impl/FireAlarmInfoRepositoryImpl.java index 70c6401..d9f8c69 100644 --- a/web-infrastructure/src/main/java/com/zcloud/zcGbsServicer/persistence/repository/impl/FireAlarmInfoRepositoryImpl.java +++ b/web-infrastructure/src/main/java/com/zcloud/zcGbsServicer/persistence/repository/impl/FireAlarmInfoRepositoryImpl.java @@ -13,6 +13,7 @@ import com.zcloud.zcGbsServicer.persistence.repository.FireAlarmInfoRepository; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import java.util.List; import java.util.Map; @Service @@ -26,7 +27,16 @@ public class FireAlarmInfoRepositoryImpl extends BaseRepositoryImpl page = new Query().getPage(params); String fireBrigadeName = params == null ? null : (String) params.get("fireBrigadeName"); Integer alarmStatus = params == null ? null : (Integer) params.get("alarmStatus"); - IPage result = fireAlarmInfoMapper.selectPageSql(page, AuthContext.getTenantId(), fireBrigadeName, alarmStatus); + List fireBrigadeIds = params == null ? null : (List) params.get("fireBrigadeIds"); + Boolean feedbackOnly = params == null ? null : (Boolean) params.get("feedbackOnly"); + IPage result = fireAlarmInfoMapper.selectPageSql( + page, + AuthContext.getTenantId(), + fireBrigadeName, + alarmStatus, + fireBrigadeIds, + feedbackOnly + ); return PageHelper.pageToResponse(result, result.getRecords()); } diff --git a/web-infrastructure/src/main/java/com/zcloud/zcGbsServicer/persistence/repository/impl/FireAlarmMeetingRoomRepositoryImpl.java b/web-infrastructure/src/main/java/com/zcloud/zcGbsServicer/persistence/repository/impl/FireAlarmMeetingRoomRepositoryImpl.java index 92fde85..b44db4a 100644 --- a/web-infrastructure/src/main/java/com/zcloud/zcGbsServicer/persistence/repository/impl/FireAlarmMeetingRoomRepositoryImpl.java +++ b/web-infrastructure/src/main/java/com/zcloud/zcGbsServicer/persistence/repository/impl/FireAlarmMeetingRoomRepositoryImpl.java @@ -2,6 +2,7 @@ package com.zcloud.zcGbsServicer.persistence.repository.impl; import cn.hutool.core.util.StrUtil; import com.alibaba.cola.dto.PageResponse; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.jjb.saas.framework.auth.utils.AuthContext; @@ -75,4 +76,11 @@ public class FireAlarmMeetingRoomRepositoryImpl extends BaseRepositoryImpl listAll() { + return this.list(new LambdaQueryWrapper() + .eq(FireAlarmMeetingRoomDO::getTenantId, AuthContext.getTenantId()) + .eq(FireAlarmMeetingRoomDO::getDeleteEnum, "FALSE")); + } } diff --git a/web-infrastructure/src/main/resources/mapper/FireAlarmInfoMapper.xml b/web-infrastructure/src/main/resources/mapper/FireAlarmInfoMapper.xml index 193fd32..bbc2166 100644 --- a/web-infrastructure/src/main/resources/mapper/FireAlarmInfoMapper.xml +++ b/web-infrastructure/src/main/resources/mapper/FireAlarmInfoMapper.xml @@ -18,6 +18,15 @@ AND alarm_status = #{alarmStatus} + + AND alarm_status IN (2, 3) + + + AND fire_brigade_id IN + + #{item} + + ORDER BY record_time DESC, create_time DESC