Browse Source

年度预算-已执行情况v2.0 历史数据处理

lgl 5 months ago
parent
commit
dae30faf1d

+ 6 - 0
src/main/java/com/liang/dao/PrjAnnualbudgetDao.java

@@ -155,5 +155,11 @@ public interface PrjAnnualbudgetDao {
155 155
     void updateSJYZXByNysId(@Param("rwsId") Integer rwsId, @Param("nf") String nf, @Param("nysId") Integer nysId);
156 156
 
157 157
     void updateSJYZXSumByNysId(@Param("rwsId") Integer rwsId, @Param("nf") String nf, @Param("nysId") Integer nysId);
158
+
159
+    void updateZFXMFYMC(@Param("nysId") Integer nysId, @Param("rwsId") Integer rwsId);
160
+
161
+    void updateSXGSKJXMFYMC(@Param("nysId") Integer nysId, @Param("rwsId") Integer rwsId);
162
+
163
+    void updateGWGSKJXMFYMC(@Param("nysId") Integer nysId, @Param("rwsId") Integer rwsId);
158 164
 }
159 165
 

+ 20 - 11
src/main/java/com/liang/service/impl/PrjAnnualbudgetServiceImpl.java

@@ -1,6 +1,8 @@
1 1
 package com.liang.service.impl;
2 2
 
3 3
 import com.liang.common.base.BaseResult;
4
+import com.liang.common.enums.ProjectTypeEnnum;
5
+import com.liang.common.exception.CustomException;
4 6
 import com.liang.dao.PrjAnnualbudgetDao;
5 7
 import com.liang.dao.PrjAnnualbudgetdetailDao;
6 8
 import com.liang.entity.PrjAnnualbudget;
@@ -157,20 +159,27 @@ public class PrjAnnualbudgetServiceImpl implements PrjAnnualbudgetService {
157 159
             prjAnnualbudgetDao.updateSJYZXSum(rws);
158 160
         }
159 161
     }
162
+
160 163
     @GetMapping("/updateSJYZXAndXTJSYZX/{rwsId}/{nysId}")
161 164
     @Transactional(rollbackFor = Exception.class)
162
-    public BaseResult updateSJYZXAndXTJSYZX(@PathVariable("rwsId")Integer rwsId, @PathVariable("nysId")Integer nysId) {
163
-        List<PrjAnnualbudget> prjAnnualbudgets = prjAnnualbudgetDao.listByRws(rwsId);
164
-        //第一年的年度预算不需要更新
165
-        if (!Collections.isEmpty(prjAnnualbudgets) && !prjAnnualbudgets.get(0).getId().equals(nysId)) {
166
-            PrjAnnualbudget annualbudget = prjAnnualbudgets.stream().filter(item -> item.getId().equals(nysId)).collect(Collectors.toList()).get(0);
167
-            //更新 系统计算已执行
168
-            prjAnnualbudgetDao.updateXTJSYZXByNysId(rwsId,annualbudget.getNf(),annualbudget.getId());
169
-            //更新 历史年度预算的实际已执行
170
-            prjAnnualbudgetDao.updateSJYZXByNysId(rwsId,annualbudget.getNf(),annualbudget.getId());
171
-            //更新已执行总计
172
-//            prjAnnualbudgetDao.updateSJYZXSumByNysId(rwsId,annualbudget.getNf(),annualbudget.getId());
165
+    public BaseResult updateSJYZXAndXTJSYZX(@PathVariable("rwsId") Integer rwsId, @PathVariable("nysId") Integer nysId) {
166
+        PrjAnnualbudget prjAnnualbudget = prjAnnualbudgetDao.queryById(nysId);
167
+        try {
168
+            if (ProjectTypeEnnum.ZFLXM.getCode().equals(prjAnnualbudget.getXmlx())) {
169
+                //政府项目
170
+                //更新费用名称
171
+                prjAnnualbudgetDao.updateZFXMFYMC(nysId, rwsId);
172
+            } else if (ProjectTypeEnnum.SXGSKJXM.getCode().equals(prjAnnualbudget.getXmlx())) {
173
+                //陕西公司科技项目
174
+                prjAnnualbudgetDao.updateSXGSKJXMFYMC(nysId, rwsId);
175
+            } else if (ProjectTypeEnnum.GWGSKJXM.getCode().equals(prjAnnualbudget.getXmlx())) {
176
+                //国网公司科技项目
177
+                prjAnnualbudgetDao.updateGWGSKJXMFYMC(nysId, rwsId);
178
+            }
179
+        } catch (Exception e) {
180
+            throw new CustomException("已执行数据同步失败");
173 181
         }
182
+
174 183
         return BaseResult.success("已执行数据同步成功");
175 184
     }
176 185
 

+ 98 - 0
src/main/resources/mapper/PrjAnnualbudgetDao.xml

@@ -529,6 +529,97 @@
529 529
         where
530 530
             NYS = #{nysId}
531 531
     </update>
532
+    <update id="updateZFXMFYMC">
533
+        update prj_AnnualBudgetDetail  set FYMC  = '(一)直接费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a15524497';
534
+        update prj_AnnualBudgetDetail  set FYMC  = '1、设备费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a155612437';
535
+        update prj_AnnualBudgetDetail  set FYMC  = '(1)购置设备费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a155639759';
536
+        update prj_AnnualBudgetDetail  set FYMC  = '(2)试制设备费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a155757605';
537
+        update prj_AnnualBudgetDetail  set FYMC  = '(3)设备改造与租赁费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a155830224';
538
+        update prj_AnnualBudgetDetail  set FYMC  = '2、材料费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a155903296';
539
+        update prj_AnnualBudgetDetail  set FYMC  = '3、测试实验加工费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a160001888';
540
+        update prj_AnnualBudgetDetail  set FYMC  = '4、燃料动力费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a160026901';
541
+        update prj_AnnualBudgetDetail  set FYMC  = '5、差旅费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a160047208';
542
+        update prj_AnnualBudgetDetail  set FYMC  = '6、会议费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a160100215';
543
+        update prj_AnnualBudgetDetail  set FYMC  = '7、国际合作与交流费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a160112278';
544
+        update prj_AnnualBudgetDetail  set FYMC  = '8、出版/文献/信息传播/知识产权事务费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a160131916';
545
+        update prj_AnnualBudgetDetail  set FYMC  = '9、劳务费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a160425416';
546
+        update prj_AnnualBudgetDetail  set FYMC  = '10、专家咨询费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a160458412';
547
+        update prj_AnnualBudgetDetail  set FYMC  = '11、其他支出' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a160517974';
548
+        update prj_AnnualBudgetDetail  set FYMC  = '(二)间接费用' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a160623545';
549
+        update prj_AnnualBudgetDetail  set FYMC  = '其中:绩效来源' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a160654304';
550
+        update prj_AnnualBudgetDetail  set FYMC  = '(三)外委支出费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a100055750';
551
+        update prj_AnnualBudgetDetail  set FYMC  = '(1)外委支出费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a142751829';
552
+        update A
553
+        set  A.bm = B.bm, A.fj = B.fj
554
+            from prj_AnnualBudgetDetail A
555
+        inner join (
556
+         select bp.* from base_ProjectBudget bp ,prj_Project pp,base_ProjectTemplate bpt
557
+         where pp.xmlx = bpt.xmlx and bpt.id = bp.xm  and pp.id = #{rwsId}
558
+            ) B on A.FYMC = B.mc
559
+        where
560
+            NYS in ( SELECT id from prj_AnnualBudget where rws =  #{rwsId} );
561
+    </update>
562
+    <update id="updateSXGSKJXMFYMC">
563
+        UPDATE prj_AnnualBudgetDetail set bm = '7' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = '6' and FYMC = '2.设备使用费' ;
564
+        UPDATE prj_AnnualBudgetDetail set bm = '8' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = '7' and FYMC = '(1)仪器设备使用费' ;
565
+        UPDATE prj_AnnualBudgetDetail set bm = '9' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = '8' and FYMC = '(2)软件使用费' ;
566
+        UPDATE prj_AnnualBudgetDetail set bm = '10' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = '9' and FYMC = '3.业务费' ;
567
+        UPDATE prj_AnnualBudgetDetail set bm = '11' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = '10' and FYMC = '(1)材料费' ;
568
+        UPDATE prj_AnnualBudgetDetail set bm = '12' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = '11' and FYMC = '(2)资料、印刷及知识产权费' ;
569
+        UPDATE prj_AnnualBudgetDetail set bm = '13' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = '12' and FYMC = '(3)会议、差旅及国际合作交流费' ;
570
+        UPDATE prj_AnnualBudgetDetail set bm = '14' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = '17' and FYMC = '4.场地使用费' ;
571
+        UPDATE prj_AnnualBudgetDetail set bm = '15' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = '18' and FYMC = '(1)场地物业费' ;
572
+        UPDATE prj_AnnualBudgetDetail set bm = '16' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = '19' and FYMC = '(2)场地使用租金' ;
573
+        UPDATE prj_AnnualBudgetDetail set bm = '17' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = '20' and FYMC = '5.专家咨询费' ;
574
+        UPDATE prj_AnnualBudgetDetail set bm = '18' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = '21' and FYMC = '(二)间接费' ;
575
+        UPDATE prj_AnnualBudgetDetail set bm = '19' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = '22' and FYMC = '(三)外委支出费' ;
576
+        UPDATE prj_AnnualBudgetDetail set bm = '20' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = '23' and FYMC = '1.外委研究支出费' ;
577
+        UPDATE prj_AnnualBudgetDetail set bm = '21' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = '24' and FYMC = '2.仪器设备租赁费' ;
578
+        UPDATE prj_AnnualBudgetDetail set bm = '22' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = '25' and FYMC = '3.外协测试试验与加工费' ;
579
+        UPDATE prj_AnnualBudgetDetail set bm = '23' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = '26' and FYMC = '(四)税金' ;
580
+        update A
581
+        set  A.fymc = B.mc, A.fj = B.fj
582
+            from prj_AnnualBudgetDetail A
583
+        inner join (
584
+         select bp.* from base_ProjectBudget bp ,prj_Project pp,base_ProjectTemplate bpt
585
+         where pp.xmlx = bpt.xmlx and bpt.id = bp.xm  and pp.id = #{rwsId}
586
+            ) B on A.bm = B.bm
587
+        where
588
+            NYS in ( SELECT id from prj_AnnualBudget where rws =  #{rwsId} );
589
+    </update>
590
+    <update id="updateGWGSKJXMFYMC">
591
+        update prj_AnnualBudgetDetail  set FYMC  = '(一)直接费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a100002972';
592
+        update prj_AnnualBudgetDetail  set FYMC  = '1.人工费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a100100606';
593
+        update prj_AnnualBudgetDetail  set FYMC  = '(1)专职研究人员人工费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a100252246';
594
+        update prj_AnnualBudgetDetail  set FYMC  = '(2)劳务外包人员人工费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a10025555';
595
+        update prj_AnnualBudgetDetail  set FYMC  = '(3)临时性研究人员人工费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a094823724';
596
+        update prj_AnnualBudgetDetail  set FYMC  = '2.设备使用费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a100124784';
597
+        update prj_AnnualBudgetDetail  set FYMC  = '(1)仪器设备使用费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a10033260';
598
+        update prj_AnnualBudgetDetail  set FYMC  = '(2)软件使用费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a100335414';
599
+        update prj_AnnualBudgetDetail  set FYMC  = '3.业务费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a100142605';
600
+        update prj_AnnualBudgetDetail  set FYMC  = '(1)材料费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a100402638';
601
+        update prj_AnnualBudgetDetail  set FYMC  = '(2)资料,印刷及知识产权费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a100404901';
602
+        update prj_AnnualBudgetDetail  set FYMC  = '(3)会议,差旅及国际合作交流费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a100406974';
603
+        update prj_AnnualBudgetDetail  set FYMC  = '场地使用费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a100145230';
604
+        update prj_AnnualBudgetDetail  set FYMC  = '(1)场地物业费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a100529887';
605
+        update prj_AnnualBudgetDetail  set FYMC  = '(2)场地使用租金' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a10053223';
606
+        update prj_AnnualBudgetDetail  set FYMC  = '5.专家咨询费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a100237514';
607
+        update prj_AnnualBudgetDetail  set FYMC  = '(二)间接费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a10055632';
608
+        update prj_AnnualBudgetDetail  set FYMC  = '外委支出费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a100604109';
609
+        update prj_AnnualBudgetDetail  set FYMC  = '1.外委研究支出费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a10063271';
610
+        update prj_AnnualBudgetDetail  set FYMC  = '2.仪器设备租赁费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a1006345';
611
+        update prj_AnnualBudgetDetail  set FYMC  = '3.外协测试试验与加工费' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a100635599';
612
+        update prj_AnnualBudgetDetail  set FYMC  = '(四)税金' where nys in (SELECT id from prj_AnnualBudget where rws = #{rwsId} ) and bm = 'a100606333';
613
+        update A
614
+        set  A.bm = B.bm, A.fj = B.fj
615
+            from prj_AnnualBudgetDetail A
616
+        inner join (
617
+         select bp.* from base_ProjectBudget bp ,prj_Project pp,base_ProjectTemplate bpt
618
+         where pp.xmlx = bpt.xmlx and bpt.id = bp.xm  and pp.id = #{rwsId}
619
+            ) B on A.FYMC = B.mc
620
+        where
621
+            NYS in ( SELECT id from prj_AnnualBudget where rws =  #{rwsId} );
622
+    </update>
532 623
 
533 624
     <!--已申请费用的预算-->
534 625
     <select id="getFysqBudgetList">
@@ -575,5 +666,12 @@
575 666
         where RWS = #{rws}
576 667
           AND a.NF = #{nf}
577 668
     </select>
669
+
670
+
671
+
672
+
673
+
674
+
675
+
578 676
 </mapper>
579 677