|
@@ -13,11 +13,13 @@ import com.jeeplus.modules.sg.raiseCapitalDesign.entity.CableSectionData;
|
|
|
import com.jeeplus.modules.sg.raiseCapitalDesign.entity.CableSectionInfo;
|
|
|
import com.jeeplus.modules.sg.raiseCapitalDesign.entity.VoltageData;
|
|
|
import com.jeeplus.modules.sg.raiseCapitalDesign.entity.VoltageInfo;
|
|
|
+import com.jeeplus.modules.sys.utils.DictUtils;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFFont;
|
|
|
import org.apache.poi.ss.usermodel.CellStyle;
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
+import org.apache.poi.ss.util.CellRangeAddress;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFCell;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFFont;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFRow;
|
|
@@ -497,6 +499,9 @@ public class RaiseCapitalDesignExportUtil {
|
|
|
//获取最大的一个list长度,作为最终的行号
|
|
|
int num=a[a.length-1];
|
|
|
|
|
|
+ //获取电缆分段的系数
|
|
|
+ String cableFactor = DictUtils.getDictLabel("cableFactor", "designCalculateCoefficient", "");
|
|
|
+
|
|
|
for (int i = 1; i <= num; i++) {
|
|
|
row = (XSSFRow) sheet.createRow((int) i + 1);
|
|
|
CableSectionInfo cableFourHundred = null; //3×400mm²
|
|
@@ -504,34 +509,131 @@ public class RaiseCapitalDesignExportUtil {
|
|
|
cableFourHundred = cableFourHundredList.get(i-1);
|
|
|
//对数据进行处理
|
|
|
disposeCableRowData(row,0,cableFourHundred,cellStyle);
|
|
|
+ }else{
|
|
|
+ disposeCableRowNoData(row,0,cableFactor,cellStyle);
|
|
|
}
|
|
|
CableSectionInfo cableThreeHundred = null; //3×300mm²
|
|
|
if(cableThreeHundredList.size()>=i){
|
|
|
cableThreeHundred = cableThreeHundredList.get(i-1);
|
|
|
disposeCableRowData(row,8,cableThreeHundred,cellStyle);
|
|
|
+ }else{
|
|
|
+ disposeCableRowNoData(row,8,cableFactor,cellStyle);
|
|
|
}
|
|
|
CableSectionInfo cableTwoHundredForty = null; //3×240mm²
|
|
|
if(cableTwoHundredFortyList.size()>=i){
|
|
|
cableTwoHundredForty = cableTwoHundredFortyList.get(i-1);
|
|
|
disposeCableRowData(row,16,cableTwoHundredForty,cellStyle);
|
|
|
+ }else{
|
|
|
+ disposeCableRowNoData(row,16,cableFactor,cellStyle);
|
|
|
}
|
|
|
CableSectionInfo cableHundredAndTwenty = null; //3×120mm²
|
|
|
if(cableHundredAndTwentyList.size()>=i){
|
|
|
cableHundredAndTwenty = cableHundredAndTwentyList.get(i-1);
|
|
|
disposeCableRowData(row,24,cableHundredAndTwenty,cellStyle);
|
|
|
+ }else{
|
|
|
+ disposeCableRowNoData(row,24,cableFactor,cellStyle);
|
|
|
}
|
|
|
CableSectionInfo cableSeventy = null; //3×70mm²
|
|
|
if(cableSeventyList.size()>=i){
|
|
|
cableSeventy = cableSeventyList.get(i-1);
|
|
|
disposeCableRowData(row,32,cableSeventy,cellStyle);
|
|
|
+ }else{
|
|
|
+ disposeCableRowNoData(row,32,cableFactor,cellStyle);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
+
|
|
|
+ //处理总数行
|
|
|
+ row = (XSSFRow) sheet.createRow(num + 2);
|
|
|
+ disposeCableRowOverallLength(row,num + 2,0,cellStyle,sheet,cableSectionData.getCableFourHundredListTotal());
|
|
|
+ disposeCableRowOverallLength(row,num + 2,8,cellStyle,sheet,cableSectionData.getCableThreeHundredListTotal());
|
|
|
+ disposeCableRowOverallLength(row,num + 2,16,cellStyle,sheet,cableSectionData.getCableTwoHundredFortyListTotal());
|
|
|
+ disposeCableRowOverallLength(row,num + 2,24,cellStyle,sheet,cableSectionData.getCableHundredAndTwentyListTotal());
|
|
|
+ disposeCableRowOverallLength(row,num + 2,32,cellStyle,sheet,cableSectionData.getCableSeventyListTotal());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 架空导线表数据处理
|
|
|
+ *
|
|
|
+ * @param row 行信息
|
|
|
+ * @param lineNum 行数
|
|
|
+ * @param columnNum 起始列
|
|
|
+ * @param cellStyle 截至列
|
|
|
+ * @param sheet
|
|
|
+ */
|
|
|
+ private static void disposeCableRowOverallLength(XSSFRow row, Integer lineNum, Integer columnNum, CellStyle cellStyle, Sheet sheet,String cableTotal){
|
|
|
+ XSSFCell cell = row.getCell(1);
|
|
|
+
|
|
|
+ if (row.getCell(columnNum) == null) {
|
|
|
+ cell = row.createCell(columnNum);
|
|
|
+ } else {
|
|
|
+ cell = row.getCell(columnNum);
|
|
|
+ }
|
|
|
+ cell.setCellValue("总长(km):");
|
|
|
+ cell.setCellStyle(cellStyle);
|
|
|
+
|
|
|
+ //第二列
|
|
|
+ if (row.getCell(columnNum+1) == null) {
|
|
|
+ cell = row.createCell(columnNum+1);
|
|
|
+ } else {
|
|
|
+ cell = row.getCell(columnNum+1);
|
|
|
+ }
|
|
|
+ cell.setCellValue("");//空行
|
|
|
+ cell.setCellStyle(cellStyle);
|
|
|
+
|
|
|
+ //第三列
|
|
|
+ if (row.getCell(columnNum+2) == null) {
|
|
|
+ cell = row.createCell(columnNum+2);
|
|
|
+ } else {
|
|
|
+ cell = row.getCell(columnNum+2);
|
|
|
+ }
|
|
|
+ cell.setCellValue("");//空行
|
|
|
+ cell.setCellStyle(cellStyle);
|
|
|
+
|
|
|
+ //第四列
|
|
|
+ if (row.getCell(columnNum+3) == null) {
|
|
|
+ cell = row.createCell(columnNum+3);
|
|
|
+ } else {
|
|
|
+ cell = row.getCell(columnNum+3);
|
|
|
+ }
|
|
|
+ cell.setCellValue("");//空行
|
|
|
+ cell.setCellStyle(cellStyle);
|
|
|
+
|
|
|
+ //第五列
|
|
|
+ if (row.getCell(columnNum+4) == null) {
|
|
|
+ cell = row.createCell(columnNum+4);
|
|
|
+ } else {
|
|
|
+ cell = row.getCell(columnNum+4);
|
|
|
+ }
|
|
|
+ cell.setCellValue("");//空行
|
|
|
+ cell.setCellStyle(cellStyle);
|
|
|
+
|
|
|
+ //第六列
|
|
|
+ if (row.getCell(columnNum+5) == null) {
|
|
|
+ cell = row.createCell(columnNum+5);
|
|
|
+ } else {
|
|
|
+ cell = row.getCell(columnNum+5);
|
|
|
+ }
|
|
|
+ cell.setCellValue("");//系数
|
|
|
+ cell.setCellStyle(cellStyle);
|
|
|
+
|
|
|
+
|
|
|
+ if (row.getCell(columnNum+6) == null) {
|
|
|
+ cell = row.createCell(columnNum+6);
|
|
|
+ } else {
|
|
|
+ cell = row.getCell(columnNum+6);
|
|
|
+ }
|
|
|
+ cell.setCellValue(cableTotal);//总长度
|
|
|
+ cell.setCellStyle(cellStyle);
|
|
|
+
|
|
|
+ // 合并日期占两行(4个参数,分别为起始行,结束行,起始列,结束列)
|
|
|
+ // 行和列都是从0开始计数,且起始结束都会合并
|
|
|
+ // 这里是合并excel中日期的两行为一行
|
|
|
+ CellRangeAddress region = new CellRangeAddress(lineNum, lineNum, columnNum, columnNum + 5);
|
|
|
+ sheet.addMergedRegion(region);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 电缆分段表数据处理
|
|
|
* @param row
|
|
|
* @param columnNum
|
|
|
* @param cableData
|
|
@@ -629,6 +731,91 @@ public class RaiseCapitalDesignExportUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 电缆分段表数据处理(无数据行)
|
|
|
+ * @param row
|
|
|
+ * @param columnNum
|
|
|
+ * @param coefficient 系数
|
|
|
+ * @param cellStyle
|
|
|
+ */
|
|
|
+ private static void disposeCableRowNoData(XSSFRow row, Integer columnNum, String coefficient, CellStyle cellStyle){
|
|
|
+
|
|
|
+ XSSFCell cell = row.getCell(1);
|
|
|
+ //第一列
|
|
|
+ if (row.getCell(columnNum) == null) {
|
|
|
+ cell = row.createCell(columnNum);
|
|
|
+ } else {
|
|
|
+ cell = row.getCell(columnNum);
|
|
|
+ }
|
|
|
+ cell.setCellValue("");//空行
|
|
|
+ cell.setCellStyle(cellStyle);
|
|
|
+
|
|
|
+ //第二列
|
|
|
+ if (row.getCell(columnNum+1) == null) {
|
|
|
+ cell = row.createCell(columnNum+1);
|
|
|
+ } else {
|
|
|
+ cell = row.getCell(columnNum+1);
|
|
|
+ }
|
|
|
+ cell.setCellValue("");//空行
|
|
|
+ cell.setCellStyle(cellStyle);
|
|
|
+
|
|
|
+ //第三列
|
|
|
+ if (row.getCell(columnNum+2) == null) {
|
|
|
+ cell = row.createCell(columnNum+2);
|
|
|
+ } else {
|
|
|
+ cell = row.getCell(columnNum+2);
|
|
|
+ }
|
|
|
+ cell.setCellValue("");//空行
|
|
|
+ cell.setCellStyle(cellStyle);
|
|
|
+
|
|
|
+ //第四列
|
|
|
+ if (row.getCell(columnNum+3) == null) {
|
|
|
+ cell = row.createCell(columnNum+3);
|
|
|
+ } else {
|
|
|
+ cell = row.getCell(columnNum+3);
|
|
|
+ }
|
|
|
+ cell.setCellValue("");//空行
|
|
|
+ cell.setCellStyle(cellStyle);
|
|
|
+
|
|
|
+ //第五列
|
|
|
+ if (row.getCell(columnNum+4) == null) {
|
|
|
+ cell = row.createCell(columnNum+4);
|
|
|
+ } else {
|
|
|
+ cell = row.getCell(columnNum+4);
|
|
|
+ }
|
|
|
+ cell.setCellValue("");//空行
|
|
|
+ cell.setCellStyle(cellStyle);
|
|
|
+
|
|
|
+ //第六列
|
|
|
+ if (row.getCell(columnNum+5) == null) {
|
|
|
+ cell = row.createCell(columnNum+5);
|
|
|
+ } else {
|
|
|
+ cell = row.getCell(columnNum+5);
|
|
|
+ }
|
|
|
+ cell.setCellValue(coefficient);//系数
|
|
|
+ cell.setCellStyle(cellStyle);
|
|
|
+
|
|
|
+ //第七列
|
|
|
+ if (row.getCell(columnNum+6) == null) {
|
|
|
+ cell = row.createCell(columnNum+6);
|
|
|
+ } else {
|
|
|
+ cell = row.getCell(columnNum+6);
|
|
|
+ }
|
|
|
+ cell.setCellValue("0");//电气长(m)
|
|
|
+ cell.setCellStyle(cellStyle);
|
|
|
+
|
|
|
+ if(null != columnNum && 32 != columnNum){
|
|
|
+ //第8列
|
|
|
+ if (row.getCell(columnNum+7) == null) {
|
|
|
+ cell = row.createCell(columnNum+7);
|
|
|
+ } else {
|
|
|
+ cell = row.getCell(columnNum+7);
|
|
|
+ }
|
|
|
+ cell.setCellValue("");//空行
|
|
|
+ cell.setCellStyle(cellStyle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
//设置 字体边框
|
|
|
public static CellStyle getCellStyleFont(Workbook workbook) {
|