5 changed files with 137 additions and 4 deletions
			
			
		| @ -0,0 +1,72 @@ | |||||||
|  | package com.hnac.hzims.common.utils; | ||||||
|  | 
 | ||||||
|  | import com.alibaba.druid.support.json.JSONUtils; | ||||||
|  | import com.alibaba.fastjson.JSON; | ||||||
|  | import com.alibaba.fastjson.JSONObject; | ||||||
|  | import com.fasterxml.jackson.databind.JsonNode; | ||||||
|  | import com.hikvision.artemis.sdk.ArtemisHttpUtil; | ||||||
|  | import com.hikvision.artemis.sdk.config.ArtemisConfig; | ||||||
|  | import okhttp3.MediaType; | ||||||
|  | import okhttp3.MultipartBody; | ||||||
|  | import okhttp3.RequestBody; | ||||||
|  | import org.springblade.core.log.exception.ServiceException; | ||||||
|  | import org.springblade.core.log.logger.BladeLogger; | ||||||
|  | import org.springblade.core.tool.jackson.JsonUtil; | ||||||
|  | import org.springblade.core.tool.utils.DateUtil; | ||||||
|  | import org.springblade.core.tool.utils.Func; | ||||||
|  | import org.springblade.server.domain.Sys; | ||||||
|  | import org.springframework.beans.factory.annotation.Value; | ||||||
|  | import org.springframework.util.Assert; | ||||||
|  | 
 | ||||||
|  | import java.text.DateFormat; | ||||||
|  | import java.time.LocalDateTime; | ||||||
|  | import java.time.ZoneId; | ||||||
|  | import java.time.ZoneOffset; | ||||||
|  | import java.time.format.DateTimeFormatter; | ||||||
|  | import java.util.HashMap; | ||||||
|  | import java.util.Map; | ||||||
|  | import java.util.Optional; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * @Author: huangxing | ||||||
|  |  * @Date: 2024/1/10 14:40 | ||||||
|  |  */ | ||||||
|  | public class HiKUtil { | ||||||
|  | 
 | ||||||
|  | 	public static String APP_KEY = "26486442"; | ||||||
|  | 	public static String APP_SECRET = "tXBM9jsMqeM9yvEMS8qg"; | ||||||
|  | 	public static String HOST = "140.210.208.111:443"; | ||||||
|  | 
 | ||||||
|  |     public static String send(String api, Map<String, Object> map) { | ||||||
|  | 		ArtemisConfig.host = HOST; | ||||||
|  | 		ArtemisConfig.appKey = APP_KEY; | ||||||
|  | 		ArtemisConfig.appSecret = APP_SECRET; | ||||||
|  | 
 | ||||||
|  |         final String url = "/artemis" + api; | ||||||
|  | 		Map<String, String> path = new HashMap<String,String>(2){{ | ||||||
|  | 			put("https://", url); | ||||||
|  | 		}}; | ||||||
|  |         String contentType = "application/json"; | ||||||
|  |         String body = JSON.toJSONString(map); | ||||||
|  |         String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType, null); | ||||||
|  | 		JSONObject object = JsonUtil.parse(result, JSONObject.class); | ||||||
|  |         return object.getString("data"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 	public static String send(String api, Map<String, Object> map, String host,String appKey,String appSecret) { | ||||||
|  | 		ArtemisConfig.host = host; | ||||||
|  | 		ArtemisConfig.appKey = appKey; | ||||||
|  | 		ArtemisConfig.appSecret = appSecret; | ||||||
|  | 
 | ||||||
|  | 		final String url = "/artemis" + api; | ||||||
|  | 		Map<String, String> path = new HashMap<String,String>(2){{ | ||||||
|  | 			put("https://", url); | ||||||
|  | 		}}; | ||||||
|  | 		String contentType = "application/json"; | ||||||
|  | 		String body = JSON.toJSONString(map); | ||||||
|  | 		String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType, null); | ||||||
|  | 		JSONObject object = JsonUtil.parse(result, JSONObject.class); | ||||||
|  | 		return object.getString("data"); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | } | ||||||
					Loading…
					
					
				
		Reference in new issue