Bladeren bron

摄像头

bihuisong 3 maanden geleden
bovenliggende
commit
41fa8d47a1

+ 95 - 0
zhjq-business/src/main/java/com/zhjq/controller/ZhjqCameraController.java

@@ -0,0 +1,95 @@
+package com.zhjq.controller;
+
+import com.zhjq.common.annotation.Log;
+import com.zhjq.common.core.controller.BaseController;
+import com.zhjq.common.core.domain.AjaxResult;
+import com.zhjq.common.core.page.TableDataInfo;
+import com.zhjq.common.enums.BusinessType;
+import com.zhjq.common.utils.poi.ExcelUtil;
+import com.zhjq.domain.ZhjqCamera;
+import com.zhjq.service.IZhjqCameraService;
+import com.zhjq.utils.GetCameras;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 摄像头Controller
+ *
+ * @author ruoyi
+ * @date 2025-03-04
+ */
+@RestController
+@RequestMapping("/system/camera")
+public class ZhjqCameraController extends BaseController {
+    @Autowired
+    private IZhjqCameraService zhjqCameraService;
+
+    /**
+     * 查询摄像头列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(ZhjqCamera zhjqCamera) {
+        startPage();
+        List<ZhjqCamera> list = zhjqCameraService.selectZhjqCameraList(zhjqCamera);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出摄像头列表
+     */
+    @Log(title = "摄像头", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, ZhjqCamera zhjqCamera) {
+        List<ZhjqCamera> list = zhjqCameraService.selectZhjqCameraList(zhjqCamera);
+        ExcelUtil<ZhjqCamera> util = new ExcelUtil<ZhjqCamera>(ZhjqCamera.class);
+        util.exportExcel(response, list, "摄像头数据");
+    }
+
+    /**
+     * 获取摄像头详细信息
+     */
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") String id) {
+        return success(zhjqCameraService.selectZhjqCameraById(id));
+    }
+
+    /**
+     * 新增摄像头
+     */
+    @Log(title = "摄像头", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody ZhjqCamera zhjqCamera) {
+        return toAjax(zhjqCameraService.insertZhjqCamera(zhjqCamera));
+    }
+
+    /**
+     * 修改摄像头
+     */
+    @Log(title = "摄像头", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody ZhjqCamera zhjqCamera) {
+        return toAjax(zhjqCameraService.updateZhjqCamera(zhjqCamera));
+    }
+
+    /**
+     * 删除摄像头
+     */
+    @Log(title = "摄像头", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable String[] ids) {
+        return toAjax(zhjqCameraService.deleteZhjqCameraByIds(ids));
+    }
+
+    /**
+     * 同步获取hik摄像头
+     */
+    @GetMapping("/getCameraList")
+    public AjaxResult getCameraList() {
+        List<ZhjqCamera> list = GetCameras.cameras("218.62.80.146:1443", "28356728", "C3K889wQUgVlSj1BMay6", "1", "1000");
+        return toAjax(zhjqCameraService.insertBatchZhjqCamera(list));
+    }
+
+}

+ 19 - 7
zhjq-business/src/main/java/com/zhjq/controller/ZhjqPassengerFlowController.java

@@ -1,5 +1,6 @@
 package com.zhjq.controller;
 
+import com.alibaba.fastjson2.JSONObject;
 import com.zhjq.common.annotation.Log;
 import com.zhjq.common.core.controller.BaseController;
 import com.zhjq.common.core.domain.AjaxResult;
@@ -9,7 +10,6 @@ import com.zhjq.common.utils.poi.ExcelUtil;
 import com.zhjq.domain.ZhjqPassengerFlow;
 import com.zhjq.service.IZhjqPassengerFlowService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
@@ -30,7 +30,6 @@ public class ZhjqPassengerFlowController extends BaseController {
     /**
      * 查询客流量统计列表
      */
-    @PreAuthorize("@ss.hasPermi('system:flow:list')")
     @GetMapping("/list")
     public TableDataInfo list(ZhjqPassengerFlow zhjqPassengerFlow) {
         startPage();
@@ -41,7 +40,6 @@ public class ZhjqPassengerFlowController extends BaseController {
     /**
      * 导出客流量统计列表
      */
-    @PreAuthorize("@ss.hasPermi('system:flow:export')")
     @Log(title = "客流量统计", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(HttpServletResponse response, ZhjqPassengerFlow zhjqPassengerFlow) {
@@ -53,7 +51,6 @@ public class ZhjqPassengerFlowController extends BaseController {
     /**
      * 获取客流量统计详细信息
      */
-    @PreAuthorize("@ss.hasPermi('system:flow:query')")
     @GetMapping(value = "/{id}")
     public AjaxResult getInfo(@PathVariable("id") Long id) {
         return success(zhjqPassengerFlowService.selectZhjqPassengerFlowById(id));
@@ -62,7 +59,6 @@ public class ZhjqPassengerFlowController extends BaseController {
     /**
      * 新增客流量统计
      */
-    @PreAuthorize("@ss.hasPermi('system:flow:add')")
     @Log(title = "客流量统计", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody ZhjqPassengerFlow zhjqPassengerFlow) {
@@ -72,7 +68,6 @@ public class ZhjqPassengerFlowController extends BaseController {
     /**
      * 修改客流量统计
      */
-    @PreAuthorize("@ss.hasPermi('system:flow:edit')")
     @Log(title = "客流量统计", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody ZhjqPassengerFlow zhjqPassengerFlow) {
@@ -82,10 +77,27 @@ public class ZhjqPassengerFlowController extends BaseController {
     /**
      * 删除客流量统计
      */
-    @PreAuthorize("@ss.hasPermi('system:flow:remove')")
     @Log(title = "客流量统计", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(zhjqPassengerFlowService.deleteZhjqPassengerFlowByIds(ids));
     }
+
+    /**
+     * 可视化客流量统计
+     */
+    @Log(title = "可视化客流量统计", businessType = BusinessType.OTHER)
+    @PostMapping("/selectAllStatistics")
+    public AjaxResult selectAllStatistics(@RequestBody JSONObject jsonObject) {
+        return AjaxResult.success(zhjqPassengerFlowService.selectAllStatistics(jsonObject));
+    }
+
+    /**
+     * 获取客流量统计组名称
+     */
+    @GetMapping(value = "/selectGroupName")
+    public AjaxResult selectGroupName() {
+        return success(zhjqPassengerFlowService.selectGroupName());
+    }
+
 }

+ 94 - 0
zhjq-business/src/main/java/com/zhjq/domain/ZhjqCamera.java

@@ -0,0 +1,94 @@
+package com.zhjq.domain;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.zhjq.common.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+
+/**
+ * 摄像头对象 zhjq_camera
+ *
+ * @author ruoyi
+ * @date 2025-03-04
+ */
+@Data
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ZhjqCamera {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键id
+     */
+    private String id;
+
+    /**
+     * 监控点唯一标识
+     */
+    @Excel(name = "监控点唯一标识")
+    private String cameraIndexCode;
+
+    /**
+     * 设备唯一标识
+     */
+    @Excel(name = "设备唯一标识")
+    private String encodeDevIndexCode;
+
+    /**
+     * 摄像头名称
+     */
+    @Excel(name = "摄像头名称")
+    private String cameraName;
+
+    /**
+     * 摄像头类型(0:枪机;1:半球;2:快球;3:云台枪机)
+     */
+    @Excel(name = "摄像头类型(0:枪机;1:半球;2:快球;3:云台枪机)")
+    private Integer cameraType;
+
+    /**
+     * 摄像头类型
+     */
+    @Excel(name = "摄像头类型")
+    private String cameraTypeName;
+
+    /**
+     * 经度
+     */
+    @Excel(name = "经度")
+    private String longitude;
+
+    /**
+     * 维度
+     */
+    @Excel(name = "维度")
+    private String latitude;
+
+    /**
+     * 部门id
+     */
+    @Excel(name = "部门id")
+    private Long deptId;
+
+    /**
+     * 创建者
+     */
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新者
+     */
+    private String updateBy;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+}

+ 30 - 0
zhjq-business/src/main/java/com/zhjq/domain/vo/ZhjqPassengerFlowVO.java

@@ -0,0 +1,30 @@
+package com.zhjq.domain.vo;
+
+import com.zhjq.common.annotation.Excel;
+import lombok.Data;
+
+
+@Data
+public class ZhjqPassengerFlowVO {
+
+    /**
+     * 进客量
+     */
+    @Excel(name = "进客量")
+    private Integer flowInNum;
+
+
+    /**
+     * 出客量
+     */
+    @Excel(name = "出客量")
+    private Integer flowOutNum;
+
+    /**
+     * 保有量
+     */
+    @Excel(name = "保有量")
+    private Integer netValue;
+
+
+}

+ 66 - 0
zhjq-business/src/main/java/com/zhjq/mapper/ZhjqCameraMapper.java

@@ -0,0 +1,66 @@
+package com.zhjq.mapper;
+
+import com.zhjq.domain.ZhjqCamera;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+/**
+ * 摄像头Mapper接口
+ *
+ * @author ruoyi
+ * @date 2025-03-04
+ */
+public interface ZhjqCameraMapper {
+    /**
+     * 查询摄像头
+     *
+     * @param id 摄像头主键
+     * @return 摄像头
+     */
+    public ZhjqCamera selectZhjqCameraById(String id);
+
+    /**
+     * 查询摄像头列表
+     *
+     * @param zhjqCamera 摄像头
+     * @return 摄像头集合
+     */
+    public List<ZhjqCamera> selectZhjqCameraList(ZhjqCamera zhjqCamera);
+
+    /**
+     * 新增摄像头
+     *
+     * @param zhjqCamera 摄像头
+     * @return 结果
+     */
+    public int insertZhjqCamera(ZhjqCamera zhjqCamera);
+
+    /**
+     * 修改摄像头
+     *
+     * @param zhjqCamera 摄像头
+     * @return 结果
+     */
+    public int updateZhjqCamera(ZhjqCamera zhjqCamera);
+
+    /**
+     * 删除摄像头
+     *
+     * @param id 摄像头主键
+     * @return 结果
+     */
+    public int deleteZhjqCameraById(String id);
+
+    /**
+     * 批量删除摄像头
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteZhjqCameraByIds(String[] ids);
+
+
+    public int insertBatchZhjqCamera(@Param("list")List<ZhjqCamera> list);
+}

+ 8 - 0
zhjq-business/src/main/java/com/zhjq/mapper/ZhjqPassengerFlowMapper.java

@@ -1,6 +1,8 @@
 package com.zhjq.mapper;
 
+import com.alibaba.fastjson2.JSONObject;
 import com.zhjq.domain.ZhjqPassengerFlow;
+import com.zhjq.domain.vo.ZhjqPassengerFlowVO;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -63,4 +65,10 @@ public interface ZhjqPassengerFlowMapper {
 
 
     void insertBatch(@Param("list") List<ZhjqPassengerFlow> list);
+
+    List<ZhjqPassengerFlowVO> selectAllStatistics(JSONObject jsonObject);
+
+    List<ZhjqPassengerFlow> selectGroupName();
+
+    ZhjqPassengerFlowVO selectAllStatisticsByGroupId(JSONObject jsonObject);
 }

+ 64 - 0
zhjq-business/src/main/java/com/zhjq/service/IZhjqCameraService.java

@@ -0,0 +1,64 @@
+package com.zhjq.service;
+
+import com.zhjq.domain.ZhjqCamera;
+
+import java.util.List;
+
+
+/**
+ * 摄像头Service接口
+ *
+ * @author ruoyi
+ * @date 2025-03-04
+ */
+public interface IZhjqCameraService {
+    /**
+     * 查询摄像头
+     *
+     * @param id 摄像头主键
+     * @return 摄像头
+     */
+    public ZhjqCamera selectZhjqCameraById(String id);
+
+    /**
+     * 查询摄像头列表
+     *
+     * @param zhjqCamera 摄像头
+     * @return 摄像头集合
+     */
+    public List<ZhjqCamera> selectZhjqCameraList(ZhjqCamera zhjqCamera);
+
+    /**
+     * 新增摄像头
+     *
+     * @param zhjqCamera 摄像头
+     * @return 结果
+     */
+    public int insertZhjqCamera(ZhjqCamera zhjqCamera);
+
+    /**
+     * 修改摄像头
+     *
+     * @param zhjqCamera 摄像头
+     * @return 结果
+     */
+    public int updateZhjqCamera(ZhjqCamera zhjqCamera);
+
+    /**
+     * 批量删除摄像头
+     *
+     * @param ids 需要删除的摄像头主键集合
+     * @return 结果
+     */
+    public int deleteZhjqCameraByIds(String[] ids);
+
+    /**
+     * 删除摄像头信息
+     *
+     * @param id 摄像头主键
+     * @return 结果
+     */
+    public int deleteZhjqCameraById(String id);
+
+    public int insertBatchZhjqCamera(List<ZhjqCamera> list);
+}

+ 6 - 0
zhjq-business/src/main/java/com/zhjq/service/IZhjqPassengerFlowService.java

@@ -1,8 +1,10 @@
 package com.zhjq.service;
 
+import com.alibaba.fastjson2.JSONObject;
 import com.zhjq.domain.ZhjqPassengerFlow;
 
 import java.util.List;
+import java.util.Map;
 
 
 /**
@@ -59,4 +61,8 @@ public interface IZhjqPassengerFlowService {
      * @return 结果
      */
     public int deleteZhjqPassengerFlowById(Long id);
+
+    Map<String, Object> selectAllStatistics(JSONObject jsonObject);
+
+    List<ZhjqPassengerFlow> selectGroupName();
 }

+ 96 - 0
zhjq-business/src/main/java/com/zhjq/service/imp/ZhjqCameraServiceImpl.java

@@ -0,0 +1,96 @@
+package com.zhjq.service.imp;
+
+import com.zhjq.common.utils.DateUtils;
+import com.zhjq.domain.ZhjqCamera;
+import com.zhjq.mapper.ZhjqCameraMapper;
+import com.zhjq.service.IZhjqCameraService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+
+/**
+ * 摄像头Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2025-03-04
+ */
+@Service
+public class ZhjqCameraServiceImpl implements IZhjqCameraService {
+    @Autowired
+    private ZhjqCameraMapper zhjqCameraMapper;
+
+    /**
+     * 查询摄像头
+     *
+     * @param id 摄像头主键
+     * @return 摄像头
+     */
+    @Override
+    public ZhjqCamera selectZhjqCameraById(String id) {
+        return zhjqCameraMapper.selectZhjqCameraById(id);
+    }
+
+    /**
+     * 查询摄像头列表
+     *
+     * @param zhjqCamera 摄像头
+     * @return 摄像头
+     */
+    @Override
+    public List<ZhjqCamera> selectZhjqCameraList(ZhjqCamera zhjqCamera) {
+        return zhjqCameraMapper.selectZhjqCameraList(zhjqCamera);
+    }
+
+    /**
+     * 新增摄像头
+     *
+     * @param zhjqCamera 摄像头
+     * @return 结果
+     */
+    @Override
+    public int insertZhjqCamera(ZhjqCamera zhjqCamera) {
+        zhjqCamera.setCreateTime(DateUtils.getNowDate());
+        return zhjqCameraMapper.insertZhjqCamera(zhjqCamera);
+    }
+
+    /**
+     * 修改摄像头
+     *
+     * @param zhjqCamera 摄像头
+     * @return 结果
+     */
+    @Override
+    public int updateZhjqCamera(ZhjqCamera zhjqCamera) {
+        zhjqCamera.setUpdateTime(DateUtils.getNowDate());
+        return zhjqCameraMapper.updateZhjqCamera(zhjqCamera);
+    }
+
+    /**
+     * 批量删除摄像头
+     *
+     * @param ids 需要删除的摄像头主键
+     * @return 结果
+     */
+    @Override
+    public int deleteZhjqCameraByIds(String[] ids) {
+        return zhjqCameraMapper.deleteZhjqCameraByIds(ids);
+    }
+
+    /**
+     * 删除摄像头信息
+     *
+     * @param id 摄像头主键
+     * @return 结果
+     */
+    @Override
+    public int deleteZhjqCameraById(String id) {
+        return zhjqCameraMapper.deleteZhjqCameraById(id);
+    }
+
+    @Override
+    public int insertBatchZhjqCamera(List<ZhjqCamera> list) {
+        return zhjqCameraMapper.insertBatchZhjqCamera(list);
+    }
+}

+ 38 - 0
zhjq-business/src/main/java/com/zhjq/service/imp/ZhjqPassengerFlowServiceImpl.java

@@ -1,12 +1,19 @@
 package com.zhjq.service.imp;
 
+import com.alibaba.fastjson2.JSONObject;
 import com.zhjq.domain.ZhjqPassengerFlow;
+import com.zhjq.domain.vo.ZhjqPassengerFlowVO;
 import com.zhjq.mapper.ZhjqPassengerFlowMapper;
 import com.zhjq.service.IZhjqPassengerFlowService;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
 
 
 /**
@@ -85,4 +92,35 @@ public class ZhjqPassengerFlowServiceImpl implements IZhjqPassengerFlowService {
     public int deleteZhjqPassengerFlowById(Long id) {
         return zhjqPassengerFlowMapper.deleteZhjqPassengerFlowById(id);
     }
+
+    @Override
+    public Map<String, Object> selectAllStatistics(JSONObject jsonObject) {
+        Map<String, Object> map = new HashMap<>();
+         if (ObjectUtils.isNotEmpty(jsonObject.get("groupId"))) {
+            ZhjqPassengerFlowVO vo = zhjqPassengerFlowMapper.selectAllStatisticsByGroupId(jsonObject);
+            map.put("data", vo);
+        } else {
+            List<ZhjqPassengerFlowVO> list = zhjqPassengerFlowMapper.selectAllStatistics(jsonObject);
+            if (list.size() == 2) {
+                Optional<ZhjqPassengerFlowVO> result = list.stream()
+                        .reduce((acc, item) -> {
+                            acc.setFlowInNum(acc.getFlowInNum() + item.getFlowInNum());
+                            acc.setFlowOutNum(acc.getFlowOutNum() + item.getFlowOutNum());
+                            acc.setNetValue(acc.getNetValue() + item.getNetValue());
+                            return acc;
+                        });
+                ZhjqPassengerFlowVO vo = result.get();
+                map.put("data", vo);
+            }
+        }
+        List<ZhjqPassengerFlow> groupNameList = zhjqPassengerFlowMapper.selectGroupName();
+        List<String> collect = groupNameList.stream().map(ZhjqPassengerFlow::getGroupName).collect(Collectors.toList());
+        map.put("groupNameList", collect);
+        return map;
+    }
+
+    @Override
+    public List<ZhjqPassengerFlow> selectGroupName() {
+        return zhjqPassengerFlowMapper.selectGroupName();
+    }
 }

+ 63 - 0
zhjq-business/src/main/java/com/zhjq/utils/GetCameras.java

@@ -0,0 +1,63 @@
+package com.zhjq.utils;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.hikvision.artemis.sdk.ArtemisHttpUtil;
+import com.hikvision.artemis.sdk.config.ArtemisConfig;
+import com.zhjq.domain.ZhjqCamera;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class GetCameras {
+
+    /**
+     * 5.3.1.2.2分页获取监控点资源
+     * @param host
+     * @param appKey
+     * @param appSecret
+     * @param pageNo
+     * @param pageSize
+     * @return
+     */
+    public static List<ZhjqCamera> cameras(String host, String appKey, String appSecret, String pageNo, String pageSize) {
+        ArtemisConfig.host = host; // 平台的ip端口
+        ArtemisConfig.appKey = appKey;  // 密钥appkey
+        ArtemisConfig.appSecret = appSecret;// 密钥appSecret
+        final String ARTEMIS_PATH = "/artemis";
+        final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v1/cameras";
+        Map<String, String> path = new HashMap<String, String>(2) {
+            {
+                put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
+            }
+        };
+
+        String contentType = "application/json";
+        JSONObject jsonBody = new JSONObject();
+        jsonBody.put("pageNo", pageNo);
+        jsonBody.put("pageSize", pageSize);
+        String body = jsonBody.toJSONString();
+        JSONObject json = JSONObject.parseObject(ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType, null));// post请求application/json类型参数
+        List<ZhjqCamera> returnList = new ArrayList<>();
+        ObjectMapper objectMapper = new ObjectMapper();
+        objectMapper.registerModule(new JavaTimeModule());
+        try {
+            returnList = objectMapper.readValue(JSONObject.parseObject(json.get("data").toString()).get("list").toString(), new TypeReference<List<ZhjqCamera>>() {});
+        } catch (JsonProcessingException e) {
+            throw new RuntimeException(e);
+        }
+        return returnList;
+    }
+
+
+
+    public static void main(String[] args) {
+        List<ZhjqCamera> returnList = cameras("218.62.80.146:1443", "28356728", "C3K889wQUgVlSj1BMay6", "1", "1000");
+        System.out.println("result结果示例: " + returnList);
+    }
+}

+ 195 - 0
zhjq-business/src/main/resources/mapper/ZhjqCameraMapper.xml

@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zhjq.mapper.ZhjqCameraMapper">
+
+    <resultMap type="ZhjqCamera" id="ZhjqCameraResult">
+        <result property="id" column="id"/>
+        <result property="encodeDevIndexCode" column="encode_dev_index_code"/>
+        <result property="cameraIndexCode" column="camera_index_code"/>
+        <result property="cameraName" column="camera_name"/>
+        <result property="cameraType" column="camera_type"/>
+        <result property="cameraTypeName" column="camera_type_name"/>
+        <result property="longitude" column="longitude"/>
+        <result property="latitude" column="latitude"/>
+        <result property="deptId" column="dept_id"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <sql id="selectZhjqCameraVo">
+        select id,
+               camera_index_code,
+               encode_dev_index_code,
+               camera_name,
+               camera_type,
+               camera_type_name,
+               longitude,
+               latitude,
+               dept_id,
+               create_by,
+               create_time,
+               update_by,
+               update_time
+        from zhjq_camera
+    </sql>
+
+    <select id="selectZhjqCameraList" parameterType="ZhjqCamera" resultMap="ZhjqCameraResult">
+        <include refid="selectZhjqCameraVo"/>
+        <where>
+            <if test="encodeDevIndexCode != null  and encodeDevIndexCode != ''">
+                and encode_dev_index_code = #{encodeDevIndexCode}
+            </if>
+            <if test="cameraName != null  and cameraName != ''">
+                and camera_name like concat('%', #{cameraName}, '%')
+            </if>
+            <if test="cameraType != null ">
+                and camera_type = #{cameraType}
+            </if>
+            <if test="longitude != null  and longitude != ''">
+                and longitude = #{longitude}
+            </if>
+            <if test="latitude != null  and latitude != ''">
+                and latitude = #{latitude}
+            </if>
+            <if test="deptId != null ">
+                and dept_id = #{deptId}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectZhjqCameraById" parameterType="String"
+            resultMap="ZhjqCameraResult">
+        <include refid="selectZhjqCameraVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertZhjqCamera" parameterType="ZhjqCamera">
+        insert into zhjq_camera
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,
+            </if>
+            <if test="encodeDevIndexCode != null">encode_dev_index_code,
+            </if>
+            <if test="cameraIndexCode != null">camera_index_code,
+            </if>
+            <if test="cameraName != null">camera_name,
+            </if>
+            <if test="cameraType != null">camera_type,
+            </if>
+            <if test="cameraTypeName != null">camera_type_name,
+            </if>
+            <if test="longitude != null">longitude,
+            </if>
+            <if test="latitude != null">latitude,
+            </if>
+            <if test="deptId != null">dept_id,
+            </if>
+            <if test="createBy != null">create_by,
+            </if>
+            <if test="createTime != null">create_time,
+            </if>
+            <if test="updateBy != null">update_by,
+            </if>
+            <if test="updateTime != null">update_time,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},
+            </if>
+            <if test="encodeDevIndexCode != null">#{encodeDevIndexCode},
+            </if>
+            <if test="cameraIndexCode != null">#{cameraIndexCode},
+            </if>
+            <if test="cameraName != null">#{cameraName},
+            </if>
+            <if test="cameraType != null">#{cameraType},
+            </if>
+            <if test="cameraTypeName != null">#{cameraTypeName},
+            </if>
+            <if test="longitude != null">#{longitude},
+            </if>
+            <if test="latitude != null">#{latitude},
+            </if>
+            <if test="deptId != null">#{deptId},
+            </if>
+            <if test="createBy != null">#{createBy},
+            </if>
+            <if test="createTime != null">#{createTime},
+            </if>
+            <if test="updateBy != null">#{updateBy},
+            </if>
+            <if test="updateTime != null">#{updateTime},
+            </if>
+        </trim>
+    </insert>
+
+    <update id="updateZhjqCamera" parameterType="ZhjqCamera">
+        update zhjq_camera
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="encodeDevIndexCode != null">encode_dev_index_code =
+                #{encodeDevIndexCode},
+            </if>
+            <if test="cameraIndexCode != null">camera_index_code =
+                #{cameraIndexCode},
+            </if>
+            <if test="cameraName != null">camera_name =
+                #{cameraName},
+            </if>
+            <if test="cameraType != null">camera_type =
+                #{cameraType},
+            </if>
+            <if test="cameraTypeName != null">camera_type_name =
+                #{cameraTypeName},
+            </if>
+            <if test="longitude != null">longitude =
+                #{longitude},
+            </if>
+            <if test="latitude != null">latitude =
+                #{latitude},
+            </if>
+            <if test="deptId != null">dept_id =
+                #{deptId},
+            </if>
+            <if test="createBy != null">create_by =
+                #{createBy},
+            </if>
+            <if test="createTime != null">create_time =
+                #{createTime},
+            </if>
+            <if test="updateBy != null">update_by =
+                #{updateBy},
+            </if>
+            <if test="updateTime != null">update_time =
+                #{updateTime},
+            </if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteZhjqCameraById" parameterType="String">
+        delete
+        from zhjq_camera
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteZhjqCameraByIds" parameterType="String">
+        delete from zhjq_camera where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+    <insert id="insertBatchZhjqCamera" parameterType="String">
+        insert into zhjq_camera (camera_index_code,encode_dev_index_code, camera_name, camera_type,camera_type_name,
+        longitude, latitude,create_time)
+        values
+        <foreach collection="list" item="item" separator="," index="index">
+            (#{item.cameraIndexCode},#{item.encodeDevIndexCode}, #{item.cameraName}, #{item.cameraType},
+            #{item.cameraTypeName}, #{item.longitude},
+            #{item.latitude}, now())
+        </foreach>
+    </insert>
+</mapper>

+ 50 - 0
zhjq-business/src/main/resources/mapper/ZhjqPassengerFlowMapper.xml

@@ -21,6 +21,12 @@
         <result property="insertTime" column="insert_time"/>
     </resultMap>
 
+    <resultMap type="ZhjqPassengerFlowVO" id="ZhjqPassengerFlowStatisticsResult">
+        <result property="flowInNum" column="flow_in_num"/>
+        <result property="flowOutNum" column="flow_out_num"/>
+        <result property="netValue" column="net_value"/>
+    </resultMap>
+
     <sql id="selectZhjqPassengerFlowVo">
         select id,
                group_id,
@@ -223,4 +229,48 @@
              now())
         </foreach>
     </insert>
+    <select id="selectAllStatistics" parameterType="ZhjqPassengerFlowVO" resultMap="ZhjqPassengerFlowStatisticsResult">
+        SELECT
+        flow_in_num,
+        flow_out_num,
+        net_value
+        FROM
+        zhjq_passenger_flow
+        <where>
+            <if test="stratTime == null and endTime == null">
+                and date(insert_time) = date(now())
+            </if>
+            <if test="stratTime != null and stratTime != ''">
+                and date(insert_time) &gt;= date(#{stratTime})
+            </if>
+            <if test="endTime != null and endTime != ''">
+                and date(insert_time) &lt;= date(#{endTime})
+            </if>
+        </where>
+        ORDER BY insert_time desc
+        limit 2
+    </select>
+    <select id="selectGroupName" parameterType="ZhjqPassengerFlow" resultMap="ZhjqPassengerFlowResult">
+        SELECT group_id,group_name FROM `zhjq_passenger_flow` group by group_id
+    </select>
+    <select id="selectAllStatisticsByGroupId" parameterType="ZhjqPassengerFlowVO" resultMap="ZhjqPassengerFlowStatisticsResult">
+        SELECT
+        flow_in_num,
+        flow_out_num,
+        net_value
+        FROM
+        zhjq_passenger_flow
+        where group_id = #{groupId}
+        <if test="stratTime == null and endTime == null">
+            and date(insert_time) = date(now())
+        </if>
+        <if test="stratTime != null and stratTime != ''">
+            and date(insert_time) &gt;= date(#{stratTime})
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and date(insert_time) &lt;= date(#{endTime})
+        </if>
+        ORDER BY insert_time desc
+        limit 1
+    </select>
 </mapper>

+ 44 - 0
zhjq-ui/src/api/system/camera.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询摄像头列表
+export function listCamera(query) {
+    return request({
+        url: '/system/camera/list',
+        method: 'get',
+        params: query
+    })
+}
+
+// 查询摄像头详细
+export function getCamera(id) {
+    return request({
+        url: '/system/camera/' + id,
+        method: 'get'
+    })
+}
+
+// 新增摄像头
+export function addCamera(data) {
+    return request({
+        url: '/system/camera',
+        method: 'post',
+        data: data
+    })
+}
+
+// 修改摄像头
+export function updateCamera(data) {
+    return request({
+        url: '/system/camera',
+        method: 'put',
+        data: data
+    })
+}
+
+// 删除摄像头
+export function delCamera(id) {
+    return request({
+        url: '/system/camera/' + id,
+        method: 'delete'
+    })
+}

+ 290 - 0
zhjq-ui/src/views/system/camera/index.vue

@@ -0,0 +1,290 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="88px">
+      <el-form-item label="摄像头名称" prop="cameraName">
+        <el-input
+          v-model="queryParams.cameraName"
+          placeholder="请输入摄像头名称"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+        >新增
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+        >修改
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+        >删除
+        </el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="cameraList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center"/>
+      <el-table-column label="序号" align="center" type="index"/>
+      <el-table-column label="监控点" align="center" prop="cameraIndexCode"/>
+      <el-table-column label="摄像头名称" align="center" prop="cameraName"/>
+      <el-table-column label="摄像头类型" align="center" prop="cameraTypeName"/>
+      <el-table-column label="经度" align="center" prop="longitude"/>
+      <el-table-column label="维度" align="center" prop="latitude"/>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+          >修改
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+          >删除
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改摄像头对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
+        <el-form-item label="监控点" prop="cameraIndexCode">
+          <el-input v-model="form.cameraIndexCode" placeholder="请输入监控点"/>
+        </el-form-item>
+        <el-form-item label="摄像头名称" prop="cameraName">
+          <el-input v-model="form.cameraName" placeholder="请输入摄像头名称"/>
+        </el-form-item>
+        <el-form-item label="经度" prop="longitude">
+          <el-input v-model="form.longitude" placeholder="请输入经度"/>
+        </el-form-item>
+        <el-form-item label="维度" prop="latitude">
+          <el-input v-model="form.latitude" placeholder="请输入维度"/>
+        </el-form-item>
+        <el-form-item label="部门名称" prop="parentId">
+          <treeselect v-model="form.parentId" :normalizer="normalizer" :options="deptOptions"
+                      placeholder="请选择部门名称"/>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {addCamera, delCamera, getCamera, listCamera, updateCamera} from "@/api/system/camera";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import {listDept} from "@/api/system/dept";
+
+export default {
+  name: "Camera",
+  components: {Treeselect},
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 摄像头表格数据
+      cameraList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        cameraIndexCode: null,
+        cameraName: null,
+        cameraTypeName: null,
+        longitude: null,
+        latitude: null,
+        deptId: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {},
+      // 表格树数据
+      deptList: [],
+      // 部门树选项
+      deptOptions: [],
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询部门列表 */
+    getDeptList() {
+      this.loading = true;
+      listDept({}).then(response => {
+        this.deptList = this.handleTree(response.data, "deptId");
+        this.loading = false;
+      });
+      console.log("deptList", this.deptList);
+    },
+    /** 转换部门数据结构 */
+    normalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children;
+      }
+      return {
+        id: node.deptId,
+        label: node.deptName,
+        children: node.children
+      };
+    },
+    /** 查询摄像头列表 */
+    getList() {
+      this.loading = true;
+      listCamera(this.queryParams).then(response => {
+        this.cameraList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        cameraIndexCode: null,
+        cameraName: null,
+        cameraTypeName: null,
+        longitude: null,
+        latitude: null,
+        deptId: null,
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.getDeptList();
+      this.open = true;
+      this.title = "添加摄像头";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getCamera(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改摄像头";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.form.sort = this.value
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateCamera(this.form).then(response => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addCamera(this.form).then(response => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$modal.confirm('是否确认删除数据项?').then(function () {
+        return delCamera(ids);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {
+      });
+    }
+  }
+};
+</script>