Browse Source

fit: 个人极端赋分规则

main
wxc 1 year ago
parent
commit
c151762042
  1. 43
      src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfileDepartController.java
  2. 86
      src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java
  3. 7
      src/main/java/com/biutag/supervision/controller/sensitivePerception/RiskPersonalController.java
  4. 11
      src/main/java/com/biutag/supervision/controller/sensitivePerception/RiskScoreRuleController.java
  5. 15
      src/main/java/com/biutag/supervision/controller/sensitivePerception/ScoreController.java
  6. 9
      src/main/java/com/biutag/supervision/pojo/domain/NegativeInfo.java
  7. 7
      src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java
  8. 17
      src/main/java/com/biutag/supervision/pojo/domain/RiskPersonalDetail.java
  9. 2
      src/main/java/com/biutag/supervision/pojo/entity/RiskScoreRule.java
  10. 6
      src/main/java/com/biutag/supervision/service/NegativeScoreService.java

43
src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfileDepartController.java

@ -63,6 +63,8 @@ public class ProfileDepartController {
return Result.success(page); return Result.success(page);
} }
private final NegativeScoreDepartService negativeScoreDepartService;
@GetMapping("{departId}") @GetMapping("{departId}")
public Result<ProfileDepart> profile(@PathVariable String departId, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date beginTime, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime) { public Result<ProfileDepart> 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)) { 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().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()); profileDepart.getDepartInfo().setDeputyRole(polices.stream().filter(item -> "副职".equals(item.getPosition())).map(SupPolice::getName).toList());
List<Negative> list = negativeService.list(new LambdaQueryWrapper<Negative>().eq(Negative::getInvolveDepartId, departId) List<NegativeScoreDepart> list = negativeScoreDepartService.list(new LambdaQueryWrapper<NegativeScoreDepart>()
.between(Negative::getDiscoveryTime, beginTime, endTime) .eq(NegativeScoreDepart::getDepartId, departId)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))); .between(NegativeScoreDepart::getDiscoveryTime, beginTime, endTime));
List<String> negativeIds = list.stream().map(Negative::getId).toList();
List<String> negativeIds = list.stream().map(NegativeScoreDepart::getNegativeId).toList();
int negativePoliceSize = negativeIds.isEmpty() ? 0 : profileDepartMapper.countByNegativeIdsAndPersonTypes(negativeIds, List.of(PersonTypeEnum.police.getValue())); int negativePoliceSize = negativeIds.isEmpty() ? 0 : profileDepartMapper.countByNegativeIdsAndPersonTypes(negativeIds, List.of(PersonTypeEnum.police.getValue()));
profileDepart.getDepartInfo().setNegativePoliceSize(negativePoliceSize); profileDepart.getDepartInfo().setNegativePoliceSize(negativePoliceSize);
int negativeAuxSize = negativeIds.isEmpty() ? 0 : profileDepartMapper.countByNegativeIdsAndPersonTypes(negativeIds, List.of(PersonTypeEnum.aux.getValue(), PersonTypeEnum.xj.getValue())); 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::getBusinessType, BusinessTypeEnum.JCJ_110.getValue())
.eq(BusinessDepart::getDepartId, departId)) .eq(BusinessDepart::getDepartId, departId))
.stream().mapToInt(BusinessDepart::getNumber).sum(); .stream().mapToInt(BusinessDepart::getNumber).sum();
int jcj110Size = negativeService.list(new LambdaQueryWrapper<Negative>()
.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<BusinessDepart>() int jcj122BusinessSize = businessDepartService.list(new LambdaQueryWrapper<BusinessDepart>()
.between(BusinessDepart::getDate, beginTime, endTime) .between(BusinessDepart::getDate, beginTime, endTime)
.eq(BusinessDepart::getBusinessType, BusinessTypeEnum.JCJ_122.getValue()) .eq(BusinessDepart::getBusinessType, BusinessTypeEnum.JCJ_122.getValue())
.eq(BusinessDepart::getDepartId, departId)) .eq(BusinessDepart::getDepartId, departId))
.stream().mapToInt(BusinessDepart::getNumber).sum(); .stream().mapToInt(BusinessDepart::getNumber).sum();
int jcj122Size = negativeService.list(new LambdaQueryWrapper<Negative>()
.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<BusinessDepart>() int zfbaBusinessSize = businessDepartService.list(new LambdaQueryWrapper<BusinessDepart>()
.between(BusinessDepart::getDate, beginTime, endTime) .between(BusinessDepart::getDate, beginTime, endTime)
.eq(BusinessDepart::getBusinessType, BusinessTypeEnum.ZFBA.getValue()) .eq(BusinessDepart::getBusinessType, BusinessTypeEnum.ZFBA.getValue())
.eq(BusinessDepart::getDepartId, departId)) .eq(BusinessDepart::getDepartId, departId))
.stream().mapToInt(BusinessDepart::getNumber).sum(); .stream().mapToInt(BusinessDepart::getNumber).sum();
int zfbaSize = negativeService.list(new LambdaQueryWrapper<Negative>()
.between(Negative::getDiscoveryTime, beginTime, endTime) profileDepart.getNegativeInfo()
.eq(Negative::getBusinessTypeCode, BusinessTypeEnum.ZFBA.getValue()) .setJcj110Size(list.stream().filter(item -> BusinessTypeEnum.JCJ_110.getValue().equals(item.getBusinessTypeCode())).count())
.eq(Negative::getInvolveDepartId, departId) .setJcj110BusinessSize(jcj110BusinessSize)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))).size(); .setJcj122Size(list.stream().filter(item -> BusinessTypeEnum.JCJ_122.getValue().equals(item.getBusinessTypeCode())).count())
profileDepart.getNegativeInfo().setJcj110Size(jcj110Size).setJcj110BusinessSize(jcj110BusinessSize)
.setJcj122Size(jcj122Size)
.setJcj122BusinessSize(jcj122BusinessSize) .setJcj122BusinessSize(jcj122BusinessSize)
.setZfbaBusinessSize(zfbaBusinessSize).setZfbaSize(zfbaSize); .setZfbaBusinessSize(zfbaBusinessSize)
.setZfbaSize(list.stream().filter(item -> BusinessTypeEnum.ZFBA.getValue().equals(item.getBusinessTypeCode())).count());
List<Negative> negatives = negativeService.listByIds(negativeIds);
// 问题来源占比 // 问题来源占比
Map<String, List<Negative>> problemSourcesGroup = list.stream().collect(Collectors.groupingBy(Negative::getProblemSourcesCode)); Map<String, List<Negative>> problemSourcesGroup = negatives.stream().collect(Collectors.groupingBy(Negative::getProblemSourcesCode));
List<PieItem> problemSourcesList = problemSourcesGroup.keySet().stream().map(key -> new PieItem(Optional.ofNullable(ProblemSourcesEnum.get(key)).map(ProblemSourcesEnum::getLabel).orElse(key), problemSourcesGroup.get(key).size())).toList(); List<PieItem> 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); profileDepart.setProblemSourcesList(problemSourcesList);
// 业务类型占比 // 业务类型占比
Map<String, List<Negative>> businessTypeGroup = list.stream().collect(Collectors.groupingBy(Negative::getBusinessTypeCode)); Map<String, List<Negative>> businessTypeGroup = negatives.stream().collect(Collectors.groupingBy(Negative::getBusinessTypeCode));
List<PieItem> businessTypeList = businessTypeGroup.keySet().stream().map(key -> new PieItem(Optional.ofNullable(BusinessTypeEnum.get(key)).map(BusinessTypeEnum::getLabel).orElse(key), List<PieItem> businessTypeList = businessTypeGroup.keySet().stream().map(key -> new PieItem(Optional.ofNullable(BusinessTypeEnum.get(key)).map(BusinessTypeEnum::getLabel).orElse(key),
businessTypeGroup.get(key).size())).toList(); businessTypeGroup.get(key).size())).toList();
profileDepart.setBusinessTypeList(businessTypeList); profileDepart.setBusinessTypeList(businessTypeList);

86
src/main/java/com/biutag/supervision/controller/sensitivePerception/ProfilePoliceController.java

@ -1,6 +1,7 @@
package com.biutag.supervision.controller.sensitivePerception; package com.biutag.supervision.controller.sensitivePerception;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.domain.ProfilePolice;
import com.biutag.supervision.pojo.dto.common.BarItem; import com.biutag.supervision.pojo.dto.common.BarItem;
import com.biutag.supervision.pojo.dto.common.PieItem; import com.biutag.supervision.pojo.dto.common.PieItem;
import com.biutag.supervision.pojo.entity.BusinessPolice; import com.biutag.supervision.pojo.entity.*;
import com.biutag.supervision.pojo.entity.Negative;
import com.biutag.supervision.pojo.entity.NegativeBlame;
import com.biutag.supervision.pojo.model.PoliceNegativeModel; import com.biutag.supervision.pojo.model.PoliceNegativeModel;
import com.biutag.supervision.pojo.param.DepartPoliceQueryParam; import com.biutag.supervision.pojo.param.DepartPoliceQueryParam;
import com.biutag.supervision.service.*; import com.biutag.supervision.service.*;
@ -66,6 +65,9 @@ public class ProfilePoliceController {
return Result.success(page); return Result.success(page);
} }
private final NegativeScorePoliceService negativeScorePoliceService;
private final NegativeProblemRelationService negativeProblemRelationService;
@GetMapping("{idCode}") @GetMapping("{idCode}")
public Result<ProfilePolice> profile(@PathVariable String idCode, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date beginTime, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime) { public Result<ProfilePolice> 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)) { if (Objects.isNull(beginTime)) {
@ -77,6 +79,8 @@ public class ProfilePoliceController {
ProfilePolice profilePolice = new ProfilePolice(); ProfilePolice profilePolice = new ProfilePolice();
profilePolice.setPoliceInfo(policeService.getByIdCode(idCode)); profilePolice.setPoliceInfo(policeService.getByIdCode(idCode));
List<NegativeScorePolice> negatives = negativeScorePoliceService.list(new LambdaQueryWrapper<NegativeScorePolice>().between(NegativeScorePolice::getDiscoveryTime, beginTime, endTime).eq(NegativeScorePolice::getIdCode, idCode));
int jcj110BusinessSize = businessPoliceService.list(new LambdaQueryWrapper<BusinessPolice>() int jcj110BusinessSize = businessPoliceService.list(new LambdaQueryWrapper<BusinessPolice>()
.between(BusinessPolice::getDate, beginTime, endTime) .between(BusinessPolice::getDate, beginTime, endTime)
.eq(BusinessPolice::getBusinessType, BusinessTypeEnum.JCJ_110.getValue()) .eq(BusinessPolice::getBusinessType, BusinessTypeEnum.JCJ_110.getValue())
@ -84,12 +88,6 @@ public class ProfilePoliceController {
.eq(BusinessPolice::getPoliceName, profilePolice.getPoliceInfo().getName())) .eq(BusinessPolice::getPoliceName, profilePolice.getPoliceInfo().getName()))
.stream().mapToInt(BusinessPolice::getNumber).sum(); .stream().mapToInt(BusinessPolice::getNumber).sum();
Set<String> negativeIds = negativeBlameService.list(new LambdaQueryWrapper<NegativeBlame>().eq(NegativeBlame::getBlameIdCode, idCode)).stream().map(NegativeBlame::getNegativeId).collect(Collectors.toSet());
int jcj110Size = negativeIds.isEmpty() ? 0 : negativeService.list(new LambdaQueryWrapper<Negative>()
.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<BusinessPolice>() int jcj122BusinessSize = businessPoliceService.list(new LambdaQueryWrapper<BusinessPolice>()
.between(BusinessPolice::getDate, beginTime, endTime) .between(BusinessPolice::getDate, beginTime, endTime)
.eq(BusinessPolice::getBusinessType, BusinessTypeEnum.JCJ_122.getValue()) .eq(BusinessPolice::getBusinessType, BusinessTypeEnum.JCJ_122.getValue())
@ -97,11 +95,6 @@ public class ProfilePoliceController {
.eq(BusinessPolice::getPoliceName, profilePolice.getPoliceInfo().getName())) .eq(BusinessPolice::getPoliceName, profilePolice.getPoliceInfo().getName()))
.stream().mapToInt(BusinessPolice::getNumber).sum(); .stream().mapToInt(BusinessPolice::getNumber).sum();
int jcj122Size = negativeIds.isEmpty() ? 0 : negativeService.list(new LambdaQueryWrapper<Negative>()
.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<BusinessPolice>() int zfbaBusinessSize = businessPoliceService.list(new LambdaQueryWrapper<BusinessPolice>()
.between(BusinessPolice::getDate, beginTime, endTime) .between(BusinessPolice::getDate, beginTime, endTime)
@ -109,46 +102,51 @@ public class ProfilePoliceController {
.eq(BusinessPolice::getEmpNo, profilePolice.getPoliceInfo().getEmpNo()) .eq(BusinessPolice::getEmpNo, profilePolice.getPoliceInfo().getEmpNo())
.eq(BusinessPolice::getPoliceName, profilePolice.getPoliceInfo().getName())) .eq(BusinessPolice::getPoliceName, profilePolice.getPoliceInfo().getName()))
.stream().mapToInt(BusinessPolice::getNumber).sum(); .stream().mapToInt(BusinessPolice::getNumber).sum();
int zfbaSize = negativeIds.isEmpty() ? 0 : negativeService.list(new LambdaQueryWrapper<Negative>()
.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<Negative> list = negativeIds.isEmpty() ? new ArrayList<>() : negativeService.list(new LambdaQueryWrapper<Negative>() profilePolice.getNegativeInfo()
.between(Negative::getDiscoveryTime, beginTime, endTime) .setScore(NumberUtil.round(negatives.stream().mapToDouble(NegativeScorePolice::getScore).sum(), 2).doubleValue())
.in(Negative::getId, negativeIds) .setJcj110BusinessSize(jcj110BusinessSize)
.in(Negative::getCheckStatus, List.of(InspectCaseEnum.TRUE.getValue(), InspectCaseEnum.PARTIALLY_TRUE.getValue()))); .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<String> negativeIds = negatives.stream().map(NegativeScorePolice::getNegativeId).collect(Collectors.toSet());
List<Negative> list = negatives.isEmpty() ? new ArrayList<>() : negativeService.list(new LambdaQueryWrapper<Negative>()
.in(Negative::getId, negativeIds));
// 问题来源占比 // 问题来源占比
Map<String, List<Negative>> problemSourcesGroup = list.stream().collect(Collectors.groupingBy(Negative::getProblemSourcesCode)); Map<String, List<Negative>> problemSourcesGroup = list.stream().collect(Collectors.groupingBy(Negative::getProblemSourcesCode));
List<PieItem> problemSourcesList = problemSourcesGroup.keySet().stream().map(key -> new PieItem(Optional.ofNullable(ProblemSourcesEnum.get(key)).map(ProblemSourcesEnum::getLabel).orElse(key), List<PieItem> problemSourcesList = problemSourcesGroup.keySet().stream()
.map(key -> new PieItem(Optional.ofNullable(ProblemSourcesEnum.get(key)).map(ProblemSourcesEnum::getLabel).orElse(key),
problemSourcesGroup.get(key).size())).toList(); problemSourcesGroup.get(key).size())).toList();
profilePolice.setProblemSourcesList(problemSourcesList); profilePolice.setProblemSourcesList(problemSourcesList);
// 业务类型占比 // 问题类型占比
Map<String, List<Negative>> businessTypeGroup = list.stream().collect(Collectors.groupingBy(Negative::getBusinessTypeCode)); if (!negativeIds.isEmpty()) {
List<PieItem> businessTypeList = businessTypeGroup.keySet().stream().map(key -> new PieItem(Optional.ofNullable(BusinessTypeEnum.get(key)).map(BusinessTypeEnum::getLabel).orElse(key) List<String> blameIds = negativeBlameService.list(new LambdaQueryWrapper<NegativeBlame>()
, businessTypeGroup.get(key).size())).toList(); .in(NegativeBlame::getNegativeId, negativeIds)
profilePolice.setBusinessTypeList(businessTypeList); .eq(NegativeBlame::getBlameIdCode, idCode))
// 风险问题构成 雷达图 .stream().map(NegativeBlame::getBlameId).toList();
List<BarItem> problemTypeBarList = profilePoliceMapper.selectProblemType(idCode, beginTime, endTime); if (!blameIds.isEmpty()) {
int max = problemTypeBarList.stream().mapToInt(BarItem::getValue).max().getAsInt(); List<NegativeProblemRelation> problemRelations = negativeProblemRelationService.list(new LambdaQueryWrapper<NegativeProblemRelation>()
List<ProfileDepart.RadarIndicatorItem> problemTypeRadarIndicator = problemTypeBarList.stream().map(item -> { .in(NegativeProblemRelation::getBlameId, blameIds)
ProfileDepart.RadarIndicatorItem radarIndicatorItem = new ProfileDepart.RadarIndicatorItem(); .in(NegativeProblemRelation::getNegativeId, negativeIds));
radarIndicatorItem.setMax(max); Map<String, List<NegativeProblemRelation>> groups = problemRelations.stream().collect(Collectors.groupingBy(NegativeProblemRelation::getThreeLevelContent));
radarIndicatorItem.setName(item.getLabel()); List<PieItem> problemTypeList = groups.keySet().stream().map(key -> new PieItem(key, groups.get(key).size())).toList();
return radarIndicatorItem; profilePolice.setProblemTypeList(problemTypeList);
}).toList(); }
List<Integer> problemTypeRadarData = problemTypeBarList.stream().map(BarItem::getValue).toList(); }
profilePolice.setProblemTypeRadarIndicator(problemTypeRadarIndicator);
profilePolice.setProblemTypeRadarData(problemTypeRadarData);
List<Object> result = negativeScoreService.calculatePoliceScore(beginTime, endTime, idCode); List<Object> result = negativeScoreService.calculatePoliceScore(beginTime, endTime, idCode);
profilePolice.setScore((BigDecimal) result.get(0)); profilePolice.setScore((BigDecimal) result.get(0));
profilePolice.setExpression(result.get(1).toString()); profilePolice.setExpression(result.get(1).toString());
profilePolice.setRemarks(result.get(2).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<Double>) result.get(3));
profilePolice.setBusinessTypeWeightRadarData((List<Double>) result.get(4));
return Result.success(profilePolice); return Result.success(profilePolice);
} }

7
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.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping; 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController; 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)); return Result.success(riskPersonalService.page(Page.of(param.getCurrent(), param.getSize()), queryWrapper));
} }
@GetMapping("{id}")
public Result<Page<RiskPersonal>> list(@PathVariable Integer id) {
return Result.success();
}
} }

11
src/main/java/com/biutag/supervision/controller/sensitivePerception/RiskScoreRuleController.java

@ -30,17 +30,28 @@ public class RiskScoreRuleController {
public Result<Boolean> add(@RequestBody RiskScoreRule scoreRule) { public Result<Boolean> add(@RequestBody RiskScoreRule scoreRule) {
scoreRule.setCreateTime(LocalDateTime.now()); scoreRule.setCreateTime(LocalDateTime.now());
scoreRule.setUpdateTime(LocalDateTime.now()); scoreRule.setUpdateTime(LocalDateTime.now());
if (scoreRule.getPid() == 0) {
scoreRule.setLevel(1);
} else {
scoreRule.setLevel(2);
}
return Result.success(riskScoreRuleService.save(scoreRule)); return Result.success(riskScoreRuleService.save(scoreRule));
} }
@PutMapping @PutMapping
public Result<Boolean> update(@RequestBody RiskScoreRule scoreRule) { public Result<Boolean> update(@RequestBody RiskScoreRule scoreRule) {
scoreRule.setUpdateTime(LocalDateTime.now()); scoreRule.setUpdateTime(LocalDateTime.now());
if (scoreRule.getPid() == 0) {
scoreRule.setLevel(1);
} else {
scoreRule.setLevel(2);
}
return Result.success(riskScoreRuleService.updateById(scoreRule)); return Result.success(riskScoreRuleService.updateById(scoreRule));
} }
@DeleteMapping("{id}") @DeleteMapping("{id}")
public Result<Boolean> update(@PathVariable Integer id) { public Result<Boolean> update(@PathVariable Integer id) {
return Result.success(riskScoreRuleService.removeById(id)); return Result.success(riskScoreRuleService.removeById(id));
} }

15
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.DepartScoreMapper;
import com.biutag.supervision.mapper.PoliceScoreMapper; import com.biutag.supervision.mapper.PoliceScoreMapper;
import com.biutag.supervision.pojo.Result; import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.entity.DepartScore; import com.biutag.supervision.pojo.entity.*;
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.service.NegativeScoreService; import com.biutag.supervision.service.NegativeScoreService;
import com.biutag.supervision.service.RiskPersonalService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -75,4 +73,13 @@ public class ScoreController {
return Result.success("success"); return Result.success("success");
} }
private final RiskPersonalService riskPersonalService;
@RequestMapping("personal")
public Result<String> updatePersonalScore() {
List<RiskPersonal> riskPersonals = riskPersonalService.list();
return Result.success("success");
}
} }

9
src/main/java/com/biutag/supervision/pojo/domain/NegativeInfo.java

@ -15,12 +15,15 @@ public class NegativeInfo {
private long size; private long size;
// 110接处警 // 110接处警
private Double score;
private Integer jcj110BusinessSize; private Integer jcj110BusinessSize;
private Integer jcj110Size; private Long jcj110Size;
// 122接处警 // 122接处警
private Integer jcj122BusinessSize; private Integer jcj122BusinessSize;
private Integer jcj122Size; private Long jcj122Size;
// 执法办案 // 执法办案
private Integer zfbaBusinessSize; private Integer zfbaBusinessSize;
private Integer zfbaSize; private Long zfbaSize;
} }

7
src/main/java/com/biutag/supervision/pojo/domain/ProfilePolice.java

@ -26,9 +26,10 @@ public class ProfilePolice {
private SupPolice policeInfo = new SupPolice(); private SupPolice policeInfo = new SupPolice();
private NegativeInfo negativeInfo = new NegativeInfo(); private NegativeInfo negativeInfo = new NegativeInfo();
private List<PieItem> problemSourcesList = new ArrayList<>(); private List<PieItem> problemSourcesList = new ArrayList<>();
private List<PieItem> businessTypeList = new ArrayList<>(); private List<PieItem> problemTypeList = new ArrayList<>();
// 雷达图 // 雷达图
private List<ProfileDepart.RadarIndicatorItem> problemTypeRadarIndicator = new ArrayList<>(); private List<ProfileDepart.RadarIndicatorItem> businessTypeRadarIndicator = new ArrayList<>();
private List<Integer> problemTypeRadarData = new ArrayList<>(); private List<Double> businessTypeScoreRadarData = new ArrayList<>();
private List<Double> businessTypeWeightRadarData = new ArrayList<>();
} }

17
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;
}

2
src/main/java/com/biutag/supervision/pojo/entity/RiskScoreRule.java

@ -53,4 +53,6 @@ public class RiskScoreRule {
private Integer sortId; private Integer sortId;
private Integer level;
} }

6
src/main/java/com/biutag/supervision/service/NegativeScoreService.java

@ -213,6 +213,8 @@ public class NegativeScoreService {
Double totalScore = scorePolices.stream().mapToDouble(NegativeScorePolice::getScore).sum(); Double totalScore = scorePolices.stream().mapToDouble(NegativeScorePolice::getScore).sum();
List<String> expressionArr = new ArrayList<>(); List<String> expressionArr = new ArrayList<>();
StringBuilder remarks = new StringBuilder(); StringBuilder remarks = new StringBuilder();
List<Double> scores = new ArrayList<>();
List<Double> weights = new ArrayList<>();
double policeScore = Arrays.stream(BusinessTypeEnum.values()).mapToDouble(businessTypeEnum -> { double policeScore = Arrays.stream(BusinessTypeEnum.values()).mapToDouble(businessTypeEnum -> {
log.info("业务 【{}】 开始-------------------------------------------------------------------", businessTypeEnum.getLabel()); log.info("业务 【{}】 开始-------------------------------------------------------------------", businessTypeEnum.getLabel());
List<NegativeScorePolice> businessScorePolice = scorePolices.stream().filter(item -> item.getBusinessTypeCode().equals(businessTypeEnum.getValue())).toList(); List<NegativeScorePolice> businessScorePolice = scorePolices.stream().filter(item -> item.getBusinessTypeCode().equals(businessTypeEnum.getValue())).toList();
@ -283,11 +285,13 @@ public class NegativeScoreService {
log.info("单个业务风险指数 = {} * {}", businessScore, businessWeight); log.info("单个业务风险指数 = {} * {}", businessScore, businessWeight);
log.info("单个业务结束-------------------------------------------------------------------", businessTypeEnum.getLabel()); log.info("单个业务结束-------------------------------------------------------------------", businessTypeEnum.getLabel());
scores.add(NumberUtil.round(businessScore, 2).doubleValue());
weights.add(NumberUtil.round(businessWeight * 100, 2).doubleValue());
return NumberUtil.mul(businessScore, businessWeight); return NumberUtil.mul(businessScore, businessWeight);
}).sum(); }).sum();
BigDecimal score = NumberUtil.roundHalfEven(policeScore, 2); BigDecimal score = NumberUtil.roundHalfEven(policeScore, 2);
String expression = String.join(" + ", expressionArr); String expression = String.join(" + ", expressionArr);
return List.of(score, expression, remarks); return List.of(score, expression, remarks, scores, weights);
} }
/** /**

Loading…
Cancel
Save