浏览代码

风机报警和升压站报警功能修改优化

shilin 1 年之前
父节点
当前提交
6145f10fc9
共有 20 个文件被更改,包括 7184 次插入0 次删除
  1. 104 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/BrownoutsThread.java
  2. 584 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/BrownoutsThreadPool.java
  3. 93 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/EconWtAlysisDayThread.java
  4. 302 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/EconWtAlysisDayThreadPool.java
  5. 76 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo1Thread.java
  6. 934 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo1ThreadPool.java
  7. 76 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo2Thread.java
  8. 747 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo2ThreadPool.java
  9. 76 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo3Thread.java
  10. 745 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo3ThreadPool.java
  11. 132 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo4Thread.java
  12. 1195 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo4ThreadPool.java
  13. 80 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo5Thread.java
  14. 314 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo5ThreadPool.java
  15. 191 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/InputOrOutPutThreadPool.java
  16. 58 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/InputOrOutPutkThread.java
  17. 84 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/MainBrownoutsThread.java
  18. 566 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/MainBrownoutsThreadPool.java
  19. 98 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/ShutdownnewThread.java
  20. 729 0
      alarm-web/src/main/java/com/gyee/alarm/task/thread/ShutdownnewThreadPool.java

+ 104 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/BrownoutsThread.java

@@ -0,0 +1,104 @@
+package com.gyee.alarm.task.thread;
+
+import com.gyee.common.model.PointData;
+import com.gyee.alarm.model.auto.ProEconBrownoutsEvent;
+import com.gyee.alarm.model.auto.ProEconBrownoutsEvent2;
+import com.gyee.alarm.model.auto.ProEconMainBrownouts;
+import com.gyee.alarm.model.auto.ProEconMainBrownouts2;
+import com.gyee.alarm.service.auto.IProEconBrownoutsEvent2Service;
+import com.gyee.alarm.service.auto.IProEconBrownoutsEventService;
+import com.gyee.alarm.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+
+public class BrownoutsThread implements Runnable {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	private Executor executor;
+
+	private Map<String, List<PointData>> statusMap;
+
+	private String wtId;
+	private Map<String, ProEconBrownoutsEvent> oldBrownoutsStatusMap;
+
+	private Map<String, ProEconBrownoutsEvent2> oldBrownoutsStatus2Map;
+
+	private IProEconBrownoutsEventService proEconBrownoutsEventService;
+
+	private IProEconBrownoutsEvent2Service proEconBrownoutsEvent2Service;
+
+	private Map<Integer, String> statusDescriptionMap;
+
+	private Map<String, Map<String, ProEconMainBrownouts2>> newMainBrownouts2Map;
+	private Map<String, Map<String, ProEconMainBrownouts>> newMainBrownoutsMap;
+	private IEdosUtil edosUtil;
+	private Date begin;
+	private Date end;
+
+	public BrownoutsThread(Executor executor,
+						   Map<String, List<PointData>> statusMap, String wtId,
+						   Map<String, ProEconBrownoutsEvent> oldBrownoutsStatusMap,
+						   Map<String, ProEconBrownoutsEvent2> oldBrownoutsStatus2Map,
+						   IProEconBrownoutsEventService proEconBrownoutsEventService,
+						   IProEconBrownoutsEvent2Service proEconBrownoutsEvent2Service,
+						   Map<Integer, String> statusDescriptionMap,
+						   Map<String, Map<String, ProEconMainBrownouts2>> newMainBrownouts2Map,
+						   Map<String, Map<String, ProEconMainBrownouts>> newMainBrownoutsMap,
+						   IEdosUtil edosUtil, Date begin, Date end
+
+						   ) {
+		this.executor = executor;
+		this.statusMap = statusMap;
+		this.wtId = wtId;
+		this.oldBrownoutsStatusMap = oldBrownoutsStatusMap;
+		this.oldBrownoutsStatus2Map = oldBrownoutsStatus2Map;
+		this.proEconBrownoutsEventService = proEconBrownoutsEventService;
+		this.proEconBrownoutsEvent2Service = proEconBrownoutsEvent2Service;
+		this.statusDescriptionMap = statusDescriptionMap;
+		this.newMainBrownoutsMap = newMainBrownoutsMap;
+		this.newMainBrownouts2Map = newMainBrownouts2Map;
+		this.begin = begin;
+		this.end = end;
+		this.edosUtil = edosUtil;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " + wtId;
+		logger.info("限电子表数据创建任务并提交到线程池中:" + wtId);
+		FutureTask<String> futureTask = new FutureTask<String>(new BrownoutsThreadPool(task,
+				statusMap,  wtId, oldBrownoutsStatusMap,oldBrownoutsStatus2Map,
+				 proEconBrownoutsEventService,
+				 proEconBrownoutsEvent2Service,
+				statusDescriptionMap,
+				newMainBrownouts2Map,
+				 newMainBrownoutsMap,
+				 edosUtil,  begin,  end
+					));
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get();
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		} finally {
+			logger.info("限电子表数据完成任务并提交到线程池中:" + wtId);
+		}
+	}
+}

+ 584 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/BrownoutsThreadPool.java

@@ -0,0 +1,584 @@
+package com.gyee.alarm.task.thread;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
+import com.gyee.alarm.init.CacheContext;
+import com.gyee.alarm.model.auto.*;
+import com.gyee.alarm.model.vo.StatData;
+import com.gyee.alarm.service.auto.IProEconBrownoutsEvent2Service;
+import com.gyee.alarm.service.auto.IProEconBrownoutsEventService;
+import com.gyee.alarm.util.DateUtils;
+import com.gyee.alarm.util.StringUtils;
+import com.gyee.alarm.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.util.*;
+import java.util.concurrent.Callable;
+
+public class BrownoutsThreadPool implements Callable<String>, Serializable {
+
+    private Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    private static final long serialVersionUID = 0;
+
+    // 保存任务所需要的数据
+
+    private Object threadPoolTaskData;
+    private Map<String, List<PointData>> statusMap;
+
+    private String wtId;
+    private Map<String, ProEconBrownoutsEvent> oldBrownoutsStatusMap;
+
+    private Map<String, ProEconBrownoutsEvent2> oldBrownoutsStatus2Map;
+
+    private IProEconBrownoutsEventService proEconBrownoutsEventService;
+
+    private IProEconBrownoutsEvent2Service proEconBrownoutsEvent2Service;
+
+    private Map<Integer, String> statusDescriptionMap;
+
+    private Map<String, Map<String, ProEconMainBrownouts2>> newMainBrownouts2Map;
+    private Map<String, Map<String, ProEconMainBrownouts>> newMainBrownoutsMap;
+    private IEdosUtil edosUtil;
+    private Date begin;
+    private Date end;
+
+
+    public BrownoutsThreadPool(Object tasks,
+                               Map<String, List<PointData>> statusMap, String wtId,
+                               Map<String, ProEconBrownoutsEvent> oldBrownoutsStatusMap,
+                               Map<String, ProEconBrownoutsEvent2> oldBrownoutsStatus2Map,
+                               IProEconBrownoutsEventService proEconBrownoutsEventService,
+                               IProEconBrownoutsEvent2Service proEconBrownoutsEvent2Service,
+                               Map<Integer, String> statusDescriptionMap,
+                               Map<String, Map<String, ProEconMainBrownouts2>> newMainBrownouts2Map,
+                               Map<String, Map<String, ProEconMainBrownouts>> newMainBrownoutsMap,
+                               IEdosUtil edosUtil, Date begin, Date end
+
+    ) {
+
+        this.threadPoolTaskData = tasks;
+        this.statusMap = statusMap;
+        this.wtId = wtId;
+        this.oldBrownoutsStatusMap = oldBrownoutsStatusMap;
+        this.oldBrownoutsStatus2Map = oldBrownoutsStatus2Map;
+        this.proEconBrownoutsEventService = proEconBrownoutsEventService;
+        this.proEconBrownoutsEvent2Service = proEconBrownoutsEvent2Service;
+        this.statusDescriptionMap = statusDescriptionMap;
+        this.newMainBrownoutsMap = newMainBrownoutsMap;
+        this.newMainBrownouts2Map = newMainBrownouts2Map;
+        this.begin = begin;
+        this.end = end;
+        this.edosUtil = edosUtil;
+
+
+    }
+
+    public synchronized String call() throws Exception {
+
+
+        // 处理一个任务,这里的处理方式太简单了,仅仅是一个打印语句
+
+        //System.out.println("开始执行任务:" + threadPoolTaskData);
+
+        String result = "";
+
+        // //便于观察,等待一段时间
+
+
+        try {
+
+
+          Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = CacheContext.wtpAimap.get(wtId);
+
+            //取实时状态数据 赋值给status
+
+            if (windturbinetestingpointnewMap.containsKey(ContantXk.MXZT)) {
+                ProBasicEquipmentPoint mxztPoint = windturbinetestingpointnewMap.get(ContantXk.MXZT);
+                //获取5分钟没个间隔1秒钟,保证状态与时序库保持一致
+                List<PointData> statusls = edosUtil.getHistoryDatasSnap(mxztPoint.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000, null, 1L);
+                statusMap.put(wtId, statusls);
+            }
+
+            List<ProEconBrownoutsEvent2> proEconBrownoutsEvent2ls=new ArrayList<>();
+            List<ProEconBrownoutsEvent> proEconBrownoutsEventls=new ArrayList<>();
+
+
+
+
+            ProEconBrownoutsEvent brownoutsEvent = null;
+            ProEconBrownoutsEvent2 brownoutsEvent2;
+            //获取5分钟的状态值
+            List<PointData> statusls = statusMap.get(wtId);
+
+            Map<String, ProBasicEquipmentPoint> wtpointmap = CacheContext.wtpAimap.get(wtId);
+            //记录上次判定的状态值
+            int lastStatus = (int) statusls.get(0).getPointValueInDouble();
+            for (PointData stpo : statusls) {
+                //获取当前状态
+                int currentStatus = (int) stpo.getPointValueInDouble();
+                //获取当前时间
+                Date currentTime = new Date(stpo.getPointTime());
+                //如果数据库中不存在该风机未完成的故障记录,进入
+                if (brownoutsEvent == null) {
+                    if (currentStatus == 8 || currentStatus == 9) {
+                        brownoutsEvent = new ProEconBrownoutsEvent();
+                        initialBrownoutsEvent(wtId, wtpointmap, currentStatus, currentTime, brownoutsEvent);
+                        oldBrownoutsStatusMap.put(wtId, brownoutsEvent);
+
+                        brownoutsEvent2 = new ProEconBrownoutsEvent2();
+                        initialBrownoutsEvent2(wtId, wtpointmap, currentStatus, currentTime, brownoutsEvent2);
+                        oldBrownoutsStatus2Map.put(wtId, brownoutsEvent2);
+                    }
+
+
+                    //将当前状态赋值给过去状态
+                    lastStatus = currentStatus;
+                } else if (lastStatus != currentStatus) {
+
+                    //如果添加了状态值,状态值变化存储,并清空
+                    if (oldBrownoutsStatusMap.containsKey(wtId)) {
+
+                        //获取数据库中的状态值,状态值变化存储,并清空
+                        brownoutsEvent = oldBrownoutsStatusMap.get(wtId);
+                        if (brownoutsEvent == null) {
+                            brownoutsEvent = new ProEconBrownoutsEvent();
+                            initialBrownoutsEvent(wtId, wtpointmap, currentStatus, currentTime, brownoutsEvent);
+                            oldBrownoutsStatusMap.put(wtId, brownoutsEvent);
+                        } else {
+                            finishBrownoutsEvent(wtId, brownoutsEvent, currentTime);
+                            oldBrownoutsStatusMap.put(wtId, null);
+                            brownoutsEvent = null;
+                        }
+
+
+                    }
+
+                    if (oldBrownoutsStatus2Map.containsKey(wtId)) {
+
+                        //获取数据库中的状态值,状态值变化存储,并清空
+                        brownoutsEvent2 = oldBrownoutsStatus2Map.get(wtId);
+                        if (brownoutsEvent2 == null) {
+                            brownoutsEvent2 = new ProEconBrownoutsEvent2();
+                            initialBrownoutsEvent2(wtId, wtpointmap, currentStatus, currentTime, brownoutsEvent2);
+                            oldBrownoutsStatus2Map.put(wtId, brownoutsEvent2);
+                        } else {
+                            finishBrownoutsEvent2(wtId, brownoutsEvent2, currentTime);
+                            oldBrownoutsStatus2Map.put(wtId, null);
+                        }
+
+
+                    }
+
+
+                    lastStatus = currentStatus;
+                }
+
+
+            }
+            //循环结束落盘,并清空
+            if (oldBrownoutsStatusMap.containsKey(wtId)) {
+                //获取数据库查询是否有风机对应时间的记录,如果没有写入数据库
+                brownoutsEvent = oldBrownoutsStatusMap.get(wtId);
+                if (brownoutsEvent != null) {
+                    ProEconBrownoutsEvent finalItem = brownoutsEvent;
+                    QueryWrapper<ProEconBrownoutsEvent> queryWrapper5 = new QueryWrapper<>();
+                    queryWrapper5.eq("windpowerstation_id", finalItem.getWindpowerstationId()).eq("stop_Time",finalItem.getStopTime());
+                    List<ProEconBrownoutsEvent> ls = proEconBrownoutsEventService.list(queryWrapper5);
+//                            .stream().filter(i -> i.getWindpowerstationId().equals(finalItem.getWindpowerstationId())
+//                                    && i.getStopTime().compareTo(finalItem.getStopTime()) == 0).collect(Collectors.toList());
+
+                    if (ls.isEmpty()) {
+                        proEconBrownoutsEventService.save(finalItem);
+                        oldBrownoutsStatusMap.put(wtId, null);
+
+                    }
+                }
+
+
+            }
+
+
+            if (oldBrownoutsStatus2Map.containsKey(wtId)) {
+                //获取数据库查询是否有风机对应时间的记录,如果没有写入数据库
+                brownoutsEvent2 = oldBrownoutsStatus2Map.get(wtId);
+                if (brownoutsEvent2 != null) {
+                    ProEconBrownoutsEvent2 finalItem = brownoutsEvent2;
+                    QueryWrapper<ProEconBrownoutsEvent2> queryWrapper5 = new QueryWrapper<>();
+                    queryWrapper5.eq("windpowerstation_id", finalItem.getWindpowerstationId()).eq("stop_Time",finalItem.getStopTime());
+                    List<ProEconBrownoutsEvent2> ls = proEconBrownoutsEvent2Service.list(queryWrapper5);
+//                            .stream().filter(i -> i.getWindpowerstationId().equals(finalItem.getWindpowerstationId())
+//                                    && i.getStopTime().compareTo(finalItem.getStopTime()) == 0).collect(Collectors.toList());
+
+                    if (ls.isEmpty()) {
+                        proEconBrownoutsEvent2Service.save(finalItem);
+                        oldBrownoutsStatus2Map.put(wtId, null);
+
+                    }
+                }
+
+            }
+
+            List<ProEconBrownoutsEvent> templs=new ArrayList<>();
+            for(ProEconBrownoutsEvent vo:proEconBrownoutsEventls)
+            {
+                templs.add(vo);
+                if(templs.size()==100)
+                {
+                    proEconBrownoutsEventService.saveOrUpdateBatch(templs);
+                    templs=new ArrayList<>();
+                }
+            }
+
+            if(!templs.isEmpty())
+            {
+                proEconBrownoutsEventService.saveOrUpdateBatch(templs);
+            }
+
+
+            List<ProEconBrownoutsEvent2> templs2=new ArrayList<>();
+            for(ProEconBrownoutsEvent2 vo:proEconBrownoutsEvent2ls)
+            {
+                templs2.add(vo);
+                if(templs2.size()==100)
+                {
+                    proEconBrownoutsEvent2Service.saveOrUpdateBatch(templs2);
+                    templs2=new ArrayList<>();
+                }
+            }
+
+            if(!templs2.isEmpty())
+            {
+                proEconBrownoutsEvent2Service.saveOrUpdateBatch(templs2);
+            }
+
+
+//            proEconBrownoutsEventService.saveOrUpdateBatch(proEconBrownoutsEventls);
+//            proEconBrownoutsEvent2Service.saveOrUpdateBatch(proEconBrownoutsEvent2ls);
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+
+        threadPoolTaskData = null;
+
+        return result;
+
+    }
+    private void initialBrownoutsEvent(String wtId, Map<String, ProBasicEquipmentPoint> wtpointmap, Integer currentStatus, Date currentTime, ProEconBrownoutsEvent sub) throws Exception {
+        ProBasicEquipment wt = CacheContext.wtmap.get(wtId);
+        Map<String, ProEconMainBrownouts> timemap = null;
+        if (newMainBrownoutsMap.containsKey(wt.getWindpowerstationId())) {
+            timemap = newMainBrownoutsMap.get(wt.getWindpowerstationId());
+        } else {
+            timemap = new HashMap<>();
+            newMainBrownoutsMap.put(wt.getWindpowerstationId(), timemap);
+        }
+        if (timemap.containsKey(String.valueOf(currentTime))) {
+            ProEconMainBrownouts mainObj = timemap.get(String.valueOf(currentTime));
+            sub.setMainId(mainObj.getId());
+        }
+
+
+        sub.setId(StringUtils.getUUID());
+        sub.setWindpowerstationId(wt.getWindpowerstationId());
+        sub.setWindturbineId(wt.getId());
+        sub.setProjectId(wt.getProjectId());
+        sub.setLineId(wt.getLineId());
+        sub.setStopTime(currentTime);
+        sub.setStartTime(null);
+        sub.setStopHours(0.0);
+        sub.setLossPower(0.0);
+
+        sub.setStopTypeId(statusDescriptionMap.get(currentStatus));
+
+
+        PointData data = edosUtil.getRealData(wtpointmap.get(ContantXk.CJ_SSGL));
+        sub.setLimitLoad(StringUtils.round(data.getPointValueInDouble(), 2));
+        data = edosUtil.getRealData(wtpointmap.get(ContantXk.CJ_SSFS));
+        sub.setWindSpeed(StringUtils.round(data.getPointValueInDouble(), 2));
+
+
+        long pried = DateUtils.secondsDiff(DateUtils.addMinutes(currentTime, -5), currentTime);
+        List<PointData> hsls = edosUtil.getHistStat(wtpointmap.get(ContantXk.CJ_SSGL), DateUtils.addMinutes(currentTime, -5).getTime() / 1000, currentTime.getTime() / 1000, 1L, pried, StatData.MAX.getValue());
+        if (StringUtils.notEmp(hsls) && hsls.size() > 0) {
+            sub.setThisLoad(hsls.get(0).getPointValueInDouble());
+
+
+            oldBrownoutsStatusMap.put(wtId, sub);
+        }
+
+    }
+
+    private void initialBrownoutsEvent2(String wtId, Map<String, ProBasicEquipmentPoint> wtpointmap, Integer currentStatus, Date currentTime, ProEconBrownoutsEvent2 sub) throws Exception {
+        ProBasicEquipment wt = CacheContext.wtmap.get(wtId);
+        Map<String, ProEconMainBrownouts2> timemap = null;
+        if (newMainBrownouts2Map.containsKey(wt.getWindpowerstationId())) {
+            timemap = newMainBrownouts2Map.get(wt.getWindpowerstationId());
+
+        }else
+        {
+            timemap=new HashMap<>();
+            newMainBrownouts2Map.put(wt.getWindpowerstationId(),timemap);
+        }
+        if (timemap.containsKey(String.valueOf(currentTime))) {
+            ProEconMainBrownouts2 mainObj = timemap.get(String.valueOf(currentTime));
+            sub.setMainId(mainObj.getId());
+        }
+
+        sub.setId(StringUtils.getUUID());
+        sub.setWindpowerstationId(wt.getWindpowerstationId());
+        sub.setWindturbineId(wt.getId());
+        sub.setProjectId(wt.getProjectId());
+        sub.setLineId(wt.getLineId());
+        sub.setStopTime(currentTime);
+        sub.setStartTime(null);
+        sub.setStopHours(0.0);
+        sub.setLossPower(0.0);
+        sub.setStopTypeId(statusDescriptionMap.get(currentStatus));
+
+
+        PointData data = edosUtil.getRealData(wtpointmap.get(ContantXk.CJ_SSGL));
+        sub.setLimitLoad(StringUtils.round(data.getPointValueInDouble(), 2));
+        data = edosUtil.getRealData(wtpointmap.get(ContantXk.CJ_SSFS));
+        sub.setWindSpeed(StringUtils.round(data.getPointValueInDouble(), 2));
+
+
+        long pried = DateUtils.secondsDiff(DateUtils.addMinutes(currentTime, -5), currentTime);
+        List<PointData> hsls = edosUtil.getHistStat(wtpointmap.get(ContantXk.CJ_SSGL), DateUtils.addMinutes(currentTime, -5).getTime() / 1000, currentTime.getTime() / 1000, 1L, pried, StatData.MAX.getValue());
+        if (StringUtils.notEmp(hsls) && hsls.size() > 0) {
+            sub.setThisLoad(hsls.get(0).getPointValueInDouble());
+
+        }
+
+        oldBrownoutsStatus2Map.put(wtId, sub);
+
+
+    }
+
+
+
+
+    private void finishBrownoutsEvent(String wpId, ProEconBrownoutsEvent item, Date currentTime) throws Exception {
+//        if (currentStatus != 8 && currentStatus != 9)
+//        {
+        item.setStartTime(currentTime);
+        double timehour = DateUtils.hoursDiff2(item.getStartTime(), item.getStopTime());
+        item.setStopHours(timehour);
+        double losspower = calLossPower(wpId, item.getStartTime(), item.getStopTime());
+        item.setLossPower(losspower);
+        proEconBrownoutsEventService.saveOrUpdate(item);
+
+
+        //       }
+    }
+
+    private void finishBrownoutsEvent2(String wpId, ProEconBrownoutsEvent2 brownoutsEvent2, Date currentTime) throws Exception {
+//        if (currentStatus != 8 && currentStatus != 9)
+//        {
+        brownoutsEvent2.setStartTime(currentTime);
+
+        double timehour = DateUtils.hoursDiff2(brownoutsEvent2.getStartTime(), brownoutsEvent2.getStopTime());
+        brownoutsEvent2.setStopHours(timehour);
+        double losspower = calLossPower(wpId, brownoutsEvent2.getStartTime(), brownoutsEvent2.getStopTime());
+        brownoutsEvent2.setLossPower(losspower);
+
+        if (timehour <= 24) {
+            proEconBrownoutsEvent2Service.saveOrUpdate(brownoutsEvent2);
+        } else {
+            int days = DateUtils.daysDiff1(brownoutsEvent2.getStartTime(), brownoutsEvent2.getStopTime());
+            Calendar c = Calendar.getInstance();
+            Date startTime = brownoutsEvent2.getStartTime();
+            c.setTime(brownoutsEvent2.getStopTime());
+            c.set(Calendar.HOUR_OF_DAY, 23);
+            c.set(Calendar.MINUTE, 59);
+            c.set(Calendar.SECOND, 59);
+            for (int i = 0; i < days; i++) {
+                if (i == 0) {
+                    brownoutsEvent2.setStartTime(c.getTime());
+                    losspower = calLossPower(wpId, brownoutsEvent2.getStartTime(), brownoutsEvent2.getStopTime());
+
+                } else {
+                    brownoutsEvent2.setStopTime(DateUtils.truncate(c.getTime()));
+                    if (i == days - 1) {
+                        brownoutsEvent2.setStartTime(startTime);
+
+                    } else {
+                        brownoutsEvent2.setStartTime(c.getTime());
+
+                    }
+                    losspower = calLossPower(wpId, brownoutsEvent2.getStartTime(), brownoutsEvent2.getStopTime());
+                }
+                brownoutsEvent2.setLossPower(losspower);
+                proEconBrownoutsEvent2Service.saveOrUpdate(brownoutsEvent2);
+
+
+                c.add(Calendar.DAY_OF_MONTH, 1);
+            }
+        }
+
+
+//        }
+
+    }
+
+
+
+    //修改后的限电损失统计,通过时序数据库历史切面计算
+    private Double calLossPower(String windturbineId, Date startDate, Date endDate) throws Exception {
+        double result = 0.0;
+
+        Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
+        Map<String, ProBasicEquipmentPoint> wtpointmap = wtpAimap.get(windturbineId);
+
+        Calendar c1 = Calendar.getInstance();
+        c1.setTime(startDate);
+        Calendar c2 = Calendar.getInstance();
+        c2.setTime(endDate);
+        //判定限电是否跨年
+        if (endDate.after(startDate) && c1.get(Calendar.YEAR) == c2.get(Calendar.YEAR)) {
+            //年限电欠发损失电量
+            if (wtpointmap.containsKey(ContantXk.NXDTJSSDL)) {
+                double beginvalue;
+                double endvalue;
+
+
+                List<String> pointid = new ArrayList<>();
+                pointid.add(wtpointmap.get(ContantXk.NXDTJSSDL).getNemCode());
+                List<PointData> xdbegin = edosUtil.getHistMatrix(pointid, startDate.getTime() / 1000);
+                List<PointData> xdend = edosUtil.getHistMatrix(pointid, endDate.getTime() / 1000);
+
+
+                if (xdbegin.size() == 1 && xdend.size() == 1) {
+                    beginvalue = xdbegin.get(0).getPointValueInDouble();
+                    endvalue = xdend.get(0).getPointValueInDouble();
+
+                    if (endvalue > beginvalue) {
+                        result = result + (endvalue - beginvalue);
+                    }
+                }
+            }
+
+            //年限电损失电量
+            if (wtpointmap.containsKey(ContantXk.NXDJCLSSDL)) {
+                double beginvalue;
+                double endvalue;
+
+                List<String> pointid = new ArrayList<>();
+                pointid.add(wtpointmap.get(ContantXk.NXDJCLSSDL).getNemCode());
+                List<PointData> xdbegin = edosUtil.getHistMatrix(pointid, startDate.getTime() / 1000);
+                List<PointData> xdend = edosUtil.getHistMatrix(pointid, endDate.getTime() / 1000);
+
+
+                if (xdbegin.size() == 1 && xdend.size() == 1) {
+                    beginvalue = xdbegin.get(0).getPointValueInDouble();
+                    endvalue = xdend.get(0).getPointValueInDouble();
+
+                    if (endvalue > beginvalue) {
+                        result = result + (endvalue - beginvalue);
+                    }
+                }
+            }
+        } else {
+            Calendar c = Calendar.getInstance();
+            c.setTime(DateUtils.truncate(startDate));
+            c.add(Calendar.DAY_OF_MONTH, 1);
+            //获得1月1日零点值
+            Date endtime = c.getTime();
+            //年限电欠发损失电量
+            if (wtpointmap.containsKey(ContantXk.NXDTJSSDL)) {
+                double beginvalue;
+                double endvalue;
+
+                List<String> pointid = new ArrayList<>();
+                pointid.add(wtpointmap.get(ContantXk.NXDTJSSDL).getNemCode());
+                List<PointData> xdbegin = edosUtil.getHistMatrix(pointid, startDate.getTime() / 1000);
+                List<PointData> xdend = edosUtil.getHistMatrix(pointid, endtime.getTime() / 1000);
+
+
+                if (xdbegin.size() == 1 && xdend.size() == 1) {
+                    beginvalue = xdbegin.get(0).getPointValueInDouble();
+                    endvalue = xdend.get(0).getPointValueInDouble();
+
+                    if (endvalue > beginvalue) {
+                        result = result + (endvalue - beginvalue);
+                    }
+                }
+            }
+
+            //年限电损失电量
+            if (wtpointmap.containsKey(ContantXk.NXDJCLSSDL)) {
+                double beginvalue;
+                double endvalue;
+
+                List<String> pointid = new ArrayList<>();
+                pointid.add(wtpointmap.get(ContantXk.NXDJCLSSDL).getNemCode());
+                List<PointData> xdbegin = edosUtil.getHistMatrix(pointid, startDate.getTime() / 1000);
+                List<PointData> xdend = edosUtil.getHistMatrix(pointid, endtime.getTime() / 1000);
+
+
+                if (xdbegin.size() == 1 && xdend.size() == 1) {
+                    beginvalue = xdbegin.get(0).getPointValueInDouble();
+                    endvalue = xdend.get(0).getPointValueInDouble();
+
+                    if (endvalue > beginvalue) {
+                        result = result + (endvalue - beginvalue);
+                    }
+                }
+            }
+
+
+            //日限电欠发损失电量
+            if (wtpointmap.containsKey(ContantXk.NXDTJSSDL)) {
+
+                double endvalue;
+
+
+                List<String> pointid = new ArrayList<>();
+                pointid.add(wtpointmap.get(ContantXk.NXDTJSSDL).getNemCode());
+
+                List<PointData> xdend = edosUtil.getHistMatrix(pointid, endDate.getTime() / 1000);
+
+
+                if (xdend.size() == 1) {
+
+                    endvalue = xdend.get(0).getPointValueInDouble();
+
+                    if (endvalue > 0) {
+                        result = result + endvalue;
+                    }
+                }
+            }
+
+            //日限电损失电量
+            if (wtpointmap.containsKey(ContantXk.NXDJCLSSDL)) {
+
+                double endvalue;
+
+
+                List<String> pointid = new ArrayList<>();
+                pointid.add(wtpointmap.get(ContantXk.NXDJCLSSDL).getNemCode());
+
+                List<PointData> xdend = edosUtil.getHistMatrix(pointid, endDate.getTime() / 1000);
+
+
+                if (xdend.size() == 1) {
+
+                    endvalue = xdend.get(0).getPointValueInDouble();
+
+                    if (endvalue > 0) {
+                        result = result + endvalue;
+                    }
+                }
+            }
+        }
+
+
+        return result;
+
+    }
+}

+ 93 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/EconWtAlysisDayThread.java

@@ -0,0 +1,93 @@
+package com.gyee.alarm.task.thread;
+
+import com.gyee.alarm.model.auto.*;
+import com.gyee.alarm.service.auto.IProEconWtAlysisDayService;
+import com.gyee.alarm.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+
+public class EconWtAlysisDayThread implements Runnable {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	private Executor executor;
+
+	private ProBasicEquipment wt;
+	private   Map<String, ProEconEquipmentInfoDay1> eqday1map;
+	private   Map<String, ProEconEquipmentInfoDay2> eqday2map;
+	private   Map<String, ProEconEquipmentInfoDay3> eqday3map;
+	private   Map<String, ProEconEquipmentInfoDay4> eqday4map;
+	private Date recordDate;
+	private Date end;
+
+	private Date begin;
+	private List<ProEconWtAlysisDay> dayls;
+	private IEdosUtil edosUtil;
+	private Calendar c;
+
+	private IProEconWtAlysisDayService proEconWtAlysisDayService;
+
+	private CountDownLatch latch;
+
+	public EconWtAlysisDayThread(Executor executor, ProBasicEquipment wt, Map<String, ProEconEquipmentInfoDay1> eqday1map,
+								 Map<String, ProEconEquipmentInfoDay2> eqday2map,
+								 Map<String, ProEconEquipmentInfoDay3> eqday3map,
+								 Map<String, ProEconEquipmentInfoDay4> eqday4map,
+								 Date recordDate, Date end, Date begin, List<ProEconWtAlysisDay> dayls,
+								 IEdosUtil edosUtil,Calendar c,IProEconWtAlysisDayService proEconWtAlysisDayService,
+                                 CountDownLatch latch	) {
+		this.executor = executor;
+		this.wt = wt;
+		this.eqday1map = eqday1map;
+		this.eqday2map = eqday2map;
+		this.eqday3map = eqday3map;
+		this.eqday4map = eqday4map;
+		this.recordDate = recordDate;
+		this.end = end;
+		this.begin = begin;
+		this.dayls = dayls;
+		this.edosUtil = edosUtil;
+		this.c = c;
+		this.proEconWtAlysisDayService = proEconWtAlysisDayService;
+		this.latch = latch;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " + wt.getId();
+		logger.info("分析数据统计务创建任务并提交到线程池中:" + wt.getId());
+		FutureTask<String> futureTask = new FutureTask<String>(new EconWtAlysisDayThreadPool(task,
+				wt,  eqday1map,
+				 eqday2map,
+				 eqday3map,
+				 eqday4map,
+				 recordDate,  end,  begin,  dayls,
+				 edosUtil, c, proEconWtAlysisDayService));
+
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get();
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		}finally {
+			latch.countDown();
+		}
+	}
+}

+ 302 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/EconWtAlysisDayThreadPool.java

@@ -0,0 +1,302 @@
+package com.gyee.alarm.task.thread;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
+import com.gyee.common.model.StringUtils;
+import com.gyee.alarm.init.CacheContext;
+import com.gyee.alarm.model.auto.*;
+import com.gyee.alarm.service.auto.IProEconWtAlysisDayService;
+import com.gyee.alarm.util.DateUtils;
+import com.gyee.alarm.util.realtimesource.IEdosUtil;
+import com.gyee.alarm.util.statisticcs.Initial;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.*;
+import java.util.concurrent.Callable;
+
+public class EconWtAlysisDayThreadPool implements Callable<String>, Serializable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+
+	private static final long serialVersionUID = 0;
+
+	// 保存任务所需要的数据
+
+	private Object threadPoolTaskData;
+	private ProBasicEquipment wt;
+	private   Map<String, ProEconEquipmentInfoDay1> eqday1map;
+	private   Map<String, ProEconEquipmentInfoDay2> eqday2map;
+	private   Map<String, ProEconEquipmentInfoDay3> eqday3map;
+	private   Map<String, ProEconEquipmentInfoDay4> eqday4map;
+	private Date recordDate;
+	private Date end;
+
+	private Date begin;
+	private List<ProEconWtAlysisDay> dayls;
+	private IEdosUtil edosUtil;
+	private Calendar c;
+
+	private IProEconWtAlysisDayService proEconWtAlysisDayService;
+
+	public EconWtAlysisDayThreadPool(Object tasks, ProBasicEquipment wt, Map<String, ProEconEquipmentInfoDay1> eqday1map,
+									 Map<String, ProEconEquipmentInfoDay2> eqday2map,
+									 Map<String, ProEconEquipmentInfoDay3> eqday3map,
+									 Map<String, ProEconEquipmentInfoDay4> eqday4map,
+                                     Date recordDate, Date end, Date begin, List<ProEconWtAlysisDay> dayls,
+                                     IEdosUtil edosUtil,Calendar c,IProEconWtAlysisDayService proEconWtAlysisDayService
+	) {
+
+		this.threadPoolTaskData = tasks;
+		this.wt = wt;
+		this.eqday1map = eqday1map;
+		this.eqday2map = eqday2map;
+		this.eqday3map = eqday3map;
+		this.eqday4map = eqday4map;
+		this.recordDate = recordDate;
+		this.end = end;
+		this.begin = begin;
+		this.dayls = dayls;
+		this.edosUtil = edosUtil;
+		this.c = c;
+		this.proEconWtAlysisDayService = proEconWtAlysisDayService;
+	}
+
+	public synchronized String call() throws Exception {
+
+
+		// 处理一个任务,这里的处理方式太简单了,仅仅是一个打印语句
+
+		//System.out.println("开始执行任务:" + threadPoolTaskData);
+
+		String result = "";
+
+		// //便于观察,等待一段时间
+
+		try {
+			ProEconWtAlysisDay pewp=new ProEconWtAlysisDay();
+			Initial.initial(pewp);
+			pewp.setRecordDate(DateUtils.truncate(recordDate));
+			pewp.setWindturbineId(wt.getId());
+
+			if(eqday1map.containsKey(wt.getId()))
+			{
+				ProEconEquipmentInfoDay1 dayinfo= eqday1map.get(wt.getId());
+
+				pewp.setRfdl(dayinfo.getRfdl());
+				pewp.setRpjfs(dayinfo.getRpjfs());
+				pewp.setRpjgl(dayinfo.getRpjgl());
+				pewp.setRyfdl(dayinfo.getRllfdl());
+
+
+				double gzss=dayinfo.getRgzssdl();
+				double jxss=dayinfo.getRjxssdl();
+				double xnss=dayinfo.getRxnssdl();
+				double xdss=dayinfo.getRxdtjssdl()+dayinfo.getRxdjclssdl();
+				double slss=dayinfo.getRcwsltqssdl()+dayinfo.getRcwsldwssdl();
+
+				double ssdl=gzss+jxss+xnss+xdss+slss;
+				pewp.setRssdl(StringUtils.round(ssdl,2));
+
+				pewp.setYfdl(dayinfo.getYfdl());
+				pewp.setYpjfs(dayinfo.getYpjfs());
+				pewp.setYpjgl(dayinfo.getYpjgl());
+				pewp.setYyfdl(dayinfo.getYllfdl());
+
+
+				gzss=dayinfo.getYgzssdl();
+				jxss=dayinfo.getYjxssdl();
+				xnss=dayinfo.getYxnssdl();
+				xdss=dayinfo.getYxdtjssdl()+dayinfo.getYxdjclssdl();
+				slss=dayinfo.getYcwsltqssdl()+dayinfo.getYcwsldwssdl();
+
+				ssdl=gzss+jxss+xnss+xdss+slss;
+				pewp.setYssdl(StringUtils.round(ssdl,2));
+
+				pewp.setNfdl(dayinfo.getNfdl());
+				pewp.setNpjfs(dayinfo.getNpjfs());
+				pewp.setNpjgl(dayinfo.getNpjgl());
+				pewp.setNyfdl(dayinfo.getNllfdl());
+
+
+				gzss=dayinfo.getNgzssdl();
+				jxss=dayinfo.getNjxssdl();
+				xnss=dayinfo.getNxnssdl();
+				xdss=dayinfo.getNxdtjssdl()+dayinfo.getNxdjclssdl();
+				slss=dayinfo.getNcwsltqssdl()+dayinfo.getNcwsldwssdl();
+
+				ssdl=gzss+jxss+xnss+xdss+slss;
+				pewp.setNssdl(StringUtils.round(ssdl,2));
+
+			}
+
+
+			if(eqday2map.containsKey(wt.getId()))
+			{
+				ProEconEquipmentInfoDay2 dayinfo= eqday2map.get(wt.getId());
+				pewp.setRyxxs(dayinfo.getRyxxs());
+				pewp.setRgzxs(dayinfo.getRgztjxs());
+				pewp.setRjxxs(dayinfo.getRjxtjxs());
+				pewp.setRzdxs(dayinfo.getRxdxs());
+				pewp.setRzdxs(dayinfo.getRtxzdxs());
+
+				int dayTimes=24;
+				double sbklyl =  new BigDecimal(dayTimes-dayinfo.getRgztjxs()).divide(new BigDecimal(dayTimes), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();//风机平均设备可利用率
+				pewp.setRsbklyl(StringUtils.round(sbklyl, 2));
+
+				pewp.setYyxxs(dayinfo.getYyxxs());
+				pewp.setYgzxs(dayinfo.getYgztjxs());
+				pewp.setYjxxs(dayinfo.getYjxtjxs());
+				pewp.setYzdxs(dayinfo.getYxdxs());
+				pewp.setYzdxs(dayinfo.getYtxzdxs());
+				c.setTime(recordDate);
+				int days=c.get(Calendar.DAY_OF_MONTH);
+				dayTimes=24*days;
+				sbklyl =  new BigDecimal(dayTimes-dayinfo.getYgztjxs()).divide(new BigDecimal(dayTimes), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();//风机平均设备可利用率
+				pewp.setYsbklyl(StringUtils.round(sbklyl, 2));
+
+				pewp.setNyxxs(dayinfo.getNyxxs());
+				pewp.setNgzxs(dayinfo.getNgztjxs());
+				pewp.setNjxxs(dayinfo.getNjxtjxs());
+				pewp.setNzdxs(dayinfo.getNxdxs());
+				pewp.setNzdxs(dayinfo.getNtxzdxs());
+
+				days=c.get(Calendar.DAY_OF_YEAR);
+				dayTimes=24*days;
+				sbklyl =  new BigDecimal(dayTimes-dayinfo.getNgztjxs()).divide(new BigDecimal(dayTimes), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();//风机平均设备可利用率
+				pewp.setNsbklyl(StringUtils.round(sbklyl, 2));
+			}
+
+			if(eqday3map.containsKey(wt.getId()))
+			{
+				ProEconEquipmentInfoDay3 dayinfo= eqday3map.get(wt.getId());
+				pewp.setRtjcs(dayinfo.getRgztjcs()+dayinfo.getRjxtjcs());
+				pewp.setYtjcs(dayinfo.getYgztjcs()+dayinfo.getYjxtjcs());
+				pewp.setNtjcs(dayinfo.getNgztjcs()+dayinfo.getNjxtjcs());
+
+			}
+
+			if(eqday4map.containsKey(wt.getId()))
+			{
+				ProEconEquipmentInfoDay4 dayinfo= eqday4map.get(wt.getId());
+				pewp.setRnhyd(dayinfo.getRnhyd());
+				pewp.setRsjbz(dayinfo.getRqxpcbbzsj());
+				pewp.setRyxfs(dayinfo.getRyxfss());
+
+				pewp.setYnhyd(dayinfo.getYnhyd());
+				pewp.setYsjbz(dayinfo.getYqxpcbbzsj());
+				pewp.setYyxfs(dayinfo.getYyxfss());
+
+				pewp.setNnhyd(dayinfo.getNnhyd());
+				pewp.setNsjbz(dayinfo.getNqxpcbbzsj());
+				pewp.setNyxfs(dayinfo.getNyxfss());
+
+			}
+			//昨日的统计结果
+			List<ProEconWtAlysisDay> pepidls =new ArrayList<>();
+			Calendar cl=Calendar.getInstance();
+			cl.setTime(recordDate);
+			cl.add(Calendar.DAY_OF_MONTH,-1);
+			if(cl.get(Calendar.DAY_OF_MONTH)!=1)
+			{
+				QueryWrapper<ProEconWtAlysisDay> queryWrapper2 = new QueryWrapper<>();
+				queryWrapper2.eq("record_date",DateUtils.truncate(cl.getTime())).eq("windTurbine_Id",wt.getId());
+				pepidls = proEconWtAlysisDayService.list(queryWrapper2);
+//                        .stream()
+//                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//                                && i.getWindturbineId().equals(wt.getId())
+//                        )
+//                        .collect(Collectors.toList());
+			}
+			calSimple(pewp, end, begin, wt, pepidls);
+			dayls.add(pewp);
+
+
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		threadPoolTaskData = null;
+
+		return result;
+
+	}
+
+	private void calSimple(ProEconWtAlysisDay pewp, Date end, Date begin, ProBasicEquipment wt, List<ProEconWtAlysisDay> pepidls) throws Exception {
+
+//*******************************************日信息统计*********************************************************/
+
+		double lastState=-1;//上一分钟状态
+
+
+		double bbhcs=0;//不饱和次数
+
+		Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
+
+
+		Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getId());
+		if(aimap.containsKey(ContantXk.SSQFZT))
+		{
+
+			ProBasicEquipmentPoint point=aimap.get(ContantXk.SSQFZT);
+			//按照分钟时间进行统计状态快照值
+			List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+			if(!pointls.isEmpty()) {
+				for (PointData po : pointls) {
+
+					if (po.getPointValueInDouble() >=3) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+							//实时欠发大于等于3的次数加1
+							bbhcs++;
+						}
+
+					}
+
+				}
+
+			}
+
+		}
+		//日不饱和次数
+		pewp.setRbbhcs(bbhcs);
+
+		//*******************************************日信息统计*********************************************************/
+
+		//*******************************************月信息统计*********************************************************/
+		if(pepidls.isEmpty())
+		{
+			pewp.setYbbhcs(pewp.getRbbhcs());
+
+		}else
+		{
+			ProEconWtAlysisDay pepid=pepidls.get(0);
+
+			pewp.setYbbhcs(StringUtils.round(pepid.getYbbhcs()+pewp.getRbbhcs(),2));
+
+		}
+		//*******************************************月信息统计*********************************************************/
+
+		//*******************************************年信息统计*********************************************************/
+		if(pepidls.isEmpty())
+		{
+			pewp.setNbbhcs(pewp.getRbbhcs());
+
+		}else
+		{
+
+
+			ProEconWtAlysisDay pepid=pepidls.get(0);
+			pewp.setNbbhcs(StringUtils.round(pepid.getNbbhcs()+pewp.getRbbhcs(),2));
+
+		}
+		//*******************************************年信息统计*********************************************************/
+	}
+
+}

+ 76 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo1Thread.java

@@ -0,0 +1,76 @@
+package com.gyee.alarm.task.thread;
+
+import com.gyee.alarm.model.auto.ProBasicEquipment;
+import com.gyee.alarm.model.auto.ProEconEquipmentInfoDay1;
+import com.gyee.alarm.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+
+public class EquipmentInfo1Thread implements Runnable {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	private Executor executor;
+
+	private ProBasicEquipment wt;
+	private   Map<String,ProEconEquipmentInfoDay1> pep1map;
+
+	private Date recordDate;
+	private Date end;
+
+	private Date begin;
+	private List<ProEconEquipmentInfoDay1> dayls;
+	private IEdosUtil edosUtil;
+
+	private CountDownLatch latch;
+
+	public EquipmentInfo1Thread(Executor executor, ProBasicEquipment wt, Map<String,ProEconEquipmentInfoDay1> pep1map,
+								Date recordDate, Date end, Date begin,List<ProEconEquipmentInfoDay1> dayls,
+								IEdosUtil edosUtil,
+                                CountDownLatch latch	) {
+		this.executor = executor;
+		this.wt = wt;
+		this.pep1map = pep1map;
+		this.recordDate = recordDate;
+		this.end = end;
+		this.begin = begin;
+		this.dayls = dayls;
+		this.edosUtil = edosUtil;
+		this.latch = latch;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " + wt.getId();
+		logger.info("设备1计算服务创建任务并提交到线程池中:" + wt.getId());
+		FutureTask<String> futureTask = new FutureTask<String>(new EquipmentInfo1ThreadPool(task,
+				 wt,  pep1map,
+				 recordDate,  end,  begin,dayls,
+				 edosUtil));
+
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get();
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		}finally {
+			latch.countDown();
+		}
+	}
+}

+ 934 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo1ThreadPool.java

@@ -0,0 +1,934 @@
+package com.gyee.alarm.task.thread;
+
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
+import com.gyee.common.model.StringUtils;
+import com.gyee.alarm.init.CacheContext;
+import com.gyee.alarm.model.auto.ProBasicEquipment;
+import com.gyee.alarm.model.auto.ProBasicEquipmentPoint;
+import com.gyee.alarm.model.auto.ProEconEquipmentInfoDay1;
+import com.gyee.alarm.model.vo.WpType;
+import com.gyee.alarm.util.DateUtils;
+import com.gyee.alarm.util.realtimesource.IEdosUtil;
+import com.gyee.alarm.util.statisticcs.Initial;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.util.*;
+import java.util.concurrent.Callable;
+
+public class EquipmentInfo1ThreadPool implements Callable<String>, Serializable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+
+	private static final long serialVersionUID = 0;
+
+	// 保存任务所需要的数据
+
+	private Object threadPoolTaskData;
+	private ProBasicEquipment wt;
+	private   Map<String,ProEconEquipmentInfoDay1> pep1map;
+
+	private Date recordDate;
+	private Date end;
+
+	private Date begin;
+	private List<ProEconEquipmentInfoDay1> dayls;
+	private IEdosUtil edosUtil;
+
+	public EquipmentInfo1ThreadPool(Object tasks, ProBasicEquipment wt, Map<String,ProEconEquipmentInfoDay1> pep1map,
+									Date recordDate, Date end, Date begin,List<ProEconEquipmentInfoDay1> dayls,
+									IEdosUtil edosUtil
+	) {
+
+		this.threadPoolTaskData = tasks;
+		this.wt = wt;
+		this.pep1map = pep1map;
+		this.recordDate = recordDate;
+		this.end = end;
+		this.begin = begin;
+		this.dayls = dayls;
+		this.edosUtil = edosUtil;
+	}
+
+	public synchronized String call() throws Exception {
+
+
+		// 处理一个任务,这里的处理方式太简单了,仅仅是一个打印语句
+
+		//System.out.println("开始执行任务:" + threadPoolTaskData);
+
+		String result = "";
+
+		// //便于观察,等待一段时间
+
+		try {
+
+			if(CacheContext.wtpAimap.containsKey(wt.getId()))
+			{
+				Map<String, ProBasicEquipmentPoint> pointmap=CacheContext.wtpAimap.get(wt.getId());
+
+				ProEconEquipmentInfoDay1 pewp=new ProEconEquipmentInfoDay1();
+				Initial.initial(pewp);
+				pewp.setCompanyId(wt.getCompanyId());
+				pewp.setWindpowerstationId(wt.getWindpowerstationId());
+				pewp.setLineId(wt.getLineId());
+				pewp.setProjectId(wt.getProjectId());
+				pewp.setRegionId(wt.getRegionId());
+				pewp.setRecordDate(DateUtils.truncate(recordDate));
+				pewp.setWindturbineId(wt.getId());
+				//昨日的统计结果
+				List<ProEconEquipmentInfoDay1> pep1ls =new ArrayList<>();
+
+				if(pep1map.containsKey(wt.getId()))
+				{
+					pep1ls.add(pep1map.get(wt.getId()));
+				}
+				extracted(recordDate, end, begin, pointmap, pewp,pep1ls);
+
+				dayls.add(pewp);
+				// proEconEquipmentInfoDay1Service.save(pewp);
+
+			}
+
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		threadPoolTaskData = null;
+
+		return result;
+
+	}
+
+	private void extracted(Date recordDate, Date end, Date begin,Map<String, ProBasicEquipmentPoint> pointmap, ProEconEquipmentInfoDay1 pewp,List<ProEconEquipmentInfoDay1> pepid1ls) throws Exception {
+
+
+		if(pewp.getWindpowerstationId().contains(WpType.FDC.id))
+		{
+			//*******************************************日信息统计*********************************************************/
+			if(pointmap.containsKey(ContantXk.RPJFS))
+			{
+				ProBasicEquipmentPoint point= pointmap.get(ContantXk.RPJFS);
+				List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+				if(!pointls.isEmpty())
+				{
+					DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
+					//日最大风速
+					pewp.setRzdfs(summaryStatistics.getMax());
+					//日最小风速
+					pewp.setRzxfs(summaryStatistics.getMin());
+					//日平均风速
+					pewp.setRpjfs(summaryStatistics.getAverage());
+				}
+
+			}
+		}else
+		{
+			//*******************************************日信息统计*********************************************************/
+			if(pointmap.containsKey(ContantXk.RPJGZD))
+			{
+				ProBasicEquipmentPoint point= pointmap.get(ContantXk.RPJGZD);
+				List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+				if(!pointls.isEmpty())
+				{
+					DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
+					//日最大风速
+					pewp.setRzdfs(summaryStatistics.getMax());
+					//日最小风速
+					pewp.setRzxfs(summaryStatistics.getMin());
+					//日平均风速
+					pewp.setRpjfs(summaryStatistics.getAverage());
+				}
+
+			}
+		}
+
+
+
+		if(pointmap.containsKey(ContantXk.RPJGL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RPJGL);
+			List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+			if(!pointls.isEmpty())
+			{
+				DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
+				//日最大功率
+				pewp.setRzdgl(summaryStatistics.getMax());
+				//日最小功率
+				pewp.setRzxgl(summaryStatistics.getMin());
+				//日平均功率
+				pewp.setRpjgl(summaryStatistics.getAverage());
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.RFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RFDL);
+
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日发电量
+				pewp.setRfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.RKYDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RKYDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日可用电量
+				pewp.setRkydl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.RLLFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RLLFDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日理论发电量
+				pewp.setRllfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.RGZSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RGZSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日故障损失电量
+				pewp.setRgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.RCNSLGZSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RCNSLGZSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日场内受累故障损失电量
+				pewp.setRcnslgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.RJXSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RJXSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日检修损失电量
+				pewp.setRjxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.RCNSLJXSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RCNSLJXSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日场内受累检修损失电量
+				pewp.setRcnsljxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.RDJSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RDJSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日待机损失电量
+				pewp.setRdjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.RQXJCLSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RQXJCLSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日缺陷降出力损失电量
+				pewp.setRqxjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.RSDTJSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RSDTJSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日手动停机损失电量
+				pewp.setRsdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.RXNSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RXNSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日性能损失电量
+				pewp.setRxnssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.RXDTJSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RXDTJSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日限电停机损失电量
+				pewp.setRxdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.RXDJCLSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RXDJCLSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日限电降出力损失电量
+				pewp.setRxdjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.RCWSLDWSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RCWSLDWSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日场外受累电网损失电量
+				pewp.setRcwsldwssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.RCWSLTQSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RCWSLTQSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日场外受累天气损失电量
+				pewp.setRcwsltqssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.RZFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RZFDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日增发电量
+				pewp.setRzfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.RQFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RQFDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日欠发电量
+				pewp.setRqfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.RZHD))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RZHD);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日自耗电
+				pewp.setRzhd(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+//*******************************************日信息统计*********************************************************/
+
+//*******************************************月信息统计*********************************************************/
+
+		if(pepid1ls.isEmpty())
+		{
+			setPowerandSpeedMonth(pewp);
+		}else
+		{
+
+
+
+			if(pointmap.containsKey(ContantXk.YPJFS))
+			{
+				ProBasicEquipmentPoint point= pointmap.get(ContantXk.YPJFS);
+				List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+				if(!pointls.isEmpty())
+				{
+					DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
+					//月最大风速
+					pewp.setYzdfs(summaryStatistics.getMax());
+					//月最小风速
+					pewp.setYzxfs(summaryStatistics.getMin());
+					//月平均风速
+					pewp.setYpjfs(summaryStatistics.getAverage());
+				}
+
+			}
+
+			if(pointmap.containsKey(ContantXk.YPJGL))
+			{
+				ProBasicEquipmentPoint point= pointmap.get(ContantXk.YPJGL);
+				List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+				if(!pointls.isEmpty())
+				{
+					DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
+					//月最大功率
+					pewp.setYzdgl(summaryStatistics.getMax());
+					//月最小功率
+					pewp.setYzxgl(summaryStatistics.getMin());
+					//月平均功率
+					pewp.setYpjgl(summaryStatistics.getAverage());
+				}
+			}
+
+		}
+
+
+
+		if(pointmap.containsKey(ContantXk.YFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YFDL);
+
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月发电量
+				pewp.setYfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.YKYDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YKYDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月可用电量
+				pewp.setYkydl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.YLLFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YLLFDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月理论发电量
+				pewp.setYllfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.YGZSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YGZSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月故障损失电量
+				pewp.setYgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.YCNSLGZSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YCNSLGZSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月场内受累故障损失电量
+				pewp.setYcnslgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.YJXSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YJXSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月检修损失电量
+				pewp.setYjxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.YCNSLJXSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YCNSLJXSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月场内受累检修损失电量
+				pewp.setYcnsljxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.YDJSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YDJSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月待机损失电量
+				pewp.setYdjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.YQXJCLSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YQXJCLSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月缺陷降出力损失电量
+				pewp.setYqxjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.YSDTJSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YSDTJSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月手动停机损失电量
+				pewp.setYsdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.YXNSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YXNSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月性能损失电量
+				pewp.setYxnssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.YXDTJSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YXDTJSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月限电停机损失电量
+				pewp.setYxdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.YXDJCLSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YXDJCLSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月限电降出力损失电量
+				pewp.setYxdjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.YCWSLDWSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YCWSLDWSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月场外受累电网损失电量
+				pewp.setYcwsldwssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.YCWSLTQSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YCWSLTQSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月场外受累天气损失电量
+				pewp.setYcwsltqssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.YZFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YZFDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月增发电量
+				pewp.setYzfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.YQFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YQFDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月欠发电量
+				pewp.setYqfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.YZHD))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YZHD);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月自耗电
+				pewp.setYzhd(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+//*******************************************月信息统计*********************************************************/
+
+//*******************************************年信息统计*********************************************************/
+		if(pepid1ls.isEmpty())
+		{
+			setPowerandSpeedYear(pewp);
+		}else
+		{
+
+			if(pointmap.containsKey(ContantXk.NPJFS))
+			{
+				ProBasicEquipmentPoint point= pointmap.get(ContantXk.NPJFS);
+				List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+				if(!pointls.isEmpty())
+				{
+					DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
+					//年最大风速
+					pewp.setNzdfs(summaryStatistics.getMax());
+					//年最小风速
+					pewp.setNzxfs(summaryStatistics.getMin());
+					//年平均风速
+					pewp.setNpjfs(summaryStatistics.getAverage());
+				}
+
+			}
+
+			if(pointmap.containsKey(ContantXk.NPJGL))
+			{
+				ProBasicEquipmentPoint point= pointmap.get(ContantXk.NPJFS);
+				List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+				if(!pointls.isEmpty())
+				{
+					DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
+					//年最大功率
+					pewp.setNzdgl(summaryStatistics.getMax());
+					//年最小功率
+					pewp.setNzxgl(summaryStatistics.getMin());
+					//年平均功率
+					pewp.setNpjgl(summaryStatistics.getAverage());
+				}
+			}
+
+		}
+
+		if(pointmap.containsKey(ContantXk.NFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NFDL);
+
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年发电量
+				pewp.setNfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.NKYDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NKYDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年可用电量
+				pewp.setNkydl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.NLLFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NLLFDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年理论发电量
+				pewp.setNllfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.NGZSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NGZSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年故障损失电量
+				pewp.setNgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.NCNSLGZSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NCNSLGZSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年场内受累故障损失电量
+				pewp.setNcnslgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.NJXSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NJXSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年检修损失电量
+				pewp.setNjxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.NCNSLJXSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NCNSLJXSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年场内受累检修损失电量
+				pewp.setNcnsljxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.NDJSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NDJSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年待机损失电量
+				pewp.setNdjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.NQXJCLSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NQXJCLSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年缺陷降出力损失电量
+				pewp.setNqxjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.NSDTJSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NSDTJSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年手动停机损失电量
+				pewp.setNsdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.NXNSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NXNSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年性能损失电量
+				pewp.setNxnssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.NXDTJSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NXDTJSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年限电停机损失电量
+				pewp.setNxdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.NXDJCLSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NXDJCLSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年限电降出力损失电量
+				pewp.setNxdjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.NCWSLDWSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NCWSLDWSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年场外受累电网损失电量
+				pewp.setNcwsldwssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.NCWSLTQSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NCWSLTQSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年场外受累天气损失电量
+				pewp.setNcwsltqssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.NZFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NZFDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年增发电量
+				pewp.setNzfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.NQFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NQFDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年欠发电量
+				pewp.setNqfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.NZHD))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NZHD);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年自耗电
+				pewp.setNzhd(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+	}
+
+	private void setPowerandSpeedYear(ProEconEquipmentInfoDay1 pewp) {
+		//年最大风速
+		pewp.setNzdfs(pewp.getRzdfs());
+		//年最小风速
+		pewp.setNzxfs(pewp.getRzxfs());
+		//年平均风速
+		pewp.setNpjfs(pewp.getRpjfs());
+
+		//年最大功率
+		pewp.setNzdgl(pewp.getRzdgl());
+		//年最小功率
+		pewp.setNzxgl(pewp.getRzxgl());
+		//年平均功率
+		pewp.setNpjgl(pewp.getRpjgl());
+
+	}
+
+	private void setPowerandSpeedMonth(ProEconEquipmentInfoDay1 pewp) {
+
+		//月最大风速
+		pewp.setYzdfs(pewp.getRzdfs());
+		//月最小风速
+		pewp.setYzxfs(pewp.getRzxfs());
+		//月平均风速
+		pewp.setYpjfs(pewp.getRpjfs());
+
+		//月最大功率
+		pewp.setYzdgl(pewp.getRzdgl());
+		//月最小功率
+		pewp.setYzxgl(pewp.getRzxgl());
+		//月平均功率
+		pewp.setYpjgl(pewp.getRpjgl());
+	}
+}

+ 76 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo2Thread.java

@@ -0,0 +1,76 @@
+package com.gyee.alarm.task.thread;
+
+import com.gyee.alarm.model.auto.ProBasicEquipment;
+import com.gyee.alarm.model.auto.ProEconEquipmentInfoDay2;
+import com.gyee.alarm.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+
+public class EquipmentInfo2Thread implements Runnable {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	private Executor executor;
+
+	private ProBasicEquipment wt;
+	private   Map<String,ProEconEquipmentInfoDay2> pep2map;
+
+	private Date recordDate;
+	private Date end;
+
+	private Date begin;
+	private List<ProEconEquipmentInfoDay2> dayls;
+	private IEdosUtil edosUtil;
+
+	private CountDownLatch latch;
+
+	public EquipmentInfo2Thread(Executor executor, ProBasicEquipment wt, Map<String,ProEconEquipmentInfoDay2> pep2map,
+                                Date recordDate, Date end, Date begin, List<ProEconEquipmentInfoDay2> dayls,
+                                IEdosUtil edosUtil,
+                                CountDownLatch latch	) {
+		this.executor = executor;
+		this.wt = wt;
+		this.pep2map = pep2map;
+		this.recordDate = recordDate;
+		this.end = end;
+		this.begin = begin;
+		this.dayls = dayls;
+		this.edosUtil = edosUtil;
+		this.latch = latch;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " + wt.getId();
+		logger.info("设备2计算服务创建任务并提交到线程池中:" + wt.getId());
+		FutureTask<String> futureTask = new FutureTask<String>(new EquipmentInfo2ThreadPool(task,
+				 wt,  pep2map,
+				 recordDate,  end,  begin,dayls,
+				 edosUtil));
+
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get();
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		}finally {
+			latch.countDown();
+		}
+	}
+}

+ 747 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo2ThreadPool.java

@@ -0,0 +1,747 @@
+package com.gyee.alarm.task.thread;
+
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
+import com.gyee.common.model.StringUtils;
+import com.gyee.alarm.init.CacheContext;
+import com.gyee.alarm.model.auto.ProBasicEquipment;
+import com.gyee.alarm.model.auto.ProBasicEquipmentPoint;
+import com.gyee.alarm.model.auto.ProEconEquipmentInfoDay2;
+import com.gyee.alarm.util.DateUtils;
+import com.gyee.alarm.util.realtimesource.IEdosUtil;
+import com.gyee.alarm.util.statisticcs.Initial;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+public class EquipmentInfo2ThreadPool implements Callable<String>, Serializable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+
+	private static final long serialVersionUID = 0;
+
+	// 保存任务所需要的数据
+
+	private Object threadPoolTaskData;
+	private ProBasicEquipment wt;
+	private   Map<String,ProEconEquipmentInfoDay2> pep2map;
+
+	private Date recordDate;
+	private Date end;
+
+	private Date begin;
+	private List<ProEconEquipmentInfoDay2> dayls;
+	private IEdosUtil edosUtil;
+
+	public EquipmentInfo2ThreadPool(Object tasks, ProBasicEquipment wt, Map<String,ProEconEquipmentInfoDay2> pep2map,
+                                    Date recordDate, Date end, Date begin, List<ProEconEquipmentInfoDay2> dayls,
+                                    IEdosUtil edosUtil
+	) {
+
+		this.threadPoolTaskData = tasks;
+		this.wt = wt;
+		this.pep2map = pep2map;
+		this.recordDate = recordDate;
+		this.end = end;
+		this.begin = begin;
+		this.dayls = dayls;
+		this.edosUtil = edosUtil;
+	}
+
+	public synchronized String call() throws Exception {
+
+
+		// 处理一个任务,这里的处理方式太简单了,仅仅是一个打印语句
+
+		//System.out.println("开始执行任务:" + threadPoolTaskData);
+
+		String result = "";
+
+		// //便于观察,等待一段时间
+
+		try {
+			if(CacheContext.wtpAimap.containsKey(wt.getId()))
+			{
+
+				ProEconEquipmentInfoDay2 pewp=new ProEconEquipmentInfoDay2();
+				Initial.initial(pewp);
+				pewp.setCompanyId(wt.getCompanyId());
+				pewp.setWindpowerstationId(wt.getWindpowerstationId());
+				pewp.setLineId(wt.getLineId());
+				pewp.setProjectId(wt.getProjectId());
+				pewp.setRegionId(wt.getRegionId());
+				pewp.setRecordDate(DateUtils.truncate(recordDate));
+				pewp.setWindturbineId(wt.getId());
+				//昨日的统计结果
+				List<ProEconEquipmentInfoDay2> pepidls =new ArrayList<>();
+//                Calendar cl=Calendar.getInstance();
+//                cl.setTime(recordDate);
+//                cl.add(Calendar.DAY_OF_MONTH,-1);
+//                if(cl.get(Calendar.DAY_OF_MONTH)!=1)
+//                {
+//                    QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper2 = new QueryWrapper<>();
+//                    queryWrapper2.eq("record_date",cl.getTime())
+//                            .eq("windturbine_Id",wt.getId());
+//                    pepidls = proEconEquipmentInfoDay2Service.list(queryWrapper2);
+////                            .stream()
+////                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+////                                    && i.getWindturbineId().equals(wt.getId())
+////                            )
+////                            .collect(Collectors.toList());
+//                }
+
+				if(pep2map.containsKey(wt.getId()))
+				{
+					pepidls.add(pep2map.get(wt.getId()));
+				}
+				calDetiall( pewp, end, begin, wt,pepidls);
+				calSimple( pewp, end, begin, wt,pepidls);
+				dayls.add(pewp);
+				// proEconEquipmentInfoDay2Service.save(pewp);
+
+			}
+
+
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		threadPoolTaskData = null;
+
+		return result;
+
+	}
+
+	private void calDetiall(ProEconEquipmentInfoDay2 pewp, Date end, Date begin, ProBasicEquipment wt, List<ProEconEquipmentInfoDay2> pepidls) throws Exception {
+		//        //                0	待机
+//                1	手动停机
+//                2	正常发电
+//                3	发电降出力
+//                4	故障
+//                5	故障受累
+//                6	检修
+//                7	检修受累
+//                8	限电降出力
+//                9	限电停机
+//                10	电网受累
+//                11	环境受累
+//                12	通讯中断
+//                13	设备离线
+
+		double lastState;//上一分钟状态
+
+		double djsc=0;//待机时长
+		double sdtjsc=0;//手动停机时长
+		double zcfdsc=0;//正常发电时长
+		double fdjclsc=0;//发电降出力时长
+		double gzsc=0;//故障时长
+		double gzslsc=0;//故障受累时长
+		double jxsc=0;//检修时长
+		double jxslsc=0;//检修受累时长
+		double xdjclsc=0;//限电降出力时长
+		double xdtjsc=0;//限电停机时长
+		double dwslsc=0;//电网受累时长
+		double hjslsc=0;//环境受累时长
+		double txzdsc=0;//通讯中断时长
+		double sblxsc=0;//设备离线时长
+
+		Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
+
+
+		lastState=-1;//上一分钟状态
+		Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getId());
+
+		if(aimap.containsKey(ContantXk.MXZT))
+		{
+
+			ProBasicEquipmentPoint point=aimap.get(ContantXk.MXZT);
+			//按照分钟时间进行统计状态快照值
+			List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+			if(!pointls.isEmpty())
+			{
+				for(PointData po :pointls)
+				{
+
+					if(po.getPointValueInDouble()==0)
+					{
+
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+						//待机时长加1分钟
+						djsc++;
+					}else  if(po.getPointValueInDouble()==1)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//手动停机时长加1分钟
+						sdtjsc++;
+					}else  if(po.getPointValueInDouble()==2)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+						//正常发电时长加1分钟
+						zcfdsc++;
+					}else  if(po.getPointValueInDouble()==3)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//发电降出力时长加1分钟
+						fdjclsc++;
+					}else  if(po.getPointValueInDouble()==4)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//故障时长加1分钟
+						gzsc++;
+					}else  if(po.getPointValueInDouble()==5)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//故障受累时长加1分钟
+						gzslsc++;
+					}else  if(po.getPointValueInDouble()==6)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//检修时长加1分钟
+						jxsc++;
+					}else  if(po.getPointValueInDouble()==7)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//检修受累时长加1分钟
+						jxslsc++;
+					}else  if(po.getPointValueInDouble()==8)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//限电降出力时长加1分钟
+						xdjclsc++;
+					}else  if(po.getPointValueInDouble()==9)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//限电停机时长加1分钟
+						xdtjsc++;
+					}else  if(po.getPointValueInDouble()==10)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//电网受累时长加1分钟
+						dwslsc++;
+					}else  if(po.getPointValueInDouble()==11)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+						//环境受累时长加1分钟
+						hjslsc++;
+					}else  if(po.getPointValueInDouble()==12)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+						//通讯中断时长加1分钟
+						txzdsc++;
+					}else  if(po.getPointValueInDouble()==13)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//设备离线时长加1分钟
+						sblxsc++;
+					}
+
+				}
+
+
+
+			}
+
+		}
+
+		//日合计故障小时(明细)
+		pewp.setRgzxsmx(new BigDecimal(gzsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计场内受累故障小时(明细)
+		pewp.setRcnslgzxsmx(new BigDecimal(gzslsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计检修小时(明细)
+		pewp.setRjxxsmx(new BigDecimal(jxsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计场内受累检修小时(明细)
+		pewp.setRcnsljxxsmx(new BigDecimal(jxslsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计待机小时(明细)
+		pewp.setRdjxsmx(new BigDecimal(djsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计缺陷降出力小时(明细)
+		pewp.setRqxjclxsmx(new BigDecimal(fdjclsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计手动停机小时(明细)
+		pewp.setRsdtjxsmx(new BigDecimal(sdtjsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计性能小时(明细)
+		pewp.setRbwxsmx(new BigDecimal(zcfdsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计限电停机小时(明细)
+		pewp.setRxdtjxsmx(new BigDecimal(xdtjsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计限电降出力小时(明细)
+		pewp.setRxdjclxsmx(new BigDecimal(xdjclsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计场外受累电网小时(明细)
+		pewp.setRcwsldwxsmx(new BigDecimal(dwslsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计场外受累电网小时(明细)
+		pewp.setRcwsltqxsmx(new BigDecimal(hjslsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计通讯中断小时(明细)
+		pewp.setRtxzdxsmx(new BigDecimal(txzdsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计离线小时(明细)
+		pewp.setRlxxsmx(new BigDecimal(sblxsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+
+
+
+//*******************************************日信息统计*********************************************************/
+
+//*******************************************月信息统计*********************************************************/
+
+		if(pepidls.isEmpty())
+		{
+			setLossHoursMonth(pewp);
+
+		}else
+		{
+
+
+			ProEconEquipmentInfoDay2 pepid=pepidls.get(0);
+
+			//月合计故障小时(明细)
+			pewp.setYgzxsmx(StringUtils.round(pepid.getYgzxsmx()+pewp.getRgzxsmx(),2));
+			//月合计场内受累故障小时(明细)
+			pewp.setYcnslgzxsmx(StringUtils.round(pepid.getYcnslgzxsmx()+pewp.getRcnslgzxsmx(),2));
+			//月合计检修小时(明细)
+			pewp.setYjxxsmx(StringUtils.round(pepid.getYjxxsmx()+pewp.getRjxxsmx(),2));
+			//月合计场内受累检修小时(明细)
+			pewp.setYcnsljxxsmx(StringUtils.round( pepid.getYcnsljxxsmx()+pewp.getRcnsljxxsmx(),2));
+			//月合计待机小时(明细)
+			pewp.setYdjxsmx(StringUtils.round(pepid.getYdjxsmx()+pewp.getRdjxsmx(),2));
+			//月合计缺陷降出力小时(明细)
+			pewp.setYqxjclxsmx(StringUtils.round(pepid.getYqxjclxsmx()+pewp.getRqxjclxsmx(),2));
+			//月合计手动停机小时(明细)
+			pewp.setYsdtjxsmx(StringUtils.round(pepid.getYsdtjxsmx()+pewp.getRsdtjxsmx(),2));
+			//月合计性能小时(明细)
+			pewp.setYbwxsmx(StringUtils.round(pepid.getYbwxsmx()+pewp.getRbwxsmx(),2));
+			//月合计限电停机小时(明细)
+			pewp.setYxdtjxsmx(StringUtils.round(pepid.getYxdtjxsmx()+pewp.getRxdtjxsmx(),2));
+			//月合计限电降出力小时(明细)
+			pewp.setYxdjclxsmx(StringUtils.round(pepid.getYxdjclxsmx()+pewp.getRxdjclxsmx(),2));
+			//月合计场外受累电网小时(明细)
+			pewp.setYcwsldwxsmx(StringUtils.round(pepid.getYcwsldwxsmx()+pewp.getRcwsldwxsmx(),2));
+			//月合计场外受累电网小时(明细)
+			pewp.setYcwsltqxsmx(StringUtils.round(pepid.getYcwsltqxsmx()+pewp.getRcwsltqxsmx(),2));
+			//月合计通讯中断小时(明细)
+			pewp.setYtxzdxsmx(StringUtils.round(pepid.getYtxzdxsmx()+pewp.getRtxzdxsmx(),2));
+			//月合计离线小时(明细)
+			pewp.setYlxxsmx(StringUtils.round(pepid.getYlxxsmx()+pewp.getRlxxsmx(),2));
+
+		}
+
+
+
+//*******************************************月信息统计*********************************************************/
+
+//*******************************************年信息统计*********************************************************/
+		if(pepidls.isEmpty())
+		{
+			setLossHoursYear(pewp);
+		}else
+		{
+
+			ProEconEquipmentInfoDay2 pepid=pepidls.get(0);
+
+			//年合计故障小时(明细)
+			pewp.setNgzxsmx(StringUtils.round(pepid.getNgzxsmx()+pewp.getRgzxsmx(),2));
+			//年合计场内受累故障小时(明细)
+			pewp.setNcnslgzxsmx(StringUtils.round(pepid.getNcnslgzxsmx()+pewp.getRcnslgzxsmx(),2));
+			//年合计检修小时(明细)
+			pewp.setNjxxsmx(StringUtils.round(pepid.getNjxxsmx()+pewp.getRjxxsmx(),2));
+			//年合计场内受累检修小时(明细)
+			pewp.setNcnsljxxsmx(StringUtils.round( pepid.getNcnsljxxsmx()+pewp.getRcnsljxxsmx(),2));
+			//年合计待机小时(明细)
+			pewp.setNdjxsmx(StringUtils.round(pepid.getNdjxsmx()+pewp.getRdjxsmx(),2));
+			//年合计缺陷降出力小时(明细)
+			pewp.setNqxjclxsmx(StringUtils.round(pepid.getNqxjclxsmx()+pewp.getRqxjclxsmx(),2));
+			//年合计手动停机小时(明细)
+			pewp.setNsdtjxsmx(StringUtils.round(pepid.getNsdtjxsmx()+pewp.getRsdtjxsmx(),2));
+			//年合计性能小时(明细)
+			pewp.setNbwxsmx(StringUtils.round(pepid.getNbwxsmx()+pewp.getRbwxsmx(),2));
+			//年合计限电停机小时(明细)
+			pewp.setNxdtjxsmx(StringUtils.round(pepid.getNxdtjxsmx()+pewp.getRxdtjxsmx(),2));
+			//年合计限电降出力小时(明细)
+			pewp.setNxdjclxsmx(StringUtils.round(pepid.getNxdjclxsmx()+pewp.getRxdjclxsmx(),2));
+			//年合计场外受累电网小时(明细)
+			pewp.setNcwsldwxsmx(StringUtils.round(pepid.getNcwsldwxsmx()+pewp.getRcwsldwxsmx(),2));
+			//年合计场外受累电网小时(明细)
+			pewp.setNcwsltqxsmx(StringUtils.round(pepid.getNcwsltqxsmx()+pewp.getRcwsltqxsmx(),2));
+			//年合计通讯中断小时(明细)
+			pewp.setNtxzdxsmx(StringUtils.round(pepid.getNtxzdxsmx()+pewp.getRtxzdxsmx(),2));
+			//年合计离线小时(明细)
+			pewp.setNlxxsmx(StringUtils.round(pepid.getNlxxsmx()+pewp.getRlxxsmx(),2));
+
+		}
+
+
+	}
+
+	private static void setLossHoursYear(ProEconEquipmentInfoDay2 pewp) {
+		//年合计故障小时(明细)
+		pewp.setNgzxsmx(pewp.getRgzxsmx());
+		//年合计场内受累故障小时(明细)
+		pewp.setNcnslgzxsmx(pewp.getRcnslgzxsmx());
+		//年合计检修小时(明细)
+		pewp.setNjxxsmx(pewp.getRjxxsmx());
+		//年合计场内受累检修小时(明细)
+		pewp.setNcnsljxxsmx(pewp.getRcnsljxxsmx());
+		//年合计待机小时(明细)
+		pewp.setNdjxsmx(pewp.getRdjxsmx());
+		//年合计缺陷降出力小时(明细)
+		pewp.setNqxjclxsmx(pewp.getRqxjclxsmx());
+		//年合计手动停机小时(明细)
+		pewp.setNsdtjxsmx(pewp.getRsdtjxsmx());
+		//年合计性能小时(明细)
+		pewp.setNbwxsmx(pewp.getRbwxsmx());
+		//年合计限电停机小时(明细)
+		pewp.setNxdtjxsmx(pewp.getRxdtjxsmx());
+		//年合计限电降出力小时(明细)
+		pewp.setNxdjclxsmx(pewp.getRxdjclxsmx());
+		//年合计场外受累电网小时(明细)
+		pewp.setNcwsldwxsmx(pewp.getRcwsldwxsmx());
+		//年合计场外受累电网小时(明细)
+		pewp.setNcwsltqxsmx(pewp.getRcwsltqxsmx());
+		//年合计通讯中断小时(明细)
+		pewp.setNtxzdxsmx(pewp.getRtxzdxsmx());
+		//年合计离线小时(明细)
+		pewp.setNlxxsmx(pewp.getRlxxsmx());
+	}
+
+	private static void setLossHoursMonth(ProEconEquipmentInfoDay2 pewp) {
+		//月合计故障小时(明细)
+		pewp.setYgzxsmx(pewp.getRgzxsmx());
+		//月合计场内受累故障小时(明细)
+		pewp.setYcnslgzxsmx(pewp.getRcnslgzxsmx());
+		//月合计检修小时(明细)
+		pewp.setYjxxsmx(pewp.getRjxxsmx());
+		//月合计场内受累检修小时(明细)
+		pewp.setYcnsljxxsmx(pewp.getRcnsljxxsmx());
+		//月合计待机小时(明细)
+		pewp.setYdjxsmx(pewp.getRdjxsmx());
+		//月合计缺陷降出力小时(明细)
+		pewp.setYqxjclxsmx(pewp.getRqxjclxsmx());
+		//月合计手动停机小时(明细)
+		pewp.setYsdtjxsmx(pewp.getRsdtjxsmx());
+		//月合计性能小时(明细)
+		pewp.setYbwxsmx(pewp.getRbwxsmx());
+		//月合计限电停机小时(明细)
+		pewp.setYxdtjxsmx(pewp.getRxdtjxsmx());
+		//月合计限电降出力小时(明细)
+		pewp.setYxdjclxsmx(pewp.getRxdjclxsmx());
+		//月合计场外受累电网小时(明细)
+		pewp.setYcwsldwxsmx(pewp.getRcwsldwxsmx());
+		//月合计场外受累电网小时(明细)
+		pewp.setYcwsltqxsmx(pewp.getRcwsltqxsmx());
+		//月合计通讯中断小时(明细)
+		pewp.setYtxzdxsmx(pewp.getRtxzdxsmx());
+		//月合计离线小时(明细)
+		pewp.setYlxxsmx(pewp.getRlxxsmx());
+	}
+
+
+	private static void setLossHoursMonthSimple(ProEconEquipmentInfoDay2 pewp) {
+		//月合计待机小时
+		pewp.setYdjxs(pewp.getRdjxs());
+		//月合计维护停机小时
+		pewp.setYjxtjxs(pewp.getRjxtjxs());
+		// 月合计故障停机小时
+		pewp.setYgztjxs(pewp.getRgztjxs());
+		//月合计运行小时
+		pewp.setYyxxs(pewp.getRyxxs());
+		//月合计限电小时
+		pewp.setYxdxs(pewp.getRxdxs());
+		//月合计通讯中断小时
+		pewp.setYtxzdxs(pewp.getRtxzdxs());
+		//月合计受累小时
+		pewp.setYslxs(pewp.getRslxs());
+	}
+
+	private static void setLossHoursYearSimple(ProEconEquipmentInfoDay2 pewp) {
+		//年合计待机小时
+		pewp.setNdjxs(pewp.getRdjxs());
+		//年合计维护停机小时
+		pewp.setNjxtjxs(pewp.getRjxtjxs());
+		// 年合计故障小时
+		pewp.setNgztjxs(pewp.getRgztjxs());
+		//年合计运行小时
+		pewp.setNyxxs(pewp.getRyxxs());
+		//年合计限电小时
+		pewp.setNxdxs(pewp.getRxdxs());
+		//年合计通讯中断小时
+		pewp.setNtxzdxs(pewp.getRtxzdxs());
+		//年合计受累小时
+		pewp.setNslxs(pewp.getRslxs());
+	}
+
+	private void calSimple(ProEconEquipmentInfoDay2 pewp, Date end, Date begin, ProBasicEquipment wt, List<ProEconEquipmentInfoDay2> pepidls) throws Exception {
+//        0	待机
+//        1	运行
+//        2	故障
+//        3	检修
+//        4	限电
+//        5	受累
+//        6	离线
+//*******************************************日信息统计*********************************************************/
+
+		double lastState=-1;//上一分钟状态
+
+
+		double djsc=0;//待机时长
+		double zcfdsc=0;//正常发电时长
+		double gzsc=0;//故障时长
+		double jxsc=0;//检修时长
+		double xdtjsc=0;//限电停机时长
+		double slsc=0;//受累时长
+		double txzdsc=0;//通讯中断时长
+
+
+
+		Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
+
+
+		Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getId());
+		if(aimap.containsKey(ContantXk.SBZT))
+		{
+
+			ProBasicEquipmentPoint point=aimap.get(ContantXk.SBZT);
+			//按照分钟时间进行统计状态快照值
+			List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+			if(!pointls.isEmpty()) {
+				for (PointData po : pointls) {
+
+					if (po.getPointValueInDouble() == 0) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+
+						}
+						//待机时长加1分钟
+						djsc++;
+					} else if (po.getPointValueInDouble() == 1) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+
+						}
+						//正常发电时长加1分钟
+						zcfdsc++;
+					} else if (po.getPointValueInDouble() == 2) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+
+						}
+						//故障时长加1分钟
+						gzsc++;
+					} else if (po.getPointValueInDouble() == 3) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+
+						}
+
+						//检修时长加1分钟
+						jxsc++;
+
+					} else if (po.getPointValueInDouble() == 4) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+
+						}
+
+						//限电停机时长加1分钟
+						xdtjsc++;
+					} else if (po.getPointValueInDouble() == 5) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+
+						}
+
+						//受累时长加1分钟
+						slsc++;
+
+					} else if (po.getPointValueInDouble() == 6) {
+						if (lastState != po.getPointValueInDouble()) {
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+
+						}
+						//通讯中断时长加1分钟
+						txzdsc++;
+					}
+
+				}
+
+			}
+
+
+
+		}
+
+
+
+		//日合计待机小时
+		pewp.setRdjxs(new BigDecimal(gzsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计维护停机小时
+		pewp.setRjxtjxs(new BigDecimal(jxsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		// 日合计待机小时
+		pewp.setRdjxs(new BigDecimal(djsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计运行小时
+		pewp.setRyxxs(new BigDecimal(zcfdsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计限电小时
+		pewp.setRxdxs(new BigDecimal(xdtjsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计通讯中断小时
+		pewp.setRtxzdxs(new BigDecimal(txzdsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计受累小时
+		pewp.setRslxs(new BigDecimal(slsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+
+
+		//*******************************************日信息统计*********************************************************/
+
+		//*******************************************月信息统计*********************************************************/
+		if(pepidls.isEmpty())
+		{
+			setLossHoursMonthSimple(pewp);
+
+		}else
+		{
+
+			ProEconEquipmentInfoDay2 pepid=pepidls.get(0);
+
+			//月合计待机小时
+			pewp.setYdjxs(StringUtils.round(pepid.getYdjxs()+pewp.getRdjxs(),2));
+			//月合计维护停机小时
+			pewp.setYjxtjxs(StringUtils.round(pepid.getYjxtjxs()+pewp.getRjxtjxs(),2));
+			// 月合计故障小时
+			pewp.setYgztjxs(StringUtils.round(pepid.getYgztjxs()+pewp.getRgztjxs(),2));
+			//月合计运行小时
+			pewp.setYyxxs(StringUtils.round(pepid.getYyxxs()+pewp.getRyxxs(),2));
+			//月合计限电小时
+			pewp.setYxdxs(StringUtils.round(pepid.getYxdxs()+pewp.getRxdxs(),2));
+			//月合计通讯中断小时
+			pewp.setYtxzdxs(StringUtils.round(pepid.getYtxzdxs()+pewp.getRtxzdxs(),2));
+			//月合计受累小时
+			pewp.setYslxs(StringUtils.round(pepid.getYslxs()+pewp.getRslxs(),2));
+
+		}
+		//*******************************************月信息统计*********************************************************/
+
+		//*******************************************年信息统计*********************************************************/
+		if(pepidls.isEmpty())
+		{
+			setLossHoursYearSimple(pewp);
+
+		}else
+		{
+			ProEconEquipmentInfoDay2 pepid=pepidls.get(0);
+
+			//年合计待机小时
+			pewp.setNdjxs(StringUtils.round(pepid.getNdjxs()+pewp.getRdjxs(),2));
+			//年合计维护停机小时
+			pewp.setNjxtjxs(StringUtils.round(pepid.getNjxtjxs()+pewp.getRjxtjxs(),2));
+			// 年合计故障小时
+			pewp.setNgztjxs(StringUtils.round(pepid.getNgztjxs()+pewp.getRgztjxs(),2));
+			//年合计运行小时
+			pewp.setNyxxs(StringUtils.round(pepid.getNyxxs()+pewp.getRyxxs(),2));
+			//年合计限电小时
+			pewp.setNxdxs(StringUtils.round(pepid.getNxdxs()+pewp.getRxdxs(),2));
+			//年合计通讯中断小时
+			pewp.setNtxzdxs(StringUtils.round(pepid.getNtxzdxs()+pewp.getRtxzdxs(),2));
+			//年合计受累小时
+			pewp.setNslxs(StringUtils.round(pepid.getNslxs()+pewp.getRslxs(),2));
+
+		}
+		//*******************************************年信息统计*********************************************************/
+	}
+}

+ 76 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo3Thread.java

@@ -0,0 +1,76 @@
+package com.gyee.alarm.task.thread;
+
+import com.gyee.alarm.model.auto.ProBasicEquipment;
+import com.gyee.alarm.model.auto.ProEconEquipmentInfoDay3;
+import com.gyee.alarm.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+
+public class EquipmentInfo3Thread implements Runnable {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	private Executor executor;
+
+	private ProBasicEquipment wt;
+	private   Map<String, ProEconEquipmentInfoDay3> pep3map;
+
+	private Date recordDate;
+	private Date end;
+
+	private Date begin;
+	private List<ProEconEquipmentInfoDay3> dayls;
+	private IEdosUtil edosUtil;
+
+	private CountDownLatch latch;
+
+	public EquipmentInfo3Thread(Executor executor, ProBasicEquipment wt, Map<String,ProEconEquipmentInfoDay3> pep3map,
+                                Date recordDate, Date end, Date begin, List<ProEconEquipmentInfoDay3> dayls,
+                                IEdosUtil edosUtil,
+                                CountDownLatch latch	) {
+		this.executor = executor;
+		this.wt = wt;
+		this.pep3map = pep3map;
+		this.recordDate = recordDate;
+		this.end = end;
+		this.begin = begin;
+		this.dayls = dayls;
+		this.edosUtil = edosUtil;
+		this.latch = latch;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " + wt.getId();
+		logger.info("设备3计算服务创建任务并提交到线程池中:" + wt.getId());
+		FutureTask<String> futureTask = new FutureTask<String>(new EquipmentInfo3ThreadPool(task,
+				 wt,  pep3map,
+				 recordDate,  end,  begin,dayls,
+				 edosUtil));
+
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get();
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		}finally {
+			latch.countDown();
+		}
+	}
+}

+ 745 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo3ThreadPool.java

@@ -0,0 +1,745 @@
+package com.gyee.alarm.task.thread;
+
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
+import com.gyee.common.model.StringUtils;
+import com.gyee.alarm.init.CacheContext;
+import com.gyee.alarm.model.auto.ProBasicEquipment;
+import com.gyee.alarm.model.auto.ProBasicEquipmentPoint;
+import com.gyee.alarm.model.auto.ProEconEquipmentInfoDay3;
+import com.gyee.alarm.util.DateUtils;
+import com.gyee.alarm.util.realtimesource.IEdosUtil;
+import com.gyee.alarm.util.statisticcs.Initial;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+public class EquipmentInfo3ThreadPool implements Callable<String>, Serializable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+
+	private static final long serialVersionUID = 0;
+
+	// 保存任务所需要的数据
+
+	private Object threadPoolTaskData;
+	private ProBasicEquipment wt;
+	private   Map<String,ProEconEquipmentInfoDay3> pep3map;
+
+	private Date recordDate;
+	private Date end;
+
+	private Date begin;
+	private List<ProEconEquipmentInfoDay3> dayls;
+	private IEdosUtil edosUtil;
+
+	public EquipmentInfo3ThreadPool(Object tasks, ProBasicEquipment wt, Map<String, ProEconEquipmentInfoDay3> pep3map,
+                                    Date recordDate, Date end, Date begin, List<ProEconEquipmentInfoDay3> dayls,
+                                    IEdosUtil edosUtil
+	) {
+
+		this.threadPoolTaskData = tasks;
+		this.wt = wt;
+		this.pep3map = pep3map;
+		this.recordDate = recordDate;
+		this.end = end;
+		this.begin = begin;
+		this.dayls = dayls;
+		this.edosUtil = edosUtil;
+	}
+
+	public synchronized String call() throws Exception {
+
+
+		// 处理一个任务,这里的处理方式太简单了,仅仅是一个打印语句
+
+		//System.out.println("开始执行任务:" + threadPoolTaskData);
+
+		String result = "";
+
+		// //便于观察,等待一段时间
+
+		try {
+			if(CacheContext.wtpAimap.containsKey(wt.getId()))
+			{
+
+
+				ProEconEquipmentInfoDay3 pewp=new ProEconEquipmentInfoDay3();
+				Initial.initial(pewp);
+				pewp.setCompanyId(wt.getCompanyId());
+				pewp.setWindpowerstationId(wt.getWindpowerstationId());
+				pewp.setLineId(wt.getLineId());
+				pewp.setProjectId(wt.getProjectId());
+				pewp.setRegionId(wt.getRegionId());
+				pewp.setRecordDate(DateUtils.truncate(recordDate));
+				pewp.setWindturbineId(wt.getId());
+				//昨日的统计结果
+				List<ProEconEquipmentInfoDay3> pepidls =new ArrayList<>();
+//                Calendar cl=Calendar.getInstance();
+//                cl.setTime(recordDate);
+//                cl.add(Calendar.DAY_OF_MONTH,-1);
+//                if(cl.get(Calendar.DAY_OF_MONTH)!=1)
+//
+//                {
+//                    QueryWrapper<ProEconEquipmentInfoDay3> queryWrapper2 = new QueryWrapper<>();
+//                    queryWrapper2.eq("record_date",cl.getTime())
+//                            .eq("windturbine_Id",wt.getId());
+//                    pepidls = proEconEquipmentInfoDay3Service.list(queryWrapper2);
+////                            .stream()
+////                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+////                                    && i.getWindturbineId().equals(wt.getId())
+////                                  )
+////                            .collect(Collectors.toList());
+//                }
+
+				if(pep3map.containsKey(wt.getId()))
+				{
+					pepidls.add(pep3map.get(wt.getId()));
+				}
+				calDetiall( pewp, end, begin,wt,pepidls);
+				calSimple( pewp, end, begin, wt,pepidls);
+				dayls.add(pewp);
+				// proEconEquipmentInfoDay3Service.save(pewp);
+
+
+			}
+
+
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		threadPoolTaskData = null;
+
+		return result;
+
+	}
+
+	private void calDetiall(ProEconEquipmentInfoDay3 pewp, Date end, Date begin, ProBasicEquipment wt, List<ProEconEquipmentInfoDay3> pepidls) throws Exception {
+		//        //                0	待机
+//                1	手动停机
+//                2	正常发电
+//                3	发电降出力
+//                4	故障
+//                5	故障受累
+//                6	检修
+//                7	检修受累
+//                8	限电降出力
+//                9	限电停机
+//                10	电网受累
+//                11	环境受累
+//                12	通讯中断
+//                13	设备离线
+
+		double lastState;//上一分钟状态
+
+		double djcs=0;//待机时长
+		double sdtjcs=0;//手动停机时长
+		double zcfdcs=0;//正常发电时长
+		double fdjclcs=0;//发电降出力时长
+		double gzcs=0;//故障时长
+		double gzslcs=0;//故障受累时长
+		double jxcs=0;//检修时长
+		double jxslcs=0;//检修受累时长
+		double xdjclcs=0;//限电降出力时长
+		double xdtjcs=0;//限电停机时长
+		double dwslcs=0;//电网受累时长
+		double hjslcs=0;//环境受累时长
+		double txzdcs=0;//通讯中断时长
+		double sblxcs=0;//设备离线时长
+
+		Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
+
+
+
+		lastState=-1;//上一分钟状态
+		Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getId());
+		if(aimap.containsKey(ContantXk.MXZT))
+		{
+
+			ProBasicEquipmentPoint point=aimap.get(ContantXk.MXZT);
+			//按照分钟时间进行统计状态快照值
+			List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+			if(!pointls.isEmpty())
+			{
+				for(PointData po :pointls)
+				{
+
+					if(po.getPointValueInDouble()==0)
+					{
+
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//待机时长加1
+							djcs++;
+						}
+
+					}else  if(po.getPointValueInDouble()==1)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//手动停机时长加1
+							sdtjcs++;
+						}
+
+
+					}else  if(po.getPointValueInDouble()==2)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//正常发电时长加1
+							zcfdcs++;
+						}
+
+					}else  if(po.getPointValueInDouble()==3)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//发电降出力时长加1
+							fdjclcs++;
+						}
+
+
+					}else  if(po.getPointValueInDouble()==4)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//故障时长加1
+							gzcs++;
+						}
+
+
+					}else  if(po.getPointValueInDouble()==5)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//故障受累时长加1
+							gzslcs++;
+						}
+
+
+					}else  if(po.getPointValueInDouble()==6)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//检修时长加1
+							jxcs++;
+						}
+
+
+					}else  if(po.getPointValueInDouble()==7)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//检修受累时长加1
+							jxslcs++;
+						}
+
+
+					}else  if(po.getPointValueInDouble()==8)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//限电降出力时长加1
+							xdjclcs++;
+						}
+
+
+					}else  if(po.getPointValueInDouble()==9)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//限电停机时长加1
+							xdtjcs++;
+						}
+
+						//限电停机时长加1
+						xdtjcs++;
+					}else  if(po.getPointValueInDouble()==10)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//电网受累时长加1
+							dwslcs++;
+						}
+
+
+					}else  if(po.getPointValueInDouble()==11)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//环境受累时长加1
+							hjslcs++;
+						}
+
+					}else  if(po.getPointValueInDouble()==12)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//通讯中断时长加1
+							txzdcs++;
+						}
+
+					}else  if(po.getPointValueInDouble()==13)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//设备离线时长加1
+							sblxcs++;
+						}
+
+
+					}
+
+				}
+
+			}
+
+		}
+
+
+		//日合计故障次数(明细)
+		pewp.setRgzcsmx(gzcs);
+		//日合计场内受累故障次数(明细)
+		pewp.setRcnslgzcsmx(gzslcs);
+		//日合计检修次数(明细)
+		pewp.setRjxcsmx(jxcs);
+		//日合计场内受累检修次数(明细)
+		pewp.setRcnsljxcsmx(jxslcs);
+		//日合计待机次数(明细)
+		pewp.setRdjcsmx(djcs);
+		//日合计缺陷降出力次数(明细)
+		pewp.setRqxjclcsmx(fdjclcs);
+		//日合计手动停机次数(明细)
+		pewp.setRsdtjcsmx(sdtjcs);
+		//日合计性能次数(明细)
+		pewp.setRbwcsmx(zcfdcs);
+		//日合计限电停机次数(明细)
+		pewp.setRxdtjcsmx(xdtjcs);
+		//日合计限电降出力次数(明细)
+		pewp.setRxdjclcsmx(xdjclcs);
+		//日合计场外受累电网次数(明细)
+		pewp.setRcwsldwcsmx(dwslcs);
+		//日合计场外受累电网次数(明细)
+		pewp.setRcwsltqcsmx(hjslcs);
+		//日合计通讯中断次数(明细)
+		pewp.setRtxzdcsmx(txzdcs);
+		//日合计离线次数(明细)
+		pewp.setRlxcsmx(sblxcs);
+
+//*******************************************日信息统计*********************************************************/
+
+//*******************************************月信息统计*********************************************************/
+
+		if(pepidls.isEmpty())
+		{
+			setLossHoursMonth(pewp);
+
+		}else
+		{
+
+
+			ProEconEquipmentInfoDay3 pepid=pepidls.get(0);
+
+			//月合计故障次数(明细)
+			pewp.setYgzcsmx(StringUtils.round(pepid.getYgzcsmx()+pewp.getRgzcsmx(),2));
+			//月合计场内受累故障次数(明细)
+			pewp.setYcnslgzcsmx(StringUtils.round(pepid.getYcnslgzcsmx()+pewp.getRcnslgzcsmx(),2));
+			//月合计检修次数(明细)
+			pewp.setYjxcsmx(StringUtils.round(pepid.getYjxcsmx()+pewp.getRjxcsmx(),2));
+			//月合计场内受累检修次数(明细)
+			pewp.setYcnsljxcsmx(StringUtils.round( pepid.getYcnsljxcsmx()+pewp.getRcnsljxcsmx(),2));
+			//月合计待机次数(明细)
+			pewp.setYdjcsmx(StringUtils.round(pepid.getYdjcsmx()+pewp.getRdjcsmx(),2));
+			//月合计缺陷降出力次数(明细)
+			pewp.setYqxjclcsmx(StringUtils.round(pepid.getYqxjclcsmx()+pewp.getRqxjclcsmx(),2));
+			//月合计手动停机次数(明细)
+			pewp.setYsdtjcsmx(StringUtils.round(pepid.getYsdtjcsmx()+pewp.getRsdtjcsmx(),2));
+			//月合计性能次数(明细)
+			pewp.setYbwcsmx(StringUtils.round(pepid.getYbwcsmx()+pewp.getRbwcsmx(),2));
+			//月合计限电停机次数(明细)
+			pewp.setYxdtjcsmx(StringUtils.round(pepid.getYxdtjcsmx()+pewp.getRxdtjcsmx(),2));
+			//月合计限电降出力次数(明细)
+			pewp.setYxdjclcsmx(StringUtils.round(pepid.getYxdjclcsmx()+pewp.getRxdjclcsmx(),2));
+			//月合计场外受累电网次数(明细)
+			pewp.setYcwsldwcsmx(StringUtils.round(pepid.getYcwsldwcsmx()+pewp.getRcwsldwcsmx(),2));
+			//月合计场外受累电网次数(明细)
+			pewp.setYcwsltqcsmx(StringUtils.round(pepid.getYcwsltqcsmx()+pewp.getRcwsltqcsmx(),2));
+			//月合计通讯中断次数(明细)
+			pewp.setYtxzdcsmx(StringUtils.round(pepid.getYtxzdcsmx()+pewp.getRtxzdcsmx(),2));
+			//月合计离线次数(明细)
+			pewp.setYlxcsmx(StringUtils.round(pepid.getYlxcsmx()+pewp.getRlxcsmx(),2));
+
+		}
+
+
+
+//*******************************************月信息统计*********************************************************/
+
+//*******************************************年信息统计*********************************************************/
+		if(pepidls.isEmpty())
+		{
+			setLossHoursYear(pewp);
+		}else
+		{
+
+			ProEconEquipmentInfoDay3 pepid=pepidls.get(0);
+
+			//年合计故障次数(明细)
+			pewp.setNgzcsmx(StringUtils.round(pepid.getNgzcsmx()+pewp.getRgzcsmx(),2));
+			//年合计场内受累故障次数(明细)
+			pewp.setNcnslgzcsmx(StringUtils.round(pepid.getNcnslgzcsmx()+pewp.getRcnslgzcsmx(),2));
+			//年合计检修次数(明细)
+			pewp.setNjxcsmx(StringUtils.round(pepid.getNjxcsmx()+pewp.getRjxcsmx(),2));
+			//年合计场内受累检修次数(明细)
+			pewp.setNcnsljxcsmx(StringUtils.round( pepid.getNcnsljxcsmx()+pewp.getRcnsljxcsmx(),2));
+			//年合计待机次数(明细)
+			pewp.setNdjcsmx(StringUtils.round(pepid.getNdjcsmx()+pewp.getRdjcsmx(),2));
+			//年合计缺陷降出力次数(明细)
+			pewp.setNqxjclcsmx(StringUtils.round(pepid.getNqxjclcsmx()+pewp.getRqxjclcsmx(),2));
+			//年合计手动停机次数(明细)
+			pewp.setNsdtjcsmx(StringUtils.round(pepid.getNsdtjcsmx()+pewp.getRsdtjcsmx(),2));
+			//年合计性能次数(明细)
+			pewp.setNbwcsmx(StringUtils.round(pepid.getNbwcsmx()+pewp.getRbwcsmx(),2));
+			//年合计限电停机次数(明细)
+			pewp.setNxdtjcsmx(StringUtils.round(pepid.getNxdtjcsmx()+pewp.getRxdtjcsmx(),2));
+			//年合计限电降出力次数(明细)
+			pewp.setNxdjclcsmx(StringUtils.round(pepid.getNxdjclcsmx()+pewp.getRxdjclcsmx(),2));
+			//年合计场外受累电网次数(明细)
+			pewp.setNcwsldwcsmx(StringUtils.round(pepid.getNcwsldwcsmx()+pewp.getRcwsldwcsmx(),2));
+			//年合计场外受累电网次数(明细)
+			pewp.setNcwsltqcsmx(StringUtils.round(pepid.getNcwsltqcsmx()+pewp.getRcwsltqcsmx(),2));
+			//年合计通讯中断次数(明细)
+			pewp.setNtxzdcsmx(StringUtils.round(pepid.getNtxzdcsmx()+pewp.getRtxzdcsmx(),2));
+			//年合计离线次数(明细)
+			pewp.setNlxcsmx(StringUtils.round(pepid.getNlxcsmx()+pewp.getRlxcsmx(),2));
+
+		}
+
+
+	}
+
+	private static void setLossHoursYear(ProEconEquipmentInfoDay3 pewp) {
+		//年合计故障次数(明细)
+		pewp.setNgzcsmx(pewp.getRgzcsmx());
+		//年合计场内受累故障次数(明细)
+		pewp.setNcnslgzcsmx(pewp.getRcnslgzcsmx());
+		//年合计检修次数(明细)
+		pewp.setNjxcsmx(pewp.getRjxcsmx());
+		//年合计场内受累检修次数(明细)
+		pewp.setNcnsljxcsmx(pewp.getRcnsljxcsmx());
+		//年合计待机次数(明细)
+		pewp.setNdjcsmx(pewp.getRdjcsmx());
+		//年合计缺陷降出力次数(明细)
+		pewp.setNqxjclcsmx(pewp.getRqxjclcsmx());
+		//年合计手动停机次数(明细)
+		pewp.setNsdtjcsmx(pewp.getRsdtjcsmx());
+		//年合计性能次数(明细)
+		pewp.setNbwcsmx(pewp.getRbwcsmx());
+		//年合计限电停机次数(明细)
+		pewp.setNxdtjcsmx(pewp.getRxdtjcsmx());
+		//年合计限电降出力次数(明细)
+		pewp.setNxdjclcsmx(pewp.getRxdjclcsmx());
+		//年合计场外受累电网次数(明细)
+		pewp.setNcwsldwcsmx(pewp.getRcwsldwcsmx());
+		//年合计场外受累电网次数(明细)
+		pewp.setNcwsltqcsmx(pewp.getRcwsltqcsmx());
+		//年合计通讯中断次数(明细)
+		pewp.setNtxzdcsmx(pewp.getRtxzdcsmx());
+		//年合计离线次数(明细)
+		pewp.setNlxcsmx(pewp.getRlxcsmx());
+	}
+
+	private static void setLossHoursMonth(ProEconEquipmentInfoDay3 pewp) {
+		//月合计故障次数(明细)
+		pewp.setYgzcsmx(pewp.getRgzcsmx());
+		//月合计场内受累故障次数(明细)
+		pewp.setYcnslgzcsmx(pewp.getRcnslgzcsmx());
+		//月合计检修次数(明细)
+		pewp.setYjxcsmx(pewp.getRjxcsmx());
+		//月合计场内受累检修次数(明细)
+		pewp.setYcnsljxcsmx(pewp.getRcnsljxcsmx());
+		//月合计待机次数(明细)
+		pewp.setYdjcsmx(pewp.getRdjcsmx());
+		//月合计缺陷降出力次数(明细)
+		pewp.setYqxjclcsmx(pewp.getRqxjclcsmx());
+		//月合计手动停机次数(明细)
+		pewp.setYsdtjcsmx(pewp.getRsdtjcsmx());
+		//月合计性能次数(明细)
+		pewp.setYbwcsmx(pewp.getRbwcsmx());
+		//月合计限电停机次数(明细)
+		pewp.setYxdtjcsmx(pewp.getRxdtjcsmx());
+		//月合计限电降出力次数(明细)
+		pewp.setYxdjclcsmx(pewp.getRxdjclcsmx());
+		//月合计场外受累电网次数(明细)
+		pewp.setYcwsldwcsmx(pewp.getRcwsldwcsmx());
+		//月合计场外受累电网次数(明细)
+		pewp.setYcwsltqcsmx(pewp.getRcwsltqcsmx());
+		//月合计通讯中断次数(明细)
+		pewp.setYtxzdcsmx(pewp.getRtxzdcsmx());
+		//月合计离线次数(明细)
+		pewp.setYlxcsmx(pewp.getRlxcsmx());
+	}
+
+
+	private static void setLossHoursMonthSimple(ProEconEquipmentInfoDay3 pewp) {
+		//月合计待机次数
+		pewp.setYdjcs(pewp.getRdjcs());
+		//月合计维护停机次数
+		pewp.setYjxtjcs(pewp.getRjxtjcs());
+		// 月合计故障停机次数
+		pewp.setYgztjcs(pewp.getRgztjcs());
+		//月合计运行次数
+		pewp.setYyxcs(pewp.getRyxcs());
+		//月合计限电次数
+		pewp.setYxdcs(pewp.getRxdcs());
+		//月合计通讯中断次数
+		pewp.setYtxzdcs(pewp.getRtxzdcs());
+		//月合计受累次数
+		pewp.setYslcs(pewp.getRslcs());
+	}
+
+	private static void setLossHoursYearSimple(ProEconEquipmentInfoDay3 pewp) {
+		//年合计待机次数
+		pewp.setNdjcs(pewp.getRdjcs());
+		//年合计维护停机次数
+		pewp.setNjxtjcs(pewp.getRjxtjcs());
+		// 年合计故障次数
+		pewp.setNgztjcs(pewp.getRgztjcs());
+		//年合计运行次数
+		pewp.setNyxcs(pewp.getRyxcs());
+		//年合计限电次数
+		pewp.setNxdcs(pewp.getRxdcs());
+		//年合计通讯中断次数
+		pewp.setNtxzdcs(pewp.getRtxzdcs());
+		//年合计受累次数
+		pewp.setNslcs(pewp.getRslcs());
+	}
+
+	private void calSimple(ProEconEquipmentInfoDay3 pewp, Date end, Date begin, ProBasicEquipment wt, List<ProEconEquipmentInfoDay3> pepidls) throws Exception {
+//        0	待机
+//        1	运行
+//        2	故障
+//        3	检修
+//        4	限电
+//        5	受累
+//        6	离线
+//*******************************************日信息统计*********************************************************/
+
+		double lastState=-1;//上一分钟状态
+
+
+		double djcs=0;//待机时长
+		double zcfdcs=0;//正常发电时长
+		double gzcs=0;//故障时长
+		double jxcs=0;//检修时长
+		double xdtjcs=0;//限电停机时长
+		double slsc=0;//受累时长
+		double txzdcs=0;//通讯中断时长
+
+
+
+		Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
+
+
+		Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getId());
+		if(aimap.containsKey(ContantXk.SBZT))
+		{
+
+			ProBasicEquipmentPoint point=aimap.get(ContantXk.SBZT);
+			//按照分钟时间进行统计状态快照值
+			List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+			if(!pointls.isEmpty()) {
+				for (PointData po : pointls) {
+
+					if (po.getPointValueInDouble() == 0) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+							//待机时长加1
+							djcs++;
+						}
+
+					} else if (po.getPointValueInDouble() == 1) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+							//正常发电时长加1
+							zcfdcs++;
+						}
+
+					} else if (po.getPointValueInDouble() == 2) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+							//故障时长加1
+							gzcs++;
+						}
+
+					} else if (po.getPointValueInDouble() == 3) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+							//检修时长加1
+							jxcs++;
+						}
+					} else if (po.getPointValueInDouble() == 4) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+							//限电停机时长加1
+							xdtjcs++;
+						}
+					} else if (po.getPointValueInDouble() == 5) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+							//受累时长加1
+							slsc++;
+						}
+
+					} else if (po.getPointValueInDouble() == 6) {
+						if (lastState != po.getPointValueInDouble()) {
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+							//通讯中断时长加1
+							txzdcs++;
+						}
+
+					}
+
+				}
+
+			}
+
+		}
+
+
+
+		//日合计待机次数
+		pewp.setRdjcs(gzcs);
+		//日合计维护停机次数
+		pewp.setRjxtjcs(jxcs);
+		// 日合计待机次数
+		pewp.setRdjcs(djcs);
+		//日合计运行次数
+		pewp.setRyxcs(zcfdcs);
+		//日合计限电次数
+		pewp.setRxdcs(xdtjcs);
+		//日合计通讯中断次数
+		pewp.setRtxzdcs(txzdcs);
+		//日合计受累次数
+		pewp.setRslcs(slsc);
+
+
+		//*******************************************日信息统计*********************************************************/
+
+		//*******************************************月信息统计*********************************************************/
+		if(pepidls.isEmpty())
+		{
+			setLossHoursMonthSimple(pewp);
+
+		}else
+		{
+
+
+			ProEconEquipmentInfoDay3 pepid=pepidls.get(0);
+
+
+			//月合计待机次数
+			pewp.setYdjcs(StringUtils.round(pepid.getYdjcs()+pewp.getRdjcs(),2));
+			//月合计维护停机次数
+			pewp.setYjxtjcs(StringUtils.round(pepid.getYjxtjcs()+pewp.getRjxtjcs(),2));
+			// 月合计故障次数
+			pewp.setYgztjcs(StringUtils.round(pepid.getYgztjcs()+pewp.getRgztjcs(),2));
+			//月合计运行次数
+			pewp.setYyxcs(StringUtils.round(pepid.getYyxcs()+pewp.getRyxcs(),2));
+			//月合计限电次数
+			pewp.setYxdcs(StringUtils.round(pepid.getYxdcs()+pewp.getRxdcs(),2));
+			//月合计通讯中断次数
+			pewp.setYtxzdcs(StringUtils.round(pepid.getYtxzdcs()+pewp.getRtxzdcs(),2));
+			//月合计受累次数
+			pewp.setYslcs(StringUtils.round(pepid.getYslcs()+pewp.getRslcs(),2));
+
+		}
+		//*******************************************月信息统计*********************************************************/
+
+		//*******************************************年信息统计*********************************************************/
+		if(pepidls.isEmpty())
+		{
+			setLossHoursYearSimple(pewp);
+
+		}else
+		{
+
+
+			ProEconEquipmentInfoDay3 pepid=pepidls.get(0);
+
+
+			//年合计待机次数
+			pewp.setNdjcs(StringUtils.round(pepid.getNdjcs()+pewp.getRdjcs(),2));
+			//年合计维护停机次数
+			pewp.setNjxtjcs(StringUtils.round(pepid.getNjxtjcs()+pewp.getRjxtjcs(),2));
+			// 年合计故障次数
+			pewp.setNgztjcs(StringUtils.round(pepid.getNgztjcs()+pewp.getRgztjcs(),2));
+			//年合计运行次数
+			pewp.setNyxcs(StringUtils.round(pepid.getNyxcs()+pewp.getRyxcs(),2));
+			//年合计限电次数
+			pewp.setNxdcs(StringUtils.round(pepid.getNxdcs()+pewp.getRxdcs(),2));
+			//年合计通讯中断次数
+			pewp.setNtxzdcs(StringUtils.round(pepid.getNtxzdcs()+pewp.getRtxzdcs(),2));
+			//年合计受累次数
+			pewp.setNslcs(StringUtils.round(pepid.getNslcs()+pewp.getRslcs(),2));
+
+		}
+		//*******************************************年信息统计*********************************************************/
+	}
+
+
+
+}

+ 132 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo4Thread.java

@@ -0,0 +1,132 @@
+package com.gyee.alarm.task.thread;
+
+import com.gyee.alarm.model.auto.*;
+import com.gyee.alarm.service.auto.*;
+import com.gyee.alarm.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+
+public class EquipmentInfo4Thread implements Runnable {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	private Executor executor;
+
+	private ProBasicEquipment wt;
+	private   Map<String, ProEconEquipmentInfoDay2> pep2map;
+	private   Map<String,ProEconEquipmentInfoDay3> pep3map;
+	private   Map<String, ProEconEquipmentInfoDay4> pep4map;
+	private Date recordDate;
+	private Date end;
+
+	private Date begin;
+	private List<ProEconEquipmentInfoDay4> dayls;
+	private IEdosUtil edosUtil;
+
+	private Map<String, ProEconInOrOutSpeedTotal> peioomap;
+
+	private Map<String,ProEconWindturbineGoodness> wgmap;
+
+	private IProEconCurveFittingMainService proEconCurveFittingMainService;
+
+	private IProEconEquipmentInfoDay5Service proEconEquipmentInfoDay5Service;
+
+	private IProEconFaultLiminatedefectsService proEconFaultLiminatedefectsService;
+
+	private IProEconCurveFittingSubService proEconCurveFittingSubService;
+
+	private IProEconCurveFittMonthMainService proEconCurveFittMonthMainService;
+
+	private IProEconCurveFittMonthSubService proEconCurveFittMonthSubService;
+
+	private IProEconCurveFittYearMainService proEconCurveFittYearMainService;
+
+
+	private IProEconCurveFittYearSubService proEconCurveFittYearSubService;
+
+	private CountDownLatch latch;
+
+	public EquipmentInfo4Thread(Executor executor,ProBasicEquipment wt,Map<String, ProEconEquipmentInfoDay2> pep2map,
+								Map<String, ProEconEquipmentInfoDay3> pep3map,
+								Map<String, ProEconEquipmentInfoDay4> pep4map,
+								Date recordDate, Date end, Date begin, List<ProEconEquipmentInfoDay4> dayls,
+								IEdosUtil edosUtil,Map<String, ProEconInOrOutSpeedTotal> peioomap,
+								Map<String,ProEconWindturbineGoodness> wgmap,
+								IProEconCurveFittingMainService proEconCurveFittingMainService,
+								IProEconEquipmentInfoDay5Service proEconEquipmentInfoDay5Service,
+								IProEconFaultLiminatedefectsService proEconFaultLiminatedefectsService,
+								IProEconCurveFittingSubService proEconCurveFittingSubService,
+								IProEconCurveFittMonthMainService proEconCurveFittMonthMainService,
+								IProEconCurveFittMonthSubService proEconCurveFittMonthSubService,
+								IProEconCurveFittYearMainService proEconCurveFittYearMainService,
+								IProEconCurveFittYearSubService proEconCurveFittYearSubService,
+                                CountDownLatch latch	) {
+		this.executor = executor;
+		this.wt = wt;
+		this.pep2map = pep2map;
+		this.pep3map = pep3map;
+		this.pep4map = pep4map;
+		this.recordDate = recordDate;
+		this.end = end;
+		this.begin = begin;
+		this.dayls = dayls;
+		this.edosUtil = edosUtil;
+		this.peioomap = peioomap;
+		this.wgmap = wgmap;
+		this.proEconCurveFittingMainService=proEconCurveFittingMainService;
+		this.proEconEquipmentInfoDay5Service=proEconEquipmentInfoDay5Service;
+		this.proEconFaultLiminatedefectsService=proEconFaultLiminatedefectsService;
+		this.proEconCurveFittingSubService=proEconCurveFittingSubService;
+		this.proEconCurveFittMonthMainService=proEconCurveFittMonthMainService;
+		this.proEconCurveFittMonthSubService=proEconCurveFittMonthSubService;
+		this.proEconCurveFittYearMainService=proEconCurveFittYearMainService;
+		this.proEconCurveFittYearSubService=proEconCurveFittYearSubService;
+		this.latch = latch;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " + wt.getId();
+		logger.info("设备4计算服务创建任务并提交到线程池中:" + wt.getId());
+		FutureTask<String> futureTask = new FutureTask<String>(new EquipmentInfo4ThreadPool(task,
+				 wt, pep2map,
+				 pep3map,
+				 pep4map,
+				 recordDate,  end,  begin,  dayls,
+				 edosUtil, peioomap,
+				 wgmap,
+				 proEconCurveFittingMainService,
+				 proEconEquipmentInfoDay5Service,
+				 proEconFaultLiminatedefectsService,
+				 proEconCurveFittingSubService,
+				 proEconCurveFittMonthMainService,
+				 proEconCurveFittMonthSubService,
+				 proEconCurveFittYearMainService,
+				 proEconCurveFittYearSubService));
+
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get();
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		}finally {
+			latch.countDown();
+		}
+	}
+}

文件差异内容过多而无法显示
+ 1195 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo4ThreadPool.java


+ 80 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo5Thread.java

@@ -0,0 +1,80 @@
+package com.gyee.alarm.task.thread;
+
+import com.gyee.alarm.model.auto.ProBasicEquipment;
+import com.gyee.alarm.model.auto.ProEconEquipmentInfoDay5;
+import com.gyee.alarm.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+
+public class EquipmentInfo5Thread implements Runnable {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	private Executor executor;
+
+	private ProBasicEquipment wt;
+	private   Map<String, ProEconEquipmentInfoDay5> rates;
+
+	private Map<Double, Double> stateDescription1;
+	private Map<Double, Double> stateDescription2;
+	private Date recordDate;
+	private Date endDate;
+
+	private Date beginDate;
+
+	private IEdosUtil edosUtil;
+
+	private CountDownLatch latch;
+
+	public EquipmentInfo5Thread(Executor executor, ProBasicEquipment wt, Map<String, ProEconEquipmentInfoDay5> rates,
+								Date endDate, Date beginDate,
+								IEdosUtil edosUtil, Map<Double, Double> stateDescription1,
+								Map<Double, Double> stateDescription2,
+                                CountDownLatch latch	) {
+
+		this.executor = executor;
+		this.wt = wt;
+		this.rates = rates;
+		this.endDate = endDate;
+		this.beginDate = beginDate;
+		this.edosUtil = edosUtil;
+		this.stateDescription1 = stateDescription1;
+		this.stateDescription2 = stateDescription2;
+		this.latch = latch;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " + wt.getId();
+		logger.info("设备5计算服务创建任务并提交到线程池中:" + wt.getId());
+		FutureTask<String> futureTask = new FutureTask<String>(new EquipmentInfo5ThreadPool(task,
+				 wt,  rates,
+				   endDate,  beginDate,
+				 edosUtil, stateDescription1,
+				 stateDescription2));
+
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get();
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		}finally {
+			latch.countDown();
+		}
+	}
+}

+ 314 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/EquipmentInfo5ThreadPool.java

@@ -0,0 +1,314 @@
+package com.gyee.alarm.task.thread;
+
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
+import com.gyee.alarm.init.CacheContext;
+import com.gyee.alarm.model.auto.ProBasicEquipment;
+import com.gyee.alarm.model.auto.ProBasicEquipmentPoint;
+import com.gyee.alarm.model.auto.ProEconEquipmentInfoDay5;
+import com.gyee.alarm.util.DateUtils;
+import com.gyee.alarm.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+public class EquipmentInfo5ThreadPool implements Callable<String>, Serializable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+
+	private static final long serialVersionUID = 0;
+
+	// 保存任务所需要的数据
+
+	private Object threadPoolTaskData;
+	private ProBasicEquipment wt;
+	private   Map<String, ProEconEquipmentInfoDay5> rates;
+
+	private Map<Double, Double> stateDescription1;
+	private Map<Double, Double> stateDescription2;
+	private Date recordDate;
+	private Date endDate;
+
+	private Date beginDate;
+
+	private IEdosUtil edosUtil;
+
+
+
+	public EquipmentInfo5ThreadPool(Object tasks, ProBasicEquipment wt, Map<String, ProEconEquipmentInfoDay5> rates,
+                                    Date endDate, Date beginDate,
+                                    IEdosUtil edosUtil, Map<Double, Double> stateDescription1,
+									Map<Double, Double> stateDescription2
+	) {
+
+		this.threadPoolTaskData = tasks;
+		this.wt = wt;
+		this.rates = rates;
+
+		this.endDate = endDate;
+		this.beginDate = beginDate;
+
+		this.edosUtil = edosUtil;
+		this.stateDescription1 = stateDescription1;
+		this.stateDescription2 = stateDescription2;
+
+	}
+
+	public synchronized String call() throws Exception {
+
+
+		// 处理一个任务,这里的处理方式太简单了,仅仅是一个打印语句
+
+		//System.out.println("开始执行任务:" + threadPoolTaskData);
+
+		String result = "";
+
+		// //便于观察,等待一段时间
+
+		try {
+			ProEconEquipmentInfoDay5 rate = rates.get(wt.getId());
+
+			List<PointData> speedDataList = null;
+			List<PointData> statusDataList = null;
+			if (CacheContext.wtpAimap.containsKey(wt.getId())) {
+				Map<String, ProBasicEquipmentPoint> wtpmap = CacheContext.wtpAimap.get(wt.getId());
+				if (wtpmap.containsKey(ContantXk.CJ_SSFS)) {
+					ProBasicEquipmentPoint point = wtpmap.get(ContantXk.CJ_SSFS);
+					speedDataList = edosUtil.getHistoryDatasSnap(point.getNemCode(), beginDate.getTime() / 1000, endDate.getTime() / 1000);
+				}
+				if (wtpmap.containsKey(ContantXk.MXZT)) {
+					ProBasicEquipmentPoint point = wtpmap.get(ContantXk.MXZT);
+					statusDataList = edosUtil.getHistoryDatasSnap(point.getNemCode(), beginDate.getTime() / 1000, endDate.getTime() / 1000);
+				}
+
+			}
+
+
+
+			if (speedDataList != null && statusDataList != null && statusDataList.size() == speedDataList.size() && !speedDataList.isEmpty()) {
+
+				double laststatus = -1;
+				Date begin = new Date();
+				for (int i = 0; i < speedDataList.size(); i++) {
+
+					double status = statusDataList.get(i).getPointValueInDouble();
+					double speed = speedDataList.get(i).getPointValueInDouble();
+					if (i == 0) {
+						begin = new Date(speedDataList.get(i).getPointTime());
+						laststatus = status;
+					}
+
+					if (speed <= 3.0) {
+						if (laststatus != status &&
+								(status == stateDescription1.get(3.0) || status == stateDescription2.get(3.0))) {
+
+							Date end = new Date(speedDataList.get(i).getPointTime());
+							double zhcs = DateUtils.hoursDiff2(begin, end);
+							if (zhcs < 0.25)//5分钟
+							{
+
+								double temp = rate.getTimerate1();
+								temp = temp + 1;
+								rate.setTimerate1(temp);
+
+								temp = rate.getTimerate2();
+								temp = temp + 1;
+								rate.setTimerate2(temp);
+
+								temp = rate.getTimerate3();
+								temp = temp + 1;
+								rate.setTimerate3(temp);
+
+								temp = rate.getTimerate4();
+								temp = temp + 1;
+								rate.setTimerate4(temp);
+
+							} else if (zhcs < 0.33)//10分钟
+							{
+								double temp = rate.getTimerate2();
+								temp = temp + 1;
+								rate.setTimerate2(temp);
+
+								temp = rate.getTimerate3();
+								temp = temp + 1;
+								rate.setTimerate3(temp);
+
+								temp = rate.getTimerate4();
+								temp = temp + 1;
+								rate.setTimerate4(temp);
+							} else if (zhcs < 0.42)//15分钟
+							{
+								double temp = rate.getTimerate3();
+								temp = temp + 1;
+								rate.setTimerate3(temp);
+
+								temp = rate.getTimerate4();
+								temp = temp + 1;
+								rate.setTimerate4(temp);
+							} else if (zhcs < 0.5)//20分钟
+							{
+								double temp = rate.getTimerate4();
+								temp = temp + 1;
+								rate.setTimerate4(temp);
+							}
+
+
+							double temp = rate.getTimerate13();
+							temp = temp + 1;
+							rate.setTimerate13(temp);
+						}
+
+						laststatus = status;
+						begin = new Date(speedDataList.get(i).getPointTime());
+					} else if (speed <= 4.0 && speed > 3.0) {
+						if (laststatus != status &&
+								(status == stateDescription1.get(3.5) || status == stateDescription2.get(3.5))) {
+
+							Date end = new Date(speedDataList.get(i).getPointTime());
+							double zhcs = DateUtils.hoursDiff2(begin, end);
+							if (zhcs < 0.25)//5分钟
+							{
+
+								double temp = rate.getTimerate5();
+								temp = temp + 1;
+								rate.setTimerate5(temp);
+
+								temp = rate.getTimerate6();
+								temp = temp + 1;
+								rate.setTimerate6(temp);
+
+								temp = rate.getTimerate7();
+								temp = temp + 1;
+								rate.setTimerate7(temp);
+
+								temp = rate.getTimerate8();
+								temp = temp + 1;
+								rate.setTimerate8(temp);
+							} else if (zhcs < 0.33)//10分钟
+							{
+
+								double temp = rate.getTimerate6();
+								temp = temp + 1;
+								rate.setTimerate6(temp);
+
+								temp = rate.getTimerate7();
+								temp = temp + 1;
+								rate.setTimerate7(temp);
+
+								temp = rate.getTimerate8();
+								temp = temp + 1;
+								rate.setTimerate8(temp);
+							} else if (zhcs < 0.42)//15分钟
+							{
+								double temp = rate.getTimerate7();
+								temp = temp + 1;
+								rate.setTimerate7(temp);
+
+								temp = rate.getTimerate8();
+								temp = temp + 1;
+								rate.setTimerate8(temp);
+
+							} else if (zhcs < 0.5)//20分钟
+							{
+								double temp = rate.getTimerate8();
+								temp = temp + 1;
+								rate.setTimerate8(temp);
+							}
+
+							//}
+							double temp = rate.getTimerate14();
+							temp = temp + 1;
+							rate.setTimerate14(temp);
+
+						}
+
+						laststatus = status;
+						begin = new Date(speedDataList.get(i).getPointTime());
+					} else {
+						if (laststatus != status &&
+								(status == stateDescription1.get(4.0) || status == stateDescription2.get(4.0))) {
+
+							Date end = new Date(speedDataList.get(i).getPointTime());
+							double zhcs = DateUtils.hoursDiff2(begin, end);
+							if (zhcs < 0.25)//5分钟
+							{
+
+								double temp = rate.getTimerate9();
+								temp = temp + 1;
+								rate.setTimerate9(temp);
+
+								temp = rate.getTimerate10();
+								temp = temp + 1;
+								rate.setTimerate10(temp);
+
+								temp = rate.getTimerate11();
+								temp = temp + 1;
+								rate.setTimerate11(temp);
+
+								temp = rate.getTimerate12();
+								temp = temp + 1;
+								rate.setTimerate12(temp);
+							} else if (zhcs < 0.33)//10分钟
+							{
+
+								double temp = rate.getTimerate10();
+								temp = temp + 1;
+								rate.setTimerate10(temp);
+
+								temp = rate.getTimerate11();
+								temp = temp + 1;
+								rate.setTimerate11(temp);
+
+								temp = rate.getTimerate12();
+								temp = temp + 1;
+								rate.setTimerate12(temp);
+							} else if (zhcs < 0.42)//15分钟
+							{
+
+								double temp = rate.getTimerate11();
+								temp = temp + 1;
+								rate.setTimerate11(temp);
+
+								temp = rate.getTimerate12();
+								temp = temp + 1;
+								rate.setTimerate12(temp);
+							} else if (zhcs < 0.5)//20分钟
+							{
+								double temp = rate.getTimerate12();
+								temp = temp + 1;
+								rate.setTimerate12(temp);
+							}
+
+							double temp = rate.getTimerate15();
+							temp = temp + 1;
+							rate.setTimerate15(temp);
+
+
+							laststatus = status;
+							begin = new Date(speedDataList.get(i).getPointTime());
+						}
+					}
+				}
+
+			}
+
+		} catch (Exception e) {
+
+			e.printStackTrace();
+		}
+
+		threadPoolTaskData = null;
+
+		return result;
+
+	}
+
+
+
+}
+

+ 191 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/InputOrOutPutThreadPool.java

@@ -0,0 +1,191 @@
+package com.gyee.alarm.task.thread;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
+import com.gyee.alarm.init.CacheContext;
+import com.gyee.alarm.model.auto.ProBasicEquipment;
+import com.gyee.alarm.model.auto.ProBasicEquipmentPoint;
+import com.gyee.alarm.model.auto.ProEconInputOrOutputSpeed;
+import com.gyee.alarm.service.auto.IProEconInputOrOutputSpeedService;
+import com.gyee.alarm.util.DateUtils;
+import com.gyee.alarm.util.StringUtils;
+import com.gyee.alarm.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.util.*;
+import java.util.concurrent.Callable;
+
+public class InputOrOutPutThreadPool implements Callable<String>, Serializable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+	
+	private static final long serialVersionUID = 0;
+	private String unicode4hour="JKYC001";
+	private String unicode1day="JKYC006";
+	private String unicode3day="JKYC011";
+	private String unicode7day="JKYC016";
+	private String unicode1month="JKYC021";
+	// 保存任务所需要的数据
+
+	private Object threadPoolTaskData;
+	private IEdosUtil edosUtil;
+	private ProBasicEquipment wt;
+	private Date begin;
+	private Date end;
+
+	private IProEconInputOrOutputSpeedService proEconInputOrOutputSpeedService;
+
+	private static Map<String,Double> wtLastStatusMap=new HashMap<>();
+
+	private static  Map<String, ProEconInputOrOutputSpeed> wtTimeStatusMap=new HashMap<>();
+	public InputOrOutPutThreadPool(Object tasks, ProBasicEquipment wt,  Date begin, Date end,
+								   IProEconInputOrOutputSpeedService proEconInputOrOutputSpeedService,IEdosUtil edosUtil) {
+
+		this.threadPoolTaskData = tasks;
+		this.wt = wt;
+		this.begin = begin;
+		this.end = end;
+		this.proEconInputOrOutputSpeedService = proEconInputOrOutputSpeedService;
+		this.edosUtil = edosUtil;
+
+	}
+
+	public synchronized String call() throws Exception {
+
+		
+		// 处理一个任务,这里的处理方式太简单了,仅仅是一个打印语句
+
+		//System.out.println("开始执行任务:" + threadPoolTaskData);
+
+		String result = "";
+
+		// //便于观察,等待一段时间
+
+		
+
+		try {
+
+			Map<String, ProBasicEquipmentPoint> pointmap= CacheContext.wtpAimap.get(wt.getId());
+
+			QueryWrapper<ProEconInputOrOutputSpeed> queryWrapper = new QueryWrapper<>();
+			queryWrapper.ge("record_date",begin).le("record_date",end).eq("windturbine_id",wt.getId());
+			List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list(queryWrapper);
+//            .stream()
+//                    .filter(i -> i.getWindturbineId().equals(wt.getId())
+//                            && (i.getRecordDate().compareTo(daybegin) == 0 || i.getRecordDate().after(daybegin))
+//                            && (i.getRecordDate().compareTo(end) == 0 || i.getRecordDate().before(end))
+//                           ).collect(Collectors.toList());
+
+			if(!recordList.isEmpty())
+			{
+				for(ProEconInputOrOutputSpeed po:recordList)
+				{
+					wtTimeStatusMap.put(String.valueOf(po.getRecordDate().getTime()),po);
+				}
+			}
+
+			double lastStatus=-1;
+
+
+			ProBasicEquipmentPoint mxzt= pointmap.get(ContantXk.SBZT);
+			ProBasicEquipmentPoint ssfs= pointmap.get(ContantXk.CJ_SSFS);
+
+			//获取5分钟没个间隔1秒钟,保证状态与时序库保持一致
+			List<PointData> statusls = edosUtil.getHistoryDatasSnap(mxzt.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000,null,1L);
+			List<PointData> ssfsls = edosUtil.getHistoryDatasSnap(ssfs.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000,null,1L);
+
+
+			if(!statusls.isEmpty() && !ssfsls.isEmpty() && ssfsls.size()==statusls.size())
+			{
+				List<ProEconInputOrOutputSpeed> ls=new ArrayList<>();
+				for(int i=0;i<statusls.size();i++)
+				{
+
+
+					if(wtLastStatusMap.containsKey(wt.getId()))
+					{
+						lastStatus=wtLastStatusMap.get(wt.getId());
+					}
+
+					PointData statuspo=statusls.get(i);
+					PointData ssfspo=ssfsls.get(i);
+					double status= StringUtils.round(statuspo.getPointValueInDouble(),0);
+
+					if(i==0)
+					{
+						lastStatus=status;
+					}
+					if (!Objects.equals(lastStatus, status))
+					{
+
+						//     切入切出风速
+						if (lastStatus == 0 && status == 1)
+						{
+							ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
+
+							input.setWindturbineId(wt.getId());
+							input.setWindpowerstationId(wt.getWindpowerstationId());
+							input.setProjectId(wt.getProjectId());
+							input.setLineId(wt.getLineId());
+							input.setRecordDate(DateUtils.truncate(new Date(statuspo.getPointTime())));
+							input.setInputOrOutput(1);
+
+
+							input.setSpeed(StringUtils.round(ssfspo.getPointValueInDouble(),2));
+
+							if(!wtTimeStatusMap.containsKey(String.valueOf(statuspo.getPointTime())))
+							{
+								//roEconInputOrOutputSpeedService.save(input);
+								ls.add(input);
+							}
+							lastStatus=status;
+
+						}
+						else if (lastStatus == 1 && status== 0)
+						{
+							ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
+							input.setWindturbineId(wt.getId());
+							input.setWindpowerstationId(wt.getWindpowerstationId());
+							input.setProjectId(wt.getProjectId());
+							input.setLineId(wt.getLineId());
+							input.setRecordDate(DateUtils.truncate(new Date(statuspo.getPointTime())));
+							input.setInputOrOutput(0);
+
+							input.setSpeed(StringUtils.round(ssfspo.getPointValueInDouble(),2));
+
+							if(!wtTimeStatusMap.containsKey(String.valueOf(statuspo.getPointTime())))
+							{
+								//proEconInputOrOutputSpeedService.save(input);
+
+								ls.add(input);
+							}
+							lastStatus=status;
+						}
+
+						wtLastStatusMap.put(wt.getId(), status);
+
+					}
+				}
+
+
+				proEconInputOrOutputSpeedService.saveBatch(ls);
+
+
+			}
+
+
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		threadPoolTaskData = null;
+
+		return result;
+
+	}
+
+
+}

+ 58 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/InputOrOutPutkThread.java

@@ -0,0 +1,58 @@
+package com.gyee.alarm.task.thread;
+
+import com.gyee.alarm.model.auto.ProBasicEquipment;
+import com.gyee.alarm.service.auto.IProEconInputOrOutputSpeedService;
+import com.gyee.alarm.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+
+public class InputOrOutPutkThread implements Runnable {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	private Executor executor;
+
+	private IProEconInputOrOutputSpeedService proEconInputOrOutputSpeedService;
+	private IEdosUtil edosUtil;
+	private ProBasicEquipment wt;
+	private Date begin;
+	private Date end;
+
+
+
+	public InputOrOutPutkThread(Executor executor,  ProBasicEquipment wt,  Date begin, Date end,
+								IProEconInputOrOutputSpeedService proEconInputOrOutputSpeedService,IEdosUtil edosUtil) {
+		this.executor = executor;
+		this.wt = wt;
+		this.begin = begin;
+		this.end = end;
+		this.proEconInputOrOutputSpeedService = proEconInputOrOutputSpeedService;
+		this.edosUtil = edosUtil;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " + wt.getId();
+		logger.info("风机切入切出数据创建任务并提交到线程池中:" + wt.getId());
+		FutureTask<String> futureTask = new FutureTask<String>(new InputOrOutPutThreadPool(task,wt,  begin, end,proEconInputOrOutputSpeedService, edosUtil));
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get();
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		} 
+	}
+}

文件差异内容过多而无法显示
+ 84 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/MainBrownoutsThread.java


文件差异内容过多而无法显示
+ 566 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/MainBrownoutsThreadPool.java


+ 98 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/ShutdownnewThread.java

@@ -0,0 +1,98 @@
+package com.gyee.alarm.task.thread;
+
+import com.gyee.common.model.PointData;
+import com.gyee.alarm.model.auto.ProEconInterruption;
+import com.gyee.alarm.model.auto.ProEconShutdownEvent;
+import com.gyee.alarm.model.auto.ProEconShutdownEvent2;
+import com.gyee.alarm.model.auto.ProEconWindturbineStatus;
+import com.gyee.alarm.service.auto.IProEconInterruptionService;
+import com.gyee.alarm.service.auto.IProEconShutdownEvent2Service;
+import com.gyee.alarm.service.auto.IProEconShutdownEventService;
+import com.gyee.alarm.service.auto.IProEconWindturbineStatusService;
+import com.gyee.alarm.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+
+public class ShutdownnewThread implements Runnable {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	private Executor executor;
+
+
+	private Map<String, ProEconWindturbineStatus> oldStatusMap;
+	private  Map<String, List<PointData>> statusMap;
+
+	private  String windturbineId;
+	private Map<Integer, String> statusDescriptionMap;
+
+	private Map<String, ProEconShutdownEvent> oldShutdownEvent;
+	private Map<String, ProEconInterruption> oldInterrup;
+	private Map<String, ProEconShutdownEvent2> oldShutdownEvent2;
+
+	private Date begin;
+	private  Date end;
+
+	private IEdosUtil edosUtil;
+	private IProEconWindturbineStatusService proEconWindturbineStatusService;
+	private IProEconShutdownEventService proEconShutdownEventService;
+	private IProEconShutdownEvent2Service proEconShutdownEvent2Service;
+	private IProEconInterruptionService proEconInterruptionService;
+
+	public ShutdownnewThread(Executor executor,  Map<String, ProEconWindturbineStatus> oldStatusMap, Map<String, List<PointData>> statusMap, String windturbineId,
+							 Map<Integer, String> statusDescriptionMap, Map<String, ProEconShutdownEvent> oldShutdownEvent,
+							 Map<String, ProEconInterruption> oldInterrup, Map<String, ProEconShutdownEvent2> oldShutdownEvent2,
+							 Date begin, Date end,
+							 IEdosUtil edosUtil,IProEconWindturbineStatusService proEconWindturbineStatusService,
+							 IProEconShutdownEventService proEconShutdownEventService,IProEconShutdownEvent2Service proEconShutdownEvent2Service,
+							 IProEconInterruptionService proEconInterruptionService	) {
+		this.executor = executor;
+		this.oldStatusMap = oldStatusMap;
+		this.statusMap = statusMap;
+		this.windturbineId = windturbineId;
+		this.statusDescriptionMap = statusDescriptionMap;
+		this.oldShutdownEvent = oldShutdownEvent;
+		this.oldInterrup = oldInterrup;
+		this.oldShutdownEvent2 = oldShutdownEvent2;
+		this.begin = begin;
+		this.end = end;
+
+		this.edosUtil = edosUtil;
+		this.proEconWindturbineStatusService = proEconWindturbineStatusService;
+		this.proEconShutdownEventService = proEconShutdownEventService;
+		this.proEconShutdownEvent2Service = proEconShutdownEvent2Service;
+		this.proEconInterruptionService = proEconInterruptionService;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " + windturbineId;
+		logger.info("停机数据创建任务并提交到线程池中:" + windturbineId);
+		FutureTask<String> futureTask = new FutureTask<String>(new ShutdownnewThreadPool(task, oldStatusMap, statusMap, windturbineId,
+				 statusDescriptionMap,oldShutdownEvent,
+				oldInterrup, oldShutdownEvent2,  begin,  end,edosUtil,proEconWindturbineStatusService,
+				 proEconShutdownEventService, proEconShutdownEvent2Service,
+				 proEconInterruptionService	));
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get();
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		} 
+	}
+}

+ 729 - 0
alarm-web/src/main/java/com/gyee/alarm/task/thread/ShutdownnewThreadPool.java

@@ -0,0 +1,729 @@
+package com.gyee.alarm.task.thread;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
+import com.gyee.alarm.init.CacheContext;
+import com.gyee.alarm.model.auto.*;
+import com.gyee.alarm.service.auto.IProEconInterruptionService;
+import com.gyee.alarm.service.auto.IProEconShutdownEvent2Service;
+import com.gyee.alarm.service.auto.IProEconShutdownEventService;
+import com.gyee.alarm.service.auto.IProEconWindturbineStatusService;
+import com.gyee.alarm.util.DateUtils;
+import com.gyee.alarm.util.StringUtils;
+import com.gyee.alarm.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.util.*;
+import java.util.concurrent.Callable;
+
+public class ShutdownnewThreadPool implements Callable<String>, Serializable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+
+	private static final long serialVersionUID = 0;
+
+	// 保存任务所需要的数据
+
+	private Object threadPoolTaskData;
+	private Map<String, ProEconWindturbineStatus> oldStatusMap;
+	private  Map<String, List<PointData>> statusMap;
+
+	private  String windturbineId;
+	private Map<Integer, String> statusDescriptionMap;
+
+	private Map<String, ProEconShutdownEvent> oldShutdownEvent;
+	private Map<String, ProEconInterruption> oldInterrup;
+	private Map<String, ProEconShutdownEvent2> oldShutdownEvent2;
+	private  Date begin;
+	private  Date end;
+
+	private IEdosUtil edosUtil;
+	private IProEconWindturbineStatusService proEconWindturbineStatusService;
+	private IProEconShutdownEventService proEconShutdownEventService;
+	private IProEconShutdownEvent2Service proEconShutdownEvent2Service;
+	private IProEconInterruptionService proEconInterruptionService;
+
+	public ShutdownnewThreadPool(Object tasks,Map<String, ProEconWindturbineStatus> oldStatusMap,Map<String, List<PointData>> statusMap,String windturbineId,
+								   Map<Integer, String> statusDescriptionMap,Map<String, ProEconShutdownEvent> oldShutdownEvent,
+								   Map<String, ProEconInterruption> oldInterrup,
+								 Map<String, ProEconShutdownEvent2> oldShutdownEvent2, Date begin, Date end ,
+								 IEdosUtil edosUtil,IProEconWindturbineStatusService proEconWindturbineStatusService,
+								 IProEconShutdownEventService proEconShutdownEventService,IProEconShutdownEvent2Service proEconShutdownEvent2Service,
+								 IProEconInterruptionService proEconInterruptionService
+	) {
+
+		this.threadPoolTaskData = tasks;
+		this.oldStatusMap = oldStatusMap;
+		this.statusMap = statusMap;
+		this.windturbineId = windturbineId;
+		this.statusDescriptionMap = statusDescriptionMap;
+		this.oldShutdownEvent = oldShutdownEvent;
+		this.oldInterrup = oldInterrup;
+		this.oldShutdownEvent2 = oldShutdownEvent2;
+		this.begin = begin;
+		this.end = end;
+
+		this.edosUtil = edosUtil;
+		this.proEconWindturbineStatusService = proEconWindturbineStatusService;
+		this.proEconShutdownEventService = proEconShutdownEventService;
+		this.proEconShutdownEvent2Service = proEconShutdownEvent2Service;
+		this.proEconInterruptionService = proEconInterruptionService;
+	}
+
+	public synchronized String call() throws Exception {
+
+
+		// 处理一个任务,这里的处理方式太简单了,仅仅是一个打印语句
+
+		//System.out.println("开始执行任务:" + threadPoolTaskData);
+
+		String result = "";
+
+		// //便于观察,等待一段时间
+
+
+
+		try {
+
+
+			Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = CacheContext.wtpAimap.get(windturbineId);
+
+			//取实时状态数据 赋值给status
+
+			if(windturbinetestingpointnewMap.containsKey(ContantXk.MXZT))
+			{
+				ProBasicEquipmentPoint mxztPoint = windturbinetestingpointnewMap.get(ContantXk.MXZT);
+				//获取5分钟没个间隔1秒钟,保证状态与时序库保持一致
+				List<PointData> statusls = edosUtil.getHistoryDatasSnap(mxztPoint.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000,null,1L);
+
+				statusMap.put(windturbineId, statusls);
+			}
+
+			ProEconWindturbineStatus item = oldStatusMap.get(windturbineId);
+			//获取5分钟的状态值
+			List<PointData> statusls=statusMap.get(windturbineId);
+
+			ProEconShutdownEvent shutdwonEvent=null;
+			ProEconInterruption interrup=null;
+			ProEconShutdownEvent2 shutdwonEvent2=null;
+			//记录上次判定的状态值
+			int lastStatus =(int)statusls.get(0).getPointValueInDouble();
+
+			List<ProEconShutdownEvent> shutdwonEventls=new ArrayList<>();
+			List<ProEconInterruption> interrupls=new ArrayList<>();
+			List<ProEconShutdownEvent2> shutdwonEvent2ls=new ArrayList<>();
+			List<ProEconWindturbineStatus> windturbineStatusls=new ArrayList<>();
+
+			for(PointData stpo:statusls)
+			{
+				//获取当前状态
+				Integer currentStatus = (int)stpo.getPointValueInDouble();
+				//获取当前时间
+				Date currentTime=new Date(stpo.getPointTime());
+				//如果数据库中不存在该风机未完成的故障记录,进入
+				if (item == null)
+				{
+
+					item = new ProEconWindturbineStatus();
+
+					initalWindturbineStatus(windturbineId, item, currentStatus, currentTime,stpo);
+
+					if (currentStatus == 4 || currentStatus == 6)
+					{
+						shutdwonEvent=new ProEconShutdownEvent();
+						initalShutdownEvent(windturbineId, item, currentStatus, currentTime, shutdwonEvent);
+
+
+						shutdwonEvent2=new ProEconShutdownEvent2();
+						initalShutdownEvent2(windturbineId, item, currentStatus, currentTime, shutdwonEvent2);
+
+
+						item.setShutdownEventId(shutdwonEvent.getId());
+					}
+					if (currentStatus == 12)
+					{
+						interrup=new ProEconInterruption();
+						initalInterruption(windturbineId, item, currentTime, interrup);
+					}
+
+					//将状态保存到MAP对象中
+					oldStatusMap.put(item.getWindturbineId(),item);
+
+
+					if (shutdwonEvent != null )
+					{
+						oldShutdownEvent.put(item.getWindturbineId(),shutdwonEvent);
+
+					}
+					if (interrup != null)
+					{
+						oldInterrup.put(item.getWindturbineId(),interrup);
+
+					}
+					if (shutdwonEvent2 != null)
+					{
+						oldShutdownEvent2.put(item.getWindturbineId(), shutdwonEvent2);
+					}
+					//将当前状态赋值给过去状态
+					lastStatus=currentStatus;
+				}else  if(lastStatus!=currentStatus)
+				{
+
+					//如果添加了状态值,状态值变化存储,并清空
+					if(oldStatusMap.containsKey(windturbineId))
+					{
+
+						//获取数据库中的状态值,状态值变化存储,并清空
+						item=oldStatusMap.get(windturbineId);
+						if(item==null)
+						{
+							item=new ProEconWindturbineStatus();
+							initalWindturbineStatus(windturbineId, item, currentStatus, currentTime,stpo);
+							oldStatusMap.put(windturbineId,item);
+						}else
+						{
+							finishWindturbineStatus(windturbineStatusls,windturbineId, item, currentStatus, currentTime);
+							item =null;
+							oldStatusMap.put(windturbineId,null);
+						}
+
+
+
+					}
+
+
+					if(oldShutdownEvent.containsKey(windturbineId))
+					{
+						shutdwonEvent=oldShutdownEvent.get(windturbineId);
+
+						if(shutdwonEvent==null)
+						{
+							shutdwonEvent=new ProEconShutdownEvent();
+							initalShutdownEvent(windturbineId, item, currentStatus, currentTime, shutdwonEvent);
+							oldShutdownEvent.put(windturbineId,shutdwonEvent);
+						}else
+						{
+							shutdwonEvent = finishShutdownEvent(shutdwonEventls,windturbineId, shutdwonEvent, currentStatus, currentTime);
+							oldShutdownEvent.put(windturbineId,null);
+						}
+
+
+					}
+					if(oldInterrup.containsKey(windturbineId))
+					{
+						interrup=oldInterrup.get(windturbineId);
+						if(interrup==null)
+						{
+							interrup=new ProEconInterruption();
+							initalInterruption(windturbineId, item, currentTime, interrup);
+							oldInterrup.put(windturbineId,interrup);
+						}else
+						{
+							interrup = finishInterruption(interrupls,windturbineId, interrup, currentStatus, currentTime);
+							oldInterrup.put(windturbineId,null);
+						}
+
+
+					}
+
+					if(oldShutdownEvent2.containsKey(windturbineId))
+					{
+						shutdwonEvent2=oldShutdownEvent2.get(windturbineId);
+						if(shutdwonEvent2==null)
+						{
+							shutdwonEvent2=new ProEconShutdownEvent2();
+							initalShutdownEvent2(windturbineId, item, currentStatus, currentTime, shutdwonEvent2);
+							oldShutdownEvent2.put(windturbineId,shutdwonEvent2);
+						}else
+						{
+							shutdwonEvent2 = finishShutdownEvent2(shutdwonEvent2ls,windturbineId, shutdwonEvent2, currentStatus, currentTime);
+							oldShutdownEvent2.put(windturbineId,null);
+						}
+
+					}
+
+					lastStatus=currentStatus;
+				}
+
+
+
+			}
+			//循环结束落盘,并清空
+			if(oldStatusMap.containsKey(windturbineId))
+			{
+				//获取数据库查询是否有风机对应时间的记录,如果没有写入数据库
+				item=oldStatusMap.get(windturbineId);
+				if(item!=null)
+				{
+					ProEconWindturbineStatus finalItem = item;
+					QueryWrapper<ProEconWindturbineStatus> queryWrapper9 = new QueryWrapper<>();
+					queryWrapper9.eq("stop_Time",finalItem.getStopTime()).eq("windturbine_id",finalItem.getWindturbineId());
+					List<ProEconWindturbineStatus> ls= proEconWindturbineStatusService.list(queryWrapper9);
+//                            .stream().filter(i->i.getWindturbineId().equals(finalItem.getWindturbineId())
+//                                    && i.getStopTime().compareTo(finalItem.getStopTime())==0).collect(Collectors.toList());
+
+					if(ls.isEmpty())
+					{
+						//proEconWindturbineStatusService.save(item);
+
+						windturbineStatusls.add(item);
+
+						oldStatusMap.put(windturbineId,null);
+					}
+				}
+
+
+			}
+
+
+			if(oldShutdownEvent.containsKey(windturbineId))
+			{
+
+				shutdwonEvent=oldShutdownEvent.get(windturbineId);
+
+				if(shutdwonEvent!=null)
+				{
+					ProEconShutdownEvent finalShutdwonEvent = shutdwonEvent;
+					QueryWrapper<ProEconShutdownEvent> queryWrapper5 = new QueryWrapper<>();
+					queryWrapper5.eq("stop_Time",finalShutdwonEvent.getStopTime()).eq("windturbine_id",finalShutdwonEvent.getWindturbineId());
+					List<ProEconShutdownEvent> ls= proEconShutdownEventService.list(queryWrapper5);
+//                            .stream().filter(i->i.getWindturbineId().equals(finalShutdwonEvent.getWindturbineId())
+//                                    && i.getStopTime().compareTo(finalShutdwonEvent.getStopTime())==0)
+//                            .collect(Collectors.toList());
+
+					if(ls.isEmpty())
+					{
+						//proEconShutdownEventService.save(shutdwonEvent);
+						shutdwonEventls.add(shutdwonEvent);
+						oldShutdownEvent.put(windturbineId,null);
+					}
+				}
+
+			}
+			if(oldInterrup.containsKey(windturbineId))
+			{
+
+				interrup=oldInterrup.get(windturbineId);
+
+				if(interrup!=null)
+				{
+					ProEconInterruption finalInterrup = interrup;
+					QueryWrapper<ProEconInterruption> queryWrapper5 = new QueryWrapper<>();
+					queryWrapper5.eq("stop_Time",finalInterrup.getStopTime()).eq("windturbine_id",finalInterrup.getWindturbineId());
+					List<ProEconInterruption> ls= proEconInterruptionService.list(queryWrapper5);
+//                            .stream().filter(i->i.getWindturbineId().equals(finalInterrup.getWindturbineId())
+//                                    && i.getStopTime().compareTo(finalInterrup.getStopTime())==0).collect(Collectors.toList());
+
+					if(ls.isEmpty())
+					{
+						//proEconInterruptionService.save(interrup);
+						interrupls.add(interrup);
+						oldInterrup.put(windturbineId,null);
+					}
+				}
+
+
+			}
+
+			if(oldShutdownEvent2.containsKey(windturbineId))
+			{
+				shutdwonEvent2=oldShutdownEvent2.get(windturbineId);
+
+				if(shutdwonEvent2!=null)
+				{
+					ProEconShutdownEvent2 finalShutdwonEvent1 = shutdwonEvent2;
+					QueryWrapper<ProEconShutdownEvent2> queryWrapper5 = new QueryWrapper<>();
+					queryWrapper5.eq("stop_Time",finalShutdwonEvent1.getStopTime()).eq("windturbine_id",finalShutdwonEvent1.getWindturbineId());
+					List<ProEconShutdownEvent2> ls= proEconShutdownEvent2Service.list(queryWrapper5);
+//                            .stream().filter(i->i.getWindturbineId().equals(finalShutdwonEvent1.getWindturbineId())
+//                                    && i.getStopTime().compareTo(finalShutdwonEvent1.getStopTime())==0).collect(Collectors.toList());
+
+					if(ls.isEmpty())
+					{
+						//proEconShutdownEvent2Service.save(shutdwonEvent2);
+						shutdwonEvent2ls.add(shutdwonEvent2);
+						oldShutdownEvent2.put(windturbineId,null);
+					}
+				}
+
+			}
+
+			if(!windturbineStatusls.isEmpty())
+			{
+				List<ProEconWindturbineStatus> templs=new ArrayList<>();
+				for(ProEconWindturbineStatus vo:windturbineStatusls)
+				{
+					templs.add(vo);
+					if(templs.size()==100)
+					{
+						proEconWindturbineStatusService.saveOrUpdateBatch(templs);
+						templs=new ArrayList<>();
+					}
+				}
+
+				if(!templs.isEmpty())
+				{
+					proEconWindturbineStatusService.saveOrUpdateBatch(templs);
+				}
+			}
+			if(!shutdwonEventls.isEmpty())
+			{
+
+				List<ProEconShutdownEvent> templs=new ArrayList<>();
+				for(ProEconShutdownEvent vo:shutdwonEventls)
+				{
+					templs.add(vo);
+					if(templs.size()==100)
+					{
+						proEconShutdownEventService.saveOrUpdateBatch(templs);
+						templs=new ArrayList<>();
+					}
+				}
+
+				if(!templs.isEmpty())
+				{
+					proEconShutdownEventService.saveOrUpdateBatch(templs);
+				}
+
+			}
+			if(!shutdwonEvent2ls.isEmpty())
+			{
+
+				List<ProEconShutdownEvent2> templs=new ArrayList<>();
+				for(ProEconShutdownEvent2 vo:shutdwonEvent2ls)
+				{
+					templs.add(vo);
+					if(templs.size()==100)
+					{
+						proEconShutdownEvent2Service.saveOrUpdateBatch(templs);
+						templs=new ArrayList<>();
+					}
+				}
+
+				if(!templs.isEmpty())
+				{
+					proEconShutdownEvent2Service.saveOrUpdateBatch(templs);
+				}
+
+			}
+			if(!interrupls.isEmpty())
+			{
+
+				List<ProEconInterruption> templs=new ArrayList<>();
+				for(ProEconInterruption vo:interrupls)
+				{
+					templs.add(vo);
+					if(templs.size()==100)
+					{
+						proEconInterruptionService.saveOrUpdateBatch(templs);
+						templs=new ArrayList<>();
+					}
+				}
+
+				if(!templs.isEmpty())
+				{
+					proEconInterruptionService.saveOrUpdateBatch(templs);
+				}
+
+			}
+
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		threadPoolTaskData = null;
+
+		return result;
+
+	}
+
+
+
+	private ProEconShutdownEvent finishShutdownEvent(List<ProEconShutdownEvent> shutdwonEventls,String windturbineId, ProEconShutdownEvent shutdwonEvent, Integer currentStatus, Date currentTime) throws Exception {
+//        if(currentStatus != 4 && currentStatus != 6)
+//        {
+		shutdwonEvent.setStartTime(currentTime);
+
+		double timehour=DateUtils.hoursDiff2(shutdwonEvent.getStartTime(), shutdwonEvent.getStopTime());
+		shutdwonEvent.setStopHours(timehour);
+		double losspower=calLossPower(windturbineId, shutdwonEvent.getStartTime(), shutdwonEvent.getStopTime());
+		shutdwonEvent.setLossPower(losspower);
+
+		shutdwonEventls.add(shutdwonEvent);
+//		proEconShutdownEventService.saveOrUpdate(shutdwonEvent);
+
+		oldShutdownEvent.put(windturbineId,null);
+		shutdwonEvent =null;
+//        }
+		return shutdwonEvent;
+	}
+
+	private ProEconInterruption finishInterruption(List<ProEconInterruption> interrupls,String windturbineId, ProEconInterruption interrup, Integer currentStatus, Date currentTime) {
+//        if(currentStatus != 12)
+//        {
+		interrup.setStartTime(currentTime);
+		double timehour=DateUtils.hoursDiff2(interrup.getStartTime(), interrup.getStopTime());
+		interrup.setStopHours(timehour);
+
+		interrupls.add(interrup);
+		//proEconInterruptionService.saveOrUpdate(interrup);
+		oldInterrup.put(windturbineId,null);
+		interrup =null;
+//        }
+		return interrup;
+	}
+
+	private ProEconShutdownEvent2 finishShutdownEvent2(List<ProEconShutdownEvent2> shutdwonEvent2ls,String windturbineId, ProEconShutdownEvent2 shutdwonEvent2, Integer currentStatus, Date currentTime) throws Exception {
+//        if(currentStatus != 4 && currentStatus != 6)
+//        {
+		shutdwonEvent2.setStartTime(currentTime);
+
+		double timehour=DateUtils.hoursDiff2(shutdwonEvent2.getStartTime(), shutdwonEvent2.getStopTime());
+		shutdwonEvent2.setStopHours(timehour);
+		double losspower=calLossPower(windturbineId, shutdwonEvent2.getStartTime(), shutdwonEvent2.getStopTime());
+		shutdwonEvent2.setLossPower(losspower);
+
+		if(timehour<=24)
+		{
+			//proEconShutdownEvent2Service.saveOrUpdate(shutdwonEvent2);
+			shutdwonEvent2ls.add(shutdwonEvent2);
+		}else
+		{
+			int days=DateUtils.daysDiff1(shutdwonEvent2.getStartTime(), shutdwonEvent2.getStopTime());
+			Calendar c=Calendar.getInstance();
+			Date startTime=shutdwonEvent2.getStartTime();
+			c.setTime(shutdwonEvent2.getStopTime());
+			c.set(Calendar.HOUR_OF_DAY,23);
+			c.set(Calendar.MINUTE,59);
+			c.set(Calendar.SECOND,59);
+			for(int i=0;i<days;i++)
+			{
+				if(i==0)
+				{
+					shutdwonEvent2.setStartTime(c.getTime());
+					losspower=calLossPower(windturbineId, shutdwonEvent2.getStartTime(), shutdwonEvent2.getStopTime());
+
+				}
+				else {
+					shutdwonEvent2.setStopTime(DateUtils.truncate(c.getTime()));
+					if(i==days-1)
+					{
+						shutdwonEvent2.setStartTime(startTime);
+
+					}else
+					{
+						shutdwonEvent2.setStartTime(c.getTime());
+
+					}
+					losspower=calLossPower(windturbineId, shutdwonEvent2.getStartTime(), shutdwonEvent2.getStopTime());
+				}
+				shutdwonEvent2.setLossPower(losspower);
+//				proEconShutdownEvent2Service.saveOrUpdate(shutdwonEvent2);
+				shutdwonEvent2ls.add(shutdwonEvent2);
+				c.add(Calendar.DAY_OF_MONTH,1);
+			}
+		}
+
+
+		shutdwonEvent2 =null;
+		oldShutdownEvent2.put(windturbineId,null);
+//        }
+		return shutdwonEvent2;
+	}
+
+	private void finishWindturbineStatus(List<ProEconWindturbineStatus> windturbineStatusls,String windturbineId, ProEconWindturbineStatus item, Integer currentStatus, Date currentTime) throws Exception {
+		if(!Objects.equals(item.getSatusCode(), currentStatus))
+		{
+			item.setStartTime(currentTime);
+			double timehour=DateUtils.hoursDiff2(item.getStartTime(), item.getStopTime());
+			item.setStopHours(timehour);
+			double losspower=calLossPower(windturbineId, item.getStartTime(), item.getStopTime());
+			item.setLossPower(losspower);
+			windturbineStatusls.add(item);
+			//proEconWindturbineStatusService.saveOrUpdate(item);
+
+		}
+	}
+
+	private static void initalInterruption(String windturbineId, ProEconWindturbineStatus item, Date stopTime, ProEconInterruption interrup) {
+		interrup.setProjectId(CacheContext.wtmap.get(windturbineId).getProjectId());
+		interrup.setStopTime(stopTime);
+		interrup.setWindpowerstationId(CacheContext.wtmap.get(windturbineId).getWindpowerstationId());
+		interrup.setWindturbineId(windturbineId);
+	}
+
+	private static void initalShutdownEvent2(String windturbineId, ProEconWindturbineStatus item, Integer currentStatus, Date stopTime, ProEconShutdownEvent2 shutdwonEvent2) {
+		shutdwonEvent2.setId(StringUtils.getUUID());
+		shutdwonEvent2.setProjectId(CacheContext.wtmap.get(windturbineId).getProjectId());
+		shutdwonEvent2.setStatusCode(currentStatus);
+		shutdwonEvent2.setStopTime(stopTime);
+		shutdwonEvent2.setWinpowerstationId(CacheContext.wtmap.get(windturbineId).getWindpowerstationId());
+		shutdwonEvent2.setWindturbineId(windturbineId);
+		if (currentStatus == 4)
+		{
+
+			shutdwonEvent2.setStopTypeId("gzbmq");
+			//读取报警记录表前后五分钟数据,选取第一个报警报警类型
+
+			// String stopTypeId =newMethod( windturbineId, begin, end);
+			String stopTypeId=null;
+			if (StringUtils.notEmp(stopTypeId))
+			{
+				shutdwonEvent2.setStopTypeId(stopTypeId);
+
+			}
+		}
+		else
+		{
+			shutdwonEvent2.setStopTypeId("wh");
+
+		}
+	}
+
+	private static void initalShutdownEvent(String windturbineId, ProEconWindturbineStatus item, Integer currentStatus, Date stopTime, ProEconShutdownEvent shutdwonEvent) {
+
+		shutdwonEvent.setId(StringUtils.getUUID());
+		shutdwonEvent.setProjectId(CacheContext.wtmap.get(windturbineId).getProjectId());
+		shutdwonEvent.setStatusCode(currentStatus);
+		shutdwonEvent.setStopTime(stopTime);
+		shutdwonEvent.setWindpowerstationId(CacheContext.wtmap.get(windturbineId).getWindpowerstationId());
+		shutdwonEvent.setWindturbineId(windturbineId);
+		if (currentStatus == 4)
+		{
+
+			shutdwonEvent.setStoptypeId("gzbmq");
+
+			//读取报警记录表前后五分钟数据,选取第一个报警报警类型
+
+			// String stopTypeId =newMethod( windturbineId, begin, end);
+			String stopTypeId=null;
+			if (StringUtils.notEmp(stopTypeId))
+			{
+				shutdwonEvent.setStoptypeId(stopTypeId);
+
+			}
+		}
+		else
+		{
+			shutdwonEvent.setStoptypeId("wh");
+
+		}
+	}
+
+	private void initalWindturbineStatus(String windturbineId, ProEconWindturbineStatus item, Integer currentStatus, Date stopTime,PointData stpo) {
+		item.setProjectId(CacheContext.wtmap.get(windturbineId).getProjectId());
+		item.setSatusCode(currentStatus);
+		item.setStatusDesc(statusDescriptionMap.get((int)stpo.getPointValueInDouble()));
+		item.setStopTime(stopTime);
+		item.setWindpowerstationId(CacheContext.wtmap.get(windturbineId).getWindpowerstationId());
+		item.setWindturbineId(windturbineId);
+	}
+
+
+	private  String newMethod( String windturbineId, Date begin, Date end)
+	{
+		String result = "";
+
+		return result;
+	}
+
+
+	private Double calLossPower(String windturbineId, Date startDate, Date endDate) throws Exception {
+		double result = 0.0;
+
+		Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
+		Map<String, ProBasicEquipmentPoint> wtpointmap=wtpAimap.get(windturbineId);
+
+		Calendar c1=Calendar.getInstance();
+		c1.setTime(startDate);
+		Calendar c2=Calendar.getInstance();
+		c2.setTime(endDate);
+		//判定限电是否跨年
+		if(endDate.after(startDate) && c1.get(Calendar.YEAR)==c2.get(Calendar.YEAR))
+		{
+			//年故障损失电量
+			if(wtpointmap.containsKey(ContantXk.NGZSSDL) )
+			{
+				double beginvalue;
+				double endvalue;
+
+				List<String> pointid=new ArrayList<>();
+				pointid.add(wtpointmap.get(ContantXk.NGZSSDL).getNemCode());
+				List<PointData> xdbegin=edosUtil.getHistMatrix(pointid,startDate.getTime()/1000);
+				List<PointData> xdend=edosUtil.getHistMatrix(pointid,endDate.getTime()/1000);
+
+
+				if(xdbegin.size()==1 && xdend.size()==1)
+				{
+					beginvalue=xdbegin.get(0).getPointValueInDouble();
+					endvalue=xdend.get(0).getPointValueInDouble();
+
+					if (endvalue > beginvalue) {
+						result =result+(endvalue - beginvalue);
+					}
+				}
+			}
+
+
+		}else
+		{
+			Calendar c=Calendar.getInstance();
+			c.setTime(DateUtils.truncate(startDate));
+			c.add(Calendar.DAY_OF_MONTH,1);
+			//获得1月1日零点值
+			Date endtime=c.getTime();
+			//年故障损失电量
+			if(wtpointmap.containsKey(ContantXk.NGZSSDL) )
+			{
+				double beginvalue;
+				double endvalue;
+
+
+
+				List<String> pointid=new ArrayList<>();
+				pointid.add(wtpointmap.get(ContantXk.NGZSSDL).getNemCode());
+				List<PointData> xdbegin=edosUtil.getHistMatrix(pointid,startDate.getTime()/1000);
+				List<PointData> xdend=edosUtil.getHistMatrix(pointid,endtime.getTime()/1000);
+
+
+				if(xdbegin.size()==1 && xdend.size()==1)
+				{
+					beginvalue=xdbegin.get(0).getPointValueInDouble();
+					endvalue=xdend.get(0).getPointValueInDouble();
+
+					if (endvalue > beginvalue) {
+						result =result+(endvalue - beginvalue);
+					}
+				}
+			}
+
+			//日故障损失电量
+			if(wtpointmap.containsKey(ContantXk.NGZSSDL) )
+			{
+
+				double endvalue;
+
+				List<String> pointid=new ArrayList<>();
+				pointid.add(wtpointmap.get(ContantXk.NGZSSDL).getNemCode());
+				List<PointData> xdend=edosUtil.getHistMatrix(pointid,startDate.getTime()/1000);
+
+				if(xdend.size()==1)
+				{
+
+					endvalue=xdend.get(0).getPointValueInDouble();
+
+					if (endvalue > 0) {
+						result =result+endvalue;
+					}
+				}
+			}
+
+		}
+
+		return result;
+
+	}
+}