|
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.ym.common.ApiException;
|
|
|
import com.ym.common.BaseResponse;
|
|
|
import com.ym.common.ErrorEnum;
|
|
|
-import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.pojo.*;
|
|
|
import com.ym.service.MessageService;
|
|
|
import com.ym.service.RoomService;
|
|
@@ -25,32 +24,25 @@ public class RoomController{
|
|
|
RoomService roomService;
|
|
|
@Autowired
|
|
|
MessageService messageService;
|
|
|
- @Autowired
|
|
|
- SysUserFeignService sysUserFeignService;
|
|
|
|
|
|
@RequestMapping(value = "/join", method = RequestMethod.POST)
|
|
|
- public Object joinRoom(@RequestBody ReqUserData data)
|
|
|
- throws ApiException, Exception {
|
|
|
- RoomResult roomResult = roomService.joinRoom(data.getUserName(), data.getRoomId(), data.isAudience(), data.isDisableCamera(),data.isMusicMode());
|
|
|
- return new BaseResponse<>(roomResult);
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/queryNoJoinStu", method = RequestMethod.GET)
|
|
|
- public Object queryNoJoinStu(String roomId){
|
|
|
- return new BaseResponse<>(roomService.queryNoJoinStu(roomId));
|
|
|
+ public Object joinRoom(@RequestBody ReqUserData data) throws Exception {
|
|
|
+ return new BaseResponse<>(roomService.joinRoom(data.getRoomId()));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/signIn", method = RequestMethod.POST)
|
|
|
public Object signIn(Long roomId){
|
|
|
- roomService.signIn(roomId);
|
|
|
return new BaseResponse<>();
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/leave", method = RequestMethod.POST)
|
|
|
- public Object leaveRoom(@RequestBody ReqUserData data)
|
|
|
- throws ApiException, Exception {
|
|
|
- boolean result = roomService.leaveRoom(data.getRoomId());
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ public Object leaveRoom(@RequestBody ReqUserData data){
|
|
|
+ return new BaseResponse<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/queryNoJoinStu", method = RequestMethod.GET)
|
|
|
+ public Object queryNoJoinStu(String roomId){
|
|
|
+ return new BaseResponse<>(roomService.queryNoJoinStu(roomId));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/sendImPlayMidiMessage", method = RequestMethod.POST)
|
|
@@ -60,40 +52,34 @@ public class RoomController{
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/statusSync")
|
|
|
- public Object statusSync(@RequestBody String body) throws Exception {
|
|
|
+ public void statusSync(@RequestBody String body) throws Exception {
|
|
|
ChannelStateNotify notify = JSONObject.parseObject(body, ChannelStateNotify.class);
|
|
|
log.info("statusSyncParam: {}",JSONObject.toJSON(notify));
|
|
|
- boolean result = false;
|
|
|
- if(notify.getEvent() == 12 || notify.getEvent() == 3){
|
|
|
- result = roomService.statusSync(notify.getChannelId(), notify.getUserId());
|
|
|
- }else if(notify.getEvent() == 11){
|
|
|
-// Teacher teacher = teacherDao.get(Integer.parseInt(notify.getUserId()));
|
|
|
-// Long roomId = Long.parseLong(notify.getChannelId().substring(1));
|
|
|
-// CourseSchedule courseSchedule = courseScheduleDao.get(roomId);
|
|
|
-// if(teacher != null && teacher.getId().equals(courseSchedule.getActualTeacherId())){
|
|
|
-// roomService.joinRoom(teacher.getRealName(),roomId.toString(),false,false);
|
|
|
-// }else {
|
|
|
-// roomService.joinRoom(teacher.getUsername(),roomId.toString(),false,false);
|
|
|
-// }
|
|
|
+ String roomId = notify.getChannelId();
|
|
|
+ String userId = notify.getUserId();
|
|
|
+ switch (notify.getEvent()){
|
|
|
+ case 11:
|
|
|
+ //成员加入
|
|
|
+ roomService.joinRoomSuccess(roomId, userId);
|
|
|
+ break;
|
|
|
+ case 12:
|
|
|
+ //成员退出
|
|
|
+ roomService.leaveRoomSuccess(roomId, userId);
|
|
|
+ break;
|
|
|
}
|
|
|
- return new BaseResponse<>(result);
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/statusImMsg")
|
|
|
- public void statusImMsg(@RequestBody String body) throws Exception {
|
|
|
- System.out.println("");
|
|
|
+// roomService.statusSync(notify);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/downgrade", method = RequestMethod.POST)
|
|
|
public Object downRole(@RequestBody ReqChangeUserRoleData data)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
boolean result = roomService.downgrade(data.getRoomId(), data.getUsers());
|
|
|
return new BaseResponse<>(result);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/kick", method = RequestMethod.POST)
|
|
|
public Object kickMember(@RequestBody ReqUserData data)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
boolean result = roomService.kickMember(data.getRoomId());
|
|
|
return new BaseResponse<>(result);
|
|
|
}
|
|
@@ -101,14 +87,14 @@ public class RoomController{
|
|
|
//only teacher
|
|
|
@RequestMapping(value = "/display", method = RequestMethod.POST)
|
|
|
public Object display(@RequestBody ReqDisplayData data)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
boolean result = roomService.display(data.getRoomId(), data.getType(), data.getUri(),data.getUserId());
|
|
|
return new BaseResponse<>(result);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/whiteboard/create", method = RequestMethod.POST)
|
|
|
public Object createWhiteBoard(@RequestBody ReqWhiteboardData data)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
String result = roomService.createWhiteBoard(data.getRoomId());
|
|
|
return new BaseResponse<>(result);
|
|
|
}
|
|
@@ -116,21 +102,21 @@ public class RoomController{
|
|
|
|
|
|
@RequestMapping(value = "/whiteboard/delete", method = RequestMethod.POST)
|
|
|
public Object destroyWhiteBoard(@RequestBody ReqWhiteboardData data)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
boolean result = roomService.deleteWhiteboard(data.getRoomId(), data.getWhiteboardId());
|
|
|
return new BaseResponse<>(result);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/whiteboard/list", method = RequestMethod.GET)
|
|
|
public Object getWhiteBoard(@RequestParam String roomId)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
List<RoomResult.WhiteboardResult> whiteboards = roomService.getWhiteboard(roomId);
|
|
|
return new BaseResponse<>(whiteboards);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/device/approve", method = RequestMethod.POST)
|
|
|
public Object approveControlDevice(@RequestBody ReqDeviceControlData data)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
boolean result;
|
|
|
result = roomService.approveControlDevice(data.getRoomId(), data.getTicket());
|
|
|
return new BaseResponse<>(result);
|
|
@@ -138,7 +124,7 @@ public class RoomController{
|
|
|
|
|
|
@RequestMapping(value = "/device/reject", method = RequestMethod.POST)
|
|
|
public Object rejectControlDevice(@RequestBody ReqDeviceControlData data)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
boolean result;
|
|
|
result = roomService.rejectControlDevice(data.getRoomId(), data.getTicket());
|
|
|
return new BaseResponse<>(result);
|
|
@@ -146,7 +132,7 @@ public class RoomController{
|
|
|
|
|
|
@RequestMapping(value = "/device/control", method = RequestMethod.POST)
|
|
|
public Object controlDevice(@RequestBody ReqDeviceControlData data)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
boolean result;
|
|
|
if (data.getCameraOn() != null) {
|
|
|
result = roomService.controlDevice(data.getRoomId(), data.getUserId(), DeviceTypeEnum.Camera, data.getCameraOn());
|
|
@@ -171,7 +157,7 @@ public class RoomController{
|
|
|
|
|
|
@RequestMapping(value = "/device/sync", method = RequestMethod.POST)
|
|
|
public Object syncDeviceState(@RequestBody ReqDeviceControlData data)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
boolean result;
|
|
|
if (data.getCameraOn() != null) {
|
|
|
result = roomService.syncDeviceState(data.getRoomId(), DeviceTypeEnum.Camera, data.getCameraOn());
|
|
@@ -189,70 +175,70 @@ public class RoomController{
|
|
|
|
|
|
@RequestMapping(value = "/whiteboard/turn-page", method = RequestMethod.POST)
|
|
|
public Object turnPage(@RequestBody ReqWhiteboardData data)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
boolean result = roomService.turnWhiteBoardPage(data.getRoomId(), data.getWhiteboardId(), data.getPage());
|
|
|
return new BaseResponse<>(result);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/members", method = RequestMethod.GET)
|
|
|
public Object getMembers(@RequestParam String roomId)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
List<RoomResult.MemberResult> whiteboards = roomService.getMembers(roomId);
|
|
|
return new BaseResponse<>(whiteboards);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/speech/apply", method = RequestMethod.POST)
|
|
|
public Object apply(@RequestBody ReqSpeechData data)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
Boolean result = roomService.applySpeech(data.getRoomId());
|
|
|
return new BaseResponse<>(result);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/speech/approve", method = RequestMethod.POST)
|
|
|
public Object approval(@RequestBody ReqSpeechData data)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
Boolean result = roomService.approveSpeech(data.getRoomId(), data.getTicket());
|
|
|
return new BaseResponse<>(result);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/speech/reject", method = RequestMethod.POST)
|
|
|
public Object reject(@RequestBody ReqSpeechData data)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
Boolean result = roomService.rejectSpeech(data.getRoomId(), data.getTicket());
|
|
|
return new BaseResponse<>(result);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/transfer", method = RequestMethod.POST)
|
|
|
public Object transfer(@RequestBody ReqUpgradeRoleData data)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
Boolean result = roomService.transfer(data.getRoomId(), data.getUserId());
|
|
|
return new BaseResponse<>(result);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/upgrade/invite", method = RequestMethod.POST)
|
|
|
public Object inviteUpgradeRole(@RequestBody ReqUpgradeRoleData data)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
Boolean result = roomService.inviteUpgradeRole(data.getRoomId(), data.getUserId(), data.getRole());
|
|
|
return new BaseResponse<>(result);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/upgrade/approve", method = RequestMethod.POST)
|
|
|
public Object approveUpgradeRole(@RequestBody ReqUpgradeRoleData data)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
Boolean result = roomService.approveUpgradeRole(data.getRoomId(), data.getTicket());
|
|
|
return new BaseResponse<>(result);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/upgrade/reject", method = RequestMethod.POST)
|
|
|
public Object rejectUpgradeRole(@RequestBody ReqUpgradeRoleData data)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
Boolean result = roomService.rejectUpgradeRole(data.getRoomId(), data.getTicket());
|
|
|
return new BaseResponse<>(result);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/change-role", method = RequestMethod.POST)
|
|
|
public Object changeRole(@RequestBody ReqChangeRole data)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
Boolean result = roomService.changeRole(data.getRoomId(), data.getUserId(), data.getRole());
|
|
|
return new BaseResponse<>(result);
|
|
|
}
|
|
@@ -262,7 +248,7 @@ public class RoomController{
|
|
|
@RequestParam(value = "timestamp", required = false) String timestamp,
|
|
|
@RequestParam(value = "nonce", required = false) String nonce,
|
|
|
@RequestParam(value = "signature", required = false) String signature)
|
|
|
- throws ApiException, Exception {
|
|
|
+ throws Exception {
|
|
|
Boolean result = roomService.memberOnlineStatus(statusList, nonce, timestamp, signature);
|
|
|
return new BaseResponse<>(result);
|
|
|
}
|