|
@@ -0,0 +1,129 @@
|
|
|
+package com.slibra.common.utils.format;
|
|
|
+
|
|
|
+import com.alibaba.fastjson2.JSON;
|
|
|
+import com.slibra.common.DecimalUtils;
|
|
|
+import com.slibra.common.constant.MyConstants;
|
|
|
+import com.slibra.common.core.domain.DecisionReq;
|
|
|
+import com.slibra.common.core.domain.TXinyiDaily;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
+import static com.slibra.common.constant.MyConstants.*;
|
|
|
+
|
|
|
+public class WaterFormat {
|
|
|
+
|
|
|
+ public static DecisionReq getWaterDecimationData(DecisionReq decisionReq, TXinyiDaily daily ) {
|
|
|
+ // 格式化小数
|
|
|
+ // 溶解氧1位 碳源投加量 2位 其他都是整数
|
|
|
+ decisionReq.setCodIn(DecimalUtils.getAbsAndScale(decisionReq.getCodIn(), INT_0));
|
|
|
+ decisionReq.setCodInName(DecimalUtils.getAbsAndScale(decisionReq.getCodInName(), INT_0));
|
|
|
+ decisionReq.setCodOff(DecimalUtils.getAbsAndScale(decisionReq.getCodOff(), INT_0));
|
|
|
+ decisionReq.setCodOffName(DecimalUtils.getAbsAndScale(decisionReq.getCodOffName(), INT_0));
|
|
|
+ decisionReq.setCodOffCon(DecimalUtils.getAbsAndScale(decisionReq.getCodOffCon(), INT_0));
|
|
|
+ decisionReq.setTpIn(DecimalUtils.getAbsAndScale(decisionReq.getTpIn(), INT_0));
|
|
|
+ decisionReq.setTpInName(DecimalUtils.getAbsAndScale(decisionReq.getTpInName(), INT_0));
|
|
|
+ decisionReq.setTpOff(DecimalUtils.getAbsAndScale(decisionReq.getTpOff(), INT_0));
|
|
|
+ decisionReq.setTpOffName(DecimalUtils.getAbsAndScale(decisionReq.getTpOffName(), INT_0));
|
|
|
+ decisionReq.setTpOffCon(DecimalUtils.getAbsAndScale(decisionReq.getTpOffCon(), INT_0));
|
|
|
+ decisionReq.setTnIn(DecimalUtils.getAbsAndScale(decisionReq.getTnIn(), INT_0));
|
|
|
+ decisionReq.setTnInName(DecimalUtils.getAbsAndScale(decisionReq.getTnInName(), INT_0));
|
|
|
+ decisionReq.setTnOff(DecimalUtils.getAbsAndScale(decisionReq.getTnOff(), INT_0));
|
|
|
+ decisionReq.setTnOffName(DecimalUtils.getAbsAndScale(decisionReq.getTnOffName(), INT_0));
|
|
|
+ decisionReq.setTnOffCon(DecimalUtils.getAbsAndScale(decisionReq.getTnOffCon(), INT_0));
|
|
|
+ decisionReq.setAddanIn(DecimalUtils.getAbsAndScale(decisionReq.getAddanIn(), INT_0));
|
|
|
+ decisionReq.setAddanInName(DecimalUtils.getAbsAndScale(decisionReq.getAddanInName(), INT_0));
|
|
|
+ decisionReq.setAndanOff(DecimalUtils.getAbsAndScale(decisionReq.getAndanOff(), INT_0));
|
|
|
+ decisionReq.setAndanOffName(DecimalUtils.getAbsAndScale(decisionReq.getAndanOffName(), INT_0));
|
|
|
+ decisionReq.setAndanOffCon(DecimalUtils.getAbsAndScale(decisionReq.getAndanOffCon(), INT_0));
|
|
|
+ decisionReq.setSsIn(DecimalUtils.getAbsAndScale(decisionReq.getSsIn(), INT_0));
|
|
|
+ decisionReq.setSsInName(DecimalUtils.getAbsAndScale(decisionReq.getSsInName(), INT_0));
|
|
|
+ decisionReq.setSsOff(DecimalUtils.getAbsAndScale(decisionReq.getSsOff(), INT_0));
|
|
|
+ decisionReq.setSsOffName(DecimalUtils.getAbsAndScale(decisionReq.getSsOffName(), INT_0));
|
|
|
+ decisionReq.setSsOffCon(DecimalUtils.getAbsAndScale(decisionReq.getSsOffCon(), INT_0));
|
|
|
+ decisionReq.setTdsIn(DecimalUtils.getAbsAndScale(decisionReq.getTdsIn(), INT_0));
|
|
|
+ decisionReq.setTdsInName(DecimalUtils.getAbsAndScale(decisionReq.getTdsInName(), INT_0));
|
|
|
+ decisionReq.setT(DecimalUtils.getAbsAndScale(daily.getJsSw(), MyConstants.INT_0));
|
|
|
+ decisionReq.setPH(DecimalUtils.getAbsAndScale(decisionReq.getPH(), INT_0));
|
|
|
+ decisionReq.setQIn(DecimalUtils.getAbsAndScale(decisionReq.getQIn(), INT_0));
|
|
|
+ decisionReq.setQInName(DecimalUtils.getAbsAndScale(decisionReq.getQInName(), INT_0));
|
|
|
+ decisionReq.setCheckRise(DecimalUtils.getAbsAndScaleStr(decisionReq.getCheckRise(), INT_0));
|
|
|
+ decisionReq.setSVI(DecimalUtils.getAbsForArray(daily.getWntjzsAll(), INT_0));
|
|
|
+ decisionReq.setSviCon(DecimalUtils.getAbsAndScale(decisionReq.getSviCon(), INT_0));
|
|
|
+ decisionReq.setSV(DecimalUtils.getAbsForArray(daily.getWncjbAll(), INT_0));
|
|
|
+ decisionReq.setSvCon(DecimalUtils.getAbsAndScale(decisionReq.getSviCon(), INT_0));
|
|
|
+ decisionReq.setMlvss(DecimalUtils.getAbsForArray(daily.getHfxwnndAll(), INT_0));
|
|
|
+ decisionReq.setMlss(DecimalUtils.getAbsForArray(daily.getHycWnndAll(), INT_0));
|
|
|
+ decisionReq.setMlvssWentai(DecimalUtils.getAbsAndScaleStr(decisionReq.getMlvssWentai(), INT_0));
|
|
|
+ decisionReq.setMlssWentai(DecimalUtils.getAbsAndScaleStr(decisionReq.getMlssWentai(), INT_0));
|
|
|
+ decisionReq.setDoAna(DecimalUtils.getAbsForArray(daily.getYycRjyAll(), INT_1));
|
|
|
+ decisionReq.setDoO(DecimalUtils.getAbsForArray(daily.getHycRjyAll(), INT_1));
|
|
|
+ decisionReq.setDoQue(DecimalUtils.getAbsForArray(daily.getQycRjyAll(), INT_1));
|
|
|
+ // decisionReq.setDoQueWentai(DecimalUtils.getAbsAndScaleStr(decisionReq.getDoQueWentai(), INT_0));
|
|
|
+ // decisionReq.setDoAnaWentai(DecimalUtils.getAbsAndScaleStr(decisionReq.getDoAnaWentai(), INT_0));
|
|
|
+ // decisionReq.setDoOWentai(DecimalUtils.getAbsAndScaleStr(decisionReq.getDoAnaWentai(), INT_0));
|
|
|
+ decisionReq.setC(DecimalUtils.getAbsAndScale(decisionReq.getC(), INT_0));
|
|
|
+ decisionReq.setB(DecimalUtils.getAbsAndScale(decisionReq.getB(), INT_0));
|
|
|
+ decisionReq.setBtpWending(DecimalUtils.getAbsAndScaleStr(decisionReq.getBtpWending(), INT_0));
|
|
|
+ decisionReq.setJsTnWentai(DecimalUtils.getAbsAndScaleStr(decisionReq.getJsTnWentai(), INT_0));
|
|
|
+ decisionReq.setClP04YCZ(DecimalUtils.getAbsAndScale(decisionReq.getClP04YCZ(), INT_0));
|
|
|
+ decisionReq.setTpLv(DecimalUtils.getAbsAndScale(decisionReq.getTpLv(), INT_0));
|
|
|
+ decisionReq.setTpLvContinuity(DecimalUtils.getAbsAndScale(decisionReq.getTpLvContinuity(), INT_0));
|
|
|
+ // 碳源投加量 2位
|
|
|
+ decisionReq.setTyjyl(DecimalUtils.getAbsAndScaleStr(decisionReq.getTyjyl(), INT_2));
|
|
|
+ decisionReq.setCltjl(DecimalUtils.getAbsAndScaleStr(decisionReq.getCltjl(), INT_0));
|
|
|
+ decisionReq.setHycxsyAll(DecimalUtils.getAbsForArray(decisionReq.getHycxsyAll(), INT_0));
|
|
|
+ decisionReq.setQyanAll(DecimalUtils.getAbsForArray(decisionReq.getQyanAll(), INT_0));
|
|
|
+ decisionReq.setQyckxsyAll(DecimalUtils.getAbsForArray(decisionReq.getQyckxsyAll(), INT_0));
|
|
|
+ decisionReq.setGwnl(DecimalUtils.getAbsAndScale(daily.getGWNL(), INT_0));
|
|
|
+ decisionReq.setEccZl(DecimalUtils.getAbsAndScaleStr(decisionReq.getEccZl(), INT_0));
|
|
|
+ decisionReq.setHyzlsyAll(DecimalUtils.getAbsForArray(decisionReq.getHyzlsyAll(), INT_0));
|
|
|
+ decisionReq.setR(DecimalUtils.getAbsAndScale(daily.getNhlR(), INT_0));
|
|
|
+ decisionReq.setRR(DecimalUtils.getAbsAndScale(daily.getWhlR(), INT_0));
|
|
|
+ BigDecimal jsBod5 = daily.getJsBod5();
|
|
|
+ BigDecimal tpIn = decisionReq.getTpIn();
|
|
|
+ BigDecimal tnIn = decisionReq.getTnIn();
|
|
|
+ decisionReq.setBodIn(DecimalUtils.getAbsAndScale(daily.getJsBod5(), INT_0));
|
|
|
+ if(!Objects.isNull(jsBod5)){
|
|
|
+ if(!Objects.isNull(tpIn) && tpIn.compareTo(new BigDecimal("0")) >0){
|
|
|
+ decisionReq.setC(DecimalUtils.getAbsAndScale(jsBod5.divide(tpIn, 4, RoundingMode.HALF_UP), INT_0));
|
|
|
+ }
|
|
|
+ if(!Objects.isNull(tnIn) && tnIn.compareTo(new BigDecimal("0")) >0){
|
|
|
+ decisionReq.setC(DecimalUtils.getAbsAndScale(jsBod5.divide(tnIn, 4, RoundingMode.HALF_UP), INT_0));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // decisionReq.setT(DecimalUtils.getAbsAndScale(daily.getJsSw(), MyConstants.INT_0));
|
|
|
+ // decisionReq.setSVI(daily.getWntjzsAll());
|
|
|
+ // decisionReq.setSV(daily.getWncjbAll());
|
|
|
+ // decisionReq.setMlvss(daily.getHfxwnndAll());
|
|
|
+ //2024年7月2日17:20:12 mlss和DO_O也要从日报获取
|
|
|
+ // decisionReq.setMlss(daily.getHycWnndAll());
|
|
|
+ // decisionReq.setDoO(daily.getHycRjyAll());
|
|
|
+ // decisionReq.setDoAna(daily.getYycRjyAll());
|
|
|
+ // decisionReq.setDoQue(daily.getQycRjyAll());
|
|
|
+ //2024年5月26日11:59:02 干污泥量数据做了同步
|
|
|
+ // decisionReq.setGwnl(daily.getGWNL());
|
|
|
+ // BigDecimal jsBod5 = daily.getJsBod5();
|
|
|
+ // decisionReq.setBodIn(jsBod5);
|
|
|
+ // BigDecimal tpIn = decisionReq.getTpIn();
|
|
|
+ // BigDecimal tnIn = decisionReq.getTnIn();
|
|
|
+ // if(!Objects.isNull(jsBod5)){
|
|
|
+ // if(!Objects.isNull(tpIn) && tpIn.compareTo(new BigDecimal("0")) >0){
|
|
|
+ // decisionReq.setC(jsBod5.divide(tpIn, 4, RoundingMode.HALF_UP));
|
|
|
+ // }
|
|
|
+ // if(!Objects.isNull(tnIn) && tnIn.compareTo(new BigDecimal("0")) >0){
|
|
|
+ // decisionReq.setB(jsBod5.divide(tnIn, 4, RoundingMode.HALF_UP));
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //2024年6月1日08:37:09 内回流加上
|
|
|
+ // decisionReq.setR(daily.getNhlR());
|
|
|
+ // decisionReq.setRR(daily.getWhlR());
|
|
|
+ return decisionReq;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|