2024-02-27 12:53:37 +08:00
|
|
|
|
package com.zhgd.xmgl.util;
|
|
|
|
|
|
|
2024-06-01 18:40:18 +08:00
|
|
|
|
import com.alibaba.fastjson.JSON;
|
2024-03-05 15:16:10 +08:00
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
2024-03-01 15:28:50 +08:00
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
2024-02-27 12:53:37 +08:00
|
|
|
|
import com.hikvision.artemis.sdk.Client;
|
|
|
|
|
|
import com.hikvision.artemis.sdk.Request;
|
|
|
|
|
|
import com.hikvision.artemis.sdk.Response;
|
|
|
|
|
|
import com.hikvision.artemis.sdk.constant.Constants;
|
|
|
|
|
|
import com.hikvision.artemis.sdk.enums.Method;
|
2024-05-21 20:43:59 +08:00
|
|
|
|
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
2024-06-04 20:51:51 +08:00
|
|
|
|
import com.zhgd.jeecg.common.execption.OpenPromptException;
|
2024-06-06 17:21:47 +08:00
|
|
|
|
import com.zhgd.xmgl.base.HikvisionOrganization;
|
2024-06-04 20:51:51 +08:00
|
|
|
|
import com.zhgd.xmgl.base.HikvisionReservationCarInfo;
|
2024-06-07 16:40:55 +08:00
|
|
|
|
import com.zhgd.xmgl.call.HikvisionCall;
|
|
|
|
|
|
import com.zhgd.xmgl.call.entity.ChargeDeletionParam;
|
2024-05-31 18:47:42 +08:00
|
|
|
|
import com.zhgd.xmgl.modules.project.entity.Project;
|
2024-06-07 16:40:55 +08:00
|
|
|
|
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
2024-02-27 12:53:37 +08:00
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
2024-03-01 15:28:50 +08:00
|
|
|
|
import org.springframework.stereotype.Component;
|
2024-02-27 12:53:37 +08:00
|
|
|
|
|
2024-06-06 17:21:47 +08:00
|
|
|
|
import java.util.*;
|
2024-02-27 12:53:37 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 海康接口
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Slf4j
|
2024-03-01 15:28:50 +08:00
|
|
|
|
@Component
|
2024-02-27 12:53:37 +08:00
|
|
|
|
public class HikvisionUtil {
|
2024-03-01 15:28:50 +08:00
|
|
|
|
|
2024-07-01 09:51:07 +08:00
|
|
|
|
public static final String SUC_CODE = "0";
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取JSONObject的请求结果
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param host
|
|
|
|
|
|
* @param path
|
|
|
|
|
|
* @param body
|
|
|
|
|
|
* @param querys
|
|
|
|
|
|
* @param appKey
|
|
|
|
|
|
* @param appSecret
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
2024-05-31 18:47:42 +08:00
|
|
|
|
public static JSONObject doPostRtObj(String host, String path, String body, Map<String, String> querys, String appKey, String appSecret) throws Exception {
|
|
|
|
|
|
return JSONObject.parseObject(doPost(host, path, body, querys, appKey, appSecret));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-07-01 09:51:07 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 发送Post请求
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param host
|
|
|
|
|
|
* @param path
|
|
|
|
|
|
* @param body
|
|
|
|
|
|
* @param querys
|
|
|
|
|
|
* @param appKey
|
|
|
|
|
|
* @param appSecret
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
2024-04-16 21:19:56 +08:00
|
|
|
|
public static String doPost(String host, String path, String body, Map<String, String> querys, String appKey, String appSecret) throws Exception {
|
2024-05-11 01:58:58 +08:00
|
|
|
|
log.info("调用海康接口.url:{}", host + path);
|
|
|
|
|
|
log.info("调用海康接口.body:{}", body);
|
2024-07-01 09:51:07 +08:00
|
|
|
|
Map<String, String> headers = new HashMap<>(16);
|
2024-04-16 21:19:56 +08:00
|
|
|
|
headers.put("Accept", "*/*");
|
|
|
|
|
|
headers.put("Content-Type", "application/json");
|
2024-04-29 21:14:46 +08:00
|
|
|
|
Request request = new Request(Method.POST_STRING, host, path, appKey, appSecret, Constants.DEFAULT_TIMEOUT * 30);
|
2024-04-16 21:19:56 +08:00
|
|
|
|
request.setHeaders(headers);
|
|
|
|
|
|
request.setQuerys(querys);
|
|
|
|
|
|
request.setStringBody(body);
|
|
|
|
|
|
Response response = Client.execute(request);
|
|
|
|
|
|
String responseStr = getResponseResult(response);
|
2024-05-11 01:58:58 +08:00
|
|
|
|
log.info("调用海康接口.getResponseResult:{}", responseStr);
|
2024-02-27 12:53:37 +08:00
|
|
|
|
return responseStr;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-07-01 09:51:07 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 获取响应结果
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param response
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2024-02-27 12:53:37 +08:00
|
|
|
|
private static String getResponseResult(Response response) {
|
|
|
|
|
|
String responseStr = null;
|
|
|
|
|
|
int statusCode = response.getStatusCode();
|
2024-07-01 09:51:07 +08:00
|
|
|
|
String prefix2 = "2";
|
|
|
|
|
|
String prefix3 = "3";
|
|
|
|
|
|
if (!String.valueOf(statusCode).startsWith(prefix2) && !String.valueOf(statusCode).startsWith(prefix3)) {
|
2024-02-27 12:53:37 +08:00
|
|
|
|
responseStr = response.getBody();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
responseStr = response.getBody();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return responseStr;
|
|
|
|
|
|
}
|
2024-03-01 15:28:50 +08:00
|
|
|
|
|
2024-04-02 18:26:22 +08:00
|
|
|
|
/**
|
2024-04-16 21:19:56 +08:00
|
|
|
|
* 成功后,获取data结果
|
2024-04-02 18:26:22 +08:00
|
|
|
|
*
|
|
|
|
|
|
* @param rs
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2024-07-01 09:51:07 +08:00
|
|
|
|
public static JSONObject getJsonObjectData(String rs) {
|
2024-03-01 15:28:50 +08:00
|
|
|
|
JSONObject rsJo = JSONObject.parseObject(rs);
|
2024-04-09 17:00:12 +08:00
|
|
|
|
String code = rsJo.getString("code");
|
2024-07-01 09:51:07 +08:00
|
|
|
|
if (Objects.equals(code, SUC_CODE)) {
|
2024-03-01 15:28:50 +08:00
|
|
|
|
return rsJo.getJSONObject("data");
|
|
|
|
|
|
} else {
|
2024-05-31 11:45:33 +08:00
|
|
|
|
log.error("海康返回错误码:{}", rs);
|
|
|
|
|
|
throw new OpenAlertException("海康返回错误码");
|
2024-03-01 15:28:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-03-05 15:16:10 +08:00
|
|
|
|
|
2024-04-16 21:19:56 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 成功后,获取data结果
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param rsJo
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2024-07-01 09:51:07 +08:00
|
|
|
|
public static JSONObject getJsonObjectData(JSONObject rsJo) {
|
2024-04-16 21:19:56 +08:00
|
|
|
|
String code = rsJo.getString("code");
|
2024-07-01 09:51:07 +08:00
|
|
|
|
if (Objects.equals(code, SUC_CODE)) {
|
2024-04-16 21:19:56 +08:00
|
|
|
|
return rsJo.getJSONObject("data");
|
|
|
|
|
|
} else {
|
2024-05-31 11:45:33 +08:00
|
|
|
|
log.error("海康返回错误码:{}", rsJo.toJSONString());
|
2024-06-12 21:55:13 +08:00
|
|
|
|
throw new OpenAlertException("下发异常:海康返回错误码");
|
2024-04-16 21:19:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-07-01 09:51:07 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 获取响应结果
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param rs
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONArray getJsonArrayData(String rs) {
|
2024-03-05 15:16:10 +08:00
|
|
|
|
JSONObject rsJo = JSONArray.parseObject(rs);
|
2024-04-09 17:00:12 +08:00
|
|
|
|
String code = rsJo.getString("code");
|
2024-07-01 09:51:07 +08:00
|
|
|
|
if (Objects.equals(code, SUC_CODE)) {
|
2024-03-05 15:16:10 +08:00
|
|
|
|
return rsJo.getJSONArray("data");
|
|
|
|
|
|
} else {
|
2024-05-31 11:45:33 +08:00
|
|
|
|
log.error("海康返回错误码:{}", rs);
|
2024-05-31 19:28:48 +08:00
|
|
|
|
throw new OpenAlertException("海康返回错误码");
|
2024-03-05 15:16:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-09 17:00:12 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 是否请求成功
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param rs
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static boolean isSuccess(String rs) {
|
|
|
|
|
|
JSONObject rsJo = JSONObject.parseObject(rs);
|
|
|
|
|
|
String code = rsJo.getString("code");
|
2024-07-01 09:51:07 +08:00
|
|
|
|
if (Objects.equals(code, SUC_CODE)) {
|
2024-04-09 17:00:12 +08:00
|
|
|
|
return true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-16 21:19:56 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 是否请求成功
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param rsJo
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static boolean isSuccess(JSONObject rsJo) {
|
|
|
|
|
|
String code = rsJo.getString("code");
|
2024-07-01 09:51:07 +08:00
|
|
|
|
if (Objects.equals(code, SUC_CODE)) {
|
2024-04-16 21:19:56 +08:00
|
|
|
|
return true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 是否请求成功
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param rsJo
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static boolean isFail(JSONObject rsJo) {
|
|
|
|
|
|
String code = rsJo.getString("code");
|
2024-07-01 09:51:07 +08:00
|
|
|
|
if (Objects.equals(code, SUC_CODE)) {
|
2024-04-16 21:19:56 +08:00
|
|
|
|
return false;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-07-01 09:51:07 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 添加初始化分页
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param param
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2024-06-12 21:55:13 +08:00
|
|
|
|
public static JSONObject addPageParamIfAbsent(JSONObject param) {
|
2024-05-30 19:52:54 +08:00
|
|
|
|
param.putIfAbsent("pageNo", 1);
|
|
|
|
|
|
param.putIfAbsent("pageSize", 1000);
|
2024-06-12 21:55:13 +08:00
|
|
|
|
return param;
|
2024-05-30 19:52:54 +08:00
|
|
|
|
}
|
2024-05-31 18:47:42 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
2024-06-01 21:41:34 +08:00
|
|
|
|
* 查询车辆列表v2-固定车辆
|
2024-05-31 18:47:42 +08:00
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2024-06-01 21:41:34 +08:00
|
|
|
|
public static JSONObject getFixCarList(Project project, JSONObject param) throws Exception {
|
2024-05-31 18:47:42 +08:00
|
|
|
|
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v2/vehicle/advance/vehicleList";
|
2024-05-31 18:47:42 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
return doPostRtObj(host, path, param.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
|
|
|
|
|
}
|
2024-05-31 19:28:48 +08:00
|
|
|
|
|
2024-06-04 20:51:51 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 查询车辆列表v2-固定车辆
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param carNumber
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @param pageNo
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONObject getFixCarListByCarNumber(String carNumber, Project project, Integer pageNo) throws Exception {
|
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
|
|
|
//模糊查询
|
|
|
|
|
|
jo.put("plateNo", carNumber);
|
|
|
|
|
|
jo.put("pageNo", pageNo);
|
|
|
|
|
|
jo.put("pageSize", 1000);
|
2024-06-26 15:49:13 +08:00
|
|
|
|
return getFixCarList(project, jo);
|
2024-06-04 20:51:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-05-31 19:28:48 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 查询车辆分类
|
|
|
|
|
|
*/
|
2024-06-04 20:51:51 +08:00
|
|
|
|
public static JSONArray getCategoryList(Project project) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/pms/v1/car/category/search";
|
2024-05-31 19:28:48 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
|
|
|
String rs = doPost(host, path, jo.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
2024-07-01 09:51:07 +08:00
|
|
|
|
return getJsonArrayData(rs);
|
2024-05-31 19:28:48 +08:00
|
|
|
|
}
|
2024-05-31 21:57:30 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 车辆群组绑定
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @param param
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONObject bindCarCategory(Project project, JSONObject param) throws Exception {
|
|
|
|
|
|
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/pms/v1/car/categoryBind";
|
2024-05-31 21:57:30 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
return doPostRtObj(host, path, param.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
|
|
|
|
|
}
|
2024-06-01 18:40:18 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 删除人脸
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @param workerFaceId
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONObject deleteWorkerFace(Project project, String workerFaceId) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v1/face/single/delete";
|
2024-06-01 18:40:18 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
|
|
|
jo.put("faceId", workerFaceId);
|
|
|
|
|
|
return JSON.parseObject(doPost(host, path, jo.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret()));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 删除人员
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param uniqueId
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONObject deleteWorkerById(String uniqueId, Project project) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v1/person/batch/delete";
|
2024-06-01 18:40:18 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
JSONObject jsonBody = new JSONObject();
|
|
|
|
|
|
jsonBody.put("personIds", Arrays.asList(uniqueId));
|
|
|
|
|
|
String body = jsonBody.toJSONString();
|
|
|
|
|
|
return doPostRtObj(host, path, body, null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 根据人员唯一字段获取人员详细信息
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONObject queryWorkerByCondition(Project project, JSONObject param) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v1/person/condition/personInfo";
|
2024-06-01 18:40:18 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
return doPostRtObj(host, path, param.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-04 20:51:51 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 获取停车库列表
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONArray getParkList(Project project) throws Exception {
|
|
|
|
|
|
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v1/park/parkList";
|
2024-06-04 20:51:51 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
|
|
|
String rs = doPost(host, path, jo.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
2024-07-01 09:51:07 +08:00
|
|
|
|
return getJsonArrayData(rs);
|
2024-06-04 20:51:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取项目名称的停车场的parkIndexCode,没有一样名字的就取第一个停车场
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static String getProjectParkCode(Project project) throws Exception {
|
|
|
|
|
|
JSONArray parkList = getParkList(project);
|
|
|
|
|
|
if (parkList != null && parkList.size() > 0) {
|
|
|
|
|
|
for (int i = 0; i < parkList.size(); i++) {
|
|
|
|
|
|
JSONObject jo = parkList.getJSONObject(i);
|
|
|
|
|
|
if (Objects.equals(jo.getString("parkName"), project.getProjectName())) {
|
|
|
|
|
|
return jo.getString("parkIndexCode");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-06-11 14:47:06 +08:00
|
|
|
|
throw new OpenPromptException("未查询到对应项目的停车场信息");
|
2024-06-04 20:51:51 +08:00
|
|
|
|
} else {
|
2024-06-11 14:47:06 +08:00
|
|
|
|
throw new OpenPromptException("停车场为空");
|
2024-06-04 20:51:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-06-01 18:40:18 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
2024-06-04 20:51:51 +08:00
|
|
|
|
* 查询预约记录v2
|
2024-06-01 18:40:18 +08:00
|
|
|
|
*
|
|
|
|
|
|
* @param carNumber
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
*/
|
2024-06-04 20:51:51 +08:00
|
|
|
|
public static JSONObject getReservationCarInfoList(String carNumber, Project project) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/pms/v2/reserveRecord/page";
|
2024-06-01 18:40:18 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
2024-06-04 20:51:51 +08:00
|
|
|
|
HikvisionReservationCarInfo info = getHikvisionReservationCarInfoObj(carNumber, project);
|
|
|
|
|
|
return doPostRtObj(host, path, JSON.toJSONString(info), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询预约记录v2
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param carNumber
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONArray getReservationCarInfoDataList(String carNumber, Project project) throws Exception {
|
|
|
|
|
|
JSONObject jo = getReservationCarInfoList(carNumber, project);
|
2024-07-01 09:51:07 +08:00
|
|
|
|
return getJsonObjectData(jo).getJSONArray("list");
|
2024-06-04 20:51:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-07-01 09:51:07 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 映射车辆预约信息
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param carNumber
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
2024-06-04 20:51:51 +08:00
|
|
|
|
private static HikvisionReservationCarInfo getHikvisionReservationCarInfoObj(String carNumber, Project project) throws Exception {
|
|
|
|
|
|
String projectParkCode = HikvisionUtil.getProjectParkCode(project);
|
|
|
|
|
|
HikvisionReservationCarInfo hikvisionReservationCarInfo = new HikvisionReservationCarInfo();
|
|
|
|
|
|
hikvisionReservationCarInfo.setParkSyscode(projectParkCode);
|
|
|
|
|
|
hikvisionReservationCarInfo.setPlateNo(carNumber);
|
|
|
|
|
|
hikvisionReservationCarInfo.setResvState(0L);
|
|
|
|
|
|
//hikvisionReservationCarInfo.setResvWay();
|
|
|
|
|
|
//hikvisionReservationCarInfo.setAllowTimes();
|
|
|
|
|
|
//hikvisionReservationCarInfo.setIsCharge();
|
|
|
|
|
|
//hikvisionReservationCarInfo.setStartTime();
|
|
|
|
|
|
//hikvisionReservationCarInfo.setEndTime();
|
|
|
|
|
|
hikvisionReservationCarInfo.setPageNo(1L);
|
|
|
|
|
|
hikvisionReservationCarInfo.setPageSize(999L);
|
|
|
|
|
|
return hikvisionReservationCarInfo;
|
2024-06-01 18:40:18 +08:00
|
|
|
|
}
|
2024-06-04 21:23:01 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取组织列表v2
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
2024-06-27 10:07:05 +08:00
|
|
|
|
* @param jo
|
2024-06-04 21:23:01 +08:00
|
|
|
|
*/
|
2024-06-27 10:07:05 +08:00
|
|
|
|
public static String getOrgV2(Project project, JSONObject jo) throws Exception {
|
2024-06-04 21:23:01 +08:00
|
|
|
|
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v2/org/advance/orgList";
|
2024-06-04 21:23:01 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
2024-06-27 10:07:05 +08:00
|
|
|
|
return doPost(host, path, jo.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
2024-06-04 21:23:01 +08:00
|
|
|
|
}
|
2024-06-06 17:21:47 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 批量添加组织
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @param hikvisionOrganization
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
2024-06-07 16:51:37 +08:00
|
|
|
|
public static String addOrg(Project project, HikvisionOrganization hikvisionOrganization) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v1/org/batch/add";
|
2024-06-06 17:21:47 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
ArrayList<HikvisionOrganization> list = new ArrayList<>();
|
|
|
|
|
|
list.add(hikvisionOrganization);
|
|
|
|
|
|
return doPost(host, path, JSON.toJSONString(list), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-07-01 09:51:07 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 批量删除组织
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @param indexCodes
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
2024-06-06 17:21:47 +08:00
|
|
|
|
public static String deleteOrgByIndexCodes(Project project, List<String> indexCodes) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v1/org/batch/delete";
|
2024-06-06 17:21:47 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
|
|
|
jo.put("indexCodes", indexCodes);
|
2024-06-16 18:05:15 +08:00
|
|
|
|
return doPost(host, path, jo.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
2024-06-06 17:21:47 +08:00
|
|
|
|
}
|
2024-06-06 21:13:17 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询黑名单(布防)车辆
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONObject getBlackCarList(Project project, JSONObject param) throws Exception {
|
|
|
|
|
|
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/pms/v1/alarmCar/page";
|
2024-06-06 21:13:17 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
return JSON.parseObject(doPost(host, path, JSON.toJSONString(param), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret()));
|
|
|
|
|
|
}
|
2024-06-07 16:40:55 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取组织下人员列表v2
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONObject getWorkerListByOrg(Project project, JSONObject param) throws Exception {
|
|
|
|
|
|
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v2/person/orgIndexCode/personList";
|
2024-06-07 16:40:55 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
return JSON.parseObject(doPost(host, path, JSON.toJSONString(param), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret()));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 根据组织编号获取组织详细信息
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONObject getOrgListByIndex(Project project, JSONObject param) throws Exception {
|
|
|
|
|
|
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v1/org/orgIndexCodes/orgInfo";
|
2024-06-07 16:40:55 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
return JSON.parseObject(doPost(host, path, JSON.toJSONString(param), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret()));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 根据父组织编号获取下级组织列表
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONObject getSubOrgListByParentOrg(Project project, JSONObject param) throws Exception {
|
|
|
|
|
|
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v1/org/parentOrgIndexCode/subOrgList";
|
2024-06-07 16:40:55 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
return JSON.parseObject(doPost(host, path, JSON.toJSONString(param), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret()));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 取消车辆包期,调用预约车之前需要调用
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONObject chargeDeletion(Project project, ChargeDeletionParam param) throws Exception {
|
|
|
|
|
|
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/pms/v1/car/charge/deletion";
|
2024-06-07 16:40:55 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
return JSON.parseObject(doPost(host, path, JSON.toJSONString(param), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret()));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 简单同步权限下载_根据人员与设备通道指定下载
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2024-06-11 16:18:30 +08:00
|
|
|
|
public static JSONObject downloadSimple(Project project, String param) throws Exception {
|
2024-06-07 16:40:55 +08:00
|
|
|
|
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/acps/v1/authDownload/task/simpleDownload";
|
2024-06-07 16:40:55 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
return JSON.parseObject(doPost(host, path, param, null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret()));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-07-01 09:51:07 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 添加人员
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param workerInfo
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
2024-06-07 16:51:37 +08:00
|
|
|
|
public static String addWorker(WorkerInfo workerInfo, Project project) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v2/person/single/add";
|
2024-06-07 16:40:55 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
String body = HikvisionCall.getWorkerJson(workerInfo);
|
|
|
|
|
|
String rs = doPost(host, path, body, null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
|
|
|
|
|
return rs;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-07-01 09:51:07 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 编剧人员
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param workerInfo
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
2024-06-07 16:51:37 +08:00
|
|
|
|
public static String editWorker(WorkerInfo workerInfo, Project project) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v1/person/single/update";
|
2024-06-07 16:40:55 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
String body = HikvisionCall.getWorkerJson(workerInfo);
|
|
|
|
|
|
return doPost(host, path, body, null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-07-01 09:51:07 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 添加人脸
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param workerInfo
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
2024-06-07 16:51:37 +08:00
|
|
|
|
public static String addWorkerFace(WorkerInfo workerInfo, Project project) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v1/face/single/add";
|
2024-06-07 16:40:55 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
|
|
|
jo.put("personId", String.valueOf(workerInfo.getId()));
|
|
|
|
|
|
jo.put("faceData", Base64Util.convertFileToBase64(PathUtil.reviseSlash(PathUtil.getBasePath() + "/" + workerInfo.getFieldAcquisitionUrl())));
|
|
|
|
|
|
return doPost(host, path, jo.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 车辆布防
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2024-06-07 16:51:37 +08:00
|
|
|
|
public static JSONObject addAlarmCar(Project project, JSONObject param) throws Exception {
|
2024-06-07 16:40:55 +08:00
|
|
|
|
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/pms/v1/alarmCar/addition";
|
2024-06-07 16:40:55 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
return JSON.parseObject(doPost(host, path, JSON.toJSONString(param), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret()));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 取消车辆布防
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2024-06-07 16:51:37 +08:00
|
|
|
|
public static JSONObject deletionAlarmCar(Project project, JSONObject param) throws Exception {
|
2024-06-07 16:40:55 +08:00
|
|
|
|
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/pms/v1/alarmCar/deletion";
|
2024-06-07 16:40:55 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
return JSON.parseObject(doPost(host, path, JSON.toJSONString(param), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret()));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-07-01 09:51:07 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 删除车辆
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param carId
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
2024-06-07 16:51:37 +08:00
|
|
|
|
public static String deleteCarInfoById(String carId, Project project) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v1/vehicle/batch/delete";
|
2024-06-07 16:40:55 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
|
|
|
ArrayList<String> list = new ArrayList<>();
|
|
|
|
|
|
list.add(carId);
|
|
|
|
|
|
jo.put("vehicleIds", list);
|
|
|
|
|
|
String rs = doPost(host, path, jo.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
|
|
|
|
|
return rs;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询门禁点事件v2
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @param param
|
|
|
|
|
|
*/
|
2024-06-07 16:51:37 +08:00
|
|
|
|
public static String getDoorEvents(Project project, JSONObject param) throws Exception {
|
2024-06-07 16:40:55 +08:00
|
|
|
|
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/acs/v2/door/events";
|
2024-06-07 16:40:55 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
return doPost(host, path, param.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询过车记录
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @param param
|
|
|
|
|
|
*/
|
2024-06-07 16:51:37 +08:00
|
|
|
|
public static String getCrossRecords(Project project, JSONObject param) throws Exception {
|
2024-06-07 16:40:55 +08:00
|
|
|
|
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/pms/v1/crossRecords/page";
|
2024-06-07 16:40:55 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
|
|
|
jo.put("pageNo", param.getIntValue("pageNo"));
|
|
|
|
|
|
jo.put("pageSize", 1000);
|
|
|
|
|
|
//ISO8601时间格式
|
|
|
|
|
|
jo.put("startTime", param.getString("startTime"));
|
|
|
|
|
|
jo.put("endTime", param.getString("endTime"));
|
|
|
|
|
|
jo.put("parkSyscode", param.getString("parkSyscode"));
|
|
|
|
|
|
return doPost(host, path, jo.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询门禁点列表v2
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @param param
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2024-06-12 21:55:13 +08:00
|
|
|
|
public static JSONObject getDoorsV2(Project project, JSONObject param) throws Exception {
|
2024-06-07 16:40:55 +08:00
|
|
|
|
if (project == null || !Objects.equals(project.getSyncHikvision(), 1)) {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v2/door/search";
|
2024-06-07 16:40:55 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
return JSON.parseObject(doPost(host, path, param.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret()));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-07-01 09:51:07 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 编辑组织
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @param hikvisionOrganization
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
2024-06-07 16:40:55 +08:00
|
|
|
|
public static String editOrg(Project project, HikvisionOrganization hikvisionOrganization) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v1/org/single/update";
|
2024-06-07 16:40:55 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
String rs = doPost(host, path, JSONArray.toJSONString(hikvisionOrganization), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
|
|
|
|
|
return rs;
|
|
|
|
|
|
}
|
2024-06-11 16:18:30 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
2024-06-12 21:55:13 +08:00
|
|
|
|
* 添加权限配置
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @param param
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONObject addAuth(Project project, JSONObject param) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/acps/v1/auth_config/add";
|
2024-06-12 21:55:13 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
return doPostRtObj(host, path, JSONArray.toJSONString(param), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 删除权限配置
|
2024-06-11 16:18:30 +08:00
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @param param
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
2024-06-12 21:55:13 +08:00
|
|
|
|
public static JSONObject deleteAuth(Project project, JSONObject param) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/acps/v1/auth_config/delete";
|
2024-06-11 16:18:30 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
return doPostRtObj(host, path, JSONArray.toJSONString(param), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
|
|
|
|
|
}
|
2024-06-12 21:55:13 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 根据出入权限配置快捷下载
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @param param
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONObject downloadAuth(Project project, JSONObject param) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/acps/v1/authDownload/configuration/shortcut";
|
2024-06-12 21:55:13 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
return doPostRtObj(host, path, JSONArray.toJSONString(param), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询下载任务进度
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @param param
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONObject queryDownloadProgress(Project project, JSONObject param) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/acps/v1/authDownload/task/progress";
|
2024-06-12 21:55:13 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
return doPostRtObj(host, path, JSONArray.toJSONString(param), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询权限条目列表
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @param param
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONObject queryAuthItem(Project project, JSONObject param) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/acps/v1/auth_item/list/search";
|
2024-06-12 21:55:13 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
return doPostRtObj(host, path, JSONArray.toJSONString(param), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-15 18:07:47 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 查询人员列表v2
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @param param
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws Exception
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONObject queryPersonList(Project project, JSONObject param) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v2/person/advance/personList";
|
2024-06-15 18:07:47 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
return doPostRtObj(host, path, JSONArray.toJSONString(param), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取单个劳务人员信息,根据人员id
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param uniqueId
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONObject getWorkerInfoByPersonId(String uniqueId, Project project) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v1/person/condition/personInfo";
|
2024-06-15 18:07:47 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
|
|
|
jo.put("paramName", "personId");
|
|
|
|
|
|
jo.put("paramValue", Collections.singletonList(uniqueId));
|
|
|
|
|
|
String rs = doPost(host, path, jo.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
2024-07-01 09:51:07 +08:00
|
|
|
|
JSONObject joData = getJsonObjectData(rs);
|
2024-06-15 18:07:47 +08:00
|
|
|
|
Integer total = joData.getInteger("total");
|
|
|
|
|
|
if (Objects.equals(total, 1)) {
|
|
|
|
|
|
JSONArray jsonArray = joData.getJSONArray("list");
|
|
|
|
|
|
for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
|
|
|
return jsonArray.getJSONObject(i);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取单个劳务人员信息,根据人员身份证
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param workerInfo
|
|
|
|
|
|
* @param project
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static JSONObject getWorkerInfoByCertificateNo(WorkerInfo workerInfo, Project project) throws Exception {
|
2024-07-01 09:51:07 +08:00
|
|
|
|
final String artemisPath = "/artemis";
|
|
|
|
|
|
final String path = artemisPath + "/api/resource/v1/person/condition/personInfo";
|
2024-06-15 18:07:47 +08:00
|
|
|
|
String host = "https://" + project.getArtemisConfigHost();
|
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
|
|
|
jo.put("paramName", "certificateNo");
|
|
|
|
|
|
jo.put("paramValue", Collections.singletonList(String.valueOf(workerInfo.getIdCard())));
|
|
|
|
|
|
String rs = doPost(host, path, jo.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
2024-07-01 09:51:07 +08:00
|
|
|
|
JSONObject joData = getJsonObjectData(rs);
|
2024-06-15 18:07:47 +08:00
|
|
|
|
Integer total = joData.getInteger("total");
|
|
|
|
|
|
if (Objects.equals(total, 1)) {
|
|
|
|
|
|
JSONArray jsonArray = joData.getJSONArray("list");
|
|
|
|
|
|
for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
|
|
|
return jsonArray.getJSONObject(i);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-02-27 12:53:37 +08:00
|
|
|
|
}
|