| | |
| | | @PostMapping(value = "/accountBillList") |
| | | @ApiOperation(value = "列表查询", tags = {"管理后台-账户结算账单"}) |
| | | public R<AccountListVO> accountBillList(@RequestBody ChargingListQuery dto) { |
| | | AccountListVO accountListVO = new AccountListVO(); |
| | | ChargingBillVO res = chargingBillService.chargingBillList1(dto); |
| | | List<ChargingBillListVO> records = res.getList().getRecords(); |
| | | accountListVO.setBillCount(records.size()); |
| | | accountListVO.setTotalAmount(res.getPaymentAmount().subtract(res.getCommissionAmount()).subtract(res.getSharingAmount()).setScale(2, BigDecimal.ROUND_DOWN)); |
| | | accountListVO.setPaymentAmount(res.getPaymentAmount().setScale(2, BigDecimal.ROUND_DOWN)); |
| | | accountListVO.setRefundAmount(res.getRefundAmount().setScale(2, BigDecimal.ROUND_DOWN)); |
| | | accountListVO.setCommissionAmount(res.getCommissionAmount().setScale(2, BigDecimal.ROUND_DOWN)); |
| | | accountListVO.setSharingAmount(res.getSharingAmount().setScale(2, BigDecimal.ROUND_DOWN)); |
| | | accountListVO.setPlatformIncome(res.getPlatformIncome().setScale(2, BigDecimal.ROUND_DOWN)); |
| | | accountListVO.setPartnerIncome(res.getPartnerIncome().setScale(2, BigDecimal.ROUND_DOWN)); |
| | | accountListVO.setList(res.getList()); |
| | | accountListVO.setOrderList(res.getExportList()); |
| | | return R.ok(accountListVO); |
| | | return R.ok(chargingBillService.accountSettlementBillList(dto)); |
| | | } |
| | | |
| | | |
| | |
| | | @PutMapping("/exportAccount") |
| | | public void exportAccount(@RequestBody ChargingListQuery dto) |
| | | { |
| | | ChargingBillVO res = chargingBillService.chargingBillList1(dto); |
| | | dto.setPageCurr(1); |
| | | dto.setPageSize(100000); |
| | | AccountListVO res = chargingBillService.accountSettlementBillList(dto); |
| | | List<ChargingBillListVO> list = res.getList().getRecords(); |
| | | List<TChargingBillExport> tChargingBillExports = new ArrayList<>(); |
| | | for (ChargingBillListVO orderInvoiceVO : list) { |
| | |
| | | tChargingBillExport.setElectrovalence(orderInvoiceVO.getElectrovalence()); |
| | | tChargingBillExport.setServiceCharge(orderInvoiceVO.getServiceCharge()); |
| | | tChargingBillExport.setChargingCapacity(orderInvoiceVO.getChargingCapacity()); |
| | | Integer chargingSecond = orderInvoiceVO.getChargingSecond(); |
| | | Integer chargingSecond = Optional.ofNullable(orderInvoiceVO.getChargingSecond()).orElse(0); |
| | | // 根据秒数 转换为xx小时xx分钟xx秒 如果小时为0不展示 如果分钟为0则不展示 |
| | | // 计算小时、分钟和秒 |
| | | int hours = chargingSecond / 60 / 60; |
| | |
| | | } |
| | | tChargingBillExport.setChargingTime(result.toString()); |
| | | tChargingBillExport.setOrderCount(orderInvoiceVO.getOrderCount()); |
| | | tChargingBillExport.setBillTime(orderInvoiceVO.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | tChargingBillExport.setBillTime(orderInvoiceVO.getCreateTime() == null ? "-" |
| | | : orderInvoiceVO.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | tChargingBillExports.add(tChargingBillExport); |
| | | } |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TChargingBillExport.class, tChargingBillExports); |
| | |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("月账单-"+res.getCategory()+"-"+res.getBillWeek()+"-"+res.getSiteName()+".xls", "utf-8"); |
| | | String fileName = URLEncoder.encode("账户结算账单.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | if (outputStream != null) { |
| | | outputStream.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |