yangyj 2 mesi fa
parent
commit
928e0c4eb1

+ 24 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/ExecutorMeter.java

@@ -147,10 +147,16 @@ public class ExecutorMeter extends FormulaExecutor {
    /**根据清单编号获取支付项目章节编号*/
     public String getPrefix(String fn){
         if(fn!=null) {
+            /*是否包含保通道路*/
             boolean hasWord = fn.contains(BTDL);
             fn= fn.split("-")[0];
-            for (InventoryForm itf : tec.meterInfo.getChapter()) {
-                /*204-1-11(保通道路)*/
+            if (BaseUtils.isNumber(fn)) {
+                fn = String.valueOf(100 * (Integer.parseInt(fn) / 100));
+            }
+            if(hasWord){
+                fn=fn+":"+BTDL;
+            }
+           /* for (InventoryForm itf : tec.meterInfo.getChapter()) {
                 String prefix = chapterPreFixFc.apply(itf);
                 if (BaseUtils.isNumber(fn)) {
                     fn = String.valueOf(100 * (Integer.parseInt(fn) / 100));
@@ -161,7 +167,8 @@ public class ExecutorMeter extends FormulaExecutor {
                 if (fn.startsWith(prefix)) {
                     return prefix;
                 }
-            }
+            }*/
+
         }
         return fn;
     }
@@ -1667,7 +1674,20 @@ public class ExecutorMeter extends FormulaExecutor {
             LinkedHashMap<String,List<SubprojectInterimPaymentSummary>> chapterGroup= totalList.stream().sorted(Comparator.comparing(e->getPrefix(e.getFormNumber()))).collect(Collectors.groupingBy(e->getPrefix(e.getFormNumber()),LinkedHashMap::new,Collectors.toList()));
             AtomicInteger loop = new AtomicInteger(chapterGroup.size());
             List<String> chapterNames= new ArrayList<>();
-            chapterGroup.forEach((k,v)->{
+            List<String>  sortIndex = tec.meterInfo.getChapter().stream().map(ch-> getPrefix(ch)).collect(Collectors.toList());
+            chapterGroup.entrySet().stream().sorted(Comparator.comparingInt(e->{
+                String key = e.getKey();
+                if(key.contains(BTDL)){
+                    key=key.replace(":","(")+")";
+                }
+                int sort=sortIndex.indexOf(key);
+                if(sort<0){
+                    sort=99999;
+                }
+                return sort;
+            })).forEach(sis->{
+                String k=sis.getKey();
+                List<SubprojectInterimPaymentSummary> v=sis.getValue();
                 /*判断是否是最后一章*/
                 int extra=loop.getAndDecrement()>1?1:2;
                 /*每章小结或总结等价一行数据*/