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); } /**