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 8961003..77495c0 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 @@ -64,4 +67,7 @@ public class ModelClue { @TableField("unique_key") 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 a281f76..8cc36e2 100644 --- a/src/main/java/com/biutag/supervision/service/ModelClueService.java +++ b/src/main/java/com/biutag/supervision/service/ModelClueService.java @@ -14,6 +14,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; @@ -82,7 +83,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()); } @@ -90,11 +91,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())) { @@ -102,8 +103,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()); @@ -120,16 +121,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()); @@ -142,6 +143,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(); @@ -264,4 +266,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---------------"); }