|
@@ -1,5 +1,18 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Comparator;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+
|
|
|
import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
|
|
|
import com.ym.mec.biz.dal.dao.StudentDao;
|
|
|
import com.ym.mec.biz.dal.dto.StudentCourseTimesDto;
|
|
@@ -12,15 +25,6 @@ import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
-
|
|
|
-import java.text.ParseException;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implements StudentService {
|
|
@@ -69,26 +73,39 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public boolean updateOperatingTag() throws ParseException {
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date date = sdf.parse("2020-02-08");
|
|
|
- List<StudentCourseTimesDto> studentCourseTimesDtoList = courseScheduleStudentPaymentDao.queryStudentCourseTimesOfOnline(date);
|
|
|
+ public boolean updateOperatingTempTag() {
|
|
|
+ List<StudentCourseTimesDto> studentCourseTimesDtoList = courseScheduleStudentPaymentDao.queryStudentNotStartCourseTimesOfOnline();
|
|
|
Map<Integer,StudentCourseTimesDto> map = studentCourseTimesDtoList.stream().collect(Collectors.toMap(StudentCourseTimesDto::getUserId, s -> s));
|
|
|
//查询服务指标为0的用户
|
|
|
- List<Student> studentList = studentDao.queryByOperatingTag(0);
|
|
|
+ List<Student> unlabeledStudentList = studentDao.queryByOperatingTempTag(0);
|
|
|
|
|
|
List<Student> updateStudentList = new ArrayList<Student>();
|
|
|
StudentCourseTimesDto dto = null;
|
|
|
- for(Student s : studentList){
|
|
|
+ for(Student s : unlabeledStudentList){
|
|
|
+ if(s.getOperatingTag() == 1){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
dto = map.get(s.getUserId());
|
|
|
if(dto != null){
|
|
|
- if(dto.getTotalCourseTimes() != dto.getFreePracticeCourseTimes()){
|
|
|
+ if(dto.getTotalCourseTimes() > 0 && dto.getTotalCourseTimes() != dto.getFreePracticeCourseTimes()){
|
|
|
+ s.setOperatingTempTag(1);
|
|
|
s.setOperatingTag(1);
|
|
|
updateStudentList.add(s);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ List<Student> labeledStudentList = studentDao.queryByOperatingTempTag(1);
|
|
|
+ for(Student s : labeledStudentList){
|
|
|
+ dto = map.get(s.getUserId());
|
|
|
+ if(dto != null){
|
|
|
+ if(dto.getTotalCourseTimes() == dto.getFreePracticeCourseTimes()){
|
|
|
+ s.setOperatingTempTag(0);
|
|
|
+ s.setOperatingTag(0);
|
|
|
+ updateStudentList.add(s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
if(updateStudentList.size() > 0){
|
|
|
studentDao.batchUpdate(updateStudentList);
|