feat(aihr): surface org snapshot data quality

This commit is contained in:
2026-07-09 21:38:35 +08:00
parent f00f9045eb
commit f38dfeeae0
5 changed files with 54 additions and 1 deletions
@@ -35,6 +35,8 @@ public final class AihrOrgSyncDto {
int total,
int active,
int departed,
int phoneLinked,
int suspectText,
int pageNum,
int pageSize,
List<OrgProjectOption> projects,
@@ -124,6 +124,17 @@ public class AihrOrgSyncService {
int total = countOrgRows("select count(*) from aihr_org_snapshot" + where, args);
int active = countOrgRows("select count(*) from aihr_org_snapshot" + where + " and employment_status = 'active'", args);
int departed = countOrgRows("select count(*) from aihr_org_snapshot" + where + " and employment_status = 'departed'", args);
int phoneLinked = countOrgRows("select count(*) from aihr_org_snapshot" + where + " and person_phone is not null and person_phone <> ''", args);
int suspectText = countOrgRows("""
select count(*) from aihr_org_snapshot
""" + where + """
and (
person_name like '%?%'
or project_name like '%?%'
or dept_name like '%?%'
or position_name like '%?%'
)
""", args);
List<Object> rowArgs = new ArrayList<>(args);
rowArgs.add(safePageSize);
rowArgs.add(offset);
@@ -147,7 +158,7 @@ public class AihrOrgSyncService {
rs.getString("employment_status"),
rs.getString("snapshot_date")
), rowArgs.toArray());
return new OrgSnapshotResponse(total, active, departed, safePageNum, safePageSize, orgProjects(), orgLevels(), rows);
return new OrgSnapshotResponse(total, active, departed, phoneLinked, suspectText, safePageNum, safePageSize, orgProjects(), orgLevels(), rows);
}
private List<JsonNode> fetchOptional(String baseUrl, String token, SyncRequest req, String resourceType,