|
@@ -1,6 +1,8 @@
|
|
|
package com.ruoyi.project.sems.controller;
|
|
|
|
|
|
+import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
+import java.io.OutputStream;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
@@ -11,20 +13,19 @@ import com.ruoyi.common.thread.SpecDevYlgdThread;
|
|
|
import com.ruoyi.common.thread.SpecDevYlrqThread;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.file.ExcelUtils;
|
|
|
-import com.ruoyi.project.sems.domain.TSpecCheck;
|
|
|
-import com.ruoyi.project.sems.domain.TSpecdevYlrq;
|
|
|
+import com.ruoyi.project.sems.domain.*;
|
|
|
import com.ruoyi.project.sems.service.ITSpecCheckService;
|
|
|
import com.ruoyi.project.system.domain.SysDept;
|
|
|
import com.ruoyi.project.system.domain.SysDictData;
|
|
|
import com.ruoyi.project.system.service.ISysDeptService;
|
|
|
import com.ruoyi.project.system.service.ISysDictTypeService;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
+import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
|
|
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
|
|
-import com.ruoyi.project.sems.domain.TSpecdevYlgd;
|
|
|
import com.ruoyi.project.sems.service.ITSpecdevYlgdService;
|
|
|
import com.ruoyi.framework.web.controller.BaseController;
|
|
|
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
@@ -431,4 +432,106 @@ public class TSpecdevYlgdController extends BaseController {
|
|
|
logger.info("failRow:" + String.valueOf(failRow));
|
|
|
return AjaxResult.success(String.valueOf(successNumber), failRow);
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping("/exportDevList")
|
|
|
+ public AjaxResult exportbmy(ParamData params) throws IOException {
|
|
|
+ logger.info(JSON.toJSONString(params));
|
|
|
+ String id = params.getIds();
|
|
|
+ String[] ids = id.split(",");
|
|
|
+ List<TSpecdevYlgd> list = new ArrayList<>();
|
|
|
+ for (String i : ids
|
|
|
+ ) {
|
|
|
+ TSpecdevYlgd t = tSpecdevYlgdService.getById(i);
|
|
|
+ list.add(t);
|
|
|
+ }
|
|
|
+ SXSSFWorkbook wb = new SXSSFWorkbook(1000);
|
|
|
+ CellStyle wrapStyle = wb.createCellStyle();
|
|
|
+ wrapStyle.setWrapText(true); //设置自动换行
|
|
|
+ //创建sheet页
|
|
|
+ Sheet sheet = wb.createSheet("sheet1");
|
|
|
+ //设置列的宽度,第一个参数为列的序号,从0开始,第二参数为列宽,单位1/256个字节
|
|
|
+ sheet.setColumnWidth(0, 12*256);
|
|
|
+ sheet.setColumnWidth(1, 26*256);
|
|
|
+ sheet.setColumnWidth(2, 26*256);
|
|
|
+ sheet.setColumnWidth(3, 26*256);
|
|
|
+ sheet.setColumnWidth(4, 26*256);
|
|
|
+ sheet.setColumnWidth(5, 26*256);
|
|
|
+ sheet.setColumnWidth(6, 26*256);
|
|
|
+ sheet.setColumnWidth(7, 26*256);
|
|
|
+ sheet.setColumnWidth(8, 40*256);
|
|
|
+ sheet.setColumnWidth(9, 40*256);
|
|
|
+ sheet.setColumnWidth(10, 26*256);
|
|
|
+ sheet.setColumnWidth(11, 26*256);
|
|
|
+ sheet.setColumnWidth(12, 40*256);
|
|
|
+ sheet.setColumnWidth(13, 40*256);
|
|
|
+ //设置开始行和开始列
|
|
|
+
|
|
|
+ Row row0 = sheet.createRow(0);
|
|
|
+ CellStyle style = wb.createCellStyle();
|
|
|
+ style.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
|
|
|
+ style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
|
|
+// Font headerFont = wb.createFont();
|
|
|
+// headerFont.setFontName("Arial");
|
|
|
+// headerFont.setFontHeightInPoints((short) 12);
|
|
|
+// headerFont.setBold(false);
|
|
|
+// headerFont.setColor(IndexedColors.BLACK.getIndex());
|
|
|
+// style.setFont(headerFont);
|
|
|
+ Cell cell0 = row0.createCell(0);
|
|
|
+ row0.createCell(0).setCellValue("序号");
|
|
|
+ row0.createCell(1).setCellValue("装置");
|
|
|
+ row0.createCell(2).setCellValue("管道名称");
|
|
|
+ row0.createCell(3).setCellValue("管道编号");
|
|
|
+ row0.createCell(4).setCellValue("使用登记表编号");
|
|
|
+ row0.createCell(5).setCellValue("检验单位");row0.getCell(5).setCellStyle(style);
|
|
|
+ row0.createCell(6).setCellValue("定期检验日期");row0.getCell(6).setCellStyle(style);
|
|
|
+ row0.createCell(7).setCellValue("安全状况等级");row0.getCell(7).setCellStyle(style);
|
|
|
+ row0.createCell(8).setCellValue("定期检验报告编号");row0.getCell(8).setCellStyle(style);
|
|
|
+ row0.createCell(9).setCellValue("下次定期检验日期");row0.getCell(9).setCellStyle(style);
|
|
|
+
|
|
|
+ row0.createCell(10).setCellValue("年度检查日期");row0.getCell(10).setCellStyle(style);
|
|
|
+ row0.createCell(11).setCellValue("年度检查结论");row0.getCell(11).setCellStyle(style);
|
|
|
+ row0.createCell(12).setCellValue("下次年度检查日期");row0.getCell(12).setCellStyle(style);
|
|
|
+ row0.createCell(13).setCellValue("年度检查报告编号");row0.getCell(13).setCellStyle(style);
|
|
|
+
|
|
|
+ //填充数据
|
|
|
+ int rowIndex = 1;
|
|
|
+ int columnIndex = 1;
|
|
|
+ for (TSpecdevYlgd t: list
|
|
|
+ ) {
|
|
|
+ Row row = sheet.createRow(rowIndex);
|
|
|
+ row.createCell(0).setCellValue(t.getId());
|
|
|
+ row.createCell(1).setCellValue(t.getPlantCode());
|
|
|
+ row.createCell(2).setCellValue(t.getDevname());
|
|
|
+ row.createCell(3).setCellValue(t.getDevno());
|
|
|
+ row.createCell(4).setCellValue(t.getUseno());
|
|
|
+ row.createCell(5).setCellValue(t.getCheckUnit());
|
|
|
+ if (t.getWarnDate()!= null){
|
|
|
+ row.createCell(6).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getWarnDate()));
|
|
|
+ }
|
|
|
+
|
|
|
+ row.createCell(7).setCellValue(t.getSafeClass());
|
|
|
+ row.createCell(8).setCellValue(t.getReportNo());
|
|
|
+ if (t.getNextWarnDate()!= null){
|
|
|
+ row.createCell(9).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getNextWarnDate()));
|
|
|
+ }
|
|
|
+ if (t.getYearWarnDate()!= null){
|
|
|
+ row.createCell(10).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getYearWarnDate()));
|
|
|
+ }
|
|
|
+
|
|
|
+ row.createCell(11).setCellValue(t.getCheckConclusion());
|
|
|
+ if (t.getYearNextWarnDate()!= null){
|
|
|
+ row.createCell(12).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getYearNextWarnDate()));
|
|
|
+ }
|
|
|
+ row.createCell(13).setCellValue(t.getYearReportNo());
|
|
|
+
|
|
|
+ rowIndex++;
|
|
|
+ }
|
|
|
+ OutputStream out = null;
|
|
|
+ String filename = ExcelUtil.encodingFilename("压力管道批量更新");
|
|
|
+ out = new FileOutputStream(ExcelUtil.getAbsoluteFile(filename));
|
|
|
+ wb.write(out);
|
|
|
+ wb.close();
|
|
|
+ out.close();
|
|
|
+ return AjaxResult.success(filename);
|
|
|
+ }
|
|
|
}
|