Browse Source

Merge remote-tracking branch 'origin/master'

main
sjh 1 year ago
parent
commit
023fc2832f
  1. 2
      src/main/java/com/biutag/supervision/constants/enums/ProblemSourcesEnum.java
  2. 4
      src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelClueController.java
  3. 6
      src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelClueRecordController.java
  4. 2
      src/main/java/com/biutag/supervision/pojo/dto/NegativeDto.java
  5. 6
      src/main/java/com/biutag/supervision/pojo/entity/ModelClue.java
  6. 2
      src/main/java/com/biutag/supervision/pojo/entity/ModelClueRecord.java
  7. 1
      src/main/java/com/biutag/supervision/pojo/entity/ModelClueTask.java
  8. 19
      src/main/java/com/biutag/supervision/service/ModelClueService.java
  9. 6
      src/main/java/com/biutag/supervision/service/NegativeService.java
  10. 4
      src/main/java/com/biutag/supervision/support/ModelEditAspect.java

2
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;

4
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<Boolean> manuelDistribute(@RequestBody ModelClueTaskDistribute taskDistribute) {
return Result.success(modelClueService.distribution(taskDistribute));
}

6
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<ModelClueRecord>> list(@PathVariable Integer modelId) {
LambdaUpdateWrapper<ModelClueRecord> queryWrapper = new LambdaUpdateWrapper<ModelClueRecord>()
.set(ModelClueRecord::getModelId, modelId)
LambdaQueryWrapper<ModelClueRecord> queryWrapper = new LambdaQueryWrapper<ModelClueRecord>()
.eq(ModelClueRecord::getModelId, modelId)
.orderByDesc(ModelClueRecord::getCreateTime);
return Result.success(modelClueRecordService.page(new Page<>(1, 8), queryWrapper).getRecords());
}

2
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;

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

2
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-失败

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

19
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<ModelClueMapper, ModelClue> {
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<ModelClueMapper, ModelClue> {
List<ModelClue> 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<ModelClue> modelClues, Model model, String taskName) {
public boolean distribution(List<ModelClue> modelClues, Model model, String taskName, List<FileVo> thingFiles) {
LocalDateTime now = LocalDateTime.now();
modelClues.forEach(item -> {
if (Objects.isNull(item.getInvolveDepartId())) {
@ -102,8 +103,8 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
}
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<ModelClueMapper, ModelClue> {
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<ModelClueMapper, ModelClue> {
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<ModelClueMapper, ModelClue> {
}
return originalFieldName;
}
}

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

@ -143,6 +143,7 @@ public class NegativeService extends ServiceImpl<NegativeMapper, Negative> {
negative.setInvolveProblem(JSON.toJSONString(negativeDto.getInvolveProblem()));
}
save(negative);
negativeDto.setId(negative.getId());
if (!negativeDto.getThingFiles().isEmpty()) {
List<NegativeThingFile> files = negativeDto.getThingFiles().stream().map(item -> {
NegativeThingFile negativeThingFile = new NegativeThingFile();
@ -164,6 +165,7 @@ public class NegativeService extends ServiceImpl<NegativeMapper, Negative> {
.setUpdateTime(now)
.setCreateTime(now);
workService.save(work);
// 下发
FirstDistributeData firstDistributeData = new FirstDistributeData();
BeanUtil.copyProperties(negativeDto, firstDistributeData);
@ -247,8 +249,8 @@ public class NegativeService extends ServiceImpl<NegativeMapper, Negative> {
* @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<Negative>().eq(Negative::getOriginId, originId))) {

4
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---------------");
}

Loading…
Cancel
Save