Browse Source

feat:网管课推送

Joburgess 4 năm trước cách đây
mục cha
commit
ab52d0c996

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java

@@ -512,4 +512,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
      * @return
      */
     List<CourseSchedule> getCourseScheduleStudentNum(@Param("courseIds") List<Long> courseIds);
+
+    List<CourseScheduleStudentPayment> getWithClassGroupIds(@Param("classGroupIds") List<Integer> classGroupIds,
+                                                            @Param("studentId") Integer studentId);
 }

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -1182,6 +1182,13 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             totalOriginPriceMap.put(musicGroupPaymentCalenderCourseSettings.getCourseType(), musicGroupPaymentCalenderCourseSettings.getCourseOriginalPrice());
         }
 
+        List<Integer> classGroupIds = classGroupList.stream().map(ClassGroup::getId).collect(Collectors.toList());
+        List<CourseScheduleStudentPayment> ccs = courseScheduleStudentPaymentDao.getWithClassGroupIds(classGroupIds, studentId);
+        Set<Long> existCourseIds = new HashSet<>();
+        if(!CollectionUtils.isEmpty(ccs)){
+            existCourseIds = ccs.stream().map(CourseScheduleStudentPayment::getCourseScheduleId).collect(Collectors.toSet());;
+        }
+
         Map<CourseScheduleType, BigDecimal> totalPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
         Map<CourseScheduleType, BigDecimal> totalOrignPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
 
@@ -1205,6 +1212,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             // 3、学生加入级未开始课程
             List<CourseSchedule> courseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroup.getId());
             for (CourseSchedule courseSchedule : courseScheduleList) {
+                if(existCourseIds.contains(courseSchedule.getId())){
+                    continue;
+                }
+
                 CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
                 courseScheduleStudentPayment.setCourseSchedule(courseSchedule);
                 courseScheduleStudentPayment.setGroupType(classGroup.getGroupType());
@@ -1212,6 +1223,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
                 courseScheduleStudentPayment.setUserId(studentId);
                 courseScheduleStudentPayment.setBatchNo(batchNo);
+                courseScheduleStudentPayment.setBeMerged(false);
 
                 unitPrice = unitPriceMap.get(courseSchedule.getType());
                 if (unitPrice != null) {

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

@@ -729,4 +729,14 @@
 		</foreach>
 		GROUP BY course_schedule_id_
 	</select>
+
+	<select id="getWithClassGroupIds" resultType="com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment">
+		SELECT * FROM course_schedule_student_payment WHERE class_group_id_ IN
+		<foreach collection="classGroupIds" item="classGroupId" open="(" close=")" separator=",">
+			#{classGroupId}
+		</foreach>
+		<if test="studentId!=null">
+			AND user_id_ = #{studentId}
+		</if>
+	</select>
 </mapper>