完成 AdminUserApi、SocialUserApi 的 feign 支持
This commit is contained in:
@@ -1,19 +1,21 @@
|
||||
package cn.iocoder.yudao.module.system.api.social;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserUnbindReqDTO;
|
||||
import cn.iocoder.yudao.module.system.service.social.SocialUserService;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 社交用户的 API 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.module.system.enums.ApiConstants.VERSION;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@DubboService(version = VERSION) // 提供 Dubbo RPC 接口,给 Dubbo Consumer 调用
|
||||
@Validated
|
||||
public class SocialUserApiImpl implements SocialUserApi {
|
||||
|
||||
@@ -21,24 +23,26 @@ public class SocialUserApiImpl implements SocialUserApi {
|
||||
private SocialUserService socialUserService;
|
||||
|
||||
@Override
|
||||
public String getAuthorizeUrl(Integer type, String redirectUri) {
|
||||
return socialUserService.getAuthorizeUrl(type, redirectUri);
|
||||
public CommonResult<String> getAuthorizeUrl(Integer type, String redirectUri) {
|
||||
return success(socialUserService.getAuthorizeUrl(type, redirectUri));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindSocialUser(SocialUserBindReqDTO reqDTO) {
|
||||
public CommonResult<Boolean> bindSocialUser(SocialUserBindReqDTO reqDTO) {
|
||||
socialUserService.bindSocialUser(reqDTO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unbindSocialUser(SocialUserUnbindReqDTO reqDTO) {
|
||||
public CommonResult<Boolean> unbindSocialUser(SocialUserUnbindReqDTO reqDTO) {
|
||||
socialUserService.unbindSocialUser(reqDTO.getUserId(), reqDTO.getUserType(),
|
||||
reqDTO.getType(), reqDTO.getUnionId());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getBindUserId(Integer userType, Integer type, String code, String state) {
|
||||
return socialUserService.getBindUserId(userType, type, code, state);
|
||||
public CommonResult<Long> getBindUserId(Integer userType, Integer type, String code, String state) {
|
||||
return success(socialUserService.getBindUserId(userType, type, code, state));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.system.api.user;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import cn.iocoder.yudao.module.system.convert.user.UserConvert;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
@@ -14,13 +15,9 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.module.system.enums.ApiConstants.VERSION;
|
||||
|
||||
/**
|
||||
* Admin 用户 API 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@DubboService(version = VERSION) // 提供 Dubbo RPC 接口,给 Dubbo Consumer 调用
|
||||
@Validated
|
||||
@@ -30,32 +27,33 @@ public class AdminUserApiImpl implements AdminUserApi {
|
||||
private AdminUserService userService;
|
||||
|
||||
@Override
|
||||
public AdminUserRespDTO getUser(Long id) {
|
||||
public CommonResult<AdminUserRespDTO> getUser(Long id) {
|
||||
AdminUserDO user = userService.getUser(id);
|
||||
return UserConvert.INSTANCE.convert4(user);
|
||||
return success(UserConvert.INSTANCE.convert4(user));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdminUserRespDTO> getUsers(Collection<Long> ids) {
|
||||
public CommonResult<List<AdminUserRespDTO>> getUsers(Collection<Long> ids) {
|
||||
List<AdminUserDO> users = userService.getUsers(ids);
|
||||
return UserConvert.INSTANCE.convertList4(users);
|
||||
return success(UserConvert.INSTANCE.convertList4(users));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdminUserRespDTO> getUsersByDeptIds(Collection<Long> deptIds) {
|
||||
public CommonResult<List<AdminUserRespDTO>> getUsersByDeptIds(Collection<Long> deptIds) {
|
||||
List<AdminUserDO> users = userService.getUsersByDeptIds(deptIds);
|
||||
return UserConvert.INSTANCE.convertList4(users);
|
||||
return success(UserConvert.INSTANCE.convertList4(users));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdminUserRespDTO> getUsersByPostIds(Collection<Long> postIds) {
|
||||
public CommonResult<List<AdminUserRespDTO>> getUsersByPostIds(Collection<Long> postIds) {
|
||||
List<AdminUserDO> users = userService.getUsersByPostIds(postIds);
|
||||
return UserConvert.INSTANCE.convertList4(users);
|
||||
return success(UserConvert.INSTANCE.convertList4(users));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validUsers(Set<Long> ids) {
|
||||
public CommonResult<Boolean> validUsers(Set<Long> ids) {
|
||||
userService.validUsers(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user