Browse Source

年度预算-年度预算详情编码配置

lgl 5 months ago
parent
commit
bb3151f9f6

+ 33 - 0
src/main/java/com/liang/common/config/SFTYProperties.java

@@ -1,18 +1,51 @@
1 1
 package com.liang.common.config;
2 2
 
3 3
 
4
+import com.liang.common.constants.CommonConstant;
5
+import com.liang.common.utils.SpringUtil;
6
+import com.liang.dao.BaseProjectbudgetDao;
7
+import com.liang.vo.dto.Ndysbm;
4 8
 import lombok.Data;
5 9
 import lombok.NoArgsConstructor;
10
+import lombok.extern.slf4j.Slf4j;
6 11
 import org.springframework.boot.context.properties.ConfigurationProperties;
7 12
 import org.springframework.stereotype.Component;
8 13
 
14
+import java.util.HashMap;
15
+import java.util.List;
16
+import java.util.Map;
17
+import java.util.stream.Collectors;
18
+
9 19
 import static com.liang.common.config.SFTYProperties.PREFIX;
10 20
 
11 21
 @Component
12 22
 @ConfigurationProperties(PREFIX)
13 23
 @Data
14 24
 @NoArgsConstructor
25
+@Slf4j
15 26
 public class SFTYProperties {
27
+    static Map<String, Map<String, String>> NDYSBM = new HashMap<>();
28
+
29
+    static {
30
+        BaseProjectbudgetDao baseProjectbudgetDao = SpringUtil.getBean("baseProjectbudgetDao");
31
+
32
+        List<Ndysbm> ndysbms = baseProjectbudgetDao.getNDYSBM();
33
+        Map<String, List<Ndysbm>> collect = ndysbms.stream().collect(Collectors.groupingBy(Ndysbm::getXmlx));
34
+        collect.forEach((k, v) -> {
35
+            Map<String, String> bm = new HashMap<>();
36
+            v.forEach(item -> {
37
+                bm.put(item.getMc(), item.getBm());
38
+            });
39
+            NDYSBM.put(k, bm);
40
+        });
41
+        log.info("============NDYSBM 初始化成功 :{}================", NDYSBM);
42
+    }
43
+
44
+    public static String getNDYSBM(String xmlx,String bmmc) {
45
+        Map<String, String> map = NDYSBM.get(xmlx);
46
+        return map.get(bmmc);
47
+    }
48
+
16 49
     public static final String PREFIX = "sfty";
17 50
 
18 51
     private String uploadFilePath;

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

@@ -16,4 +16,16 @@ public class CommonConstant {
16 16
     public static final String WTJFH = "未提交(返回)";
17 17
     public static final String WTJ = "未提交";
18 18
     public static final String SPJS = "审批结束";
19
+    /**
20
+     * 模板项目预算
21
+     */
22
+
23
+    public static final String ZJ = "总计";
24
+    public static final String ZJF = "(一)直接费";
25
+    public static final String RGF = "1.人工费";
26
+    public static final String SBSYF = "2.设备使用费";
27
+    public static final String YWF = "3.业务费";
28
+    public static final String CDSYF = "4.场地使用费";
29
+    public static final String WWZCF = "(三)外委支出费";
30
+
19 31
 }

+ 18 - 16
src/main/java/com/liang/controller/PrjAnnualbudgetController.java

@@ -8,6 +8,8 @@ import com.github.pagehelper.PageInfo;
8 8
 import com.liang.common.JsonTool;
9 9
 import com.liang.common.base.BaseController;
10 10
 import com.liang.common.base.BaseResult;
11
+import com.liang.common.config.SFTYProperties;
12
+import com.liang.common.constants.CommonConstant;
11 13
 import com.liang.common.enums.PostInfoEnum;
12 14
 import com.liang.common.enums.ProjectTypeEnnum;
13 15
 import com.liang.common.utils.ExcelPoiUtil;
@@ -304,7 +306,7 @@ public class PrjAnnualbudgetController extends BaseController {
304 306
 
305 307
                 Set<String> nf = yzxqkVos.stream().map(PrjAnnualbudgetYzxqkVo::getNf).collect(Collectors.toSet());
306 308
                 //后端对已执行情况的父级求和
307
-                sumYzxqk(readValue, nf);
309
+                sumYzxqk(readValue, nf,yzxqkVos.get(0).getXmlx());
308 310
                 nf.forEach(nfItem -> {
309 311
                     readValue.stream().forEach(item -> {
310 312
                         Double ysje = allBudgetDetails.stream().filter(allBudgetDetailItem -> allBudgetDetailItem.getFymc().equals(item.get("fymc")) && nfItem.equals(String.valueOf(allBudgetDetailItem.getNf()))).collect(Collectors.toList()).get(0).getYsje();
@@ -326,29 +328,29 @@ public class PrjAnnualbudgetController extends BaseController {
326 328
 
327 329
     }
328 330
 
329
-    private void sumYzxqk(List<Map<String, Object>> readValue, Set<String> nf) {
331
+    private void sumYzxqk(List<Map<String, Object>> readValue, Set<String> nf, String xmlx) {
330 332
         for (String n : nf) {
331 333
             //更新人工费
332
-            BigDecimal rgf = readValue.stream().filter(item -> "32".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);
333
-            readValue.stream().filter(item -> "32".equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, rgf.setScale(2, 4)));
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)));
334 336
             //更新设备使用费
335
-            BigDecimal sbsyf = readValue.stream().filter(item -> "36".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);
336
-            readValue.stream().filter(item -> "36".equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(sbsyf)));
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)));
337 339
             //更新业务费
338
-            BigDecimal ywf = readValue.stream().filter(item -> "39".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);
339
-            readValue.stream().filter(item -> "39".equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(ywf)));
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)));
340 342
             //更新场地使用费
341
-            BigDecimal cdsyf = readValue.stream().filter(item -> "43".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);
342
-            readValue.stream().filter(item -> "43".equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(cdsyf)));
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)));
343 345
             //更新外委支出费
344
-            BigDecimal wwzcf = readValue.stream().filter(item -> "48".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);
345
-            readValue.stream().filter(item -> "48".equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(wwzcf)));
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)));
346 348
             //更新直接费
347
-            BigDecimal zjf = readValue.stream().filter(item -> "31".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);
348
-            readValue.stream().filter(item -> "31".equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(zjf)));
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)));
349 351
             //更新总计
350
-            BigDecimal zj = readValue.stream().filter(item -> "30".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);
351
-            readValue.stream().filter(item -> "30".equals(item.get("bm"))).forEach(item -> item.put("yzxqk" + n, String.valueOf(zj)));
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)));
352 354
         }
353 355
     }
354 356
 

+ 4 - 0
src/main/java/com/liang/dao/BaseProjectbudgetDao.java

@@ -1,6 +1,7 @@
1 1
 package com.liang.dao;
2 2
 
3 3
 import com.liang.entity.BaseProjectbudget;
4
+import com.liang.vo.dto.Ndysbm;
4 5
 import org.apache.ibatis.annotations.Param;
5 6
 import org.springframework.data.domain.Pageable;
6 7
 
@@ -109,5 +110,8 @@ public interface BaseProjectbudgetDao {
109 110
      * @return
110 111
      */
111 112
     List<BaseProjectbudget> getBudgetListByXmlx(String xmlx);
113
+
114
+    List<Ndysbm> getNDYSBM();
115
+
112 116
 }
113 117
 

+ 1 - 0
src/main/java/com/liang/vo/PrjAnnualbudgetYzxqkVo.java

@@ -18,4 +18,5 @@ public class PrjAnnualbudgetYzxqkVo {
18 18
     private String bzje;
19 19
     private String fymc;
20 20
     private String nf;
21
+    private String xmlx;
21 22
 }

+ 21 - 0
src/main/java/com/liang/vo/dto/Ndysbm.java

@@ -0,0 +1,21 @@
1
+package com.liang.vo.dto;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Builder;
5
+import lombok.Data;
6
+import lombok.NoArgsConstructor;
7
+
8
+/**
9
+ * @author by lgl
10
+ * @date 2024/5/13.
11
+ */
12
+@Data
13
+@Builder
14
+@NoArgsConstructor
15
+@AllArgsConstructor
16
+public class Ndysbm {
17
+    private String mc;
18
+    private String bm;
19
+    private String xmlx;
20
+
21
+}

+ 14 - 0
src/main/resources/mapper/BaseProjectbudgetDao.xml

@@ -202,5 +202,19 @@
202 202
                  LEFT JOIN base_ProjectBudget AS b ON t.ID = b.XM
203 203
         where p.ID = #{xm}
204 204
     </select>
205
+    <select id="getNDYSBM" resultType="com.liang.vo.dto.Ndysbm">
206
+        SELECT bpb.mc,bpb.bm , bpt.XMLX
207
+        FROM
208
+            base_ProjectBudget bpb ,base_ProjectTemplate bpt
209
+        WHERE bpb.XM = bpt.ID
210
+          AND (bpb.MC = '总计'
211
+               OR bpb.MC = '(一)直接费'
212
+               OR bpb.MC = '1.人工费'
213
+               OR bpb.MC = '2.设备使用费'
214
+               OR bpb.MC = '3.业务费'
215
+               OR bpb.MC = '4.场地使用费'
216
+               OR bpb.MC = '(三)外委支出费')
217
+        order by xmlx
218
+    </select>
205 219
 </mapper>
206 220
 

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

@@ -625,8 +625,8 @@
625 625
         AND NYS=#{nys})
626 626
     </select>
627 627
     <select id="getYzxqk" resultType="com.liang.vo.PrjAnnualbudgetYzxqkVo">
628
-        SELECT convert(decimal(18,2),(sum(BZJE)/10000)) BZJE ,pa.fymc,sb.nf
629
-        from(SELECT	sb.id ,sb.fylb,pa.nf
628
+        SELECT convert(decimal(18,2),(sum(BZJE)/10000)) BZJE ,pa.fymc,sb.nf,sb.xmlx
629
+        from(SELECT	sb.id ,sb.fylb,pa.nf,pa.xmlx
630 630
              from sta_BudgetApproval sb
631 631
                  left join prj_AnnualBudget pa on pa.id = sb.nys
632 632
              where	nys in (
@@ -637,7 +637,7 @@
637 637
                  )) sb
638 638
                 left join sta_Reimbursement sa on sa.fysq = sb.id
639 639
                 LEFT join prj_AnnualBudgetDetail pa on pa.id = sb.fylb
640
-        group by pa.fymc,sb.nf
640
+        group by pa.fymc,sb.nf,sb.xmlx
641 641
         order by sb.nf asc
642 642
     </select>
643 643
     <select id="getNf" resultType="com.liang.vo.PrjAnnualbudgetYzxqkVo">