From 5217d0ce6938357ed91eda87401e27bba55cbece Mon Sep 17 00:00:00 2001 From: wxc <191104855@qq.com> Date: Fri, 18 Oct 2024 16:23:46 +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 --- .../ModelClueController.java | 25 +++++++- .../controller/system/MenuController.java | 5 ++ .../flow/action/ThreeSignReturnAction.java | 27 +++++--- .../supervision/mapper/ModelClueMapper.java | 9 +++ .../pojo/dto/ModelClueTaskDistribute.java | 49 ++++++++++++++ .../pojo/entity/ModelClueTask.java | 2 - .../pojo/model/ModelClueModel.java | 8 +++ .../pojo/model/ModelClueTaskModel.java | 3 +- .../pojo/param/ModelClueQueryParam.java | 3 +- .../supervision/service/ModelClueService.java | 64 ++++++++++++------- 10 files changed, 156 insertions(+), 39 deletions(-) create mode 100644 src/main/java/com/biutag/supervision/pojo/dto/ModelClueTaskDistribute.java 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 a60df60..76dd6bf 100644 --- a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelClueController.java +++ b/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 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 manuelDistribute(@RequestBody ModelClueTaskDistribute taskDistribute) { + return Result.success(modelClueService.distribution(taskDistribute)); + } + } diff --git a/src/main/java/com/biutag/supervision/controller/system/MenuController.java b/src/main/java/com/biutag/supervision/controller/system/MenuController.java index 43d80c0..90ac260 100644 --- a/src/main/java/com/biutag/supervision/controller/system/MenuController.java +++ b/src/main/java/com/biutag/supervision/controller/system/MenuController.java @@ -43,4 +43,9 @@ public class MenuController { return Result.success(); } + @DeleteMapping("{id}") + public Result del(@PathVariable Integer id) { + return Result.success(menuService.removeById(id)); + } + } diff --git a/src/main/java/com/biutag/supervision/flow/action/ThreeSignReturnAction.java b/src/main/java/com/biutag/supervision/flow/action/ThreeSignReturnAction.java index 7191abd..459c0cf 100644 --- a/src/main/java/com/biutag/supervision/flow/action/ThreeSignReturnAction.java +++ b/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() + .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() - .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().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() + .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()) diff --git a/src/main/java/com/biutag/supervision/mapper/ModelClueMapper.java b/src/main/java/com/biutag/supervision/mapper/ModelClueMapper.java index 3a5e8e0..8d21267 100644 --- a/src/main/java/com/biutag/supervision/mapper/ModelClueMapper.java +++ b/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 { + @Select("select *, m.model_name from model_clue mc left join model m on mc.model_id = m.id ${ew.getCustomSqlSegment}") + Page queryPage(@Param("page") Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + } \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/dto/ModelClueTaskDistribute.java b/src/main/java/com/biutag/supervision/pojo/dto/ModelClueTaskDistribute.java new file mode 100644 index 0000000..cb2252d --- /dev/null +++ b/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 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 thingFiles = new ArrayList<>(); + +} 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 b47227c..d8a14b2 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/ModelClueTask.java +++ b/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; // 条数 diff --git a/src/main/java/com/biutag/supervision/pojo/model/ModelClueModel.java b/src/main/java/com/biutag/supervision/pojo/model/ModelClueModel.java index 25ab621..a5fcbc0 100644 --- a/src/main/java/com/biutag/supervision/pojo/model/ModelClueModel.java +++ b/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; + } diff --git a/src/main/java/com/biutag/supervision/pojo/model/ModelClueTaskModel.java b/src/main/java/com/biutag/supervision/pojo/model/ModelClueTaskModel.java index 1e3a427..49ac2bf 100644 --- a/src/main/java/com/biutag/supervision/pojo/model/ModelClueTaskModel.java +++ b/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; } diff --git a/src/main/java/com/biutag/supervision/pojo/param/ModelClueQueryParam.java b/src/main/java/com/biutag/supervision/pojo/param/ModelClueQueryParam.java index 7349f4a..e5513dd 100644 --- a/src/main/java/com/biutag/supervision/pojo/param/ModelClueQueryParam.java +++ b/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 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; } diff --git a/src/main/java/com/biutag/supervision/service/ModelClueService.java b/src/main/java/com/biutag/supervision/service/ModelClueService.java index f3d5246..7521007 100644 --- a/src/main/java/com/biutag/supervision/service/ModelClueService.java +++ b/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; @@ -17,7 +18,10 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -43,38 +47,49 @@ public class ModelClueService extends ServiceImpl { public final SupDepartMapper supDepartMapper; public Page page(ModelClueQueryParam param) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() - .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().setTotal(0).setRecords(new ArrayList<>()); } - Page page = page(Page.of(param.getCurrent(), param.getSize()), queryWrapper); - if (page.getRecords().isEmpty()) { - return new Page().setRecords(new ArrayList<>()).setTotal(0); + QueryWrapper queryWrapper = new QueryWrapper() + .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 modelIds = page.getRecords().stream().map(ModelClue::getModelId).collect(Collectors.toSet()); - List models = modelMapper.selectBatchIds(modelIds); - List 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().setRecords(list).setTotal(page.getTotal()); + return baseMapper.queryPage(Page.of(param.getCurrent(), param.getSize()), queryWrapper); } public List listByUnDistributed(Integer modelId) { return list(new LambdaQueryWrapper().eq(ModelClue::getModelId, modelId).eq(ModelClue::getDistributionState, ModelDistributionStateEnum.UNDISTRIBUTED.getValue())); } - @Transactional(rollbackFor = Exception.class) + public boolean distribution(ModelClueTaskDistribute taskDistribute) { + List 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 modelClues = listByUnDistributed(modelId); Model model = modelMapper.selectById(modelId); + String taskName = "自动下发"; + return distribution(modelClues, model, taskName); + } + + @Transactional(rollbackFor = Exception.class) + public boolean distribution(List modelClues, Model model, String taskName) { LocalDateTime now = LocalDateTime.now(); modelClues.forEach(item -> { if (Objects.isNull(item.getInvolveDepartId())) { @@ -125,7 +140,8 @@ public class ModelClueService extends ServiceImpl { updateById(item); }); ModelClueTask modelClueTask = new ModelClueTask(); - modelClueTask.setModelId(modelId); + modelClueTask.setTaskName(taskName); + modelClueTask.setModelId(model.getId()); modelClueTask.setSize(modelClues.size()); modelClueTask.setDistributionTime(now); // 下发方式