修复bug
This commit is contained in:
@@ -1966,4 +1966,9 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
return dictItemModel;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTokenForceLoggedOut(String token) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,11 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Constant {
|
||||
// 添加私有构造函数以防止实例化
|
||||
private Constant() {
|
||||
throw new AssertionError("Cannot instantiate Constant class");
|
||||
}
|
||||
|
||||
public static final int HeadLen = 10;
|
||||
|
||||
public static final int SDM_PORT = 60000;
|
||||
@@ -537,8 +542,6 @@ public class Constant {
|
||||
public final static int MSG_UPDATE_STUDY_PROJECT_RSP = PROJECT_CREATE + 0x17;
|
||||
public final static int MSG_DEL_PROJECT_USELESS_DATA_REQ = PROJECT_CREATE + 0x18;
|
||||
public final static int MSG_DEL_PROJECT_USELESS_DATA_RSP = PROJECT_CREATE + 0x19;
|
||||
/*******************************数据信息查询**************************/
|
||||
private final static int DATA_QUERY = 0x9000;
|
||||
/*************************项目阶段操作**********************/
|
||||
private final static int PROJECT_PHASE_CREATE = 0x4000;
|
||||
public final static int MSG_ADD_PROJECT_PHASE_REQ = PROJECT_PHASE_CREATE + 0x01;
|
||||
@@ -866,24 +869,4 @@ public class Constant {
|
||||
public final static int MSG_DATA_SPACE_CHECK_FINISH_IND = IND + 0x0A;
|
||||
public final static int MSG_PBS_POST_PROCESS_IND = IND + 0x0B;
|
||||
public static Map<Integer, Class<?>> classMap = new HashMap<Integer, Class<?>>();
|
||||
|
||||
static {
|
||||
}
|
||||
/****************************************/
|
||||
// public static AbstractMessage getObject(int msgId)
|
||||
// {
|
||||
// Class<? > class1 = classMap.get(msgId);
|
||||
// if(class1 == null)
|
||||
// return null;
|
||||
// AbstractMessage object = null;
|
||||
// try
|
||||
// {
|
||||
// object = class1.newInstance();
|
||||
// }
|
||||
// catch(Exception exception)
|
||||
// {
|
||||
// exception.printStackTrace();
|
||||
// }
|
||||
// return object;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.ccag.common;
|
||||
|
||||
public class RedisConstant {
|
||||
private RedisConstant() {
|
||||
throw new AssertionError("Cannot instantiate constants class");
|
||||
}
|
||||
|
||||
public static final String SIMULATION_FLOW = "simulation_flow:";
|
||||
public static final String SYNC_HPC_TASK_STATUS = "syncHpcTaskStatus:";
|
||||
|
||||
@@ -7,7 +7,6 @@ public enum ResultCode implements IErrorCode {
|
||||
UNAUTHORIZED(401, "用户名或密码错误"),
|
||||
FORBIDDEN(403, "没有相关权限"),
|
||||
/**********Message Return Code************/
|
||||
// PERMISSION 1000;
|
||||
NO_PERMISSION(1001, "没有操作权限"),
|
||||
|
||||
NO_ROOTPERMISSION(1002, "没有用户权限"),
|
||||
@@ -360,7 +359,7 @@ public enum ResultCode implements IErrorCode {
|
||||
UPDATE_APPROVAL_SUCCESS(614, "评审更新成功"),
|
||||
UPDATE_APPROVAL_FAIL(615, "评审更新失败"),
|
||||
/*************5. version ************/
|
||||
// VERSION_CODE 700;
|
||||
|
||||
ADD_VERSION_INFO_SUCCESS(701, "版本信息添加成功"),
|
||||
ADD_VERSION_INFO_FAIL(702, "版本信息添加失败"),
|
||||
COMMIT_VERSION_FILE_SUCCESS(703, "版本提交成功"),
|
||||
@@ -383,7 +382,7 @@ public enum ResultCode implements IErrorCode {
|
||||
VERSION_DELETE_SUCCESS(720, "版本删除成功"),
|
||||
VERSION_DELETE_FAIL(721, "版本删除失败"),
|
||||
/*************6. pbs ************/
|
||||
// PBS_CODE 800;
|
||||
|
||||
SUBMIT_PBS_SUCCESS(801, "提交PBS任务成功"),
|
||||
SUBMIT_PBS_FAIL(802, "提交PBS任务失败"),
|
||||
STOP_PBS_SUCCESS(803, "停止PBS任务成功"),
|
||||
@@ -395,12 +394,12 @@ public enum ResultCode implements IErrorCode {
|
||||
QUERY_PBS_LICENSE_FAIL(809, "查询PBS License失败"),
|
||||
|
||||
/*************7. flow ************/
|
||||
// FLOW_TEMPLATE 900;
|
||||
|
||||
UPDATE_FLOW_TEMPLATE_SUCCESS(901, "流程模板更新成功"),
|
||||
UPDATE_FLOW_TEMPLATE_FAILED(902, "流程模板更新失败"),
|
||||
|
||||
/*************8. node ************/
|
||||
// DISCIPLINE_NODE 1000;
|
||||
|
||||
UPDATE_DISCIPLINE_NODE_SUCCESS(1001,"更新节点成功"),
|
||||
UPDATE_DISCIPLINE_NODE_FAILED(1002,"更新节点失败");
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SdmResponse<T> implements Serializable {
|
||||
/**
|
||||
* 成功返回结果
|
||||
*/
|
||||
public static SdmResponse success() {
|
||||
public static <T> SdmResponse<T> success() {
|
||||
return new SdmResponse(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMessage(), Collections.EMPTY_LIST);
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ public class SdmResponse<T> implements Serializable {
|
||||
return new SdmResponse<T>(ResultCode.FORBIDDEN.getCode(), ResultCode.FORBIDDEN.getMessage(), data);
|
||||
}
|
||||
|
||||
public static <T> SdmResponse validResult(int result, int code) {
|
||||
public static <T> SdmResponse<T> validResult(int result, int code) {
|
||||
if (result == code) {
|
||||
return SdmResponse.success();
|
||||
} else {
|
||||
|
||||
@@ -9,6 +9,10 @@ import lombok.extern.slf4j.Slf4j;
|
||||
public class ThreadLocalContext {
|
||||
private static final ThreadLocal<CommonHeader> current = new InheritableThreadLocal<>();
|
||||
|
||||
private ThreadLocalContext() {
|
||||
throw new AssertionError("Cannot instantiate ThreadLocalContext class");
|
||||
}
|
||||
|
||||
// 获取静态的ThreadLocal对象
|
||||
public static ThreadLocal<CommonHeader> getCurrent() {
|
||||
return current;
|
||||
@@ -56,4 +60,8 @@ public class ThreadLocalContext {
|
||||
return current.get();
|
||||
}
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
current.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Configuration
|
||||
@ConditionalOnClass(JSON.class)
|
||||
public class FastJsonConfiguration {
|
||||
private FastJsonConfiguration() {
|
||||
throw new AssertionError("Cannot instantiate FastJsonConfiguration class");
|
||||
}
|
||||
static {
|
||||
JSON.config(JSONWriter.Feature.WriteMapNullValue, // 是否输出值为null的字段,默认为false
|
||||
JSONWriter.Feature.WriteNullListAsEmpty); // List字段如果为null,输出为[],而非null
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.ccag.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ccag.common.SdmResponse;
|
||||
import com.ccag.config.shiro.IgnoreAuth;
|
||||
import com.ccag.entity.bo.data.FileBaseInfo;
|
||||
import com.ccag.entity.req.data.*;
|
||||
import com.ccag.service.DataService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -13,6 +15,9 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@Tag(name = "文件相关接口")
|
||||
@RequestMapping("/data")
|
||||
@@ -29,7 +34,7 @@ public class DataController {
|
||||
*/
|
||||
@Operation(summary = "创建文件夹")
|
||||
@PostMapping("/createDir")
|
||||
public SdmResponse createDir(@RequestBody @Validated CreateDirReq req) {
|
||||
public SdmResponse<ArrayList<JSONObject>> createDir(@RequestBody @Validated CreateDirReq req) {
|
||||
return dataService.createDir(req);
|
||||
}
|
||||
|
||||
@@ -41,7 +46,7 @@ public class DataController {
|
||||
*/
|
||||
@Operation(summary = "删除文件夹")
|
||||
@PostMapping("/delDir")
|
||||
public SdmResponse delDir(@RequestBody @Validated DelDirReq req) {
|
||||
public SdmResponse<ArrayList<JSONObject>> delDir(@RequestBody @Validated DelDirReq req) {
|
||||
return dataService.delDir(req);
|
||||
}
|
||||
|
||||
@@ -53,7 +58,7 @@ public class DataController {
|
||||
*/
|
||||
@Operation(summary = "删除文件")
|
||||
@PostMapping("/delFile")
|
||||
public SdmResponse delFile(@RequestBody @Validated DelFileReq req) {
|
||||
public SdmResponse<ArrayList<JSONObject>> delFile(@RequestBody @Validated DelFileReq req) {
|
||||
return dataService.delFile(req);
|
||||
}
|
||||
|
||||
@@ -64,7 +69,7 @@ public class DataController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getFileBaseInfo")
|
||||
public SdmResponse getFileBaseInfo(@RequestBody @Validated GetFileBaseInfoReq req) {
|
||||
public SdmResponse<FileBaseInfo> getFileBaseInfo(@RequestBody @Validated GetFileBaseInfoReq req) {
|
||||
return dataService.getFileBaseInfo(req);
|
||||
}
|
||||
|
||||
@@ -76,7 +81,7 @@ public class DataController {
|
||||
*/
|
||||
@Operation(summary = "获取文件夹内容信息")
|
||||
@PostMapping("/queryDir")
|
||||
public SdmResponse queryDir(@RequestBody @Validated QueryDirReq req) {
|
||||
public SdmResponse<JSONObject> queryDir(@RequestBody @Validated QueryDirReq req) {
|
||||
return dataService.queryDir(req);
|
||||
}
|
||||
|
||||
@@ -88,7 +93,7 @@ public class DataController {
|
||||
*/
|
||||
@Operation(summary = "重命名文件")
|
||||
@PostMapping("/renameFile")
|
||||
public SdmResponse renameFile(@RequestBody @Validated RenameFileReq req) {
|
||||
public SdmResponse<List<JSONObject>> renameFile(@RequestBody @Validated RenameFileReq req) {
|
||||
return dataService.renameFile(req);
|
||||
}
|
||||
|
||||
@@ -100,7 +105,7 @@ public class DataController {
|
||||
*/
|
||||
@Operation(summary = "检查文件或文件夹是否存在")
|
||||
@GetMapping("/fileExists")
|
||||
public SdmResponse fileExists(@RequestParam("path") String path) {
|
||||
public SdmResponse<Boolean> fileExists(@RequestParam("path") String path) {
|
||||
return dataService.fileExists(path);
|
||||
}
|
||||
|
||||
@@ -112,7 +117,7 @@ public class DataController {
|
||||
*/
|
||||
@Operation(summary = "复制文件")
|
||||
@PostMapping("/copyFile")
|
||||
public SdmResponse copyFile(@RequestBody @Validated CopyFileReq req) {
|
||||
public SdmResponse<List<JSONObject>> copyFile(@RequestBody @Validated CopyFileReq req) {
|
||||
return dataService.copyFile(req);
|
||||
}
|
||||
|
||||
@@ -125,7 +130,7 @@ public class DataController {
|
||||
*/
|
||||
@Operation(summary = "重命名文件夹")
|
||||
@GetMapping("/renameDir")
|
||||
public SdmResponse renameFile(@RequestParam("filePath") String filePath, @RequestParam("newName") String newName, Integer type) {
|
||||
public SdmResponse<List<JSONObject>> renameFile(@RequestParam("filePath") String filePath, @RequestParam("newName") String newName, Integer type) {
|
||||
return dataService.renameDir(filePath, newName, type);
|
||||
}
|
||||
|
||||
@@ -149,17 +154,17 @@ public class DataController {
|
||||
*/
|
||||
@Operation(summary = "分片上传文件")
|
||||
@PostMapping("/uploadFiles")
|
||||
public SdmResponse uploadFiles(UploadFilesReq req) {
|
||||
public SdmResponse<List<JSONObject>> uploadFiles(UploadFilesReq req) {
|
||||
return dataService.uploadFiles(req);
|
||||
}
|
||||
|
||||
@PostMapping("/copyRoute")
|
||||
public SdmResponse copyRoute(@RequestBody @Validated CopyRouteReq req) {
|
||||
public SdmResponse<List<JSONObject>> copyRoute(@RequestBody @Validated CopyRouteReq req) {
|
||||
return dataService.copyRoute(req);
|
||||
}
|
||||
|
||||
@GetMapping("/downloadTvsFile")
|
||||
public SdmResponse downloadTvsFile(String id, String path) {
|
||||
public SdmResponse<List<JSONObject>> downloadTvsFile(String id, String path) {
|
||||
return dataService.downloadTvsFile(id, path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.ccag.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ccag.common.SdmResponse;
|
||||
import com.ccag.config.shiro.IgnoreAuth;
|
||||
import com.ccag.entity.req.model.*;
|
||||
import com.ccag.service.ModelService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import netscape.javascript.JSObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -13,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@Tag(name = "模型相关接口")
|
||||
@RequestMapping("/model")
|
||||
@@ -29,7 +33,7 @@ public class ModelController {
|
||||
@Operation(summary = "接收模型信息(对外)")
|
||||
@IgnoreAuth
|
||||
@PostMapping("/acceptModelInfo")
|
||||
public SdmResponse acceptModelInfo(@RequestBody @Validated AcceptModelInfoReq req) {
|
||||
public SdmResponse<List<JSONObject>> acceptModelInfo(@RequestBody @Validated AcceptModelInfoReq req) {
|
||||
return modelService.acceptModelInfo(req);
|
||||
}
|
||||
|
||||
@@ -40,7 +44,7 @@ public class ModelController {
|
||||
*/
|
||||
@Operation(summary = "向EMBSE推送模型信息")
|
||||
@PostMapping("/pushModelInfo")
|
||||
public SdmResponse pushModelInfo(@RequestBody @Validated PushModelInfoReq req) {
|
||||
public SdmResponse<List<JSONObject>> pushModelInfo(@RequestBody @Validated PushModelInfoReq req) {
|
||||
return modelService.pushModelInfo(req);
|
||||
}
|
||||
|
||||
@@ -52,7 +56,7 @@ public class ModelController {
|
||||
*/
|
||||
@Operation(summary = "查询模型列表")
|
||||
@PostMapping("/queryModelList")
|
||||
public SdmResponse queryModelList(@RequestBody @Validated QueryModelListReq req) {
|
||||
public SdmResponse<JSONObject> queryModelList(@RequestBody @Validated QueryModelListReq req) {
|
||||
return modelService.queryModelList(req);
|
||||
}
|
||||
|
||||
@@ -64,7 +68,7 @@ public class ModelController {
|
||||
*/
|
||||
@Operation(summary = "查询模型训练列表")
|
||||
@PostMapping("/queryModelTrainingList")
|
||||
public SdmResponse queryModelTrainingList(@RequestBody @Validated QueryModelTrainingListReq req) {
|
||||
public SdmResponse<JSONObject> queryModelTrainingList(@RequestBody @Validated QueryModelTrainingListReq req) {
|
||||
return modelService.queryModelTrainingList(req);
|
||||
}
|
||||
|
||||
@@ -76,7 +80,7 @@ public class ModelController {
|
||||
*/
|
||||
@Operation(summary = "查询模型训练详情")
|
||||
@PostMapping("/queryModelTrainingDetail")
|
||||
public SdmResponse queryModelTrainingDetail(@RequestBody @Validated QueryModelTrainingDetailReq req) {
|
||||
public SdmResponse<JSONObject> queryModelTrainingDetail(@RequestBody @Validated QueryModelTrainingDetailReq req) {
|
||||
return modelService.queryModelTrainingDetail(req);
|
||||
}
|
||||
|
||||
@@ -88,7 +92,7 @@ public class ModelController {
|
||||
*/
|
||||
@Operation(summary = "新增模型训练")
|
||||
@PostMapping("/addModelTraining")
|
||||
public SdmResponse addModelTraining(@RequestBody @Validated AddModelTrainingReq req) {
|
||||
public SdmResponse<JSONObject> addModelTraining(@RequestBody @Validated AddModelTrainingReq req) {
|
||||
return modelService.addModelTraining(req);
|
||||
}
|
||||
|
||||
@@ -100,7 +104,7 @@ public class ModelController {
|
||||
*/
|
||||
@Operation(summary = "新增模型训练文件")
|
||||
@PostMapping("/addModelTrainingFile")
|
||||
public SdmResponse addModelTrainingFile(@RequestBody @Validated AddModelTrainingFileReq req) {
|
||||
public SdmResponse<JSONObject> addModelTrainingFile(@RequestBody @Validated AddModelTrainingFileReq req) {
|
||||
return modelService.addModelTrainingFile(req);
|
||||
}
|
||||
|
||||
@@ -112,7 +116,7 @@ public class ModelController {
|
||||
*/
|
||||
@Operation(summary = "检查模型训练名称是否重复")
|
||||
@PostMapping("/checkModelTrainingName")
|
||||
public SdmResponse checkModelTrainingName(@RequestBody @Validated CheckModelTrainingNameReq req) {
|
||||
public SdmResponse<Boolean> checkModelTrainingName(@RequestBody @Validated CheckModelTrainingNameReq req) {
|
||||
return modelService.checkModelTrainingName(req);
|
||||
}
|
||||
|
||||
@@ -124,7 +128,7 @@ public class ModelController {
|
||||
*/
|
||||
@Operation(summary = "更新模型训练")
|
||||
@PostMapping("/updateModelTraining")
|
||||
public SdmResponse updateModelTraining(@RequestBody @Validated UpdateModelTrainingReq req) {
|
||||
public SdmResponse<JSONObject> updateModelTraining(@RequestBody @Validated UpdateModelTrainingReq req) {
|
||||
return modelService.updateModelTraining(req);
|
||||
}
|
||||
|
||||
@@ -136,7 +140,7 @@ public class ModelController {
|
||||
*/
|
||||
@Operation(summary = "删除模型训练")
|
||||
@PostMapping("/delModelTraining")
|
||||
public SdmResponse delModelTraining(@RequestBody @Validated DelModelTrainingReq req) {
|
||||
public SdmResponse<JSONObject> delModelTraining(@RequestBody @Validated DelModelTrainingReq req) {
|
||||
return modelService.delModelTraining(req);
|
||||
}
|
||||
|
||||
@@ -148,7 +152,7 @@ public class ModelController {
|
||||
*/
|
||||
@Operation(summary = "删除模型训练文件")
|
||||
@PostMapping("/delModelTrainingFile")
|
||||
public SdmResponse delModelTrainingFile(@RequestBody @Validated DelModelTrainingFileReq req) {
|
||||
public SdmResponse<JSONObject> delModelTrainingFile(@RequestBody @Validated DelModelTrainingFileReq req) {
|
||||
return modelService.delModelTrainingFile(req);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.ccag.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ccag.common.SdmResponse;
|
||||
import com.ccag.entity.bo.data.FileBaseInfo;
|
||||
import com.ccag.entity.req.data.*;
|
||||
import com.ccag.fileService.entity.SysAttachment;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
@@ -9,35 +11,37 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public interface DataService {
|
||||
|
||||
SdmResponse createDir(CreateDirReq req);
|
||||
SdmResponse<ArrayList<JSONObject>> createDir(CreateDirReq req);
|
||||
|
||||
SdmResponse delDir(DelDirReq req);
|
||||
SdmResponse<ArrayList<JSONObject>> delDir(DelDirReq req);
|
||||
|
||||
boolean reverseDeleteDataFiles(File file);
|
||||
|
||||
SdmResponse delFile(DelFileReq req);
|
||||
SdmResponse<ArrayList<JSONObject>> delFile(DelFileReq req);
|
||||
|
||||
SdmResponse getFileBaseInfo(GetFileBaseInfoReq req);
|
||||
SdmResponse<FileBaseInfo> getFileBaseInfo(GetFileBaseInfoReq req);
|
||||
|
||||
SdmResponse queryDir(QueryDirReq req);
|
||||
SdmResponse<JSONObject> queryDir(QueryDirReq req);
|
||||
|
||||
SdmResponse renameFile(RenameFileReq req);
|
||||
SdmResponse<List<JSONObject>> renameFile(RenameFileReq req);
|
||||
|
||||
SdmResponse fileExists(String path);
|
||||
SdmResponse<Boolean> fileExists(String path);
|
||||
|
||||
SdmResponse copyFile(CopyFileReq req);
|
||||
SdmResponse<List<JSONObject>> copyFile(CopyFileReq req);
|
||||
|
||||
SdmResponse renameDir(String filePath, String newName, Integer type);
|
||||
SdmResponse<List<JSONObject>> renameDir(String filePath, String newName, Integer type);
|
||||
|
||||
void downloadFile(DownloadFileReq req, HttpServletResponse response);
|
||||
|
||||
SdmResponse uploadFiles(UploadFilesReq req);
|
||||
SdmResponse<List<JSONObject>> uploadFiles(UploadFilesReq req);
|
||||
|
||||
SdmResponse copyRoute(CopyRouteReq req);
|
||||
SdmResponse<List<JSONObject>> copyRoute(CopyRouteReq req);
|
||||
|
||||
SdmResponse downloadTvsFile(String id, String path);
|
||||
SdmResponse<List<JSONObject>> downloadTvsFile(String id, String path);
|
||||
}
|
||||
|
||||
@@ -1,29 +1,33 @@
|
||||
package com.ccag.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ccag.common.SdmResponse;
|
||||
import com.ccag.entity.req.model.*;
|
||||
import netscape.javascript.JSObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public interface ModelService {
|
||||
|
||||
SdmResponse acceptModelInfo(AcceptModelInfoReq req);
|
||||
SdmResponse<List<JSONObject>> acceptModelInfo(AcceptModelInfoReq req);
|
||||
|
||||
SdmResponse pushModelInfo(PushModelInfoReq req);
|
||||
SdmResponse<List<JSONObject>> pushModelInfo(PushModelInfoReq req);
|
||||
|
||||
SdmResponse queryModelList(QueryModelListReq req);
|
||||
SdmResponse<JSONObject> queryModelList(QueryModelListReq req);
|
||||
|
||||
SdmResponse queryModelTrainingList(QueryModelTrainingListReq req);
|
||||
SdmResponse queryModelTrainingDetail(QueryModelTrainingDetailReq req);
|
||||
SdmResponse<JSONObject> queryModelTrainingList(QueryModelTrainingListReq req);
|
||||
SdmResponse<JSONObject> queryModelTrainingDetail(QueryModelTrainingDetailReq req);
|
||||
|
||||
SdmResponse addModelTraining(AddModelTrainingReq req);
|
||||
SdmResponse addModelTrainingFile(AddModelTrainingFileReq req);
|
||||
SdmResponse checkModelTrainingName(CheckModelTrainingNameReq req);
|
||||
SdmResponse<JSONObject> addModelTraining(AddModelTrainingReq req);
|
||||
SdmResponse<JSONObject> addModelTrainingFile(AddModelTrainingFileReq req);
|
||||
SdmResponse<Boolean> checkModelTrainingName(CheckModelTrainingNameReq req);
|
||||
|
||||
SdmResponse updateModelTraining(UpdateModelTrainingReq req);
|
||||
SdmResponse<JSONObject> updateModelTraining(UpdateModelTrainingReq req);
|
||||
|
||||
SdmResponse delModelTraining(DelModelTrainingReq req);
|
||||
SdmResponse<JSONObject> delModelTraining(DelModelTrainingReq req);
|
||||
|
||||
SdmResponse delModelTrainingFile(DelModelTrainingFileReq req);
|
||||
SdmResponse<JSONObject> delModelTrainingFile(DelModelTrainingFileReq req);
|
||||
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public class DataServiceImpl implements DataService {
|
||||
private String rootPath;
|
||||
|
||||
@Override
|
||||
public SdmResponse createDir(CreateDirReq req) {
|
||||
public SdmResponse<ArrayList<JSONObject>> createDir(CreateDirReq req) {
|
||||
String strParentPath = req.getParentPath();
|
||||
if (StringUtils.isNotBlank(strParentPath) && strParentPath.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
@@ -95,7 +95,7 @@ public class DataServiceImpl implements DataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse delDir(DelDirReq req) {
|
||||
public SdmResponse<ArrayList<JSONObject>> delDir(DelDirReq req) {
|
||||
log.info(ThreadLocalContext.getIdCode() + " delDir " + req.getDirName());
|
||||
String strParentPath = req.getParentPath();
|
||||
if (StringUtils.isNotBlank(strParentPath) && strParentPath.contains("..")) {
|
||||
@@ -156,7 +156,7 @@ public class DataServiceImpl implements DataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse delFile(DelFileReq req) {
|
||||
public SdmResponse<ArrayList<JSONObject>> delFile(DelFileReq req) {
|
||||
log.info(ThreadLocalContext.getIdCode() + " delFile " + req.getDirName());
|
||||
String strParentPath = req.getParentPath();
|
||||
if (StringUtils.isNotBlank(strParentPath) && strParentPath.contains("..")) {
|
||||
@@ -189,7 +189,7 @@ public class DataServiceImpl implements DataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getFileBaseInfo(GetFileBaseInfoReq req) {
|
||||
public SdmResponse<FileBaseInfo> getFileBaseInfo(GetFileBaseInfoReq req) {
|
||||
String filePath = req.getPath();
|
||||
if (StringUtils.isNotBlank(filePath) && filePath.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
@@ -230,7 +230,7 @@ public class DataServiceImpl implements DataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse queryDir(QueryDirReq req) {
|
||||
public SdmResponse<JSONObject> queryDir(QueryDirReq req) {
|
||||
String strParentPath = req.getParentPath();
|
||||
String strFileName = req.getFileName();
|
||||
String dirPath = strFileName;
|
||||
@@ -318,7 +318,7 @@ public class DataServiceImpl implements DataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse renameFile(RenameFileReq req) {
|
||||
public SdmResponse<List<JSONObject>> renameFile(RenameFileReq req) {
|
||||
String strParentPath = req.getParentPath();
|
||||
if (StringUtils.isNotBlank(strParentPath) && strParentPath.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
@@ -360,7 +360,7 @@ public class DataServiceImpl implements DataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse fileExists(String path) {
|
||||
public SdmResponse<Boolean> fileExists(String path) {
|
||||
if (StringUtils.isNotBlank(path) && path.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
}
|
||||
@@ -369,7 +369,7 @@ public class DataServiceImpl implements DataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse copyFile(CopyFileReq req) {
|
||||
public SdmResponse<List<JSONObject>> copyFile(CopyFileReq req) {
|
||||
String sourceFilePath = req.getSourceFilePath();
|
||||
if (StringUtils.isNotBlank(sourceFilePath) && sourceFilePath.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
@@ -401,7 +401,7 @@ public class DataServiceImpl implements DataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse renameDir(String filePath, String newName, Integer type) {
|
||||
public SdmResponse<List<JSONObject>> renameDir(String filePath, String newName, Integer type) {
|
||||
if (StringUtils.isNotBlank(filePath) && filePath.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
}
|
||||
@@ -455,7 +455,7 @@ public class DataServiceImpl implements DataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse uploadFiles(UploadFilesReq req) {
|
||||
public SdmResponse<List<JSONObject>> uploadFiles(UploadFilesReq req) {
|
||||
String loginIdCode = ThreadLocalContext.getIdCode();
|
||||
if (ObjectUtils.isEmpty(req)) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "参数不能为空!");
|
||||
@@ -534,7 +534,7 @@ public class DataServiceImpl implements DataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse copyRoute(CopyRouteReq req) {
|
||||
public SdmResponse<List<JSONObject>> copyRoute(CopyRouteReq req) {
|
||||
String sourceFilePath = req.getSourcePath();
|
||||
if (StringUtils.isNotBlank(sourceFilePath) && sourceFilePath.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
@@ -586,7 +586,7 @@ public class DataServiceImpl implements DataService {
|
||||
* @param path 存储文件的绝对路径
|
||||
*/
|
||||
@Override
|
||||
public SdmResponse downloadTvsFile(String id, String path) {
|
||||
public SdmResponse<List<JSONObject>> downloadTvsFile(String id, String path) {
|
||||
byte[] bytes = attachmentGrpcClientService.downloadFile(id);
|
||||
try {
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(path);
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.ccag.knowledgeservice.entity.KbProjectLibrary;
|
||||
import com.ccag.service.ModelService;
|
||||
import com.ccag.service.remote.EmbseService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import netscape.javascript.JSObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -54,7 +55,7 @@ public class ModelServiceImpl implements ModelService {
|
||||
private static final String ROUND_ID = "roundId";
|
||||
|
||||
@Override
|
||||
public SdmResponse acceptModelInfo(AcceptModelInfoReq req) {
|
||||
public SdmResponse<List<JSONObject>> acceptModelInfo(AcceptModelInfoReq req) {
|
||||
log.info("同步模型信息请求:" + JSON.toJSONString(req));
|
||||
String operation = req.getOperation();
|
||||
JSONObject record = req.getRecord();
|
||||
@@ -179,7 +180,7 @@ public class ModelServiceImpl implements ModelService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse pushModelInfo(PushModelInfoReq req) {
|
||||
public SdmResponse<List<JSONObject>> pushModelInfo(PushModelInfoReq req) {
|
||||
List<String> modelIds = req.getModelIds();
|
||||
String dataSource;
|
||||
String operationFlag;
|
||||
@@ -242,7 +243,7 @@ public class ModelServiceImpl implements ModelService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse queryModelList(QueryModelListReq req) {
|
||||
public SdmResponse<JSONObject> queryModelList(QueryModelListReq req) {
|
||||
String company = ThreadLocalContext.getUserContext().getUser().getTenantId();
|
||||
int pos = (req.getPageNum() - 1) * req.getPageSize();
|
||||
int limit = req.getPageSize();
|
||||
@@ -283,7 +284,7 @@ public class ModelServiceImpl implements ModelService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse queryModelTrainingList(QueryModelTrainingListReq req) {
|
||||
public SdmResponse<JSONObject> queryModelTrainingList(QueryModelTrainingListReq req) {
|
||||
int pos = (req.getPageNum() - 1) * req.getPageSize();
|
||||
List<ModelTraining> modelTrainings = modelMapper.queryModelTrainingList(req.getName(), req.getAlgorithmType(), req.getAlgorithm(), req.getStatus(), req.getCreateBy(), req.getTenantId(), pos, req.getPageSize());
|
||||
int count = modelMapper.queryModelTrainingCount(req.getName(), req.getAlgorithmType(), req.getAlgorithm(), req.getStatus(), req.getCreateBy(), req.getTenantId());
|
||||
@@ -300,7 +301,7 @@ public class ModelServiceImpl implements ModelService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse queryModelTrainingDetail(QueryModelTrainingDetailReq req) {
|
||||
public SdmResponse<JSONObject> queryModelTrainingDetail(QueryModelTrainingDetailReq req) {
|
||||
ModelTraining modelTraining = modelMapper.getModelTrainingById(req.getTrainingId(), ThreadLocalContext.getUserContext().getUser().getTenantId());
|
||||
JSONObject jsonObject = JSONObject.from(modelTraining);
|
||||
jsonObject.put("files", modelMapper.getModelTrainingFileList(req.getTrainingId(), ThreadLocalContext.getUserContext().getUser().getTenantId()));
|
||||
@@ -308,7 +309,7 @@ public class ModelServiceImpl implements ModelService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse addModelTraining(AddModelTrainingReq req) {
|
||||
public SdmResponse<JSONObject> addModelTraining(AddModelTrainingReq req) {
|
||||
ModelTraining modelTraining = new ModelTraining();
|
||||
modelTraining.setName(req.getName());
|
||||
modelTraining.setAlgorithmType(req.getAlgorithmType());
|
||||
@@ -324,7 +325,7 @@ public class ModelServiceImpl implements ModelService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse addModelTrainingFile(AddModelTrainingFileReq req) {
|
||||
public SdmResponse<JSONObject> addModelTrainingFile(AddModelTrainingFileReq req) {
|
||||
List<ModelTrainingFile> modelTrainingFiles = req.getModelTrainingFiles();
|
||||
int result = modelMapper.addModelTrainingFileBatch(modelTrainingFiles);
|
||||
if (result <= 0) {
|
||||
@@ -334,13 +335,13 @@ public class ModelServiceImpl implements ModelService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse checkModelTrainingName(CheckModelTrainingNameReq req) {
|
||||
public SdmResponse<Boolean> checkModelTrainingName(CheckModelTrainingNameReq req) {
|
||||
ModelTraining modelTraining = modelMapper.getModelTrainingByName(req.getName(), ThreadLocalContext.getUserContext().getUser().getTenantId());
|
||||
return SdmResponse.success(modelTraining != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse updateModelTraining(UpdateModelTrainingReq req) {
|
||||
public SdmResponse<JSONObject> updateModelTraining(UpdateModelTrainingReq req) {
|
||||
ModelTraining training = modelMapper.getModelTrainingById(req.getId(), ThreadLocalContext.getUserContext().getUser().getTenantId());
|
||||
if (training == null) {
|
||||
return SdmResponse.failed("模型训练记录不存在");
|
||||
@@ -360,7 +361,7 @@ public class ModelServiceImpl implements ModelService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse delModelTraining(DelModelTrainingReq req) {
|
||||
public SdmResponse<JSONObject> delModelTraining(DelModelTrainingReq req) {
|
||||
ModelTraining modelTraining = modelMapper.getModelTrainingById(req.getId(), ThreadLocalContext.getUserContext().getUser().getTenantId());
|
||||
if (modelTraining == null) {
|
||||
return SdmResponse.failed("模型训练记录不存在");
|
||||
@@ -370,7 +371,7 @@ public class ModelServiceImpl implements ModelService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse delModelTrainingFile(DelModelTrainingFileReq req) {
|
||||
public SdmResponse<JSONObject> delModelTrainingFile(DelModelTrainingFileReq req) {
|
||||
int result = modelMapper.delModelTrainingFile(req.getIds());
|
||||
if (result <= 0) {
|
||||
return SdmResponse.failed("删除模型训练文件失败");
|
||||
|
||||
Reference in New Issue
Block a user