diff --git a/sql/20260716.sql b/sql/20260716.sql new file mode 100644 index 0000000..1ba98ff --- /dev/null +++ b/sql/20260716.sql @@ -0,0 +1,76 @@ +INSERT INTO `sup_dict_type` +(`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) +SELECT '局长信箱涉嫌问题映射', 'mayorMailboxInvolveProblemMapping', '0', '', NOW(), '', NOW(), '局长信箱类目到数字督察涉嫌问题的映射' +WHERE NOT EXISTS ( + SELECT 1 FROM `sup_dict_type` WHERE `dict_type` = 'mayorMailboxInvolveProblemMapping' +); + +INSERT INTO `sup_dict_data` +(`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, + `create_by`, `create_time`, `update_by`, `update_time`, `remark`) +SELECT mapping_data.dict_sort, + mapping_data.external_path, + mapping_data.external_path, + 'mayorMailboxInvolveProblemMapping', + '', + '', + '0', + '0', + '', + NOW(), + '', + NOW(), + mapping_data.internal_problem +FROM ( + SELECT 1 AS dict_sort, '投诉类/投诉执法行为/接处警不规范' AS external_path, '接处警不及时' AS internal_problem + UNION ALL SELECT 2, '投诉类/投诉执法行为/受立案不规范', '受立案不作为' + UNION ALL SELECT 3, '投诉类/投诉执法行为/违规使用枪支警械', '执法不规范' + UNION ALL SELECT 4, '投诉类/投诉执法行为/暴力执法', '执法不规范' + UNION ALL SELECT 5, '投诉类/投诉执法行为/不作为、慢作为', '执法不作为、慢作为' + UNION ALL SELECT 6, '投诉类/投诉执法行为/乱作为', '执法不作为、慢作为' + UNION ALL SELECT 7, '投诉类/投诉执法行为/执法过程,方式简单粗暴、态度恶劣', '执法不规范' + UNION ALL SELECT 8, '投诉类/投诉执法行为/包庇纵容、充当保护伞', '执法不规范' + UNION ALL SELECT 9, '投诉类/投诉执法行为/违规查封扣押冻结及处置涉案财物', '执法不规范' + UNION ALL SELECT 10, '投诉类/投诉执法行为/执法不公正', '执法不规范' + UNION ALL SELECT 11, '投诉类/投诉执法行为/办关系案、人情案', '执法不规范' + UNION ALL SELECT 12, '投诉类/投诉执法行为/对法律文书和鉴定结论不认可', '执法不规范' + UNION ALL SELECT 13, '投诉类/投诉执法行为/非法搜查拘禁,滥用强制措施,刑讯逼供,体罚虐待嫌疑人', '执法不规范' + UNION ALL SELECT 14, '投诉类/投诉执法行为/违规插手经济纠纷', '执法不规范' + UNION ALL SELECT 15, '投诉类/投诉执法行为/违规处罚收费', '执法不规范' + UNION ALL SELECT 16, '投诉类/投诉执法行为/对辖区黄赌毒等治安突出问题打击不力', '执法不规范' + UNION ALL SELECT 17, '投诉类/投诉执法行为/错录公民违法犯罪信息', '执法不规范' + UNION ALL SELECT 18, '投诉类/投诉执法行为/其他执法不规范行为', '执法不规范' + UNION ALL SELECT 19, '投诉类/投诉服务管理行为/态度生硬恶劣', '队伍管理问题' + UNION ALL SELECT 20, '投诉类/投诉服务管理行为/推诿扯皮,办事拖拉、效率低', '队伍管理问题' + UNION ALL SELECT 21, '投诉类/投诉服务管理行为/违规办理证照', '队伍管理问题' + UNION ALL SELECT 22, '投诉类/投诉服务管理行为/未履行一次性告知义务', '队伍管理问题' + UNION ALL SELECT 23, '投诉类/投诉服务管理行为/吃拿卡要,乱收费', '队伍管理问题' + UNION ALL SELECT 24, '投诉类/投诉服务管理行为/其他服务管理行为', '队伍管理问题' + UNION ALL SELECT 25, '投诉类/投诉内部管理行为/队伍管理不善', '队伍管理问题' + UNION ALL SELECT 26, '投诉类/投诉内部管理行为/工作作风问题', '队伍管理问题' + UNION ALL SELECT 27, '投诉类/投诉内部管理行为/公安管理措施、便民设施不规范', '队伍管理问题' + UNION ALL SELECT 28, '投诉类/投诉内部管理行为/其他内部管理行为', '队伍管理问题' + UNION ALL SELECT 29, '投诉类/投诉违反党纪政纪行为/违反组织人事纪律', '违法违纪违规问题' + UNION ALL SELECT 30, '投诉类/投诉违反党纪政纪行为/贪污受贿违反廉洁纪律', '违法违纪违规问题' + UNION ALL SELECT 31, '投诉类/投诉违反党纪政纪行为/违反社会公德、生活作风', '违法违纪违规问题' + UNION ALL SELECT 32, '投诉类/投诉违反党纪政纪行为/从事营利性经营活动', '违法违纪违规问题' + UNION ALL SELECT 33, '投诉类/投诉违反党纪政纪行为/违反政治纪律', '违法违纪违规问题' + UNION ALL SELECT 34, '投诉类/投诉违反党纪政纪行为/其他违反党纪政纪行为', '违法违纪违规问题' + UNION ALL SELECT 35, '投诉类/投诉违反警纪行为/泄露警务工作秘密', '违法违纪违规问题' + UNION ALL SELECT 36, '投诉类/投诉违反警纪行为/参与黄赌毒', '违法违纪违规问题' + UNION ALL SELECT 37, '投诉类/投诉违反警纪行为/侵犯公民个人信息', '违法违纪违规问题' + UNION ALL SELECT 38, '投诉类/投诉违反警纪行为/滥用职权', '违法违纪违规问题' + UNION ALL SELECT 39, '投诉类/投诉违反警纪行为/违反内务管理规定', '违法违纪违规问题' + UNION ALL SELECT 40, '投诉类/投诉违反警纪行为/违反车、枪、酒相关规定', '违法违纪违规问题' + UNION ALL SELECT 41, '投诉类/投诉违反警纪行为/其他违反警纪行为', '违法违纪违规问题' + UNION ALL SELECT 42, '投诉类/投诉执法行为/对处理结果不满意', '执法不作为、慢作为' + UNION ALL SELECT 43, '投诉类/涉企涉冻/涉企', '涉企、涉查扣冻' + UNION ALL SELECT 44, '投诉类/涉企涉冻/涉冻', '涉企、涉查扣冻' + UNION ALL SELECT 45, '举报类/举报警务人员违纪违法/', '违纪违规问题' +) AS mapping_data +WHERE NOT EXISTS ( + SELECT 1 + FROM `sup_dict_data` existing + WHERE existing.`dict_type` = 'mayorMailboxInvolveProblemMapping' + AND existing.`dict_value` = mapping_data.external_path +); diff --git a/src/main/java/com/biutag/supervision/pojo/enums/supDict/SupDictEnum.java b/src/main/java/com/biutag/supervision/pojo/enums/supDict/SupDictEnum.java index a8965cb..69003b1 100644 --- a/src/main/java/com/biutag/supervision/pojo/enums/supDict/SupDictEnum.java +++ b/src/main/java/com/biutag/supervision/pojo/enums/supDict/SupDictEnum.java @@ -16,6 +16,7 @@ public enum SupDictEnum implements CodeEnum { PROBLEM_SOURCES("problemSources", "问题来源"), BUSINESS_TYPE("businessType", "业务类型"), SUSPECT_PROBLEM("suspectProblem", "涉嫌问题"), + MAYOR_MAILBOX_INVOLVE_PROBLEM_MAPPING("mayorMailboxInvolveProblemMapping", "局长信箱涉嫌问题映射"), POLICE_TYPE("policeType", "涉及警种"), PERSON_TYPE("personType", "人员属性"), INSPECT_CASE("inspectCase", "核查情况"), diff --git a/src/main/java/com/biutag/supervision/service/MailBoxCaptureService.java b/src/main/java/com/biutag/supervision/service/MailBoxCaptureService.java index 0fd06df..daa48b2 100644 --- a/src/main/java/com/biutag/supervision/service/MailBoxCaptureService.java +++ b/src/main/java/com/biutag/supervision/service/MailBoxCaptureService.java @@ -25,6 +25,7 @@ import com.biutag.supervision.pojo.enums.complaintCollection.ComplaintCollection import com.biutag.supervision.pojo.enums.complaintCollection.ComplaintCollectionPublicApprovalEnum; import com.biutag.supervision.pojo.enums.complaintCollection.ComplaintCollectionSourceTableEnum; import com.biutag.supervision.pojo.enums.negative.NegativeSourceTypeEnum; +import com.biutag.supervision.pojo.enums.supDict.SupDictEnum; import com.biutag.supervision.pojo.param.ComplaintCollection.ComplaintCollectionQueryParam; import com.biutag.supervision.pojo.param.ComplaintCollection.ComplaintCollectionUpdateParam; import com.biutag.supervision.pojo.param.MailQueryParam; @@ -48,7 +49,9 @@ import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; @@ -80,6 +83,7 @@ public class MailBoxCaptureService { private final SupDictHandleResultMapingService dictHandleResultMapingService; private final SupDictProblemTypeMapingService dictProblemTypeMapingService; private final SupDictProblemTypeService problemTypeService; + private final SupDictDataService supDictDataService; private final TransactionTemplate transactionTemplate; private final ComplaintCollectionMapper complaintCollectionMapper; private final ComplaintCollectionService complaintCollectionService; @@ -105,6 +109,8 @@ public class MailBoxCaptureService { } log.info("【局长信箱抓取新信件】查询到投诉举报信件信件数量:{}", mailList.size()); + Map involveProblemMapping = loadMayorMailboxInvolveProblemMapping(); + // 3. 遍历处理 int successCount = 0; int skipCount = 0; @@ -114,7 +120,7 @@ public class MailBoxCaptureService { try { // 每条记录在独立事务中执行 boolean success = Boolean.TRUE.equals(transactionTemplate.execute(status -> { - return doCaptureSingleMail(mail); + return doCaptureSingleMail(mail, involveProblemMapping); })); if (success) { successCount++; @@ -323,6 +329,10 @@ public class MailBoxCaptureService { * 单条记录的抓取逻辑(独立事务执行) */ public boolean doCaptureSingleMail(Mail mail) { + return doCaptureSingleMail(mail, loadMayorMailboxInvolveProblemMapping()); + } + + private boolean doCaptureSingleMail(Mail mail, Map involveProblemMapping) { // 1. 判重检查 if (isAlreadyProcessed(mail)) { return false; @@ -338,7 +348,7 @@ public class MailBoxCaptureService { } // 3. 构建并保存 Negative(阶段1:主表 + 来信附件) - NegativeDataOnlyDto dto = buildNegativeDto(mail, secondDepart, thirdDepart); + NegativeDataOnlyDto dto = buildNegativeDto(mail, secondDepart, thirdDepart, involveProblemMapping); Negative negative = negativeService.saveNegativeMain(dto); negativeService.saveThingFiles(dto, negative.getId()); @@ -622,7 +632,8 @@ public class MailBoxCaptureService { /** * 构建 NegativeDataOnlyDto */ - private NegativeDataOnlyDto buildNegativeDto(Mail mail, SupDepart secondDepart, SupDepart thirdDepart) { + private NegativeDataOnlyDto buildNegativeDto(Mail mail, SupDepart secondDepart, SupDepart thirdDepart, + Map involveProblemMapping) { NegativeDataOnlyDto dto = new NegativeDataOnlyDto(); // 基础字段 dto.setOriginId(mail.getId()); @@ -644,6 +655,15 @@ public class MailBoxCaptureService { // 来信内容 dto.setThingDesc(mail.getContent()); + String categoryPath = buildMailCategoryPath(mail); + String involveProblemCode = involveProblemMapping.get(categoryPath); + if (StrUtil.isNotBlank(involveProblemCode)) { + dto.setInvolveProblem(Collections.singletonList(involveProblemCode)); + } else { + log.warn("【局长信箱抓取新信件】涉嫌问题映射不存在: mailId={}, categoryPath={}", + mail.getId(), categoryPath); + } + // 涉及单位设置 dto.setInvolveDepartId(thirdDepart.getId()); dto.setInvolveDepartName(thirdDepart.getName()); @@ -664,6 +684,75 @@ public class MailBoxCaptureService { return dto; } + private Map loadMayorMailboxInvolveProblemMapping() { + List suspectProblems = supDictDataService.list( + new LambdaQueryWrapper() + .eq(SupDictData::getDictType, SupDictEnum.SUSPECT_PROBLEM.getCode()) + .eq(SupDictData::getStatus, "0") + ); + Map suspectProblemCodeByLabel = new HashMap<>(); + for (SupDictData suspectProblem : suspectProblems) { + String label = trimToEmpty(suspectProblem.getDictLabel()); + String code = trimToEmpty(suspectProblem.getDictValue()); + if (StrUtil.isBlank(label) || StrUtil.isBlank(code)) { + log.warn("【局长信箱抓取新信件】项目涉嫌问题字典配置不完整: dictCode={}", + suspectProblem.getDictCode()); + continue; + } + if (suspectProblemCodeByLabel.containsKey(label)) { + log.warn("【局长信箱抓取新信件】项目涉嫌问题名称重复,保留第一条: dictLabel={}", label); + continue; + } + suspectProblemCodeByLabel.put(label, code); + } + + List mappings = supDictDataService.list( + new LambdaQueryWrapper() + .eq(SupDictData::getDictType, + SupDictEnum.MAYOR_MAILBOX_INVOLVE_PROBLEM_MAPPING.getCode()) + .eq(SupDictData::getStatus, "0") + .orderByAsc(SupDictData::getDictSort) + ); + Map result = new HashMap<>(); + for (SupDictData mapping : mappings) { + String categoryPath = trimToEmpty(mapping.getDictValue()); + String involveProblemLabel = trimToEmpty(mapping.getRemark()); + if (StrUtil.isBlank(categoryPath)) { + log.warn("【局长信箱抓取新信件】涉嫌问题映射外部路径为空: dictCode={}", mapping.getDictCode()); + continue; + } + if (StrUtil.isBlank(involveProblemLabel)) { + log.warn("【局长信箱抓取新信件】涉嫌问题映射目标为空: dictCode={}, categoryPath={}", + mapping.getDictCode(), categoryPath); + continue; + } + String involveProblemCode = suspectProblemCodeByLabel.get(involveProblemLabel); + if (StrUtil.isBlank(involveProblemCode)) { + log.warn("【局长信箱抓取新信件】映射目标在项目涉嫌问题字典中不存在: categoryPath={}, involveProblem={}", + categoryPath, involveProblemLabel); + continue; + } + if (result.containsKey(categoryPath)) { + log.warn("【局长信箱抓取新信件】外部类目路径重复,保留第一条: categoryPath={}", categoryPath); + continue; + } + result.put(categoryPath, involveProblemCode); + } + log.info("【局长信箱抓取新信件】涉嫌问题映射加载完成: mappingCount={}", result.size()); + return result; + } + + private String buildMailCategoryPath(Mail mail) { + return String.join("/", + trimToEmpty(mail.getMailFirstCategory()), + trimToEmpty(mail.getMailSecondCategory()), + trimToEmpty(mail.getMailThreeCategory())); + } + + private String trimToEmpty(String value) { + return value == null ? "" : value.trim(); + } + /** * 构建问题附件列表 */