| | |
| | | import com.mzl.flower.dto.request.wallet.QueryWalletDTO; |
| | | import com.mzl.flower.dto.response.supplier.SupplierDTO; |
| | | import com.mzl.flower.service.supplier.SupplierService; |
| | | import com.mzl.flower.service.wallet.WalletBillRecordService; |
| | | import com.mzl.flower.service.wallet.WalletService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | @Autowired |
| | | private SupplierService supplierService; |
| | | |
| | | @Autowired |
| | | private WalletBillRecordService walletBillRecordService; |
| | | |
| | | @PostMapping("") |
| | | public ResponseEntity<ReturnDataDTO> create() { |
| | |
| | | if(null!=walletDO){ |
| | | // 根据当前供应商获取待结算的钱 |
| | | BigDecimal waittingSettlementAmount = walletService.getWaittingSettlementAmount(walletDO); |
| | | // 获取已经提现和已结算的钱 |
| | | BigDecimal historyAmount = walletBillRecordService.getHistoryAmount(walletDO.getId(), walletDO.getSupplierId()); |
| | | //已提现 |
| | | walletDO.setWithdrawnAmount(walletDO.getWithdrawnAmount().add(historyAmount)); |
| | | //已结算 |
| | | walletDO.setSettledAmount(walletDO.getSettledAmount().add(historyAmount)); |
| | | walletDO.setSettlingAmount(waittingSettlementAmount); |
| | | // 总交易额度 |
| | | walletDO.setTotalTransactionAmount(walletService.getSupplierTotalTransactionAmount(walletDO)); |
| | | // 总扣款数量 |
| | | walletDO.setTotalDeduction(walletService.getSupplierDeductAmount(walletDO)); |
| | | |
| | | } |
| | | |
| | | return returnData(R.SUCCESS.getCode(), walletDO); |