绑定车辆群组修改
This commit is contained in:
parent
1f4cdade53
commit
54091015f8
@ -919,8 +919,8 @@ public class HikvisionCall {
|
|||||||
// 新增
|
// 新增
|
||||||
JSONObject wiJo = HikvisionUtil.getWorkerInfoByCertificateNo(workerInfo, project);
|
JSONObject wiJo = HikvisionUtil.getWorkerInfoByCertificateNo(workerInfo, project);
|
||||||
if (wiJo != null) {
|
if (wiJo != null) {
|
||||||
Long iscPersonId = wiJo.getLong("personId");
|
String iscPersonId = wiJo.getString("personId");
|
||||||
if (Objects.equals(iscPersonId, workerInfo.getId())) {
|
if (Objects.equals(iscPersonId, workerInfo.getId() + "")) {
|
||||||
if (isSaveWorker) {
|
if (isSaveWorker) {
|
||||||
editWorkerFromHttp(workerInfo, project);
|
editWorkerFromHttp(workerInfo, project);
|
||||||
}
|
}
|
||||||
@ -2123,24 +2123,64 @@ public class HikvisionCall {
|
|||||||
* @param carInfo
|
* @param carInfo
|
||||||
*/
|
*/
|
||||||
public void bindOrNotCarCategory(Project project, Integer operation, String categoryCode, CarInfo carInfo) throws Exception {
|
public void bindOrNotCarCategory(Project project, Integer operation, String categoryCode, CarInfo carInfo) throws Exception {
|
||||||
String carId = this.getRemoteCarIdByCarNumber(carInfo.getCarNumber(), project);
|
|
||||||
JSONObject param = new JSONObject();
|
|
||||||
Object vehicleIds = carId == null ? carInfo.getId() : carId;
|
|
||||||
if (vehicleIds == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
param.put("vehicleIds", vehicleIds);
|
|
||||||
param.put("operation", operation);
|
|
||||||
param.put("categoryCode", categoryCode);
|
|
||||||
JSONObject jo = HikvisionUtil.bindCarCategory(project, param);
|
|
||||||
String rs = jo.toJSONString();
|
|
||||||
if (Objects.equals(operation, 1)) {
|
if (Objects.equals(operation, 1)) {
|
||||||
|
//绑定
|
||||||
|
Set<String> ids = getHkCarIds(project, carInfo);
|
||||||
|
JSONObject bindParam = new JSONObject();
|
||||||
|
bindParam.put("vehicleIds", StrUtil.join(",", ids));
|
||||||
|
bindParam.put("operation", 1);
|
||||||
|
bindParam.put("categoryCode", categoryCode);
|
||||||
|
JSONObject jo = HikvisionUtil.bindCarCategory(project, bindParam);
|
||||||
|
String rs = jo.toJSONString();
|
||||||
sendNoticeAndSetStatusForCarInfo("绑定" + FIXED_CAR_GROUP_NAME + "到海康isc", rs, carInfo, 5, 1, null, true);
|
sendNoticeAndSetStatusForCarInfo("绑定" + FIXED_CAR_GROUP_NAME + "到海康isc", rs, carInfo, 5, 1, null, true);
|
||||||
} else if (Objects.equals(operation, 2)) {
|
} else if (Objects.equals(operation, 2)) {
|
||||||
|
//解绑
|
||||||
|
String carId = this.getRemoteCarIdByCarNumber(carInfo.getCarNumber(), project);
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
Object vehicleIds = carId == null ? carInfo.getId() : carId;
|
||||||
|
if (vehicleIds == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
param.put("vehicleIds", vehicleIds);
|
||||||
|
param.put("operation", 2);
|
||||||
|
param.put("categoryCode", categoryCode);
|
||||||
|
JSONObject jo = HikvisionUtil.bindCarCategory(project, param);
|
||||||
|
String rs = jo.toJSONString();
|
||||||
sendNoticeAndSetStatusForCarInfo("解绑" + FIXED_CAR_GROUP_NAME + "到海康isc", rs, carInfo, 5, 3, null, true);
|
sendNoticeAndSetStatusForCarInfo("解绑" + FIXED_CAR_GROUP_NAME + "到海康isc", rs, carInfo, 5, 3, null, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private Set<String> getHkCarIds(Project project, CarInfo carInfo) throws Exception {
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.putIfAbsent("pageNo", 0);
|
||||||
|
param.putIfAbsent("pageSize", 1000);
|
||||||
|
JSONArray listJa = new JSONArray();
|
||||||
|
int total = 0;
|
||||||
|
do {
|
||||||
|
param.put("pageNo", param.getInteger("pageNo") + 1);
|
||||||
|
JSONObject hkFixCars = HikvisionUtil.getFixCarList(project, param);
|
||||||
|
JSONObject jo = HikvisionUtil.getJSONObjectData(hkFixCars);
|
||||||
|
total = jo.getInteger("total");
|
||||||
|
JSONArray oneList = jo.getJSONArray("list");
|
||||||
|
listJa.addAll(oneList);
|
||||||
|
} while (total > param.getInteger(Cts.PAGE_NO) * 1000);
|
||||||
|
List<CarInfo> myFixCars = carInfoMapper.selectList(new LambdaQueryWrapper<CarInfo>()
|
||||||
|
.eq(CarInfo::getProjectSn, project.getProjectSn())
|
||||||
|
.eq(CarInfo::getCarModuleType, 1)
|
||||||
|
);
|
||||||
|
Set<String> ids = new HashSet<>();
|
||||||
|
Set<String> carNumSet = myFixCars.stream().map(CarInfo::getCarNumber).collect(Collectors.toSet());
|
||||||
|
for (int i = 0; i < listJa.size(); i++) {
|
||||||
|
JSONObject jo = listJa.getJSONObject(i);
|
||||||
|
if (carNumSet.contains(jo.getString("plateNo"))) {
|
||||||
|
ids.add(jo.getString("vehicleId"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ids.add(carInfo.getId() + "");
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 人脸评分
|
* 人脸评分
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -183,15 +183,12 @@ public class HikvisionUtil {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static JSONObject getFixCarListByCarNumber(String carNumber, Project project, Integer pageNo) throws Exception {
|
public static JSONObject getFixCarListByCarNumber(String carNumber, Project project, Integer pageNo) throws Exception {
|
||||||
final String ARTEMIS_PATH = "/artemis";
|
|
||||||
final String path = ARTEMIS_PATH + "/api/resource/v2/vehicle/advance/vehicleList";
|
|
||||||
String host = "https://" + project.getArtemisConfigHost();
|
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
//模糊查询
|
//模糊查询
|
||||||
jo.put("plateNo", carNumber);
|
jo.put("plateNo", carNumber);
|
||||||
jo.put("pageNo", pageNo);
|
jo.put("pageNo", pageNo);
|
||||||
jo.put("pageSize", 1000);
|
jo.put("pageSize", 1000);
|
||||||
return doPostRtObj(host, path, jo.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
return getFixCarList(project, jo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user