20250402 更新
1.优化计算保留时间的方法
This commit is contained in:
+1
-1
@@ -93,7 +93,7 @@ public class PushDataToLabsCareServiceImpl implements PushDataToLabsCareService
|
|||||||
private final static String NON_INFRARED_GENERAL_QUALITATIVE_RECORD = "NonInfraredGeneralQualitativeRecord";
|
private final static String NON_INFRARED_GENERAL_QUALITATIVE_RECORD = "NonInfraredGeneralQualitativeRecord";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 做一个定时推送,对于推送失败的委托进行重新推送, 每天凌晨1点推送
|
* 做一个定时推送,对于推送失败的委托进行重新推送, 每天凌晨2点推送
|
||||||
*/
|
*/
|
||||||
// @Scheduled(cron = "30 * * * * ?") // 测试
|
// @Scheduled(cron = "30 * * * * ?") // 测试
|
||||||
@Scheduled(cron = "0 0 2 * * ?") // 每天凌晨 2 点执行
|
@Scheduled(cron = "0 0 2 * * ?") // 每天凌晨 2 点执行
|
||||||
|
|||||||
+33
-27
@@ -407,7 +407,7 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
|||||||
}
|
}
|
||||||
// 开启异步执行
|
// 开启异步执行
|
||||||
// CompletableFuture.runAsync(() -> {
|
// CompletableFuture.runAsync(() -> {
|
||||||
testRecordSampleDataList.forEach(item -> calculateInspectData(item.getId()));
|
calculateInspectData(testRecordSampleDataList.stream().map(TestRecordSampleData::getId).collect(Collectors.toList()), testRecord.getBusinessType());
|
||||||
// }).exceptionally(e -> {
|
// }).exceptionally(e -> {
|
||||||
// log.error("计算保留时间以及相对误差出错!");
|
// log.error("计算保留时间以及相对误差出错!");
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
@@ -1610,38 +1610,44 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新计算数据,计算保留时间和保留时间误差
|
* 更新计算数据,计算保留时间和保留时间误差
|
||||||
* @param dataId 检验数据id
|
*
|
||||||
|
* @param dataIds 检验数据id列表
|
||||||
|
* @param businessType 实验类型(业务类型)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Boolean calculateInspectData(String dataId) {
|
public Boolean calculateInspectData(List<String> dataIds, String businessType) {
|
||||||
TestRecordSampleData testRecordSampleData = super.getById(dataId);
|
// 获取所有需要操作的列表
|
||||||
String compoundName = testRecordSampleData.getCompoundName();
|
List<TestRecordSampleData> testRecordSampleDataList = super.listByIds(dataIds);
|
||||||
|
|
||||||
TestRecordSampleData std = this.getOne(Wrappers.<TestRecordSampleData>lambdaQuery()
|
// 筛选出标准物质检验数据,并根据compoundName转map
|
||||||
.eq(TestRecordSampleData::getCompoundName, compoundName)
|
Map<String, TestRecordSampleData> stdTestDataMap = testRecordSampleDataList
|
||||||
.eq(TestRecordSampleData::getTestId, testRecordSampleData.getTestId())
|
.stream()
|
||||||
.eq(TestRecordSampleData::getSampleType, "STD"));
|
.filter(testRecordSampleData -> testRecordSampleData.getSampleType().equals(TestRecordSampleDataConstant.SAMPLE_TYPE_STD))
|
||||||
|
.collect(Collectors.toMap(TestRecordSampleData::getCompoundName, Function.identity()));
|
||||||
|
|
||||||
if ( testRecordSampleData.getTargetRtTime() != null && std.getTargetRtTime() != null ) {
|
testRecordSampleDataList.forEach(testRecordSampleData -> {
|
||||||
TestRecord testRecord = testRecordService.getById(testRecordSampleData.getTestId());
|
TestRecordSampleData std = stdTestDataMap.get(testRecordSampleData.getCompoundName());
|
||||||
if (testRecord.getBusinessType().equals(BusinessType.BOINT_CASE.getBusinessType())) {
|
|
||||||
|
if ( std != null && testRecordSampleData.getTargetRtTime() != null && std.getTargetRtTime() != null ) {
|
||||||
testRecordSampleData.setRtTimeError(processInspectDataService.getHairCaseRtTimeError(testRecordSampleData.getTargetRtTime(), std.getTargetRtTime()));
|
testRecordSampleData.setRtTimeError(processInspectDataService.getHairCaseRtTimeError(testRecordSampleData.getTargetRtTime(), std.getTargetRtTime()));
|
||||||
testRecordSampleData.setRtTimeWithinError(
|
if (businessType.equals(BusinessType.BOINT_CASE.getBusinessType())) {
|
||||||
processInspectDataService.setHairCaseRtTimeWithinError(
|
testRecordSampleData.setRtTimeWithinError(
|
||||||
testRecordSampleData.getRtTimeError().doubleValue()
|
processInspectDataService.setHairCaseRtTimeWithinError(
|
||||||
)
|
testRecordSampleData.getRtTimeError().doubleValue()
|
||||||
);
|
)
|
||||||
} else {
|
);
|
||||||
testRecordSampleData.setRtTimeError(processInspectDataService.getHairCaseRtTimeError(testRecordSampleData.getTargetRtTime(), std.getTargetRtTime()));
|
} else {
|
||||||
testRecordSampleData.setRtTimeWithinError(
|
testRecordSampleData.setRtTimeWithinError(
|
||||||
processInspectDataService.getRtWithinErrorText(
|
processInspectDataService.getRtWithinErrorText(
|
||||||
Math.abs(testRecordSampleData.getRtTimeError().doubleValue()),
|
Math.abs(testRecordSampleData.getRtTimeError().doubleValue()),
|
||||||
1
|
1
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
return this.updateById(testRecordSampleData);
|
|
||||||
|
return this.updateBatchById(testRecordSampleDataList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user