Commit 87bc3f510c27374714398e9cfafc2c698b518e21

Authored by YunaiV
1 parent e9317bf2

优化:社交登录、用户的管理

Showing 17 changed files with 77 additions and 148 deletions
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java
... ... @@ -116,11 +116,11 @@ public interface ErrorCodeConstants {
116 116  
117 117 // ========== 社交用户 1-002-018-000 ==========
118 118 ErrorCode SOCIAL_USER_AUTH_FAILURE = new ErrorCode(1_002_018_000, "社交授权失败,原因是:{}");
119   - ErrorCode SOCIAL_USER_UNBIND_NOT_SELF = new ErrorCode(1_002_018_001, "社交解绑失败,非当前用户绑定");
120   - ErrorCode SOCIAL_USER_NOT_FOUND = new ErrorCode(1_002_018_002, "社交授权失败,找不到对应的用户");
121   - ErrorCode SOCIAL_APP_WEIXIN_MINI_APP_PHONE_CODE_ERROR = new ErrorCode(1_002_018_103, "获得手机号失败");
122   - ErrorCode SOCIAL_CLIENT_NOT_EXISTS = new ErrorCode(1_002_018_104, "社交客户端不存在");
123   - ErrorCode SOCIAL_USER_NOT_EXISTS = new ErrorCode(1_002_018_105, "社交用户不存在");
  119 + ErrorCode SOCIAL_USER_NOT_FOUND = new ErrorCode(1_002_018_001, "社交授权失败,找不到对应的用户");
  120 +
  121 + ErrorCode SOCIAL_CLIENT_WEIXIN_MINI_APP_PHONE_CODE_ERROR = new ErrorCode(1_002_018_200, "获得手机号失败");
  122 + ErrorCode SOCIAL_CLIENT_NOT_EXISTS = new ErrorCode(1_002_018_201, "社交客户端不存在");
  123 + ErrorCode SOCIAL_CLIENT_UNIQUE = new ErrorCode(1_002_018_201, "社交客户端已存在配置");
124 124  
125 125 // ========== 系统敏感词 1-002-019-000 =========
126 126 ErrorCode SENSITIVE_WORD_NOT_EXISTS = new ErrorCode(1_002_019_000, "系统敏感词在所有标签中都不存在");
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/socail/SocialUserController.java
... ... @@ -7,7 +7,6 @@ import cn.iocoder.yudao.module.system.controller.admin.socail.vo.SocialUserBindR
7 7 import cn.iocoder.yudao.module.system.controller.admin.socail.vo.SocialUserUnbindReqVO;
8 8 import cn.iocoder.yudao.module.system.controller.admin.socail.vo.user.SocialUserPageReqVO;
9 9 import cn.iocoder.yudao.module.system.controller.admin.socail.vo.user.SocialUserRespVO;
10   -import cn.iocoder.yudao.module.system.controller.admin.socail.vo.user.SocialUserUpdateReqVO;
11 10 import cn.iocoder.yudao.module.system.convert.social.SocialUserConvert;
12 11 import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO;
13 12 import cn.iocoder.yudao.module.system.service.social.SocialUserService;
... ... @@ -49,23 +48,6 @@ public class SocialUserController {
49 48  
50 49 // ==================== 社交用户 CRUD ====================
51 50  
52   - @PutMapping("/update")
53   - @Operation(summary = "更新社交用户")
54   - @PreAuthorize("@ss.hasPermission('system:social-user:update')")
55   - public CommonResult<Boolean> updateSocialUser(@Valid @RequestBody SocialUserUpdateReqVO updateReqVO) {
56   - socialUserService.updateSocialUser(updateReqVO);
57   - return success(true);
58   - }
59   -
60   - @DeleteMapping("/delete")
61   - @Operation(summary = "删除社交用户")
62   - @Parameter(name = "id", description = "编号", required = true)
63   - @PreAuthorize("@ss.hasPermission('system:social-user:delete')")
64   - public CommonResult<Boolean> deleteSocialUser(@RequestParam("id") Long id) {
65   - socialUserService.deleteSocialUser(id);
66   - return success(true);
67   - }
68   -
69 51 @GetMapping("/get")
70 52 @Operation(summary = "获得社交用户")
71 53 @Parameter(name = "id", description = "编号", required = true, example = "1024")
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/socail/vo/client/SocialClientBaseVO.java
1 1 package cn.iocoder.yudao.module.system.controller.admin.socail.vo.client;
2 2  
  3 +import cn.hutool.core.util.StrUtil;
  4 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
  5 +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
  6 +import cn.iocoder.yudao.framework.common.validation.InEnum;
  7 +import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
  8 +import com.fasterxml.jackson.annotation.JsonIgnore;
3 9 import io.swagger.v3.oas.annotations.media.Schema;
4 10 import lombok.Data;
5 11  
  12 +import javax.validation.constraints.AssertTrue;
6 13 import javax.validation.constraints.NotNull;
  14 +import java.util.Objects;
7 15  
8 16 /**
9 17 * 社交客户端 Base VO,提供给添加、修改、详细的子 VO 使用
... ... @@ -18,10 +26,12 @@ public class SocialClientBaseVO {
18 26  
19 27 @Schema(description = "社交平台的类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "31")
20 28 @NotNull(message = "社交平台的类型不能为空")
  29 + @InEnum(SocialTypeEnum.class)
21 30 private Integer socialType;
22 31  
23 32 @Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
24 33 @NotNull(message = "用户类型不能为空")
  34 + @InEnum(UserTypeEnum.class)
25 35 private Integer userType;
26 36  
27 37 @Schema(description = "客户端编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "wwd411c69a39ad2e54")
... ... @@ -37,6 +47,19 @@ public class SocialClientBaseVO {
37 47  
38 48 @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
39 49 @NotNull(message = "状态不能为空")
  50 + @InEnum(CommonStatusEnum.class)
40 51 private Integer status;
41 52  
  53 + @SuppressWarnings("RedundantIfStatement")
  54 + @AssertTrue(message = "agentId 不能为空")
  55 + @JsonIgnore
  56 + public boolean isAgentIdValid() {
  57 + // 如果是企业微信,必须填写 agentId 属性
  58 + if (Objects.equals(socialType, SocialTypeEnum.WECHAT_ENTERPRISE.getType())
  59 + && StrUtil.isEmpty(agentId)) {
  60 + return false;
  61 + }
  62 + return true;
  63 + }
  64 +
42 65 }
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/socail/vo/client/SocialClientPageReqVO.java
... ... @@ -5,11 +5,6 @@ import io.swagger.v3.oas.annotations.media.Schema;
5 5 import lombok.Data;
6 6 import lombok.EqualsAndHashCode;
7 7 import lombok.ToString;
8   -import org.springframework.format.annotation.DateTimeFormat;
9   -
10   -import java.time.LocalDateTime;
11   -
12   -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
13 8  
14 9 @Schema(description = "管理后台 - 社交客户端分页 Request VO")
15 10 @Data
... ... @@ -29,14 +24,7 @@ public class SocialClientPageReqVO extends PageParam {
29 24 @Schema(description = "客户端编号", example = "145442115")
30 25 private String clientId;
31 26  
32   - @Schema(description = "客户端密钥", example = "215151515154446")
33   - private String clientSecret;
34   -
35 27 @Schema(description = "状态", example = "1")
36 28 private Integer status;
37 29  
38   - @Schema(description = "创建时间")
39   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
40   - private LocalDateTime[] createTime;
41   -
42 30 }
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/socail/vo/user/SocialUserBaseVO.java
... ... @@ -20,10 +20,10 @@ public class SocialUserBaseVO {
20 20 @NotNull(message = "社交 openid不能为空")
21 21 private String openid;
22 22  
23   - @Schema(description = "社交 token", example = "666")
  23 + @Schema(description = "社交 token", requiredMode = Schema.RequiredMode.REQUIRED, example = "666")
24 24 private String token;
25 25  
26   - @Schema(description = "原始 Token 数据,一般是 JSON 格式", example = "{}")
  26 + @Schema(description = "原始 Token 数据,一般是 JSON 格式", requiredMode = Schema.RequiredMode.REQUIRED, example = "{}")
27 27 private String rawTokenInfo;
28 28  
29 29 @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
... ... @@ -33,13 +33,13 @@ public class SocialUserBaseVO {
33 33 @Schema(description = "用户头像", example = "https://www.iocoder.cn/xxx.png")
34 34 private String avatar;
35 35  
36   - @Schema(description = "原始用户数据,一般是 JSON 格式", example = "{}")
  36 + @Schema(description = "原始用户数据,一般是 JSON 格式", requiredMode = Schema.RequiredMode.REQUIRED, example = "{}")
37 37 private String rawUserInfo;
38 38  
39   - @Schema(description = "最后一次的认证 code", example = "666666")
  39 + @Schema(description = "最后一次的认证 code", requiredMode = Schema.RequiredMode.REQUIRED, example = "666666")
40 40 private String code;
41 41  
42   - @Schema(description = "最后一次的认证 state", example = "123456")
  42 + @Schema(description = "最后一次的认证 state", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456")
43 43 private String state;
44 44  
45 45 }
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/socail/vo/user/SocialUserPageReqVO.java
... ... @@ -23,6 +23,9 @@ public class SocialUserPageReqVO extends PageParam {
23 23 @Schema(description = "用户昵称", example = "李四")
24 24 private String nickname;
25 25  
  26 + @Schema(description = "社交 openid", example = "oz-Jdt0kd_jdhUxJHQdBJMlOFN7w\n")
  27 + private String openid;
  28 +
26 29 @Schema(description = "创建时间")
27 30 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
28 31 private LocalDateTime[] createTime;
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/socail/vo/user/SocialUserRespVO.java
... ... @@ -19,4 +19,7 @@ public class SocialUserRespVO extends SocialUserBaseVO {
19 19 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
20 20 private LocalDateTime createTime;
21 21  
  22 + @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
  23 + private LocalDateTime updateTime;
  24 +
22 25 }
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/socail/vo/user/SocialUserUpdateReqVO.java deleted
1   -package cn.iocoder.yudao.module.system.controller.admin.socail.vo.user;
2   -
3   -import io.swagger.v3.oas.annotations.media.Schema;
4   -import lombok.Data;
5   -import lombok.EqualsAndHashCode;
6   -import lombok.ToString;
7   -
8   -import javax.validation.constraints.NotNull;
9   -
10   -@Schema(description = "管理后台 - 社交用户更新 Request VO")
11   -@Data
12   -@EqualsAndHashCode(callSuper = true)
13   -@ToString(callSuper = true)
14   -public class SocialUserUpdateReqVO extends SocialUserBaseVO {
15   -
16   - @Schema(description = "主键(自增策略)", requiredMode = Schema.RequiredMode.REQUIRED, example = "14569")
17   - @NotNull(message = "主键(自增策略)不能为空")
18   - private Long id;
19   -
20   -}
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/social/SocialUserConvert.java
... ... @@ -6,7 +6,6 @@ import cn.iocoder.yudao.module.system.api.social.dto.SocialUserUnbindReqDTO;
6 6 import cn.iocoder.yudao.module.system.controller.admin.socail.vo.SocialUserBindReqVO;
7 7 import cn.iocoder.yudao.module.system.controller.admin.socail.vo.SocialUserUnbindReqVO;
8 8 import cn.iocoder.yudao.module.system.controller.admin.socail.vo.user.SocialUserRespVO;
9   -import cn.iocoder.yudao.module.system.controller.admin.socail.vo.user.SocialUserUpdateReqVO;
10 9 import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO;
11 10 import org.mapstruct.Mapper;
12 11 import org.mapstruct.Mapping;
... ... @@ -24,8 +23,6 @@ public interface SocialUserConvert {
24 23  
25 24 SocialUserUnbindReqDTO convert(Long userId, Integer userType, SocialUserUnbindReqVO reqVO);
26 25  
27   - SocialUserDO convert(SocialUserUpdateReqVO bean);
28   -
29 26 SocialUserRespVO convert(SocialUserDO bean);
30 27  
31 28 List<SocialUserRespVO> convertList(List<SocialUserDO> list);
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/social/SocialClientDO.java
... ... @@ -64,8 +64,12 @@ public class SocialClientDO extends TenantBaseDO {
64 64 * 客户端 Secret
65 65 */
66 66 private String clientSecret;
  67 +
67 68 /**
68   - * 授权方的网页应用 ID
  69 + * 代理编号
  70 + *
  71 + * 目前只有部分“社交类型”在使用:
  72 + * 1. 企业微信:对应授权方的网页应用 ID
69 73 */
70 74 private String agentId;
71 75  
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/social/SocialClientMapper.java
... ... @@ -21,9 +21,7 @@ public interface SocialClientMapper extends BaseMapperX&lt;SocialClientDO&gt; {
21 21 .eqIfPresent(SocialClientDO::getSocialType, reqVO.getSocialType())
22 22 .eqIfPresent(SocialClientDO::getUserType, reqVO.getUserType())
23 23 .eqIfPresent(SocialClientDO::getClientId, reqVO.getClientId())
24   - .eqIfPresent(SocialClientDO::getClientSecret, reqVO.getClientSecret())
25 24 .eqIfPresent(SocialClientDO::getStatus, reqVO.getStatus())
26   - .betweenIfPresent(SocialClientDO::getCreateTime, reqVO.getCreateTime())
27 25 .orderByDesc(SocialClientDO::getId));
28 26 }
29 27  
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/social/SocialUserMapper.java
... ... @@ -28,6 +28,7 @@ public interface SocialUserMapper extends BaseMapperX&lt;SocialUserDO&gt; {
28 28 return selectPage(reqVO, new LambdaQueryWrapperX<SocialUserDO>()
29 29 .eqIfPresent(SocialUserDO::getType, reqVO.getType())
30 30 .likeIfPresent(SocialUserDO::getNickname, reqVO.getNickname())
  31 + .likeIfPresent(SocialUserDO::getOpenid, reqVO.getOpenid())
31 32 .betweenIfPresent(SocialUserDO::getCreateTime, reqVO.getCreateTime())
32 33 .orderByDesc(SocialUserDO::getId));
33 34 }
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientService.java
... ... @@ -11,8 +11,6 @@ import com.xingyuv.jushauth.model.AuthUser;
11 11 import me.chanjar.weixin.common.bean.WxJsapiSignature;
12 12  
13 13 import javax.validation.Valid;
14   -import java.util.Collection;
15   -import java.util.List;
16 14  
17 15 /**
18 16 * 社交应用 Service 接口
... ... @@ -97,14 +95,6 @@ public interface SocialClientService {
97 95 SocialClientDO getSocialClient(Long id);
98 96  
99 97 /**
100   - * 获得社交客户端列表
101   - *
102   - * @param ids 编号
103   - * @return 社交客户端列表
104   - */
105   - List<SocialClientDO> getSocialClientList(Collection<Long> ids);
106   -
107   - /**
108 98 * 获得社交客户端分页
109 99 *
110 100 * @param pageReqVO 分页查询
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java
... ... @@ -5,9 +5,8 @@ import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
5 5 import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
6 6 import cn.binarywang.wx.miniapp.config.impl.WxMaRedisBetterConfigImpl;
7 7 import cn.hutool.core.bean.BeanUtil;
8   -import cn.hutool.core.collection.CollUtil;
9   -import cn.hutool.core.collection.ListUtil;
10 8 import cn.hutool.core.lang.Assert;
  9 +import cn.hutool.core.util.ObjUtil;
11 10 import cn.hutool.core.util.ReflectUtil;
12 11 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
13 12 import cn.iocoder.yudao.framework.common.pojo.PageResult;
... ... @@ -23,6 +22,7 @@ import cn.iocoder.yudao.module.system.dal.mysql.social.SocialClientMapper;
23 22 import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
24 23 import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaProperties;
25 24 import com.binarywang.spring.starter.wxjava.mp.properties.WxMpProperties;
  25 +import com.google.common.annotations.VisibleForTesting;
26 26 import com.google.common.cache.CacheLoader;
27 27 import com.google.common.cache.LoadingCache;
28 28 import com.xingyuv.jushauth.config.AuthConfig;
... ... @@ -44,8 +44,6 @@ import org.springframework.stereotype.Service;
44 44  
45 45 import javax.annotation.Resource;
46 46 import java.time.Duration;
47   -import java.util.Collection;
48   -import java.util.List;
49 47 import java.util.Objects;
50 48  
51 49 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
... ... @@ -224,7 +222,7 @@ public class SocialClientServiceImpl implements SocialClientService {
224 222 return service.getUserService().getPhoneNoInfo(phoneCode);
225 223 } catch (WxErrorException e) {
226 224 log.error("[getPhoneNoInfo][userType({}) phoneCode({}) 获得手机号失败]", userType, phoneCode, e);
227   - throw exception(SOCIAL_APP_WEIXIN_MINI_APP_PHONE_CODE_ERROR);
  225 + throw exception(SOCIAL_CLIENT_WEIXIN_MINI_APP_PHONE_CODE_ERROR);
228 226 }
229 227 }
230 228  
... ... @@ -270,6 +268,9 @@ public class SocialClientServiceImpl implements SocialClientService {
270 268  
271 269 @Override
272 270 public Long createSocialClient(SocialClientCreateReqVO createReqVO) {
  271 + // 校验重复
  272 + validateSocialClientUnique(null, createReqVO.getUserType(), createReqVO.getSocialType());
  273 +
273 274 // 插入
274 275 SocialClientDO socialClient = SocialClientConvert.INSTANCE.convert(createReqVO);
275 276 socialClientMapper.insert(socialClient);
... ... @@ -281,6 +282,9 @@ public class SocialClientServiceImpl implements SocialClientService {
281 282 public void updateSocialClient(SocialClientUpdateReqVO updateReqVO) {
282 283 // 校验存在
283 284 validateSocialClientExists(updateReqVO.getId());
  285 + // 校验重复
  286 + validateSocialClientUnique(updateReqVO.getId(), updateReqVO.getUserType(), updateReqVO.getSocialType());
  287 +
284 288 // 更新
285 289 SocialClientDO updateObj = SocialClientConvert.INSTANCE.convert(updateReqVO);
286 290 socialClientMapper.updateById(updateObj);
... ... @@ -300,17 +304,31 @@ public class SocialClientServiceImpl implements SocialClientService {
300 304 }
301 305 }
302 306  
303   - @Override
304   - public SocialClientDO getSocialClient(Long id) {
305   - return socialClientMapper.selectById(id);
  307 + /**
  308 + * 校验社交应用是否重复,需要保证 userType + socialType 唯一
  309 + *
  310 + * 原因是,不同端(userType)选择某个社交登录(socialType)时,需要通过 {@link #buildAuthRequest(Integer, Integer)} 构建对应的请求
  311 + *
  312 + * @param id 编号
  313 + * @param userType 用户类型
  314 + * @param socialType 社交类型
  315 + */
  316 + @VisibleForTesting
  317 + private void validateSocialClientUnique(Long id, Integer userType, Integer socialType) {
  318 + SocialClientDO client = socialClientMapper.selectBySocialTypeAndUserType(
  319 + socialType, userType);
  320 + if (client == null) {
  321 + return;
  322 + }
  323 + if (id == null // 新增时,说明重复
  324 + || ObjUtil.notEqual(id, client.getId())) { // 更新时,如果 id 不一致,说明重复
  325 + throw exception(SOCIAL_CLIENT_UNIQUE);
  326 + }
306 327 }
307 328  
308 329 @Override
309   - public List<SocialClientDO> getSocialClientList(Collection<Long> ids) {
310   - if (CollUtil.isEmpty(ids)) {
311   - return ListUtil.empty();
312   - }
313   - return socialClientMapper.selectBatchIds(ids);
  330 + public SocialClientDO getSocialClient(Long id) {
  331 + return socialClientMapper.selectById(id);
314 332 }
315 333  
316 334 @Override
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserService.java
... ... @@ -5,12 +5,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 5 import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO;
6 6 import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO;
7 7 import cn.iocoder.yudao.module.system.controller.admin.socail.vo.user.SocialUserPageReqVO;
8   -import cn.iocoder.yudao.module.system.controller.admin.socail.vo.user.SocialUserUpdateReqVO;
9 8 import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO;
10 9 import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
11 10  
12 11 import javax.validation.Valid;
13   -import java.util.Collection;
14 12 import java.util.List;
15 13  
16 14 /**
... ... @@ -63,20 +61,6 @@ public interface SocialUserService {
63 61 // ==================== 社交用户 CRUD ====================
64 62  
65 63 /**
66   - * 更新社交用户
67   - *
68   - * @param updateReqVO 更新信息
69   - */
70   - void updateSocialUser(@Valid SocialUserUpdateReqVO updateReqVO);
71   -
72   - /**
73   - * 删除社交用户
74   - *
75   - * @param id 编号
76   - */
77   - void deleteSocialUser(Long id);
78   -
79   - /**
80 64 * 获得社交用户
81 65 *
82 66 * @param id 编号
... ... @@ -85,14 +69,6 @@ public interface SocialUserService {
85 69 SocialUserDO getSocialUser(Long id);
86 70  
87 71 /**
88   - * 获得社交用户列表
89   - *
90   - * @param ids 编号
91   - * @return 社交用户列表
92   - */
93   - List<SocialUserDO> getSocialUserList(Collection<Long> ids);
94   -
95   - /**
96 72 * 获得社交用户分页
97 73 *
98 74 * @param pageReqVO 分页查询
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImpl.java
... ... @@ -8,7 +8,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
8 8 import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO;
9 9 import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO;
10 10 import cn.iocoder.yudao.module.system.controller.admin.socail.vo.user.SocialUserPageReqVO;
11   -import cn.iocoder.yudao.module.system.controller.admin.socail.vo.user.SocialUserUpdateReqVO;
12 11 import cn.iocoder.yudao.module.system.convert.social.SocialUserConvert;
13 12 import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserBindDO;
14 13 import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO;
... ... @@ -154,42 +153,11 @@ public class SocialUserServiceImpl implements SocialUserService {
154 153 // ==================== 社交用户 CRUD ====================
155 154  
156 155 @Override
157   - public void updateSocialUser(SocialUserUpdateReqVO updateReqVO) {
158   - // 校验存在
159   - validateSocialUserExists(updateReqVO.getId());
160   - // 更新
161   - SocialUserDO updateObj = SocialUserConvert.INSTANCE.convert(updateReqVO);
162   - socialUserMapper.updateById(updateObj);
163   - }
164   -
165   - @Override
166   - public void deleteSocialUser(Long id) {
167   - // 校验存在
168   - validateSocialUserExists(id);
169   - // 删除
170   - socialUserMapper.deleteById(id);
171   - }
172   -
173   - private void validateSocialUserExists(Long id) {
174   - if (socialUserMapper.selectById(id) == null) {
175   - throw exception(SOCIAL_USER_NOT_EXISTS);
176   - }
177   - }
178   -
179   - @Override
180 156 public SocialUserDO getSocialUser(Long id) {
181 157 return socialUserMapper.selectById(id);
182 158 }
183 159  
184 160 @Override
185   - public List<SocialUserDO> getSocialUserList(Collection<Long> ids) {
186   - if (CollUtil.isEmpty(ids)) {
187   - return ListUtil.empty();
188   - }
189   - return socialUserMapper.selectBatchIds(ids);
190   - }
191   -
192   - @Override
193 161 public PageResult<SocialUserDO> getSocialUserPage(SocialUserPageReqVO pageReqVO) {
194 162 return socialUserMapper.selectPage(pageReqVO);
195 163 }
... ...
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImplTest.java
... ... @@ -13,7 +13,6 @@ import org.springframework.context.annotation.Import;
13 13  
14 14 import javax.annotation.Resource;
15 15  
16   -import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
17 16 import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
18 17 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
19 18 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
... ... @@ -22,6 +21,7 @@ import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
22 21 import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.SOCIAL_CLIENT_NOT_EXISTS;
23 22 import static org.junit.jupiter.api.Assertions.*;
24 23  
  24 +// TODO 芋艿:单测后续补充下;
25 25 /**
26 26 * {@link SocialClientServiceImpl} 的单元测试类
27 27 *
... ... @@ -133,9 +133,7 @@ public class SocialClientServiceImplTest extends BaseDbUnitTest {
133 133 reqVO.setSocialType(null);
134 134 reqVO.setUserType(null);
135 135 reqVO.setClientId(null);
136   - reqVO.setClientSecret(null);
137 136 reqVO.setStatus(null);
138   - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
139 137  
140 138 // 调用
141 139 PageResult<SocialClientDO> pageResult = socialClientService.getSocialClientPage(reqVO);
... ...