Pārlūkot izejas kodu

添加首页配置信息设置,首页工作看板设置,首页环保数据设置,摄像头信息配置

523096025 4 gadi atpakaļ
vecāks
revīzija
4689bbbada
65 mainītis faili ar 2626 papildinājumiem un 40 dzēšanām
  1. 45 0
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/controller/IndexEnvController.java
  2. 97 0
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/entity/IndexEnvEntity.java
  3. 9 0
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/repo/IndexEnvEntityRepo.java
  4. 21 0
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/service/IndexEnvService.java
  5. 80 0
      huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/service/impl/IndexEnvServiceImpl.java
  6. 38 0
      huimv-ql-farm/huimv-ql-production/pom.xml
  7. 2 0
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/HuimvProductionApplication.java
  8. 40 0
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/controller/IndexAllController.java
  9. 45 0
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/controller/IndexBoardController.java
  10. 47 0
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/controller/IndexParameterController.java
  11. 32 0
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/domain/IndexAllEntity.java
  12. 42 0
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/domain/IndexBoardEntity.java
  13. 45 0
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/domain/IndexParameterEntity.java
  14. 15 0
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/repo/IndexAllEntityRepository.java
  15. 9 0
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/repo/IndexBoardEntityRepository.java
  16. 9 0
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/repo/IndexParameterEntityRepository.java
  17. 28 0
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/result/Result.java
  18. 19 0
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/service/IndexAllService.java
  19. 21 0
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/service/IndexBoardService.java
  20. 24 0
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/service/IndexParameterService.java
  21. 54 0
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/service/impl/IndexAllServiceImpl.java
  22. 80 0
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/service/impl/IndexBoardServiceImpl.java
  23. 83 0
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/service/impl/IndexParameterServiceImpl.java
  24. 12 12
      huimv-ql-farm/huimv-ql-production/src/main/resources/application-dev.yml
  25. 38 0
      huimv-ql-farm/huimv-ql-security/pom.xml
  26. 2 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/HuimvSecurityApplication.java
  27. 100 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/controller/FaceController.java
  28. 37 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/domain/FaceRecoEntity.java
  29. 58 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/domain/FaceSbdaEntity.java
  30. 79 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/domain/FaceUserEntity.java
  31. 29 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/domain/FaceUserImgEntity.java
  32. 19 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/repo/FaceRecoEntityRepository.java
  33. 9 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/repo/FaceSbdaEntityRepository.java
  34. 9 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/repo/FaceUserEntityRepository.java
  35. 10 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/repo/FaceUserImgEntityRepository.java
  36. 28 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/result/Result.java
  37. 24 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/service/FaceRecoService.java
  38. 11 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/service/FaceSbdaService.java
  39. 19 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/service/FaceUserImgService.java
  40. 16 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/service/FaceUserService.java
  41. 81 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/service/impl/FaceRecoServiceImpl.java
  42. 15 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/service/impl/FaceSbdaServiceImpl.java
  43. 54 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/service/impl/FaceUserImgServiceImpl.java
  44. 27 0
      huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/service/impl/FaceUserServiceImpl.java
  45. 12 12
      huimv-ql-farm/huimv-ql-security/src/main/resources/application-dev.yml
  46. 55 4
      huimv-ql-farm/huimv-ql-video/pom.xml
  47. 94 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/controller/CameraInfoController.java
  48. 87 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/controller/PastureAreaController.java
  49. 95 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/controller/PublicNetworkController.java
  50. 44 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/domain/CameraInfo.java
  51. 36 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/domain/PastureArea.java
  52. 38 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/domain/PublicNetwork.java
  53. 31 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/repo/CameraInfoRepo.java
  54. 24 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/repo/PastureAreaRepo.java
  55. 18 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/repo/PublicNetworkRepo.java
  56. 28 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/result/Result.java
  57. 47 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/CameraInfoService.java
  58. 24 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/PastureAreaService.java
  59. 36 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/PublicNetworkService.java
  60. 109 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/impl/CameraInfoServiceImpl.java
  61. 107 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/impl/PastureAreaServiceImpl.java
  62. 29 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/impl/PublicNetworkServiceImpl.java
  63. 53 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/util/IpUtil.java
  64. 85 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/util/PropertiesUtils.java
  65. 12 12
      huimv-ql-farm/huimv-ql-video/src/main/resources/application-dev.yml

+ 45 - 0
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/controller/IndexEnvController.java

@@ -0,0 +1,45 @@
+package com.huimv.environment.controller;
+
+import com.huimv.common.result.Result;
+import com.huimv.environment.entity.IndexEnvEntity;
+import com.huimv.environment.service.IndexEnvService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.environment.controller
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/8 0008 14:59
+ **/
+@RestController
+@CrossOrigin
+@RequestMapping("/env")
+public class IndexEnvController {
+
+    @Autowired
+    private IndexEnvService envService;
+
+    @RequestMapping("/add")
+    public Result add(IndexEnvEntity BoardEntity){
+        return envService.add(BoardEntity);
+    }
+
+    @RequestMapping("/remove")
+    public Result add(Integer[] ids){
+        return envService.remove(ids);
+    }
+
+    @RequestMapping("/update")
+    public Result update(IndexEnvEntity BoardEntity){
+        return envService.update(BoardEntity);
+    }
+
+    @RequestMapping("/findAll")
+    public Result findAll(){
+        return envService.findAll();
+    }
+}

+ 97 - 0
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/entity/IndexEnvEntity.java

@@ -0,0 +1,97 @@
+package com.huimv.environment.entity;
+
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+
+@Entity
+@Table(name = "index_env")
+public class IndexEnvEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id", nullable = false)
+    private Integer id;
+
+    @Column(name = "name")
+    private String name;
+
+    @Column(name = "data")
+    private String data;
+
+    @Column(name = "create_time", nullable = false)
+    private Date createTime;
+
+    @Column(name = "update_time", nullable = false)
+    private Date updateTime;
+
+
+    public IndexEnvEntity() {
+    }
+    public IndexEnvEntity(Integer id, String name, String data, Date createTime, Date updateTime) {
+        this.id = id;
+        this.name = name;
+        this.data = data;
+        this.createTime = createTime;
+        this.updateTime = updateTime;
+    }
+
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getData() {
+        return data;
+    }
+
+    public void setData(String data) {
+        this.data = data;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    @Override
+    public String toString() {
+        return "IndexEnvEntity{" +
+                "id=" + id +
+                ", name='" + name + '\'' +
+                ", data='" + data + '\'' +
+                ", createTime=" + createTime +
+                ", updateTime=" + updateTime +
+                '}';
+    }
+}

+ 9 - 0
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/repo/IndexEnvEntityRepo.java

@@ -0,0 +1,9 @@
+package com.huimv.environment.repo;
+
+import com.huimv.environment.entity.IndexEnvEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+public interface IndexEnvEntityRepo extends JpaRepository<IndexEnvEntity, Integer>, JpaSpecificationExecutor<IndexEnvEntity> {
+
+}

+ 21 - 0
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/service/IndexEnvService.java

@@ -0,0 +1,21 @@
+package com.huimv.environment.service;
+
+import com.huimv.common.result.Result;
+import com.huimv.environment.entity.IndexEnvEntity;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.environment.service
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/8 0008 14:59
+ **/
+public interface IndexEnvService {
+    Result remove(Integer[] ids);
+
+    Result add(IndexEnvEntity boardEntity);
+
+    Result update(IndexEnvEntity boardEntity);
+
+    Result findAll();
+}

+ 80 - 0
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/service/impl/IndexEnvServiceImpl.java

@@ -0,0 +1,80 @@
+package com.huimv.environment.service.impl;
+
+import com.huimv.common.result.Result;
+import com.huimv.common.result.ResultCode;
+import com.huimv.environment.entity.IndexEnvEntity;
+import com.huimv.environment.repo.IndexEnvEntityRepo;
+import com.huimv.environment.service.IndexEnvService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.environment.service.impl
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/8 0008 14:59
+ **/
+@Service
+public class IndexEnvServiceImpl implements IndexEnvService {
+    
+    @Autowired
+    private IndexEnvEntityRepo entityRepo;
+
+    @Override
+    public Result add(IndexEnvEntity envEntity) {
+        if (envEntity == null){
+            return new Result(10002,"请输入参数",false);
+        }
+        try {
+            entityRepo.save(envEntity);
+            return new Result(10000,"添加成功",true);
+        }catch (Exception e){
+            return new Result(10001,"添加失败",false);
+        }
+    }
+
+    @Override
+    public Result remove(Integer[] ids) {
+        if (ids == null || ids.length==0){
+            return new Result(10002,"请选择要删除的数据",false);
+        }
+        try {
+            for (Integer id : ids) {
+                entityRepo.deleteById(id);
+            }
+
+            return new Result(10000,"删除成功",true);
+        }catch (Exception e){
+            return new Result(10001,"删除失败",false);
+        }
+    }
+
+    @Override
+    public Result update(IndexEnvEntity envEntity) {
+        if (envEntity == null){
+            return new Result(10002,"请选择要修改的值",false);
+        }
+        try {
+            envEntity.setCreateTime(entityRepo.findById(envEntity.getId()).get().getCreateTime());
+            envEntity.setUpdateTime(new Date());
+            entityRepo.save(envEntity);
+            return new Result(10000,"修改成功",true);
+        }catch (Exception e){
+            return new Result(10001,"修改失败",false);
+        }
+    }
+
+    @Override
+    public Result findAll() {
+        try {
+            List<IndexEnvEntity> all = entityRepo.findAll();
+            return new Result(ResultCode.SUCCESS,all);
+        }catch (Exception e){
+            return new Result(ResultCode.FAIL,null);
+        }
+    }
+}

+ 38 - 0
huimv-ql-farm/huimv-ql-production/pom.xml

@@ -11,5 +11,43 @@
 
     <artifactId>huimv-ql-production</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>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-data-jpa</artifactId>
+        <version>2.3.1.RELEASE</version>
+    </dependency>
+    <dependency>
+        <groupId>mysql</groupId>
+        <artifactId>mysql-connector-java</artifactId>
+        <version>8.0.16</version>
+    </dependency>
+    <dependency>
+        <groupId>com.alibaba</groupId>
+        <artifactId>fastjson</artifactId>
+        <version>1.2.24</version>
+    </dependency>
+    <dependency>
+        <groupId>cn.hutool</groupId>
+        <artifactId>hutool-all</artifactId>
+        <version>5.5.9</version>
+    </dependency>
+
+
+    <dependency>
+        <groupId>org.projectlombok</groupId>
+        <artifactId>lombok</artifactId>
+    </dependency>
+</dependencies>
 </project>

+ 2 - 0
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/HuimvProductionApplication.java

@@ -2,8 +2,10 @@ package com.huimv.production;
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
 
 @SpringBootApplication
+@EnableJpaAuditing
 public class HuimvProductionApplication {
 
     public static void main(String[] args) {

+ 40 - 0
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/controller/IndexAllController.java

@@ -0,0 +1,40 @@
+package com.huimv.production.controller;
+
+import com.huimv.production.domain.IndexAllEntity;
+import com.huimv.production.result.Result;
+import com.huimv.production.service.IndexAllService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.production.controller
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/5 0005 17:43
+ **/
+@RestController
+@RequestMapping("/all")
+@CrossOrigin
+public class IndexAllController {
+    @Autowired
+    private IndexAllService allService;
+
+    @RequestMapping("/add")
+    public Result add(IndexAllEntity allEntity){
+        return allService.add(allEntity);
+    }
+
+    @RequestMapping("/update")
+    public Result update(IndexAllEntity allEntity){
+        return allService.update(allEntity);
+    }
+
+    @RequestMapping("/findAll")
+    public Result findAll(){
+        return allService.findAll();
+    }
+
+}

+ 45 - 0
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/controller/IndexBoardController.java

@@ -0,0 +1,45 @@
+package com.huimv.production.controller;
+
+import com.huimv.production.domain.IndexBoardEntity;
+import com.huimv.production.result.Result;
+import com.huimv.production.service.IndexBoardService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.production.controller
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/5 0005 10:55
+ **/
+@RestController
+@CrossOrigin
+@RequestMapping("/board")
+public class IndexBoardController {
+
+    @Autowired
+    private IndexBoardService boardService;
+
+    @RequestMapping("/add")
+    public Result add(IndexBoardEntity BoardEntity){
+        return boardService.add(BoardEntity);
+    }
+
+    @RequestMapping("/remove")
+    public Result add(Integer[] ids){
+        return boardService.remove(ids);
+    }
+
+    @RequestMapping("/update")
+    public Result update(IndexBoardEntity BoardEntity){
+        return boardService.update(BoardEntity);
+    }
+
+    @RequestMapping("/findAll")
+    public Result findAll(){
+        return boardService.findAll();
+    }
+}

+ 47 - 0
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/controller/IndexParameterController.java

@@ -0,0 +1,47 @@
+package com.huimv.production.controller;
+
+import com.huimv.production.domain.IndexParameterEntity;
+import com.huimv.production.result.Result;
+import com.huimv.production.service.IndexParameterService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.production.controller
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/5 0005 10:54
+ **/
+@RestController
+@CrossOrigin
+@RequestMapping("/parameter")
+public class IndexParameterController {
+    @Autowired
+    private IndexParameterService parameterService;
+
+    @RequestMapping("/add")
+    public Result add(IndexParameterEntity parameterEntity){
+        return parameterService.add(parameterEntity);
+    }
+
+    @RequestMapping("/remove")
+    public Result add(Integer[] ids){
+        return parameterService.remove(ids);
+    }
+
+    @RequestMapping("/update")
+    public Result update(IndexParameterEntity parameterEntity){
+        return parameterService.update(parameterEntity);
+    }
+
+    @RequestMapping("/findAll")
+    public Result findAll(){
+        return parameterService.findAll();
+    }
+
+}

+ 32 - 0
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/domain/IndexAllEntity.java

@@ -0,0 +1,32 @@
+package com.huimv.production.domain;
+
+import lombok.Data;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "index_all")
+@Data
+public class IndexAllEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id", nullable = false)
+    private Integer id;
+
+    @Column(name = "total_quantity")
+    private Integer totalQuantity;
+
+    @Column(name = "sow")
+    private Integer sow;
+
+    @Column(name = "child_care")
+    private Integer childCare;
+
+    @Column(name = "day")
+    private String day;
+
+}

+ 42 - 0
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/domain/IndexBoardEntity.java

@@ -0,0 +1,42 @@
+package com.huimv.production.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.data.annotation.CreatedDate;
+import org.springframework.data.annotation.LastModifiedDate;
+import org.springframework.data.jpa.domain.support.AuditingEntityListener;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+
+@Entity
+@Data
+@Table(name = "index_board")
+@EntityListeners(AuditingEntityListener.class)
+public class IndexBoardEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id", nullable = false)
+    private Integer id;
+
+    @Column(name = "name")
+    private String name;
+
+    @Column(name = "data")
+    private String data;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @CreatedDate
+    @Column(name = "create_time", nullable = false)
+    private Date createTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @LastModifiedDate
+    @Column(name = "update_time", nullable = false)
+    private Date updateTime;
+
+}

+ 45 - 0
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/domain/IndexParameterEntity.java

@@ -0,0 +1,45 @@
+package com.huimv.production.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.data.annotation.CreatedDate;
+import org.springframework.data.annotation.LastModifiedDate;
+import org.springframework.data.jpa.domain.support.AuditingEntityListener;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+
+@Table(name = "index_parameter")
+@Entity
+@Data
+@EntityListeners(AuditingEntityListener.class)
+public class IndexParameterEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id", nullable = false)
+    private Integer id;
+
+    @Column(name = "name")
+    private String name;
+
+    @Column(name = "data")
+    private String data;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @Column(name = "create_time",nullable = false)
+    @CreatedDate
+    private Date createTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @LastModifiedDate
+    @Column(name = "update_time",nullable = false)
+    private Date updateTime;
+
+    @Column(name = "check_parameter")
+    private Boolean checkParameter;
+
+}

+ 15 - 0
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/repo/IndexAllEntityRepository.java

@@ -0,0 +1,15 @@
+package com.huimv.production.repo;
+
+import com.huimv.production.domain.IndexAllEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+import java.util.List;
+
+public interface IndexAllEntityRepository extends JpaRepository<IndexAllEntity, Integer>, JpaSpecificationExecutor<IndexAllEntity> {
+
+    IndexAllEntity findByDay(String day);
+
+//    List<IndexAllEntity
+
+}

+ 9 - 0
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/repo/IndexBoardEntityRepository.java

@@ -0,0 +1,9 @@
+package com.huimv.production.repo;
+
+import com.huimv.production.domain.IndexBoardEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+public interface IndexBoardEntityRepository extends JpaRepository<IndexBoardEntity, Integer>, JpaSpecificationExecutor<IndexBoardEntity> {
+
+}

+ 9 - 0
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/repo/IndexParameterEntityRepository.java

@@ -0,0 +1,9 @@
+package com.huimv.production.repo;
+
+import com.huimv.production.domain.IndexParameterEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+public interface IndexParameterEntityRepository extends JpaRepository<IndexParameterEntity, Integer>, JpaSpecificationExecutor<IndexParameterEntity> {
+
+}

+ 28 - 0
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/result/Result.java

@@ -0,0 +1,28 @@
+package com.huimv.production.result;
+
+import lombok.Data;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.face.result
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2020/12/29 0029 14:46
+ **/
+@Data
+public class Result {
+    private Integer  status;
+    private String msg;
+    private Object data;
+
+    public Result(Integer status, String msg, Object data) {
+        this.status = status;
+        this.msg = msg;
+        this.data = data;
+    }
+
+    public Result(Integer status, String msg) {
+        this.status = status;
+        this.msg = msg;
+    }
+}

+ 19 - 0
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/service/IndexAllService.java

@@ -0,0 +1,19 @@
+package com.huimv.production.service;
+
+import com.huimv.production.domain.IndexAllEntity;
+import com.huimv.production.result.Result;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.production.service
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/5 0005 17:43
+ **/
+public interface IndexAllService {
+    Result add(IndexAllEntity allEntity);
+
+    Result update(IndexAllEntity allEntity);
+
+    Result findAll();
+}

+ 21 - 0
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/service/IndexBoardService.java

@@ -0,0 +1,21 @@
+package com.huimv.production.service;
+
+import com.huimv.production.domain.IndexBoardEntity;
+import com.huimv.production.result.Result;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.production.service
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/5 0005 10:55
+ **/
+public interface IndexBoardService {
+    Result add(IndexBoardEntity boardEntity);
+
+    Result remove(Integer[] ids);
+
+    Result update(IndexBoardEntity boardEntity);
+
+    Result findAll();
+}

+ 24 - 0
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/service/IndexParameterService.java

@@ -0,0 +1,24 @@
+package com.huimv.production.service;
+
+import com.huimv.production.domain.IndexParameterEntity;
+import com.huimv.production.result.Result;
+
+import java.util.List;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.production.service
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/5 0005 10:56
+ **/
+public interface IndexParameterService {
+    //增删改查
+    Result add(IndexParameterEntity parameterEntity);
+
+    Result remove(Integer[] ids);
+
+    Result update(IndexParameterEntity parameterEntity);
+
+    Result findAll();
+}

+ 54 - 0
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/service/impl/IndexAllServiceImpl.java

@@ -0,0 +1,54 @@
+package com.huimv.production.service.impl;
+
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+import com.huimv.production.domain.IndexAllEntity;
+import com.huimv.production.repo.IndexAllEntityRepository;
+import com.huimv.production.result.Result;
+import com.huimv.production.service.IndexAllService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.production.service.impl
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/5 0005 17:43
+ **/
+@Service
+public class IndexAllServiceImpl  implements IndexAllService {
+
+    @Autowired
+    private IndexAllEntityRepository repository;
+
+    @Override
+    public Result add(IndexAllEntity allEntity) {
+
+        String day = DateUtil.format(new Date(), "MM/dd");
+        IndexAllEntity byDay = repository.findByDay(day);
+        if (byDay != null){
+            return new Result(10002,"每天只能添加一次");
+        }
+        allEntity.setDay(day);
+        allEntity.setTotalQuantity(allEntity.getSow()+allEntity.getSow());
+        repository.save(allEntity);
+        return new Result(10000,"添加成功");
+    }
+
+    @Override
+    public Result update(IndexAllEntity allEntity) {
+
+        repository.save(allEntity);
+        return new Result(10000,"修改成功");
+    }
+
+    @Override
+    public Result findAll() {
+        repository.findAll();
+
+        return null;
+    }
+}

+ 80 - 0
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/service/impl/IndexBoardServiceImpl.java

@@ -0,0 +1,80 @@
+package com.huimv.production.service.impl;
+
+import com.huimv.production.domain.IndexBoardEntity;
+import com.huimv.production.domain.IndexParameterEntity;
+import com.huimv.production.repo.IndexBoardEntityRepository;
+import com.huimv.production.result.Result;
+import com.huimv.production.service.IndexBoardService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.production.service.impl
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/5 0005 10:55
+ **/
+@Service
+public class IndexBoardServiceImpl implements IndexBoardService {
+    @Autowired
+    private IndexBoardEntityRepository boardEntityRepository;
+
+    @Override
+    public Result add(IndexBoardEntity boardEntity) {
+        if (boardEntity == null){
+            return new Result(10002,"请输入参数");
+        }
+        try {
+            boardEntityRepository.save(boardEntity);
+            return new Result(10000,"添加成功");
+        }catch (Exception e){
+            return new Result(10001,"添加失败");
+        }
+    }
+
+    @Override
+    public Result remove(Integer[] ids) {
+        if (ids == null || ids.length==0){
+            return new Result(10002,"请选择要删除的数据");
+        }
+        try {
+            for (Integer id : ids) {
+                boardEntityRepository.deleteById(id);
+            }
+
+            return new Result(10000,"删除成功");
+        }catch (Exception e){
+            return new Result(10001,"删除失败");
+        }
+    }
+
+    @Override
+    public Result update(IndexBoardEntity boardEntity) {
+        if (boardEntity == null){
+            return new Result(10002,"请选择要修改的值");
+        }
+        try {
+            boardEntity.setCreateTime(boardEntityRepository.findById(boardEntity.getId()).get().getCreateTime());
+            boardEntity.setUpdateTime(new Date());
+            boardEntityRepository.save(boardEntity);
+            return new Result(10000,"修改成功");
+        }catch (Exception e){
+            return new Result(10001,"修改失败");
+        }
+    }
+
+    @Override
+    public Result findAll() {
+        try {
+            List<IndexBoardEntity> all = boardEntityRepository.findAll();
+            return new Result(10000,"查询成功",all);
+        }catch (Exception e){
+            return new Result(10001,"查询失败",null);
+        }
+    }
+}

+ 83 - 0
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/service/impl/IndexParameterServiceImpl.java

@@ -0,0 +1,83 @@
+package com.huimv.production.service.impl;
+
+import com.huimv.production.domain.IndexParameterEntity;
+import com.huimv.production.repo.IndexParameterEntityRepository;
+import com.huimv.production.result.Result;
+import com.huimv.production.service.IndexParameterService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.production.service.impl
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/5 0005 10:56
+ **/
+@Service
+public class IndexParameterServiceImpl implements IndexParameterService {
+    @Autowired
+    private IndexParameterEntityRepository parameterEntityRepository;
+
+    @Override
+    public Result add(IndexParameterEntity parameterEntity) {
+        if (parameterEntity == null){
+           return new Result(10002,"请输入参数");
+        }
+        try {
+            parameterEntity.setCheckParameter(false);
+            parameterEntityRepository.save(parameterEntity);
+            return new Result(10000,"添加成功");
+        }catch (Exception e){
+            return new Result(10001,"添加失败");
+        }
+
+
+    }
+
+    @Override
+    public Result remove(Integer[] ids) {
+        if (ids == null || ids.length==0){
+            return new Result(10002,"请选择要删除的数据");
+        }
+        try {
+            for (Integer id : ids) {
+                parameterEntityRepository.deleteById(id);
+            }
+
+            return new Result(10000,"删除成功");
+        }catch (Exception e){
+            return new Result(10001,"删除失败");
+        }
+    }
+    //暂时有疑问
+    @Override
+    public Result update(IndexParameterEntity parameterEntity) {
+        if (parameterEntity == null){
+            return new Result(10002,"请选择要修改的值");
+        }
+        try {
+            parameterEntity.setCreateTime(parameterEntityRepository.findById(parameterEntity.getId()).get().getCreateTime());
+            parameterEntity.setUpdateTime(new Date());
+            parameterEntityRepository.save(parameterEntity);
+            return new Result(10000,"修改成功");
+        }catch (Exception e){
+            return new Result(10001,"修改失败");
+        }
+
+    }
+
+    @Override
+    public Result findAll() {
+        try {
+            List<IndexParameterEntity> all = parameterEntityRepository.findAll();
+            return new Result(10000,"查询成功",all);
+        }catch (Exception e){
+            return new Result(10001,"查询失败",null);
+        }
+
+    }
+}

+ 12 - 12
huimv-ql-farm/huimv-ql-production/src/main/resources/application-dev.yml

@@ -4,18 +4,18 @@ spring:
   application:
     name: environment
 
-#  datasource:
-#    url: jdbc:mysql://192.168.1.7:3306/eartag_db?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
+  datasource:
+    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:
+    show-sql: true
+    database: mysql
+    hibernate:
+      ddl-auto: update
+    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+    open-in-view: true
 
     #  redis:
 #    database: 0

+ 38 - 0
huimv-ql-farm/huimv-ql-security/pom.xml

@@ -11,5 +11,43 @@
 
     <artifactId>huimv-ql-security</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>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-jpa</artifactId>
+            <version>2.3.1.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>8.0.16</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.24</version>
+        </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.5.9</version>
+        </dependency>
+
+
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
+    </dependencies>
 </project>

+ 2 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/HuimvSecurityApplication.java

@@ -2,8 +2,10 @@ package com.huimv.security;
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
 
 @SpringBootApplication
+@EnableJpaAuditing
 public class HuimvSecurityApplication {
 
     public static void main(String[] args) {

+ 100 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/controller/FaceController.java

@@ -0,0 +1,100 @@
+package com.huimv.security.controller;
+
+import cn.hutool.json.JSONObject;
+import com.huimv.security.domain.FaceUserEntity;
+import com.huimv.security.domain.FaceUserImgEntity;
+import com.huimv.security.result.Result;
+import com.huimv.security.service.FaceRecoService;
+import com.huimv.security.service.FaceSbdaService;
+import com.huimv.security.service.FaceUserImgService;
+import com.huimv.security.service.FaceUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.Base64;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.security.controller
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/7 0007 15:46
+ **/
+@RestController
+@RequestMapping("/face")
+@CrossOrigin
+public class FaceController {
+
+    @Autowired
+    FaceUserService userService;
+
+    @Autowired
+    FaceSbdaService sbdaService;
+
+    @Autowired
+    FaceRecoService recoService;
+
+    @Autowired
+    FaceUserImgService userImgService;
+
+    /*
+    * @Method      : intoOutCount
+    * @Description : 查询进出总量
+    * @Params      : []
+    * @Return      : com.huimv.security.result.Result
+    *
+    * @Author      : yuxuexuan
+    * @Date        : 2021/3/7 0007
+    * @Time        : 16:14
+    */
+    @RequestMapping("/intoOutCount")
+    private Result intoOutCount(){
+        List list = recoService.intoOutCount();
+
+        return new Result(10000,"成功",list);
+    }
+
+
+    @RequestMapping("/oneDay")
+    private Result oneDay(){
+        List list = recoService.oneDay();
+
+        return new Result(10000,"成功",list);
+    }
+
+
+    @RequestMapping("/oneWeek")
+    private Result oneWeek(){
+        List list = recoService.oneWeek();
+
+        return new Result(10000,"成功",list);
+    }
+
+    @RequestMapping("/oneMouth")
+    private Result oneMouth(){
+        List list = recoService.oneMouth();
+
+        return new Result(10000,"成功",list);
+    }
+
+    @PostMapping("/upload")
+    public  Result upload(String XM , String USERID, @RequestParam(required = true) MultipartFile file){
+        return userImgService.upload(XM,USERID,file);
+    }
+
+    @RequestMapping("/findImg")
+    public Result findImg (){
+//        List<FaceUserEntity> userList = userService.findAll();
+//        FaceUserEntity faceUserEntity = userList.get(0);
+//        faceUserEntity.getUSERID();
+//        faceUserEntity.getXM();
+
+        List<FaceUserImgEntity> list = userImgService.findImg();
+        byte[] img = list.get(0).getImg();
+        String imgBase64 = "data:image/jpg;base64,"+ Base64.getEncoder().encodeToString(img);
+        return new Result(10000,"查询成功",imgBase64);
+    }
+}

+ 37 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/domain/FaceRecoEntity.java

@@ -0,0 +1,37 @@
+package com.huimv.security.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.data.annotation.LastModifiedDate;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+
+@Entity
+@Table(name = "face_reco")
+@Data
+public class FaceRecoEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "ID", nullable = false)
+    private Integer ID;
+
+    @Column(name = "USERID")
+    private String USERID;
+
+    @Column(name = "SBID")
+    private String SBID;
+
+    @Column(name = "MCID")
+    private Integer MCID;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @LastModifiedDate
+    @Column(name = "XGSJ")
+    private Date XGSJ;
+
+}

+ 58 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/domain/FaceSbdaEntity.java

@@ -0,0 +1,58 @@
+package com.huimv.security.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.data.annotation.LastModifiedDate;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+
+@Entity
+@Table(name = "face_sbda")
+@Data
+public class FaceSbdaEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "ID", nullable = false)
+    private Integer ID;
+
+    @Column(name = "MCID")
+    private Integer MCID;
+
+    /**
+     * 设备ID
+     */
+    @Column(name = "SBID")
+    private String SBID;
+
+    /**
+     * 名称
+     */
+    @Column(name = "SBMC")
+    private String SBMC;
+
+    /**
+     * 备注
+     */
+    @Column(name = "BZ")
+    private String BZ;
+
+    /**
+     * 修改时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
+    @LastModifiedDate
+    @Column(name = "XGSJ")
+    private Date XGSJ;
+
+    /**
+     * 作废标志
+     */
+    @Column(name = "ZFBZ")
+    private Integer ZFBZ;
+
+}

+ 79 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/domain/FaceUserEntity.java

@@ -0,0 +1,79 @@
+package com.huimv.security.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.data.annotation.LastModifiedDate;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+
+@Entity
+@Table(name = "face_user")
+@Data
+public class FaceUserEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "ID", nullable = false)
+    private Integer ID;
+
+    /**
+     * 牧场ID
+     */
+    @Column(name = "MCID")
+    private Integer MCID;
+
+    /**
+     * 员工ID
+     */
+    @Column(name = "YGID")
+    private Integer YGID;
+
+    /**
+     * user id
+     */
+    @Column(name = "USERID")
+    private String USERID;
+
+    /**
+     * 姓名
+     */
+    @Column(name = "XM")
+    private String XM;
+
+    /**
+     * 职位
+     */
+    @Column(name = "ZW")
+    private String ZW;
+
+    /**
+     * 备注
+     */
+    @Column(name = "BZ")
+    private String BZ;
+
+    /**
+     * 修改时间
+     */
+    @Column(name = "XGSJ")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    @LastModifiedDate
+    private Date XGSJ;
+
+    /**
+     * 作废标志
+     */
+    @Column(name = "ZFBZ")
+    private Integer ZFBZ;
+
+    @Column(name = "sbid")
+    private String sbid;
+
+    @Column(name = "sbmc")
+    private String sbmc;
+
+}

+ 29 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/domain/FaceUserImgEntity.java

@@ -0,0 +1,29 @@
+package com.huimv.security.domain;
+
+import lombok.Data;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "face_user_img")
+@Data
+public class FaceUserImgEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id", nullable = false)
+    private Integer id;
+
+    @Column(name = "user_id")
+    private String userId;
+
+    @Column(name = "user_name")
+    private String userName;
+
+    @Column(name = "img")
+    private byte[] img;
+
+}

+ 19 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/repo/FaceRecoEntityRepository.java

@@ -0,0 +1,19 @@
+package com.huimv.security.repo;
+
+import com.huimv.security.domain.FaceRecoEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.Date;
+import java.util.List;
+
+public interface FaceRecoEntityRepository extends JpaRepository<FaceRecoEntity, Integer>, JpaSpecificationExecutor<FaceRecoEntity> {
+
+
+    @Query(nativeQuery = true,value = "SELECT COUNT(*) AS num,  r.SBID,s.SBMC FROM `face_reco` r ,`face_sbda` s WHERE r.`SBID`=s.`SBID` GROUP BY SBID")
+    List findAllByOOrderBySBID();
+
+    List findAllByXGSJBetween(Date startTime,Date endTime);
+
+}

+ 9 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/repo/FaceSbdaEntityRepository.java

@@ -0,0 +1,9 @@
+package com.huimv.security.repo;
+
+import com.huimv.security.domain.FaceSbdaEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+public interface FaceSbdaEntityRepository extends JpaRepository<FaceSbdaEntity, Integer>, JpaSpecificationExecutor<FaceSbdaEntity> {
+
+}

+ 9 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/repo/FaceUserEntityRepository.java

@@ -0,0 +1,9 @@
+package com.huimv.security.repo;
+
+import com.huimv.security.domain.FaceUserEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+public interface FaceUserEntityRepository extends JpaRepository<FaceUserEntity, Integer>, JpaSpecificationExecutor<FaceUserEntity> {
+
+}

+ 10 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/repo/FaceUserImgEntityRepository.java

@@ -0,0 +1,10 @@
+package com.huimv.security.repo;
+
+import com.huimv.security.domain.FaceUserImgEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+public interface FaceUserImgEntityRepository extends JpaRepository<FaceUserImgEntity, Integer>, JpaSpecificationExecutor<FaceUserImgEntity> {
+    FaceUserImgEntity findAllByUserId(String userId);
+
+}

+ 28 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/result/Result.java

@@ -0,0 +1,28 @@
+package com.huimv.security.result;
+
+import lombok.Data;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.face.result
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2020/12/29 0029 14:46
+ **/
+@Data
+public class Result {
+    private Integer  status;
+    private String msg;
+    private Object data;
+
+    public Result(Integer status, String msg, Object data) {
+        this.status = status;
+        this.msg = msg;
+        this.data = data;
+    }
+
+    public Result(Integer status, String msg) {
+        this.status = status;
+        this.msg = msg;
+    }
+}

+ 24 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/service/FaceRecoService.java

@@ -0,0 +1,24 @@
+package com.huimv.security.service;
+
+import cn.hutool.json.JSONObject;
+import com.huimv.security.result.Result;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.security.service
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/7 0007 15:43
+ **/
+public interface FaceRecoService {
+    List intoOutCount();
+
+    List oneDay();
+
+    List oneWeek();
+
+    List oneMouth();
+}

+ 11 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/service/FaceSbdaService.java

@@ -0,0 +1,11 @@
+package com.huimv.security.service;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.security.service
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/7 0007 15:44
+ **/
+public interface FaceSbdaService {
+}

+ 19 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/service/FaceUserImgService.java

@@ -0,0 +1,19 @@
+package com.huimv.security.service;
+
+import com.huimv.security.result.Result;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.security.service
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/8 0008 10:10
+ **/
+public interface FaceUserImgService {
+    Result upload( String xm, String userid, MultipartFile file);
+
+    List findImg();
+}

+ 16 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/service/FaceUserService.java

@@ -0,0 +1,16 @@
+package com.huimv.security.service;
+
+import com.huimv.security.domain.FaceUserEntity;
+
+import java.util.List;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.security.service
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/7 0007 15:44
+ **/
+public interface FaceUserService {
+    List<FaceUserEntity> findAll();
+}

+ 81 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/service/impl/FaceRecoServiceImpl.java

@@ -0,0 +1,81 @@
+package com.huimv.security.service.impl;
+
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.date.Month;
+import cn.hutool.json.JSONObject;
+import com.huimv.security.repo.FaceRecoEntityRepository;
+import com.huimv.security.result.Result;
+import com.huimv.security.service.FaceRecoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.security.service.impl
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/7 0007 15:44
+ **/
+@Service
+public class FaceRecoServiceImpl implements FaceRecoService {
+    @Autowired
+    FaceRecoEntityRepository faceRecoEntityRepository;
+
+    @Override
+    public List intoOutCount() {
+        return faceRecoEntityRepository.findAllByOOrderBySBID();
+    }
+
+    @Override
+    public List oneDay() {
+        DateTime date = DateUtil.date();
+        int nowHour = Integer.parseInt((DateUtil.beginOfHour(date)+"").substring(11,13));
+        DateTime beginOfDay = DateUtil.beginOfDay(new Date());
+
+        List list = new ArrayList();
+        for (int i=0;i<nowHour+1;i++){
+            List allByXGSJBetween = faceRecoEntityRepository.findAllByXGSJBetween(DateUtil.offsetHour(beginOfDay, i), DateUtil.offsetHour(beginOfDay, i + 1));
+            Map map = new HashMap();
+            map.put((i+1)+":00",allByXGSJBetween.size());
+            list.add(map);
+        }
+
+        return list;
+    }
+
+    @Override
+    public List oneWeek() {
+        DateTime endOfDay = DateUtil.endOfDay(new Date());
+        List list = new ArrayList();
+       for (int i = 0; i<7;i++){
+           DateTime dateTime = DateUtil.offsetDay(endOfDay, -i);
+           List allByXGSJBetween = faceRecoEntityRepository.findAllByXGSJBetween( DateUtil.offsetDay(endOfDay, -i - 1),dateTime);
+           Map map = new HashMap();
+           map.put((dateTime+"").substring(5,10),allByXGSJBetween.size());
+           list.add(map);
+       }
+
+        return list;
+    }
+
+    @Override
+    public List oneMouth() {
+
+        DateTime endOfDay = DateUtil.endOfDay(new Date());
+        List list = new ArrayList();
+        int nowDay = Integer.parseInt((endOfDay+"").substring(8,10));
+
+        for (int i = 0; i<nowDay;i++){
+            DateTime dateTime = DateUtil.offsetDay(endOfDay, -i);
+            List allByXGSJBetween = faceRecoEntityRepository.findAllByXGSJBetween( DateUtil.offsetDay(endOfDay, -i - 1),dateTime);
+            Map map = new HashMap();
+           map.put((dateTime+"").substring(5,10),allByXGSJBetween.size());
+           list.add(map);
+        }
+
+        return list;
+    }
+}

+ 15 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/service/impl/FaceSbdaServiceImpl.java

@@ -0,0 +1,15 @@
+package com.huimv.security.service.impl;
+
+import com.huimv.security.service.FaceSbdaService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.security.service.impl
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/7 0007 15:44
+ **/
+@Service
+public class FaceSbdaServiceImpl implements FaceSbdaService {
+}

+ 54 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/service/impl/FaceUserImgServiceImpl.java

@@ -0,0 +1,54 @@
+package com.huimv.security.service.impl;
+
+import com.huimv.security.domain.FaceUserImgEntity;
+import com.huimv.security.repo.FaceRecoEntityRepository;
+import com.huimv.security.repo.FaceUserImgEntityRepository;
+import com.huimv.security.result.Result;
+import com.huimv.security.service.FaceUserImgService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.security.service.impl
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/8 0008 10:10
+ **/
+@Service
+public class FaceUserImgServiceImpl implements FaceUserImgService {
+    @Autowired
+    private FaceUserImgEntityRepository faceUserImgRepository;
+
+    @Override
+    public Result upload( String XM, String USERID, MultipartFile file) {
+//        try {
+        FaceUserImgEntity faceUserImgs = faceUserImgRepository.findAllByUserId(USERID);
+        if (faceUserImgs == null) {
+            faceUserImgs = new FaceUserImgEntity();
+        }
+        faceUserImgs.setUserId(USERID);
+        faceUserImgs.setUserName(XM);
+        try {
+            faceUserImgs.setImg(file.getBytes());
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        faceUserImgRepository.save(faceUserImgs);
+        return new Result(10000, "添加成功");
+//        }catch (Exception e){
+//            return new Result(10001,"添加失败");
+//        }
+
+    }
+
+    @Override
+    public List findImg() {
+        return faceUserImgRepository.findAll();
+    }
+}

+ 27 - 0
huimv-ql-farm/huimv-ql-security/src/main/java/com/huimv/security/service/impl/FaceUserServiceImpl.java

@@ -0,0 +1,27 @@
+package com.huimv.security.service.impl;
+
+import com.huimv.security.domain.FaceUserEntity;
+import com.huimv.security.repo.FaceUserEntityRepository;
+import com.huimv.security.service.FaceUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.security.service.impl
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/7 0007 15:45
+ **/
+@Service
+public class FaceUserServiceImpl implements FaceUserService {
+    @Autowired
+    private FaceUserEntityRepository faceUserEntityRepository;
+
+    @Override
+    public List<FaceUserEntity> findAll() {
+        return faceUserEntityRepository.findAll();
+    }
+}

+ 12 - 12
huimv-ql-farm/huimv-ql-security/src/main/resources/application-dev.yml

@@ -4,18 +4,18 @@ spring:
   application:
     name: environment
 
-#  datasource:
-#    url: jdbc:mysql://192.168.1.7:3306/eartag_db?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
+  datasource:
+    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:
+    show-sql: true
+    database: mysql
+    hibernate:
+      ddl-auto: update
+    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+    open-in-view: true
 
     #  redis:
 #    database: 0

+ 55 - 4
huimv-ql-farm/huimv-ql-video/pom.xml

@@ -3,13 +3,64 @@
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
-        <artifactId>huimv-ql-farm</artifactId>
-        <groupId>com.huimv</groupId>
-        <version>0.0.1-SNAPSHOT</version>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.4.1</version>
+        <relativePath/> <!-- lookup parent from repository -->
     </parent>
+    <groupId>com.huimv</groupId>
+    <artifactId>huimv-ql-video</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>huimv-ql-video</name>
+    <description>Demo project for Spring Boot</description>
     <modelVersion>4.0.0</modelVersion>
+    <properties>
+        <java.version>1.8</java.version>
+    </properties>
 
-    <artifactId>huimv-ql-video</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>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-jpa</artifactId>
+            <version>2.3.1.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>8.0.16</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.24</version>
+        </dependency>
+
+
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
 
 
 </project>

+ 94 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/controller/CameraInfoController.java

@@ -0,0 +1,94 @@
+package com.huimv.video.controller;
+
+import com.huimv.video.domain.CameraInfo;
+import com.huimv.video.result.Result;
+import com.huimv.video.service.CameraInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.video.controller
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/4 0007 13:58
+ **/
+@CrossOrigin
+@RestController
+@RequestMapping("/cameraInfo")
+public class CameraInfoController {
+
+    @Autowired
+    private CameraInfoService cameraInfoService;
+
+    @RequestMapping("/add")
+    private Result addCamera(CameraInfo cameraInfo){
+        try {
+            cameraInfoService.save(cameraInfo);
+            return new Result(10000,"添加成功");
+        }catch (Exception e){
+            return new Result(10001,"添加失败");
+        }
+    }
+
+    @RequestMapping("/update")
+    private Result updateCamera(CameraInfo cameraInfo){
+        try {
+            if (cameraInfo.getId()==0){
+                return new Result(10002,"请选择修改数据");
+            }
+            cameraInfoService.update(cameraInfo);
+            return new Result(10000,"修改成功");
+        }catch (Exception e){
+            return new Result(10001,"修改失败");
+        }
+    }
+
+    @RequestMapping("/delete")
+    private Result deleteCamera(@RequestParam(required = false) List<Integer> ids){
+        try {
+            cameraInfoService.delete(ids);
+            return new Result(10000,"删除成功");
+        }catch (Exception e){
+            return new Result(10001,"删除失败");
+        }
+    }
+
+    @RequestMapping("/findAll")
+    private Result findAll(){
+        try {
+            List<CameraInfo> list = cameraInfoService.findAll();
+            if (list == null){
+                return new Result(10002,"查询失败,地区信息有误",list);
+            }
+            return new Result(10000,"查询成功",list);
+        }catch (Exception e){
+            return new Result(10001,"查询失败");
+        }
+    }
+
+    @RequestMapping("searchAll")
+    private Result searchAll(String name){
+        try {
+            List list = cameraInfoService.searchAll(name);
+            return new Result(10000,"查询成功",list);
+        }catch (Exception e){
+            return new Result(10001,"查询失败");
+        }
+    }
+
+    @RequestMapping("/getCameraDetails")
+    private Result getCameraDetails(@RequestParam(required = false) List<Integer> areaIds){
+        try {
+            List list =  cameraInfoService.getCameraDetails(areaIds);
+            return new Result(10000,"查询成功",list);
+        }catch (Exception e){
+            return new Result(10001,"查询失败");
+        }
+    }
+}

+ 87 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/controller/PastureAreaController.java

@@ -0,0 +1,87 @@
+package com.huimv.video.controller;
+
+import com.huimv.video.domain.PastureArea;
+import com.huimv.video.result.Result;
+import com.huimv.video.service.PastureAreaService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.video.controller
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/4 0007 10:34
+ **/
+
+@CrossOrigin
+@RestController
+@RequestMapping("/pastureArea")
+public class PastureAreaController {
+
+    @Autowired
+    private PastureAreaService pastureAreaService;
+
+    @RequestMapping("/add")
+    private Result addArea(PastureArea pastureArea){
+        try {
+            if (pastureArea.getParentId() != null){
+                pastureAreaService.save(pastureArea);
+                return new Result(10000,"添加成功");
+            }else {
+                return new Result(10002,"请选择父级ID");
+            }
+        }catch (Exception e){
+            return new Result(10001,"添加失败");
+        }
+    }
+
+    @RequestMapping("/update")
+    private Result updateArea(PastureArea pastureArea){
+        try {
+            if (pastureArea.getId()==0){
+                return new Result(10002,"请选择修改数据");
+            }
+            if (pastureArea.getParentId() != null){
+                pastureAreaService.update(pastureArea);
+                return new Result(10000,"修改成功");
+            }else {
+                return new Result(10002,"请选择父级ID");
+            }
+
+        }catch (Exception e){
+            return new Result(10001,"修改失败");
+        }
+    }
+
+    @RequestMapping("/delete")
+    private Result deleteArea(@RequestParam(required = false)List<Integer> ids){
+//        try {
+            pastureAreaService.delete(ids);
+            return new Result(10000,"删除成功");
+//        }catch (Exception e){
+//            return new Result(10001,"删除失败");
+//        }
+    }
+
+    @RequestMapping("/findAll")
+    private Result findAll(){
+        try {
+            List list = pastureAreaService.findAll();
+            if (list == null){
+                return new Result(10000,"暂时没有数据");
+            }
+            return new Result(10000,"查询成功",list);
+        }catch (Exception e){
+            return new Result(10001,"查询失败");
+        }
+    }
+
+
+
+}

+ 95 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/controller/PublicNetworkController.java

@@ -0,0 +1,95 @@
+package com.huimv.video.controller;
+
+import com.huimv.video.domain.PublicNetwork;
+import com.huimv.video.result.Result;
+import com.huimv.video.service.PublicNetworkService;
+import com.huimv.video.util.IpUtil;
+import com.huimv.video.util.PropertiesUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.video.controller
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/4 0006 14:13
+ **/
+@CrossOrigin
+@RestController
+@RequestMapping("/publicNetwork")
+public class PublicNetworkController {
+    @Autowired
+    private PublicNetworkService networkService;
+    //本地测试 windows 系统
+   // final String fileUrl ="G:\\idea\\huimv\\huimv.shiwan\\shiwan\\video\\src\\main\\resources\\file.properties";
+
+    //linux系统
+    final String fileUrl ="/root/huimv.shimen/file/file.properties";
+
+    @RequestMapping("/add")
+    public Result addNetwork(HttpServletRequest request){
+
+        String ipAddress = IpUtil.getIpAddr(request);
+        File file = new File(fileUrl);
+        if (!file.getParentFile().exists()){
+            file.getParentFile().mkdir();
+        }
+        if (!file.exists()) {
+            try {
+                file.createNewFile();
+            }catch (IOException e){}
+        }
+
+        if (ipAddress.equals(PropertiesUtils.getFileIO("url",fileUrl))){
+            //如果ip没变,只修改配置文件
+            Map map =new HashMap();
+            map.put("creationTime",new Date());
+            PropertiesUtils.writeData(map,fileUrl);
+            return null;
+        }else {
+            Map map1 =new HashMap();
+            Map map2 =new HashMap();
+            Map map3 =new HashMap();
+            map1.put("creationTime",new Date());
+            map2.put("url",ipAddress);
+            map3.put("id",100);
+            PropertiesUtils.writeData(map1,fileUrl);
+            PropertiesUtils.writeData(map2,fileUrl);
+            PropertiesUtils.writeData(map3,fileUrl);
+            PublicNetwork publicNetwork = new PublicNetwork();
+            publicNetwork.setUrl(ipAddress);
+            publicNetwork.setId(100);
+            publicNetwork.setCreationTime(new Date());
+            try {
+                networkService.save(publicNetwork);
+                return new Result(10000,"添加成功");
+            }catch (Exception e){
+                return new Result(10001,"添加失败");
+            }
+
+        }
+
+    }
+
+    @RequestMapping("/get")
+    public Result getNetwork(){
+        try {
+            PublicNetwork publicNetwork = networkService.getNetwork();
+            return new Result(10000,"查询成功",publicNetwork);
+        }catch (Exception e){
+            return new Result(10001,"查询失败");
+        }
+    }
+
+
+}

+ 44 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/domain/CameraInfo.java

@@ -0,0 +1,44 @@
+package com.huimv.video.domain;
+
+import lombok.Data;
+
+import javax.persistence.*;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.video.domain
+ * @Description : 摄像头信息管理
+ * @Author : yuxuexuan
+ * @Create : 2021/3/4 0007 13:46
+ **/
+@Entity
+@Data
+@Table(name = "camera_info")
+public class CameraInfo {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private int id;
+
+    @Column(name = "name")
+    private String name;
+
+    @Column(name = "account")
+    private String account;
+
+    @Column(name = "password")
+    private String password;
+
+    @Column(name = "area_name")
+    private String areaName;
+
+    @Column(name = "ip")
+    private String ip;
+
+    @Column(name = "area_id")
+    private String areaId;
+
+    @Column(name = "remark")
+    private String remark;
+
+}

+ 36 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/domain/PastureArea.java

@@ -0,0 +1,36 @@
+package com.huimv.video.domain;
+
+import lombok.Data;
+
+import javax.persistence.*;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.video.domain
+ * @Description : 牧场区域
+ * @Author : yuxuexuan
+ * @Create : 2021/3/4 0007 9:20
+ **/
+@Entity
+@Data
+@Table(name = "pasture_area")
+public class PastureArea {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private int id;
+
+    @Column(name = "name")
+    private String name;
+
+    @Column(name = "remark")
+    private String remark;
+
+    @Column(name = "parent_id")
+    private Integer parentId;
+
+    @Column(name = "sort")
+    private Integer sort;
+
+}

+ 38 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/domain/PublicNetwork.java

@@ -0,0 +1,38 @@
+package com.huimv.video.domain;
+
+import lombok.Data;
+import org.springframework.data.annotation.CreatedDate;
+
+import javax.persistence.*;
+import java.util.Date;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.video.domain
+ * @Description : 公网IP
+ * @Author : yuxuexuan
+ * @Create : 2021/3/4 0006 13:59
+ **/
+@Entity
+@Data
+@Table(name = "public_network")
+public class PublicNetwork {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private int id;
+
+    @Column(name = "url")
+    private String url;
+
+
+    @CreatedDate
+    @Temporal(TemporalType.TIMESTAMP)
+    @Column(name = "creation_time")
+    private Date creationTime;
+
+    @Column(name = "remark")
+    private String remark;
+
+}

+ 31 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/repo/CameraInfoRepo.java

@@ -0,0 +1,31 @@
+package com.huimv.video.repo;
+
+import com.huimv.video.domain.CameraInfo;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.video.repo
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/4 0007 13:57
+ **/
+public interface CameraInfoRepo extends JpaRepository<CameraInfo,Integer> , JpaSpecificationExecutor<CameraInfo> {
+//    @Query(nativeQuery = true,value = "select * from camera_info where name like %?1%")
+    List<CameraInfo> findByNameLike(String name);
+
+
+//    @Query(nativeQuery = true,value = "select * from camera_info where  area_id=?1")
+    List<CameraInfo> findAllByAreaId(Integer areaId);
+
+    @Modifying
+    @Transactional
+    @Query(nativeQuery = true,value = "DELETE FROM camera_info WHERE area_id=?1")
+    void deleteByAreaId(Integer areaId);
+}

+ 24 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/repo/PastureAreaRepo.java

@@ -0,0 +1,24 @@
+package com.huimv.video.repo;
+
+import com.huimv.video.domain.PastureArea;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.List;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.video.repo
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/4 0007 10:33
+ **/
+public interface PastureAreaRepo extends JpaRepository<PastureArea,Integer> , JpaSpecificationExecutor<PastureArea> {
+
+//    @Query(nativeQuery = true,value = "select * from pasture_area where parent=?1")
+    List<PastureArea> findAllByParentId(Integer id);
+
+//    @Query(nativeQuery = true,value = "select * from pasture_area where id=?1")
+    PastureArea findAllById(Integer id);
+}

+ 18 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/repo/PublicNetworkRepo.java

@@ -0,0 +1,18 @@
+package com.huimv.video.repo;
+
+import com.huimv.video.domain.PublicNetwork;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.video.repo
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/4 0006 14:09
+ **/
+public interface PublicNetworkRepo extends JpaRepository<PublicNetwork,Integer> , JpaSpecificationExecutor<PublicNetwork> {
+    @Query(nativeQuery = true,value = "SELECT * FROM public_network  ORDER BY id  DESC   LIMIT  1 ")
+    PublicNetwork findTopByIdDesc();
+}

+ 28 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/result/Result.java

@@ -0,0 +1,28 @@
+package com.huimv.video.result;
+
+import lombok.Data;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.face.result
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2020/12/29 0029 14:46
+ **/
+@Data
+public class Result {
+    private Integer  status;
+    private String msg;
+    private Object data;
+
+    public Result(Integer status, String msg, Object data) {
+        this.status = status;
+        this.msg = msg;
+        this.data = data;
+    }
+
+    public Result(Integer status, String msg) {
+        this.status = status;
+        this.msg = msg;
+    }
+}

+ 47 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/CameraInfoService.java

@@ -0,0 +1,47 @@
+package com.huimv.video.service;
+
+import com.huimv.video.domain.CameraInfo;
+
+import java.util.List;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.video.service
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/4 0007 13:54
+ **/
+public interface CameraInfoService {
+    void save(CameraInfo cameraInfo);
+
+    void update(CameraInfo cameraInfo);
+
+    void delete(List<Integer> ids);
+
+    List findAll();
+    //以上是crud
+
+    /*
+    * @Method      : searchAll
+    * @Description : 模糊查询,没有分页
+    * @Params      : [name]
+    * @Return      : java.util.List
+    * 
+    * @Author      : yuxuexuan
+    * @Date        : 2021/1/7 0007
+    * @Time        : 18:05 
+    */
+    List<CameraInfo> searchAll(String name);
+
+    /*
+     * @Method      : getCameraDetails
+     * @Description : 获取摄像头组合信息
+     * @Params      : []
+     * @Return      : java.util.List
+     *
+     * @Author      : yuxuexuan
+     * @Date        : 2021/1/7 0007
+     * @Time        : 19:01
+     */
+    List getCameraDetails(List<Integer> areaIds);
+}

+ 24 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/PastureAreaService.java

@@ -0,0 +1,24 @@
+package com.huimv.video.service;
+
+import com.huimv.video.domain.PastureArea;
+
+import java.util.List;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.video.service
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/4 0007 10:28
+ **/
+public interface PastureAreaService {
+    void save(PastureArea pastureArea);
+
+    void update(PastureArea pastureArea);
+
+    void delete(List<Integer> ids);
+
+    List findAll();
+    //以上是增删改查
+
+}

+ 36 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/PublicNetworkService.java

@@ -0,0 +1,36 @@
+package com.huimv.video.service;
+
+import com.huimv.video.domain.PublicNetwork;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.video.service
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/4 0006 14:09
+ **/
+public interface PublicNetworkService {
+    /*
+    * @Method      : save
+    * @Description : 获取请求接口的ip添加到数据库
+    * @Params      : [publicNetwork]
+    * @Return      : void
+    *
+    * @Author      : yuxuexuan
+    * @Date        : 2021/1/6 0006
+    * @Time        : 14:45
+    */
+    void save(PublicNetwork publicNetwork);
+
+    /*
+    * @Method      : getNetwork
+    * @Description : 拿到最新一条数据
+    * @Params      : []
+    * @Return      : com.huimv.video.domain.PublicNetwork
+    *
+    * @Author      : yuxuexuan
+    * @Date        : 2021/1/7 0007
+    * @Time        : 10:28
+    */
+    PublicNetwork getNetwork();
+}

+ 109 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/impl/CameraInfoServiceImpl.java

@@ -0,0 +1,109 @@
+package com.huimv.video.service.impl;
+
+import com.huimv.video.domain.CameraInfo;
+import com.huimv.video.domain.PastureArea;
+import com.huimv.video.repo.CameraInfoRepo;
+import com.huimv.video.repo.PastureAreaRepo;
+import com.huimv.video.repo.PublicNetworkRepo;
+import com.huimv.video.service.CameraInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.video.service.impl
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/4 0007 13:56
+ **/
+@Service
+public class CameraInfoServiceImpl implements CameraInfoService {
+    @Autowired
+    private CameraInfoRepo cameraInfoRepo;
+
+    @Autowired
+    private PublicNetworkRepo publicNetworkRepo;
+
+    @Autowired
+    private PastureAreaRepo pastureAreaRepo;
+
+    @Override
+    public void save(CameraInfo cameraInfo) {
+        cameraInfoRepo.save(cameraInfo);
+    }
+
+    @Override
+    public void update(CameraInfo cameraInfo) {
+        cameraInfoRepo.save(cameraInfo);
+    }
+
+    @Override
+    public void delete(List<Integer> ids) {
+        for (Integer id : ids) {
+            cameraInfoRepo.deleteById(id);
+        }
+    }
+
+    @Override
+    public List findAll() {
+        List list = new ArrayList();
+        List<CameraInfo> all = cameraInfoRepo.findAll();
+        for (CameraInfo cameraInfo : all) {
+            Map map = new HashMap();
+
+            PastureArea pastureArea = pastureAreaRepo.findAllById( Integer.parseInt(cameraInfo.getAreaId()));
+
+            if (pastureArea.getParentId() != null){
+                map.put("id",cameraInfo.getId());
+                map.put("name",cameraInfo.getName());
+                map.put("account",cameraInfo.getAccount());
+                map.put("password",cameraInfo.getPassword());
+                map.put("areaName",cameraInfo.getAreaName());
+                map.put("ip",cameraInfo.getIp());
+                map.put("areaId",cameraInfo.getAreaId());
+                map.put("remark",cameraInfo.getRemark());
+                map.put("areaParentId",pastureArea.getParentId());
+                list.add(map);
+            }else {
+                return list;
+            }
+
+        }
+
+
+        return list;
+    }
+
+    @Override
+    public List<CameraInfo> searchAll(String name) {
+
+        return cameraInfoRepo.findByNameLike(name);
+    }
+
+    @Override
+    public List getCameraDetails(List<Integer> areaIds) {
+        List cameraDetailsList = new ArrayList();
+        for (Integer areaId : areaIds) {
+            List<CameraInfo> cameraList = cameraInfoRepo.findAllByAreaId(areaId);
+            for (CameraInfo cameraInfo : cameraList) {
+                PastureArea pastureArea = pastureAreaRepo.findAllById( Integer.parseInt(cameraInfo.getAreaId()));
+                Map map = new HashMap();
+                String cameraAccount =  cameraInfo.getAccount();
+                String cameraPassword =  cameraInfo.getPassword();
+                String camerIp = cameraInfo.getIp();
+                map.put("wsUrl","ws://111.2.71.225:10080/camera_relay?tcpaddr=" + cameraAccount + "%3A" + cameraPassword+"%40"+camerIp);
+                map.put("rtspUrl","rtsp://"+cameraAccount+":"+cameraPassword+"@"+camerIp);
+                map.put("areaId",areaId);
+                map.put("areaParentId",pastureArea.getParentId());
+                cameraDetailsList.add(map);
+            }
+        }
+
+        return cameraDetailsList;
+    }
+}

+ 107 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/impl/PastureAreaServiceImpl.java

@@ -0,0 +1,107 @@
+package com.huimv.video.service.impl;
+
+import com.huimv.video.domain.CameraInfo;
+import com.huimv.video.domain.PastureArea;
+import com.huimv.video.repo.CameraInfoRepo;
+import com.huimv.video.repo.PastureAreaRepo;
+import com.huimv.video.service.PastureAreaService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Sort;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.video.service.impl
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/4 0007 10:32
+ **/
+@Service
+public class PastureAreaServiceImpl implements PastureAreaService {
+    @Autowired
+    private PastureAreaRepo pastureAreaRepo;
+
+    @Autowired
+    private CameraInfoRepo cameraInfoRepo;
+
+    @Override
+    public void save(PastureArea pastureArea) {
+        pastureAreaRepo.save(pastureArea);
+    }
+
+    @Override
+    public void update(PastureArea pastureArea) {
+        pastureAreaRepo.save(pastureArea);
+    }
+
+    @Override
+    public void delete(List<Integer> ids) {
+        for (Integer id : ids) {
+            List<PastureArea> list = pastureAreaRepo.findAllByParentId(id);
+            if (list != null && list.size()>0){
+                for (PastureArea pastureArea : list) {
+                    cameraInfoRepo.deleteByAreaId(pastureArea.getId());
+                    pastureAreaRepo.deleteById(pastureArea.getId());
+                }
+            }
+            pastureAreaRepo.deleteById(id);
+        }
+    }
+
+    @Override
+    public List findAll() {
+        List list  = new ArrayList();
+        Sort sort = Sort.by(Sort.Direction.ASC, "sort");
+        List<PastureArea> allArea = pastureAreaRepo.findAll(sort);
+        list = areaUtil(allArea);
+        return list;
+    }
+
+
+    public List areaUtil(List<PastureArea> areaList){
+        List<Map> list = new ArrayList<>();
+        for (PastureArea pastureArea : areaList) {
+            if(pastureArea.getParentId() == null){
+                return null;
+            }
+            if (pastureArea.getParentId()==0){
+                Map map  = new HashMap();
+                map.put("id", pastureArea.getId());
+                map.put("name", pastureArea.getName());
+                map.put("parentId", pastureArea.getParentId());
+                map.put("remark", pastureArea.getRemark());
+                map.put("sort",pastureArea.getSort());
+
+                List list1 = new ArrayList();
+                for (PastureArea area : areaList) {
+                    if (pastureArea.getId()==area.getParentId()){
+                        list1.add(area);
+                    }
+                }
+                map.put("children",list1);
+
+                list.add(map);
+            }
+        }
+
+
+
+        return list;
+    }
+
+
+    private boolean areaEntityIsChildren(PastureArea pastureArea, List<PastureArea> areaEntityList) {
+        for (PastureArea pastureAreas : areaEntityList) {
+            if (pastureArea.getId()==(pastureAreas.getParentId()) ){
+                return true;
+            }
+        }
+        return false;
+    }
+
+}

+ 29 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/impl/PublicNetworkServiceImpl.java

@@ -0,0 +1,29 @@
+package com.huimv.video.service.impl;
+
+import com.huimv.video.domain.PublicNetwork;
+import com.huimv.video.repo.PublicNetworkRepo;
+import com.huimv.video.service.PublicNetworkService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.video.service.impl
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/4 0006 14:09
+ **/
+@Service
+public class PublicNetworkServiceImpl implements PublicNetworkService {
+    @Autowired
+    private PublicNetworkRepo publicNetworkRepo;
+    @Override
+    public void save(PublicNetwork publicNetwork) {
+        publicNetworkRepo.save(publicNetwork);
+    }
+
+    @Override
+    public PublicNetwork getNetwork() {
+        return publicNetworkRepo.findTopByIdDesc();
+    }
+}

+ 53 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/util/IpUtil.java

@@ -0,0 +1,53 @@
+package com.huimv.video.util;
+
+import javax.servlet.http.HttpServletRequest;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.video.util
+ * @Description : 获取ip地址工具类
+ * @Author : yuxuexuan
+ * @Create : 2021/3/4 0006 14:28
+ **/
+public class IpUtil {
+    public static String getIpAddr(HttpServletRequest request) {
+        String ipAddress = null;
+        try {
+            ipAddress = request.getHeader("x-forwarded-for");
+            if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
+                ipAddress = request.getHeader("Proxy-Client-IP");
+            }
+            if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
+                ipAddress = request.getHeader("WL-Proxy-Client-IP");
+            }
+            if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
+                ipAddress = request.getRemoteAddr();
+                if (ipAddress.equals("127.0.0.1")) {
+                    // 根据网卡取本机配置的IP
+                    InetAddress inet = null;
+                    try {
+                        inet = InetAddress.getLocalHost();
+                    } catch (UnknownHostException e) {
+                        e.printStackTrace();
+                    }
+                    ipAddress = inet.getHostAddress();
+                }
+            }
+            // 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
+            if (ipAddress != null && ipAddress.length() > 15) { // "***.***.***.***".length()
+                // = 15
+                if (ipAddress.indexOf(",") > 0) {
+                    ipAddress = ipAddress.substring(0, ipAddress.indexOf(","));
+                }
+            }
+        } catch (Exception e) {
+            ipAddress="";
+        }
+        // ipAddress = this.getRequest().getRemoteAddr();
+
+        return ipAddress;
+    }
+
+}

+ 85 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/util/PropertiesUtils.java

@@ -0,0 +1,85 @@
+package com.huimv.video.util;
+
+import java.io.*;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.video.util
+ * @Description : TODO
+ * @Author : yuxuexuan
+ * @Create : 2021/3/4 0008 16:03
+ **/
+public  class PropertiesUtils {
+
+    /**
+     * 根据key获取prpperties中的某一项值
+     * @param key
+     * @param fileURL properties地址
+     * @return
+     */
+    public static String getFileIO(String key, String fileURL) {
+        java.util.Properties prop = new java.util.Properties();
+        InputStream in=null;
+        try {
+            in = new BufferedInputStream(new FileInputStream(fileURL));
+            prop.load(in);
+            //根据key 获得所对应的value
+            return prop.getProperty(key);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                in.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
+    /**
+     * 修改并写properties
+     * @param map
+     * @param fileURL
+     * @return
+     */
+    public static boolean writeData(Map<String, Object> map, String fileURL) {
+        java.util.Properties prop = new java.util.Properties();
+        InputStream fis = null;
+        OutputStream fos = null;
+        try {
+            //获得文件
+            File file = new File(fileURL);
+            //查看文件是否存在
+            if (!file.exists()){
+                return false;
+            }
+            fis = new FileInputStream(file);
+            prop.load(fis);
+            fis.close();// 一定要在修改值之前关闭fis
+            fos = new FileOutputStream(file);
+            Iterator<Map.Entry<String, Object>> valueSet = map.entrySet().iterator();
+            //便利map的值
+            while (valueSet.hasNext()) {
+                Map.Entry<String, Object> entry = (Map.Entry<String, Object>) valueSet.next();
+                String key = entry.getKey().toString();
+                String value= entry.getValue().toString();
+                prop.setProperty(key, value);
+                prop.store(fos, "Update '" + key + "' value");
+            }
+            fos.close();
+            return true;
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                fos.close();
+                fis.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return false;
+    }
+}

+ 12 - 12
huimv-ql-farm/huimv-ql-video/src/main/resources/application-dev.yml

@@ -4,18 +4,18 @@ spring:
   application:
     name: environment
 
-#  datasource:
-#    url: jdbc:mysql://192.168.1.7:3306/eartag_db?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
+  datasource:
+    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:
+    show-sql: true
+    database: mysql
+    hibernate:
+      ddl-auto: update
+    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+    open-in-view: true
 
     #  redis:
 #    database: 0