Sfoglia il codice sorgente

电缆分段表导出代码部分上传

user5 3 anni fa
parent
commit
6d68124a7a

+ 30 - 25
pom.xml

@@ -56,7 +56,7 @@
         <downloadSources>true</downloadSources>
 
     </properties>
-	
+
 	<!-- 设定仓库 -->
 	<repositories>
 		<repository>
@@ -94,7 +94,7 @@
 				<enabled>false</enabled>
 			</snapshots>
 		</repository>
-	
+
 		<repository>
 			<id>bitwalker.user-agent-utils.mvn.repo</id>
 			<url>https://nexus.jackpinetech.com/nexus/content/groups/public</url>
@@ -120,31 +120,31 @@
 			</resource>
 		</resources>
         <plugins>
-           
+
            <!-- tomcat6插件 -->
 			<plugin>
 				<groupId>org.apache.tomcat.maven</groupId>
 				<artifactId>tomcat6-maven-plugin</artifactId>
-				<version>${tomcat.version}</version> 
+				<version>${tomcat.version}</version>
 				<configuration>
 					<port>${webserver.port}</port>
 					<path>/${project.artifactId}</path>
 					<uriEncoding>${project.build.sourceEncoding}</uriEncoding>
 				</configuration>
 			</plugin>
-			
+
 			<!-- tomcat7插件 -->
 			<plugin>
 				<groupId>org.apache.tomcat.maven</groupId>
 				<artifactId>tomcat7-maven-plugin</artifactId>
-				<version>${tomcat.version}</version> 
+				<version>${tomcat.version}</version>
 				<configuration>
 					<port>${webserver.port}</port>
 					<path>/${project.artifactId}</path>
 					<uriEncoding>${project.build.sourceEncoding}</uriEncoding>
 				</configuration>
 			</plugin>
-           
+
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
@@ -235,17 +235,17 @@
             <artifactId>spring-jdbc</artifactId>
             <version>${spring.version}</version>
         </dependency>
-        
-        <!-- spring websocket--> 
-		<dependency>  
-           <groupId>org.springframework</groupId>  
-           <artifactId>spring-websocket</artifactId>  
-           <version>${spring.version}</version>  
-        </dependency>  
-        <dependency>  
-           <groupId>org.springframework</groupId>  
-           <artifactId>spring-messaging</artifactId>  
-           <version>${spring.version}</version>  
+
+        <!-- spring websocket-->
+		<dependency>
+           <groupId>org.springframework</groupId>
+           <artifactId>spring-websocket</artifactId>
+           <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+           <groupId>org.springframework</groupId>
+           <artifactId>spring-messaging</artifactId>
+           <version>${spring.version}</version>
         </dependency>
 
         <!-- bean validate -->
@@ -385,7 +385,7 @@
             <artifactId>jsp-api</artifactId>
             <version>2.2</version>
             <scope>provided</scope>
-        </dependency>--> 
+        </dependency>-->
 
 
         <!-- J2CACHE begin -->
@@ -519,7 +519,7 @@
 			<artifactId>activiti-diagram-rest</artifactId>
 			<version>${activiti.version}</version>
 		</dependency>
-		
+
 		<!-- 支持activiti缓存 -->
 		<!-- <dependency>
 			<groupId>org.infinispan</groupId>
@@ -617,7 +617,7 @@
             <groupId>com.alibaba</groupId>
             <artifactId>fastjson</artifactId>
             <version>${fastjson.version}</version>
-        </dependency> 
+        </dependency>
 
         <!-- xstream xml -->
         <dependency>
@@ -695,7 +695,7 @@
             <systemPath>${lib.path}/batik-util-1.7.jar</systemPath>
             <scope>system</scope>
         </dependency>
-        
+
         <!-- quartz -->
 		<dependency>
 			<groupId>org.quartz-scheduler</groupId>
@@ -726,7 +726,7 @@
             <systemPath>${lib.path}/org.jeeframework.gencode-2.0-tomcat7.0.jar</systemPath>
             <scope>system</scope>
         </dependency>
-        
+
 	 <!-- Echarts图表依赖包开始 -->
         <!-- https://mvnrepository.com/artifact/com.github.abel533/ECharts -->
         <dependency>
@@ -740,7 +740,7 @@
 	        <version>2.6.2</version>
 	    </dependency>
 	    <!-- Echarts图表依赖包结束 -->
-		
+
         <!-- TEST begin -->
         <dependency>
             <groupId>junit</groupId>
@@ -791,7 +791,7 @@
             <systemPath>${lib.path}/QRCode.jar</systemPath>
             <scope>system</scope>
         </dependency>
-       
+
         <!-- UTILS begin -->
         <dependency>
             <groupId>com.google.guava</groupId>
@@ -817,6 +817,11 @@
             <version>1.7.0</version>
         </dependency>
         <!-- UTILS end -->
+        <dependency>
+            <groupId>org.apache.ant</groupId>
+            <artifactId>ant</artifactId>
+            <version>1.10.5</version>
+        </dependency>
     </dependencies>
 
 </project>

+ 87 - 0
src/main/java/com/jeeplus/modules/sg/raiseCapitalDesign/service/RaiseCapitalDesignService.java

@@ -112,6 +112,88 @@ public class RaiseCapitalDesignService extends CrudService<RaiseCapitalDesignMap
 		voltageData.setHighVoltageList(highVoltageList);
 		voltageData.setLowVoltageList(lowVoltageList);
 
+
+		//获取电缆分段表数据信息
+		CableSectionData cableSectionData = new CableSectionData();
+		BinaryJedisCommands binaryJedisCommands = client.get();
+		//获取400的信息
+		byte[] bytes = binaryJedisCommands.get((uuid + "cableFourHundred").getBytes());
+		if(null != bytes){
+			String item = new String(bytes);
+			if(StringUtils.isNotBlank(item)) {
+				List<CableSectionInfo> cableFourHundredList = JSON.parseArray(new String(bytes),CableSectionInfo.class);
+				if(null != cableFourHundredList){
+					cableSectionData.setCableFourHundredList(cableFourHundredList);
+				}else{
+					cableSectionData.setCableFourHundredList(Lists.newArrayList());
+				}
+			}else{
+				cableSectionData.setCableFourHundredList(Lists.newArrayList());
+			}
+		}
+		//获取300的信息
+		bytes = binaryJedisCommands.get((uuid + "cableThreeHundred").getBytes());
+		if(null != bytes){
+			String item = new String(bytes);
+			if(StringUtils.isNotBlank(item)) {
+				List<CableSectionInfo> cableThreeHundredList = JSON.parseArray(new String(bytes),CableSectionInfo.class);
+				if(null != cableThreeHundredList){
+					cableSectionData.setCableThreeHundredList(cableThreeHundredList);
+				}else{
+					cableSectionData.setCableThreeHundredList(Lists.newArrayList());
+				}
+			}else{
+				cableSectionData.setCableThreeHundredList(Lists.newArrayList());
+			}
+		}
+		//获取240的信息
+		bytes = binaryJedisCommands.get((uuid + "cableTwoHundredForty").getBytes());
+		if(null != bytes){
+			String item = new String(bytes);
+			if(StringUtils.isNotBlank(item)) {
+				List<CableSectionInfo> cableTwoHundredFortyList = JSON.parseArray(new String(bytes),CableSectionInfo.class);
+				if(null != cableTwoHundredFortyList){
+					cableSectionData.setCableTwoHundredFortyList(cableTwoHundredFortyList);
+				}else{
+					cableSectionData.setCableTwoHundredFortyList(Lists.newArrayList());
+				}
+			}else{
+				cableSectionData.setCableTwoHundredFortyList(Lists.newArrayList());
+			}
+		}
+		//获取120的信息
+		bytes = binaryJedisCommands.get((uuid + "cableHundredAndTwenty").getBytes());
+		if(null != bytes){
+			String item = new String(bytes);
+			if(StringUtils.isNotBlank(item)) {
+				List<CableSectionInfo> cableHundredAndTwentyList = JSON.parseArray(new String(bytes),CableSectionInfo.class);
+				if(null != cableHundredAndTwentyList){
+					cableSectionData.setCableHundredAndTwentyList(cableHundredAndTwentyList);
+				}else{
+					cableSectionData.setCableHundredAndTwentyList(Lists.newArrayList());
+				}
+			}else{
+				cableSectionData.setCableHundredAndTwentyList(Lists.newArrayList());
+			}
+		}
+		//获取70的信息
+		bytes = binaryJedisCommands.get((uuid + "cableSeventy").getBytes());
+		if(null != bytes){
+			String item = new String(bytes);
+			if(StringUtils.isNotBlank(item)) {
+				List<CableSectionInfo> cableSeventyList = JSON.parseArray(new String(bytes),CableSectionInfo.class);
+				if(null != cableSeventyList){
+					cableSectionData.setCableSeventyList(cableSeventyList);
+				}else{
+					cableSectionData.setCableSeventyList(Lists.newArrayList());
+				}
+			}else{
+				cableSectionData.setCableSeventyList(Lists.newArrayList());
+			}
+		}
+
+
+
 		RaiseCapital newRaise = (RaiseCapital) newMap.get("raiseCapital");
 
 		RaiseCapitalDesignTemplate raiseTemplate = new RaiseCapitalDesignTemplate();
@@ -134,6 +216,8 @@ public class RaiseCapitalDesignService extends CrudService<RaiseCapitalDesignMap
 			sheetPickingList = workbook.getSheetAt(1);//领料清单
 
 			sheetVoltageList = workbook.getSheetAt(2);//架空导线计算表
+
+			sheetVoltageList = workbook.getSheetAt(3);//电缆分段表
 		} catch (Exception e1) {
 			e1.printStackTrace();
 		}
@@ -143,7 +227,10 @@ public class RaiseCapitalDesignService extends CrudService<RaiseCapitalDesignMap
 			RaiseCapitalDesignExportUtil.getSheetModular(sheetModular,myList,newList,newRaise,workbook);//模块表
 			/*RaiseExportUtil.getSheetModuleList(sheetModuleList,moduleList,workbook);//模块清单*/
 			RaiseCapitalDesignExportUtil.getSheetPickingList(sheetPickingList,materialsList,newRaise,workbook);//领料清单
+
 			RaiseCapitalDesignExportUtil.getSheetVoltageList(sheetVoltageList,voltageData,newRaise,workbook);//架空导线计算表
+
+			RaiseCapitalDesignExportUtil.getSheetCableList(sheetVoltageList,cableSectionData,newRaise,workbook);//电缆分段表
             showListMapper.trunCate(projectName);
 			workbook.write(fos);
 			fos.flush();

+ 175 - 4
src/main/java/com/jeeplus/modules/sg/raiseCapitalDesign/utils/RaiseCapitalDesignExportUtil.java

@@ -9,6 +9,8 @@ import com.jeeplus.modules.sg.picking.activiti.entity.MdTheClass;
 import com.jeeplus.modules.sg.picking.activiti.entity.PickList;
 import com.jeeplus.modules.sg.picking.activiti.entity.ShowList;
 import com.jeeplus.modules.sg.raiseCapital.entity.RaiseCapital;
+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 org.apache.poi.hssf.usermodel.HSSFCellStyle;
@@ -23,6 +25,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -425,6 +428,13 @@ public class RaiseCapitalDesignExportUtil {
         }
     }
 
+    /**
+     * 架空导线表数据处理
+     * @param rowLineNumber
+     * @param sheet
+     * @param voltageInfo
+     * @param cellStyle
+     */
     private static void disposeRowData(Integer rowLineNumber, Sheet sheet, VoltageInfo voltageInfo, CellStyle cellStyle){
 
         XSSFRow row = (XSSFRow) sheet.getRow(rowLineNumber);
@@ -435,7 +445,7 @@ public class RaiseCapitalDesignExportUtil {
         } else {
             cell = row.getCell(1);
         }
-        cell.setCellValue(voltageInfo.getSingleCircuitPath());//物料编码
+        cell.setCellValue(voltageInfo.getSingleCircuitPath());//单回路路径
 
         //第三列
         if (row.getCell(2) == null) {
@@ -443,7 +453,7 @@ public class RaiseCapitalDesignExportUtil {
         } else {
             cell = row.getCell(2);
         }
-        cell.setCellValue(voltageInfo.getDoubleCircuitPath());//物料名称
+        cell.setCellValue(voltageInfo.getDoubleCircuitPath());//双回路路径
 
         //第四列
         if (row.getCell(3) == null) {
@@ -452,13 +462,174 @@ public class RaiseCapitalDesignExportUtil {
             cell = row.getCell(3);
         }
         if(StringUtils.isNotBlank(voltageInfo.getSingleLong())){
-            cell.setCellValue(voltageInfo.getSingleLong());//扩展描述
+            cell.setCellValue(voltageInfo.getSingleLong());//单线长
         }else{
-            cell.setCellValue("0");//扩展描述
+            cell.setCellValue("0");//单线长
         }
 
     }
 
+
+    /**
+     * 电缆分段表
+     * @param sheet
+     * @param cableSectionData
+     * @param raiseCapital
+     * @param workbook
+     */
+    public static void getSheetCableList(Sheet sheet, CableSectionData cableSectionData, RaiseCapital raiseCapital, Workbook workbook) {
+        if (sheet != null) {
+            CellStyle style = getCellStyleFont(workbook);
+            CellStyle cellStyle = getCellStyle(workbook);
+
+            XSSFRow row = (XSSFRow) sheet.getRow(0);
+            XSSFCell cell = row.getCell(0);
+
+            List<CableSectionInfo> cableFourHundredList = cableSectionData.getCableFourHundredList();    //YJV22-3×400mm²
+            List<CableSectionInfo> cableThreeHundredList = cableSectionData.getCableThreeHundredList();   //YJV22-3×300mm²
+            List<CableSectionInfo> cableTwoHundredFortyList = cableSectionData.getCableTwoHundredFortyList();    //YJV22-3×240mm²
+            List<CableSectionInfo> cableHundredAndTwentyList = cableSectionData.getCableHundredAndTwentyList();   //YJV22-3×120mm²
+            List<CableSectionInfo> cableSeventyList = cableSectionData.getCableSeventyList();       //YJV22-3×70mm²
+            //将五个list的长度进行排序
+            int[] a=new int[]{cableFourHundredList.size(),cableThreeHundredList.size(),cableTwoHundredFortyList.size(),cableHundredAndTwentyList.size(),cableSeventyList.size()};
+            //将数组按小到大的顺序排列,最后的一个为最大值
+            Arrays.sort(a);
+            //获取最大的一个list长度,作为最终的行号
+            int num=a[a.length-1];
+
+            for (int i = 1; i <= num; i++) {
+                row = (XSSFRow) sheet.createRow((int) i + 1);
+                CableSectionInfo cableFourHundred = null;   //3×400mm²
+                if(cableFourHundredList.size()>=i){
+                    cableFourHundred = cableFourHundredList.get(i-1);
+                    //对数据进行处理
+                    disposeCableRowData(row,0,cableFourHundred,cellStyle);
+                }
+                CableSectionInfo cableThreeHundred = null;  //3×300mm²
+                if(cableThreeHundredList.size()>=i){
+                    cableThreeHundred = cableThreeHundredList.get(i-1);
+                    disposeCableRowData(row,8,cableThreeHundred,cellStyle);
+                }
+                CableSectionInfo cableTwoHundredForty = null;   //3×240mm²
+                if(cableTwoHundredFortyList.size()>=i){
+                    cableTwoHundredForty = cableTwoHundredFortyList.get(i-1);
+                    disposeCableRowData(row,16,cableTwoHundredForty,cellStyle);
+                }
+                CableSectionInfo cableHundredAndTwenty = null;  //3×120mm²
+                if(cableHundredAndTwentyList.size()>=i){
+                    cableHundredAndTwenty = cableHundredAndTwentyList.get(i-1);
+                    disposeCableRowData(row,24,cableHundredAndTwenty,cellStyle);
+                }
+                CableSectionInfo cableSeventy = null;       //3×70mm²
+                if(cableSeventyList.size()>=i){
+                    cableSeventy = cableSeventyList.get(i-1);
+                    disposeCableRowData(row,32,cableSeventy,cellStyle);
+                }
+
+            }
+        }
+    }
+
+    /**
+     * 架空导线表数据处理
+     * @param row
+     * @param columnNum
+     * @param cableData
+     * @param cellStyle
+     */
+    private static void disposeCableRowData(XSSFRow row, Integer columnNum, CableSectionInfo cableData, CellStyle cellStyle){
+
+        XSSFCell cell = row.getCell(1);
+        //第一列
+        if (row.getCell(columnNum) == null) {
+            cell = row.createCell(columnNum);
+        } else {
+            cell = row.getCell(columnNum);
+        }
+        if(cableData != null){
+            cell.setCellValue(cableData.getDestination());//400起讫点
+            cell.setCellStyle(cellStyle);
+        }
+
+        //第二列
+        if (row.getCell(columnNum+1) == null) {
+            cell = row.createCell(columnNum+1);
+        } else {
+            cell = row.getCell(columnNum+1);
+        }
+        if(cableData != null){
+            cell.setCellValue(cableData.getPathLength());//400路径长(m)
+            cell.setCellStyle(cellStyle);
+        }
+
+        //第三列
+        if (row.getCell(columnNum+2) == null) {
+            cell = row.createCell(columnNum+2);
+        } else {
+            cell = row.getCell(columnNum+2);
+        }
+        if(cableData != null){
+            cell.setCellValue(cableData.getUpperRod());//400上杆(m)
+            cell.setCellStyle(cellStyle);
+        }
+
+        //第四列
+        if (row.getCell(columnNum+3) == null) {
+            cell = row.createCell(columnNum+3);
+        } else {
+            cell = row.getCell(columnNum+3);
+        }
+        if(cableData != null){
+            cell.setCellValue(cableData.getArrival());//400进站(m)
+            cell.setCellStyle(cellStyle);
+        }
+
+        //第五列
+        if (row.getCell(columnNum+4) == null) {
+            cell = row.createCell(columnNum+4);
+        } else {
+            cell = row.getCell(columnNum+4);
+        }
+        if(cableData != null){
+            cell.setCellValue(cableData.getIncomingEquipment());//400进设备(m)
+            cell.setCellStyle(cellStyle);
+        }
+
+        //第六列
+        if (row.getCell(columnNum+5) == null) {
+            cell = row.createCell(columnNum+5);
+        } else {
+            cell = row.getCell(columnNum+5);
+        }
+        if(cableData != null){
+            cell.setCellValue(cableData.getCoefficient());//400系数
+            cell.setCellStyle(cellStyle);
+        }
+
+        //第七列
+        if (row.getCell(columnNum+6) == null) {
+            cell = row.createCell(columnNum+6);
+        } else {
+            cell = row.getCell(columnNum+6);
+        }
+        if(cableData != null){
+            cell.setCellValue(cableData.getElectricalChief());//400电气长(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) {
         XSSFFont font = (XSSFFont) workbook.createFont();