Преглед на файлове

add 储备中进行中可以报名缴费

周箭河 преди 4 години
родител
ревизия
3b4a3cb140

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -1794,4 +1794,11 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
 
     List<CourseSchedule> queryByCourseScheduleIds(Map<String, Object> params);
     int countByCourseScheduleIds(Map<String, Object> params);
+
+    /**
+     * 获取乐团已开始的课程数
+     * @param musicGroupId
+     * @return
+     */
+    Integer getMusicGroupHasStartCourseNum(@Param("musicGroupId") String musicGroupId);
 }

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java

@@ -309,8 +309,16 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
 
     /**
      * 获取
+     *
      * @param calenderIds
      * @return
      */
     List<String> queryMusicGroupIds(@Param("calenderIds") List<Long> calenderIds);
+
+    /**
+     * 获取乐团缴费项的批次数
+     * @param musicGroupId
+     * @return
+     */
+    List<Integer> getMusicGroupCalenderBatchNoTimes(@Param("musicGroupId") String musicGroupId);
 }

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java

@@ -351,4 +351,11 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
      */
     List<StudentRegistration> getMusicGroupStuReBack(String musicGroupId);
 
+
+    /**
+     * 检查乐团是否能报名或缴费
+     * @return
+     */
+    String checkRegOrPayStatus(String musicGroupId);
+
 }

+ 68 - 45
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -21,6 +21,7 @@ import java.util.stream.Collectors;
 import javax.annotation.Resource;
 
 import com.ym.mec.biz.dal.dto.*;
+import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.event.source.GroupEventSource;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -80,19 +81,6 @@ import com.ym.mec.biz.dal.entity.Subject;
 import com.ym.mec.biz.dal.entity.SubjectChange;
 import com.ym.mec.biz.dal.entity.SysUserCashAccount;
 import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
-import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
-import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
-import com.ym.mec.biz.dal.enums.CourseStatusEnum;
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.dal.enums.GoodsType;
-import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
-import com.ym.mec.biz.dal.enums.MessageTypeEnum;
-import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
-import com.ym.mec.biz.dal.enums.OrderTypeEnum;
-import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
-import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
-import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
 import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
 import com.ym.mec.biz.service.ClassGroupService;
 import com.ym.mec.biz.service.ClassGroupStudentMapperService;
@@ -275,7 +263,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public StudentFeeDetailDto queryFeeDetail(Integer studentId, String musicGroupId) {
         StudentFeeDetailDto studentFeeDetailDto = new StudentFeeDetailDto();
         List<MusicalListDetailDto> musicalList = studentPaymentOrderDetailService.getMusicalListDetail(musicGroupId, studentId);
-        if(musicalList.size() <=0){
+        if (musicalList.size() <= 0) {
             return studentFeeDetailDto;
         }
         MusicalListDetailDto detailDto = musicalList.get(0);
@@ -383,11 +371,11 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         studentRegistration.setUpdateTime(date);
         studentRegistration.setUserId(sysUser.getId());
         studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.APPLY);
-        if(hasReg != null){
+        if (hasReg != null) {
             studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
             studentRegistration.setId(hasReg.getId());
             studentRegistrationDao.update(studentRegistration);
-        }else {
+        } else {
             studentRegistrationDao.insert(studentRegistration);
         }
 
@@ -677,7 +665,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             return null;
         }
         SysUserCashAccount account = sysUserCashAccountDao.getLocked(userId);
-        registration.setBalance(account==null?BigDecimal.ZERO : account.getBalance());
+        registration.setBalance(account == null ? BigDecimal.ZERO : account.getBalance());
         registration.setTransferStudent(0);
         return registration;
     }
@@ -841,30 +829,30 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
     @Override
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
-    public void insertStudent(String studentIds,String oldMusicGroupId,String newMusicGroupId,Map<Integer, List<MusicGroupPaymentCalenderStudentDetail>> collect){
+    public void insertStudent(String studentIds, String oldMusicGroupId, String newMusicGroupId, Map<Integer, List<MusicGroupPaymentCalenderStudentDetail>> collect) {
         SysUser sysUser1 = sysUserFeignService.queryUserInfo();
         //获取旧乐团学员注册信息
-        List<StudentRegistration> studentRegistrations = studentRegistrationDao.queryByUserIdsAndMusicGroupId(studentIds,oldMusicGroupId);
+        List<StudentRegistration> studentRegistrations = studentRegistrationDao.queryByUserIdsAndMusicGroupId(studentIds, oldMusicGroupId);
         List<StudentCourseFeeDetail> studentCourseFeeDetails = new ArrayList<>();
         BigDecimal amount = BigDecimal.ZERO;
         for (StudentRegistration studentRegistration : studentRegistrations) {
             List<MusicGroupPaymentCalenderStudentDetail> details = collect.get(studentRegistration.getUserId());
-            BigDecimal masterTotalPrice = details.stream().map(e->e.getCutAmount()).reduce(BigDecimal.ZERO, BigDecimal::add);
-            if(masterTotalPrice.doubleValue() > studentRegistration.getSurplusCourseFee().doubleValue()){
+            BigDecimal masterTotalPrice = details.stream().map(e -> e.getCutAmount()).reduce(BigDecimal.ZERO, BigDecimal::add);
+            if (masterTotalPrice.doubleValue() > studentRegistration.getSurplusCourseFee().doubleValue()) {
                 throw new BizException("用户信息发生变动,请重新提交");
             }
-            if(oldMusicGroupId == newMusicGroupId){
+            if (oldMusicGroupId == newMusicGroupId) {
                 continue;
             }
-            courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(oldMusicGroupId),null, GroupType.MUSIC);
+            courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(oldMusicGroupId), null, GroupType.MUSIC);
             //记录课程余额消费日志
-            if(studentRegistration.getSurplusCourseFee().doubleValue() > 0d && masterTotalPrice.doubleValue() > 0d){
+            if (studentRegistration.getSurplusCourseFee().doubleValue() > 0d && masterTotalPrice.doubleValue() > 0d) {
                 StudentCourseFeeDetail studentCourseFeeDetail = new StudentCourseFeeDetail();
-                if(studentRegistration.getSurplusCourseFee().doubleValue() > masterTotalPrice.doubleValue()){
+                if (studentRegistration.getSurplusCourseFee().doubleValue() > masterTotalPrice.doubleValue()) {
                     amount = masterTotalPrice;
                     studentCourseFeeDetail.setAmount(masterTotalPrice.negate());
                     studentCourseFeeDetail.setSurplusCourseFee(studentRegistration.getSurplusCourseFee().subtract(masterTotalPrice));
-                }else {
+                } else {
                     amount = studentRegistration.getSurplusCourseFee();
                     studentCourseFeeDetail.setAmount(studentRegistration.getSurplusCourseFee().negate());
                     studentCourseFeeDetail.setSurplusCourseFee(BigDecimal.ZERO);
@@ -881,7 +869,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             //用户是否在主乐团
             StudentRegistration registration = studentRegistrationDao.getByPhoneAndMusicGroupId(newMusicGroupId, studentRegistration.getParentsPhone());
             if (registration != null) {
-                if(registration.getMusicGroupStatus() == StudentMusicGroupStatusEnum.NORMAL){
+                if (registration.getMusicGroupStatus() == StudentMusicGroupStatusEnum.NORMAL) {
                     orderFlag = false;
                 }
                 //修改剩余课程余额
@@ -891,7 +879,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 registration.setUpdateTime(date);
                 registration.setSurplusCourseFee(registration.getSurplusCourseFee().add(amount));
                 studentRegistrationDao.update(registration);
-            }else {
+            } else {
                 //生成学员乐团注册表
                 studentRegistration.setOrganId(musicGroupDao.get(newMusicGroupId).getOrganId());
                 studentRegistration.setSurplusCourseFee(amount);
@@ -902,11 +890,11 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 //增加报名学生数
                 musicGroupSubjectPlanService.addApplyStudentNum(newMusicGroupId, studentRegistration.getActualSubjectId(), 1);
                 //新增Fee表
-                MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(studentRegistration.getUserId(),newMusicGroupId);
-                if(musicGroupStudentFee == null){
+                MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(studentRegistration.getUserId(), newMusicGroupId);
+                if (musicGroupStudentFee == null) {
                     musicGroupStudentFee = new MusicGroupStudentFee(newMusicGroupId,
-                            studentRegistration.getUserId(), studentRegistration.getSubjectId(),BigDecimal.ZERO,
-                            null, studentRegistration.getTemporaryCourseFee(), studentRegistration.getPaymentStatus()==YES?PAID_COMPLETED:NON_PAYMENT);
+                            studentRegistration.getUserId(), studentRegistration.getSubjectId(), BigDecimal.ZERO,
+                            null, studentRegistration.getTemporaryCourseFee(), studentRegistration.getPaymentStatus() == YES ? PAID_COMPLETED : NON_PAYMENT);
                     musicGroupStudentFeeDao.insert(musicGroupStudentFee);
                 }
             }
@@ -916,7 +904,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 waitPayOrder.setStatus(DealStatusEnum.CLOSE);
                 studentPaymentOrderService.update(waitPayOrder);
             }
-            if(orderFlag){
+            if (orderFlag) {
                 //生成订单
                 StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
                 studentPaymentOrder.setUserId(registration.getUserId());
@@ -933,7 +921,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrderService.insert(studentPaymentOrder);
             }
             //主班新增余额日志
-            if(amount.doubleValue() != 0d && masterTotalPrice.doubleValue() > 0d){
+            if (amount.doubleValue() != 0d && masterTotalPrice.doubleValue() > 0d) {
                 StudentCourseFeeDetail studentCourseFeeDetail = new StudentCourseFeeDetail();
                 studentCourseFeeDetail.setAmount(amount);
                 studentCourseFeeDetail.setSurplusCourseFee(registration.getSurplusCourseFee());
@@ -943,7 +931,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentCourseFeeDetails.add(studentCourseFeeDetail);
             }
         }
-        if(studentCourseFeeDetails.size() > 0){
+        if (studentCourseFeeDetails.size() > 0) {
             studentCourseFeeDetailDao.batchInsert(studentCourseFeeDetails);
         }
     }
@@ -1435,7 +1423,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     @Override
     @Transactional
     public StudentRegistration updateStudent(StudentRegistration studentRegistration) {
-        if(StringUtils.isBlank(studentRegistration.getCertificateType())){
+        if (StringUtils.isBlank(studentRegistration.getCertificateType())) {
             studentRegistration.setCertificateType(CertificateTypeEnum.IDENTITY.getCode());
         }
         StudentRegistration student = get(studentRegistration.getId());
@@ -1447,9 +1435,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         student.setIdCardNo(studentRegistration.getIdCardNo());
         student.setGender(studentRegistration.getGender());
         update(studentRegistration);
-        studentRegistrationDao.updateUser(student.getUserId(),student.getName(), student.getParentsName(), student.getIdCardNo(), student.getGender(),studentRegistration.getCertificateType());
+        studentRegistrationDao.updateUser(student.getUserId(), student.getName(), student.getParentsName(), student.getIdCardNo(), student.getGender(), studentRegistration.getCertificateType());
         // 添加用户电子签章账户
-        if(CertificateTypeEnum.IDENTITY.getCode().equals(studentRegistration.getCertificateType())){
+        if (CertificateTypeEnum.IDENTITY.getCode().equals(studentRegistration.getCertificateType())) {
             contractService.register(student.getUserId(), student.getParentsName(), student.getIdCardNo(), student.getParentsPhone());
         }
         return student;
@@ -1637,10 +1625,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         return amount;
     }
 
-	@Override
-	public List<StudentMusicGroupDto> queryStudentMusicGroupInfo(Integer userId) {
-		return studentRegistrationDao.queryStudentMusicGroupInfo(userId);
-	}
+    @Override
+    public List<StudentMusicGroupDto> queryStudentMusicGroupInfo(Integer userId) {
+        return studentRegistrationDao.queryStudentMusicGroupInfo(userId);
+    }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -1661,8 +1649,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public Boolean batchDelRegs(String musicGroupId, List<Integer> userIds) {
         List<StudentRegistration> registrations = studentRegistrationDao.findStudentListByUserIdList(musicGroupId, userIds);
         for (StudentRegistration registration : registrations) {
-            if(registration.getPaymentStatus().equals(PaymentStatusEnum.OPEN)||registration.getPaymentStatus().equals(PaymentStatusEnum.YES)){
-                throw new BizException(registration.getName()+"("+registration.getPaymentStatus().getDesc()+"),不能删除");
+            if (registration.getPaymentStatus().equals(PaymentStatusEnum.OPEN) || registration.getPaymentStatus().equals(PaymentStatusEnum.YES)) {
+                throw new BizException(registration.getName() + "(" + registration.getPaymentStatus().getDesc() + "),不能删除");
             }
         }
         if (registrations.size() <= 0) {
@@ -1690,6 +1678,41 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     @Override
     public List<StudentRegistration> getMusicGroupStuReBack(String musicGroupId) {
         courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(musicGroupId), null, GroupType.MUSIC);
-        return this.findMusicGroupStudent(musicGroupId,null);
+        return this.findMusicGroupStudent(musicGroupId, null);
+    }
+
+    @Override
+    public String checkRegOrPayStatus(String musicGroupId) {
+        MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
+        if (musicGroup.getStatus() == MusicGroupStatusEnum.PAY &&
+                musicGroup.getStatus() == MusicGroupStatusEnum.PREPARE &&
+                musicGroup.getStatus() == MusicGroupStatusEnum.PROGRESS) {
+            Date now = new Date();
+            MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroup.getId());
+            if (regCalender != null && regCalender.getDeadlinePaymentDate() != null) {
+                musicGroup.setPaymentExpireDate(regCalender.getDeadlinePaymentDate());
+            }
+            if (musicGroup.getPaymentExpireDate() != null && DateUtil.daysBetween(musicGroup.getPaymentExpireDate(), now) > 1) {
+                return "乐团缴费时间已截止";
+            }
+        }
+        //储备中、进行中,乐团没有报名缴费项、有多批次缴费项不能缴费、有已上的课程不能缴费
+        if (musicGroup.getStatus() == MusicGroupStatusEnum.PREPARE &&
+                musicGroup.getStatus() == MusicGroupStatusEnum.PROGRESS) {
+            MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroup.getId());
+            if (regCalender == null) {
+                return "乐团没有报名缴费项";
+            }
+            List<Integer> musicGroupCalenderBatchNoTimes = musicGroupPaymentCalenderDao.getMusicGroupCalenderBatchNoTimes(musicGroup.getId());
+            if (musicGroupCalenderBatchNoTimes.size() > 1) {
+                return "乐团已建多批次缴费";
+            }
+
+            Integer hasStartCourseNum = courseScheduleDao.getMusicGroupHasStartCourseNum(musicGroup.getId());
+            if (hasStartCourseNum != null && hasStartCourseNum > 0) {
+                return "乐团已开课";
+            }
+        }
+        return null;
     }
 }

+ 7 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -3651,5 +3651,12 @@
         </foreach>
     </select>
 
+    <select id="getMusicGroupHasStartCourseNum" resultType="integer">
+        SELECT COUNT(*) FROM course_schedule
+        WHERE music_group_id_ = #{musicGroupId}
+        AND group_type_='MUSIC'
+        AND status_ IN ('UNDERWAY','OVER')
+    </select>
+
 
 </mapper>

+ 7 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml

@@ -576,4 +576,11 @@
             #{calenderId}
         </foreach>
     </select>
+
+    <select id="getMusicGroupCalenderBatchNoTimes" resultType="java.lang.Integer">
+        SELECT COUNT(*) FROM music_group_payment_calender
+        WHERE music_group_id_ = #{musicGroupId}
+        AND status_ IN ('AUDITING','NO', 'OPEN', 'OVER', 'PAID')
+        GROUP BY batch_no_
+    </select>
 </mapper>

+ 43 - 35
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.student.controller;
 
+import com.ym.mec.biz.dal.dao.CourseScheduleDao;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -69,26 +70,28 @@ public class MusicGroupController extends BaseController {
     private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
     @Autowired
     private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
-    
+
     @Autowired
     private StudentPreRegistrationDao studentPreRegistrationDao;
-    
+    @Autowired
+    private CourseScheduleDao courseScheduleDao;
+
     @ApiOperation("预报名")
     @PostMapping(value = "/preRegister")
-	public Object preRegister(@RequestBody StudentPreRegistration studentPreRegistration) {
-		return musicGroupService.preRegister(studentPreRegistration) ? succeed() : failed();
-	}
-    
+    public Object preRegister(@RequestBody StudentPreRegistration studentPreRegistration) {
+        return musicGroupService.preRegister(studentPreRegistration) ? succeed() : failed();
+    }
+
     @ApiOperation("预报名信息查询")
     @GetMapping(value = "/queryPreRegister")
-	public Object queryPreRegister(String musicGroupId) {
-		SysUser sysUser = sysUserFeignService.queryUserInfo();
-		if (sysUser == null) {
-			return failed(HttpStatus.FORBIDDEN, "请登录");
-		}
+    public Object queryPreRegister(String musicGroupId) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
 
-		return succeed(studentPreRegistrationDao.queryByMusicGroupIdAndUserId(sysUser.getId(), musicGroupId));
-	}
+        return succeed(studentPreRegistrationDao.queryByMusicGroupIdAndUserId(sysUser.getId(), musicGroupId));
+    }
 
     @ApiOperation("获取学生所在乐团列表")
     @GetMapping(value = "/queryUserMusicGroups")
@@ -99,7 +102,7 @@ public class MusicGroupController extends BaseController {
         }
         return succeed(musicGroupService.queryUserMusicGroups(sysUser.getId()));
     }
-    
+
     @ApiOperation("获取学生所在乐团列表")
     @GetMapping(value = "/queryStudentMusicGroupInfo")
     public Object queryStudentMusicGroupInfo() {
@@ -168,31 +171,26 @@ public class MusicGroupController extends BaseController {
             return failed(HttpStatus.CONTINUE, "乐团报名信息不存在");
         }
         if (studentRegistration.getPaymentStatus() != null && studentRegistration.getPaymentStatus() == PaymentStatusEnum.YES) {
-            return failed(HttpStatus.PROCESSING,"您已缴费,请等待乐团开启");
+            return failed(HttpStatus.PROCESSING, "您已缴费,请等待乐团开启");
         }
 
         if (studentRegistration.getPaymentStatus() != PaymentStatusEnum.OPEN) {
             return failed("乐团还未开启缴费,请等待通知");
         }
-        if (studentRegistration.getTemporaryCourseFee() == null) {
-            if (musicGroup.getStatus() != MusicGroupStatusEnum.APPLY && musicGroup.getStatus() != MusicGroupStatusEnum.PAY) {
-                return failed("乐团在" + musicGroup.getStatus().getMsg() + ",不能缴费");
-            }
-
-            if (musicGroup.getStatus() == MusicGroupStatusEnum.PAY) {
-                Date now = new Date();
-                MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroupId);
-                if (regCalender != null && regCalender.getDeadlinePaymentDate() != null) {
-                    musicGroup.setPaymentExpireDate(regCalender.getDeadlinePaymentDate());
-                }
-                if (musicGroup.getPaymentExpireDate() != null && DateUtil.daysBetween(musicGroup.getPaymentExpireDate(), now) > 1) {
-                    return failed("乐团缴费时间已截止");
-                }
-            }
+        if (musicGroup.getStatus() != MusicGroupStatusEnum.APPLY &&
+                musicGroup.getStatus() != MusicGroupStatusEnum.PAY &&
+                musicGroup.getStatus() != MusicGroupStatusEnum.PREPARE &&
+                musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS
+        ) {
+            return failed("乐团在" + musicGroup.getStatus().getMsg() + ",不能缴费");
+        }
+        String err = studentRegistrationService.checkRegOrPayStatus(musicGroupId);
+        if(err != null){
+            return failed(err+"不能缴费");
         }
         studentRegistration.setOwnershipType(musicGroup.getOwnershipType());
         studentRegistration.setChargeTypeId(musicGroup.getChargeTypeId());
-        if(sysUser != null){
+        if (sysUser != null) {
             studentRegistration.setGender(sysUser.getGender());
         }
 
@@ -246,7 +244,7 @@ public class MusicGroupController extends BaseController {
     @ApiOperation(value = "申请退团")
     @PostMapping("/quitMusicGroup")
     @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团id", required = true, dataType = "String"),
-    	@ApiImplicitParam(name = "reason", value = "原因", required = true, dataType = "String")})
+            @ApiImplicitParam(name = "reason", value = "原因", required = true, dataType = "String")})
     public HttpResponseResult quitMusicGroup(String musicGroupId, String reason) throws Exception {
         return succeed(musicGroupService.applyQuitMusicGroup(musicGroupId, reason));
     }
@@ -254,11 +252,11 @@ public class MusicGroupController extends BaseController {
     @ApiOperation(value = "取消退团申请")
     @PostMapping("/cancelQuitMusicGroup")
     @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团id", required = true, dataType = "String"),
-    	@ApiImplicitParam(name = "reason", value = "取消原因", required = true, dataType = "String")})
+            @ApiImplicitParam(name = "reason", value = "取消原因", required = true, dataType = "String")})
     public HttpResponseResult cancelQuitMusicGroup(String musicGroupId, String reason) throws Exception {
-    	SysUser sysUser = sysUserFeignService.queryUserInfo();
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
         Integer userId = sysUser.getId();
-        
+
         return succeed(musicGroupService.cancelQuitMusicGroup(userId, musicGroupId, reason));
     }
 
@@ -288,6 +286,11 @@ public class MusicGroupController extends BaseController {
             return failed("报名信息有误,请核查");
         }
 
+        String err = studentRegistrationService.checkRegOrPayStatus(studentRegistration.getMusicGroupId());
+        if(err !=null){
+            return failed(err+"不能缴费");
+        }
+
         Integer userId = studentRegistration.getUserId();
 
         StudentPaymentOrder ApplyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.SUCCESS);
@@ -315,6 +318,11 @@ public class MusicGroupController extends BaseController {
         if (studentRegistration == null) {
             return failed("报名信息有误,请核查");
         }
+
+        String err = studentRegistrationService.checkRegOrPayStatus(studentRegistration.getMusicGroupId());
+        if(err !=null){
+            return failed(err+"不能缴费");
+        }
         Integer userId = studentRegistration.getUserId();
         StudentPaymentOrder ApplyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.SUCCESS);
         StudentPaymentOrder waitPay = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);

+ 12 - 0
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupRegisterController.java

@@ -2,7 +2,10 @@ 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.CourseScheduleDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
 import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
 import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
@@ -26,6 +29,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.io.IOException;
 import java.util.Date;
+import java.util.List;
 
 @RequestMapping("register")
 @Api(tags = "乐团注册")
@@ -40,6 +44,10 @@ public class MusicGroupRegisterController extends BaseController {
     private MusicGroupService musicGroupService;
     @Autowired
     private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
+    @Autowired
+    private CourseScheduleDao courseScheduleDao;
 
 
     @ApiOperation(value = "新增学生报名信息")
@@ -69,6 +77,10 @@ public class MusicGroupRegisterController extends BaseController {
         if (hasReg != null && hasReg.getMusicGroupStatus() != StudentMusicGroupStatusEnum.QUIT) {
             return succeed(hasReg);
         }
+        String err = studentRegistrationService.checkRegOrPayStatus(musicGroup.getId());
+        if(err != null){
+            return failed(err+",不能报名");
+        }
 
         if (musicGroup.getStatus().equals(MusicGroupStatusEnum.PAY)) {
             studentRegistration.setPaymentStatus(PaymentStatusEnum.OPEN);