diff --git a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ExperimentTestProcessServiceImpl.java b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ExperimentTestProcessServiceImpl.java index 55926f1..e5806b2 100644 --- a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ExperimentTestProcessServiceImpl.java +++ b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ExperimentTestProcessServiceImpl.java @@ -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 getByExperimentId(String experimentId) { List list = list( @@ -71,30 +76,53 @@ public class ExperimentTestProcessServiceImpl extends ServiceImpl()); if (StringUtils.isNotBlank(testEquipmentJson)) { - List testEquipmentDTOList = JSON.parseArray(testEquipmentJson, TestEquipmentDTO.class); - experimentTestProcess.setTestEquipmentList(testEquipmentDTOList); + try { + List 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)) { - List testEquipmentDTOList = JSON.parseArray(testMeteringPointJson, TestMeteringPointDTO.class); - experimentTestProcess.setTestMeteringPointList(testEquipmentDTOList); + try { + List 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)) { - List testEquipmentDTOList = JSON.parseArray(testFluencePointJson, TestFluencePointDTO.class); - experimentTestProcess.setTestFluencePointList(testEquipmentDTOList); + try { + List 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)) { - List testAnnealingDurationDTOList = JSON.parseArray(annealingDurationJson, - TestAnnealingDurationDTO.class); - experimentTestProcess.setAnnealingDurationList(testAnnealingDurationDTOList); + try { + List testAnnealingDurationDTOList = JSON.parseArray(annealingDurationJson, + TestAnnealingDurationDTO.class); + experimentTestProcess.setAnnealingDurationList(testAnnealingDurationDTOList); + }catch (Exception e) { + // 忽略解析错误并打印错误日志,兼容历史脏数据 + logger.error("解析TestAnnealingDurationDTO失败:" + e.getMessage()); + } } }