|
@@ -2,10 +2,14 @@ package com.jeeplus.modules.sg.financial.erpcredit.util;
|
|
|
|
|
|
import com.jeeplus.modules.sg.financial.erpcredit.entity.*;
|
|
|
import com.jeeplus.modules.sg.financial.settlement.entity.MaintainData;
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFFont;
|
|
|
import org.apache.poi.hssf.util.HSSFColor;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFCell;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFFont;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFRow;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
+
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -20,11 +24,11 @@ public class ExportUtil2 {
|
|
|
XSSFRow row = (XSSFRow) sheet.getRow(0);
|
|
|
XSSFCell cell = row.getCell(3);
|
|
|
List<Schedule> scheduleList = ExportUtil1.getScheduleList(erpCredits, maintainDataList);
|
|
|
- for (int i = 1; i <=scheduleList.size(); i++) {
|
|
|
+ for (int i = 0; i <scheduleList.size(); i++) {
|
|
|
schedule = scheduleList.get(i);
|
|
|
- row=(XSSFRow)sheet.getRow(i+5);
|
|
|
+ row=(XSSFRow)sheet.getRow(i+6);
|
|
|
cell=row.getCell(0);
|
|
|
- cell.setCellValue(i);
|
|
|
+ cell.setCellValue(i+1);
|
|
|
cell=row.getCell(1);
|
|
|
cell.setCellValue(schedule.getItemId());
|
|
|
cell=row.getCell(2);
|
|
@@ -93,8 +97,9 @@ public class ExportUtil2 {
|
|
|
}
|
|
|
}
|
|
|
//移交资产—配电网资产一览表(线路)
|
|
|
- public static void getSheet5(Sheet sheet,List<ErpCredit> erpCredits){
|
|
|
+ public static void getSheet5(Sheet sheet, List<ErpCredit> erpCredits, XSSFWorkbook workbook){
|
|
|
if (null!=sheet){
|
|
|
+ CellStyle style=getCellStyle(workbook);
|
|
|
XSSFRow row = (XSSFRow) sheet.getRow(0);
|
|
|
XSSFCell cell = row.getCell(0);
|
|
|
TransferOfPower1 transferOfPower1 = null;
|
|
@@ -104,32 +109,61 @@ public class ExportUtil2 {
|
|
|
row = (XSSFRow) sheet.getRow((int)i+5);
|
|
|
cell=row.getCell(0);
|
|
|
cell.setCellValue(transferOfPower1.getPowerId());
|
|
|
+ if (i == transferOfPower1s.size() - 1){ cell.setCellStyle(style); }
|
|
|
cell=row.getCell(1);
|
|
|
cell.setCellValue(transferOfPower1.getPowerName());
|
|
|
+ if (i == transferOfPower1s.size() - 1){
|
|
|
+ cell.setCellStyle(style);
|
|
|
+ }
|
|
|
cell=row.getCell(2);
|
|
|
cell.setCellValue(transferOfPower1.getPowerArea());
|
|
|
+ if (i == transferOfPower1s.size() - 1){
|
|
|
+ cell.setCellStyle(style);
|
|
|
+ }
|
|
|
cell=row.getCell(3);
|
|
|
cell.setCellValue(transferOfPower1.getPowerDepartment());
|
|
|
+ if (i == transferOfPower1s.size() - 1){
|
|
|
+ cell.setCellStyle(style);
|
|
|
+ }
|
|
|
cell=row.getCell(4);
|
|
|
cell.setCellValue(transferOfPower1.getPowerTenKvLineLength());
|
|
|
+ if (i == transferOfPower1s.size() - 1){
|
|
|
+ cell.setCellStyle(style);
|
|
|
+ }
|
|
|
cell=row.getCell(5);
|
|
|
cell.setCellValue(transferOfPower1.getPowerTenKvCableType());
|
|
|
+ if (i == transferOfPower1s.size() - 1){
|
|
|
+ cell.setCellStyle(style);
|
|
|
+ }
|
|
|
cell=row.getCell(6);
|
|
|
cell.setCellValue(transferOfPower1.getPowerBuildFee());
|
|
|
+ if (i == transferOfPower1s.size() - 1){
|
|
|
+ cell.setCellStyle(style);
|
|
|
+ }
|
|
|
cell=row.getCell(7);
|
|
|
cell.setCellValue(transferOfPower1.getPowerInstallFee());
|
|
|
+ if (i == transferOfPower1s.size() - 1){
|
|
|
+ cell.setCellStyle(style);
|
|
|
+ }
|
|
|
cell=row.getCell(8);
|
|
|
cell.setCellValue(transferOfPower1.getPowerStandInFee());
|
|
|
+ if (i == transferOfPower1s.size() - 1){
|
|
|
+ cell.setCellStyle(style);
|
|
|
+ }
|
|
|
cell=row.getCell(9);
|
|
|
cell.setCellValue(transferOfPower1.getPowerDeliveredAssets());
|
|
|
+ if (i == transferOfPower1s.size() - 1){
|
|
|
+ cell.setCellStyle(style);
|
|
|
+ }
|
|
|
cell=row.getCell(10);
|
|
|
cell.setCellValue(transferOfPower1.getPoweRequipmentFee());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//移交资产—配电网资产一览表(设备)
|
|
|
- public static void getSheet6(Sheet sheet,List<ErpCredit> erpCredits){
|
|
|
+ public static void getSheet6(Sheet sheet,List<ErpCredit> erpCredits,Workbook workbook){
|
|
|
if (sheet!=null){
|
|
|
+ CellStyle style=getCellStyle(workbook);
|
|
|
XSSFRow row = (XSSFRow) sheet.getRow(0);
|
|
|
XSSFCell cell = row.getCell(0);
|
|
|
TransferOfPower2 transferOfPower2 = null;
|
|
@@ -139,26 +173,37 @@ public class ExportUtil2 {
|
|
|
row = (XSSFRow) sheet.getRow((int)i+5);
|
|
|
cell=row.getCell(0);
|
|
|
cell.setCellValue(transferOfPower2.getPowerId());//项目定义编号
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(1);
|
|
|
cell.setCellValue(transferOfPower2.getPowerName());//配电网资产名称
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(2);
|
|
|
cell.setCellValue(transferOfPower2.getPowerArea());////线路起止地点或配变所在滴
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(3);
|
|
|
cell.setCellValue(transferOfPower2.getPowerDepartment());//保管部门
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(4);
|
|
|
cell.setCellValue(transferOfPower2.getPowerNumber());//配变数量
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(5);
|
|
|
cell.setCellValue(transferOfPower2.getPowerUnit());//计量单位
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(6);
|
|
|
cell.setCellValue(transferOfPower2.getPowerCapacity());//配变容量
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(7);
|
|
|
cell.setCellValue(transferOfPower2.getPowerValue());//设备价值
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(8);
|
|
|
cell.setCellValue(transferOfPower2.getPowerStandInFee());//摊入费用
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(9);
|
|
|
cell.setCellValue(transferOfPower2.getPowerDeliveredAssets());//交付使用资产价值
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(10);
|
|
|
cell.setCellValue(transferOfPower2.getPoweRequipmentFee());//其中:附属设备价值
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -193,8 +238,9 @@ public class ExportUtil2 {
|
|
|
}
|
|
|
|
|
|
//移交资产—配电网资产一览表(线路)1
|
|
|
- public static void getSheet10(Sheet sheet,List<ErpCredit> erpCredits){
|
|
|
+ public static void getSheet10(Sheet sheet,List<ErpCredit> erpCredits,Workbook workbook){
|
|
|
if (null!=sheet){
|
|
|
+ CellStyle style=getCellStyle(workbook);
|
|
|
XSSFRow row = (XSSFRow) sheet.getRow(0);
|
|
|
XSSFCell cell = row.getCell(0);
|
|
|
TransferOfPower1 transferOfPower1 = null;
|
|
@@ -206,34 +252,47 @@ public class ExportUtil2 {
|
|
|
cell.setCellValue(transferOfPower1.getPowerId());
|
|
|
cell=row.getCell(1);
|
|
|
cell.setCellValue(transferOfPower1.getPowerName());
|
|
|
+ if (i == transferOfPower1s.size() - 1){ cell.setCellStyle(style); }
|
|
|
cell=row.getCell(2);
|
|
|
cell.setCellValue(transferOfPower1.getPowerNumberBars());
|
|
|
+ if (i == transferOfPower1s.size() - 1){ cell.setCellStyle(style); }
|
|
|
cell=row.getCell(3);
|
|
|
cell.setCellValue(transferOfPower1.getPowerAssetClass());
|
|
|
+ if (i == transferOfPower1s.size() - 1){ cell.setCellStyle(style); }
|
|
|
cell=row.getCell(4);
|
|
|
cell.setCellValue(transferOfPower1.getPowerArea());
|
|
|
+ if (i == transferOfPower1s.size() - 1){ cell.setCellStyle(style); }
|
|
|
cell=row.getCell(5);
|
|
|
cell.setCellValue(transferOfPower1.getPowerDepartment());
|
|
|
+ if (i == transferOfPower1s.size() - 1){ cell.setCellStyle(style); }
|
|
|
cell=row.getCell(6);
|
|
|
cell.setCellValue(transferOfPower1.getPowerTenKvLineLength());
|
|
|
+ if (i == transferOfPower1s.size() - 1){ cell.setCellStyle(style); }
|
|
|
cell=row.getCell(7);
|
|
|
cell.setCellValue(transferOfPower1.getPowerTenKvCableType());
|
|
|
+ if (i == transferOfPower1s.size() - 1){ cell.setCellStyle(style); }
|
|
|
cell=row.getCell(8);
|
|
|
cell.setCellValue(transferOfPower1.getPowerBuildFee());
|
|
|
+ if (i == transferOfPower1s.size() - 1){ cell.setCellStyle(style); }
|
|
|
cell=row.getCell(9);
|
|
|
cell.setCellValue(transferOfPower1.getPowerInstallFee());
|
|
|
+ if (i == transferOfPower1s.size() - 1){ cell.setCellStyle(style); }
|
|
|
cell=row.getCell(10);
|
|
|
cell.setCellValue(transferOfPower1.getPowerStandInFee());
|
|
|
+ if (i == transferOfPower1s.size() - 1){ cell.setCellStyle(style); }
|
|
|
cell=row.getCell(11);
|
|
|
cell.setCellValue(transferOfPower1.getPowerDeliveredAssets());
|
|
|
+ if (i == transferOfPower1s.size() - 1){ cell.setCellStyle(style); }
|
|
|
cell=row.getCell(12);
|
|
|
cell.setCellValue(transferOfPower1.getPoweRequipmentFee());
|
|
|
+ if (i == transferOfPower1s.size() - 1){ cell.setCellStyle(style); }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//移交资产—配电网资产一览表(设备)2
|
|
|
- public static void getSheet11(Sheet sheet,List<ErpCredit> erpCredits){
|
|
|
+ public static void getSheet11(Sheet sheet,List<ErpCredit> erpCredits,Workbook workbook){
|
|
|
if (sheet!=null){
|
|
|
+ CellStyle style=getCellStyle(workbook);
|
|
|
XSSFRow row = (XSSFRow) sheet.getRow(0);
|
|
|
XSSFCell cell = row.getCell(0);
|
|
|
TransferOfPower2 transferOfPower2 = null;
|
|
@@ -248,26 +307,37 @@ public class ExportUtil2 {
|
|
|
cell.setCellValue(transferOfPower2.getPowerId());//项目定义编号
|
|
|
cell=row.getCell(1);
|
|
|
cell.setCellValue(transferOfPower2.getPowerName());//配电网资产名称
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(2);
|
|
|
cell.setCellValue(transferOfPower2.getPowerAssetClass());
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(3);
|
|
|
cell.setCellValue(transferOfPower2.getPowerArea());////线路起止地点或配变所在滴
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(4);
|
|
|
cell.setCellValue(transferOfPower2.getPowerDepartment());//保管部门
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(5);
|
|
|
cell.setCellValue(transferOfPower2.getPowerNumber());//配变数量
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(6);
|
|
|
cell.setCellValue(transferOfPower2.getPowerUnit());//计量单位
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(7);
|
|
|
cell.setCellValue(transferOfPower2.getPowerCapacity());//配变容量
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(8);
|
|
|
cell.setCellValue(transferOfPower2.getPowerValue());//设备价值
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(9);
|
|
|
cell.setCellValue(transferOfPower2.getPowerStandInFee());//摊入费用
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(10);
|
|
|
cell.setCellValue(transferOfPower2.getPowerDeliveredAssets());//交付使用资产价值
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
cell=row.getCell(11);
|
|
|
cell.setCellValue(transferOfPower2.getPoweRequipmentFee());//其中:附属设备价值
|
|
|
+ if (i == transferOfPower2s.size() - 1){ cell.setCellStyle(style);}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -336,65 +406,29 @@ public class ExportUtil2 {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- private static Map<String, CellStyle> createStyles(Workbook wb) {
|
|
|
- Map<String, CellStyle> styles = new HashMap<String, CellStyle>();
|
|
|
-
|
|
|
- CellStyle style = wb.createCellStyle();
|
|
|
- style.setAlignment(CellStyle.ALIGN_CENTER);
|
|
|
- style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
|
|
|
- Font titleFont = wb.createFont();
|
|
|
- titleFont.setFontName("Arial");
|
|
|
- titleFont.setFontHeightInPoints((short) 16);
|
|
|
- titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
|
|
|
- style.setFont(titleFont);
|
|
|
- styles.put("title", style);
|
|
|
-
|
|
|
- style = wb.createCellStyle();
|
|
|
- style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
|
|
|
- style.setBorderRight(CellStyle.BORDER_THIN);
|
|
|
- style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
|
|
|
- style.setBorderLeft(CellStyle.BORDER_THIN);
|
|
|
- style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
|
|
|
- style.setBorderTop(CellStyle.BORDER_THIN);
|
|
|
- style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
|
|
|
- style.setBorderBottom(CellStyle.BORDER_THIN);
|
|
|
- style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
|
|
|
- Font dataFont = wb.createFont();
|
|
|
- dataFont.setFontName("Arial");
|
|
|
- dataFont.setFontHeightInPoints((short) 10);
|
|
|
- style.setFont(dataFont);
|
|
|
- styles.put("data", style);
|
|
|
-
|
|
|
- style = wb.createCellStyle();
|
|
|
- style.cloneStyleFrom(styles.get("data"));
|
|
|
- style.setAlignment(CellStyle.ALIGN_LEFT);
|
|
|
- styles.put("data1", style);
|
|
|
-
|
|
|
- style = wb.createCellStyle();
|
|
|
- style.cloneStyleFrom(styles.get("data"));
|
|
|
- style.setAlignment(CellStyle.ALIGN_CENTER);
|
|
|
- styles.put("data2", style);
|
|
|
-
|
|
|
- style = wb.createCellStyle();
|
|
|
- style.cloneStyleFrom(styles.get("data"));
|
|
|
- style.setAlignment(CellStyle.ALIGN_RIGHT);
|
|
|
- styles.put("data3", style);
|
|
|
-
|
|
|
- style = wb.createCellStyle();
|
|
|
- style.cloneStyleFrom(styles.get("data"));
|
|
|
-// style.setWrapText(true);
|
|
|
- style.setAlignment(CellStyle.ALIGN_CENTER);
|
|
|
- style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
|
|
|
- style.setFillPattern(CellStyle.SOLID_FOREGROUND);
|
|
|
- Font headerFont = wb.createFont();
|
|
|
- headerFont.setFontName("Arial");
|
|
|
- headerFont.setFontHeightInPoints((short) 10);
|
|
|
- headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
|
|
|
- headerFont.setColor(IndexedColors.BLACK.getIndex());
|
|
|
- style.setFont(headerFont);
|
|
|
- style.setFillForegroundColor(HSSFColor.WHITE.index);
|
|
|
- styles.put("header", style);
|
|
|
+ public static void getSheet8(Sheet sheet,List<ErpCredit> erpCredits,List<MaintainData> maintainDataList){
|
|
|
+ if (null!=sheet){
|
|
|
+ XSSFRow row = (XSSFRow) sheet.getRow(0);
|
|
|
+ XSSFCell cell = row.getCell(0);
|
|
|
+ MCompletionProject mCompletionProject = ExportUtil1.getMCompletionProject(erpCredits,maintainDataList);
|
|
|
+ row = (XSSFRow) sheet.getRow(6);
|
|
|
+ cell=row.getCell(5);
|
|
|
+ cell.setCellValue(mCompletionProject.getFixedAssets());
|
|
|
+ row = (XSSFRow) sheet.getRow(11);
|
|
|
+ cell=row.getCell(5);
|
|
|
+ cell.setCellValue(mCompletionProject.getVatDeduction());
|
|
|
|
|
|
- return styles;
|
|
|
+ row = (XSSFRow) sheet.getRow(15);
|
|
|
+ cell=row.getCell(2);
|
|
|
+ cell.setCellValue(mCompletionProject.getAppropriatedFunds());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public static CellStyle getCellStyle(Workbook workbook){
|
|
|
+ XSSFFont font = (XSSFFont) workbook.createFont();
|
|
|
+ font.setFontHeightInPoints((short) 12);//设置字体大小
|
|
|
+ font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);//粗体显示
|
|
|
+ CellStyle style=workbook.createCellStyle();
|
|
|
+ style.setFont(font);
|
|
|
+ return style;
|
|
|
}
|
|
|
}
|