From 4f7c780004a4540fcccf4231b6c94d31dcc5c346 Mon Sep 17 00:00:00 2001 From: wxc <191104855@qq.com> Date: Mon, 21 Oct 2024 18:00:33 +0800 Subject: [PATCH] =?UTF-8?q?fit:=20=E6=A8=A1=E5=9E=8B=E7=BA=BF=E7=B4=A2?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E5=88=86=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constants/enums/ProblemSourcesEnum.java | 2 +- .../ModelClueController.java | 4 +--- .../ModelClueRecordController.java | 6 ++++-- .../supervision/pojo/dto/NegativeDto.java | 2 ++ .../supervision/pojo/entity/ModelClue.java | 6 ++++++ .../pojo/entity/ModelClueRecord.java | 2 ++ .../pojo/entity/ModelClueTask.java | 1 - .../supervision/service/ModelClueService.java | 19 +++++++++++-------- .../supervision/service/NegativeService.java | 6 ++++-- .../supervision/support/ModelEditAspect.java | 4 ++++ 10 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/biutag/supervision/constants/enums/ProblemSourcesEnum.java b/src/main/java/com/biutag/supervision/constants/enums/ProblemSourcesEnum.java index 9cfc09b..82bf7e8 100644 --- a/src/main/java/com/biutag/supervision/constants/enums/ProblemSourcesEnum.java +++ b/src/main/java/com/biutag/supervision/constants/enums/ProblemSourcesEnum.java @@ -29,7 +29,7 @@ public enum ProblemSourcesEnum { CFJD("持法监督", "4"), JCKH("检查考核", "8"), QT("其他", "9"), - MXCS("模型超市", "10"); + LMGZ("灵敏感知", "27"); private String label; diff --git a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelClueController.java b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelClueController.java index 76dd6bf..642e378 100644 --- a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelClueController.java +++ b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelClueController.java @@ -6,9 +6,7 @@ import com.biutag.supervision.pojo.dto.ModelClueTaskDistribute; import com.biutag.supervision.pojo.entity.ModelClue; import com.biutag.supervision.pojo.model.ModelClueModel; import com.biutag.supervision.pojo.param.ModelClueQueryParam; -import com.biutag.supervision.pojo.param.ModelQueryParam; import com.biutag.supervision.service.ModelClueService; -import io.swagger.v3.oas.annotations.parameters.RequestBody; import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.web.bind.annotation.*; @@ -42,7 +40,7 @@ public class ModelClueController { * @param taskDistribute * @return */ - @PostMapping("distribute/manuel") + @PostMapping("task/distribute/manuel") public Result manuelDistribute(@RequestBody ModelClueTaskDistribute taskDistribute) { return Result.success(modelClueService.distribution(taskDistribute)); } diff --git a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelClueRecordController.java b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelClueRecordController.java index 86fdbcc..8be86bb 100644 --- a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelClueRecordController.java +++ b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelClueRecordController.java @@ -1,5 +1,7 @@ package com.biutag.supervision.controller.sensitivePerception; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.biutag.supervision.pojo.Result; @@ -26,8 +28,8 @@ public class ModelClueRecordController { @GetMapping("/{modelId}/top") public Result> list(@PathVariable Integer modelId) { - LambdaUpdateWrapper queryWrapper = new LambdaUpdateWrapper() - .set(ModelClueRecord::getModelId, modelId) + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .eq(ModelClueRecord::getModelId, modelId) .orderByDesc(ModelClueRecord::getCreateTime); return Result.success(modelClueRecordService.page(new Page<>(1, 8), queryWrapper).getRecords()); } diff --git a/src/main/java/com/biutag/supervision/pojo/dto/NegativeDto.java b/src/main/java/com/biutag/supervision/pojo/dto/NegativeDto.java index 8dceeb5..0a46704 100644 --- a/src/main/java/com/biutag/supervision/pojo/dto/NegativeDto.java +++ b/src/main/java/com/biutag/supervision/pojo/dto/NegativeDto.java @@ -16,6 +16,8 @@ import java.util.Map; @Getter public class NegativeDto { + private String id; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm") private LocalDateTime happenTime; diff --git a/src/main/java/com/biutag/supervision/pojo/entity/ModelClue.java b/src/main/java/com/biutag/supervision/pojo/entity/ModelClue.java index 4c13b6b..640b4b1 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/ModelClue.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/ModelClue.java @@ -3,6 +3,7 @@ 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; @@ -44,9 +45,11 @@ public class ModelClue { private String distributionState; @TableField("create_time") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm") private LocalDateTime createTime; @TableField("update_time") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm") private LocalDateTime updateTime; // 数据详情 JSON @@ -55,4 +58,7 @@ public class ModelClue { @TableField(exist = false) private String uniqueKey; + // 问题ID + private String negativeId; + } \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/entity/ModelClueRecord.java b/src/main/java/com/biutag/supervision/pojo/entity/ModelClueRecord.java index 159f355..5888f89 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/ModelClueRecord.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/ModelClueRecord.java @@ -3,6 +3,7 @@ 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 lombok.experimental.Accessors; @@ -27,6 +28,7 @@ public class ModelClueRecord { // 创建时间 @TableField("create_time") + @JsonFormat(pattern = "YYYY-MM-dd HH:mm") private LocalDateTime createTime; // 状态 success-成功 fail-失败 diff --git a/src/main/java/com/biutag/supervision/pojo/entity/ModelClueTask.java b/src/main/java/com/biutag/supervision/pojo/entity/ModelClueTask.java index d8a14b2..eb92b2a 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/ModelClueTask.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/ModelClueTask.java @@ -32,7 +32,6 @@ public class ModelClueTask { @TableField("size") private Integer size; - private String distributionMethod; } \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/service/ModelClueService.java b/src/main/java/com/biutag/supervision/service/ModelClueService.java index 7a8f524..8d39d6a 100644 --- a/src/main/java/com/biutag/supervision/service/ModelClueService.java +++ b/src/main/java/com/biutag/supervision/service/ModelClueService.java @@ -13,6 +13,7 @@ import com.biutag.supervision.pojo.dto.NegativeDto; import com.biutag.supervision.pojo.entity.*; import com.biutag.supervision.pojo.model.ModelClueModel; import com.biutag.supervision.pojo.param.ModelClueQueryParam; +import com.biutag.supervision.pojo.vo.FileVo; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -83,7 +84,7 @@ public class ModelClueService extends ServiceImpl { model.setApprovalFlow(taskDistribute.getApprovalFlow()); model.setDistributionFlow(taskDistribute.getDistributionFlow()); - return distribution(modelClues, model, taskDistribute.getTaskName()); + return distribution(modelClues, model, taskDistribute.getTaskName(), taskDistribute.getThingFiles()); } @@ -91,11 +92,11 @@ public class ModelClueService extends ServiceImpl { List modelClues = listByUnDistributed(modelId); Model model = modelMapper.selectById(modelId); String taskName = "自动下发"; - return distribution(modelClues, model, taskName); + return distribution(modelClues, model, taskName, new ArrayList<>()); } @Transactional(rollbackFor = Exception.class) - public boolean distribution(List modelClues, Model model, String taskName) { + public boolean distribution(List modelClues, Model model, String taskName, List thingFiles) { LocalDateTime now = LocalDateTime.now(); modelClues.forEach(item -> { if (Objects.isNull(item.getInvolveDepartId())) { @@ -103,8 +104,8 @@ public class ModelClueService extends ServiceImpl { } NegativeDto negative = new NegativeDto(); // 问题来源 - negative.setProblemSourcesCode(ProblemSourcesEnum.MXCS.getValue()); - negative.setProblemSourcesCode(ProblemSourcesEnum.MXCS.getLabel()); + negative.setProblemSources(ProblemSourcesEnum.LMGZ.getLabel()); + negative.setProblemSourcesCode(ProblemSourcesEnum.LMGZ.getValue()); // TODO 业务类别 涉及问题 // 涉及单位 negative.setInvolveDepartId(item.getInvolveDepartId()); @@ -121,16 +122,16 @@ public class ModelClueService extends ServiceImpl { SupDepart depart = departService.getById(item.getInvolveDepartId()); if (depart.getLevel().equals(DepartLevelEnum.SECOND.getValue())) { negative.setDepartId(depart.getId()); - negative.setDepartId(depart.getName()); + negative.setDepartName(depart.getName()); } if (depart.getLevel().equals(DepartLevelEnum.THREE.getValue()) && Objects.equals(model.getDistributionFlow(), DistributionFlowEnum.SECOND.getValue())) { SupDepart parentDepart = departService.getParentDepart(item.getInvolveDepartId()); negative.setDepartId(parentDepart.getId()); - negative.setDepartId(parentDepart.getName()); + negative.setDepartName(parentDepart.getName()); } if (depart.getLevel().equals(DepartLevelEnum.THREE.getValue()) && Objects.equals(model.getDistributionFlow(), DistributionFlowEnum.THIRD.getValue())) { negative.setDepartId(depart.getId()); - negative.setDepartId(depart.getName()); + negative.setDepartName(depart.getName()); } negative.setTimeLimit(model.getTimeLimit()); negative.setMaxSignDuration(model.getMaxSignDuration()); @@ -143,6 +144,7 @@ public class ModelClueService extends ServiceImpl { item.setDistributionState(ModelDistributionStateEnum.DISTRIBUTED.getValue()); item.setUpdateTime(LocalDateTime.now()); + item.setNegativeId(negative.getId()); updateById(item); }); ModelClueTask modelClueTask = new ModelClueTask(); @@ -254,4 +256,5 @@ public class ModelClueService extends ServiceImpl { } return originalFieldName; } + } diff --git a/src/main/java/com/biutag/supervision/service/NegativeService.java b/src/main/java/com/biutag/supervision/service/NegativeService.java index cb1e723..e202436 100644 --- a/src/main/java/com/biutag/supervision/service/NegativeService.java +++ b/src/main/java/com/biutag/supervision/service/NegativeService.java @@ -143,6 +143,7 @@ public class NegativeService extends ServiceImpl { negative.setInvolveProblem(JSON.toJSONString(negativeDto.getInvolveProblem())); } save(negative); + negativeDto.setId(negative.getId()); if (!negativeDto.getThingFiles().isEmpty()) { List files = negativeDto.getThingFiles().stream().map(item -> { NegativeThingFile negativeThingFile = new NegativeThingFile(); @@ -164,6 +165,7 @@ public class NegativeService extends ServiceImpl { .setUpdateTime(now) .setCreateTime(now); workService.save(work); + // 下发 FirstDistributeData firstDistributeData = new FirstDistributeData(); BeanUtil.copyProperties(negativeDto, firstDistributeData); @@ -247,8 +249,8 @@ public class NegativeService extends ServiceImpl { * @return */ public String generateOriginId(String problemSourcesCode, String businessTypeCode) { - String originId = String.format("%s_%s_%s%s", ProblemSourcesEnum.get(problemSourcesCode).name(), - BusinessTypeEnum.get(businessTypeCode).getKey(), + String originId = String.format("%s_%s_%s%s", StrUtil.isBlank(problemSourcesCode) ? "" : ProblemSourcesEnum.get(problemSourcesCode).name(), + StrUtil.isBlank(businessTypeCode) ? "" : BusinessTypeEnum.get(businessTypeCode).getKey(), DateUtil.format(new Date(), DatePattern.PURE_DATE_FORMAT), RandomUtil.randomString(4)); if (exists(new LambdaUpdateWrapper().eq(Negative::getOriginId, originId))) { diff --git a/src/main/java/com/biutag/supervision/support/ModelEditAspect.java b/src/main/java/com/biutag/supervision/support/ModelEditAspect.java index 07ede38..69e270c 100644 --- a/src/main/java/com/biutag/supervision/support/ModelEditAspect.java +++ b/src/main/java/com/biutag/supervision/support/ModelEditAspect.java @@ -1,5 +1,6 @@ package com.biutag.supervision.support; +import com.biutag.supervision.constants.enums.DistributionMethodEnum; import com.biutag.supervision.pojo.entity.Model; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -31,6 +32,9 @@ public class ModelEditAspect { @After("saveMethod() || updateMethod()") public void afterSaveOrUpdateAdvice(JoinPoint joinPoint) { Model model = (Model) joinPoint.getArgs()[0]; + if (!DistributionMethodEnum.NEGATIVE_DISTRIBUTE.getValue().equals(model.getDistributionMethod())) { + return; + } modelClueDistributionAware.put(model); log.info("afterSaveOrUpdateAdvice---------------"); }