浏览代码

风机绩效表明细风能利用率修改

shilin 4 年之前
父节点
当前提交
a5e36eb72b
共有 1 个文件被更改,包括 118 次插入16 次删除
  1. 118 16
      src/main/java/com/gyee/frame/controller/powercompare/PowerCompareDetailController.java

+ 118 - 16
src/main/java/com/gyee/frame/controller/powercompare/PowerCompareDetailController.java

@@ -2,13 +2,9 @@ package com.gyee.frame.controller.powercompare;
 
 import com.gyee.frame.common.conf.AjaxStatus;
 import com.gyee.frame.common.domain.AjaxResult;
-import com.gyee.frame.model.auto.Windturbineinfoday3;
 import com.gyee.frame.model.benchmarking.PowerCompareDetail;
-import com.gyee.frame.service.Windpowerinfoday3Service;
-import com.gyee.frame.service.Windturbineinfoday3Service;
 import com.gyee.frame.service.benchmarking.PowerCompareDetailService;
 import com.gyee.frame.util.DateUtils;
-import com.gyee.frame.util.StringUtils;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -16,10 +12,8 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.annotation.Resource;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+
 /**
  * @ClassName : PowerCompareDetailController
  * @Author : xieshengjie
@@ -47,13 +41,67 @@ public class PowerCompareDetailController {
         Date begin = DateUtils.parseDate(beginDate);
         Date end = DateUtils.parseDate(endDate);
         List<PowerCompareDetail>  vos = powerCompareDetailService.getDetailWtInfo(begin,end,wpId,pjId,xlId);
-        if(vos !=null && !vos.isEmpty())
+//        if(vos !=null && !vos.isEmpty())
+//        {
+//            vos.stream().forEach(i -> i.setFnlyl(i.getScadafdl()/i.getLlfdl()*100));
+//            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+//        }else
+//        {
+//            return	AjaxResult.successData(AjaxStatus.emptyresultset.code,vos);
+//        }
+
+        List<Map<String,Object>> lylls=new ArrayList<>();
+        Map<String,Object> result=new LinkedHashMap<>();
+
+
+
+        if(vos !=null  && !vos.isEmpty())
         {
-            vos.stream().forEach(i -> i.setFnlyl(i.getScadafdl()/i.getLlfdl()*100));
-            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+
+            Optional<PowerCompareDetail> maxEmp= vos.stream().filter(Objects::nonNull).max(Comparator.comparingDouble(PowerCompareDetail ::getLlfdl));
+            PowerCompareDetail wi3 = maxEmp.orElse(new PowerCompareDetail());
+            double xAxis=wi3.getLlfdl();
+            for (int i=0;i<vos.size();i++)
+            {
+                PowerCompareDetail wi=vos.get(i);
+                Map<String,Object> data=new LinkedHashMap<>();
+                data.put("yAxis",i);
+                data.put("xAxis",xAxis);
+                data.put("symbolSize",1);
+                data.put("symbol","circle");
+
+                Map<String,Object> itemStyle=new LinkedHashMap<>();
+                Map<String,Object> normal=new LinkedHashMap<>();
+                normal.put("color","#87b754");
+                itemStyle.put("normal",normal);
+                data.put("itemStyle",itemStyle);
+
+                Map<String,Object> label=new LinkedHashMap<>();
+                Map<String,Object> normal2=new LinkedHashMap<>();
+
+                normal2.put("color","#000");
+                normal2.put("position","right");
+                normal2.put("distance",12);
+                normal2.put("show",true);
+                normal2.put("formatter","利用率"+(wi3.getScadafdl()/wi3.getLlfdl()*100));
+
+                label.put("normal",normal2);
+                data.put("label",label);
+
+                lylls.add(data);
+
+            }
+
+            //       System.out.println( JSONObject.toJSONString(lylls));
+
+            result.put("list",vos);
+            result.put("lyl",lylls);
+            return	AjaxResult.successData(AjaxStatus.success.code,result);
         }else
         {
-            return	AjaxResult.successData(AjaxStatus.emptyresultset.code,vos);
+            result.put("list",vos);
+            result.put("lyl",lylls);
+            return	AjaxResult.successData(AjaxStatus.emptyresultset.code,result);
         }
     }
 
@@ -74,13 +122,67 @@ public class PowerCompareDetailController {
         } else if (queryType.equals("xl")) {
             vos = powerCompareDetailService.getDetailInfo(begin,end,2);
         }
-        if(vos !=null && !vos.isEmpty())
+//        if(vos !=null && !vos.isEmpty())
+//        {
+//            vos.stream().forEach(i -> i.setFnlyl(i.getScadafdl()/i.getLlfdl()*100));
+//            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+//        }else
+//        {
+//            return	AjaxResult.successData(AjaxStatus.emptyresultset.code,vos);
+//        }
+
+        List<Map<String,Object>> lylls=new ArrayList<>();
+        Map<String,Object> result=new LinkedHashMap<>();
+
+
+
+        if(vos !=null  && !vos.isEmpty())
         {
-            vos.stream().forEach(i -> i.setFnlyl(i.getScadafdl()/i.getLlfdl()*100));
-            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+
+            Optional<PowerCompareDetail> maxEmp= vos.stream().filter(Objects::nonNull).max(Comparator.comparingDouble(PowerCompareDetail ::getLlfdl));
+            PowerCompareDetail wi3 = maxEmp.orElse(new PowerCompareDetail());
+            double xAxis=wi3.getLlfdl();
+            for (int i=0;i<vos.size();i++)
+            {
+                PowerCompareDetail wi=vos.get(i);
+                Map<String,Object> data=new LinkedHashMap<>();
+                data.put("yAxis",i);
+                data.put("xAxis",xAxis);
+                data.put("symbolSize",1);
+                data.put("symbol","circle");
+
+                Map<String,Object> itemStyle=new LinkedHashMap<>();
+                Map<String,Object> normal=new LinkedHashMap<>();
+                normal.put("color","#87b754");
+                itemStyle.put("normal",normal);
+                data.put("itemStyle",itemStyle);
+
+                Map<String,Object> label=new LinkedHashMap<>();
+                Map<String,Object> normal2=new LinkedHashMap<>();
+
+                normal2.put("color","#000");
+                normal2.put("position","right");
+                normal2.put("distance",12);
+                normal2.put("show",true);
+                normal2.put("formatter","利用率"+(wi3.getScadafdl()/wi3.getLlfdl()*100));
+
+                label.put("normal",normal2);
+                data.put("label",label);
+
+                lylls.add(data);
+
+            }
+
+            //       System.out.println( JSONObject.toJSONString(lylls));
+
+            result.put("list",vos);
+            result.put("lyl",lylls);
+            return	AjaxResult.successData(AjaxStatus.success.code,result);
         }else
         {
-            return	AjaxResult.successData(AjaxStatus.emptyresultset.code,vos);
+            result.put("list",vos);
+            result.put("lyl",lylls);
+            return	AjaxResult.successData(AjaxStatus.emptyresultset.code,result);
         }
     }
 }