【功能修复】API 调用时,相关的 checkData 补充

pull/139/head
YunaiV 2024-09-03 11:37:47 +08:00
parent b1f6110406
commit b35799b593
30 changed files with 55 additions and 56 deletions

View File

@ -23,7 +23,7 @@ public class ApiAccessLogFrameworkServiceImpl implements ApiAccessLogFrameworkSe
@Async
public void createApiAccessLog(ApiAccessLogCreateReqDTO reqDTO) {
try {
apiAccessLogApi.createApiAccessLog(reqDTO);
apiAccessLogApi.createApiAccessLog(reqDTO).checkError();
} catch (Throwable ex) {
// 由于 @Async 异步调用,这里打印下日志,更容易跟进
log.error("[createApiAccessLog][url({}) log({}) 发生异常]", reqDTO.getRequestUrl(), reqDTO, ex);

View File

@ -23,7 +23,7 @@ public class ApiErrorLogFrameworkServiceImpl implements ApiErrorLogFrameworkServ
@Async
public void createApiErrorLog(ApiErrorLogCreateReqDTO reqDTO) {
try {
apiErrorLogApi.createApiErrorLog(reqDTO);
apiErrorLogApi.createApiErrorLog(reqDTO).checkError();
} catch (Throwable ex) {
// 由于 @Async 异步调用,这里打印下日志,更容易跟进
log.error("[createApiErrorLog][url({}) log({}) 发生异常]", reqDTO.getRequestUrl(), reqDTO, ex);

View File

@ -33,7 +33,7 @@ public class BpmTaskCandidateDeptLeaderStrategy implements BpmTaskCandidateStrat
@Override
public void validateParam(String param) {
Set<Long> deptIds = StrUtils.splitToLongSet(param);
deptApi.validateDeptList(deptIds);
deptApi.validateDeptList(deptIds).checkError();
}
@Override

View File

@ -36,7 +36,7 @@ public class BpmTaskCandidateDeptMemberStrategy implements BpmTaskCandidateStrat
@Override
public void validateParam(String param) {
Set<Long> deptIds = StrUtils.splitToLongSet(param);
deptApi.validateDeptList(deptIds);
deptApi.validateDeptList(deptIds).checkError();
}
@Override

View File

@ -36,7 +36,7 @@ public class BpmTaskCandidatePostStrategy implements BpmTaskCandidateStrategy {
@Override
public void validateParam(String param) {
Set<Long> postIds = StrUtils.splitToLongSet(param);
postApi.validPostList(postIds);
postApi.validPostList(postIds).checkError();
}
@Override

View File

@ -32,7 +32,7 @@ public class BpmTaskCandidateRoleStrategy implements BpmTaskCandidateStrategy {
@Override
public void validateParam(String param) {
Set<Long> roleIds = StrUtils.splitToLongSet(param);
roleApi.validRoleList(roleIds);
roleApi.validRoleList(roleIds).checkError();
}
@Override

View File

@ -28,7 +28,7 @@ public class BpmTaskCandidateUserStrategy implements BpmTaskCandidateStrategy {
@Override
public void validateParam(String param) {
adminUserApi.validateUserList(StrUtils.splitToLongSet(param));
adminUserApi.validateUserList(StrUtils.splitToLongSet(param)).checkError();
}
@Override

View File

@ -37,7 +37,7 @@ public class BpmMessageServiceImpl implements BpmMessageService {
templateParams.put("processInstanceName", reqDTO.getProcessInstanceName());
templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId()));
smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getStartUserId(),
BpmMessageEnum.PROCESS_INSTANCE_APPROVE.getSmsTemplateCode(), templateParams));
BpmMessageEnum.PROCESS_INSTANCE_APPROVE.getSmsTemplateCode(), templateParams)).checkError();
}
@Override
@ -47,7 +47,7 @@ public class BpmMessageServiceImpl implements BpmMessageService {
templateParams.put("reason", reqDTO.getReason());
templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId()));
smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getStartUserId(),
BpmMessageEnum.PROCESS_INSTANCE_REJECT.getSmsTemplateCode(), templateParams));
BpmMessageEnum.PROCESS_INSTANCE_REJECT.getSmsTemplateCode(), templateParams)).getCheckedData();
}
@Override
@ -58,7 +58,7 @@ public class BpmMessageServiceImpl implements BpmMessageService {
templateParams.put("startUserNickname", reqDTO.getStartUserNickname());
templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId()));
smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getAssigneeUserId(),
BpmMessageEnum.TASK_ASSIGNED.getSmsTemplateCode(), templateParams));
BpmMessageEnum.TASK_ASSIGNED.getSmsTemplateCode(), templateParams)).getCheckedData();
}
private String getProcessInstanceDetailUrl(String taskId) {

View File

@ -114,7 +114,7 @@ public class CrmClueServiceImpl implements CrmClueService {
private void validateRelationDataExists(CrmClueSaveReqVO reqVO) {
// 校验负责人
if (Objects.nonNull(reqVO.getOwnerUserId()) &&
Objects.isNull(adminUserApi.getUser(reqVO.getOwnerUserId()))) {
Objects.isNull(adminUserApi.getUser(reqVO.getOwnerUserId()).getCheckedData())) {
throw exception(USER_NOT_EXISTS);
}
}

View File

@ -110,8 +110,8 @@ public class CrmCustomerLimitConfigServiceImpl implements CrmCustomerLimitConfig
* @param deptIds ids
*/
private void validateUserAndDept(Collection<Long> userIds, Collection<Long> deptIds) {
deptApi.validateDeptList(deptIds);
adminUserApi.validateUserList(userIds);
deptApi.validateDeptList(deptIds).checkError();
adminUserApi.validateUserList(userIds).checkError();
}
@Override

View File

@ -396,7 +396,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
throw exception(CUSTOMER_NOT_EXISTS);
}
// 1.2 校验负责人是否存在
adminUserApi.validateUserList(singletonList(ownerUserId));
adminUserApi.validateUserList(singletonList(ownerUserId)).checkError();
// 1.3 校验状态
customers.forEach(customer -> {
// 校验是否已有负责人

View File

@ -157,7 +157,7 @@ public class CrmPermissionServiceImpl implements CrmPermissionService {
private Long createPermission0(CrmPermissionCreateReqBO createReqBO) {
validatePermissionNotExists(Collections.singletonList(createReqBO));
// 1. 校验用户是否存在
adminUserApi.validateUserList(Collections.singletonList(createReqBO.getUserId()));
adminUserApi.validateUserList(Collections.singletonList(createReqBO.getUserId())).checkError();
// 2. 插入权限
CrmPermissionDO permission = BeanUtils.toBean(createReqBO, CrmPermissionDO.class);
permissionMapper.insert(permission);
@ -168,7 +168,7 @@ public class CrmPermissionServiceImpl implements CrmPermissionService {
public void createPermissionBatch(List<CrmPermissionCreateReqBO> createReqBOs) {
validatePermissionNotExists(createReqBOs);
// 1. 校验用户是否存在
adminUserApi.validateUserList(convertSet(createReqBOs, CrmPermissionCreateReqBO::getUserId));
adminUserApi.validateUserList(convertSet(createReqBOs, CrmPermissionCreateReqBO::getUserId)).checkError();
// 2. 创建
List<CrmPermissionDO> permissions = BeanUtils.toBean(createReqBOs, CrmPermissionDO.class);
@ -219,7 +219,7 @@ public class CrmPermissionServiceImpl implements CrmPermissionService {
throw exception(CRM_PERMISSION_MODEL_TRANSFER_FAIL_OWNER_USER_EXISTS, bizTypeName);
}
// 1.2 校验新负责人是否存在
adminUserApi.validateUserList(Collections.singletonList(transferReqBO.getNewOwnerUserId()));
adminUserApi.validateUserList(Collections.singletonList(transferReqBO.getNewOwnerUserId())).checkError();
// 2. 修改新负责人的权限
List<CrmPermissionDO> permissions = permissionMapper.selectByBizTypeAndBizId(

View File

@ -60,7 +60,7 @@ public class CrmProductServiceImpl implements CrmProductService {
success = CRM_PRODUCT_CREATE_SUCCESS)
public Long createProduct(CrmProductSaveReqVO createReqVO) {
// 1. 校验产品
adminUserApi.validateUserList(Collections.singleton(createReqVO.getOwnerUserId()));
adminUserApi.validateUserList(Collections.singleton(createReqVO.getOwnerUserId())).checkError();
validateProductNoDuplicate(null, createReqVO.getNo());
validateProductCategoryExists(createReqVO.getCategoryId());

View File

@ -232,7 +232,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService {
.setTemplateTitle(COMBINATION_SUCCESS)
.setPage("pages/order/detail?id=" + record.getOrderId()) // 订单详情页
.addMessage("thing1", "商品拼团活动") // 活动标题
.addMessage("thing2", "恭喜您拼团成功!我们将尽快为您发货。")); // 温馨提示
.addMessage("thing2", "恭喜您拼团成功!我们将尽快为您发货。")).checkError(); // 温馨提示
}
@Override
@ -338,7 +338,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService {
List<CombinationRecordDO> headAndRecords = updateBatchCombinationRecords(headRecord,
CombinationRecordStatusEnum.FAILED);
// 2. 订单取消
headAndRecords.forEach(item -> tradeOrderApi.cancelPaidOrder(item.getUserId(), item.getOrderId()));
headAndRecords.forEach(item -> tradeOrderApi.cancelPaidOrder(item.getUserId(), item.getOrderId()).checkError());
}
/**

View File

@ -95,9 +95,9 @@ public class CouponTemplateServiceImpl implements CouponTemplateService {
private void validateProductScope(Integer productScope, List<Long> productScopeValues) {
if (Objects.equals(PromotionProductScopeEnum.SPU.getScope(), productScope)) {
productSpuApi.validateSpuList(productScopeValues);
productSpuApi.validateSpuList(productScopeValues).checkError();
} else if (Objects.equals(PromotionProductScopeEnum.CATEGORY.getScope(), productScope)) {
productCategoryApi.validateCategoryList(productScopeValues);
productCategoryApi.validateCategoryList(productScopeValues).checkError();
}
}

View File

@ -99,7 +99,7 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService {
.put("reason", withdraw.getAuditReason())
.build();
notifyMessageSendApi.sendSingleMessageToMember(new NotifySendSingleToUserReqDTO()
.setUserId(withdraw.getUserId()).setTemplateCode(templateCode).setTemplateParams(templateParams));
.setUserId(withdraw.getUserId()).setTemplateCode(templateCode).setTemplateParams(templateParams)).checkError();
}
private BrokerageWithdrawDO validateBrokerageWithdrawExists(Integer id) {

View File

@ -38,7 +38,7 @@ public class TradeMessageServiceImpl implements TradeMessageService {
new NotifySendSingleToUserReqDTO()
.setUserId(reqBO.getUserId())
.setTemplateCode(MessageTemplateConstants.SMS_ORDER_DELIVERY)
.setTemplateParams(msgMap));
.setTemplateParams(msgMap)).checkError();
}
}

View File

@ -391,7 +391,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
.addMessage("phrase6", TradeOrderStatusEnum.DELIVERED.getName()) // 订单状态
.addMessage("date4", LocalDateTimeUtil.formatNormal(LocalDateTime.now()))// 发货时间
.addMessage("character_string5", StrUtil.blankToDefault(deliveryReqVO.getLogisticsNo(), "-")) // 快递单号
.addMessage("thing9", order.getReceiverDetailAddress())); // 收货地址
.addMessage("thing9", order.getReceiverDetailAddress())).checkError(); // 收货地址
}
/**
@ -670,7 +670,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
tradeOrderItemMapper.updateBatch(updateItems);
// 4. 更新支付订单
payOrderApi.updatePayOrderPrice(order.getPayOrderId(), newPayPrice);
payOrderApi.updatePayOrderPrice(order.getPayOrderId(), newPayPrice).checkError();
// 5. 记录订单日志
TradeOrderLogUtils.setOrderInfo(order.getId(), order.getStatus(), order.getStatus(),

View File

@ -35,7 +35,7 @@ public class TradeBargainOrderHandler implements TradeOrderHandler {
// 扣减砍价活动的库存
bargainActivityApi.updateBargainActivityStock(order.getBargainActivityId(),
-orderItems.get(0).getCount());
-orderItems.get(0).getCount()).checkError();
}
@Override
@ -47,7 +47,7 @@ public class TradeBargainOrderHandler implements TradeOrderHandler {
Assert.isTrue(orderItems.size() == 1, "砍价时,只允许选择一个商品");
// 记录砍价记录对应的订单编号
bargainRecordApi.updateBargainRecordOrderId(order.getBargainRecordId(), order.getId());
bargainRecordApi.updateBargainRecordOrderId(order.getBargainRecordId(), order.getId()).checkError();
}
@Override
@ -72,7 +72,7 @@ public class TradeBargainOrderHandler implements TradeOrderHandler {
return;
}
// 恢复(增加)砍价活动的库存
bargainActivityApi.updateBargainActivityStock(order.getBargainActivityId(), orderItem.getCount());
bargainActivityApi.updateBargainActivityStock(order.getBargainActivityId(), orderItem.getCount()).checkError();
}
}

View File

@ -49,7 +49,7 @@ public class TradeCombinationOrderHandler implements TradeOrderHandler {
// 1. 校验是否满足拼团活动相关限制
TradeOrderItemDO item = orderItems.get(0);
combinationRecordApi.validateCombinationRecord(order.getUserId(), order.getCombinationActivityId(),
order.getCombinationHeadId(), item.getSkuId(), item.getCount());
order.getCombinationHeadId(), item.getSkuId(), item.getCount()).checkError();
// 2. 校验该用户是否存在未支付的拼团活动订单,避免一个拼团可以下多个单子了
TradeOrderDO activityOrder = orderQueryService.getOrderByUserIdAndStatusAndCombination(

View File

@ -27,7 +27,7 @@ public class TradeCouponOrderHandler implements TradeOrderHandler {
}
// 不在前置扣减的原因,是因为优惠劵要记录使用的订单号
couponApi.useCoupon(new CouponUseReqDTO().setId(order.getCouponId()).setUserId(order.getUserId())
.setOrderId(order.getId()));
.setOrderId(order.getId())).checkError();
}
@Override
@ -36,7 +36,7 @@ public class TradeCouponOrderHandler implements TradeOrderHandler {
return;
}
// 退回优惠劵
couponApi.returnUsedCoupon(order.getCouponId());
couponApi.returnUsedCoupon(order.getCouponId()).checkError();
}
}

View File

@ -46,7 +46,7 @@ public class TradeMemberPointOrderHandler implements TradeOrderHandler {
// 增加用户经验
memberLevelApi.addExperience(order.getUserId(), order.getPayPrice(),
MemberExperienceBizTypeEnum.ORDER_GIVE.getType(), String.valueOf(order.getId()));
MemberExperienceBizTypeEnum.ORDER_GIVE.getType(), String.valueOf(order.getId())).checkError();
}
@Override
@ -73,7 +73,7 @@ public class TradeMemberPointOrderHandler implements TradeOrderHandler {
// 扣减(回滚)用户经验
int payPrice = order.getPayPrice() - order.getRefundPrice();
memberLevelApi.addExperience(order.getUserId(), payPrice,
MemberExperienceBizTypeEnum.ORDER_GIVE_CANCEL.getType(), String.valueOf(order.getId()));
MemberExperienceBizTypeEnum.ORDER_GIVE_CANCEL.getType(), String.valueOf(order.getId())).checkError();
}
@Override
@ -86,7 +86,7 @@ public class TradeMemberPointOrderHandler implements TradeOrderHandler {
// 扣减(回滚)用户经验
AfterSaleDO afterSale = afterSaleService.getAfterSale(orderItem.getAfterSaleId());
memberLevelApi.reduceExperience(order.getUserId(), afterSale.getRefundPrice(),
MemberExperienceBizTypeEnum.ORDER_GIVE_CANCEL_ITEM.getType(), String.valueOf(orderItem.getId()));
MemberExperienceBizTypeEnum.ORDER_GIVE_CANCEL_ITEM.getType(), String.valueOf(orderItem.getId())).checkError();
}
/**
@ -111,7 +111,7 @@ public class TradeMemberPointOrderHandler implements TradeOrderHandler {
protected void reducePoint(Long userId, Integer point, MemberPointBizTypeEnum bizType, Long bizId) {
if (point != null && point > 0) {
memberPointApi.reducePoint(userId, point, bizType.getType(), String.valueOf(bizId));
memberPointApi.reducePoint(userId, point, bizType.getType(), String.valueOf(bizId)).checkError();
}
}

View File

@ -25,7 +25,7 @@ public class TradeProductSkuOrderHandler implements TradeOrderHandler {
@Override
public void beforeOrderCreate(TradeOrderDO order, List<TradeOrderItemDO> orderItems) {
productSkuApi.updateSkuStock(TradeOrderConvert.INSTANCE.convertNegative(orderItems));
productSkuApi.updateSkuStock(TradeOrderConvert.INSTANCE.convertNegative(orderItems)).checkError();
}
@Override
@ -35,12 +35,12 @@ public class TradeProductSkuOrderHandler implements TradeOrderHandler {
if (CollUtil.isEmpty(orderItems)) {
return;
}
productSkuApi.updateSkuStock(TradeOrderConvert.INSTANCE.convert(orderItems));
productSkuApi.updateSkuStock(TradeOrderConvert.INSTANCE.convert(orderItems)).checkError();
}
@Override
public void afterCancelOrderItem(TradeOrderDO order, TradeOrderItemDO orderItem) {
productSkuApi.updateSkuStock(TradeOrderConvert.INSTANCE.convert(singletonList(orderItem)));
productSkuApi.updateSkuStock(TradeOrderConvert.INSTANCE.convert(singletonList(orderItem))).checkError();
}
}

View File

@ -32,7 +32,7 @@ public class TradeSeckillOrderHandler implements TradeOrderHandler {
// 扣减秒杀活动的库存
seckillActivityApi.updateSeckillStockDecr(order.getSeckillActivityId(),
orderItems.get(0).getSkuId(), orderItems.get(0).getCount());
orderItems.get(0).getSkuId(), orderItems.get(0).getCount()).checkError();
}
@Override
@ -58,7 +58,7 @@ public class TradeSeckillOrderHandler implements TradeOrderHandler {
}
// 恢复秒杀活动的库存
seckillActivityApi.updateSeckillStockIncr(order.getSeckillActivityId(),
orderItem.getSkuId(), orderItem.getCount());
orderItem.getSkuId(), orderItem.getCount()).checkError();
}
}

View File

@ -48,7 +48,7 @@ public class AppSocialUserController {
public CommonResult<Boolean> socialUnbind(@RequestBody AppSocialUserUnbindReqVO reqVO) {
SocialUserUnbindReqDTO reqDTO = new SocialUserUnbindReqDTO(getLoginUserId(), UserTypeEnum.MEMBER.getValue(),
reqVO.getType(), reqVO.getOpenid());
socialUserApi.unbindSocialUser(reqDTO);
socialUserApi.unbindSocialUser(reqDTO).checkError();
return success(true);
}

View File

@ -81,7 +81,7 @@ public class MemberAuthServiceImpl implements MemberAuthService {
public AppAuthLoginRespVO smsLogin(AppAuthSmsLoginReqVO reqVO) {
// 校验验证码
String userIp = getClientIP();
smsCodeApi.useSmsCode(AuthConvert.INSTANCE.convert(reqVO, SmsSceneEnum.MEMBER_LOGIN.getScene(), userIp));
smsCodeApi.useSmsCode(AuthConvert.INSTANCE.convert(reqVO, SmsSceneEnum.MEMBER_LOGIN.getScene(), userIp)).checkError();
// 获得获得注册用户
MemberUserDO user = userService.createUserIfAbsent(reqVO.getMobile(), userIp, getTerminal());
@ -122,7 +122,7 @@ public class MemberAuthServiceImpl implements MemberAuthService {
} else {
user = userService.createUser(socialUser.getNickname(), socialUser.getAvatar(), getClientIP(), getTerminal());
socialUserApi.bindSocialUser(new SocialUserBindReqDTO(user.getId(), getUserType().getValue(),
reqVO.getType(), reqVO.getCode(), reqVO.getState()));
reqVO.getType(), reqVO.getCode(), reqVO.getState())).checkError();
}
if (user == null) {
throw exception(USER_NOT_EXISTS);
@ -200,7 +200,7 @@ public class MemberAuthServiceImpl implements MemberAuthService {
reqDTO.setUserAgent(ServletUtils.getUserAgent());
reqDTO.setUserIp(getClientIP());
reqDTO.setResult(loginResult.getResult());
loginLogApi.createLoginLog(reqDTO);
loginLogApi.createLoginLog(reqDTO).checkError();
// 更新最后登录时间
if (userId != null && Objects.equals(LoginResultEnum.SUCCESS.getResult(), loginResult.getResult())) {
userService.updateUserLogin(userId, getClientIP());
@ -242,7 +242,7 @@ public class MemberAuthServiceImpl implements MemberAuthService {
}
// 执行发送
smsCodeApi.sendSmsCode(AuthConvert.INSTANCE.convert(reqVO).setCreateIp(getClientIP()));
smsCodeApi.sendSmsCode(AuthConvert.INSTANCE.convert(reqVO).setCreateIp(getClientIP())).checkError();
}
@Override
@ -267,7 +267,7 @@ public class MemberAuthServiceImpl implements MemberAuthService {
reqDTO.setUserAgent(ServletUtils.getUserAgent());
reqDTO.setUserIp(getClientIP());
reqDTO.setResult(LoginResultEnum.SUCCESS.getResult());
loginLogApi.createLoginLog(reqDTO);
loginLogApi.createLoginLog(reqDTO).checkError();
}
private String getMobile(Long userId) {

View File

@ -152,7 +152,7 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
.addMessage("character_string1", String.valueOf(payOrderId)) // 支付单编号
.addMessage("amount2", fenToYuanStr(walletRecharge.getTotalPrice())) // 充值金额
.addMessage("time3", LocalDateTimeUtil.formatNormal(walletRecharge.getCreateTime())) // 充值时间
.addMessage("phrase4", "充值成功")); // 充值状态
.addMessage("phrase4", "充值成功")).checkError(); // 充值状态
}
@Override

View File

@ -77,7 +77,7 @@ public class SocialClientController {
@Operation(summary = "发送订阅消息") // 用于测试
@PreAuthorize("@ss.hasPermission('system:social-client:query')")
public void sendSubscribeMessage(@RequestBody SocialWxaSubscribeMessageSendReqDTO reqDTO) {
socialClientApi.sendWxaSubscribeMessage(reqDTO);
socialClientApi.sendWxaSubscribeMessage(reqDTO).checkError();
}
}

View File

@ -116,7 +116,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
throw exception(AUTH_MOBILE_NOT_EXISTS);
}
// 发送验证码
smsCodeApi.sendSmsCode(AuthConvert.INSTANCE.convert(reqVO).setCreateIp(getClientIP()));
smsCodeApi.sendSmsCode(AuthConvert.INSTANCE.convert(reqVO).setCreateIp(getClientIP())).checkError();
}
@Override

View File

@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.system.service.auth;
import cn.hutool.core.util.ReflectUtil;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi;
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO;
@ -22,15 +21,14 @@ import cn.iocoder.yudao.module.system.service.social.SocialUserService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import com.xingyuv.captcha.model.common.ResponseModel;
import com.xingyuv.captcha.service.CaptchaService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
import jakarta.annotation.Resource;
import jakarta.validation.ConstraintViolationException;
import jakarta.validation.Validation;
import jakarta.validation.Validator;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -195,6 +193,7 @@ public class AdminAuthServiceImplTest extends BaseDbUnitTest {
// mock 方法(用户信息)
AdminUserDO user = randomPojo(AdminUserDO.class);
when(userService.getUserByMobile(eq(mobile))).thenReturn(user);
when(smsCodeApi.sendSmsCode(any())).thenReturn(success(true));
// 调用
authService.sendSmsCode(reqVO);