From 365a1a1eacc425c858a661b7ffa14a7270bb1634 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期三, 30 九月 2026 14:27:04 +0800
Subject: [PATCH] fix(auth): 修复企业微信扫码登录换 profile 必抛空指针,并给自动注册账号绑默认角色
---
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/util/storage/StorageFileUtil.java | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 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 abc79c1..c4854fd 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
@@ -41,7 +41,7 @@
* - token浣跨敤娆℃暟鎺у埗锛圧edis锛�
* - 鍥剧墖鍘嬬缉
*
- * @author 鑺嬮亾婧愮爜
+ * @author 瓒呯骇绠$悊鍛�
*/
@Component
@RequiredArgsConstructor
@@ -104,21 +104,20 @@
throw new IllegalArgumentException("鍏宠仈璁板綍id涓嶈兘涓虹┖");
}
- // 鍒犻櫎鏃ч檮浠朵俊鎭�
+ // 鍙垹闄ゆ棫鐨勯檮浠跺叧鑱旇褰曪紝淇濈暀 blob 璁板綍锛堟枃浠舵湰韬笉鍒犻櫎锛�
if (application == null || application.trim().isEmpty()) {
for (SystemStorageAttachmentSaveReqVO.BlobItem item : blobItems) {
String itemApp = item.getApplication();
if (itemApp == null || itemApp.trim().isEmpty()) {
throw new IllegalArgumentException("鏂囦欢鐢ㄩ�斾笉鑳戒负绌�");
}
- deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordId(itemApp, recordType.getType(), recordId);
+ storageAttachmentMapper.deleteByApplicationAndRecordTypeAndRecordId(itemApp, recordType.getType(), recordId);
}
} else {
- deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordId(application, recordType.getType(), recordId);
+ storageAttachmentMapper.deleteByApplicationAndRecordTypeAndRecordId(application, recordType.getType(), recordId);
}
if (CollUtil.isEmpty(blobItems)) {
- deleteStorageAttachmentsByRecordTypeAndRecordId(recordType.getType(), recordId);
return;
}
@@ -279,7 +278,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));
@@ -303,7 +303,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)
--
Gitblit v1.9.3