Merge remote-tracking branch 'websoft/dev'

This commit is contained in:
2026-10-26 16:09:25 +08:00
23 changed files with 1639 additions and 296 deletions
@@ -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,18 @@ public interface IDriverClient {
@PostMapping(ENSURE_PROFILE)
R<DriverEnsureProfileVO> ensureProfile(@RequestBody DriverEnsureProfileDTO param);
/**
* 账号改手机号后同步司机档案的 mobile
* <p>
* 幂等入口:档案 mobile 已是新号时返回成功且不写库。只在档案属于该账号
* (user_id + tenant_id 命中)且档案 mobile 等于 oldPhone 时改这一列;
* 不满足时不动档案,通过返回值的 message 说明原因。入参不合法时服务端抛 ServiceException,
* feign 以调用异常返回,调用方按失败处理并自行决定是否影响账号更新。
*
* @param param 租户、小程序账号、账号旧号与新号
* @return 档案ID与本次是否同步
*/
@PostMapping(SYNC_MOBILE)
R<DriverSyncMobileVO> syncMobile(@RequestBody DriverSyncMobileDTO param);
}
@@ -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;
}
@@ -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;
}
}