From 99a4514737765ca694dc3dfce8f274a72fd1c135 Mon Sep 17 00:00:00 2001 From: dearlin <1261008090@qq.com> Date: Sat, 27 Jan 2024 11:29:26 +0800 Subject: [PATCH] ai bajing --- .../controller/mapApi/MapController.java | 64 +++++++++++++++++ src/main/java/com/zcloud/util/PLSUtil.java | 68 ++++++++++++++----- .../datasource/video/AIWarningMapper.xml | 5 +- 3 files changed, 119 insertions(+), 18 deletions(-) create mode 100644 src/main/java/com/zcloud/controller/mapApi/MapController.java diff --git a/src/main/java/com/zcloud/controller/mapApi/MapController.java b/src/main/java/com/zcloud/controller/mapApi/MapController.java new file mode 100644 index 0000000..8df8716 --- /dev/null +++ b/src/main/java/com/zcloud/controller/mapApi/MapController.java @@ -0,0 +1,64 @@ +package com.zcloud.controller.mapApi; + +import com.zcloud.controller.base.BaseController; +import com.zcloud.entity.PageData; +import com.zcloud.service.system.UsersService; +import com.zcloud.util.Jurisdiction; +import com.zcloud.util.PLSUtil; +import com.zcloud.util.ReturnMap; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * 说明:TODO + * 作者:wangxuan + * 官网:www.zcloudchina.com + */ +@Controller +@RequestMapping("/map") +public class MapController extends BaseController { + @Autowired + private UsersService usersService; + + + /** + * @Description: 人员类型统计 告警类型统计 + * @Author: dearLin + * @Date: 2024/1/26/026 16:42 + * @Param: [] [] + * @Return: java.lang.String + */ + @RequestMapping(value = "/getPersonnelTypeCount") + public ReturnMap getPersonnelTypeCount() throws Exception { + PageData pageData = getPageData(); + pageData.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + int userCount = usersService.getUserCount(pageData); + return ReturnMap.ok().put("userCount", userCount); + } + + /** + * @Description: 告警类型统计 来自人员定位系统 + * @Author: dearLin + * @Date: 2024/1/26/026 16:43 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/getAlarmTypeCount") + public ReturnMap getAlarmTypeCount() throws Exception { + return ReturnMap.ok().put("data", PLSUtil.getAlarmTypeCount(Jurisdiction.getCORPINFO_ID())); + } + + /** + * @Description: 人员定位情况 来自人员定位系统 + * @Author: dearLin + * @Date: 2024/1/26/026 16:43 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/getPersonnelPositioningCount") + public ReturnMap getPersonnelPositioningCount() throws Exception { +// return ReturnMap.ok().put("data", PLSUtil.getPersonnelPositioningCount(Jurisdiction.getCORPINFO_ID())); + return ReturnMap.error(); + } +} diff --git a/src/main/java/com/zcloud/util/PLSUtil.java b/src/main/java/com/zcloud/util/PLSUtil.java index 05ef2e4..2692161 100644 --- a/src/main/java/com/zcloud/util/PLSUtil.java +++ b/src/main/java/com/zcloud/util/PLSUtil.java @@ -31,6 +31,19 @@ public class PLSUtil { public static HashMap BAKEADDR = new HashMap<>(); private static RestTemplate restTemplate; + public static Object getPersonnelPositioningCount(String CORPINFO_ID, Integer currentPage, Integer showCount) throws Exception { + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", getToken(CORPINFO_ID)); + HttpEntity httpEntity = new HttpEntity<>(headers); + ResponseEntity exchange = restTemplate.exchange( + PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/deploy/card/list?sortThePowerLevel=1&pageNum=" + + currentPage + + "&pageSize=" + showCount, + HttpMethod.GET, httpEntity, + JSONObject.class); + return exchange.getBody(); + } + @Autowired public void setCorpplsinfoService(CorpPlsInfoService corpplsinfoServicebean, UsersService usersServicebean, RestTemplate restTemplatebean) { corpplsinfoService = corpplsinfoServicebean; @@ -38,6 +51,25 @@ public class PLSUtil { restTemplate = restTemplatebean; } + /** + * @Description: 告警类型统计 + * @Author: dearLin + * @Date: 2024/1/25/025 14:37 + * @Param: [java.lang.String, java.lang.Integer, java.lang.Integer] [keywords, currentPage, showCount] + * @Return: com.alibaba.fastjson.JSONObject + */ + public static JSONObject getAlarmTypeCount(String CORPINFO_ID) throws Exception { + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", getToken(CORPINFO_ID)); + HttpEntity httpEntity = new HttpEntity<>(headers); + ResponseEntity exchange = restTemplate.exchange( + PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/region/alarm/alarmStatistics?type=day", + HttpMethod.GET, httpEntity, + JSONObject.class); + return exchange.getBody(); + } + + /** * @Description: 添加摄像头 * @Author: dearLin @@ -50,17 +82,17 @@ public class PLSUtil { headers.set("Authorization", getToken(CORPINFO_ID)); headers.setContentType(org.springframework.http.MediaType.valueOf("application/json")); JSONObject uriVariables = new JSONObject(); - uriVariables.put("camNo",camera.getString("CODE")); - uriVariables.put("camName",camera.getString("VIDEONAME")); - uriVariables.put("camIp","127.0.0.1"); - uriVariables.put("type","0"); - uriVariables.put("port",""); - uriVariables.put("camUserName","1"); - uriVariables.put("camPassword","1"); - uriVariables.put("lon",""); - uriVariables.put("lat",""); - uriVariables.put("alt",""); - HttpEntity httpEntity = new HttpEntity<>(uriVariables,headers); + uriVariables.put("camNo", camera.getString("CODE")); + uriVariables.put("camName", camera.getString("VIDEONAME")); + uriVariables.put("camIp", "127.0.0.1"); + uriVariables.put("type", "0"); + uriVariables.put("port", ""); + uriVariables.put("camUserName", "1"); + uriVariables.put("camPassword", "1"); + uriVariables.put("lon", ""); + uriVariables.put("lat", ""); + uriVariables.put("alt", ""); + HttpEntity httpEntity = new HttpEntity<>(uriVariables, headers); // HttpEntity httpEntity = new HttpEntity<>(uriVariables,headers); // ResponseEntity jsonObjectResponseEntity = restTemplate.postForEntity(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/device/camera", // httpEntity, JSONObject.class); @@ -72,6 +104,7 @@ public class PLSUtil { JSONObject.class); return exchange.getBody(); } + /** * @Description: 修改摄像头 * @Author: dearLin @@ -84,15 +117,16 @@ public class PLSUtil { headers.set("Authorization", getToken(CORPINFO_ID)); headers.setContentType(org.springframework.http.MediaType.valueOf("application/json")); JSONObject uriVariables = new JSONObject(); - uriVariables.put("camNo",camera.getString("CODE")); - uriVariables.put("camName",camera.getString("VIDEONAME")); - uriVariables.put("camId",camera.getString("PLS_ID")); - HttpEntity httpEntity = new HttpEntity<>(uriVariables,headers); + uriVariables.put("camNo", camera.getString("CODE")); + uriVariables.put("camName", camera.getString("VIDEONAME")); + uriVariables.put("camId", camera.getString("PLS_ID")); + HttpEntity httpEntity = new HttpEntity<>(uriVariables, headers); ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/device/camera", HttpMethod.PUT, httpEntity, - JSONObject.class,uriVariables); + JSONObject.class, uriVariables); return exchange.getBody(); } + /** * @Description: 删除摄像头 * @Author: dearLin @@ -104,7 +138,7 @@ public class PLSUtil { HttpHeaders headers = new HttpHeaders(); headers.set("Authorization", getToken(CORPINFO_ID)); HttpEntity httpEntity = new HttpEntity<>(headers); - ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/device/camera/"+Integer.parseInt(camera.getString("PLS_ID")), HttpMethod.DELETE, httpEntity, JSONObject.class); + ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/device/camera/" + Integer.parseInt(camera.getString("PLS_ID")), HttpMethod.DELETE, httpEntity, JSONObject.class); return exchange.getBody(); } diff --git a/src/main/resources/mybatis/datasource/video/AIWarningMapper.xml b/src/main/resources/mybatis/datasource/video/AIWarningMapper.xml index 330d7b1..ffc2a10 100644 --- a/src/main/resources/mybatis/datasource/video/AIWarningMapper.xml +++ b/src/main/resources/mybatis/datasource/video/AIWarningMapper.xml @@ -135,8 +135,11 @@ and c.CORPINFO_ID = #{pd.CORPINFO_ID} + + and f.ISTRUE = #{pd.ISTRUE} + - and f.STATUS = #{STATUS} + and f.STATUS = #{pd.STATUS} and DATE_FORMAT(f.CREATTIME,'%Y-%m-%d %H:%i')