浏览代码

1、退课审核时学生状态检测
2、后台给学生退课时检测学生是否存在退课申请

Joburgess 5 年之前
父节点
当前提交
080321a255

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

@@ -29,5 +29,18 @@ public interface StudentApplyRefundsDao extends BaseDAO<Long, StudentApplyRefund
      */
      */
     List<StudentApplyRefunds> findByGroupAndType(@Param("groupId") String groupId,
     List<StudentApplyRefunds> findByGroupAndType(@Param("groupId") String groupId,
                                                  @Param("groupType") String groupType);
                                                  @Param("groupType") String groupType);
+
+    /**
+     * @describe 获取用户退课中的申请
+     * @author Joburgess
+     * @date 2019/12/9
+     * @param groupId: 乐团或vip课编号
+     * @param groupType: 乐团类型
+     * @param userId: 用户编号
+     * @return java.util.List<com.ym.mec.biz.dal.entity.StudentApplyRefunds>
+     */
+    List<StudentApplyRefunds> findByGroupAndUser(@Param("groupId") String groupId,
+                                                 @Param("groupType") String groupType,
+                                                 @Param("userId") Integer userId);
 	
 	
 }
 }

+ 12 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -1187,9 +1187,15 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			throw new BizException("指定的课程不存在");
 			throw new BizException("指定的课程不存在");
 		}
 		}
 		if(vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)){
 		if(vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)){
-			throw new BizException("不能已进行的课程进行此操作");
+			throw new BizException("不能对已停止的课程进行此操作");
 		}
 		}
-		ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
+
+        List<StudentApplyRefunds> studentApplyRefunds = studentApplyRefundsDao.findByGroupAndUser(vipGroupId.toString(), GroupType.VIP.getCode(), studentId);
+		if(!CollectionUtils.isEmpty(studentApplyRefunds)){
+		    throw new BizException("此学生存在退课申请,请到系统日志中查看");
+        }
+
+        ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
 
 
 		ClassGroupStudentMapper classStudentMapperByUserIdAndClassGroupId = classGroupStudentMapperDao.query(classGroup.getId(),
 		ClassGroupStudentMapper classStudentMapperByUserIdAndClassGroupId = classGroupStudentMapperDao.query(classGroup.getId(),
 				studentId);
 				studentId);
@@ -1310,6 +1316,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				ClassGroupStudentMapper classStudentMapperByUserIdAndClassGroupId = classGroupStudentMapperDao.query(studentPaymentOrder.getClassGroupId(),
 				ClassGroupStudentMapper classStudentMapperByUserIdAndClassGroupId = classGroupStudentMapperDao.query(studentPaymentOrder.getClassGroupId(),
 						studentPaymentOrder.getUserId());
 						studentPaymentOrder.getUserId());
 
 
+				if(Objects.isNull(classStudentMapperByUserIdAndClassGroupId)){
+				    throw new BizException("此学员不在指定班级上");
+                }
+
 				classStudentMapperByUserIdAndClassGroupId.setStatus(ClassGroupStudentStatusEnum.QUIT);
 				classStudentMapperByUserIdAndClassGroupId.setStatus(ClassGroupStudentStatusEnum.QUIT);
 				classGroupStudentMapperDao.update(classStudentMapperByUserIdAndClassGroupId);
 				classGroupStudentMapperDao.update(classStudentMapperByUserIdAndClassGroupId);
 
 

+ 17 - 1
mec-biz/src/main/resources/config/mybatis/StudentApplyRefundsMapper.xml

@@ -144,7 +144,7 @@
             sar.update_time_
             sar.update_time_
         FROM
         FROM
             student_payment_order spo
             student_payment_order spo
-            LEFT JOIN student_apply_refunds sar ON spo.user_id_
+            LEFT JOIN student_apply_refunds sar ON spo.user_id_=sar.user_id_
             AND spo.id_ = sar.orig_payment_order_id_
             AND spo.id_ = sar.orig_payment_order_id_
         WHERE
         WHERE
             spo.music_group_id_ = #{groupId}
             spo.music_group_id_ = #{groupId}
@@ -155,4 +155,20 @@
             spo.update_time_ DESC
             spo.update_time_ DESC
 
 
     </select>
     </select>
+    <select id="findByGroupAndUser" resultMap="StudentApplyRefunds">
+        SELECT
+            sar.*
+        FROM
+            student_apply_refunds sar
+            LEFT JOIN student_payment_order spo ON spo.user_id_=sar.user_id_
+            AND spo.id_ = sar.orig_payment_order_id_
+        WHERE
+            spo.music_group_id_ = #{groupId}
+            AND spo.group_type_ = #{groupType}
+            AND spo.user_id_ = #{userId}
+            AND spo.status_ = 'SUCCESS'
+            AND sar.status_ = 'ING'
+        ORDER BY
+            spo.update_time_ DESC
+    </select>
 </mapper>
 </mapper>