|
@@ -647,47 +647,47 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
- public void applyRefundAudit(StudentApplyRefunds studentApplyRefunds) {
|
|
|
- if(Objects.isNull(studentApplyRefunds.getId())){
|
|
|
- throw new BizException("请指定退费订单!");
|
|
|
- }
|
|
|
+ public void applyRefundAudit(Long id, AuditStatusEnum status, String remark) {
|
|
|
|
|
|
- StudentApplyRefunds oldStudentApplyRefunds=studentApplyRefundsDao.get(studentApplyRefunds.getId());
|
|
|
+ StudentApplyRefunds studentApplyRefunds = studentApplyRefundsDao.get(id);
|
|
|
+ if (studentApplyRefunds == null) {
|
|
|
+ throw new BizException("退课申请记录不存在");
|
|
|
+ }
|
|
|
|
|
|
- StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.get(oldStudentApplyRefunds.getOrigPaymentOrderId());
|
|
|
- if(null==studentPaymentOrder){
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.get(studentApplyRefunds.getOrigPaymentOrderId());
|
|
|
+ if (null == studentPaymentOrder) {
|
|
|
throw new BizException("未找到原订单信息!");
|
|
|
}
|
|
|
|
|
|
- oldStudentApplyRefunds.setStatus(studentApplyRefunds.getStatus());
|
|
|
- if(null==studentApplyRefunds.getActualAmount()){
|
|
|
- oldStudentApplyRefunds.setActualAmount(oldStudentApplyRefunds.getExpectAmount());
|
|
|
- }else{
|
|
|
- oldStudentApplyRefunds.setActualAmount(studentApplyRefunds.getActualAmount());
|
|
|
- }
|
|
|
- oldStudentApplyRefunds.setRemark(studentApplyRefunds.getRemark());
|
|
|
- studentApplyRefundsDao.update(oldStudentApplyRefunds);
|
|
|
- switch (studentApplyRefunds.getStatus()){
|
|
|
- case PASS:
|
|
|
- sysUserCashAccountService.updateBalance(oldStudentApplyRefunds.getUserId(),oldStudentApplyRefunds.getActualAmount());
|
|
|
- SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentApplyRefunds.getUserId().intValue());
|
|
|
- SysUserCashAccountDetail sysUserCashAccountDetail=new SysUserCashAccountDetail();
|
|
|
- sysUserCashAccountDetail.setUserId(studentApplyRefunds.getUserId());
|
|
|
- sysUserCashAccountDetail.setType(PlatformCashAccountDetailTypeEnum.REFUNDS);
|
|
|
- sysUserCashAccountDetail.setStatus(DealStatusEnum.SUCCESS);
|
|
|
- sysUserCashAccountDetail.setAmount(oldStudentApplyRefunds.getActualAmount());
|
|
|
- sysUserCashAccountDetail.setBalance(sysUserCashAccount.getBalance());
|
|
|
- sysUserCashAccountDetail.setAttribute(oldStudentApplyRefunds.getId().toString());
|
|
|
- sysUserCashAccountDetailDao.insert(sysUserCashAccountDetail);
|
|
|
-
|
|
|
- classGroupStudentMapperDao.deleteStudentByClassGroupId(studentPaymentOrder.getClassGroupId().longValue(),
|
|
|
- studentPaymentOrder.getUserId().longValue());
|
|
|
- break;
|
|
|
- case REJECT:
|
|
|
+ studentApplyRefunds.setStatus(status);
|
|
|
+ if (studentApplyRefunds.getStatus() == AuditStatusEnum.PASS) {
|
|
|
+ studentApplyRefunds.setActualAmount(studentApplyRefunds.getExpectAmount());
|
|
|
+ } else {
|
|
|
+ studentApplyRefunds.setActualAmount(new BigDecimal(0));
|
|
|
+ }
|
|
|
+ studentApplyRefunds.setRemark(remark);
|
|
|
+ studentApplyRefundsDao.update(studentApplyRefunds);
|
|
|
+ switch (studentApplyRefunds.getStatus()) {
|
|
|
+ case PASS:
|
|
|
+ sysUserCashAccountService.updateBalance(studentApplyRefunds.getUserId(), studentApplyRefunds.getActualAmount());
|
|
|
+ SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentApplyRefunds.getUserId().intValue());
|
|
|
+ SysUserCashAccountDetail sysUserCashAccountDetail = new SysUserCashAccountDetail();
|
|
|
+ sysUserCashAccountDetail.setUserId(studentApplyRefunds.getUserId());
|
|
|
+ sysUserCashAccountDetail.setType(PlatformCashAccountDetailTypeEnum.REFUNDS);
|
|
|
+ sysUserCashAccountDetail.setStatus(DealStatusEnum.SUCCESS);
|
|
|
+ sysUserCashAccountDetail.setAmount(studentApplyRefunds.getActualAmount());
|
|
|
+ sysUserCashAccountDetail.setBalance(sysUserCashAccount.getBalance());
|
|
|
+ sysUserCashAccountDetail.setAttribute(studentApplyRefunds.getId().toString());
|
|
|
+ sysUserCashAccountDetailDao.insert(sysUserCashAccountDetail);
|
|
|
|
|
|
- break;
|
|
|
- default:
|
|
|
- throw new BizException("审核状态错误!");
|
|
|
+ classGroupStudentMapperDao.deleteStudentByClassGroupId(studentPaymentOrder.getClassGroupId().longValue(), studentPaymentOrder.getUserId()
|
|
|
+ .longValue());
|
|
|
+ break;
|
|
|
+ case REJECT:
|
|
|
+
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new BizException("审核状态错误!");
|
|
|
}
|
|
|
}
|
|
|
|