1、生成自动化脚本修改performance.json

This commit is contained in:
2025-12-04 10:21:06 +08:00
parent c1f9a6065e
commit 802015a472

View File

@@ -1121,18 +1121,23 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
}
// 生成performance.json
List<SimulationPerformance> performanceList = req.getPerformanceList();
List<PerformanceInfoReq> exportPerformanceList = new ArrayList<>();
List<JSONObject> exportPerformanceList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(performanceList)) {
PerformanceInfoReq performanceInfoReq = new PerformanceInfoReq();
for (SimulationPerformance performance : performanceList) {
JSONObject performanceInfoJson = new JSONObject();
PerformanceInfoReq performanceInfoReq = new PerformanceInfoReq();
performanceInfoReq.setValue(StringUtils.isNotBlank(performance.getTargetValue()) ? performance.getTargetValue() : "");
performanceInfoReq.setEnglishName(StringUtils.isNotBlank(performance.getEnglishName()) ? performance.getEnglishName() : "");
performanceInfoReq.setHighValue(StringUtils.isNotBlank(performance.getHighValue()) ? performance.getHighValue() : "");
performanceInfoReq.setPerformanceName(StringUtils.isNotBlank(performance.getPerformanceName()) ? performance.getPerformanceName() : "");
performanceInfoReq.setMethod(StringUtils.isNotBlank(performance.getMethod()) ? performance.getMethod() : "");
performanceInfoReq.setUnit(StringUtils.isNotBlank(performance.getUnit()) ? performance.getUnit() : "");
exportPerformanceList.add(performanceInfoReq);
performanceInfoJson.put(performanceInfoReq.getEnglishName(),performanceInfoReq);
exportPerformanceList.add(performanceInfoJson);
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("type","insert");
exportPerformanceList.add(jsonObject);
String jsonString = JSON.toJSONString(exportPerformanceList);
FileOutputStream performanceOutputStream = null;
try {