Quellcode durchsuchen

添加手机摄像头功能

523096025 vor 4 Jahren
Ursprung
Commit
0b2d201a0d
27 geänderte Dateien mit 638 neuen und 43 gelöschten Zeilen
  1. 2 1
      huimv-ql-farm/huimv-ql-environment/src/main/resources/application-dev1.yml
  2. 2 2
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/controller/BaoyvCountController.java
  3. 2 2
      huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/domain/MConceptionRatioEntity.java
  4. 2 1
      huimv-ql-farm/huimv-ql-production/src/main/resources/application-dev.yml
  5. 2 1
      huimv-ql-farm/huimv-ql-security/src/main/resources/application-dev.yml
  6. 20 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/controller/CameraInfoController.java
  7. 45 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/controller/MobileAttentionController.java
  8. 56 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/controller/MobileUserController.java
  9. 34 2
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/controller/PastureAreaController.java
  10. 25 27
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/domain/CameraInfo.java
  11. 24 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/domain/MobileAttention.java
  12. 30 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/domain/MobileUser.java
  13. 3 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/domain/PastureArea.java
  14. 6 1
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/repo/CameraInfoRepo.java
  15. 13 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/repo/MobileAttentionRepository.java
  16. 12 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/repo/MobileUserRepository.java
  17. 2 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/repo/PastureAreaRepo.java
  18. 15 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/result/ResultStatus.java
  19. 4 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/CameraInfoService.java
  20. 27 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/MobileAttentionService.java
  21. 29 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/MobileUserService.java
  22. 7 1
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/PastureAreaService.java
  23. 21 4
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/impl/CameraInfoServiceImpl.java
  24. 112 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/impl/MobileAttentionServiceImpl.java
  25. 107 0
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/impl/MobileUserServiceImpl.java
  26. 35 1
      huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/impl/PastureAreaServiceImpl.java
  27. 1 0
      huimv-ql-farm/huimv-ql-video/src/main/resources/application-dev.yml

+ 2 - 1
huimv-ql-farm/huimv-ql-environment/src/main/resources/application-dev1.yml

@@ -6,7 +6,8 @@ spring:
 
   #------DataSource-----
   datasource:
-    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+#    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm_youchegang?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
     username: root
     password: hm123456
     driver-class-name: com.mysql.cj.jdbc.Driver

+ 2 - 2
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/controller/BaoyvCountController.java

@@ -28,7 +28,7 @@ public class BaoyvCountController {
 	@RequestMapping("/findAll")
 	public Result findAll(){ return service.findAll(); }
 
-@RequestMapping("/findAllById")
-public Result findAllById(Integer id){ return service.findAllById(id); }
+	@RequestMapping("/findAllById")
+	public Result findAllById(Integer id){ return service.findAllById(id); }
 
 }

+ 2 - 2
huimv-ql-farm/huimv-ql-production/src/main/java/com/huimv/production/domain/MConceptionRatioEntity.java

@@ -20,8 +20,8 @@ public class MConceptionRatioEntity implements Serializable {
     @Column(name = "year")
     private Integer year;
 
-    @Column(name = "date")
-    private String date;
+    @Column(name = "month")
+    private String month;
 
     @Column(name = "ratio")
     private Float ratio;

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

@@ -5,7 +5,8 @@ spring:
     name: environment
 
   datasource:
-    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+#    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm_youchegang?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
     username: root
     password: hm123456
     driver-class-name: com.mysql.cj.jdbc.Driver

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

@@ -5,7 +5,8 @@ spring:
     name: environment
 
   datasource:
-    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+#    url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm_youchegang?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
     username: root
     password: hm123456
     driver-class-name: com.mysql.cj.jdbc.Driver

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

@@ -91,4 +91,24 @@ public class CameraInfoController {
             return new Result(10001,"查询失败");
         }
     }
+
+    @RequestMapping("/findAllByAttention")
+    private Result findAllByAttention(){
+        try {
+            List list =  cameraInfoService.findAllByAttention();
+            return new Result(10000,"查询成功",list);
+        }catch (Exception e){
+            return new Result(10001,"查询失败");
+        }
+    }
+
+    @RequestMapping("/updateAttention")
+    private Result updateAttention(Integer id,Integer attention){
+        try {
+              cameraInfoService.updateAttention(id,attention);
+            return new Result(10000,"修改成功");
+        }catch (Exception e){
+            return new Result(10001,"修改失败");
+        }
+    }
 }

+ 45 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/controller/MobileAttentionController.java

@@ -0,0 +1,45 @@
+package com.huimv.video.controller;
+
+
+import com.huimv.video.domain.MobileAttention;
+import com.huimv.video.result.Result;
+import com.huimv.video.service.MobileAttentionService;
+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;
+
+@RestController
+@CrossOrigin
+@RequestMapping("/mobileAttention")
+public class MobileAttentionController {
+
+	@Autowired
+	private MobileAttentionService service;
+
+	@RequestMapping("/add")
+	public Result add(MobileAttention childcareEntity){ return service.add(childcareEntity); }
+
+	@RequestMapping("/remove")
+	public Result add(Integer[] ids){ return service.remove(ids); }
+
+	@RequestMapping("/update")
+	public Result update(MobileAttention childcareEntity){ return service.update(childcareEntity); }
+
+	@RequestMapping("/findAll")
+	public Result findAll(){ return service.findAll(); }
+
+	@RequestMapping("/findAllById")
+	public Result findAllById(Integer id){ return service.findAllById(id); }
+
+	@RequestMapping("/findAllByAttention")
+	public Result findAllByAttention(Integer userId){ return service.findAllByAttention(userId); }
+
+	@RequestMapping("/updateAttention")
+	private Result updateAttention(Integer userId,Integer areaId){
+
+		return 	service.updateAttention(userId,areaId);
+
+	}
+
+}

+ 56 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/controller/MobileUserController.java

@@ -0,0 +1,56 @@
+package com.huimv.video.controller;
+
+
+import com.huimv.video.domain.MobileUser;
+import com.huimv.video.result.Result;
+import com.huimv.video.service.CameraInfoService;
+import com.huimv.video.service.MobileUserService;
+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.ArrayList;
+import java.util.List;
+
+@RestController
+@CrossOrigin
+@RequestMapping("/mobileUser")
+public class MobileUserController {
+
+	@Autowired
+	private MobileUserService service;
+
+	@Autowired
+	private CameraInfoService cameraInfoService;
+
+	@RequestMapping("/register")
+	public Result add(MobileUser childcareEntity){ return service.add(childcareEntity); }
+
+	@RequestMapping("/remove")
+	public Result add(Integer[] ids){ return service.remove(ids); }
+
+	@RequestMapping("/update")
+	public Result update(MobileUser childcareEntity){ return service.update(childcareEntity); }
+
+	@RequestMapping("/findAll")
+	public Result findAll(){ return service.findAll(); }
+
+	@RequestMapping("/findAllById")
+	public Result findAllById(Integer id){ return service.findAllById(id); }
+
+	@RequestMapping("/updateIndex")
+	public Result updateIndex(Integer id,Integer userId){ return service.updateIndex(id,userId); }
+
+	@RequestMapping("/findIndex")
+	public Result findIndex(Integer userId){
+		List<Integer> list = new ArrayList();
+		list.add(service.findIndex(userId));
+		List cameraDetails = cameraInfoService.getCameraDetails(list);
+		return new Result(10000,"查询成功",cameraDetails);
+	}
+
+	@RequestMapping("/login")
+	public Result login(String account, String password){ return service.login(account,password); }
+
+}

+ 34 - 2
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/controller/PastureAreaController.java

@@ -70,9 +70,9 @@ public class PastureAreaController {
     }
 
     @RequestMapping("/findAll")
-    private Result findAll(){
+    private Result findAll(Integer userId){
         try {
-            List list = pastureAreaService.findAll();
+            List list = pastureAreaService.findAll(userId);
             if (list == null){
                 return new Result(10000,"暂时没有数据");
             }
@@ -81,6 +81,38 @@ public class PastureAreaController {
             return new Result(10001,"查询失败");
         }
     }
+    @RequestMapping("/findById")
+    private Result findById(Integer id){
+        try {
+            PastureArea pastureArea = pastureAreaService.findById(id);
+            return new Result(10000,"设置成功",pastureArea);
+        }catch (Exception e){
+            return new Result(10001,"设置失败");
+        }
+    }
+
+    @RequestMapping("/findAllByAttention")
+    private Result findAllByAttention(){
+        try {
+            List list =  pastureAreaService.findAllByAttention();
+            return new Result(10000,"查询成功",list);
+        }catch (Exception e){
+            return new Result(10001,"查询失败");
+        }
+    }
+
+    @RequestMapping("/updateAttention")
+    private Result updateAttention(Integer id,Integer attention){
+        try {
+            pastureAreaService.updateAttention(id,attention);
+            if (attention == 0){
+                return new Result(10000,"取消关注成功");
+            }
+            return new Result(10000,"关注成功");
+        }catch (Exception e){
+            return new Result(10001,"关注失败");
+        }
+    }
 
 
 

+ 25 - 27
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/domain/CameraInfo.java

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

+ 24 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/domain/MobileAttention.java

@@ -0,0 +1,24 @@
+package com.huimv.video.domain;
+
+import lombok.Data;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Data
+@Entity
+@Table(name = "mobile_attention")
+public class MobileAttention implements Serializable {
+
+	@Id
+	@GeneratedValue(strategy = GenerationType.IDENTITY)
+	@Column(name = "id")
+	private Integer id;
+
+	@Column(name = "user_id")
+	private Integer userId;
+
+	@Column(name = "area_id")
+	private Integer areaId;
+
+}

+ 30 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/domain/MobileUser.java

@@ -0,0 +1,30 @@
+package com.huimv.video.domain;
+
+import lombok.Data;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Data
+@Entity
+@Table(name = "mobile_user")
+public class MobileUser implements Serializable {
+
+	@Id
+	@GeneratedValue(strategy = GenerationType.IDENTITY)
+	@Column(name = "id")
+	private Integer id;
+
+	@Column(name = "user_name")
+	private String userName;
+
+	@Column(name = "password")
+	private String password;
+
+	@Column(name = "account")
+	private String account;
+
+	@Column(name = "index_video")
+	private Integer indexVideo;
+
+}

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

@@ -33,4 +33,7 @@ public class PastureArea {
     @Column(name = "sort")
     private Integer sort;
 
+    @Column(name = "attention")
+    private Integer attention;
+
 }

+ 6 - 1
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/repo/CameraInfoRepo.java

@@ -22,10 +22,15 @@ public interface CameraInfoRepo extends JpaRepository<CameraInfo,Integer> , JpaS
 
 
 //    @Query(nativeQuery = true,value = "select * from camera_info where  area_id=?1")
-    List<CameraInfo> findAllByAreaId(String areaId);
+    List<CameraInfo> findAllByAreaId(Integer areaId);
 
     @Modifying
     @Transactional
     @Query(nativeQuery = true,value = "DELETE FROM camera_info WHERE area_id=?1")
     void deleteByAreaId(Integer areaId);
+
+    List<CameraInfo> findAllByAttention(Integer attention);
+
+
+
 }

+ 13 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/repo/MobileAttentionRepository.java

@@ -0,0 +1,13 @@
+package com.huimv.video.repo;
+
+import com.huimv.video.domain.MobileAttention;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+import java.util.List;
+
+public interface MobileAttentionRepository extends JpaRepository<MobileAttention, Integer>,JpaSpecificationExecutor<MobileAttention>{
+    List<MobileAttention> findAllByUserId(Integer userId);
+
+    MobileAttention findByUserIdAndAreaId(Integer userId ,Integer areaId);
+}

+ 12 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/repo/MobileUserRepository.java

@@ -0,0 +1,12 @@
+package com.huimv.video.repo;
+
+import com.huimv.video.domain.MobileUser;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+public interface MobileUserRepository extends JpaRepository<MobileUser, Integer>,JpaSpecificationExecutor<MobileUser>{
+
+    MobileUser findByAccountAndPassword(String account, String password);
+
+
+}

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

@@ -21,4 +21,6 @@ public interface PastureAreaRepo extends JpaRepository<PastureArea,Integer> , Jp
 
 //    @Query(nativeQuery = true,value = "select * from pasture_area where id=?1")
     PastureArea findAllById(Integer id);
+
+    List findAllByAttention(int i);
 }

+ 15 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/result/ResultStatus.java

@@ -0,0 +1,15 @@
+package com.huimv.video.result;
+
+public  class ResultStatus {
+	public  final static String addNull = "没有输入参数";
+	public  final static String addSuccess = "添加成功";
+	public  final static String addFailed = "添加失败";
+	public  final static String deleteNull = "没有要删除的数据";
+	public  final static String deleteSuccess = "删除成功";
+	public  final static String deleteFailed = "删除失败";
+	public  final static String updateNull = "没有要修改的数据";
+	public  final static String updateSuccess = "修改成功";
+	public  final static String updateFailed = "修改失败";
+	public  final static String findSuccess = "查询成功";
+	public  final static String findFailed = "查询失败";
+}

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

@@ -44,4 +44,8 @@ public interface CameraInfoService {
      * @Time        : 19:01
      */
     List getCameraDetails(List<Integer> areaIds);
+
+    List findAllByAttention();
+
+    void updateAttention(Integer id,Integer attention);
 }

+ 27 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/MobileAttentionService.java

@@ -0,0 +1,27 @@
+package com.huimv.video.service;
+
+
+import com.huimv.video.domain.MobileAttention;
+import com.huimv.video.result.Result;
+
+public interface MobileAttentionService  {
+
+   //添加
+   Result add(MobileAttention entity);
+
+   //添加
+   Result remove(Integer[] ids);
+
+   //添加
+   Result update(MobileAttention entity);
+
+   //查询
+   Result findAll();
+
+   //根据id查找
+   Result findAllById(Integer id);
+
+   Result findAllByAttention(Integer userId);
+
+   Result updateAttention(Integer userId, Integer areaId);
+}

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

@@ -0,0 +1,29 @@
+package com.huimv.video.service;
+
+
+import com.huimv.video.domain.MobileUser;
+import com.huimv.video.result.Result;
+
+public interface MobileUserService  {
+
+   //添加
+   Result add(MobileUser entity);
+
+   //添加
+   Result remove(Integer[] ids);
+
+   //添加
+   Result update(MobileUser entity);
+
+   //查询
+   Result findAll();
+
+   //根据id查找
+   Result findAllById(Integer id);
+
+    Result login(String account, String password);
+
+   Result updateIndex(Integer id, Integer userId);
+
+   Integer findIndex(Integer userId);
+}

+ 7 - 1
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/PastureAreaService.java

@@ -18,7 +18,13 @@ public interface PastureAreaService {
 
     void delete(List<Integer> ids);
 
-    List findAll();
+    List findAll(Integer userId);
+
+    List findAllByAttention();
+
+    void updateAttention(Integer id, Integer attention);
+
+    PastureArea findById(Integer id);
     //以上是增删改查
 
 }

+ 21 - 4
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/impl/CameraInfoServiceImpl.java

@@ -56,7 +56,7 @@ public class CameraInfoServiceImpl implements CameraInfoService {
         for (CameraInfo cameraInfo : all) {
             Map map = new HashMap();
 
-            PastureArea pastureArea = pastureAreaRepo.findAllById( Integer.parseInt(cameraInfo.getAreaId()));
+            PastureArea pastureArea = pastureAreaRepo.findAllById( cameraInfo.getAreaId());
 
             if (pastureArea.getParentId() != null){
                 map.put("id",cameraInfo.getId());
@@ -91,22 +91,39 @@ public class CameraInfoServiceImpl implements CameraInfoService {
     public List getCameraDetails(List<Integer> areaIds) {
         List cameraDetailsList = new ArrayList();
         for (Integer areaId : areaIds) {
-            List<CameraInfo> cameraList = cameraInfoRepo.findAllByAreaId(areaId+"");
+            List<CameraInfo> cameraList = cameraInfoRepo.findAllByAreaId(areaId);
             for (CameraInfo cameraInfo : cameraList) {
-                PastureArea pastureArea = pastureAreaRepo.findAllById( Integer.parseInt(cameraInfo.getAreaId()));
+                PastureArea pastureArea = pastureAreaRepo.findAllById( cameraInfo.getAreaId());
+                PastureArea pastureArea1   = pastureAreaRepo.findAllById(pastureArea.getParentId());
                 Map map = new HashMap();
                 String cameraAccount =  cameraInfo.getAccount();
                 String cameraPassword =  cameraInfo.getPassword();
                 String camerIp = cameraInfo.getIp();
+                String url = publicNetworkRepo.getOne(1).getUrl();
 //                map.put("wsUrl","ws://111.2.71.225:10080/camera_relay?tcpaddr=" + cameraAccount + "%3A" + cameraPassword+"%40"+camerIp);
-                map.put("wsUrl","ws://36.22.189.214:10080/camera_relay?tcpaddr=" + cameraAccount + "%3A" + cameraPassword+"%40"+camerIp);
+                map.put("wsUrl","ws://"+url+"/camera_relay?tcpaddr=" + cameraAccount + "%3A" + cameraPassword+"%40"+camerIp);
                 map.put("rtspUrl","rtsp://"+cameraAccount+":"+cameraPassword+"@"+camerIp);
                 map.put("areaId",areaId);
                 map.put("areaParentId",pastureArea.getParentId());
+                map.put("name",pastureArea1.getName() + " "+cameraInfo.getName());
+
                 cameraDetailsList.add(map);
             }
         }
 
         return cameraDetailsList;
     }
+
+    @Override
+    public List findAllByAttention() {
+        return  cameraInfoRepo.findAllByAttention(1);
+    }
+
+    @Override
+    public void updateAttention(Integer id,Integer attention) {
+        CameraInfo cameraInfo = cameraInfoRepo.findById(id).get();
+        cameraInfo.setAttention(attention);
+        cameraInfoRepo.save(cameraInfo);
+
+    }
 }

+ 112 - 0
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/impl/MobileAttentionServiceImpl.java

@@ -0,0 +1,112 @@
+package com.huimv.video.service.impl;
+
+
+import com.huimv.video.domain.MobileAttention;
+import com.huimv.video.repo.MobileAttentionRepository;
+import com.huimv.video.repo.MobileUserRepository;
+import com.huimv.video.repo.PastureAreaRepo;
+import com.huimv.video.result.Result;
+import com.huimv.video.result.ResultStatus;
+import com.huimv.video.service.MobileAttentionService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class MobileAttentionServiceImpl implements MobileAttentionService {
+
+	@Autowired
+	private MobileAttentionRepository rep;
+
+	@Autowired
+	private PastureAreaRepo areaRepo;
+
+	@Override
+	public Result add(MobileAttention entity){
+		if (entity == null){
+			return new Result(10002, ResultStatus.addNull);
+		}
+		try {
+			rep.save(entity);
+			return new Result(10000,ResultStatus.addSuccess);
+		}catch (Exception e){
+			return new Result(10001,ResultStatus.addFailed);
+		}
+	}
+
+	@Override
+	public Result remove(Integer[] ids) {
+		if (ids == null || ids.length==0){
+			return new Result(10002,ResultStatus.deleteNull);
+		}
+		try {
+			for (Integer id : ids) {
+				rep.deleteById(id);
+			}
+			return new Result(10000,ResultStatus.deleteSuccess);
+		}catch (Exception e){
+			return new Result(10001,ResultStatus.deleteFailed);
+		}
+	}
+
+	@Override
+	public Result update(MobileAttention entity) {
+		if (entity == null){
+			return new Result(10002,ResultStatus.updateNull);
+		}
+		try {
+			rep.save(entity);
+			return new Result(10000,ResultStatus.updateSuccess);
+		}catch (Exception e){
+			return new Result(10001,ResultStatus.updateFailed);
+		}
+	}
+
+	@Override
+	public Result findAll() {
+		try {
+			List<MobileAttention> all = rep.findAll();
+			return new Result(10000,ResultStatus.findSuccess,all);
+		}catch (Exception e){
+			return new Result(10001,ResultStatus.findFailed,null);
+		}
+	}
+
+	@Override
+	public Result findAllById(Integer id) {
+		try {
+			MobileAttention entity = rep.findById(id).get();
+			return new Result(10000,ResultStatus.findSuccess,entity);
+		}catch (Exception e){
+			return new Result(10001,ResultStatus.findFailed,null);
+		}
+	}
+
+	@Override
+	public Result findAllByAttention(Integer userId) {
+		List endList  = new ArrayList();
+		List<MobileAttention> allByUserId = rep.findAllByUserId(userId);
+
+		for (MobileAttention mobileAttention : allByUserId) {
+			endList.add(areaRepo.findAllById(mobileAttention.getAreaId()));
+		}
+		return new Result(10000,"查询成功",endList);
+	}
+
+	@Override
+	public Result updateAttention(Integer userId, Integer areaId) {
+		MobileAttention mobileAttention = new MobileAttention();
+		MobileAttention byUserIdAndAreaId = rep.findByUserIdAndAreaId(userId, areaId);
+		if (byUserIdAndAreaId ==null ){
+
+			mobileAttention.setAreaId(areaId);
+			mobileAttention.setUserId(userId);
+			rep.save(mobileAttention);
+			return new Result(10000,"关注成功");
+		}
+		rep.delete(byUserIdAndAreaId);
+		return new Result(10000,"取消关注成功");
+	}
+}

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

@@ -0,0 +1,107 @@
+package com.huimv.video.service.impl;
+
+import com.huimv.video.domain.MobileUser;
+import com.huimv.video.repo.MobileUserRepository;
+import com.huimv.video.result.Result;
+import com.huimv.video.result.ResultStatus;
+import com.huimv.video.service.MobileUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.DigestUtils;
+
+import java.util.List;
+
+@Service
+public class MobileUserServiceImpl implements MobileUserService {
+
+	@Autowired
+	private MobileUserRepository rep;
+
+	@Override
+	public Result add(MobileUser entity){
+		if (entity == null){
+			return new Result(10002, ResultStatus.addNull);
+		}
+		try {
+			String password = entity.getPassword();
+			entity.setPassword(DigestUtils.md5DigestAsHex(password.getBytes()));
+			rep.save(entity);
+			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,ResultStatus.deleteNull);
+		}
+		try {
+			for (Integer id : ids) {
+				rep.deleteById(id);
+			}
+			return new Result(10000,ResultStatus.deleteSuccess);
+		}catch (Exception e){
+			return new Result(10001,ResultStatus.deleteFailed);
+		}
+	}
+
+	@Override
+	public Result update(MobileUser entity) {
+		if (entity == null){
+			return new Result(10002,ResultStatus.updateNull);
+		}
+		try {
+			rep.save(entity);
+			return new Result(10000,ResultStatus.updateSuccess);
+		}catch (Exception e){
+			return new Result(10001,ResultStatus.updateFailed);
+		}
+	}
+
+	@Override
+	public Result findAll() {
+		try {
+			List<MobileUser> all = rep.findAll();
+			return new Result(10000,ResultStatus.findSuccess,all);
+		}catch (Exception e){
+			return new Result(10001,ResultStatus.findFailed,null);
+		}
+	}
+
+	@Override
+	public Result findAllById(Integer id) {
+		try {
+			MobileUser entity = rep.findById(id).get();
+			return new Result(10000,ResultStatus.findSuccess,entity);
+		}catch (Exception e){
+			return new Result(10001,ResultStatus.findFailed,null);
+		}
+	}
+
+	@Override
+	public Result login(String account, String password) {
+		password = DigestUtils.md5DigestAsHex(password.getBytes());
+		MobileUser byUserNameAndPassword = rep.findByAccountAndPassword(account, password);
+		if (byUserNameAndPassword == null){
+			return new Result(10001,"登录失败",null);
+		}
+		return new Result(10000,"登录成功",byUserNameAndPassword);
+	}
+
+	@Override
+	public Result updateIndex(Integer id, Integer userId) {
+		MobileUser mobileUser = rep.findById(userId).get();
+		mobileUser.setIndexVideo(id);
+		rep.save(mobileUser);
+		return new Result(10000,"设置成功");
+	}
+
+	@Override
+	public Integer findIndex(Integer userId) {
+
+		return rep.findById(userId).get().getIndexVideo();
+	}
+
+}

+ 35 - 1
huimv-ql-farm/huimv-ql-video/src/main/java/com/huimv/video/service/impl/PastureAreaServiceImpl.java

@@ -1,9 +1,12 @@
 package com.huimv.video.service.impl;
 
 import com.huimv.video.domain.CameraInfo;
+import com.huimv.video.domain.MobileAttention;
 import com.huimv.video.domain.PastureArea;
 import com.huimv.video.repo.CameraInfoRepo;
+import com.huimv.video.repo.MobileAttentionRepository;
 import com.huimv.video.repo.PastureAreaRepo;
+import com.huimv.video.result.Result;
 import com.huimv.video.service.PastureAreaService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Sort;
@@ -29,6 +32,9 @@ public class PastureAreaServiceImpl implements PastureAreaService {
     @Autowired
     private CameraInfoRepo cameraInfoRepo;
 
+    @Autowired
+    private MobileAttentionRepository attentionRepository;
+
     @Override
     public void save(PastureArea pastureArea) {
         pastureAreaRepo.save(pastureArea);
@@ -54,10 +60,19 @@ public class PastureAreaServiceImpl implements PastureAreaService {
     }
 
     @Override
-    public List findAll() {
+    public List findAll(Integer userId) {
         List list  = new ArrayList();
         Sort sort = Sort.by(Sort.Direction.ASC, "sort");
+        List<MobileAttention> allByUserId = attentionRepository.findAllByUserId(userId);
         List<PastureArea> allArea = pastureAreaRepo.findAll(sort);
+        for (MobileAttention mobileAttention : allByUserId) {
+            for (PastureArea pastureArea : allArea) {
+                if (pastureArea.getId() == mobileAttention.getAreaId()){
+                    pastureArea.setAttention(1);
+                }
+            }
+        }
+
         list = areaUtil(allArea);
         return list;
     }
@@ -104,4 +119,23 @@ public class PastureAreaServiceImpl implements PastureAreaService {
         return false;
     }
 
+
+    @Override
+    public List findAllByAttention() {
+        return  pastureAreaRepo.findAllByAttention(1);
+    }
+
+    @Override
+    public void updateAttention(Integer id,Integer attention) {
+        PastureArea pastureArea = pastureAreaRepo.findById(id).get();
+        pastureArea.setAttention(attention);
+        pastureAreaRepo.save(pastureArea);
+
+    }
+
+    @Override
+    public PastureArea findById(Integer id) {
+
+        return  pastureAreaRepo.findAllById(id);
+    }
 }

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

@@ -6,6 +6,7 @@ spring:
 
   datasource:
     url: jdbc:mysql://192.168.1.7:3306/huimv_ql_farm?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
+#    url: jdbc:mysql://127.0.0.1:3306/huimv_ql_farm_youchegang?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&serverTimezone=Asia/Shanghai
     username: root
     password: hm123456
     driver-class-name: com.mysql.cj.jdbc.Driver