| | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | public void export(@RequestBody MgtAuctionSalesroomQuery query, HttpServletResponse response) { |
| | | PageDTO<MgtAuctionSalesroomVO> page = auctionSalesroomService.getAuctionSalesroomPage(query); |
| | | if (page.isEmpty()){ |
| | | return; |
| | | response.setContentType( |
| | | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 |
| | | try { |
| | | String fileName = URLEncoder.encode( |
| | | "优惠券领取明细" + DateUtils.format(new Date(), "yyyyMMddHHmmss"), "UTF-8") |
| | | .replaceAll("\\+", "%20"); |
| | | response.setHeader("Content-disposition", |
| | | "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
| | | EasyExcel.write(response.getOutputStream(), AuctionBidRecordVO.class) |
| | | .sheet("优惠券领取明细") |
| | | .doWrite(new ArrayDeque<>()); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | List<MgtAuctionSalesroomVO> list = page.getList(); |