Browse Source

光伏节能减排

2025年1月10日14:38:59
qingyuan_dev_new
lishuai 1 year ago
parent
commit
3a605bcf2a
  1. 13
      modules/qingyuan/src/main/java/com/thing/qingyuan/manageboard/controller/PlantController.java
  2. 2
      modules/qingyuan/src/main/java/com/thing/qingyuan/manageboard/service/PlantService.java
  3. 16
      modules/qingyuan/src/main/java/com/thing/qingyuan/manageboard/service/impl/PlantServiceImpl.java

13
modules/qingyuan/src/main/java/com/thing/qingyuan/manageboard/controller/PlantController.java

@ -1,14 +1,14 @@
package com.thing.qingyuan.manageboard.controller;
import com.thing.common.core.annotation.LogOperation;
import com.thing.common.core.constants.Constant;
import com.thing.common.core.web.response.PageData;
import com.thing.common.core.web.response.Result;
import com.thing.qingyuan.manageboard.dto.PhotovoltaicDTO;
import com.thing.qingyuan.manageboard.dto.PhotovoltaicOverviewDTO;
import com.thing.qingyuan.manageboard.dto.PlantDTO;
import com.thing.qingyuan.manageboard.dto.ReductionStatistics;
import com.thing.qingyuan.manageboard.service.PlantService;
import com.thing.common.core.annotation.LogOperation;
import com.thing.common.core.constants.Constant;
import com.thing.common.core.web.response.PageData;
import com.thing.common.core.web.response.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
@ -72,8 +72,9 @@ public class PlantController {
@GetMapping ("reduction")
@Operation(summary="管理端主平台-光伏节能减排信息")
private Result<ReductionStatistics> reduction(){
return plantService.reduction();
public Result<ReductionStatistics.ReductionInfo> reduction(){
ReductionStatistics.ReductionInfo reduction = plantService.reduction();
return new Result<ReductionStatistics.ReductionInfo>().ok(reduction);
}

2
modules/qingyuan/src/main/java/com/thing/qingyuan/manageboard/service/PlantService.java

@ -21,7 +21,7 @@ public interface PlantService extends IBaseService<PlantEntity> {
PhotovoltaicDTO findById(Long plantId);
Result<ReductionStatistics> reduction();
ReductionStatistics.ReductionInfo reduction();
List<PlantDTO> list(Map<String, Object> params);

16
modules/qingyuan/src/main/java/com/thing/qingyuan/manageboard/service/impl/PlantServiceImpl.java

@ -184,9 +184,9 @@ public class PlantServiceImpl extends BaseServiceImpl<PlantMapper, PlantEntity>
}
@Override
public Result<ReductionStatistics> reduction() {
public ReductionStatistics.ReductionInfo reduction() {
BigDecimal nowTotalA29yy = this.nowTotalA29yy();
BigDecimal allTotalA29yy = this.AllTotalA29yy();
// BigDecimal allTotalA29yy = this.AllTotalA29yy();
BigDecimal tceRatio = BigDecimal.valueOf(0.0004);
BigDecimal co2Ratio = BigDecimal.valueOf(0.000475);
BigDecimal treeRatio = BigDecimal.valueOf(18.3).divide(BigDecimal.valueOf(40),8,RoundingMode.UP).multiply(BigDecimal.valueOf(1000));
@ -196,13 +196,13 @@ public class PlantServiceImpl extends BaseServiceImpl<PlantMapper, PlantEntity>
nowYearInfo.setCo2(nowTotalA29yy.multiply(co2Ratio).setScale(4,RoundingMode.UP));
nowYearInfo.setTree(nowYearInfo.getCo2().multiply(treeRatio).setScale(4,RoundingMode.UP));
ReductionStatistics.ReductionInfo allInfo = new ReductionStatistics.ReductionInfo();
allInfo.setTce(allTotalA29yy.multiply(tceRatio).setScale(4,RoundingMode.UP));
allInfo.setCo2(allTotalA29yy.multiply(co2Ratio).setScale(4,RoundingMode.UP));
allInfo.setTree(allInfo.getCo2().multiply(treeRatio).setScale(4,RoundingMode.UP));
ReductionStatistics result = new ReductionStatistics(nowYearInfo,allInfo);
// ReductionStatistics.ReductionInfo allInfo = new ReductionStatistics.ReductionInfo();
// allInfo.setTce(allTotalA29yy.multiply(tceRatio).setScale(4,RoundingMode.UP));
// allInfo.setCo2(allTotalA29yy.multiply(co2Ratio).setScale(4,RoundingMode.UP));
// allInfo.setTree(allInfo.getCo2().multiply(treeRatio).setScale(4,RoundingMode.UP));
// ReductionStatistics result = new ReductionStatistics(nowYearInfo,allInfo);
return new Result<ReductionStatistics>().ok(result);
return nowYearInfo;
}

Loading…
Cancel
Save