Browse Source

APP公司电量

wangb@gyee-china.com 1 year ago
parent
commit
36cd9f531f

+ 21 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/Application/ApplicationController.java

@@ -11,7 +11,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 @RestController
@@ -21,6 +23,7 @@ public class ApplicationController {
 
     @Resource
     private ApplicationService applicationService;
+
     @GetMapping(value = "/bulletin")
     @ApiOperation(value = "简报", notes = "简报")
     @ApiImplicitParams({
@@ -39,4 +42,22 @@ public class ApplicationController {
 
     }
 
+    @GetMapping(value = "/companyelectricity")
+    @ApiOperation(value = "公司电量", notes = "公司电量")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wpId", value = "场站编号", required = true, dataType = "string", paramType = "query")})
+    public AjaxResult getelectricity(String wpId) throws Exception {
+
+        List<List> map = new ArrayList<>();
+        if (!wpId.isEmpty()) {
+            map = applicationService.electricity();
+        }
+        if (null != map) {
+            return AjaxResult.successData(200, map);
+        } else {
+            return AjaxResult.error(500, "操作失败");
+        }
+
+    }
+
 }

+ 24 - 4
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/Application/ApplicationService.java

@@ -3,18 +3,16 @@ package com.gyee.runeconomy.service.Application;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.StringUtils;
-import com.gyee.common.util.DateUtils;
-import com.gyee.common.util.algorithm.MathUtils;
+import com.gyee.runeconomy.init.CacheContext;
+import com.gyee.runeconomy.model.auto.ProBasicPowerstation;
 import com.gyee.runeconomy.model.auto.ProBasicPowerstationPoint;
 import com.gyee.runeconomy.model.auto.ProBasicProjectPlan;
 import com.gyee.runeconomy.model.auto.ProEconPowerstationInfoDay5;
 import com.gyee.runeconomy.service.auto.IProBasicPowerstationPointService;
 import com.gyee.runeconomy.service.auto.IProBasicProjectPlanService;
 import com.gyee.runeconomy.service.auto.IProEconPowerstationInfoDay5Service;
-import com.gyee.runeconomy.service.monitor.MonitorprojectplanService;
 import com.gyee.runeconomy.util.MathUtil;
 import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
-import com.gyee.runeconomy.util.realtimesource.StringUtil;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -117,4 +115,26 @@ public class ApplicationService {
 
         return map;
     }
+
+    public List electricity() throws Exception {
+
+        long longDate = System.currentTimeMillis();
+        Date nowDate = new Date(longDate);
+
+        List<List> list = new ArrayList<>();
+        List<ProBasicPowerstation> wpls =  CacheContext.wpls;
+
+        for (ProBasicPowerstation wp : wpls){
+            List<ProEconPowerstationInfoDay5> qwt = null;
+            QueryWrapper<ProEconPowerstationInfoDay5> qw = new QueryWrapper<>();
+            qw.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId,wp.getId());
+            qw.lambda().eq(ProEconPowerstationInfoDay5::getRecordDate,nowDate);
+            qwt = proEconPowerstationInfoDay5Service.list(qw);
+            list.add(qwt);
+
+        }
+
+
+        return list;
+    }
 }