|
|
|
@ -3,6 +3,7 @@ package com.thing.qingyuan.carbon.service.impl; |
|
|
|
import com.mybatisflex.core.query.QueryWrapper; |
|
|
|
import com.thing.qingyuan.carbon.dto.QyCarbonAssetDTO; |
|
|
|
import com.thing.qingyuan.carbon.dto.QyCarbonQuotaInfoDTO; |
|
|
|
import com.thing.qingyuan.carbon.dto.QyCarbonSumQuotaInfoDTO; |
|
|
|
import com.thing.qingyuan.carbon.dto.QyCcerInfoDTO; |
|
|
|
import com.thing.qingyuan.carbon.entity.QyCarbonQuotaInfoEntity; |
|
|
|
import com.thing.qingyuan.carbon.entity.QyCcerInfoEntity; |
|
|
|
@ -12,12 +13,11 @@ import com.thing.qingyuan.carbon.service.QyCarbonQuotaInfoService; |
|
|
|
import com.thing.qingyuan.carbon.service.QyCcerInfoService; |
|
|
|
import com.thing.qingyuan.carbon.service.QyGreenCertificateInfoService; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.util.Comparator; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
@ -41,215 +41,123 @@ public class QyCarbonAssetServiceImpl implements QyCarbonAssetService { |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Map<String, String> countCarbonAsset() { |
|
|
|
//查询待发放碳配额 |
|
|
|
|
|
|
|
BigDecimal carbonTotal = BigDecimal.ZERO; |
|
|
|
BigDecimal ccerTotal = BigDecimal.ZERO; |
|
|
|
BigDecimal greenTotal = BigDecimal.ZERO; |
|
|
|
BigDecimal carbon = BigDecimal.ZERO; |
|
|
|
BigDecimal ccer = BigDecimal.ZERO; |
|
|
|
BigDecimal green = BigDecimal.ZERO; |
|
|
|
//买入 |
|
|
|
BigDecimal carbonBuy = BigDecimal.ZERO; |
|
|
|
BigDecimal ccerBuy = BigDecimal.ZERO; |
|
|
|
BigDecimal greenBuy = BigDecimal.ZERO; |
|
|
|
//卖出 |
|
|
|
BigDecimal carbonSell = BigDecimal.ZERO; |
|
|
|
BigDecimal ccerSell = BigDecimal.ZERO; |
|
|
|
BigDecimal greenSell = BigDecimal.ZERO; |
|
|
|
//核销 |
|
|
|
BigDecimal carbonOff = BigDecimal.ZERO; |
|
|
|
BigDecimal ccerOff = BigDecimal.ZERO; |
|
|
|
BigDecimal greenOff = BigDecimal.ZERO; |
|
|
|
//查询碳配额 |
|
|
|
QueryWrapper queryWrapper = QueryWrapper.create() |
|
|
|
.select(sum(QY_CARBON_QUOTA_INFO_ENTITY.TOTAL).as("total")) |
|
|
|
.select(sum(QY_CARBON_QUOTA_INFO_ENTITY.TOTAL).as("total"), QY_CARBON_QUOTA_INFO_ENTITY.STATE) |
|
|
|
.from(QY_CARBON_QUOTA_INFO_ENTITY) |
|
|
|
.eq(QyCarbonQuotaInfoEntity::getState,"1"); |
|
|
|
// sum1 为待发放碳配额 |
|
|
|
String sum1 = qyCarbonQuotaInfoService.getMapper().selectOneByQueryAs(queryWrapper, String.class); |
|
|
|
.in(QyCarbonQuotaInfoEntity::getState,"2", "3", "4", "5") |
|
|
|
.ne(QyCarbonQuotaInfoEntity::getState,"0") |
|
|
|
.groupBy(QY_CARBON_QUOTA_INFO_ENTITY.STATE); |
|
|
|
// sum1 为待 发放碳配额 |
|
|
|
List<QyCarbonSumQuotaInfoDTO> carbonList = qyCarbonQuotaInfoService.getMapper().selectListByQueryAs(queryWrapper, QyCarbonSumQuotaInfoDTO.class); |
|
|
|
if(CollectionUtils.isNotEmpty(carbonList)){ |
|
|
|
carbonTotal = carbonList.stream().filter(e -> "2".equals(e.getState()) || "3".equals(e.getState())) |
|
|
|
.map(QyCarbonSumQuotaInfoDTO::getTotal) |
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
carbon = carbonList.stream().filter(e -> "4".equals(e.getState()) || "5".equals(e.getState())) |
|
|
|
.map(QyCarbonSumQuotaInfoDTO::getTotal) |
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
carbonBuy = carbonList.stream().filter(e -> "3".equals(e.getState())) |
|
|
|
.map(QyCarbonSumQuotaInfoDTO::getTotal) |
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
carbonSell = carbonList.stream().filter(e -> "4".equals(e.getState())).map(QyCarbonSumQuotaInfoDTO::getTotal) |
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
carbonOff = carbonList.stream().filter(e -> "5".equals(e.getState())).map(QyCarbonSumQuotaInfoDTO::getTotal) |
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
} |
|
|
|
|
|
|
|
//查询待申请CCER |
|
|
|
QueryWrapper queryWrapper1 = QueryWrapper.create() |
|
|
|
.select(sum(QY_CCER_INFO_ENTITY.TOTAL).as("total")) |
|
|
|
.from(QY_CCER_INFO_ENTITY) |
|
|
|
.eq(QyCcerInfoEntity::getState,"1"); |
|
|
|
.in(QyCcerInfoEntity::getState,"2", "3", "4", "5") |
|
|
|
.ne(QyCcerInfoEntity::getState,"0") |
|
|
|
.groupBy(QY_CCER_INFO_ENTITY.STATE); |
|
|
|
// sum2 为待申请CCER |
|
|
|
String sum2 = qyCcerInfoService.getMapper().selectOneByQueryAs(queryWrapper1, String.class); |
|
|
|
|
|
|
|
List<QyCarbonSumQuotaInfoDTO> ccerList = qyCarbonQuotaInfoService.getMapper().selectListByQueryAs(queryWrapper1, QyCarbonSumQuotaInfoDTO.class); |
|
|
|
if(CollectionUtils.isNotEmpty(ccerList)){ |
|
|
|
ccerTotal = ccerList.stream().filter(e -> "2".equals(e.getState()) || "3".equals(e.getState())) |
|
|
|
.map(QyCarbonSumQuotaInfoDTO::getTotal) |
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
ccer = ccerList.stream().filter(e -> "4".equals(e.getState()) || "5".equals(e.getState())) |
|
|
|
.map(QyCarbonSumQuotaInfoDTO::getTotal) |
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
ccerBuy = ccerList.stream().filter(e -> "3".equals(e.getState())) |
|
|
|
.map(QyCarbonSumQuotaInfoDTO::getTotal) |
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
ccerSell = ccerList.stream().filter(e -> "4".equals(e.getState())).map(QyCarbonSumQuotaInfoDTO::getTotal) |
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
ccerOff = ccerList.stream().filter(e -> "5".equals(e.getState())).map(QyCarbonSumQuotaInfoDTO::getTotal) |
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
} |
|
|
|
//查询待发放绿证 |
|
|
|
QueryWrapper queryWrapper2 = QueryWrapper.create() |
|
|
|
.select(sum(QY_GREEN_CERTIFICATE_INFO_ENTITY.TOTAL).as("total")) |
|
|
|
.from(QY_GREEN_CERTIFICATE_INFO_ENTITY) |
|
|
|
.eq(QyGreenCertificateInfoEntity::getState,"1"); |
|
|
|
.in(QyGreenCertificateInfoEntity::getState,"2", "3", "4", "5") |
|
|
|
.ne(QyGreenCertificateInfoEntity::getState,"0") |
|
|
|
.groupBy(QY_GREEN_CERTIFICATE_INFO_ENTITY.STATE); |
|
|
|
// sum3 为待发放绿证 |
|
|
|
String sum3 = qyGreenCertificateInfoService.getMapper().selectOneByQueryAs(queryWrapper2, String.class); |
|
|
|
List<QyCarbonSumQuotaInfoDTO> greenList = qyCarbonQuotaInfoService.getMapper().selectListByQueryAs(queryWrapper2, QyCarbonSumQuotaInfoDTO.class); |
|
|
|
if(CollectionUtils.isNotEmpty(greenList)){ |
|
|
|
greenTotal = greenList.stream().filter(e -> "2".equals(e.getState()) || "3".equals(e.getState())) |
|
|
|
.map(QyCarbonSumQuotaInfoDTO::getTotal) |
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
green = greenList.stream().filter(e -> "4".equals(e.getState()) || "5".equals(e.getState())) |
|
|
|
.map(QyCarbonSumQuotaInfoDTO::getTotal) |
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
greenBuy = greenList.stream().filter(e -> "3".equals(e.getState())) |
|
|
|
.map(QyCarbonSumQuotaInfoDTO::getTotal) |
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
greenSell = greenList.stream().filter(e -> "4".equals(e.getState())).map(QyCarbonSumQuotaInfoDTO::getTotal) |
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
greenOff = greenList.stream().filter(e -> "5".equals(e.getState())).map(QyCarbonSumQuotaInfoDTO::getTotal) |
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
} |
|
|
|
|
|
|
|
//统计当前状态下 碳配额,ccer,绿证总和 |
|
|
|
BigDecimal addTotal = new BigDecimal(sum1).add(new BigDecimal(sum2)).add(new BigDecimal(sum3)); |
|
|
|
BigDecimal total = carbonTotal.add(ccerTotal).add(greenTotal).subtract(carbon).subtract(ccer).subtract(green); |
|
|
|
|
|
|
|
// 查询已发放碳配额 |
|
|
|
QueryWrapper queryWrapper3 = QueryWrapper.create() |
|
|
|
.select(sum(QY_CARBON_QUOTA_INFO_ENTITY.TOTAL).as("total")) |
|
|
|
.from(QY_CARBON_QUOTA_INFO_ENTITY) |
|
|
|
.eq(QyCarbonQuotaInfoEntity::getState,"2"); |
|
|
|
// sum4 为已发放碳配额 |
|
|
|
String sum4 = qyCarbonQuotaInfoService.getMapper().selectOneByQueryAs(queryWrapper3, String.class); |
|
|
|
|
|
|
|
// 查询已申请ccer |
|
|
|
QueryWrapper queryWrapper4 = QueryWrapper.create() |
|
|
|
.select(sum(QY_CCER_INFO_ENTITY.TOTAL).as("total")) |
|
|
|
.from(QY_CCER_INFO_ENTITY) |
|
|
|
.eq(QyCcerInfoEntity::getState,"2"); |
|
|
|
// sum5 为已申请ccer |
|
|
|
String sum5 = qyCcerInfoService.getMapper().selectOneByQueryAs(queryWrapper4, String.class); |
|
|
|
|
|
|
|
// 查询已发放绿证 |
|
|
|
QueryWrapper queryWrapper5 = QueryWrapper.create() |
|
|
|
.select(sum(QY_GREEN_CERTIFICATE_INFO_ENTITY.TOTAL).as("total")) |
|
|
|
.from(QY_GREEN_CERTIFICATE_INFO_ENTITY) |
|
|
|
.eq(QyGreenCertificateInfoEntity::getState,"2"); |
|
|
|
// sum6 为已发放绿证 |
|
|
|
String sum6 = qyGreenCertificateInfoService.getMapper().selectOneByQueryAs(queryWrapper5, String.class); |
|
|
|
|
|
|
|
//统计当前状态下,碳配额,ccer,绿证总和 |
|
|
|
BigDecimal addTotal1 = new BigDecimal(sum4).add(new BigDecimal(sum5)).add(new BigDecimal(sum6)); |
|
|
|
BigDecimal carbonSum = carbonTotal.subtract(carbon); |
|
|
|
BigDecimal ccerSum = ccerTotal.subtract(ccer); |
|
|
|
BigDecimal greenSum = greenTotal.subtract(green); |
|
|
|
|
|
|
|
//返回结果 |
|
|
|
Map<String, String> temMap = new HashMap<>(); |
|
|
|
//1.碳配额占比 |
|
|
|
temMap.put("quotaPercent",new BigDecimal(sum1).divide(addTotal,2, RoundingMode.HALF_UP).toString()); |
|
|
|
temMap.put("quotaPercent1",new BigDecimal(sum4).divide(addTotal1,2, RoundingMode.HALF_UP).toString()); |
|
|
|
//CCER占比 |
|
|
|
temMap.put("ccerPercent",new BigDecimal(sum2).divide(addTotal,2, RoundingMode.HALF_UP).toString()); |
|
|
|
temMap.put("ccerPercent1",new BigDecimal(sum5).divide(addTotal1,2, RoundingMode.HALF_UP).toString()); |
|
|
|
//绿证占比 |
|
|
|
temMap.put("greenPercent",new BigDecimal(sum3).divide(addTotal,2, RoundingMode.HALF_UP).toString()); |
|
|
|
temMap.put("greenPercent1",new BigDecimal(sum6).divide(addTotal1,2, RoundingMode.HALF_UP).toString()); |
|
|
|
return temMap; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 计算累计碳资产,包括碳配额、CCER和绿证的占比 |
|
|
|
* @return 返回一个包含碳配额、CCER和绿证占比的Map |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Map<String, String> countTotalCarbonAsset() { |
|
|
|
QueryWrapper queryWrapper = QueryWrapper.create() |
|
|
|
.select(sum(QY_CARBON_QUOTA_INFO_ENTITY.TOTAL).as("total")) |
|
|
|
.from(QY_CARBON_QUOTA_INFO_ENTITY); |
|
|
|
//sum1 当前碳配额 |
|
|
|
String sum1 = qyCarbonQuotaInfoService.getMapper().selectOneByQueryAs(queryWrapper, String.class); |
|
|
|
|
|
|
|
QueryWrapper queryWrapper1 = QueryWrapper.create() |
|
|
|
.select(sum(QY_CCER_INFO_ENTITY.TOTAL).as("total")) |
|
|
|
.from(QY_CCER_INFO_ENTITY); |
|
|
|
//sum2 当前CCER |
|
|
|
String sum2 = qyCcerInfoService.getMapper().selectOneByQueryAs(queryWrapper1, String.class); |
|
|
|
|
|
|
|
QueryWrapper queryWrapper2 = QueryWrapper.create() |
|
|
|
.select(sum(QY_GREEN_CERTIFICATE_INFO_ENTITY.TOTAL).as("total")) |
|
|
|
.from(QY_GREEN_CERTIFICATE_INFO_ENTITY); |
|
|
|
//sum3 当前绿证 |
|
|
|
String sum3 = qyGreenCertificateInfoService.getMapper().selectOneByQueryAs(queryWrapper2, String.class); |
|
|
|
|
|
|
|
//资产综合 |
|
|
|
BigDecimal sumTotal = new BigDecimal(sum1).add(new BigDecimal(sum2)).add(new BigDecimal(sum3)); |
|
|
|
|
|
|
|
//存储最终结果 |
|
|
|
Map<String, String> temMap = new HashMap<>(); |
|
|
|
//碳配额占比 |
|
|
|
temMap.put("quotaPercent",new BigDecimal(sum1).divide(sumTotal,2, RoundingMode.HALF_UP).toString()); |
|
|
|
//CCER占比 |
|
|
|
temMap.put("ccerPercent",new BigDecimal(sum2).divide(sumTotal,2, RoundingMode.HALF_UP).toString()); |
|
|
|
//绿证占比 |
|
|
|
temMap.put("greenPercent",new BigDecimal(sum3).divide(sumTotal,2, RoundingMode.HALF_UP).toString()); |
|
|
|
return temMap; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 统计买入,发放,核销三种状态共计碳资产量 |
|
|
|
* @return 返回一个map |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Map<String, String> countCarbonAssetState() { |
|
|
|
/* |
|
|
|
==============================统计买入量============================================================== |
|
|
|
*/ |
|
|
|
/*//查询碳配额买入碳资产 |
|
|
|
QueryWrapper queryWrapper = QueryWrapper.create() |
|
|
|
.select(sum(QY_CARBON_QUOTA_INFO_ENTITY.TOTAL).as("total")) |
|
|
|
.from(QY_CARBON_QUOTA_INFO_ENTITY) |
|
|
|
.eq(QyCarbonQuotaInfoEntity::getAssetState,"1"); |
|
|
|
//numTotal 为碳配额中买入碳资产量 |
|
|
|
String carbonTotal = qyCarbonQuotaInfoService.getMapper().selectOneByQueryAs(queryWrapper, String.class); |
|
|
|
|
|
|
|
//查询ccer买入碳资产 |
|
|
|
QueryWrapper queryWrapper1 = QueryWrapper.create() |
|
|
|
.select(sum(QY_CCER_INFO_ENTITY.TOTAL).as("total")) |
|
|
|
.from(QY_CCER_INFO_ENTITY) |
|
|
|
.eq(QyCcerInfoEntity::getAssetState,"1"); |
|
|
|
//ccerTotal 为ccer中买入碳资产量 |
|
|
|
String ccerTotal = mapper.selectOneByQueryAs(queryWrapper1, String.class); |
|
|
|
|
|
|
|
//查询绿证买入碳资产 |
|
|
|
QueryWrapper queryWrapper2 = QueryWrapper.create() |
|
|
|
.select(sum(QY_GREEN_CERTIFICATE_INFO_ENTITY.TOTAL).as("total")) |
|
|
|
.from(QY_GREEN_CERTIFICATE_INFO_ENTITY) |
|
|
|
.eq(QyGreenCertificateInfoEntity::getAssetState,"1"); |
|
|
|
//greenTotal 为绿证买入碳资产量 |
|
|
|
String greenTotal = qyGreenCertificateInfoService.getMapper().selectOneByQueryAs(queryWrapper2, String.class); |
|
|
|
|
|
|
|
*//* |
|
|
|
==============================统计核销量===================================================================== |
|
|
|
*//* |
|
|
|
//查询碳配额核销量 |
|
|
|
QueryWrapper queryWrapper3 = QueryWrapper.create() |
|
|
|
.select(sum(QY_CARBON_QUOTA_INFO_ENTITY.VERIFICATION_VOLUME).as("total")) |
|
|
|
.from(QY_CARBON_QUOTA_INFO_ENTITY) |
|
|
|
.eq(QyCarbonQuotaInfoEntity::getAssetState,"2"); |
|
|
|
//carbonVolume 为碳配额核销量 |
|
|
|
String carbonVolume = qyCarbonQuotaInfoService.getMapper().selectOneByQueryAs(queryWrapper3, String.class); |
|
|
|
Map<String, String> resMap = new HashMap<>(); |
|
|
|
//占比 |
|
|
|
resMap.put("carbonPercent",carbonSum.divide(total,2, RoundingMode.HALF_UP).toPlainString()); |
|
|
|
resMap.put("ccerPercent",ccerSum.divide(total,2, RoundingMode.HALF_UP).toPlainString()); |
|
|
|
resMap.put("greenPercent",greenSum.divide(total,2, RoundingMode.HALF_UP).toPlainString()); |
|
|
|
resMap.put("total",total.toPlainString()); |
|
|
|
//累计资产状态 |
|
|
|
resMap.put("carbonSum",carbonSum.toPlainString()); |
|
|
|
resMap.put("ccerSum",ccerSum.toPlainString()); |
|
|
|
resMap.put("greenSum",greenSum.toPlainString()); |
|
|
|
//碳资产状态 |
|
|
|
resMap.put("buy",carbonBuy.add(ccerBuy).add(greenBuy).toPlainString()); |
|
|
|
resMap.put("sell",carbonSell.add(ccerSell).add(greenSell).toPlainString()); |
|
|
|
resMap.put("off",carbonOff.add(ccerOff).add(greenOff).toPlainString()); |
|
|
|
return resMap; |
|
|
|
|
|
|
|
//查询ccer核销量 |
|
|
|
QueryWrapper queryWrapper4 = QueryWrapper.create() |
|
|
|
.select(sum(QY_CCER_INFO_ENTITY.VERIFICATION_VOLUME).as("total")) |
|
|
|
.from(QY_CCER_INFO_ENTITY) |
|
|
|
.eq(QyCcerInfoEntity::getAssetState,"2"); |
|
|
|
//ccerVolume 为ccer核销量 |
|
|
|
String ccerVolume = mapper.selectOneByQueryAs(queryWrapper4, String.class); |
|
|
|
|
|
|
|
//查询绿证核销量 |
|
|
|
QueryWrapper queryWrapper5 = QueryWrapper.create() |
|
|
|
.select(sum(QY_GREEN_CERTIFICATE_INFO_ENTITY.VERIFICATION_VOLUME).as("total")) |
|
|
|
.from(QY_GREEN_CERTIFICATE_INFO_ENTITY) |
|
|
|
.eq(QyGreenCertificateInfoEntity::getAssetState,"2"); |
|
|
|
//greenVolume 为绿证核销量 |
|
|
|
String greenVolume = qyGreenCertificateInfoService.getMapper().selectOneByQueryAs(queryWrapper5, String.class); |
|
|
|
|
|
|
|
|
|
|
|
*//* |
|
|
|
==============================统计发放量===================================================================== |
|
|
|
*//* |
|
|
|
//查询碳配额卖出量 |
|
|
|
QueryWrapper queryWrapper6 = QueryWrapper.create() |
|
|
|
.select(sum(QY_CARBON_QUOTA_INFO_ENTITY.CARBON_QUOTA).as("total")) |
|
|
|
.from(QY_CARBON_QUOTA_INFO_ENTITY) |
|
|
|
.eq(QyCarbonQuotaInfoEntity::getAssetState,"3"); |
|
|
|
//carbonSell 为碳配额卖出 |
|
|
|
String carbonSell = qyCarbonQuotaInfoService.getMapper().selectOneByQueryAs(queryWrapper6, String.class); |
|
|
|
|
|
|
|
//查询ccer卖出量 |
|
|
|
QueryWrapper queryWrapper7 = QueryWrapper.create() |
|
|
|
.select(sum(QY_CCER_INFO_ENTITY.RECORD_EMISSION).as("total")) |
|
|
|
.from(QY_CCER_INFO_ENTITY) |
|
|
|
.eq(QyCcerInfoEntity::getAssetState,"3"); |
|
|
|
//ccerSell 为ccer卖出 |
|
|
|
String ccerSell = mapper.selectOneByQueryAs(queryWrapper7, String.class); |
|
|
|
|
|
|
|
//查询绿证卖出量 |
|
|
|
QueryWrapper queryWrapper8 = QueryWrapper.create() |
|
|
|
.select(sum(QY_GREEN_CERTIFICATE_INFO_ENTITY.GREEN_TOTAL).as("total")) |
|
|
|
.from(QY_GREEN_CERTIFICATE_INFO_ENTITY) |
|
|
|
.eq(QyGreenCertificateInfoEntity::getAssetState,"3"); |
|
|
|
//greenSell 为绿证卖出 |
|
|
|
String greenSell = qyGreenCertificateInfoService.getMapper().selectOneByQueryAs(queryWrapper8, String.class); |
|
|
|
|
|
|
|
//总买入碳资产 |
|
|
|
BigDecimal buyTotal = new BigDecimal(greenTotal).multiply(new BigDecimal("0.5703")).add(new BigDecimal(carbonTotal)).add(new BigDecimal(ccerTotal)); |
|
|
|
//总核销碳资产 |
|
|
|
BigDecimal verTotal = new BigDecimal(greenVolume).multiply(new BigDecimal("0.5703")).add(new BigDecimal(carbonVolume)).add(new BigDecimal(ccerVolume)); |
|
|
|
//总卖出碳资产 |
|
|
|
BigDecimal sellTotal = new BigDecimal(greenSell).multiply(new BigDecimal("0.5703")).add(new BigDecimal(carbonSell)).add(new BigDecimal(ccerSell)); |
|
|
|
*/ |
|
|
|
//存入结果 |
|
|
|
HashMap<String, String> temMap = new HashMap<>(); |
|
|
|
//返回结果 买入 核销 卖出 |
|
|
|
/* temMap.put("buy", buyTotal.compareTo(BigDecimal.ZERO) == 0 ? "0" : buyTotal.toString()); |
|
|
|
temMap.put("ver", verTotal.compareTo(BigDecimal.ZERO) == 0 ? "0" : verTotal.toString()); |
|
|
|
temMap.put("sell", sellTotal.compareTo(BigDecimal.ZERO) == 0 ? "0" : sellTotal.toString());*/ |
|
|
|
return temMap; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
|