瀏覽代碼

Merge remote-tracking branch 'origin/master'

liweifan 2 年之前
父節點
當前提交
93210f10e6
共有 42 個文件被更改,包括 866 次插入446 次删除
  1. 2 2
      cooleshow-api/src/main/java/com/yonge/cooleshow/api/feign/AdminFeignService.java
  2. 1 1
      cooleshow-mall/mall-admin/src/main/resources/config/mybatis/OmsOrderDao.xml
  3. 1 1
      cooleshow-mall/mall-admin/src/main/resources/config/mybatis/PmsProductDao.xml
  4. 3 1
      cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/config/ResourceServerConfig.java
  5. 9 1
      cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/controller/OmsPortalOrderController.java
  6. 10 0
      cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/dto/OrderPayRes.java
  7. 3 1
      cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/service/impl/HomeServiceImpl.java
  8. 13 0
      cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/service/impl/OmsPortalOrderServiceImpl.java
  9. 1 1
      cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/client/AdminFeignClient.java
  10. 6 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseGroupDao.java
  11. 3 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleDao.java
  12. 7 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleRecordDao.java
  13. 19 19
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleStudentDao.java
  14. 2 2
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleStudentMusicSheetDao.java
  15. 5 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleStudentPaymentDao.java
  16. 0 9
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/ImNetworkControlDeviceNotifyMessage.java
  17. 8 8
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/ImNetworkCustomMessage.java
  18. 10 10
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/ImNetworkDeviceControlDto.java
  19. 5 5
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/ImNetworkDeviceStateChangedMessage.java
  20. 54 54
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/CourseScheduleStudent.java
  21. 5 5
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/CourseScheduleStudentMusicSheet.java
  22. 8 8
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/PianoRoomTime.java
  23. 1 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/enums/MessageTypeEnum.java
  24. 8 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/CourseScheduleService.java
  25. 294 32
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java
  26. 52 41
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ImNetworkRoomServiceImpl.java
  27. 0 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/ArrangeCourseVo.java
  28. 34 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/CourseCompleteVo.java
  29. 125 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/CourseScheduleRecordVo.java
  30. 11 2
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/CourseScheduleStudentVo.java
  31. 8 1
      cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseGroupMapper.xml
  32. 7 3
      cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  33. 59 7
      cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleRecordMapper.xml
  34. 0 23
      cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleStudentMapper.xml
  35. 4 4
      cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleStudentMusicSheetDao.xml
  36. 20 5
      cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml
  37. 1 1
      cooleshow-user/user-biz/src/main/resources/config/mybatis/ImNetworkRoomMemberMapper.xml
  38. 1 1
      cooleshow-user/user-biz/src/main/resources/config/mybatis/UserBindingTeacherMapper.xml
  39. 2 0
      cooleshow-user/user-classroom/src/main/java/com/yonge/cooleshow/classroom/controller/ImNetworkRoomController.java
  40. 0 166
      cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/ImNetworkRoomController.java
  41. 0 29
      cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/ImNetworkRoomMemberController.java
  42. 64 1
      cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/TeacherCourseScheduleController.java

+ 2 - 2
cooleshow-api/src/main/java/com/yonge/cooleshow/api/feign/AdminFeignService.java

@@ -39,10 +39,10 @@ public interface AdminFeignService {
     /**
      * 老师作业布置通知
      */
-    @GetMapping("/admin/teacherSend")
+    @GetMapping("/task/teacherSend")
     HttpResponseResult<Object> sendTodayNotRepliedAndNotDecorateHomework();
 
     //老师课酬
-    @PostMapping(value = "/teacherEarning")
+    @PostMapping(value = "/task/teacherEarning")
     HttpResponseResult<Object> sendTeacherEarning();
 }

+ 1 - 1
cooleshow-mall/mall-admin/src/main/resources/config/mybatis/OmsOrderDao.xml

@@ -118,7 +118,7 @@
             sum(if(status = 2,1,0)) as outOrder,
             sum(if(status = 3,1,0)) as successOrder,
             sum(if(status = 2 and confirm_status = 0,1,0)) as waitReceiptOrder
-        from oms_order
+        from oms_order where delete_status = 0
     </select>
 
     <select id="selectOrderCountAndAmount" resultType="com.yonge.cooleshow.admin.dto.OrderStatistical">

+ 1 - 1
cooleshow-mall/mall-admin/src/main/resources/config/mybatis/PmsProductDao.xml

@@ -52,7 +52,7 @@
              from  pms_sku_stock pss
              where pss.stock &lt;= pss.low_stock) b
         on b.product_id = pp.id
-        where  (pp.stock &lt;= pp.low_stock or b.product_id is not null)
+        where  (pp.stock &lt;= pp.low_stock or b.product_id is not null) and pp.delete_status = 0
     </select>
 
     <select id="selectProductShowStatusCount" resultType="com.yonge.cooleshow.admin.dto.HomeStatistical">

+ 3 - 1
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/config/ResourceServerConfig.java

@@ -26,7 +26,9 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
         http.csrf().disable().exceptionHandling().accessDeniedHandler(baseAccessDeniedHandler).authenticationEntryPoint(baseAuthenticationEntryPoint).and()
             .authorizeRequests().antMatchers("/task/**").hasIpAddress("0.0.0.0/0")
                 .and()
-                .authorizeRequests().antMatchers("/wechat/*","/v2/api-docs", "/code/*").permitAll().anyRequest().permitAll().and().httpBasic();
+                .authorizeRequests().antMatchers("/wechat/*","/v2/api-docs", "/code/*","/payment/callback/**",
+                 "/order/paySuccess/test")
+            .permitAll().anyRequest().permitAll().and().httpBasic();
     }
 
     @Override

+ 9 - 1
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/controller/OmsPortalOrderController.java

@@ -62,7 +62,7 @@ public class OmsPortalOrderController {
     }
 
     @ApiOperation("用户支付成功的回调")
-    // @RequestMapping(value = "/paySuccess", method = RequestMethod.POST)
+    @RequestMapping(value = "/paySuccess", method = RequestMethod.POST)
     @ResponseBody
     public CommonResult paySuccess(@RequestParam Long orderId,@RequestParam Integer payType) {
         Integer count = portalOrderService.paySuccess(orderId,payType);
@@ -128,4 +128,12 @@ public class OmsPortalOrderController {
         portalOrderService.deleteOrder(orderId);
         return CommonResult.success(null);
     }
+
+    @ApiOperation("用户支付成功的回调")
+    @RequestMapping(value = "/paySuccess/test", method = RequestMethod.GET)
+    @ResponseBody
+    public CommonResult paySuccessTest(@RequestParam Long orderId,@RequestParam Integer payType) {
+        Integer count = portalOrderService.paySuccess(orderId,payType);
+        return CommonResult.success(count, "支付成功");
+    }
 }

+ 10 - 0
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/dto/OrderPayRes.java

@@ -23,6 +23,8 @@ public class OrderPayRes {
     @JsonIgnore
     private String message;
 
+    @ApiModelProperty("支付单号")
+    private String paymentNo;
 
 
     @ApiModelProperty(value = "订单编号",required = true)
@@ -91,4 +93,12 @@ public class OrderPayRes {
     public void setTransNo(String transNo) {
         this.transNo = transNo;
     }
+
+    public String getPaymentNo() {
+        return paymentNo;
+    }
+
+    public void setPaymentNo(String paymentNo) {
+        this.paymentNo = paymentNo;
+    }
 }

+ 3 - 1
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/service/impl/HomeServiceImpl.java

@@ -217,7 +217,9 @@ public class HomeServiceImpl implements HomeService {
 
     private List<SmsHomeAdvertise> getHomeAdvertiseList() {
         SmsHomeAdvertiseExample example = new SmsHomeAdvertiseExample();
-        example.createCriteria().andTypeEqualTo(1).andStatusEqualTo(1);
+        example.createCriteria().andTypeEqualTo(1).andStatusEqualTo(1)
+               .andEndTimeGreaterThanOrEqualTo(new Date())
+               .andStartTimeLessThanOrEqualTo(new Date());
         example.setOrderByClause("sort desc");
         return advertiseMapper.selectByExample(example);
     }

+ 13 - 0
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/service/impl/OmsPortalOrderServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.portal.dao.PortalProductDao;
 import com.yonge.cooleshow.portal.dto.OrderPayReq;
 import com.yonge.cooleshow.portal.dto.OrderPayRes;
@@ -585,6 +586,18 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
 
         saveOrderPayment(executePayment.getData(), detail,payReq.getPaymentClient());
 
+        if (executePayment.getStatus()) {
+            orderPayRes.setPay_amt(detail.getPayAmount().setScale(2, RoundingMode.HALF_UP).toString());
+            String pay_info = executePayment.getData().getPayInfo();
+            orderPayRes.setPay_info(pay_info);
+            orderPayRes.setPayChannel(payReq.getPayChannel().getCode());
+            orderPayRes.setPaymentNo(payment.getPaymentNo());
+            orderPayRes.setStatus(true);
+
+        } else {
+            orderPayRes.setMessage(executePayment.getMsg());
+            orderPayRes.setStatus(false);
+        }
         return orderPayRes;
     }
 

+ 1 - 1
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/client/AdminFeignClient.java

@@ -17,7 +17,7 @@ import springfox.documentation.annotations.ApiIgnore;
  */
 @ApiIgnore
 @RestController
-@RequestMapping("/feign-client/admin")
+@RequestMapping("/task")
 public class AdminFeignClient {
 
     @Autowired

+ 6 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseGroupDao.java

@@ -179,5 +179,11 @@ public interface CourseGroupDao extends BaseMapper<CourseGroup> {
      * @return
      */
     CourseGroupInfoVo selectGroupInfoVo(Long groupId);
+
+    /**
+     * 批量更新组状态
+     * @param list
+     */
+    void updateBatch(List<Long> list);
 }
 

+ 3 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleDao.java

@@ -225,4 +225,7 @@ public interface CourseScheduleDao extends BaseMapper<CourseSchedule> {
 
     //更新老师课酬
     void updateTeacherSalary(List<Long> list);
+
+    //查询已完成课时
+    List<CourseCompleteVo> selectComplete();
 }

+ 7 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleRecordDao.java

@@ -1,10 +1,14 @@
 package com.yonge.cooleshow.biz.dal.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.yonge.cooleshow.biz.dal.entity.CourseScheduleRecord;
+import com.yonge.cooleshow.biz.dal.vo.CourseScheduleRecordVo;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Author: cy
@@ -19,4 +23,7 @@ public interface CourseScheduleRecordDao extends BaseMapper<CourseScheduleRecord
 
     //消耗时长
     Long countTimeByTeacherId(@Param("teacherId")Long teacherId,@Param("month") String month);
+
+    //消耗时长详情
+    IPage<CourseScheduleRecordVo> selectConsumeTimeList(Page<CourseScheduleRecordVo> pageInfo, @Param("param") Map<String, Object> param);
 }

+ 19 - 19
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleStudentDao.java

@@ -1,19 +1,19 @@
-package com.yonge.cooleshow.biz.dal.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.yonge.cooleshow.biz.dal.entity.CourseScheduleStudent;
-import com.yonge.cooleshow.biz.dal.vo.CourseScheduleStudentVo;
-
-import java.util.List;
-
-/**
- * @Author: cy
- * @Date: 2022/5/27
- */
-public interface CourseScheduleStudentDao extends BaseMapper<CourseScheduleStudent> {
-    //批量添加学员
-    void insertBatch(List<CourseScheduleStudent> list);
-
-    //查询课程对应的老师学员
-    List<CourseScheduleStudentVo> selectUser();
-}
+//package com.yonge.cooleshow.biz.dal.dao;
+//
+//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+//import com.yonge.cooleshow.biz.dal.entity.CourseScheduleStudent;
+//import com.yonge.cooleshow.biz.dal.vo.CourseScheduleStudentVo;
+//
+//import java.util.List;
+//
+///**
+// * @Author: cy
+// * @Date: 2022/5/27
+// */
+//public interface CourseScheduleStudentDao extends BaseMapper<CourseScheduleStudent> {
+//    //批量添加学员
+//    void insertBatch(List<CourseScheduleStudent> list);
+//
+//    //查询课程对应的老师学员
+//    List<CourseScheduleStudentVo> selectUser();
+//}

+ 2 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleStudentMusicSheetDao.java

@@ -22,10 +22,10 @@ public interface CourseScheduleStudentMusicSheetDao extends BaseMapper<CourseSch
                                                                           @Param("userType") Integer userType);
     //开启原音播放
     void openPlayStatus(@Param("scheduleId") Long scheduleId,
-                       @Param("musicScoreAccompanimentId") Integer musicScoreAccompanimentId,
+                       @Param("musicSheetAccompanimentId") Integer musicSheetAccompanimentId,
                        @Param("userId") Long userId);
     void openAccompanimentPlayStatus(@Param("scheduleId") Long scheduleId,
-                                    @Param("musicScoreAccompanimentId") Integer musicScoreAccompanimentId,
+                                    @Param("musicSheetAccompanimentId") Integer musicSheetAccompanimentId,
                                     @Param("userId") Long userId);
     //关闭伴奏
     void closePlayStatus(@Param("courseId") Long courseId,@Param("userId") Long userId);

+ 5 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleStudentPaymentDao.java

@@ -3,6 +3,7 @@ package com.yonge.cooleshow.biz.dal.dao;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.yonge.cooleshow.biz.dal.entity.CourseScheduleStudentPayment;
 import com.yonge.cooleshow.biz.dal.vo.CourseScheduleStudentPaymentVo;
+import com.yonge.cooleshow.biz.dal.vo.CourseScheduleStudentVo;
 import com.yonge.cooleshow.biz.dal.vo.LiveCourseInfoVo;
 import org.apache.ibatis.annotations.Param;
 
@@ -65,7 +66,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseMapper<CourseSchedu
     String getMusicSheetByCourseIdAndUserId(@Param("courseScheduleId") Long courseScheduleId, @Param("userId") Long userId);
 
     //调整节拍器
-    void adjustPlayMidi(@Param("courseScheduleId") long courseScheduleId, @Param("userId") Long userId, @Param("content") String content);
+    void adjustPlayMidi(@Param("courseScheduleId") long courseScheduleId, @Param("userId") String userId, @Param("content") String content);
 
     //调整伴奏
     void adjustExamSong(@Param("courseScheduleId") long courseScheduleId, @Param("userId") Long userId, @Param("examSongJson") String examSongJson);
@@ -84,5 +85,8 @@ public interface CourseScheduleStudentPaymentDao extends BaseMapper<CourseSchedu
      * @date 2022/5/7 16:44
      */
     void adjustPlayMidiAndMusicSheet(Long scheduleId, Long userId, String content, String musicSheetJson);
+
+    //查询报课学员
+    List<CourseScheduleStudentVo> selectUser();
 }
 

+ 0 - 9
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/ImNetworkControlDeviceNotifyMessage.java

@@ -6,7 +6,6 @@ import com.yonge.cooleshow.biz.dal.entity.BaseMessage;
 public class ImNetworkControlDeviceNotifyMessage extends BaseMessage {
 
     private int action;
-//    private String ticket;
     private int type;
     private String opUserId;
     private String opUserName;
@@ -23,14 +22,6 @@ public class ImNetworkControlDeviceNotifyMessage extends BaseMessage {
         this.action = action;
     }
 
-//    public String getTicket() {
-//        return ticket;
-//    }
-//
-//    public void setTicket(String ticket) {
-//        this.ticket = ticket;
-//    }
-
     public int getType() {
         return type;
     }

+ 8 - 8
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/ImNetworkCustomMessage.java

@@ -8,7 +8,7 @@ public class ImNetworkCustomMessage extends BaseMessage {
     @ApiModelProperty(value = "节拍器开关",required = true)
     private boolean enable;
 
-    @ApiModelProperty(value = "消息类型",required = true)
+    @ApiModelProperty(value = "消息类型(移动端定义,具体的类型不太清楚)",required = true)
     private int customType;
 
     @ApiModelProperty(value = "速度",required = true)
@@ -17,18 +17,18 @@ public class ImNetworkCustomMessage extends BaseMessage {
     @ApiModelProperty(value = "音量",required = true)
     private int playVolume;
 
-    @ApiModelProperty(value = "用户",required = false)
+    @ApiModelProperty(value = "学员编号列表,都还分割",required = true)
     private String userId;
 
-    @ApiModelProperty(value = "课程编号",required = true)
-    private Long courseScheduleId;
+    @ApiModelProperty(value = "房间号(课程编号",required = true)
+    private Long roomId;
 
-    public Long getCourseScheduleId() {
-        return courseScheduleId;
+    public Long getRoomId() {
+        return roomId;
     }
 
-    public void setCourseScheduleId(Long courseScheduleId) {
-        this.courseScheduleId = courseScheduleId;
+    public void setRoomId(Long roomId) {
+        this.roomId = roomId;
     }
 
     public int getPlayVolume() {

+ 10 - 10
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/ImNetworkDeviceControlDto.java

@@ -23,10 +23,10 @@ public class ImNetworkDeviceControlDto {
 	private Integer status;
 
 	@ApiModelProperty(value = "原音",required = true)
-	private Integer examSongId;
+	private Integer musicSheetId;
 
 	@ApiModelProperty(value = "伴奏",required = true)
-	private Integer musicScoreAccompanimentId;
+	private Integer musicSheetAccompanimentId;
 
 	@ApiModelProperty(value = "伴奏音量",required = true)
 	private Integer soundVolume = 100;
@@ -79,20 +79,20 @@ public class ImNetworkDeviceControlDto {
 		this.status = status;
 	}
 
-	public Integer getExamSongId() {
-		return examSongId;
+	public Integer getMusicSheetId() {
+		return musicSheetId;
 	}
 
-	public void setExamSongId(Integer examSongId) {
-		this.examSongId = examSongId;
+	public void setMusicSheetId(Integer musicSheetId) {
+		this.musicSheetId = musicSheetId;
 	}
 
-	public Integer getMusicScoreAccompanimentId() {
-		return musicScoreAccompanimentId;
+	public Integer getMusicSheetAccompanimentId() {
+		return musicSheetAccompanimentId;
 	}
 
-	public void setMusicScoreAccompanimentId(Integer musicScoreAccompanimentId) {
-		this.musicScoreAccompanimentId = musicScoreAccompanimentId;
+	public void setMusicSheetAccompanimentId(Integer musicSheetAccompanimentId) {
+		this.musicSheetAccompanimentId = musicSheetAccompanimentId;
 	}
 
 	public Integer getSoundVolume() {

+ 5 - 5
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/ImNetworkDeviceStateChangedMessage.java

@@ -6,7 +6,7 @@ import com.yonge.cooleshow.biz.dal.entity.BaseMessage;
 public class ImNetworkDeviceStateChangedMessage extends BaseMessage {
     private boolean enable;
     private int type;
-    private Integer musicScoreAccompanimentId;
+    private Integer musicSheetAccompanimentId;
     private String userId;
     private String userName;
     private Integer soundVolume = 100;
@@ -32,12 +32,12 @@ public class ImNetworkDeviceStateChangedMessage extends BaseMessage {
         this.type = type;
     }
 
-    public Integer getMusicScoreAccompanimentId() {
-        return musicScoreAccompanimentId;
+    public Integer getMusicSheetAccompanimentId() {
+        return musicSheetAccompanimentId;
     }
 
-    public void setMusicScoreAccompanimentId(Integer musicScoreAccompanimentId) {
-        this.musicScoreAccompanimentId = musicScoreAccompanimentId;
+    public void setMusicSheetAccompanimentId(Integer musicSheetAccompanimentId) {
+        this.musicSheetAccompanimentId = musicSheetAccompanimentId;
     }
 
     public String getUserId() {

+ 54 - 54
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/CourseScheduleStudent.java

@@ -1,54 +1,54 @@
-package com.yonge.cooleshow.biz.dal.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * @Author: cy
- * @Date: 2022/5/26
- */
-@ApiModel
-public class CourseScheduleStudent implements Serializable {
-    @TableId(value = "id_", type = IdType.AUTO)
-    @ApiModelProperty(value = "主键")
-    private Long id;
-
-    @TableField("course_id_")
-    @ApiModelProperty(value = "课程id")
-    private Long courseId;
-
-    @TableField("student_id_")
-    @ApiModelProperty(value = "学生id")
-    private Long studentId;
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public Long getCourseId() {
-        return courseId;
-    }
-
-    public void setCourseId(Long courseId) {
-        this.courseId = courseId;
-    }
-
-    public Long getStudentId() {
-        return studentId;
-    }
-
-    public void setStudentId(Long studentId) {
-        this.studentId = studentId;
-    }
-}
-
+//package com.yonge.cooleshow.biz.dal.entity;
+//
+//import com.baomidou.mybatisplus.annotation.IdType;
+//import com.baomidou.mybatisplus.annotation.TableField;
+//import com.baomidou.mybatisplus.annotation.TableId;
+//import io.swagger.annotations.ApiModel;
+//import io.swagger.annotations.ApiModelProperty;
+//
+//import java.io.Serializable;
+//import java.util.Date;
+//
+///**
+// * @Author: cy
+// * @Date: 2022/5/26
+// */
+//@ApiModel
+//public class CourseScheduleStudent implements Serializable {
+//    @TableId(value = "id_", type = IdType.AUTO)
+//    @ApiModelProperty(value = "主键")
+//    private Long id;
+//
+//    @TableField("course_id_")
+//    @ApiModelProperty(value = "课程id")
+//    private Long courseId;
+//
+//    @TableField("student_id_")
+//    @ApiModelProperty(value = "学生id")
+//    private Long studentId;
+//
+//    public Long getId() {
+//        return id;
+//    }
+//
+//    public void setId(Long id) {
+//        this.id = id;
+//    }
+//
+//    public Long getCourseId() {
+//        return courseId;
+//    }
+//
+//    public void setCourseId(Long courseId) {
+//        this.courseId = courseId;
+//    }
+//
+//    public Long getStudentId() {
+//        return studentId;
+//    }
+//
+//    public void setStudentId(Long studentId) {
+//        this.studentId = studentId;
+//    }
+//}
+//

+ 5 - 5
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/CourseScheduleStudentMusicSheet.java

@@ -33,7 +33,7 @@ public class CourseScheduleStudentMusicSheet implements Serializable {
 
     @TableField("down_status_")
     @ApiModelProperty(value = "伴奏下载状态(1下载成功0下载中2下载失败)")
-    private Integer downStatus;
+    private Integer downStatus = 0;
 
     @TableField("music_sheet_accompaniment_id_")
     @ApiModelProperty(value = "伴奏编号")
@@ -41,19 +41,19 @@ public class CourseScheduleStudentMusicSheet implements Serializable {
 
     @TableField("play_status_")
     @ApiModelProperty(value = "原音播放状态(1是0否)")
-    private Integer playStatus;
+    private Integer playStatus = 0;
 
     @TableField("accompaniment_play_status_")
     @ApiModelProperty(value = "伴奏播放状态")
-    private Integer accompanimentPlayStatus;
+    private Integer accompanimentPlayStatus = 0;
 
     @TableField("user_type_")
     @ApiModelProperty(value = "0学生1老师")
-    private Integer userType;
+    private Integer userType = 0;
 
     @TableField("speed_")
     @ApiModelProperty(value = "播放速度")
-    private Integer speed;
+    private Integer speed = 100;
 
     @TableField("create_time_")
     @ApiModelProperty(value = "${column.comment}")

+ 8 - 8
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/PianoRoomTime.java

@@ -43,14 +43,6 @@ public class PianoRoomTime implements Serializable {
     @ApiModelProperty(value = "我的学员")
     private Integer studentCount;
 
-    public Integer getStudentCount() {
-        return studentCount;
-    }
-
-    public void setStudentCount(Integer studentCount) {
-        this.studentCount = studentCount;
-    }
-
     public Long getId() {
         return id;
     }
@@ -98,5 +90,13 @@ public class PianoRoomTime implements Serializable {
     public void setUpdateTime(Date updateTime) {
         this.updateTime = updateTime;
     }
+
+    public Integer getStudentCount() {
+        return studentCount;
+    }
+
+    public void setStudentCount(Integer studentCount) {
+        this.studentCount = studentCount;
+    }
 }
 

+ 1 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/enums/MessageTypeEnum.java

@@ -39,6 +39,7 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
 
     STUDENT_BUY_PRACTICE("学员购买陪练课"),
     SMS_STUDENT_BUY_PRACTICE("学员购买陪练课(短信)"),
+    ARRANGE_PIANO_ROOM_CLASS("琴房课排课"),
 
     STUDENT_BUY_LIVE("学员购买直播课"),
     STUDENT_BUY_VIDEO("学员购买视频课"),

+ 8 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/CourseScheduleService.java

@@ -245,5 +245,13 @@ public interface CourseScheduleService extends IService<CourseSchedule> {
     void arrangeCourse(ArrangeCourseVo arrangeCourseVo, Long teacherId);
 
     Map<String, Object> selectConsumeTime(String month, Long teacherId);
+
+    PageInfo<CourseScheduleRecordVo> selectConsumeTimeList(Map<String, Object> param);
+
+    void deleteCourse(Map<String, Object> param);
+
+    void updateCourseTime(Map<String, Object> param);
+
+    void updateCourseStudent(Map<String, Object> param);
 }
 

+ 294 - 32
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java

@@ -99,8 +99,6 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
     @Autowired
     private UserBindingTeacherDao userBindingTeacherDao;
     @Autowired
-    private CourseScheduleStudentDao courseScheduleStudentDao;
-    @Autowired
     private CourseScheduleRecordDao recordDao;
 
     @Override
@@ -884,7 +882,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         timeList.forEach(o -> {
             boolean checkDataTime = this.checkStudentCourseTime(studentId, startTimeFun.apply(o), endTimeFun.apply(o));
             if (checkDataTime) {
-                throw new BizException("预计安排在" + DateUtil.dateToString(startTimeFun.apply(o), "yyyy年MM月dd号 HH点mm分") + "的课程时间存在冲突!");
+                throw new BizException("学生id:" + studentId + ",预计安排在" + DateUtil.dateToString(startTimeFun.apply(o), "yyyy年MM月dd号 HH点mm分") + "的课程时间存在冲突!");
             }
         });
     }
@@ -1117,23 +1115,14 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
             throw new BizException("课程无人购买");
         }
 
+        CourseTimeEntity timeEntity = new CourseTimeEntity();
+        timeEntity.setStartTime(startTime);
+        timeEntity.setEndTime(endTime);
+        List<CourseTimeEntity> timeList = Arrays.asList(timeEntity);
         //校验老师课程是否冲突
-        List<CourseSchedule> scheduleList = this.list(Wrappers.<CourseSchedule>lambdaQuery()
-                .eq(CourseSchedule::getTeacherId, teacherId)
-                .in(CourseSchedule::getStatus, Lists.newArrayList(CourseScheduleEnum.NOT_START.getCode(), CourseScheduleEnum.ING.getCode())));
-        for (CourseSchedule courseSchedule : scheduleList) {
-            if (inInterSection(startTime, endTime, courseSchedule.getStartTime(), courseSchedule.getEndTime(), true)) {
-                throw new BizException("老师排课冲突,课程id:{}", courseSchedule.getId());
-            }
-        }
-
+        this.batchCheckTeacherCourseTime(teacherId, timeList, CourseTimeEntity::getStartTime, CourseTimeEntity::getEndTime);
         //校验学生课程是否冲突
-        List<CourseSchedule> studentList = baseMapper.selectSchedule(courseId);
-        for (CourseSchedule courseSchedule : studentList) {
-            if (inInterSection(startTime, endTime, courseSchedule.getStartTime(), courseSchedule.getEndTime(), true)) {
-                throw new BizException("学生排课冲突,课程id:{}", courseSchedule.getId());
-            }
-        }
+        this.batchCheckTeacherCourseTime(studentPayment.getUserId(), timeList, CourseTimeEntity::getStartTime, CourseTimeEntity::getEndTime);
 
         baseMapper.courseAdjust(adjustVo);
     }
@@ -1503,14 +1492,18 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         }
 
         //课程结束(NOW ≥ 结束时间)
-        List<CourseScheduleStudentVo> userList = courseScheduleStudentDao.selectUser();
+        List<CourseScheduleStudentVo> userList = paymentDao.selectUser();
         if (CollectionUtils.isNotEmpty(userList)) {
             //更新学生最近结课时间
-            pianoRoomTimeDao.updateEndTime(userList);
+            List<CourseScheduleStudentVo> pianoUserList = userList.stream().filter((CourseScheduleStudentVo s) -> s.getType().equals(CourseScheduleEnum.PIANO_ROOM_CLASS.getCode())).collect(Collectors.toList());
+            if (CollectionUtils.isNotEmpty(pianoUserList)) {
+                pianoRoomTimeDao.updateEndTime(pianoUserList);
+            }
 
+            //统计琴房课消耗时长
             List<CourseScheduleRecord> recordList = recordDao.sumCourseTime();
             if (CollectionUtils.isNotEmpty(recordList)) {
-                //记录消耗课时
+                //时长消费记录
                 recordDao.insertBatch(recordList);
 
                 //释放冻结课时
@@ -1531,6 +1524,29 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
             //课程状态更新为COMPLETE
             baseMapper.updateEndTime(userList);
         }
+
+        //查完完成的课程
+        List<CourseCompleteVo> completeList = baseMapper.selectComplete();
+        if (CollectionUtils.isNotEmpty(completeList)) {
+            List<Long> gids = completeList.stream().map(CourseCompleteVo::getCourseGroupId).collect(Collectors.toList());
+            List<CourseGroup> courseGroups = courseGroupService.getDao().selectList(Wrappers.<CourseGroup>lambdaQuery().in(CourseGroup::getId, gids));
+            if (CollectionUtils.isNotEmpty(courseGroups)) {
+                List<Long> ids = new ArrayList<>();
+                for (CourseGroup group : courseGroups) {
+                    for (CourseCompleteVo complete : completeList) {
+                        Integer courseNum = group.getCourseNum();
+                        Integer completeCount = complete.getCourseCount();
+                        if (courseNum.equals(completeCount)) {
+                            ids.add(complete.getCourseGroupId());
+                        }
+                    }
+                }
+                if (CollectionUtils.isNotEmpty(ids)) {
+                    //同步课程组状态
+                    courseGroupService.getDao().updateBatch(ids);
+                }
+            }
+        }
     }
 
     /**
@@ -1567,7 +1583,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
     public PageInfo<CourseStudentVo> selectStudent(Map<String, Object> param) {
         Integer courseId = (Integer) param.get("courseId");
         if (courseId != null) {
-            List<CourseScheduleStudent> studentList = courseScheduleStudentDao.selectList(Wrappers.<CourseScheduleStudent>lambdaQuery().eq(CourseScheduleStudent::getCourseId, courseId));
+            List<CourseScheduleStudentPayment> studentList = paymentDao.selectList(Wrappers.<CourseScheduleStudentPayment>lambdaQuery().eq(CourseScheduleStudentPayment::getCourseId, courseId));
             param.put("studentList", studentList);//根据课程id查询报课学员
         }
         return PageUtil.pageInfo(userBindingTeacherDao.selectStudent(PageUtil.getPageInfo(param), param));
@@ -1623,7 +1639,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
 
         //校验学员是否绑定
         List<UserBindingTeacher> bindingTeachers = userBindingTeacherDao.selectList(Wrappers.<UserBindingTeacher>lambdaQuery().eq(UserBindingTeacher::getTeacherId, teacherId));
-        if (com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isEmpty(bindingTeachers)) {
+        if (CollectionUtils.isEmpty(bindingTeachers)) {
             throw new BizException("无绑定学员");
         }
         List<Long> studentList = bindingTeachers.stream().map(UserBindingTeacher::getStudentId).collect(Collectors.toList());
@@ -1664,7 +1680,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         courseGroup.setSubjectId(arrangeCourseVo.getSubjectId());
         courseGroup.setSingleCourseMinutes(singleClssTime);
         courseGroup.setCourseNum(classNum);
-        courseGroup.setStatus(CourseGroupEnum.NOT_SALE.getCode());
+        courseGroup.setStatus(CourseGroupEnum.ING.getCode());
         courseGroup.setCreatedBy(teacherId);
         courseGroupService.getDao().insert(courseGroup);
 
@@ -1685,15 +1701,17 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
             schedule.setSingleCourseTime(singleClssTime);
             baseMapper.insert(schedule);
 
-            //添加course_schedule_student
-            List<CourseScheduleStudent> list = new ArrayList<>();
+            //添加payment
             for (Long studentId : studentIds) {
-                CourseScheduleStudent teacherTime = new CourseScheduleStudent();
-                teacherTime.setStudentId(studentId);
-                teacherTime.setCourseId(schedule.getId());
-                list.add(teacherTime);
+                CourseScheduleStudentPayment payment = new CourseScheduleStudentPayment();
+                payment.setCourseGroupId(courseGroup.getId());
+                payment.setCourseId(schedule.getId());
+                payment.setUserId(studentId);
+                payment.setCourseType(CourseScheduleEnum.PIANO_ROOM_CLASS.getCode());
+                courseScheduleStudentPaymentService.save(payment);
+
+                pianoSend(teacherId, studentId);
             }
-            courseScheduleStudentDao.insertBatch(list);
         }
 
         //扣减piano_room_time
@@ -1704,11 +1722,255 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
     }
 
     /**
-     * 根据月份查询消耗记录
+     * @Description: 根据月份查询消耗记录
+     * @Author: cy
+     * @Date: 2022/5/30
      */
     public Map<String, Object> selectConsumeTime(String month, Long teacherId) {
         Map<String, Object> map = new HashMap();
         map.put("consumeTime", recordDao.countTimeByTeacherId(teacherId, month));
         return map;
     }
+
+    /**
+     * @Description: 消耗时长详情
+     * @Author: cy
+     * @Date: 2022/5/30
+     */
+    @Override
+    public PageInfo<CourseScheduleRecordVo> selectConsumeTimeList(Map<String, Object> param) {
+        param.put("type", CourseScheduleEnum.PIANO_ROOM_CLASS.getCode());
+        return PageUtil.pageInfo(recordDao.selectConsumeTimeList(PageUtil.getPageInfo(param), param));
+    }
+
+    /**
+     * @Description: 排课推送
+     * @Author: cy
+     * @Date: 2022/5/31
+     */
+    public void pianoSend(Long teacherId, Long studentId) {
+        try {
+            //查询老师&学生信息
+            SysUser teacher = sysUserFeignService.queryUserById(teacherId);
+            SysUser student = sysUserFeignService.queryUserById(studentId);
+
+            //消息接收者(Key:用户编号 value:消息接收对象)
+            Map<Long, String> studentReceivers = new HashMap<>();
+            studentReceivers.put(studentId, student.getPhone());
+
+            String pianoUrl = sysMessageService.selectConfigUrl(MessageTypeEnum.ARRANGE_PIANO_ROOM_CLASS.getCode());
+            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.ARRANGE_PIANO_ROOM_CLASS,
+                    studentReceivers, null, 0, pianoUrl, ClientEnum.STUDENT.getCode(),
+                    teacher.getUsername());
+            log.info("老师:{},学员:{},排课推送成功", teacherId, studentId);
+        } catch (Exception e) {
+            log.error("老师:{},学员:{},排课推送失败,{}", teacherId, studentId, e);
+        }
+    }
+
+    /**
+     * @Description: 删除课程
+     * @Author: cy
+     * @Date: 2022/5/31
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public void deleteCourse(Map<String, Object> param) {
+        Long courseId = WrapperUtil.toLong(param, "courseId", "课程id不能为空!");
+        Long teacherId = WrapperUtil.toLong(param, "teacherId", "老师id不能为空!");
+
+        //校验课程是否存在
+        CourseSchedule schedule = baseMapper.selectOne(Wrappers.<CourseSchedule>lambdaQuery()
+                .eq(CourseSchedule::getId, courseId)
+                .eq(CourseSchedule::getTeacherId, teacherId)
+                .eq(CourseSchedule::getType, CourseScheduleEnum.PIANO_ROOM_CLASS.getCode()));
+        if (schedule == null) {
+            throw new BizException("课程不存在");
+        }
+
+        //课程是否未开始
+        if (!schedule.getStatus().equals(CourseScheduleEnum.NOT_START.getCode())) {
+            throw new BizException("只能删除未开始的课程");
+        }
+
+        //计算课时
+        List<CourseScheduleStudentPayment> studentPaymentList = paymentDao.selectList(Wrappers.<CourseScheduleStudentPayment>lambdaQuery().eq(CourseScheduleStudentPayment::getCourseId, courseId));
+        int time = studentPaymentList.size() * schedule.getSingleCourseTime();
+        PianoRoomTime pianoRoomTime = pianoRoomTimeDao.selectOne(Wrappers.<PianoRoomTime>lambdaQuery().eq(PianoRoomTime::getTeacherId, teacherId));
+        if (pianoRoomTime == null) {
+            throw new BizException("未查到剩余时长");
+        }
+        if (pianoRoomTime.getFrozenTime() - time < 0) {
+            throw new BizException("冻结时长计算错误");
+        }
+        pianoRoomTimeDao.update(null, Wrappers.<PianoRoomTime>lambdaUpdate()
+                .eq(PianoRoomTime::getTeacherId, teacherId)
+                .set(PianoRoomTime::getRemainTime, pianoRoomTime.getRemainTime() + time)
+                .set(PianoRoomTime::getFrozenTime, pianoRoomTime.getFrozenTime() - time));
+
+        //删除课程
+        baseMapper.deleteById(courseId);
+        //删除payment
+        paymentDao.delete(Wrappers.<CourseScheduleStudentPayment>lambdaQuery().eq(CourseScheduleStudentPayment::getCourseId, courseId));
+
+        //更新组课程数
+        Long groupId = schedule.getCourseGroupId();
+        Integer count = baseMapper.selectCount(Wrappers.<CourseSchedule>lambdaQuery().eq(CourseSchedule::getCourseGroupId, groupId));
+        if (count == 0) {
+            courseGroupService.getDao().deleteById(groupId);
+        } else {
+            courseGroupService.update(null, Wrappers.<CourseGroup>lambdaUpdate()
+                    .eq(CourseGroup::getId, groupId)
+                    .set(CourseGroup::getCourseNum, count));
+        }
+    }
+
+    /**
+     * @Description: 调整上课时间
+     * @Author: cy
+     * @Date: 2022/5/31
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public void updateCourseTime(Map<String, Object> param) {
+        Long courseId = WrapperUtil.toLong(param, "courseId", "课程id不能为空!");
+        Long teacherId = WrapperUtil.toLong(param, "teacherId", "老师id不能为空!");
+        String startTimeStr = WrapperUtil.toStr(param, "startTime", "开始时间不能为空!");
+        String endTimeStr = WrapperUtil.toStr(param, "endTime", "结束时间不能为空!");
+
+        Date startTime = DateUtil.strToDate(startTimeStr);
+        Date endTime = DateUtil.strToDate(endTimeStr);
+        CourseTimeEntity courseTime = new CourseTimeEntity();
+        courseTime.setStartTime(startTime);
+        courseTime.setEndTime(endTime);
+        List<CourseTimeEntity> timeList = Arrays.asList(courseTime);
+
+        CourseSchedule courseSchedule = baseMapper.selectOne(Wrappers.<CourseSchedule>lambdaQuery()
+                .eq(CourseSchedule::getId, courseId)
+                .eq(CourseSchedule::getTeacherId, teacherId)
+                .eq(CourseSchedule::getStatus, CourseScheduleEnum.NOT_START.getCode())
+                .eq(CourseSchedule::getType, CourseScheduleEnum.PIANO_ROOM_CLASS.getCode()));
+        if (courseSchedule == null) {
+            throw new BizException("无法修改课程");
+        }
+
+        //校验上下课时间
+        Integer singleCourseTime = courseSchedule.getSingleCourseTime();
+        if (!DateUtil.offsetMinute(startTime, singleCourseTime).equals(endTime)) {
+            throw new BizException("课程结束时间计算错误");
+        }
+
+        //批量检查老师课时在数据库是否重复
+        this.batchCheckTeacherCourseTime(teacherId, timeList, CourseTimeEntity::getStartTime, CourseTimeEntity::getEndTime);
+
+        //校验购买的课程组每节课时间是否和自己的课时冲突
+        List<CourseScheduleStudentPayment> studentPayments = paymentDao.selectList(Wrappers.<CourseScheduleStudentPayment>lambdaQuery()
+                .eq(CourseScheduleStudentPayment::getCourseId, courseId)
+                .eq(CourseScheduleStudentPayment::getCourseType, CourseScheduleEnum.PIANO_ROOM_CLASS.getCode()));
+        if (CollectionUtils.isNotEmpty(studentPayments)) {
+            for (CourseScheduleStudentPayment payment : studentPayments) {
+                this.batchCheckStudentCourseTime(payment.getUserId(), timeList, CourseTimeEntity::getStartTime, CourseTimeEntity::getEndTime);
+            }
+        }
+
+        //更新时间
+        baseMapper.update(null, Wrappers.<CourseSchedule>lambdaUpdate()
+                .eq(CourseSchedule::getId, courseId)
+                .set(CourseSchedule::getClassDate, DateUtil.trunc(startTime))
+                .set(CourseSchedule::getStartTime, startTime)
+                .set(CourseSchedule::getEndTime, endTime));
+    }
+
+    /**
+     * @Description: 调整学员
+     * @Author: cy
+     * @Date: 2022/5/31
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public void updateCourseStudent(Map<String, Object> param) {
+        Long courseId = WrapperUtil.toLong(param, "courseId", "课程id不能为空!");
+        Long teacherId = WrapperUtil.toLong(param, "teacherId", "老师id不能为空!");
+        List<Integer> studentIdsList = (List<Integer>) param.get("studentIds");
+        List<Long> studentIds = JSONArray.parseArray(studentIdsList.toString(), Long.class);
+        if (CollectionUtils.isEmpty(studentIds)) {
+            throw new BizException("学生id不能为空");
+        }
+
+        List<UserBindingTeacher> bindingTeachers = userBindingTeacherDao.selectList(Wrappers.<UserBindingTeacher>lambdaQuery().eq(UserBindingTeacher::getTeacherId, teacherId));
+        if (CollectionUtils.isEmpty(bindingTeachers)) {
+            throw new BizException("未绑定学员");
+        }
+        List<Long> students = bindingTeachers.stream().map(UserBindingTeacher::getStudentId).collect(Collectors.toList());
+        if (!students.containsAll(studentIds)) {
+            throw new BizException("存在未绑定学员");
+        }
+
+        CourseSchedule courseSchedule = baseMapper.selectOne(Wrappers.<CourseSchedule>lambdaQuery()
+                .eq(CourseSchedule::getId, courseId)
+                .eq(CourseSchedule::getTeacherId, teacherId)
+                .eq(CourseSchedule::getStatus, CourseScheduleEnum.NOT_START.getCode())
+                .eq(CourseSchedule::getType, CourseScheduleEnum.PIANO_ROOM_CLASS.getCode()));
+        if (courseSchedule == null) {
+            throw new BizException("无法修改课程");
+        }
+        Integer singleCourseTime = courseSchedule.getSingleCourseTime();
+        Long groupId = courseSchedule.getCourseGroupId();
+
+        List<CourseScheduleStudentPayment> paymentList = paymentDao.selectList(Wrappers.<CourseScheduleStudentPayment>lambdaQuery()
+                .eq(CourseScheduleStudentPayment::getCourseId, courseId)
+                .eq(CourseScheduleStudentPayment::getCourseType, CourseScheduleEnum.PIANO_ROOM_CLASS.getCode()));
+        if (CollectionUtils.isEmpty(paymentList)) {
+            throw new BizException("未查到排课学员");
+        }
+
+        PianoRoomTime pianoRoomTime = pianoRoomTimeDao.selectOne(Wrappers.<PianoRoomTime>lambdaQuery().eq(PianoRoomTime::getTeacherId, teacherId));
+        if (pianoRoomTime == null) {
+            throw new BizException("未查到剩余时长");
+        }
+        Integer frozenTime = pianoRoomTime.getFrozenTime();
+        Integer remainTime = pianoRoomTime.getRemainTime();
+
+        int i = studentIds.size() - paymentList.size();//新人数-原人数
+        if (i > 0) {//加人,扣时长
+            int courseTime = singleCourseTime * i;
+            if (remainTime - courseTime < 0) {
+                throw new BizException("剩余时长不足");
+            }
+            pianoRoomTimeDao.update(null, Wrappers.<PianoRoomTime>lambdaUpdate()
+                    .eq(PianoRoomTime::getTeacherId, teacherId)
+                    .set(PianoRoomTime::getRemainTime, remainTime - courseTime)
+                    .set(PianoRoomTime::getFrozenTime, frozenTime + courseTime));
+        }
+        if (i < 0) {//减人,释放时长
+            int courseTime = singleCourseTime * (-i);
+            pianoRoomTimeDao.update(null, Wrappers.<PianoRoomTime>lambdaUpdate()
+                    .eq(PianoRoomTime::getTeacherId, teacherId)
+                    .set(PianoRoomTime::getRemainTime, remainTime + courseTime)
+                    .set(PianoRoomTime::getFrozenTime, frozenTime - courseTime));
+        }
+
+        //删除原学员
+        paymentDao.delete(Wrappers.<CourseScheduleStudentPayment>lambdaQuery().eq(CourseScheduleStudentPayment::getCourseId, courseId));
+
+        CourseTimeEntity courseTime = new CourseTimeEntity();
+        courseTime.setStartTime(courseSchedule.getStartTime());
+        courseTime.setEndTime(courseSchedule.getEndTime());
+        List<CourseTimeEntity> timeList = Arrays.asList(courseTime);
+        //批量检查老师课时在数据库是否重复
+        this.batchCheckTeacherCourseTime(teacherId, timeList, CourseTimeEntity::getStartTime, CourseTimeEntity::getEndTime);
+
+        List<CourseScheduleStudentPayment> payments = new ArrayList<>();
+        for (Long studentId : studentIds) {
+            //校验购买的课程组每节课时间是否和自己的课时冲突
+            this.batchCheckStudentCourseTime(studentId, timeList, CourseTimeEntity::getStartTime, CourseTimeEntity::getEndTime);
+
+            CourseScheduleStudentPayment payment = new CourseScheduleStudentPayment();
+            payment.setUserId(studentId);
+            payment.setCourseId(courseId);
+            payment.setCourseGroupId(groupId);
+            payment.setCourseType(CourseScheduleEnum.PIANO_ROOM_CLASS.getCode());
+            payments.add(payment);
+        }
+
+        //重新新增学员
+        paymentDao.insertBatch(payments);
+    }
 }

+ 52 - 41
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ImNetworkRoomServiceImpl.java

@@ -1,7 +1,6 @@
 package com.yonge.cooleshow.biz.dal.service.impl;
 
 import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.extension.exceptions.ApiException;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
@@ -29,8 +28,6 @@ import javax.annotation.Resource;
 import java.util.*;
 import java.util.stream.Collectors;
 
-import static org.bouncycastle.asn1.cms.CMSObjectIdentifiers.data;
-
 /**
  * 网络教室房间(ImNetworkRoom)表服务实现类
  *
@@ -72,11 +69,12 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
     @Transactional(rollbackFor = Exception.class)
     public HttpResponseResult<ImNetworkRoomResult> joinRoom(Long courseScheduleId, UserRoleEnum userRole) throws Exception {
         log.info("joinRoom params:courseScheduleId:{},userRole:{}",courseScheduleId,userRole);
-        SysUser user = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+        Long userId = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+                map(SysUser::getId).
                 orElseThrow(()-> new BizException("请登录"));
         CourseSchedule courseSchedule = Optional.ofNullable(courseScheduleService.getById(courseScheduleId)).
                 orElseThrow(()->new BizException("房间信息不存在"));
-        BasicUserInfo sysUser = Optional.ofNullable(teacherDao.getBasicUserInfo(user.getId())).
+        BasicUserInfo sysUser = Optional.ofNullable(teacherDao.getBasicUserInfo(userId)).
                 orElseThrow(()-> new BizException("用户信息不存在"));
         Date now = new Date();
         courseSchedule.setUpdatedTime(now);
@@ -125,12 +123,13 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
     @Transactional(rollbackFor = Exception.class)
     public void joinRoomSuccess(String roomId,Long userId) throws Exception {
         log.info("joinRoomSuccess: roomId={}, userId={}", roomId, userId);
-        CourseSchedule courseSchedule = Optional.ofNullable(courseScheduleService.getById(roomId)).
+        Long teacherId = Optional.ofNullable(courseScheduleService.getById(roomId)).
+                map(CourseSchedule::getTeacherId).
                 orElseThrow(()->new BizException("房间信息不存在"));
         BasicUserInfo sysUser = Optional.ofNullable(teacherDao.getBasicUserInfo(userId)).
                 orElseThrow(()-> new BizException("用户信息不存在"));
         UserRoleEnum userRole = UserRoleEnum.STUDENT;
-        if(Objects.equals(courseSchedule.getTeacherId(),userId)){
+        if(Objects.equals(teacherId,userId)){
             userRole = UserRoleEnum.TEACHER;
         }
         Date now = new Date();
@@ -153,9 +152,9 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void joinRoomFailure(String roomId) {
-        SysUser sysUser = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+        Long userId = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+                map(SysUser::getId).
                 orElseThrow(()-> new BizException("请登录"));
-        Long userId = sysUser.getId();
         log.info("joinRoomFailure: roomId={}, userId={}", roomId, userId);
         imNetworkRoomMemberService.getDao().delByRidAndUid(roomId, userId);
     }
@@ -163,9 +162,9 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void leaveRoom(String roomId,UserRoleEnum userRole) throws Exception {
-        SysUser sysUser = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+        Long userId = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+                map(SysUser::getId).
                 orElseThrow(()-> new BizException("请登录"));
-        Long userId = sysUser.getId();
         log.info("leaveRoom: roomId={}, userId={}", roomId, userId);
         long courseScheduleId = Long.parseLong(roomId);
         if (userRole == UserRoleEnum.TEACHER){
@@ -227,21 +226,22 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void sendImPlayMidiMessage(ImNetworkCustomMessage customMessage) throws Exception {
-        SysUser sysUser = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+        Long userId = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+                map(SysUser::getId).
                 orElseThrow(()-> new BizException("请登录"));
-        Long userId = sysUser.getId();
-        Long courseScheduleId = customMessage.getCourseScheduleId();
-        log.info("sendImPlayMidiMessage: roomId={}, userId={}", courseScheduleId, userId);
+        Long roomId = customMessage.getRoomId();
+        log.info("sendImPlayMidiMessage: roomId={}, userId={}", roomId, userId);
         ImNetworkMetronomeMessage displayMessage = new ImNetworkMetronomeMessage(customMessage);
-        imHelper.publishMessage(userId.toString(), courseScheduleId.toString(), displayMessage, 0);
+        imHelper.publishMessage(userId.toString(), roomId.toString(), displayMessage, 0);
         //记录节拍器信息
-        courseScheduleStudentPaymentService.getDao().adjustPlayMidi(courseScheduleId,userId,customMessage.toString());
+        courseScheduleStudentPaymentService.getDao().adjustPlayMidi(roomId,customMessage.getUserId(),customMessage.toString());
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void pushDownloadMusicSheetMsg(String roomId,Long accompanimentId) throws Exception {
-        SysUser sysUser = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+        Long userId = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+                map(SysUser::getId).
                 orElseThrow(()-> new BizException("请登录"));
         Long courseScheduleId = Long.parseLong(roomId);
         List<CourseScheduleStudentMusicSheetResult> scheduleStudentMusicSheetResults = courseScheduleStudentMusicSheetService.getDao().
@@ -264,21 +264,22 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
             musicSheet.setMusicSheetAccompanimentId(accompanimentId);
             musicSheet.setSpeed(accompaniment.getSpeed());
             musicSheet.setCourseScheduleId(courseScheduleId);
-            musicSheet.setUserId(sysUser.getId());
+            musicSheet.setUserId(userId);
             musicSheet.setUserType(1);
             scheduleStudentMusicSheetResults.add(musicSheet);
             courseScheduleStudentMusicSheetService.getDao().batchInsert(scheduleStudentMusicSheetResults);
         }
         ImNetworkMusicSheetDownloadMessage msg = new ImNetworkMusicSheetDownloadMessage(
                 JSON.parseObject(JSON.toJSONString(accompaniment), ImNetworkMusicSheetDownloadMessageContent.class));
-        imHelper.publishMessage(sysUser.getId().toString(), roomId, msg, 0);
+        imHelper.publishMessage(userId.toString(), roomId, msg, 0);
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void display(ImNetworkDisplayDataDto displayData) throws Exception {
         log.info("display in data = {}", displayData);
-        SysUser sysUser = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+        Long userId = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+                map(SysUser::getId).
                 orElseThrow(()-> new BizException("请登录"));
 
         StringBuffer display = new StringBuffer("display://type=").append(displayData.getType().ordinal()).append("?userId=");
@@ -288,22 +289,24 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
                 display = new StringBuffer();
                 break;
             case TEACHER:
-                CourseSchedule courseSchedule = courseScheduleService.getById(displayData.getRoomId());
-                display.append(courseSchedule.getTeacherId()).append("?uri=");
+                Long teacherId = Optional.ofNullable(courseScheduleService.getById(displayData.getRoomId())).
+                        map(CourseSchedule::getTeacherId).
+                        orElseThrow(()->new BizException("房间信息不存在"));
+                display.append(teacherId).append("?uri=");
                 break;
             case SCREEN:
-                display.append(sysUser.getId()).append("?uri=");
+                display.append(userId).append("?uri=");
                 break;
             case STUDENT:
                 display.append(displayData.getUserId()).append("?uri=").append(displayData.getUri());
                 break;
             default:
-                display.append(sysUser.getId()).append("?uri=").append(displayData.getUri());
+                display.append(userId).append("?uri=").append(displayData.getUri());
                 break;
         }
         ImNetworkRoom room = baseMapper.findByRoomId(displayData.getRoomId());
         room.setDisplay(display.toString());
-        this.updateDisplay(sysUser.getId(),room);
+        this.updateDisplay(userId,room);
     }
 
     @Override
@@ -354,21 +357,25 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
                     imHelper.publishMessage(userId.toString(), deviceControl.getRoomId(), deviceResourceMessage, 1);
                     break;
                 case MUSIC_SHEET:
+                    Integer musicSheetId = Optional.ofNullable(deviceControl.getMusicSheetAccompanimentId()).
+                            orElseThrow(()-> new BizException("请选择曲目"));
                     //关闭所有曲目播放
                     courseScheduleStudentMusicSheetService.getDao().closePlayStatus(scheduleId,userId);
                     //打开原音
-                    courseScheduleStudentMusicSheetService.getDao().openPlayStatus(scheduleId,deviceControl.getMusicScoreAccompanimentId(),userId);
-                    deviceResourceMessage.setMusicScoreAccompanimentId(deviceControl.getMusicScoreAccompanimentId());
+                    courseScheduleStudentMusicSheetService.getDao().openPlayStatus(scheduleId,musicSheetId,userId);
+                    deviceResourceMessage.setMusicSheetAccompanimentId(musicSheetId);
                     deviceResourceMessage.setUserId(userId.toString());
                     deviceResourceMessage.setSoundVolume(deviceControl.getSoundVolume());
                     imHelper.publishMessage(sysUser.getId().toString(), roomId, deviceResourceMessage, 1);
                     break;
                 case ACCOMPANIMENT:
+                  Integer musicSheetAccompanimentId = Optional.ofNullable(deviceControl.getMusicSheetAccompanimentId()).
+                            orElseThrow(()-> new BizException("请选择曲目"));
                     //关闭所有曲目播放
                     courseScheduleStudentMusicSheetService.getDao().closePlayStatus(scheduleId,userId);
                     //打开伴奏
-                    courseScheduleStudentMusicSheetService.getDao().openAccompanimentPlayStatus(scheduleId, deviceControl.getMusicScoreAccompanimentId(),userId);
-                    deviceResourceMessage.setMusicScoreAccompanimentId(deviceControl.getMusicScoreAccompanimentId());
+                    courseScheduleStudentMusicSheetService.getDao().openAccompanimentPlayStatus(scheduleId,musicSheetAccompanimentId,userId);
+                    deviceResourceMessage.setMusicSheetAccompanimentId(musicSheetAccompanimentId);
                     deviceResourceMessage.setUserId(userId.toString());
                     deviceResourceMessage.setSoundVolume(deviceControl.getSoundVolume());
                     imHelper.publishMessage(sysUser.getId().toString(), roomId, deviceResourceMessage, 1);
@@ -376,7 +383,6 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
                 default:
                     //邀请打开指定设备权限
                     ImNetworkControlDeviceNotifyMessage message = new ImNetworkControlDeviceNotifyMessage(ImNetworkActionEnum.INVITE.ordinal());
-//                    msg.setTicket(ticket);
                     message.setType(deviceControl.getDeviceType().ordinal());
                     message.setOpUserId(sysUser.getId().toString());
                     message.setOpUserName(sysUser.getUsername());
@@ -384,7 +390,8 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
                     break;
             }
         }else {
-            ImNetworkRoomMember roomMember = imNetworkRoomMemberService.getById(roomId);
+            ImNetworkRoomMember roomMember = Optional.ofNullable(imNetworkRoomMemberService.getDao().findByRidAndUid(roomId, userId))
+                    .orElseThrow(()-> new BizException("用户不在房间内"));
             long scheduleId = Long.parseLong(roomId);
             switch (deviceControl.getDeviceType()) {
                 case CAMERA:
@@ -431,7 +438,8 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
         log.info("approveControlDevice: deviceControl={}", deviceControl);
         SysUser sysUser = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
                 orElseThrow(()-> new BizException("请登录"));
-        ImNetworkRoomMember roomMember = imNetworkRoomMemberService.getById(deviceControl.getRoomId());
+        ImNetworkRoomMember roomMember = Optional.ofNullable(imNetworkRoomMemberService.getDao().findByRidAndUid(deviceControl.getRoomId(), sysUser.getId())).
+                orElseThrow(()-> new BizException("用户不在房间内"));
         switch (deviceControl.getDeviceType()) {
             case CAMERA:
                 roomMember.setCameraFlag(deviceControl.getEnable());
@@ -465,10 +473,13 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
     @Transactional(rollbackFor = Exception.class)
     public void deviceStatusSync(ImNetworkDeviceControlDto deviceStatusSync) throws Exception {
         log.info("deviceStatusSync: deviceStatusSync={}", deviceStatusSync);
-        SysUser sysUser = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+        Long userId = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+                map(SysUser::getId).
                 orElseThrow(()-> new BizException("请登录"));
         ImNetworkDeviceTypeEnum deviceType = deviceStatusSync.getDeviceType();
-        ImNetworkRoomMember roomMember = imNetworkRoomMemberService.getById(deviceStatusSync.getRoomId());
+        ImNetworkRoomMember roomMember = Optional.ofNullable(imNetworkRoomMemberService.getDao().
+                        findByRidAndUid(deviceStatusSync.getRoomId(), userId))
+                .orElseThrow(()-> new BizException("用户不在房间内"));
         switch (deviceType) {
             case CAMERA:
                 roomMember.setCameraFlag(deviceStatusSync.getEnable());
@@ -484,9 +495,9 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
                 break;
             case EXAM_SONG:
                 long scheduleId = Long.parseLong(deviceStatusSync.getRoomId());
-                ImNetworkRoomMusicSheetDownloadData msg = courseScheduleStudentPaymentService.getMemberExamSong(scheduleId, sysUser.getId());
+                ImNetworkRoomMusicSheetDownloadData msg = courseScheduleStudentPaymentService.getMemberExamSong(scheduleId, userId);
                 msg.setEnable(deviceStatusSync.getEnable());
-                courseScheduleStudentPaymentService.getDao().adjustExamSong(scheduleId, sysUser.getId(), JSON.toJSONString(msg));
+                courseScheduleStudentPaymentService.getDao().adjustExamSong(scheduleId, userId, JSON.toJSONString(msg));
                 break;
         }
         if(deviceType == ImNetworkDeviceTypeEnum.CAMERA ||
@@ -496,10 +507,10 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
             imNetworkRoomMemberService.getDao().updateById(roomMember);
         }
         ImNetworkDeviceStateChangedMessage deviceResourceMessage = new ImNetworkDeviceStateChangedMessage(deviceType.ordinal(),deviceStatusSync.getEnable());
-        deviceResourceMessage.setUserId(sysUser.getId().toString());
-        ImNetworkRoom room = this.getById(deviceStatusSync.getRoomId());
+        deviceResourceMessage.setUserId(userId.toString());
+        ImNetworkRoom room = baseMapper.findByRoomId(deviceStatusSync.getRoomId());
         deviceResourceMessage.setSoundVolume(room.getSoundVolume());
-        imHelper.publishMessage(sysUser.getId().toString(), deviceStatusSync.getRoomId(), deviceResourceMessage, 1);
+        imHelper.publishMessage(userId.toString(), deviceStatusSync.getRoomId(), deviceResourceMessage, 1);
     }
 
     @Override
@@ -547,7 +558,7 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
         if (StringUtils.isEmpty(courseBeforeBufferTime)) {
             courseBeforeBufferTime = "5";
         }
-        Date addMinutes = DateUtil.addMinutes(courseSchedule.getUpdatedTime(), Integer.parseInt(courseBeforeBufferTime));
+        Date addMinutes = DateUtil.addMinutes(courseSchedule.getStartTime(), Integer.parseInt(courseBeforeBufferTime));
         return courseSchedule.getStartTime().compareTo(addMinutes) > 0;
     }
 

+ 0 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/ArrangeCourseVo.java

@@ -1,6 +1,5 @@
 package com.yonge.cooleshow.biz.dal.vo;
 
-import com.yonge.cooleshow.biz.dal.dto.CheckCourseTimeDto;
 import com.yonge.cooleshow.biz.dal.entity.CourseTimeEntity;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;

+ 34 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/CourseCompleteVo.java

@@ -0,0 +1,34 @@
+package com.yonge.cooleshow.biz.dal.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Author: cy
+ * @Date: 2022/5/30
+ */
+@ApiModel
+public class CourseCompleteVo implements Serializable {
+    @ApiModelProperty("课程组id")
+    private Long courseGroupId;
+    @ApiModelProperty("已完成课时数")
+    private Integer courseCount;
+
+    public Long getCourseGroupId() {
+        return courseGroupId;
+    }
+
+    public void setCourseGroupId(Long courseGroupId) {
+        this.courseGroupId = courseGroupId;
+    }
+
+    public Integer getCourseCount() {
+        return courseCount;
+    }
+
+    public void setCourseCount(Integer courseCount) {
+        this.courseCount = courseCount;
+    }
+}

+ 125 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/CourseScheduleRecordVo.java

@@ -0,0 +1,125 @@
+package com.yonge.cooleshow.biz.dal.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Author: cy
+ * @Date: 2022/5/30
+ */
+@ApiModel
+public class CourseScheduleRecordVo implements Serializable {
+    @ApiModelProperty(value = "课程id")
+    private Long courseId;
+
+    @ApiModelProperty(value = "课程组名称")
+    private String groupName;
+
+    @ApiModelProperty(value = "声部id")
+    private Long subjectId;
+
+    @ApiModelProperty(value = "声部名称")
+    private String subjectName;
+
+    @ApiModelProperty(value = "课程状态 NOT_START未开始 ING进行中 COMPLETE已完成 CANCEL已取消")
+    private String status;
+
+    @ApiModelProperty(value = "开课时间")
+    private Date startTime;
+
+    @ApiModelProperty(value = "结课时间")
+    private Date endTime;
+
+    @ApiModelProperty(value = "上课学员人数")
+    private Integer studentCount;
+
+    @ApiModelProperty(value = "总消耗时长")
+    private Integer consumTime;
+
+    @ApiModelProperty(value = "单课时长")
+    private Integer singleCourseTime;
+
+    public Integer getSingleCourseTime() {
+        return singleCourseTime;
+    }
+
+    public void setSingleCourseTime(Integer singleCourseTime) {
+        this.singleCourseTime = singleCourseTime;
+    }
+
+    public Long getCourseId() {
+        return courseId;
+    }
+
+    public void setCourseId(Long courseId) {
+        this.courseId = courseId;
+    }
+
+    public String getGroupName() {
+        return groupName;
+    }
+
+    public void setGroupName(String groupName) {
+        this.groupName = groupName;
+    }
+
+    public Long getSubjectId() {
+        return subjectId;
+    }
+
+    public void setSubjectId(Long subjectId) {
+        this.subjectId = subjectId;
+    }
+
+    public String getSubjectName() {
+        return subjectName;
+    }
+
+    public void setSubjectName(String subjectName) {
+        this.subjectName = subjectName;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public Date getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+
+    public Integer getStudentCount() {
+        return studentCount;
+    }
+
+    public void setStudentCount(Integer studentCount) {
+        this.studentCount = studentCount;
+    }
+
+    public Integer getConsumTime() {
+        return consumTime;
+    }
+
+    public void setConsumTime(Integer consumTime) {
+        this.consumTime = consumTime;
+    }
+}
+

+ 11 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/CourseScheduleStudentVo.java

@@ -24,13 +24,22 @@ public class CourseScheduleStudentVo implements Serializable {
     private Long studentId;
 
     @ApiModelProperty(value = "结课时间")
-    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date endTime;
 
     @ApiModelProperty(value = "单课时长(分)")
     private Integer singleCourseTime;
 
+    @ApiModelProperty(value = "课程类型")
+    private String type;
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
     public Integer getSingleCourseTime() {
         return singleCourseTime;
     }

+ 8 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseGroupMapper.xml

@@ -655,5 +655,12 @@
             pre_student_num_ = pre_student_num_ + #{num}
         where id_ = #{id}
     </update>
-
+    <update id="updateBatch">
+        UPDATE course_group
+        SET status_='COMPLETE'
+        WHERE id_ IN
+        <foreach collection="list" item="item" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+    </update>
 </mapper>

+ 7 - 3
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -325,7 +325,7 @@
         LEFT JOIN course_schedule_replied r ON cs.id_ = r.course_schedule_id_
         WHERE cs.lock_=0
         AND cs.status_ IN ('ING','COMPLETE','NOT_START')
-        AND cs.type_='LIVE'
+        AND cs.type_ IN ('LIVE','PIANO_ROOM_CLASS')
         AND cs.teacher_id_=#{param.teacherId}
         AND cs.class_date_=#{param.classDate}
         AND cs.id_ IN(
@@ -335,7 +335,8 @@
             AND p.course_group_id_ = c.course_group_id_
             AND c.teacher_id_=#{param.teacherId}
             AND c.class_date_=#{param.classDate}
-            AND c.type_='LIVE')
+            AND c.type_ IN ('LIVE','PIANO_ROOM_CLASS')
+            )
         UNION
         SELECT
             p.course_id_ AS courseId,
@@ -482,7 +483,7 @@
         WHERE s.lock_=0
         AND s.status_ IN ('ING','NOT_START','COMPLETE')
         AND s.id_ IN
-        (SELECT course_id_ FROM course_schedule_student_payment WHERE user_id_ = #{param.studentId} AND course_type_ = 'LIVE')
+        (SELECT course_id_ FROM course_schedule_student_payment WHERE user_id_ = #{param.studentId} AND course_type_ IN ('LIVE','PIANO_ROOM_CLASS'))
         AND s.class_date_ = #{param.classDate}
         ORDER BY startTime
     </select>
@@ -792,6 +793,9 @@
     <select id="selectIdList" resultType="java.lang.Long">
         SELECT id_ FROM course_schedule WHERE lock_=0 AND class_date_ &lt;= #{day}
     </select>
+    <select id="selectComplete" resultType="com.yonge.cooleshow.biz.dal.vo.CourseCompleteVo">
+        SELECT course_group_id_ AS courseGroupId ,COUNT(1) AS courseCount  FROM course_schedule WHERE lock_=0 AND status_='COMPLETE' GROUP BY course_group_id_
+    </select>
     <update id="updateStartTime">
         UPDATE course_schedule SET status_='ING' WHERE id_ IN(
         <foreach collection="list" item="item" index="index" open="" close="" separator=",">

+ 59 - 7
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleRecordMapper.xml

@@ -2,19 +2,71 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.yonge.cooleshow.biz.dal.dao.CourseScheduleRecordDao">
     <select id="sumCourseTime" resultType="com.yonge.cooleshow.biz.dal.entity.CourseScheduleRecord">
-        SELECT * FROM(
-        SELECT teacherId, courseId, SUM(singleCourseTime) AS consumTime, COUNT(studentId) AS studentCount, endTime FROM (
-        SELECT c.id_ AS courseId, c.teacher_id_ AS teacherId, s.student_id_ AS studentId, c.end_time_ AS endTime, c.single_course_time_ AS singleCourseTime
-        FROM course_schedule c LEFT JOIN course_schedule_student s ON c.id_ = s.course_id_ WHERE c.lock_ = 0 AND c.status_ IN ('ING', 'NOT_START') AND NOW() >= c.end_time_ ) a GROUP BY courseId) b
-        WHERE b.studentCount!=0
+        SELECT
+            teacherId,
+            courseId,
+            SUM( singleCourseTime ) AS consumTime,
+            COUNT( studentId ) AS studentCount,
+            endTime
+        FROM
+            (SELECT
+                 c.id_ AS courseId,
+                 c.teacher_id_ AS teacherId,
+                 p.user_id_ AS studentId,
+                 c.end_time_ AS endTime,
+                 c.single_course_time_ AS singleCourseTime
+             FROM course_schedule c
+             LEFT JOIN course_schedule_student_payment p ON c.id_ = p.course_id_
+             WHERE c.type_ = 'PIANO_ROOM_CLASS'
+             AND c.lock_ = 0
+             AND c.status_ IN ( 'ING', 'NOT_START' )
+             AND NOW() >= c.end_time_) a
+        GROUP BY courseId
     </select>
     <select id="countTimeByTeacherId" resultType="java.lang.Long">
-        SELECT SUM(consum_time_) FROM course_schedule_record WHERE teacher_id_=#{teacherId} AND  date_format(end_time_,'%Y-%m') = #{month}
+        SELECT SUM(consum_time_) FROM course_schedule_piano WHERE teacher_id_=#{teacherId} AND  date_format(end_time_,'%Y-%m') = #{month}
     </select>
     <insert id="insertBatch">
-        INSERT INTO course_schedule_record (course_id_, teacher_id_, student_count_, consum_time_, end_time_) VALUES
+        INSERT INTO course_schedule_piano (course_id_, teacher_id_, student_count_, consum_time_, end_time_) VALUES
         <foreach collection ="recordList" item="item" index="index" separator =",">
             (#{item.courseId},#{item.teacherId},#{item.studentCount}, #{item.consumTime}, #{item.endTime})
         </foreach>
     </insert>
+    <select id="selectConsumeTimeList" resultType="com.yonge.cooleshow.biz.dal.vo.CourseScheduleRecordVo">
+        SELECT
+            s.id_ AS courseId,
+            g.name_ AS groupName,
+            g.subject_id_ AS subjectId,
+            sb.name_ AS subjectName,
+            s.status_ AS `status`,
+            s.start_time_ AS startTime,
+            s.end_time_ AS endTime,
+            r.student_count_ AS studentCount,
+            r.consum_time_ AS consumTime,
+            s.single_course_time_ AS singleCourseTime
+        FROM course_schedule s
+        LEFT JOIN course_schedule_piano r ON r.course_id_ =s.id_
+        LEFT JOIN course_group g ON s.course_group_id_=g.id_
+        LEFT JOIN `subject` sb ON g.subject_id_ = sb.id_
+        <where>
+            <if test="param.type != null and param.type !=''">
+                AND s.type_ = #{param.type}
+            </if>
+            <if test="param.status != null and param.status !=''">
+                AND s.status_ = #{param.status}
+            </if>
+            <if test="param.teacherId != null">
+               AND r.teacher_id_ = #{param.teacherId}
+            </if>
+            <if test="param.subjectId != null">
+                AND g.subject_id_ = #{param.subjectId}
+            </if>
+            <if test="param.month != null and param.month !=''">
+                AND date_format(s.end_time_,'%Y-%m') = #{param.month}
+            </if>
+            <if test="param.status != null and param.status !=''">
+                AND s.status_ = #{param.status}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 0 - 23
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleStudentMapper.xml

@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.yonge.cooleshow.biz.dal.dao.CourseScheduleStudentDao">
-    <insert id="insertBatch">
-        INSERT INTO course_schedule_student (course_id_, student_id_) VALUES
-        <foreach collection ="list" item="item" separator =",">
-            (#{item.courseId}, #{item.studentId})
-        </foreach >
-    </insert>
-    <select id="selectUser" resultType="com.yonge.cooleshow.biz.dal.vo.CourseScheduleStudentVo">
-        SELECT
-        c.id_ AS courseId,
-        c.teacher_id_ AS teacherId,
-        s.student_id_ AS studentId,
-        c.end_time_ AS endTime,
-        c.single_course_time_ AS singleCourseTime
-        FROM course_schedule c
-        LEFT JOIN course_schedule_student s ON c.id_ = s.course_id_
-        WHERE c.lock_ = 0
-        AND c.status_ IN ('ING','NOT_START')
-        AND NOW() &gt;= c.end_time_
-    </select>
-</mapper>

+ 4 - 4
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleStudentMusicSheetDao.xml

@@ -21,12 +21,12 @@
     accompaniment_play_status_, user_type_, speed_, create_time_, update_time_
     </sql>
     <insert id="batchInsert">
-        INSERT INTO course_schedule_student_music_score (course_schedule_id_,user_id_,user_type_,down_status_,
+        INSERT INTO course_schedule_student_music_sheet (course_schedule_id_,user_id_,user_type_,down_status_,
         music_sheet_accompaniment_id_,play_status_,accompaniment_play_status_,
                                                          speed_,create_time_,update_time_)
         VALUE
         <foreach collection="musicSheet" item="item" separator=",">
-            (#{item.courseScheduleId},#{item.userId},#{item.userType},#{item.downStatus},#{item.musicScoreAccompanimentId},
+            (#{item.courseScheduleId},#{item.userId},#{item.userType},#{item.downStatus},#{item.musicSheetAccompanimentId},
             #{item.playStatus},#{item.accompanimentPlayStatus},#{item.speed},now(),now())
         </foreach>
     </insert>
@@ -40,14 +40,14 @@
     <update id="openPlayStatus">
         UPDATE course_schedule_student_music_sheet SET play_status_ = 1,update_time_ = NOW()
         WHERE course_schedule_id_ = #{scheduleId}
-        AND music_score_accompaniment_id_ = #{musicScoreAccompanimentId}
+        AND music_sheet_accompaniment_id_ = #{musicSheetAccompanimentId}
         <if test="userId != null">
             AND user_id_ = #{userId}
         </if>
     </update>
     <update id="openAccompanimentPlayStatus">
         UPDATE course_schedule_student_music_sheet SET accompaniment_play_status_ = 1,update_time_ = NOW()
-        WHERE course_schedule_id_ = #{scheduleId} AND music_score_accompaniment_id_ = #{musicScoreAccompanimentId}
+        WHERE course_schedule_id_ = #{scheduleId} AND music_sheet_accompaniment_id_ = #{musicSheetAccompanimentId}
         <if test="userId != null">
             AND user_id_ = #{userId}
         </if>

+ 20 - 5
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml

@@ -40,10 +40,10 @@
         UPDATE course_schedule_student_payment cssp
         <set>
             <if test="content == null or content == ''">
-                cssp.play_midi_ = NULL,cssp.update_time_ = NOW()
+                cssp.play_midi_ = NULL,cssp.updated_time_ = NOW()
             </if>
             <if test="content != null and content != ''">
-                cssp.play_midi_ = #{content},cssp.update_time_ = NOW()
+                cssp.play_midi_ = #{content},cssp.updated_time_ = NOW()
             </if>
         </set>
         <where>
@@ -55,7 +55,7 @@
     </update>
     <update id="adjustExamSong">
         UPDATE course_schedule_student_payment SET music_sheet_download_json_ = #{examSongJson}
-        WHERE course_id_ = #{roomId}
+        WHERE course_id_ = #{courseScheduleId}
         <if test="userId != null">
             AND user_id_ = #{userId}
         </if>
@@ -64,10 +64,10 @@
         UPDATE course_schedule_student_payment cssp
         <set>
             <if test="content == null or content == ''">
-                cssp.open_play_midi_ = NULL,cssp.update_time_ = NOW()
+                cssp.open_play_midi_ = NULL,cssp.updated_time_ = NOW()
             </if>
             <if test="content != null and content != ''">
-                cssp.open_play_midi_ = #{content},cssp.update_time_ = NOW()
+                cssp.open_play_midi_ = #{content},cssp.updated_time_ = NOW()
             </if>
             <if test="examSongJson != null">
                 cssp.exam_song_download_json_ = #{examSongJson}
@@ -147,4 +147,19 @@
         from course_schedule_student_payment cssp
         where cssp.course_group_id_ = #{courseGroupId}
     </select>
+    <select id="selectUser" resultType="com.yonge.cooleshow.biz.dal.vo.CourseScheduleStudentVo">
+        SELECT
+            c.id_ AS courseId,
+            c.teacher_id_ AS teacherId,
+            p.user_id_ AS studentId,
+            c.end_time_ AS endTime,
+            c.single_course_time_ AS singleCourseTime,
+            c.type_ AS type
+        FROM course_schedule c
+        LEFT JOIN course_schedule_student_payment p ON c.id_ = p.course_id_
+        WHERE c.lock_ = 0
+        AND c.status_ IN ('ING','NOT_START')
+        AND NOW() &gt;= c.end_time_
+        ORDER BY c.end_time_
+    </select>
 </mapper>

+ 1 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/ImNetworkRoomMemberMapper.xml

@@ -40,7 +40,7 @@
                 #{entity.cameraFlag}, #{entity.micFlag}, #{entity.musicModeFlag}, #{entity.handFlag}, #{entity.username}, #{entity.avatar})
         ON DUPLICATE KEY UPDATE
         room_id_ = VALUES(room_id_),
-        user_id_ = VALUES(user_id_))
+        user_id_ = VALUES(user_id_)
     </insert>
     <delete id="delByRidAndUid">
         DELETE FROM im_network_room_member WHERE room_id_ = #{roomId} AND user_id_ = #{userId}

+ 1 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/UserBindingTeacherMapper.xml

@@ -26,7 +26,7 @@
             <if test="param.studentList !=null and param.studentList.size>0">
                 AND su.id_ IN
                 <foreach collection="param.studentList" item="item" open="(" separator="," close=")">
-                    #{item.studentId}
+                    #{item.userId}
                 </foreach>
             </if>
         </where>

+ 2 - 0
cooleshow-user/user-classroom/src/main/java/com/yonge/cooleshow/classroom/controller/ImNetworkRoomController.java

@@ -120,6 +120,7 @@ public class ImNetworkRoomController extends BaseController {
     @ApiOperation(value = "学员同意打开,麦克风、摄像头")
     @PostMapping(value = "/device/approve", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     public HttpResponseResult approveControlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl) throws Exception {
+        deviceControl.setEnable(true);
         imNetworkRoomService.approveControlDevice(deviceControl);
         return succeed();
     }
@@ -128,6 +129,7 @@ public class ImNetworkRoomController extends BaseController {
     @PostMapping(value = "/device/reject", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     public HttpResponseResult rejectControlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl)
             throws Exception {
+        deviceControl.setEnable(false);
         imNetworkRoomService.rejectControlDevice(deviceControl);
         return succeed();
     }

+ 0 - 166
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/ImNetworkRoomController.java

@@ -1,166 +0,0 @@
-package com.yonge.cooleshow.teacher.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.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;
-
-/**
- * 网络教室房间(ImNetworkRoom)表控制层
- *
- * @author zx
- * @since 2022-03-30 16:36:36
- */
-@Api(tags = "网络教室房间")
-@RestController
-@RequestMapping("/imNetworkRoom")
-public class ImNetworkRoomController extends BaseController {
-
-    private final static Logger log = LoggerFactory.getLogger(ImNetworkRoomController.class);
-    /**
-     * 服务对象
-     */
-    @Resource
-    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, UserRoleEnum.TEACHER);
-    }
-
-//    @ApiOperation("加入网络教室状态回调")
-//    @PostMapping(value = "joinRoomSuccess", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-//    public HttpResponseResult joinRoomSuccess(Long courseScheduleId) throws Exception {
-//        imNetworkRoomService.joinRoomSuccess(courseScheduleId.toString(),UserRoleEnum.TEACHER);
-//        return succeed();
-//    }
-
-    @ApiOperation("加入网络教室状态回调")
-    @PostMapping(value = "joinRoomFailure", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-    public HttpResponseResult joinRoomFailure(Long roomId){
-        imNetworkRoomService.joinRoomFailure(roomId.toString());
-        return succeed();
-    }
-
-    @RequestMapping(value = "/statusSync")
-    public void statusSync(@RequestBody String body) throws Exception {
-        ImChannelStateNotify notify = JSONObject.parseObject(body, ImChannelStateNotify.class);
-        log.info("statusSyncParam: {}",JSONObject.toJSON(notify));
-        switch (notify.getEvent()) {
-            case 11:
-                //成员加入
-                imNetworkRoomService.joinRoomSuccess(notify.getChannelId(),Long.parseLong(notify.getUserId()));
-                break;
-            case 12:
-                //成员退出
-                imNetworkRoomService.leaveRoomSuccess(notify.getChannelId(),Long.parseLong(notify.getUserId()));
-                break;
-        }
-    }
-
-    @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 {
-        imNetworkRoomService.leaveRoom(roomId.toString(),UserRoleEnum.TEACHER);
-        return succeed();
-    }
-
-    @ApiOperation("控制学员节拍器")
-    @PostMapping(value = "/sendImPlayMidiMessage", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-    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)
-    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)
-    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)
-    public HttpResponseResult controlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl)
-            throws Exception {
-        imNetworkRoomService.controlDevice(deviceControl);
-        return succeed();
-    }
-
-    @ApiOperation(value = "学员同意打开,麦克风、摄像头")
-    @PostMapping(value = "/device/approve", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-    public HttpResponseResult approveControlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl) throws Exception {
-        imNetworkRoomService.approveControlDevice(deviceControl);
-        return succeed();
-    }
-
-    @ApiOperation(value = "学员拒绝打开,麦克风、摄像头")
-    @PostMapping(value = "/device/reject", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-    public HttpResponseResult rejectControlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl)
-            throws Exception {
-        imNetworkRoomService.rejectControlDevice(deviceControl);
-        return succeed();
-    }
-
-    @ApiOperation(value = "学员设备状态同步")
-    @PostMapping(value = "/device/sync", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-    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);
-        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);
-        return succeed();
-    }
-}
-

+ 0 - 29
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/ImNetworkRoomMemberController.java

@@ -1,29 +0,0 @@
-package com.yonge.cooleshow.teacher.controller;
-
-
-import com.yonge.cooleshow.biz.dal.service.ImNetworkRoomMemberService;
-import com.yonge.cooleshow.common.controller.BaseController;
-import io.swagger.annotations.Api;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-
-/**
- * 网络教室成员(ImNetworkRoomMember)表控制层
- *
- * @author zx
- * @since 2022-03-30 16:36:37
- */
-@Api(tags = "网络教室成员")
-@RestController
-@RequestMapping("/imNetworkRoomMember")
-public class ImNetworkRoomMemberController extends BaseController {
-    /**
-     * 服务对象
-     */
-    @Resource
-    private ImNetworkRoomMemberService imNetworkRoomMemberService;
-
-}
-

+ 64 - 1
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/TeacherCourseScheduleController.java

@@ -172,7 +172,7 @@ public class TeacherCourseScheduleController extends BaseController {
     }
 
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "subjectId", dataType = "Long", value = "声部id"),
+            @ApiImplicitParam(name = "subjectId", dataType = "Long", value = "学员声部id"),
             @ApiImplicitParam(name = "userName", dataType = "String", value = "学员姓名"),
             @ApiImplicitParam(name = "courseId", dataType = "Long", value = "课程id"),
     })
@@ -207,5 +207,68 @@ public class TeacherCourseScheduleController extends BaseController {
         }
         return succeed(courseScheduleService.selectConsumeTime(month, user.getId()));
     }
+
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "subjectId", dataType = "Long", value = "声部id"),
+            @ApiImplicitParam(name = "month", dataType = "String", value = "月份,yyyy-mm"),
+            @ApiImplicitParam(name = "status", dataType = "String", value = "课程状态"),
+    })
+    @ApiOperation("课程列表&消耗时长列表")
+    @PostMapping("/selectConsumeTimeList")
+    public HttpResponseResult<PageInfo<CourseScheduleRecordVo>> selectConsumeTimeList(@RequestBody Map<String, Object> param) {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || null == user.getId()) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        param.put("teacherId", user.getId());
+        return succeed(courseScheduleService.selectConsumeTimeList(param));
+    }
+
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "courseId", dataType = "Long", value = "课程id"),
+    })
+    @ApiOperation("删除课程")
+    @PostMapping("/deleteCourse")
+    public HttpResponseResult<Object> deleteCourse(@RequestBody Map<String, Object> param) {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || null == user.getId()) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        param.put("teacherId", user.getId());
+        courseScheduleService.deleteCourse(param);
+        return succeed();
+    }
+
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "courseId", dataType = "Long", value = "课程id"),
+            @ApiImplicitParam(name = "startTime", dataType = "String", value = "上课时间"),
+            @ApiImplicitParam(name = "endTime", dataType = "String", value = "下课时间"),
+    })
+    @ApiOperation("调整上课时间")
+    @PostMapping("/updateCourseTime")
+    public HttpResponseResult<Object> updateCourseTime(@RequestBody Map<String, Object> param) {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || null == user.getId()) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        param.put("teacherId", user.getId());
+        courseScheduleService.updateCourseTime(param);
+        return succeed();
+    }
+
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "studentIds", dataType = "List", value = "学生id集合"),
+    })
+    @ApiOperation("调整上课学员")
+    @PostMapping("/updateCourseStudent")
+    public HttpResponseResult<Object> updateCourseStudent(@RequestBody Map<String, Object> param) {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || null == user.getId()) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        param.put("teacherId", user.getId());
+        courseScheduleService.updateCourseStudent(param);
+        return succeed();
+    }
 }