refactor: 完成项目代码结构优化与权限清理

主要变更:
1. 重构健康检查模块,迁移目录结构并合并重复代码
2. 清理路由标签冗余的"系统管理/平台管理"前缀,简化标签名称
3. 重构工作流相关目录与API,统一命名为flow和nodes
4. 重命名缓存删除接口为clear,同步前后端路由与权限
5. 简化接口参数描述,统一批量状态修改的请求体格式
6. 重构动态路由加载逻辑,优化初始化流程
7. 清理废弃的self_service模块,整合租户自助服务到租户API
8. 重构发票管理接口,统一路由前缀与权限控制
9. 优化代码生成模板,补全参数注解与描述
10: 修复日志删除接口的参数解析逻辑
This commit is contained in:
zhangtao
2026-07-02 00:10:02 +08:00
parent fa5bfc2a4f
commit 64bd82ee75
74 changed files with 1434 additions and 1547 deletions
@@ -51,7 +51,7 @@ from .service import (
TenantRegisterService,
)
AuthRouter = APIRouter(route_class=OperationLogRoute, prefix="/auth", tags=["系统管理", "认证授权"])
AuthRouter = APIRouter(route_class=OperationLogRoute, prefix="/auth", tags=["认证授权"])
_AUTH_TENANTS_NS = "auth_tenants"
@@ -13,7 +13,7 @@ from app.core.router_class import OperationLogRoute
from .schema import DeptCreateSchema, DeptOutSchema, DeptQueryParam, DeptUpdateSchema
from .service import DeptService
DeptRouter = APIRouter(route_class=OperationLogRoute, prefix="/dept", tags=["系统管理", "部门管理"])
DeptRouter = APIRouter(route_class=OperationLogRoute, prefix="/dept", tags=["部门管理"])
_DEPT_NS = "dept"
@@ -90,7 +90,7 @@ async def delete_obj_controller(
)
async def batch_set_available_obj_controller(
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:dept:patch"]))],
data: Annotated[BatchSetAvailable, Body(description="批量修改部门状态参数")],
data: Annotated[BatchSetAvailable, Body(description="状态设置")],
) -> JSONResponse:
await DeptService(auth).batch_set_available(data=data)
await FastAPICache.clear(namespace=_DEPT_NS)
@@ -25,7 +25,7 @@ from .schema import (
)
from .service import DictDataService, DictTypeService
DictRouter = APIRouter(route_class=OperationLogRoute, prefix="/dict", tags=["系统管理", "字典管理"])
DictRouter = APIRouter(route_class=OperationLogRoute, prefix="/dict", tags=["字典管理"])
_DICT_TYPE_NS = "dict_type"
@@ -121,7 +121,7 @@ async def delete_type_controller(
)
async def batch_set_available_dict_type_controller(
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:dict_type:patch"]))],
data: Annotated[BatchSetAvailable, Body(description="批量修改字典类型状态参数")],
data: Annotated[BatchSetAvailable, Body(description="状态设置")],
) -> JSONResponse:
await DictTypeService(auth).set_available(data=data)
await FastAPICache.clear(namespace=_DICT_TYPE_NS)
@@ -227,7 +227,7 @@ async def delete_data_controller(
)
async def batch_set_available_dict_data_controller(
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:dict_data:patch"]))],
data: Annotated[BatchSetAvailable, Body(description="批量修改字典数据状态参数")],
data: Annotated[BatchSetAvailable, Body(description="状态设置")],
) -> JSONResponse:
await DictDataService(auth).set_available(data=data)
return SuccessResponse(msg="批量修改字典数据状态成功")
@@ -5,7 +5,7 @@ from fastapi.responses import JSONResponse
from app.common.response import ResponseSchema, SuccessResponse
from app.core.base_params import PaginationQueryParam
from app.core.base_schema import AuthSchema, BatchDelete, PageResultSchema
from app.core.base_schema import AuthSchema, PageResultSchema
from app.core.dependencies import AuthPermission, get_current_user
from app.core.router_class import OperationLogRoute
@@ -21,7 +21,7 @@ from .schema import (
)
from .service import LoginLogService, OperationLogService
LogRouter = APIRouter(route_class=OperationLogRoute, prefix="/log", tags=["系统管理", "日志管理"])
LogRouter = APIRouter(route_class=OperationLogRoute, prefix="/log", tags=["日志管理"])
@LogRouter.get(
@@ -137,7 +137,7 @@ async def create_operation_log_controller(
)
async def delete(
auth: Annotated[AuthSchema, Depends(get_current_user)],
data: Annotated[BatchDelete, Body(description="ID列表")],
ids: Annotated[list[int], Body(description="ID列表")],
):
await OperationLogService(auth).delete(ids=data.ids)
await OperationLogService(auth).delete(ids=ids)
return SuccessResponse(msg="删除操作日志成功")
@@ -22,7 +22,7 @@ from .schema import (
)
from .service import NoticeService
NoticeRouter = APIRouter(route_class=OperationLogRoute, prefix="/notice", tags=["系统管理", "公告通知"])
NoticeRouter = APIRouter(route_class=OperationLogRoute, prefix="/notice", tags=["公告通知"])
_NOTICE_NS = "notice"
@@ -103,7 +103,7 @@ async def delete_notice_controller(
)
async def batch_set_available_notice_controller(
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:notice:patch"]))],
data: Annotated[BatchSetAvailable, Body(description="批量修改公告状态参数")],
data: Annotated[BatchSetAvailable, Body(description="状态设置")],
) -> JSONResponse:
await NoticeService(auth).set_available(data=data)
await FastAPICache.clear(namespace=_NOTICE_NS)
@@ -6,7 +6,7 @@ from redis.asyncio.client import Redis
from app.common.response import ResponseSchema, StreamResponse, SuccessResponse
from app.core.base_params import PaginationQueryParam
from app.core.base_schema import AuthSchema, PageResultSchema
from app.core.base_schema import AuthSchema, BatchSetAvailable, PageResultSchema
from app.core.dependencies import AuthPermission, redis_getter
from app.core.router_class import OperationLogRoute
from app.utils.common_util import bytes2file_response
@@ -14,7 +14,7 @@ from app.utils.common_util import bytes2file_response
from .schema import ParamsCreateSchema, ParamsOutSchema, ParamsQueryParam, ParamsUpdateSchema
from .service import ParamsService
ParamsRouter = APIRouter(route_class=OperationLogRoute, prefix="/param", tags=["系统管理", "参数管理"])
ParamsRouter = APIRouter(route_class=OperationLogRoute, prefix="/param", tags=["参数管理"])
@ParamsRouter.get(
"/detail/{id}",
@@ -117,10 +117,9 @@ async def delete_param_controller(
)
async def batch_set_status_controller(
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:param:patch"]))],
ids: Annotated[list[int], Body(description="参数ID列表")],
status: Annotated[int, Body(description="状态值")],
data: Annotated[BatchSetAvailable, Body(description="状态设置")],
) -> JSONResponse:
await ParamsService(auth).batch_set_status(ids=ids, status=status)
await ParamsService(auth).batch_set_status(ids=data.ids, status=data.status)
return SuccessResponse(msg="批量设置参数状态成功")
@ParamsRouter.get(
@@ -20,7 +20,7 @@ from .schema import (
)
from .service import PositionService
PositionRouter = APIRouter(route_class=OperationLogRoute, prefix="/position", tags=["系统管理", "岗位管理"])
PositionRouter = APIRouter(route_class=OperationLogRoute, prefix="/position", tags=["岗位管理"])
_POS_NS = "position"
@@ -105,7 +105,7 @@ async def delete_obj_controller(
)
async def batch_set_available_obj_controller(
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:position:patch"]))],
data: Annotated[BatchSetAvailable, Body(description="批量修改岗位状态参数")],
data: Annotated[BatchSetAvailable, Body(description="状态设置")],
) -> JSONResponse:
await PositionService(auth).set_available(data=data)
await FastAPICache.clear(namespace=_POS_NS)
@@ -21,7 +21,7 @@ from .schema import (
)
from .service import RoleService
RoleRouter = APIRouter(route_class=OperationLogRoute, prefix="/role", tags=["系统管理", "角色管理"])
RoleRouter = APIRouter(route_class=OperationLogRoute, prefix="/role", tags=["角色管理"])
_ROLE_NS = "role"
@@ -106,7 +106,7 @@ async def delete_role_controller(
)
async def batch_set_available_role_controller(
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:role:patch"]))],
data: Annotated[BatchSetAvailable, Body(description="批量修改角色状态参数")],
data: Annotated[BatchSetAvailable, Body(description="状态设置")],
) -> JSONResponse:
await RoleService(auth).set_available(data=data)
await FastAPICache.clear(namespace=_ROLE_NS)
@@ -18,7 +18,7 @@ from .schema import (
)
from .service import TicketService
TicketRouter = APIRouter(route_class=OperationLogRoute, prefix="/ticket", tags=["系统管理", "工单管理"])
TicketRouter = APIRouter(route_class=OperationLogRoute, prefix="/ticket", tags=["工单管理"])
@TicketRouter.get("/list", summary="工单列表", response_model=ResponseSchema[PageResultSchema[TicketOutSchema]])
async def ticket_list_controller(
@@ -26,7 +26,7 @@ from .schema import (
)
from .service import UserService
UserRouter = APIRouter(route_class=OperationLogRoute, prefix="/user", tags=["系统管理", "用户管理"])
UserRouter = APIRouter(route_class=OperationLogRoute, prefix="/user", tags=["用户管理"])
@UserRouter.get(
"/current/info",
@@ -179,7 +179,7 @@ async def delete_user_controller(
)
async def batch_set_available_user_controller(
auth: Annotated[AuthSchema, Depends(AuthPermission(["module_system:user:patch"]))],
data: Annotated[BatchSetAvailable, Body(description="批量修改用户状态参数")],
data: Annotated[BatchSetAvailable, Body(description="状态设置")],
) -> JSONResponse:
await UserService(auth).set_available(data=data)
return SuccessResponse(msg="批量修改用户状态成功")