Ver código fonte

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

zouxuan 5 anos atrás
pai
commit
20b1b66951

+ 14 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java

@@ -4,6 +4,7 @@ import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.TeachModeEnum;
 import com.ym.mec.biz.dal.enums.VipGroupActivityTypeEnum;
+import com.ym.mec.biz.dal.enums.VipGroupStatusEnum;
 import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
 import com.ym.mec.common.constant.CommonConstants;
 import com.ym.mec.common.dal.BaseDAO;
@@ -52,6 +53,15 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 		if(CollectionUtils.isEmpty(vipGroupCourseSchedules)){
 			throw new BizException("未获取到排课信息");
 		}
+
+        int giveClassTimes=0;
+        if(vipGroupApplyBaseInfoDto.getStatus().equals(VipGroupStatusEnum.APPLYING)
+                &&Objects.nonNull(vipGroupActivity)
+                &&vipGroupActivity.getType().equals(VipGroupActivityTypeEnum.GIVE_CLASS)
+                &&vipGroupCourseSchedules.size()>=Integer.parseInt(vipGroupActivity.getAttribute1())){
+            giveClassTimes=Integer.parseInt(vipGroupActivity.getAttribute2());
+        }
+
 		List<CourseScheduleStudentPayment> courseScheduleStudentPayments=new ArrayList<>();
 		Map<TeachModeEnum, List<CourseSchedule>> courseScheduleGroupByTeachMode = vipGroupCourseSchedules.stream().collect(Collectors.groupingBy(CourseSchedule::getTeachMode));
 		for(TeachModeEnum teachModeEnum:courseScheduleGroupByTeachMode.keySet()){
@@ -82,9 +92,8 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 							);
 							break;
 						case GIVE_CLASS:
-							if (vipGroupActivity.getType() == VipGroupActivityTypeEnum.GIVE_CLASS
-									&& vipGroupApplyBaseInfoDto.getGiveTeachMode() == teachModeEnum
-									&& i >= Integer.parseInt(vipGroupActivity.getAttribute1())) {
+							if (vipGroupApplyBaseInfoDto.getGiveTeachMode() == teachModeEnum
+									&& i >= (courseSchedules.size()-giveClassTimes)) {
 								courseScheduleStudentPayment.setExpectPrice(new BigDecimal(0));
 							} else {
 								courseScheduleStudentPayment.setExpectPrice(vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice());
@@ -108,9 +117,8 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 							);
 							break;
 						case GIVE_CLASS:
-							if (vipGroupActivity.getType() == VipGroupActivityTypeEnum.GIVE_CLASS
-									&& vipGroupApplyBaseInfoDto.getGiveTeachMode() == teachModeEnum
-									&& i >= Integer.parseInt(vipGroupActivity.getAttribute1())) {
+							if (vipGroupApplyBaseInfoDto.getGiveTeachMode() == teachModeEnum
+                                    && i >= (courseSchedules.size()-giveClassTimes)) {
 								courseScheduleStudentPayment.setExpectPrice(new BigDecimal(0));
 							} else {
 								courseScheduleStudentPayment.setExpectPrice(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice());