From b6dd47b05107fc36d8ff4f7f29a4446521f95503 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 02 一月 2025 18:44:28 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java |   56 ++++++++++++++++++++++++++++++--------------------------
 1 files changed, 30 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 d322936..9f109d1 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
@@ -31,14 +31,7 @@
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.ibatis.annotations.Options;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.ss.usermodel.Workbook;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jdbc.datasource.DataSourceTransactionManager;
-import org.springframework.transaction.TransactionDefinition;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
@@ -85,7 +78,7 @@
     private IServiceReimbursementService serviceReimbursementService;
 
     @Autowired
-    private IServiceSystemmessageService ServiceSystemmessage;
+    private IServiceSystemmessageService iServiceSystemmessageService;
 
     @Autowired
     private IServiceExternalpersonService externalpersonService;
@@ -109,7 +102,7 @@
      * 鏌ヨ璐圭敤鐢宠涓诲垪琛�
      */
     @ApiOperation("鏌ヨ璐圭敤鐢宠涓诲垪琛�")
-    //@PreAuthorize("@ss.hasPermi('project:fund:list')")
+    //// @PreAuthorize("@ss.hasPermi('project:fund:list')")
     @GetMapping("/list")
     public TableDataInfo list(ServiceFund serviceFund) {
         startPage();
@@ -185,7 +178,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);
@@ -203,7 +196,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));
@@ -225,7 +218,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) {
@@ -239,7 +232,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));
@@ -249,7 +242,7 @@
      * 鏂板璐圭敤鐢宠涓�
      */
     @ApiOperation("鏂板璐圭敤鐢宠涓�")
-    //@PreAuthorize("@ss.hasPermi('project:fund:add')")
+    //// @PreAuthorize("@ss.hasPermi('project:fund:add')")
     @Log(title = "璐圭敤鐢宠涓�", businessType = BusinessType.INSERT)
     @PostMapping("/add")
     @RepeatSubmit
@@ -413,8 +406,8 @@
             Boolean aBoolean = serviceFundflowService.saveData(serviceFundflow);
             log.info("sserviceFund淇濆瓨鐨勭殑鍊兼槸-------- :{}", aBoolean);
 
-            //001瀹℃壒閫氳繃涔嬪悗锛屽氨闇�瑕佹妸鈥滃姙鍏涓讳换鈥濈殑鍚嶅瓧濉笂
-            if (checkFundVO.getFlowconclusion() == 1 && user.getUserName().equals("001")) {
+            //053瀹℃壒閫氳繃涔嬪悗锛屽氨闇�瑕佹妸鈥滃姙鍏涓讳换鈥濈殑鍚嶅瓧濉笂
+            if (checkFundVO.getFlowconclusion() == 1 && user.getUserName().equals("053")) {
                 serviceFund.setOfficedirector(user.getNickName());
                 serviceFund.setUploadStates(1);
             }
@@ -477,7 +470,7 @@
                     serviceSystemmessage.setMessagecontent("鎮�" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime()) + "鎻愪氦鐨勭哗鏁堢敵璇峰凡椹冲洖锛屽師鍥�: " + checkFundVO.getFlowcontent() + "");
                 }
             }
-            ServiceSystemmessage.save(serviceSystemmessage);
+            iServiceSystemmessageService.save(serviceSystemmessage);
             return AjaxResult.success();
         } else {
             return AjaxResult.error(HttpStatus.NO_CONTENT, "璐圭敤缂栧彿涓嶆纭�");
@@ -578,7 +571,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) {
@@ -592,7 +585,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锛屾暟鎹簱鏁欑▼瑁呰浇锛�
@@ -606,7 +599,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");
@@ -629,7 +626,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);
@@ -646,7 +643,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());
@@ -761,6 +762,7 @@
         dataMap.put("KSLJ", kslj);
         dataMap.put("SHLJ", shlj);
 
+        return serviceFund.getApplytype();
     }
 
 
@@ -958,6 +960,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));
@@ -988,18 +991,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");
@@ -1014,7 +1018,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());
         }
 
@@ -1141,7 +1145,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