| | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.common.core.utils.WebUtils; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.ExportUidDto; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TSettlementConfirm; |
| | | import com.ruoyi.order.api.vo.AccountListVO; |
| | | import com.ruoyi.order.api.vo.ChargingBillListVO; |
| | | |
| | | |
| | |
| | | private final RedisService redisService; |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | |
| | | } |
| | | |
| | | @ApiOperation(value = "下载-已出账", tags = {"管理后台-充电算账单"}) |
| | | @GetMapping("/downloadBill") |
| | | public R downloadBill(String uid,HttpServletResponse response) |
| | | @PutMapping("/downloadBill") |
| | | public R downloadBill(@RequestBody ExportUidDto uid, HttpServletResponse response) |
| | | { |
| | | ChargingListQuery chargingListQuery = new ChargingListQuery(); |
| | | chargingListQuery.setUid(uid); |
| | | chargingListQuery.setUid(uid.getUid()); |
| | | chargingListQuery.setPageCurr(1); |
| | | chargingListQuery.setPageSize(99999); |
| | | ChargingBillVO data = chargingOrderClient.chargingBillListR(chargingListQuery).getData(); |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation(value = "导出", tags = {"管理后台-结算汇总表"}) |
| | | @GetMapping("/downloadSettlementTotal") |
| | | public R downloadSettlementTotal(String time,HttpServletResponse response) |
| | | @ApiOperation(value = "下载", tags = {"管理后台-账户结算账单"}) |
| | | @PutMapping("/downloadAccount") |
| | | public R downloadAccount(@RequestBody ChargingListQuery dto,HttpServletResponse response) |
| | | { |
| | | SettlementTotalVO data = chargingOrderClient.settlementTotalR(time).getData(); |
| | | AccountListVO data = orderClient.accountBillList(dto).getData(); |
| | | try { |
| | | response.setCharacterEncoding(Constants.UTF8); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setHeader("Access-Control-Expose-Headers", "Content-disposition"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + |
| | | URLEncoder.encode("账户结算账单", CharEncoding.UTF_8) + ".xlsx"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | return R.fail("excel导出失败!"); |
| | | } |
| | | try { |
| | | // excel模板封装 |
| | | ExcelWriterBuilder excelWriterBuilder = EasyExcelFactory.write(response.getOutputStream()); |
| | | InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("template/" +"账户结算账单" + ".xlsx"); |
| | | // 自动释放资源 |
| | | try (ExcelWriter excelWriter = excelWriterBuilder.withTemplate(stream).build()) { |
| | | WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
| | | FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.VERTICAL).build(); |
| | | excelWriter.fill(new FillWrapper("data1", data.getList().getRecords()), fillConfig, writeSheet); |
| | | excelWriter.finish(); |
| | | } catch (Exception e) { |
| | | return R.fail("excel导出失败!"); |
| | | } |
| | | } catch (IOException e) { |
| | | return R.fail("excel导出失败!"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "导出", tags = {"管理后台-结算汇总表"}) |
| | | @PutMapping("/downloadSettlementTotal") |
| | | public R downloadSettlementTotal(@RequestBody ExportUidDto uid,HttpServletResponse response) |
| | | { |
| | | SettlementTotalVO data = chargingOrderClient.settlementTotalR(uid.getTime()).getData(); |
| | | |
| | | |
| | | try { |
| | |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation(value = "下载", tags = {"管理后台-结算表记录"}) |
| | | @GetMapping("/downloadSettlement") |
| | | public R downloadSettlement(String uid,HttpServletResponse response) |
| | | @PutMapping("/downloadSettlement") |
| | | public R downloadSettlement(@RequestBody ExportUidDto uid,HttpServletResponse response) |
| | | { |
| | | TSettlementConfirm data = chargingOrderClient.downloadSettlement(uid).getData(); |
| | | TSettlementConfirm data = chargingOrderClient.downloadSettlement(uid.getUid()).getData(); |
| | | List<Site> data1 = siteClient.getSiteByIds(Arrays.asList(data.getSiteId())).getData(); |
| | | if (!data1.isEmpty()){ |
| | | data.setSiteName(data1.get(0).getName()); |
| | |
| | | |
| | | |
| | | @ApiOperation(value = "下载-未出账", tags = {"管理后台-充电算账单"}) |
| | | @GetMapping("/download") |
| | | @PutMapping("/download") |
| | | public R download(String uid,HttpServletResponse response) |
| | | { |
| | | ChargingListQuery chargingListQuery = new ChargingListQuery(); |