【同步】与 yudao-boot 版本保持一致!

This commit is contained in:
YunaiV
2024-04-22 21:01:30 +08:00
parent a5aeca4d49
commit feb742e084
193 changed files with 3245 additions and 3750 deletions

View File

@@ -1,45 +0,0 @@
package cn.iocoder.yudao.module.system.api.errorcode;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.system.api.errorcode.dto.ErrorCodeAutoGenerateReqDTO;
import cn.iocoder.yudao.module.system.api.errorcode.dto.ErrorCodeRespDTO;
import cn.iocoder.yudao.module.system.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import jakarta.validation.Valid;
import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 错误码")
public interface ErrorCodeApi {
String PREFIX = ApiConstants.PREFIX + "/error-code";
@PostMapping(PREFIX + "/auto-generate")
@Operation(summary = "自动创建错误码")
CommonResult<Boolean> autoGenerateErrorCodeList(@Valid @RequestBody List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs);
@GetMapping(PREFIX + "/list")
@Operation(summary = "增量获得错误码数组", description = "如果 minUpdateTime 为空时,则获取所有错误码")
@Parameters({
@Parameter(name = "applicationName", description = "应用名", example = "system-server", required = true),
@Parameter(name = "minUpdateTime", description = "最小更新时间")
})
CommonResult<List<ErrorCodeRespDTO>> getErrorCodeList(
@RequestParam(value = "applicationName") String applicationName,
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@RequestParam(value = "minUpdateTime", required = false) LocalDateTime minUpdateTime);
}

View File

@@ -1,25 +0,0 @@
package cn.iocoder.yudao.module.system.api.errorcode.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
@Schema(description = "RPC 服务 - 错误码自动生成 Request DTO")
@Data
public class ErrorCodeAutoGenerateReqDTO {
@Schema(description = "应用名", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudao")
@NotNull(message = "应用名不能为空")
private String applicationName;
@Schema(description = "错误码编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000")
@NotNull(message = "错误码编码不能为空")
private Integer code;
@Schema(description = "错误码错误提示", requiredMode = Schema.RequiredMode.REQUIRED, example = "业务不能为空")
@NotEmpty(message = "错误码错误提示不能为空")
private String message;
}

View File

@@ -1,28 +0,0 @@
package cn.iocoder.yudao.module.system.api.errorcode.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "RPC 服务 - 错误码 Response DTO")
@Data
public class ErrorCodeRespDTO {
/**
* 错误码编码
*/
@Schema(description = "错误码编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000")
private Integer code;
/**
* 错误码错误提示
*/
@Schema(description = "错误码错误提示", requiredMode = Schema.RequiredMode.REQUIRED, example = "业务不能为空")
private String message;
/**
* 更新时间
*/
@Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime updateTime;
}

View File

@@ -1,39 +0,0 @@
package cn.iocoder.yudao.module.system.api.sensitiveword;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.system.enums.ApiConstants;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFacx`tory =
@Tag(name = "RPC 服务 - 敏感词")
public interface SensitiveWordApi {
String PREFIX = ApiConstants.PREFIX + "/sensitive-word";
@GetMapping(PREFIX + "/validate-text")
@Operation(summary = "获得文本所包含的不合法的敏感词数组")
@Parameters({
@Parameter(name = "text", description = "文本", example = "傻瓜", required = true),
@Parameter(name = "tags", description = "标签数组", example = "product,life", required = true)
})
CommonResult<List<String>> validateText(@RequestParam("text") String text,
@RequestParam("tags") List<String> tags);
@GetMapping(PREFIX + "/is-text-valid")
@Operation(summary = "判断文本是否包含敏感词")
@Parameters({
@Parameter(name = "text", description = "文本", example = "傻瓜", required = true),
@Parameter(name = "tags", description = "标签数组", example = "product,life", required = true)
})
CommonResult<Boolean> isTextValid(@RequestParam("text") String text,
@RequestParam("tags") List<String> tags);
}

View File

@@ -115,10 +115,6 @@ public interface ErrorCodeConstants {
ErrorCode TENANT_PACKAGE_USED = new ErrorCode(1_002_016_001, "租户正在使用该套餐,请给租户重新设置套餐后再尝试删除");
ErrorCode TENANT_PACKAGE_DISABLE = new ErrorCode(1_002_016_002, "名字为【{}】的租户套餐已被禁用");
// ========== 错误码模块 1-002-017-000 ==========
ErrorCode ERROR_CODE_NOT_EXISTS = new ErrorCode(1_002_017_000, "错误码不存在");
ErrorCode ERROR_CODE_DUPLICATE = new ErrorCode(1_002_017_001, "已经存在编码为【{}】的错误码");
// ========== 社交用户 1-002-018-000 ==========
ErrorCode SOCIAL_USER_AUTH_FAILURE = new ErrorCode(1_002_018_000, "社交授权失败,原因是:{}");
ErrorCode SOCIAL_USER_NOT_FOUND = new ErrorCode(1_002_018_001, "社交授权失败,找不到对应的用户");
@@ -127,10 +123,6 @@ public interface ErrorCodeConstants {
ErrorCode SOCIAL_CLIENT_NOT_EXISTS = new ErrorCode(1_002_018_201, "社交客户端不存在");
ErrorCode SOCIAL_CLIENT_UNIQUE = new ErrorCode(1_002_018_202, "社交客户端已存在配置");
// ========== 系统敏感词 1-002-019-000 =========
ErrorCode SENSITIVE_WORD_NOT_EXISTS = new ErrorCode(1_002_019_000, "系统敏感词在所有标签中都不存在");
ErrorCode SENSITIVE_WORD_EXISTS = new ErrorCode(1_002_019_001, "系统敏感词已在标签中存在");
// ========== OAuth2 客户端 1-002-020-000 =========
ErrorCode OAUTH2_CLIENT_NOT_EXISTS = new ErrorCode(1_002_020_000, "OAuth2 客户端不存在");
ErrorCode OAUTH2_CLIENT_EXISTS = new ErrorCode(1_002_020_001, "OAuth2 客户端编号已存在");

View File

@@ -1,39 +0,0 @@
package cn.iocoder.yudao.module.system.enums.errorcode;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 错误码的类型枚举
*
* @author dylan
*/
@AllArgsConstructor
@Getter
public enum ErrorCodeTypeEnum implements IntArrayValuable {
/**
* 自动生成
*/
AUTO_GENERATION(1),
/**
* 手动编辑
*/
MANUAL_OPERATION(2);
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ErrorCodeTypeEnum::getType).toArray();
/**
* 类型
*/
private final Integer type;
@Override
public int[] array() {
return ARRAYS;
}
}