|
@@ -77,6 +77,8 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
|
|
|
private MusicGroupPurchaseListDao musicGroupPurchaseListDao;
|
|
|
@Autowired
|
|
|
private StudentRegistrationDao studentRegistrationDao;
|
|
|
+ @Autowired
|
|
|
+ private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
|
|
|
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
|
|
|
@@ -229,13 +231,12 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public SubjectChange addChange(SubjectChange subjectChange) {
|
|
|
- SubjectChange studentWaitPay = subjectChangeDao.getStudentWaitPay(subjectChange.getStudentId(), subjectChange.getMusicGroupId());
|
|
|
+ String musicGroupId = subjectChange.getMusicGroupId();
|
|
|
+ SubjectChange studentWaitPay = subjectChangeDao.getStudentWaitPay(subjectChange.getStudentId(), musicGroupId);
|
|
|
if (studentWaitPay != null) {
|
|
|
throw new BizException("已有未支付的声部更改,请勿重复创建");
|
|
|
}
|
|
|
|
|
|
- String musicGroupId = subjectChange.getMusicGroupId();
|
|
|
-
|
|
|
Set<String> musicGroupIds = new HashSet<String>();
|
|
|
musicGroupIds.add(musicGroupId);
|
|
|
|
|
@@ -244,6 +245,23 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
|
|
|
throw new BizException("乐器清单已确认,不能做声部更改");
|
|
|
}
|
|
|
|
|
|
+ //判断新声部人数是否已满
|
|
|
+ MusicGroupSubjectPlan changeSubjectPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(musicGroupId, subjectChange.getChangeSubjectId());
|
|
|
+ if (changeSubjectPlan.getExpectedStudentNum() >= changeSubjectPlan.getPaidStudentNum()) {
|
|
|
+ throw new BizException("当前声部人数已满");
|
|
|
+ }
|
|
|
+
|
|
|
+ StudentRegistration studentRegistration = studentRegistrationDao.getStudentRegister(musicGroupId, subjectChange.getStudentId());
|
|
|
+ if(studentRegistration == null){
|
|
|
+ throw new BizException("用户乐团报名信息查询失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(studentRegistration.getNoneNeedCloudTeacher() != null && studentRegistration.getNoneNeedCloudTeacher() == 1){
|
|
|
+ if(changeSubjectPlan.getPaidZeroNum() != null && changeSubjectPlan.getPaidZeroNum() > 0){
|
|
|
+ throw new BizException("声部更换失败,当前用户是0元入团,且当前声部已有0元入团学生");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
Date nowDate = new Date();
|
|
|
SubjectChange studentOriginal = getStudentOriginal(subjectChange.getStudentId(), subjectChange.getMusicGroupId());
|
|
|
if(studentOriginal != null){
|
|
@@ -414,8 +432,10 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
|
|
|
|
|
|
List<Long> paymentOrderIdList = studentPaymentOrderList.stream().map(t -> t.getId()).collect(Collectors.toList());
|
|
|
|
|
|
- List<StudentPaymentOrderDetail> details = studentPaymentOrderDetailDao.getWithIds(paymentOrderIdList);
|
|
|
-
|
|
|
+ List<StudentPaymentOrderDetail> details = new ArrayList<StudentPaymentOrderDetail>();
|
|
|
+ if (paymentOrderIdList != null && paymentOrderIdList.size() > 0) {
|
|
|
+ details = studentPaymentOrderDetailDao.getWithIds(paymentOrderIdList);
|
|
|
+ }
|
|
|
|
|
|
//查询乐器订单
|
|
|
StudentPaymentOrderDetail musicalOrderDetail =null, accessoriesOrderDetail = null;
|