|
|
@@ -21,7 +21,7 @@ use axum::response::Response;
|
|
|
use bos_api::extract::{json_err, json_err_data, json_ok, DataBody, RequireAuth};
|
|
|
use bos_api::AppState;
|
|
|
use bos_core::error::KltCode;
|
|
|
-use bos_core::{BosError, RoleCode};
|
|
|
+use bos_core::{reject_unknown_keys, BosError, RoleCode};
|
|
|
use bos_platform::audit::AuditEvent;
|
|
|
use bos_platform::clients::uds::{DmlStatement, UdsClient};
|
|
|
use bos_scope::{AuthContext, ScopedSelect};
|
|
|
@@ -495,19 +495,6 @@ fn require_period_opt(raw: Option<&str>) -> Result<Option<String>, BosError> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-/// F-N-02:拒未知检索键(与 CU 域 60004 白名单同口径)。
|
|
|
-fn reject_unknown_keys(extra: &HashMap<String, Value>) -> Result<(), BosError> {
|
|
|
- if extra.is_empty() {
|
|
|
- return Ok(());
|
|
|
- }
|
|
|
- let mut keys: Vec<&str> = extra.keys().map(String::as_str).collect();
|
|
|
- keys.sort_unstable();
|
|
|
- Err(BosError::bad_params(format!(
|
|
|
- "不支持的检索条件:{}(请去掉未知键后重试)",
|
|
|
- keys.join("/")
|
|
|
- )))
|
|
|
-}
|
|
|
-
|
|
|
/// 导出 CSV(带 BOM)→ OSS → 回执键。
|
|
|
async fn recon_upload_csv(
|
|
|
state: &AppState,
|
|
|
@@ -606,7 +593,7 @@ pub async fn share_param_summary(
|
|
|
DataBody(body): DataBody<ShareParamSummaryReq>,
|
|
|
) -> Response {
|
|
|
if let Err(e) = can_view(&auth) { return json_err(e); }
|
|
|
- if let Err(e) = reject_unknown_keys(&body.extra) { return json_err(e); }
|
|
|
+ if let Err(e) = reject_unknown_keys(body.extra.keys()) { return json_err(e); }
|
|
|
let holders = match body.holders {
|
|
|
None => return json_err(BosError::bad_params("holders 不能为空")),
|
|
|
Some(h) if h.is_empty() => return json_err(BosError::bad_params("holders 不能为空")),
|
|
|
@@ -1242,7 +1229,7 @@ async fn recon_list_body(
|
|
|
auth: &AuthContext,
|
|
|
req: &ReconListReq,
|
|
|
) -> Result<Value, BosError> {
|
|
|
- reject_unknown_keys(&req.extra)?;
|
|
|
+ reject_unknown_keys(req.extra.keys())?;
|
|
|
let period_opt = require_period_opt(req.period.as_deref())?;
|
|
|
let period = period_opt.as_deref();
|
|
|
let page = req.page.unwrap_or(0).max(0);
|
|
|
@@ -1428,7 +1415,7 @@ pub async fn recon_export_list(
|
|
|
if let Err(e) = auth.require_roles(&[RoleCode::Admin, RoleCode::OpsMain, RoleCode::OpsSub]) {
|
|
|
return json_err(e);
|
|
|
}
|
|
|
- if let Err(e) = reject_unknown_keys(&req.extra) {
|
|
|
+ if let Err(e) = reject_unknown_keys(req.extra.keys()) {
|
|
|
return json_err(e);
|
|
|
}
|
|
|
let period_opt = match require_period_opt(req.period.as_deref()) {
|
|
|
@@ -3048,7 +3035,7 @@ pub async fn bill_list(
|
|
|
DataBody(req): DataBody<BillListReq>,
|
|
|
) -> Response {
|
|
|
if let Err(e) = can_view(&auth) { return json_err(e); }
|
|
|
- if let Err(e) = reject_unknown_keys(&req.extra) { return json_err(e); }
|
|
|
+ if let Err(e) = reject_unknown_keys(req.extra.keys()) { return json_err(e); }
|
|
|
// 期次缺省=「全部期次」;非法 ⇒ 60004(BUG-26FN-11/F-N-02)。
|
|
|
let period = match require_period_opt(req.period.as_deref()) {
|
|
|
Ok(v) => v,
|
|
|
@@ -3781,7 +3768,7 @@ pub async fn correction_list(
|
|
|
DataBody(req): DataBody<CorrectionListReq>,
|
|
|
) -> Response {
|
|
|
if let Err(e) = can_view(&auth) { return json_err(e); }
|
|
|
- if let Err(e) = reject_unknown_keys(&req.extra) { return json_err(e); }
|
|
|
+ if let Err(e) = reject_unknown_keys(req.extra.keys()) { return json_err(e); }
|
|
|
let page = req.page.unwrap_or(0).max(0);
|
|
|
let size = req.page_size.unwrap_or(20).clamp(1, 100);
|
|
|
let offset = page * size;
|