Explorar o código

新增报警首页查询:今日报警、设备故障率、三级警报

zhuoning %!s(int64=3) %!d(string=hai) anos
pai
achega
d5cd4061bb

+ 84 - 1
huimv-farm-produce/pom.xml

@@ -12,12 +12,95 @@
     <artifactId>huimv-farm-produce</artifactId>
 
     <dependencies>
+<!--        <dependency>-->
+<!--            <groupId>org.springframework.boot</groupId>-->
+<!--            <artifactId>spring-boot-starter-web</artifactId>-->
+<!--        </dependency>-->
+<!--        <dependency>-->
+<!--            <groupId>org.springframework.boot</groupId>-->
+<!--            <artifactId>spring-boot-starter-test</artifactId>-->
+<!--            <scope>test</scope>-->
+<!--        </dependency>-->
+        <dependency>
+            <groupId>cn.dustlight.captcha</groupId>
+            <artifactId>redis-store</artifactId>
+            <version>0.0.6</version>
+        </dependency>
+        <dependency>
+            <groupId>cn.dustlight.captcha</groupId>
+            <artifactId>captcha-core</artifactId>
+            <version>0.0.6</version>
+        </dependency>
+        <dependency>
+            <groupId>com.auth0</groupId>
+            <artifactId>java-jwt</artifactId>
+            <version>3.3.0</version>
+        </dependency>
+        <dependency>
+            <groupId>io.jsonwebtoken</groupId>
+            <artifactId>jjwt</artifactId>
+            <version>0.9.1</version>
+        </dependency>
+<!--        &lt;!&ndash;CloseableHttpClient&ndash;&gt;-->
+<!--        <dependency>-->
+<!--            <groupId>org.apache.httpcomponents</groupId>-->
+<!--            <artifactId>httpclient</artifactId>-->
+<!--            <version>4.5.2</version>-->
+<!--        </dependency>-->
+<!--        <dependency>-->
+<!--            <groupId>cn.hutool</groupId>-->
+<!--            <artifactId>hutool-all</artifactId>-->
+<!--            <version>5.7.11</version>-->
+<!--        </dependency>-->
+
+<!--        <dependency>-->
+<!--            <groupId>org.freemarker</groupId>-->
+<!--            <artifactId>freemarker</artifactId>-->
+<!--            <version>2.3.28</version>-->
+<!--        </dependency>-->
+
+<!--        <dependency>-->
+<!--            <groupId>com.baomidou</groupId>-->
+<!--            <artifactId>mybatis-plus-boot-starter</artifactId>-->
+<!--            <version>3.4.2</version>-->
+<!--        </dependency>-->
+<!--        <dependency>-->
+<!--            <groupId>com.baomidou</groupId>-->
+<!--            <artifactId>mybatis-plus-extension</artifactId>-->
+<!--            <version>3.4.2</version>-->
+<!--        </dependency>-->
+<!--        <dependency>-->
+<!--            <groupId>com.baomidou</groupId>-->
+<!--            <artifactId>mybatis-plus-generator</artifactId>-->
+<!--            <version>3.2.0</version>-->
+<!--        </dependency>-->
+<!--        <dependency>-->
+<!--            <groupId>org.projectlombok</groupId>-->
+<!--            <artifactId>lombok</artifactId>-->
+<!--            <optional>true</optional>-->
+<!--        </dependency>-->
         <!-- JPA -->
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-data-jpa</artifactId>
         </dependency>
-
+        <!-- MySQL -->
+<!--        <dependency>-->
+<!--            <groupId>mysql</groupId>-->
+<!--            <artifactId>mysql-connector-java</artifactId>-->
+<!--            <scope>runtime</scope>-->
+<!--        </dependency>-->
+<!--        <dependency>-->
+<!--            <groupId>javax.xml.bind</groupId>-->
+<!--            <artifactId>jaxb-api</artifactId>-->
+<!--            <version>2.3.0</version>-->
+<!--        </dependency>-->
+        <!-- fastjson -->
+<!--        <dependency>-->
+<!--            <groupId>com.alibaba</groupId>-->
+<!--            <artifactId>fastjson</artifactId>-->
+<!--            <version>1.2.28</version>-->
+<!--        </dependency>-->
 
     </dependencies>
 

+ 32 - 0
huimv-farm-produce/src/main/java/com/huimv/produce/warning/controller/AlarmController.java

@@ -0,0 +1,32 @@
+package com.huimv.produce.warning.controller;
+
+import com.huimv.common.utils.Result;
+import com.huimv.produce.warning.service.IAlarmService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.biosafety.uface.controller
+ * @Description : TODO
+ * @Version : 1.0
+ * @Author : ZhuoNing
+ * @Create : 2020-12-25
+ **/
+@RestController
+@Slf4j
+@RequestMapping(value = "/warning")
+public class AlarmController {
+    @Autowired
+    private IAlarmService iAlarmService;
+
+    @RequestMapping(value = "/getMainPageWarning",method = RequestMethod.GET)
+    public Result getMainPage(){
+        //读取首页告警
+        return iAlarmService.getMainPageAlarm();
+    }
+
+}

+ 16 - 0
huimv-farm-produce/src/main/java/com/huimv/produce/warning/service/IAlarmService.java

@@ -0,0 +1,16 @@
+package com.huimv.produce.warning.service;
+
+import com.huimv.common.utils.Result;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.biosafety.uface.controller
+ * @Description : TODO
+ * @Version : 1.0
+ * @Author : ZhuoNing
+ * @Create : 2020-12-25
+ **/
+public interface IAlarmService {
+    //获取首页报警信息
+    Result getMainPageAlarm();
+}

+ 33 - 0
huimv-farm-produce/src/main/java/com/huimv/produce/warning/service/impl/AlarmServiceImpl.java

@@ -0,0 +1,33 @@
+package com.huimv.produce.warning.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.huimv.common.utils.Result;
+import com.huimv.common.utils.ResultCode;
+import com.huimv.produce.warning.service.IAlarmService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.biosafety.uface.controller
+ * @Description : TODO
+ * @Version : 1.0
+ * @Author : ZhuoNing
+ * @Create : 2020-12-25
+ **/
+@Service
+public class AlarmServiceImpl implements IAlarmService {
+
+    @Override
+    public Result getMainPageAlarm(){
+        //今日报警
+        //设备故障率
+        //今日提醒(周界)
+        //三级报警数量
+        JSONObject outJo = new JSONObject();
+        outJo.put("todayAlarm","9次");
+        outJo.put("failureRate","16%");
+        outJo.put("personAlarm","27次");
+        outJo.put("warningQuantity","7次");
+        return new Result(ResultCode.SUCCESS,outJo);
+    }
+}

+ 5 - 1
huimv-farm-produce/src/main/resources/application-dev.yml

@@ -14,9 +14,13 @@ spring:
     hibernate:
       ddl-auto: update
     database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+  redis:
+    host: 122.112.224.199
+    port: 6379
+    password: hm123456
 
 # Socket配置
-socket:
+#socket:
   # 监听端口 9001
 #  listen:
 #    #ip: 192.168.16.3

+ 2 - 2
huimv-farm-produce/src/main/resources/application.properties

@@ -1,5 +1,5 @@
-#spring.profiles.active=dev
-spring.profiles.active=prod
+spring.profiles.active=dev
+#spring.profiles.active=prod
 
 #ʱ¼ä¸ñʽÅäÖÃ
 spring.jackson.date-format=yyyy-MM-dd HH:mm:ss