|
@@ -147,7 +147,7 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
BigDecimal wsHsytkhCsCod = tXinyiCarbonMajor.getWsHsytkhCsCod();
|
|
|
BigDecimal wsHsytkhCo2 = null;
|
|
|
if(!Objects.isNull(wsHsytkhClsl) && !Objects.isNull(wsHsytkhJsCod) && !Objects.isNull(wsHsytkhCsCod)){
|
|
|
- wsHsytkhCo2 = (wsHsytkhJsCod.subtract(wsHsytkhCsCod)).abs().multiply(wsHsytkhClsl).multiply(BigDecimal_0_56).multiply(BigDecimal_0_1).divide(BigDecimal_1000000, NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ wsHsytkhCo2 = DecimalUtils.getNLengthHalfUp((wsHsytkhJsCod.subtract(wsHsytkhCsCod)).abs().multiply(wsHsytkhClsl).multiply(BigDecimal_0_56).multiply(BigDecimal_0_1).divide(BigDecimal_1000000, NUMBER_SCALE_6, RoundingMode.HALF_UP), INT_2);
|
|
|
tXinyiCarbonMajorUpdate.setWsHsytkhCo2(wsHsytkhCo2);
|
|
|
}
|
|
|
BigDecimal wsSjclCh4Clsl = tXinyiCarbonMajor.getWsSjclCh4Clsl();
|
|
@@ -163,10 +163,10 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
}
|
|
|
//判断是否有实测
|
|
|
if(!Objects.isNull(wsSjclCh4Tsb) && !Objects.isNull(wsSjclCh4Csc)){//有实测
|
|
|
- wsSjclCh4Co2 = ((wsSjclCh4JsCod.subtract(wsSjclCh4CsCod)).abs().multiply(wsSjclCh4Clsl).multiply(wsSjclCh4Pfyz).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP).add(wsSjclCh4Tsb).add(wsSjclCh4Csc)).multiply(BigDecimal_28).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ wsSjclCh4Co2 = DecimalUtils.getNLengthHalfUp(((wsSjclCh4JsCod.subtract(wsSjclCh4CsCod)).abs().multiply(wsSjclCh4Clsl).multiply(wsSjclCh4Pfyz).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP).add(wsSjclCh4Tsb).add(wsSjclCh4Csc)).multiply(BigDecimal_28).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP), INT_2);
|
|
|
tXinyiCarbonMajorUpdate.setWsSjclCh4Co2(wsSjclCh4Co2);
|
|
|
}else{//没有实测
|
|
|
- wsSjclCh4Co2 = (wsSjclCh4JsCod.subtract(wsSjclCh4CsCod)).abs().multiply(wsSjclCh4Clsl).multiply(wsSjclCh4Pfyz).multiply((BigDecimal_1.add(BigDecimal_0_2))).multiply(BigDecimal_28).divide(BigDecimal_1000000, NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ wsSjclCh4Co2 = DecimalUtils.getNLengthHalfUp((wsSjclCh4JsCod.subtract(wsSjclCh4CsCod)).abs().multiply(wsSjclCh4Clsl).multiply(wsSjclCh4Pfyz).multiply((BigDecimal_1.add(BigDecimal_0_2))).multiply(BigDecimal_28).divide(BigDecimal_1000000, NUMBER_SCALE_6, RoundingMode.HALF_UP), INT_2);
|
|
|
tXinyiCarbonMajorUpdate.setWsSjclCh4Co2(wsSjclCh4Co2);
|
|
|
}
|
|
|
}
|
|
@@ -180,7 +180,7 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
if(Objects.isNull(wsTdN2oPfyz)){
|
|
|
wsTdN2oPfyz = BigDecimal_0_01;
|
|
|
}
|
|
|
- wsTdN2oCo2 = (wsTdN2oJsTn.subtract(wsTdN2oCsTn)).abs().multiply(wsTdN2oClsl).multiply(wsTdN2oPfyz).multiply(BigDecimal_265).multiply(BigDecimal_44).divide(BigDecimal_28, NUMBER_SCALE_6, RoundingMode.HALF_UP).divide(BigDecimal_1000000, NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ wsTdN2oCo2 = DecimalUtils.getNLengthHalfUp((wsTdN2oJsTn.subtract(wsTdN2oCsTn)).abs().multiply(wsTdN2oClsl).multiply(wsTdN2oPfyz).multiply(BigDecimal_265).multiply(BigDecimal_44).divide(BigDecimal_28, NUMBER_SCALE_6, RoundingMode.HALF_UP).divide(BigDecimal_1000000, NUMBER_SCALE_6, RoundingMode.HALF_UP), INT_2);
|
|
|
tXinyiCarbonMajorUpdate.setWsTdN2oCo2(wsTdN2oCo2);
|
|
|
}
|
|
|
|
|
@@ -212,7 +212,7 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
//总耗电
|
|
|
nyyjDlxhZhdl = tXinyiCarbonMajor.getNyyjDlxhZhdl();
|
|
|
if(!Objects.isNull(nyyjDlxhZhdl)){
|
|
|
- nyyjDlxhZhdlCo2 = nyyjDlxhZhdl.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ nyyjDlxhZhdlCo2 = DecimalUtils.getNLengthHalfUp(nyyjDlxhZhdl.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP), INT_2);
|
|
|
tXinyiCarbonMajorUpdate.setNyyjDlxhZhdlCo2(nyyjDlxhZhdlCo2);
|
|
|
}
|
|
|
|
|
@@ -286,7 +286,7 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
BigDecimal nyyjGrrlCo2 = null;
|
|
|
//2024年08月27日17:21:58 计算的时候,不用nyyjGrrlRl了,用前面的2个值,计算出来热力nyyjGrrlRl
|
|
|
if(!Objects.isNull(nyyjGrrlZq) && !Objects.isNull(nyyjGrrlDyhz)){
|
|
|
- nyyjGrrlCo2 = (nyyjGrrlDyhz.subtract(BigDecimal_83_74)).abs().multiply(nyyjGrrlZq).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP).multiply(BigDecimal_110000).divide(BigDecimal_1000000, NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ nyyjGrrlCo2 = DecimalUtils.getNLengthHalfUp((nyyjGrrlDyhz.subtract(BigDecimal_83_74)).abs().multiply(nyyjGrrlZq).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP).multiply(BigDecimal_110000).divide(BigDecimal_1000000, NUMBER_SCALE_6, RoundingMode.HALF_UP), INT_2);
|
|
|
tXinyiCarbonMajorUpdate.setNyyjGrrlCo2(nyyjGrrlCo2);
|
|
|
}
|
|
|
|
|
@@ -317,7 +317,7 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
BigDecimal wnclYyzqChZlfs = tXinyiCarbonMajor.getWnclYyzqChZlfs();
|
|
|
BigDecimal wnclYyzqCo2 = null;
|
|
|
if(!Objects.isNull(wnclYyzqZqcl) && !Objects.isNull(wnclYyzqChZlfs)){
|
|
|
- wnclYyzqCo2 = wnclYyzqZqcl.multiply(wnclYyzqChZlfs).multiply(BigDecimal_0_05).multiply(BigDecimal_28).multiply(BigDecimal_16).divide(BigDecimal_22_4, NUMBER_SCALE_6, RoundingMode.HALF_UP).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP).divide(BigDecimal_100, NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ wnclYyzqCo2 = DecimalUtils.getNLengthHalfUp(wnclYyzqZqcl.multiply(wnclYyzqChZlfs).multiply(BigDecimal_0_05).multiply(BigDecimal_28).multiply(BigDecimal_16).divide(BigDecimal_22_4, NUMBER_SCALE_6, RoundingMode.HALF_UP).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP).divide(BigDecimal_100, NUMBER_SCALE_6, RoundingMode.HALF_UP), INT_2);
|
|
|
tXinyiCarbonMajorUpdate.setWnclYyzqCo2(wnclYyzqCo2);
|
|
|
}
|
|
|
|
|
@@ -331,7 +331,7 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
if(Objects.isNull(wnclDdclPfyz)){
|
|
|
wnclDdclPfyz = BigDecimal_0_01;
|
|
|
}
|
|
|
- wnclDdclCo2 = (wnclDdclClqnd.subtract(wnclDdclClhnd)).abs().multiply(wnclDdclZycll).multiply(wnclDdclPfyz).multiply(BigDecimal_265).multiply(BigDecimal_44).divide(BigDecimal_28, NUMBER_SCALE_6, RoundingMode.HALF_UP).divide(BigDecimal_1000000, NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ wnclDdclCo2 = DecimalUtils.getNLengthHalfUp((wnclDdclClqnd.subtract(wnclDdclClhnd)).abs().multiply(wnclDdclZycll).multiply(wnclDdclPfyz).multiply(BigDecimal_265).multiply(BigDecimal_44).divide(BigDecimal_28, NUMBER_SCALE_6, RoundingMode.HALF_UP).divide(BigDecimal_1000000, NUMBER_SCALE_6, RoundingMode.HALF_UP), INT_2);
|
|
|
tXinyiCarbonMajorUpdate.setWnclDdclCo2(wnclDdclCo2);
|
|
|
}
|
|
|
|
|
@@ -341,9 +341,9 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
BigDecimal wnclHyfjCh4Co2 = null;
|
|
|
BigDecimal wnclHyfjN2oCo2 = null;
|
|
|
if(!Objects.isNull(wnclHyfjFjl)){
|
|
|
- wnclHyfjCh4Co2 = wnclHyfjFjl.multiply(BigDecimal_10).multiply(BigDecimal_28).divide(BigDecimal_1000000, NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ wnclHyfjCh4Co2 = DecimalUtils.getNLengthHalfUp(wnclHyfjFjl.multiply(BigDecimal_10).multiply(BigDecimal_28).divide(BigDecimal_1000000, NUMBER_SCALE_6, RoundingMode.HALF_UP), INT_2);
|
|
|
tXinyiCarbonMajorUpdate.setWnclHyfjCh4Co2(wnclHyfjCh4Co2);
|
|
|
- wnclHyfjN2oCo2 = wnclHyfjFjl.multiply(BigDecimal_0_6).multiply(BigDecimal_265).divide(BigDecimal_1000000, NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ wnclHyfjN2oCo2 = DecimalUtils.getNLengthHalfUp(wnclHyfjFjl.multiply(BigDecimal_0_6).multiply(BigDecimal_265).divide(BigDecimal_1000000, NUMBER_SCALE_6, RoundingMode.HALF_UP), INT_2);
|
|
|
tXinyiCarbonMajorUpdate.setWnclHyfjN2oCo2(wnclHyfjN2oCo2);
|
|
|
}
|
|
|
|
|
@@ -353,7 +353,7 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
BigDecimal wnclWnfsCo2 = null;
|
|
|
|
|
|
if(!Objects.isNull(wnclWnfsXhl) && !Objects.isNull(wnclWnfsHtbl)){
|
|
|
- wnclWnfsCo2 = wnclWnfsXhl.multiply(wnclWnfsHtbl).multiply(BigDecimal_0_12).multiply(BigDecimal_44).divide(BigDecimal_12, NUMBER_SCALE_6, RoundingMode.HALF_UP).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP).divide(BigDecimal_100, NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ wnclWnfsCo2 = DecimalUtils.getNLengthHalfUp(wnclWnfsXhl.multiply(wnclWnfsHtbl).multiply(BigDecimal_0_12).multiply(BigDecimal_44).divide(BigDecimal_12, NUMBER_SCALE_6, RoundingMode.HALF_UP).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP).divide(BigDecimal_100, NUMBER_SCALE_6, RoundingMode.HALF_UP), INT_2);
|
|
|
tXinyiCarbonMajorUpdate.setWnclWnfsCo2(wnclWnfsCo2);
|
|
|
}
|
|
|
|
|
@@ -383,9 +383,9 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
//类型前端必须选,不选默认就是0
|
|
|
wnclBwqrsPfyz = BigDecimal.ZERO;
|
|
|
}*/
|
|
|
- wnclBwqrsCh4Co2 = wnclBwqrsFsl.multiply(wnclBwqrsPfyz).multiply(BigDecimal_28).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ wnclBwqrsCh4Co2 = DecimalUtils.getNLengthHalfUp(wnclBwqrsFsl.multiply(wnclBwqrsPfyz).multiply(BigDecimal_28).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP), INT_2);
|
|
|
tXinyiCarbonMajorUpdate.setWnclBwqrsCh4Co2(wnclBwqrsCh4Co2);
|
|
|
- wnclBwqrsN2oCo2 = wnclBwqrsFsl.multiply(Objects.isNull(wnclBwqrsPfyzOnlyForN2o) ? BigDecimal_0_99 : wnclBwqrsPfyzOnlyForN2o).multiply(BigDecimal_265).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ wnclBwqrsN2oCo2 = DecimalUtils.getNLengthHalfUp(wnclBwqrsFsl.multiply(Objects.isNull(wnclBwqrsPfyzOnlyForN2o) ? BigDecimal_0_99 : wnclBwqrsPfyzOnlyForN2o).multiply(BigDecimal_265).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP), INT_2);
|
|
|
tXinyiCarbonMajorUpdate.setWnclBwqrsN2oCo2(wnclBwqrsN2oCo2);
|
|
|
}
|
|
|
|
|
@@ -394,7 +394,7 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
BigDecimal wnclWnrjByhHtbl = tXinyiCarbonMajor.getWnclWnrjByhHtbl();
|
|
|
BigDecimal wnclWnrjByhCo2 = null;
|
|
|
if(!Objects.isNull(wnclWnrjByhHtbl) && !Objects.isNull(wnclWnrjByhXhl)){
|
|
|
- wnclWnrjByhCo2 = wnclWnrjByhXhl.multiply(wnclWnrjByhHtbl).multiply(BigDecimal_0_12).multiply(BigDecimal_44).divide(BigDecimal_12, NUMBER_SCALE_6, RoundingMode.HALF_UP).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP).divide(BigDecimal_100, NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ wnclWnrjByhCo2 = DecimalUtils.getNLengthHalfUp(wnclWnrjByhXhl.multiply(wnclWnrjByhHtbl).multiply(BigDecimal_0_12).multiply(BigDecimal_44).divide(BigDecimal_12, NUMBER_SCALE_6, RoundingMode.HALF_UP).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP).divide(BigDecimal_100, NUMBER_SCALE_6, RoundingMode.HALF_UP), INT_2);
|
|
|
tXinyiCarbonMajorUpdate.setWnclWnrjByhCo2(wnclWnrjByhCo2);
|
|
|
}
|
|
|
|
|
@@ -428,9 +428,9 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- wnclWnrjQtCh4Co2 = wnclWnrjQtXhl.multiply(wnclWnrjQtPfyzCh4).multiply(BigDecimal_28).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ wnclWnrjQtCh4Co2 = DecimalUtils.getNLengthHalfUp(wnclWnrjQtXhl.multiply(wnclWnrjQtPfyzCh4).multiply(BigDecimal_28).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP), INT_2);
|
|
|
tXinyiCarbonMajorUpdate.setWnclWnrjQtCh4Co2(wnclWnrjQtCh4Co2);
|
|
|
- wnclWnrjQtN2oCo2 = wnclWnrjQtXhl.multiply(wnclWnrjQtPfyzN2o).multiply(BigDecimal_265).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ wnclWnrjQtN2oCo2 = DecimalUtils.getNLengthHalfUp(wnclWnrjQtXhl.multiply(wnclWnrjQtPfyzN2o).multiply(BigDecimal_265).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP), INT_2);
|
|
|
tXinyiCarbonMajorUpdate.setWnclWnrjQtN2oCo2(wnclWnrjQtN2oCo2);
|
|
|
}
|
|
|
|
|
@@ -474,7 +474,7 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
BigDecimal thGfZhdl = tXinyiCarbonMajor.getThGfZhdl();
|
|
|
BigDecimal thGfCo2 = null;
|
|
|
if(!Objects.isNull(thGfZhdl) && !Objects.isNull(yz)){
|
|
|
- thGfCo2 = thGfZhdl.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ thGfCo2 = DecimalUtils.getNLengthHalfUp(thGfZhdl.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP), INT_2);
|
|
|
tXinyiCarbonMajorUpdate.setThGfCo2(thGfCo2);
|
|
|
}
|
|
|
|
|
@@ -493,7 +493,7 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
}else {
|
|
|
thZssCo2Yz = BigDecimal.ZERO;
|
|
|
}
|
|
|
- thZssCo2 = ((BigDecimal_0_2.add(BigDecimal_0_5).subtract(BigDecimal_0_5)).abs().multiply(yz).add(thZssCo2Yz)).multiply(thZssGyl).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ thZssCo2 = DecimalUtils.getNLengthHalfUp(((BigDecimal_0_2.add(BigDecimal_0_5).subtract(BigDecimal_0_5)).abs().multiply(yz).add(thZssCo2Yz)).multiply(thZssGyl).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP), INT_2);
|
|
|
tXinyiCarbonMajorUpdate.setThZssCo2(thZssCo2);
|
|
|
}
|
|
|
|
|
@@ -501,7 +501,7 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
BigDecimal thWnClhFlwnl = tXinyiCarbonMajor.getThWnClhFlwnl();
|
|
|
BigDecimal thWnClhCo2 = null;
|
|
|
if(!Objects.isNull(thWnClhFlwnl)){
|
|
|
- thWnClhCo2 = ((BigDecimal_0_03.multiply(BigDecimal_0_61).multiply(BigDecimal_2_116)).add((BigDecimal_0_006.multiply(BigDecimal_0_7).multiply(BigDecimal_1_45)))).multiply(thWnClhFlwnl).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ thWnClhCo2 = DecimalUtils.getNLengthHalfUp(((BigDecimal_0_03.multiply(BigDecimal_0_61).multiply(BigDecimal_2_116)).add((BigDecimal_0_006.multiply(BigDecimal_0_7).multiply(BigDecimal_1_45)))).multiply(thWnClhFlwnl).divide(BigDecimal_1000, NUMBER_SCALE_6, RoundingMode.HALF_UP), INT_2);
|
|
|
tXinyiCarbonMajorUpdate.setThWnClhCo2(thWnClhCo2);
|
|
|
}
|
|
|
//替碳、碳汇替总碳量
|
|
@@ -532,7 +532,8 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
//计算各个大类和总的co2
|
|
|
BigDecimal ztTotalCo2 = wsclTotalCo2.add(nyyjTotalCo2).add(wnclTotalCo2).subtract(ttthTotalCo2);
|
|
|
if(ztTotalCo2.compareTo(BigDecimal.ZERO) != 0){//这里计算取了个巧,默认它是0,否则需要多很多判断
|
|
|
- tXinyiCarbonMajorUpdate.setZtTotalCo2(ztTotalCo2);
|
|
|
+ //2024年09月12日17:20:53 这里要取整数
|
|
|
+ tXinyiCarbonMajorUpdate.setZtTotalCo2(DecimalUtils.getNLengthHalfUp(ztTotalCo2, INT_0));
|
|
|
}
|
|
|
|
|
|
//处理百分比信息
|
|
@@ -555,8 +556,8 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
BigDecimal avgJsl = this.tXinyiCarbonMajorMapper.selectSumJslByMonth(addYearMonth.replaceAll("-", "/"));
|
|
|
if(!Objects.isNull(avgJsl)){
|
|
|
//2024年08月27日09:36:14 计算公式有调整:再乘以10的三次方。
|
|
|
- BigDecimal wschytpfqd = ztTotalCo2.divide(avgJsl, NUMBER_SCALE_6, RoundingMode.HALF_UP).multiply(BigDecimal_1000);
|
|
|
- tXinyiCarbonMajorUpdate.setWschytpfqd(wschytpfqd);
|
|
|
+ BigDecimal wschytpfqd = ztTotalCo2.divide(avgJsl, NUMBER_SCALE_10, RoundingMode.HALF_UP).multiply(BigDecimal_1000);
|
|
|
+ tXinyiCarbonMajorUpdate.setWschytpfqd(DecimalUtils.getNLengthHalfUp(wschytpfqd, NUMBER_SCALE_2));
|
|
|
BigDecimal avgCod = this.tXinyiCarbonMajorMapper.selectAvgCodByMonth(addYearMonth.replaceAll("-", "/"));
|
|
|
//从字典获取不同cod对应的标准
|
|
|
if(!Objects.isNull(avgCod)){
|
|
@@ -603,18 +604,18 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
}
|
|
|
//2024年08月30日14:08:19 计算公式 不统一,并且字段不太一致,所以需要TXinyiCarbonExtra表新增2个字段,代表四个含义。
|
|
|
if(type == BusinessEnum.CarbonExtraTeypEnum.ZERO.getCode()){
|
|
|
- return amount.multiply(new BigDecimal(sysDictData.getDictValue()).divide(BigDecimal_1000,NUMBER_SCALE_6, RoundingMode.HALF_UP));
|
|
|
+ return DecimalUtils.getNLengthHalfUp(amount.multiply(new BigDecimal(sysDictData.getDictValue()).divide(BigDecimal_1000,NUMBER_SCALE_10, RoundingMode.HALF_UP)), INT_2);
|
|
|
}else if(type == BusinessEnum.CarbonExtraTeypEnum.ONE.getCode()){
|
|
|
- return amount.multiply(new BigDecimal(sysDictData.getDictValue()).divide(BigDecimal_1000,NUMBER_SCALE_6, RoundingMode.HALF_UP));
|
|
|
+ return DecimalUtils.getNLengthHalfUp(amount.multiply(new BigDecimal(sysDictData.getDictValue()).divide(BigDecimal_1000,NUMBER_SCALE_10, RoundingMode.HALF_UP)), INT_2);
|
|
|
}else if(type == BusinessEnum.CarbonExtraTeypEnum.TWO.getCode()){
|
|
|
- return amount.multiply(new BigDecimal(sysDictData.getDictValue()).divide(BigDecimal_1000,NUMBER_SCALE_6, RoundingMode.HALF_UP));
|
|
|
+ return DecimalUtils.getNLengthHalfUp(amount.multiply(new BigDecimal(sysDictData.getDictValue()).divide(BigDecimal_1000,NUMBER_SCALE_10, RoundingMode.HALF_UP)), INT_2);
|
|
|
}else if(type == BusinessEnum.CarbonExtraTeypEnum.THREE.getCode()){
|
|
|
- return amount.multiply(new BigDecimal(sysDictData.getDictValue()).divide(BigDecimal_1000000000000,NUMBER_SCALE_6, RoundingMode.HALF_UP));
|
|
|
+ return DecimalUtils.getNLengthHalfUp(amount.multiply(new BigDecimal(sysDictData.getDictValue()).divide(BigDecimal_1000000000000,NUMBER_SCALE_10, RoundingMode.HALF_UP)), INT_2);
|
|
|
}else if(type == BusinessEnum.CarbonExtraTeypEnum.FOUR.getCode()){
|
|
|
- return Objects.isNull(yz) ? null : (amount.multiply(yz).add((lyl.multiply(new BigDecimal(sysDictData.getDictValue()))).add((hz.multiply(BigDecimal_0_0022))))).divide(BigDecimal_1000,NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ return Objects.isNull(yz) ? null : DecimalUtils.getNLengthHalfUp((amount.multiply(yz).add((lyl.multiply(new BigDecimal(sysDictData.getDictValue()))).add((hz.multiply(BigDecimal_0_0022))))).divide(BigDecimal_1000,NUMBER_SCALE_10, RoundingMode.HALF_UP), INT_2);
|
|
|
}else if(type == BusinessEnum.CarbonExtraTeypEnum.FIVE.getCode()){
|
|
|
//2024年09月05日13:49:11 公式调整,没有 沼气提纯并网的天然气量/对应焓值 这个参数了
|
|
|
- return Objects.isNull(yz) ? null : (amount.multiply(yz).add((lyl.multiply(new BigDecimal(sysDictData.getDictValue())).divide(BigDecimal_1000,NUMBER_SCALE_6, RoundingMode.HALF_UP)))).divide(BigDecimal_1000,NUMBER_SCALE_6, RoundingMode.HALF_UP);
|
|
|
+ return Objects.isNull(yz) ? null : DecimalUtils.getNLengthHalfUp((amount.multiply(yz).add((lyl.multiply(new BigDecimal(sysDictData.getDictValue())).divide(BigDecimal_1000,NUMBER_SCALE_10, RoundingMode.HALF_UP)))).divide(BigDecimal_1000,NUMBER_SCALE_10, RoundingMode.HALF_UP), INT_2);
|
|
|
}else {
|
|
|
log.error("暂不支持的类型");
|
|
|
throw new ServiceException("暂不支持的类型");
|
|
@@ -699,39 +700,40 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
List<TXinyiCarbonMajor> tXinyiCarbonMajors = this.tXinyiCarbonMajorMapper.selectTXinyiCarbonMajorList(TXinyiCarbonMajor.builder().addYearMonth(DateUtils.getMonthsBefore(addYearMonth, 1)).build());
|
|
|
if(!CollectionUtils.isEmpty(tXinyiCarbonMajors) && tXinyiCarbonMajors.size() == 1){
|
|
|
//污水处理碳排放量-环比上个月
|
|
|
+ //2024年09月12日16:17:45 修改bug: 1.不要取绝对值 2.当前月和上个月份的值取反了
|
|
|
TXinyiCarbonMajor tXinyiCarbonMajorLastMonth = tXinyiCarbonMajors.get(0);
|
|
|
- BigDecimal nowCo2 = tXinyiCarbonMajorLastMonth.getWsclTotalCo2();
|
|
|
- BigDecimal lastMonthCo2 = tXinyiCarbonMajor.getWsclTotalCo2();
|
|
|
+ BigDecimal lastMonthCo2 = tXinyiCarbonMajorLastMonth.getWsclTotalCo2();
|
|
|
+ BigDecimal nowCo2 = tXinyiCarbonMajor.getWsclTotalCo2();
|
|
|
if(!Objects.isNull(nowCo2) && !Objects.isNull(lastMonthCo2) && BigDecimal.ZERO.compareTo(lastMonthCo2) != 0){//除数不能为0
|
|
|
- tXinyiCarbonMajor.setWsclTotalCo2Hb(DecimalUtils.getAbsAndScale((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_6, RoundingMode.HALF_UP).multiply(BigDecimal_100) ,NUMBER_SCALE_2));
|
|
|
+ tXinyiCarbonMajor.setWsclTotalCo2Hb(DecimalUtils.getNLengthHalfUp((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_10, RoundingMode.HALF_UP).multiply(BigDecimal_100) ,NUMBER_SCALE_2));
|
|
|
}
|
|
|
|
|
|
//能源、药剂碳排量-环比上个月
|
|
|
- nowCo2 = tXinyiCarbonMajorLastMonth.getNyyjTotalCo2();
|
|
|
- lastMonthCo2 = tXinyiCarbonMajor.getNyyjTotalCo2();
|
|
|
+ lastMonthCo2 = tXinyiCarbonMajorLastMonth.getNyyjTotalCo2();
|
|
|
+ nowCo2 = tXinyiCarbonMajor.getNyyjTotalCo2();
|
|
|
if(!Objects.isNull(nowCo2) && !Objects.isNull(lastMonthCo2) && BigDecimal.ZERO.compareTo(lastMonthCo2) != 0){//除数不能为0
|
|
|
- tXinyiCarbonMajor.setNyyjTotalCo2Hb(DecimalUtils.getAbsAndScale((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_6, RoundingMode.HALF_UP).multiply(BigDecimal_100) ,NUMBER_SCALE_2));
|
|
|
+ tXinyiCarbonMajor.setNyyjTotalCo2Hb(DecimalUtils.getNLengthHalfUp((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_10, RoundingMode.HALF_UP).multiply(BigDecimal_100) ,NUMBER_SCALE_2));
|
|
|
}
|
|
|
|
|
|
//污泥处理碳排量-环比上个月
|
|
|
- nowCo2 = tXinyiCarbonMajorLastMonth.getWnclTotalCo2();
|
|
|
- lastMonthCo2 = tXinyiCarbonMajor.getWnclTotalCo2();
|
|
|
+ lastMonthCo2 = tXinyiCarbonMajorLastMonth.getWnclTotalCo2();
|
|
|
+ nowCo2 = tXinyiCarbonMajor.getWnclTotalCo2();
|
|
|
if(!Objects.isNull(nowCo2) && !Objects.isNull(lastMonthCo2) && BigDecimal.ZERO.compareTo(lastMonthCo2) != 0){//除数不能为0
|
|
|
- tXinyiCarbonMajor.setWnclTotalCo2Hb(DecimalUtils.getAbsAndScale((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_6, RoundingMode.HALF_UP).multiply(BigDecimal_100) ,NUMBER_SCALE_2));
|
|
|
+ tXinyiCarbonMajor.setWnclTotalCo2Hb(DecimalUtils.getNLengthHalfUp((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_10, RoundingMode.HALF_UP).multiply(BigDecimal_100) ,NUMBER_SCALE_2));
|
|
|
}
|
|
|
|
|
|
//替碳、碳汇替碳量-环比上个月
|
|
|
- nowCo2 = tXinyiCarbonMajorLastMonth.getTtthTotalCo2();
|
|
|
- lastMonthCo2 = tXinyiCarbonMajor.getTtthTotalCo2();
|
|
|
+ lastMonthCo2 = tXinyiCarbonMajorLastMonth.getTtthTotalCo2();
|
|
|
+ nowCo2 = tXinyiCarbonMajor.getTtthTotalCo2();
|
|
|
if(!Objects.isNull(nowCo2) && !Objects.isNull(lastMonthCo2) && BigDecimal.ZERO.compareTo(lastMonthCo2) != 0){//除数不能为0
|
|
|
- tXinyiCarbonMajor.setTtthTotalCo2Hb(DecimalUtils.getAbsAndScale((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_6, RoundingMode.HALF_UP).multiply(BigDecimal_100) ,NUMBER_SCALE_2));
|
|
|
+ tXinyiCarbonMajor.setTtthTotalCo2Hb(DecimalUtils.getNLengthHalfUp((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_10, RoundingMode.HALF_UP).multiply(BigDecimal_100) ,NUMBER_SCALE_2));
|
|
|
}
|
|
|
|
|
|
//总碳排放量-环比上个月
|
|
|
- nowCo2 = tXinyiCarbonMajorLastMonth.getZtTotalCo2();
|
|
|
- lastMonthCo2 = tXinyiCarbonMajor.getZtTotalCo2();
|
|
|
+ lastMonthCo2 = tXinyiCarbonMajorLastMonth.getZtTotalCo2();
|
|
|
+ nowCo2 = tXinyiCarbonMajor.getZtTotalCo2();
|
|
|
if(!Objects.isNull(nowCo2) && !Objects.isNull(lastMonthCo2) && BigDecimal.ZERO.compareTo(lastMonthCo2) != 0){//除数不能为0
|
|
|
- tXinyiCarbonMajor.setZtTotalCo2Hb(DecimalUtils.getAbsAndScale((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_6, RoundingMode.HALF_UP).multiply(BigDecimal_100) ,NUMBER_SCALE_2));
|
|
|
+ tXinyiCarbonMajor.setZtTotalCo2Hb(DecimalUtils.getNLengthHalfUp((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_10, RoundingMode.HALF_UP).multiply(BigDecimal_100) ,NUMBER_SCALE_2));
|
|
|
}
|
|
|
}
|
|
|
//最近7个月的数据集合
|
|
@@ -751,7 +753,7 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
//获取某个月份的平均进水cod
|
|
|
BigDecimal avgJsl = this.tXinyiCarbonMajorMapper.selectSumJslByMonth(addYearMonthTmp.replaceAll("-", "/"));
|
|
|
if(!Objects.isNull(avgJsl) && !Objects.isNull(ztTotalCo2)){
|
|
|
- chartBasic.setWschytpfqd(ztTotalCo2.divide(avgJsl, NUMBER_SCALE_6, RoundingMode.HALF_UP).multiply(BigDecimal_1000));
|
|
|
+ chartBasic.setWschytpfqd(DecimalUtils.getNLengthHalfUp(ztTotalCo2.divide(avgJsl, NUMBER_SCALE_10, RoundingMode.HALF_UP).multiply(BigDecimal_1000), NUMBER_SCALE_2));
|
|
|
}
|
|
|
recent7PflDatas.add(chartBasic);
|
|
|
}
|