Browse Source

风机绩效榜接口开发

xieshengjie 2 years ago
parent
commit
18f76f620f

+ 1 - 0
common/src/main/java/com/gyee/common/vo/benchmark/FjjxbVo.java

@@ -25,4 +25,5 @@ public class FjjxbVo  implements Serializable  {
     private Double xd;  //限电
     private Double xn;  //性能
     private Double fnlly;   //风能利用率
+    private Double point;
 }

+ 1 - 0
common/src/main/java/com/gyee/common/vo/benchmark/FjjxbmxVo.java

@@ -32,4 +32,5 @@ public class FjjxbmxVo implements Serializable {
     private Double xn3;   //正常发电
     private Double xn4;   //缺陷降出
     private Double fnlly;   //风能利用率
+    private Double point;
 }

+ 139 - 3
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/bmk/BenchmarkingService.java

@@ -10,6 +10,7 @@ import com.gyee.common.util.BigDecimalUtils;
 import com.gyee.common.util.DateUtils;
 import com.gyee.common.util.DoubleUtils;
 import com.gyee.common.vo.benchmark.FjjxbVo;
+import com.gyee.common.vo.benchmark.FjjxbmxVo;
 import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.model.auto.*;
 import com.gyee.runeconomy.service.auto.IProBasicCompanyService;
@@ -143,7 +144,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));
 
             llfdl.updateAndGet(v -> new Double((double) (v + vo.getLlfdl())));
             sjfdl.updateAndGet(v -> new Double((double) (v + vo.getSjfdl())));
@@ -167,11 +168,146 @@ 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));
         resultList.add(vo);
         return resultList;
     }
 
-    public List<FjjxbVo> performanceMX(String companyid, String getype, String sttype, String beginDate, String endDate, String wpids, String projectids, String lineids) {
-        return null;
+    public List<FjjxbmxVo> performanceMX(String companyid, String getype, String sttype, String beginDate, String endDate, String wpids, String projectids, String lineids) {
+        List<FjjxbmxVo> resultList = new ArrayList<>();
+        QueryWrapper<ProEconEquipmentInfoDay1> qw = new QueryWrapper<>();
+        StringBuilder sb = new StringBuilder();
+        if (sttype.equals("1") ){
+            sb.append("windpowerstation_id,");
+        }else if (sttype.equals("2")){
+            sb.append("project_id,");
+        } else if (sttype.equals("3")){
+            sb.append("line_id,");
+        }else {
+            sb.append("windturbine_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 (companyid.endsWith("ZGS")){
+            qw.eq("company_id",companyid);
+        }
+        if (getype.equals("-1")){
+            qw.like("windturbine_id","_F_WT_");
+        }else if(getype.equals("-2")){
+            qw.like("windturbine_id","_G_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 (sttype.equals("1")){
+            qw.groupBy("windpowerstation_id");
+        }else if(sttype.equals("2")){
+            qw.groupBy("project_id");
+        }else if(sttype.equals("3")){
+            qw.groupBy("line_id");
+        }else{
+            qw.groupBy("windturbine_id");
+        }
+        List<ProEconEquipmentInfoDay1> list = proEconEquipmentInfoDay1Service.list(qw);
+        AtomicReference<Double> llfdl = new AtomicReference<>((double) 0);
+        AtomicReference<Double> sjfdl = new AtomicReference<>((double) 0);
+        AtomicReference<Double> pjfs = new AtomicReference<>((double) 0);
+        AtomicReference<Double> wh1 = new AtomicReference<>((double) 0);
+        AtomicReference<Double> wh2 = new AtomicReference<>((double) 0);
+        AtomicReference<Double> gz1 = new AtomicReference<>((double) 0);
+        AtomicReference<Double> gz2 = new AtomicReference<>((double) 0);
+        AtomicReference<Double> xd1 = new AtomicReference<>((double) 0);
+        AtomicReference<Double> xd2 = new AtomicReference<>((double) 0);
+        AtomicReference<Double> xn1 = new AtomicReference<>((double) 0);
+        AtomicReference<Double> xn2 = new AtomicReference<>((double) 0);
+        AtomicReference<Double> xn3 = new AtomicReference<>((double) 0);
+        AtomicReference<Double> xn4 = new AtomicReference<>((double) 0);
+        AtomicReference<Double> sl1 = new AtomicReference<>((double) 0);
+        AtomicReference<Double> sl2 = new AtomicReference<>((double) 0);
+
+
+        list.stream().forEach(i->{
+            FjjxbmxVo vo = new FjjxbmxVo();
+            if (sttype.equals("1")){
+                vo.setId(i.getWindpowerstationId());
+                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()).getName());
+            }else if(sttype.equals("3")){
+                vo.setId(i.getLineId());
+                vo.setName(CacheContext.lnmap.get(i.getLineId().trim()).getName());
+            }else{
+                vo.setId(i.getWindturbineId());
+                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));
+            vo.setSpeed(DoubleUtils.keepPrecision(i.getRpjfs(),2));
+            vo.setFjhjx1(DoubleUtils.keepPrecision(i.getRgzssdl()/10000,2));
+            vo.setFjhjx2(DoubleUtils.keepPrecision(i.getRcnslgzssdl()/10000,2));
+            vo.setJhjx1(DoubleUtils.keepPrecision(i.getRjxssdl()/10000,2));
+            vo.setJhjx2(DoubleUtils.keepPrecision(i.getRcnsljxssdl()/10000,2));
+            vo.setXd1(DoubleUtils.keepPrecision(i.getRxdjclssdl()/10000,2));
+            vo.setXd2(DoubleUtils.keepPrecision(i.getRxdtjssdl()/10000,2));
+            vo.setSl1(DoubleUtils.keepPrecision(i.getRcwsldwssdl()/10000,2));
+            vo.setSl2(DoubleUtils.keepPrecision(i.getRcwsltqssdl()/10000,2));
+            vo.setXn1(DoubleUtils.keepPrecision(i.getRdjssdl()/10000,2));
+            vo.setXn2(DoubleUtils.keepPrecision(i.getRsdtjssdl()/10000,2));
+            vo.setXn3(DoubleUtils.keepPrecision(i.getRxnssdl()/10000,2));
+            vo.setXn4(DoubleUtils.keepPrecision(i.getRqxjclssdl()/10000,2));
+            vo.setFnlly(vo.getLlfdl()!=0?DoubleUtils.keepPrecision(vo.getSjfdl()/vo.getLlfdl()*100,2):0.0);
+            vo.setPoint(DoubleUtils.keepPrecision(vo.getLlfdl()+10,2));
+            llfdl.updateAndGet(v -> new Double((double) (v + vo.getLlfdl())));
+            sjfdl.updateAndGet(v -> new Double((double) (v + vo.getSjfdl())));
+            pjfs.updateAndGet(v -> new Double((double) (v + vo.getSpeed())));
+            wh1.updateAndGet(v -> new Double((double) (v + vo.getJhjx1())));
+            wh2.updateAndGet(v -> new Double((double) (v + vo.getJhjx2())));
+            gz1.updateAndGet(v -> new Double((double) (v + vo.getFjhjx1())));
+            gz2.updateAndGet(v -> new Double((double) (v + vo.getFjhjx2())));
+            xd1.updateAndGet(v -> new Double((double) (v + vo.getXd1())));
+            xd2.updateAndGet(v -> new Double((double) (v + vo.getXd2())));
+            xn1.updateAndGet(v -> new Double((double) (v + vo.getXn1())));
+            xn2.updateAndGet(v -> new Double((double) (v + vo.getXn2())));
+            xn3.updateAndGet(v -> new Double((double) (v + vo.getXn3())));
+            xn4.updateAndGet(v -> new Double((double) (v + vo.getXn4())));
+            sl1.updateAndGet(v -> new Double((double) (v + vo.getSl1())));
+            sl2.updateAndGet(v -> new Double((double) (v + vo.getSl2())));
+            resultList.add(vo);
+        });
+        FjjxbmxVo vo = new FjjxbmxVo();
+        vo.setId("hj");
+        vo.setName("合计");
+        vo.setSjfdl(DoubleUtils.keepPrecision(sjfdl.get().doubleValue(),2));
+        vo.setLlfdl(DoubleUtils.keepPrecision(llfdl.get().doubleValue(),2));
+        vo.setSpeed(list.size()!=0?DoubleUtils.keepPrecision(pjfs.get().doubleValue()/list.size(),2):0.0);
+        vo.setJhjx1(DoubleUtils.keepPrecision(wh1.get().doubleValue(),2));
+        vo.setJhjx2(DoubleUtils.keepPrecision(wh2.get().doubleValue(),2));
+        vo.setFjhjx1(DoubleUtils.keepPrecision(gz1.get().doubleValue(),2));
+        vo.setFjhjx2(DoubleUtils.keepPrecision(gz2.get().doubleValue(),2));
+        vo.setXd1(DoubleUtils.keepPrecision(xd1.get().doubleValue(),2));
+        vo.setXd2(DoubleUtils.keepPrecision(xd2.get().doubleValue(),2));
+        vo.setXn1(DoubleUtils.keepPrecision(xn1.get().doubleValue(),2));
+        vo.setXn2(DoubleUtils.keepPrecision(xn2.get().doubleValue(),2));
+        vo.setXn3(DoubleUtils.keepPrecision(xn3.get().doubleValue(),2));
+        vo.setXn4(DoubleUtils.keepPrecision(xn4.get().doubleValue(),2));
+        vo.setSl1(DoubleUtils.keepPrecision(sl1.get().doubleValue(),2));
+        vo.setSl2(DoubleUtils.keepPrecision(sl2.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));
+        resultList.add(vo);
+        return resultList;
     }
 }