删除swagger侵入式代码 , 删除demo

This commit is contained in:
2025-06-04 15:08:06 +08:00
parent 8cbbe932f2
commit f9cfaced05
303 changed files with 16491 additions and 49854 deletions

View File

@@ -22,13 +22,6 @@
<artifactId>tashow-common</artifactId>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>org.springdoc</groupId> <!-- 接口文档:使用最新版本的 Swagger 模型 -->
<artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- 参数校验 -->
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@@ -1,55 +1,46 @@
package com.tashow.cloud.systemapi.api.dept;
import com.tashow.cloud.systemapi.api.dept.dto.DeptRespDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import com.tashow.cloud.common.pojo.CommonResult;
import com.tashow.cloud.common.util.collection.CollectionUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.tashow.cloud.systemapi.api.dept.dto.DeptRespDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 部门")
/** RPC 服务 - 部门 */
public interface DeptApi {
String PREFIX = ApiConstants.PREFIX + "/dept";
String PREFIX = ApiConstants.PREFIX + "/dept";
@GetMapping(PREFIX + "/get")
@Operation(summary = "获得部门信息")
@Parameter(name = "id", description = "部门编号", example = "1024", required = true)
CommonResult<DeptRespDTO> getDept(@RequestParam("id") Long id);
@GetMapping(PREFIX + "/get")
/** 获得部门信息 */
CommonResult<DeptRespDTO> getDept(@RequestParam("id") Long id);
@GetMapping(PREFIX + "/list")
@Operation(summary = "获得部门信息数组")
@Parameter(name = "ids", description = "部门编号数组", example = "1,2", required = true)
CommonResult<List<DeptRespDTO>> getDeptList(@RequestParam("ids") Collection<Long> ids);
@GetMapping(PREFIX + "/list")
/** 获得部门信息数组 */
CommonResult<List<DeptRespDTO>> getDeptList(@RequestParam("ids") Collection<Long> ids);
@GetMapping(PREFIX + "/valid")
@Operation(summary = "校验部门是否合法")
@Parameter(name = "ids", description = "部门编号数组", example = "1,2", required = true)
CommonResult<Boolean> validateDeptList(@RequestParam("ids") Collection<Long> ids);
@GetMapping(PREFIX + "/valid")
/** 校验部门是否合法 */
CommonResult<Boolean> validateDeptList(@RequestParam("ids") Collection<Long> ids);
/**
* 获得指定编号的部门 Map
*
* @param ids 部门编号数组
* @return 部门 Map
*/
default Map<Long, DeptRespDTO> getDeptMap(Collection<Long> ids) {
List<DeptRespDTO> list = getDeptList(ids).getCheckedData();
return CollectionUtils.convertMap(list, DeptRespDTO::getId);
}
@GetMapping(PREFIX + "/list-child")
@Operation(summary = "获得指定部门的所有子部门")
@Parameter(name = "id", description = "部门编号", example = "1024", required = true)
CommonResult<List<DeptRespDTO>> getChildDeptList(@RequestParam("id") Long id);
/**
* 获得指定编号的部门 Map
*
* @param ids 部门编号数组
* @return 部门 Map
*/
default Map<Long, DeptRespDTO> getDeptMap(Collection<Long> ids) {
List<DeptRespDTO> list = getDeptList(ids).getCheckedData();
return CollectionUtils.convertMap(list, DeptRespDTO::getId);
}
@GetMapping(PREFIX + "/list-child")
/** 获得指定部门的所有子部门 */
CommonResult<List<DeptRespDTO>> getChildDeptList(@RequestParam("id") Long id);
}

View File

@@ -6,44 +6,33 @@ import com.tashow.cloud.common.pojo.CommonResult;
import com.tashow.cloud.common.util.collection.CollectionUtils;
import com.tashow.cloud.systemapi.api.dept.dto.PostRespDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import com.tashow.cloud.systemapi.api.dept.dto.PostRespDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import com.tashow.cloud.systemapi.api.dept.dto.PostRespDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 岗位")
/** RPC 服务 - 岗位 */
public interface PostApi {
String PREFIX = ApiConstants.PREFIX + "/post";
String PREFIX = ApiConstants.PREFIX + "/post";
@GetMapping(PREFIX + "/valid")
@Operation(summary = "校验岗位是否合法")
@Parameter(name = "ids", description = "岗位编号数组", example = "1,2", required = true)
CommonResult<Boolean> validPostList(@RequestParam("ids") Collection<Long> ids);
@GetMapping(PREFIX + "/valid")
/** 校验岗位是否合法 */
CommonResult<Boolean> validPostList(@RequestParam("ids") Collection<Long> ids);
@GetMapping(PREFIX + "/list")
@Operation(summary = "获得岗位列表")
@Parameter(name = "ids", description = "岗位编号数组", example = "1,2", required = true)
CommonResult<List<PostRespDTO>> getPostList(@RequestParam("ids") Collection<Long> ids);
@GetMapping(PREFIX + "/list")
/** 获得岗位列表 */
CommonResult<List<PostRespDTO>> getPostList(@RequestParam("ids") Collection<Long> ids);
default Map<Long, PostRespDTO> getPostMap(Collection<Long> ids) {
if (CollUtil.isEmpty(ids)) {
return MapUtil.empty();
}
List<PostRespDTO> list = getPostList(ids).getData();
return CollectionUtils.convertMap(list, PostRespDTO::getId);
default Map<Long, PostRespDTO> getPostMap(Collection<Long> ids) {
if (CollUtil.isEmpty(ids)) {
return MapUtil.empty();
}
List<PostRespDTO> list = getPostList(ids).getData();
return CollectionUtils.convertMap(list, PostRespDTO::getId);
}
}

View File

@@ -1,25 +1,23 @@
package com.tashow.cloud.systemapi.api.dept.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "RPC 服务 - 部门 Response DTO")
/** RPC 服务 - 部门 Response DTO */
@Data
public class DeptRespDTO {
@Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long id;
/** 部门编号" */
private Long id;
@Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "研发部")
private String name;
/** 部门名称", example = "研发部 */
private String name;
@Schema(description = "父部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long parentId;
/** 父部门编号" */
private Long parentId;
@Schema(description = "负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long leaderUserId;
@Schema(description = "部门状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer status; // 参见 CommonStatusEnum 枚举
/** 负责人的用户编号" */
private Long leaderUserId;
/** 部门状态" */
private Integer status; // 参见 CommonStatusEnum 枚举
}

View File

@@ -1,6 +1,5 @@
package com.tashow.cloud.systemapi.api.dept.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
@@ -8,23 +7,22 @@ import lombok.Data;
*
* @author 芋道源码
*/
@Schema(description = "RPC 服务 - 岗位 Response DTO")
/** RPC 服务 - 岗位 Response DTO */
@Data
public class PostRespDTO {
@Schema(description = "岗位编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long id;
/** 岗位编号" */
private Long id;
@Schema(description = "岗位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "小土豆")
private String name;
/** 岗位名称", example = "小土豆 */
private String name;
@Schema(description = "岗位编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudao")
private String code;
/** 岗位编码" */
private String code;
@Schema(description = "岗位排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer sort;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer status; // 参见 CommonStatusEnum 枚举
/** 岗位排序" */
private Integer sort;
/** 状态" */
private Integer status; // 参见 CommonStatusEnum 枚举
}

View File

@@ -1,85 +1,66 @@
package com.tashow.cloud.systemapi.api.dict;
import static com.tashow.cloud.common.util.collection.CollectionUtils.convertList;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import com.tashow.cloud.systemapi.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 com.tashow.cloud.common.pojo.CommonResult;
import com.tashow.cloud.systemapi.api.dict.dto.DictDataRespDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import java.util.Collection;
import java.util.List;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Collection;
import java.util.List;
import static com.tashow.cloud.common.util.collection.CollectionUtils.convertList;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 字典数据")
/** RPC 服务 - 字典数据 */
public interface DictDataApi {
String PREFIX = ApiConstants.PREFIX + "/dict-data";
String PREFIX = ApiConstants.PREFIX + "/dict-data";
@GetMapping(PREFIX + "/valid")
@Operation(summary = "校验字典数据们是否有效")
@Parameters({
@Parameter(name = "dictType", description = "字典类型", example = "SEX", required = true),
@Parameter(name = "descriptions", description = "字典数据值的数组", example = "1,2", required = true)
})
CommonResult<Boolean> validateDictDataList(@RequestParam("dictType") String dictType,
@RequestParam("values") Collection<String> values);
@GetMapping(PREFIX + "/valid")
/** 校验字典数据们是否有效 */
CommonResult<Boolean> validateDictDataList(
@RequestParam("dictType") String dictType, @RequestParam("values") Collection<String> values);
@GetMapping(PREFIX + "/get")
@Operation(summary = "获得指定的字典数据")
@Parameters({
@Parameter(name = "dictType", description = "字典类型", example = "SEX", required = true),
@Parameter(name = "description", description = "字典数据值", example = "1", required = true)
})
CommonResult<DictDataRespDTO> getDictData(@RequestParam("dictType") String dictType,
@RequestParam("value") String value);
@GetMapping(PREFIX + "/get")
/** 获得指定的字典数据 */
CommonResult<DictDataRespDTO> getDictData(
@RequestParam("dictType") String dictType, @RequestParam("value") String value);
/**
* 获得指定的字典标签,从缓存中
*
* @param type 字典类型
* @param value 字典数据值
* @return 字典标签
*/
default String getDictDataLabel(String type, Integer value) {
DictDataRespDTO dictData = getDictData(type, String.valueOf(value)).getData();
if (ObjUtil.isNull(dictData)) {
return StrUtil.EMPTY;
}
return dictData.getLabel();
/**
* 获得指定的字典标签,从缓存中
*
* @param type 字典类型
* @param value 字典数据值
* @return 字典标签
*/
default String getDictDataLabel(String type, Integer value) {
DictDataRespDTO dictData = getDictData(type, String.valueOf(value)).getData();
if (ObjUtil.isNull(dictData)) {
return StrUtil.EMPTY;
}
return dictData.getLabel();
}
@GetMapping(PREFIX + "/parse")
@Operation(summary = "解析获得指定的字典数据")
@Parameters({
@Parameter(name = "dictType", description = "字典类型", example = "SEX", required = true),
@Parameter(name = "label", description = "字典标签", example = "", required = true)
})
CommonResult<DictDataRespDTO> parseDictData(@RequestParam("dictType") String dictType,
@RequestParam("label") String label);
@GetMapping(PREFIX + "/parse")
/** 解析获得指定的字典数据 */
CommonResult<DictDataRespDTO> parseDictData(
@RequestParam("dictType") String dictType, @RequestParam("label") String label);
@GetMapping(PREFIX + "/list")
@Operation(summary = "获得指定字典类型的字典数据列表")
@Parameter(name = "dictType", description = "字典类型", example = "SEX", required = true)
CommonResult<List<DictDataRespDTO>> getDictDataList(@RequestParam("dictType") String dictType);
/**
* 获得字典数据标签列表
*
* @param dictType 字典类型
* @return 字典数据标签列表
*/
default List<String> getDictDataLabelList(String dictType) {
List<DictDataRespDTO> list = getDictDataList(dictType).getData();
return convertList(list, DictDataRespDTO::getLabel);
}
@GetMapping(PREFIX + "/list")
/** 获得指定字典类型的字典数据列表 */
CommonResult<List<DictDataRespDTO>> getDictDataList(@RequestParam("dictType") String dictType);
/**
* 获得字典数据标签列表
*
* @param dictType 字典类型
* @return 字典数据标签列表
*/
default List<String> getDictDataLabelList(String dictType) {
List<DictDataRespDTO> list = getDictDataList(dictType).getData();
return convertList(list, DictDataRespDTO::getLabel);
}
}

View File

@@ -1,22 +1,20 @@
package com.tashow.cloud.systemapi.api.dict.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "RPC 服务 - 字典数据 Response DTO")
/** RPC 服务 - 字典数据 Response DTO */
@Data
public class DictDataRespDTO {
@Schema(description = "字典标签", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
private String label;
/** 字典标签", example = "芋道 */
private String label;
@Schema(description = "字典值", requiredMode = Schema.RequiredMode.REQUIRED, example = "iocoder")
private String value;
/** 字典值" */
private String value;
@Schema(description = "字典类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "sys_common_sex")
private String dictType;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer status; // 参见 CommonStatusEnum 枚举
/** 字典类型" */
private String dictType;
/** 状态" */
private Integer status; // 参见 CommonStatusEnum 枚举
}

View File

@@ -3,24 +3,18 @@ package com.tashow.cloud.systemapi.api.logger;
import com.tashow.cloud.common.pojo.CommonResult;
import com.tashow.cloud.systemapi.api.logger.dto.LoginLogCreateReqDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import jakarta.validation.Valid;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 登录日志")
/** RPC 服务 - 登录日志 */
public interface LoginLogApi {
String PREFIX = ApiConstants.PREFIX + "/login-log";
@PostMapping(PREFIX + "/create")
@Operation(summary = "创建登录日志")
CommonResult<Boolean> createLoginLog(@Valid @RequestBody LoginLogCreateReqDTO reqDTO);
String PREFIX = ApiConstants.PREFIX + "/login-log";
@PostMapping(PREFIX + "/create")
/** 创建登录日志 */
CommonResult<Boolean> createLoginLog(@Valid @RequestBody LoginLogCreateReqDTO reqDTO);
}

View File

@@ -6,10 +6,6 @@ import com.tashow.cloud.systemapi.api.logger.dto.OperateLogCreateReqDTO;
import com.tashow.cloud.systemapi.api.logger.dto.OperateLogPageReqDTO;
import com.tashow.cloud.systemapi.api.logger.dto.OperateLogRespDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
@@ -19,27 +15,27 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 操作日志")
/** RPC 服务 - 操作日志 */
public interface OperateLogApi {
String PREFIX = ApiConstants.PREFIX + "/operate-log";
String PREFIX = ApiConstants.PREFIX + "/operate-log";
@PostMapping(PREFIX + "/create")
@Operation(summary = "创建操作日志")
CommonResult<Boolean> createOperateLog(@Valid @RequestBody OperateLogCreateReqDTO createReqDTO);
@PostMapping(PREFIX + "/create")
/** 创建操作日志 */
CommonResult<Boolean> createOperateLog(@Valid @RequestBody OperateLogCreateReqDTO createReqDTO);
/**
* 【异步】创建操作日志
*
* @param createReqDTO 请求
*/
@Async
default void createOperateLogAsync(OperateLogCreateReqDTO createReqDTO) {
createOperateLog(createReqDTO).checkError();
}
@GetMapping(PREFIX + "/page")
@Operation(summary = "获取指定模块的指定数据的操作日志分页")
CommonResult<PageResult<OperateLogRespDTO>> getOperateLogPage(@SpringQueryMap OperateLogPageReqDTO pageReqDTO);
/**
* 【异步】创建操作日志
*
* @param createReqDTO 请求
*/
@Async
default void createOperateLogAsync(OperateLogCreateReqDTO createReqDTO) {
createOperateLog(createReqDTO).checkError();
}
@GetMapping(PREFIX + "/page")
/** 获取指定模块的指定数据的操作日志分页 */
CommonResult<PageResult<OperateLogRespDTO>> getOperateLogPage(
@SpringQueryMap OperateLogPageReqDTO pageReqDTO);
}

View File

@@ -1,40 +1,55 @@
package com.tashow.cloud.systemapi.api.logger.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
@Schema(description = "RPC 服务 - 登录日志创建 Request DTO")
/**
* RPC 服务 - 登录日志创建 Request DTO
*/
@Data
public class LoginLogCreateReqDTO {
@Schema(description = "日志类型,参见 LoginLogTypeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1" )
/**
* 日志类型,参见 LoginLogTypeEnum 枚举类
*/
@NotNull(message = "日志类型不能为空")
private Integer logType;
@Schema(description = "链路追踪编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "89aca178-a370-411c-ae02-3f0d672be4ab")
/**
* 链路追踪编号"
*/
private String traceId;
@Schema(description = "用户编号", example = "666")
/**
* 用户类型
*/
private Long userId;
@Schema(description = "用户类型,参见 UserTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "2" )
@NotNull(message = "用户类型不能为空")
private Integer userType;
@Schema(description = "用户账号", example = "yudao")
/**
* 用户账号
*/
@Size(max = 30, message = "用户账号长度不能超过30个字符")
private String username; // 不再强制校验 username 非空,因为 Member 社交登录时,此时暂时没有 username(mobile
@Schema(description = "登录结果,参见 LoginResultEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
/**
* 登录结果,参见 LoginResultEnum 枚举类"
*/
@NotNull(message = "登录结果不能为空")
private Integer result;
@Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1")
/**
* 用户 IP"
*/
@NotEmpty(message = "用户 IP 不能为空")
private String userIp;
@Schema(description = "浏览器 UserAgent", requiredMode = Schema.RequiredMode.REQUIRED, example = "Mozilla/5.0")
/**
* 浏览器 UserAgent"
*/
private String userAgent;
}

View File

@@ -1,50 +1,73 @@
package com.tashow.cloud.systemapi.api.logger.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Schema(name = "RPC 服务 - 系统操作日志 Create Request DTO")
/**
* RPC 服务 - 系统操作日志 Create Request DTO
*/
@Data
public class OperateLogCreateReqDTO {
@Schema(description = "链路追踪编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "89aca178-a370-411c-ae02-3f0d672be4ab")
/**
* 链路追踪编号"
*/
private String traceId;
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "666")
/**
* 用户编号"
*/
@NotNull(message = "用户编号不能为空")
private Long userId;
@Schema(description = "用户类型,参见 UserTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "2" )
/**
* 用户类型
*/
@NotNull(message = "用户类型不能为空")
private Integer userType;
@Schema(description = "操作模块类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "订单")
/**
* 操作模块类型", example = "订单
*/
@NotEmpty(message = "操作模块类型不能为空")
private String type;
@Schema(description = "操作名", requiredMode = Schema.RequiredMode.REQUIRED, example = "创建订单")
/**
* 操作名", example = "创建订单
*/
@NotEmpty(message = "操作名不能为空")
private String subType;
@Schema(description = "操作模块业务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "188")
/**
* 操作模块业务编号"
*/
@NotNull(message = "操作模块业务编号不能为空")
private Long bizId;
@Schema(description = "操作内容", requiredMode = Schema.RequiredMode.REQUIRED,
example = "修改编号为 1 的用户信息,将性别从男改成女,将姓名从芋道改成源码")
/**
* 操作内容
*/
@NotEmpty(message = "操作内容不能为空")
private String action;
@Schema(description = "拓展字段", example = "{\"orderId\": \"1\"}")
/**
* 拓展字段
*/
private String extra;
@Schema(description = "请求方法名", requiredMode = Schema.RequiredMode.REQUIRED, example = "GET")
/**
* 请求方法名"
*/
@NotEmpty(message = "请求方法名不能为空")
private String requestMethod;
@Schema(description = "请求地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "/order/get")
/**
* 请求地址", example = "/order/get
*/
@NotEmpty(message = "请求地址不能为空")
private String requestUrl;
@Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1")
/**
* 用户 IP"
*/
@NotEmpty(message = "用户 IP 不能为空")
private String userIp;
@Schema(description = "浏览器 UserAgent", requiredMode = Schema.RequiredMode.REQUIRED, example = "Mozilla/5.0")
/**
* 浏览器 UserAgent"
*/
@NotEmpty(message = "浏览器 UA 不能为空")
private String userAgent;

View File

@@ -1,20 +1,28 @@
package com.tashow.cloud.systemapi.api.logger.dto;
import com.tashow.cloud.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(name = "RPC 服务 - 操作日志分页 Request DTO")
/**
* RPC 服务 - 操作日志分页 Request DTO
*/
@Data
public class OperateLogPageReqDTO extends PageParam {
@Schema(description = "模块类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "订单")
/**
* 模块类型", example = "订单
*/
private String type;
@Schema(description = "模块数据编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "188")
/**
* 模块数据编号"
*/
private Long bizId;
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "666")
/**
* 用户编号"
*/
private Long userId;
}

View File

@@ -4,49 +4,80 @@ import com.tashow.cloud.systemapi.api.user.AdminUserApi;
import com.fhs.core.trans.anno.Trans;
import com.fhs.core.trans.constant.TransType;
import com.fhs.core.trans.vo.VO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(name = "RPC 服务 - 系统操作日志 Response DTO")
/**
* RPC 服务 - 系统操作日志 Response DTO
*/
@Data
public class OperateLogRespDTO implements VO {
@Schema(description = "日志编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
/**
* 日志编号"
*/
private Long id;
@Schema(description = "链路追踪编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "89aca178-a370-411c-ae02-3f0d672be4ab")
/**
* 链路追踪编号"
*/
private String traceId;
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "666")
/**
* 用户编号"
*/
@Trans(type = TransType.AUTO_TRANS, key = AdminUserApi.PREFIX, fields = "nickname", ref = "userName")
private Long userId;
@Schema(description = "用户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
/**
* 用户名称", example = "芋道
*/
private String userName;
@Schema(description = "用户类型,参见 UserTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "2" )
/**
* 用户类型
*/
private Integer userType;
@Schema(description = "操作模块类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "订单")
/**
* 操作模块类型", example = "订单
*/
private String type;
@Schema(description = "操作名", requiredMode = Schema.RequiredMode.REQUIRED, example = "创建订单")
/**
* 操作名", example = "创建订单
*/
private String subType;
@Schema(description = "操作模块业务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "188")
/**
* 操作模块业务编号"
*/
private Long bizId;
@Schema(description = "操作内容", requiredMode = Schema.RequiredMode.REQUIRED,
example = "修改编号为 1 的用户信息,将性别从男改成女,将姓名从芋道改成源码")
/**
* 操作内容
*/
private String action;
@Schema(description = "拓展字段", example = "{\"orderId\": \"1\"}")
/**
* 拓展字段
*/
private String extra;
@Schema(description = "请求方法名", requiredMode = Schema.RequiredMode.REQUIRED, example = "GET")
/**
* 请求方法名"
*/
private String requestMethod;
@Schema(description = "请求地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "/order/get")
/**
* 请求地址", example = "/order/get
*/
private String requestUrl;
@Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1")
/**
* 用户 IP"
*/
private String userIp;
@Schema(description = "浏览器 UserAgent", requiredMode = Schema.RequiredMode.REQUIRED, example = "Mozilla/5.0")
/**
* 浏览器 UserAgent"
*/
private String userAgent;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
/**
* 创建时间
*/
private LocalDateTime createTime;
}

View File

@@ -3,30 +3,22 @@ package com.tashow.cloud.systemapi.api.mail;
import com.tashow.cloud.common.pojo.CommonResult;
import com.tashow.cloud.systemapi.api.mail.dto.MailSendSingleToUserReqDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import com.tashow.cloud.systemapi.api.mail.dto.MailSendSingleToUserReqDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import com.tashow.cloud.systemapi.api.mail.dto.MailSendSingleToUserReqDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.RequestBody;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 邮件发送")
/** RPC 服务 - 邮件发送 */
public interface MailSendApi {
String PREFIX = ApiConstants.PREFIX + "/mail/send";
String PREFIX = ApiConstants.PREFIX + "/mail/send";
@PostMapping(PREFIX + "/send-single-admin")
@Operation(summary = "发送单条邮件给 Admin 用户", description = "在 mail 为空时,使用 userId 加载对应 Admin 的邮箱")
CommonResult<Long> sendSingleMailToAdmin(@Valid @RequestBody MailSendSingleToUserReqDTO reqDTO);
@PostMapping(PREFIX + "/send-single-member")
@Operation(summary = "发送单条邮件给 Member 用户", description = "在 mail 为空时,使用 userId 加载对应 Member 的邮箱")
CommonResult<Long> sendSingleMailToMember(@Valid @RequestBody MailSendSingleToUserReqDTO reqDTO);
@PostMapping(PREFIX + "/send-single-admin")
/** 发送单条邮件给 Admin 用户", description = "在 mail 为空时,使用 userId 加载对应 Admin 的邮箱 */
CommonResult<Long> sendSingleMailToAdmin(@Valid @RequestBody MailSendSingleToUserReqDTO reqDTO);
@PostMapping(PREFIX + "/send-single-member")
/** 发送单条邮件给 Member 用户", description = "在 mail 为空时,使用 userId 加载对应 Member 的邮箱 */
CommonResult<Long> sendSingleMailToMember(@Valid @RequestBody MailSendSingleToUserReqDTO reqDTO);
}

View File

@@ -1,27 +1,37 @@
package com.tashow.cloud.systemapi.api.mail.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotNull;
import java.util.Map;
@Schema(description = "RPC 服务 - 邮件发送给 Admin 或者 Member 用户 Request DTO")
/**
* RPC 服务 - 邮件发送给 Admin 或者 Member 用户 Request DTO
*/
@Data
public class MailSendSingleToUserReqDTO {
@Schema(description = "用户编号", example = "1024")
/**
* 用户编号
*/
private Long userId;
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601691300")
/**
* 手机号"
*/
@Email
private String mail;
@Schema(description = "邮件模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "USER_SEND")
/**
* 邮件模板编号"
*/
@NotNull(message = "邮件模板编号不能为空")
private String templateCode;
@Schema(description = "邮件模板参数")
/**
* 邮件模板参数
*/
private Map<String, Object> templateParams;
}

View File

@@ -3,30 +3,24 @@ package com.tashow.cloud.systemapi.api.notify;
import com.tashow.cloud.common.pojo.CommonResult;
import com.tashow.cloud.systemapi.api.notify.dto.NotifySendSingleToUserReqDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import com.tashow.cloud.systemapi.api.notify.dto.NotifySendSingleToUserReqDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import com.tashow.cloud.systemapi.api.notify.dto.NotifySendSingleToUserReqDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.RequestBody;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 站内信发送")
/** RPC 服务 - 站内信发送 */
public interface NotifyMessageSendApi {
String PREFIX = ApiConstants.PREFIX + "/notify/send";
String PREFIX = ApiConstants.PREFIX + "/notify/send";
@PostMapping(PREFIX + "/send-single-admin")
@Operation(summary = "发送单条站内信给 Admin 用户")
CommonResult<Long> sendSingleMessageToAdmin(@Valid @RequestBody NotifySendSingleToUserReqDTO reqDTO);
@PostMapping(PREFIX + "/send-single-member")
@Operation(summary = "发送单条站内信给 Member 用户")
CommonResult<Long> sendSingleMessageToMember(@Valid @RequestBody NotifySendSingleToUserReqDTO reqDTO);
@PostMapping(PREFIX + "/send-single-admin")
/** 发送单条站内信给 Admin 用户 */
CommonResult<Long> sendSingleMessageToAdmin(
@Valid @RequestBody NotifySendSingleToUserReqDTO reqDTO);
@PostMapping(PREFIX + "/send-single-member")
/** 发送单条站内信给 Member 用户 */
CommonResult<Long> sendSingleMessageToMember(
@Valid @RequestBody NotifySendSingleToUserReqDTO reqDTO);
}

View File

@@ -1,23 +1,31 @@
package com.tashow.cloud.systemapi.api.notify.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import java.util.Map;
@Schema(description = "RPC 服务 - 站内信发送给 Admin 或者 Member 用户 Request DTO")
/**
* RPC 服务 - 站内信发送给 Admin 或者 Member 用户 Request DTO
*/
@Data
public class NotifySendSingleToUserReqDTO {
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
/**
* 用户编号"
*/
@NotNull(message = "用户编号不能为空")
private Long userId;
@Schema(description = "站内信模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "USER_SEND")
/**
* 站内信模板编号"
*/
@NotEmpty(message = "站内信模板编号不能为空")
private String templateCode;
@Schema(description = "邮件模板参数")
/**
* 邮件模板参数
*/
private Map<String, Object> templateParams;
}

View File

@@ -5,48 +5,37 @@ import com.tashow.cloud.systemapi.api.oauth2.dto.OAuth2AccessTokenCheckRespDTO;
import com.tashow.cloud.systemapi.api.oauth2.dto.OAuth2AccessTokenCreateReqDTO;
import com.tashow.cloud.systemapi.api.oauth2.dto.OAuth2AccessTokenRespDTO;
import com.tashow.cloud.systemapi.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 jakarta.validation.Valid;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import jakarta.validation.Valid;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - OAuth2.0 令牌")
/** RPC 服务 - OAuth2.0 令牌 */
public interface OAuth2TokenApi {
String PREFIX = ApiConstants.PREFIX + "/oauth2/token";
String PREFIX = ApiConstants.PREFIX + "/oauth2/token";
/**
* 校验 Token 的 URL 地址,主要是提供给 Gateway 使用
*/
@SuppressWarnings("HttpUrlsUsage")
String URL_CHECK = "http://" + ApiConstants.NAME + PREFIX + "/check";
/** 校验 Token 的 URL 地址,主要是提供给 Gateway 使用 */
@SuppressWarnings("HttpUrlsUsage")
String URL_CHECK = "http://" + ApiConstants.NAME + PREFIX + "/check";
@PostMapping(PREFIX + "/create")
@Operation(summary = "创建访问令牌")
CommonResult<OAuth2AccessTokenRespDTO> createAccessToken(@Valid @RequestBody OAuth2AccessTokenCreateReqDTO reqDTO);
@PostMapping(PREFIX + "/create")
/** 创建访问令牌 */
CommonResult<OAuth2AccessTokenRespDTO> createAccessToken(
@Valid @RequestBody OAuth2AccessTokenCreateReqDTO reqDTO);
@GetMapping(PREFIX + "/check")
@Operation(summary = "校验访问令牌")
@Parameter(name = "accessToken", description = "访问令牌", required = true, example = "tudou")
CommonResult<OAuth2AccessTokenCheckRespDTO> checkAccessToken(@RequestParam("accessToken") String accessToken);
@GetMapping(PREFIX + "/check")
/** 校验访问令牌 */
CommonResult<OAuth2AccessTokenCheckRespDTO> checkAccessToken(
@RequestParam("accessToken") String accessToken);
@DeleteMapping(PREFIX + "/remove")
@Operation(summary = "移除访问令牌")
@Parameter(name = "accessToken", description = "访问令牌", required = true, example = "tudou")
CommonResult<OAuth2AccessTokenRespDTO> removeAccessToken(@RequestParam("accessToken") String accessToken);
@PutMapping(PREFIX + "/refresh")
@Operation(summary = "刷新访问令牌")
@Parameters({
@Parameter(name = "refreshToken", description = "刷新令牌", required = true, example = "haha"),
@Parameter(name = "clientId", description = "客户端编号", required = true, example = "yudaoyuanma")
})
CommonResult<OAuth2AccessTokenRespDTO> refreshAccessToken(@RequestParam("refreshToken") String refreshToken,
@RequestParam("clientId") String clientId);
@DeleteMapping(PREFIX + "/remove")
/** 移除访问令牌 */
CommonResult<OAuth2AccessTokenRespDTO> removeAccessToken(
@RequestParam("accessToken") String accessToken);
@PutMapping(PREFIX + "/refresh")
/** 刷新访问令牌 */
CommonResult<OAuth2AccessTokenRespDTO> refreshAccessToken(
@RequestParam("refreshToken") String refreshToken, @RequestParam("clientId") String clientId);
}

View File

@@ -1,33 +1,32 @@
package com.tashow.cloud.systemapi.api.oauth2.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import lombok.Data;
@Schema(description = "RPC 服务 - OAuth2 访问令牌的校验 Response DTO")
/** RPC 服务 - OAuth2 访问令牌的校验 Response DTO */
@Data
public class OAuth2AccessTokenCheckRespDTO implements Serializable {
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
private Long userId;
/** 用户编号" */
private Long userId;
@Schema(description = "用户类型,参见 UserTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer userType;
/** 用户类型,参见 UserTypeEnum 枚举" */
private Integer userType;
@Schema(description = "用户信息", example = "{\"nickname\": \"芋道\"}")
private Map<String, String> userInfo;
/** 用户信息 */
private Map<String, String> userInfo;
@Schema(description = "租户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long tenantId;
/** 租户编号" */
private Long tenantId;
@Schema(description = "授权范围的数组", example = "user_info")
private List<String> scopes;
@Schema(description = "过期时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime expiresTime;
/** 授权范围的数组 */
private List<String> scopes;
/**
* 过期时间
*/
private LocalDateTime expiresTime;
}

View File

@@ -2,31 +2,41 @@ package com.tashow.cloud.systemapi.api.oauth2.dto;
import com.tashow.cloud.common.enums.UserTypeEnum;
import com.tashow.cloud.common.validation.InEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
@Schema(description = "RPC 服务 - OAuth2 访问令牌创建 Request DTO")
/**
* RPC 服务 - OAuth2 访问令牌创建 Request DTO
*/
@Data
public class OAuth2AccessTokenCreateReqDTO implements Serializable {
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
/**
* 用户编号"
*/
@NotNull(message = "用户编号不能为空")
private Long userId;
@Schema(description = "用户类型,参见 UserTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
/**
* 用户类型,参见 UserTypeEnum 枚举"
*/
@NotNull(message = "用户类型不能为空")
@InEnum(value = UserTypeEnum.class, message = "用户类型必须是 {value}")
private Integer userType;
@Schema(description = "客户端编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudaoyuanma")
/**
* 客户端编号"
*/
@NotNull(message = "客户端编号不能为空")
private String clientId;
@Schema(description = "授权范围的数组", example = "user_info")
/**
* 授权范围的数组
*/
private List<String> scopes;
}

View File

@@ -1,30 +1,42 @@
package com.tashow.cloud.systemapi.api.oauth2.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
@Schema(description = "RPC 服务 - OAuth2 访问令牌的信息 Response DTO")
/**
* RPC 服务 - OAuth2 访问令牌的信息 Response DTO
*/
@Data
@Accessors(chain = true)
public class OAuth2AccessTokenRespDTO implements Serializable {
@Schema(description = "访问令牌", requiredMode = Schema.RequiredMode.REQUIRED, example = "tudou")
/**
* 访问令牌"
*/
private String accessToken;
@Schema(description = "刷新令牌", requiredMode = Schema.RequiredMode.REQUIRED, example = "haha")
/**
* 刷新令牌"
*/
private String refreshToken;
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
/**
* 用户编号"
*/
private Long userId;
@Schema(description = "用户类型,参见 UserTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1" )
/**
* 用户类型
*/
private Integer userType;
@Schema(description = "过期时间", requiredMode = Schema.RequiredMode.REQUIRED)
/**
* 过期时间
*/
private LocalDateTime expiresTime;
}

View File

@@ -3,51 +3,35 @@ package com.tashow.cloud.systemapi.api.permission;
import com.tashow.cloud.common.pojo.CommonResult;
import com.tashow.cloud.systemapi.api.permission.dto.DeptDataPermissionRespDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import com.tashow.cloud.systemapi.api.permission.dto.DeptDataPermissionRespDTO;
import com.tashow.cloud.systemapi.api.permission.dto.DeptDataPermissionRespDTO;
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 java.util.Collection;
import java.util.Set;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Collection;
import java.util.Set;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 权限")
/** RPC 服务 - 权限 */
public interface PermissionApi {
String PREFIX = ApiConstants.PREFIX + "/permission";
String PREFIX = ApiConstants.PREFIX + "/permission";
@GetMapping(PREFIX + "/user-role-id-list-by-role-id")
@Operation(summary = "获得拥有多个角色的用户编号集合")
@Parameter(name = "roleIds", description = "角色编号集合", example = "1,2", required = true)
CommonResult<Set<Long>> getUserRoleIdListByRoleIds(@RequestParam("roleIds") Collection<Long> roleIds);
@GetMapping(PREFIX + "/user-role-id-list-by-role-id")
/** 获得拥有多个角色的用户编号集合 */
CommonResult<Set<Long>> getUserRoleIdListByRoleIds(
@RequestParam("roleIds") Collection<Long> roleIds);
@GetMapping(PREFIX + "/has-any-permissions")
@Operation(summary = "判断是否有权限,任一一个即可")
@Parameters({
@Parameter(name = "userId", description = "用户编号", example = "1", required = true),
@Parameter(name = "permissions", description = "权限", example = "read,write", required = true)
})
CommonResult<Boolean> hasAnyPermissions(@RequestParam("userId") Long userId,
@RequestParam("permissions") String... permissions);
@GetMapping(PREFIX + "/has-any-permissions")
/** 判断是否有权限,任一一个即可 */
CommonResult<Boolean> hasAnyPermissions(
@RequestParam("userId") Long userId, @RequestParam("permissions") String... permissions);
@GetMapping(PREFIX + "/has-any-roles")
@Operation(summary = "判断是否有角色,任一一个即可")
@Parameters({
@Parameter(name = "userId", description = "用户编号", example = "1", required = true),
@Parameter(name = "roles", description = "角色数组", example = "2", required = true)
})
CommonResult<Boolean> hasAnyRoles(@RequestParam("userId") Long userId,
@RequestParam("roles") String... roles);
@GetMapping(PREFIX + "/get-dept-data-permission")
@Operation(summary = "获得登陆用户的部门数据权限")
@Parameter(name = "userId", description = "用户编号", example = "2", required = true)
CommonResult<DeptDataPermissionRespDTO> getDeptDataPermission(@RequestParam("userId") Long userId);
@GetMapping(PREFIX + "/has-any-roles")
/** 判断是否有角色,任一一个即可 */
CommonResult<Boolean> hasAnyRoles(
@RequestParam("userId") Long userId, @RequestParam("roles") String... roles);
@GetMapping(PREFIX + "/get-dept-data-permission")
/** 获得登陆用户的部门数据权限 */
CommonResult<DeptDataPermissionRespDTO> getDeptDataPermission(
@RequestParam("userId") Long userId);
}

View File

@@ -2,24 +2,18 @@ package com.tashow.cloud.systemapi.api.permission;
import com.tashow.cloud.common.pojo.CommonResult;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import java.util.Collection;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Collection;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 角色")
/** RPC 服务 - 角色 */
public interface RoleApi {
String PREFIX = ApiConstants.PREFIX + "/role";
@GetMapping(PREFIX + "/valid")
@Operation(summary = "校验角色是否合法")
@Parameter(name = "ids", description = "角色编号数组", example = "1,2", required = true)
CommonResult<Boolean> validRoleList(@RequestParam("ids") Collection<Long> ids);
String PREFIX = ApiConstants.PREFIX + "/role";
@GetMapping(PREFIX + "/valid")
/** 校验角色是否合法 */
CommonResult<Boolean> validRoleList(@RequestParam("ids") Collection<Long> ids);
}

View File

@@ -1,22 +1,30 @@
package com.tashow.cloud.systemapi.api.permission.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.HashSet;
import java.util.Set;
@Schema(description = "RPC 服务 - 部门的数据权限 Response DTO")
/**
* RPC 服务 - 部门的数据权限 Response DTO
*/
@Data
public class DeptDataPermissionRespDTO {
@Schema(description = "是否可查看全部数据", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
/**
* 是否可查看全部数据"
*/
private Boolean all;
@Schema(description = "是否可查看自己的数据", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
/**
* 是否可查看自己的数据"
*/
private Boolean self;
@Schema(description = "可查看的部门编号数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "[1, 3]")
/**
* 可查看的部门编号数组", example = "[1, 3]
*/
private Set<Long> deptIds;
public DeptDataPermissionRespDTO() {

View File

@@ -1,44 +1,32 @@
package com.tashow.cloud.systemapi.api.sms;
import com.tashow.cloud.common.pojo.CommonResult;
import com.tashow.cloud.systemapi.api.sms.dto.code.SmsCodeValidateReqDTO;
import com.tashow.cloud.systemapi.api.sms.dto.code.SmsCodeSendReqDTO;
import com.tashow.cloud.systemapi.api.sms.dto.code.SmsCodeUseReqDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import com.tashow.cloud.systemapi.api.sms.dto.code.SmsCodeSendReqDTO;
import com.tashow.cloud.systemapi.api.sms.dto.code.SmsCodeUseReqDTO;
import com.tashow.cloud.systemapi.api.sms.dto.code.SmsCodeValidateReqDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import com.tashow.cloud.systemapi.api.sms.dto.code.SmsCodeSendReqDTO;
import com.tashow.cloud.systemapi.api.sms.dto.code.SmsCodeUseReqDTO;
import com.tashow.cloud.systemapi.api.sms.dto.code.SmsCodeValidateReqDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import jakarta.validation.Valid;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 短信验证码")
/** RPC 服务 - 短信验证码 */
public interface SmsCodeApi {
String PREFIX = ApiConstants.PREFIX + "/oauth2/sms/code";
String PREFIX = ApiConstants.PREFIX + "/oauth2/sms/code";
@PostMapping(PREFIX + "/send")
@Operation(summary = "创建短信验证码,并进行发送")
CommonResult<Boolean> sendSmsCode(@Valid @RequestBody SmsCodeSendReqDTO reqDTO);
@PostMapping(PREFIX + "/send")
/** 创建短信验证码,并进行发送 */
CommonResult<Boolean> sendSmsCode(@Valid @RequestBody SmsCodeSendReqDTO reqDTO);
@PutMapping(PREFIX + "/use")
@Operation(summary = "验证短信验证码,并进行使用")
CommonResult<Boolean> useSmsCode(@Valid @RequestBody SmsCodeUseReqDTO reqDTO);
@GetMapping(PREFIX + "/validate")
@Operation(summary = "检查验证码是否有效")
CommonResult<Boolean> validateSmsCode(@Valid @RequestBody SmsCodeValidateReqDTO reqDTO);
@PutMapping(PREFIX + "/use")
/** 验证短信验证码,并进行使用 */
CommonResult<Boolean> useSmsCode(@Valid @RequestBody SmsCodeUseReqDTO reqDTO);
@GetMapping(PREFIX + "/validate")
/** 检查验证码是否有效 */
CommonResult<Boolean> validateSmsCode(@Valid @RequestBody SmsCodeValidateReqDTO reqDTO);
}

View File

@@ -3,28 +3,22 @@ package com.tashow.cloud.systemapi.api.sms;
import com.tashow.cloud.common.pojo.CommonResult;
import com.tashow.cloud.systemapi.api.sms.dto.send.SmsSendSingleToUserReqDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import jakarta.validation.Valid;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 短信发送")
/** RPC 服务 - 短信发送 */
public interface SmsSendApi {
String PREFIX = ApiConstants.PREFIX + "/sms/send";
String PREFIX = ApiConstants.PREFIX + "/sms/send";
@PostMapping(PREFIX + "/send-single-admin")
@Operation(summary = "发送单条短信给 Admin 用户", description = "在 mobile 为空时,使用 userId 加载对应 Admin 的手机号")
CommonResult<Long> sendSingleSmsToAdmin(@Valid @RequestBody SmsSendSingleToUserReqDTO reqDTO);
@PostMapping(PREFIX + "/send-single-member")
@Operation(summary = "发送单条短信给 Member 用户", description = "在 mobile 为空时,使用 userId 加载对应 Member 的手机号")
CommonResult<Long> sendSingleSmsToMember(@Valid @RequestBody SmsSendSingleToUserReqDTO reqDTO);
@PostMapping(PREFIX + "/send-single-admin")
/** 发送单条短信给 Admin 用户", description = "在 mobile 为空时,使用 userId 加载对应 Admin 的手机号 */
CommonResult<Long> sendSingleSmsToAdmin(@Valid @RequestBody SmsSendSingleToUserReqDTO reqDTO);
@PostMapping(PREFIX + "/send-single-member")
/** 发送单条短信给 Member 用户", description = "在 mobile 为空时,使用 userId 加载对应 Member 的手机号 */
CommonResult<Long> sendSingleSmsToMember(@Valid @RequestBody SmsSendSingleToUserReqDTO reqDTO);
}

View File

@@ -3,27 +3,35 @@ package com.tashow.cloud.systemapi.api.sms.dto.code;
import com.tashow.cloud.common.validation.InEnum;
import com.tashow.cloud.common.validation.Mobile;
import com.tashow.cloud.systemapi.enums.sms.SmsSceneEnum;
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")
/**
* RPC 服务 - 短信验证码的发送 Request DTO
*/
@Data
public class SmsCodeSendReqDTO {
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601691300")
/**
* 手机号"
*/
@Mobile
@NotEmpty(message = "手机号不能为空")
private String mobile;
@Schema(description = "发送场景", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
/**
* 发送场景"
*/
@NotNull(message = "发送场景不能为空")
@InEnum(SmsSceneEnum.class)
private Integer scene;
@Schema(description = "发送 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "10.20.30.40")
/**
* 发送 IP"
*/
@NotEmpty(message = "发送 IP 不能为空")
private String createIp;

View File

@@ -5,31 +5,41 @@ import com.tashow.cloud.common.validation.Mobile;
import com.tashow.cloud.systemapi.enums.sms.SmsSceneEnum;
import com.tashow.cloud.systemapi.enums.sms.SmsSceneEnum;
import com.tashow.cloud.systemapi.enums.sms.SmsSceneEnum;
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")
/**
* RPC 服务 - 短信验证码的使用 Request DTO
*/
@Data
public class SmsCodeUseReqDTO {
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601691300")
/**
* 手机号"
*/
@Mobile
@NotEmpty(message = "手机号不能为空")
private String mobile;
@Schema(description = "发送场景", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
/**
* 发送场景"
*/
@NotNull(message = "发送场景不能为空")
@InEnum(SmsSceneEnum.class)
private Integer scene;
@Schema(description = "验证码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
/**
* 验证码"
*/
@NotEmpty(message = "验证码")
private String code;
@Schema(description = "发送 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "10.20.30.40")
/**
* 发送 IP"
*/
@NotEmpty(message = "使用 IP 不能为空")
private String usedIp;

View File

@@ -5,27 +5,35 @@ import com.tashow.cloud.common.validation.Mobile;
import com.tashow.cloud.systemapi.enums.sms.SmsSceneEnum;
import com.tashow.cloud.systemapi.enums.sms.SmsSceneEnum;
import com.tashow.cloud.systemapi.enums.sms.SmsSceneEnum;
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")
/**
* RPC 服务 - 短信验证码的校验 Request DTO
*/
@Data
public class SmsCodeValidateReqDTO {
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601691300")
/**
* 手机号"
*/
@Mobile
@NotEmpty(message = "手机号不能为空")
private String mobile;
@Schema(description = "发送场景", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
/**
* 发送场景"
*/
@NotNull(message = "发送场景不能为空")
@InEnum(SmsSceneEnum.class)
private Integer scene;
@Schema(description = "验证码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
/**
* 验证码"
*/
@NotEmpty(message = "验证码")
private String code;

View File

@@ -1,26 +1,24 @@
package com.tashow.cloud.systemapi.api.sms.dto.send;
import com.tashow.cloud.common.validation.Mobile;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotEmpty;
import java.util.Map;
import lombok.Data;
@Schema(description = "RPC 服务 - 短信发送给 Admin 或者 Member 用户 Request DTO")
/** RPC 服务 - 短信发送给 Admin 或者 Member 用户 Request DTO */
@Data
public class SmsSendSingleToUserReqDTO {
@Schema(description = "用户编号", example = "1024")
private Long userId;
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601691300")
@Mobile
private String mobile;
/** 用户编号 */
private Long userId;
@Schema(description = "短信模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "USER_SEND")
@NotEmpty(message = "短信模板编号不能为空")
private String templateCode;
@Schema(description = "短信模板参数")
private Map<String, Object> templateParams;
/** 手机号" */
@Mobile private String mobile;
/** 短信模板编号" */
@NotEmpty(message = "短信模板编号不能为空")
private String templateCode;
/** 短信模板参数 */
private Map<String, Object> templateParams;
}

View File

@@ -3,11 +3,8 @@ package com.tashow.cloud.systemapi.api.social;
import com.tashow.cloud.common.pojo.CommonResult;
import com.tashow.cloud.systemapi.api.social.dto.*;
import com.tashow.cloud.systemapi.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 jakarta.validation.Valid;
import java.util.List;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
@@ -15,53 +12,40 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 社交应用")
/** RPC 服务 - 社交应用 */
public interface SocialClientApi {
String PREFIX = ApiConstants.PREFIX + "/social-client";
String PREFIX = ApiConstants.PREFIX + "/social-client";
@GetMapping(PREFIX + "/get-authorize-url")
@Operation(summary = "获得社交平台的授权 URL")
@Parameters({
@Parameter(name = "socialType", description = "社交平台的类型", example = "1", required = true),
@Parameter(name = "userType", description = "用户类型", example = "1", required = true),
@Parameter(name = "redirectUri", description = "重定向 URL", example = "https://www.iocoder.cn", required = true)
})
CommonResult<String> getAuthorizeUrl(@RequestParam("socialType") Integer socialType,
@RequestParam("userType") Integer userType,
@RequestParam("redirectUri") String redirectUri);
@GetMapping(PREFIX + "/get-authorize-url")
/** 获得社交平台的授权 URL */
CommonResult<String> getAuthorizeUrl(
@RequestParam("socialType") Integer socialType,
@RequestParam("userType") Integer userType,
@RequestParam("redirectUri") String redirectUri);
@GetMapping(PREFIX + "/create-wx-mp-jsapi-signature")
@Operation(summary = "创建微信公众号 JS SDK 初始化所需的签名")
@Parameters({
@Parameter(name = "userType", description = "用户类型", example = "1", required = true),
@Parameter(name = "url", description = "访问 URL", example = "https://www.iocoder.cn", required = true)
})
CommonResult<SocialWxJsapiSignatureRespDTO> createWxMpJsapiSignature(@RequestParam("userType") Integer userType,
@RequestParam("url") String url);
@GetMapping(PREFIX + "/create-wx-mp-jsapi-signature")
/** 创建微信公众号 JS SDK 初始化所需的签名 */
CommonResult<SocialWxJsapiSignatureRespDTO> createWxMpJsapiSignature(
@RequestParam("userType") Integer userType, @RequestParam("url") String url);
@GetMapping(PREFIX + "/create-wx-ma-phone-number-info")
@Operation(summary = "获得微信小程序的手机信息")
@Parameters({
@Parameter(name = "userType", description = "用户类型", example = "1", required = true),
@Parameter(name = "phoneCode", description = "手机授权码", example = "yudao11", required = true)
})
CommonResult<SocialWxPhoneNumberInfoRespDTO> getWxMaPhoneNumberInfo(@RequestParam("userType") Integer userType,
@RequestParam("phoneCode") String phoneCode);
@GetMapping(PREFIX + "/create-wx-ma-phone-number-info")
/** 获得微信小程序的手机信息 */
CommonResult<SocialWxPhoneNumberInfoRespDTO> getWxMaPhoneNumberInfo(
@RequestParam("userType") Integer userType, @RequestParam("phoneCode") String phoneCode);
@GetMapping(PREFIX + "/get-wxa-qrcode")
@Operation(summary = "获得小程序二维码")
CommonResult<byte[]> getWxaQrcode(@SpringQueryMap SocialWxQrcodeReqDTO reqVO);
@GetMapping(PREFIX + "/get-wxa-qrcode")
/** 获得小程序二维码 */
CommonResult<byte[]> getWxaQrcode(@SpringQueryMap SocialWxQrcodeReqDTO reqVO);
@GetMapping(PREFIX + "/get-wxa-subscribe-template-list")
@Operation(summary = "获得微信小程订阅模板")
CommonResult<List<SocialWxaSubscribeTemplateRespDTO>> getWxaSubscribeTemplateList(@RequestParam("userType") Integer userType);
@PostMapping(PREFIX + "/send-wxa-subscribe-message")
@Operation(summary = "发送微信小程序订阅消息")
CommonResult<Boolean> sendWxaSubscribeMessage(@Valid @RequestBody SocialWxaSubscribeMessageSendReqDTO reqDTO);
@GetMapping(PREFIX + "/get-wxa-subscribe-template-list")
/** 获得微信小程订阅模板 */
CommonResult<List<SocialWxaSubscribeTemplateRespDTO>> getWxaSubscribeTemplateList(
@RequestParam("userType") Integer userType);
@PostMapping(PREFIX + "/send-wxa-subscribe-message")
/** 发送微信小程序订阅消息 */
CommonResult<Boolean> sendWxaSubscribeMessage(
@Valid @RequestBody SocialWxaSubscribeMessageSendReqDTO reqDTO);
}

View File

@@ -5,51 +5,38 @@ import com.tashow.cloud.systemapi.api.social.dto.SocialUserBindReqDTO;
import com.tashow.cloud.systemapi.api.social.dto.SocialUserRespDTO;
import com.tashow.cloud.systemapi.api.social.dto.SocialUserUnbindReqDTO;
import com.tashow.cloud.systemapi.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 jakarta.validation.Valid;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import jakarta.validation.Valid;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 社交用户")
/** RPC 服务 - 社交用户 */
public interface SocialUserApi {
String PREFIX = ApiConstants.PREFIX + "/social-user";
String PREFIX = ApiConstants.PREFIX + "/social-user";
@PostMapping(PREFIX + "/bind")
@Operation(summary = "绑定社交用户")
CommonResult<String> bindSocialUser(@Valid @RequestBody SocialUserBindReqDTO reqDTO);
@PostMapping(PREFIX + "/bind")
/** 绑定社交用户 */
CommonResult<String> bindSocialUser(@Valid @RequestBody SocialUserBindReqDTO reqDTO);
@DeleteMapping(PREFIX + "/unbind")
@Operation(summary = "取消绑定社交用户")
CommonResult<Boolean> unbindSocialUser(@Valid @RequestBody SocialUserUnbindReqDTO reqDTO);
@DeleteMapping(PREFIX + "/unbind")
/** 取消绑定社交用户 */
CommonResult<Boolean> unbindSocialUser(@Valid @RequestBody SocialUserUnbindReqDTO reqDTO);
@GetMapping(PREFIX + "/get-by-user-id")
@Operation(summary = "获得社交用户,基于 userId")
@Parameters({
@Parameter(name = "userType", description = "用户类型", example = "2", required = true),
@Parameter(name = "userId", description = "用户编号", example = "1024", required = true),
@Parameter(name = "socialType", description = "社交平台的类型", example = "1", required = true),
})
CommonResult<SocialUserRespDTO> getSocialUserByUserId(@RequestParam("userType") Integer userType,
@RequestParam("userId") Long userId,
@RequestParam("socialType") Integer socialType);
@GetMapping(PREFIX + "/get-by-user-id")
/** 获得社交用户,基于 userId */
CommonResult<SocialUserRespDTO> getSocialUserByUserId(
@RequestParam("userType") Integer userType,
@RequestParam("userId") Long userId,
@RequestParam("socialType") Integer socialType);
@GetMapping(PREFIX + "/get-by-code")
@Operation(summary = "获得社交用") // 在认证信息不正确的情况下,也会抛出 {@link ServiceException} 业务异常
@Parameters({
@Parameter(name = "userType", description = "用户类型", example = "2", required = true),
@Parameter(name = "socialType", description = "社交平台的类型", example = "1", required = true),
@Parameter(name = "code", description = "授权码", example = "88888", required = true),
@Parameter(name = "state", description = "state", example = "666", required = true),
})
CommonResult<SocialUserRespDTO> getSocialUserByCode(@RequestParam("userType") Integer userType,
@RequestParam("socialType") Integer socialType,
@RequestParam("code") String code,
@RequestParam("state") String state);
@GetMapping(PREFIX + "/get-by-code")
/** 获得社交用 */
// 在认证信息不正确的情况下,也会抛出 {@link ServiceException} 业务异常
CommonResult<SocialUserRespDTO> getSocialUserByCode(
@RequestParam("userType") Integer userType,
@RequestParam("socialType") Integer socialType,
@RequestParam("code") String code,
@RequestParam("state") String state);
}

View File

@@ -3,37 +3,37 @@ package com.tashow.cloud.systemapi.api.social.dto;
import com.tashow.cloud.common.enums.UserTypeEnum;
import com.tashow.cloud.common.validation.InEnum;
import com.tashow.cloud.systemapi.enums.social.SocialTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
@Schema(description = "RPC 服务 - 取消绑定社交用户 Request DTO")
/** RPC 服务 - 取消绑定社交用户 Request DTO */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SocialUserBindReqDTO {
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@NotNull(message = "用户编号不能为空")
private Long userId;
@Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@InEnum(UserTypeEnum.class)
@NotNull(message = "用户类型不能为空")
private Integer userType;
/** 用户编号" */
@NotNull(message = "用户编号不能为空")
private Long userId;
@Schema(description = "社交平台的类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@InEnum(SocialTypeEnum.class)
@NotNull(message = "社交平台的类型不能为空")
private Integer socialType;
@Schema(description = "授权码", requiredMode = Schema.RequiredMode.REQUIRED, example = "zsw")
@NotEmpty(message = "授权码不能为空")
private String code;
@Schema(description = "state", requiredMode = Schema.RequiredMode.REQUIRED, example = "qtw")
@NotEmpty(message = "state 不能为空")
private String state;
/** 用户类型" */
@InEnum(UserTypeEnum.class)
@NotNull(message = "用户类型不能为空")
private Integer userType;
/** 社交平台的类型" */
@InEnum(SocialTypeEnum.class)
@NotNull(message = "社交平台的类型不能为空")
private Integer socialType;
/** 授权码" */
@NotEmpty(message = "授权码不能为空")
private String code;
/** state" */
@NotEmpty(message = "state 不能为空")
private String state;
}

View File

@@ -1,26 +1,24 @@
package com.tashow.cloud.systemapi.api.social.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Schema(description = "RPC 服务 - 社交用户 Response DTO")
/** RPC 服务 - 社交用户 Response DTO */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SocialUserRespDTO {
@Schema(description = "社交用户 openid", requiredMode = Schema.RequiredMode.REQUIRED, example = "zsw")
private String openid;
/** 社交用户 openid" */
private String openid;
@Schema(description = "社交用户的昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码")
private String nickname;
/** 社交用户的昵称", example = "芋道源码 */
private String nickname;
@Schema(description = "社交用户的头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.jpg")
private String avatar;
@Schema(description = "关联的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long userId;
/** 社交用户的头像" */
private String avatar;
/** 关联的用户编号" */
private Long userId;
}

View File

@@ -5,7 +5,7 @@ import com.tashow.cloud.common.validation.InEnum;
import com.tashow.cloud.systemapi.enums.social.SocialTypeEnum;
import com.tashow.cloud.systemapi.enums.social.SocialTypeEnum;
import com.tashow.cloud.systemapi.enums.social.SocialTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -13,25 +13,35 @@ import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.NoArgsConstructor;
@Schema(description = "RPC 服务 - 取消绑定社交用户 Request DTO")
/**
* RPC 服务 - 取消绑定社交用户 Request DTO
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SocialUserUnbindReqDTO {
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
/**
* 用户编号"
*/
@NotNull(message = "用户编号不能为空")
private Long userId;
@Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
/**
* 用户类型"
*/
@InEnum(UserTypeEnum.class)
@NotNull(message = "用户类型不能为空")
private Integer userType;
@Schema(description = "社交平台的类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
/**
* 社交平台的类型"
*/
@InEnum(SocialTypeEnum.class)
@NotNull(message = "社交平台的类型不能为空")
private Integer socialType;
@Schema(description = "社交平台的 openid", requiredMode = Schema.RequiredMode.REQUIRED, example = "zsw")
/**
* 社交平台的 openid"
*/
@NotEmpty(message = "社交平台的 openid 不能为空")
private String openid;

View File

@@ -1,25 +1,37 @@
package com.tashow.cloud.systemapi.api.social.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "RPC 服务 - 微信公众号 JSAPI 签名 Response DTO")
/**
* RPC 服务 - 微信公众号 JSAPI 签名 Response DTO
*/
@Data
public class SocialWxJsapiSignatureRespDTO {
@Schema(description = "微信公众号的 appId", requiredMode = Schema.RequiredMode.REQUIRED, example = "wx123456")
/**
* 微信公众号的 appId"
*/
private String appId;
@Schema(description = "匿名串", requiredMode = Schema.RequiredMode.REQUIRED, example = "zsw")
/**
* 匿名串"
*/
private String nonceStr;
@Schema(description = "时间戳", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456789")
/**
* 时间戳"
*/
private Long timestamp;
@Schema(description = "URL", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
/**
* URL"
*/
private String url;
@Schema(description = "签名", requiredMode = Schema.RequiredMode.REQUIRED, example = "zsw")
/**
* 签名"
*/
private String signature;
}

View File

@@ -1,18 +1,26 @@
package com.tashow.cloud.systemapi.api.social.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "RPC 服务 - 微信小程序的手机信息 Response DTO")
/**
* RPC 服务 - 微信小程序的手机信息 Response DTO
*/
@Data
public class SocialWxPhoneNumberInfoRespDTO {
@Schema(description = "用户绑定的手机号(国外手机号会有区号)", requiredMode = Schema.RequiredMode.REQUIRED, example = "021-13579246810")
/**
* 用户绑定的手机号(国外手机号会有区号)"
*/
private String phoneNumber;
@Schema(description = "没有区号的手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13579246810")
/**
* 没有区号的手机号"
*/
private String purePhoneNumber;
@Schema(description = "区号", requiredMode = Schema.RequiredMode.REQUIRED, example = "021")
/**
* 区号"
*/
private String countryCode;
}

View File

@@ -1,57 +1,52 @@
package com.tashow.cloud.systemapi.api.social.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
/**
* @see <a href="https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/qrcode-link/qr-code/getUnlimitedQRCode.html">获取不限制的小程序码</a>
* @see <a
* href="https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/qrcode-link/qr-code/getUnlimitedQRCode.html">获取不限制的小程序码</a>
*/
@Schema(description = "RPC 服务 - 获得获取小程序码 Request DTO")
/** RPC 服务 - 获得获取小程序码 Request DTO */
@Data
public class SocialWxQrcodeReqDTO {
/**
* 页面路径不能携带参数参数请放在scene字段里
*/
public static final String SCENE = "";
/**
* 二维码宽度
*/
public static final Integer WIDTH = 430;
/**
* 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调
*/
public static final Boolean AUTO_COLOR = true;
/**
* 检查 page 是否存在
*/
public static final Boolean CHECK_PATH = true;
/**
* 是否需要透明底色
*
* hyaline 为 true 时,生成透明底色的小程序码
*/
public static final Boolean HYALINE = true;
/** 页面路径不能携带参数参数请放在scene字段里 */
public static final String SCENE = "";
@Schema(description = "场景", requiredMode = Schema.RequiredMode.REQUIRED, example = "1001")
@NotEmpty(message = "场景不能为空")
private String scene;
/** 二维码宽度 */
public static final Integer WIDTH = 430;
@Schema(description = "页面路径", requiredMode = Schema.RequiredMode.REQUIRED, example = "pages/goods/index")
@NotEmpty(message = "页面路径不能为空")
private String path;
/** 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调 */
public static final Boolean AUTO_COLOR = true;
@Schema(description = "二维码宽度", example = "430")
private Integer width;
/** 检查 page 是否存在 */
public static final Boolean CHECK_PATH = true;
@Schema(description = "是否需要透明底色", example = "true")
private Boolean autoColor;
/**
* 是否需要透明底色
*
* <p>hyaline 为 true 时,生成透明底色的小程序码
*/
public static final Boolean HYALINE = true;
@Schema(description = "是否检查 page 是否存在", example = "true")
private Boolean checkPath;
/** 场景" */
@NotEmpty(message = "场景不能为空")
private String scene;
@Schema(description = "是否需要透明底色", example = "true")
private Boolean hyaline;
/** 页面路径" */
@NotEmpty(message = "页面路径不能为空")
private String path;
/** 二维码宽度 */
private Integer width;
/** 是否需要透明底色 */
private Boolean autoColor;
/** 是否检查 page 是否存在 */
private Boolean checkPath;
/** 是否需要透明底色 */
private Boolean hyaline;
}

View File

@@ -2,7 +2,7 @@ package com.tashow.cloud.systemapi.api.social.dto;
import com.tashow.cloud.common.enums.UserTypeEnum;
import com.tashow.cloud.common.validation.InEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@@ -10,26 +10,38 @@ import lombok.Data;
import java.util.HashMap;
import java.util.Map;
@Schema(description = "RPC 服务 - 微信小程序订阅消息发送 Request DTO")
/**
* RPC 服务 - 微信小程序订阅消息发送 Request DTO
*/
@Data
public class SocialWxaSubscribeMessageSendReqDTO {
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
/**
* 用户编号"
*/
@NotNull(message = "用户编号不能为空")
private Long userId;
@Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
/**
* 用户类型"
*/
@InEnum(UserTypeEnum.class)
@NotNull(message = "用户类型不能为空")
private Integer userType;
@Schema(description = "消息模版标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "模版标题")
/**
* 消息模版标题", example = "模版标题
*/
@NotEmpty(message = "消息模版标题不能为空")
private String templateTitle;
@Schema(description = "点击模板卡片后的跳转页面,仅限本小程序内的页面", example = "pages/index?foo=bar")
/**
* 点击模板卡片后的跳转页面,仅限本小程序内的页面
*/
private String page; // 支持带参数,(示例 index?foo=bar )。该字段不填则模板无跳转。
@Schema(description = "模板内容的参数")
/**
* 模板内容的参数
*/
private Map<String, String> messages;
public SocialWxaSubscribeMessageSendReqDTO addMessage(String key, String value) {

View File

@@ -1,25 +1,23 @@
package com.tashow.cloud.systemapi.api.social.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "RPC 服务 - 小程序订阅消息模版 Response DTO")
/** RPC 服务 - 小程序订阅消息模版 Response DTO */
@Data
public class SocialWxaSubscribeTemplateRespDTO {
@Schema(description = "模版编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private String id;
/** 模版编号" */
private String id;
@Schema(description = "模版标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "模版标题")
private String title;
/** 模版标题", example = "模版标题 */
private String title;
@Schema(description = "模版内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "模版内容")
private String content;
/** 模版内容", example = "模版内容 */
private String content;
@Schema(description = "模板内容示例", requiredMode = Schema.RequiredMode.REQUIRED, example = "模版内容示例")
private String example;
@Schema(description = "模版类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Integer type; // 2为一次性订阅3为长期订阅
/** 模板内容示例", example = "模版内容示例 */
private String example;
/** 模版类型" */
private Integer type; // 2为一次性订阅3为长期订阅
}

View File

@@ -2,28 +2,22 @@ package com.tashow.cloud.systemapi.api.tenant;
import com.tashow.cloud.common.pojo.CommonResult;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import java.util.List;
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 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 多租户")
/** RPC 服务 - 多租户 */
public interface TenantApi {
String PREFIX = ApiConstants.PREFIX + "/tenant";
String PREFIX = ApiConstants.PREFIX + "/tenant";
@GetMapping(PREFIX + "/id-list")
@Operation(summary = "获得所有租户编号")
CommonResult<List<Long>> getTenantIdList();
@GetMapping(PREFIX + "/valid")
@Operation(summary = "校验租户是否合法")
@Parameter(name = "id", description = "租户编号", required = true, example = "1024")
CommonResult<Boolean> validTenant(@RequestParam("id") Long id);
@GetMapping(PREFIX + "/id-list")
/** 获得所有租户编号 */
CommonResult<List<Long>> getTenantIdList();
@GetMapping(PREFIX + "/valid")
/** 校验租户是否合法 */
CommonResult<Boolean> validTenant(@RequestParam("id") Long id);
}

View File

@@ -1,96 +1,87 @@
package com.tashow.cloud.systemapi.api.user;
import static com.tashow.cloud.systemapi.api.user.AdminUserApi.PREFIX;
import cn.hutool.core.convert.Convert;
import com.fhs.core.trans.anno.AutoTrans;
import com.tashow.cloud.common.pojo.CommonResult;
import com.tashow.cloud.common.trans.AutoTransable;
import com.tashow.cloud.common.util.collection.CollectionUtils;
import com.tashow.cloud.systemapi.api.user.dto.AdminUserRespDTO;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import com.fhs.core.trans.anno.AutoTrans;
import feign.FeignIgnore;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import static com.tashow.cloud.systemapi.api.user.AdminUserApi.PREFIX;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 管理员用户")
@AutoTrans(namespace = PREFIX, fields = {"nickname"})
/** RPC 服务 - 管理员用户 */
@AutoTrans(
namespace = PREFIX,
fields = {"nickname"})
public interface AdminUserApi extends AutoTransable<AdminUserRespDTO> {
String PREFIX = ApiConstants.PREFIX + "/user";
String PREFIX = ApiConstants.PREFIX + "/user";
@GetMapping(PREFIX + "/get")
@Operation(summary = "通过用户 ID 查询用户")
@Parameter(name = "id", description = "用户编号", example = "1", required = true)
CommonResult<AdminUserRespDTO> getUser(@RequestParam("id") Long id);
@GetMapping(PREFIX + "/get")
/** 通过用户 ID 查询用户 */
CommonResult<AdminUserRespDTO> getUser(@RequestParam("id") Long id);
@GetMapping(PREFIX + "/list-by-subordinate")
@Operation(summary = "通过用户 ID 查询用户下属")
@Parameter(name = "id", description = "用户编号", example = "1", required = true)
CommonResult<List<AdminUserRespDTO>> getUserListBySubordinate(@RequestParam("id") Long id);
@GetMapping(PREFIX + "/list-by-subordinate")
/** 通过用户 ID 查询用户下属 */
CommonResult<List<AdminUserRespDTO>> getUserListBySubordinate(@RequestParam("id") Long id);
@GetMapping(PREFIX + "/list")
@Operation(summary = "通过用户 ID 查询用户们")
@Parameter(name = "ids", description = "部门编号数组", example = "1,2", required = true)
CommonResult<List<AdminUserRespDTO>> getUserList(@RequestParam("ids") Collection<Long> ids);
@GetMapping(PREFIX + "/list")
/** 通过用户 ID 查询用户们 */
CommonResult<List<AdminUserRespDTO>> getUserList(@RequestParam("ids") Collection<Long> ids);
@GetMapping(PREFIX + "/list-by-dept-id")
@Operation(summary = "获得指定部门的用户数组")
@Parameter(name = "deptIds", description = "部门编号数组", example = "1,2", required = true)
CommonResult<List<AdminUserRespDTO>> getUserListByDeptIds(@RequestParam("deptIds") Collection<Long> deptIds);
@GetMapping(PREFIX + "/list-by-dept-id")
/** 获得指定部门的用户数组 */
CommonResult<List<AdminUserRespDTO>> getUserListByDeptIds(
@RequestParam("deptIds") Collection<Long> deptIds);
@GetMapping(PREFIX + "/list-by-post-id")
@Operation(summary = "获得指定岗位的用户数组")
@Parameter(name = "postIds", description = "岗位编号数组", example = "2,3", required = true)
CommonResult<List<AdminUserRespDTO>> getUserListByPostIds(@RequestParam("postIds") Collection<Long> postIds);
@GetMapping(PREFIX + "/list-by-post-id")
/** 获得指定岗位的用户数组 */
CommonResult<List<AdminUserRespDTO>> getUserListByPostIds(
@RequestParam("postIds") Collection<Long> postIds);
/**
* 获得用户 Map
*
* @param ids 用户编号数组
* @return 用户 Map
*/
default Map<Long, AdminUserRespDTO> getUserMap(Collection<Long> ids) {
List<AdminUserRespDTO> users = getUserList(ids).getCheckedData();
return CollectionUtils.convertMap(users, AdminUserRespDTO::getId);
}
/**
* 获得用户 Map
*
* @param ids 用户编号数组
* @return 用户 Map
*/
default Map<Long, AdminUserRespDTO> getUserMap(Collection<Long> ids) {
List<AdminUserRespDTO> users = getUserList(ids).getCheckedData();
return CollectionUtils.convertMap(users, AdminUserRespDTO::getId);
}
/**
* 校验用户是否有效。如下情况,视为无效:
* 1. 用户编号不存在
* 2. 用户被禁用
*
* @param id 用户编号
*/
default void validateUser(Long id) {
validateUserList(Collections.singleton(id));
}
/**
* 校验用户是否有效。如下情况,视为无效: 1. 用户编号不存在 2. 用户被禁用
*
* @param id 用户编号
*/
default void validateUser(Long id) {
validateUserList(Collections.singleton(id));
}
@GetMapping(PREFIX + "/valid")
@Operation(summary = "校验用户们是否有效")
@Parameter(name = "ids", description = "用户编号数组", example = "3,5", required = true)
CommonResult<Boolean> validateUserList(@RequestParam("ids") Collection<Long> ids);
@GetMapping(PREFIX + "/valid")
/** 校验用户们是否有效 */
CommonResult<Boolean> validateUserList(@RequestParam("ids") Collection<Long> ids);
@Override
@FeignIgnore
default List<AdminUserRespDTO> selectByIds(List<?> ids) {
return getUserList(Convert.toList(Long.class, ids)).getCheckedData();
}
@Override
@FeignIgnore
default AdminUserRespDTO selectById(Object id) {
return getUser(Convert.toLong(id)).getCheckedData();
}
@Override
@FeignIgnore
default List<AdminUserRespDTO> selectByIds(List<?> ids) {
return getUserList(Convert.toList(Long.class, ids)).getCheckedData();
}
@Override
@FeignIgnore
default AdminUserRespDTO selectById(Object id) {
return getUser(Convert.toLong(id)).getCheckedData();
}
}

View File

@@ -1,34 +1,50 @@
package com.tashow.cloud.systemapi.api.user.dto;
import com.fhs.core.trans.vo.VO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Set;
@Schema(description = "RPC 服务 - Admin 用户 Response DTO")
/**
* RPC 服务 - Admin 用户 Response DTO
*/
@Data
public class AdminUserRespDTO implements VO {
@Schema(description = "用户 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
/**
* 用户 ID"
*/
private Long id;
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "小王")
/**
* 用户昵称", example = "小王
*/
private String nickname;
@Schema(description = "帐号状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
/**
* 帐号状态"
*/
private Integer status; // 参见 CommonStatusEnum 枚举
@Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
/**
* 部门编号"
*/
private Long deptId;
@Schema(description = "岗位编号数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "[1, 3]")
/**
* 岗位编号数组", example = "[1, 3]
*/
private Set<Long> postIds;
@Schema(description = "手机号码", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601691300")
/**
* 手机号码"
*/
private String mobile;
@Schema(description = "用户头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png")
/**
* 用户头像"
*/
private String avatar;
}