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 af86f4a..b34fe77 100644 --- a/src/main/java/com/biutag/supervision/controller/sensitiveperception/ModelController.java +++ b/src/main/java/com/biutag/supervision/controller/sensitiveperception/ModelController.java @@ -40,6 +40,7 @@ public class ModelController { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper .like(StrUtil.isNotBlank(queryParam.getModelName()), Model::getModelName, queryParam.getModelName()) + .eq(StrUtil.isNotBlank(queryParam.getModelDataType()), Model::getModelDataType, queryParam.getModelDataType()) .eq(StrUtil.isNotBlank(queryParam.getDistributionMethod()), Model::getDistributionMethod, queryParam.getDistributionMethod()) .eq(Objects.nonNull(queryParam.getClassId()), Model::getClassId, queryParam.getClassId()) .orderByDesc(Model::getCreateTime); 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 38d63e8..87dfa05 100644 --- a/src/main/java/com/biutag/supervision/controller/sensitiveperception/ProfileDepartController.java +++ b/src/main/java/com/biutag/supervision/controller/sensitiveperception/ProfileDepartController.java @@ -174,7 +174,7 @@ public class ProfileDepartController { List negativeProfiles = negatives.stream().map(item -> { NegativeProfile negativeProfile = new NegativeProfile(); BeanUtil.copyProperties(item, negativeProfile); - String problemType = negativeProblemRelations.stream().filter(p -> item.getId().equals(p.getNegativeId())).findFirst().map(p -> p.getOneLevelContent() + " / " + p.getTwoLevelContent() + " / " + p.getThreeLevelContent()).orElse(""); + String problemType = negativeProblemRelations.stream().filter(p -> item.getId().equals(p.getNegativeId())).findFirst().map(negativeProblemRelationService::getProblemType).orElse(""); negativeProfile.setProblemType(problemType); negativeProfile.setScore(list.stream().filter(s -> item.getId().equals(s.getNegativeId())).findFirst().map(NegativeScoreDepart::getScore).orElse(null)); return negativeProfile; 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 855b6ef..06e3651 100644 --- a/src/main/java/com/biutag/supervision/controller/sensitiveperception/ProfilePoliceController.java +++ b/src/main/java/com/biutag/supervision/controller/sensitiveperception/ProfilePoliceController.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -53,7 +54,6 @@ public class ProfilePoliceController { private final NegativeBlameService negativeBlameService; private final NegativeService negativeService; - private final NegativeScoreService negativeScoreService; private final NegativeScorePoliceService negativeScorePoliceService; private final NegativeProblemRelationService negativeProblemRelationService; @@ -130,10 +130,6 @@ public class ProfilePoliceController { problemSourcesGroup.get(key).size())).toList(); profilePolice.setProblemSourcesList(problemSourcesList); // 问题类型占比 - List blameIds = negativeBlameService.list(new LambdaQueryWrapper() - .in(NegativeBlame::getNegativeId, negativeIds) - .eq(NegativeBlame::getBlameIdCode, idCode)) - .stream().map(NegativeBlame::getBlameId).toList(); List problemRelations = negativeProblemRelationService.list(new LambdaQueryWrapper() .in(NegativeProblemRelation::getNegativeId, negativeIds)); Map> groups = problemRelations.stream().collect(Collectors.groupingBy(NegativeProblemRelation::getOneLevelContent)); @@ -154,7 +150,7 @@ public class ProfilePoliceController { List negativeProfiles = negatives.stream().map(item -> { NegativeProfile negativeProfile = new NegativeProfile(); BeanUtil.copyProperties(item, negativeProfile); - String problemType = problemRelations.stream().filter(p -> item.getId().equals(p.getNegativeId())).findFirst().map(p -> p.getOneLevelContent() + " / " + p.getTwoLevelContent() + " / " + p.getThreeLevelContent()).orElse(""); + String problemType = problemRelations.stream().filter(p -> item.getId().equals(p.getNegativeId())).findFirst().map(negativeProblemRelationService::getProblemType).orElse(""); negativeProfile.setProblemType(problemType); negativeProfile.setScore(negativeScorePolices.stream().filter(s -> item.getId().equals(s.getNegativeId())).findFirst().map(NegativeScorePolice::getScore).orElse(null)); return negativeProfile; diff --git a/src/main/java/com/biutag/supervision/controller/work/AlarmNotificationController.java b/src/main/java/com/biutag/supervision/controller/work/AlarmNotificationController.java index fe44344..95f1a1f 100644 --- a/src/main/java/com/biutag/supervision/controller/work/AlarmNotificationController.java +++ b/src/main/java/com/biutag/supervision/controller/work/AlarmNotificationController.java @@ -13,7 +13,6 @@ import com.biutag.supervision.pojo.param.AlarmParam; import com.biutag.supervision.service.AlarmFileService; import com.biutag.supervision.service.AlarmNotificationService; import com.biutag.supervision.service.SupDepartService; -import com.biutag.supervision.util.JSON; import jakarta.validation.Valid; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/src/main/java/com/biutag/supervision/flow/action/ConfirmationCompletionAction.java b/src/main/java/com/biutag/supervision/flow/action/ConfirmationCompletionAction.java index 501db86..ead16c8 100644 --- a/src/main/java/com/biutag/supervision/flow/action/ConfirmationCompletionAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/ConfirmationCompletionAction.java @@ -50,30 +50,35 @@ public class ConfirmationCompletionAction implements Action { doneWork(actionDto.getWorkId(), actionDto.getNegativeId()); // 最后更新状态 updateNegative(negativeId, completionData); + + addNegativeScorePolice(negativeId, completionData); } public void addNegativeScorePolice(String negativeId, ConfirmationCompletionData completionData) { - String formula = "%s + (1 * %s) + (1 * %s)"; Negative negative = negativeService.getById(negativeId); - List 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); + // 属实 + if (InspectCaseEnum.isItTure(negative.getCheckStatus())) { + String formula = "%s + (1 * %s) + (1 * %s)"; + List 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) { diff --git a/src/main/java/com/biutag/supervision/pojo/entity/AlarmNotification.java b/src/main/java/com/biutag/supervision/pojo/entity/AlarmNotification.java index 01a2418..06cb8b4 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/AlarmNotification.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/AlarmNotification.java @@ -164,5 +164,5 @@ public class AlarmNotification implements Serializable { // 通知回复时限 private Integer replyLimit; - + private Integer modelId; } diff --git a/src/main/java/com/biutag/supervision/pojo/param/AlarmParam.java b/src/main/java/com/biutag/supervision/pojo/param/AlarmParam.java index d13a17b..840d080 100644 --- a/src/main/java/com/biutag/supervision/pojo/param/AlarmParam.java +++ b/src/main/java/com/biutag/supervision/pojo/param/AlarmParam.java @@ -13,6 +13,8 @@ import java.io.Serial; import java.io.Serializable; import java.time.LocalDate; import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Date; import java.util.List; /** @@ -24,27 +26,11 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public class AlarmParam extends BasePage implements Serializable { - @Serial - private static final long serialVersionUID = 1L; - /** - * 预警类型id - */ - Long alarmTypeId; - /** - * 预警开始时间 - */ - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss") - @JsonDeserialize(using = LocalDateTimeDeserializer.class) - @JsonSerialize(using = LocalDateTimeSerializer.class) - LocalDateTime startTime; - /** * 预警开始时间 */ - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss") - @JsonDeserialize(using = LocalDateTimeDeserializer.class) - @JsonSerialize(using = LocalDateTimeSerializer.class) - LocalDateTime endTime; + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private List alarmTime = new ArrayList<>(); /** * 回复情况0-未回复 1-已回复 @@ -59,4 +45,8 @@ public class AlarmParam extends BasePage implements Serializable { */ String alarmContent; + private Integer modelId; + + private Integer alarmTypeId; + } diff --git a/src/main/java/com/biutag/supervision/pojo/param/ModelQueryParam.java b/src/main/java/com/biutag/supervision/pojo/param/ModelQueryParam.java index c7ffaec..00f9433 100644 --- a/src/main/java/com/biutag/supervision/pojo/param/ModelQueryParam.java +++ b/src/main/java/com/biutag/supervision/pojo/param/ModelQueryParam.java @@ -12,4 +12,6 @@ public class ModelQueryParam extends BasePage { private String distributionMethod; private Integer classId; + + private String modelDataType; } diff --git a/src/main/java/com/biutag/supervision/service/AlarmNotificationService.java b/src/main/java/com/biutag/supervision/service/AlarmNotificationService.java index 5430da8..e65d710 100644 --- a/src/main/java/com/biutag/supervision/service/AlarmNotificationService.java +++ b/src/main/java/com/biutag/supervision/service/AlarmNotificationService.java @@ -1,6 +1,7 @@ package com.biutag.supervision.service; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -19,6 +20,7 @@ import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; +import java.util.Objects; /** * @author kami on 2024-11-16 11:07:43 @@ -39,11 +41,9 @@ public class AlarmNotificationService extends ServiceImpl pages(AlarmParam param) { LambdaQueryWrapper query = new LambdaQueryWrapper<>(); - if(param.getAlarmTypeId() != null && param.getAlarmTypeId() != -1) { - query.eq(AlarmNotification::getAlarmTypeId, param.getAlarmTypeId()); - } - if(param.getStartTime() != null) { - query.between(AlarmNotification::getAlarmTime, param.getStartTime(), param.getEndTime()); + query.eq(Objects.nonNull(param.getAlarmTypeId()) && param.getAlarmTypeId() == 3 && Objects.nonNull(param.getModelId()), AlarmNotification::getModelId, param.getModelId()); + if (CollectionUtil.isNotEmpty(param.getAlarmTime()) && param.getAlarmTime().size() == 2) { + query.between(AlarmNotification::getAlarmTime, param.getAlarmTime().get(0), param.getAlarmTime().get(1)); } if(param.getReplyState() != null && param.getReplyState() != -1) { query.eq(AlarmNotification::getReplyState, param.getReplyState()); diff --git a/src/main/java/com/biutag/supervision/service/NegativeProblemRelationService.java b/src/main/java/com/biutag/supervision/service/NegativeProblemRelationService.java index 453ace7..483988a 100644 --- a/src/main/java/com/biutag/supervision/service/NegativeProblemRelationService.java +++ b/src/main/java/com/biutag/supervision/service/NegativeProblemRelationService.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.pojo.entity.NegativeBlame; @@ -25,4 +26,8 @@ public class NegativeProblemRelationService extends ServiceImpl - 刘新良 + XXX