|
@@ -1,21 +1,17 @@
|
|
|
package com.yonge.cooleshow.teacher.controller;
|
|
|
|
|
|
-import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
|
-import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
|
-import com.yonge.cooleshow.biz.dal.service.CourseScheduleService;
|
|
|
-import com.yonge.cooleshow.biz.dal.service.MusicSheetService;
|
|
|
-import com.yonge.cooleshow.biz.dal.service.UserAccountRecordService;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.*;
|
|
|
import com.yonge.cooleshow.biz.dal.vo.PianoRoomTimeVo;
|
|
|
import com.yonge.cooleshow.biz.dal.vo.TeacherHomeStatisticalVo;
|
|
|
+import com.yonge.cooleshow.biz.dal.wrapper.TeacherIndexWrapper;
|
|
|
import com.yonge.cooleshow.common.controller.BaseController;
|
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
|
/**
|
|
@@ -30,7 +26,7 @@ import java.math.BigDecimal;
|
|
|
public class TeacherHomeController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
- private SysUserFeignService sysUserFeignService;
|
|
|
+ private SysUserService sysUserService;
|
|
|
|
|
|
@Autowired
|
|
|
private CourseScheduleService courseScheduleService;
|
|
@@ -41,35 +37,35 @@ public class TeacherHomeController extends BaseController {
|
|
|
@Autowired
|
|
|
private UserAccountRecordService userAccountRecordService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private SysMusicCompareRecordService sysMusicCompareRecordService;
|
|
|
+
|
|
|
@ApiOperation(value = "首页统计数据")
|
|
|
@GetMapping(value="/count")
|
|
|
public HttpResponseResult<TeacherHomeStatisticalVo> countTeacherHome() {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null || sysUser.getId() == null) {
|
|
|
- return failed("用户信息获取失败");
|
|
|
- }
|
|
|
+ Long userId = sysUserService.getUserId();
|
|
|
|
|
|
// 我的课程
|
|
|
- Integer courseSechedule = courseScheduleService.getWeekNotStart(sysUser.getId());
|
|
|
+ Integer courseSechedule = courseScheduleService.getWeekNotStart(userId);
|
|
|
|
|
|
// 课后作业
|
|
|
- Integer courseHomework = courseScheduleService.getHomeworkNotDecorate(sysUser.getId());
|
|
|
+ Integer courseHomework = courseScheduleService.getHomeworkNotDecorate(userId);
|
|
|
|
|
|
// 课后评价
|
|
|
- Integer courseScheduleReplied = courseScheduleService.getNotRepliedCourseSchedule(sysUser.getId());
|
|
|
+ Integer courseScheduleReplied = courseScheduleService.getNotRepliedCourseSchedule(userId);
|
|
|
|
|
|
// 我的乐谱
|
|
|
- Integer musicSheet = musicSheetService.getTeacherMusicSheetCount(sysUser.getId());
|
|
|
+ Integer musicSheet = musicSheetService.getTeacherMusicSheetCount(userId);
|
|
|
|
|
|
// 我收到的评价
|
|
|
- Integer studentReplied = courseScheduleService.getWeekStudentRepliedCourseSchedule(sysUser.getId());
|
|
|
+ Integer studentReplied = courseScheduleService.getWeekStudentRepliedCourseSchedule(userId);
|
|
|
|
|
|
// 我的收入
|
|
|
- BigDecimal decimal = userAccountRecordService.getMonthDecimal(sysUser.getId());
|
|
|
+ BigDecimal decimal = userAccountRecordService.getMonthDecimal(userId);
|
|
|
|
|
|
|
|
|
// 琴房剩余时长
|
|
|
- PianoRoomTimeVo pianoRoomTimeVo = courseScheduleService.selectRemainTime(sysUser.getId());
|
|
|
+ PianoRoomTimeVo pianoRoomTimeVo = courseScheduleService.selectRemainTime(userId);
|
|
|
|
|
|
TeacherHomeStatisticalVo teacherHomeStatisticalVo = new TeacherHomeStatisticalVo();
|
|
|
teacherHomeStatisticalVo.setCourseHomework(courseHomework);
|
|
@@ -82,6 +78,14 @@ public class TeacherHomeController extends BaseController {
|
|
|
return succeed(teacherHomeStatisticalVo);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation("首页练习数据统计")
|
|
|
+ @PostMapping(value = "/practice")
|
|
|
+ public HttpResponseResult<TeacherIndexWrapper.TeacherPracticeHome> practice(@RequestBody TeacherIndexWrapper.SummarySearch summarySearch) {
|
|
|
+ summarySearch.setTeacherId(sysUserService.getUserId());
|
|
|
+ return succeed(sysMusicCompareRecordService.getTeacherPracticeHome(summarySearch));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|