ソースを参照

数据返回包处理

wangchangsheng 2 年 前
コミット
f0012668e9

+ 3 - 4
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/ProEconPowerstationInfoDay1Controller.java

@@ -3,10 +3,9 @@ package com.gyee.runeconomy.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.gyee.runeconomy.dto.R;
+import com.gyee.runeconomy.dto.ResultMsg;
 import com.gyee.runeconomy.model.auto.ProEconPowerstationInfoDay1;
 import com.gyee.runeconomy.service.auto.IProEconPowerstationInfoDay1Service;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -45,9 +44,9 @@ public class ProEconPowerstationInfoDay1Controller {
                       @RequestParam(value = "pageSize", required = true) String pageSize) {
         IPage<ProEconPowerstationInfoDay1> list = proEconPowerstationInfoDay1Service.list(pageNum,pageSize);
         if (null != list) {
-            return R.ok().data(list);
+            return R.data(ResultMsg.ok(list));
         } else {
-            return R.error().data("查询失败!");
+            return R.error(ResultMsg.error());
         }
     }
 

+ 27 - 26
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/bmk/BenchmarkingController.java

@@ -7,6 +7,7 @@ import com.gyee.common.model.StringUtils;
 import com.gyee.common.vo.benchmark.FjjxbVo;
 import com.gyee.common.vo.benchmark.FjjxbmxVo;
 import com.gyee.runeconomy.dto.R;
+import com.gyee.runeconomy.dto.ResultMsg;
 import com.gyee.runeconomy.model.auto.ProBasicCompany;
 import com.gyee.runeconomy.model.auto.ProBasicLine;
 import com.gyee.runeconomy.model.auto.ProBasicPowerstation;
@@ -31,9 +32,9 @@ public class BenchmarkingController {
     public R companys()  {
         List<ProBasicCompany> resultList = benchmarkingService.companys();
         if (StringUtils.isNotNull(resultList)) {
-            return R.ok().data(resultList);
+            return R.data(ResultMsg.ok(resultList));
         } else {
-            return R.error().data("查询失败!");
+            return R.error(ResultMsg.error());
         }
     }
     @GetMapping(value = "/wpByCplist")
@@ -42,9 +43,9 @@ public class BenchmarkingController {
 
         List<ProBasicPowerstation> resultList = benchmarkingService.wpByCplist(companyids);
         if (StringUtils.isNotNull(resultList)) {
-            return R.ok().data(resultList);
+            return R.data(ResultMsg.ok(resultList));
         } else {
-            return R.error().data("查询失败!");
+            return R.error(ResultMsg.error());
         }
     }
     @GetMapping(value = "/pjByWplist")
@@ -53,9 +54,9 @@ public class BenchmarkingController {
 
         List<ProBasicProject> resultList = benchmarkingService.pjByWplist(wpids);
         if (StringUtils.isNotNull(resultList)) {
-            return R.ok().data(resultList);
+            return R.data(ResultMsg.ok(resultList));
         } else {
-            return R.error().data("查询失败!");
+            return R.error(ResultMsg.error());
         }
     }
 
@@ -65,45 +66,45 @@ public class BenchmarkingController {
 
         List<ProBasicLine> resultList = benchmarkingService.lnByPjlist(pjids);
         if (StringUtils.isNotNull(resultList)) {
-            return R.ok().data(resultList);
+            return R.data(ResultMsg.ok(resultList));
         } else {
-            return R.error().data("查询失败!");
+            return R.error(ResultMsg.error());
         }
     }
 
     @GetMapping(value = "/performance")
     @ApiOperation(value = "风机绩效榜", notes = "风机绩效榜")
     public R performance(@RequestParam(value = "companyid", required = true) String companyid,
-                             @RequestParam(value = "getype", required = true) String getype,
-                             @RequestParam(value = "sttype", required = true) String sttype,
-                             @RequestParam(value = "beginDate", required = true) String beginDate,
-                             @RequestParam(value = "endDate", required = true) String endDate,
-                             @RequestParam(value = "wpids", required = true) String wpids,
-                             @RequestParam(value = "projectids", required = true) String projectids,
-                             @RequestParam(value = "lineids", required = true) String lineids){
+                         @RequestParam(value = "getype", required = true) String getype,
+                         @RequestParam(value = "sttype", required = true) String sttype,
+                         @RequestParam(value = "beginDate", required = true) String beginDate,
+                         @RequestParam(value = "endDate", required = true) String endDate,
+                         @RequestParam(value = "wpids", required = true) String wpids,
+                         @RequestParam(value = "projectids", required = true) String projectids,
+                         @RequestParam(value = "lineids", required = true) String lineids){
         List<FjjxbVo> resultList = benchmarkingService.performance(companyid,getype,sttype,beginDate,endDate,wpids,projectids,lineids);
         if (StringUtils.isNotNull(resultList)) {
-            return R.ok().data(resultList);
+            return R.data(ResultMsg.ok(resultList));
         } else {
-            return R.error().data("查询失败!");
+            return R.error(ResultMsg.error());
         }
     }
 
     @GetMapping(value = "/performanceMX")
     @ApiOperation(value = "风机绩效榜明细", notes = "风机绩效榜明细")
     public R performanceMX(@RequestParam(value = "companyid", required = true) String companyid,
-                         @RequestParam(value = "getype", required = true) String getype,
-                         @RequestParam(value = "sttype", required = true) String sttype,
-                         @RequestParam(value = "beginDate", required = true) String beginDate,
-                         @RequestParam(value = "endDate", required = true) String endDate,
-                         @RequestParam(value = "wpids", required = true) String wpids,
-                         @RequestParam(value = "projectids", required = true) String projectids,
-                         @RequestParam(value = "lineids", required = true) String lineids){
+                           @RequestParam(value = "getype", required = true) String getype,
+                           @RequestParam(value = "sttype", required = true) String sttype,
+                           @RequestParam(value = "beginDate", required = true) String beginDate,
+                           @RequestParam(value = "endDate", required = true) String endDate,
+                           @RequestParam(value = "wpids", required = true) String wpids,
+                           @RequestParam(value = "projectids", required = true) String projectids,
+                           @RequestParam(value = "lineids", required = true) String lineids){
         List<FjjxbmxVo> resultList = benchmarkingService.performanceMX(companyid,getype,sttype,beginDate,endDate,wpids,projectids,lineids);
         if (StringUtils.isNotNull(resultList)) {
-            return R.ok().data(resultList);
+            return R.data(ResultMsg.ok(resultList));
         } else {
-            return R.error().data("查询失败!");
+            return R.error(ResultMsg.error());
         }
     }
  }

+ 3 - 2
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/homepage/EconomyHomePageController.java

@@ -2,6 +2,7 @@ package com.gyee.runeconomy.controller.homepage;
 
 
 import com.gyee.runeconomy.dto.R;
+import com.gyee.runeconomy.dto.ResultMsg;
 import com.gyee.runeconomy.service.homepage.EconomyPointHomePageService;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -51,9 +52,9 @@ public class EconomyHomePageController {
 
         Map<String ,Object> map  = economyPointHomePageService.getEconomyPointHomePageInfo(foreignKeyId,regionId, companyId, staType, dateType,pointCode);
         if (null != map) {
-            return R.ok().data(map);
+            return R.data(ResultMsg.ok(map));
         } else {
-            return R.error().data("查询失败!");
+             return R.error(ResultMsg.error());
         }
     }
 

+ 35 - 34
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/specific/SpecificController.java

@@ -6,6 +6,7 @@ package com.gyee.runeconomy.controller.specific;/*
 import com.gyee.common.model.StringUtils;
 import com.gyee.common.vo.specific.SpecificTargetVo;
 import com.gyee.runeconomy.dto.R;
+import com.gyee.runeconomy.dto.ResultMsg;
 import com.gyee.runeconomy.service.specific.SpecificService;
 import org.springframework.web.bind.annotation.*;
 
@@ -32,9 +33,9 @@ public class SpecificController {
 
         List<SpecificTargetVo> resultList = specificService.fnlylList(companys,type,year);
         if (StringUtils.isNotNull(resultList)) {
-            return R.ok().data(resultList);
+            return R.data(ResultMsg.ok(resultList));
         }else{
-            return R.error().message("访问失败");
+            return R.error(ResultMsg.error());
         }
     }
 
@@ -45,14 +46,14 @@ public class SpecificController {
     @GetMapping("/fdlList")
     @ResponseBody
     public R fdlList(@RequestParam(value = "companys",required = true) String companys,
-                       @RequestParam(value = "type",required = true) String type,
-                       @RequestParam(value = "year",required = true) String year) throws ParseException {
+                     @RequestParam(value = "type",required = true) String type,
+                     @RequestParam(value = "year",required = true) String year) throws ParseException {
 
         List<SpecificTargetVo> resultList = specificService.fdlList(companys,type,year);
         if (StringUtils.isNotNull(resultList)) {
-            return R.ok().data(resultList);
+            return R.data(ResultMsg.ok(resultList));
         }else{
-            return R.error().message("访问失败");
+            return R.error(ResultMsg.error());
         }
     }
 
@@ -63,14 +64,14 @@ public class SpecificController {
     @GetMapping("/zhcydlList")
     @ResponseBody
     public R zhcydlList(@RequestParam(value = "companys",required = true) String companys,
-                     @RequestParam(value = "type",required = true) String type,
-                     @RequestParam(value = "year",required = true) String year) throws ParseException {
+                        @RequestParam(value = "type",required = true) String type,
+                        @RequestParam(value = "year",required = true) String year) throws ParseException {
 
         List<SpecificTargetVo> resultList = specificService.zhcydlList(companys,type,year);
         if (StringUtils.isNotNull(resultList)) {
-            return R.ok().data(resultList);
+            return R.data(ResultMsg.ok(resultList));
         }else{
-            return R.error().message("访问失败");
+             return R.error(ResultMsg.error());
         }
     }
 
@@ -81,14 +82,14 @@ public class SpecificController {
     @GetMapping("/gzsslList")
     @ResponseBody
     public R gzsslList(@RequestParam(value = "companys",required = true) String companys,
-                        @RequestParam(value = "type",required = true) String type,
-                        @RequestParam(value = "year",required = true) String year) throws ParseException {
+                       @RequestParam(value = "type",required = true) String type,
+                       @RequestParam(value = "year",required = true) String year) throws ParseException {
 
         List<SpecificTargetVo> resultList = specificService.gzsslList(companys,type,year);
         if (StringUtils.isNotNull(resultList)) {
-            return R.ok().data(resultList);
+            return R.data(ResultMsg.ok(resultList));
         }else{
-            return R.error().message("访问失败");
+             return R.error(ResultMsg.error());
         }
     }
 
@@ -104,9 +105,9 @@ public class SpecificController {
 
         List<SpecificTargetVo> resultList = specificService.whsslList(companys,type,year);
         if (StringUtils.isNotNull(resultList)) {
-            return R.ok().data(resultList);
+            return R.data(ResultMsg.ok(resultList));
         }else{
-            return R.error().message("访问失败");
+             return R.error(ResultMsg.error());
         }
     }
 
@@ -122,9 +123,9 @@ public class SpecificController {
 
         List<SpecificTargetVo> resultList = specificService.xdsslList(companys,type,year);
         if (StringUtils.isNotNull(resultList)) {
-            return R.ok().data(resultList);
+            return R.data(ResultMsg.ok(resultList));
         }else{
-            return R.error().message("访问失败");
+             return R.error(ResultMsg.error());
         }
     }
 
@@ -140,9 +141,9 @@ public class SpecificController {
 
         List<SpecificTargetVo> resultList = specificService.xnsslList(companys,type,year);
         if (StringUtils.isNotNull(resultList)) {
-            return R.ok().data(resultList);
+            return R.data(ResultMsg.ok(resultList));
         }else{
-            return R.error().message("访问失败");
+             return R.error(ResultMsg.error());
         }
     }
 
@@ -158,9 +159,9 @@ public class SpecificController {
 
         List<SpecificTargetVo> resultList = specificService.slsslList(companys,type,year);
         if (StringUtils.isNotNull(resultList)) {
-            return R.ok().data(resultList);
+            return R.data(ResultMsg.ok(resultList));
         }else{
-            return R.error().message("访问失败");
+             return R.error(ResultMsg.error());
         }
     }
 
@@ -176,9 +177,9 @@ public class SpecificController {
 
         List<SpecificTargetVo> resultList = specificService.fwjslList(companys,type,year);
         if (StringUtils.isNotNull(resultList)) {
-            return R.ok().data(resultList);
+            return R.data(ResultMsg.ok(resultList));
         }else{
-            return R.error().message("访问失败");
+             return R.error(ResultMsg.error());
         }
     }
 
@@ -194,9 +195,9 @@ public class SpecificController {
 
         List<SpecificTargetVo> resultList = specificService.ztzhlList(companys,type,year);
         if (StringUtils.isNotNull(resultList)) {
-            return R.ok().data(resultList);
+            return R.data(ResultMsg.ok(resultList));
         }else{
-            return R.error().message("访问失败");
+             return R.error(ResultMsg.error());
         }
     }
 
@@ -212,9 +213,9 @@ public class SpecificController {
 
         List<SpecificTargetVo> resultList = specificService.xqjslList(companys,type,year);
         if (StringUtils.isNotNull(resultList)) {
-            return R.ok().data(resultList);
+            return R.data(ResultMsg.ok(resultList));
         }else{
-            return R.error().message("访问失败");
+             return R.error(ResultMsg.error());
         }
     }
 
@@ -225,14 +226,14 @@ public class SpecificController {
     @GetMapping("/mtbfList")
     @ResponseBody
     public R mtbfList(@RequestParam(value = "companys",required = true) String companys,
-                       @RequestParam(value = "type",required = true) String type,
-                       @RequestParam(value = "year",required = true) String year) throws ParseException {
+                      @RequestParam(value = "type",required = true) String type,
+                      @RequestParam(value = "year",required = true) String year) throws ParseException {
 
         List<SpecificTargetVo> resultList = specificService.mtbfList(companys,type,year);
         if (StringUtils.isNotNull(resultList)) {
-            return R.ok().data(resultList);
+            return R.data(ResultMsg.ok(resultList));
         }else{
-            return R.error().message("访问失败");
+             return R.error(ResultMsg.error());
         }
     }
 
@@ -248,9 +249,9 @@ public class SpecificController {
 
         List<SpecificTargetVo> resultList = specificService.mttrList(companys,type,year);
         if (StringUtils.isNotNull(resultList)) {
-            return R.ok().data(resultList);
+            return R.data(ResultMsg.ok(resultList));
         }else{
-            return R.error().message("访问失败");
+             return R.error(ResultMsg.error());
         }
     }
 }

+ 20 - 16
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/threerate/ThreeRateController.java

@@ -3,6 +3,7 @@ package com.gyee.runeconomy.controller.threerate;
 
 import com.gyee.common.model.StringUtils;
 import com.gyee.runeconomy.dto.R;
+import com.gyee.runeconomy.dto.ResultMsg;
 import com.gyee.runeconomy.dto.response.FwjslDTO;
 import com.gyee.runeconomy.dto.response.QxjslDTO;
 import com.gyee.runeconomy.service.threerate.ThreeRateService;
@@ -40,19 +41,17 @@ public class ThreeRateController {
     @ResponseBody
     @CrossOrigin(origins = "*", maxAge = 3600)
     public R getResetTimelyRateInfo(
-            @RequestParam(value = "regionId", required = false) String regionId,
             @RequestParam(value = "companyId", required = false) String companyId,
             @RequestParam(value = "windpowerstationId", required = false) String windpowerstationId,
-            @RequestParam(value = "projectId", required = false) String projectId,
             @RequestParam(value = "beginDate", required = true) String beginDate,
             @RequestParam(value = "endDate", required = true) String endDate
     ) {
 
-        List<FwjslDTO> resultlist = threeRateService.getResetTimelyRateInfo(beginDate, endDate);
+        List<FwjslDTO> resultlist = threeRateService.getResetTimelyRateInfo(companyId, windpowerstationId, beginDate, endDate);
         if (StringUtils.isNotNull(resultlist)) {
-            return R.ok(resultlist.size()).data(resultlist);
+            return R.data(ResultMsg.ok(resultlist));
         } else {
-            return R.error().message("访问失败");
+            return R.error(ResultMsg.error());
         }
     }
 
@@ -67,15 +66,17 @@ public class ThreeRateController {
     @GetMapping("/state-conversion-rate")
     @ResponseBody
     @CrossOrigin(origins = "*", maxAge = 3600)
-    public R getStateConversionRateInfo(@RequestParam(value = "beginDate", required = true) String beginDate,
-                                        @RequestParam(value = "endDate", required = true) String endDate
+    public R getStateConversionRateInfo(
+            @RequestParam(value = "companyId", required = false) String companyId,
+            @RequestParam(value = "windpowerstationId", required = false) String windpowerstationId,
+            @RequestParam(value = "beginDate", required = true) String beginDate,
+            @RequestParam(value = "endDate", required = true) String endDate
     ) {
-
-        Map<String, List<FwjslDTO>> resultlist = threeRateService.getStateConversionRateInfo(beginDate, endDate);
+        Map<String, List<FwjslDTO>> resultlist = threeRateService.getStateConversionRateInfo(companyId, windpowerstationId, beginDate, endDate);
         if (StringUtils.isNotNull(resultlist)) {
-            return R.ok(resultlist.size()).data(resultlist);
+            return R.data(ResultMsg.ok(resultlist));
         } else {
-            return R.error().message("访问失败");
+            return R.error(ResultMsg.error());
         }
     }
 
@@ -90,14 +91,17 @@ public class ThreeRateController {
     @GetMapping("/defects-eliminat-rate")
     @ResponseBody
     @CrossOrigin(origins = "*", maxAge = 3600)
-    public R getDefectsEliminatRateList(@RequestParam(value = "beginDate", required = true) String beginDate,
-                                        @RequestParam(value = "endDate", required = true) String endDate
+    public R getDefectsEliminatRateList(
+            @RequestParam(value = "companyId", required = false) String companyId,
+            @RequestParam(value = "windpowerstationId", required = false) String windpowerstationId,
+            @RequestParam(value = "beginDate", required = true) String beginDate,
+            @RequestParam(value = "endDate", required = true) String endDate
     ) {
-        List<QxjslDTO> resultlist = threeRateService.getDefectsEliminatRateList(beginDate, endDate);
+        List<QxjslDTO> resultlist = threeRateService.getDefectsEliminatRateList(companyId, windpowerstationId,beginDate, endDate);
         if (StringUtils.isNotNull(resultlist)) {
-            return R.ok(resultlist.size()).data(resultlist);
+            return R.data(ResultMsg.ok(resultlist));
         } else {
-            return R.error().message("访问失败");
+            return R.error(ResultMsg.error());
         }
     }
 

+ 12 - 47
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/R.java

@@ -11,61 +11,26 @@ import lombok.Data;
  */
 @Data
 public class R {
-    @ApiModelProperty(value = "是否成功")
-    private Boolean success;
+
     @ApiModelProperty(value = "返回码")
     private Integer code;
-    @ApiModelProperty(value = "返回消息")
-    private String message;
-    @ApiModelProperty(value = "总数量")
-    private Integer count;
     @ApiModelProperty(value = "返回数据")
-    private Object data = new Object();
+    private ResultMsg data = new ResultMsg();
+
     private R(){}
-    public static R ok(){
-        R r = new R();
-        r.setSuccess(true);
-        r.setCode(ResultCode.SUCCESS);
-        r.setMessage("成功");
-        return r;
-    }
-    public static R ok(Integer count){
+
+    public static R error(ResultMsg error){
         R r = new R();
-        r.setSuccess(true);
-        r.setCode(ResultCode.SUCCESS);
-        r.setMessage("成功");
-        r.setCount(count);
+        r.setData(error);
+        r.setCode(ResultCode.ERROR1);
         return r;
     }
-    public static R error(){
+
+    public static R data(ResultMsg ok) {
+
         R r = new R();
-        r.setSuccess(false);
-        r.setCode(ResultCode.ERROR);
-        r.setMessage("失败");
+        r.setCode(ResultCode.SUCCESS0);
+        r.setData(ok);
         return r;
     }
-    public R success(Boolean success){
-        this.setSuccess(success);
-        return this;
-    }
-    public R message(String message){
-        this.setMessage(message);
-        return this;
-    }
-    public R code(Integer code){
-        this.setCode(code);
-        return this;
-    }
-//    public R data(String key, Object value){
-//        this.data.put(key, value);
-//        return this;
-//    }
-//    public R data(Map<String, Object> map){
-//        this.setData(map);
-//        return this;
-//    }
-    public R data(Object value){
-        this.setData(value);
-        return this;
-    }
 }

+ 4 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/ResultCode.java

@@ -9,4 +9,8 @@ package com.gyee.runeconomy.dto;
 public class ResultCode {
     public static Integer SUCCESS = 200;
     public static Integer ERROR = 500;
+
+    public static Integer SUCCESS0 = 0;
+    public static Integer ERROR1 = -1;
+
 }

+ 87 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/ResultMsg.java

@@ -0,0 +1,87 @@
+package com.gyee.runeconomy.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @ClassName : R
+ * @Author : xieshengjie
+ * @Date: 2021/5/16 16:59
+ * @Description : 结果集
+ */
+@Data
+public class ResultMsg{
+    @ApiModelProperty(value = "是否成功")
+    private Boolean success;
+    @ApiModelProperty(value = "返回码")
+    private Integer code;
+    @ApiModelProperty(value = "返回消息")
+    private String message;
+    @ApiModelProperty(value = "总数量")
+    private Integer count;
+    @ApiModelProperty(value = "返回数据")
+    private Object data = new Object();
+
+    public ResultMsg(){}
+    public static ResultMsg ok(){
+        ResultMsg r = new ResultMsg();
+        r.setSuccess(true);
+        r.setCode(ResultCode.SUCCESS);
+        r.setMessage("成功");
+        return r;
+    }
+
+
+    public static ResultMsg ok(Object data ){
+        ResultMsg r = new ResultMsg();
+        r.setSuccess(true);
+        r.setCode(ResultCode.SUCCESS);
+        r.setData(data);
+        r.setMessage("成功");
+
+        return r;
+    }
+
+
+    public static ResultMsg ok(Integer count){
+        ResultMsg r = new ResultMsg();
+        r.setSuccess(true);
+        r.setCode(ResultCode.SUCCESS);
+        r.setMessage("成功");
+        r.setCount(count);
+        return r;
+    }
+    public static ResultMsg error(){
+        ResultMsg r = new ResultMsg();
+        r.setSuccess(false);
+        r.setCode(ResultCode.ERROR);
+        r.setMessage("失败");
+        return r;
+    }
+
+
+    public ResultMsg success(Boolean success){
+        this.setSuccess(success);
+        return this;
+    }
+    public ResultMsg message(String message){
+        this.setMessage(message);
+        return this;
+    }
+    public static ResultMsg errorMsg(String msg){
+        ResultMsg r = new ResultMsg();
+        r.setSuccess(false);
+        r.setCode(ResultCode.ERROR);
+        r.setMessage(msg);
+        return r;
+    }
+    public ResultMsg code(Integer code){
+        this.setCode(code);
+        return this;
+    }
+
+    public  ResultMsg data(Object value){
+        this.setData(value);
+        return this;
+    }
+}

+ 2 - 2
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/mapper/auto/ProEconEquipmentInfoDay5Mapper.java

@@ -19,7 +19,7 @@ import java.util.List;
 public interface ProEconEquipmentInfoDay5Mapper extends BaseMapper<ProEconEquipmentInfoDay5> {
 
 
-    @Select("select windpowerstation_id," +
+    @Select(" select windpowerstation_id," +
             "sum(TIMERATE20) TIMERATE20," +
             "sum(TIMERATE16) TIMERATE16," +
             "sum(TIMERATE17) TIMERATE17," +
@@ -27,7 +27,7 @@ public interface ProEconEquipmentInfoDay5Mapper extends BaseMapper<ProEconEquipm
             "sum(TIMERATE19) TIMERATE19 " +
             "from pro_econ_equipment_info_day5 where " +
             "record_date>= #{beginDate} and record_date<= #{endDate}" +
-            " group by windpowerstation_id")
+            " group by windpowerstation_id ")
     List<ProEconEquipmentInfoDay5>  selectResetTimelyRateList(@Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
 
 

+ 2 - 2
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProEconEquipmentInfoDay5Service.java

@@ -15,8 +15,8 @@ import java.util.List;
  */
 public interface IProEconEquipmentInfoDay5Service extends IService<ProEconEquipmentInfoDay5> {
 
-    List<ProEconEquipmentInfoDay5> getResetTimelyRateList(String beginDate, String endDate);
+    List<ProEconEquipmentInfoDay5> getResetTimelyRateList(String companyId,String windpowerstationId,String beginDate, String endDate);
 
-    List<ProEconEquipmentInfoDay5> getStateConversionRateList(String beginDate, String endDate);
+    List<ProEconEquipmentInfoDay5> getStateConversionRateList(String companyId, String windpowerstationId,String beginDate, String endDate);
 
 }

+ 51 - 4
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconEquipmentInfoDay5ServiceImpl.java

@@ -1,5 +1,7 @@
 package com.gyee.runeconomy.service.auto.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.common.model.StringUtils;
 import com.gyee.common.util.DateUtils;
 import com.gyee.runeconomy.model.auto.ProEconEquipmentInfoDay5;
 import com.gyee.runeconomy.mapper.auto.ProEconEquipmentInfoDay5Mapper;
@@ -25,14 +27,59 @@ public class ProEconEquipmentInfoDay5ServiceImpl extends ServiceImpl<ProEconEqui
     private ProEconEquipmentInfoDay5Mapper proEconEquipmentInfoDay5Mapper;
 
     @Override
-    public List<ProEconEquipmentInfoDay5> getResetTimelyRateList(String beginDate, String endDate) {
-        List<ProEconEquipmentInfoDay5> list = proEconEquipmentInfoDay5Mapper.selectResetTimelyRateList(DateUtils.parseDate(beginDate), DateUtils.parseDate(endDate));
+    public List<ProEconEquipmentInfoDay5> getResetTimelyRateList(String companyId, String windpowerstationId, String beginDate, String endDate) {
+
+        QueryWrapper<ProEconEquipmentInfoDay5> qw = new QueryWrapper<>();
+        StringBuilder sb = new StringBuilder();
+        sb.append("windpowerstation_id, sum(TIMERATE20) TIMERATE20, sum(TIMERATE16) TIMERATE16, sum(TIMERATE17) TIMERATE17,sum(TIMERATE18) TIMERATE18, sum(TIMERATE19) TIMERATE19 ");
+
+        qw.select(sb.toString());
+
+        qw.ge("record_date", DateUtils.parseDate(beginDate)).le("record_date", DateUtils.parseDate(endDate));
+        //判断后缀是区域还是公司
+        if (StringUtils.isNotEmpty(companyId) && companyId.endsWith("_ZGS")) {
+            qw.lambda().eq(ProEconEquipmentInfoDay5::getCompanyId, companyId);
+        }
+        if (StringUtils.isNotEmpty(companyId) && companyId.endsWith("_RGN")) {
+            qw.lambda().eq(ProEconEquipmentInfoDay5::getRegionId, companyId);
+        }
+
+        //场站模糊查询
+        if (StringUtils.isNotEmpty(windpowerstationId)) {
+            qw.lambda().like(ProEconEquipmentInfoDay5::getWindpowerstationId, windpowerstationId);
+        }
+        //分组查询
+        qw.lambda().groupBy(ProEconEquipmentInfoDay5::getWindpowerstationId);
+        List<ProEconEquipmentInfoDay5> list = baseMapper.selectList(qw);
+
         return list;
     }
 
     @Override
-    public List<ProEconEquipmentInfoDay5> getStateConversionRateList(String beginDate, String endDate) {
-        List<ProEconEquipmentInfoDay5> list = proEconEquipmentInfoDay5Mapper.selectStateConversionRateList(DateUtils.parseDate(beginDate), DateUtils.parseDate(endDate));
+    public List<ProEconEquipmentInfoDay5> getStateConversionRateList(String companyId, String windpowerstationId,String beginDate, String endDate) {
+
+
+        QueryWrapper<ProEconEquipmentInfoDay5> qw = new QueryWrapper<>();
+        StringBuilder sb = new StringBuilder();
+        sb.append("windpowerstation_id,sum(TIMERATE13) TIMERATE13,sum(TIMERATE1) TIMERATE1,sum(TIMERATE2) TIMERATE2,sum(TIMERATE3) TIMERATE3,sum(TIMERATE4) TIMERATE4,sum(TIMERATE14) TIMERATE14,sum(TIMERATE5) TIMERATE5,sum(TIMERATE6) TIMERATE6,sum(TIMERATE7) TIMERATE7,sum(TIMERATE8)  TIMERATE8,sum(TIMERATE15) TIMERATE15,sum(TIMERATE9) TIMERATE9,sum(TIMERATE10) TIMERATE10,sum(TIMERATE11) TIMERATE11,sum(TIMERATE12) TIMERATE12");
+
+        qw.select(sb.toString());
+        qw.ge("record_date", DateUtils.parseDate(beginDate)).le("record_date", DateUtils.parseDate(endDate));
+        //判断后缀是区域还是公司
+        if (StringUtils.isNotEmpty(companyId) && companyId.endsWith("_ZGS")) {
+            qw.lambda().eq(ProEconEquipmentInfoDay5::getCompanyId, companyId);
+        }
+        if (StringUtils.isNotEmpty(companyId) && companyId.endsWith("_RGN")) {
+            qw.lambda().eq(ProEconEquipmentInfoDay5::getRegionId, companyId);
+        }
+
+        //场站模糊查询
+        if (StringUtils.isNotEmpty(windpowerstationId)) {
+            qw.lambda().like(ProEconEquipmentInfoDay5::getWindpowerstationId, windpowerstationId);
+        }
+        //分组查询
+        qw.lambda().groupBy(ProEconEquipmentInfoDay5::getWindpowerstationId);
+        List<ProEconEquipmentInfoDay5> list = baseMapper.selectList(qw);
         return list;
     }
 }

+ 30 - 30
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/homepage/EconomyPointHomePageService.java

@@ -112,7 +112,7 @@ public class EconomyPointHomePageService {
         Map<String,Object> allmap = new HashMap<>();
         //获取当前时间
         String strdate = DateUtils.toDate1(new Date());
-        Date date = DateUtils.parseDate("2022-11-22");
+        Date date = DateUtils.parseDate(strdate);
 
 
 
@@ -143,7 +143,7 @@ public class EconomyPointHomePageService {
         threeRateCurvelist = proEconPowerstationInfoDay4Service.getEconThreeRateCurve(foreignKeyId, staType, dateType, date);
 
         List<ProEconPointCodeDTO> pointCodeDTO =  proEconPointCodeService.getEconPointRanking(regionId, companyId, pointCode);
-                /**  场站信息 */
+        /**  场站信息 */
         List<ProBasicPowerstation> powerstationList =  proBasicPowerstationService.getProBasicPowerstationlist(regionId,companyId,staType);
         wsdlfx = new HashMap<>();//五损电量分析
         zhcydl= new ArrayList<>();//综合场用电率
@@ -210,8 +210,8 @@ public class EconomyPointHomePageService {
     private void currfdinfo() {
         ProEconPowerstationInfoDay1 fdinfo = wsmap.get("currFiveInfo");
         if(null != fdinfo){
-            fdinfomap.put("fdl",fdinfo.getRfdl());
-            fdinfomap.put("qfdl",fdinfo.getRqfdl());
+            fdinfomap.put("fdl",fdinfo.getRfdl().divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP));
+            fdinfomap.put("qfdl",fdinfo.getRqfdl().divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP));
             if(compare0(fdinfo.getRllfdl())){
                 fdinfomap.put("fnlyl", compare100(fdinfo.getRfdl().divide(fdinfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))));
             }else {
@@ -225,8 +225,8 @@ public class EconomyPointHomePageService {
     private void monthfdinfo() {
         ProEconPowerstationInfoDay1 fdinfo = wsmap.get("currFiveInfo");
         if(null != fdinfo){
-            fdinfomap.put("fdl",fdinfo.getYfdl());
-            fdinfomap.put("qfdl",fdinfo.getYqfdl());
+            fdinfomap.put("fdl",fdinfo.getYfdl().divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP));
+            fdinfomap.put("qfdl",fdinfo.getYqfdl().divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP));
             fdinfomap.put("fnlyl", compare100(fdinfo.getYfdl().divide(fdinfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))));
 
 
@@ -235,8 +235,8 @@ public class EconomyPointHomePageService {
     private void yearfdinfo() {
         ProEconPowerstationInfoDay1 fdinfo = wsmap.get("currFiveInfo");
         if(null != fdinfo){
-            fdinfomap.put("fdl",fdinfo.getNfdl());
-            fdinfomap.put("qfdl",fdinfo.getNqfdl());
+            fdinfomap.put("fdl",fdinfo.getNfdl().divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP));
+            fdinfomap.put("qfdl",fdinfo.getNqfdl().divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP));
             fdinfomap.put("fnlyl", compare100(fdinfo.getNfdl().divide(fdinfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))));
 
         }
@@ -291,12 +291,12 @@ public class EconomyPointHomePageService {
 
         dltjfxlist.stream().forEach(i -> {
             Map<String, Object> m = new HashMap<>();
-            m.put("fdl", i.getRfdl()); //发电量
-            m.put("sldl", i.getRcwsldwssdl().add(i.getRcwsltqssdl()));  //受累
-            m.put("jxdl", i.getRjxssdl()); //检修
-            m.put("xddl", i.getRxdtjssdl().add(i.getRxdjclssdl()));//限电
-            m.put("gzdl", i.getRgzssdl());      //故障
-            m.put("xndl", i.getRxnssdl());//性能
+            m.put("fdl", i.getRfdl().divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP)); //发电量
+            m.put("sldl", (i.getRcwsldwssdl().add(i.getRcwsltqssdl())).divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP));  //受累
+            m.put("jxdl", i.getRjxssdl().divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP)); //检修
+            m.put("xddl", (i.getRxdtjssdl().add(i.getRxdjclssdl())).divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP));//限电
+            m.put("gzdl", i.getRgzssdl().divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP));      //故障
+            m.put("xndl", i.getRxnssdl().divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP));//性能
             m.put("date",DateUtils.toDate1(i.getRecordDate()));
             dltjfxList.add(m);
         });
@@ -305,12 +305,12 @@ public class EconomyPointHomePageService {
     private void monthDltjfx() {
         dltjfxlist.stream().forEach(i -> {
             Map<String, Object> m = new HashMap<>();
-            m.put("fdl", i.getYfdl()); //发电量
-            m.put("sldl", i.getYcwsldwssdl().add(i.getRcwsltqssdl()));  //受累
-            m.put("jxdl", i.getYjxssdl()); //检修
-            m.put("xddl", i.getYxdtjssdl().add(i.getRxdjclssdl()));//限电
-            m.put("gzdl", i.getYgzssdl());      //故障
-            m.put("xndl", i.getYxnssdl());//性能
+            m.put("fdl", i.getYfdl().divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP)); //发电量
+            m.put("sldl", (i.getYcwsldwssdl().add(i.getRcwsltqssdl())).divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP));  //受累
+            m.put("jxdl", i.getYjxssdl().divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP)); //检修
+            m.put("xddl", (i.getYxdtjssdl().add(i.getRxdjclssdl())).divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP));//限电
+            m.put("gzdl", (i.getYgzssdl()).divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP));      //故障
+            m.put("xndl", (i.getYxnssdl()).divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP));//性能
             m.put("date",DateUtils.toDate1(i.getRecordDate()));
             dltjfxList.add(m);
         });
@@ -319,12 +319,12 @@ public class EconomyPointHomePageService {
     private void yearDltjfx() {
         dltjfxlist.stream().forEach(i -> {
             Map<String, Object> m = new HashMap<>();
-            m.put("fdl", i.getNfdl()); //发电量
-            m.put("sldl", i.getNcwsldwssdl().add(i.getRcwsltqssdl()));  //受累
-            m.put("jxdl", i.getNjxssdl()); //检修
-            m.put("xddl", i.getNxdtjssdl().add(i.getRxdjclssdl()));//限电
-            m.put("gzdl", i.getNgzssdl());      //故障
-            m.put("xndl", i.getNxnssdl());//性能
+            m.put("fdl", i.getNfdl().divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP)); //发电量
+            m.put("sldl", (i.getNcwsldwssdl().add(i.getRcwsltqssdl())).divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP));  //受累
+            m.put("jxdl", (i.getNjxssdl()).divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP)); //检修
+            m.put("xddl", (i.getNxdtjssdl().add(i.getRxdjclssdl())).divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP));//限电
+            m.put("gzdl", (i.getNgzssdl()).divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP));      //故障
+            m.put("xndl", (i.getNxnssdl()).divide(new BigDecimal(10000), 6, BigDecimal.ROUND_HALF_UP));//性能
             m.put("date",DateUtils.toDate1(i.getRecordDate()));
             dltjfxList.add(m);
         });
@@ -390,7 +390,7 @@ public class EconomyPointHomePageService {
         //限电
         wsdlfx.put("xddl", compare100((fiveInfo.getRxdtjssdl().add(fiveInfo.getRxdjclssdl())).divide(fiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))));
         //故障
-        wsdlfx.put("fgzdl", compare100(fiveInfo.getRgzssdl().divide(fiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))));
+        wsdlfx.put("gzdl", compare100(fiveInfo.getRgzssdl().divide(fiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))));
         //性能
         wsdlfx.put("xndl", compare100(fiveInfo.getRxnssdl().divide(fiveInfo.getRllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))));
 
@@ -406,7 +406,7 @@ public class EconomyPointHomePageService {
         //限电
         wsdlfx.put("xddl", compare100((fiveInfo.getYxdtjssdl().add(fiveInfo.getYxdjclssdl())).divide(fiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))));
         //故障
-        wsdlfx.put("fgzdl", compare100(fiveInfo.getYgzssdl().divide(fiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))));
+        wsdlfx.put("gzdl", compare100(fiveInfo.getYgzssdl().divide(fiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))));
         //性能
         wsdlfx.put("xndl", compare100(fiveInfo.getYxnssdl().divide(fiveInfo.getYllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))));
 
@@ -423,7 +423,7 @@ public class EconomyPointHomePageService {
         //限电
         wsdlfx.put("xddl", compare100((fiveInfo.getNxdtjssdl().add(fiveInfo.getNxdjclssdl())).divide(fiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))));
         //故障
-        wsdlfx.put("fgzdl", compare100(fiveInfo.getNgzssdl().divide(fiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))));
+        wsdlfx.put("gzdl", compare100(fiveInfo.getNgzssdl().divide(fiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))));
         //性能
         wsdlfx.put("xndl", compare100(fiveInfo.getNxnssdl().divide(fiveInfo.getNllfdl(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))));
     }
@@ -968,7 +968,7 @@ public class EconomyPointHomePageService {
     private boolean compare0(BigDecimal a){
         BigDecimal b = new BigDecimal (0.00);
         BigDecimal c = new BigDecimal (0);
-        if(b.compareTo(a) == 0 || b.compareTo(c) == 0){
+        if(b.compareTo(a) == 0 || c.compareTo(a) == 0){
            return false;
         }
         return true;

+ 23 - 5
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/threerate/ThreeRateService.java

@@ -1,6 +1,7 @@
 package com.gyee.runeconomy.service.threerate;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.common.model.StringUtils;
 import com.gyee.common.util.DateUtils;
 import com.gyee.common.util.DoubleUtils;
 import com.gyee.common.util.SortUtils;
@@ -42,9 +43,11 @@ public class ThreeRateService {
      * @param endDate
      * @return
      */
-    public  List<FwjslDTO> getResetTimelyRateInfo(String beginDate, String endDate) {
+    public  List<FwjslDTO> getResetTimelyRateInfo(String companyId,String windpowerstationId,String beginDate, String endDate) {
         List<FwjslDTO> resultList = new ArrayList<>();
-        List<ProEconEquipmentInfoDay5> list =  proEconEquipmentInfoDay5Service.getResetTimelyRateList( beginDate,  endDate);
+        List<ProEconEquipmentInfoDay5> list = proEconEquipmentInfoDay5Service.getResetTimelyRateList(companyId, windpowerstationId, beginDate, endDate);
+
+
         getData(resultList, list);
         SortUtils.sort(resultList,"ordernum",SortUtils.ASC);
         return resultList;
@@ -60,7 +63,7 @@ public class ThreeRateService {
      * @param endDate
      * @return
      */
-    public Map<String, List<FwjslDTO>> getStateConversionRateInfo(String beginDate, String endDate) {
+    public Map<String, List<FwjslDTO>> getStateConversionRateInfo(String companyId, String windpowerstationId,String beginDate, String endDate) {
         Map<String, List<FwjslDTO>> resultMap = new HashMap<>();
         List<FwjslDTO> resultList1 = new ArrayList<>();
         List<FwjslDTO> resultList2 = new ArrayList<>();
@@ -69,7 +72,8 @@ public class ThreeRateService {
         resultMap.put("大于3米风速",resultList2);
         resultMap.put("大于4米风速",resultList3);
         QueryWrapper<ProEconEquipmentInfoDay5> qw = new QueryWrapper<>();
-        List<ProEconEquipmentInfoDay5> list = proEconEquipmentInfoDay5Service.getStateConversionRateList(beginDate, endDate);
+        List<ProEconEquipmentInfoDay5> list = proEconEquipmentInfoDay5Service.getStateConversionRateList( companyId,  windpowerstationId,beginDate, endDate);
+
 
         getData1(resultList1, list);
         getData2(resultList2, list);
@@ -91,18 +95,32 @@ public class ThreeRateService {
      * @param endDate
      * @return
      */
-    public List<QxjslDTO> getDefectsEliminatRateList(String beginDate, String endDate) {
+    public List<QxjslDTO> getDefectsEliminatRateList(String companyId, String windpowerstationId,String beginDate, String endDate) {
 
 
         Map<String, Integer> station =  proBasicPowerstationService.list()
                 .stream().collect(Collectors.toMap(ProBasicPowerstation::getId,ProBasicPowerstation::getOrderNum));
 
+        List<String> wpids = new ArrayList<>();
+        //场站模糊查询
+        if (StringUtils.isNotEmpty(companyId)) {
+            List<ProBasicPowerstation> wplist = CacheContext.wpls.stream().filter(wp -> wp.getRegionId().equals(companyId) || wp.getCompanyId().equals(companyId)).collect(Collectors.toList());
+            wpids = wplist.stream().map(ProBasicPowerstation::getId).collect(Collectors.toList());
 
+        }
+        if (StringUtils.isNotEmpty(companyId)) {
+            wpids.add(windpowerstationId);
+        }
 
         List<QxjslDTO> resultList = new ArrayList<>();
         QueryWrapper<ProEconFaultLiminatedefects> qw = new QueryWrapper<>();
         qw.select("windpowerstation_id,sum(fault_count) faultcount,sum(right_count) rightcount");
         qw.ge("date_time", DateUtils.parseDate(beginDate)).le("date_time",DateUtils.parseDate(endDate));
+        if (wpids.size()>0) {
+            qw.lambda().in(ProEconFaultLiminatedefects::getWindpowerstationId, wpids);
+
+        }
+
         qw.groupBy("windpowerstation_id");
         List<ProEconFaultLiminatedefects> faulteliminatedefectsList = proEconFaultLiminatedefectsService.list(qw);
         AtomicReference<Long> gzCount= new AtomicReference<>((long) 0);