From 65314b14210a175bae095649584614973b3619df Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期二, 12 八月 2025 13:48:14 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java |  283 ++++++++++++++-----------------------------------------
 1 files changed, 74 insertions(+), 209 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 dd3e69b..94b2a5e 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
@@ -20,7 +20,6 @@
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.project.domain.*;
 import com.ruoyi.project.domain.vo.*;
-import com.ruoyi.project.mapper.ServiceFunddetailMapper;
 import com.ruoyi.project.service.*;
 import com.ruoyi.system.service.ISysPostService;
 import com.ruoyi.system.service.ISysUserService;
@@ -60,13 +59,7 @@
     @Autowired
     private IServiceFundService serviceFundService;
     @Autowired
-    private IServiceFundSharedService fundSharedService;
-    @Autowired
-    private ServiceFunddetailMapper serviceFunddetailMapper;
-    @Autowired
     private IServiceFunddetailService serviceFunddetailService;
-    @Autowired
-    private IServiceFunddetailSharedService funddetailSharedService;
     @Autowired
     private IServiceFundflowruleService serviceFundflowruleService;
     @Autowired
@@ -78,7 +71,7 @@
     private IServiceReimbursementService serviceReimbursementService;
 
     @Autowired
-    private IServiceSystemmessageService ServiceSystemmessage;
+    private IServiceSystemmessageService iServiceSystemmessageService;
 
     @Autowired
     private IServiceExternalpersonService externalpersonService;
@@ -99,10 +92,47 @@
     }
 
     /**
+     * 鑷磋繙绯荤粺娴佺▼閫�鍥�
+     *
+     * @param serviceProcessDocVO
+     * @return
+     */
+    @PostMapping("/backdocument")
+    public AjaxResult backDocument(@RequestBody ServiceProcessDocVO serviceProcessDocVO) {
+        log.info("鑷磋繙绯荤粺娴佺▼閫�鍥炲叆鍙傦細{}", serviceProcessDocVO);
+        if (serviceProcessDocVO.getBackCode() == null || StringUtils.isEmpty(serviceProcessDocVO.getApplytype())) {
+            return AjaxResult.error("鍏ヨ兘涓虹┖,璇锋鏌ュ叆鍙�!!");
+        }
+
+        serviceFundService.backDocument(serviceProcessDocVO);
+        return AjaxResult.success("閫�鍥炴垚鍔�");
+    }
+
+
+    /**
+     * 鑷磋繙绯荤粺娴佺▼閫�鍥炲鎵规棩蹇�
+     *
+     * @param serviceProcessVO
+     * @return
+     */
+    @PostMapping("/processlog")
+    public AjaxResult processlog(@RequestBody ServiceProcessVO serviceProcessVO) {
+        log.info("鑷磋繙绯荤粺娴佺▼閫�鍥炲鎵规棩蹇楀叆鍙傦細{}", serviceProcessVO);
+        if (serviceProcessVO.getBackCode() == null || StringUtils.isEmpty(serviceProcessVO.getApplytype())) {
+            return AjaxResult.error("鍏ヨ兘涓虹┖,璇锋鏌ュ叆鍙�!!");
+        }
+
+        Boolean processlog = serviceFundService.processlog(serviceProcessVO);
+        if (!processlog) return AjaxResult.error("瀹℃壒璁板綍澶辫触");
+        return AjaxResult.success("瀹℃壒璁板綍鎴愬姛");
+    }
+
+
+    /**
      * 鏌ヨ璐圭敤鐢宠涓诲垪琛�
      */
     @ApiOperation("鏌ヨ璐圭敤鐢宠涓诲垪琛�")
-    //@PreAuthorize("@ss.hasPermi('project:fund:list')")
+    //// @PreAuthorize("@ss.hasPermi('project:fund:list')")
     @GetMapping("/list")
     public TableDataInfo list(ServiceFund serviceFund) {
         startPage();
@@ -168,7 +198,10 @@
         if (StringUtils.isNotEmpty(spFinancialExpensesIn.getDonorname())) {
             list = list.stream().filter(obj -> obj.getDonorname().contains(spFinancialExpensesIn.getDonorname())).collect(Collectors.toList());
         }
-
+        //閫氳繃涓氬姟缁勮繃婊�
+        if (StringUtils.isNotEmpty(spFinancialExpensesIn.getDeptnos())) {
+            list = list.stream().filter(obj -> obj.getDeptmentno().contains(spFinancialExpensesIn.getDeptnos())).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());
@@ -178,7 +211,7 @@
         Collections.sort(list, new Comparator<SpFinancialExpensesFundOut>() {
             @Override
             public int compare(SpFinancialExpensesFundOut o1, SpFinancialExpensesFundOut o2) {
-                return o1.getCreateTime().compareTo(o2.getCreateTime());
+                return o1.getApplyTime().compareTo(o2.getApplyTime());
             }
         });
         return getCustomDataTable(list, pageNum, pageSize);
@@ -196,7 +229,7 @@
     }
 
     @ApiOperation("鏌ヨ璐圭敤鐢宠涓诲垪琛�")
-    //@PreAuthorize("@ss.hasPermi('project:fund:list')")
+    //// @PreAuthorize("@ss.hasPermi('project:fund:list')")
     @GetMapping(value = "/getInfo/{infoid}")
     public AjaxResult getInfoByInfoId(@PathVariable("infoid") Long infoid) {
         return AjaxResult.success(serviceFundService.getInfoByInfoId(infoid));
@@ -218,7 +251,7 @@
      * 瀵煎嚭璐圭敤鐢宠涓诲垪琛�
      */
     @ApiOperation("瀵煎嚭璐圭敤鐢宠涓诲垪琛�")
-    //@PreAuthorize("@ss.hasPermi('project:fund:export')")
+    //// @PreAuthorize("@ss.hasPermi('project:fund:export')")
     @Log(title = "璐圭敤鐢宠涓�", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(ServiceFund serviceFund) {
@@ -232,7 +265,7 @@
      * 鑾峰彇璐圭敤鐢宠涓昏缁嗕俊鎭�
      */
     @ApiOperation("鑾峰彇璐圭敤鐢宠涓昏缁嗕俊鎭�")
-    //@PreAuthorize("@ss.hasPermi('project:fund:query')")
+    //// @PreAuthorize("@ss.hasPermi('project:fund:query')")
     @GetMapping(value = "/{id}")
     public AjaxResult getInfo(@PathVariable("id") Long id) {
         return AjaxResult.success(serviceFundService.getById(id));
@@ -242,7 +275,7 @@
      * 鏂板璐圭敤鐢宠涓�
      */
     @ApiOperation("鏂板璐圭敤鐢宠涓�")
-    //@PreAuthorize("@ss.hasPermi('project:fund:add')")
+    //// @PreAuthorize("@ss.hasPermi('project:fund:add')")
     @Log(title = "璐圭敤鐢宠涓�", businessType = BusinessType.INSERT)
     @PostMapping("/add")
     @RepeatSubmit
@@ -289,192 +322,13 @@
     @PostMapping("/checkfund")
     public AjaxResult checkFund(@RequestBody CheckFundVO checkFundVO) {
         log.info("serviceFundController---checkFund鐨勫叆鍙傚�糲heckFundVO :{}", checkFundVO);
-        ServiceFund serviceFund = serviceFundService.getById(checkFundVO.getFundid());
-        if (serviceFund != null) {
-            Integer TotalLevel = 0;
-            LoginUser loginUser = getLoginUser();
-            ServiceFundflowrule serviceFundflowrule = new ServiceFundflowrule();
-            serviceFundflowrule.setFundtype(2);
-            serviceFundflowrule.setApplytype(serviceFund.getApplytype());
-            serviceFundflowrule.setCheckuserno(loginUser.getUsername());
-            log.info("serviceFundController---checkFund---queryList鐨勫叆鍙傚�約erviceFundflowrule:{}", serviceFundflowrule);
-            List<ServiceFundflowrule> serviceFundflowrules = serviceFundflowruleService.queryList(serviceFundflowrule);
-
-            if (serviceFundflowrules == null || serviceFundflowrules.stream().count() == 0) {
-                return AjaxResult.error(HttpStatus.ERROR, "褰撳墠浜哄憳鏃犳璁板綍瀹℃牳鏉冮檺");
-            }
-
-            if (serviceFundflowrules.get(0).getFlowlevel() - 1 != serviceFund.getFlowlevel()) {
-                return AjaxResult.error(HttpStatus.ERROR, "褰撳墠浜哄憳涓庢璁板綍鐨勫鏍哥骇鍒笉绗�");
-            }
-
-            if (serviceFundflowrules != null && serviceFundflowrules.stream().count() > 0) {
-                TotalLevel = serviceFundflowrules.get(0).getTotallevel();
-            }
-
-            Integer CheckFlag = 0;
-            Integer RecordStatus = serviceFund.getRecordstatus();
-            Integer FlowLevel = serviceFund.getFlowlevel().intValue();
-            Integer OriginalFlowLevel = FlowLevel;
-            if (checkFundVO.getFlowconclusion() == 1) {
-                CheckFlag = 1;
-                if (TotalLevel == 0) {
-                    RecordStatus = 99;
-                } else {
-                    if (TotalLevel == FlowLevel + 1) {
-                        RecordStatus = 99;
-                    } else {
-                        RecordStatus = (FlowLevel + 1) * 2;
-                    }
-                }
-                FlowLevel = FlowLevel + 1;
-
-                if (serviceFund.getFlowlevel() == Long.valueOf(serviceFundflowrules.get(0).getFlowlevel() - 1) && serviceFund.getBackflowlevel() == 100) {
-                    log.info("璐㈠姟閫�鍥炲啀鎻愪氦锛屽嚭绾冲啀娆″鎵癸紝涔嬪悗鎻愪氦鍒拌储鍔�");
-                    //璇存槑鏄储鍔¢��鍥炲啀鎻愪氦鐨�.闇�瑕佸嚭绾冲啀鐪嬩竴閬嶏紝娌¢棶棰樹箣鍚庯紝寰�鍒嗕韩琛ㄩ噷鏂板
-//                    serviceFundService.addFundSharedInfo(serviceFund.getId());
-                    serviceFund.setFlowlevel(serviceFundflowrules.get(0).getTotallevel().longValue());
-                    serviceFund.setRecordstatus(99);
-                    serviceFund.setUploadStates(1);
-                    serviceFundService.updateById(serviceFund);
-
-                    //淇濆瓨瀹℃壒娴佺▼琛�
-                    ServiceFundflow serviceFundflow = new ServiceFundflow();
-                    SysUser user = loginUser.getUser();
-                    serviceFundflow.setFundid(serviceFund.getId());
-                    serviceFundflow.setCheckuserno(user.getUserName());
-                    serviceFundflow.setCheckusername(user.getNickName());
-                    serviceFundflow.setFundtype(2);
-                    serviceFundflow.setApplytype(serviceFund.getApplytype());
-                    serviceFundflow.setFlowconclusion(CheckFlag);
-                    serviceFundflow.setFlowcontent("閫氳繃");
-                    Boolean aBoolean = serviceFundflowService.saveData(serviceFundflow);
-                    return AjaxResult.success();
-                }
-                //璁板綍涓�涓嬶紝涓嬩竴绾х殑瀹℃壒锛屼互渚夸簬涓嬩竴绾ч��鍥炲悗锛屽彂璧疯�呮彁浜ゆ椂锛岃兘鍐嶆彁鍒板綋鍓嶅鎵瑰眰绾�
-                serviceFund.setBackflowlevel(FlowLevel);
-            } else {
-                CheckFlag = 2;
-                if (CheckFlag == 2) {
-                    //搴斿尰闄㈣姹傚鏋滃嚭鐜伴��鍥烇紝鐩存帴閫�鍒板彂璧疯��
-                    FlowLevel = 0;
-                    RecordStatus = -1;
-                    logger.info("serviceFund杩涙潵浜嗗悧锛燂紵锛燂紵锛燂紵 :{},{}", RecordStatus, FlowLevel);
-                    System.out.println("serviceFund杩涙潵浜嗗悧锛燂紵锛燂紵锛燂紵");
-                } else {
-                    RecordStatus = (FlowLevel + 1) * 2 - 1;
-                    FlowLevel = (FlowLevel - 1);
-                    if (FlowLevel < 0) {
-                        FlowLevel = 0;
-                    }
-                }
-
-                SysUser sysUser = sysUserService.selectUserByUserName(serviceFund.getUserno());
-                ArrayList<ConcurrentHashMap<String, Object>> contentList = new ArrayList<>();
-                ConcurrentHashMap map = new ConcurrentHashMap();
-                map.put("瀹℃壒浜猴細", loginUser.getUser().getUserName());
-                map.put("瀹℃壒鏃堕棿锛�", new Date());
-                map.put("鎰忚锛�", "涓嶉�氳繃");
-                if (StringUtils.isNotBlank(checkFundVO.getFlowcontent())) map.put("鎰忚锛�", checkFundVO.getFlowcontent());
-                contentList.add(map);
-                DingTalkReqVo dingTalkReqVo = new DingTalkReqVo();
-                dingTalkReqVo.setTitle("璐㈠姟绯荤粺椹冲洖淇℃伅");
-                dingTalkReqVo.setNumber(sysUser.getPhonenumber());
-                dingTalkReqVo.setContents(contentList);
-                dingTalkService.sendNotification(dingTalkReqVo);
-            }
-
-            serviceFund.setRecordstatus(RecordStatus);
-            serviceFund.setFlowlevel(FlowLevel.longValue());
-            //  serviceFund.setBackflowlevel(serviceFund.getFlowlevel());
-
-            ServiceFundflow serviceFundflow = new ServiceFundflow();
-            SysUser user = loginUser.getUser();
-            serviceFundflow.setFundid(serviceFund.getId());
-            serviceFundflow.setCheckuserno(user.getUserName());
-            serviceFundflow.setCheckusername(user.getNickName());
-            serviceFundflow.setFundtype(2);
-            serviceFundflow.setApplytype(serviceFund.getApplytype());
-            serviceFundflow.setFlowconclusion(CheckFlag);
-            if (org.apache.commons.lang.StringUtils.isNotBlank(checkFundVO.getFlowcontent())) {
-                serviceFundflow.setFlowcontent(checkFundVO.getFlowcontent());
-            } else {
-                serviceFundflow.setFlowcontent(checkFundVO.getFlowconclusion() == 1 ? "閫氳繃" : "涓嶉�氳繃");
-            }
-            serviceFundflow.setFlowlevel(OriginalFlowLevel + 1);
-
-            Boolean aBoolean = serviceFundflowService.saveData(serviceFundflow);
-            log.info("sserviceFund淇濆瓨鐨勭殑鍊兼槸-------- :{}", aBoolean);
-
-            //001瀹℃壒閫氳繃涔嬪悗锛屽氨闇�瑕佹妸鈥滃姙鍏涓讳换鈥濈殑鍚嶅瓧濉笂
-            if (checkFundVO.getFlowconclusion() == 1 && user.getUserName().equals("001")) {
-                serviceFund.setOfficedirector(user.getNickName());
-                serviceFund.setUploadStates(1);
-            }
-            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());
-            serviceSystemmessage.setSenduserno(user.getUserName());
-            serviceSystemmessage.setSendusername(user.getNickName());
-            serviceSystemmessage.setReceiveuserno(serviceFund.getUserno());
-            serviceSystemmessage.setReceiveusername(serviceFund.getUsername());
-            serviceSystemmessage.setUpdateTime(new Date());
-            serviceSystemmessage.setUpdateBy(user.getNickName());
-            serviceSystemmessage.setIsread(0);
-            serviceSystemmessage.setMessagetype(1);
-            serviceSystemmessage.setRelevantno(serviceFund.getId());
-
-            if (CheckFlag == 1) {
-
-                //閫氳繃
-                if (serviceFund.getApplytype().equals("1")) {
-                    serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "绾у鏍搁�氳繃");
-                    serviceSystemmessage.setMessagecontent("鎮�" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "鎻愪氦鐨勪笓瀹跺姵鍔¤垂鎹愮尞妗堜緥銆�" + serviceFund.getDonorname() + "銆戠殑璐圭敤鐢宠宸查�氳繃");
-                } else if (serviceFund.getApplytype().equals("2")) {
-                    serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "绾у鏍搁�氳繃");
-                    serviceSystemmessage.setMessagecontent("鎮�" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "鎻愪氦鐨勪鸡鐞嗕笓瀹跺姵鍔¤垂鎹愮尞妗堜緥銆�" + serviceFund.getDonorname() + "銆戠殑璐圭敤鐢宠宸查�氳繃");
-                } else if (serviceFund.getApplytype().equals("3")) {
-                    serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "绾у鏍搁�氳繃");
-                    serviceSystemmessage.setMessagecontent("鎮�" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "鎻愪氦鐨勫尰瀛︽垚鏈崘鐚渚嬨��" + serviceFund.getDonorname() + "銆戠殑璐圭敤鐢宠宸查�氳繃");
-                } else if (serviceFund.getApplytype().equals("4")) {
-                    serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "绾у鏍搁�氳繃");
-                    serviceSystemmessage.setMessagecontent("鎮�" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "鎻愪氦鐨勫姙鍏垂鐢ㄧ敵璇峰凡閫氳繃");
-                } else if (serviceFund.getApplytype().equals("5")) {
-                    serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "绾у鏍搁�氳繃");
-                    serviceSystemmessage.setMessagecontent("鎮�" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "鎻愪氦鐨勭哗鏁堢敵璇峰凡閫氳繃");
-                }
-            } else {
-                //椹冲洖
-                if (serviceFund.getApplytype().equals("1")) {
-                    serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "绾у鏍搁┏鍥�");
-                    serviceSystemmessage.setMessagecontent("鎮�" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "鎻愪氦鐨勪笓瀹跺姵鍔¤垂鎹愮尞妗堜緥銆�" + serviceFund.getDonorname() + "銆戠殑璐圭敤鐢宠宸茶椹冲洖锛屽師鍥�: " + checkFundVO.getFlowcontent() + "");
-                } else if (serviceFund.getApplytype().equals("2")) {
-                    serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "绾у鏍搁┏鍥�");
-                    serviceSystemmessage.setMessagecontent("鎮�" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "鎻愪氦鐨勪鸡鐞嗕笓瀹跺姵鍔¤垂鎹愮尞妗堜緥銆�" + serviceFund.getDonorname() + "銆戠殑璐圭敤鐢宠宸茶椹冲洖锛屽師鍥�: " + checkFundVO.getFlowcontent() + "");
-                } else if (serviceFund.getApplytype().equals("3")) {
-                    serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "绾у鏍搁┏鍥�");
-                    serviceSystemmessage.setMessagecontent("鎮�" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "鎻愪氦鐨勫尰瀛︽垚鏈崘鐚渚嬨��" + serviceFund.getDonorname() + "銆戠殑璐圭敤鐢宠宸茶椹冲洖锛屽師鍥�: " + checkFundVO.getFlowcontent() + "");
-                } else if (serviceFund.getApplytype().equals("4")) {
-                    serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "绾у鏍搁┏鍥�");
-                    serviceSystemmessage.setMessagecontent("鎮�" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "鎻愪氦鐨勫姙鍏垂鐢ㄧ敵璇峰凡椹冲洖锛屽師鍥�: " + checkFundVO.getFlowcontent() + "");
-                } else if (serviceFund.getApplytype().equals("5")) {
-                    serviceSystemmessage.setMessagetitle("" + (OriginalFlowLevel + 1) + "绾у鏍搁┏鍥�");
-                    serviceSystemmessage.setMessagecontent("鎮�" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "鎻愪氦鐨勭哗鏁堢敵璇峰凡椹冲洖锛屽師鍥�: " + checkFundVO.getFlowcontent() + "");
-                }
-            }
-            ServiceSystemmessage.save(serviceSystemmessage);
-            return AjaxResult.success();
-        } else {
-            return AjaxResult.error(HttpStatus.NO_CONTENT, "璐圭敤缂栧彿涓嶆纭�");
+        LoginUser loginUser = getLoginUser();
+        Map<String, String> map = serviceFundService.checkFund(checkFundVO,loginUser);
+        Set<String> keys = map.keySet();
+        for (String s : keys) {
+            if (!s.equals("200")) return AjaxResult.error(map.get(s));
         }
+        return AjaxResult.success();
     }
 
 
@@ -571,7 +425,7 @@
      * 鍒犻櫎璐圭敤鐢宠涓�
      */
     @ApiOperation("鍒犻櫎璐圭敤鐢宠涓�")
-    //@PreAuthorize("@ss.hasPermi('project:fund:remove')")
+    //// @PreAuthorize("@ss.hasPermi('project:fund:remove')")
     @Log(title = "璐圭敤鐢宠涓�", businessType = BusinessType.DELETE)
     @GetMapping("/remove/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids) {
@@ -585,7 +439,7 @@
     @GetMapping(value = "/downloadLW/{id}")
     public Map downloadInfoLW(@PathVariable("id") Long id) throws IOException {
         Map dataMap = new HashMap();
-        getDataLW(dataMap, id);
+        String dataLW = getDataLW(dataMap, id);
         String filePath = getClass().getResource("/template/").getPath();
         System.out.println(filePath);
         //璁剧疆妯℃湰瑁呯疆鏂规硶鍜岃矾寰�,FreeMarker鏀寔澶氱妯℃澘瑁呰浇鏂规硶銆傚彲浠ラ噸servlet锛宑lasspath锛屾暟鎹簱鏁欑▼瑁呰浇锛�
@@ -599,7 +453,11 @@
             e.printStackTrace();
         }
         String newTime = String.valueOf(Calendar.getInstance().getTimeInMillis());
+
         String name = "涓撳鍔冲姟璐瑰彂鏀剧敵璇峰崟_" + dataMap.get("XM") + "_" + newTime;
+        if (dataLW.equals("4")) {
+            name = "鍔炲叕璐圭敤鐢宠鍗昣" + dataMap.get("XM") + "_" + newTime;
+        }
 
         //杈撳嚭鏂囨。璺緞鍙婂悕绉�
         File outFile = new File(RuoYiConfig.getProfile() + "/download/wordtemplate/" + name + ".doc");
@@ -622,7 +480,7 @@
         return map;
     }
 
-    private void getDataLW(Map dataMap, Long id) {
+    private String getDataLW(Map dataMap, Long id) {
         ServiceFund serviceFund = serviceFundService.getById(id);
         if (serviceFund == null) {
             throw new ServiceException("涓嬭浇澶辫触锛岀敤鎴蜂俊鎭嚭閿�", HttpStatus.NO_CONTENT);
@@ -639,7 +497,11 @@
         dataMap.put("JXZXM", serviceFund.getDonorname() == null ? "" : serviceFund.getDonorname());
         dataMap.put("JSR", serviceFund.getUsername() == null ? "" : serviceFund.getUsername());
 //        dataMap.put("FYXM1", "鏀粯涓撳璐圭敤锛屽叾涓◣鍓嶉噾棰�" + serviceFund.getPretaxcost() + "鍏冿紝绋庡悗閲戦" + serviceFund.getTaxedcost() + "鍏冦��");
-        dataMap.put("FYXM1", "浜轰綋鍣ㄥ畼鎹愮尞涓撳鍔冲姟璐�:" + serviceFund.getPretaxcost() + "鍏� (鍏朵腑绋庡悗璐圭敤鐢变腑蹇冩壙鎷呯◣璐�)銆�");
+        if (serviceFund.getApplytype().equals("1")) {
+            dataMap.put("FYXM1", "浜轰綋鍣ㄥ畼鎹愮尞涓撳鍔冲姟璐�:" + serviceFund.getPretaxcost() + "鍏� (鍏朵腑绋庡悗璐圭敤鐢变腑蹇冩壙鎷呯◣璐�)銆�");
+        } else if (serviceFund.getApplytype().equals("4")) {
+            dataMap.put("FYXM1", "鍔炲叕璐圭敤:" + serviceFund.getPretaxcost());
+        }
         dataMap.put("FYXM2", "");
         dataMap.put("FYXM3", "");
         dataMap.put("JEXS", serviceFund.getPretaxcost());
@@ -754,6 +616,7 @@
         dataMap.put("KSLJ", kslj);
         dataMap.put("SHLJ", shlj);
 
+        return serviceFund.getApplytype();
     }
 
 
@@ -951,6 +814,7 @@
         Map dataMap = new HashMap();
         String dataYX = getDataYX(dataMap, id);
         String filePath = getClass().getResource("/template/").getPath();
+        log.info("filePath鐨勫�间负:{}", filePath);
         System.out.println(filePath);
         //璁剧疆妯℃湰瑁呯疆鏂规硶鍜岃矾寰�,FreeMarker鏀寔澶氱妯℃澘瑁呰浇鏂规硶銆傚彲浠ラ噸servlet锛宑lasspath锛屾暟鎹簱鏁欑▼瑁呰浇锛�
         configuration.setDirectoryForTemplateLoading(new File(filePath));
@@ -981,18 +845,19 @@
         //杈撳嚭鏂囨。璺緞鍙婂悕绉�
         File outFile = new File(RuoYiConfig.getProfile() + "/download/wordtemplate/" + name + ".doc");
         Writer out = null;
-
         try {
             out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"));
 
         } catch (FileNotFoundException e1) {
-            e1.printStackTrace();
+            log.error("FileNotFoundException鎶ラ敊淇℃伅鏄細{}", e1.getMessage());
+//            e1.printStackTrace();
         }
         try {
 
             t.process(dataMap, out);
         } catch (TemplateException e) {
-            e.printStackTrace();
+            log.error("TemplateException鎶ラ敊淇¤嚜鏄細{}", e.getMessage());
+            e.getMessage();
         }
         Map<String, Object> map = new HashMap<>();
         map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");
@@ -1007,7 +872,7 @@
             throw new ServiceException("涓嬭浇澶辫触锛岀敤鎴蜂俊鎭嚭閿�", HttpStatus.NO_CONTENT);
         }
         ServiceExternalperson infoByUserNo = null;
-        if (StringUtils.isNotBlank(serviceFund.getUserno())) {
+        if (StringUtils.isNotBlank(serviceFund.getUserno()) && serviceFund.getApplytype().equals("5")) {
             infoByUserNo = externalpersonService.getInfoByUserNo(serviceFund.getUserno());
         }
 
@@ -1134,7 +999,7 @@
         dataMap.put("CWSH", serviceFund.getFinancechecher() == null ? "" : serviceFund.getFinancechecher());
 
         dataMap.put("YYMMDD", time);
-        dataMap.put("XM", serviceFund.getDonorname() == null ? "" : serviceFund.getDonorname());
+        dataMap.put("XM", serviceFund.getDonorname() == null ? "" : serviceFund.getDonorname().trim());
         dataMap.put("GZRY", serviceFund.getUsername() == null ? "" : serviceFund.getUsername());
         dataMap.put("ZZ", serviceFund.getManagername() == null ? "" : serviceFund.getManagername());
 

--
Gitblit v1.9.3