|
@@ -103,7 +103,7 @@ public class RoomServiceImpl implements RoomService {
|
|
|
@Value("${auth.sysconfig.tenantId}")
|
|
|
private Integer lesseeOrganId;
|
|
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
+ @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
@Override
|
|
|
public RoomResult joinRoom(String userName, String roomId, boolean isAudience, boolean isDisableCamera) throws ApiException, Exception {
|
|
|
CheckUtils.checkArgument(userName != null, "userName must't be null");
|
|
@@ -775,12 +775,39 @@ public class RoomServiceImpl implements RoomService {
|
|
|
if (!userInfoList.isEmpty()) {
|
|
|
deviceResourceMessage.setUserName(userInfoList.get(0).getName());
|
|
|
}
|
|
|
- imHelper.publishMessage(userId, roomId, deviceResourceMessage, 1);
|
|
|
+ imHelper.publishMessage(authUser.getId().toString(), roomId, deviceResourceMessage, 1);
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean batchControlDevice(ReqDeviceControlData data) throws Exception {
|
|
|
+ //获取所有的学员列表
|
|
|
+ List<RoomMember> roomMembers = roomMemberDao.findByRidAndRole(data.getRoomId(),RoleEnum.RoleStudent.getValue());
|
|
|
+ if(roomMembers.size() == 0){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ boolean result = true;
|
|
|
+ if (data.getCameraOn() != null) {
|
|
|
+ for (RoomMember e:roomMembers) {
|
|
|
+ controlDevice(data.getRoomId(), e.getUid(), DeviceTypeEnum.Camera, data.getCameraOn());
|
|
|
+ }
|
|
|
+ } else if (data.getMicrophoneOn() != null) {
|
|
|
+ for (RoomMember e:roomMembers) {
|
|
|
+ controlDevice(data.getRoomId(), e.getUid(), DeviceTypeEnum.Microphone, data.getMicrophoneOn());
|
|
|
+ }
|
|
|
+ } else if (data.getMusicModeOn() != null) {
|
|
|
+ for (RoomMember e:roomMembers) {
|
|
|
+ controlDevice(data.getRoomId(), e.getUid(), DeviceTypeEnum.MusicMode, data.getMusicModeOn());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new ApiException(ErrorEnum.ERR_REQUEST_PARA_ERR);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public Boolean approveControlDevice(String roomId, String ticket) throws ApiException, Exception {
|
|
|
CheckUtils.checkArgument(ticket != null, "ticket must't be null");
|
|
|
SysUser authUser = sysUserFeignService.queryUserInfo();
|
|
@@ -821,6 +848,7 @@ public class RoomServiceImpl implements RoomService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean syncDeviceState(String roomId, DeviceTypeEnum type, boolean enable) throws ApiException, Exception {
|
|
|
CheckUtils.checkArgument(roomId != null, "roomId must't be null");
|
|
|
CheckUtils.checkArgument(roomDao.existsByRid(roomId), "room not exist");
|
|
@@ -832,9 +860,12 @@ public class RoomServiceImpl implements RoomService {
|
|
|
if (type.equals(DeviceTypeEnum.Camera)) {
|
|
|
result = roomMemberDao.updateCameraByRidAndUid(roomId, userId, enable);
|
|
|
deviceResourceMessage = new DeviceStateChangedMessage(type.ordinal(), enable);
|
|
|
- } else {
|
|
|
+ } else if (type.equals(DeviceTypeEnum.Microphone)){
|
|
|
result = roomMemberDao.updateMicByRidAndUid(roomId, userId, enable);
|
|
|
deviceResourceMessage = new DeviceStateChangedMessage(type.ordinal(), enable);
|
|
|
+ }else {
|
|
|
+ result = roomMemberDao.updateMusicByRidAndUid(roomId, userId, enable);
|
|
|
+ deviceResourceMessage = new DeviceStateChangedMessage(type.ordinal(), enable);
|
|
|
}
|
|
|
deviceResourceMessage.setUserId(userId);
|
|
|
imHelper.publishMessage(userId, roomId, deviceResourceMessage, 1);
|