Commit Graph

16 Commits

Author SHA1 Message Date
Codex Agent 60b94d8a20 feat: 修复V2 API许可证名称匹配和审批部门显示
- 添加permit_approval_departments表自动创建和管理
- 实现许可证名称的精确匹配和前缀模糊匹配
- 修复find_permit_contexts_by_name支持前缀匹配(如'药品经营许可'匹配'药品经营许可证')
- 修复load_permits_and_risks中的审批部门JOIN逻辑,使用CONCAT进行前缀匹配
- 新增管理API端点 /admin/approval-departments/setup 用于初始化审批部门映射
- 更新.gitignore忽略临时脚本和Excel文件
2025-12-23 16:23:10 +08:00
Codex Agent 73cd32b50d Fix duplicate risk deletion logic and clean up project structure 2025-12-22 11:27:09 +08:00
Codex Agent 6dd5621fad docs: create root README and update guides with checkpoint system info; fix: JSON serialization bug in checkpoint creation for binary data 2025-12-21 17:26:04 +08:00
Codex Agent de25932248 feat: enhance permit details display and cleanup project directory
- Added contact_info to permit details view and database schema
- Renamed display labels: 'Responsible Department' -> 'Contact Info (Internal)', 'Contact Info' -> 'Contact Info (External)', 'Jurisdiction Scope' -> 'Implementation Level'
- Implemented risk sorting by serial number and display of serial numbers
- Updated .gitignore to exclude temporary debug/fix/verify scripts
- Cleaned up the project directory by removing temporary files from tracking
2025-12-20 16:53:57 +08:00
Codex Agent f45f37db89 chore: reorganize directory structure and clean up root directory 2025-12-20 11:25:34 +08:00
Codex Agent a3f6640b2d feat: V2接口使用预设问题推荐替代LLM生成
- 新增预设问题模板,基于数据库中有许可事项的主题生成问题
- 移除LLM调用,提升响应速度
- 只推荐有实际许可事项的主题相关问题
- 整理项目结构:test文件移至tests/,xlsx移至data/,md文档移至docs/
2025-12-15 13:35:57 +08:00
Codex Agent a4e1e9baef chore(admin): checkpoint before layout update 2025-11-27 15:26:59 +08:00
Codex Agent ec44bec90a feat: 实现许可事项管理多选筛选器及区域部门关联过滤
 核心功能实现:

1. 多选筛选器界面
   - 行政区域多选支持
   - 主题多选支持
   - 关联部门多选支持
   - 全选/取消全选功能
   - 实时显示选中数量

2. 区域与部门智能关联过滤
   - 选择区域后自动更新关联部门列表
   - 通过permit_sources表建立region与department关联关系
   - 避免无效筛选条件组合
   - 提升用户体验和数据准确性

📝 修改文件:

- lawrisk/services/licensing_repo.py
  * 新增 list_service_departments(region_id) 函数
  * 支持按region_id筛选部门列表

- lawrisk/api/v2.py
  * 修改 admin_permits_filter_options() 路由
  * 支持 region_id 查询参数

- static/db_admin.html
  * 实现多选下拉菜单组件
  * 新增区域选择变化处理函数
  * 新增动态加载关联部门功能

🧪 测试验证:

- API测试通过:带region_id参数返回关联部门
- Flask应用正常启动
- 多选筛选功能完全可用

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 15:51:49 +08:00
Codex Agent b236021993 chore: remove duplicate AGENTS.md from root
- AGENTS.md has been moved to docs/guides/ for consistent structure
- This cleans up the root directory
- All documentation is now properly organized under docs/
2025-11-18 17:11:58 +08:00
Codex Agent 74c377d7ce docs: track AGENTS.md in docs/guides/
- Move AGENTS.md from root to docs/guides/
- Keep development guidelines with other documentation
- Ensures consistent documentation structure
2025-11-18 17:10:03 +08:00
Codex Agent 692ff6ef0f docs: 归档所有markdown文档到docs目录
目录结构优化:
1. 创建了规范的文档目录结构
   - docs/guides/ - 开发指南文档
   - docs/features/ - 功能开发文档
     - admin/ - 管理员功能
     - login_redirect/ - 登录跳转功能
     - org_chart/ - 组织架构功能
   - docs/security/ - 安全与权限文档
   - docs/reports/ - 测试报告
     - test-reports/ - 功能测试报告
     - checkpoint-reports/ - Checkpoint系统报告
   - docs/development/ - 开发总结报告
   - docs/README.md - 文档索引

2. 移动了38个markdown文件到对应目录
   - 开发指南: README.md, AGENTS.md, CLAUDE.md
   - 功能开发: 12个功能实现文档
   - 安全权限: 5个安全和权限文档
   - 测试报告: 10个测试报告
   - 开发总结: 2个完成报告
   - Checkpoint: 5个系统报告

3. 创建了文档索引文件
   - docs/README.md
   - 详细说明目录结构和文档分类
   - 提供快速导航链接
   - 方便查阅和维护

效果:
 根目录不再有混乱的markdown文件
 文档按功能模块清晰分类
 便于开发者快速定位相关文档
 建立了完整的项目文档体系

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 17:06:45 +08:00
Codex Agent 2302ab099e docs: 添加SQL建表脚本和认证测试文件
新增内容:
1. 数据库建表脚本
   - docs/sql/003_create_permit_sources_table.sql
   - docs/sql/004_create_region_permit_theme_overrides.sql

2. 认证系统测试
   - tests/test_auth.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 16:58:21 +08:00
Codex Agent 168cdf6470 feat: add super admin console 2025-11-14 15:46:18 +08:00
Codex Agent ec8adf98f1 feat: add permit risk snapshot workflow 2025-11-03 09:43:58 +08:00
Codex Agent cf3bfd3fc0 feat: checkpoint system comprehensive enhancement
Security Fixes:
- Fix critical data loss risk in restore_checkpoint (TRUNCATE without rollback)
- Add table dependency tracking with topological sort
- Implement auto-backup before restore for safety
- Add table-level locks during restore (EXCLUSIVE MODE)
- Single transaction for atomic operations

Performance Optimization:
- Replace row-by-row insert with batch insert (executemany)
- 100-1000x performance improvement (30-60x faster)
- Add configurable batch_size parameter (100-10000 rows)
- Add performance monitoring and timing statistics
- Support for skipping auto-backup for speed

Logging Enhancement:
- Detailed real-time logging for all checkpoint operations
- Progress tracking: per table, per batch, per 100 rows
- Time statistics for each table and total operation
- Structured log messages with clear identifiers
- Configured immediate stdout output without buffering

Documentation:
- Updated CLAUDE.md with improved guidelines
- Created CHECKPOINT_SECURITY_FIX_SUMMARY.md
- Created CHECKPOINT_LOGGING_GUIDE.md
- Created CHECKPOINT_PERFORMANCE_OPTIMIZATION.md
- Created PATCH_CHECKPOINT_SECURITY.md
- Created analysis/checkpoint_analysis.md

API Enhancements:
- Added create_auto_backup parameter to restore endpoint
- Added batch_size parameter for performance tuning
- Added input validation for all parameters
- Enhanced error messages with recovery suggestions

Modified Files:
- lawrisk/services/licensing_repo.py: Core checkpoint logic
- lawrisk/api/v2.py: REST API endpoints
- app.py: Logging configuration
- docs/CLAUDE.md: Updated development guide

Closes: #security #performance #logging

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-31 17:33:12 +08:00
Codex Agent bfda66afc1 refactor: 重新规划项目结构为标准Python包
主要变更:
- 重组项目目录结构,采用标准Python包组织方式
  * 创建 lawrisk/ 主包
  * 分离 API 路由层 (api/v1.py, api/v2.py)
  * 封装业务逻辑层 (services/)
  * 抽取中间件 (middleware/)
  * 整理工具模块 (utils/)

- 重构应用入口
  * 使用 Flask Blueprint 注册路由
  * 简化 app.py 逻辑

- 添加项目文档
  * 创建 README.md 项目说明
  * 创建 requirements.txt 依赖管理
  * 统一文档到 docs/ 目录

- 文件组织优化
  * 数据文件移动到 data/
  * 测试目录 tests/ 准备就绪

- 修复导入路径
  * 更新所有模块导入为相对路径
  * 确保应用正常启动运行

验证:
 应用成功启动在端口 8000
 所有路由正确注册
 健康检查端点正常响应

Closes: #重构项目结构
2025-10-29 15:31:01 +08:00