|
@@ -1,13 +1,13 @@
|
|
|
package com.ruoyi.project.invoice.controller;
|
|
|
|
|
|
-import java.io.File;
|
|
|
-import java.io.IOException;
|
|
|
-import java.io.InputStream;
|
|
|
+import java.io.*;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.deepoove.poi.XWPFTemplate;
|
|
|
import com.deepoove.poi.data.PictureRenderData;
|
|
|
import com.deepoove.poi.data.Pictures;
|
|
@@ -23,10 +23,14 @@ import com.ruoyi.project.invoice.domain.TInvoiceContractor;
|
|
|
import com.ruoyi.project.invoice.domain.TInvoiceWorkcontent;
|
|
|
import com.ruoyi.project.invoice.service.ITInvoiceContractorService;
|
|
|
import com.ruoyi.project.invoice.service.ITInvoiceWorkcontentService;
|
|
|
+import com.ruoyi.project.sems.domain.ParamData;
|
|
|
+import com.ruoyi.project.sems.domain.TSpecdevCc;
|
|
|
import com.ruoyi.project.system.domain.SysDictData;
|
|
|
import com.ruoyi.project.system.service.ISysDictTypeService;
|
|
|
import io.jsonwebtoken.lang.Assert;
|
|
|
import org.apache.poi.ss.formula.functions.T;
|
|
|
+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.GetMapping;
|
|
@@ -97,6 +101,82 @@ public class TInvoiceBookingworkticketController extends BaseController
|
|
|
return util.exportExcel(list, "bookingworkticket");
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/exportBook")
|
|
|
+ public AjaxResult exportBook(TInvoiceBookingworkticket tInvoiceBookingworkticket) throws IOException {
|
|
|
+ logger.info(JSON.toJSONString(tInvoiceBookingworkticket));
|
|
|
+ List<TInvoiceBookingworkticket> list = tInvoiceBookingworkticketService.selectTInvoiceBookingworkticketList(tInvoiceBookingworkticket);
|
|
|
+
|
|
|
+ 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, 40*256);
|
|
|
+ sheet.setColumnWidth(11, 40*256);
|
|
|
+ sheet.setColumnWidth(12, 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.getCell(0).setCellStyle(style);
|
|
|
+ row0.createCell(1).setCellValue("作业类型");row0.getCell(1).setCellStyle(style);
|
|
|
+ row0.createCell(2).setCellValue("作业开始时间");row0.getCell(2).setCellStyle(style);
|
|
|
+ row0.createCell(3).setCellValue("作业结束时间");row0.getCell(3).setCellStyle(style);
|
|
|
+ row0.createCell(4).setCellValue("作业地址");row0.getCell(4).setCellStyle(style);
|
|
|
+ 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);
|
|
|
+ //填充数据
|
|
|
+ int rowIndex = 1;
|
|
|
+ int columnIndex = 1;
|
|
|
+ for (TInvoiceBookingworkticket t: list
|
|
|
+ ) {
|
|
|
+ Row row = sheet.createRow(rowIndex);
|
|
|
+ row.createCell(0).setCellValue(t.getId());
|
|
|
+ //
|
|
|
+ if (t.getWorkStartTime()!= null){
|
|
|
+ row.createCell(2).setCellValue(new SimpleDateFormat("yyyy/MM/dd").format(t.getWorkStartTime()));
|
|
|
+ }
|
|
|
+ rowIndex++;
|
|
|
+ }
|
|
|
+ // 总数统计
|
|
|
+ Row row1 = sheet.createRow(rowIndex);
|
|
|
+ row1.createCell(0).setCellValue("总计");
|
|
|
+
|
|
|
+ OutputStream out = null;
|
|
|
+ String filename = ExcelUtil.encodingFilename("预约票台账导出");
|
|
|
+ out = new FileOutputStream(ExcelUtil.getAbsoluteFile(filename));
|
|
|
+ wb.write(out);
|
|
|
+ wb.close();
|
|
|
+ out.close();
|
|
|
+ return AjaxResult.success(filename);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取预约作业票台账详细信息
|
|
|
*/
|