Przeglądaj źródła

万盛中期计量

chenr 4 dni temu
rodzic
commit
7f3705e860

+ 3 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/ExecutorCalc.java

@@ -75,6 +75,9 @@ public class ExecutorCalc extends FormulaExecutor {
         /*并发说明:有依赖关系,需要按顺序执行,否则有可能取不到内容*/
         ExecuteFlow executeFlow=createExecuteFlow();
         for(FormData fd:tec.formDataList){
+            if(fd.getId().equals(1760570626336096285L)){
+                System.out.println("");
+            }
             if(fd.verify()){
                 try {
                     /*自定义脚本预处理*/

+ 18 - 19
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -923,7 +923,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                         Formula tf= formulaIdMap.get(d.getK());
                         if(tf!=null&&e.getId()!=null) {
                             e.setFormula(tf);
-                            tec.formDataList.add(e);
+                            //tec.formDataList.add(e);
                             ElementFormulaMapping efm = new ElementFormulaMapping();
                             efm.setScope(FormulaBean.PARAM);
                             efm.setParamId(d.getId());
@@ -2986,13 +2986,13 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             if(index.isPresent()){
                 int j = index.getAsInt();
                 if(j>0){
-                    for (int i = 0; i < j; i++) {
-                        Object o = bladeRedis.get("redisId"+redisId+"periodId:"+list.get(j).getId()+"formNum:"+key+"nowMoney");
+                    //期数ID,章节号
+                        Object o = bladeRedis.get("periodId:"+list.get(j-1).getId()+"formNum:"+key+"nowMoney");
                         if(ObjectUtil.isNotEmpty(o)){
                             beforeEndMoney=beforeEndMoney.add ((BigDecimal) o);
                         }
-                    }
                   if(!beforeEndMoney.equals(BigDecimal.ZERO)){
+                      //到上期末完成
                       monthlyReport.setBeforeEndMoney(beforeEndMoney);
                       BigDecimal percentage = monthlyReport.getBeforeEndMoney().divide(monthlyReport.getCurrentMeterMoney(), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
                       percentage = percentage.setScale(2, BigDecimal.ROUND_HALF_UP); // 设置
@@ -3002,7 +3002,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             }
          }
             //本期完成
-            Object o = bladeRedis.get("redisId"+redisId+"periodId:"+periodId+"formNum:"+key+"nowMoney");
+            Object o = bladeRedis.get("periodId:"+periodId+"formNum:"+key+"nowMoney");
             if(ObjectUtil.isNotEmpty(o)){
              monthlyReport.setNowMoney((BigDecimal)o);
               BigDecimal percentage = monthlyReport.getNowMoney().divide(monthlyReport.getCurrentMeterMoney(), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
@@ -3244,21 +3244,19 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             if(index.isPresent()){
                 int j = index.getAsInt();
                 if(j>0){
-                    for (int i = 0; i < j; i++) {
-                   MiddleMeterApply oldMiddleMeterApply=new MiddleMeterApply();
+                    MiddleMeterApply oldMiddleMeterApply=new MiddleMeterApply();
                    oldMiddleMeterApply.setProjectId(projectId);
                    oldMiddleMeterApply.setContractId(contractId);
-                   oldMiddleMeterApply.setContractPeriodId(list.get(i).getId());
+                   oldMiddleMeterApply.setContractPeriodId(list.get(j-1).getId());
                    List<MeterInventoryDetailVO>  oldFormDetail=middleMeterApplyClient.formDetail(oldMiddleMeterApply);
-                   oldFormDetailMap.put("第"+i+1+"期",oldFormDetail);
-                 }
+                   oldFormDetailMap.put("第"+j+"期",oldFormDetail);
                 }
             }
         }
         //上期且需要变化的清单明细
         Map<String,List<MeterInventoryDetailVO>> changeFormDetailMap=new HashMap<>();
         if(oldFormDetailMap.size()>0){
-            for (Map.Entry<String, List<MeterInventoryDetailVO>> entry : changeFormDetailMap.entrySet()) {
+            for (Map.Entry<String, List<MeterInventoryDetailVO>> entry : oldFormDetailMap.entrySet()) {
                 List<MeterInventoryDetailVO>changelist=new ArrayList<>();
                 List<MeterInventoryDetailVO> value = entry.getValue();
                 for (MeterInventoryDetailVO vo : value) {
@@ -3326,17 +3324,17 @@ 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.getCurrentMeterTotal());
-                         b2=b2.add(changevo.getCurrentMeterMoney());
+                         b1=b1.add(changevo.getAllMeterTotal());
+                         b2=b2.add(changevo.getAllMeterMoney());
                          break;
                        }
                     }
                }
-            //到上期末完成工程量
-            vo.setBeforeEndTotal(b1.setScale(0, RoundingMode.HALF_UP));
-            //到上期末完成金额
-            vo.setBeforeEndMoney(b2.setScale(0, RoundingMode.HALF_UP));
-        }
+              //到上期末完成工程量
+              vo.setBeforeEndTotal(!b1.equals(BigDecimal.ZERO)?b1.setScale(0, RoundingMode.HALF_UP):null);
+              //到上期末完成金额
+              vo.setBeforeEndMoney(!b2.equals(BigDecimal.ZERO)?b2.setScale(0, RoundingMode.HALF_UP):null);
+          }
             //到本期末完成工程量
             if(vo.getBeforeEndTotal()!=null){
                 vo.setNowEndTotal(vo.getBeforeEndTotal().add(vo.getNowTotal()));
@@ -3485,7 +3483,8 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                     NewBladeFile bladeFile = this.commonFileClient.excelToPdf(files);
                     listUrl.add(bladeFile.getPdfUrl());
                 }
-                bladeRedis.set("redisId"+redisId+"periodId:"+periodId+"formNum:"+listEntry.getKey()+"nowMoney",totalNowMoney);
+                //本期末完成 本期ID+章节号
+                bladeRedis.set("periodId:"+periodId+"formNum:"+listEntry.getKey()+"nowMoney",totalNowMoney);
             }
             collectionUtilsClient.mergePdfPublicMethods(listUrl, localImgUrl);
             //上传oss

+ 1 - 1
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/TaskController.java

@@ -3671,7 +3671,7 @@ public class TaskController extends BladeController {
         /*如果数据没有变化,则各表的PDF可以不用更新*/
         ExecutionTime executionTime = new ExecutionTime();
         List<ReportResult> reportResults;
-        if(ObjectUtil.isNotEmpty(report.getProjectId())&&report.getProjectId().equals(1764484458576179201L)){
+        if(ObjectUtil.isNotEmpty(report.getProjectId())&&report.getProjectId().equals(1847548977467035649L)){
              reportResults=formulaClient.formulaExecute4(report.getId(),report.getContractId(),report.getPeriodId(),report.getType(),report.getProjectId());
             /*合并所有表*/
             String file_path = CollectionUtils.getSysLocalFileUrl();