|
@@ -2,7 +2,9 @@ package com.ruoyi.business.service.impl;
|
|
|
|
|
|
import com.ruoyi.business.domain.*;
|
|
|
import com.ruoyi.business.mapper.*;
|
|
|
+import com.ruoyi.business.req.AssayReq;
|
|
|
import com.ruoyi.business.req.DeviceReq;
|
|
|
+import com.ruoyi.business.res.AssayDetailRes;
|
|
|
import com.ruoyi.business.res.DeviceRes;
|
|
|
import com.ruoyi.business.res.HomeCountsRes;
|
|
|
import com.ruoyi.business.service.IBusinessService;
|
|
@@ -81,12 +83,45 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
//额外处理其他数据
|
|
|
if(!CollectionUtils.isEmpty(list)){
|
|
|
for (DeviceRes deviceRes : list) {
|
|
|
- this.addExtra(deviceRes, assayDate, deviceRes.getDeviceNo());
|
|
|
+ this.addDeviceExtra(deviceRes, assayDate, deviceRes.getDeviceNo());
|
|
|
}
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<AssayDetailRes> assayPageListByDeviceNoAndDate(AssayReq assayReq) {
|
|
|
+ //通过设备编号和日期获取质控样的化验记录的明细化验时间和化验编号
|
|
|
+ List<AssayDetailRes> list = this.zAssayMapper.assayPageListByDeviceNoAndDate(assayReq);
|
|
|
+ if(!CollectionUtils.isEmpty(list)){
|
|
|
+ for (AssayDetailRes assayDetailRes : list) {
|
|
|
+ String assayNo = assayDetailRes.getAssayNo();
|
|
|
+ if(StringUtils.isNotBlank(assayNo)){
|
|
|
+ this.addAssayExtra(assayNo, assayDetailRes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void addAssayExtra(String assayNo, AssayDetailRes assayDetailRes) {
|
|
|
+ //分别处理化验设备的名称、水厂的名字字段
|
|
|
+ List<BizDevice> bizDevices = this.bizDeviceMapper.selectBizDeviceList(BizDevice.builder().deviceNo(assayDetailRes.getDeviceNo()).build());
|
|
|
+ if(!CollectionUtils.isEmpty(bizDevices)){
|
|
|
+ assayDetailRes.setDeviceName(bizDevices.get(0).getDeviceName());
|
|
|
+ assayDetailRes.setDeviceWorks(bizDevices.get(0).getDeviceWorks());
|
|
|
+ }
|
|
|
+ List<BizWaterWork> bizWaterWorks = this.bizWaterWorkMapper.selectBizWaterWorkList(BizWaterWork.builder().worksId(assayDetailRes.getDeviceWorks()).build());
|
|
|
+ if(!CollectionUtils.isEmpty(bizWaterWorks)){
|
|
|
+ assayDetailRes.setWorksName(bizWaterWorks.get(0).getWorksName());
|
|
|
+ }
|
|
|
+ //通过化验编号查询所有的化验明细,然后根据类型计算对应的
|
|
|
+ List<ZAssayResult> zAssayResults = this.zAssayResultMapper.selectZAssayResultList(ZAssayResult.builder().assayNo(assayNo).assayType("3").build());
|
|
|
+ if(!CollectionUtils.isEmpty(zAssayResults)){
|
|
|
+ //todo 处理八种类型化验的计算
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 额外处理其他的字段 聚合,查询其他表,计算等
|
|
|
*
|
|
@@ -94,7 +129,7 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
* @param assayDate
|
|
|
* @param deviceNo
|
|
|
*/
|
|
|
- private void addExtra(DeviceRes deviceRes, String assayDate, String deviceNo) {
|
|
|
+ private void addDeviceExtra(DeviceRes deviceRes, String assayDate, String deviceNo) {
|
|
|
//查询最近的一条化验记录明细 及 化验统计(结果)
|
|
|
List<ZAssayResult> zAssayResults = this.zAssayResultMapper.selectZAssayResultList(ZAssayResult.builder().resultDate(assayDate).assayType("3").deviceNo(deviceNo).build());
|
|
|
if(!CollectionUtils.isEmpty(zAssayResults)){
|
|
@@ -162,14 +197,14 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
//todo 日期临时写死,因为数据不会同步,都是历史数据 正式以后,需要改成真实日期
|
|
|
// Date nowDate = DateUtils.getNowDate();
|
|
|
Date nowDate = DateUtils.parseDate("2024-08-13");
|
|
|
- Long resultConcentration = zAssayResult.getResultConcentration();//化验的真实值
|
|
|
+ Double resultConcentration = zAssayResult.getResultConcentration();//化验的真实值
|
|
|
//去查询配置的标准值的范围(数据不确认,有可能是多个,获取最后一条数据):
|
|
|
List<ZQualityValue> list = this.zQualityValueMapper.selectZQualityValueList(ZQualityValue.builder().beginTime(nowDate).endTime(nowDate).deviceWorks(bizDevices.get(0).getDeviceWorks()).assayItem(zAssayResult.getAssayItem()).build());
|
|
|
//理论上是只有一个的
|
|
|
if(!CollectionUtils.isEmpty(list)){
|
|
|
ZQualityValue zQualityValue = list.get(0);//获取最新的一条,防止有多条数据的情况
|
|
|
- Long lowValue = zQualityValue.getLowValue();
|
|
|
- Long highValue = zQualityValue.getHighValue();
|
|
|
+ Double lowValue = zQualityValue.getLowValue();
|
|
|
+ Double highValue = zQualityValue.getHighValue();
|
|
|
if(!Objects.isNull(resultConcentration) && !Objects.isNull(lowValue) && !Objects.isNull(highValue)){
|
|
|
isPassed = resultConcentration >= lowValue && resultConcentration <= highValue;
|
|
|
}
|