39 changed files with 714 additions and 140 deletions
@ -0,0 +1,19 @@ |
|||||||
|
truncate statistics_group ; |
||||||
|
|
||||||
|
INSERT INTO `negative`.`statistics_group`(`groupId`, `name`, `level`, `remark`, `type`, `pid`, `flag`, `sort`) VALUES (4, '局属单位', 1, NULL, 'oneLevel', NULL, '0', 2); |
||||||
|
INSERT INTO `negative`.`statistics_group`(`groupId`, `name`, `level`, `remark`, `type`, `pid`, `flag`, `sort`) VALUES (3, '分县市局', 1, '二级机构对比', 'oneLevel', NULL, '0', 3); |
||||||
|
INSERT INTO `negative`.`statistics_group`(`groupId`, `name`, `level`, `remark`, `type`, `pid`, `flag`, `sort`) VALUES (10, '派出所', 2, '三级机构对比', '', NULL, '1', 4); |
||||||
|
INSERT INTO `negative`.`statistics_group`(`groupId`, `name`, `level`, `remark`, `type`, `pid`, `flag`, `sort`) VALUES (11, '交警大队', 2, '三级机构对比', NULL, NULL, '0', 5); |
||||||
|
INSERT INTO `negative`.`statistics_group`(`groupId`, `name`, `level`, `remark`, `type`, `pid`, `flag`, `sort`) VALUES (13, '刑侦大队', 2, NULL, NULL, NULL, '0', 6); |
||||||
|
INSERT INTO `negative`.`statistics_group`(`groupId`, `name`, `level`, `remark`, `type`, `pid`, `flag`, `sort`) VALUES (14, '禁毒大队', 2, NULL, NULL, NULL, '0', 7); |
||||||
|
INSERT INTO `negative`.`statistics_group`(`groupId`, `name`, `level`, `remark`, `type`, `pid`, `flag`, `sort`) VALUES (15, '治安大队', 2, NULL, NULL, NULL, '0', 8); |
||||||
|
INSERT INTO `negative`.`statistics_group`(`groupId`, `name`, `level`, `remark`, `type`, `pid`, `flag`, `sort`) VALUES (16, '人境大队', 2, NULL, NULL, NULL, '0', 9); |
||||||
|
INSERT INTO `negative`.`statistics_group`(`groupId`, `name`, `level`, `remark`, `type`, `pid`, `flag`, `sort`) VALUES (12, '其他', 2, '三级机构对比', NULL, NULL, '0', 10); |
||||||
|
|
||||||
|
update sup_depart set statistics_group_id = 10 where short_name like '%派出所' and `level` = 3; |
||||||
|
update sup_depart set statistics_group_id = 12 where pid = '2623' and short_name like '%大队' and `level` = 3; |
||||||
|
update sup_depart set statistics_group_id = 14 where short_name = '禁毒大队' and `level` = 3; |
||||||
|
update sup_depart set statistics_group_id = 15 where short_name = '治安大队' and `level` = 3; |
||||||
|
update sup_depart set statistics_group_id = 16 where short_name = '人境大队' and `level` = 3; |
||||||
|
-- 其他 |
||||||
|
update sup_depart set statistics_group_id = 12 where statistics_group_id is null and `level` = 3; |
||||||
@ -0,0 +1,34 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/11/8 |
||||||
|
*/ |
||||||
|
@Getter |
||||||
|
@AllArgsConstructor |
||||||
|
public enum NegativeLevelEnum { |
||||||
|
|
||||||
|
GENERAL_IMPACT("一般影响", "1", 0.0), |
||||||
|
SERIOUS_IMPACT("严重影响", "2", 0.2), |
||||||
|
|
||||||
|
SIGNIFICANT_IMPACT("重大影响", "3", 0.5); |
||||||
|
|
||||||
|
private String lable; |
||||||
|
|
||||||
|
private String value; |
||||||
|
|
||||||
|
private Double score; |
||||||
|
|
||||||
|
public static Double getScore(String value) { |
||||||
|
for (NegativeLevelEnum negativeLevelEnum : values()) { |
||||||
|
if (negativeLevelEnum.value.equals(value)) { |
||||||
|
return negativeLevelEnum.score; |
||||||
|
} |
||||||
|
} |
||||||
|
return 0.0; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/11/8 |
||||||
|
*/ |
||||||
|
public enum OrderEnum { |
||||||
|
// 正序
|
||||||
|
ascending, |
||||||
|
// 倒叙
|
||||||
|
descending; |
||||||
|
} |
||||||
@ -0,0 +1,106 @@ |
|||||||
|
package com.biutag.supervision.flow.action; |
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil; |
||||||
|
import cn.hutool.core.util.NumberUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
||||||
|
import com.biutag.supervision.common.UserContextHolder; |
||||||
|
import com.biutag.supervision.constants.enums.*; |
||||||
|
import com.biutag.supervision.pojo.dto.ActionDto; |
||||||
|
import com.biutag.supervision.pojo.dto.flow.ConfirmationCompletionData; |
||||||
|
import com.biutag.supervision.pojo.entity.Negative; |
||||||
|
import com.biutag.supervision.pojo.entity.NegativeApprove; |
||||||
|
import com.biutag.supervision.pojo.entity.NegativeScorePolice; |
||||||
|
import com.biutag.supervision.pojo.entity.NegativeWork; |
||||||
|
import com.biutag.supervision.pojo.model.UserAuth; |
||||||
|
import com.biutag.supervision.service.*; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/11/8 |
||||||
|
*/ |
||||||
|
@RequiredArgsConstructor |
||||||
|
@Component |
||||||
|
public class ConfirmationCompletionAction implements Action { |
||||||
|
|
||||||
|
private final NegativeService negativeService; |
||||||
|
|
||||||
|
private final NegativeScorePoliceService negativeScorePoliceService; |
||||||
|
|
||||||
|
private final NegativeWorkService workService; |
||||||
|
|
||||||
|
private final NegativeApproveService approveService; |
||||||
|
|
||||||
|
@Override |
||||||
|
public void next(ActionDto actionDto) { |
||||||
|
ConfirmationCompletionData completionData = BeanUtil.toBean(actionDto.getData(), ConfirmationCompletionData.class); |
||||||
|
String negativeId = actionDto.getNegativeId(); |
||||||
|
updateNegative(negativeId, completionData); |
||||||
|
addNegativeScorePolice(negativeId, completionData); |
||||||
|
updateApprove(negativeId, completionData.getCompletionComment(), actionDto.getWorkId()); |
||||||
|
doneWork(actionDto.getWorkId()); |
||||||
|
} |
||||||
|
|
||||||
|
public void updateNegative(String negativeId, ConfirmationCompletionData completionData) { |
||||||
|
LambdaUpdateWrapper<Negative> updateWrapper = new LambdaUpdateWrapper<Negative>() |
||||||
|
.eq(Negative::getId, negativeId) |
||||||
|
.set(Negative::getProcessingStatus, ProcessingStatusEnum.completed.name()) |
||||||
|
.set(Negative::getVerifySituation, completionData.getVerifySituation()) |
||||||
|
.set(Negative::getVerifyFileSituation, completionData.getVerifyFileSituation()) |
||||||
|
.set(Negative::getCompleteDate, LocalDateTime.now()) |
||||||
|
.set(Negative::getFlowKey, FlowNodeEnum.COMPLETED.getKey()) |
||||||
|
.set(Negative::getUpdTime, LocalDateTime.now()); |
||||||
|
negativeService.update(updateWrapper); |
||||||
|
} |
||||||
|
|
||||||
|
public void addNegativeScorePolice(String negativeId, ConfirmationCompletionData completionData) { |
||||||
|
String formula = "%s + (1 * %s) + (1 * %s)"; |
||||||
|
Negative negative = negativeService.getById(negativeId); |
||||||
|
List<NegativeScorePolice> scorePolices = completionData.getBlames().stream().map(blame -> { |
||||||
|
NegativeScorePolice negativeScorePolice = new NegativeScorePolice() |
||||||
|
.setNegativeId(negativeId) |
||||||
|
.setIdCode(blame.getBlameIdCode()) |
||||||
|
.setDiscoveryTime(negative.getDiscoveryTime()) |
||||||
|
.setIdCode(blame.getBlameIdCode()); |
||||||
|
String expression = String.format(formula, |
||||||
|
blame.getBaseScore(), |
||||||
|
NegativeLevelEnum.getScore(blame.getNegativeLevel()), |
||||||
|
blame.getFrequencyScore()); |
||||||
|
negativeScorePolice.setExpression(expression); |
||||||
|
double calculate = NumberUtil.calculate(expression); |
||||||
|
double score = NumberUtil.roundHalfEven(calculate, 2).doubleValue(); |
||||||
|
negativeScorePolice.setScore(score); |
||||||
|
negativeScorePolice.setCreateTime(LocalDateTime.now()); |
||||||
|
return negativeScorePolice; |
||||||
|
}).toList(); |
||||||
|
negativeScorePoliceService.saveBatch(scorePolices); |
||||||
|
} |
||||||
|
|
||||||
|
public void updateApprove(String negativeId, String comments, Integer workId) { |
||||||
|
UserAuth user = UserContextHolder.getCurrentUser(); |
||||||
|
Negative negative = negativeService.getById(negativeId); |
||||||
|
NegativeWork work = workService.getById(workId); |
||||||
|
approveService.update(new LambdaUpdateWrapper<NegativeApprove>() |
||||||
|
.set(NegativeApprove::getState, ApproveStateEnum.approved.name()) |
||||||
|
.set(NegativeApprove::getComments, comments) |
||||||
|
.set(NegativeApprove::getHandlerDepartId, work.getDepartId()) |
||||||
|
.set(NegativeApprove::getHandlerDepartName, work.getDepartName()) |
||||||
|
.set(NegativeApprove::getHandlerUserName, user.getUserName()) |
||||||
|
.set(NegativeApprove::getHandlerName, user.getNickName()) |
||||||
|
.set(NegativeApprove::getUpdateTime, LocalDateTime.now()) |
||||||
|
.eq(NegativeApprove::getNegativeId, negativeId) |
||||||
|
.eq(NegativeApprove::getActionKey, negative.getFlowKey())); |
||||||
|
} |
||||||
|
public void doneWork(Integer workId) { |
||||||
|
LambdaUpdateWrapper<NegativeWork> updateWrapper = new LambdaUpdateWrapper<NegativeWork>() |
||||||
|
.eq(NegativeWork::getId, workId) |
||||||
|
.set(NegativeWork::getStatus, WorkStatusEnum.done.name()) |
||||||
|
.set(NegativeWork::getUpdateTime, LocalDateTime.now()); |
||||||
|
workService.update(updateWrapper); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -1,77 +0,0 @@ |
|||||||
package com.biutag.supervision.flow.action; |
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil; |
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
||||||
import com.biutag.supervision.common.UserContextHolder; |
|
||||||
import com.biutag.supervision.constants.enums.ApproveStateEnum; |
|
||||||
import com.biutag.supervision.constants.enums.ProcessingStatusEnum; |
|
||||||
import com.biutag.supervision.constants.enums.WorkStatusEnum; |
|
||||||
import com.biutag.supervision.pojo.dto.ActionDto; |
|
||||||
import com.biutag.supervision.pojo.dto.flow.ApproveData; |
|
||||||
import com.biutag.supervision.pojo.entity.Negative; |
|
||||||
import com.biutag.supervision.pojo.entity.NegativeApprove; |
|
||||||
import com.biutag.supervision.pojo.entity.NegativeWork; |
|
||||||
import com.biutag.supervision.pojo.model.UserAuth; |
|
||||||
import com.biutag.supervision.service.NegativeApproveService; |
|
||||||
import com.biutag.supervision.service.NegativeService; |
|
||||||
import com.biutag.supervision.service.NegativeWorkService; |
|
||||||
import lombok.RequiredArgsConstructor; |
|
||||||
import org.springframework.stereotype.Component; |
|
||||||
|
|
||||||
import java.time.LocalDateTime; |
|
||||||
|
|
||||||
/** |
|
||||||
* 市局审批通过 |
|
||||||
*/ |
|
||||||
@RequiredArgsConstructor |
|
||||||
@Component |
|
||||||
public class FirstApproveAction implements Action { |
|
||||||
|
|
||||||
private final NegativeService negativeService; |
|
||||||
|
|
||||||
private final NegativeWorkService workService; |
|
||||||
|
|
||||||
private final NegativeApproveService approveService; |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public void next(ActionDto actionDto) { |
|
||||||
ApproveData approveData = BeanUtil.toBean(actionDto.getData(), ApproveData.class); |
|
||||||
updateNegative(actionDto.getNegativeId(), actionDto.getNextFlowKey()); |
|
||||||
updateApprove(actionDto.getNegativeId(), actionDto.getActionKey(), actionDto.getWorkId(), approveData.getComments()); |
|
||||||
doneWork(actionDto.getWorkId()); |
|
||||||
} |
|
||||||
|
|
||||||
public void updateNegative(String negativeId, String nextFlowKey) { |
|
||||||
negativeService.update(new LambdaUpdateWrapper<Negative>() |
|
||||||
.set(Negative::getFlowKey, nextFlowKey) |
|
||||||
.set(Negative::getProcessingStatus, ProcessingStatusEnum.completed.name()) |
|
||||||
.set(Negative::getCompleteDate, LocalDateTime.now()) |
|
||||||
.set(Negative::getUpdTime, LocalDateTime.now()) |
|
||||||
.eq(Negative::getId, negativeId)); |
|
||||||
} |
|
||||||
|
|
||||||
public void updateApprove(String negativeId, String actionKey, Integer workId, String comments) { |
|
||||||
UserAuth user = UserContextHolder.getCurrentUser(); |
|
||||||
NegativeWork work = workService.getById(workId); |
|
||||||
approveService.update(new LambdaUpdateWrapper<NegativeApprove>() |
|
||||||
.set(NegativeApprove::getState, ApproveStateEnum.approved.name()) |
|
||||||
.set(NegativeApprove::getComments, comments) |
|
||||||
.set(NegativeApprove::getHandlerDepartId, work.getDepartId()) |
|
||||||
.set(NegativeApprove::getHandlerDepartName, work.getDepartName()) |
|
||||||
.set(NegativeApprove::getHandlerUserName, user.getUserName()) |
|
||||||
.set(NegativeApprove::getHandlerName, user.getNickName()) |
|
||||||
.set(NegativeApprove::getUpdateTime, LocalDateTime.now()) |
|
||||||
.eq(NegativeApprove::getNegativeId, negativeId) |
|
||||||
.eq(NegativeApprove::getActionKey, actionKey)); |
|
||||||
} |
|
||||||
|
|
||||||
public void doneWork(Integer workId) { |
|
||||||
workService.update(new LambdaUpdateWrapper<NegativeWork>() |
|
||||||
.set(NegativeWork::getUpdateTime, LocalDateTime.now()) |
|
||||||
.set(NegativeWork::getStatus, WorkStatusEnum.done.name()) |
|
||||||
.eq(NegativeWork::getId, workId)); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
@ -0,0 +1,79 @@ |
|||||||
|
package com.biutag.supervision.job; |
||||||
|
|
||||||
|
import cn.hutool.core.util.NumberUtil; |
||||||
|
import com.biutag.supervision.constants.enums.NegativeLevelEnum; |
||||||
|
import com.biutag.supervision.mapper.NegativeBlameMapper; |
||||||
|
import com.biutag.supervision.mapper.SupDictContentMapper; |
||||||
|
import com.biutag.supervision.pojo.entity.*; |
||||||
|
import com.biutag.supervision.service.NegativeBlameService; |
||||||
|
import com.biutag.supervision.service.NegativeProblemRelationService; |
||||||
|
import com.biutag.supervision.service.NegativeScorePoliceService; |
||||||
|
import com.biutag.supervision.service.NegativeService; |
||||||
|
import com.biutag.supervision.util.ScoreRule; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.scheduling.annotation.Scheduled; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/11/10 |
||||||
|
*/ |
||||||
|
@RequiredArgsConstructor |
||||||
|
@Component |
||||||
|
public class ScoreJob { |
||||||
|
|
||||||
|
private final NegativeScorePoliceService negativeScorePoliceService; |
||||||
|
|
||||||
|
private final NegativeBlameMapper blameMapper; |
||||||
|
|
||||||
|
private final NegativeBlameService blameService; |
||||||
|
|
||||||
|
private final NegativeService negativeService; |
||||||
|
|
||||||
|
private final NegativeProblemRelationService problemRelationService; |
||||||
|
|
||||||
|
private final SupDictContentMapper supDictContentMapper; |
||||||
|
|
||||||
|
@Scheduled(fixedRate = 6000000) |
||||||
|
public void updateScore() { |
||||||
|
System.out.println("updateScore-------------------------------------------------"); |
||||||
|
List<NegativeBlame> negativeBlames = blameMapper.selectVerifyTrue(); |
||||||
|
String formula = "%s + (1 * %s) + (1 * %s)"; |
||||||
|
List<NegativeScorePolice> scorePolices = negativeBlames.stream().map(blame -> { |
||||||
|
Negative negative = negativeService.getById(blame.getNegativeId()); |
||||||
|
|
||||||
|
NegativeScorePolice negativeScorePolice = new NegativeScorePolice() |
||||||
|
.setNegativeId(blame.getNegativeId()) |
||||||
|
.setIdCode(blame.getBlameIdCode()) |
||||||
|
.setDiscoveryTime(negative.getDiscoveryTime()) |
||||||
|
.setIdCode(blame.getBlameIdCode()); |
||||||
|
List<NegativeProblemRelation> problems = problemRelationService.list(blame.getNegativeId(), blame.getBlameId()); |
||||||
|
List<String> codes = problems.stream().map(NegativeProblemRelation::getThreeLevelCode).toList(); |
||||||
|
if (codes.isEmpty()) { |
||||||
|
throw new RuntimeException("数据异常"); |
||||||
|
} |
||||||
|
SupDictProblemType problemType = supDictContentMapper.selectOneByMaxScore(codes); |
||||||
|
LocalDateTime endTime = negative.getDiscoveryTime(); |
||||||
|
LocalDateTime beginTime = endTime.minusYears(1); |
||||||
|
int frequency = blameService.countByTrue(blame.getBlameIdCode(), problemType.getParentCode(), beginTime, endTime); |
||||||
|
String expression = String.format(formula, |
||||||
|
problemType.getScore(), |
||||||
|
NegativeLevelEnum.GENERAL_IMPACT.getScore(), |
||||||
|
ScoreRule.getFrequencyScore(frequency)); |
||||||
|
negativeScorePolice.setExpression(expression); |
||||||
|
double calculate = NumberUtil.calculate(expression); |
||||||
|
double score = NumberUtil.roundHalfEven(calculate, 2).doubleValue(); |
||||||
|
negativeScorePolice.setScore(score); |
||||||
|
negativeScorePolice.setCreateTime(LocalDateTime.now()); |
||||||
|
return negativeScorePolice; |
||||||
|
}).toList(); |
||||||
|
if (!scorePolices.isEmpty()) { |
||||||
|
negativeScorePoliceService.saveBatch(scorePolices); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
package com.biutag.supervision.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.biutag.supervision.pojo.entity.NegativeScorePolice; |
||||||
|
|
||||||
|
public interface NegativeScorePoliceMapper extends BaseMapper<NegativeScorePolice> { |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,42 @@ |
|||||||
|
package com.biutag.supervision.pojo.dto.flow; |
||||||
|
|
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/11/8 |
||||||
|
*/ |
||||||
|
@Setter |
||||||
|
@Getter |
||||||
|
public class ConfirmationCompletionData { |
||||||
|
|
||||||
|
// 核查办理情况
|
||||||
|
private String verifySituation; |
||||||
|
|
||||||
|
// 佐证材料情况
|
||||||
|
private String verifyFileSituation; |
||||||
|
|
||||||
|
// 认定办结意见
|
||||||
|
private String completionComment; |
||||||
|
|
||||||
|
private List<Blame> blames = new ArrayList<>(); |
||||||
|
|
||||||
|
@Setter |
||||||
|
@Getter |
||||||
|
public static class Blame { |
||||||
|
|
||||||
|
private String blameIdCode; |
||||||
|
// 严重等级
|
||||||
|
private String negativeLevel; |
||||||
|
|
||||||
|
private Double baseScore = 0.0; |
||||||
|
|
||||||
|
private Double frequencyScore = 0.0; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,34 @@ |
|||||||
|
package com.biutag.supervision.pojo.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
@Accessors(chain = true) |
||||||
|
@Setter |
||||||
|
@Getter |
||||||
|
public class NegativeScorePolice { |
||||||
|
|
||||||
|
private String negativeId; |
||||||
|
|
||||||
|
private String idCode; |
||||||
|
|
||||||
|
//
|
||||||
|
@TableField("score") |
||||||
|
private Double score; |
||||||
|
|
||||||
|
// 问题发现时间
|
||||||
|
@TableField("discovery_time") |
||||||
|
private LocalDateTime discoveryTime; |
||||||
|
|
||||||
|
//
|
||||||
|
@TableField("create_time") |
||||||
|
private LocalDateTime createTime; |
||||||
|
|
||||||
|
// 计算公式
|
||||||
|
private String expression; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,65 @@ |
|||||||
|
package com.biutag.supervision.pojo.vo; |
||||||
|
|
||||||
|
import com.biutag.supervision.constants.enums.NegativeLevelEnum; |
||||||
|
import com.biutag.supervision.pojo.entity.NegativeProblemRelation; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 认定办结 赋分 |
||||||
|
* @author wxc |
||||||
|
* @date 2024/11/8 |
||||||
|
*/ |
||||||
|
@Setter |
||||||
|
@Getter |
||||||
|
public class NegativeConfirmationCompletionVo { |
||||||
|
|
||||||
|
private List<NegativeLevel> negativeLevels = List.of(new NegativeLevel(NegativeLevelEnum.GENERAL_IMPACT), new NegativeLevel(NegativeLevelEnum.SERIOUS_IMPACT), new NegativeLevel(NegativeLevelEnum.SIGNIFICANT_IMPACT)); |
||||||
|
|
||||||
|
private List<Blame> blames = new ArrayList<>(); |
||||||
|
@Setter |
||||||
|
@Getter |
||||||
|
public static class Blame { |
||||||
|
private String blameId; |
||||||
|
|
||||||
|
private String blameName; |
||||||
|
|
||||||
|
private String blameIdCode; |
||||||
|
|
||||||
|
private Double baseScore = 0.0; |
||||||
|
|
||||||
|
// 涉及警号
|
||||||
|
private String blameEmpNo; |
||||||
|
|
||||||
|
// 问题发生频次
|
||||||
|
private Integer frequency; |
||||||
|
|
||||||
|
// 问题发生频次系数
|
||||||
|
private Double frequencyScore = 0.0; |
||||||
|
|
||||||
|
// 问题发生率
|
||||||
|
private Double incidenceRate = 0.0; |
||||||
|
|
||||||
|
// 问题发生率系数
|
||||||
|
private Double incidenceRateScore = -0.15; |
||||||
|
|
||||||
|
private List<NegativeProblemRelation> problems = new ArrayList<>(); |
||||||
|
} |
||||||
|
|
||||||
|
@Setter |
||||||
|
@Getter |
||||||
|
@AllArgsConstructor |
||||||
|
public static class NegativeLevel { |
||||||
|
private String value; |
||||||
|
private Double score; |
||||||
|
|
||||||
|
public NegativeLevel(NegativeLevelEnum levelEnum) { |
||||||
|
this.value = levelEnum.getValue(); |
||||||
|
this.score = levelEnum.getScore(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,18 @@ |
|||||||
|
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.pojo.entity.NegativeScorePolice; |
||||||
|
import com.biutag.supervision.mapper.NegativeScorePoliceMapper; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Service |
||||||
|
public class NegativeScorePoliceService extends ServiceImpl<NegativeScorePoliceMapper, NegativeScorePolice> { |
||||||
|
|
||||||
|
public List<NegativeScorePolice> list(String negativeId) { |
||||||
|
return list(new LambdaQueryWrapper<NegativeScorePolice>().eq(NegativeScorePolice::getNegativeId, negativeId)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,33 @@ |
|||||||
|
package com.biutag.supervision.util; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/11/9 |
||||||
|
*/ |
||||||
|
public class ScoreRule { |
||||||
|
|
||||||
|
public static Double getFrequencyScore(Integer frequency) { |
||||||
|
if (frequency == 2) { |
||||||
|
return 0.1; |
||||||
|
} |
||||||
|
if (frequency >= 3) { |
||||||
|
return 0.3; |
||||||
|
} |
||||||
|
return 0.0; |
||||||
|
} |
||||||
|
|
||||||
|
public static Double getIncidenceFactor(Double incidenceRate, Double incidenceRateTied) { |
||||||
|
double b = incidenceRateTied * 0.8; |
||||||
|
double b1 = incidenceRateTied * 1.2; |
||||||
|
// 中等问题发生率 :平均问题发生率 × 0.8 < 问题发生率 ≤ 平均问题发生率 × 1.2
|
||||||
|
if (b < incidenceRate && incidenceRate <= b1) { |
||||||
|
return 0.0; |
||||||
|
} |
||||||
|
// 高问题发生率 问题发生率 > 平均问题发生率 × 1.2
|
||||||
|
if (incidenceRate > b1) { |
||||||
|
return 0.15; |
||||||
|
} |
||||||
|
return -0.15; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||||
|
<!DOCTYPE mapper |
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.biutag.supervision.mapper.SupDictContentMapper"> |
||||||
|
|
||||||
|
<select id="selectOneByMaxScore"> |
||||||
|
select * from sup_dict_problem_type where code in |
||||||
|
<foreach collection="codes" item="code" open="(" separator="," close=")"> |
||||||
|
#{ code } |
||||||
|
</foreach> |
||||||
|
order by score desc LIMIT 1 |
||||||
|
</select> |
||||||
|
|
||||||
|
</mapper> |
||||||
Loading…
Reference in new issue