Browse Source

经济运行代码修改

wangb@gyee-china.com 1 year ago
parent
commit
a826aebcf2

+ 12 - 1
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/controller/bmk/BenchmarkingController.java

@@ -34,7 +34,7 @@ public class BenchmarkingController {
 
     @GetMapping(value = "/companys")
     @ApiOperation(value = "公司列表", notes = "公司列表")
-    public R companys()  {
+    public R companys ()  {
         List<ProBasicOrganizeTree> resultList = benchmarkingService.companys();
         if (StringUtils.isNotNull(resultList)) {
             return R.data(ResultMsg.ok(resultList));
@@ -361,5 +361,16 @@ public class BenchmarkingController {
         }
     }
 
+    @GetMapping(value = "/companyslist")
+    @ApiOperation(value = "公司列表", notes = "公司列表")
+    public R companyslist (@RequestParam(value = "type", required = true) String type)  {
+        List<ProBasicOrganizeTree> resultList = benchmarkingService.companyslist(type);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
+
 
 }

+ 4 - 4
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/init/CacheContext.java

@@ -293,7 +293,7 @@ public class CacheContext implements CommandLineRunner {
         {
             for(ProBasicOrganizeTree sq:cpls)
             {
-                cpmap.put(sq.getParentCode(),sq);
+                cpmap.put(sq.getId(),sq);
 
                 if (redisService.hasKey(sq.getParentCode()+"0")){
                     String cp0String = redisService.get(sq.getParentCode()+"0");
@@ -416,7 +416,7 @@ public class CacheContext implements CommandLineRunner {
         {
             for(ProBasicOrganizeTree gp:gpls)
             {
-                gpmap.put(gp.getParentCode(),gp);
+                gpmap.put(gp.getId(),gp);
 
                 if (redisService.hasKey(gp.getParentCode()+"0")){
                     String cp0String = redisService.get(gp.getParentCode()+"0");
@@ -475,7 +475,7 @@ public class CacheContext implements CommandLineRunner {
 //                cpwpmap.put(wp.getCompanyId(),wps);
 //            }
 //        }
-
+        wpls = proBasicOrganizeTreeService.list().stream().filter(i->i.getIsAble()==1 && i.getOrgType().contains("STA")).collect(Collectors.toList());
         for(ProBasicOrganizeTree wp:wpls)
         {
             if (cpwpmap.containsKey(wp.getOrgType().contains("STA"))){
@@ -820,7 +820,7 @@ public class CacheContext implements CommandLineRunner {
 
 
         //树形线路
-        lnls = proBasicOrganizeTreeService.list().stream().filter(i-> StringUtils.isNotNull(pjmap.get(i.getOrgType().contains("EG"))) && i.getIsAble()==1).collect(Collectors.toList());
+        lnls = proBasicOrganizeTreeService.list().stream().filter(i-> StringUtils.isNotNull(pjmap.get(i.getParentCode())) && i.getIsAble()==1).collect(Collectors.toList());
         lnls.stream().forEach(l->{
             lnmap.put(l.getId(),l);
             if (prolinemap.containsKey(l.getOrgType().contains("EG"))){

+ 47 - 38
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconPointCodeServiceImpl.java

@@ -1,20 +1,27 @@
 package com.gyee.runeconomy.service.auto.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.backconfig.model.auto.ProBasicOrganizeTree;
 import com.gyee.common.model.StringUtils;
 import com.gyee.runeconomy.dto.response.ProEconPointCodeDTO;
 import com.gyee.runeconomy.init.CacheContext;
-import com.gyee.runeconomy.model.auto.*;
 import com.gyee.runeconomy.mapper.auto.ProEconPointCodeMapper;
+import com.gyee.runeconomy.model.auto.ProEconPointCode;
+import com.gyee.runeconomy.model.auto.ProEconPowerstationInfoDay1;
+import com.gyee.runeconomy.model.auto.ProEconPowerstationInfoDay4;
+import com.gyee.runeconomy.service.auto.IProBasicOrganizeTreeService;
 import com.gyee.runeconomy.service.auto.IProEconPointCodeService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 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.ArrayList;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
 import java.util.stream.Collectors;
 
 /**
@@ -38,7 +45,8 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
     @Autowired
     private IProEconPowerstationInfoDay4Service proEconPowerstationInfoDay4Service;
 
-
+    @Autowired
+    private IProBasicOrganizeTreeService proBasicOrganizeTreeService;
 
     @Override
     public List<ProEconPointCode> getEconPointCodeList() {
@@ -60,7 +68,8 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
 
     @Override
     public List<ProEconPointCodeDTO> getEconPointRanking(String regionId, String companyId, String pointCode, Date date, String dateType, boolean popup,String statype) {
-        List<ProBasicPowerstation> powerstationList = proBasicPowerstationService.getProBasicPowerstationlist(regionId, companyId, statype);
+
+        List<ProBasicOrganizeTree> powerstationList = proBasicOrganizeTreeService.getProBasicPowerstationlist(regionId, companyId, statype);
 
         ProEconPointCode proEconPointCode = getProEconPointCode(pointCode);
         if (null == proEconPointCode){
@@ -122,7 +131,7 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
 
 
         List<String> newsto = dtos.stream().map(ProEconPointCodeDTO::getStationcode).collect(Collectors.toList());
-        List<String> newsta = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
+        List<String> newsta = powerstationList.stream().map(ProBasicOrganizeTree::getNemCode).collect(Collectors.toList());
         List<String> reduce1 = newsta.stream().filter(item -> !newsto.contains(item)).collect(Collectors.toList());
         for (String i : reduce1) {
             ProEconPointCodeDTO dto = new ProEconPointCodeDTO();
@@ -142,8 +151,8 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
     /**
      * 发电量
      */
-    private List<ProEconPointCodeDTO> fdl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
-        List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
+    private List<ProEconPointCodeDTO> fdl(List<ProBasicOrganizeTree> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
+        List<String> stationlist = powerstationList.stream().map(ProBasicOrganizeTree::getNemCode).collect(Collectors.toList());
 
         List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
         List<ProEconPointCodeDTO> dtos = new ArrayList<>();
@@ -175,8 +184,8 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
     /**
      * 欠发电量
      */
-    private List<ProEconPointCodeDTO> qfdl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
-        List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
+    private List<ProEconPointCodeDTO> qfdl(List<ProBasicOrganizeTree> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
+        List<String> stationlist = powerstationList.stream().map(ProBasicOrganizeTree::getNemCode).collect(Collectors.toList());
 
         List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
         List<ProEconPointCodeDTO> dtos = new ArrayList<>();
@@ -205,8 +214,8 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
 
 
     // 风能利用率
-    private List<ProEconPointCodeDTO> fnlyl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
-        List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
+    private List<ProEconPointCodeDTO> fnlyl(List<ProBasicOrganizeTree> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
+        List<String> stationlist = powerstationList.stream().map(ProBasicOrganizeTree::getNemCode).collect(Collectors.toList());
 
         List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
         List<ProEconPointCodeDTO> dtos = new ArrayList<>();
@@ -243,8 +252,8 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
     /**
      * 受累损失电量
      */
-    private List<ProEconPointCodeDTO> slssdl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
-        List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
+    private List<ProEconPointCodeDTO> slssdl(List<ProBasicOrganizeTree> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
+        List<String> stationlist = powerstationList.stream().map(ProBasicOrganizeTree::getNemCode).collect(Collectors.toList());
 
         List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
         List<ProEconPointCodeDTO> dtos = new ArrayList<>();
@@ -273,8 +282,8 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
 
 
     /** 检修损失电量 */
-    private List<ProEconPointCodeDTO> jxssdl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
-        List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
+    private List<ProEconPointCodeDTO> jxssdl(List<ProBasicOrganizeTree> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
+        List<String> stationlist = powerstationList.stream().map(ProBasicOrganizeTree::getNemCode).collect(Collectors.toList());
 
         List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
         List<ProEconPointCodeDTO> dtos = new ArrayList<>();
@@ -302,8 +311,8 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
     }
 
     /** 限电损失电量*/
-    private List<ProEconPointCodeDTO> xdjclssdl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
-        List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
+    private List<ProEconPointCodeDTO> xdjclssdl(List<ProBasicOrganizeTree> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
+        List<String> stationlist = powerstationList.stream().map(ProBasicOrganizeTree::getNemCode).collect(Collectors.toList());
 
         List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
         List<ProEconPointCodeDTO> dtos = new ArrayList<>();
@@ -331,8 +340,8 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
     }
 
    /** 故障损失电量*/
-    private List<ProEconPointCodeDTO> gzssdl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
-        List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
+    private List<ProEconPointCodeDTO> gzssdl(List<ProBasicOrganizeTree> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
+        List<String> stationlist = powerstationList.stream().map(ProBasicOrganizeTree::getNemCode).collect(Collectors.toList());
 
         List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
         List<ProEconPointCodeDTO> dtos = new ArrayList<>();
@@ -360,8 +369,8 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
     }
 
     /** 性能损失电量*/
-    private List<ProEconPointCodeDTO> xnssdl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
-        List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
+    private List<ProEconPointCodeDTO> xnssdl(List<ProBasicOrganizeTree> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
+        List<String> stationlist = powerstationList.stream().map(ProBasicOrganizeTree::getNemCode).collect(Collectors.toList());
 
         List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
         List<ProEconPointCodeDTO> dtos = new ArrayList<>();
@@ -389,8 +398,8 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
     }
 
    /** 复位及时率 */
-    private List<ProEconPointCodeDTO> fwjsl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
-        List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
+    private List<ProEconPointCodeDTO> fwjsl(List<ProBasicOrganizeTree> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
+        List<String> stationlist = powerstationList.stream().map(ProBasicOrganizeTree::getNemCode).collect(Collectors.toList());
 
         List<ProEconPowerstationInfoDay4> list = proEconPowerstationInfoDay4Service.getEconThreeRateCurvelist(stationlist, date);
         List<ProEconPointCodeDTO> dtos = new ArrayList<>();
@@ -418,8 +427,8 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
     }
 
     /** 状态转换及时率 */
-    private List<ProEconPointCodeDTO> ztzhjsl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
-        List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
+    private List<ProEconPointCodeDTO> ztzhjsl(List<ProBasicOrganizeTree> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
+        List<String> stationlist = powerstationList.stream().map(ProBasicOrganizeTree::getNemCode).collect(Collectors.toList());
 
         List<ProEconPowerstationInfoDay4> list = proEconPowerstationInfoDay4Service.getEconThreeRateCurvelist(stationlist, date);
         List<ProEconPointCodeDTO> dtos = new ArrayList<>();
@@ -447,8 +456,8 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
     }
 
     /** 故障消缺及时率 */
-    private List<ProEconPointCodeDTO> gzxqjsl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
-        List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
+    private List<ProEconPointCodeDTO> gzxqjsl(List<ProBasicOrganizeTree> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
+        List<String> stationlist = powerstationList.stream().map(ProBasicOrganizeTree::getNemCode).collect(Collectors.toList());
 
         List<ProEconPowerstationInfoDay4> list = proEconPowerstationInfoDay4Service.getEconThreeRateCurvelist(stationlist, date);
         List<ProEconPointCodeDTO> dtos = new ArrayList<>();
@@ -476,8 +485,8 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
     }
 
     /** 受累损失率 */
-    private List<ProEconPointCodeDTO> slssl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
-        List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
+    private List<ProEconPointCodeDTO> slssl(List<ProBasicOrganizeTree> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
+        List<String> stationlist = powerstationList.stream().map(ProBasicOrganizeTree::getNemCode).collect(Collectors.toList());
 
         List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
         List<ProEconPointCodeDTO> dtos = new ArrayList<>();
@@ -508,8 +517,8 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
     }
 
     /** 检修损失率 */
-    private List<ProEconPointCodeDTO> jxssl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
-        List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
+    private List<ProEconPointCodeDTO> jxssl(List<ProBasicOrganizeTree> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
+        List<String> stationlist = powerstationList.stream().map(ProBasicOrganizeTree::getNemCode).collect(Collectors.toList());
 
         List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
         List<ProEconPointCodeDTO> dtos = new ArrayList<>();
@@ -540,8 +549,8 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
     }
 
     /** 限电损失率 */
-    private List<ProEconPointCodeDTO> xdjclssl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
-        List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
+    private List<ProEconPointCodeDTO> xdjclssl(List<ProBasicOrganizeTree> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
+        List<String> stationlist = powerstationList.stream().map(ProBasicOrganizeTree::getNemCode).collect(Collectors.toList());
 
         List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
         List<ProEconPointCodeDTO> dtos = new ArrayList<>();
@@ -570,8 +579,8 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
     }
 
    /** 故障损失率*/
-    private List<ProEconPointCodeDTO> gzssl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
-        List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
+    private List<ProEconPointCodeDTO> gzssl(List<ProBasicOrganizeTree> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
+        List<String> stationlist = powerstationList.stream().map(ProBasicOrganizeTree::getNemCode).collect(Collectors.toList());
 
         List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
         List<ProEconPointCodeDTO> dtos = new ArrayList<>();
@@ -600,8 +609,8 @@ public class ProEconPointCodeServiceImpl extends ServiceImpl<ProEconPointCodeMap
     }
 
     /** 性能损失率 */
-    private List<ProEconPointCodeDTO> xnssl(List<ProBasicPowerstation> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
-        List<String> stationlist = powerstationList.stream().map(ProBasicPowerstation::getNemCode).collect(Collectors.toList());
+    private List<ProEconPointCodeDTO> xnssl(List<ProBasicOrganizeTree> powerstationList, Date date, String dateType, ProEconPointCode pointCode) {
+        List<String> stationlist = powerstationList.stream().map(ProBasicOrganizeTree::getNemCode).collect(Collectors.toList());
 
         List<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.getEconFiveLosslist(stationlist, date);
         List<ProEconPointCodeDTO> dtos = new ArrayList<>();

+ 47 - 0
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/bmk/BenchmarkingService.java

@@ -841,4 +841,51 @@ public class BenchmarkingService {
         }
         return wxsslVoList;
     }
+
+    public List<ProBasicOrganizeTree> companyslist(String type) {
+        List<ProBasicOrganizeTree> cpls = CacheContext.cpls;
+        List<ProBasicOrganizeTree> wpls = CacheContext.wpls;
+        Map<String, ProBasicOrganizeTree> rgmap = CacheContext.rgmap;
+        Map<String, ProBasicOrganizeTree> rgmap1 = CacheContext.cpmap;
+        List<ProBasicOrganizeTree> result1 = new ArrayList<>();
+        List<ProBasicOrganizeTree> result2 = new ArrayList<>();
+
+        String F = "F";
+        String G = "G";
+        if (type.contains("-2")){
+            cpls = cpls.stream().filter(cp->G.contains(cp.getEleType())).collect(Collectors.toList());
+        }else if (type.contains("-1")){
+            cpls = cpls.stream().filter(cp->F.contains(cp.getEleType())).collect(Collectors.toList());
+        }
+
+        cpls.stream().forEach(cp->{
+            result1.add(cp);
+        });
+
+        wpls.stream().forEach(wp->{
+            result2.add(wp);
+        });
+        //单区域部署打开
+        ProBasicOrganizeTree company = new ProBasicOrganizeTree();
+        ProBasicOrganizeTree station = new ProBasicOrganizeTree();
+        Optional<ProBasicOrganizeTree> first = result1.stream().findFirst();
+        Optional<ProBasicOrganizeTree> first1 = result2.stream().findFirst();
+        if (first.isPresent()){
+            String regionId = first.get().getParentCode();
+            company.setId(regionId);
+            company.setAname(rgmap.get(regionId).getAname());
+            company.setOrderNum(0);
+        }
+        if (first1.isPresent()){
+            String regionId = first1.get().getParentCode();
+            station.setId(regionId);
+            station.setAname(rgmap1.get(regionId).getAname());
+            station.setOrderNum(0);
+        }
+        result1.add(company);
+        result2.add(station);
+        SortUtils.sort(result1,"orderNum",SortUtils.ASC);
+
+        return result1;
+    }
 }