Commit d746cadf LN

hik接口修改

1 个父辈 93b61fb9
......@@ -367,6 +367,9 @@ public class LiteOrderCache implements ITaskListener {
public LiteOrder updateOrderItem(LiteOrder order,LiteOrderItem item) {
List<LiteOrderItem> items = order.getOrderItems();
if(items==null){
items=new ArrayList<>();
}
boolean find = false;
for (LiteOrderItem oldItem :
......
......@@ -279,7 +279,9 @@ public class LiteOrder extends BasePo implements Serializable {
this.setUpdateDate(new Date());
this.setEndDate(outInfo.getEndD());
this.setWemng(outInfo.getWemng());
orderItems=new ArrayList<>();
if(orderItems==null){
orderItems=new ArrayList<>();
}
}
public void addOrderItems(LiteOrderItem item){
......
package com.neotel.smfcore.hikvision;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.hikvision.bean.*;
import com.neotel.smfcore.hikvision.bean.api.HikApiRequest;
import com.neotel.smfcore.hikvision.bean.api.RequestParam;
......@@ -10,10 +9,8 @@ import com.neotel.smfcore.hikvision.util.HttpHelper;
import com.neotel.smfcore.hikvision.util.JsonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -116,7 +113,7 @@ public class HikApi {
log.info("Hik 转储单接口 (transferOrder): 发送" + data);
boolean needResend = false;
try {
ResponseParam responseInfo = HttpHelper.postJson(request);
ResponseParam responseInfo = HttpHelper.post(request);
if (responseInfo == null || responseInfo.getCode().equals(-1)) {
// needResend = true;
......@@ -164,7 +161,7 @@ public class HikApi {
log.info(apiName+" 发送" + data);
boolean needResend = false;
try {
ResponseParam responseInfo = HttpHelper.postJson(request);
ResponseParam responseInfo = HttpHelper.post(request);
if (responseInfo == null || responseInfo.getCode().equals(-1)) {
// needResend = true;
......@@ -222,7 +219,7 @@ public class HikApi {
log.info(apiName+" 发送" + data);
boolean needResend = false;
try {
ResponseParam responseInfo = HttpHelper.postJson(request);
ResponseParam responseInfo = HttpHelper.post(request);
if (responseInfo == null || responseInfo.getCode().equals(-1)) {
// needResend = true;
......@@ -266,7 +263,7 @@ public class HikApi {
log.info(apiName+" 发送" + info.getData());
boolean needResend = false;
try {
ResponseParam responseInfo = HttpHelper.postJson(request);
ResponseParam responseInfo = HttpHelper.post(request);
if (responseInfo == null || responseInfo.getCode().equals(-1)) {
// needResend = true;
......@@ -341,7 +338,7 @@ public class HikApi {
log.info(apiName+" 发送" + data);
boolean needResend = false;
try {
ResponseParam responseInfo = HttpHelper.postJson(request);
ResponseParam responseInfo = HttpHelper.post(request);
if (responseInfo == null || responseInfo.getCode().equals(-1)) {
// needResend = true;
......@@ -400,7 +397,7 @@ public class HikApi {
log.info(apiName+" 发送" + data);
boolean needResend = false;
try {
ResponseParam responseInfo = HttpHelper.postJson(request);
ResponseParam responseInfo = HttpHelper.post(request);
if (responseInfo == null || responseInfo.getCode().equals(-1)) {
// needResend = true;
......@@ -439,7 +436,7 @@ public class HikApi {
List<Object> resultList=new ArrayList<>();
log.info(apiName+" 发送" + info.getData());
try {
ResponseParam responseInfo = HttpHelper.postJson(request);
ResponseParam responseInfo = HttpHelper.post(request);
if (responseInfo == null || responseInfo.getCode().equals(-1)) {
// needResend = true;
......@@ -510,7 +507,7 @@ public class HikApi {
log.info(apiName+" 发送" + info.getData());
boolean needResend = false;
try {
ResponseParam responseInfo = HttpHelper.postJson(request);
ResponseParam responseInfo = HttpHelper.post(request);
if (responseInfo == null || responseInfo.getCode().equals(-1)) {
// needResend = true;
......@@ -548,7 +545,7 @@ public class HikApi {
log.info(apiName+" 发送" + info.getData());
boolean needResend = false;
try {
ResponseParam responseInfo = HttpHelper.postJson(request);
ResponseParam responseInfo = HttpHelper.post(request);
if (responseInfo == null || responseInfo.getCode().equals(-1)) {
// needResend = true;
......@@ -607,7 +604,7 @@ public class HikApi {
log.info(apiName+" 发送" + info.getData());
boolean needResend = false;
try {
ResponseParam responseInfo = HttpHelper.postJson(request);
ResponseParam responseInfo = HttpHelper.post(request);
if (responseInfo == null || responseInfo.getCode().equals(-1)) {
// needResend = true;
......@@ -657,7 +654,7 @@ public class HikApi {
log.info(apiName+" 发送" + info.getData());
boolean needResend = false;
try {
ResponseParam responseInfo = HttpHelper.postJson(request);
ResponseParam responseInfo = HttpHelper.post(request);
if (responseInfo == null || responseInfo.getCode().equals(-1)) {
// needResend = true;
......
......@@ -89,7 +89,7 @@ public class HikApiCache {
});
for (HikApiRequest apiRequest : failedList) {
ResponseParam responseParam = HttpHelper.postJson(apiRequest);
ResponseParam responseParam = HttpHelper.post(apiRequest);
boolean needResend = false;
if (responseParam == null || responseParam.getCode().equals(-1)) {
......
......@@ -14,6 +14,7 @@ import com.neotel.smfcore.hikvision.bean.HikOrderInfo;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
......@@ -23,7 +24,8 @@ import java.util.List;
import java.util.Map;
@Slf4j
@Controller
@RestController
@RequiredArgsConstructor
@RequestMapping("/rest/api")
@Api(tags = "海康API")
public class HikvisionApiController {
......@@ -93,6 +95,7 @@ public class HikvisionApiController {
liteOrderManager.createWithItems(order);
liteOrderCache.addOrderToMap(order);
log.info("新建工单[" + order.getOrderNo() + "]工单详情"+order.getOrderItems().size()+"条" );
} else {
if (order.getStatus() > LITEORDER_STATUS.NEW) {
......@@ -104,13 +107,15 @@ public class HikvisionApiController {
LiteOrderItem item = outInfo.crateOrderItem(orderNo);
order = liteOrderCache.updateOrderItem(order, item);
liteOrderManager.save(order);
liteOrderCache.addOrderToMap(order);
log.info("更新工单[" + order.getOrderNo() + "]物料号["+item.getMaterialNo()+"]" );
}
}
}
return ResultBean.newOkResult("");
return ResultBean.newOkResult("smfcore.order.uploadOK", "工单上传成功", "");
}
@ApiOperation("对湿敏过期物料进行冻结")
......@@ -160,6 +165,6 @@ public class HikvisionApiController {
log.info("lockMsl:对湿敏过期物料进行冻结 " + reelIds);
}
return ResultBean.newOkResult("");
return ResultBean.newOkResult("smfcore.order.lockMslOk","冻结湿敏物料成功","");
}
}
package com.neotel.smfcore.hikvision.util;
import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.hikvision.bean.api.HikApiRequest;
import com.neotel.smfcore.hikvision.bean.api.RequestParam;
import com.neotel.smfcore.hikvision.bean.api.ResponseParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
import org.apache.commons.httpclient.params.HttpMethodParams;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.logging.log4j.util.Strings;
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.cookie.CookiePolicy;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.multipart.FilePart;
import org.apache.commons.httpclient.methods.multipart.Part;
import org.apache.commons.httpclient.methods.multipart.StringPart;
import org.springframework.util.CollectionUtils;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
......@@ -42,6 +38,99 @@ public class HttpHelper {
// 设置User-Agent
private static final String USER_AGENT = "SMD-BOX";
public static ResponseParam post(HikApiRequest request) throws ApiException {
String url = request.getUrl();
String key = request.getKey();
String secret = request.getSecret();
RequestParam param = request.getParam();
if (ObjectUtil.isEmpty(url)) {
return null;
}
Map<String, Object> params = new HashMap<>();
params.put("reqCode", param.getReqCode());
params.put("userCode", param.getUserCode());
params.put("data", param.getData());
String result = postJson(url, params, key, secret);
ResponseParam responseInfo = JsonUtil.toObj(result, ResponseParam.class);
if (responseInfo == null) {
log.error("[" + url + "][" + key + "][" + secret + "]发送[" + param.getReqCode() + "][" + param.getUserCode() + "][" + param.getData() + "],返回值:" + result);
responseInfo = new ResponseParam(param.getReqCode(), "-1", "", "");
} else {
log.info("[" + url + "][" + key + "][" + secret + "]发送[" + param.getReqCode() + "][" + param.getUserCode() + "][" + param.getData() + "],返回值:" + result);
}
return responseInfo;
}
public static String postJson(String url, Map<String, Object> params,String key,String secret ) throws ApiException {
String userName = "102";
Map<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "application/json;charset=utf-8");
if (Strings.isNotBlank(userName)) {
String auth = userName + ":" + secret;
//对其进行加密
byte[] rel = Base64.getEncoder().encode(auth.getBytes());
String res = new String(rel);
//设置认证属性
headers.put("Authorization", "Basic " + res);
headers.put("API_KEY", key);
}
try {
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost post = new HttpPost(url);
try {
if (!CollectionUtils.isEmpty(params)) {
StringEntity entity = new StringEntity(JsonUtil.toJsonStr(params), CONTENT_CHARSET);
entity.setContentEncoding(CONTENT_CHARSET);
post.setEntity(entity);
}
if (!CollectionUtils.isEmpty(headers)) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
post.addHeader(entry.getKey(), entry.getValue());
}
}
RequestConfig customReqConfig = getCustomReqConfig(CONNECTION_TIMEOUT, READ_DATA_TIMEOUT);
post.setConfig(customReqConfig);
HttpResponse res = httpClient.execute(post);
return convertInputStreamToString(res.getEntity().getContent(), CONTENT_CHARSET);
} finally {
post.releaseConnection();
}
} catch (Exception e) {
throw new ApiException("Request [" + url + "] failed:" + e.getMessage());
}
}
private static RequestConfig getCustomReqConfig(Integer connTimeout, Integer readTimeout) {
RequestConfig.Builder customReqConf = RequestConfig.custom();
if (connTimeout != null) {
customReqConf.setConnectTimeout(connTimeout);
}
if (readTimeout != null) {
customReqConf.setSocketTimeout(readTimeout);
}
return customReqConf.build();
}
private static String convertInputStreamToString(InputStream inputStream, String charset) throws UnsupportedEncodingException,
IOException {
try (InputStreamReader inputStreamReader = new InputStreamReader(inputStream, charset); BufferedReader bufferedReader = new BufferedReader(inputStreamReader)) {
String str = null;
StringBuilder buffer = new StringBuilder();
boolean flag = Boolean.FALSE.booleanValue();
while ((str = bufferedReader.readLine()) != null) {
if (flag) {
buffer.append(System.getProperty("line.separator"));
} else {
flag = Boolean.TRUE;
}
buffer.append(str);
}
return buffer.toString();
}
}
// public static String postJson(String url, Map<String, Object> params) throws ApiException {
// return postJson(url,params,null, "http");
// }
......@@ -50,90 +139,91 @@ public class HttpHelper {
// return get(url,params,null, "http");
// }
//
// public static String postParamWithAuth(String url, Map<String, Object> paramMap, String user, String pwd) throws ApiException {
// PrintWriter out = null;
// BufferedReader in = null;
// String result = "";
// try {
// URL realUrl = new URL(url);
// // 打开和URL之间的连接
// URLConnection conn = realUrl.openConnection();
// // 设置通用的请求属性
// conn.setRequestProperty("accept", "*/*");
// conn.setRequestProperty("connection", "Keep-Alive");
// conn.setRequestProperty("user-agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
// conn.setRequestProperty("Accept-Charset", "UTF-8");
//
// //设置用户名和密码
//
// if(Strings.isNotBlank(user)){
// String auth = user+":"+pwd;
// //对其进行加密
// byte[] rel = Base64.getEncoder().encode(auth.getBytes());
// String res = new String(rel);
// //设置认证属性
// conn.setRequestProperty("Authorization","Basic " + res);
// }
//
// // conn.setRequestProperty("Charset", "UTF-8");
// // 发送POST请求必须设置如下两行
// conn.setDoOutput(true);
// conn.setDoInput(true);
// conn.setConnectTimeout(20000);
// // 获取URLConnection对象对应的输出流
// //out = new PrintWriter(conn.getOutputStream());
// out = new PrintWriter(new OutputStreamWriter(conn.getOutputStream(),"utf-8"));
//
// // 设置请求属性
// String param = "";
// if (paramMap != null && paramMap.size() > 0) {
// Iterator<String> ite = paramMap.keySet().iterator();
// while (ite.hasNext()) {
// String key = ite.next();// key
// Object valueObj = paramMap.get(key);
// String value = "";
// if(valueObj != null){
// if(valueObj instanceof Date){
// DateUtil.toDateString((Date)valueObj,"yyyyMMdd");
// }else{
// value = valueObj.toString();
// }
// }
// param += key + "=" + value + "&";
// }
// param = param.substring(0, param.length() - 1);
// }
//
// // 发送请求参数
// out.print(param);
// // flush输出流的缓冲
// out.flush();
// // 定义BufferedReader输入流来读取URL的响应
// //in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
//
// in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
// String line;
// while ((line = in.readLine()) != null) {
// result += line;
// }
// } catch (Exception e) {
// throw new ApiException("Request [" + url + "] failed:" + e.getMessage());
// }
// // 使用finally块来关闭输出流、输入流
// finally {
// try {
// if (out != null) {
// out.close();
// }
// if (in != null) {
// in.close();
// }
// } catch (IOException ex) {
// throw new ApiException("Request [" + url + "] close instream failed:" + ex.getMessage());
// }
// }
// return result;
// }
public static String postParamWithAuth(String url, Map<String, Object> paramMap, String user, String pwd) throws ApiException {
PrintWriter out = null;
BufferedReader in = null;
String result = "";
try {
URL realUrl = new URL(url);
// 打开和URL之间的连接
URLConnection conn = realUrl.openConnection();
// 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
conn.setRequestProperty("Accept-Charset", "UTF-8");
//设置用户名和密码
if(Strings.isNotBlank(user)){
String auth = user+":"+pwd;
//对其进行加密
byte[] rel = Base64.getEncoder().encode(auth.getBytes());
String res = new String(rel);
//设置认证属性
conn.setRequestProperty("Authorization","Basic " + res);
conn.setRequestProperty("API_KEY",user);
}
// conn.setRequestProperty("Charset", "UTF-8");
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setConnectTimeout(20000);
// 获取URLConnection对象对应的输出流
//out = new PrintWriter(conn.getOutputStream());
out = new PrintWriter(new OutputStreamWriter(conn.getOutputStream(),"utf-8"));
// 设置请求属性
String param = "";
if (paramMap != null && paramMap.size() > 0) {
Iterator<String> ite = paramMap.keySet().iterator();
while (ite.hasNext()) {
String key = ite.next();// key
Object valueObj = paramMap.get(key);
String value = "";
if(valueObj != null){
if(valueObj instanceof Date){
DateUtil.toDateString((Date)valueObj,"yyyyMMdd");
}else{
value = valueObj.toString();
}
}
param += key + "=" + value + "&";
}
param = param.substring(0, param.length() - 1);
}
// 发送请求参数
out.print(param);
// flush输出流的缓冲
out.flush();
// 定义BufferedReader输入流来读取URL的响应
//in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
} catch (Exception e) {
throw new ApiException("Request [" + url + "] failed:" + e.getMessage());
}
// 使用finally块来关闭输出流、输入流
finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
} catch (IOException ex) {
throw new ApiException("Request [" + url + "] close instream failed:" + ex.getMessage());
}
}
return result;
}
//
//
// /**
......@@ -398,103 +488,79 @@ public class HttpHelper {
// }
/**
* POST提交JSON格式的内容
*/
private static String postJson(String url, Map<String, Object> params,
HashMap<String, String> cookies, String protocol,String key,String secret) throws ApiException {
// if (protocol.equalsIgnoreCase("https")) {
// Protocol httpsProtocol = new Protocol("https", new SecureProtocolSocketFactoryImpl(), 443);
// Protocol.registerProtocol("https", httpsProtocol);
// }
HttpClient httpClient = new HttpClient();
PostMethod postMethod = new PostMethod(url);
// 设置请求参数
if (params != null && !params.isEmpty()) {
ObjectMapper mapper = new ObjectMapper();
try {
String requestBody = mapper.writeValueAsString(params);
StringRequestEntity requestEntity = new StringRequestEntity(
requestBody, "text/json", CONTENT_CHARSET);
postMethod.setRequestEntity(requestEntity);
} catch (JsonProcessingException e) {
throw new ApiException("Request [" + url + "] failed:" + e.getMessage());
} catch (UnsupportedEncodingException e) {
throw new ApiException("Request [" + url + "] failed:" + e.getMessage());
}
}
// 设置cookie
if (cookies != null && !cookies.isEmpty()) {
Iterator<Map.Entry<String, String>> iterator = cookies.entrySet().iterator();
StringBuilder buffer = new StringBuilder(128);
while (iterator.hasNext()) {
Map.Entry<String, String> entry = iterator.next();
buffer.append(entry.getKey()).append("=").append(entry.getValue()).append("; ");
}
// 设置cookie策略
postMethod.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
// 设置cookie内容
postMethod.setRequestHeader("Cookie", buffer.toString());
}
// 设置User-Agent
postMethod.setRequestHeader("User-Agent", USER_AGENT);
// 设置建立连接超时时间
httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(CONNECTION_TIMEOUT);
// 设置读数据超时时间
httpClient.getHttpConnectionManager().getParams().setSoTimeout(READ_DATA_TIMEOUT);
// 设置编码
postMethod.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, CONTENT_CHARSET);
// 使用系统提供的默认的恢复策略
postMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler());
try {
try {
int statusCode = httpClient.executeMethod(postMethod);
if (statusCode != HttpStatus.SC_OK) {
throw new ApiException("Request [" + url + "] failed:" + postMethod.getStatusLine());
}
// 读取内容
byte[] responseBody = postMethod.getResponseBody();
return new String(responseBody, CONTENT_CHARSET);
} finally {
// 释放链接
postMethod.releaseConnection();
}
} catch (HttpException e) {
// 发生致命的异常,可能是协议不对或者返回的内容有问题
throw new ApiException("Request [" + url + "] failed:" + e.getMessage());
} catch (IOException e) {
// 发生网络异常
throw new ApiException("Request [" + url + "] failed:" + e.getMessage());
}
}
public static ResponseParam postJson(HikApiRequest request) throws ApiException {
String url=request.getUrl();
String key=request.getKey();
String secret=request.getSecret();
RequestParam param=request.getParam();
if(ObjectUtil.isEmpty(url)){
return null;
}
Map<String, Object> params = new HashMap<>();
HashMap<String, String> cookies = null;
String protocol = "http";
params.put("reqCode", param.getReqCode());
params.put("userCode", param.getUserCode());
params.put("data", param.getData());
String result = postJson(url, params, cookies, protocol,key,secret);
ResponseParam responseInfo = JsonUtil.toObj(result, ResponseParam.class);
if (responseInfo == null) {
log.error("[" + url + "]["+key+"]["+secret+"]发送[" + param.getReqCode() + "][" + param.getUserCode() + "][" + param.getData() + "],返回值:" + result);
responseInfo = new ResponseParam(param.getReqCode(), "-1", "", "");
}else{
log.info("[" + url + "]["+key+"]["+secret+"]发送[" + param.getReqCode() + "][" + param.getUserCode() + "][" + param.getData() + "],返回值:" + result);
}
// /**
// * POST提交JSON格式的内容
// */
// private static String postJson(String url, Map<String, Object> params,
// HashMap<String, String> cookies, String protocol,String key,String secret) throws ApiException {
//// if (protocol.equalsIgnoreCase("https")) {
//// Protocol httpsProtocol = new Protocol("https", new SecureProtocolSocketFactoryImpl(), 443);
//// Protocol.registerProtocol("https", httpsProtocol);
//// }
//
// HttpClient httpClient = new HttpClient();
// PostMethod postMethod = new PostMethod(url);
//
// // 设置请求参数
// if (params != null && !params.isEmpty()) {
// ObjectMapper mapper = new ObjectMapper();
// try {
// String requestBody = mapper.writeValueAsString(params);
// StringRequestEntity requestEntity = new StringRequestEntity(
// requestBody, "text/json", CONTENT_CHARSET);
// postMethod.setRequestEntity(requestEntity);
// } catch (JsonProcessingException e) {
// throw new ApiException("Request [" + url + "] failed:" + e.getMessage());
// } catch (UnsupportedEncodingException e) {
// throw new ApiException("Request [" + url + "] failed:" + e.getMessage());
// }
// }
//
// // 设置cookie
// if (cookies != null && !cookies.isEmpty()) {
// Iterator<Map.Entry<String, String>> iterator = cookies.entrySet().iterator();
// StringBuilder buffer = new StringBuilder(128);
// while (iterator.hasNext()) {
// Map.Entry<String, String> entry = iterator.next();
// buffer.append(entry.getKey()).append("=").append(entry.getValue()).append("; ");
// }
// // 设置cookie策略
// postMethod.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
// // 设置cookie内容
// postMethod.setRequestHeader("Cookie", buffer.toString());
// }
//
// // 设置User-Agent
// postMethod.setRequestHeader("User-Agent", USER_AGENT);
// // 设置建立连接超时时间
// httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(CONNECTION_TIMEOUT);
// // 设置读数据超时时间
// httpClient.getHttpConnectionManager().getParams().setSoTimeout(READ_DATA_TIMEOUT);
// // 设置编码
// postMethod.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, CONTENT_CHARSET);
// // 使用系统提供的默认的恢复策略
// postMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler());
//
// try {
// try {
// int statusCode = httpClient.executeMethod(postMethod);
// if (statusCode != HttpStatus.SC_OK) {
// throw new ApiException("Request [" + url + "] failed:" + postMethod.getStatusLine());
// }
// // 读取内容
// byte[] responseBody = postMethod.getResponseBody();
// return new String(responseBody, CONTENT_CHARSET);
// } finally {
// // 释放链接
// postMethod.releaseConnection();
// }
// } catch (HttpException e) {
// // 发生致命的异常,可能是协议不对或者返回的内容有问题
// throw new ApiException("Request [" + url + "] failed:" + e.getMessage());
// } catch (IOException e) {
// // 发生网络异常
// throw new ApiException("Request [" + url + "] failed:" + e.getMessage());
// }
// }
return responseInfo;
}
}
\ No newline at end of file
server:
port: 8800
hik:
server:
server: http://cloudapi-tst.hikvision1.com.cn/api/
baseCode: baseCode
lgort: lgort
addr_1_transferOrderApi:
......@@ -17,26 +17,26 @@ hik:
addr_11_orderEndApi:
key_1_transferOrderApi:
key_2_transferOrderInApi:
key_3_scheduleTaskApi:
key_4_returnMaterialApi:
key_5_putInApi:
key_6_checkOutApi:
key_7_updateOrderApi:
key_8_riCheckApi:
key_3_scheduleTaskApi: 065009097
key_4_returnMaterialApi: 065009043
key_5_putInApi: 065009094
key_6_checkOutApi: 065009095
key_7_updateOrderApi: 065009096
key_8_riCheckApi: 065009099
key_9_updateRepOrderApi:
key_10_reservedOrderApi:
key_11_orderEndApi:
key_11_orderEndApi: 065009098
secret_1_transferOrderApi:
secret_2_transferOrderInApi:
secret_3_scheduleTaskApi:
secret_4_returnMaterialApi:
secret_5_putInApi:
secret_6_checkOutApi:
secret_7_updateOrderApi:
secret_8_riCheckApi:
secret_3_scheduleTaskApi: eR2RbW9zHVglHfDweBHPzDF2pYR0RpF1dUpHJKrVKLmYCyHErz2NjXvMsWNJoKgz
secret_4_returnMaterialApi: sRs9lFTsRYpTvORhSI32FhjEPhJDb6TzTvIxhPudrmo9jgwwCiKJWi8go1yN8988
secret_5_putInApi: 1ifjm9mFtpXep0aJXOFtNi3R502v1Lzl6VuaKEKVZdQLmlKhzxIjjmtn29WDG7R0
secret_6_checkOutApi: MDulYCOgEasYYJXOk2tLycnpYKS2HQK0vXcIvJNzPt79isaHJkyE24BcCzn3hTg4
secret_7_updateOrderApi: HvbUVz6vQJYIDfmWokk98rxSUHAoDlUWNSsPuVc0hB8JtIOzZLDQYARW9tmeU2Fy
secret_8_riCheckApi: eQPd3y8xDvwXKMetEbwp2LdzJe8tD0Dg48YA1H68SPsGeKSt2Yj3pOrKibguwzwe
secret_9_updateRepOrderApi:
secret_10_reservedOrderApi:
secret_11_orderEndApi:
secret_11_orderEndApi: W0KWumdsD4eMyTm3Qail9HxHTfqdvxAJW30hLKtiTpJeGO7wXwBe7aUO6n0eicf8
# 文件存储路径
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!