|
|
@@ -204,6 +204,7 @@ public class PayOrderBusiness {
|
|
|
return R.fail(result.getMsg());
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
return R.fail(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
@@ -215,22 +216,23 @@ public class PayOrderBusiness {
|
|
|
@Transactional(rollbackFor = ConsumeException.class)
|
|
|
public R<PurseInOutBo>refund(PurseInOutBo bo){
|
|
|
//校验钱包余额是否充足
|
|
|
- PtBagVo bagVo = payBaseBusiness.checkUserBag(bo);
|
|
|
- if (bagVo.getBalance().compareTo(bo.getReceiptMoney()) < 0) {
|
|
|
- return R.fail(MessageFormat.format("钱包余额不足,当前余额为:{0}", bagVo.getBalance()),bo);
|
|
|
+ PurseInOutBo boCopy = BeanUtil.copyProperties(bo, PurseInOutBo.class);
|
|
|
+ PtBagVo bagVo = payBaseBusiness.checkUserBag(boCopy);
|
|
|
+ if (bagVo.getBalance().compareTo(boCopy.getReceiptMoney()) < 0) {
|
|
|
+ return R.fail(MessageFormat.format("钱包余额不足,当前余额为:{0}", bagVo.getBalance()),boCopy);
|
|
|
}
|
|
|
- bo.setUseType(SystemUseTypeEnum.CONSUME);
|
|
|
+ boCopy.setUseType(SystemUseTypeEnum.CONSUME);
|
|
|
//退款是记支出,所以金额设置为负数
|
|
|
- bo.setReceiptMoney(bo.getReceiptMoney().negate());
|
|
|
+ boCopy.setReceiptMoney(boCopy.getReceiptMoney().negate());
|
|
|
try {
|
|
|
- R<PurseInOutBo> result = createNormalOrder(bo);
|
|
|
+ R<PurseInOutBo> result = createNormalOrder(boCopy);
|
|
|
if (result.getCode() == R.SUCCESS) {
|
|
|
return R.ok(result.getData());
|
|
|
} else {
|
|
|
- return R.fail(result.getMsg(),bo);
|
|
|
+ return R.fail(result.getMsg(),boCopy);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- return R.fail(e.getMessage(),bo);
|
|
|
+ return R.fail(e.getMessage(),boCopy);
|
|
|
}
|
|
|
}
|
|
|
/**
|