Browse Source

年度预算-增加本年度已申请金额和已报账金额

lgl 5 months ago
parent
commit
2d83c7d93a

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

@@ -292,6 +292,8 @@ public class PrjAnnualbudgetController extends BaseController {
292 292
         List<PrjAnnualbudgetdetail> list = prjAnnualbudgetdetailService.getBudgetList(nys);
293 293
         //获取已执行情况
294 294
         List<PrjAnnualbudgetYzxqkVo> yzxqkVos = prjAnnualbudgetdetailDao.getYzxqk(nys);
295
+        //获取所有的年度预算
296
+        List<PrjAnnualbudgetdetail> allBudgetDetails = prjAnnualbudgetdetailService.listAllBudgetDetail(nys);
295 297
         String res = "";
296 298
         try {
297 299
             List<Map<String, Object>> readValue = JsonTool.getObjectMapper().readValue(JsonTool.toJsonString(list), List.class);
@@ -299,9 +301,17 @@ public class PrjAnnualbudgetController extends BaseController {
299 301
                 yzxqkVos.forEach(yzxItem -> {
300 302
                     readValue.stream().filter(item -> item.get("fymc").equals(yzxItem.getFymc())).forEach(item -> item.put("yzxqk" + yzxItem.getNf(), yzxItem.getBzje()));
301 303
                 });
304
+
302 305
                 Set<String> nf = yzxqkVos.stream().map(PrjAnnualbudgetYzxqkVo::getNf).collect(Collectors.toSet());
303 306
                 //后端对已执行情况的父级求和
304 307
                 sumYzxqk(readValue, nf);
308
+                nf.forEach(nfItem -> {
309
+                    readValue.stream().forEach(item -> {
310
+                        Double ysje = allBudgetDetails.stream().filter(allBudgetDetailItem -> allBudgetDetailItem.getFymc().equals(item.get("fymc")) && nfItem.equals(String.valueOf(allBudgetDetailItem.getNf()))).collect(Collectors.toList()).get(0).getYsje();
311
+
312
+                        item.put("yzxqk" + nfItem, (ysje == null ? 0 : ysje) + "(" + (item.get("yzxqk" + nfItem) == null ? 0 : item.get("yzxqk" + nfItem)) + ")");
313
+                    });
314
+                });
305 315
             }
306 316
             res = JsonTool.toJsonString(readValue);
307 317
         } catch (JsonProcessingException e) {

+ 2 - 0
src/main/java/com/liang/dao/PrjAnnualbudgetdetailDao.java

@@ -132,5 +132,7 @@ public interface PrjAnnualbudgetdetailDao {
132 132
     List<PrjAnnualbudgetYzxqkVo> getYzxqk(@Param("nys") Integer nys);
133 133
 
134 134
     List<PrjAnnualbudgetYzxqkVo> getNf(@Param("nys")Integer nys);
135
+
136
+    List<PrjAnnualbudgetdetail> listAllBudgetDetail(@Param("nys") Integer nys);
135 137
 }
136 138
 

+ 4 - 0
src/main/java/com/liang/entity/PrjAnnualbudgetdetail.java

@@ -6,6 +6,7 @@ import lombok.Data;
6 6
 import lombok.NoArgsConstructor;
7 7
 
8 8
 import java.io.Serializable;
9
+import java.math.BigDecimal;
9 10
 import java.util.HashMap;
10 11
 import java.util.Map;
11 12
 
@@ -205,5 +206,8 @@ public class PrjAnnualbudgetdetail implements Serializable {
205 206
      */
206 207
     private Double dnzyzf;
207 208
 
209
+    private BigDecimal bndsqje;
210
+    private BigDecimal bndbzje;
211
+
208 212
 }
209 213
 

+ 2 - 0
src/main/java/com/liang/service/PrjAnnualbudgetdetailService.java

@@ -89,4 +89,6 @@ public interface PrjAnnualbudgetdetailService {
89 89
 
90 90
 
91 91
     Integer getSubNodeCount(@Param("nys") Integer nys, @Param("page") Integer page, @Param("limit") Integer limit);
92
+
93
+    List<PrjAnnualbudgetdetail> listAllBudgetDetail(@Param("nys") Integer nys);
92 94
 }

+ 5 - 0
src/main/java/com/liang/service/impl/PrjAnnualbudgetdetailServiceImpl.java

@@ -229,4 +229,9 @@ public class PrjAnnualbudgetdetailServiceImpl implements PrjAnnualbudgetdetailSe
229 229
         return this.prjAnnualbudgetdetailDao.getSubNodeCount(nys,page,limit);
230 230
     }
231 231
 
232
+    @Override
233
+    public List<PrjAnnualbudgetdetail> listAllBudgetDetail(Integer nys) {
234
+        return this.prjAnnualbudgetdetailDao.listAllBudgetDetail(nys);
235
+    }
236
+
232 237
 }

+ 45 - 5
src/main/resources/mapper/PrjAnnualbudgetdetailDao.xml

@@ -14,6 +14,8 @@
14 14
         <result property="px" column="PX" jdbcType="VARCHAR"/>
15 15
         <result property="hjbm" column="HJBM" jdbcType="VARCHAR"/>
16 16
         <result property="bz" column="BZ" jdbcType="VARCHAR"/>
17
+        <result property="bndsqje" column="bndbzje" jdbcType="NUMERIC"/>
18
+        <result property="bndsqje" column="bndbzje" jdbcType="NUMERIC"/>
17 19
         <result property="dw1" column="DW1" jdbcType="NUMERIC"/>
18 20
         <result property="dw2" column="DW2" jdbcType="NUMERIC"/>
19 21
         <result property="dw3" column="DW3" jdbcType="NUMERIC"/>
@@ -517,8 +519,33 @@
517 519
 
518 520
     <!--获取年度预算-->
519 521
     <select id="getBudgetList" resultMap="PrjAnnualbudgetdetailMap">
520
-        select (select FYMC from prj_AnnualBudgetDetail where BM = b.FJ and NYS = b.NYS) as FJMC, b.*
522
+        select (select FYMC from prj_AnnualBudgetDetail where BM = b.FJ and NYS = b.NYS) as FJMC,
523
+               ID, b.FYMC, YSJE, YSQJE, NYS, BM, FJ, NF, PX, HJBM, BZ, DW1, DW2, DW3, DW4, DW5, DW6, DW7, DW8, DW9, DW10, SJYS1, SJYS2, SJYS3, SJYS4, SJYS5, SJYS6, SJYS7, SJYS8, SJYS9, SJYS10, XTJSYZX, XMZ,BYJ, ZRJE, RWSYS, XMZYS, YBZJE, ZCBYJ, KYYS, ZCJE, BYJYSQ, BYQYBZ, ZRBYJ, DNZYZF,
524
+               a.bzje sjyzx,
525
+               c.bndsqje,
526
+               c.bndbzje
521 527
         from prj_AnnualBudgetDetail b
528
+        left join (
529
+        SELECT convert(decimal(18,2),(sum(BZJE)/10000))  BZJE ,pa.fymc
530
+        from(SELECT	id ,fylb
531
+        from sta_BudgetApproval
532
+        where	nys in (
533
+        select	id
534
+        from prj_AnnualBudget
535
+        where rws = (select  rws from prj_AnnualBudget where id = #{nys}) and nf &lt; (select  nf  from prj_AnnualBudget where id = #{nys}) )) sb
536
+        left join sta_Reimbursement sa on sa.fysq = sb.id
537
+        LEFT join prj_AnnualBudgetDetail pa on pa.id = sb.fylb group by pa.fymc
538
+        ) a on a.fymc = b.fymc
539
+        left join (
540
+            SELECT SUM(sb.SQJE) bndsqje, SUM(sr.BZJE) bndbzje,pa.FYMC
541
+            from
542
+            sta_BudgetApproval sb
543
+            left join sta_Reimbursement sr on sr.FYSQ = sb.ID and sr.SPZT = '审批结束'
544
+            left join prj_AnnualBudgetDetail pa on pa.ID = sb.FYLB
545
+            where
546
+             sb.NYS = #{nys} and sb.SPZT != '作废'
547
+            GROUP by pa.FYMC
548
+        ) c on c.fymc = b.fymc
522 549
         where NYS = #{nys}
523 550
     </select>
524 551
 
@@ -599,12 +626,15 @@
599 626
     </select>
600 627
     <select id="getYzxqk" resultType="com.liang.vo.PrjAnnualbudgetYzxqkVo">
601 628
         SELECT convert(decimal(18,2),(sum(BZJE)/10000)) BZJE ,pa.fymc,sb.nf
602
-        from(SELECT	id ,fylb,nf
603
-             from sta_BudgetApproval
629
+        from(SELECT	sb.id ,sb.fylb,pa.nf
630
+             from sta_BudgetApproval sb
631
+                 left join prj_AnnualBudget pa on pa.id = sb.nys
604 632
              where	nys in (
605 633
                  select	id
606 634
                  from prj_AnnualBudget
607
-                 where rws = (select rws from prj_AnnualBudget where ID = #{nys}))) sb
635
+                 where rws = (select rws from prj_AnnualBudget where ID = #{nys})
636
+                   AND  NF &lt;( select DISTINCT NF from prj_AnnualBudget  where id = #{nys} )
637
+                 )) sb
608 638
                 left join sta_Reimbursement sa on sa.fysq = sb.id
609 639
                 LEFT join prj_AnnualBudgetDetail pa on pa.id = sb.fylb
610 640
         group by pa.fymc,sb.nf
@@ -613,7 +643,17 @@
613 643
     <select id="getNf" resultType="com.liang.vo.PrjAnnualbudgetYzxqkVo">
614 644
         select DISTINCT NF
615 645
         from prj_AnnualBudget
616
-        where rws = (SELECT RWS  from prj_AnnualBudget where id = #{nys})
646
+        where
647
+         rws = (SELECT RWS  from prj_AnnualBudget where id = #{nys})
648
+        AND  NF &lt;( select DISTINCT NF from prj_AnnualBudget  where id = #{nys} )
649
+    </select>
650
+    <select id="listAllBudgetDetail" resultType="com.liang.entity.PrjAnnualbudgetdetail">
651
+        select a.FYMC ,a.YSJE ,b.NF
652
+        from
653
+            prj_AnnualBudgetDetail A
654
+            left join prj_AnnualBudget B on b.ID = A.NYS
655
+        where
656
+           nys in (select  ID from prj_AnnualBudget where rws = (select  rws from prj_AnnualBudget where id = #{nys}))
617 657
     </select>
618 658
 </mapper>
619 659
 

+ 17 - 11
src/main/resources/templates/annualbudget/view_annualbudget.html

@@ -254,6 +254,13 @@
254 254
                 nf = result;
255 255
             }
256 256
         });
257
+        var field = "";
258
+        var title = "已执行情况";
259
+        if (nf.length === 1) {
260
+            field = nf[0].title;
261
+            title = title + nf[0].title;
262
+            nf = new Array();
263
+        }
257 264
         let fjArray = []
258 265
         fjArray = Array.from(dataBudget1, ({fj}) => fj)
259 266
         for (var j = 0; j < dataBudget1.length; j++) {
@@ -281,17 +288,16 @@
281 288
             // toolbar: '#toolbarDemo',
282 289
             cols: [
283 290
                 [
284
-                    {type: 'numbers', width: '3%',rowspan:2},
285
-                    {field: 'fymc', width: '30%', title: '费用名称',rowspan:2},
286
-                    {field: 'xmzys', width: '12%', title: '项目总预算',rowspan:2},
287
-                    {field: 'xtjsyzx', width: '15%', title: '系统计算已执行',rowspan:2},
288
-                    {field: 'yzxqk', width: '15%',align: 'center',title: '已执行情况',colspan:nf.length},
289
-                    {field: 'sjyzx', width: '12%', title: '实际已执行',rowspan:2},
290
-                    {field: 'ysje', width: '10%', title: '预算金额',rowspan:2},
291
-                    {field: 'xmz', width: '9%', title: '项目组',rowspan:2},
292
-                    {field: "byj", width: '9%', title: '备用金',rowspan:2}
293
-                    // {field: 'ysqje', width: '11%', title: '已申请金额'},
294
-                    // {field: 'ybzje', width: '11%', title: '已报账金额'},
291
+                    {type: 'numbers', width: '3%', rowspan: 2},
292
+                    {field: 'fymc', width: '30%', title: '费用名称', rowspan: 2},
293
+                    {field: 'xmzys', width: '12%', title: '项目总预算', rowspan: 2},
294
+                    {field: 'yzxqk' + field, width: '15%', align: 'center', title: title, colspan: nf.length},
295
+                    {field: 'sjyzx', width: '12%', title: '实际已执行', rowspan: 2},
296
+                    {field: 'ysje', width: '10%', title: '预算金额', rowspan: 2},
297
+                    {field: 'xmz', width: '9%', title: '项目组', rowspan: 2},
298
+                    {field: "byj", width: '9%', title: '备用金', rowspan: 2},
299
+                    {field: 'bndsqje', width: '11%', title: '本年度已申请金额'},
300
+                    {field: 'bndbzje', width: '11%', title: '本年度已报账金额'},
295 301
                     // {field: 'byjysq', width: '11%', title: '备用金已申请'},
296 302
                     // {field: 'byjybz', width: '11%', title: '备用金已报账'}
297 303
                 ], nf