vince
2023-07-05 169e829234045a236419fdf354e1f5acaf13c6df
igds-protocol-bhzn/src/main/java/com/ld/igds/protocol/bhzn/verb/analysis/AnalysisGas.java
@@ -18,6 +18,7 @@
import com.ld.igds.temp.dto.TempParam;
import com.ld.igds.util.BytesUtil;
import com.ld.igds.util.ContextUtil;
import com.ld.igds.util.NumberUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -79,6 +80,7 @@
        Integer[] n2ValArray = res209.getN2ValArray();
        Integer[] pH3ValArray = res209.getPH3ValArray();
        Integer[] cO2ValArray = res209.getCO2ValArray();
        double sumO2 = 0.0, sumCo2 = 0.0, sumPh3 = 0.0, sumN2 = 0.0;
        for (int i=0;i<res209.getCO2ValArray().length;i++){
            info = new GasInfo();
            info.setId(ContextUtil.buildInfoId(gas.getCompanyId(), gas.getDepotId(), gas.getBatchId()));
@@ -130,7 +132,10 @@
            if (info.getPerN2() < gas.getPerN2Min()) {
                gas.setPerN2Min(info.getPerN2());
            }
            sumO2 += info.getPerO2();
            sumCo2 += info.getPerCo2();
            sumPh3 += info.getPerPh3();
            sumN2 += info.getPerN2();
            //固定为:passCode,co2,o2,ph3,n2;passCode,co2,o2,ph3,n2;"
            sb.append(info.getPassCode());
            sb.append(",");
@@ -143,6 +148,13 @@
            sb.append(info.getPerN2());
            sb.append(";");
        }
        if(res209.getCO2ValArray().length>1){
            gas.setPerCo2(NumberUtil.keepPrecision(sumCo2/res209.getCO2ValArray().length, 2));
            gas.setPerO2(NumberUtil.keepPrecision(sumO2/res209.getCO2ValArray().length, 2));
            gas.setPerN2(NumberUtil.keepPrecision(sumN2/res209.getCO2ValArray().length, 2));
            gas.setPerPh3(NumberUtil.keepPrecision(sumPh3/res209.getCO2ValArray().length, 2));
        }
        gas.setPoints(sb.toString());
        gasService.saveInfoGas(items);