From b35799b593ae48b92db242bf64398dded832024c Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 3 Sep 2024 11:37:47 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E3=80=91API=20=E8=B0=83=E7=94=A8=E6=97=B6=EF=BC=8C=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E7=9A=84=20checkData=20=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ApiAccessLogFrameworkServiceImpl.java | 2 +- .../core/service/ApiErrorLogFrameworkServiceImpl.java | 2 +- .../strategy/BpmTaskCandidateDeptLeaderStrategy.java | 2 +- .../strategy/BpmTaskCandidateDeptMemberStrategy.java | 2 +- .../strategy/BpmTaskCandidatePostStrategy.java | 2 +- .../strategy/BpmTaskCandidateRoleStrategy.java | 2 +- .../strategy/BpmTaskCandidateUserStrategy.java | 2 +- .../bpm/service/message/BpmMessageServiceImpl.java | 6 +++--- .../module/crm/service/clue/CrmClueServiceImpl.java | 2 +- .../customer/CrmCustomerLimitConfigServiceImpl.java | 4 ++-- .../crm/service/customer/CrmCustomerServiceImpl.java | 2 +- .../service/permission/CrmPermissionServiceImpl.java | 6 +++--- .../crm/service/product/CrmProductServiceImpl.java | 2 +- .../combination/CombinationRecordServiceImpl.java | 4 ++-- .../service/coupon/CouponTemplateServiceImpl.java | 4 ++-- .../brokerage/BrokerageWithdrawServiceImpl.java | 2 +- .../service/message/TradeMessageServiceImpl.java | 2 +- .../service/order/TradeOrderUpdateServiceImpl.java | 4 ++-- .../order/handler/TradeBargainOrderHandler.java | 6 +++--- .../order/handler/TradeCombinationOrderHandler.java | 2 +- .../order/handler/TradeCouponOrderHandler.java | 4 ++-- .../order/handler/TradeMemberPointOrderHandler.java | 8 ++++---- .../order/handler/TradeProductSkuOrderHandler.java | 6 +++--- .../order/handler/TradeSeckillOrderHandler.java | 4 ++-- .../app/social/AppSocialUserController.java | 2 +- .../member/service/auth/MemberAuthServiceImpl.java | 10 +++++----- .../service/wallet/PayWalletRechargeServiceImpl.java | 2 +- .../admin/socail/SocialClientController.java | 2 +- .../system/service/auth/AdminAuthServiceImpl.java | 2 +- .../system/service/auth/AdminAuthServiceImplTest.java | 11 +++++------ 30 files changed, 55 insertions(+), 56 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLogFrameworkServiceImpl.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLogFrameworkServiceImpl.java index 934f8141c..5237492b3 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLogFrameworkServiceImpl.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLogFrameworkServiceImpl.java @@ -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); diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLogFrameworkServiceImpl.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLogFrameworkServiceImpl.java index e4e19fb32..d04332364 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLogFrameworkServiceImpl.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLogFrameworkServiceImpl.java @@ -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); diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateDeptLeaderStrategy.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateDeptLeaderStrategy.java index 10744dc4b..18dc8dc55 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateDeptLeaderStrategy.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateDeptLeaderStrategy.java @@ -33,7 +33,7 @@ public class BpmTaskCandidateDeptLeaderStrategy implements BpmTaskCandidateStrat @Override public void validateParam(String param) { Set deptIds = StrUtils.splitToLongSet(param); - deptApi.validateDeptList(deptIds); + deptApi.validateDeptList(deptIds).checkError(); } @Override diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateDeptMemberStrategy.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateDeptMemberStrategy.java index e347883c0..f12fdb9d3 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateDeptMemberStrategy.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateDeptMemberStrategy.java @@ -36,7 +36,7 @@ public class BpmTaskCandidateDeptMemberStrategy implements BpmTaskCandidateStrat @Override public void validateParam(String param) { Set deptIds = StrUtils.splitToLongSet(param); - deptApi.validateDeptList(deptIds); + deptApi.validateDeptList(deptIds).checkError(); } @Override diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidatePostStrategy.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidatePostStrategy.java index 03d966870..34f63cccb 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidatePostStrategy.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidatePostStrategy.java @@ -36,7 +36,7 @@ public class BpmTaskCandidatePostStrategy implements BpmTaskCandidateStrategy { @Override public void validateParam(String param) { Set postIds = StrUtils.splitToLongSet(param); - postApi.validPostList(postIds); + postApi.validPostList(postIds).checkError(); } @Override diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateRoleStrategy.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateRoleStrategy.java index 6db8a50e5..a34f15418 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateRoleStrategy.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateRoleStrategy.java @@ -32,7 +32,7 @@ public class BpmTaskCandidateRoleStrategy implements BpmTaskCandidateStrategy { @Override public void validateParam(String param) { Set roleIds = StrUtils.splitToLongSet(param); - roleApi.validRoleList(roleIds); + roleApi.validRoleList(roleIds).checkError(); } @Override diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateUserStrategy.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateUserStrategy.java index 390e4903a..7ff65e454 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateUserStrategy.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateUserStrategy.java @@ -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 diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java index 957b6d12c..df1a7b8f6 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java @@ -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) { diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java index 9724eeaf2..6b40620bc 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java @@ -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); } } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerLimitConfigServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerLimitConfigServiceImpl.java index eeddec327..610447f86 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerLimitConfigServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerLimitConfigServiceImpl.java @@ -110,8 +110,8 @@ public class CrmCustomerLimitConfigServiceImpl implements CrmCustomerLimitConfig * @param deptIds 部门 ids */ private void validateUserAndDept(Collection userIds, Collection deptIds) { - deptApi.validateDeptList(deptIds); - adminUserApi.validateUserList(userIds); + deptApi.validateDeptList(deptIds).checkError(); + adminUserApi.validateUserList(userIds).checkError(); } @Override diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java index dcfa6419f..d765398cf 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java @@ -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 -> { // 校验是否已有负责人 diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionServiceImpl.java index cb1b6a1c6..1c94291ce 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/permission/CrmPermissionServiceImpl.java @@ -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 createReqBOs) { validatePermissionNotExists(createReqBOs); // 1. 校验用户是否存在 - adminUserApi.validateUserList(convertSet(createReqBOs, CrmPermissionCreateReqBO::getUserId)); + adminUserApi.validateUserList(convertSet(createReqBOs, CrmPermissionCreateReqBO::getUserId)).checkError(); // 2. 创建 List 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 permissions = permissionMapper.selectByBizTypeAndBizId( diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductServiceImpl.java index 0598e6253..bff7df282 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductServiceImpl.java @@ -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()); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java index 689a18814..98352330a 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java @@ -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 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()); } /** diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponTemplateServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponTemplateServiceImpl.java index 6dc7b312d..15246740a 100755 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponTemplateServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponTemplateServiceImpl.java @@ -95,9 +95,9 @@ public class CouponTemplateServiceImpl implements CouponTemplateService { private void validateProductScope(Integer productScope, List 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(); } } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageWithdrawServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageWithdrawServiceImpl.java index c735163a5..629ca1d86 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageWithdrawServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageWithdrawServiceImpl.java @@ -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) { diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/message/TradeMessageServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/message/TradeMessageServiceImpl.java index a06c06906..abd02e0f0 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/message/TradeMessageServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/message/TradeMessageServiceImpl.java @@ -38,7 +38,7 @@ public class TradeMessageServiceImpl implements TradeMessageService { new NotifySendSingleToUserReqDTO() .setUserId(reqBO.getUserId()) .setTemplateCode(MessageTemplateConstants.SMS_ORDER_DELIVERY) - .setTemplateParams(msgMap)); + .setTemplateParams(msgMap)).checkError(); } } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java index e4617b00e..b04019cfb 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java @@ -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(), diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeBargainOrderHandler.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeBargainOrderHandler.java index 15a206406..27ffb0be7 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeBargainOrderHandler.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeBargainOrderHandler.java @@ -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(); } } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java index 329dcbbaf..fa1e50672 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java @@ -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( diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCouponOrderHandler.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCouponOrderHandler.java index 478de450f..bfe21f372 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCouponOrderHandler.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCouponOrderHandler.java @@ -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(); } } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeMemberPointOrderHandler.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeMemberPointOrderHandler.java index 88e1ce4f7..cb4a9738d 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeMemberPointOrderHandler.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeMemberPointOrderHandler.java @@ -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(); } } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeProductSkuOrderHandler.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeProductSkuOrderHandler.java index 1666cb88c..e20d5d9cb 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeProductSkuOrderHandler.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeProductSkuOrderHandler.java @@ -25,7 +25,7 @@ public class TradeProductSkuOrderHandler implements TradeOrderHandler { @Override public void beforeOrderCreate(TradeOrderDO order, List 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(); } } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeSeckillOrderHandler.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeSeckillOrderHandler.java index e70c7fa58..2c49820d6 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeSeckillOrderHandler.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeSeckillOrderHandler.java @@ -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(); } } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/social/AppSocialUserController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/social/AppSocialUserController.java index 19910e54c..b0d7824df 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/social/AppSocialUserController.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/social/AppSocialUserController.java @@ -48,7 +48,7 @@ public class AppSocialUserController { public CommonResult 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); } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java index 500961dea..778d78cb4 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java @@ -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) { diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java index 98e32ec79..b448286b9 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java @@ -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 diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/socail/SocialClientController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/socail/SocialClientController.java index e91a3d8a0..a455d4006 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/socail/SocialClientController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/socail/SocialClientController.java @@ -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(); } } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java index 99ef11b2c..e387c247e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java @@ -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 diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImplTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImplTest.java index d6709a082..1335068d9 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImplTest.java +++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImplTest.java @@ -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);