Merge branch 'upstream/master'

# Conflicts:
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/dept/UserPostDO.java
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/UserPostMapper.java
This commit is contained in:
anzhen
2022-04-27 22:17:43 +08:00
1067 changed files with 14352 additions and 12149 deletions

View File

@@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<modules>
<module>yudao-module-system-api</module>
<module>yudao-module-system-impl</module>
<module>yudao-module-system-biz</module>
</modules>
<artifactId>yudao-module-system</artifactId>
<packaging>pom</packaging>

View File

@@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.system.api.sensitiveword;
import java.util.List;
/**
* 敏感词 API 接口
*
* @author 永不言败
*/
public interface SensitiveWordApi {
/**
* 获得文本所包含的不合法的敏感词数组
*
* @param text 文本
* @param tags 标签数组
* @return 不合法的敏感词数组
*/
List<String> validateText(String text, List<String> tags);
/**
* 判断文本是否包含敏感词
*
* @param text 文本
* @param tags 表述数组
* @return 是否包含
*/
boolean isTextValid(String text, List<String> tags);
}

View File

@@ -18,7 +18,6 @@ public class SmsSendSingleToUserReqDTO {
/**
* 用户编号
*/
@NotNull(message = "用户编号不能为空")
private Long userId;
/**
* 手机号

View File

@@ -37,21 +37,10 @@ public interface SocialUserApi {
*/
void unbindSocialUser(@Valid SocialUserUnbindReqDTO reqDTO);
/**
* 校验社交用户的认证信息是否正确
* 如果校验不通过,则抛出 {@link ServiceException} 业务异常
*
* @param type 社交平台的类型
* @param code 授权码
* @param state state
*/
void checkSocialUser(Integer type, String code, String state);
/**
* 获得社交用户的绑定用户编号
* 注意,返回的是 MemberUser 或者 AdminUser 的 id 编号!
* 该方法会执行和 {@link #checkSocialUser(Integer, String, String)} 一样的逻辑。
* 所以在认证信息不正确的情况下,也会抛出 {@link ServiceException} 业务异常
* 在认证信息不正确的情况下,也会抛出 {@link ServiceException} 业务异常
*
* @param userType 用户类型
* @param type 社交平台的类型

View File

@@ -119,4 +119,8 @@ public interface ErrorCodeConstants {
ErrorCode SOCIAL_USER_UNBIND_NOT_SELF = new ErrorCode(1002018001, "社交解绑失败,非当前用户绑定");
ErrorCode SOCIAL_USER_NOT_FOUND = new ErrorCode(1002018002, "社交授权失败,找不到对应的用户");
// ========== 系统铭感词 1002019000 =========
ErrorCode SENSITIVE_WORD_NOT_EXISTS = new ErrorCode(1002019000, "系统敏感词在所有标签中都不存在");
ErrorCode SENSITIVE_WORD_EXISTS = new ErrorCode(1002019001, "系统敏感词已在标签中存在");
}

View File

@@ -1,13 +1,14 @@
package cn.iocoder.yudao.module.system.enums.social;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.List;
import java.util.Collection;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 社交平台的类型枚举
@@ -53,9 +54,6 @@ public enum SocialTypeEnum implements IntArrayValuable {
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(SocialTypeEnum::getType).toArray();
public static final List<Integer> WECHAT_ALL = ListUtil.toList(WECHAT_ENTERPRISE.type, WECHAT_MP.type, WECHAT_OPEN.type,
WECHAT_MINI_PROGRAM.type);
/**
* 类型
*/
@@ -74,11 +72,4 @@ public enum SocialTypeEnum implements IntArrayValuable {
return ArrayUtil.firstMatch(o -> o.getType().equals(type), values());
}
public static List<Integer> getRelationTypes(Integer type) {
if (WECHAT_ALL.contains(type)) {
return WECHAT_ALL;
}
return ListUtil.toList(type);
}
}

View File

@@ -8,7 +8,7 @@
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yudao-module-system-impl</artifactId>
<artifactId>yudao-module-system-biz</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
@@ -23,11 +23,6 @@
<artifactId>yudao-module-system-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-member-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-infra-api</artifactId>

View File

@@ -0,0 +1,29 @@
package cn.iocoder.yudao.module.system.api.sensitiveword;
import cn.iocoder.yudao.module.system.service.sensitiveword.SensitiveWordService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 敏感词 API 实现类
*
* @author 永不言败
*/
@Service
public class SensitiveWordApiImpl implements SensitiveWordApi {
@Resource
private SensitiveWordService sensitiveWordService;
@Override
public List<String> validateText(String text, List<String> tags) {
return sensitiveWordService.validateText(text, tags);
}
@Override
public boolean isTextValid(String text, List<String> tags) {
return sensitiveWordService.isTextValid(text, tags);
}
}

View File

@@ -36,11 +36,6 @@ public class SocialUserApiImpl implements SocialUserApi {
reqDTO.getType(), reqDTO.getUnionId());
}
@Override
public void checkSocialUser(Integer type, String code, String state) {
socialUserService.checkSocialUser(type, code, state);
}
@Override
public Long getBindUserId(Integer userType, Integer type, String code, String state) {
return socialUserService.getBindUserId(userType, type, code, state);

View File

@@ -36,7 +36,7 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti
@Api(tags = "管理后台 - 认证")
@RestController
@RequestMapping("/system") // 暂时不跟 /auth 结尾
@RequestMapping("/system/auth") // 暂时不跟 /auth 结尾
@Validated
@Slf4j
public class AuthController {
@@ -80,7 +80,7 @@ public class AuthController {
return success(AuthConvert.INSTANCE.convert(user, roleList, menuList));
}
@GetMapping("list-menus")
@GetMapping("/list-menus")
@ApiOperation("获得登录用户的菜单列表")
public CommonResult<List<AuthMenuRespVO>> getMenus() {
// 获得用户拥有的菜单列表
@@ -105,36 +105,22 @@ public class AuthController {
return CommonResult.success(socialUserService.getAuthorizeUrl(type, redirectUri));
}
@PostMapping("/social-login")
@ApiOperation("社交登录,使用 code 授权码")
@PostMapping("/social-quick-login")
@ApiOperation("社交快捷登录,使用 code 授权码")
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
public CommonResult<AuthLoginRespVO> socialLogin(@RequestBody @Valid AuthSocialLoginReqVO reqVO) {
public CommonResult<AuthLoginRespVO> socialQuickLogin(@RequestBody @Valid AuthSocialQuickLoginReqVO reqVO) {
String token = authService.socialLogin(reqVO, getClientIP(), getUserAgent());
// 返回结果
return success(AuthLoginRespVO.builder().token(token).build());
}
@PostMapping("/social-login2")
@ApiOperation("社交登录,使用 code 授权码 + 账号密码")
@PostMapping("/social-bind-login")
@ApiOperation("社交绑定登录,使用 code 授权码 + 账号密码")
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
public CommonResult<AuthLoginRespVO> socialLogin2(@RequestBody @Valid AuthSocialLogin2ReqVO reqVO) {
String token = authService.socialLogin2(reqVO, getClientIP(), getUserAgent());
public CommonResult<AuthLoginRespVO> socialBindLogin(@RequestBody @Valid AuthSocialBindLoginReqVO reqVO) {
String token = authService.socialBindLogin(reqVO, getClientIP(), getUserAgent());
// 返回结果
return success(AuthLoginRespVO.builder().token(token).build());
}
@PostMapping("/social-bind")
@ApiOperation("社交绑定,使用 code 授权码")
public CommonResult<Boolean> socialBind(@RequestBody @Valid AuthSocialBindReqVO reqVO) {
authService.socialBind(getLoginUserId(), reqVO);
return CommonResult.success(true);
}
@DeleteMapping("/social-unbind")
@ApiOperation("取消社交绑定")
public CommonResult<Boolean> socialUnbind(@RequestBody AuthSocialUnbindReqVO reqVO) {
socialUserService.unbindSocialUser(getLoginUserId(), UserTypeEnum.ADMIN.getValue(), reqVO.getType(), reqVO.getUnionId());
return CommonResult.success(true);
}
}

View File

@@ -34,6 +34,12 @@ public class AuthMenuRespVO {
@ApiModelProperty(value = "菜单图标", example = "/menu/list", notes = "仅菜单类型为菜单或者目录时,才需要传")
private String icon;
@ApiModelProperty(value = "是否可见", required = true, example = "false")
private Boolean visible;
@ApiModelProperty(value = "是否缓存", required = true, example = "false")
private Boolean keepAlive;
/**
* 子路由
*/

View File

@@ -14,12 +14,12 @@ import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
@ApiModel("管理后台 - 社交登录 Request VO使用 code 授权码 + 账号密码")
@ApiModel("管理后台 - 社交绑定登录 Request VO使用 code 授权码 + 账号密码")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class AuthSocialLogin2ReqVO {
public class AuthSocialBindLoginReqVO {
@ApiModelProperty(value = "社交平台的类型", required = true, example = "10", notes = "参见 UserSocialTypeEnum 枚举值")
@InEnum(SocialTypeEnum.class)

View File

@@ -12,12 +12,12 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("管理后台 - 社交登录 Request VO使用 code 授权码")
@ApiModel("管理后台 - 社交快捷登录 Request VO使用 code 授权码")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class AuthSocialLoginReqVO {
public class AuthSocialQuickLoginReqVO {
@ApiModelProperty(value = "社交平台的类型", required = true, example = "10", notes = "参见 UserSocialTypeEnum 枚举值")
@InEnum(SocialTypeEnum.class)

View File

@@ -19,7 +19,7 @@ public class NoticeBaseVO {
@Size(max = 50, message = "公告标题不能超过50个字符")
private String title;
@ApiModelProperty(value = "公告标题", required = true, example = "小博主")
@ApiModelProperty(value = "公告类型", required = true, example = "小博主")
@NotNull(message = "公告类型不能为空")
private Integer type;

View File

@@ -35,7 +35,6 @@ public class PermissionController {
@Resource
private TenantService tenantService;
@ApiOperation("获得角色拥有的菜单编号")
@ApiImplicitParam(name = "roleId", value = "角色编号", required = true, dataTypeClass = Long.class)
@GetMapping("/list-role-resources")

Some files were not shown because too many files have changed in this diff Show More