| 
					
				 | 
			
			
				@@ -7,15 +7,10 @@ import com.yonge.cooleshow.biz.dal.dao.MusicSheetDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.dao.UserAccountRecordDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.dto.SubjectHomeSearch; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.dto.req.TotalReq; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.yonge.cooleshow.biz.dal.entity.MusicSheet; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.enums.CourseScheduleEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.enums.GoodTypeEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.enums.TeacherTagEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.yonge.cooleshow.biz.dal.service.CourseScheduleService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.yonge.cooleshow.biz.dal.service.HomeService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-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.support.WrapperUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.vo.CourseHomeVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.vo.SubjectHomeVo; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -23,14 +18,18 @@ import com.yonge.cooleshow.biz.dal.vo.TagTotalTeacher; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.vo.res.HomeTotalStudent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.vo.res.HomeTotalTeacher; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.vo.res.HomeUserToDoNum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yonge.cooleshow.biz.dal.wrapper.TeacherIndexWrapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.wrapper.teacher.TeacherHomeWrapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.common.entity.HttpResponseResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.toolset.base.page.PageInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.toolset.mybatis.support.PageUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yonge.toolset.utils.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.collections.CollectionUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import javax.annotation.Resource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.time.LocalDate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.time.temporal.TemporalAdjusters; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.*; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -43,18 +42,22 @@ import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Service 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class HomeServiceImpl implements HomeService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private HomeDao baserMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private CourseScheduleService courseScheduleService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private MusicSheetService musicSheetService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private MusicSheetDao musicSheetDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private UserAccountRecordDao userAccountRecordDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private ExposureRecordService exposureRecordService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private TeacherService teacherService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private SysMusicCompareRecordService sysMusicCompareRecordService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private UserOrderDetailService userOrderDetailService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public HomeUserToDoNum getUserToDoNum() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -381,4 +384,165 @@ public class HomeServiceImpl implements HomeService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return musicSheetDao.musicSheetPage(query); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public TeacherIndexWrapper.TeacherPracticeHome getTeacherPracticeHome(TeacherIndexWrapper.SummarySearch summarySearch) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        TeacherIndexWrapper.TeacherPracticeHome teacherPracticeHome = new TeacherIndexWrapper.TeacherPracticeHome(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取老师关联的学员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Long> studentIds = teacherService.getDao().getStudentIds(summarySearch.getTeacherId(),summarySearch.getSubjectId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(CollectionUtils.isEmpty(studentIds)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return teacherPracticeHome; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取学员练习汇总 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        TeacherIndexWrapper.PracticeSummaryDto practiceSummary = sysMusicCompareRecordService.getDao().getStudentTrainOverView(studentIds,summarySearch); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //计算平均练习时长 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(Objects.nonNull(practiceSummary) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                && practiceSummary.getPracticeCount().compareTo(BigDecimal.ZERO) > 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                && practiceSummary.getTotalPracticeTime().compareTo(BigDecimal.ZERO) > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            practiceSummary.setAveragePracticeTime(practiceSummary.getTotalPracticeTime().divide(practiceSummary.getPracticeCount(), 0, BigDecimal.ROUND_HALF_UP)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        teacherPracticeHome.setPracticeSummary(practiceSummary); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取学员练习时长 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取分组条件,如果所选时间段只有一天,则按小时分组,超过一个月按天分组,超过一年按月分组 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String groupBy; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> dateList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Date startDate = DateUtil.strToDate(summarySearch.getStartTime(), DateUtil.DEFAULT_PATTERN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(StringUtils.equals(summarySearch.getStartTime(),summarySearch.getEndTime())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            groupBy = "%Y-%m-%d %H"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //获取当天的小时段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dateList = DateUtil.getHourList(startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Date endDate = DateUtil.strToDate(summarySearch.getEndTime(), DateUtil.DEFAULT_PATTERN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(DateUtil.daysBetween(startDate,endDate) <= 31){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                groupBy = "%Y-%m-%d"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                dateList = DateUtil.getDayList(startDate,endDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }else if(DateUtil.monthsBetween(startDate,endDate) <= 12){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                groupBy = "%Y-%m"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                dateList = DateUtil.getMonthList(startDate,endDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                groupBy = "%Y"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                dateList = DateUtil.getYearList(startDate,endDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<TeacherIndexWrapper.PracticeTimeDto> studentTrainTime = sysMusicCompareRecordService.getDao().getStudentTrainTime(studentIds, summarySearch, groupBy); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //补全时间段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        teacherPracticeHome.setPracticeTimes(fillData(studentTrainTime,dateList)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //练习人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<TeacherIndexWrapper.PracticeTimeDto> studentTrainCount = sysMusicCompareRecordService.getDao().getStudentTrainCount(studentIds, summarySearch, groupBy); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //补全时间段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        teacherPracticeHome.setPracticeCounts(fillData(studentTrainCount,dateList)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return teacherPracticeHome; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //数据补全,按时间顺序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private List<TeacherIndexWrapper.PracticeTimeDto> fillData(List<TeacherIndexWrapper.PracticeTimeDto> studentTrainTime, List<String> dateList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String,TeacherIndexWrapper.PracticeTimeDto> timeMap = studentTrainTime.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .collect(Collectors.toMap(TeacherIndexWrapper.PracticeTimeDto::getDate, o -> o)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<TeacherIndexWrapper.PracticeTimeDto> result = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (String s : dateList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            TeacherIndexWrapper.PracticeTimeDto practiceTimeDto = timeMap.get(s); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(Objects.nonNull(practiceTimeDto)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                result.add(practiceTimeDto); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                result.add(new TeacherIndexWrapper.PracticeTimeDto(s,0L)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //数据补全,按时间顺序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private List<TeacherIndexWrapper.CourseExposureTotal> exposureFillData(List<TeacherIndexWrapper.CourseExposureTotal> exposureTotals, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                                           List<String> dateList, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                                           String[] typeArr) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //按类型分组 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, List<TeacherIndexWrapper.CourseExposureTotal>> typeMap = exposureTotals.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .collect(Collectors.groupingBy(TeacherIndexWrapper.CourseExposureTotal::getType)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<TeacherIndexWrapper.CourseExposureTotal> result = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //按时间段补全数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (String s : dateList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (String type : typeArr) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<TeacherIndexWrapper.CourseExposureTotal> dateMap = typeMap.get(type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Map<String, TeacherIndexWrapper.CourseExposureTotal> dateMapGroup = dateMap.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        .collect(Collectors.toMap(TeacherIndexWrapper.CourseExposureTotal::getDate, o -> o)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                TeacherIndexWrapper.CourseExposureTotal courseExposureTotal = dateMapGroup.get(s); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(Objects.nonNull(courseExposureTotal)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    result.add(courseExposureTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    result.add(new TeacherIndexWrapper.CourseExposureTotal(s,type,0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public List<TeacherIndexWrapper.StudentPracticeSummaryDto> getTeacherHomeStudent(TeacherIndexWrapper.StudentSearch studentSearch) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取老师关联的学员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Long> studentIds = teacherService.getDao().getStudentIds(studentSearch.getTeacherId(),studentSearch.getSubjectId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(CollectionUtils.isEmpty(studentIds)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return Collections.emptyList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取学员练习汇总 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return sysMusicCompareRecordService.getDao().getStudentTrainOverViewList(studentIds,studentSearch); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public List<TeacherIndexWrapper.CourseExposureTotal> courseExposureTotal(TeacherIndexWrapper.CourseExposureSearch search) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String groupBy; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> dateList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Date startDate = DateUtil.strToDate(search.getStartTime(), DateUtil.DEFAULT_PATTERN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Date endDate = DateUtil.strToDate(search.getEndTime(), DateUtil.DEFAULT_PATTERN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(DateUtil.daysBetween(startDate,endDate) <= 31){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            groupBy = "%Y-%m-%d"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dateList = DateUtil.getDayList(startDate,endDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else if(DateUtil.monthsBetween(startDate,endDate) <= 12){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            groupBy = "%Y-%m"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dateList = DateUtil.getMonthList(startDate,endDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            groupBy = "%Y"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public Map<String,List<TeacherIndexWrapper.CourseExposureTotal>> courseBuyTotal(TeacherIndexWrapper.CourseExposureSearch search) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取学员练习时长 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取分组条件,如果所选时间段只有一天,则按小时分组,超过一个月按天分组,超过一年按月分组 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String groupBy; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> dateList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Date startDate = DateUtil.strToDate(search.getStartTime(), DateUtil.DEFAULT_PATTERN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Date endDate = DateUtil.strToDate(search.getEndTime(), DateUtil.DEFAULT_PATTERN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(DateUtil.daysBetween(startDate,endDate) <= 31){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            groupBy = "%Y-%m-%d"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dateList = DateUtil.getDayList(startDate,endDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else if(DateUtil.monthsBetween(startDate,endDate) <= 12){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            groupBy = "%Y-%m"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dateList = DateUtil.getMonthList(startDate,endDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            groupBy = "%Y"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dateList = DateUtil.getYearList(startDate,endDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String,List<TeacherIndexWrapper.CourseExposureTotal>> result = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //直播课 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<TeacherIndexWrapper.CourseExposureTotal> liveSummer = userOrderDetailService.getDao().liveBuyTotal(search,groupBy); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.put(GoodTypeEnum.LIVE.getCode(),exposureFillData(liveSummer,dateList,new String[]{GoodTypeEnum.LIVE.getCode()})); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //视频课 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<TeacherIndexWrapper.CourseExposureTotal> videoSummer = userOrderDetailService.getDao().videoBuyTotal(search,groupBy); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.put(GoodTypeEnum.VIDEO.getCode(),exposureFillData(videoSummer,dateList,new String[]{GoodTypeEnum.VIDEO.getCode()})); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取老师关联的学员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        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,new String[]{GoodTypeEnum.MUSIC.getCode()})); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |