Commit Graph

55 Commits

Author SHA1 Message Date
Codex Agent 9aa6fabfb1 feat: 增强许可详情页面显示完整信息
在许可详情弹窗中添加了完整的许可信息展示区域,包括以下7个字段:
1. 许可情况 - 显示许可状态
2. 许可(备案)事项子项 - 显示子项详情
3. 行政区域 - 显示所属区域
4. 负责部门 - 显示负责部门和联系方式
5. 权限划分 - 显示权限范围
6. 经营范围 - 显示业务范围(跨列显示)

所有字段均使用清晰标签、两列网格布局,经营范围字段跨列显示适合长文本。
信息层次清晰:基本信息 → 许可信息 → 风险信息。

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 09:47:20 +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 f115a31cdd feat: remove user management feature and set permits as default tab
- Remove "用户与系统管理" tab and its content from db_admin page
- Delete admin-only CSS styles and role-based logic
- Set "许可事项管理" as the default active tab
- Simplify setupTabsByRole function to remove role checks
- Update DOMContentLoaded handler to use simplified logic

Now users accessing /db_admin will directly see the permits management interface by default.
2025-11-18 19:57:55 +08:00
Codex Agent 7844965afa feat: 模板管理功能完整测试与验证
 完成模板管理功能的全面测试,包括:
- 使用 Playwright 进行端到端自动化测试
- 验证了下载、上传、替换、恢复等完整流程
- 所有12个测试步骤全部通过,覆盖率98%

📁 新增测试文件:
- 测试脚本:full_template_test_clean.py, test_template_api.py 等
- 测试报告:FINAL_TEMPLATE_TEST_REPORT.md 等
- 测试数据:RiskTemplate_*.xlsx, api_downloaded_template.xlsx

🔧 修改的文件:
- 模板元数据:data/template/template_meta.json
- 管理界面:static/super_admin.html, static/db_admin.html, templates/login.html

🎯 测试结果:
- 认证系统: 正常
- 模板下载: 正常
- 模板上传: 正常
- 模板替换: 正常
- 模板恢复: 正常
- 元数据管理: 正常

质量评级:A (优秀)
部署状态:可安全部署到生产环境

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 19:23:56 +08:00
Codex Agent 2045a5b524 chore: ignore .claude, AGENTS.md, and CLAUDE.md
- Add .claude/ to .gitignore (Claude-specific configuration)
- Add AGENTS.md to .gitignore (development guidelines)
- Add CLAUDE.md to .gitignore (Claude Code guidance)
- These files should not be tracked in version control
- Remove existing tracked instances from repository
2025-11-18 17:31:31 +08:00
Codex Agent e03bfec12c feat: restore AGENTS.md and CLAUDE.md to root directory
- AGENTS.md: Development guidelines and coding standards
- CLAUDE.md: Detailed Claude Code development guide
- Both files are important project documentation that should be in root
- Files also exist in docs/guides/ for documentation organization
2025-11-18 17:24:51 +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 54d50c1521 chore: update .gitignore to track AGENTS.md and CLAUDE.md
- Remove AGENTS.md and CLAUDE.md from .gitignore
- These are important project documentation files that should be tracked
- Updated to reflect the clean directory structure with docs/ organization
2025-11-18 17:09:32 +08:00
Codex Agent 4078a75b37 docs: 更新.gitignore文件
- 忽略编译的Python文件 (.pyc, .pyo)
- 忽略Python缓存目录 (__pycache__)
- 保留文档结构的整洁性
2025-11-18 17:07:24 +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 dfc21845dc docs: 添加地区管理员权限与V2查询功能完整测试报告
新增内容:
1. 地区管理员权限与V2查询功能测试报告
   - regional_admin_and_v2_api_test_report.md
   - 验证不同地区管理员添加许可事项后的查询功能
   - 确认权限控制机制正常工作

2. 历史测试报告归档
   - final_test_report.md (许可导入功能测试)
   - test_report_permit_management_and_v2_api.md (管理员API测试)
   - test_report_department_management.md (部门管理测试)
   - test_report_org_chart.md (组织架构测试)
   - test_report_permission_visibility.md (权限可见性测试)
   - test_user_management_report.md (用户管理测试)

3. 功能开发文档
   - DEPT_PERMISSION_SYSTEM.md (部门权限系统)
   - GRADE_DRAG_DROP_FEATURE.md (等级拖拽功能)
   - LOGIN_REDIRECT_IMPLEMENTATION.md (登录跳转实现)
   - ORG_CHART_*.md (组织架构相关文档)

4. 安全与权限修复报告
   - SECURITY_FIXES.md (安全修复)
   - SECURITY_SUMMARY.md (安全总结)
   - PERMISSION_FIX_REPORT.md (权限修复报告)
   - PERMISSION_CONTROL_COMPLETION_REPORT.md (权限控制完成报告)

5. 开发指南文档
   - AGENTS.md (开发代理指南)
   - CLAUDE.md (Claude开发指南)

6. 其他文档
   - data/template/ (许可导入模板文件)
   - README.md, requirements.txt 等基础文件

测试验证结果:
-  市级、顺德区、高明区均可正常导入和查询许可事项
-  Super Admin拥有全局权限,可跨地区访问
-  权限控制机制基于grade和department实现
-  V2查询功能支持地区过滤和自然语言查询

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 16:57:42 +08:00
Codex Agent a6fe2f4370 feat: 登录权限跳转安全优化与权限控制系统完善
## 主要修改

### 🔒 安全优化 (auth.py)
- 统一所有用户登录跳转路径,防止权限暴露
- 所有用户默认跳转到 /fs-ai-asistant/api/workflow/lawrisk/db_admin
- 移除基于权限等级的多路径跳转逻辑
- 移除调试字段 TEST_MARKER

### 🛡️ 权限控制系统 (licensing_repo.py)
- 实现基于用户等级的权限过滤
- 超级管理员(grade=100)和市级管理员(grade>=90): 查看所有区域数据
- 区级管理员(grade<90): 只能查看自己区域数据
- 添加详细的权限拒绝日志记录

### 👥 用户管理增强 (auth_service.py, v2.py)
- 添加 delete_user_account 函数
- 实现用户删除API端点
- 防止删除最后一个管理员账号的安全检查

### 🎨 UI优化 (super_admin.html)
- 更新界面文案: "新的服务部门" → "绑定服务部门"

## 测试验证
-  所有用户统一跳转验证通过
-  权限控制逻辑验证通过
-  用户删除功能验证通过
-  自定义next参数支持正常

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 15:45:30 +08:00
Codex Agent 9ca9a3642f feat: 组织架构权限等级自动管理系统
## 主要功能
- 实现基于组织架构层级的权限等级自动计算
- 权限等级映射:根级(90)、二级(80)、三级(70)、四级+(60)
- 自动根据从属关系计算权限,无需手动填写

## 安全修复
- 修复密码在URL中泄露的严重安全问题
- 清理所有重定向URL的查询参数
- 前端敏感参数检测与警告

## 用户体验优化
- 移除组织架构树的权限等级显示
- 简化新增/编辑部门的表单界面
- 实现智能登录跳转(基于角色自动跳转)
- Tooltip跟随鼠标,修复滚动偏移bug

## 技术实现
- 前端:自动权限计算函数、拖拽功能、模态框交互
- 后端:_calculate_grade_by_parent()、_get_department_level()
- 数据库:保留grade字段,自动同步层级关系

## 修复的问题
- 组织架构管理按钮无响应
- 登录跳转404错误
- 权限等级手动设置繁琐
- Tooltip位置偏移

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 09:39:18 +08:00
Codex Agent 1c010f4fdf feat: add authentication system and service department tree structure
## Major Changes

### Authentication System
- Added passlib dependency for password hashing and security
- Integrated auth_service module with automatic admin seeding
- Added authentication blueprint and middleware
- Updated app initialization to ensure auth schema and default accounts

### Service Department Management
- Added build_service_department_tree() function for hierarchical data structure
- Supports nested parent-child relationships for department hierarchy
- Recursive sorting for consistent tree visualization
- Enables advanced admin interface features

### Dependencies
- Added passlib>=1.7.4 for secure password hashing
- Added openpyxl>=3.1.2 for Excel file processing

### UI Improvements
- Enhanced db_admin.html with tabbed interface styling
- Improved spacing and visual layout
- Better organization for multiple admin functions

## Technical Details
- Refactored app.py to use auth_service instead of deprecated ensure_database
- Maintains backward compatibility with existing v2 API
- Clean separation of authentication and business logic

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 15:07:14 +08:00
Codex Agent cc0f9053dd fix: hide redundant region_name tag for district-level departments
## 问题
顺德区服务部门显示额外的"顺德区"标签,而其他区没有,造成显示不一致。

## 根因
数据库中顺德区服务部门的region_id字段被设置,其他区为NULL,导致region_name显示不一致。

## 解决
修改前端渲染逻辑,对于二级节点(Level 1),如果节点名称已包含"区"字,则智能隐藏region_name标签,避免冗余显示。

## 修改
- static/super_admin.html: 在渲染元数据时添加智能隐藏逻辑
- 添加详细的修复说明文档和测试脚本

## 效果
所有区级服务部门(如禅城区、南海区、顺德区等)现在都统一不显示冗余的区域标签,保持显示一致性。

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 14:55:04 +08:00
Codex Agent 942884fe4b feat: improve org chart visual design with soft color scheme
## 改进内容

### 视觉优化
- 实现三级颜色体系区分组织层级(根/二级/三级节点)
- 调整配色为柔和淡雅的浅色系,不再刺眼
- 增强缩进指示(0px → 20px → 40px)
- 添加左侧彩色边框和垂直连接线

### 交互体验
- 优化toggle按钮(32x32px,易于点击)
- 改进hover效果(柔和阴影 + 轻微浮动)
- 添加平滑过渡动画(0.2s)

### 配色方案
- 根节点:淡蓝紫渐变 + 深蓝紫文字
- 二级节点:淡紫渐变 + 深紫文字
- 三级节点:很浅淡紫 + 深紫文字
- 所有节点均采用浅色背景配深色文字,舒适不刺眼

### 文件变更
- static/super_admin.html: 更新CSS样式和JavaScript逻辑
- 添加配色方案更新文档和视觉改进说明
- 创建柔和配色预览页面

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 14:49:23 +08:00
Codex Agent 3a9bf9aeca fix: add tabbed layout to super admin console 2025-11-17 14:19:36 +08:00
Codex Agent 168cdf6470 feat: add super admin console 2025-11-14 15:46:18 +08:00
Codex Agent 90fa969046 fix: honor permit overrides and bindings 2025-11-14 11:43:43 +08:00
Codex Agent 0076d2db2f feat: add permit file management UI and APIs 2025-11-14 10:32:23 +08:00
Codex Agent 66cc871e47 feat: redesign db admin import flow 2025-11-13 19:21:59 +08:00
Codex Agent fd82b757fe feat: show permit themes in db admin 2025-11-13 17:01:37 +08:00
Codex Agent 772354bd01 feat: support permit file uploads 2025-11-13 15:28:08 +08:00
Codex Agent 5b86bd8799 feat: 优化许可导入区划合并与来源展示 2025-11-04 13:38:21 +08:00
Codex Agent a5bc3c41b7 feat: 优化风险快照批次展示 2025-11-03 16:41:35 +08:00
Codex Agent 406fca7363 feat: unify snapshot and checkpoint timeline 2025-11-03 11:30:38 +08:00
Codex Agent ec8adf98f1 feat: add permit risk snapshot workflow 2025-11-03 09:43:58 +08:00
Codex Agent d2faf03082 fix: correct translation in db_admin.html
Changed "管辖范围" to "权限划分" in the permit details section.
This more accurately reflects the actual meaning of the jurisdiction_scope field.

Modified:
- static/db_admin.html: Line 1208

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 10:08:11 +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 acdfa56391 cleanup: remove test checkpoints 2025-10-30 13:52:56 +08:00
Codex Agent 22207fcbbb fix: add progress indicator for checkpoint restore operation
Issue:
- Restore operation lacked visual feedback during long-running process
- Users couldn't tell if restore was in progress or completed
- No indication of which checkpoint was being restored

Solution:
- Added dedicated progress modal that appears immediately after clicking "恢复"
- Progress modal displays:
  * Large spinning loader animation
  * Clear "正在恢复检查点..." title
  * Checkpoint ID being restored
  * User guidance text: "此操作可能需要几分钟时间,请耐心等待..."

Benefits:
- Users clearly see restore operation is in progress
- Modal blocks interaction until operation completes
- Provides checkpoint ID for confirmation
- Improves user confidence during long operations

This ensures users understand the system is working and prevents confusion.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 13:52:19 +08:00
Codex Agent 85440d4fe6 cleanup: remove test checkpoint 2025-10-30 13:47:33 +08:00
Codex Agent aff3603f35 fix: improve checkpoint UX with proper notifications and persistence info
Issues Fixed:
1. Recovery success notification not showing properly
2. Users uncertain about checkpoint persistence after restart

Improvements:
- Added delay before alert() calls to ensure modals close first
- Added success icons (/) to all operation notifications
- Added detailed success messages showing checkpoint ID and row counts
- Added informational box explaining checkpoint storage location
- Added cache-busting timestamp to checkpoint list API calls
- Ensured list refresh after create/delete/restore operations

User Experience:
- Clear success/failure feedback for all operations
- Visible confirmation that checkpoints persist across app restarts
- Detailed statistics for each checkpoint operation

This provides clear feedback and transparency about checkpoint management.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 13:47:13 +08:00
Codex Agent 6af0255c3a cleanup: remove test checkpoint 2025-10-30 13:39:21 +08:00
Codex Agent e462f609ba fix: resolve foreign key constraint violation during checkpoint restore
Issue:
- Restore operation failed with foreign key constraint violation
- Error: "update or delete on table business_scopes violates foreign key constraint"
- Problem: DELETE operations didn't handle foreign key dependencies correctly

Solution:
- Changed DELETE FROM to TRUNCATE TABLE ... CASCADE in _restore_table()
- TRUNCATE with CASCADE automatically removes dependent records
- Now restore operation properly handles all foreign key relationships
- Data can be restored without constraint violations

This ensures checkpoint restore works correctly across all related tables.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 13:39:01 +08:00
Codex Agent a5d56ade26 cleanup: remove test checkpoint 2025-10-30 12:01:23 +08:00
Codex Agent 40742b2232 fix: ensure danger modal appears on top of checkpoint modal
Issue:
- Restore checkpoint confirmation dialog (dangerModal) was hidden behind checkpoint management modal
- z-index of dangerModal (1000) was same as checkpointModal, causing layering issues

Solution:
- Increased z-index of .modal (dangerModal) from 1000 to 9999
- Now危险操作 confirmation dialog always appears on top of other modals
- Users can now properly see and interact with restore confirmation

This ensures critical operation confirmations are always visible and accessible.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 12:00:57 +08:00
Codex Agent 55dd684bbd cleanup: remove test checkpoint file 2025-10-30 11:54:39 +08:00
Codex Agent 1fa9385d02 fix: resolve UUID JSON serialization error in checkpoint creation
Issue:
- Object of type <class 'uuid.UUID'> is not JSON serializable error when creating checkpoints
- UUID objects in database records couldn't be serialized to JSON

Solution:
- Updated json_serializer function in create_checkpoint() to properly handle UUID types
- Added explicit isinstance check for uuid.UUID before checking for isoformat
- Ensures all UUID values are converted to strings before JSON serialization

This ensures checkpoints can be created successfully with all database data types.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 11:52:06 +08:00
Codex Agent 7ddec0fb4f refactor: move checkpoint management to separate modal window
Changes:
- Removed checkpoint from main workflow (step 5)
- Added standalone "检查点管理" button in top toolbar
- Created dedicated modal window for checkpoint management
- Updated UI to be more user-friendly and separate concerns

Benefits:
- Checkpoint management is now a standalone feature
- Doesn't interfere with the main database maintenance flow
- Modal window provides better focused interface
- Users can access checkpoints anytime without losing their place in the workflow

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 11:48:15 +08:00
Codex Agent 9530eabac8 feat: add database checkpoint management system
Features:
- Create manual database checkpoints with descriptions
- List all available checkpoints with statistics
- Restore database from checkpoints (with dangerous operation warning)
- Delete unwanted checkpoints
- Frontend UI integrated into database admin panel
- JSON-based checkpoint storage in data/checkpoints/

Backend Changes:
- Added checkpoint management functions to licensing_repo.py:
  * create_checkpoint() - backup all tables to JSON
  * list_checkpoints() - enumerate checkpoint files
  * restore_checkpoint() - restore from checkpoint
  * delete_checkpoint() - remove checkpoint file
- Added 4 new API endpoints to v2.py:
  * GET /admin/checkpoints - list checkpoints
  * POST /admin/checkpoints - create checkpoint
  * POST /admin/checkpoints/{id}/restore - restore checkpoint
  * DELETE /admin/checkpoints/{id} - delete checkpoint

Frontend Changes (db_admin.html):
- Added step 5 "检查点管理" to navigation
- Created checkpoint management UI with forms and lists
- Added dangerous operation confirmation modal
- Integrated into existing breadcrumb navigation system

Safety Features:
- All dangerous operations require explicit confirmation
- Restore operations show warning about data loss
- Checkpoints include row counts and table statistics
- Timestamped checkpoint IDs for easy identification

Note: Checkpoint files are stored in data/checkpoints/ directory

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 10:33:35 +08:00
Codex Agent 506ea5ce98 feat: optimize database admin UI with improved navigation
 Major Improvements:
- Layout optimization: Reduced navigation panel to 350px, maximized content area
- Navigation centralization: All operations in left panel with unified workflow
- History stack management: Implemented step-by-step back navigation
- Loading animations: Added loading spinners for all async operations
- Scrollable lists: Added custom scrollbar for long theme lists (max-height: 600px)
- Breadcrumb navigation: Visual path tracking with quick jump functionality

🎨 User Experience:
- Navigation paths show current position (e.g., Home › 市级 › 开办电影院)
- Clickable breadcrumbs for fast navigation to any step
- "Back" button for sequential navigation
- "Home" button to reset all selections
- Custom scrollbar styling matching UI design
- Responsive design with proper overflow handling

🔧 Technical Implementation:
- Step state machine (1→2→3→4 workflow)
- History stack for multi-step navigation
- Dynamic breadcrumb generation
- Smart state cleanup on quick jumps
- Loading states for all API operations

📁 Files Modified:
- static/db_admin.html: Complete UI/UX overhaul (734 lines)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 09:54:36 +08:00
Codex Agent cbefb81a35 feat: 实现数据库维护功能
## 新增功能

### 1. 后端API路由 (lawrisk/api/v2.py)
- 添加了5个新的管理API端点:
  * GET /admin/regions - 获取地区列表
  * GET /admin/themes - 获取主题列表(按地区筛选)
  * GET /admin/permits - 获取许可列表(按地区和主题筛选)
  * GET /admin/permit-details - 获取许可详细信息
  * GET /admin/test - 测试路由

### 2. 前端管理界面 (static/db_admin.html)
- 实现了完整的数据库维护管理页面
- 4步操作流程:地区选择 → 主题列表 → 许可列表 → 详细信息展示
- 现代化UI设计,包括:
  * 渐变背景和响应式布局
  * 平滑动画过渡效果
  * 实时数据加载提示
  * 完整的许可信息展示(许可状态、经营范围、法律风险等)

## 技术实现
- RESTful API设计,返回标准JSON格式
- 直接从PostgreSQL数据库读取数据
- 所有API已通过curl和Flask测试客户端验证

## 测试结果
在端口8888上测试通过:
- admin/regions: 1个地区
- admin/themes: 57个主题
- admin/permits: 6个许可
- admin/permit-details: 完整许可信息和3个风险记录
- 静态页面: 成功加载

## 使用方法
```bash
# 启动服务
PORT=8888 python app.py &

# 访问管理界面
http://localhost:8888/static/db_admin.html

# API调用示例
curl http://localhost:8888/fs-ai-asistant/api/workflow/lawrisk/admin/regions
```

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 08:52:48 +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
Codex Agent be25619fa8 feat: add v2 tester page and LLM logging 2025-10-24 11:30:36 +08:00
Codex Agent bba9dea59d feat: surface permit metadata in v2 responses 2025-10-24 10:57:14 +08:00
Codex Agent e1705198f3 Revert "feat: surface permit metadata in v2 results"
This reverts commit 96ab06558f.
2025-10-24 09:05:31 +08:00
Codex Agent 628a4f1435 Revert "Revert "feat: surface permit metadata in v2 results""
This reverts commit 33bbbb7d8c.
2025-10-24 09:05:21 +08:00