|
|
@@ -246,8 +246,17 @@ class InstitutionService:
|
|
|
# 第6步:保存发放规则到本地
|
|
|
if issuerule_data and issue_rule_id:
|
|
|
from app.plugin.module_payment.expense.quota.model import QuotaModel
|
|
|
+ # 根据适用范围确定 employee_id
|
|
|
+ scope = (raw_data or {}).get("applicable_scope", "")
|
|
|
+ emp_id = "ALL"
|
|
|
+ if scope == "employee":
|
|
|
+ owner_ids = (raw_data or {}).get("scope_owner_id_list") or []
|
|
|
+ emp_id = owner_ids[0] if owner_ids else "ALL"
|
|
|
+ elif scope == "department":
|
|
|
+ dept_id = (raw_data or {}).get("department_id", "")
|
|
|
+ emp_id = f"DEPT:{dept_id}" if dept_id else "ALL"
|
|
|
quota_save_data = {
|
|
|
- "employee_id": "",
|
|
|
+ "employee_id": emp_id,
|
|
|
"institution_id": institution_id,
|
|
|
"out_biz_no": issuerule_data.get("outer_source_id", f"issue_{institution_id}"),
|
|
|
"quota_id": issue_rule_id,
|