Browse Source

活动排课

zouxuan 3 years ago
parent
commit
72789f1ede

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/VipGroupBuyParamsDto.java

@@ -23,7 +23,7 @@ public class VipGroupBuyParamsDto {
     private boolean isUseBalancePayment;
 
     @ApiModelProperty(value = "是否重新支付")
-    private boolean isRepeatPay;
+    private boolean isRepeatPay = false;
 
     @ApiModelProperty(value = "优惠券列表", required = false)
     private List<Integer> couponIdList;

+ 7 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -244,12 +244,14 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 		//获取活动信息
 		VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupApplyBaseInfo().getVipGroupActivityId());
-		if(!vipGroup.getAllowOverstepActivityStudentNum()&&Objects.nonNull(vipGroupActivity)&&Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes())&&vipGroupActivity.getStudentMaxUsedTimes()!=-1&&StringUtils.isNotBlank(vipGroupApplyBaseInfoDto.getStudentIdList())){
+		if(!vipGroup.getAllowOverstepActivityStudentNum() && Objects.nonNull(vipGroupActivity)
+				&& Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes()) && vipGroupActivity.getStudentMaxUsedTimes()!=-1 &&
+				StringUtils.isNotBlank(vipGroupApplyBaseInfoDto.getStudentIdList())){
 			List<String> tempStudentIds = Arrays.asList(vipGroupApplyBaseInfoDto.getStudentIdList().split(","));
 			List<Integer> errStudentIds = new ArrayList<>();
 			for (String studentIdStr : tempStudentIds) {
 				int useNum = vipGroupDao.countStudentUserActivityNum(vipGroup.getVipGroupApplyBaseInfo().getVipGroupActivityId(), Integer.valueOf(studentIdStr));
-				if(useNum>=vipGroupActivity.getStudentMaxUsedTimes()){
+				if(useNum >= vipGroupActivity.getStudentMaxUsedTimes()){
 					errStudentIds.add(Integer.valueOf(studentIdStr));
 				}
 			}
@@ -257,7 +259,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				List<SimpleUserDto> students = teacherDao.getUsersSimpleInfo(errStudentIds);
 				TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
 				String studentNames = StringUtils.join(students.stream().map(SimpleUserDto::getNickName).collect(Collectors.toList()), "、");
-				return BaseController.failed(HttpStatus.PARTIAL_CONTENT,"该活动"+studentNames+"学员创建及成课之和已达上限,是否继续创建该课程?");
+				return BaseController.failed(HttpStatus.PARTIAL_CONTENT,"该活动"+studentNames+"学员已超过该活动购买次数限制");
 			}
 		}
 		//判断课程安排是否超出范围
@@ -2576,7 +2578,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				throw new BizException("订单还在交易中,请稍后重试");
 			}
 			if(!vipGroupBuyParams.isRepeatPay()){
-				return BaseController.failed(HttpStatus.CONTINUE, "您有待支付的订单");
+				return BaseController.failed(HttpStatus.CONTINUE, "您有待支付的订单,是否继续支付");
 			}
 			//处理关闭订单
 			applyOrder.setStatus(DealStatusEnum.CLOSE);
@@ -2823,7 +2825,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 						if (i == 0) {
 							courseScheduleStudentPayment.setExpectPrice(firstAmount);
 						}else{
-							courseScheduleStudentPayment.setExpectPrice(actualPrice);
+							courseScheduleStudentPayment.setExpectPrice(divide);
 						}
 						courseScheduleStudentPayment.setOriginalPrice(TeachModeEnum.ONLINE.equals(courseSchedule.getTeachMode())?vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice():vipGroupDefaultClassesUnitPrice.getOfflineClassesUnitPrice());
 						courseScheduleStudentPayment.setActualPrice(courseScheduleStudentPayment.getExpectPrice());

+ 5 - 0
mec-student/src/main/java/com/ym/mec/student/controller/StudentVipGroupController.java

@@ -102,6 +102,11 @@ public class StudentVipGroupController extends BaseController {
     @PostMapping("/buyVipGroup")
     @AuditLogAnnotation(operateName = "vip课购买")
     public Object buyVipGroup(VipGroupBuyParamsDto vipGroupBuyParams) throws Exception {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (null == sysUser) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        vipGroupBuyParams.setUserId(sysUser.getId());
         return vipGroupService.buyVipGroup(vipGroupBuyParams);
     }