ai bajing

pull/4/head
dearlin 2024-01-27 11:29:26 +08:00
parent 5032c3e5c1
commit 99a4514737
3 changed files with 119 additions and 18 deletions

View File

@ -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();
}
}

View File

@ -31,6 +31,19 @@ public class PLSUtil {
public static HashMap<String, String> 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<JSONObject> httpEntity = new HttpEntity<>(headers);
ResponseEntity<JSONObject> 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<JSONObject> httpEntity = new HttpEntity<>(headers);
ResponseEntity<JSONObject> 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<JSONObject> 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<JSONObject> httpEntity = new HttpEntity<>(uriVariables, headers);
// HttpEntity<JSONObject> httpEntity = new HttpEntity<>(uriVariables,headers);
// ResponseEntity<JSONObject> 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<JSONObject> 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<JSONObject> httpEntity = new HttpEntity<>(uriVariables, headers);
ResponseEntity<JSONObject> 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<JSONObject> httpEntity = new HttpEntity<>(headers);
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/device/camera/"+Integer.parseInt(camera.getString("PLS_ID")), HttpMethod.DELETE, httpEntity, JSONObject.class);
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/device/camera/" + Integer.parseInt(camera.getString("PLS_ID")), HttpMethod.DELETE, httpEntity, JSONObject.class);
return exchange.getBody();
}

View File

@ -135,8 +135,11 @@
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''"><!-- 关键词检索 -->
and c.CORPINFO_ID = #{pd.CORPINFO_ID}
</if>
<if test="pd.ISTRUE != null and pd.ISTRUE !=''" >
and f.ISTRUE = #{pd.ISTRUE}
</if>
<if test="pd.STATUS != null and pd.STATUS !=''" >
and f.STATUS = #{STATUS}
and f.STATUS = #{pd.STATUS}
</if>
<if test="pd.START_TIME != null and pd.START_TIME !=''" >
and DATE_FORMAT(f.CREATTIME,'%Y-%m-%d %H:%i')