|
@@ -1,20 +1,19 @@
|
|
|
package com.gyee.runeconomy.service.auto.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.gyee.common.model.PointData;
|
|
|
import com.gyee.common.model.StringUtils;
|
|
|
import com.gyee.runeconomy.dto.response.ProEconPointCodeDTO;
|
|
|
-import com.gyee.runeconomy.model.auto.ProBasicPowerstation;
|
|
|
-import com.gyee.runeconomy.model.auto.ProBasicPowerstationPoint;
|
|
|
-import com.gyee.runeconomy.model.auto.ProEconPointCode;
|
|
|
+import com.gyee.runeconomy.init.CacheContext;
|
|
|
+import com.gyee.runeconomy.model.auto.*;
|
|
|
import com.gyee.runeconomy.mapper.auto.ProEconPointCodeMapper;
|
|
|
-import com.gyee.runeconomy.service.auto.IProBasicPowerstationPointService;
|
|
|
import com.gyee.runeconomy.service.auto.IProEconPointCodeService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.gyee.runeconomy.util.realtimesource.EdosUtil;
|
|
|
+import com.gyee.runeconomy.service.auto.IProEconPowerstationInfoDay1Service;
|
|
|
+import com.gyee.runeconomy.service.auto.IProEconPowerstationInfoDay4Service;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -31,28 +30,20 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
- private ProBasicPowerstationServiceImpl proBasicPowerstationService;
|
|
|
+ private IProEconPowerstationInfoDay1Service proEconPowerstationInfoDay1Service;
|
|
|
|
|
|
@Autowired
|
|
|
- private IProBasicPowerstationPointService proBasicPowerstationPointService;
|
|
|
+ private ProBasicPowerstationServiceImpl proBasicPowerstationService;
|
|
|
|
|
|
@Autowired
|
|
|
- private EdosUtil edosUtil;
|
|
|
+ private IProEconPowerstationInfoDay4Service proEconPowerstationInfoDay4Service;
|
|
|
+
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public List<ProEconPointCode> getEconPointCodeList(String equipmentType) {
|
|
|
+ public List<ProEconPointCode> getEconPointCodeList() {
|
|
|
QueryWrapper<ProEconPointCode> qw = new QueryWrapper<>();
|
|
|
List<ProEconPointCode> list = baseMapper.selectList(qw);
|
|
|
- if (StringUtils.isNotEmpty(equipmentType) && equipmentType.equals("-1")) {
|
|
|
-
|
|
|
- list = list.stream().filter(i ->i.getEquipmentType().equals("fj")).collect(Collectors.toList());
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(equipmentType) && equipmentType.equals("-2")) {
|
|
|
-
|
|
|
- list = list.stream().filter(i -> i.getId().indexOf("gf") >= 0).collect(Collectors.toList());
|
|
|
- }
|
|
|
-
|
|
|
return list;
|
|
|
}
|
|
|
|
|
@@ -60,39 +51,583 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
|
|
|
public ProEconPointCode getProEconPointCode(String nemCode) {
|
|
|
QueryWrapper<ProEconPointCode> qw = new QueryWrapper<>();
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(nemCode) ) {
|
|
|
- qw.lambda().eq(ProEconPointCode::getNemCode,nemCode);
|
|
|
+ if (StringUtils.isNotEmpty(nemCode)) {
|
|
|
+ qw.lambda().eq(ProEconPointCode::getNemCode, nemCode);
|
|
|
}
|
|
|
- ProEconPointCode one = baseMapper.selectOne(qw);
|
|
|
+ ProEconPointCode one = baseMapper.selectOne(qw);
|
|
|
return one;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<ProEconPointCodeDTO> getEconPointRanking(String regionId, String companyId, String pointCode) {
|
|
|
- List<ProBasicPowerstation> powerstationList = proBasicPowerstationService.getProBasicPowerstationlist(regionId,companyId,"");
|
|
|
- ProEconPointCode pointCode1 = getProEconPointCode(pointCode);
|
|
|
+ public List<ProEconPointCodeDTO> getEconPointRanking(String regionId, String companyId, String pointCode, Date date, String dateType) {
|
|
|
+ List<ProBasicPowerstation> powerstationList = proBasicPowerstationService.getProBasicPowerstationlist(regionId, companyId, "");
|
|
|
+ ProEconPointCode proEconPointCode = getProEconPointCode(pointCode);
|
|
|
+ List<ProEconPointCodeDTO> dtos = new ArrayList<>();
|
|
|
+
|
|
|
+ switch (pointCode) {
|
|
|
+ case "fdl":
|
|
|
+ dtos = fdl(powerstationList, date, dateType, proEconPointCode);
|
|
|
+ break;
|
|
|
+ case "qfdl":
|
|
|
+ dtos = qfdl(powerstationList, date, dateType, proEconPointCode);
|
|
|
+ break;
|
|
|
+ case "fnlyl":
|
|
|
+ dtos = fnlyl(powerstationList, date, dateType, proEconPointCode);
|
|
|
+ break;
|
|
|
+ case "slssdl":
|
|
|
+ dtos = slssdl(powerstationList, date, dateType, proEconPointCode);
|
|
|
+ break;
|
|
|
+ case "jxssdl":
|
|
|
+ dtos = jxssdl(powerstationList, date, dateType, proEconPointCode);
|
|
|
+ break;
|
|
|
+ case "xdjclssdl":
|
|
|
+ dtos = xdjclssdl(powerstationList, date, dateType, proEconPointCode);
|
|
|
+ break;
|
|
|
+ case "gzssdl":
|
|
|
+ dtos = gzssdl(powerstationList, date, dateType, proEconPointCode);
|
|
|
+ break;
|
|
|
+ case "xnssdl":
|
|
|
+ dtos = xnssdl(powerstationList, date, dateType, proEconPointCode);
|
|
|
+ break;
|
|
|
+ case "fwjsl":
|
|
|
+ dtos = fwjsl(powerstationList, date, dateType, proEconPointCode);
|
|
|
+ break;
|
|
|
+ case "ztzhjsl":
|
|
|
+ dtos = ztzhjsl(powerstationList, date, dateType, proEconPointCode);
|
|
|
+ break;
|
|
|
+ case "gzxqjsl":
|
|
|
+ dtos = gzxqjsl(powerstationList, date, dateType, proEconPointCode);
|
|
|
+ break;
|
|
|
+ case "slssl":
|
|
|
+ dtos = slssl(powerstationList, date, dateType, proEconPointCode);
|
|
|
+ break;
|
|
|
+ case "jxssl":
|
|
|
+ dtos = jxssl(powerstationList, date, dateType, proEconPointCode);
|
|
|
+ break;
|
|
|
+ case "xdjclssl":
|
|
|
+ dtos = xdjclssl(powerstationList, date, dateType, proEconPointCode);
|
|
|
+ break;
|
|
|
+ case "gzssl":
|
|
|
+ dtos = gzssl(powerstationList, date, dateType, proEconPointCode);
|
|
|
+ break;
|
|
|
+ case "xnssl":
|
|
|
+ dtos = xnssl(powerstationList, date, dateType, proEconPointCode);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ProEconPointCodeDTO> dtoss = dtos.stream().sorted(Comparator.comparing(ProEconPointCodeDTO::getValue)).limit(10).collect(Collectors.toList());
|
|
|
+
|
|
|
+ return dtoss;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 发电量
|
|
|
+ */
|
|
|
+ private List<ProEconPointCodeDTO> fdl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
|
|
|
+ List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
|
|
|
List<ProEconPointCodeDTO> dtos = new ArrayList<>();
|
|
|
- powerstationList.stream().forEach(i->{
|
|
|
+
|
|
|
+ list.stream().forEach(i -> {
|
|
|
+
|
|
|
ProEconPointCodeDTO dto = new ProEconPointCodeDTO();
|
|
|
+ dto.setDescription(pointCode.getDescription() + "(" + pointCode.getUnit() + ")");
|
|
|
+ dto.setStationcode(i.getForeignKeyId());
|
|
|
+ dto.setStationname(CacheContext.wpmap.get(i.getForeignKeyId()).getName());
|
|
|
+ switch (dateType) {
|
|
|
+ case "r":
|
|
|
+ dto.setValue(i.getRfdl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ case "y":
|
|
|
+ dto.setValue(i.getYfdl());
|
|
|
+ break;
|
|
|
+ case "n":
|
|
|
+ dto.setValue(i.getNfdl());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ dtos.add(dto);
|
|
|
+ });
|
|
|
|
|
|
- dto.setDescription(pointCode1.getDescription()+"("+pointCode1.getUnit()+")");
|
|
|
- dto.setStationcode(i.getNemCode());
|
|
|
- dto.setStationname(i.getName());
|
|
|
+ return dtos;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 欠发电量
|
|
|
+ */
|
|
|
+ private List<ProEconPointCodeDTO> qfdl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
|
|
|
+ List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
|
|
|
+ List<ProEconPointCodeDTO> dtos = new ArrayList<>();
|
|
|
+ list.stream().forEach(i -> {
|
|
|
+
|
|
|
+ ProEconPointCodeDTO dto = new ProEconPointCodeDTO();
|
|
|
+ dto.setDescription(pointCode.getDescription() + "(" + pointCode.getUnit() + ")");
|
|
|
+ dto.setStationcode(i.getForeignKeyId());
|
|
|
+ dto.setStationname(CacheContext.wpmap.get(i.getForeignKeyId()).getName());
|
|
|
+ switch (dateType) {
|
|
|
+ case "r":
|
|
|
+ dto.setValue(i.getRqfdl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ case "y":
|
|
|
+ dto.setValue(i.getYqfdl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ case "n":
|
|
|
+ dto.setValue(i.getNqfdl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ dtos.add(dto);
|
|
|
+ });
|
|
|
+
|
|
|
+ return dtos;
|
|
|
+ }
|
|
|
|
|
|
- List<ProBasicPowerstationPoint> oripoint = proBasicPowerstationPointService.getProBasicPowerstationPointList(i.getId(),pointCode);
|
|
|
- if (null != oripoint && oripoint.size()>0){
|
|
|
- try {
|
|
|
- PointData p = edosUtil.getRealData(oripoint.get(0));
|
|
|
- dto.setValue(p.getPointValueInDouble()*pointCode1.getRatio());
|
|
|
- } catch (Exception e) {
|
|
|
|
|
|
+ // 风能利用率
|
|
|
+ private List<ProEconPointCodeDTO> fnlyl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
|
|
|
+ List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
|
|
|
+ List<ProEconPointCodeDTO> dtos = new ArrayList<>();
|
|
|
+ list.stream().forEach(i -> {
|
|
|
+
|
|
|
+ ProEconPointCodeDTO dto = new ProEconPointCodeDTO();
|
|
|
+ dto.setDescription(pointCode.getDescription() + "(" + pointCode.getUnit() + ")");
|
|
|
+ dto.setStationcode(i.getForeignKeyId());
|
|
|
+ dto.setStationname(CacheContext.wpmap.get(i.getForeignKeyId()).getName());
|
|
|
+ if(compare0(i.getRllfdl())){
|
|
|
+ switch (dateType) {
|
|
|
+ case "r":
|
|
|
+ //发电量/理论发电量*100
|
|
|
+ //divide(fdinfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))
|
|
|
+ dto.setValue(i.getRqfdl().divide(i.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP));
|
|
|
+ break;
|
|
|
+ case "y":
|
|
|
+ dto.setValue(i.getRqfdl().divide(i.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP));
|
|
|
+ break;
|
|
|
+ case "n":
|
|
|
+ dto.setValue(i.getRqfdl().divide(i.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP));
|
|
|
+ break;
|
|
|
}
|
|
|
+ dto.setValue(compare100(dto.getValue()));
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
dtos.add(dto);
|
|
|
});
|
|
|
-// SortUtils.sort(dtos,"value",SortUtils.DESC);
|
|
|
- List<ProEconPointCodeDTO> dtoss = dtos.stream().sorted(Comparator.comparing(ProEconPointCodeDTO::getValue)).limit(10).collect(Collectors.toList());
|
|
|
|
|
|
- return dtoss;
|
|
|
+ return dtos;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 受累损失电量
|
|
|
+ */
|
|
|
+ private List<ProEconPointCodeDTO> slssdl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
|
|
|
+ List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
|
|
|
+ List<ProEconPointCodeDTO> dtos = new ArrayList<>();
|
|
|
+ list.stream().forEach(i -> {
|
|
|
+
|
|
|
+ ProEconPointCodeDTO dto = new ProEconPointCodeDTO();
|
|
|
+ dto.setDescription(pointCode.getDescription() + "(" + pointCode.getUnit() + ")");
|
|
|
+ dto.setStationcode(i.getForeignKeyId());
|
|
|
+ dto.setStationname(CacheContext.wpmap.get(i.getForeignKeyId()).getName());
|
|
|
+ switch (dateType) {
|
|
|
+ case "r":
|
|
|
+ dto.setValue((i.getRcwsltqssdl().add(i.getRcwsldwssdl())).divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ case "y":
|
|
|
+ dto.setValue((i.getYcwsltqssdl().add(i.getYcwsldwssdl())).divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ case "n":
|
|
|
+ dto.setValue((i.getNcwsltqssdl().add(i.getNcwsldwssdl())).divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ dtos.add(dto);
|
|
|
+ });
|
|
|
+
|
|
|
+ return dtos;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /** 检修损失电量 */
|
|
|
+ private List<ProEconPointCodeDTO> jxssdl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
|
|
|
+ List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
|
|
|
+ List<ProEconPointCodeDTO> dtos = new ArrayList<>();
|
|
|
+ list.stream().forEach(i -> {
|
|
|
+
|
|
|
+ ProEconPointCodeDTO dto = new ProEconPointCodeDTO();
|
|
|
+ dto.setDescription(pointCode.getDescription() + "(" + pointCode.getUnit() + ")");
|
|
|
+ dto.setStationcode(i.getForeignKeyId());
|
|
|
+ dto.setStationname(CacheContext.wpmap.get(i.getForeignKeyId()).getName());
|
|
|
+ switch (dateType) {
|
|
|
+ case "r":
|
|
|
+ dto.setValue(i.getRjxssdl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ case "y":
|
|
|
+ dto.setValue(i.getYjxssdl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ case "n":
|
|
|
+ dto.setValue(i.getNjxssdl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ dtos.add(dto);
|
|
|
+ });
|
|
|
+
|
|
|
+ return dtos;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 限电损失电量*/
|
|
|
+ private List<ProEconPointCodeDTO> xdjclssdl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
|
|
|
+ List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
|
|
|
+ List<ProEconPointCodeDTO> dtos = new ArrayList<>();
|
|
|
+ list.stream().forEach(i -> {
|
|
|
+
|
|
|
+ ProEconPointCodeDTO dto = new ProEconPointCodeDTO();
|
|
|
+ dto.setDescription(pointCode.getDescription() + "(" + pointCode.getUnit() + ")");
|
|
|
+ dto.setStationcode(i.getForeignKeyId());
|
|
|
+ dto.setStationname(CacheContext.wpmap.get(i.getForeignKeyId()).getName());
|
|
|
+ switch (dateType) {
|
|
|
+ case "r":
|
|
|
+ dto.setValue((i.getRxdtjssdl().add(i.getRxdjclssdl())).divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ case "y":
|
|
|
+ dto.setValue((i.getYxdtjssdl().add(i.getYxdjclssdl())).divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ case "n":
|
|
|
+ dto.setValue((i.getNxdtjssdl().add(i.getNxdjclssdl())).divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ dtos.add(dto);
|
|
|
+ });
|
|
|
+
|
|
|
+ return dtos;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 故障损失电量*/
|
|
|
+ private List<ProEconPointCodeDTO> gzssdl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
|
|
|
+ List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
|
|
|
+ List<ProEconPointCodeDTO> dtos = new ArrayList<>();
|
|
|
+ list.stream().forEach(i -> {
|
|
|
+
|
|
|
+ ProEconPointCodeDTO dto = new ProEconPointCodeDTO();
|
|
|
+ dto.setDescription(pointCode.getDescription() + "(" + pointCode.getUnit() + ")");
|
|
|
+ dto.setStationcode(i.getForeignKeyId());
|
|
|
+ dto.setStationname(CacheContext.wpmap.get(i.getForeignKeyId()).getName());
|
|
|
+ switch (dateType) {
|
|
|
+ case "r":
|
|
|
+ dto.setValue(i.getRgzssdl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ case "y":
|
|
|
+ dto.setValue(i.getYgzssdl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ case "n":
|
|
|
+ dto.setValue(i.getNgzssdl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ dtos.add(dto);
|
|
|
+ });
|
|
|
+
|
|
|
+ return dtos;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 性能损失电量*/
|
|
|
+ private List<ProEconPointCodeDTO> xnssdl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
|
|
|
+ List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
|
|
|
+ List<ProEconPointCodeDTO> dtos = new ArrayList<>();
|
|
|
+ list.stream().forEach(i -> {
|
|
|
+
|
|
|
+ ProEconPointCodeDTO dto = new ProEconPointCodeDTO();
|
|
|
+ dto.setDescription(pointCode.getDescription() + "(" + pointCode.getUnit() + ")");
|
|
|
+ dto.setStationcode(i.getForeignKeyId());
|
|
|
+ dto.setStationname(CacheContext.wpmap.get(i.getForeignKeyId()).getName());
|
|
|
+ switch (dateType) {
|
|
|
+ case "r":
|
|
|
+ dto.setValue(i.getRxnssdl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ case "y":
|
|
|
+ dto.setValue(i.getYxnssdl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ case "n":
|
|
|
+ dto.setValue(i.getNxnssdl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ dtos.add(dto);
|
|
|
+ });
|
|
|
+
|
|
|
+ return dtos;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 复位及时率 */
|
|
|
+ private List<ProEconPointCodeDTO> fwjsl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
|
|
|
+ List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconPowerstationInfoDay4> list = proEconPowerstationInfoDay4Service.getEconThreeRateCurvelist(stationlist, date);
|
|
|
+ List<ProEconPointCodeDTO> dtos = new ArrayList<>();
|
|
|
+ list.stream().forEach(i -> {
|
|
|
+
|
|
|
+ ProEconPointCodeDTO dto = new ProEconPointCodeDTO();
|
|
|
+ dto.setDescription(pointCode.getDescription() + "(" + pointCode.getUnit() + ")");
|
|
|
+ dto.setStationcode(i.getForeignKeyId());
|
|
|
+ dto.setStationname(CacheContext.wpmap.get(i.getForeignKeyId()).getName());
|
|
|
+ switch (dateType) {
|
|
|
+ case "r":
|
|
|
+ dto.setValue(i.getRfwjsl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ case "y":
|
|
|
+ dto.setValue(i.getYfwjsl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ case "n":
|
|
|
+ dto.setValue(i.getNfwjsl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ dtos.add(dto);
|
|
|
+ });
|
|
|
+
|
|
|
+ return dtos;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 状态转换及时率 */
|
|
|
+ private List<ProEconPointCodeDTO> ztzhjsl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
|
|
|
+ List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconPowerstationInfoDay4> list = proEconPowerstationInfoDay4Service.getEconThreeRateCurvelist(stationlist, date);
|
|
|
+ List<ProEconPointCodeDTO> dtos = new ArrayList<>();
|
|
|
+ list.stream().forEach(i -> {
|
|
|
+
|
|
|
+ ProEconPointCodeDTO dto = new ProEconPointCodeDTO();
|
|
|
+ dto.setDescription(pointCode.getDescription() + "(" + pointCode.getUnit() + ")");
|
|
|
+ dto.setStationcode(i.getForeignKeyId());
|
|
|
+ dto.setStationname(CacheContext.wpmap.get(i.getForeignKeyId()).getName());
|
|
|
+ switch (dateType) {
|
|
|
+ case "r":
|
|
|
+ dto.setValue(i.getRztzhjsl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ case "y":
|
|
|
+ dto.setValue(i.getYztzhjsl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ case "n":
|
|
|
+ dto.setValue(i.getNztzhjsl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ dtos.add(dto);
|
|
|
+ });
|
|
|
+
|
|
|
+ return dtos;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 故障消缺及时率 */
|
|
|
+ private List<ProEconPointCodeDTO> gzxqjsl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
|
|
|
+ List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconPowerstationInfoDay4> list = proEconPowerstationInfoDay4Service.getEconThreeRateCurvelist(stationlist, date);
|
|
|
+ List<ProEconPointCodeDTO> dtos = new ArrayList<>();
|
|
|
+ list.stream().forEach(i -> {
|
|
|
+
|
|
|
+ ProEconPointCodeDTO dto = new ProEconPointCodeDTO();
|
|
|
+ dto.setDescription(pointCode.getDescription() + "(" + pointCode.getUnit() + ")");
|
|
|
+ dto.setStationcode(i.getForeignKeyId());
|
|
|
+ dto.setStationname(CacheContext.wpmap.get(i.getForeignKeyId()).getName());
|
|
|
+ switch (dateType) {
|
|
|
+ case "r":
|
|
|
+ dto.setValue(i.getRgzxqjsl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ case "y":
|
|
|
+ dto.setValue(i.getYgzxqjsl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ case "n":
|
|
|
+ dto.setValue(i.getNgzxqjsl().divide(new BigDecimal(pointCode.getRatio())));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ dtos.add(dto);
|
|
|
+ });
|
|
|
+
|
|
|
+ return dtos;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 受累损失率 */
|
|
|
+ private List<ProEconPointCodeDTO> slssl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
|
|
|
+ List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
|
|
|
+ List<ProEconPointCodeDTO> dtos = new ArrayList<>();
|
|
|
+ list.stream().forEach(i -> {
|
|
|
+
|
|
|
+ ProEconPointCodeDTO dto = new ProEconPointCodeDTO();
|
|
|
+ dto.setDescription(pointCode.getDescription() + "(" + pointCode.getUnit() + ")");
|
|
|
+ dto.setStationcode(i.getForeignKeyId());
|
|
|
+ dto.setStationname(CacheContext.wpmap.get(i.getForeignKeyId()).getName());
|
|
|
+
|
|
|
+ switch (dateType) {
|
|
|
+ case "r":
|
|
|
+ dto.setValue(compare0(i.getRllfdl())?(i.getRcwsltqssdl().add(i.getRcwsldwssdl())).divide(i.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(pointCode.getRatio())): new BigDecimal(0));
|
|
|
+ break;
|
|
|
+ case "y":
|
|
|
+ dto.setValue(compare0(i.getYllfdl())?(i.getYcwsltqssdl().add(i.getYcwsldwssdl())).divide(i.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(pointCode.getRatio())):new BigDecimal(0));
|
|
|
+ break;
|
|
|
+ case "n":
|
|
|
+ dto.setValue(compare0(i.getNllfdl())?(i.getNcwsltqssdl().add(i.getNcwsldwssdl())).divide(i.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(pointCode.getRatio())):new BigDecimal(0));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ dto.setValue(compare100(dto.getValue()));
|
|
|
+
|
|
|
+ dtos.add(dto);
|
|
|
+ });
|
|
|
+
|
|
|
+ return dtos;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 检修损失率 */
|
|
|
+ private List<ProEconPointCodeDTO> jxssl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
|
|
|
+ List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
|
|
|
+ List<ProEconPointCodeDTO> dtos = new ArrayList<>();
|
|
|
+ list.stream().forEach(i -> {
|
|
|
+
|
|
|
+ ProEconPointCodeDTO dto = new ProEconPointCodeDTO();
|
|
|
+ dto.setDescription(pointCode.getDescription() + "(" + pointCode.getUnit() + ")");
|
|
|
+ dto.setStationcode(i.getForeignKeyId());
|
|
|
+ dto.setStationname(CacheContext.wpmap.get(i.getForeignKeyId()).getName());
|
|
|
+
|
|
|
+
|
|
|
+ switch (dateType) {
|
|
|
+ case "r":
|
|
|
+ dto.setValue(compare0(i.getRllfdl())?i.getRjxssdl().divide(i.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(pointCode.getRatio())): new BigDecimal(0));
|
|
|
+ break;
|
|
|
+ case "y":
|
|
|
+ dto.setValue(compare0(i.getYllfdl())?i.getYjxssdl().divide(i.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(pointCode.getRatio())):new BigDecimal(0));
|
|
|
+ break;
|
|
|
+ case "n":
|
|
|
+ dto.setValue(compare0(i.getNllfdl())?i.getNjxssdl().divide(i.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(pointCode.getRatio())):new BigDecimal(0));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ dto.setValue(compare100(dto.getValue()));
|
|
|
+ dtos.add(dto);
|
|
|
+ });
|
|
|
+
|
|
|
+ return dtos;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 限电损失率 */
|
|
|
+ private List<ProEconPointCodeDTO> xdjclssl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
|
|
|
+ List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
|
|
|
+ List<ProEconPointCodeDTO> dtos = new ArrayList<>();
|
|
|
+ list.stream().forEach(i -> {
|
|
|
+
|
|
|
+ ProEconPointCodeDTO dto = new ProEconPointCodeDTO();
|
|
|
+ dto.setDescription(pointCode.getDescription() + "(" + pointCode.getUnit() + ")");
|
|
|
+ dto.setStationcode(i.getForeignKeyId());
|
|
|
+ dto.setStationname(CacheContext.wpmap.get(i.getForeignKeyId()).getName());
|
|
|
+ switch (dateType) {
|
|
|
+ case "r":
|
|
|
+ dto.setValue(compare0(i.getRllfdl())?i.getRxdtjssdl().divide(i.getRxdjclssdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(pointCode.getRatio())): new BigDecimal(0));
|
|
|
+ break;
|
|
|
+ case "y":
|
|
|
+ dto.setValue(compare0(i.getYllfdl())?i.getYxdtjssdl().divide(i.getYxdjclssdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(pointCode.getRatio())):new BigDecimal(0));
|
|
|
+ break;
|
|
|
+ case "n":
|
|
|
+ dto.setValue(compare0(i.getNllfdl())?i.getNxdtjssdl().divide(i.getNxdjclssdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(pointCode.getRatio())):new BigDecimal(0));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ dto.setValue(compare100(dto.getValue()));
|
|
|
+ dtos.add(dto);
|
|
|
+ });
|
|
|
+
|
|
|
+ return dtos;
|
|
|
}
|
|
|
+
|
|
|
+ /** 故障损失率*/
|
|
|
+ private List<ProEconPointCodeDTO> gzssl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
|
|
|
+ List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
|
|
|
+ List<ProEconPointCodeDTO> dtos = new ArrayList<>();
|
|
|
+ list.stream().forEach(i -> {
|
|
|
+
|
|
|
+ ProEconPointCodeDTO dto = new ProEconPointCodeDTO();
|
|
|
+ dto.setDescription(pointCode.getDescription() + "(" + pointCode.getUnit() + ")");
|
|
|
+ dto.setStationcode(i.getForeignKeyId());
|
|
|
+ dto.setStationname(CacheContext.wpmap.get(i.getForeignKeyId()).getName());
|
|
|
+ switch (dateType) {
|
|
|
+ case "r":
|
|
|
+ dto.setValue(compare0(i.getRllfdl())?i.getRgzssdl().divide(i.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(pointCode.getRatio())): new BigDecimal(0));
|
|
|
+ break;
|
|
|
+ case "y":
|
|
|
+ dto.setValue(compare0(i.getYllfdl())?i.getYgzssdl().divide(i.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(pointCode.getRatio())):new BigDecimal(0));
|
|
|
+ break;
|
|
|
+ case "n":
|
|
|
+ dto.setValue(compare0(i.getNllfdl())?i.getNgzssdl().divide(i.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(pointCode.getRatio())):new BigDecimal(0));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ dto.setValue(compare100(dto.getValue()));
|
|
|
+ dtos.add(dto);
|
|
|
+ });
|
|
|
+
|
|
|
+ return dtos;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 性能损失率 */
|
|
|
+ private List<ProEconPointCodeDTO> xnssl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
|
|
|
+ List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
|
|
|
+ List<ProEconPointCodeDTO> dtos = new ArrayList<>();
|
|
|
+ list.stream().forEach(i -> {
|
|
|
+
|
|
|
+ ProEconPointCodeDTO dto = new ProEconPointCodeDTO();
|
|
|
+ dto.setDescription(pointCode.getDescription() + "(" + pointCode.getUnit() + ")");
|
|
|
+ dto.setStationcode(i.getForeignKeyId());
|
|
|
+ dto.setStationname(CacheContext.wpmap.get(i.getForeignKeyId()).getName());
|
|
|
+ switch (dateType) {
|
|
|
+ case "r":
|
|
|
+ dto.setValue(compare0(i.getRllfdl())?i.getRxnssdl().divide(i.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(pointCode.getRatio())): new BigDecimal(0));
|
|
|
+ break;
|
|
|
+ case "y":
|
|
|
+ dto.setValue(compare0(i.getYllfdl())?i.getYxnssdl().divide(i.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(pointCode.getRatio())):new BigDecimal(0));
|
|
|
+ break;
|
|
|
+ case "n":
|
|
|
+ dto.setValue(compare0(i.getNllfdl())?i.getNxnssdl().divide(i.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(pointCode.getRatio())):new BigDecimal(0));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ dto.setValue(compare100(dto.getValue()));
|
|
|
+ dtos.add(dto);
|
|
|
+ });
|
|
|
+
|
|
|
+ return dtos;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private BigDecimal compare100(BigDecimal a) {
|
|
|
+ BigDecimal b = new BigDecimal(100);
|
|
|
+ if (b.compareTo(a) == -1) {
|
|
|
+ a = new BigDecimal(100);
|
|
|
+ ;
|
|
|
+ }
|
|
|
+ return a;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private boolean compare0(BigDecimal a) {
|
|
|
+ BigDecimal b = new BigDecimal(0.00);
|
|
|
+ if (b.compareTo(a.setScale(2, BigDecimal.ROUND_HALF_UP)) == 0) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
}
|