From 129f9175ac365fed6c9a29ce2c15af27c7d36023 Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Mon, 2 Jun 2025 21:55:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../customer/CrmCustomerServiceImpl.java | 19 +++++--------- .../admin/oauth2/OAuth2OpenController.java | 25 ++++++------------- 2 files changed, 14 insertions(+), 30 deletions(-) diff --git a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java index 0ea725fc87..c75713c3f5 100644 --- a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java +++ b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java @@ -47,7 +47,6 @@ import java.time.LocalDateTime; import java.util.*; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.filterList; import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.module.crm.enums.LogRecordConstants.*; @@ -233,24 +232,18 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { private void transfer(CrmCustomerTransferReqVO reqVO, Long userId) { if (reqVO.getToBizTypes().contains(CrmBizTypeEnum.CRM_CONTACT.getType())) { List contactList = contactService.getContactListByCustomerIdOwnerUserId(reqVO.getId(), userId); - contactList.forEach(item -> { - contactService.transferContact(new CrmContactTransferReqVO(item.getId(), reqVO.getNewOwnerUserId(), - reqVO.getOldOwnerPermissionLevel()), userId); - }); + contactList.forEach(item -> contactService.transferContact(new CrmContactTransferReqVO(item.getId(), reqVO.getNewOwnerUserId(), + reqVO.getOldOwnerPermissionLevel()), userId)); } if (reqVO.getToBizTypes().contains(CrmBizTypeEnum.CRM_BUSINESS.getType())) { List businessList = businessService.getBusinessListByCustomerIdOwnerUserId(reqVO.getId(), userId); - businessList.forEach(item -> { - businessService.transferBusiness(new CrmBusinessTransferReqVO(item.getId(), reqVO.getNewOwnerUserId(), - reqVO.getOldOwnerPermissionLevel()), userId); - }); + businessList.forEach(item -> businessService.transferBusiness(new CrmBusinessTransferReqVO(item.getId(), reqVO.getNewOwnerUserId(), + reqVO.getOldOwnerPermissionLevel()), userId)); } if (reqVO.getToBizTypes().contains(CrmBizTypeEnum.CRM_CONTRACT.getType())) { List contractList = contractService.getContractListByCustomerIdOwnerUserId(reqVO.getId(), userId); - contractList.forEach(item -> { - contractService.transferContract(new CrmContractTransferReqVO(item.getId(), reqVO.getNewOwnerUserId(), - reqVO.getOldOwnerPermissionLevel()), userId); - }); + contractList.forEach(item -> contractService.transferContract(new CrmContractTransferReqVO(item.getId(), reqVO.getNewOwnerUserId(), + reqVO.getOldOwnerPermissionLevel()), userId)); } } diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oauth2/OAuth2OpenController.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oauth2/OAuth2OpenController.java index fd37be87cf..e002e63a82 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oauth2/OAuth2OpenController.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oauth2/OAuth2OpenController.java @@ -119,23 +119,14 @@ public class OAuth2OpenController { grantType, scopes, redirectUri); // 2. 根据授权模式,获取访问令牌 - OAuth2AccessTokenDO accessTokenDO; - switch (grantTypeEnum) { - case AUTHORIZATION_CODE: - accessTokenDO = oauth2GrantService.grantAuthorizationCodeForAccessToken(client.getClientId(), code, redirectUri, state); - break; - case PASSWORD: - accessTokenDO = oauth2GrantService.grantPassword(username, password, client.getClientId(), scopes); - break; - case CLIENT_CREDENTIALS: - accessTokenDO = oauth2GrantService.grantClientCredentials(client.getClientId(), scopes); - break; - case REFRESH_TOKEN: - accessTokenDO = oauth2GrantService.grantRefreshToken(refreshToken, client.getClientId()); - break; - default: - throw new IllegalArgumentException("未知授权类型:" + grantType); - } + OAuth2AccessTokenDO accessTokenDO = switch (grantTypeEnum) { + case AUTHORIZATION_CODE -> + oauth2GrantService.grantAuthorizationCodeForAccessToken(client.getClientId(), code, redirectUri, state); + case PASSWORD -> oauth2GrantService.grantPassword(username, password, client.getClientId(), scopes); + case CLIENT_CREDENTIALS -> oauth2GrantService.grantClientCredentials(client.getClientId(), scopes); + case REFRESH_TOKEN -> oauth2GrantService.grantRefreshToken(refreshToken, client.getClientId()); + default -> throw new IllegalArgumentException("未知授权类型:" + grantType); + }; Assert.notNull(accessTokenDO, "访问令牌不能为空"); // 防御性检查 return success(OAuth2OpenConvert.INSTANCE.convert(accessTokenDO)); }