| | |
| | | wrapper.select("sum(money) as money").last(" limit 1"); |
| | | Refund total = refundMapper.selectOne(wrapper); |
| | | BigDecimal refundMoney = total == null?new BigDecimal(0):Constants.formatDecimalNum(total.getMoney()); |
| | | BigDecimal canBalance =Constants.formatDecimalNum(goodsorder.getMoney()).subtract(money); |
| | | //可退剩余 单位元 |
| | | BigDecimal canBalance =Constants.translateMoney(Constants.formatDecimalNum(goodsorder.getMoney()).subtract(refundMoney)); |
| | | if(canBalance.compareTo(money) > Constants.ZERO){ |
| | | RefundDTO refundDTO = new RefundDTO(); |
| | | refundDTO.setOrderId(orderId); |
| | |
| | | refundDTO.setType(Constants.REFUND_TYPE.BACK.getKey()); |
| | | Refund refund = wxMiniUtilService.wxRefund(refundDTO); |
| | | }else { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,退款金额不允许超过"+canBalance); |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,退款金额不允许超过"+canBalance+"元"); |
| | | } |
| | | } |
| | | |