feat:查询算例结果文件和指标提供给flowable
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -25,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;
|
||||
@@ -178,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查询相关属性和任务信息
|
||||
*
|
||||
|
||||
@@ -59,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);
|
||||
|
||||
@@ -1016,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<>();
|
||||
|
||||
@@ -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