调整
This commit is contained in:
parent
1d8e375ae7
commit
84240347c7
@ -1426,6 +1426,8 @@ public class HikvisionCall {
|
||||
if (carInfo.getIsBlack() == 0) {
|
||||
handleAlarmCar(project, carInfo);
|
||||
}
|
||||
//根据车牌号删除车辆
|
||||
JSONObject oldCarInfo = searchCarInfoByCarNumberFromHttp(carInfo.getCarNumber(), project);
|
||||
|
||||
cancelCharge(project, carInfo);
|
||||
if (Objects.equals(carInfo.getCarModuleType(), 1)) {
|
||||
@ -1566,6 +1568,12 @@ public class HikvisionCall {
|
||||
}
|
||||
}
|
||||
|
||||
private String getRemoteCarIdByCarNumber(String carNumber, Project project) throws Exception {
|
||||
JSONObject oldCarInfo = searchCarInfoByCarNumberFromHttp(carNumber, project);
|
||||
|
||||
return oldCarInfo.getString("vehicleId");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存绑定群组关系
|
||||
@ -1576,19 +1584,14 @@ public class HikvisionCall {
|
||||
*/
|
||||
private void saveBindCategory(CarInfo carInfo, Project project) throws Exception {
|
||||
String categoryCode = getCategoryCode(project, carInfo);
|
||||
saveCarCategoryBind(project, categoryCode, String.valueOf(carInfo.getId()), carInfo);
|
||||
saveCarCategoryBind(project, categoryCode, carInfo.getHikvisionVehicleId(), carInfo);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String getCategoryCode(Project project, CarInfo carInfo) throws Exception {
|
||||
//绑定固定的群组
|
||||
JSONArray ja = categorySearch(project);
|
||||
String categoryCode = getFixedCarGroupName(ja);
|
||||
if (StringUtils.isBlank(categoryCode)) {
|
||||
log.error("获取固定车的群组失败:车牌号:{}", carInfo.getCarNumber());
|
||||
throw new OpenPromptException("获取固定车的群组失败");
|
||||
}
|
||||
return categoryCode;
|
||||
JSONArray ja = HikvisionUtil.categorySearch(project);
|
||||
return getFixedCarGroupName(ja);
|
||||
}
|
||||
|
||||
public void addCarInfoFromHttp(CarInfo carInfo, Project project) throws Exception {
|
||||
@ -1763,7 +1766,7 @@ public class HikvisionCall {
|
||||
*/
|
||||
private void bindCarOrNot(Project project, int operation, CarInfo carInfo) throws Exception {
|
||||
String categoryCode = getCategoryCode(project, carInfo);
|
||||
carCategoryBindOrNotFromHttp(project, operation, categoryCode, String.valueOf(carInfo.getId()), carInfo);
|
||||
carCategoryBindOrNotFromHttp(project, operation, categoryCode, carInfo.getHikvisionVehicleId(), carInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1781,7 +1784,8 @@ public class HikvisionCall {
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
log.error("获取固定车的群组失败");
|
||||
throw new OpenPromptException("获取固定车的群组失败");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2346,18 +2350,6 @@ public class HikvisionCall {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询车辆分类
|
||||
*/
|
||||
public JSONArray categorySearch(Project project) throws Exception {
|
||||
final String ARTEMIS_PATH = "/artemis";
|
||||
final String path = ARTEMIS_PATH + "/api/pms/v1/car/category/search";
|
||||
String host = "https://" + project.getArtemisConfigHost();
|
||||
JSONObject jo = new JSONObject();
|
||||
String rs = HikvisionUtil.doPost(host, path, jo.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
||||
return HikvisionUtil.getJSONArrayData(rs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 人脸评分
|
||||
*/
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.zhgd.xmgl.util;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hikvision.artemis.sdk.Client;
|
||||
@ -90,16 +89,13 @@ public class HikvisionUtil {
|
||||
}
|
||||
|
||||
public static JSONArray getJSONArrayData(String rs) {
|
||||
if (StrUtil.isBlank(rs)) {
|
||||
return null;
|
||||
}
|
||||
JSONObject rsJo = JSONArray.parseObject(rs);
|
||||
String code = rsJo.getString("code");
|
||||
if (Objects.equals(code, "0")) {
|
||||
return rsJo.getJSONArray("data");
|
||||
} else {
|
||||
log.error("海康返回错误码:{}", rs);
|
||||
return null;
|
||||
throw new OpenAlertException("海康返回错误码");
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,4 +166,16 @@ public class HikvisionUtil {
|
||||
String host = "https://" + project.getArtemisConfigHost();
|
||||
return doPostRtObj(host, path, param.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询车辆分类
|
||||
*/
|
||||
public static JSONArray categorySearch(Project project) throws Exception {
|
||||
final String ARTEMIS_PATH = "/artemis";
|
||||
final String path = ARTEMIS_PATH + "/api/pms/v1/car/category/search";
|
||||
String host = "https://" + project.getArtemisConfigHost();
|
||||
JSONObject jo = new JSONObject();
|
||||
String rs = doPost(host, path, jo.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
||||
return getJSONArrayData(rs);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user