feat:交付物审批&参数库审批
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user