feat(公司tab): 批次 2/3/4 再接 8 页,注册表收到 16 页——用户页回流 company_id 按新边界改写反向钉
「切 tab 数据还一样」的根因一直是分母小于现实:批次 1 只登记 8 页,本轮按控制方 三次点名扩到 16 页(company-scope.ts 是唯一清单,routes.ts 的 companyScoped 逐页对平)。 批次 2(五页 ASIN 中心):去重总数据 / 不符合ASIN / 查询ASIN / 最低价ASIN / 商品类目。 批次 3(两页店铺中心):撞款监控、店铺数据记录。这两页没有归属列可筛,归属口径是 「本公司账号名下的店铺」——后端由 DataReadScope 推公司 → 成员账号 → biz_shop_manage. created_by_id,前端只把 activeId 当 company_id 送下去。空成员集必须交空集合,绝不能 退化成 null(null 在这里=全量,那样第二家会看到全部数据)。 批次 4(用户管理):后端早就认 company_id(只对站点超管生效,公司超管恒锁本公司), 断的是前端——UserListQuery 里连这个字段都没有,三家 tab 看的是同一份全量列表。 三处口径改动,逐条说明: 1)company-user-list.test.ts 的反向钉被改写。2026-10-04 定案把公司维度从用户页整体摘掉, 那条钉的原文是「列表查询/筛选/行渲染不允许出现公司维度」。控制方 2026-10-05 明确要 用户管理区分公司 tab,所以钉的边界收窄成两半:渲染层(行级公司列、「所属公司」标签、 筛选状态、顶栏公司名)仍不得回流;请求层的 company_id 是这次加回来的,尺子换成 「取值口唯一」——页面每处 companyId 都必须等于 companyTab.requestCompanyId,且 normalizeUserPageParams/toUserListQuery 两只白名单构造器体内不许出现公司值。 新增一支行为钉:往归一化里传 companyId 必须被丢掉,这是 users.ts 读原始入参的全部理由 (写成 normalized.companyId 时 TS 照样绿、运行时恒 undefined)。 2)align-dup-console 那条 watch 看守的 token 扩到含 reload。变异自证里「删掉 void loadConsole()」当场全绿:体里的清筛选项守住了,重新取数那半没人守。批次 3/4 三对 token 一起写到 reload 为止(批次 1/2 的老条目不动)。 3)公司管理页补正/反向两把尺子:company-config-entry-super-only 新增「吃公司 tab 的页面 集合恰好等于 COMPANY_SCOPED_PAGES 的 pageFiles」——按代码真值比,不按清单比,所以 清单不改一字而往 CompaniesPage.vue 里塞 store 也会红。谓词带括号,否则 import 行也算消费者。 菜单权限(admin_columns)本轮不动:MenusPage 只消费 /api/admin/permission-menus 这一份全局 菜单字典,切 tab 一样是数据本身全局,不是筛选坏了。真问题在写侧——PermissionMenuService create/update/delete 只有 ensureAdminOperatorIfPresent(isAdmin 即放行),公司管理员改的是 全平台的菜单行。收窄为仅站点超管 vs 给 permission_menu 加归属列,两种改法代价差一个量级, 留给控制方定档。 护栏:G1 发送口 22 个 / 页面分组 17、watch 体看守 10 对、operation-guide 的 tab 文案 15 页 (撞款监控是显式豁免,另有一条自检盯「豁免落空」)。 变异自证 12/12 全杀(前端 10 + 公司管理反向钉 2),分母钉死在 27 例。 门禁:后端全量 3823 例 / 0 失败 / 0 错误 / 7 skipped,BUILD SUCCESS;admin-frontend-vue 1741 例 / 0 红;vue-tsc rc=0。首轮后端 4 红是另一路 task_partial 改动与本轮编译抢跑, 单跑 13 例已绿,本笔不含他们的任何文件。 未上线:jar 与 admin-vue 都没出包,V147 未在生产执行。
This commit is contained in:
@@ -44,12 +44,38 @@ public final class ExcelStreamReader {
|
||||
} else {
|
||||
EasyExcel.read(inputStream, listener).sheet(0).headRowNumber(1).doRead();
|
||||
}
|
||||
} catch (WrappedRuntimeException ex) {
|
||||
if (ex.getCause() instanceof IOException ioException) {
|
||||
} catch (RuntimeException ex) {
|
||||
// EasyExcel/POI 的解析异常是 RuntimeException,原样冒到接口层会变成 HTTP 500;
|
||||
// 本工具的契约是 IOException,调用方已按 IOException 给用户回 400。
|
||||
throw toContractException(listener.handlerFailure(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static IOException toContractException(Exception handlerFailure, RuntimeException readFailure) throws IOException {
|
||||
if (handlerFailure != null) {
|
||||
// 调用方自己抛的不算"文件坏了":运行时异常原样透传,保住 BusinessException 的 400 语义。
|
||||
if (handlerFailure instanceof IOException ioException) {
|
||||
throw ioException;
|
||||
}
|
||||
throw ex;
|
||||
if (handlerFailure instanceof RuntimeException runtimeException) {
|
||||
throw runtimeException;
|
||||
}
|
||||
throw new IOException("Excel 行处理失败:" + describe(handlerFailure), handlerFailure);
|
||||
}
|
||||
throw new IOException("Excel 解析失败:" + describe(readFailure), readFailure);
|
||||
}
|
||||
|
||||
private static String describe(Throwable ex) {
|
||||
Throwable deepest = ex;
|
||||
String message = ex.getMessage();
|
||||
while (deepest.getCause() != null) {
|
||||
deepest = deepest.getCause();
|
||||
String current = deepest.getMessage();
|
||||
if (current != null && !current.isBlank()) {
|
||||
message = current;
|
||||
}
|
||||
}
|
||||
return message == null || message.isBlank() ? ex.getClass().getSimpleName() : message;
|
||||
}
|
||||
|
||||
public interface SheetRowHandler {
|
||||
@@ -70,11 +96,27 @@ public final class ExcelStreamReader {
|
||||
|
||||
private final SheetRowHandler handler;
|
||||
private Map<Integer, String> currentHeaderMap = Map.of();
|
||||
private Exception handlerFailure;
|
||||
|
||||
private StreamingListener(SheetRowHandler handler) {
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
private Exception handlerFailure() {
|
||||
return handlerFailure;
|
||||
}
|
||||
|
||||
/** 记下调用方抛出的异常,好让 runRead 分得清「文件解析坏了」和「行处理被调用方拒了」。 */
|
||||
private RuntimeException recordHandlerFailure(Exception ex) {
|
||||
if (handlerFailure == null) {
|
||||
handlerFailure = ex;
|
||||
}
|
||||
if (ex instanceof RuntimeException runtimeException) {
|
||||
return runtimeException;
|
||||
}
|
||||
return new WrappedRuntimeException(ex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
|
||||
Map<Integer, String> normalizedHeadMap = new LinkedHashMap<>();
|
||||
@@ -85,10 +127,8 @@ public final class ExcelStreamReader {
|
||||
try {
|
||||
handler.onHeader(sheetName(context), sheetNo(context), currentHeaderMap);
|
||||
handler.onSheetTotal(sheetName(context), sheetNo(context), approximateTotalRows(context));
|
||||
} catch (RuntimeException ex) {
|
||||
throw ex;
|
||||
} catch (Exception ex) {
|
||||
throw new WrappedRuntimeException(ex);
|
||||
throw recordHandlerFailure(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,10 +146,8 @@ public final class ExcelStreamReader {
|
||||
currentHeaderMap,
|
||||
normalizedRow
|
||||
);
|
||||
} catch (RuntimeException ex) {
|
||||
throw ex;
|
||||
} catch (Exception ex) {
|
||||
throw new WrappedRuntimeException(ex);
|
||||
throw recordHandlerFailure(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user