|
@@ -8,7 +8,7 @@ import com.yonge.cooleshow.biz.dal.service.ImGroupService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.ImNetworkRoomService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.SysUserService;
|
|
|
import com.yonge.cooleshow.common.controller.BaseController;
|
|
|
-import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
|
+import com.yonge.cooleshow.common.entity.BaseResponse;
|
|
|
import com.yonge.toolset.base.exception.BizException;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.text.MessageFormat;
|
|
|
+import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
import java.util.Optional;
|
|
|
|
|
@@ -34,9 +34,9 @@ import java.util.Optional;
|
|
|
@Api(tags = "网络教室房间")
|
|
|
@RestController
|
|
|
@RequestMapping("/room")
|
|
|
-public class ImNetworkRoomController extends BaseController {
|
|
|
+public class RoomController extends BaseController {
|
|
|
|
|
|
- private final static Logger log = LoggerFactory.getLogger(ImNetworkRoomController.class);
|
|
|
+ private final static Logger log = LoggerFactory.getLogger(RoomController.class);
|
|
|
/**
|
|
|
* 服务对象
|
|
|
*/
|
|
@@ -49,7 +49,7 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
|
|
|
@ApiOperation("加入网络教室")
|
|
|
@PostMapping(value = "/join")
|
|
|
- public HttpResponseResult<ImNetworkRoomResult> joinRoom(@RequestBody ImNetworkBaseDto imNetworkBaseDto) throws Exception {
|
|
|
+ public BaseResponse<ImNetworkRoomResult> joinRoom(@RequestBody ImNetworkBaseDto imNetworkBaseDto) throws Exception {
|
|
|
|
|
|
// 设置请求客户端来源
|
|
|
if (Objects.isNull(imNetworkBaseDto.getClientType())) {
|
|
@@ -64,7 +64,7 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
|
|
|
@ApiOperation("加入网络教室状态回调")
|
|
|
@PostMapping(value = "joinRoomFailure")
|
|
|
- public HttpResponseResult joinRoomFailure(@RequestBody ImNetworkBaseDto imNetworkBaseDto){
|
|
|
+ public BaseResponse joinRoomFailure(@RequestBody ImNetworkBaseDto imNetworkBaseDto){
|
|
|
|
|
|
// 设置请求客户端来源
|
|
|
if (Objects.isNull(imNetworkBaseDto.getClientType())) {
|
|
@@ -74,7 +74,7 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
imNetworkRoomService.joinRoomFailure(Optional.ofNullable(imNetworkBaseDto)
|
|
|
.map(ImNetworkBaseDto::getRoomId)
|
|
|
.orElseThrow(()->new BizException("房间号不可为空")).toString(), imNetworkBaseDto.getClientType());
|
|
|
- return succeed();
|
|
|
+ return BaseResponse.success();
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = "/statusSync")
|
|
@@ -97,7 +97,7 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
|
|
|
@ApiOperation("退出网络教室")
|
|
|
@PostMapping(value = "/leave")
|
|
|
- public HttpResponseResult leaveRoom(@RequestBody ImNetworkBaseDto imNetworkBaseDto) throws Exception {
|
|
|
+ public BaseResponse leaveRoom(@RequestBody ImNetworkBaseDto imNetworkBaseDto) throws Exception {
|
|
|
|
|
|
// 设置请求客户端来源
|
|
|
if (Objects.isNull(imNetworkBaseDto.getClientType())) {
|
|
@@ -118,12 +118,12 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
imNetworkRoomService.quitRoomSuccess(Optional.ofNullable(imNetworkBaseDto)
|
|
|
.map(ImNetworkBaseDto::getRoomId)
|
|
|
.orElseThrow(()->new BizException("房间号不可为空")).toString(), imUserId);
|
|
|
- return succeed();
|
|
|
+ return BaseResponse.success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation("控制学员节拍器")
|
|
|
@PostMapping(value = "/sendImPlayMidiMessage")
|
|
|
- public HttpResponseResult sendImPlayMidiMessage(@RequestBody ImNetworkCustomMessage customMessage) throws Exception {
|
|
|
+ public BaseResponse sendImPlayMidiMessage(@RequestBody ImNetworkCustomMessage customMessage) throws Exception {
|
|
|
|
|
|
// 设置客户端类型
|
|
|
if (Objects.isNull(customMessage.getClientType())) {
|
|
@@ -131,12 +131,12 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
}
|
|
|
|
|
|
imNetworkRoomService.sendImPlayMidiMessage(customMessage);
|
|
|
- return succeed();
|
|
|
+ return BaseResponse.success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation("移动端用来渲染页面")
|
|
|
@PostMapping(value = "/display")
|
|
|
- public HttpResponseResult display(@RequestBody ImNetworkDisplayDataDto displayData) throws Exception {
|
|
|
+ public BaseResponse display(@RequestBody ImNetworkDisplayDataDto displayData) throws Exception {
|
|
|
|
|
|
// 设置客户端类型
|
|
|
if (Objects.isNull(displayData.getClientType())) {
|
|
@@ -144,12 +144,12 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
}
|
|
|
|
|
|
imNetworkRoomService.display(displayData);
|
|
|
- return succeed();
|
|
|
+ return BaseResponse.success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "批量控制学员设备开关")
|
|
|
@PostMapping(value = "/device/batchControl")
|
|
|
- public Object batchControlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl)throws Exception {
|
|
|
+ public BaseResponse batchControlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl)throws Exception {
|
|
|
|
|
|
// 设置客户端类型
|
|
|
if (Objects.isNull(deviceControl.getClientType())) {
|
|
@@ -157,12 +157,12 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
}
|
|
|
|
|
|
imNetworkRoomService.batchControlDevice(deviceControl);
|
|
|
- return succeed();
|
|
|
+ return BaseResponse.success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "控制学员设备开关")
|
|
|
@PostMapping(value = "/device/control")
|
|
|
- public HttpResponseResult controlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl)
|
|
|
+ public BaseResponse controlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl)
|
|
|
throws Exception {
|
|
|
|
|
|
// 设置客户端类型
|
|
@@ -171,12 +171,12 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
}
|
|
|
|
|
|
imNetworkRoomService.controlDevice(deviceControl);
|
|
|
- return succeed();
|
|
|
+ return BaseResponse.success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "学员同意打开,麦克风、摄像头")
|
|
|
@PostMapping(value = "/device/approve")
|
|
|
- public HttpResponseResult approveControlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl) throws Exception {
|
|
|
+ public BaseResponse approveControlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl) throws Exception {
|
|
|
deviceControl.setEnable(true);
|
|
|
|
|
|
// 设置客户端类型
|
|
@@ -185,12 +185,12 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
}
|
|
|
|
|
|
imNetworkRoomService.approveControlDevice(deviceControl);
|
|
|
- return succeed();
|
|
|
+ return BaseResponse.success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "学员拒绝打开,麦克风、摄像头")
|
|
|
@PostMapping(value = "/device/reject")
|
|
|
- public HttpResponseResult rejectControlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl)
|
|
|
+ public BaseResponse rejectControlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl)
|
|
|
throws Exception {
|
|
|
deviceControl.setEnable(false);
|
|
|
|
|
@@ -200,7 +200,7 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
}
|
|
|
|
|
|
imNetworkRoomService.rejectControlDevice(deviceControl);
|
|
|
- return succeed();
|
|
|
+ return BaseResponse.success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "学员设备状态同步")
|
|
@@ -214,12 +214,12 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
}
|
|
|
|
|
|
imNetworkRoomService.deviceStatusSync(deviceControl);
|
|
|
- return succeed();
|
|
|
+ return BaseResponse.success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "老师在网络教室选择完伴奏后、通知学员下载伴奏")
|
|
|
@PostMapping(value = "pushDownloadMusicSheetMsg")
|
|
|
- public HttpResponseResult pushDownloadMusicSheetMsg(@RequestBody ImNetworkMusicSheetDto musicSheetDto) throws Exception {
|
|
|
+ public BaseResponse pushDownloadMusicSheetMsg(@RequestBody ImNetworkMusicSheetDto musicSheetDto) throws Exception {
|
|
|
|
|
|
// 设置客户端类型
|
|
|
if (Objects.isNull(musicSheetDto.getClientType())) {
|
|
@@ -227,12 +227,12 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
}
|
|
|
|
|
|
imNetworkRoomService.pushDownloadMusicSheetMsg(musicSheetDto);
|
|
|
- return succeed();
|
|
|
+ return BaseResponse.success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "学员伴奏下载状态回调")
|
|
|
@PostMapping(value = "musicSheetDownNotify")
|
|
|
- public HttpResponseResult adjustMusicScore(@RequestBody ImNetworkMusicSheetDto musicSheetDto) throws Exception {
|
|
|
+ public BaseResponse adjustMusicScore(@RequestBody ImNetworkMusicSheetDto musicSheetDto) throws Exception {
|
|
|
|
|
|
// 设置客户端类型
|
|
|
if (Objects.isNull(musicSheetDto.getClientType())) {
|
|
@@ -240,13 +240,13 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
}
|
|
|
|
|
|
imNetworkRoomService.musicSheetDownNotify(musicSheetDto);
|
|
|
- return succeed();
|
|
|
+ return BaseResponse.success();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "查询不在教室的学员")
|
|
|
@PostMapping(value = "/queryNoJoinStu")
|
|
|
- public HttpResponseResult queryNoJoinStu(@RequestBody ImNetworkBaseDto imNetworkBaseDto){
|
|
|
- return succeed(imNetworkRoomService.queryNoJoinStu(Optional.ofNullable(imNetworkBaseDto)
|
|
|
+ public BaseResponse<List<BasicUserInfo>> queryNoJoinStu(@RequestBody ImNetworkBaseDto imNetworkBaseDto){
|
|
|
+ return BaseResponse.success(imNetworkRoomService.queryNoJoinStu(Optional.ofNullable(imNetworkBaseDto)
|
|
|
.map(ImNetworkBaseDto::getRoomId)
|
|
|
.orElseThrow(()->new BizException("房间号不可为空"))));
|
|
|
}
|