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 | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 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 9b321ae..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");
@@ -233,8 +240,8 @@
} else if (relativeConfirmation.getSex().equals("2")) {
dataMap.put("XB", "濂�");
}
-
- dataMap.put("CSRQ", relativeConfirmation.getBirthday() == null ? "" : relativeConfirmation.getBirthday().substring(0, 10));
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ dataMap.put("CSRQ", relativeConfirmation.getBirthday() == null ? "" : simpleDateFormat.format(relativeConfirmation.getBirthday()).substring(0, 10));
dataMap.put("MZ", NationalityEnum.getDescByCode(relativeConfirmation.getNation()) == null ? "" : NationalityEnum.getDescByCode(relativeConfirmation.getNation()));
dataMap.put("XL", Education.getDescByCode(relativeConfirmation.getEducation()) == null ? "" : Education.getDescByCode(relativeConfirmation.getEducation()));
String occupation = "";
--
Gitblit v1.9.3