Browse Source

Merge branch 'master' of http://124.70.43.205:3000/xieshengjie/sis

 Conflicts:
	web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/bmk/BenchmarkingService.java
xushili 1 year ago
parent
commit
18ca63742a

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

@@ -415,7 +415,7 @@ public class BenchmarkingController {
     }
 
     @GetMapping(value = "/companyslist")
-    @ApiOperation(value = "公司列表", notes = "公司列表")
+    @ApiOperation(value = "公司列表", notes = "公司列表")
     public R companyslist (@RequestParam(value = "type", required = true) String type)  {
         List<ProBasicOrganizeTree> resultList = benchmarkingService.companyslist(type);
         if (StringUtils.isNotNull(resultList)) {
@@ -425,5 +425,17 @@ public class BenchmarkingController {
         }
     }
 
+    @GetMapping(value = "/wpBylist")
+    @ApiOperation(value = "场站列表新", notes = "场站列表新")
+    public R wpBylist(@RequestParam(value = "companyids", required = true) String companyids,
+                        @RequestParam(value = "type", required = false) String type) {
+
+        List<ProBasicOrganizeTree> resultList = benchmarkingService.wpBylist(companyids,type);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
 
 }

+ 23 - 11
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/Economic/EconomicService.java

@@ -56,7 +56,8 @@ public class EconomicService {
         List<WxssVo> lbls = new ArrayList<>();
         List<EconomicVo> jsls = new ArrayList<>();
         List<Object> qwls = new ArrayList<>();
-        List<Map> czpx = new ArrayList<>();
+        List<Map<String,Object>> czpx = new ArrayList<>();
+
 
         List<ProEconPowerstationInfoDay1> station1ls = CacheContext.station1ls;
         List<ProBasicOrganizeTree> treels = CacheContext.treels;
@@ -79,7 +80,7 @@ public class EconomicService {
                 fdtjmap.put("nfdl", st.getNfdl());
                 fdtjmap.put("gnlyl", st.getYfdl().divide(st.getYllfdl(), 2, BigDecimal.ROUND_HALF_UP).multiply(num1));
                 wxssmap.put("gzss", st.getYgzssdl());
-                wxssmap.put("whss", st.getYgzssdl());
+                wxssmap.put("whss", st.getYjxssdl());
                 wxssmap.put("xnss", st.getYxnssdl());
                 wxssmap.put("xdss", st.getYxdjclssdl().add(st.getYxdtjssdl()));
                 wxssmap.put("slss", st.getYcwsldwssdl().add(st.getYcwsltqssdl()).add(st.getYcnsljxssdl()).add(st.getYcnslgzssdl()));
@@ -119,17 +120,17 @@ public class EconomicService {
 
                     wxssVo.setId(ss.getForeignKeyId());
                     if (cp.getId().contains(ss.getForeignKeyId())) {
-                        wxssVo.setName(cp.getNemName());
+                        wxssVo.setName(cp.getAname());
                         vo.setName(cp.getAname());
                     } else {
                         continue;
                     }
                     wxssVo.setFdl(ss.getYfdl());
-                    wxssVo.setGzssdl(ss.getYfdl());
-                    wxssVo.setSlssdl(ss.getYfdl());
-                    wxssVo.setWhssdl(ss.getYfdl());
-                    wxssVo.setXdssdl(ss.getYfdl());
-                    wxssVo.setXnssdl(ss.getYfdl());
+                    wxssVo.setGzssdl(ss.getYgzssdl());
+                    wxssVo.setSlssdl(ss.getYcwsldwssdl().add(ss.getYcwsltqssdl()).add(ss.getYcnslgzssdl()).add(ss.getYcnsljxssdl()));
+                    wxssVo.setWhssdl(ss.getYjxssdl());
+                    wxssVo.setXdssdl(ss.getYxdjclssdl().add(ss.getYxdtjssdl()));
+                    wxssVo.setXnssdl(ss.getYxnssdl());
                     wxssVo.setGnlyl(ss.getYfdl().divide(ss.getYllfdl(), 2, BigDecimal.ROUND_HALF_UP).multiply(num1));
                     lbls.add(wxssVo);
 
@@ -156,7 +157,7 @@ public class EconomicService {
         int i = 0;
         for (EconomicVo ll : jsls) {
 
-            Map czpxmap = new LinkedHashMap();
+            Map<String,Object> czpxmap = new LinkedHashMap<>();
             i++;
             czpxmap.put("ordernum", i);
             czpxmap.put("id", ll.getId());
@@ -166,8 +167,19 @@ public class EconomicService {
 
         }
 
-        // 获取 list 集合中的前五个元素,即最小的五条数据
-        List<Map> subList = czpx.subList(0, Math.min(5, czpx.size()));
+
+// 使用lambda表达式和Stream API对List进行排序
+        czpx.sort(Comparator.comparing(m -> (BigDecimal) m.get("wxss")));
+
+
+
+        // 获取 list 集合中的前五个元素
+        List<Map<String, Object>>  subList = null;
+        if (czpx.size()>=5) {
+          subList = czpx.subList(0, 5);
+        }else {
+            subList=czpx;
+        }
         map.put("czwxss", subList);
 
 

+ 36 - 22
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/bmk/BenchmarkingService.java

@@ -841,11 +841,8 @@ public class BenchmarkingService {
 
     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<>();
+        List<ProBasicOrganizeTree> result = new ArrayList<>();
 
         String F = "F";
         String G = "G";
@@ -855,35 +852,52 @@ public class BenchmarkingService {
             cpls = cpls.stream().filter(cp -> F.contains(cp.getEleType())).collect(Collectors.toList());
         }
 
-        cpls.stream().forEach(cp -> {
-            result1.add(cp);
+        cpls.stream().forEach(cp->{
+            result.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()) {
+        Optional<ProBasicOrganizeTree> first = result.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);
+
+        result.add(company);
+        SortUtils.sort(result,"orderNum",SortUtils.ASC);
+
+        return result;
+    }
+
+
+    public List<ProBasicOrganizeTree> wpBylist(String companyids,String  type) {
+
+
+        List<ProBasicOrganizeTree> list = CacheContext.wpls;
+        List<ProBasicOrganizeTree> list1 = CacheContext.wpls;
+
+//        if (StringUtils.isNotEmpty(type) && !type.equals("0")){
+//            String finalType  =  type.equals("-1") ? "_FDC" : "_GDC";
+//            list = list.stream().filter(wp-> wp.getId().indexOf(finalType) >= 0).collect(Collectors.toList());
+//        }
+
+        if (companyids.endsWith("RGN") && type.equals("-1")){
+            list = list1.stream().filter(wp -> wp.getEleType().equals("F")).collect(Collectors.toList());
+        }else if (companyids.endsWith("RGN") && type.equals("-2")){
+            list = list1.stream().filter(wp -> wp.getEleType().equals("G")).collect(Collectors.toList());
+        }
+        if (companyids.endsWith("FGS")){
+            list = list.stream().filter(wp->companyids.contains(wp.getParentCode())).collect(Collectors.toList());
         }
-        result1.add(company);
-        result2.add(station);
-        SortUtils.sort(result1, "orderNum", SortUtils.ASC);
+        if (companyids.endsWith("ZGS")){
+            list = list.stream().filter(wp->companyids.contains(wp.getParentCode())).collect(Collectors.toList());
+        }
+        SortUtils.sort(list,"orderNum",SortUtils.ASC);
+        return list;
 
-        return result1;
     }
 
     public List<WxsslVo> gsdb(String companys, String type, String beginDate, String endDate, String target, String sort) {