|
@@ -90,10 +90,10 @@ public class OutInRecordUtil {
|
|
|
|
|
|
SqlRunnerAdapter.db().dynamicInsert(tableName, where);
|
|
|
|
|
|
- //车辆入库后,判定教师考情状态
|
|
|
+ //车辆入库后,判定教师考勤状态
|
|
|
if(carMessageApplyId != 0){
|
|
|
String selectTable = "car_message_apply";
|
|
|
- Entity selectWhere = Entity.create(tableName);
|
|
|
+ Entity selectWhere = Entity.create(selectTable);
|
|
|
selectWhere.set("car_message_apply_id", carMessageApplyId);
|
|
|
selectWhere.set("plan_no", planNo);
|
|
|
Map<String, Object> objectMap = SqlRunnerAdapter.db().dynamicSelectOne(selectTable, selectWhere);
|
|
@@ -108,6 +108,38 @@ public class OutInRecordUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void updatePicVehicleRecord(String eventId, String photo, int releaseWayInt, int releaseReasonInt, int releaseResultInt) {
|
|
|
+ String photoValue = (photo != null && !photo.equals("null")) ? photo : "";
|
|
|
+
|
|
|
+ String tableName = "car_out_in_record";
|
|
|
+
|
|
|
+ Entity params = Entity.create();
|
|
|
+ params.set("face_photo", photoValue);
|
|
|
+ params.set("release_way", releaseWayInt);
|
|
|
+ params.set("release_reason", releaseReasonInt);
|
|
|
+ params.set("release_result", releaseResultInt);
|
|
|
+
|
|
|
+ Entity where = Entity.create();
|
|
|
+ where.set("cross_record_syscode", eventId);
|
|
|
+
|
|
|
+ // 执行更新操作
|
|
|
+ SqlRunnerAdapter.db().dynamicUpdate(tableName, params, where);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void updateReleaseVehicleRecord(String eventId, int releaseWayInt, int releaseReasonInt, int releaseResultInt) {
|
|
|
+ String tableName = "car_out_in_record";
|
|
|
+
|
|
|
+ Entity params = Entity.create();
|
|
|
+ params.set("release_way", releaseWayInt);
|
|
|
+ params.set("release_reason", releaseReasonInt);
|
|
|
+ params.set("release_result", releaseResultInt);
|
|
|
+
|
|
|
+ Entity where = Entity.create();
|
|
|
+ where.set("cross_record_syscode", eventId);
|
|
|
+
|
|
|
+ SqlRunnerAdapter.db().dynamicUpdate(tableName, params, where);
|
|
|
+ }
|
|
|
+
|
|
|
public void GetTeacherAndStudentRecords(FaceImportMapper faceImportMapper) throws ParseException {
|
|
|
JsonArray responseBuilder = new JsonArray();
|
|
|
|
|
@@ -397,6 +429,8 @@ public class OutInRecordUtil {
|
|
|
JsonObject paramJson = new JsonObject();
|
|
|
paramJson.addProperty("pageNo", pageNo.getAndIncrement());
|
|
|
paramJson.addProperty("pageSize", pageSize);
|
|
|
+// paramJson.addProperty("startTime", "2024-06-18T00:00:00+08:00");
|
|
|
+// paramJson.addProperty("endTime", "2024-06-19T16:00:00+08:00");
|
|
|
|
|
|
String response = apiUtil.doPost(apiPath, String.valueOf(paramJson), null);
|
|
|
JsonElement responseElement = new Gson().fromJson(response, JsonElement.class);
|
|
@@ -490,7 +524,7 @@ public class OutInRecordUtil {
|
|
|
String apiPath = "/api/acs/v2/door/events";
|
|
|
JsonObject paramJson = new JsonObject();
|
|
|
JsonArray eventList = new JsonArray();
|
|
|
- eventList.add(196893);
|
|
|
+ eventList.add(196893); // 只获取人脸通过的
|
|
|
paramJson.addProperty("pageNo", pageNo.get());
|
|
|
paramJson.addProperty("pageSize", pageSize);
|
|
|
paramJson.add("eventTypes", eventList);
|
|
@@ -578,60 +612,143 @@ public class OutInRecordUtil {
|
|
|
for (JsonElement eventElement : eventsArray) {
|
|
|
JsonObject eventObject = eventElement.getAsJsonObject();
|
|
|
JsonObject dataObject = eventObject.getAsJsonObject("data");
|
|
|
+ if (dataObject.get("eventCmd").getAsInt() == 1){
|
|
|
+ String carNum = dataObject.get("plateNo").getAsString().trim();
|
|
|
+ String eventIndex = dataObject.get("eventIndex").getAsString().trim();
|
|
|
+ String carMessageApplyIdStr = faceImportMapper.GetCarMessageApplyIdByCarNumber(carNum);
|
|
|
+ Long carId = (carMessageApplyIdStr == null || carMessageApplyIdStr.isEmpty()) ? 0 : Long.parseLong(carMessageApplyIdStr);
|
|
|
+ String eventTime = ChangeTime(dataObject.get("time").getAsString());
|
|
|
+
|
|
|
+ int releaseWayInt = -1;
|
|
|
+ int releaseReasonInt = -1;
|
|
|
+ int releaseResultInt = -1;
|
|
|
+ JsonObject inResultObject = dataObject.getAsJsonObject("inResult");
|
|
|
+ JsonObject outResultObject = dataObject.getAsJsonObject("outResult");
|
|
|
+ JsonObject inoutResult = (inResultObject != null && !inResultObject.isJsonNull()) ? inResultObject : outResultObject;
|
|
|
+ if (inoutResult != null) {
|
|
|
+ JsonObject rlsResultObject = inoutResult.getAsJsonObject("rlsResult");
|
|
|
+ if (rlsResultObject.has("releaseWay") && rlsResultObject.has("releaseReason") && rlsResultObject.has("releaseResult")) {
|
|
|
+ releaseWayInt = rlsResultObject.get("releaseWay").getAsInt();
|
|
|
+ releaseReasonInt = rlsResultObject.get("releaseReason").getAsInt();
|
|
|
+ releaseResultInt = rlsResultObject.get("releaseResult").getAsInt();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- String carNum = dataObject.get("plateNo").getAsString().trim();
|
|
|
- String eventIndex = dataObject.get("eventIndex").getAsString().trim();
|
|
|
- String carMessageApplyIdStr = faceImportMapper.GetCarMessageApplyIdByCarNumber(carNum);
|
|
|
- Long carId = (carMessageApplyIdStr == null || carMessageApplyIdStr.isEmpty()) ? 0 : Long.parseLong(carMessageApplyIdStr);
|
|
|
- String eventTime = ChangeTime(dataObject.get("time").getAsString());
|
|
|
-
|
|
|
- int releaseWayInt = -1;
|
|
|
- int releaseReasonInt = -1;
|
|
|
- int releaseResultInt = -1;
|
|
|
- JsonObject inResultObject = dataObject.getAsJsonObject("inResult");
|
|
|
- JsonObject outResultObject = dataObject.getAsJsonObject("outResult");
|
|
|
- JsonObject inoutResult = (inResultObject != null && !inResultObject.isJsonNull()) ? inResultObject : outResultObject;
|
|
|
- if (inoutResult != null) {
|
|
|
- JsonObject rlsResultObject = inoutResult.getAsJsonObject("rlsResult");
|
|
|
- if (rlsResultObject.has("releaseWay") && rlsResultObject.has("releaseReason") && rlsResultObject.has("releaseResult")) {
|
|
|
- releaseWayInt = rlsResultObject.get("releaseWay").getAsInt();
|
|
|
- releaseReasonInt = rlsResultObject.get("releaseReason").getAsInt();
|
|
|
- releaseResultInt = rlsResultObject.get("releaseResult").getAsInt();
|
|
|
+ String carAttributeName = dataObject.get("carAttributeName").getAsString().trim();
|
|
|
+ int vehicleType = dataObject.get("vehicleType").getAsInt();
|
|
|
+ int category = -1;
|
|
|
+ switch (carAttributeName){
|
|
|
+ case "临时车":
|
|
|
+ category = 1;
|
|
|
+ break;
|
|
|
+ case "固定车":
|
|
|
+ category = 0;
|
|
|
+ break;
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- String carAttributeName = dataObject.get("carAttributeName").getAsString().trim();
|
|
|
- int vehicleType = dataObject.get("vehicleType").getAsInt();
|
|
|
- int category = -1;
|
|
|
- switch (carAttributeName){
|
|
|
- case "临时车":
|
|
|
- category = 1;
|
|
|
- break;
|
|
|
- case "固定车":
|
|
|
- category = 0;
|
|
|
- break;
|
|
|
- }
|
|
|
+ String facePicUri = "";
|
|
|
+ JsonObject picUrlObject = dataObject.getAsJsonObject("picUrl");
|
|
|
+ if (picUrlObject != null && picUrlObject.has("vehiclePicUrl")) {
|
|
|
+ facePicUri = picUrlObject.get("vehiclePicUrl").getAsString();
|
|
|
+ }
|
|
|
+
|
|
|
+ String statusStr = dataObject.get("roadwayName").getAsString();
|
|
|
+ int statusInt = -1;
|
|
|
+ if (statusStr.contains("入")) {
|
|
|
+ statusInt = 0;
|
|
|
+ } else if (statusStr.contains("出")) {
|
|
|
+ statusInt = 1;
|
|
|
+ }
|
|
|
|
|
|
- String facePicUri = "";
|
|
|
- JsonObject picUrlObject = dataObject.getAsJsonObject("picUrl");
|
|
|
- if (picUrlObject != null && picUrlObject.has("vehiclePicUrl")) {
|
|
|
- facePicUri = picUrlObject.get("vehiclePicUrl").getAsString();
|
|
|
+ String phone = faceImportMapper.GetPhoneNumberByPlanNum(carNum);
|
|
|
+ String name = faceImportMapper.GetNameByPlanNum(carNum);
|
|
|
+
|
|
|
+ if (vehicle_id_list.contains(eventIndex)) continue;
|
|
|
+
|
|
|
+ vehicleInsertRecord(carId, eventTime, releaseReasonInt, category, ApiUtil.GetRedirectURL(facePicUri), statusInt, carNum, eventIndex, releaseResultInt, releaseWayInt,vehicleType,phone,name);
|
|
|
}
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info(String.valueOf(e));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void UpdatePicVehicleRecordTest(String data) {
|
|
|
+ if (data != null) {
|
|
|
+ try {
|
|
|
+ JsonObject jsonObject = new Gson().fromJson(data, JsonObject.class);
|
|
|
+ JsonObject paramsObject = jsonObject.getAsJsonObject("params");
|
|
|
+ JsonArray eventsArray = paramsObject.getAsJsonArray("events");
|
|
|
+
|
|
|
+ for (JsonElement eventElement : eventsArray) {
|
|
|
+ JsonObject eventObject = eventElement.getAsJsonObject();
|
|
|
+ JsonObject dataObject = eventObject.getAsJsonObject("data");
|
|
|
|
|
|
- String statusStr = dataObject.get("roadwayName").getAsString();
|
|
|
- int statusInt = 1;
|
|
|
- if (statusStr.contains("入")) {
|
|
|
- statusInt = 0;
|
|
|
- } else if (statusStr.contains("出")) {
|
|
|
- statusInt = 1;
|
|
|
+ if(dataObject.get("eventCmd").getAsInt() == 2){
|
|
|
+ String eventIndex = dataObject.get("eventIndex").getAsString().trim();
|
|
|
+
|
|
|
+ int releaseWayInt = -1;
|
|
|
+ int releaseReasonInt = -1;
|
|
|
+ int releaseResultInt = -1;
|
|
|
+ JsonObject inResultObject = dataObject.getAsJsonObject("inResult");
|
|
|
+ JsonObject outResultObject = dataObject.getAsJsonObject("outResult");
|
|
|
+ JsonObject inoutResult = (inResultObject != null && !inResultObject.isJsonNull()) ? inResultObject : outResultObject;
|
|
|
+ if (inoutResult != null) {
|
|
|
+ JsonObject rlsResultObject = inoutResult.getAsJsonObject("rlsResult");
|
|
|
+ if (rlsResultObject.has("releaseWay") && rlsResultObject.has("releaseReason") && rlsResultObject.has("releaseResult")) {
|
|
|
+ releaseWayInt = rlsResultObject.get("releaseWay").getAsInt();
|
|
|
+ releaseReasonInt = rlsResultObject.get("releaseReason").getAsInt();
|
|
|
+ releaseResultInt = rlsResultObject.get("releaseResult").getAsInt();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String facePicUri = "";
|
|
|
+ JsonObject picUrlObject = dataObject.getAsJsonObject("picUrl");
|
|
|
+ if (picUrlObject != null && picUrlObject.has("vehiclePicUrl")) {
|
|
|
+ facePicUri = picUrlObject.get("vehiclePicUrl").getAsString();
|
|
|
+ }
|
|
|
+
|
|
|
+ updatePicVehicleRecord(eventIndex, ApiUtil.GetRedirectURL(facePicUri), releaseWayInt, releaseReasonInt, releaseResultInt);
|
|
|
}
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info(String.valueOf(e));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void UpdateReleaseVehicleRecordTest(String data) {
|
|
|
+ if (data != null) {
|
|
|
+ try {
|
|
|
+ JsonObject jsonObject = new Gson().fromJson(data, JsonObject.class);
|
|
|
+ JsonObject paramsObject = jsonObject.getAsJsonObject("params");
|
|
|
+ JsonArray eventsArray = paramsObject.getAsJsonArray("events");
|
|
|
|
|
|
- String phone = faceImportMapper.GetPhoneNumberByPlanNum(carNum);
|
|
|
- String name = faceImportMapper.GetNameByPlanNum(carNum);
|
|
|
+ for (JsonElement eventElement : eventsArray) {
|
|
|
+ JsonObject eventObject = eventElement.getAsJsonObject();
|
|
|
+ JsonObject dataObject = eventObject.getAsJsonObject("data");
|
|
|
|
|
|
- if (vehicle_id_list.contains(eventIndex)) continue;
|
|
|
+ if (dataObject.get("eventCmd").getAsInt() == 3 || dataObject.get("eventCmd").getAsInt() == 4) {
|
|
|
+ String eventIndex = dataObject.get("eventIndex").getAsString().trim();
|
|
|
+
|
|
|
+ int releaseWayInt = -1;
|
|
|
+ int releaseReasonInt = -1;
|
|
|
+ int releaseResultInt = -1;
|
|
|
+ JsonObject inResultObject = dataObject.getAsJsonObject("inResult");
|
|
|
+ JsonObject outResultObject = dataObject.getAsJsonObject("outResult");
|
|
|
+ JsonObject inoutResult = (inResultObject != null && !inResultObject.isJsonNull()) ? inResultObject : outResultObject;
|
|
|
+ if (inoutResult != null) {
|
|
|
+ JsonObject rlsResultObject = inoutResult.getAsJsonObject("rlsResult");
|
|
|
+ if (rlsResultObject.has("releaseWay") && rlsResultObject.has("releaseReason") && rlsResultObject.has("releaseResult")) {
|
|
|
+ releaseWayInt = rlsResultObject.get("releaseWay").getAsInt();
|
|
|
+ releaseReasonInt = rlsResultObject.get("releaseReason").getAsInt();
|
|
|
+ releaseResultInt = rlsResultObject.get("releaseResult").getAsInt();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- vehicleInsertRecord(carId, eventTime, releaseReasonInt, category, ApiUtil.GetRedirectURL(facePicUri), statusInt, carNum, eventIndex, releaseResultInt, releaseWayInt,vehicleType,phone,name);
|
|
|
+ updateReleaseVehicleRecord(eventIndex, releaseWayInt, releaseReasonInt, releaseResultInt);
|
|
|
+ }
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.info(String.valueOf(e));
|