Browse Source

Merge branch 'feature/1219_opt' of http://git.dayaedu.com/yonge/cooleshow into feature/1219_opt

刘俊驰 1 ngày trước cách đây
mục cha
commit
fe9af0b686

+ 4 - 22
cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/TeacherHomeController.java

@@ -1,6 +1,5 @@
 package com.yonge.cooleshow.teacher.controller;
 
-import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.service.*;
 import com.yonge.cooleshow.biz.dal.vo.PianoRoomTimeVo;
 import com.yonge.cooleshow.biz.dal.vo.TeacherHomeStatisticalVo;
@@ -95,12 +94,7 @@ public class TeacherHomeController extends BaseController {
     @ApiOperation(value = "课程统计")
     @PostMapping("/totalCourse")
     public HttpResponseResult<List<TeacherHomeWrapper.TeacherTotalCourse>> totalCourse(@RequestBody TeacherHomeWrapper.TeacherTotalCourseQuery query) {
-        SysUser sysUser = sysUserService.getUser();
-        if (sysUser == null  || sysUser.getId() == null) {
-
-            return failed("用户信息获取失败");
-        }
-        query.setTeacherId(sysUser.getId());
+        query.setTeacherId(sysUserService.getUserId());
 
         return succeed(homeService.teacherTotalCourse(query));
     }
@@ -109,31 +103,19 @@ public class TeacherHomeController extends BaseController {
     @ApiOperation(value = "我的乐谱统计")
     @GetMapping("/musicSheetTotal")
     public HttpResponseResult<TeacherHomeWrapper.MusicSheetTotal> musicSheetTotal() {
-        SysUser sysUser = sysUserService.getUser();
-        if (sysUser == null  || sysUser.getId() == null) {
-
-            return failed("用户信息获取失败");
-        }
-
-        return succeed(homeService.musicSheetTotal(sysUser.getId()));
+        return succeed(homeService.musicSheetTotal(sysUserService.getUserId()));
     }
 
     @ApiOperation(value = "我的乐谱分页")
     @PostMapping("/musicSheetPage")
     public HttpResponseResult<List<TeacherHomeWrapper.MusicSheetTotal>> musicSheetPage(@RequestBody TeacherHomeWrapper.MusicSheetQuery query) {
-        SysUser sysUser = sysUserService.getUser();
-        if (sysUser == null  || sysUser.getId() == null) {
-
-            return failed("用户信息获取失败");
-        }
-        query.setTeacherId(sysUser.getId());
-
+        query.setTeacherId(sysUserService.getUserId());
         return succeed(homeService.musicSheetPage(query));
     }
 
 
 
-    @ApiOperation(value = "课程曝光/购买")
+    @ApiOperation(value = "课程浏览/购买")
     @PostMapping("/courseExposure")
     public HttpResponseResult<Map<String, List<TeacherIndexWrapper.CourseExposureTotal>>> courseExposure(@RequestBody TeacherIndexWrapper.CourseExposureSearch query) {
         query.setTeacherId(sysUserService.getUserId());

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ExposureRecordServiceImpl.java

@@ -49,7 +49,7 @@ public class ExposureRecordServiceImpl extends ServiceImpl<ExposureRecordDao, Ex
             //按对象id分组,并获取集合数量
             Map<Long, Integer> exposureNumMap = saveExposureReportDtos.stream().collect(Collectors.groupingBy(ExposureRecordWrapper.SaveExposureRecordDto::getObjectId, Collectors.summingInt(e -> 1)));
             exposureNumMap.forEach((objectId,exposureNum)-> {
-                if ("LIVE".equals(k) || "VIP_COURSE".equals(k) || "PRACTICE".equals(k)) {
+                if ("LIVE".equals(k) || "VIP_COURSE".equals(k) || "PRACTICE".equals(k) || "GROUP".equals(k)) {
                     courseGroupService.getDao().updateExposureNum(objectId, exposureNum);
                 } else if ("VIDEO".equals(k)) {
                     videoLessonGroupService.getDao().updateExposureNum(objectId, exposureNum);

+ 11 - 45
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/HomeServiceImpl.java

@@ -501,17 +501,7 @@ public class HomeServiceImpl implements HomeService {
             groupBy = "%Y";
             dateList = DateUtil.getYearList(startDate,endDate);
         }
-        List<TeacherIndexWrapper.CourseExposureTotal> courseExposureTotals = exposureRecordService.getDao().courseExposureTotal(search, groupBy);
-//        //按分类分组
-//        Map<String,List<TeacherIndexWrapper.CourseExposureTotal>> typeMap = courseExposureTotals.stream()
-//                .collect(Collectors.groupingBy(TeacherIndexWrapper.CourseExposureTotal::getType));
-//        Map<String,List<TeacherIndexWrapper.CourseExposureTotal>> result = new HashMap<>();
-//        result.put("EXPOSURE_VIP",exposureFillData(typeMap.get(GoodTypeEnum.VIP_COURSE.getCode()),dateList,new String[]{GoodTypeEnum.VIP_COURSE.getCode()}));
-//        result.put("EXPOSURE_PRACTICE",exposureFillData(typeMap.get(GoodTypeEnum.PRACTICE.getCode()),dateList,new String[]{GoodTypeEnum.PRACTICE.getCode()}));
-//        result.put("EXPOSURE_LIVE",exposureFillData(typeMap.get(GoodTypeEnum.LIVE.getCode()),dateList,new String[]{GoodTypeEnum.LIVE.getCode()}));
-//        result.put("EXPOSURE_VIDEO",exposureFillData(typeMap.get(GoodTypeEnum.VIDEO.getCode()),dateList,new String[]{GoodTypeEnum.VIDEO.getCode()}));
-//        result.put("EXPOSURE_MUSIC",exposureFillData(typeMap.get(GoodTypeEnum.MUSIC.getCode()),dateList,new String[]{GoodTypeEnum.MUSIC.getCode()}));
-        return exposureFillData(courseExposureTotals,dateList);
+        return exposureFillData(exposureRecordService.getDao().courseExposureTotal(search, groupBy),dateList);
     }
 
     @Override
@@ -533,40 +523,16 @@ public class HomeServiceImpl implements HomeService {
             dateList = DateUtil.getYearList(startDate,endDate);
         }
         Map<String,List<TeacherIndexWrapper.CourseExposureTotal>> result = new HashMap<>();
-        if(StringUtils.isEmpty(search.getType())){
-            //直播课
-            List<TeacherIndexWrapper.CourseExposureTotal> liveSummer = userOrderDetailService.getDao().liveBuyTotal(search,groupBy);
-            result.put(GoodTypeEnum.LIVE.getCode(),exposureFillData(liveSummer,dateList));
-            //视频课
-            List<TeacherIndexWrapper.CourseExposureTotal> videoSummer = userOrderDetailService.getDao().videoBuyTotal(search,groupBy);
-            result.put(GoodTypeEnum.VIDEO.getCode(),exposureFillData(videoSummer,dateList));
-            //获取老师关联的学员
-            List<Long> studentIds = teacherService.getDao().getStudentIds(search.getTeacherId(),null);
-            if(CollectionUtils.isNotEmpty(studentIds)){
-                //曲谱
-                search.setStudentIds(studentIds);
-                List<TeacherIndexWrapper.CourseExposureTotal> musicSheetSummer = userOrderDetailService.getDao().musicSheetBuyTotal(search,groupBy);
-                result.put(GoodTypeEnum.MUSIC.getCode(),exposureFillData(musicSheetSummer,dateList));
-            }
-        }else {
-            if(StringUtils.equals("LIVE",search.getType()) || StringUtils.equals("VIP_COURSE",search.getType()) || StringUtils.equals("PRACTICE",search.getType())){
-                //直播课
-                List<TeacherIndexWrapper.CourseExposureTotal> liveSummer = userOrderDetailService.getDao().liveBuyTotal(search,groupBy);
-                result.put(GoodTypeEnum.LIVE.getCode(),exposureFillData(liveSummer,dateList));
-            }else if (StringUtils.equals("VIDEO",search.getType())){
-                //视频课
-                List<TeacherIndexWrapper.CourseExposureTotal> videoSummer = userOrderDetailService.getDao().videoBuyTotal(search,groupBy);
-                result.put(GoodTypeEnum.VIDEO.getCode(),exposureFillData(videoSummer,dateList));
-            }else if (StringUtils.equals("MUSIC",search.getType())){
-                //获取老师关联的学员
-                List<Long> studentIds = teacherService.getDao().getStudentIds(search.getTeacherId(),null);
-                if(CollectionUtils.isNotEmpty(studentIds)){
-                    //曲谱
-                    search.setStudentIds(studentIds);
-                    List<TeacherIndexWrapper.CourseExposureTotal> musicSheetSummer = userOrderDetailService.getDao().musicSheetBuyTotal(search,groupBy);
-                    result.put(GoodTypeEnum.MUSIC.getCode(),exposureFillData(musicSheetSummer,dateList));
-                }
-            }
+        //课程
+        List<TeacherIndexWrapper.CourseExposureTotal> liveSummer = userOrderDetailService.getDao().liveBuyTotal(search,groupBy);
+        result.put("COURSE",exposureFillData(liveSummer,dateList));
+        //获取老师关联的学员
+        List<Long> studentIds = teacherService.getDao().getStudentIds(search.getTeacherId(),null);
+        if(CollectionUtils.isNotEmpty(studentIds)){
+            //曲谱
+            search.setStudentIds(studentIds);
+            List<TeacherIndexWrapper.CourseExposureTotal> musicSheetSummer = userOrderDetailService.getDao().musicSheetBuyTotal(search,groupBy);
+            result.put(GoodTypeEnum.MUSIC.getCode(),exposureFillData(musicSheetSummer,dateList));
         }
         //将数据合并,map中所有的数据按时间,将list中的数据相加
         List<TeacherIndexWrapper.CourseExposureTotal> finalResult = new ArrayList<>();

+ 3 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/LiveCourseGroupVo.java

@@ -62,6 +62,9 @@ public class LiveCourseGroupVo {
     @ApiModelProperty(value = "老师姓名")
     private String teacherName;
 
+    @ApiModelProperty(value = "老师编号")
+    private Integer teacherId;
+
     @ApiModelProperty("订单号")
     private String orderNo;
 

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

@@ -183,7 +183,8 @@
         cg.im_group_id_  as imGroupId,
         cg.course_plan_ as coursePlan,
         su.username_ as teacherName,
-        su.phone_ as phone
+        su.phone_ as phone,
+        cg.teacher_id_ as teacherId
         from course_group cg
         left join sys_user su on su.id_ = cg. teacher_id_
         <if test="param.studentId != null">