|
@@ -5,6 +5,7 @@ import com.google.gson.Gson;
|
|
|
import com.google.gson.JsonArray;
|
|
|
import com.google.gson.JsonElement;
|
|
|
import com.google.gson.JsonObject;
|
|
|
+import com.xjrsoft.common.enums.OutInStatusEnum;
|
|
|
import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
|
|
|
import com.xjrsoft.common.utils.SqlRunnerAdapterUtil;
|
|
|
import com.xjrsoft.module.attendance.entity.AttendanceRuleDetails;
|
|
@@ -37,7 +38,7 @@ public class OutInRecordUtil {
|
|
|
|
|
|
String updSql = "UPDATE attendance_user_relation SET " +
|
|
|
"attendance_status = '" + attendanceStatus + "', attendance_time = '" + recordTime + "' " +
|
|
|
- "WHERE user_id = '" + userId + "' AND delete_mark = 0";
|
|
|
+ "WHERE user_id = '" + userId + "', attendance_mode = '人脸' AND delete_mark = 0";
|
|
|
SqlRunnerAdapter.db().update(updSql);
|
|
|
}
|
|
|
|
|
@@ -51,7 +52,7 @@ public class OutInRecordUtil {
|
|
|
|
|
|
String updSql = "UPDATE attendance_user_relation SET " +
|
|
|
"attendance_status = '" + attendanceStatus + "', attendance_time = '" + recordTime + "' " +
|
|
|
- "WHERE user_id = '" + userId + "' AND delete_mark = 0";
|
|
|
+ "WHERE user_id = '" + userId + "', attendance_mode = '人脸' AND delete_mark = 0";
|
|
|
SqlRunnerAdapter.db().update(updSql);
|
|
|
}
|
|
|
|
|
@@ -90,10 +91,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);
|
|
@@ -103,11 +104,43 @@ public class OutInRecordUtil {
|
|
|
|
|
|
String updSql = "UPDATE attendance_user_relation SET " +
|
|
|
"attendance_status = '" + attendanceStatus + "', attendance_time = '" + recordTime + "' " +
|
|
|
- "WHERE user_id = '" + userId + "' AND delete_mark = 0";
|
|
|
+ "WHERE user_id = '" + userId + "', attendance_mode = '车辆', car_number = '" + planNo + "' AND delete_mark = 0";
|
|
|
SqlRunnerAdapter.db().update(updSql);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ 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();
|
|
|
|
|
@@ -149,7 +182,7 @@ public class OutInRecordUtil {
|
|
|
if (personId == null) continue;
|
|
|
|
|
|
int statusInt = item.get("inAndOutType").getAsInt();
|
|
|
- int status = -1;
|
|
|
+ int status = 1;
|
|
|
switch (statusInt){
|
|
|
case 0:
|
|
|
status = 1;
|
|
@@ -216,7 +249,7 @@ public class OutInRecordUtil {
|
|
|
.withMinute(ruleDetails.getPmEndTime().toLocalTime().getMinute())
|
|
|
.withSecond(ruleDetails.getPmEndTime().toLocalTime().getSecond());
|
|
|
}
|
|
|
- if (status == 0) {//出
|
|
|
+ if (status == OutInStatusEnum.goOut.getCode()) {//出
|
|
|
if (recordTime.isBefore(amEndTime) && recordTime.isAfter(amStartTime)) {
|
|
|
attendanceStatus = "早退";
|
|
|
} else if (recordTime.isBefore(pmEndTime) && recordTime.isAfter(pmStartTime)) {
|
|
@@ -278,7 +311,7 @@ public class OutInRecordUtil {
|
|
|
.withMinute(ruleDetails.getEveningEndTime().toLocalTime().getMinute())
|
|
|
.withSecond(ruleDetails.getEveningEndTime().toLocalTime().getSecond());
|
|
|
}
|
|
|
- if(status == 0){//出
|
|
|
+ if(status == OutInStatusEnum.goOut.getCode()){//出
|
|
|
if(recordTime.isBefore(amEndTime) && recordTime.isAfter(amStartTime)){
|
|
|
attendanceStatus = "早退";
|
|
|
}else if(recordTime.isBefore(pmEndTime) && recordTime.isAfter(pmStartTime)){
|
|
@@ -367,7 +400,7 @@ public class OutInRecordUtil {
|
|
|
String eventId = item.get("eventId").isJsonNull() ? null : item.get("eventId").getAsString();
|
|
|
String deviceDesc = item.get("deviceDesc").isJsonNull() ? null : item.get("deviceDesc").getAsString();
|
|
|
|
|
|
- int status = -1;
|
|
|
+ int status = 1;
|
|
|
for (JsonElement e : doorEventsResponse){
|
|
|
JsonObject ele = e.getAsJsonObject();
|
|
|
if (ele.get("eventId") == item.get("eventId")){
|
|
@@ -397,6 +430,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);
|
|
@@ -489,8 +524,11 @@ public class OutInRecordUtil {
|
|
|
ApiUtil apiUtil = new ApiUtil();
|
|
|
String apiPath = "/api/acs/v2/door/events";
|
|
|
JsonObject paramJson = new JsonObject();
|
|
|
+ JsonArray eventList = new JsonArray();
|
|
|
+ eventList.add(196893); // 只获取人脸通过的
|
|
|
paramJson.addProperty("pageNo", pageNo.get());
|
|
|
paramJson.addProperty("pageSize", pageSize);
|
|
|
+ paramJson.add("eventTypes", eventList);
|
|
|
|
|
|
return apiUtil.doPost(apiPath, String.valueOf(paramJson), null);
|
|
|
}
|
|
@@ -525,7 +563,7 @@ public class OutInRecordUtil {
|
|
|
String happenTime = eventObject.get("happenTime").getAsString();
|
|
|
String extEventPictureURL = dataObject.get("ExtEventPictureURL").getAsString();
|
|
|
int statusInt = dataObject.get("ExtEventInOut").getAsInt();
|
|
|
- int status = -1;
|
|
|
+ int status = 1;
|
|
|
switch (statusInt){
|
|
|
case 0:
|
|
|
status = 1;
|
|
@@ -575,60 +613,146 @@ 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();
|
|
|
+ if (releaseResultInt == 13) releaseResultInt = 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 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 = 0;
|
|
|
- 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();
|
|
|
+ if (releaseResultInt == 13) releaseResultInt = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ 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();
|
|
|
+ if (releaseResultInt == 13) releaseResultInt = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- 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));
|