补齐父手机客户

This commit is contained in:
2026-05-19 09:31:13 +08:00
parent b73f5505bf
commit 893af21ce2
4 changed files with 47 additions and 3 deletions

View File

@@ -376,9 +376,21 @@ public class LbUserServiceImpl extends ServiceImpl<LbUserMapper, LbUser> impleme
page++;
}
int pmobileFilled = fillParentMobile(tid);
if (pmobileFilled < 0) {
result.put("success", false);
result.put("message", "用户已同步,但补齐上级手机号失败");
result.put("synced", totalSynced);
result.put("pmobileFilled", 0);
result.put("remoteCount", firstBody != null ? firstBody.count() : 0);
result.put("pages", page);
return result;
}
result.put("success", true);
result.put("message", totalSynced == 0 ? "接口成功,无用户数据" : "同步完成");
result.put("synced", totalSynced);
result.put("pmobileFilled", pmobileFilled);
result.put("remoteCount", firstBody != null ? firstBody.count() : 0);
result.put("pages", page);
return result;
@@ -398,6 +410,20 @@ public class LbUserServiceImpl extends ServiceImpl<LbUserMapper, LbUser> impleme
}
}
/**
* 同步完成后,按 pid 查找上级用户并将其 mobile 写入 pmobile。
*
* @return 受影响行数;失败返回 -1
*/
private int fillParentMobile(String tenantId) {
try {
return baseMapper.fillPmobileByTenantId(tenantId);
} catch (Exception e) {
log.error("fillParentMobile failed, tenantId={}", tenantId, e);
return -1;
}
}
/**
* @return 实际 upsert 条数;无有效 id 时返回 0失败返回 -1
*/