|
@@ -15,86 +15,86 @@ import java.util.List;
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/room")
|
|
|
-public class RoomController {
|
|
|
+public class RoomController extends BaseController{
|
|
|
@Autowired
|
|
|
RoomService roomService;
|
|
|
|
|
|
@RequestMapping(value = "/join", method = RequestMethod.POST)
|
|
|
- public BaseResponse<RoomResult> joinRoom(@RequestBody ReqUserData data)
|
|
|
+ public Object joinRoom(@RequestBody ReqUserData data)
|
|
|
throws ApiException, Exception {
|
|
|
RoomResult roomResult = roomService.joinRoom(data.getUserName(), data.getRoomId(), data.isAudience(), data.isDisableCamera());
|
|
|
- return new BaseResponse<>(roomResult);
|
|
|
+ return succeed(new BaseResponse<>(roomResult));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/leave", method = RequestMethod.POST)
|
|
|
- public BaseResponse<Boolean> leaveRoom(@RequestBody ReqUserData data)
|
|
|
+ public Object leaveRoom(@RequestBody ReqUserData data)
|
|
|
throws ApiException, Exception {
|
|
|
boolean result = roomService.leaveRoom(data.getRoomId());
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/downgrade", method = RequestMethod.POST)
|
|
|
- public BaseResponse<Boolean> downRole(@RequestBody ReqChangeUserRoleData data)
|
|
|
+ public Object downRole(@RequestBody ReqChangeUserRoleData data)
|
|
|
throws ApiException, Exception {
|
|
|
boolean result = roomService.downgrade(data.getRoomId(), data.getUsers());
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/kick", method = RequestMethod.POST)
|
|
|
- public BaseResponse<Boolean> kickMember(@RequestBody ReqUserData data)
|
|
|
+ public Object kickMember(@RequestBody ReqUserData data)
|
|
|
throws ApiException, Exception {
|
|
|
boolean result = roomService.kickMember(data.getRoomId(), data.getUserId());
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
|
|
|
//only teacher
|
|
|
@RequestMapping(value = "/display", method = RequestMethod.POST)
|
|
|
- public BaseResponse<Boolean> display(@RequestBody ReqDisplayData data)
|
|
|
+ public Object display(@RequestBody ReqDisplayData data)
|
|
|
throws ApiException, Exception {
|
|
|
boolean result = roomService.display(data.getRoomId(), data.getType(), data.getUserId(), data.getUri());
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/whiteboard/create", method = RequestMethod.POST)
|
|
|
- public BaseResponse<String> createWhiteBoard(@RequestBody ReqWhiteboardData data)
|
|
|
+ public Object createWhiteBoard(@RequestBody ReqWhiteboardData data)
|
|
|
throws ApiException, Exception {
|
|
|
String result = roomService.createWhiteBoard(data.getRoomId());
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/whiteboard/delete", method = RequestMethod.POST)
|
|
|
- public BaseResponse<Boolean> destroyWhiteBoard(@RequestBody ReqWhiteboardData data)
|
|
|
+ public Object destroyWhiteBoard(@RequestBody ReqWhiteboardData data)
|
|
|
throws ApiException, Exception {
|
|
|
boolean result = roomService.deleteWhiteboard(data.getRoomId(), data.getWhiteboardId());
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/whiteboard/list", method = RequestMethod.GET)
|
|
|
- public BaseResponse<List<RoomResult.WhiteboardResult>> getWhiteBoard(@RequestParam String roomId)
|
|
|
+ public Object getWhiteBoard(@RequestParam String roomId)
|
|
|
throws ApiException, Exception {
|
|
|
List<RoomResult.WhiteboardResult> whiteboards = roomService.getWhiteboard(roomId);
|
|
|
- return new BaseResponse<>(whiteboards);
|
|
|
+ return succeed(new BaseResponse<>(whiteboards));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/device/approve", method = RequestMethod.POST)
|
|
|
- public BaseResponse<Boolean> approveControlDevice(@RequestBody ReqDeviceControlData data)
|
|
|
+ public Object approveControlDevice(@RequestBody ReqDeviceControlData data)
|
|
|
throws ApiException, Exception {
|
|
|
boolean result;
|
|
|
result = roomService.approveControlDevice(data.getRoomId(), data.getTicket());
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/device/reject", method = RequestMethod.POST)
|
|
|
- public BaseResponse<Boolean> rejectControlDevice(@RequestBody ReqDeviceControlData data)
|
|
|
+ public Object rejectControlDevice(@RequestBody ReqDeviceControlData data)
|
|
|
throws ApiException, Exception {
|
|
|
boolean result;
|
|
|
result = roomService.rejectControlDevice(data.getRoomId(), data.getTicket());
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/device/control", method = RequestMethod.POST)
|
|
|
- public BaseResponse<Boolean> controlDevice(@RequestBody ReqDeviceControlData data)
|
|
|
+ public Object controlDevice(@RequestBody ReqDeviceControlData data)
|
|
|
throws ApiException, Exception {
|
|
|
boolean result;
|
|
|
if (data.getCameraOn() != null) {
|
|
@@ -104,11 +104,11 @@ public class RoomController {
|
|
|
} else {
|
|
|
throw new ApiException(ErrorEnum.ERR_REQUEST_PARA_ERR);
|
|
|
}
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/device/sync", method = RequestMethod.POST)
|
|
|
- public BaseResponse<Boolean> syncDeviceState(@RequestBody ReqDeviceControlData data)
|
|
|
+ public Object syncDeviceState(@RequestBody ReqDeviceControlData data)
|
|
|
throws ApiException, Exception {
|
|
|
boolean result;
|
|
|
if (data.getCameraOn() != null) {
|
|
@@ -118,86 +118,86 @@ public class RoomController {
|
|
|
} else {
|
|
|
throw new ApiException(ErrorEnum.ERR_REQUEST_PARA_ERR);
|
|
|
}
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/whiteboard/turn-page", method = RequestMethod.POST)
|
|
|
- public BaseResponse<Boolean> turnPage(@RequestBody ReqWhiteboardData data)
|
|
|
+ public Object turnPage(@RequestBody ReqWhiteboardData data)
|
|
|
throws ApiException, Exception {
|
|
|
boolean result = roomService.turnWhiteBoardPage(data.getRoomId(), data.getWhiteboardId(), data.getPage());
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/members", method = RequestMethod.GET)
|
|
|
- public BaseResponse<List<RoomResult.MemberResult>> getMembers(@RequestParam String roomId)
|
|
|
+ public Object getMembers(@RequestParam String roomId)
|
|
|
throws ApiException, Exception {
|
|
|
List<RoomResult.MemberResult> whiteboards = roomService.getMembers(roomId);
|
|
|
- return new BaseResponse<>(whiteboards);
|
|
|
+ return succeed(new BaseResponse<>(whiteboards));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/speech/apply", method = RequestMethod.POST)
|
|
|
- public BaseResponse<Boolean> apply(@RequestBody ReqSpeechData data)
|
|
|
+ public Object apply(@RequestBody ReqSpeechData data)
|
|
|
throws ApiException, Exception {
|
|
|
Boolean result = roomService.applySpeech(data.getRoomId());
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/speech/approve", method = RequestMethod.POST)
|
|
|
- public BaseResponse<Boolean> approval(@RequestBody ReqSpeechData data)
|
|
|
+ public Object approval(@RequestBody ReqSpeechData data)
|
|
|
throws ApiException, Exception {
|
|
|
Boolean result = roomService.approveSpeech(data.getRoomId(), data.getTicket());
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/speech/reject", method = RequestMethod.POST)
|
|
|
- public BaseResponse<Boolean> reject(@RequestBody ReqSpeechData data)
|
|
|
+ public Object reject(@RequestBody ReqSpeechData data)
|
|
|
throws ApiException, Exception {
|
|
|
Boolean result = roomService.rejectSpeech(data.getRoomId(), data.getTicket());
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/transfer", method = RequestMethod.POST)
|
|
|
- public BaseResponse<Boolean> transfer(@RequestBody ReqUpgradeRoleData data)
|
|
|
+ public Object transfer(@RequestBody ReqUpgradeRoleData data)
|
|
|
throws ApiException, Exception {
|
|
|
Boolean result = roomService.transfer(data.getRoomId(), data.getUserId());
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/upgrade/invite", method = RequestMethod.POST)
|
|
|
- public BaseResponse<Boolean> inviteUpgradeRole(@RequestBody ReqUpgradeRoleData data)
|
|
|
+ public Object inviteUpgradeRole(@RequestBody ReqUpgradeRoleData data)
|
|
|
throws ApiException, Exception {
|
|
|
Boolean result = roomService.inviteUpgradeRole(data.getRoomId(), data.getUserId(), data.getRole());
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/upgrade/approve", method = RequestMethod.POST)
|
|
|
- public BaseResponse<Boolean> approveUpgradeRole(@RequestBody ReqUpgradeRoleData data)
|
|
|
+ public Object approveUpgradeRole(@RequestBody ReqUpgradeRoleData data)
|
|
|
throws ApiException, Exception {
|
|
|
Boolean result = roomService.approveUpgradeRole(data.getRoomId(), data.getTicket());
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/upgrade/reject", method = RequestMethod.POST)
|
|
|
- public BaseResponse<Boolean> rejectUpgradeRole(@RequestBody ReqUpgradeRoleData data)
|
|
|
+ public Object rejectUpgradeRole(@RequestBody ReqUpgradeRoleData data)
|
|
|
throws ApiException, Exception {
|
|
|
Boolean result = roomService.rejectUpgradeRole(data.getRoomId(), data.getTicket());
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/change-role", method = RequestMethod.POST)
|
|
|
- public BaseResponse<Boolean> changeRole(@RequestBody ReqChangeRole data)
|
|
|
+ public Object changeRole(@RequestBody ReqChangeRole data)
|
|
|
throws ApiException, Exception {
|
|
|
Boolean result = roomService.changeRole(data.getRoomId(), data.getUserId(), data.getRole());
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/members/online-status", method = RequestMethod.POST)
|
|
|
- public BaseResponse<Boolean> memberOnlineStatus(@RequestBody List<ReqMemberOnlineStatus> statusList,
|
|
|
+ public Object memberOnlineStatus(@RequestBody List<ReqMemberOnlineStatus> statusList,
|
|
|
@RequestParam(value = "timestamp", required = false) String timestamp,
|
|
|
@RequestParam(value = "nonce", required = false) String nonce,
|
|
|
@RequestParam(value = "signature", required = false) String signature)
|
|
|
throws ApiException, Exception {
|
|
|
Boolean result = roomService.memberOnlineStatus(statusList, nonce, timestamp, signature);
|
|
|
- return new BaseResponse<>(result);
|
|
|
+ return succeed(new BaseResponse<>(result));
|
|
|
}
|
|
|
}
|