导出试验时,兼容历史数据格式不正确问题
This commit is contained in:
@@ -11,6 +11,8 @@ import org.jeecg.modules.database.dto.*;
|
||||
import org.jeecg.modules.database.entity.*;
|
||||
import org.jeecg.modules.database.mapper.ExperimentTestProcessMapper;
|
||||
import org.jeecg.modules.database.service.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -35,6 +37,9 @@ public class ExperimentTestProcessServiceImpl extends ServiceImpl<ExperimentTest
|
||||
@Autowired
|
||||
private IComponentSearchService componentSearchService;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ExperimentTestProcessServiceImpl.class);
|
||||
|
||||
|
||||
@Override
|
||||
public List<ExperimentTestProcess> getByExperimentId(String experimentId) {
|
||||
List<ExperimentTestProcess> list = list(
|
||||
@@ -71,30 +76,53 @@ public class ExperimentTestProcessServiceImpl extends ServiceImpl<ExperimentTest
|
||||
String testEquipmentJson = experimentTestProcess.getTestEquipment();
|
||||
experimentTestProcess.setTestEquipmentList(new ArrayList<>());
|
||||
if (StringUtils.isNotBlank(testEquipmentJson)) {
|
||||
try {
|
||||
List<TestEquipmentDTO> testEquipmentDTOList = JSON.parseArray(testEquipmentJson, TestEquipmentDTO.class);
|
||||
experimentTestProcess.setTestEquipmentList(testEquipmentDTOList);
|
||||
}catch (Exception e) {
|
||||
// 忽略解析错误并打印错误日志,兼容历史脏数据
|
||||
logger.error("解析TestEquipmentDTO失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
String testMeteringPointJson = experimentTestProcess.getTestMeteringPoint();
|
||||
experimentTestProcess.setTestMeteringPointList(new ArrayList<>());
|
||||
if (StringUtils.isNotBlank(testMeteringPointJson)) {
|
||||
try {
|
||||
List<TestMeteringPointDTO> testEquipmentDTOList = JSON.parseArray(testMeteringPointJson, TestMeteringPointDTO.class);
|
||||
experimentTestProcess.setTestMeteringPointList(testEquipmentDTOList);
|
||||
}catch (Exception e) {
|
||||
// 忽略解析错误并打印错误日志,兼容历史脏数据
|
||||
logger.error("解析TestMeteringPointDTO失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
String testFluencePointJson = experimentTestProcess.getTestFluencePoint();
|
||||
experimentTestProcess.setTestFluencePointList(new ArrayList<>());
|
||||
if (StringUtils.isNotBlank(testFluencePointJson)) {
|
||||
try {
|
||||
List<TestFluencePointDTO> testEquipmentDTOList = JSON.parseArray(testFluencePointJson, TestFluencePointDTO.class);
|
||||
experimentTestProcess.setTestFluencePointList(testEquipmentDTOList);
|
||||
}catch (Exception e) {
|
||||
// 忽略解析错误并打印错误日志,兼容历史脏数据
|
||||
logger.error("解析TestFluencePointDTO失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
String annealingDurationJson = experimentTestProcess.getAnnealingDuration();
|
||||
experimentTestProcess.setAnnealingDurationList(new ArrayList<>());
|
||||
if (StringUtils.isNotBlank(annealingDurationJson)) {
|
||||
try {
|
||||
List<TestAnnealingDurationDTO> testAnnealingDurationDTOList = JSON.parseArray(annealingDurationJson,
|
||||
TestAnnealingDurationDTO.class);
|
||||
experimentTestProcess.setAnnealingDurationList(testAnnealingDurationDTOList);
|
||||
}catch (Exception e) {
|
||||
// 忽略解析错误并打印错误日志,兼容历史脏数据
|
||||
logger.error("解析TestAnnealingDurationDTO失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user