From dcd3eb3bbbc25b01155493f20f5680fc6d4aee11 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 26 十月 2023 16:02:07 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java |  130 ++++++++++++++++++++++++++++++++++--------
 1 files changed, 104 insertions(+), 26 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java
index e563bbb..0e26b67 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java
@@ -1,5 +1,7 @@
 package com.ruoyi.web.controller.project;
 
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.annotation.RepeatSubmit;
 import com.ruoyi.common.config.RuoYiConfig;
@@ -28,7 +30,12 @@
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.ibatis.annotations.Options;
+import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+import org.springframework.transaction.TransactionDefinition;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
@@ -76,7 +83,7 @@
     private IServiceSystemmessageService ServiceSystemmessage;
 
     @Autowired
-    private IServiceFundSharedService fundServiceShare;
+    private IBaseOnlyvalueService baseOnlyvalueService;
 
     @Autowired
     private IServiceExternalpersonService externalpersonService;
@@ -84,6 +91,11 @@
     @Autowired
     private ISysPostService postService;
 
+    @Autowired
+    private DataSourceTransactionManager transactionManager;
+
+    @Autowired
+    private TransactionDefinition transactionDefinition;
 
     public ServiceFundController() {
         configuration = new Configuration();
@@ -128,7 +140,9 @@
         Integer APPLYTYPE = spFinancialExpensesIn.getAPPLYTYPE();
         Integer pageNum = spFinancialExpensesIn.getPageNum();
         Integer pageSize = spFinancialExpensesIn.getPageSize();
+        Integer checkstatus = spFinancialExpensesIn.getCheckstatus();
 
+        String donorname = spFinancialExpensesIn.getDonorname();
         if (pageNum == null) {
             pageNum = 1;
         }
@@ -150,16 +164,22 @@
         }
 
         //startPage();
-        List<SpFinancialExpensesFundOut> list = serviceFundService.getListBypower(loginUser.getUsername(), 2, APPLICANT, APPLICATIONBEGTIME, APPLICATIONENDTIME, loginUser.getDeptId().toString(), CHECKFLAG, APPLYTYPE);
+        List<SpFinancialExpensesFundOut> list = serviceFundService.getListBypower(loginUser.getUsername(), 2, APPLICANT, APPLICATIONBEGTIME, APPLICATIONENDTIME, loginUser.getDeptId().toString(), CHECKFLAG, APPLYTYPE, checkstatus, donorname);
         //閫氳繃鎹愮尞鑰呰繃婊�
         if (StringUtils.isNotEmpty(spFinancialExpensesIn.getDonorname())) {
             list = list.stream().filter(obj -> obj.getDonorname().contains(spFinancialExpensesIn.getDonorname())).collect(Collectors.toList());
         }
 
+        //閫氳繃閲戦杩囨护
+        if (spFinancialExpensesIn.getMoney() != null) {
+            list = list.stream().filter(reimbursementOut -> new BigDecimal(reimbursementOut.getPretaxcost()).compareTo(new BigDecimal(spFinancialExpensesIn.getMoney())) == 0).collect(Collectors.toList());
+
+        }
+
         Collections.sort(list, new Comparator<SpFinancialExpensesFundOut>() {
             @Override
             public int compare(SpFinancialExpensesFundOut o1, SpFinancialExpensesFundOut o2) {
-                return o2.getCreateTime().compareTo(o1.getCreateTime());
+                return o1.getCreateTime().compareTo(o2.getCreateTime());
             }
         });
         return getCustomDataTable(list, pageNum, pageSize);
@@ -455,10 +475,10 @@
      * 瀹℃牳璐圭敤
      */
     @ApiOperation("瀹℃牳璐圭敤")
-    @Log(title = "瀹℃牳璐圭敤", businessType = BusinessType.OTHER)
+//    @Log(title = "瀹℃牳璐圭敤", businessType = BusinessType.OTHER)
     @PostMapping("/checkfund")
     public AjaxResult checkFund(@RequestBody CheckFundVO checkFundVO) {
-        logger.info("serviceFundController---checkFund鐨勫叆鍙傚�糲heckFundVO :{}", checkFundVO);
+        log.info("serviceFundController---checkFund鐨勫叆鍙傚�糲heckFundVO :{}", checkFundVO);
         ServiceFund serviceFund = serviceFundService.getById(checkFundVO.getFundid());
         if (serviceFund != null) {
             Integer TotalLevel = 0;
@@ -467,7 +487,7 @@
             serviceFundflowrule.setFundtype(2);
             serviceFundflowrule.setApplytype(serviceFund.getApplytype());
             serviceFundflowrule.setCheckuserno(loginUser.getUsername());
-            logger.info("serviceFundController---checkFund---queryList鐨勫叆鍙傚�約erviceFundflowrule:{}", serviceFundflowrule);
+            log.info("serviceFundController---checkFund---queryList鐨勫叆鍙傚�約erviceFundflowrule:{}", serviceFundflowrule);
 
             List<ServiceFundflowrule> serviceFundflowrules = serviceFundflowruleService.queryList(serviceFundflowrule);
 
@@ -485,7 +505,7 @@
 
             Integer CheckFlag = 0;
             Integer RecordStatus = serviceFund.getRecordstatus();
-            Integer FlowLevel = serviceFund.getFlowlevel();
+            Integer FlowLevel = serviceFund.getFlowlevel().intValue();
             Integer OriginalFlowLevel = FlowLevel;
             if (checkFundVO.getFlowconclusion() == 1) {
                 CheckFlag = 1;
@@ -507,6 +527,8 @@
                     //搴斿尰闄㈣姹傚鏋滃嚭鐜伴��鍥烇紝鐩存帴閫�鍒板彂璧疯��
                     FlowLevel = 0;
                     RecordStatus = -1;
+                    logger.info("serviceFund杩涙潵浜嗗悧锛燂紵锛燂紵锛燂紵 :{},{}", RecordStatus, FlowLevel);
+                    System.out.println("serviceFund杩涙潵浜嗗悧锛燂紵锛燂紵锛燂紵");
                 } else {
                     RecordStatus = (FlowLevel + 1) * 2 - 1;
                     FlowLevel = (FlowLevel - 1);
@@ -517,7 +539,7 @@
             }
 
             serviceFund.setRecordstatus(RecordStatus);
-            serviceFund.setFlowlevel(FlowLevel);
+            serviceFund.setFlowlevel(FlowLevel.longValue());
             //  serviceFund.setBackflowlevel(serviceFund.getFlowlevel());
 
             ServiceFundflow serviceFundflow = new ServiceFundflow();
@@ -534,9 +556,22 @@
                 serviceFundflow.setFlowcontent(checkFundVO.getFlowconclusion() == 1 ? "閫氳繃" : "涓嶉�氳繃");
             }
             serviceFundflow.setFlowlevel(OriginalFlowLevel + 1);
-            serviceFundflowService.save(serviceFundflow);
-            serviceFundService.updateById(serviceFund);
 
+            Boolean aBoolean = serviceFundflowService.saveData(serviceFundflow);
+            log.info("sserviceFund淇濆瓨鐨勭殑鍊兼槸-------- :{}", aBoolean);
+
+            //001瀹℃壒閫氳繃涔嬪悗锛屽氨闇�瑕佹妸鈥滃姙鍏涓讳换鈥濈殑鍚嶅瓧濉笂
+            if (checkFundVO.getFlowconclusion() == 1 && user.getUserName().equals("001")) {
+                serviceFund.setOfficedirector(user.getNickName());
+            }
+            System.out.println("serviceFund鐨勫�兼槸--------:" + serviceFund);
+            log.info("寮�濮嬫洿鏂扮殑鐨勫�兼槸--------");
+            ServiceFund updateServiceFund = new ServiceFund();
+            updateServiceFund.setRecordstatus(serviceFund.getRecordstatus());
+            updateServiceFund.setFlowlevel(serviceFund.getFlowlevel());
+
+            Boolean aBoolean1 = serviceFundService.updateById(serviceFund);
+            log.info("integer鏇存柊鐨勭殑鍊兼槸-------- :{}", aBoolean1);
             ServiceSystemmessage serviceSystemmessage = new ServiceSystemmessage();
             serviceSystemmessage.setFundtype(2);
             serviceSystemmessage.setApplytype(serviceFund.getApplytype());
@@ -603,17 +638,17 @@
                 if (!postids.contains(2)) {
                     serviceFund.setRecordstatus(2);
                     if (serviceFund.getBackflowlevel() != null) {
-                        serviceFund.setFlowlevel(serviceFund.getBackflowlevel());
+                        serviceFund.setFlowlevel(serviceFund.getBackflowlevel().longValue());
                     } else {
                         serviceFund.setBackflowlevel(1);
-                        serviceFund.setFlowlevel(1);
+                        serviceFund.setFlowlevel(1L);
                     }
                 } else {
                     serviceFund.setRecordstatus(0);
                     if (serviceFund.getBackflowlevel() != null) {
-                        serviceFund.setFlowlevel(serviceFund.getBackflowlevel());
+                        serviceFund.setFlowlevel(serviceFund.getBackflowlevel().longValue());
                     } else {
-                        serviceFund.setFlowlevel(0);
+                        serviceFund.setFlowlevel(0L);
                         serviceFund.setBackflowlevel(0);
                     }
 
@@ -694,8 +729,9 @@
         String time = date.substring(0, 10);
 
         dataMap.put("XZBH", serviceFund.getBh() == null ? "" : serviceFund.getBh());
+        dataMap.put("ZB", serviceFund.getDeptmentname() == null ? "" : serviceFund.getDeptmentname());
         dataMap.put("TBYYMMDD", time);
-        dataMap.put("BXDFJ", serviceFund.getAttachcount() == 0 ? "   " : serviceFund.getAttachcount());
+        dataMap.put("BXDFJ", serviceFund.getAttachcount() == null ? "   " : serviceFund.getAttachcount());
         dataMap.put("JXZXM", serviceFund.getDonorname() == null ? "" : serviceFund.getDonorname());
         dataMap.put("JSR", serviceFund.getUsername() == null ? "" : serviceFund.getUsername());
 //        dataMap.put("FYXM1", "鏀粯涓撳璐圭敤锛屽叾涓◣鍓嶉噾棰�" + serviceFund.getPretaxcost() + "鍏冿紝绋庡悗閲戦" + serviceFund.getTaxedcost() + "鍏冦��");
@@ -1001,9 +1037,9 @@
     }
 
     /**
-     * 涓嬭浇鎹愮尞鑰呭尰瀛︽垚鏈粺璁¤〃
+     * 涓嬭浇鎹愮尞鑰呭尰瀛︺�佸姙鍏�佺哗鏁堟垚鏈粺璁¤〃
      */
-    @ApiOperation("鎹愮尞鑰呭尰瀛︽垚鏈粺璁¤〃")
+    @ApiOperation("鎹愮尞鑰呭尰瀛︺�佸姙鍏�佺哗鏁堟垚鏈粺璁¤〃")
     @GetMapping(value = "/downloadYX/{id}")
     public Map downloadInfoYX(@PathVariable("id") Long id) throws IOException {
         Map dataMap = new HashMap();
@@ -1016,11 +1052,13 @@
         Template t = null;
         try {
             //鎹愮尞琛�.ftl涓鸿瑁呰浇鐨勬ā鏉�
-            //涓撳鍔冲姟璐圭敵璇� 1    浼︾悊璇勪及鍔冲姟璐圭敵璇� 2    鍖诲鎴愭湰璐圭敤鐢宠 3     鍔炲叕璐圭敤鎶ラ攢鐢宠 4
+            //涓撳鍔冲姟璐圭敵璇� 1    浼︾悊璇勪及鍔冲姟璐圭敵璇� 2    鍖诲鎴愭湰璐圭敤鐢宠 3     鍔炲叕璐圭敤鎶ラ攢鐢宠 4   缁╂晥璐圭敤鎶ラ攢鐢宠 5
             if (dataYX.equals("3")) {
                 t = configuration.getTemplate("鍖诲鎴愭湰璐圭敤鐢宠鍗�.ftl");
             } else if (dataYX.equals("4")) {
                 t = configuration.getTemplate("鍔炲叕璐圭敤鐢宠鍗�.ftl");
+            } else if (dataYX.equals("5")) {
+                t = configuration.getTemplate("缁╂晥璐圭敤鐢宠鍗�.ftl");
             }
         } catch (IOException e) {
             e.printStackTrace();
@@ -1031,6 +1069,8 @@
             name = "鍖诲鎴愭湰璐圭敤鐢宠鍗昣" + dataMap.get("XM") + "_" + newTime;
         } else if (dataYX.equals("4")) {
             name = "鍔炲叕璐圭敤鐢宠鍗昣" + dataMap.get("XM") + "_" + newTime;
+        } else if (dataYX.equals("5")) {
+            name = "缁╂晥璐圭敤鐢宠鍗昣" + dataMap.get("XM") + "_" + newTime;
         }
         //杈撳嚭鏂囨。璺緞鍙婂悕绉�
         File outFile = new File(RuoYiConfig.getProfile() + "/download/wordtemplate/" + name + ".doc");
@@ -1043,6 +1083,7 @@
             e1.printStackTrace();
         }
         try {
+
             t.process(dataMap, out);
         } catch (TemplateException e) {
             e.printStackTrace();
@@ -1063,6 +1104,18 @@
         }
 
         List<ServiceFunddetail> fd = serviceFunddetailService.getAllDetailsByFDIDHZ(id);
+        if (serviceFund.getApplytype().equals("5")) {
+            //缁╂晥鐨勮鎯呭鏋滃皬浜�3琛岋紝榛樿瑕佺瓑浜�3琛�
+            if (fd.size() < 3) {
+                for (int i = 0; i <= 3 - fd.size(); i++) {
+                    ServiceFunddetail serviceFunddetail = new ServiceFunddetail();
+                    serviceFunddetail.setQuantity(0.00);
+                    serviceFunddetail.setPrice(0.00);
+                    serviceFunddetail.setAmount(0.00);
+                    fd.add(serviceFunddetail);
+                }
+            }
+        }
         if (fd == null) {
             throw new ServiceException("涓嬭浇澶辫触锛屾病鏈夊搴斾俊鎭�", HttpStatus.NO_CONTENT);
         }
@@ -1075,6 +1128,7 @@
         List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>();
         int seqno = 0;
 
+        dataMap.put("ZB", serviceFund.getDeptmentname() == null ? "" : serviceFund.getDeptmentname());
         dataMap.put("XZBH", serviceFund.getBh() == null ? "" : serviceFund.getBh());
         dataMap.put("TBYYMMDD", time);
         dataMap.put("BXDFJ", serviceFund.getAttachcount() == 0 ? "   " : serviceFund.getAttachcount());
@@ -1104,16 +1158,27 @@
             //濡傛灉鏄尰鐤楁垚鏈紝鍒欐妸閾惰鍗″姞涓婃瘡鏉℃槑缁嗙殑鍚庨潰
             if (serviceFund.getApplytype().equals("3")) {
                 i = i + 1;
-                bz += f.getUnitname() == null ? "(" + i + ")" : "(" + i + ")" + f.getUnitname() + "锛�";
+                bz += f.getBeneficiaryname() == null ? "(" + i + ")" : "(" + i + ")" + f.getBeneficiaryname() + "锛�";
+                bz += "閲戦 : " + f.getAmount() + "鍏�" + "锛�";
                 bz += f.getDepositbank() == null ? "" : f.getDepositbank() + ": ";
-                bz += f.getBankcardno() == null ? "" : f.getBankcardno() + "锛�";
-                bz += "閲戦 : " + f.getAmount() + "鍏�";
-                bz += System.lineSeparator();
+                bz += f.getBankcardno() == null ? "" : f.getBankcardno();
+                bz += "<w:br/>";
+            }
+            if (serviceFund.getApplytype().equals("4")) {
+                i = i + 1;
+                bz += f.getBeneficiaryname() == null ? "(" + i + ")" : "(" + i + ")" + f.getBeneficiaryname() + "锛�";
+                bz += "閲戦 : " + f.getAmount() + "鍏�" + "锛�";
+                bz += f.getDepositbank() == null ? "" : f.getDepositbank() + ": ";
+                bz += f.getBankcardno() == null ? "" : f.getBankcardno();
+                bz += "<w:br/>";
             }
 
-            String fyxm = f.getItemname() == null ? "" : f.getItemname();
+            String fyxm = "";
             fyxm += f.getItemname() == null ? "" : f.getItemname();
             fyxm += f.getAmount() + "鍏�";
+            if (f.getItemname() == null && f.getAmount() == 0.0) {
+                fyxm = "";
+            }
             map.put("FYXM", fyxm);
             newList.add(map);
         }
@@ -1127,7 +1192,7 @@
 //        dataMap.put("JEDS", convert(serviceFund.getAmountrequested()) + "鏁�");
         //澶囨敞閲屾斁鐨勬槸缁忓姙浜虹殑閾惰鍗′俊鎭�
 
-        dataMap.put("BXBZ", serviceFund.getApplytype().equals("3") ? bz : infoByUserNo == null ? "" : infoByUserNo.getBranchbankname() + "  " + infoByUserNo.getBankcardno());
+        dataMap.put("BXBZ", serviceFund.getApplytype().equals("3") || serviceFund.getApplytype().equals("4") ? bz : infoByUserNo == null ? "" : infoByUserNo.getBranchbankname() + "  " + infoByUserNo.getBankcardno());
         dataMap.put("YZ", serviceFund.getPresident() == null ? "" : serviceFund.getPresident());
         dataMap.put("CWFYZ", serviceFund.getFinvicepresident() == null ? "" : serviceFund.getFinvicepresident());
         dataMap.put("YWFYZ", serviceFund.getBusvicepresident() == null ? "" : serviceFund.getBusvicepresident());
@@ -1150,7 +1215,7 @@
             count++;
             map.put("XH", count);
             map.put("FWNR", f.getItemname() == null ? "" : f.getItemname());
-            map.put("DW", f.getUnitname() == null ? "" : f.getUnitname());
+            map.put("DW", f.getBeneficiaryname() == null ? "" : f.getBeneficiaryname());
             map.put("SL", f.getQuantity() == 0.00 ? "" : f.getQuantity());
             map.put("JG", f.getPrice() == 0.00 ? "" : f.getPrice());
 
@@ -1889,6 +1954,7 @@
         String date = formatter.format(dt);
         String time = date.substring(0, 10);
 
+        dataMap.put("ZB", serviceFund.getDeptmentname() == null ? "" : serviceFund.getDeptmentname());
         dataMap.put("XZBH", serviceFund.getBh() == null ? "" : serviceFund.getBh());
         dataMap.put("TBYYMMDD", time);
         dataMap.put("BXDFJ", serviceFund.getAttachcount() == 0 ? "   " : serviceFund.getAttachcount());
@@ -1946,7 +2012,6 @@
 
         dataMap.put("SQZE", String.format("%.2f", sh).toString() + "");
 
-
     }
 
 
@@ -1982,4 +2047,17 @@
 
     }
 
+
+    /**
+     * 缁╂晥璁$畻
+     */
+    @ApiOperation("缁╂晥璁$畻")
+    @Log(title = "缁╂晥璁$畻", businessType = BusinessType.INSERT)
+    @PostMapping("/performance")
+    @RepeatSubmit
+    public AjaxResult performance(@RequestBody ServiceFundVO serviceFundVO) {
+
+        return AjaxResult.success(serviceFundService.performance(serviceFundVO));
+    }
+
 }

--
Gitblit v1.9.3