yonge 5 年之前
父節點
當前提交
c06c60337f

+ 1 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java

@@ -250,10 +250,9 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
     
     /**
      * 从指定时间开始查询学的线上可数
-     * @param startDate 指定的开始时间
      * @return
      */
-    List<StudentCourseTimesDto> queryStudentCourseTimesOfOnline(Date startDate);
+    List<StudentCourseTimesDto> queryStudentNotStartCourseTimesOfOnline();
 
     List<StudentTeacherCourseDto> findAllStudentCourseInfo();
 }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentDao.java

@@ -18,7 +18,7 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
 
     int countStudents(Map<String, Object> params);
 
-    List<Student> queryByOperatingTag(Integer operatingTag);
+    List<Student> queryByOperatingTempTag(Integer operatingTag);
 
     int batchUpdate(@Param("studentList") List<Student> studentList);
 

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Student.java

@@ -17,6 +17,8 @@ public class Student {
 
 	private Integer operatingTag;
 
+	private Integer operatingTempTag;
+
 	private Integer teacherId;
 	
 	/**  */
@@ -86,6 +88,14 @@ public class Student {
 		this.operatingTag = operatingTag;
 	}
 
+	public Integer getOperatingTempTag() {
+		return operatingTempTag;
+	}
+
+	public void setOperatingTempTag(Integer operatingTempTag) {
+		this.operatingTempTag = operatingTempTag;
+	}
+
 	public Integer getTeacherId() {
 		return teacherId;
 	}

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/StudentService.java

@@ -1,12 +1,12 @@
 package com.ym.mec.biz.service;
 
+import java.text.ParseException;
+
 import com.ym.mec.biz.dal.entity.Student;
 import com.ym.mec.biz.dal.page.StudentQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
-import java.text.ParseException;
-
 public interface StudentService extends BaseService<Integer, Student> {
 
     PageInfo findStudentVipGroupList(StudentQueryInfo queryInfo);
@@ -18,7 +18,7 @@ public interface StudentService extends BaseService<Integer, Student> {
      * @return
      * @throws ParseException 
      */
-    boolean updateOperatingTag() throws ParseException;
+    boolean updateOperatingTempTag();
 
     /**
      * @describe 初始化教师编号

+ 34 - 17
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java

@@ -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);

+ 2 - 2
mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml

@@ -382,13 +382,13 @@
 		DELETE FROM course_schedule_student_payment WHERE music_group_id_=#{groupId} AND group_type_=#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 	</delete>
 	
-	<select id="queryStudentCourseTimesOfOnline" resultMap="studentCourseTimesDto">
+	<select id="queryStudentNotStartCourseTimesOfOnline" resultMap="studentCourseTimesDto">
 		SELECT cssp.`user_id_`,count(*) totalTimes, 
 		sum(case when (pg.buy_months_ > 0) then 1 ELSE 0 END) practiceTmes,
 		sum(case when (pg.buy_months_ IS NULL AND cssp.`group_type_` = 'PRACTICE' ) then 1 ELSE 0 END) freePracticeTimes
 		FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs on cssp.course_schedule_id_ = cs.id_
 		LEFT JOIN practice_group pg ON pg.id_ = cs.music_group_id_ AND cs.group_type_ = 'PRACTICE'
-		WHERE cs.`teach_mode_` = 'ONLINE' AND cs.`class_date_` &gt;= #{startDate}
+		WHERE cs.`teach_mode_` = 'ONLINE' AND cs.status_ = 'NOT_START'
 		GROUP BY cssp.`user_id_`
 	</select>
 

+ 12 - 2
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -11,6 +11,7 @@
         <result column="subject_id_list_" property="subjectIdList"/>
         <result column="service_tag_" property="serviceTag"/>
         <result column="operating_tag_" property="operatingTag"/>
+        <result column="operating_temp_tag_" property="operatingTempTag"/>
         <result column="teacher_id_" property="teacherId"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
@@ -46,6 +47,9 @@
         <if test="operatingTag != null">
             operating_tag_,
         </if>
+        <if test="operatingTempTag != null">
+            operating_temp_tag_,
+        </if>
         teacher_id_,create_time_,update_time_)
         VALUES
         (#{userId},#{subjectIdList},
@@ -70,6 +74,9 @@
             <if test="operatingTag != null">
                 operating_tag_ = #{operatingTag},
             </if>
+            <if test="operatingTempTag != null">
+                operating_temp_tag_ = #{operatingTempTag},
+            </if>
             <if test="teacherId != null">
                 teacher_id_=#{teacherId},
             </if>
@@ -119,10 +126,10 @@
         </where>
     </sql>
 
-    <select id="queryByOperatingTag" resultMap="Student">
+    <select id="queryByOperatingTempTag" resultMap="Student">
         SELECT *
         FROM student
-        WHERE operating_tag_ = #{operatingTag}
+        WHERE operating_temp_tag_ = #{operatingTempTag}
     </select>
 
     <update id="batchUpdate" parameterType="java.util.List">
@@ -138,6 +145,9 @@
                 <if test="item.operatingTag != null">
                     operating_tag_ = #{item.operatingTag},
                 </if>
+                <if test="item.operatingTempTag != null">
+                    operating_temp_tag_ = #{item.operatingTempTag},
+                </if>
                 <if test="item.teacherId != null">
                     teacher_id_=#{item.teacherId},
                 </if>

+ 20 - 6
mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -1,15 +1,29 @@
 package com.ym.mec.web.controller;
 
-import com.ym.mec.biz.service.*;
-import com.ym.mec.common.controller.BaseController;
+import java.util.Date;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.text.ParseException;
-import java.util.Date;
+import com.ym.mec.biz.service.CourseHomeworkService;
+import com.ym.mec.biz.service.CourseReviewService;
+import com.ym.mec.biz.service.CourseScheduleEvaluateService;
+import com.ym.mec.biz.service.CourseScheduleService;
+import com.ym.mec.biz.service.CourseScheduleTeacherSalaryService;
+import com.ym.mec.biz.service.CoursesGroupService;
+import com.ym.mec.biz.service.ExtracurricularExercisesReplyService;
+import com.ym.mec.biz.service.MusicGroupStudentFeeService;
+import com.ym.mec.biz.service.PracticeGroupService;
+import com.ym.mec.biz.service.StudentCourseHomeworkService;
+import com.ym.mec.biz.service.StudentPaymentOrderService;
+import com.ym.mec.biz.service.StudentService;
+import com.ym.mec.biz.service.TeacherAttendanceService;
+import com.ym.mec.biz.service.TeacherCourseStatisticsService;
+import com.ym.mec.biz.service.TenantPaymentOrderService;
+import com.ym.mec.biz.service.VipGroupService;
+import com.ym.mec.common.controller.BaseController;
 
 @RequestMapping("task")
 @RestController
@@ -221,7 +235,7 @@ public class TaskController extends BaseController {
 
 	//更新学生运营指标
 	@GetMapping("/updateStudentOperatingTag")
-	public void updateStudentOperatingTag() throws ParseException{
-		studentService.updateOperatingTag();
+	public void updateStudentOperatingTag(){
+		studentService.updateOperatingTempTag();
 	}
 }