|
@@ -5,20 +5,17 @@ import com.github.pagehelper.PageInfo;
|
|
|
import com.gyee.frame.common.dao.IRealTimeDataBaseUtil;
|
|
|
import com.gyee.frame.common.dao.golden.EdosUtil;
|
|
|
import com.gyee.frame.common.spring.Constant;
|
|
|
-import com.gyee.frame.common.spring.InitialRunner;
|
|
|
import com.gyee.frame.mapper.auto.WindturbinegoodnessMapper;
|
|
|
import com.gyee.frame.model.auto.WindTurbineTestingPointAi2;
|
|
|
import com.gyee.frame.model.auto.Windturbinegoodness;
|
|
|
import com.gyee.frame.model.auto.WindturbinegoodnessExample;
|
|
|
-import com.gyee.frame.model.custom.DataVo;
|
|
|
-import com.gyee.frame.model.custom.PointData;
|
|
|
-import com.gyee.frame.model.custom.Tablepar;
|
|
|
+import com.gyee.frame.model.custom.*;
|
|
|
+import com.gyee.frame.service.WindTurbineTestingPointAiService;
|
|
|
import com.gyee.frame.util.DateUtils;
|
|
|
import com.gyee.frame.util.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.text.SimpleDateFormat;
|
|
@@ -35,8 +32,11 @@ public class WindturbinegoodnessService {
|
|
|
@Resource
|
|
|
private WindturbinegoodnessMapper windturbinegoodnessMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private WindTurbineTestingPointAiService windTurbineTestingPointAiService;
|
|
|
+
|
|
|
IRealTimeDataBaseUtil realApiUtil = new EdosUtil();
|
|
|
-
|
|
|
+
|
|
|
public PageInfo<Windturbinegoodness> windturbinegoodnessList(Tablepar tablepar, String wpId, String recorddate) {
|
|
|
|
|
|
WindturbinegoodnessExample example = new WindturbinegoodnessExample();
|
|
@@ -77,124 +77,143 @@ public class WindturbinegoodnessService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public String getplotBands(String wtId, Date recorddate, HttpServletRequest request) throws Exception {
|
|
|
+ public List<List<EchartDataVo>> getplotBands(String wtId, Date recorddate) throws Exception {
|
|
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- SimpleDateFormat sdfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
|
|
|
+ SimpleDateFormat sdf2 = new SimpleDateFormat("YYYY-MM-DD HH:mm");
|
|
|
+ Calendar c = Calendar.getInstance();
|
|
|
+ c.setTime(recorddate);
|
|
|
+ c.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ c.set(Calendar.MINUTE, 0);
|
|
|
+ c.set(Calendar.SECOND, 0);
|
|
|
+ c.set(Calendar.MILLISECOND,0);
|
|
|
|
|
|
- List<Long> from = new ArrayList<Long>();
|
|
|
- List<Long> to = new ArrayList<Long>();
|
|
|
- List<Integer> ztls = new ArrayList<Integer>();
|
|
|
- Date endDate = sdfs.parse(sdf.format(DateUtils.addDays(recorddate, 1)) + " 00:06:00");
|
|
|
- Date beginDate = sdfs.parse(sdf.format(recorddate) + " 01:00:00");
|
|
|
|
|
|
- int length = 230;
|
|
|
+ Date beginDate = c.getTime();
|
|
|
+ c.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
+ Date endDate = c.getTime();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ List<String> xtime=new ArrayList<>();
|
|
|
+ List<EchartDataVo> vos=new ArrayList<>();
|
|
|
+ List<List<EchartDataVo>> resultvos=new ArrayList<>();
|
|
|
+ Map<String,String> map=new HashMap<>();
|
|
|
+ int length = 240;
|
|
|
String plotBands = null;
|
|
|
StringBuilder sb = new StringBuilder("");
|
|
|
- Map<String, WindTurbineTestingPointAi2> map = InitialRunner.wtpAimap.get(wtId);
|
|
|
|
|
|
- WindTurbineTestingPointAi2 fjzt = map.get(Constant.FJZT);
|
|
|
- Map<String, Map<String, Double>> plotBandMap = new HashMap<String, Map<String, Double>>();
|
|
|
- try {
|
|
|
+ WindTurbineTestingPointAi2 fjzt = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.FJZT);
|
|
|
+
|
|
|
+ String beginTime=null;
|
|
|
+ String endTime=null;
|
|
|
+ String time=null;
|
|
|
|
|
|
if (null != fjzt) {
|
|
|
List<PointData> fjztls = realApiUtil.getHistoryDatasSnap(fjzt, beginDate.getTime() / 1000, endDate.getTime() / 1000, (long) length, 360L);
|
|
|
|
|
|
|
|
|
+ int zt = 0;
|
|
|
for (int i = 0; i < fjztls.size(); i++) {
|
|
|
- if (i < fjztls.size() ) {
|
|
|
- from.add(fjztls.get(i).getPointTime() * 1000);
|
|
|
- ztls.add(Double.valueOf(fjztls.get(i).getPointValueInDouble()).intValue());
|
|
|
- }
|
|
|
-
|
|
|
- to.add(fjztls.get(i).getPointTime() * 1000);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- Integer state = ztls.get(0);
|
|
|
- double begin = -1;
|
|
|
- double end = 0.1;
|
|
|
- int beginnum = 0;
|
|
|
- int endnum = 1;
|
|
|
- StringBuilder temp = new StringBuilder();
|
|
|
-
|
|
|
- for (int i = 0; i < length; i++) {
|
|
|
-
|
|
|
- Integer zt = ztls.get(i);
|
|
|
- if (i < length - 1) {
|
|
|
- zt = ztls.get(i + 1);
|
|
|
- }
|
|
|
-
|
|
|
- if (StringUtils.notEmp(zt)) {
|
|
|
- if (zt != state) {
|
|
|
- sb.append("{");
|
|
|
- sb.append("id: '").append(i).append("',");
|
|
|
- sb.append(getColor(temp, state));
|
|
|
- state = zt;
|
|
|
- sb.append("from: ").append(begin).append(",");
|
|
|
- Date begindate = new Date(from.get(beginnum));
|
|
|
- if (i != 0) {
|
|
|
- begin = end;
|
|
|
- beginnum = endnum;
|
|
|
- end = end + 0.1;
|
|
|
- endnum++;
|
|
|
+ if (i < fjztls.size()) {
|
|
|
+
|
|
|
+ PointData pd=fjztls.get(i);
|
|
|
+ int zttemp = Double.valueOf(pd.getPointValueInDouble()).intValue();
|
|
|
+ Date resultDate = new Date(pd.getPointTime() * 1000);
|
|
|
+ beginTime = sdf.format(resultDate);
|
|
|
+ time=sdf2.format(resultDate);
|
|
|
+ xtime.add(beginTime);
|
|
|
+ if (i == 0) {
|
|
|
+ zt = zttemp;
|
|
|
+ EchartDataVo vo = new EchartDataVo();
|
|
|
+ vo.setxAxis(beginTime);
|
|
|
+ vo.setTime(time);
|
|
|
+ vo.setName(judgeSatte(zttemp));
|
|
|
+ vos.add(vo);
|
|
|
} else {
|
|
|
- begin = 0.0;
|
|
|
- }
|
|
|
- sb.append("to: ").append(end);
|
|
|
- sb.append(", events: { click: function (e) {plotBandAjax(" + i + ");}}},");
|
|
|
-
|
|
|
- Date enddate = new Date(to.get(endnum));
|
|
|
+ if (zt != zttemp) {
|
|
|
+ zt = zttemp;
|
|
|
+ c = Calendar.getInstance();
|
|
|
+ c.setTime(resultDate);
|
|
|
+ c.add(Calendar.MINUTE, -6);
|
|
|
+ endTime = sdf.format(c.getTime());
|
|
|
+ time=sdf2.format(c.getTime());
|
|
|
+ EchartDataVo vo = new EchartDataVo();
|
|
|
+ vo.setxAxis(endTime);
|
|
|
+ vo.setTime(time);
|
|
|
+ vos.add(vo);
|
|
|
+ if (vos.size() == 2) {
|
|
|
+ resultvos.add(vos);
|
|
|
+ vos = new ArrayList<>();
|
|
|
+ vo = new EchartDataVo();
|
|
|
+ vo.setxAxis(beginTime);
|
|
|
+ vo.setTime(sdf2.format(resultDate));
|
|
|
+ vo.setName(judgeSatte(zttemp));
|
|
|
+ vos.add(vo);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- plotBandMap.put(String.valueOf(i), getPlotBand(map, begindate, enddate));
|
|
|
+ }
|
|
|
|
|
|
- } else {
|
|
|
- end = end + 0.1;
|
|
|
- endnum++;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
- sb.append("{");
|
|
|
- sb.append("id: '230' ,");
|
|
|
- sb.append(getColor(temp, state));
|
|
|
- sb.append("from: ").append(begin).append(",");
|
|
|
- sb.append("to: ").append(end);
|
|
|
- sb.append(", events: { click: function (e) {plotBandAjax(230); }}},");
|
|
|
- Date begindate = new Date(from.get(beginnum));
|
|
|
- Date enddate = new Date(to.get(229));
|
|
|
- plotBandMap.put(String.valueOf(230), getPlotBand(map, begindate, enddate));
|
|
|
- // ////////////////////////////////////////////////
|
|
|
-
|
|
|
- if (sb.length() >= 1) {
|
|
|
- plotBands = sb.substring(0, sb.length() - 1);
|
|
|
}
|
|
|
- } catch (Exception ex) {
|
|
|
- ex.printStackTrace();
|
|
|
- }
|
|
|
- request.getSession().setAttribute("plotBandMap", plotBandMap);
|
|
|
-
|
|
|
- // sb.append("]");
|
|
|
- // plotBands = String.valueOf(sb);
|
|
|
- return plotBands;
|
|
|
+ return resultvos;
|
|
|
}
|
|
|
|
|
|
- public Map<String, Double> getPlotBand(Map<String, WindTurbineTestingPointAi2> map, Date begindate, Date enddate) throws Exception {
|
|
|
- WindTurbineTestingPointAi2 fdlAi = map.get(Constant.TPOINT_WT_RFDL);
|
|
|
- WindTurbineTestingPointAi2 fsAi = map.get(Constant.TPOINT_WT_FJSSFS);
|
|
|
- WindTurbineTestingPointAi2 llfdlAi = map.get(Constant.TPOINT_WT_RFDLBZ);
|
|
|
- WindTurbineTestingPointAi2 glAi = map.get(Constant.TPOINT_WT_FJGL);
|
|
|
- WindTurbineTestingPointAi2 fjztAi = map.get(Constant.FJZT);
|
|
|
+ private String judgeSatte(int zt)
|
|
|
+ {
|
|
|
+ String ztname=null;
|
|
|
+ switch ( zt ) {
|
|
|
+ case 0:
|
|
|
+ ztname= "待机";
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ ztname= "运行";
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ ztname= "故障";
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ ztname= "中断";
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ ztname= "维护";
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ ztname= "限电停机";
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ ztname= "限电出力";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+
|
|
|
+ }
|
|
|
+ return ztname;
|
|
|
+ }
|
|
|
|
|
|
- Map<String, Double> tempmap = new HashMap<String, Double>();
|
|
|
+ public Map<String, String> getPlotBand(String wtId , String begin, String end) throws Exception {
|
|
|
+ WindTurbineTestingPointAi2 fdlAi =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.TPOINT_WT_RFDL);
|
|
|
+ WindTurbineTestingPointAi2 fsAi = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.TPOINT_WT_FJSSFS);
|
|
|
+ WindTurbineTestingPointAi2 llfdlAi =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.TPOINT_WT_RFDLBZ);
|
|
|
+ WindTurbineTestingPointAi2 glAi = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.TPOINT_WT_FJGL);
|
|
|
+ WindTurbineTestingPointAi2 fjztAi =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.FJZT);
|
|
|
+ String sdf = "yyyy-MM-dd HH:mm";
|
|
|
+ Date begindate=DateUtils.parseStrtoDate(begin,sdf);
|
|
|
+ Date enddate=DateUtils.parseStrtoDate(end,sdf);
|
|
|
+ Map<String, String> tempmap = new HashMap<String, String>();
|
|
|
|
|
|
// 发电量
|
|
|
double beginfdl = 0.0;
|
|
|
double endfdl = 0.0;
|
|
|
double fdl = 0.0;
|
|
|
+
|
|
|
+// String[] id=new String[1];
|
|
|
+// DNAVal[] val= realApiUtil.getHistMatrix(id,begindate.getTime() / 1000);
|
|
|
+// beginfdl=val[0].DValue;
|
|
|
+// val= realApiUtil.getHistMatrix(id,enddate.getTime() / 1000);
|
|
|
+// endfdl=val[0].DValue;
|
|
|
List<PointData> beginfdlls = realApiUtil.getHistoryDatasSnap(fdlAi,
|
|
|
begindate.getTime() / 1000, begindate.getTime() / 1000,
|
|
|
(long) 1, 3600L);
|
|
@@ -209,7 +228,7 @@ public class WindturbinegoodnessService {
|
|
|
}
|
|
|
fdl = endfdl - beginfdl;
|
|
|
|
|
|
- tempmap.put("fdl", StringUtils.round(fdl, 2));
|
|
|
+ tempmap.put("fdl", String.valueOf(StringUtils.round(fdl, 2)));
|
|
|
// 理论电量
|
|
|
double beginllfdl = 0.0;
|
|
|
double endllfdl = 0.0;
|
|
@@ -230,16 +249,17 @@ public class WindturbinegoodnessService {
|
|
|
// llfdl=new BigDecimal(llfdl).multiply(new
|
|
|
// BigDecimal(10000)).doubleValue();
|
|
|
|
|
|
- tempmap.put("llfdl", StringUtils.round(llfdl, 2));
|
|
|
+ tempmap.put("llfdl", String.valueOf(StringUtils.round(llfdl, 2)));
|
|
|
|
|
|
// 风机状态
|
|
|
- double fjzt = 0.0;
|
|
|
+ int fjzt = 0;
|
|
|
List<PointData> fjztls = realApiUtil.getHistoryDatasSnap(fjztAi,
|
|
|
begindate.getTime() / 1000, enddate.getTime() / 1000, (long) 1,
|
|
|
3600L);
|
|
|
if (!fjztls.isEmpty()) {
|
|
|
- fjzt = fjztls.get(0).getPointValueInDouble();
|
|
|
- tempmap.put("fjzt", fjzt);
|
|
|
+ fjzt = Double.valueOf(fjztls.get(0).getPointValueInDouble()).intValue();
|
|
|
+
|
|
|
+ tempmap.put("fjzt", judgeSatte(fjzt));
|
|
|
|
|
|
}
|
|
|
|
|
@@ -262,7 +282,7 @@ public class WindturbinegoodnessService {
|
|
|
double fstemp = new BigDecimal(fs).divide(
|
|
|
new BigDecimal(time1.doubleValue()), 2,
|
|
|
RoundingMode.HALF_EVEN).doubleValue();
|
|
|
- tempmap.put("fs", StringUtils.round(fstemp, 2));
|
|
|
+ tempmap.put("fs", String.valueOf(StringUtils.round(fstemp, 2)));
|
|
|
}
|
|
|
// 功率
|
|
|
double gl = 0.0;
|
|
@@ -282,21 +302,21 @@ public class WindturbinegoodnessService {
|
|
|
double gltemp = new BigDecimal(gl).divide(
|
|
|
new BigDecimal(time2.doubleValue()), 2,
|
|
|
RoundingMode.HALF_EVEN).doubleValue();
|
|
|
- tempmap.put("gl", StringUtils.round(gltemp, 2));
|
|
|
+ tempmap.put("gl", String.valueOf(StringUtils.round(gltemp, 2)));
|
|
|
}
|
|
|
// 时长
|
|
|
- tempmap.put("sc", StringUtils.round(DateUtils.hoursDiff2(begindate, enddate), 2));
|
|
|
+ tempmap.put("sc", String.valueOf(StringUtils.round(DateUtils.hoursDiff2(begindate, enddate), 2)));
|
|
|
|
|
|
// 损失电量
|
|
|
|
|
|
if (fjzt != 1) {
|
|
|
fdl = 0.0;
|
|
|
- tempmap.put("fdl", 0.0);
|
|
|
- tempmap.put("gl", 0.0);
|
|
|
+ tempmap.put("fdl", "0.0");
|
|
|
+ tempmap.put("gl", "0.0");
|
|
|
}
|
|
|
- tempmap.put("ssdl", StringUtils.round(llfdl - fdl, 2));
|
|
|
- tempmap.put("ks", Double.valueOf(begindate.getTime()));
|
|
|
- tempmap.put("js", Double.valueOf(enddate.getTime()));
|
|
|
+ tempmap.put("ssdl", String.valueOf(StringUtils.round(llfdl - fdl, 2)));
|
|
|
+ tempmap.put("ks", begin);
|
|
|
+ tempmap.put("js", end);
|
|
|
return tempmap;
|
|
|
}
|
|
|
|
|
@@ -360,14 +380,14 @@ public class WindturbinegoodnessService {
|
|
|
vos.add(vo);
|
|
|
}
|
|
|
|
|
|
- Map<String, WindTurbineTestingPointAi2> map = InitialRunner.wtpAimap.get(wtId);
|
|
|
|
|
|
- WindTurbineTestingPointAi2 fdl = map.get(Constant.TPOINT_WT_RFDL);
|
|
|
- WindTurbineTestingPointAi2 whss = map.get(Constant.RJXSSDL);
|
|
|
- WindTurbineTestingPointAi2 gzss = map.get(Constant.RGZSSDL);
|
|
|
- WindTurbineTestingPointAi2 xdss = map.get(Constant.RXDSSDL);
|
|
|
- WindTurbineTestingPointAi2 qfss = map.get(Constant.RQFSSDL);
|
|
|
- WindTurbineTestingPointAi2 fs = map.get(Constant.TPOINT_WT_FJSSFS);
|
|
|
+
|
|
|
+ WindTurbineTestingPointAi2 fdl =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.TPOINT_WT_RFDL);
|
|
|
+ WindTurbineTestingPointAi2 whss =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.RJXSSDL);
|
|
|
+ WindTurbineTestingPointAi2 gzss =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.RGZSSDL);
|
|
|
+ WindTurbineTestingPointAi2 xdss =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.RXDSSDL);
|
|
|
+ WindTurbineTestingPointAi2 qfss =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.RQFSSDL);
|
|
|
+ WindTurbineTestingPointAi2 fs =windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtId,Constant.TPOINT_WT_FJSSFS);
|
|
|
|
|
|
try {
|
|
|
if (null != fdl) {
|