Pārlūkot izejas kodu

1、试听课
2、收费网管课活动

Joburgess 5 gadi atpakaļ
vecāks
revīzija
370c39690a

+ 13 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -1299,6 +1299,19 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     List<Map<Long, String>> queryTeacherName(@Param("courseScheduleIds") List<Long> courseScheduleIds);
 
     /**
+     * @describe 统计学生在指定周期内的vip课数量
+     * @author Joburgess
+     * @date 2020.04.28
+     * @param studentIds:
+     * @param startTime:
+     * @param endTime:
+     * @return java.util.List<java.util.Map<java.lang.Integer,java.lang.Integer>>
+     */
+    List<Map<Integer, Long>> countStudentVipCoursesWithDate(@Param("studentIds") List<Integer> studentIds,
+                                                               @Param("startTime") Date startTime,
+                                                               @Param("endTime") Date endTime);
+
+    /**
      * @param groupId:
      * @param groupType:
      * @param isLock:    冻结状态:1、冻结,0、正常

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentExercisesSituationDto.java

@@ -14,6 +14,16 @@ public class StudentExercisesSituationDto extends StudentExtracurricularExercise
 
     private String teacherName;
 
+    private Integer existVipCourse;
+
+    public Integer getExistVipCourse() {
+        return existVipCourse;
+    }
+
+    public void setExistVipCourse(Integer existVipCourse) {
+        this.existVipCourse = existVipCourse;
+    }
+
     public String getStudentName() {
         return studentName;
     }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentExercisesSituationQueryInfo.java

@@ -36,6 +36,17 @@ public class StudentExercisesSituationQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "及时训练评价次数是否达到预期")
     private Integer exercisesMessageTimelyNumIsAchieve;
 
+    @ApiModelProperty(value = "是否存在vip课")
+    private Integer existVipCourse;
+
+    public Integer getExistVipCourse() {
+        return existVipCourse;
+    }
+
+    public void setExistVipCourse(Integer existVipCourse) {
+        this.existVipCourse = existVipCourse;
+    }
+
     public Integer getTeacherId() {
         return teacherId;
     }

+ 18 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentExtracurricularExercisesSituationServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.service.impl;
 
+import com.ym.mec.biz.dal.dao.CourseScheduleDao;
 import com.ym.mec.biz.dal.dao.StudentExtracurricularExercisesSituationDao;
 import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.dto.StudentExercisesSituationDto;
@@ -13,10 +14,8 @@ import com.ym.mec.util.collection.MapUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 public class StudentExtracurricularExercisesSituationServiceImpl extends BaseServiceImpl<Long, StudentExtracurricularExercisesSituation> implements StudentExtracurricularExercisesSituationService {
@@ -24,6 +23,8 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 	@Autowired
 	private StudentExtracurricularExercisesSituationDao studentExtracurricularExercisesSituationDao;
 	@Autowired
+	private CourseScheduleDao courseScheduleDao;
+	@Autowired
 	private TeacherDao teacherDao;
 
 	@Override
@@ -43,6 +44,19 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 			pageInfo.setTotal(count);
 			params.put("offset", pageInfo.getOffset());
 			dataList = studentExtracurricularExercisesSituationDao.findExercisesSituations(params);
+			if(Objects.isNull(queryInfo.getExistVipCourse())){
+				List<Integer> studentIds = dataList.stream().map(StudentExtracurricularExercisesSituation::getStudentId).collect(Collectors.toList());
+				List<Map<Integer, Long>> studentVipCoursesMaps = courseScheduleDao.countStudentVipCoursesWithDate(studentIds, queryInfo.getMonday(), queryInfo.getSunday());
+				Map<Integer, Long> studentVipCourseMap = MapUtil.convertIntegerMap(studentVipCoursesMaps);
+				for (StudentExercisesSituationDto exercisesSituationDto : dataList) {
+					Long vipCourses=studentVipCourseMap.get(exercisesSituationDto.getStudentId());
+					if(Objects.isNull(vipCourses)||vipCourses<=0){
+						exercisesSituationDto.setExistVipCourse(0);
+					}else{
+						exercisesSituationDto.setExistVipCourse(1);
+					}
+				}
+			}
 		}
 		if (count == 0) {
 			dataList = new ArrayList<>();

+ 17 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -2990,5 +2990,22 @@
         FROM course_schedule cs
         WHERE cs.music_group_id_ = #{practiceGroupId} AND cs.del_flag_ = 0 AND cs.group_type_ = #{groupType};
     </select>
+    <select id="countStudentVipCoursesWithDate" resultType="map">
+        SELECT
+          cssp.user_id_ as 'key',
+          COUNT( cs.id_ ) as 'value'
+        FROM
+            course_schedule_student_payment cssp
+            LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
+        WHERE
+            cssp.user_id_ IN
+            <foreach collection="studentIds" item="studentId" separator="," open="(" close=")">
+                #{studentId}
+            </foreach>
+            AND cssp.group_type_ = 'VIP'
+            AND cs.class_date_ BETWEEN #{startTime} AND #{endTime}
+        GROUP BY
+        cssp.user_id_
+    </select>
 
 </mapper>

+ 16 - 0
mec-biz/src/main/resources/config/mybatis/StudentExtracurricularExercisesSituationMapper.xml

@@ -26,6 +26,7 @@
 		<result column="student_name_" property="studentName"/>
 		<result column="teacher_name_" property="teacherName"/>
 		<result column="organ_name_" property="organName"/>
+		<result column="exist_vip_course_" property="existVipCourse"/>
 	</resultMap>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -131,6 +132,9 @@
 			SUM( exercises_reply_num_ ) exercises_reply_num_,
 			SUM( exercises_message_num_ ) exercises_message_num_,
 			SUM( exercises_message_timely_num_ ) exercises_message_timely_num_
+			<if test="existVipCourse!=null">
+				,#{existVipCourse} exist_vip_course_
+			</if>
 		FROM
 			student_extracurricular_exercises_situation_ sees
 			LEFT JOIN sys_user stu ON stu.id_=sees.student_id_
@@ -148,6 +152,12 @@
 			<if test="organIdList != null">
 				AND FIND_IN_SET(stu.organ_id_,#{organIdList})
 			</if>
+			<if test="existVipCourse!=null and existVipCourse==1">
+				AND EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='VIP' AND class_date_ BETWEEN #{monday} AND #{sunday})
+			</if>
+			<if test="existVipCourse!=null and existVipCourse==0">
+				AND NOT EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='VIP' AND class_date_ BETWEEN #{monday} AND #{sunday})
+			</if>
 			GROUP BY
 			student_id_,teacher_id_
 			<trim prefix="HAVING" suffixOverrides="and">
@@ -202,6 +212,12 @@
 			<if test="organIdList != null">
 				AND FIND_IN_SET(stu.organ_id_, #{organIdList})
 			</if>
+			<if test="existVipCourse!=null and existVipCourse==1">
+				AND EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='VIP' AND class_date_ BETWEEN #{monday} AND #{sunday})
+			</if>
+			<if test="existVipCourse!=null and existVipCourse==0">
+				AND NOT EXISTS (SELECT cssp.id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=sees.student_id_ AND cssp.group_type_='VIP' AND class_date_ BETWEEN #{monday} AND #{sunday})
+			</if>
 			GROUP BY
 			student_id_,teacher_id_
 			<trim prefix="HAVING" suffixOverrides="and">