fix:更新报告模板绑定工况&导出报告指标入库优化
This commit is contained in:
@@ -184,6 +184,13 @@ public class SimulationReportTemplateServiceImpl extends ServiceImpl<SimulationR
|
||||
SimulationReportTemplate reportTemplate = new SimulationReportTemplate();
|
||||
BeanUtils.copyProperties(templateDto, reportTemplate);
|
||||
this.updateById(reportTemplate);
|
||||
|
||||
// 解析工况库信息JSON字符串
|
||||
if (StringUtils.isNotBlank(templateDto.getSimulationPoolInfoListStr())) {
|
||||
List<SimulationFlowTaskBindInfo> simulationPoolInfoList = JSON.parseArray(templateDto.getSimulationPoolInfoListStr(), SimulationFlowTaskBindInfo.class);
|
||||
// 绑定工况
|
||||
bindReportTemplateAndTask(reportTemplate.getTemplateCode(), simulationPoolInfoList);
|
||||
}
|
||||
return SdmResponse.success(reportTemplate.getId());
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
@@ -2211,7 +2212,9 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
newPerformance.setCreator(userId);
|
||||
}
|
||||
} else {
|
||||
Map<String, List<SimulationPerformance>> oldPerformanceMap = oldPerformances.stream().collect(Collectors.groupingBy(SimulationPerformance::getNodeName));
|
||||
Map<String, List<SimulationPerformance>> oldPerformanceMap = oldPerformances.stream()
|
||||
.filter(p -> p.getNodeName() != null)
|
||||
.collect(Collectors.groupingBy(SimulationPerformance::getNodeName));
|
||||
for (SimulationPerformance newPerformance : performanceList) {
|
||||
List<SimulationPerformance> oldPerformanceByNodeName = oldPerformanceMap.get(newPerformance.getNodeName());
|
||||
if (CollectionUtils.isNotEmpty(oldPerformanceByNodeName)) {
|
||||
@@ -2267,6 +2270,8 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
public List<SimulationPerformance> extractPerformance(String jsonData) {
|
||||
List<SimulationPerformance> performances = new ArrayList<>();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
// 配置ObjectMapper:忽略未知字段
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
|
||||
try {
|
||||
JsonNode rootNode = objectMapper.readTree(jsonData);
|
||||
@@ -2281,7 +2286,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("解析指标数据失败:", e);
|
||||
}
|
||||
// 去重
|
||||
performances = new ArrayList<>(performances.stream()
|
||||
|
||||
Reference in New Issue
Block a user