修改:知识库项目,所属项目,分析方向名称数据补充
This commit is contained in:
@@ -190,5 +190,12 @@ public class FileMetadataInfo implements Serializable {
|
||||
@TableField(value = "cidFlowReviewer", insertStrategy = FieldStrategy.NEVER,select = false,updateStrategy = FieldStrategy.NEVER)
|
||||
private String cidFlowReviewer;
|
||||
|
||||
@Schema(description= "projectName:所属项目,只有列表展示使用")
|
||||
@TableField(value = "projectName", insertStrategy = FieldStrategy.NEVER,select = false,updateStrategy = FieldStrategy.NEVER)
|
||||
private String projectName;
|
||||
|
||||
@Schema(description= "分析方向,只有列表展示使用")
|
||||
@TableField(value = "analysisDirectionName", insertStrategy = FieldStrategy.NEVER,select = false,updateStrategy = FieldStrategy.NEVER)
|
||||
private String analysisDirectionName;
|
||||
|
||||
}
|
||||
|
||||
@@ -13,19 +13,23 @@ import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
import com.sdm.common.entity.req.data.DelDirReq;
|
||||
import com.sdm.common.entity.req.data.RenameDirReq;
|
||||
import com.sdm.common.entity.req.data.UploadFilesReq;
|
||||
import com.sdm.common.entity.req.project.SpdmNodeListReq;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.entity.req.system.UserListReq;
|
||||
import com.sdm.common.entity.req.system.UserQueryReq;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import com.sdm.common.entity.resp.project.SimulationNodeResp;
|
||||
import com.sdm.common.entity.resp.system.CIDUserResp;
|
||||
import com.sdm.common.feign.impl.project.SimulationNodeFeignClientImpl;
|
||||
import com.sdm.common.feign.impl.system.SysUserFeignClientImpl;
|
||||
import com.sdm.common.feign.inter.project.ISimulationNodeFeignClient;
|
||||
import com.sdm.common.feign.inter.system.IApproveFeignClient;
|
||||
import com.sdm.common.log.CoreLogger;
|
||||
import com.sdm.common.utils.CidApproveUtil;
|
||||
import com.sdm.common.utils.CidSysUserUtil;
|
||||
import com.sdm.common.utils.PageUtils;
|
||||
import com.sdm.common.utils.ProjectUtil;
|
||||
import com.sdm.data.model.bo.ApprovalFileDataContentsModel;
|
||||
import com.sdm.data.model.entity.FileMetadataExtension;
|
||||
import com.sdm.data.model.entity.FileMetadataInfo;
|
||||
@@ -118,6 +122,9 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
@Autowired
|
||||
private IApproveFeignClient approveFeignClient;
|
||||
|
||||
@Autowired
|
||||
private ISimulationNodeFeignClient isSimulationNodeFeignClient;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return type;
|
||||
@@ -650,6 +657,8 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
.list();
|
||||
setCreatorNames(files);
|
||||
setCidInfos(files);
|
||||
setProjectName(files);
|
||||
setAnalysisDirectionName(files);
|
||||
PageDataResp<List<FileMetadataInfo>> page = new PageDataResp<>();
|
||||
page.setData(files);
|
||||
page.setTotal(pageDataResp.getTotal());
|
||||
@@ -702,6 +711,8 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
// 创建人赋值
|
||||
setCreatorNames(list);
|
||||
setCidInfos(list);
|
||||
setProjectName(list);
|
||||
setAnalysisDirectionName(list);
|
||||
PageInfo<FileMetadataInfo> page = new PageInfo<>(list);
|
||||
return PageUtils.getJsonObjectSdmResponse(list, page);
|
||||
}
|
||||
@@ -1822,10 +1833,83 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("setCreatorNames error:{}",e.getMessage());
|
||||
log.error("setCidInfos error:{}",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void setProjectName(List<FileMetadataInfo> list) {
|
||||
try {
|
||||
if (ObjectUtils.isNotEmpty(list)) {
|
||||
// 提取Id,当前不可能超过500,无需分批
|
||||
List<String> projectIds = list.stream()
|
||||
.map(FileMetadataInfo::getProjectId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.toList();
|
||||
// 查询电子流详情
|
||||
SpdmNodeListReq spdmNodeListReq = new SpdmNodeListReq();
|
||||
spdmNodeListReq.setCurrent(NumberConstants.ONE);
|
||||
spdmNodeListReq.setSize(NumberConstants.NINE_NINE_NINE_NINE);
|
||||
spdmNodeListReq.setNodeType(NodeTypeEnum.PROJECT.getValue());
|
||||
SdmResponse sdmResponse = isSimulationNodeFeignClient.list(spdmNodeListReq);
|
||||
Object data = sdmResponse.getData();
|
||||
// 批量设置
|
||||
if (sdmResponse.isSuccess() && !Objects.isNull(data)) {
|
||||
Map<String, Map<String, Object>> projectInfoMap = ProjectUtil.convertProjectInfoMap(data);
|
||||
if(MapUtils.isNotEmpty(projectInfoMap)){
|
||||
list.forEach(fileMetadataInfo -> {
|
||||
String projectId = fileMetadataInfo.getProjectId();
|
||||
Map<String, Object> project = projectInfoMap.get(projectId);
|
||||
if(!Objects.isNull(project)){
|
||||
fileMetadataInfo.setProjectName(Objects.isNull(project.get("nodeName"))?
|
||||
"":project.get("nodeName").toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("setProjectName error:{}",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void setAnalysisDirectionName(List<FileMetadataInfo> list) {
|
||||
try {
|
||||
if (ObjectUtils.isNotEmpty(list)) {
|
||||
// 提取Id,当前不可能超过1000,无需分批
|
||||
List<String> analyIds = list.stream()
|
||||
.map(FileMetadataInfo::getAnalysisDirectionId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.toList();
|
||||
// 查询电子流详情
|
||||
SdmResponse<List<SimulationNodeResp>> sdmResponse = isSimulationNodeFeignClient.querySimulationNodeByUuids(analyIds);
|
||||
List<SimulationNodeResp> datas = sdmResponse.getData();
|
||||
// 批量设置
|
||||
if (sdmResponse.isSuccess() && CollectionUtils.isNotEmpty(datas)) {
|
||||
Map<String, List<SimulationNodeResp>> simulationNodeMap = datas.stream()
|
||||
.collect(Collectors.groupingBy(SimulationNodeResp::getUuid));
|
||||
if(MapUtils.isNotEmpty(simulationNodeMap)){
|
||||
list.forEach(fileMetadataInfo -> {
|
||||
String analysisDirectionId = fileMetadataInfo.getAnalysisDirectionId();
|
||||
List<SimulationNodeResp> simulationNodeResps = simulationNodeMap.get(analysisDirectionId);
|
||||
if(CollectionUtils.isNotEmpty(simulationNodeResps)){
|
||||
fileMetadataInfo.setAnalysisDirectionName(Objects.isNull(simulationNodeResps.get(0).getNodeName())?
|
||||
"":simulationNodeResps.get(0).getNodeName());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("setAnalysisDirectionName error:{}",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 从审批详情里拼接审批人
|
||||
private String getCidFlowReviewer(List<Map<String, Object>> flowInfos) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user