Files
guwangtu b91954df4a
CI / check (push) Failing after 15m48s
chore: initial open-source baseline v1.0.0
Signed-off-by: 南通一次元科技有限公司 <guwangtu@icimeta.com>
2026-12-05 15:44:53 +00:00

93 lines
3.1 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""生成 GBK + CRLF 编码的一键启动批处理(cmd.exe 兼容)
启动整套系统:门户 8080 / 审计 8000 / 风险 8001 / 合同 8090。
所有路径均相对于本文件所在目录,不再写死盘符和外部 Python 路径。
"""
import os
BAT_CONTENT = r"""@echo off
chcp 936 >nul
title 审计科综合管理平台 - 一键启动整套系统
echo ==================================================
echo 审计科综合管理平台 - 一键启动整套系统
echo 门户 / 审计 / 风险 / 合同 四个服务
echo ==================================================
echo.
for %%I in ("%~dp0..") do set "ROOT=%%~fI"
set "PORTAL_PY=%~dp0.venv\Scripts\python.exe"
set "AUDIT_PY=%ROOT%\审计项目管理平台\.venv\Scripts\python.exe"
set "RISK_PY=%ROOT%\风险管理项目\.venv\Scripts\python.exe"
set "CONTRACT_PY=%ROOT%\合同审核管理平台\.venv\Scripts\python.exe"
if not exist "%AUDIT_PY%" goto :missing_env
if not exist "%RISK_PY%" goto :missing_env
if not exist "%CONTRACT_PY%" goto :missing_env
if not exist "%PORTAL_PY%" goto :missing_env
call :start_one 8000 "审计管理系统" "%ROOT%\审计项目管理平台" "%AUDIT_PY%" start_audit_server.py
call :start_one 8001 "风险管理系统" "%ROOT%\风险管理项目" "%RISK_PY%" main.py
call :start_one 8090 "合同审核系统" "%ROOT%\合同审核管理平台" "%CONTRACT_PY%" portal_server.py
call :start_one 8080 "门户服务" "%~dp0." "%PORTAL_PY%" portal_server.py
echo.
echo ==================================================
echo 全部服务已处理完成!
echo 门户地址: http://localhost:8080/
echo 审计系统: http://localhost:8000/
echo 风险系统: http://localhost:8001/
echo 合同审核: http://localhost:8090/
echo ==================================================
echo.
echo 正在打开浏览器...
ping -n 4 127.0.0.1 >nul
start http://localhost:8080/
echo 按任意键关闭此窗口(服务继续在后台运行)
pause >nul
exit /b 0
:start_one
set "PORT=%~1"
set "TITLE=%~2"
set "WORKDIR=%~3"
set "PY=%~4"
set "SCRIPT=%~5"
netstat -ano | findstr ":%PORT% " | findstr "LISTENING" >nul 2>&1
if %errorlevel% equ 0 (
echo [跳过] %TITLE% 端口 %PORT% 已在运行
goto :eof
)
echo [启动] %TITLE% 端口 %PORT% ...
start "%TITLE%" /min /D "%WORKDIR%" "%PY%" %SCRIPT%
ping -n 2 127.0.0.1 >nul
goto :eof
:missing_env
echo [错误] 有项目缺少虚拟环境 .venv,请先创建环境并安装依赖。
echo 审计: %AUDIT_PY%
echo 风险: %RISK_PY%
echo 合同: %CONTRACT_PY%
echo 门户: %PORTAL_PY%
echo.
echo 依赖安装命令示例:
echo uv venv .venv --python 3.12
echo uv pip install --python .venv\Scripts\python.exe fastapi "uvicorn[standard]" python-multipart python-docx pypdfium2 Pillow pytesseract openai openpyxl PyPDF2
pause
exit /b 1
"""
def main() -> None:
out_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "启动平台.bat")
content = BAT_CONTENT.replace("\r\n", "\n").replace("\n", "\r\n")
with open(out_path, "w", encoding="gbk", newline="") as f:
f.write(content)
print(f"OK - 已生成 {out_path}(GBK + CRLF)")
if __name__ == "__main__":
main()