|
@@ -77,7 +77,7 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
Student student = studentDao.getLocked(degreeRegistration.getUserId());
|
|
|
|
|
|
degreeRegistration.setActivityTag(ACTIVITY_TAG);
|
|
|
- DegreeRegistration degree = degreeRegistrationDao.getWithSubjectAndLevel(degreeRegistration);
|
|
|
+ DegreeRegistration degree = degreeRegistrationDao.getWithLevel(degreeRegistration);
|
|
|
|
|
|
Date nowDate = new Date();
|
|
|
|
|
@@ -85,7 +85,7 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
|
|
|
//获取收费项价格
|
|
|
SporadicChargeInfo chargeInfo = null;
|
|
|
- if(Objects.nonNull(degreeRegistration.getSporadicId())&&Objects.nonNull(degreeRegistration.getTheoryLevel())){
|
|
|
+ if(Objects.nonNull(degreeRegistration.getSporadicId())){
|
|
|
chargeInfo = sporadicChargeInfoDao.get(degreeRegistration.getSporadicId());
|
|
|
if (chargeInfo == null || chargeInfo.getDelFlag().equals(1) || chargeInfo.getOpenFlag().equals(1)) {
|
|
|
throw new BizException("你选的考试级别不存在");
|
|
@@ -95,9 +95,13 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
&& StringUtils.isBlank(degreeRegistration.getTheoryCert())) {
|
|
|
throw new BizException("报考级别为“" + chargeInfo.getTitle() + "”且乐理级别是“免考”时,必须上传证书");
|
|
|
}
|
|
|
-
|
|
|
- degreeRegistration.setActivityTag(ACTIVITY_TAG);
|
|
|
degreeRegistration.setLevel(chargeInfo.getTitle());
|
|
|
+ degreeRegistration.setMoney(chargeInfo.getAmount());
|
|
|
+ }else{
|
|
|
+ degreeRegistration.setMoney(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(Objects.nonNull(degreeRegistration.getTheoryLevel())){
|
|
|
degreeRegistration.setOrderNo(orderNo);
|
|
|
BigDecimal theoryMoney = BigDecimal.ZERO;
|
|
|
switch (degreeRegistration.getTheoryLevel()) {
|
|
@@ -119,8 +123,12 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
throw new BizException("您选择的乐理级别不存在,请核对");
|
|
|
}
|
|
|
degreeRegistration.setTheoryMoney(theoryMoney);
|
|
|
+ }else{
|
|
|
+ degreeRegistration.setTheoryMoney(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(Objects.nonNull(degreeRegistration.getSporadicId())||Objects.nonNull(degreeRegistration.getTheoryLevel())){
|
|
|
if (degree == null) {
|
|
|
- degreeRegistration.setMoney(chargeInfo.getAmount());
|
|
|
degreeRegistration.setStatus(1);
|
|
|
degreeRegistration.setCreateTime(nowDate);
|
|
|
degreeRegistration.setUpdateTime(nowDate);
|
|
@@ -148,9 +156,6 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
degreeRegistration.setUpdateTime(nowDate);
|
|
|
degreeRegistrationDao.update(degreeRegistration);
|
|
|
}
|
|
|
- }else{
|
|
|
- degreeRegistration.setMoney(BigDecimal.ZERO);
|
|
|
- degreeRegistration.setTheoryMoney(BigDecimal.ZERO);
|
|
|
}
|
|
|
|
|
|
BigDecimal additionCoursePrice = new BigDecimal("0");
|
|
@@ -160,6 +165,29 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
if(Objects.isNull(practiceGroupSellPrice)){
|
|
|
throw new BizException("该分部暂未参与此活动");
|
|
|
}
|
|
|
+
|
|
|
+ List<StudentPaymentOrderDetail> historyOrderDetails = studentPaymentOrderDetailDao.getWithUserAndOrderType(degreeRegistration.getUserId(), OrderTypeEnum.DEGREE_REGISTRATION);
|
|
|
+ int historyVipNum = 0, historyPracticeNum = 0, historyHighNum = 0;
|
|
|
+ for (StudentPaymentOrderDetail historyOrderDetail : historyOrderDetails) {
|
|
|
+ if(StringUtils.isBlank(historyOrderDetail.getGoodsIdList())){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Map<String, Integer> courseNumMap = JSON.parseObject(historyOrderDetail.getGoodsIdList(), Map.class);
|
|
|
+ for (Map.Entry<String, Integer> stringIntegerEntry : courseNumMap.entrySet()) {
|
|
|
+ switch (stringIntegerEntry.getKey()){
|
|
|
+ case "VIP":
|
|
|
+ historyVipNum = historyVipNum + stringIntegerEntry.getValue();
|
|
|
+ break;
|
|
|
+ case "PRACTICE":
|
|
|
+ historyPracticeNum = historyPracticeNum + stringIntegerEntry.getValue();
|
|
|
+ break;
|
|
|
+ case "HIGH":
|
|
|
+ historyHighNum = historyHighNum + stringIntegerEntry.getValue();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
BigDecimal practiceUnitPrice = practiceGroupSellPrice.getOnceOriginalPrice(),
|
|
|
vipUnitPrice = new BigDecimal("0"), highUnitPrice;
|
|
|
if(student.getIsNewUser()){
|
|
@@ -168,7 +196,10 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
if(!additionCourseInfo.containsKey(CourseSchedule.CourseScheduleType.VIP)){
|
|
|
additionCourseInfo.remove(CourseSchedule.CourseScheduleType.PRACTICE);
|
|
|
}
|
|
|
- boolean vipMoreThan2 = additionCourseInfo.containsKey(CourseSchedule.CourseScheduleType.VIP)&&additionCourseInfo.get(CourseSchedule.CourseScheduleType.VIP)>=2;
|
|
|
+ if(additionCourseInfo.containsKey(CourseSchedule.CourseScheduleType.VIP)){
|
|
|
+ historyVipNum = historyVipNum + additionCourseInfo.get(CourseSchedule.CourseScheduleType.VIP);
|
|
|
+ }
|
|
|
+ boolean vipMoreThan2 = historyVipNum>=2;
|
|
|
if(vipMoreThan2){
|
|
|
if(FREE_PRICE_LEVEL.contains(degreeRegistration.getLevel())){
|
|
|
degreeRegistration.setMoney(BigDecimal.ZERO);
|
|
@@ -176,7 +207,6 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
degreeRegistration.setMoney(degreeRegistration.getMoney().divide(new BigDecimal(2), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN));
|
|
|
}
|
|
|
highUnitPrice = practiceGroupSellPrice.getHighOnlineTenCourseActivityPriceWithNewUser();
|
|
|
-
|
|
|
}
|
|
|
if(vipMoreThan2&&additionCourseInfo.containsKey(CourseSchedule.CourseScheduleType.HIGH)){
|
|
|
degreeRegistration.setTheoryMoney(BigDecimal.ZERO);
|
|
@@ -223,6 +253,7 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
studentPaymentOrder.setExpectAmount(amount);
|
|
|
studentPaymentOrder.setActualAmount(amount);
|
|
|
studentPaymentOrder.setStatus(DealStatusEnum.ING);
|
|
|
+ studentPaymentOrder.setClassGroupId(degreeRegistration.getId());
|
|
|
if(Objects.nonNull(degreeRegistration.getSporadicId())){
|
|
|
studentPaymentOrder.setMusicGroupId(degreeRegistration.getSporadicId().toString());
|
|
|
}
|
|
@@ -283,7 +314,7 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
|
|
|
@Override
|
|
|
public Boolean updateStatus(StudentPaymentOrder studentPaymentOrder) {
|
|
|
- DegreeRegistration degree = degreeRegistrationDao.getLock(studentPaymentOrder.getUserId());
|
|
|
+ DegreeRegistration degree = degreeRegistrationDao.getLock(studentPaymentOrder.getClassGroupId());
|
|
|
|
|
|
int updateCount = studentPaymentOrderService.update(studentPaymentOrder);
|
|
|
if (updateCount <= 0) {
|