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