|
@ -3,9 +3,12 @@ package com.oldwei.hikdev.service.impl; |
|
|
import cn.hutool.core.codec.Base64; |
|
|
import cn.hutool.core.codec.Base64; |
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
|
import cn.hutool.http.HttpStatus; |
|
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
|
import com.aliyuncs.utils.StringUtils; |
|
|
import com.oldwei.hikdev.component.DataCache; |
|
|
import com.oldwei.hikdev.component.DataCache; |
|
|
import com.oldwei.hikdev.constant.DataCachePrefixConstant; |
|
|
import com.oldwei.hikdev.constant.DataCachePrefixConstant; |
|
|
import com.oldwei.hikdev.constant.HikConstant; |
|
|
import com.oldwei.hikdev.constant.HikConstant; |
|
@ -286,7 +289,13 @@ public class HikAccessControlServiceImpl implements IHikAccessControlService { |
|
|
//读取返回的json并解析
|
|
|
//读取返回的json并解析
|
|
|
ptrOutBuff.read(); |
|
|
ptrOutBuff.read(); |
|
|
String strResult = new String(ptrOutBuff.byValue).trim(); |
|
|
String strResult = new String(ptrOutBuff.byValue).trim(); |
|
|
JSONObject jsonResult = JSONObject.parseObject(strResult); |
|
|
JSONObject jsonResult; |
|
|
|
|
|
log.info(strResult); |
|
|
|
|
|
if(StringUtils.isEmpty(strResult)){ |
|
|
|
|
|
jsonResult = new JSONObject(); |
|
|
|
|
|
}else{ |
|
|
|
|
|
jsonResult = JSONObject.parseObject(strResult); |
|
|
|
|
|
} |
|
|
result.put("data", jsonResult); |
|
|
result.put("data", jsonResult); |
|
|
if (dwState != HikConstant.NET_SDK_CONFIG_STATUS_SUCCESS) { |
|
|
if (dwState != HikConstant.NET_SDK_CONFIG_STATUS_SUCCESS) { |
|
|
//返回NET_SDK_CONFIG_STATUS_SUCCESS代表流程走通了,但并不代表下发成功,比如有些设备可能因为人员已存在等原因下发失败,所以需要解析Json报文 如果statusCode=1无异常情况,否则就是有异常情况
|
|
|
//返回NET_SDK_CONFIG_STATUS_SUCCESS代表流程走通了,但并不代表下发成功,比如有些设备可能因为人员已存在等原因下发失败,所以需要解析Json报文 如果statusCode=1无异常情况,否则就是有异常情况
|
|
@ -1009,7 +1018,18 @@ public class HikAccessControlServiceImpl implements IHikAccessControlService { |
|
|
HikDevResponse result = new HikDevResponse(); |
|
|
HikDevResponse result = new HikDevResponse(); |
|
|
|
|
|
|
|
|
Boolean stdBoolean = this.hikDevService.NET_DVR_STDXMLConfig(longUserId, strXMLInput, strXMLOutput); |
|
|
Boolean stdBoolean = this.hikDevService.NET_DVR_STDXMLConfig(longUserId, strXMLInput, strXMLOutput); |
|
|
getDeleteProcess(deviceSn); |
|
|
|
|
|
|
|
|
while(true) { |
|
|
|
|
|
HikDevResponse process = getDeleteProcess(deviceSn); |
|
|
|
|
|
log.info(JSONUtil.toJsonStr(process)); |
|
|
|
|
|
if(process.get("code").equals(HttpStatus.HTTP_INTERNAL_ERROR)){ |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(process.get("msg").equals("success")){ |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
if (!stdBoolean) { |
|
|
if (!stdBoolean) { |
|
|
int iErr = this.hikDevService.NET_DVR_GetLastError(); |
|
|
int iErr = this.hikDevService.NET_DVR_GetLastError(); |
|
|
log.info("NET_DVR_STDXMLConfig失败,错误号:" + iErr); |
|
|
log.info("NET_DVR_STDXMLConfig失败,错误号:" + iErr); |
|
@ -1072,6 +1092,12 @@ public class HikAccessControlServiceImpl implements IHikAccessControlService { |
|
|
String strResult = new String(ptrOutBuff.byValue).trim(); |
|
|
String strResult = new String(ptrOutBuff.byValue).trim(); |
|
|
JSONObject jsonResult = JSONObject.parseObject(strResult); |
|
|
JSONObject jsonResult = JSONObject.parseObject(strResult); |
|
|
log.info(jsonResult.toJSONString()); |
|
|
log.info(jsonResult.toJSONString()); |
|
|
|
|
|
if(jsonResult.getJSONObject("UserInfoDetailDeleteProcess").getString("status").equals("success")){ |
|
|
|
|
|
result.ok("success"); |
|
|
|
|
|
}else{ |
|
|
|
|
|
result.ok("process"); |
|
|
|
|
|
} |
|
|
|
|
|
// {"UserInfoDetailDeleteProcess":{"status":"success"}}
|
|
|
//姓名
|
|
|
//姓名
|
|
|
// String strName = StringEncodingUtil.guessEncodingTransformString(struCardRecord.byName);
|
|
|
// String strName = StringEncodingUtil.guessEncodingTransformString(struCardRecord.byName);
|
|
|
// //卡号
|
|
|
// //卡号
|
|
|