|
@@ -40,44 +40,93 @@ public class InputOrOutPutService {
|
|
|
@Value("${frequency.cutinandout}")
|
|
|
private Integer frequency;
|
|
|
|
|
|
+ private static Map<String, Double> statusRanngMap;
|
|
|
|
|
|
|
|
|
- public void inputOrOutputSpeed(Date recordDate) throws Exception {
|
|
|
|
|
|
-// Date begin = DateUtils.addSeconds(recordDate, -60);
|
|
|
-//
|
|
|
- Date begin = DateUtils.addSeconds(recordDate, -frequency);
|
|
|
- Date end = recordDate;
|
|
|
- Map<String, ProEconInputOrOutputSpeed> wtTimeStatusMap=new HashMap<>();
|
|
|
- Map<String,Double> wtLastStatusMap=new HashMap<>();
|
|
|
+ public void initialInputOrOutputSpeed()
|
|
|
+ {
|
|
|
+ statusRanngMap=new HashMap<>();
|
|
|
+ List<ProBasicEquipment> wtls= new ArrayList<>();
|
|
|
+ for(ProBasicPowerstation wp: CacheContext.wpls)
|
|
|
+ {
|
|
|
+ if(wp.getId().contains("FDC") )
|
|
|
+ {
|
|
|
+ wtls.addAll(CacheContext.wpwtmap.get(wp.getId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- QueryWrapper<ProEconInputOrOutputSpeed> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.ge("record_date",begin).le("record_date",end);
|
|
|
- queryWrapper.orderByAsc("record_date");
|
|
|
- List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list(queryWrapper);
|
|
|
+ List<ProEconInputOrOutputSpeed> ls=new ArrayList<>();
|
|
|
|
|
|
- Map<String, Map<String,ProEconInputOrOutputSpeed>> statusMap=new HashMap<>();
|
|
|
- if(!recordList.isEmpty())
|
|
|
+
|
|
|
+ List<String> mxztls=new ArrayList<>();
|
|
|
+ List<String> ssfsls=new ArrayList<>();
|
|
|
+ for (ProBasicEquipment wt: wtls)
|
|
|
{
|
|
|
- for(ProEconInputOrOutputSpeed po:recordList)
|
|
|
+
|
|
|
+ Map<String, ProBasicEquipmentPoint> pointmap= CacheContext.wtpAimap.get(wt.getId());
|
|
|
+
|
|
|
+ ProBasicEquipmentPoint mxzt= pointmap.get(ContantXk.SBZT);
|
|
|
+ mxztls.add(mxzt.getNemCode());
|
|
|
+ ProBasicEquipmentPoint ssfs= pointmap.get(ContantXk.CJ_SSFS);
|
|
|
+ ssfsls.add(ssfs.getNemCode());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ try {
|
|
|
+ List<PointData> mxztvaluels = edosUtil.getRealData(mxztls);
|
|
|
+
|
|
|
+ if(!mxztvaluels.isEmpty() && mxztvaluels.size()==wtls.size())
|
|
|
{
|
|
|
- if(statusMap.containsKey(po.getWindturbineId()))
|
|
|
+ for (int i=0;i<wtls.size();i++)
|
|
|
{
|
|
|
- Map<String, ProEconInputOrOutputSpeed> map= statusMap.get(po.getWindturbineId());
|
|
|
- map.put(String.valueOf(po.getRecordDate().getTime()),po);
|
|
|
- }else
|
|
|
- {
|
|
|
- Map<String, ProEconInputOrOutputSpeed> map= new HashMap<>();
|
|
|
- map.put(String.valueOf(po.getRecordDate().getTime()),po);
|
|
|
- statusMap.put(po.getWindturbineId(),map);
|
|
|
- }
|
|
|
|
|
|
+ ProBasicEquipment wt=wtls.get(i);
|
|
|
+ statusRanngMap.put(wt.getId(),mxztvaluels.get(i).getPointValueInDouble());
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ public void inputOrOutputSpeed(Date recordDate) throws Exception {
|
|
|
+
|
|
|
+// Date begin = DateUtils.addSeconds(recordDate, -60);
|
|
|
+//
|
|
|
+// Date begin = DateUtils.addHours(recordDate, -frequency);
|
|
|
+// Date end = recordDate;
|
|
|
+// Map<String, ProEconInputOrOutputSpeed> wtTimeStatusMap=new HashMap<>();
|
|
|
+// Map<String,Double> wtLastStatusMap=new HashMap<>();
|
|
|
+//
|
|
|
+// QueryWrapper<ProEconInputOrOutputSpeed> queryWrapper = new QueryWrapper<>();
|
|
|
+// queryWrapper.ge("record_date",begin).le("record_date",end);
|
|
|
+// queryWrapper.orderByAsc("record_date");
|
|
|
+// List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list(queryWrapper);
|
|
|
+//
|
|
|
+// Map<String, Map<String,ProEconInputOrOutputSpeed>> statusMap=new HashMap<>();
|
|
|
+// if(!recordList.isEmpty())
|
|
|
+// {
|
|
|
+// for(ProEconInputOrOutputSpeed po:recordList)
|
|
|
+// {
|
|
|
+// if(statusMap.containsKey(po.getWindturbineId()))
|
|
|
+// {
|
|
|
+// Map<String, ProEconInputOrOutputSpeed> map= statusMap.get(po.getWindturbineId());
|
|
|
+// map.put(String.valueOf(po.getRecordDate().getTime()),po);
|
|
|
+// }else
|
|
|
+// {
|
|
|
+// Map<String, ProEconInputOrOutputSpeed> map= new HashMap<>();
|
|
|
+// map.put(String.valueOf(po.getRecordDate().getTime()),po);
|
|
|
+// statusMap.put(po.getWindturbineId(),map);
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
List<ProBasicEquipment> wtls= new ArrayList<>();
|
|
|
for(ProBasicPowerstation wp: CacheContext.wpls)
|
|
|
{
|
|
|
- if(wp.getId().contains("FDC") && !wp.getId().contains("MLJ") )
|
|
|
+ if(wp.getId().contains("FDC") )
|
|
|
{
|
|
|
wtls.addAll(CacheContext.wpwtmap.get(wp.getId()));
|
|
|
}
|
|
@@ -99,72 +148,87 @@ public class InputOrOutPutService {
|
|
|
ssfsls.add(ssfs.getNemCode());
|
|
|
}
|
|
|
|
|
|
- Calendar c=Calendar.getInstance();
|
|
|
- c.setTime(recordDate);
|
|
|
- c.add(Calendar.SECOND,-1);
|
|
|
|
|
|
- List<PointData> mxztlastvaluels = edosUtil.getHistMatrix(mxztls,c.getTime().getTime()/1000);
|
|
|
+
|
|
|
+
|
|
|
List<PointData> mxztvaluels = edosUtil.getRealData(mxztls);
|
|
|
List<PointData> ssfsvaluels = edosUtil.getRealData(ssfsls);
|
|
|
|
|
|
- if(ssfsvaluels.size() == mxztlastvaluels.size() && ssfsvaluels.size() == mxztvaluels.size() && ssfsvaluels.size()==wtls.size())
|
|
|
+ if(ssfsvaluels.size() == mxztvaluels.size() && ssfsvaluels.size()==wtls.size())
|
|
|
{
|
|
|
for (int i=0;i<wtls.size();i++)
|
|
|
{
|
|
|
- ProBasicEquipment wt=wtls.get(i);
|
|
|
|
|
|
- double lastStatus=StringUtils.round(mxztlastvaluels.get(i).getPointValueInDouble(),0);
|
|
|
+
|
|
|
+ ProBasicEquipment wt=wtls.get(i);
|
|
|
double status=StringUtils.round(mxztvaluels.get(i).getPointValueInDouble(),0);
|
|
|
- PointData ssfspo=ssfsvaluels.get(i);
|
|
|
- // 切入切出风速
|
|
|
- if (lastStatus == StatusValue.DJ.getCode() && status == StatusValue.YX.getCode())
|
|
|
+ if(null !=statusRanngMap)
|
|
|
{
|
|
|
- ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
|
|
|
-
|
|
|
- input.setWindturbineId(wt.getId());
|
|
|
- input.setWindpowerstationId(wt.getWindpowerstationId());
|
|
|
- input.setProjectId(wt.getProjectId());
|
|
|
- input.setLineId(wt.getLineId());
|
|
|
- input.setRecordDate(new Date());
|
|
|
- input.setInputOrOutput(1);
|
|
|
+ double lastStatus=StringUtils.round( statusRanngMap.get(wt.getId()),0);
|
|
|
|
|
|
+ PointData ssfspo=ssfsvaluels.get(i);
|
|
|
+ // 切入切出风速
|
|
|
+ if (lastStatus == StatusValue.DJ.getCode() && status == StatusValue.YX.getCode())
|
|
|
+ {
|
|
|
+ ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
|
|
|
|
|
|
- input.setSpeed(StringUtils.round(ssfspo.getPointValueInDouble(),2));
|
|
|
+ input.setWindturbineId(wt.getId());
|
|
|
+ input.setWindpowerstationId(wt.getWindpowerstationId());
|
|
|
+ input.setProjectId(wt.getProjectId());
|
|
|
+ input.setLineId(wt.getLineId());
|
|
|
+ input.setRecordDate(DateUtils.truncate(new Date()));
|
|
|
+ input.setInputOrOutput(1);
|
|
|
|
|
|
|
|
|
- if(statusMap.containsKey(wt.getId()))
|
|
|
- {
|
|
|
- Map<String, ProEconInputOrOutputSpeed> map= statusMap.get(wt.getId());
|
|
|
+ input.setSpeed(StringUtils.round(ssfspo.getPointValueInDouble(),2));
|
|
|
|
|
|
- if(!map.containsKey(String.valueOf(ssfspo.getPointTime())) )
|
|
|
- {
|
|
|
- ls.add(input);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
- else if (lastStatus == StatusValue.YX.getCode() && status== StatusValue.DJ.getCode())
|
|
|
- {
|
|
|
- ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
|
|
|
- input.setWindturbineId(wt.getId());
|
|
|
- input.setWindpowerstationId(wt.getWindpowerstationId());
|
|
|
- input.setProjectId(wt.getProjectId());
|
|
|
- input.setLineId(wt.getLineId());
|
|
|
- input.setRecordDate(new Date());
|
|
|
- input.setInputOrOutput(0);
|
|
|
+// if(statusMap.containsKey(wt.getId()))
|
|
|
+// {
|
|
|
+// Map<String, ProEconInputOrOutputSpeed> map= statusMap.get(wt.getId());
|
|
|
+//
|
|
|
+// if(!map.containsKey(String.valueOf(ssfspo.getPointTime())) )
|
|
|
+// {
|
|
|
+// ls.add(input);
|
|
|
+// }
|
|
|
+// }else {
|
|
|
+// ls.add(input);
|
|
|
+// }
|
|
|
|
|
|
- input.setSpeed(StringUtils.round(ssfspo.getPointValueInDouble(),2));
|
|
|
+ ls.add(input);
|
|
|
|
|
|
- if(statusMap.containsKey(wt.getId()))
|
|
|
+ }
|
|
|
+ else if (lastStatus == StatusValue.YX.getCode() && status== StatusValue.DJ.getCode())
|
|
|
{
|
|
|
- Map<String, ProEconInputOrOutputSpeed> map= statusMap.get(wt.getId());
|
|
|
+ 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()));
|
|
|
+ input.setInputOrOutput(0);
|
|
|
+
|
|
|
+ input.setSpeed(StringUtils.round(ssfspo.getPointValueInDouble(),2));
|
|
|
|
|
|
- if(!map.containsKey(String.valueOf(ssfspo.getPointTime())) )
|
|
|
- {
|
|
|
- ls.add(input);
|
|
|
- }
|
|
|
+// if(statusMap.containsKey(wt.getId()))
|
|
|
+// {
|
|
|
+// Map<String, ProEconInputOrOutputSpeed> map= statusMap.get(wt.getId());
|
|
|
+//
|
|
|
+// if(!map.containsKey(String.valueOf(ssfspo.getPointTime())) )
|
|
|
+// {
|
|
|
+// ls.add(input);
|
|
|
+// }
|
|
|
+// }else
|
|
|
+// {
|
|
|
+// ls.add(input);
|
|
|
+// }
|
|
|
+
|
|
|
+ ls.add(input);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ statusRanngMap.put(wt.getId(),status);
|
|
|
}
|
|
|
}
|
|
|
// for (ProBasicEquipment wt: wtls) {
|