|
@@ -3,19 +3,18 @@ package com.yonge.cooleshow.classroom.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.*;
|
|
|
-import com.yonge.cooleshow.biz.dal.enums.UserRoleEnum;
|
|
|
import com.yonge.cooleshow.biz.dal.service.ImNetworkRoomService;
|
|
|
import com.yonge.cooleshow.common.controller.BaseController;
|
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
|
import com.yonge.toolset.base.exception.BizException;
|
|
|
import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiImplicitParam;
|
|
|
-import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
-import org.springframework.http.MediaType;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.Optional;
|
|
@@ -39,12 +38,11 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
private ImNetworkRoomService imNetworkRoomService;
|
|
|
|
|
|
@ApiOperation("加入网络教室")
|
|
|
- @PostMapping(value = "/join", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
- @ApiImplicitParam(name = "roomId", dataType = "Long", value = "课程编号")
|
|
|
- public HttpResponseResult<ImNetworkRoomResult> joinRoom(Long roomId) throws Exception {
|
|
|
- roomId = Optional.ofNullable(roomId)
|
|
|
- .orElseThrow(()->new BizException("房间号不可为空"));
|
|
|
- return imNetworkRoomService.joinRoom(roomId);
|
|
|
+ @PostMapping(value = "/join")
|
|
|
+ public HttpResponseResult<ImNetworkRoomResult> joinRoom(@RequestBody ImNetworkBaseDto imNetworkBaseDto) throws Exception {
|
|
|
+ return imNetworkRoomService.joinRoom(Optional.ofNullable(imNetworkBaseDto)
|
|
|
+ .map(ImNetworkBaseDto::getRoomId)
|
|
|
+ .orElseThrow(()->new BizException("房间号不可为空")));
|
|
|
}
|
|
|
|
|
|
// @ApiOperation("加入网络教室状态回调")
|
|
@@ -55,10 +53,11 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
// }
|
|
|
|
|
|
@ApiOperation("加入网络教室状态回调")
|
|
|
- @PostMapping(value = "joinRoomFailure", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
- public HttpResponseResult joinRoomFailure(Long roomId){
|
|
|
- roomId = Optional.ofNullable(roomId).orElseThrow(()->new BizException("房间号不可为空"));
|
|
|
- imNetworkRoomService.joinRoomFailure(roomId.toString());
|
|
|
+ @PostMapping(value = "joinRoomFailure")
|
|
|
+ public HttpResponseResult joinRoomFailure(@RequestBody ImNetworkBaseDto imNetworkBaseDto){
|
|
|
+ imNetworkRoomService.joinRoomFailure(Optional.ofNullable(imNetworkBaseDto)
|
|
|
+ .map(ImNetworkBaseDto::getRoomId)
|
|
|
+ .orElseThrow(()->new BizException("房间号不可为空")).toString());
|
|
|
return succeed();
|
|
|
}
|
|
|
|
|
@@ -80,37 +79,37 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation("退出网络教室")
|
|
|
- @ApiImplicitParam(name = "roomId", dataType = "Long", value = "课程编号")
|
|
|
- @PostMapping(value = "/leave", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
- public HttpResponseResult leaveRoom(Long roomId) throws Exception {
|
|
|
- roomId = Optional.ofNullable(roomId).orElseThrow(()->new BizException("房间号不可为空"));
|
|
|
- imNetworkRoomService.leaveRoom(roomId.toString());
|
|
|
+ @PostMapping(value = "/leave")
|
|
|
+ public HttpResponseResult leaveRoom(@RequestBody ImNetworkBaseDto imNetworkBaseDto) throws Exception {
|
|
|
+ imNetworkRoomService.leaveRoom(Optional.ofNullable(imNetworkBaseDto)
|
|
|
+ .map(ImNetworkBaseDto::getRoomId)
|
|
|
+ .orElseThrow(()->new BizException("房间号不可为空")).toString());
|
|
|
return succeed();
|
|
|
}
|
|
|
|
|
|
@ApiOperation("控制学员节拍器")
|
|
|
- @PostMapping(value = "/sendImPlayMidiMessage", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
+ @PostMapping(value = "/sendImPlayMidiMessage")
|
|
|
public HttpResponseResult sendImPlayMidiMessage(@RequestBody ImNetworkCustomMessage customMessage) throws Exception {
|
|
|
imNetworkRoomService.sendImPlayMidiMessage(customMessage);
|
|
|
return succeed();
|
|
|
}
|
|
|
|
|
|
@ApiOperation("移动端用来渲染页面")
|
|
|
- @PostMapping(value = "/display", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
+ @PostMapping(value = "/display")
|
|
|
public HttpResponseResult display(@RequestBody ImNetworkDisplayDataDto displayData) throws Exception {
|
|
|
imNetworkRoomService.display(displayData);
|
|
|
return succeed();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "批量控制学员设备开关")
|
|
|
- @PostMapping(value = "/device/batchControl", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
+ @PostMapping(value = "/device/batchControl")
|
|
|
public Object batchControlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl)throws Exception {
|
|
|
imNetworkRoomService.batchControlDevice(deviceControl);
|
|
|
return succeed();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "控制学员设备开关")
|
|
|
- @PostMapping(value = "/device/control", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
+ @PostMapping(value = "/device/control")
|
|
|
public HttpResponseResult controlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl)
|
|
|
throws Exception {
|
|
|
imNetworkRoomService.controlDevice(deviceControl);
|
|
@@ -118,7 +117,7 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "学员同意打开,麦克风、摄像头")
|
|
|
- @PostMapping(value = "/device/approve", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
+ @PostMapping(value = "/device/approve")
|
|
|
public HttpResponseResult approveControlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl) throws Exception {
|
|
|
deviceControl.setEnable(true);
|
|
|
imNetworkRoomService.approveControlDevice(deviceControl);
|
|
@@ -126,7 +125,7 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "学员拒绝打开,麦克风、摄像头")
|
|
|
- @PostMapping(value = "/device/reject", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
+ @PostMapping(value = "/device/reject")
|
|
|
public HttpResponseResult rejectControlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl)
|
|
|
throws Exception {
|
|
|
deviceControl.setEnable(false);
|
|
@@ -135,41 +134,33 @@ public class ImNetworkRoomController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "学员设备状态同步")
|
|
|
- @PostMapping(value = "/device/sync", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
+ @PostMapping(value = "/device/sync")
|
|
|
public Object deviceStatusSync(@RequestBody ImNetworkDeviceControlDto deviceControl)
|
|
|
throws Exception {
|
|
|
imNetworkRoomService.deviceStatusSync(deviceControl);
|
|
|
return succeed();
|
|
|
}
|
|
|
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "roomId", dataType = "String", value = "房间号",required = true),
|
|
|
- @ApiImplicitParam(name = "accompanimentId", dataType = "Long", value = "伴奏编号",required = true)
|
|
|
- })
|
|
|
@ApiOperation(value = "老师在网络教室选择完伴奏后、通知学员下载伴奏")
|
|
|
- @PostMapping(value = "pushDownloadMusicSheetMsg", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
- public HttpResponseResult pushDownloadMusicSheetMsg(String roomId,Long accompanimentId) throws Exception {
|
|
|
- imNetworkRoomService.pushDownloadMusicSheetMsg(roomId,accompanimentId);
|
|
|
+ @PostMapping(value = "pushDownloadMusicSheetMsg")
|
|
|
+ public HttpResponseResult pushDownloadMusicSheetMsg(@RequestBody ImNetworkMusicSheetDto musicSheetDto) throws Exception {
|
|
|
+ imNetworkRoomService.pushDownloadMusicSheetMsg(musicSheetDto);
|
|
|
return succeed();
|
|
|
}
|
|
|
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "roomId", dataType = "String", value = "房间号",required = true),
|
|
|
- @ApiImplicitParam(name = "accompanimentId", dataType = "Long", value = "伴奏编号",required = false),
|
|
|
- @ApiImplicitParam(name = "status", dataType = "Integer", value = "伴奏下载状态(1下载成功0下载中2下载失败)",required = true)
|
|
|
- })
|
|
|
@ApiOperation(value = "学员伴奏下载状态回调")
|
|
|
- @PostMapping(value = "musicSheetDownNotify", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
- public HttpResponseResult adjustMusicScore(String roomId,Long accompanimentId,Integer status) throws Exception {
|
|
|
- imNetworkRoomService.musicSheetDownNotify(roomId,accompanimentId,status);
|
|
|
+ @PostMapping(value = "musicSheetDownNotify")
|
|
|
+ public HttpResponseResult adjustMusicScore(@RequestBody ImNetworkMusicSheetDto musicSheetDto) throws Exception {
|
|
|
+ imNetworkRoomService.musicSheetDownNotify(musicSheetDto);
|
|
|
return succeed();
|
|
|
}
|
|
|
|
|
|
- @ApiImplicitParam(name = "roomId", dataType = "Long", value = "房间号",required = true)
|
|
|
@ApiOperation(value = "查询不在教室的学员")
|
|
|
- @PostMapping(value = "/queryNoJoinStu", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
- public HttpResponseResult queryNoJoinStu(Long roomId){
|
|
|
- return succeed(imNetworkRoomService.queryNoJoinStu(roomId));
|
|
|
+ @PostMapping(value = "/queryNoJoinStu")
|
|
|
+ public HttpResponseResult queryNoJoinStu(@RequestBody ImNetworkBaseDto imNetworkBaseDto){
|
|
|
+ return succeed(imNetworkRoomService.queryNoJoinStu(Optional.ofNullable(imNetworkBaseDto)
|
|
|
+ .map(ImNetworkBaseDto::getRoomId)
|
|
|
+ .orElseThrow(()->new BizException("房间号不可为空"))));
|
|
|
}
|
|
|
}
|
|
|
|