From 285599338673fe373a2beea95dd5759eea07ae69 Mon Sep 17 00:00:00 2001 From: shenzhidan Date: Tue, 21 Jul 2026 18:06:09 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=96=B0=E5=A2=9E=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E4=BA=BA=E5=91=98=E5=AE=9A=E4=BD=8D=E5=B9=B3=E5=8F=B0=E5=8F=91?= =?UTF-8?q?=E9=80=81=E7=82=B9=E4=BD=8D=E6=8A=A5=E6=96=87=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=202=E3=80=81=E6=A0=B9=E6=8D=AE=E6=8A=A5=E6=96=87=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=E5=B9=B3=E5=8F=B0=E4=BA=BA=E5=91=98=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=8F=AA=E5=A4=84=E7=90=86=E7=AC=A6=E5=90=88=E6=9C=AC=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E4=BA=BA=E5=91=98=E4=BF=A1=E6=81=AF=E7=82=B9=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../query/PersonnelPositioningBiQueryExe.java | 58 ++++++------------- .../command/query/PositionPersonQueryExe.java | 6 +- 2 files changed, 23 insertions(+), 41 deletions(-) diff --git a/web-app/src/main/java/com/zcloud/personnel/positioning/command/query/PersonnelPositioningBiQueryExe.java b/web-app/src/main/java/com/zcloud/personnel/positioning/command/query/PersonnelPositioningBiQueryExe.java index 2b50f4f..8d94cb8 100644 --- a/web-app/src/main/java/com/zcloud/personnel/positioning/command/query/PersonnelPositioningBiQueryExe.java +++ b/web-app/src/main/java/com/zcloud/personnel/positioning/command/query/PersonnelPositioningBiQueryExe.java @@ -151,36 +151,21 @@ public class PersonnelPositioningBiQueryExe { } private List loadMatchedPersonLocations(BiPersonLocationQry query) { - boolean terminalOnly = isTerminalOnlyQuery(query); - List staffRows; - if (terminalOnly) { - StaffSnapshot snapshot = new StaffSnapshot(); - snapshot.terminalNo = query.getTerminalNo(); - staffRows = Collections.singletonList(snapshot); - } else { - staffRows = loadAllStaffSnapshots(); - } - - Map localPeople; - if (terminalOnly) { - localPeople = localLookupService.findUniquePeopleByTerminalNos( - Collections.singleton(query.getTerminalNo())); - } else { - Set phones = new LinkedHashSet<>(); - for (StaffSnapshot staff : staffRows) { - if (StringUtils.hasText(staff.staffNo)) { - phones.add(staff.staffNo); - } + List staffRows = loadAllStaffSnapshots(); + Set phones = new LinkedHashSet<>(); + for (StaffSnapshot staff : staffRows) { + if (StringUtils.hasText(staff.staffNo)) { + phones.add(staff.staffNo); } - localPeople = localLookupService.findUniquePeopleByPhones(phones); } + Map localPeople = + localLookupService.findUniquePeopleByPhones(phones); List matchedStaff = new ArrayList<>(); Set matchedUserIds = new HashSet<>(); Set terminalNos = new LinkedHashSet<>(); for (StaffSnapshot staff : staffRows) { - PositionPersonLocalLookupService.LocalPerson local = terminalOnly - ? localPeople.get(staff.terminalNo) : localPeople.get(staff.staffNo); + PositionPersonLocalLookupService.LocalPerson local = localPeople.get(staff.staffNo); if (local == null) { continue; } @@ -190,6 +175,10 @@ public class PersonnelPositioningBiQueryExe { if (!StringUtils.hasText(staff.terminalNo)) { staff.terminalNo = resolveTerminalNo(staff.staffNo, staff.idCardNo, staff.mobileNo, false); } + if (StringUtils.hasText(query.getTerminalNo()) + && !query.getTerminalNo().equals(staff.terminalNo)) { + continue; + } if (StringUtils.hasText(staff.terminalNo)) { terminalNos.add(staff.terminalNo); } @@ -200,15 +189,14 @@ public class PersonnelPositioningBiQueryExe { for (MatchedStaffSnapshot matched : matchedStaff) { matchedSnapshots.add(matched.staff); } - Map locationMap = locateStaffRows(matchedSnapshots, - terminalOnly ? query.getTerminalNo() : null); + Map locationMap = locateStaffRows(matchedSnapshots, query.getTerminalNo()); Map localTerminals = localLookupService.findTerminals(terminalNos); List rows = new ArrayList<>(); List fences = listAllAreaFence(); for (MatchedStaffSnapshot matched : matchedStaff) { StaffSnapshot staff = matched.staff; - String terminalNo = terminalOnly ? query.getTerminalNo() : staff.terminalNo; + String terminalNo = staff.terminalNo; JsonNode location = locationMap.get(terminalNo); BiPersonLocationCO co = mapPersonLocation(staff, matched.local, terminalNo, localTerminals.get(terminalNo), location, fences); @@ -482,19 +470,6 @@ public class PersonnelPositioningBiQueryExe { return request; } - private boolean isTerminalOnlyQuery(BiPersonLocationQry qry) { - return StringUtils.hasText(qry.getTerminalNo()) - && qry.getCorpinfoId() == null - && !StringUtils.hasText(qry.getCompanyName()) - && !StringUtils.hasText(qry.getOrgName()) - && !StringUtils.hasText(qry.getOrgCode()) - && !StringUtils.hasText(qry.getCreditCode()) - && !StringUtils.hasText(qry.getStaffName()) - && !StringUtils.hasText(qry.getStaffNo()) - && !StringUtils.hasText(qry.getIdCardNo()) - && !StringUtils.hasText(qry.getMobileNo()); - } - private List mapStaffSnapshots(JsonNode data) { JsonNode rows = extractRows(data); List result = new ArrayList<>(); @@ -510,10 +485,12 @@ public class PersonnelPositioningBiQueryExe { private StaffSnapshot mapStaffSnapshot(JsonNode row) { StaffSnapshot snapshot = new StaffSnapshot(); snapshot.rawNode = row; + JsonNode terminalInfo = child(row, "terminalInfo"); snapshot.staffName = textValue(firstPresentAny(child(row, "staffName"), child(row, "name"), child(row, "realName"), child(row, "userName"))); snapshot.staffNo = textValue(firstPresentAny(child(row, "staffNo"), child(row, "code"), - child(row, "employeeNo"), child(row, "workNo"))); + child(row, "employeeNo"), child(row, "workNo"), child(row, "trackNo"), + child(terminalInfo, "trackNo"), child(terminalInfo, "staffNo"))); snapshot.idCardNo = textValue(firstPresentAny(child(row, "idCardNo"), child(row, "identityNo"), child(row, "certificateNo"), child(row, "cardNo"))); snapshot.mobileNo = textValue(firstPresentAny(child(row, "mobileNo"), child(row, "phone"), @@ -526,6 +503,7 @@ public class PersonnelPositioningBiQueryExe { child(row, "unifiedSocialCreditCode"), child(row, "unifiedCreditCode"), child(row, "creditNo"))); snapshot.lastLocation = firstPresentAny(child(row, "lastLocation"), child(row, "location"), child(row, "point")); snapshot.terminalNo = firstText(textValue(child(row, "terminalNo")), + textValue(child(terminalInfo, "terminalNo")), textValue(child(snapshot.lastLocation, "terminalNo")), textValue(child(child(row, "bindTerminal"), "terminalNo")), textValue(child(child(row, "terminal"), "terminalNo")), diff --git a/web-app/src/main/java/com/zcloud/personnel/positioning/command/query/PositionPersonQueryExe.java b/web-app/src/main/java/com/zcloud/personnel/positioning/command/query/PositionPersonQueryExe.java index 3255d82..af27389 100644 --- a/web-app/src/main/java/com/zcloud/personnel/positioning/command/query/PositionPersonQueryExe.java +++ b/web-app/src/main/java/com/zcloud/personnel/positioning/command/query/PositionPersonQueryExe.java @@ -145,7 +145,10 @@ public class PositionPersonQueryExe { private FindsStaff mapFindsStaff(JsonNode row) { FindsStaff staff = new FindsStaff(); - staff.staffNo = normalize(text(firstPresent(row, "staffNo", "code", "employeeNo", "workNo"))); + JsonNode terminalInfo = row.path("terminalInfo"); + staff.staffNo = normalize(firstText( + text(firstPresent(row, "staffNo", "code", "employeeNo", "workNo", "trackNo")), + text(firstPresent(terminalInfo, "trackNo", "staffNo")))); staff.sourceCompanyName = text(firstPresent(row, "companyName", "corpName", "enterpriseName", "orgName")); staff.sourceDepartmentName = text(firstPresent(row, "departmentName", "deptName", "orgDepartmentName")); staff.lastLocation = firstPresent(row, "lastLocation", "location", "point"); @@ -153,6 +156,7 @@ public class PositionPersonQueryExe { timeMillis(firstPresent(row, "lastReportTime", "lastLocationTime", "lastOnlineTime"))); staff.terminalNo = firstText( text(firstPresent(row, "terminalNo")), + text(firstPresent(terminalInfo, "terminalNo")), text(firstPresent(staff.lastLocation, "terminalNo")), text(firstPresent(row.path("terminal"), "terminalNo")), text(firstPresent(row.path("bindTerminal"), "terminalNo")),