From 2450a8348e0803b20e465d8c5cd033b9bc754e58 Mon Sep 17 00:00:00 2001 From: "youhong.ai" Date: Fri, 30 Jun 2023 15:17:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E6=97=B6=E6=8D=B7=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=96=87=E4=BB=B6=E5=90=8D=E4=B9=B1=E7=A0=81?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/aiyh/utils/action/SafeCusBaseAction.java | 1 + .../ai/pcn/download/service/DownloadFileService.java | 7 +++++++ .../action/sapdocking/VoucherPayableNewAction.java | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/aiyh/utils/action/SafeCusBaseAction.java b/src/main/java/aiyh/utils/action/SafeCusBaseAction.java index 92cdf9f..be9f5c8 100644 --- a/src/main/java/aiyh/utils/action/SafeCusBaseAction.java +++ b/src/main/java/aiyh/utils/action/SafeCusBaseAction.java @@ -200,6 +200,7 @@ public abstract class SafeCusBaseAction implements Action { String billTable = requestManager.getBillTableName(); String id = mapper.selectIdByRequest(billTable, requestInfo.getRequestid()); result.put("id", id); + result.put("requestid", requestInfo.getRequestid()); return result; } diff --git a/src/main/java/com/api/youhong/ai/pcn/download/service/DownloadFileService.java b/src/main/java/com/api/youhong/ai/pcn/download/service/DownloadFileService.java index 6585426..b7a802d 100644 --- a/src/main/java/com/api/youhong/ai/pcn/download/service/DownloadFileService.java +++ b/src/main/java/com/api/youhong/ai/pcn/download/service/DownloadFileService.java @@ -11,7 +11,9 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.StreamingOutput; import java.io.InputStream; +import java.io.UnsupportedEncodingException; import java.net.URLDecoder; +import java.net.URLEncoder; /** *

@@ -57,6 +59,11 @@ public class DownloadFileService { } }; String imageFileName = docImageInfo.getImageFileName(); + try { + imageFileName = URLEncoder.encode(imageFileName, "UTF-8"); + } catch (UnsupportedEncodingException ignore) { + } + return Response .ok(stream) .header("Content-Disposition", "attachment; filename=\"" + imageFileName + "\"") diff --git a/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/VoucherPayableNewAction.java b/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/VoucherPayableNewAction.java index b9ef555..8b1cc3c 100644 --- a/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/VoucherPayableNewAction.java +++ b/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/VoucherPayableNewAction.java @@ -172,7 +172,7 @@ public class VoucherPayableNewAction extends SafeCusBaseAction { } headKeys = sortKey(headKeys); for (String headKey : headKeys) { - sb.append(Util.null2String(heads.get(headKey)).replace(" ", " ")).append("\t"); + sb.append(Util.null2String(heads.get(headKey)).replace("
", " ").replace(" ", " ")).append("\t"); } sb.deleteCharAt(sb.lastIndexOf("\t")); sb.append("\r\n"); @@ -184,7 +184,7 @@ public class VoucherPayableNewAction extends SafeCusBaseAction { try { OutputStreamWriter out = new OutputStreamWriter( Files.newOutputStream(Paths.get(filePath)), StandardCharsets.UTF_8); - out.write(sb.toString().replace(" ", " ")); + out.write(sb.toString().replace("
", " ").replace(" ", " ")); out.close(); } catch (IOException e) {