|  | @@ -3,7 +3,6 @@ package com.yonge.cooleshow.biz.dal.service.impl;
 | 
											
												
													
														|  |  import com.alibaba.fastjson.JSON;
 |  |  import com.alibaba.fastjson.JSON;
 | 
											
												
													
														|  |  import com.alibaba.fastjson.JSONObject;
 |  |  import com.alibaba.fastjson.JSONObject;
 | 
											
												
													
														|  |  import com.google.common.collect.Lists;
 |  |  import com.google.common.collect.Lists;
 | 
											
												
													
														|  | -import com.yonge.cooleshow.auth.api.entity.SysUser;
 |  | 
 | 
											
												
													
														|  |  import com.yonge.cooleshow.biz.dal.dao.MusicSheetDao;
 |  |  import com.yonge.cooleshow.biz.dal.dao.MusicSheetDao;
 | 
											
												
													
														|  |  import com.yonge.cooleshow.biz.dal.dao.SysMusicCompareRecordDao;
 |  |  import com.yonge.cooleshow.biz.dal.dao.SysMusicCompareRecordDao;
 | 
											
												
													
														|  |  import com.yonge.cooleshow.biz.dal.dto.*;
 |  |  import com.yonge.cooleshow.biz.dal.dto.*;
 | 
											
										
											
												
													
														|  | @@ -28,7 +27,6 @@ import org.apache.commons.lang3.StringUtils;
 | 
											
												
													
														|  |  import org.joda.time.DateTime;
 |  |  import org.joda.time.DateTime;
 | 
											
												
													
														|  |  import org.slf4j.Logger;
 |  |  import org.slf4j.Logger;
 | 
											
												
													
														|  |  import org.slf4j.LoggerFactory;
 |  |  import org.slf4j.LoggerFactory;
 | 
											
												
													
														|  | -import org.springframework.beans.factory.annotation.Autowired;
 |  | 
 | 
											
												
													
														|  |  import org.springframework.stereotype.Service;
 |  |  import org.springframework.stereotype.Service;
 | 
											
												
													
														|  |  import org.springframework.transaction.annotation.Transactional;
 |  |  import org.springframework.transaction.annotation.Transactional;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -547,26 +545,57 @@ public class SysMusicCompareRecordServiceImpl extends BaseServiceImpl<Long, SysM
 | 
											
												
													
														|  |  		//获取学员练习时长
 |  |  		//获取学员练习时长
 | 
											
												
													
														|  |  		//获取分组条件,如果所选时间段只有一天,则按小时分组,超过一个月按天分组,超过一年按月分组
 |  |  		//获取分组条件,如果所选时间段只有一天,则按小时分组,超过一个月按天分组,超过一年按月分组
 | 
											
												
													
														|  |  		String groupBy;
 |  |  		String groupBy;
 | 
											
												
													
														|  | 
 |  | +		List<String> dateList;
 | 
											
												
													
														|  | 
 |  | +		Date startDate = DateUtil.strToDate(summarySearch.getStartTime(), DateUtil.DEFAULT_PATTERN);
 | 
											
												
													
														|  |  		if(StringUtils.equals(summarySearch.getStartTime(),summarySearch.getEndTime())){
 |  |  		if(StringUtils.equals(summarySearch.getStartTime(),summarySearch.getEndTime())){
 | 
											
												
													
														|  |  			groupBy = "%Y-%m-%d %H";
 |  |  			groupBy = "%Y-%m-%d %H";
 | 
											
												
													
														|  | 
 |  | +			//获取当天的小时段
 | 
											
												
													
														|  | 
 |  | +			dateList = DateUtil.getHourList(startDate);
 | 
											
												
													
														|  |  		}else {
 |  |  		}else {
 | 
											
												
													
														|  | -			Date startDate = DateUtil.strToDate(summarySearch.getStartTime(), DateUtil.DEFAULT_PATTERN);
 |  | 
 | 
											
												
													
														|  |  			Date endDate = DateUtil.strToDate(summarySearch.getEndTime(), DateUtil.DEFAULT_PATTERN);
 |  |  			Date endDate = DateUtil.strToDate(summarySearch.getEndTime(), DateUtil.DEFAULT_PATTERN);
 | 
											
												
													
														|  |  			if(DateUtil.daysBetween(startDate,endDate) <= 31){
 |  |  			if(DateUtil.daysBetween(startDate,endDate) <= 31){
 | 
											
												
													
														|  |  				groupBy = "%Y-%m-%d";
 |  |  				groupBy = "%Y-%m-%d";
 | 
											
												
													
														|  | 
 |  | +				dateList = DateUtil.getDayList(startDate,endDate);
 | 
											
												
													
														|  |  			}else if(DateUtil.monthsBetween(startDate,endDate) <= 12){
 |  |  			}else if(DateUtil.monthsBetween(startDate,endDate) <= 12){
 | 
											
												
													
														|  |  				groupBy = "%Y-%m";
 |  |  				groupBy = "%Y-%m";
 | 
											
												
													
														|  | 
 |  | +				dateList = DateUtil.getMonthList(startDate,endDate);
 | 
											
												
													
														|  |  			}else {
 |  |  			}else {
 | 
											
												
													
														|  |  				groupBy = "%Y";
 |  |  				groupBy = "%Y";
 | 
											
												
													
														|  | 
 |  | +				dateList = DateUtil.getYearList(startDate,endDate);
 | 
											
												
													
														|  |  			}
 |  |  			}
 | 
											
												
													
														|  |  		}
 |  |  		}
 | 
											
												
													
														|  | -		teacherPracticeHome.setPracticeTimes(sysMusicCompareRecordDao.getStudentTrainTime(studentIds,summarySearch,groupBy));
 |  | 
 | 
											
												
													
														|  | 
 |  | +		List<TeacherIndexWrapper.PracticeTimeDto> studentTrainTime = sysMusicCompareRecordDao.getStudentTrainTime(studentIds, summarySearch, groupBy);
 | 
											
												
													
														|  | 
 |  | +		//补全时间段
 | 
											
												
													
														|  | 
 |  | +		fillData(studentTrainTime,dateList);
 | 
											
												
													
														|  | 
 |  | +		teacherPracticeHome.setPracticeTimes(studentTrainTime);
 | 
											
												
													
														|  |  		//练习人数
 |  |  		//练习人数
 | 
											
												
													
														|  | -		teacherPracticeHome.setPracticeCounts(sysMusicCompareRecordDao.getStudentTrainCount(studentIds,summarySearch,groupBy));
 |  | 
 | 
											
												
													
														|  | 
 |  | +		List<TeacherIndexWrapper.PracticeTimeDto> studentTrainCount = sysMusicCompareRecordDao.getStudentTrainCount(studentIds, summarySearch, groupBy);
 | 
											
												
													
														|  | 
 |  | +		//补全时间段
 | 
											
												
													
														|  | 
 |  | +		fillData(studentTrainCount,dateList);
 | 
											
												
													
														|  | 
 |  | +		teacherPracticeHome.setPracticeCounts(studentTrainCount);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          return teacherPracticeHome;
 |  |          return teacherPracticeHome;
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +	//数据补全
 | 
											
												
													
														|  | 
 |  | +	private void fillData(List<TeacherIndexWrapper.PracticeTimeDto> studentTrainTime, List<String> dateList) {
 | 
											
												
													
														|  | 
 |  | +		if(CollectionUtils.isEmpty(studentTrainTime)){
 | 
											
												
													
														|  | 
 |  | +			return;
 | 
											
												
													
														|  | 
 |  | +		}
 | 
											
												
													
														|  | 
 |  | +		for (String date : dateList) {
 | 
											
												
													
														|  | 
 |  | +			boolean flag = false;
 | 
											
												
													
														|  | 
 |  | +			for (TeacherIndexWrapper.PracticeTimeDto practiceTimeDto : studentTrainTime) {
 | 
											
												
													
														|  | 
 |  | +				if(StringUtils.equals(date,practiceTimeDto.getDate())){
 | 
											
												
													
														|  | 
 |  | +					flag = true;
 | 
											
												
													
														|  | 
 |  | +					break;
 | 
											
												
													
														|  | 
 |  | +				}
 | 
											
												
													
														|  | 
 |  | +			}
 | 
											
												
													
														|  | 
 |  | +			if(!flag){
 | 
											
												
													
														|  | 
 |  | +				studentTrainTime.add(new TeacherIndexWrapper.PracticeTimeDto(date,0L));
 | 
											
												
													
														|  | 
 |  | +			}
 | 
											
												
													
														|  | 
 |  | +		}
 | 
											
												
													
														|  | 
 |  | +	}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  	@Override
 |  |  	@Override
 | 
											
												
													
														|  |  	public List<TeacherIndexWrapper.StudentPracticeSummaryDto> getTeacherHomeStudent(TeacherIndexWrapper.StudentSearch studentSearch) {
 |  |  	public List<TeacherIndexWrapper.StudentPracticeSummaryDto> getTeacherHomeStudent(TeacherIndexWrapper.StudentSearch studentSearch) {
 | 
											
												
													
														|  |  		//获取老师关联的学员
 |  |  		//获取老师关联的学员
 |