From 68b49efb4da346edb42a5d8ebb39af47207402bd Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期一, 12 十月 2026 11:14:13 +0800
Subject: [PATCH] 修改了报销校验

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceRelativesconfirmationController.java |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceRelativesconfirmationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceRelativesconfirmationController.java
index ddb5675..71bfc70 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceRelativesconfirmationController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceRelativesconfirmationController.java
@@ -19,6 +19,7 @@
 import freemarker.template.TemplateException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.CollectionUtils;
@@ -46,6 +47,7 @@
  * @author ruoyi
  * @date 2021-11-15
  */
+@Slf4j
 @Api("浜插睘纭绠$悊")
 @RestController
 @RequestMapping("/project/relativesconfirmation")
@@ -119,6 +121,7 @@
     @PostMapping("/add")
     @RepeatSubmit
     public AjaxResult add(@RequestBody ServiceRelativesconfirmation serviceRelativesconfirmation) {
+        log.info("鏂板鎹愮尞浜插睘纭锛歿}", serviceRelativesconfirmation);
         boolean save = serviceRelativesconfirmationService.save(serviceRelativesconfirmation);
         return AjaxResult.success(serviceRelativesconfirmation);
     }
@@ -132,6 +135,7 @@
     @PostMapping("/edit")
     @RepeatSubmit
     public AjaxResult edit(@RequestBody ServiceRelativesconfirmation serviceRelativesconfirmation) {
+        log.info("淇敼浜插睘纭锛歿}", serviceRelativesconfirmation);
         if (serviceRelativesconfirmation.getInfoid() == null || serviceRelativesconfirmation.getId() == null) {
             throw new BaseException("璇疯仈绯诲伐绋嬪笀妫�鏌D鏄惁涓虹┖");
         }
@@ -185,13 +189,16 @@
         String name = "浜轰綋鍣ㄥ畼鎹愮尞浜插睘纭鐧昏琛╛" + dataMap.get("XM") + "_" + newTime;
         //杈撳嚭鏂囨。璺緞鍙婂悕绉�
         File outFile = new File(RuoYiConfig.getProfile() + "/download/wordtemplate/" + name + ".doc");
-        Writer out = null;
+        if (t == null) {
+            throw new ServiceException("妯℃澘鍔犺浇澶辫触锛岃妫�鏌ユā鏉挎枃浠舵槸鍚﹀瓨鍦�", HttpStatus.NO_CONTENT);
+        }
 
-        try {
-            out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"));
+        // 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