|
@@ -42,36 +42,36 @@ public class MusicGroupRegisterController extends BaseController {
|
|
|
@ApiOperation(value = "新增学生报名信息")
|
|
|
@PostMapping("/add")
|
|
|
public HttpResponseResult add(@RequestBody StudentRegistration studentRegistration) throws Exception {
|
|
|
-
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
if (sysUser == null) {
|
|
|
return failed("用户信息获取失败");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
Date date = new Date();
|
|
|
MusicGroup musicGroup = musicGroupService.get(studentRegistration.getMusicGroupId());
|
|
|
if (musicGroup == null) {
|
|
|
return failed("乐团信息不存在");
|
|
|
}
|
|
|
-
|
|
|
- if (DateUtil.daysBetween(musicGroup.getApplyExpireDate(),date) > 1) {
|
|
|
+
|
|
|
+ if (DateUtil.daysBetween(musicGroup.getApplyExpireDate(), date) > 1 && studentRegistration.getId() == null) {
|
|
|
return failed("乐团已截止报名");
|
|
|
}
|
|
|
-
|
|
|
- if(studentRegistration.getId() != null){
|
|
|
- return succeed(studentRegistrationService.updateStudent(studentRegistration));
|
|
|
+
|
|
|
+ if (studentRegistration.getId() != null) {
|
|
|
+ return succeed(studentRegistrationService.updateStudent(studentRegistration));
|
|
|
}
|
|
|
|
|
|
if (musicGroup.getStatus().equals(MusicGroupStatusEnum.PAY)) {
|
|
|
studentRegistration.setPaymentStatus(PaymentStatusEnum.OPEN);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
studentRegistration.setPaymentStatus(PaymentStatusEnum.NO);
|
|
|
}
|
|
|
-
|
|
|
- if(studentRegistration.getUserId() == null){
|
|
|
- studentRegistration.setUserId(sysUser.getId());
|
|
|
+
|
|
|
+ if (studentRegistration.getUserId() == null) {
|
|
|
+ studentRegistration.setUserId(sysUser.getId());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
studentRegistration.setOrganId(musicGroup.getOrganId());
|
|
|
return succeed(studentRegistrationService.addStudent(studentRegistration));
|
|
|
}
|