Ver código fonte

Merge branch 'feature/0529-live' of http://git.dayaedu.com/yonge/mec into feature/0529-live

liujc 2 anos atrás
pai
commit
8d1af2c07d

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupDao.java

@@ -871,4 +871,6 @@ public interface ClassGroupDao extends BaseDAO<Integer, ClassGroup> {
     List<ClassGroup> getClassGroupByMusicIds(@Param("musicGroupIds") List<String> musicGroupIds);
 
     void modifyStudentNum(@Param("classGroupId") Integer classGroupId, @Param("num") int num);
+
+    boolean checkStudentNum(@Param("classGroupId") Integer classGroupId);
 }

+ 0 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java

@@ -971,9 +971,6 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
         if (repeatPay == false && payStatus == PayStatus.PAYING) {
             return BaseController.failed(HttpStatus.CONTINUE, "您有支付中的订单,是否继续支付");
         }
-        /*if (!repeatPay) {
-            return BaseController.failed(HttpStatus.CONTINUE, "您有待支付的订单,是否继续支付");
-        }*/
         //处理关闭订单
         order.setStatus(DealStatusEnum.CLOSE);
         order.setMemo("关闭订单");

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

@@ -2665,36 +2665,32 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
                 classGroupDao.modifyStudentNum(classGroup.getId(),-1);
             }
         }
-
         Date date = new Date();
 
-        if (groupType == VIP && classGroup.getStudentNum() >= classGroup.getExpectStudentNum()) {
-            throw new BizException("该课程组人数已满,请联系教务老师!");
-        }
-
         VipGroupActivity vipGroupActivity = null;
         if (Objects.nonNull(vipGroup.getVipGroupActivityId())) {
             vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId());
         }
-
         if (Objects.nonNull(vipGroupActivity) && Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes()) && vipGroupActivity.getStudentMaxUsedTimes() != -1) {
             int useNum = activityUserMapperService.countActivityBuyNum(vipGroupActivity.getId(), userId);
             if (useNum >= vipGroupActivity.getStudentMaxUsedTimes()) {
                 throw new BizException("您已超过该活动购买限制{}次", vipGroupActivity.getStudentMaxUsedTimes());
             }
         }
-
         if (vipGroup.getPaymentExpireDate().before(date)) {
             throw new BizException("该课程已结束报名!");
         }
-
         if (groupType == VIP && Objects.nonNull(vipGroup.getStudentIdList())) {
             Set<Integer> userIds = Arrays.asList(vipGroup.getStudentIdList().split(",")).stream().mapToInt(Integer::parseInt).boxed().collect(Collectors.toSet());
             if (!userIds.contains(userId)) {
                 throw new BizException("您无法购买此课程");
             }
         }
+
         if(groupType == GroupType.VIP){
+            if (classGroupDao.checkStudentNum(classGroup.getId())) {
+                throw new BizException("该课程组人数已满,请联系教务老师!");
+            }
             //增加学员数
             classGroupDao.modifyStudentNum(classGroup.getId(),1);
         }

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

@@ -1688,4 +1688,7 @@
         </foreach>
         AND cg.del_flag_ = 0
     </select>
+    <select id="checkStudentNum" resultType="java.lang.Boolean">
+        select student_num_ >= expect_student_num_ from class_group where id_ = #{classGroupId}
+    </select>
 </mapper>