蔡德晨 5 anni fa
parent
commit
0a1428acd9

+ 18 - 14
src/main/java/com/jeeplus/common/utils/excel/ImportExcel.java

@@ -100,9 +100,9 @@ public class ImportExcel {
 		this(new File(fileName), headerNum, sheetIndex);
 	}
 
-	public ImportExcel(String fileName, int headerNum, String sheetName)
+	public ImportExcel(String fileName, int headerNum, String sheetName,boolean flag)
 			throws InvalidFormatException, IOException {
-		this(new File(fileName), headerNum, sheetName);
+		this(new File(fileName), headerNum, sheetName,flag);
 	}
 	
 	/**
@@ -118,9 +118,9 @@ public class ImportExcel {
 		this(file.getName(), new FileInputStream(file), headerNum, sheetIndex);
 	}
 
-	public ImportExcel(File file, int headerNum, String sheetName)
+	public ImportExcel(File file, int headerNum, String sheetName,boolean flag)
 			throws InvalidFormatException, IOException {
-		this(file.getName(), new FileInputStream(file), headerNum, sheetName);
+		this(file.getName(), new FileInputStream(file), headerNum, sheetName,flag);
 	}
 	
 	/**
@@ -136,14 +136,14 @@ public class ImportExcel {
 		this(multipartFile.getOriginalFilename(), multipartFile.getInputStream(), headerNum, sheetName);
 	}
 
-	public ImportExcel(MultipartFile multipartFile, int headerNum, String sheetName)
+	public ImportExcel(MultipartFile multipartFile, int headerNum, String sheetName,boolean flag)
 			throws InvalidFormatException, IOException {
-		this(multipartFile.getOriginalFilename(), multipartFile.getInputStream(), headerNum, sheetName);
+		this(multipartFile.getOriginalFilename(), multipartFile.getInputStream(), headerNum, sheetName,flag);
 	}
 
-	public ImportExcel(MultipartFile multipartFile, int headerNum, String[] sheetName)
+	public ImportExcel(MultipartFile multipartFile, int headerNum, String[] sheetName,boolean flag)
 			throws InvalidFormatException, IOException {
-		this(multipartFile.getOriginalFilename(), multipartFile.getInputStream(), headerNum, sheetName);
+		this(multipartFile.getOriginalFilename(), multipartFile.getInputStream(), headerNum, sheetName,flag);
 	}
 
 	/**
@@ -173,7 +173,7 @@ public class ImportExcel {
 		log.debug("Initialize success.");
 	}
 
-	public ImportExcel(String fileName, InputStream is, int headerNum, String sheetName)
+	public ImportExcel(String fileName, InputStream is, int headerNum, String sheetName,boolean flag)
 			throws InvalidFormatException, IOException {
 		if (StringUtils.isBlank(fileName)){
 			throw new RuntimeException("导入文档为空!");
@@ -184,8 +184,10 @@ public class ImportExcel {
 		}else{
 			throw new RuntimeException("文档格式不正确!");
 		}
-		if(this.wb.getSheet(sheetName) == null ){
-			throw new RuntimeException("缺少"+sheetName);
+		if(flag) {
+			if (this.wb.getSheet(sheetName) == null) {
+				throw new RuntimeException("缺少" + sheetName);
+			}
 		}
 		this.sheet = this.wb.getSheet(sheetName);
 		this.headerNum = headerNum;
@@ -193,7 +195,7 @@ public class ImportExcel {
 	}
 
 
-	public ImportExcel(String fileName, InputStream is, int headerNum, String[] sheetName)
+	public ImportExcel(String fileName, InputStream is, int headerNum, String[] sheetName,boolean flag)
 			throws InvalidFormatException, IOException {
 		int i = 100;
 		if (StringUtils.isBlank(fileName)){
@@ -211,8 +213,10 @@ public class ImportExcel {
                   break;
 			}
 		}
-		if(i==100){
-			throw new RuntimeException("缺少"+sheetName[0]);
+		if(flag) {
+			if (i == 100) {
+				throw new RuntimeException("缺少" + sheetName[0]);
+			}
 		}
 		this.sheet = this.wb.getSheet(sheetName[i]);
 		this.headerNum = headerNum;

+ 21 - 21
src/main/java/com/jeeplus/modules/sg/overheadline/service/OverheadLineService.java

@@ -380,14 +380,14 @@ public List<JkxlDetailFee> findList(String id,String type){
        tcRate[1] = ruleRatioService.getValueByName(BashInfo.RATIO_CLTC).getValue()/100;
        tcRate[2] = ruleRatioService.getValueByName(BashInfo.RATIO_JXTC).getValue()/100;
        //读取表格
-       ImportExcel importExcel = new ImportExcel(file,1,BashInfo.SHEET_FBFXJJ);  //分部分项工程量清单计价表
-       ImportExcel csqd = new ImportExcel(file,1,new String[]{BashInfo.SHEET_CSB,BashInfo.SHEET_CSB1});  // 措施项目清单计价表(一)
-       ImportExcel gf = new ImportExcel(file,1,BashInfo.SHEET_GFQD);  //规费项目清单计价表
-       ImportExcel qt = new ImportExcel(file,1,BashInfo.SHEET_QTFY);  //其他项目清单计价表
-       ImportExcel total = new ImportExcel(file,1,BashInfo.SHEET_HZB );  //工程项目竣工结算汇总表
-       ImportExcel gzhz = new ImportExcel(file,1,new String[]{BashInfo.SHEET_GCHZ,BashInfo.SHEET_GCHZ1} );   //架空线路工程费用汇总
-       ImportExcel fbrcg = new ImportExcel(file,1,new String[]{BashInfo.SHEET_FBRCG,BashInfo.SHEET_FBRCG1,BashInfo.SHEET_FBRCG2});   //发包人采购材料设备计价表
-        ImportExcel zyrg = new ImportExcel(file,1,BashInfo.SHEET_ZYRG); //主要日工价格表
+       ImportExcel importExcel = new ImportExcel(file,1,BashInfo.SHEET_FBFXJJ,true);  //分部分项工程量清单计价表
+       ImportExcel csqd = new ImportExcel(file,1,new String[]{BashInfo.SHEET_CSB,BashInfo.SHEET_CSB1},true);  // 措施项目清单计价表(一)
+       ImportExcel gf = new ImportExcel(file,1,BashInfo.SHEET_GFQD,true);  //规费项目清单计价表
+       ImportExcel qt = new ImportExcel(file,1,BashInfo.SHEET_QTFY,true);  //其他项目清单计价表
+       ImportExcel total = new ImportExcel(file,1,BashInfo.SHEET_HZB,true );  //工程项目竣工结算汇总表
+       ImportExcel gzhz = new ImportExcel(file,1,new String[]{BashInfo.SHEET_GCHZ,BashInfo.SHEET_GCHZ1},true );   //架空线路工程费用汇总
+       ImportExcel fbrcg = new ImportExcel(file,1,new String[]{BashInfo.SHEET_FBRCG,BashInfo.SHEET_FBRCG1,BashInfo.SHEET_FBRCG2},true);   //发包人采购材料设备计价表
+        ImportExcel zyrg = new ImportExcel(file,1,BashInfo.SHEET_ZYRG,true); //主要日工价格表
         //数据核验数据
         List<Settlement> settlementList =  SettementUtil.getComparison(total);
        double builtTotal = ExcelUtil.getDouble(gzhz,BashInfo.QT_HJ,0,2);//获取架空线路工程费用汇总表 分部分项 合计
@@ -543,11 +543,11 @@ public List<JkxlDetailFee> findList(String id,String type){
         tcRate[1] = ruleRatioService.getValueByName(BashInfo.RATIO_CLTC).getValue()/100;
         tcRate[2] = ruleRatioService.getValueByName(BashInfo.RATIO_JXTC).getValue()/100;
         //读取表格
-        ImportExcel total = new ImportExcel(file,1,new String[]{BashInfo.SHEET_HZB,BashInfo.SHEET_HZB1} );  //工程项目竣工结算汇总表
-        ImportExcel csqd = new ImportExcel(file,1,new String[]{BashInfo.SHEET_CSB,BashInfo.SHEET_CSB1});  // 措施项目清单计价表(一)
-        ImportExcel gf = new ImportExcel(file,1,BashInfo.SHEET_GFQD);  //规费项目清单计价表
-        ImportExcel qt = new ImportExcel(file,1,BashInfo.SHEET_QTFY);  //其他项目清单计价表
-        ImportExcel fbrcg = new ImportExcel(file,1,new String[]{BashInfo.SHEET_FBRCG,BashInfo.SHEET_FBRCG1,BashInfo.SHEET_FBRCG2});   //发包人采购材料设备计价表
+        ImportExcel total = new ImportExcel(file,1,new String[]{BashInfo.SHEET_HZB,BashInfo.SHEET_HZB1},true );  //工程项目竣工结算汇总表
+        ImportExcel csqd = new ImportExcel(file,1,new String[]{BashInfo.SHEET_CSB,BashInfo.SHEET_CSB1},true);  // 措施项目清单计价表(一)
+        ImportExcel gf = new ImportExcel(file,1,BashInfo.SHEET_GFQD,true);  //规费项目清单计价表
+        ImportExcel qt = new ImportExcel(file,1,BashInfo.SHEET_QTFY,true);  //其他项目清单计价表
+        ImportExcel fbrcg = new ImportExcel(file,1,new String[]{BashInfo.SHEET_FBRCG,BashInfo.SHEET_FBRCG1,BashInfo.SHEET_FBRCG2},true);   //发包人采购材料设备计价表
         List<Settlement> settlementList =  SettementUtil.getComparison(total);
         double cbperson = 0.0;
         double word1total =  ExcelUtil.getDouble(csqd,BashInfo.QT_HJ,0,4);//获取措施费清单计价表一
@@ -571,8 +571,8 @@ public List<JkxlDetailFee> findList(String id,String type){
         double totalfee = 0.00;  //合计
         List<JkxlDetailFee> list = new ArrayList<>();
         if(jzgc !=0.00 && azgc == 0.00){
-            ImportExcel jzqd = new ImportExcel(file,1,BashInfo.SHEET_JZFBFXJJ);  //建筑分部分项工程量清单计价表
-            ImportExcel jzhz = new ImportExcel(file,1,BashInfo.SHEET_JZHZB );   //电缆线路建筑工程费用汇总表
+            ImportExcel jzqd = new ImportExcel(file,1,BashInfo.SHEET_JZFBFXJJ,true);  //建筑分部分项工程量清单计价表
+            ImportExcel jzhz = new ImportExcel(file,1,BashInfo.SHEET_JZHZB,true );   //电缆线路建筑工程费用汇总表
             double built1Total = ExcelUtil.getDouble(jzhz,BashInfo.QT_HJ,0,2);//建筑分布分项工程量清单计价表合计
             double[] builtTotal={built1Total,0.00};
             double[] division1total=ExcelUtil.getDoubleArray(jzqd,BashInfo.DLJZ,2,comlumn2);//建筑分部分项比对数据清单合计
@@ -641,8 +641,8 @@ public List<JkxlDetailFee> findList(String id,String type){
             }
 
         } else if(jzgc ==0.00 && azgc != 0.00){
-            ImportExcel azqd = new ImportExcel(file,1,BashInfo.SHEET_AZFBFXJJ);  //安装分部分项工程量清单计价表
-            ImportExcel azhz = new ImportExcel(file,1,BashInfo.SHEET_HZHZB );   //电缆线路安装工程费用汇总表
+            ImportExcel azqd = new ImportExcel(file,1,BashInfo.SHEET_AZFBFXJJ,true);  //安装分部分项工程量清单计价表
+            ImportExcel azhz = new ImportExcel(file,1,BashInfo.SHEET_HZHZB ,true);   //电缆线路安装工程费用汇总表
             double built2Total = ExcelUtil.getDouble(azhz,BashInfo.QT_HJ,0,2);//安装分部分项工程量清单计合计
             double[] builtTotal={0.00,built2Total};
             double[] division2total=ExcelUtil.getDoubleArray(azqd,BashInfo.DLAZ,2,comlumn2);//安装分部分项比对数据清单合计
@@ -710,10 +710,10 @@ public List<JkxlDetailFee> findList(String id,String type){
             }
 
         } else {
-            ImportExcel jzqd = new ImportExcel(file, 1, BashInfo.SHEET_JZFBFXJJ);  //建筑分部分项工程量清单计价表
-            ImportExcel azqd = new ImportExcel(file, 1, BashInfo.SHEET_AZFBFXJJ);  //安装分部分项工程量清单计价表
-            ImportExcel jzhz = new ImportExcel(file, 1, BashInfo.SHEET_JZHZB);   //电缆线路建筑工程费用汇总表
-            ImportExcel azhz = new ImportExcel(file, 1, BashInfo.SHEET_HZHZB);   //电缆线路安装工程费用汇总表
+            ImportExcel jzqd = new ImportExcel(file, 1, BashInfo.SHEET_JZFBFXJJ,true);  //建筑分部分项工程量清单计价表
+            ImportExcel azqd = new ImportExcel(file, 1, BashInfo.SHEET_AZFBFXJJ,true);  //安装分部分项工程量清单计价表
+            ImportExcel jzhz = new ImportExcel(file, 1, BashInfo.SHEET_JZHZB,true);   //电缆线路建筑工程费用汇总表
+            ImportExcel azhz = new ImportExcel(file, 1, BashInfo.SHEET_HZHZB,true);   //电缆线路安装工程费用汇总表
             double built1Total = ExcelUtil.getDouble(jzhz,BashInfo.QT_HJ,0,2);//建筑分布分项工程量清单计价表合计
             double built2Total = ExcelUtil.getDouble(azhz,BashInfo.QT_HJ,0,2);//安装分部分项工程量清单计合计
             double[] builtTotal={built1Total,built2Total};

+ 28 - 20
src/main/java/com/jeeplus/modules/sg/substation/service/SubstationService.java

@@ -74,16 +74,24 @@ public class SubstationService {
         tcRate[2] = ruleRatioService.getValueByName(SubstationInfo.RATIO_JXTC).getValue()/100;
 
         //读取表格
-        ImportExcel total = new ImportExcel(file,1,new String[]{SubstationInfo.SHEET_HZB,SubstationInfo.SHEET_HZB1} );  //工程项目竣工结算汇总表
-        ImportExcel csqd1 = new ImportExcel(file,1,new String[]{SubstationInfo.SHEET_CSB,SubstationInfo.SHEET_CSB1});  // 措施项目清单计价表(一)
-        ImportExcel csqd2 = new ImportExcel(file,1,SubstationInfo.SHEET_CSB2);  // 措施项目清单计价表(二)
-        ImportExcel gf = new ImportExcel(file,1,SubstationInfo.SHEET_GFQD);  //规费项目清单计价表
-        ImportExcel qt = new ImportExcel(file,1,SubstationInfo.SHEET_QTFY);  //其他项目清单计价表
-        ImportExcel fbrcg = new ImportExcel(file,1,SubstationInfo.SHEET_ZBRCGSB );   //招标人采购材料设备计价表
-        ImportExcel tbrsb = new ImportExcel(file,1,SubstationInfo.SHEET_TBRCGSB);//投标人采购设备计价表
+        ImportExcel total = new ImportExcel(file,1,new String[]{SubstationInfo.SHEET_HZB,SubstationInfo.SHEET_HZB1},true );  //工程项目竣工结算汇总表
+        ImportExcel csqd1 = new ImportExcel(file,1,new String[]{SubstationInfo.SHEET_CSB,SubstationInfo.SHEET_CSB1},true);  // 措施项目清单计价表(一)
+        ImportExcel csqd2 = new ImportExcel(file,1,SubstationInfo.SHEET_CSB2,false);  // 措施项目清单计价表(二)
+        ImportExcel gf = new ImportExcel(file,1,SubstationInfo.SHEET_GFQD,true);  //规费项目清单计价表
+        ImportExcel qt = new ImportExcel(file,1,SubstationInfo.SHEET_QTFY,true);  //其他项目清单计价表
+        ImportExcel fbrcg = new ImportExcel(file,1,SubstationInfo.SHEET_ZBRCGSB,true);   //招标人采购材料设备计价表
+        ImportExcel tbrsb = new ImportExcel(file,1,SubstationInfo.SHEET_TBRCGSB,true);//投标人采购设备计价表
         double jzgc = ExcelUtil.getDouble(total,SubstationInfo.HZ_JZGC,1,2);//汇总表建筑金额
         double azgc = ExcelUtil.getDouble(total,SubstationInfo.HZ_AZGC,1,2);//汇总表安装金额
         double texRate = ExcelUtil.getTexRate(total); //获取税率
+        double csJzFee = 0.00;  //建筑措施分摊费
+        double csAzFee = 0.00;  //安装措施分摊费
+        double word2total=0.00;  //获取措施费二表措施项目合计金额
+        if(ImportExcel.getSheet(csqd2) != null){
+             csJzFee = SubstationInfo.getCsJzFee(csqd2);//建筑措施分摊费
+             csAzFee = SubstationInfo.getCsAzFee(csqd2);//安装措施分摊费
+             word2total=csJzFee+csAzFee;
+        }
         double fbfxFee = ExcelUtil.getDouble(total,SubstationInfo.JS_FBFX,1,2);  //分部分项工程费
         double jzcsRate = BashInfo.getJzRate(csqd1); //获取建筑措施费率
         double[] azcsRate = BashInfo.getAzRate(csqd1); //获取安装措施费率
@@ -100,14 +108,14 @@ public class SubstationService {
         List<Settlement> settlementsBdz =  SettementUtil.getComparison(total);
         double cbperson = ExcelUtil.getDouble(tbrsb,BashInfo.QT_HJ,0,6);//获取投标人设备表合计
         double word1total =  ExcelUtil.getDouble(csqd1,BashInfo.QT_HJ,0,4);//获取措施费清单计价表一
-        double word2total=ExcelUtil.getDouble(csqd2,SubstationInfo.CS_JZ,0,10);//获取措施费二表措施项目合计金额
+//        double word2total=ExcelUtil.getDouble(csqd2,SubstationInfo.CS_JZ,0,10);//获取措施费二表措施项目合计金额
         double otherBdzTotal =  ExcelUtil.getDouble(qt,BashInfo.QT_HJ,0,2);//获取其他项目费合计
         double feesBdzCount =  ExcelUtil.getDouble(gf,BashInfo.QT_HJ,0,4);//获取规费合计
         if(jzgc !=0.00 && azgc != 0.00){
-            ImportExcel jzqd = new ImportExcel(file, 1, SubstationInfo.SHEET_JZFBFXJJ);  //建筑分部分项工程量清单计价表
-            ImportExcel azqd = new ImportExcel(file, 1, SubstationInfo.SHEET_AZFBFXJJ);  //安装分部分项工程量清单计价表
-            ImportExcel jzhz = new ImportExcel(file, 1, SubstationInfo.SHEET_JZHZB);   //建筑工程费用汇总表
-            ImportExcel azhz = new ImportExcel(file, 1, SubstationInfo.SHEET_HZHZB);   //安装工程费用汇总表
+            ImportExcel jzqd = new ImportExcel(file, 1, SubstationInfo.SHEET_JZFBFXJJ,true);  //建筑分部分项工程量清单计价表
+            ImportExcel azqd = new ImportExcel(file, 1, SubstationInfo.SHEET_AZFBFXJJ,true);  //安装分部分项工程量清单计价表
+            ImportExcel jzhz = new ImportExcel(file, 1, SubstationInfo.SHEET_JZHZB,true);   //建筑工程费用汇总表
+            ImportExcel azhz = new ImportExcel(file, 1, SubstationInfo.SHEET_HZHZB,true);   //安装工程费用汇总表
             //变电站结算汇总
             int[] comlumn2 = {12,15};//定义所要数组
             double built1Total = ExcelUtil.getDouble(jzhz,BashInfo.QT_HJ,0,2);//变电站建筑
@@ -120,8 +128,8 @@ public class SubstationService {
             settlementService.save(settlementBdzs,id);
             double zjgcJzTotal = ExcelUtil.getDouble(jzhz,SubstationInfo.QT_HJ,0,3);//建筑直接工程费合计
             double zjgcAzTotal = ExcelUtil.getDouble(azhz,SubstationInfo.QT_HJ,0,3);//安装直接工程费合计
-            double csJzFee = SubstationInfo.getCsJzFee(csqd2);//建筑措施分摊费
-            double csAzFee = SubstationInfo.getCsAzFee(csqd2);//安装措施分摊费
+//            double csJzFee = SubstationInfo.getCsJzFee(csqd2);//建筑措施分摊费
+//            double csAzFee = SubstationInfo.getCsAzFee(csqd2);//安装措施分摊费
             double tbrJzFee = BashInfo.getFbrJzFee(tbrsb); //投标人建筑费
             double tbrAzFee = BashInfo.getFbrAzFee(tbrsb); //投标人安装费
             double zjgcTotal = zjgcAzTotal+zjgcJzTotal;
@@ -301,8 +309,8 @@ public class SubstationService {
             feeAdjustService.save(jkxlAdjustFee);
         }
         if(jzgc !=0.00 && azgc == 0.00){
-            ImportExcel jzqd = new ImportExcel(file, 1, SubstationInfo.SHEET_JZFBFXJJ);  //建筑分部分项工程量清单计价表
-            ImportExcel jzhz = new ImportExcel(file, 1, SubstationInfo.SHEET_JZHZB);   //建筑工程费用汇总表
+            ImportExcel jzqd = new ImportExcel(file, 1, SubstationInfo.SHEET_JZFBFXJJ,true);  //建筑分部分项工程量清单计价表
+            ImportExcel jzhz = new ImportExcel(file, 1, SubstationInfo.SHEET_JZHZB,true);   //建筑工程费用汇总表
             //变电站结算汇总
             int[] comlumn2 = {12,15};//定义所要数组
             double built1Total = ExcelUtil.getDouble(jzhz,BashInfo.QT_HJ,0,2);//变电站建筑
@@ -312,7 +320,7 @@ public class SubstationService {
             List<Settlement> settlementBdzs = SettementUtil.getDLComparison(settlementsBdz,builtTotal,division,word1total,word2total,otherBdzTotal,feesBdzCount,cbperson);
             settlementService.save(settlementBdzs,id);
             double zjgcJzTotal = ExcelUtil.getDouble(jzhz,SubstationInfo.QT_HJ,0,3);//建筑直接工程费合计
-            double csJzFee = SubstationInfo.getCsJzFee(csqd2);//建筑措施分摊费
+//            double csJzFee = SubstationInfo.getCsJzFee(csqd2);//建筑措施分摊费
             double tbrJzFee = BashInfo.getFbrJzFee(tbrsb); //投标人建筑费
             double[] aqwmJzFees = ExcelUtil.getDoubleArray(csqd1,SubstationInfo.CS_SGZJ,1, new int[]{3, 4});  //建筑安全文明施工费
             double fbrJzFee = ExcelUtil.getDouble(jzqd,SubstationInfo.JZMX_BJZ,2,15);
@@ -415,8 +423,8 @@ public class SubstationService {
             feeAdjustService.save(jkxlAdjustFee);
         }
         if(jzgc ==0.00 && azgc != 0.00){
-            ImportExcel azqd = new ImportExcel(file, 1, SubstationInfo.SHEET_AZFBFXJJ);  //安装分部分项工程量清单计价表
-            ImportExcel azhz = new ImportExcel(file, 1, SubstationInfo.SHEET_HZHZB);   //安装工程费用汇总表
+            ImportExcel azqd = new ImportExcel(file, 1, SubstationInfo.SHEET_AZFBFXJJ,true);  //安装分部分项工程量清单计价表
+            ImportExcel azhz = new ImportExcel(file, 1, SubstationInfo.SHEET_HZHZB,true);   //安装工程费用汇总表
             //变电站结算汇总
             int[] comlumn2 = {12,15};//定义所要数组
             double built2Total = ExcelUtil.getDouble(azhz,BashInfo.QT_HJ,0,2);//变电站安装
@@ -426,7 +434,7 @@ public class SubstationService {
             List<Settlement> settlementBdzs = SettementUtil.getDLComparison(settlementsBdz,builtTotal,division,word1total,word2total,otherBdzTotal,feesBdzCount,cbperson);
             settlementService.save(settlementBdzs,id);
             double zjgcAzTotal = ExcelUtil.getDouble(azhz,SubstationInfo.QT_HJ,0,3);//安装直接工程费合计
-            double csAzFee = SubstationInfo.getCsAzFee(csqd2);//安装措施分摊费
+//            double csAzFee = SubstationInfo.getCsAzFee(csqd2);//安装措施分摊费
             double tbrAzFee = BashInfo.getFbrAzFee(tbrsb); //投标人安装费
             double[] aqwmAzFees = BashInfo.getAqwfAzFee(csqd1);  //安装安全文明施工费
             double fbrAzFee = ExcelUtil.getDouble(azqd,SubstationInfo.AZMX_BDZAZ,2,15);