🐛 后台改手机号同步登录账号与司机档案电话
- transport 新增 feign /feign/client/driver/sync-mobile:按 user_id+tenant_id 找档案, 档案 mobile 等于账号旧号时只改 mobile 一列(带 driving_vehicle 原值),已是新号幂等成功, 找不到或判据不满足返回 synced=false 与原因 - blade-system updateUserWithPhoneSync:账号等于旧号时跟随新号、补账号唯一性校验, 本地写库后调 feign 同步档案;同步失败只记日志,不回滚账号更新。登录链路仍走 updateUser - App 内改号改调 updateUserWithPhoneSync - bindOpenId 改为覆盖写:不再拦截已绑定其他 openid 或 openid 属于其它账号
This commit is contained in:
+16
@@ -27,7 +27,9 @@ package org.springblade.transport.feign;
|
||||
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.transport.pojo.dto.DriverEnsureProfileDTO;
|
||||
import org.springblade.transport.pojo.dto.DriverSyncMobileDTO;
|
||||
import org.springblade.transport.pojo.vo.DriverEnsureProfileVO;
|
||||
import org.springblade.transport.pojo.vo.DriverSyncMobileVO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -42,6 +44,7 @@ public interface IDriverClient {
|
||||
|
||||
String API_PREFIX = "/feign/client/driver";
|
||||
String ENSURE_PROFILE = API_PREFIX + "/ensure-profile";
|
||||
String SYNC_MOBILE = API_PREFIX + "/sync-mobile";
|
||||
|
||||
/**
|
||||
* 查找或创建司机档案,并把档案绑定到指定小程序账号
|
||||
@@ -55,4 +58,17 @@ public interface IDriverClient {
|
||||
@PostMapping(ENSURE_PROFILE)
|
||||
R<DriverEnsureProfileVO> ensureProfile(@RequestBody DriverEnsureProfileDTO param);
|
||||
|
||||
/**
|
||||
* 账号改手机号后同步司机档案的 mobile
|
||||
* <p>
|
||||
* 幂等入口:档案 mobile 已是新号时返回成功且不写库。只在档案属于该账号
|
||||
* (user_id + tenant_id 命中)且档案 mobile 等于 oldPhone 时改这一列;
|
||||
* 不满足时不动档案,通过返回值的 message 说明原因,不抛异常给调用方的账号更新。
|
||||
*
|
||||
* @param param 租户、小程序账号、账号旧号与新号
|
||||
* @return 档案ID与本次是否同步
|
||||
*/
|
||||
@PostMapping(SYNC_MOBILE)
|
||||
R<DriverSyncMobileVO> syncMobile(@RequestBody DriverSyncMobileDTO param);
|
||||
|
||||
}
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.pojo.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 司机档案「按账号改手机号」参数
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "司机档案手机号同步参数")
|
||||
public class DriverSyncMobileDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "租户ID,为空时取当前请求租户;仍为空则拒绝")
|
||||
private String tenantId;
|
||||
|
||||
@Schema(description = "关联小程序用户ID(blade_mp_user.id)")
|
||||
private Long mpUserId;
|
||||
|
||||
@Schema(description = "账号当前手机号:档案 mobile 与之不一致时不改档案")
|
||||
private String oldPhone;
|
||||
|
||||
@Schema(description = "账号改后的手机号")
|
||||
private String newPhone;
|
||||
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.transport.pojo.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 司机档案「按账号改手机号」结果
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "司机档案手机号同步结果")
|
||||
public class DriverSyncMobileVO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "命中的司机档案ID,未找到时为null")
|
||||
private Long driverId;
|
||||
|
||||
@Schema(description = "档案手机号已同步为新号")
|
||||
private Boolean synced;
|
||||
|
||||
@Schema(description = "未同步的原因;成功时为null")
|
||||
private String message;
|
||||
|
||||
public static DriverSyncMobileVO synced(Long driverId) {
|
||||
DriverSyncMobileVO vo = new DriverSyncMobileVO();
|
||||
vo.setDriverId(driverId);
|
||||
vo.setSynced(true);
|
||||
return vo;
|
||||
}
|
||||
|
||||
public static DriverSyncMobileVO notSynced(Long driverId, String message) {
|
||||
DriverSyncMobileVO vo = new DriverSyncMobileVO();
|
||||
vo.setDriverId(driverId);
|
||||
vo.setSynced(false);
|
||||
vo.setMessage(message);
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user