|
@@ -15,6 +15,7 @@ import com.ym.mec.biz.service.SysMessageService;
|
|
import com.ym.mec.biz.service.SysMusicCompareRecordService;
|
|
import com.ym.mec.biz.service.SysMusicCompareRecordService;
|
|
import com.ym.mec.biz.service.SysMusicCompareWeekDataService;
|
|
import com.ym.mec.biz.service.SysMusicCompareWeekDataService;
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
|
+import com.ym.mec.common.exception.BizException;
|
|
import com.ym.mec.common.page.PageInfo;
|
|
import com.ym.mec.common.page.PageInfo;
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
|
|
import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
|
|
@@ -48,6 +49,8 @@ public class SysMusicCompareRecordServiceImpl extends BaseServiceImpl<Long, SysM
|
|
@Autowired
|
|
@Autowired
|
|
private StudentDao studentDao;
|
|
private StudentDao studentDao;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private StudentVisitDao studentVisitDao;
|
|
|
|
+ @Autowired
|
|
private SysMessageService sysMessageService;
|
|
private SysMessageService sysMessageService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -327,16 +330,40 @@ public class SysMusicCompareRecordServiceImpl extends BaseServiceImpl<Long, SysM
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public PageInfo<CountStudentTrainDataDto> countStudentTrain(SysMusicCompareRecordQueryInfo queryInfo) {
|
|
public PageInfo<CountStudentTrainDataDto> countStudentTrain(SysMusicCompareRecordQueryInfo queryInfo) {
|
|
|
|
+ if(queryInfo.getStartTime() == null || queryInfo.getEndTime() == null){
|
|
|
|
+ throw new BizException("请选择训练时间");
|
|
|
|
+ }
|
|
PageInfo<CountStudentTrainDataDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
|
|
PageInfo<CountStudentTrainDataDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
MapUtil.populateMap(params, queryInfo);
|
|
MapUtil.populateMap(params, queryInfo);
|
|
|
|
+ Integer visitFlag = 0;
|
|
|
|
+ if(queryInfo.getVisitFlag() != null && queryInfo.getVisitFlag()){
|
|
|
|
+ //获取所选时间段下一周的日期
|
|
|
|
+ Date addDays1 = DateUtil.addDays(DateUtil.toDate(queryInfo.getEndTime()), 1);
|
|
|
|
+ Date addDays3 = DateUtil.addDays(DateUtil.toDate(queryInfo.getEndTime()), 3);
|
|
|
|
+ //有回访过的学员列表
|
|
|
|
+ List<Integer> studentIds = studentVisitDao.queryRecordVisitStudentIds(queryInfo.getTeacherId(),addDays1,addDays3);
|
|
|
|
+ if(studentIds != null && studentIds.size() > 0){
|
|
|
|
+ params.put("visitStudents",studentIds);
|
|
|
|
+ }
|
|
|
|
+ Date date = DateUtil.toDate(DateUtil.format(new Date(),DateUtil.ISO_EXPANDED_DATE_FORMAT));
|
|
|
|
+ int daysBetween = DateUtil.daysBetween(addDays1, date);
|
|
|
|
+ //每周只有前三天可以回访
|
|
|
|
+ if(daysBetween >= 0 && daysBetween <= 2){
|
|
|
|
+ visitFlag = 1;
|
|
|
|
+ }
|
|
|
|
+ params.put("having",1);
|
|
|
|
+ }
|
|
|
|
|
|
- List<CountStudentTrainDataDto> dataList = new ArrayList<>();
|
|
|
|
- int count = sysMusicCompareRecordDao.countStudentTrain(params);
|
|
|
|
- if (count > 0) {
|
|
|
|
- pageInfo.setTotal(count);
|
|
|
|
|
|
+ List<CountStudentTrainDataDto> dataList = sysMusicCompareRecordDao.queryStudentTrain(params);
|
|
|
|
+ if(dataList != null && dataList.size() > 0){
|
|
|
|
+ pageInfo.setTotal(dataList.size());
|
|
params.put("offset", pageInfo.getOffset());
|
|
params.put("offset", pageInfo.getOffset());
|
|
- dataList =sysMusicCompareRecordDao.queryStudentTrain(params);
|
|
|
|
|
|
+ if(visitFlag == 1){
|
|
|
|
+ for (CountStudentTrainDataDto e : dataList) {
|
|
|
|
+ e.setVisitFlag(visitFlag);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
pageInfo.setRows(dataList);
|
|
pageInfo.setRows(dataList);
|
|
return pageInfo;
|
|
return pageInfo;
|