Browse Source

2019-09-24 1617

xs 5 năm trước cách đây
mục cha
commit
4fbc8f184a

+ 72 - 165
src/main/java/com/jeeplus/modules/sg/overheadline/util/SettementUtil.java

@@ -98,17 +98,12 @@ public class SettementUtil {
     public static final String RESON_JGJS8=",小计,<span style='font-weight: bold;'>xxx</span>,";
     //变电站
     public static final String BDZ_TBBJ="《工程项目投标报价汇总表》,投标报价,<span style='font-weight: bold;'>xxx</span>,";
-    /*
-        增补税率差额
-     */
-    public static final String RESON_BZZS="补增值税税率调整差额";
+
     /*
        工程结算
     */
-    public static final String RESON_GCJS="《工程项目竣工结算汇总表》,工程结算价,<span style='font-weight: bold;'>xxx</span>,";
-    public static final String RESON_GCJS1=",竣工结算价合计,<span style='font-weight: bold;'>xxx</span>,";
-    public static final String RESON_GCJS2=",补增值税税率调整差额,<span style='font-weight: bold;'>xxx</span>,";
-    public static final String RESON_GCJS3=",扣减甲供材超供材料费,<span style='font-weight: bold;'>xxx</span>,";
+    public static final String RESON_GCJS="《工程项目竣工结算汇总表》,结算价,<span style='font-weight: bold;'>xxx</span>,";
+    public static final String RESON_GCJS1="《工程项目竣工结算汇总表》,结算价,<span style='font-weight: bold;'>xxx</span>,";
     public static final String[] DLBDZ_FBFX2 = {RESON_FBFX1,BDZ_FBFX1,BDZ_FBFX2,RESON_JGJS8,RESON_JZFBFX3,RESON_AZFBFX3,RESON_JGJS8};
     public static final String[] DLBDZ_FBFX1 = {RESON_FBFX1,RESON_JZFBFX,RESON_AZFBFX,RESON_JGJS8,RESON_JZFBFX3,RESON_AZFBFX3,RESON_JGJS8};
     /*
@@ -318,15 +313,11 @@ public class SettementUtil {
                     settlement.setTheAmount(str);
                     break;
                 case BashInfo.JS_GCJS:
-                    double[] gcComparison =getGcComparison(settlements);
-                    if (gcComparison[0]<=moneyComparison1&&gcComparison[0]>=moneyComparison2){
+                    double gcComparison =getGcComparison(settlements);
+                    if (gcComparison<=moneyComparison1&&gcComparison>=moneyComparison2){
                         settlement.setStatus("0");
                     }
-                    String gc = String.valueOf(nf.format(gcComparison[0])+','+
-                            nf.format(gcComparison[1])+','
-                            +nf.format(gcComparison[2])+','+
-                            nf.format(gcComparison[3]));
-                    settlement.setTheAmount(gc);
+                    settlement.setTheAmount(String.valueOf(nf.format(gcComparison)));
                     break;
                 default:
                     settlement.setStatus("2");
@@ -436,15 +427,11 @@ public class SettementUtil {
                     settlement.setTheAmount(str);
                     break;
                 case BashInfo.JS_GCJS:
-                    double[] gcComparison =getGcComparison(settlements);
-                    if (gcComparison[0]<=moneyComparison1&&gcComparison[0]>=moneyComparison2){
+                    double gcComparison =getGcComparison(settlements);
+                    if (gcComparison<=moneyComparison1&&gcComparison>=moneyComparison2){
                         settlement.setStatus("0");
                     }
-                    String gc = String.valueOf(nf.format(gcComparison[0])+','+
-                            nf.format(gcComparison[1])+','
-                            +nf.format(gcComparison[2])+','+
-                            nf.format(gcComparison[3]));
-                    settlement.setTheAmount(gc);
+                    settlement.setTheAmount(String.valueOf(nf.format(gcComparison)));
                     break;
                 default:
                     settlement.setStatus("2");
@@ -543,19 +530,18 @@ public class SettementUtil {
         }
         return doubles[0];
     }
-
     /**
      * 工程结算价 校验
      * @param settlements 《工程项目结算汇总表》 集合
      * @return double[] 计算匹配数据集合
      */
-    public static double[] getGcComparison(List<Settlement> settlements){
-        double[] doubles=new double[4];
-        double[] doubles1 = new double[8];
-        String name;
-        double money=0;
+    public static double getGcComparison(List<Settlement> settlements){
+        double fbrMoney = 0.0;
+        String name="";
+        double money=0.0;
         double minus = 0.0;
         double addcount = 0.0;
+        double count = 0.0;
         for (Settlement settlement:settlements){
             name = settlement.getEntryName();
             if (name.equals(BDZ_TBNAME)){
@@ -570,10 +556,10 @@ public class SettementUtil {
             if (name.equals(BDZ_TBNAME)){
                 name=BashInfo.JS_JGJS;
             }
-            if (name.contains(RESON_KYJ)&&!name.equals(BashInfo.JS_KJJG)){
+            if (name.contains(RESON_KYJ)){
                 name = RESON_KYJ;
             }
-            if (name.contains(RESON_KYJ1)&&!name.equals(BashInfo.JS_KJJG)){
+            if (name.contains(RESON_KYJ1)){
                 name = RESON_KYJ1;
             }
             if (name.equals(RESON_ZZJS)){
@@ -581,26 +567,8 @@ public class SettementUtil {
             }
             money =settlement.getMoney();
             switch (name) {
-                case BashInfo.JS_FBFX:
-                    doubles1[1]=money;
-                    break;
-                case BashInfo.JS_CBRF:
-                    doubles1[2]=money;
-                    break;
-                case BashInfo.JS_CSXM:
-                    doubles1[3]=money;
-                    break;
-                case BashInfo.JS_QTXM:
-                    doubles1[4]=money;
-                    break;
-                case BashInfo.JS_GF:
-                    doubles1[5]=money;
-                    break;
-                case BashInfo.JS_SJ:
-                    doubles1[6]=money;
-                    break;
                 case BashInfo.JS_FBRF:
-                    doubles1[7]=money;
+                    fbrMoney+=money;
                     break;
                 case RESON_KYJ:
                     minus += money;
@@ -608,12 +576,6 @@ public class SettementUtil {
                 case RESON_KYJ1:
                     minus += money;
                     break;
-                case BashInfo.JS_BZZS://补增值税
-                    doubles[2]=money;
-                    break;
-                case BashInfo.JS_KJJG://扣减
-                    doubles[3]=money;
-                    break;
                 default:
                     if (!name.equals(BashInfo.JS_JGJS)&&!name.equals(BashInfo.JS_GCJS)){
                         addcount+=money;
@@ -622,13 +584,11 @@ public class SettementUtil {
             }
         }
         if (getFlag){
-            doubles1[0]=doubles1[1]+doubles1[2]+doubles1[3]+doubles1[4]+doubles1[5]+doubles1[6]-doubles1[7]-minus+addcount;
+            count =addcount-fbrMoney-minus;
         }else {
-            doubles1[0]=doubles1[1]+doubles1[2]+doubles1[3]+doubles1[4]+doubles1[5]+doubles1[6]-minus+addcount;
+            count=addcount-minus;
         }
-        doubles[1]=doubles1[0];
-        doubles[0]=doubles[1]+doubles[2]-doubles[3];
-        return doubles;
+        return count;
     }
     /**
      * 前台显示提示数据匹配:架空线路
@@ -637,7 +597,6 @@ public class SettementUtil {
      */
     public static List<Settlement> getSelectSettlement(List<Settlement> settlementList){
         boolean flag = false;//定义开关
-        boolean[] booleans =getJgforJoint(settlementList);
         String key="";
         String reason="";
         for(Settlement settlement:settlementList){
@@ -654,6 +613,10 @@ public class SettementUtil {
                 flag=true;
                 key = BashInfo.JS_JGJS;
             }
+            if (key.equals(RESON_ZZJS)){
+                flag = true;
+                key = BashInfo.GCJS;
+            }
             switch (key){
                 case BashInfo.JS_FBFX:
                     reason = getFbfxJoint(settlement);
@@ -705,16 +668,13 @@ public class SettementUtil {
                     }
                     settlement.setReason(reason);
                     break;
-                case BashInfo.JS_BZZS:
-                    reason=RESON_BZZS;
-                    settlement.setReason(reason);
-                    break;
-                case BashInfo.JS_KJJG:
-                    reason=RESON_BZZS;
-                    settlement.setReason(reason);
-                    break;
                 case BashInfo.GCJS:
-                    reason=getJshzJoint(settlement,booleans);
+                    if(flag){
+                        settlement.setEntryName(RESON_ZZJS);
+                        reason=getJshzJoint(RESON_GCJS1,settlement,settlementList);
+                    }else {
+                        reason=getJshzJoint(RESON_GCJS,settlement,settlementList);
+                    }
                     settlement.setReason(reason);
                     break;
             }
@@ -728,7 +688,6 @@ public class SettementUtil {
      */
     public static List<Settlement> getSelectDlSettlement(List<Settlement> settlementList){
         boolean flag = false;//定义开关
-        boolean[] booleans =getJgforJoint(settlementList);
         String key="";
         String reason="";
         for(Settlement settlement:settlementList){
@@ -745,6 +704,10 @@ public class SettementUtil {
                 flag=true;
                 key = BashInfo.JS_JGJS;
             }
+            if (key.equals(RESON_ZZJS)){
+                flag = true;
+                key = BashInfo.GCJS;
+            }
             switch (key){
                 case BashInfo.JS_FBFX:
                     reason = getDJoint(settlement,DLBDZ_FBFX1);
@@ -796,16 +759,13 @@ public class SettementUtil {
                     }
                     settlement.setReason(reason);
                     break;
-                case BashInfo.JS_BZZS:
-                    reason=RESON_BZZS;
-                    settlement.setReason(reason);
-                    break;
-                case BashInfo.JS_KJJG:
-                    reason=RESON_BZZS;
-                    settlement.setReason(reason);
-                    break;
                 case BashInfo.GCJS:
-                    reason=getJshzJoint(settlement,booleans);
+                    if(flag){
+                        settlement.setEntryName(RESON_ZZJS);
+                        reason=getJshzJoint(RESON_GCJS1,settlement,settlementList);
+                    }else {
+                        reason=getJshzJoint(RESON_GCJS,settlement,settlementList);
+                    }
                     settlement.setReason(reason);
                     break;
             }
@@ -820,7 +780,6 @@ public class SettementUtil {
      */
     public static List<Settlement> getSelectBdzSettlement(List<Settlement> settlementList){
         boolean flag = false;//定义开关
-        boolean[] booleans =getJgforJoint(settlementList);//判断读取存在字段
         String key=""; //匹配字段
         String reason=""; //提示 字段
         for(Settlement settlement:settlementList){
@@ -838,6 +797,10 @@ public class SettementUtil {
                 flag=true;
                 key = BDZ_TBNAME;
             }
+            if (key.equals(RESON_ZZJS)){
+                flag = true;
+                key = BashInfo.GCJS;
+            }
             switch (key){
                 case BashInfo.JS_FBFX:
                     reason = getDJoint(settlement,DLBDZ_FBFX2);
@@ -889,16 +852,13 @@ public class SettementUtil {
                     }
                     settlement.setReason(reason);
                     break;
-                case BashInfo.JS_BZZS:
-                    reason=RESON_BZZS;
-                    settlement.setReason(reason);
-                    break;
-                case BashInfo.JS_KJJG:
-                    reason=RESON_BZZS;
-                    settlement.setReason(reason);
-                    break;
                 case BashInfo.GCJS:
-                    reason=getJshzJoint(settlement,booleans);
+                    if(flag){
+                        settlement.setEntryName(RESON_ZZJS);
+                        reason=getJshzJoint(RESON_GCJS1,settlement,settlementList);
+                    }else {
+                        reason=getJshzJoint(RESON_GCJS,settlement,settlementList);
+                    }
                     settlement.setReason(reason);
                     break;
             }
@@ -1078,27 +1038,33 @@ public class SettementUtil {
         }
         return reason;
     }
-
     /**
      * 工程结算
-     * @param settlement bean
-     * @param booleans 判断工程结算 对比 字段 是否存在
-     * @return bean rason
+     * @param tops
+     * @param settlement
+     * @param settlements
+     * @return String
      */
-    public static String getJshzJoint(Settlement settlement,boolean[] booleans){
+    public static String getJshzJoint(String tops,Settlement settlement,List<Settlement> settlements){
         String reason="";
-        String[] amout=settlement.getTheAmount().split(",");
-        reason+=RESON_GCJS.replace("xxx",String.valueOf(nf.format(settlement.getMoney())));
-        if (booleans[8]){
-            reason+=RESON_GCJS1.replace("xxx",amout[1]);
-        }
-        if (booleans[9]){
-            reason+=RESON_GCJS2.replace("xxx",amout[2]);
-        }
-        if (booleans[10]) {
-            reason +=RESON_GCJS3.replace("xxx", amout[3]);
+        reason = tops.replace("xxx",String.valueOf(nf.format(settlement.getMoney())));
+        String amout=settlement.getTheAmount();
+        for (int i = 0; i < settlements.size(); i++) {
+            if (settlements.get(i).getEntryName().equals(BashInfo.JS_JGJS)){
+                continue;
+            }
+            if (settlements.get(i).getEntryName().equals(BashInfo.JS_GCJS)){
+                reason+=RESON_JGJS8.replace("xxx",amout);
+                if (settlement.getStatus().equals("0")){
+                    reason+=SettementUtil.RESON_TRUE;
+                }else {
+                    reason+=SettementUtil.RESON_FLASE;
+                }
+                return reason;
+            }
+            reason += ","+settlements.get(i).getEntryName()+",<span style='font-weight: bold;'>"+nf.format(settlements.get(i).getMoney())+"</span>,";
         }
-        reason+=RESON_JGJS8.replace("xxx",amout[0]);
+        reason+=RESON_JGJS8.replace("xxx",amout);
         if (settlement.getStatus().equals("0")){
             reason+=SettementUtil.RESON_TRUE;
         }else {
@@ -1106,65 +1072,6 @@ public class SettementUtil {
         }
         return reason;
     }
-
-    /**
-     * 获取 工程竣工、工程投标 是否存在
-     * @param settlements 汇总表 所有数据 list 集合
-     * @return 布尔  数组
-     */
-    public static boolean[] getJgforJoint(List<Settlement> settlements){
-        String key = "";
-        boolean[] booleans = new boolean[11];
-        for (int i = 0; i < booleans.length; i++) {
-            booleans[i]=false;
-        }
-        for (int i = 0; i < settlements.size(); i++) {
-            key =  settlements.get(i).getEntryName();
-            if(key.equals(BDZ_TBRNAME)){
-                key=BashInfo.JS_CBRF;
-            }
-            if (key.equals(BDZ_ZBRNAME)){
-                key=BashInfo.JS_FBRF;
-            }
-            if (key.equals(BDZ_TBNAME)){
-                key=BashInfo.JS_JGJS;
-            }
-            switch (key){
-                case BashInfo.JS_FBFX:
-                    booleans[1]=true;
-                    break;
-                case  BashInfo.JS_CBRF:
-                    booleans[2]=true;
-                    break;
-                case BashInfo.JS_CSXM:
-                    booleans[3]=true;
-                    break;
-                case BashInfo.JS_QTXM:
-                    booleans[4]=true;
-                    break;
-                case BashInfo.JS_GF:
-                    booleans[5]=true;
-                    break;
-                case BashInfo.JS_SJ:
-                    booleans[6]=true;
-                    break;
-                case BashInfo.JS_FBRF:
-                    booleans[7]=true;
-                    break;
-                case BashInfo.JS_JGJS://竣工结算
-                    booleans[8]=true;
-                    break;
-                case BashInfo.JS_BZZS://补增值税
-                    booleans[9]=true;
-                    break;
-                case BashInfo.JS_KJJG://扣减
-                    booleans[10]=true;
-                    break;
-            }
-        }
-        return booleans;
-    }
-
     /**
      *  添加获取数据到settlement 对象
      * @param settlement bean