From bbc5784cc34d65e64d639d949e75b978fe07bdb3 Mon Sep 17 00:00:00 2001 From: yyt <306727702@qq.com> Date: 星期一, 06 五月 2024 12:30:48 +0800 Subject: [PATCH] 更新首页 --- jcdm-main/src/main/java/com/jcdm/main/rm/repairRecord/controller/RmRepairRecordController.java | 88 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 88 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 b4ed99a..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,73 @@ } /** + * 鑾峰彇杩斾慨鏁版嵁鍒楄〃 + * @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") + public TableDataInfo noPagelist(RmRepairRecord rmRepairRecord) + { + List<RmRepairRecord> list = rmRepairRecordService.selectRmRepairRecordList(rmRepairRecord); + return getDataTable(list); + } + + /** * 瀵煎嚭杩斾慨璁板綍鍒楄〃 */ @PreAuthorize("@ss.hasPermi('rm:repairRecord:export')") -- Gitblit v1.9.3