Преглед изворни кода

Merge branch 'feature/1113-vipCourse' of http://git.dayaedu.com/yonge/cooleshow into test

zouxuan пре 8 месеци
родитељ
комит
72fee80b2b

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

@@ -141,7 +141,7 @@ public class TeacherHomeController extends BaseController {
         query.setTeacherId(sysUserService.getUserId());
         Map<String, List<TeacherIndexWrapper.CourseExposureTotal>> stringListMap = homeService.courseBuyTotal(query);
         //获取曝光的统计数据
-        stringListMap.put("exposure", homeService.courseExposureTotal(query));
+        stringListMap.putAll(homeService.courseExposureTotal(query));
         return succeed(stringListMap);
     }
 

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

@@ -87,7 +87,7 @@ public interface HomeService {
 
     List<TeacherIndexWrapper.StudentPracticeSummaryDto> getTeacherHomeStudent(TeacherIndexWrapper.StudentSearch studentSearch);
 
-    List<TeacherIndexWrapper.CourseExposureTotal> courseExposureTotal(TeacherIndexWrapper.CourseExposureSearch query);
+    Map<String,List<TeacherIndexWrapper.CourseExposureTotal>> courseExposureTotal(TeacherIndexWrapper.CourseExposureSearch query);
 
     Map<String,List<TeacherIndexWrapper.CourseExposureTotal>> courseBuyTotal(TeacherIndexWrapper.CourseExposureSearch query);
 }

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

@@ -455,6 +455,9 @@ public class HomeServiceImpl implements HomeService {
     private List<TeacherIndexWrapper.CourseExposureTotal> exposureFillData(List<TeacherIndexWrapper.CourseExposureTotal> exposureTotals,
                                                                            List<String> dateList,
                                                                            String[] typeArr) {
+        if(exposureTotals == null){
+            exposureTotals = new ArrayList<>();
+        }
         //按类型分组
         Map<String, List<TeacherIndexWrapper.CourseExposureTotal>> typeMap = exposureTotals.stream()
                 .collect(Collectors.groupingBy(TeacherIndexWrapper.CourseExposureTotal::getType));
@@ -493,7 +496,7 @@ public class HomeServiceImpl implements HomeService {
 
 
     @Override
-    public List<TeacherIndexWrapper.CourseExposureTotal> courseExposureTotal(TeacherIndexWrapper.CourseExposureSearch search) {
+    public Map<String,List<TeacherIndexWrapper.CourseExposureTotal>> courseExposureTotal(TeacherIndexWrapper.CourseExposureSearch search) {
         String groupBy;
         List<String> dateList;
         Date startDate = DateUtil.strToDate(search.getStartTime(), DateUtil.DEFAULT_PATTERN);
@@ -509,8 +512,14 @@ public class HomeServiceImpl implements HomeService {
             dateList = DateUtil.getYearList(startDate,endDate);
         }
         List<TeacherIndexWrapper.CourseExposureTotal> courseExposureTotals = exposureRecordService.getDao().courseExposureTotal(search, groupBy);
-        String[] typeArr = new String[]{GoodTypeEnum.LIVE.getCode(),GoodTypeEnum.VIDEO.getCode(),GoodTypeEnum.MUSIC.getCode()};
-        return exposureFillData(courseExposureTotals,dateList,typeArr);
+        //按分类分组
+        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_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 result;
     }
 
     @Override

+ 0 - 3
cooleshow-user/user-biz/src/main/resources/config/mybatis/ExposureRecordDao.xml

@@ -17,9 +17,6 @@
 		select DATE_FORMAT(er.exposure_time_, #{groupBy}) 'date',er.object_type_ as type,
 		       SUM(er.exposure_num_) exposureNum from exposure_record er
 		where er.exposure_time_ BETWEEN #{param.startTime} AND #{param.endTime}
-		<if test="param.objectType != null and param.objectType != ''">
-				and er.object_type_ = #{param.objectType}
-		</if>
 		group by er.object_type_,DATE_FORMAT(er.exposure_time_, #{groupBy})
 		ORDER BY type,'date'
 	</select>