refactor: 完成项目目录重构与代码迁移

本次提交完成了整体项目的目录梳理与代码迁移:
1.  将根级controlplane、webhost等目录的代码迁移至desktop/对应子目录,统一桌面端架构
2.  移动并整理了插件目录结构,将插件统一放入根级plugins/
3.  调整了前端项目的路径与配置,统一前后端开发构建流程
4.  清理了废弃的旧版app/目录与冗余的构建中间文件
5.  更新了.gitignore与README.md,适配新的项目结构
This commit is contained in:
2026-09-14 17:46:09 +08:00
parent a1a06504a5
commit 0ab43d0ed8
131 changed files with 4071 additions and 38034 deletions
+63
View File
@@ -0,0 +1,63 @@
# -*- coding: utf-8 -*-
"""考勤月报封存检查 - Excel 报告导出(webhost 场景插件)
与 plugins/seal_check/report.py 保持同步(根级 plugins/ 为单一真源)。
输出:考勤月报封存检查_{月份}_{时间戳}.xlsx(汇总 + 检查1~5 Sheet,空 Sheet 保留表头)
"""
import os
from datetime import datetime
from typing import Dict, List
from webhost.backend.plugins.seal_check import config
from webhost.backend.plugins.seal_check.logic import OUTPUT_COLUMNS, TYPE_1, TYPE_3, TYPE_4, TYPE_5
CHECK_TAB_TITLES = {
1: "检查1_在职天数排班异常",
2: "检查2_排休天数异常",
3: "检查3_封存非最新值",
4: "检查4_出勤天数异常",
5: "检查5_未封存名单",
}
CHECK_DESCRIPTIONS = {
1: TYPE_1,
2: "当月排休不满足……天规则(动态)",
3: TYPE_3,
4: TYPE_4,
5: TYPE_5,
}
def export_report(rows_map: Dict[int, List[dict]], month: str, notes: List[str] = None,
save_dir: str = None) -> str:
try:
import pandas as pd
except ImportError:
raise RuntimeError("缺少 pandas / openpyxl 依赖,无法导出 Excel")
save_dir = save_dir or config.SAVE_DIR
os.makedirs(save_dir, exist_ok=True)
ts = datetime.now().strftime("%Y%m%d_%H%M%S")
path = os.path.join(save_dir, f"考勤月报封存检查_{month}_{ts}.xlsx")
with pd.ExcelWriter(path, engine="openpyxl") as writer:
summary = []
for i in range(1, 6):
n = len(rows_map.get(i, []))
summary.append({
"检查项": CHECK_TAB_TITLES[i],
"命中条数": n,
"异常类型": CHECK_DESCRIPTIONS[i],
"说明": "详见对应 Sheet" if n else "无异常",
})
if notes:
summary.append({"检查项": "备注", "命中条数": len(notes),
"异常类型": "", "说明": ";".join(notes)})
pd.DataFrame(summary).to_excel(writer, sheet_name="汇总", index=False)
for i in range(1, 6):
df = pd.DataFrame(rows_map.get(i, []), columns=OUTPUT_COLUMNS)
df.to_excel(writer, sheet_name=CHECK_TAB_TITLES[i], index=False)
return path