Compare commits
2 Commits
61ab844e5d
...
cac5b8ae7d
| Author | SHA1 | Date | |
|---|---|---|---|
| cac5b8ae7d | |||
| 7067d5380d |
@@ -128,11 +128,43 @@ h3 {
|
||||
.jd-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
gap: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
/* 工具栏右侧两个批量按钮:推右的 margin 由移除分类带,删除跟排。 */
|
||||
.jd-remove-btn {
|
||||
/* 工具栏里的下拉与按钮统一 42px 外壳(2026-11-16 用户口径「样式要统一」):
|
||||
这一行此前只有 .btn 有壳,两个原生 <select> 落成 28px 灰框、字号也不跟,
|
||||
与旁边按钮同排时高矮不齐。数值与 .form-group select / .btn 同一套(42px 高、
|
||||
9px 圆角、#cbd9e6 描边、#f8fbfd 底),箭头用内联 SVG 自绘,避免各浏览器原生
|
||||
箭头粗细不一(appearance:none 后必须补 padding-right 给箭头留位)。 */
|
||||
.jd-toolbar select {
|
||||
min-height: 42px;
|
||||
max-width: 220px;
|
||||
padding: 0 34px 0 12px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 9px;
|
||||
background-color: #f8fbfd;
|
||||
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%235b6f83' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
||||
background-repeat: no-repeat;
|
||||
background-position: right 12px center;
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
color: #24384d;
|
||||
font-family: inherit;
|
||||
font-size: 13.5px;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
|
||||
}
|
||||
.jd-toolbar select:hover {
|
||||
border-color: #9fb7cd;
|
||||
}
|
||||
.jd-toolbar select:focus {
|
||||
background-color: #ffffff;
|
||||
border-color: #5f85ad;
|
||||
box-shadow: 0 0 0 3px rgba(95, 133, 173, 0.16);
|
||||
}
|
||||
/* 危险动作(删除勾选)推到行尾:留在「店铺分类/分类筛选」旁边会被读成同一组动作。 */
|
||||
.jd-delete-btn {
|
||||
margin-left: auto;
|
||||
}
|
||||
/* 危险动作(删除勾选):与全站 .btn-danger 同形——实心红渐变+白字。
|
||||
@@ -156,10 +188,18 @@ h3 {
|
||||
font-size: 12.5px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
/* 只有一个可见分组时锁定的组名(不可切):与下拉同位置同字号,视觉上不跳。 */
|
||||
/* 只有一个可见分组时锁定的组名(不可切):做成与下拉同高的静态芯片,
|
||||
这样"一组锁定"和"多组下拉"两种形态占位一致,页面不跳。 */
|
||||
.jd-group-locked {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 42px;
|
||||
padding: 0 12px;
|
||||
border: 1px solid #dbe5ee;
|
||||
border-radius: 9px;
|
||||
background: #f1f6fb;
|
||||
color: #4e6479;
|
||||
font-size: 12.5px;
|
||||
font-size: 13.5px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.table-scroll {
|
||||
|
||||
+7
-1
@@ -213,7 +213,13 @@ public class JdCategoryScopeService {
|
||||
String groupName = group.getGroupName() == null ? "" : group.getGroupName().trim();
|
||||
String label = groupName;
|
||||
if (platformSuperAdmin) {
|
||||
String companyName = companyNames.get(group.getCompanyId());
|
||||
// 归属公司可为 NULL(V153 口径:组长账号已不存在、归属无从追溯),而 companyNames()
|
||||
// 在「一个公司 id 都取不到」时返回的是 Map.of()——对不可变空 Map 调 get(null) 会抛
|
||||
// NullPointerException(2026-11-16 22:00 线上实录:全空归属时整个京东数据库 500,
|
||||
// 列表/分类/scope 三端点同时挂)。故先判空再取,取不到就只显示组名。
|
||||
Long groupCompanyId = group.getCompanyId();
|
||||
String companyName = groupCompanyId == null || groupCompanyId <= 0
|
||||
? null : companyNames.get(groupCompanyId);
|
||||
label = companyName == null || companyName.isBlank()
|
||||
? groupName : companyName + " / " + groupName;
|
||||
}
|
||||
|
||||
+51
@@ -225,6 +225,49 @@ class JdCategoryScopeServiceTest {
|
||||
verify(adminUserMapper, org.mockito.Mockito.times(1)).selectById(anyLong());
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台超管 + 全部组的归属公司都是 NULL(V153 留下的存量形状:组长账号已不存在)。
|
||||
*
|
||||
* <p>2026-11-16 22:00 线上实录:这种数据的整页 500——{@code companyNames()} 在「一个公司 id
|
||||
* 都取不到」时返回 {@code Map.of()},`Map.of().get(null)` 抛 NullPointerException,
|
||||
* 列表/分类/scope 三个端点同时挂。判据:不炸、组名不加前缀、也不去查公司表。</p>
|
||||
*/
|
||||
@Test
|
||||
void 平台超管_组归属公司全为NULL时不炸且组名不带前缀() {
|
||||
AdminUserEntity operator = user(USER_ID, COMPANY_ID);
|
||||
when(adminAuthSupport.currentRole(operator)).thenReturn("super_admin");
|
||||
when(dataReadScope.isPlatformSuperAdmin(operator)).thenReturn(true);
|
||||
when(shopManageGroupMapper.selectAllGroups()).thenReturn(List.of(
|
||||
groupWithoutCompany(10L, "A组"), groupWithoutCompany(11L, "B组")));
|
||||
|
||||
JdCategoryScopeService.JdCategoryScope scope = service.resolve(operator);
|
||||
|
||||
assertThat(scope.visibleGroupIds()).containsExactly(10L, 11L);
|
||||
assertThat(scope.writableGroupIds()).containsExactly(10L, 11L);
|
||||
assertThat(scope.groups()).extracting(JdCategoryGroupOptionVo::getLabel)
|
||||
.containsExactly("A组", "B组");
|
||||
verify(companyMapper, never()).selectBatchIds(any());
|
||||
}
|
||||
|
||||
/** 部分组没归属公司(NULL)、部分有:有归属的带公司前缀,没归属的只显示组名。 */
|
||||
@Test
|
||||
void 平台超管_组归属公司部分为NULL时只给有归属的加前缀() {
|
||||
AdminUserEntity operator = user(USER_ID, COMPANY_ID);
|
||||
when(adminAuthSupport.currentRole(operator)).thenReturn("super_admin");
|
||||
when(dataReadScope.isPlatformSuperAdmin(operator)).thenReturn(true);
|
||||
when(shopManageGroupMapper.selectAllGroups()).thenReturn(List.of(
|
||||
group(10L, 1L, "A组"), groupWithoutCompany(11L, "B组")));
|
||||
CompanyEntity company = new CompanyEntity();
|
||||
company.setId(1L);
|
||||
company.setCompanyName("甲公司");
|
||||
when(companyMapper.selectBatchIds(any())).thenReturn(List.of(company));
|
||||
|
||||
JdCategoryScopeService.JdCategoryScope scope = service.resolve(operator);
|
||||
|
||||
assertThat(scope.groups()).extracting(JdCategoryGroupOptionVo::getLabel)
|
||||
.containsExactly("甲公司 / A组", "B组");
|
||||
}
|
||||
|
||||
@Test
|
||||
void scope回执_带平台超管标记与每组可写标记() {
|
||||
AdminUserEntity operator = user(USER_ID, COMPANY_ID);
|
||||
@@ -261,6 +304,14 @@ class JdCategoryScopeServiceTest {
|
||||
return group;
|
||||
}
|
||||
|
||||
/** 归属公司为 NULL 的组(V153 口径:组长账号已不存在,归属无从追溯)。 */
|
||||
private static ShopManageGroupEntity groupWithoutCompany(long id, String name) {
|
||||
ShopManageGroupEntity group = new ShopManageGroupEntity();
|
||||
group.setId(id);
|
||||
group.setGroupName(name);
|
||||
return group;
|
||||
}
|
||||
|
||||
/** 直接构作用域(跳过解析):可见组 / 可写组 / 下拉项三者按入参给。 */
|
||||
private static JdCategoryScopeService.JdCategoryScope scope(List<Long> visible, List<Long> writable,
|
||||
List<Long> optionGroupIds) {
|
||||
|
||||
Reference in New Issue
Block a user