|
@@ -3,6 +3,7 @@ package com.gyee.frame.service.contrast;
|
|
|
import com.gyee.frame.common.spring.InitialRunner;
|
|
|
import com.gyee.frame.model.auto.*;
|
|
|
import com.gyee.frame.model.custom.BenchMarkVo;
|
|
|
+import com.gyee.frame.model.custom.DataVo;
|
|
|
import com.gyee.frame.service.FaultEliminateDefectsService;
|
|
|
import com.gyee.frame.service.StatetransitionratesService;
|
|
|
import com.gyee.frame.service.Windpowerinfoday3Service;
|
|
@@ -290,4 +291,118 @@ public class ContrastPjService {
|
|
|
}
|
|
|
return vos;
|
|
|
}
|
|
|
+
|
|
|
+ public List<DataVo> findPjPowerChat(String wpId,String pjId, String beginDate, String endDate) {
|
|
|
+
|
|
|
+ Date begin = DateUtils.parseDate(beginDate);
|
|
|
+ Date end = DateUtils.parseDate(endDate);
|
|
|
+
|
|
|
+ List<DataVo> vos = new ArrayList<DataVo>();
|
|
|
+ List<String> wpids = new ArrayList<String>();
|
|
|
+ if (StringUtils.notEmp(wpId)) {
|
|
|
+ if (wpId.indexOf(",") != -1) {
|
|
|
+ String[] strs = wpId.split(",");
|
|
|
+ if (strs.length > 0) {
|
|
|
+ for (int i = 0; i < strs.length; i++) {
|
|
|
+ wpids.add(strs[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ wpids.add(wpId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> pjids = new ArrayList<String>();
|
|
|
+ if (StringUtils.notEmp(pjId)) {
|
|
|
+ if (pjId.indexOf(",") != -1) {
|
|
|
+ String[] strs = pjId.split(",");
|
|
|
+ if (strs.length > 0) {
|
|
|
+ for (int i = 0; i < strs.length; i++) {
|
|
|
+ pjids.add(strs[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ pjids.add(pjId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<Windpowerinfoday3> ls =null;
|
|
|
+ if (!pjids.isEmpty()) {
|
|
|
+ ls =windpowerinfoday3Service.getWindpowerinfoday3(pjids, begin, end, "project");
|
|
|
+ } else if (!wpids.isEmpty()) {
|
|
|
+ ls =windpowerinfoday3Service.getWindpowerinfoday3(wpids, begin, end, "windpower");
|
|
|
+ }
|
|
|
+ // Map<String, Windpowerstation> wpmap = CacheContext.wpmap;
|
|
|
+ Map<String, Project> pjmap = InitialRunner.pjmap;
|
|
|
+ Map<String, DataVo> vomap = new HashMap<String, DataVo>();
|
|
|
+ if (!ls.isEmpty()) {
|
|
|
+ for (int i = 0; i < ls.size(); i++) {
|
|
|
+ Windpowerinfoday3 wd = ls.get(i);
|
|
|
+ if (vomap.containsKey(wd.getProjectid())) {
|
|
|
+ DataVo vo = vomap.get(wd.getProjectid());
|
|
|
+ double losspower1 = null != wd.getDaynhxdssdl2() ? wd.getDaynhxdssdl2() : 0.0;
|
|
|
+ double losspower2 = null != wd.getDaynhgzssdl2() ? wd.getDaynhgzssdl2() : 0.0;
|
|
|
+ double losspower3 = null != wd.getDaynhwhssdl2() ? wd.getDaynhwhssdl2() : 0.0;
|
|
|
+ double losspower4 = null != wd.getDaynhqfdl2() ? wd.getDaynhqfdl2() : 0.0;
|
|
|
+ double fdl = null != wd.getDaydl2() ? wd.getDaydl2() : 0.0;
|
|
|
+
|
|
|
+ vo.setValue1(vo.getValue1() + losspower1);// 限电损失
|
|
|
+ vo.setValue2(vo.getValue2() + losspower2);// 故障损失
|
|
|
+ vo.setValue3(vo.getValue3() + losspower3);// 维护损失
|
|
|
+ vo.setValue4(vo.getValue4() + losspower4);// 欠发损失
|
|
|
+ vo.setValue5(0.0);// 受累损失
|
|
|
+ vo.setValue6(vo.getValue6() + fdl);// 发电量
|
|
|
+ vomap.put(wd.getProjectid(), vo);
|
|
|
+ } else {
|
|
|
+ DataVo vo = new DataVo();
|
|
|
+
|
|
|
+ vo.setValue1(null != wd.getDaynhxdssdl2() ? wd.getDaynhxdssdl2() : 0.0);// 限电损失
|
|
|
+ vo.setValue2(null != wd.getDaynhgzssdl2() ? wd.getDaynhgzssdl2() : 0.0);// 故障损失
|
|
|
+ vo.setValue3(null != wd.getDaynhwhssdl2() ? wd.getDaynhwhssdl2() : 0.0);// 维护损失
|
|
|
+ vo.setValue4(null != wd.getDaynhqfdl2() ? wd.getDaynhqfdl2() : 0.0);// 欠发损失
|
|
|
+
|
|
|
+ vo.setValue5(0.0);// 受累损失
|
|
|
+ vo.setValue6(null != wd.getDaydl2() ? (new BigDecimal(wd.getDaydl2()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP).doubleValue()) : 0.0);// 发电量
|
|
|
+
|
|
|
+ // vo.setValue7(null != wd.getGridelectricity() ?
|
|
|
+ // wd.getGridelectricity() : 0.0);// 上网电量
|
|
|
+ // vo.setValue8(null != wd.getBuyelectricity() ?
|
|
|
+ // wd.getBuyelectricity() : 0.0);// 购网电量
|
|
|
+
|
|
|
+ vo.setTime(DateUtils.truncate(DateUtils.addDays(wd.getRecorddate(), 1)).getTime());
|
|
|
+
|
|
|
+ if (pjmap.containsKey(wd.getProjectid())) {
|
|
|
+ Project pj = pjmap.get(wd.getProjectid());
|
|
|
+ vo.setName(pj.getName());
|
|
|
+
|
|
|
+ }
|
|
|
+ // if(wpmap.containsKey(wd.getWindpowerstationid()))
|
|
|
+ // {
|
|
|
+ // Windpowerstation
|
|
|
+ // wp=wpmap.get(wd.getWindpowerstationid());
|
|
|
+ // vo.setName(wp.getName());
|
|
|
+ // }
|
|
|
+ vomap.put(wd.getProjectid(), vo);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ Set<Map.Entry<String, DataVo>> set = vomap.entrySet();
|
|
|
+ for (Iterator<Map.Entry<String, DataVo>> it = set.iterator(); it.hasNext();) {
|
|
|
+ Map.Entry<String, DataVo> entry = (Map.Entry<String, DataVo>) it.next();
|
|
|
+ // System.out.println(entry.getKey() + "--->" +
|
|
|
+ // entry.getValue());
|
|
|
+ DataVo vo = entry.getValue();
|
|
|
+ vo.setValue1(new BigDecimal(vo.getValue1()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
|
+ vo.setValue2(new BigDecimal(vo.getValue2()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
|
+ vo.setValue3(new BigDecimal(vo.getValue3()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
|
+ vo.setValue4(new BigDecimal(vo.getValue4()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
|
+ vo.setValue5(StringUtils.round(vo.getValue5(), 2));
|
|
|
+ vo.setValue6(new BigDecimal(vo.getValue6()).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
|
+ // vo.setValue7(StringUtils.round(vo.getValue7(), 2));
|
|
|
+ // vo.setValue8(StringUtils.round(vo.getValue8(), 2));
|
|
|
+ vos.add(vo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return vos;
|
|
|
+ }
|
|
|
}
|