Przeglądaj źródła

Merge remote-tracking branch 'origin/master'

shilin 2 lat temu
rodzic
commit
1c957550d4

+ 12 - 12
web/gdsx-ghost/src/main/java/com/gyee/ghost/service/RealtimeService.java

@@ -42,7 +42,7 @@ public class RealtimeService {
     @Resource
     private IEdosUtil edosUtil;
 
-    public void saveWindturbineStatus2() {
+    public void saveWindturbineStatus2() throws ParseException {
 
         List<ProEconWindturbineStatus2> resultList = new ArrayList<>();
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
@@ -53,7 +53,7 @@ public class RealtimeService {
         Map<String, Map<String, Windturbinetestingpointai>> wtpAimap = CacheContext.wtpAimap;
 
         Date samedayZero = DateUtils.getSamedayZero();
-        Date currentDate = DateUtils.getCurrentDate();
+        Date currentDate = sdf.parse(DateUtils.toDate(DateUtils.getCurrentDate()));
 //        Date befroeDate = DateUtils.addSeconds(currentDate, -1);
         Date befroeDate = DateUtils.addMinutes(currentDate,-5);
 
@@ -81,8 +81,8 @@ public class RealtimeService {
                     proEconWindturbineStatus2.setWindpowerstationId(wt.getWindpowerstationid());
                     proEconWindturbineStatus2.setWindturbineId(wt.getId());
 
-                    proEconWindturbineStatus2.setStopTime(DateUtils.parseLongToDate(sdf.parse(DateUtils.toDate1(currentDate)).getTime()));
-                    proEconWindturbineStatus2.setStartTime(DateUtils.parseLongToDate(sdf.parse(DateUtils.toDate1(currentDate)).getTime()));
+                    proEconWindturbineStatus2.setStopTime(DateUtils.parseLongToDate(currentDate.getTime()));
+                    proEconWindturbineStatus2.setStartTime(DateUtils.parseLongToDate(currentDate.getTime()));
                     proEconWindturbineStatus2.setStopHours(DateUtils.hoursDiff2(proEconWindturbineStatus2.getStopTime(), proEconWindturbineStatus2.getStartTime()));
                     proEconWindturbineStatus2.setLossPower(0.0);
                     proEconWindturbineStatus2.setShutdownEventId("");
@@ -97,10 +97,10 @@ public class RealtimeService {
 
                     QueryWrapper<ProEconWindturbineStatus2> qw = new QueryWrapper<>();
                     qw.eq("windTurbine_Id",wt.getId());
-                    Date beforeFive = DateUtils.addMinutes(sdf.parse(DateUtils.toDate1(currentDate)), -5);
+//                    Date beforeFive = DateUtils.addMinutes(sdf.parse(DateUtils.toDate1(currentDate)), -5);
 //                    String toDate = DateUtils.toDate(beforeFive);
 //                    Date parse = sdf.parse(toDate);
-                    qw.eq("stop_Time",beforeFive);
+                    qw.eq("stop_Time",befroeDate);
                     Optional<ProEconWindturbineStatus2> first = proEconWindturbineStatus2Service.list(qw).stream().findFirst();
                     if (first.isPresent()){
                         ProEconWindturbineStatus2 proEconWindturbineStatus = first.get();
@@ -110,20 +110,20 @@ public class RealtimeService {
                         proEconWindturbineStatus.setSpeed(speed);
                         proEconWindturbineStatus.setAvgSpeed(0.0);
 //                        resultList.add(proEconWindturbineStatus2);
-                        proEconWindturbineStatus2Service.updateById(proEconWindturbineStatus2);
+                        proEconWindturbineStatus2Service.updateById(proEconWindturbineStatus);
                     }
 
                 }else {
                     QueryWrapper<ProEconWindturbineStatus2> qw = new QueryWrapper<>();
                     qw.eq("windTurbine_Id",wt.getId());
-                    Date beforeFive = DateUtils.addMinutes(sdf.parse(DateUtils.toDate1(currentDate)), -5);
+//                    Date beforeFive = DateUtils.addMinutes(sdf.parse(DateUtils.toDate1(currentDate)), -5);
 //                    String toDate = DateUtils.toDate(beforeFive);
 //                    Date parse = sdf.parse(toDate);
-                    qw.eq("stop_Time",beforeFive);
+                    qw.eq("stop_Time",befroeDate);
                     Optional<ProEconWindturbineStatus2> first = proEconWindturbineStatus2Service.list(qw).stream().findFirst();
                     if (first.isPresent()){
                         ProEconWindturbineStatus2 proEconWindturbineStatus2 = first.get();
-                        proEconWindturbineStatus2.setStopTime(DateUtils.parseLongToDate(sdf.parse(DateUtils.toDate1(currentDate)).getTime()));
+                        proEconWindturbineStatus2.setStopTime(DateUtils.parseLongToDate(currentDate.getTime()));
                         proEconWindturbineStatus2.setStopHours(DateUtils.hoursDiff2(proEconWindturbineStatus2.getStopTime(), proEconWindturbineStatus2.getStartTime()));
                         proEconWindturbineStatus2.setLossPower(0.0);
                         proEconWindturbineStatus2.setSpeed(speed);
@@ -135,8 +135,8 @@ public class RealtimeService {
                         proEconWindturbineStatus2.setId(CommonUtils.getUUID());
                         proEconWindturbineStatus2.setWindpowerstationId(wt.getWindpowerstationid());
                         proEconWindturbineStatus2.setWindturbineId(wt.getId());
-                        proEconWindturbineStatus2.setStopTime(DateUtils.parseLongToDate(sdf.parse(DateUtils.toDate1(currentDate)).getTime()));
-                        proEconWindturbineStatus2.setStartTime(DateUtils.parseLongToDate(sdf.parse(DateUtils.toDate1(currentDate)).getTime()));
+                        proEconWindturbineStatus2.setStopTime(DateUtils.parseLongToDate(currentDate.getTime()));
+                        proEconWindturbineStatus2.setStartTime(DateUtils.parseLongToDate(currentDate.getTime()));
                         proEconWindturbineStatus2.setStopHours(DateUtils.hoursDiff2(proEconWindturbineStatus2.getStopTime(), proEconWindturbineStatus2.getStartTime()));
                         proEconWindturbineStatus2.setLossPower(0.0);
                         proEconWindturbineStatus2.setShutdownEventId("");

+ 13 - 3
web/monitor-web-sxjn/pom.xml

@@ -376,6 +376,12 @@
             <artifactId>postgresql</artifactId>
             <version>${pgsql.version}</version>
         </dependency>
+        <dependency>
+            <groupId>com.gyee</groupId>
+            <artifactId>common</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
     <dependencyManagement>
@@ -444,9 +450,13 @@
                     <!--						<version>${mysql.version}</version>-->
                     <!--					</dependency>-->
                     <dependency>
-                        <groupId>com.oracle</groupId>
-                        <artifactId>ojdbc6</artifactId>
-                        <version>11.2.0.3</version>
+<!--                        <groupId>com.oracle</groupId>-->
+<!--                        <artifactId>ojdbc6</artifactId>-->
+<!--                        <version>11.2.0.3</version>-->
+
+                        <groupId>org.postgresql</groupId>
+                        <artifactId>postgresql</artifactId>
+                        <version>${pgsql.version}</version>
                     </dependency>
 
                     <!--					<dependency>-->

+ 83 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/controller/peranalysis/EBAPerSisController.java

@@ -0,0 +1,83 @@
+package com.gyee.frame.controller.peranalysis;
+
+
+import com.gyee.frame.common.conf.AjaxStatus;
+import com.gyee.frame.common.domain.AjaxResult;
+import com.gyee.frame.model.custom.EBAPerSisVo;
+import com.gyee.frame.model.custom.ElePerAnalysisVo;
+import com.gyee.frame.service.peranalysis.EBApersisService;
+import com.gyee.frame.util.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+@RestController
+@RequestMapping("/ebapersis")
+@Api(value = "EBA能效分析", tags = "EBA能效分析")
+public class EBAPerSisController {
+
+
+    @Autowired
+    private EBApersisService ebApersisService;
+
+
+    /**
+     * 月电量分析
+     *
+     * @param companyid
+     * @param regionid
+     * @param station
+     * @param year
+     * @param month
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/getebapersislist")
+    @ResponseBody
+    @ApiOperation(value = "EBA能效分析", notes = "EBA能效分析")
+    public AjaxResult EBAPerSisList(
+            @RequestParam(value = "companyid", required = false) String companyid,
+            @RequestParam(value = "regionid", required = false) String regionid,
+            @RequestParam(value = "station", required = false) String station,
+            @RequestParam(value = "year", required = false) String year,
+            @RequestParam(value = "month", required = false) String month
+    ) throws Exception {
+
+        List<EBAPerSisVo> vos = new ArrayList<>();
+
+        if (StringUtils.notEmp(year) && StringUtils.notEmp(month)) {
+
+            Calendar cal = Calendar.getInstance();
+            cal.set(Calendar.HOUR_OF_DAY, 0);
+            cal.set(Calendar.MINUTE, 0);
+            cal.set(Calendar.SECOND, 0);
+            cal.set(Calendar.MILLISECOND, 0);
+
+            cal.set(Calendar.YEAR, Integer.valueOf(year));
+            cal.set(Calendar.MONTH, Integer.valueOf(month) - 1);
+            cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
+            Date beginDate = cal.getTime();
+            cal.add(Calendar.MONTH, 1);
+            Date endDate = cal.getTime();
+            vos = ebApersisService.getEBApersisList(companyid, regionid, station, beginDate, endDate);
+        }
+
+
+        if (null != vos) {
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        } else {
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        }
+
+    }
+
+
+
+
+}

+ 3 - 3
web/monitor-web-sxjn/src/main/java/com/gyee/frame/controller/peranalysis/ElePerAnalysis.java

@@ -18,7 +18,7 @@ import java.util.List;
 @RestController
 @RequestMapping("/eleperanalysis")
 @Api(value = "月电量分析", tags = "月电量分析")
-public class ElePerAnalysis {
+public class ElePerAnalysisController {
 
 
     @Autowired
@@ -35,7 +35,7 @@ public class ElePerAnalysis {
      * @return
      * @throws Exception
      */
-    @PostMapping("/geteleperanalysislist")
+    @GetMapping("/geteleperanalysislist")
     @ResponseBody
     @ApiOperation(value = "月电量分析", notes = "月电量分析")
     public AjaxResult ElePerAnalysisList(
@@ -47,7 +47,7 @@ public class ElePerAnalysis {
     ) throws Exception {
 
         List<ElePerAnalysisVo> vos = new ArrayList<>();
-        if (StringUtils.notEmp(station) && StringUtils.notEmp(year) && StringUtils.notEmp(month)) {
+        if (StringUtils.notEmp(year) && StringUtils.notEmp(month)) {
 
             Calendar cal = Calendar.getInstance();
             cal.set(Calendar.HOUR_OF_DAY, 0);

+ 1 - 1
web/monitor-web-sxjn/src/main/java/com/gyee/frame/controller/peranalysis/PointPerSis.java

@@ -14,7 +14,7 @@ import java.util.List;
 @RestController
 @RequestMapping("/pointpersis")
 @Api(value = "测点曲线分析", tags = "测点曲线分析")
-public class PointPerSis {
+public class PointPerSisController {
 
 
     @Autowired

+ 1 - 1
web/monitor-web-sxjn/src/main/java/com/gyee/frame/controller/peranalysis/StationPersis.java

@@ -15,7 +15,7 @@ import java.util.List;
 @RestController
 @RequestMapping("/stationPersis")
 @Api(value = "场站性能分析", tags = "场站性能分析")
-public class StationPersis {
+public class StationPersisController {
 
     @Autowired
     private WindpowerstationService windpowerstationService;

+ 23 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/model/custom/EBAPerSisVo.java

@@ -0,0 +1,23 @@
+package com.gyee.frame.model.custom;
+
+
+import lombok.Data;
+
+
+@Data
+public class EBAPerSisVo {
+
+    private String station;
+
+    private String name;
+
+    private double fdl;//发电量
+    private double fs;//风速
+    private double gzssdl;//故障损失电量
+    private double whssdl; //维护损失电量
+    private double xnssdl ; //性能损失电量
+    private double xdssdl; //限电损失电量
+    private double slssdl;//受累损失电量
+    private double fnlyl;//风能利用率
+
+}

+ 3 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/model/custom/ElePerAnalysisVo.java

@@ -34,6 +34,9 @@ public class ElePerAnalysisVo {
 
 
     public double getFinishrate() {
+        if(0==generatingcapacity){
+            return 0;
+        }
         return generation/generatingcapacity;
     }
 }

+ 2 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/model/custom/PointPerSisVo.java

@@ -10,6 +10,8 @@ public class PointPerSisVo {
 
     private String wtid;
 
+    private String name;
+
     private Map<String, List<PointData>> pointDataMap;
 
 

+ 2 - 2
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/WindpowerstationPGService.java

@@ -77,8 +77,8 @@ public class WindpowerstationPGService implements BaseService<WindpowerstationPG
         if(null != regionid){
             criteria.andRegionidEqualTo(regionid);
         }
-        if(null != regionid){
-            criteria.andRegionidEqualTo(regionid);
+        if(null != station){
+            criteria.andIdEqualTo(station);
         }
 
 

+ 87 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/peranalysis/EBApersisService.java

@@ -0,0 +1,87 @@
+package com.gyee.frame.service.peranalysis;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
+import com.gyee.frame.common.cache.IGlobalCache;
+import com.gyee.frame.common.spring.InitialRunner;
+import com.gyee.frame.model.auto.WindpowerstationPG;
+import com.gyee.frame.model.auto.Windpowerstationpointnew;
+import com.gyee.frame.model.custom.DNAVal;
+import com.gyee.frame.model.custom.EBAPerSisVo;
+import com.gyee.frame.service.WindpowerstationPGService;
+import com.gyee.frame.util.DoubleUtils;
+import com.gyee.frame.util.IRealTimeDataBaseUtil;
+import com.gyee.frame.util.RealTimeDataBaseFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+@Service
+public class EBApersisService {
+
+
+    IRealTimeDataBaseUtil realApiUtil = RealTimeDataBaseFactory.createRealTimeDataBase();
+
+
+    @Resource
+    private IGlobalCache globalCache;
+
+
+    @Autowired
+    private WindpowerstationPGService windpowerstationPGService;
+
+
+    public List<EBAPerSisVo> getEBApersisList(String companyid, String regionid, String station, Date beginDate, Date endDate) throws Exception {
+
+        if(endDate.getTime()>new Date().getTime()){
+            endDate = new Date();
+        }
+
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(endDate);
+        calendar.add(Calendar.SECOND, -2);
+        long newend = calendar.getTimeInMillis() / 1000;
+        List<EBAPerSisVo> vos = new ArrayList<>();
+
+        List<WindpowerstationPG> list = windpowerstationPGService.findWindpowerstationPG(companyid, regionid, station);
+        for (WindpowerstationPG wp : list) {
+            EBAPerSisVo vo = new EBAPerSisVo();
+            Map<String, Windpowerstationpointnew> stringMapMap = InitialRunner.wpPointmap.get(wp.getId());
+
+            if (null == stringMapMap || stringMapMap.size() <= 0
+                    || null == stringMapMap.get("YPJFS").getCode() || null == stringMapMap.get("YFDL")
+                    || null == stringMapMap.get("GZSSDL") || null == stringMapMap.get("WHSSDL")
+                    || null == stringMapMap.get("XNSSDL") || null == stringMapMap.get("XDSSDL")
+                    || null == stringMapMap.get("SLSSDL") || null == stringMapMap.get("FNLYL")) {
+                continue;
+            }
+            String[] points = {stringMapMap.get("YPJFS").getCode(),
+                    stringMapMap.get("YFDL").getCode(),
+                    stringMapMap.get("GZSSDL").getCode(),
+                    stringMapMap.get("WHSSDL").getCode(),
+                    stringMapMap.get("XNSSDL").getCode(),
+                    stringMapMap.get("XDSSDL").getCode(),
+                    stringMapMap.get("SLSSDL").getCode(),
+                    stringMapMap.get("FNLYL").getCode()};
+
+            DNAVal[] jkvalues = realApiUtil.getHistMatrix(points, newend);
+            vo.setStation(wp.getId());
+            vo.setName(wp.getName());
+            vo.setFs(jkvalues[0].DValue);
+            vo.setFdl(jkvalues[1].DValue);
+            vo.setGzssdl(jkvalues[2].DValue);//故障损失电量
+            vo.setWhssdl(jkvalues[3].DValue); //维护损失电量
+            vo.setXnssdl(jkvalues[4].DValue); //性能损失电量
+            vo.setXdssdl(jkvalues[5].DValue); //限电损失电量
+            vo.setSlssdl(jkvalues[6].DValue);//受累损失电量
+            vo.setFnlyl(DoubleUtils.keepPrecision(jkvalues[7].DValue,4));//风能利用率
+            vos.add(vo);
+        }
+
+        return vos;
+    }
+
+}

+ 12 - 9
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/peranalysis/ElePerAnalysisService.java

@@ -4,10 +4,8 @@ package com.gyee.frame.service.peranalysis;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.TypeReference;
 import com.gyee.frame.common.cache.IGlobalCache;
-import com.gyee.frame.model.auto.ProjectplanPG;
-import com.gyee.frame.model.auto.Windpowerinfoday;
-import com.gyee.frame.model.auto.WindpowerstationPG;
-import com.gyee.frame.model.auto.Windpowerstationpointnew;
+import com.gyee.frame.common.spring.InitialRunner;
+import com.gyee.frame.model.auto.*;
 import com.gyee.frame.model.custom.DNAVal;
 import com.gyee.frame.model.custom.ElePerAnalysisVo;
 import com.gyee.frame.service.*;
@@ -47,20 +45,22 @@ public class ElePerAnalysisService {
     public List<ElePerAnalysisVo> getElePerAnalysisList(String companyid, String regionid, String station, Date beginDate, Date endDate) throws Exception {
 
 
+        if(endDate.getTime()>new Date().getTime()){
+            endDate = new Date();
+        }
         List<ElePerAnalysisVo> vos = new ArrayList<>();
 
         List<WindpowerstationPG> list = windpowerstationPGService.findWindpowerstationPG(companyid, regionid, station);
         for (WindpowerstationPG wp : list) {
-            String wpString = JSONObject.toJSONString(globalCache.get(station));
-            Map<String, Windpowerstationpointnew> stringMapMap = JSONObject.parseObject(wpString, new TypeReference<Map<String, Windpowerstationpointnew>>() {
-            });
+
+            Map<String, Windpowerstationpointnew> stringMapMap = InitialRunner.wpPointmap.get(wp.getId());
 
 
             Calendar calendar = Calendar.getInstance();
             calendar.setTime(beginDate);
 
 
-            List<ProjectplanPG> pgList = projectplanPGService.findProjectplanPG(station, String.valueOf(calendar.get(Calendar.YEAR)), String.valueOf(calendar.get(Calendar.MONTH)));
+            List<ProjectplanPG> pgList = projectplanPGService.findProjectplanPG(wp.getId(), String.valueOf(calendar.get(Calendar.YEAR)), String.valueOf(calendar.get(Calendar.MONTH)));
             //(风场、发电量 YFDL、风速 YPJFS、计划发电量、发电小时、停机小时、故障小时、电量完成率)
             ElePerAnalysisVo vo = new ElePerAnalysisVo();
             vo.setId(wp.getId());
@@ -79,7 +79,10 @@ public class ElePerAnalysisService {
                     vo.setFs(jkvalues[0].DValue);
                     vo.setGeneration(jkvalues[1].DValue);
                 }
-                vo.setGeneratingcapacity(Double.valueOf(pgList.get(0).getGeneratingcapacity()));
+
+                if(null != pgList && pgList.size()>0){
+                    vo.setGeneratingcapacity(Double.valueOf(pgList.get(0).getGeneratingcapacity()));
+                }
             }
 
             List<Windpowerinfoday> windpowerinfodayList = windpowerinfodayService.getWindpowerinfodayList2(station, beginDate, endDate);

+ 8 - 10
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/peranalysis/PointPerSisService.java

@@ -1,10 +1,9 @@
 package com.gyee.frame.service.peranalysis;
 
-import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.TypeReference;
 import com.gyee.frame.common.cache.IGlobalCache;
+import com.gyee.frame.common.spring.InitialRunner;
 import com.gyee.frame.model.auto.Freedom;
-import com.gyee.frame.model.auto.Windpowerstationpointnew;
+import com.gyee.frame.model.auto.Windturbine;
 import com.gyee.frame.model.auto.Windturbinetestingpointnew;
 import com.gyee.frame.model.custom.PointData;
 import com.gyee.frame.model.custom.PointPerSisVo;
@@ -34,15 +33,11 @@ public class PointPerSisService {
             String[] wtids = wtid.split(",");
             for (String w : wtids) {
                 String[] codes = uniformcodes.split(",");
-
-                String wpString = (String) (globalCache.get(w));
-
-                Map<String, Windturbinetestingpointnew> windturbinetestingpointnewMap = JSONObject.parseObject(wpString, new TypeReference<Map<String, Windturbinetestingpointnew>>() {
-                });
-
-
+                Map<String, Windturbinetestingpointnew> windturbinetestingpointnewMap = InitialRunner.wtPointmap.get(w);
                 PointPerSisVo vo = new PointPerSisVo();
                 vo.setWtid(w);
+                Windturbine windturbines = InitialRunner.wtmap.get(w);
+                vo.setName(windturbines.getName());
 
                 Map<String, List<PointData>> pointDataMap = new HashMap<>();
                 for (int i = 0; i < codes.length; i++) {
@@ -50,6 +45,9 @@ public class PointPerSisService {
                     if (StringUtils.isNotNull(windturbinetestingpointai)) {
                         try {
                             List<PointData> historyDatas = realApiUtil.getHistoryDatasSnap(windturbinetestingpointai, beginDate / 1000, endDate / 1000, null, interval * 60l);
+                            historyDatas.stream().forEach(p->{
+                                p.setPointName(windturbinetestingpointai.getName());
+                            });
                             pointDataMap.put(codes[i], historyDatas);
                         } catch (Exception e) {
                             e.printStackTrace();

+ 1 - 1
web/monitor-web-sxjn/src/main/resources/mybatis-generator.xml

@@ -125,7 +125,7 @@
 <!--        <table tableName='StopAnalysismainVo' domainObjectName='StopAnalysismainVo'/>-->
 
 
-        <table tableName='windpowerstation' domainObjectName='WindpowerstationPG'/>
+        <table tableName='projectplan' domainObjectName='ProjectplanPG'/>
 
 
     </context>