| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.ruoyi.account.api.dto.GiveVipDto; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.utils.WebUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | import com.ruoyi.order.api.query.ShoppingOrderQuery; |
| | | import com.ruoyi.order.api.query.VipShoppingOrderQuery; |
| | | import com.ruoyi.order.dto.TEnterpriseExport; |
| | | import com.ruoyi.order.service.TVipOrderService; |
| | | import com.ruoyi.other.api.domain.TEnterpriseUserApplication; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.omg.CORBA.PRIVATE_MEMBER; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private OtherClient otherClient; |
| | | |
| | | @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "导出") |
| | | @PutMapping(value = "/export") |
| | | @Log(title = "【申请建桩】导出建桩申请列表", businessType = BusinessType.EXPORT) |
| | | public void export(String landlordPhone) { |
| | | |
| | | R<List<TEnterpriseUserApplication>> tnterPrise = otherClient.getTnterPrise(); |
| | | List<TEnterpriseUserApplication> list = tnterPrise.getData(); |
| | | List<TEnterpriseExport> orderInvoiceExports = new ArrayList<>(); |
| | | for (TEnterpriseUserApplication orderInvoiceVO : list) { |
| | | TEnterpriseExport orderInvoiceExport = new TEnterpriseExport(); |
| | | BeanUtils.copyProperties(orderInvoiceVO,orderInvoiceExport); |
| | | orderInvoiceExport.setCreateTime(DateUtils.localDateTimeToString(orderInvoiceVO.getCreateTime())); |
| | | orderInvoiceExports.add(orderInvoiceExport); |
| | | } |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TEnterpriseExport.class, orderInvoiceExports); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | 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"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | workbook.close(); |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |