|
@@ -24,6 +24,7 @@ import org.apache.poi.ss.usermodel.CellStyle;
|
|
|
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
import org.apache.poi.ss.util.CellRangeAddress;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -31,6 +32,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.swing.*;
|
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
@@ -118,6 +120,9 @@ public class TPssrMaterialController extends BaseController {
|
|
|
Row originalRow = sheet.getRow(3);
|
|
|
Cell originalcell = originalRow.getCell(0);
|
|
|
CellStyle originalStyle = originalcell.getCellStyle();
|
|
|
+ CellStyle originalStyleCopy = wb.createCellStyle();
|
|
|
+ originalStyleCopy.cloneStyleFrom(originalStyle);
|
|
|
+ originalStyleCopy.setAlignment(HorizontalAlignment.LEFT);
|
|
|
for (TPssrMaterial t : list1) {
|
|
|
Row row = sheet.createRow(rowIndex);
|
|
|
row.setHeight((short) 800);
|
|
@@ -195,7 +200,7 @@ public class TPssrMaterialController extends BaseController {
|
|
|
title2.createCell(3);
|
|
|
title2.createCell(4);
|
|
|
for (int i = 0; i < 5; i++) {
|
|
|
- title2.getCell(i).setCellStyle(originalStyle);
|
|
|
+ title2.getCell(i).setCellStyle(originalStyleCopy);
|
|
|
}
|
|
|
CellRangeAddress cellRangeAddress1 = new CellRangeAddress(rowIndex, rowIndex, 0, 4);
|
|
|
sheet.addMergedRegion(cellRangeAddress1);
|
|
@@ -208,7 +213,7 @@ public class TPssrMaterialController extends BaseController {
|
|
|
title3.createCell(3);
|
|
|
title3.createCell(4);
|
|
|
for (int i = 0; i < 5; i++) {
|
|
|
- title3.getCell(i).setCellStyle(originalStyle);
|
|
|
+ title3.getCell(i).setCellStyle(originalStyleCopy);
|
|
|
}
|
|
|
CellRangeAddress cellRangeAddress2 = new CellRangeAddress(rowIndex, rowIndex, 0, 4);
|
|
|
sheet.addMergedRegion(cellRangeAddress2);
|
|
@@ -220,10 +225,17 @@ public class TPssrMaterialController extends BaseController {
|
|
|
title4.createCell(0);
|
|
|
title4.createCell(1);
|
|
|
title4.createCell(2);
|
|
|
- title4.createCell(3);
|
|
|
- title4.createCell(4).setCellValue("确认人:");
|
|
|
+ title4.createCell(3).setCellValue("确认人:");
|
|
|
+ title4.createCell(4);
|
|
|
+ try {
|
|
|
+ SysUser sysUser = sysUserService.selectUserById(Long.valueOf(list1.get(0).getConfirm1()));
|
|
|
+ String confirm = sysUser.getSignUrl();
|
|
|
+ ExcelUtils.insertPicture(wb, sheet, confirm, rowIndex, 4, 0.25, 1);
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
for (int i = 0; i < 5; i++) {
|
|
|
- title4.getCell(i).setCellStyle(originalStyle);
|
|
|
+ title4.getCell(i).setCellStyle(originalStyleCopy);
|
|
|
}
|
|
|
rowIndex++;
|
|
|
|
|
@@ -233,10 +245,10 @@ public class TPssrMaterialController extends BaseController {
|
|
|
title5.createCell(0);
|
|
|
title5.createCell(1);
|
|
|
title5.createCell(2);
|
|
|
- title5.createCell(3);
|
|
|
- title5.createCell(4).setCellValue("确认时间:");
|
|
|
+ title5.createCell(3).setCellValue("确认时间:");
|
|
|
+ title5.createCell(4).setCellValue(DateUtils.dateTime(list1.get(0).getConfirmationDate()));
|
|
|
for (int i = 0; i < 5; i++) {
|
|
|
- title5.getCell(i).setCellStyle(originalStyle);
|
|
|
+ title5.getCell(i).setCellStyle(originalStyleCopy);
|
|
|
}
|
|
|
rowIndex++;
|
|
|
|