fix:批量查询报告模板&绑定相同工况库查询最新版本
This commit is contained in:
@@ -112,5 +112,15 @@ public class ReportTemplateController implements ISimulationReportFeignClient {
|
||||
return reportTemplateService.queryValidReportTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询报告模版详情
|
||||
* @param uuids
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/queryReportTemplateInfoBatch")
|
||||
public SdmResponse<List<ReportTemplateResp>> queryReportTemplateInfoBatch(@RequestBody List<String> uuids) {
|
||||
return reportTemplateService.queryReportTemplateInfoBatch(uuids);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -33,5 +33,6 @@ public interface ISimulationReportTemplateService extends IService<SimulationRep
|
||||
|
||||
SdmResponse<List<ReportTemplateResp>> queryValidReportTemplate();
|
||||
|
||||
SdmResponse<List<ReportTemplateResp>> queryReportTemplateInfoBatch(List<String> uuids);
|
||||
|
||||
}
|
||||
|
||||
@@ -313,7 +313,27 @@ public class SimulationReportTemplateServiceImpl extends ServiceImpl<SimulationR
|
||||
if(bindResponse.isSuccess())
|
||||
{
|
||||
List<FlowBindTaskPoolItem> flowBindTaskPoolItems = (List<FlowBindTaskPoolItem>)bindResponse.getData();
|
||||
//过滤出工况库中最新的版本对流程模版的绑定关系
|
||||
Map<String,FlowBindTaskPoolItem> latestPoolBindRelateMap = new HashMap<>();
|
||||
for(FlowBindTaskPoolItem flowBindTaskPoolItem : flowBindTaskPoolItems)
|
||||
{
|
||||
String poolName = flowBindTaskPoolItem.poolName;
|
||||
String version = flowBindTaskPoolItem.version;
|
||||
FlowBindTaskPoolItem savedPoolItem = latestPoolBindRelateMap.get(poolName);
|
||||
if(savedPoolItem == null)
|
||||
{
|
||||
latestPoolBindRelateMap.put(poolName,flowBindTaskPoolItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
String savedVersion = savedPoolItem.version;
|
||||
if(version.compareTo(savedVersion) > 0)
|
||||
{
|
||||
latestPoolBindRelateMap.put(poolName,flowBindTaskPoolItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(FlowBindTaskPoolItem flowBindTaskPoolItem : latestPoolBindRelateMap.values())
|
||||
{
|
||||
SimulationFlowTaskBindInfo flowTaskBindInfo = new SimulationFlowTaskBindInfo();
|
||||
flowTaskBindInfo.simulationPoolName = flowBindTaskPoolItem.poolName;
|
||||
@@ -411,6 +431,30 @@ public class SimulationReportTemplateServiceImpl extends ServiceImpl<SimulationR
|
||||
return SdmResponse.success(resp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询报告模版详情
|
||||
* @param uuids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SdmResponse<List<ReportTemplateResp>> queryReportTemplateInfoBatch(List<String> uuids) {
|
||||
if (CollectionUtils.isEmpty(uuids)) {
|
||||
return SdmResponse.success(new ArrayList<>());
|
||||
}
|
||||
List<SimulationReportTemplate> reportTemplates = this.lambdaQuery()
|
||||
.in(SimulationReportTemplate::getUuid, uuids)
|
||||
.list();
|
||||
if (CollectionUtils.isEmpty(reportTemplates)) {
|
||||
return SdmResponse.success(new ArrayList<>());
|
||||
}
|
||||
List<ReportTemplateResp> respList = reportTemplates.stream().map(reportTemplate -> {
|
||||
ReportTemplateResp resp = new ReportTemplateResp();
|
||||
BeanUtils.copyProperties(reportTemplate, resp);
|
||||
return resp;
|
||||
}).toList();
|
||||
return SdmResponse.success(respList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤出最新的版本模版
|
||||
* @param templates
|
||||
|
||||
@@ -63,4 +63,19 @@ public class SimulationReportFeignClientImpl implements ISimulationReportFeignCl
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<List<ReportTemplateResp>> queryReportTemplateInfoBatch(List<String> uuids) {
|
||||
SdmResponse<List<ReportTemplateResp>> response;
|
||||
try {
|
||||
response = reportFeignClient.queryReportTemplateInfoBatch(uuids);
|
||||
if (!response.isSuccess()) {
|
||||
return SdmResponse.failed("批量查询报告模板失败");
|
||||
}
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("批量查询报告模板失败", e);
|
||||
return SdmResponse.failed("批量查询报告模板失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,4 +25,7 @@ public interface ISimulationReportFeignClient {
|
||||
@GetMapping("/report/queryValidReportTemplate")
|
||||
SdmResponse<List<ReportTemplateResp>> queryValidReportTemplate();
|
||||
|
||||
@PostMapping("/report/queryReportTemplateInfoBatch")
|
||||
SdmResponse<List<ReportTemplateResp>> queryReportTemplateInfoBatch(@RequestBody List<String> uuids);
|
||||
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 192.168.65.161:8848
|
||||
group: DAI_GROUP
|
||||
group: ZXR_GROUP
|
||||
enabled: true
|
||||
|
||||
data:
|
||||
|
||||
Reference in New Issue
Block a user