Parcourir la source

优化后台计算算法

shilin il y a 1 an
Parent
commit
37e9de647b

+ 30 - 3
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/CommonController.java

@@ -11,6 +11,7 @@ import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.model.auto.ProBasicCompany;
 import com.gyee.runeconomy.model.auto.ProBasicEquipmentPoint;
 import com.gyee.runeconomy.model.auto.ProBasicPowerstationPoint;
+import com.gyee.runeconomy.model.auto.ProBasicSubStation;
 import com.gyee.runeconomy.util.DateUtils;
 import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
 import io.swagger.annotations.ApiOperation;
@@ -91,14 +92,40 @@ public class CommonController {
                           @RequestParam(value = "wpid", required = true) String wpid) {
 
         Map<String, Map<String, ProBasicPowerstationPoint>> wppointmap = CacheContext.wppointmap;
+        Map<String, Map<String, ProBasicPowerstationPoint>> subwppointmap = CacheContext.subwppointmap;
+
         Map<String, ProBasicPowerstationPoint> powerstationPointMap = wppointmap.get(wpid);
+        Map<String, ProBasicPowerstationPoint> substationPointMap =new HashMap<>();
+                List<ProBasicSubStation>  subwpls=CacheContext.subwpls;
+        for(ProBasicSubStation sub:subwpls)
+        {
+            if(sub.getWindpowerstationId().equals(wpid))
+            {
+               substationPointMap = subwppointmap.get(sub.getId());
+
+                break;
+            }
+
+        }
 
         List<ProBasicPowerstationPoint> resultList = new ArrayList<>();
 
         String[] split = unifromcodes.split(",");
-        Arrays.stream(split).forEach(s -> {
-            resultList.add(powerstationPointMap.get(s));
-        });
+
+        for(int i=0;i<split.length;i++)
+        {
+            String s=split[i];
+            if(powerstationPointMap.containsKey(s))
+            {
+                resultList.add(powerstationPointMap.get(s));
+            }
+
+            if(substationPointMap.containsKey(s))
+            {
+                resultList.add(substationPointMap.get(s));
+            }
+        }
+
 
         if (StringUtils.isNotNull(resultList)) {
             return R.data(ResultMsg.ok(resultList));

+ 1 - 1
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/homepage/EconomyPointHomePageService.java

@@ -6,7 +6,7 @@ import com.gyee.runeconomy.dto.response.EconHomePagePointRateDTO;
 import com.gyee.runeconomy.dto.response.ProEconPointCodeDTO;
 import com.gyee.runeconomy.model.auto.*;
 import com.gyee.runeconomy.service.auto.*;
-import jdk.nashorn.internal.runtime.regexp.joni.constants.StackType;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;