|
@@ -2,15 +2,14 @@ package com.ym.mec.student.controller;
|
|
|
|
|
|
import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.ADD_STUDENT;
|
|
|
import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY;
|
|
|
+
|
|
|
+import com.ym.mec.biz.service.*;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -52,12 +51,6 @@ import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.OrderTypeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.PayStatus;
|
|
|
import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
|
|
|
-import com.ym.mec.biz.service.MusicGroupService;
|
|
|
-import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
|
|
|
-import com.ym.mec.biz.service.OrganizationService;
|
|
|
-import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
|
|
|
-import com.ym.mec.biz.service.StudentPaymentOrderService;
|
|
|
-import com.ym.mec.biz.service.StudentRegistrationService;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
@@ -82,7 +75,7 @@ public class MusicGroupController extends BaseController {
|
|
|
@Autowired
|
|
|
private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
|
|
|
@Autowired
|
|
|
- private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
|
|
|
+ private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
|
|
|
@Autowired
|
|
|
private StudentPreRegistrationDao studentPreRegistrationDao;
|
|
|
@Autowired
|
|
@@ -169,41 +162,57 @@ public class MusicGroupController extends BaseController {
|
|
|
if (sysUser != null && Objects.nonNull(sysUser.getId())) {
|
|
|
userId = sysUser.getId();
|
|
|
}
|
|
|
-
|
|
|
StudentRegistration studentRegistration = studentRegistrationService.queryByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
|
if (studentRegistration == null) {
|
|
|
return failed(HttpStatus.CONTINUE, "乐团报名信息不存在");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 判断是否可以继续购买
|
|
|
List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.findUserApplyOrder(userId, musicGroupId, DealStatusEnum.SUCCESS);
|
|
|
+
|
|
|
if(studentPaymentOrderDetailList != null && studentPaymentOrderDetailList.size() > 0){
|
|
|
- List<OrderDetailTypeEnum> typeList = studentPaymentOrderDetailList.stream().map(t -> t.getType()).collect(Collectors.toList());
|
|
|
- //判断是否所有类型都购买完
|
|
|
- if (musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE) {
|
|
|
- if (typeList.contains(OrderDetailTypeEnum.MUSICAL) && typeList.contains(OrderDetailTypeEnum.ACCESSORIES)
|
|
|
- && (typeList.contains(OrderDetailTypeEnum.CLOUD_TEACHER) || typeList.contains(OrderDetailTypeEnum.CLOUD_TEACHER_PLUS))) {
|
|
|
- return failed(HttpStatus.PROCESSING, "您已缴费,请等待乐团开启");
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (typeList.contains(OrderDetailTypeEnum.MUSICAL)
|
|
|
- && typeList.contains(OrderDetailTypeEnum.ACCESSORIES)
|
|
|
- && (typeList.contains(OrderDetailTypeEnum.CLOUD_TEACHER) || typeList.contains(OrderDetailTypeEnum.CLOUD_TEACHER_PLUS) || typeList.contains(OrderDetailTypeEnum.COURSE)
|
|
|
- || typeList.contains(OrderDetailTypeEnum.HIGH_ONLINE_COURSE) || typeList.contains(OrderDetailTypeEnum.SINGLE)
|
|
|
- || typeList.contains(OrderDetailTypeEnum.MIX) || typeList.contains(OrderDetailTypeEnum.HIGH)
|
|
|
- || typeList.contains(OrderDetailTypeEnum.VIP) || typeList.contains(OrderDetailTypeEnum.DEMO)
|
|
|
- || typeList.contains(OrderDetailTypeEnum.COMPREHENSIVE) || typeList.contains(OrderDetailTypeEnum.ENLIGHTENMENT)
|
|
|
- || typeList.contains(OrderDetailTypeEnum.TRAINING_SINGLE) || typeList.contains(OrderDetailTypeEnum.TRAINING_MIX)
|
|
|
- || typeList.contains(OrderDetailTypeEnum.HIGH_ONLINE) || typeList.contains(OrderDetailTypeEnum.MUSIC_NETWORK) || typeList
|
|
|
- .contains(OrderDetailTypeEnum.CLASSROOM))) {
|
|
|
- return failed(HttpStatus.PROCESSING, "您已缴费,请等待乐团开启");
|
|
|
- }
|
|
|
- }
|
|
|
+ List<OrderDetailTypeEnum> typeList = studentPaymentOrderDetailList.stream().map(t -> t.getType()).collect(Collectors.toList());
|
|
|
+ //如果乐器和辅件都买过/那么看是否购买过其他的缴费项
|
|
|
+ if (typeList.contains(OrderDetailTypeEnum.MUSICAL) && typeList.contains(OrderDetailTypeEnum.ACCESSORIES)) {
|
|
|
+ MusicGroupPaymentCalender paymentCalender = musicGroupPaymentCalenderService.getApplyCalenderByMusicId(musicGroupId);
|
|
|
+ HashMap<String, Object> calenderDetail = new HashMap<>(4);
|
|
|
+ musicGroupPaymentCalenderService.getCalenderDetail(calenderDetail,paymentCalender.getId());
|
|
|
+ boolean flag = false;
|
|
|
+ //是否购买乐团课
|
|
|
+ if(Objects.nonNull(calenderDetail.get("course"))){
|
|
|
+ if(typeList.contains(OrderDetailTypeEnum.COURSE)
|
|
|
+ || typeList.contains(OrderDetailTypeEnum.HIGH_ONLINE_COURSE) || typeList.contains(OrderDetailTypeEnum.SINGLE)
|
|
|
+ || typeList.contains(OrderDetailTypeEnum.MIX) || typeList.contains(OrderDetailTypeEnum.HIGH)
|
|
|
+ || typeList.contains(OrderDetailTypeEnum.DEMO) || typeList.contains(OrderDetailTypeEnum.CLASSROOM)
|
|
|
+ || typeList.contains(OrderDetailTypeEnum.COMPREHENSIVE) || typeList.contains(OrderDetailTypeEnum.ENLIGHTENMENT)
|
|
|
+ || typeList.contains(OrderDetailTypeEnum.TRAINING_SINGLE) || typeList.contains(OrderDetailTypeEnum.TRAINING_MIX)
|
|
|
+ || typeList.contains(OrderDetailTypeEnum.HIGH_ONLINE) || typeList.contains(OrderDetailTypeEnum.MUSIC_NETWORK)){
|
|
|
+ flag = true;
|
|
|
+ }else {
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //是否购买会员
|
|
|
+ if(Objects.nonNull(calenderDetail.get("member"))){
|
|
|
+ if(typeList.contains(OrderDetailTypeEnum.CLOUD_TEACHER) || typeList.contains(OrderDetailTypeEnum.CLOUD_TEACHER_PLUS)){
|
|
|
+ flag = true;
|
|
|
+ }else {
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //是否购买活动包
|
|
|
+ if(Objects.nonNull(calenderDetail.get("activity"))){
|
|
|
+ if(typeList.contains(OrderDetailTypeEnum.VIP) || typeList.contains(OrderDetailTypeEnum.PRACTICE)){
|
|
|
+ flag = true;
|
|
|
+ }else {
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(flag){
|
|
|
+ return failed(HttpStatus.PROCESSING, "您已缴费,请等待乐团开启");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- /*if (studentRegistration.getPaymentStatus() != null && studentRegistration.getPaymentStatus() == PaymentStatusEnum.YES) {
|
|
|
-
|
|
|
- }*/
|
|
|
|
|
|
if (studentRegistration.getPaymentStatus() == PaymentStatusEnum.NO) {
|
|
|
return failed("乐团还未开启缴费,请等待通知");
|
|
@@ -285,26 +294,7 @@ public class MusicGroupController extends BaseController {
|
|
|
if(calenderId == null){
|
|
|
throw new BizException("参数校验失败");
|
|
|
}
|
|
|
- MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(calenderId);
|
|
|
- if (renewParamDto.getRepeatPay() == false) {
|
|
|
- MusicGroupPaymentCalender.PaymentType paymentType = calender.getPaymentType();
|
|
|
- OrderTypeEnum type = paymentType== ADD_STUDENT?OrderTypeEnum.ADD_STUDENT:paymentType == MUSIC_APPLY?OrderTypeEnum.APPLY:OrderTypeEnum.RENEW;
|
|
|
- // 判断是否存在支付中的记录
|
|
|
- List<StudentPaymentOrder> list = studentPaymentOrderService.queryByCondition(GroupType.MUSIC, calender.getMusicGroupId(), userId, DealStatusEnum.ING,
|
|
|
- type);
|
|
|
- if (list != null && list.size() > 0) {
|
|
|
- for (StudentPaymentOrder order : list) {
|
|
|
- // 查询订单状态
|
|
|
- PayStatus payStatus = studentPaymentOrderService.queryPayStatus(order.getPaymentChannel(), order.getOrderNo(), order.getTransNo());
|
|
|
- if(payStatus == PayStatus.SUCCESSED){
|
|
|
- throw new BizException("订单已支付成功,请勿重复支付");
|
|
|
- }/*else if(payStatus == PayStatus.PAYING){
|
|
|
- throw new BizException("订单还在交易中,请稍后重试");
|
|
|
- }*/
|
|
|
- return failed(HttpStatus.CONTINUE, "您有待支付的订单");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ MusicGroupPaymentCalender calender = musicGroupPaymentCalenderService.get(calenderId);
|
|
|
MusicGroupPaymentCalenderDetail calenderDetail = musicGroupPaymentCalenderDetailDao.findByCalenderIdAndUserId(calenderId, userId);
|
|
|
if (calenderDetail == null) {
|
|
|
throw new BizException("缴费项不存在该学员,请联系教务老师");
|
|
@@ -313,19 +303,14 @@ public class MusicGroupController extends BaseController {
|
|
|
throw new BizException("您已缴费,请勿重复提交");
|
|
|
}
|
|
|
//缴费项目已开启或者单独开启
|
|
|
- Map renew;
|
|
|
if (calender.getStatus() == PaymentCalenderStatusEnum.OPEN || calenderDetail.getOpen() == 1) {
|
|
|
renewParamDto.setUserId(userId);
|
|
|
- renew = musicGroupService.renew(renewParamDto);
|
|
|
+ return musicGroupService.renew(renewParamDto);
|
|
|
} else if (calender.getStatus() == PaymentCalenderStatusEnum.OVER) {
|
|
|
throw new BizException("缴费已截止,如有问题请联系指导老师");
|
|
|
} else {
|
|
|
throw new BizException("缴费暂未开始,如有问题请联系指导老师");
|
|
|
}
|
|
|
- if (renew.containsKey("tradeState")) {
|
|
|
- return failed(HttpStatus.CREATED, renew, "恭喜您,缴费成功!");
|
|
|
- }
|
|
|
- return succeed(renew);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "乐团报名支付")
|