|
@@ -3,7 +3,6 @@ package com.yonge.cooleshow.biz.dal.service.impl;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
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.SysMusicCompareRecordDao;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.*;
|
|
@@ -28,7 +27,6 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.joda.time.DateTime;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@@ -547,26 +545,57 @@ public class SysMusicCompareRecordServiceImpl extends BaseServiceImpl<Long, SysM
|
|
|
|
|
|
|
|
|
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 startDate = DateUtil.strToDate(summarySearch.getStartTime(), DateUtil.DEFAULT_PATTERN);
|
|
|
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);
|
|
|
}
|
|
|
}
|
|
|
- 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;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ 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
|
|
|
public List<TeacherIndexWrapper.StudentPracticeSummaryDto> getTeacherHomeStudent(TeacherIndexWrapper.StudentSearch studentSearch) {
|
|
|
|