瀏覽代碼

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

zouxuan 5 年之前
父節點
當前提交
ff87d31712

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java

@@ -92,7 +92,7 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 	 * @return
 	 */
 	StudentPaymentOrder addOrder(StudentRegistration studentRegistration, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee,
-			List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList);
+			List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList) throws Exception;
 
 	/**
 	 * 学生注册缴费重新下订单

+ 5 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -213,7 +213,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
     @Transactional(rollbackFor = Exception.class)
     @Override
-    public StudentPaymentOrder addOrder(StudentRegistration studentRegistration, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee, List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList) {
+    public StudentPaymentOrder addOrder(StudentRegistration studentRegistration, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee, List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList) throws Exception {
         Date date = new Date();
         StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
         studentPaymentOrder.setUserId(studentRegistration.getUserId());
@@ -290,6 +290,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId());
         int paidNum = musicOneSubjectClassPlan.getPaidStudentNum() == null ? 0 : musicOneSubjectClassPlan.getPaidStudentNum();
         musicOneSubjectClassPlan.setPaidStudentNum(paidNum + 1);
+        if(musicOneSubjectClassPlan.getPaidStudentNum() > musicOneSubjectClassPlan.getExpectedStudentNum()){
+            throw new Exception("乐团人数已满");
+        }
+        musicGroupSubjectPlanService.update(musicOneSubjectClassPlan);
         return studentPaymentOrder;
     }
 

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

@@ -224,10 +224,10 @@
     <!-- 根据乐团id获取乐团下所有班级 -->
     <select id="findClassGroupByMusicGroupId" resultMap="ClassGroupTeachers">
         SELECT * FROM class_group WHERE music_group_id_ = #{musicGroupId}
-        <if test="type !=null and type !=''">
+        <if test="type !=null">
             AND FIND_IN_SET(type_,#{type})
         </if>
-        <if test="classGroupId !=null and classGroupId !=''">
+        <if test="classGroupId !=null">
             AND id_ = #{classGroupId}
         </if>
         AND del_flag_ = 0