From dca6fa4a8d64750542625cc8d1c328abf85eb977 Mon Sep 17 00:00:00 2001 From: luyie Date: Mon, 23 Sep 2024 16:11:44 +0800 Subject: [PATCH] =?UTF-8?q?add:=E5=90=91=E9=87=8F=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/VectorParamController.java | 7 ++----- .../maintenance/service/VectorParamService.java | 2 ++ .../service/impl/VectorParamLogServiceImpl.java | 20 +++++++++++--------- .../service/impl/VectorParamServiceImpl.java | 9 +++++++++ 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/VectorParamController.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/VectorParamController.java index 6deaddd..fc42a5e 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/VectorParamController.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/VectorParamController.java @@ -1,5 +1,6 @@ package com.hnac.gglm.bigmodel.maintenance.controller; +import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.mybatisplus.core.metadata.IPage; import com.fasterxml.jackson.core.JsonProcessingException; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; @@ -69,11 +70,7 @@ public class VectorParamController { @ApiOperation(value = "删除向量参数配置") @ApiOperationSupport(order = 4) public R remove(@RequestParam @ApiParam("主键ID,按逗号分隔") String ids) { - Boolean result = vectorParamService.removeByIds(Func.toLongList(",", ids)); - if (result) { - vectorParamLogService.delete(Func.toLongList(",", ids)); - } - return R.status(result); + return R.status(vectorParamService.removeByIdsWithLog(Func.toLongList(",", ids))); } @PutMapping("/update") diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/VectorParamService.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/VectorParamService.java index 760447c..2b65868 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/VectorParamService.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/VectorParamService.java @@ -21,4 +21,6 @@ public interface VectorParamService extends IService { Boolean synchronization(List id ,String bladeToken, String hzinfoToken); Boolean synchronization(Long id, String bladeToken, String hzinfoToken); + + Boolean removeByIdsWithLog(List isList); } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/VectorParamLogServiceImpl.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/VectorParamLogServiceImpl.java index d0e5660..6332c3f 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/VectorParamLogServiceImpl.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/VectorParamLogServiceImpl.java @@ -8,13 +8,11 @@ import com.hnac.gglm.bigmodel.maintenance.mapper.VectorParamLogMapper; import com.hnac.gglm.bigmodel.maintenance.service.VectorParamLogService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.utils.ObjectUtil; import org.springframework.stereotype.Service; import java.util.List; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; /** * @Author: ypj @@ -31,6 +29,7 @@ public class VectorParamLogServiceImpl extends ServiceImpl ids) { - ThreadPoolExecutor executor = new ThreadPoolExecutor(5, ids.size() > 5 ? ids.size() : 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue()); + final Long userId = AuthUtil.getUserId(); ids.forEach(id -> { - executor.execute(() -> { - save(VectorParamLogEntity.builder() - .vectorParamId(id) - .type(DataOperateType.DELETE.getCode()).build()); - }); + VectorParamLogEntity log = VectorParamLogEntity.builder() + .vectorParamId(id) + .type(DataOperateType.DELETE.getCode()).build(); + log.setCreateUser(userId); + save(log); }); return Boolean.TRUE; } @@ -71,6 +72,7 @@ public class VectorParamLogServiceImpl extends ServiceImpl idList) { + Boolean result = baseMapper.deleteBatchIds(idList) > 0; + if (result) { + vectorParamLogService.delete(idList); + } + return result; + } }