Browse Source

年度预算-已执行情况bug

lgl 5 months ago
parent
commit
da92c99b26

+ 42 - 15
src/main/java/com/liang/controller/PrjAnnualbudgetController.java

@@ -21,6 +21,7 @@ import com.liang.service.*;
21 21
 import com.liang.vo.PrjAnnualbudgetNfVo;
22 22
 import com.liang.vo.PrjAnnualbudgetYzxqkVo;
23 23
 import io.swagger.annotations.ApiOperation;
24
+import lombok.extern.slf4j.Slf4j;
24 25
 import org.springframework.data.domain.Page;
25 26
 import org.springframework.data.domain.PageRequest;
26 27
 import org.springframework.http.ResponseEntity;
@@ -43,6 +44,7 @@ import java.util.stream.Collectors;
43 44
  * @since 2023-05-17 08:56:49
44 45
  */
45 46
 @Controller
47
+@Slf4j
46 48
 @RequestMapping("prjAnnualbudget")
47 49
 public class PrjAnnualbudgetController extends BaseController {
48 50
     /**
@@ -306,7 +308,7 @@ public class PrjAnnualbudgetController extends BaseController {
306 308
 
307 309
                 Set<String> nf = yzxqkVos.stream().map(PrjAnnualbudgetYzxqkVo::getNf).collect(Collectors.toSet());
308 310
                 //后端对已执行情况的父级求和
309
-                sumYzxqk(readValue, nf,yzxqkVos.get(0).getXmlx());
311
+                sumYzxqk(readValue, nf, yzxqkVos.get(0).getXmlx());
310 312
                 nf.forEach(nfItem -> {
311 313
                     readValue.stream().forEach(item -> {
312 314
                         Double ysje = allBudgetDetails.stream().filter(allBudgetDetailItem -> allBudgetDetailItem.getFymc().equals(item.get("fymc")) && nfItem.equals(String.valueOf(allBudgetDetailItem.getNf()))).collect(Collectors.toList()).get(0).getYsje();
@@ -331,26 +333,51 @@ public class PrjAnnualbudgetController extends BaseController {
331 333
     private void sumYzxqk(List<Map<String, Object>> readValue, Set<String> nf, String xmlx) {
332 334
         for (String n : nf) {
333 335
             //更新人工费
334
-            BigDecimal rgf = readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx,CommonConstant.RGF).equals(item.get("fj")) && Tools.notEmpty(item.get("yzxqk" + n))).map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
335
-            readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx,CommonConstant.RGF).equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, rgf.setScale(2, 4)));
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)));
344
+            }
336 345
             //更新设备使用费
337
-            BigDecimal sbsyf = readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx,CommonConstant.SBSYF).equals(item.get("fj")) && Tools.notEmpty(item.get("yzxqk" + n))).map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
338
-            readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx,CommonConstant.SBSYF).equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(sbsyf)));
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)));
350
+            }
339 351
             //更新业务费
340
-            BigDecimal ywf = readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx,CommonConstant.YWF).equals(item.get("fj")) && Tools.notEmpty(item.get("yzxqk" + n))).map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
341
-            readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx,CommonConstant.YWF).equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(ywf)));
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)));
356
+            }
342 357
             //更新场地使用费
343
-            BigDecimal cdsyf = readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx,CommonConstant.CDSYF).equals(item.get("fj")) && Tools.notEmpty(item.get("yzxqk" + n))).map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
344
-            readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx,CommonConstant.CDSYF).equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(cdsyf)));
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)));
362
+            }
345 363
             //更新外委支出费
346
-            BigDecimal wwzcf = readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx,CommonConstant.WWZCF).equals(item.get("fj")) && Tools.notEmpty(item.get("yzxqk" + n))).map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
347
-            readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx,CommonConstant.WWZCF).equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(wwzcf)));
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)));
368
+            }
348 369
             //更新直接费
349
-            BigDecimal zjf = readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx,CommonConstant.ZJF).equals(item.get("fj")) && Tools.notEmpty(item.get("yzxqk" + n))).map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
350
-            readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx,CommonConstant.ZJF).equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(zjf)));
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)));
374
+            }
351 375
             //更新总计
352
-            BigDecimal zj = readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx,CommonConstant.ZJ).equals(item.get("fj")) && Tools.notEmpty(item.get("yzxqk" + n))).map(item -> new BigDecimal(String.valueOf(item.get("yzxqk" + n)))).reduce(BigDecimal.ZERO, BigDecimal::add);
353
-            readValue.stream().filter(item -> SFTYProperties.getNDYSBM(xmlx,CommonConstant.ZJ).equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(zj)));
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)));
380
+            }
354 381
         }
355 382
     }
356 383
 

+ 3 - 3
src/main/resources/mapper/PrjAnnualbudgetdetailDao.xml

@@ -627,9 +627,9 @@
627 627
     <select id="getYzxqk" resultType="com.liang.vo.PrjAnnualbudgetYzxqkVo">
628 628
         SELECT convert(decimal(18,2),(sum(BZJE)/10000)) BZJE ,pa.fymc,sb.nf,sb.xmlx
629 629
         from(SELECT	sb.id ,sb.fylb,pa.nf,pa.xmlx
630
-             from sta_BudgetApproval sb
631
-                 left join prj_AnnualBudget pa on pa.id = sb.nys
632
-             where	nys in (
630
+             from  prj_AnnualBudget pa
631
+                 left join sta_BudgetApproval sb on pa.id = sb.nys
632
+             where	pa.id in (
633 633
                  select	id
634 634
                  from prj_AnnualBudget
635 635
                  where rws = (select rws from prj_AnnualBudget where ID = #{nys})