fix: 证书批量导入改为覆盖式回填 (直接替换旧 URL, 不再逗号追加)

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
2026-10-08 14:44:12 +00:00
co-authored by Claude Code
parent 8461f3400d
commit f8afe9baab
@@ -526,8 +526,6 @@ public class BizExpertServiceImpl implements IBizExpertService
int updated = 0; int updated = 0;
int processed = 0; int processed = 0;
// expertId -> 已拼接的 URL (处理同一专家多文件时避免互相覆盖)
Map<Long, String> accumulated = new HashMap<>();
List<Map<String, Object>> results = new ArrayList<>(); List<Map<String, Object>> results = new ArrayList<>();
for (CertFile f : files) { for (CertFile f : files) {
processed++; processed++;
@@ -544,17 +542,13 @@ public class BizExpertServiceImpl implements IBizExpertService
BizExpert matched = cm.expert; BizExpert matched = cm.expert;
String url = ossUploader.uploadWithOriginalName(f.bytes, f.name, subDir); 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(); BizExpert entity = new BizExpert();
entity.setExpertId(matched.getExpertId()); entity.setExpertId(matched.getExpertId());
entity.setUpdateBy(username); entity.setUpdateBy(username);
if (practice) entity.setPracticeCertUrl(joined); if (practice) entity.setPracticeCertUrl(url);
else entity.setTitleCertUrl(joined); else entity.setTitleCertUrl(url);
bizExpertMapper.updateByPrimaryKey(entity); bizExpertMapper.updateByPrimaryKey(entity);
updated++; updated++;