提交
This commit is contained in:
1 parent
5ad07c8cac
commit
a79aee2614
61 files changed
+9220
-9348
No files matched your search
@@ -4,8 +4,8 @@ DATABASE_URL=mysql+pymysql://root:password@localhost:3306/zkxw
|
||||
|
||||
# 与 sys_user.tenant_no 一致;登录按 (tenant_no, user_no) 查用户
|
||||
# DEFAULT_TENANT_NO=zkxw
|
||||
# 用户无 sys_user_role 记录时,Web 管理端 JWT 使用的默认角色(super_admin 可全量菜单)
|
||||
# WEB_AUTH_DEFAULT_ROLE=super_admin
|
||||
# 已废弃:无角色用户不可登录,JWT role 固定为 guest(勿设为 super_admin)
|
||||
# WEB_AUTH_DEFAULT_ROLE=guest
|
||||
|
||||
# JWT配置示例
|
||||
# SECRET_KEY=your-secret-key-change-in-production
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
41962
|
||||
86521
|
||||
@@ -29,7 +29,11 @@ from app.models.models import SysUser
|
||||
from app.crud.user import user_crud
|
||||
from app.core.utils import generate_uuid
|
||||
from app.core import login_crypto
|
||||
from app.services.web_auth_roles import iter_user_menu_perm_codes, resolve_web_role_for_user
|
||||
from app.services.web_auth_roles import (
|
||||
iter_user_menu_perm_codes,
|
||||
resolve_web_role_for_user,
|
||||
user_has_active_roles,
|
||||
)
|
||||
from app.schemas.auth import ProfileUpdateRequest
|
||||
from app.crud.user import update_user, change_password
|
||||
|
||||
@@ -134,6 +138,9 @@ async def web_login(
|
||||
if user.status != "1":
|
||||
return error_response(403, "账号已被停用,请联系管理员")
|
||||
|
||||
if not user_has_active_roles(db, user.id):
|
||||
return error_response(403, "账号未分配角色,请联系管理员")
|
||||
|
||||
web_role = resolve_web_role_for_user(db, user.id)
|
||||
|
||||
session_id = generate_uuid()
|
||||
|
||||
@@ -102,8 +102,8 @@ class Settings(BaseSettings):
|
||||
|
||||
# 与 docs/sql/zkxw.sql 基线一致:登录按租户 + sys_user.user_no
|
||||
DEFAULT_TENANT_NO: str = "zkxw"
|
||||
# 用户未绑定 sys_user_role 时,Web 管理端默认角色(建议 super_admin 便于开发全菜单)
|
||||
WEB_AUTH_DEFAULT_ROLE: str = "super_admin"
|
||||
# 已废弃:无角色用户固定为 guest,不可通过环境变量提升为 super_admin
|
||||
WEB_AUTH_DEFAULT_ROLE: str = "guest"
|
||||
|
||||
# 登录 RSA:私钥 PEM(多实例/负载均衡须配置同一私钥;留空则进程启动时临时生成,仅适合单机开发)
|
||||
LOGIN_RSA_PRIVATE_KEY_PEM: str = ""
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_backend_app_api_public_py", "label": "public.py", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L1"}, {"id": "api_public_avatar_url_field", "label": "_avatar_url_field()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L43"}, {"id": "api_public_build_user_info_payload", "label": "_build_user_info_payload()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L52"}, {"id": "api_public_build_current_user_payload", "label": "_build_current_user_payload()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L70"}, {"id": "api_public_resolve_current_user_from_request", "label": "_resolve_current_user_from_request()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L92"}, {"id": "api_public_jwt_user_payload", "label": "_jwt_user_payload()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L100"}, {"id": "api_public_web_login_rsa_public_key", "label": "web_login_rsa_public_key()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L111"}, {"id": "api_public_web_login", "label": "web_login()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L118"}, {"id": "api_public_refresh_token", "label": "refresh_token()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L179"}, {"id": "api_public_logout", "label": "logout()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L241"}, {"id": "api_public_get_current_user_profile", "label": "get_current_user_profile()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L260"}, {"id": "api_public_update_current_user_profile", "label": "update_current_user_profile()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L270"}, {"id": "api_public_change_current_user_password", "label": "change_current_user_password()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L306"}, {"id": "api_public_upload_current_user_avatar", "label": "upload_current_user_avatar()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L338"}, {"id": "api_public_get_web_auth_menu_codes", "label": "get_web_auth_menu_codes()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L375"}, {"id": "api_public_rationale_1", "label": "\u516c\u5171\u63a5\u53e3\uff08Web \u767b\u5f55\u3001\u5237\u65b0 Token\u3001\u767b\u51fa\uff1b\u7528\u6237\u6a21\u578b\u5bf9\u9f50 docs/sql/zkxw.sql \u57fa\u7ebf\uff09", "file_type": "rationale", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L1"}, {"id": "api_public_rationale_44", "label": "\u8fd4\u56de\u5e93\u4e2d\u539f\u59cb\u5934\u50cf\u8def\u5f84\uff0c\u7531\u524d\u7aef\u6309 VITE_MINIO_BASE_URL \u62fc\u5c55\u793a URL\u3002", "file_type": "rationale", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L44"}, {"id": "api_public_rationale_53", "label": "\u4e0e web-admin `userInfo` \u5b57\u6bb5\u7ea6\u5b9a\u4e00\u81f4\u3002", "file_type": "rationale", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L53"}, {"id": "api_public_rationale_71", "label": "\u7ec4\u88c5 current-user \u63a5\u53e3\u54cd\u5e94\u3002", "file_type": "rationale", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L71"}, {"id": "api_public_rationale_112", "label": "Web \u7aef\u767b\u5f55\u7528 RSA \u516c\u94a5\uff08PKCS#1 v1.5\uff0c\u4e0e JSEncrypt \u4e00\u81f4\uff09", "file_type": "rationale", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L112"}, {"id": "api_public_rationale_123", "label": "Web \u7aef\u767b\u5f55\uff1a\u8d26\u53f7\u4e3a sys_user.user_no\uff0c\u5bc6\u7801\u4e3a sys_user.password\uff08bcrypt\uff09\u3002", "file_type": "rationale", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py", "source_location": "L123"}, {"id": "api_public_rationale_242", "label": "\u767b\u51fa\uff1a\u540a\u9500 Redis \u4f1a\u8bdd\uff08\u82e5\u5df2\u914d\u7f6e REDIS_HOST\uff09\u3002", "file_type": "rationale",Line truncated
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_backend_app_services_web_auth_roles_py", "label": "web_auth_roles.py", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py", "source_location": "L1"}, {"id": "services_web_auth_roles_map_role_name_to_web", "label": "_map_role_name_to_web()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py", "source_location": "L19"}, {"id": "services_web_auth_roles_active_role_name_rows", "label": "_active_role_name_rows()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py", "source_location": "L31"}, {"id": "services_web_auth_roles_user_has_active_roles", "label": "user_has_active_roles()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py", "source_location": "L53"}, {"id": "services_web_auth_roles_resolve_web_role_for_user", "label": "resolve_web_role_for_user()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py", "source_location": "L58"}, {"id": "services_web_auth_roles_iter_user_menu_perm_codes", "label": "iter_user_menu_perm_codes()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py", "source_location": "L69"}, {"id": "services_web_auth_roles_rationale_1", "label": "Web \u7ba1\u7406\u7aef\u767b\u5f55\uff1a\u57fa\u4e8e V0.3 sys_user / sys_user_role / sys_role \u7684\u89d2\u8272\u4e0e\u83dc\u5355\u6743\u9650\u89e3\u6790", "file_type": "rationale", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py", "source_location": "L1"}, {"id": "services_web_auth_roles_rationale_20", "label": "\u5c06 sys_role.role_name \u6620\u5c04\u4e3a web-admin \u4f7f\u7528\u7684 role \u5b57\u7b26\u4e32\u3002", "file_type": "rationale", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py", "source_location": "L20"}, {"id": "services_web_auth_roles_rationale_32", "label": "\u67e5\u8be2\u7528\u6237\u5f53\u524d\u6709\u6548\u7684 sys_role.role_name \u5217\u8868\u3002", "file_type": "rationale", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py", "source_location": "L32"}, {"id": "services_web_auth_roles_rationale_54", "label": "\u7528\u6237\u662f\u5426\u81f3\u5c11\u7ed1\u5b9a\u4e00\u4e2a\u6709\u6548\u89d2\u8272\uff08sys_user_role \u2192 sys_role\uff09\u3002", "file_type": "rationale", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py", "source_location": "L54"}, {"id": "services_web_auth_roles_rationale_59", "label": "\u6839\u636e\u7528\u6237\u5173\u8054\u89d2\u8272\u89e3\u6790 Web \u7aef role\uff08admin / super_admin / guest\uff09\u3002", "file_type": "rationale", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py", "source_location": "L59"}, {"id": "services_web_auth_roles_rationale_70", "label": "\u7528\u6237\u901a\u8fc7\u89d2\u8272\u5173\u8054\u5f97\u5230\u7684\u83dc\u5355\u6743\u9650\u6807\u8bc6\uff08sys_menu.perms\uff0c\u7a7a\u5219\u9000\u56de\u83dc\u5355 id\uff09\u3002 \u6ce8\uff1a\u4e00\u7ea7\u83dc\u5355\uff08market\u3001production\u3001quali", "file_type": "rationale", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py", "source_location": "L70"}], "edges": [{"source": "users_wuzilong_work_00code_zkxw_backend_app_services_web_auth_roles_py", "target": "typing", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py", "source_location": "L4", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_backend_app_services_web_auth_roles_py", "target": "sqlalchemy", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py", "source_location": "L6", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_backend_app_services_web_auth_roles_py", "target": "sqlalchemy_orm", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py", "source_location": "L7", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_backend_app_services_web_auth_roles_py", "target": "app_core_config", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py", "source_location": "L9", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_backend_app_services_web_auth_roles_py", "target": "app_models_models", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py", "source_location": "L10", "weight": 1.0}Line truncated
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_backend_app_crud_storage_facility_py", "label": "storage_facility.py", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L1"}, {"id": "crud_storage_facility_row_to_dict", "label": "_row_to_dict()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L28"}, {"id": "crud_storage_facility_list_all_facilities", "label": "list_all_facilities()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L44"}, {"id": "crud_storage_facility_get_facility", "label": "get_facility()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L67"}, {"id": "crud_storage_facility_get_children", "label": "get_children()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L76"}, {"id": "crud_storage_facility_collect_descendant_ids", "label": "collect_descendant_ids()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L92"}, {"id": "crud_storage_facility_create_facility", "label": "create_facility()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L105"}, {"id": "crud_storage_facility_update_facility", "label": "update_facility()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L149"}, {"id": "crud_storage_facility_soft_delete_facility", "label": "soft_delete_facility()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L207"}, {"id": "crud_storage_facility_slot_to_dict", "label": "_slot_to_dict()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L233"}, {"id": "crud_storage_facility_list_slots", "label": "list_slots()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L256"}, {"id": "crud_storage_facility_get_slot", "label": "get_slot()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L275"}, {"id": "crud_storage_facility_slot_to_dict_for_row", "label": "_slot_to_dict_for_row()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L284"}, {"id": "crud_storage_facility_create_slot", "label": "create_slot()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L289"}, {"id": "crud_storage_facility_update_slot", "label": "update_slot()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L324"}, {"id": "crud_storage_facility_soft_delete_slot", "label": "soft_delete_slot()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L360"}, {"id": "crud_storage_facility_clear_slots_by_facility_node", "label": "clear_slots_by_facility_node()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L370"}, {"id": "crud_storage_facility_batch_create_slots", "label": "batch_create_slots()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L402"}, {"id": "crud_storage_facility_insert_row_and_shift_slots", "label": "insert_row_and_shift_slots()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L455"}, {"id": "crud_storage_facility_rationale_1", "label": "\u5b58\u50a8\u8bbe\u65bd\uff08\u6811\u7ed3\u6784\uff09+ \u5c0f\u683c CRUD\uff08biz_storage_facility / biz_storage_facility_slot\uff09", "file_type": "rationale", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L1"}, {"id": "crud_storage_facility_rationale_50", "label": "Return FLAT list of all non-deleted facility nodes (no pagination, no tree build", "file_type": "rationale", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L50"}, {"id": "crud_storage_facility_rationale_77", "label": "Direct children of a node.", "file_type": "rationale", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py", "source_location": "L77"}, {"id": "Line truncated
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_backend_app_core_config_py", "label": "config.py", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/core/config.py", "source_location": "L1"}, {"id": "core_config_settings", "label": "Settings", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/core/config.py", "source_location": "L7"}, {"id": "basesettings", "label": "BaseSettings", "file_type": "code", "source_file": "", "source_location": ""}, {"id": "core_config_config", "label": "Config", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/core/config.py", "source_location": "L145"}], "edges": [{"source": "users_wuzilong_work_00code_zkxw_backend_app_core_config_py", "target": "pydantic_settings", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/core/config.py", "source_location": "L1", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_backend_app_core_config_py", "target": "typing", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/core/config.py", "source_location": "L2", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_backend_app_core_config_py", "target": "pathlib", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/core/config.py", "source_location": "L3", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_backend_app_core_config_py", "target": "os", "relation": "imports", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/core/config.py", "source_location": "L4", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_backend_app_core_config_py", "target": "core_config_settings", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/core/config.py", "source_location": "L7", "weight": 1.0}, {"source": "core_config_settings", "target": "basesettings", "relation": "inherits", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/core/config.py", "source_location": "L7", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_backend_app_core_config_py", "target": "core_config_config", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/backend/app/core/config.py", "source_location": "L145", "weight": 1.0}], "raw_calls": []}
|
||||
@@ -9,6 +9,9 @@ from sqlalchemy.orm import Session
|
||||
from app.core.config import settings
|
||||
from app.models.models import SysMenu, SysRole, SysRoleMenu, SysUserRole
|
||||
|
||||
# 无 sys_user_role 绑定时的 Web 端角色(不可为 super_admin,避免越权)
|
||||
NO_ROLE_WEB_ROLE = "guest"
|
||||
|
||||
# 一级菜单权限码(用于顶部菜单权限控制)
|
||||
TOP_MENU_PERMS = frozenset({"menu:market", "menu:production", "menu:quality", "menu:operations", "menu:system-manage"})
|
||||
|
||||
@@ -25,10 +28,10 @@ def _map_role_name_to_web(role_name: str) -> str:
|
||||
return "admin"
|
||||
|
||||
|
||||
def resolve_web_role_for_user(db: Session, user_id: str) -> str:
|
||||
"""根据用户关联角色解析 Web 端 role(admin / super_admin)。"""
|
||||
def _active_role_name_rows(db: Session, user_id: str):
|
||||
"""查询用户当前有效的 sys_role.role_name 列表。"""
|
||||
if not user_id:
|
||||
return settings.WEB_AUTH_DEFAULT_ROLE
|
||||
return []
|
||||
tenant = settings.DEFAULT_TENANT_NO
|
||||
rows = (
|
||||
db.query(SysRole.role_name)
|
||||
@@ -44,9 +47,19 @@ def resolve_web_role_for_user(db: Session, user_id: str) -> str:
|
||||
.order_by(SysRole.create_time.desc())
|
||||
.all()
|
||||
)
|
||||
names = [str(r[0]).strip() for r in rows if r and r[0]]
|
||||
return [str(r[0]).strip() for r in rows if r and r[0]]
|
||||
|
||||
|
||||
def user_has_active_roles(db: Session, user_id: str) -> bool:
|
||||
"""用户是否至少绑定一个有效角色(sys_user_role → sys_role)。"""
|
||||
return bool(_active_role_name_rows(db, user_id))
|
||||
|
||||
|
||||
def resolve_web_role_for_user(db: Session, user_id: str) -> str:
|
||||
"""根据用户关联角色解析 Web 端 role(admin / super_admin / guest)。"""
|
||||
names = _active_role_name_rows(db, user_id)
|
||||
if not names:
|
||||
return settings.WEB_AUTH_DEFAULT_ROLE
|
||||
return NO_ROLE_WEB_ROLE
|
||||
mapped = [_map_role_name_to_web(n) for n in names]
|
||||
if "super_admin" in mapped:
|
||||
return "super_admin"
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,11 +1,11 @@
|
||||
# Graph Report - app (2026-06-13)
|
||||
|
||||
## Corpus Check
|
||||
- Large corpus: 205 files · ~231,443 words. Semantic extraction will be expensive (many Claude tokens). Consider running on a subfolder, or use --no-semantic to run AST-only.
|
||||
- Large corpus: 205 files · ~231,501 words. Semantic extraction will be expensive (many Claude tokens). Consider running on a subfolder, or use --no-semantic to run AST-only.
|
||||
|
||||
## Summary
|
||||
- 4023 nodes · 20953 edges · 55 communities detected
|
||||
- Extraction: 33% EXTRACTED · 67% INFERRED · 0% AMBIGUOUS · INFERRED: 14077 edges (avg confidence: 0.6)
|
||||
- 4027 nodes · 20969 edges · 55 communities detected
|
||||
- Extraction: 33% EXTRACTED · 67% INFERRED · 0% AMBIGUOUS · INFERRED: 14087 edges (avg confidence: 0.6)
|
||||
- Token cost: 0 input · 0 output
|
||||
|
||||
## Community Hubs (Navigation)
|
||||
@@ -82,179 +82,179 @@
|
||||
core/api_request_log_middleware.py → models/models.py
|
||||
- `get_menu_list()` --calls--> `success_response()` [INFERRED]
|
||||
api/menu.py → core/response.py
|
||||
- `中试服务体检管理 API(体检信息、预约项目、实际项目)` --uses--> `SysUser` [INFERRED]
|
||||
api/pilot_checkup.py → models/models.py
|
||||
- `保留匹配节点及其全部上级,供关键词检索后仍能正确组树。` --uses--> `SysDept` [INFERRED]
|
||||
crud/dept.py → models/models.py
|
||||
- `物品单位 CRUD(biz_item_unit)` --uses--> `BizItemUnit` [INFERRED]
|
||||
crud/item_unit.py → models/models.py
|
||||
- `快递公司 CRUD(biz_express_company)` --uses--> `BizExpressCompany` [INFERRED]
|
||||
crud/express_company.py → models/models.py
|
||||
|
||||
## Communities
|
||||
|
||||
### Community 0 - "Community 0"
|
||||
Cohesion: 0.01
|
||||
Nodes (768): attachment_download_url(), create_dept(), create_dict_data(), create_dict_type(), create_express_company(), create_item_unit(), create_menu(), create_post() (+760 more)
|
||||
Nodes (796): attachment_download_url(), create_dept(), create_dict_data(), create_dict_type(), create_express_company(), create_item_unit(), create_menu(), create_post() (+788 more)
|
||||
|
||||
### Community 1 - "Community 1"
|
||||
Cohesion: 0.01
|
||||
Nodes (528): AttachmentDownloadUrlBody, DeptCreateBody, DeptUpdateBody, DictDataCreateBody, DictDataUpdateBody, DictTypeCreateBody, DictTypeUpdateBody, ExpressCompanyCreateBody (+520 more)
|
||||
Nodes (570): AttachmentDownloadUrlBody, DeptCreateBody, DeptUpdateBody, DictDataCreateBody, DictDataUpdateBody, DictTypeCreateBody, DictTypeUpdateBody, ExpressCompanyCreateBody (+562 more)
|
||||
|
||||
### Community 2 - "Community 2"
|
||||
Cohesion: 0.09
|
||||
Nodes (332): 环境检测 — 检测项维护 + 登记管理 API, 保险公司及险种价格管理 API(保险公司 + 开票信息 + 险种价格), AccessLogCreateBody, AccessLogUpdateBody, CleanRoomCreateBody, CleanRoomUpdateBody, ExhibitionAppointmentCreateBody, ExhibitionAppointmentUpdateBody (+324 more)
|
||||
Cohesion: 0.08
|
||||
Nodes (370): 环境检测 — 检测项维护 + 登记管理 API, 保险公司及险种价格管理 API(保险公司 + 开票信息 + 险种价格), AccessLogCreateBody, AccessLogUpdateBody, CleanRoomCreateBody, CleanRoomUpdateBody, ExhibitionAppointmentCreateBody, ExhibitionAppointmentUpdateBody (+362 more)
|
||||
|
||||
### Community 3 - "Community 3"
|
||||
Cohesion: 0.02
|
||||
Nodes (223): _persist_protocol_sub_resources(), list_ethnics_for_select(), list_access_logs(), list_uv_disinfect_logs(), apply_data_scope(), _get_child_dept_ids(), get_user_dept_id(), _resolve_user_role_scopes() (+215 more)
|
||||
Cohesion: 0.01
|
||||
Nodes (231): _ensure_customer_for_mother(), _persist_protocol_sub_resources(), list_ethnics_for_select(), apply_data_scope(), _get_child_dept_ids(), get_user_dept_id(), _resolve_user_role_scopes(), format_date() (+223 more)
|
||||
|
||||
### Community 4 - "Community 4"
|
||||
Cohesion: 0.02
|
||||
Nodes (234): generate_uuid(), create_collection_region(), create_hospital(), get_collection_region(), get_hospital(), _hospital_to_dict(), list_hospitals(), soft_delete_collection_region() (+226 more)
|
||||
Nodes (226): eq_unicode(), like_unicode(), MySQL 字符串比较/模糊匹配时统一排序规则,避免 Illegal mix of collations。, 跨表字符串等值比较(JOIN / WHERE)时统一为 utf8mb4_unicode_ci。, 将列显式设为 utf8mb4_unicode_ci。, unicode_ci(), _format_attachment_file_size(), urls_to_attachment_list() (+218 more)
|
||||
|
||||
### Community 5 - "Community 5"
|
||||
Cohesion: 0.02
|
||||
Nodes (219): eq_unicode(), like_unicode(), MySQL 字符串比较/模糊匹配时统一排序规则,避免 Illegal mix of collations。, 跨表字符串等值比较(JOIN / WHERE)时统一为 utf8mb4_unicode_ci。, 将列显式设为 utf8mb4_unicode_ci。, unicode_ci(), _format_attachment_file_size(), urls_to_attachment_list() (+211 more)
|
||||
Cohesion: 0.04
|
||||
Nodes (216): generate_uuid(), batch_stock_in(), batch_stock_out(), consumable_code_exists(), create_consumable(), _dec(), get_consumable(), _is_enabled_status() (+208 more)
|
||||
|
||||
### Community 6 - "Community 6"
|
||||
Cohesion: 0.07
|
||||
Nodes (223): CellSampleTypeCreateBody, CellSampleTypeUpdateBody, CollectionRegionCreateBody, CollectionRegionUpdateBody, CustomerCreateBody, CustomerUpdateBody, HospitalCreateBody, HospitalUpdateBody (+215 more)
|
||||
Cohesion: 0.05
|
||||
Nodes (196): CellSampleTypeCreateBody, CellSampleTypeUpdateBody, CollectionRegionCreateBody, CollectionRegionUpdateBody, CustomerCreateBody, CustomerUpdateBody, HospitalCreateBody, HospitalUpdateBody (+188 more)
|
||||
|
||||
### Community 7 - "Community 7"
|
||||
Cohesion: 0.02
|
||||
Nodes (183): api_save_application(), api_get_checkup_detail(), get_protocol_nos_used_in_protocols(), create_dict_type(), dict_type_code_exists(), get_dict_type(), list_dict_types(), 字典类型 CRUD(sys_dict_type) (+175 more)
|
||||
Nodes (113): get_designer_data(), _error_json(), lifespan(), 数据库异常:返回 JSON 并保留 CORS 头,避免浏览器只报跨域错误, 未捕获异常:统一 JSON 500,确保跨域场景下仍有 Access-Control-Allow-Origin, sqlalchemy_exception_handler(), unhandled_exception_handler(), BaseHTTPMiddleware (+105 more)
|
||||
|
||||
### Community 8 - "Community 8"
|
||||
Cohesion: 0.03
|
||||
Nodes (170): _code_exists(), create_material(), _dec(), _fmt_dt(), get_material(), get_material_entity(), _is_enabled_status(), list_materials() (+162 more)
|
||||
Cohesion: 0.02
|
||||
Nodes (165): api_save_application(), get_protocol_nos_used_in_protocols(), create_dict_type(), dict_type_code_exists(), get_dict_type(), list_dict_types(), 字典类型 CRUD(sys_dict_type), _row_to_dict() (+157 more)
|
||||
|
||||
### Community 9 - "Community 9"
|
||||
Cohesion: 0.02
|
||||
Nodes (109): get_designer_data(), _error_json(), 数据库异常:返回 JSON 并保留 CORS 头,避免浏览器只报跨域错误, 未捕获异常:统一 JSON 500,确保跨域场景下仍有 Access-Control-Allow-Origin, sqlalchemy_exception_handler(), unhandled_exception_handler(), BaseHTTPMiddleware, ApiCryptoError (+101 more)
|
||||
Cohesion: 0.03
|
||||
Nodes (143): batch_discard(), batch_options(), _batch_row_to_dict(), batch_stock_in(), batch_stock_out(), _create_batch_and_usage(), delete_batch(), _discard_batch() (+135 more)
|
||||
|
||||
### Community 10 - "Community 10"
|
||||
Cohesion: 0.03
|
||||
Nodes (99): _avatar_url_field(), _build_current_user_payload(), _build_user_info_payload(), get_current_user_profile(), get_web_auth_menu_codes(), _jwt_user_payload(), logout(), 公共接口(Web 登录、刷新 Token、登出;用户模型对齐 docs/sql/zkxw.sql 基线) (+91 more)
|
||||
Nodes (98): _avatar_url_field(), _build_current_user_payload(), _build_user_info_payload(), get_current_user_profile(), get_web_auth_menu_codes(), _jwt_user_payload(), logout(), 公共接口(Web 登录、刷新 Token、登出;用户模型对齐 docs/sql/zkxw.sql 基线) (+90 more)
|
||||
|
||||
### Community 11 - "Community 11"
|
||||
Cohesion: 0.04
|
||||
Nodes (93): get_next_cell_product_code(), _ancestor_link_from_cell_product_input(), _ancestor_sample_chain_link(), _apply_cell_product_status_change(), _build_ancestor_chain(), _build_descendant_chain(), _build_facility_path_label(), build_split_product_codes() (+85 more)
|
||||
Nodes (99): get_next_cell_product_code(), _ancestor_link_from_cell_product_input(), _ancestor_sample_chain_link(), _apply_cell_product_status_change(), _build_ancestor_chain(), _build_descendant_chain(), _build_facility_path_label(), build_split_product_codes() (+91 more)
|
||||
|
||||
### Community 12 - "Community 12"
|
||||
Cohesion: 0.36
|
||||
Nodes (66): BatchStockInBody, BatchStockInItem, BatchStockOutBody, BatchStockOutItem, ConsumableCreateBody, ConsumablePackCreateBody, ConsumablePackUpdateBody, ConsumableUpdateBody (+58 more)
|
||||
|
||||
### Community 13 - "Community 13"
|
||||
Cohesion: 0.09
|
||||
Nodes (48): allocate_next_biz_no(), _format_biz_no(), _prefix_for(), 业务协议号自动生成:XBCC / JZCC + YYYYMMDD + 6 位序号, 原子分配下一个业务协议号。 须在 create 事务内调用;使用 MySQL LAST_INSERT_ID 保证并发安全。, create_collection_protocol(), _active_link_query(), assert_biz_no_available() (+40 more)
|
||||
|
||||
### Community 14 - "Community 14"
|
||||
Cohesion: 0.09
|
||||
Nodes (45): batch_stock_in(), batch_stock_out(), code_exists(), create_material(), _dec(), _filter_material_type(), _fmt_dt(), get_material() (+37 more)
|
||||
|
||||
### Community 15 - "Community 15"
|
||||
### Community 13 - "Community 13"
|
||||
Cohesion: 0.11
|
||||
Nodes (35): batch_create_sterilize_logs(), batch_create_wash_logs(), batch_discard_garments(), batch_soft_delete_garments(), _count_map(), create_garment(), create_sterilize_log(), create_wash_log() (+27 more)
|
||||
|
||||
### Community 16 - "Community 16"
|
||||
### Community 14 - "Community 14"
|
||||
Cohesion: 0.12
|
||||
Nodes (10): get_wechat_pay_client(), get_wechat_pay_v2(), 微信支付工具模块 支持微信支付 V3 API 文档参考: https://pay.weixin.qq.com/docs/v3/apis/index.ht, 统一下单接口 (V3) Args: out_trade_no: 商户订单号 total, 小程序调起支付的二次签名参数(与公众号 JSAPI 规则一致), 统一下单 (V2 API) Args: out_trade_no: 商户订单号 tot, 生成签名 V3 (SHA256 with RSA), wechat_pay() (+2 more)
|
||||
Nodes (11): get_wechat_pay_client(), get_wechat_pay_v2(), 微信支付工具模块 支持微信支付 V3 API 文档参考: https://pay.weixin.qq.com/docs/v3/apis/index.ht, 统一下单接口 (V3) Args: out_trade_no: 商户订单号 total, 申请退款 Args: out_trade_no: 商户订单号 total_amount, 小程序调起支付的二次签名参数(与公众号 JSAPI 规则一致), 统一下单 (V2 API) Args: out_trade_no: 商户订单号 tot, 生成签名 V3 (SHA256 with RSA) (+3 more)
|
||||
|
||||
### Community 15 - "Community 15"
|
||||
Cohesion: 0.16
|
||||
Nodes (27): set_current_process_route(), add_step(), copy_step(), create_route(), _create_step_consumable(), _create_step_data_collection(), _create_step_output(), _create_step_reagent() (+19 more)
|
||||
|
||||
### Community 16 - "Community 16"
|
||||
Cohesion: 0.21
|
||||
Nodes (23): _amount_for_row(), _batch_map(), deduct_for_task(), _deduct_task_usage_legacy_batch(), _display_remark(), list_linked_task_usages(), list_my_usages(), list_requisition_options() (+15 more)
|
||||
|
||||
### Community 17 - "Community 17"
|
||||
Cohesion: 0.18
|
||||
Nodes (18): company_code_exists(), create_company(), get_company(), list_companies(), list_company_options(), _row_to_dict(), soft_delete_company(), update_company() (+10 more)
|
||||
Cohesion: 0.15
|
||||
Nodes (20): _access_log_to_dict(), _calc_duration_minutes(), create_access_log(), create_clean_room(), create_uv_disinfect_log(), get_access_log(), get_clean_room(), get_uv_disinfect_log() (+12 more)
|
||||
|
||||
### Community 18 - "Community 18"
|
||||
Cohesion: 0.21
|
||||
Nodes (15): batch_generate_protocol_nos(), batch_issue_protocol_nos(), batch_revoke_protocol_nos(), create_protocol_no(), get_protocol_no(), list_protocol_nos(), _parse_issued_time(), protocol_no_exists() (+7 more)
|
||||
Nodes (19): _consumable_row_to_dict(), create_process(), _create_sub_consumable(), _create_sub_data_collection(), _create_sub_output(), _create_sub_reagent(), _data_collection_row_to_dict(), get_process() (+11 more)
|
||||
|
||||
### Community 19 - "Community 19"
|
||||
Cohesion: 0.18
|
||||
Nodes (18): company_code_exists(), create_company(), get_company(), list_companies(), list_company_options(), _row_to_dict(), soft_delete_company(), update_company() (+10 more)
|
||||
|
||||
### Community 20 - "Community 20"
|
||||
Cohesion: 0.29
|
||||
Nodes (14): _amount_for_row(), _batch_map(), _display_remark(), list_usages(), _list_usages_query(), _paginate_usages(), _parse_receiver_purpose_from_remark(), _receiver_display_map() (+6 more)
|
||||
|
||||
### Community 20 - "Community 20"
|
||||
Cohesion: 0.25
|
||||
Nodes (12): batch_generate_sample_codes(), batch_issue_sample_codes(), batch_revoke_sample_codes(), create_sample_code(), get_sample_code(), _parse_issued_time(), 样本编码池 CRUD(biz_sample_code), 批量生成样本编码: 类型前缀 + 中间段 + 补零序号 (+4 more)
|
||||
|
||||
### Community 21 - "Community 21"
|
||||
Cohesion: 0.28
|
||||
Nodes (14): _code_exists(), create_material(), _dec(), _fmt_dt(), get_material(), get_material_entity(), _is_enabled_status(), list_materials() (+6 more)
|
||||
|
||||
### Community 22 - "Community 22"
|
||||
Cohesion: 0.24
|
||||
Nodes (9): 微信消息通知服务 支持微信小程序模板消息推送 使用方式: from app.core.wechat_message import Wech, 发送模板消息 Args: openid: 用户openid templ, send_delivery_notice(), send_delivery_warning(), send_order_status(), send_payment_success(), send_refund_result(), send_urge_notification() (+1 more)
|
||||
|
||||
### Community 22 - "Community 22"
|
||||
### Community 23 - "Community 23"
|
||||
Cohesion: 0.23
|
||||
Nodes (12): Config, ProductBase, ProductCategoryBase, ProductCategoryCreate, ProductCategoryResponse, ProductCreate, ProductResponse, ProductUnitBase (+4 more)
|
||||
|
||||
### Community 24 - "Community 24"
|
||||
Cohesion: 0.29
|
||||
Nodes (11): create_equipment(), _dec(), equipment_code_exists(), get_equipment(), list_equipments(), _norm_status(), _parse_date(), 设备 CRUD(biz_equipment) (+3 more)
|
||||
|
||||
### Community 23 - "Community 23"
|
||||
Cohesion: 0.24
|
||||
Nodes (12): appointment_no_exists(), create_exhibition_appointment(), _format_visit_date(), _generate_appointment_no(), get_exhibition_appointment(), list_exhibition_appointments(), 展览预约 CRUD(biz_exhibition_appointment), 生成预约编号:YYYYMMDD + 6位序号(如 20260515000001) (+4 more)
|
||||
|
||||
### Community 24 - "Community 24"
|
||||
Cohesion: 0.24
|
||||
Nodes (11): deduct_for_step(), _display_remark(), list_stock_logs(), _parse_receiver_purpose_from_remark(), 试剂变动记录 CRUD(biz_reagent_stock_log), 撤销步骤此前 step_save 扣减,便于重新填报。, 扣减试剂库存并生成变动记录。调用方控制事务,本函数不 commit。, _resolve_receiver_purpose() (+3 more)
|
||||
|
||||
### Community 25 - "Community 25"
|
||||
Cohesion: 0.32
|
||||
Nodes (11): create_env_detect_record(), _generate_record_no(), get_env_detect_record(), _join_csv(), list_env_detect_records(), _resolve_inspector_snapshots(), _resolve_item_snapshot(), _row_to_dict() (+3 more)
|
||||
Cohesion: 0.27
|
||||
Nodes (11): create_consumable_pack(), get_consumable_pack(), get_pack_detail(), _item_row_to_dict(), list_all_packs(), list_consumable_packs(), pack_code_exists(), 耗材包 CRUD(biz_consumable_pack + biz_consumable_pack_item) (+3 more)
|
||||
|
||||
### Community 26 - "Community 26"
|
||||
Cohesion: 0.24
|
||||
Nodes (11): deduct_for_step(), _display_remark(), list_stock_logs(), _parse_receiver_purpose_from_remark(), 耗材变动记录 CRUD(biz_consumable_stock_log), 撤销步骤此前 step_save 扣减,便于重新填报。, 扣减耗材库存并生成变动记录。调用方控制事务,本函数不 commit。, _resolve_receiver_purpose() (+3 more)
|
||||
Nodes (12): appointment_no_exists(), create_exhibition_appointment(), _format_visit_date(), _generate_appointment_no(), get_exhibition_appointment(), list_exhibition_appointments(), 展览预约 CRUD(biz_exhibition_appointment), 生成预约编号:YYYYMMDD + 6位序号(如 20260515000001) (+4 more)
|
||||
|
||||
### Community 27 - "Community 27"
|
||||
Cohesion: 0.32
|
||||
Nodes (11): create_env_detect_record(), _generate_record_no(), get_env_detect_record(), _join_csv(), list_env_detect_records(), _resolve_inspector_snapshots(), _resolve_item_snapshot(), _row_to_dict() (+3 more)
|
||||
|
||||
### Community 28 - "Community 28"
|
||||
Cohesion: 0.24
|
||||
Nodes (11): deduct_for_step(), _display_remark(), list_stock_logs(), _parse_receiver_purpose_from_remark(), 耗材变动记录 CRUD(biz_consumable_stock_log), 撤销步骤此前 step_save 扣减,便于重新填报。, 扣减耗材库存并生成变动记录。调用方控制事务,本函数不 commit。, _resolve_receiver_purpose() (+3 more)
|
||||
|
||||
### Community 29 - "Community 29"
|
||||
Cohesion: 0.27
|
||||
Nodes (11): _build_tree(), _cascade_soft_delete(), _collect_with_ancestors(), create_dept(), get_dept(), list_depts(), list_depts_tree(), 保留匹配节点及其全部上级,供关键词检索后仍能正确组树。 (+3 more)
|
||||
|
||||
### Community 28 - "Community 28"
|
||||
Cohesion: 0.27
|
||||
Nodes (8): create_customer(), get_customer(), id_card_taken(), list_customers(), 客户 CRUD(biz_customer), _row_to_dict(), soft_delete_customer(), update_customer()
|
||||
### Community 30 - "Community 30"
|
||||
Cohesion: 0.29
|
||||
Nodes (9): _build_tree(), _cascade_soft_delete(), create_menu(), get_menu(), list_menus(), list_menus_tree(), _row_to_dict(), soft_delete_menu() (+1 more)
|
||||
|
||||
### Community 29 - "Community 29"
|
||||
### Community 31 - "Community 31"
|
||||
Cohesion: 0.31
|
||||
Nodes (8): create_sop_document(), get_sop_document(), list_sop_documents(), SOP文档 CRUD(biz_sop_document), _row_to_dict(), soft_delete_sop_document(), sop_code_exists(), update_sop_document()
|
||||
|
||||
### Community 30 - "Community 30"
|
||||
### Community 32 - "Community 32"
|
||||
Cohesion: 0.31
|
||||
Nodes (8): create_express_company(), express_code_exists(), get_express_company(), list_express_companies(), 快递公司 CRUD(biz_express_company), _row_to_dict(), soft_delete_express_company(), update_express_company()
|
||||
|
||||
### Community 31 - "Community 31"
|
||||
### Community 33 - "Community 33"
|
||||
Cohesion: 0.38
|
||||
Nodes (9): create_check_item(), get_check_item(), item_code_exists(), list_active_check_items(), list_check_items(), _order_query(), _row_to_dict(), soft_delete_check_item() (+1 more)
|
||||
|
||||
### Community 32 - "Community 32"
|
||||
### Community 34 - "Community 34"
|
||||
Cohesion: 0.27
|
||||
Nodes (8): create_dict_data(), get_dict_data(), list_dict_data(), list_dict_data_options(), 字典数据 CRUD(sys_dict_data), _row_to_dict(), soft_delete_dict_data(), update_dict_data()
|
||||
|
||||
### Community 33 - "Community 33"
|
||||
### Community 35 - "Community 35"
|
||||
Cohesion: 0.38
|
||||
Nodes (9): create_env_detect_item(), get_env_detect_item(), item_code_exists(), list_active_env_detect_items(), list_env_detect_items(), _order_query(), _row_to_dict(), soft_delete_env_detect_item() (+1 more)
|
||||
|
||||
### Community 34 - "Community 34"
|
||||
### Community 36 - "Community 36"
|
||||
Cohesion: 0.31
|
||||
Nodes (8): category_code_exists(), create_process_category(), get_process_category(), list_process_categories(), 工艺工序分类 CRUD(biz_process_category), _row_to_dict(), soft_delete_process_category(), update_process_category()
|
||||
|
||||
### Community 35 - "Community 35"
|
||||
### Community 37 - "Community 37"
|
||||
Cohesion: 0.31
|
||||
Nodes (8): create_item_unit(), get_item_unit(), list_item_units(), 物品单位 CRUD(biz_item_unit), _row_to_dict(), soft_delete_item_unit(), unit_code_exists(), update_item_unit()
|
||||
|
||||
### Community 36 - "Community 36"
|
||||
### Community 38 - "Community 38"
|
||||
Cohesion: 0.31
|
||||
Nodes (8): create_cell_sample_type(), get_cell_sample_type(), list_cell_sample_types(), 细胞样本类型 CRUD(biz_cell_sample_type), _row_to_dict(), soft_delete_cell_sample_type(), type_code_exists(), update_cell_sample_type()
|
||||
|
||||
### Community 37 - "Community 37"
|
||||
### Community 39 - "Community 39"
|
||||
Cohesion: 0.31
|
||||
Nodes (8): create_output_type(), get_output_type(), list_output_types(), 工艺产出物类型 CRUD(biz_output_type), _row_to_dict(), soft_delete_output_type(), type_code_exists(), update_output_type()
|
||||
|
||||
### Community 38 - "Community 38"
|
||||
Cohesion: 0.36
|
||||
Nodes (7): create_post(), get_post(), list_posts(), post_code_exists(), _row_to_dict(), soft_delete_post(), update_post()
|
||||
|
||||
### Community 39 - "Community 39"
|
||||
### Community 40 - "Community 40"
|
||||
Cohesion: 0.36
|
||||
Nodes (7): create_tenant(), get_tenant(), list_tenants(), _row_to_dict(), soft_delete_tenant(), tenant_no_exists(), update_tenant()
|
||||
|
||||
### Community 40 - "Community 40"
|
||||
Cohesion: 0.33
|
||||
Nodes (7): _cascade_soft_delete(), create_menu(), get_menu(), list_menus(), _row_to_dict(), soft_delete_menu(), update_menu()
|
||||
|
||||
### Community 41 - "Community 41"
|
||||
Cohesion: 0.25
|
||||
Nodes (7): 菜单 code 权限守卫(V0.3:通过 sys_user_role → sys_role_menu → sys_menu.perms), 运营端角色守卫:admin / super_admin 可访问。, 接口菜单权限守卫。super_admin 直接放行。, 接口菜单权限守卫:拥有任一 menuCode 即可访问。super_admin 直接放行。, require_admin_or_super_admin(), require_any_menu_code(), require_menu_code()
|
||||
@@ -340,11 +340,11 @@ Nodes (1): 发送催单通知给配送员 Args: del
|
||||
## Suggested Questions
|
||||
_Questions this graph is uniquely positioned to answer:_
|
||||
|
||||
- **Why does `SysUser` connect `Community 1` to `Community 0`, `Community 2`, `Community 5`, `Community 6`, `Community 7`, `Community 9`, `Community 10`, `Community 12`, `Community 18`, `Community 20`, `Community 24`, `Community 26`?**
|
||||
- **Why does `SysUser` connect `Community 1` to `Community 2`, `Community 3`, `Community 4`, `Community 5`, `Community 6`, `Community 8`, `Community 10`, `Community 28`?**
|
||||
_High betweenness centrality (0.105) - this node is a cross-community bridge._
|
||||
- **Why does `success_response()` connect `Community 0` to `Community 1`, `Community 3`, `Community 7`, `Community 9`, `Community 10`, `Community 11`, `Community 46`?**
|
||||
- **Why does `success_response()` connect `Community 0` to `Community 1`, `Community 3`, `Community 7`, `Community 8`, `Community 10`, `Community 11`, `Community 46`, `Community 15`?**
|
||||
_High betweenness centrality (0.063) - this node is a cross-community bridge._
|
||||
- **Why does `generate_uuid()` connect `Community 4` to `Community 0`, `Community 3`, `Community 5`, `Community 6`, `Community 7`, `Community 8`, `Community 9`, `Community 10`, `Community 11`, `Community 13`, `Community 14`, `Community 15`, `Community 17`, `Community 18`, `Community 20`, `Community 22`, `Community 23`, `Community 24`, `Community 25`, `Community 26`, `Community 27`, `Community 28`, `Community 29`, `Community 30`, `Community 31`, `Community 32`, `Community 33`, `Community 34`, `Community 35`, `Community 36`, `Community 37`, `Community 38`, `Community 39`, `Community 40`?**
|
||||
- **Why does `generate_uuid()` connect `Community 5` to `Community 0`, `Community 3`, `Community 4`, `Community 6`, `Community 7`, `Community 8`, `Community 9`, `Community 10`, `Community 11`, `Community 12`, `Community 13`, `Community 15`, `Community 16`, `Community 17`, `Community 18`, `Community 19`, `Community 21`, `Community 24`, `Community 25`, `Community 26`, `Community 27`, `Community 28`, `Community 29`, `Community 30`, `Community 31`, `Community 32`, `Community 33`, `Community 34`, `Community 35`, `Community 36`, `Community 37`, `Community 38`, `Community 39`, `Community 40`?**
|
||||
_High betweenness centrality (0.055) - this node is a cross-community bridge._
|
||||
- **Are the 665 inferred relationships involving `str` (e.g. with `unhandled_exception_handler()` and `get_current_user_by_token()`) actually correct?**
|
||||
_`str` has 665 INFERRED edges - model-reasoned connections that need verification._
|
||||
|
||||
@@ -57,12 +57,12 @@
|
||||
</div>
|
||||
<div id="legend"></div>
|
||||
</div>
|
||||
<div id="stats">4023 nodes · 20953 edges · 61 communities</div>
|
||||
<div id="stats">4027 nodes · 20969 edges · 61 communities</div>
|
||||
</div>
|
||||
<script>
|
||||
const RAW_NODES = [{"id": "init_py", "label": "__init__.py", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "__init__.py", "community": 49, "community_name": "Community 49", "source_file": "__init__.py", "file_type": "code", "degree": 0}, {"id": "main_py", "label": "main.py", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.3, "font": {"size": 0, "color": "#ffffff"}, "title": "main.py", "community": 9, "community_name": "Community 9", "source_file": "main.py", "file_type": "code", "degree": 7}, {"id": "app_main_lifespan", "label": "lifespan()", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 10.2, "font": {"size": 0, "color": "#ffffff"}, "title": "lifespan()", "community": 10, "community_name": "Community 10", "source_file": "main.py", "file_type": "code", "degree": 4}, {"id": "app_main_error_json", "label": "_error_json()", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "_error_json()", "community": 9, "community_name": "Community 9", "source_file": "main.py", "file_type": "code", "degree": 3}, {"id": "app_main_sqlalchemy_exception_handler", "label": "sqlalchemy_exception_handler()", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.2, "font": {"size": 0, "color": "#ffffff"}, "title": "sqlalchemy_exception_handler()", "community": 9, "community_name": "Community 9", "source_file": "main.py", "file_type": "code", "degree": 4}, {"id": "app_main_unhandled_exception_handler", "label": "unhandled_exception_handler()", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.2, "font": {"size": 0, "color": "#ffffff"}, "title": "unhandled_exception_handler()", "community": 9, "community_name": "Community 9", "source_file": "main.py", "file_type": "code", "degree": 5}, {"id": "app_main_mask_secret", "label": "_mask_secret()", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "_mask_secret()", "community": 9, "community_name": "Community 9", "source_file": "main.py", "file_type": "code", "degree": 1}, {"id": "app_main_root", "label": "root()", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "root()", "community": 9, "community_name": "Community 9", "source_file": "main.py", "file_type": "code", "degree": 1}, {"id": "app_main_health_check", "label": "health_check()", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "health_check()", "community": 9, "community_name": "Community 9", "source_file": "main.py", "file_type": "code", "degree": 1}, {"id": "app_main_rationale_81", "label": "\u6570\u636e\u5e93\u5f02\u5e38\uff1a\u8fd4\u56de JSON \u5e76\u4fdd\u7559 CORS \u5934\uff0c\u907f\u514d\u6d4f\u89c8\u5668\u53ea\u62a5\u8de8\u57df\u9519\u8bef", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "\u6570\u636e\u5e93\u5f02\u5e38\uff1a\u8fd4\u56de JSON \u5e76\u4fdd\u7559 CORS \u5934\uff0c\u907f\u514d\u6d4f\u89c8\u5668\u53ea\u62a5\u8de8\u57df\u9519\u8bef", "community": 9, "community_name": "Community 9", "source_file": "main.py", "file_type": "rationale", "degree": 3}, {"id": "app_main_rationale_92", "label": "\u672a\u6355\u83b7\u5f02\u5e38\uff1a\u7edf\u4e00 JSON 500\uff0c\u786e\u4fdd\u8de8\u57df\u573a\u666f\u4e0b\u4ecd\u6709 Access-Control-Allow-Origin", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "\u672a\u6355\u83b7\u5f02\u5e38\uff1a\u7edf\u4e00 JSON 500\uff0c\u786e\u4fdd\u8de8\u57df\u573a\u666f\u4e0b\u4ecd\u6709 Access-Control-Allow-Origin", "community": 9, "community_name": "Community 9", "source_file": "main.py", "file_type": "rationale", "degree": 3}, {"id": "tasks_init_py", "label": "__init__.py", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "__init__.py", "community": 10, "community_name": "Community 10", "source_file": "tasks/__init__.py", "file_type": "code", Line truncated
|
||||
const RAW_EDGES = [{"from": "main_py", "to": "app_main_lifespan", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_error_json", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_sqlalchemy_exception_handler", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_unhandled_exception_handler", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_mask_secret", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_root", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_health_check", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_lifespan", "to": "core_login_crypto_ensure_initialized", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_lifespan", "to": "tasks_init_init_scheduled_tasks", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_lifespan", "to": "tasks_init_shutdown_scheduler", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_error_json", "to": "app_main_sqlalchemy_exception_handler", "label": "calls", "title": "calls [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_error_json", "to": "app_main_unhandled_exception_handler", "label": "calls", "title": "calls [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_sqlalchemy_exception_handler", "to": "app_main_rationale_81", "label": "rationale_for", "title": "rationale_for [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_sqlalchemy_exception_handler", "to": "exception", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_unhandled_exception_handler", "to": "app_main_rationale_92", "label": "rationale_for", "title": "rationale_for [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_unhandled_exception_handler", "to": "exception", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_unhandled_exception_handler", "to": "str", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_rationale_81", "to": "core_api_request_log_middleware_apirequestlogmiddleware", "label": "uses", "title": "uses [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_rationale_81", "to": "core_api_crypto_middleware_apicryptomiddleware", "label": "uses", "title": "uses [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_rationale_92", "to": "core_api_request_log_middleware_apirequestlogmiddleware", "label": "uses", "title": "uses [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_rationale_92", "to": "core_api_crypto_middleware_apicryptomiddleware", "label": "uses", "title": "uses [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "tasks_init_py", "to": "tasks_init_init_scheduled_tasks", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "tasks_init_py", "to": "tasks_init_shutdown_scheduler", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "core_auth_py", "to": "core_auth_redis_session_enabled", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "core_auth_py", "to": "core_auth_get_redis_client", "labeLine truncated
|
||||
const LEGEND = [{"cid": 0, "color": "#4E79A7", "label": "Community 0", "count": 799}, {"cid": 1, "color": "#F28E2B", "label": "Community 1", "count": 563}, {"cid": 2, "color": "#E15759", "label": "Community 2", "count": 337}, {"cid": 3, "color": "#76B7B2", "label": "Community 3", "count": 260}, {"cid": 4, "color": "#59A14F", "label": "Community 4", "count": 256}, {"cid": 5, "color": "#EDC948", "label": "Community 5", "count": 235}, {"cid": 6, "color": "#B07AA1", "label": "Community 6", "count": 224}, {"cid": 7, "color": "#FF9DA7", "label": "Community 7", "count": 198}, {"cid": 8, "color": "#9C755F", "label": "Community 8", "count": 183}, {"cid": 9, "color": "#BAB0AC", "label": "Community 9", "count": 177}, {"cid": 10, "color": "#4E79A7", "label": "Community 10", "count": 120}, {"cid": 11, "color": "#F28E2B", "label": "Community 11", "count": 100}, {"cid": 12, "color": "#E15759", "label": "Community 12", "count": 73}, {"cid": 13, "color": "#76B7B2", "label": "Community 13", "count": 52}, {"cid": 14, "color": "#59A14F", "label": "Community 14", "count": 48}, {"cid": 15, "color": "#EDC948", "label": "Community 15", "count": 38}, {"cid": 16, "color": "#B07AA1", "label": "Community 16", "count": 29}, {"cid": 17, "color": "#FF9DA7", "label": "Community 17", "count": 20}, {"cid": 18, "color": "#9C755F", "label": "Community 18", "count": 17}, {"cid": 19, "color": "#BAB0AC", "label": "Community 19", "count": 15}, {"cid": 20, "color": "#4E79A7", "label": "Community 20", "count": 14}, {"cid": 21, "color": "#F28E2B", "label": "Community 21", "count": 13}, {"cid": 22, "color": "#E15759", "label": "Community 22", "count": 13}, {"cid": 23, "color": "#76B7B2", "label": "Community 23", "count": 13}, {"cid": 24, "color": "#59A14F", "label": "Community 24", "count": 12}, {"cid": 25, "color": "#EDC948", "label": "Community 25", "count": 12}, {"cid": 26, "color": "#B07AA1", "label": "Community 26", "count": 12}, {"cid": 27, "color": "#FF9DA7", "label": "Community 27", "count": 12}, {"cid": 28, "color": "#9C755F", "label": "Community 28", "count": 11}, {"cid": 29, "color": "#BAB0AC", "label": "Community 29", "count": 10}, {"cid": 30, "color": "#4E79A7", "label": "Community 30", "count": 10}, {"cid": 31, "color": "#F28E2B", "label": "Community 31", "count": 10}, {"cid": 32, "color": "#E15759", "label": "Community 32", "count": 10}, {"cid": 33, "color": "#76B7B2", "label": "Community 33", "count": 10}, {"cid": 34, "color": "#59A14F", "label": "Community 34", "count": 10}, {"cid": 35, "color": "#EDC948", "label": "Community 35", "count": 10}, {"cid": 36, "color": "#B07AA1", "label": "Community 36", "count": 10}, {"cid": 37, "color": "#FF9DA7", "label": "Community 37", "count": 10}, {"cid": 38, "color": "#9C755F", "label": "Community 38", "count": 9}, {"cid": 39, "color": "#BAB0AC", "label": "Community 39", "count": 9}, {"cid": 40, "color": "#4E79A7", "label": "Community 40", "count": 9}, {"cid": 41, "color": "#F28E2B", "label": "Community 41", "count": 8}, {"cid": 42, "color": "#E15759", "label": "Community 42", "count": 8}, {"cid": 43, "color": "#76B7B2", "label": "Community 43", "count": 7}, {"cid": 44, "color": "#59A14F", "label": "Community 44", "count": 4}, {"cid": 45, "color": "#EDC948", "label": "Community 45", "count": 4}, {"cid": 46, "color": "#B07AA1", "label": "Community 46", "count": 3}, {"cid": 47, "color": "#FF9DA7", "label": "Community 47", "count": 2}, {"cid": 48, "color": "#9C755F", "label": "Community 48", "count": 2}, {"cid": 49, "color": "#BAB0AC", "label": "Community 49", "count": 1}, {"cid": 50, "color": "#4E79A7", "label": "Community 50", "count": 1}, {"cid": 51, "color": "#F28E2B", "label": "Community 51", "count": 1}, {"cid": 52, "color": "#E15759", "label": "Community 52", "count": 1}, {"cid": 53, "color": "#76B7B2", "label": "Community 53", "count": 1}, {"cid": 54, "color": "#59A14F", "label": "Community 54", "count": 1}, {"cid": 55, "color": "#EDC948", "label": "Community 55", "count": 1}, {"cid": 56, "color": "#B07AA1", "label": "Community 56", "count": 1}, {"cid": 57, "color": "#FF9DA7", "label": "Community 57", "count": 1}, {"cid": 58, "color": "#9C755F", "label": "Community 58", "count": 1}];
|
||||
const RAW_NODES = [{"id": "init_py", "label": "__init__.py", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "__init__.py", "community": 49, "community_name": "Community 49", "source_file": "__init__.py", "file_type": "code", "degree": 0}, {"id": "main_py", "label": "main.py", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.3, "font": {"size": 0, "color": "#ffffff"}, "title": "main.py", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 7}, {"id": "app_main_lifespan", "label": "lifespan()", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.2, "font": {"size": 0, "color": "#ffffff"}, "title": "lifespan()", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 4}, {"id": "app_main_error_json", "label": "_error_json()", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "_error_json()", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 3}, {"id": "app_main_sqlalchemy_exception_handler", "label": "sqlalchemy_exception_handler()", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.2, "font": {"size": 0, "color": "#ffffff"}, "title": "sqlalchemy_exception_handler()", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 4}, {"id": "app_main_unhandled_exception_handler", "label": "unhandled_exception_handler()", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.2, "font": {"size": 0, "color": "#ffffff"}, "title": "unhandled_exception_handler()", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 5}, {"id": "app_main_mask_secret", "label": "_mask_secret()", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "_mask_secret()", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 1}, {"id": "app_main_root", "label": "root()", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "root()", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 1}, {"id": "app_main_health_check", "label": "health_check()", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "health_check()", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "code", "degree": 1}, {"id": "app_main_rationale_81", "label": "\u6570\u636e\u5e93\u5f02\u5e38\uff1a\u8fd4\u56de JSON \u5e76\u4fdd\u7559 CORS \u5934\uff0c\u907f\u514d\u6d4f\u89c8\u5668\u53ea\u62a5\u8de8\u57df\u9519\u8bef", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "\u6570\u636e\u5e93\u5f02\u5e38\uff1a\u8fd4\u56de JSON \u5e76\u4fdd\u7559 CORS \u5934\uff0c\u907f\u514d\u6d4f\u89c8\u5668\u53ea\u62a5\u8de8\u57df\u9519\u8bef", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "rationale", "degree": 3}, {"id": "app_main_rationale_92", "label": "\u672a\u6355\u83b7\u5f02\u5e38\uff1a\u7edf\u4e00 JSON 500\uff0c\u786e\u4fdd\u8de8\u57df\u573a\u666f\u4e0b\u4ecd\u6709 Access-Control-Allow-Origin", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "\u672a\u6355\u83b7\u5f02\u5e38\uff1a\u7edf\u4e00 JSON 500\uff0c\u786e\u4fdd\u8de8\u57df\u573a\u666f\u4e0b\u4ecd\u6709 Access-Control-Allow-Origin", "community": 7, "community_name": "Community 7", "source_file": "main.py", "file_type": "rationale", "degree": 3}, {"id": "tasks_init_py", "label": "__init__.py", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "__init__.py", "community": 7, "community_name": "Community 7", "source_file": "tasks/__init__.py", "file_type": "code", "degLine truncated
|
||||
const RAW_EDGES = [{"from": "main_py", "to": "app_main_lifespan", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_error_json", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_sqlalchemy_exception_handler", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_unhandled_exception_handler", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_mask_secret", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_root", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "main_py", "to": "app_main_health_check", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_lifespan", "to": "core_login_crypto_ensure_initialized", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_lifespan", "to": "tasks_init_init_scheduled_tasks", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_lifespan", "to": "tasks_init_shutdown_scheduler", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_error_json", "to": "app_main_sqlalchemy_exception_handler", "label": "calls", "title": "calls [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_error_json", "to": "app_main_unhandled_exception_handler", "label": "calls", "title": "calls [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_sqlalchemy_exception_handler", "to": "app_main_rationale_81", "label": "rationale_for", "title": "rationale_for [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_sqlalchemy_exception_handler", "to": "exception", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_unhandled_exception_handler", "to": "app_main_rationale_92", "label": "rationale_for", "title": "rationale_for [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_main_unhandled_exception_handler", "to": "exception", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_unhandled_exception_handler", "to": "str", "label": "calls", "title": "calls [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_rationale_81", "to": "core_api_request_log_middleware_apirequestlogmiddleware", "label": "uses", "title": "uses [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_rationale_81", "to": "core_api_crypto_middleware_apicryptomiddleware", "label": "uses", "title": "uses [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_rationale_92", "to": "core_api_request_log_middleware_apirequestlogmiddleware", "label": "uses", "title": "uses [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "app_main_rationale_92", "to": "core_api_crypto_middleware_apicryptomiddleware", "label": "uses", "title": "uses [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "tasks_init_py", "to": "tasks_init_init_scheduled_tasks", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "tasks_init_py", "to": "tasks_init_shutdown_scheduler", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "core_auth_py", "to": "core_auth_redis_session_enabled", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "core_auth_py", "to": "core_auth_get_redis_client", "labeLine truncated
|
||||
const LEGEND = [{"cid": 0, "color": "#4E79A7", "label": "Community 0", "count": 828}, {"cid": 1, "color": "#F28E2B", "label": "Community 1", "count": 611}, {"cid": 2, "color": "#E15759", "label": "Community 2", "count": 375}, {"cid": 3, "color": "#76B7B2", "label": "Community 3", "count": 275}, {"cid": 4, "color": "#59A14F", "label": "Community 4", "count": 242}, {"cid": 5, "color": "#EDC948", "label": "Community 5", "count": 232}, {"cid": 6, "color": "#B07AA1", "label": "Community 6", "count": 203}, {"cid": 7, "color": "#FF9DA7", "label": "Community 7", "count": 181}, {"cid": 8, "color": "#9C755F", "label": "Community 8", "count": 178}, {"cid": 9, "color": "#BAB0AC", "label": "Community 9", "count": 154}, {"cid": 10, "color": "#4E79A7", "label": "Community 10", "count": 118}, {"cid": 11, "color": "#F28E2B", "label": "Community 11", "count": 106}, {"cid": 12, "color": "#E15759", "label": "Community 12", "count": 48}, {"cid": 13, "color": "#76B7B2", "label": "Community 13", "count": 38}, {"cid": 14, "color": "#59A14F", "label": "Community 14", "count": 31}, {"cid": 15, "color": "#EDC948", "label": "Community 15", "count": 29}, {"cid": 16, "color": "#B07AA1", "label": "Community 16", "count": 24}, {"cid": 17, "color": "#FF9DA7", "label": "Community 17", "count": 22}, {"cid": 18, "color": "#9C755F", "label": "Community 18", "count": 21}, {"cid": 19, "color": "#BAB0AC", "label": "Community 19", "count": 20}, {"cid": 20, "color": "#4E79A7", "label": "Community 20", "count": 15}, {"cid": 21, "color": "#F28E2B", "label": "Community 21", "count": 15}, {"cid": 22, "color": "#E15759", "label": "Community 22", "count": 13}, {"cid": 23, "color": "#76B7B2", "label": "Community 23", "count": 13}, {"cid": 24, "color": "#59A14F", "label": "Community 24", "count": 13}, {"cid": 25, "color": "#EDC948", "label": "Community 25", "count": 13}, {"cid": 26, "color": "#B07AA1", "label": "Community 26", "count": 13}, {"cid": 27, "color": "#FF9DA7", "label": "Community 27", "count": 12}, {"cid": 28, "color": "#9C755F", "label": "Community 28", "count": 12}, {"cid": 29, "color": "#BAB0AC", "label": "Community 29", "count": 12}, {"cid": 30, "color": "#4E79A7", "label": "Community 30", "count": 11}, {"cid": 31, "color": "#F28E2B", "label": "Community 31", "count": 10}, {"cid": 32, "color": "#E15759", "label": "Community 32", "count": 10}, {"cid": 33, "color": "#76B7B2", "label": "Community 33", "count": 10}, {"cid": 34, "color": "#59A14F", "label": "Community 34", "count": 10}, {"cid": 35, "color": "#EDC948", "label": "Community 35", "count": 10}, {"cid": 36, "color": "#B07AA1", "label": "Community 36", "count": 10}, {"cid": 37, "color": "#FF9DA7", "label": "Community 37", "count": 10}, {"cid": 38, "color": "#9C755F", "label": "Community 38", "count": 10}, {"cid": 39, "color": "#BAB0AC", "label": "Community 39", "count": 10}, {"cid": 40, "color": "#4E79A7", "label": "Community 40", "count": 9}, {"cid": 41, "color": "#F28E2B", "label": "Community 41", "count": 8}, {"cid": 42, "color": "#E15759", "label": "Community 42", "count": 8}, {"cid": 43, "color": "#76B7B2", "label": "Community 43", "count": 7}, {"cid": 44, "color": "#59A14F", "label": "Community 44", "count": 4}, {"cid": 45, "color": "#EDC948", "label": "Community 45", "count": 4}, {"cid": 46, "color": "#B07AA1", "label": "Community 46", "count": 3}, {"cid": 47, "color": "#FF9DA7", "label": "Community 47", "count": 2}, {"cid": 48, "color": "#9C755F", "label": "Community 48", "count": 2}, {"cid": 49, "color": "#BAB0AC", "label": "Community 49", "count": 1}, {"cid": 50, "color": "#4E79A7", "label": "Community 50", "count": 1}, {"cid": 51, "color": "#F28E2B", "label": "Community 51", "count": 1}, {"cid": 52, "color": "#E15759", "label": "Community 52", "count": 1}, {"cid": 53, "color": "#76B7B2", "label": "Community 53", "count": 1}, {"cid": 54, "color": "#59A14F", "label": "Community 54", "count": 1}, {"cid": 55, "color": "#EDC948", "label": "Community 55", "count": 1}, {"cid": 56, "color": "#B07AA1", "label": "Community 56", "count": 1}, {"cid": 57, "color": "#FF9DA7", "label": "Community 57", "count": 1}, {"cid": 58, "color": "#9C755F", "label": "Community 58", "count": 1}];
|
||||
|
||||
// HTML-escape helper — prevents XSS when injecting graph data into innerHTML
|
||||
function esc(s) {
|
||||
|
||||
+2308
-2080
File diff suppressed because it is too large.
Load diff
@@ -5,7 +5,7 @@
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/core/auth.py": 1780540737.3359916,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/core/api_crypto.py": 1778578258.039314,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/core/login_crypto.py": 1778578258.041774,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/core/config.py": 1780539434.4590578,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/core/config.py": 1781364254.604756,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/core/wechat_pay.py": 1778578258.0461762,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/core/api_request_log_middleware.py": 1779882001.753267,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/core/avatar_url.py": 1780540753.5481932,
|
||||
@@ -149,7 +149,7 @@
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/qc_material.py": 1779284415.64655,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/collection_protocol_no.py": 1779882001.753651,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/outbound_handover.py": 1780455574.0993364,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py": 1781348070.4137235,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/storage_facility.py": 1781348192.5178332,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/sample_reception_lab_code.py": 1780462849.099601,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/cell_sample_type.py": 1778733001.8375483,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/pilot_outbound_status_sync.py": 1781079916.545948,
|
||||
@@ -165,7 +165,7 @@
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/crud/clinical_payment.py": 1781079908.473383,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/api/storage_release_review.py": 1779526635.1455016,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/api/outbound_release_review.py": 1779968232.5759368,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py": 1780540754.892583,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/api/public.py": 1781364255.0874767,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/api/material.py": 1781346125.224969,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/api/production_material.py": 1781345627.6603975,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/api/qc.py": 1781345617.9076924,
|
||||
@@ -200,7 +200,7 @@
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/services/qc_work_order_fee_summary.py": 1781337818.5442588,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/services/storage_facility_code.py": 1781348051.133351,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/services/workflow_engine.py": 1778634664.6293883,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py": 1781264627.3503358,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/services/web_auth_roles.py": 1781364250.593021,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/services/protocol_payment_installment.py": 1781076733.062029,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/services/protocol_pay_mode_switch.py": 1781076762.2225447,
|
||||
"/Users/wuzilong/work/00code/zkxw/backend/app/ws/__init__.py": 1778578258.105995
|
||||
|
||||
@@ -0,0 +1,272 @@
|
||||
#!/usr/bin/env python3
|
||||
"""批量初始化洁净室及子表测试数据(biz_clean_room + access_log + uv_disinfect_log),已存在编码则跳过。"""
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
from app.core.database import SessionLocal
|
||||
from app.crud import clean_room as clean_room_svc
|
||||
|
||||
ADMIN_ID = "d3000000000000000000000000000001"
|
||||
TEST_USER_ID = "b13c2be24e7111f19f4700163e3bdd9601"
|
||||
|
||||
# (room_code, room_name, room_grade, room_status, area_sqm, order_num, remark)
|
||||
CLEAN_ROOMS = [
|
||||
("CR-A01", "细胞制备A级洁净室", "A", "zc", 45.50, 1, "主制备区,日常细胞培养"),
|
||||
("CR-B01", "样本接收B级洁净室", "B", "zc", 32.00, 2, "样本接收与初检"),
|
||||
("CR-B02", "质检B级洁净室", "B", "zc", 28.80, 3, "质检与留样"),
|
||||
("CR-C01", "物料暂存C级洁净室", "C", "zc", 18.60, 4, "物料暂存与缓冲"),
|
||||
("CR-D01", "更衣D级洁净室", "D", "yc", 12.00, 5, "压差异常,待检修"),
|
||||
]
|
||||
|
||||
# room_code -> list of access log dicts
|
||||
ACCESS_LOGS = {
|
||||
"CR-A01": [
|
||||
{
|
||||
"user_id": ADMIN_ID,
|
||||
"person_name": "管理员",
|
||||
"dept_name": "综合部",
|
||||
"enter_time": datetime(2026, 6, 10, 8, 15),
|
||||
"purpose": "日常巡检",
|
||||
"leave_time": datetime(2026, 6, 10, 8, 45),
|
||||
"body_temp": "36.5",
|
||||
},
|
||||
{
|
||||
"user_id": TEST_USER_ID,
|
||||
"person_name": "中科兴皖测试1",
|
||||
"dept_name": "技术研发部",
|
||||
"enter_time": datetime(2026, 6, 10, 9, 0),
|
||||
"purpose": "细胞培养操作",
|
||||
"leave_time": datetime(2026, 6, 10, 12, 30),
|
||||
"body_temp": "36.4",
|
||||
},
|
||||
],
|
||||
"CR-B01": [
|
||||
{
|
||||
"user_id": TEST_USER_ID,
|
||||
"person_name": "中科兴皖测试1",
|
||||
"dept_name": "生产部",
|
||||
"enter_time": datetime(2026, 6, 11, 7, 50),
|
||||
"purpose": "样本接收登记",
|
||||
"leave_time": datetime(2026, 6, 11, 8, 40),
|
||||
"body_temp": "36.6",
|
||||
},
|
||||
{
|
||||
"person_name": "张质检",
|
||||
"dept_name": "质量安全部",
|
||||
"enter_time": datetime(2026, 6, 11, 14, 0),
|
||||
"purpose": "样本初检",
|
||||
"leave_time": datetime(2026, 6, 11, 15, 20),
|
||||
"body_temp": "36.3",
|
||||
"remark": "外部访客",
|
||||
},
|
||||
],
|
||||
"CR-B02": [
|
||||
{
|
||||
"user_id": ADMIN_ID,
|
||||
"person_name": "管理员",
|
||||
"dept_name": "质量安全部",
|
||||
"enter_time": datetime(2026, 6, 12, 10, 0),
|
||||
"purpose": "留样复核",
|
||||
"leave_time": datetime(2026, 6, 12, 11, 0),
|
||||
"body_temp": "36.5",
|
||||
},
|
||||
],
|
||||
"CR-C01": [
|
||||
{
|
||||
"person_name": "李物料",
|
||||
"dept_name": "生产部",
|
||||
"enter_time": datetime(2026, 6, 12, 15, 30),
|
||||
"purpose": "物料入库",
|
||||
"leave_time": datetime(2026, 6, 12, 16, 0),
|
||||
"body_temp": "36.7",
|
||||
},
|
||||
],
|
||||
"CR-D01": [
|
||||
{
|
||||
"user_id": ADMIN_ID,
|
||||
"person_name": "管理员",
|
||||
"dept_name": "综合部",
|
||||
"enter_time": datetime(2026, 6, 10, 16, 0),
|
||||
"purpose": "压差异常排查",
|
||||
"leave_time": None,
|
||||
"body_temp": "36.5",
|
||||
"remark": "尚未离开",
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
# room_code -> list of uv disinfect log dicts
|
||||
UV_LOGS = {
|
||||
"CR-A01": [
|
||||
{
|
||||
"user_id": ADMIN_ID,
|
||||
"operator_name": "管理员",
|
||||
"start_time": datetime(2026, 6, 9, 18, 0),
|
||||
"end_time": datetime(2026, 6, 9, 19, 0),
|
||||
"remark": "班后消毒",
|
||||
},
|
||||
{
|
||||
"user_id": ADMIN_ID,
|
||||
"operator_name": "管理员",
|
||||
"start_time": datetime(2026, 6, 10, 18, 0),
|
||||
"end_time": datetime(2026, 6, 10, 19, 0),
|
||||
"remark": "班后消毒",
|
||||
},
|
||||
],
|
||||
"CR-B01": [
|
||||
{
|
||||
"user_id": ADMIN_ID,
|
||||
"operator_name": "管理员",
|
||||
"start_time": datetime(2026, 6, 10, 17, 30),
|
||||
"end_time": datetime(2026, 6, 10, 18, 30),
|
||||
},
|
||||
],
|
||||
"CR-B02": [
|
||||
{
|
||||
"user_id": ADMIN_ID,
|
||||
"operator_name": "管理员",
|
||||
"start_time": datetime(2026, 6, 11, 18, 0),
|
||||
"end_time": datetime(2026, 6, 11, 19, 0),
|
||||
},
|
||||
],
|
||||
"CR-C01": [
|
||||
{
|
||||
"user_id": ADMIN_ID,
|
||||
"operator_name": "管理员",
|
||||
"start_time": datetime(2026, 6, 11, 17, 0),
|
||||
"end_time": datetime(2026, 6, 11, 17, 45),
|
||||
"remark": "C级区缩短时长",
|
||||
},
|
||||
],
|
||||
"CR-D01": [
|
||||
{
|
||||
"user_id": ADMIN_ID,
|
||||
"operator_name": "管理员",
|
||||
"start_time": datetime(2026, 6, 10, 14, 30),
|
||||
"end_time": None,
|
||||
"remark": "异常区暂停消毒",
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
def _room_exists(db, code: str, tenant_no: str) -> bool:
|
||||
return clean_room_svc.room_code_exists(db, code, tenant_no)
|
||||
|
||||
|
||||
def _access_log_exists(db, room_id: str, enter_time: datetime, tenant_no: str) -> bool:
|
||||
rows, _ = clean_room_svc.list_access_logs(
|
||||
db, page=1, page_size=100, clean_room_id=room_id, tenant_no=tenant_no
|
||||
)
|
||||
ts = enter_time.strftime("%Y-%m-%d %H:%M:%S")
|
||||
return any(r.get("enterTime") == ts for r in rows)
|
||||
|
||||
|
||||
def _uv_log_exists(db, room_id: str, start_time: datetime, tenant_no: str) -> bool:
|
||||
rows, _ = clean_room_svc.list_uv_disinfect_logs(
|
||||
db, page=1, page_size=100, clean_room_id=room_id, tenant_no=tenant_no
|
||||
)
|
||||
ts = start_time.strftime("%Y-%m-%d %H:%M:%S")
|
||||
return any(r.get("startTime") == ts for r in rows)
|
||||
|
||||
|
||||
def seed(tenant_no: str = "zkxw", user_id: str = ADMIN_ID) -> None:
|
||||
db = SessionLocal()
|
||||
rooms_created = 0
|
||||
rooms_skipped = 0
|
||||
access_created = 0
|
||||
access_skipped = 0
|
||||
uv_created = 0
|
||||
uv_skipped = 0
|
||||
try:
|
||||
room_ids: dict[str, str] = {}
|
||||
for code, name, grade, status, area, order_num, remark in CLEAN_ROOMS:
|
||||
if _room_exists(db, code, tenant_no):
|
||||
rooms_skipped += 1
|
||||
existing = clean_room_svc.list_clean_rooms(db, page=1, page_size=1, keyword=code, tenant_no=tenant_no)
|
||||
if existing[0]:
|
||||
room_ids[code] = existing[0][0]["id"]
|
||||
continue
|
||||
obj = clean_room_svc.create_clean_room(
|
||||
db,
|
||||
room_code=code,
|
||||
room_name=name,
|
||||
room_grade=grade,
|
||||
room_status=status,
|
||||
area_sqm=area,
|
||||
tenant_no=tenant_no,
|
||||
order_num=order_num,
|
||||
remark=remark,
|
||||
user_id=user_id,
|
||||
)
|
||||
room_ids[code] = obj.id
|
||||
rooms_created += 1
|
||||
|
||||
for code, logs in ACCESS_LOGS.items():
|
||||
room_id = room_ids.get(code)
|
||||
if not room_id:
|
||||
continue
|
||||
for idx, log in enumerate(logs, start=1):
|
||||
enter_time = log["enter_time"]
|
||||
if _access_log_exists(db, room_id, enter_time, tenant_no):
|
||||
access_skipped += 1
|
||||
continue
|
||||
clean_room_svc.create_access_log(
|
||||
db,
|
||||
clean_room_id=room_id,
|
||||
user_id=log.get("user_id"),
|
||||
person_name=log.get("person_name"),
|
||||
dept_name=log.get("dept_name"),
|
||||
enter_time=enter_time,
|
||||
purpose=log.get("purpose"),
|
||||
leave_time=log.get("leave_time"),
|
||||
body_temp=log.get("body_temp"),
|
||||
tenant_no=tenant_no,
|
||||
order_num=idx,
|
||||
remark=log.get("remark"),
|
||||
user_id_param=user_id,
|
||||
)
|
||||
access_created += 1
|
||||
|
||||
for code, logs in UV_LOGS.items():
|
||||
room_id = room_ids.get(code)
|
||||
if not room_id:
|
||||
continue
|
||||
for idx, log in enumerate(logs, start=1):
|
||||
start_time = log["start_time"]
|
||||
if _uv_log_exists(db, room_id, start_time, tenant_no):
|
||||
uv_skipped += 1
|
||||
continue
|
||||
clean_room_svc.create_uv_disinfect_log(
|
||||
db,
|
||||
clean_room_id=room_id,
|
||||
user_id=log.get("user_id"),
|
||||
operator_name=log.get("operator_name"),
|
||||
start_time=start_time,
|
||||
end_time=log.get("end_time"),
|
||||
tenant_no=tenant_no,
|
||||
order_num=idx,
|
||||
remark=log.get("remark"),
|
||||
user_id_param=user_id,
|
||||
)
|
||||
uv_created += 1
|
||||
|
||||
print(
|
||||
f"洁净室测试数据初始化完成:"
|
||||
f"洁净室 新增 {rooms_created} / 跳过 {rooms_skipped};"
|
||||
f"进出记录 新增 {access_created} / 跳过 {access_skipped};"
|
||||
f"消毒记录 新增 {uv_created} / 跳过 {uv_skipped}。"
|
||||
)
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
seed()
|
||||
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
"""批量初始化常用快递公司(biz_express_company),已存在编码则跳过。"""
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
from app.core.database import SessionLocal
|
||||
from app.crud import express_company as express_company_svc
|
||||
|
||||
# (express_code, express_name, order_num, remark)
|
||||
EXPRESS_COMPANIES = [
|
||||
("SF", "顺丰速运", 1, "常用快递"),
|
||||
("YTO", "圆通速递", 2, "常用快递"),
|
||||
("ZTO", "中通快递", 3, "常用快递"),
|
||||
("STO", "申通快递", 4, "常用快递"),
|
||||
("YD", "韵达速递", 5, "常用快递"),
|
||||
("JD", "京东物流", 6, "常用快递"),
|
||||
("EMS", "中国邮政EMS", 7, "常用快递"),
|
||||
("HTKY", "百世快递", 8, "常用快递"),
|
||||
("JTSD", "极兔速递", 9, "常用快递"),
|
||||
("DBL", "德邦快递", 10, "常用快递"),
|
||||
]
|
||||
|
||||
|
||||
def seed(tenant_no: str = "zkxw", user_id: str = "d3000000000000000000000000000001") -> None:
|
||||
db = SessionLocal()
|
||||
created = 0
|
||||
skipped = 0
|
||||
try:
|
||||
for code, name, order_num, remark in EXPRESS_COMPANIES:
|
||||
if express_company_svc.express_code_exists(db, code, tenant_no):
|
||||
skipped += 1
|
||||
continue
|
||||
express_company_svc.create_express_company(
|
||||
db,
|
||||
express_code=code,
|
||||
express_name=name,
|
||||
tenant_no=tenant_no,
|
||||
order_num=order_num,
|
||||
remark=remark,
|
||||
user_id=user_id,
|
||||
)
|
||||
created += 1
|
||||
print(f"快递公司初始化完成:新增 {created} 条,跳过 {skipped} 条(编码已存在)。")
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
seed()
|
||||
@@ -0,0 +1,232 @@
|
||||
#!/usr/bin/env python3
|
||||
"""批量初始化物品单位(biz_item_unit),已存在编码则跳过。"""
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
from app.core.database import SessionLocal
|
||||
from app.crud import item_unit as item_unit_svc
|
||||
|
||||
# (unit_code, unit_name, order_num, remark)
|
||||
ITEM_UNITS = [
|
||||
# —— 计数 / 件数 ——
|
||||
("ge", "个", 1, "计数"),
|
||||
("jian", "件", 2, "计数"),
|
||||
("tao", "套", 3, "计数"),
|
||||
("tai", "台", 4, "计数"),
|
||||
("liang_che", "辆", 5, "计数"),
|
||||
("jia", "架", 6, "计数"),
|
||||
("bu", "部", 7, "计数"),
|
||||
("zhi", "支", 8, "计数"),
|
||||
("tiao", "条", 9, "计数"),
|
||||
("gen", "根", 10, "计数"),
|
||||
("zhang", "张", 11, "计数"),
|
||||
("pian", "片", 12, "计数"),
|
||||
("kuai", "块", 13, "计数"),
|
||||
("ke", "颗", 14, "计数"),
|
||||
("li", "粒", 15, "计数"),
|
||||
("mei", "枚", 16, "计数"),
|
||||
("zhi_zhi", "只", 17, "计数"),
|
||||
("tou", "头", 18, "计数"),
|
||||
("wei_tail", "尾", 19, "计数"),
|
||||
("pi", "匹", 20, "计数"),
|
||||
("shuang", "双", 21, "计数"),
|
||||
("dui", "对", 22, "计数"),
|
||||
("fu", "副", 23, "计数"),
|
||||
("zu", "组", 24, "计数"),
|
||||
("pi_pi", "批", 25, "计数"),
|
||||
("fen", "份", 26, "计数"),
|
||||
("ci", "次", 27, "计数"),
|
||||
("hui", "回", 28, "计数"),
|
||||
("lun", "轮", 29, "计数"),
|
||||
("ba", "把", 30, "计数"),
|
||||
("kun", "捆", 31, "计数"),
|
||||
("chuan", "串", 32, "计数"),
|
||||
("shu", "束", 33, "计数"),
|
||||
("pai", "排", 34, "计数"),
|
||||
("kong", "孔", 35, "计数"),
|
||||
("zhu", "株", 36, "计数"),
|
||||
("ke_shu", "棵", 37, "计数"),
|
||||
("cong", "丛", 38, "计数"),
|
||||
("duo", "朵", 39, "计数"),
|
||||
("ban_petal", "瓣", 40, "计数"),
|
||||
("ren", "人", 41, "计数"),
|
||||
("wei_pos", "位", 42, "计数"),
|
||||
("hu_hu", "户", 43, "计数"),
|
||||
("jia_hu", "家", 44, "计数"),
|
||||
("kou", "口", 45, "计数"),
|
||||
("dun", "顿", 46, "计数"),
|
||||
("xiang_mu", "项", 47, "计数"),
|
||||
("ben", "本", 48, "计数"),
|
||||
("ce", "册", 49, "计数"),
|
||||
("zhang_page", "页", 50, "计数"),
|
||||
# —— 质量 ——
|
||||
("ug", "微克", 100, "质量"),
|
||||
("mg", "毫克", 101, "质量"),
|
||||
("g", "克", 102, "质量"),
|
||||
("kg", "千克", 103, "质量"),
|
||||
("t", "吨", 104, "质量"),
|
||||
("jin", "斤", 105, "质量"),
|
||||
("liang_w", "两", 106, "质量"),
|
||||
("lb", "磅", 107, "质量"),
|
||||
("oz", "盎司", 108, "质量"),
|
||||
("dan", "担", 109, "质量"),
|
||||
("gongjin", "公斤", 110, "质量"),
|
||||
# —— 体积 ——
|
||||
("ul", "微升", 200, "体积"),
|
||||
("ml", "毫升", 201, "体积"),
|
||||
("l", "升", 202, "体积"),
|
||||
("dl", "分升", 203, "体积"),
|
||||
("cl", "厘升", 204, "体积"),
|
||||
("m3", "立方米", 205, "体积"),
|
||||
("dm3", "立方分米", 206, "体积"),
|
||||
("cm3", "立方厘米", 207, "体积"),
|
||||
("mm3", "立方毫米", 208, "体积"),
|
||||
("gal", "加仑", 209, "体积"),
|
||||
# —— 长度 / 面积 ——
|
||||
("mm", "毫米", 300, "长度"),
|
||||
("cm", "厘米", 301, "长度"),
|
||||
("dm", "分米", 302, "长度"),
|
||||
("m", "米", 303, "长度"),
|
||||
("km", "千米", 304, "长度"),
|
||||
("inch", "英寸", 305, "长度"),
|
||||
("ft", "英尺", 306, "长度"),
|
||||
("chi", "尺", 307, "长度"),
|
||||
("cun", "寸", 308, "长度"),
|
||||
("mm2", "平方毫米", 320, "面积"),
|
||||
("cm2", "平方厘米", 321, "面积"),
|
||||
("m2", "平方米", 322, "面积"),
|
||||
("km2", "平方千米", 323, "面积"),
|
||||
("mu_area", "亩", 324, "面积"),
|
||||
("ha", "公顷", 325, "面积"),
|
||||
# —— 包装 ——
|
||||
("he", "盒", 400, "包装"),
|
||||
("xiang", "箱", 401, "包装"),
|
||||
("dai", "袋", 402, "包装"),
|
||||
("bao", "包", 403, "包装"),
|
||||
("ping", "瓶", 404, "包装"),
|
||||
("guan", "罐", 405, "包装"),
|
||||
("tong", "桶", 406, "包装"),
|
||||
("tong_tube", "筒", 407, "包装"),
|
||||
("juan", "卷", 408, "包装"),
|
||||
("ban_board", "板", 409, "包装"),
|
||||
("tuo", "托", 410, "包装"),
|
||||
("pan", "盘", 411, "包装"),
|
||||
("kuang", "筐", 412, "包装"),
|
||||
("lan", "篮", 413, "包装"),
|
||||
("lou", "篓", 414, "包装"),
|
||||
("long", "笼", 415, "包装"),
|
||||
("bei", "杯", 416, "包装"),
|
||||
("wan", "碗", 417, "包装"),
|
||||
("hu_pot", "壶", 418, "包装"),
|
||||
("pen", "盆", 419, "包装"),
|
||||
("guan_tube", "管", 420, "包装"),
|
||||
("nang", "囊", 421, "包装"),
|
||||
("tie", "贴", 422, "包装"),
|
||||
("za", "扎", 423, "包装"),
|
||||
("ceng", "层", 424, "包装"),
|
||||
("ge_pack", "格", 425, "包装"),
|
||||
("xi_tou", "吸头", 426, "包装"),
|
||||
("qiang_tou", "枪头", 427, "包装"),
|
||||
("kong_ban", "孔板", 428, "包装"),
|
||||
("yang_ben_guan", "样本管", 429, "包装"),
|
||||
("dong_cun_guan", "冻存管", 430, "包装"),
|
||||
("pei_yang_ping", "培养瓶", 431, "包装"),
|
||||
("pei_yang_min", "培养皿", 432, "包装"),
|
||||
("liu_guan", "六孔板", 433, "包装"),
|
||||
("shi_er_guan", "十二孔板", 434, "包装"),
|
||||
("ershi_si_guan", "二十四孔板", 435, "包装"),
|
||||
("jiu_shi_liu_guan", "九十六孔板", 436, "包装"),
|
||||
("san_bai_ba_shi_guan", "三百八十四孔板", 437, "包装"),
|
||||
# —— 实验室 / 生物 ——
|
||||
("u", "单位", 500, "实验室"),
|
||||
("iu", "IU", 501, "实验室"),
|
||||
("ku", "KU", 502, "实验室"),
|
||||
("mu_act", "MU", 503, "实验室"),
|
||||
("cells_ml", "cells/mL", 504, "实验室"),
|
||||
("cells_ul", "cells/μL", 505, "实验室"),
|
||||
("cfu", "CFU", 506, "实验室"),
|
||||
("cfu_ml", "CFU/mL", 507, "实验室"),
|
||||
("pfu", "PFU", 508, "实验室"),
|
||||
("pfu_ml", "PFU/mL", 509, "实验室"),
|
||||
("od", "OD", 510, "实验室"),
|
||||
("copies_ml", "copies/mL", 511, "实验室"),
|
||||
("copies_ul", "copies/μL", 512, "实验室"),
|
||||
("mol", "摩尔", 513, "实验室"),
|
||||
("mmol", "毫摩尔", 514, "实验室"),
|
||||
("umol", "微摩尔", 515, "实验室"),
|
||||
("nmol", "纳摩尔", 516, "实验室"),
|
||||
("mol_l", "mol/L", 517, "实验室"),
|
||||
("mmol_l", "mmol/L", 518, "实验室"),
|
||||
("umol_l", "μmol/L", 519, "实验室"),
|
||||
("nmol_l", "nmol/L", 520, "实验室"),
|
||||
("m_l", "M", 521, "实验室"),
|
||||
("percent", "%", 522, "实验室"),
|
||||
("ppm", "ppm", 523, "实验室"),
|
||||
("ppb", "ppb", 524, "实验室"),
|
||||
("mg_ml", "mg/mL", 525, "实验室"),
|
||||
("ug_ml", "μg/mL", 526, "实验室"),
|
||||
("ng_ml", "ng/mL", 527, "实验室"),
|
||||
("pg_ml", "pg/mL", 528, "实验室"),
|
||||
("mg_l", "mg/L", 529, "实验室"),
|
||||
("ug_l", "μg/L", 530, "实验室"),
|
||||
("ng_l", "ng/L", 531, "实验室"),
|
||||
("iu_ml", "IU/mL", 532, "实验室"),
|
||||
("u_ml", "U/mL", 533, "实验室"),
|
||||
("x_be", "×", 534, "实验室"),
|
||||
("ren_fen", "人份", 535, "实验室"),
|
||||
("yang_ben", "样本", 536, "实验室"),
|
||||
("ji_yin", "基因", 537, "实验室"),
|
||||
("tiao_dai", "条带", 538, "实验室"),
|
||||
("kuai_jiao", "块胶", 539, "实验室"),
|
||||
# —— 时间 ——
|
||||
("s", "秒", 600, "时间"),
|
||||
("min", "分钟", 601, "时间"),
|
||||
("h", "小时", 602, "时间"),
|
||||
("d", "天", 603, "时间"),
|
||||
("week", "周", 604, "时间"),
|
||||
("month", "月", 605, "时间"),
|
||||
("year", "年", 606, "时间"),
|
||||
("ji", "季", 607, "时间"),
|
||||
# —— 其他 ——
|
||||
("yuan", "元", 700, "其他"),
|
||||
("kwh", "千瓦时", 701, "其他"),
|
||||
("du", "度", 702, "其他"),
|
||||
("zhi_plant", "枝", 703, "其他"),
|
||||
("dai_pack", "袋装", 704, "其他"),
|
||||
("xiang_pack", "箱装", 705, "其他"),
|
||||
("he_pack", "盒装", 706, "其他"),
|
||||
]
|
||||
|
||||
|
||||
def seed(tenant_no: str = "zkxw", user_id: str = "d3000000000000000000000000000001") -> None:
|
||||
db = SessionLocal()
|
||||
created = 0
|
||||
skipped = 0
|
||||
try:
|
||||
for code, name, order_num, remark in ITEM_UNITS:
|
||||
if item_unit_svc.unit_code_exists(db, code, tenant_no):
|
||||
skipped += 1
|
||||
continue
|
||||
item_unit_svc.create_item_unit(
|
||||
db,
|
||||
unit_code=code,
|
||||
unit_name=name,
|
||||
tenant_no=tenant_no,
|
||||
order_num=order_num,
|
||||
remark=remark,
|
||||
user_id=user_id,
|
||||
)
|
||||
created += 1
|
||||
print(f"物品单位初始化完成:新增 {created} 条,跳过 {skipped} 条(编码已存在)。")
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
seed()
|
||||
Reference in new issue
Block a user