Commit 1f3f0801 authored by pengxin's avatar pengxin

还原代码。

parent f486099d
...@@ -38,6 +38,16 @@ public class KnowledgeConfig { ...@@ -38,6 +38,16 @@ public class KnowledgeConfig {
*/ */
private String searchDocs; private String searchDocs;
/**
* 直接更新知识库文档
*/
private String updateDocsById;
/**
* 直接删除知识库文档片段
*/
private String deleteDocsById;
/** /**
* 上传文件到知识库,并/或进行向量化 * 上传文件到知识库,并/或进行向量化
*/ */
......
package com.yice.webadmin.app.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Data
@Configuration
@ConfigurationProperties(prefix = "llm-model")
public class LlmModelConfig {
/**
* 大模型管理接口地址
*/
private String llmModelInterface;
/**
* 模型停止
*/
private String stop;
/**
* 重新模型部署
*/
private String reload;
/**
* 模型启动
*/
private String start;
/**
* 列出当前已加载模型
*/
private String listRunningModels;
}
package com.yice.webadmin.app.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Data
@Configuration
@ConfigurationProperties(prefix = "other")
public class OtherConfig {
/**
* 其他通用接口地址
*/
private String otherInterface;
/**
* 获取GPU信息
*/
private String getGpuInfo;
}
...@@ -3,52 +3,12 @@ package com.yice.webadmin.app.constant; ...@@ -3,52 +3,12 @@ package com.yice.webadmin.app.constant;
public class DatasetConstant { public class DatasetConstant {
/** /**
* 未发布状态 *未发布状态0
*/ */
public static final Integer STATUS_UNPUBLISHED = 0; public static final Integer STATUS_UNPUBLISHED = 0;
/** /**
* 已发布状态 *已发布状态
*/ */
public static final Integer STATUS_PUBLISHED = 1; public static final Integer STATUS_PUBLISHED = 1;
/**
* 未完成状态
*/
public static final Integer STATUS_UNFINISHED = 0;
/**
* 未标记状态
*/
public static final Integer UNMARK = 0;
/**
* 已完成状态
*/
public static final Integer STATUS_FINISHED = 1 ;
/**
* 文件上传字段
*/
public static final Integer UPLOAD = 1 ;
/**
* 文件上传字段
*/
public static final String KB = "KB" ;
/**
* 文件名称
*/
public static final String FILE_NAME = "output.";
/**
* 导出位置
*/
public static final String OUTPUT_POSTION = "导出至本地" ;
/**
* 导出内容
*/
public static final String OUTPUT_CONTENT = "全部数据" ;
} }
...@@ -25,22 +25,6 @@ public final class MongoConstant { ...@@ -25,22 +25,6 @@ public final class MongoConstant {
*/ */
public static final String CREATE_TIME = "createTime"; public static final String CREATE_TIME = "createTime";
/**
* 标记状态
*/
public static final String MARK_STATUS = "markStatus";
/**
* 标记状态
*/
public static final String OUTPUT = "output";
/**
* NULL状态
*/
public static final String EMPTY = "";
/** /**
* 主键id * 主键id
*/ */
......
...@@ -99,25 +99,6 @@ public class DatasetDataController { ...@@ -99,25 +99,6 @@ public class DatasetDataController {
return ResponseResult.success(MyPageUtil.makeResponseData(datasetDataList, count)); return ResponseResult.success(MyPageUtil.makeResponseData(datasetDataList, count));
} }
/**
* 根据版本id,查询该数据集列表
* @param datasetDataDtoFilter 数据集对象
* @param pageParam 分页参数
* @return
*/
@PostMapping("/load")
public ResponseResult<MyPageData<DatasetData>> load(
@MyRequestBody DatasetDataDto datasetDataDtoFilter,
@MyRequestBody MyPageParam pageParam) {
if (pageParam != null) {
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
}
DatasetData datasetDataFilter = MyModelUtil.copyTo(datasetDataDtoFilter, DatasetData.class);
List<DatasetData> datasetDataList = datasetDataService.list(datasetDataFilter,pageParam);
Long count = datasetDataService.count(datasetDataFilter);
return ResponseResult.success(MyPageUtil.makeResponseData(datasetDataList, count));
}
/** /**
* 查看指定数据集版本对象详情。 * 查看指定数据集版本对象详情。
* @param id 主键标识。 * @param id 主键标识。
......
...@@ -125,29 +125,6 @@ public class DatasetManageController { ...@@ -125,29 +125,6 @@ public class DatasetManageController {
return ResponseResult.success(MyPageUtil.makeResponseData(datasetManageList, DatasetManage.INSTANCE)); return ResponseResult.success(MyPageUtil.makeResponseData(datasetManageList, DatasetManage.INSTANCE));
} }
/**
* 查询所有数据集列表最新的记录列表进行分组查询。
*
* @param datasetManageDtoFilter 过滤对象。
* @param orderParam 排序参数。
* @param pageParam 分页参数。
* @return 应答结果对象,包含查询结果集。
*/
@PostMapping("/findDatasets")
public ResponseResult<MyPageData<DatasetManageVo>> findDatasets(
@MyRequestBody DatasetManageDto datasetManageDtoFilter,
@MyRequestBody MyOrderParam orderParam,
@MyRequestBody MyPageParam pageParam) {
if (pageParam != null) {
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
}
DatasetManage datasetManageFilter = MyModelUtil.copyTo(datasetManageDtoFilter, DatasetManage.class);
String orderBy = MyOrderParam.buildOrderBy(orderParam, DatasetManage.class);
List<DatasetManage> datasetManageList =
datasetManageService.getDatasetManageGroupList(datasetManageFilter, orderBy);
return ResponseResult.success(MyPageUtil.makeResponseData(datasetManageList, DatasetManage.INSTANCE));
}
/** /**
* 列出符合过滤条件的数据集管理列表。 * 列出符合过滤条件的数据集管理列表。
* *
......
...@@ -18,15 +18,11 @@ import com.yice.common.core.util.MyPageUtil; ...@@ -18,15 +18,11 @@ import com.yice.common.core.util.MyPageUtil;
import com.yice.common.log.annotation.OperationLog; import com.yice.common.log.annotation.OperationLog;
import com.yice.common.log.model.constant.SysOperationLogType; import com.yice.common.log.model.constant.SysOperationLogType;
import com.yice.webadmin.app.config.PythonConfig; import com.yice.webadmin.app.config.PythonConfig;
import com.yice.webadmin.app.constant.DatasetConstant;
import com.yice.webadmin.app.data.DatasetData;
import com.yice.webadmin.app.dto.DatasetDetailDto; import com.yice.webadmin.app.dto.DatasetDetailDto;
import com.yice.webadmin.app.dto.DatasetVersionDto; import com.yice.webadmin.app.dto.DatasetVersionDto;
import com.yice.webadmin.app.model.DatasetDetail; import com.yice.webadmin.app.model.DatasetDetail;
import com.yice.webadmin.app.model.DatasetOutput;
import com.yice.webadmin.app.model.DatasetVersion; import com.yice.webadmin.app.model.DatasetVersion;
import com.yice.webadmin.app.service.DatasetDataService; import com.yice.webadmin.app.service.DatasetDataService;
import com.yice.webadmin.app.service.DatasetOutputService;
import com.yice.webadmin.app.service.DatasetVersionService; import com.yice.webadmin.app.service.DatasetVersionService;
import com.yice.webadmin.app.vo.DatasetVersionVo; import com.yice.webadmin.app.vo.DatasetVersionVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -46,7 +42,10 @@ import java.nio.charset.StandardCharsets; ...@@ -46,7 +42,10 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.*; import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/** /**
* 数据集版本操作控制器类。 * 数据集版本操作控制器类。
...@@ -66,8 +65,6 @@ public class DatasetVersionController { ...@@ -66,8 +65,6 @@ public class DatasetVersionController {
private PythonConfig pythonConfig; private PythonConfig pythonConfig;
@Autowired @Autowired
private DatasetDataService datasetDataService; private DatasetDataService datasetDataService;
@Autowired
private DatasetOutputService datasetOutputService;
/** /**
* 新增数据集版本数据。 * 新增数据集版本数据。
* *
...@@ -113,40 +110,6 @@ public class DatasetVersionController { ...@@ -113,40 +110,6 @@ public class DatasetVersionController {
return ResponseResult.success(); return ResponseResult.success();
} }
/**
* 更新数据集版本数据。
*
* @param versionId 更新对象。
* @return 应答结果对象。
*/
@OperationLog(type = SysOperationLogType.UPDATE)
@GetMapping("/publish")
public ResponseResult<Void> publish(@RequestParam("versionId") Long versionId) {
String errorMessage;
if (null == versionId) {
errorMessage = "数据验证失败,参数不能为空!";
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
DatasetVersion datasetVersion = datasetVersionService.getById(versionId);
if (datasetVersion == null) {
errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
}
DatasetData datasetDataFilter = new DatasetData();
datasetDataFilter.setMarkStatus(DatasetConstant.UNMARK);
datasetDataFilter.setVersionId(versionId);
Long count = datasetDataService.count(datasetDataFilter);
if (count > 0) {
errorMessage = "该数据集不满足发布条件,请确保数据集已完成全部数据标注!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
}
datasetVersion.setReleaseStatus(DatasetConstant.STATUS_PUBLISHED);
if (!datasetVersionService.update(datasetVersion)) {
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
}
return ResponseResult.success();
}
/** /**
* 删除数据集版本数据。 * 删除数据集版本数据。
* *
...@@ -333,10 +296,10 @@ public class DatasetVersionController { ...@@ -333,10 +296,10 @@ public class DatasetVersionController {
if (!Files.isWritable(path)) { if (!Files.isWritable(path)) {
Files.createDirectories(Paths.get(pythonConfig.getDatasetFileBaseDir())); Files.createDirectories(Paths.get(pythonConfig.getDatasetFileBaseDir()));
} }
// 文件写入指定路径、应该是追加到文件里面 // 文件写入指定路径
Files.write(path, bytes); Files.write(path, bytes);
// 写入到mongodb中 // 写入到mongodb中
datasetVersionService.writeDatasetFile(bytes,importFile.getOriginalFilename(),versionId); datasetVersionService.writeDatasetFileForMongo(bytes,importFile.getOriginalFilename(),versionId);
} catch (IOException e) { } catch (IOException e) {
log.error("Failed to write imported file [" + importFile.getOriginalFilename() + " ].", e); log.error("Failed to write imported file [" + importFile.getOriginalFilename() + " ].", e);
throw e; throw e;
...@@ -362,30 +325,4 @@ public class DatasetVersionController { ...@@ -362,30 +325,4 @@ public class DatasetVersionController {
return ResponseEntity.notFound().build(); // 如果文件不存在,返回404 Not Found状态码 return ResponseEntity.notFound().build(); // 如果文件不存在,返回404 Not Found状态码
} }
} }
/**
* 开始导出数据集记录
* @param versionId 版本标识
* @param fileType 文件类型
* @return 返回导出文件链接
*/
@GetMapping("/startExport")
public ResponseResult<String> startExport(@RequestParam Long versionId,
@RequestParam String fileType){
DatasetVersion datasetVersion = this.datasetVersionService.getById(versionId);
datasetVersion.setFileUrl("E:\\自我认知数据集_V2.json");
if (datasetVersion == null) {
String errorMessage = "数据操作失败,查询数据不存在,请刷新后重试!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST,errorMessage);
}
DatasetOutput datasetOutput = datasetOutputService.saveNew(fileType,datasetVersion.getFileUrl(),versionId);
if (datasetOutput == null) {
String errorMessage = "导出数据操作失败,请刷新后重试或者联系管理员!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST,errorMessage);
}
datasetOutput.setStatus(DatasetConstant.STATUS_FINISHED);
datasetOutput.setOutputEndTime(new Date());
datasetOutputService.updateById(datasetOutput);
return ResponseResult.success(datasetOutput.getDownloadUrl());
}
} }
package com.yice.webadmin.app.controller; package com.yice.webadmin.app.controller;
import com.github.pagehelper.page.PageMethod;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yice.common.core.annotation.MyRequestBody;
import com.yice.common.core.constant.ErrorCodeEnum;
import com.yice.common.core.object.*;
import com.yice.common.core.util.MyCommonUtil;
import com.yice.common.core.util.MyModelUtil;
import com.yice.common.core.util.MyPageUtil;
import com.yice.common.log.annotation.OperationLog; import com.yice.common.log.annotation.OperationLog;
import com.yice.common.log.model.constant.SysOperationLogType; import com.yice.common.log.model.constant.SysOperationLogType;
import com.yice.webadmin.app.dto.DatasetOutputDto; import com.github.pagehelper.page.PageMethod;
import com.yice.webadmin.app.model.DatasetOutput; import com.yice.webadmin.app.vo.*;
import com.yice.webadmin.app.service.DatasetOutputService; import com.yice.webadmin.app.dto.*;
import com.yice.webadmin.app.vo.DatasetOutputVo; import com.yice.webadmin.app.model.*;
import com.yice.webadmin.config.ApplicationConfig; import com.yice.webadmin.app.service.*;
import com.yice.common.core.object.*;
import com.yice.common.core.util.*;
import com.yice.common.core.constant.*;
import com.yice.common.core.annotation.MyRequestBody;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.*;
/** /**
* 数据集详情操作控制器类。 * 知识图谱管理操作控制器类。
* *
* @author linking * @author linking
* @date 2023-04-13 * @date 2023-04-13
*/ */
@Api(tags = "数据集版本导出管理接口") @Api(tags = "知识图谱管理管理接口")
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/admin/app/datasetOutput") @RequestMapping("/admin/app/kGManage")
public class DatasetOutputController { public class KGManageController {
@Autowired
private DatasetOutputService datasetOutputService;
@Autowired @Autowired
private ApplicationConfig appConfig; private KGManageService kGManageService;
/** /**
* 新增数据集详情数据。 * 新增知识图谱管理数据。
* *
* @param datasetOutputDto 新增对象。 * @param kGManageDto 新增对象。
* @return 应答结果对象,包含新增对象主键Id。 * @return 应答结果对象,包含新增对象主键Id。
*/ */
@ApiOperationSupport(ignoreParameters = {"datasetOutputDto.outputId"}) @ApiOperationSupport(ignoreParameters = {"kGManageDto.kgId"})
@OperationLog(type = SysOperationLogType.ADD) @OperationLog(type = SysOperationLogType.ADD)
@PostMapping("/add") @PostMapping("/add")
public ResponseResult<Long> add(@MyRequestBody DatasetOutputDto datasetOutputDto) { public ResponseResult<Long> add(@MyRequestBody KGManageDto kGManageDto) {
String errorMessage = MyCommonUtil.getModelValidationError(datasetOutputDto, false); String errorMessage = MyCommonUtil.getModelValidationError(kGManageDto, false);
if (errorMessage != null) { if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage); return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
} }
DatasetOutput datasetOutput = MyModelUtil.copyTo(datasetOutputDto, DatasetOutput.class); KGManage kGManage = MyModelUtil.copyTo(kGManageDto, KGManage.class);
datasetOutput = datasetOutputService.saveNew(datasetOutput); kGManage = kGManageService.saveNew(kGManage);
return ResponseResult.success(datasetOutput.getOutputId()); return ResponseResult.success(kGManage.getKgId());
} }
/** /**
* 更新数据集详情数据。 * 更新知识图谱管理数据。
* *
* @param datasetOutputDto 更新对象。 * @param kGManageDto 更新对象。
* @return 应答结果对象。 * @return 应答结果对象。
*/ */
@OperationLog(type = SysOperationLogType.UPDATE) @OperationLog(type = SysOperationLogType.UPDATE)
@PostMapping("/update") @PostMapping("/update")
public ResponseResult<Void> update(@MyRequestBody DatasetOutputDto datasetOutputDto) { public ResponseResult<Void> update(@MyRequestBody KGManageDto kGManageDto) {
String errorMessage = MyCommonUtil.getModelValidationError(datasetOutputDto, true); String errorMessage = MyCommonUtil.getModelValidationError(kGManageDto, true);
if (errorMessage != null) { if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage); return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
} }
DatasetOutput datasetOutput = MyModelUtil.copyTo(datasetOutputDto, DatasetOutput.class); KGManage kGManage = MyModelUtil.copyTo(kGManageDto, KGManage.class);
DatasetOutput originaldatasetOutput = datasetOutputService.getById(datasetOutput.getOutputId()); KGManage originalKGManage = kGManageService.getById(kGManage.getKgId());
if (originaldatasetOutput == null) { if (originalKGManage == null) {
// NOTE: 修改下面方括号中的话述
errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!"; errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage); return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
} }
if (!datasetOutputService.update(datasetOutput, originaldatasetOutput)) { if (!kGManageService.update(kGManage, originalKGManage)) {
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST); return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
} }
return ResponseResult.success(); return ResponseResult.success();
} }
/** /**
* 删除数据集详情数据。 * 删除知识图谱管理数据。
* *
* @param detailId 删除对象主键Id。 * @param kgId 删除对象主键Id。
* @return 应答结果对象。 * @return 应答结果对象。
*/ */
@OperationLog(type = SysOperationLogType.DELETE) @OperationLog(type = SysOperationLogType.DELETE)
@PostMapping("/delete") @PostMapping("/delete")
public ResponseResult<Void> delete(@MyRequestBody Long detailId) { public ResponseResult<Void> delete(@MyRequestBody Long kgId) {
if (MyCommonUtil.existBlankArgument(detailId)) { if (MyCommonUtil.existBlankArgument(kgId)) {
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST); return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
} }
return this.doDelete(detailId); return this.doDelete(kgId);
} }
/** /**
* 列出符合过滤条件的数据集详情列表。 * 列出符合过滤条件的知识图谱管理列表。
* *
* @param datasetOutputDtoFilter 过滤对象。 * @param kGManageDtoFilter 过滤对象。
* @param orderParam 排序参数。 * @param orderParam 排序参数。
* @param pageParam 分页参数。 * @param pageParam 分页参数。
* @return 应答结果对象,包含查询结果集。 * @return 应答结果对象,包含查询结果集。
*/ */
@PostMapping("/list") @PostMapping("/list")
public ResponseResult<MyPageData<DatasetOutputVo>> list( public ResponseResult<MyPageData<KGManageVo>> list(
@MyRequestBody DatasetOutputDto datasetOutputDtoFilter, @MyRequestBody KGManageDto kGManageDtoFilter,
@MyRequestBody MyOrderParam orderParam, @MyRequestBody MyOrderParam orderParam,
@MyRequestBody MyPageParam pageParam) { @MyRequestBody MyPageParam pageParam) {
if (pageParam != null) { if (pageParam != null) {
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize()); PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
} }
DatasetOutput datasetOutputFilter = MyModelUtil.copyTo(datasetOutputDtoFilter, DatasetOutput.class); KGManage kGManageFilter = MyModelUtil.copyTo(kGManageDtoFilter, KGManage.class);
String orderBy = MyOrderParam.buildOrderBy(orderParam, DatasetOutput.class); String orderBy = MyOrderParam.buildOrderBy(orderParam, KGManage.class);
List<DatasetOutput> datasetOutputList = List<KGManage> kGManageList = kGManageService.getKGManageListWithRelation(kGManageFilter, orderBy);
datasetOutputService.getDatasetOutputListWithRelation(datasetOutputFilter, orderBy); return ResponseResult.success(MyPageUtil.makeResponseData(kGManageList, KGManage.INSTANCE));
return ResponseResult.success(MyPageUtil.makeResponseData(datasetOutputList, DatasetOutput.INSTANCE));
} }
/** /**
* 查看指定数据集详情对象详情。 * 查看指定知识图谱管理对象详情。
* *
* @param detailId 指定对象主键Id。 * @param kgId 指定对象主键Id。
* @return 应答结果对象,包含对象详情。 * @return 应答结果对象,包含对象详情。
*/ */
@GetMapping("/view") @GetMapping("/view")
public ResponseResult<DatasetOutputVo> view(@RequestParam Long detailId) { public ResponseResult<KGManageVo> view(@RequestParam Long kgId) {
DatasetOutput datasetOutput = datasetOutputService.getByIdWithRelation(detailId, MyRelationParam.full()); KGManage kGManage = kGManageService.getByIdWithRelation(kgId, MyRelationParam.full());
if (datasetOutput == null) { if (kGManage == null) {
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST); return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
} }
DatasetOutputVo datasetOutputVo = DatasetOutput.INSTANCE.fromModel(datasetOutput); KGManageVo kGManageVo = KGManage.INSTANCE.fromModel(kGManage);
return ResponseResult.success(datasetOutputVo); return ResponseResult.success(kGManageVo);
} }
private ResponseResult<Void> doDelete(Long detailId) { private ResponseResult<Void> doDelete(Long kgId) {
String errorMessage; String errorMessage;
// 验证关联Id的数据合法性 // 验证关联Id的数据合法性
DatasetOutput originaldatasetOutput = datasetOutputService.getById(detailId); KGManage originalKGManage = kGManageService.getById(kgId);
if (originaldatasetOutput == null) { if (originalKGManage == null) {
// NOTE: 修改下面方括号中的话述
errorMessage = "数据验证失败,当前 [对象] 并不存在,请刷新后重试!"; errorMessage = "数据验证失败,当前 [对象] 并不存在,请刷新后重试!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage); return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
} }
if (!datasetOutputService.remove(detailId)) { if (!kGManageService.remove(kgId)) {
errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!"; errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage); return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
} }
......
...@@ -68,16 +68,14 @@ public class KnowledgeManageController { ...@@ -68,16 +68,14 @@ public class KnowledgeManageController {
if (errorMessage != null) { if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage); return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
} }
KnowledgeManage knowledgeManage = MyModelUtil.copyTo(knowledgeManageDto, KnowledgeManage.class); String requestBody = "{\n" + " \"knowledge_base_name\": \"" + knowledgeManageDto.getKnowledgeName() + "\",\n" + " \"vector_store_type\": \"faiss\",\n" + " \"embed_model\": \"m3e-base\"\n" + "}";
knowledgeManage.setKnowledgeCode(PinyinUtil.getPinyin(knowledgeManage.getKnowledgeName()).replace(" ","_"));
String requestBody = "{\n" + " \"knowledge_base_name\": \"" + knowledgeManage.getKnowledgeCode() + "\",\n" + " \"vector_store_type\": \"faiss\",\n" + " \"embed_model\": \"m3e-base\"\n" + "}";
try { try {
String result = proxyPythonService.predictPost(knowledgeConfig.getKnowledgeInterface() + knowledgeConfig.getCreate(), requestBody); String result = proxyPythonService.predictPost(knowledgeConfig.getKnowledgeInterface() + knowledgeConfig.getCreate(), requestBody);
JSONObject jo = JSON.parseObject(result); JSONObject jo = JSON.parseObject(result);
Integer code = jo.getIntValue("code"); Integer code = jo.getIntValue("code");
String msg = jo.getString("msg"); String msg = jo.getString("msg");
String data = jo.getString("data");
if (code != null && code == 200) { if (code != null && code == 200) {
KnowledgeManage knowledgeManage = MyModelUtil.copyTo(knowledgeManageDto, KnowledgeManage.class);
KnowledgeManage reKnowledgeManage = knowledgeManageService.saveNew(knowledgeManage); KnowledgeManage reKnowledgeManage = knowledgeManageService.saveNew(knowledgeManage);
return ResponseResult.success(reKnowledgeManage); return ResponseResult.success(reKnowledgeManage);
} else { } else {
...@@ -228,7 +226,6 @@ public class KnowledgeManageController { ...@@ -228,7 +226,6 @@ public class KnowledgeManageController {
} }
return ResponseResult.success(originalKnowledgeManage); return ResponseResult.success(originalKnowledgeManage);
} }
/** /**
* 删除知识库管理数据。 * 删除知识库管理数据。
* *
...@@ -279,6 +276,46 @@ public class KnowledgeManageController { ...@@ -279,6 +276,46 @@ public class KnowledgeManageController {
return ResponseResult.success(data); return ResponseResult.success(data);
} }
/**
* 直接更新知识库文档。
*
* @param requestBody 请求对象。
* @return 应答结果对象。
*/
@PostMapping("/updateDocsById")
public ResponseResult<String> updateDocsById(@RequestBody String requestBody) {
if (MyCommonUtil.existBlankArgument(requestBody)) {
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
}
String data = null;
try {
data = this.proxyPythonService.predictPost(this.knowledgeConfig.getKnowledgeInterface() + knowledgeConfig.getUpdateDocsById(), requestBody);
} catch (IOException e) {
throw new RuntimeException(e);
}
return ResponseResult.success(data);
}
/**
* 直接删除知识库文档片段。
*
* @param requestBody 请求对象。
* @return 应答结果对象。
*/
@PostMapping("/deleteDocsById")
public ResponseResult<String> deleteDocsById(@RequestBody String requestBody) {
if (MyCommonUtil.existBlankArgument(requestBody)) {
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
}
String data = null;
try {
data = this.proxyPythonService.predictPost(this.knowledgeConfig.getKnowledgeInterface() + knowledgeConfig.getDeleteDocsById(), requestBody);
} catch (IOException e) {
throw new RuntimeException(e);
}
return ResponseResult.success(data);
}
/** /**
* 删除知识库指定文件。 * 删除知识库指定文件。
* *
...@@ -354,7 +391,7 @@ public class KnowledgeManageController { ...@@ -354,7 +391,7 @@ public class KnowledgeManageController {
String msg = jo.getString("msg"); String msg = jo.getString("msg");
String data = jo.getString("data"); String data = jo.getString("data");
if (code != null && code == 200) { if (code != null && code == 200) {
return ResponseResult.create(ErrorCodeEnum.NO_ERROR, msg, data); return ResponseResult.success(data);
} else { } else {
return ResponseResult.create(ErrorCodeEnum.SERVER_INTERNAL_ERROR, msg, data); return ResponseResult.create(ErrorCodeEnum.SERVER_INTERNAL_ERROR, msg, data);
} }
...@@ -425,7 +462,7 @@ public class KnowledgeManageController { ...@@ -425,7 +462,7 @@ public class KnowledgeManageController {
if (code != null && code == 200) { if (code != null && code == 200) {
for (KnowledgeManage knowledgeManage : knowledgeManageList) { for (KnowledgeManage knowledgeManage : knowledgeManageList) {
for (Object jsonObject : jsonArray) { for (Object jsonObject : jsonArray) {
if (knowledgeManage.getKnowledgeCode().equals(String.valueOf(jsonObject))) { if (knowledgeManage.getKnowledgeName().equals(String.valueOf(jsonObject))) {
reKnowledgeManageList.add(knowledgeManage); reKnowledgeManageList.add(knowledgeManage);
} }
} }
...@@ -456,7 +493,7 @@ public class KnowledgeManageController { ...@@ -456,7 +493,7 @@ public class KnowledgeManageController {
if (code != null && code == 200) { if (code != null && code == 200) {
for (KnowledgeManage knowledgeManage : knowledgeManageList) { for (KnowledgeManage knowledgeManage : knowledgeManageList) {
for (Object jsonObject : jsonArray) { for (Object jsonObject : jsonArray) {
if (knowledgeManage.getKnowledgeCode().equals(String.valueOf(jsonObject))) { if (knowledgeManage.getKnowledgeName().equals(String.valueOf(jsonObject))) {
reKnowledgeManageList.add(knowledgeManage); reKnowledgeManageList.add(knowledgeManage);
} }
} }
...@@ -529,6 +566,6 @@ public class KnowledgeManageController { ...@@ -529,6 +566,6 @@ public class KnowledgeManageController {
errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!"; errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage); return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
} }
return this.doDeleteByName(originalKnowledgeManage.getKnowledgeCode()); return this.doDeleteByName(originalKnowledgeManage.getKnowledgeName());
} }
} }
package com.yice.webadmin.app.controller; package com.yice.webadmin.app.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.page.PageMethod; import com.github.pagehelper.page.PageMethod;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yice.common.core.annotation.MyRequestBody; import com.yice.common.core.annotation.MyRequestBody;
...@@ -10,16 +12,28 @@ import com.yice.common.core.util.MyModelUtil; ...@@ -10,16 +12,28 @@ import com.yice.common.core.util.MyModelUtil;
import com.yice.common.core.util.MyPageUtil; import com.yice.common.core.util.MyPageUtil;
import com.yice.common.log.annotation.OperationLog; import com.yice.common.log.annotation.OperationLog;
import com.yice.common.log.model.constant.SysOperationLogType; import com.yice.common.log.model.constant.SysOperationLogType;
import com.yice.webadmin.app.config.LlmModelConfig;
import com.yice.webadmin.app.config.OtherConfig;
import com.yice.webadmin.app.config.PythonConfig;
import com.yice.webadmin.app.dto.ModelDeployDto; import com.yice.webadmin.app.dto.ModelDeployDto;
import com.yice.webadmin.app.model.ModelDeploy; import com.yice.webadmin.app.model.ModelDeploy;
import com.yice.webadmin.app.model.ModelManage;
import com.yice.webadmin.app.model.ModelVersion;
import com.yice.webadmin.app.service.ModelDeployService; import com.yice.webadmin.app.service.ModelDeployService;
import com.yice.webadmin.app.service.ModelManageService;
import com.yice.webadmin.app.service.ModelVersionService;
import com.yice.webadmin.app.service.ProxyPythonService;
import com.yice.webadmin.app.vo.ModelDeployVo; import com.yice.webadmin.app.vo.ModelDeployVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.jws.WebParam;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 模型部署操作控制器类。 * 模型部署操作控制器类。
...@@ -35,6 +49,18 @@ public class ModelDeployController { ...@@ -35,6 +49,18 @@ public class ModelDeployController {
@Autowired @Autowired
private ModelDeployService modelDeployService; private ModelDeployService modelDeployService;
@Autowired
private ProxyPythonService proxyPythonService;
@Autowired
private OtherConfig otherConfig;
@Autowired
private LlmModelConfig llmModelConfig;
@Autowired
private PythonConfig pythonConfig;
@Autowired
private ModelVersionService modelVersionService;
@Autowired
private ModelManageService modelManageService;
/** /**
* 新增模型部署数据。 * 新增模型部署数据。
...@@ -56,10 +82,74 @@ public class ModelDeployController { ...@@ -56,10 +82,74 @@ public class ModelDeployController {
if (!callResult.isSuccess()) { if (!callResult.isSuccess()) {
return ResponseResult.errorFrom(callResult); return ResponseResult.errorFrom(callResult);
} }
modelDeploy = modelDeployService.saveNew(modelDeploy); List<ModelDeploy> modelDeployList = this.modelDeployService.getModelDeployList(modelDeploy, "");
for (ModelDeploy modelDeploy1 : modelDeployList) {
if (modelDeploy1.getVersionId() == modelDeploy.getVersionId()) {
return ResponseResult.error(ErrorCodeEnum.DUPLICATED_UNIQUE_KEY, "同一个模型只能部署一次!");
}
}
ModelVersion modelVersion = this.modelVersionService.getById(modelDeploy.getVersionId());
ModelManage modelManage = modelManageService.getById(modelVersion.getModelId());
modelDeploy.setDeployStatus(3);
modelDeploy.setModelId(modelVersion.getModelId());
modelDeploy.setVersionName(modelVersion.getVersionName());
modelDeploy.setModelVersion(modelVersion.getModelVersion());
modelDeploy.setModelName(modelManage.getModelName());
modelDeployService.saveNew(modelDeploy);
return ResponseResult.success(modelDeploy.getDeployId()); return ResponseResult.success(modelDeploy.getDeployId());
} }
/**
* 部署指定LLM模型。
*
* @return 应答结果对象,包含查询结果集。
*/
@PostMapping("/deploy")
public ResponseResult<String> deploy(@MyRequestBody ModelDeployDto modelDeployDto, @MyRequestBody String type) {
ModelDeploy modelDeploy = modelDeployService.getById(modelDeployDto.getDeployId());
modelDeploy.setDeployStatus(0);
modelDeployService.updateById(modelDeploy);
ResponseResult<String> responseResult = this.doReloadOrStart(modelDeploy, type);
if (responseResult.isSuccess()) {
modelDeploy.setDeployStatus(1);
modelDeployService.updateById(modelDeploy);
return ResponseResult.success(responseResult.getData());
}
modelDeploy.setDeployStatus(-1);
modelDeployService.updateById(modelDeploy);
return responseResult;
}
private ResponseResult<String> doReloadOrStart(ModelDeploy modelDeploy, String type) {
String gps_ids = JSON.parseArray(modelDeploy.getResourceInfo()).stream()
.map(obj -> ((JSONObject) obj).getString("gpu_id"))
.collect(Collectors.joining(","));
ModelVersion modelVersion = this.modelVersionService.getById(modelDeploy.getVersionId());
String requestBody = "{\n" +
" \"new_model_name\": \"" + modelDeploy.getVersionName() + "\",\n" +
" \"new_model_path\": \"" + modelVersion.getModelUrl() + "\",\n" +
" \"startup_param\": {\n" +
" \"gpu_ids\": \"" + gps_ids + "\"\n" +
" },\n" +
" \"controller_address\": \"" + pythonConfig.getControllerAddress() + "\"\n" +
"}";
try {
String apiName = type.equals("start") ? llmModelConfig.getStart() : llmModelConfig.getReload();
String result = proxyPythonService.predictPost(llmModelConfig.getLlmModelInterface() + apiName, requestBody);
JSONObject jo = JSON.parseObject(result);
Integer code = jo.getIntValue("code");
String msg = jo.getString("msg");
String data = jo.getString("data");
if (code != null && code == 200) {
return ResponseResult.success(data);
} else {
return ResponseResult.create(ErrorCodeEnum.SERVER_INTERNAL_ERROR, msg, data);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/** /**
* 更新模型部署数据。 * 更新模型部署数据。
* *
...@@ -106,6 +196,35 @@ public class ModelDeployController { ...@@ -106,6 +196,35 @@ public class ModelDeployController {
return this.doDelete(deployId); return this.doDelete(deployId);
} }
/**
* 列出所有可用模型部署列表。
*
* @return 应答结果对象,包含查询结果集。
*/
@PostMapping("/canUseList")
public ResponseResult<MyPageData<ModelDeployVo>> canUseList() {
ModelDeploy modelDeployFilter = new ModelDeploy();
modelDeployFilter.setDeployStatus(1);
List<ModelDeploy> modelDeployList =
modelDeployService.getModelDeployListWithRelation(modelDeployFilter, "deploy_id");
ResponseResult<String> responseResult = this.listRunningModels();
String data = responseResult.getData();
String[] modelNames = stringToArray(data);
List<ModelDeploy> modelDeploys = new ArrayList<ModelDeploy>();
for (ModelDeploy modelDeploy : modelDeployList) {
boolean isEx = false;
for (int i = 0; i < modelNames.length; i++) {
if (modelDeploy.getVersionName().equals(modelNames[i])) {
isEx = true;
}
}
if (isEx) {
modelDeploy.setDeployStatus(1);
modelDeploys.add(modelDeploy);
}
}
return ResponseResult.success(MyPageUtil.makeResponseData(modelDeploys, ModelDeploy.INSTANCE));
}
/** /**
* 列出符合过滤条件的模型部署列表。 * 列出符合过滤条件的模型部署列表。
* *
...@@ -126,8 +245,123 @@ public class ModelDeployController { ...@@ -126,8 +245,123 @@ public class ModelDeployController {
String orderBy = MyOrderParam.buildOrderBy(orderParam, ModelDeploy.class); String orderBy = MyOrderParam.buildOrderBy(orderParam, ModelDeploy.class);
List<ModelDeploy> modelDeployList = List<ModelDeploy> modelDeployList =
modelDeployService.getModelDeployListWithRelation(modelDeployFilter, orderBy); modelDeployService.getModelDeployListWithRelation(modelDeployFilter, orderBy);
ResponseResult<String> responseResult = this.listRunningModels();
if (!responseResult.isSuccess()) {
modelDeployList.forEach(modelDeploy -> {
modelDeploy.setDeployStatus(2);
});
return ResponseResult.success(MyPageUtil.makeResponseData(modelDeployList, ModelDeploy.INSTANCE)); return ResponseResult.success(MyPageUtil.makeResponseData(modelDeployList, ModelDeploy.INSTANCE));
} }
String data = responseResult.getData();
System.out.println(data);
String[] modelNames = stringToArray(data);
for (ModelDeploy modelDeploy : modelDeployList) {
boolean isEx = false;
for (int i = 0; i < modelNames.length; i++) {
if (modelDeploy.getVersionName().equals(modelNames[i])) {
isEx = true;
}
}
if (!isEx) {
if (modelDeploy.getDeployStatus() != 3)
modelDeploy.setDeployStatus(2);
} else {
modelDeploy.setDeployStatus(1);
}
}
return ResponseResult.success(MyPageUtil.makeResponseData(modelDeployList, ModelDeploy.INSTANCE));
}
private String[] stringToArray(String strArray) {
strArray = strArray.replaceAll("\\[|\\]|\"", "");
return strArray.split(",\\s*"); // 正则表达式也考虑了逗号后的空格
}
private ResponseResult<String> listRunningModels() {
String requestBody = "{\n" +
" \"controller_address\": \"" + pythonConfig.getControllerAddress() + "\",\n" +
" \"placeholder\": \"string\"\n" +
"}";
try {
String result = proxyPythonService.predictPost(llmModelConfig.getLlmModelInterface() + llmModelConfig.getListRunningModels(), requestBody);
JSONObject jo = JSON.parseObject(result);
Integer code = jo.getIntValue("code");
String msg = jo.getString("msg");
String data = jo.getString("data");
if (code != null && code == 200) {
return ResponseResult.success(data);
} else {
return ResponseResult.create(ErrorCodeEnum.SERVER_INTERNAL_ERROR, msg, data);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/**
* 获取GPU信息。
*
* @return 应答结果对象,包含查询结果集。
*/
@PostMapping("/getGpuInfo")
public ResponseResult<String> getGpuInfo() {
try {
String result = proxyPythonService.predictPost(otherConfig.getOtherInterface() + otherConfig.getGetGpuInfo(), "");
JSONObject jo = JSON.parseObject(result);
Integer code = jo.getIntValue("code");
String msg = jo.getString("msg");
String data = jo.getString("data");
if (code != null && code == 200) {
return ResponseResult.success(data);
} else {
return ResponseResult.create(ErrorCodeEnum.SERVER_INTERNAL_ERROR, msg, data);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/**
* 停止指定LLM模型。
*
* @return 应答结果对象,包含查询结果集。
*/
@PostMapping("/stop")
public ResponseResult<String> stop(@MyRequestBody ModelDeployDto modelDeployDto) {
ModelDeploy modelDeploy = modelDeployService.getById(modelDeployDto.getDeployId());
ResponseResult<String> responseResult = this.doStop(modelDeploy);
if (responseResult.isSuccess()) {
modelDeploy.setDeployStatus(3);
modelDeployService.updateById(modelDeploy);
return ResponseResult.success(responseResult.getData());
}
return responseResult;
}
private ResponseResult<String> doStop(ModelDeploy modelDeploy) {
String errorMessage = MyCommonUtil.getModelValidationError(modelDeploy, true);
if (errorMessage != null) {
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
}
String requestBody = "{\n" +
" \"model_name\": \"" + modelDeploy.getVersionName() + "\",\n" +
" \"controller_address\": \"" + pythonConfig.getControllerAddress() + "\"\n" +
"}";
try {
String result = proxyPythonService.predictPost(llmModelConfig.getLlmModelInterface() + llmModelConfig.getStop(), requestBody);
JSONObject jo = JSON.parseObject(result);
Integer code = jo.getIntValue("code");
String msg = jo.getString("msg");
String data = jo.getString("data");
if (code != null && code == 200) {
return ResponseResult.success(data);
} else {
return ResponseResult.create(ErrorCodeEnum.SERVER_INTERNAL_ERROR, msg, data);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/** /**
* 查看指定模型部署对象详情。 * 查看指定模型部署对象详情。
...@@ -158,6 +392,7 @@ public class ModelDeployController { ...@@ -158,6 +392,7 @@ public class ModelDeployController {
errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!"; errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!";
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage); return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
} }
this.doStop(originalModelDeploy);
return ResponseResult.success(); return ResponseResult.success();
} }
} }
...@@ -44,15 +44,4 @@ public interface DatasetManageMapper extends BaseDaoMapper<DatasetManage> { ...@@ -44,15 +44,4 @@ public interface DatasetManageMapper extends BaseDaoMapper<DatasetManage> {
@Param("datasetManageFilter") DatasetManage datasetManageFilter, @Param("datasetManageFilter") DatasetManage datasetManageFilter,
@Param("datasetVersionFilter") DatasetVersion datasetVersionFilter, @Param("datasetVersionFilter") DatasetVersion datasetVersionFilter,
@Param("orderBy") String orderBy); @Param("orderBy") String orderBy);
/**
* 查询最新的数据列表。
*
* @param datasetManageFilter 主表过滤对象。
* @param orderBy 排序字符串,order by从句的参数。
* @return 对象列表。
*/
List<DatasetManage> getDatasetManageGroupList(
@Param("datasetManageFilter") DatasetManage datasetManageFilter,
@Param("orderBy") String orderBy);
} }
package com.yice.webadmin.app.dao; package com.yice.webadmin.app.dao;
import com.yice.common.core.base.dao.BaseDaoMapper; import com.yice.common.core.base.dao.BaseDaoMapper;
import com.yice.webadmin.app.model.DatasetOutput; import com.yice.webadmin.app.model.KGManage;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.*;
/** /**
* 数据集导出数据操作访问接口。 * 知识图谱管理数据操作访问接口。
* *
* @author linking * @author linking
* @date 2023-04-13 * @date 2023-04-13
*/ */
public interface DatasetOutputMapper extends BaseDaoMapper<DatasetOutput> { public interface KGManageMapper extends BaseDaoMapper<KGManage> {
/** /**
* 批量插入对象列表。 * 批量插入对象列表。
* *
* @param datasetOutputList 新增对象列表。 * @param kGManageList 新增对象列表。
*/ */
void insertList(List<DatasetOutput> datasetOutputList); void insertList(List<KGManage> kGManageList);
/** /**
* 获取过滤后的对象列表。 * 获取过滤后的对象列表。
* *
* @param datasetOutputFilter 主表过滤对象。 * @param kGManageFilter 主表过滤对象。
* @param orderBy 排序字符串,order by从句的参数。 * @param orderBy 排序字符串,order by从句的参数。
* @return 对象列表。 * @return 对象列表。
*/ */
List<DatasetOutput> getDatasetOutputList( List<KGManage> getKGManageList(
@Param("datasetOutputFilter") DatasetOutput datasetOutputFilter, @Param("orderBy") String orderBy); @Param("kGManageFilter") KGManage kGManageFilter, @Param("orderBy") String orderBy);
} }
...@@ -11,10 +11,6 @@ ...@@ -11,10 +11,6 @@
<result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/> <result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="data_type" jdbcType="TINYINT" property="dataType"/> <result column="data_type" jdbcType="TINYINT" property="dataType"/>
<result column="data_volume" jdbcType="TINYINT" property="dataVolume"/>
<result column="release_status" jdbcType="TINYINT" property="releaseStatus"/>
<result column="input_status" jdbcType="TINYINT" property="inputStatus"/>
<result column="dataset_version" jdbcType="TINYINT" property="datasetVersion"/>
</resultMap> </resultMap>
<insert id="insertList"> <insert id="insertList">
...@@ -99,23 +95,4 @@ ...@@ -99,23 +95,4 @@
ORDER BY ${orderBy} ORDER BY ${orderBy}
</if> </if>
</select> </select>
<select id="getDatasetManageGroupList" resultMap="BaseResultMap" parameterType="com.yice.webadmin.app.model.DatasetManage">
SELECT lmp_dataset_manage.*, version.release_status, version.input_status, version.data_volume, version.dataset_version
FROM
lmp_dataset_manage lmp_dataset_manage
JOIN (
SELECT dataset_id, MAX(dataset_version) as max_dataset_version
FROM lmp_dataset_version
GROUP BY dataset_id
) v ON lmp_dataset_manage.dataset_id = v.dataset_id
JOIN lmp_dataset_version version ON lmp_dataset_manage.dataset_id = version.dataset_id
AND v.max_dataset_version = version.dataset_version
<where>
<include refid="filterRef"/>
</where>
<if test="orderBy != null and orderBy != ''">
ORDER BY ${orderBy}
</if>
</select>
</mapper> </mapper>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yice.webadmin.app.dao.DatasetOutputMapper"> <mapper namespace="com.yice.webadmin.app.dao.KGManageMapper">
<resultMap id="BaseResultMap" type="com.yice.webadmin.app.model.DatasetOutput"> <resultMap id="BaseResultMap" type="com.yice.webadmin.app.model.KGManage">
<id column="output_id" jdbcType="BIGINT" property="outputId"/> <id column="kg_id" jdbcType="BIGINT" property="kgId"/>
<result column="output_postion" jdbcType="VARCHAR" property="outputPostion"/>
<result column="mark_format_type" jdbcType="VARCHAR" property="markFormatType"/>
<result column="output_content" jdbcType="VARCHAR" property="outputContent"/>
<result column="file_size" jdbcType="VARCHAR" property="fileSize"/>
<result column="data_count" jdbcType="BIGINT" property="dataCount"/>
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/> <result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
<result column="version_id" jdbcType="BIGINT" property="versionId"/> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="output_start_time" jdbcType="TIMESTAMP" property="outputStartTime"/> <result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
<result column="output_end_time" jdbcType="TIMESTAMP" property="outputEndTime"/> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="status" jdbcType="TINYINT" property="status"/> <result column="kg_name" jdbcType="VARCHAR" property="kgName"/>
<result column="download_url" jdbcType="VARCHAR" property="downloadUrl"/> <result column="kg_describe" jdbcType="VARCHAR" property="kgDescribe"/>
<result column="kg_url" jdbcType="VARCHAR" property="kgUrl"/>
<result column="kg_user_name" jdbcType="VARCHAR" property="kgUserName"/>
<result column="kg_password" jdbcType="VARCHAR" property="kgPassword"/>
<result column="kg_bower_url" jdbcType="VARCHAR" property="kgBowerUrl"/>
<result column="kg_type" jdbcType="VARCHAR" property="kgType"/>
</resultMap> </resultMap>
<insert id="insertList"> <insert id="insertList">
INSERT INTO lmp_data_output INSERT INTO lmp_kg_manage
(output_id, (kg_id,
output_postion,
mark_format_type,
output_content,
file_size,
data_count,
create_user_id, create_user_id,
output_start_time, create_time,
output_end_time, update_user_id,
status, update_time,
download_url, kg_name,
version_id) kg_describe,
kg_url,
kg_user_name,
kg_password,
kg_bower_url,
kg_type)
VALUES VALUES
<foreach collection="list" index="index" item="item" separator=","> <foreach collection="list" index="index" item="item" separator="," >
(#{item.outputId}, (#{item.kgId},
#{item.outputPostion},
#{item.markFormatType},
#{item.outputContent},
#{item.fileSize},
#{item.dataCount},
#{item.createUserId}, #{item.createUserId},
#{item.outputStartTime}, #{item.createTime},
#{item.outputEndTime}, #{item.updateUserId},
#{item.status}, #{item.updateTime},
#{item.downloadUrl}, #{item.kgName},
#{item.versionId}) #{item.kgDescribe},
#{item.kgUrl},
#{item.kgUserName},
#{item.kgPassword},
#{item.kgBowerUrl},
#{item.kgType})
</foreach> </foreach>
</insert> </insert>
<!-- 如果有逻辑删除字段过滤,请写到这里 --> <!-- 如果有逻辑删除字段过滤,请写到这里 -->
<sql id="filterRef"> <sql id="filterRef">
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 --> <!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
<include refid="com.yice.webadmin.app.dao.DatasetOutputMapper.inputFilterRef"/> <include refid="com.yice.webadmin.app.dao.KGManageMapper.inputFilterRef"/>
</sql> </sql>
<!-- 这里仅包含调用接口输入的主表过滤条件 --> <!-- 这里仅包含调用接口输入的主表过滤条件 -->
<sql id="inputFilterRef"> <sql id="inputFilterRef">
<if test="datasetOutputFilter != null"> <if test="kGManageFilter != null">
<if test="datasetOutputFilter.outputId != null"> <if test="kGManageFilter.kgName != null and kGManageFilter.kgName != ''">
AND lmp_data_output.output_id = #{datasetOutputFilter.datasetId} AND lmp_kg_manage.kg_name = #{kGManageFilter.kgName}
</if>
<if test="datasetOutputFilter.versionId != null">
AND lmp_data_output.version_id = #{datasetOutputFilter.versionId}
</if>
<if test="datasetOutputFilter.markFormatType != null">
AND lmp_data_output.mark_format_type = #{datasetOutputFilter.markFormatType}
</if> </if>
</if> </if>
</sql> </sql>
<select id="getDatasetOutputList" resultMap="BaseResultMap" parameterType="com.yice.webadmin.app.model.DatasetOutput"> <select id="getKGManageList" resultMap="BaseResultMap" parameterType="com.yice.webadmin.app.model.KGManage">
SELECT * FROM lmp_data_output SELECT * FROM lmp_kg_manage
<where> <where>
<include refid="filterRef"/> <include refid="filterRef"/>
</where> </where>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<result column="knowledge_name" jdbcType="VARCHAR" property="knowledgeName"/> <result column="knowledge_name" jdbcType="VARCHAR" property="knowledgeName"/>
<result column="knowledge_code" jdbcType="VARCHAR" property="knowledgeCode"/> <result column="knowledge_code" jdbcType="VARCHAR" property="knowledgeCode"/>
<result column="knowledge_describe" jdbcType="VARCHAR" property="knowledgeDescribe"/> <result column="knowledge_describe" jdbcType="VARCHAR" property="knowledgeDescribe"/>
<result column="knowledge_format" jdbcType="VARCHAR" property="knowledgeFormat"/>
</resultMap> </resultMap>
<insert id="insertList"> <insert id="insertList">
...@@ -21,7 +22,8 @@ ...@@ -21,7 +22,8 @@
update_time, update_time,
knowledge_name, knowledge_name,
knowledge_code, knowledge_code,
knowledge_describe) knowledge_describe,
knowledge_format)
VALUES VALUES
<foreach collection="list" index="index" item="item" separator=","> <foreach collection="list" index="index" item="item" separator=",">
(#{item.knowledgeId}, (#{item.knowledgeId},
...@@ -31,7 +33,8 @@ ...@@ -31,7 +33,8 @@
#{item.updateTime}, #{item.updateTime},
#{item.knowledgeName}, #{item.knowledgeName},
#{item.knowledgeCode}, #{item.knowledgeCode},
#{item.knowledgeDescribe}) #{item.knowledgeDescribe},
#{item.knowledgeFormat})
</foreach> </foreach>
</insert> </insert>
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="com.yice.webadmin.app.model.ModelDeploy"> <resultMap id="BaseResultMap" type="com.yice.webadmin.app.model.ModelDeploy">
<id column="deploy_id" jdbcType="BIGINT" property="deployId"/> <id column="deploy_id" jdbcType="BIGINT" property="deployId"/>
<result column="model_id" jdbcType="BIGINT" property="modelId"/> <result column="model_id" jdbcType="BIGINT" property="modelId"/>
<result column="model_name" jdbcType="VARCHAR" property="modelName"/>
<result column="version_id" jdbcType="BIGINT" property="versionId"/> <result column="version_id" jdbcType="BIGINT" property="versionId"/>
<result column="version_name" jdbcType="VARCHAR" property="versionName"/> <result column="version_name" jdbcType="VARCHAR" property="versionName"/>
<result column="deploy_status" jdbcType="TINYINT" property="deployStatus"/> <result column="deploy_status" jdbcType="TINYINT" property="deployStatus"/>
...@@ -15,12 +16,15 @@ ...@@ -15,12 +16,15 @@
<result column="service_id" jdbcType="BIGINT" property="serviceId"/> <result column="service_id" jdbcType="BIGINT" property="serviceId"/>
<result column="service_name" jdbcType="VARCHAR" property="serviceName"/> <result column="service_name" jdbcType="VARCHAR" property="serviceName"/>
<result column="service_version" jdbcType="TINYINT" property="serviceVersion"/> <result column="service_version" jdbcType="TINYINT" property="serviceVersion"/>
<result column="resource_info" jdbcType="VARCHAR" property="resourceInfo"/>
<result column="service_remark" jdbcType="VARCHAR" property="serviceRemark"/>
</resultMap> </resultMap>
<insert id="insertList"> <insert id="insertList">
INSERT INTO lmp_model_deploy INSERT INTO lmp_model_deploy
(deploy_id, (deploy_id,
model_id, model_id,
model_name,
version_id, version_id,
version_name, version_name,
deploy_status, deploy_status,
...@@ -31,11 +35,14 @@ ...@@ -31,11 +35,14 @@
model_version, model_version,
service_id, service_id,
service_name, service_name,
service_version) service_version,
resource_info,
service_remark)
VALUES VALUES
<foreach collection="list" index="index" item="item" separator=","> <foreach collection="list" index="index" item="item" separator=",">
(#{item.deployId}, (#{item.deployId},
#{item.modelId}, #{item.modelId},
#{item.modelName},
#{item.versionId}, #{item.versionId},
#{item.versionName}, #{item.versionName},
#{item.deployStatus}, #{item.deployStatus},
...@@ -46,7 +53,9 @@ ...@@ -46,7 +53,9 @@
#{item.modelVersion}, #{item.modelVersion},
#{item.serviceId}, #{item.serviceId},
#{item.serviceName}, #{item.serviceName},
#{item.serviceVersion}) #{item.serviceVersion},
#{item.resourceInfo},
#{item.serviceRemark})
</foreach> </foreach>
</insert> </insert>
......
...@@ -29,8 +29,4 @@ public class DatasetData { ...@@ -29,8 +29,4 @@ public class DatasetData {
@ApiModelProperty(name = "createTime",value="创建时间") @ApiModelProperty(name = "createTime",value="创建时间")
private Date createTime; private Date createTime;
@ApiModelProperty(name = "markStatus",value="标记状态")
private Integer markStatus;
} }
...@@ -12,7 +12,7 @@ import java.util.Date; ...@@ -12,7 +12,7 @@ import java.util.Date;
* @author linking * @author linking
* @date 2023-04-13 * @date 2023-04-13
*/ */
@ApiModel("DatasetMongoDto视图对象") @ApiModel("DatasetDataDto视图对象")
@Data @Data
public class DatasetDataDto { public class DatasetDataDto {
...@@ -39,10 +39,4 @@ public class DatasetDataDto { ...@@ -39,10 +39,4 @@ public class DatasetDataDto {
*/ */
@ApiModelProperty(value="创建时间") @ApiModelProperty(value="创建时间")
private Date createTime; private Date createTime;
/**
* 标记状态。
*/
@ApiModelProperty(value="标记状态:0:未标记,1:已标记")
private Integer markStatus;
} }
package com.yice.webadmin.app.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* DatasetDataSummaryDto视图对象。
*
* @author linking
* @date 2023-04-13
*/
@ApiModel("DatasetDataSummaryDto视图对象")
@Data
public class DatasetDataSummaryDto {
/**
* 全部标记数
*/
@ApiModelProperty(value = "全部标记数")
private Long allMarkCount;
/**
* 未标记数
*/
@ApiModelProperty(value = "未标记数")
private Long unMarkCount;
/**
* 已标记数
*/
@ApiModelProperty(value = "已标记数")
private Long markCount;
}
...@@ -48,30 +48,6 @@ public class DatasetManageDto { ...@@ -48,30 +48,6 @@ public class DatasetManageDto {
@ApiModelProperty(value = "数据类型") @ApiModelProperty(value = "数据类型")
private Integer dataType; private Integer dataType;
/**
* 数据量。
*/
@ApiModelProperty(value = "数据量")
private Long dataVolume;
/**
* 发布状态。
*/
@ApiModelProperty(value = "发布状态")
private Integer releaseStatus;
/**
* 导入状态。
*/
@ApiModelProperty(value = "导入状态")
private Integer inputStatus;
/**
* 版本。
*/
@ApiModelProperty(value = "版本")
private Integer datasetVersion;
/** /**
* dataset_name LIKE搜索字符串。 * dataset_name LIKE搜索字符串。
*/ */
......
package com.yice.webadmin.app.dto;
import com.yice.common.core.validator.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* DatasetOutputDto对象。
*
* @author linking
* @date 2023-04-13
*/
@ApiModel("DatasetOutputDto对象")
@Data
public class DatasetOutputDto {
/**
* 导出任务ID。
*/
@ApiModelProperty(value = "导出任务ID", required = true)
@NotNull(message = "数据验证失败,导出任务ID不能为空!", groups = {UpdateGroup.class})
private Long outputId;
/**
* 导出位置。
*/
@ApiModelProperty(value = "导出位置", required = true)
private String outputPostion;
/**
* 导出格式类型。
*/
@ApiModelProperty(value = "导出格式类型")
private String markFormatType;
/**
* 导出内容。
*/
@ApiModelProperty(value = "导出内容")
private String outputContent;
/**
* 文件大小。
*/
@ApiModelProperty(value = "文件大小")
private String fileSize;
/**
* 数据量。
*/
@ApiModelProperty(value = "数据量")
private Long dataCount;
/**
* 创建人。
*/
@ApiModelProperty(value = "创建人")
private Long createUserId;
/**
* 导出开始时间。
*/
@ApiModelProperty(value = "导出开始时间")
private Date outputStartTime;
/**
* 导出完成时间。
*/
@ApiModelProperty(value = "导出完成时间")
private Date outputEndTime;
/**
* 状态。
*/
@ApiModelProperty(value = "状态:0:标识未完成;1标识已完成")
private Integer status;
/**
* 下载地址。
*/
@ApiModelProperty(value = "下载地址")
private String downloadUrl;
/**
* 版本ID。
*/
@ApiModelProperty(value = "版本ID")
private Long versionId;
}
...@@ -64,7 +64,7 @@ public class DatasetVersionDto { ...@@ -64,7 +64,7 @@ public class DatasetVersionDto {
/** /**
* 发布状态。 * 发布状态。
*/ */
@ApiModelProperty(value = "发布状态:0标识未发布;1标识已发布") @ApiModelProperty(value = "发布状态")
private Integer releaseStatus; private Integer releaseStatus;
/** /**
......
package com.yice.webadmin.app.dto;
import com.yice.common.core.validator.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.*;
/**
* KGManageDto对象。
*
* @author linking
* @date 2023-04-13
*/
@ApiModel("KGManageDto对象")
@Data
public class KGManageDto {
/**
* 知识图谱ID。
*/
@ApiModelProperty(value = "知识图谱ID", required = true)
@NotNull(message = "数据验证失败,知识图谱ID不能为空!", groups = {UpdateGroup.class})
private Long kgId;
/**
* 知识图谱名称。
*/
@ApiModelProperty(value = "知识图谱名称")
@NotNull(message = "数据验证失败,知识图谱名称不能为空!", groups = {UpdateGroup.class})
private String kgName;
/**
* 知识图谱描述。
*/
@ApiModelProperty(value = "知识图谱描述")
private String kgDescribe;
/**
* 知识图谱地址。
*/
@ApiModelProperty(value = "知识图谱地址")
private String kgUrl;
/**
* 知识图谱用户名。
*/
@ApiModelProperty(value = "知识图谱用户名")
private String kgUserName;
/**
* 知识图谱密码。
*/
@ApiModelProperty(value = "知识图谱密码")
private String kgPassword;
/**
* 知识图谱浏览地址。
*/
@ApiModelProperty(value = "知识图谱浏览地址")
private String kgBowerUrl;
/**
* 知识图谱类型。
*/
@ApiModelProperty(value = "知识图谱类型")
private String kgType;
}
...@@ -49,4 +49,10 @@ public class KnowledgeManageDto { ...@@ -49,4 +49,10 @@ public class KnowledgeManageDto {
*/ */
@ApiModelProperty(value = "LIKE模糊搜索字符串") @ApiModelProperty(value = "LIKE模糊搜索字符串")
private String searchString; private String searchString;
/**
* 知识格式。
*/
@ApiModelProperty(value = "知识格式")
private String knowledgeFormat;
} }
...@@ -30,6 +30,12 @@ public class ModelDeployDto { ...@@ -30,6 +30,12 @@ public class ModelDeployDto {
@ApiModelProperty(value = "模型ID") @ApiModelProperty(value = "模型ID")
private Long modelId; private Long modelId;
/**
* 模型名称。
*/
@ApiModelProperty(value = "模型名称")
private String modelName;
/** /**
* 版本ID。 * 版本ID。
*/ */
...@@ -71,4 +77,22 @@ public class ModelDeployDto { ...@@ -71,4 +77,22 @@ public class ModelDeployDto {
*/ */
@ApiModelProperty(value = "服务版本") @ApiModelProperty(value = "服务版本")
private Integer serviceVersion; private Integer serviceVersion;
/**
* 资源信息。
*/
@ApiModelProperty(value = "资源信息")
private String resourceInfo;
/**
* 服务描述。
*/
@ApiModelProperty(value = "服务描述")
private String serviceRemark;
/**
* 资源id。
*/
@ApiModelProperty(value = "资源id")
private String gpuIds;
} }
...@@ -51,35 +51,12 @@ public class DatasetManage extends BaseModel { ...@@ -51,35 +51,12 @@ public class DatasetManage extends BaseModel {
*/ */
private Integer template; private Integer template;
/** /**
* 数据类型。 * 数据类型。
*/ */
private Integer dataType; private Integer dataType;
/**
* 数据量。
*/
@TableField(exist = false)
private Long dataVolume;
/**
* 发布状态。
*/
@TableField(exist = false)
private Integer releaseStatus;
/**
* 导入状态。
*/
@TableField(exist = false)
private Integer inputStatus;
/**
* 版本。
*/
@TableField(exist = false)
private Integer datasetVersion;
/** /**
* dataset_name LIKE搜索字符串。 * dataset_name LIKE搜索字符串。
*/ */
......
package com.yice.webadmin.app.model;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yice.common.core.base.mapper.BaseModelMapper;
import com.yice.common.core.base.model.BaseModel;
import com.yice.webadmin.app.vo.DatasetOutputVo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.Date;
/**
* DatasetOutput实体对象。
*
* @author linking
* @date 2023-04-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "lmp_data_output")
public class DatasetOutput extends BaseModel {
/**
* 导出任务ID。
*/
@TableId(value = "output_id")
private Long outputId;
/**
* 导出位置。
*/
private String outputPostion;
/**
* 导出文件格式类型。
*/
private String markFormatType;
/**
* 版本标识。
*/
private Long versionId;
/**
* 导出内容。
*/
private String outputContent;
/**
* 文件大小。
*/
private String fileSize;
/**
* 数据量。
*/
private Long dataCount;
/**
* 创建人。
*/
private Long createUserId;
/**
* 导出开始时间。
*/
private Date outputStartTime;
/**
* 导出完成时间。
*/
private Date outputEndTime;
/**
* 状态。
*/
private Integer status;
/**
* 下载地址。
*/
private String downloadUrl;
@Mapper
public interface DatasetOutputModelMapper extends BaseModelMapper<DatasetOutputVo, DatasetOutput> {
/**
* 转换Vo对象到实体对象。
*
* @param datasetOutputVo 域对象。
* @return 实体对象。
*/
@Override
DatasetOutput toModel(DatasetOutputVo datasetOutputVo);
/**
* 转换实体对象到VO对象。
*
* @param datasetOutput 实体对象。
* @return 域对象。
*/
@Override
DatasetOutputVo fromModel(DatasetOutput datasetOutput);
}
public static final DatasetOutput.DatasetOutputModelMapper INSTANCE = Mappers.getMapper(DatasetOutput.DatasetOutputModelMapper.class);
}
package com.yice.webadmin.app.model;
import com.baomidou.mybatisplus.annotation.*;
import com.yice.common.core.base.model.BaseModel;
import com.yice.common.core.base.mapper.BaseModelMapper;
import com.yice.webadmin.app.vo.KGManageVo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.mapstruct.*;
import org.mapstruct.factory.Mappers;
/**
* KGManage实体对象。
*
* @author linking
* @date 2023-04-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "lmp_kg_manage")
public class KGManage extends BaseModel {
/**
* 知识图谱ID。
*/
@TableId(value = "kg_id")
private Long kgId;
/**
* 知识图谱名称。
*/
private String kgName;
/**
* 知识图谱描述。
*/
private String kgDescribe;
/**
* 知识图谱地址。
*/
private String kgUrl;
/**
* 知识图谱用户名。
*/
private String kgUserName;
/**
* 知识图谱密码。
*/
private String kgPassword;
/**
* 知识图谱浏览地址。
*/
private String kgBowerUrl;
/**
* 知识图谱类型。
*/
private String kgType;
@Mapper
public interface KGManageModelMapper extends BaseModelMapper<KGManageVo, KGManage> {
}
public static final KGManageModelMapper INSTANCE = Mappers.getMapper(KGManageModelMapper.class);
}
...@@ -48,6 +48,11 @@ public class KnowledgeManage extends BaseModel { ...@@ -48,6 +48,11 @@ public class KnowledgeManage extends BaseModel {
*/ */
private String knowledgeDescribe; private String knowledgeDescribe;
/**
* 知识格式。
*/
private String knowledgeFormat;
/** /**
* knowledge_name LIKE搜索字符串。 * knowledge_name LIKE搜索字符串。
*/ */
......
...@@ -32,6 +32,10 @@ public class ModelDeploy extends BaseModel { ...@@ -32,6 +32,10 @@ public class ModelDeploy extends BaseModel {
*/ */
private Long modelId; private Long modelId;
/**
* 模型名称。
*/
private String modelName;
/** /**
* 版本ID。 * 版本ID。
*/ */
...@@ -67,6 +71,16 @@ public class ModelDeploy extends BaseModel { ...@@ -67,6 +71,16 @@ public class ModelDeploy extends BaseModel {
*/ */
private Integer serviceVersion; private Integer serviceVersion;
/**
* 资源信息。
*/
private String resourceInfo;
/**
* 服务描述。
*/
private String serviceRemark;
@Mapper @Mapper
public interface ModelDeployModelMapper extends BaseModelMapper<ModelDeployVo, ModelDeploy> { public interface ModelDeployModelMapper extends BaseModelMapper<ModelDeployVo, ModelDeploy> {
} }
......
...@@ -45,14 +45,6 @@ public interface DatasetDataService { ...@@ -45,14 +45,6 @@ public interface DatasetDataService {
*/ */
Long count(Long versionId); Long count(Long versionId);
/**
* 查询列表集合总条数
* @param filter 过滤条件
* @return 返回总条数
*/
Long count(DatasetData filter);
/** /**
* 查询列表集合 * 查询列表集合
* @param versionId 版本标识 * @param versionId 版本标识
...@@ -61,15 +53,6 @@ public interface DatasetDataService { ...@@ -61,15 +53,6 @@ public interface DatasetDataService {
*/ */
List<DatasetData> list(Long versionId, MyPageParam pageParam); List<DatasetData> list(Long versionId, MyPageParam pageParam);
/**
* 根据条件查询数据集数据。
*
* @param filter 过滤对象。
* @param pageParam 分页对象。
* @return 查询结果集。
*/
List<DatasetData> list(DatasetData filter, MyPageParam pageParam);
/** /**
* 更新数据对象。 * 更新数据对象。
* *
......
...@@ -68,20 +68,5 @@ public interface DatasetManageService extends IBaseService<DatasetManage, Long> ...@@ -68,20 +68,5 @@ public interface DatasetManageService extends IBaseService<DatasetManage, Long>
*/ */
List<DatasetManage> getDatasetManageListWithRelation(DatasetManage filter, DatasetVersion datasetVersionFilter, String orderBy); List<DatasetManage> getDatasetManageListWithRelation(DatasetManage filter, DatasetVersion datasetVersionFilter, String orderBy);
/**
* 获取数据集管理对象
*
* @param filter 主表过滤对象。
* @param orderBy 排序参数。
* @return 查询结果集。
*/
List<DatasetManage> getDatasetManageGroupList(DatasetManage filter, String orderBy);
/**
* 保存和创建数据集版本管理
* @param datasetManage 数据集管理对象
* @return 数据集管理对象
*/
DatasetManage saveAndCreateVersion(DatasetManage datasetManage); DatasetManage saveAndCreateVersion(DatasetManage datasetManage);
} }
...@@ -43,7 +43,7 @@ public interface DatasetVersionService extends IBaseService<DatasetVersion, Long ...@@ -43,7 +43,7 @@ public interface DatasetVersionService extends IBaseService<DatasetVersion, Long
* @param originalFilename 导入文件名称 * @param originalFilename 导入文件名称
* @param versionId 版本标识 * @param versionId 版本标识
*/ */
void writeDatasetFile(byte[] bytes, String originalFilename, Long versionId); void writeDatasetFileForMongo(byte[] bytes, String originalFilename, Long versionId);
/** /**
* 更新数据对象。 * 更新数据对象。
...@@ -54,14 +54,6 @@ public interface DatasetVersionService extends IBaseService<DatasetVersion, Long ...@@ -54,14 +54,6 @@ public interface DatasetVersionService extends IBaseService<DatasetVersion, Long
*/ */
boolean update(DatasetVersion datasetVersion, DatasetVersion originalDatasetVersion); boolean update(DatasetVersion datasetVersion, DatasetVersion originalDatasetVersion);
/**
* 更新数据对象。
*
* @param datasetVersion 更新的对象。
* @return 成功返回true,否则false。
*/
boolean update(DatasetVersion datasetVersion);
/** /**
* 删除指定数据。 * 删除指定数据。
* *
......
package com.yice.webadmin.app.service; package com.yice.webadmin.app.service;
import com.yice.webadmin.app.model.*;
import com.yice.common.core.base.service.IBaseService; import com.yice.common.core.base.service.IBaseService;
import com.yice.webadmin.app.model.DatasetOutput;
import java.util.List; import java.util.*;
/** /**
* 数据集导出数据操作服务接口。 * 知识图谱管理数据操作服务接口。
* *
* @author linking * @author linking
* @date 2023-04-13 * @date 2023-04-13
*/ */
public interface DatasetOutputService extends IBaseService<DatasetOutput, Long> { public interface KGManageService extends IBaseService<KGManage, Long> {
/** /**
* 保存新增对象。 * 保存新增对象。
* *
* @param datasetOutput 新增对象。 * @param kGManage 新增对象。
* @return 返回新增对象。 * @return 返回新增对象。
*/ */
DatasetOutput saveNew(DatasetOutput datasetOutput); KGManage saveNew(KGManage kGManage);
/**
* 记录地址并保存到minio中。
* @param fileType 文件类型。
* @param fileUrl 文件地址。
* @param versionId 版本标识。
* @return 返回新增对象。
*/
DatasetOutput saveNew(String fileType, String fileUrl, Long versionId);
/** /**
* 利用数据库的insertList语法,批量插入对象列表。 * 利用数据库的insertList语法,批量插入对象列表。
* *
* @param datasetOutputList 新增对象列表。 * @param kGManageList 新增对象列表。
*/ */
void saveNewBatch(List<DatasetOutput> datasetOutputList); void saveNewBatch(List<KGManage> kGManageList);
/** /**
* 更新数据对象。 * 更新数据对象。
* *
* @param DatasetOutput 更新的对象。 * @param kGManage 更新的对象。
* @param originalDatasetOutput 原有数据对象。 * @param originalKGManage 原有数据对象。
* @return 成功返回true,否则false。 * @return 成功返回true,否则false。
*/ */
boolean update(DatasetOutput DatasetOutput, DatasetOutput originalDatasetOutput); boolean update(KGManage kGManage, KGManage originalKGManage);
/** /**
* 删除指定数据。 * 删除指定数据。
* *
* @param outputId 主键Id。 * @param kgId 主键Id。
* @return 成功返回true,否则false。 * @return 成功返回true,否则false。
*/ */
boolean remove(Long outputId); boolean remove(Long kgId);
/** /**
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。 * 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
* 如果需要同时获取关联数据,请移步(getDatasetOutputListWithRelation)方法。 * 如果需要同时获取关联数据,请移步(getKGManageListWithRelation)方法。
* *
* @param filter 过滤对象。 * @param filter 过滤对象。
* @param orderBy 排序参数。 * @param orderBy 排序参数。
* @return 查询结果集。 * @return 查询结果集。
*/ */
List<DatasetOutput> getDatasetOutputList(DatasetOutput filter, String orderBy); List<KGManage> getKGManageList(KGManage filter, String orderBy);
/** /**
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。 * 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。 * 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
* 如果仅仅需要获取主表数据,请移步(getDatasetOutputList),以便获取更好的查询性能。 * 如果仅仅需要获取主表数据,请移步(getKGManageList),以便获取更好的查询性能。
* *
* @param filter 主表过滤对象。 * @param filter 主表过滤对象。
* @param orderBy 排序参数。 * @param orderBy 排序参数。
* @return 查询结果集。 * @return 查询结果集。
*/ */
List<DatasetOutput> getDatasetOutputListWithRelation(DatasetOutput filter, String orderBy); List<KGManage> getKGManageListWithRelation(KGManage filter, String orderBy);
} }
package com.yice.webadmin.app.service.impl; package com.yice.webadmin.app.service.impl;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yice.common.core.object.MyPageParam; import com.yice.common.core.object.MyPageParam;
import com.yice.webadmin.app.constant.MongoConstant; import com.yice.webadmin.app.constant.MongoConstant;
import com.yice.webadmin.app.data.DatasetData; import com.yice.webadmin.app.data.DatasetData;
...@@ -37,20 +36,15 @@ public class DatasetDataServiceImpl implements DatasetDataService { ...@@ -37,20 +36,15 @@ public class DatasetDataServiceImpl implements DatasetDataService {
* @param datasetData 新增对象。 * @param datasetData 新增对象。
* @return 返回新增对象。 * @return 返回新增对象。
*/ */
@Override
public void save(DatasetData datasetData) { public void save(DatasetData datasetData) {
if (StringUtils.isNotBlank(datasetData.getData())) { if (StringUtils.isNotBlank(datasetData.getData())) {
List<Document> documents = new ArrayList<>(); List<Document> documents = new ArrayList<>();
JSONArray jsonArray = JSONArray.parseArray(datasetData.getData()); JSONArray jsonArray = JSONArray.parseArray(datasetData.getData());
if (null != jsonArray && jsonArray.size() > 0) { if (null != jsonArray && jsonArray.size() > 0) {
for (int i = 0; i < jsonArray.size(); i++) { for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i); Document document = new Document(MongoConstant.DATA, jsonArray.getJSONObject(i))
Integer markStatus = jsonObject.getString(MongoConstant.OUTPUT) != null
&& !jsonObject.getString(MongoConstant.OUTPUT).equals(MongoConstant.EMPTY) ? 1 : 0;
Document document = new Document(MongoConstant.DATA,jsonObject)
.append(MongoConstant.VERSION, datasetData.getVersionId()) .append(MongoConstant.VERSION, datasetData.getVersionId())
.append(MongoConstant.CREATE_TIME, datasetData.getCreateTime()) .append(MongoConstant.CREATE_TIME, datasetData.getCreateTime());
.append(MongoConstant.MARK_STATUS, markStatus);
documents.add(document); documents.add(document);
} }
} }
...@@ -65,7 +59,6 @@ public class DatasetDataServiceImpl implements DatasetDataService { ...@@ -65,7 +59,6 @@ public class DatasetDataServiceImpl implements DatasetDataService {
* @param pageParam 页码参数 * @param pageParam 页码参数
* @return 返回查看对象列表 * @return 返回查看对象列表
*/ */
@Override
public List<DatasetData> list(Long versionId, MyPageParam pageParam) { public List<DatasetData> list(Long versionId, MyPageParam pageParam) {
Query query = new Query(Criteria.where(MongoConstant.VERSION).is(versionId)) Query query = new Query(Criteria.where(MongoConstant.VERSION).is(versionId))
.skip((pageParam.getPageNum() - 1) * pageParam.getPageSize()) .skip((pageParam.getPageNum() - 1) * pageParam.getPageSize())
...@@ -75,48 +68,11 @@ public class DatasetDataServiceImpl implements DatasetDataService { ...@@ -75,48 +68,11 @@ public class DatasetDataServiceImpl implements DatasetDataService {
MongoConstant.COLLECT_NAME + versionId); MongoConstant.COLLECT_NAME + versionId);
} }
/**
* 根据条件查询数据集数据。
*
* @param filter 过滤对象。
* @param pageParam 分页对象。
* @return 查询结果集。
*/
@Override
public List<DatasetData> list(DatasetData filter, MyPageParam pageParam) {
Query query = new Query();
query.addCriteria(Criteria.where(MongoConstant.VERSION).is(filter.getVersionId()));
if (filter.getMarkStatus() != null) {
query.addCriteria(Criteria.where(MongoConstant.MARK_STATUS).is(filter.getMarkStatus()));
}
query.skip((pageParam.getPageNum() - 1) * pageParam.getPageSize())
.limit(pageParam.getPageSize());
return mongoTemplate.find(query, DatasetData.class,
MongoConstant.COLLECT_NAME + filter.getVersionId());
}
/**
* 根据条件查询列表集合总条数
* @param filter 版本标识
* @return 返回总条数
*/
@Override
public Long count(DatasetData filter) {
Query query = new Query();
query.addCriteria(Criteria.where(MongoConstant.VERSION).is(filter.getVersionId()));
if (filter.getMarkStatus() != null) {
query.addCriteria(Criteria.where(MongoConstant.MARK_STATUS).is(filter.getMarkStatus()));
}
return mongoTemplate.count(query, DatasetData.class,
MongoConstant.COLLECT_NAME + filter.getVersionId());
}
/** /**
* 查询列表集合总条数 * 查询列表集合总条数
* @param versionId 版本标识 * @param versionId 版本标识
* @return 返回总条数 * @return 返回总条数
*/ */
@Override
public Long count(Long versionId) { public Long count(Long versionId) {
Query query = new Query(Criteria.where(MongoConstant.VERSION).is(versionId)); Query query = new Query(Criteria.where(MongoConstant.VERSION).is(versionId));
return mongoTemplate.count(query, DatasetData.class, return mongoTemplate.count(query, DatasetData.class,
...@@ -130,7 +86,6 @@ public class DatasetDataServiceImpl implements DatasetDataService { ...@@ -130,7 +86,6 @@ public class DatasetDataServiceImpl implements DatasetDataService {
* @param versionId 版本标识。 * @param versionId 版本标识。
* @return 返回查看对象。 * @return 返回查看对象。
*/ */
@Override
public DatasetData view(String id, Long versionId) { public DatasetData view(String id, Long versionId) {
return mongoTemplate.findById(id, DatasetData.class, return mongoTemplate.findById(id, DatasetData.class,
MongoConstant.COLLECT_NAME + versionId); MongoConstant.COLLECT_NAME + versionId);
...@@ -142,7 +97,6 @@ public class DatasetDataServiceImpl implements DatasetDataService { ...@@ -142,7 +97,6 @@ public class DatasetDataServiceImpl implements DatasetDataService {
* @param datasetData 更新的对象。 * @param datasetData 更新的对象。
* @return 成功返回true,否则false。 * @return 成功返回true,否则false。
*/ */
@Override
public void update(DatasetData datasetData) { public void update(DatasetData datasetData) {
mongoTemplate.save(datasetData, mongoTemplate.save(datasetData,
MongoConstant.COLLECT_NAME + datasetData.getVersionId()); MongoConstant.COLLECT_NAME + datasetData.getVersionId());
...@@ -155,7 +109,6 @@ public class DatasetDataServiceImpl implements DatasetDataService { ...@@ -155,7 +109,6 @@ public class DatasetDataServiceImpl implements DatasetDataService {
* @param versionId 版本标识。 * @param versionId 版本标识。
* @return 返回受影响的行数。 * @return 返回受影响的行数。
*/ */
@Override
public Long remove(String id, Long versionId) { public Long remove(String id, Long versionId) {
Query query = new Query(Criteria.where(MongoConstant.ID).is(id)); Query query = new Query(Criteria.where(MongoConstant.ID).is(id));
return mongoTemplate.remove(query, DatasetData.class, return mongoTemplate.remove(query, DatasetData.class,
...@@ -168,7 +121,6 @@ public class DatasetDataServiceImpl implements DatasetDataService { ...@@ -168,7 +121,6 @@ public class DatasetDataServiceImpl implements DatasetDataService {
* @param versionId 版本标识。 * @param versionId 版本标识。
* @return 返回受影响的行数。 * @return 返回受影响的行数。
*/ */
@Override
public void delete(Long versionId) { public void delete(Long versionId) {
mongoTemplate.dropCollection(MongoConstant.COLLECT_NAME + versionId); mongoTemplate.dropCollection(MongoConstant.COLLECT_NAME + versionId);
} }
......
...@@ -140,17 +140,6 @@ public class DatasetManageServiceImpl extends BaseService<DatasetManage, Long> i ...@@ -140,17 +140,6 @@ public class DatasetManageServiceImpl extends BaseService<DatasetManage, Long> i
return resultList; return resultList;
} }
/**
* 分组进行查询数据集列表
* @param filter 主表过滤对象。
* @param orderBy 排序参数。
* @return 查询结果集。
*/
@Override
public List<DatasetManage> getDatasetManageGroupList(DatasetManage filter, String orderBy) {
return datasetManageMapper.getDatasetManageGroupList(filter, orderBy);
}
@Transactional @Transactional
@Override @Override
public DatasetManage saveAndCreateVersion(DatasetManage datasetManage) { public DatasetManage saveAndCreateVersion(DatasetManage datasetManage) {
......
...@@ -174,7 +174,6 @@ public class DatasetVersionServiceImpl extends BaseService<DatasetVersion, Long> ...@@ -174,7 +174,6 @@ public class DatasetVersionServiceImpl extends BaseService<DatasetVersion, Long>
* @param versionName 版本名称 * @param versionName 版本名称
* @throws IOException 异常操作 * @throws IOException 异常操作
*/ */
@Override
public void saveDatasetInfo(String versionName) throws IOException { public void saveDatasetInfo(String versionName) throws IOException {
File file = new File(pythonConfig.getDatasetFileBaseDir(), pythonConfig.getDatasetInfo()); File file = new File(pythonConfig.getDatasetFileBaseDir(), pythonConfig.getDatasetInfo());
if (!file.exists()) { if (!file.exists()) {
...@@ -199,7 +198,7 @@ public class DatasetVersionServiceImpl extends BaseService<DatasetVersion, Long> ...@@ -199,7 +198,7 @@ public class DatasetVersionServiceImpl extends BaseService<DatasetVersion, Long>
* @param fileName 文件名称 * @param fileName 文件名称
* @return 返回截取后的字符串 * @return 返回截取后的字符串
*/ */
private String extractFileName(String fileName) { private static String extractFileName(String fileName) {
int lastSlashIndex = fileName.lastIndexOf('/'); int lastSlashIndex = fileName.lastIndexOf('/');
if (lastSlashIndex != -1) { if (lastSlashIndex != -1) {
fileName = fileName.substring(0, lastSlashIndex + 1); fileName = fileName.substring(0, lastSlashIndex + 1);
...@@ -226,7 +225,7 @@ public class DatasetVersionServiceImpl extends BaseService<DatasetVersion, Long> ...@@ -226,7 +225,7 @@ public class DatasetVersionServiceImpl extends BaseService<DatasetVersion, Long>
// 文件写入指定路径 // 文件写入指定路径
Files.write(path, bytes); Files.write(path, bytes);
// 写入到mongodb中 // 写入到mongodb中
writeDatasetFile(bytes,fullName,versionId); writeDatasetFileForMongo(bytes,fullName,versionId);
} catch (IOException e) { } catch (IOException e) {
log.error("Failed to write imported file [" + fullName + " ].", e); log.error("Failed to write imported file [" + fullName + " ].", e);
throw e; throw e;
...@@ -254,15 +253,14 @@ public class DatasetVersionServiceImpl extends BaseService<DatasetVersion, Long> ...@@ -254,15 +253,14 @@ public class DatasetVersionServiceImpl extends BaseService<DatasetVersion, Long>
* @param originalFilename 导入文件名称 * @param originalFilename 导入文件名称
* @param versionId 版本标识 * @param versionId 版本标识
*/ */
@Override public void writeDatasetFileForMongo(byte[] bytes, String originalFilename, Long versionId) {
public void writeDatasetFile(byte[] bytes, String originalFilename, Long versionId) {
try { try {
// 或者指定字符集进行转换,替换"UTF-8"为你想要使用的字符集 // 或者指定字符集进行转换,替换"UTF-8"为你想要使用的字符集
String result = new String(bytes, StandardCharsets.UTF_8); String result = new String(bytes, StandardCharsets.UTF_8);
//先删除数据集 //先删除数据集
datasetDataService.delete(versionId); datasetDataService.delete(versionId);
//保存到mongodb中 //保存到mongodb中
datasetDataService.save(new DatasetData(null, versionId, result, new Date(), null)); datasetDataService.save(new DatasetData(null, versionId, result, new Date()));
}catch (Exception ex) { }catch (Exception ex) {
log.error("Failed to write mongodb database [" + originalFilename + " ].", ex); log.error("Failed to write mongodb database [" + originalFilename + " ].", ex);
} }
...@@ -298,18 +296,6 @@ public class DatasetVersionServiceImpl extends BaseService<DatasetVersion, Long> ...@@ -298,18 +296,6 @@ public class DatasetVersionServiceImpl extends BaseService<DatasetVersion, Long>
return datasetVersionMapper.update(datasetVersion, uw) == 1; return datasetVersionMapper.update(datasetVersion, uw) == 1;
} }
/**
* 更新数据对象。
*
* @param datasetVersion 更新的对象。
* @return 成功返回true,否则false。
*/
@Transactional(rollbackFor = Exception.class)
@Override
public boolean update(DatasetVersion datasetVersion) {
return datasetVersionMapper.updateById(datasetVersion) > 0;
}
/** /**
* 删除指定数据。 * 删除指定数据。
* *
......
package com.yice.webadmin.app.service.impl; package com.yice.webadmin.app.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.Page; import com.yice.webadmin.app.service.*;
import com.yice.webadmin.app.dao.*;
import com.yice.webadmin.app.model.*;
import com.yice.common.core.base.dao.BaseDaoMapper; import com.yice.common.core.base.dao.BaseDaoMapper;
import com.yice.common.core.base.service.BaseService;
import com.yice.common.core.object.MyRelationParam; import com.yice.common.core.object.MyRelationParam;
import com.yice.common.core.object.TokenData; import com.yice.common.core.base.service.BaseService;
import com.yice.common.core.upload.BaseUpDownloader;
import com.yice.common.core.upload.UpDownloaderFactory;
import com.yice.common.core.upload.UploadResponseInfo;
import com.yice.common.core.upload.UploadStoreTypeEnum;
import com.yice.common.core.util.MyModelUtil; import com.yice.common.core.util.MyModelUtil;
import com.yice.common.minio.config.MinioProperties;
import com.yice.common.sequence.wrapper.IdGeneratorWrapper; import com.yice.common.sequence.wrapper.IdGeneratorWrapper;
import com.yice.webadmin.app.constant.DatasetConstant; import com.github.pagehelper.Page;
import com.yice.webadmin.app.dao.DatasetOutputMapper;
import com.yice.webadmin.app.model.DatasetOutput;
import com.yice.webadmin.app.service.DatasetOutputService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils; import org.springframework.transaction.annotation.Transactional;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.core.io.UrlResource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException; import java.util.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.List;
/** /**
* 数据集详情数据操作服务类。 * 知识图谱管理数据操作服务类。
* *
* @author linking * @author linking
* @date 2023-04-13 * @date 2023-04-13
*/ */
@Slf4j @Slf4j
@Service("datasetOutputService") @Service("kGManageService")
public class DatasetOutputServiceImpl extends BaseService<DatasetOutput, Long> implements DatasetOutputService { public class KGManageServiceImpl extends BaseService<KGManage, Long> implements KGManageService {
@Autowired @Autowired
private DatasetOutputMapper datasetOutputMapper; private KGManageMapper kGManageMapper;
@Autowired @Autowired
private IdGeneratorWrapper idGenerator; private IdGeneratorWrapper idGenerator;
@Autowired
private UpDownloaderFactory upDownloaderFactory;
@Autowired
private MinioProperties minioProperties;
/** /**
* 返回当前Service的主表Mapper对象。 * 返回当前Service的主表Mapper对象。
...@@ -61,158 +39,90 @@ public class DatasetOutputServiceImpl extends BaseService<DatasetOutput, Long> i ...@@ -61,158 +39,90 @@ public class DatasetOutputServiceImpl extends BaseService<DatasetOutput, Long> i
* @return 主表Mapper对象。 * @return 主表Mapper对象。
*/ */
@Override @Override
protected BaseDaoMapper<DatasetOutput> mapper() { protected BaseDaoMapper<KGManage> mapper() {
return datasetOutputMapper; return kGManageMapper;
} }
/** /**
* 保存新增对象。 * 保存新增对象。
* *
* @param datasetOutput 新增对象。 * @param kGManage 新增对象。
* @return 返回新增对象。 * @return 返回新增对象。
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public DatasetOutput saveNew(DatasetOutput datasetOutput) { public KGManage saveNew(KGManage kGManage) {
datasetOutputMapper.insert(this.buildDefaultValue(datasetOutput)); kGManageMapper.insert(this.buildDefaultValue(kGManage));
return datasetOutput; return kGManage;
} }
/** /**
* 利用数据库的insertList语法,批量插入对象列表。 * 利用数据库的insertList语法,批量插入对象列表。
* *
* @param datasetOutputList 新增对象列表。 * @param kGManageList 新增对象列表。
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void saveNewBatch(List<DatasetOutput> datasetOutputList) {
if (CollUtil.isNotEmpty(datasetOutputList)) {
datasetOutputList.forEach(this::buildDefaultValue);
datasetOutputMapper.insertList(datasetOutputList);
}
}
/**
* 记录地址并保存到minio中。
* @param fileType 文件类型。
* @param fileUrl 文件地址。
* @param versionId 版本标识。
* @return 返回新增对象。
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public DatasetOutput saveNew(String fileType, String fileUrl, Long versionId) { public void saveNewBatch(List<KGManage> kGManageList) {
DatasetOutput datasetOutput = new DatasetOutput(); if (CollUtil.isNotEmpty(kGManageList)) {
String uploadUrl = doUpload(fileUrl,fileType,datasetOutput); kGManageList.forEach(this::buildDefaultValue);
if(StringUtils.isEmpty(uploadUrl)) return null; kGManageMapper.insertList(kGManageList);
datasetOutput.setOutputId(idGenerator.nextLongId());
datasetOutput.setCreateUserId(TokenData.takeFromRequest().getUserId());
datasetOutput.setVersionId(versionId);
datasetOutput.setOutputStartTime(new Date());
datasetOutput.setStatus(DatasetConstant.STATUS_UNFINISHED);
datasetOutput.setDownloadUrl(uploadUrl);
datasetOutput.setMarkFormatType(fileType);
datasetOutput.setOutputPostion(DatasetConstant.OUTPUT_POSTION);
datasetOutput.setOutputContent(DatasetConstant.OUTPUT_CONTENT);
datasetOutputMapper.insert(datasetOutput);
return datasetOutput;
} }
/**
* 根据类型,生成对应的文件类型名称
* @param fileUrl 文件地址
* @param fileType 文件类型
*/
private String doUpload(String fileUrl, String fileType, DatasetOutput datasetOutput) {
String fileName = null;
try {
Path file = Paths.get(fileUrl);
Resource resource = new UrlResource(file.toUri());
byte[] data = IOUtils.toByteArray(resource.getInputStream());
datasetOutput.setDataCount(Long.valueOf(JSON.parseArray(new String(data, StandardCharsets.UTF_8)).size()));
double sizeInMb = (double) resource.contentLength() / 1024;
DecimalFormat df = new DecimalFormat("#.##");
datasetOutput.setFileSize(df.format(sizeInMb) + DatasetConstant.KB);
UploadStoreTypeEnum uploadStoreType = UploadStoreTypeEnum.values()[DatasetConstant.UPLOAD];
BaseUpDownloader upDownloader = upDownloaderFactory.get(uploadStoreType);
UploadResponseInfo responseInfo = upDownloader.doUpload(resource.getInputStream(),
DatasetConstant.FILE_NAME + fileType);
if (!Boolean.TRUE.equals(responseInfo.getUploadFailed())) {
fileName = buildDownloadUrl(responseInfo.getFilename());
}
}catch (IOException ex){
log.error("上传文件错误信息为:", ex);
}
return fileName;
}
/**
* 构建文件下载链接
* @param fileUrl
* @return
*/
private String buildDownloadUrl(String fileUrl) {
StringBuilder sb = new StringBuilder();
sb.append(minioProperties.getEndpoint()).
append("/").append(minioProperties.getBucketName()).
append("/").append(fileUrl);
return sb.toString();
} }
/** /**
* 更新数据对象。 * 更新数据对象。
* *
* @param datasetOutput 更新的对象。 * @param kGManage 更新的对象。
* @param originalDatasetOutput 原有数据对象。 * @param originalKGManage 原有数据对象。
* @return 成功返回true,否则false。 * @return 成功返回true,否则false。
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public boolean update(DatasetOutput datasetOutput, DatasetOutput originalDatasetOutput) { public boolean update(KGManage kGManage, KGManage originalKGManage) {
MyModelUtil.fillCommonsForUpdate(datasetOutput, originalDatasetOutput); MyModelUtil.fillCommonsForUpdate(kGManage, originalKGManage);
// 这里重点提示,在执行主表数据更新之前,如果有哪些字段不支持修改操作,请用原有数据对象字段替换当前数据字段。 // 这里重点提示,在执行主表数据更新之前,如果有哪些字段不支持修改操作,请用原有数据对象字段替换当前数据字段。
UpdateWrapper<DatasetOutput> uw = this.createUpdateQueryForNullValue(datasetOutput, datasetOutput.getOutputId()); UpdateWrapper<KGManage> uw = this.createUpdateQueryForNullValue(kGManage, kGManage.getKgId());
return datasetOutputMapper.update(datasetOutput, uw) == 1; return kGManageMapper.update(kGManage, uw) == 1;
} }
/** /**
* 删除指定数据。 * 删除指定数据。
* *
* @param outputId 主键Id。 * @param kgId 主键Id。
* @return 成功返回true,否则false。 * @return 成功返回true,否则false。
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public boolean remove(Long outputId) { public boolean remove(Long kgId) {
return datasetOutputMapper.deleteById(outputId) == 1; return kGManageMapper.deleteById(kgId) == 1;
} }
/** /**
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。 * 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
* 如果需要同时获取关联数据,请移步(getDatasetOutputListWithRelation)方法。 * 如果需要同时获取关联数据,请移步(getKGManageListWithRelation)方法。
* *
* @param filter 过滤对象。 * @param filter 过滤对象。
* @param orderBy 排序参数。 * @param orderBy 排序参数。
* @return 查询结果集。 * @return 查询结果集。
*/ */
@Override @Override
public List<DatasetOutput> getDatasetOutputList(DatasetOutput filter, String orderBy) { public List<KGManage> getKGManageList(KGManage filter, String orderBy) {
return datasetOutputMapper.getDatasetOutputList(filter, orderBy); return kGManageMapper.getKGManageList(filter, orderBy);
} }
/** /**
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。 * 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。 * 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
* 如果仅仅需要获取主表数据,请移步(getDatasetOutputList),以便获取更好的查询性能。 * 如果仅仅需要获取主表数据,请移步(getKGManageList),以便获取更好的查询性能。
* *
* @param filter 主表过滤对象。 * @param filter 主表过滤对象。
* @param orderBy 排序参数。 * @param orderBy 排序参数。
* @return 查询结果集。 * @return 查询结果集。
*/ */
@Override @Override
public List<DatasetOutput> getDatasetOutputListWithRelation(DatasetOutput filter, String orderBy) { public List<KGManage> getKGManageListWithRelation(KGManage filter, String orderBy) {
List<DatasetOutput> resultList = datasetOutputMapper.getDatasetOutputList(filter, orderBy); List<KGManage> resultList = kGManageMapper.getKGManageList(filter, orderBy);
// 在缺省生成的代码中,如果查询结果resultList不是Page对象,说明没有分页,那么就很可能是数据导出接口调用了当前方法。 // 在缺省生成的代码中,如果查询结果resultList不是Page对象,说明没有分页,那么就很可能是数据导出接口调用了当前方法。
// 为了避免一次性的大量数据关联,规避因此而造成的系统运行性能冲击,这里手动进行了分批次读取,开发者可按需修改该值。 // 为了避免一次性的大量数据关联,规避因此而造成的系统运行性能冲击,这里手动进行了分批次读取,开发者可按需修改该值。
int batchSize = resultList instanceof Page ? 0 : 1000; int batchSize = resultList instanceof Page ? 0 : 1000;
...@@ -220,11 +130,11 @@ public class DatasetOutputServiceImpl extends BaseService<DatasetOutput, Long> i ...@@ -220,11 +130,11 @@ public class DatasetOutputServiceImpl extends BaseService<DatasetOutput, Long> i
return resultList; return resultList;
} }
private DatasetOutput buildDefaultValue(DatasetOutput datasetOutput) { private KGManage buildDefaultValue(KGManage kGManage) {
if (datasetOutput.getOutputId() == null) { if (kGManage.getKgId() == null) {
datasetOutput.setOutputId(idGenerator.nextLongId()); kGManage.setKgId(idGenerator.nextLongId());
} }
MyModelUtil.fillCommonsForInsert(datasetOutput); MyModelUtil.fillCommonsForInsert(kGManage);
return datasetOutput; return kGManage;
} }
} }
package com.yice.webadmin.app.util;
/*import org.neo4j.driver.Driver;
import org.neo4j.driver.GraphDatabase;
import org.neo4j.driver.AuthTokens;
import org.neo4j.driver.Config;*/
public class Neo4jUtil {
public void test() {
// 配置 Neo4j 驱动程序
/* Config config = Config.builder().
.withCredentials(AuthTokens.basic("username", "password")) // 替换为你的用户名和密码
.build();
// 获取 Neo4j 驱动实例
Driver driver = Driver.builder()
.withConfig(config)
.build();
// 打开与 Neo4j 的连接
try (GraphDatabase graphDatabase = driver.session()) {
// 在此处执行你的数据库操作
// 例如,查询节点或关系
// 关闭会话
graphDatabase.shutdown();
} catch (Exception e) {
e.printStackTrace();
} finally {
// 关闭驱动程序
driver.close();
}*/
}
}
...@@ -39,10 +39,4 @@ public class DatasetDataVo { ...@@ -39,10 +39,4 @@ public class DatasetDataVo {
*/ */
@ApiModelProperty(value="创建时间") @ApiModelProperty(value="创建时间")
private Date createTime; private Date createTime;
/**
* 标记状态。
*/
@ApiModelProperty(value="标记状态:0:未标记,1:已标记")
private Integer markStatus;
} }
...@@ -44,36 +44,13 @@ public class DatasetManageVo extends BaseVo { ...@@ -44,36 +44,13 @@ public class DatasetManageVo extends BaseVo {
@ApiModelProperty(value = "模板") @ApiModelProperty(value = "模板")
private Integer template; private Integer template;
/** /**
* 数据类型。 * 数据类型。
*/ */
@ApiModelProperty(value = "数据类型") @ApiModelProperty(value = "数据类型")
private Integer dataType; private Integer dataType;
/**
* 数据量。
*/
@ApiModelProperty(value = "数据量")
private Long dataVolume;
/**
* 发布状态。
*/
@ApiModelProperty(value = "发布状态")
private Integer releaseStatus;
/**
* 导入状态。
*/
@ApiModelProperty(value = "导入状态")
private Integer inputStatus;
/**
* 版本。
*/
@ApiModelProperty(value = "版本")
private Integer datasetVersion;
/** /**
* DatasetVersion 的一对多关联表数据对象。数据对应类型为DatasetVersion。 * DatasetVersion 的一对多关联表数据对象。数据对应类型为DatasetVersion。
*/ */
......
package com.yice.webadmin.app.vo;
import com.yice.common.core.validator.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* DatasetOutputVo对象。
*
* @author linking
* @date 2023-04-13
*/
@ApiModel("DatasetOutputVo对象")
@Data
public class DatasetOutputVo {
/**
* 导出任务ID。
*/
@ApiModelProperty(value = "导出任务ID", required = true)
@NotNull(message = "数据验证失败,导出任务ID不能为空!", groups = {UpdateGroup.class})
private Long outputId;
/**
* 导出位置。
*/
@ApiModelProperty(value = "导出位置", required = true)
private String outputPostion;
/**
* 导出格式类型。
*/
@ApiModelProperty(value = "导出格式类型")
private String markFormatType;
/**
* 导出内容。
*/
@ApiModelProperty(value = "导出内容")
private String outputContent;
/**
* 文件大小。
*/
@ApiModelProperty(value = "文件大小")
private String fileSize;
/**
* 数据量。
*/
@ApiModelProperty(value = "数据量")
private Long dataCount;
/**
* 创建人。
*/
@ApiModelProperty(value = "创建人")
private Long createUserId;
/**
* 导出开始时间。
*/
@ApiModelProperty(value = "导出开始时间")
private Date outputStartTime;
/**
* 导出完成时间。
*/
@ApiModelProperty(value = "导出完成时间")
private Date outputEndTime;
/**
* 状态。
*/
@ApiModelProperty(value = "状态")
private Integer status;
/**
* 下载地址。
*/
@ApiModelProperty(value = "下载地址")
private String downloadUrl;
/**
* 版本ID。
*/
@ApiModelProperty(value = "版本ID")
private Long versionId;
}
...@@ -64,7 +64,7 @@ public class DatasetVersionVo extends BaseVo { ...@@ -64,7 +64,7 @@ public class DatasetVersionVo extends BaseVo {
/** /**
* 发布状态。 * 发布状态。
*/ */
@ApiModelProperty(value = "发布状态:0标识未发布;1标识已发布") @ApiModelProperty(value = "发布状态")
private Integer releaseStatus; private Integer releaseStatus;
/** /**
......
package com.yice.webadmin.app.vo;
import com.yice.common.core.base.vo.BaseVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* KGManageVO视图对象。
*
* @author linking
* @date 2023-04-13
*/
@ApiModel("KGManageVO视图对象")
@Data
@EqualsAndHashCode(callSuper = true)
public class KGManageVo extends BaseVo {
/**
* 知识图谱ID。
*/
@ApiModelProperty(value = "知识图谱ID")
private Long kgId;
/**
* 知识图谱名称。
*/
@ApiModelProperty(value = "知识图谱名称")
private String kgName;
/**
* 知识图谱描述。
*/
@ApiModelProperty(value = "知识图谱描述")
private String kgDescribe;
/**
* 知识图谱地址。
*/
@ApiModelProperty(value = "知识图谱地址")
private String kgUrl;
/**
* 知识图谱用户名。
*/
@ApiModelProperty(value = "知识图谱用户名")
private String kgUserName;
/**
* 知识图谱密码。
*/
@ApiModelProperty(value = "知识图谱密码")
private String kgPassword;
/**
* 知识图谱浏览地址。
*/
@ApiModelProperty(value = "知识图谱浏览地址")
private String kgBowerUrl;
/**
* 知识图谱类型。
*/
@ApiModelProperty(value = "知识图谱类型")
private String kgType;
}
...@@ -48,4 +48,10 @@ public class KnowledgeManageVo extends BaseVo { ...@@ -48,4 +48,10 @@ public class KnowledgeManageVo extends BaseVo {
*/ */
@ApiModelProperty(value = "创建人名称") @ApiModelProperty(value = "创建人名称")
private Map<String, Object> createUserIdDictMap; private Map<String, Object> createUserIdDictMap;
/**
* 知识格式。
*/
@ApiModelProperty(value = "知识格式")
private String knowledgeFormat;
} }
...@@ -28,7 +28,11 @@ public class ModelDeployVo extends BaseVo { ...@@ -28,7 +28,11 @@ public class ModelDeployVo extends BaseVo {
*/ */
@ApiModelProperty(value = "模型ID") @ApiModelProperty(value = "模型ID")
private Long modelId; private Long modelId;
/**
* 模型名称。
*/
@ApiModelProperty(value = "模型名称")
private String modelName;
/** /**
* 版本ID。 * 版本ID。
*/ */
...@@ -70,4 +74,15 @@ public class ModelDeployVo extends BaseVo { ...@@ -70,4 +74,15 @@ public class ModelDeployVo extends BaseVo {
*/ */
@ApiModelProperty(value = "服务版本") @ApiModelProperty(value = "服务版本")
private Integer serviceVersion; private Integer serviceVersion;
/**
* 资源信息。
*/
@ApiModelProperty(value = "资源信息")
private String resourceInfo;
/**
* 服务描述。
*/
@ApiModelProperty(value = "服务描述")
private String serviceRemark;
} }
...@@ -78,10 +78,25 @@ python: ...@@ -78,10 +78,25 @@ python:
#python websocket 服务地址 #python websocket 服务地址
pythonWebsocketUri: ws://192.168.0.36:7860/queue/join pythonWebsocketUri: ws://192.168.0.36:7860/queue/join
#输出控制地址 #输出控制地址
controllerAddress: http://192.168.0.36:20001 controllerAddress: http://127.0.0.1:20001
#对话基础路径 #对话基础路径
chatAddress: http://192.168.0.36:7861/ chatAddress: http://192.168.0.36:8000/
llm-model:
#模型管理基础路径
llmModelInterface: http://192.168.0.36:7861/llm_model/
#模型停止
stop: stop
#模型模型部署
reload: reload
#模型部署
start: start
#列出当前已加载模型
listRunningModels: list_running_models
other:
#其他管理接口
otherInterface: http://192.168.0.36:7861/other/
#获取gpu信息
getGpuInfo: get_gpu_info
knowledge: knowledge:
#知识库通用接口地址 #知识库通用接口地址
knowledgeInterface: http://192.168.0.36:7861/knowledge_base/ knowledgeInterface: http://192.168.0.36:7861/knowledge_base/
...@@ -95,6 +110,10 @@ knowledge: ...@@ -95,6 +110,10 @@ knowledge:
listFiles: list_files listFiles: list_files
#搜索知识库 #搜索知识库
searchDocs: search_docs searchDocs: search_docs
#直接更新知识库文档
updateDocsById: update_docs_by_id
#直接删除知识库文档片段
deleteDocsById: delete_docs_by_id
#上传文件到知识库,bing/或进行向量化 #上传文件到知识库,bing/或进行向量化
uploadDocs: upload_docs uploadDocs: upload_docs
#删除知识库内指定文件 #删除知识库内指定文件
...@@ -177,9 +196,9 @@ redis: ...@@ -177,9 +196,9 @@ redis:
# 连接池中最小空闲数量。 # 连接池中最小空闲数量。
minIdle: 5 minIdle: 5
minio: #minio:
enabled: true # enabled: true
endpoint: http://192.168.0.145:9090 # endpoint: http://192.168.0.145:9090
accessKey: minioadmin # accessKey: minioadmin
secretKey: minioadmin # secretKey: minioadmin
bucketName: lmp # bucketName: application
...@@ -16,7 +16,6 @@ import javax.imageio.ImageIO; ...@@ -16,7 +16,6 @@ import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
...@@ -139,17 +138,6 @@ public abstract class BaseUpDownloader { ...@@ -139,17 +138,6 @@ public abstract class BaseUpDownloader {
Boolean asImage, Boolean asImage,
MultipartFile uploadFile) throws IOException; MultipartFile uploadFile) throws IOException;
/**
* 方法重置写入Minio里面中,保留文件名称
* 执行文件上传操作,将文件数据存入Minio。
*
* @param inputStream 上传地址。
* @param fileName 文件名称。
* @return 上传应答信息对象。该对象始终不为null。
* @throws IOException minio抛出的异常。
*/
public abstract UploadResponseInfo doUpload(InputStream inputStream, String fileName);
/** /**
* 判断filename参数指定的文件名,是否被包含在fileInfoJson参数中。 * 判断filename参数指定的文件名,是否被包含在fileInfoJson参数中。
* *
......
...@@ -147,20 +147,6 @@ public class LocalUpDownloader extends BaseUpDownloader { ...@@ -147,20 +147,6 @@ public class LocalUpDownloader extends BaseUpDownloader {
return responseInfo; return responseInfo;
} }
/**
* 方法重置写入Minio里面中,保留文件名称
* 执行文件上传操作,将文件数据存入Minio。
*
* @param inputStream 上传地址。
* @param fileName 文件名称。
* @return 上传应答信息对象。该对象始终不为null。
* @throws IOException minio抛出的异常。
*/
@Override
public UploadResponseInfo doUpload(InputStream inputStream, String fileName){
return new UploadResponseInfo();
}
/** /**
* 判断filename参数指定的文件名,是否被包含在fileInfoJson参数中。 * 判断filename参数指定的文件名,是否被包含在fileInfoJson参数中。
* *
......
...@@ -6,10 +6,8 @@ import com.yice.common.core.upload.UpDownloaderFactory; ...@@ -6,10 +6,8 @@ import com.yice.common.core.upload.UpDownloaderFactory;
import com.yice.common.core.upload.UploadResponseInfo; import com.yice.common.core.upload.UploadResponseInfo;
import com.yice.common.core.upload.BaseUpDownloader; import com.yice.common.core.upload.BaseUpDownloader;
import com.yice.common.core.upload.UploadStoreTypeEnum; import com.yice.common.core.upload.UploadStoreTypeEnum;
import com.yice.common.core.util.MyCommonUtil;
import com.yice.common.minio.wrapper.MinioTemplate; import com.yice.common.minio.wrapper.MinioTemplate;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -59,26 +57,6 @@ public class MinioUpDownloader extends BaseUpDownloader { ...@@ -59,26 +57,6 @@ public class MinioUpDownloader extends BaseUpDownloader {
return responseInfo; return responseInfo;
} }
/**
* 方法重置写入Minio里面中,保留文件名称
* 执行文件上传操作,将文件数据存入Minio。
*
* @param inputStream 上传地址。
* @param fileName 文件名称。
* @return 上传应答信息对象。该对象始终不为null。
* @throws IOException minio抛出的异常。
*/
@Override
public UploadResponseInfo doUpload(InputStream inputStream, String fileName){
UploadResponseInfo responseInfo = new UploadResponseInfo();
StringBuilder filenameBuilder = new StringBuilder(64);
filenameBuilder.append(MyCommonUtil.generateUuid())
.append(".").append(FilenameUtils.getExtension(fileName));
responseInfo.setFilename(filenameBuilder.toString());
minioTemplate.putObject(responseInfo.getFilename(), inputStream);
return responseInfo;
}
@Override @Override
public void doDownload( public void doDownload(
String rootBaseDir, String rootBaseDir,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment