个人和背景照片审核处理

This commit is contained in:
tianfeng 2025-12-11 17:00:59 +08:00
parent 41b8f700d2
commit eeff1d35a5
2 changed files with 29 additions and 5 deletions

View File

@ -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<PhotoItem> newPhotos, List<PhotoItem> 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()));
}
}
}
}

View File

@ -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);