wangb 3 週間 前
コミット
4ebd7e3f11

+ 12 - 6
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/goodness/WindturbineGoodnessDetailController.java

@@ -9,10 +9,7 @@ import com.gyee.runeconomy.dto.ResultMsg;
 import com.gyee.runeconomy.dto.SawVo;
 import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.model.auto.*;
-import com.gyee.runeconomy.service.auto.IProEconWindturbineGoodnessService;
-import com.gyee.runeconomy.service.auto.IProEconWtAlysisDayService;
-import com.gyee.runeconomy.service.auto.IProEconWtCurveFittingMonthService;
-import com.gyee.runeconomy.service.auto.IProEconWtwindDayInfoService;
+import com.gyee.runeconomy.service.auto.*;
 import com.gyee.runeconomy.util.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -44,9 +41,11 @@ public class WindturbineGoodnessDetailController {
     @Resource
     private IProEconWtCurveFittingMonthService proEconWtCurveFittingMonthService;
 
-
     private String jfpl;
 
+    @Resource
+    private ITurbineInfoDayService turbineInfoDayService;
+
 
     /**
      * 获得明细页面显示信息
@@ -74,9 +73,16 @@ public class WindturbineGoodnessDetailController {
             //                    .stream().filter(i->i.getWindturbineId().equals(wtId )
             //           && i.getRecordDate().compareTo(date)==0
             //            ).collect(Collectors.toList());
-
             if (!wtadls.isEmpty()) {
                 wtday = wtadls.get(0);
+
+                QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
+                qw.lambda().eq(TurbineInfoDay::getRecordDate, date).eq(TurbineInfoDay::getTurbineId, wtId);
+                List<TurbineInfoDay> turbineInfoDays = turbineInfoDayService.list(qw);
+                TurbineInfoDay tb = turbineInfoDays.get(0);
+                wtday.setRfdl(Math.round((tb.getRfdl() / 1000) * 100.0) / 100.0);
+                wtday.setRyfdl(Math.round((tb.getLlfdl() / 1000) * 100.0) / 100.0);
+                wtday.setNpjfs(tb.getPjfs());
             }
         }
         if (null != wtday) {

+ 0 - 1
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/homepage/EconomyHomePageController.java

@@ -137,7 +137,6 @@ public class EconomyHomePageController {
     @ApiOperation(value = "首页-右侧模块", notes = "首页-右侧模块")
     public ResultMsg getHomeRight(@RequestParam(value = "companyId", required = false) String companyId,
                                   @RequestParam(value = "periodType", required = false) String periodType) throws Exception {
-        economyPointHomePageService.calFdl();
         Map<String, Object> map = economyPointHomePageService.getHomeRight(companyId,periodType);
         if (null != map) {
             return ResultMsg.ok(map);

+ 2 - 1
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/WpwindDayInfoService.java

@@ -30,7 +30,8 @@ public class WpwindDayInfoService {
         if (StringUtils.notEmp(wpId) && StringUtils.notEmp(recorddate)) {
 
             QueryWrapper<ProEconWpwindDayInfo> queryWrapper = new QueryWrapper<>();
-            queryWrapper.eq("weather_id", wpId)
+            queryWrapper
+//                    .eq("weather_id", wpId)
                     .le("record_date", DateUtils.truncate(recorddate))
                     .ge("record_date", DateUtils.truncate(recorddate));
             list = proEconWpwindDayInfoService.list(queryWrapper);

+ 58 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/WtAlysisDayService.java

@@ -1,22 +1,33 @@
 package com.gyee.runeconomy.service;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gyee.runeconomy.model.auto.ProEconWtAlysisDay;
+import com.gyee.runeconomy.model.auto.TurbineInfoDay;
 import com.gyee.runeconomy.service.auto.IProEconWtAlysisDayService;
+import com.gyee.runeconomy.service.auto.ITurbineInfoDayService;
 import com.gyee.runeconomy.util.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.util.Calendar;
 import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 @Service
 public class WtAlysisDayService {
 
     @Resource
     private IProEconWtAlysisDayService proEconWtAlysisDayService;
+    @Resource
+    private ITurbineInfoDayService turbineInfoDayService;
 
 
     public Page<ProEconWtAlysisDay> wtAlysisDayList(Integer pageNum, Integer pageSize, String wtId, String beginDate, String endDate) {
@@ -51,10 +62,57 @@ public class WtAlysisDayService {
             queryWrapper.orderByAsc(ProEconWtAlysisDay::getRecordDate);
             //执行查询
             proEconWtAlysisDayService.page(pageInfo, queryWrapper);
+
+
+            QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
+            qw.lambda().eq(TurbineInfoDay::getTurbineId, wtId).between(TurbineInfoDay::getRecordDate, begin, end)
+                    .orderByAsc(TurbineInfoDay::getRecordDate);
+            IPage<TurbineInfoDay> page01 = new Page<>(pageNum, pageSize);
+            IPage<TurbineInfoDay> page1 = turbineInfoDayService.page(page01, qw);
+            Map<Date, TurbineInfoDay> dayMap = page1.getRecords().stream().collect(Collectors.toMap(TurbineInfoDay::getRecordDate, Function.identity()));
+
+            pageInfo.getRecords().forEach(rsl -> {
+                TurbineInfoDay day = dayMap.get(rsl.getRecordDate());
+                rsl.setRfdl(day.getRfdl());
+                double yfdl = calFdl(rsl.getWindturbineId(), "month", rsl.getRecordDate());
+                rsl.setYfdl(yfdl);
+                double nfdl = calFdl(rsl.getWindturbineId(), "year", rsl.getRecordDate());
+                rsl.setNfdl(nfdl);
+                rsl.setRpjfs(day.getPjfs());
+                rsl.setRssdl(day.getGzss() + day.getJhjxss() + day.getXdss() + day.getXnss() + day.getSlss());
+                rsl.setRgzxs(day.getGzMin() / 60);
+                rsl.setRjxxs(day.getJxMin() / 60);
+                rsl.setRyxxs(day.getYxMin() / 60);
+            });
+
         }
 
         return pageInfo;
     }
 
 
+    public double calFdl(String windturbineId, String type, Date endDate) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(endDate);
+        Date firstDay = null;
+        if ("month".equals(type)) {
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            firstDay = calendar.getTime();
+        } else if ("year".equals(type)) {
+            calendar.set(Calendar.MONTH, 0);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            firstDay = calendar.getTime();
+        }
+        QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
+        currentqw.select("station_id,MAX(record_date) AS record_date,SUM(rfdl) AS rfdl")
+                .ge("record_date", firstDay)
+                .le("record_date", endDate)
+                .eq("turbine_id", windturbineId)
+                .like("station_id", "_FDC_")
+                .groupBy("station_id");
+        List<TurbineInfoDay> monthData = turbineInfoDayService.list(currentqw);
+        return monthData.get(0).getRfdl();
+    }
+
+
 }

+ 4 - 2
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/bmk/BenchmarkingService.java

@@ -426,7 +426,8 @@ public class BenchmarkingService {
                 vo.setSpeed(BigDecimalUtils.divide(BigDecimal.valueOf(i.getPjfs()), new BigDecimal(1), 2).doubleValue());
                 vo2.setSpeed(BigDecimalUtils.divide(BigDecimal.valueOf(i.getPjfs()), new BigDecimal(1), 2).doubleValue());
             }
-            vo.setFjhjx(BigDecimalUtils.divide(BigDecimal.valueOf(i.getFjhjxss()), new BigDecimal(1), 2).doubleValue());
+//            vo.setFjhjx(BigDecimalUtils.divide(BigDecimal.valueOf(i.getFjhjxss()), new BigDecimal(1), 2).doubleValue());
+            vo.setFjhjx(BigDecimalUtils.divide(BigDecimal.valueOf(i.getGzss()), new BigDecimal(1), 2).doubleValue());
             vo.setJhjx(BigDecimalUtils.divide(BigDecimal.valueOf(i.getJhjxss()), new BigDecimal(1), 2).doubleValue());
             vo.setXd(BigDecimalUtils.divide(BigDecimal.valueOf(i.getXdss()), new BigDecimal(1), 2).doubleValue());
             vo.setSl(BigDecimalUtils.divide(BigDecimal.valueOf(i.getSlss()), new BigDecimal(1), 2).doubleValue());
@@ -435,7 +436,8 @@ public class BenchmarkingService {
             vo.setFnlly(vo.getLlfdl() != 0 ? DoubleUtils.keepPrecision(vo.getSjfdl() / vo.getLlfdl() * 100, 2) : 0);
             vo.setPoint(DoubleUtils.keepPrecision(vo.getLlfdl() * 1.1, 2));
 
-            vo2.setFjhjx(BigDecimalUtils.divide(BigDecimal.valueOf(i.getFjhjxss() / 1000), new BigDecimal(1), 2).doubleValue());
+//            vo2.setFjhjx(BigDecimalUtils.divide(BigDecimal.valueOf(i.getFjhjxss() / 1000), new BigDecimal(1), 2).doubleValue());
+            vo2.setFjhjx(BigDecimalUtils.divide(BigDecimal.valueOf(i.getGzss() / 1000), new BigDecimal(1), 2).doubleValue());
             vo2.setJhjx(BigDecimalUtils.divide(BigDecimal.valueOf(i.getJhjxss() / 1000), new BigDecimal(1), 2).doubleValue());
             vo2.setXd(BigDecimalUtils.divide(BigDecimal.valueOf(i.getXdss() / 1000), new BigDecimal(1), 2).doubleValue());
             vo2.setSl(BigDecimalUtils.divide(BigDecimal.valueOf(i.getSlss() / 1000), new BigDecimal(1), 2).doubleValue());