Merge branch 'main' of http://carsafe.uicp.cn/toolchaintechnologycenter/spdm-backend
This commit is contained in:
@@ -67,4 +67,7 @@ public class GetSimulationTaskFileReq extends BaseReq {
|
||||
|
||||
@Schema(description = "排序类型:Asc/Desc")
|
||||
private String orderType;
|
||||
|
||||
@Schema(description = "所属学科名称")
|
||||
private String ownDisciplineName;
|
||||
}
|
||||
|
||||
@@ -3,10 +3,13 @@ package com.sdm.common.entity.req.project;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class GetTaskDetailReq {
|
||||
|
||||
@NotNull(message = "relatedResourceUuid不能为空")
|
||||
private String relatedResourceUuid;
|
||||
|
||||
private List<String> relatedResourceUuidList;
|
||||
}
|
||||
|
||||
@@ -14,15 +14,6 @@ public class BaseResp {
|
||||
@Schema(description = "所属学科")
|
||||
String ownDisciplineName;
|
||||
|
||||
@Schema(description = "所属学科id")
|
||||
private String ownDisciplineId;
|
||||
|
||||
@Schema(description = "所属工况任务")
|
||||
String owntaskName;
|
||||
|
||||
@Schema(description = "所属工况任务id")
|
||||
private String owntaskId;
|
||||
|
||||
@Schema(description= "文件业务类型(1:模型文件 2:仿真报告、3:计算文件、4:曲线文件、5:云图文件,6:网格文件,7:计算过程文件)")
|
||||
@TableField("fileType")
|
||||
private Integer fileType;
|
||||
|
||||
@@ -57,6 +57,20 @@ public class SimulationTaskFeignClientImpl implements ISimulationTaskFeignClient
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<Map<String, SpdmTaskVo>> batchGetTaskDetailByUuids(GetTaskDetailReq req) {
|
||||
try {
|
||||
SdmResponse<Map<String, SpdmTaskVo>> response = simulationTaskFeignClient.batchGetTaskDetailByUuids(req);
|
||||
if(!response.isSuccess() || ObjectUtils.isEmpty(response.getData())){
|
||||
return SdmResponse.failed("内部调用获取任务详情失败");
|
||||
}
|
||||
return response;
|
||||
}catch (Exception e){
|
||||
log.error("内部调用获取任务详情失败", e);
|
||||
return SdmResponse.failed("内部调用获取任务详情失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<Map<String, List<String>>> getAllTasksByDiscipline(GetAllTasksByDisciplineReq req) {
|
||||
try {
|
||||
|
||||
@@ -38,6 +38,10 @@ public interface ISimulationTaskFeignClient {
|
||||
@PostMapping("/task/getTaskDetail")
|
||||
SdmResponse<SpdmTaskVo> getTaskDetail(@RequestBody GetTaskDetailReq req);
|
||||
|
||||
@PostMapping("/task/batchGetTaskDetailByUuids")
|
||||
SdmResponse<Map<String,SpdmTaskVo>> batchGetTaskDetailByUuids(@RequestBody GetTaskDetailReq req);
|
||||
|
||||
|
||||
/**
|
||||
* 根据学科获取所有的任务
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.sdm.common.service;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.bo.DataDictionary;
|
||||
import com.sdm.common.entity.enums.FileDictTagEnum;
|
||||
import com.sdm.common.feign.impl.system.SysConfigFeignClientImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
|
||||
/**
|
||||
* @Description: 文件业务类型服务
|
||||
* @Date: 2021/12/27 16:07
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class FileBizTypeService {
|
||||
@Autowired
|
||||
private SysConfigFeignClientImpl sysConfigFeignClient;
|
||||
|
||||
/**
|
||||
* 获取文件类型字典映射(value -> name)
|
||||
* @return 映射表,key 为 dictValue=6,value 为 dictName=流程脚本
|
||||
*/
|
||||
public Map<String, String> getFileTypeMapName() {
|
||||
return getDictMap(FileDictTagEnum.FILE_TYPE.getDictClass(), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件类型字典映射(name -> value)
|
||||
* @return 映射表,key 为 dictName=流程脚本,value 为 dictValue=6
|
||||
*/
|
||||
public Map<String, String> getFileNameMapValue() {
|
||||
return getDictMap(FileDictTagEnum.FILE_TYPE.getDictClass(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用方法:根据 dictClass 获取字典映射
|
||||
* @param dictClass 字典分类
|
||||
* @param reverse 是否反转映射(true: name->value, false: value->name)
|
||||
* @return 映射表
|
||||
*/
|
||||
private Map<String, String> getDictMap(String dictClass, boolean reverse) {
|
||||
SdmResponse<List<DataDictionary>> dictList = sysConfigFeignClient.getDictionaryData(dictClass);
|
||||
if (!dictList.isSuccess() || ObjectUtils.isEmpty(dictList.getData())) {
|
||||
log.error("字典信息查询失败,dictClass: {}", dictClass);
|
||||
return emptyMap();
|
||||
}
|
||||
|
||||
if (reverse) {
|
||||
// name -> value
|
||||
return dictList.getData().stream()
|
||||
.collect(Collectors.toMap(DataDictionary::getDictName, DataDictionary::getDictValue));
|
||||
} else {
|
||||
// value -> name
|
||||
return dictList.getData().stream()
|
||||
.collect(Collectors.toMap(DataDictionary::getDictValue, DataDictionary::getDictName));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为文件类型节点
|
||||
* @param fileType 文件类型值
|
||||
* @return 是否为配置的类型
|
||||
*/
|
||||
public boolean isFileType(String fileType) {
|
||||
Map<String, String> typeMap = getFileTypeMapName();
|
||||
return typeMap.containsKey(fileType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件类型名称
|
||||
* @param fileType 文件字典表的dictValue: 1,2,3
|
||||
* @return 文件类型名称:脚本,流程,图片
|
||||
*/
|
||||
public String getFileName(String fileType) {
|
||||
Map<String, String> typeMap = getFileTypeMapName();
|
||||
return typeMap.get(fileType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件类型值
|
||||
* @param fileName 文件类型名称
|
||||
* @return 文件类型值
|
||||
*/
|
||||
public String getFileType(String fileName) {
|
||||
Map<String, String> fileNameMapValue = getFileNameMapValue();
|
||||
return fileNameMapValue.get(fileName);
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ public class TagMapService {
|
||||
log.error("字典信息查询失败");
|
||||
return emptyMap();
|
||||
}
|
||||
// project-->tag1 phase-->tag2
|
||||
// tag1 --> project tag2 --> phase
|
||||
return tagMapList.getData().stream().collect(Collectors.toMap(DataDictionary::getDictName, DataDictionary::getDictValue));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user