From 04d2e4b493964baa0827849ca14823d2ddb78459 Mon Sep 17 00:00:00 2001 From: luyie Date: Wed, 25 Sep 2024 10:43:12 +0800 Subject: [PATCH 1/3] =?UTF-8?q?add:=E7=9F=A5=E8=AF=86=E5=BA=93=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=96=87=E4=BB=B6=E7=BA=A7=E8=81=94=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=88=86=E6=AE=B5=E4=BF=A1=E6=81=AF=E5=92=8C?= =?UTF-8?q?=E5=90=91=E9=87=8F=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/KnowledgeFileInfoController.java | 8 +++++++- .../maintenance/service/KnowledgeFileInfoService.java | 7 ++++++- .../service/impl/KnowledgeFileInfoServiceImpl.java | 18 ++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/KnowledgeFileInfoController.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/KnowledgeFileInfoController.java index 3e6a8f8..ba97c55 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/KnowledgeFileInfoController.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/KnowledgeFileInfoController.java @@ -1,8 +1,11 @@ package com.hnac.gglm.bigmodel.maintenance.controller; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.gglm.bigmodel.maintenance.entity.KnowledgeFileFragment; import com.hnac.gglm.bigmodel.maintenance.entity.KnowledgeFileInfo; +import com.hnac.gglm.bigmodel.maintenance.service.KnowledgeFileFragmentService; import com.hnac.gglm.bigmodel.maintenance.service.KnowledgeFileInfoService; import com.hnac.gglm.bigmodel.maintenance.vo.IdRequest; import com.hnac.gglm.bigmodel.maintenance.vo.IdsRequest; @@ -21,6 +24,8 @@ import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import java.util.List; + /** * @Author: ypj * @Date: 2024/9/10 16:44 @@ -66,7 +71,8 @@ public class KnowledgeFileInfoController { @ApiOperation(value = "删除") @ApiOperationSupport(order = 5) public R remove(@RequestParam @ApiParam("主键ID,按逗号分隔") String ids) { - return R.status(knowledgeFileInfoService.removeByIds(Func.toLongList(",", ids))); + List idsList = Func.toLongList(",", ids); + return R.status(knowledgeFileInfoService.removeRecursive( idsList)); } @PostMapping(value = "/upload", produces = MediaType.APPLICATION_PROBLEM_JSON_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/KnowledgeFileInfoService.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/KnowledgeFileInfoService.java index fb2f232..1d30668 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/KnowledgeFileInfoService.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/KnowledgeFileInfoService.java @@ -9,12 +9,15 @@ import org.springblade.core.oss.model.BladeFile; import org.springblade.core.tool.api.R; import org.springframework.web.multipart.MultipartFile; +import java.util.List; + /** * @Author: ypj * @Date: 2024/9/10 16:42 */ public interface KnowledgeFileInfoService extends IService { - String SEGMENT_URL= "/kn/doc_segment"; + String SEGMENT_URL = "/kn/doc_segment"; + String VICTOR_DATABASE_NAME = "knowledge_data"; Boolean store(IdRequest req); @@ -23,4 +26,6 @@ public interface KnowledgeFileInfoService extends IService { IPage listPage(IPage page, KnowledgeFileInfo req); R upload(MultipartFile file); + + Boolean removeRecursive(List idsList); } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java index 4f4179b..309faab 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java @@ -8,12 +8,16 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.gglm.bigmodel.configuration.BigModelInvokeApi; import com.hnac.gglm.bigmodel.maintenance.constants.StoreStatus; +import com.hnac.gglm.bigmodel.maintenance.entity.KnowledgeFileFragment; import com.hnac.gglm.bigmodel.maintenance.entity.KnowledgeFileInfo; import com.hnac.gglm.bigmodel.maintenance.mapper.KnowledgeFileInfoMapper; +import com.hnac.gglm.bigmodel.maintenance.service.KnowledgeFileFragmentService; import com.hnac.gglm.bigmodel.maintenance.service.KnowledgeFileInfoService; import com.hnac.gglm.bigmodel.maintenance.vo.IdRequest; import com.hnac.gglm.bigmodel.maintenance.vo.IdsRequest; +import com.hnac.gglm.bigmodel.utils.RequestClientUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.oss.model.BladeFile; @@ -41,7 +45,9 @@ import java.util.Map; @DS("hznlm") public class KnowledgeFileInfoServiceImpl extends ServiceImpl implements KnowledgeFileInfoService { private final KnowledgeFileInfoMapper knowledgeFileInfoMapper; + private final KnowledgeFileFragmentService fileFragmentService; private final IOssClient ossClient; + private final BigModelInvokeApi invokeApi; @Value("${gglm.url}") private String interactionUrl; @@ -110,4 +116,16 @@ public class KnowledgeFileInfoServiceImpl extends ServiceImpl upload(MultipartFile file) { return ossClient.putFile(file); } + + @Override + public Boolean removeRecursive(List idsList) { + Boolean result = removeByIds(idsList); + if (result) { + fileFragmentService.remove(Wrappers.lambdaQuery().in(KnowledgeFileFragment::getDocId, idsList)); + Map deleteTableParams = new HashMap<>(1); + deleteTableParams.put("table_name", VICTOR_DATABASE_NAME); + RequestClientUtil.postCall(interactionUrl + invokeApi.getDeleteTable(), deleteTableParams); + } + return result; + } } From 1aff5fab37a85d4318e329e5787f912ad5fdd6bd Mon Sep 17 00:00:00 2001 From: luyie Date: Wed, 25 Sep 2024 11:18:13 +0800 Subject: [PATCH 2/3] =?UTF-8?q?add:=E6=99=BA=E8=B0=B1=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=95=B0=E6=8D=AE=E6=BA=90=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/gglm/bigmodel/zhipuai/mapper/ZhipuAnalysisInfoMapper.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/zhipuai/mapper/ZhipuAnalysisInfoMapper.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/zhipuai/mapper/ZhipuAnalysisInfoMapper.java index ba93219..12acbae 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/zhipuai/mapper/ZhipuAnalysisInfoMapper.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/zhipuai/mapper/ZhipuAnalysisInfoMapper.java @@ -1,5 +1,6 @@ package com.hnac.gglm.bigmodel.zhipuai.mapper; +import com.baomidou.dynamic.datasource.annotation.DS; import com.hnac.gglm.bigmodel.zhipuai.entity.ZhipuAnalysisInfoEntity; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; @@ -7,5 +8,6 @@ import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; * @Author: ypj * @Date: 2024/8/12 20:05 */ +@DS("hznlm") public interface ZhipuAnalysisInfoMapper extends UserDataScopeBaseMapper { } From 885c99d63fafd3d0fda05c11b5cc56a808fec256 Mon Sep 17 00:00:00 2001 From: luyie Date: Wed, 25 Sep 2024 11:22:54 +0800 Subject: [PATCH 3/3] =?UTF-8?q?add:=E6=99=BA=E8=B0=B1=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=95=B0=E6=8D=AE=E6=BA=90=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/gglm/bigmodel/zhipuai/entity/ZhipuAnalysisInfoEntity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/zhipuai/entity/ZhipuAnalysisInfoEntity.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/zhipuai/entity/ZhipuAnalysisInfoEntity.java index 7e4d67a..be26907 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/zhipuai/entity/ZhipuAnalysisInfoEntity.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/zhipuai/entity/ZhipuAnalysisInfoEntity.java @@ -17,7 +17,7 @@ import org.springblade.core.tenant.mp.TenantEntity; @ApiModel(value = "大模型分析信息") @Data @EqualsAndHashCode(callSuper = false) -@TableName("hzims_analysis_info") +@TableName("gglm_analysis_info") public class ZhipuAnalysisInfoEntity extends TenantEntity { @ApiModelProperty(value = "策略编码")