Browse Source

Merge remote-tracking branch 'origin/prod-5.1.3' into prod-5.1.3

zhongwei
haungxing 2 months ago
parent
commit
02ad1c3744
  1. 8
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/KnowledgeFileInfoController.java
  2. 5
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/KnowledgeFileInfoService.java
  3. 18
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java
  4. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/zhipuai/entity/ZhipuAnalysisInfoEntity.java
  5. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/zhipuai/mapper/ZhipuAnalysisInfoMapper.java

8
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<Long> 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)

5
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<KnowledgeFileInfo> {
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<KnowledgeFileInfo> {
IPage<KnowledgeFileInfo> listPage(IPage<KnowledgeFileInfo> page, KnowledgeFileInfo req);
R<BladeFile> upload(MultipartFile file);
Boolean removeRecursive(List<Long> idsList);
}

18
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<KnowledgeFileInfoMapper, KnowledgeFileInfo> 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<KnowledgeFileInfoM
public R<BladeFile> upload(MultipartFile file) {
return ossClient.putFile(file);
}
@Override
public Boolean removeRecursive(List<Long> idsList) {
Boolean result = removeByIds(idsList);
if (result) {
fileFragmentService.remove(Wrappers.<KnowledgeFileFragment>lambdaQuery().in(KnowledgeFileFragment::getDocId, idsList));
Map<String, String> deleteTableParams = new HashMap<>(1);
deleteTableParams.put("table_name", VICTOR_DATABASE_NAME);
RequestClientUtil.postCall(interactionUrl + invokeApi.getDeleteTable(), deleteTableParams);
}
return result;
}
}

2
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 = "策略编码")

2
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<ZhipuAnalysisInfoEntity> {
}

Loading…
Cancel
Save