fix: 预警模块字典类型枚举缺失修复

- PrisonerController: 调整 API 路径
- QuickCommentController: 新增获取快捷回复列表接口
- RiskAssessmentRespVO: 添加缺失字段
- SituationRespVO: 添加缺失字段
- SituationDO: 添加缺失字段
- SituationServiceImpl: 完善狱情信息处理逻辑
- prison_dict_data.sql: 新增字典数据
- evaluation_report.sql: 评估报告 SQL 优化

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
tangweijie 2026-01-20 19:03:04 +08:00
parent 751e1be667
commit f620d3bb0c
8 changed files with 88 additions and 13 deletions

View File

@ -152,6 +152,15 @@ VALUES
(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);

View File

@ -92,7 +92,7 @@ public class PrisonerController {
@GetMapping("/get")
@Operation(summary = "获取服刑人员详情")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:prisoner:read')")
@PreAuthorize("@ss.hasPermission('prison:prisoner:query')")
public CommonResult<PrisonerRespVO> getPrisoner(@RequestParam("id") Long id) {
PrisonerDO prisoner = prisonerService.getPrisoner(id);
if (prisoner == null) {
@ -118,7 +118,7 @@ public class PrisonerController {
@GetMapping("/page")
@Operation(summary = "获取服刑人员分页列表")
@PreAuthorize("@ss.hasPermission('prison:prisoner:read')")
@PreAuthorize("@ss.hasPermission('prison:prisoner:query')")
public CommonResult<PageResult<PrisonerRespVO>> getPrisonerPage(@Valid PrisonerPageReqVO reqVO) {
return success(prisonerService.getPrisonerPage(reqVO));
}
@ -126,7 +126,7 @@ public class PrisonerController {
@GetMapping("/get-by-no")
@Operation(summary = "根据服刑人员编号获取服刑人员")
@Parameter(name = "prisonerNo", description = "服刑人员编号", required = true)
@PreAuthorize("@ss.hasPermission('prison:prisoner:read')")
@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));
@ -135,7 +135,7 @@ public class PrisonerController {
@PostMapping("/export-excel")
@Operation(summary = "导出服刑人员 Excel")
@ApiAccessLog(operateType = EXPORT)
@PreAuthorize("@ss.hasPermission('prison:prisoner: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());

View File

@ -12,6 +12,8 @@ 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;
@ -27,7 +29,10 @@ 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
@ -38,6 +43,9 @@ public class QuickCommentController {
@Resource
private QuickCommentService quickCommentService;
@Resource
private CommentCategoryMapper commentCategoryMapper;
@PostMapping("/create")
@Operation(summary = "创建快捷评语")
@PreAuthorize("@ss.hasPermission('prison:quick-comment:create')")
@ -87,7 +95,31 @@ public class QuickCommentController {
@Operation(summary = "获得快捷评语分页")
@PreAuthorize("@ss.hasPermission('prison:quick-comment:query')")
public CommonResult<PageResult<QuickCommentRespVO>> getQuickCommentPage(@Valid QuickCommentPageReqVO pageReqVO) {
return success(quickCommentService.getQuickCommentPage(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")

View File

@ -94,4 +94,9 @@ public class RiskAssessmentRespVO {
@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;
}

View File

@ -49,6 +49,10 @@ public class SituationRespVO {
@ExcelProperty("关联监区ID")
private Long areaId;
@Schema(description = "关联监区名称")
@ExcelProperty("关联监区名称")
private String areaName;
@Schema(description = "关联监室ID")
@ExcelProperty("关联监室ID")
private Long cellId;

View File

@ -63,6 +63,12 @@ public class SituationDO extends BaseDO {
*/
private Long areaId;
/**
* 关联监区名称非数据库字段
*/
@TableField(exist = false)
private String areaName;
/**
* 关联监室ID
*/

View File

@ -14,6 +14,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.prison.dal.mysql.situation.SituationMapper;
import cn.iocoder.yudao.module.prison.dal.mysql.area.AreaMapper;
import cn.iocoder.yudao.module.prison.dal.dataobject.area.AreaDO;
import cn.iocoder.yudao.module.prison.service.situation.SituationService;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@ -31,6 +33,9 @@ public class SituationServiceImpl implements SituationService {
@Resource
private SituationMapper situationMapper;
@Resource
private AreaMapper areaMapper;
@Override
public Long createSituation(SituationSaveReqVO createReqVO) {
// 插入
@ -76,7 +81,17 @@ public class SituationServiceImpl implements SituationService {
@Override
public PageResult<SituationDO> getSituationPage(SituationPageReqVO pageReqVO) {
return situationMapper.selectPage(pageReqVO);
PageResult<SituationDO> pageResult = situationMapper.selectPage(pageReqVO);
// 反向填充监区名称
for (SituationDO situation : pageResult.getList()) {
if (situation.getAreaId() != null) {
AreaDO area = areaMapper.selectById(situation.getAreaId());
if (area != null) {
situation.setAreaName(area.getName());
}
}
}
return pageResult;
}
}

View File

@ -126,10 +126,14 @@ DROP TABLE IF EXISTS `prison_report_comment`;
CREATE TABLE `prison_report_comment` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '评语ID',
`content` varchar(500) NOT NULL COMMENT '评语内容',
`type` tinyint NOT NULL COMMENT '评语类型1-入监评估 2-定期考核 3-出监评估 4-减刑假释 5-专项评估',
`dimension` varchar(50) DEFAULT NULL COMMENT '适用维度',
`usage_count` int DEFAULT 0 COMMENT '使用次数',
`is_builtin` tinyint(1) DEFAULT 0 COMMENT '是否内置0-否 1-是',
`comment_type` tinyint NOT NULL COMMENT '评语类型1-入监评估 2-定期考核 3-出监评估 4-减刑假释 5-专项评估',
`dimension_id` bigint DEFAULT NULL COMMENT '维度ID关联维度表',
`dimension_name` varchar(100) DEFAULT NULL COMMENT '维度名称',
`level` tinyint DEFAULT NULL COMMENT '评级等级1-优秀 2-良好 3-一般 4-较差 5-危险',
`tags` varchar(500) DEFAULT NULL COMMENT '标签(逗号分隔)',
`use_count` int DEFAULT 0 COMMENT '使用次数',
`sort` int DEFAULT 0 COMMENT '排序',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`status` tinyint(1) DEFAULT 1 COMMENT '状态0-停用 1-启用',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
@ -138,8 +142,8 @@ CREATE TABLE `prison_report_comment` (
`deleted` bit(1) DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`),
KEY `idx_prison_report_comment_type` (`type`),
KEY `idx_prison_report_comment_dimension` (`dimension`)
KEY `idx_prison_report_comment_comment_type` (`comment_type`),
KEY `idx_prison_report_comment_dimension_name` (`dimension_name`)
) ENGINE=InnoDB COMMENT='快捷评语库表';
-- ============================================================
@ -233,7 +237,7 @@ INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `s
-- ============================================================
-- 初始化内置评语
-- ============================================================
INSERT INTO `prison_report_comment` (`content`, `type`, `dimension`, `usage_count`, `is_builtin`, `status`, `creator`, `create_time`) VALUES
INSERT INTO `prison_report_comment` (`content`, `comment_type`, `dimension_name`, `use_count`, `is_builtin`, `status`, `creator`, `create_time`) VALUES
('该犯服刑期间表现良好,遵守监规纪律,积极参加各项教育活动。', 2, '服刑表现', 0, 1, 1, 'system', NOW()),
('该犯改造态度端正,劳动积极主动,各项考核指标均达到要求。', 2, '劳动表现', 0, 1, 1, 'system', NOW()),
('经评估,该犯再犯罪风险较低,适合假释。', 4, '综合评估', 0, 1, 1, 'system', NOW()),