From f80df09d8dee5c731cb42d4e3d18f627e32bdaea Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 19 十月 2023 09:51:47 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementController.java |   71 ++++++++++++++++++++++++++++-------
 1 files changed, 56 insertions(+), 15 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementController.java
index 22b64aa..cf2d34f 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementController.java
@@ -31,6 +31,7 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.ibatis.annotations.Options;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
 import java.io.*;
@@ -74,6 +75,9 @@
     private IServiceFundService serviceFundService;
 
     @Autowired
+    private IBaseOnlyvalueService baseOnlyvalueService;
+
+    @Autowired
     private ISysPostService postService;
 
     @Autowired
@@ -100,6 +104,7 @@
     public TableDataInfo list(ServiceReimbursement serviceReimbursement) {
         SysUser user = SecurityUtils.getLoginUser().getUser();
         serviceReimbursement.setCreateBy(user.getUserName());
+        serviceReimbursement.setUsername(user.getNickName());
         startPage();
         List<ServiceReimbursement> list = serviceReimbursementService.queryList(serviceReimbursement);
         return getDataTable(list);
@@ -130,6 +135,7 @@
         String APPLICATIONENDTIME = spFinancialExpensesIn.getAPPLICATIONENDTIME();
         Integer CHECKFLAG = spFinancialExpensesIn.getCHECKFLAG();
         Integer APPLYTYPE = spFinancialExpensesIn.getAPPLYTYPE();
+        Integer checkstatus = spFinancialExpensesIn.getCheckstatus();
         Integer pageNum = spFinancialExpensesIn.getPageNum();
         Integer pageSize = spFinancialExpensesIn.getPageSize();
 
@@ -153,11 +159,21 @@
             APPLICATIONENDTIME = "";
         }
         //startPage();
-        List<SpFinancialExpensesReimbursementOut> list = serviceReimbursementService.getListBypower(loginUser.getUsername(), 1, APPLICANT, APPLICATIONBEGTIME, APPLICATIONENDTIME, loginUser.getDeptId().toString(), CHECKFLAG, APPLYTYPE);
+        List<SpFinancialExpensesReimbursementOut> list = serviceReimbursementService.getListBypower(loginUser.getUsername(), 1, APPLICANT, APPLICATIONBEGTIME, APPLICATIONENDTIME, loginUser.getDeptId().toString(), CHECKFLAG, APPLYTYPE,checkstatus);
+        //鏍规嵁缁忓姙浜虹瓫閫�
+        if (StringUtils.isNotBlank(spFinancialExpensesIn.getUsername())) {
+            list = list.stream().filter(reimbursementOut -> reimbursementOut.getUsername().contains(spFinancialExpensesIn.getUsername())).collect(Collectors.toList()); // 鎸塶ame瀛楁杩囨护
+        }
+        //鏍规嵁閲戦绛涢��
+        if (spFinancialExpensesIn.getMoney() != null) {
+            list = list.stream().filter(reimbursementOut -> new BigDecimal(reimbursementOut.getAmountrequested()).compareTo(new BigDecimal(spFinancialExpensesIn.getMoney())) == 0).collect(Collectors.toList());
+
+        }
+        //鏍规嵁鍒涘缓鏃堕棿鎺掑簭
         Collections.sort(list, new Comparator<SpFinancialExpensesReimbursementOut>() {
             @Override
             public int compare(SpFinancialExpensesReimbursementOut o1, SpFinancialExpensesReimbursementOut o2) {
-                return o2.getCreateTime().compareTo(o1.getCreateTime());
+                return o1.getCreateTime().compareTo(o2.getCreateTime());
             }
         });
         return getCustomDataTable(list, pageNum, pageSize);
@@ -206,13 +222,13 @@
     @RepeatSubmit
     @Options(useGeneratedKeys = true, keyProperty = "id")
     public AjaxResult add(@RequestBody ServiceReimbursement serviceReimbursement) {
-
-        boolean b = serviceReimbursementService.save(serviceReimbursement);
-//        if (b) {
-//            addReiSharedDatd(serviceReimbursement, 1);
-//        }
-        Long id = serviceReimbursement.getId();
-        return AjaxResult.success(id);
+        if (!Objects.isNull(serviceReimbursement)) {
+            serviceReimbursement.setCheckstatus(serviceReimbursement.getCheckstatus() == null ? 1 : serviceReimbursement.getCheckstatus());
+            boolean b = serviceReimbursementService.save(serviceReimbursement);
+            Long id = serviceReimbursement.getId();
+            return AjaxResult.success(id);
+        }
+        return error();
     }
 
 //    public int addReiSharedDatd(ServiceReimbursement serviceReimbursement, int nType) {
@@ -591,7 +607,11 @@
             serviceFundflow.setFundtype(1);
             serviceFundflow.setApplytype("0");
             serviceFundflow.setFlowconclusion(CheckFlag);
-            serviceFundflow.setFlowcontent(checkFundVO.getFlowcontent());
+            if (StringUtils.isNotBlank(checkFundVO.getFlowcontent())) {
+                serviceFundflow.setFlowcontent(checkFundVO.getFlowcontent());
+            } else {
+                serviceFundflow.setFlowcontent(checkFundVO.getFlowconclusion() == 1 ? "閫氳繃" : "涓嶉�氳繃");
+            }
             serviceFundflow.setFlowlevel(OriginalFlowLevel + 1);
             serviceFundflowService.save(serviceFundflow);
 
@@ -612,6 +632,10 @@
                     serviceReimbursement.setRecordstatus(1);
                 }
 
+            }
+            //001瀹℃壒閫氳繃涔嬪悗锛屽氨闇�瑕佹妸鈥滃姙鍏涓讳换鈥濈殑鍚嶅瓧濉笂
+            if (checkFundVO.getFlowconclusion() == 1 && user.getUserName().equals("001")) {
+                serviceReimbursement.setOfficedirector(user.getNickName());
             }
 
             serviceReimbursementService.updateById(serviceReimbursement);
@@ -686,8 +710,8 @@
      */
     @ApiOperation("鍒犻櫎鎶ラ攢鐢宠")
     //@PreAuthorize("@ss.hasPermi('project:reimbursement:remove')")
-    @Log(title = "鎶ラ攢鐢宠", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ids}")
+    @Log(title = "鎶ラ攢鐢宠")
+    @GetMapping("/remove/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(serviceReimbursementService.removeByIds(Arrays.asList(ids)));
     }
@@ -701,6 +725,7 @@
         Map dataMap = new HashMap();
         getData(dataMap, id);
         String filePath = getClass().getResource("/template/").getPath();
+        log.info("涓嬭浇鍦板潃鏄暐锛燂紵锛焮}", filePath);
         System.out.println(filePath);
         //璁剧疆妯℃湰瑁呯疆鏂规硶鍜岃矾寰�,FreeMarker鏀寔澶氱妯℃澘瑁呰浇鏂规硶銆傚彲浠ラ噸servlet锛宑lasspath锛屾暟鎹簱鏁欑▼瑁呰浇锛�
         configuration.setDirectoryForTemplateLoading(new File(filePath));
@@ -713,7 +738,7 @@
             e.printStackTrace();
         }
         String newTime = String.valueOf(Calendar.getInstance().getTimeInMillis());
-        String name = "宸梾璐规姤閿�鐢宠鍗昣" + dataMap.get("XM") + "_" + newTime;
+        String name = "宸梾璐规姤閿�鐢宠鍗昣" + dataMap.get("JSR") + "_" + newTime;
 
         //杈撳嚭鏂囨。璺緞鍙婂悕绉�
         File outFile = new File(RuoYiConfig.getProfile() + "/download/wordtemplate/" + name + ".doc");
@@ -756,9 +781,15 @@
         ServiceReimbursementEo serviceReimbursementEo = new ServiceReimbursementEo();
         serviceReimbursementEo.setId(id);
         List<ServiceReimbursementEo> rdInfoByItem = serviceReimbursementService.getRDInfoByItem(serviceReimbursementEo);
+        log.info("rdInfoByItem鏄惁涓虹┖ :{}", CollectionUtils.isEmpty(rdInfoByItem) ? null : rdInfoByItem.size());
+        for (int i = 0; i < rdInfoByItem.size(); i++) {
+            ServiceReimbursementEo serviceReimbursementEo1 = rdInfoByItem.get(i);
+            String codeByInfo = PersonType.getCodeByInfo(serviceReimbursementEo1.getPersontype());
+            serviceReimbursementEo1.setPersontype(codeByInfo);
+        }
         //鑾峰彇鎶ラ攢鏀粯淇℃伅
         List<ServiceReimbursementpayee> reimbursementpayeeInfo = reimbursementpayeeService.getReimbursementpayeeInfo(serviceReimbursementEo);
-
+        log.info("reimbursementpayeeInfo鏄惁涓虹┖ :{}", CollectionUtils.isEmpty(reimbursementpayeeInfo) ? null : reimbursementpayeeInfo.size());
         Map<String, List<ServiceReimbursementEo>> listMap = rdInfoByItem.stream().collect(Collectors.groupingBy(ServiceReimbursementEo::getPersontype));
         List<Map<String, BigDecimal>> list = new ArrayList<>();
         StringBuffer FYXM1 = new StringBuffer();
@@ -775,7 +806,7 @@
             BigDecimal keyOneMoney = new BigDecimal(0.00);
             BigDecimal keyTwoMoney = new BigDecimal(0.00);
             for (ServiceReimbursementEo serviceReimbursementEo1 : values) {
-                otherMoney = otherMoney.add(serviceReimbursementEo1.getTrafficexpense()).add(serviceReimbursementEo1.getHotelexpense()).add(serviceReimbursementEo1.getFoodexpenses()).add(serviceReimbursementEo1.getFoodallowance()).add(serviceReimbursementEo1.getOtherexpense()).add(serviceReimbursementEo1.getOtherfeeamount());
+                otherMoney = otherMoney.add(serviceReimbursementEo1.getTrafficexpense()).add(serviceReimbursementEo1.getHotelexpense()).add(serviceReimbursementEo1.getCityfee()).add(serviceReimbursementEo1.getFoodexpenses()).add(serviceReimbursementEo1.getFoodallowance()).add(serviceReimbursementEo1.getOtherexpense()).add(serviceReimbursementEo1.getOtherfeeamount());
             }
             map.put(key, otherMoney);
             list.add(map);
@@ -874,6 +905,8 @@
         String date = formatter.format(dt);
         String time = date.substring(0, 10);
 
+        dataMap.put("ZB", rdInfoByItem.get(0).getDeptmentname() == null ? "" : rdInfoByItem.get(0).getDeptmentname());
+        dataMap.put("XZBH", rdInfoByItem.get(0).getBh() == null ? "" : rdInfoByItem.get(0).getBh());
         dataMap.put("TBYYMMDD", time);
         dataMap.put("BXDFJ", rdInfoByItem.get(0).getAttachcount() == null ? "   " : "" + rdInfoByItem.get(0).getAttachcount());
         dataMap.put("JXZXM", rdInfoByItem.get(0).getDonorname() == null ? "" : rdInfoByItem.get(0).getDonorname());
@@ -910,6 +943,14 @@
         }
         dataMap.put("BXBZ", remark);
 
+        dataMap.put("ZXFZR", StringUtils.isEmpty(rdInfoByItem.get(0).getOpochecker()) ? "" : rdInfoByItem.get(0).getOpochecker());
+//
+        dataMap.put("CWFYZ", StringUtils.isEmpty(rdInfoByItem.get(0).getFinvicepresident()) ? "" : rdInfoByItem.get(0).getFinvicepresident());
+        dataMap.put("YWFYZ", StringUtils.isEmpty(rdInfoByItem.get(0).getBusvicepresident()) ? "" : rdInfoByItem.get(0).getBusvicepresident());
+        dataMap.put("BGSZR", StringUtils.isEmpty(rdInfoByItem.get(0).getOfficedirector()) ? "" : rdInfoByItem.get(0).getOfficedirector());
+        dataMap.put("CWBZR", StringUtils.isEmpty(rdInfoByItem.get(0).getFinancedirector()) ? "" : rdInfoByItem.get(0).getFinancedirector());
+        dataMap.put("CWSH", StringUtils.isEmpty(rdInfoByItem.get(0).getFinancechecher()) ? "" : rdInfoByItem.get(0).getFinancechecher());
+
 
         dataMap.put("YYMMDD", time);
 

--
Gitblit v1.9.3