|  | @@ -3,6 +3,7 @@ package com.ym.mec.student.controller;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dao.OrganizationDao;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.*;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.*;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.CourseScheduleDao;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.ApiImplicitParam;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.ApiImplicitParams;
 | 
	
	
		
			
				|  | @@ -60,28 +61,31 @@ public class MusicGroupController extends BaseController {
 | 
	
		
			
				|  |  |      private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private StudentPreRegistrationDao studentPreRegistrationDao;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private OrganizationService organizationService;
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @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")
 | 
	
	
		
			
				|  | @@ -92,7 +96,7 @@ public class MusicGroupController extends BaseController {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return succeed(musicGroupService.queryUserMusicGroups(sysUser.getId()));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @ApiOperation("获取学生所在乐团列表")
 | 
	
		
			
				|  |  |      @GetMapping(value = "/queryStudentMusicGroupInfo")
 | 
	
		
			
				|  |  |      public Object queryStudentMusicGroupInfo() {
 | 
	
	
		
			
				|  | @@ -161,31 +165,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());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -239,7 +238,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));
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -247,11 +246,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));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -281,6 +280,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);
 | 
	
	
		
			
				|  | @@ -308,6 +312,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);
 |