瀏覽代碼

Merge remote-tracking branch 'origin/master'

宁檬 1 年之前
父節點
當前提交
9e2b97b5d8

+ 45 - 46
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/Economic/EconomicService.java

@@ -56,7 +56,7 @@ public class EconomicService {
      * @return
      * @throws ParseException
      */
-    public Map<String, Object> getEconomyPointInfo(String companyId, String type, String statype,String datetype) throws ParseException {
+    public Map<String, Object> getEconomyPointInfo(String companyId, String type, String statype, String datetype) throws ParseException {
 
 
         //获取当前时间
@@ -72,7 +72,7 @@ public class EconomicService {
         List<WxssVo> lbls = new ArrayList<>();
         List<EconomicVo> jsls = new ArrayList<>();
         List<Object> qwls = new ArrayList<>();
-        List<Map<String,Object>> czpx = new ArrayList<>();
+        List<Map<String, Object>> czpx = new ArrayList<>();
 
 
         List<ProEconPowerstationInfoDay1> station1ls = CacheContext.station1ls;
@@ -84,9 +84,9 @@ public class EconomicService {
         BigDecimal num1 = new BigDecimal("100");
         if (companyId.startsWith("JS_RGN") && type.equals("-1")) {
             qyls = station1ls.stream().filter(wp -> wp.getForeignKeyId().contains("JS_RGN-1") && wp.getRecordDate().equals(date)).collect(Collectors.toList());
-        }else if (companyId.startsWith("JS_RGN") && type.equals("-2")) {
+        } else if (companyId.startsWith("JS_RGN") && type.equals("-2")) {
             qyls = station1ls.stream().filter(wp -> wp.getForeignKeyId().contains("JS_RGN-2") && wp.getRecordDate().equals(date)).collect(Collectors.toList());
-        }else {
+        } else {
             qyls = station1ls.stream().filter(wp -> wp.getForeignKeyId().contains(companyId) && wp.getRecordDate().equals(date)).collect(Collectors.toList());
         }
 
@@ -100,13 +100,13 @@ public class EconomicService {
             trls = treels.stream().filter(wp -> wp.getId().endsWith("ZGS")).collect(Collectors.toList());
 
 
-        }else if (companyId.startsWith("JS_RGN") && statype.equals("-1")){
+        } else if (companyId.startsWith("JS_RGN") && statype.equals("-1")) {
             gsls = station1ls.stream().filter(wp -> wp.getRegionId().contains("JS_RGN-1") && wp.getRecordDate().equals(date)).collect(Collectors.toList());
             trls = treels.stream().filter(wp -> wp.getId().endsWith("STA")).collect(Collectors.toList());
-        }else if (companyId.startsWith("JS_RGN") && statype.equals("-2")){
+        } else if (companyId.startsWith("JS_RGN") && statype.equals("-2")) {
             gsls = station1ls.stream().filter(wp -> wp.getRegionId().contains("JS_RGN-2") && wp.getRecordDate().equals(date)).collect(Collectors.toList());
             trls = treels.stream().filter(wp -> wp.getId().endsWith("STA")).collect(Collectors.toList());
-        }else {
+        } else {
             gsls = station1ls.stream().filter(wp -> wp.getForeignKeyId().contains("STA") && wp.getRecordDate().equals(date)).collect(Collectors.toList());
             trls = treels.stream().filter(wp -> wp.getParentCode().endsWith(companyId)).collect(Collectors.toList());
         }
@@ -164,7 +164,7 @@ public class EconomicService {
                     jsls.add(vo);
                 }
             }
-        }else if (datetype.contains("y")){
+        } else if (datetype.contains("y")) {
             if (!station1ls.isEmpty()) {
                 for (ProEconPowerstationInfoDay1 st : qyls) {
                     fdtjmap.put("rfdl", st.getYfdl());
@@ -217,7 +217,7 @@ public class EconomicService {
                     jsls.add(vo);
                 }
             }
-        }else if (datetype.contains("n")){
+        } else if (datetype.contains("n")) {
             if (!station1ls.isEmpty()) {
                 for (ProEconPowerstationInfoDay1 st : qyls) {
                     fdtjmap.put("rfdl", st.getNfdl());
@@ -278,7 +278,7 @@ public class EconomicService {
         int i = 0;
         for (EconomicVo ll : jsls) {
 
-            Map<String,Object> czpxmap = new LinkedHashMap<>();
+            Map<String, Object> czpxmap = new LinkedHashMap<>();
             i++;
             czpxmap.put("ordernum", i);
             czpxmap.put("id", ll.getId());
@@ -293,13 +293,12 @@ public class EconomicService {
         czpx.sort(Comparator.comparing(m -> (BigDecimal) m.get("wxss")));
 
 
-
         // 获取 list 集合中的前五个元素
-        List<Map<String, Object>>  subList = null;
-        if (czpx.size()>=5) {
+        List<Map<String, Object>> subList = null;
+        if (czpx.size() >= 5) {
             subList = czpx.subList(0, 5);
-        }else {
-            subList=czpx;
+        } else {
+            subList = czpx;
         }
         map.put("czwxss", subList);
 
@@ -307,7 +306,7 @@ public class EconomicService {
         return map;
     }
 
-    public List<PowercurveVo> powercurve(String wpid, String type, Date starttime,Date endtime) throws Exception {
+    public List<PowercurveVo> powercurve(String wpid, String type, Date starttime, Date endtime) throws Exception {
 
         Date beginDate = com.gyee.common.util.DateUtils.getSamedayZero();   //当日零点
         Date endDate = com.gyee.common.util.DateUtils.getCurrentDate();   //当前时间
@@ -346,8 +345,7 @@ public class EconomicService {
     }
 
 
-
-    public  List<Glqx> curveFittingList(String wpids, String type, String starttime, String endtime, String dateType,String windturbineids) throws Exception {
+    public List<Glqx> curveFittingList(String wpids, String type, String starttime, String endtime, String dateType, String windturbineids) throws Exception {
         Map<String, List<List<Glqx>>> resultMap = new HashMap<>();
 
 
@@ -355,37 +353,44 @@ public class EconomicService {
         List<EconomicVo> wt = new ArrayList<>();
 
         List<List<Glqx>> tempList = new ArrayList<>();
-       ;
+        ;
         List<Glqx> vo = new ArrayList<Glqx>();
 
 
         Date beginDate = DateUtils.parseDate(starttime);
         Date endDate = DateUtils.parseDate(endtime);
         Date current = com.gyee.common.util.DateUtils.getCurrentDate();
-        if(endDate.after(current)){
+        if (endDate.after(current)) {
             endDate = current;
         }
 
-        if (type.equals("-2")) {
 
-            for (ProBasicOrganizeEquipment wt1: wtls){
-                if (wpids.contains(wt1.getWindpowerstationId())){
-                    EconomicVo vo1 = new EconomicVo();
-                    vo1.setId(wt1.getWindturbineId());
-                    vo1.setName(wt1.getAname());
-                    wt.add(vo1);
-                }
+        for (ProBasicOrganizeEquipment wt1 : wtls) {
+            if (wpids.contains(wt1.getWindpowerstationId())) {
+                EconomicVo vo1 = new EconomicVo();
+                vo1.setId(wt1.getWindturbineId());
+                vo1.setName(wt1.getAname());
+                wt.add(vo1);
             }
+        }
+
 
+        for (EconomicVo wt2 : wt) {
 
-            for ( EconomicVo wt2 : wt) {
 
+            if (windturbineids.contains(wt2.getId())) {
 
-                if (windturbineids.contains(wt2.getId())){
+                ProBasicEquipmentPoint sjgl = null;
+                ProBasicEquipmentPoint llgl = null;
 
-                ProBasicEquipmentPoint sjgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
-                ProBasicEquipmentPoint llgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
-                if (sjgl.getId()==null){
+                if (type.equals("-2")) {
+                    sjgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
+                    llgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
+                }if (type.equals("-1")){
+                    sjgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
+                    llgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
+                }
+                if (sjgl.getId() == null) {
                     continue;
                 }
 
@@ -405,31 +410,25 @@ public class EconomicService {
 
                     temp1 = sjglls.get(i).getPointValueInDouble();
 
-                        if (sjgl.getWindturbineId().contains(wt2.getId())){
+                    if (sjgl.getWindturbineId().contains(wt2.getId())) {
 //                            Date date = new Date(sjglls.get(i).getPointTime());
 //                            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 //                            String formattedDate = sdf.format(date);
-                            vos.setTime(sjglls.get(i).getPointTime());
+                        vos.setTime(sjglls.get(i).getPointTime());
 //                            vos.setTime(formattedDate);
-                            vos.setId(wt2.getId());
-                            vos.setName(wt2.getName());
-                            vos.setSjgl(StringUtils.round(temp1, 2));
-                        }
+                        vos.setId(wt2.getId());
+                        vos.setName(wt2.getName());
+                        vos.setSjgl(StringUtils.round(temp1, 2));
+                    }
 
                     temp2 = llglls.get(i).getPointValueInDouble();
-                    if (llgl.getWindturbineId().contains(wt2.getId())){
+                    if (llgl.getWindturbineId().contains(wt2.getId())) {
                         vos.setYcgl(StringUtils.round(temp2, 2));
                     }
 
                     vo.add(vos);
                 }
 
-//                for (int i = 0; i < llglls.size(); i++) {
-//
-//                }
-
-            }
-
 
             }