Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/com/biutag/supervision/service/ModelClueService.java
main
sjh 1 year ago
parent
commit
1af481b05b
  1. 25
      src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelClueController.java
  2. 5
      src/main/java/com/biutag/supervision/controller/system/MenuController.java
  3. 27
      src/main/java/com/biutag/supervision/flow/action/ThreeSignReturnAction.java
  4. 9
      src/main/java/com/biutag/supervision/mapper/ModelClueMapper.java
  5. 49
      src/main/java/com/biutag/supervision/pojo/dto/ModelClueTaskDistribute.java
  6. 2
      src/main/java/com/biutag/supervision/pojo/entity/ModelClueTask.java
  7. 8
      src/main/java/com/biutag/supervision/pojo/model/ModelClueModel.java
  8. 3
      src/main/java/com/biutag/supervision/pojo/model/ModelClueTaskModel.java
  9. 3
      src/main/java/com/biutag/supervision/pojo/param/ModelClueQueryParam.java
  10. 63
      src/main/java/com/biutag/supervision/service/ModelClueService.java

25
src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelClueController.java

@ -2,15 +2,16 @@ package com.biutag.supervision.controller.sensitivePerception;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.pojo.Result;
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.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
/**
* @author wxc
@ -28,4 +29,22 @@ public class ModelClueController {
return Result.success(modelClueService.page(param));
}
@GetMapping("{id}")
public Result<ModelClueModel> page(@PathVariable Integer id) {
ModelClueModel modelClueModel = new ModelClueModel();
ModelClue modelClue = modelClueService.getById(id);
BeanUtils.copyProperties(modelClue, modelClueModel);
return Result.success(modelClueModel);
}
/**
* 手动分发
* @param taskDistribute
* @return
*/
@PostMapping("distribute/manuel")
public Result<Boolean> manuelDistribute(@RequestBody ModelClueTaskDistribute taskDistribute) {
return Result.success(modelClueService.distribution(taskDistribute));
}
}

5
src/main/java/com/biutag/supervision/controller/system/MenuController.java

@ -43,4 +43,9 @@ public class MenuController {
return Result.success();
}
@DeleteMapping("{id}")
public Result<Boolean> del(@PathVariable Integer id) {
return Result.success(menuService.removeById(id));
}
}

27
src/main/java/com/biutag/supervision/flow/action/ThreeSignReturnAction.java

@ -4,6 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.biutag.supervision.common.UserContextHolder;
import com.biutag.supervision.constants.AppConstants;
import com.biutag.supervision.constants.enums.FlowNodeEnum;
import com.biutag.supervision.constants.enums.ProcessingStatusEnum;
import com.biutag.supervision.constants.enums.RoleCodeEnum;
import com.biutag.supervision.constants.enums.WorkStatusEnum;
@ -37,23 +39,28 @@ public class ThreeSignReturnAction implements Action {
private final NegativeProblemRelationService problemRelationService;
private final NegativeWorkService negativeWorkService;
@Override
public void next(ActionDto actionDto) {
SignReturnData signReturnData = BeanUtil.toBean(actionDto.getData(), SignReturnData.class);
updateNegative(actionDto.getNegativeId(), actionDto.getNextFlowKey());
boolean secondFlag = negativeWorkService.exists(new LambdaQueryWrapper<NegativeWork>()
.eq(NegativeWork::getRoleCode, RoleCodeEnum.SECOND_ADMIN.getCode())
.eq(NegativeWork::getNegativeId, actionDto.getNegativeId()));
updateNegative(actionDto.getNegativeId(), secondFlag);
addSignReturn(actionDto, signReturnData.getComments());
doneWork(actionDto.getWorkId());
addWork(actionDto.getNegativeId(), RoleCodeEnum.SECOND_ADMIN.getCode());
addWork(actionDto.getNegativeId(), secondFlag);
}
public void updateNegative(String negativeId, String nextFlowKey) {
public void updateNegative(String negativeId, boolean secondFlag) {
Negative negative = negativeService.getById(negativeId);
negativeService.update(new LambdaUpdateWrapper<Negative>()
.set(Negative::getFlowKey, nextFlowKey)
.set(Negative::getFlowKey, secondFlag ? FlowNodeEnum.SECOND_SIGN.getKey() : FlowNodeEnum.FIRST_DISTRIBUTE.getKey())
.set(Negative::getUpdTime, LocalDateTime.now())
.set(Negative::getProcessingStatus, ProcessingStatusEnum.signing.name())
// 当前处理对象
.set(Negative::getCurrentProcessingObject, String.format("%s专班", negative.getHandleSecondDepartName()))
.set(Negative::getCurrentProcessingObject, secondFlag ? String.format("%s专班", negative.getHandleSecondDepartName()) : "市局专班")
//-----------------------------------------------------------------------------
.set(Negative::getCheckStatus, null)
.set(Negative::getCheckStatusName, null)
@ -90,8 +97,11 @@ public class ThreeSignReturnAction implements Action {
.eq(NegativeWork::getId, workId));
}
public void addWork(String negativeId, String roleCode) {
NegativeWork work = workService.getOne(new LambdaQueryWrapper<NegativeWork>().eq(NegativeWork::getNegativeId, negativeId).eq(NegativeWork::getRoleCode, roleCode));
public void addWork(String negativeId, boolean secondFlag) {
String roleCode = secondFlag ? RoleCodeEnum.SECOND_ADMIN.getCode() : RoleCodeEnum.FIRST_ADMIN.getCode();
NegativeWork work = workService.getOne(new LambdaQueryWrapper<NegativeWork>()
.eq(NegativeWork::getNegativeId, negativeId)
.eq(NegativeWork::getRoleCode, roleCode));
if (Objects.nonNull(work)) {
work.setUpdateTime(LocalDateTime.now())
.setStatus(WorkStatusEnum.todo.name());
@ -101,7 +111,8 @@ public class ThreeSignReturnAction implements Action {
work = new NegativeWork()
.setNegativeId(negativeId)
.setRoleCode(roleCode)
.setDepartId(secondFlag ? negative.getHandleSecondDepartId() : AppConstants.ROOT_DEPART_ID)
.setDepartName(secondFlag ? negative.getHandleSecondDepartName() : AppConstants.ROOT_DEPART_NAME)
.setProblemSourcesCode(negative.getProblemSourcesCode())
.setCreateTime(LocalDateTime.now())
.setUpdateTime(LocalDateTime.now())

9
src/main/java/com/biutag/supervision/mapper/ModelClueMapper.java

@ -1,8 +1,17 @@
package com.biutag.supervision.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.pojo.entity.ModelClue;
import com.biutag.supervision.pojo.model.ModelClueModel;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
public interface ModelClueMapper extends BaseMapper<ModelClue> {
@Select("select *, m.model_name from model_clue mc left join model m on mc.model_id = m.id ${ew.getCustomSqlSegment}")
Page<ModelClueModel> queryPage(@Param("page") Page<ModelClue> page, @Param(Constants.WRAPPER) QueryWrapper<ModelClue> queryWrapper);
}

49
src/main/java/com/biutag/supervision/pojo/dto/ModelClueTaskDistribute.java

@ -0,0 +1,49 @@
package com.biutag.supervision.pojo.dto;
import com.biutag.supervision.pojo.entity.ModelClue;
import com.biutag.supervision.pojo.model.ModelClueModel;
import com.biutag.supervision.pojo.vo.FileVo;
import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
/**
* 模型线索手动分发
* @author wxc
* @date 2024/10/18
*/
@Setter
@Getter
public class ModelClueTaskDistribute {
private List<ModelClue> modelClues = new ArrayList<>();
private String taskName;
// 办理时限
@NotBlank
private String timeLimit;
// 最大签收时长(天)
private Integer maxSignDuration;
// 最大办理时长(天)
private Integer maxHandleDuration;
// 最大延期时长(天)
private Integer maxExtensionDuration;
// 下发流程
private String distributionFlow;
// 审批流程
@NotBlank
private String approvalFlow;
private List<FileVo> thingFiles = new ArrayList<>();
}

2
src/main/java/com/biutag/supervision/pojo/entity/ModelClueTask.java

@ -3,7 +3,6 @@ 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;
@ -27,7 +26,6 @@ public class ModelClueTask {
// 下发时间
@TableField("distribution_time")
@JsonFormat(pattern = "YYYY-MM-dd HH:mm")
private LocalDateTime distributionTime;
// 条数

8
src/main/java/com/biutag/supervision/pojo/model/ModelClueModel.java

@ -21,9 +21,16 @@ public class ModelClueModel {
private String modelName;
private String involveDepartId;
// 涉及单位
private String involveDepartName;
// 涉及人员
private String involvePoliceName;
// 涉及人员警号
private String involvePoliceEmpNo;
// 预警内容
private String thingDesc;
@ -36,4 +43,5 @@ public class ModelClueModel {
private String data;
}

3
src/main/java/com/biutag/supervision/pojo/model/ModelClueTaskModel.java

@ -1,5 +1,6 @@
package com.biutag.supervision.pojo.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
@ -22,11 +23,11 @@ public class ModelClueTaskModel {
private String modelName;
// 下发时间
@JsonFormat(pattern = "YYYY-MM-dd HH:mm")
private LocalDateTime distributionTime;
// 条数
private String size;
private LocalDateTime createTime;
}

3
src/main/java/com/biutag/supervision/pojo/param/ModelClueQueryParam.java

@ -17,7 +17,7 @@ import java.util.List;
@Setter
@Getter
public class ModelClueQueryParam extends BasePage {
private Integer modelId;
private List<Integer> modelIds;
private String modelType;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ -25,4 +25,5 @@ public class ModelClueQueryParam extends BasePage {
private Integer involveDepartId;
private String thingDesc;
private String distributionState;
private String distributionMethod;
}

63
src/main/java/com/biutag/supervision/service/ModelClueService.java

@ -1,13 +1,14 @@
package com.biutag.supervision.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.supervision.constants.enums.*;
import com.biutag.supervision.mapper.*;
import com.biutag.supervision.pojo.dto.ModelClueTaskDistribute;
import com.biutag.supervision.pojo.dto.NegativeDto;
import com.biutag.supervision.pojo.entity.*;
import com.biutag.supervision.pojo.model.ModelClueModel;
@ -19,6 +20,10 @@ import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.*;
@ -48,38 +53,49 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
public final SupDepartMapper supDepartMapper;
public Page<ModelClueModel> page(ModelClueQueryParam param) {
LambdaQueryWrapper<ModelClue> queryWrapper = new LambdaQueryWrapper<ModelClue>()
.eq(Objects.nonNull(param.getInvolveDepartId()), ModelClue::getInvolveDepartId, param.getInvolveDepartId())
.eq(StrUtil.isNotBlank(param.getDistributionState()), ModelClue::getDistributionState, param.getDistributionState())
.like(StrUtil.isNotBlank(param.getThingDesc()), ModelClue::getThingDesc, param.getThingDesc())
.orderByDesc(ModelClue::getCreateTime);
if (Objects.nonNull(param.getCreateTime()) && param.getCreateTime().size() == 2) {
queryWrapper.between(ModelClue::getCreateTime, param.getCreateTime().get(0), param.getCreateTime().get(1));
if (Objects.nonNull(param.getModelIds()) && param.getModelIds().isEmpty()) {
return new Page<ModelClueModel>().setTotal(0).setRecords(new ArrayList<>());
}
Page<ModelClue> page = page(Page.of(param.getCurrent(), param.getSize()), queryWrapper);
if (page.getRecords().isEmpty()) {
return new Page<ModelClueModel>().setRecords(new ArrayList<>()).setTotal(0);
QueryWrapper<ModelClue> queryWrapper = new QueryWrapper<ModelClue>()
.eq(StrUtil.isNotBlank(param.getDistributionMethod()), "m.distribution_method", param.getDistributionMethod())
.in(Objects.nonNull(param.getModelIds()) && !param.getModelIds().isEmpty(), "mc.model_id", param.getModelIds())
.eq(Objects.nonNull(param.getInvolveDepartId()), "mc.involve_depart_id", param.getInvolveDepartId())
.eq(StrUtil.isNotBlank(param.getDistributionState()), "mc.distribution_state", param.getDistributionState())
.like(StrUtil.isNotBlank(param.getThingDesc()), "mc.thing_desc", param.getThingDesc())
.orderByDesc("mc.create_time");
if (Objects.nonNull(param.getCreateTime()) && param.getCreateTime().size() == 2) {
queryWrapper.between("mc.create_time", param.getCreateTime().get(0), param.getCreateTime().get(1));
}
Set<Integer> modelIds = page.getRecords().stream().map(ModelClue::getModelId).collect(Collectors.toSet());
List<Model> models = modelMapper.selectBatchIds(modelIds);
List<ModelClueModel> list = page.getRecords().stream().map(item -> {
ModelClueModel modelClueModel = new ModelClueModel();
BeanUtil.copyProperties(item, modelClueModel);
String modelName = models.stream().filter(model -> model.getId().equals(item.getModelId())).findFirst().map(Model::getModelName).orElse("");
modelClueModel.setModelName(modelName);
return modelClueModel;
}).toList();
return new Page<ModelClueModel>().setRecords(list).setTotal(page.getTotal());
return baseMapper.queryPage(Page.of(param.getCurrent(), param.getSize()), queryWrapper);
}
public List<ModelClue> listByUnDistributed(Integer modelId) {
return list(new LambdaQueryWrapper<ModelClue>().eq(ModelClue::getModelId, modelId).eq(ModelClue::getDistributionState, ModelDistributionStateEnum.UNDISTRIBUTED.getValue()));
}
@Transactional(rollbackFor = Exception.class)
public boolean distribution(ModelClueTaskDistribute taskDistribute) {
List<ModelClue> modelClues = taskDistribute.getModelClues();
Model model = modelMapper.selectById(modelClues.get(0).getModelId());
model.setTimeLimit(taskDistribute.getTimeLimit());
model.setMaxSignDuration(taskDistribute.getMaxSignDuration());
model.setMaxHandleDuration(taskDistribute.getMaxHandleDuration());
model.setMaxExtensionDuration(taskDistribute.getMaxExtensionDuration());
model.setApprovalFlow(taskDistribute.getApprovalFlow());
model.setDistributionFlow(taskDistribute.getDistributionFlow());
return distribution(modelClues, model, taskDistribute.getTaskName());
}
public boolean distribution(Integer modelId) {
List<ModelClue> modelClues = listByUnDistributed(modelId);
Model model = modelMapper.selectById(modelId);
String taskName = "自动下发";
return distribution(modelClues, model, taskName);
}
@Transactional(rollbackFor = Exception.class)
public boolean distribution(List<ModelClue> modelClues, Model model, String taskName) {
LocalDateTime now = LocalDateTime.now();
modelClues.forEach(item -> {
if (Objects.isNull(item.getInvolveDepartId())) {
@ -130,7 +146,8 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
updateById(item);
});
ModelClueTask modelClueTask = new ModelClueTask();
modelClueTask.setModelId(modelId);
modelClueTask.setTaskName(taskName);
modelClueTask.setModelId(model.getId());
modelClueTask.setSize(modelClues.size());
modelClueTask.setDistributionTime(now);
// 下发方式

Loading…
Cancel
Save