From 5d34bdd3c426bb2ca5f6627424ae67984f745603 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期三, 21 十月 2026 18:28:59 +0800
Subject: [PATCH] feat: 新增资产/用车/采购模块,完善课题、会员、财务与企微功能
---
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/util/storage/StorageFileUtil.java | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/util/storage/StorageFileUtil.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/util/storage/StorageFileUtil.java
index c5ac949..a0bfc83 100644
--- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/util/storage/StorageFileUtil.java
+++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/util/storage/StorageFileUtil.java
@@ -23,6 +23,7 @@
import javax.crypto.SecretKey;
import java.io.File;
import java.math.BigDecimal;
+import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
@@ -41,7 +42,7 @@
* - token浣跨敤娆℃暟鎺у埗锛圧edis锛�
* - 鍥剧墖鍘嬬缉
*
- * @author 鑺嬮亾婧愮爜
+ * @author 瓒呯骇绠$悊鍛�
*/
@Component
@RequiredArgsConstructor
@@ -278,7 +279,8 @@
List<SystemStorageAttachmentDO> attachments = getStorageAttachmentsByApplicationAndRecordTypeAndRecordId(
application, recordType, recordId);
if (CollUtil.isEmpty(attachments)) {
- return null;
+ // 杩斿洖绌洪泦鍚堣�岄潪 null锛氳皟鐢ㄦ柟甯告妸瀹冪洿鎺ュ杩� Collectors.toMap 鍋氬垎缁勶紙value 涓� null 浼氭姏 NPE锛�
+ return new ArrayList<>();
}
Map<Long, Long> blobIdToAttachmentIdMap = attachments.stream()
.collect(Collectors.toMap(SystemStorageAttachmentDO::getStorageBlobId, SystemStorageAttachmentDO::getId));
@@ -302,7 +304,8 @@
public List<SystemStorageBlobRespVO> getStorageBlobVOsByRecordTypeAndRecordId(String recordType, Long recordId) {
List<SystemStorageAttachmentDO> attachments = getStorageAttachmentsByRecordTypeAndRecordId(recordType, recordId);
if (CollUtil.isEmpty(attachments)) {
- return null;
+ // 杩斿洖绌洪泦鍚堣�岄潪 null锛岄伩鍏嶈皟鐢ㄦ柟鐩存帴浣跨敤杩斿洖鍊兼椂鎶� NPE
+ return new ArrayList<>();
}
List<Long> storageBlobIds = attachments.stream()
.map(SystemStorageAttachmentDO::getStorageBlobId)
@@ -459,7 +462,10 @@
}
String domain = StringUtils.trimTrailingCharacter(properties.getDomain(), '/');
String prefix = properties.getUrlPrefix().startsWith("/") ? properties.getUrlPrefix() : "/" + properties.getUrlPrefix();
- String baseUrl = domain + prefix + actionPath + uidFilename;
+ // 鏂囦欢鍚嶅彲鑳藉寘鍚腑鏂囥�佺┖鏍肩瓑瀛楃锛屽繀椤荤紪鐮佸悗鍐嶆嫾鎺ュ埌 URL锛屽惁鍒欓儴鍒嗗鎴风/瀹瑰櫒浼氱洿鎺ヨ繑鍥� 400
+ String encodedUidFilename = URLEncoder.encode(uidFilename, StandardCharsets.UTF_8)
+ .replace("+", "%20");
+ String baseUrl = domain + prefix + actionPath + encodedUidFilename;
// -1 琛ㄧず姘镐箙鏈夋晥锛屼笉鐢熸垚 token锛屾敼涓� publicKey 缁勫悎鏍¢獙
if (expired != null && BigDecimal.valueOf(-1L).compareTo(expired) == 0) {
--
Gitblit v1.9.3