From 759a047e94e11b5688e0863c6536683f3a89889a Mon Sep 17 00:00:00 2001 From: sjh Date: Thu, 5 Dec 2024 16:26:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=88=B6=E4=BA=B2=E6=96=87=E5=8C=96=E7=A8=8B?= =?UTF-8?q?=E5=BA=A6=E3=80=81=E6=AF=8D=E4=BA=B2=E6=96=87=E5=8C=96=E7=A8=8B?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/ApplicationEvent.java | 3 +- .../mapper/dwd/GBaseCSCZRKMapper.java | 18 ++++ .../pojo/constants/Default.java | 4 + .../pojo/entity/dwd/GBaseCSCZRK.java | 83 ++++++++++++++++ .../repository/GBaseCSCZRKRepository.java | 10 ++ .../supervisiondata/service/PointService.java | 6 ++ .../service/impl/PointServiceImpl.java | 98 +++++++++++++++++++ 7 files changed, 221 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/biutag/supervisiondata/mapper/dwd/GBaseCSCZRKMapper.java create mode 100644 src/main/java/com/biutag/supervisiondata/pojo/entity/dwd/GBaseCSCZRK.java create mode 100644 src/main/java/com/biutag/supervisiondata/repository/GBaseCSCZRKRepository.java diff --git a/src/main/java/com/biutag/supervisiondata/event/ApplicationEvent.java b/src/main/java/com/biutag/supervisiondata/event/ApplicationEvent.java index e35b728..46496f4 100644 --- a/src/main/java/com/biutag/supervisiondata/event/ApplicationEvent.java +++ b/src/main/java/com/biutag/supervisiondata/event/ApplicationEvent.java @@ -131,7 +131,8 @@ public class ApplicationEvent { // pointService.syncPointCall(initDomain(List.of(50))); // pointService.syncOilBuy(initDomain(List.of(52))); pointService.syncIsPetition(initDomain(List.of(101))); - + pointService.syncFatherEducation(initDomain(List.of(102))); + pointService.syncMotherEducation(initDomain(List.of(103))); //暂时废弃该保安 //gBaseBAService.baModelTask(initDomain(List.of(37))); //personalService.syncOrg(); diff --git a/src/main/java/com/biutag/supervisiondata/mapper/dwd/GBaseCSCZRKMapper.java b/src/main/java/com/biutag/supervisiondata/mapper/dwd/GBaseCSCZRKMapper.java new file mode 100644 index 0000000..89fe70b --- /dev/null +++ b/src/main/java/com/biutag/supervisiondata/mapper/dwd/GBaseCSCZRKMapper.java @@ -0,0 +1,18 @@ +package com.biutag.supervisiondata.mapper.dwd; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.supervisiondata.pojo.entity.dwd.GBaseCSCZRK; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +public interface GBaseCSCZRKMapper extends BaseMapper { + + @Select("select a.gmsfhm, b.whcdmc fatherEducation from dwd_ry_kxgxzyk_csczrk a left join dwd_ry_kxgxzyk_csczrk b " + + "on a.fqgmsfzhm = b.gmsfhm where a.fqgmsfzhm is not null and b.whcdmc is not null and a.fqgmsfzhm != a.gmsfhm") + List selectFatherEducation(); + + @Select("select a.gmsfhm, b.whcdmc motherEducation from dwd_ry_kxgxzyk_csczrk a left join dwd_ry_kxgxzyk_csczrk b " + + "on a.mqgmsfzhm = b.gmsfhm where a.mqgmsfzhm is not null and b.whcdmc is not null and a.mqgmsfzhm != a.gmsfhm") + List selectMotherEducation(); +} diff --git a/src/main/java/com/biutag/supervisiondata/pojo/constants/Default.java b/src/main/java/com/biutag/supervisiondata/pojo/constants/Default.java index 30e3de2..56bfd4b 100644 --- a/src/main/java/com/biutag/supervisiondata/pojo/constants/Default.java +++ b/src/main/java/com/biutag/supervisiondata/pojo/constants/Default.java @@ -89,4 +89,8 @@ public class Default { public static final String CAR_IG ="有车因素"; public static final String IS_PETITION = "是否上访"; + + public static final String FATHER_EDUCATION = "父亲文化程度"; + + public static final String MOTHER_EDUCATION = "母亲文化程度"; } diff --git a/src/main/java/com/biutag/supervisiondata/pojo/entity/dwd/GBaseCSCZRK.java b/src/main/java/com/biutag/supervisiondata/pojo/entity/dwd/GBaseCSCZRK.java new file mode 100644 index 0000000..5fd9eed --- /dev/null +++ b/src/main/java/com/biutag/supervisiondata/pojo/entity/dwd/GBaseCSCZRK.java @@ -0,0 +1,83 @@ +package com.biutag.supervisiondata.pojo.entity.dwd; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +@TableName("dwd_ry_kxgxzyk_csczrk") +public class GBaseCSCZRK implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + // 姓名 + @TableField("xm") + String xm; + + // 性别名称 + @TableField("xbmc") + String xbmc; + + // 民族名称 + @TableField("mzmc") + String mzmc; + + // 出生日期 + @TableField("csrq") + LocalDateTime csrq; + + // 住址省市县区代码 + @TableField("zzssxq") + String zzssxq; + + // 住址详址 + @TableField("zzxz") + String zzxz; + + // 出生地-省市县 + @TableField("csd") + String csd; + + // 公民身份证号码 + @TableField("gmsfhm") + String gmsfhm; + + // 文化程度名称 + @TableField("whcdmc") + String whcdmc; + + // 婚姻状况名称 + @TableField("hyzkmc") + String hyzkmc; + + // 职业名称 + @TableField("zymc") + String zymc; + + // 所属派出所机关代码 + @TableField("sspcsjgdm") + String sspcsjgdm; + + // 所属派出所名称 + @TableField("sspcsmc") + String sspcsmc; + + // 父亲身份证号 + @TableField("fqgmsfzhm") + String fqgmsfzhm; + + // 母亲身份证号 + @TableField("mqgmsfzhm") + String mqgmsfzhm; + + @TableField(exist = false) + String fatherEducation; + + @TableField(exist = false) + String motherEducation; +} diff --git a/src/main/java/com/biutag/supervisiondata/repository/GBaseCSCZRKRepository.java b/src/main/java/com/biutag/supervisiondata/repository/GBaseCSCZRKRepository.java new file mode 100644 index 0000000..5689996 --- /dev/null +++ b/src/main/java/com/biutag/supervisiondata/repository/GBaseCSCZRKRepository.java @@ -0,0 +1,10 @@ +package com.biutag.supervisiondata.repository; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.biutag.supervisiondata.mapper.dwd.GBaseCSCZRKMapper; +import com.biutag.supervisiondata.pojo.entity.dwd.GBaseCSCZRK; +import org.springframework.stereotype.Service; + +@Service +public class GBaseCSCZRKRepository extends ServiceImpl { +} diff --git a/src/main/java/com/biutag/supervisiondata/service/PointService.java b/src/main/java/com/biutag/supervisiondata/service/PointService.java index a41174d..70d94f5 100644 --- a/src/main/java/com/biutag/supervisiondata/service/PointService.java +++ b/src/main/java/com/biutag/supervisiondata/service/PointService.java @@ -38,6 +38,12 @@ public interface PointService { // 是否上访 void syncIsPetition(TaskParamDomain domain); + // 父亲文化程度 + void syncFatherEducation(TaskParamDomain domain); + + // 母亲文化程度 + void syncMotherEducation(TaskParamDomain domain); + void syncSecurity(TaskParamDomain domain); /** diff --git a/src/main/java/com/biutag/supervisiondata/service/impl/PointServiceImpl.java b/src/main/java/com/biutag/supervisiondata/service/impl/PointServiceImpl.java index 35b6549..e399cfa 100644 --- a/src/main/java/com/biutag/supervisiondata/service/impl/PointServiceImpl.java +++ b/src/main/java/com/biutag/supervisiondata/service/impl/PointServiceImpl.java @@ -11,6 +11,7 @@ import com.biutag.supervisiondata.pojo.database.MuchCall; import com.biutag.supervisiondata.pojo.database.PointOrg; import com.biutag.supervisiondata.pojo.database.SecurityMan; import com.biutag.supervisiondata.pojo.domain.*; +import com.biutag.supervisiondata.pojo.entity.dwd.GBaseCSCZRK; import com.biutag.supervisiondata.pojo.entity.dwd.GBaseOilBuy; import com.biutag.supervisiondata.pojo.entity.dwd.GBaseTbDZdrylb; import com.biutag.supervisiondata.pojo.entity.dwd.GBaseZDRY; @@ -61,6 +62,8 @@ public class PointServiceImpl implements PointService { private final WdpcGrjdXfsjCsRepository wdpcGrjdXfsjCsRepository; + private final GBaseCSCZRKRepository cSCZRKRepository; + @Override public void personPullAndSave(LocalDateTime start, LocalDateTime end) { riskPersonalService.formatAndSave(getPersons(), Default.POINT_POEPLE); @@ -234,6 +237,101 @@ public class PointServiceImpl implements PointService { taskRepository.updateById(updateTask); } + @Override + public void syncFatherEducation(TaskParamDomain domain) { + RiskTask task = createTask(domain.getPersons().size(), 102); + taskRepository.save(task); + + Map oldMap = domain.getOldMap(task.getModelId(), true); + Map idCode = new HashMap<>(); + List list = cSCZRKRepository.getBaseMapper().selectFatherEducation(); + log.info("模型102查询结果数:{}", list.size()); + Map personalMap = domain.getPersons().stream().collect(Collectors.toMap(RiskPersonal::getIdCode, Function.identity(), (old, newVal) -> newVal)); + List toInsert = new ArrayList<>(); + for (GBaseCSCZRK fatherEducation : list) { + RiskPersonal personal = personalMap.get(fatherEducation.getGmsfhm()); + if (personal == null) continue; + if (idCode.get(fatherEducation.getGmsfhm()) != null) continue; + if (oldMap.get(fatherEducation.getGmsfhm()) != null) continue; + + idCode.put(fatherEducation.getGmsfhm(), 1); + int eduScore = getEduScore(fatherEducation); + ClueData data = ClueData.builder() + .name(personal.getName()) + .id(personal.getId().toString()) + .idCode(personal.getIdCode()) + .tag("父亲文化程度") + .personId(personal.getId()) + .sourceData("发现该人员父亲文化程度为" + fatherEducation.getFatherEducation() + ",增加风险分" + eduScore + "分") + .build(); + toInsert.add(createClue(task.getModelId(), eduScore, task.getId(), data)); + } + if (!toInsert.isEmpty()) { + modelTaskClueService.saveClues(toInsert, Default.FATHER_EDUCATION); + } + RiskTask updateTask = new RiskTask(); + updateTask.setId(task.getId()); + updateTask.setInsertSize(toInsert.size()); + updateTask.setUpdateSize(0); + updateTask.setState(1); + updateTask.setEndTime(LocalDateTime.now()); + taskRepository.updateById(updateTask); + } + + @Override + public void syncMotherEducation(TaskParamDomain domain) { + RiskTask task = createTask(domain.getPersons().size(), 103); + taskRepository.save(task); + + Map oldMap = domain.getOldMap(task.getModelId(), true); + Map idCode = new HashMap<>(); + List list = cSCZRKRepository.getBaseMapper().selectMotherEducation(); + log.info("模型103查询结果数:{}", list.size()); + Map personalMap = domain.getPersons().stream().collect(Collectors.toMap(RiskPersonal::getIdCode, Function.identity(), (old, newVal) -> newVal)); + List toInsert = new ArrayList<>(); + for (GBaseCSCZRK motherEducation : list) { + RiskPersonal personal = personalMap.get(motherEducation.getGmsfhm()); + if (personal == null) continue; + if (idCode.get(motherEducation.getGmsfhm()) != null) continue; + if (oldMap.get(motherEducation.getGmsfhm()) != null) continue; + + idCode.put(motherEducation.getGmsfhm(), 1); + int eduScore = getEduScore(motherEducation); + ClueData data = ClueData.builder() + .name(personal.getName()) + .id(personal.getId().toString()) + .idCode(personal.getIdCode()) + .tag("母亲文化程度") + .personId(personal.getId()) + .sourceData("发现该人员母亲文化程度为" + motherEducation.getMotherEducation() + ",增加风险分" + eduScore + "分") + .build(); + toInsert.add(createClue(task.getModelId(), eduScore, task.getId(), data)); + } + if (!toInsert.isEmpty()) { + modelTaskClueService.saveClues(toInsert, Default.MOTHER_EDUCATION); + } + RiskTask updateTask = new RiskTask(); + updateTask.setId(task.getId()); + updateTask.setInsertSize(toInsert.size()); + updateTask.setUpdateSize(0); + updateTask.setState(1); + updateTask.setEndTime(LocalDateTime.now()); + taskRepository.updateById(updateTask); + } + + private static int getEduScore(GBaseCSCZRK fatherEducation) { + return switch (fatherEducation.getFatherEducation()) { + case "研究生", "研究生肄业", "研究生毕业", "大学毕业", "大学本科", "大学肄业", "相当大学毕业" -> 1;// 本科 + case "大学专科和专科学校", "相当专科毕业", "专科毕业", "专科肄业" -> 2;// 大专 + case "相当高中毕业", "相当中专或中技毕业", "中专中技肄业", "职业高中毕业", "中专毕业", "高中肄业", + "中技毕业", "中等专科学校", "高中", "高中毕业", "农业高中毕业" -> 3;// 高中中专 + case "农业初中毕业", "技工学校", "技工学校肄业", "技工学校毕业", "初中", "职业初中毕业", "初中毕业", + "初中肆业", "相当初中毕业" -> 4;// 初中 + case "小学", "小学肄业", "小学毕业", "相当小学毕业", "文盲", "文盲或半文盲", "学龄前儿童" -> 5;// 小学 + default -> 0; + }; + } + @Override public void syncIsPetition(TaskParamDomain domain) { RiskTask task = createTask(domain.getPersons().size(), 101);