From 958ea15961a78930d9a48d958c86caf85ebdac44 Mon Sep 17 00:00:00 2001 From: wxc <191104855@qq.com> Date: Wed, 16 Oct 2024 18:18:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=8C=E5=96=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E7=9A=84=E5=BD=93=E5=89=8D=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=20fit:=20=E9=A2=84=E8=AD=A6=E7=BA=BF?= =?UTF-8?q?=E7=B4=A2=E5=88=97=E8=A1=A8=20fit:=20=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=96=B0=E5=A2=9E=E5=BB=BA=E6=A8=A1=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E3=80=81=E6=95=B0=E6=8D=AE=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ModelClueController.java | 31 +++++++++++++++ .../ModelClueRecordController.java | 35 +++++++++++++++++ .../sensitivePerception/ModelController.java | 12 ++++++ .../controller/system/DictController.java | 15 +++++++ .../flow/action/ApplyCompletionAction.java | 4 +- .../flow/action/FirstApproveReturnAction.java | 3 ++ .../flow/action/SecondApproveAction.java | 3 +- .../action/SecondApproveReturnAction.java | 3 ++ .../flow/action/SecondSignReturnAction.java | 2 + .../flow/action/ThreeSignReturnAction.java | 3 ++ .../mapper/ModelClueRecordMapper.java | 8 ++++ .../biutag/supervision/pojo/entity/Model.java | 21 +++++++--- .../supervision/pojo/entity/ModelClue.java | 9 +++-- .../pojo/entity/ModelClueRecord.java | 38 ++++++++++++++++++ .../pojo/model/ModelClueModel.java | 39 +++++++++++++++++++ .../pojo/param/ModelClueQueryParam.java | 23 +++++++++++ .../supervision/service/HolidayService.java | 2 +- .../service/ModelClueRecordService.java | 11 ++++++ .../supervision/service/ModelClueService.java | 39 +++++++++++++++++++ .../supervision/service/SupDepartService.java | 4 +- 20 files changed, 291 insertions(+), 14 deletions(-) create mode 100644 src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelClueController.java create mode 100644 src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelClueRecordController.java create mode 100644 src/main/java/com/biutag/supervision/mapper/ModelClueRecordMapper.java create mode 100644 src/main/java/com/biutag/supervision/pojo/entity/ModelClueRecord.java create mode 100644 src/main/java/com/biutag/supervision/pojo/model/ModelClueModel.java create mode 100644 src/main/java/com/biutag/supervision/pojo/param/ModelClueQueryParam.java create mode 100644 src/main/java/com/biutag/supervision/service/ModelClueRecordService.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 new file mode 100644 index 0000000..a60df60 --- /dev/null +++ b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelClueController.java @@ -0,0 +1,31 @@ +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.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 lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author wxc + * @date 2024/10/16 + */ +@RequestMapping("model/clues") +@RequiredArgsConstructor +@RestController +public class ModelClueController { + + private final ModelClueService modelClueService; + + @GetMapping + public Result> page(ModelClueQueryParam param) { + return Result.success(modelClueService.page(param)); + } + +} diff --git a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelClueRecordController.java b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelClueRecordController.java new file mode 100644 index 0000000..86fdbcc --- /dev/null +++ b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelClueRecordController.java @@ -0,0 +1,35 @@ +package com.biutag.supervision.controller.sensitivePerception; + +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.biutag.supervision.pojo.Result; +import com.biutag.supervision.pojo.entity.ModelClueRecord; +import com.biutag.supervision.service.ModelClueRecordService; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @author wxc + * @date 2024/10/16 + */ +@RequestMapping("model/clue/records") +@RequiredArgsConstructor +@RestController +public class ModelClueRecordController { + + private final ModelClueRecordService modelClueRecordService; + + @GetMapping("/{modelId}/top") + public Result> list(@PathVariable Integer modelId) { + LambdaUpdateWrapper queryWrapper = new LambdaUpdateWrapper() + .set(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/controller/sensitivePerception/ModelController.java b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelController.java index 9bd31a8..4af015e 100644 --- a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelController.java +++ b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelController.java @@ -69,4 +69,16 @@ public class ModelController { return Result.success(); } + @PutMapping + public Result update(@RequestBody Model model) { + model.setUpdateTime(LocalDateTime.now()); + modelService.updateById(model); + return Result.success(model); + } + + @DeleteMapping("{id}") + public Result del(@PathVariable Integer id) { + return Result.success(modelService.removeById(id)); + } + } diff --git a/src/main/java/com/biutag/supervision/controller/system/DictController.java b/src/main/java/com/biutag/supervision/controller/system/DictController.java index 99318ac..550fefd 100644 --- a/src/main/java/com/biutag/supervision/controller/system/DictController.java +++ b/src/main/java/com/biutag/supervision/controller/system/DictController.java @@ -3,6 +3,7 @@ package com.biutag.supervision.controller.system; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.biutag.supervision.pojo.Result; import com.biutag.supervision.pojo.dto.DictDataDto; @@ -48,8 +49,22 @@ public class DictController { SupDictType supDictType = new SupDictType(); BeanUtil.copyProperties(dictType, supDictType); supDictType.setUpdateTime(LocalDateTime.now()); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().ne(SupDictType::getDictId, dictType.getDictId()).eq(SupDictType::getDictType, dictType.getDictType()); + if (dictTypeService.exists(queryWrapper)) { + throw new RuntimeException("字典类型已存在"); + } + SupDictType oldSupDictType = dictTypeService.getById(dictType.getDictId()); + if (!oldSupDictType.getDictType().equals(supDictType.getDictType())) { + // 更新 + dictDataService.update(new LambdaUpdateWrapper().eq(SupDictData::getDictType, oldSupDictType.getDictType()).set(SupDictData::getDictType, dictType.getDictType())); + } return Result.success(dictTypeService.updateById(supDictType)); } + + @DeleteMapping("{dictId}") + public Result update(@PathVariable Integer dictId) { + return Result.success(dictTypeService.removeById(dictId)); + } @GetMapping("{dictType}/dictData") public Result> list(Page page, @PathVariable String dictType) { return Result.success(dictDataService.page(page, new LambdaQueryWrapper() diff --git a/src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java b/src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java index cfe7469..fae62d4 100644 --- a/src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java @@ -68,7 +68,9 @@ public class ApplyCompletionAction implements Action { .set(Negative::getCheckStatusName, verifyData.getCheckStatusName()) .set(Negative::getIsRectifyCode, verifyData.getIsRectifyCode()) .set(Negative::getIsRectifyName, verifyData.getIsRectifyName()) - .set(Negative::getAccountabilityTarget, verifyData.getAccountabilityTarget()); + .set(Negative::getAccountabilityTarget, verifyData.getAccountabilityTarget()) + // 当前处理对象 + .set(Negative::getCurrentProcessingObject, negative.getIsSecondHandle() ? "市局专班" : String.format("%s专班", negative.getHandleSecondDepartName())); // 未整改 if (IsRectifyEnum.NOT.getValue().equals(verifyData.getIsRectifyCode())) { updateWrapper.set(Negative::getRectifyRestrictionDays, verifyData.getRectifyRestrictionDays()); diff --git a/src/main/java/com/biutag/supervision/flow/action/FirstApproveReturnAction.java b/src/main/java/com/biutag/supervision/flow/action/FirstApproveReturnAction.java index deef65e..0663c010 100644 --- a/src/main/java/com/biutag/supervision/flow/action/FirstApproveReturnAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/FirstApproveReturnAction.java @@ -42,9 +42,12 @@ public class FirstApproveReturnAction implements Action { } public void updateNegative(String negativeId, String nextFlowKey) { + Negative negative = negativeService.getById(negativeId); negativeService.update(new LambdaUpdateWrapper() .set(Negative::getFlowKey, nextFlowKey) .set(Negative::getUpdTime, LocalDateTime.now()) + // 当前处理对象 + .set(Negative::getCurrentProcessingObject, String.format("%s专班", negative.getHandleSecondDepartName())) .eq(Negative::getId, negativeId)); } diff --git a/src/main/java/com/biutag/supervision/flow/action/SecondApproveAction.java b/src/main/java/com/biutag/supervision/flow/action/SecondApproveAction.java index 67fb040..c6d2260 100644 --- a/src/main/java/com/biutag/supervision/flow/action/SecondApproveAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/SecondApproveAction.java @@ -56,7 +56,8 @@ public class SecondApproveAction implements Action { .set(Negative::getProcessingStatus, ProcessingStatusEnum.completed.name()) .set(Negative::getCompleteDate, LocalDateTime.now()); } else { - updateWrapper.set(Negative::getFlowKey, nextFlowKey); + updateWrapper.set(Negative::getFlowKey, nextFlowKey) + .set(Negative::getCurrentProcessingObject, "市局专班"); } negativeService.update(updateWrapper); } diff --git a/src/main/java/com/biutag/supervision/flow/action/SecondApproveReturnAction.java b/src/main/java/com/biutag/supervision/flow/action/SecondApproveReturnAction.java index cd09efe..7958156 100644 --- a/src/main/java/com/biutag/supervision/flow/action/SecondApproveReturnAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/SecondApproveReturnAction.java @@ -43,10 +43,13 @@ public class SecondApproveReturnAction implements Action { } public void updateNegative(String negativeId, String nextFlowKey) { + Negative negative = negativeService.getById(negativeId); negativeService.update(new LambdaUpdateWrapper() .set(Negative::getFlowKey, nextFlowKey) .set(Negative::getUpdTime, LocalDateTime.now()) .set(Negative::getProcessingStatus, ProcessingStatusEnum.processing.name()) + // 当前处理对象 + .set(Negative::getCurrentProcessingObject, String.format("%s专班", negative.getHandleThreeDepartName())) .eq(Negative::getId, negativeId)); } diff --git a/src/main/java/com/biutag/supervision/flow/action/SecondSignReturnAction.java b/src/main/java/com/biutag/supervision/flow/action/SecondSignReturnAction.java index 4e93941..44d5e4b 100644 --- a/src/main/java/com/biutag/supervision/flow/action/SecondSignReturnAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/SecondSignReturnAction.java @@ -46,6 +46,8 @@ public class SecondSignReturnAction implements Action { negativeService.update(new LambdaUpdateWrapper() .set(Negative::getFlowKey, nextFlowKey) .set(Negative::getUpdTime, LocalDateTime.now()) + // 当前处理对象 + .set(Negative::getCurrentProcessingObject, "市局专班") .eq(Negative::getId, negativeId)); } 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 4b7fbe5..7191abd 100644 --- a/src/main/java/com/biutag/supervision/flow/action/ThreeSignReturnAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/ThreeSignReturnAction.java @@ -47,10 +47,13 @@ public class ThreeSignReturnAction implements Action { } public void updateNegative(String negativeId, String nextFlowKey) { + Negative negative = negativeService.getById(negativeId); negativeService.update(new LambdaUpdateWrapper() .set(Negative::getFlowKey, nextFlowKey) .set(Negative::getUpdTime, LocalDateTime.now()) .set(Negative::getProcessingStatus, ProcessingStatusEnum.signing.name()) + // 当前处理对象 + .set(Negative::getCurrentProcessingObject, String.format("%s专班", negative.getHandleSecondDepartName())) //----------------------------------------------------------------------------- .set(Negative::getCheckStatus, null) .set(Negative::getCheckStatusName, null) diff --git a/src/main/java/com/biutag/supervision/mapper/ModelClueRecordMapper.java b/src/main/java/com/biutag/supervision/mapper/ModelClueRecordMapper.java new file mode 100644 index 0000000..41c00b3 --- /dev/null +++ b/src/main/java/com/biutag/supervision/mapper/ModelClueRecordMapper.java @@ -0,0 +1,8 @@ +package com.biutag.supervision.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.supervision.pojo.entity.ModelClueRecord; + +public interface ModelClueRecordMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/entity/Model.java b/src/main/java/com/biutag/supervision/pojo/entity/Model.java index 5caefa4..af05575 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/Model.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/Model.java @@ -35,11 +35,17 @@ public class Model { @TableField("distribution_method") private String distributionMethod; - // + // 分发周期 @TableField("distribution_cycle") private String distributionCycle; - // + // 分发周期 周 + private String distributionCycleDayOfWeek; + + // 分发周期 时间 + private String distributionCycleTime; + + // 限时 @TableField("time_limit") private String timeLimit; @@ -59,15 +65,14 @@ public class Model { @TableField("distribution_flow") private String distributionFlow; - // @TableField("approval_flow") private String approvalFlow; - // + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss") @TableField("create_time") private LocalDateTime createTime; - @JsonFormat(pattern = "YYYY-MM-dd HH:mm") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss") @TableField("update_time") private LocalDateTime updateTime; @@ -75,4 +80,10 @@ public class Model { private String createDepartName; + // 建模方式 + private String modelingMethod; + + // 模型数据类型 + private String modelDataType; + } \ No newline at end of file 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 f36e0b0..5879fda 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/ModelClue.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/ModelClue.java @@ -24,6 +24,8 @@ public class ModelClue { @TableField("involve_depart_name") private String involveDepartName; + private String involveDepartId; + // 涉及人员 @TableField("involve_personnel_name") private String involvePersonnelName; @@ -33,11 +35,12 @@ public class ModelClue { private String thingDesc; // 分发状态 - @TableField("distribution_staus") - private String distributionStaus; + @TableField("distribution_state") + private String distributionState; - // @TableField("create_time") private LocalDateTime createTime; + private String data; + } \ 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 new file mode 100644 index 0000000..b3ca285 --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/entity/ModelClueRecord.java @@ -0,0 +1,38 @@ +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 lombok.Getter; +import lombok.Setter; + +import java.time.LocalDateTime; + +@Setter +@Getter +public class ModelClueRecord { + + // + @TableId(type = IdType.AUTO) + private Integer id; + + // 模型ID + private String modelId; + + // 条数 + @TableField("size") + private Integer size; + + // 创建时间 + @TableField("create_time") + private LocalDateTime createTime; + + // 状态 success-成功 fail-失败 + @TableField("state") + private String state; + + // 异常详情 + @TableField("err_msg") + private String errMsg; + +} \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/model/ModelClueModel.java b/src/main/java/com/biutag/supervision/pojo/model/ModelClueModel.java new file mode 100644 index 0000000..25ab621 --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/model/ModelClueModel.java @@ -0,0 +1,39 @@ +package com.biutag.supervision.pojo.model; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Getter; +import lombok.Setter; + +import java.time.LocalDateTime; + +/** + * + * @author wxc + * @date 2024/10/16 + */ +@Setter +@Getter +public class ModelClueModel { + + private Integer id; + + private Integer modelId; + + private String modelName; + + // 涉及单位 + private String involveDepartName; + + + // 预警内容 + private String thingDesc; + + // 分发状态 + private String distributionState; + + @JsonFormat(pattern = "YYYY-MM-dd HH:mm") + private LocalDateTime createTime; + + private String data; + +} diff --git a/src/main/java/com/biutag/supervision/pojo/param/ModelClueQueryParam.java b/src/main/java/com/biutag/supervision/pojo/param/ModelClueQueryParam.java new file mode 100644 index 0000000..9899a71 --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/param/ModelClueQueryParam.java @@ -0,0 +1,23 @@ +package com.biutag.supervision.pojo.param; + +import lombok.Getter; +import lombok.Setter; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author wxc + * @date 2024/10/16 + */ +@Setter +@Getter +public class ModelClueQueryParam extends BasePage { + private Integer modelId; + private String modelType; + + private List createTime; + private Integer involveDepartId; + private String thingDesc; + private String distributionState; +} diff --git a/src/main/java/com/biutag/supervision/service/HolidayService.java b/src/main/java/com/biutag/supervision/service/HolidayService.java index fc1a66f..9b9a970 100644 --- a/src/main/java/com/biutag/supervision/service/HolidayService.java +++ b/src/main/java/com/biutag/supervision/service/HolidayService.java @@ -33,7 +33,7 @@ public class HolidayService extends ServiceImpl { } Holiday holiday = getOne(new LambdaUpdateWrapper().eq(Holiday::getDate, date)); if (Objects.isNull(holiday)) { - log.error("节假日 {} 数据未找到"); + log.error("节假日 {} 数据未找到", date); return false; } redisTemplate.opsForValue().set(String.format("holiday:%s", date), holiday.getFlag()); diff --git a/src/main/java/com/biutag/supervision/service/ModelClueRecordService.java b/src/main/java/com/biutag/supervision/service/ModelClueRecordService.java new file mode 100644 index 0000000..4641af1 --- /dev/null +++ b/src/main/java/com/biutag/supervision/service/ModelClueRecordService.java @@ -0,0 +1,11 @@ +package com.biutag.supervision.service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.biutag.supervision.pojo.entity.ModelClueRecord; +import com.biutag.supervision.mapper.ModelClueRecordMapper; +import org.springframework.stereotype.Service; + +@Service +public class ModelClueRecordService extends ServiceImpl { + +} diff --git a/src/main/java/com/biutag/supervision/service/ModelClueService.java b/src/main/java/com/biutag/supervision/service/ModelClueService.java index f267dad..1cdf481 100644 --- a/src/main/java/com/biutag/supervision/service/ModelClueService.java +++ b/src/main/java/com/biutag/supervision/service/ModelClueService.java @@ -1,11 +1,50 @@ package com.biutag.supervision.service; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.biutag.supervision.pojo.entity.Model; import com.biutag.supervision.pojo.entity.ModelClue; import com.biutag.supervision.mapper.ModelClueMapper; +import com.biutag.supervision.pojo.model.ModelClueModel; +import com.biutag.supervision.pojo.param.ModelClueQueryParam; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; + +@RequiredArgsConstructor @Service public class ModelClueService extends ServiceImpl { + private final ModelService modelService; + + 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); + Page page = page(Page.of(param.getCurrent(), param.getSize()), queryWrapper); + if (page.getRecords().isEmpty()) { + return new Page().setRecords(new ArrayList<>()).setTotal(0); + } + Set modelIds = page.getRecords().stream().map(ModelClue::getModelId).collect(Collectors.toSet()); + List models = modelService.listByIds(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()); + } + } diff --git a/src/main/java/com/biutag/supervision/service/SupDepartService.java b/src/main/java/com/biutag/supervision/service/SupDepartService.java index c18a9ca..c833c0f 100644 --- a/src/main/java/com/biutag/supervision/service/SupDepartService.java +++ b/src/main/java/com/biutag/supervision/service/SupDepartService.java @@ -32,7 +32,6 @@ public class SupDepartService extends ServiceImpl { public List listByEnabled() { return list(new LambdaQueryWrapper() - .ne(SupDepart::getId, AppConstants.ROOT_DEPART_ID) .notIn(SupDepart::getLevel, List.of(4, 5)) .eq(SupDepart::getStatus, StatusEnum.ENABLE.getValue()) .orderByAsc(SupDepart::getOrderNo)); @@ -116,8 +115,7 @@ public class SupDepartService extends ServiceImpl { node.setHasChildren(!depart.getLevel().equals(4) && departs.stream().anyMatch(item -> node.getId().equals(item.getPid()))); List children = childMap.computeIfAbsent(node.getPid(), k -> new ArrayList<>()); children.add(node); - String pid = node.getPid(); - if (AppConstants.ROOT_DEPART_ID.equals(pid)) { + if (AppConstants.ROOT_DEPART_ID.equals(node.getId())) { tree.add(node); } }