From 8c215c8be0f5076e8c95daf1b2203440ca7dfcad Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期五, 23 十月 2026 13:42:50 +0800
Subject: [PATCH] 修改了报销校验
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceRelativesconfirmationController.java | 26 ++++++++++++++++++++------
1 files changed, 20 insertions(+), 6 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 72938a7..7a4a790 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
@@ -122,7 +122,18 @@
@RepeatSubmit
public AjaxResult add(@RequestBody ServiceRelativesconfirmation serviceRelativesconfirmation) {
log.info("鏂板鎹愮尞浜插睘纭锛歿}", serviceRelativesconfirmation);
- boolean save = serviceRelativesconfirmationService.save(serviceRelativesconfirmation);
+ // 2026-10-22锛氬悓涓�妗堜緥鍙厑璁镐竴鏉℃湭鍒犻櫎璁板綍鈥斺�斿凡瀛樺湪鍒欐洿鏂帮紝閬垮厤鍙嶅淇濆瓨浜х敓閲嶅琛�
+ if (serviceRelativesconfirmation.getInfoid() != null) {
+ ServiceRelativesconfirmation query = new ServiceRelativesconfirmation();
+ query.setInfoid(serviceRelativesconfirmation.getInfoid());
+ List<ServiceRelativesconfirmation> exist = serviceRelativesconfirmationService.queryList(query);
+ if (exist != null && !exist.isEmpty()) {
+ serviceRelativesconfirmation.setId(exist.get(0).getId());
+ serviceRelativesconfirmationService.updateById(serviceRelativesconfirmation);
+ return AjaxResult.success(serviceRelativesconfirmation);
+ }
+ }
+ serviceRelativesconfirmationService.save(serviceRelativesconfirmation);
return AjaxResult.success(serviceRelativesconfirmation);
}
@@ -189,13 +200,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