fix: 证书批量导入改为覆盖式回填 (直接替换旧 URL, 不再逗号追加)
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
+3
-9
@@ -526,8 +526,6 @@ public class BizExpertServiceImpl implements IBizExpertService
|
||||
|
||||
int updated = 0;
|
||||
int processed = 0;
|
||||
// expertId -> 已拼接的 URL (处理同一专家多文件时避免互相覆盖)
|
||||
Map<Long, String> accumulated = new HashMap<>();
|
||||
List<Map<String, Object>> results = new ArrayList<>();
|
||||
for (CertFile f : files) {
|
||||
processed++;
|
||||
@@ -544,17 +542,13 @@ public class BizExpertServiceImpl implements IBizExpertService
|
||||
BizExpert matched = cm.expert;
|
||||
|
||||
String url = ossUploader.uploadWithOriginalName(f.bytes, f.name, subDir);
|
||||
String existing = accumulated.containsKey(matched.getExpertId())
|
||||
? accumulated.get(matched.getExpertId())
|
||||
: (practice ? matched.getPracticeCertUrl() : matched.getTitleCertUrl());
|
||||
String joined = (existing == null || existing.isEmpty()) ? url : existing + "," + url;
|
||||
accumulated.put(matched.getExpertId(), joined);
|
||||
|
||||
// 覆盖式回填: 直接替换为新 URL (证书不允许多张)
|
||||
BizExpert entity = new BizExpert();
|
||||
entity.setExpertId(matched.getExpertId());
|
||||
entity.setUpdateBy(username);
|
||||
if (practice) entity.setPracticeCertUrl(joined);
|
||||
else entity.setTitleCertUrl(joined);
|
||||
if (practice) entity.setPracticeCertUrl(url);
|
||||
else entity.setTitleCertUrl(url);
|
||||
bizExpertMapper.updateByPrimaryKey(entity);
|
||||
updated++;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user