|
@@ -0,0 +1,87 @@
|
|
|
+package com.ym.mec.student.controller;
|
|
|
+
|
|
|
+import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
+import com.ym.mec.auth.api.entity.SysUser;
|
|
|
+import com.ym.mec.biz.dal.dao.*;
|
|
|
+import com.ym.mec.biz.dal.dto.RegisterPayDto;
|
|
|
+import com.ym.mec.biz.dal.entity.*;
|
|
|
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
|
|
|
+import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
|
|
|
+import com.ym.mec.biz.dal.enums.*;
|
|
|
+import com.ym.mec.biz.service.*;
|
|
|
+import com.ym.mec.common.controller.BaseController;
|
|
|
+import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
+import com.ym.mec.common.exception.BizException;
|
|
|
+import com.ym.mec.util.date.DateUtil;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
+import org.springframework.ui.ModelMap;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+@RequestMapping("musicGroupPaymentCalender")
|
|
|
+@Api(tags = "乐团缴费项目服务")
|
|
|
+@RestController
|
|
|
+public class MusicGroupPaymentCalenderController extends BaseController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private SysUserFeignService sysUserFeignService;
|
|
|
+ @Autowired
|
|
|
+ private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
|
|
|
+ @Autowired
|
|
|
+ private StudentRegistrationService studentRegistrationService;
|
|
|
+ @Autowired
|
|
|
+ private MusicGroupDao musicGroupDao;
|
|
|
+ @Autowired
|
|
|
+ private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
|
|
|
+ @Autowired
|
|
|
+ private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询学员缴费详情")
|
|
|
+ @GetMapping("/getCalenderInfo")
|
|
|
+ @ApiImplicitParams({@ApiImplicitParam(name = "calenderId", value = "缴费项目编号", required = true, dataType = "Long")})
|
|
|
+ public HttpResponseResult getCalenderInfo(Long calenderId){
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ Integer userId = sysUser.getId();
|
|
|
+ MusicGroupPaymentCalender calender = musicGroupPaymentCalenderService.get(calenderId);
|
|
|
+ if (calender == null) {
|
|
|
+ return failed("缴费项目不存在");
|
|
|
+ }
|
|
|
+ String musicGroupId = calender.getMusicGroupId();
|
|
|
+ MusicGroupPaymentCalenderDetail calenderDetail = musicGroupPaymentCalenderDetailDao.findByCalenderIdAndUserId(calenderId, userId);
|
|
|
+ if (calenderDetail == null) {
|
|
|
+ throw new BizException("缴费项不存在该学员,请联系教务老师");
|
|
|
+ }
|
|
|
+ if(calenderDetail.getPaymentStatus() == PaymentStatus.PAID_COMPLETED){
|
|
|
+ throw new BizException("当前缴费项已缴费");
|
|
|
+ }else if(calenderDetail.getPaymentStatus() == PaymentStatus.PROCESSING){
|
|
|
+ throw new BizException("当前缴费项存在待处理的订单,请稍候尝试");
|
|
|
+ }
|
|
|
+ if(calender.getStatus() == PaymentCalenderStatusEnum.OPEN){
|
|
|
+ StudentRegistration studentRegistration = studentRegistrationService.queryByUserIdAndMusicGroupId(userId,musicGroupId);
|
|
|
+ if (studentRegistration == null) {
|
|
|
+ return failed("乐团报名信息找不到");
|
|
|
+ }
|
|
|
+ List<MusicGroupPaymentCalenderCourseSettings> calenderCourseSettings = musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(calenderId);
|
|
|
+ ModelMap model = new ModelMap();
|
|
|
+ model.put("musicGroup",musicGroupDao.get(musicGroupId));
|
|
|
+ model.put("amount", calenderDetail.getExpectAmount());
|
|
|
+ model.put("calenderCourseSettings", calenderCourseSettings);
|
|
|
+ model.put("balance",studentRegistration.getBalance());
|
|
|
+ return succeed(model);
|
|
|
+ }else if(calender.getStatus() == PaymentCalenderStatusEnum.OVER){
|
|
|
+ throw new BizException("当前缴费项时间已截止,如有问题请联系指导老师");
|
|
|
+ }else {
|
|
|
+ throw new BizException("当前缴费项未开始,如有问题请联系指导老师");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|