|
@@ -4,6 +4,7 @@ package com.gyee.runeconomy.service.bmk;
|
|
|
@date 2022/11/23-11:06
|
|
|
*/
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.gyee.common.model.StringUtils;
|
|
|
import com.gyee.common.util.BigDecimalUtils;
|
|
@@ -44,6 +45,7 @@ public class BenchmarkingService {
|
|
|
|
|
|
@Resource
|
|
|
private IProEconEquipmentInfoDay1Service proEconEquipmentInfoDay1Service;
|
|
|
+ private List<ProBasicOrganizeTree> organizeTrees;
|
|
|
|
|
|
public List<ProBasicOrganizeTree> companys() {
|
|
|
List<ProBasicOrganizeTree> cpls = CacheContext.cpls;
|
|
@@ -64,7 +66,7 @@ public class BenchmarkingService {
|
|
|
|
|
|
SortUtils.sort(result, "orderNum", SortUtils.ASC);
|
|
|
|
|
|
- result.add(0,company);
|
|
|
+ result.add(0, company);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -120,24 +122,24 @@ public class BenchmarkingService {
|
|
|
}
|
|
|
|
|
|
public ProBasicOrganizeTree treeByWpid(String wpId, String treeType) {
|
|
|
-
|
|
|
- ProBasicOrganizeTree root = null;
|
|
|
- List<ProBasicOrganizeTree> collect = CacheContext.proBasicOrganizeTrees.stream().filter(pbot -> {
|
|
|
- if(wpId.equals(pbot.getParentCode()) || wpId.equals(pbot.getId())){
|
|
|
- if("AG".equals(treeType)){
|
|
|
- if("EQ".equals(pbot.getOrgType())) return false;
|
|
|
- }else if ("LN".equals(treeType)){
|
|
|
- if("EQ".equals(pbot.getOrgType()) || "AG".equals(pbot.getOrgType())) return false;
|
|
|
- } else if ("EG".equals(treeType)) {
|
|
|
- if("EQ".equals(pbot.getOrgType()) || "AG".equals(pbot.getOrgType()) || "LN".equals(pbot.getOrgType())) return false;
|
|
|
+ if (organizeTrees == null) {
|
|
|
+ List<ProBasicOrganizeTree> collect = CacheContext.proBasicOrganizeTrees.stream().filter(ot -> {
|
|
|
+ if ("EQ".equals(ot.getOrgType())) {
|
|
|
+ if (!"IN".equals(ot.getEqType())) return false;
|
|
|
}
|
|
|
- }else {
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
- }).collect(Collectors.toList());
|
|
|
+ return true;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ organizeTrees = ObjectUtil.cloneByStream(collect);
|
|
|
+ ProBasicOrganizeTree.buildTree(organizeTrees);
|
|
|
+ }
|
|
|
|
|
|
- return ProBasicOrganizeTree.buildTree(collect);
|
|
|
+ List<ProBasicOrganizeTree> trees = ObjectUtil.cloneByStream(organizeTrees);
|
|
|
+ ProBasicOrganizeTree anElse = trees.stream().peek(t -> {
|
|
|
+ if (treeType.equals(t.getOrgType())) {
|
|
|
+ t.setChildren(new ArrayList<>());
|
|
|
+ }
|
|
|
+ }).filter(t -> wpId.equals(t.getId())).findFirst().orElse(null);
|
|
|
+ return anElse;
|
|
|
}
|
|
|
|
|
|
public List<ProBasicOrganizeEquipment> wtByWplistxin(String wpids) {
|
|
@@ -146,17 +148,17 @@ public class BenchmarkingService {
|
|
|
}
|
|
|
|
|
|
//public List<ProBasicOrganizeTree> modellist(String wpids) {
|
|
|
-// if (CacheContext.wtls == null) {
|
|
|
-// return new ArrayList<>();
|
|
|
-// }
|
|
|
-//
|
|
|
-// return CacheContext.wtls.stream()
|
|
|
-// .filter(wt -> "EQ".equals(wt.getOrgType()) && wt.getPcodes() != null && wpids.contains(wt.getPcodes()))
|
|
|
-// .collect(Collectors.toMap(ProBasicOrganizeTree::getModelId, Function.identity(), (a, b) -> a))
|
|
|
-// .values()
|
|
|
-// .stream()
|
|
|
-// .collect(Collectors.toList());
|
|
|
-//}
|
|
|
+ // if (CacheContext.wtls == null) {
|
|
|
+ // return new ArrayList<>();
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // return CacheContext.wtls.stream()
|
|
|
+ // .filter(wt -> "EQ".equals(wt.getOrgType()) && wt.getPcodes() != null && wpids.contains(wt.getPcodes()))
|
|
|
+ // .collect(Collectors.toMap(ProBasicOrganizeTree::getModelId, Function.identity(), (a, b) -> a))
|
|
|
+ // .values()
|
|
|
+ // .stream()
|
|
|
+ // .collect(Collectors.toList());
|
|
|
+ //}
|
|
|
public List<ProBasicOrganizeTree> modellist(String wpids) {
|
|
|
if (CacheContext.wtls == null) {
|
|
|
return new ArrayList<>();
|
|
@@ -188,10 +190,10 @@ public class BenchmarkingService {
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
- for (ProBasicOrganizeEquipment sqlist :collect) {
|
|
|
+ for (ProBasicOrganizeEquipment sqlist : collect) {
|
|
|
for (ProBasicOrganizeTree sq : CacheContext.sqls) {
|
|
|
|
|
|
- if (sqlist.getSquareId().equals(sq.getId())){
|
|
|
+ if (sqlist.getSquareId().equals(sq.getId())) {
|
|
|
sqlist.setParentCode(sq.getAname());
|
|
|
}
|
|
|
}
|
|
@@ -981,7 +983,7 @@ public class BenchmarkingService {
|
|
|
|
|
|
|
|
|
public List<WxsslVo> details(String id, String beginDate, String endDate, String target, String sort) {
|
|
|
- if(endDate==null){
|
|
|
+ if (endDate == null) {
|
|
|
beginDate = beginDate + "-01";
|
|
|
}
|
|
|
List<WxsslVo> resultList = new ArrayList<>();
|
|
@@ -1064,7 +1066,7 @@ public class BenchmarkingService {
|
|
|
|
|
|
SortUtils.sort(result, "orderNum", SortUtils.ASC);
|
|
|
|
|
|
- result.add(0,company);
|
|
|
+ result.add(0, company);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -1318,10 +1320,10 @@ public class BenchmarkingService {
|
|
|
for (String s1 : splitMd) {
|
|
|
|
|
|
|
|
|
-// List<String> wtls = CacheContext.wtls.stream().filter(c -> !Objects.isNull(c.getModelId()) && c.getNemName().contains("逆变器") &&
|
|
|
-// s1.equals(c.getModelId())).map(ot -> ot.getId()).collect(Collectors.toList());
|
|
|
+ // List<String> wtls = CacheContext.wtls.stream().filter(c -> !Objects.isNull(c.getModelId()) && c.getNemName().contains("逆变器") &&
|
|
|
+ // s1.equals(c.getModelId())).map(ot -> ot.getId()).collect(Collectors.toList());
|
|
|
|
|
|
- List<String> wtls = CacheContext.organizeEquipmentList.stream().filter(
|
|
|
+ List<String> wtls = CacheContext.organizeEquipmentList.stream().filter(
|
|
|
oe -> wpids.contains(oe.getWindpowerstationId())).map(ot -> ot.getWindturbineId()).collect(Collectors.toList());
|
|
|
|
|
|
if (wtls.size() == 0) continue;
|
|
@@ -1354,7 +1356,7 @@ public class BenchmarkingService {
|
|
|
peeidls.add(infoDay1);
|
|
|
}
|
|
|
} else if (model.isEmpty()) {
|
|
|
- List<String> wtls = CacheContext.organizeEquipmentList.stream().filter(
|
|
|
+ List<String> wtls = CacheContext.organizeEquipmentList.stream().filter(
|
|
|
oe -> wpids.contains(oe.getWindpowerstationId())).map(ot -> ot.getWindturbineId()).collect(Collectors.toList());
|
|
|
|
|
|
QueryWrapper<ProEconEquipmentInfoDay1> wiqw = qw.clone().in("windturbine_id", wtls);
|
|
@@ -1362,7 +1364,7 @@ public class BenchmarkingService {
|
|
|
|
|
|
ProEconEquipmentInfoDay1 infoDay1 = new ProEconEquipmentInfoDay1();
|
|
|
|
|
|
- for (ProBasicOrganizeTree t1: CacheContext.wtls){
|
|
|
+ for (ProBasicOrganizeTree t1 : CacheContext.wtls) {
|
|
|
for (ProEconEquipmentInfoDay1 listl : listls) {
|
|
|
infoDay1.setRfdl((infoDay1.getRfdl() != null ? infoDay1.getRfdl() : 0) + (listl.getRfdl() != null ? listl.getRfdl() : 0));
|
|
|
infoDay1.setRllfdl((infoDay1.getRllfdl() != null ? infoDay1.getRllfdl() : 0) + (listl.getRllfdl() != null ? listl.getRllfdl() : 0));
|
|
@@ -1387,62 +1389,62 @@ public class BenchmarkingService {
|
|
|
peeidls.add(infoDay1);
|
|
|
}
|
|
|
|
|
|
- if (!peeidls.isEmpty() && peeidls.size() > 0) {
|
|
|
- if (peeidls.get(0).getWindturbineId() != null && !peeidls.get(0).getWindturbineId().isEmpty()
|
|
|
- && peeidls.get(0).getWindpowerstationId() != null && !peeidls.get(0).getWindpowerstationId().isEmpty()) {
|
|
|
-
|
|
|
- Map<String, Integer> station = CacheContext.wpls
|
|
|
- .stream().collect(Collectors.toMap(ProBasicOrganizeTree::getId, ProBasicOrganizeTree::getOrderNum));
|
|
|
-
|
|
|
- if (!type.equals(TYPE_DATE))
|
|
|
- for (ProEconEquipmentInfoDay1 i : peeidls) {
|
|
|
- WxsslVo vo = new WxsslVo();
|
|
|
-
|
|
|
- if (type.equals(TYPE_WIND)) {
|
|
|
-// vo.setId(i.getWindpowerstationId());
|
|
|
- vo.setName(i.getWindturbineId());
|
|
|
- vo.setOrdernum(station.get(i.getWindpowerstationId()).doubleValue());
|
|
|
- } else if (type.equals(TYPE_PROJECT)) {
|
|
|
- vo.setId(i.getProjectId());
|
|
|
- vo.setName(CacheContext.pjmap.get(i.getProjectId().trim()).getModelId());
|
|
|
- vo.setOrdernum(CacheContext.pjmap.get(i.getProjectId().trim()).getOrderNum().doubleValue());
|
|
|
- } else if (type.equals(TYPE_LINE)) {
|
|
|
- vo.setId(i.getLineId());
|
|
|
- vo.setName(CacheContext.lnmap.get(i.getLineId().trim()).getModelId());
|
|
|
- vo.setOrdernum(CacheContext.lnmap.get(i.getLineId().trim()).getOrderNum().doubleValue());
|
|
|
- } else if (type.equals(TYPE_WINDTURBINE)) {
|
|
|
- vo.setId(i.getWindturbineId());
|
|
|
- vo.setName(CacheContext.wtmap.get(i.getWindturbineId().trim()).getModelId());
|
|
|
- vo.setOrdernum(CacheContext.wtmap.get(i.getWindturbineId().trim()).getOrderNum().doubleValue());
|
|
|
- } else if (type.equals(TYPE_SQUARE)) {
|
|
|
- vo.setId(i.getSquareId());
|
|
|
- vo.setName(CacheContext.proBasicOrganizeTreesMap.get(i.getSquareId()).getModelId());
|
|
|
- vo.setOrdernum(CacheContext.proBasicOrganizeTreesMap.get(i.getSquareId()).getOrderNum().doubleValue());
|
|
|
- } else if (type.equals(TYPE_COMPANY)) {
|
|
|
- vo.setId(i.getId());
|
|
|
- vo.setName(CacheContext.proBasicOrganizeTreesMap.get(i.getId()).getAname());
|
|
|
- vo.setOrdernum(CacheContext.proBasicOrganizeTreesMap.get(i.getId()).getOrderNum().doubleValue());
|
|
|
- }
|
|
|
-
|
|
|
- vo.setDate(i.getRecordDate());
|
|
|
- vo.setFdl(DoubleUtils.keepPrecision(i.getRfdl() / 10000, 2));
|
|
|
- vo.setLlfdl(DoubleUtils.keepPrecision(i.getRllfdl() / 10000, 2));
|
|
|
- vo.setJxssdl(DoubleUtils.keepPrecision((i.getRjxssdl() + i.getRcnsljxssdl()) / 10000, 2));
|
|
|
- vo.setGzssdl(DoubleUtils.keepPrecision((i.getRgzssdl() + i.getRcnslgzssdl()) / 10000, 2));
|
|
|
- vo.setXdssdl(DoubleUtils.keepPrecision((i.getRxdtjssdl() + i.getRxdjclssdl()) / 10000, 2));
|
|
|
- vo.setSlssdl(DoubleUtils.keepPrecision((i.getRcwsltqssdl() + i.getRcwsldwssdl()) / 10000, 2));
|
|
|
- vo.setXnssdl(DoubleUtils.keepPrecision((i.getRdjssdl() + i.getRsdtjssdl() + i.getRqxjclssdl() + i.getRxnssdl()) / 10000, 2));
|
|
|
- vo.setZssdl(DoubleUtils.keepPrecision(vo.getGzssdl() + vo.getJxssdl() + vo.getXdssdl() + vo.getXnssdl() + vo.getSlssdl(), 2));
|
|
|
- vo.setFnlyl(vo.getLlfdl() != 0 ? DoubleUtils.keepPrecision(vo.getFdl() / vo.getLlfdl() * 100, 2) : 0);
|
|
|
- vo.setGzssl(vo.getLlfdl() != 0 ? DoubleUtils.keepPrecision(vo.getGzssdl() / vo.getLlfdl() * 100, 2) : 0);
|
|
|
- vo.setJxssl(vo.getLlfdl() != 0 ? DoubleUtils.keepPrecision(vo.getJxssdl() / vo.getLlfdl() * 100, 2) : 0);
|
|
|
- vo.setQfl(vo.getLlfdl() != 0 ? DoubleUtils.keepPrecision(vo.getXdssdl() / vo.getLlfdl() * 100, 2) : 0);
|
|
|
- vo.setXnssl(vo.getLlfdl() != 0 ? DoubleUtils.keepPrecision(vo.getXnssdl() / vo.getLlfdl() * 100, 2) : 0);
|
|
|
- vo.setSlssl(vo.getLlfdl() != 0 ? DoubleUtils.keepPrecision(vo.getSlssdl() / vo.getLlfdl() * 100, 2) : 0);
|
|
|
- resultList.add(vo);
|
|
|
+ if (!peeidls.isEmpty() && peeidls.size() > 0) {
|
|
|
+ if (peeidls.get(0).getWindturbineId() != null && !peeidls.get(0).getWindturbineId().isEmpty()
|
|
|
+ && peeidls.get(0).getWindpowerstationId() != null && !peeidls.get(0).getWindpowerstationId().isEmpty()) {
|
|
|
+
|
|
|
+ Map<String, Integer> station = CacheContext.wpls
|
|
|
+ .stream().collect(Collectors.toMap(ProBasicOrganizeTree::getId, ProBasicOrganizeTree::getOrderNum));
|
|
|
+
|
|
|
+ if (!type.equals(TYPE_DATE))
|
|
|
+ for (ProEconEquipmentInfoDay1 i : peeidls) {
|
|
|
+ WxsslVo vo = new WxsslVo();
|
|
|
+
|
|
|
+ if (type.equals(TYPE_WIND)) {
|
|
|
+ // vo.setId(i.getWindpowerstationId());
|
|
|
+ vo.setName(i.getWindturbineId());
|
|
|
+ vo.setOrdernum(station.get(i.getWindpowerstationId()).doubleValue());
|
|
|
+ } else if (type.equals(TYPE_PROJECT)) {
|
|
|
+ vo.setId(i.getProjectId());
|
|
|
+ vo.setName(CacheContext.pjmap.get(i.getProjectId().trim()).getModelId());
|
|
|
+ vo.setOrdernum(CacheContext.pjmap.get(i.getProjectId().trim()).getOrderNum().doubleValue());
|
|
|
+ } else if (type.equals(TYPE_LINE)) {
|
|
|
+ vo.setId(i.getLineId());
|
|
|
+ vo.setName(CacheContext.lnmap.get(i.getLineId().trim()).getModelId());
|
|
|
+ vo.setOrdernum(CacheContext.lnmap.get(i.getLineId().trim()).getOrderNum().doubleValue());
|
|
|
+ } else if (type.equals(TYPE_WINDTURBINE)) {
|
|
|
+ vo.setId(i.getWindturbineId());
|
|
|
+ vo.setName(CacheContext.wtmap.get(i.getWindturbineId().trim()).getModelId());
|
|
|
+ vo.setOrdernum(CacheContext.wtmap.get(i.getWindturbineId().trim()).getOrderNum().doubleValue());
|
|
|
+ } else if (type.equals(TYPE_SQUARE)) {
|
|
|
+ vo.setId(i.getSquareId());
|
|
|
+ vo.setName(CacheContext.proBasicOrganizeTreesMap.get(i.getSquareId()).getModelId());
|
|
|
+ vo.setOrdernum(CacheContext.proBasicOrganizeTreesMap.get(i.getSquareId()).getOrderNum().doubleValue());
|
|
|
+ } else if (type.equals(TYPE_COMPANY)) {
|
|
|
+ vo.setId(i.getId());
|
|
|
+ vo.setName(CacheContext.proBasicOrganizeTreesMap.get(i.getId()).getAname());
|
|
|
+ vo.setOrdernum(CacheContext.proBasicOrganizeTreesMap.get(i.getId()).getOrderNum().doubleValue());
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
+ vo.setDate(i.getRecordDate());
|
|
|
+ vo.setFdl(DoubleUtils.keepPrecision(i.getRfdl() / 10000, 2));
|
|
|
+ vo.setLlfdl(DoubleUtils.keepPrecision(i.getRllfdl() / 10000, 2));
|
|
|
+ vo.setJxssdl(DoubleUtils.keepPrecision((i.getRjxssdl() + i.getRcnsljxssdl()) / 10000, 2));
|
|
|
+ vo.setGzssdl(DoubleUtils.keepPrecision((i.getRgzssdl() + i.getRcnslgzssdl()) / 10000, 2));
|
|
|
+ vo.setXdssdl(DoubleUtils.keepPrecision((i.getRxdtjssdl() + i.getRxdjclssdl()) / 10000, 2));
|
|
|
+ vo.setSlssdl(DoubleUtils.keepPrecision((i.getRcwsltqssdl() + i.getRcwsldwssdl()) / 10000, 2));
|
|
|
+ vo.setXnssdl(DoubleUtils.keepPrecision((i.getRdjssdl() + i.getRsdtjssdl() + i.getRqxjclssdl() + i.getRxnssdl()) / 10000, 2));
|
|
|
+ vo.setZssdl(DoubleUtils.keepPrecision(vo.getGzssdl() + vo.getJxssdl() + vo.getXdssdl() + vo.getXnssdl() + vo.getSlssdl(), 2));
|
|
|
+ vo.setFnlyl(vo.getLlfdl() != 0 ? DoubleUtils.keepPrecision(vo.getFdl() / vo.getLlfdl() * 100, 2) : 0);
|
|
|
+ vo.setGzssl(vo.getLlfdl() != 0 ? DoubleUtils.keepPrecision(vo.getGzssdl() / vo.getLlfdl() * 100, 2) : 0);
|
|
|
+ vo.setJxssl(vo.getLlfdl() != 0 ? DoubleUtils.keepPrecision(vo.getJxssdl() / vo.getLlfdl() * 100, 2) : 0);
|
|
|
+ vo.setQfl(vo.getLlfdl() != 0 ? DoubleUtils.keepPrecision(vo.getXdssdl() / vo.getLlfdl() * 100, 2) : 0);
|
|
|
+ vo.setXnssl(vo.getLlfdl() != 0 ? DoubleUtils.keepPrecision(vo.getXnssdl() / vo.getLlfdl() * 100, 2) : 0);
|
|
|
+ vo.setSlssl(vo.getLlfdl() != 0 ? DoubleUtils.keepPrecision(vo.getSlssdl() / vo.getLlfdl() * 100, 2) : 0);
|
|
|
+ resultList.add(vo);
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
|
|
|
SortUtils.sort(resultList, "llfdl", SortUtils.DESC);
|