|
@@ -1,10 +1,8 @@
|
|
|
package com.ruoyi.project.sems.service.impl;
|
|
|
|
|
|
-import java.io.File;
|
|
|
-import java.io.FileOutputStream;
|
|
|
-import java.io.InputStream;
|
|
|
-import java.io.OutputStream;
|
|
|
+import java.io.*;
|
|
|
import java.net.URLEncoder;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
@@ -21,6 +19,7 @@ import com.ruoyi.framework.config.RuoYiConfig;
|
|
|
import com.ruoyi.framework.web.controller.BaseController;
|
|
|
import com.ruoyi.project.plant.domain.TStaffmgr;
|
|
|
import com.ruoyi.project.sems.domain.*;
|
|
|
+import com.ruoyi.project.sems.mapper.*;
|
|
|
import com.ruoyi.project.sems.service.*;
|
|
|
import com.ruoyi.project.system.domain.SysDictData;
|
|
|
import com.ruoyi.project.training.domain.TTraining;
|
|
@@ -32,7 +31,6 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import com.ruoyi.project.sems.mapper.TSpecReportMapper;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -60,6 +58,18 @@ public class TSpecReportServiceImpl implements ITSpecReportService {
|
|
|
private ITSpecdevYlrqService tSpecdevYlrqService;
|
|
|
@Autowired
|
|
|
private ITSpecdevCcService tSpecdevCcService;
|
|
|
+ @Resource
|
|
|
+ private TSpecdevCcMapper tSpecdevCcMapper;
|
|
|
+ @Resource
|
|
|
+ private TSpecdevYlrqMapper tSpecdevYlrqMapper;
|
|
|
+ @Resource
|
|
|
+ private TSpecdevYlgdMapper tSpecdevYlgdMapper;
|
|
|
+ @Resource
|
|
|
+ private TSpecdevGlMapper tSpecdevGlMapper;
|
|
|
+ @Resource
|
|
|
+ private TSpecdevDzsbMapper tSpecdevDzsbMapper;
|
|
|
+ @Resource
|
|
|
+ private TSpecdevDtMapper tSpecdevDtMapper;
|
|
|
|
|
|
protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
|
|
|
|
|
@@ -109,6 +119,9 @@ public class TSpecReportServiceImpl implements ITSpecReportService {
|
|
|
replaceExcelByHi(wb);
|
|
|
replaceExcelExpireByThreeMonth(wb);
|
|
|
replaceExcelExpire(wb);
|
|
|
+ //创建明细excel
|
|
|
+ String detailUrl = createDetailExcel(tSpecReport);
|
|
|
+
|
|
|
// Save the generated file
|
|
|
File dir = new File(fileDir);
|
|
|
if (!dir.exists()) {
|
|
@@ -128,6 +141,7 @@ public class TSpecReportServiceImpl implements ITSpecReportService {
|
|
|
String pathFileName = Constants.RESOURCE_PREFIX + "/" + currentDir ;
|
|
|
tSpecReport.setReportUrl(pathFileName);
|
|
|
tSpecReport.setReportName(dateStr + "报告");
|
|
|
+ tSpecReport.setDetailUrl(detailUrl);
|
|
|
tSpecReportMapper.updateTSpecReport(tSpecReport);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -546,4 +560,487 @@ public class TSpecReportServiceImpl implements ITSpecReportService {
|
|
|
public int deleteTSpecReportById(Long id) {
|
|
|
return tSpecReportMapper.deleteTSpecReportById(id);
|
|
|
}
|
|
|
+
|
|
|
+ private String createDetailExcel(TSpecReport tSpecReport) {
|
|
|
+ SXSSFWorkbook wb = new SXSSFWorkbook(1000);
|
|
|
+ CellStyle wrapStyle = wb.createCellStyle();
|
|
|
+ wrapStyle.setWrapText(true); //设置自动换行
|
|
|
+ //
|
|
|
+ replaceDetailYrlq(wb);
|
|
|
+ replaceDetailYrgd(wb);
|
|
|
+ replaceDetailGl(wb);
|
|
|
+ replaceDetailDt(wb);
|
|
|
+ replaceDetailDzsb(wb);
|
|
|
+ replaceDetailCc(wb);
|
|
|
+
|
|
|
+
|
|
|
+ try {
|
|
|
+ String fileDir = RuoYiConfig.getProfile() + "/" + "sems/spec-report-detail";
|
|
|
+ // Save the generated file
|
|
|
+ File dir = new File(fileDir);
|
|
|
+ if (!dir.exists()) {
|
|
|
+ logger.info("目录不存在,创建文件夹{}!", fileDir);
|
|
|
+ dir.mkdirs();
|
|
|
+ }
|
|
|
+ FileOutputStream fos = null;
|
|
|
+ LocalDate currentDate = LocalDate.now();
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
|
|
+ String dateStr = currentDate.format(formatter);
|
|
|
+ String filePath = fileDir + "/" + dateStr + "ReportDetail" + tSpecReport.getId() +".xlsx";
|
|
|
+
|
|
|
+ fos = new FileOutputStream(filePath);
|
|
|
+
|
|
|
+ wb.write(fos);
|
|
|
+ //
|
|
|
+ int dirLastIndex = RuoYiConfig.getProfile().length() + 1;
|
|
|
+ String currentDir = StringUtils.substring(filePath, dirLastIndex);
|
|
|
+ String pathFileName = Constants.RESOURCE_PREFIX + "/" + currentDir ;
|
|
|
+ return pathFileName;
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ private void replaceDetailYrlq(SXSSFWorkbook wb) {
|
|
|
+ List<TSpecdevYlrq> list = tSpecdevYlrqMapper.selectExpiredYlrq();
|
|
|
+ //创建sheet页
|
|
|
+ Sheet sheet = wb.createSheet("压力容器");
|
|
|
+ //设置列的宽度,第一个参数为列的序号,从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.createCell(6).setCellValue("定期检验日期");
|
|
|
+ row0.createCell(7).setCellValue("安全状况等级");
|
|
|
+ row0.createCell(8).setCellValue("下次定期检验日期");
|
|
|
+ row0.createCell(9).setCellValue("定期检验报告编号");
|
|
|
+
|
|
|
+ row0.createCell(10).setCellValue("年度检查日期");
|
|
|
+ row0.createCell(11).setCellValue("年度检查结论");
|
|
|
+ row0.createCell(12).setCellValue("下次年度检查日期");
|
|
|
+ row0.createCell(13).setCellValue("年度检查报告编号");
|
|
|
+ row0.createCell(14).setCellValue("备注");
|
|
|
+
|
|
|
+ //填充数据
|
|
|
+ int rowIndex = 1;
|
|
|
+ int columnIndex = 1;
|
|
|
+ for (TSpecdevYlrq t : list
|
|
|
+ ) {
|
|
|
+ Row row = sheet.createRow(rowIndex);
|
|
|
+ row.createCell(0).setCellValue(t.getId());
|
|
|
+ row.createCell(1).setCellValue(t.getPlantCode());
|
|
|
+ row.createCell(2).setCellValue(t.getDevno());
|
|
|
+ row.createCell(3).setCellValue(t.getDevname());
|
|
|
+ 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());
|
|
|
+ if (t.getNextWarnDate() != null) {
|
|
|
+ row.createCell(8).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getNextWarnDate()));
|
|
|
+ }
|
|
|
+ row.createCell(9).setCellValue(t.getReportNo());
|
|
|
+ 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());
|
|
|
+ row.createCell(14).setCellValue(t.getRemarks());
|
|
|
+ rowIndex++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void replaceDetailYrgd(SXSSFWorkbook wb) {
|
|
|
+ List<TSpecdevYlgd> list = tSpecdevYlgdMapper.selectExpiredYlgd();
|
|
|
+ //创建sheet页
|
|
|
+ Sheet sheet = wb.createSheet("压力管道");
|
|
|
+ //设置列的宽度,第一个参数为列的序号,从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();
|
|
|
+
|
|
|
+// 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);
|
|
|
+ row0.createCell(14).setCellValue("备注");
|
|
|
+ row0.getCell(14).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());
|
|
|
+ row.createCell(14).setCellValue(t.getRemarks());
|
|
|
+ rowIndex++;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ private void replaceDetailGl(SXSSFWorkbook wb) {
|
|
|
+ List<TSpecdevGl> list = tSpecdevGlMapper.selectExpiredGl();
|
|
|
+ //创建sheet页
|
|
|
+ Sheet sheet = wb.createSheet("锅炉");
|
|
|
+ //设置列的宽度,第一个参数为列的序号,从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();
|
|
|
+
|
|
|
+// 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);
|
|
|
+ row0.createCell(14).setCellValue("备注");row0.getCell(14).setCellStyle(style);
|
|
|
+ //填充数据
|
|
|
+ int rowIndex = 1;
|
|
|
+ int columnIndex = 1;
|
|
|
+ for (TSpecdevGl t: list
|
|
|
+ ) {
|
|
|
+ Row row = sheet.createRow(rowIndex);
|
|
|
+ row.createCell(0).setCellValue(t.getId());
|
|
|
+ row.createCell(1).setCellValue(t.getPlantCode());
|
|
|
+ row.createCell(2).setCellValue(t.getDevno());
|
|
|
+ row.createCell(3).setCellValue(t.getDevname());
|
|
|
+ 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.getCheckConclusion());
|
|
|
+ row.createCell(8).setCellValue(t.getReportNo());
|
|
|
+ if (t.getNextWarnDate()!= null){
|
|
|
+ row.createCell(9).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getNextWarnDate()));
|
|
|
+ }
|
|
|
+ if (t.getOutWarnDate()!= null){
|
|
|
+ row.createCell(10).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getOutWarnDate()));
|
|
|
+ }
|
|
|
+ row.createCell(11).setCellValue(t.getOutCheckConclusion());
|
|
|
+ row.createCell(12).setCellValue(t.getOutReportNo());
|
|
|
+ if (t.getOutNextWarnDate()!= null){
|
|
|
+ row.createCell(13).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getOutNextWarnDate()));
|
|
|
+ }
|
|
|
+ row.createCell(14).setCellValue(t.getRemarks());
|
|
|
+ rowIndex++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void replaceDetailDt(SXSSFWorkbook wb) {
|
|
|
+ List<TSpecdevDt> list = tSpecdevDtMapper.selectExpiredDt();
|
|
|
+ //创建sheet页
|
|
|
+ Sheet sheet = wb.createSheet("电梯");
|
|
|
+ //设置列的宽度,第一个参数为列的序号,从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);
|
|
|
+ //设置开始行和开始列
|
|
|
+
|
|
|
+ Row row0 = sheet.createRow(0);
|
|
|
+ CellStyle style = wb.createCellStyle();
|
|
|
+
|
|
|
+// 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);
|
|
|
+ //填充数据
|
|
|
+ int rowIndex = 1;
|
|
|
+ int columnIndex = 1;
|
|
|
+ for (TSpecdevDt t : list
|
|
|
+ ) {
|
|
|
+ Row row = sheet.createRow(rowIndex);
|
|
|
+ row.createCell(0).setCellValue(t.getId());
|
|
|
+ row.createCell(1).setCellValue(t.getPlantCode());
|
|
|
+ row.createCell(2).setCellValue(t.getDocno());
|
|
|
+ row.createCell(3).setCellValue(t.getModel());
|
|
|
+ row.createCell(4).setCellValue(t.getLocation());
|
|
|
+ if (t.getWarnDate() != null) {
|
|
|
+ row.createCell(5).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getWarnDate()));
|
|
|
+ }
|
|
|
+ row.createCell(6).setCellValue(t.getCheckUnit());
|
|
|
+ row.createCell(7).setCellValue(t.getReportNo());
|
|
|
+ if (t.getNextWarnDate() != null) {
|
|
|
+ row.createCell(8).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getNextWarnDate()));
|
|
|
+ }
|
|
|
+ row.createCell(9).setCellValue(t.getPerTestConclusion());
|
|
|
+ row.createCell(10).setCellValue(t.getRemarks());
|
|
|
+ rowIndex++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void replaceDetailDzsb(SXSSFWorkbook wb) {
|
|
|
+ List<TSpecdevDzsb> list = tSpecdevDzsbMapper.selectExpiredDzsb();
|
|
|
+ //创建sheet页
|
|
|
+ Sheet sheet = wb.createSheet("起重机械");
|
|
|
+ //设置列的宽度,第一个参数为列的序号,从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);
|
|
|
+ //设置开始行和开始列
|
|
|
+
|
|
|
+ Row row0 = sheet.createRow(0);
|
|
|
+ CellStyle style = wb.createCellStyle();
|
|
|
+// 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);
|
|
|
+ //填充数据
|
|
|
+ int rowIndex = 1;
|
|
|
+ int columnIndex = 1;
|
|
|
+ for (TSpecdevDzsb t : list
|
|
|
+ ) {
|
|
|
+ Row row = sheet.createRow(rowIndex);
|
|
|
+ row.createCell(0).setCellValue(t.getId());
|
|
|
+ row.createCell(1).setCellValue(t.getPlantCode());
|
|
|
+ row.createCell(2).setCellValue(t.getDevno());
|
|
|
+ row.createCell(3).setCellValue(t.getDocno());
|
|
|
+ row.createCell(4).setCellValue(t.getDevname());
|
|
|
+ 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.getReportNo());
|
|
|
+ if (t.getNextWarnDate() != null) {
|
|
|
+ row.createCell(8).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getNextWarnDate()));
|
|
|
+ }
|
|
|
+ row.createCell(9).setCellValue(t.getPerTestConclusion());
|
|
|
+ row.createCell(10).setCellValue(t.getRemarks());
|
|
|
+ rowIndex++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void replaceDetailCc(SXSSFWorkbook wb) {
|
|
|
+ List<TSpecdevCc> list = tSpecdevCcMapper.selectExpiredCc();
|
|
|
+ //创建sheet页
|
|
|
+ Sheet sheet = wb.createSheet("叉车");
|
|
|
+ //设置列的宽度,第一个参数为列的序号,从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);
|
|
|
+ //设置开始行和开始列
|
|
|
+
|
|
|
+ Row row0 = sheet.createRow(0);
|
|
|
+ CellStyle style = wb.createCellStyle();
|
|
|
+ style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
|
|
+ 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.createCell(6).setCellValue("报告编号");
|
|
|
+ row0.createCell(7).setCellValue("定期检验结论");
|
|
|
+ row0.createCell(8).setCellValue("备注");
|
|
|
+ //填充数据
|
|
|
+ int rowIndex = 1;
|
|
|
+ int columnIndex = 1;
|
|
|
+ for (TSpecdevCc t : list
|
|
|
+ ) {
|
|
|
+ Row row = sheet.createRow(rowIndex);
|
|
|
+ row.createCell(0).setCellValue(t.getId());
|
|
|
+ row.createCell(1).setCellValue(t.getPlantCode());
|
|
|
+ row.createCell(2).setCellValue(t.getCarNo());
|
|
|
+ row.createCell(3).setCellValue(t.getDocno());
|
|
|
+ if (t.getWarnDate() != null) {
|
|
|
+ row.createCell(4).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getWarnDate()));
|
|
|
+ }
|
|
|
+ if (t.getNextWarnDate() != null) {
|
|
|
+ row.createCell(5).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getNextWarnDate()));
|
|
|
+ }
|
|
|
+ row.createCell(6).setCellValue(t.getReportNo());
|
|
|
+ row.createCell(7).setCellValue(t.getPerTestConclusion());
|
|
|
+ row.createCell(8).setCellValue(t.getRemarks());
|
|
|
+ rowIndex++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|