From c76f64a1f4d9a7f7283373be70b1dfd925286e4d Mon Sep 17 00:00:00 2001
From: sinake <sinake1@qq.com>
Date: 星期二, 13 十月 2026 17:11:51 +0800
Subject: [PATCH] 上传命名规则调整

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java |  163 +++++++++++++++++++++++++++---------------------------
 1 files changed, 81 insertions(+), 82 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 2c26721..b846a92 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
@@ -221,7 +221,7 @@
         Collections.sort(list, new Comparator<SpFinancialExpensesFundOut>() {
             @Override
             public int compare(SpFinancialExpensesFundOut o1, SpFinancialExpensesFundOut o2) {
-                return o1.getApplyTime().compareTo(o2.getApplyTime());
+                return o2.getApplyTime().compareTo(o1.getApplyTime());
             }
         });
         return getCustomDataTable(list, pageNum, pageSize);
@@ -320,6 +320,23 @@
     public AjaxResult addOrUpdateNew(@RequestBody ServiceFundVO serviceFundVO) {
 
         return AjaxResult.success(serviceFundService.addOrUpdateNew(serviceFundVO));
+    }
+
+    /**
+     * 涓撳鍔冲姟璐癸細淇濆瓨鍓嶇殑璐圭敤鎺у埗鏍¢獙锛堝共璺戯紝涓嶈惤搴擄級
+     *
+     * <p>渚涗笓瀹跺姵鍔¤垂濉姤椤靛湪鐐光�滀繚瀛樷�濆墠璋冪敤锛屾妸 9 鏉¤鍒欑殑鏍¢獙缁撴灉
+     * 锛坋rrors 闃绘柇 / warnings 鎻愮ず锛夎繑鍥炲墠绔睍绀猴紱鐪熸鐨勮惤搴撴嫤鎴湪 addOrUpdateNew 涓��
+     */
+    @ApiOperation("涓撳鍔冲姟璐逛繚瀛樺墠鏍¢獙")
+    @PostMapping("/validateExpertFee")
+    public AjaxResult validateExpertFee(@RequestBody ServiceFundVO serviceFundVO) {
+        ExpertFeeCheckResult result = serviceFundService.validateExpertFee(serviceFundVO);
+        AjaxResult ajaxResult = AjaxResult.success();
+        ajaxResult.put("errors", result.getErrors());
+        ajaxResult.put("warnings", result.getWarnings());
+        ajaxResult.put("blocked", result.hasError());
+        return ajaxResult;
     }
 
 
@@ -475,18 +492,16 @@
 
         //杈撳嚭鏂囨。璺緞鍙婂悕绉�
         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();
+        if (t == null) {
+            throw new ServiceException("妯℃澘鍔犺浇澶辫触锛岃妫�鏌ユā鏉挎枃浠舵槸鍚﹀瓨鍦�", HttpStatus.NO_CONTENT);
         }
-        try {
+
+        // Writer 蹇呴』鍏抽棴/鍒锋柊锛欱ufferedWriter 甯︾紦鍐诧紝涓嶅叧闂細閫犳垚鏂囦欢鍙ユ焺娉勬紡涓斿唴瀹瑰彲鑳戒笉瀹屾暣
+        try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"))) {
             t.process(dataMap, out);
-        } catch (TemplateException e) {
-            e.printStackTrace();
+        } catch (TemplateException | IOException e) {
+            log.error("鐢熸垚妯℃澘鏂囨。澶辫触, name={}", name, e);
+            throw new ServiceException("鐢熸垚鏂囨。澶辫触", HttpStatus.ERROR);
         }
         Map<String, Object> map = new HashMap<>();
         map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");
@@ -659,18 +674,16 @@
 
         //杈撳嚭鏂囨。璺緞鍙婂悕绉�
         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();
+        if (t == null) {
+            throw new ServiceException("妯℃澘鍔犺浇澶辫触锛岃妫�鏌ユā鏉挎枃浠舵槸鍚﹀瓨鍦�", HttpStatus.NO_CONTENT);
         }
-        try {
+
+        // Writer 蹇呴』鍏抽棴/鍒锋柊锛欱ufferedWriter 甯︾紦鍐诧紝涓嶅叧闂細閫犳垚鏂囦欢鍙ユ焺娉勬紡涓斿唴瀹瑰彲鑳戒笉瀹屾暣
+        try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"))) {
             t.process(dataMap, out);
-        } catch (TemplateException e) {
-            e.printStackTrace();
+        } catch (TemplateException | IOException e) {
+            log.error("鐢熸垚妯℃澘鏂囨。澶辫触, name={}", name, e);
+            throw new ServiceException("鐢熸垚鏂囨。澶辫触", HttpStatus.ERROR);
         }
         Map<String, Object> map = new HashMap<>();
         map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");
@@ -756,18 +769,16 @@
 
         //杈撳嚭鏂囨。璺緞鍙婂悕绉�
         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();
+        if (t == null) {
+            throw new ServiceException("妯℃澘鍔犺浇澶辫触锛岃妫�鏌ユā鏉挎枃浠舵槸鍚﹀瓨鍦�", HttpStatus.NO_CONTENT);
         }
-        try {
+
+        // Writer 蹇呴』鍏抽棴/鍒锋柊锛欱ufferedWriter 甯︾紦鍐诧紝涓嶅叧闂細閫犳垚鏂囦欢鍙ユ焺娉勬紡涓斿唴瀹瑰彲鑳戒笉瀹屾暣
+        try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"))) {
             t.process(dataMap, out);
-        } catch (TemplateException e) {
-            e.printStackTrace();
+        } catch (TemplateException | IOException e) {
+            log.error("鐢熸垚妯℃澘鏂囨。澶辫触, name={}", name, e);
+            throw new ServiceException("鐢熸垚鏂囨。澶辫触", HttpStatus.ERROR);
         }
         Map<String, Object> map = new HashMap<>();
         map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");
@@ -858,20 +869,16 @@
         }
         //杈撳嚭鏂囨。璺緞鍙婂悕绉�
         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) {
-            log.error("FileNotFoundException鎶ラ敊淇℃伅鏄細{}", e1.getMessage());
-//            e1.printStackTrace();
+        if (t == null) {
+            throw new ServiceException("妯℃澘鍔犺浇澶辫触锛岃妫�鏌ユā鏉挎枃浠舵槸鍚﹀瓨鍦�", HttpStatus.NO_CONTENT);
         }
-        try {
 
+        // Writer 蹇呴』鍏抽棴/鍒锋柊锛欱ufferedWriter 甯︾紦鍐诧紝涓嶅叧闂細閫犳垚鏂囦欢鍙ユ焺娉勬紡涓斿唴瀹瑰彲鑳戒笉瀹屾暣
+        try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"))) {
             t.process(dataMap, out);
-        } catch (TemplateException e) {
-            log.error("TemplateException鎶ラ敊淇¤嚜鏄細{}", e.getMessage());
-            e.getMessage();
+        } catch (TemplateException | IOException e) {
+            log.error("鐢熸垚妯℃澘鏂囨。澶辫触, name={}", name, e);
+            throw new ServiceException("鐢熸垚鏂囨。澶辫触", HttpStatus.ERROR);
         }
         Map<String, Object> map = new HashMap<>();
         map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");
@@ -1083,18 +1090,16 @@
 
         //杈撳嚭鏂囨。璺緞鍙婂悕绉�
         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();
+        if (t == null) {
+            throw new ServiceException("妯℃澘鍔犺浇澶辫触锛岃妫�鏌ユā鏉挎枃浠舵槸鍚﹀瓨鍦�", HttpStatus.NO_CONTENT);
         }
-        try {
+
+        // Writer 蹇呴』鍏抽棴/鍒锋柊锛欱ufferedWriter 甯︾紦鍐诧紝涓嶅叧闂細閫犳垚鏂囦欢鍙ユ焺娉勬紡涓斿唴瀹瑰彲鑳戒笉瀹屾暣
+        try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"))) {
             t.process(dataMap, out);
-        } catch (TemplateException e) {
-            e.printStackTrace();
+        } catch (TemplateException | IOException e) {
+            log.error("鐢熸垚妯℃澘鏂囨。澶辫触, name={}", name, e);
+            throw new ServiceException("鐢熸垚鏂囨。澶辫触", HttpStatus.ERROR);
         }
         Map<String, Object> map = new HashMap<>();
         map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");
@@ -1152,18 +1157,16 @@
 
         //杈撳嚭鏂囨。璺緞鍙婂悕绉�
         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();
+        if (t == null) {
+            throw new ServiceException("妯℃澘鍔犺浇澶辫触锛岃妫�鏌ユā鏉挎枃浠舵槸鍚﹀瓨鍦�", HttpStatus.NO_CONTENT);
         }
-        try {
+
+        // Writer 蹇呴』鍏抽棴/鍒锋柊锛欱ufferedWriter 甯︾紦鍐诧紝涓嶅叧闂細閫犳垚鏂囦欢鍙ユ焺娉勬紡涓斿唴瀹瑰彲鑳戒笉瀹屾暣
+        try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"))) {
             t.process(dataMap, out);
-        } catch (TemplateException e) {
-            e.printStackTrace();
+        } catch (TemplateException | IOException e) {
+            log.error("鐢熸垚妯℃澘鏂囨。澶辫触, name={}", name, e);
+            throw new ServiceException("鐢熸垚鏂囨。澶辫触", HttpStatus.ERROR);
         }
         Map<String, Object> map = new HashMap<>();
         map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");
@@ -1652,18 +1655,16 @@
 
         //杈撳嚭鏂囨。璺緞鍙婂悕绉�
         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();
+        if (t == null) {
+            throw new ServiceException("妯℃澘鍔犺浇澶辫触锛岃妫�鏌ユā鏉挎枃浠舵槸鍚﹀瓨鍦�", HttpStatus.NO_CONTENT);
         }
-        try {
+
+        // Writer 蹇呴』鍏抽棴/鍒锋柊锛欱ufferedWriter 甯︾紦鍐诧紝涓嶅叧闂細閫犳垚鏂囦欢鍙ユ焺娉勬紡涓斿唴瀹瑰彲鑳戒笉瀹屾暣
+        try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"))) {
             t.process(dataMap, out);
-        } catch (TemplateException e) {
-            e.printStackTrace();
+        } catch (TemplateException | IOException e) {
+            log.error("鐢熸垚妯℃澘鏂囨。澶辫触, name={}", name, e);
+            throw new ServiceException("鐢熸垚鏂囨。澶辫触", HttpStatus.ERROR);
         }
         Map<String, Object> map = new HashMap<>();
         map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");
@@ -1741,18 +1742,16 @@
 
         //杈撳嚭鏂囨。璺緞鍙婂悕绉�
         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();
+        if (t == null) {
+            throw new ServiceException("妯℃澘鍔犺浇澶辫触锛岃妫�鏌ユā鏉挎枃浠舵槸鍚﹀瓨鍦�", HttpStatus.NO_CONTENT);
         }
-        try {
+
+        // Writer 蹇呴』鍏抽棴/鍒锋柊锛欱ufferedWriter 甯︾紦鍐诧紝涓嶅叧闂細閫犳垚鏂囦欢鍙ユ焺娉勬紡涓斿唴瀹瑰彲鑳戒笉瀹屾暣
+        try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"))) {
             t.process(dataMap, out);
-        } catch (TemplateException e) {
-            e.printStackTrace();
+        } catch (TemplateException | IOException e) {
+            log.error("鐢熸垚妯℃澘鏂囨。澶辫触, name={}", name, e);
+            throw new ServiceException("鐢熸垚鏂囨。澶辫触", HttpStatus.ERROR);
         }
         Map<String, Object> map = new HashMap<>();
         map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");

--
Gitblit v1.9.3