|
@@ -3,7 +3,6 @@ package com.slibra.business.service.impl;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
import com.alibaba.fastjson2.JSON;
|
|
import com.slibra.business.domain.TXinyiCarbonExtra;
|
|
import com.slibra.business.domain.TXinyiCarbonExtra;
|
|
@@ -29,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import static com.slibra.common.constant.MyConstants.*;
|
|
import static com.slibra.common.constant.MyConstants.*;
|
|
|
|
+import static org.apache.el.lang.ELArithmetic.divide;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 碳排放主Service业务层处理
|
|
* 碳排放主Service业务层处理
|
|
@@ -99,12 +99,25 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
int i = tXinyiCarbonMajorMapper.insertTXinyiCarbonMajor(tXinyiCarbonMajor);
|
|
int i = tXinyiCarbonMajorMapper.insertTXinyiCarbonMajor(tXinyiCarbonMajor);
|
|
Long id = tXinyiCarbonMajor.getId();
|
|
Long id = tXinyiCarbonMajor.getId();
|
|
log.info("要保存的主表的碳核查智能体的记录ID为{}", id);
|
|
log.info("要保存的主表的碳核查智能体的记录ID为{}", id);
|
|
|
|
+ //查看污水厂所在区域电力行业的平均CO2当量排放因子(kg CO2-eq/(kW·h))
|
|
|
|
+ Long provinceId = tXinyiCarbonMajor.getProvinceId();
|
|
|
|
+ BigDecimal yz = null;
|
|
|
|
+ if(!Objects.isNull(provinceId)) {
|
|
|
|
+ SysDictData sysDictData = this.sysDictDataMapper.selectDictDataById(provinceId);
|
|
|
|
+ if (Objects.nonNull(sysDictData)) {
|
|
|
|
+ String dictValue = sysDictData.getDictValue();
|
|
|
|
+ if (StringUtils.isNotBlank(dictValue)) {
|
|
|
|
+ yz = new BigDecimal(dictValue);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
//处理关联表
|
|
//处理关联表
|
|
List<TXinyiCarbonExtra> extraList = tXinyiCarbonMajor.getExtraList();
|
|
List<TXinyiCarbonExtra> extraList = tXinyiCarbonMajor.getExtraList();
|
|
if(!CollectionUtils.isEmpty(extraList)){
|
|
if(!CollectionUtils.isEmpty(extraList)){
|
|
for (TXinyiCarbonExtra tXinyiCarbonExtra : extraList) {
|
|
for (TXinyiCarbonExtra tXinyiCarbonExtra : extraList) {
|
|
tXinyiCarbonExtra.setMajorId(id);
|
|
tXinyiCarbonExtra.setMajorId(id);
|
|
- tXinyiCarbonExtra.setVal(this.calculate(tXinyiCarbonExtra));//需要单独计算
|
|
|
|
|
|
+ tXinyiCarbonExtra.setVal(this.calculate(tXinyiCarbonExtra, yz));//需要单独计算
|
|
tXinyiCarbonExtra.setCreateTime(nowDate);
|
|
tXinyiCarbonExtra.setCreateTime(nowDate);
|
|
tXinyiCarbonExtra.setCreateBy(username);
|
|
tXinyiCarbonExtra.setCreateBy(username);
|
|
this.xinyiCarbonExtraMapper.insertTXinyiCarbonExtra(tXinyiCarbonExtra);
|
|
this.xinyiCarbonExtraMapper.insertTXinyiCarbonExtra(tXinyiCarbonExtra);
|
|
@@ -191,72 +204,62 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
|
|
|
|
//------------能源、药剂排放------------
|
|
//------------能源、药剂排放------------
|
|
//耗电相关
|
|
//耗电相关
|
|
- Long provinceId = tXinyiCarbonMajor.getProvinceId();
|
|
|
|
BigDecimal nyyjTotalCo2 = BigDecimal.ZERO;
|
|
BigDecimal nyyjTotalCo2 = BigDecimal.ZERO;
|
|
- BigDecimal yz = null;
|
|
|
|
BigDecimal nyyjDlxhZhdlCo2 = null;
|
|
BigDecimal nyyjDlxhZhdlCo2 = null;
|
|
- if(!Objects.isNull(provinceId)){
|
|
|
|
- SysDictData sysDictData = this.sysDictDataMapper.selectDictDataById(provinceId);
|
|
|
|
- if(Objects.nonNull(sysDictData)){
|
|
|
|
- String dictValue = sysDictData.getDictValue();
|
|
|
|
- if(StringUtils.isNotBlank(dictValue)){
|
|
|
|
- yz = new BigDecimal(dictValue);
|
|
|
|
-
|
|
|
|
- //总耗电
|
|
|
|
- BigDecimal nyyjDlxhZhdl = tXinyiCarbonMajor.getNyyjDlxhZhdl();
|
|
|
|
- if(!Objects.isNull(nyyjDlxhZhdl)){
|
|
|
|
- nyyjDlxhZhdlCo2 = nyyjDlxhZhdl.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_2, RoundingMode.HALF_UP);
|
|
|
|
- tXinyiCarbonMajorUpdate.setNyyjDlxhZhdlCo2(nyyjDlxhZhdlCo2);
|
|
|
|
- }
|
|
|
|
|
|
+ if(!Objects.isNull(yz)){
|
|
|
|
+ //总耗电
|
|
|
|
+ BigDecimal nyyjDlxhZhdl = tXinyiCarbonMajor.getNyyjDlxhZhdl();
|
|
|
|
+ if(!Objects.isNull(nyyjDlxhZhdl)){
|
|
|
|
+ nyyjDlxhZhdlCo2 = nyyjDlxhZhdl.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_2, RoundingMode.HALF_UP);
|
|
|
|
+ tXinyiCarbonMajorUpdate.setNyyjDlxhZhdlCo2(nyyjDlxhZhdlCo2);
|
|
|
|
+ }
|
|
|
|
|
|
- //进水泵房
|
|
|
|
- BigDecimal nyyjDlxhJsbf = tXinyiCarbonMajor.getNyyjDlxhJsbf();
|
|
|
|
- if(!Objects.isNull(nyyjDlxhJsbf)){
|
|
|
|
- tXinyiCarbonMajorUpdate.setNyyjDlxhJsbfCo2(nyyjDlxhJsbf.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
|
|
- }
|
|
|
|
|
|
+ //进水泵房
|
|
|
|
+ BigDecimal nyyjDlxhJsbf = tXinyiCarbonMajor.getNyyjDlxhJsbf();
|
|
|
|
+ if(!Objects.isNull(nyyjDlxhJsbf)){
|
|
|
|
+ tXinyiCarbonMajorUpdate.setNyyjDlxhJsbfCo2(nyyjDlxhJsbf.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
|
|
+ }
|
|
|
|
|
|
- //鼓风机房
|
|
|
|
- BigDecimal nyyjDlxhGfjf = tXinyiCarbonMajor.getNyyjDlxhGfjf();
|
|
|
|
- if(!Objects.isNull(nyyjDlxhGfjf)){
|
|
|
|
- tXinyiCarbonMajorUpdate.setNyyjDlxhGfjfCo2(nyyjDlxhGfjf.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
|
|
- }
|
|
|
|
|
|
+ //鼓风机房
|
|
|
|
+ BigDecimal nyyjDlxhGfjf = tXinyiCarbonMajor.getNyyjDlxhGfjf();
|
|
|
|
+ if(!Objects.isNull(nyyjDlxhGfjf)){
|
|
|
|
+ tXinyiCarbonMajorUpdate.setNyyjDlxhGfjfCo2(nyyjDlxhGfjf.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
|
|
+ }
|
|
|
|
|
|
- //脱水机房
|
|
|
|
- BigDecimal nyyjDlxhTsjf = tXinyiCarbonMajor.getNyyjDlxhTsjf();
|
|
|
|
- if(!Objects.isNull(nyyjDlxhTsjf)){
|
|
|
|
- tXinyiCarbonMajorUpdate.setNyyjDlxhTsjfCo2(nyyjDlxhTsjf.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
|
|
- }
|
|
|
|
|
|
+ //脱水机房
|
|
|
|
+ BigDecimal nyyjDlxhTsjf = tXinyiCarbonMajor.getNyyjDlxhTsjf();
|
|
|
|
+ if(!Objects.isNull(nyyjDlxhTsjf)){
|
|
|
|
+ tXinyiCarbonMajorUpdate.setNyyjDlxhTsjfCo2(nyyjDlxhTsjf.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
|
|
+ }
|
|
|
|
|
|
- //消毒间
|
|
|
|
- BigDecimal nyyjDlxhXdj = tXinyiCarbonMajor.getNyyjDlxhXdj();
|
|
|
|
- if(!Objects.isNull(nyyjDlxhXdj)){
|
|
|
|
- tXinyiCarbonMajorUpdate.setNyyjDlxhXdjCo2(nyyjDlxhXdj.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
|
|
- }
|
|
|
|
|
|
+ //消毒间
|
|
|
|
+ BigDecimal nyyjDlxhXdj = tXinyiCarbonMajor.getNyyjDlxhXdj();
|
|
|
|
+ if(!Objects.isNull(nyyjDlxhXdj)){
|
|
|
|
+ tXinyiCarbonMajorUpdate.setNyyjDlxhXdjCo2(nyyjDlxhXdj.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
|
|
+ }
|
|
|
|
|
|
- //深度处理用电
|
|
|
|
- BigDecimal nyyjDlxhSdcl = tXinyiCarbonMajor.getNyyjDlxhSdcl();
|
|
|
|
- if(!Objects.isNull(nyyjDlxhSdcl)){
|
|
|
|
- tXinyiCarbonMajorUpdate.setNyyjDlxhSdclCo2(nyyjDlxhSdcl.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
|
|
- }
|
|
|
|
|
|
+ //深度处理用电
|
|
|
|
+ BigDecimal nyyjDlxhSdcl = tXinyiCarbonMajor.getNyyjDlxhSdcl();
|
|
|
|
+ if(!Objects.isNull(nyyjDlxhSdcl)){
|
|
|
|
+ tXinyiCarbonMajorUpdate.setNyyjDlxhSdclCo2(nyyjDlxhSdcl.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
|
|
+ }
|
|
|
|
|
|
- //污泥处置
|
|
|
|
- BigDecimal nyyjDlxhWncz = tXinyiCarbonMajor.getNyyjDlxhWncz();
|
|
|
|
- if(!Objects.isNull(nyyjDlxhWncz)){
|
|
|
|
- tXinyiCarbonMajorUpdate.setNyyjDlxhWnczCo2(nyyjDlxhWncz.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
|
|
- }
|
|
|
|
|
|
+ //污泥处置
|
|
|
|
+ BigDecimal nyyjDlxhWncz = tXinyiCarbonMajor.getNyyjDlxhWncz();
|
|
|
|
+ if(!Objects.isNull(nyyjDlxhWncz)){
|
|
|
|
+ tXinyiCarbonMajorUpdate.setNyyjDlxhWnczCo2(nyyjDlxhWncz.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
|
|
+ }
|
|
|
|
|
|
- //生活区
|
|
|
|
- BigDecimal nyyjDlxhShq = tXinyiCarbonMajor.getNyyjDlxhShq();
|
|
|
|
- if(!Objects.isNull(nyyjDlxhShq)){
|
|
|
|
- tXinyiCarbonMajorUpdate.setNyyjDlxhShqCo2(nyyjDlxhShq.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
|
|
- }
|
|
|
|
|
|
+ //生活区
|
|
|
|
+ BigDecimal nyyjDlxhShq = tXinyiCarbonMajor.getNyyjDlxhShq();
|
|
|
|
+ if(!Objects.isNull(nyyjDlxhShq)){
|
|
|
|
+ tXinyiCarbonMajorUpdate.setNyyjDlxhShqCo2(nyyjDlxhShq.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
|
|
+ }
|
|
|
|
|
|
- //其他耗电区
|
|
|
|
- BigDecimal nyyjDlxhQt = tXinyiCarbonMajor.getNyyjDlxhQt();
|
|
|
|
- if(!Objects.isNull(nyyjDlxhQt)){
|
|
|
|
- tXinyiCarbonMajorUpdate.setNyyjDlxhQtCo2(nyyjDlxhQt.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ //其他耗电区
|
|
|
|
+ BigDecimal nyyjDlxhQt = tXinyiCarbonMajor.getNyyjDlxhQt();
|
|
|
|
+ if(!Objects.isNull(nyyjDlxhQt)){
|
|
|
|
+ tXinyiCarbonMajorUpdate.setNyyjDlxhQtCo2(nyyjDlxhQt.multiply(yz).divide(BigDecimal_1000, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -513,21 +516,19 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
//计算各个大类和总的co2
|
|
//计算各个大类和总的co2
|
|
tXinyiCarbonMajorUpdate.setZtTotalCo2(wsclTotalCo2.add(nyyjTotalCo2).add(wnclTotalCo2).subtract(ttthTotalCo2));
|
|
tXinyiCarbonMajorUpdate.setZtTotalCo2(wsclTotalCo2.add(nyyjTotalCo2).add(wnclTotalCo2).subtract(ttthTotalCo2));
|
|
|
|
|
|
- //一对多的的计算的存在问题。 todo
|
|
|
|
-
|
|
|
|
//处理百分比信息
|
|
//处理百分比信息
|
|
if(nyyjTotalCo2.compareTo(BigDecimal.ZERO) > 0){//必须是正数
|
|
if(nyyjTotalCo2.compareTo(BigDecimal.ZERO) > 0){//必须是正数
|
|
if(!Objects.isNull(nyyjDlxhZhdlCo2)){
|
|
if(!Objects.isNull(nyyjDlxhZhdlCo2)){
|
|
- tXinyiCarbonMajorUpdate.setDlxhPercent(nyyjDlxhZhdlCo2.divide(nyyjTotalCo2, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
|
|
|
+ tXinyiCarbonMajorUpdate.setDlxhPercent(nyyjDlxhZhdlCo2.divide(nyyjTotalCo2, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
}
|
|
}
|
|
if(!Objects.isNull(wscljdyjxhCo2)){
|
|
if(!Objects.isNull(wscljdyjxhCo2)){
|
|
- tXinyiCarbonMajorUpdate.setYjxhPercent(wscljdyjxhCo2.divide(nyyjTotalCo2, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
|
|
|
+ tXinyiCarbonMajorUpdate.setYjxhPercent(wscljdyjxhCo2.divide(nyyjTotalCo2, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
}
|
|
}
|
|
if(!Objects.isNull(nyyjGrrlCo2)){
|
|
if(!Objects.isNull(nyyjGrrlCo2)){
|
|
- tXinyiCarbonMajorUpdate.setJgrrlPercent(nyyjGrrlCo2.divide(nyyjTotalCo2, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
|
|
|
+ tXinyiCarbonMajorUpdate.setJgrrlPercent(nyyjGrrlCo2.divide(nyyjTotalCo2, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
}
|
|
}
|
|
if(!Objects.isNull(gdsnyrlCo2)){
|
|
if(!Objects.isNull(gdsnyrlCo2)){
|
|
- tXinyiCarbonMajorUpdate.setRlxhPercent(gdsnyrlCo2.divide(nyyjTotalCo2, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
|
|
|
+ tXinyiCarbonMajorUpdate.setRlxhPercent(gdsnyrlCo2.divide(nyyjTotalCo2, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -536,7 +537,7 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
BigDecimal ztTotalCo2 = tXinyiCarbonMajorUpdate.getZtTotalCo2();
|
|
BigDecimal ztTotalCo2 = tXinyiCarbonMajorUpdate.getZtTotalCo2();
|
|
if(!Objects.isNull(avgJsl) && !Objects.isNull(ztTotalCo2)){
|
|
if(!Objects.isNull(avgJsl) && !Objects.isNull(ztTotalCo2)){
|
|
//2024年08月27日09:36:14 计算公式有调整:再乘以10的三次方。
|
|
//2024年08月27日09:36:14 计算公式有调整:再乘以10的三次方。
|
|
- BigDecimal wschytpfqd = ztTotalCo2.divide(avgJsl, NUMBER_SCALE_4, RoundingMode.HALF_UP).multiply(BigDecimal_1000);
|
|
|
|
|
|
+ BigDecimal wschytpfqd = ztTotalCo2.divide(avgJsl, NUMBER_SCALE_2, RoundingMode.HALF_UP).multiply(BigDecimal_1000);
|
|
tXinyiCarbonMajorUpdate.setWschytpfqd(wschytpfqd);
|
|
tXinyiCarbonMajorUpdate.setWschytpfqd(wschytpfqd);
|
|
BigDecimal avgCod = this.tXinyiCarbonMajorMapper.selectAvgCodByMonth(addYearMonth.replaceAll("-", "/"));
|
|
BigDecimal avgCod = this.tXinyiCarbonMajorMapper.selectAvgCodByMonth(addYearMonth.replaceAll("-", "/"));
|
|
//从字典获取不同cod对应的标准
|
|
//从字典获取不同cod对应的标准
|
|
@@ -566,38 +567,41 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- *
|
|
|
|
* 明细字段的计算处理
|
|
* 明细字段的计算处理
|
|
* 类型放入到值集中,然后再判断
|
|
* 类型放入到值集中,然后再判断
|
|
|
|
+ *
|
|
* @param tXinyiCarbonExtra
|
|
* @param tXinyiCarbonExtra
|
|
|
|
+ * @param yz
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- private BigDecimal calculate(TXinyiCarbonExtra tXinyiCarbonExtra) {
|
|
|
|
-// int type = tXinyiCarbonExtra.getType();
|
|
|
|
|
|
+ private BigDecimal calculate(TXinyiCarbonExtra tXinyiCarbonExtra, BigDecimal yz) {
|
|
|
|
+ int type = tXinyiCarbonExtra.getType();
|
|
BigDecimal amount = tXinyiCarbonExtra.getAmount();
|
|
BigDecimal amount = tXinyiCarbonExtra.getAmount();
|
|
|
|
+ BigDecimal lyl = tXinyiCarbonExtra.getLyl();
|
|
|
|
+ BigDecimal hz = tXinyiCarbonExtra.getHz();
|
|
SysDictData sysDictData = this.sysDictDataMapper.selectDictDataById(tXinyiCarbonExtra.getDictCode());
|
|
SysDictData sysDictData = this.sysDictDataMapper.selectDictDataById(tXinyiCarbonExtra.getDictCode());
|
|
if(Objects.isNull(sysDictData)){
|
|
if(Objects.isNull(sysDictData)){
|
|
throw new ServiceException("没有查询到对应的配置项");
|
|
throw new ServiceException("没有查询到对应的配置项");
|
|
}
|
|
}
|
|
- /*if(type == BusinessEnum.CarbonExtraTeypEnum.ZERO.getCode()){
|
|
|
|
-
|
|
|
|
|
|
+ //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_2, RoundingMode.HALF_UP));
|
|
}else if(type == BusinessEnum.CarbonExtraTeypEnum.ONE.getCode()){
|
|
}else if(type == BusinessEnum.CarbonExtraTeypEnum.ONE.getCode()){
|
|
-
|
|
|
|
|
|
+ return amount.multiply(new BigDecimal(sysDictData.getDictValue()).divide(BigDecimal_1000,NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
}else if(type == BusinessEnum.CarbonExtraTeypEnum.TWO.getCode()){
|
|
}else if(type == BusinessEnum.CarbonExtraTeypEnum.TWO.getCode()){
|
|
-
|
|
|
|
|
|
+ return amount.multiply(new BigDecimal(sysDictData.getDictValue()).divide(BigDecimal_1000,NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
}else if(type == BusinessEnum.CarbonExtraTeypEnum.THREE.getCode()){
|
|
}else if(type == BusinessEnum.CarbonExtraTeypEnum.THREE.getCode()){
|
|
-
|
|
|
|
|
|
+ return amount.multiply(new BigDecimal(sysDictData.getDictValue()).divide(BigDecimal_1000000000000,NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
}else if(type == BusinessEnum.CarbonExtraTeypEnum.FOUR.getCode()){
|
|
}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_2, RoundingMode.HALF_UP);
|
|
}else if(type == BusinessEnum.CarbonExtraTeypEnum.FIVE.getCode()){
|
|
}else if(type == BusinessEnum.CarbonExtraTeypEnum.FIVE.getCode()){
|
|
-
|
|
|
|
|
|
+ return Objects.isNull(yz) ? null : (amount.multiply(yz).add((lyl.multiply(hz.subtract(BigDecimal_83_74)).divide(BigDecimal_1000,NUMBER_SCALE_2, RoundingMode.HALF_UP))).multiply(new BigDecimal(sysDictData.getDictValue())).divide(BigDecimal_1000,NUMBER_SCALE_2, RoundingMode.HALF_UP)).divide(BigDecimal_1000,NUMBER_SCALE_2, RoundingMode.HALF_UP);
|
|
}else {
|
|
}else {
|
|
log.error("暂不支持的类型");
|
|
log.error("暂不支持的类型");
|
|
throw new ServiceException("暂不支持的类型");
|
|
throw new ServiceException("暂不支持的类型");
|
|
}
|
|
}
|
|
- return null;*/
|
|
|
|
//2024年08月28日17:43:58 所有的公式都统一了,都采用下面的方式【感谢郭京京】
|
|
//2024年08月28日17:43:58 所有的公式都统一了,都采用下面的方式【感谢郭京京】
|
|
- return amount.multiply(new BigDecimal(sysDictData.getDictValue()).divide(BigDecimal_1000,NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
|
|
|
+// return amount.multiply(new BigDecimal(sysDictData.getDictValue()).divide(BigDecimal_1000,NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -680,35 +684,35 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
BigDecimal nowCo2 = tXinyiCarbonMajorLastMonth.getWsclTotalCo2();
|
|
BigDecimal nowCo2 = tXinyiCarbonMajorLastMonth.getWsclTotalCo2();
|
|
BigDecimal lastMonthCo2 = tXinyiCarbonMajor.getWsclTotalCo2();
|
|
BigDecimal lastMonthCo2 = tXinyiCarbonMajor.getWsclTotalCo2();
|
|
if(!Objects.isNull(nowCo2) && !Objects.isNull(lastMonthCo2)){
|
|
if(!Objects.isNull(nowCo2) && !Objects.isNull(lastMonthCo2)){
|
|
- tXinyiCarbonMajor.setWsclTotalCo2Hb(DecimalUtils.getAbsAndScale((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_4, RoundingMode.HALF_UP) ,NUMBER_SCALE_4));
|
|
|
|
|
|
+ tXinyiCarbonMajor.setWsclTotalCo2Hb(DecimalUtils.getAbsAndScale((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_2, RoundingMode.HALF_UP) ,NUMBER_SCALE_2));
|
|
}
|
|
}
|
|
|
|
|
|
//能源、药剂碳排量-环比上个月
|
|
//能源、药剂碳排量-环比上个月
|
|
nowCo2 = tXinyiCarbonMajorLastMonth.getNyyjTotalCo2();
|
|
nowCo2 = tXinyiCarbonMajorLastMonth.getNyyjTotalCo2();
|
|
lastMonthCo2 = tXinyiCarbonMajor.getNyyjTotalCo2();
|
|
lastMonthCo2 = tXinyiCarbonMajor.getNyyjTotalCo2();
|
|
if(!Objects.isNull(nowCo2) && !Objects.isNull(lastMonthCo2)){
|
|
if(!Objects.isNull(nowCo2) && !Objects.isNull(lastMonthCo2)){
|
|
- tXinyiCarbonMajor.setNyyjTotalCo2Hb(DecimalUtils.getAbsAndScale((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_4, RoundingMode.HALF_UP) ,NUMBER_SCALE_4));
|
|
|
|
|
|
+ tXinyiCarbonMajor.setNyyjTotalCo2Hb(DecimalUtils.getAbsAndScale((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_2, RoundingMode.HALF_UP) ,NUMBER_SCALE_2));
|
|
}
|
|
}
|
|
|
|
|
|
//污泥处理碳排量-环比上个月
|
|
//污泥处理碳排量-环比上个月
|
|
nowCo2 = tXinyiCarbonMajorLastMonth.getWnclTotalCo2();
|
|
nowCo2 = tXinyiCarbonMajorLastMonth.getWnclTotalCo2();
|
|
lastMonthCo2 = tXinyiCarbonMajor.getWnclTotalCo2();
|
|
lastMonthCo2 = tXinyiCarbonMajor.getWnclTotalCo2();
|
|
if(!Objects.isNull(nowCo2) && !Objects.isNull(lastMonthCo2)){
|
|
if(!Objects.isNull(nowCo2) && !Objects.isNull(lastMonthCo2)){
|
|
- tXinyiCarbonMajor.setWnclTotalCo2Hb(DecimalUtils.getAbsAndScale((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_4, RoundingMode.HALF_UP) ,NUMBER_SCALE_4));
|
|
|
|
|
|
+ tXinyiCarbonMajor.setWnclTotalCo2Hb(DecimalUtils.getAbsAndScale((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_2, RoundingMode.HALF_UP) ,NUMBER_SCALE_2));
|
|
}
|
|
}
|
|
|
|
|
|
//替碳、碳汇替碳量-环比上个月
|
|
//替碳、碳汇替碳量-环比上个月
|
|
nowCo2 = tXinyiCarbonMajorLastMonth.getTtthTotalCo2();
|
|
nowCo2 = tXinyiCarbonMajorLastMonth.getTtthTotalCo2();
|
|
lastMonthCo2 = tXinyiCarbonMajor.getTtthTotalCo2();
|
|
lastMonthCo2 = tXinyiCarbonMajor.getTtthTotalCo2();
|
|
if(!Objects.isNull(nowCo2) && !Objects.isNull(lastMonthCo2)){
|
|
if(!Objects.isNull(nowCo2) && !Objects.isNull(lastMonthCo2)){
|
|
- tXinyiCarbonMajor.setTtthTotalCo2Hb(DecimalUtils.getAbsAndScale((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_4, RoundingMode.HALF_UP) ,NUMBER_SCALE_4));
|
|
|
|
|
|
+ tXinyiCarbonMajor.setTtthTotalCo2Hb(DecimalUtils.getAbsAndScale((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_2, RoundingMode.HALF_UP) ,NUMBER_SCALE_2));
|
|
}
|
|
}
|
|
|
|
|
|
//总碳排放量-环比上个月
|
|
//总碳排放量-环比上个月
|
|
nowCo2 = tXinyiCarbonMajorLastMonth.getZtTotalCo2();
|
|
nowCo2 = tXinyiCarbonMajorLastMonth.getZtTotalCo2();
|
|
lastMonthCo2 = tXinyiCarbonMajor.getZtTotalCo2();
|
|
lastMonthCo2 = tXinyiCarbonMajor.getZtTotalCo2();
|
|
if(!Objects.isNull(nowCo2) && !Objects.isNull(lastMonthCo2)){
|
|
if(!Objects.isNull(nowCo2) && !Objects.isNull(lastMonthCo2)){
|
|
- tXinyiCarbonMajor.setZtTotalCo2Hb(DecimalUtils.getAbsAndScale((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_4, RoundingMode.HALF_UP) ,NUMBER_SCALE_4));
|
|
|
|
|
|
+ tXinyiCarbonMajor.setZtTotalCo2Hb(DecimalUtils.getAbsAndScale((nowCo2.subtract(lastMonthCo2)).divide(lastMonthCo2, NUMBER_SCALE_2, RoundingMode.HALF_UP) ,NUMBER_SCALE_2));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//最近7个月的数据集合
|
|
//最近7个月的数据集合
|
|
@@ -728,7 +732,7 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
|
|
//获取某个月份的平均进水cod
|
|
//获取某个月份的平均进水cod
|
|
BigDecimal avgJsl = this.tXinyiCarbonMajorMapper.selectSumJslByMonth(addYearMonthTmp.replaceAll("-", "/"));
|
|
BigDecimal avgJsl = this.tXinyiCarbonMajorMapper.selectSumJslByMonth(addYearMonthTmp.replaceAll("-", "/"));
|
|
if(!Objects.isNull(avgJsl) && !Objects.isNull(ztTotalCo2)){
|
|
if(!Objects.isNull(avgJsl) && !Objects.isNull(ztTotalCo2)){
|
|
- chartBasic.setWschytpfqd(ztTotalCo2.divide(avgJsl, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
|
|
|
+ chartBasic.setWschytpfqd(ztTotalCo2.divide(avgJsl, NUMBER_SCALE_2, RoundingMode.HALF_UP));
|
|
}
|
|
}
|
|
recent7PflDatas.add(chartBasic);
|
|
recent7PflDatas.add(chartBasic);
|
|
}
|
|
}
|