Browse Source

系统收费

zouxuan 4 years ago
parent
commit
52ceece14d

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

@@ -638,5 +638,6 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
      * @return
      * @return
      */
      */
     List<StudentRegistration> queryMemberEndAutoQuitMusic(@Param("memberEndAutoQuitMusic") String memberEndAutoQuitMusic,
     List<StudentRegistration> queryMemberEndAutoQuitMusic(@Param("memberEndAutoQuitMusic") String memberEndAutoQuitMusic,
-                                                          @Param("educationUserId") Integer educationUserId);
+                                                          @Param("educationUserId") Integer educationUserId,
+                                                          @Param("organIds") String organIds);
 }
 }

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

@@ -532,7 +532,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			twoChild.add(new IndexErrInfoDto(IndexErrorType.STUDENT_APPLY_FOR_QUIT_MUSIC_GROUP, IndexErrorType.STUDENT_APPLY_FOR_QUIT_MUSIC_GROUP.getMsg(), quitGroupNum.size(),  quitGroupNum));
 			twoChild.add(new IndexErrInfoDto(IndexErrorType.STUDENT_APPLY_FOR_QUIT_MUSIC_GROUP, IndexErrorType.STUDENT_APPLY_FOR_QUIT_MUSIC_GROUP.getMsg(), quitGroupNum.size(),  quitGroupNum));
 
 
 			//乐团学员会员到期首页提醒
 			//乐团学员会员到期首页提醒
-			List<StudentRegistration> studentRegistrations = studentRegistrationDao.queryMemberEndAutoQuitMusic(null,educationUserId);
+			List<StudentRegistration> studentRegistrations = studentRegistrationDao.queryMemberEndAutoQuitMusic(null,educationUserId,organIdsStr);
 			IndexErrInfoDto noClassMusicGroupStudentInfo = new IndexErrInfoDto();
 			IndexErrInfoDto noClassMusicGroupStudentInfo = new IndexErrInfoDto();
 			Set<String> musicGroupIds = studentRegistrations.stream().map(e -> e.getMusicGroupId()).collect(Collectors.toSet());
 			Set<String> musicGroupIds = studentRegistrations.stream().map(e -> e.getMusicGroupId()).collect(Collectors.toSet());
 			Set<Integer> userIds = studentRegistrations.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
 			Set<Integer> userIds = studentRegistrations.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
@@ -910,7 +910,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		if(StringUtils.isEmpty(configValue)){
 		if(StringUtils.isEmpty(configValue)){
 			configValue = "15";
 			configValue = "15";
 		}
 		}
-		List<StudentRegistration> studentRegistrations = studentRegistrationDao.queryMemberEndAutoQuitMusic(configValue,educationUserId);
+		List<StudentRegistration> studentRegistrations = studentRegistrationDao.queryMemberEndAutoQuitMusic(configValue,educationUserId,organIds);
 		Set<String> musicGroupIdList = studentRegistrations.stream().map(e -> e.getMusicGroupId()).collect(Collectors.toSet());
 		Set<String> musicGroupIdList = studentRegistrations.stream().map(e -> e.getMusicGroupId()).collect(Collectors.toSet());
 		Set<Integer> userIds = studentRegistrations.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
 		Set<Integer> userIds = studentRegistrations.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
 		IndexErrInfoDto infoDto = new IndexErrInfoDto();
 		IndexErrInfoDto infoDto = new IndexErrInfoDto();
@@ -987,7 +987,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			if(StringUtils.isEmpty(configValue)){
 			if(StringUtils.isEmpty(configValue)){
 				configValue = "15";
 				configValue = "15";
 			}
 			}
-			List<StudentRegistration> studentRegistrations = studentRegistrationDao.queryMemberEndAutoQuitMusic(configValue,educationUserId);
+			List<StudentRegistration> studentRegistrations = studentRegistrationDao.queryMemberEndAutoQuitMusic(configValue,educationUserId,organIdsStr);
 			if(studentRegistrations.size() > 0){
 			if(studentRegistrations.size() > 0){
 				flag2 = true;
 				flag2 = true;
 			}
 			}
@@ -1096,7 +1096,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		}
 		}
 		if(!flag5){
 		if(!flag5){
 			if(!flag5){
 			if(!flag5){
-				List<StudentRegistration> studentRegistrations = studentRegistrationDao.queryMemberEndAutoQuitMusic(null,educationUserId);
+				List<StudentRegistration> studentRegistrations = studentRegistrationDao.queryMemberEndAutoQuitMusic(null,educationUserId,organIdsStr);
 				if(studentRegistrations.size() > 0){
 				if(studentRegistrations.size() > 0){
 					flag5 = true;
 					flag5 = true;
 				}
 				}

+ 7 - 4
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -1539,18 +1539,21 @@
     <select id="queryMemberEndAutoQuitMusic" resultMap="StudentRegistration">
     <select id="queryMemberEndAutoQuitMusic" resultMap="StudentRegistration">
         SELECT sr.music_group_id_,sr.user_id_ FROM student_registration sr
         SELECT sr.music_group_id_,sr.user_id_ FROM student_registration sr
         LEFT JOIN music_group mg ON mg.id_ = sr.music_group_id_
         LEFT JOIN music_group mg ON mg.id_ = sr.music_group_id_
-        LEFT JOIN cloud_teacher_order cto ON cto.student_id_ = sr.user_id_
+        LEFT JOIN cloud_teacher_order cto ON cto.student_id_ = sr.user_id_ AND cto.status_ IN (1,2)
         WHERE sr.music_group_status_ != 'QUIT' AND mg.course_view_type_ = 1
         WHERE sr.music_group_status_ != 'QUIT' AND mg.course_view_type_ = 1
-        AND mg.status_ = 'PROGRESS' AND cto.status_ IN (1,2)
+        AND mg.status_ = 'PROGRESS'
         <if test="educationUserId != null">
         <if test="educationUserId != null">
             AND mg.educational_teacher_id_ = #{educationUserId}
             AND mg.educational_teacher_id_ = #{educationUserId}
         </if>
         </if>
-        GROUP BY cto.student_id_ HAVING MIN(cto.status_) != 1
+        <if test="organIds != null and organIds != ''">
+            AND FIND_IN_SET(mg.organ_id_,#{organIds})
+        </if>
+        GROUP BY cto.student_id_ HAVING (MAX(cto.id_) IS NULL OR MIN(cto.status_) != 1)
         <if test="memberEndAutoQuitMusic != null">
         <if test="memberEndAutoQuitMusic != null">
             AND DATEDIFF(MAX(cto.end_time_),NOW()) &lt;= #{memberEndAutoQuitMusic} AND DATEDIFF(MAX(cto.end_time_),NOW()) >= 0
             AND DATEDIFF(MAX(cto.end_time_),NOW()) &lt;= #{memberEndAutoQuitMusic} AND DATEDIFF(MAX(cto.end_time_),NOW()) >= 0
         </if>
         </if>
         <if test="memberEndAutoQuitMusic == null">
         <if test="memberEndAutoQuitMusic == null">
-            AND DATEDIFF(MAX(cto.end_time_),NOW()) &lt; 0
+            AND (MAX(cto.id_) IS NULL OR DATEDIFF(MAX(cto.end_time_),NOW()) &lt; 0)
         </if>
         </if>
     </select>
     </select>
 </mapper>
 </mapper>