| | |
| | | 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.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; |
| | | |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation(value = "下载", tags = {"管理后台-账户结算账单"}) |
| | | @PutMapping("/downloadAccount") |
| | | public R downloadAccount(@RequestBody ChargingListQuery dto,HttpServletResponse response) |
| | | { |
| | | 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 = {"管理后台-结算汇总表"}) |
| | | @GetMapping("/downloadSettlementTotal") |
| | | public R downloadSettlementTotal(String time,HttpServletResponse response) |
| | | { |
| | | SettlementTotalVO data = chargingOrderClient.settlementTotalR(time).getData(); |
| | | |
| | | |
| | | try { |
| | | response.setCharacterEncoding(Constants.UTF8); |
| | | response.setContentType("application/vnd.ms-excel"); |