From b419f200c1bbca9101204e5d06d66af631e0239a Mon Sep 17 00:00:00 2001 From: wxc <191104855@qq.com> Date: Thu, 14 Nov 2024 13:05:58 +0800 Subject: [PATCH 1/7] =?UTF-8?q?fit:=20=E4=B8=AA=E4=BA=BA=E6=9E=81=E7=AB=AF?= =?UTF-8?q?=E8=B5=8B=E5=88=86=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/1114.sql | 13 ++ .../supervision/constants/AppConstants.java | 2 +- .../sensitivePerception/ModelController.java | 10 +- .../RiskScoreRuleController.java | 47 +++++ .../supervision/mapper/ModelClassMapper.java | 7 + .../biutag/supervision/pojo/entity/Model.java | 2 + .../pojo/model/ModelClassModel.java | 22 ++ .../biutag/supervision/pojo/vo/MenuTree.java | 2 +- .../biutag/supervision/pojo/vo/ModelTree.java | 2 + .../pojo/vo/RiskScoreRuleTree.java | 45 ++++ .../service/BusinessDepartService.java | 6 +- .../service/ModelClassService.java | 1 + .../supervision/service/ModelService.java | 5 +- .../service/NegativeScoreService.java | 199 ++++++++++-------- .../support/ModelClueDistributionAware.java | 2 +- src/main/resources/application-local.yml | 6 +- .../resources/mapper/ProfilePoliceMapper.xml | 2 +- .../biutag/supervision/tools/ExcelTest.java | 41 ++++ .../supervision/tools/GenCodeTests.java | 2 +- .../biutag/supervision/tools/HdtExcelDto.java | 26 +++ 20 files changed, 340 insertions(+), 102 deletions(-) create mode 100644 sql/1114.sql create mode 100644 src/main/java/com/biutag/supervision/controller/sensitivePerception/RiskScoreRuleController.java create mode 100644 src/main/java/com/biutag/supervision/pojo/model/ModelClassModel.java create mode 100644 src/main/java/com/biutag/supervision/pojo/vo/RiskScoreRuleTree.java create mode 100644 src/test/java/com/biutag/supervision/tools/ExcelTest.java create mode 100644 src/test/java/com/biutag/supervision/tools/HdtExcelDto.java diff --git a/sql/1114.sql b/sql/1114.sql new file mode 100644 index 0000000..2feba64 --- /dev/null +++ b/sql/1114.sql @@ -0,0 +1,13 @@ +CREATE TABLE `risk_score_rule` ( + `id` int NOT NULL AUTO_INCREMENT, + `pid` int DEFAULT NULL, + `risk_name` varchar(255) COMMENT '风险因素', + `score` varchar(255) COMMENT '分值', + `rule_desc` text COLLATE utf8mb4_general_ci COMMENT '规则描述', + `weight` int DEFAULT NULL COMMENT '权重', + `status` tinyint DEFAULT NULL COMMENT '状态', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `sort_id` int DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 COMMENT='个人极端赋分规则'; diff --git a/src/main/java/com/biutag/supervision/constants/AppConstants.java b/src/main/java/com/biutag/supervision/constants/AppConstants.java index 8fdbdb4..6d67389 100644 --- a/src/main/java/com/biutag/supervision/constants/AppConstants.java +++ b/src/main/java/com/biutag/supervision/constants/AppConstants.java @@ -2,7 +2,7 @@ package com.biutag.supervision.constants; public class AppConstants { - public static final int MENU_ROOT_ID = 0; + public static final Integer TREE_ROOT_ID = 0; // 单位 public static final String DICT_CONTENT_ROOT_PARENT_CODE = "-1"; diff --git a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelController.java b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelController.java index 49a15ce..9911300 100644 --- a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelController.java +++ b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelController.java @@ -3,12 +3,12 @@ package com.biutag.supervision.controller.sensitivePerception; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.biutag.supervision.mapper.ModelClassMapper; import com.biutag.supervision.pojo.Result; import com.biutag.supervision.pojo.entity.Model; -import com.biutag.supervision.pojo.entity.ModelClass; +import com.biutag.supervision.pojo.model.ModelClassModel; import com.biutag.supervision.pojo.param.ModelQueryParam; import com.biutag.supervision.pojo.vo.ModelTree; -import com.biutag.supervision.service.ModelClassService; import com.biutag.supervision.service.ModelService; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; @@ -24,7 +24,7 @@ public class ModelController { private final ModelService modelService; - private final ModelClassService modelClassService; + private final ModelClassMapper modelClassMapper; @GetMapping public Result> list(ModelQueryParam queryParam) { @@ -39,13 +39,14 @@ public class ModelController { @GetMapping("tree") public Result> tree() { - List modelClasses = modelClassService.list(); + List modelClasses = modelClassMapper.selectListAll(); List models = modelService.list(); List list = new ArrayList<>(); list.addAll(modelClasses.stream().map(item -> { ModelTree node = new ModelTree(); node.setValue(item.getId()); node.setLabel(item.getName()); + node.setSize(item.getSize()); node.setType("modelClass"); List children = models.stream().filter(model -> item.getId().equals(model.getClassId())).map(ModelTree::of).toList(); node.setChildren(children); @@ -57,7 +58,6 @@ public class ModelController { @PostMapping public Result add(@RequestBody Model model) { - return Result.success(modelService.saveModel(model)); } diff --git a/src/main/java/com/biutag/supervision/controller/sensitivePerception/RiskScoreRuleController.java b/src/main/java/com/biutag/supervision/controller/sensitivePerception/RiskScoreRuleController.java new file mode 100644 index 0000000..ca965aa --- /dev/null +++ b/src/main/java/com/biutag/supervision/controller/sensitivePerception/RiskScoreRuleController.java @@ -0,0 +1,47 @@ +package com.biutag.supervision.controller.sensitivePerception; + +import com.biutag.supervision.pojo.Result; +import com.biutag.supervision.pojo.entity.RiskScoreRule; +import com.biutag.supervision.pojo.vo.RiskScoreRuleTree; +import com.biutag.supervision.service.RiskScoreRuleService; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author wxc + * @date 2024/11/14 + */ +@RequiredArgsConstructor +@RequestMapping("risk/scoreRule") +@RestController +public class RiskScoreRuleController { + + private final RiskScoreRuleService riskScoreRuleService; + + @GetMapping("tree") + public Result> list() { + return Result.success(riskScoreRuleService.buildTree()); + } + + @PostMapping + public Result add(@RequestBody RiskScoreRule scoreRule) { + scoreRule.setCreateTime(LocalDateTime.now()); + scoreRule.setUpdateTime(LocalDateTime.now()); + return Result.success(riskScoreRuleService.save(scoreRule)); + } + + @PutMapping + public Result update(@RequestBody RiskScoreRule scoreRule) { + scoreRule.setUpdateTime(LocalDateTime.now()); + return Result.success(riskScoreRuleService.updateById(scoreRule)); + } + + @DeleteMapping("{id}") + public Result update(@PathVariable Integer id) { + return Result.success(riskScoreRuleService.removeById(id)); + } + +} diff --git a/src/main/java/com/biutag/supervision/mapper/ModelClassMapper.java b/src/main/java/com/biutag/supervision/mapper/ModelClassMapper.java index 8db59f1..c5ce565 100644 --- a/src/main/java/com/biutag/supervision/mapper/ModelClassMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/ModelClassMapper.java @@ -2,7 +2,14 @@ package com.biutag.supervision.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.biutag.supervision.pojo.entity.ModelClass; +import com.biutag.supervision.pojo.model.ModelClassModel; +import org.apache.ibatis.annotations.Select; + +import java.util.List; public interface ModelClassMapper extends BaseMapper { + @Select("select mc.id, mc.name, mc.sort, count(m.id) size from model_class mc left join model m on mc.id = m.class_id GROUP BY mc.id, mc.name, mc.sort order by sort") + List selectListAll(); + } \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/entity/Model.java b/src/main/java/com/biutag/supervision/pojo/entity/Model.java index aa66988..ceae6c5 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/Model.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/Model.java @@ -91,4 +91,6 @@ public class Model { @TableField("model_sql") private String modelSql; + + private Integer riskScoreRuleId; } \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/model/ModelClassModel.java b/src/main/java/com/biutag/supervision/pojo/model/ModelClassModel.java new file mode 100644 index 0000000..fbfd6ac --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/model/ModelClassModel.java @@ -0,0 +1,22 @@ +package com.biutag.supervision.pojo.model; + +import lombok.Getter; +import lombok.Setter; + +/** + * @author wxc + * @date 2024/11/13 + */ +@Setter +@Getter +public class ModelClassModel { + + private Integer id; + + private String name; + + private Integer sort; + + private Integer size; + +} diff --git a/src/main/java/com/biutag/supervision/pojo/vo/MenuTree.java b/src/main/java/com/biutag/supervision/pojo/vo/MenuTree.java index 0350ebd..ffb622b 100644 --- a/src/main/java/com/biutag/supervision/pojo/vo/MenuTree.java +++ b/src/main/java/com/biutag/supervision/pojo/vo/MenuTree.java @@ -52,7 +52,7 @@ public class MenuTree { private List children; public static List buildTree(List list) { - return buildTree(list, AppConstants.MENU_ROOT_ID); + return buildTree(list, AppConstants.TREE_ROOT_ID); } public static List buildTree(List list, Integer pid) { diff --git a/src/main/java/com/biutag/supervision/pojo/vo/ModelTree.java b/src/main/java/com/biutag/supervision/pojo/vo/ModelTree.java index 05db427..688d766 100644 --- a/src/main/java/com/biutag/supervision/pojo/vo/ModelTree.java +++ b/src/main/java/com/biutag/supervision/pojo/vo/ModelTree.java @@ -21,6 +21,8 @@ public class ModelTree { private String type; + private Integer size; + private List children = new ArrayList<>(); public static ModelTree of(Model model) { diff --git a/src/main/java/com/biutag/supervision/pojo/vo/RiskScoreRuleTree.java b/src/main/java/com/biutag/supervision/pojo/vo/RiskScoreRuleTree.java new file mode 100644 index 0000000..aa7f539 --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/vo/RiskScoreRuleTree.java @@ -0,0 +1,45 @@ +package com.biutag.supervision.pojo.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Getter; +import lombok.Setter; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +/** + * @author wxc + * @date 2024/11/14 + */ +@Setter +@Getter +public class RiskScoreRuleTree { + + private Integer id; + + private Integer pid; + + // 风险因素 + private String riskName; + + // 分值 + private String score; + + // 规则描述 + private String ruleDesc; + + // 权重 + private Integer weight; + + // 状态 + private Boolean status; + + // 更新时间 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime updateTime; + + private Integer sortId; + + private List children = new ArrayList<>(); +} diff --git a/src/main/java/com/biutag/supervision/service/BusinessDepartService.java b/src/main/java/com/biutag/supervision/service/BusinessDepartService.java index 9e8a50c..46f44a7 100644 --- a/src/main/java/com/biutag/supervision/service/BusinessDepartService.java +++ b/src/main/java/com/biutag/supervision/service/BusinessDepartService.java @@ -278,7 +278,9 @@ public class BusinessDepartService extends ServiceImpl list(Date beginTime, Date endTime, String businessType) { - return list(new LambdaQueryWrapper().between(BusinessDepart::getDate, beginTime, endTime).eq(BusinessDepart::getBusinessType, businessType)); + public List list(Date beginTime, Date endTime, String departId, String businessType) { + return list(new LambdaQueryWrapper().between(BusinessDepart::getDate, beginTime, endTime) + .eq(BusinessDepart::getDepartId, departId) + .eq(BusinessDepart::getBusinessType, businessType)); } } diff --git a/src/main/java/com/biutag/supervision/service/ModelClassService.java b/src/main/java/com/biutag/supervision/service/ModelClassService.java index 37a42bc..6e78464 100644 --- a/src/main/java/com/biutag/supervision/service/ModelClassService.java +++ b/src/main/java/com/biutag/supervision/service/ModelClassService.java @@ -8,4 +8,5 @@ import org.springframework.stereotype.Service; @Service public class ModelClassService extends ServiceImpl { + } diff --git a/src/main/java/com/biutag/supervision/service/ModelService.java b/src/main/java/com/biutag/supervision/service/ModelService.java index 884d0e0..4e470fd 100644 --- a/src/main/java/com/biutag/supervision/service/ModelService.java +++ b/src/main/java/com/biutag/supervision/service/ModelService.java @@ -1,5 +1,6 @@ package com.biutag.supervision.service; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.biutag.supervision.common.UserContextHolder; @@ -24,7 +25,7 @@ public class ModelService extends ServiceImpl { } public boolean saveModel(Model model) { - if (DistributionMethodEnum.NEGATIVE_DISTRIBUTE.getValue().equals(model.getDistributionMethod())) { + if (StrUtil.isNotBlank(model.getDistributionCycle()) && DistributionMethodEnum.NEGATIVE_DISTRIBUTE.getValue().equals(model.getDistributionMethod())) { String expression = DistributionCycleEnum.day.name().equals(model.getDistributionCycle()) ? ExpressionBuilder.build(model.getDistributionCycleTime()) : ExpressionBuilder.build(model.getDistributionCycleTime(), model.getDistributionCycleDayOfWeek()); model.setDistributionCycleExpression(expression); @@ -39,7 +40,7 @@ public class ModelService extends ServiceImpl { } public boolean updateModel(Model model) { - if (DistributionMethodEnum.NEGATIVE_DISTRIBUTE.getValue().equals(model.getDistributionMethod())) { + if (StrUtil.isNotBlank(model.getDistributionCycle()) && DistributionMethodEnum.NEGATIVE_DISTRIBUTE.getValue().equals(model.getDistributionMethod())) { String expression = DistributionCycleEnum.day.name().equals(model.getDistributionCycle()) ? ExpressionBuilder.build(model.getDistributionCycleTime()) : ExpressionBuilder.build(model.getDistributionCycleTime(), model.getDistributionCycleDayOfWeek()); model.setDistributionCycleExpression(expression); diff --git a/src/main/java/com/biutag/supervision/service/NegativeScoreService.java b/src/main/java/com/biutag/supervision/service/NegativeScoreService.java index a1899cc..5ebb868 100644 --- a/src/main/java/com/biutag/supervision/service/NegativeScoreService.java +++ b/src/main/java/com/biutag/supervision/service/NegativeScoreService.java @@ -11,7 +11,6 @@ import com.biutag.supervision.pojo.entity.*; import com.biutag.supervision.util.ScoreRule; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import java.math.BigDecimal; @@ -116,90 +115,77 @@ public class NegativeScoreService { System.out.println("calculateScore-------------------------------------------------End"); } - - private final BusinessPoliceService businessPoliceService; - private final BusinessDepartService businessDepartService; private final SupPoliceService policeService; // 业务权重 = 单个业务风险指数 / 总业务风险指数之和 - public double calculateBusinessWeight(Double totalScore, Double score) { + public double calculateBusinessWeight(Double score, Double totalScore) { if (totalScore == 0) { return 0.0; } - + log.info("业务权重 = {} / {}", score, totalScore); return NumberUtil.div(score, totalScore); } - // 平均问题数 = 单个业务问题数 / 业务涉及人数 - public double calculateAvgNumber(int size, int policeSize) { - if (policeSize == 0) { + // 平均问题发生率 = 单个业务问题加权数 / 单位总业务量 + public double calculateAvgNumber(double businessWeightScore, int totalBusinessSize) { + if (totalBusinessSize == 0) { + log.info("平均问题发生率 = 0"); return 0; } - return NumberUtil.div(size, policeSize); + log.info("平均问题发生率 = {} / {}", businessWeightScore, totalBusinessSize); + return NumberUtil.div(businessWeightScore, totalBusinessSize); } + // 业务标准差 = 根号(sum((个人问题数 - 平均问题数)²) / 业务涉及人数) - public double calculateSd(double[] diffNumber, int policeSize) { + public double calculateSd1(double[] diffNumber, int policeSize) { if (policeSize == 0) { + log.info("业务标准差 = 0"); return 0; } + log.info("业务标准差 = 根号({}) / {}", Arrays.stream(diffNumber).mapToObj(val -> String.format("(%s)²", val)).collect(Collectors.joining(" + ")), policeSize); return Math.sqrt(Arrays.stream(diffNumber).map(val -> Math.pow(val, 2)).sum() / policeSize); } - // 业务差异值1 = (个人问题发生率 - 平均问题发生率) / 业务标准差 - // 平均问题发生率 = 总问题数 / 总业务量 - // 个人问题发生率 = 个人问题数 / 个人业务量 - public double calculateDiff1(List businessScorePolice, SupPolice police, Date beginTime, Date endTime, String businessTypeCode, double sd) { - if (sd == 0) { + // 业务标准差 = 根号(sum((个人问题数 - 平均问题数)²) / 业务涉及人数) + public double calculateSd2(double[] diffNumber, int policeSize) { + if (policeSize == 0) { + log.info("业务标准差 = 0"); return 0; } - List businessDeparts = businessDepartService.list(beginTime, endTime, businessTypeCode); - // 总业务量 - int totalBusinessSize = businessDeparts.stream().mapToInt(BusinessDepart::getNumber).sum(); - // 平均问题发生率 - double avgRate = totalBusinessSize == 0? 0: NumberUtil.div(businessScorePolice.size(), totalBusinessSize); - // 个人问题数 - long personSize = businessScorePolice.stream().filter(item -> police.getOrgId().equals(item.getIdCode())).count(); - // 单位业务量 - long departBusinessSize = businessDeparts.stream().filter(item -> police.getOrgId().equals(item.getDepartId())).count(); - // 个人问题发生率 - double personRate = departBusinessSize == 0? 0: NumberUtil.div(personSize, departBusinessSize); - return NumberUtil.div(personRate - avgRate, sd); + log.info("业务标准差 = 根号({}) / {}", Arrays.stream(diffNumber).mapToObj(val -> String.format("(%s)²", val)).collect(Collectors.joining(" + ")), policeSize); + return Math.sqrt(Arrays.stream(diffNumber).map(val -> Math.pow(val, 2)).sum() / policeSize); } - public double calculateDiff1ByDepart(List businessScoreDeparts, String departId, Date beginTime, Date endTime, String businessTypeCode, double sd) { + // 业务差异值1 = (个人问题发生率 - 平均问题发生率) / 业务标准差 + // 平均问题发生率 = 总问题数 / 总业务量 + // 个人问题发生率 = 个人问题数 / 个人业务量 + public double calculateDiff1(double personalRate, double avgNumber, double sd) { if (sd == 0) { + log.info("业务差异值(发生率) = 0"); return 0; } - List businessDeparts = businessDepartService.list(beginTime, endTime, businessTypeCode); - // 总业务量 - int totalBusinessSize = businessDeparts.stream().mapToInt(BusinessDepart::getNumber).sum(); - // 平均问题发生率 - double avgRate = totalBusinessSize == 0? 0: NumberUtil.div(businessScoreDeparts.size(), totalBusinessSize); - // 个人问题数 - long personSize = businessScoreDeparts.stream().filter(item -> departId.equals(item.getDepartId())).count(); - // 个人业务量 - long personBusinessSize = businessDeparts.stream().filter(item -> departId.equals(item.getDepartId())).count(); - // 个人问题发生率 - double personRate = personBusinessSize == 0? 0: NumberUtil.div(personSize, personBusinessSize); - return NumberUtil.div(personRate - avgRate, sd); + log.info("业务差异值(发生率) = ({} - {}) / {}", personalRate, avgNumber, sd); + return NumberUtil.div(personalRate - avgNumber, sd); } - // 业务差异值2 = (问题数 - 平均问题数) / 业务标准差 - public double calculateDiff2(long personalSize, double avgNumber, double sd) { + // 业务差异值2 = (加权问题数 - 平均问题数) / 业务标准差 + public double calculateDiff2(double personalScore, double avgNumber, double sd) { if (sd == 0) { return 0; } - return NumberUtil.div(personalSize - avgNumber, sd); + log.info("业务差异值(数量) = ({} - {}) / {}", personalScore, avgNumber, sd); + return NumberUtil.div(personalScore - avgNumber, sd); } - public double calculateBusinessScore(double diff, long personalSize) { + public double calculateBusinessScore(double diff, double personalSize) { if (personalSize == 0) { return 0; } - return 50 + (diff * 15); + log.info("单个业务风险指数 = 50 + ({} * 5)", diff); + return 50 + (diff * 5); } private final SupDepartService departService; @@ -228,43 +214,75 @@ public class NegativeScoreService { List expressionArr = new ArrayList<>(); StringBuilder remarks = new StringBuilder(); double policeScore = Arrays.stream(BusinessTypeEnum.values()).mapToDouble(businessTypeEnum -> { + log.info("业务 【{}】 开始-------------------------------------------------------------------", businessTypeEnum.getLabel()); List businessScorePolice = scorePolices.stream().filter(item -> item.getBusinessTypeCode().equals(businessTypeEnum.getValue())).toList(); + // 业务加权问题总数 + double businessWeightScore = businessScorePolice.stream().mapToDouble(NegativeScorePolice::getScore).sum(); + log.info("业务加权问题数 = {}", businessWeightScore); // 业务涉及人数 int policeSize = businessScorePolice.stream().map(NegativeScorePolice::getIdCode).collect(Collectors.toSet()).size(); - remarks.append(String.format("业务设计人数 %s", policeSize)); - // 业务问题数 - int businessSize = businessScorePolice.size(); - //--------------------------------------------------------- - // 平均问题数 - double avgNumber = calculateAvgNumber(businessSize, policeSize); - // 差值集合 = 个人问题数 - 平均问题数 - Map> group = businessScorePolice.stream().collect(Collectors.groupingBy(NegativeScorePolice::getIdCode)); - double[] diffNumbers = group.values().stream().mapToDouble(val -> val.size() - avgNumber).toArray(); - // 业务标准差 - double sd = calculateSd(diffNumbers, policeSize); - log.info("业务标准差为:{}", sd); + log.info("业务涉及人数 = {}", policeSize); + // 业务加权问题数(风险指数) + double personalScore = businessScorePolice.stream().filter(item -> idCode.equals(item.getIdCode())).mapToDouble(NegativeScorePolice::getScore).sum(); + log.info("个人业务加权问题数 = {}", personalScore); // 业务差异值 double diff; - long personalSize = businessScorePolice.stream().filter(item -> idCode.equals(item.getIdCode())).count(); - if (businessTypeEnum.getBusinessVolume()) { - diff = calculateDiff1(businessScorePolice, police, beginTime, endTime, businessTypeEnum.getValue(), sd); + if (false) { + String departId = depart.getId(); + // 如果是4级单位 则找他上级单位 + if (depart.getLevel() == 4) { + departId = departService.getById(depart.getPid()).getId(); + } + List businessDeparts = businessDepartService.list(beginTime, endTime, departId, businessTypeEnum.getValue()); + // 单位总业务量 + int totalBusinessSize = businessDeparts.stream().mapToInt(BusinessDepart::getNumber).sum(); + log.info("单位总业务量 = {}", totalBusinessSize); + // 平均加权问题发生率 + double avgNumber = calculateAvgNumber(businessWeightScore, totalBusinessSize); + log.info("平均加权问题发生率 = {}", avgNumber); + Map> group = businessScorePolice.stream().collect(Collectors.groupingBy(NegativeScorePolice::getIdCode)); + double[] diffNumbers = group.values().stream().mapToDouble(val -> { + if (totalBusinessSize == 0) { + return -avgNumber; + } + return (val.stream().mapToDouble(NegativeScorePolice::getScore).sum() / totalBusinessSize) - avgNumber; + }).toArray(); + // 业务标准差 + double sd = calculateSd1(diffNumbers, policeSize); + double rate = personalScore / totalBusinessSize; + log.info("个人问题发生率 = {} / {}", personalScore, totalBusinessSize); + log.info("个人问题发生率 = {}", rate); + diff = calculateDiff1(personalScore / totalBusinessSize, avgNumber, sd); } else { - diff = calculateDiff2(personalSize, avgNumber, sd); + remarks.append(String.format("业务涉及人数 %s", policeSize)); + // 业务平均加权问题数 + double avgNumber = calculateAvgNumber(businessWeightScore, policeSize); + // 差值集合 = 个人问题数 - 平均问题数 + Map> group = businessScorePolice.stream().collect(Collectors.groupingBy(NegativeScorePolice::getIdCode)); + double[] diffNumbers = group.values().stream().mapToDouble(val -> val.stream().mapToDouble(NegativeScorePolice::getScore).sum() - avgNumber).toArray(); + // 业务标准差 + double sd = calculateSd2(diffNumbers, policeSize); + log.info("业务标准差为 = {}", sd); + + diff = calculateDiff2(personalScore, avgNumber, sd); } - log.info("业务差异值为:{}", diff); + log.info("业务差异值为 = {}", diff); // 业务风险指数 - double businessScore = calculateBusinessScore(diff, personalSize); - log.info("业务风险指数:{}", businessScore); + double businessScore = calculateBusinessScore(diff, personalScore); + // 业务权重 Double score = businessScorePolice.stream().mapToDouble(NegativeScorePolice::getScore).sum(); - double businessWeight = calculateBusinessWeight(totalScore, score); + double businessWeight = calculateBusinessWeight(score, totalScore); expressionArr.add(String.format("(%s * %s)", businessScore, businessWeight)); remarks.append(String.format("%s:", businessTypeEnum.getLabel())).append("\n"); remarks.append(String.format("业务涉及人数 %s", policeSize)).append("\n"); - remarks.append(String.format("业务问题数 %s", businessSize)).append("\n"); - remarks.append(String.format("平均问题数 %s", avgNumber)).append("\n"); - remarks.append(String.format("业务标准差 %s", sd)).append("\n"); + remarks.append(String.format("业务问题数 %s", businessWeightScore)).append("\n"); remarks.append(String.format("业务差异值 %s", diff)).append("\n"); + log.info("业务风险指数 = {}", businessScore); + log.info("业务权重 = {}", businessWeight); + log.info("单个业务风险指数 = {} * {}", businessScore, businessWeight); + + log.info("单个业务结束-------------------------------------------------------------------", businessTypeEnum.getLabel()); return NumberUtil.mul(businessScore, businessWeight); }).sum(); BigDecimal score = NumberUtil.roundHalfEven(policeScore, 2); @@ -288,35 +306,46 @@ public class NegativeScoreService { StringBuilder remarks = new StringBuilder(); double policeScore = Arrays.stream(BusinessTypeEnum.values()).mapToDouble(businessTypeEnum -> { List businessScoreDeparts = scoreDeparts.stream().filter(item -> item.getBusinessTypeCode().equals(businessTypeEnum.getValue())).toList(); + // 业务加权问题数 + double businessWeightScore = businessScoreDeparts.stream().mapToDouble(NegativeScoreDepart::getScore).sum(); // 业务涉及人数 int departSize = businessScoreDeparts.stream().map(NegativeScoreDepart::getDepartId).collect(Collectors.toSet()).size(); - // 当前部门问题数 - long personalSize = businessScoreDeparts.stream().filter(item -> departId.equals(item.getDepartId())).count(); - // 平均问题数 - double avgNumber = calculateAvgNumber(businessScoreDeparts.size(), departSize); - // 差值集合 = 个人问题数 - 平均问题数 - Map> group = businessScoreDeparts.stream().collect(Collectors.groupingBy(NegativeScoreDepart::getDepartId)); - double[] diffNumbers = group.values().stream().mapToDouble(val -> val.size() - avgNumber).toArray(); - // 业务标准差 - double sd = calculateSd(diffNumbers, departSize); + // 业务加权问题数(风险指数) + double personalScore = businessScoreDeparts.stream().filter(item -> departId.equals(item.getDepartId())).mapToDouble(NegativeScoreDepart::getScore).sum(); // 业务差异值 double diff; - if (businessTypeEnum.getBusinessVolume()) { - diff = calculateDiff1ByDepart(businessScoreDeparts, departId, beginTime, endTime, businessTypeEnum.getValue(), sd); + if (false) { + List businessDeparts = businessDepartService.list(beginTime, endTime, departId, businessTypeEnum.getValue()); + // 总业务量 + int totalBusinessSize = businessDeparts.stream().mapToInt(BusinessDepart::getNumber).sum(); + // 平均加权问题发生率 + double avgNumber = calculateAvgNumber(businessWeightScore, totalBusinessSize); + Map> group = businessScoreDeparts.stream().collect(Collectors.groupingBy(NegativeScoreDepart::getDepartId)); + double[] diffNumbers = group.values().stream().mapToDouble(val -> val.stream().mapToDouble(NegativeScoreDepart::getScore).sum() - avgNumber).toArray(); + // 业务标准差 + double sd = calculateSd1(diffNumbers, departSize); + log.info(""); + diff = calculateDiff1(personalScore, avgNumber, sd); } else { + // 当前部门问题数 + long personalSize = businessScoreDeparts.stream().filter(item -> departId.equals(item.getDepartId())).count(); + // 平均问题数 + double avgNumber = calculateAvgNumber(businessScoreDeparts.size(), departSize); + // 差值集合 = 个人问题数 - 平均问题数 + Map> group = businessScoreDeparts.stream().collect(Collectors.groupingBy(NegativeScoreDepart::getDepartId)); + double[] diffNumbers = group.values().stream().mapToDouble(val -> val.size() - avgNumber).toArray(); + // 业务标准差 + double sd = calculateSd2(diffNumbers, departSize); diff = calculateDiff2(personalSize, avgNumber, sd); } // 业务风险指数 - double businessScore = calculateBusinessScore(diff, personalSize); + double businessScore = calculateBusinessScore(diff, personalScore); // 业务权重 Double score = businessScoreDeparts.stream().mapToDouble(NegativeScoreDepart::getScore).sum(); - double businessWeight = calculateBusinessWeight(totalScore, score); + double businessWeight = calculateBusinessWeight(score, totalScore); expressionArr.add(String.format("(%s * %s)", businessScore, businessWeight)); remarks.append(String.format("%s:", businessTypeEnum.getLabel())).append("\n"); remarks.append(String.format("业务涉及人数 %s", departSize)).append("\n"); - remarks.append(String.format("当前部门问题数 %s", personalSize)).append("\n"); - remarks.append(String.format("平均问题数 %s", avgNumber)).append("\n"); - remarks.append(String.format("业务标准差 %s", sd)).append("\n"); remarks.append(String.format("业务差异值 %s", diff)).append("\n"); return NumberUtil.mul(businessScore, businessWeight); }).sum(); diff --git a/src/main/java/com/biutag/supervision/support/ModelClueDistributionAware.java b/src/main/java/com/biutag/supervision/support/ModelClueDistributionAware.java index 854487c..719eb16 100644 --- a/src/main/java/com/biutag/supervision/support/ModelClueDistributionAware.java +++ b/src/main/java/com/biutag/supervision/support/ModelClueDistributionAware.java @@ -51,7 +51,7 @@ public class ModelClueDistributionAware { log.info("新增模型【{}】分发任务", model.getModelName()); String expression = model.getDistributionCycleExpression(); if (StrUtil.isBlank(expression)) { - throw new RuntimeException("分发周期配置[expression]为空"); + return; } if (taskMap.containsKey(model.getId())) { remove(model.getId()); diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml index 506acbc..7c967c0 100644 --- a/src/main/resources/application-local.yml +++ b/src/main/resources/application-local.yml @@ -19,9 +19,9 @@ spring: port: 6379 password: 123456 -mybatis-plus: - configuration: - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl +#mybatis-plus: +# configuration: +# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl fdfs: tracker-list: #TrackerList参数,支持多个 diff --git a/src/main/resources/mapper/ProfilePoliceMapper.xml b/src/main/resources/mapper/ProfilePoliceMapper.xml index a13a5cd..12b9e6a 100644 --- a/src/main/resources/mapper/ProfilePoliceMapper.xml +++ b/src/main/resources/mapper/ProfilePoliceMapper.xml @@ -28,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND d.statistics_group_id = #{departGroupId} - AND pc.score > 0 + AND p.name like concat('%', #{name}, '%') diff --git a/src/test/java/com/biutag/supervision/tools/ExcelTest.java b/src/test/java/com/biutag/supervision/tools/ExcelTest.java new file mode 100644 index 0000000..dc24199 --- /dev/null +++ b/src/test/java/com/biutag/supervision/tools/ExcelTest.java @@ -0,0 +1,41 @@ +package com.biutag.supervision.tools; + +import cn.hutool.core.util.StrUtil; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelReader; +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.read.listener.ReadListener; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.biutag.supervision.pojo.dto.DataCaseVerifImportDto; +import com.biutag.supervision.pojo.entity.SupDepart; +import jakarta.validation.ConstraintViolation; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * @author wxc + * @date 2024/11/13 + */ +public class ExcelTest { + + public void test() throws FileNotFoundException { + File file = new File(""); + + ExcelReader excelReader = EasyExcel.read(new FileInputStream(file), HdtExcelDto.class, new ReadListener() { + @Override + public void invoke(DataCaseVerifImportDto data, AnalysisContext analysisContext) { + + + } + + @Override + public void doAfterAllAnalysed(AnalysisContext analysisContext) { + + } + }).build(); + } +} diff --git a/src/test/java/com/biutag/supervision/tools/GenCodeTests.java b/src/test/java/com/biutag/supervision/tools/GenCodeTests.java index f57ee08..b9769ae 100644 --- a/src/test/java/com/biutag/supervision/tools/GenCodeTests.java +++ b/src/test/java/com/biutag/supervision/tools/GenCodeTests.java @@ -25,7 +25,7 @@ public class GenCodeTests { @Test public void genEntity() throws TemplateException, IOException { - String tableName = "depart_score"; + String tableName = "risk_model_task_clue"; String tableSchema = "negative"; boolean genMapper = true; boolean genService = true; diff --git a/src/test/java/com/biutag/supervision/tools/HdtExcelDto.java b/src/test/java/com/biutag/supervision/tools/HdtExcelDto.java new file mode 100644 index 0000000..bf6a5f7 --- /dev/null +++ b/src/test/java/com/biutag/supervision/tools/HdtExcelDto.java @@ -0,0 +1,26 @@ +package com.biutag.supervision.tools; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.time.LocalDateTime; + +/** + * @author wxc + * @date 2024/11/13 + */ +@Setter +@Getter +public class HdtExcelDto { + + @ExcelProperty("姓名") + private String departId; + + @ExcelProperty("部门") + private String departName; + + @ExcelProperty("姓名") + private LocalDateTime discoveryTime; + +} From b29013fb41756b6b154a44315ad9cff6098ed4e0 Mon Sep 17 00:00:00 2001 From: sjh Date: Thu, 14 Nov 2024 13:45:44 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BF=AE=E6=94=B926=E3=80=8128=E5=8F=B7?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../supervision/service/ModelClueService.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/biutag/supervision/service/ModelClueService.java b/src/main/java/com/biutag/supervision/service/ModelClueService.java index 9c8c1aa..0e2f23f 100644 --- a/src/main/java/com/biutag/supervision/service/ModelClueService.java +++ b/src/main/java/com/biutag/supervision/service/ModelClueService.java @@ -486,23 +486,22 @@ public class ModelClueService extends ServiceImpl { + ",未录入反馈人员身份证信息。"); } else if (modelId == 26) { // 26号模型:执法办案场所进出时间过短 if (data.get("lksj") != null && !data.get("lksj").equals("")) { - modelClue.setThingDesc("发现执法场所人员“" + data.get("xm") - + "”(身份证号" + data.get("zjhm") - + "),于" + getDateMinuteString(data.get("jrsj")) - + "进入" + modelClue.getInvolveDepartName() - + "执法办案区,于" + getDateMinuteString(data.get("lksj")) - + "离开,停留时长" + calculateMinutesBetween(data.get("djsj"), data.get("lksj")) - + ",存在间隔时间过短的异常。"); + modelClue.setThingDesc("发现" + modelClue.getInvolveDepartName() + "办理的被处以刑事打处的嫌疑人员“" + + data.get("xm") + "”(身份证号" + data.get("zjhm") + + "),其于" + getDateMinuteString(data.get("jrsj")) + + "登记进入" + modelClue.getInvolveDepartName() + + "执法办案区,但仅停留" + calculateMinutesBetween(data.get("djsj"), data.get("lksj")) + + "后便予以离开,少于3小时,与正常开展流程办理刑事案件所需时长相违背,存在疑似不如实登记执法办案场所的异常问题。"); } } else if (modelId == 27) { // 27号模型:盗窃车内财物警情结警性质变动的异常数据 modelClue.setThingDesc("发现" + modelClue.getInvolveDepartName() + "受理的接警单" + modelClue.getUniqueKey() + ",报警日期为" + getDateMinuteString(data.get("bjsj")) + ",接警性质为“" + data.get("ysjqxzmc") + "”,结警性质为“" + data.get("jqxzmc") + ",存在盗窃车内财物警情结警性质变动的异常情况。"); - } else if (modelId == 28) { // 28号模型:盗窃车内财物超过5000元的数据 + } else if (modelId == 28) { // 28号模型:盗窃车内财物超过2000元的数据 modelClue.setThingDesc("发现" + modelClue.getInvolveDepartName() + "受理的接警单" + modelClue.getUniqueKey() + ",报警日期为" + getDateMinuteString(data.get("bjsj")) - + ",接警性质为“" + data.get("ysjqxzmc") + "”,金额超过5000元。报警内容为:“" + data.get("bjnr") + + ",接警性质为“" + data.get("ysjqxzmc") + "”,金额超过2000元。报警内容为:“" + data.get("bjnr") + "”。"); } else if (modelId == 29) { // 29号模型:案件降格处理的异常数据 modelClue.setThingDesc("发现" + modelClue.getInvolveDepartName() + "受理的接警单" @@ -894,9 +893,13 @@ public class ModelClueService extends ServiceImpl { } newModelClue.setData(JSONObject.toJSONString(map)); newModelClue.setDistributionState("0"); + Long count = (Long) map.get("num"); + BigDecimal result = BigDecimal.valueOf(count).divide(BigDecimal.valueOf(250), 3, RoundingMode.HALF_UP); newModelClue.setThingDesc( - "灵敏感知系统发现" + newModelClue.getInvolveDepartName() + "民警" + xzdzrr - + "的管控人数为" + map.get("num") + "人。"); + "发现" + newModelClue.getInvolveDepartName() + "民警" + xzdzrr + + ",其在重点人员管控系统中的管控人数为" + count + + "人,即使每个重点人员只见一次,其工作日(采取每年250天)必须每日完成管控" + + result +"个。"); modelClues.add(newModelClue); } } From a661185f5e3a151a0bb81838f94d1964b2c55d9b Mon Sep 17 00:00:00 2001 From: wxc <191104855@qq.com> Date: Thu, 14 Nov 2024 13:47:25 +0800 Subject: [PATCH 3/7] =?UTF-8?q?fit:=20=E4=B8=AA=E4=BA=BA=E6=9E=81=E7=AB=AF?= =?UTF-8?q?=E8=B5=8B=E5=88=86=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RiskClueController.java | 55 ++++++++++++ .../mapper/RiskModelTaskClueMapper.java | 8 ++ .../mapper/RiskScoreRuleMapper.java | 8 ++ .../pojo/entity/RiskModelTaskClue.java | 85 ++++++++++++++++++ .../pojo/entity/RiskScoreRule.java | 56 ++++++++++++ .../param/RiskModelTaskClueQueryParam.java | 29 ++++++ .../biutag/supervision/pojo/vo/MenuTree.java | 2 +- .../service/RiskModelTaskClueService.java | 11 +++ .../service/RiskScoreRuleService.java | 50 +++++++++++ ...系风险赋分及预警处置机制.doc | Bin 0 -> 84480 bytes 10 files changed, 303 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/biutag/supervision/controller/sensitivePerception/RiskClueController.java create mode 100644 src/main/java/com/biutag/supervision/mapper/RiskModelTaskClueMapper.java create mode 100644 src/main/java/com/biutag/supervision/mapper/RiskScoreRuleMapper.java create mode 100644 src/main/java/com/biutag/supervision/pojo/entity/RiskModelTaskClue.java create mode 100644 src/main/java/com/biutag/supervision/pojo/entity/RiskScoreRule.java create mode 100644 src/main/java/com/biutag/supervision/pojo/param/RiskModelTaskClueQueryParam.java create mode 100644 src/main/java/com/biutag/supervision/service/RiskModelTaskClueService.java create mode 100644 src/main/java/com/biutag/supervision/service/RiskScoreRuleService.java create mode 100644 src/main/resources/static/templates/【工作机制】个人极端暴力风险数字督察灵敏感知体系风险赋分及预警处置机制.doc diff --git a/src/main/java/com/biutag/supervision/controller/sensitivePerception/RiskClueController.java b/src/main/java/com/biutag/supervision/controller/sensitivePerception/RiskClueController.java new file mode 100644 index 0000000..f80d0ec --- /dev/null +++ b/src/main/java/com/biutag/supervision/controller/sensitivePerception/RiskClueController.java @@ -0,0 +1,55 @@ +package com.biutag.supervision.controller.sensitivePerception; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.biutag.supervision.pojo.Result; +import com.biutag.supervision.pojo.entity.Model; +import com.biutag.supervision.pojo.entity.RiskModelTaskClue; +import com.biutag.supervision.pojo.param.RiskModelTaskClueQueryParam; +import com.biutag.supervision.service.ModelService; +import com.biutag.supervision.service.RiskModelTaskClueService; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author wxc + * @date 2024/11/14 + */ +@RequiredArgsConstructor +@RequestMapping("risk/clues") +@RestController +public class RiskClueController { + + private final RiskModelTaskClueService riskModelTaskClueService; + + private final ModelService modelService; + + @GetMapping + public Result> page(RiskModelTaskClueQueryParam param) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + if (Objects.nonNull(param.getRiskScoreRuleId()) && !param.getRiskScoreRuleId().isEmpty()) { + List models = modelService.list(new LambdaQueryWrapper().in(Model::getRiskScoreRuleId, param.getRiskScoreRuleId())); + if (models.isEmpty()) { + return Result.success(new Page().setRecords(new ArrayList<>()).setTotal(0)); + } + queryWrapper.in(RiskModelTaskClue::getModelId, models.stream().map(Model::getId).collect(Collectors.toSet())); + } + if (Objects.nonNull(param.getEventTime()) && param.getEventTime().size() == 2) { + queryWrapper.between(RiskModelTaskClue::getEventTime, param.getEventTime().get(0), param.getEventTime().get(1)); + } + queryWrapper.like(StrUtil.isNotBlank(param.getName()), RiskModelTaskClue::getName, param.getName()) + .like(StrUtil.isNotBlank(param.getIdCode()), RiskModelTaskClue::getIdCode, param.getIdCode()) + .like(StrUtil.isNotBlank(param.getThingDesc()), RiskModelTaskClue::getThingDesc, param.getThingDesc()); + queryWrapper.orderByDesc(RiskModelTaskClue::getCreateTime); + return Result.success(riskModelTaskClueService.page(Page.of(param.getCurrent(), param.getSize()), queryWrapper)); + } + +} diff --git a/src/main/java/com/biutag/supervision/mapper/RiskModelTaskClueMapper.java b/src/main/java/com/biutag/supervision/mapper/RiskModelTaskClueMapper.java new file mode 100644 index 0000000..7d91b05 --- /dev/null +++ b/src/main/java/com/biutag/supervision/mapper/RiskModelTaskClueMapper.java @@ -0,0 +1,8 @@ +package com.biutag.supervision.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.supervision.pojo.entity.RiskModelTaskClue; + +public interface RiskModelTaskClueMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/mapper/RiskScoreRuleMapper.java b/src/main/java/com/biutag/supervision/mapper/RiskScoreRuleMapper.java new file mode 100644 index 0000000..3ddb5c3 --- /dev/null +++ b/src/main/java/com/biutag/supervision/mapper/RiskScoreRuleMapper.java @@ -0,0 +1,8 @@ +package com.biutag.supervision.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.supervision.pojo.entity.RiskScoreRule; + +public interface RiskScoreRuleMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/entity/RiskModelTaskClue.java b/src/main/java/com/biutag/supervision/pojo/entity/RiskModelTaskClue.java new file mode 100644 index 0000000..3dbdd7c --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/entity/RiskModelTaskClue.java @@ -0,0 +1,85 @@ +package com.biutag.supervision.pojo.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Getter; +import lombok.Setter; + +import java.time.LocalDateTime; + +@Setter +@Getter +public class RiskModelTaskClue { + + // 主键 + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + // 模型id + @TableField("model_id") + private Integer modelId; + + // 姓名 + @TableField("name") + private String name; + + // 证件号码 + @TableField("id_code") + private String idCode; + + // 预警内容 + @TableField("thing_desc") + private String thingDesc; + + // 状态 默认 0-未分发 1-已分发 2-已处理 + @TableField("distribution_state") + private Boolean distributionState; + + // 任务ID + @TableField("task_id") + private Integer taskId; + + // 问题id + @TableField("negative_id") + private String negativeId; + + // 原始id + @TableField("source_id") + private String sourceId; + + // 案件id,“,”分割 + @TableField("case_ids") + private String caseIds; + + // 风险原因 + @TableField("risk_reason") + private String riskReason; + + // 数据详情 JSON + @TableField("data") + private String data; + + // 分数 + @TableField("score") + private Integer score; + + // 发生时间 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @TableField("event_time") + private LocalDateTime eventTime; + + // 创建时间 + @TableField("create_time") + private LocalDateTime createTime; + + // 修改时间 + @TableField("update_time") + private LocalDateTime updateTime; + + // 逻辑删除键0-未删1已删 + @TableField("del") + private Boolean del; + +} \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/entity/RiskScoreRule.java b/src/main/java/com/biutag/supervision/pojo/entity/RiskScoreRule.java new file mode 100644 index 0000000..289254f --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/entity/RiskScoreRule.java @@ -0,0 +1,56 @@ +package com.biutag.supervision.pojo.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Getter; +import lombok.Setter; + +import java.time.LocalDateTime; + +@Setter +@Getter +public class RiskScoreRule { + + // + @TableId(type = IdType.AUTO) + private Integer id; + + // + @TableField("pid") + private Integer pid; + + // 风险因素 + @TableField("risk_name") + private String riskName; + + // 分值 + @TableField("score") + private String score; + + // 规则描述 + @TableField("rule_desc") + private String ruleDesc; + + // 权重 + @TableField("weight") + private Integer weight; + + // 状态 + @TableField("status") + private Boolean status; + + // 更新时间 + @TableField("update_time") + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm") + private LocalDateTime updateTime; + + // 创建时间 + @TableField("create_time") + private LocalDateTime createTime; + + private Integer sortId; + +} \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/param/RiskModelTaskClueQueryParam.java b/src/main/java/com/biutag/supervision/pojo/param/RiskModelTaskClueQueryParam.java new file mode 100644 index 0000000..4c16034 --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/param/RiskModelTaskClueQueryParam.java @@ -0,0 +1,29 @@ +package com.biutag.supervision.pojo.param; + +import lombok.Getter; +import lombok.Setter; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * @author wxc + * @date 2024/11/14 + */ +@Setter +@Getter +public class RiskModelTaskClueQueryParam extends BasePage { + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private List eventTime = new ArrayList<>(); + + private String name; + + private String idCode; + + private String thingDesc; + + private List riskScoreRuleId = new ArrayList<>(); +} diff --git a/src/main/java/com/biutag/supervision/pojo/vo/MenuTree.java b/src/main/java/com/biutag/supervision/pojo/vo/MenuTree.java index ffb622b..9df8593 100644 --- a/src/main/java/com/biutag/supervision/pojo/vo/MenuTree.java +++ b/src/main/java/com/biutag/supervision/pojo/vo/MenuTree.java @@ -46,7 +46,7 @@ public class MenuTree { // 是否打开新页面 默认为false private Boolean openNewPage; - @JsonFormat(pattern = "YYYY-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime updateTime; private List children; diff --git a/src/main/java/com/biutag/supervision/service/RiskModelTaskClueService.java b/src/main/java/com/biutag/supervision/service/RiskModelTaskClueService.java new file mode 100644 index 0000000..6922335 --- /dev/null +++ b/src/main/java/com/biutag/supervision/service/RiskModelTaskClueService.java @@ -0,0 +1,11 @@ +package com.biutag.supervision.service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.biutag.supervision.pojo.entity.RiskModelTaskClue; +import com.biutag.supervision.mapper.RiskModelTaskClueMapper; +import org.springframework.stereotype.Service; + +@Service +public class RiskModelTaskClueService extends ServiceImpl { + +} diff --git a/src/main/java/com/biutag/supervision/service/RiskScoreRuleService.java b/src/main/java/com/biutag/supervision/service/RiskScoreRuleService.java new file mode 100644 index 0000000..a8fb130 --- /dev/null +++ b/src/main/java/com/biutag/supervision/service/RiskScoreRuleService.java @@ -0,0 +1,50 @@ +package com.biutag.supervision.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.biutag.supervision.constants.AppConstants; +import com.biutag.supervision.mapper.RiskScoreRuleMapper; +import com.biutag.supervision.pojo.entity.RiskScoreRule; +import com.biutag.supervision.pojo.vo.RiskScoreRuleTree; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class RiskScoreRuleService extends ServiceImpl { + + public List buildTree() { + List scoreRules = list(new LambdaQueryWrapper().orderByAsc(RiskScoreRule::getSortId)); + Map> childMap = new HashMap<>(); + List tree = new ArrayList<>(); + for (RiskScoreRule rule: scoreRules) { + RiskScoreRuleTree node = new RiskScoreRuleTree(); + BeanUtils.copyProperties(rule, node); + List children = childMap.computeIfAbsent(node.getPid(), k -> new ArrayList<>()); + children.add(node); + Integer pid = node.getPid(); + if (AppConstants.TREE_ROOT_ID.equals(pid)) { + tree.add(node); + } + } + for (RiskScoreRuleTree node : tree) { + buildTreeRecursive(node, childMap); + } + return tree; + } + + private static RiskScoreRuleTree buildTreeRecursive(RiskScoreRuleTree node, Map> childMap) { + List children = childMap.get(node.getId()); + if (children != null) { + node.getChildren().addAll(children.stream() + .map(childNode -> buildTreeRecursive(childNode, childMap)) + .toList()); + } + return node; + } + +} diff --git a/src/main/resources/static/templates/【工作机制】个人极端暴力风险数字督察灵敏感知体系风险赋分及预警处置机制.doc b/src/main/resources/static/templates/【工作机制】个人极端暴力风险数字督察灵敏感知体系风险赋分及预警处置机制.doc new file mode 100644 index 0000000000000000000000000000000000000000..851ede3cda099b3869f5a037d0aae77dc46392d2 GIT binary patch literal 84480 zcmeHQ2Vjin8-MRExeN&rL?p(EAV}h}BUVUC1eYlhiR?upAsBJ@4T& zh32LnXC`$@V^04xwILrIDlveJ3oFAZtFEv=0sDSXEli=JYV+(wV26J>3LptZyUxoBH*}ojPJLu`K3!E;w9Z=c#oP1w;luIq z@hV?_-kr>jXzn{u9urvd@zkbPkEgo%x&>pUeB?^;DOo+2mQSDPt^Dxzq`JYuwJBrP z${zlveiY)Pho=)?-?pFLcq7>P3<*ZX!`t)uiA6Yl-Vy3a(1Gghx5&Q~D%C%FQY!s@ zg?c~_AD+zQpHE-m_!55jboi)veo;D+=mz-opQZBQYg20r&(}v@tt~un&&R`?Yg2iD z)m5I()$OaB`FMFgR#%_pUfuu8GV}bZp5JGg`TVM@))p_x=4b=Pd?6IvQ0ujsF@E*5 zw9tcSp4XiMxwGddC;JtK4vz~CjTw19G;_F5T#Km7BLjT?7+Z(6mu->dC)^tIY5cqX zhvp5L(|4NKzdWE|UVM>ONJ_3-g0sINGi03-Q(`ENpNjRR>3-8?iGI;@SH_%~!Nr>r zL-7`5>BRgQS}$rxVI8SJsxMWJ*(iD?v3M|xRS9`IA~ zAiv`wlu}bkXW2^s_@X8L0%^fK`#Gd*CMn4JJuBVsr{c8S{KB5e268vqFT>*eI!?=u z=vuHabmF`}Ln-WHf42y)#Cx(J|KbD#dB>22p$~(5hCK{+A9ZQscFf`HckFkyYbzq$I4^@J|+R_;kN^tNyz^e z*}%Ye!fj*)Sz3YFW65M7r`(u@+|A+RBhCq>ZnBh7=X{8#6n{b1(b4gtZ6l`!Ci|s_ zw~aKA-wpaEhv;!3NHR_!{iWz=0H^CW*-ggjmSnGpAzhzrvyk?(yE*TJPo<&1XO)B( zWKmj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i!p>gmWN%|b@BfjW97lEbs_tQsSY~`GZ7&4rUDnl7M7j7?1*_0>gn3KpKz^WB{2!7C>tl zbOeRs8v`{PptYBAKn{=#cwhoh0K5%M1SSEKfkI#kPy|c`rU4Y^45-DxOkfu9 z4p0Kj2FQIb)Oo;spcHr)ptYU%0CNAU5=$!0WJl0Eua*LIa5EJ(M}nH40yPbXGSzuZ zn6`k=G070I9!V4K%nuZ5N{=63w@o+b9LzG<fZUXr9-W0{;X1)KO0W literal 0 HcmV?d00001 From ed418f6513a1cf90bef2345e7f7a3eaf0cc2a875 Mon Sep 17 00:00:00 2001 From: sjh Date: Thu, 14 Nov 2024 15:41:56 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BF=AE=E6=94=B926=E5=8F=B7=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../supervision/service/ModelClueService.java | 71 ++++++++++++++----- 1 file changed, 55 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/biutag/supervision/service/ModelClueService.java b/src/main/java/com/biutag/supervision/service/ModelClueService.java index 0e2f23f..a970aa2 100644 --- a/src/main/java/com/biutag/supervision/service/ModelClueService.java +++ b/src/main/java/com/biutag/supervision/service/ModelClueService.java @@ -24,10 +24,7 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.sql.Timestamp; import java.text.SimpleDateFormat; -import java.time.Instant; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.ZoneId; +import java.time.*; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; import java.util.*; @@ -252,7 +249,7 @@ public class ModelClueService extends ServiceImpl { List uniqueKeys = modelClues.stream().map(ModelClue::getUniqueKey).filter(k -> k != null && !k.isEmpty()).toList(); List oldUniqueKeys = new ArrayList<>(); // 无需更新状态的模型 - if (modelId != 19 && modelId != 27 && modelId != 28 && modelId != 30) { + if (modelId != 19 && modelId != 26 && modelId != 27 && modelId != 28 && modelId != 30) { oldUniqueKeys = this.listObjs(new LambdaQueryWrapper().select(ModelClue::getUniqueKey).ne(ModelClue::getDistributionState, "2").eq(ModelClue::getModelId, modelId), String::valueOf); List changeStatusIds = oldUniqueKeys.stream().filter(item -> !uniqueKeys.contains(item)).toList(); if (!changeStatusIds.isEmpty()) { @@ -273,32 +270,26 @@ public class ModelClueService extends ServiceImpl { return new ArrayList<>(); } List needsInsertModelClues = modelClues.stream().filter(item -> needsInsertIds.contains(item.getUniqueKey())).toList(); - System.out.println("needsInsertModelClues:" + needsInsertModelClues.size()); String newSql = generateNewSql(sql, needsInsertIds, modelId); System.out.println("开始查询新sql" + newSql); List> allData = modelClueDataMapper.selectByUniqueKeys(newSql); + if (modelId == 26) { + filterDataForModel26(allData); + } System.out.println("查询新sql完成,结果数量:" + allData.size()); String originalFieldName = getKeyFieldName(sql); - System.out.println("originalFieldName:" + originalFieldName); for (ModelClue modelClue : needsInsertModelClues) { for (Map data : allData) { String keyColumn = (String) data.get(originalFieldName); - System.out.println("测试1:" + keyColumn + "测试" + modelClue.getUniqueKey()); if (Objects.equals(keyColumn, modelClue.getUniqueKey())) { - System.out.println("测试2"); modelClue.setData(JSONObject.toJSONString(data)); modelClue.setDistributionState("0"); - System.out.println("测试3"); SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper().eq(SupExternalDepart::getExternalId, modelClue.getInvolveDepartId()).last("LIMIT 1")); - System.out.println("测试4"+modelClue.getInvolveDepartId()); if (supExternalDepart != null && supExternalDepart.getInternalShortName() != null && !supExternalDepart.getInternalShortName().isEmpty()) { - System.out.println("测试5"); modelClue.setInvolveDepartName(supExternalDepart.getInternalShortName()); modelClue.setInvolveDepartId(supExternalDepart.getInternalId()); } - System.out.println("测试6"); setPerson(modelId, modelClue, data); - System.out.println("测试7"); generateThingDesc(modelId, modelClue, data); System.out.println("测试8"); break; @@ -308,6 +299,54 @@ public class ModelClueService extends ServiceImpl { return needsInsertModelClues; } + private static void filterDataForModel26(List> allData) { + List> filteredData = allData.stream().filter(map -> map.get("ajbh") != null).toList(); + Map>> groupedData = filteredData.stream().collect(Collectors.groupingBy(map -> (String) map.get("ajbh"))); + allData.clear(); + for (Map.Entry>> entry : groupedData.entrySet()) { + String ajbh = entry.getKey(); + List> records = entry.getValue(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); + String earliestJRSJ = null; + LocalDateTime earliestDateTime = LocalDateTime.MIN; + for (Map record : records) { + String jrsj = (String) record.get("jrsj"); + LocalDateTime dateTime = LocalDateTime.parse(jrsj, formatter); + if (earliestJRSJ == null || !dateTime.isAfter(earliestDateTime)) { + earliestJRSJ = jrsj; + earliestDateTime = dateTime; + } + } + String latestLKSJ = null; + LocalDateTime latestDateTime = LocalDateTime.MIN; + for (Map record : records) { + String lksj = (String) record.get("lksj"); + LocalDateTime dateTime = LocalDateTime.parse(lksj, formatter); + if (latestLKSJ == null || dateTime.isAfter(latestDateTime)) { + latestLKSJ = lksj; + latestDateTime = dateTime; + } + } + if (earliestJRSJ != null && latestLKSJ != null) { + Duration duration = Duration.between(earliestDateTime, latestDateTime); + if (duration.toHours() < 3) { + continue; + } + Map newRecord = new HashMap<>(); + newRecord.put("ajbh", ajbh); + newRecord.put("jrsj", earliestJRSJ); + newRecord.put("lksj", latestLKSJ); + for (String key : records.get(0).keySet()) { + if (!key.equals("jrsj") && !key.equals("lksj")) { + newRecord.put(key, records.get(0).get(key)); + } + } + allData.add(newRecord); + } + } + System.out.println("模型26筛选后的alldata数量:" + allData.size()); + } + private void setPerson(Integer modelId, ModelClue modelClue, Map data) { // 执法区域人员表 if (modelId == 3) { @@ -487,10 +526,10 @@ public class ModelClueService extends ServiceImpl { } else if (modelId == 26) { // 26号模型:执法办案场所进出时间过短 if (data.get("lksj") != null && !data.get("lksj").equals("")) { modelClue.setThingDesc("发现" + modelClue.getInvolveDepartName() + "办理的被处以刑事打处的嫌疑人员“" - + data.get("xm") + "”(身份证号" + data.get("zjhm") + + data.get("xm") + "”(身份证号:" + data.get("zjhm") + "),其于" + getDateMinuteString(data.get("jrsj")) + "登记进入" + modelClue.getInvolveDepartName() - + "执法办案区,但仅停留" + calculateMinutesBetween(data.get("djsj"), data.get("lksj")) + + "执法办案区,但仅停留" + calculateMinutesBetween(data.get("jrsj"), data.get("lksj")) + "后便予以离开,少于3小时,与正常开展流程办理刑事案件所需时长相违背,存在疑似不如实登记执法办案场所的异常问题。"); } } else if (modelId == 27) { // 27号模型:盗窃车内财物警情结警性质变动的异常数据 From 93937cb99171d92d657ef383144b58b4c9cb9f48 Mon Sep 17 00:00:00 2001 From: sjh Date: Thu, 14 Nov 2024 17:10:59 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E6=96=B0=E5=A2=9E100=E5=8F=B7=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=EF=BC=9A=E6=95=A3=E6=B2=B9=E5=AE=9E=E6=97=B6=E9=A2=84?= =?UTF-8?q?=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../supervision/service/ModelClueService.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/biutag/supervision/service/ModelClueService.java b/src/main/java/com/biutag/supervision/service/ModelClueService.java index a970aa2..e4dba55 100644 --- a/src/main/java/com/biutag/supervision/service/ModelClueService.java +++ b/src/main/java/com/biutag/supervision/service/ModelClueService.java @@ -249,7 +249,7 @@ public class ModelClueService extends ServiceImpl { List uniqueKeys = modelClues.stream().map(ModelClue::getUniqueKey).filter(k -> k != null && !k.isEmpty()).toList(); List oldUniqueKeys = new ArrayList<>(); // 无需更新状态的模型 - if (modelId != 19 && modelId != 26 && modelId != 27 && modelId != 28 && modelId != 30) { + if (modelId != 19 && modelId != 26 && modelId != 27 && modelId != 28 && modelId != 30 && modelId != 100) { oldUniqueKeys = this.listObjs(new LambdaQueryWrapper().select(ModelClue::getUniqueKey).ne(ModelClue::getDistributionState, "2").eq(ModelClue::getModelId, modelId), String::valueOf); List changeStatusIds = oldUniqueKeys.stream().filter(item -> !uniqueKeys.contains(item)).toList(); if (!changeStatusIds.isEmpty()) { @@ -556,6 +556,14 @@ public class ModelClueService extends ServiceImpl { "发现" + modelClue.getInvolveDepartName() + "受理的“" + data.get("AJMC") + "”(【" + data.get("AJBZmc") + "】编号:" + getAjbh(data) + "),未扣押任何财物,存在疑似涉案财物未按要求录入的问题。"); + } else if (modelId == 100) { // 100号模型:散油实时预警 + modelClue.setInvolvePoliceName((String) data.get("gmrxm")); + modelClue.setThingDesc( + "发现" + data.get("gmrxm") + "(身份证号:" + data.get("zjhm") + ")于" + + getDateMinuteString(data.get("gmsj")) + "在" + + data.get("fjmc") + modelClue.getInvolveDepartName() + "管辖的" + data.get("dwmc") + + "购买了" + data.get("gmsl") + "升" + data.get("jplx") + data.get("gmyt") + + ",产生了" + data.get("yjlx") + ",请予以重点关注。"); } } @@ -1112,7 +1120,18 @@ public class ModelClueService extends ServiceImpl { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日HH时mm分"); return formatter.format(localDateTime); } catch (Exception exx) { - log.info("日期转换异常{}", time, ex); + try { + time = String.valueOf(param); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date parse = sdf.parse(time); + Instant instant = parse.toInstant(); + ZoneId zoneId = ZoneId.systemDefault(); + LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日HH时mm分"); + return formatter.format(localDateTime); + } catch (Exception exxx) { + log.info("日期转换异常{}", time, ex); + } } } } From c1517620427e96510e4555b6c27fb5a32fa738d4 Mon Sep 17 00:00:00 2001 From: wxc <191104855@qq.com> Date: Thu, 14 Nov 2024 17:31:36 +0800 Subject: [PATCH 6/7] =?UTF-8?q?fit:=20=E4=B8=AA=E4=BA=BA=E6=9E=81=E7=AB=AF?= =?UTF-8?q?=E8=B5=8B=E5=88=86=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProfileDepartController.java | 43 ++++------ .../ProfilePoliceController.java | 86 +++++++++---------- .../RiskPersonalController.java | 7 ++ .../RiskScoreRuleController.java | 11 +++ .../sensitivePerception/ScoreController.java | 15 +++- .../supervision/pojo/domain/NegativeInfo.java | 9 +- .../pojo/domain/ProfilePolice.java | 7 +- .../pojo/domain/RiskPersonalDetail.java | 17 ++++ .../pojo/entity/RiskScoreRule.java | 2 + .../service/NegativeScoreService.java | 6 +- 10 files changed, 123 insertions(+), 80 deletions(-) create mode 100644 src/main/java/com/biutag/supervision/pojo/domain/RiskPersonalDetail.java diff --git a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfileDepartController.java b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfileDepartController.java index ff6fe53..9f561b3 100644 --- a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfileDepartController.java +++ b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfileDepartController.java @@ -63,6 +63,8 @@ public class ProfileDepartController { return Result.success(page); } + private final NegativeScoreDepartService negativeScoreDepartService; + @GetMapping("{departId}") public Result profile(@PathVariable String departId, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date beginTime, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime) { if (Objects.isNull(beginTime)) { @@ -80,10 +82,11 @@ public class ProfileDepartController { profileDepart.getDepartInfo().setMainRole(polices.stream().filter(item -> "正职".equals(item.getPosition())).findFirst().map(SupPolice::getName).orElse(null)); profileDepart.getDepartInfo().setDeputyRole(polices.stream().filter(item -> "副职".equals(item.getPosition())).map(SupPolice::getName).toList()); - List list = negativeService.list(new LambdaQueryWrapper().eq(Negative::getInvolveDepartId, departId) - .between(Negative::getDiscoveryTime, beginTime, endTime) - .in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))); - List negativeIds = list.stream().map(Negative::getId).toList(); + List list = negativeScoreDepartService.list(new LambdaQueryWrapper() + .eq(NegativeScoreDepart::getDepartId, departId) + .between(NegativeScoreDepart::getDiscoveryTime, beginTime, endTime)); + + List negativeIds = list.stream().map(NegativeScoreDepart::getNegativeId).toList(); int negativePoliceSize = negativeIds.isEmpty() ? 0 : profileDepartMapper.countByNegativeIdsAndPersonTypes(negativeIds, List.of(PersonTypeEnum.police.getValue())); profileDepart.getDepartInfo().setNegativePoliceSize(negativePoliceSize); int negativeAuxSize = negativeIds.isEmpty() ? 0 : profileDepartMapper.countByNegativeIdsAndPersonTypes(negativeIds, List.of(PersonTypeEnum.aux.getValue(), PersonTypeEnum.xj.getValue())); @@ -96,42 +99,32 @@ public class ProfileDepartController { .eq(BusinessDepart::getBusinessType, BusinessTypeEnum.JCJ_110.getValue()) .eq(BusinessDepart::getDepartId, departId)) .stream().mapToInt(BusinessDepart::getNumber).sum(); - int jcj110Size = negativeService.list(new LambdaQueryWrapper() - .between(Negative::getDiscoveryTime, beginTime, endTime) - .eq(Negative::getBusinessTypeCode, BusinessTypeEnum.JCJ_110.getValue()) - .eq(Negative::getInvolveDepartId, departId) - .in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))).size(); + int jcj122BusinessSize = businessDepartService.list(new LambdaQueryWrapper() .between(BusinessDepart::getDate, beginTime, endTime) .eq(BusinessDepart::getBusinessType, BusinessTypeEnum.JCJ_122.getValue()) .eq(BusinessDepart::getDepartId, departId)) .stream().mapToInt(BusinessDepart::getNumber).sum(); - int jcj122Size = negativeService.list(new LambdaQueryWrapper() - .between(Negative::getDiscoveryTime, beginTime, endTime) - .eq(Negative::getBusinessTypeCode, BusinessTypeEnum.JCJ_122.getValue()) - .eq(Negative::getInvolveDepartId, departId) - .in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))).size(); - int zfbaBusinessSize = businessDepartService.list(new LambdaQueryWrapper() .between(BusinessDepart::getDate, beginTime, endTime) .eq(BusinessDepart::getBusinessType, BusinessTypeEnum.ZFBA.getValue()) .eq(BusinessDepart::getDepartId, departId)) .stream().mapToInt(BusinessDepart::getNumber).sum(); - int zfbaSize = negativeService.list(new LambdaQueryWrapper() - .between(Negative::getDiscoveryTime, beginTime, endTime) - .eq(Negative::getBusinessTypeCode, BusinessTypeEnum.ZFBA.getValue()) - .eq(Negative::getInvolveDepartId, departId) - .in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))).size(); - profileDepart.getNegativeInfo().setJcj110Size(jcj110Size).setJcj110BusinessSize(jcj110BusinessSize) - .setJcj122Size(jcj122Size) + + profileDepart.getNegativeInfo() + .setJcj110Size(list.stream().filter(item -> BusinessTypeEnum.JCJ_110.getValue().equals(item.getBusinessTypeCode())).count()) + .setJcj110BusinessSize(jcj110BusinessSize) + .setJcj122Size(list.stream().filter(item -> BusinessTypeEnum.JCJ_122.getValue().equals(item.getBusinessTypeCode())).count()) .setJcj122BusinessSize(jcj122BusinessSize) - .setZfbaBusinessSize(zfbaBusinessSize).setZfbaSize(zfbaSize); + .setZfbaBusinessSize(zfbaBusinessSize) + .setZfbaSize(list.stream().filter(item -> BusinessTypeEnum.ZFBA.getValue().equals(item.getBusinessTypeCode())).count()); + List negatives = negativeService.listByIds(negativeIds); // 问题来源占比 - Map> problemSourcesGroup = list.stream().collect(Collectors.groupingBy(Negative::getProblemSourcesCode)); + Map> problemSourcesGroup = negatives.stream().collect(Collectors.groupingBy(Negative::getProblemSourcesCode)); List problemSourcesList = problemSourcesGroup.keySet().stream().map(key -> new PieItem(Optional.ofNullable(ProblemSourcesEnum.get(key)).map(ProblemSourcesEnum::getLabel).orElse(key), problemSourcesGroup.get(key).size())).toList(); profileDepart.setProblemSourcesList(problemSourcesList); // 业务类型占比 - Map> businessTypeGroup = list.stream().collect(Collectors.groupingBy(Negative::getBusinessTypeCode)); + Map> businessTypeGroup = negatives.stream().collect(Collectors.groupingBy(Negative::getBusinessTypeCode)); List businessTypeList = businessTypeGroup.keySet().stream().map(key -> new PieItem(Optional.ofNullable(BusinessTypeEnum.get(key)).map(BusinessTypeEnum::getLabel).orElse(key), businessTypeGroup.get(key).size())).toList(); profileDepart.setBusinessTypeList(businessTypeList); diff --git a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java index abfd15d..b31bdda 100644 --- a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java +++ b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java @@ -1,6 +1,7 @@ package com.biutag.supervision.controller.sensitivePerception; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.NumberUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -13,9 +14,7 @@ import com.biutag.supervision.pojo.domain.ProfileDepart; import com.biutag.supervision.pojo.domain.ProfilePolice; import com.biutag.supervision.pojo.dto.common.BarItem; import com.biutag.supervision.pojo.dto.common.PieItem; -import com.biutag.supervision.pojo.entity.BusinessPolice; -import com.biutag.supervision.pojo.entity.Negative; -import com.biutag.supervision.pojo.entity.NegativeBlame; +import com.biutag.supervision.pojo.entity.*; import com.biutag.supervision.pojo.model.PoliceNegativeModel; import com.biutag.supervision.pojo.param.DepartPoliceQueryParam; import com.biutag.supervision.service.*; @@ -66,6 +65,9 @@ public class ProfilePoliceController { return Result.success(page); } + private final NegativeScorePoliceService negativeScorePoliceService; + private final NegativeProblemRelationService negativeProblemRelationService; + @GetMapping("{idCode}") public Result profile(@PathVariable String idCode, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date beginTime, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime) { if (Objects.isNull(beginTime)) { @@ -77,6 +79,8 @@ public class ProfilePoliceController { ProfilePolice profilePolice = new ProfilePolice(); profilePolice.setPoliceInfo(policeService.getByIdCode(idCode)); + List negatives = negativeScorePoliceService.list(new LambdaQueryWrapper().between(NegativeScorePolice::getDiscoveryTime, beginTime, endTime).eq(NegativeScorePolice::getIdCode, idCode)); + int jcj110BusinessSize = businessPoliceService.list(new LambdaQueryWrapper() .between(BusinessPolice::getDate, beginTime, endTime) .eq(BusinessPolice::getBusinessType, BusinessTypeEnum.JCJ_110.getValue()) @@ -84,12 +88,6 @@ public class ProfilePoliceController { .eq(BusinessPolice::getPoliceName, profilePolice.getPoliceInfo().getName())) .stream().mapToInt(BusinessPolice::getNumber).sum(); - Set negativeIds = negativeBlameService.list(new LambdaQueryWrapper().eq(NegativeBlame::getBlameIdCode, idCode)).stream().map(NegativeBlame::getNegativeId).collect(Collectors.toSet()); - int jcj110Size = negativeIds.isEmpty() ? 0 : negativeService.list(new LambdaQueryWrapper() - .between(Negative::getDiscoveryTime, beginTime, endTime) - .eq(Negative::getBusinessTypeCode, BusinessTypeEnum.JCJ_110.getValue()) - .in(Negative::getId, negativeIds) - .in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))).size(); int jcj122BusinessSize = businessPoliceService.list(new LambdaQueryWrapper() .between(BusinessPolice::getDate, beginTime, endTime) .eq(BusinessPolice::getBusinessType, BusinessTypeEnum.JCJ_122.getValue()) @@ -97,11 +95,6 @@ public class ProfilePoliceController { .eq(BusinessPolice::getPoliceName, profilePolice.getPoliceInfo().getName())) .stream().mapToInt(BusinessPolice::getNumber).sum(); - int jcj122Size = negativeIds.isEmpty() ? 0 : negativeService.list(new LambdaQueryWrapper() - .between(Negative::getDiscoveryTime, beginTime, endTime) - .eq(Negative::getBusinessTypeCode, BusinessTypeEnum.JCJ_122.getValue()) - .in(Negative::getId, negativeIds) - .in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))).size(); int zfbaBusinessSize = businessPoliceService.list(new LambdaQueryWrapper() .between(BusinessPolice::getDate, beginTime, endTime) @@ -109,46 +102,51 @@ public class ProfilePoliceController { .eq(BusinessPolice::getEmpNo, profilePolice.getPoliceInfo().getEmpNo()) .eq(BusinessPolice::getPoliceName, profilePolice.getPoliceInfo().getName())) .stream().mapToInt(BusinessPolice::getNumber).sum(); - int zfbaSize = negativeIds.isEmpty() ? 0 : negativeService.list(new LambdaQueryWrapper() - .between(Negative::getDiscoveryTime, beginTime, endTime) - .eq(Negative::getBusinessTypeCode, BusinessTypeEnum.ZFBA.getValue()) - .in(Negative::getId, negativeIds) - .in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))).size(); - profilePolice.getNegativeInfo().setJcj110BusinessSize(jcj110BusinessSize).setJcj110Size(jcj110Size) - .setJcj122BusinessSize(jcj122BusinessSize).setJcj122Size(jcj122Size) - .setZfbaBusinessSize(zfbaBusinessSize).setZfbaSize(zfbaSize); - List list = negativeIds.isEmpty() ? new ArrayList<>() : negativeService.list(new LambdaQueryWrapper() - .between(Negative::getDiscoveryTime, beginTime, endTime) - .in(Negative::getId, negativeIds) - .in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))); + profilePolice.getNegativeInfo() + .setScore(NumberUtil.round(negatives.stream().mapToDouble(NegativeScorePolice::getScore).sum(), 2).doubleValue()) + .setJcj110BusinessSize(jcj110BusinessSize) + .setSize(negatives.size()) + .setJcj110Size(negatives.stream().filter(item -> BusinessTypeEnum.JCJ_110.getValue().equals(item.getBusinessTypeCode())).count()) + .setJcj122BusinessSize(jcj122BusinessSize) + .setJcj122Size(negatives.stream().filter(item -> BusinessTypeEnum.JCJ_122.getValue().equals(item.getBusinessTypeCode())).count()) + .setZfbaBusinessSize(zfbaBusinessSize) + .setZfbaSize(negatives.stream().filter(item -> BusinessTypeEnum.ZFBA.getValue().equals(item.getBusinessTypeCode())).count()); + + Set negativeIds = negatives.stream().map(NegativeScorePolice::getNegativeId).collect(Collectors.toSet()); + List list = negatives.isEmpty() ? new ArrayList<>() : negativeService.list(new LambdaQueryWrapper() + .in(Negative::getId, negativeIds)); // 问题来源占比 Map> problemSourcesGroup = list.stream().collect(Collectors.groupingBy(Negative::getProblemSourcesCode)); - List problemSourcesList = problemSourcesGroup.keySet().stream().map(key -> new PieItem(Optional.ofNullable(ProblemSourcesEnum.get(key)).map(ProblemSourcesEnum::getLabel).orElse(key), + List problemSourcesList = problemSourcesGroup.keySet().stream() + .map(key -> new PieItem(Optional.ofNullable(ProblemSourcesEnum.get(key)).map(ProblemSourcesEnum::getLabel).orElse(key), problemSourcesGroup.get(key).size())).toList(); profilePolice.setProblemSourcesList(problemSourcesList); - // 业务类型占比 - Map> businessTypeGroup = list.stream().collect(Collectors.groupingBy(Negative::getBusinessTypeCode)); - List businessTypeList = businessTypeGroup.keySet().stream().map(key -> new PieItem(Optional.ofNullable(BusinessTypeEnum.get(key)).map(BusinessTypeEnum::getLabel).orElse(key) - , businessTypeGroup.get(key).size())).toList(); - profilePolice.setBusinessTypeList(businessTypeList); - // 风险问题构成 雷达图 - List problemTypeBarList = profilePoliceMapper.selectProblemType(idCode, beginTime, endTime); - int max = problemTypeBarList.stream().mapToInt(BarItem::getValue).max().getAsInt(); - List problemTypeRadarIndicator = problemTypeBarList.stream().map(item -> { - ProfileDepart.RadarIndicatorItem radarIndicatorItem = new ProfileDepart.RadarIndicatorItem(); - radarIndicatorItem.setMax(max); - radarIndicatorItem.setName(item.getLabel()); - return radarIndicatorItem; - }).toList(); - List problemTypeRadarData = problemTypeBarList.stream().map(BarItem::getValue).toList(); - profilePolice.setProblemTypeRadarIndicator(problemTypeRadarIndicator); - profilePolice.setProblemTypeRadarData(problemTypeRadarData); + // 问题类型占比 + if (!negativeIds.isEmpty()) { + List blameIds = negativeBlameService.list(new LambdaQueryWrapper() + .in(NegativeBlame::getNegativeId, negativeIds) + .eq(NegativeBlame::getBlameIdCode, idCode)) + .stream().map(NegativeBlame::getBlameId).toList(); + if (!blameIds.isEmpty()) { + List problemRelations = negativeProblemRelationService.list(new LambdaQueryWrapper() + .in(NegativeProblemRelation::getBlameId, blameIds) + .in(NegativeProblemRelation::getNegativeId, negativeIds)); + Map> groups = problemRelations.stream().collect(Collectors.groupingBy(NegativeProblemRelation::getThreeLevelContent)); + List problemTypeList = groups.keySet().stream().map(key -> new PieItem(key, groups.get(key).size())).toList(); + profilePolice.setProblemTypeList(problemTypeList); + } + } List result = negativeScoreService.calculatePoliceScore(beginTime, endTime, idCode); profilePolice.setScore((BigDecimal) result.get(0)); profilePolice.setExpression(result.get(1).toString()); profilePolice.setRemarks(result.get(2).toString()); + // 雷达图 + profilePolice.setBusinessTypeRadarIndicator(Arrays.stream(BusinessTypeEnum.values()) + .map(item -> new ProfileDepart.RadarIndicatorItem().setName(item.getLabel()).setMax(100)).toList()); + profilePolice.setBusinessTypeScoreRadarData((List) result.get(3)); + profilePolice.setBusinessTypeWeightRadarData((List) result.get(4)); return Result.success(profilePolice); } diff --git a/src/main/java/com/biutag/supervision/controller/sensitivePerception/RiskPersonalController.java b/src/main/java/com/biutag/supervision/controller/sensitivePerception/RiskPersonalController.java index da443a9..6731a36 100644 --- a/src/main/java/com/biutag/supervision/controller/sensitivePerception/RiskPersonalController.java +++ b/src/main/java/com/biutag/supervision/controller/sensitivePerception/RiskPersonalController.java @@ -10,6 +10,7 @@ import com.biutag.supervision.service.RiskPersonalService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -36,4 +37,10 @@ public class RiskPersonalController { return Result.success(riskPersonalService.page(Page.of(param.getCurrent(), param.getSize()), queryWrapper)); } + @GetMapping("{id}") + public Result> list(@PathVariable Integer id) { + + return Result.success(); + } + } \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/controller/sensitivePerception/RiskScoreRuleController.java b/src/main/java/com/biutag/supervision/controller/sensitivePerception/RiskScoreRuleController.java index ca965aa..be705f2 100644 --- a/src/main/java/com/biutag/supervision/controller/sensitivePerception/RiskScoreRuleController.java +++ b/src/main/java/com/biutag/supervision/controller/sensitivePerception/RiskScoreRuleController.java @@ -30,17 +30,28 @@ public class RiskScoreRuleController { public Result add(@RequestBody RiskScoreRule scoreRule) { scoreRule.setCreateTime(LocalDateTime.now()); scoreRule.setUpdateTime(LocalDateTime.now()); + if (scoreRule.getPid() == 0) { + scoreRule.setLevel(1); + } else { + scoreRule.setLevel(2); + } return Result.success(riskScoreRuleService.save(scoreRule)); } @PutMapping public Result update(@RequestBody RiskScoreRule scoreRule) { scoreRule.setUpdateTime(LocalDateTime.now()); + if (scoreRule.getPid() == 0) { + scoreRule.setLevel(1); + } else { + scoreRule.setLevel(2); + } return Result.success(riskScoreRuleService.updateById(scoreRule)); } @DeleteMapping("{id}") public Result update(@PathVariable Integer id) { + return Result.success(riskScoreRuleService.removeById(id)); } diff --git a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ScoreController.java b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ScoreController.java index be5fde3..1496d05 100644 --- a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ScoreController.java +++ b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ScoreController.java @@ -3,11 +3,9 @@ package com.biutag.supervision.controller.sensitivePerception; import com.biutag.supervision.mapper.DepartScoreMapper; import com.biutag.supervision.mapper.PoliceScoreMapper; import com.biutag.supervision.pojo.Result; -import com.biutag.supervision.pojo.entity.DepartScore; -import com.biutag.supervision.pojo.entity.PoliceScore; -import com.biutag.supervision.pojo.entity.SupDepart; -import com.biutag.supervision.pojo.entity.SupPolice; +import com.biutag.supervision.pojo.entity.*; import com.biutag.supervision.service.NegativeScoreService; +import com.biutag.supervision.service.RiskPersonalService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.RequestMapping; @@ -75,4 +73,13 @@ public class ScoreController { return Result.success("success"); } + private final RiskPersonalService riskPersonalService; + + @RequestMapping("personal") + public Result updatePersonalScore() { + List riskPersonals = riskPersonalService.list(); + + return Result.success("success"); + } + } diff --git a/src/main/java/com/biutag/supervision/pojo/domain/NegativeInfo.java b/src/main/java/com/biutag/supervision/pojo/domain/NegativeInfo.java index 05eb1f1..0fa3ebd 100644 --- a/src/main/java/com/biutag/supervision/pojo/domain/NegativeInfo.java +++ b/src/main/java/com/biutag/supervision/pojo/domain/NegativeInfo.java @@ -15,12 +15,15 @@ public class NegativeInfo { private long size; // 110接处警 + + private Double score; + private Integer jcj110BusinessSize; - private Integer jcj110Size; + private Long jcj110Size; // 122接处警 private Integer jcj122BusinessSize; - private Integer jcj122Size; + private Long jcj122Size; // 执法办案 private Integer zfbaBusinessSize; - private Integer zfbaSize; + private Long zfbaSize; } diff --git a/src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java b/src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java index 09c0dca..ebad75f 100644 --- a/src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java +++ b/src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java @@ -26,9 +26,10 @@ public class ProfilePolice { private SupPolice policeInfo = new SupPolice(); private NegativeInfo negativeInfo = new NegativeInfo(); private List problemSourcesList = new ArrayList<>(); - private List businessTypeList = new ArrayList<>(); + private List problemTypeList = new ArrayList<>(); // 雷达图 - private List problemTypeRadarIndicator = new ArrayList<>(); - private List problemTypeRadarData = new ArrayList<>(); + private List businessTypeRadarIndicator = new ArrayList<>(); + private List businessTypeScoreRadarData = new ArrayList<>(); + private List businessTypeWeightRadarData = new ArrayList<>(); } diff --git a/src/main/java/com/biutag/supervision/pojo/domain/RiskPersonalDetail.java b/src/main/java/com/biutag/supervision/pojo/domain/RiskPersonalDetail.java new file mode 100644 index 0000000..c6c5b96 --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/domain/RiskPersonalDetail.java @@ -0,0 +1,17 @@ +package com.biutag.supervision.pojo.domain; + +import com.biutag.supervision.pojo.entity.RiskPersonal; +import lombok.Getter; +import lombok.Setter; + +/** + * @author wxc + * @date 2024/11/14 + */ +@Setter +@Getter +public class RiskPersonalDetail { + + private RiskPersonal riskPersonal; + +} diff --git a/src/main/java/com/biutag/supervision/pojo/entity/RiskScoreRule.java b/src/main/java/com/biutag/supervision/pojo/entity/RiskScoreRule.java index 289254f..51730ce 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/RiskScoreRule.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/RiskScoreRule.java @@ -53,4 +53,6 @@ public class RiskScoreRule { private Integer sortId; + private Integer level; + } \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/service/NegativeScoreService.java b/src/main/java/com/biutag/supervision/service/NegativeScoreService.java index 5ebb868..af8d0a3 100644 --- a/src/main/java/com/biutag/supervision/service/NegativeScoreService.java +++ b/src/main/java/com/biutag/supervision/service/NegativeScoreService.java @@ -213,6 +213,8 @@ public class NegativeScoreService { Double totalScore = scorePolices.stream().mapToDouble(NegativeScorePolice::getScore).sum(); List expressionArr = new ArrayList<>(); StringBuilder remarks = new StringBuilder(); + List scores = new ArrayList<>(); + List weights = new ArrayList<>(); double policeScore = Arrays.stream(BusinessTypeEnum.values()).mapToDouble(businessTypeEnum -> { log.info("业务 【{}】 开始-------------------------------------------------------------------", businessTypeEnum.getLabel()); List businessScorePolice = scorePolices.stream().filter(item -> item.getBusinessTypeCode().equals(businessTypeEnum.getValue())).toList(); @@ -283,11 +285,13 @@ public class NegativeScoreService { log.info("单个业务风险指数 = {} * {}", businessScore, businessWeight); log.info("单个业务结束-------------------------------------------------------------------", businessTypeEnum.getLabel()); + scores.add(NumberUtil.round(businessScore, 2).doubleValue()); + weights.add(NumberUtil.round(businessWeight * 100, 2).doubleValue()); return NumberUtil.mul(businessScore, businessWeight); }).sum(); BigDecimal score = NumberUtil.roundHalfEven(policeScore, 2); String expression = String.join(" + ", expressionArr); - return List.of(score, expression, remarks); + return List.of(score, expression, remarks, scores, weights); } /** From 2cdadf6f3df31a8f6efd6da1694c8e80189767da Mon Sep 17 00:00:00 2001 From: sjh Date: Thu, 14 Nov 2024 18:55:33 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BF=AE=E6=94=B926=E5=8F=B7=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biutag/supervision/service/ModelClueService.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/biutag/supervision/service/ModelClueService.java b/src/main/java/com/biutag/supervision/service/ModelClueService.java index e4dba55..ef5979f 100644 --- a/src/main/java/com/biutag/supervision/service/ModelClueService.java +++ b/src/main/java/com/biutag/supervision/service/ModelClueService.java @@ -199,23 +199,18 @@ public class ModelClueService extends ServiceImpl { if (!Objects.isNull(model) && model.getModelSql() != null) { modelClues.addAll(getModelClueBySql(model.getModelSql(), modelId)); } - System.out.println("测试10"); if (!modelClues.isEmpty()) { List result = new ArrayList<>(); for (ModelClue modelClue : modelClues) { modelClue.setModelId(modelId); modelClue.setCreateTime(LocalDateTime.now()); - System.out.println("测试12"); if (modelClue.getInvolveDepartName() != null && !modelClue.getInvolveDepartName().isEmpty()) { - System.out.println("测试13"); result.add(modelClue); } } - System.out.println("测试14"); modelClueMapper.insert(result); modelClueRecordMapper.insert(new ModelClueRecord().setModelId(modelId).setSize(result.size()).setCreateTime(LocalDateTime.now()).setState("success")); } else { - System.out.println("测试15"); modelClueRecordMapper.insert(new ModelClueRecord().setModelId(modelId).setSize(0).setCreateTime(LocalDateTime.now()).setState("fail").setErrMsg("数据为空")); } } @@ -291,7 +286,6 @@ public class ModelClueService extends ServiceImpl { } setPerson(modelId, modelClue, data); generateThingDesc(modelId, modelClue, data); - System.out.println("测试8"); break; } } @@ -329,7 +323,7 @@ public class ModelClueService extends ServiceImpl { } if (earliestJRSJ != null && latestLKSJ != null) { Duration duration = Duration.between(earliestDateTime, latestDateTime); - if (duration.toHours() < 3) { + if (duration.toHours() >= 3) { continue; } Map newRecord = new HashMap<>(); @@ -562,7 +556,7 @@ public class ModelClueService extends ServiceImpl { "发现" + data.get("gmrxm") + "(身份证号:" + data.get("zjhm") + ")于" + getDateMinuteString(data.get("gmsj")) + "在" + data.get("fjmc") + modelClue.getInvolveDepartName() + "管辖的" + data.get("dwmc") - + "购买了" + data.get("gmsl") + "升" + data.get("jplx") + data.get("gmyt") + + "购买了" + data.get("gmsl") + "升" + data.get("gmyt") + ",产生了" + data.get("yjlx") + ",请予以重点关注。"); } } @@ -1000,9 +994,7 @@ public class ModelClueService extends ServiceImpl { List uniqueKeys = modelClues1.stream().map(ModelClue::getUniqueKey).filter(k -> k != null && !k.isEmpty()).toList(); if (!uniqueKeys.isEmpty()) { String newSql = "SELECT a.* FROM dwd_asj_zhtx_jjd a LEFT JOIN dwd_asj_sjjhygx_jjcjxxb b ON b.BARLXDH = a.bjdh WHERE a.jjdbh IN " + "(" + uniqueKeys.stream().map(k -> "'" + k + "'").collect(Collectors.joining(",")) + ");"; - System.out.println("测试2开始查询数据库 newSql"); List> allData = modelClueDataMapper.selectByUniqueKeys(newSql); - System.out.println("测试2查询数据库newSql记录条数:" + allData.size()); for (ModelClue modelClue : modelClues1) { for (Map data : allData) { String keyColumn = (String) data.get("jjdbh");