Quellcode durchsuchen

年度预算-已执行情况计算总和优化

lgl vor 5 Monaten
Ursprung
Commit
1d2c818938

+ 1 - 0
src/main/java/com/liang/common/constants/CommonConstant.java

@@ -23,6 +23,7 @@ public class CommonConstant {
23 23
     public static final String ZJ = "总计";
24 24
     public static final String ZJF = "(一)直接费";
25 25
     public static final String RGF = "1.人工费";
26
+    public static final String SBF = "1.设备费";
26 27
     public static final String SBSYF = "2.设备使用费";
27 28
     public static final String YWF = "3.业务费";
28 29
     public static final String CDSYF = "4.场地使用费";

+ 65 - 32
src/main/java/com/liang/controller/PrjAnnualbudgetController.java

@@ -332,52 +332,85 @@ public class PrjAnnualbudgetController extends BaseController {
332 332
 
333 333
     private void sumYzxqk(List<Map<String, Object>> readValue, Set<String> nf, String xmlx) {
334 334
         for (String n : nf) {
335
+            String rgfbm = SFTYProperties.getNDYSBM(xmlx, CommonConstant.RGF);
335 336
             //更新人工费
336
-            List<Map<String, Object>> rgfs = readValue.stream().filter(item -> {
337
-                String ndysbm = SFTYProperties.getNDYSBM(xmlx, CommonConstant.RGF);
338
-                log.info("ndysbm"+ndysbm);
339
-                return ndysbm.equals(item.get("fj")) && item.get("yzxqk" + n) != null;
340
-            }).collect(Collectors.toList());
341
-            if (Tools.notEmpty(rgfs)) {
342
-                BigDecimal rgf = rgfs.stream().map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
343
-                readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx, CommonConstant.RGF).equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, rgf.setScale(2, 4)));
337
+            if (Tools.notEmpty(rgfbm)) {
338
+                List<Map<String, Object>> rgfs = readValue.stream().filter(item -> {
339
+                    return Tools.notEmpty(rgfbm) && rgfbm.equals(item.get("fj")) && item.get("yzxqk" + n) != null;
340
+                }).collect(Collectors.toList());
341
+                if (Tools.notEmpty(rgfs)) {
342
+                    BigDecimal rgf = rgfs.stream().map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
343
+                    readValue.stream().filter(item -> rgfbm.equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, rgf.setScale(2, 4)));
344
+                }
345
+            }
346
+            //更新设备费
347
+            String sbfbm = SFTYProperties.getNDYSBM(xmlx, CommonConstant.SBF);
348
+            if (Tools.notEmpty(sbfbm)) {
349
+                List<Map<String, Object>> sbfs = readValue.stream().filter(item -> {
350
+                    return Tools.notEmpty(sbfbm) && sbfbm.equals(item.get("fj")) && item.get("yzxqk" + n) != null;
351
+                }).collect(Collectors.toList());
352
+                if (Tools.notEmpty(sbfs)) {
353
+                    BigDecimal sbf = sbfs.stream().map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
354
+                    readValue.stream().filter(item -> sbfbm.equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, sbf.setScale(2, 4)));
355
+                }
344 356
             }
345 357
             //更新设备使用费
346
-            List<Map<String, Object>> sbsyfs = readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx, CommonConstant.SBSYF).equals(item.get("fj")) && item.get("yzxqk" + n) != null).collect(Collectors.toList());
347
-            if (Tools.notEmpty(sbsyfs)) {
348
-                BigDecimal sbsyf = sbsyfs.stream().map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
349
-                readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx, CommonConstant.SBSYF).equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(sbsyf)));
358
+            String sbsyfbm = SFTYProperties.getNDYSBM(xmlx, CommonConstant.SBSYF);
359
+            if (Tools.notEmpty(sbsyfbm)) {
360
+                List<Map<String, Object>> sbsyfs = readValue.stream().filter(item -> sbsyfbm.equals(item.get("fj")) && item.get("yzxqk" + n) != null).collect(Collectors.toList());
361
+                if (Tools.notEmpty(sbsyfs)) {
362
+                    BigDecimal sbsyf = sbsyfs.stream().map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
363
+                    readValue.stream().filter(item -> sbsyfbm.equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(sbsyf)));
364
+                }
350 365
             }
351 366
             //更新业务费
352
-            List<Map<String, Object>> yfws = readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx, CommonConstant.YWF).equals(item.get("fj")) && item.get("yzxqk" + n) != null).collect(Collectors.toList());
353
-            if (Tools.notEmpty(yfws)) {
354
-                BigDecimal ywf = yfws.stream().map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
355
-                readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx, CommonConstant.YWF).equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(ywf)));
367
+            String ywfbm = SFTYProperties.getNDYSBM(xmlx, CommonConstant.YWF);
368
+            if (Tools.notEmpty(ywfbm)) {
369
+                List<Map<String, Object>> yfws = readValue.stream().filter(item -> ywfbm.equals(item.get("fj")) && item.get("yzxqk" + n) != null).collect(Collectors.toList());
370
+                if (Tools.notEmpty(yfws)) {
371
+                    BigDecimal ywf = yfws.stream().map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
372
+                    readValue.stream().filter(item -> ywfbm.equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(ywf)));
373
+                }
356 374
             }
357 375
             //更新场地使用费
358
-            List<Map<String, Object>> cdsyfs = readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx, CommonConstant.CDSYF).equals(item.get("fj")) && item.get("yzxqk" + n) != null).collect(Collectors.toList());
359
-            if (Tools.notEmpty(cdsyfs)) {
360
-                BigDecimal cdsyf = yfws.stream().map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
361
-                readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx, CommonConstant.CDSYF).equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(cdsyf)));
376
+            String cdsyfbm = SFTYProperties.getNDYSBM(xmlx, CommonConstant.CDSYF);
377
+            if (Tools.notEmpty(cdsyfbm)) {
378
+                List<Map<String, Object>> cdsyfs = readValue.stream().filter(item -> cdsyfbm.equals(item.get("fj")) && item.get("yzxqk" + n) != null).collect(Collectors.toList());
379
+                if (Tools.notEmpty(cdsyfs)) {
380
+                    BigDecimal cdsyf = cdsyfs.stream().map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
381
+                    readValue.stream().filter(item -> cdsyfbm.equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(cdsyf)));
382
+                }
362 383
             }
384
+
363 385
             //更新外委支出费
364
-            List<Map<String, Object>> wwzcfs = readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx, CommonConstant.WWZCF).equals(item.get("fj")) && item.get("yzxqk" + n) != null).collect(Collectors.toList());
365
-            if (Tools.notEmpty(wwzcfs)) {
366
-                BigDecimal wwzcf = yfws.stream().map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
367
-                readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx, CommonConstant.WWZCF).equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(wwzcf)));
386
+            String wwzcfbm = SFTYProperties.getNDYSBM(xmlx, CommonConstant.WWZCF);
387
+            if (Tools.notEmpty(wwzcfbm)) {
388
+                List<Map<String, Object>> wwzcfs = readValue.stream().filter(item -> wwzcfbm.equals(item.get("fj")) && item.get("yzxqk" + n) != null).collect(Collectors.toList());
389
+                if (Tools.notEmpty(wwzcfs)) {
390
+                    BigDecimal wwzcf = wwzcfs.stream().map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
391
+                    readValue.stream().filter(item -> wwzcfbm.equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(wwzcf)));
392
+                }
368 393
             }
394
+
369 395
             //更新直接费
370
-            List<Map<String, Object>> zjfs = readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx, CommonConstant.ZJF).equals(item.get("fj")) && item.get("yzxqk" + n) != null).collect(Collectors.toList());
371
-            if (Tools.notEmpty(zjfs)) {
372
-                BigDecimal zjf = yfws.stream().map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
373
-                readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx, CommonConstant.ZJF).equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(zjf)));
396
+            String zjfbm = SFTYProperties.getNDYSBM(xmlx, CommonConstant.ZJF);
397
+            if (Tools.notEmpty(zjfbm)) {
398
+                List<Map<String, Object>> zjfs = readValue.stream().filter(item -> zjfbm.equals(item.get("fj")) && item.get("yzxqk" + n) != null).collect(Collectors.toList());
399
+                if (Tools.notEmpty(zjfs)) {
400
+                    BigDecimal zjf = zjfs.stream().map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
401
+                    readValue.stream().filter(item -> zjfbm.equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(zjf)));
402
+                }
374 403
             }
375 404
             //更新总计
376
-            List<Map<String, Object>> zjs = readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx, CommonConstant.ZJ).equals(item.get("fj")) && item.get("yzxqk" + n) != null).collect(Collectors.toList());
377
-            if (Tools.notEmpty(zjs)) {
378
-                BigDecimal zj = yfws.stream().map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
379
-                readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx, CommonConstant.ZJ).equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(zj)));
405
+            String zjbm = SFTYProperties.getNDYSBM(xmlx, CommonConstant.ZJ);
406
+            if (Tools.notEmpty(zjbm)) {
407
+                List<Map<String, Object>> zjs = readValue.stream().filter(item -> zjbm.equals(item.get("fj")) && item.get("yzxqk" + n) != null).collect(Collectors.toList());
408
+                if (Tools.notEmpty(zjs)) {
409
+                    BigDecimal zj = zjs.stream().map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
410
+                    readValue.stream().filter(item -> zjbm.equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(zj)));
411
+                }
380 412
             }
413
+
381 414
         }
382 415
     }
383 416