Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -6,6 +6,7 @@ package com.sdm.common.entity.enums;
|
||||
public enum MessageTemplateEnum {
|
||||
|
||||
TASK_ISSUE("任务通知", "收到一条下发的新任务:%s,请前去[任务管理-我执行的]进行处理"),
|
||||
DATA_ALERT("数据通知", "您的数据存储空间已达阈值,可前往[系统管理-数据存储-存储设置]查看"),
|
||||
HPC_START("作业通知", "作业已发起"),
|
||||
HPC_END("作业通知", "作业已结束")
|
||||
;
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.sdm.common.entity.resp.task;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class PerformanceResp {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String uuid;
|
||||
|
||||
private String nodeId;
|
||||
|
||||
private String taskId;
|
||||
|
||||
@ApiModelProperty(value = "算列runId")
|
||||
private String runId;
|
||||
|
||||
private String performanceName;
|
||||
|
||||
private String nodeName;
|
||||
|
||||
private String englishName;
|
||||
|
||||
private String nodeCode;
|
||||
|
||||
private String poolName;
|
||||
|
||||
private String performanceType;
|
||||
|
||||
private String unit;
|
||||
|
||||
private String targetValue;
|
||||
|
||||
private String lowValue;
|
||||
|
||||
private String highValue;
|
||||
|
||||
private String method;
|
||||
|
||||
@ApiModelProperty(value = "指标完成情况 未完成 不合格 风险可控 未分析 合格")
|
||||
private String completeStatus;
|
||||
|
||||
@ApiModelProperty(value = "计算及结果值")
|
||||
private String resultValue;
|
||||
|
||||
private String description;
|
||||
|
||||
private String taskName;
|
||||
|
||||
private String standard;
|
||||
|
||||
private String tenantId;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private Long creator;
|
||||
|
||||
private Integer pid;
|
||||
|
||||
}
|
||||
@@ -27,4 +27,16 @@ public class SimulationRunFeignClientImpl implements ISimulationRunFeignClient {
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<List<Long>> getSimulationKeyResultFileIds(String runId) {
|
||||
SdmResponse response;
|
||||
try {
|
||||
response = simulationRunFeignClient.getSimulationKeyResultFileIds(runId);
|
||||
} catch (Exception e) {
|
||||
log.error("查询算例关键结果文件失败", e);
|
||||
return SdmResponse.failed("查询算例关键结果文件失败");
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.sdm.common.feign.impl.task;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.resp.task.PerformanceResp;
|
||||
import com.sdm.common.feign.inter.task.ISimuluationPerformanceFeignClient;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SimuluationPerformanceFeignClientImpl implements ISimuluationPerformanceFeignClient {
|
||||
|
||||
@Autowired
|
||||
private ISimuluationPerformanceFeignClient simuluationPerformanceFeignClient;
|
||||
|
||||
@Override
|
||||
public SdmResponse<List<PerformanceResp>> getRunPerformance(String runId) {
|
||||
SdmResponse response;
|
||||
try {
|
||||
response = simuluationPerformanceFeignClient.getRunPerformance(runId);
|
||||
if (!response.isSuccess()) {
|
||||
return SdmResponse.failed("查询算例指标失败");
|
||||
}
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("查询算例指标异常", e);
|
||||
return SdmResponse.failed("查询算例指标异常");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,12 @@ package com.sdm.common.feign.inter.project;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@FeignClient(name = "project",contextId = "runFeignClient")
|
||||
@@ -13,4 +17,7 @@ public interface ISimulationRunFeignClient {
|
||||
@PostMapping("/run/deliverableApproveCallback")
|
||||
SdmResponse deliverableApproveCallback(@RequestBody LaunchApproveReq req);
|
||||
|
||||
@GetMapping(value = "/run/getSimulationKeyResultFileIds")
|
||||
SdmResponse<List<Long>> getSimulationKeyResultFileIds(@RequestParam String runId);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.sdm.common.feign.inter.task;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.resp.task.PerformanceResp;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = "task",contextId = "taskPerformanceClient")
|
||||
public interface ISimuluationPerformanceFeignClient {
|
||||
|
||||
@GetMapping("/taskPerformance/getRunPerformance")
|
||||
SdmResponse<List<PerformanceResp>> getRunPerformance(@NotNull @RequestParam String runId);
|
||||
|
||||
}
|
||||
@@ -6,7 +6,9 @@ import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@FeignClient(name = "task")
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = "task",contextId = "taskPoolClient")
|
||||
public interface ISimuluationTaskPoolFeignClient {
|
||||
|
||||
@PostMapping("/taskpool/approveHandleNotice")
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.sdm.data.job;
|
||||
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.entity.enums.MessageTemplateEnum;
|
||||
import com.sdm.common.entity.req.system.SendMsgReq;
|
||||
import com.sdm.common.feign.impl.system.MessageFeignClientImpl;
|
||||
import com.sdm.data.model.entity.FileStorageQuota;
|
||||
import com.sdm.data.service.DataStorageAnalysis;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class DataStorageMonitorJob {
|
||||
|
||||
private final DataStorageAnalysis dataStorageAnalysis;
|
||||
private final MessageFeignClientImpl messageFeignClient;
|
||||
|
||||
/**
|
||||
* 定时筛选存储空间达到阈值的用户 发送告警消息
|
||||
*/
|
||||
@Scheduled(cron = "${data.storage-monitor.cron:0 */1 * * * ?}")
|
||||
public void checkDataStorageSpaceAndSendAlert() {
|
||||
log.info("开始执行定时筛选存储空间达到阈值的用户任务");
|
||||
try {
|
||||
SdmResponse<List<FileStorageQuota>> sdmResponse = dataStorageAnalysis.listAllUserQuotaForJob();
|
||||
if (CollectionUtils.isNotEmpty(sdmResponse.getData())) {
|
||||
List<FileStorageQuota> fileStorageQuotaList = sdmResponse.getData();
|
||||
fileStorageQuotaList.forEach(quota -> {
|
||||
SendMsgReq req = new SendMsgReq();
|
||||
req.setTitle(MessageTemplateEnum.DATA_ALERT.getTitle());
|
||||
req.setContent(MessageTemplateEnum.DATA_ALERT.getContent());
|
||||
req.setTenantId(String.valueOf(quota.getTenantId()));
|
||||
req.setUserId(String.valueOf(quota.getUserId()));
|
||||
log.info("[DataStorageMonitorJob] checkDataStorageSpaceAndSendAlert param:{}", JSON.toJSONString(req));
|
||||
messageFeignClient.sendMessage(req);
|
||||
});
|
||||
}
|
||||
log.info("定时筛选存储空间达到阈值的用户任务执行完成");
|
||||
} catch (Exception e) {
|
||||
log.error("定时筛选存储空间达到阈值的用户任务执行失败", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.sdm.data.service;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.data.model.entity.FileStorage;
|
||||
import com.sdm.data.model.entity.FileStorageQuota;
|
||||
import com.sdm.data.model.req.AddUserQuotaEntity;
|
||||
import com.sdm.data.model.req.ListUserQuotaReq;
|
||||
import com.sdm.data.model.req.QueryBigFileReq;
|
||||
@@ -45,4 +46,6 @@ public interface DataStorageAnalysis {
|
||||
|
||||
List<Long> getListBigFileId(QueryBigFileReq queryBigFileReq);
|
||||
|
||||
SdmResponse<List<FileStorageQuota>> listAllUserQuotaForJob();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.sdm.data.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
@@ -35,6 +36,7 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
@@ -280,7 +282,7 @@ public class DataStorageAnalysisImpl implements DataStorageAnalysis {
|
||||
|
||||
// 构造最终结果,对于没有配额信息的用户添加默认值,并根据已使用存储量设置状态
|
||||
List<FileStorageQuota> fullList = userIds.stream().map(userId -> {
|
||||
FileStorageQuota quota = quotaMap.getOrDefault(userId, createDefaultFileStorageQuota(userId));
|
||||
FileStorageQuota quota = quotaMap.getOrDefault(userId, createDefaultFileStorageQuota(userId, tenantId));
|
||||
// 设置已使用值
|
||||
UserTotalFileSizeDTO usedStorage = usedStorageMap.get(userId);
|
||||
if (usedStorage != null) {
|
||||
@@ -324,13 +326,18 @@ public class DataStorageAnalysisImpl implements DataStorageAnalysis {
|
||||
}
|
||||
|
||||
// 辅助方法:创建默认的 FileStorageQuota 实例
|
||||
private FileStorageQuota createDefaultFileStorageQuota(Long userId) {
|
||||
private FileStorageQuota createDefaultFileStorageQuota(Long userId, Long tenantId) {
|
||||
FileStorageQuota defaultQuota = new FileStorageQuota();
|
||||
defaultQuota.setUserId(userId);
|
||||
defaultQuota.setTenantId(tenantId);
|
||||
defaultQuota.setQuotaValue(2L); // 默认存储阈值
|
||||
defaultQuota.setQuotaUnit("GB"); // 默认单位
|
||||
defaultQuota.setUsedValue(0L); // 默认已使用值
|
||||
defaultQuota.setStatus("NORMAL"); // 默认状态
|
||||
// 初始化到表里 存储告警查询使用
|
||||
if (CollectionUtils.isEmpty(fileStorageQuotaService.lambdaQuery().eq(FileStorageQuota::getUserId, userId).list())) {
|
||||
fileStorageQuotaService.save(defaultQuota);
|
||||
}
|
||||
return defaultQuota;
|
||||
}
|
||||
|
||||
@@ -376,4 +383,26 @@ public class DataStorageAnalysisImpl implements DataStorageAnalysis {
|
||||
.map(FileStorage::getFileId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<List<FileStorageQuota>> listAllUserQuotaForJob() {
|
||||
List<FileStorageQuota> quotaList = fileStorageQuotaService.list();
|
||||
for (FileStorageQuota quota : quotaList) {
|
||||
// fileStorageService 查询用户已使用的存储空间
|
||||
List<UserTotalFileSizeDTO> userStorageList = fileStorageService.getTotalFileSizeByCreator(Arrays.asList(quota.getUserId()), null,quota.getTenantId());
|
||||
if (CollUtil.size(userStorageList) > 0) {
|
||||
UserTotalFileSizeDTO usedStorage = userStorageList.get(0);
|
||||
quota.setUsedValue(usedStorage.getTotalSize());
|
||||
// 根据配额和已使用量设置状态
|
||||
if (quota.getQuotaValue() != null && quota.getUsedValue() != null) {
|
||||
// 将配额值转换为与已使用值相同的单位(字节)进行比较
|
||||
long quotaInBytes = convertToBytes(quota.getQuotaValue(), quota.getQuotaUnit());
|
||||
if (quotaInBytes <= quota.getUsedValue()) {
|
||||
quota.setStatus("EXCEED");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return SdmResponse.success(quotaList.stream().filter(i -> "EXCEED".equals(i.getStatus())).toList());
|
||||
}
|
||||
}
|
||||
@@ -14,8 +14,12 @@ import com.sdm.common.entity.req.data.DelDirReq;
|
||||
import com.sdm.common.entity.req.data.DelFileReq;
|
||||
import com.sdm.common.entity.req.data.UploadFilesReq;
|
||||
import com.sdm.common.entity.req.project.DelNodeReq;
|
||||
import com.sdm.common.entity.req.system.UserQueryReq;
|
||||
import com.sdm.common.entity.resp.AllNodeByProjectIdAndTypeResp;
|
||||
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.utils.CidSysUserUtil;
|
||||
import com.sdm.common.utils.PageUtils;
|
||||
import com.sdm.data.model.entity.DimensionTemplate;
|
||||
import com.sdm.data.dao.DimensionTemplateMapper;
|
||||
@@ -40,9 +44,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
@@ -68,6 +70,9 @@ public class DimensionTemplateServiceImpl extends ServiceImpl<DimensionTemplateM
|
||||
@Autowired
|
||||
IFileMetadataInfoService fileMetadataInfoService;
|
||||
|
||||
@Autowired
|
||||
private SysUserFeignClientImpl sysUserFeignClient;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public SdmResponse saveDimensionTemplateWithHierarchies(TemplateCreationRequest request) {
|
||||
@@ -310,11 +315,46 @@ public class DimensionTemplateServiceImpl extends ServiceImpl<DimensionTemplateM
|
||||
|
||||
PageHelper.startPage(req.getCurrent(), req.getSize());
|
||||
List<FileMetadataInfo> fileMetadataInfos = fileMetadataInfoService.listSimulationNodeFiles(parentDirId, dirInfos,req.isFilterEmptyData(),tenantId);
|
||||
setCreatorNames(fileMetadataInfos);
|
||||
|
||||
PageInfo<FileMetadataInfo> page = new PageInfo<>(fileMetadataInfos);
|
||||
return PageUtils.getJsonObjectSdmResponse(fileMetadataInfos, page);
|
||||
}
|
||||
|
||||
private void setCreatorNames(List<FileMetadataInfo> list) {
|
||||
try {
|
||||
if (ObjectUtils.isNotEmpty(list)) {
|
||||
// 提取去重的 creatorId
|
||||
List<Long> creatorIds = list.stream()
|
||||
.map(FileMetadataInfo::getCreatorId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
// 远程查询用户信息
|
||||
SdmResponse<List<CIDUserResp>> userListSdmRsp = sysUserFeignClient.listUserByIds(
|
||||
UserQueryReq.builder().userIds(creatorIds).build()
|
||||
);
|
||||
// 批量设置 creatorName
|
||||
if (userListSdmRsp.isSuccess() && CollectionUtils.isNotEmpty(userListSdmRsp.getData())) {
|
||||
Map<Long, CIDUserResp> cidUserMap = CidSysUserUtil.getCidUserToMap(userListSdmRsp.getData());
|
||||
list.forEach(fileMetadataInfo -> {
|
||||
Long creatorId = fileMetadataInfo.getCreatorId();
|
||||
CIDUserResp cidUser = cidUserMap.get(creatorId);
|
||||
String username = Objects.isNull(cidUser) ? "" : org.apache.commons.lang3.StringUtils.firstNonBlank(
|
||||
cidUser.getNickname(),
|
||||
cidUser.getUsername(),
|
||||
cidUser.getRealName()
|
||||
);
|
||||
fileMetadataInfo.setCreatorName(username);
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("setCreatorNames error:{}",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse createSimulationNodeDir(CreateDirReq req) {
|
||||
req.setDirType(DirTypeEnum.PROJECT_NODE_DIR.getValue());
|
||||
|
||||
@@ -125,4 +125,8 @@ security:
|
||||
- /data/downloadFile
|
||||
- /data/flowableUpFileToLocal
|
||||
- /data/flowableUpFileToLocalMerge
|
||||
- /data/getFileBaseInfo
|
||||
- /data/getFileBaseInfo
|
||||
|
||||
data:
|
||||
storage-monitor:
|
||||
cron: 0 0 9 * * ?
|
||||
@@ -132,6 +132,10 @@ security:
|
||||
- /data/flowableUpFileToLocalMerge
|
||||
- /data/getFileBaseInfo
|
||||
|
||||
data:
|
||||
storage-monitor:
|
||||
cron: 0 0 9 * * ?
|
||||
|
||||
# 0单机处理,可以指向本地,1负载均衡轮询
|
||||
serverType: 0
|
||||
#serverIp: 192.168.65.161
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.FlowInfoDto;
|
||||
import com.sdm.project.model.resp.KeyResultAndTaskInfoResp;
|
||||
import com.sdm.project.model.resp.RunVersionInfoResp;
|
||||
import com.sdm.project.service.ISimulationRunService;
|
||||
@@ -24,10 +25,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
@@ -177,6 +175,11 @@ public class SimulationRunController implements ISimulationRunFeignClient {
|
||||
return runService.listSimulationKeyResult(req);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getSimulationKeyResultFileIds")
|
||||
public SdmResponse<List<Long>> getSimulationKeyResultFileIds(@RequestParam String runId) {
|
||||
return runService.getSimulationKeyResultFileIds(runId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据交付物文件id查询相关属性和任务信息
|
||||
*
|
||||
@@ -230,7 +233,7 @@ public class SimulationRunController implements ISimulationRunFeignClient {
|
||||
* 任务执行 查询流程节点列表
|
||||
*/
|
||||
@PostMapping("/listFlowNodes")
|
||||
public SdmResponse<List<FlowNodeDto>> listFlowNodes(@RequestBody SpdmTaskRunReq req) {
|
||||
public SdmResponse<FlowInfoDto> listFlowNodes(@RequestBody SpdmTaskRunReq req) {
|
||||
return runService.listFlowNodes(req);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.sdm.project.model.resp;
|
||||
|
||||
import com.sdm.common.entity.flowable.dto.ProcessInstanceInfo;
|
||||
import com.sdm.common.entity.req.capability.FlowNodeDto;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FlowInfoDto {
|
||||
|
||||
private ProcessInstanceInfo processInfo;
|
||||
private List<FlowNodeDto> flowNodeDtoList;
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ 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.resp.FlowInfoDto;
|
||||
import com.sdm.project.model.resp.KeyResultAndTaskInfoResp;
|
||||
import com.sdm.project.model.resp.RunVersionInfoResp;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
@@ -58,6 +59,8 @@ public interface ISimulationRunService extends IService<SimulationRun> {
|
||||
|
||||
SdmResponse<PageDataResp<List<SimulationRunKeyResult>>> listSimulationKeyResult(KeyResultReq req);
|
||||
|
||||
SdmResponse<List<Long>> getSimulationKeyResultFileIds(String runId);
|
||||
|
||||
SdmResponse<PageDataResp<List<KeyResultAndTaskInfoResp>>> queryKeyResultAndTaskInfo(KeyResultReq req);
|
||||
|
||||
SdmResponse deleteSimulationKeyResult(KeyResultReq req);
|
||||
@@ -68,5 +71,5 @@ public interface ISimulationRunService extends IService<SimulationRun> {
|
||||
|
||||
SdmResponse saveNodeParams(SpdmNodeParamReq req);
|
||||
|
||||
SdmResponse<List<FlowNodeDto>> listFlowNodes(SpdmTaskRunReq req);
|
||||
SdmResponse<FlowInfoDto> listFlowNodes(SpdmTaskRunReq req);
|
||||
}
|
||||
|
||||
@@ -47,6 +47,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.FlowInfoDto;
|
||||
import com.sdm.project.model.resp.KeyResultAndTaskInfoResp;
|
||||
import com.sdm.project.model.resp.RunVersionInfoResp;
|
||||
import com.sdm.project.service.*;
|
||||
@@ -1015,6 +1016,15 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
return PageUtils.getJsonObjectSdmResponse(runKeyResults, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<List<Long>> getSimulationKeyResultFileIds(String runId) {
|
||||
List<SimulationRunKeyResult> runKeyResults = simulationKeyResultService.lambdaQuery().eq(SimulationRunKeyResult::getRunId, runId).list();
|
||||
if (CollectionUtils.isNotEmpty(runKeyResults)) {
|
||||
return SdmResponse.success(runKeyResults.stream().map(SimulationRunKeyResult::getFileId).collect(Collectors.toList()));
|
||||
}
|
||||
return SdmResponse.success(new ArrayList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<PageDataResp<List<KeyResultAndTaskInfoResp>>> queryKeyResultAndTaskInfo(KeyResultReq req) {
|
||||
List<KeyResultAndTaskInfoResp> respList = new ArrayList<>();
|
||||
@@ -1254,7 +1264,8 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<List<FlowNodeDto>> listFlowNodes(SpdmTaskRunReq req) {
|
||||
public SdmResponse<FlowInfoDto> listFlowNodes(SpdmTaskRunReq req) {
|
||||
FlowInfoDto flowInfoDto = new FlowInfoDto();
|
||||
FlowNodeDto nodeReq = new FlowNodeDto();
|
||||
nodeReq.setRunId(req.getRunId());
|
||||
SdmResponse<List<FlowNodeDto>> sdmResponse = flowFeignClient.listSimulationFlowNode(nodeReq);
|
||||
@@ -1263,6 +1274,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
SimulationRun simulationRun = this.lambdaQuery().eq(SimulationRun::getUuid, req.getRunId()).one();
|
||||
SdmResponse<ProcessInstanceDetailResponse> response = flowableFeignClient.getProcessAndNodeDetailByInstanceId(simulationRun.getProcessDefinitionId(), simulationRun.getFlowInstanceId(), simulationRun.getUuid());
|
||||
if (response.getData() != null && CollectionUtils.isNotEmpty(response.getData().getNodes())) {
|
||||
flowInfoDto.setProcessInfo(response.getData().getProcessInfo());
|
||||
for (FlowNodeDto flowNodeDto : flowNodeDtoList) {
|
||||
response.getData().getNodes().stream().filter(i -> StringUtils.equals(i.getId(), flowNodeDto.getNodeId())).findFirst().ifPresent(i -> {
|
||||
flowNodeDto.setNodeStatus(i.getStatus());
|
||||
@@ -1278,10 +1290,10 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
node.setNodeStatus("pending");
|
||||
});
|
||||
}
|
||||
|
||||
return SdmResponse.success(flowNodeDtoList);
|
||||
flowInfoDto.setFlowNodeDtoList(flowNodeDtoList);
|
||||
return SdmResponse.success(flowInfoDto);
|
||||
}
|
||||
return SdmResponse.success(new ArrayList<>());
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
public static void deleteFolder(File folder) {
|
||||
|
||||
@@ -177,4 +177,5 @@ security:
|
||||
whitelist:
|
||||
paths:
|
||||
- /systemApprove/approveStatusNotice
|
||||
- /user/getUserToken
|
||||
- /user/getUserToken
|
||||
- /systemMsg/sendMessage
|
||||
@@ -173,6 +173,13 @@ cid:
|
||||
log:
|
||||
saveLog: /spdm-log/saveLog
|
||||
|
||||
security:
|
||||
whitelist:
|
||||
paths:
|
||||
- /systemApprove/approveStatusNotice
|
||||
- /user/getUserToken
|
||||
- /systemMsg/sendMessage
|
||||
|
||||
# 0单机处理,可以指向本地,1负载均衡轮询
|
||||
serverType: 0
|
||||
#serverIp: 192.168.65.161
|
||||
|
||||
@@ -4,6 +4,8 @@ package com.sdm.task.controller;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.performance.PerformanceExportExcelFormat;
|
||||
import com.sdm.common.entity.req.task.DemandExportExcelFormat;
|
||||
import com.sdm.common.entity.resp.task.PerformanceResp;
|
||||
import com.sdm.common.feign.inter.task.ISimuluationPerformanceFeignClient;
|
||||
import com.sdm.task.model.dto.TaskPerformanceDto;
|
||||
import com.sdm.task.model.entity.SimulationPerformance;
|
||||
import com.sdm.task.model.req.BatchAddTaskPerformanceReq;
|
||||
@@ -29,7 +31,7 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequestMapping("/taskPerformance")
|
||||
@Tag(name = "数据分析", description = "获取任务性能指标")
|
||||
public class SimulationPerformanceController {
|
||||
public class SimulationPerformanceController implements ISimuluationPerformanceFeignClient {
|
||||
@Autowired
|
||||
private ISimulationPerformanceService simulationPerformanceService;
|
||||
|
||||
@@ -52,7 +54,7 @@ public class SimulationPerformanceController {
|
||||
*/
|
||||
@GetMapping("/getRunPerformance")
|
||||
@Operation(summary = "获取算例性能指标")
|
||||
public SdmResponse<List<SimulationPerformance>> getRunPerformance( @NotNull @RequestParam String runId) {
|
||||
public SdmResponse<List<PerformanceResp>> getRunPerformance(@NotNull @RequestParam String runId) {
|
||||
return simulationPerformanceService.getRunPerformance(runId);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.sdm.task.service;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.performance.PerformanceExportExcelFormat;
|
||||
import com.sdm.common.entity.resp.task.PerformanceResp;
|
||||
import com.sdm.task.model.dto.TaskPerformanceDto;
|
||||
import com.sdm.task.model.entity.SimulationPerformance;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@@ -21,7 +22,7 @@ import java.util.List;
|
||||
public interface ISimulationPerformanceService extends IService<SimulationPerformance> {
|
||||
SdmResponse getTaskPerformance(Integer taskId);
|
||||
|
||||
SdmResponse<List<SimulationPerformance>> getRunPerformance(String runId);
|
||||
SdmResponse<List<PerformanceResp>> getRunPerformance(String runId);
|
||||
/**
|
||||
* 批量新增任务性能指标
|
||||
*
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.sdm.common.entity.req.data.KnowledgeExportExcelParam;
|
||||
import com.sdm.common.entity.req.performance.PerformanceExportExcelFormat;
|
||||
import com.sdm.common.entity.req.performance.PerformanceExportExcelParam;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.entity.resp.task.PerformanceResp;
|
||||
import com.sdm.common.service.BaseService;
|
||||
import com.sdm.common.utils.RandomUtil;
|
||||
import com.sdm.common.utils.excel.ExcelUtil;
|
||||
@@ -56,9 +57,17 @@ public class SimulationPerformanceServiceImpl extends ServiceImpl<SimulationPerf
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<List<SimulationPerformance>> getRunPerformance(String runId) {
|
||||
public SdmResponse<List<PerformanceResp>> getRunPerformance(String runId) {
|
||||
List<SimulationPerformance> list = this.lambdaQuery().eq(SimulationPerformance::getRunId, runId).list();
|
||||
return SdmResponse.success(list);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
List<PerformanceResp> resps = list.stream().map(i -> {
|
||||
PerformanceResp resp = new PerformanceResp();
|
||||
BeanUtils.copyProperties(i, resp);
|
||||
return resp;
|
||||
}).toList();
|
||||
return SdmResponse.success(resps);
|
||||
}
|
||||
return SdmResponse.success(new ArrayList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -144,9 +153,9 @@ public class SimulationPerformanceServiceImpl extends ServiceImpl<SimulationPerf
|
||||
response = SdmResponse.failed(taskRespond.getMessage());
|
||||
}
|
||||
}else {
|
||||
SdmResponse<List<SimulationPerformance>> taskRespond = getRunPerformance(runId);
|
||||
SdmResponse<List<PerformanceResp>> taskRespond = getRunPerformance(runId);
|
||||
if(taskRespond.isSuccess()) {
|
||||
List<SimulationPerformance> dataList = taskRespond.getData();
|
||||
List<PerformanceResp> dataList = taskRespond.getData();
|
||||
if (CollectionUtils.isEmpty(dataList)) {
|
||||
ExcelUtil.exportExcelNoMerge(new JSONArray(),exportExcelFormats,httpServletResponse);
|
||||
return response;
|
||||
|
||||
Reference in New Issue
Block a user