| | |
| | | import com.zy.asrs.mapper.ReportQueryMapper; |
| | | import com.zy.asrs.service.AgvWrkMastLogService; |
| | | import com.zy.common.web.BaseController; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/report/download") |
| | | public class ReportDownloadController extends BaseController { |
| | |
| | | * @since 2.1.1 |
| | | */ |
| | | @RequestMapping("/out") |
| | | public void out(HttpServletResponse response, @RequestParam(required = false) ViewWorkInBean bean) throws IOException { |
| | | public void out(HttpServletResponse response, @RequestParam(required = false) Map<String, Object> bean) throws IOException { |
| | | try { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 |
| | | String fileName = URLEncoder.encode("日出库明细统计", "UTF-8").replaceAll("\\+", "%20"); |
| | | response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
| | | List<ViewWorkInBean> list = reportQueryMapper.queryViewWorkOutList(bean); |
| | | List<ViewWorkInBean> list = reportQueryMapper.queryViewWorkOutList(JSON.parseObject(JSON.toJSONString(bean), ViewWorkInBean.class)); |
| | | // 这里需要设置不关闭流 |
| | | EasyExcel.write(response.getOutputStream(), ViewWorkInBean.class).autoCloseStream(Boolean.FALSE).sheet("sheet1").doWrite(list); |
| | | } catch (Exception e) { |
| | |
| | | * @since 2.1.1 |
| | | */ |
| | | @RequestMapping("/in") |
| | | public void in(HttpServletResponse response, @RequestParam(required = false) ViewWorkInBean bean) throws IOException { |
| | | public void in(HttpServletResponse response, @RequestParam(required = false) Map<String, Object> bean) throws IOException { |
| | | try { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 |
| | | String fileName = URLEncoder.encode("日入库明细统计", "UTF-8").replaceAll("\\+", "%20"); |
| | | response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
| | | List<ViewWorkInBean> list = reportQueryMapper.queryViewWorkInList(bean); |
| | | String s = "1"; |
| | | ViewWorkInBean viewWorkInBean = JSON.parseObject(JSON.toJSONString(bean), ViewWorkInBean.class); |
| | | List<ViewWorkInBean> list = reportQueryMapper.queryViewWorkInList(viewWorkInBean); |
| | | // 这里需要设置不关闭流 |
| | | EasyExcel.write(response.getOutputStream(), ViewWorkInBean.class).autoCloseStream(Boolean.FALSE).sheet("sheet1").doWrite(list); |
| | | } catch (Exception e) { |