diff --git a/par-api/src/main/java/com/par/api/controller/AdminController.java b/par-api/src/main/java/com/par/api/controller/AdminController.java index 3a7aa84..49102fe 100644 --- a/par-api/src/main/java/com/par/api/controller/AdminController.java +++ b/par-api/src/main/java/com/par/api/controller/AdminController.java @@ -277,12 +277,14 @@ public class AdminController { HttpServletRequest request) { checkAdmin(request); Long reviewerId = (Long) request.getAttribute("accountId"); - String name = body != null ? (String) body.get("name") : null; - String baseUrl = body != null ? (String) body.get("baseUrl") : null; + @SuppressWarnings("unchecked") + List names = body != null ? (List) body.get("names") : null; + @SuppressWarnings("unchecked") + List urls = body != null ? (List) body.get("urls") : null; String siteType = body != null ? (String) body.get("siteType") : null; String status = body != null ? (String) body.get("status") : null; String notes = body != null ? (String) body.get("notes") : null; - siteService.approveChange(id, reviewerId, name, baseUrl, siteType, status, notes); + siteService.approveChange(id, reviewerId, names, urls, siteType, status, notes); log.info("Change approved: id={}, reviewer={}", id, reviewerId); return ApiResponse.success(); } diff --git a/par-core/src/main/java/com/par/core/service/SiteService.java b/par-core/src/main/java/com/par/core/service/SiteService.java index 864b7e2..95ff067 100644 --- a/par-core/src/main/java/com/par/core/service/SiteService.java +++ b/par-core/src/main/java/com/par/core/service/SiteService.java @@ -52,8 +52,8 @@ public interface SiteService { /** 待审核变更列表 */ List listPendingChanges(); - /** 审核通过 → 写入 sites 表(支持审核时编辑 name/baseUrl/siteType/status/notes) */ - Site approveChange(Long changeId, Long reviewerId, String name, String baseUrl, + /** 审核通过 → 写入 sites 表(支持审核时编辑 names/urls/...) */ + Site approveChange(Long changeId, Long reviewerId, List names, List urls, String siteType, String status, String notes); /** 拒绝变更 */ diff --git a/par-core/src/main/java/com/par/core/service/impl/SiteServiceImpl.java b/par-core/src/main/java/com/par/core/service/impl/SiteServiceImpl.java index baa8dae..b2a8b34 100644 --- a/par-core/src/main/java/com/par/core/service/impl/SiteServiceImpl.java +++ b/par-core/src/main/java/com/par/core/service/impl/SiteServiceImpl.java @@ -236,7 +236,7 @@ public class SiteServiceImpl implements SiteService { } @Override - public Site approveChange(Long changeId, Long reviewerId, String reviewerName, String reviewerBaseUrl, + public Site approveChange(Long changeId, Long reviewerId, List reviewerNames, List reviewerUrls, String reviewerSiteType, String reviewerStatus, String reviewerNotes) { SiteChange entry = changeMapper.selectById(changeId); if (entry == null) throw new IllegalArgumentException("变更记录不存在"); @@ -251,9 +251,9 @@ public class SiteServiceImpl implements SiteService { // 优先使用审核者编辑的数据,否则用原始提交数据 @SuppressWarnings("unchecked") - List names = reviewerName != null ? List.of(reviewerName) + List names = (reviewerNames != null && !reviewerNames.isEmpty()) ? reviewerNames : (List) raw.getOrDefault("names", List.of()); - List urls = reviewerBaseUrl != null ? List.of(reviewerBaseUrl) + List urls = (reviewerUrls != null && !reviewerUrls.isEmpty()) ? reviewerUrls : (List) raw.getOrDefault("urls", List.of()); String notes = reviewerNotes != null ? reviewerNotes : (String) raw.getOrDefault("notes", ""); diff --git a/web/src/views/SiteReview.vue b/web/src/views/SiteReview.vue index ee0b097..2522ff2 100644 --- a/web/src/views/SiteReview.vue +++ b/web/src/views/SiteReview.vue @@ -105,13 +105,13 @@ const handleApprove = (row) => { } const confirmApprove = async () => { - const name = approveForm.namesText.split('\n').map(s => s.trim()).filter(Boolean)[0] || '' - const baseUrl = approveForm.urlsText.split('\n').map(s => s.trim()).filter(Boolean)[0] || '' - if (!name || !baseUrl) { ElMessage.warning('名称和地址不能为空'); return } + const names = approveForm.namesText.split('\n').map(s => s.trim()).filter(Boolean) + const urls = approveForm.urlsText.split('\n').map(s => s.trim()).filter(Boolean) + if (names.length === 0 || urls.length === 0) { ElMessage.warning('名称和地址不能为空'); return } saving.value = true try { await api.sites.approveChange(approveForm.id, { - name, baseUrl, + names, urls, siteType: approveForm.siteType || 'unknown', status: approveForm.status, notes: approveForm.notes || null,