From ed1ff2e69d8d5e6b75cdc1d9bf65cf564b392939 Mon Sep 17 00:00:00 2001 From: chen <2710907404@qq.com> Date: Wed, 2 Apr 2025 17:01:59 +0800 Subject: [PATCH] =?UTF-8?q?20250402=20=E6=9B=B4=E6=96=B0=201.=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E8=AE=A1=E7=AE=97=E4=BF=9D=E7=95=99=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PushDataToLabsCareServiceImpl.java | 2 +- .../impl/TestRecordSampleDataServiceImpl.java | 64 ++++++++++--------- 2 files changed, 36 insertions(+), 30 deletions(-) diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/PushDataToLabsCareServiceImpl.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/PushDataToLabsCareServiceImpl.java index 13114e1..550840e 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/PushDataToLabsCareServiceImpl.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/PushDataToLabsCareServiceImpl.java @@ -93,7 +93,7 @@ public class PushDataToLabsCareServiceImpl implements PushDataToLabsCareService private final static String NON_INFRARED_GENERAL_QUALITATIVE_RECORD = "NonInfraredGeneralQualitativeRecord"; /** - * 做一个定时推送,对于推送失败的委托进行重新推送, 每天凌晨1点推送 + * 做一个定时推送,对于推送失败的委托进行重新推送, 每天凌晨2点推送 */ // @Scheduled(cron = "30 * * * * ?") // 测试 @Scheduled(cron = "0 0 2 * * ?") // 每天凌晨 2 点执行 diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampleDataServiceImpl.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampleDataServiceImpl.java index c0f3d63..51b6f5f 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampleDataServiceImpl.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampleDataServiceImpl.java @@ -407,7 +407,7 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl { - testRecordSampleDataList.forEach(item -> calculateInspectData(item.getId())); + calculateInspectData(testRecordSampleDataList.stream().map(TestRecordSampleData::getId).collect(Collectors.toList()), testRecord.getBusinessType()); // }).exceptionally(e -> { // log.error("计算保留时间以及相对误差出错!"); // e.printStackTrace(); @@ -1610,38 +1610,44 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpllambdaQuery() - .eq(TestRecordSampleData::getCompoundName, compoundName) - .eq(TestRecordSampleData::getTestId, testRecordSampleData.getTestId()) - .eq(TestRecordSampleData::getSampleType, "STD")); - - if ( testRecordSampleData.getTargetRtTime() != null && std.getTargetRtTime() != null ) { - TestRecord testRecord = testRecordService.getById(testRecordSampleData.getTestId()); - if (testRecord.getBusinessType().equals(BusinessType.BOINT_CASE.getBusinessType())) { - testRecordSampleData.setRtTimeError(processInspectDataService.getHairCaseRtTimeError(testRecordSampleData.getTargetRtTime(), std.getTargetRtTime())); - testRecordSampleData.setRtTimeWithinError( - processInspectDataService.setHairCaseRtTimeWithinError( - testRecordSampleData.getRtTimeError().doubleValue() - ) - ); - } else { + public Boolean calculateInspectData(List dataIds, String businessType) { + // 获取所有需要操作的列表 + List testRecordSampleDataList = super.listByIds(dataIds); + + // 筛选出标准物质检验数据,并根据compoundName转map + Map stdTestDataMap = testRecordSampleDataList + .stream() + .filter(testRecordSampleData -> testRecordSampleData.getSampleType().equals(TestRecordSampleDataConstant.SAMPLE_TYPE_STD)) + .collect(Collectors.toMap(TestRecordSampleData::getCompoundName, Function.identity())); + + testRecordSampleDataList.forEach(testRecordSampleData -> { + TestRecordSampleData std = stdTestDataMap.get(testRecordSampleData.getCompoundName()); + + if ( std != null && testRecordSampleData.getTargetRtTime() != null && std.getTargetRtTime() != null ) { testRecordSampleData.setRtTimeError(processInspectDataService.getHairCaseRtTimeError(testRecordSampleData.getTargetRtTime(), std.getTargetRtTime())); - testRecordSampleData.setRtTimeWithinError( - processInspectDataService.getRtWithinErrorText( - Math.abs(testRecordSampleData.getRtTimeError().doubleValue()), - 1 - ) - ); + if (businessType.equals(BusinessType.BOINT_CASE.getBusinessType())) { + testRecordSampleData.setRtTimeWithinError( + processInspectDataService.setHairCaseRtTimeWithinError( + testRecordSampleData.getRtTimeError().doubleValue() + ) + ); + } else { + testRecordSampleData.setRtTimeWithinError( + processInspectDataService.getRtWithinErrorText( + Math.abs(testRecordSampleData.getRtTimeError().doubleValue()), + 1 + ) + ); + } } - } - return this.updateById(testRecordSampleData); + }); + + return this.updateBatchById(testRecordSampleDataList); } @Override