|
@@ -12,6 +12,7 @@ import com.ruoyi.business.service.IBusinessService;
|
|
|
import com.ruoyi.common.NumberUtils;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
@@ -21,7 +22,9 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
import static com.ruoyi.common.constant.Constants.INT_2;
|
|
|
import static com.ruoyi.common.constant.Constants.INT_4;
|
|
|
+import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;
|
|
|
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
public class BusinessServiceImpl implements IBusinessService {
|
|
|
|
|
@@ -126,14 +129,25 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
Map<String, List<ZAssayResult>> map = zAssayResults.stream().collect(Collectors.groupingBy(ZAssayResult::getDeviceNo));
|
|
|
map.forEach((deviceNo, value) -> {
|
|
|
AssayQualityDetailRes assayQualityDetailRes = new AssayQualityDetailRes();
|
|
|
+ log.info("水厂的编号为{}", deviceNo);
|
|
|
//获取水厂的名称
|
|
|
//先查询化验室,再获取水厂信息
|
|
|
List<BizDevice> bizDevices = this.bizDeviceMapper.selectBizDeviceList(BizDevice.builder().deviceNo(deviceNo).build());
|
|
|
if(!CollectionUtils.isEmpty(bizDevices)){
|
|
|
//水厂
|
|
|
+ /*log.info("化验对应的设备id为{}", bizDevices.get(0).getDeviceWorks());
|
|
|
List<BizWaterWork> bizWaterWorks = this.bizWaterWorkMapper.selectBizWaterWorkList(BizWaterWork.builder().worksId(bizDevices.get(0).getDeviceWorks()).build());
|
|
|
if(!CollectionUtils.isEmpty(bizWaterWorks)){
|
|
|
assayQualityDetailRes.setWorksName(bizWaterWorks.get(0).getWorksName());
|
|
|
+ }*/
|
|
|
+ Long deviceWorks = bizDevices.get(0).getDeviceWorks();
|
|
|
+ if(Objects.isNull(deviceWorks)){
|
|
|
+ log.error("通过化验结果的化验设备编号查询设备记录时,没有查询到设备记录,导致无法获取水厂信息");
|
|
|
+ }else{
|
|
|
+ BizWaterWork bizWaterWork = this.bizWaterWorkMapper.selectBizWaterWorkByWorksId(deviceWorks);
|
|
|
+ if(!Objects.isNull(bizWaterWork)){
|
|
|
+ assayQualityDetailRes.setWorksName(bizWaterWork.getWorksName());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
//处理统计信息
|
|
@@ -227,31 +241,40 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
}
|
|
|
//处理总的合格率
|
|
|
Double totalDeviationRate = 0D;
|
|
|
+ int index = 0;
|
|
|
if(!Objects.isNull(highCodDeviationRate)){
|
|
|
totalDeviationRate += highCodDeviationRate;
|
|
|
+ index++;
|
|
|
}
|
|
|
if(!Objects.isNull(lowCodDeviationRate)){
|
|
|
totalDeviationRate += lowCodDeviationRate;
|
|
|
+ index++;
|
|
|
}
|
|
|
if(!Objects.isNull(anDanDeviationRate)){
|
|
|
totalDeviationRate += anDanDeviationRate;
|
|
|
+ index++;
|
|
|
}
|
|
|
if(!Objects.isNull(tnDeviationRate)){
|
|
|
totalDeviationRate += tnDeviationRate;
|
|
|
+ index++;
|
|
|
}
|
|
|
if(!Objects.isNull(tpDeviationRate)){
|
|
|
totalDeviationRate += tpDeviationRate;
|
|
|
+ index++;
|
|
|
}
|
|
|
if(!Objects.isNull(zlsyDeviationRate)){
|
|
|
totalDeviationRate += zlsyDeviationRate;
|
|
|
+ index++;
|
|
|
}
|
|
|
if(!Objects.isNull(yxsydDeviationRate)){
|
|
|
totalDeviationRate += yxsydDeviationRate;
|
|
|
+ index++;
|
|
|
}
|
|
|
if(!Objects.isNull(xsydDeviationRate)){
|
|
|
totalDeviationRate += xsydDeviationRate;
|
|
|
+ index++;
|
|
|
}
|
|
|
- assayQualityDetailRes.setTotalDeviationRate(NumberUtils.getDoublePercentAndNLength(INT_4, totalDeviationRate / 8, INT_2));
|
|
|
+ assayQualityDetailRes.setTotalDeviationRate(NumberUtils.getDoublePercentAndNLength(INT_4, totalDeviationRate / index, INT_2));
|
|
|
result.add(assayQualityDetailRes);
|
|
|
});
|
|
|
}
|
|
@@ -267,9 +290,18 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
assayDetailRes.setDeviceWorks(bizDevices.get(0).getDeviceWorks());
|
|
|
}
|
|
|
//水厂
|
|
|
- List<BizWaterWork> bizWaterWorks = this.bizWaterWorkMapper.selectBizWaterWorkList(BizWaterWork.builder().worksId(assayDetailRes.getDeviceWorks()).build());
|
|
|
+ /*List<BizWaterWork> bizWaterWorks = this.bizWaterWorkMapper.selectBizWaterWorkList(BizWaterWork.builder().worksId(assayDetailRes.getDeviceWorks()).build());
|
|
|
if(!CollectionUtils.isEmpty(bizWaterWorks)){
|
|
|
assayDetailRes.setWorksName(bizWaterWorks.get(0).getWorksName());
|
|
|
+ }*/
|
|
|
+ Long deviceWorks = bizDevices.get(0).getDeviceWorks();
|
|
|
+ if(Objects.isNull(deviceWorks)){
|
|
|
+ log.error("通过化验结果的化验设备编号查询设备记录时,没有查询到设备记录,导致无法获取水厂信息");
|
|
|
+ }else{
|
|
|
+ BizWaterWork bizWaterWork = this.bizWaterWorkMapper.selectBizWaterWorkByWorksId(deviceWorks);
|
|
|
+ if(!Objects.isNull(bizWaterWork)){
|
|
|
+ assayDetailRes.setWorksName(bizWaterWork.getWorksName());
|
|
|
+ }
|
|
|
}
|
|
|
//通过化验编号查询所有的化验明细,然后根据类型计算对应的
|
|
|
List<ZAssayResult> zAssayResults = this.zAssayResultMapper.selectZAssayResultList(ZAssayResult.builder().assayNo(assayNo).assayType("3").build());
|