Merge branch 'main' of http://192.168.65.198:3000/toolchaintechnologycenter/spdm-backend
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package com.sdm.common.entity.enums;
|
||||
|
||||
public enum ApproveTypeEnum {
|
||||
|
||||
MAP_APPROVE(1, "仿真地图评审"),
|
||||
KNOWLEDGE_APPROVE(2, "仿真知识库评审"),
|
||||
FLOW_TEMPLATE_APPROVE(3, "流程模板评审"),
|
||||
DELIVERABLE_APPROVE(4, "交付物评审"),
|
||||
PARAM_APPROVE(5, "仿真参数库评审")
|
||||
;
|
||||
|
||||
private final int code;
|
||||
private final String description;
|
||||
|
||||
ApproveTypeEnum(int code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,6 +45,12 @@ public enum FileBizTypeEnum {
|
||||
@Schema(description = "计算过程文件", example = "7")
|
||||
COMPUTE_PROCESS_FILE(7),
|
||||
|
||||
/**
|
||||
* 交付物文件
|
||||
*/
|
||||
@Schema(description = "交付物文件", example = "8")
|
||||
DELIVERABLE_FILE(8),
|
||||
|
||||
/**
|
||||
* 项目文件
|
||||
*/
|
||||
|
||||
@@ -98,6 +98,16 @@ public class UploadFilesReq {
|
||||
@Schema(description = "扩展信息")
|
||||
private List<FileMetadataExtensionRequest> fileMetadataExtensionRequest;
|
||||
|
||||
public UploadFilesReq(String fileName, Long size, Integer fileType) {
|
||||
this.fileName = fileName;
|
||||
this.size = size;
|
||||
this.fileType = fileType;
|
||||
}
|
||||
|
||||
public UploadFilesReq() {
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
public class FileMetadataExtensionRequest {
|
||||
/**
|
||||
|
||||
@@ -18,8 +18,8 @@ public class LaunchApproveReq extends BaseBean {
|
||||
@Schema(description = "CID生成的流程ID",defaultValue = "")
|
||||
public String cidFlowId;
|
||||
|
||||
// 审批类型 0.http回调的,replyUrl必须传递,相当于是跨系统的,调用的时候可以不传,replyUrl必须传递 ;1:仿真地图审批(spdm内部feign) 2:知识库审批(spdm内部feign)
|
||||
@Schema(description = "审批类型 1:仿真地图审批 2:知识库审批",defaultValue = "0")
|
||||
// 审批类型 0.http回调的,replyUrl必须传递,相当于是跨系统的,调用的时候可以不传,replyUrl必须传递 ;1:仿真地图审批(spdm内部feign) 2:知识库审批(spdm内部feign) 3:交付物审批(spdm内部feign)
|
||||
@Schema(description = "审批类型 1:仿真地图审批 2:知识库审批 3:流程模板审批 4:交付物审批",defaultValue = "0")
|
||||
@Value("10")
|
||||
public int approveType;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.data.*;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.entity.resp.data.BatchAddFileInfoResp;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import com.sdm.common.feign.inter.data.IDataFeignClient;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -131,4 +132,17 @@ public class DataClientFeignClientImpl implements IDataFeignClient {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<List<BatchAddFileInfoResp>> batchAddFileInfo(UploadFilesReq req) {
|
||||
SdmResponse<List<BatchAddFileInfoResp>> response;
|
||||
try {
|
||||
response = dataClient.batchAddFileInfo(req);
|
||||
log.info("文件信息批量入库响应:"+ response);
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("文件信息批量入库响应", e);
|
||||
return SdmResponse.failed("文件信息批量入库响应");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.data.*;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.entity.resp.data.BatchAddFileInfoResp;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
@@ -48,6 +49,9 @@ public interface IDataFeignClient {
|
||||
@PostMapping("/data/downloadFileToLocal")
|
||||
void downloadFileToLocal(@RequestParam(value = "fileId") @Validated Long fileId, @RequestParam(value = "path") @Validated String path);
|
||||
|
||||
@PostMapping("/data/batchAddFileInfo")
|
||||
SdmResponse<List<BatchAddFileInfoResp>> batchAddFileInfo(@RequestBody UploadFilesReq req);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -49,8 +49,13 @@ public class DataFileController implements IDataFeignClient {
|
||||
return IDataFileService.createDir(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 因为审批的都是文件 所以这个审批回调方法可以公用
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/approveDataFile")
|
||||
@Operation(summary = "知识库文件审批状态修改", description = "知识库文件审批状态修改")
|
||||
@Operation(summary = "知识库文件审批状态修改", description = "知识库文件、交付物文件、参数库文件审批状态修改")
|
||||
public SdmResponse approveDataFile(@RequestBody @Validated LaunchApproveReq req) {
|
||||
return IDataFileService.approveDataFile(req);
|
||||
}
|
||||
@@ -405,10 +410,10 @@ public class DataFileController implements IDataFeignClient {
|
||||
return IDataFileService.batchAddFileInfo(req);
|
||||
}
|
||||
|
||||
@PostMapping("/callBackknowledgeFile")
|
||||
@PostMapping("/chunkUploadCallback")
|
||||
@Operation(summary = "文件分片上传成功后前端回调")
|
||||
public SdmResponse callBackknowledgeFile(@RequestBody KnowledgeCallBackReq req) {
|
||||
return IDataFileService.callBackknowledgeFile(req);
|
||||
public SdmResponse chunkUploadCallback(@RequestBody KnowledgeCallBackReq req) {
|
||||
return IDataFileService.chunkUploadCallback(req);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@ package com.sdm.data.controller;
|
||||
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.data.model.req.SimulationParamLibraryReq;
|
||||
import com.sdm.data.model.req.SimulationParameterLibraryCategoryObjectReq;
|
||||
import com.sdm.data.model.resp.SimulationParameterLibraryCategoryObjectResp;
|
||||
import com.sdm.data.service.ISimulationParameterLibraryService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -69,15 +71,12 @@ public class SimulationParameterLibraryController {
|
||||
/**
|
||||
* 删除仿真参数库数据(参数库、参数分类、参数推向)
|
||||
*
|
||||
* @param type 1:仿真参数库 2:仿真参数库分类 3:仿真参数库分类参数对象
|
||||
* @param id 仿真参数库id/仿真参数库分类id/仿真参数库分类参数对象id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/deleteSimulationParameter")
|
||||
@PostMapping("/deleteSimulationParameter")
|
||||
@Operation(summary = "删除仿真参数库数据", description = "删除仿真参数库数据")
|
||||
SdmResponse deleteSimulationParameter(@Parameter(description = "1:仿真参数库 2:仿真参数库分类 3:仿真参数库分类参数对象") @RequestParam(value = "type") Integer type
|
||||
, @Parameter(description = "仿真参数库id/仿真参数库分类id/仿真参数库分类参数对象id") @RequestParam(value = "id") Long id) {
|
||||
return simulationParameterLibraryService.deleteSimulationParameter(type, id);
|
||||
SdmResponse deleteSimulationParameter(@RequestBody SimulationParamLibraryReq req) {
|
||||
return simulationParameterLibraryService.deleteSimulationParameter(req);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.sdm.data.model.bo;
|
||||
|
||||
import com.sdm.data.model.entity.FileMetadataInfo;
|
||||
import com.sdm.data.model.resp.SimulationParameterLibraryCategoryObjectResp;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/* 参数库文件增加审批流程,传递给电子流平台内容变化的数据 */
|
||||
@Data
|
||||
public class ApprovalParamContentsModel {
|
||||
|
||||
private List<Long> ids; //新增知识库,待审批的原始数据的id集合
|
||||
|
||||
private String contents;//变更的描述
|
||||
|
||||
private int approveAction;// approveAction-- 1:新增 2:修改 3:删除
|
||||
/**
|
||||
* 上传文件的基本信息
|
||||
*/
|
||||
private FileMetadataInfo fileInfo;
|
||||
/**
|
||||
* 上传的参数库json文件数据
|
||||
*/
|
||||
private SimulationParameterLibraryCategoryObjectResp paramData;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.sdm.data.model.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SimulationParamLibraryReq {
|
||||
/**
|
||||
* SimulationParameterDataTypeEnum
|
||||
*/
|
||||
@Schema(description = "仿真参数库类型")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "主键id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "参数库文件审批模板id")
|
||||
private String templateId;
|
||||
|
||||
@Schema(description = "参数库文件审批模板名称")
|
||||
private String templateName;
|
||||
|
||||
}
|
||||
@@ -34,4 +34,11 @@ public class SimulationParameterLibraryCategoryObjectReq {
|
||||
|
||||
@Schema(description = "文件传输对象")
|
||||
private MultipartFile file;
|
||||
|
||||
@Schema(description = "审批模板id")
|
||||
private String templateId;
|
||||
|
||||
@Schema(description = "审批模板名称")
|
||||
private String templateName;
|
||||
|
||||
}
|
||||
@@ -45,6 +45,8 @@ public class SimulationParameterLibraryCategoryObjectResp {
|
||||
|
||||
private String fileName;
|
||||
|
||||
private Integer approveType;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
@@ -316,7 +316,7 @@ public interface IDataFileService {
|
||||
|
||||
SdmResponse<List<BatchAddFileInfoResp>> batchAddFileInfo(UploadFilesReq req);
|
||||
|
||||
SdmResponse callBackknowledgeFile(KnowledgeCallBackReq req);
|
||||
SdmResponse chunkUploadCallback(KnowledgeCallBackReq req);
|
||||
|
||||
/**
|
||||
* 下载文件到本地临时目录
|
||||
|
||||
@@ -3,7 +3,9 @@ package com.sdm.data.service;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.data.model.entity.SimulationParameterLibrary;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sdm.data.model.req.SimulationParamLibraryReq;
|
||||
import com.sdm.data.model.req.SimulationParameterLibraryCategoryObjectReq;
|
||||
import com.sdm.data.model.resp.SimulationParameterLibraryCategoryObjectResp;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -33,13 +35,11 @@ public interface ISimulationParameterLibraryService extends IService<SimulationP
|
||||
|
||||
/**
|
||||
* 删除仿真参数库数据(参数库、参数分类、参数推向)
|
||||
* @param type 1:仿真参数库 2:仿真参数库分类 3:仿真参数库分类参数对象
|
||||
* @param id 仿真参数库id/仿真参数库分类id/仿真参数库分类参数对象id
|
||||
* @return
|
||||
*/
|
||||
SdmResponse deleteSimulationParameter(Integer type,Long id);
|
||||
SdmResponse deleteSimulationParameter(SimulationParamLibraryReq req);
|
||||
|
||||
// 获取仿真参数库分类参数对象
|
||||
SdmResponse getSimulationParameterLibraryCategoryObject(Long ObjectId);
|
||||
SdmResponse<SimulationParameterLibraryCategoryObjectResp> getSimulationParameterLibraryCategoryObject(Long ObjectId);
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.github.pagehelper.util.StringUtil;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.entity.ExportExcelFormat;
|
||||
@@ -127,6 +128,9 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
@Autowired
|
||||
IFileStorageService fileStorageService;
|
||||
|
||||
@Autowired
|
||||
ISimulationParameterLibraryCategoryObjectService paramObjectService;
|
||||
|
||||
@Autowired
|
||||
private ApproveStrategyFactory approveStrategyFactory;
|
||||
|
||||
@@ -172,6 +176,8 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
public SdmResponse approveDataFile(LaunchApproveReq req) {
|
||||
// 审批状态
|
||||
int approveStatus = req.approveStatus;
|
||||
// 审批类型
|
||||
int approveType = req.approveType;
|
||||
// 前置校验
|
||||
validateApproveRequest(req);
|
||||
// id获取
|
||||
@@ -189,16 +195,18 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
ApproveContext context = new ApproveContext(
|
||||
approveMetadataInfos,
|
||||
approveStatus,
|
||||
approveType,
|
||||
minioService,
|
||||
fileMetadataInfoService,
|
||||
fileMetadataExtensionService,
|
||||
fileUserPermissionService,
|
||||
fileStorageService
|
||||
fileStorageService,
|
||||
paramObjectService
|
||||
);
|
||||
|
||||
// 获取并执行审批结果
|
||||
Integer approveType = approveMetadataInfos.get(0).getApproveType();
|
||||
ApproveStrategy strategy = approveStrategyFactory.getStrategy(approveType);
|
||||
Integer fileApproveType = approveMetadataInfos.get(0).getApproveType();
|
||||
ApproveStrategy strategy = approveStrategyFactory.getStrategy(fileApproveType);
|
||||
boolean result = strategy.handle(context);
|
||||
|
||||
return result ? SdmResponse.success("仿真知识库审批状态修改成功") :
|
||||
@@ -317,7 +325,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
|
||||
String fileMinioObjectKey = getFileMinioObjectKey(dirMetadataInfo.getObjectKey() + modifiedFileName);
|
||||
// 检查此文件夹下是否有历史同名文件 提示
|
||||
// if (CollectionUtils.isNotEmpty(fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getObjectKey, fileMinioObjectKey).list())) {
|
||||
// if (StringUtil.isNotEmpty(minioService.getMinioPresignedUrl(fileMinioObjectKey))) {
|
||||
// return SdmResponse.failed("该文件夹下存在同名文件:" + fileReq.getFileName() + ",请确认是否覆盖");
|
||||
// }
|
||||
|
||||
@@ -327,15 +335,16 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
}
|
||||
try {
|
||||
// 创建目录元数据并保存到数据库
|
||||
FileMetadataInfo fileInfo = createFileMetadata(fileMinioObjectKey, fileReq.getFileName(), req.getFileType(),
|
||||
FileMetadataInfo fileInfo = createFileMetadata(fileMinioObjectKey, fileReq.getFileName(), fileReq.getFileType(),
|
||||
req.getProjectId(), req.getAnalysisDirectionId(), req.getRemarks(), dirMetadataInfo.getId(), fileReq.getSize());
|
||||
fileInfo.setUploadTaskId(req.getUploadTaskId());
|
||||
fileInfo.setTemplateId(req.getTemplateId());
|
||||
fileInfo.setTemplateName(req.getTemplateName());
|
||||
// 只有知识库的文件需要审核
|
||||
// 1 知识库文件夹
|
||||
// 知识库和交付物的文件需要审核
|
||||
// 1 知识库文件夹 2 交付物属于项目文件夹
|
||||
boolean isknowledge = Objects.equals(DirTypeEnum.KNOWLEDGE_BASE_DIR.getValue(), dirMetadataInfo.getDirType());
|
||||
if (isknowledge) {
|
||||
boolean isDeliverable = Objects.equals(DirTypeEnum.PROJECT_NODE_DIR.getValue(), dirMetadataInfo.getDirType());
|
||||
if (isknowledge || isDeliverable) {
|
||||
fileInfo.setApprovalStatus(ApprovalFileDataStatusEnum.PENDING.getKey());
|
||||
fileInfo.setApproveType(ApproveFileDataTypeEnum.UPLOAD_REVIEWING.getCode());
|
||||
}
|
||||
@@ -366,22 +375,6 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
// 调用审批流,开启审批; 上面先入库拿到主键id,审批流创建失败后再回退数据
|
||||
// String templateId, String templateName,String approveContents,int approveAction:1:新增 2:修改 3:删除
|
||||
// if(isknowledge){
|
||||
// String approveContents = getApproveContents(fileInfo.getId(), "知识库文件新增", NumberConstants.ONE, fileInfo, null);
|
||||
// Pair<Boolean,String> approvePair = launchFileDataApprove(req.getTemplateId(), req.getTemplateName(), approveContents, NumberConstants.ONE);
|
||||
// if(!approvePair.getLeft()|| org.apache.commons.lang3.StringUtils.isBlank(approvePair.getRight())) {
|
||||
// log.error("uploadFiles create approveInit failed, params :{}", JSONObject.toJSONString(req));
|
||||
// // - 回退MinIO中已上传的文件(删除该文件)。catch 里统一操作了
|
||||
// //- 新增 file_metadata_info 信息不入表。
|
||||
// //- 向前端返回“上传文件失败”。
|
||||
// throw new RuntimeException("文件上传,创建审批流失败,cidFlowId:"+approvePair.getRight());
|
||||
// }
|
||||
// // cid流程id
|
||||
// fileInfo.setCidFlowId(approvePair.getRight());
|
||||
// }
|
||||
|
||||
// 创建文件扩展信息并保存到数据库
|
||||
List<FileMetadataExtension> fileMetadataExtensionList = new ArrayList<>();
|
||||
List<UploadFilesReq.FileMetadataExtensionRequest> fileMetadataExtensionRequestList = req.getFileMetadataExtensionRequest();
|
||||
@@ -417,7 +410,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse callBackknowledgeFile(KnowledgeCallBackReq req) {
|
||||
public SdmResponse chunkUploadCallback(KnowledgeCallBackReq req) {
|
||||
// 处理成功上传的数据
|
||||
handleSuccessFiles(req.getSuccBusinessIds());
|
||||
// 处理失败上传的数据(回滚)
|
||||
@@ -430,8 +423,10 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
* @param req 审批回调请求对象
|
||||
*/
|
||||
private void validateApproveRequest(LaunchApproveReq req) {
|
||||
// 校验审批类型(排除知识库审批)
|
||||
if (!Objects.equals(NumberConstants.TWO, req.approveType)) {
|
||||
// 校验审批类型(排除知识库审批、交付物审批、参数库审批)
|
||||
if (!Arrays.asList(ApproveTypeEnum.KNOWLEDGE_APPROVE.getCode(),
|
||||
ApproveTypeEnum.DELIVERABLE_APPROVE.getCode(),
|
||||
ApproveTypeEnum.PARAM_APPROVE.getCode()).contains(req.approveType)) {
|
||||
String errorMsg = "仿真知识库审批回调修改失败,审批类型非法";
|
||||
log.error("{},param:{}", errorMsg, JSONObject.toJSONString(req));
|
||||
throw new RuntimeException(errorMsg);
|
||||
@@ -815,7 +810,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
// 发送审批电子流,成功继续西面操作,失败直接返回
|
||||
// String templateId, String templateName,String approveContents,int approveAction:1:新增 2:修改 3:删除
|
||||
String approveContents = getApproveContents(List.of(delFileId), "知识库文件删除", NumberConstants.THREE, List.of(deleteFileMetadataInfo), null);
|
||||
Pair<Boolean, String> approvePair = launchFileDataApprove(req.getTemplateId(), req.getTemplateName(), approveContents, NumberConstants.THREE);
|
||||
Pair<Boolean, String> approvePair = launchFileDataApprove(req.getTemplateId(), req.getTemplateName(), approveContents, NumberConstants.THREE, ApproveTypeEnum.KNOWLEDGE_APPROVE);
|
||||
if(!approvePair.getLeft()|| org.apache.commons.lang3.StringUtils.isBlank(approvePair.getRight())) {
|
||||
log.error("delFile approveInit failed, params :{}", JSONObject.toJSONString(req));
|
||||
throw new RuntimeException("文件删除,创建审批流失败,cidFlowId:"+approvePair.getRight());
|
||||
@@ -1293,7 +1288,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
// String templateId, String templateName,String approveContents,int approveAction:1:新增 2:修改 3:删除
|
||||
if(isknowledge){
|
||||
String approveContents = getApproveContents(List.of(fileInfo.getId()), "知识库文件新增", NumberConstants.ONE, List.of(fileInfo), null);
|
||||
Pair<Boolean,String> approvePair = launchFileDataApprove(req.getTemplateId(), req.getTemplateName(), approveContents, NumberConstants.ONE);
|
||||
Pair<Boolean,String> approvePair = launchFileDataApprove(req.getTemplateId(), req.getTemplateName(), approveContents, NumberConstants.ONE, ApproveTypeEnum.KNOWLEDGE_APPROVE);
|
||||
if(!approvePair.getLeft()|| org.apache.commons.lang3.StringUtils.isBlank(approvePair.getRight())) {
|
||||
log.error("uploadFiles create approveInit failed, params :{}", JSONObject.toJSONString(req));
|
||||
// - 回退MinIO中已上传的文件(删除该文件)。catch 里统一操作了
|
||||
@@ -1440,7 +1435,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
// 本次待审核的数据
|
||||
fileMetadataInfo.setTempMetadata(JSONObject.toJSONString(tempFileMetadataInfo));
|
||||
// String templateId, String templateName,String approveContents,int approveAction:1:新增 2:修改 3:删除
|
||||
Pair<Boolean, String> approvePair = launchFileDataApprove(req.getTemplateId(), req.getTemplateName(), approveContents, NumberConstants.TWO);
|
||||
Pair<Boolean, String> approvePair = launchFileDataApprove(req.getTemplateId(), req.getTemplateName(), approveContents, NumberConstants.TWO, ApproveTypeEnum.KNOWLEDGE_APPROVE);
|
||||
if(!approvePair.getLeft()||org.apache.commons.lang3.StringUtils.isBlank(approvePair.getRight())){
|
||||
log.error("updateFile meteData approveInit failed, params :{}", JSONObject.toJSONString(req));
|
||||
// 失败数据还未入表
|
||||
@@ -1506,7 +1501,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
// 获取前后变化的file信息
|
||||
String approveContents = getApproveContents(List.of(fileInfo.getId()), "知识库文件修改",
|
||||
NumberConstants.TWO,List.of(fileMetadataInfo) , List.of(fileInfo));
|
||||
Pair<Boolean, String> approvePair = launchFileDataApprove(req.getTemplateId(), req.getTemplateName(), approveContents, NumberConstants.TWO);
|
||||
Pair<Boolean, String> approvePair = launchFileDataApprove(req.getTemplateId(), req.getTemplateName(), approveContents, NumberConstants.TWO, ApproveTypeEnum.KNOWLEDGE_APPROVE);
|
||||
if(!approvePair.getLeft()||org.apache.commons.lang3.StringUtils.isBlank(approvePair.getRight())){
|
||||
log.error("uploadAndUpdateFile updateFile approveInit failed, params :{}", JSONObject.toJSONString(req));
|
||||
// 失败数据回退删除--事务回滚
|
||||
@@ -1659,6 +1654,9 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
// 创建目录元数据并保存到数据库
|
||||
FileMetadataInfo fileInfo = createFileMetadata(simulationParamMinioObjectKey, newFilename, null,
|
||||
null, null, null, parSimulationParamDirId, paramFile.getSize());
|
||||
// 设置文件状态为审批中 暂不可见
|
||||
fileInfo.setApprovalStatus(ApprovalFileDataStatusEnum.PENDING.getKey());
|
||||
fileInfo.setApproveType(ApproveFileDataTypeEnum.UPLOAD_REVIEWING.getCode());
|
||||
fileMetadataInfoService.save(fileInfo);
|
||||
return SdmResponse.success(fileInfo.getId());
|
||||
} catch (Exception e) {
|
||||
@@ -1912,7 +1910,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
}
|
||||
|
||||
// 发起仿真知识库文件审核 true 成功 false失败
|
||||
private Pair<Boolean,String> launchFileDataApprove(String templateId, String templateName, String approveContents, int approveAction)
|
||||
private Pair<Boolean,String> launchFileDataApprove(String templateId, String templateName, String approveContents, int approveAction, ApproveTypeEnum approveTypeEnum)
|
||||
{
|
||||
boolean result = false;
|
||||
String cidFlowId="";
|
||||
@@ -1928,10 +1926,10 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
req.approveContents = approveContents;
|
||||
// 评审动作 1:新增 2:修改 3:删除
|
||||
req.approveAction = approveAction;
|
||||
// 审批类型 1:仿真地图审批 2:知识库审批
|
||||
req.approveType = 2;
|
||||
// 审批类型 1:仿真地图审批 2:知识库审批 3:流程模板审批 4:交付物审批
|
||||
req.approveType = approveTypeEnum.getCode();
|
||||
// 审批主题
|
||||
req.approveTitle = "仿真知识库评审";
|
||||
req.approveTitle = approveTypeEnum.getDescription();
|
||||
// 租户ID
|
||||
req.tenantId = ThreadLocalContext.getTenantId();
|
||||
// req.tenantId = 1979091834410176514l;
|
||||
@@ -2215,7 +2213,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理成功上传的文件:更新状态、发起审批(知识库场景)
|
||||
* 处理成功上传的文件:更新状态、发起审批(知识库场景&交付物场景)
|
||||
* @param succBusinessIds 成功的文件ID列表
|
||||
*/
|
||||
private Boolean handleSuccessFiles(List<Long> succBusinessIds) {
|
||||
@@ -2230,7 +2228,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
CoreLogger.warn("handleSuccessFiles succFileMetadataInfos null");
|
||||
return true;
|
||||
}
|
||||
// 2. 知识库文件特殊处理:发起审批流
|
||||
// 2. 知识库文件特殊处理:发起审批流 & 交付物文件(属于项目文件夹)审批
|
||||
String cidFlowId = "";
|
||||
FileMetadataInfo firstFile = succFileMetadataInfos.get(0);
|
||||
Long parentId = firstFile.getParentId();
|
||||
@@ -2241,16 +2239,26 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
boolean isKnowledge = dirMetadataInfo != null &&
|
||||
Objects.equals(DirTypeEnum.KNOWLEDGE_BASE_DIR.getValue(), dirMetadataInfo.getDirType());
|
||||
|
||||
if (isKnowledge) {
|
||||
boolean isDeliverable = dirMetadataInfo != null &&
|
||||
Objects.equals(DirTypeEnum.PROJECT_NODE_DIR.getValue(), dirMetadataInfo.getDirType());
|
||||
|
||||
if (isKnowledge || isDeliverable) {
|
||||
// 构建审批内容
|
||||
String approveContents = getApproveContents(
|
||||
succBusinessIds,"知识库文件批量新增", NumberConstants.ONE,succFileMetadataInfos,null );
|
||||
String approveContents = "";
|
||||
if (isKnowledge) {
|
||||
approveContents = getApproveContents(
|
||||
succBusinessIds,"知识库文件批量新增", NumberConstants.ONE,succFileMetadataInfos,null );
|
||||
} else {
|
||||
approveContents = getApproveContents(
|
||||
succBusinessIds,"交付物文件批量新增", NumberConstants.ONE,succFileMetadataInfos,null );
|
||||
}
|
||||
// 发起审批
|
||||
Pair<Boolean, String> approvePair = launchFileDataApprove(
|
||||
firstFile.getTemplateId(),
|
||||
firstFile.getTemplateName(),
|
||||
approveContents,
|
||||
NumberConstants.ONE
|
||||
NumberConstants.ONE,
|
||||
isKnowledge ? ApproveTypeEnum.KNOWLEDGE_APPROVE : ApproveTypeEnum.DELIVERABLE_APPROVE
|
||||
);
|
||||
// 审批创建失败:抛出异常
|
||||
if (!approvePair.getLeft() || org.apache.commons.lang3.StringUtils.isBlank(approvePair.getRight())) {
|
||||
@@ -2263,8 +2271,8 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
// 3. 批量更新文件状态(上传完成)
|
||||
FileMetadataInfo updateEntity = new FileMetadataInfo();
|
||||
updateEntity.setUploadStatus(NumberConstants.ONE_STR);
|
||||
// 知识库文件:关联审批流ID
|
||||
if (isKnowledge && org.apache.commons.lang3.StringUtils.isNotBlank(cidFlowId)) {
|
||||
// 知识库文件 & 交付物文件:关联审批流ID
|
||||
if ((isKnowledge || isDeliverable) && org.apache.commons.lang3.StringUtils.isNotBlank(cidFlowId)) {
|
||||
updateEntity.setCidFlowId(cidFlowId);
|
||||
}
|
||||
// 执行更新
|
||||
|
||||
@@ -6,21 +6,29 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.entity.enums.ApprovalFileDataStatusEnum;
|
||||
import com.sdm.common.entity.enums.ApproveFileDataTypeEnum;
|
||||
import com.sdm.common.entity.enums.ApproveTypeEnum;
|
||||
import com.sdm.common.entity.enums.SimulationParameterDataTypeEnum;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.feign.impl.system.ApproveFeignClientImpl;
|
||||
import com.sdm.data.dao.SimulationParameterLibraryMapper;
|
||||
import com.sdm.data.model.bo.ApprovalParamContentsModel;
|
||||
import com.sdm.data.model.entity.FileMetadataInfo;
|
||||
import com.sdm.data.model.entity.SimulationParameterLibrary;
|
||||
import com.sdm.data.model.entity.SimulationParameterLibraryCategory;
|
||||
import com.sdm.data.model.entity.SimulationParameterLibraryCategoryObject;
|
||||
import com.sdm.data.model.req.SimulationParamLibraryReq;
|
||||
import com.sdm.data.model.req.SimulationParameterLibraryCategoryObjectReq;
|
||||
import com.sdm.data.model.resp.SimulationParameterLibraryCategoryObjectResp;
|
||||
import com.sdm.data.service.IDataFileService;
|
||||
import com.sdm.data.service.ISimulationParameterLibraryCategoryObjectService;
|
||||
import com.sdm.data.service.ISimulationParameterLibraryCategoryService;
|
||||
import com.sdm.data.service.ISimulationParameterLibraryService;
|
||||
import com.sdm.data.service.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -49,6 +57,12 @@ public class SimulationParameterLibraryServiceImpl extends ServiceImpl<Simulatio
|
||||
@Autowired
|
||||
ISimulationParameterLibraryCategoryObjectService simulationParameterLibraryCategoryObjectService;
|
||||
|
||||
@Autowired
|
||||
private IFileMetadataInfoService fileMetadataInfoService;
|
||||
|
||||
@Autowired
|
||||
private ApproveFeignClientImpl approveFeignClient;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public SdmResponse addLibrary(String parameterLibraryName) {
|
||||
@@ -70,15 +84,32 @@ public class SimulationParameterLibraryServiceImpl extends ServiceImpl<Simulatio
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public SdmResponse addLibraryCategoryObject(SimulationParameterLibraryCategoryObjectReq simulationParameterLibraryCategoryObjectReq) {
|
||||
public SdmResponse addLibraryCategoryObject(SimulationParameterLibraryCategoryObjectReq req) {
|
||||
try {
|
||||
SdmResponse<Long> integerSdmResponse = dataFileService.uploadSimulationParamFile(simulationParameterLibraryCategoryObjectReq.getFile());
|
||||
SdmResponse<Long> integerSdmResponse = dataFileService.uploadSimulationParamFile(req.getFile());
|
||||
Long fileId = integerSdmResponse.getData();
|
||||
|
||||
SimulationParameterLibraryCategoryObject simulationParameterLibraryCategoryObject = new SimulationParameterLibraryCategoryObject();
|
||||
BeanUtils.copyProperties(simulationParameterLibraryCategoryObjectReq, simulationParameterLibraryCategoryObject);
|
||||
BeanUtils.copyProperties(req, simulationParameterLibraryCategoryObject);
|
||||
simulationParameterLibraryCategoryObject.setFileId(fileId);
|
||||
simulationParameterLibraryCategoryObjectService.save(simulationParameterLibraryCategoryObject);
|
||||
|
||||
FileMetadataInfo fileMetadataInfo = fileMetadataInfoService.getById(fileId);
|
||||
// 参数库上传json文件内容
|
||||
SimulationParameterLibraryCategoryObjectResp objectResp = getSimulationParameterLibraryCategoryObjectInner(simulationParameterLibraryCategoryObject.getId());
|
||||
ApprovalParamContentsModel contentsModel = new ApprovalParamContentsModel();
|
||||
contentsModel.setIds(Arrays.asList(fileId));
|
||||
contentsModel.setApproveAction(1);
|
||||
contentsModel.setContents("参数库文件新增");
|
||||
contentsModel.setFileInfo(fileMetadataInfo);
|
||||
contentsModel.setParamData(objectResp);
|
||||
// 发起审批
|
||||
String cidFlowId = launchParamApprove(req.getTemplateId(),req.getTemplateName(), JSONObject.toJSONString(contentsModel),1);
|
||||
if (StringUtils.isEmpty(cidFlowId)) {
|
||||
return SdmResponse.failed("发起评审失败");
|
||||
}
|
||||
fileMetadataInfo.setCidFlowId(cidFlowId);
|
||||
fileMetadataInfoService.updateById(fileMetadataInfo);
|
||||
} catch (Exception e) {
|
||||
log.error("仿真参数库文件上传失败", e);
|
||||
return SdmResponse.failed("仿真参数库文件上传失败");
|
||||
@@ -86,6 +117,29 @@ public class SimulationParameterLibraryServiceImpl extends ServiceImpl<Simulatio
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
private String launchParamApprove(String templateId, String templateName,String approveContents,int approveAction) {
|
||||
LaunchApproveReq req = new LaunchApproveReq();
|
||||
req.templateId = templateId;
|
||||
req.templateName = templateName;
|
||||
req.approveContents = approveContents;
|
||||
req.approveAction = approveAction;
|
||||
req.approveStatus = 1;
|
||||
req.approveType = ApproveTypeEnum.PARAM_APPROVE.getCode();
|
||||
req.approveTitle = "仿真参数库评审";
|
||||
req.tenantId = ThreadLocalContext.getTenantId();
|
||||
req.userId = ThreadLocalContext.getUserId();
|
||||
req.creator = ThreadLocalContext.getUserId();
|
||||
SdmResponse response = approveFeignClient.launchApproval(req);
|
||||
if(response.isSuccess()){
|
||||
// 成功
|
||||
String cidFlowId = Optional.ofNullable(response.getData())
|
||||
.map(Object::toString)
|
||||
.orElse("");
|
||||
return cidFlowId;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getSimulationParameterTree(Integer type, Long id) {
|
||||
List<JSONObject> jsonObjects = new ArrayList<>();
|
||||
@@ -147,24 +201,55 @@ public class SimulationParameterLibraryServiceImpl extends ServiceImpl<Simulatio
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse deleteSimulationParameter(Integer type, Long id) {
|
||||
public SdmResponse deleteSimulationParameter(SimulationParamLibraryReq req) {
|
||||
// 根据参数类型和参数id删除参数
|
||||
if (type == SimulationParameterDataTypeEnum.OBJECT.getValue()) {
|
||||
simulationParameterLibraryCategoryObjectService.removeById(id);
|
||||
} else if (type == SimulationParameterDataTypeEnum.CATEGORY.getValue()) {
|
||||
simulationParameterLibraryCategoryService.removeById(id);
|
||||
simulationParameterLibraryCategoryObjectService.lambdaUpdate().eq(SimulationParameterLibraryCategoryObject::getParameterLibraryCategoryId, id).remove();
|
||||
} else if (type == SimulationParameterDataTypeEnum.LIBRARY.getValue()) {
|
||||
this.removeById(id);
|
||||
simulationParameterLibraryCategoryService.lambdaUpdate().eq(SimulationParameterLibraryCategory::getParameterLibraryId, id).remove();
|
||||
simulationParameterLibraryCategoryObjectService.lambdaUpdate().eq(SimulationParameterLibraryCategoryObject::getParameterLibraryId, id).remove();
|
||||
if (req.getType() == SimulationParameterDataTypeEnum.OBJECT.getValue()) {
|
||||
// 发起审批 审批通过后才能删除
|
||||
SimulationParameterLibraryCategoryObject object = simulationParameterLibraryCategoryObjectService.getById(req.getId());
|
||||
FileMetadataInfo deleteFileMetadataInfo = fileMetadataInfoService.getById(object.getFileId());
|
||||
// 参数库上传json文件内容
|
||||
SimulationParameterLibraryCategoryObjectResp objectResp = getSimulationParameterLibraryCategoryObjectInner(req.getId());
|
||||
ApprovalParamContentsModel contentsModel = new ApprovalParamContentsModel();
|
||||
contentsModel.setIds(Arrays.asList(deleteFileMetadataInfo.getId()));
|
||||
contentsModel.setApproveAction(3);
|
||||
contentsModel.setContents("参数库文件删除");
|
||||
contentsModel.setFileInfo(deleteFileMetadataInfo);
|
||||
contentsModel.setParamData(objectResp);
|
||||
// 发起审批
|
||||
String cidFlowId = launchParamApprove(req.getTemplateId(),req.getTemplateName(), JSONObject.toJSONString(contentsModel),3);
|
||||
if (StringUtils.isEmpty(cidFlowId)) {
|
||||
return SdmResponse.failed("发起评审失败");
|
||||
}
|
||||
deleteFileMetadataInfo.setCidFlowId(cidFlowId);
|
||||
deleteFileMetadataInfo.setApprovalStatus(ApprovalFileDataStatusEnum.PENDING.getKey());
|
||||
deleteFileMetadataInfo.setApproveType(ApproveFileDataTypeEnum.DELETE_REVIEWING.getCode());
|
||||
fileMetadataInfoService.updateById(deleteFileMetadataInfo);
|
||||
|
||||
// simulationParameterLibraryCategoryObjectService.removeById(id);
|
||||
|
||||
} else if (req.getType() == SimulationParameterDataTypeEnum.CATEGORY.getValue()) {
|
||||
simulationParameterLibraryCategoryService.removeById(req.getId());
|
||||
simulationParameterLibraryCategoryObjectService.lambdaUpdate().eq(SimulationParameterLibraryCategoryObject::getParameterLibraryCategoryId, req.getId()).remove();
|
||||
} else if (req.getType() == SimulationParameterDataTypeEnum.LIBRARY.getValue()) {
|
||||
this.removeById(req.getId());
|
||||
simulationParameterLibraryCategoryService.lambdaUpdate().eq(SimulationParameterLibraryCategory::getParameterLibraryId, req.getId()).remove();
|
||||
simulationParameterLibraryCategoryObjectService.lambdaUpdate().eq(SimulationParameterLibraryCategoryObject::getParameterLibraryId, req.getId()).remove();
|
||||
}
|
||||
|
||||
return SdmResponse.success("删除成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getSimulationParameterLibraryCategoryObject(Long ObjectId) {
|
||||
public SdmResponse<SimulationParameterLibraryCategoryObjectResp> getSimulationParameterLibraryCategoryObject(Long ObjectId) {
|
||||
SimulationParameterLibraryCategoryObjectResp resp = getSimulationParameterLibraryCategoryObjectInner(ObjectId);
|
||||
if (ApproveFileDataTypeEnum.UPLOAD_REVIEWING.getCode() != resp.getApproveType()) {
|
||||
return SdmResponse.success(resp);
|
||||
} else {
|
||||
return SdmResponse.success(null);
|
||||
}
|
||||
}
|
||||
|
||||
private SimulationParameterLibraryCategoryObjectResp getSimulationParameterLibraryCategoryObjectInner(Long ObjectId) {
|
||||
SimulationParameterLibraryCategoryObject simulationParameterLibraryCategoryObject = simulationParameterLibraryCategoryObjectService.getById(ObjectId);
|
||||
SimulationParameterLibraryCategoryObjectResp simulationParameterLibraryCategoryObjectResp = new SimulationParameterLibraryCategoryObjectResp();
|
||||
|
||||
@@ -195,12 +280,13 @@ public class SimulationParameterLibraryServiceImpl extends ServiceImpl<Simulatio
|
||||
simulationParameterLibraryCategoryObjectResp.setParameterLibraryCategoryId(simulationParameterLibraryCategory.getId());
|
||||
simulationParameterLibraryCategoryObjectResp.setParameterLibraryCategoryName(simulationParameterLibraryCategory.getParameterLibraryCategoryName());
|
||||
|
||||
FileMetadataInfo fileMetadataInfo = fileMetadataInfoService.getById(simulationParameterLibraryCategoryObject.getFileId());
|
||||
simulationParameterLibraryCategoryObjectResp.setApproveType(fileMetadataInfo.getApproveType());
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("解析JSON文件时发生错误", e);
|
||||
}
|
||||
return SdmResponse
|
||||
.success(simulationParameterLibraryCategoryObjectResp);
|
||||
return simulationParameterLibraryCategoryObjectResp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1297,7 +1297,7 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
|
||||
// 未实现,勿使用
|
||||
@Override
|
||||
public SdmResponse callBackknowledgeFile(KnowledgeCallBackReq req) {
|
||||
public SdmResponse chunkUploadCallback(KnowledgeCallBackReq req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,11 @@ import java.util.List;
|
||||
public class ApproveContext {
|
||||
private List<FileMetadataInfo> approveMetadataInfos;
|
||||
private int approveStatus;
|
||||
private int approveType;
|
||||
private IMinioService minioService;
|
||||
private IFileMetadataInfoService fileMetadataInfoService;
|
||||
private IFileMetadataExtensionService fileMetadataExtensionService;
|
||||
private IFileUserPermissionService fileUserPermissionService;
|
||||
private IFileStorageService fileStorageService;
|
||||
private ISimulationParameterLibraryCategoryObjectService paramObjectService;
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package com.sdm.data.service.impl.dataFileHandle;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.sdm.common.entity.constants.NumberConstants;
|
||||
import com.sdm.common.entity.enums.ApproveFileDataTypeEnum;
|
||||
import com.sdm.data.model.entity.FileMetadataExtension;
|
||||
import com.sdm.data.model.entity.FileMetadataInfo;
|
||||
import com.sdm.data.model.entity.FileStorage;
|
||||
import com.sdm.data.model.entity.FileUserPermission;
|
||||
import com.sdm.common.entity.enums.ApproveTypeEnum;
|
||||
import com.sdm.data.model.entity.*;
|
||||
import com.sdm.data.service.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -21,11 +19,13 @@ public class DeleteApproveStrategy implements ApproveStrategy {
|
||||
// FileMetadataInfo metadata = context.getApproveMetadataInfo();
|
||||
FileMetadataInfo metadata = context.getApproveMetadataInfos().get(0);
|
||||
int status = context.getApproveStatus();
|
||||
int type = context.getApproveType();
|
||||
IFileMetadataInfoService service = context.getFileMetadataInfoService();
|
||||
IMinioService minioService = context.getMinioService();
|
||||
IFileMetadataExtensionService fileMetadataExtensionService = context.getFileMetadataExtensionService();
|
||||
IFileUserPermissionService fileUserPermissionService = context.getFileUserPermissionService();
|
||||
IFileStorageService fileStorageService = context.getFileStorageService();
|
||||
ISimulationParameterLibraryCategoryObjectService paramObjectService = context.getParamObjectService();
|
||||
|
||||
// 审批通过
|
||||
if (NumberConstants.TWO == status) {
|
||||
@@ -36,7 +36,10 @@ public class DeleteApproveStrategy implements ApproveStrategy {
|
||||
fileStorageService.remove(new LambdaQueryWrapper<FileStorage>().eq(FileStorage::getFileId, metadata.getId()));
|
||||
fileMetadataExtensionService.remove(new LambdaQueryWrapper<FileMetadataExtension>().eq(FileMetadataExtension::getTFilemetaId, metadata.getId()));
|
||||
fileUserPermissionService.remove(new LambdaQueryWrapper<FileUserPermission>().eq(FileUserPermission::getTFilemetaId, metadata.getId()));
|
||||
|
||||
// 如果是参数库审批 删除参数库对象
|
||||
if (ApproveTypeEnum.PARAM_APPROVE.getCode() == type) {
|
||||
paramObjectService.remove(new LambdaQueryWrapper<SimulationParameterLibraryCategoryObject>().eq(SimulationParameterLibraryCategoryObject::getFileId, metadata.getId()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,14 +2,17 @@ package com.sdm.project.controller;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
import com.sdm.common.entity.req.data.KnowledgeCallBackReq;
|
||||
import com.sdm.common.entity.req.data.QueryDirReq;
|
||||
import com.sdm.common.entity.req.data.UploadFilesReq;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.entity.resp.data.BatchAddFileInfoResp;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import com.sdm.project.model.entity.SimulationRun;
|
||||
import com.sdm.project.model.entity.SimulationRunKeyResult;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.model.resp.KeyResultAndTaskInfoResp;
|
||||
import com.sdm.project.model.resp.RunVersionInfoResp;
|
||||
import com.sdm.project.service.ISimulationRunService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -124,6 +127,16 @@ public class SimulationRunController {
|
||||
return runService.addSimulationKeyResult(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传交付物-第一步 文件信息和关键结果信息批量入库
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/batchAddSimulationKeyResult")
|
||||
public SdmResponse<List<BatchAddFileInfoResp>> batchAddSimulationKeyResult(@RequestBody KeyResultReq req) {
|
||||
return runService.batchAddSimulationKeyResult(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 算例关键结果查询
|
||||
*
|
||||
@@ -134,6 +147,16 @@ public class SimulationRunController {
|
||||
return runService.listSimulationKeyResult(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据交付物文件id查询相关属性和任务信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/queryKeyResultAndTaskInfo")
|
||||
public SdmResponse<KeyResultAndTaskInfoResp> queryKeyResultAndTaskInfo(@RequestBody KeyResultReq req) {
|
||||
return runService.queryKeyResultAndTaskInfo(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除算例关键结果
|
||||
*
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.sdm.project.model.req;
|
||||
|
||||
import com.sdm.common.entity.BaseReq;
|
||||
import com.sdm.common.entity.enums.FileBizTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class KeyResultReq extends BaseReq {
|
||||
|
||||
@@ -59,9 +62,34 @@ public class KeyResultReq extends BaseReq {
|
||||
@Schema(description = "文件名")
|
||||
private String fileName;
|
||||
|
||||
@Schema(description = "文件类型")
|
||||
@Schema(description = "文件大小")
|
||||
private Long fileSize;
|
||||
|
||||
@Schema(description = "文件类型",implementation = FileBizTypeEnum.class)
|
||||
private Integer fileType;
|
||||
|
||||
@Schema(description = "文件")
|
||||
private MultipartFile file;
|
||||
|
||||
/**
|
||||
* -------------------------------------------------上传交付物使用参数------------------------------------------------
|
||||
*/
|
||||
@Schema(description = "上传交付物使用,批量文件属性信息")
|
||||
private List<KeyResultReq> keyResultList;
|
||||
|
||||
@Schema(description = "用户勾选的所有的文件的原始名称,前端限制不能选择相同名称的文件,后端逻辑判断对应dirId下不能和历史文件名相同")
|
||||
private List<KeyResultReq> sourceFiles;
|
||||
|
||||
@Schema(description = "审批模板id")
|
||||
private String templateId;
|
||||
|
||||
@Schema(description = "审批模板名称")
|
||||
private String templateName;
|
||||
|
||||
@Schema(description = "本次新增数据的任务id,毫秒值时间戳")
|
||||
private String uploadTaskId;
|
||||
|
||||
@Schema(description = "所属任务uuid")
|
||||
private String taskId;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.sdm.project.model.resp;
|
||||
|
||||
import com.sdm.project.model.entity.SimulationTask;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class KeyResultAndTaskInfoResp {
|
||||
|
||||
@Schema(description = "算例uuid")
|
||||
private String runId;
|
||||
|
||||
@Schema(description = "关键性能结果类型 1-图片/动画 2-曲线 3-报告 4-数值")
|
||||
private Integer keyResultType;
|
||||
|
||||
@Schema(description = "结果名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "文件id")
|
||||
private Long fileId;
|
||||
|
||||
@Schema(description = "物理量")
|
||||
private String quantityType;
|
||||
|
||||
@Schema(description = "结果单位")
|
||||
private String units;
|
||||
|
||||
@Schema(description = "最大数值")
|
||||
private String max;
|
||||
|
||||
@Schema(description = "最小数值")
|
||||
private String min;
|
||||
|
||||
@Schema(description = "数值")
|
||||
private String value;
|
||||
|
||||
@Schema(description = "描述信息")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "x轴物理量(曲线结果使用)")
|
||||
private String xQuantityType;
|
||||
|
||||
@Schema(description = "x轴结果单位(曲线结果使用)")
|
||||
private String xUnits;
|
||||
|
||||
@Schema(description = "y轴物理量(曲线结果使用)")
|
||||
private String yQuantityType;
|
||||
|
||||
@Schema(description = "y轴结果单位(曲线结果使用)")
|
||||
private String yUnits;
|
||||
|
||||
@Schema(description = "任务信息")
|
||||
private SimulationTask simulationTask;
|
||||
|
||||
}
|
||||
@@ -2,15 +2,17 @@ package com.sdm.project.service;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
import com.sdm.common.entity.req.data.KnowledgeCallBackReq;
|
||||
import com.sdm.common.entity.req.data.QueryDirReq;
|
||||
import com.sdm.common.entity.req.data.UploadFilesReq;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.entity.resp.data.BatchAddFileInfoResp;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import com.sdm.project.model.entity.SimulationRun;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sdm.project.model.entity.SimulationRunKeyResult;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.model.resp.KeyResultAndTaskInfoResp;
|
||||
import com.sdm.project.model.resp.RunVersionInfoResp;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -46,8 +48,12 @@ public interface ISimulationRunService extends IService<SimulationRun> {
|
||||
|
||||
SdmResponse addSimulationKeyResult(KeyResultReq req);
|
||||
|
||||
SdmResponse<List<BatchAddFileInfoResp>> batchAddSimulationKeyResult(KeyResultReq req);
|
||||
|
||||
SdmResponse<PageDataResp<List<SimulationRunKeyResult>>> listSimulationKeyResult(KeyResultReq req);
|
||||
|
||||
SdmResponse<KeyResultAndTaskInfoResp> queryKeyResultAndTaskInfo(KeyResultReq req);
|
||||
|
||||
SdmResponse deleteSimulationKeyResult(KeyResultReq req);
|
||||
|
||||
void generateReport(SpdmReportReq req, HttpServletResponse response);
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.sdm.common.entity.enums.NodeTypeEnum;
|
||||
import com.sdm.common.entity.req.data.*;
|
||||
import com.sdm.common.entity.req.system.UserQueryReq;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.entity.resp.data.BatchAddFileInfoResp;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import com.sdm.common.entity.resp.system.CIDUserResp;
|
||||
import com.sdm.common.feign.impl.system.SysUserFeignClientImpl;
|
||||
@@ -31,6 +32,7 @@ import com.sdm.project.model.po.ProjectNodePo;
|
||||
import com.sdm.project.model.po.RunNodePo;
|
||||
import com.sdm.project.model.po.TaskNodePo;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.model.resp.KeyResultAndTaskInfoResp;
|
||||
import com.sdm.project.model.resp.RunVersionInfoResp;
|
||||
import com.sdm.project.service.ISimulationPerformanceService;
|
||||
import com.sdm.project.service.ISimulationRunService;
|
||||
@@ -682,6 +684,42 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public SdmResponse<List<BatchAddFileInfoResp>> batchAddSimulationKeyResult(KeyResultReq req) {
|
||||
if (CollectionUtils.isNotEmpty(req.getKeyResultList())) {
|
||||
UploadFilesReq filesReq = new UploadFilesReq();
|
||||
BeanUtils.copyProperties(req, filesReq);
|
||||
filesReq.setUuid(req.getTaskId());
|
||||
filesReq.setSourceFiles(req.getKeyResultList().stream().map(i -> new UploadFilesReq(i.getFileName(), i.getFileSize(), i.getFileType())).toList());
|
||||
// 批量存储文件信息,返回数据供第二步分片上传使用
|
||||
SdmResponse<List<BatchAddFileInfoResp>> sdmResponse = dataFeignClient.batchAddFileInfo(filesReq);
|
||||
if (sdmResponse.isSuccess() && CollectionUtils.isNotEmpty(sdmResponse.getData())) {
|
||||
List<BatchAddFileInfoResp> batchAddFileInfoResps = sdmResponse.getData();
|
||||
|
||||
List<SimulationRunKeyResult> simulationRunKeyResultList = new ArrayList<>();
|
||||
for (KeyResultReq keyResultReq : req.getKeyResultList()) {
|
||||
SimulationRunKeyResult simulationRunKeyResult = new SimulationRunKeyResult();
|
||||
BeanUtils.copyProperties(keyResultReq, simulationRunKeyResult);
|
||||
simulationRunKeyResult.setUuid(RandomUtil.generateString(32));
|
||||
// 上传交付物不挂在算例下面 不属于关键结果 但是又有文件属性 所以还用这张表 但是不记得RunId
|
||||
// simulationRunKeyResult.setRunId(req.getRunId());
|
||||
simulationRunKeyResult.setCreator(ThreadLocalContext.getUserId());
|
||||
simulationRunKeyResult.setUpdater(ThreadLocalContext.getUserId());
|
||||
batchAddFileInfoResps.stream().filter(i -> StringUtils.equals(i.getSourceFileName(), keyResultReq.getFileName())).findFirst().ifPresent(i -> {
|
||||
simulationRunKeyResult.setFileId(i.getBusinessId());
|
||||
});
|
||||
simulationRunKeyResultList.add(simulationRunKeyResult);
|
||||
}
|
||||
// 批量存储文件属性
|
||||
simulationKeyResultService.saveBatch(simulationRunKeyResultList);
|
||||
return sdmResponse;
|
||||
}
|
||||
return sdmResponse;
|
||||
}
|
||||
return SdmResponse.success(new ArrayList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<PageDataResp<List<SimulationRunKeyResult>>> listSimulationKeyResult(KeyResultReq req) {
|
||||
PageHelper.startPage(req.getCurrent(), req.getSize());
|
||||
@@ -691,6 +729,20 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
return PageUtils.getJsonObjectSdmResponse(runKeyResults, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<KeyResultAndTaskInfoResp> queryKeyResultAndTaskInfo(KeyResultReq req) {
|
||||
KeyResultAndTaskInfoResp keyResultAndTaskInfoResp = new KeyResultAndTaskInfoResp();
|
||||
SimulationRunKeyResult simulationRunKeyResult = simulationKeyResultService.lambdaQuery().eq(SimulationRunKeyResult::getFileId, req.getFileId()).one();
|
||||
if (simulationRunKeyResult != null) {
|
||||
BeanUtils.copyProperties(simulationRunKeyResult, keyResultAndTaskInfoResp);
|
||||
SimulationRun simulationRun = this.lambdaQuery().eq(SimulationRun::getUuid, simulationRunKeyResult.getRunId()).one();
|
||||
if (simulationRun != null) {
|
||||
keyResultAndTaskInfoResp.setSimulationTask(simulationTaskService.lambdaQuery().eq(SimulationTask::getUuid, simulationRun.getTaskId()).one());
|
||||
}
|
||||
}
|
||||
return SdmResponse.success(keyResultAndTaskInfoResp);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public SdmResponse deleteSimulationKeyResult(KeyResultReq req) {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.sdm.system.service.impl.approvalNotice;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.enums.ApproveTypeEnum;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.feign.inter.data.IDataFeignClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class SimulationParamStrategy extends ApproveAbstractNoticeStrategy {
|
||||
|
||||
@Autowired
|
||||
private IDataFeignClient dataFeignClient;
|
||||
// 这个回调场景值和 LaunchApproveReq 类里的 approveType 对应
|
||||
// 审批类型 0.http回调的,replyUrl必须传递,相当于是跨系统的,调用的时候可以不传,replyUrl必须传递 ;1:仿真地图审批(spdm内部feign) 2:知识库审批(spdm内部feign) 4:交付物审批(spdm内部feign)
|
||||
@Override
|
||||
protected int getNoticeType() {
|
||||
return ApproveTypeEnum.PARAM_APPROVE.getCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse noticeResult(LaunchApproveReq req) {
|
||||
return dataFeignClient.approveDataFile(req);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.sdm.system.service.impl.approvalNotice;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.enums.ApproveTypeEnum;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.feign.inter.data.IDataFeignClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class TaskDeliverableStrategy extends ApproveAbstractNoticeStrategy {
|
||||
|
||||
@Autowired
|
||||
private IDataFeignClient dataFeignClient;
|
||||
// 这个回调场景值和 LaunchApproveReq 类里的 approveType 对应
|
||||
// 审批类型 0.http回调的,replyUrl必须传递,相当于是跨系统的,调用的时候可以不传,replyUrl必须传递 ;1:仿真地图审批(spdm内部feign) 2:知识库审批(spdm内部feign) 4:交付物审批(spdm内部feign)
|
||||
@Override
|
||||
protected int getNoticeType() {
|
||||
return ApproveTypeEnum.DELIVERABLE_APPROVE.getCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse noticeResult(LaunchApproveReq req) {
|
||||
return dataFeignClient.approveDataFile(req);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user