|
@@ -502,4 +502,31 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
|
|
|
}
|
|
|
return BaseController.succeed();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public int refund(Integer degreeRegistrationId) {
|
|
|
+ DegreeRegistration degreeRegistration = degreeRegistrationDao.getLock(degreeRegistrationId);
|
|
|
+ if(Objects.isNull(degreeRegistration)){
|
|
|
+ throw new BizException("报名信息不存在");
|
|
|
+ }
|
|
|
+ if(degreeRegistration.getStatus() != 2){
|
|
|
+ throw new BizException("当前状态不支持退费");
|
|
|
+ }
|
|
|
+ StudentPaymentOrder order = studentPaymentOrderService.findOrderByOrderNo(degreeRegistration.getOrderNo());
|
|
|
+ if(Objects.isNull(order)){
|
|
|
+ throw new BizException("订单信息不存在");
|
|
|
+ }
|
|
|
+ if(order.getStatus() != DealStatusEnum.SUCCESS){
|
|
|
+ throw new BizException("当前订单状态不支持退费");
|
|
|
+ }
|
|
|
+ //退到账户余额
|
|
|
+ if(degreeRegistration.getMoney().compareTo(BigDecimal.ZERO) <= 0){
|
|
|
+ throw new BizException("订单金额异常");
|
|
|
+ }
|
|
|
+ sysUserCashAccountService.updateBalance(order.getUserId(), degreeRegistration.getMoney(), PlatformCashAccountDetailTypeEnum.REFUNDS, "考级退费");
|
|
|
+ degreeRegistration.setStatus(3);
|
|
|
+ degreeRegistration.setUpdateTime(new Date());
|
|
|
+ return degreeRegistrationDao.update(degreeRegistration);
|
|
|
+ }
|
|
|
}
|