|
@@ -0,0 +1,674 @@
|
|
|
+package com.gyee.health.service.leaderboard;
|
|
|
+
|
|
|
+import com.gyee.health.dto.DataVo;
|
|
|
+import com.gyee.health.init.CacheContext;
|
|
|
+import com.gyee.health.model.auto.*;
|
|
|
+import com.gyee.health.model.custom.Tablepar;
|
|
|
+import com.gyee.health.service.auto.IProEconCurveFittMonthMainService;
|
|
|
+import com.gyee.health.service.auto.IProEconCurveFittingMainService;
|
|
|
+import com.gyee.health.service.auto.IProEconWtCurveFittingMonthService;
|
|
|
+import com.gyee.health.service.auto.IProEconWtCurveFittingService;
|
|
|
+import com.gyee.health.util.StringUtils;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class LeaderboardService {
|
|
|
+
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IProEconWtCurveFittingMonthService proEconWtCurveFittingMonthService;
|
|
|
+ @Resource
|
|
|
+ private IProEconWtCurveFittingService proEconWtCurveFittingService;
|
|
|
+ @Resource
|
|
|
+ private IProEconCurveFittingMainService proEconCurveFittingMainService;
|
|
|
+ @Resource
|
|
|
+ private IProEconCurveFittMonthMainService proEconCurveFittMonthMainService;
|
|
|
+
|
|
|
+ private final String SJBZ = "sjbz";//实际保证
|
|
|
+ private final String SJZY = "sjzy";//实际最优
|
|
|
+ private final String ZYBZ = "zybz";//最优保证
|
|
|
+ private final String TB = "tb";//同比
|
|
|
+ private final String HB = "hb";//环比
|
|
|
+ private final String BG = "bg";//标杆
|
|
|
+
|
|
|
+ private String name1;
|
|
|
+ private String name2;
|
|
|
+
|
|
|
+
|
|
|
+ /*******************************************************************************************************************************************************/
|
|
|
+
|
|
|
+ public List<ProEconCurveFittingMain> proEconCurveFittingMainList(Tablepar tablepar, String wpId, Date recorddate) {
|
|
|
+
|
|
|
+ List<ProEconCurveFittingMain> list =new ArrayList<>();
|
|
|
+ List<String> wtIds=new ArrayList<>();
|
|
|
+ if(StringUtils.notEmp(wpId) && StringUtils.notEmp(recorddate))
|
|
|
+ {
|
|
|
+ List<ProBasicEquipment> wtls=CacheContext.wpwtmap.get(wpId);
|
|
|
+ for(ProBasicEquipment wt:wtls)
|
|
|
+ {
|
|
|
+ wtIds.add(wt.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ list =proEconCurveFittingMainService.getProEconCurveFittingMainList(tablepar,wtIds,recorddate);
|
|
|
+ }
|
|
|
+
|
|
|
+ return list;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, Object> getCurvechatAjax(String type,String wtId, Date recorddate) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+
|
|
|
+ if(StringUtils.notEmp(type) && StringUtils.notEmp(wtId) && StringUtils.notEmp(recorddate))
|
|
|
+ {
|
|
|
+ List<DataVo> datavos = new ArrayList<>();
|
|
|
+ List<ProEconWtCurveFitting> wcls = proEconWtCurveFittingService.comparechatAjax(wtId, recorddate);
|
|
|
+ Map<String, ProBasicEquipment> wtmap = CacheContext.wtmap;
|
|
|
+ Map<String, Map<Double, ProBasicModelPowerRd>> modelpowerrdmap = CacheContext.modelpowerrdmap;
|
|
|
+ Map<Double, ProBasicModelPowerRd> modelmap = null;
|
|
|
+ if (wtmap.containsKey(wtId)) {
|
|
|
+ ProBasicEquipment wt = wtmap.get(wtId);
|
|
|
+ if (modelpowerrdmap.containsKey(wt.getModelId())) {
|
|
|
+ modelmap = modelpowerrdmap.get(wt.getModelId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!wcls.isEmpty()) {
|
|
|
+ Collections.sort(wcls, new Comparator<ProEconWtCurveFitting>() {
|
|
|
+ public int compare(ProEconWtCurveFitting arg0, ProEconWtCurveFitting arg1) {
|
|
|
+ return arg0.getSpeed().compareTo(arg1.getSpeed());
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ for (ProEconWtCurveFitting wc : wcls) {
|
|
|
+
|
|
|
+ DataVo vo = new DataVo();
|
|
|
+ int c = (int) wc.getSpeed().intValue();
|
|
|
+ if (c == wc.getSpeed()) {
|
|
|
+ vo.setValue1(wc.getSpeed());
|
|
|
+ if (StringUtils.notEmp(type) && type.equals(SJBZ) && null != modelmap) {
|
|
|
+ if (modelmap.containsKey(String.valueOf(wc.getSpeed()))) {
|
|
|
+ ProBasicModelPowerRd mp = modelmap.get(String.valueOf(wc.getSpeed()));
|
|
|
+ vo.setValue3(mp.getEnsurePower());
|
|
|
+ } else {
|
|
|
+ vo.setValue3(0.0);
|
|
|
+ }
|
|
|
+ vo.setValue2(wc.getActualPower());
|
|
|
+
|
|
|
+ } else if (StringUtils.notEmp(type) && type.equals(SJZY)) {
|
|
|
+ vo.setValue2(wc.getActualPower());
|
|
|
+ vo.setValue3(wc.getOptimalPower());
|
|
|
+
|
|
|
+ } else if (StringUtils.notEmp(type) && type.equals(ZYBZ) && null != modelmap) {
|
|
|
+ if (modelmap.containsKey(String.valueOf(wc.getSpeed()))) {
|
|
|
+ ProBasicModelPowerRd mp = modelmap.get(String.valueOf(wc.getSpeed()));
|
|
|
+ vo.setValue3(mp.getEnsurePower());
|
|
|
+ } else {
|
|
|
+ vo.setValue3(0.0);
|
|
|
+ }
|
|
|
+ vo.setValue2(wc.getOptimalPower());
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ datavos.add(vo);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ curvechat(type);
|
|
|
+
|
|
|
+ map.put("datas", datavos);
|
|
|
+ map.put("name1", name1);
|
|
|
+ map.put("name2", name2);
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public Map<String, Object> curvechatAjaxtb(String type,String wtId, Date recorddate) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+
|
|
|
+ if(StringUtils.notEmp(type) && StringUtils.notEmp(wtId) && StringUtils.notEmp(recorddate))
|
|
|
+ {
|
|
|
+ List<DataVo> datavos = new ArrayList<DataVo>();
|
|
|
+ Map<Double, Double> speedmap = new HashMap<Double, Double>();
|
|
|
+ List<ProEconWtCurveFitting> thisdayls = proEconWtCurveFittingService.comparechatAjax(wtId,recorddate);
|
|
|
+
|
|
|
+ // 去年统计指标
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ cal.setTime(recorddate);
|
|
|
+ cal.add(Calendar.YEAR, -1);
|
|
|
+
|
|
|
+ List<ProEconWtCurveFitting> lastyearls = proEconWtCurveFittingService.comparechatAjax(wtId,cal.getTime());
|
|
|
+
|
|
|
+ if (!lastyearls.isEmpty()) {
|
|
|
+
|
|
|
+ for (ProEconWtCurveFitting wc : lastyearls) {
|
|
|
+ int c = (int) wc.getSpeed().intValue();
|
|
|
+ if (c == wc.getSpeed()) {
|
|
|
+ speedmap.put(wc.getSpeed(), wc.getActualPower());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!thisdayls.isEmpty()) {
|
|
|
+ Collections.sort(thisdayls, new Comparator<ProEconWtCurveFitting>() {
|
|
|
+ public int compare(ProEconWtCurveFitting arg0, ProEconWtCurveFitting arg1) {
|
|
|
+ return arg0.getSpeed().compareTo(arg1.getSpeed());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ for (ProEconWtCurveFitting wc : thisdayls) {
|
|
|
+
|
|
|
+ DataVo vo = new DataVo();
|
|
|
+ int c = (int) wc.getSpeed().intValue();
|
|
|
+ if (c == wc.getSpeed()) {
|
|
|
+ vo.setValue1(wc.getSpeed());
|
|
|
+ vo.setValue2(wc.getActualPower());
|
|
|
+
|
|
|
+ if (speedmap.containsKey(wc.getSpeed())) {
|
|
|
+ vo.setValue3(speedmap.get(wc.getSpeed()));
|
|
|
+ } else {
|
|
|
+ vo.setValue3(0.0);
|
|
|
+ }
|
|
|
+ datavos.add(vo);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ curvechat(type);
|
|
|
+
|
|
|
+ map.put("datas", datavos);
|
|
|
+ map.put("name1", name1);
|
|
|
+ map.put("name2", name2);
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, Object> curvechatAjaxhb(String type,String wtId, Date recorddate) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+
|
|
|
+ if(StringUtils.notEmp(type) && StringUtils.notEmp(wtId) && StringUtils.notEmp(recorddate))
|
|
|
+ {
|
|
|
+ List<DataVo> datavos = new ArrayList<DataVo>();
|
|
|
+ Map<Double, Double> speedmap = new HashMap<Double, Double>();
|
|
|
+ List<ProEconWtCurveFitting> thisdayls = proEconWtCurveFittingService.comparechatAjax(wtId,recorddate);
|
|
|
+
|
|
|
+ // 上个月统计指标
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ cal.setTime(recorddate);
|
|
|
+ cal.add(Calendar.DAY_OF_MONTH, -1);
|
|
|
+
|
|
|
+ List<ProEconWtCurveFitting> lastyearls = proEconWtCurveFittingService.comparechatAjax(wtId,cal.getTime());
|
|
|
+
|
|
|
+ if (!lastyearls.isEmpty()) {
|
|
|
+
|
|
|
+ for (ProEconWtCurveFitting wc : lastyearls) {
|
|
|
+ int c = (int) wc.getSpeed().intValue();
|
|
|
+ if (c == wc.getSpeed()) {
|
|
|
+ speedmap.put(wc.getSpeed(), wc.getActualPower());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!thisdayls.isEmpty()) {
|
|
|
+ Collections.sort(thisdayls, new Comparator<ProEconWtCurveFitting>() {
|
|
|
+ public int compare(ProEconWtCurveFitting arg0, ProEconWtCurveFitting arg1) {
|
|
|
+ return arg0.getSpeed().compareTo(arg1.getSpeed());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ for (ProEconWtCurveFitting wc : thisdayls) {
|
|
|
+
|
|
|
+ DataVo vo = new DataVo();
|
|
|
+ int c = (int) wc.getSpeed().intValue();
|
|
|
+ if (c == wc.getSpeed()) {
|
|
|
+ vo.setValue1(wc.getSpeed());
|
|
|
+ vo.setValue2(wc.getActualPower());
|
|
|
+
|
|
|
+ if (speedmap.containsKey(wc.getSpeed())) {
|
|
|
+ vo.setValue3(speedmap.get(wc.getSpeed()));
|
|
|
+ } else {
|
|
|
+ vo.setValue3(0.0);
|
|
|
+ }
|
|
|
+ datavos.add(vo);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ curvechat(type);
|
|
|
+
|
|
|
+ map.put("datas", datavos);
|
|
|
+ map.put("name1", name1);
|
|
|
+ map.put("name2", name2);
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, Object> curvechatAjaxbg(String type,String wtId, Date recorddate) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+
|
|
|
+ if(StringUtils.notEmp(type) && StringUtils.notEmp(wtId) && StringUtils.notEmp(recorddate))
|
|
|
+ {
|
|
|
+ List<DataVo> datavos = new ArrayList<DataVo>();
|
|
|
+ Map<Double, Double> speedmap = new HashMap<Double, Double>();
|
|
|
+ List<ProEconWtCurveFitting> thisdayls = proEconWtCurveFittingService.comparechatAjax(wtId,recorddate);
|
|
|
+
|
|
|
+ // 标杆风机指标
|
|
|
+ String stid = CacheContext.wtstandardmap.get(wtId);
|
|
|
+
|
|
|
+
|
|
|
+ if(StringUtils.notEmp(stid))
|
|
|
+ {
|
|
|
+ List<ProEconWtCurveFitting> stmonthls = proEconWtCurveFittingService.comparechatAjax(wtId,recorddate);
|
|
|
+
|
|
|
+ if (null != stmonthls && !stmonthls.isEmpty()) {
|
|
|
+
|
|
|
+ if (!stmonthls.isEmpty()) {
|
|
|
+
|
|
|
+ for (ProEconWtCurveFitting wc : stmonthls) {
|
|
|
+ int c = (int) wc.getSpeed().intValue();
|
|
|
+ if (c == wc.getSpeed()) {
|
|
|
+ speedmap.put(wc.getSpeed(), wc.getActualPower());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!thisdayls.isEmpty()) {
|
|
|
+ Collections.sort(thisdayls, new Comparator<ProEconWtCurveFitting>() {
|
|
|
+ public int compare(ProEconWtCurveFitting arg0, ProEconWtCurveFitting arg1) {
|
|
|
+ return arg0.getSpeed().compareTo(arg1.getSpeed());
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ for (ProEconWtCurveFitting wc : thisdayls) {
|
|
|
+
|
|
|
+ DataVo vo = new DataVo();
|
|
|
+ int c = (int) wc.getSpeed().intValue();
|
|
|
+ if (c == wc.getSpeed()) {
|
|
|
+ vo.setValue1(wc.getSpeed());
|
|
|
+ vo.setValue2(wc.getActualPower());
|
|
|
+
|
|
|
+ if (speedmap.containsKey(wc.getSpeed())) {
|
|
|
+ vo.setValue3(speedmap.get(wc.getSpeed()));
|
|
|
+ } else {
|
|
|
+ vo.setValue3(0.0);
|
|
|
+ }
|
|
|
+ datavos.add(vo);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ curvechat(type);
|
|
|
+
|
|
|
+ map.put("datas", datavos);
|
|
|
+ map.put("name1", name1);
|
|
|
+ map.put("name2", name2);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void curvechat(String type) {
|
|
|
+ if (StringUtils.notEmp(type) && type.equals(SJBZ)) {
|
|
|
+
|
|
|
+ name1 = "实际功率";
|
|
|
+ name2 = "保证功率";
|
|
|
+
|
|
|
+ } else if (StringUtils.notEmp(type) && type.equals(SJZY)) {
|
|
|
+
|
|
|
+ name1 = "实际功率";
|
|
|
+ name2 = "最优功率";
|
|
|
+ } else if (StringUtils.notEmp(type) && type.equals(ZYBZ)) {
|
|
|
+
|
|
|
+ name1 = "最优功率";
|
|
|
+ name2 = "保证功率";
|
|
|
+ } else if (StringUtils.notEmp(type) && type.equals(TB)) {
|
|
|
+
|
|
|
+ name1 = "本日实际功率";
|
|
|
+ name2 = "去年同期实际功率";
|
|
|
+ } else if (StringUtils.notEmp(type) && type.equals(HB)) {
|
|
|
+
|
|
|
+ name1 = "本日实际功率";
|
|
|
+ name2 = "上日实际功率";
|
|
|
+ } else if (StringUtils.notEmp(type) && type.equals(BG)) {
|
|
|
+
|
|
|
+ name1 = "本日实际功率";
|
|
|
+ name2 = "标杆实际功率";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /*******************************************************************************************************************************************************/
|
|
|
+
|
|
|
+ public List<ProEconCurveFittMonthMain> curvefittingmonthmainList(Tablepar tablepar, String wpId, String year, String month) {
|
|
|
+
|
|
|
+ List<ProEconCurveFittMonthMain> list =new ArrayList<>();
|
|
|
+ List<String> wtIds=new ArrayList<>();
|
|
|
+ if(StringUtils.notEmp(wpId) && StringUtils.notEmp(year) && StringUtils.notEmp(month))
|
|
|
+ {
|
|
|
+ List<ProBasicEquipment> wtls=CacheContext.wpwtmap.get(wpId);
|
|
|
+ for(ProBasicEquipment wt:wtls)
|
|
|
+ {
|
|
|
+ wtIds.add(wt.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ list =proEconCurveFittMonthMainService.getCurvefittingmonthmainList(tablepar,wtIds,year,month);
|
|
|
+ }
|
|
|
+
|
|
|
+ return list;
|
|
|
+
|
|
|
+ }
|
|
|
+ public Map<String, Object> curveMonthchatAjax(String type,String wtId, String year,String month) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+
|
|
|
+ if(StringUtils.notEmp(type) && StringUtils.notEmp(wtId) && StringUtils.notEmp(year) && StringUtils.notEmp(month))
|
|
|
+ {
|
|
|
+ List<DataVo> datavos = new ArrayList<DataVo>();
|
|
|
+ List<ProEconWtCurveFittingMonth> wcls = proEconWtCurveFittingMonthService.getProEconWtCurveFittingMonthList(wtId, year,month);
|
|
|
+ Map<String, ProBasicEquipment> wtmap = CacheContext.wtmap;
|
|
|
+ Map<String, Map<Double, ProBasicModelPowerRd>> modelpowerrdmap = CacheContext.modelpowerrdmap;
|
|
|
+
|
|
|
+ Map<Double, ProBasicModelPowerRd> modelmap = null;
|
|
|
+ if (wtmap.containsKey(wtId)) {
|
|
|
+ ProBasicEquipment wt = wtmap.get(wtId);
|
|
|
+ if (modelpowerrdmap.containsKey(wt.getModelId())) {
|
|
|
+ modelmap = modelpowerrdmap.get(wt.getModelId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!wcls.isEmpty()) {
|
|
|
+ Collections.sort(wcls, new Comparator<ProEconWtCurveFittingMonth>() {
|
|
|
+ public int compare(ProEconWtCurveFittingMonth arg0, ProEconWtCurveFittingMonth arg1) {
|
|
|
+ return arg0.getSpeed().compareTo(arg1.getSpeed());
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ for (ProEconWtCurveFittingMonth wc : wcls) {
|
|
|
+
|
|
|
+ DataVo vo = new DataVo();
|
|
|
+ int c = (int) wc.getSpeed().intValue();
|
|
|
+ if (c == wc.getSpeed()) {
|
|
|
+ vo.setValue1(wc.getSpeed());
|
|
|
+ if (StringUtils.notEmp(type) && type.equals(SJBZ) && null != modelmap) {
|
|
|
+ if (modelmap.containsKey(String.valueOf(wc.getSpeed()))) {
|
|
|
+ ProBasicModelPowerRd mp = modelmap.get(String.valueOf(wc.getSpeed()));
|
|
|
+ vo.setValue3(mp.getEnsurePower());
|
|
|
+ } else {
|
|
|
+ vo.setValue3(0.0);
|
|
|
+ }
|
|
|
+ vo.setValue2(wc.getActualPower());
|
|
|
+ name1 = "实际功率";
|
|
|
+ name2 = "保证功率";
|
|
|
+
|
|
|
+ } else if (StringUtils.notEmp(type) && type.equals(SJZY)) {
|
|
|
+ vo.setValue2(wc.getActualPower());
|
|
|
+ vo.setValue3(wc.getOptimalPower());
|
|
|
+ name1 = "实际功率";
|
|
|
+ name2 = "最优功率";
|
|
|
+ } else if (StringUtils.notEmp(type) && type.equals(ZYBZ) && null != modelmap) {
|
|
|
+ if (modelmap.containsKey(String.valueOf(wc.getSpeed()))) {
|
|
|
+ ProBasicModelPowerRd mp = modelmap.get(String.valueOf(wc.getSpeed()));
|
|
|
+ vo.setValue3(mp.getEnsurePower());
|
|
|
+ } else {
|
|
|
+ vo.setValue3(0.0);
|
|
|
+ }
|
|
|
+ vo.setValue2(wc.getOptimalPower());
|
|
|
+
|
|
|
+ name1 = "最优功率";
|
|
|
+ name2 = "保证功率";
|
|
|
+ }
|
|
|
+
|
|
|
+ datavos.add(vo);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ curvemonthchat(type);
|
|
|
+
|
|
|
+ map.put("datas", datavos);
|
|
|
+ map.put("name1", name1);
|
|
|
+ map.put("name2", name2);
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public Map<String, Object> curveMonthchatAjaxtb(String type,String wtId, String year,String month) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+
|
|
|
+ if(StringUtils.notEmp(type) && StringUtils.notEmp(wtId) && StringUtils.notEmp(year) && StringUtils.notEmp(month))
|
|
|
+ {
|
|
|
+ List<DataVo> datavos = new ArrayList<DataVo>();
|
|
|
+ Map<Double, Double> speedmap = new HashMap<Double, Double>();
|
|
|
+ List<ProEconWtCurveFittingMonth> thismonthls = proEconWtCurveFittingMonthService.getProEconWtCurveFittingMonthList(wtId, year,month);
|
|
|
+
|
|
|
+ // 去年统计指标
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ cal.set(Calendar.YEAR,Integer.valueOf(year));
|
|
|
+ cal.set(Calendar.MONTH,Integer.valueOf(month)-1);
|
|
|
+ cal.add(Calendar.YEAR, -1);
|
|
|
+
|
|
|
+ String lastyear=String.valueOf(cal.get(Calendar.YEAR));
|
|
|
+
|
|
|
+ List<ProEconWtCurveFittingMonth> lastyearls =proEconWtCurveFittingMonthService.getProEconWtCurveFittingMonthList(wtId, lastyear,month);
|
|
|
+
|
|
|
+ if (!lastyearls.isEmpty()) {
|
|
|
+
|
|
|
+ for (ProEconWtCurveFittingMonth wc : lastyearls) {
|
|
|
+ int c = (int) wc.getSpeed().intValue();
|
|
|
+ if (c == wc.getSpeed()) {
|
|
|
+ speedmap.put(wc.getSpeed(), wc.getActualPower());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!thismonthls.isEmpty()) {
|
|
|
+ Collections.sort(thismonthls, new Comparator<ProEconWtCurveFittingMonth>() {
|
|
|
+ public int compare(ProEconWtCurveFittingMonth arg0, ProEconWtCurveFittingMonth arg1) {
|
|
|
+ return arg0.getSpeed().compareTo(arg1.getSpeed());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ for (ProEconWtCurveFittingMonth wc : thismonthls) {
|
|
|
+
|
|
|
+ DataVo vo = new DataVo();
|
|
|
+ int c = (int) wc.getSpeed().intValue();
|
|
|
+ if (c == wc.getSpeed()) {
|
|
|
+ vo.setValue1(wc.getSpeed());
|
|
|
+ vo.setValue2(wc.getActualPower());
|
|
|
+ name1 = "本月实际功率";
|
|
|
+ name2 = "去年同期实际功率";
|
|
|
+ if (speedmap.containsKey(wc.getSpeed())) {
|
|
|
+ vo.setValue3(speedmap.get(wc.getSpeed()));
|
|
|
+ } else {
|
|
|
+ vo.setValue3(0.0);
|
|
|
+ }
|
|
|
+ datavos.add(vo);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ curvemonthchat(type);
|
|
|
+
|
|
|
+ map.put("datas", datavos);
|
|
|
+ map.put("name1", name1);
|
|
|
+ map.put("name2", name2);
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, Object> curveMonthchatAjaxhb(String type,String wtId, String year,String month) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+
|
|
|
+ if(StringUtils.notEmp(type) && StringUtils.notEmp(wtId) && StringUtils.notEmp(year) && StringUtils.notEmp(month))
|
|
|
+ {
|
|
|
+ List<DataVo> datavos = new ArrayList<DataVo>();
|
|
|
+ Map<Double, Double> speedmap = new HashMap<Double, Double>();
|
|
|
+ List<ProEconWtCurveFittingMonth> thismonthls = proEconWtCurveFittingMonthService.getProEconWtCurveFittingMonthList(wtId, year,month);
|
|
|
+
|
|
|
+ // 上个月统计指标
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ cal.set(Calendar.YEAR,Integer.valueOf(year));
|
|
|
+ cal.set(Calendar.MONTH,Integer.valueOf(month)-1);
|
|
|
+ cal.add(Calendar.MONTH, -1);
|
|
|
+
|
|
|
+ String lastyearmonth=String.valueOf(cal.get(Calendar.MONTH));
|
|
|
+
|
|
|
+ List<ProEconWtCurveFittingMonth> lastmonthls =proEconWtCurveFittingMonthService.getProEconWtCurveFittingMonthList(wtId, year,lastyearmonth);
|
|
|
+
|
|
|
+
|
|
|
+ if (!lastmonthls.isEmpty()) {
|
|
|
+
|
|
|
+ for (ProEconWtCurveFittingMonth wc : lastmonthls) {
|
|
|
+ int c = (int) wc.getSpeed().intValue();
|
|
|
+ if (c == wc.getSpeed()) {
|
|
|
+ speedmap.put(wc.getSpeed(), wc.getActualPower());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!thismonthls.isEmpty()) {
|
|
|
+ Collections.sort(thismonthls, new Comparator<ProEconWtCurveFittingMonth>() {
|
|
|
+ public int compare(ProEconWtCurveFittingMonth arg0, ProEconWtCurveFittingMonth arg1) {
|
|
|
+ // 修改横轴排序
|
|
|
+ return arg0.getSpeed().compareTo(arg1.getSpeed());
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ for (ProEconWtCurveFittingMonth wc : thismonthls) {
|
|
|
+
|
|
|
+ DataVo vo = new DataVo();
|
|
|
+ int c = (int) wc.getSpeed().intValue();
|
|
|
+ if (c == wc.getSpeed()) {
|
|
|
+ vo.setValue1(wc.getSpeed());
|
|
|
+ vo.setValue2(wc.getActualPower());
|
|
|
+ name1 = "本月实际功率";
|
|
|
+ name2 = "上月实际功率";
|
|
|
+ if (speedmap.containsKey(wc.getSpeed())) {
|
|
|
+ vo.setValue3(speedmap.get(wc.getSpeed()));
|
|
|
+ } else {
|
|
|
+ vo.setValue3(0.0);
|
|
|
+ }
|
|
|
+ datavos.add(vo);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ curvemonthchat(type);
|
|
|
+ map.put("datas", datavos);
|
|
|
+ map.put("name1", name1);
|
|
|
+ map.put("name2", name2);
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, Object> curveMonthchatAjaxbg(String type,String wtId, String year,String month) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+
|
|
|
+ if(StringUtils.notEmp(type) && StringUtils.notEmp(wtId) && StringUtils.notEmp(year) && StringUtils.notEmp(month))
|
|
|
+ {
|
|
|
+ List<DataVo> datavos = new ArrayList<>();
|
|
|
+ Map<Double, Double> speedmap = new HashMap<>();
|
|
|
+ List<ProEconWtCurveFittingMonth> thismonthls = proEconWtCurveFittingMonthService.getProEconWtCurveFittingMonthList(wtId, year,month);
|
|
|
+
|
|
|
+ // 标杆风机指标
|
|
|
+ ProBasicEquipment wt = CacheContext.wtmap.get(wtId);
|
|
|
+ // 标杆风机指标
|
|
|
+ String stid = CacheContext.wtstandardmap.get(wtId);
|
|
|
+
|
|
|
+ if(StringUtils.notEmp(stid))
|
|
|
+ {
|
|
|
+ List<ProEconWtCurveFittingMonth> stmonthls = proEconWtCurveFittingMonthService.getProEconWtCurveFittingMonthList(stid, year,month);
|
|
|
+
|
|
|
+ if (null != stmonthls && !stmonthls.isEmpty()) {
|
|
|
+
|
|
|
+ if (!stmonthls.isEmpty()) {
|
|
|
+
|
|
|
+ for (ProEconWtCurveFittingMonth wc : stmonthls) {
|
|
|
+ int c = (int) wc.getSpeed().intValue();
|
|
|
+ if (c == wc.getSpeed()) {
|
|
|
+ speedmap.put(wc.getSpeed(), wc.getActualPower());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!thismonthls.isEmpty()) {
|
|
|
+ Collections.sort(thismonthls, new Comparator<ProEconWtCurveFittingMonth>() {
|
|
|
+ public int compare(ProEconWtCurveFittingMonth arg0, ProEconWtCurveFittingMonth arg1) {
|
|
|
+ return arg0.getSpeed().compareTo(arg1.getSpeed());
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ for (ProEconWtCurveFittingMonth wc : thismonthls) {
|
|
|
+
|
|
|
+ DataVo vo = new DataVo();
|
|
|
+ int c = (int) wc.getSpeed().intValue();
|
|
|
+ if (c == wc.getSpeed()) {
|
|
|
+ vo.setValue1(wc.getSpeed());
|
|
|
+ vo.setValue2(wc.getActualPower());
|
|
|
+ name1 = "本月实际功率";
|
|
|
+ name2 = "标杆实际功率";
|
|
|
+ if (speedmap.containsKey(wc.getSpeed())) {
|
|
|
+ vo.setValue3(speedmap.get(wc.getSpeed()));
|
|
|
+ } else {
|
|
|
+ vo.setValue3(0.0);
|
|
|
+ }
|
|
|
+ datavos.add(vo);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ curvemonthchat(type);
|
|
|
+
|
|
|
+ map.put("datas", datavos);
|
|
|
+ map.put("name1", name1);
|
|
|
+ map.put("name2", name2);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void curvemonthchat(String type) {
|
|
|
+
|
|
|
+ if (StringUtils.notEmp(type) && type.equals(SJBZ)) {
|
|
|
+
|
|
|
+ name1 = "实际功率";
|
|
|
+ name2 = "保证功率";
|
|
|
+
|
|
|
+ } else if (StringUtils.notEmp(type) && type.equals(SJZY)) {
|
|
|
+
|
|
|
+ name1 = "实际功率";
|
|
|
+ name2 = "最优功率";
|
|
|
+ } else if (StringUtils.notEmp(type) && type.equals(ZYBZ)) {
|
|
|
+
|
|
|
+ name1 = "最优功率";
|
|
|
+ name2 = "保证功率";
|
|
|
+ } else if (StringUtils.notEmp(type) && type.equals(TB)) {
|
|
|
+
|
|
|
+ name1 = "本月实际功率";
|
|
|
+ name2 = "去年同期实际功率";
|
|
|
+ } else if (StringUtils.notEmp(type) && type.equals(HB)) {
|
|
|
+
|
|
|
+ name1 = "本月实际功率";
|
|
|
+ name2 = "上月实际功率";
|
|
|
+ } else if (StringUtils.notEmp(type) && type.equals(BG)) {
|
|
|
+
|
|
|
+ name1 = "本月实际功率";
|
|
|
+ name2 = "标杆实际功率";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|