🩹 code-review 修订:改号同步日志手机号脱敏、统一 feign 契约注释
This commit is contained in:
+1
-7
@@ -97,13 +97,7 @@ public final class MpPhoneChangePlan {
|
||||
&& !submittedAccount.equals(oldAccount) && !isMasked(submittedAccount)) {
|
||||
return submittedAccount;
|
||||
}
|
||||
if (oldAccount == null) {
|
||||
return newPhone;
|
||||
}
|
||||
if (oldAccount.equals(oldPhone)) {
|
||||
return newPhone;
|
||||
}
|
||||
return oldAccount;
|
||||
return shouldSyncAccount() ? newPhone : oldAccount;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+12
-9
@@ -22,6 +22,7 @@
|
||||
*/
|
||||
package org.springblade.system.support;
|
||||
|
||||
import cn.hutool.core.util.DesensitizedUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.core.tool.api.R;
|
||||
@@ -34,12 +35,12 @@ import org.springframework.stereotype.Component;
|
||||
/**
|
||||
* 改号后同步司机档案手机号
|
||||
* <p>
|
||||
* 只在后台编辑与 App 内改号两个入口调用:登录链路上 transport 会回调本服务的 updateUser,
|
||||
* 若那里再回调用 transport,会形成 transport(持 driver 行锁) → system → transport 的嵌套更新,
|
||||
* 内层等同一行的锁直到超时。
|
||||
* 只在后台编辑与 App 内改号两个入口调用。登录链路的账号更新不得回调 transport:
|
||||
* transport 的司机档案编辑会回调本服务的 updateUser,互相回调会形成 transport(持 driver 行锁)
|
||||
* → system → transport 的嵌套更新,内层等同一行的锁直到超时。
|
||||
* <p>
|
||||
* 档案同步是账号更新之后的补偿动作:任何失败只记日志、不抛异常,账号更新照常提交。
|
||||
* 调用方据此能看出「账号改了、档案没改」。
|
||||
* 档案同步在账号更新之后执行:任何失败只记日志、不抛异常,账号更新照常提交。
|
||||
* 日志里的手机号一律脱敏;tenantId / mpUserId / driverId 保持原值用于定位。
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@@ -63,6 +64,8 @@ public class MpUserPhoneChangeSupport {
|
||||
|| oldMobile.contains("*") || newMobile.contains("*") || oldMobile.equals(newMobile)) {
|
||||
return false;
|
||||
}
|
||||
String maskedOldPhone = DesensitizedUtil.mobilePhone(oldMobile);
|
||||
String maskedNewPhone = DesensitizedUtil.mobilePhone(newMobile);
|
||||
DriverSyncMobileDTO param = new DriverSyncMobileDTO();
|
||||
param.setTenantId(tenant);
|
||||
param.setMpUserId(userId);
|
||||
@@ -72,24 +75,24 @@ public class MpUserPhoneChangeSupport {
|
||||
R<DriverSyncMobileVO> result = driverClient.syncMobile(param);
|
||||
if (result == null || !result.isSuccess()) {
|
||||
log.error("小程序用户改号:账号已更新,司机档案同步调用失败。tenantId={} mpUserId={} oldPhone={} newPhone={} reason={}",
|
||||
tenant, userId, oldMobile, newMobile, result == null ? "无响应" : result.getMsg());
|
||||
tenant, userId, maskedOldPhone, maskedNewPhone, result == null ? "无响应" : result.getMsg());
|
||||
return false;
|
||||
}
|
||||
DriverSyncMobileVO data = result.getData();
|
||||
if (data == null) {
|
||||
log.error("小程序用户改号:账号已更新,司机档案同步无返回数据。tenantId={} mpUserId={} oldPhone={} newPhone={}",
|
||||
tenant, userId, oldMobile, newMobile);
|
||||
tenant, userId, maskedOldPhone, maskedNewPhone);
|
||||
return false;
|
||||
}
|
||||
if (!Boolean.TRUE.equals(data.getSynced())) {
|
||||
log.warn("小程序用户改号:账号已更新,司机档案未同步。tenantId={} mpUserId={} oldPhone={} newPhone={} driverId={} reason={}",
|
||||
tenant, userId, oldMobile, newMobile, data.getDriverId(), data.getMessage());
|
||||
tenant, userId, maskedOldPhone, maskedNewPhone, data.getDriverId(), data.getMessage());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} catch (Exception exception) {
|
||||
log.error("小程序用户改号:账号已更新,司机档案同步异常。tenantId={} mpUserId={} oldPhone={} newPhone={}",
|
||||
tenant, userId, oldMobile, newMobile, exception);
|
||||
tenant, userId, maskedOldPhone, maskedNewPhone, exception);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user