Browse Source

使用nacos和feign

JasonWang 3 years ago
parent
commit
3fb7da5286
27 changed files with 870 additions and 115 deletions
  1. 2 2
      .idea/compiler.xml
  2. 5 0
      web/analysis-web-hb/pom.xml
  3. 2 0
      web/analysis-web-hb/src/main/java/com/gyee/analysis/AnalysisMain.java
  4. 11 0
      web/analysis-web-hb/src/main/resources/application-dev.yml
  5. 11 0
      web/analysis-web-hb/src/main/resources/application-test.yml
  6. 5 0
      web/benchmarking-web-hb/pom.xml
  7. 2 0
      web/benchmarking-web-hb/src/main/java/com/gyee/benchmarkingweb/BenchmarkingwebMain.java
  8. 11 0
      web/benchmarking-web-hb/src/main/resources/application-dev.yml
  9. 11 0
      web/benchmarking-web-hb/src/main/resources/application-test.yml
  10. 1 0
      web/consumer/pom.xml
  11. 78 0
      web/consumer/src/main/java/com/gyee/consumer/api/analysis/AnalysisApi.java
  12. 296 0
      web/consumer/src/main/java/com/gyee/consumer/api/benching/BenchmarkingApi.java
  13. 125 0
      web/consumer/src/main/java/com/gyee/consumer/api/knowleage/KnowledgeApi.java
  14. 117 0
      web/consumer/src/main/java/com/gyee/consumer/api/specific/SpecificApi.java
  15. 37 0
      web/consumer/src/main/java/com/gyee/consumer/api/targetdata/TargetdataApi.java
  16. 44 0
      web/consumer/src/main/java/com/gyee/consumer/api/threerate/ThreeRateApi.java
  17. 17 17
      web/consumer/src/main/java/com/gyee/consumer/controller/analysis/AnalysisController.java
  18. 24 28
      web/consumer/src/main/java/com/gyee/consumer/controller/benching/BenchmarkingController.java
  19. 11 30
      web/consumer/src/main/java/com/gyee/consumer/controller/knowleage/KnowleageController.java
  20. 19 21
      web/consumer/src/main/java/com/gyee/consumer/controller/specific/SpecificController.java
  21. 5 7
      web/consumer/src/main/java/com/gyee/consumer/controller/targetdata/TargetdataController.java
  22. 5 8
      web/consumer/src/main/java/com/gyee/consumer/controller/threerate/ThreerateController.java
  23. 2 2
      web/consumer/src/main/resources/application.yml
  24. 5 0
      web/knowledge-hb/pom.xml
  25. 2 0
      web/knowledge-hb/src/main/java/com/gyee/knowledge/KnowledgeMain.java
  26. 11 0
      web/knowledge-hb/src/main/resources/application-dev.yml
  27. 11 0
      web/knowledge-hb/src/main/resources/application-test.yml

+ 2 - 2
.idea/compiler.xml

@@ -8,19 +8,19 @@
         <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
         <outputRelativeToContentRoot value="true" />
         <module name="datatraining-server" />
+        <module name="consumer-hb" />
         <module name="adapter-td-hb" />
         <module name="meteorologicalcollection" />
+        <module name="customization-hb" />
         <module name="datacenter-hb" />
         <module name="failurestatistics-server" />
         <module name="analysis-histroy-hb" />
-        <module name="consumer-hb" />
         <module name="cache" />
         <module name="healthmodel-server" />
         <module name="meteorologicalcollection-web" />
         <module name="monitor-web" />
         <module name="knowledge-hb" />
         <module name="benchmarking-web-hb" />
-        <module name="customization-hb" />
         <module name="benchmarking-web" />
         <module name="healthmanagement-histroy" />
         <module name="benchmarking-histroy-hb" />

+ 5 - 0
web/analysis-web-hb/pom.xml

@@ -40,6 +40,11 @@
             <version>1.2.7</version>
             <scope>compile</scope>
         </dependency>
+        <!--nacos 依赖-->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

+ 2 - 0
web/analysis-web-hb/src/main/java/com/gyee/analysis/AnalysisMain.java

@@ -3,6 +3,7 @@ package com.gyee.analysis;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
 
 /**
  * @ClassName : AnalysisMain
@@ -11,6 +12,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
  * @Description :
  */
 @SpringBootApplication
+@EnableDiscoveryClient
 @MapperScan("com.gyee.analysis.mapper")
 public class AnalysisMain {
     public static void main(String[] args) {

+ 11 - 0
web/analysis-web-hb/src/main/resources/application-dev.yml

@@ -5,8 +5,19 @@ server:
 
 
 spring:
+  application:
+    name: analysis-provider
   main:
     allow-bean-definition-overriding: true #当遇到同样名字的时候,是否允许覆盖注册
+  cloud:
+    nacos:
+      discovery:
+        server-addr: 192.168.2.216:8848
+        #指定yaml格式的配置
+        file-extension: yaml
+        cluster-name: master
+      username: nacos
+      password: nacos
   #redis集群
   redis:
 #    host: 10.83.68.94

+ 11 - 0
web/analysis-web-hb/src/main/resources/application-test.yml

@@ -5,8 +5,19 @@ server:
 
 
 spring:
+  application:
+    name: analysis-provider
   main:
     allow-bean-definition-overriding: true #当遇到同样名字的时候,是否允许覆盖注册
+  cloud:
+    nacos:
+      discovery:
+        server-addr: 10.83.68.97:8848
+        #指定yaml格式的配置
+        file-extension: yaml
+        cluster-name: master
+      username: nacos
+      password: nacos
   #redis集群
   redis:
     host: 10.83.68.94

+ 5 - 0
web/benchmarking-web-hb/pom.xml

@@ -34,6 +34,11 @@
             <artifactId>common</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <!--nacos 依赖-->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

+ 2 - 0
web/benchmarking-web-hb/src/main/java/com/gyee/benchmarkingweb/BenchmarkingwebMain.java

@@ -3,6 +3,7 @@ package com.gyee.benchmarkingweb;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
 
 /**
  * @ClassName : BenchmarkingwebMain
@@ -12,6 +13,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
  */
 @SpringBootApplication
 @MapperScan("com.gyee.benchmarkingweb.mapper")
+@EnableDiscoveryClient
 public class BenchmarkingwebMain {
 
     public static void main(String[] args) {

+ 11 - 0
web/benchmarking-web-hb/src/main/resources/application-dev.yml

@@ -5,8 +5,19 @@ server:
 
 
 spring:
+  application:
+    name: benchmarking-provider
   main:
     allow-bean-definition-overriding: true #当遇到同样名字的时候,是否允许覆盖注册
+  cloud:
+    nacos:
+      discovery:
+        server-addr: 192.168.2.216:8848
+        #指定yaml格式的配置
+        file-extension: yaml
+        cluster-name: master
+      username: nacos
+      password: nacos
   #redis集群
   redis:
 #    host: 10.83.68.94

+ 11 - 0
web/benchmarking-web-hb/src/main/resources/application-test.yml

@@ -5,8 +5,19 @@ server:
 
 
 spring:
+  application:
+    name: benchmarking-provider
   main:
     allow-bean-definition-overriding: true #当遇到同样名字的时候,是否允许覆盖注册
+  cloud:
+    nacos:
+      discovery:
+        server-addr: 10.83.68.97:8848
+        #指定yaml格式的配置
+        file-extension: yaml
+        cluster-name: master
+      username: nacos
+      password: nacos
   #redis集群
   redis:
     host: 10.83.68.94

+ 1 - 0
web/consumer/pom.xml

@@ -24,6 +24,7 @@
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-openfeign</artifactId>
         </dependency>
+        <!--nacos 依赖-->
         <dependency>
             <groupId>com.alibaba.cloud</groupId>
             <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>

+ 78 - 0
web/consumer/src/main/java/com/gyee/consumer/api/analysis/AnalysisApi.java

@@ -0,0 +1,78 @@
+package com.gyee.consumer.api.analysis;
+
+import com.gyee.common.config.R;
+import com.gyee.common.vo.analysis.AnalysisMainVo;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.*;
+
+import java.beans.IntrospectionException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+import java.util.Map;
+
+@FeignClient("analysis-provider")
+@RequestMapping("//analysisplus")
+public interface AnalysisApi {
+
+
+    /**
+     * 首页list
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    @GetMapping("/list")
+    public R list(
+            @RequestParam(value = "beginDate",required = true)String beginDate,
+            @RequestParam(value = "endDate",required = true)String endDate);
+
+    /**
+     * 首页确认
+     * @param vo
+     */
+    @PostMapping("/commit")
+    public R commit(@RequestBody AnalysisMainVo vo);
+
+
+    /**
+     * 表底查询
+     * @param theday
+     * @param wpid
+     * @return
+     */
+    @GetMapping("/bdzlist")
+    public R bdzlist(
+            @RequestParam(value = "theday",required = true)String theday,
+            @RequestParam(value = "wpid",required = true)String wpid) throws IllegalAccessException, IntrospectionException, InvocationTargetException;
+
+    /**
+     * 统计分析查询
+     * @param theday
+     * @param wpid
+     * @param identity
+     * @return
+     */
+    @GetMapping("/tjfxlist")
+    public R  tjfxlist(
+            @RequestParam(value = "theday",required = true)String theday,
+            @RequestParam(value = "wpid",required = true)String wpid,
+            @RequestParam(value = "identity",required = true) Integer identity);
+
+    /**
+     * 表底值修改
+     * @param bdzVo
+     */
+    @PostMapping("/bdzupdate")
+    public void   bdzupdate(@RequestBody Map<String,Object> bdzVo);
+
+    /**
+     * 统计分析修改
+     * @param tjfxVo
+     */
+    @PostMapping("/tjfxupdate")
+    public void   tjfxupdate(@RequestBody List<Map<String,Object>> tjfxVo);
+
+    @GetMapping("/energyDaily")
+    public R  energyDaily(
+            @RequestParam(value = "theday",required = true)String theday);
+}

+ 296 - 0
web/consumer/src/main/java/com/gyee/consumer/api/benching/BenchmarkingApi.java

@@ -0,0 +1,296 @@
+package com.gyee.consumer.api.benching;
+
+import com.gyee.common.config.R;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@FeignClient("benchmarking-provider")
+@RequestMapping("//benchmarking")
+public interface BenchmarkingApi {
+    /**
+     * 场站列表
+     * @return
+     */
+    @GetMapping("/wplist")
+    public R wplist();
+
+
+    /**
+     * GF场站列表
+     * @return
+     */
+    @GetMapping("/wpgflist")
+    public R wpGFlist();
+
+    /**
+     * 根据场站查询
+     * 项目列表
+     * @return
+     */
+    @GetMapping("/projectList")
+    public R projectList(@RequestParam(value = "wpids",required = true) String wpids);
+
+    /**
+     * 根据项目查询
+     * 线路列表
+     * @return
+     */
+    @GetMapping("/lineList")
+    public R lineList(@RequestParam(value = "projects",required = true) String projects);
+
+    /**
+     * 根据场站查询
+     * 风机列表
+     * @return
+     */
+    @GetMapping("/wtList")
+    public R wtList(@RequestParam(value = "wpid",required = true) String wpid);
+    /**
+     * 风机绩效榜
+     * @param wpids
+     * @param projectids
+     * @param lineids
+     * @param beginDate
+     * @param endDate
+     * @param type
+     * @return
+     */
+    @GetMapping("/fjjxb")
+    public R fjjxb(@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 = "type",required = true) String type,
+                   @RequestParam(value = "target",required = true) String target,
+                   @RequestParam(value = "sort",required = true) String sort
+    );
+    /**
+     * 风机绩效榜明细
+     * @param wpids
+     * @param projectids
+     * @param lineids
+     * @param beginDate
+     * @param endDate
+     * @param type
+     * @return
+     */
+    @GetMapping("/fjjxbmx")
+    public R fjjxbmx(@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 = "type",required = true) String type,
+                     @RequestParam(value = "target",required = true) String target,
+                     @RequestParam(value = "sort",required = true) String sort
+    );
+
+    /**
+     * 五项损失率
+     * @param wpids
+     * @param projectids
+     * @param lineids
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    @GetMapping("/wxssl")
+    public R wxssl(@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
+    );
+
+    /**
+     * 场内对标
+     * @param wpid
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    @GetMapping("/cndb")
+    public R cndb(@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
+    );
+
+    /**
+     * 场际对标
+     * @param wpids
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    @GetMapping("/cjdb")
+    public R cjdb(@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
+    );
+
+    /**
+     * 项目对标
+     * @param wpids
+     * @param projectids
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    @GetMapping("/xmdb")
+    public R xmdb(@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
+    );
+
+    /**
+     * 线路对标
+     * @param wpids
+     * @param projectids
+     * @param lineids
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    @GetMapping("/xldb")
+    public R xldb(@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
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    @GetMapping("/zjlist")
+    public R listplus(@RequestParam(value = "beginDate",required = true)String beginDate,
+                      @RequestParam(value = "endDate",required = true)String endDate);
+
+    /**
+     * 值际点击钻取
+     * @param beginDate
+     * @param endDate
+     * @param dutyname
+     * @param direct
+     * @return
+     */
+    @GetMapping("/zjdrill")
+    public R zjdrill(@RequestParam(value = "beginDate",required = true)String beginDate,
+                     @RequestParam(value = "endDate",required = true)String endDate,
+                     @RequestParam(value = "dutyname",required = true)String dutyname,
+                     @RequestParam(value = "direct",required = true)String direct);
+
+    /**
+     * 值际损失电量
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    @GetMapping("/zjwxssl")
+    public R zjwxssl(@RequestParam(value = "beginDate",required = true)String beginDate,
+                     @RequestParam(value = "endDate",required = true)String endDate);
+
+    /**
+     * 对标页面详情
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    @GetMapping("/details")
+    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
+    );
+
+
+
+    /**
+     * 日单机横向对比列表
+     * @param wpid
+     * @param wtids
+     * @param date
+     * @return
+     */
+    @GetMapping("/daydjhxdbtop")
+    public R daydjhxdbtop(@RequestParam(value = "wpid",required = true)String wpid,
+                          @RequestParam(value = "wtids",required = true)String wtids,
+                          @RequestParam(value = "date",required = true)String date);
+
+    /**
+     * 月单机横向对比列表
+     * @param wpid
+     * @param wtids
+     * @param date
+     * @return
+     */
+    @GetMapping("/monthdjhxdbtop")
+    public R monthdjhxdbtop(@RequestParam(value = "wpid",required = true)String wpid,
+                            @RequestParam(value = "wtids",required = true)String wtids,
+                            @RequestParam(value = "date",required = true)String date);
+
+    /**
+     * 年单机横向对比列表
+     * @param wpid
+     * @param wtids
+     * @param date
+     * @return
+     */
+    @GetMapping("/yeardjhxdbtop")
+    public R yeardjhxdbtop(@RequestParam(value = "wpid",required = true)String wpid,
+                           @RequestParam(value = "wtids",required = true)String wtids,
+                           @RequestParam(value = "date",required = true)String date);
+
+    /**
+     * 日单机横向对比图
+     * @param wpid
+     * @param wtids
+     * @param date
+     * @return
+     */
+    @GetMapping("/djhxdbbottom")
+    public R djhxdbbottom(@RequestParam(value = "wpid",required = true)String wpid,
+                          @RequestParam(value = "wtids",required = true)String wtids,
+                          @RequestParam(value = "date",required = true)String date);
+
+    /**
+     * 对标首页下面部分
+     * @param timetype
+     * @param foreigntype
+     * @return
+     * @throws Exception
+     */
+    @GetMapping("/dbmainbottom")
+    public R dbmainbottom(@RequestParam(value = "timetype",required = true)String timetype,
+                          @RequestParam(value = "foreigntype",required = true)String foreigntype) throws Exception;
+
+
+    /**
+     * 对标首页上面部分
+     * @param timetype
+     * @param foreigntype
+     * @return
+     * @throws Exception
+     */
+    @GetMapping("/dbmaintop")
+    public R dbmaintop(@RequestParam(value = "timetype",required = true)String timetype,
+                       @RequestParam(value = "foreigntype",required = true)String foreigntype) throws Exception;
+}

+ 125 - 0
web/consumer/src/main/java/com/gyee/consumer/api/knowleage/KnowledgeApi.java

@@ -0,0 +1,125 @@
+package com.gyee.consumer.api.knowleage;
+
+import com.gyee.common.config.R;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@FeignClient("knowledge-provider")
+@RequestMapping("//knowledge")
+public interface KnowledgeApi {
+    @GetMapping("/faultKnowledge")
+    public R faultKnowledge(@RequestParam(value = "gzjb",required = true) String gzjb,
+                            @RequestParam(value = "tjlx",required = true) String tjlx,
+                            @RequestParam(value = "cxnr",required = true) String cxnr,
+                            @RequestParam(value = "pageNum",required = true) String pageNum,
+                            @RequestParam(value = "pageSize",required = true) String pageSize
+    );
+
+    /**
+     * 预警知识
+     * @param gzjb
+     * @param bjlx
+     * @param cxnr
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/earlyKnowledge")
+    public R earlyKnowledge(@RequestParam(value = "gzjb",required = true) String gzjb,
+                            @RequestParam(value = "bjlx",required = true) String bjlx,
+                            @RequestParam(value = "cxnr",required = true) String cxnr,
+                            @RequestParam(value = "pageNum",required = true) String pageNum,
+                            @RequestParam(value = "pageSize",required = true) String pageSize
+    );
+
+    /**
+     * 检查修理方案
+     * @param model
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/checkRepairProgramme")
+    public R checkRepairProgramme(@RequestParam(value = "model",required = true) String model,
+                                  @RequestParam(value = "pageNum",required = true) String pageNum,
+                                  @RequestParam(value = "pageSize",required = true) String pageSize
+    );
+
+
+    /**
+     * 检查修理方案型号list
+     * @return
+     */
+    @GetMapping("/modelList")
+    public R modelList();
+
+    /**
+     * 特征参数
+     * @param name
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/featureParameter")
+    public R featureParameter(@RequestParam(value = "name",required = true) String name,
+                              @RequestParam(value = "pageNum",required = true) String pageNum,
+                              @RequestParam(value = "pageSize",required = true) String pageSize
+    );
+
+    /**
+     * 安全措施知识
+     * @param name
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/safeMeasureKnowledge")
+    public R safeMeasureKnowledge(@RequestParam(value = "safecontent",required = true) String name,
+                                  @RequestParam(value = "pageNum",required = true) String pageNum,
+                                  @RequestParam(value = "pageSize",required = true) String pageSize
+    );
+
+    /**
+     * 作业指导知识
+     * @param name
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+
+    @GetMapping("/workGuideKnowledge")
+    public R workGuideKnowledge(@RequestParam(value = "content",required = true) String name,
+                                @RequestParam(value = "pageNum",required = true) String pageNum,
+                                @RequestParam(value = "pageSize",required = true) String pageSize
+    );
+
+    /**
+     *作业指导知识->安措内容
+     * @param rsnum
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/workGuideKnowledge/safetyMeasure")
+    public R safetyMeasure(@RequestParam(value = "rsnum",required = false) String rsnum,
+                           @RequestParam(value = "content",required = false) String content,
+                           @RequestParam(value = "pageNum",required = true) String pageNum,
+                           @RequestParam(value = "pageSize",required = true) String pageSize
+    );
+
+    /**
+     * 作业指导知识->危险点内容
+     * @param rsnum
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/workGuideKnowledge/dangerContent")
+    public R dangerContent(@RequestParam(value = "rsnum",required = false) String rsnum,
+                           @RequestParam(value = "content",required = false) String content,
+                           @RequestParam(value = "pageNum",required = true) String pageNum,
+                           @RequestParam(value = "pageSize",required = true) String pageSize
+    );
+}

+ 117 - 0
web/consumer/src/main/java/com/gyee/consumer/api/specific/SpecificApi.java

@@ -0,0 +1,117 @@
+package com.gyee.consumer.api.specific;
+
+import com.gyee.common.config.R;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.text.ParseException;
+
+@FeignClient("benchmarking-provider")
+@RequestMapping("//specific")
+public interface SpecificApi {
+    /**
+     * 查询专题分析列表上
+     * @return
+     */
+    @GetMapping("/maintoplist")
+    public R maintoplist(@RequestParam(value = "month",required = true) String month) throws ParseException;
+
+    /**
+     * 查询专题分析列表下
+     * @return
+     */
+    @GetMapping("/maincenterlist")
+    public R maincenterlist(@RequestParam(value = "month",required = true) String month) throws ParseException;
+
+    /**
+     * 查询风能利用率功能
+     * @return
+     */
+    @GetMapping("/fnlylList")
+    public R fnlylList(@RequestParam(value = "year",required = true) String year) throws ParseException;
+
+    /**
+     * 查询发电量
+     * @return
+     */
+    @GetMapping("/fdlList")
+    public R fdlList(@RequestParam(value = "year",required = true) String year) throws ParseException;
+
+    /**
+     * 综合场用电量
+     * @return
+     */
+    @GetMapping("/zhcydlList")
+    public R zhcydlList(@RequestParam(value = "year",required = true) String year) throws ParseException;
+
+    /**
+     * 查询维护损失率功能
+     * @return
+     */
+    @GetMapping("/whsslList")
+    public R whsslList(@RequestParam(value = "year",required = true) String year) throws ParseException;
+
+    /**
+     * 查询故障损失率功能
+     * @return
+     */
+    @GetMapping("/gzsslList")
+    public R gzsslList(@RequestParam(value = "year",required = true) String year) throws ParseException;
+
+    /**
+     * 查询限电损失率功能
+     * @return
+     */
+    @GetMapping("/xdsslList")
+    public R xdsslList(@RequestParam(value = "year",required = true) String year) throws ParseException;
+
+    /**
+     * 查询性能损失率功能
+     * @return
+     */
+    @GetMapping("/xnsslList")
+    public R xnsslList(@RequestParam(value = "year",required = true) String year) throws ParseException;
+    /**
+     * 查询受累损失率功能
+     * @return
+     */
+    @GetMapping("/slsslList")
+    public R slsslList(@RequestParam(value = "year",required = true) String year) throws ParseException;
+
+    /**
+     * 查询MTBF功能
+     * @return
+     */
+    @GetMapping("/mtbfList")
+    public R mtbfList(@RequestParam(value = "year",required = true) String year) throws ParseException;
+
+    /**
+     * 查询MTTR功能
+     * @return
+     */
+    @GetMapping("/mttrList")
+    public R mttrList(@RequestParam(value = "year",required = true) String year) throws ParseException;
+
+    /**
+     * 查询复位及时率功能
+     * @return
+     */
+    @GetMapping("/fwjslList")
+    public R fwjslList(@RequestParam(value = "year",required = true) String year) throws ParseException;
+
+    /**
+     * 查询状态转换率功能
+     * @return
+     */
+    @GetMapping("/ztzhlList")
+    public R ztzhlList(@RequestParam(value = "year",required = true) String year) throws ParseException;
+
+    /**
+     * 查询消缺及时率功能
+     * @return
+     */
+    @GetMapping("/xqjslList")
+    public R xqjslList(@RequestParam(value = "year",required = true) String year) throws ParseException;
+}

+ 37 - 0
web/consumer/src/main/java/com/gyee/consumer/api/targetdata/TargetdataApi.java

@@ -0,0 +1,37 @@
+package com.gyee.consumer.api.targetdata;
+
+import com.gyee.common.config.R;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.text.ParseException;
+
+@FeignClient("benchmarking-provider")
+@RequestMapping("//targetdata")
+public interface TargetdataApi {
+    /**
+     * 能效指标查询
+     * @param date
+     * @return
+     */
+    @GetMapping("/nxzbcx")
+    public R nxzbcx(@RequestParam(value = "date",required = true) String date);
+
+    /**
+     * 可靠性指标分析
+     * @param date
+     * @return
+     */
+    @GetMapping("/kkxzbfx")
+    public R kkxzbfx(@RequestParam(value = "date",required = true) String date);
+
+    /**
+     * 节能减排kpi
+     * @param month
+     * @return
+     */
+    @GetMapping("/jnjpkpi")
+    public R jnjpkpi(@RequestParam(value = "month",required = true) String month) throws ParseException;
+}

+ 44 - 0
web/consumer/src/main/java/com/gyee/consumer/api/threerate/ThreeRateApi.java

@@ -0,0 +1,44 @@
+package com.gyee.consumer.api.threerate;
+
+import com.gyee.common.config.R;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@FeignClient("benchmarking-provider")
+@RequestMapping("//threerate")
+public interface ThreeRateApi {
+    /**
+     * 复位及时率
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    @GetMapping("/fwjsl")
+    public R fwjsl(@RequestParam(value = "beginDate",required = true) String beginDate,
+                   @RequestParam(value = "endDate",required = true) String endDate
+    );
+
+    /**
+     * 状态转换率
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    @GetMapping("/ztzhl")
+    public R ztzhl(@RequestParam(value = "beginDate",required = true) String beginDate,
+                   @RequestParam(value = "endDate",required = true) String endDate
+    );
+
+    /**
+     * 消缺及时率
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    @GetMapping("/xqjsl")
+    public R xqjsl(@RequestParam(value = "beginDate",required = true) String beginDate,
+                   @RequestParam(value = "endDate",required = true) String endDate
+    );
+}

+ 17 - 17
web/consumer/src/main/java/com/gyee/consumer/controller/analysis/AnalysisController.java

@@ -1,12 +1,9 @@
 package com.gyee.consumer.controller.analysis;
 
 import com.gyee.common.config.R;
-import com.gyee.common.model.StringUtils;
 import com.gyee.common.vo.analysis.AnalysisMainVo;
-import com.gyee.common.vo.analysis.EnergyDailyVo;
-import org.springframework.beans.factory.annotation.Value;
+import com.gyee.consumer.api.analysis.AnalysisApi;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.client.RestTemplate;
 
 import javax.annotation.Resource;
 import java.beans.IntrospectionException;
@@ -22,12 +19,10 @@ import java.util.Map;
  */
 @RestController
 public class AnalysisController {
+    @Resource
+    private AnalysisApi analysisApi;
 
-    @Value("${url.analysis}")
-    private String  ANALYSIS_URL;
 
-    @Resource
-    private RestTemplate restTemplate;
 
     /**
      * 首页list
@@ -38,7 +33,7 @@ public class AnalysisController {
     @GetMapping(value = "/consumer/analysisplus/list")
     public R list(@RequestParam(value = "beginDate",required = true)String beginDate,
                     @RequestParam(value = "endDate",required = true)String endDate){
-        return restTemplate.getForObject(ANALYSIS_URL+"/analysisplus/list?beginDate="+beginDate+"&endDate="+endDate,R.class);
+        return analysisApi.list(beginDate,endDate);
     }
 
     /**
@@ -47,7 +42,7 @@ public class AnalysisController {
      */
     @PostMapping(value = "/consumer/analysisplus/commit")
     public R commit(@RequestBody AnalysisMainVo vo){
-        return restTemplate.postForObject(ANALYSIS_URL+"/analysisplus/commit",vo,R.class);
+        return analysisApi.commit(vo);
     }
 
 
@@ -60,8 +55,8 @@ public class AnalysisController {
     @GetMapping("/consumer/analysisplus/bdzlist")
     public R bdzlist(
             @RequestParam(value = "theday",required = true)String theday,
-            @RequestParam(value = "wpid",required = true)String wpid)  {
-        return restTemplate.getForObject(ANALYSIS_URL+"/analysisplus/bdzlist?theday="+theday+"&wpid="+wpid,R.class);
+            @RequestParam(value = "wpid",required = true)String wpid) throws IllegalAccessException, IntrospectionException, InvocationTargetException {
+        return analysisApi.bdzlist(theday,wpid);
     }
 
 
@@ -77,9 +72,8 @@ public class AnalysisController {
             @RequestParam(value = "theday",required = true)String theday,
             @RequestParam(value = "wpid",required = true)String wpid,
             @RequestParam(value = "identity",required = true) Integer identity) {
-        return restTemplate.getForObject(ANALYSIS_URL+"/analysisplus/tjfxlist?theday="+theday+"&wpid="+wpid+"&identity="+identity,R.class);
-
 
+        return analysisApi.tjfxlist(theday,wpid,identity);
     }
 
     /**
@@ -88,7 +82,8 @@ public class AnalysisController {
      */
     @PostMapping("/consumer/analysisplus/bdzupdate")
     public void   bdzupdate(@RequestBody Map<String,Object> bdzVo) {
-        restTemplate.postForObject(ANALYSIS_URL+"/analysisplus/commit",bdzVo,null);
+
+        analysisApi.bdzupdate(bdzVo);
     }
 
     /**
@@ -97,13 +92,18 @@ public class AnalysisController {
      */
     @PostMapping("/consumer/analysisplus/tjfxupdate")
     public void   tjfxupdate(@RequestBody List<Map<String,Object>> tjfxVo) {
-        restTemplate.postForObject(ANALYSIS_URL+"/analysisplus/tjfxupdate",tjfxVo,null);
+        analysisApi.tjfxupdate(tjfxVo);
     }
 
+    /**
+     * 新能源日报
+     * @param theday
+     * @return
+     */
     @GetMapping("/consumer/analysisplus/energyDaily")
     public R  energyDaily(
             @RequestParam(value = "theday",required = true)String theday) {
-        return restTemplate.getForObject(ANALYSIS_URL+"/analysisplus/energyDaily?theday="+theday,R.class);
+        return analysisApi.energyDaily(theday);
     }
 
 }

+ 24 - 28
web/consumer/src/main/java/com/gyee/consumer/controller/benching/BenchmarkingController.java

@@ -7,9 +7,9 @@ import com.gyee.common.util.SortUtils;
 import com.gyee.common.vo.algorithm.LineParameters;
 import com.gyee.common.vo.benchmark.Operation;
 import com.gyee.common.vo.benchmark.WxsslVo;
+import com.gyee.consumer.api.benching.BenchmarkingApi;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.client.RestTemplate;
 
 import javax.annotation.Resource;
 import java.util.List;
@@ -23,12 +23,8 @@ import java.util.Map;
  */
 @RestController
 public class BenchmarkingController {
-
-    @Value("${url.benchmaring}")
-    private String  BENCHMARKING_URL;
-
     @Resource
-    private RestTemplate restTemplate;
+    private BenchmarkingApi benchmarkingApi;
 
     /**
      * 场站列表
@@ -36,7 +32,7 @@ public class BenchmarkingController {
      */
     @GetMapping(value = "/consumer/benchmarking/wplist")
     public R wplist(){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/wplist",R.class);
+        return benchmarkingApi.wplist();
     }
 
     /**
@@ -45,7 +41,7 @@ public class BenchmarkingController {
      */
     @GetMapping(value = "/consumer/benchmarking/wpgflist")
     public R wpGFlist(){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/wpgflist",R.class);
+        return benchmarkingApi.wpGFlist();
     }
 
     /**
@@ -55,7 +51,7 @@ public class BenchmarkingController {
      */
     @GetMapping(value = "/consumer/benchmarking/projectList")
     public R projectList(@RequestParam(value = "wpids",required = true) String wpids){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/projectList?wpids="+wpids,R.class);
+        return benchmarkingApi.projectList(wpids);
     }
 
     /**
@@ -65,7 +61,7 @@ public class BenchmarkingController {
      */
     @GetMapping(value = "/consumer/benchmarking/lineList")
     public R lineList(@RequestParam(value = "projects",required = true) String projects){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/lineList?projects="+projects,R.class);
+        return benchmarkingApi.lineList(projects);
     }
 
     /**
@@ -75,7 +71,7 @@ public class BenchmarkingController {
      */
     @GetMapping(value = "/consumer/benchmarking/wtList")
     public R wtList(@RequestParam(value = "wpid",required = true) String wpid){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/wtList?wpid="+wpid,R.class);
+        return benchmarkingApi.wtList(wpid);
     }
 
     /**
@@ -99,7 +95,7 @@ public class BenchmarkingController {
                    @RequestParam(value = "type",required = true) String type,
                    @RequestParam(value = "target",required = true) String target,
                    @RequestParam(value = "sort",required = true) String sort){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/fjjxb?wpids="+wpids+"&projectids="+projectids+"&lineids="+lineids+"&beginDate="+beginDate+"&endDate="+endDate+"&type="+type+"&target="+target+"&sort="+sort,R.class);
+        return benchmarkingApi.fjjxb(wpids,projectids,lineids,beginDate,endDate,type,target,sort);
     }
 
     /**
@@ -123,7 +119,7 @@ public class BenchmarkingController {
                    @RequestParam(value = "type",required = true) String type,
                    @RequestParam(value = "target",required = true) String target,
                    @RequestParam(value = "sort",required = true) String sort){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/fjjxbmx?wpids="+wpids+"&projectids="+projectids+"&lineids="+lineids+"&beginDate="+beginDate+"&endDate="+endDate+"&type="+type+"&target="+target+"&sort="+sort,R.class);
+        return benchmarkingApi.fjjxbmx(wpids,projectids,lineids,beginDate,endDate,type,target,sort);
     }
 
     /**
@@ -144,7 +140,7 @@ public class BenchmarkingController {
                    @RequestParam(value = "target",required = true) String target,
                    @RequestParam(value = "sort",required = true) String sort
     ){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/wxssl?wpids="+wpids+"&projectids="+projectids+"&lineids="+lineids+"&beginDate="+beginDate+"&endDate="+endDate+"&target="+target+"&sort="+sort,R.class);
+        return benchmarkingApi.wxssl(wpids,projectids,lineids,beginDate,endDate,target,sort);
     }
 
     /**
@@ -161,7 +157,7 @@ public class BenchmarkingController {
                   @RequestParam(value = "target",required = true) String target,
                   @RequestParam(value = "sort",required = true) String sort
     ){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/cndb?wpid="+wpid+"&beginDate="+beginDate+"&endDate="+endDate+"&target="+target+"&sort="+sort,R.class);
+        return benchmarkingApi.cndb(wpid,beginDate,endDate,target,sort);
 
 
     }
@@ -181,7 +177,7 @@ public class BenchmarkingController {
                   @RequestParam(value = "sort",required = true) String sort
     ){
 
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/cjdb?wpids="+wpids+"&beginDate="+beginDate+"&endDate="+endDate+"&target="+target+"&sort="+sort,R.class);
+        return benchmarkingApi.cjdb(wpids,beginDate,endDate,target,sort);
 
 
     }
@@ -204,7 +200,7 @@ public class BenchmarkingController {
                   @RequestParam(value = "sort",required = true) String sort
     ){
 
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/xmdb?wpids="+wpids+"&projectids="+projectids+"&beginDate="+beginDate+"&endDate="+endDate+"&target="+target+"&sort="+sort,R.class);
+        return benchmarkingApi.xmdb(wpids,projectids,beginDate,endDate,target,sort);
 
     }
 
@@ -228,7 +224,7 @@ public class BenchmarkingController {
                   @RequestParam(value = "target",required = true) String target,
                   @RequestParam(value = "sort",required = true) String sort
     ){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/xldb?wpids="+wpids+"&projectids="+projectids+"&lineids"+lineids+"&beginDate="+beginDate+"&endDate="+endDate+"&target="+target+"&sort="+sort,R.class);
+        return benchmarkingApi.xldb(wpids,projectids,lineids,beginDate,endDate,target,sort);
 
     }
 
@@ -242,7 +238,7 @@ public class BenchmarkingController {
     @GetMapping("/consumer/benchmarking/zjlist")
     public R listplus(@RequestParam(value = "beginDate",required = true)String beginDate,
                       @RequestParam(value = "endDate",required = true)String endDate){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/zjlist?beginDate="+beginDate+"&endDate="+endDate,R.class);
+        return benchmarkingApi.listplus(beginDate,endDate);
 
     }
 
@@ -259,7 +255,7 @@ public class BenchmarkingController {
                      @RequestParam(value = "endDate",required = true)String endDate,
                      @RequestParam(value = "dutyname",required = true)String dutyname,
                      @RequestParam(value = "direct",required = true)String direct){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/zjdrill?beginDate="+beginDate+"&endDate="+endDate+"&dutyname="+dutyname+"&direct="+direct,R.class);
+        return benchmarkingApi.zjdrill(beginDate,endDate,dutyname,direct);
 
     }
 
@@ -272,7 +268,7 @@ public class BenchmarkingController {
     @GetMapping("/consumer/benchmarking/zjwxssl")
     public R zjwxssl(@RequestParam(value = "beginDate",required = true)String beginDate,
                      @RequestParam(value = "endDate",required = true)String endDate){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/zjwxssl?beginDate="+beginDate+"&endDate="+endDate,R.class);
+        return benchmarkingApi.zjwxssl(beginDate,endDate);
 
     }
 
@@ -289,7 +285,7 @@ public class BenchmarkingController {
                      @RequestParam(value = "target",required = true) String target,
                      @RequestParam(value = "sort",required = true) String sort
     ){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/details?id="+id+"&beginDate="+beginDate+"&endDate="+endDate+"&target="+target+"&sort="+sort,R.class);
+        return benchmarkingApi.details(id,beginDate,endDate,target,sort);
 
     }
 
@@ -304,7 +300,7 @@ public class BenchmarkingController {
     public R daydjhxdbtop(@RequestParam(value = "wpid",required = true)String wpid,
                           @RequestParam(value = "wtids",required = true)String wtids,
                           @RequestParam(value = "date",required = true)String date){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/daydjhxdbtop?wpid="+wpid+"&wtids="+wtids+"&date="+date,R.class);
+        return benchmarkingApi.daydjhxdbtop(wpid,wtids,date);
 
     }
 
@@ -320,7 +316,7 @@ public class BenchmarkingController {
     public R monthdjhxdbtop(@RequestParam(value = "wpid",required = true)String wpid,
                             @RequestParam(value = "wtids",required = true)String wtids,
                             @RequestParam(value = "date",required = true)String date){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/monthdjhxdbtop?wpid="+wpid+"&wtids="+wtids+"&date="+date,R.class);
+        return benchmarkingApi.monthdjhxdbtop(wpid,wtids,date);
 
     }
 
@@ -335,7 +331,7 @@ public class BenchmarkingController {
     public R yeardjhxdbtop(@RequestParam(value = "wpid",required = true)String wpid,
                            @RequestParam(value = "wtids",required = true)String wtids,
                            @RequestParam(value = "date",required = true)String date){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/yeardjhxdbtop?wpid="+wpid+"&wtids="+wtids+"&date="+date,R.class);
+        return benchmarkingApi.yeardjhxdbtop(wpid,wtids,date);
 
     }
 
@@ -351,7 +347,7 @@ public class BenchmarkingController {
     public R djhxdbbottom(@RequestParam(value = "wpid",required = true)String wpid,
                           @RequestParam(value = "wtids",required = true)String wtids,
                           @RequestParam(value = "date",required = true)String date){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/djhxdbbottom?wpid="+wpid+"&wtids="+wtids+"&date="+date,R.class);
+        return benchmarkingApi.djhxdbbottom(wpid,wtids,date);
 
     }
 
@@ -368,7 +364,7 @@ public class BenchmarkingController {
     @CrossOrigin(origins = "*", maxAge = 3600)
     public R dbmainbottom(@RequestParam(value = "timetype",required = true)String timetype,
                           @RequestParam(value = "foreigntype",required = true)String foreigntype) throws Exception {
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/dbmainbottom?timetype="+timetype+"&foreigntype="+foreigntype,R.class);
+        return benchmarkingApi.dbmainbottom(timetype,foreigntype);
     }
 
 
@@ -382,7 +378,7 @@ public class BenchmarkingController {
     @GetMapping("/consumer/benchmarking/dbmaintop")
     public R dbmaintop(@RequestParam(value = "timetype",required = true)String timetype,
                        @RequestParam(value = "foreigntype",required = true)String foreigntype) throws Exception {
-        return restTemplate.getForObject(BENCHMARKING_URL+"/benchmarking/dbmaintop?timetype="+timetype+"&foreigntype="+foreigntype,R.class);
+        return benchmarkingApi.dbmaintop(timetype,foreigntype);
     }
 
 }

+ 11 - 30
web/consumer/src/main/java/com/gyee/consumer/controller/knowleage/KnowleageController.java

@@ -2,9 +2,9 @@ package com.gyee.consumer.controller.knowleage;
 
 import com.gyee.common.config.R;
 import com.gyee.common.model.StringUtils;
+import com.gyee.consumer.api.knowleage.KnowledgeApi;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.client.RestTemplate;
 
 import javax.annotation.Resource;
 import java.util.List;
@@ -18,12 +18,8 @@ import java.util.List;
 @RestController
 public class KnowleageController {
 
-
-    @Value("${url.knowleage}")
-    private String  KNOWLEAGE_URL;
-
     @Resource
-    private RestTemplate restTemplate;
+    private KnowledgeApi knowledgeApi;
 
     /**
      * 故障知识列表
@@ -43,7 +39,7 @@ public class KnowleageController {
                             @RequestParam(value = "pageNum",required = true) String pageNum,
                             @RequestParam(value = "pageSize",required = true) String pageSize
     )  {
-        return restTemplate.getForObject(KNOWLEAGE_URL+"/knowledge/faultKnowledge?gzjb="+gzjb+"&tjlx="+tjlx+"&cxnr="+cxnr+"&pageNum="+pageNum+"&pageSize="+pageSize,R.class);
+        return knowledgeApi.faultKnowledge(gzjb,tjlx,cxnr,pageNum,pageSize);
     }
 
 
@@ -65,7 +61,7 @@ public class KnowleageController {
                             @RequestParam(value = "pageNum",required = true) String pageNum,
                             @RequestParam(value = "pageSize",required = true) String pageSize
     )  {
-        return restTemplate.getForObject(KNOWLEAGE_URL+"/knowledge/earlyKnowledge?gzjb="+gzjb+"&bjlx="+bjlx+"&cxnr="+cxnr+"&pageNum="+pageNum+"&pageSize="+pageSize,R.class);
+        return knowledgeApi.earlyKnowledge(gzjb,bjlx,cxnr,pageNum,pageSize);
     }
 
 
@@ -84,7 +80,7 @@ public class KnowleageController {
                                   @RequestParam(value = "pageSize",required = true) String pageSize
     )  {
 
-        return restTemplate.getForObject(KNOWLEAGE_URL+"/knowledge/checkRepairProgramme?model="+model+"&pageNum="+pageNum+"&pageSize="+pageSize,R.class);
+        return knowledgeApi.checkRepairProgramme(model,pageNum,pageSize);
 
     }
 
@@ -99,7 +95,7 @@ public class KnowleageController {
     public R modelList()  {
 
 
-        return restTemplate.getForObject(KNOWLEAGE_URL+"/knowledge/modelList",R.class);
+        return knowledgeApi.modelList();
 
 
     }
@@ -119,7 +115,7 @@ public class KnowleageController {
                               @RequestParam(value = "pageSize",required = true) String pageSize
     )  {
 
-        return restTemplate.getForObject(KNOWLEAGE_URL+"/knowledge/featureParameter?name="+name+"&pageNum="+pageNum+"&pageSize="+pageSize,R.class);
+        return knowledgeApi.featureParameter(name,pageNum,pageSize);
 
     }
 
@@ -138,7 +134,7 @@ public class KnowleageController {
                                   @RequestParam(value = "pageSize",required = true) String pageSize
     )  {
 
-        return restTemplate.getForObject(KNOWLEAGE_URL+"/knowledge/safeMeasureKnowledge?safecontent="+name+"&pageNum="+pageNum+"&pageSize="+pageSize,R.class);
+        return knowledgeApi.safeMeasureKnowledge(name,pageNum,pageSize);
 
 
     }
@@ -159,7 +155,7 @@ public class KnowleageController {
                                 @RequestParam(value = "pageNum",required = true) String pageNum,
                                 @RequestParam(value = "pageSize",required = true) String pageSize
     )  {
-        return restTemplate.getForObject(KNOWLEAGE_URL+"/knowledge/workGuideKnowledge?content="+name+"&pageNum="+pageNum+"&pageSize="+pageSize,R.class);
+        return knowledgeApi.workGuideKnowledge(name,pageNum,pageSize);
     }
 
     /**
@@ -177,16 +173,8 @@ public class KnowleageController {
                            @RequestParam(value = "pageNum",required = true) String pageNum,
                            @RequestParam(value = "pageSize",required = true) String pageSize
     )  {
-        String url = KNOWLEAGE_URL+"/knowledge/workGuideKnowledge/safetyMeasure?&pageNum="+pageNum+"&pageSize="+pageSize;
-
-        if (StringUtils.isNotEmpty(rsnum)){
-            url = url + "&rsnum="+rsnum;
-        }
-        if (StringUtils.isNotEmpty(content)){
-            url = url + "&content="+content;
-        }
 
-        return restTemplate.getForObject(url,R.class);
+        return knowledgeApi.safetyMeasure(rsnum,content,pageNum,pageSize);
 
 
     }
@@ -205,16 +193,9 @@ public class KnowleageController {
                            @RequestParam(value = "pageNum",required = true) String pageNum,
                            @RequestParam(value = "pageSize",required = true) String pageSize
     )  {
-        String url = KNOWLEAGE_URL+"/knowledge/workGuideKnowledge/dangerContent?&pageNum="+pageNum+"&pageSize="+pageSize;
 
-        if (StringUtils.isNotEmpty(rsnum)){
-            url = url + "&rsnum="+rsnum;
-        }
-        if (StringUtils.isNotEmpty(content)){
-            url = url + "&content="+content;
-        }
 
-        return restTemplate.getForObject(url,R.class);
+        return knowledgeApi.dangerContent(rsnum,content,pageNum,pageSize);
 
 
     }

+ 19 - 21
web/consumer/src/main/java/com/gyee/consumer/controller/specific/SpecificController.java

@@ -5,9 +5,10 @@ import com.gyee.common.model.StringUtils;
 import com.gyee.common.vo.specific.SpecificCenterVo;
 import com.gyee.common.vo.specific.SpecificTargetVo;
 import com.gyee.common.vo.specific.SpecificTopVo;
+import com.gyee.consumer.api.specific.SpecificApi;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.client.RestTemplate;
+
 
 import javax.annotation.Resource;
 import java.text.ParseException;
@@ -22,19 +23,16 @@ import java.util.Map;
  */
 @RestController
 public class SpecificController {
-    @Value("${url.benchmaring}")
-    private String  BENCHMARKING_URL;
-
     @Resource
-    private RestTemplate restTemplate;
+    private SpecificApi specificApi;
 
     /**
      * 查询专题分析列表上
      * @return
      */
     @GetMapping(value = "/consumer/specific/maintoplist")
-    public R maintoplist(@RequestParam(value = "month",required = true) String month) {
-        return restTemplate.getForObject(BENCHMARKING_URL+"/specific/maintoplist?month="+month,R.class);
+    public R maintoplist(@RequestParam(value = "month",required = true) String month) throws ParseException {
+        return specificApi.maintoplist(month);
     }
 
     /**
@@ -43,7 +41,7 @@ public class SpecificController {
      */
     @GetMapping("/consumer/specific/maincenterlist")
     public R maincenterlist(@RequestParam(value = "month",required = true) String month) throws ParseException {
-        return restTemplate.getForObject(BENCHMARKING_URL+"/specific/maincenterlist?month="+month,R.class);
+        return specificApi.maincenterlist(month);
 
     }
 
@@ -53,7 +51,7 @@ public class SpecificController {
      */
     @GetMapping("/consumer/specific/fnlylList")
     public R fnlylList(@RequestParam(value = "year",required = true) String year) throws ParseException {
-        return restTemplate.getForObject(BENCHMARKING_URL+"/specific/fnlylList?year="+year,R.class);
+        return specificApi.fnlylList(year);
     }
 
     /**
@@ -62,7 +60,7 @@ public class SpecificController {
      */
     @GetMapping("/consumer/specific/fdlList")
     public R fdlList(@RequestParam(value = "year",required = true) String year) throws ParseException {
-        return restTemplate.getForObject(BENCHMARKING_URL+"/specific/fdlList?year="+year,R.class);
+        return specificApi.fdlList(year);
     }
 
     /**
@@ -71,7 +69,7 @@ public class SpecificController {
      */
     @GetMapping("/consumer/specific/zhcydlList")
     public R zhcydlList(@RequestParam(value = "year",required = true) String year) throws ParseException {
-        return restTemplate.getForObject(BENCHMARKING_URL+"/specific/zhcydlList?year="+year,R.class);
+        return specificApi.zhcydlList(year);
     }
 
     /**
@@ -80,7 +78,7 @@ public class SpecificController {
      */
     @GetMapping("/consumer/specific/whsslList")
     public R whsslList(@RequestParam(value = "year",required = true) String year) throws ParseException {
-        return restTemplate.getForObject(BENCHMARKING_URL+"/specific/whsslList?year="+year,R.class);
+        return specificApi.whsslList(year);
     }
 
     /**
@@ -89,7 +87,7 @@ public class SpecificController {
      */
     @GetMapping("/consumer/specific/gzsslList")
     public R gzsslList(@RequestParam(value = "year",required = true) String year) throws ParseException {
-        return restTemplate.getForObject(BENCHMARKING_URL+"/specific/gzsslList?year="+year,R.class);
+        return specificApi.gzsslList(year);
     }
 
     /**
@@ -98,7 +96,7 @@ public class SpecificController {
      */
     @GetMapping("/consumer/specific/xdsslList")
     public R xdsslList(@RequestParam(value = "year",required = true) String year) throws ParseException {
-        return restTemplate.getForObject(BENCHMARKING_URL+"/specific/xdsslList?year="+year,R.class);
+        return specificApi.xdsslList(year);
     }
 
     /**
@@ -107,7 +105,7 @@ public class SpecificController {
      */
     @GetMapping("/consumer/specific/xnsslList")
     public R xnsslList(@RequestParam(value = "year",required = true) String year) throws ParseException {
-        return restTemplate.getForObject(BENCHMARKING_URL+"/specific/xnsslList?year="+year,R.class);
+        return specificApi.xnsslList(year);
     }
 
     /**
@@ -116,7 +114,7 @@ public class SpecificController {
      */
     @GetMapping("/consumer/specific/slsslList")
     public R slsslList(@RequestParam(value = "year",required = true) String year) throws ParseException {
-        return restTemplate.getForObject(BENCHMARKING_URL+"/specific/slsslList?year="+year,R.class);
+        return specificApi.slsslList(year);
     }
 
     /**
@@ -125,7 +123,7 @@ public class SpecificController {
      */
     @GetMapping("/consumer/specific/mtbfList")
     public R mtbfList(@RequestParam(value = "year",required = true) String year) throws ParseException {
-        return restTemplate.getForObject(BENCHMARKING_URL+"/specific/mtbfList?year="+year,R.class);
+        return specificApi.mtbfList(year);
     }
 
     /**
@@ -134,7 +132,7 @@ public class SpecificController {
      */
     @GetMapping("/consumer/specific/mttrList")
     public R mttrList(@RequestParam(value = "year",required = true) String year) throws ParseException {
-        return restTemplate.getForObject(BENCHMARKING_URL+"/specific/mttrList?year="+year,R.class);
+        return specificApi.mttrList(year);
     }
 
     /**
@@ -143,7 +141,7 @@ public class SpecificController {
      */
     @GetMapping("/consumer/specific/fwjslList")
     public R fwjslList(@RequestParam(value = "year",required = true) String year) throws ParseException {
-        return restTemplate.getForObject(BENCHMARKING_URL+"/specific/fwjslList?year="+year,R.class);
+        return specificApi.fwjslList(year);
     }
 
     /**
@@ -152,7 +150,7 @@ public class SpecificController {
      */
     @GetMapping("/consumer/specific/ztzhlList")
     public R ztzhlList(@RequestParam(value = "year",required = true) String year) throws ParseException {
-        return restTemplate.getForObject(BENCHMARKING_URL+"/specific/ztzhlList?year="+year,R.class);
+        return specificApi.ztzhlList(year);
 
     }
 
@@ -163,7 +161,7 @@ public class SpecificController {
     @GetMapping("/consumer/specific/xqjslList")
     public R xqjslList(@RequestParam(value = "year",required = true) String year) throws ParseException {
 
-        return restTemplate.getForObject(BENCHMARKING_URL+"/specific/xqjslList?year="+year,R.class);
+        return specificApi.xqjslList(year);
     }
 
 }

+ 5 - 7
web/consumer/src/main/java/com/gyee/consumer/controller/targetdata/TargetdataController.java

@@ -1,6 +1,7 @@
 package com.gyee.consumer.controller.targetdata;
 
 import com.gyee.common.config.R;
+import com.gyee.consumer.api.targetdata.TargetdataApi;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -8,6 +9,7 @@ import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.client.RestTemplate;
 
 import javax.annotation.Resource;
+import java.text.ParseException;
 
 /**
  * @ClassName : TargetdataController
@@ -17,19 +19,15 @@ import javax.annotation.Resource;
  */
 @RestController
 public class TargetdataController {
-
-    @Value("${url.benchmaring}")
-    private String  BENCHMARKING_URL;
-
     @Resource
-    private RestTemplate restTemplate;
+    private TargetdataApi targetdataApi;
 
     /**
      * 节能减排kpi
      * @return
      */
     @GetMapping(value = "/consumer/targetdata/jnjpkpi")
-    public R maintoplist(@RequestParam(value = "month",required = true) String month) {
-        return restTemplate.getForObject(BENCHMARKING_URL+"/targetdata/jnjpkpi?month="+month,R.class);
+    public R jnjpkpi(@RequestParam(value = "month",required = true) String month) throws ParseException {
+        return targetdataApi.jnjpkpi(month);
     }
 }

+ 5 - 8
web/consumer/src/main/java/com/gyee/consumer/controller/threerate/ThreerateController.java

@@ -1,11 +1,11 @@
 package com.gyee.consumer.controller.threerate;
 
 import com.gyee.common.config.R;
+import com.gyee.consumer.api.threerate.ThreeRateApi;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.client.RestTemplate;
 
 import javax.annotation.Resource;
 
@@ -17,11 +17,8 @@ import javax.annotation.Resource;
  */
 @RestController
 public class ThreerateController {
-    @Value("${url.benchmaring}")
-    private String  BENCHMARKING_URL;
-
     @Resource
-    private RestTemplate restTemplate;
+    private ThreeRateApi threeRateApi;
 
     /**
      * 复位及时率
@@ -30,7 +27,7 @@ public class ThreerateController {
     @GetMapping(value = "/consumer/threerate/fwjsl")
     public R fwjsl(@RequestParam(value = "beginDate",required = true) String beginDate,
                    @RequestParam(value = "endDate",required = true) String endDate){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/threerate/fwjsl?beginDate="+beginDate+"&endDate="+endDate,R.class);
+        return threeRateApi.fwjsl(beginDate,endDate);
     }
 
     /**
@@ -40,7 +37,7 @@ public class ThreerateController {
     @GetMapping(value = "/consumer/threerate/ztzhl")
     public R ztzhl(@RequestParam(value = "beginDate",required = true) String beginDate,
                       @RequestParam(value = "endDate",required = true) String endDate){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/threerate/ztzhl?beginDate="+beginDate+"&endDate="+endDate,R.class);
+        return threeRateApi.ztzhl(beginDate,endDate);
     }
 
     /**
@@ -51,7 +48,7 @@ public class ThreerateController {
     @GetMapping(value = "/consumer/threerate/xqjsl")
     public R xqjsl(@RequestParam(value = "beginDate",required = true) String beginDate,
                          @RequestParam(value = "endDate",required = true) String endDate){
-        return restTemplate.getForObject(BENCHMARKING_URL+"/threerate/xqjsl?beginDate="+beginDate+"&endDate="+endDate,R.class);
+        return threeRateApi.xqjsl(beginDate,endDate);
     }
 
 }

+ 2 - 2
web/consumer/src/main/resources/application.yml

@@ -1,4 +1,4 @@
 spring:
   profiles:
-    active: dev
-#    active: test
+#    active: dev
+    active: test

+ 5 - 0
web/knowledge-hb/pom.xml

@@ -34,6 +34,11 @@
             <artifactId>common</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <!--nacos 依赖-->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

+ 2 - 0
web/knowledge-hb/src/main/java/com/gyee/knowledge/KnowledgeMain.java

@@ -4,9 +4,11 @@ package com.gyee.knowledge;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
 
 @SpringBootApplication
 @MapperScan("com.gyee.knowledge.mapper")
+@EnableDiscoveryClient
 public class KnowledgeMain {
     public static void main(String[] args) {
         SpringApplication.run(KnowledgeMain.class,args);

+ 11 - 0
web/knowledge-hb/src/main/resources/application-dev.yml

@@ -5,8 +5,19 @@ server:
 
 
 spring:
+  application:
+    name: knowledge-provider
   main:
     allow-bean-definition-overriding: true #当遇到同样名字的时候,是否允许覆盖注册
+  cloud:
+    nacos:
+      discovery:
+        server-addr: 192.168.2.216:8848
+        #指定yaml格式的配置
+        file-extension: yaml
+        cluster-name: master
+      username: nacos
+      password: nacos
   #redis集群
   redis:
 #    host: 10.83.68.94

+ 11 - 0
web/knowledge-hb/src/main/resources/application-test.yml

@@ -5,8 +5,19 @@ server:
 
 
 spring:
+  application:
+    name: knowledge-provider
   main:
     allow-bean-definition-overriding: true #当遇到同样名字的时候,是否允许覆盖注册
+  cloud:
+    nacos:
+      discovery:
+        server-addr: 10.83.68.97:8848
+        #指定yaml格式的配置
+        file-extension: yaml
+        cluster-name: master
+      username: nacos
+      password: nacos
   #redis集群
   redis:
     host: 10.83.68.94