From 64fe4241b5e764f91966878eff1720a3b14d6da8 Mon Sep 17 00:00:00 2001
From: sinake <sinake1@qq.com>
Date: 星期三, 25 十一月 2026 11:50:58 +0800
Subject: [PATCH] 打包文件
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java | 283 ++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 182 insertions(+), 101 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 94b2a5e..a287a6b 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
@@ -9,6 +9,7 @@
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
@@ -59,11 +60,12 @@
@Autowired
private IServiceFundService serviceFundService;
@Autowired
+ private IServiceFundSharedService serviceFundSharedService;
+ @Autowired
private IServiceFunddetailService serviceFunddetailService;
@Autowired
private IServiceFundflowruleService serviceFundflowruleService;
- @Autowired
- private IServiceFundflowService serviceFundflowService;
+
@Autowired
private IServiceDonatebaseinfoService serviceDonatebaseinfoService;
@@ -71,20 +73,10 @@
private IServiceReimbursementService serviceReimbursementService;
@Autowired
- private IServiceSystemmessageService iServiceSystemmessageService;
-
- @Autowired
private IServiceExternalpersonService externalpersonService;
@Autowired
private ISysPostService postService;
-
-
- @Autowired
- private DingTalkService dingTalkService;
-
- @Autowired
- private ISysUserService sysUserService;
public ServiceFundController() {
configuration = new Configuration();
@@ -118,13 +110,32 @@
@PostMapping("/processlog")
public AjaxResult processlog(@RequestBody ServiceProcessVO serviceProcessVO) {
log.info("鑷磋繙绯荤粺娴佺▼閫�鍥炲鎵规棩蹇楀叆鍙傦細{}", serviceProcessVO);
- if (serviceProcessVO.getBackCode() == null || StringUtils.isEmpty(serviceProcessVO.getApplytype())) {
+ if (serviceProcessVO.getBackCode() == null && StringUtils.isEmpty(serviceProcessVO.getApplytype())) {
return AjaxResult.error("鍏ヨ兘涓虹┖,璇锋鏌ュ叆鍙�!!");
}
Boolean processlog = serviceFundService.processlog(serviceProcessVO);
if (!processlog) return AjaxResult.error("瀹℃壒璁板綍澶辫触");
return AjaxResult.success("瀹℃壒璁板綍鎴愬姛");
+ }
+
+ /**
+ * 淇敼缂栧彿涓庢敮浠樻柟寮�
+ *
+ * @param serviceCodeAndPyaWay
+ * @return
+ */
+ @PostMapping("/updatecodepayway")
+ public AjaxResult updatecodepay(@RequestBody ServiceCodeAndPyaWay serviceCodeAndPyaWay) {
+ log.info("鑷磋繙绯荤粺缂栧彿涓庢敮浠樻柟寮忓叆鍙傦細{}", serviceCodeAndPyaWay);
+ if (StringUtils.isEmpty(serviceCodeAndPyaWay.getApplytype()) || StringUtils.isEmpty(serviceCodeAndPyaWay.getBh()) || StringUtils.isEmpty(serviceCodeAndPyaWay.getZffs())) {
+ return AjaxResult.error("鍏ヨ兘涓虹┖,璇锋鏌ュ叆鍙�!!");
+ }
+
+ Boolean result = serviceFundService.updatecodepay(serviceCodeAndPyaWay);
+ if (!result) return AjaxResult.error("淇敼澶辫触");
+
+ return AjaxResult.success("淇敼鎴愬姛");
}
@@ -136,11 +147,47 @@
@GetMapping("/list")
public TableDataInfo list(ServiceFund serviceFund) {
startPage();
- //List<ServiceFund> list = serviceFundService.queryList(serviceFund);
SysUser user = SecurityUtils.getLoginUser().getUser();
- serviceFund.setUsername(user.getNickName());
+ // 2026-11-10锛氭寜瑙掕壊鍒掑垎鍙鑼冨洿锛堝師瀹炵幇涓�寰嬪彧鏌�"鐢宠浜�=鏈汉"锛岀鐞嗗憳/缁勯暱鐪嬩笉鍒板埆浜虹殑鍗曟嵁锛�
+ applyFundDataScope(serviceFund, user);
List<ServiceFund> list = serviceFundService.selectServiceFundList(serviceFund);
return getDataTable(list);
+ }
+
+ /**
+ * 鎶ラ攢鍗曞垪琛ㄦ暟鎹寖鍥达細
+ * 瓒呯锛坲ser_id=1 鎴� role_id=1锛夆啋 鍏ㄩ儴锛�
+ * 涓氬姟缁勯暱锛坮ole_id=13锛夆啋 鏈粍锛圖eptmentNo = 鐧诲綍浜烘墍灞為儴闂級锛�
+ * 鍏朵粬锛堜笓鑱屼汉鍛樼瓑锛夆啋 鏈汉锛圲serName = 鐧诲綍浜烘樀绉帮級銆�
+ */
+ private void applyFundDataScope(ServiceFund serviceFund, SysUser user) {
+ if (user == null) {
+ return;
+ }
+ if (Long.valueOf(1L).equals(user.getUserId()) || hasRole(user, 1L)) {
+ // 瓒呯锛氫笉鍔犱换浣曡繃婊わ紝鐪嬪叏閮�
+ return;
+ }
+ if (hasRole(user, 13L) && user.getDeptId() != null) {
+ // 涓氬姟缁勯暱锛氱湅鏈粍
+ serviceFund.setDeptmentno(String.valueOf(user.getDeptId()));
+ return;
+ }
+ // 榛樿锛氬彧鐪嬫湰浜�
+ serviceFund.setUsername(user.getNickName());
+ }
+
+ /** 鍒ゆ柇鐧诲綍浜烘槸鍚︽嫢鏈夋寚瀹氳鑹� */
+ private boolean hasRole(SysUser user, Long roleId) {
+ if (user == null || user.getRoles() == null) {
+ return false;
+ }
+ for (SysRole role : user.getRoles()) {
+ if (role != null && roleId.equals(role.getRoleId())) {
+ return true;
+ }
+ }
+ return false;
}
@GetMapping("/listnew")
@@ -211,7 +258,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);
@@ -308,8 +355,54 @@
@RepeatSubmit
@Options(useGeneratedKeys = true, keyProperty = "id")
public AjaxResult addOrUpdateNew(@RequestBody ServiceFundVO serviceFundVO) {
+ // 2026-11-23锛氬墧闄� blob:/data: 杩欑被娴忚鍣ㄤ复鏃堕檮浠跺湴鍧�锛岄伩鍏嶈惤搴撳悗鏃犳硶棰勮
+ int droppedAttach = sanitizeAttachments(serviceFundVO);
+ AjaxResult result = AjaxResult.success(serviceFundService.addOrUpdateNew(serviceFundVO));
+ if (droppedAttach > 0) {
+ result.put("attachWarn",
+ "妫�娴嬪埌 " + droppedAttach + " 涓檮浠跺湴鍧�鏃犳晥锛堟祻瑙堝櫒涓存椂鍦板潃锛夛紝宸茶嚜鍔ㄥ墧闄わ紝璇烽噸鏂颁笂浼犺繖浜涢檮浠跺悗鍐嶄繚瀛樸��");
+ }
+ return result;
+ }
- return AjaxResult.success(serviceFundService.addOrUpdateNew(serviceFundVO));
+ /**
+ * 2026-11-23锛氭竻娲楁暣鍗曟槑缁嗛噷鐨勪复鏃堕檮浠跺湴鍧�锛坆lob:/data:/file:锛夈��
+ *
+ * @return 琚墧闄ょ殑闄勪欢鏉℃暟
+ */
+ private int sanitizeAttachments(ServiceFundVO serviceFundVO) {
+ if (serviceFundVO == null || CollectionUtils.isEmpty(serviceFundVO.getServiceFunddetails())) {
+ return 0;
+ }
+ int dropped = 0;
+ for (ServiceFunddetailVO detail : serviceFundVO.getServiceFunddetails()) {
+ if (detail == null) {
+ continue;
+ }
+ dropped += com.ruoyi.project.common.AttachmentUrlSanitizer.sanitize(detail.getAnnexfilesList());
+ dropped += com.ruoyi.project.common.AttachmentUrlSanitizer.sanitize(detail.getInvoicefilesList());
+ }
+ if (dropped > 0) {
+ log.warn("鎶ラ攢鍗曚繚瀛橈細鍓旈櫎 {} 涓复鏃堕檮浠跺湴鍧�锛坆lob:/data:锛夛紝鍗曟嵁 fundid={}", dropped, serviceFundVO.getId());
+ }
+ return dropped;
+ }
+
+ /**
+ * 涓撳鍔冲姟璐癸細淇濆瓨鍓嶇殑璐圭敤鎺у埗鏍¢獙锛堝共璺戯紝涓嶈惤搴擄級
+ *
+ * <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;
}
@@ -323,7 +416,7 @@
public AjaxResult checkFund(@RequestBody CheckFundVO checkFundVO) {
log.info("serviceFundController---checkFund鐨勫叆鍙傚�糲heckFundVO :{}", checkFundVO);
LoginUser loginUser = getLoginUser();
- Map<String, String> map = serviceFundService.checkFund(checkFundVO,loginUser);
+ Map<String, String> map = serviceFundService.checkFund(checkFundVO, loginUser);
Set<String> keys = map.keySet();
for (String s : keys) {
if (!s.equals("200")) return AjaxResult.error(map.get(s));
@@ -345,6 +438,8 @@
List<ServiceFund> infoByInfoIdList = serviceFundService.queryInfoById(serviceFund);
log.info("淇敼璐圭敤鐢宠锛岄�氳繃鍏ュ弬鏌ヨ serviceFundService.queryInfoById鏁版嵁涓虹┖,鍏ュ弬:{}", infoByInfoIdList.size());
if (CollectionUtils.isEmpty(infoByInfoIdList)) {
+ // 2026-11-23锛氬悓鏍峰墧闄や复鏃堕檮浠跺湴鍧�锛坆lob:/data:锛夛紝閬垮厤钀藉簱鍚庢棤娉曢瑙�
+ sanitizeAttachments(serviceFundVO);
Long id = serviceFundService.addOrUpdateNew(serviceFundVO);
serviceFund.setId(id);
}
@@ -454,25 +549,27 @@
}
String newTime = String.valueOf(Calendar.getInstance().getTimeInMillis());
- String name = "涓撳鍔冲姟璐瑰彂鏀剧敵璇峰崟_" + dataMap.get("XM") + "_" + newTime;
+ String newName = null;
+ if (Objects.isNull(dataMap.get("XM"))) {
+ newName = dataMap.get("XM").toString().trim();
+ }
+ String name = "涓撳鍔冲姟璐瑰彂鏀剧敵璇峰崟_" + newName + "_" + newTime;
if (dataLW.equals("4")) {
- name = "鍔炲叕璐圭敤鐢宠鍗昣" + dataMap.get("XM") + "_" + newTime;
+ name = "鍔炲叕璐圭敤鐢宠鍗昣" + newName + "_" + newTime;
}
//杈撳嚭鏂囨。璺緞鍙婂悕绉�
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");
@@ -645,18 +742,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");
@@ -742,18 +837,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");
@@ -844,20 +937,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");
@@ -1069,18 +1158,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");
@@ -1138,18 +1225,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");
@@ -1638,18 +1723,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");
@@ -1727,18 +1810,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