|
@@ -71,63 +71,70 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
DegreeRegistration degree = degreeRegistrationDao.getWithUserIdAndActivityTag(degreeRegistration.getUserId(), ACTIVITY_TAG);
|
|
|
|
|
|
Date nowDate = new Date();
|
|
|
- //获取收费项价格
|
|
|
- SporadicChargeInfo chargeInfo = sporadicChargeInfoDao.get(degreeRegistration.getSporadicId());
|
|
|
- if (chargeInfo == null || chargeInfo.getDelFlag().equals(1) || chargeInfo.getOpenFlag().equals(1)) {
|
|
|
- throw new BizException("你选的考试级别不存在");
|
|
|
- }
|
|
|
-
|
|
|
- if (!chargeInfo.getTitle().equals("一级") && !chargeInfo.getTitle().equals("二级") && StringUtils.equals("免考", degreeRegistration.getTheoryLevel())
|
|
|
- && StringUtils.isBlank(degreeRegistration.getTheoryCert())) {
|
|
|
- throw new BizException("报考级别为“" + chargeInfo.getTitle() + "”且乐理级别是“免考”时,必须上传证书");
|
|
|
- }
|
|
|
|
|
|
String orderNo = idGeneratorService.generatorId("payment") + "";
|
|
|
|
|
|
- degreeRegistration.setActivityTag(ACTIVITY_TAG);
|
|
|
- degreeRegistration.setLevel(chargeInfo.getTitle());
|
|
|
- degreeRegistration.setOrderNo(orderNo);
|
|
|
- BigDecimal theoryMoney = BigDecimal.ZERO;
|
|
|
- switch (degreeRegistration.getTheoryLevel()) {
|
|
|
- case "一级":
|
|
|
- theoryMoney = new BigDecimal(200);
|
|
|
- break;
|
|
|
- case "二级":
|
|
|
- theoryMoney = new BigDecimal(240);
|
|
|
- break;
|
|
|
- case "三级":
|
|
|
- theoryMoney = new BigDecimal(280);
|
|
|
- break;
|
|
|
- case "四级":
|
|
|
- theoryMoney = new BigDecimal(320);
|
|
|
- break;
|
|
|
- case "免考":
|
|
|
- break;
|
|
|
- default:
|
|
|
- throw new BizException("您选择的乐理级别不存在,请核对");
|
|
|
- }
|
|
|
- degreeRegistration.setTheoryMoney(theoryMoney);
|
|
|
- if (degree == null) {
|
|
|
- degreeRegistration.setMoney(chargeInfo.getAmount());
|
|
|
- degreeRegistration.setStatus(1);
|
|
|
- degreeRegistration.setCreateTime(nowDate);
|
|
|
- degreeRegistration.setUpdateTime(nowDate);
|
|
|
- degreeRegistrationDao.insert(degreeRegistration);
|
|
|
- } else if (degree.getStatus().equals(2)) {
|
|
|
- //throw new BizException("您本次已报名,请勿重复报名");
|
|
|
- } else {
|
|
|
- degreeRegistration.setId(degree.getId());
|
|
|
- degreeRegistration.setStatus(1);
|
|
|
- degreeRegistration.setCreateTime(nowDate);
|
|
|
- degreeRegistration.setUpdateTime(nowDate);
|
|
|
- degreeRegistrationDao.update(degreeRegistration);
|
|
|
+ //获取收费项价格
|
|
|
+ SporadicChargeInfo chargeInfo = null;
|
|
|
+ if(Objects.nonNull(degreeRegistration.getLevel())&&Objects.nonNull(degreeRegistration.getTheoryLevel())){
|
|
|
+ chargeInfo = sporadicChargeInfoDao.get(degreeRegistration.getSporadicId());
|
|
|
+ if (chargeInfo == null || chargeInfo.getDelFlag().equals(1) || chargeInfo.getOpenFlag().equals(1)) {
|
|
|
+ throw new BizException("你选的考试级别不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!chargeInfo.getTitle().equals("一级") && !chargeInfo.getTitle().equals("二级") && StringUtils.equals("免考", degreeRegistration.getTheoryLevel())
|
|
|
+ && StringUtils.isBlank(degreeRegistration.getTheoryCert())) {
|
|
|
+ throw new BizException("报考级别为“" + chargeInfo.getTitle() + "”且乐理级别是“免考”时,必须上传证书");
|
|
|
+ }
|
|
|
+
|
|
|
+ degreeRegistration.setActivityTag(ACTIVITY_TAG);
|
|
|
+ degreeRegistration.setLevel(chargeInfo.getTitle());
|
|
|
+ degreeRegistration.setOrderNo(orderNo);
|
|
|
+ BigDecimal theoryMoney = BigDecimal.ZERO;
|
|
|
+ switch (degreeRegistration.getTheoryLevel()) {
|
|
|
+ case "一级":
|
|
|
+ theoryMoney = new BigDecimal(200);
|
|
|
+ break;
|
|
|
+ case "二级":
|
|
|
+ theoryMoney = new BigDecimal(240);
|
|
|
+ break;
|
|
|
+ case "三级":
|
|
|
+ theoryMoney = new BigDecimal(280);
|
|
|
+ break;
|
|
|
+ case "四级":
|
|
|
+ theoryMoney = new BigDecimal(320);
|
|
|
+ break;
|
|
|
+ case "免考":
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new BizException("您选择的乐理级别不存在,请核对");
|
|
|
+ }
|
|
|
+ degreeRegistration.setTheoryMoney(theoryMoney);
|
|
|
+ if (degree == null) {
|
|
|
+ degreeRegistration.setMoney(chargeInfo.getAmount());
|
|
|
+ degreeRegistration.setStatus(1);
|
|
|
+ degreeRegistration.setCreateTime(nowDate);
|
|
|
+ degreeRegistration.setUpdateTime(nowDate);
|
|
|
+ degreeRegistrationDao.insert(degreeRegistration);
|
|
|
+ } else if (degree.getStatus().equals(2)) {
|
|
|
+ //throw new BizException("您本次已报名,请勿重复报名");
|
|
|
+ } else {
|
|
|
+ degreeRegistration.setId(degree.getId());
|
|
|
+ degreeRegistration.setStatus(1);
|
|
|
+ degreeRegistration.setCreateTime(nowDate);
|
|
|
+ degreeRegistration.setUpdateTime(nowDate);
|
|
|
+ degreeRegistrationDao.update(degreeRegistration);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ degreeRegistration.setMoney(BigDecimal.ZERO);
|
|
|
+ degreeRegistration.setTheoryMoney(BigDecimal.ZERO);
|
|
|
}
|
|
|
|
|
|
BigDecimal additionCoursePrice = new BigDecimal("0");
|
|
|
Map<CourseSchedule.CourseScheduleType, Integer> typeCourseTime = new HashMap<>();
|
|
|
if(Objects.nonNull(degreeRegistration.getAdditionCourseInfo())){
|
|
|
Map<CourseSchedule.CourseScheduleType, Integer> additionCourseInfo = degreeRegistration.getAdditionCourseInfo();
|
|
|
- PracticeGroupSellPrice practiceGroupSellPrice = practiceGroupSellPriceDao.get(degreeRegistration.getId());
|
|
|
+ PracticeGroupSellPrice practiceGroupSellPrice = practiceGroupSellPriceDao.get(degreeRegistration.getOrganId());
|
|
|
if(Objects.isNull(practiceGroupSellPrice)){
|
|
|
throw new BizException("该分部暂未参与此活动");
|
|
|
}
|
|
@@ -174,7 +181,7 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
}
|
|
|
|
|
|
BigDecimal amount = degreeRegistration.getMoney();
|
|
|
- amount = amount.add(theoryMoney);
|
|
|
+ amount = amount.add(degreeRegistration.getTheoryMoney());
|
|
|
amount = amount.add(additionCoursePrice);
|
|
|
|
|
|
OrderTypeEnum type = OrderTypeEnum.DEGREE_REGISTRATION;
|
|
@@ -192,8 +199,8 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
studentPaymentOrder.setMusicGroupId(degreeRegistration.getSporadicId().toString());
|
|
|
studentPaymentOrder.setOrganId(degreeRegistration.getOrganId());
|
|
|
studentPaymentOrder.setRoutingOrganId(degreeRegistration.getOrganId());
|
|
|
- if (theoryMoney.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- studentPaymentOrder.setMemo("乐理" + degreeRegistration.getTheoryLevel() + ",费用:" + theoryMoney);
|
|
|
+ if (degreeRegistration.getTheoryMoney().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ studentPaymentOrder.setMemo("乐理" + degreeRegistration.getTheoryLevel() + ",费用:" + degreeRegistration.getTheoryMoney());
|
|
|
}
|
|
|
studentPaymentOrderService.insert(studentPaymentOrder);
|
|
|
studentPaymentOrder.setVersion(0);
|
|
@@ -229,8 +236,8 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
orderNo,
|
|
|
baseApiUrl + "/api-student/studentOrder/notify",
|
|
|
baseApiUrl + "/api-student/studentOrder/paymentResult?orderNo=" + orderNo,
|
|
|
- chargeInfo.getDetail(),
|
|
|
- chargeInfo.getDetail(),
|
|
|
+ Objects.nonNull(chargeInfo)?chargeInfo.getDetail():"考级报名活动",
|
|
|
+ Objects.nonNull(chargeInfo)?chargeInfo.getDetail():"考级报名活动",
|
|
|
degreeRegistration.getOrganId(),
|
|
|
receiver
|
|
|
);
|
|
@@ -246,6 +253,12 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
@Override
|
|
|
public Boolean updateStatus(StudentPaymentOrder studentPaymentOrder) {
|
|
|
DegreeRegistration degree = degreeRegistrationDao.getLock(studentPaymentOrder.getUserId());
|
|
|
+
|
|
|
+ int updateCount = studentPaymentOrderService.update(studentPaymentOrder);
|
|
|
+ if (updateCount <= 0) {
|
|
|
+ throw new BizException("订单更新失败");
|
|
|
+ }
|
|
|
+
|
|
|
if (degree == null || degree.getStatus().equals(2)) {
|
|
|
return true;
|
|
|
}
|