# Conflicts:
#	common/src/main/java/com/sdm/common/entity/req/project/SpdmReportReq.java
#	project/src/main/java/com/sdm/project/controller/SimulationRunController.java
#	project/src/main/java/com/sdm/project/dao/SimulationTaskMapper.java
#	project/src/main/java/com/sdm/project/service/ISimulationRunService.java
#	project/src/main/java/com/sdm/project/service/impl/ProjectServiceImpl.java
#	project/src/main/java/com/sdm/project/service/impl/SimulationRunServiceImpl.java
#	project/src/main/resources/mapper/SimulationTaskMapper.xml
This commit is contained in:
2025-12-11 20:30:07 +08:00
213 changed files with 18211 additions and 1017 deletions

View File

@@ -97,7 +97,10 @@ public class FeignLoggingConfig {
public Exception decode(String methodKey, Response response) {
// 记录错误响应
try {
String body = Util.toString(response.body().asReader(UTF_8));
String body = "";
if (response.body() != null) {
body = Util.toString(response.body().asReader(UTF_8));
}
LoggerFactory.getLogger("FeignClient").error("Feign调用出错方法: {},状态码: {},响应体: {}",
methodKey, response.status(), body);
} catch (IOException e) {

View File

@@ -4,6 +4,28 @@ import java.lang.reflect.Field;
public class BaseBean {
public void handleNull()
{
Class cls = this.getClass();
Field[] fields = cls.getDeclaredFields();
try {
for (Field field : fields) {
Class typeClass = field.getType();
if (typeClass.equals(String.class))
{
Object object = field.get(this);
if (object == null)
{
field.set(this, "");
}
}
}
}
catch (Exception e) {
e.printStackTrace();
}
}
protected void init()
{
Class cls = this.getClass();

View File

@@ -11,10 +11,10 @@ public class DataDictionary extends BaseBean {
public String uuid;
public String dictName;
public String dictValue;
public String dictType;
public String valueType;
public String aliasName;
public String dictClass;
public String classType;
public int dictOrder;
public String comment;
public Long creator;

View File

@@ -0,0 +1,58 @@
package com.sdm.common.entity.bo;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class JwtToken {
private String keyId;
private String issuer;
private String subject;
private String userName;
private final long EXPIRE_TIME = 100*60*60*1000;
public JwtToken(String keyId,String userId,String userName,String appName)
{
this.keyId = keyId;
this.issuer = userId;
this.subject = appName;
this.userName = userName;
}
public String getKeyId()
{
return keyId;
}
public String getIssuer()
{
return issuer;
}
public String getUserName()
{
return userName;
}
public String getSubject()
{
return subject;
}
public String getJwtId()
{
return UUID.randomUUID().toString();
}
public long getExpirationTime()
{
return EXPIRE_TIME;
}
public Map<String,?> getClaimMap()
{
Map<String,String> claimMap = new HashMap<>();
claimMap.put("userid",issuer);
claimMap.put("username",userName);
claimMap.put("account",userName);
return claimMap;
}
}

View File

@@ -2,6 +2,8 @@ package com.sdm.common.entity.enums;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
@Schema(description = "文件夹类型枚举")
public enum DirTypeEnum {
/**
@@ -64,4 +66,12 @@ public enum DirTypeEnum {
}
return null;
}
// 初始化用户业务库目录
private static final List<DirTypeEnum> INIT_SPMD_DIR = List.of(
DirTypeEnum.KNOWLEDGE_BASE_DIR, DirTypeEnum.PROJECT_NODE_DIR,
DirTypeEnum.AVATAR_DIR, DirTypeEnum.SIMULATION_PARAMETER_DIR, DirTypeEnum.TRAIN_MODEL_DIR,DirTypeEnum.SCRIPT_DIR);
public static final List<DirTypeEnum> getInitSpmdDir() {
return INIT_SPMD_DIR;
}
}

View File

@@ -4,9 +4,8 @@ public enum FilePermissionEnum {
READ((byte) 0x01),
WRITE((byte) 0x02),
DELETE((byte) 0x04),
DOWNLOAD((byte) 0x08),
UPLOAD((byte) 0x10),
NONE((byte) -1),
UPLOAD((byte) 0x08),
DOWNLOAD((byte) 0x10),
ZERO((byte) 0),
ALL((byte) (READ.value | WRITE.value | DELETE.value | DOWNLOAD.value | UPLOAD.value));
byte value;

View File

@@ -6,6 +6,7 @@ package com.sdm.common.entity.enums;
public enum MessageTemplateEnum {
TASK_ISSUE("任务通知", "收到一条下发的新任务:%s请前去[任务管理-我执行的]进行处理"),
DATA_ALERT("数据通知", "您的数据存储空间已达阈值,可前往[系统管理-数据存储-存储设置]查看"),
HPC_START("作业通知", "作业已发起"),
HPC_END("作业通知", "作业已结束")
;

View File

@@ -15,4 +15,5 @@ public class NodeDetailInfo extends NodeStructureInfo{
private Date endTime;
private Long durationInMillis;
private String durationFormatted;
private String errorMessage;
}

View File

@@ -1,5 +1,6 @@
package com.sdm.common.entity.flowable.dto;
import com.alibaba.fastjson2.JSONObject;
import lombok.Data;
import java.util.List;
@@ -12,5 +13,5 @@ public class NodeStructureInfo {
protected String type; // 如 "UserTask", "ExclusiveGateway"
protected List<String> nextNodeIds; // 后续节点 ID 列表
protected String executeConfig; // 扩展属性内容
protected Map<String,Object> userParam;// 用户输入参数
protected JSONObject userParam;// 用户输入参数
}

View File

@@ -4,4 +4,11 @@ import lombok.Data;
@Data
public class ExportWordScriptExecuteConfig extends BaseExecuteConfig {
// 输入节点id
private String beforeNodeId;
// 文件正则表达式,用于匹配输入文件夹下的文件名
private String fileRegularStr="^.+\\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|tif)$";
// 导出脚本文件id
private Long exportScriptFileId = 4462L;
}

View File

@@ -5,7 +5,6 @@ import lombok.Data;
@Data
public class HPCExecuteConfig extends BaseExecuteConfig {
private String currentNodeId;
private String beforeNodeId;
// 先默认写死一个,后面前端配置传递
private String masterFileRegularStr="^aa\\.xml$";

View File

@@ -0,0 +1,17 @@
package com.sdm.common.entity.pojo.task;
import java.util.ArrayList;
import java.util.List;
public class FlowBindTaskPoolItem {
public String poolName;
public int poolId;
public String version;
public String flowCode;
public List<TaskBaseInfo> taskList = new ArrayList<>();
}

View File

@@ -0,0 +1,23 @@
package com.sdm.common.entity.pojo.task;
import com.sdm.common.common.SdmResponse;
import lombok.Data;
@Data
public class TaskBaseInfo {
public String taskName;
public String taskCode;
public String uuid;
public String poolName;
public String version;
public Integer poolId;
public Long fileId;
}

View File

@@ -1,5 +1,6 @@
package com.sdm.common.entity.req.capability;
import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.sdm.common.entity.flowable.dto.NodeDetailInfo;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -43,7 +44,7 @@ public class FlowNodeDto {
private String processInstanceId;
@Schema(description = "用户输入参数")
private Map<String, Object> userParams;
private JSONObject userParams;
@Schema(description = "创建人")
private Long creator;

View File

@@ -0,0 +1,47 @@
package com.sdm.common.entity.req.data;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Map;
@Data
@Schema(description = "更新权限请求参数")
public class UpdatePermissionReq {
// @NotBlank(message = "parentPath不能为空")
@Schema(description = "父路径")
private String parentPath;
// @NotBlank(message = "fileName不能为空")
@Schema(description = "文件名称")
private String fileName;
@Schema(description = "工号", requiredMode = Schema.RequiredMode.REQUIRED)
private String jobNumber;
@Schema(description = "用户名", requiredMode = Schema.RequiredMode.REQUIRED)
private String userName;
// @NotBlank(message = "effectiveTime不能为空")
@Schema(description = "生效时间")
private String effectiveTime;
@Schema(description = "权限值")
private byte permission;
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "文件ID")
private Long fileId;
@Schema(description = "节点uuid")
private String uuid;
@Schema(description = "类型: 0普通用户, 1组用户")
private byte type; //0:普通用户 1组用户
@Schema(description = "用户权限key:用户ID,value:权限值")
private Map<Long,Byte> userPermissions;
}

View File

@@ -1,18 +1,13 @@
package com.sdm.common.entity.req.pbs;
import com.alibaba.fastjson2.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
import java.io.Serializable;
@Data
public class SubmitHpcTaskRemoteReq {
@Schema(description = "配置时的mm时间戳")
public String timesmap;
public class SubmitHpcTaskRemoteReq implements Serializable {
private static final long serialVersionUID = 10086L;
@Schema(description = "计算任务名称")
public String jobName;
@@ -29,14 +24,6 @@ public class SubmitHpcTaskRemoteReq {
@Schema(description = "计算任务是否独立存在 0非独立任务 1独立任务")
public int independence;
@Schema(description = "求解文件")
@JSONField(serialize = false)
public List<MultipartFile> inputFiles = new ArrayList<>();
@Schema(description = "计算主文件")
@JSONField(serialize = false)
public MultipartFile masterFile;
@Schema(description = "计算任务所属任务ID")
public String taskId;
@@ -58,4 +45,20 @@ public class SubmitHpcTaskRemoteReq {
@Schema(description = "任务所属项目")
public String projectname;
@Schema(description = "计算任务回传minio的路径")
public String stdoutSpdmMinoFilePath;
@Schema(description = "任务回传本地Nas的路径")
public String stdoutSpdmNasFilePath;
@Schema(description = "任务求解文件本地路径,spdm工作流引擎会传递过来adapter里使用")
public String simulationFileLocalPath;
@Schema(description = "任务求解文件主文件正则,spdm工作流引擎会传递过来adapter里使用")
public String masterFileRegularStr;
@Schema(description = "任务求解文件从文件正则,spdm工作流引擎会传递过来adapter里使用")
public String inputFilesRegularStr;
}

View File

@@ -0,0 +1,46 @@
package com.sdm.common.entity.req.project;
import lombok.Data;
import java.io.Serializable;
@Data
public class ProjecInfoReq implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 部门
*/
private String department;
private String applicants;
private String date;
private String projectNum;
private String workspaceNum;
private String workspace;
private String taskType;
private String reportVer;
private String fileNum;
private String formulateTime;
private String checkTime;
private String approveTime;
private Boolean isBatch = false;
private String loadcaseName;
private String reportCommand;
}

View File

@@ -0,0 +1,141 @@
package com.sdm.common.entity.req.project;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author author
* @since 2025-11-03
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("simulation_performance")
@ApiModel(value="SimulationPerformance对象", description="")
public class SimulationPerformance implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableField("uuid")
private String uuid;
@TableField("nodeId")
private String nodeId;
@TableField("taskId")
private String taskId;
@ApiModelProperty(value = "算列runId")
@TableField("runId")
private String runId;
@TableField("performanceName")
private String performanceName;
@TableField("nodeName")
private String nodeName;
@TableField("englishName")
private String englishName;
@TableField("nodeCode")
private String nodeCode;
@TableField("poolName")
private String poolName;
@TableField("performanceType")
private String performanceType;
@TableField("unit")
private String unit;
@TableField("targetValue")
private String targetValue;
@TableField("lowValue")
private String lowValue;
@TableField("highValue")
private String highValue;
@TableField("method")
private String method;
@ApiModelProperty(value = "指标完成情况 未完成 不合格 风险可控 未分析 合格")
@TableField("completeStatus")
private String completeStatus;
@ApiModelProperty(value = "计算及结果值")
@TableField("resultValue")
private String resultValue;
@TableField("description")
private String description;
@TableField("taskName")
private String taskName;
@TableField("standard")
private String standard;
@TableField("tenantId")
private String tenantId;
@TableField("createTime")
private LocalDateTime createTime;
@TableField("creator")
private Long creator;
@TableField("pid")
private Integer pid;
@TableField("tag1")
private String tag1;
@TableField("tag2")
private String tag2;
@TableField("tag3")
private String tag3;
@TableField("tag4")
private String tag4;
@TableField("tag5")
private String tag5;
@TableField("tag6")
private String tag6;
@TableField("tag7")
private String tag7;
@TableField("tag8")
private String tag8;
@TableField("tag9")
private String tag9;
@TableField("tag10")
private String tag10;
}

View File

@@ -0,0 +1,36 @@
package com.sdm.common.entity.req.project;
import lombok.Data;
import java.util.List;
@Data
public class SpdmReportReq {
/**
* 任务执行————关键结果————图片结果的文件id集合
*/
private List<Long> imageFileIdList;
/**
* 性能指标集合
*/
private List<SimulationPerformance> performanceList;
/**
* 算例父节点信息
*/
private ProjecInfoReq projecInfoReq;
/**
* 报告复制路径地址
*/
private String outPutDirPath;
/**
* 生成的报告要上传到流程节点的路径
*/
private String flowPath;
}

View File

@@ -0,0 +1,19 @@
package com.sdm.common.entity.req.task;
import com.sdm.common.entity.pojo.task.FlowBindTaskPoolItem;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
public class BindTaskAndFlowTemplateReq {
@Schema(description = "流程模版编号")
@NotBlank(message = "流程模版编号不能为空")
public String flowCode;
@Schema(description = "分析项库中绑定到执行流程的分析项信息")
public List<FlowBindTaskPoolItem> bindTaskkPoolItem = new ArrayList<>();
}

View File

@@ -8,6 +8,7 @@ import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
* 文件元数据传输对象(用于接口返回给前端)
@@ -107,6 +108,9 @@ public class FileMetadataInfoResp implements Serializable {
@Schema(description = "分析方向名称(展示用)")
private String analysisDirectionName;
@Schema(description= "仿真任务池信息列表")
private List<PoolInfo> poolInfos;
@Schema(description = "完整访问URL拼接minio网关地址 + objectKey")
private String fileUrl;

View File

@@ -0,0 +1,42 @@
package com.sdm.common.entity.resp.data;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 文件与工况任务绑定关系
* </p>
*
* @author author
* @since 2025-12-02
*/
@Data
public class FileSimulationMappingResp implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private Long fileId;
private Integer simulationPoolId;
private String simulationPoolVersion;
private String simulationPoolTaskId;
private LocalDateTime createTime;
private LocalDateTime updateTime;
}

View File

@@ -0,0 +1,15 @@
package com.sdm.common.entity.resp.data;
import com.sdm.common.entity.pojo.task.TaskBaseInfo;
import lombok.Data;
import java.util.List;
@Data
public class PoolInfo {
private Integer simulationPoolId;
private String simulationPoolName;
private String simulationPoolVersion;
private List<String> simulationPoolTaskIds;
private List<TaskBaseInfo> taskBaseInfoList;
}

View File

@@ -0,0 +1,19 @@
package com.sdm.common.entity.resp.system;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "用户新增请求参数")
public class UserTokenResp {
@Schema(description = "token")
private String access_token;
@Schema(description = "用户ID")
private String cid_user_id;
@Schema(description = "租户ID")
private String cid_tenant_id;
}

View File

@@ -0,0 +1,65 @@
package com.sdm.common.entity.resp.task;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class PerformanceResp {
private Integer id;
private String uuid;
private String nodeId;
private String taskId;
@ApiModelProperty(value = "算列runId")
private String runId;
private String performanceName;
private String nodeName;
private String englishName;
private String nodeCode;
private String poolName;
private String performanceType;
private String unit;
private String targetValue;
private String lowValue;
private String highValue;
private String method;
@ApiModelProperty(value = "指标完成情况 未完成 不合格 风险可控 未分析 合格")
private String completeStatus;
@ApiModelProperty(value = "计算及结果值")
private String resultValue;
private String description;
private String taskName;
private String standard;
private String tenantId;
private LocalDateTime createTime;
private Long creator;
private Integer pid;
}

View File

@@ -158,6 +158,17 @@ public class DataClientFeignClientImpl implements IDataFeignClient {
}
}
@Override
public SdmResponse downloadFolderToLocal(Long downloadDirId, String basePath, String fileRegularStr) {
try {
dataClient.downloadFolderToLocal(downloadDirId,basePath,fileRegularStr);
return SdmResponse.success();
} catch (Exception e) {
log.error("下载文件响应", e);
return SdmResponse.failed("下载文件响应");
}
}
@Override
public SdmResponse<List<BatchAddFileInfoResp>> batchAddFileInfo(UploadFilesReq req) {
SdmResponse<List<BatchAddFileInfoResp>> response;
@@ -171,4 +182,16 @@ public class DataClientFeignClientImpl implements IDataFeignClient {
}
}
@Override
public SdmResponse updatePermission(UpdatePermissionReq req) {
SdmResponse response;
try {
response = dataClient.updatePermission(req);
log.info("权限更新成功:"+ response);
return response;
} catch (Exception e) {
log.error("权限更新失败:", e);
return SdmResponse.failed("权限更新失败");
}
}
}

View File

@@ -16,10 +16,10 @@ public class TaskClientFeignClientImpl implements ITaskFeignClient {
private ITaskFeignClient taskFeignClient;
@Override
public SdmResponse<String> submitHpcJob(SubmitHpcTaskRemoteReq req) {
public SdmResponse<String> adapterSubmitHpcJob(SubmitHpcTaskRemoteReq req) {
SdmResponse<String> response;
try {
response = taskFeignClient.submitHpcJob(req);
response = taskFeignClient.adapterSubmitHpcJob(req);
return response;
} catch (Exception e) {
CoreLogger.error("SubmitHpcJob Exception:{}", e.getMessage());

View File

@@ -1,6 +1,7 @@
package com.sdm.common.feign.impl.project;
import com.sdm.common.common.SdmResponse;
import com.sdm.common.entity.req.project.SpdmReportReq;
import com.sdm.common.entity.req.system.LaunchApproveReq;
import com.sdm.common.entity.resp.AllNodeByProjectIdAndTypeResp;
import com.sdm.common.feign.inter.project.ISimulationRunFeignClient;
@@ -27,4 +28,27 @@ public class SimulationRunFeignClientImpl implements ISimulationRunFeignClient {
}
return response;
}
@Override
public SdmResponse<List<Long>> getSimulationKeyResultFileIds(String runId) {
SdmResponse response;
try {
response = simulationRunFeignClient.getSimulationKeyResultFileIds(runId);
} catch (Exception e) {
log.error("查询算例关键结果文件失败", e);
return SdmResponse.failed("查询算例关键结果文件失败");
}
return response;
}
@Override
public SdmResponse<Void> generateReportInternal(SpdmReportReq req) {
try {
simulationRunFeignClient.generateReportInternal(req);
return SdmResponse.success();
}catch (Exception e){
log.error("内部调用生成自动化报告失败", e);
return SdmResponse.failed("内部调用生成自动化报告失败");
}
}
}

View File

@@ -0,0 +1,33 @@
package com.sdm.common.feign.impl.task;
import com.sdm.common.common.SdmResponse;
import com.sdm.common.entity.resp.task.PerformanceResp;
import com.sdm.common.feign.inter.task.ISimuluationPerformanceFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
@Slf4j
@Component
public class SimuluationPerformanceFeignClientImpl implements ISimuluationPerformanceFeignClient {
@Autowired
private ISimuluationPerformanceFeignClient simuluationPerformanceFeignClient;
@Override
public SdmResponse<List<PerformanceResp>> getRunPerformance(String runId) {
SdmResponse response;
try {
response = simuluationPerformanceFeignClient.getRunPerformance(runId);
if (!response.isSuccess()) {
return SdmResponse.failed("查询算例指标失败");
}
return response;
} catch (Exception e) {
log.error("查询算例指标异常", e);
return SdmResponse.failed("查询算例指标异常");
}
}
}

View File

@@ -1,11 +1,18 @@
package com.sdm.common.feign.impl.task;
import com.sdm.common.common.SdmResponse;
import com.sdm.common.entity.pojo.task.FlowBindTaskPoolItem;
import com.sdm.common.entity.pojo.task.TaskBaseInfo;
import com.sdm.common.entity.req.system.LaunchApproveReq;
import com.sdm.common.entity.req.task.BindTaskAndFlowTemplateReq;
import com.sdm.common.feign.inter.task.ISimuluationTaskPoolFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
@Slf4j
@Component
@@ -30,4 +37,54 @@ public class SimuluationTaskPoolFeignClientImpl implements ISimuluationTaskPoolF
}
}
@Override
public SdmResponse updateTaskAndFlowTemplate(BindTaskAndFlowTemplateReq req) {
SdmResponse response;
try {
response = simuluationTaskPoolFeignClient.updateTaskAndFlowTemplate(req);
if (!response.isSuccess()) {
response = SdmResponse.failed("绑定分析项和流程模版失败");
}
}catch (Exception e){
log.error("绑定分析项和流程模版异常");
response = SdmResponse.failed(("绑定分析项和流程模版异常"));
}
return response;
}
@Override
public SdmResponse<List<FlowBindTaskPoolItem>> getFlowTemplateBindTaskRelate(String flowCode) {
SdmResponse response;
try {
response = simuluationTaskPoolFeignClient.getFlowTemplateBindTaskRelate(flowCode);
if (!response.isSuccess()) {
response = SdmResponse.failed("获取流程模版与分析项的绑定关系失败");
}
}catch (Exception e){
log.error("获取流程模版与分析项的绑定关系异常");
response = SdmResponse.failed(("获取流程模版与分析项的绑定关系异常"));
}
return response;
}
@Override
public SdmResponse<Map<String, TaskBaseInfo>> getTaskPoolTaskMap( long poolId)
{
SdmResponse response;
try {
response = simuluationTaskPoolFeignClient.getTaskPoolTaskMap(poolId);
if (!response.isSuccess()) {
response = SdmResponse.failed("获取分析项库");
}
}catch (Exception e){
log.error("获取分析项库异常");
response = SdmResponse.failed(("获取分析项库异常"));
}
return response;
}
}

View File

@@ -13,5 +13,5 @@ import java.util.List;
@FeignClient(name = "data",contextId = "dataAnalysisFeignClient")
public interface IDataAnalysisFeignClient {
@PostMapping("/dataAnalysis/getSimulationTaskFile")
public SdmResponse<PageDataResp<List<SimulationTaskResultCurveResp>>> getSimulationTaskFile(@RequestBody GetSimulationTaskFileReq getSimulationTaskFileReq);
SdmResponse<PageDataResp<List<SimulationTaskResultCurveResp>>> getSimulationTaskFile(@RequestBody GetSimulationTaskFileReq getSimulationTaskFileReq);
}

View File

@@ -61,9 +61,16 @@ public interface IDataFeignClient {
@PostMapping("/data/downloadFileToLocal")
void downloadFileToLocal(@RequestParam(value = "fileId") @Validated Long fileId, @RequestParam(value = "path") @Validated String path);
@PostMapping("/data/downloadFolderToLocal")
SdmResponse downloadFolderToLocal(@RequestParam(value = "downloadDirId") @Validated Long downloadDirId,
@RequestParam(value = "basePath") @Validated String basePath,
@RequestParam(value = "fileRegularStr", required = false) String fileRegularStr) throws Exception;
@PostMapping("/data/batchAddFileInfo")
SdmResponse<List<BatchAddFileInfoResp>> batchAddFileInfo(@RequestBody UploadFilesReq req);
@PostMapping("/data/updatePermission")
SdmResponse updatePermission(@RequestBody UpdatePermissionReq req);
}

View File

@@ -19,6 +19,6 @@ public interface IFileSimulationMappingFeignClient {
@PostMapping("/getFileSimulationMappingBySimulationPoolIdAndVersionAndTaskId")
SdmResponse<List<FileMetadataInfoResp>> getFileSimulationMappingBySimulationPoolIdAndVersionAndTaskId(@RequestBody GetFileSimulationMappingReq getFileSimulationMappingReq);
@PostMapping("/batchGetFileSimulationMappingBySimulationPoolIdAndVersion")
@PostMapping("/fileSimulationMapping/batchGetFileSimulationMappingBySimulationPoolIdAndVersion")
SdmResponse<Map<String, List<FileMetadataInfoResp>>> batchGetFileSimulationMappingBySimulationPoolIdAndVersion(@RequestBody GetFileSimulationMappingReq getFileSimulationMappingReq);
}

View File

@@ -4,7 +4,6 @@ import com.sdm.common.common.SdmResponse;
import com.sdm.common.config.LongTimeRespFeignConfig;
import com.sdm.common.entity.req.pbs.SubmitHpcTaskRemoteReq;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
@@ -15,7 +14,7 @@ import org.springframework.web.bind.annotation.PostMapping;
public interface ITaskFeignClient {
// "作业提交"
@PostMapping(value = "/pbs/submitHpcJob", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
SdmResponse<String> submitHpcJob( SubmitHpcTaskRemoteReq req);
@PostMapping("/pbs/adapterSubmitHpcJob")
SdmResponse<String> adapterSubmitHpcJob( SubmitHpcTaskRemoteReq req);
}

View File

@@ -1,11 +1,12 @@
package com.sdm.common.feign.inter.project;
import com.sdm.common.common.SdmResponse;
import com.sdm.common.entity.req.project.SpdmReportReq;
import com.sdm.common.entity.req.system.LaunchApproveReq;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@FeignClient(name = "project",contextId = "runFeignClient")
public interface ISimulationRunFeignClient {
@@ -13,4 +14,16 @@ public interface ISimulationRunFeignClient {
@PostMapping("/run/deliverableApproveCallback")
SdmResponse deliverableApproveCallback(@RequestBody LaunchApproveReq req);
}
@GetMapping(value = "/run/getSimulationKeyResultFileIds")
SdmResponse<List<Long>> getSimulationKeyResultFileIds(@RequestParam String runId);
/**
* 内部调用生成报告
*
* @param req 报告请求参数
* @return SdmResponse<Void>
*/
@PostMapping("/run/generateReportInternal")
SdmResponse<Void> generateReportInternal(@RequestBody SpdmReportReq req);
}

View File

@@ -0,0 +1,18 @@
package com.sdm.common.feign.inter.task;
import com.sdm.common.common.SdmResponse;
import com.sdm.common.entity.resp.task.PerformanceResp;
import jakarta.validation.constraints.NotNull;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(name = "task",contextId = "taskPerformanceClient")
public interface ISimuluationPerformanceFeignClient {
@GetMapping("/taskPerformance/getRunPerformance")
SdmResponse<List<PerformanceResp>> getRunPerformance(@NotNull @RequestParam String runId);
}

View File

@@ -1,15 +1,36 @@
package com.sdm.common.feign.inter.task;
import com.sdm.common.common.SdmResponse;
import com.sdm.common.entity.pojo.task.FlowBindTaskPoolItem;
import com.sdm.common.entity.pojo.task.TaskBaseInfo;
import com.sdm.common.entity.req.system.LaunchApproveReq;
import com.sdm.common.entity.req.task.BindTaskAndFlowTemplateReq;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.*;
@FeignClient(name = "task")
import java.util.List;
import java.util.Map;
import java.util.List;
@FeignClient(name = "task",contextId = "taskPoolClient")
public interface ISimuluationTaskPoolFeignClient {
@PostMapping("/taskpool/approveHandleNotice")
SdmResponse receiveApproveNotice(@RequestBody LaunchApproveReq req);
@PostMapping(value = "/taskpool/updateTaskAndFlowTemplate")
@ResponseBody
SdmResponse updateTaskAndFlowTemplate(@RequestBody BindTaskAndFlowTemplateReq req);
@GetMapping(value = "/taskpool/getFlowTaskRelate")
SdmResponse<List<FlowBindTaskPoolItem>> getFlowTemplateBindTaskRelate(@RequestParam("flowCode")String flowCode);
@GetMapping(value = "/taskpool/getTaskPoolTaskMap")
@ResponseBody
SdmResponse<Map<String, TaskBaseInfo>> getTaskPoolTaskMap(@RequestParam("poolId") long poolId);
}

View File

@@ -62,7 +62,7 @@ public class SysLogUtils {
sysLog.setMethod(request.getMethod());
sysLog.setRemoteAddr(JakartaServletUtil.getClientIP(request));
sysLog.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
sysLog.setCreateBy(ObjectUtils.isNotEmpty(ThreadLocalContext.getUserName()) ? ThreadLocalContext.getUserName() : "anonymousUser");
sysLog.setCreateBy(String.valueOf(ThreadLocalContext.getUserId()));
try {
// 获取服务名称
sysLog.setServiceId("simulation-" + SpringUtil.getProperty("spring.application.name"));

View File

@@ -329,7 +329,8 @@ public class FilesUtil {
String inputFilesRegularStr,
AtomicReference<String> masterFilePath,
List<String> inputFilePaths) {
Objects.requireNonNull(jobWorkDir, "jobWorkDir 不能为空");
log.info("求解文件目录={}", jobWorkDir);
Objects.requireNonNull(jobWorkDir, "本地求解文件夹不能为空");
boolean hasMasterRule =
masterFileRegularStr != null && !masterFileRegularStr.isBlank();
boolean hasInputRule =

View File

@@ -172,10 +172,12 @@ public class HpcCommandExcuteUtil {
return builder.body(body);
}
public SdmResponse<Boolean> callHpcUploadToTarget(String jobId, String workDir) {
public SdmResponse<Boolean> callHpcUploadToTarget(String jobId, String workDir,String callBackMinioDir,String callBackNasDir) {
com.alibaba.fastjson2.JSONObject paramJson = new com.alibaba.fastjson2.JSONObject();
paramJson.put("jobId", jobId);
paramJson.put("jobWorkDir", workDir);
paramJson.put("callBackMinioDir", callBackMinioDir);
paramJson.put("callBackNasDir", callBackNasDir);
Boolean call = false;
String resultString = "";
try {

View File

@@ -1,16 +1,32 @@
package com.sdm.common.utils;
import com.sdm.common.entity.bo.JwtToken;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.interfaces.DecodedJWT;
import java.io.*;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.text.SimpleDateFormat;
import java.util.Base64;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@Slf4j
public class SystemOperate {
@@ -157,4 +173,90 @@ public class SystemOperate {
return sdf.format(new Date());
}
public static PrivateKey getPrivateKey(String key) throws Exception
{
PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(Base64.getDecoder().decode(key.getBytes()));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
return keyFactory.generatePrivate(spec);
}
/**
* 生成JWT
* @param jwtToken
* @param key
* @param isUnique
* @return
*/
public static String generateToken(JwtToken jwtToken, String key, boolean isUnique) {
String token = "";
try
{
PrivateKey privateKey = getPrivateKey(key);
Algorithm algorithm = Algorithm.RSA256(null, (RSAPrivateKey) privateKey);
Date issuedAt = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(issuedAt);
issuedAt = calendar.getTime();
// 未设置过期时间则默认签发时间后10分钟内有效
Date expiresAt = new Date(issuedAt.getTime() + (jwtToken.getExpirationTime() <= 0 ? 600000 : jwtToken.getExpirationTime()));
token = JWT.create()
.withKeyId(jwtToken.getKeyId()) //密钥ID
.withIssuer(jwtToken.getUserName()+":"+jwtToken.getIssuer()+":1") //用户名:用户ID:租户
.withSubject(jwtToken.getSubject()) //appName
.withExpiresAt(expiresAt)
.withIssuedAt(issuedAt)
.withJWTId(jwtToken.getJwtId()) //随机UUID
.withClaim("claimsMap", jwtToken.getClaimMap()) //保持默认值
.sign(algorithm);
}
catch (Exception ex)
{
ex.printStackTrace();
}
finally {
return token;
}
}
private static PublicKey getPublicKey(String publicKeyStr) {
byte[] keyBytes = Base64.getDecoder().decode(publicKeyStr);
X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(keyBytes);
KeyFactory keyFactory;
try {
keyFactory = KeyFactory.getInstance("RSA");
return keyFactory.generatePublic(x509EncodedKeySpec);
} catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
e.printStackTrace();
}
return null;
}
public static boolean verify( String pubKey, String token) {
// 从公钥缓存中获取对应的密钥编号的公钥
PublicKey publicKey =getPublicKey(pubKey);
try {
Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null);
DecodedJWT decodedJwt = JWT.require(algorithm).ignoreIssuedAt().build().verify(token);
Date expiresAt = decodedJwt.getExpiresAt();
// 验证token是否过期
if (expiresAt.before(new Date())) {
return false;
}
// 验证自己是否为接收方
List<String> audience = decodedJwt.getAudience();
if (audience != null && !audience.isEmpty()) {
return false;
}
} catch (Exception ex) {
ex.printStackTrace();
return false;
}
return true;
}
}