瀏覽代碼

年度预算旧数据显示与高亮对比数据不一致问题

梁世豪 7 月之前
父節點
當前提交
dfff9a0b22

+ 38 - 0
src/main/java/com/liang/controller/PrjAnnualbudgetController.java

@@ -354,6 +354,44 @@ public class PrjAnnualbudgetController extends BaseController {
354 354
         }
355 355
         return res;
356 356
     }
357
+    /**
358
+     * 获取项目修改预算列表
359
+     *
360
+     * @return
361
+     */
362
+    @ResponseBody
363
+    @RequestMapping(value = "/list_xg/{nys}", method = RequestMethod.POST)
364
+    public Object xglist(@PathVariable Integer nys) {
365
+        List<PrjAnnualbudgetdetail> list = prjAnnualbudgetdetailService.getSptgZt(nys);
366
+        //获取已执行情况
367
+        List<PrjAnnualbudgetYzxqkVo> yzxqkVos = prjAnnualbudgetdetailDao.getYzxqk(nys);
368
+        //获取所有的年度预算
369
+        List<PrjAnnualbudgetdetail> allBudgetDetails = prjAnnualbudgetdetailService.listAllBudgetDetail(nys);
370
+        String res = "";
371
+        try {
372
+            List<Map<String, Object>> readValue = JsonTool.getObjectMapper().readValue(JsonTool.toJsonString(list), List.class);
373
+            if (!Tools.isEmpty(yzxqkVos)) {
374
+                yzxqkVos.forEach(yzxItem -> {
375
+                    readValue.stream().filter(item -> item.get("fymc").equals(yzxItem.getFymc())).forEach(item -> item.put("yzxqk" + yzxItem.getNf(), yzxItem.getBzje()));
376
+                });
377
+
378
+                Set<String> nf = yzxqkVos.stream().map(PrjAnnualbudgetYzxqkVo::getNf).collect(Collectors.toSet());
379
+                //后端对已执行情况的父级求和
380
+                sumYzxqk(readValue, nf, yzxqkVos.get(0).getXmlx());
381
+                nf.forEach(nfItem -> {
382
+                    readValue.stream().forEach(item -> {
383
+                        Double ysje = allBudgetDetails.stream().filter(allBudgetDetailItem -> allBudgetDetailItem.getFymc().equals(item.get("fymc")) && nfItem.equals(String.valueOf(allBudgetDetailItem.getNf()))).collect(Collectors.toList()).get(0).getYsje();
384
+
385
+                        item.put("yzxqk" + nfItem, (ysje == null ? 0 : ysje) + "(" + (item.get("yzxqk" + nfItem) == null ? 0 : item.get("yzxqk" + nfItem)) + ")");
386
+                    });
387
+                });
388
+            }
389
+            res = JsonTool.toJsonString(readValue);
390
+        } catch (JsonProcessingException e) {
391
+            e.printStackTrace();
392
+        }
393
+        return res;
394
+    }
357 395
 
358 396
     public static void main(String[] args) {
359 397
         System.out.println(Math.floor(3.6799999999));

+ 1 - 1
src/main/resources/templates/annualbudget/xgview_record.html

@@ -63,7 +63,7 @@
63 63
         //经费预算
64 64
         var dataBudget1 = new Array();
65 65
         $.ajax({
66
-            url: AjaxUtil.ctx + 'prjAnnualbudget/list/' + ysId,
66
+            url: AjaxUtil.ctx + 'prjAnnualbudget/list_xg/' + ysId,
67 67
             type: "post",
68 68
             async: false,
69 69
             dataType: "json",