From eeff1d35a5b2ac5399a567bd6bce4b2bad2c1285 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Thu, 11 Dec 2025 17:00:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E5=92=8C=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E7=85=A7=E7=89=87=E5=AE=A1=E6=A0=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../command/user/UpdateUserProfileCmdExe.java | 27 +++++++++++++++++++ .../app/listener/CensorProfileListener.java | 7 ++--- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UpdateUserProfileCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UpdateUserProfileCmdExe.java index 1cbcea45..98b6c680 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UpdateUserProfileCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UpdateUserProfileCmdExe.java @@ -103,6 +103,10 @@ public class UpdateUserProfileCmdExe { processCountry(cmd, userProfile); + // 处理照片状态 + processPhotoStatus(updateUserProfile.getBackgroundPhotos(), userProfile.getBackgroundPhotos()); + processPhotoStatus(updateUserProfile.getPersonalPhotos(), userProfile.getPersonalPhotos()); + userProfileGateway.updateSelectiveById(updateUserProfile); // 同步修改房间国家 @@ -253,4 +257,27 @@ public class UpdateUserProfileCmdExe { baseInfo.setCountryId(null); } + /** + * 处理照片状态:新照片设置为待审核,已存在照片保持原状态. + */ + private void processPhotoStatus(List newPhotos, List originalPhotos) { + if (CollectionUtils.isEmpty(newPhotos)) { + return; + } + + for (PhotoItem photo : newPhotos) { + boolean isNew = CollectionUtils.isEmpty(originalPhotos) + || originalPhotos.stream().noneMatch(p -> Objects.equals(p.getUrl(), photo.getUrl())); + + if (isNew) { + photo.setStatus(PhotoAuditStatus.PENDING.getCode()); + } else { + originalPhotos.stream() + .filter(p -> Objects.equals(p.getUrl(), photo.getUrl())) + .findFirst() + .ifPresent(p -> photo.setStatus(p.getStatus())); + } + } + } + } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/CensorProfileListener.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/CensorProfileListener.java index 20688690..84efc301 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/CensorProfileListener.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/CensorProfileListener.java @@ -284,12 +284,9 @@ public class CensorProfileListener implements MessageListener { String labelNames = response.formatLabelString(); - if (response.checkBlock()) { + if (!response.checkPass()) { // 审核不通过,记录违规 - photoViolationHandle(param.getUserId(), censorContent.getContent(), - labelNames, approvalType); - // 删除违规图片 - ossServiceClient.remove(censorContent.getContent()); + photoViolationHandle(param.getUserId(), censorContent.getContent(), labelNames, approvalType); // 更新MongoDB中图片状态 updatePhotoStatus(param.getUserId(), censorContent.getContent(), PhotoAuditStatus.REJECTED.getCode(), labelNames, approvalType);