From 0e3cac8d5d9603cdd5ff8935e4054f0018a35ed9 Mon Sep 17 00:00:00 2001 From: wujian <14790700720@163.com> Date: 星期日, 28 四月 2024 15:08:56 +0800 Subject: [PATCH] change model10 --- jcdm-main/src/main/java/com/jcdm/main/rm/repairRecord/controller/RmRepairRecordController.java | 78 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 78 insertions(+), 0 deletions(-) diff --git a/jcdm-main/src/main/java/com/jcdm/main/rm/repairRecord/controller/RmRepairRecordController.java b/jcdm-main/src/main/java/com/jcdm/main/rm/repairRecord/controller/RmRepairRecordController.java index afdb8ab..eafe0e4 100644 --- a/jcdm-main/src/main/java/com/jcdm/main/rm/repairRecord/controller/RmRepairRecordController.java +++ b/jcdm-main/src/main/java/com/jcdm/main/rm/repairRecord/controller/RmRepairRecordController.java @@ -1,7 +1,25 @@ package com.jcdm.main.rm.repairRecord.controller; +import java.io.IOException; import java.util.List; +import java.util.stream.Collectors; +import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; +import com.jcdm.common.core.domain.R; +import com.jcdm.common.core.domain.entity.SysDictData; +import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling; +import com.jcdm.main.bs.orderScheduling.vo.FollowReportVO; +import com.jcdm.main.da.paramCollection.domain.DaParamCollection; +import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection; +import com.jcdm.main.rm.repairData.domain.RmRepairData; +import com.jcdm.main.rm.repairRecord.vo.RmRepairDataVO; +import com.jcdm.system.service.ISysDictDataService; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -34,6 +52,9 @@ @Autowired private IRmRepairRecordService rmRepairRecordService; + @Resource + private ISysDictDataService iSysDictDataService; + /** * 鏌ヨ杩斾慨璁板綍鍒楄〃 */ @@ -47,6 +68,63 @@ } /** + * 鑾峰彇杩斾慨鏁版嵁鍒楄〃 + * @param rmRepairRecord + * @return + */ + @PreAuthorize("@ss.hasPermi('rm:repairRecord:list')") + @GetMapping("/getRepairReportList") + public R getRepairReportList(RmRepairRecord rmRepairRecord) + { + RmRepairDataVO repairReportList = rmRepairRecordService.getRepairReportList(rmRepairRecord); + return R.ok(repairReportList); + } + + @PreAuthorize("@ss.hasPermi('rm:repairRecord:export')") + @Log(title = "杩斾慨鏁版嵁鎶ヨ〃瀵煎嚭", businessType = BusinessType.EXPORT) + @PostMapping("/exportRepair") + public void exportRepair(HttpServletResponse response, RmRepairRecord rmRepairRecord) + { + RmRepairDataVO repairReportList = rmRepairRecordService.getRepairReportList(rmRepairRecord); +// List<SysDictData> allDict = iSysDictDataService.selectDictDataList(null); + String fileName = "杩芥函鎶ヨ〃"; + try { + ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build(); + WriteSheet mainSheet = EasyExcel.writerSheet(0, "杩斾慨鏁版嵁") + .head(RmRepairRecord.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) + .build(); + WriteSheet sheet1 = EasyExcel.writerSheet(1, "鎷х揣鏁版嵁") + .head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) + .build(); + WriteSheet sheet2 = EasyExcel.writerSheet(2, "鐩告満妫�娴�") + .head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) + .build(); + WriteSheet sheet3 = EasyExcel.writerSheet(3, "澶栨紡妫�娴�") + .head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) + .build(); + WriteSheet sheet4 = EasyExcel.writerSheet(4, "鏈烘补鍔犳敞") + .head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) + .build(); + WriteSheet sheet5 = EasyExcel.writerSheet(5, "宸ヤ綅缁撴灉") + .head(DaPassingStationCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) + .build(); + excelWriter.write(repairReportList.getMainList(),mainSheet); + excelWriter.write(repairReportList.getList1(),sheet1); + excelWriter.write(repairReportList.getList2(),sheet2); + excelWriter.write(repairReportList.getList3(),sheet3); + excelWriter.write(repairReportList.getList4(),sheet4); + excelWriter.write(repairReportList.getList5(),sheet5); + response.setContentType("application/vnd.ms-excel;charset=utf-8"); + response.setCharacterEncoding("UTF-8"); + response.setHeader("Content-Disposition","attachment;filename="+fileName+".xlsx"); + excelWriter.finish(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + + /** * 涓嶅垎椤垫煡璇㈣繑淇褰曞垪琛� */ @GetMapping("/noPagelist") -- Gitblit v1.9.3