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/ServiceReimbursementController.java |   51 ++++++++++++++++++++++++++++++---------------------
 1 files changed, 30 insertions(+), 21 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 2f47faa..96d05de 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
@@ -14,6 +14,7 @@
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.project.domain.*;
+import com.ruoyi.project.common.FundNotifyMessageBuilder;
 import com.ruoyi.project.domain.dto.ServiceReimbursementDto;
 import com.ruoyi.project.domain.vo.CheckFundVO;
 import com.ruoyi.project.domain.vo.DingTalkReqVo;
@@ -346,17 +347,27 @@
                     //闄堟厱鍗庝俊鎭�
                     sysUser = sysUserService.selectUserByUserName("047");
                 }
-                ConcurrentHashMap map = new ConcurrentHashMap();
-                ArrayList<ConcurrentHashMap<String, Object>> contentList = new ArrayList<>();
-                map.put("鎻愪氦浜猴細", loginUser.getUser().getUserName());
-                map.put("鎻愪氦鏃堕棿锛�", new Date());
-                map.put("鍐呭锛�", serviceReimbursement.getReason());
-                contentList.add(map);
-                DingTalkReqVo dingTalkReqVo = new DingTalkReqVo();
-                dingTalkReqVo.setTitle("宸梾瀹℃壒淇℃伅");
-                dingTalkReqVo.setNumber(sysUser != null ? sysUser.getPhonenumber() : "");
-                dingTalkReqVo.setContents(contentList);
-                dingTalkService.sendNotification(dingTalkReqVo);
+                //宸梾璐逛笂鎶ユ彁浜わ細鍗曟嵁淇℃伅 + 鎻愪氦浜�/鎻愪氦鏃堕棿/鍐呭
+                //閽夐拤灞炰簬鏃佽矾閫氱煡锛屼换浣曞け璐ラ兘涓嶅緱褰卞搷"涓婃姤"涓绘祦绋嬶紙鍚﹀垯鍓嶇浼氭彁绀哄け璐ヤ絾鏁版嵁宸叉洿鏂帮級
+                try {
+                    List<ConcurrentHashMap<String, Object>> contentList = FundNotifyMessageBuilder.newRows();
+                    FundNotifyMessageBuilder.addBillInfo(contentList, "0", serviceReimbursement.getUsername(),
+                            serviceReimbursement.getAmountrequested(), null,
+                            FundNotifyMessageBuilder.billNo(serviceReimbursement.getBh(),
+                                    serviceReimbursement.getId()));
+                    FundNotifyMessageBuilder.addTravelInfo(contentList, serviceReimbursement.getTravelers(),
+                            serviceReimbursement.getReason());
+                    FundNotifyMessageBuilder.addSubmitInfo(contentList, loginUser.getUser().getNickName(),
+                            new Date(), serviceReimbursement.getReason());
+                    DingTalkReqVo dingTalkReqVo = new DingTalkReqVo();
+                    dingTalkReqVo.setTitle(FundNotifyMessageBuilder.TITLE);
+                    dingTalkReqVo.setNumber(sysUser != null ? sysUser.getPhonenumber() : "");
+                    dingTalkReqVo.setContents(contentList);
+                    dingTalkService.sendNotification(dingTalkReqVo);
+                } catch (Throwable t) {
+                    log.error("宸梾涓婃姤閽夐拤閫氱煡澶辫触锛屽凡蹇界暐锛堜笉褰卞搷涓婃姤涓绘祦绋嬶級锛宨d={}",
+                            serviceReimbursement.getId(), t);
+                }
             }
 
             serviceReimbursementService.updateById(serviceReimbursement);
@@ -467,18 +478,16 @@
             System.out.println("鐩綍宸插瓨鍦�");
         }
 
-        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