Compare commits

...

18 Commits

Author SHA1 Message Date
6e7a62e7f0 feat: 扩展问卷问题管理权限,支持问卷管理员权限
- 后端:PrisonQuestionController 接口增加 prison:questionnaire:update 和 prison:questionnaire:query 权限判断
- 前端:QuestionList.vue 按钮增加 prison:questionnaire:update 权限判断
- 允许拥有问卷模板管理权限的用户也能管理问卷问题
2026-01-28 11:54:39 +08:00
f252c69dd2 fix: 修复社交登录回调解析问题及优化
- 修复 SocialClientServiceImpl 中社交登录回调的 userId 解析逻辑
- 新增 EvaluationTemplateFlattenedRespVO 扁平化响应VO
- 优化 EvaluationTemplateWithDimensionsRespVO 结构
- 更新 pom.xml 依赖版本
2026-01-22 21:09:40 +08:00
1eb543d803 feat(evaluation): 新增模板详情导出功能及代码优化
- 新增导出单个模板及其维度信息的接口
- 修复参数校验缺失问题,添加 @NotNull 校验
- 修复 N+1 查询问题,改用批量查询
- 优化 DateTimeFormatter 为静态常量
- 添加评论列表字段到 VO 类
2026-01-22 12:23:15 +08:00
cff7832d5e feat: 新增监狱综合管理平台数据库迁移脚本
- 创建了完整的数据库迁移脚本,包含罪犯信息、监区信息、监室信息、计分考核、考核规则、消费记录等多个表的定义
- 每个表均包含详细的字段定义和注释,确保数据结构清晰
- 关闭外键检查以支持表的创建,最后恢复外键检查

此脚本为后续系统功能实现提供了基础数据结构支持。
2026-01-22 09:29:05 +08:00
6063256883 fix: 优化评估报告模块权限控制
- 查询接口支持多权限验证(template:query, report:query)
- 维度CRUD操作统一使用 template:update 权限
- 维度数据CRUD操作统一使用 report:update 权限

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-01-21 00:49:12 +08:00
76bdb3a931 feat: 新增AI监控仪表盘功能和监管对象位置字段
- 新增AI监控仪表盘相关接口(监狱概况统计、重点人员查询)
- 新增监管对象位置字段(province/city/district)到各DO实体
- 新增重点人员页面相关VO(FocusPersonPageReqVO、FocusPersonVO)
- 新增AI监控入口菜单SQL脚本
- 新增监管对象位置升级SQL脚本
- 完善监控仪表盘服务实现(实时数据、统计分析、风险预警)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-21 00:17:53 +08:00
0984924431 chore: 提交本地修改后更新子模块 2026-01-20 20:58:33 +08:00
011b505a80 chore: clean up debug artifacts and improve table scrolling
- Remove .DS_Store and console.log statements
- Remove debugger statements from decorate.vue
- Add horizontal scroll support to prison management tables
2026-01-20 20:19:45 +08:00
f620d3bb0c fix: 预警模块字典类型枚举缺失修复
- PrisonerController: 调整 API 路径
- QuickCommentController: 新增获取快捷回复列表接口
- RiskAssessmentRespVO: 添加缺失字段
- SituationRespVO: 添加缺失字段
- SituationDO: 添加缺失字段
- SituationServiceImpl: 完善狱情信息处理逻辑
- prison_dict_data.sql: 新增字典数据
- evaluation_report.sql: 评估报告 SQL 优化

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-20 19:03:04 +08:00
751e1be667 feat(report): 新增评估报告服务实现和配置更新
- 新增 EvaluationReportServiceImpl 服务实现
- 添加 EvaluationDimensionDataSaveReqVO 字段
- 优化 ReportController 和 ReportService
- 新增 ReportUpdateReqVO 请求对象
- 更新 pom.xml 依赖配置
- 更新 application-local.yaml 开发配置

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-20 12:12:46 +08:00
0d46e00ba7 feat: 更新评估报告服务和相关模块
- 计分考核模块新增监区、监室字段
- 问卷答题记录添加关联字段
- 危险评估优化服务逻辑
- 评估报告服务重构数据源处理
- 新增数据库升级脚本

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-19 23:13:07 +08:00
877e691792 修复评估维度配置中dataSources和questions字段返回null的问题
- 添加autoResultMap=true到EvaluationDimensionDO的@TableName注解
- 确保JacksonTypeHandler能正确处理dataSources字段的JSON序列化
2026-01-19 22:19:09 +08:00
f6b0410fda feat(prison): 新增评估报告等模块,集成问卷与危险评估功能
核心变更:
1. 新增模块
   - 评估报告模块 (evaluationreport): 报告生成与编辑
   - 快捷评语模块 (quickcomment): 常用评语管理
   - 报告模板模块 (reporttemplate): 报告模板配置
   - 预警模块 (warning): 风险预警功能
   - 风险模块 (risk): 风险分析功能
   - 情况模块 (situation): 服刑情况跟踪

2. 功能增强
   - 危险评估模块完善: 支持多种评估方法
   - 问卷模块重构: 调查问卷整合到答题记录
   - 罪犯模块: 新增Workbench工作台页面
   - 计分考核: 新增计分规则管理

3. 枚举与配置
   - 新增评估相关枚举: AssessmentType, EvaluationCycle等
   - 统一风险等级枚举
   - 更新字典数据类型常量

4. 数据库
   - 新增 evaluation_report.sql
   - 新增 report_module.sql
   - 新增 prison_situation_warning_risk.sql

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-16 20:13:56 +08:00
dc65ef8d24 refactor: 重构评估模块为答题模块,整合到问卷记录服务
主要变更:
- 删除 assessment 模块,原有功能整合到 questionnaire-record
- 新增 answer 模块处理答题记录
- QuestionnaireRecordServiceImpl 扩展测评执行、评分、统计功能
- 更新枚举类状态定义(1-待测评 2-测评中 3-已完成 4-已过期 5-已取消)
- 消费记录模块新增明细相关接口

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-15 22:35:42 +08:00
bbcf68bdb8 feat: 新增评估模块功能
评估模块:
- AssessmentAnswer 评估答案管理(提交、评分、人工复核)
- AssessmentRecord 评估记录管理(状态流转、完成统计)
- AssessmentResult 评估结果管理(风险等级、管控建议)
- AssessmentStatistics 评估统计分析(按类型、时段统计)

LLM智能评估集成:
- Claude LLM 客户端实现
- 评估上下文构建
- 提示词模板构建
- 风险评估数据聚合

代码审查修复:
- 删除 AreaDO 重复导入
- 移除反射调用改用直接方法
- 11个 Controller 添加参数校验注解
- QuestionServiceImpl 批量更新兼容性修复

新增枚举:
- AssessmentAnswerStatusEnum 答案状态
- AssessmentManualReviewStatusEnum 人工复核状态
- AssessmentRecordStatusEnum 记录状态
- RiskLevelEnum 风险等级
2026-01-15 20:49:42 +08:00
f7f318bed8 fix: 代码审查修复 - 调查问卷模块优化
后端修复:
- QuestionnaireRecordServiceImpl: 修复缩进问题,添加空值校验和ID存在性校验
- QuestionnaireSaveReqVO/RespVO/PageReqVO: 同步DO新增的5个字段
- QuestionnaireMapper: 添加新字段查询条件
- QuestionServiceImpl: 优化批量更新性能,修复缩进问题
- 新增枚举类: QuestionnaireStatusEnum, QuestionnaireRecordStatusEnum, QuestionnaireRecordPassStatusEnum
- 新增数据库迁移脚本: question_add_columns.sql, questionnaire_add_columns.sql

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-15 20:14:32 +08:00
5f9bcfc9b2 feat(prison): 完善监室管理功能及代码优化
- 修复监室状态枚举显示问题,使用标准字典类型
- 优化监区树形选择组件,改用 el-tree-select
- 修复 PrisonerDO.subAreaId 字段相关编译错误
- 优化 CellServiceImpl 关联查询监区名称
- 修复 lambda 表达式变量引用问题
- 配置 Redis 密码 redis_Dbdb2F
2026-01-15 12:16:55 +08:00
8077990e5d feat(prison): 问卷系统批量更新接口及性能优化
- 添加问卷问题批量更新API: POST /prison/question/batch-update
- 修复savePartitions循环调用API问题 (50题只需1次请求)
- 修复onPartitionDragEnd拖拽排序性能问题
- 修复onQuestionDragEnd问题拖拽排序性能问题
- 添加QuestionBatchUpdateReqVO请求对象
- 添加自动填充来源字典SQL (35个选项)
2026-01-13 16:23:55 +08:00
852 changed files with 30745 additions and 22 deletions

BIN
.DS_Store vendored

Binary file not shown.

3
.gitignore vendored
View File

@ -52,3 +52,6 @@ application-my.yaml
/yudao-ui-app/unpackage/
**/.DS_Store
# Generated codegen files
/codegen/

View File

@ -25,6 +25,7 @@
<!-- <module>yudao-module-erp</module>-->
<!-- <module>yudao-module-ai</module>-->
<!-- <module>yudao-module-iot</module>-->
<module>yudao-module-prison</module>
</modules>
<name>${project.artifactId}</name>
@ -45,6 +46,11 @@
<spring.boot.version>3.5.9</spring.boot.version>
<mapstruct.version>1.6.3</mapstruct.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- 编译速度优化配置 -->
<maven.compiler.fork>false</maven.compiler.fork>
<maven.compiler.incremental>true</maven.compiler.incremental>
<maven.test.skip>true</maven.test.skip>
</properties>
<dependencyManagement>

171
sql/prison_dict_data.sql Normal file
View File

@ -0,0 +1,171 @@
-- ============================================
-- 监狱管理模块字典数据
-- ============================================
-- 1. 监管等级 (prison_supervision_level)
INSERT IGNORE INTO system_dict_type (id, name, type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES (2008, '监管等级', 'prison_supervision_level', '0', '服刑人员监管等级', 'admin', NOW(), 'admin', NOW(), 0);
INSERT IGNORE INTO system_dict_data (id, sort, label, value, color_type, css_class, dict_type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES
(200801, 1, '严管级', '1', 'danger', '', 'prison_supervision_level', '0', '需要重点监控', 'admin', NOW(), 'admin', NOW(), 0),
(200802, 2, '普管级', '2', 'warning', '', 'prison_supervision_level', '0', '常规管理', 'admin', NOW(), 'admin', NOW(), 0),
(200803, 3, '宽管级', '3', 'success', '', 'prison_supervision_level', '0', '表现良好,给予更多自主权', 'admin', NOW(), 'admin', NOW(), 0);
-- 2. 风险等级 (prison_risk_level)
INSERT IGNORE INTO system_dict_type (id, name, type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES (2009, '风险等级', 'prison_risk_level', '0', '服刑人员风险等级', 'admin', NOW(), 'admin', NOW(), 0);
INSERT IGNORE INTO system_dict_data (id, sort, label, value, color_type, css_class, dict_type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES
(200901, 1, '低风险', '1', 'success', '', 'prison_risk_level', '0', '低风险,表现稳定', 'admin', NOW(), 'admin', NOW(), 0),
(200902, 2, '中风险', '2', 'warning', '', 'prison_risk_level', '0', '中风险,需要定期关注', 'admin', NOW(), 'admin', NOW(), 0),
(200903, 3, '高风险', '3', 'danger', '', 'prison_risk_level', '0', '高风险,需要重点关注', 'admin', NOW(), 'admin', NOW(), 0),
(200904, 4, '极高风险', '4', 'danger', '', 'prison_risk_level', '0', '极高风险,需要重点监控', 'admin', NOW(), 'admin', NOW(), 0);
-- 3. 服刑人员状态 (prisoner_status)
INSERT IGNORE INTO system_dict_type (id, name, type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES (2010, '服刑人员状态', 'prisoner_status', '0', '服刑人员状态', 'admin', NOW(), 'admin', NOW(), 0);
INSERT IGNORE INTO system_dict_data (id, sort, label, value, color_type, css_class, dict_type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES
(201001, 1, '在押', '1', 'primary', '', 'prisoner_status', '0', '正在服刑', 'admin', NOW(), 'admin', NOW(), 0),
(201002, 2, '假释', '2', 'warning', '', 'prisoner_status', '0', '假释期间', 'admin', NOW(), 'admin', NOW(), 0),
(201003, 3, '暂予监外执行', '3', 'info', '', 'prisoner_status', '0', '暂予监外执行', 'admin', NOW(), 'admin', NOW(), 0),
(201004, 4, '已释放', '4', 'success', '', 'prisoner_status', '0', '已刑满释放', 'admin', NOW(), 'admin', NOW(), 0),
(201005, 5, '已死亡', '5', 'danger', '', 'prisoner_status', '0', '已死亡', 'admin', NOW(), 'admin', NOW(), 0);
-- 4. 文化程度 (prison_education)
INSERT IGNORE INTO system_dict_type (id, name, type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES (2011, '文化程度', 'prison_education', '0', '服刑人员文化程度', 'admin', NOW(), 'admin', NOW(), 0);
INSERT IGNORE INTO system_dict_data (id, sort, label, value, color_type, css_class, dict_type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES
(201101, 1, '文盲', '1', 'info', '', 'prison_education', '0', '未接受过教育', 'admin', NOW(), 'admin', NOW(), 0),
(201102, 2, '小学', '2', 'info', '', 'prison_education', '0', '小学毕业', 'admin', NOW(), 'admin', NOW(), 0),
(201103, 3, '初中', '3', 'primary', '', 'prison_education', '0', '初中毕业', 'admin', NOW(), 'admin', NOW(), 0),
(201104, 4, '高中', '4', 'primary', '', 'prison_education', '0', '高中毕业', 'admin', NOW(), 'admin', NOW(), 0),
(201105, 5, '中专', '5', 'success', '', 'prison_education', '0', '中专毕业', 'admin', NOW(), 'admin', NOW(), 0),
(201106, 6, '大专', '6', 'success', '', 'prison_education', '0', '大专毕业', 'admin', NOW(), 'admin', NOW(), 0),
(201107, 7, '本科及以上', '7', 'success', '', 'prison_education', '0', '本科及以上学历', 'admin', NOW(), 'admin', NOW(), 0);
-- 5. 问卷问题类型 (prison_question_type)
INSERT IGNORE INTO system_dict_type (id, name, type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES (2012, '问卷问题类型', 'prison_question_type', '0', '问卷问题类型', 'admin', NOW(), 'admin', NOW(), 0);
INSERT IGNORE INTO system_dict_data (id, sort, label, value, color_type, css_class, dict_type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES
(201201, 1, '单选', '1', 'primary', '', 'prison_question_type', '0', '单选题', 'admin', NOW(), 'admin', NOW(), 0),
(201202, 2, '多选', '2', 'success', '', 'prison_question_type', '0', '多选题', 'admin', NOW(), 'admin', NOW(), 0),
(201203, 3, '填空', '3', 'warning', '', 'prison_question_type', '0', '填空题', 'admin', NOW(), 'admin', NOW(), 0),
(201204, 4, '评分', '4', 'info', '', 'prison_question_type', '0', '评分题', 'admin', NOW(), 'admin', NOW(), 0),
(201205, 5, '日期', '5', 'primary', '', 'prison_question_type', '0', '日期选择题', 'admin', NOW(), 'admin', NOW(), 0),
(201206, 6, '数字', '6', 'success', '', 'prison_question_type', '0', '数字输入题', 'admin', NOW(), 'admin', NOW(), 0);
-- 6. 问卷状态 (prison_questionnaire_status)
INSERT IGNORE INTO system_dict_type (id, name, type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES (2013, '问卷状态', 'prison_questionnaire_status', '0', '问卷状态', 'admin', NOW(), 'admin', NOW(), 0);
INSERT IGNORE INTO system_dict_data (id, sort, label, value, color_type, css_class, dict_type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES
(201301, 1, '草稿', '1', 'info', '', 'prison_questionnaire_status', '0', '问卷草稿', 'admin', NOW(), 'admin', NOW(), 0),
(201302, 2, '已发布', '2', 'success', '', 'prison_questionnaire_status', '0', '问卷已发布', 'admin', NOW(), 'admin', NOW(), 0),
(201303, 3, '已禁用', '3', 'danger', '', 'prison_questionnaire_status', '0', '问卷已禁用', 'admin', NOW(), 'admin', NOW(), 0);
-- 6.1 问卷类型 (prison_questionnaire_type)
INSERT IGNORE INTO system_dict_type (id, name, type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES (2021, '问卷类型', 'prison_questionnaire_type', '0', '问卷类型', 'admin', NOW(), 'admin', NOW(), 0);
INSERT IGNORE INTO system_dict_data (id, sort, label, value, color_type, css_class, dict_type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES
(202101, 1, '心理测评', '1', 'primary', '', 'prison_questionnaire_type', '0', '心理测评问卷', 'admin', NOW(), 'admin', NOW(), 0),
(202102, 2, '行为评估', '2', 'warning', '', 'prison_questionnaire_type', '0', '行为评估问卷', 'admin', NOW(), 'admin', NOW(), 0),
(202103, 3, '满意度调查', '3', 'success', '', 'prison_questionnaire_type', '0', '满意度调查问卷', 'admin', NOW(), 'admin', NOW(), 0);
-- 7. 消费类型 (prison_consumption_type)
INSERT IGNORE INTO system_dict_type (id, name, type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES (2014, '消费类型', 'prison_consumption_type', '0', '消费记录类型', 'admin', NOW(), 'admin', NOW(), 0);
INSERT IGNORE INTO system_dict_data (id, sort, label, value, color_type, css_class, dict_type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES
(201401, 1, '购物', '1', 'success', '', 'prison_consumption_type', '0', '购物消费', 'admin', NOW(), 'admin', NOW(), 0),
(201402, 2, '餐饮', '2', 'primary', '', 'prison_consumption_type', '0', '餐饮消费', 'admin', NOW(), 'admin', NOW(), 0),
(201403, 3, '医疗', '3', 'warning', '', 'prison_consumption_type', '0', '医疗消费', 'admin', NOW(), 'admin', NOW(), 0),
(201404, 4, '通讯', '4', 'info', '', 'prison_consumption_type', '0', '通讯消费', 'admin', NOW(), 'admin', NOW(), 0),
(201405, 5, '其他', '5', 'primary', '', 'prison_consumption_type', '0', '其他消费', 'admin', NOW(), 'admin', NOW(), 0);
-- 8. 消费状态 (prison_consumption_status)
INSERT IGNORE INTO system_dict_type (id, name, type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES (2015, '消费状态', 'prison_consumption_status', '0', '消费记录状态', 'admin', NOW(), 'admin', NOW(), 0);
INSERT IGNORE INTO system_dict_data (id, sort, label, value, color_type, css_class, dict_type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES
(201501, 1, '成功', '1', 'success', '', 'prison_consumption_status', '0', '交易成功', 'admin', NOW(), 'admin', NOW(), 0),
(201502, 2, '失败', '2', 'danger', '', 'prison_consumption_status', '0', '交易失败', 'admin', NOW(), 'admin', NOW(), 0);
-- 9. 评估类型 (prison_assessment_type)
INSERT IGNORE INTO system_dict_type (id, name, type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES (2016, '评估类型', 'prison_assessment_type', '0', '危险评估类型', 'admin', NOW(), 'admin', NOW(), 0);
INSERT IGNORE INTO system_dict_data (id, sort, label, value, color_type, css_class, dict_type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES
(201601, 1, '入监评估', '1', 'primary', '', 'prison_assessment_type', '0', '入监时评估', 'admin', NOW(), 'admin', NOW(), 0),
(201602, 2, '定期评估', '2', 'success', '', 'prison_assessment_type', '0', '定期评估', 'admin', NOW(), 'admin', NOW(), 0),
(201603, 3, '专项评估', '3', 'warning', '', 'prison_assessment_type', '0', '专项评估', 'admin', NOW(), 'admin', NOW(), 0),
(201604, 4, '出监评估', '4', 'info', '', 'prison_assessment_type', '0', '出监时评估', 'admin', NOW(), 'admin', NOW(), 0);
-- 10. 考核等级 (prison_score_level)
INSERT IGNORE INTO system_dict_type (id, name, type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES (2017, '考核等级', 'prison_score_level', '0', '计分考核等级', 'admin', NOW(), 'admin', NOW(), 0);
INSERT IGNORE INTO system_dict_data (id, sort, label, value, color_type, css_class, dict_type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES
(201701, 1, '优秀', '1', 'success', '', 'prison_score_level', '0', '表现优秀', 'admin', NOW(), 'admin', NOW(), 0),
(201702, 2, '良好', '2', 'primary', '', 'prison_score_level', '0', '表现良好', 'admin', NOW(), 'admin', NOW(), 0),
(201703, 3, '合格', '3', 'warning', '', 'prison_score_level', '0', '表现合格', 'admin', NOW(), 'admin', NOW(), 0),
(201704, 4, '不合格', '4', 'danger', '', 'prison_score_level', '0', '表现不合格', 'admin', NOW(), 'admin', NOW(), 0);
-- 11. 考核状态 (prison_score_status)
INSERT IGNORE INTO system_dict_type (id, name, type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES (2018, '考核状态', 'prison_score_status', '0', '计分考核状态', 'admin', NOW(), 'admin', NOW(), 0);
INSERT IGNORE INTO system_dict_data (id, sort, label, value, color_type, css_class, dict_type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES
(201801, 1, '待审核', '1', 'info', '', 'prison_score_status', '0', '待审核', 'admin', NOW(), 'admin', NOW(), 0),
(201802, 2, '已通过', '2', 'success', '', 'prison_score_status', '0', '已通过审核', 'admin', NOW(), 'admin', NOW(), 0),
(201803, 3, '已驳回', '3', 'danger', '', 'prison_score_status', '0', '已驳回', 'admin', NOW(), 'admin', NOW(), 0);
-- 12. 监区类型 (prison_area_type)
INSERT IGNORE INTO system_dict_type (id, name, type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES (2019, '监区类型', 'prison_area_type', '0', '监区类型', 'admin', NOW(), 'admin', NOW(), 0);
INSERT IGNORE INTO system_dict_data (id, sort, label, value, color_type, css_class, dict_type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES
(201901, 1, '普通监区', '1', 'primary', '', 'prison_area_type', '0', '普通管理监区', 'admin', NOW(), 'admin', NOW(), 0),
(201902, 2, '严管监区', '2', 'danger', '', 'prison_area_type', '0', '严格管理监区', 'admin', NOW(), 'admin', NOW(), 0),
(201903, 3, '医院', '3', 'success', '', 'prison_area_type', '0', '监狱医院', 'admin', NOW(), 'admin', NOW(), 0),
(201904, 4, '禁闭室', '4', 'warning', '', 'prison_area_type', '0', '禁闭室', 'admin', NOW(), 'admin', NOW(), 0),
(201905, 5, '老残监区', '5', 'info', '', 'prison_area_type', '0', '老弱病残监区', 'admin', NOW(), 'admin', NOW(), 0),
(201906, 6, '女犯监区', '6', 'primary', '', 'prison_area_type', '0', '女性罪犯监区', 'admin', NOW(), 'admin', NOW(), 0),
(201907, 7, '未成年犯监区', '7', 'success', '', 'prison_area_type', '0', '未成年罪犯监区', 'admin', NOW(), 'admin', NOW(), 0),
(201908, 8, '出入监区', '8', 'warning', '', 'prison_area_type', '0', '新收押/释放监区', 'admin', NOW(), 'admin', NOW(), 0),
(201909, 9, '劳动监区', '9', 'primary', '', 'prison_area_type', '0', '劳动改造监区', 'admin', NOW(), 'admin', NOW(), 0),
(201910, 10, '教育监区', '10', 'success', '', 'prison_area_type', '0', '教育改造监区', 'admin', NOW(), 'admin', NOW(), 0);
-- 12.1 监区级别 (prison_area_level)
INSERT IGNORE INTO system_dict_type (id, name, type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES (2022, '监区级别', 'prison_area_level', '0', '监区级别', 'admin', NOW(), 'admin', NOW(), 0);
INSERT IGNORE INTO system_dict_data (id, sort, label, value, color_type, css_class, dict_type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES
(202201, 1, '监区(大队)', '1', 'primary', '', 'prison_area_level', '0', '一级监区(大队)', 'admin', NOW(), 'admin', NOW(), 0),
(202202, 2, '分监区(中队)', '2', 'info', '', 'prison_area_level', '0', '二级监区(中队)', 'admin', NOW(), 'admin', NOW(), 0);
-- 13. 监室状态 (prison_cell_status)
INSERT IGNORE INTO system_dict_type (id, name, type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES (2020, '监室状态', 'prison_cell_status', '0', '监室状态', 'admin', NOW(), 'admin', NOW(), 0);
INSERT IGNORE INTO system_dict_data (id, sort, label, value, color_type, css_class, dict_type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES
(202001, 1, '启用', '1', 'success', '', 'prison_cell_status', '0', '监室启用', 'admin', NOW(), 'admin', NOW(), 0),
(202002, 2, '禁用', '2', 'danger', '', 'prison_cell_status', '0', '监室禁用', 'admin', NOW(), 'admin', NOW(), 0);

268
sql/prison_init.sql Normal file
View File

@ -0,0 +1,268 @@
-- ============================================
-- XL监狱综合管理平台 - 数据库初始化脚本
-- ============================================
-- 罪犯信息表
CREATE TABLE IF NOT EXISTS `prison_prisoner` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '罪犯ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`prisoner_no` varchar(50) NOT NULL COMMENT '罪犯编号',
`name` varchar(50) NOT NULL COMMENT '姓名',
`gender` tinyint NOT NULL COMMENT '性别1-男 2-女',
`birthday` date DEFAULT NULL COMMENT '出生日期',
`id_card` varchar(18) DEFAULT NULL COMMENT '身份证号',
`ethnicity` varchar(50) DEFAULT NULL COMMENT '民族',
`native_place` varchar(100) DEFAULT NULL COMMENT '籍贯',
`education` tinyint DEFAULT NULL COMMENT '文化程度1-文盲 2-小学 3-初中 4-高中 5-中专 6-大专 7-本科 8-硕士 9-博士',
`occupation` varchar(50) DEFAULT NULL COMMENT '入狱前职业',
`address` varchar(500) DEFAULT NULL COMMENT '家庭住址',
`crime` varchar(200) NOT NULL COMMENT '罪名',
`sentence_years` int DEFAULT 0 COMMENT '刑期(年)',
`sentence_months` int DEFAULT 0 COMMENT '刑期(月)',
`life_imprisonment` tinyint DEFAULT 0 COMMENT '是否无期0-否 1-是',
`death_sentence_reprieve` tinyint DEFAULT 0 COMMENT '是否死缓0-否 1-是',
`court_name` varchar(100) DEFAULT NULL COMMENT '判决法院',
`judgment_date` date DEFAULT NULL COMMENT '判决日期',
`judgment_no` varchar(50) DEFAULT NULL COMMENT '判决书编号',
`original_sentence` varchar(100) DEFAULT NULL COMMENT '原判刑期',
`imprisonment_date` date DEFAULT NULL COMMENT '入狱日期',
`release_date` date DEFAULT NULL COMMENT '释放日期',
`release_type` tinyint DEFAULT 0 COMMENT '释放类型0-未知 1-刑满释放 2-假释 3-保外就医 4-减刑 5-暂予监外执行 6-特赦 7-死亡 8-其他',
`release_reason` varchar(500) DEFAULT NULL COMMENT '释放原因',
`photo` varchar(512) DEFAULT NULL COMMENT '照片URL',
`supervision_level` tinyint DEFAULT 2 COMMENT '监管等级1-严管 2-普管 3-宽管',
`risk_level` tinyint DEFAULT 1 COMMENT '风险等级1-低风险 2-中风险 3-高风险 4-极高风险',
`prison_area_id` bigint DEFAULT NULL COMMENT '监区ID',
`sub_area_id` bigint DEFAULT NULL COMMENT '分区ID',
`prison_cell_id` bigint DEFAULT NULL COMMENT '监室ID',
`marital_status` tinyint DEFAULT NULL COMMENT '婚姻状态1-未婚 2-已婚 3-离异 4-丧偶',
`crime_type` varchar(100) DEFAULT NULL COMMENT '罪名类型',
`sentence` varchar(100) DEFAULT NULL COMMENT '刑期',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-在押 2-已释放 3-已死亡 4-假释',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_prisoner_no` (`prisoner_no`, `tenant_id`),
KEY `idx_name` (`name`),
KEY `idx_id_card` (`id_card`),
KEY `idx_status` (`status`)
) ENGINE=InnoDB COMMENT='罪犯信息表';
-- 监区信息表
CREATE TABLE IF NOT EXISTS `prison_area` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '监区ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`name` varchar(50) NOT NULL COMMENT '监区名称',
`code` varchar(50) NOT NULL COMMENT '监区编码',
`type` tinyint DEFAULT NULL COMMENT '监区类型1-普通监区 2-严管监区 3-医院 4-禁闭室',
`capacity` int DEFAULT NULL COMMENT '容纳人数',
`current_count` int DEFAULT 0 COMMENT '当前人数',
`sort` int DEFAULT 0 COMMENT '排序',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-启用 2-禁用',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_code` (`code`, `tenant_id`),
KEY `idx_sort` (`sort`)
) ENGINE=InnoDB COMMENT='监区信息表';
-- 监室信息表
CREATE TABLE IF NOT EXISTS `prison_cell` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '监室ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`area_id` bigint NOT NULL COMMENT '所属监区ID',
`name` varchar(50) NOT NULL COMMENT '监室名称',
`code` varchar(50) NOT NULL COMMENT '监室编码',
`capacity` int DEFAULT NULL COMMENT '床位数量',
`current_count` int DEFAULT 0 COMMENT '当前人数',
`sort` int DEFAULT 0 COMMENT '排序',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-启用 2-禁用',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_code` (`code`, `tenant_id`),
KEY `idx_area_id` (`area_id`)
) ENGINE=InnoDB COMMENT='监室信息表';
-- 计分考核表
CREATE TABLE IF NOT EXISTS `prison_score` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`prisoner_id` bigint NOT NULL COMMENT '罪犯ID',
`prisoner_no` varchar(50) NOT NULL COMMENT '罪犯编号',
`year` int NOT NULL COMMENT '考核年份',
`month` int NOT NULL COMMENT '考核月份',
`base_score` decimal(10,2) DEFAULT 0.00 COMMENT '基础分',
`reward_score` decimal(10,2) DEFAULT 0.00 COMMENT '加分',
`penalty_score` decimal(10,2) DEFAULT 0.00 COMMENT '扣分',
`total_score` decimal(10,2) DEFAULT 0.00 COMMENT '总分',
`level` tinyint DEFAULT NULL COMMENT '考核等级1-优秀 2-良好 3-合格 4-不合格',
`assessor_id` bigint DEFAULT NULL COMMENT '考核人ID',
`assessor_name` varchar(50) DEFAULT NULL COMMENT '考核人姓名',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-待审核 2-已通过 3-已驳回',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_prisoner_id` (`prisoner_id`),
KEY `idx_year_month` (`year`, `month`)
) ENGINE=InnoDB COMMENT='计分考核表';
-- 危险评估表
CREATE TABLE IF NOT EXISTS `prison_risk_assessment` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '评估ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`prisoner_id` bigint NOT NULL COMMENT '罪犯ID',
`prisoner_no` varchar(50) NOT NULL COMMENT '罪犯编号',
`assessment_type` tinyint NOT NULL COMMENT '评估类型1-入狱评估 2-定期评估 3-专项评估',
`assessment_date` date NOT NULL COMMENT '评估日期',
`violence_score` decimal(10,2) DEFAULT 0.00 COMMENT '暴力倾向得分',
`escape_score` decimal(10,2) DEFAULT 0.00 COMMENT '脱逃倾向得分',
`suicide_score` decimal(10,2) DEFAULT 0.00 COMMENT '自杀倾向得分',
`total_score` decimal(10,2) DEFAULT 0.00 COMMENT '综合得分',
`risk_level` tinyint NOT NULL COMMENT '风险等级1-低风险 2-中风险 3-高风险 4-极高风险',
`risk_factors` varchar(500) DEFAULT NULL COMMENT '风险因素',
`suggestions` varchar(500) DEFAULT NULL COMMENT '管控建议',
`assessor_id` bigint DEFAULT NULL COMMENT '评估人ID',
`assessor_name` varchar(50) DEFAULT NULL COMMENT '评估人姓名',
`next_assessment_date` date DEFAULT NULL COMMENT '下次评估日期',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-待审核 2-已通过',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_prisoner_id` (`prisoner_id`),
KEY `idx_assessment_date` (`assessment_date`)
) ENGINE=InnoDB COMMENT='危险评估表';
-- 消费记录表
CREATE TABLE IF NOT EXISTS `prison_consumption` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`prisoner_id` bigint NOT NULL COMMENT '罪犯ID',
`prisoner_no` varchar(50) NOT NULL COMMENT '罪犯编号',
`type` tinyint NOT NULL COMMENT '类型1-存款 2-消费 3-转账',
`amount` decimal(12,2) NOT NULL COMMENT '金额',
`balance` decimal(12,2) DEFAULT 0.00 COMMENT '账户余额',
`goods_name` varchar(100) DEFAULT NULL COMMENT '商品名称',
`goods_count` int DEFAULT 1 COMMENT '商品数量',
`order_no` varchar(64) DEFAULT NULL COMMENT '订单号',
`trade_time` datetime NOT NULL COMMENT '交易时间',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-成功 2-失败',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_prisoner_id` (`prisoner_id`),
KEY `idx_trade_time` (`trade_time`),
KEY `idx_type` (`type`)
) ENGINE=InnoDB COMMENT='消费记录表';
-- 问卷模板表
CREATE TABLE IF NOT EXISTS `prison_questionnaire` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '问卷ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`title` varchar(200) NOT NULL COMMENT '问卷标题',
`type` tinyint NOT NULL COMMENT '问卷类型1-心理测评 2-行为评估 3-满意度调查',
`description` varchar(500) DEFAULT NULL COMMENT '问卷说明',
`total_score` decimal(10,2) DEFAULT 100.00 COMMENT '总分',
`pass_score` decimal(10,2) DEFAULT 60.00 COMMENT '及格分',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-草稿 2-已发布 3-已禁用',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_type` (`type`),
KEY `idx_status` (`status`)
) ENGINE=InnoDB COMMENT='问卷模板表';
-- 问卷问题表
CREATE TABLE IF NOT EXISTS `prison_question` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '问题ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`questionnaire_id` bigint NOT NULL COMMENT '所属问卷ID',
`title` varchar(500) NOT NULL COMMENT '问题标题',
`type` tinyint NOT NULL COMMENT '问题类型1-单选 2-多选 3-填空 4-评分',
`options` text COMMENT '选项JSON[{label:"选项1",score:10},...]',
`score` decimal(10,2) DEFAULT 0.00 COMMENT '分值',
`sort` int DEFAULT 0 COMMENT '排序',
`is_required` bit(1) DEFAULT b'1' COMMENT '是否必答',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_questionnaire_id` (`questionnaire_id`)
) ENGINE=InnoDB COMMENT='问卷问题表';
-- 问卷答题记录表
CREATE TABLE IF NOT EXISTS `prison_questionnaire_record` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`questionnaire_id` bigint NOT NULL COMMENT '问卷ID',
`prisoner_id` bigint NOT NULL COMMENT '罪犯ID',
`prisoner_no` varchar(50) NOT NULL COMMENT '罪犯编号',
`total_score` decimal(10,2) DEFAULT 0.00 COMMENT '得分',
`pass_status` tinyint DEFAULT NULL COMMENT '是否及格1-及格 2-不及格',
`answer_time` datetime NOT NULL COMMENT '答题时间',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-已完成 2-已过期',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_questionnaire_id` (`questionnaire_id`),
KEY `idx_prisoner_id` (`prisoner_id`)
) ENGINE=InnoDB COMMENT='问卷答题记录表';
-- 罪犯监区变动记录表
CREATE TABLE IF NOT EXISTS `prison_prisoner_area_log` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`prisoner_id` bigint NOT NULL COMMENT '罪犯ID',
`from_area_id` bigint DEFAULT NULL COMMENT '原监区ID',
`from_cell_id` bigint DEFAULT NULL COMMENT '原监室ID',
`to_area_id` bigint NOT NULL COMMENT '新监区ID',
`to_cell_id` bigint NOT NULL COMMENT '新监室ID',
`change_type` varchar(20) NOT NULL COMMENT '变动类型:调监区、调监室、入监、出监',
`reason` varchar(500) DEFAULT NULL COMMENT '变动原因',
`approve_no` varchar(50) DEFAULT NULL COMMENT '批准文号',
`operate_by` bigint NOT NULL COMMENT '操作人ID',
`operate_name` varchar(50) DEFAULT NULL COMMENT '操作人姓名',
`operate_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '操作时间',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_prisoner_id` (`prisoner_id`),
KEY `idx_operate_time` (`operate_time`)
) ENGINE=InnoDB COMMENT='罪犯监区变动记录表';

View File

@ -0,0 +1,45 @@
-- ============================================
-- 服刑人员表
-- ============================================
DROP TABLE IF EXISTS prison_inmate;
CREATE TABLE prison_inmate (
id bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
prisoner_no varchar(50) NOT NULL COMMENT '服刑人员编号',
name varchar(50) NOT NULL COMMENT '姓名',
gender tinyint NOT NULL COMMENT '性别1-男2-女',
birthday date DEFAULT NULL COMMENT '出生日期',
id_card varchar(18) DEFAULT NULL COMMENT '身份证号',
ethnicity varchar(50) DEFAULT '' COMMENT '民族',
native_place varchar(100) DEFAULT '' COMMENT '籍贯',
education tinyint DEFAULT NULL COMMENT '文化程度1-文盲2-小学3-初中4-高中5-中专6-大专7-本科及以上',
occupation varchar(100) DEFAULT '' COMMENT '职业',
address varchar(500) DEFAULT '' COMMENT '家庭住址',
crime varchar(200) NOT NULL COMMENT '罪名',
sentence_years int DEFAULT 0 COMMENT '刑期(年)',
sentence_months int DEFAULT 0 COMMENT '刑期(月)',
imprisonment_date date DEFAULT NULL COMMENT '入狱日期',
release_date date DEFAULT NULL COMMENT '释放日期',
supervision_level tinyint DEFAULT NULL COMMENT '监管等级1-严管级2-普管级3-宽管级',
risk_level tinyint DEFAULT NULL COMMENT '风险等级1-高风险2-中风险3-低风险',
prison_area_id bigint DEFAULT NULL COMMENT '当前监区ID',
prison_cell_id bigint DEFAULT NULL COMMENT '当前监室ID',
status tinyint NOT NULL DEFAULT 1 COMMENT '状态1-在押2-假释3-暂予监外执行4-已释放5-已死亡',
remark varchar(500) DEFAULT '' COMMENT '备注',
creator varchar(64) DEFAULT '' COMMENT '创建者',
create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updater varchar(64) DEFAULT '' COMMENT '更新者',
update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
deleted tinyint NOT NULL DEFAULT 0 COMMENT '是否删除',
tenant_id bigint NOT NULL DEFAULT 1 COMMENT '租户编号',
PRIMARY KEY (id),
UNIQUE KEY uk_prisoner_no (prisoner_no),
KEY idx_name (name),
KEY idx_id_card (id_card),
KEY idx_prison_area_id (prison_area_id),
KEY idx_prison_cell_id (prison_cell_id),
KEY idx_status (status)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='服刑人员信息表';
-- 创建序列(如果需要)
-- DROP SEQUENCE IF EXISTS prison_inmate_seq;
-- CREATE SEQUENCE prison_inmate_seq START WITH 1 INCREMENT BY 1;

View File

@ -0,0 +1,56 @@
-- ============================================
-- 服刑人员仿真数据
-- ============================================
-- 插入服刑人员数据
INSERT INTO prison_prisoner (id, prisoner_no, name, gender, birthday, id_card, ethnicity, native_place, education, occupation, address, crime, sentence_years, sentence_months, imprisonment_date, release_date, supervision_level, risk_level, prison_area_id, prison_cell_id, status, remark, creator, create_time, updater, update_time, deleted, tenant_id)
VALUES
-- 1. 张三 - 盗窃罪
(1, 'ZF2024001', '张三', 1, '1985-03-15', '310101198503151234', '汉族', '上海市', 3, '无业', '上海市徐汇区某路100号', '盗窃罪', 3, 6, '2024-01-15', '2027-07-14', 2, 1, 1, 101, 1, '多次盗窃,数额较大', 'admin', NOW(), 'admin', NOW(), 0, 1),
-- 2. 李四 - 故意伤害罪
(2, 'ZF2024002', '李四', 1, '1990-07-22', '320101199007221234', '汉族', '江苏省南京市', 4, '工人', '南京市鼓楼区某路200号', '故意伤害罪', 5, 0, '2023-06-01', '2028-05-31', 2, 2, 1, 102, 1, '打架斗殴致人重伤', 'admin', NOW(), 'admin', NOW(), 0, 1),
-- 3. 王芳 - 诈骗罪
(3, 'ZF2024003', '王芳', 2, '1992-11-08', '330102199211081234', '汉族', '浙江省杭州市', 5, '公司职员', '杭州市西湖区某路300号', '诈骗罪', 2, 0, '2024-03-20', '2026-03-19', 3, 3, 2, 201, 1, '电信诈骗初犯', 'admin', NOW(), 'admin', NOW(), 0, 1),
-- 4. 赵六 - 抢劫罪
(4, 'ZF2024004', '赵六', 1, '1988-05-30', '410101198805301234', '汉族', '河南省郑州市', 2, '无业', '郑州市金水区某路400号', '抢劫罪', 8, 0, '2022-09-10', '2030-09-09', 1, 1, 1, 103, 1, '团伙抢劫累犯', 'admin', NOW(), 'admin', NOW(), 0, 1),
-- 5. 陈小明 - 贩卖毒品罪
(5, 'ZF2024005', '陈小明', 1, '1995-01-25', '510101199501251234', '汉族', '四川省成都市', 3, '无业', '成都市武侯区某路500号', '贩卖毒品罪', 10, 0, '2021-12-01', '2031-11-30', 1, 1, 1, 104, 1, '贩卖毒品罪情节严重', 'admin', NOW(), 'admin', NOW(), 0, 1),
-- 6. 刘丽 - 职务侵占罪
(6, 'ZF2024006', '刘丽', 2, '1987-09-12', '440101198709121234', '汉族', '广东省广州市', 6, '会计', '广州市天河区某路600号', '职务侵占罪', 3, 0, '2024-02-15', '2027-02-14', 2, 2, 2, 202, 1, '侵占公司资金', 'admin', NOW(), 'admin', NOW(), 0, 1),
-- 7. 孙强 - 交通肇事罪
(7, 'ZF2024007', '孙强', 1, '1993-04-18', '420101199304181234', '汉族', '湖北省武汉市', 4, '司机', '武汉市江岸区某路700号', '交通肇事罪', 2, 0, '2024-05-01', '2026-04-30', 3, 3, 2, 203, 1, '醉驾致人死亡', 'admin', NOW(), 'admin', NOW(), 0, 1),
-- 8. 周雪 - 非法吸收公众存款罪
(8, 'ZF2024008', '周雪', 2, '1980-12-03', '310101198012031234', '汉族', '上海市', 7, '金融从业者', '上海市浦东新区某路800号', '非法吸收公众存款罪', 4, 0, '2023-08-15', '2027-08-14', 2, 2, 1, 105, 1, 'P2P平台非法集资', 'admin', NOW(), 'admin', NOW(), 0, 1),
-- 9. 吴刚 - 强奸罪
(9, 'ZF2024009', '吴刚', 1, '1998-06-28', '520101199806281234', '汉族', '贵州省贵阳市', 2, '无业', '贵阳市南明区某路900号', '强奸罪', 6, 0, '2023-03-20', '2029-03-19', 1, 1, 1, 106, 1, '强奸罪累犯', 'admin', NOW(), 'admin', NOW(), 0, 1),
-- 10. 郑敏 - 组织卖淫罪
(10, 'ZF2024010', '郑敏', 2, '1983-08-15', '330102198308151234', '汉族', '浙江省宁波市', 3, '无业', '宁波市鄞州区某路1000号', '组织卖淫罪', 5, 0, '2023-11-01', '2028-10-31', 1, 1, 2, 204, 1, '组织卖淫团伙头目', 'admin', NOW(), 'admin', NOW(), 0, 1);
-- 插入监区数据
INSERT INTO prison_area (id, tenant_id, name, code, type, capacity, current_count, sort, status, remark, creator, create_time, updater, update_time, deleted)
VALUES
(1, 1, '第一监区', 'AREA001', 1, 100, 50, 1, 1, '普通监区', 'admin', NOW(), 'admin', NOW(), 0),
(2, 1, '第二监区', 'AREA002', 1, 100, 30, 2, 1, '普通监区', 'admin', NOW(), 'admin', NOW(), 0),
(3, 1, '严管监区', 'AREA003', 2, 50, 20, 3, 1, '严管监区', 'admin', NOW(), 'admin', NOW(), 0);
-- 插入监室数据
INSERT INTO prison_cell (id, tenant_id, area_id, name, code, capacity, current_count, sort, status, remark, creator, create_time, updater, update_time, deleted)
VALUES
(101, 1, 1, '101室', 'CELL101', 10, 8, 1, 1, '第一监区第一室', 'admin', NOW(), 'admin', NOW(), 0),
(102, 1, 1, '102室', 'CELL102', 10, 7, 2, 1, '第一监区第二室', 'admin', NOW(), 'admin', NOW(), 0),
(103, 1, 1, '103室', 'CELL103', 10, 5, 3, 1, '第一监区第三室', 'admin', NOW(), 'admin', NOW(), 0),
(104, 1, 1, '104室', 'CELL104', 10, 6, 4, 1, '第一监区第四室', 'admin', NOW(), 'admin', NOW(), 0),
(105, 1, 1, '105室', 'CELL105', 10, 4, 5, 1, '第一监区第五室', 'admin', NOW(), 'admin', NOW(), 0),
(201, 1, 2, '201室', 'CELL201', 10, 5, 1, 1, '第二监区第一室', 'admin', NOW(), 'admin', NOW(), 0),
(202, 1, 2, '202室', 'CELL202', 10, 6, 2, 1, '第二监区第二室', 'admin', NOW(), 'admin', NOW(), 0),
(203, 1, 2, '203室', 'CELL203', 10, 4, 3, 1, '第二监区第三室', 'admin', NOW(), 'admin', NOW(), 0),
(204, 1, 2, '204室', 'CELL204', 10, 5, 4, 1, '第二监区第四室', 'admin', NOW(), 'admin', NOW(), 0);

View File

@ -0,0 +1,15 @@
-- 升级脚本:为 prison_score 表添加 prison_area_id 和 prison_cell_id 字段
-- 执行时间2026-01-19
-- 为 prison_score 表添加 prison_area_id 字段
ALTER TABLE `prison_score`
ADD COLUMN `prison_area_id` bigint DEFAULT NULL COMMENT '监区ID' AFTER `remark`;
-- 为 prison_score 表添加 prison_cell_id 字段
ALTER TABLE `prison_score`
ADD COLUMN `prison_cell_id` bigint DEFAULT NULL COMMENT '监室ID' AFTER `prison_area_id`;
-- 添加索引(可选,如果查询频繁需要的话)
ALTER TABLE `prison_score`
ADD KEY `idx_prison_score_prison_area_id` (`prison_area_id`),
ADD KEY `idx_prison_score_prison_cell_id` (`prison_cell_id`);

View File

@ -0,0 +1,73 @@
-- =====================================================
-- XL监狱综合管理平台 - 问卷系统增强脚本
-- 执行日期2026-01-13
-- =====================================================
-- 切换到目标数据库
USE xlcp_dev;
-- =====================================================
-- 1. 问题表 (prison_question) 新增字段
-- =====================================================
ALTER TABLE prison_question
ADD COLUMN part_name VARCHAR(100) COMMENT '分区名称Part名称用于将问题分组' AFTER is_required,
ADD COLUMN part_sort INT DEFAULT 0 COMMENT '分区排序(同一问卷内的分区序号)' AFTER part_name,
ADD COLUMN help_text VARCHAR(500) COMMENT '帮助说明文字' AFTER part_sort,
ADD COLUMN placeholder VARCHAR(200) COMMENT '占位提示(填空题/数字题显示)' AFTER help_text,
ADD COLUMN default_value VARCHAR(200) COMMENT '默认值' AFTER placeholder,
ADD COLUMN auto_fill_type VARCHAR(20) DEFAULT 'NONE' COMMENT '自动填充类型NONE-无 AUTO-系统自动填充 MANUAL-手动输入' AFTER default_value,
ADD COLUMN auto_fill_source VARCHAR(100) COMMENT '自动填充来源dict:字典类型 / field:字段名 示例dict:system_user_sex 或 field:prisonerName' AFTER auto_fill_type,
ADD COLUMN display_condition VARCHAR(500) COMMENT '显示条件JSON{\"field\":\"字段名\",\"operator\":\">=\",\"value\":\"值\"} 示例:{\"field\":\"riskLevel\",\"operator\":\">=\",\"value\":\"3\"}' AFTER auto_fill_source,
ADD COLUMN min_value INT COMMENT '最小值(数字/评分题)' AFTER display_condition,
ADD COLUMN max_value INT COMMENT '最大值(数字/评分题)' AFTER min_value;
-- =====================================================
-- 2. 问卷表 (prison_questionnaire) 新增字段
-- =====================================================
ALTER TABLE prison_questionnaire
ADD COLUMN cover_image VARCHAR(500) COMMENT '封面图片URL' AFTER status,
ADD COLUMN instruction VARCHAR(1000) COMMENT '填写说明' AFTER cover_image,
ADD COLUMN estimated_time INT COMMENT '预计耗时(分钟)' AFTER instruction,
ADD COLUMN part_count INT DEFAULT 0 COMMENT '分区数量' AFTER estimated_time,
ADD COLUMN allow_anonymous TINYINT(1) DEFAULT 1 COMMENT '是否允许匿名0-否 1-是' AFTER part_count;
-- =====================================================
-- 3. 验证脚本 - 查看新增字段
-- =====================================================
SELECT COLUMN_NAME, COLUMN_TYPE, COLUMN_COMMENT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'xlcp_dev'
AND TABLE_NAME = 'prison_question'
AND COLUMN_NAME LIKE 'part_%'
OR COLUMN_NAME = 'help_text'
OR COLUMN_NAME = 'placeholder'
OR COLUMN_NAME = 'default_value'
OR COLUMN_NAME LIKE 'auto_%'
OR COLUMN_NAME = 'display_condition'
OR COLUMN_NAME IN ('min_value', 'max_value')
ORDER BY ORDINAL_POSITION;
SELECT COLUMN_NAME, COLUMN_TYPE, COLUMN_COMMENT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'xlcp_dev'
AND TABLE_NAME = 'prison_questionnaire'
AND COLUMN_NAME IN ('cover_image', 'instruction', 'estimated_time', 'part_count', 'allow_anonymous')
ORDER BY ORDINAL_POSITION;
-- =====================================================
-- 4. 问题类型字典数据(如果需要)
-- =====================================================
-- 问题类型1-单选 2-多选 3-填空 4-评分 5-日期 6-数字
-- INSERT INTO system_dict_data (dict_type, dict_value, dict_label, sort_order, status)
-- VALUES ('prison_question_type', '5', '日期', 5, '0'),
-- ('prison_question_type', '6', '数字', 6, '0');
-- =====================================================
-- 5. 自动填充类型字典数据
-- =====================================================
-- INSERT INTO system_dict_data (dict_type, dict_value, dict_label, sort_order, status)
-- VALUES ('question_auto_fill_type', 'NONE', '无', 1, '0'),
-- ('question_auto_fill_type', 'AUTO', '系统自动填充', 2, '0'),
-- ('question_auto_fill_type', 'MANUAL', '手动输入', 3, '0');
SELECT '脚本执行完成!请验证字段是否添加成功。' AS RESULT;

View File

@ -0,0 +1,68 @@
-- =====================================================
-- XL监狱综合管理平台 - 问卷自动填充来源字典
-- 执行日期2026-01-13
-- =====================================================
-- 切换到目标数据库
USE xlcp_dev;
-- =====================================================
-- 1. 自动填充来源字典类型
-- =====================================================
INSERT INTO system_dict_type (id, name, type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES (2100, '问卷自动填充来源', 'prison_question_auto_fill_source', '0', '问卷问题自动填充来源配置', 'admin', NOW(), 'admin', NOW(), 0);
-- =====================================================
-- 2. 自动填充来源字典数据
-- =====================================================
-- 罪犯基本信息类field: 前缀)
INSERT INTO system_dict_data (id, sort, label, value, color_type, css_class, dict_type, status, remark, creator, create_time, updater, update_time, deleted)
VALUES
-- 罪犯基本信息 (ID: 210101-210110)
(210101, 1, '罪犯姓名', 'field:prisonerName', '', '', 'prison_question_auto_fill_source', '0', '从罪犯基本信息获取姓名', 'admin', NOW(), 'admin', NOW(), 0),
(210102, 2, '罪犯编号', 'field:prisonerNo', '', '', 'prison_question_auto_fill_source', '0', '从罪犯基本信息获取编号', 'admin', NOW(), 'admin', NOW(), 0),
(210103, 3, '年龄', 'field:age', '', '', 'prison_question_auto_fill_source', '0', '从罪犯基本信息计算年龄', 'admin', NOW(), 'admin', NOW(), 0),
(210104, 4, '性别', 'field:gender', '', '', 'prison_question_auto_fill_source', '0', '从罪犯基本信息获取性别', 'admin', NOW(), 'admin', NOW(), 0),
(210105, 5, '民族', 'field:nation', '', '', 'prison_question_auto_fill_source', '0', '从罪犯基本信息获取民族', 'admin', NOW(), 'admin', NOW(), 0),
(210106, 6, '文化程度', 'field:education', '', '', 'prison_question_auto_fill_source', '0', '从罪犯基本信息获取文化程度', 'admin', NOW(), 'admin', NOW(), 0),
(210107, 7, '出生日期', 'field:birthDate', '', '', 'prison_question_auto_fill_source', '0', '从罪犯基本信息获取出生日期', 'admin', NOW(), 'admin', NOW(), 0),
(210108, 8, '籍贯', 'field:nativePlace', '', '', 'prison_question_auto_fill_source', '0', '从罪犯基本信息获取籍贯', 'admin', NOW(), 'admin', NOW(), 0),
(210109, 9, '身份证号', 'field:idCard', '', '', 'prison_question_auto_fill_source', '0', '从罪犯基本信息获取身份证号', 'admin', NOW(), 'admin', NOW(), 0),
(210110, 10, '家庭住址', 'field:address', '', '', 'prison_question_auto_fill_source', '0', '从罪犯基本信息获取家庭住址', 'admin', NOW(), 'admin', NOW(), 0),
-- 狱政管理类 (ID: 210120-210128)
(210120, 20, '监管等级', 'field:supervisionLevel', '', '', 'prison_question_auto_fill_source', '0', '从狱政管理获取监管等级', 'admin', NOW(), 'admin', NOW(), 0),
(210121, 21, '风险等级', 'field:riskLevel', '', '', 'prison_question_auto_fill_source', '0', '从危评系统获取风险等级', 'admin', NOW(), 'admin', NOW(), 0),
(210122, 22, '在押时长(月)', 'field:months', '', '', 'prison_question_auto_fill_source', '0', '计算在押时长(月)', 'admin', NOW(), 'admin', NOW(), 0),
(210123, 23, '入监日期', 'field:admissionDate', '', '', 'prison_question_auto_fill_source', '0', '从狱政管理获取入监日期', 'admin', NOW(), 'admin', NOW(), 0),
(210124, 24, '预计出监日期', 'field:releaseDate', '', '', 'prison_question_auto_fill_source', '0', '从狱政管理获取预计出监日期', 'admin', NOW(), 'admin', NOW(), 0),
(210125, 25, '刑期(年)', 'field:sentenceYears', '', '', 'prison_question_auto_fill_source', '0', '从狱政管理获取刑期', 'admin', NOW(), 'admin', NOW(), 0),
(210126, 26, '犯罪类型', 'field:crimeType', '', '', 'prison_question_auto_fill_source', '0', '从狱政管理获取犯罪类型', 'admin', NOW(), 'admin', NOW(), 0),
(210127, 27, '所在监区', 'field:prisonArea', '', '', 'prison_question_auto_fill_source', '0', '从狱政管理获取所在监区', 'admin', NOW(), 'admin', NOW(), 0),
(210128, 28, '所在监室', 'field:prisonCell', '', '', 'prison_question_auto_fill_source', '0', '从狱政管理获取所在监室', 'admin', NOW(), 'admin', NOW(), 0),
-- 考核评估类 (ID: 210140-210145)
(210140, 40, '当前总分', 'field:totalScore', '', '', 'prison_question_auto_fill_source', '0', '从计分考核获取当前总分', 'admin', NOW(), 'admin', NOW(), 0),
(210141, 41, '本月得分', 'field:monthScore', '', '', 'prison_question_auto_fill_source', '0', '从计分考核获取本月得分', 'admin', NOW(), 'admin', NOW(), 0),
(210142, 42, '本年累计得分', 'field:yearScore', '', '', 'prison_question_auto_fill_source', '0', '从计分考核获取本年累计得分', 'admin', NOW(), 'admin', NOW(), 0),
(210143, 43, '评估次数', 'field:assessmentCount', '', '', 'prison_question_auto_fill_source', '0', '从危评系统获取评估次数', 'admin', NOW(), 'admin', NOW(), 0),
(210144, 44, '上次评估日期', 'field:lastAssessmentDate', '', '', 'prison_question_auto_fill_source', '0', '从危评系统获取上次评估日期', 'admin', NOW(), 'admin', NOW(), 0),
(210145, 45, '考核等级', 'field:scoreLevel', '', '', 'prison_question_auto_fill_source', '0', '从计分考核获取考核等级', 'admin', NOW(), 'admin', NOW(), 0),
-- 系统字典类dict: 前缀)(ID: 210160-210164)
(210160, 60, '性别(字典)', 'dict:system_user_sex', '', '', 'prison_question_auto_fill_source', '0', '从系统字典获取性别选项', 'admin', NOW(), 'admin', NOW(), 0),
(210161, 61, '监管等级(字典)', 'dict:prison_supervision_level', '', '', 'prison_question_auto_fill_source', '0', '从系统字典获取监管等级选项', 'admin', NOW(), 'admin', NOW(), 0),
(210162, 62, '风险等级(字典)', 'dict:prison_risk_level', '', '', 'prison_question_auto_fill_source', '0', '从系统字典获取风险等级选项', 'admin', NOW(), 'admin', NOW(), 0),
(210163, 63, '文化程度(字典)', 'dict:prison_education', '', '', 'prison_question_auto_fill_source', '0', '从系统字典获取文化程度选项', 'admin', NOW(), 'admin', NOW(), 0),
(210164, 64, '考核等级(字典)', 'dict:prison_score_level', '', '', 'prison_question_auto_fill_source', '0', '从系统字典获取考核等级选项', 'admin', NOW(), 'admin', NOW(), 0);
-- =====================================================
-- 3. 验证脚本 - 查看新增字典数据
-- =====================================================
SELECT id, sort, label, value, dict_type, status
FROM system_dict_data
WHERE dict_type = 'prison_question_auto_fill_source'
ORDER BY sort;
SELECT '字典数据插入完成!请在系统管理-字典管理中查看并启用。' AS RESULT;

View File

@ -0,0 +1,793 @@
-- ============================================
-- XL监狱综合管理平台 - 数据库迁移脚本 V1
-- 版本: 1.0
-- 日期: 2026-01-21
-- 说明: 基于实体类DO生成包含所有表的完整字段定义
-- ============================================
-- 开启外键检查(可选,根据需求调整)
SET FOREIGN_KEY_CHECKS = 0;
-- ============================================
-- 1. 罪犯信息表 (prison_prisoner)
-- ============================================
DROP TABLE IF EXISTS `prison_prisoner`;
CREATE TABLE IF NOT EXISTS `prison_prisoner` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '罪犯ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`prisoner_no` varchar(50) NOT NULL COMMENT '罪犯编号',
`name` varchar(50) NOT NULL COMMENT '姓名',
`gender` tinyint NOT NULL COMMENT '性别1-男 2-女',
`birthday` date DEFAULT NULL COMMENT '出生日期',
`id_card` varchar(18) DEFAULT NULL COMMENT '身份证号',
`ethnicity` varchar(50) DEFAULT NULL COMMENT '民族',
`native_place` varchar(100) DEFAULT NULL COMMENT '籍贯',
`education` tinyint DEFAULT NULL COMMENT '文化程度1-文盲 2-小学 3-初中 4-高中 5-中专 6-大专 7-本科 8-硕士 9-博士',
`occupation` varchar(50) DEFAULT NULL COMMENT '入狱前职业',
`address` varchar(500) DEFAULT NULL COMMENT '家庭住址',
`crime` varchar(200) NOT NULL COMMENT '罪名',
`sentence_years` int DEFAULT 0 COMMENT '刑期(年)',
`sentence_months` int DEFAULT 0 COMMENT '刑期(月)',
`life_imprisonment` tinyint DEFAULT 0 COMMENT '是否无期0-否 1-是',
`death_sentence_reprieve` tinyint DEFAULT 0 COMMENT '是否死缓0-否 1-是',
`court_name` varchar(100) DEFAULT NULL COMMENT '判决法院',
`judgment_date` date DEFAULT NULL COMMENT '判决日期',
`judgment_no` varchar(50) DEFAULT NULL COMMENT '判决书编号',
`original_sentence` varchar(100) DEFAULT NULL COMMENT '原判刑期',
`imprisonment_date` date DEFAULT NULL COMMENT '入狱日期',
`release_date` date DEFAULT NULL COMMENT '释放日期',
`release_type` tinyint DEFAULT 0 COMMENT '释放类型1-刑满 2-假释 3-暂予监外执行 4-减刑 5-移交 6-死亡',
`release_reason` varchar(500) DEFAULT NULL COMMENT '释放原因',
`photo` varchar(512) DEFAULT NULL COMMENT '照片URL',
`supervision_level` tinyint DEFAULT 2 COMMENT '监管等级1-严管 2-普管 3-宽管',
`risk_level` tinyint DEFAULT 1 COMMENT '风险等级1-低风险 2-中风险 3-高风险 4-极高风险',
`prison_area_id` bigint DEFAULT NULL COMMENT '监区ID',
`sub_area_id` bigint DEFAULT NULL COMMENT '分区ID',
`prison_cell_id` bigint DEFAULT NULL COMMENT '监室ID',
`marital_status` tinyint DEFAULT NULL COMMENT '婚姻状态1-未婚 2-已婚 3-离异 4-丧偶',
`crime_type` varchar(100) DEFAULT NULL COMMENT '罪名类型',
`sentence` varchar(100) DEFAULT NULL COMMENT '刑期',
`children` varchar(500) DEFAULT NULL COMMENT '子女情况',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-在押 2-已释放 3-已死亡 4-假释',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_prisoner_no` (`prisoner_no`, `tenant_id`),
KEY `idx_name` (`name`),
KEY `idx_id_card` (`id_card`),
KEY `idx_status` (`status`)
) ENGINE=InnoDB COMMENT='罪犯信息表';
-- ============================================
-- 2. 监区信息表 (prison_area)
-- ============================================
DROP TABLE IF EXISTS `prison_area`;
CREATE TABLE IF NOT EXISTS `prison_area` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '监区ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`name` varchar(50) NOT NULL COMMENT '监区名称',
`code` varchar(50) NOT NULL COMMENT '监区编码',
`type` tinyint DEFAULT NULL COMMENT '监区类型1-普通监区 2-严管监区 3-集训监区 4-出监监区 5-医院 6-禁闭室',
`parent_id` bigint DEFAULT 0 COMMENT '父级ID0表示顶级监区',
`level` tinyint DEFAULT 1 COMMENT '级别1-监区(大队) 2-分监区(中队)',
`capacity` int DEFAULT NULL COMMENT '容纳人数',
`current_count` int DEFAULT 0 COMMENT '当前人数',
`sort` int DEFAULT 0 COMMENT '排序',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-启用 2-禁用',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_code` (`code`, `tenant_id`),
KEY `idx_sort` (`sort`),
KEY `idx_parent_id` (`parent_id`)
) ENGINE=InnoDB COMMENT='监区信息表';
-- ============================================
-- 3. 监室信息表 (prison_cell)
-- ============================================
DROP TABLE IF EXISTS `prison_cell`;
CREATE TABLE IF NOT EXISTS `prison_cell` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '监室ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`area_id` bigint NOT NULL COMMENT '所属监区ID',
`name` varchar(50) NOT NULL COMMENT '监室名称',
`code` varchar(50) NOT NULL COMMENT '监室编码',
`capacity` int DEFAULT NULL COMMENT '床位数量',
`current_count` int DEFAULT 0 COMMENT '当前人数',
`sort` int DEFAULT 0 COMMENT '排序',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-启用 2-禁用',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_code` (`code`, `tenant_id`),
KEY `idx_area_id` (`area_id`)
) ENGINE=InnoDB COMMENT='监室信息表';
-- ============================================
-- 4. 计分考核表 (prison_score)
-- ============================================
DROP TABLE IF EXISTS `prison_score`;
CREATE TABLE IF NOT EXISTS `prison_score` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`prisoner_id` bigint NOT NULL COMMENT '罪犯ID',
`prisoner_no` varchar(50) NOT NULL COMMENT '罪犯编号',
`year` int NOT NULL COMMENT '考核年份',
`month` int NOT NULL COMMENT '考核月份',
`base_score` decimal(10,2) DEFAULT 0.00 COMMENT '基础分',
`reward_score` decimal(10,2) DEFAULT 0.00 COMMENT '加分',
`penalty_score` decimal(10,2) DEFAULT 0.00 COMMENT '扣分',
`total_score` decimal(10,2) DEFAULT 0.00 COMMENT '总分',
`level` tinyint DEFAULT NULL COMMENT '考核等级1-优秀 2-良好 3-合格 4-不合格',
`assessor_id` bigint DEFAULT NULL COMMENT '考核人ID',
`assessor_name` varchar(50) DEFAULT NULL COMMENT '考核人姓名',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-待审核 2-已通过 3-已驳回',
`prison_area_id` bigint DEFAULT NULL COMMENT '监区ID',
`prison_cell_id` bigint DEFAULT NULL COMMENT '监室ID',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_prisoner_id` (`prisoner_id`),
KEY `idx_year_month` (`year`, `month`)
) ENGINE=InnoDB COMMENT='计分考核表';
-- ============================================
-- 5. 考核规则配置表 (prison_score_rule)
-- ============================================
DROP TABLE IF EXISTS `prison_score_rule`;
CREATE TABLE IF NOT EXISTS `prison_score_rule` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '规则ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`category` tinyint NOT NULL COMMENT '类别1-劳动改造 2-教育改造 3-日常行为 4-卫生纪律 5-加分项 6-扣分项',
`item_name` varchar(100) NOT NULL COMMENT '项目名称',
`item_code` varchar(50) NOT NULL COMMENT '项目编码(唯一)',
`score` decimal(10,2) NOT NULL COMMENT '分值(加分正数,扣分负数)',
`max_daily_score` decimal(10,2) DEFAULT NULL COMMENT '日最高分限制',
`max_monthly_score` decimal(10,2) DEFAULT NULL COMMENT '月最高分限制',
`description` varchar(500) DEFAULT NULL COMMENT '规则说明',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-启用 2-禁用',
`sort` int DEFAULT 0 COMMENT '排序',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_item_code` (`item_code`, `tenant_id`),
KEY `idx_category` (`category`),
KEY `idx_status` (`status`)
) ENGINE=InnoDB COMMENT='考核规则配置表';
-- ============================================
-- 6. 考核记录明细表 (prison_score_detail)
-- ============================================
DROP TABLE IF EXISTS `prison_score_detail`;
CREATE TABLE IF NOT EXISTS `prison_score_detail` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`prisoner_id` bigint NOT NULL COMMENT '罪犯ID',
`prisoner_no` varchar(50) NOT NULL COMMENT '罪犯编号',
`record_date` date NOT NULL COMMENT '记录日期',
`rule_id` bigint DEFAULT NULL COMMENT '规则ID',
`score` decimal(10,2) NOT NULL COMMENT '得分',
`score_type` tinyint NOT NULL COMMENT '类型1-加分 2-扣分',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`recorder_id` bigint DEFAULT NULL COMMENT '记录人ID',
`recorder_name` varchar(50) DEFAULT NULL COMMENT '记录人姓名',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-有效 2-作废',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_prisoner_id` (`prisoner_id`),
KEY `idx_record_date` (`record_date`),
KEY `idx_rule_id` (`rule_id`)
) ENGINE=InnoDB COMMENT='考核记录明细表';
-- ============================================
-- 7. 危险评估表 (prison_risk_assessment)
-- ============================================
DROP TABLE IF EXISTS `prison_risk_assessment`;
CREATE TABLE IF NOT EXISTS `prison_risk_assessment` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '评估ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`prisoner_id` bigint NOT NULL COMMENT '罪犯ID',
`prisoner_no` varchar(50) NOT NULL COMMENT '罪犯编号',
`assessment_type` tinyint NOT NULL COMMENT '评估类型1-入狱评估 2-定期评估 3-专项评估',
`assessment_date` date NOT NULL COMMENT '评估日期',
`violence_score` decimal(10,2) DEFAULT 0.00 COMMENT '暴力倾向得分',
`escape_score` decimal(10,2) DEFAULT 0.00 COMMENT '脱逃倾向得分',
`suicide_score` decimal(10,2) DEFAULT 0.00 COMMENT '自杀倾向得分',
`total_score` decimal(10,2) DEFAULT 0.00 COMMENT '综合得分',
`risk_level` tinyint NOT NULL COMMENT '风险等级1-低风险 2-中风险 3-高风险 4-极高风险',
`risk_factors` varchar(500) DEFAULT NULL COMMENT '风险因素',
`suggestions` varchar(500) DEFAULT NULL COMMENT '管控建议',
`assessor_id` bigint DEFAULT NULL COMMENT '评估人ID',
`assessor_name` varchar(50) DEFAULT NULL COMMENT '评估人姓名',
`next_assessment_date` date DEFAULT NULL COMMENT '下次评估日期',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-待审核 2-已通过',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_prisoner_id` (`prisoner_id`),
KEY `idx_assessment_date` (`assessment_date`)
) ENGINE=InnoDB COMMENT='危险评估表';
-- ============================================
-- 8. 消费记录表 (prison_consumption)
-- ============================================
DROP TABLE IF EXISTS `prison_consumption`;
CREATE TABLE IF NOT EXISTS `prison_consumption` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '消费ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`prisoner_id` bigint NOT NULL COMMENT '罪犯ID',
`prisoner_no` varchar(50) NOT NULL COMMENT '罪犯编号',
`order_no` varchar(64) DEFAULT NULL COMMENT '订单号',
`type` tinyint NOT NULL COMMENT '类型1-购物 2-餐饮 3-医疗 4-通讯 5-其他',
`total_amount` decimal(12,2) NOT NULL COMMENT '订单总金额',
`balance` decimal(12,2) DEFAULT 0.00 COMMENT '账户余额(消费后)',
`trade_time` datetime NOT NULL COMMENT '交易时间',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-成功 2-失败',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_prisoner_id` (`prisoner_id`),
KEY `idx_trade_time` (`trade_time`),
KEY `idx_type` (`type`)
) ENGINE=InnoDB COMMENT='消费记录表';
-- ============================================
-- 9. 问卷模板表 (prison_questionnaire)
-- ============================================
DROP TABLE IF EXISTS `prison_questionnaire`;
CREATE TABLE IF NOT EXISTS `prison_questionnaire` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '问卷ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`title` varchar(200) NOT NULL COMMENT '问卷标题',
`type` tinyint NOT NULL COMMENT '问卷类型1-心理测评 2-行为评估 3-满意度调查',
`description` varchar(500) DEFAULT NULL COMMENT '问卷说明',
`total_score` decimal(10,2) DEFAULT 100.00 COMMENT '总分',
`pass_score` decimal(10,2) DEFAULT 60.00 COMMENT '及格分',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-草稿 2-已发布 3-已禁用',
`cover_image` varchar(500) DEFAULT NULL COMMENT '封面图片URL',
`instruction` varchar(1000) DEFAULT NULL COMMENT '填写说明',
`estimated_time` int DEFAULT NULL COMMENT '预计耗时(分钟)',
`part_count` tinyint DEFAULT 1 COMMENT '分区数量',
`allow_anonymous` tinyint DEFAULT 0 COMMENT '是否允许匿名0-不允许 1-允许',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_type` (`type`),
KEY `idx_status` (`status`)
) ENGINE=InnoDB COMMENT='问卷模板表';
-- ============================================
-- 10. 问卷问题表 (prison_question)
-- ============================================
DROP TABLE IF EXISTS `prison_question`;
CREATE TABLE IF NOT EXISTS `prison_question` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '问题ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`questionnaire_id` bigint NOT NULL COMMENT '所属问卷ID',
`title` varchar(500) NOT NULL COMMENT '问题标题',
`type` tinyint NOT NULL COMMENT '问题类型1-单选 2-多选 3-填空 4-评分 5-日期 6-数字',
`options` text COMMENT '选项JSON[{label:"选项1",score:10,isOther:false},...]',
`score` decimal(10,2) DEFAULT 0.00 COMMENT '分值',
`sort` int DEFAULT 0 COMMENT '排序',
`is_required` tinyint DEFAULT 1 COMMENT '是否必答0-否 1-是',
`part_name` varchar(50) DEFAULT NULL COMMENT '分区名称Part名称用于将问题分组',
`part_sort` tinyint DEFAULT 0 COMMENT '分区排序(同一问卷内的分区序号)',
`help_text` varchar(500) DEFAULT NULL COMMENT '帮助说明文字',
`placeholder` varchar(200) DEFAULT NULL COMMENT '占位提示(填空题/数字题显示)',
`default_value` varchar(200) DEFAULT NULL COMMENT '默认值',
`auto_fill_type` varchar(20) DEFAULT 'NONE' COMMENT '自动填充类型NONE-无 AUTO-系统自动填充 MANUAL-手动输入',
`auto_fill_source` varchar(100) DEFAULT NULL COMMENT '自动填充来源dict:字典类型 / field:字段名',
`display_condition` text COMMENT '显示条件JSON{"field":"字段名","operator":">=","value":"值"}',
`min_value` int DEFAULT NULL COMMENT '最小值(数字/评分题)',
`max_value` int DEFAULT NULL COMMENT '最大值(数字/评分题)',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_questionnaire_id` (`questionnaire_id`)
) ENGINE=InnoDB COMMENT='问卷问题表';
-- ============================================
-- 11. 问卷答题记录表 (prison_questionnaire_record)
-- ============================================
DROP TABLE IF EXISTS `prison_questionnaire_record`;
CREATE TABLE IF NOT EXISTS `prison_questionnaire_record` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`questionnaire_id` bigint NOT NULL COMMENT '问卷ID',
`questionnaire_name` varchar(200) DEFAULT NULL COMMENT '问卷名称',
`prisoner_id` bigint NOT NULL COMMENT '罪犯ID',
`prisoner_no` varchar(50) NOT NULL COMMENT '罪犯编号',
`prisoner_name` varchar(50) DEFAULT NULL COMMENT '罪犯姓名',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-待测评 2-测评中 3-已完成 4-已过期 5-已取消',
`start_time` datetime DEFAULT NULL COMMENT '开始时间',
`end_time` datetime DEFAULT NULL COMMENT '结束时间',
`answer_time` datetime DEFAULT NULL COMMENT '答题时间',
`deadline` datetime DEFAULT NULL COMMENT '截止日期',
`objective_score` decimal(10,2) DEFAULT 0.00 COMMENT '客观题得分',
`subjective_score` decimal(10,2) DEFAULT 0.00 COMMENT '主观题得分',
`total_score` decimal(10,2) DEFAULT 0.00 COMMENT '总分',
`pass_score` decimal(10,2) DEFAULT NULL COMMENT '及格分数',
`pass_status` tinyint DEFAULT NULL COMMENT '及格状态1-及格 2-不及格 3-待评阅',
`risk_level` tinyint DEFAULT NULL COMMENT '风险等级1-高风险 2-中风险 3-低风险',
`evaluator_id` bigint DEFAULT NULL COMMENT '评阅人ID',
`evaluator_name` varchar(50) DEFAULT NULL COMMENT '评阅人姓名',
`evaluate_time` datetime DEFAULT NULL COMMENT '评阅时间',
`participant_count` int DEFAULT 0 COMMENT '参与人数',
`completed_count` int DEFAULT 0 COMMENT '完成人数',
`duration` int DEFAULT 0 COMMENT '答题用时(秒)',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_questionnaire_id` (`questionnaire_id`),
KEY `idx_prisoner_id` (`prisoner_id`),
KEY `idx_status` (`status`)
) ENGINE=InnoDB COMMENT='问卷答题记录表';
-- ============================================
-- 12. 问卷答题详情表 (prison_answer)
-- ============================================
DROP TABLE IF EXISTS `prison_answer`;
CREATE TABLE IF NOT EXISTS `prison_answer` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '答题记录ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`assessment_record_id` bigint NOT NULL COMMENT '测评记录ID',
`question_id` bigint NOT NULL COMMENT '问题ID',
`questionnaire_id` bigint NOT NULL COMMENT '问卷ID冗余',
`prisoner_id` bigint NOT NULL COMMENT '罪犯ID',
`question_type` tinyint NOT NULL COMMENT '问题类型1-单选 2-多选 3-填空 4-评分 5-日期 6-数字',
`answer_text` text COMMENT '答案内容(填空题、评分题等)',
`option_ids` text COMMENT '选项ID列表JSON数组如 [1,2,3]',
`score` decimal(10,2) DEFAULT 0.00 COMMENT '得分',
`is_correct` tinyint DEFAULT NULL COMMENT '是否正确null-未评分 0-错误 1-正确',
`duration` int DEFAULT 0 COMMENT '答题时间(秒)',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_assessment_record_id` (`assessment_record_id`),
KEY `idx_question_id` (`question_id`),
KEY `idx_prisoner_id` (`prisoner_id`)
) ENGINE=InnoDB COMMENT='问卷答题详情表';
-- ============================================
-- 13. 罪犯监区变动记录表 (prison_prisoner_area_log)
-- ============================================
DROP TABLE IF EXISTS `prison_prisoner_area_log`;
CREATE TABLE IF NOT EXISTS `prison_prisoner_area_log` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`prisoner_id` bigint NOT NULL COMMENT '罪犯ID',
`prisoner_no` varchar(50) NOT NULL COMMENT '罪犯编号',
`from_area_id` bigint DEFAULT NULL COMMENT '原监区ID',
`from_sub_area_id` bigint DEFAULT NULL COMMENT '原分监区ID',
`from_cell_id` bigint DEFAULT NULL COMMENT '原监室ID',
`to_area_id` bigint NOT NULL COMMENT '新监区ID',
`to_sub_area_id` bigint DEFAULT NULL COMMENT '新分监区ID',
`to_cell_id` bigint NOT NULL COMMENT '新监室ID',
`change_type` tinyint NOT NULL COMMENT '变动类型1-调入 2-调出 3-临时安置 4-医疗回监 5-初始分配',
`reason` varchar(500) DEFAULT NULL COMMENT '变动原因',
`approve_no` varchar(50) DEFAULT NULL COMMENT '批准文号',
`operate_by` bigint NOT NULL COMMENT '操作人ID',
`operate_name` varchar(50) DEFAULT NULL COMMENT '操作人姓名',
`operate_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '操作时间',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_prisoner_id` (`prisoner_id`),
KEY `idx_operate_time` (`operate_time`)
) ENGINE=InnoDB COMMENT='罪犯监区变动记录表';
-- ============================================
-- 14. 预警信息表 (prison_warning)
-- ============================================
DROP TABLE IF EXISTS `prison_warning`;
CREATE TABLE IF NOT EXISTS `prison_warning` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '预警ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`title` varchar(200) NOT NULL COMMENT '预警标题',
`content` text COMMENT '预警内容',
`type` tinyint NOT NULL COMMENT '预警类型1-安全预警 2-监管预警 3-改造预警 4-生产预警 5-生活卫生预警 6-其他',
`level` tinyint NOT NULL COMMENT '预警等级1-一般 2-重要 3-紧急 4-严重',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '预警状态1-待核实 2-已核实 3-已处置 4-已解除',
`source` tinyint DEFAULT NULL COMMENT '预警来源1-民警报告 2-监控系统 3-举报 4-罪犯自首 5-智能分析 6-其他',
`situation_id` bigint DEFAULT NULL COMMENT '关联狱情ID',
`area_id` bigint DEFAULT NULL COMMENT '关联监区ID',
`cell_id` bigint DEFAULT NULL COMMENT '关联监室ID',
`alert_time` datetime NOT NULL COMMENT '预警时间',
`verify_time` datetime DEFAULT NULL COMMENT '核实时间',
`verifier` varchar(50) DEFAULT NULL COMMENT '核实人',
`verify_result` varchar(500) DEFAULT NULL COMMENT '核实结果',
`handle_time` datetime DEFAULT NULL COMMENT '处置时间',
`handler` varchar(50) DEFAULT NULL COMMENT '处置人',
`handle_method` varchar(200) DEFAULT NULL COMMENT '处置方式',
`handle_result` varchar(500) DEFAULT NULL COMMENT '处置结果',
`release_time` datetime DEFAULT NULL COMMENT '解除时间',
`releaser` varchar(50) DEFAULT NULL COMMENT '解除人',
`release_reason` varchar(500) DEFAULT NULL COMMENT '解除原因',
`occur_time` datetime DEFAULT NULL COMMENT '发生时间',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_type` (`type`),
KEY `idx_level` (`level`),
KEY `idx_status` (`status`),
KEY `idx_area_id` (`area_id`),
KEY `idx_alert_time` (`alert_time`)
) ENGINE=InnoDB COMMENT='预警信息表';
-- ============================================
-- 15. 狱情收集信息表 (prison_situation)
-- ============================================
DROP TABLE IF EXISTS `prison_situation`;
CREATE TABLE IF NOT EXISTS `prison_situation` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '狱情ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`title` varchar(200) NOT NULL COMMENT '标题',
`content` text COMMENT '详情内容',
`category` tinyint NOT NULL COMMENT '分类1-监管安全 2-教育改造 3-生活卫生 4-生产安全 5-狱内案件 6-其他',
`level` tinyint NOT NULL COMMENT '等级1-一般 2-重要 3-紧急',
`source` tinyint DEFAULT NULL COMMENT '来源1-民警报告 2-监控系统 3-举报 4-罪犯自首 5-其他',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '处理状态1-待处理 2-处理中 3-已处理',
`area_id` bigint DEFAULT NULL COMMENT '关联监区ID',
`cell_id` bigint DEFAULT NULL COMMENT '关联监室ID',
`reporter` varchar(50) DEFAULT NULL COMMENT '报告人',
`handler` varchar(50) DEFAULT NULL COMMENT '处理人',
`handle_time` datetime DEFAULT NULL COMMENT '处理时间',
`handle_result` varchar(500) DEFAULT NULL COMMENT '处理结果',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`occur_time` datetime DEFAULT NULL COMMENT '发生时间',
`type` varchar(50) DEFAULT NULL COMMENT '类型',
`location` varchar(200) DEFAULT NULL COMMENT '地点',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_category` (`category`),
KEY `idx_level` (`level`),
KEY `idx_status` (`status`),
KEY `idx_area_id` (`area_id`),
KEY `idx_occur_time` (`occur_time`)
) ENGINE=InnoDB COMMENT='狱情收集信息表';
-- ============================================
-- 16. 评估报告表 (prison_evaluation_report)
-- ============================================
DROP TABLE IF EXISTS `prison_evaluation_report`;
CREATE TABLE IF NOT EXISTS `prison_evaluation_report` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '报告ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`report_no` varchar(50) NOT NULL COMMENT '报告编号',
`prisoner_id` bigint NOT NULL COMMENT '罪犯ID',
`prisoner_no` varchar(50) NOT NULL COMMENT '罪犯编号',
`prisoner_name` varchar(50) DEFAULT NULL COMMENT '罪犯姓名',
`template_id` bigint DEFAULT NULL COMMENT '模板ID',
`template_name` varchar(100) DEFAULT NULL COMMENT '模板名称',
`evaluation_type` tinyint DEFAULT NULL COMMENT '评估类型1-心理评估 2-危险性评估 3-改造表现评估 4-综合评估',
`evaluation_cycle` tinyint DEFAULT NULL COMMENT '评估周期1-月评 2-季评 3-半年评 4-年终评 5-入监评估 6-出监评估',
`evaluation_date` datetime DEFAULT NULL COMMENT '评估日期',
`evaluator_id` bigint DEFAULT NULL COMMENT '评估人员ID',
`evaluator_name` varchar(50) DEFAULT NULL COMMENT '评估人员姓名',
`area_id` bigint DEFAULT NULL COMMENT '监区ID',
`area_name` varchar(100) DEFAULT NULL COMMENT '监区名称',
`total_score` decimal(10,2) DEFAULT 0.00 COMMENT '总分',
`level` tinyint DEFAULT NULL COMMENT '评级1-优秀 2-良好 3-一般 4-较差 5-危险',
`risk_level` tinyint DEFAULT NULL COMMENT '风险等级1-低风险 2-中风险 3-高风险 4-极高风险',
`risk_score` decimal(10,2) DEFAULT 0.00 COMMENT '风险得分',
`ai_status` tinyint DEFAULT 1 COMMENT 'AI生成状态1-待生成 2-生成中 3-已完成 4-生成失败',
`ai_content` text COMMENT 'AI生成内容',
`ai_report_content` text COMMENT 'AI生成报告内容',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '报告状态1-草稿 2-待审核 3-已审核 4-已作废',
`auditor_id` bigint DEFAULT NULL COMMENT '审核人ID',
`auditor_name` varchar(50) DEFAULT NULL COMMENT '审核人姓名',
`audit_time` datetime DEFAULT NULL COMMENT '审核时间',
`audit_opinion` varchar(500) DEFAULT NULL COMMENT '审核意见',
`conclusion` text COMMENT '报告结论',
`suggestions` text COMMENT '改造建议',
`pdf_path` varchar(500) DEFAULT NULL COMMENT '报告PDF路径',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_report_no` (`report_no`, `tenant_id`),
KEY `idx_prisoner_id` (`prisoner_id`),
KEY `idx_evaluation_date` (`evaluation_date`),
KEY `idx_status` (`status`)
) ENGINE=InnoDB COMMENT='评估报告表';
-- ============================================
-- 17. 快速点评表 (prison_quick_comment)
-- ============================================
DROP TABLE IF EXISTS `prison_quick_comment`;
CREATE TABLE IF NOT EXISTS `prison_quick_comment` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '点评ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`title` varchar(100) NOT NULL COMMENT '点评标题',
`content` varchar(500) NOT NULL COMMENT '点评内容',
`category_id` bigint DEFAULT NULL COMMENT '分类ID',
`sort` int DEFAULT 0 COMMENT '排序',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-启用 2-禁用',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_category_id` (`category_id`)
) ENGINE=InnoDB COMMENT='快速点评表';
-- ============================================
-- 18. 快速点评分类表 (prison_comment_category)
-- ============================================
DROP TABLE IF EXISTS `prison_comment_category`;
CREATE TABLE IF NOT EXISTS `prison_comment_category` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '分类ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`name` varchar(50) NOT NULL COMMENT '分类名称',
`sort` int DEFAULT 0 COMMENT '排序',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-启用 2-禁用',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`)
) ENGINE=InnoDB COMMENT='快速点评分类表';
-- ============================================
-- 19. 报告模板表 (prison_report_template)
-- ============================================
DROP TABLE IF EXISTS `prison_report_template`;
CREATE TABLE IF NOT EXISTS `prison_report_template` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '模板ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`name` varchar(100) NOT NULL COMMENT '模板名称',
`type` tinyint NOT NULL COMMENT '模板类型1-评估报告 2-月度报告 3-季度报告',
`content` text COMMENT '模板内容HTML或Markdown',
`fields` text COMMENT '字段配置JSON',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-启用 2-禁用',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_type` (`type`)
) ENGINE=InnoDB COMMENT='报告模板表';
-- ============================================
-- 20. 报告表 (prison_report)
-- ============================================
DROP TABLE IF EXISTS `prison_report`;
CREATE TABLE IF NOT EXISTS `prison_report` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '报告ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`title` varchar(200) NOT NULL COMMENT '报告标题',
`type` tinyint NOT NULL COMMENT '报告类型1-日报告 2-周报告 3-月报告 4-季度报告 5-年度报告',
`content` text COMMENT '报告内容',
`prison_area_id` bigint DEFAULT NULL COMMENT '监区ID',
`report_date` date DEFAULT NULL COMMENT '报告日期',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-草稿 2-已发布 3-已归档',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_type` (`type`),
KEY `idx_report_date` (`report_date`)
) ENGINE=InnoDB COMMENT='报告表';
-- ============================================
-- 21. 释放登记信息表 (prison_release)
-- ============================================
DROP TABLE IF EXISTS `prison_release`;
CREATE TABLE IF NOT EXISTS `prison_release` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '释放ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`prisoner_id` bigint NOT NULL COMMENT '罪犯ID',
`prisoner_no` varchar(50) NOT NULL COMMENT '罪犯编号',
`release_type` tinyint NOT NULL COMMENT '释放类型1-刑满释放 2-假释 3-保外就医 4-减刑 5-暂予监外执行 6-特赦 7-死亡 8-其他',
`release_date` date NOT NULL COMMENT '释放日期',
`release_reason` varchar(500) DEFAULT NULL COMMENT '释放原因',
`approve_no` varchar(50) DEFAULT NULL COMMENT '批准文号',
`destination` varchar(200) DEFAULT NULL COMMENT '释放去向',
`contact_phone` varchar(20) DEFAULT NULL COMMENT '联系电话',
`emergency_contact` varchar(100) DEFAULT NULL COMMENT '紧急联系人',
`emergency_phone` varchar(20) DEFAULT NULL COMMENT '紧急联系人电话',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-待释放 2-已释放 3-已取消',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_prisoner_id` (`prisoner_id`),
KEY `idx_release_date` (`release_date`)
) ENGINE=InnoDB COMMENT='释放登记信息表';
-- ============================================
-- 22. 风险评估维度表 (prison_risk)
-- ============================================
DROP TABLE IF EXISTS `prison_risk`;
CREATE TABLE IF NOT EXISTS `prison_risk` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '维度ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`name` varchar(50) NOT NULL COMMENT '维度名称',
`code` varchar(50) NOT NULL COMMENT '维度编码',
`description` varchar(500) DEFAULT NULL COMMENT '维度描述',
`weight` decimal(5,2) DEFAULT NULL COMMENT '权重',
`max_score` decimal(10,2) DEFAULT 100.00 COMMENT '最高分值',
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态1-启用 2-禁用',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_code` (`code`, `tenant_id`)
) ENGINE=InnoDB COMMENT='风险评估维度表';
-- ============================================
-- 23. 评估报告维度表 (prison_evaluation_dimension)
-- ============================================
DROP TABLE IF EXISTS `prison_evaluation_dimension`;
CREATE TABLE IF NOT EXISTS `prison_evaluation_dimension` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '维度ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`report_id` bigint NOT NULL COMMENT '报告ID',
`dimension_name` varchar(100) NOT NULL COMMENT '维度名称',
`dimension_code` varchar(50) DEFAULT NULL COMMENT '维度编码',
`score` decimal(10,2) DEFAULT 0.00 COMMENT '得分',
`max_score` decimal(10,2) DEFAULT 100.00 COMMENT '满分',
`level` varchar(20) DEFAULT NULL COMMENT '评级',
`description` text COMMENT '维度描述',
`suggestion` text COMMENT '建议',
`sort` int DEFAULT 0 COMMENT '排序',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_report_id` (`report_id`)
) ENGINE=InnoDB COMMENT='评估报告维度表';
-- ============================================
-- 24. 评估报告维度数据表 (prison_evaluation_dimension_data)
-- ============================================
DROP TABLE IF EXISTS `prison_evaluation_dimension_data`;
CREATE TABLE IF NOT EXISTS `prison_evaluation_dimension_data` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '数据ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`dimension_id` bigint NOT NULL COMMENT '维度ID',
`data_type` varchar(50) NOT NULL COMMENT '数据类型score-得分 evidence-证据 behavior-行为',
`content` text COMMENT '内容',
`score` decimal(10,2) DEFAULT 0.00 COMMENT '得分',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_dimension_id` (`dimension_id`)
) ENGINE=InnoDB COMMENT='评估报告维度数据表';
-- ============================================
-- 25. 报告评价表 (prison_report_comment)
-- ============================================
DROP TABLE IF EXISTS `prison_report_comment`;
CREATE TABLE IF NOT EXISTS `prison_report_comment` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '评价ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`report_id` bigint NOT NULL COMMENT '报告ID',
`type` tinyint NOT NULL COMMENT '评价类型1-总体评价 2-优点 3-不足 4-建议',
`content` text NOT NULL COMMENT '评价内容',
`score` decimal(10,2) DEFAULT NULL COMMENT '评价得分',
`sort` int DEFAULT 0 COMMENT '排序',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_report_id` (`report_id`)
) ENGINE=InnoDB COMMENT='报告评价表';
-- ============================================
-- 26. 消费明细表 (prison_consumption_detail)
-- ============================================
DROP TABLE IF EXISTS `prison_consumption_detail`;
CREATE TABLE IF NOT EXISTS `prison_consumption_detail` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '明细ID',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
`consumption_id` bigint NOT NULL COMMENT '消费ID',
`goods_name` varchar(100) NOT NULL COMMENT '商品名称',
`goods_code` varchar(50) DEFAULT NULL COMMENT '商品编码',
`quantity` int DEFAULT 1 COMMENT '数量',
`unit_price` decimal(10,2) NOT NULL COMMENT '单价',
`total_price` decimal(10,2) NOT NULL COMMENT '总价',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY `idx_consumption_id` (`consumption_id`)
) ENGINE=InnoDB COMMENT='消费明细表';
-- 恢复外键检查
SET FOREIGN_KEY_CHECKS = 1;
-- ============================================
-- 索引优化建议
-- ============================================
-- 为常用查询添加复合索引
-- ALTER TABLE prison_prisoner ADD INDEX idx_area_cell (prison_area_id, prison_cell_id);
-- ALTER TABLE prison_score ADD INDEX idx_prisoner_year_month (prisoner_id, year, month);
-- ALTER TABLE prison_warning ADD INDEX idx_type_level_status (type, level, status);
-- ============================================
-- 字段注释更新脚本(可选)
-- ============================================
-- COMMENT ON COLUMN prison_prisoner.children IS '子女情况';
-- COMMENT ON COLUMN prison_questionnaire.cover_image IS '封面图片URL';
-- COMMENT ON COLUMN prison_questionnaire.instruction IS '填写说明';
-- COMMENT ON COLUMN prison_questionnaire.estimated_time IS '预计耗时(分钟)';
-- COMMENT ON COLUMN prison_questionnaire.part_count IS '分区数量';
-- COMMENT ON COLUMN prison_questionnaire.allow_anonymous IS '是否允许匿名0-不允许 1-允许';

View File

@ -2,10 +2,11 @@ package cn.iocoder.yudao.framework.quartz.core.scheduler;
import cn.iocoder.yudao.framework.quartz.core.enums.JobDataKeyEnum;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker;
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import org.quartz.*;
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.NOT_IMPLEMENTED;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
/**
* {@link org.quartz.Scheduler} 的管理器负责创建任务
@ -142,7 +143,7 @@ public class SchedulerManager {
private void validateScheduler() {
if (scheduler == null) {
throw exception0(NOT_IMPLEMENTED.getCode(),
throw new ServiceException(NOT_IMPLEMENTED.getCode(),
"[定时任务 - 已禁用][参考 https://doc.iocoder.cn/job/ 开启]");
}
}

View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yudao-module-prison</artifactId>
<packaging>jar</packaging>
<name>yudao-module-prison</name>
<description>监狱管理模块:罪犯信息、监区管理、计分考核、危险评估等</description>
<dependencies>
<!-- 引入芋道框架 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-redis</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-data-permission</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-excel</artifactId>
</dependency>
<!-- 引入 system 模块 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-system</artifactId>
<version>${revision}</version>
</dependency>
<!-- 引入 infra 模块 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-infra</artifactId>
<version>${revision}</version>
</dependency>
<!-- 工具类 -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,112 @@
package cn.iocoder.yudao.module.prison.controller.admin.answer;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.prison.controller.admin.answer.vo.*;
import cn.iocoder.yudao.module.prison.dal.dataobject.answer.AnswerDO;
import cn.iocoder.yudao.module.prison.service.answer.AnswerService;
@Tag(name = "管理后台 - 问卷答题记录")
@RestController
@RequestMapping("/prison/answer")
@Validated
public class PrisonAnswerController {
@Resource
private AnswerService answerService;
@PostMapping("/create")
@Operation(summary = "创建答题记录")
@PreAuthorize("@ss.hasPermission('prison:answer:create')")
public CommonResult<Long> createAnswer(@Valid @RequestBody AnswerSaveReqVO createReqVO) {
return success(answerService.createAnswer(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新答题记录")
@PreAuthorize("@ss.hasPermission('prison:answer:update')")
public CommonResult<Boolean> updateAnswer(@Valid @RequestBody AnswerSaveReqVO updateReqVO) {
answerService.updateAnswer(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除答题记录")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:answer:delete')")
public CommonResult<Boolean> deleteAnswer(@NotNull(message = "编号不能为空") @RequestParam("id") Long id) {
answerService.deleteAnswer(id);
return success(true);
}
@PostMapping("/delete-list")
@Operation(summary = "批量删除答题记录")
@PreAuthorize("@ss.hasPermission('prison:answer:delete')")
public CommonResult<Boolean> deleteAnswerList(@NotEmpty(message = "编号列表不能为空") @RequestBody List<Long> ids) {
answerService.deleteAnswerListByIds(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得答题记录")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('prison:answer:query')")
public CommonResult<AnswerRespVO> getAnswer(@NotNull(message = "编号不能为空") @RequestParam("id") Long id) {
AnswerDO answer = answerService.getAnswer(id);
return success(BeanUtils.toBean(answer, AnswerRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得答题记录分页")
@PreAuthorize("@ss.hasPermission('prison:answer:query')")
public CommonResult<PageResult<AnswerRespVO>> getAnswerPage(@Valid AnswerPageReqVO pageReqVO) {
PageResult<AnswerDO> pageResult = answerService.getAnswerPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, AnswerRespVO.class));
}
@GetMapping("/list-by-assessment-record")
@Operation(summary = "根据测评记录ID查询答题列表")
@PreAuthorize("@ss.hasPermission('prison:answer:query')")
public CommonResult<List<AnswerRespVO>> getAnswersByAssessmentRecordId(
@NotNull(message = "测评记录ID不能为空") @RequestParam("assessmentRecordId") Long assessmentRecordId) {
List<AnswerDO> list = answerService.getAnswersByAssessmentRecordId(assessmentRecordId);
return success(BeanUtils.toBean(list, AnswerRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出答题记录 Excel")
@PreAuthorize("@ss.hasPermission('prison:answer:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportAnswerExcel(@Valid AnswerPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<AnswerDO> list = answerService.getAnswerPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "答题记录.xls", "数据", AnswerRespVO.class,
BeanUtils.toBean(list, AnswerRespVO.class));
}
}

View File

@ -0,0 +1,31 @@
package cn.iocoder.yudao.module.prison.controller.admin.answer.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
@Schema(description = "管理后台 - 问卷答题记录分页 Request VO")
@Data
public class AnswerPageReqVO extends PageParam {
@Schema(description = "测评记录ID")
private Long assessmentRecordId;
@Schema(description = "问题ID")
private Long questionId;
@Schema(description = "问卷ID")
private Long questionnaireId;
@Schema(description = "罪犯ID")
private Long prisonerId;
@Schema(description = "问题类型1-单选 2-多选 3-填空 4-评分 5-日期 6-数字")
private Integer questionType;
@Schema(description = "创建时间")
private Date[] createTime;
}

View File

@ -0,0 +1,54 @@
package cn.iocoder.yudao.module.prison.controller.admin.answer.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 问卷答题记录 Response VO")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AnswerRespVO {
@Schema(description = "答题记录ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
@Schema(description = "测评记录ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long assessmentRecordId;
@Schema(description = "问题ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long questionId;
@Schema(description = "问卷ID", example = "1024")
private Long questionnaireId;
@Schema(description = "罪犯ID", example = "1024")
private Long prisonerId;
@Schema(description = "问题类型1-单选 2-多选 3-填空 4-评分 5-日期 6-数字", example = "1")
private Integer questionType;
@Schema(description = "答案内容(填空题、评分题等)")
private String answerText;
@Schema(description = "选项ID列表JSON数组如 [1,2,3]")
private String optionIds;
@Schema(description = "得分")
private BigDecimal score;
@Schema(description = "是否正确null-未评分 false-错误 true-正确")
private Boolean isCorrect;
@Schema(description = "答题时间(秒)")
private Integer duration;
@Schema(description = "创建者", example = "芋艿")
private String creator;
@Schema(description = "创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,49 @@
package cn.iocoder.yudao.module.prison.controller.admin.answer.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 问卷答题记录新增/修改 Request VO")
@Data
public class AnswerSaveReqVO {
@Schema(description = "答题记录ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26045")
private Long id;
@Schema(description = "测评记录ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@NotNull(message = "测评记录ID不能为空")
private Long assessmentRecordId;
@Schema(description = "问题ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@NotNull(message = "问题ID不能为空")
private Long questionId;
@Schema(description = "问卷ID")
private Long questionnaireId;
@Schema(description = "罪犯ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@NotNull(message = "罪犯ID不能为空")
private Long prisonerId;
@Schema(description = "问题类型1-单选 2-多选 3-填空 4-评分 5-日期 6-数字", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "问题类型不能为空")
private Integer questionType;
@Schema(description = "答案内容(填空题、评分题等)")
private String answerText;
@Schema(description = "选项ID列表JSON数组如 [1,2,3]")
private String optionIds;
@Schema(description = "得分")
private BigDecimal score;
@Schema(description = "是否正确null-未评分 false-错误 true-正确")
private Boolean isCorrect;
@Schema(description = "答题时间(秒)")
private Integer duration;
}

View File

@ -0,0 +1,181 @@
package cn.iocoder.yudao.module.prison.controller.admin.area;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.util.stream.Collectors;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.prison.controller.admin.area.vo.*;
import cn.iocoder.yudao.module.prison.dal.dataobject.area.AreaDO;
import cn.iocoder.yudao.module.prison.service.area.AreaService;
@Tag(name = "管理后台 - 监区信息")
@RestController
@RequestMapping("/prison/area")
@Validated
public class PrisonAreaController {
@Resource
private AreaService areaService;
@PostMapping("/create")
@Operation(summary = "创建监区信息")
@PreAuthorize("@ss.hasPermission('prison:area:create')")
public CommonResult<Long> createArea(@Valid @RequestBody AreaSaveReqVO createReqVO) {
return success(areaService.createArea(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新监区信息")
@PreAuthorize("@ss.hasPermission('prison:area:update')")
public CommonResult<Boolean> updateArea(@Valid @RequestBody AreaSaveReqVO updateReqVO) {
areaService.updateArea(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除监区信息")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:area:delete')")
public CommonResult<Boolean> deleteArea(@NotNull(message = "编号不能为空") @RequestParam("id") Long id) {
areaService.deleteArea(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除监区信息")
@PreAuthorize("@ss.hasPermission('prison:area:delete')")
public CommonResult<Boolean> deleteAreaList(@NotEmpty(message = "编号列表不能为空") @RequestParam("ids") List<Long> ids) {
areaService.deleteAreaListByIds(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得监区信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('prison:area:query')")
public CommonResult<AreaRespVO> getArea(@RequestParam("id") Long id) {
AreaDO area = areaService.getArea(id);
return success(BeanUtils.toBean(area, AreaRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得监区信息分页")
@PreAuthorize("@ss.hasPermission('prison:area:query')")
public CommonResult<PageResult<AreaRespVO>> getAreaPage(@Valid AreaPageReqVO pageReqVO) {
PageResult<AreaDO> pageResult = areaService.getAreaPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, AreaRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出监区信息 Excel")
@PreAuthorize("@ss.hasPermission('prison:area:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportAreaExcel(@Valid AreaPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<AreaDO> list = areaService.getAreaPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "监区信息.xlsx", "数据", AreaRespVO.class,
BeanUtils.toBean(list, AreaRespVO.class));
}
@GetMapping("/tree")
@Operation(summary = "获得监区树形结构")
@PreAuthorize("@ss.hasPermission('prison:area:query')")
public CommonResult<List<AreaRespVO>> getAreaTree(
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "type", required = false) Integer type,
@RequestParam(value = "level", required = false) Integer level,
@RequestParam(value = "status", required = false) Integer status) {
List<AreaDO> tree = areaService.getAreaTree(name, type, level, status);
return success(convertTreeToRespVO(tree));
}
/**
* 递归转换 AreaDO 树形结构到 AreaRespVO
*/
private List<AreaRespVO> convertTreeToRespVO(List<AreaDO> areas) {
if (areas == null || areas.isEmpty()) {
return new ArrayList<>();
}
List<AreaRespVO> result = new ArrayList<>();
for (AreaDO area : areas) {
result.add(convertToRespVO(area));
}
return result;
}
/**
* 递归转换单个 AreaDO AreaRespVO
*/
private AreaRespVO convertToRespVO(AreaDO area) {
AreaRespVO resp = new AreaRespVO();
resp.setId(area.getId());
resp.setName(area.getName());
resp.setCode(area.getCode());
resp.setParentId(area.getParentId());
resp.setLevel(area.getLevel());
resp.setType(area.getType());
resp.setCapacity(area.getCapacity());
resp.setCurrentCount(area.getCurrentCount());
resp.setSort(area.getSort());
resp.setStatus(area.getStatus());
resp.setRemark(area.getRemark());
resp.setCreateTime(area.getCreateTime());
// 递归设置子节点
if (area.getChildren() != null && !area.getChildren().isEmpty()) {
resp.setChildren(convertTreeToRespVO(area.getChildren()));
}
return resp;
}
@GetMapping("/children")
@Operation(summary = "获得子监区列表")
@Parameter(name = "parentId", description = "父级ID", required = true)
@PreAuthorize("@ss.hasPermission('prison:area:query')")
public CommonResult<List<AreaRespVO>> getChildAreas(@RequestParam("parentId") Long parentId) {
List<AreaDO> children = areaService.getChildAreas(parentId);
return success(BeanUtils.toBean(children, AreaRespVO.class));
}
@GetMapping("/parent-list")
@Operation(summary = "获得父级监区列表")
@Parameter(name = "level", description = "监区级别", required = false)
@PreAuthorize("@ss.hasPermission('prison:area:query')")
public CommonResult<List<AreaRespVO>> getParentAreas(@RequestParam(value = "level", required = false) Integer level) {
List<AreaDO> parentAreas = areaService.getParentAreas(level);
return success(BeanUtils.toBean(parentAreas, AreaRespVO.class));
}
@PostMapping("/sync-current-count")
@Operation(summary = "同步监区当前人数")
@PreAuthorize("@ss.hasPermission('prison:area:update')")
public CommonResult<Boolean> syncCurrentCount(@RequestParam("areaId") Long areaId) {
areaService.syncCurrentCount(areaId);
return success(true);
}
}

View File

@ -0,0 +1,44 @@
package cn.iocoder.yudao.module.prison.controller.admin.area.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 监区信息分页 Request VO")
@Data
public class AreaPageReqVO extends PageParam {
@Schema(description = "监区名称", example = "第一监区")
private String name;
@Schema(description = "监区编码")
private String code;
@Schema(description = "监区类型1-普通监区 2-严管监区 3-集训监区 4-出监监区 5-医院 6-禁闭室", example = "1")
private Integer type;
@Schema(description = "容纳人数")
private Integer capacity;
@Schema(description = "当前人数", example = "100")
private Integer currentCount;
@Schema(description = "排序")
private Integer sort;
@Schema(description = "状态1-启用 2-禁用", example = "1")
private Integer status;
@Schema(description = "备注", example = "正常运行的监区")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,69 @@
package cn.iocoder.yudao.module.prison.controller.admin.area.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import cn.idev.excel.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Schema(description = "管理后台 - 监区信息 Response VO")
@Data
@ExcelIgnoreUnannotated
public class AreaRespVO {
@Schema(description = "监区ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19443")
@ExcelProperty("监区ID")
private Long id;
@Schema(description = "监区名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "第一监区")
@ExcelProperty("监区名称")
private String name;
@Schema(description = "监区编码", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("监区编码")
private String code;
@Schema(description = "父级ID0表示顶级监区")
@ExcelProperty("父级ID")
private Long parentId;
@Schema(description = "级别1-监区(大队) 2-分监区(中队)")
@ExcelProperty("级别")
private Integer level;
@Schema(description = "监区类型1-普通监区 2-严管监区 3-集训监区 4-出监监区 5-医院 6-禁闭室", example = "1")
@ExcelProperty("监区类型")
private Integer type;
@Schema(description = "容纳人数")
@ExcelProperty("容纳人数")
private Integer capacity;
@Schema(description = "当前人数", example = "100")
@ExcelProperty("当前人数")
private Integer currentCount;
@Schema(description = "排序")
@ExcelProperty("排序")
private Integer sort;
@Schema(description = "状态1-启用 2-禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("状态1-启用 2-禁用")
private Integer status;
@Schema(description = "备注", example = "正常运行的监区")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private LocalDateTime createTime;
@Schema(description = "子监区列表,仅一级监区返回")
private List<AreaRespVO> children;
}

View File

@ -0,0 +1,53 @@
package cn.iocoder.yudao.module.prison.controller.admin.area.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 监区信息新增/修改 Request VO")
@Data
public class AreaSaveReqVO {
@Schema(description = "监区ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19443")
private Long id;
@Schema(description = "监区名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "第一监区")
@NotEmpty(message = "监区名称不能为空")
private String name;
@Schema(description = "监区编码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "监区编码不能为空")
private String code;
@Schema(description = "父级ID0表示顶级监区")
private Long parentId;
@Schema(description = "级别1-监区(大队) 2-分监区(中队)")
@NotNull(message = "级别不能为空")
private Integer level;
@Schema(description = "监区类型1-普通监区 2-严管监区 3-集训监区 4-出监监区 5-医院 6-禁闭室", example = "1")
@NotNull(message = "监区类型不能为空")
private Integer type;
@Schema(description = "容纳人数")
@Min(value = 0, message = "容纳人数不能为负数")
private Integer capacity;
@Schema(description = "当前人数", example = "100")
@Min(value = 0, message = "当前人数不能为负数")
private Integer currentCount;
@Schema(description = "排序")
@Min(value = 0, message = "排序不能为负数")
private Integer sort;
@Schema(description = "状态1-启用 2-禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "状态1-启用 2-禁用不能为空")
private Integer status;
@Schema(description = "备注", example = "正常运行的监区")
private String remark;
}

View File

@ -0,0 +1,133 @@
package cn.iocoder.yudao.module.prison.controller.admin.cell;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.*;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.module.prison.dal.dataobject.area.AreaDO;
import cn.iocoder.yudao.module.prison.dal.mysql.area.AreaMapper;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.prison.controller.admin.cell.vo.*;
import cn.iocoder.yudao.module.prison.dal.dataobject.cell.CellDO;
import cn.iocoder.yudao.module.prison.service.cell.CellService;
@Tag(name = "管理后台 - 监室信息")
@RestController
@RequestMapping("/prison/cell")
@Validated
public class PrisonCellController {
@Resource
private CellService cellService;
@Resource
private AreaMapper areaMapper;
@PostMapping("/create")
@Operation(summary = "创建监室信息")
@PreAuthorize("@ss.hasPermission('prison:cell:create')")
public CommonResult<Long> createCell(@Valid @RequestBody CellSaveReqVO createReqVO) {
return success(cellService.createCell(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新监室信息")
@PreAuthorize("@ss.hasPermission('prison:cell:update')")
public CommonResult<Boolean> updateCell(@Valid @RequestBody CellSaveReqVO updateReqVO) {
cellService.updateCell(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除监室信息")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:cell:delete')")
public CommonResult<Boolean> deleteCell(@NotNull(message = "编号不能为空") @RequestParam("id") Long id) {
cellService.deleteCell(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除监室信息")
@PreAuthorize("@ss.hasPermission('prison:cell:delete')")
public CommonResult<Boolean> deleteCellList(@NotEmpty(message = "编号列表不能为空") @RequestParam("ids") List<Long> ids) {
cellService.deleteCellListByIds(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得监室信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('prison:cell:query')")
public CommonResult<CellRespVO> getCell(@RequestParam("id") Long id) {
CellDO cell = cellService.getCell(id);
if (cell == null) {
return success(null);
}
CellRespVO respVO = BeanUtils.toBean(cell, CellRespVO.class);
// 显式设置创建时间因为继承字段可能未正确复制
respVO.setCreateTime(cell.getCreateTime());
// 填充监区名称
if (cell.getAreaId() != null) {
AreaDO area = areaMapper.selectById(cell.getAreaId());
if (area != null) {
respVO.setAreaName(area.getName());
}
}
return success(respVO);
}
@GetMapping("/page")
@Operation(summary = "获得监室信息分页")
@PreAuthorize("@ss.hasPermission('prison:cell:query')")
public CommonResult<PageResult<CellRespVO>> getCellPage(@Valid CellPageReqVO pageReqVO) {
return success(cellService.getCellPage(pageReqVO));
}
@GetMapping("/list")
@Operation(summary = "获得监室列表")
public CommonResult<List<CellRespVO>> getCellList(
@RequestParam(value = "areaId", required = false) Long areaId,
@RequestParam(value = "status", required = false) Integer status) {
CellPageReqVO pageReqVO = new CellPageReqVO();
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
pageReqVO.setAreaId(areaId);
pageReqVO.setStatus(status);
return success(cellService.getCellPage(pageReqVO).getList());
}
@GetMapping("/export-excel")
@Operation(summary = "导出监室信息 Excel")
@PreAuthorize("@ss.hasPermission('prison:cell:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportCellExcel(@Valid CellPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<CellRespVO> list = cellService.getCellPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "监室信息.xlsx", "数据", CellRespVO.class, list);
}
}

View File

@ -0,0 +1,44 @@
package cn.iocoder.yudao.module.prison.controller.admin.cell.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 监室信息分页 Request VO")
@Data
public class CellPageReqVO extends PageParam {
@Schema(description = "所属监区ID", example = "9889")
private Long areaId;
@Schema(description = "监室名称", example = "101监室")
private String name;
@Schema(description = "监室编码")
private String code;
@Schema(description = "床位数量")
private Integer capacity;
@Schema(description = "当前人数", example = "5")
private Integer currentCount;
@Schema(description = "排序")
private Integer sort;
@Schema(description = "状态1-启用 2-禁用", example = "1")
private Integer status;
@Schema(description = "备注", example = "正常使用的监室")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,61 @@
package cn.iocoder.yudao.module.prison.controller.admin.cell.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import cn.idev.excel.annotation.*;
@Schema(description = "管理后台 - 监室信息 Response VO")
@Data
@ExcelIgnoreUnannotated
public class CellRespVO {
@Schema(description = "监室ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4727")
@ExcelProperty("监室ID")
private Long id;
@Schema(description = "所属监区ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9889")
@ExcelProperty("所属监区ID")
private Long areaId;
@Schema(description = "所属监区名称", example = "一监区")
@ExcelProperty("所属监区")
private String areaName;
@Schema(description = "监室名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@ExcelProperty("监室名称")
private String name;
@Schema(description = "监室编码", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("监室编码")
private String code;
@Schema(description = "床位数量")
@ExcelProperty("床位数量")
private Integer capacity;
@Schema(description = "当前人数", example = "31423")
@ExcelProperty("当前人数")
private Integer currentCount;
@Schema(description = "排序")
@ExcelProperty("排序")
private Integer sort;
@Schema(description = "状态1-启用 2-禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("状态1-启用 2-禁用")
private Integer status;
@Schema(description = "备注", example = "随便")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,48 @@
package cn.iocoder.yudao.module.prison.controller.admin.cell.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 监室信息新增/修改 Request VO")
@Data
public class CellSaveReqVO {
@Schema(description = "监室ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4727")
private Long id;
@Schema(description = "所属监区ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9889")
@NotNull(message = "所属监区ID不能为空")
private Long areaId;
@Schema(description = "监室名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "101监室")
@NotEmpty(message = "监室名称不能为空")
private String name;
@Schema(description = "监室编码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "监室编码不能为空")
private String code;
@Schema(description = "床位数量", example = "10")
@Min(value = 0, message = "床位数量不能小于0")
private Integer capacity;
@Schema(description = "当前人数", example = "5")
@Min(value = 0, message = "当前人数不能小于0")
private Integer currentCount;
@Schema(description = "排序", example = "1")
@Min(value = 0, message = "排序不能小于0")
private Integer sort;
@Schema(description = "状态1-启用 2-禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "状态1-启用 2-禁用不能为空")
@Min(value = 1, message = "状态最小值为1")
@Max(value = 2, message = "状态最大值为2")
private Integer status;
@Schema(description = "备注", example = "正常使用的监室")
private String remark;
}

View File

@ -0,0 +1,140 @@
package cn.iocoder.yudao.module.prison.controller.admin.consumption;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.module.prison.controller.admin.vo.ImportRespVO;
import org.springframework.web.multipart.MultipartFile;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.prison.controller.admin.consumption.vo.*;
import cn.iocoder.yudao.module.prison.dal.dataobject.consumption.ConsumptionDetailDO;
import cn.iocoder.yudao.module.prison.service.consumption.ConsumptionService;
import cn.iocoder.yudao.module.prison.convert.consumption.ConsumptionDetailConvert;
@Tag(name = "管理后台 - 消费订单")
@RestController
@RequestMapping("/prison/consumption")
@Validated
public class PrisonConsumptionController {
@Resource
private ConsumptionService consumptionService;
@PostMapping("/create")
@Operation(summary = "创建消费订单")
@PreAuthorize("@ss.hasPermission('prison:consumption:create')")
public CommonResult<Long> createConsumption(@Valid @RequestBody ConsumptionSaveReqVO createReqVO) {
return success(consumptionService.createConsumption(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新消费订单")
@PreAuthorize("@ss.hasPermission('prison:consumption:update')")
public CommonResult<Boolean> updateConsumption(@Valid @RequestBody ConsumptionSaveReqVO updateReqVO) {
consumptionService.updateConsumption(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除消费订单")
@Parameter(name = "id", description = "订单编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:consumption:delete')")
public CommonResult<Boolean> deleteConsumption(@NotNull(message = "编号不能为空") @RequestParam("id") Long id) {
consumptionService.deleteConsumption(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号列表", required = true)
@Operation(summary = "批量删除消费订单")
@PreAuthorize("@ss.hasPermission('prison:consumption:delete')")
public CommonResult<Boolean> deleteConsumptionList(@NotEmpty(message = "编号列表不能为空") @RequestParam("ids") List<Long> ids) {
consumptionService.deleteConsumptionListByIds(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得消费订单详情")
@Parameter(name = "id", description = "订单编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('prison:consumption:query')")
public CommonResult<ConsumptionRespVO> getConsumption(@RequestParam("id") Long id) {
return success(consumptionService.getConsumption(id));
}
@GetMapping("/page")
@Operation(summary = "获得消费订单分页")
@PreAuthorize("@ss.hasPermission('prison:consumption:query')")
public CommonResult<PageResult<ConsumptionRespVO>> getConsumptionPage(@Valid ConsumptionPageReqVO pageReqVO) {
return success(consumptionService.getConsumptionPage(pageReqVO));
}
@GetMapping("/detail-list")
@Operation(summary = "获得消费订单明细列表")
@Parameter(name = "consumptionId", description = "消费订单ID", required = true)
@PreAuthorize("@ss.hasPermission('prison:consumption:query')")
public CommonResult<List<ConsumptionDetailRespVO>> getConsumptionDetailList(
@RequestParam("consumptionId") Long consumptionId) {
List<ConsumptionDetailDO> detailList = consumptionService.getConsumptionDetailList(consumptionId);
return success(ConsumptionDetailConvert.INSTANCE.convertListResp(detailList));
}
@GetMapping("/export-excel")
@Operation(summary = "导出消费订单 Excel")
@PreAuthorize("@ss.hasPermission('prison:consumption:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportConsumptionExcel(@Valid ConsumptionPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ConsumptionRespVO> list = consumptionService.getConsumptionPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "消费订单.xls", "数据", ConsumptionRespVO.class, list);
}
@GetMapping("/get-import-template")
@Operation(summary = "获取消费记录导入模板")
public void getImportTemplate(HttpServletResponse response) throws IOException {
// 手动创建导出 demo
List<ConsumptionImportExcelVO> list = Arrays.asList(
ConsumptionImportExcelVO.builder()
.prisonerNo("ZF20230001")
.type(1)
.totalAmount(new java.math.BigDecimal("50.00"))
.tradeTime("2024-01-15 10:30:00")
.status(1)
.remark("示例数据")
.build()
);
// 输出
ExcelUtils.write(response, "消费记录导入模板.xls", "消费记录", ConsumptionImportExcelVO.class, list);
}
@PostMapping("/import")
@Operation(summary = "导入消费记录")
@PreAuthorize("@ss.hasPermission('prison:consumption:import')")
public CommonResult<ImportRespVO> importExcel(@RequestParam("file") MultipartFile file) throws Exception {
List<ConsumptionImportExcelVO> list = ExcelUtils.read(file, ConsumptionImportExcelVO.class);
ImportRespVO respVO = consumptionService.importConsumption(list);
return success(respVO);
}
}

View File

@ -0,0 +1,41 @@
package cn.iocoder.yudao.module.prison.controller.admin.consumption.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.math.BigDecimal;
import cn.idev.excel.annotation.*;
@Schema(description = "管理后台 - 消费订单明细 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ConsumptionDetailRespVO {
@Schema(description = "明细ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4042")
@ExcelProperty("明细ID")
private Long id;
@Schema(description = "消费订单ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@ExcelProperty("消费订单ID")
private Long consumptionId;
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("商品名称")
private String goodsName;
@Schema(description = "商品编码")
@ExcelProperty("商品编码")
private String goodsCode;
@Schema(description = "商品单价", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("商品单价")
private BigDecimal goodsPrice;
@Schema(description = "商品数量", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("商品数量")
private Integer goodsCount;
@Schema(description = "小计金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("小计金额")
private BigDecimal subtotal;
}

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.prison.controller.admin.consumption.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import jakarta.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import cn.idev.excel.annotation.*;
@Schema(description = "管理后台 - 消费订单明细新增/修改 Request VO")
@Data
public class ConsumptionDetailSaveReqVO {
@Schema(description = "明细ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4042")
private Long id;
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "商品名称不能为空")
private String goodsName;
@Schema(description = "商品编码")
private String goodsCode;
@Schema(description = "商品单价", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "商品单价不能为空")
private BigDecimal goodsPrice;
@Schema(description = "商品数量", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "商品数量不能为空")
private Integer goodsCount;
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.prison.controller.admin.consumption.vo;
import cn.idev.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* 消费记录导入 Excel VO
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "消费记录导入 Excel VO")
public class ConsumptionImportExcelVO {
@ExcelProperty("罪犯编号")
private String prisonerNo;
@ExcelProperty("类型(1-购物 2-餐饮 3-医疗 4-通讯 5-其他)")
private Integer type;
@ExcelProperty("订单总金额")
private BigDecimal totalAmount;
@ExcelProperty("交易时间(yyyy-MM-dd HH:mm:ss)")
private String tradeTime;
@ExcelProperty("状态(1-成功 2-失败)")
private Integer status;
@ExcelProperty("备注")
private String remark;
}

View File

@ -0,0 +1,71 @@
package cn.iocoder.yudao.module.prison.controller.admin.consumption.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.Size;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 消费订单分页 Request VO")
@Data
public class ConsumptionPageReqVO extends PageParam {
@Schema(description = "罪犯ID", example = "25932")
@Min(value = 1, message = "罪犯ID必须为正数")
private Long prisonerId;
@Schema(description = "罪犯编号")
@Size(max = 50, message = "罪犯编号长度不能超过50个字符")
private String prisonerNo;
@Schema(description = "罪犯姓名", example = "张三")
private String prisonerName;
@Schema(description = "监区ID", example = "1")
private Long prisonAreaId;
@Schema(description = "监室ID", example = "1")
private Long prisonCellId;
@Schema(description = "类型1-购物 2-餐饮 3-医疗 4-通讯 5-其他", example = "1")
@Min(value = 1, message = "类型最小值为1")
@Max(value = 5, message = "类型最大值为5")
private Integer type;
@Schema(description = "订单总金额")
@Min(value = 0, message = "订单总金额不能为负数")
private BigDecimal totalAmount;
@Schema(description = "账户余额")
@Min(value = 0, message = "账户余额不能为负数")
private BigDecimal balance;
@Schema(description = "订单号")
@Size(max = 64, message = "订单号长度不能超过64个字符")
private String orderNo;
@Schema(description = "交易时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] tradeTime;
@Schema(description = "状态1-成功 2-失败", example = "1")
@Min(value = 1, message = "状态最小值为1")
@Max(value = 2, message = "状态最大值为2")
private Integer status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "备注")
@Size(max = 500, message = "备注长度不能超过500个字符")
private String remark;
}

View File

@ -0,0 +1,89 @@
package cn.iocoder.yudao.module.prison.controller.admin.consumption.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import cn.idev.excel.annotation.*;
@Schema(description = "管理后台 - 消费订单 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ConsumptionRespVO {
@Schema(description = "消费ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4042")
@ExcelProperty("消费ID")
private Long id;
@Schema(description = "罪犯ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25932")
@ExcelProperty("罪犯ID")
private Long prisonerId;
@Schema(description = "罪犯编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("罪犯编号")
private String prisonerNo;
@Schema(description = "罪犯姓名", example = "张三")
@ExcelProperty("罪犯姓名")
private String prisonerName;
@Schema(description = "监区ID", example = "1")
private Long prisonAreaId;
@Schema(description = "监区名称", example = "一监区")
@ExcelProperty("监区")
private String prisonAreaName;
@Schema(description = "监室ID", example = "1")
private Long prisonCellId;
@Schema(description = "监室名称", example = "101监室")
@ExcelProperty("监室")
private String prisonCellName;
@Schema(description = "订单号")
@ExcelProperty("订单号")
private String orderNo;
@Schema(description = "类型1-购物 2-餐饮 3-医疗 4-通讯 5-其他", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("类型")
private Integer type;
@Schema(description = "订单总金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("订单总金额")
private BigDecimal totalAmount;
@Schema(description = "账户余额(消费后)")
@ExcelProperty("账户余额")
private BigDecimal balance;
@Schema(description = "交易时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("交易时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private LocalDateTime tradeTime;
@Schema(description = "状态1-成功 2-失败", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("状态")
private Integer status;
@Schema(description = "备注", example = "订单备注")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private LocalDateTime createTime;
@Schema(description = "更新时间")
@ExcelProperty("更新时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private LocalDateTime updateTime;
@Schema(description = "消费明细列表")
private List<ConsumptionDetailRespVO> details;
}

View File

@ -0,0 +1,54 @@
package cn.iocoder.yudao.module.prison.controller.admin.consumption.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 消费订单新增/修改 Request VO")
@Data
public class ConsumptionSaveReqVO {
@Schema(description = "消费ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4042")
private Long id;
@Schema(description = "罪犯ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25932")
@NotNull(message = "罪犯ID不能为空")
private Long prisonerId;
@Schema(description = "罪犯编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "罪犯编号不能为空")
private String prisonerNo;
@Schema(description = "订单号")
private String orderNo;
@Schema(description = "类型1-购物 2-餐饮 3-医疗 4-通讯 5-其他", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "类型不能为空")
private Integer type;
@Schema(description = "订单总金额", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "订单总金额不能为空")
private BigDecimal totalAmount;
@Schema(description = "账户余额(消费后)")
private BigDecimal balance;
@Schema(description = "交易时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "交易时间不能为空")
private LocalDateTime tradeTime;
@Schema(description = "状态1-成功 2-失败", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "状态不能为空")
private Integer status;
@Schema(description = "备注", example = "订单备注")
private String remark;
@Schema(description = "消费明细列表")
private List<ConsumptionDetailSaveReqVO> details;
}

View File

@ -0,0 +1,62 @@
package cn.iocoder.yudao.module.prison.controller.admin.dashboard;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.prison.controller.admin.dashboard.vo.*;
import cn.iocoder.yudao.module.prison.service.dashboard.PrisonDashboardService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
* 管理后台 - 监管看板
*
* @author xlcp
*/
@RestController
@RequestMapping("/prison/dashboard")
@Tag(name = "管理后台 - 监管看板")
@RequiredArgsConstructor
public class PrisonDashboardController {
private final PrisonDashboardService dashboardService;
@GetMapping("/statistics")
@Operation(summary = "获取看板统计数据")
@PreAuthorize("@ss.hasPermission('prison:dashboard:query')")
public DashboardStatisticsVO getStatistics() {
return dashboardService.getDashboardStatistics();
}
@GetMapping("/prisoner-stats")
@Operation(summary = "获取罪犯工作台统计数据")
@Parameter(name = "prisonerId", description = "罪犯ID", required = true, example = "1")
@PreAuthorize("@ss.hasPermission('prison:dashboard:query')")
public CommonResult<PrisonerDashboardStatsRespVO> getPrisonerStats(@RequestParam("prisonerId") Long prisonerId) {
return success(dashboardService.getPrisonerStats(prisonerId));
}
@GetMapping("/ai-dash-entry/statistics")
@Operation(summary = "获取AI心航360°统计数据")
@PreAuthorize("@ss.hasPermission('prison:ai-dash-entry:query')")
public CommonResult<AiDashEntryStatisticsVO> getAiDashEntryStatistics() {
return success(dashboardService.getAiDashEntryStatistics());
}
@GetMapping("/ai-dash-entry/focus-person-page")
@Operation(summary = "获取重点关注对象分页列表")
@PreAuthorize("@ss.hasPermission('prison:ai-dash-entry:query')")
public CommonResult<PageResult<FocusPersonVO>> getFocusPersonPage(@Valid FocusPersonPageReqVO reqVO) {
return success(dashboardService.getFocusPersonPage(reqVO));
}
}

View File

@ -0,0 +1,97 @@
package cn.iocoder.yudao.module.prison.controller.admin.dashboard.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Schema(description = "管理后台 - AI心航360°统计 Response VO")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AiDashEntryStatisticsVO {
// ==================== 统计卡片数据 ====================
@Schema(description = "全部人员数量")
private Integer totalCount;
@Schema(description = "本月新增人员数量")
private Integer monthlyNewCount;
@Schema(description = "本月较上月变化")
private Integer monthlyChange;
@Schema(description = "高危人员数量")
private Integer highRiskCount;
@Schema(description = "高危本月新增")
private Integer highRiskMonthlyNew;
@Schema(description = "高危本月变化")
private Integer highRiskMonthlyChange;
@Schema(description = "预警人员数量")
private Integer warningCount;
@Schema(description = "预警本月新增")
private Integer warningMonthlyNew;
@Schema(description = "预警本月变化")
private Integer warningMonthlyChange;
@Schema(description = "普通人员数量")
private Integer normalCount;
@Schema(description = "普通本月新增")
private Integer normalMonthlyNew;
@Schema(description = "普通本月变化")
private Integer normalMonthlyChange;
// ==================== 图表数据 ====================
@Schema(description = "风险等级分布")
private List<RiskDistributionVO> riskDistribution;
@Schema(description = "风险趋势数据")
private List<RiskTrendVO> riskTrendData;
/**
* 风险等级分布数据
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class RiskDistributionVO {
@Schema(description = "名称")
private String name;
@Schema(description = "数量")
private Integer value;
@Schema(description = "颜色")
private String color;
}
/**
* 风险趋势数据
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class RiskTrendVO {
@Schema(description = "月份")
private String month;
@Schema(description = "高危人数")
private Integer highRisk;
@Schema(description = "预警人数")
private Integer warning;
@Schema(description = "普通人数")
private Integer normal;
}
}

View File

@ -0,0 +1,25 @@
package cn.iocoder.yudao.module.prison.controller.admin.dashboard.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Schema(description = "图表数据项")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ChartDataVO {
@Schema(description = "分组名称", example = "青年(18-30)")
private String name;
@Schema(description = "数量", example = "100")
private Integer value;
@Schema(description = "占比", example = "28.5")
private Double percentage;
}

View File

@ -0,0 +1,49 @@
package cn.iocoder.yudao.module.prison.controller.admin.dashboard.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Schema(description = "管理后台 - 监管看板统计 Response VO")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DashboardStatisticsVO {
// ==================== 核心指标卡片 ====================
@Schema(description = "在册罪犯总数")
private Integer totalPrisoners;
@Schema(description = "本月已释放人数")
private Integer monthlyReleased;
@Schema(description = "本月已移交人数")
private Integer monthlyTransferred;
@Schema(description = "当前就医人数")
private Integer hospitalCount;
@Schema(description = "当前禁闭人数")
private Integer solitaryCount;
// ==================== 图表数据 ====================
@Schema(description = "年龄分布")
private List<ChartDataVO> ageDistribution;
@Schema(description = "刑期分布")
private List<ChartDataVO> sentenceDistribution;
@Schema(description = "文化程度分布")
private List<ChartDataVO> educationDistribution;
@Schema(description = "省份分布")
private List<ProvinceChartVO> provinceDistribution;
}

View File

@ -0,0 +1,23 @@
package cn.iocoder.yudao.module.prison.controller.admin.dashboard.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 重点关注对象分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class FocusPersonPageReqVO extends PageParam {
@Schema(description = "风险等级类型high-高危, warning-预警, normal-普通, 空为全部")
private String riskLevelType;
@Schema(description = "罪犯姓名,模糊匹配")
private String name;
@Schema(description = "监区ID")
private Long areaId;
}

View File

@ -0,0 +1,42 @@
package cn.iocoder.yudao.module.prison.controller.admin.dashboard.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Schema(description = "管理后台 - 重点关注对象 Response VO")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class FocusPersonVO {
@Schema(description = "罪犯ID")
private Long id;
@Schema(description = "罪犯姓名")
private String name;
@Schema(description = "性别")
private String gender;
@Schema(description = "年龄")
private Integer age;
@Schema(description = "风险等级high-高危, warning-预警, normal-普通")
private String riskLevelType;
@Schema(description = "风险等级文本")
private String riskLevel;
@Schema(description = "监区")
private String supervisionArea;
@Schema(description = "心理风险等级")
private String psychologicalRiskLevel;
@Schema(description = "是否新增")
private Boolean isNew;
}

View File

@ -0,0 +1,222 @@
package cn.iocoder.yudao.module.prison.controller.admin.dashboard.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 罪犯工作台统计响应 VO
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "管理后台 - 罪犯工作台统计 Response VO")
public class PrisonerDashboardStatsRespVO {
@Schema(description = "罪犯姓名", example = "张三")
private String prisonerName;
@Schema(description = "监区信息", example = "一监区一分监区")
private String prisonArea;
@Schema(description = "罪犯编号", example = "ZF20230001")
private String prisonerNo;
@Schema(description = "入狱时间", example = "2023-01-15")
private String imprisonmentDate;
@Schema(description = "出狱时间", example = "2028-01-14")
private String releaseDate;
@Schema(description = "已服刑天数", example = "365")
private Integer servedDays;
@Schema(description = "年龄", example = "35")
private Integer age;
@Schema(description = "籍贯", example = "浙江省杭州市")
private String nativePlace;
@Schema(description = "文化程度", example = "大专")
private String education;
@Schema(description = "婚姻状况", example = "已婚")
private String maritalStatus;
@Schema(description = "子女情况", example = "一子一女")
private String children;
@Schema(description = "出生日期", example = "1990-05-20")
private String birthDate;
@Schema(description = "犯罪类型", example = "盗窃罪")
private String crimeType;
@Schema(description = "前科次数", example = "0")
private String previousConvictions;
@Schema(description = "刑期", example = "5年")
private String sentence;
@Schema(description = "风险评估分", example = "35")
private Integer riskScore;
@Schema(description = "风险等级1-低风险 2-中风险 3-高风险 4-极高风险", example = "1")
private Integer riskLevel;
@Schema(description = "中心左侧数据")
private CenterLeftData centerLeftData;
@Schema(description = "中心右侧数据")
private CenterRightData centerRightData;
@Schema(description = "月度消费数据")
private List<MonthlyConsumptionData> consumptionMonthlyData;
@Schema(description = "消费汇总")
private ConsumptionSummary consumptionSummary;
@Schema(description = "心理访谈记录")
private List<InterviewRecord> interviewRecords;
@Schema(description = "近期奖惩记录")
private List<RewardsPunishment> rewardsPunishments;
@Schema(description = "计分考核记录")
private List<ScoreRecord> scoreRecords;
@Schema(description = "消费记录")
private List<ConsumptionRecord> consumptionRecords;
@Schema(description = "汇款记录")
private List<RemittanceRecord> remittanceRecords;
@Schema(description = "关系人信息")
private List<RelationshipInfo> relationships;
// ==================== 内部类定义 ====================
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class CenterLeftData {
private String topValue;
private String topLabel;
private String middleLeftValue;
private String middleLeftLabel;
private String middleRightValue;
private String middleRightLabel;
private String bottomValue;
private String bottomLabel;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class CenterRightData {
private String topValue;
private String topLabel;
private String middleLeftValue;
private String middleLeftLabel;
private String middleRightValue;
private String middleRightLabel;
private String bottomLeftValue;
private String bottomLeftLabel;
private String bottomRightValue;
private String bottomRightLabel;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class MonthlyConsumptionData {
private String category;
private Integer monthlyStandard;
private Integer perCapita;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class ConsumptionSummary {
private Integer inProgress;
private Integer toWarehouse;
private Integer outWarehouse;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class InterviewRecord {
private String date;
private String content;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class RewardsPunishment {
private String date;
private String type;
private String typeText;
private String content;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class ScoreRecord {
private String date;
private String score;
private String scoreType;
private Integer finalScore;
private String level;
private String levelText;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class ConsumptionRecord {
private String date;
private String name;
private String nameColor;
private String category;
private Integer amount;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class RemittanceRecord {
private String date;
private String name;
private String nameColor;
private String category;
private Integer amount;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class RelationshipInfo {
private String name;
private String relate;
private String color;
}
}

View File

@ -0,0 +1,25 @@
package cn.iocoder.yudao.module.prison.controller.admin.dashboard.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Schema(description = "省份图表数据")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ProvinceChartVO {
@Schema(description = "省份名称", example = "河南省")
private String province;
@Schema(description = "省份名称/编码", example = "河南省或上海")
private String provinceCode;
@Schema(description = "人数", example = "156")
private Integer count;
}

View File

@ -0,0 +1,487 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.io.IOException;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo.*;
import cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo.EvaluationTemplateWithDimensionsRespVO;
import cn.iocoder.yudao.module.prison.dal.dataobject.evaluationreport.*;
import cn.iocoder.yudao.module.prison.service.evaluationreport.EvaluationReportService;
import cn.iocoder.yudao.module.prison.service.evaluationreport.dto.DimensionDataSourcesRespDTO;
import cn.iocoder.yudao.module.prison.enums.EvaluationTemplateTypeEnum;
import cn.iocoder.yudao.module.prison.enums.EvaluationCycleEnum;
@Tag(name = "管理后台 - 评估报告")
@RestController
@RequestMapping("/prison/evaluation-report")
@Validated
public class EvaluationReportController {
@Resource
private EvaluationReportService evaluationReportService;
// ========== 模板管理 ==========
@PostMapping("/template/create")
@Operation(summary = "创建评估模板")
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:template:create')")
public CommonResult<Long> createTemplate(@Valid @RequestBody EvaluationTemplateSaveReqVO createReqVO) {
return success(evaluationReportService.createTemplate(createReqVO));
}
@PutMapping("/template/update")
@Operation(summary = "更新评估模板")
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:template:update')")
public CommonResult<Boolean> updateTemplate(@Valid @RequestBody EvaluationTemplateSaveReqVO updateReqVO) {
evaluationReportService.updateTemplate(updateReqVO);
return success(true);
}
@DeleteMapping("/template/delete")
@Operation(summary = "删除评估模板")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:template:delete')")
public CommonResult<Boolean> deleteTemplate(@NotNull(message = "编号不能为空") @RequestParam("id") Long id) {
evaluationReportService.deleteTemplate(id);
return success(true);
}
@DeleteMapping("/template/delete-list")
@Operation(summary = "批量删除评估模板")
@Parameter(name = "ids", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:template:delete')")
public CommonResult<Boolean> deleteTemplateList(@NotEmpty(message = "编号列表不能为空") @RequestParam("ids") List<Long> ids) {
evaluationReportService.deleteTemplateListByIds(ids);
return success(true);
}
@GetMapping("/template/get")
@Operation(summary = "获得评估模板")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasAnyPermissions('prison:evaluation-report:template:query', 'prison:evaluation-report:report:query')")
public CommonResult<EvaluationTemplateRespVO> getTemplate(@RequestParam("id") Long id) {
EvaluationTemplateDO template = evaluationReportService.getTemplate(id);
return success(BeanUtils.toBean(template, EvaluationTemplateRespVO.class));
}
@GetMapping("/template/page")
@Operation(summary = "获得评估模板分页")
@PreAuthorize("@ss.hasAnyPermissions('prison:evaluation-report:template:query', 'prison:evaluation-report:report:query')")
public CommonResult<PageResult<EvaluationTemplateRespVO>> getTemplatePage(@Valid EvaluationTemplatePageReqVO pageReqVO) {
PageResult<EvaluationTemplateDO> pageResult = evaluationReportService.getTemplatePage(pageReqVO);
// 转换为 VO 并填充枚举名称
List<EvaluationTemplateRespVO> voList = pageResult.getList().stream().map(template -> {
EvaluationTemplateRespVO vo = BeanUtils.toBean(template, EvaluationTemplateRespVO.class);
// 填充模板类型名称
if (template.getType() != null) {
EvaluationTemplateTypeEnum typeEnum = EvaluationTemplateTypeEnum.fromValue(template.getType());
if (typeEnum != null) {
vo.setTypeName(typeEnum.getName());
}
}
// 填充评估周期名称
if (template.getEvaluationCycle() != null) {
EvaluationCycleEnum cycleEnum = EvaluationCycleEnum.fromValue(template.getEvaluationCycle());
if (cycleEnum != null) {
vo.setEvaluationCycleName(cycleEnum.getName());
}
}
// 填充状态名称
if (template.getStatus() != null) {
vo.setStatusName(template.getStatus() == 1 ? "启用" : "禁用");
}
// 填充AI允许名称
if (template.getAiEnabled() != null) {
vo.setAiEnabledName(template.getAiEnabled() == 1 ? "" : "");
}
return vo;
}).collect(Collectors.toList());
return success(new PageResult<>(voList, pageResult.getTotal()));
}
@GetMapping("/template/list-enabled")
@Operation(summary = "获取启用的模板列表")
@PreAuthorize("@ss.hasAnyPermissions('prison:evaluation-report:template:query', 'prison:evaluation-report:report:query')")
public CommonResult<List<EvaluationTemplateRespVO>> getEnabledTemplateList() {
List<EvaluationTemplateDO> list = evaluationReportService.getEnabledTemplateList();
return success(BeanUtils.toBean(list, EvaluationTemplateRespVO.class));
}
@PostMapping("/template/export-excel")
@Operation(summary = "导出评估模板 Excel")
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:template:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportTemplateExcel(@Valid EvaluationTemplatePageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<EvaluationTemplateDO> list = evaluationReportService.getTemplatePage(pageReqVO).getList();
ExcelUtils.write(response, "评估模板.xlsx", "数据", EvaluationTemplateRespVO.class,
BeanUtils.toBean(list, EvaluationTemplateRespVO.class));
}
@GetMapping("/template/export-with-dimensions")
@Operation(summary = "导出单个模板及其维度信息 Excel")
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:template:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportTemplateWithDimensions(@NotNull(message = "编号不能为空") @RequestParam("id") Long id,
HttpServletResponse response) throws IOException {
EvaluationTemplateWithDimensionsRespVO templateWithDimensions = evaluationReportService.getTemplateWithDimensions(id);
// 扁平化导出每个维度一行模板信息重复显示
List<EvaluationTemplateFlattenedRespVO> flattenedData = new ArrayList<>();
if (templateWithDimensions.getDimensions() != null) {
for (EvaluationDimensionRespVO dimension : templateWithDimensions.getDimensions()) {
EvaluationTemplateFlattenedRespVO vo = new EvaluationTemplateFlattenedRespVO();
vo.setTemplateId(templateWithDimensions.getId());
vo.setTemplateName(templateWithDimensions.getName());
vo.setTemplateCode(templateWithDimensions.getCode());
vo.setType(templateWithDimensions.getType());
vo.setDescription(templateWithDimensions.getDescription());
vo.setApplicableCrowd(templateWithDimensions.getApplicableCrowd());
vo.setEvaluationCycle(templateWithDimensions.getEvaluationCycle());
vo.setStatus(templateWithDimensions.getStatus());
vo.setAiEnabled(templateWithDimensions.getAiEnabled());
vo.setDimensionId(dimension.getId());
vo.setDimensionName(dimension.getName());
vo.setDimensionCode(dimension.getCode());
vo.setDimensionType(dimension.getDimensionType());
vo.setWeight(dimension.getWeight());
vo.setScoreRule(dimension.getScoreRule());
vo.setMaxScore(dimension.getMaxScore());
vo.setMinScore(dimension.getMinScore());
vo.setPassScore(dimension.getPassScore());
vo.setEvaluationMethod(dimension.getEvaluationMethod());
vo.setDimensionAiEnabled(dimension.getAiEnabled());
vo.setSort(dimension.getSort());
flattenedData.add(vo);
}
}
ExcelUtils.write(response, "评估模板详情.xlsx", "模板详情", EvaluationTemplateFlattenedRespVO.class, flattenedData);
}
// ========== 维度配置管理 ==========
@PostMapping("/dimension/create")
@Operation(summary = "创建评估维度")
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:template:update')")
public CommonResult<Long> createDimension(@Valid @RequestBody EvaluationDimensionSaveReqVO createReqVO) {
return success(evaluationReportService.createDimension(createReqVO));
}
@PutMapping("/dimension/update")
@Operation(summary = "更新评估维度")
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:template:update')")
public CommonResult<Boolean> updateDimension(@Valid @RequestBody EvaluationDimensionSaveReqVO updateReqVO) {
evaluationReportService.updateDimension(updateReqVO);
return success(true);
}
@DeleteMapping("/dimension/delete")
@Operation(summary = "删除评估维度")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:template:update')")
public CommonResult<Boolean> deleteDimension(@NotNull(message = "编号不能为空") @RequestParam("id") Long id) {
evaluationReportService.deleteDimension(id);
return success(true);
}
@DeleteMapping("/dimension/delete-list")
@Operation(summary = "批量删除评估维度")
@Parameter(name = "ids", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:template:update')")
public CommonResult<Boolean> deleteDimensionList(@NotEmpty(message = "编号列表不能为空") @RequestParam("ids") List<Long> ids) {
evaluationReportService.deleteDimensionListByIds(ids);
return success(true);
}
@GetMapping("/dimension/get")
@Operation(summary = "获得评估维度")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasAnyPermissions('prison:evaluation-report:template:query', 'prison:evaluation-report:report:query')")
public CommonResult<EvaluationDimensionRespVO> getDimension(@RequestParam("id") Long id) {
EvaluationDimensionDO dimension = evaluationReportService.getDimension(id);
return success(BeanUtils.toBean(dimension, EvaluationDimensionRespVO.class));
}
@GetMapping("/dimension/page")
@Operation(summary = "获得评估维度分页")
@PreAuthorize("@ss.hasAnyPermissions('prison:evaluation-report:template:query', 'prison:evaluation-report:report:query')")
public CommonResult<PageResult<EvaluationDimensionRespVO>> getDimensionPage(@Valid EvaluationDimensionPageReqVO pageReqVO) {
PageResult<EvaluationDimensionDO> pageResult = evaluationReportService.getDimensionPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, EvaluationDimensionRespVO.class));
}
@GetMapping("/dimension/list-by-template")
@Operation(summary = "根据模板ID获取维度列表")
@Parameter(name = "templateId", description = "模板ID", required = true)
@PreAuthorize("@ss.hasAnyPermissions('prison:evaluation-report:template:query', 'prison:evaluation-report:report:query')")
public CommonResult<List<EvaluationDimensionRespVO>> getDimensionsByTemplateId(@RequestParam("templateId") Long templateId) {
List<EvaluationDimensionDO> list = evaluationReportService.getDimensionsByTemplateId(templateId);
return success(BeanUtils.toBean(list, EvaluationDimensionRespVO.class));
}
@GetMapping("/dimension/data-sources")
@Operation(summary = "获取维度数据源")
@Parameter(name = "dimensionId", description = "维度ID", required = true)
@Parameter(name = "prisonerId", description = "罪犯ID", required = true)
@PreAuthorize("@ss.hasAnyPermissions('prison:evaluation-report:template:query', 'prison:evaluation-report:report:query')")
public CommonResult<DimensionDataSourcesRespDTO> getDimensionDataSources(
@RequestParam("dimensionId") Long dimensionId,
@RequestParam("prisonerId") Long prisonerId) {
DimensionDataSourcesRespDTO data = evaluationReportService.getDimensionDataSources(dimensionId, prisonerId);
return success(data);
}
@GetMapping(value = "/dimension/stream-generate", produces = "text/event-stream;charset=UTF-8")
@Operation(summary = "流式生成维度评估内容SSE")
@Parameter(name = "dimensionId", description = "维度ID", required = true)
@Parameter(name = "prisonerId", description = "罪犯ID", required = true)
@Parameter(name = "customPrompt", description = "自定义提示词(可选)")
@Parameter(name = "systemPrompt", description = "系统提示词(可选)")
@PreAuthorize("@ss.hasAnyPermissions('prison:evaluation-report:template:update', 'prison:evaluation-report:report:update')")
public SseEmitter streamGenerateDimension(
@RequestParam("dimensionId") Long dimensionId,
@RequestParam("prisonerId") Long prisonerId,
@RequestParam(value = "customPrompt", required = false) String customPrompt,
@RequestParam(value = "systemPrompt", required = false) String systemPrompt) {
return evaluationReportService.streamGenerateDimension(dimensionId, prisonerId, customPrompt, systemPrompt);
}
// ========== 评估报告管理 ==========
@PostMapping("/report/create")
@Operation(summary = "创建评估报告")
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:report:create')")
public CommonResult<Long> createReport(@Valid @RequestBody EvaluationReportSaveReqVO createReqVO) {
return success(evaluationReportService.createReport(createReqVO));
}
@PutMapping("/report/update")
@Operation(summary = "更新评估报告")
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:report:update')")
public CommonResult<Boolean> updateReport(@Valid @RequestBody EvaluationReportSaveReqVO updateReqVO) {
evaluationReportService.updateReport(updateReqVO);
return success(true);
}
@DeleteMapping("/report/delete")
@Operation(summary = "删除评估报告")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:report:delete')")
public CommonResult<Boolean> deleteReport(@NotNull(message = "编号不能为空") @RequestParam("id") Long id) {
evaluationReportService.deleteReport(id);
return success(true);
}
@DeleteMapping("/report/delete-list")
@Operation(summary = "批量删除评估报告")
@Parameter(name = "ids", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:report:delete')")
public CommonResult<Boolean> deleteReportList(@NotEmpty(message = "编号列表不能为空") @RequestParam("ids") List<Long> ids) {
evaluationReportService.deleteReportListByIds(ids);
return success(true);
}
@GetMapping("/report/get")
@Operation(summary = "获得评估报告")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasAnyPermissions('prison:evaluation-report:report:query', 'prison:evaluation-report:template:query')")
public CommonResult<EvaluationReportRespVO> getReport(@RequestParam("id") Long id) {
EvaluationReportDO report = evaluationReportService.getReport(id);
return success(BeanUtils.toBean(report, EvaluationReportRespVO.class));
}
@GetMapping("/report/page")
@Operation(summary = "获得评估报告分页")
@PreAuthorize("@ss.hasAnyPermissions('prison:evaluation-report:report:query', 'prison:evaluation-report:template:query')")
public CommonResult<PageResult<EvaluationReportRespVO>> getReportPage(@Valid EvaluationReportPageReqVO pageReqVO) {
PageResult<EvaluationReportDO> pageResult = evaluationReportService.getReportPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, EvaluationReportRespVO.class));
}
@GetMapping("/report/get-by-report-no")
@Operation(summary = "根据报告编号获取报告")
@Parameter(name = "reportNo", description = "报告编号", required = true)
@PreAuthorize("@ss.hasAnyPermissions('prison:evaluation-report:report:query', 'prison:evaluation-report:template:query')")
public CommonResult<EvaluationReportRespVO> getReportByReportNo(@RequestParam("reportNo") String reportNo) {
EvaluationReportDO report = evaluationReportService.getReportByReportNo(reportNo);
return success(BeanUtils.toBean(report, EvaluationReportRespVO.class));
}
@GetMapping("/report/list-by-prisoner")
@Operation(summary = "根据罪犯ID获取报告列表")
@Parameter(name = "prisonerId", description = "罪犯ID", required = true)
@PreAuthorize("@ss.hasAnyPermissions('prison:evaluation-report:report:query', 'prison:evaluation-report:template:query')")
public CommonResult<List<EvaluationReportRespVO>> getReportsByPrisonerId(@RequestParam("prisonerId") Long prisonerId) {
List<EvaluationReportDO> list = evaluationReportService.getReportsByPrisonerId(prisonerId);
return success(BeanUtils.toBean(list, EvaluationReportRespVO.class));
}
@PostMapping("/report/submit")
@Operation(summary = "提交报告审核")
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:report:update')")
public CommonResult<Boolean> submitReport(@RequestParam("id") Long id) {
evaluationReportService.submitReport(id);
return success(true);
}
@PostMapping("/report/audit")
@Operation(summary = "审核报告")
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:report:audit')")
public CommonResult<Boolean> auditReport(@Valid @RequestBody EvaluationReportAuditReqVO auditReqVO) {
evaluationReportService.auditReport(auditReqVO);
return success(true);
}
@PostMapping("/report/void")
@Operation(summary = "作废报告")
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:report:void')")
public CommonResult<Boolean> voidReport(@RequestParam("id") Long id) {
evaluationReportService.voidReport(id);
return success(true);
}
@PostMapping("/report/export-excel")
@Operation(summary = "导出评估报告 Excel")
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:report:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportReportExcel(@Valid EvaluationReportPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<EvaluationReportDO> list = evaluationReportService.getReportPage(pageReqVO).getList();
ExcelUtils.write(response, "评估报告.xlsx", "数据", EvaluationReportRespVO.class,
BeanUtils.toBean(list, EvaluationReportRespVO.class));
}
// ========== 维度数据管理 ==========
@PostMapping("/dimension-data/create")
@Operation(summary = "创建维度数据")
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:report:update')")
public CommonResult<Long> createDimensionData(@Valid @RequestBody EvaluationDimensionDataSaveReqVO createReqVO) {
return success(evaluationReportService.createDimensionData(createReqVO));
}
@PutMapping("/dimension-data/update")
@Operation(summary = "更新维度数据")
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:report:update')")
public CommonResult<Boolean> updateDimensionData(@Valid @RequestBody EvaluationDimensionDataSaveReqVO updateReqVO) {
evaluationReportService.updateDimensionData(updateReqVO);
return success(true);
}
@DeleteMapping("/dimension-data/delete")
@Operation(summary = "删除维度数据")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:report:update')")
public CommonResult<Boolean> deleteDimensionData(@NotNull(message = "编号不能为空") @RequestParam("id") Long id) {
evaluationReportService.deleteDimensionData(id);
return success(true);
}
@GetMapping("/dimension-data/list-by-report")
@Operation(summary = "根据报告ID获取维度数据列表")
@Parameter(name = "reportId", description = "报告ID", required = true)
@PreAuthorize("@ss.hasAnyPermissions('prison:evaluation-report:report:query', 'prison:evaluation-report:template:query')")
public CommonResult<List<EvaluationDimensionDataRespVO>> getDimensionDataListByReportId(@RequestParam("reportId") Long reportId) {
List<EvaluationDimensionDataDO> list = evaluationReportService.getDimensionDataListByReportId(reportId);
return success(BeanUtils.toBean(list, EvaluationDimensionDataRespVO.class));
}
// ========== 快捷评语库管理 ==========
@PostMapping("/comment/create")
@Operation(summary = "创建快捷评语")
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:comment:create')")
public CommonResult<Long> createComment(@Valid @RequestBody ReportCommentSaveReqVO createReqVO) {
return success(evaluationReportService.createComment(createReqVO));
}
@PutMapping("/comment/update")
@Operation(summary = "更新快捷评语")
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:comment:update')")
public CommonResult<Boolean> updateComment(@Valid @RequestBody ReportCommentSaveReqVO updateReqVO) {
evaluationReportService.updateComment(updateReqVO);
return success(true);
}
@DeleteMapping("/comment/delete")
@Operation(summary = "删除快捷评语")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:comment:delete')")
public CommonResult<Boolean> deleteComment(@NotNull(message = "编号不能为空") @RequestParam("id") Long id) {
evaluationReportService.deleteComment(id);
return success(true);
}
@DeleteMapping("/comment/delete-list")
@Operation(summary = "批量删除快捷评语")
@Parameter(name = "ids", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:comment:delete')")
public CommonResult<Boolean> deleteCommentList(@NotEmpty(message = "编号列表不能为空") @RequestParam("ids") List<Long> ids) {
evaluationReportService.deleteCommentListByIds(ids);
return success(true);
}
@GetMapping("/comment/get")
@Operation(summary = "获得快捷评语")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:comment:query')")
public CommonResult<ReportCommentRespVO> getComment(@RequestParam("id") Long id) {
ReportCommentDO comment = evaluationReportService.getComment(id);
return success(BeanUtils.toBean(comment, ReportCommentRespVO.class));
}
@GetMapping("/comment/page")
@Operation(summary = "获得快捷评语分页")
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:comment:query')")
public CommonResult<PageResult<ReportCommentRespVO>> getCommentPage(@Valid ReportCommentPageReqVO pageReqVO) {
PageResult<ReportCommentDO> pageResult = evaluationReportService.getCommentPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ReportCommentRespVO.class));
}
@GetMapping("/comment/list-by-type-level")
@Operation(summary = "根据类型和等级获取评语列表")
@Parameter(name = "commentType", description = "评语类型", required = true)
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:comment:query')")
public CommonResult<List<ReportCommentRespVO>> getCommentsByTypeAndLevel(
@RequestParam("commentType") Integer commentType,
@RequestParam(value = "level", required = false) Integer level) {
List<ReportCommentDO> list = evaluationReportService.getCommentsByTypeAndLevel(commentType, level);
return success(BeanUtils.toBean(list, ReportCommentRespVO.class));
}
@GetMapping("/comment/list-by-dimension")
@Operation(summary = "根据维度ID获取评语列表")
@Parameter(name = "dimensionId", description = "维度ID", required = true)
@PreAuthorize("@ss.hasPermission('prison:evaluation-report:comment:query')")
public CommonResult<List<ReportCommentRespVO>> getCommentsByDimensionId(@RequestParam("dimensionId") Long dimensionId) {
List<ReportCommentDO> list = evaluationReportService.getCommentsByDimensionId(dimensionId);
return success(BeanUtils.toBean(list, ReportCommentRespVO.class));
}
}

View File

@ -0,0 +1,29 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 报告维度数据分页 Request VO")
@Data
public class EvaluationDimensionDataPageReqVO extends PageParam {
@Schema(description = "报告ID")
private Long reportId;
@Schema(description = "维度ID")
private Long dimensionId;
@Schema(description = "维度类型")
private Integer dimensionType;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,80 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import cn.idev.excel.annotation.*;
@Schema(description = "管理后台 - 报告维度数据 Response VO")
@Data
@ExcelIgnoreUnannotated
public class EvaluationDimensionDataRespVO {
@Schema(description = "数据ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19443")
@ExcelProperty("数据ID")
private Long id;
@Schema(description = "报告ID", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("报告ID")
private Long reportId;
@Schema(description = "维度ID", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("维度ID")
private Long dimensionId;
@Schema(description = "维度名称", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("维度名称")
private String dimensionName;
@Schema(description = "维度编码", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("维度编码")
private String dimensionCode;
@Schema(description = "维度类型1-心理测评 2-行为表现 3-教育改造 4-劳动表现 5-人际交往 6-自评/他评")
@ExcelProperty("维度类型")
private Integer dimensionType;
@Schema(description = "得分", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("得分")
private BigDecimal score;
@Schema(description = "满分")
@ExcelProperty("满分")
private BigDecimal fullScore;
@Schema(description = "权重得分")
@ExcelProperty("权重得分")
private BigDecimal weightedScore;
@Schema(description = "评级1-优秀 2-良好 3-一般 4-较差")
@ExcelProperty("评级")
private Integer level;
@Schema(description = "维度结论")
@ExcelProperty("维度结论")
private String conclusion;
@Schema(description = "维度评语")
@ExcelProperty("维度评语")
private String comment;
@Schema(description = "AI分析内容")
private String aiAnalysis;
@Schema(description = "回答详情JSON格式")
private String answerDetails;
@Schema(description = "排序")
@ExcelProperty("排序")
private Integer sort;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,61 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 报告维度数据新增/修改 Request VO")
@Data
public class EvaluationDimensionDataSaveReqVO {
@Schema(description = "数据ID")
private Long id;
@Schema(description = "报告ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "报告ID不能为空")
private Long reportId;
@Schema(description = "维度ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "维度ID不能为空")
private Long dimensionId;
@Schema(description = "维度名称")
private String dimensionName;
@Schema(description = "维度编码")
private String dimensionCode;
@Schema(description = "维度类型1-心理测评 2-行为表现 3-教育改造 4-劳动表现 5-人际交往 6-自评/他评")
private Integer dimensionType;
@Schema(description = "得分")
private BigDecimal score;
@Schema(description = "满分")
private BigDecimal fullScore;
@Schema(description = "权重得分")
private BigDecimal weightedScore;
@Schema(description = "评级1-优秀 2-良好 3-一般 4-较差")
private Integer level;
@Schema(description = "维度结论")
private String conclusion;
@Schema(description = "维度评语")
private String comment;
@Schema(description = "AI分析内容")
private String aiAnalysis;
@Schema(description = "回答详情JSON格式")
private String answerDetails;
@Schema(description = "排序")
@Min(value = 0, message = "排序不能为负数")
private Integer sort;
}

View File

@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 评估维度分页 Request VO")
@Data
public class EvaluationDimensionPageReqVO extends PageParam {
@Schema(description = "模板ID")
private Long templateId;
@Schema(description = "维度名称")
private String name;
@Schema(description = "维度编码")
private String code;
@Schema(description = "维度类型1-心理测评 2-行为表现 3-教育改造 4-劳动表现 5-人际交往 6-自评/他评")
private Integer dimensionType;
@Schema(description = "评估方式1-问卷测评 2-量表评分 3-行为观察 4-AI分析 5-综合评定")
private Integer evaluationMethod;
@Schema(description = "状态1-启用 2-禁用")
private Integer status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,107 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import cn.idev.excel.annotation.*;
@Schema(description = "管理后台 - 评估维度 Response VO")
@Data
@ExcelIgnoreUnannotated
public class EvaluationDimensionRespVO {
@Schema(description = "维度ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19443")
@ExcelProperty("维度ID")
private Long id;
@Schema(description = "模板ID", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("模板ID")
private Long templateId;
@Schema(description = "维度名称", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("维度名称")
private String name;
@Schema(description = "维度编码", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("维度编码")
private String code;
@Schema(description = "维度描述")
@ExcelProperty("维度描述")
private String description;
@Schema(description = "维度类型1-心理测评 2-行为表现 3-教育改造 4-劳动表现 5-人际交往 6-自评/他评", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("维度类型")
private Integer dimensionType;
@Schema(description = "权重(百分比)", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("权重")
private BigDecimal weight;
@Schema(description = "评分规则1-分值越高越好 2-分值越低越好 3-区间评分", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("评分规则")
private Integer scoreRule;
@Schema(description = "最大分值", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("最大分值")
private BigDecimal maxScore;
@Schema(description = "最小分值", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("最小分值")
private BigDecimal minScore;
@Schema(description = "及格分值")
@ExcelProperty("及格分值")
private BigDecimal passScore;
@Schema(description = "评估方式1-问卷测评 2-量表评分 3-行为观察 4-AI分析 5-综合评定")
@ExcelProperty("评估方式")
private Integer evaluationMethod;
@Schema(description = "AI提示词")
@ExcelProperty("AI提示词")
private String aiPrompt;
@Schema(description = "输出格式1-文本 2-数值 3-评分 4-等级 5-综合")
@ExcelProperty("输出格式")
private Integer outputFormat;
@Schema(description = "是否启用AI0-否 1-是")
@ExcelProperty("是否启用AI")
private Integer aiEnabled;
@Schema(description = "编辑器类型1-富文本 2-Markdown 3-纯文本 4-表单编辑")
@ExcelProperty("编辑器类型")
private Integer editorType;
@Schema(description = "是否必填0-否 1-是")
@ExcelProperty("是否必填")
private Integer isRequired;
@Schema(description = "问题列表JSON格式")
private String questions;
@Schema(description = "数据源绑定prisoner-罪犯档案 consumption-消费记录 score-计分考核 questionnaire-问卷测评 risk-风险评估 violation-违规记录 reward-奖励记录 visit-会见记录 labor-劳动数据 family-家庭帮教 psychology-心理测评")
private List<String> dataSources;
@Schema(description = "排序")
@ExcelProperty("排序")
private Integer sort;
@Schema(description = "状态1-启用 2-禁用", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("状态")
private Integer status;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private LocalDateTime createTime;
@Schema(description = "快捷评语列表")
private List<cn.iocoder.yudao.module.prison.dal.dataobject.evaluationreport.ReportCommentDO> commentList;
}

View File

@ -0,0 +1,77 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 评估维度新增/修改 Request VO")
@Data
public class EvaluationDimensionSaveReqVO {
@Schema(description = "维度ID")
private Long id;
@Schema(description = "模板ID")
private Long templateId;
@Schema(description = "维度名称")
private String name;
@Schema(description = "维度编码")
private String code;
@Schema(description = "维度描述")
private String description;
@Schema(description = "维度类型1-心理测评 2-行为表现 3-教育改造 4-劳动表现 5-人际交往 6-自评/他评")
private Integer dimensionType;
@Schema(description = "权重(百分比)")
private BigDecimal weight;
@Schema(description = "评分规则1-分值越高越好 2-分值越低越好 3-区间评分")
private Integer scoreRule;
@Schema(description = "最大分值")
private BigDecimal maxScore;
@Schema(description = "最小分值")
private BigDecimal minScore;
@Schema(description = "及格分值")
private BigDecimal passScore;
@Schema(description = "评估方式1-问卷测评 2-量表评分 3-行为观察 4-AI分析 5-综合评定")
private Integer evaluationMethod;
@Schema(description = "AI提示词")
private String aiPrompt;
@Schema(description = "输出格式1-文本 2-数值 3-评分 4-等级 5-综合")
private Integer outputFormat;
@Schema(description = "是否启用AI0-否 1-是")
private Integer aiEnabled;
@Schema(description = "编辑器类型1-富文本 2-Markdown 3-纯文本 4-表单编辑")
private Integer editorType;
@Schema(description = "是否必填0-否 1-是")
private Integer isRequired;
@Schema(description = "问题列表JSON格式")
private String questions;
@Schema(description = "数据源绑定prisoner-罪犯档案 consumption-消费记录 score-计分考核 questionnaire-问卷测评 risk-风险评估 violation-违规记录 reward-奖励记录 visit-会见记录 labor-劳动数据 family-家庭帮教 psychology-心理测评")
private List<String> dataSources;
@Schema(description = "排序")
@Min(value = 0, message = "排序不能为负数")
private Integer sort;
@Schema(description = "状态1-启用 2-禁用")
private Integer status;
}

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 评估报告审核 Request VO")
@Data
public class EvaluationReportAuditReqVO {
@Schema(description = "报告ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "报告ID不能为空")
private Long id;
@Schema(description = "审核状态3-已审核 4-已作废", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "审核状态不能为空")
private Integer status;
@Schema(description = "审核意见")
private String auditOpinion;
}

View File

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 评估报告分页 Request VO")
@Data
public class EvaluationReportPageReqVO extends PageParam {
@Schema(description = "罪犯ID")
private Long prisonerId;
@Schema(description = "罪犯编号")
private String prisonerNo;
@Schema(description = "罪犯姓名")
private String prisonerName;
@Schema(description = "模板ID")
private Long templateId;
@Schema(description = "评估类型1-心理评估 2-危险性评估 3-改造表现评估 4-综合评估")
private Integer evaluationType;
@Schema(description = "评估周期1-月评 2-季评 3-半年评 4-年终评 5-入监评估 6-出监评估")
private Integer evaluationCycle;
@Schema(description = "评级1-优秀 2-良好 3-一般 4-较差 5-危险")
private Integer level;
@Schema(description = "风险等级1-低风险 2-中风险 3-高风险 4-极高风险")
private Integer riskLevel;
@Schema(description = "报告状态1-草稿 2-待审核 3-已审核 4-已作废")
private Integer status;
@Schema(description = "监区ID")
private Long areaId;
@Schema(description = "评估日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] evaluationDate;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,138 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import cn.idev.excel.annotation.*;
@Schema(description = "管理后台 - 评估报告 Response VO")
@Data
@ExcelIgnoreUnannotated
public class EvaluationReportRespVO {
@Schema(description = "报告ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19443")
@ExcelProperty("报告ID")
private Long id;
@Schema(description = "报告编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("报告编号")
private String reportNo;
@Schema(description = "罪犯ID", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("罪犯ID")
private Long prisonerId;
@Schema(description = "罪犯编号")
@ExcelProperty("罪犯编号")
private String prisonerNo;
@Schema(description = "罪犯姓名")
@ExcelProperty("罪犯姓名")
private String prisonerName;
@Schema(description = "模板ID", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("模板ID")
private Long templateId;
@Schema(description = "模板名称")
@ExcelProperty("模板名称")
private String templateName;
@Schema(description = "评估类型1-心理评估 2-危险性评估 3-改造表现评估 4-综合评估", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("评估类型")
private Integer evaluationType;
@Schema(description = "评估周期1-月评 2-季评 3-半年评 4-年终评 5-入监评估 6-出监评估", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("评估周期")
private Integer evaluationCycle;
@Schema(description = "评估日期")
@ExcelProperty("评估日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime evaluationDate;
@Schema(description = "评估人员ID")
private Long evaluatorId;
@Schema(description = "评估人员姓名")
@ExcelProperty("评估人员")
private String evaluatorName;
@Schema(description = "监区ID")
private Long areaId;
@Schema(description = "监区名称")
@ExcelProperty("监区名称")
private String areaName;
@Schema(description = "总分")
@ExcelProperty("总分")
private BigDecimal totalScore;
@Schema(description = "评级1-优秀 2-良好 3-一般 4-较差 5-危险", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("评级")
private Integer level;
@Schema(description = "风险等级1-低风险 2-中风险 3-高风险 4-极高风险")
@ExcelProperty("风险等级")
private Integer riskLevel;
@Schema(description = "风险得分")
@ExcelProperty("风险得分")
private BigDecimal riskScore;
@Schema(description = "AI生成状态1-待生成 2-生成中 3-已完成 4-生成失败")
@ExcelProperty("AI生成状态")
private Integer aiStatus;
@Schema(description = "AI生成内容")
private String aiContent;
@Schema(description = "AI生成报告内容")
private String aiReportContent;
@Schema(description = "报告状态1-草稿 2-待审核 3-已审核 4-已作废", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("报告状态")
private Integer status;
@Schema(description = "审核人ID")
private Long auditorId;
@Schema(description = "审核人姓名")
@ExcelProperty("审核人")
private String auditorName;
@Schema(description = "审核时间")
@ExcelProperty("审核时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime auditTime;
@Schema(description = "审核意见")
@ExcelProperty("审核意见")
private String auditOpinion;
@Schema(description = "报告结论")
@ExcelProperty("报告结论")
private String conclusion;
@Schema(description = "改造建议")
@ExcelProperty("改造建议")
private String suggestions;
@Schema(description = "报告PDF路径")
private String pdfPath;
@Schema(description = "备注")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,94 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 评估报告新增/修改 Request VO")
@Data
public class EvaluationReportSaveReqVO {
@Schema(description = "报告ID")
private Long id;
@Schema(description = "罪犯ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "罪犯ID不能为空")
private Long prisonerId;
@Schema(description = "罪犯编号")
private String prisonerNo;
@Schema(description = "罪犯姓名")
private String prisonerName;
@Schema(description = "模板ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "模板ID不能为空")
private Long templateId;
@Schema(description = "模板名称")
private String templateName;
@Schema(description = "评估类型1-心理评估 2-危险性评估 3-改造表现评估 4-综合评估", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "评估类型不能为空")
private Integer evaluationType;
@Schema(description = "评估周期1-月评 2-季评 3-半年评 4-年终评 5-入监评估 6-出监评估", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "评估周期不能为空")
private Integer evaluationCycle;
@Schema(description = "评估日期", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "评估日期不能为空")
private LocalDateTime evaluationDate;
@Schema(description = "评估人员ID")
private Long evaluatorId;
@Schema(description = "评估人员姓名")
private String evaluatorName;
@Schema(description = "监区ID")
private Long areaId;
@Schema(description = "监区名称")
private String areaName;
@Schema(description = "总分")
private BigDecimal totalScore;
@Schema(description = "评级1-优秀 2-良好 3-一般 4-较差 5-危险")
private Integer level;
@Schema(description = "风险等级1-低风险 2-中风险 3-高风险 4-极高风险")
private Integer riskLevel;
@Schema(description = "风险得分")
private BigDecimal riskScore;
@Schema(description = "AI生成状态1-待生成 2-生成中 3-已完成 4-生成失败")
private Integer aiStatus;
@Schema(description = "AI生成内容")
private String aiContent;
@Schema(description = "AI生成报告内容")
private String aiReportContent;
@Schema(description = "报告状态1-草稿 2-待审核 3-已审核 4-已作废")
private Integer status;
@Schema(description = "报告结论")
private String conclusion;
@Schema(description = "改造建议")
private String suggestions;
@Schema(description = "报告PDF路径")
private String pdfPath;
@Schema(description = "备注")
private String remark;
}

View File

@ -0,0 +1,97 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import cn.idev.excel.annotation.ExcelProperty;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 评估模板详情导出 VO扁平化")
@Data
public class EvaluationTemplateFlattenedRespVO {
@Schema(description = "模板ID")
@ExcelProperty("模板ID")
private Long templateId;
@Schema(description = "模板名称")
@ExcelProperty("模板名称")
private String templateName;
@Schema(description = "模板编码")
@ExcelProperty("模板编码")
private String templateCode;
@Schema(description = "模板类型1-心理评估 2-危险性评估 3-改造表现评估 4-综合评估")
@ExcelProperty("模板类型")
private Integer type;
@Schema(description = "描述")
@ExcelProperty("描述")
private String description;
@Schema(description = "适用人群")
@ExcelProperty("适用人群")
private String applicableCrowd;
@Schema(description = "评估周期1-月评 2-季评 3-半年评 4-年终评 5-入监评估 6-出监评估")
@ExcelProperty("评估周期")
private Integer evaluationCycle;
@Schema(description = "状态1-启用 2-禁用")
@ExcelProperty("状态")
private Integer status;
@Schema(description = "是否允许AI生成1-是 2-否")
@ExcelProperty("允许AI生成")
private Integer aiEnabled;
@Schema(description = "维度ID")
@ExcelProperty("维度ID")
private Long dimensionId;
@Schema(description = "维度名称")
@ExcelProperty("维度名称")
private String dimensionName;
@Schema(description = "维度编码")
@ExcelProperty("维度编码")
private String dimensionCode;
@Schema(description = "维度类型1-心理测评 2-行为表现 3-教育改造 4-劳动表现 5-人际交往 6-自评/他评")
@ExcelProperty("维度类型")
private Integer dimensionType;
@Schema(description = "权重(百分比)")
@ExcelProperty("权重")
private BigDecimal weight;
@Schema(description = "评分规则1-分值越高越好 2-分值越低越好 3-区间评分")
@ExcelProperty("评分规则")
private Integer scoreRule;
@Schema(description = "最大分值")
@ExcelProperty("最大分值")
private BigDecimal maxScore;
@Schema(description = "最小分值")
@ExcelProperty("最小分值")
private BigDecimal minScore;
@Schema(description = "及格分值")
@ExcelProperty("及格分值")
private BigDecimal passScore;
@Schema(description = "评估方式1-问卷测评 2-量表评分 3-行为观察 4-AI分析 5-综合评定")
@ExcelProperty("评估方式")
private Integer evaluationMethod;
@Schema(description = "是否启用AI0-否 1-是")
@ExcelProperty("维度启用AI")
private Integer dimensionAiEnabled;
@Schema(description = "排序")
@ExcelProperty("排序")
private Integer sort;
}

View File

@ -0,0 +1,38 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 评估模板分页 Request VO")
@Data
public class EvaluationTemplatePageReqVO extends PageParam {
@Schema(description = "模板名称")
private String name;
@Schema(description = "模板编码")
private String code;
@Schema(description = "模板类型1-心理评估 2-危险性评估 3-改造表现评估 4-综合评估")
private Integer type;
@Schema(description = "评估周期1-月评 2-季评 3-半年评 4-年终评 5-入监评估 6-出监评估")
private Integer evaluationCycle;
@Schema(description = "状态1-启用 2-禁用")
private Integer status;
@Schema(description = "是否允许AI生成1-是 2-否")
private Integer aiEnabled;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,98 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import cn.idev.excel.annotation.*;
@Schema(description = "管理后台 - 评估模板 Response VO")
@Data
@ExcelIgnoreUnannotated
public class EvaluationTemplateRespVO {
@Schema(description = "模板ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19443")
@ExcelProperty("模板ID")
private Long id;
@Schema(description = "模板名称", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("模板名称")
private String name;
@Schema(description = "模板编码", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("模板编码")
private String code;
@Schema(description = "模板类型1-心理评估 2-危险性评估 3-改造表现评估 4-综合评估", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("模板类型")
private Integer type;
@Schema(description = "模板类型名称")
@ExcelProperty("模板类型名称")
private String typeName;
@Schema(description = "描述")
@ExcelProperty("描述")
private String description;
@Schema(description = "适用人群")
@ExcelProperty("适用人群")
private String applicableCrowd;
@Schema(description = "评估周期1-月评 2-季评 3-半年评 4-年终评 5-入监评估 6-出监评估", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("评估周期")
private Integer evaluationCycle;
@Schema(description = "评估周期名称")
@ExcelProperty("评估周期名称")
private String evaluationCycleName;
@Schema(description = "状态1-启用 2-禁用", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("状态")
private Integer status;
@Schema(description = "状态名称")
@ExcelProperty("状态名称")
private String statusName;
@Schema(description = "是否允许AI生成1-是 2-否")
@ExcelProperty("允许AI生成")
private Integer aiEnabled;
@Schema(description = "是否允许AI生成名称")
@ExcelProperty("允许AI生成名称")
private String aiEnabledName;
@Schema(description = "AI提示词")
private String aiPrompt;
@Schema(description = "报告封面图")
private String coverImage;
@Schema(description = "排序")
@ExcelProperty("排序")
private Integer sort;
@Schema(description = "备注")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建人")
@ExcelProperty("创建人")
private String creator;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private LocalDateTime createTime;
@Schema(description = "更新人")
private String updater;
@Schema(description = "更新时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private LocalDateTime updateTime;
}

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 评估模板新增/修改 Request VO")
@Data
public class EvaluationTemplateSaveReqVO {
@Schema(description = "模板ID")
private Long id;
@Schema(description = "模板名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "模板名称不能为空")
private String name;
@Schema(description = "模板编码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "模板编码不能为空")
private String code;
@Schema(description = "模板类型1-心理评估 2-危险性评估 3-改造表现评估 4-综合评估", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "模板类型不能为空")
private Integer type;
@Schema(description = "描述")
private String description;
@Schema(description = "适用人群")
private String applicableCrowd;
@Schema(description = "评估周期1-月评 2-季评 3-半年评 4-年终评 5-入监评估 6-出监评估", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "评估周期不能为空")
private Integer evaluationCycle;
@Schema(description = "状态1-启用 2-禁用", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "状态不能为空")
private Integer status;
@Schema(description = "是否允许AI生成1-是 2-否")
private Integer aiEnabled;
@Schema(description = "AI提示词")
private String aiPrompt;
@Schema(description = "报告封面图")
private String coverImage;
@Schema(description = "排序")
@Min(value = 0, message = "排序不能为负数")
private Integer sort;
@Schema(description = "备注")
private String remark;
}

View File

@ -0,0 +1,74 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import cn.idev.excel.annotation.ExcelIgnore;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import java.util.List;
@Schema(description = "管理后台 - 评估模板详情导出 VO")
@Data
@ExcelIgnoreUnannotated
public class EvaluationTemplateWithDimensionsRespVO {
@Schema(description = "模板ID", example = "19443")
@ExcelProperty("模板ID")
private Long id;
@Schema(description = "模板名称", example = "入监综合评估")
@ExcelProperty("模板名称")
private String name;
@Schema(description = "模板编码", example = "INCOMING_ASSESSMENT")
@ExcelProperty("模板编码")
private String code;
@Schema(description = "模板类型1-心理评估 2-危险性评估 3-改造表现评估 4-综合评估")
@ExcelProperty("模板类型")
private Integer type;
@Schema(description = "描述")
@ExcelProperty("描述")
private String description;
@Schema(description = "适用人群", example = "新入监罪犯")
@ExcelProperty("适用人群")
private String applicableCrowd;
@Schema(description = "评估周期1-月评 2-季评 3-半年评 4-年终评 5-入监评估 6-出监评估")
@ExcelProperty("评估周期")
private Integer evaluationCycle;
@Schema(description = "状态1-启用 2-禁用")
@ExcelProperty("状态")
private Integer status;
@Schema(description = "是否允许AI生成1-是 2-否")
@ExcelProperty("允许AI生成")
private Integer aiEnabled;
@Schema(description = "AI提示词")
@ExcelProperty("AI提示词")
private String aiPrompt;
@Schema(description = "排序")
@ExcelProperty("排序")
private Integer sort;
@Schema(description = "备注")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建人")
@ExcelProperty("创建人")
private String creator;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private String createTime;
@Schema(description = "维度列表")
@ExcelIgnore
private List<EvaluationDimensionRespVO> dimensions;
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 快捷评语分页 Request VO")
@Data
public class ReportCommentPageReqVO extends PageParam {
@Schema(description = "评语内容")
private String content;
@Schema(description = "评语类型1-心理评语 2-行为表现评语 3-教育改造评语 4-劳动表现评语 5-综合评语 6-风险提示 7-建议措施")
private Integer commentType;
@Schema(description = "适用维度")
private Long dimensionId;
@Schema(description = "评级等级1-优秀 2-良好 3-一般 4-较差 5-危险")
private Integer level;
@Schema(description = "状态1-启用 2-禁用")
private Integer status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,65 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import cn.idev.excel.annotation.*;
@Schema(description = "管理后台 - 快捷评语 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ReportCommentRespVO {
@Schema(description = "评语ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19443")
@ExcelProperty("评语ID")
private Long id;
@Schema(description = "评语内容", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("评语内容")
private String content;
@Schema(description = "评语类型1-心理评语 2-行为表现评语 3-教育改造评语 4-劳动表现评语 5-综合评语 6-风险提示 7-建议措施", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("评语类型")
private Integer commentType;
@Schema(description = "适用维度(关联维度表)")
@ExcelProperty("维度ID")
private Long dimensionId;
@Schema(description = "维度名称")
@ExcelProperty("维度名称")
private String dimensionName;
@Schema(description = "评级等级1-优秀 2-良好 3-一般 4-较差 5-危险")
@ExcelProperty("评级")
private Integer level;
@Schema(description = "标签(逗号分隔)")
@ExcelProperty("标签")
private String tags;
@Schema(description = "使用次数")
@ExcelProperty("使用次数")
private Integer useCount;
@Schema(description = "状态1-启用 2-禁用", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("状态")
private Integer status;
@Schema(description = "排序")
@ExcelProperty("排序")
private Integer sort;
@Schema(description = "备注")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,46 @@
package cn.iocoder.yudao.module.prison.controller.admin.evaluationreport.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 快捷评语新增/修改 Request VO")
@Data
public class ReportCommentSaveReqVO {
@Schema(description = "评语ID")
private Long id;
@Schema(description = "评语内容", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "评语内容不能为空")
private String content;
@Schema(description = "评语类型1-心理评语 2-行为表现评语 3-教育改造评语 4-劳动表现评语 5-综合评语 6-风险提示 7-建议措施", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "评语类型不能为空")
private Integer commentType;
@Schema(description = "适用维度(关联维度表)")
private Long dimensionId;
@Schema(description = "维度名称")
private String dimensionName;
@Schema(description = "评级等级1-优秀 2-良好 3-一般 4-较差 5-危险")
private Integer level;
@Schema(description = "标签(逗号分隔)")
private String tags;
@Schema(description = "状态1-启用 2-禁用", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "状态不能为空")
private Integer status;
@Schema(description = "排序")
@Min(value = 0, message = "排序不能为负数")
private Integer sort;
@Schema(description = "备注")
private String remark;
}

View File

@ -0,0 +1,173 @@
package cn.iocoder.yudao.module.prison.controller.admin.prisoner;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.prison.controller.admin.prisoner.arealog.vo.PrisonerAreaLogRespVO;
import cn.iocoder.yudao.module.prison.controller.admin.prisoner.vo.*;
import cn.iocoder.yudao.module.prison.convert.prisoner.PrisonerConvert;
import cn.iocoder.yudao.module.prison.convert.prisonerarealog.PrisonerAreaLogConvert;
import cn.iocoder.yudao.module.prison.dal.dataobject.PrisonerAreaLogDO;
import cn.iocoder.yudao.module.prison.dal.dataobject.PrisonerDO;
import cn.iocoder.yudao.module.prison.dal.dataobject.area.AreaDO;
import cn.iocoder.yudao.module.prison.dal.dataobject.cell.CellDO;
import cn.iocoder.yudao.module.prison.dal.mysql.area.AreaMapper;
import cn.iocoder.yudao.module.prison.dal.mysql.cell.CellMapper;
import cn.iocoder.yudao.module.prison.service.PrisonerService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
/**
* 服刑人员信息管理 Controller
*
* @author xlcp
*/
@Tag(name = "管理后台 - 服刑人员信息管理")
@RestController
@RequestMapping("/prison/prisoner")
@Validated
public class PrisonerController {
@Resource
private PrisonerService prisonerService;
@Resource
private AreaMapper areaMapper;
@Resource
private CellMapper cellMapper;
@PostMapping("/create")
@Operation(summary = "新增服刑人员")
@PreAuthorize("@ss.hasPermission('prison:prisoner:create')")
public CommonResult<Long> createPrisoner(@Valid @RequestBody PrisonerSaveReqVO reqVO) {
Long id = prisonerService.createPrisoner(reqVO);
return success(id);
}
@PutMapping("/update")
@Operation(summary = "修改服刑人员")
@PreAuthorize("@ss.hasPermission('prison:prisoner:update')")
public CommonResult<Boolean> updatePrisoner(@Valid @RequestBody PrisonerSaveReqVO reqVO) {
prisonerService.updatePrisoner(reqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除服刑人员")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:prisoner:delete')")
public CommonResult<Boolean> deletePrisoner(@NotNull(message = "编号不能为空") @RequestParam("id") Long id) {
prisonerService.deletePrisoner(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Operation(summary = "批量删除服刑人员")
@Parameter(name = "ids", description = "编号列表", required = true)
@PreAuthorize("@ss.hasPermission('prison:prisoner:delete')")
public CommonResult<Boolean> deletePrisonerList(@NotEmpty(message = "编号列表不能为空") @RequestParam("ids") List<Long> ids) {
prisonerService.deletePrisonerList(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获取服刑人员详情")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:prisoner:query')")
public CommonResult<PrisonerRespVO> getPrisoner(@RequestParam("id") Long id) {
PrisonerDO prisoner = prisonerService.getPrisoner(id);
if (prisoner == null) {
return success(null);
}
PrisonerRespVO vo = PrisonerConvert.INSTANCE.convert(prisoner);
// 设置监区名称
if (prisoner.getPrisonAreaId() != null) {
AreaDO area = areaMapper.selectById(prisoner.getPrisonAreaId());
if (area != null) {
vo.setPrisonAreaName(area.getName());
}
}
// 设置监室名称
if (prisoner.getPrisonCellId() != null) {
CellDO cell = cellMapper.selectById(prisoner.getPrisonCellId());
if (cell != null) {
vo.setPrisonCellName(cell.getName());
}
}
return success(vo);
}
@GetMapping("/page")
@Operation(summary = "获取服刑人员分页列表")
@PreAuthorize("@ss.hasPermission('prison:prisoner:query')")
public CommonResult<PageResult<PrisonerRespVO>> getPrisonerPage(@Valid PrisonerPageReqVO reqVO) {
return success(prisonerService.getPrisonerPage(reqVO));
}
@GetMapping("/get-by-no")
@Operation(summary = "根据服刑人员编号获取服刑人员")
@Parameter(name = "prisonerNo", description = "服刑人员编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:prisoner:query')")
public CommonResult<PrisonerRespVO> getPrisonerByNo(@RequestParam("prisonerNo") String prisonerNo) {
PrisonerDO prisoner = prisonerService.getPrisonerByNo(prisonerNo);
return success(PrisonerConvert.INSTANCE.convert(prisoner));
}
@PostMapping("/export-excel")
@Operation(summary = "导出服刑人员 Excel")
@ApiAccessLog(operateType = EXPORT)
@PreAuthorize("@ss.hasPermission('prison:prisoner:query')")
public void exportExcel(HttpServletResponse response, @Valid PrisonerPageReqVO reqVO) throws IOException {
PageResult<PrisonerRespVO> pageResult = prisonerService.getPrisonerPage(reqVO);
List<PrisonerExcelVO> excelVOs = PrisonerConvert.INSTANCE.convertExcelListFromRespVO(pageResult.getList());
ExcelUtils.write(response, "服刑人员数据.xls", "服刑人员列表", PrisonerExcelVO.class, excelVOs);
}
@PostMapping("/transfer")
@Operation(summary = "调监")
@Parameter(name = "prisonerId", description = "罪犯ID", required = true)
@Parameter(name = "targetCellId", description = "目标监室ID", required = true)
@Parameter(name = "reason", description = "调监原因")
@PreAuthorize("@ss.hasPermission('prison:prisoner:transfer')")
public CommonResult<Boolean> transfer(
@RequestParam("prisonerId") Long prisonerId,
@RequestParam("targetCellId") Long targetCellId,
@RequestParam(value = "reason", required = false) String reason) {
cn.iocoder.yudao.module.prison.controller.admin.prisoner.vo.TransferReqVO reqVO =
new cn.iocoder.yudao.module.prison.controller.admin.prisoner.vo.TransferReqVO();
reqVO.setPrisonerId(prisonerId);
reqVO.setTargetCellId(targetCellId);
reqVO.setReason(reason);
prisonerService.doTransfer(reqVO, getLoginUserId());
return success(true);
}
@GetMapping("/get-area-history")
@Operation(summary = "获取罪犯位置历史轨迹")
@Parameter(name = "id", description = "罪犯ID", required = true)
@PreAuthorize("@ss.hasPermission('prison:prisoner:query')")
public CommonResult<List<PrisonerAreaLogRespVO>> getAreaHistory(@RequestParam("id") Long id) {
List<PrisonerAreaLogDO> list = prisonerService.getAreaHistory(id);
return success(PrisonerAreaLogConvert.INSTANCE.convertList(list));
}
}

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.prison.controller.admin.prisoner.arealog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.prison.controller.admin.prisoner.arealog.vo.*;
import cn.iocoder.yudao.module.prison.convert.prisonerarealog.PrisonerAreaLogConvert;
import cn.iocoder.yudao.module.prison.dal.dataobject.PrisonerAreaLogDO;
import cn.iocoder.yudao.module.prison.service.prisonerarealog.PrisonerAreaLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
* 罪犯监区变动记录 Controller
*
* @author xlcp
*/
@Tag(name = "罪犯监区变动记录")
@RestController
@RequestMapping("/prison/prisoner-area-log")
public class PrisonerAreaLogController {
@Resource
private PrisonerAreaLogService prisonerAreaLogService;
@PostMapping("/create")
@Operation(summary = "创建罪犯监区变动记录")
@PreAuthorize("@ss.hasPermission('prison:prisoner-area-log:create')")
public CommonResult<Long> createPrisonerAreaLog(@Valid @RequestBody PrisonerAreaLogSaveReqVO reqVO) {
return success(prisonerAreaLogService.createPrisonerAreaLog(reqVO));
}
@PutMapping("/update")
@Operation(summary = "更新罪犯监区变动记录")
@PreAuthorize("@ss.hasPermission('prison:prisoner-area-log:update')")
public CommonResult<Boolean> updatePrisonerAreaLog(@Valid @RequestBody PrisonerAreaLogSaveReqVO reqVO) {
prisonerAreaLogService.updatePrisonerAreaLog(reqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除罪犯监区变动记录")
@Parameter(name = "id", description = "记录ID", required = true)
@PreAuthorize("@ss.hasPermission('prison:prisoner-area-log:delete')")
public CommonResult<Boolean> deletePrisonerAreaLog(@NotNull(message = "编号不能为空") @RequestParam("id") Long id) {
prisonerAreaLogService.deletePrisonerAreaLog(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Operation(summary = "批量删除罪犯监区变动记录")
@PreAuthorize("@ss.hasPermission('prison:prisoner-area-log:delete')")
public CommonResult<Boolean> deletePrisonerAreaLogList(@NotEmpty(message = "编号列表不能为空") @RequestParam("ids") List<Long> ids) {
prisonerAreaLogService.deletePrisonerAreaLogList(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获取罪犯监区变动记录")
@Parameter(name = "id", description = "记录ID", required = true)
public CommonResult<PrisonerAreaLogRespVO> getPrisonerAreaLog(@RequestParam("id") Long id) {
PrisonerAreaLogDO areaLog = prisonerAreaLogService.getPrisonerAreaLog(id);
if (areaLog == null) {
return success(null);
}
return success(PrisonerAreaLogConvert.INSTANCE.convert(areaLog));
}
@GetMapping("/page")
@Operation(summary = "获取罪犯监区变动记录分页列表")
public CommonResult<PageResult<PrisonerAreaLogRespVO>> getPrisonerAreaLogPage(@Valid PrisonerAreaLogPageReqVO reqVO) {
PageResult<PrisonerAreaLogDO> page = prisonerAreaLogService.getPrisonerAreaLogPage(reqVO);
return success(PrisonerAreaLogConvert.INSTANCE.convertPage(page));
}
@GetMapping("/list-by-prisoner-id")
@Operation(summary = "获取罪犯的监区变动记录列表")
@Parameter(name = "prisonerId", description = "罪犯ID", required = true)
public CommonResult<List<PrisonerAreaLogRespVO>> getPrisonerAreaLogListByPrisonerId(
@RequestParam("prisonerId") Long prisonerId) {
List<PrisonerAreaLogDO> list = prisonerAreaLogService.getPrisonerAreaLogListByPrisonerId(prisonerId);
return success(PrisonerAreaLogConvert.INSTANCE.convertList(list));
}
}

View File

@ -0,0 +1,41 @@
package cn.iocoder.yudao.module.prison.controller.admin.prisoner.arealog.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* 罪犯监区变动记录分页查询 Request VO
*
* @author xlcp
*/
@Schema(description = "罪犯监区变动记录分页查询")
@Data
@EqualsAndHashCode(callSuper = true)
public class PrisonerAreaLogPageReqVO extends PageParam {
@Schema(description = "罪犯ID", example = "1")
private Long prisonerId;
@Schema(description = "罪犯编号", example = "ZF2024001")
private String prisonerNo;
@Schema(description = "变动类型1-调入 2-调出 3-临时安置 4-医疗回监 5-初始分配", example = "1")
private Integer changeType;
@Schema(description = "原监区ID", example = "1")
private Long fromAreaId;
@Schema(description = "新监区ID", example = "2")
private Long toAreaId;
@Schema(description = "操作开始时间", example = "2024-01-01")
private LocalDateTime operateTimeStart;
@Schema(description = "操作结束时间", example = "2024-12-31")
private LocalDateTime operateTimeEnd;
}

View File

@ -0,0 +1,92 @@
package cn.iocoder.yudao.module.prison.controller.admin.prisoner.arealog.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
/**
* 罪犯监区变动记录 Response VO
*
* @author xlcp
*/
@Schema(description = "罪犯监区变动记录")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PrisonerAreaLogRespVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19443")
private Long id;
@Schema(description = "罪犯ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long prisonerId;
@Schema(description = "罪犯编号", example = "ZF2024001")
private String prisonerNo;
@Schema(description = "罪犯姓名", example = "张三")
private String prisonerName;
@Schema(description = "原监区ID", example = "1")
private Long fromAreaId;
@Schema(description = "原监区名称", example = "一监区")
private String fromAreaName;
@Schema(description = "原分监区ID", example = "1")
private Long fromSubAreaId;
@Schema(description = "原分监区名称", example = "一分监区")
private String fromSubAreaName;
@Schema(description = "原监室ID", example = "1")
private Long fromCellId;
@Schema(description = "原监室名称", example = "101监室")
private String fromCellName;
@Schema(description = "新监区ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Long toAreaId;
@Schema(description = "新监区名称", example = "二监区")
private String toAreaName;
@Schema(description = "新分监区ID", example = "2")
private Long toSubAreaId;
@Schema(description = "新分监区名称", example = "二分监区")
private String toSubAreaName;
@Schema(description = "新监室ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Long toCellId;
@Schema(description = "新监室名称", example = "201监室")
private String toCellName;
@Schema(description = "变动类型1-调入 2-调出 3-临时安置 4-医疗回监 5-初始分配", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer changeType;
@Schema(description = "变动类型名称", example = "调监")
private String transferTypeName;
@Schema(description = "变动原因", example = "因表现良好,调换监区")
private String reason;
@Schema(description = "批准文号", example = "沪狱刑调2024001号")
private String approveNo;
@Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long operateBy;
@Schema(description = "操作人姓名", example = "张警官")
private String operateName;
@Schema(description = "操作时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2024-01-15 10:00:00")
private LocalDateTime operateTime;
@Schema(description = "创建时间", example = "2024-01-15 10:00:00")
private String createTime;
}

View File

@ -0,0 +1,66 @@
package cn.iocoder.yudao.module.prison.controller.admin.prisoner.arealog.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime;
/**
* 罪犯监区变动记录创建/更新 Request VO
*
* @author xlcp
*/
@Schema(description = "罪犯监区变动记录创建/更新")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PrisonerAreaLogSaveReqVO {
@Schema(description = "主键ID", example = "1")
private Long id;
@Schema(description = "罪犯ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "罪犯ID不能为空")
private Long prisonerId;
@Schema(description = "罪犯编号", example = "ZF2024001")
private String prisonerNo;
@Schema(description = "原监区ID", example = "1")
private Long fromAreaId;
@Schema(description = "原监室ID", example = "1")
private Long fromCellId;
@Schema(description = "新监区ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "新监区ID不能为空")
private Long toAreaId;
@Schema(description = "新监室ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "新监室ID不能为空")
private Long toCellId;
@Schema(description = "变动类型1-调入 2-调出 3-临时安置 4-医疗回监 5-初始分配", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "变动类型不能为空")
private Integer changeType;
@Schema(description = "变动原因", example = "因表现良好,调换监区")
private String reason;
@Schema(description = "批准文号", example = "沪狱刑调2024001号")
private String approveNo;
@Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "操作人ID不能为空")
private Long operateBy;
@Schema(description = "操作人姓名", example = "张警官")
private String operateName;
@Schema(description = "操作时间", example = "2024-01-15 10:00:00")
private LocalDateTime operateTime;
}

View File

@ -0,0 +1,73 @@
package cn.iocoder.yudao.module.prison.controller.admin.prisoner.vo;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* 服刑人员信息 Excel VO
*
* @author xlcp
*/
@Data
@HeadRowHeight(30)
public class PrisonerExcelVO {
@ExcelProperty("服刑人员编号")
private String prisonerNo;
@ExcelProperty("姓名")
private String name;
@ExcelProperty("性别")
private Integer gender;
@ExcelProperty("出生日期")
private LocalDate birthday;
@ExcelProperty("民族")
private String ethnicity;
@ExcelProperty("籍贯")
private String nativePlace;
@ExcelProperty("文化程度")
private Integer education;
@ExcelProperty("职业")
private String occupation;
@ExcelProperty("罪名")
private String crime;
@ExcelProperty("刑期(年)")
private Integer sentenceYears;
@ExcelProperty("刑期(月)")
private Integer sentenceMonths;
@ExcelProperty("入狱日期")
private LocalDate imprisonmentDate;
@ExcelProperty("释放日期")
private LocalDate releaseDate;
@ExcelProperty("监管等级")
private Integer supervisionLevel;
@ExcelProperty("风险等级")
private Integer riskLevel;
@ExcelProperty("状态")
private Integer status;
@ExcelProperty("备注")
private String remark;
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,58 @@
package cn.iocoder.yudao.module.prison.controller.admin.prisoner.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate;
/**
* 服刑人员分页查询 Request VO
*
* @author xlcp
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class PrisonerPageReqVO extends PageParam {
@Schema(description = "服刑人员编号", example = "ZF2024001")
private String prisonerNo;
@Schema(description = "姓名", example = "张三")
private String name;
@Schema(description = "性别,参见 GenderEnum 枚举0-未知 1-男 2-女", example = "1")
private Integer gender;
@Schema(description = "身份证号", example = "310101199001011234")
private String idCard;
@Schema(description = "罪名", example = "盗窃罪")
private String crime;
@Schema(description = "监管等级", example = "2")
private Integer supervisionLevel;
@Schema(description = "风险等级", example = "1")
private Integer riskLevel;
@Schema(description = "监区ID", example = "1")
private Long prisonAreaId;
@Schema(description = "监室ID", example = "1")
private Long prisonCellId;
@Schema(description = "状态", example = "1")
private Integer status;
@Schema(description = "入狱日期开始", example = "2024-01-01")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate imprisonmentDateStart;
@Schema(description = "入狱日期结束", example = "2024-12-31")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate imprisonmentDateEnd;
}

View File

@ -0,0 +1,144 @@
package cn.iocoder.yudao.module.prison.controller.admin.prisoner.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDate;
/**
* 服刑人员信息 Response VO
*
* @author xlcp
*/
@Data
public class PrisonerRespVO {
@Schema(description = "服刑人员ID", example = "1")
private Long id;
@Schema(description = "服刑人员编号", example = "ZF2024001")
private String prisonerNo;
@Schema(description = "姓名", example = "张三")
private String name;
@Schema(description = "性别,参见 GenderEnum 枚举0-未知 1-男 2-女", example = "1")
private Integer gender;
@Schema(description = "性别名称", example = "")
private String genderName;
@Schema(description = "出生日期", example = "1990-01-01")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate birthday;
@Schema(description = "身份证号", example = "310101199001011234")
private String idCard;
@Schema(description = "民族", example = "汉族")
private String ethnicity;
@Schema(description = "籍贯", example = "上海")
private String nativePlace;
@Schema(description = "文化程度", example = "3")
private Integer education;
@Schema(description = "文化程度名称", example = "初中")
private String educationName;
@Schema(description = "职业", example = "无业")
private String occupation;
@Schema(description = "家庭住址", example = "上海市浦东新区xxx")
private String address;
@Schema(description = "罪名", example = "盗窃罪")
private String crime;
@Schema(description = "刑期(年)", example = "3")
private Integer sentenceYears;
@Schema(description = "刑期(月)", example = "6")
private Integer sentenceMonths;
@Schema(description = "是否无期0-否 1-是", example = "0")
private Integer lifeImprisonment;
@Schema(description = "是否死缓0-否 1-是", example = "0")
private Integer deathSentenceReprieve;
@Schema(description = "判决法院", example = "上海市第一中级人民法院")
private String courtName;
@Schema(description = "判决日期", example = "2023-01-15")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate judgmentDate;
@Schema(description = "判决书编号", example = "(2023)沪01刑初123号")
private String judgmentNo;
@Schema(description = "原判刑期", example = "有期徒刑10年")
private String originalSentence;
@Schema(description = "入狱日期", example = "2024-01-01")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate imprisonmentDate;
@Schema(description = "释放日期", example = "2027-07-01")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate releaseDate;
@Schema(description = "释放类型", example = "1")
private Integer releaseType;
@Schema(description = "释放类型名称", example = "刑满释放")
private String releaseTypeName;
@Schema(description = "释放原因", example = "刑满释放")
private String releaseReason;
@Schema(description = "照片URL", example = "http://xxx.com/photo.jpg")
private String photo;
@Schema(description = "监管等级", example = "2")
private Integer supervisionLevel;
@Schema(description = "监管等级名称", example = "普管级")
private String supervisionLevelName;
@Schema(description = "风险等级", example = "1")
private Integer riskLevel;
@Schema(description = "风险等级名称", example = "低风险")
private String riskLevelName;
@Schema(description = "监区ID", example = "1")
private Long prisonAreaId;
@Schema(description = "分区ID", example = "1")
private Long subAreaId;
@Schema(description = "监区名称", example = "一监区")
private String prisonAreaName;
@Schema(description = "监室ID", example = "1")
private Long prisonCellId;
@Schema(description = "监室名称", example = "101监室")
private String prisonCellName;
@Schema(description = "状态", example = "1")
private Integer status;
@Schema(description = "状态名称", example = "在押")
private String statusName;
@Schema(description = "备注", example = "")
private String remark;
@Schema(description = "创建时间", example = "2024-01-01 10:00:00")
private String createTime;
}

View File

@ -0,0 +1,131 @@
package cn.iocoder.yudao.module.prison.controller.admin.prisoner.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate;
/**
* 服刑人员信息创建/更新 Request VO
*
* @author xlcp
*/
@Data
public class PrisonerSaveReqVO {
@Schema(description = "服刑人员ID", example = "1")
private Long id;
@Schema(description = "服刑人员编号", example = "ZF2024001")
@NotBlank(message = "服刑人员编号不能为空")
@Size(max = 50, message = "服刑人员编号长度不能超过50")
private String prisonerNo;
@Schema(description = "姓名", example = "张三")
@NotBlank(message = "姓名不能为空")
@Size(max = 50, message = "姓名长度不能超过50")
private String name;
@Schema(description = "性别,参见 GenderEnum 枚举0-未知 1-男 2-女", example = "1", required = true)
@NotNull(message = "性别不能为空")
private Integer gender;
@Schema(description = "出生日期", example = "1990-01-01")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate birthday;
@Schema(description = "身份证号", example = "310101199001011234")
@Pattern(regexp = "^[0-9]{17}[0-9Xx]$", message = "身份证号格式不正确")
private String idCard;
@Schema(description = "民族", example = "汉族")
@Size(max = 50, message = "民族长度不能超过50")
private String ethnicity;
@Schema(description = "籍贯", example = "上海")
@Size(max = 100, message = "籍贯长度不能超过100")
private String nativePlace;
@Schema(description = "文化程度", example = "3")
private Integer education;
@Schema(description = "职业", example = "无业")
@Size(max = 100, message = "职业长度不能超过100")
private String occupation;
@Schema(description = "家庭住址", example = "上海市浦东新区xxx")
@Size(max = 500, message = "家庭住址长度不能超过500")
private String address;
@Schema(description = "罪名", example = "盗窃罪", required = true)
@NotBlank(message = "罪名不能为空")
@Size(max = 100, message = "罪名长度不能超过100")
private String crime;
@Schema(description = "刑期(年)", example = "3")
@Min(value = 0, message = "刑期(年)不能为负数")
@Max(value = 150, message = "刑期不能超过150")
private Integer sentenceYears;
@Schema(description = "刑期(月)", example = "6")
@Min(value = 0, message = "刑期(月)不能为负数")
@Max(value = 11, message = "刑期不能超过11")
private Integer sentenceMonths;
@Schema(description = "是否无期0-否 1-是", example = "0")
@Min(value = 0, message = "是否无期值不正确")
@Max(value = 1, message = "是否无期值不正确")
private Integer lifeImprisonment;
@Schema(description = "是否死缓0-否 1-是", example = "0")
@Min(value = 0, message = "是否死缓值不正确")
@Max(value = 1, message = "是否死缓值不正确")
private Integer deathSentenceReprieve;
@Schema(description = "判决法院", example = "上海市第一中级人民法院")
@Size(max = 100, message = "判决法院长度不能超过100")
private String courtName;
@Schema(description = "判决日期", example = "2023-01-15")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate judgmentDate;
@Schema(description = "判决书编号", example = "(2023)沪01刑初123号")
@Size(max = 50, message = "判决书编号长度不能超过50")
private String judgmentNo;
@Schema(description = "原判刑期", example = "有期徒刑10年")
@Size(max = 100, message = "原判刑期长度不能超过100")
private String originalSentence;
@Schema(description = "入狱日期", example = "2024-01-01", required = true)
@NotNull(message = "入狱日期不能为空")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate imprisonmentDate;
@Schema(description = "释放日期", example = "2027-07-01")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate releaseDate;
@Schema(description = "监管等级", example = "2")
private Integer supervisionLevel;
@Schema(description = "风险等级", example = "1")
private Integer riskLevel;
@Schema(description = "监区ID", example = "1")
private Long prisonAreaId;
@Schema(description = "监室ID", example = "1")
private Long prisonCellId;
@Schema(description = "状态", example = "1")
private Integer status;
@Schema(description = "备注", example = "")
@Size(max = 500, message = "备注长度不能超过500")
private String remark;
}

View File

@ -0,0 +1,29 @@
package cn.iocoder.yudao.module.prison.controller.admin.prisoner.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import jakarta.validation.constraints.NotNull;
/**
* 调监请求 VO
*
* @author xlcp
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TransferReqVO {
@Schema(description = "罪犯ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "罪犯ID不能为空")
private Long prisonerId;
@Schema(description = "目标监室ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "目标监室ID不能为空")
private Long targetCellId;
@Schema(description = "调监原因")
private String reason;
}

View File

@ -0,0 +1,127 @@
package cn.iocoder.yudao.module.prison.controller.admin.question;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.prison.controller.admin.question.vo.*;
import cn.iocoder.yudao.module.prison.dal.dataobject.question.QuestionDO;
import cn.iocoder.yudao.module.prison.service.question.QuestionService;
import cn.iocoder.yudao.module.prison.convert.question.QuestionConvert;
@Tag(name = "管理后台 - 问卷问题")
@RestController
@RequestMapping("/prison/question")
@Validated
public class PrisonQuestionController {
@Resource
private QuestionService questionService;
@PostMapping("/create")
@Operation(summary = "创建问卷问题")
@PreAuthorize("@ss.hasPermission('prison:question:create') or @ss.hasPermission('prison:questionnaire:update')")
@ApiAccessLog(operateType = CREATE)
public CommonResult<Long> createQuestion(@Valid @RequestBody QuestionSaveReqVO createReqVO) {
return success(questionService.createQuestion(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新问卷问题")
@PreAuthorize("@ss.hasPermission('prison:question:update') or @ss.hasPermission('prison:questionnaire:update')")
@ApiAccessLog(operateType = UPDATE)
public CommonResult<Boolean> updateQuestion(@Valid @RequestBody QuestionSaveReqVO updateReqVO) {
questionService.updateQuestion(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除问卷问题")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:question:delete') or @ss.hasPermission('prison:questionnaire:update')")
@ApiAccessLog(operateType = DELETE)
public CommonResult<Boolean> deleteQuestion(@NotNull(message = "编号不能为空") @RequestParam("id") Long id) {
questionService.deleteQuestion(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除问卷问题")
@PreAuthorize("@ss.hasPermission('prison:question:delete') or @ss.hasPermission('prison:questionnaire:update')")
@ApiAccessLog(operateType = DELETE)
public CommonResult<Boolean> deleteQuestionList(@NotEmpty(message = "编号列表不能为空") @RequestParam("ids") List<Long> ids) {
questionService.deleteQuestionListByIds(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得问卷问题")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('prison:question:query') or @ss.hasPermission('prison:questionnaire:query') or @ss.hasPermission('prison:questionnaire:update')")
public CommonResult<QuestionRespVO> getQuestion(@RequestParam("id") Long id) {
QuestionDO question = questionService.getQuestion(id);
return success(QuestionConvert.INSTANCE.convert(question));
}
@GetMapping("/page")
@Operation(summary = "获得问卷问题分页")
@PreAuthorize("@ss.hasPermission('prison:question:query') or @ss.hasPermission('prison:questionnaire:query') or @ss.hasPermission('prison:questionnaire:update')")
public CommonResult<PageResult<QuestionRespVO>> getQuestionPage(@Valid QuestionPageReqVO pageReqVO) {
PageResult<QuestionDO> pageResult = questionService.getQuestionPage(pageReqVO);
return success(QuestionConvert.INSTANCE.convertPage(pageResult));
}
@PostMapping("/batch-update")
@Operation(summary = "批量更新问卷问题")
@PreAuthorize("@ss.hasPermission('prison:question:update') or @ss.hasPermission('prison:questionnaire:update')")
@ApiAccessLog(operateType = UPDATE)
public CommonResult<Boolean> batchUpdateQuestion(@Valid @RequestBody QuestionBatchUpdateReqVO reqVO) {
// 转换为 Service 需要的格式
List<QuestionSaveReqVO> updateList = new ArrayList<>();
for (QuestionBatchUpdateReqVO.QuestionUpdateItem item : reqVO.getQuestions()) {
QuestionSaveReqVO saveReqVO = new QuestionSaveReqVO();
saveReqVO.setId(item.getId());
saveReqVO.setPartName(item.getPartName());
saveReqVO.setPartSort(item.getPartSort());
saveReqVO.setSort(item.getSort());
updateList.add(saveReqVO);
}
questionService.batchUpdateQuestion(updateList);
return success(true);
}
@GetMapping("/export-excel")
@Operation(summary = "导出问卷问题 Excel")
@PreAuthorize("@ss.hasPermission('prison:question:export') or @ss.hasPermission('prison:questionnaire:export') or @ss.hasPermission('prison:questionnaire:update')")
@ApiAccessLog(operateType = EXPORT)
public void exportQuestionExcel(@Valid QuestionPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<QuestionDO> list = questionService.getQuestionPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "问卷问题.xls", "数据", QuestionRespVO.class,
QuestionConvert.INSTANCE.convertList(list));
}
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.prison.controller.admin.question.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 问卷问题批量更新 Request VO")
@Data
public class QuestionBatchUpdateReqVO {
@Schema(description = "问题更新列表", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "更新列表不能为空")
private List<QuestionUpdateItem> questions;
@Schema(description = "问题更新项")
@Data
public static class QuestionUpdateItem {
@Schema(description = "问题ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@NotNull(message = "问题ID不能为空")
private Long id;
@Schema(description = "分区名称")
private String partName;
@Schema(description = "分区排序")
private Integer partSort;
@Schema(description = "问题排序")
private Integer sort;
}
}

View File

@ -0,0 +1,42 @@
package cn.iocoder.yudao.module.prison.controller.admin.question.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 问卷问题分页 Request VO")
@Data
public class QuestionPageReqVO extends PageParam {
@Schema(description = "所属问卷ID", example = "2967")
private Long questionnaireId;
@Schema(description = "问题标题")
private String title;
@Schema(description = "问题类型1-单选 2-多选 3-填空 4-评分", example = "2")
private Integer type;
@Schema(description = "选项JSON格式如[{label:选项1,score:10},...]")
private String options;
@Schema(description = "分值")
private BigDecimal score;
@Schema(description = "排序")
private Integer sort;
@Schema(description = "是否必答")
private Boolean isRequired;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,89 @@
package cn.iocoder.yudao.module.prison.controller.admin.question.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import cn.idev.excel.annotation.*;
@Schema(description = "管理后台 - 问卷问题 Response VO")
@Data
@ExcelIgnoreUnannotated
public class QuestionRespVO {
@Schema(description = "问题ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1324")
@ExcelProperty("问题ID")
private Long id;
@Schema(description = "所属问卷ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2967")
@ExcelProperty("所属问卷ID")
private Long questionnaireId;
@Schema(description = "问题标题", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("问题标题")
private String title;
@Schema(description = "问题类型1-单选 2-多选 3-填空 4-评分 5-日期 6-数字", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("问题类型")
private Integer type;
@Schema(description = "选项JSON")
@ExcelProperty("选项")
private String options;
@Schema(description = "分值")
@ExcelProperty("分值")
private BigDecimal score;
@Schema(description = "排序")
@ExcelProperty("排序")
private Integer sort;
@Schema(description = "是否必答")
@ExcelProperty("是否必答")
private Boolean isRequired;
// ==================== 新增字段 ====================
@Schema(description = "分区名称")
@ExcelProperty("分区名称")
private String partName;
@Schema(description = "分区排序")
@ExcelProperty("分区排序")
private Integer partSort;
@Schema(description = "帮助说明文字")
@ExcelProperty("帮助说明")
private String helpText;
@Schema(description = "占位提示")
private String placeholder;
@Schema(description = "默认值")
private String defaultValue;
@Schema(description = "自动填充类型NONE-无 AUTO-自动填充 MANUAL-手动输入")
private String autoFillType;
@Schema(description = "自动填充来源")
private String autoFillSource;
@Schema(description = "显示条件JSON")
private String displayCondition;
@Schema(description = "最小值")
private Integer minValue;
@Schema(description = "最大值")
private Integer maxValue;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,72 @@
package cn.iocoder.yudao.module.prison.controller.admin.question.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 问卷问题新增/修改 Request VO")
@Data
public class QuestionSaveReqVO {
@Schema(description = "问题ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1324")
private Long id;
@Schema(description = "所属问卷ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2967")
@NotNull(message = "所属问卷ID不能为空")
private Long questionnaireId;
@Schema(description = "问题标题", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "问题标题不能为空")
private String title;
@Schema(description = "问题类型1-单选 2-多选 3-填空 4-评分 5-日期 6-数字", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "问题类型不能为空")
private Integer type;
@Schema(description = "选项JSON格式如[{label:选项1,score:10,isOther:false},...]")
private String options;
@Schema(description = "分值")
private BigDecimal score;
@Schema(description = "排序")
private Integer sort;
@Schema(description = "是否必答")
private Boolean isRequired;
// ==================== 新增字段 ====================
@Schema(description = "分区名称Part名称")
private String partName;
@Schema(description = "分区排序")
private Integer partSort;
@Schema(description = "帮助说明文字")
private String helpText;
@Schema(description = "占位提示")
private String placeholder;
@Schema(description = "默认值")
private String defaultValue;
@Schema(description = "自动填充类型NONE-无 AUTO-自动填充 MANUAL-手动输入")
private String autoFillType;
@Schema(description = "自动填充来源dict:字典类型 / field:字段名")
private String autoFillSource;
@Schema(description = "显示条件JSON")
private String displayCondition;
@Schema(description = "最小值(数字/评分题)")
private Integer minValue;
@Schema(description = "最大值(数字/评分题)")
private Integer maxValue;
}

View File

@ -0,0 +1,108 @@
package cn.iocoder.yudao.module.prison.controller.admin.questionnaire;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.prison.controller.admin.questionnaire.vo.*;
import cn.iocoder.yudao.module.prison.dal.dataobject.questionnaire.QuestionnaireDO;
import cn.iocoder.yudao.module.prison.service.questionnaire.QuestionnaireService;
import cn.iocoder.yudao.module.prison.convert.questionnaire.QuestionnaireConvert;
@Tag(name = "管理后台 - 问卷模板")
@RestController
@RequestMapping("/prison/questionnaire")
@Validated
public class PrisonQuestionnaireController {
@Resource
private QuestionnaireService questionnaireService;
@PostMapping("/create")
@Operation(summary = "创建问卷模板")
@PreAuthorize("@ss.hasPermission('prison:questionnaire:create')")
@ApiAccessLog(operateType = CREATE)
public CommonResult<Long> createQuestionnaire(@Valid @RequestBody QuestionnaireSaveReqVO createReqVO) {
return success(questionnaireService.createQuestionnaire(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新问卷模板")
@PreAuthorize("@ss.hasPermission('prison:questionnaire:update')")
@ApiAccessLog(operateType = UPDATE)
public CommonResult<Boolean> updateQuestionnaire(@Valid @RequestBody QuestionnaireSaveReqVO updateReqVO) {
questionnaireService.updateQuestionnaire(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除问卷模板")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:questionnaire:delete')")
@ApiAccessLog(operateType = DELETE)
public CommonResult<Boolean> deleteQuestionnaire(@NotNull(message = "编号不能为空") @RequestParam("id") Long id) {
questionnaireService.deleteQuestionnaire(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号列表", required = true)
@Operation(summary = "批量删除问卷模板")
@PreAuthorize("@ss.hasPermission('prison:questionnaire:delete')")
@ApiAccessLog(operateType = DELETE)
public CommonResult<Boolean> deleteQuestionnaireList(@NotEmpty(message = "编号列表不能为空") @RequestParam("ids") List<Long> ids) {
questionnaireService.deleteQuestionnaireListByIds(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得问卷模板")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('prison:questionnaire:query')")
public CommonResult<QuestionnaireRespVO> getQuestionnaire(@RequestParam("id") Long id) {
QuestionnaireDO questionnaire = questionnaireService.getQuestionnaire(id);
return success(QuestionnaireConvert.INSTANCE.convert(questionnaire));
}
@GetMapping("/page")
@Operation(summary = "获得问卷模板分页")
@PreAuthorize("@ss.hasPermission('prison:questionnaire:query')")
public CommonResult<PageResult<QuestionnaireRespVO>> getQuestionnairePage(@Valid QuestionnairePageReqVO pageReqVO) {
PageResult<QuestionnaireDO> pageResult = questionnaireService.getQuestionnairePage(pageReqVO);
return success(QuestionnaireConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出问卷模板 Excel")
@PreAuthorize("@ss.hasPermission('prison:questionnaire:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportQuestionnaireExcel(@Valid QuestionnairePageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<QuestionnaireDO> list = questionnaireService.getQuestionnairePage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "问卷模板.xls", "数据", QuestionnaireRespVO.class,
QuestionnaireConvert.INSTANCE.convertList(list));
}
}

View File

@ -0,0 +1,56 @@
package cn.iocoder.yudao.module.prison.controller.admin.questionnaire.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 问卷模板分页 Request VO")
@Data
public class QuestionnairePageReqVO extends PageParam {
@Schema(description = "问卷标题")
private String title;
@Schema(description = "问卷类型1-心理测评 2-行为评估 3-满意度调查", example = "2")
private Integer type;
@Schema(description = "问卷说明", example = "你猜")
private String description;
@Schema(description = "总分")
private BigDecimal totalScore;
@Schema(description = "及格分")
private BigDecimal passScore;
@Schema(description = "状态1-草稿 2-已发布 3-已禁用", example = "2")
private Integer status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
// ==================== 新增字段 ====================
@Schema(description = "封面图片URL")
private String coverImage;
@Schema(description = "填写说明")
private String instruction;
@Schema(description = "预计耗时(分钟)")
private Integer estimatedTime;
@Schema(description = "分区数量")
private Integer partCount;
@Schema(description = "是否允许匿名")
private Boolean allowAnonymous;
}

View File

@ -0,0 +1,72 @@
package cn.iocoder.yudao.module.prison.controller.admin.questionnaire.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import cn.idev.excel.annotation.*;
@Schema(description = "管理后台 - 问卷模板 Response VO")
@Data
@ExcelIgnoreUnannotated
public class QuestionnaireRespVO {
@Schema(description = "问卷ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26045")
@ExcelProperty("问卷ID")
private Long id;
@Schema(description = "问卷标题", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("问卷标题")
private String title;
@Schema(description = "问卷类型1-心理测评 2-行为评估 3-满意度调查", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("问卷类型1-心理测评 2-行为评估 3-满意度调查")
private Integer type;
@Schema(description = "问卷说明", example = "你猜")
@ExcelProperty("问卷说明")
private String description;
@Schema(description = "总分")
@ExcelProperty("总分")
private BigDecimal totalScore;
@Schema(description = "及格分")
@ExcelProperty("及格分")
private BigDecimal passScore;
@Schema(description = "状态1-草稿 2-已发布 3-已禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("状态1-草稿 2-已发布 3-已禁用")
private Integer status;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private LocalDateTime createTime;
// ==================== 新增字段 ====================
@Schema(description = "封面图片URL")
@ExcelProperty("封面图片URL")
private String coverImage;
@Schema(description = "填写说明")
@ExcelProperty("填写说明")
private String instruction;
@Schema(description = "预计耗时(分钟)")
@ExcelProperty("预计耗时(分钟)")
private Integer estimatedTime;
@Schema(description = "分区数量")
@ExcelProperty("分区数量")
private Integer partCount;
@Schema(description = "是否允许匿名false-不允许 true-允许")
@ExcelProperty("是否允许匿名")
private Boolean allowAnonymous;
}

View File

@ -0,0 +1,54 @@
package cn.iocoder.yudao.module.prison.controller.admin.questionnaire.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 问卷模板新增/修改 Request VO")
@Data
public class QuestionnaireSaveReqVO {
@Schema(description = "问卷ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26045")
private Long id;
@Schema(description = "问卷标题", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "问卷标题不能为空")
private String title;
@Schema(description = "问卷类型1-心理测评 2-行为评估 3-满意度调查", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "问卷类型1-心理测评 2-行为评估 3-满意度调查不能为空")
private Integer type;
@Schema(description = "问卷说明", example = "你猜")
private String description;
@Schema(description = "总分")
private BigDecimal totalScore;
@Schema(description = "及格分")
private BigDecimal passScore;
@Schema(description = "状态1-草稿 2-已发布 3-已禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "状态不能为空")
private Integer status;
// ==================== 新增字段 ====================
@Schema(description = "封面图片URL")
private String coverImage;
@Schema(description = "填写说明")
private String instruction;
@Schema(description = "预计耗时(分钟)")
private Integer estimatedTime;
@Schema(description = "分区数量")
private Integer partCount;
@Schema(description = "是否允许匿名false-不允许 true-允许")
private Boolean allowAnonymous;
}

View File

@ -0,0 +1,189 @@
package cn.iocoder.yudao.module.prison.controller.admin.questionnairerecord;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import java.math.BigDecimal;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.prison.controller.admin.questionnairerecord.vo.*;
import cn.iocoder.yudao.module.prison.dal.dataobject.questionnairerecord.QuestionnaireRecordDO;
import cn.iocoder.yudao.module.prison.service.questionnairerecord.QuestionnaireRecordService;
import cn.iocoder.yudao.module.prison.convert.questionnairerecord.QuestionnaireRecordConvert;
@Tag(name = "管理后台 - 问卷答题记录/测评记录")
@RestController
@RequestMapping("/prison/questionnaire-record")
@Validated
public class PrisonQuestionnaireRecordController {
@Resource
private QuestionnaireRecordService questionnaireRecordService;
// ==================== 基础 CRUD ====================
@PostMapping("/create")
@Operation(summary = "创建问卷答题记录")
@PreAuthorize("@ss.hasPermission('prison:questionnaire-record:create')")
public CommonResult<Long> createQuestionnaireRecord(@Valid @RequestBody QuestionnaireRecordSaveReqVO createReqVO) {
return success(questionnaireRecordService.createQuestionnaireRecord(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新问卷答题记录")
@PreAuthorize("@ss.hasPermission('prison:questionnaire-record:update')")
public CommonResult<Boolean> updateQuestionnaireRecord(@Valid @RequestBody QuestionnaireRecordSaveReqVO updateReqVO) {
questionnaireRecordService.updateQuestionnaireRecord(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除问卷答题记录")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:questionnaire-record:delete')")
public CommonResult<Boolean> deleteQuestionnaireRecord(@NotNull(message = "编号不能为空") @RequestParam("id") Long id) {
questionnaireRecordService.deleteQuestionnaireRecord(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Operation(summary = "批量删除问卷答题记录")
@PreAuthorize("@ss.hasPermission('prison:questionnaire-record:delete')")
public CommonResult<Boolean> deleteQuestionnaireRecordList(@NotEmpty(message = "编号列表不能为空") @RequestParam("ids") List<Long> ids) {
questionnaireRecordService.deleteQuestionnaireRecordListByIds(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得问卷答题记录")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('prison:questionnaire-record:query')")
public CommonResult<QuestionnaireRecordRespVO> getQuestionnaireRecord(@NotNull(message = "编号不能为空") @RequestParam("id") Long id) {
QuestionnaireRecordDO questionnaireRecord = questionnaireRecordService.getQuestionnaireRecord(id);
return success(QuestionnaireRecordConvert.INSTANCE.convert(questionnaireRecord));
}
@GetMapping("/page")
@Operation(summary = "获得问卷答题记录分页")
@PreAuthorize("@ss.hasPermission('prison:questionnaire-record:query')")
public CommonResult<PageResult<QuestionnaireRecordRespVO>> getQuestionnaireRecordPage(@Valid QuestionnaireRecordPageReqVO pageReqVO) {
PageResult<QuestionnaireRecordDO> pageResult = questionnaireRecordService.getQuestionnaireRecordPage(pageReqVO);
return success(QuestionnaireRecordConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出问卷答题记录 Excel")
@PreAuthorize("@ss.hasPermission('prison:questionnaire-record:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportQuestionnaireRecordExcel(@Valid QuestionnaireRecordPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<QuestionnaireRecordDO> list = questionnaireRecordService.getQuestionnaireRecordPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "问卷答题记录.xls", "数据", QuestionnaireRecordRespVO.class,
QuestionnaireRecordConvert.INSTANCE.convertList(list));
}
// ==================== 测评执行相关 ====================
@PostMapping("/initiate")
@Operation(summary = "发起测评")
@PreAuthorize("@ss.hasPermission('prison:questionnaire-record:initiate')")
public CommonResult<Long> initiateAssessment(@Valid @RequestBody AssessmentInitiateReqVO reqVO) {
return success(questionnaireRecordService.initiateAssessment(reqVO));
}
@PostMapping("/start")
@Operation(summary = "开始测评")
@PreAuthorize("@ss.hasPermission('prison:questionnaire-record:start')")
public CommonResult<Boolean> startAssessment(@NotNull(message = "记录ID不能为空") @RequestParam("id") Long id,
@NotNull(message = "罪犯ID不能为空") @RequestParam("prisonerId") Long prisonerId) {
questionnaireRecordService.startAssessment(id, prisonerId);
return success(true);
}
@PostMapping("/submit")
@Operation(summary = "提交答卷")
@PreAuthorize("@ss.hasPermission('prison:questionnaire-record:submit')")
public CommonResult<Boolean> submitAnswer(@Valid @RequestBody AssessmentAnswerSubmitReqVO reqVO) {
questionnaireRecordService.submitAnswer(reqVO);
return success(true);
}
@PostMapping("/finish")
@Operation(summary = "结束测评")
@PreAuthorize("@ss.hasPermission('prison:questionnaire-record:finish')")
public CommonResult<Boolean> finishAssessment(@NotNull(message = "记录ID不能为空") @RequestParam("id") Long id) {
questionnaireRecordService.finishAssessment(id);
return success(true);
}
@PostMapping("/cancel")
@Operation(summary = "取消测评")
@PreAuthorize("@ss.hasPermission('prison:questionnaire-record:cancel')")
public CommonResult<Boolean> cancelAssessment(@NotNull(message = "记录ID不能为空") @RequestParam("id") Long id) {
questionnaireRecordService.cancelAssessment(id);
return success(true);
}
// ==================== 评分相关 ====================
@PostMapping("/auto-score")
@Operation(summary = "自动评分")
@PreAuthorize("@ss.hasPermission('prison:questionnaire-record:score')")
public CommonResult<Boolean> autoScore(@NotNull(message = "记录ID不能为空") @RequestParam("id") Long id) {
questionnaireRecordService.autoScore(id);
return success(true);
}
@PostMapping("/manual-score")
@Operation(summary = "人工评分")
@PreAuthorize("@ss.hasPermission('prison:questionnaire-record:score')")
public CommonResult<Boolean> manualScore(@Valid @RequestBody AssessmentManualScoreReqVO reqVO) {
questionnaireRecordService.manualScore(reqVO);
return success(true);
}
// ==================== 统计相关 ====================
@GetMapping("/completion-rate")
@Operation(summary = "获取完成率")
@PreAuthorize("@ss.hasPermission('prison:questionnaire-record:query')")
public CommonResult<BigDecimal> getCompletionRate(@NotNull(message = "测评记录ID不能为空") @RequestParam("assessmentRecordId") Long assessmentRecordId) {
return success(questionnaireRecordService.getCompletionRate(assessmentRecordId));
}
@GetMapping("/score-distribution")
@Operation(summary = "获取分数分布")
@PreAuthorize("@ss.hasPermission('prison:questionnaire-record:query')")
public CommonResult<Map<String, Integer>> getScoreDistribution(@NotNull(message = "测评记录ID不能为空") @RequestParam("assessmentRecordId") Long assessmentRecordId) {
return success(questionnaireRecordService.getScoreDistribution(assessmentRecordId));
}
@GetMapping("/risk-distribution")
@Operation(summary = "获取风险分布")
@PreAuthorize("@ss.hasPermission('prison:questionnaire-record:query')")
public CommonResult<Map<String, Integer>> getRiskDistribution(@NotNull(message = "测评记录ID不能为空") @RequestParam("assessmentRecordId") Long assessmentRecordId) {
return success(questionnaireRecordService.getRiskDistribution(assessmentRecordId));
}
}

View File

@ -0,0 +1,38 @@
package cn.iocoder.yudao.module.prison.controller.admin.questionnairerecord.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.util.List;
/**
* 提交答卷 Request VO
*
* @author 芋道源码
*/
@Data
public class AssessmentAnswerSubmitReqVO {
@Schema(description = "测评记录ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@NotNull(message = "测评记录不能为空")
private Long recordId;
@Schema(description = "罪犯ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "罪犯不能为空")
private Long prisonerId;
@Schema(description = "答案列表")
private List<AnswerItem> answers;
@Data
public static class AnswerItem {
@Schema(description = "题目ID", example = "1024")
private Long questionId;
@Schema(description = "答案内容")
private String answer;
@Schema(description = "选项ID列表多选用")
private List<Long> optionIds;
}
}

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.module.prison.controller.admin.questionnairerecord.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
/**
* 发起测评 Request VO
*
* @author 芋道源码
*/
@Data
public class AssessmentInitiateReqVO {
@Schema(description = "问卷ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@NotNull(message = "问卷不能为空")
private Long questionnaireId;
@Schema(description = "罪犯ID列表", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "罪犯不能为空")
private List<Long> prisonerIds;
@Schema(description = "测评说明")
private String remark;
@Schema(description = "截止日期")
private LocalDateTime deadline;
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.prison.controller.admin.questionnairerecord.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.math.BigDecimal;
/**
* 人工评分 Request VO
*
* @author 芋道源码
*/
@Data
public class AssessmentManualScoreReqVO {
@Schema(description = "测评记录ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@NotNull(message = "测评记录不能为空")
private Long recordId;
@Schema(description = "主观题得分", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "主观题得分不能为空")
private BigDecimal subjectiveScore;
@Schema(description = "评语")
private String comment;
@Schema(description = "风险等级1-高风险 2-中风险 3-低风险")
private Integer riskLevel;
}

View File

@ -0,0 +1,64 @@
package cn.iocoder.yudao.module.prison.controller.admin.questionnairerecord.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 管理后台 - 问卷答题记录/测评记录分页 Request VO
*
* @author 芋道源码
*/
@Data
public class QuestionnaireRecordPageReqVO extends PageParam {
@Schema(description = "问卷ID", example = "18966")
private Long questionnaireId;
@Schema(description = "问卷名称", example = "心理测评")
private String questionnaireName;
@Schema(description = "罪犯ID", example = "4071")
private Long prisonerId;
@Schema(description = "罪犯编号")
private String prisonerNo;
@Schema(description = "罪犯姓名")
private String prisonerName;
@Schema(description = "状态1-待测评 2-测评中 3-已完成 4-已过期 5-已取消", example = "1")
private Integer status;
@Schema(description = "及格状态1-及格 2-不及格 3-待评阅", example = "1")
private Integer passStatus;
@Schema(description = "风险等级1-低风险 2-中风险 3-高风险 4-极高风险", example = "3")
private Integer riskLevel;
@Schema(description = "总分")
private BigDecimal totalScore;
@Schema(description = "测评开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] startTime;
@Schema(description = "测评结束时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] endTime;
@Schema(description = "测评截止时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] deadline;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,142 @@
package cn.iocoder.yudao.module.prison.controller.admin.questionnairerecord.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import cn.idev.excel.annotation.*;
/**
* 管理后台 - 问卷答题记录/测评记录 Response VO
*
* @author 芋道源码
*/
@Schema(description = "管理后台 - 问卷答题记录 Response VO")
@Data
@ExcelIgnoreUnannotated
public class QuestionnaireRecordRespVO {
@Schema(description = "记录ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "8596")
@ExcelProperty("记录ID")
private Long id;
// ==================== 问卷信息 ====================
@Schema(description = "问卷ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18966")
@ExcelProperty("问卷ID")
private Long questionnaireId;
@Schema(description = "问卷名称")
@ExcelProperty("问卷名称")
private String questionnaireName;
// ==================== 罪犯信息 ====================
@Schema(description = "罪犯ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4071")
@ExcelProperty("罪犯ID")
private Long prisonerId;
@Schema(description = "罪犯编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("罪犯编号")
private String prisonerNo;
@Schema(description = "罪犯姓名")
@ExcelProperty("罪犯姓名")
private String prisonerName;
// ==================== 测评状态 ====================
@Schema(description = "状态1-待测评 2-测评中 3-已完成 4-已过期 5-已取消", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("状态")
private Integer status;
// ==================== 测评时间 ====================
@Schema(description = "开始时间")
@ExcelProperty("开始时间")
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "UTC")
private LocalDateTime startTime;
@Schema(description = "结束时间")
@ExcelProperty("结束时间")
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "UTC")
private LocalDateTime endTime;
@Schema(description = "答题时间")
@ExcelProperty("答题时间")
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "UTC")
private LocalDateTime answerTime;
@Schema(description = "截止日期")
@ExcelProperty("截止日期")
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "UTC")
private LocalDateTime deadline;
// ==================== 评分信息 ====================
@Schema(description = "客观题得分")
@ExcelProperty("客观题得分")
private BigDecimal objectiveScore;
@Schema(description = "主观题得分")
@ExcelProperty("主观题得分")
private BigDecimal subjectiveScore;
@Schema(description = "总分")
@ExcelProperty("总分")
private BigDecimal totalScore;
@Schema(description = "及格分数")
@ExcelProperty("及格分数")
private BigDecimal passScore;
@Schema(description = "及格状态1-及格 2-不及格 3-待评阅", example = "2")
@ExcelProperty("及格状态")
private Integer passStatus;
@Schema(description = "风险等级1-高风险 2-中风险 3-低风险", example = "3")
@ExcelProperty("风险等级")
private Integer riskLevel;
// ==================== 评阅信息 ====================
@Schema(description = "评阅人ID")
private Long evaluatorId;
@Schema(description = "评阅人姓名")
@ExcelProperty("评阅人")
private String evaluatorName;
@Schema(description = "评阅时间")
@ExcelProperty("评阅时间")
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "UTC")
private LocalDateTime evaluateTime;
// ==================== 统计信息 ====================
@Schema(description = "参与人数")
private Integer participantCount;
@Schema(description = "完成人数")
private Integer completedCount;
@Schema(description = "答题用时(秒)")
@ExcelProperty("答题用时")
private Integer duration;
// ==================== 备注 ====================
@Schema(description = "备注")
private String remark;
// ==================== 通用字段 ====================
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "UTC")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,110 @@
package cn.iocoder.yudao.module.prison.controller.admin.questionnairerecord.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
/**
* 管理后台 - 问卷答题记录/测评记录新增/修改 Request VO
*
* @author 芋道源码
*/
@Data
public class QuestionnaireRecordSaveReqVO {
@Schema(description = "记录ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "8596")
private Long id;
// ==================== 问卷信息 ====================
@Schema(description = "问卷ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18966")
@NotNull(message = "问卷ID不能为空")
private Long questionnaireId;
@Schema(description = "问卷名称")
private String questionnaireName;
// ==================== 罪犯信息 ====================
@Schema(description = "罪犯ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4071")
@NotNull(message = "罪犯ID不能为空")
private Long prisonerId;
@Schema(description = "罪犯编号")
private String prisonerNo;
@Schema(description = "罪犯姓名")
private String prisonerName;
// ==================== 测评状态 ====================
@Schema(description = "状态1-待测评 2-测评中 3-已完成 4-已过期 5-已取消", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "状态不能为空")
private Integer status;
// ==================== 测评时间 ====================
@Schema(description = "开始时间")
private LocalDateTime startTime;
@Schema(description = "结束时间")
private LocalDateTime endTime;
@Schema(description = "答题时间")
private LocalDateTime answerTime;
@Schema(description = "截止日期")
private LocalDateTime deadline;
// ==================== 评分信息 ====================
@Schema(description = "客观题得分")
private BigDecimal objectiveScore;
@Schema(description = "主观题得分")
private BigDecimal subjectiveScore;
@Schema(description = "总分")
private BigDecimal totalScore;
@Schema(description = "及格分数")
private BigDecimal passScore;
@Schema(description = "及格状态1-及格 2-不及格 3-待评阅", example = "2")
private Integer passStatus;
@Schema(description = "风险等级1-低风险 2-中风险 3-高风险 4-极高风险", example = "3")
private Integer riskLevel;
// ==================== 评阅信息 ====================
@Schema(description = "评阅人ID")
private Long evaluatorId;
@Schema(description = "评阅人姓名")
private String evaluatorName;
@Schema(description = "评阅时间")
private LocalDateTime evaluateTime;
// ==================== 统计信息 ====================
@Schema(description = "参与人数")
private Integer participantCount;
@Schema(description = "完成人数")
private Integer completedCount;
@Schema(description = "答题用时(秒)")
private Integer duration;
// ==================== 备注 ====================
@Schema(description = "备注")
private String remark;
}

View File

@ -0,0 +1,49 @@
package cn.iocoder.yudao.module.prison.controller.admin.quickcomment;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.module.prison.controller.admin.quickcomment.vo.*;
import cn.iocoder.yudao.module.prison.service.quickcomment.CommentCategoryService;
import cn.iocoder.yudao.module.prison.dal.dataobject.quickcomment.CommentCategoryDO;
@Tag(name = "管理后台 - 快捷评语分类")
@RestController
@RequestMapping("/prison/quick-comment/category")
@Validated
public class CommentCategoryController {
@Resource
private CommentCategoryService commentCategoryService;
@PostMapping("/init")
@Operation(summary = "初始化快捷评语分类和评语(预置数据)")
@PreAuthorize("@ss.hasPermission('prison:comment-category:create')")
public CommonResult<Integer> initCategories() {
int count = commentCategoryService.initCategories();
return success(count);
}
@GetMapping("/list")
@Operation(summary = "查询分类列表")
public CommonResult<List<CommentCategoryDO>> getCategoryList(CommentCategorySaveReqVO reqVO) {
return success(commentCategoryService.getCategoryList(reqVO));
}
@GetMapping("/get")
@Operation(summary = "获得分类详情")
@Parameter(name = "id", description = "编号", required = true)
public CommonResult<CommentCategoryDO> getCategory(@RequestParam("id") Long id) {
return success(commentCategoryService.getCategory(id));
}
}

View File

@ -0,0 +1,147 @@
package cn.iocoder.yudao.module.prison.controller.admin.quickcomment;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.util.HashMap;
import java.util.stream.Collectors;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.prison.controller.admin.quickcomment.vo.*;
import cn.iocoder.yudao.module.prison.dal.dataobject.quickcomment.QuickCommentDO;
import cn.iocoder.yudao.module.prison.dal.dataobject.quickcomment.CommentCategoryDO;
import cn.iocoder.yudao.module.prison.service.quickcomment.QuickCommentService;
import cn.iocoder.yudao.module.prison.dal.mysql.quickcomment.CommentCategoryMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@Tag(name = "管理后台 - 快捷评语")
@RestController
@RequestMapping("/prison/quick-comment")
@Validated
public class QuickCommentController {
@Resource
private QuickCommentService quickCommentService;
@Resource
private CommentCategoryMapper commentCategoryMapper;
@PostMapping("/create")
@Operation(summary = "创建快捷评语")
@PreAuthorize("@ss.hasPermission('prison:quick-comment:create')")
public CommonResult<Long> createQuickComment(@Valid @RequestBody QuickCommentSaveReqVO createReqVO) {
return success(quickCommentService.createQuickComment(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新快捷评语")
@PreAuthorize("@ss.hasPermission('prison:quick-comment:update')")
public CommonResult<Boolean> updateQuickComment(@Valid @RequestBody QuickCommentSaveReqVO updateReqVO) {
quickCommentService.updateQuickComment(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除快捷评语")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:quick-comment:delete')")
public CommonResult<Boolean> deleteQuickComment(@NotNull(message = "编号不能为空") @RequestParam("id") Long id) {
quickCommentService.deleteQuickComment(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Operation(summary = "批量删除快捷评语")
@Parameter(name = "ids", description = "编号列表", required = true)
@PreAuthorize("@ss.hasPermission('prison:quick-comment:delete')")
public CommonResult<Boolean> deleteQuickCommentList(@NotEmpty(message = "编号列表不能为空") @RequestParam("ids") List<Long> ids) {
quickCommentService.deleteQuickCommentListByIds(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得快捷评语详情")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('prison:quick-comment:query')")
public CommonResult<QuickCommentRespVO> getQuickComment(@RequestParam("id") Long id) {
QuickCommentDO comment = quickCommentService.getQuickComment(id);
if (comment == null) {
return success(null);
}
return success(BeanUtils.toBean(comment, QuickCommentRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得快捷评语分页")
@PreAuthorize("@ss.hasPermission('prison:quick-comment:query')")
public CommonResult<PageResult<QuickCommentRespVO>> getQuickCommentPage(@Valid QuickCommentPageReqVO pageReqVO) {
// 获取分页数据
PageResult<QuickCommentRespVO> pageResult = quickCommentService.getQuickCommentPage(pageReqVO);
// 批量获取分类名称
List<Long> categoryIds = pageResult.getList().stream()
.map(QuickCommentRespVO::getCategoryId)
.distinct()
.collect(Collectors.toList());
Map<Long, String> categoryNameMap = new HashMap<>();
if (!categoryIds.isEmpty()) {
List<CommentCategoryDO> categories = commentCategoryMapper.selectList(
new LambdaQueryWrapper<CommentCategoryDO>()
.in(CommentCategoryDO::getId, categoryIds)
);
categoryNameMap = categories.stream()
.collect(Collectors.toMap(CommentCategoryDO::getId, CommentCategoryDO::getName));
}
// 填充分类名称
for (QuickCommentRespVO comment : pageResult.getList()) {
comment.setCategoryName(categoryNameMap.get(comment.getCategoryId()));
}
return success(pageResult);
}
@PostMapping("/import")
@Operation(summary = "导入快捷评语")
@PreAuthorize("@ss.hasPermission('prison:quick-comment:import')")
public CommonResult<Integer> importComments(@RequestBody Map<String, Object> params) {
Long categoryId = Long.valueOf(params.get("categoryId").toString());
@SuppressWarnings("unchecked")
List<String> contents = (List<String>) params.get("contents");
int count = quickCommentService.importComments(categoryId, contents);
return success(count);
}
@GetMapping("/export")
@Operation(summary = "导出快捷评语 Excel")
@PreAuthorize("@ss.hasPermission('prison:quick-comment:export')")
public void exportQuickCommentExcel(@Valid QuickCommentPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<QuickCommentRespVO> list = quickCommentService.getQuickCommentPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "快捷评语.xls", "数据", QuickCommentRespVO.class, list);
}
}

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.module.prison.controller.admin.quickcomment.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 快捷评语分类分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CommentCategoryPageReqVO extends PageParam {
@Schema(description = "分类名称", example = "入监综合评估")
private String name;
@Schema(description = "评估类型1-入监 2-定期 3-出监 4-减刑 5-专项", example = "1")
private Integer type;
@Schema(description = "状态0-停用 1-启用", example = "1")
private Integer status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.prison.controller.admin.quickcomment.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 快捷评语分类 Response VO")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CommentCategoryRespVO {
@Schema(description = "分类ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long id;
@Schema(description = "分类名称")
private String name;
@Schema(description = "评估类型1-入监 2-定期 3-出监 4-减刑 5-专项")
private Integer type;
@Schema(description = "排序")
private Integer sort;
@Schema(description = "状态0-停用 1-启用")
private Integer status;
@Schema(description = "创建者")
private String creator;
@Schema(description = "创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.prison.controller.admin.quickcomment.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 快捷评语分类新增/修改 Request VO")
@Data
public class CommentCategorySaveReqVO {
@Schema(description = "分类ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long id;
@Schema(description = "分类名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "分类名称不能为空")
private String name;
@Schema(description = "评估类型1-入监 2-定期 3-出监 4-减刑 5-专项", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "评估类型不能为空")
private Integer type;
@Schema(description = "排序")
private Integer sort;
@Schema(description = "状态0-停用 1-启用", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "状态不能为空")
private Integer status;
}

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.module.prison.controller.admin.quickcomment.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
@Schema(description = "管理后台 - 快捷评语分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class QuickCommentPageReqVO extends PageParam {
@Schema(description = "分类ID")
private Long categoryId;
@Schema(description = "评语内容")
private String content;
@Schema(description = "状态0-停用 1-启用")
private Integer status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

Some files were not shown because too many files have changed in this diff Show More