Browse Source

万盛中期计量

chenr 1 ngày trước cách đây
mục cha
commit
1d35fa76b9

+ 27 - 7
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -3036,10 +3036,14 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
               monthlyReport.setNowC(percentage);
            }
             //到本期末完成
+            //如果有到上期末完成金额,和本期完成金额  则到本期末完成金额=到上期末完成金额+本期完成金额
             if(ObjectUtil.isNotEmpty(monthlyReport.getBeforeEndMoney())&&ObjectUtil.isNotEmpty(monthlyReport.getNowMoney())){
                 monthlyReport.setNowEndMoney(monthlyReport.getBeforeEndMoney().add(monthlyReport.getNowMoney()));
-            }else if(ObjectUtil.isEmpty(monthlyReport.getBeforeEndMoney())&&ObjectUtil.isNotEmpty(monthlyReport.getNowMoney())){
+            }//如果到上期末完成金额为空,本期完成金额不为空 本期末完成金额=本期完成金额
+            else if(ObjectUtil.isEmpty(monthlyReport.getBeforeEndMoney())&&ObjectUtil.isNotEmpty(monthlyReport.getNowMoney())){
                 monthlyReport.setNowEndMoney(monthlyReport.getNowMoney());
+            }else if(ObjectUtil.isEmpty(monthlyReport.getNowMoney())&&ObjectUtil.isNotEmpty(monthlyReport.getBeforeEndMoney())){
+                monthlyReport.setNowEndMoney(monthlyReport.getBeforeEndMoney());
             }
             if(ObjectUtil.isNotEmpty(monthlyReport.getNowEndMoney())){
                 BigDecimal percentage = monthlyReport.getNowEndMoney().divide(monthlyReport.getCurrentMeterMoney(), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
@@ -3133,6 +3137,10 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
           m11.setBeforeEndC(m3.getBeforeEndC());
         }
         m11.setNowMoney(m3.getNowMoney());
+        BigDecimal percentage7 = m11.getNowMoney().divide(m11.getAfterCurrentMeterMoney(), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
+        percentage7 = percentage7.setScale(2, BigDecimal.ROUND_HALF_UP);
+        m11.setNowC(percentage7);
+
         if(ObjectUtil.isNotEmpty(m3.getNowEndMoney())){
             m11.setNowEndMoney(m3.getNowEndMoney());
             m11.setNowEndC(m3.getNowEndC());
@@ -3172,6 +3180,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
 
         MonthlyReportVo m18 = new MonthlyReportVo();
         m18.setFormName("扣款合计");
+        if(ObjectUtil.isNotEmpty(m13.getBeforeEndMoney())){
+         m18.setBeforeEndMoney(m13.getBeforeEndMoney());
+        }
         m18.setNowMoney(m13.getNowMoney());
         m18.setNowEndMoney(m13.getNowEndMoney());
         values.add(m18);
@@ -3191,7 +3202,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         m19.setNowEndMoney(m11.getNowEndMoney().subtract(m18.getNowEndMoney()));
         BigDecimal percentage6 = m19.getNowEndMoney().divide(m11.getAfterCurrentMeterMoney(), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
         percentage6 = percentage6.setScale(2, BigDecimal.ROUND_HALF_UP);
-        m19.setNowC(percentage6);
+        m19.setNowEndC(percentage6);
         values.add(m19);
         setZeroBigDecimalFieldsToNullInList(values);
         InputStream modInput = null;
@@ -3275,7 +3286,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                    oldMiddleMeterApply.setContractId(contractId);
                    oldMiddleMeterApply.setContractPeriodId(list.get(j-1).getId());
                    List<MeterInventoryDetailVO>  oldFormDetail=middleMeterApplyClient.formDetail(oldMiddleMeterApply);
-                   oldFormDetailMap.put("第"+j+"期",oldFormDetail);
+                   oldFormDetailMap.put(list.get(j-1).getId().toString(),oldFormDetail);
                 }
             }
         }
@@ -3350,16 +3361,18 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                 for (Map.Entry<String, List<MeterInventoryDetailVO>> entry : changeFormDetailMap.entrySet()) {
                     for (MeterInventoryDetailVO changevo : entry.getValue()) {
                         if(changevo.getFormNumber().equals(vo.getFormNumber())){
-                         b1=b1.add(changevo.getAllMeterTotal());
-                         b2=b2.add(changevo.getAllMeterMoney());
+                         b1=bladeRedis.get("period"+entry.getKey()+"formNumber"+vo.getFormNumber()+"detailsTotal");
+                         b2=bladeRedis.get("period"+entry.getKey()+"formNumber"+vo.getFormNumber()+"detailsMoney");
                          break;
                        }
                     }
                }
+             if(ObjectUtil.isNotEmpty(b1)&&ObjectUtil.isNotEmpty(b2)){
               //到上期末完成工程量
-              vo.setBeforeEndTotal(!b1.equals(BigDecimal.ZERO)?b1.setScale(0, RoundingMode.HALF_UP):null);
+              vo.setBeforeEndTotal(b1);
               //到上期末完成金额
               vo.setBeforeEndMoney(!b2.equals(BigDecimal.ZERO)?b2.setScale(0, RoundingMode.HALF_UP):null);
+             }
           }
             //到本期末完成工程量
             if(vo.getBeforeEndTotal()!=null){
@@ -3373,6 +3386,13 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             }else {
                 vo.setNowEndMoney(vo.getNowMoney().setScale(0, RoundingMode.HALF_UP));
             }
+            if(ObjectUtil.isNotEmpty(vo.getNowEndTotal())&&!vo.getNowEndTotal().equals(BigDecimal.ZERO)){
+                bladeRedis.set("period"+periodId+"formNumber"+vo.getFormNumber()+"detailsTotal",vo.getNowEndTotal());
+            }
+            if(ObjectUtil.isNotEmpty(vo.getNowEndMoney())&&!vo.getNowEndMoney().equals(BigDecimal.ZERO)){
+                bladeRedis.set("period"+periodId+"formNumber"+vo.getFormNumber()+"detailsMoney",vo.getNowEndMoney());
+            }
+
             list1.add(vo);
         }
         setZeroBigDecimalFieldsToNullInList(list1);
@@ -3511,7 +3531,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                     listUrl.add(bladeFile.getPdfUrl());
                 }
                 //本期末完成 本期ID+章节号
-                bladeRedis.set("periodId:"+periodId+"formNum:"+listEntry.getKey()+"nowMoney",totalNowMoney);
+                bladeRedis.set("periodId:"+periodId+"formNum:"+listEntry.getKey()+"nowMoney",totalNowEndMoney);
             }
             collectionUtilsClient.mergePdfPublicMethods(listUrl, localImgUrl);
             //上传oss