zhuoning 2 лет назад
Родитель
Сommit
3431e41c6c

+ 106 - 0
huimv-eartag2-admin/src/main/resources/application-lishui-local.yml

@@ -0,0 +1,106 @@
+server:
+  port: 8091
+spring:
+  application:
+    name: huimv-eartag2-admin
+
+  datasource:
+    url: jdbc:mysql://192.168.1.7:3306/huimv-lishui?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    username: root
+    password: hm123456
+    driver-class-name: com.mysql.cj.jdbc.Driver
+  jpa:
+    show-sql: true
+    database: mysql
+    hibernate:
+      ddl-auto: update
+    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+    open-in-view: true
+
+  #配置rabbitMq 服务器
+#  rabbitmq:
+#    host: 10.0.0.4
+#    port: 5672
+#    username: huimv
+#    password: hm123456
+#    #虚拟host 可以不设置,使用server默认host
+#    virtual-host: /
+  rabbitmq:
+    host: 121.36.134.218
+    port: 5672
+    username: admin
+    password: admin
+    #虚拟host 可以不设置,使用server默认host
+    virtual-host: /
+    listener:
+      simple:
+        acknowledge-mode: none
+
+  #redis
+  redis:
+    database: 0
+    host: 121.36.134.218
+    port: 6379
+    password: hm123456
+    timeout: 5000ms
+    jedis:
+      pool:
+        max-active: 20
+        max-wait: -1
+        max-idle: 10
+        min-idle: 0
+
+  #redis
+#  redis:
+#    database: 0
+#    host: 192.168.1.68
+#    port: 6379
+#    password: hm123456
+#    timeout: 5000ms
+#    jedis:
+#      pool:
+#        max-active: 20
+#        max-wait: -1
+#        max-idle: 10
+#        min-idle: 0
+#    lettuce:
+#      pool:
+#        max-active: 3
+#        min-idle: 2
+#        max-idle: 3
+#        max-wait: 1
+#      shutdown-timeout: 100
+
+#  data:
+#    redis:
+#      repositories:
+#        enabled: false
+
+  #是否缓存空值
+#  cache:
+#    redis:
+#      cache-null-values: false
+    #server:
+#  port: 9110
+#spring:
+#  application:
+#    name: huimv-hy-autoGetData
+#
+#  datasource:
+##    url: jdbc:mysql://47.98.175.112:3306/huimv_ql_farm_haiyan?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+#    #    url: jdbc:mysql://36.22.189.214:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+#        url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+#    username: root
+#    password: hm123456
+#    driver-class-name: com.mysql.cj.jdbc.Driver
+#  jpa:
+#    properties:
+#      hibernate:
+#        enable_lazy_load_no_trans: true
+#    show-sql: true
+#    database: mysql
+#    hibernate:
+#      ddl-auto: update
+#    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+#    open-in-view: true
+

+ 2 - 2
huimv-eartag2-admin/src/main/resources/application-lishui.yml

@@ -1,11 +1,11 @@
 server:
 server:
-  port: 8091
+  port: 10050
 spring:
 spring:
   application:
   application:
     name: huimv-eartag2-admin
     name: huimv-eartag2-admin
 
 
   datasource:
   datasource:
-    url: jdbc:mysql://192.168.1.7:3306/huimv-lishui?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://122.112.224.199:3306/huimv-lishui?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
     username: root
     username: root
     password: hm123456
     password: hm123456
     driver-class-name: com.mysql.cj.jdbc.Driver
     driver-class-name: com.mysql.cj.jdbc.Driver

+ 2 - 2
huimv-eartag2-admin/src/main/resources/application.properties

@@ -1,5 +1,5 @@
-spring.profiles.active=dev
-#spring.profiles.active=lishui
+#spring.profiles.active=dev
+spring.profiles.active=lishui
 
 
 device.register.prefix=device_register_
 device.register.prefix=device_register_
 redis.expire.eartag_online_set=25
 redis.expire.eartag_online_set=25

+ 5 - 0
huimv-farm-environ/src/main/java/com/huimv/environ/eco/controller/EcoDeviceFlowController.java

@@ -48,5 +48,10 @@ public class EcoDeviceFlowController {
     public Result listDayDetails( HttpServletRequest request,@RequestBody Map<String, String> paramsMap) throws ParseException {
     public Result listDayDetails( HttpServletRequest request,@RequestBody Map<String, String> paramsMap) throws ParseException {
         return ecoDeviceFlowService.listDayDetails(request, paramsMap);
         return ecoDeviceFlowService.listDayDetails(request, paramsMap);
     }
     }
+
+//    @PostMapping("/getFlowList")
+//    public Result getFlowList(@RequestBody Map<String, String> paramsMap){
+//        return ecoDeviceFlowService.getFlowList(paramsMap);
+//    }
 }
 }
 
 

+ 1 - 0
huimv-farm-environ/src/main/java/com/huimv/environ/eco/entity/dto/LastFlowDto.java

@@ -7,4 +7,5 @@ public class LastFlowDto {
     private String tem;
     private String tem;
     private String hum;
     private String hum;
     private String room;
     private String room;
+    private String unitId;
 }
 }

+ 4 - 0
huimv-farm-environ/src/main/java/com/huimv/environ/eco/mapper/EcoDeviceFlowMapper.java

@@ -26,6 +26,8 @@ public interface EcoDeviceFlowMapper extends BaseMapper<EcoDeviceFlow> {
 
 
     List<LastFlowDto> getLastFlow(@Param("farmId") String farmId);
     List<LastFlowDto> getLastFlow(@Param("farmId") String farmId);
 
 
+    List<LastFlowDto>  getLastFlowByPigpenId(@Param("pigpenId") String pigpenId,@Param("farmId") String farmId);
+
     List<EcoDeviceDto> listDevice(@Param("farmId") String farmId,
     List<EcoDeviceDto> listDevice(@Param("farmId") String farmId,
                                   @Param("unitId") String unitId,
                                   @Param("unitId") String unitId,
                                   @Param("startDate") String startDate,
                                   @Param("startDate") String startDate,
@@ -42,4 +44,6 @@ public interface EcoDeviceFlowMapper extends BaseMapper<EcoDeviceFlow> {
                                      @Param("unitId") String unitId);
                                      @Param("unitId") String unitId);
 
 
     LastFlowDto getLastFlowByUnitId(@Param("unitId") String unitId);
     LastFlowDto getLastFlowByUnitId(@Param("unitId") String unitId);
+
+
 }
 }

+ 2 - 0
huimv-farm-environ/src/main/java/com/huimv/environ/eco/service/EcoDeviceFlowService.java

@@ -29,4 +29,6 @@ public interface EcoDeviceFlowService extends IService<EcoDeviceFlow> {
     Result listDayDetails(HttpServletRequest request, Map<String, String> paramsMap) throws ParseException;
     Result listDayDetails(HttpServletRequest request, Map<String, String> paramsMap) throws ParseException;
 
 
     Result getLastFlowByUnitId(Map<String, String> paramsMap);
     Result getLastFlowByUnitId(Map<String, String> paramsMap);
+
+//    Result getFlowList(Map<String, String> paramsMap);
 }
 }

+ 19 - 1
huimv-farm-environ/src/main/java/com/huimv/environ/eco/service/impl/EcoDeviceFlowServiceImpl.java

@@ -53,9 +53,21 @@ public class EcoDeviceFlowServiceImpl extends ServiceImpl<EcoDeviceFlowMapper, E
     @Override
     @Override
     public Result getLastFlow(Map<String, String> paramsMap) {
     public Result getLastFlow(Map<String, String> paramsMap) {
         String farmId = paramsMap.get("farmId");
         String farmId = paramsMap.get("farmId");
-        return new Result(ResultCode.SUCCESS, ecoDeviceFlowMapper.getLastFlow(farmId));
+        //栋舍id
+        String pigpenId = paramsMap.get("pigpenId");
+        if(StringUtils.isNotBlank(pigpenId)){
+            //查询栋舍下单元
+            return new Result(ResultCode.SUCCESS, ecoDeviceFlowMapper.getLastFlowByPigpenId(pigpenId,farmId));
+        }else{
+            return new Result(ResultCode.SUCCESS, ecoDeviceFlowMapper.getLastFlow(farmId));
+        }
     }
     }
 
 
+//    public Result getLastFlow(Map<String, String> paramsMap) {
+//        String farmId = paramsMap.get("farmId");
+//        return new Result(ResultCode.SUCCESS, ecoDeviceFlowMapper.getLastFlow(farmId));
+//    }
+
     @Override
     @Override
     public void save(JSONObject dataJo, Date todayTime) throws ParseException {
     public void save(JSONObject dataJo, Date todayTime) throws ParseException {
         DateUtil dateUtil = new DateUtil();
         DateUtil dateUtil = new DateUtil();
@@ -179,6 +191,12 @@ public class EcoDeviceFlowServiceImpl extends ServiceImpl<EcoDeviceFlowMapper, E
         return new Result(ResultCode.SUCCESS,lastFlowByUnitId);
         return new Result(ResultCode.SUCCESS,lastFlowByUnitId);
     }
     }
 
 
+//    @Override
+//    public Result getFlowList(Map<String, String> paramsMap) {
+//        String pigpenId = paramsMap.get("pigpenId");
+//        return null;
+//    }
+
     //获取阈值
     //获取阈值
     private JSONObject getThresholdURL(Integer farmId) {
     private JSONObject getThresholdURL(Integer farmId) {
         HttpHeaders httpHeaders = new HttpHeaders();
         HttpHeaders httpHeaders = new HttpHeaders();

+ 47 - 0
huimv-farm-environ/src/main/resources/application-lishui-local.yml

@@ -0,0 +1,47 @@
+server:
+  port: 8092
+
+spring:
+  application:
+    name: huimv-farm-environ
+  datasource:
+    #本地测试数据库
+    url: jdbc:mysql://192.168.1.7/huimv-lishui?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    username: root
+    password: hm123456
+    driver-class-name: com.mysql.cj.jdbc.Driver
+  jpa:
+    hibernate:
+      ddl-auto: none
+    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+    show-sql: true
+
+  #redis
+  redis:
+    database: 2
+    host: 122.112.224.199
+#    host: 121.36.134.218
+    port: 6379
+    password: hm123456
+    timeout: 5000ms
+    jedis:
+      pool:
+        max-active: 20
+        max-wait: -1
+        max-idle: 10
+        min-idle: 0
+    lettuce:
+      pool:
+        max-active: 3
+        min-idle: 2
+        max-idle: 3
+        max-wait: 1
+      shutdown-timeout: 100
+
+mybatis-plus:
+  configuration:
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    map-underscore-to-camel-case: true   # 关闭驼峰式编码
+  # mapper.xml文件所存放的位置
+#  mapper-locations: classpath*:com/huimv/saas/breed/mapper/xml/*.xml  # 不加这一行出错:“org.apache.ibatis.binding.BindingException:  Invalid bound statement (not found)”
+#  mapper-locations: classpath:com/huimv/center/mappers/**/*Mapper.xml

+ 2 - 2
huimv-farm-environ/src/main/resources/application-lishui.yml

@@ -1,12 +1,12 @@
 server:
 server:
-  port: 8092
+  port: 10051
 
 
 spring:
 spring:
   application:
   application:
     name: huimv-farm-environ
     name: huimv-farm-environ
   datasource:
   datasource:
     #本地测试数据库
     #本地测试数据库
-    url: jdbc:mysql://192.168.1.7/huimv-lishui?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://122.112.224.199:3306/huimv-lishui?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
     username: root
     username: root
     password: hm123456
     password: hm123456
     driver-class-name: com.mysql.cj.jdbc.Driver
     driver-class-name: com.mysql.cj.jdbc.Driver

+ 22 - 2
huimv-farm-environ/src/main/resources/com/huimv/environ/eco/mapper/EcoDeviceFlowMapper.xml

@@ -25,8 +25,17 @@
     </sql>
     </sql>
 
 
 
 
+<!--    <select id="getLastFlow" resultType="com.huimv.environ.eco.entity.dto.LastFlowDto">-->
+<!--       SELECT CONCAT(b.pigpen_name,a.pigpen_name) room,df.id1_value 'tem',df.id2_value 'hum'-->
+<!--        FROM `base_pigpen` a INNER JOIN `base_pigpen` b ON a.parent_id =b.id AND a.farm_code = #{farmId}-->
+<!--        LEFT JOIN `eco_device` d ON d.unit_id = a.id AND d.device_type ='1'-->
+<!--        LEFT JOIN `eco_device_flow` df ON d.device_code = df.device_code-->
+<!--        AND df.id IN (SELECT MAX(df.id) FROM `eco_device_flow` df GROUP BY device_code)-->
+<!--        ORDER BY a.id DESC,a.parent_id DESC-->
+<!--    </select>-->
+
     <select id="getLastFlow" resultType="com.huimv.environ.eco.entity.dto.LastFlowDto">
     <select id="getLastFlow" resultType="com.huimv.environ.eco.entity.dto.LastFlowDto">
-       SELECT CONCAT(b.pigpen_name,a.pigpen_name) room,df.id1_value 'tem',df.id2_value 'hum'
+       SELECT CONCAT(b.pigpen_name,a.pigpen_name) room,a.id unit_id,df.id1_value 'tem',df.id2_value 'hum'
         FROM `base_pigpen` a INNER JOIN `base_pigpen` b ON a.parent_id =b.id AND a.farm_code = #{farmId}
         FROM `base_pigpen` a INNER JOIN `base_pigpen` b ON a.parent_id =b.id AND a.farm_code = #{farmId}
         LEFT JOIN `eco_device` d ON d.unit_id = a.id AND d.device_type ='1'
         LEFT JOIN `eco_device` d ON d.unit_id = a.id AND d.device_type ='1'
         LEFT JOIN `eco_device_flow` df ON d.device_code = df.device_code
         LEFT JOIN `eco_device_flow` df ON d.device_code = df.device_code
@@ -34,6 +43,16 @@
         ORDER BY a.id DESC,a.parent_id DESC
         ORDER BY a.id DESC,a.parent_id DESC
     </select>
     </select>
 
 
+    <select id="getLastFlowByPigpenId" resultType="com.huimv.environ.eco.entity.dto.LastFlowDto">
+     SELECT CONCAT(b.pigpen_name,a.pigpen_name) room,a.id unit_id,df.id1_value 'tem',df.id2_value 'hum'
+    FROM `base_pigpen` a INNER JOIN `base_pigpen` b ON a.parent_id =b.id AND a.farm_code = #{farmId}
+    LEFT JOIN `eco_device` d ON d.unit_id = a.id AND d.device_type ='1'
+    LEFT JOIN `eco_device_flow` df ON d.device_code = df.device_code
+    AND df.id IN (SELECT MAX(df.id) FROM `eco_device_flow` df GROUP BY device_code)
+    WHERE a.parent_id=#{pigpenId}
+    ORDER BY a.id DESC,a.parent_id DESC
+    </select>
+
     <select id="listDevice" resultType="com.huimv.environ.eco.entity.dto.EcoDeviceDto">
     <select id="listDevice" resultType="com.huimv.environ.eco.entity.dto.EcoDeviceDto">
        SELECT d.location 'roomName',ROUND(AVG(df.id1_value),2) 'tem',ROUND(AVG(df.id2_value),2) 'hum',DATE_FORMAT(df.add_time,'%Y-%m-%d') 'addTime' FROM `eco_device` d
        SELECT d.location 'roomName',ROUND(AVG(df.id1_value),2) 'tem',ROUND(AVG(df.id2_value),2) 'hum',DATE_FORMAT(df.add_time,'%Y-%m-%d') 'addTime' FROM `eco_device` d
 LEFT JOIN `eco_device_flow` df ON df.device_code = d.device_code
 LEFT JOIN `eco_device_flow` df ON df.device_code = d.device_code
@@ -72,4 +91,5 @@ AND df.id IN (SELECT MAX(df.id) FROM `eco_device_flow` df GROUP BY device_code)
 AND d.device_type = 1
 AND d.device_type = 1
 WHERE d.unit_id = #{unitId}
 WHERE d.unit_id = #{unitId}
     </select>
     </select>
-</mapper>
+
+</mapper>

+ 4 - 17
huimv-farm-gateway/src/main/resources/application-lishui.yml

@@ -9,42 +9,29 @@ spring:
       enabled: true
       enabled: true
       routes:
       routes:
         - id: admin
         - id: admin
-          uri: http://127.0.0.1:8091
+          uri: http://127.0.0.1:10050
           predicates:
           predicates:
             - Path=/admin/**
             - Path=/admin/**
           filters:
           filters:
             - StripPrefix=1
             - StripPrefix=1
         - id: video
         - id: video
-          uri: http://127.0.0.1:8096
+          uri: http://127.0.0.1:10053
           predicates:
           predicates:
             - Path=/video/**
             - Path=/video/**
           filters:
           filters:
             - StripPrefix=1
             - StripPrefix=1
         - id: produce
         - id: produce
-          uri: http://127.0.0.1:8094
+          uri: http://127.0.0.1:10052
           predicates:
           predicates:
             - Path=/produce/**
             - Path=/produce/**
           filters:
           filters:
             - StripPrefix=1
             - StripPrefix=1
         - id: env
         - id: env
-          uri: http://127.0.0.1:8092
+          uri: http://127.0.0.1:10051
           predicates:
           predicates:
             - Path=/env/**
             - Path=/env/**
           filters:
           filters:
             - StripPrefix=1
             - StripPrefix=1
-        - id: receiver
-          uri: http://127.0.0.1:8098
-          predicates:
-            - Path=/receiver/**
-          filters:
-            - StripPrefix=1
-        - id: eartag
-          uri: http://127.0.0.1:8099
-          predicates:
-            - Path=/eartag/**
-          filters:
-            - StripPrefix=1
-
 
 
 logging:
 logging:
   level:
   level:

+ 34 - 0
huimv-farm-produce/src/main/resources/application-lishui-local.yml

@@ -0,0 +1,34 @@
+server:
+  port: 8094
+spring:
+  application:
+    name: huimv-farm-produce
+  #------DataSource-----
+  datasource:
+    url: jdbc:mysql://192.168.1.7:3306/huimv-lishui?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    username: root
+    password: hm123456
+    driver-class-name: com.mysql.cj.jdbc.Driver
+  jpa:
+    hibernate:
+      ddl-auto: update
+    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+  redis:
+    host: 122.112.224.199
+    port: 6379
+    password: hm123456
+# Socket配置
+#socket:
+  # 监听端口 9001
+#  listen:
+#    #ip: 192.168.16.3
+#    ip: 192.168.1.49
+#    port: 10020
+  # 线程池 - 保持线程数 20
+  #pool-keep: 20
+  # 线程池 - 核心线程数 10
+  #pool-core: 10
+  # 线程池 - 最大线程数 20
+  #pool-max: 30
+  # 线程队列容量 10
+  #pool-queue-init: 10

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

@@ -1,11 +1,11 @@
 server:
 server:
-  port: 8094
+  port: 10052
 spring:
 spring:
   application:
   application:
     name: huimv-farm-produce
     name: huimv-farm-produce
   #------DataSource-----
   #------DataSource-----
   datasource:
   datasource:
-    url: jdbc:mysql://192.168.1.7:3306/huimv-lishui?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://122.112.224.199:3306/huimv-lishui?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
     username: root
     username: root
     password: hm123456
     password: hm123456
     driver-class-name: com.mysql.cj.jdbc.Driver
     driver-class-name: com.mysql.cj.jdbc.Driver

+ 37 - 0
huimv-farm-video/src/main/resources/application-lishui-local.yml

@@ -0,0 +1,37 @@
+server:
+  port: 8096
+spring:
+  application:
+    name: pigfarm-local-device
+  #------DataSource-----
+  datasource:
+    url: jdbc:mysql://192.168.1.7:3306/huimv-lishui?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    username: root
+    password: hm123456789
+    driver-class-name: com.mysql.cj.jdbc.Driver
+  jpa:
+    hibernate:
+      ddl-auto: update
+    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+  redis:
+    host: 122.112.224.199
+    port: 6379
+    password: hm123456
+# Socket配置
+#socket:
+  # 监听端口 9001
+#  listen:
+#    #ip: 192.168.16.3
+#    ip: 192.168.1.49
+#    port: 10020
+  # 线程池 - 保持线程数 20
+  #pool-keep: 20
+  # 线程池 - 核心线程数 10
+  #pool-core: 10
+  # 线程池 - 最大线程数 20
+  #pool-max: 30
+  # 线程队列容量 10
+  #pool-queue-init: 10
+#mybatis-plus:
+#  configuration:
+#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

+ 4 - 4
huimv-farm-video/src/main/resources/application-lishui.yml

@@ -1,13 +1,13 @@
 server:
 server:
-  port: 8096
+  port: 10053
 spring:
 spring:
   application:
   application:
-    name: pigfarm-local-device
+    name: huimv-farm-video
   #------DataSource-----
   #------DataSource-----
   datasource:
   datasource:
-    url: jdbc:mysql://192.168.1.7:3306/huimv-lishui?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://122.112.224.199:3306/huimv-lishui?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
     username: root
     username: root
-    password: hm123456789
+    password: hm123456
     driver-class-name: com.mysql.cj.jdbc.Driver
     driver-class-name: com.mysql.cj.jdbc.Driver
   jpa:
   jpa:
     hibernate:
     hibernate: