| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | |
| | | @ApiOperation(value = "线下支付") |
| | | @PostMapping("offlinePay") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R offlinePay(@Validated @RequestBody OfflinePayDto dto){ |
| | | List<TBill> tBills = tBillService.listByIds(dto.getBillIds()); |
| | | TBillConfirm confirm = new TBillConfirm(); |
| | | confirm.setBillId(CollectionUtil.join(dto.getBillIds(),",")); |
| | | confirm.setVoucher(dto.getVoucher()); |
| | | confirm.setPayFeesMoney(new BigDecimal(dto.getAmount()).divide(AmountConstant.b100).setScale(2, RoundingMode.HALF_DOWN).doubleValue()); |
| | | confirm.setPayTime(dto.getPayTime()); |
| | | tBillConfirmService.save(confirm); |
| | | for (TBill tBill : tBills) { |
| | | TBill save = new TBill(); |
| | | save.setId(tBill.getId()); |
| | | save.setPayFeesType(2); |
| | | save.setVoucher(dto.getVoucher()); |
| | | save.setPayFeesStatus("2"); |
| | | tBillService.lockAndUpdateInfo(save); |
| | | save.setConfirmId(confirm.getId()); |
| | | tBillService.lockAndUpdateInfo(save,1); |
| | | } |
| | | TBillConfirm confirm = new TBillConfirm(); |
| | | confirm.setBillId(CollectionUtil.join(dto.getBillIds(),",")); |
| | | confirm.setVoucher(dto.getVoucher()); |
| | | confirm.setPayFeesMoney(new BigDecimal(dto.getAmount()).divide(AmountConstant.b100).setScale(2, RoundingMode.HALF_DOWN).doubleValue()); |
| | | tBillConfirmService.save(confirm); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |