海康接口数据获取类修改了配置 增加了一个售票接口用于获取某日售票情况
This commit is contained in:
parent
2c92857cf1
commit
01e2a51b57
@ -143,6 +143,15 @@ public class SaleDataApi {
|
|||||||
System.out.println(saleDataService.findEventsByYear(year));
|
System.out.println(saleDataService.findEventsByYear(year));
|
||||||
return saleDataService.findEventsByYear(year).size();
|
return saleDataService.findEventsByYear(year).size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/selectSaleCountByDate")
|
||||||
|
@Operation(summary = "查询某年某月某日售票数量")
|
||||||
|
public Integer selectSaleCountByDate(String date) {
|
||||||
|
System.out.println("date: "+date);
|
||||||
|
String dateParam = date.replace("-", "");
|
||||||
|
System.out.println("dateParam: "+dateParam);
|
||||||
|
return saleDataService.selectSaleCountByDate(dateParam);
|
||||||
|
}
|
||||||
// @GetMapping("/test")
|
// @GetMapping("/test")
|
||||||
// public void testMethod(){
|
// public void testMethod(){
|
||||||
//
|
//
|
||||||
|
@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.datacenter.utlis.IntegrationURL;
|
|||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
@ -37,15 +38,14 @@ public class CameraServiceImpl implements CameraService {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private CameraMapper cameraMapper;
|
private CameraMapper cameraMapper;
|
||||||
private ObjectMapper objectMapper;
|
@Autowired
|
||||||
@Resource
|
private RedisTemplate<String, String> redisTemplate;
|
||||||
private RedisTemplate redisTemplate;
|
|
||||||
private static final String ACCESS_TOKEN_KEY = "hikingAPI:access_token";
|
private static final String ACCESS_TOKEN_KEY = "hikingAPI:access_token";
|
||||||
|
|
||||||
|
|
||||||
public String getAccessToken() {
|
public String getAccessToken() {
|
||||||
// 检查 Redis 中是否有 access_token
|
// 检查 Redis 中是否有 access_token
|
||||||
String accessToken = (String) redisTemplate.opsForValue().get(ACCESS_TOKEN_KEY);
|
String accessToken = redisTemplate.opsForValue().get(ACCESS_TOKEN_KEY);
|
||||||
if (!StringUtils.isEmpty(accessToken)) {
|
if (!StringUtils.isEmpty(accessToken)) {
|
||||||
System.out.println("使用缓存的token:" + accessToken);
|
System.out.println("使用缓存的token:" + accessToken);
|
||||||
return accessToken; // 如果存在则直接返回
|
return accessToken; // 如果存在则直接返回
|
||||||
@ -55,10 +55,10 @@ public class CameraServiceImpl implements CameraService {
|
|||||||
System.out.println("获取新的token");
|
System.out.println("获取新的token");
|
||||||
String accessTokenUrlResp = IntegrationURL.getAccessTokenURL();
|
String accessTokenUrlResp = IntegrationURL.getAccessTokenURL();
|
||||||
try {
|
try {
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
JsonNode jsonNode = objectMapper.readTree(accessTokenUrlResp);
|
JsonNode jsonNode = objectMapper.readTree(accessTokenUrlResp);
|
||||||
accessToken = jsonNode.get("access_token").asText();
|
accessToken = jsonNode.get("access_token").asText();
|
||||||
|
System.out.println("cameraapi -------------accessToken:" + accessToken);
|
||||||
// 将 access_token 存入 Redis,设置过期时间为 11 小时(有效期12小时)
|
// 将 access_token 存入 Redis,设置过期时间为 11 小时(有效期12小时)
|
||||||
redisTemplate.opsForValue().set(ACCESS_TOKEN_KEY, accessToken, 11, TimeUnit.HOURS);
|
redisTemplate.opsForValue().set(ACCESS_TOKEN_KEY, accessToken, 11, TimeUnit.HOURS);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -75,7 +75,7 @@ public class CameraServiceImpl implements CameraService {
|
|||||||
|
|
||||||
public Boolean checkToken(String result) {
|
public Boolean checkToken(String result) {
|
||||||
try {
|
try {
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
JsonNode jsonNode = objectMapper.readTree(result);
|
JsonNode jsonNode = objectMapper.readTree(result);
|
||||||
String code = jsonNode.path("code").asText();
|
String code = jsonNode.path("code").asText();
|
||||||
if ("0x02401007".equals(code)) {
|
if ("0x02401007".equals(code)) {
|
||||||
|
@ -98,4 +98,6 @@ public interface SaleDataService {
|
|||||||
* @return java.math.BigDecimal
|
* @return java.math.BigDecimal
|
||||||
*/
|
*/
|
||||||
BigDecimal findyearJun(List<SaleData> list);
|
BigDecimal findyearJun(List<SaleData> list);
|
||||||
|
|
||||||
|
Integer selectSaleCountByDate(String dateParam);
|
||||||
}
|
}
|
@ -445,5 +445,10 @@ public class SaleDataServiceImpl implements SaleDataService {
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer selectSaleCountByDate(String dateParam) {
|
||||||
|
return saleDataRepository.countBySddate(dateParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -12,9 +12,9 @@ public class IntegrationURL {
|
|||||||
|
|
||||||
//设置平台参数,根据实际情况,设置host appKey appSecret 三个参数.
|
//设置平台参数,根据实际情况,设置host appKey appSecret 三个参数.
|
||||||
static {
|
static {
|
||||||
ArtemisConfig.host = "127.0.0.1:443"; // 平台的ip端口
|
ArtemisConfig.host = "192.168.11.3:443"; // 平台的ip端口
|
||||||
ArtemisConfig.appKey = "29180881"; // 密钥appkey
|
ArtemisConfig.appKey = "22116579"; // 密钥appkey
|
||||||
ArtemisConfig.appSecret = "XO0wCAYGi4KV70ybjznx";// 密钥appSecret
|
ArtemisConfig.appSecret = "AqL0EZSvZ60vzvO3Gqx9";// 密钥appSecret
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置OpenAPI接口的上下文
|
//设置OpenAPI接口的上下文
|
||||||
@ -46,7 +46,7 @@ public class IntegrationURL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//查询区域列表v2
|
//查询区域列表v2
|
||||||
public static String getRegionListURL(String resourceType,int pageNo,int pageSize,String accessToken) {
|
public static String getRegionListURL(String resourceType, String[] parentIndexCodes, Boolean isSubRegion, int pageNo,int pageSize, String[] authCodes, Integer regionType, String regionName, String[] sonOrgIndexCodes, Integer cascadeFlag, String orderBy, String orderType ,String accessToken) {
|
||||||
|
|
||||||
|
|
||||||
//设置接口的URI地址
|
//设置接口的URI地址
|
||||||
@ -63,8 +63,17 @@ public class IntegrationURL {
|
|||||||
//组装请求参数
|
//组装请求参数
|
||||||
JSONObject jsonBody = new JSONObject();
|
JSONObject jsonBody = new JSONObject();
|
||||||
jsonBody.put("resourceType",resourceType);
|
jsonBody.put("resourceType",resourceType);
|
||||||
|
jsonBody.put("parentIndexCodes",parentIndexCodes);
|
||||||
|
jsonBody.put("isSubRegion",isSubRegion);
|
||||||
jsonBody.put("pageNo", pageNo);
|
jsonBody.put("pageNo", pageNo);
|
||||||
jsonBody.put("pageSize", pageSize);
|
jsonBody.put("pageSize", pageSize);
|
||||||
|
jsonBody.put("authCodes",authCodes);
|
||||||
|
jsonBody.put("regionType",regionType);
|
||||||
|
jsonBody.put("regionName",regionName);
|
||||||
|
jsonBody.put("sonOrgIndexCodes",sonOrgIndexCodes);
|
||||||
|
jsonBody.put("cascadeFlag",cascadeFlag);
|
||||||
|
jsonBody.put("orderBy",orderBy);
|
||||||
|
jsonBody.put("orderType",orderType);
|
||||||
String body = jsonBody.toJSONString();
|
String body = jsonBody.toJSONString();
|
||||||
|
|
||||||
//请求头添加 access_token认证
|
//请求头添加 access_token认证
|
||||||
@ -77,7 +86,7 @@ public class IntegrationURL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 根据区域编号获取下一级区域列表v2
|
// 根据区域编号获取下一级区域列表v2
|
||||||
public static String getRegionListByParentIndexCodeURL(String parentIndexCode, String resourceType,int pageNo,int pageSize,String accessToken) {
|
public static String getRegionListByParentIndexCodeURL(String parentIndexCode, String resourceType,String[] authCodes, int pageNo,int pageSize, Integer cascadeFlag, String accessToken) {
|
||||||
|
|
||||||
|
|
||||||
//设置接口的URI地址
|
//设置接口的URI地址
|
||||||
@ -95,8 +104,10 @@ public class IntegrationURL {
|
|||||||
JSONObject jsonBody = new JSONObject();
|
JSONObject jsonBody = new JSONObject();
|
||||||
jsonBody.put("parentIndexCode", parentIndexCode);
|
jsonBody.put("parentIndexCode", parentIndexCode);
|
||||||
jsonBody.put("resourceType",resourceType);
|
jsonBody.put("resourceType",resourceType);
|
||||||
|
jsonBody.put("authCodes",authCodes);
|
||||||
jsonBody.put("pageNo", pageNo);
|
jsonBody.put("pageNo", pageNo);
|
||||||
jsonBody.put("pageSize", pageSize);
|
jsonBody.put("pageSize", pageSize);
|
||||||
|
jsonBody.put("cascadeFlag",cascadeFlag);
|
||||||
String body = jsonBody.toJSONString();
|
String body = jsonBody.toJSONString();
|
||||||
|
|
||||||
//请求头添加 access_token认证
|
//请求头添加 access_token认证
|
||||||
@ -166,7 +177,7 @@ public class IntegrationURL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 增量获取区域数据
|
// 增量获取区域数据
|
||||||
public static String getRegionTimeRangeURL(String startTime, String pageNo, String pageSize,String accessToken) {
|
public static String getRegionTimeRangeURL(String startTime, String endTime, String pageNo, String pageSize,String accessToken) {
|
||||||
//设置接口的URI地址
|
//设置接口的URI地址
|
||||||
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v1/region/timeRange";
|
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v1/region/timeRange";
|
||||||
Map<String, String> path = new HashMap<String, String>(2) {
|
Map<String, String> path = new HashMap<String, String>(2) {
|
||||||
@ -181,6 +192,7 @@ public class IntegrationURL {
|
|||||||
//组装请求参数
|
//组装请求参数
|
||||||
JSONObject jsonBody = new JSONObject();
|
JSONObject jsonBody = new JSONObject();
|
||||||
jsonBody.put("startTime", startTime);
|
jsonBody.put("startTime", startTime);
|
||||||
|
jsonBody.put("endTime", endTime);
|
||||||
jsonBody.put("pageNo", pageNo);
|
jsonBody.put("pageNo", pageNo);
|
||||||
jsonBody.put("pageSize", pageSize);
|
jsonBody.put("pageSize", pageSize);
|
||||||
String body = jsonBody.toJSONString();
|
String body = jsonBody.toJSONString();
|
||||||
@ -195,7 +207,7 @@ public class IntegrationURL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//查询监控点列表v2
|
//查询监控点列表v2
|
||||||
public static String getCameraListURL(int pageNo,int pageSize,String accessToken) {
|
public static String getCameraListURL(String name, String[] regionIndexCodes, Boolean isSubRegion, int pageNo,int pageSize, String[] authCodes, Object[] expressions, String orderBy, String orderType, String accessToken) {
|
||||||
|
|
||||||
//设置接口的URI地址
|
//设置接口的URI地址
|
||||||
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v2/camera/search";
|
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v2/camera/search";
|
||||||
@ -210,8 +222,15 @@ public class IntegrationURL {
|
|||||||
|
|
||||||
//组装请求参数
|
//组装请求参数
|
||||||
JSONObject jsonBody = new JSONObject();
|
JSONObject jsonBody = new JSONObject();
|
||||||
|
jsonBody.put("name", name);
|
||||||
|
jsonBody.put("regionIndexCodes", regionIndexCodes);
|
||||||
|
jsonBody.put("isSubRegion", isSubRegion);
|
||||||
jsonBody.put("pageNo", pageNo); //当前页码
|
jsonBody.put("pageNo", pageNo); //当前页码
|
||||||
jsonBody.put("pageSize", pageSize); //分页大小
|
jsonBody.put("pageSize", pageSize); //分页大小
|
||||||
|
jsonBody.put("authCodes", authCodes);
|
||||||
|
jsonBody.put("expressions", expressions);
|
||||||
|
jsonBody.put("orderBy", orderBy);
|
||||||
|
jsonBody.put("orderType", orderType);
|
||||||
String body = jsonBody.toJSONString();
|
String body = jsonBody.toJSONString();
|
||||||
|
|
||||||
//请求头添加 access_token认证
|
//请求头添加 access_token认证
|
||||||
@ -312,7 +331,7 @@ public class IntegrationURL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 增量获取监控点数据
|
// 增量获取监控点数据
|
||||||
public static String getCameraTimeRangeURL(String startTime, int pageNo, int pageSize, String accessToken) {
|
public static String getCameraTimeRangeURL(String startTime, String endTime, int pageNo, int pageSize, String accessToken) {
|
||||||
|
|
||||||
//设置接口的URI地址
|
//设置接口的URI地址
|
||||||
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v1/camera/timeRange";
|
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v1/camera/timeRange";
|
||||||
@ -328,6 +347,7 @@ public class IntegrationURL {
|
|||||||
//组装请求参数
|
//组装请求参数
|
||||||
JSONObject jsonBody = new JSONObject();
|
JSONObject jsonBody = new JSONObject();
|
||||||
jsonBody.put("startTime", startTime);
|
jsonBody.put("startTime", startTime);
|
||||||
|
jsonBody.put("endTime", endTime);
|
||||||
jsonBody.put("pageNo", pageNo); //当前页码
|
jsonBody.put("pageNo", pageNo); //当前页码
|
||||||
jsonBody.put("pageSize", pageSize); //分页大小
|
jsonBody.put("pageSize", pageSize); //分页大小
|
||||||
String body = jsonBody.toJSONString();
|
String body = jsonBody.toJSONString();
|
||||||
|
@ -45,8 +45,8 @@ public class GetCameraInfoUtil {
|
|||||||
try {
|
try {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
JsonNode jsonNode = objectMapper.readTree(accessTokenUrlResp);
|
JsonNode jsonNode = objectMapper.readTree(accessTokenUrlResp);
|
||||||
accessToken = jsonNode.get("access_token").asText();
|
accessToken = jsonNode.path("data").path("access_token").asText();
|
||||||
|
System.out.println("getCameraInfo获取到的token--------------------------------------:" + accessToken);
|
||||||
// 将 access_token 存入 Redis,设置过期时间为 11 小时(有效期12小时)
|
// 将 access_token 存入 Redis,设置过期时间为 11 小时(有效期12小时)
|
||||||
redisTemplate.opsForValue().set(ACCESS_TOKEN_KEY, accessToken, 11, TimeUnit.HOURS);
|
redisTemplate.opsForValue().set(ACCESS_TOKEN_KEY, accessToken, 11, TimeUnit.HOURS);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -85,73 +85,74 @@ public class GetCameraInfoUtil {
|
|||||||
JsonNode jsonNode;
|
JsonNode jsonNode;
|
||||||
JsonNode cameraDataList;
|
JsonNode cameraDataList;
|
||||||
// 查询有几条记录
|
// 查询有几条记录
|
||||||
// String cameraListPageURL = IntegrationURL.getCameraResourceURL(1, 1, getAccessToken());
|
String cameraListPageURL = IntegrationURL.getCameraResourceURL(1, 1, getAccessToken());
|
||||||
// if (!checkToken(cameraListPageURL)) {
|
if (!checkToken(cameraListPageURL)) {
|
||||||
// cameraListPageURL = IntegrationURL.getCameraResourceURL(1, 1, getAccessToken());
|
cameraListPageURL = IntegrationURL.getCameraResourceURL(1, 1, getAccessToken());
|
||||||
// }
|
}
|
||||||
String cameraListPageURL = " {\n" +
|
// String cameraListPageURL = " {\n" +
|
||||||
" \"code\": \"0\", \n" +
|
// " \"code\": \"0\", \n" +
|
||||||
" \"msg\": \"success\", \n" +
|
// " \"msg\": \"success\", \n" +
|
||||||
" \"data\": {\n" +
|
// " \"data\": {\n" +
|
||||||
" \"total\": 13, \n" +
|
// " \"total\": 13, \n" +
|
||||||
" \"pageNo\": 1, \n" +
|
// " \"pageNo\": 1, \n" +
|
||||||
" \"pageSize\": 1, \n" +
|
// " \"pageSize\": 1, \n" +
|
||||||
" \"list\": [\n" +
|
// " \"list\": [\n" +
|
||||||
" {\n" +
|
// " {\n" +
|
||||||
" \"altitude\": null, \n" +
|
// " \"altitude\": null, \n" +
|
||||||
" \"cameraIndexCode\": \"eddf8458f74d42e9bf4ecfc752dba146\", \n" +
|
// " \"cameraIndexCode\": \"eddf8458f74d42e9bf4ecfc752dba146\", \n" +
|
||||||
" \"cameraName\": \"3层吉米后厨入口\", \n" +
|
// " \"cameraName\": \"3层吉米后厨入口\", \n" +
|
||||||
" \"cameraType\": 0, \n" +
|
// " \"cameraType\": 0, \n" +
|
||||||
" \"cameraTypeName\": \"枪机\", \n" +
|
// " \"cameraTypeName\": \"枪机\", \n" +
|
||||||
" \"capabilitySet\": \"io,event_io,event_ias,event_rule,event_heat,record,net,event_face,vss,ptz,status,maintenance,event_device\", \n" +
|
// " \"capabilitySet\": \"io,event_io,event_ias,event_rule,event_heat,record,net,event_face,vss,ptz,status,maintenance,event_device\", \n" +
|
||||||
" \"capabilitySetName\": null, \n" +
|
// " \"capabilitySetName\": null, \n" +
|
||||||
" \"intelligentSet\": null, \n" +
|
// " \"intelligentSet\": null, \n" +
|
||||||
" \"intelligentSetName\": null, \n" +
|
// " \"intelligentSetName\": null, \n" +
|
||||||
" \"channelNo\": \"33\", \n" +
|
// " \"channelNo\": \"33\", \n" +
|
||||||
" \"channelType\": \"digital\", \n" +
|
// " \"channelType\": \"digital\", \n" +
|
||||||
" \"channelTypeName\": \"数字通道\", \n" +
|
// " \"channelTypeName\": \"数字通道\", \n" +
|
||||||
" \"createTime\": \"2018-09-15T11:14:27.812+08:00\", \n" +
|
// " \"createTime\": \"2018-09-15T11:14:27.812+08:00\", \n" +
|
||||||
" \"encodeDevIndexCode\": \"1d3d5c26e6174cf1aa452f57cac91879\", \n" +
|
// " \"encodeDevIndexCode\": \"1d3d5c26e6174cf1aa452f57cac91879\", \n" +
|
||||||
" \"encodeDevResourceType\": null, \n" +
|
// " \"encodeDevResourceType\": null, \n" +
|
||||||
" \"encodeDevResourceTypeName\": null, \n" +
|
// " \"encodeDevResourceTypeName\": null, \n" +
|
||||||
" \"gbIndexCode\": null, \n" +
|
// " \"gbIndexCode\": null, \n" +
|
||||||
" \"installLocation\": null, \n" +
|
// " \"installLocation\": null, \n" +
|
||||||
" \"keyBoardCode\": null, \n" +
|
// " \"keyBoardCode\": null, \n" +
|
||||||
" \"latitude\": null, \n" +
|
// " \"latitude\": null, \n" +
|
||||||
" \"longitude\": null, \n" +
|
// " \"longitude\": null, \n" +
|
||||||
" \"pixel\": null, \n" +
|
// " \"pixel\": null, \n" +
|
||||||
" \"ptz\": null, \n" +
|
// " \"ptz\": null, \n" +
|
||||||
" \"ptzName\": null, \n" +
|
// " \"ptzName\": null, \n" +
|
||||||
" \"ptzController\": null, \n" +
|
// " \"ptzController\": null, \n" +
|
||||||
" \"ptzControllerName\": null, \n" +
|
// " \"ptzControllerName\": null, \n" +
|
||||||
" \"recordLocation\": null, \n" +
|
// " \"recordLocation\": null, \n" +
|
||||||
" \"recordLocationName\": null, \n" +
|
// " \"recordLocationName\": null, \n" +
|
||||||
" \"regionIndexCode\": \"2feadc43-ffef-464b-a2e2-b146a02de5ba\", \n" +
|
// " \"regionIndexCode\": \"2feadc43-ffef-464b-a2e2-b146a02de5ba\", \n" +
|
||||||
" \"status\": null, \n" +
|
// " \"status\": null, \n" +
|
||||||
" \"statusName\": null, \n" +
|
// " \"statusName\": null, \n" +
|
||||||
" \"transType\": 1, \n" +
|
// " \"transType\": 1, \n" +
|
||||||
" \"transTypeName\": \"TCP\", \n" +
|
// " \"transTypeName\": \"TCP\", \n" +
|
||||||
" \"treatyType\": null, \n" +
|
// " \"treatyType\": null, \n" +
|
||||||
" \"treatyTypeName\": null, \n" +
|
// " \"treatyTypeName\": null, \n" +
|
||||||
" \"viewshed\": null, \n" +
|
// " \"viewshed\": null, \n" +
|
||||||
" \"updateTime\": \"2018-09-15T11:19:48.973+08:00\"\n" +
|
// " \"updateTime\": \"2018-09-15T11:19:48.973+08:00\"\n" +
|
||||||
" }\n" +
|
// " }\n" +
|
||||||
" ]\n" +
|
// " ]\n" +
|
||||||
" }\n" +
|
// " }\n" +
|
||||||
"}\n";
|
// "}\n";
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
jsonNode = objectMapper.readTree(cameraListPageURL);
|
jsonNode = objectMapper.readTree(cameraListPageURL);
|
||||||
// total = jsonNode.path("data").path("total").asInt();
|
total = jsonNode.path("data").path("total").asInt();
|
||||||
total = 1;
|
System.out.println("total::::::::::::::::::::::::::::::::::::::" + total);
|
||||||
|
// total = 1;
|
||||||
|
|
||||||
JsonNode cameraNode;
|
JsonNode cameraNode;
|
||||||
// 查询所有记录的cameraIndexCode并保存
|
// 查询所有记录的cameraIndexCode并保存
|
||||||
for (int i = 1; i <= (total / 100) + 1; i++) {
|
for (int i = 1; i <= (total / 100) + 1; i++) {
|
||||||
System.out.println("开始第" + i + "次查询");
|
System.out.println("开始第" + i + "次查询");
|
||||||
// cameraListPageURL = IntegrationURL.getCameraResourceURL(i, 100, getAccessToken());
|
cameraListPageURL = IntegrationURL.getCameraResourceURL(i, 100, getAccessToken());
|
||||||
jsonNode = objectMapper.readTree(cameraListPageURL);
|
jsonNode = objectMapper.readTree(cameraListPageURL);
|
||||||
cameraDataList = jsonNode.path("data").path("list");
|
cameraDataList = jsonNode.path("data").path("list");
|
||||||
System.out.println(cameraDataList);
|
System.out.println("cameraDataList::::::::::::::::::::::::::::::::::::::" + cameraDataList);
|
||||||
Iterator<JsonNode> elements2 = cameraDataList.elements();
|
Iterator<JsonNode> elements2 = cameraDataList.elements();
|
||||||
while (elements2.hasNext()) {
|
while (elements2.hasNext()) {
|
||||||
CameraDO cameraDO = new CameraDO();
|
CameraDO cameraDO = new CameraDO();
|
||||||
|
@ -46,7 +46,8 @@ public class GetRegionInfoUtil {
|
|||||||
try {
|
try {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
JsonNode jsonNode = objectMapper.readTree(accessTokenUrlResp);
|
JsonNode jsonNode = objectMapper.readTree(accessTokenUrlResp);
|
||||||
accessToken = jsonNode.get("access_token").asText();
|
accessToken = jsonNode.path("data").path("access_token").asText();
|
||||||
|
System.out.println("accessToken " + accessToken);
|
||||||
|
|
||||||
// 将 access_token 存入 Redis,设置过期时间为 11 小时(有效期12小时)
|
// 将 access_token 存入 Redis,设置过期时间为 11 小时(有效期12小时)
|
||||||
redisTemplate.opsForValue().set(ACCESS_TOKEN_KEY, accessToken, 11, TimeUnit.HOURS);
|
redisTemplate.opsForValue().set(ACCESS_TOKEN_KEY, accessToken, 11, TimeUnit.HOURS);
|
||||||
@ -80,6 +81,7 @@ public class GetRegionInfoUtil {
|
|||||||
|
|
||||||
@GetMapping("/getRegionListToDB")
|
@GetMapping("/getRegionListToDB")
|
||||||
public void getRegionListToDB() {
|
public void getRegionListToDB() {
|
||||||
|
System.out.println("token:" + getAccessToken());
|
||||||
try {
|
try {
|
||||||
// 总记录数
|
// 总记录数
|
||||||
int total = 0;
|
int total = 0;
|
||||||
@ -91,35 +93,36 @@ public class GetRegionInfoUtil {
|
|||||||
JsonNode jsonNode;
|
JsonNode jsonNode;
|
||||||
JsonNode regionDataList;
|
JsonNode regionDataList;
|
||||||
// 查询有几条记录
|
// 查询有几条记录
|
||||||
// String regionListPageURL = IntegrationURL.getRegionListPageURL(1, 1, getAccessToken());
|
String regionListPageURL = IntegrationURL.getRegionListPageURL(1, 1, getAccessToken());
|
||||||
String regionListPageURL = "{\n" +
|
// String regionListPageURL = "{\n" +
|
||||||
" \"code\": \"0\",\n" +
|
// " \"code\": \"0\",\n" +
|
||||||
" \"msg\": \"SUCCESS\",\n" +
|
// " \"msg\": \"SUCCESS\",\n" +
|
||||||
" \"data\": {\n" +
|
// " \"data\": {\n" +
|
||||||
" \"total\": 18,\n" +
|
// " \"total\": 18,\n" +
|
||||||
" \"pageNo\": 2,\n" +
|
// " \"pageNo\": 2,\n" +
|
||||||
" \"pageSize\": 3,\n" +
|
// " \"pageSize\": 3,\n" +
|
||||||
" \"list\": [\n" +
|
// " \"list\": [\n" +
|
||||||
" {\n" +
|
// " {\n" +
|
||||||
" \"indexCode\": \"root000000\",\n" +
|
// " \"indexCode\": \"root000000\",\n" +
|
||||||
" \"name\": \"根节点\",\n" +
|
// " \"name\": \"根节点\",\n" +
|
||||||
" \"parentIndexCode\": \"null\",\n" +
|
// " \"parentIndexCode\": \"null\",\n" +
|
||||||
" \"treeCode\": \"0\"\n" +
|
// " \"treeCode\": \"0\"\n" +
|
||||||
" }\n" +
|
// " }\n" +
|
||||||
" ]\n" +
|
// " ]\n" +
|
||||||
" }\n" +
|
// " }\n" +
|
||||||
"}\n";
|
// "}\n";
|
||||||
// if (!checkToken(regionListPageURL)) {
|
if (!checkToken(regionListPageURL)) {
|
||||||
// regionListPageURL = IntegrationURL.getRegionListPageURL(1, 1, getAccessToken());
|
regionListPageURL = IntegrationURL.getRegionListPageURL(1, 1, getAccessToken());
|
||||||
// }
|
}
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
jsonNode = objectMapper.readTree(regionListPageURL);
|
jsonNode = objectMapper.readTree(regionListPageURL);
|
||||||
total = jsonNode.path("data").path("total").asInt();
|
total = jsonNode.path("data").path("total").asInt();
|
||||||
|
System.out.println("共" + total + "条数据");
|
||||||
// 查询所有记录的indexCode并保存
|
// 查询所有记录的indexCode并保存
|
||||||
indexCodes = new String[100];
|
indexCodes = new String[100];
|
||||||
for (int i = 1; i <= (total / 100) + 1; i++) {
|
for (int i = 1; i <= (total / 100) + 1; i++) {
|
||||||
// regionListPageURL = IntegrationURL.getRegionListPageURL(i, 100, getAccessToken());
|
regionListPageURL = IntegrationURL.getRegionListPageURL(i, 100, getAccessToken());
|
||||||
|
System.out.println("获取的数据:::::::::::::::::"+regionListPageURL);
|
||||||
ObjectMapper objectMapper2 = new ObjectMapper();
|
ObjectMapper objectMapper2 = new ObjectMapper();
|
||||||
jsonNode = objectMapper2.readTree(regionListPageURL);
|
jsonNode = objectMapper2.readTree(regionListPageURL);
|
||||||
regionDataList = jsonNode.path("data").path("list");
|
regionDataList = jsonNode.path("data").path("list");
|
||||||
@ -131,32 +134,32 @@ public class GetRegionInfoUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 保存后使用indexCodes数组查询区域详细信息
|
// 保存后使用indexCodes数组查询区域详细信息
|
||||||
// String regionListPageURL2 = IntegrationURL.getRegionByIndexCodesURL(indexCodes, getAccessToken());
|
String regionListPageURL2 = IntegrationURL.getRegionByIndexCodesURL(indexCodes, getAccessToken());
|
||||||
String regionListPageURL2 = "{\n" +
|
// String regionListPageURL2 = "{\n" +
|
||||||
" \"code\": \"0\",\n" +
|
// " \"code\": \"0\",\n" +
|
||||||
" \"msg\": \"SUCCESS\",\n" +
|
// " \"msg\": \"SUCCESS\",\n" +
|
||||||
" \"data\": {\n" +
|
// " \"data\": {\n" +
|
||||||
" \"total\": 1,\n" +
|
// " \"total\": 1,\n" +
|
||||||
" \"list\": [\n" +
|
// " \"list\": [\n" +
|
||||||
" {\n" +
|
// " {\n" +
|
||||||
" \"indexCode\": \"root000000\",\n" +
|
// " \"indexCode\": \"root000000\",\n" +
|
||||||
" \"name\": \"根节点123123123123\",\n" +
|
// " \"name\": \"根节点123123123123\",\n" +
|
||||||
" \"regionPath\": \"@root000000@\",\n" +
|
// " \"regionPath\": \"@root000000@\",\n" +
|
||||||
" \"parentIndexCode\": \"-1\",\n" +
|
// " \"parentIndexCode\": \"-1\",\n" +
|
||||||
" \"available\": true,\n" +
|
// " \"available\": true,\n" +
|
||||||
" \"leaf\": false,\n" +
|
// " \"leaf\": false,\n" +
|
||||||
" \"cascadeCode\": \"0\",\n" +
|
// " \"cascadeCode\": \"0\",\n" +
|
||||||
" \"cascadeType\": 0,\n" +
|
// " \"cascadeType\": 0,\n" +
|
||||||
" \"catalogType\": 10,\n" +
|
// " \"catalogType\": 10,\n" +
|
||||||
" \"externalIndexCode\": \"34\",\n" +
|
// " \"externalIndexCode\": \"34\",\n" +
|
||||||
" \"parentExternalIndexCode\": \"34\",\n" +
|
// " \"parentExternalIndexCode\": \"34\",\n" +
|
||||||
" \"sort\": 1,\n" +
|
// " \"sort\": 1,\n" +
|
||||||
" \"createTime\": \"2019-08-06T14:01:17.839+0800\",\n" +
|
// " \"createTime\": \"2019-08-06T14:01:17.839+0800\",\n" +
|
||||||
" \"updateTime\": \"2019-08-07T14:01:17.839+0800\"\n" +
|
// " \"updateTime\": \"2019-08-07T14:01:17.839+0800\"\n" +
|
||||||
" }\n" +
|
// " }\n" +
|
||||||
" ]\n" +
|
// " ]\n" +
|
||||||
" }\n" +
|
// " }\n" +
|
||||||
"}\n";
|
// "}\n";
|
||||||
jsonNode = objectMapper.readTree(regionListPageURL2);
|
jsonNode = objectMapper.readTree(regionListPageURL2);
|
||||||
regionDataList = jsonNode.path("data").path("list");
|
regionDataList = jsonNode.path("data").path("list");
|
||||||
Iterator<JsonNode> elements3 = regionDataList.elements();
|
Iterator<JsonNode> elements3 = regionDataList.elements();
|
||||||
@ -172,6 +175,7 @@ public class GetRegionInfoUtil {
|
|||||||
regionDO.setCatalogType(regionNode.path("catalogType").asInt());
|
regionDO.setCatalogType(regionNode.path("catalogType").asInt());
|
||||||
regionDO.setExternalIndexCode(regionNode.path("externalIndexCode").asText());
|
regionDO.setExternalIndexCode(regionNode.path("externalIndexCode").asText());
|
||||||
regionDO.setSort(regionNode.path("sort").asInt());
|
regionDO.setSort(regionNode.path("sort").asInt());
|
||||||
|
regionDO.setLeaf(regionNode.path("leaf").asInt());
|
||||||
System.out.println(regionNode.path("createTime").asText());
|
System.out.println(regionNode.path("createTime").asText());
|
||||||
regionDO.setCreateTime(dateParse(regionNode.path("createTime").asText()));
|
regionDO.setCreateTime(dateParse(regionNode.path("createTime").asText()));
|
||||||
regionDO.setUpdateTime(dateParse(regionNode.path("updateTime").asText()));
|
regionDO.setUpdateTime(dateParse(regionNode.path("updateTime").asText()));
|
||||||
|
@ -12,9 +12,9 @@ public class IntegrationURL {
|
|||||||
|
|
||||||
//设置平台参数,根据实际情况,设置host appKey appSecret 三个参数.
|
//设置平台参数,根据实际情况,设置host appKey appSecret 三个参数.
|
||||||
static {
|
static {
|
||||||
ArtemisConfig.host = "127.0.0.1:443"; // 平台的ip端口
|
ArtemisConfig.host = "192.168.11.3:443"; // 平台的ip端口
|
||||||
ArtemisConfig.appKey = "29180881"; // 密钥appkey
|
ArtemisConfig.appKey = "22116579"; // 密钥appkey
|
||||||
ArtemisConfig.appSecret = "XO0wCAYGi4KV70ybjznx";// 密钥appSecret
|
ArtemisConfig.appSecret = "AqL0EZSvZ60vzvO3Gqx9";// 密钥appSecret
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置OpenAPI接口的上下文
|
//设置OpenAPI接口的上下文
|
||||||
@ -29,9 +29,10 @@ public class IntegrationURL {
|
|||||||
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v1/regions/root";
|
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v1/regions/root";
|
||||||
Map<String, String> path = new HashMap<String, String>(2) {
|
Map<String, String> path = new HashMap<String, String>(2) {
|
||||||
{
|
{
|
||||||
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
|
put("http://", previewURLsApi);//根据现场环境部署确认是http还是https
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
System.out.println(path);
|
||||||
|
|
||||||
//设置参数提交方式
|
//设置参数提交方式
|
||||||
String contentType = "application/json";
|
String contentType = "application/json";
|
||||||
|
@ -55,8 +55,8 @@ public interface CameraService {
|
|||||||
|
|
||||||
CameraDO selectByCameraIndexCode(String cameraIndexCode);
|
CameraDO selectByCameraIndexCode(String cameraIndexCode);
|
||||||
|
|
||||||
String getPreviewUrl(String cameraIndexCode);
|
String getPreviewUrl(String cameraIndexCode, Integer streamType, String protocol, Integer transmode, String expand, String streamform);
|
||||||
String getPlayBackUrl(String cameraIndexCode, String startTime, String endTime);
|
String getPlayBackUrl(String cameraIndexCode, Integer recordLocation, String protocol, Integer transmode, String beginTime, String endTime, String uuid, String expand, String streamform, Integer lockType);
|
||||||
|
|
||||||
void updateCameraCheckByCameraIndexCode(@Valid CameraSaveReqVO cameraSaveReqVO);
|
void updateCameraCheckByCameraIndexCode(@Valid CameraSaveReqVO cameraSaveReqVO);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user