Browse Source

对标模块

xieshengjie 2 years ago
parent
commit
dc55db5c97

+ 49 - 0
common/src/main/java/com/gyee/common/util/ReflexUtil.java

@@ -0,0 +1,49 @@
+package com.gyee.common.util;/*
+@author   谢生杰
+@date   2022/11/26-15:27
+*/
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+import java.lang.reflect.Field;
+
+public class ReflexUtil {
+
+    public static Object getFieldValueByObject(Object object,String targetFieldName) throws Exception{
+        //获取该对象的class
+        Class objClass = object.getClass();
+        //初始化返回时
+        Object result = null;
+
+        //获取所有的属性数组
+        Field[] fields = objClass.getDeclaredFields();
+
+        for (Field field : fields){
+            //属性名称
+            String currentFieldName = "";
+
+            try {
+                boolean has_JsonProperty = field.isAnnotationPresent(JsonProperty.class);
+                if (has_JsonProperty){
+                    currentFieldName = field.getAnnotation(JsonProperty.class).value();
+                }else {
+                    currentFieldName = field.getName();
+                }
+
+                if (currentFieldName.equals(targetFieldName)) {
+                    field.setAccessible(true);
+                    result = field.get(object);
+
+                    return result;
+                }
+            }catch (SecurityException e) {
+                e.printStackTrace();
+            }catch (IllegalArgumentException e){
+                e.printStackTrace();
+            }catch (IllegalAccessException e){
+                e.printStackTrace();
+            }
+        }
+        return result;
+    }
+}

+ 138 - 1
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/bmk/BenchmarkingController.java

@@ -6,6 +6,7 @@ package com.gyee.runeconomy.controller.bmk;/*
 import com.gyee.common.model.StringUtils;
 import com.gyee.common.vo.benchmark.FjjxbVo;
 import com.gyee.common.vo.benchmark.FjjxbmxVo;
+import com.gyee.common.vo.benchmark.WxsslVo;
 import com.gyee.runeconomy.dto.R;
 import com.gyee.runeconomy.dto.ResultMsg;
 import com.gyee.runeconomy.model.auto.ProBasicCompany;
@@ -110,4 +111,140 @@ public class BenchmarkingController {
             return R.error(ResultMsg.error());
         }
     }
- }
+
+
+    @GetMapping("/wxssl")
+    @ResponseBody
+    @ApiOperation(value = "五项损失率", notes = "五项损失率")
+    public R wxssl(@RequestParam(value = "companys",required = true) String companys,
+                   @RequestParam(value = "type",required = true) String type,
+                    @RequestParam(value = "wpids",required = true) String wpids,
+                   @RequestParam(value = "projectids",required = true) String projectids,
+                   @RequestParam(value = "lineids",required = true) String lineids,
+                   @RequestParam(value = "beginDate",required = true) String beginDate,
+                   @RequestParam(value = "endDate",required = true) String endDate,
+                   @RequestParam(value = "target",required = true) String target,
+                   @RequestParam(value = "sort",required = true) String sort
+    ){
+        List<WxsslVo> resultList = benchmarkingService.wxssl(companys,type,wpids,projectids,lineids,beginDate,endDate,target,sort);
+
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
+
+    @GetMapping("/cndb")
+    @ResponseBody
+    @ApiOperation(value = "场内对标", notes = "场内对标")
+    public R cndb(@RequestParam(value = "companys",required = true) String companys,
+                  @RequestParam(value = "type",required = true) String type,
+                  @RequestParam(value = "wpid",required = true) String wpid,
+                  @RequestParam(value = "beginDate",required = true) String beginDate,
+                  @RequestParam(value = "endDate",required = true) String endDate,
+                  @RequestParam(value = "target",required = true) String target,
+                  @RequestParam(value = "sort",required = true) String sort
+    ){
+        List<WxsslVo> resultList = benchmarkingService.cndb(companys,type,wpid,beginDate,endDate,target,sort);
+
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
+
+
+    @GetMapping("/cjdb")
+    @ResponseBody
+    @ApiOperation(value = "场际对标", notes = "场际对标")
+    public R cjdb(@RequestParam(value = "companys",required = true) String companys,
+                  @RequestParam(value = "type",required = true) String type,
+                  @RequestParam(value = "wpids",required = true) String wpids,
+                  @RequestParam(value = "beginDate",required = true) String beginDate,
+                  @RequestParam(value = "endDate",required = true) String endDate,
+                  @RequestParam(value = "target",required = true) String target,
+                  @RequestParam(value = "sort",required = true) String sort
+    ){
+        List<WxsslVo> resultList = benchmarkingService.cjdb(companys,type,wpids,beginDate,endDate,target,sort);
+
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
+
+
+    @GetMapping("/xmdb")
+    @ResponseBody
+    @ApiOperation(value = "项目对标", notes = "项目对标")
+    public R xmdb(@RequestParam(value = "companys",required = true) String companys,
+                  @RequestParam(value = "type",required = true) String type,
+                  @RequestParam(value = "wpids",required = true) String wpids,
+                  @RequestParam(value = "projectids",required = true) String projectids,
+                  @RequestParam(value = "beginDate",required = true) String beginDate,
+                  @RequestParam(value = "endDate",required = true) String endDate,
+                  @RequestParam(value = "target",required = true) String target,
+                  @RequestParam(value = "sort",required = true) String sort
+    ){
+        List<WxsslVo> resultList = benchmarkingService.xmdb(companys,type,wpids,projectids,beginDate,endDate,target,sort);
+
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
+
+
+    @GetMapping("/xldb")
+    @ResponseBody
+    @ApiOperation(value = "线路对标", notes = "线路对标")
+    public R xldb(@RequestParam(value = "companys",required = true) String companys,
+                  @RequestParam(value = "type",required = true) String type,
+                  @RequestParam(value = "wpids",required = true) String wpids,
+                  @RequestParam(value = "projectids",required = true) String projectids,
+                  @RequestParam(value = "lineids",required = true) String lineids,
+                  @RequestParam(value = "beginDate",required = true) String beginDate,
+                  @RequestParam(value = "endDate",required = true) String endDate,
+                  @RequestParam(value = "target",required = true) String target,
+                  @RequestParam(value = "sort",required = true) String sort
+    ){
+        List<WxsslVo> resultList = benchmarkingService.xldb(companys,type,wpids,projectids,lineids,beginDate,endDate,target,sort);
+
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
+
+
+    /**
+     * 对标页面详情
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    @GetMapping("/details")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R details(@RequestParam(value = "id",required = true)String id,
+                     @RequestParam(value = "beginDate",required = true)String beginDate,
+                     @RequestParam(value = "endDate",required = true)String endDate,
+                     @RequestParam(value = "target",required = true) String target,
+                     @RequestParam(value = "sort",required = true) String sort
+    ){
+        List<WxsslVo> resultList =  benchmarkingService.details(id,beginDate,endDate,target,sort);
+
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+    }
+
+
+}

+ 1 - 1
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/model/auto/ProBasicEquipment.java

@@ -142,7 +142,7 @@ public class ProBasicEquipment extends Model {
     /**
      * 排序
      */
-    private String orderNum;
+    private Integer orderNum;
 
     private String substationId;
 }

+ 462 - 13
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/bmk/BenchmarkingService.java

@@ -6,11 +6,10 @@ package com.gyee.runeconomy.service.bmk;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.model.StringUtils;
-import com.gyee.common.util.BigDecimalUtils;
-import com.gyee.common.util.DateUtils;
-import com.gyee.common.util.DoubleUtils;
+import com.gyee.common.util.*;
 import com.gyee.common.vo.benchmark.FjjxbVo;
 import com.gyee.common.vo.benchmark.FjjxbmxVo;
+import com.gyee.common.vo.benchmark.WxsslVo;
 import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.model.auto.*;
 import com.gyee.runeconomy.service.auto.IProEconEquipmentInfoDay1Service;
@@ -26,6 +25,13 @@ import java.util.stream.Collectors;
 public class BenchmarkingService {
 
 
+    private  final String TYPE_DATE = "date";
+    private  final String TYPE_WIND = "wind";
+    private  final String TYPE_PROJECT = "project";
+    private  final String TYPE_LINE = "line";
+    private  final String TYPE_WINDTURBINE = "windturbine";
+
+
     @Resource
     private IProEconEquipmentInfoDay1Service proEconEquipmentInfoDay1Service;
 
@@ -133,16 +139,16 @@ public class BenchmarkingService {
             FjjxbVo vo = new FjjxbVo();
             if (sttype.equals("1")){
                 vo.setId(i.getWindpowerstationId());
-                vo.setName(CacheContext.wpmap.get(i.getWindpowerstationId().trim()).getAname());
+                vo.setName(CacheContext.wpmap.get(i.getWindpowerstationId().trim()).getName());
             }else if(sttype.equals("2")){
                 vo.setId(i.getProjectId());
-                vo.setName(CacheContext.pjmap.get(i.getProjectId().trim()).getAname());
+                vo.setName(CacheContext.pjmap.get(i.getProjectId().trim()).getName());
             }else if(sttype.equals("3")){
                 vo.setId(i.getLineId());
-                vo.setName(CacheContext.lnmap.get(i.getLineId().trim()).getAname());
+                vo.setName(CacheContext.lnmap.get(i.getLineId().trim()).getName());
             }else{
                 vo.setId(i.getWindturbineId());
-                vo.setName(CacheContext.wtmap.get(i.getWindturbineId().trim()).getAname());
+                vo.setName(CacheContext.wtmap.get(i.getWindturbineId().trim()).getName());
             }
             vo.setSjfdl(BigDecimalUtils.divide(new BigDecimal(i.getRfdl()),new BigDecimal(10000),2).doubleValue());
             vo.setLlfdl(BigDecimalUtils.divide(new BigDecimal(i.getRllfdl()),new BigDecimal(10000),2).doubleValue());
@@ -155,7 +161,7 @@ public class BenchmarkingService {
             vo.setXn(BigDecimalUtils.divide(new BigDecimal(i.getRdjssdl()+i.getRqxjclssdl()+i.getRsdtjssdl()+i.getRxnssdl()),new BigDecimal(10000),2).doubleValue());
 //            vo.setLlfdl(DoubleUtils.getRoundingNum(vo.getSjfdl()+vo.getFjhjx()+vo.getJhjx()+vo.getXd()+vo.getXn(),2));
             vo.setFnlly(vo.getLlfdl()!=0? DoubleUtils.keepPrecision(vo.getSjfdl()/vo.getLlfdl()*100,2):0);
-            vo.setPoint(DoubleUtils.keepPrecision(vo.getLlfdl()+10,2));
+            vo.setPoint(DoubleUtils.keepPrecision(vo.getLlfdl()*1.1,2));
 
             llfdl.updateAndGet(v -> new Double((double) (v + vo.getLlfdl())));
             sjfdl.updateAndGet(v -> new Double((double) (v + vo.getSjfdl())));
@@ -179,7 +185,7 @@ public class BenchmarkingService {
         vo.setXn(DoubleUtils.keepPrecision(xn.get().doubleValue(),2));
         vo.setSl(DoubleUtils.keepPrecision(sl.get().doubleValue(),2));
         vo.setFnlly(vo.getLlfdl()!=0?DoubleUtils.keepPrecision(vo.getSjfdl()/vo.getLlfdl()*100,2):0.0);
-        vo.setPoint(DoubleUtils.keepPrecision(vo.getLlfdl()+10,2));
+        vo.setPoint(DoubleUtils.keepPrecision(vo.getLlfdl()*1.1,2));
         resultList.add(vo);
         return resultList;
     }
@@ -253,16 +259,16 @@ public class BenchmarkingService {
             FjjxbmxVo vo = new FjjxbmxVo();
             if (sttype.equals("1")){
                 vo.setId(i.getWindpowerstationId());
-                vo.setName(CacheContext.wpmap.get(i.getWindpowerstationId().trim()).getAname());
+                vo.setName(CacheContext.wpmap.get(i.getWindpowerstationId().trim()).getName());
             }else if(sttype.equals("2")){
                 vo.setId(i.getProjectId());
-                vo.setName(CacheContext.pjmap.get(i.getProjectId().trim()).getAname());
+                vo.setName(CacheContext.pjmap.get(i.getProjectId().trim()).getName());
             }else if(sttype.equals("3")){
                 vo.setId(i.getLineId());
-                vo.setName(CacheContext.lnmap.get(i.getLineId().trim()).getAname());
+                vo.setName(CacheContext.lnmap.get(i.getLineId().trim()).getName());
             }else{
                 vo.setId(i.getWindturbineId());
-                vo.setName(CacheContext.wtmap.get(i.getWindturbineId().trim()).getAname());
+                vo.setName(CacheContext.wtmap.get(i.getWindturbineId().trim()).getName());
             }
             vo.setSjfdl(DoubleUtils.keepPrecision(i.getRfdl()/10000,2));
             vo.setLlfdl(DoubleUtils.keepPrecision(i.getRllfdl()/10000,2));
@@ -321,4 +327,447 @@ public class BenchmarkingService {
         resultList.add(vo);
         return resultList;
     }
+
+    public List<WxsslVo> wxssl(String companys, String type, String wpids, String projectids, String lineids, String beginDate, String endDate, String target, String sort)  {
+        List<WxsslVo> resultList = new ArrayList<>();
+        List<ProBasicPowerstation> wpls = CacheContext.wpls;
+        QueryWrapper<ProEconEquipmentInfoDay1> qw = new QueryWrapper<>();
+        StringBuilder sb = new StringBuilder();
+
+        if (StringUtils.isNotEmpty(wpids) && StringUtils.isEmpty(projectids) && StringUtils.isEmpty(lineids)){
+            sb.append("windpowerstation_id,");
+        }else if (StringUtils.isNotEmpty(wpids) && StringUtils.isNotEmpty(projectids) && StringUtils.isEmpty(lineids)){
+            sb.append("project_id,");
+        } else if (StringUtils.isNotEmpty(wpids) && StringUtils.isNotEmpty(projectids) && StringUtils.isNotEmpty(lineids)){
+            sb.append("line_id,");
+        }else {
+            sb.append("windpowerstation_id,");
+        }
+        sb.append("sum(rfdl) rfdl,sum(rllfdl) rllfdl,avg(rpjfs) rpjfs,sum(rjxssdl) rjxssdl,sum(rcnsljxssdl) rcnsljxssdl,sum(rgzssdl) rgzssdl,sum(rcnslgzssdl) rcnslgzssdl,sum(rxdtjssdl) rxdtjssdl,sum(rxdjclssdl) rxdjclssdl,sum(rdjssdl) rdjssdl,sum(rqxjclssdl) rqxjclssdl,sum(rsdtjssdl) rsdtjssdl,sum(rxnssdl) rxnssdl,sum(rcwsldwssdl) rcwsldwssdl,sum(rcwsltqssdl) rcwsltqssdl");
+        qw.select(String.valueOf(sb));
+        qw.ge("record_date",DateUtils.parseDate(beginDate)).le("record_date",DateUtils.parseDate(endDate));
+
+        if (companys.endsWith("RGN")){
+            qw.eq("region_id",companys);
+        }else {
+            qw.eq("company_id",companys);
+        }
+        if (type.equals("-1")){
+            qw.like("windturbine_id","_WT_");
+        }else {
+            qw.like("windturbine_id","_IN_");
+        }
+        if (StringUtils.isNotEmpty(wpids)){
+            List<String> wpList = Arrays.asList(wpids.split(","));
+            qw.in("windpowerstation_id",wpList);
+        }
+
+        if (StringUtils.isNotEmpty(projectids)){
+            List<String> proList = Arrays.asList(projectids.split(","));
+            qw.in("project_id",proList);
+        }
+        if (StringUtils.isNotEmpty(lineids)){
+            List<String> lineList = Arrays.asList(lineids.split(","));
+            qw.in("line_id",lineList);
+        }
+        if (StringUtils.isNotEmpty(wpids) && StringUtils.isEmpty(projectids) && StringUtils.isEmpty(lineids)){
+            qw.groupBy("windpowerstation_id");
+        }else if (StringUtils.isNotEmpty(wpids) && StringUtils.isNotEmpty(projectids) && StringUtils.isEmpty(lineids)){
+            qw.groupBy("project_id");
+        } else if (StringUtils.isNotEmpty(wpids) && StringUtils.isNotEmpty(projectids) && StringUtils.isNotEmpty(lineids)){
+            qw.groupBy("line_id");
+        }else {
+            qw.groupBy("windpowerstation_id");
+        }
+        List<ProEconEquipmentInfoDay1> list = proEconEquipmentInfoDay1Service.list(qw);
+
+        Map<String,Integer> station =  wpls
+                .stream().collect(Collectors.toMap(ProBasicPowerstation::getId,ProBasicPowerstation::getOrderNum));
+
+        list.stream().forEach(i->{
+            WxsslVo vo = new WxsslVo();
+            station.get(i.getWindpowerstationId());
+            if (StringUtils.isNotEmpty(wpids) && StringUtils.isEmpty(projectids) && StringUtils.isEmpty(lineids)){
+                vo.setId(i.getWindpowerstationId());
+                vo.setName(CacheContext.wpmap.get(i.getWindpowerstationId().trim()).getName());
+                vo.setOrdernum(station.get(i.getWindpowerstationId()).doubleValue());
+            }else if (StringUtils.isNotEmpty(wpids) && StringUtils.isNotEmpty(projectids) && StringUtils.isEmpty(lineids)){
+                vo.setId(i.getProjectId());
+                vo.setName(CacheContext.pjmap.get(i.getProjectId().trim()).getName());
+                vo.setOrdernum(CacheContext.pjmap.get(i.getProjectId().trim()).getOrderNum().doubleValue());
+            } else if (StringUtils.isNotEmpty(wpids) && StringUtils.isNotEmpty(projectids) && StringUtils.isNotEmpty(lineids)){
+                vo.setId(i.getLineId());
+                vo.setName(CacheContext.lnmap.get(i.getLineId().trim()).getName());
+                vo.setOrdernum(CacheContext.lnmap.get(i.getLineId().trim()).getOrderNum().doubleValue());
+            }else {
+                vo.setId(i.getWindpowerstationId());
+                vo.setName(CacheContext.wpmap.get(i.getWindpowerstationId().trim()).getName());
+                vo.setOrdernum(station.get(i.getWindpowerstationId()).doubleValue());
+            }
+
+            vo.setFdl(DoubleUtils.keepPrecision(i.getRfdl()/10000,2));
+            vo.setLlfdl(DoubleUtils.keepPrecision(i.getRllfdl()/10000,2));
+            vo.setJxssdl(DoubleUtils.keepPrecision((i.getRjxssdl()+i.getRcnsljxssdl())/10000,2));
+            vo.setGzssdl(DoubleUtils.keepPrecision((i.getRgzssdl()+i.getRcnslgzssdl())/10000,2));
+            vo.setXdssdl(DoubleUtils.keepPrecision((i.getRxdtjssdl()+i.getRxdjclssdl())/10000,2));
+            vo.setSlssdl(DoubleUtils.keepPrecision((i.getRcwsltqssdl()+i.getRcwsldwssdl())/10000,2));
+            vo.setXnssdl(DoubleUtils.keepPrecision((i.getRdjssdl()+i.getRsdtjssdl()+i.getRqxjclssdl()+i.getRxnssdl())/10000,2));
+            vo.setZssdl(DoubleUtils.keepPrecision((vo.getGzssdl()+vo.getJxssdl()+vo.getXdssdl()+vo.getXnssdl()+vo.getSlssdl())/10000,2));
+            vo.setFnlyl(vo.getLlfdl()!=0?DoubleUtils.keepPrecision(vo.getFdl()/vo.getLlfdl()*100,2):0.0);
+            vo.setGzssl(vo.getLlfdl()!=0?DoubleUtils.keepPrecision(vo.getGzssdl()/vo.getLlfdl()*100,2):0.0);
+            vo.setJxssl(vo.getLlfdl()!=0?DoubleUtils.keepPrecision(vo.getJxssdl()/vo.getLlfdl()*100,2):0.0);
+            vo.setQfl(vo.getLlfdl()!=0?DoubleUtils.keepPrecision(vo.getXdssdl()/vo.getLlfdl()*100,2):0.0);
+            vo.setXnssl(vo.getLlfdl()!=0?DoubleUtils.keepPrecision(vo.getXnssdl()/vo.getLlfdl()*100,2):0.0);
+            vo.setSlssl(vo.getLlfdl()!=0?DoubleUtils.keepPrecision(vo.getSlssdl()/vo.getLlfdl()*100,2):0.0);
+            resultList.add(vo);
+        });
+        SortUtils.sort(resultList,"fdl",SortUtils.DESC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setFdlpm(i+1);
+        }
+
+        SortUtils.sort(resultList,"fnlyl",SortUtils.DESC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setFnlylpm(i+1);
+        }
+        SortUtils.sort(resultList,"zssdl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setZhpm(i+1);
+        }
+        SortUtils.sort(resultList,"gzssdl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setGzssdlpm(i+1);
+        }
+        SortUtils.sort(resultList,"gzssl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setGzsslpm(i+1);
+        }
+        SortUtils.sort(resultList,"jxssdl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setJxssdlpm(i+1);
+        }
+        SortUtils.sort(resultList,"jxssl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setJxsslpm(i+1);
+        }
+        SortUtils.sort(resultList,"xdssdl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setXdssdlpm(i+1);
+        }
+        SortUtils.sort(resultList,"qfl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setQflpm(i+1);
+        }
+        SortUtils.sort(resultList,"xnssdl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setXnssdlpm(i+1);
+        }
+        SortUtils.sort(resultList,"xnssl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setXnsslpm(i+1);
+        }
+        SortUtils.sort(resultList,"slssdl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setSlssdlpm(i+1);
+        }
+        SortUtils.sort(resultList,"slssl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setSlsslpm(i+1);
+        }
+        if (StringUtils.isNotEmpty(target) && StringUtils.isNotEmpty(sort)){
+            if (sort.equals("1")){
+                SortUtils.sort(resultList,target,SortUtils.ASC);
+            }else {
+                SortUtils.sort(resultList,target,SortUtils.DESC);
+            }
+        }else {
+            //SortUtils.sort(resultList,"fdl",SortUtils.DESC);
+            SortUtils.sort(resultList,"ordernum",SortUtils.ASC);
+        }
+        return resultList;
+    }
+
+
+
+    public List<WxsslVo> cndb(String companys, String type, String wpid, String beginDate, String endDate, String target, String sort) {
+        QueryWrapper<ProEconEquipmentInfoDay1> qw = new QueryWrapper<>();
+        List<WxsslVo> resultList = new ArrayList<>();
+        qw.select("record_date,sum(rfdl) rfdl,sum(rllfdl) rllfdl,avg(rpjfs) rpjfs,sum(rjxssdl) rjxssdl,sum(rcnsljxssdl) rcnsljxssdl,sum(rgzssdl) rgzssdl,sum(rcnslgzssdl) rcnslgzssdl,sum(rxdtjssdl) rxdtjssdl,sum(rxdjclssdl) rxdjclssdl,sum(rdjssdl) rdjssdl,sum(rqxjclssdl) rqxjclssdl,sum(rsdtjssdl) rsdtjssdl,sum(rxnssdl) rxnssdl,sum(rcwsldwssdl) rcwsldwssdl,sum(rcwsltqssdl) rcwsltqssdl");
+        qw.ge("record_date",DateUtils.parseDate(beginDate)).le("record_date",DateUtils.parseDate(endDate));
+        if (StringUtils.isNotEmpty(wpid)){
+            qw.eq("windpowerstation_id",wpid);
+        }
+        if (companys.endsWith("RGN")){
+            qw.eq("region_id",companys);
+        }else {
+            qw.eq("company_id",companys);
+        }
+        if (type.equals("-1")){
+            qw.like("windturbine_id","_WT_");
+        }else {
+            qw.like("windturbine_id","_IN_");
+        }
+        qw.groupBy("record_date");
+        List<WxsslVo> wxsslVoList = getWxsslSortVos(qw,resultList,TYPE_DATE);
+        if (StringUtils.isNotEmpty(target) && StringUtils.isNotEmpty(sort)){
+            if (sort.equals("1")){
+                SortUtils.sort(resultList,target,SortUtils.ASC);
+            }else {
+                SortUtils.sort(resultList,target,SortUtils.DESC);
+            }
+        }else {
+            SortUtils.sort(resultList,"date",SortUtils.ASC);
+        }
+        return wxsslVoList;
+    }
+
+    public List<WxsslVo> cjdb(String companys, String type, String wpids, String beginDate, String endDate, String target, String sort) {
+        List<WxsslVo> resultList = new ArrayList<>();
+        QueryWrapper<ProEconEquipmentInfoDay1> qw = new QueryWrapper<>();
+        qw.select("windpowerstation_id,sum(rfdl) rfdl,sum(rllfdl) rllfdl,avg(rpjfs) rpjfs,sum(rjxssdl) rjxssdl,sum(rcnsljxssdl) rcnsljxssdl,sum(rgzssdl) rgzssdl,sum(rcnslgzssdl) rcnslgzssdl,sum(rxdtjssdl) rxdtjssdl,sum(rxdjclssdl) rxdjclssdl,sum(rdjssdl) rdjssdl,sum(rqxjclssdl) rqxjclssdl,sum(rsdtjssdl) rsdtjssdl,sum(rxnssdl) rxnssdl,sum(rcwsldwssdl) rcwsldwssdl,sum(rcwsltqssdl) rcwsltqssdl");
+
+        qw.ge("record_date",DateUtils.parseDate(beginDate)).le("record_date",DateUtils.parseDate(endDate));
+        if (StringUtils.isNotEmpty(wpids)){
+            List<String> wpList = Arrays.asList(wpids.split(","));
+            qw.in("windpowerstation_id",wpList);
+        }
+        if (companys.endsWith("RGN")){
+            qw.eq("region_id",companys);
+        }else {
+            qw.eq("company_id",companys);
+        }
+        if (type.equals("-1")){
+            qw.like("windturbine_id","_WT_");
+        }else {
+            qw.like("windturbine_id","_IN_");
+        }
+        qw.groupBy("windpowerstation_id");
+        List<WxsslVo> wxsslVoList = getWxsslSortVos(qw,resultList,TYPE_WIND);
+        if (StringUtils.isNotEmpty(target) && StringUtils.isNotEmpty(sort)){
+            if (sort.equals("1")){
+                SortUtils.sort(resultList,target,SortUtils.ASC);
+            }else {
+                SortUtils.sort(resultList,target,SortUtils.DESC);
+            }
+        }else {
+            SortUtils.sort(resultList,"ordernum",SortUtils.ASC);
+        }
+        return wxsslVoList;
+    }
+
+
+    public List<WxsslVo> xmdb(String companys, String type, String wpids, String projectids, String beginDate, String endDate, String target, String sort) {
+        List<WxsslVo> resultList = new ArrayList<>();
+        QueryWrapper<ProEconEquipmentInfoDay1> qw = new QueryWrapper<>();
+        qw.select("project_id,sum(rfdl) rfdl,sum(rllfdl) rllfdl,avg(rpjfs) rpjfs,sum(rjxssdl) rjxssdl,sum(rcnsljxssdl) rcnsljxssdl,sum(rgzssdl) rgzssdl,sum(rcnslgzssdl) rcnslgzssdl,sum(rxdtjssdl) rxdtjssdl,sum(rxdjclssdl) rxdjclssdl,sum(rdjssdl) rdjssdl,sum(rqxjclssdl) rqxjclssdl,sum(rsdtjssdl) rsdtjssdl,sum(rxnssdl) rxnssdl,sum(rcwsldwssdl) rcwsldwssdl,sum(rcwsltqssdl) rcwsltqssdl");
+        qw.ge("record_date",DateUtils.parseDate(beginDate)).le("record_date",DateUtils.parseDate(endDate));
+        if (StringUtils.isNotEmpty(wpids)){
+            List<String> wpList = Arrays.asList(wpids.split(","));
+            qw.in("windpowerstation_id",wpList);
+        }
+        if (StringUtils.isNotEmpty(projectids)){
+            List<String> projectList = Arrays.asList(projectids.split(","));
+            qw.in("project_id",projectList);
+        }
+        if (companys.endsWith("RGN")){
+            qw.eq("region_id",companys);
+        }else {
+            qw.eq("company_id",companys);
+        }
+        if (type.equals("-1")){
+            qw.like("windturbine_id","_WT_");
+        }else {
+            qw.like("windturbine_id","_IN_");
+        }
+        qw.groupBy("project_id");
+        List<WxsslVo> wxsslVoList = getWxsslSortVos(qw,resultList,TYPE_PROJECT);
+        if (StringUtils.isNotEmpty(target) && StringUtils.isNotEmpty(sort)){
+            if (sort.equals("1")){
+                SortUtils.sort(resultList,target,SortUtils.ASC);
+            }else {
+                SortUtils.sort(resultList,target,SortUtils.DESC);
+            }
+        }else {
+            SortUtils.sort(resultList,"fdl",SortUtils.ASC);
+        }
+        return wxsslVoList;
+    }
+
+    public List<WxsslVo> xldb(String companys, String type, String wpids, String projectids, String lineids, String beginDate, String endDate, String target, String sort) {
+        List<WxsslVo> resultList = new ArrayList<>();
+        QueryWrapper<ProEconEquipmentInfoDay1> qw = new QueryWrapper<>();
+        qw.select("line_id,sum(rfdl) rfdl,sum(rllfdl) rllfdl,avg(rpjfs) rpjfs,sum(rjxssdl) rjxssdl,sum(rcnsljxssdl) rcnsljxssdl,sum(rgzssdl) rgzssdl,sum(rcnslgzssdl) rcnslgzssdl,sum(rxdtjssdl) rxdtjssdl,sum(rxdjclssdl) rxdjclssdl,sum(rdjssdl) rdjssdl,sum(rqxjclssdl) rqxjclssdl,sum(rsdtjssdl) rsdtjssdl,sum(rxnssdl) rxnssdl,sum(rcwsldwssdl) rcwsldwssdl,sum(rcwsltqssdl) rcwsltqssdl");
+
+        qw.ge("record_date",DateUtils.parseDate(beginDate)).le("record_date",DateUtils.parseDate(endDate));
+
+        if (StringUtils.isNotEmpty(wpids)){
+            List<String> wpList = Arrays.asList(wpids.split(","));
+            qw.in("windpowerstation_id",wpList);
+        }
+        if (StringUtils.isNotEmpty(projectids)){
+            List<String> projectList = Arrays.asList(projectids.split(","));
+            qw.in("project_id",projectList);
+        }
+        if (StringUtils.isNotEmpty(lineids)){
+            List<String> lineList = Arrays.asList(lineids.split(","));
+            qw.in("line_id",lineList);
+
+        }
+        if (companys.endsWith("RGN")){
+            qw.eq("region_id",companys);
+        }else {
+            qw.eq("company_id",companys);
+        }
+        if (type.equals("-1")){
+            qw.like("windturbine_id","_WT_");
+        }else {
+            qw.like("windturbine_id","_IN_");
+        }
+        qw.groupBy("line_id");
+        List<WxsslVo> wxsslVoList = getWxsslSortVos(qw,resultList,TYPE_LINE);
+        if (StringUtils.isNotEmpty(target) && StringUtils.isNotEmpty(sort)){
+            if (sort.equals("1")){
+                SortUtils.sort(resultList,target,SortUtils.ASC);
+            }else {
+                SortUtils.sort(resultList,target,SortUtils.DESC);
+            }
+        }else {
+            SortUtils.sort(resultList,"fdl",SortUtils.ASC);
+        }
+        return wxsslVoList;
+    }
+
+    /**
+     * 根据查询条件和类型,查询处五项损失并封装到结果list
+     * @param qw
+     * @param resultList
+     * @param type
+     * @return
+     */
+    private List<WxsslVo> getWxsslSortVos(QueryWrapper<ProEconEquipmentInfoDay1> qw, List<WxsslVo> resultList, String type) {
+
+        Map<String,Integer> station =  CacheContext.wpls
+                .stream().collect(Collectors.toMap(ProBasicPowerstation::getId,ProBasicPowerstation::getOrderNum));
+
+        List<ProEconEquipmentInfoDay1> list = proEconEquipmentInfoDay1Service.list(qw);
+        list.stream().forEach(i->{
+            WxsslVo vo = new WxsslVo();
+
+            if (type.equals(TYPE_WIND)){
+                vo.setId(i.getWindpowerstationId());
+                vo.setName(CacheContext.wpmap.get(i.getWindpowerstationId().trim()).getName());
+                vo.setOrdernum(station.get(i.getWindpowerstationId()).doubleValue());
+            }else if(type.equals(TYPE_PROJECT)){
+                vo.setId(i.getProjectId());
+                vo.setName(CacheContext.pjmap.get(i.getProjectId().trim()).getName());
+                vo.setOrdernum(CacheContext.pjmap.get(i.getProjectId().trim()).getOrderNum().doubleValue());
+            }else if(type.equals(TYPE_LINE)){
+                vo.setId(i.getLineId());
+                vo.setName(CacheContext.lnmap.get(i.getLineId().trim()).getName());
+                vo.setOrdernum(CacheContext.lnmap.get(i.getLineId().trim()).getOrderNum().doubleValue());
+            }else if(type.equals(TYPE_WINDTURBINE)){
+                vo.setId(i.getWindturbineId());
+                vo.setName(CacheContext.wtmap.get(i.getWindturbineId().trim()).getName());
+                vo.setOrdernum(CacheContext.wtmap.get(i.getWindturbineId().trim()).getOrderNum().doubleValue());
+            }
+            vo.setDate(i.getRecordDate());
+            vo.setFdl(DoubleUtils.keepPrecision(i.getRfdl()/10000,2));
+            vo.setLlfdl(DoubleUtils.keepPrecision(i.getRllfdl()/10000,2));
+            vo.setJxssdl(DoubleUtils.keepPrecision((i.getRjxssdl()+i.getRcnsljxssdl())/10000,2));
+            vo.setGzssdl(DoubleUtils.keepPrecision((i.getRgzssdl()+i.getRcnslgzssdl())/10000,2));
+            vo.setXdssdl(DoubleUtils.keepPrecision((i.getRxdtjssdl()+i.getRxdjclssdl())/10000,2));
+            vo.setSlssdl(DoubleUtils.keepPrecision((i.getRcwsltqssdl()+i.getRcwsldwssdl())/10000,2));
+            vo.setXnssdl(DoubleUtils.keepPrecision((i.getRdjssdl()+i.getRsdtjssdl()+i.getRqxjclssdl()+i.getRxnssdl())/10000,2));
+
+            vo.setFnlyl(vo.getLlfdl()!=0?DoubleUtils.keepPrecision(vo.getFdl()/vo.getLlfdl()*100,2):0);
+            vo.setGzssl(vo.getLlfdl()!=0?DoubleUtils.keepPrecision(vo.getGzssdl()/vo.getLlfdl()*100,2):0);
+            vo.setJxssl(vo.getLlfdl()!=0?DoubleUtils.keepPrecision(vo.getJxssdl()/vo.getLlfdl()*100,2):0);
+            vo.setQfl(vo.getLlfdl()!=0?DoubleUtils.keepPrecision(vo.getXdssdl()/vo.getLlfdl()*100,2):0);
+            vo.setXnssl(vo.getLlfdl()!=0?DoubleUtils.keepPrecision(vo.getXnssdl()/vo.getLlfdl()*100,2):0);
+            vo.setSlssl(vo.getLlfdl()!=0?DoubleUtils.keepPrecision(vo.getSlssdl()/vo.getLlfdl()*100,2):0);
+            resultList.add(vo);
+        });
+        SortUtils.sort(resultList,"llfdl",SortUtils.DESC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setZhpm(i+1);
+        }
+        SortUtils.sort(resultList,"fdl",SortUtils.DESC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setFdlpm(i+1);
+        }
+        SortUtils.sort(resultList,"fnlyl",SortUtils.DESC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setFnlylpm(i+1);
+        }
+        SortUtils.sort(resultList,"gzssdl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setGzssdlpm(i+1);
+        }
+        SortUtils.sort(resultList,"gzssl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setGzsslpm(i+1);
+        }
+        SortUtils.sort(resultList,"jxssdl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setJxssdlpm(i+1);
+        }
+        SortUtils.sort(resultList,"jxssl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setJxsslpm(i+1);
+        }
+        SortUtils.sort(resultList,"xdssdl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setXdssdlpm(i+1);
+        }
+        SortUtils.sort(resultList,"qfl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setQflpm(i+1);
+        }
+        SortUtils.sort(resultList,"xnssdl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setXnssdlpm(i+1);
+        }
+        SortUtils.sort(resultList,"xnssl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setXnsslpm(i+1);
+        }
+        SortUtils.sort(resultList,"slssdl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setSlssdlpm(i+1);
+        }
+        SortUtils.sort(resultList,"slssl",SortUtils.ASC);
+        for (int i=0;i<resultList.size();i++){
+            resultList.get(i).setSlsslpm(i+1);
+        }
+
+        return resultList;
+    }
+
+
+    public List<WxsslVo> details(String id, String beginDate, String endDate, String target, String sort) {
+        List<WxsslVo> resultList = new ArrayList<>();
+        QueryWrapper<ProEconEquipmentInfoDay1> qw = new QueryWrapper<>();
+        qw.select("windturbine_id,sum(rfdl) rfdl,sum(rllfdl) rllfdl,avg(rpjfs) rpjfs,sum(rjxssdl) rjxssdl,sum(rcnsljxssdl) rcnsljxssdl,sum(rgzssdl) rgzssdl,sum(rcnslgzssdl) rcnslgzssdl,sum(rxdtjssdl) rxdtjssdl,sum(rxdjclssdl) rxdjclssdl,sum(rdjssdl) rdjssdl,sum(rqxjclssdl) rqxjclssdl,sum(rsdtjssdl) rsdtjssdl,sum(rxnssdl) rxnssdl,sum(rcwsldwssdl) rcwsldwssdl,sum(rcwsltqssdl) rcwsltqssdl");
+
+        qw.ge("record_date",DateUtils.parseDate(beginDate)).le("record_date",DateUtils.parseDate(endDate));
+        if (id.endsWith("STA")){
+            qw.eq("windpowerstation_id",id);
+        }else if(id.endsWith("EG")){
+            qw.eq("project_id",id);
+        }else if(id.endsWith("LN")){
+        }
+            qw.eq("line_id",id);
+        qw.groupBy("windturbine_id");
+        List<WxsslVo> wxsslVoList = getWxsslSortVos(qw,resultList,TYPE_WINDTURBINE);
+        if (StringUtils.isNotEmpty(target) && StringUtils.isNotEmpty(sort)){
+            if (sort.equals("1")){
+                SortUtils.sort(resultList,target,SortUtils.ASC);
+            }else {
+                SortUtils.sort(resultList,target,SortUtils.DESC);
+            }
+        }else {
+            SortUtils.sort(resultList,"fdl",SortUtils.ASC);
+        }
+        return wxsslVoList;
+    }
 }