Merge branch 'main' of http://192.168.65.198:3000/toolchaintechnologycenter/spdm-backend
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
package com.sdm.common.config;
|
||||
|
||||
public interface FlowableConfig {
|
||||
/*
|
||||
* 前端流程节点自定义执行参数key
|
||||
*/
|
||||
String EXECUTECONFIG = "executeConfig";
|
||||
|
||||
// 异步流程ReceiveTask节点回调返回结果变量名
|
||||
String RECEIVETASK_CALLBACKE_STATUS = "ReceivetaskCallbackeStatus";
|
||||
String RECEIVETASK_CALLBACKE_MSG = "ReceivetaskCallbackeMsg";
|
||||
|
||||
/*
|
||||
* 重试相关变量名
|
||||
*/
|
||||
String RETRY_TARGET_NODE_ID = "_retryTargetNodeId";
|
||||
String RETRY_ORIGIN_NODE_ID = "_retryOriginNodeId";
|
||||
String RETRY_ERROR_MESSAGE = "_retryErrorMessage";
|
||||
|
||||
/*
|
||||
* 重试任务ID
|
||||
*/
|
||||
String RETRY_TASK_ID = "genericRetryTask";
|
||||
|
||||
/*
|
||||
* 网关前缀
|
||||
*/
|
||||
String JOIN_GATEWAY_PREFIX = "join_gw_";
|
||||
String SPLIT_GATEWAY_PREFIX = "split_gw_";
|
||||
|
||||
/*
|
||||
* 任务后缀
|
||||
*/
|
||||
String ASYNC_TASK_SUFFIX = "_wait"; // 后置接收
|
||||
String WAIT_USER_SUFFIX = "_waitUser"; //前置人工
|
||||
String CHECK_SUFFIX = "_check"; // 后置哨兵
|
||||
|
||||
/**
|
||||
* 流程的节点本地文件夹基础路径
|
||||
*/
|
||||
String FLOWABLE_SIMULATION_BASEDIR ="/home/simulation/";
|
||||
|
||||
|
||||
/**
|
||||
* 节点执行模式 Key (存储在 paramJson 中)
|
||||
* value: "AUTO" | "MANUAL"
|
||||
*/
|
||||
String EXECUTE_MODE_KEY = "executeMode";
|
||||
String EXECUTE_MODE_AUTO = "AUTO";
|
||||
String EXECUTE_MODE_MANUAL = "MANUAL";
|
||||
|
||||
/**
|
||||
* 手动模式下,用户明确指定的文件列表 Key
|
||||
* value: Map<String, List<String>>
|
||||
*/
|
||||
String EXPLICIT_INPUT_FILES_KEY = "explicitInputFiles"; // 原: _explicitInputFiles
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SubmitHpcTaskRemoteReq implements Serializable {
|
||||
@@ -51,7 +52,10 @@ public class SubmitHpcTaskRemoteReq implements Serializable {
|
||||
@Schema(description = "任务回传本地Nas的路径")
|
||||
public String stdoutSpdmNasFilePath;
|
||||
|
||||
@Schema(description = "任务求解文件本地路径,spdm工作流引擎会传递过来,adapter里使用")
|
||||
@Schema(description = "获取求解文件的方式AUTO,自动或者手动MANUAL")
|
||||
public String executeMode;
|
||||
|
||||
@Schema(description = "任务求解文件本地路径,spdm工作流引擎会传递过来,adapter里使用,executeMode=AUTO")
|
||||
public String simulationFileLocalPath;
|
||||
|
||||
@Schema(description = "任务求解文件主文件正则,spdm工作流引擎会传递过来,adapter里使用")
|
||||
@@ -60,5 +64,10 @@ public class SubmitHpcTaskRemoteReq implements Serializable {
|
||||
@Schema(description = "任务求解文件从文件正则,spdm工作流引擎会传递过来,adapter里使用")
|
||||
public String inputFilesRegularStr;
|
||||
|
||||
@Schema(description = "任务求解文件主文件路径,adapter里使用,executeMode=MANUAL")
|
||||
public List<String> manualMasterFilepaths;
|
||||
|
||||
@Schema(description = "任务求解文件从文件路径,adapter里使用,executeMode=MANUAL")
|
||||
public List<String> manualInputFilePaths;
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class TaskClientFeignClientImpl implements ITaskFeignClient {
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
CoreLogger.error("SubmitHpcJob Exception:{}", e.getMessage());
|
||||
return SdmResponse.failed("Hpc任务提交失败");
|
||||
return SdmResponse.failed("Hpc任务提交失败:"+e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -61,6 +61,15 @@ public interface IDataFeignClient {
|
||||
@PostMapping("/data/downloadFileToLocal")
|
||||
void downloadFileToLocal(@RequestParam(value = "fileId") @Validated Long fileId, @RequestParam(value = "path") @Validated String path);
|
||||
|
||||
/**
|
||||
* 下载文件夹
|
||||
*
|
||||
* @param downloadDirId
|
||||
* @param basePath
|
||||
* @param fileRegularStr
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/data/downloadFolderToLocal")
|
||||
SdmResponse downloadFolderToLocal(@RequestParam(value = "downloadDirId") @Validated Long downloadDirId,
|
||||
@RequestParam(value = "basePath") @Validated String basePath,
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.sdm.common.service;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.data.GetFileBaseInfoReq;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import com.sdm.common.feign.inter.data.IDataFeignClient;
|
||||
import lombok.extern.log4j.Log4j;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class DataFileService {
|
||||
@Autowired
|
||||
private IDataFeignClient dataFeignClient;
|
||||
|
||||
/**
|
||||
* 辅助:获取 ObjectKey
|
||||
*/
|
||||
public String getObjectKeyByDirId(Long dirId) {
|
||||
GetFileBaseInfoReq fileReq = new GetFileBaseInfoReq();
|
||||
fileReq.setFileId(dirId);
|
||||
SdmResponse<FileMetadataInfoResp> fileResp = dataFeignClient.getFileBaseInfo(fileReq);
|
||||
if (!fileResp.isSuccess() || fileResp.getData() == null) {
|
||||
log.error("获取文件信息失败:" + fileResp.getMessage());
|
||||
return null;
|
||||
}
|
||||
return fileResp.getData().getObjectKey();
|
||||
}
|
||||
}
|
||||
@@ -541,4 +541,45 @@ public class FilesUtil {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 直接将MultipartFile写入Linux服务器
|
||||
*
|
||||
* @param file 上传的文件
|
||||
* @param linuxDirPath Linux服务器上的目录路径
|
||||
* @return 完整的文件路径
|
||||
*/
|
||||
private String writeToLinuxServer(MultipartFile file, String linuxDirPath) {
|
||||
// 方式1:如果您可以通过网络文件系统(如NFS、Samba等)访问Linux服务器上的目录
|
||||
|
||||
try {
|
||||
// 确保目标目录存在
|
||||
File destDir = new File(linuxDirPath);
|
||||
if (!destDir.exists()) {
|
||||
destDir.mkdirs();
|
||||
}
|
||||
|
||||
// 拼接完整文件路径
|
||||
String fileName = file.getOriginalFilename();
|
||||
// 处理文件名为空的情况
|
||||
if (fileName == null || fileName.isEmpty()) {
|
||||
fileName = System.currentTimeMillis() + "_uploadFile";
|
||||
}
|
||||
|
||||
// 构造完整的目标文件路径
|
||||
String destFilePath = linuxDirPath.endsWith("/") ?
|
||||
linuxDirPath + fileName : linuxDirPath + "/" + fileName;
|
||||
|
||||
File destFile = new File(destFilePath);
|
||||
|
||||
// 将文件内容写入Linux服务器路径
|
||||
file.transferTo(destFile);
|
||||
log.info("文件成功写入Linux服务器: {}", destFilePath);
|
||||
|
||||
return destFilePath;
|
||||
} catch (IOException e) {
|
||||
log.error("写入Linux服务器失败,目录: {}", linuxDirPath, e);
|
||||
throw new RuntimeException("无法将文件写入Linux服务器: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user