提交代码
This commit is contained in:
parent
1a1c22b2e1
commit
a4097bd2f0
|
|
@ -9,6 +9,7 @@ import com.bonus.common.log.annotation.SysLog;
|
|||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -26,6 +27,7 @@ public class MirrorManagerController extends BaseController {
|
|||
@Resource
|
||||
private MirrorManagerService aiMirrorManagerService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询镜像管理列表
|
||||
*/
|
||||
|
|
@ -65,7 +67,7 @@ public class MirrorManagerController extends BaseController {
|
|||
* 修改镜像管理
|
||||
*/
|
||||
@RequiresPermissions("mirror:manager:edit")
|
||||
@PutMapping("/edit")
|
||||
@PostMapping("/edit")
|
||||
@SysLog(title = "镜像管理", businessType = OperaType.UPDATE, logType = 0, module = "镜像管理", details = "导出镜像管理列表")
|
||||
public AjaxResult edit(@RequestBody MirrorManagerEntity aiMirrorManager) {
|
||||
return aiMirrorManagerService.updateAiMirrorManager(aiMirrorManager);
|
||||
|
|
@ -80,4 +82,18 @@ public class MirrorManagerController extends BaseController {
|
|||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return aiMirrorManagerService.deleteAiMirrorManagerByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*/
|
||||
@RequiresPermissions("mirror:manager:uploadFile")
|
||||
@PostMapping("/uploadFile")
|
||||
@SysLog(title = "模型管理", businessType = OperaType.DELETE, logType = 0, module = "模型管理", details = "导出模型管理列表")
|
||||
public AjaxResult uploadFile(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam("chunk") int chunk,
|
||||
@RequestParam("totalChunks") int totalChunks,
|
||||
@RequestParam("fileName") String fileName) {
|
||||
return aiMirrorManagerService.uploadFile(file, chunk, totalChunks, fileName);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,16 @@ public class ModelManagerController extends BaseController {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询模型管理列表
|
||||
*/
|
||||
@RequiresPermissions("model:manager:list")
|
||||
@GetMapping("/listAll")
|
||||
public AjaxResult listAll(ModelManagerEntity aiModelManager) {
|
||||
return AjaxResult.success(aiModelManagerService.selectAiModelManagerList(aiModelManager));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模型管理详细信息
|
||||
*/
|
||||
|
|
@ -92,7 +102,7 @@ public class ModelManagerController extends BaseController {
|
|||
@RequestParam("chunk") int chunk,
|
||||
@RequestParam("totalChunks") int totalChunks,
|
||||
@RequestParam("fileName") String fileName) {
|
||||
return aiModelManagerService.uploadFile(file, chunk, totalChunks,fileName);
|
||||
return aiModelManagerService.uploadFile(file, chunk, totalChunks, fileName);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class MirrorManagerEntity extends BaseEntity
|
|||
private String mirrorVersion;
|
||||
|
||||
/** 所属模型 */
|
||||
private String ownModel;
|
||||
private Long ownModel;
|
||||
|
||||
/** 运行环境 */
|
||||
private String runEnvironment;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,16 @@
|
|||
package com.bonus.ai.service.Impl;
|
||||
|
||||
import com.bonus.ai.domain.DataSetBasicFileEntity;
|
||||
import com.bonus.ai.domain.MirrorManagerEntity;
|
||||
import com.bonus.ai.mapper.MirrorManagerMapper;
|
||||
import com.bonus.ai.service.MirrorManagerService;
|
||||
import com.bonus.ai.utils.MinioUtil;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
|
@ -21,6 +25,8 @@ import java.util.List;
|
|||
public class MirrorManagerServiceImpl implements MirrorManagerService {
|
||||
@Resource
|
||||
private MirrorManagerMapper aiMirrorManagerMapper;
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
|
||||
/**
|
||||
* 查询镜像管理
|
||||
|
|
@ -62,6 +68,7 @@ public class MirrorManagerServiceImpl implements MirrorManagerService {
|
|||
@Override
|
||||
public AjaxResult insertAiMirrorManager(MirrorManagerEntity aiMirrorManager) {
|
||||
aiMirrorManager.setCreateTime(DateUtils.getNowDate());
|
||||
aiMirrorManager.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
try {
|
||||
int rows = aiMirrorManagerMapper.insertAiMirrorManager(aiMirrorManager);
|
||||
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
|
|
@ -103,4 +110,29 @@ public class MirrorManagerServiceImpl implements MirrorManagerService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*
|
||||
* @param file
|
||||
* @param chunk
|
||||
* @param totalChunks
|
||||
* @param fileName
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult uploadFile(MultipartFile file, int chunk, int totalChunks, String fileName) {
|
||||
try {
|
||||
// 使用唯一路径保存分片到 MinIO
|
||||
String objectName = SecurityUtils.getUserId().toString() + "/temp/" + fileName + "/chunk_" + chunk;
|
||||
minioUtil.uploadFile(file, objectName);
|
||||
// 检查是否是最后一个分片,若是则合并
|
||||
if (chunk == totalChunks) {
|
||||
DataSetBasicFileEntity entity = minioUtil.mergeChunksWithMultithreading(fileName, totalChunks, minioUtil.joinPath(SecurityUtils.getUserId().toString(), "mirror/"));
|
||||
return AjaxResult.success(entity);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.ai.service;
|
|||
|
||||
import com.bonus.ai.domain.MirrorManagerEntity;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -52,5 +53,8 @@ public interface MirrorManagerService
|
|||
* @return 结果
|
||||
*/
|
||||
public AjaxResult deleteAiMirrorManagerByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*/
|
||||
AjaxResult uploadFile(MultipartFile file, int chunk, int totalChunks, String fileName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,51 +27,52 @@
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectAiMirrorManagerVo">
|
||||
select id,
|
||||
create_by,
|
||||
con_manner,
|
||||
interface_document,
|
||||
document_path,
|
||||
mirror_name,
|
||||
mirror_version,
|
||||
own_model,
|
||||
run_environment,
|
||||
model_frame,
|
||||
language,
|
||||
mirror_path,
|
||||
remark,
|
||||
create_time,
|
||||
update_time,
|
||||
is_active,
|
||||
datasetId,
|
||||
modelFileName,
|
||||
manualFileName
|
||||
from ai_mirror_manager
|
||||
select am.id,
|
||||
am.create_by,
|
||||
am.con_manner,
|
||||
am.interface_document,
|
||||
am.document_path,
|
||||
am.mirror_name,
|
||||
am.mirror_version,
|
||||
am.own_model,
|
||||
am.run_environment,
|
||||
am.model_frame,
|
||||
am.language,
|
||||
am.mirror_path,
|
||||
am.remark,
|
||||
am.create_time,
|
||||
am.update_time,
|
||||
am.is_active,
|
||||
am.modelFileName,
|
||||
am.manualFileName,
|
||||
CONCAT(amm.model_name, ' - ', amm.model_version) AS datasetId
|
||||
from ai_mirror_manager am
|
||||
LEFT JOIN ai_model_manager amm ON amm.id = am.own_model
|
||||
</sql>
|
||||
|
||||
<select id="selectAiMirrorManagerList" parameterType="com.bonus.ai.domain.MirrorManagerEntity"
|
||||
resultMap="AiMirrorManagerResult">
|
||||
<include refid="selectAiMirrorManagerVo"/>
|
||||
<where>
|
||||
<if test="conManner != null and conManner != ''">and con_manner = #{conManner}</if>
|
||||
<if test="interfaceDocument != null and interfaceDocument != ''">and interface_document =
|
||||
<if test="conManner != null and conManner != ''">and am.con_manner = #{conManner}</if>
|
||||
<if test="interfaceDocument != null and interfaceDocument != ''">and am.interface_document =
|
||||
#{interfaceDocument}
|
||||
</if>
|
||||
<if test="documentPath != null and documentPath != ''">and document_path = #{documentPath}</if>
|
||||
<if test="mirrorName != null and mirrorName != ''">and mirror_name like concat('%', #{mirrorName}, '%')
|
||||
<if test="documentPath != null and documentPath != ''">and am.document_path = #{documentPath}</if>
|
||||
<if test="mirrorName != null and mirrorName != ''">and am.mirror_name like concat('%', #{mirrorName}, '%')
|
||||
</if>
|
||||
<if test="mirrorVersion != null and mirrorVersion != ''">and mirror_version = #{mirrorVersion}</if>
|
||||
<if test="ownModel != null and ownModel != ''">and own_model = #{ownModel}</if>
|
||||
<if test="runEnvironment != null and runEnvironment != ''">and run_environment = #{runEnvironment}</if>
|
||||
<if test="modelFrame != null and modelFrame != ''">and model_frame = #{modelFrame}</if>
|
||||
<if test="language != null and language != ''">and language = #{language}</if>
|
||||
<if test="mirrorPath != null and mirrorPath != ''">and mirror_path = #{mirrorPath}</if>
|
||||
<if test="isActive != null and isActive != ''">and is_active = #{isActive}</if>
|
||||
<if test="datasetId != null and datasetId != ''">and datasetId = #{datasetId}</if>
|
||||
<if test="modelFileName != null and modelFileName != ''">and modelFileName like concat('%',
|
||||
<if test="mirrorVersion != null and mirrorVersion != ''">and am.mirror_version = #{mirrorVersion}</if>
|
||||
<if test="ownModel != null and ownModel != ''">and am.own_model = #{ownModel}</if>
|
||||
<if test="runEnvironment != null and runEnvironment != ''">and am.run_environment = #{runEnvironment}</if>
|
||||
<if test="modelFrame != null and modelFrame != ''">and am.model_frame = #{modelFrame}</if>
|
||||
<if test="language != null and language != ''">and am.language = #{language}</if>
|
||||
<if test="mirrorPath != null and mirrorPath != ''">and am.mirror_path = #{mirrorPath}</if>
|
||||
<if test="isActive != null and isActive != ''">and am.is_active = #{isActive}</if>
|
||||
<if test="datasetId != null and datasetId != ''">and am.datasetId = #{datasetId}</if>
|
||||
<if test="modelFileName != null and modelFileName != ''">and am.modelFileName like concat('%',
|
||||
#{modelFileName}, '%')
|
||||
</if>
|
||||
<if test="manualFileName != null and manualFileName != ''">and manualFileName like concat('%',
|
||||
<if test="manualFileName != null and manualFileName != ''">and am.manualFileName like concat('%',
|
||||
#{manualFileName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
|
|
@ -79,7 +80,7 @@
|
|||
|
||||
<select id="selectAiMirrorManagerById" parameterType="Long" resultMap="AiMirrorManagerResult">
|
||||
<include refid="selectAiMirrorManagerVo"/>
|
||||
where id = #{id}
|
||||
where am.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertAiMirrorManager" parameterType="com.bonus.ai.domain.MirrorManagerEntity">
|
||||
|
|
|
|||
Loading…
Reference in New Issue