修复注册审核记录不可见问题

This commit is contained in:
2026-10-26 23:58:51 +08:00
parent 50af9b3fb0
commit 44dda21976
5 changed files with 236 additions and 15 deletions
@@ -201,7 +201,11 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe
public List<WorkbenchRegistrationReviewVO> listForReviewer(Long reviewerId, boolean platformAdmin) {
List<WorkbenchRegistrationApplicationDO> applications;
if (platformAdmin) {
applications = applicationMapper.selectList(Wrappers.lambdaQuery(WorkbenchRegistrationApplicationDO.class).eq(WorkbenchRegistrationApplicationDO::getStatus, WorkbenchRegistrationStatus.PENDING_ADMIN).eq(WorkbenchRegistrationApplicationDO::getIsDelete, 0).orderByAsc(WorkbenchRegistrationApplicationDO::getCreateTime));
applications = applicationMapper.selectList(Wrappers.lambdaQuery(WorkbenchRegistrationApplicationDO.class)
.eq(WorkbenchRegistrationApplicationDO::getRoleType, WorkbenchRegistrationRole.MANAGER)
.eq(WorkbenchRegistrationApplicationDO::getStatus, WorkbenchRegistrationStatus.PENDING_ADMIN)
.eq(WorkbenchRegistrationApplicationDO::getIsDelete, 0)
.orderByAsc(WorkbenchRegistrationApplicationDO::getCreateTime));
} else {
UserDO reviewer = requireManager(reviewerId);
applications = applicationMapper.selectList(Wrappers.lambdaQuery(WorkbenchRegistrationApplicationDO.class).eq(WorkbenchRegistrationApplicationDO::getStatus, WorkbenchRegistrationStatus.PENDING_MANAGER).eq(WorkbenchRegistrationApplicationDO::getShopId, reviewer.getShopId()).eq(WorkbenchRegistrationApplicationDO::getIsDelete, 0).orderByAsc(WorkbenchRegistrationApplicationDO::getCreateTime));
@@ -222,15 +226,6 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe
? Map.of()
: contentModerationRecordMapper.selectBatchIds(moderationIds).stream()
.collect(Collectors.toMap(ContentModerationRecordDO::getId, Function.identity()));
if (platformAdmin) {
applications = applications.stream()
.filter(application -> {
ContentModerationRecordDO moderation = application.getContentModerationRecordId() == null
? null : moderationById.get(application.getContentModerationRecordId());
return moderation != null && "APPROVED".equals(moderation.getStatus());
})
.collect(Collectors.toList());
}
return applications.stream()
.map(application -> toReviewVO(application, applicants.get(application.getUserId()),
application.getContentModerationRecordId() == null
@@ -0,0 +1,208 @@
package com.xiaowang.jayucloud.salon.core.modules.registration.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.xiaowang.jayucloud.salon.core.modules.integration.service.WechatMiniAuthService;
import com.xiaowang.jayucloud.salon.core.modules.privacy.entity.ContentModerationRecordDO;
import com.xiaowang.jayucloud.salon.core.modules.privacy.mapper.ContentModerationRecordMapper;
import com.xiaowang.jayucloud.salon.core.modules.privacy.service.ContentModerationService;
import com.xiaowang.jayucloud.salon.core.modules.registration.entity.WorkbenchRegistrationApplicationDO;
import com.xiaowang.jayucloud.salon.core.modules.registration.entity.WorkbenchRegistrationStatus;
import com.xiaowang.jayucloud.salon.core.modules.registration.mapper.WorkbenchRegistrationApplicationMapper;
import com.xiaowang.jayucloud.salon.core.modules.registration.vo.WorkbenchRegistrationReviewSummaryVO;
import com.xiaowang.jayucloud.salon.core.modules.registration.vo.WorkbenchRegistrationReviewVO;
import com.xiaowang.jayucloud.salon.core.modules.shop.mapper.ShopMapper;
import com.xiaowang.jayucloud.salon.core.modules.shop.entity.ShopDO;
import com.xiaowang.jayucloud.salon.core.modules.shop.service.ShopBusinessExpiryService;
import com.xiaowang.jayucloud.salon.core.modules.shop.mapper.UserShopBindingMapper;
import com.xiaowang.jayucloud.salon.core.modules.shop.support.UserShopBindingSupport;
import com.xiaowang.jayucloud.salon.core.modules.system.service.SystemParameterConfigService;
import com.xiaowang.jayucloud.salon.core.modules.user.entity.UserDO;
import com.xiaowang.jayucloud.salon.core.modules.user.mapper.UserMapper;
import com.xiaowang.jayucloud.salon.core.modules.user.service.UserService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.transaction.PlatformTransactionManager;
import java.util.Collection;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
class WorkbenchRegistrationServiceImplTest {
@Mock private WorkbenchRegistrationApplicationMapper applicationMapper;
@Mock private UserMapper userMapper;
@Mock private ShopMapper shopMapper;
@Mock private UserService userService;
@Mock private UserShopBindingSupport userShopBindingSupport;
@Mock private UserShopBindingMapper userShopBindingMapper;
@Mock private WechatMiniAuthService wechatMiniAuthService;
@Mock private SystemParameterConfigService systemParameterConfigService;
@Mock private ContentModerationService contentModerationService;
@Mock private ContentModerationRecordMapper contentModerationRecordMapper;
@Mock private ShopBusinessExpiryService shopBusinessExpiryService;
@Mock private PlatformTransactionManager transactionManager;
private WorkbenchRegistrationServiceImpl service;
@BeforeEach
void setUp() {
service = new WorkbenchRegistrationServiceImpl(applicationMapper, userMapper, shopMapper, userService,
userShopBindingSupport, userShopBindingMapper, wechatMiniAuthService, systemParameterConfigService,
contentModerationService, contentModerationRecordMapper, shopBusinessExpiryService, transactionManager);
}
@Test
void returnsManagerReviewSummaryFromCurrentShopAndSwitch() {
UserDO manager = manager(7L, 21L);
when(userMapper.selectById(7L)).thenReturn(manager);
when(applicationMapper.selectCount(any(Wrapper.class))).thenReturn(3L);
when(systemParameterConfigService.getEnabledValue("WORKBENCH", "MANAGER_REGISTRATION_REVIEW_NOTICE"))
.thenReturn("true");
WorkbenchRegistrationReviewSummaryVO summary = service.getReviewSummary(7L);
assertEquals(3L, summary.getPendingCount());
assertEquals(true, summary.isNoticeEnabled());
}
@Test
void rejectsSummaryForNonManager() {
UserDO staff = new UserDO();
staff.setId(8L);
staff.setType(3);
staff.setShopId(21L);
when(userMapper.selectById(8L)).thenReturn(staff);
assertThrows(IllegalArgumentException.class, () -> service.getReviewSummary(8L));
}
@Test
void enrichesReviewListWithApplicantProfile() {
when(userMapper.selectById(7L)).thenReturn(manager(7L, 21L));
WorkbenchRegistrationApplicationDO application = new WorkbenchRegistrationApplicationDO();
application.setId(31L);
application.setUserId(9L);
application.setApplicationNo("SALON-001");
application.setStatus(WorkbenchRegistrationStatus.PENDING_MANAGER);
application.setShopId(21L);
when(applicationMapper.selectList(any(Wrapper.class))).thenReturn(List.of(application));
UserDO applicant = new UserDO();
applicant.setId(9L);
applicant.setNickname("小周");
applicant.setPhone("13812345678");
when(userMapper.selectBatchIds(any(Collection.class))).thenReturn(List.of(applicant));
List<WorkbenchRegistrationReviewVO> result = service.listForReviewer(7L, false);
assertEquals(1, result.size());
assertEquals("小周", result.get(0).getApplicantNickname());
assertEquals("138****5678", result.get(0).getApplicantMaskedPhone());
}
@Test
void locksApplicationAndRejectsAlreadyProcessedReview() {
WorkbenchRegistrationApplicationDO application = new WorkbenchRegistrationApplicationDO();
application.setId(31L);
application.setShopId(21L);
application.setStatus(WorkbenchRegistrationStatus.APPROVED);
when(applicationMapper.selectByIdForUpdate(31L)).thenReturn(application);
when(userMapper.selectById(7L)).thenReturn(manager(7L, 21L));
assertThrows(IllegalArgumentException.class, () -> service.approve(7L, false, 31L));
verify(applicationMapper).selectByIdForUpdate(31L);
}
@Test
void managerApplicationCannotBeApprovedBeforeContentModerationPasses() {
WorkbenchRegistrationApplicationDO application = new WorkbenchRegistrationApplicationDO();
application.setId(32L);
application.setUserId(9L);
application.setShopId(21L);
application.setRoleType("MANAGER");
application.setStatus(WorkbenchRegistrationStatus.PENDING_ADMIN);
application.setContentModerationRecordId(81L);
ContentModerationRecordDO moderation = new ContentModerationRecordDO();
moderation.setId(81L);
moderation.setStatus("PENDING");
when(applicationMapper.selectByIdForUpdate(32L)).thenReturn(application);
when(contentModerationRecordMapper.selectById(81L)).thenReturn(moderation);
assertThrows(IllegalArgumentException.class, () -> service.approve(1L, true, 32L));
verify(shopMapper, org.mockito.Mockito.never()).updateById(any());
verify(userMapper, org.mockito.Mockito.never()).updateById(any());
}
@Test
void platformAdminListShowsManagerApplicationsWhileContentReviewIsPending() {
WorkbenchRegistrationApplicationDO application = new WorkbenchRegistrationApplicationDO();
application.setId(33L);
application.setUserId(9L);
application.setRoleType("MANAGER");
application.setShopId(21L);
application.setStatus(WorkbenchRegistrationStatus.PENDING_ADMIN);
application.setContentModerationRecordId(82L);
ContentModerationRecordDO moderation = new ContentModerationRecordDO();
moderation.setId(82L);
moderation.setStatus("PENDING");
when(applicationMapper.selectList(any(Wrapper.class))).thenReturn(List.of(application));
when(userMapper.selectBatchIds(any(Collection.class))).thenReturn(List.of(new UserDO()));
when(contentModerationRecordMapper.selectBatchIds(any(Collection.class))).thenReturn(List.of(moderation));
List<WorkbenchRegistrationReviewVO> result = service.listForReviewer(1L, true);
assertEquals(1, result.size());
assertEquals(WorkbenchRegistrationStatus.PENDING_ADMIN, result.get(0).getStatus());
assertEquals("PENDING", result.get(0).getContentModerationStatus());
}
@Test
void autoApprovesManagerOnlyWhenLinkedShopContentPassed() {
WorkbenchRegistrationApplicationDO application = new WorkbenchRegistrationApplicationDO();
application.setId(34L);
application.setUserId(9L);
application.setShopId(21L);
application.setRoleType("MANAGER");
application.setStatus(WorkbenchRegistrationStatus.PENDING_ADMIN);
application.setContentModerationRecordId(83L);
ContentModerationRecordDO moderation = new ContentModerationRecordDO();
moderation.setId(83L);
moderation.setContentType("SHOP");
moderation.setUserId(9L);
moderation.setStatus("APPROVED");
UserDO applicant = new UserDO();
applicant.setId(9L);
ShopDO shop = new ShopDO();
shop.setId(21L);
when(applicationMapper.selectByIdForUpdate(34L)).thenReturn(application);
when(contentModerationRecordMapper.selectById(83L)).thenReturn(moderation);
when(systemParameterConfigService.getEnabledValue("WORKBENCH", "MANAGER_REGISTRATION_AUTO_APPROVE"))
.thenReturn("true");
when(userMapper.selectById(9L)).thenReturn(applicant);
when(shopMapper.selectById(21L)).thenReturn(shop);
service.processManagerModeration(34L);
assertEquals(WorkbenchRegistrationStatus.APPROVED, application.getStatus());
verify(shopBusinessExpiryService).startDefaultValidity(org.mockito.ArgumentMatchers.eq(21L), any());
verify(userShopBindingSupport).updateBindingStatus(9L, 21L, 1);
verify(userService).syncManagedPermissions(9L);
}
private UserDO manager(Long id, Long shopId) {
UserDO manager = new UserDO();
manager.setId(id);
manager.setType(2);
manager.setShopId(shopId);
return manager;
}
}
@@ -4,7 +4,7 @@
<div>
<span class="admin-view-heading__eyebrow">账号管理</span>
<h1>注册审核</h1>
<p>核验并处理店长与员工的账号申请。</p>
<p>处理店长注册申请;员工加入申请由店长在小程序员工页面审核。</p>
</div>
<div class="admin-view-heading__count"><strong>{{ applications.length }}</strong><span>条申请记录</span></div>
</header>
@@ -22,7 +22,7 @@
</template>
<template v-else-if="column.key === 'status'">
<a-tag :color="record.status === 'APPROVED' ? 'green' : record.status === 'REJECTED' ? 'red' : 'processing'">
{{ statusLabel(record.status) }}
{{ statusLabel(record.status, record.contentModerationStatus) }}
</a-tag>
</template>
<template v-else-if="column.key === 'contentModerationStatus'">
@@ -33,7 +33,14 @@
</template>
<template v-else-if="column.key === 'action'">
<a-space v-if="record.status === 'PENDING_ADMIN'">
<a-button type="primary" size="small" @click="approve(record.id)">通过</a-button>
<a-tooltip :title="record.contentModerationStatus === 'APPROVED' ? '' : '门店资料内容审核通过后才可批准'">
<a-button
type="primary"
size="small"
:disabled="record.contentModerationStatus !== 'APPROVED'"
@click="approve(record.id)"
>通过</a-button>
</a-tooltip>
<a-button danger size="small" @click="reject(record.id)">驳回</a-button>
</a-space>
</template>
@@ -60,7 +67,10 @@ const columns = [
{ title: '操作', key: 'action', width: 150 }
]
const statusLabel = (status: string) => ({ PENDING_ADMIN: '待管理员审核', PENDING_MANAGER: '待店长审核', APPROVED: '已通过', REJECTED: '已驳回' }[status] || status)
const statusLabel = (status: string, moderationStatus?: string) => {
if (status === 'PENDING_ADMIN' && moderationStatus !== 'APPROVED') return '待资料审核'
return ({ PENDING_ADMIN: '待管理员审核', PENDING_MANAGER: '待店长审核', APPROVED: '已通过', REJECTED: '已驳回' }[status] || status)
}
const moderationLabel = (status?: string) => ({ APPROVED: '已通过', PENDING: '待审核', RETRY: '重试中', REJECTED: '未通过', MISSING: '未提交' }[status || ''] || '审核中')
const moderationColor = (status?: string) => ({ APPROVED: 'green', PENDING: 'processing', RETRY: 'orange', REJECTED: 'red', MISSING: 'default' }[status || ''] || 'processing')
+1 -1
View File
@@ -155,7 +155,7 @@ Page({
const result = await new Promise(resolve => {
wx.showModal({
title: '有美甲师申请待审核',
content: `当前有 ${summary.pendingCount} 条美甲师加入申请,是否立即处理?`,
content: `当前有 ${summary.pendingCount} 条美甲师加入申请,请在小程序员工页面审核。是否立即处理?`,
cancelText: '稍后处理',
confirmText: '立即审核',
success: resolve,
+8
View File
@@ -354,3 +354,11 @@
- 原因是 `MyBatisPlusConfig` 使用显式 `@MapperScan` 包清单,但漏登记新增的 analytics mapper 包;干净编译不会发现该 Spring Bean 注册错误。
- 将 analytics mapper 包加入扫描范围。Core clean compile 通过;实际启动成功,Nacos、MySQL、RabbitMQ 连接正常,Flyway 校验 5 个迁移并确认数据库已是 V5,无待执行迁移;`/health/check` 返回 200。
- 验证后已关闭本次启动的 Core 进程,保留既有 Gateway 进程。
## 2026-10-26 Salon 注册审核记录可见性修复
- 修复平台管理员注册审核列表隐藏待内容审核店长申请的问题;审核列表现在显示所有待管理员处理的店长申请及其内容审核状态。
- 内容审核未通过或尚未完成时禁用“通过”,后端原有审核门禁保持不变;驳回仍可使用。
- 明确后台注册审核页只处理店长申请,员工加入申请由店长在小程序员工页面审核。登录提醒统计的是当前门店待店长审核员工申请,因此与后台店长申请队列不同。
- 登录提醒文案明确员工申请需在小程序员工页面审核,并保留“立即审核”直达入口。
- 原因是管理员列表额外过滤掉了内容审核状态非 APPROVED 的申请,而 DEV 的本地 Mock 对未标记场景默认返回 PENDING,导致申请记录不可见。