فهرست منبع

代码修改2

全业务考评 1 سال پیش
والد
کامیت
5965819535

+ 8 - 2
power-fitting-JN/src/main/java/com.gyee.power.fitting/controller/gf/PhotovoltaicController.java

@@ -9,9 +9,11 @@ import com.gyee.power.fitting.model.custom.FjjxbVo;
 import com.gyee.power.fitting.model.custom.PhotovoltaicInfo;
 import com.gyee.power.fitting.model.custom.TableTitle;
 import com.gyee.power.fitting.service.impl.IvPvCurveFittingService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -21,6 +23,10 @@ import java.util.stream.Collectors;
 public class PhotovoltaicController {
 
 
+    @Autowired
+    private HttpServletRequest request;
+
+
     @Resource
     private IvPvCurveFittingService curveFittingService;
 
@@ -43,14 +49,14 @@ public class PhotovoltaicController {
         //Map<String, Object> table = curveFittingService.getTable(fileList.get(0));
         //table.put("filelist", fileList);
 
-        List<Object> fileLists = curveFittingService.str2FileList(fileList);
+        List<Object> fileLists = curveFittingService.str2FileList(fileList,request);
         return JsonResult.successData(ResultCode.SUCCESS, fileLists);
     }
 
     @GetMapping("/allfilelist")
     private JSONObject getFileList() {
         List<String> fileList = curveFittingService.getAllFileList();
-        List<Object> objects = curveFittingService.str2FileList(fileList);
+        List<Object> objects = curveFittingService.str2FileList(fileList,request);
         return JsonResult.successData(ResultCode.SUCCESS, objects);
     }
 

+ 17 - 1
power-fitting-JN/src/main/java/com.gyee.power.fitting/service/impl/IvPvCurveFittingService.java

@@ -18,6 +18,7 @@ import com.gyee.power.fitting.model.custom.TableTitle;
 import com.gyee.power.fitting.model.custom.TsDoubleData;
 import com.gyee.power.fitting.service.ProBasicEquipmentPointService;
 import com.gyee.power.fitting.service.ProBasicPowerstationPointService;
+import com.gyee.power.fitting.service.auth.TokenService;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.math3.fitting.WeightedObservedPoints;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,6 +26,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.File;
 import java.math.BigDecimal;
@@ -61,6 +63,9 @@ public class IvPvCurveFittingService {
     @Resource
     private ProBasicWeatherStationServiceImpl weatherStationService;
 
+    @Resource
+    private TokenService tokenService;
+
     public void getDatas2File(String stationid, long start, long end) {
 
         int daym = 24 * 60 * 60 * 1000;
@@ -252,10 +257,21 @@ public class IvPvCurveFittingService {
         return stringListMap;
     }
 
-    public List<Object> str2FileList(List<String> fileList) {
+    public List<Object> str2FileList(List<String> fileList,HttpServletRequest request) {
+
+        List<ProBasicPowerstation> powerstationList = tokenService.getWpls(request);
+        if(powerstationList.size()<=0){
+            return null;
+        }
+
         List<ProEconPowerFittingAnalySis> fileLists = new ArrayList<>();
         for (String s : fileList) {
+
             String[] split = s.split("-");
+            boolean b = powerstationList.stream().filter(m -> m.getId().equals(split[0])).findAny().isPresent();
+            if(!b){
+                continue;
+            }
             ProEconPowerFittingAnalySis fl = new ProEconPowerFittingAnalySis();
             /*fl.setPath(s);
             fl.setStation(split[0]);