|
|
|
@ -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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|