Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -51,6 +51,12 @@ public enum FileBizTypeEnum {
|
||||
@Schema(description = "交付物文件", example = "8")
|
||||
DELIVERABLE_FILE(8),
|
||||
|
||||
/**
|
||||
* 交付物文件
|
||||
*/
|
||||
@Schema(description = "试验结果文件", example = "9")
|
||||
EXPERIMENT_FILE(9),
|
||||
|
||||
/**
|
||||
* 项目文件
|
||||
*/
|
||||
|
||||
@@ -11,10 +11,7 @@ import com.sdm.common.entity.resp.data.BatchAddFileInfoResp;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import com.sdm.common.feign.inter.project.ISimulationRunFeignClient;
|
||||
import com.sdm.common.log.annotation.SysLog;
|
||||
import com.sdm.project.model.entity.SimulationBaseQuantities;
|
||||
import com.sdm.project.model.entity.SimulationBaseUnits;
|
||||
import com.sdm.project.model.entity.SimulationRun;
|
||||
import com.sdm.project.model.entity.SimulationRunKeyResult;
|
||||
import com.sdm.project.model.entity.*;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.model.resp.FlowInfoDto;
|
||||
import com.sdm.project.model.resp.KeyResultAndTaskInfoResp;
|
||||
@@ -291,4 +288,40 @@ public class SimulationRunController implements ISimulationRunFeignClient {
|
||||
return runService.listUnits(quantityType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 试验结果上传
|
||||
* @return
|
||||
*/
|
||||
@SysLog("试验结果上传")
|
||||
@PostMapping(value = "/batchAddExperimentResult")
|
||||
public SdmResponse batchAddExperimentResult(@RequestBody ExperimentResultReq req) {
|
||||
return runService.batchAddExperimentResult(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 试验结果查询
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/listExperimentResult")
|
||||
public SdmResponse<PageDataResp<List<SimulationExperimentResult>>> listExperimentResult(@RequestBody ExperimentResultReq req) {
|
||||
return runService.listExperimentResult(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除试验结果
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/deleteExperimentResult")
|
||||
public SdmResponse deleteExperimentResult(@RequestBody ExperimentResultReq req) {
|
||||
return runService.deleteExperimentResult(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑试验结果
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/editExperimentResult")
|
||||
public SdmResponse editExperimentResult(@RequestBody ExperimentResultReq req) {
|
||||
return runService.editExperimentResult(req);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.sdm.project.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sdm.project.model.entity.SimulationExperimentResult;
|
||||
import com.sdm.project.model.entity.SimulationRunKeyResult;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SimulationExpResultMapper extends BaseMapper<SimulationExperimentResult> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.sdm.project.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("simulation_experiment_result")
|
||||
@ApiModel(value="simulationExperimentResult对象", description="任务-试验结果实体")
|
||||
public class SimulationExperimentResult implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "主键ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
@TableField("uuid")
|
||||
@ApiModelProperty(value = "关键结果唯一ID", required = true)
|
||||
private String uuid;
|
||||
|
||||
@TableField("taskId")
|
||||
@ApiModelProperty(value = "所属任务 UUID", required = true)
|
||||
private String taskId;
|
||||
|
||||
@TableField("expName")
|
||||
@ApiModelProperty(value = "试验名称")
|
||||
private String expName;
|
||||
|
||||
@TableField("expData")
|
||||
@ApiModelProperty(value = "试验数据")
|
||||
private String expData;
|
||||
|
||||
@TableField("expDesc")
|
||||
@ApiModelProperty(value = "试验描述")
|
||||
private String expDesc;
|
||||
|
||||
@TableField("imageId")
|
||||
@ApiModelProperty(value = "关联试验图片id")
|
||||
private Long imageId;
|
||||
|
||||
@TableField("fileId")
|
||||
@ApiModelProperty(value = "关联试验文件id")
|
||||
private String fileId;
|
||||
|
||||
@TableField("creator")
|
||||
@ApiModelProperty(value = "创建人ID")
|
||||
private Long creator;
|
||||
|
||||
@TableField("createTime")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField("updater")
|
||||
@ApiModelProperty(value = "更新人ID")
|
||||
private Long updater;
|
||||
|
||||
@TableField("updateTime")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Schema(description= "创建者名称,列表展示使用")
|
||||
@TableField(value = "creatorName", insertStrategy = FieldStrategy.NEVER,select = false,updateStrategy = FieldStrategy.NEVER)
|
||||
private String creatorName;
|
||||
|
||||
@Schema(description= "更新者名称,列表展示使用")
|
||||
@TableField(value = "updaterName", insertStrategy = FieldStrategy.NEVER,select = false,updateStrategy = FieldStrategy.NEVER)
|
||||
private String updaterName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.sdm.project.model.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.sdm.common.entity.BaseReq;
|
||||
import com.sdm.common.entity.enums.FileBizTypeEnum;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
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;
|
||||
|
||||
|
||||
@Data
|
||||
public class ExperimentResultReq extends BaseReq {
|
||||
private Long id;
|
||||
|
||||
private String uuid;
|
||||
|
||||
@Schema(description = "所属任务 UUID", required = true)
|
||||
private String taskId;
|
||||
|
||||
@Schema(description = "试验名称")
|
||||
private String expName;
|
||||
|
||||
@Schema(description = "试验数据")
|
||||
private String expData;
|
||||
|
||||
@Schema(description = "试验描述")
|
||||
private String expDesc;
|
||||
|
||||
@Schema(description = "关联试验截图文件id")
|
||||
private Long imageId;
|
||||
|
||||
@Schema(description = "关联试验附件文件id")
|
||||
private String fileId;
|
||||
|
||||
@Schema(description = "上传文件所在父目录id")
|
||||
private Long dirId;
|
||||
|
||||
@Schema(description = "文件名")
|
||||
private String fileName;
|
||||
|
||||
@Schema(description = "文件大小")
|
||||
private Long fileSize;
|
||||
|
||||
@Schema(description = "文件类型",implementation = FileBizTypeEnum.class)
|
||||
private Integer fileType;
|
||||
|
||||
@Schema(description = "文件")
|
||||
private MultipartFile file;
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
@Schema(description = "上传试验截图文件属性信息")
|
||||
private ExperimentResultReq imageFileInfo;
|
||||
|
||||
@Schema(description = "上传试验附件批量文件属性信息")
|
||||
private List<ExperimentResultReq> fileInfoList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 调用data服务使用
|
||||
*/
|
||||
@Schema(description = "用户勾选的所有的文件的原始名称,前端限制不能选择相同名称的文件,后端逻辑判断对应dirId下不能和历史文件名相同")
|
||||
private List<ExperimentResultReq> sourceFiles;
|
||||
|
||||
@Schema(description = "本次新增数据的任务id,毫秒值时间戳")
|
||||
private String uploadTaskId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.sdm.project.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sdm.project.model.entity.SimulationExperimentResult;
|
||||
|
||||
public interface ISimulationExpResultService extends IService<SimulationExperimentResult> {
|
||||
|
||||
}
|
||||
@@ -9,11 +9,8 @@ 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.project.model.entity.SimulationBaseQuantities;
|
||||
import com.sdm.project.model.entity.SimulationBaseUnits;
|
||||
import com.sdm.project.model.entity.SimulationRun;
|
||||
import com.sdm.project.model.entity.*;
|
||||
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.resp.FlowInfoDto;
|
||||
import com.sdm.project.model.resp.KeyResultAndTaskInfoResp;
|
||||
@@ -88,4 +85,12 @@ public interface ISimulationRunService extends IService<SimulationRun> {
|
||||
|
||||
SdmResponse<List<SimulationBaseUnits>> listUnits(String quantityType);
|
||||
|
||||
SdmResponse batchAddExperimentResult(ExperimentResultReq req);
|
||||
|
||||
SdmResponse<PageDataResp<List<SimulationExperimentResult>>> listExperimentResult(ExperimentResultReq req);
|
||||
|
||||
SdmResponse deleteExperimentResult(ExperimentResultReq req);
|
||||
|
||||
SdmResponse editExperimentResult(ExperimentResultReq req);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.sdm.project.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sdm.project.dao.SimulationExpResultMapper;
|
||||
import com.sdm.project.model.entity.SimulationExperimentResult;
|
||||
import com.sdm.project.service.ISimulationExpResultService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class SimulationExpResultServiceImpl extends ServiceImpl<SimulationExpResultMapper, SimulationExperimentResult> implements ISimulationExpResultService {
|
||||
|
||||
}
|
||||
@@ -108,6 +108,9 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
@Autowired
|
||||
private ISimulationKeyResultService simulationKeyResultService;
|
||||
|
||||
@Autowired
|
||||
private ISimulationExpResultService simulationExpResultService;
|
||||
|
||||
@Autowired
|
||||
SysUserFeignClientImpl sysUserFeignClient;
|
||||
|
||||
@@ -1488,6 +1491,78 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public SdmResponse batchAddExperimentResult(ExperimentResultReq req) {
|
||||
SimulationExperimentResult experimentResult = new SimulationExperimentResult();
|
||||
BeanUtils.copyProperties(req, experimentResult);
|
||||
experimentResult.setUuid(RandomUtil.generateString(32));
|
||||
experimentResult.setCreator(ThreadLocalContext.getUserId());
|
||||
experimentResult.setUpdater(ThreadLocalContext.getUserId());
|
||||
|
||||
if (ObjectUtils.isNotEmpty(req.getImageFileInfo())) {
|
||||
req.getFileInfoList().add(req.getImageFileInfo());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(req.getFileInfoList())) {
|
||||
UploadFilesReq filesReq = new UploadFilesReq();
|
||||
BeanUtils.copyProperties(req, filesReq);
|
||||
filesReq.setUuid(req.getTaskId());
|
||||
filesReq.setSourceFiles(req.getFileInfoList().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();
|
||||
if (ObjectUtils.isNotEmpty(req.getImageFileInfo())) {
|
||||
batchAddFileInfoResps.stream().filter(i -> StringUtils.equals(i.getSourceFileName(), req.getImageFileInfo().getFileName())).findFirst().ifPresent(i -> {
|
||||
experimentResult.setImageId(i.getBusinessId());
|
||||
});
|
||||
}
|
||||
String fileIds = batchAddFileInfoResps.stream().filter(i -> !Objects.equals(i.getBusinessId(), experimentResult.getImageId())).map(i -> String.valueOf(i.getBusinessId())).collect(Collectors.joining(","));
|
||||
experimentResult.setFileId(fileIds);
|
||||
simulationExpResultService.save(experimentResult);
|
||||
}
|
||||
return sdmResponse;
|
||||
}
|
||||
return SdmResponse.success(experimentResult.getUuid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<PageDataResp<List<SimulationExperimentResult>>> listExperimentResult(ExperimentResultReq req) {
|
||||
PageHelper.startPage(req.getCurrent(), req.getSize());
|
||||
List<SimulationExperimentResult> experimentResults = simulationExpResultService.list();
|
||||
PageInfo<SimulationExperimentResult> page = new PageInfo<>(experimentResults);
|
||||
return PageUtils.getJsonObjectSdmResponse(experimentResults, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public SdmResponse deleteExperimentResult(ExperimentResultReq req) {
|
||||
simulationExpResultService.removeById(req.getId());
|
||||
// 删除文件
|
||||
if (ObjectUtils.isNotEmpty(req.getImageId())) {
|
||||
req.getFileInfoList().add(req.getImageFileInfo());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(req.getFileInfoList())) {
|
||||
for (ExperimentResultReq resultReq : req.getFileInfoList()) {
|
||||
DelFileReq delFileReq = new DelFileReq();
|
||||
delFileReq.setDelFileId(resultReq.getImageId());
|
||||
SdmResponse response = dataFeignClient.delFile(delFileReq);
|
||||
if (!response.isSuccess()) {
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public SdmResponse editExperimentResult(ExperimentResultReq req) {
|
||||
deleteExperimentResult(req);
|
||||
batchAddExperimentResult(req);
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
public static void deleteFolder(File folder) {
|
||||
if (folder.isDirectory()) {
|
||||
File[] files = folder.listFiles();
|
||||
|
||||
@@ -179,4 +179,5 @@ security:
|
||||
- /systemApprove/approveStatusNotice
|
||||
- /user/getUserToken
|
||||
- /systemMsg/sendMessage
|
||||
- /systemLog/saveLog
|
||||
- /tenant/list
|
||||
@@ -173,12 +173,18 @@ cid:
|
||||
log:
|
||||
saveLog: /spdm-log/saveLog
|
||||
|
||||
thirdparty:
|
||||
api:
|
||||
# 即时通消息通知
|
||||
freeLinkUrl: http://freelink.haihui.com/wechat/InformApi/FreelinkAndDingdingInform
|
||||
|
||||
security:
|
||||
whitelist:
|
||||
paths:
|
||||
- /systemApprove/approveStatusNotice
|
||||
- /user/getUserToken
|
||||
- /systemMsg/sendMessage
|
||||
- /systemLog/saveLog
|
||||
- /tenant/list
|
||||
|
||||
# 0单机处理,可以指向本地,1负载均衡轮询
|
||||
|
||||
@@ -179,4 +179,5 @@ security:
|
||||
- /systemApprove/approveStatusNotice
|
||||
- /user/getUserToken
|
||||
- /systemMsg/sendMessage
|
||||
- /systemLog/saveLog
|
||||
- /tenant/list
|
||||
Reference in New Issue
Block a user