diff --git a/归档/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/GlobalException.java b/归档/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/GlobalException.java deleted file mode 100644 index a499afa96..000000000 --- a/归档/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/GlobalException.java +++ /dev/null @@ -1,71 +0,0 @@ -package cn.iocoder.common.framework.exception; - -import cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants; -import cn.iocoder.common.framework.vo.CommonResult; - -/** - * 全局异常 Exception - */ -public class GlobalException extends RuntimeException { - - /** - * 全局错误码 - * - * @see GlobalErrorCodeConstants - */ - private Integer code; - /** - * 错误提示 - */ - private String message; - /** - * 错误明细,内部调试错误 - * - * 和 {@link CommonResult#getDetailMessage()} 一致的设计 - */ - private String detailMessage; - - /** - * 空构造方法,避免反序列化问题 - */ - public GlobalException() { - } - - public GlobalException(ErrorCode errorCode) { - this.code = errorCode.getCode(); - this.message = errorCode.getMessage(); - } - - public GlobalException(Integer code, String message) { - this.code = code; - this.message = message; - } - - public Integer getCode() { - return code; - } - - public String getDetailMessage() { - return detailMessage; - } - - public GlobalException setDetailMessage(String detailMessage) { - this.detailMessage = detailMessage; - return this; - } - - public GlobalException setCode(Integer code) { - this.code = code; - return this; - } - - public String getMessage() { - return message; - } - - public GlobalException setMessage(String message) { - this.message = message; - return this; - } - -} diff --git a/归档/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/ServiceException.java b/归档/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/ServiceException.java deleted file mode 100644 index c9af66cd7..000000000 --- a/归档/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/ServiceException.java +++ /dev/null @@ -1,71 +0,0 @@ -package cn.iocoder.common.framework.exception; - -import cn.iocoder.common.framework.exception.enums.ServiceErrorCodeRange; -import cn.iocoder.common.framework.vo.CommonResult; - -/** - * 业务逻辑异常 Exception - */ -public final class ServiceException extends RuntimeException { - - /** - * 业务错误码 - * - * @see ServiceErrorCodeRange - */ - private Integer code; - /** - * 错误提示 - */ - private String message; - /** - * 错误明细,内部调试错误 - * - * 和 {@link CommonResult#getDetailMessage()} 一致的设计 - */ - private String detailMessage; - - /** - * 空构造方法,避免反序列化问题 - */ - public ServiceException() { - } - - public ServiceException(ErrorCode errorCode) { - this.code = errorCode.getCode(); - this.message = errorCode.getMessage(); - } - - public ServiceException(Integer code, String message) { - this.code = code; - this.message = message; - } - - public Integer getCode() { - return code; - } - - public String getDetailMessage() { - return detailMessage; - } - - public ServiceException setDetailMessage(String detailMessage) { - this.detailMessage = detailMessage; - return this; - } - - public ServiceException setCode(Integer code) { - this.code = code; - return this; - } - - public String getMessage() { - return message; - } - - public ServiceException setMessage(String message) { - this.message = message; - return this; - } - -} diff --git a/归档/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/enums/GlobalErrorCodeConstants.java b/归档/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/enums/GlobalErrorCodeConstants.java deleted file mode 100644 index 9b72a9958..000000000 --- a/归档/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/enums/GlobalErrorCodeConstants.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.iocoder.common.framework.exception.enums; - -import cn.iocoder.common.framework.exception.ErrorCode; - -/** - * 全局错误码枚举 - * 0-999 系统异常编码保留 - * - * 一般情况下,使用 HTTP 响应状态码 https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Status - * 虽然说,HTTP 响应状态码作为业务使用表达能力偏弱,但是使用在系统层面还是非常不错的 - * 比较特殊的是,因为之前一直使用 0 作为成功,就不使用 200 啦。 - */ -public interface GlobalErrorCodeConstants { - - ErrorCode SUCCESS = new ErrorCode(0, "成功"); - - // ========== 客户端错误段 ========== - - ErrorCode BAD_REQUEST = new ErrorCode(400, "请求参数不正确"); - ErrorCode UNAUTHORIZED = new ErrorCode(401, "账号未登录"); - ErrorCode FORBIDDEN = new ErrorCode(403, "没有该操作权限"); - ErrorCode NOT_FOUND = new ErrorCode(404, "请求未找到"); - ErrorCode METHOD_NOT_ALLOWED = new ErrorCode(405, "请求方法不正确"); - - // ========== 服务端错误段 ========== - - ErrorCode INTERNAL_SERVER_ERROR = new ErrorCode(500, "系统异常"); - - ErrorCode UNKNOWN = new ErrorCode(999, "未知错误"); - - static boolean isMatch(Integer code) { - return code != null - && code >= SUCCESS.getCode() && code <= UNKNOWN.getCode(); - } - -} diff --git a/归档/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/enums/ServiceErrorCodeRange.java b/归档/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/enums/ServiceErrorCodeRange.java deleted file mode 100644 index 9c759f885..000000000 --- a/归档/common/common-framework/src/main/java/cn/iocoder/common/framework/exception/enums/ServiceErrorCodeRange.java +++ /dev/null @@ -1,47 +0,0 @@ -package cn.iocoder.common.framework.exception.enums; - -/** - * 业务异常的错误码区间,解决:解决各模块错误码定义,避免重复,在此只声明不做实际使用 - * - * 一共 10 位,分成四段 - * - * 第一段,1 位,类型 - * 1 - 业务级别异常 - * x - 预留 - * 第二段,3 位,系统类型 - * 001 - 用户系统 - * 002 - 商品系统 - * 003 - 订单系统 - * 004 - 支付系统 - * 005 - 优惠劵系统 - * ... - ... - * 第三段,3 位,模块 - * 不限制规则。 - * 一般建议,每个系统里面,可能有多个模块,可以再去做分段。以用户系统为例子: - * 001 - OAuth2 模块 - * 002 - User 模块 - * 003 - MobileCode 模块 - * 第四段,3 位,错误码 - * 不限制规则。 - * 一般建议,每个模块自增。 - * - * @author Sin - * @time 2019-03-23 11:28 - */ -public class ServiceErrorCodeRange { - - // order 错误码区间 [1-000-001-000 ~ 1-000-002-000] - - // user 错误码区间 [1-001-000-000 ~ 1-002-000-000) - - // system-service 服务 => 错误码区间 [1-002-000-000 ~ 1-003-000-000) - - // product 错误码区间 [1-003-000-000 ~ 1-004-000-000) - - // pay 错误码区间 [1-004-000-000 ~ 1-005-000-000) - - // cart 错误码区间 [1-005-000-000 ~ 1-006-000-000) - - // promotion 错误码区间 [1-006-000-000 ~ 1-007-000-000) - -} diff --git a/归档/common/mall-security-annotations/pom.xml b/归档/common/mall-security-annotations/pom.xml deleted file mode 100644 index 9b5840ab5..000000000 --- a/归档/common/mall-security-annotations/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - common - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - mall-security-annotations - - - diff --git a/归档/common/mall-security-annotations/src/main/java/cn/iocoder/security/annotations/RequiresAuthenticate.java b/归档/common/mall-security-annotations/src/main/java/cn/iocoder/security/annotations/RequiresAuthenticate.java deleted file mode 100644 index 98d5ba9f8..000000000 --- a/归档/common/mall-security-annotations/src/main/java/cn/iocoder/security/annotations/RequiresAuthenticate.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.iocoder.security.annotations; - -import java.lang.annotation.*; - -/** - * 要求用户认证(登陆)注解。通过将该注解添加到 Controller 上,会自动校验用户是否登陆。 - * - * 默认请求下,用户访问的 API 接口,无需登陆。主要的考虑是, - * 1. 需要用户登陆的接口,本身会获取在线用户的编号。如果不添加 @RequiresLogin 注解就会报错。 - * 2. 大多数情况下,用户的 API 接口无需登陆。 - * - * ps:同样适用于管理员 Admin - */ -@Documented -@Target({ElementType.METHOD}) // 暂时不支持 ElementType.TYPE ,因为没有场景 -@Retention(RetentionPolicy.RUNTIME) -public @interface RequiresAuthenticate { -} diff --git a/归档/common/mall-security-annotations/src/main/java/cn/iocoder/security/annotations/RequiresNone.java b/归档/common/mall-security-annotations/src/main/java/cn/iocoder/security/annotations/RequiresNone.java deleted file mode 100644 index efc4801a4..000000000 --- a/归档/common/mall-security-annotations/src/main/java/cn/iocoder/security/annotations/RequiresNone.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.iocoder.security.annotations; - -import java.lang.annotation.*; - -/** - * 通过将该注解添加到 Controller 的方法上,声明无需进行登陆 - */ -@Documented -@Target({ElementType.METHOD}) // 暂时不支持 ElementType.TYPE ,因为没有场景 -@Retention(RetentionPolicy.RUNTIME) -public @interface RequiresNone { -} diff --git a/归档/common/mall-security-annotations/src/main/java/cn/iocoder/security/annotations/RequiresPermissions.java b/归档/common/mall-security-annotations/src/main/java/cn/iocoder/security/annotations/RequiresPermissions.java deleted file mode 100644 index efb21c235..000000000 --- a/归档/common/mall-security-annotations/src/main/java/cn/iocoder/security/annotations/RequiresPermissions.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.iocoder.security.annotations; - -import java.lang.annotation.*; - -/** - * 参考 Shiro @RequiresPermissions 设计 http://shiro.apache.org/static/1.3.2/apidocs/org/apache/shiro/authz/annotation/RequiresPermissions.html - * - * 通过将该注解添加到 Controller 的方法上,进行授权鉴定 - * - * ps:目前暂时只有管理员 Admin 使用到 - */ -@Documented -@Target({ElementType.METHOD}) // 暂时不支持 ElementType.TYPE ,因为没有场景 -@Retention(RetentionPolicy.RUNTIME) -public @interface RequiresPermissions { - - /** - * 当有多个标识时,必须全部拥有权限,才可以操作 - * - * @return 权限标识数组 - */ - String[] value() default {}; - -} diff --git a/归档/common/mall-spring-boot-starter-security-admin/pom.xml b/归档/common/mall-spring-boot-starter-security-admin/pom.xml deleted file mode 100644 index 5a11b847d..000000000 --- a/归档/common/mall-spring-boot-starter-security-admin/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - common - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - mall-spring-boot-starter-security-admin - - - - - cn.iocoder.mall - system-service-api - 1.0-SNAPSHOT - - - - - org.springframework.boot - spring-boot-configuration-processor - true - - - - - cn.iocoder.mall - mall-spring-boot-starter-web - 1.0-SNAPSHOT - - - - cn.iocoder.mall - mall-security-annotations - - - - - org.apache.dubbo - dubbo - - - - diff --git a/归档/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/config/AdminSecurityAutoConfiguration.java b/归档/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/config/AdminSecurityAutoConfiguration.java deleted file mode 100644 index c49f6f1d9..000000000 --- a/归档/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/config/AdminSecurityAutoConfiguration.java +++ /dev/null @@ -1,60 +0,0 @@ -package cn.iocoder.mall.security.admin.config; - -import cn.iocoder.mall.security.admin.core.interceptor.AdminDemoInterceptor; -import cn.iocoder.mall.security.admin.core.interceptor.AdminSecurityInterceptor; -import cn.iocoder.mall.web.config.CommonWebAutoConfiguration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.boot.autoconfigure.AutoConfigureAfter; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -@Configuration -@AutoConfigureAfter(CommonWebAutoConfiguration.class) // 在 CommonWebAutoConfiguration 之后自动配置,保证过滤器的顺序 -@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) -@EnableConfigurationProperties(AdminSecurityProperties.class) -public class AdminSecurityAutoConfiguration implements WebMvcConfigurer { - - private Logger logger = LoggerFactory.getLogger(getClass()); - - @Bean - @ConditionalOnMissingBean - public AdminSecurityProperties adminSecurityProperties() { - return new AdminSecurityProperties(); - } - - // ========== 拦截器相关 ========== - - @Bean - public AdminSecurityInterceptor adminSecurityInterceptor() { - return new AdminSecurityInterceptor(); - } - - @Bean - public AdminDemoInterceptor adminDemoInterceptor() { - return new AdminDemoInterceptor(); - } - - @Override - public void addInterceptors(InterceptorRegistry registry) { - AdminSecurityProperties properties = this.adminSecurityProperties(); - // AdminSecurityInterceptor 拦截器 - registry.addInterceptor(this.adminSecurityInterceptor()) - .excludePathPatterns(properties.getIgnorePaths()) - .excludePathPatterns(properties.getDefaultIgnorePaths()); - logger.info("[addInterceptors][加载 AdminSecurityInterceptor 拦截器完成]"); - // AdminDemoInterceptor 拦截器 - if (Boolean.TRUE.equals(properties.getDemo())) { - registry.addInterceptor(this.adminDemoInterceptor()) - .excludePathPatterns(properties.getIgnorePaths()) - .excludePathPatterns(properties.getDefaultIgnorePaths()); - logger.info("[addInterceptors][加载 AdminDemoInterceptor 拦截器完成]"); - } - } - -} diff --git a/归档/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/config/AdminSecurityProperties.java b/归档/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/config/AdminSecurityProperties.java deleted file mode 100644 index 7c36f8350..000000000 --- a/归档/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/config/AdminSecurityProperties.java +++ /dev/null @@ -1,59 +0,0 @@ -package cn.iocoder.mall.security.admin.config; - -import org.springframework.boot.context.properties.ConfigurationProperties; - -@ConfigurationProperties("mall.security.admin") -public class AdminSecurityProperties { - - private static final String[] DEFAULT_IGNORE_PATHS = new String[]{ - // Swagger 相关 - "/doc.html", "/swagger-resources", "/swagger-resources/**", "/webjars/**", - // Actuator 相关 - }; - - /** - * 演示模式 - 默认值(关闭) - */ - private static final Boolean DEFAULT_DEMO = false; - - /** - * 自定义忽略 Path - */ - private String[] ignorePaths = new String[0]; - /** - * 默认忽略 Path - */ - private String[] defaultIgnorePaths = DEFAULT_IGNORE_PATHS; - /** - * 是否开启演示模式 - */ - private Boolean demo = DEFAULT_DEMO; - - public String[] getIgnorePaths() { - return ignorePaths; - } - - public AdminSecurityProperties setIgnorePaths(String[] ignorePaths) { - this.ignorePaths = ignorePaths; - return this; - } - - public String[] getDefaultIgnorePaths() { - return defaultIgnorePaths; - } - - public AdminSecurityProperties setDefaultIgnorePaths(String[] defaultIgnorePaths) { - this.defaultIgnorePaths = defaultIgnorePaths; - return this; - } - - public Boolean getDemo() { - return demo; - } - - public AdminSecurityProperties setDemo(Boolean demo) { - this.demo = demo; - return this; - } - -} diff --git a/归档/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/context/AdminSecurityContext.java b/归档/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/context/AdminSecurityContext.java deleted file mode 100644 index 242797584..000000000 --- a/归档/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/context/AdminSecurityContext.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.iocoder.mall.security.admin.core.context; - -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * Admin Security 上下文 - */ -@Data -@Accessors(chain = true) -public class AdminSecurityContext { - - /** - * 管理员编号 - */ - private Integer adminId; - -} diff --git a/归档/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/context/AdminSecurityContextHolder.java b/归档/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/context/AdminSecurityContextHolder.java deleted file mode 100644 index 357c3c7d4..000000000 --- a/归档/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/context/AdminSecurityContextHolder.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.mall.security.admin.core.context; - -/** - * {@link AdminSecurityContext} Holder - * - * 参考 spring security 的 ThreadLocalSecurityContextHolderStrategy 类,简单实现。 - */ -public class AdminSecurityContextHolder { - - private static final ThreadLocal SECURITY_CONTEXT = new ThreadLocal<>(); - - public static void setContext(AdminSecurityContext context) { - SECURITY_CONTEXT.set(context); - } - - public static AdminSecurityContext getContext() { - AdminSecurityContext ctx = SECURITY_CONTEXT.get(); - // 为空时,设置一个空的进去 - if (ctx == null) { - ctx = new AdminSecurityContext(); - SECURITY_CONTEXT.set(ctx); - } - return ctx; - } - - public static void clear() { - SECURITY_CONTEXT.remove(); - } - - public static Integer getAdminId() { - return getContext().getAdminId(); - } - -} diff --git a/归档/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/interceptor/AdminDemoInterceptor.java b/归档/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/interceptor/AdminDemoInterceptor.java deleted file mode 100644 index 056395c9e..000000000 --- a/归档/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/interceptor/AdminDemoInterceptor.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.iocoder.mall.security.admin.core.interceptor; - -import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; -import cn.iocoder.mall.security.admin.core.context.AdminSecurityContextHolder; -import cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants; -import org.springframework.http.HttpMethod; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.Objects; - -/** - * Admin 演示拦截器 - * - * 这是个比较“奇怪”的拦截器,用于演示的管理员账号,禁止使用 POST 请求,从而实现即达到阉割版的演示的效果,又避免影响了数据 - */ -public class AdminDemoInterceptor extends HandlerInterceptorAdapter { - - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { - // 当 Admin 编号等于 1 时,约定为演示账号 - // TODO 芋艿,后续去优化 - if (Objects.equals(AdminSecurityContextHolder.getAdminId(), 1) - && request.getMethod().equalsIgnoreCase(HttpMethod.POST.toString())) { - throw ServiceExceptionUtil.exception(SystemErrorCodeConstants.PERMISSION_DEMO_PERMISSION_DENY); - } - return true; - } - -} diff --git a/归档/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/interceptor/AdminSecurityInterceptor.java b/归档/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/interceptor/AdminSecurityInterceptor.java deleted file mode 100644 index 2e18d74a1..000000000 --- a/归档/common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/core/interceptor/AdminSecurityInterceptor.java +++ /dev/null @@ -1,96 +0,0 @@ -package cn.iocoder.mall.security.admin.core.interceptor; - -import cn.iocoder.common.framework.enums.UserTypeEnum; -import cn.iocoder.common.framework.exception.GlobalException; -import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; -import cn.iocoder.common.framework.util.CollectionUtils; -import cn.iocoder.common.framework.util.HttpUtil; -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.security.admin.core.context.AdminSecurityContext; -import cn.iocoder.mall.security.admin.core.context.AdminSecurityContextHolder; -import cn.iocoder.mall.systemservice.rpc.oauth.OAuthFeign; -import cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2AccessTokenRespDTO; -import cn.iocoder.mall.systemservice.rpc.permission.PermissionFeign; -import cn.iocoder.mall.systemservice.rpc.permission.dto.PermissionCheckDTO; -import cn.iocoder.mall.web.core.util.CommonWebUtil; -import cn.iocoder.security.annotations.RequiresNone; -import cn.iocoder.security.annotations.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.method.HandlerMethod; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.Arrays; - -import static cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants.UNAUTHORIZED; -import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.OAUTH_USER_TYPE_ERROR; - -public class AdminSecurityInterceptor extends HandlerInterceptorAdapter { - - - @Autowired - private OAuthFeign oAuthFeign; - @Autowired - private PermissionFeign permissionFeign; - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { - // 获得访问令牌 - Integer adminId = this.obtainAdminId(request); - // 校验认证 - this.checkAuthentication((HandlerMethod) handler, adminId); - // 校验权限 - this.checkPermission((HandlerMethod) handler, adminId); - return true; - } - - private Integer obtainAdminId(HttpServletRequest request) { - String accessToken = HttpUtil.obtainAuthorization(request); - Integer adminId = null; - if (accessToken != null) { - CommonResult checkAccessTokenResult = oAuthFeign.checkAccessToken(accessToken); - checkAccessTokenResult.checkError(); - // 校验用户类型正确 - if (!UserTypeEnum.ADMIN.getValue().equals(checkAccessTokenResult.getData().getUserType())) { - throw ServiceExceptionUtil.exception(OAUTH_USER_TYPE_ERROR); - } - // 获得用户编号 - adminId = checkAccessTokenResult.getData().getUserId(); - // 设置到 Request 中 - CommonWebUtil.setUserId(request, adminId); - CommonWebUtil.setUserType(request, UserTypeEnum.ADMIN.getValue()); - // 设置到 - AdminSecurityContext adminSecurityContext = new AdminSecurityContext().setAdminId(adminId); - AdminSecurityContextHolder.setContext(adminSecurityContext); - } - return adminId; - } - - private void checkAuthentication(HandlerMethod handlerMethod, Integer adminId) { - boolean requiresAuthenticate = !handlerMethod.hasMethodAnnotation(RequiresNone.class); // 对于 ADMIN 来说,默认需登录 - if (requiresAuthenticate && adminId == null) { - throw new GlobalException(UNAUTHORIZED); - } - } - - private void checkPermission(HandlerMethod handlerMethod, Integer adminId) { - RequiresPermissions requiresPermissions = handlerMethod.getMethodAnnotation(RequiresPermissions.class); - if (requiresPermissions == null) { - return; - } - String[] permissions = requiresPermissions.value(); - if (CollectionUtils.isEmpty(permissions)) { - return; - } - // 权限验证 - permissionFeign.checkPermission(new PermissionCheckDTO().setAdminId(adminId).setPermissions(Arrays.asList(permissions))) - .checkError(); - } - - @Override - public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { - // 清空 SecurityContext - AdminSecurityContextHolder.clear(); - } - -} diff --git a/归档/common/mall-spring-boot-starter-security-admin/src/main/resources/META-INF/spring.factories b/归档/common/mall-spring-boot-starter-security-admin/src/main/resources/META-INF/spring.factories deleted file mode 100644 index f9774e1c8..000000000 --- a/归档/common/mall-spring-boot-starter-security-admin/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ - cn.iocoder.mall.security.admin.config.AdminSecurityAutoConfiguration diff --git a/归档/common/mall-spring-boot-starter-security-user/pom.xml b/归档/common/mall-spring-boot-starter-security-user/pom.xml deleted file mode 100644 index c998755a4..000000000 --- a/归档/common/mall-spring-boot-starter-security-user/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - common - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - mall-spring-boot-starter-security-user - - - - - cn.iocoder.mall - system-service-api - 1.0-SNAPSHOT - - - - - org.springframework.boot - spring-boot-configuration-processor - true - - - - - cn.iocoder.mall - mall-spring-boot-starter-web - - - - cn.iocoder.mall - mall-security-annotations - - - - - org.apache.dubbo - dubbo - - - - diff --git a/归档/common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/config/UserSecurityAutoConfiguration.java b/归档/common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/config/UserSecurityAutoConfiguration.java deleted file mode 100644 index 68d4cdacc..000000000 --- a/归档/common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/config/UserSecurityAutoConfiguration.java +++ /dev/null @@ -1,47 +0,0 @@ -package cn.iocoder.mall.security.user.config; - -import cn.iocoder.mall.security.user.core.interceptor.UserSecurityInterceptor; -import cn.iocoder.mall.web.config.CommonWebAutoConfiguration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.boot.autoconfigure.AutoConfigureAfter; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -@Configuration -@AutoConfigureAfter(CommonWebAutoConfiguration.class) // 在 CommonWebAutoConfiguration 之后自动配置,保证过滤器的顺序 -@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) -@EnableConfigurationProperties(UserSecurityProperties.class) -public class UserSecurityAutoConfiguration implements WebMvcConfigurer { - - private Logger logger = LoggerFactory.getLogger(getClass()); - - @Bean - @ConditionalOnMissingBean - public UserSecurityProperties userSecurityProperties() { - return new UserSecurityProperties(); - } - - // ========== 拦截器相关 ========== - - @Bean - public UserSecurityInterceptor userSecurityInterceptor() { - return new UserSecurityInterceptor(); - } - - @Override - public void addInterceptors(InterceptorRegistry registry) { - UserSecurityProperties properties = this.userSecurityProperties(); - // UserSecurityInterceptor 拦截器 - registry.addInterceptor(this.userSecurityInterceptor()) - .excludePathPatterns(properties.getIgnorePaths()) - .excludePathPatterns(properties.getDefaultIgnorePaths());; - logger.info("[addInterceptors][加载 UserSecurityInterceptor 拦截器完成]"); - } - -} diff --git a/归档/common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/config/UserSecurityProperties.java b/归档/common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/config/UserSecurityProperties.java deleted file mode 100644 index 7957b9114..000000000 --- a/归档/common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/config/UserSecurityProperties.java +++ /dev/null @@ -1,41 +0,0 @@ -package cn.iocoder.mall.security.user.config; - -import org.springframework.boot.context.properties.ConfigurationProperties; - -@ConfigurationProperties("mall.security.user") -public class UserSecurityProperties { - - private static final String[] DEFAULT_IGNORE_PATHS = new String[]{ - // Swagger 相关 - "/doc.html", "/swagger-resources", "/swagger-resources/**", "/webjars/**", - // Actuator 相关 - }; - - /** - * 自定义忽略 Path - */ - private String[] ignorePaths = new String[0]; - /** - * 默认忽略 Path - */ - private String[] defaultIgnorePaths = DEFAULT_IGNORE_PATHS; - - public String[] getIgnorePaths() { - return ignorePaths; - } - - public UserSecurityProperties setIgnorePaths(String[] ignorePaths) { - this.ignorePaths = ignorePaths; - return this; - } - - public String[] getDefaultIgnorePaths() { - return defaultIgnorePaths; - } - - public UserSecurityProperties setDefaultIgnorePaths(String[] defaultIgnorePaths) { - this.defaultIgnorePaths = defaultIgnorePaths; - return this; - } - -} diff --git a/归档/common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/core/context/UserSecurityContext.java b/归档/common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/core/context/UserSecurityContext.java deleted file mode 100644 index 12ff0904e..000000000 --- a/归档/common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/core/context/UserSecurityContext.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.iocoder.mall.security.user.core.context; - -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * User Security 上下文 - */ -@Data -@Accessors(chain = true) -public class UserSecurityContext { - - /** - * 用户编号 - */ - private Integer userId; - -} diff --git a/归档/common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/core/context/UserSecurityContextHolder.java b/归档/common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/core/context/UserSecurityContextHolder.java deleted file mode 100644 index 14702639b..000000000 --- a/归档/common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/core/context/UserSecurityContextHolder.java +++ /dev/null @@ -1,35 +0,0 @@ -package cn.iocoder.mall.security.user.core.context; - -/** - * {@link UserSecurityContext} Holder - * - * 参考 spring security 的 ThreadLocalSecurityContextHolderStrategy 类,简单实现。 - */ -public class UserSecurityContextHolder { - - private static final ThreadLocal SECURITY_CONTEXT = new ThreadLocal(); - - public static void setContext(UserSecurityContext context) { - SECURITY_CONTEXT.set(context); - } - - public static UserSecurityContext getContext() { - UserSecurityContext ctx = SECURITY_CONTEXT.get(); - // 为空时,设置一个空的进去 - if (ctx == null) { - ctx = new UserSecurityContext(); - SECURITY_CONTEXT.set(ctx); - } - return ctx; - } - - public static Integer getUserId() { - UserSecurityContext ctx = SECURITY_CONTEXT.get(); - return ctx != null ? ctx.getUserId() : null; - } - - public static void clear() { - SECURITY_CONTEXT.remove(); - } - -} diff --git a/归档/common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/core/interceptor/UserSecurityInterceptor.java b/归档/common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/core/interceptor/UserSecurityInterceptor.java deleted file mode 100644 index 2de13636c..000000000 --- a/归档/common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/core/interceptor/UserSecurityInterceptor.java +++ /dev/null @@ -1,77 +0,0 @@ -package cn.iocoder.mall.security.user.core.interceptor; - -import cn.iocoder.common.framework.enums.UserTypeEnum; -import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; -import cn.iocoder.common.framework.util.HttpUtil; -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.security.user.core.context.UserSecurityContext; -import cn.iocoder.mall.security.user.core.context.UserSecurityContextHolder; -import cn.iocoder.mall.systemservice.rpc.oauth.OAuthFeign; -import cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2AccessTokenRespDTO; -import cn.iocoder.mall.web.core.util.CommonWebUtil; -import cn.iocoder.security.annotations.RequiresAuthenticate; -import cn.iocoder.security.annotations.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.method.HandlerMethod; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import static cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants.UNAUTHORIZED; -import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.OAUTH_USER_TYPE_ERROR; - -public class UserSecurityInterceptor extends HandlerInterceptorAdapter { - - @Autowired - private OAuthFeign oAuthFeign; - - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { - // 获得访问令牌 - Integer userId = this.obtainUserId(request); - // 校验认证 - this.checkAuthentication((HandlerMethod) handler, userId); - return true; - } - - private Integer obtainUserId(HttpServletRequest request) { - String accessToken = HttpUtil.obtainAuthorization(request); - Integer userId = null; - if (accessToken != null) { - CommonResult checkAccessTokenResult = oAuthFeign.checkAccessToken(accessToken); - checkAccessTokenResult.checkError(); - // 校验用户类型正确 - if (!UserTypeEnum.USER.getValue().equals(checkAccessTokenResult.getData().getUserType())) { - throw ServiceExceptionUtil.exception(OAUTH_USER_TYPE_ERROR); - } - // 获得用户编号 - userId = checkAccessTokenResult.getData().getUserId(); - // 设置到 Request 中 - CommonWebUtil.setUserId(request, userId); - CommonWebUtil.setUserType(request, UserTypeEnum.USER.getValue()); - // 设置到 - UserSecurityContext userSecurityContext = new UserSecurityContext().setUserId(userId); - UserSecurityContextHolder.setContext(userSecurityContext); - } - return userId; - } - - private void checkAuthentication(HandlerMethod handlerMethod, Integer userId) { - boolean requiresAuthenticate = false; // 对于 USER 来说,默认无需登录 - if (handlerMethod.hasMethodAnnotation(RequiresAuthenticate.class) - || handlerMethod.hasMethodAnnotation(RequiresPermissions.class)) { // 如果需要权限验证,也认为需要认证 - requiresAuthenticate = true; - } - if (requiresAuthenticate && userId == null) { - throw ServiceExceptionUtil.exception(UNAUTHORIZED); - } - } - - @Override - public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { - // 清空 SecurityContext - UserSecurityContextHolder.clear(); - } - -} diff --git a/归档/common/mall-spring-boot-starter-security-user/src/main/resources/META-INF/spring.factories b/归档/common/mall-spring-boot-starter-security-user/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 716481f0a..000000000 --- a/归档/common/mall-spring-boot-starter-security-user/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ - cn.iocoder.mall.security.user.config.UserSecurityAutoConfiguration diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/ManagementWebApplication.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/ManagementWebApplication.java deleted file mode 100644 index 7e141a365..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/ManagementWebApplication.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.iocoder.mall.managementweb; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.cloud.openfeign.EnableFeignClients; - -@SpringBootApplication -@EnableDiscoveryClient -@EnableFeignClients(basePackages = {"cn.iocoder.mall.productservice.rpc","cn.iocoder.mall.payservice.rpc" -,"cn.iocoder.mall.promotion.api.rpc","cn.iocoder.mall.systemservice.rpc","cn.iocoder.mall.userservice.rpc"}) -public class ManagementWebApplication { - - public static void main(String[] args) { - SpringApplication.run(ManagementWebApplication.class, args); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/client/pay/transaction/PayTransactionClient.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/client/pay/transaction/PayTransactionClient.java deleted file mode 100644 index 81831a472..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/client/pay/transaction/PayTransactionClient.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.iocoder.mall.managementweb.client.pay.transaction; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.payservice.rpc.transaction.PayTransactionFeign; -import cn.iocoder.mall.payservice.rpc.transaction.dto.PayTransactionPageReqDTO; -import cn.iocoder.mall.payservice.rpc.transaction.dto.PayTransactionRespDTO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class PayTransactionClient { - - - @Autowired - private PayTransactionFeign payTransactionFeign; - public PageResult pagePayTransaction(PayTransactionPageReqDTO pageReqDTO) { - CommonResult> pagePayTransactionResult = payTransactionFeign.pagePayTransaction(pageReqDTO); - pagePayTransactionResult.checkError(); - return pagePayTransactionResult.getData(); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/AdminController.http b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/AdminController.http deleted file mode 100644 index d02f18830..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/AdminController.http +++ /dev/null @@ -1,41 +0,0 @@ -### /admin/page 成功 -GET http://127.0.0.1:18083/management-api/admin/page?pageNo=1&pageSize=10 -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### /admin/create 成功 -POST http://127.0.0.1:18083/management-api/admin/create -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -username=admin02&password=buzhidao&name=测试管理员&departmentId=1 - -### /admin/update 成功 -POST http://127.0.0.1:18083/management-api/admin/update -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -id=31&username=admin02&password=buzhidao&name=测试管理员&departmentId=1 - -### /admin/update-status 成功 -POST http://127.0.0.1:18083/management-api/admin/update-status -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -adminId=31&status=1 - -### /admin/update-status 失败,参数缺失 -POST http://127.0.0.1:18083/management-api/admin/update-status -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -adminId=31 - -### admin/update-status 失败,地址不存在 -GET http://127.0.0.1:18083/management-api/admin/update-status--- -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -adminId=31&status=sss - -### diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/AdminController.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/AdminController.java deleted file mode 100644 index 6b530fee4..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/AdminController.java +++ /dev/null @@ -1,67 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.admin; - -import cn.iocoder.common.framework.util.HttpUtil; -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.admin.dto.AdminCreateDTO; -import cn.iocoder.mall.managementweb.controller.admin.dto.AdminPageDTO; -import cn.iocoder.mall.managementweb.controller.admin.dto.AdminUpdateInfoDTO; -import cn.iocoder.mall.managementweb.controller.admin.dto.AdminUpdateStatusDTO; -import cn.iocoder.mall.managementweb.controller.admin.vo.AdminPageItemVO; -import cn.iocoder.mall.managementweb.manager.admin.AdminManager; -import cn.iocoder.mall.security.admin.core.context.AdminSecurityContextHolder; -import cn.iocoder.security.annotations.RequiresPermissions; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.servlet.http.HttpServletRequest; -import javax.validation.Valid; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -@Api(tags = "管理员 API") -@RestController -@RequestMapping("/admin") -@Validated -public class AdminController { - - @Autowired - private AdminManager adminManager; - - @ApiOperation(value = "管理员分页") - @GetMapping("/page") - @RequiresPermissions("system:admin:page") - public CommonResult> page(AdminPageDTO adminPageDTO) { - return success(adminManager.pageAdmin(adminPageDTO)); - } - - @ApiOperation(value = "创建管理员") - @PostMapping("/create") - @RequiresPermissions("system:admin:create") - public CommonResult createAdmin(AdminCreateDTO createDTO, HttpServletRequest request) { - return success(adminManager.createAdmin(createDTO, AdminSecurityContextHolder.getAdminId(), HttpUtil.getIp(request))); - } - - @PostMapping("/update") - @ApiOperation(value = "更新管理员") - @RequiresPermissions("system:admin:update") - public CommonResult updateAdmin(AdminUpdateInfoDTO updateInfoDTO) { - adminManager.updateAdmin(updateInfoDTO); - return success(true); - } - - @PostMapping("/update-status") - @ApiOperation(value = "更新管理员状态") - @RequiresPermissions("system:admin:update-status") - public CommonResult updateAdminStatus(@Valid AdminUpdateStatusDTO updateStatusDTO) { - adminManager.updateAdminStatus(updateStatusDTO); - return success(true); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/DepartmentController.http b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/DepartmentController.http deleted file mode 100644 index b43f64d43..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/DepartmentController.http +++ /dev/null @@ -1,39 +0,0 @@ -### /department/create 成功 -POST http://127.0.0.1:18083/management-api/department/create -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma -dubbo-tag: {{dubboTag}} - -name=测试部门&pid=0&sort=0 - -### /department/update 成功 -POST http://127.0.0.1:18083/management-api/department/update -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -id=1&name=测试部门&pid=0&sort=0 - -### /resource/delete 成功 -POST http://127.0.0.1:18083/management-api/department/delete -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -id=1 - -### /department/get 成功 -GET http://127.0.0.1:18083/management-api/department/get?departmentId=1 -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### /department/list 成功 -GET http://127.0.0.1:18083/management-api/department/list?departmentIds=1,13 -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### /department/tree 成功 -GET http://127.0.0.1:18083/management-api/department/tree -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### - diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/DepartmentController.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/DepartmentController.java deleted file mode 100644 index 6a1b92499..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/DepartmentController.java +++ /dev/null @@ -1,81 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.admin; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.managementweb.controller.admin.dto.DepartmentCreateDTO; -import cn.iocoder.mall.managementweb.controller.admin.dto.DepartmentUpdateDTO; -import cn.iocoder.mall.managementweb.controller.admin.vo.DepartmentTreeNodeVO; -import cn.iocoder.mall.managementweb.controller.admin.vo.DepartmentVO; -import cn.iocoder.mall.managementweb.manager.admin.DepartmentManager; -import cn.iocoder.security.annotations.RequiresPermissions; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.List; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** -* 部门 Controller -*/ -@RestController -@RequestMapping("/department") -@Api(tags = "部门") -@Validated -public class DepartmentController { - - @Autowired - private DepartmentManager departmentManager; - - @PostMapping("/create") - @ApiOperation("创建部门") - @RequiresPermissions("system:department:create") - public CommonResult createDepartment(@Valid DepartmentCreateDTO createDTO) { - return success(departmentManager.createDepartment(createDTO)); - } - - @PostMapping("/update") - @ApiOperation("更新部门") - @RequiresPermissions("system:department:update") - public CommonResult updateDepartment(@Valid DepartmentUpdateDTO updateDTO) { - departmentManager.updateDepartment(updateDTO); - return success(true); - } - - @PostMapping("/delete") - @ApiOperation("删除部门") - @ApiImplicitParam(name = "departmentId", value = "部门编号", required = true) - @RequiresPermissions("system:department:delete") - public CommonResult deleteDepartment(@RequestParam("departmentId") Integer departmentId) { - departmentManager.deleteDepartment(departmentId); - return success(true); - } - - @GetMapping("/get") - @ApiOperation("获得部门") - @ApiImplicitParam(name = "departmentId", value = "部门编号", required = true) - @RequiresPermissions("system:department:tree") - public CommonResult getDepartment(@RequestParam("departmentId") Integer departmentId) { - return success(departmentManager.getDepartment(departmentId)); - } - - @GetMapping("/list") - @ApiOperation("获得部门列表") - @ApiImplicitParam(name = "departmentIds", value = "部门编号列表", required = true) - @RequiresPermissions("system:department:tree") - public CommonResult> listDepartments(@RequestParam("departmentIds") List departmentIds) { - return success(departmentManager.listDepartments(departmentIds)); - } - - @GetMapping("/tree") - @ApiOperation("获得部门树") - @RequiresPermissions("system:department:tree") - public CommonResult> treeDepartment() { - return success(departmentManager.treeDepartment()); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/dto/AdminCreateDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/dto/AdminCreateDTO.java deleted file mode 100644 index 45c6a4f20..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/dto/AdminCreateDTO.java +++ /dev/null @@ -1,38 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.admin.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; - -@ApiModel("管理员创建 DTO") -@Data -@Accessors(chain = true) -public class AdminCreateDTO { - - @ApiModelProperty(value = "真实名字", required = true, example = "小王") - @NotEmpty(message = "真实名字不能为空") - @Length(max = 10, message = "真实名字长度最大为 10 位") - private String name; - - @ApiModelProperty(value = "部门编号", required = true, example = "1") - @NotNull(message = "部门不能为空") - private Integer departmentId; - - @ApiModelProperty(value = "登陆账号", required = true, example = "15601691300") - @NotEmpty(message = "登陆账号不能为空") - @Length(min = 5, max = 16, message = "账号长度为 5-16 位") - @Pattern(regexp = "^[A-Za-z0-9]+$", message = "账号格式为数字以及字母") - private String username; - - @ApiModelProperty(value = "密码", required = true, example = "buzhidao") - @NotEmpty(message = "密码不能为空") - @Length(min = 4, max = 16, message = "密码长度为 4-16 位") - private String password; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/dto/AdminPageDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/dto/AdminPageDTO.java deleted file mode 100644 index b921afbd0..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/dto/AdminPageDTO.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.admin.dto; - -import cn.iocoder.common.framework.vo.PageParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -@ApiModel("管理员分页查询 DTO") -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class AdminPageDTO extends PageParam { - - @ApiModelProperty(value = "真实名字,模糊匹配", example = "小王") - private String name; - - @ApiModelProperty(value = "部门编号") - private Integer departmentId; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/dto/AdminUpdateInfoDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/dto/AdminUpdateInfoDTO.java deleted file mode 100644 index 929481244..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/dto/AdminUpdateInfoDTO.java +++ /dev/null @@ -1,42 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.admin.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; - -@ApiModel("管理员更新信息 DTO") -@Data -@Accessors(chain = true) -public class AdminUpdateInfoDTO { - - @ApiModelProperty(value = "管理员编号", required = true, example = "1") - @NotNull(message = "管理员编号不能为空") - private Integer id; - - @ApiModelProperty(value = "登陆账号", required = true, example = "15601691300") - @NotEmpty(message = "登陆账号不能为空") - @Length(min = 5, max = 16, message = "账号长度为 5-16 位") - @Pattern(regexp = "^[A-Za-z0-9]+$", message = "账号格式为数字以及字母") - private String username; - - @ApiModelProperty(value = "密码", required = true, example = "buzhidao") - @NotEmpty(message = "密码不能为空") - @Length(min = 4, max = 16, message = "密码长度为 4-16 位") - private String password; - - @ApiModelProperty(value = "真实名字", required = true, example = "小王") - @NotEmpty(message = "真实名字不能为空") - @Length(max = 10, message = "真实名字长度最大为 10 位") - private String name; - - @ApiModelProperty(value = "部门编号", required = true, example = "1") - @NotNull(message = "部门不能为空") - private Integer departmentId; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/dto/AdminUpdateStatusDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/dto/AdminUpdateStatusDTO.java deleted file mode 100644 index 8a19ad31d..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/dto/AdminUpdateStatusDTO.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.admin.dto; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; - -@ApiModel("管理员更新状态 DTO") -@Data -@Accessors(chain = true) -public class AdminUpdateStatusDTO { - - @ApiModelProperty(value = "管理员编号", required = true, example = "1") - @NotNull(message = "管理员编号不能为空") - private Integer adminId; - - @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举") - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/dto/DepartmentCreateDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/dto/DepartmentCreateDTO.java deleted file mode 100644 index f85d73213..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/dto/DepartmentCreateDTO.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.admin.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("部门创建 DTO") -@Data -public class DepartmentCreateDTO { - - @ApiModelProperty(value = "部门名称", required = true, example = "技术部") - @NotEmpty(message = "部门名称不能为空") - private String name; - @ApiModelProperty(value = "排序字段", required = true, example = "1024") - @NotNull(message = "排序字段不能为空") - private Integer sort; - @ApiModelProperty(value = "父级部门编号", required = true, example = "2048") - @NotNull(message = "父级部门编号不能为空") - private Integer pid; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/dto/DepartmentUpdateDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/dto/DepartmentUpdateDTO.java deleted file mode 100644 index 5e18118da..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/dto/DepartmentUpdateDTO.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.admin.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("部门更新 DTO") -@Data -public class DepartmentUpdateDTO { - - @ApiModelProperty(value = "部门编号", required = true, example = "1") - @NotNull(message = "部门编号不能为空") - private Integer id; - @ApiModelProperty(value = "部门名称", required = true, example = "技术部") - @NotEmpty(message = "部门名称不能为空") - private String name; - @ApiModelProperty(value = "排序字段", required = true, example = "1024") - @NotNull(message = "排序字段不能为空") - private Integer sort; - @ApiModelProperty(value = "父级部门编号", required = true, example = "2048") - @NotNull(message = "父级部门编号不能为空") - private Integer pid; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/vo/AdminPageItemVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/vo/AdminPageItemVO.java deleted file mode 100644 index 5c128d3c6..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/vo/AdminPageItemVO.java +++ /dev/null @@ -1,62 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.admin.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; -import java.util.List; - -@ApiModel(value = "分页时,管理员的信息 VO") -@Data -@Accessors(chain = true) -public class AdminPageItemVO { - - @ApiModel("角色") - @Data - @Accessors(chain = true) - public static class Role { - - @ApiModelProperty(value = "角色编号", required = true, example = "1") - private Integer id; - - @ApiModelProperty(value = "角色名", required = true, example = "码神") - private String name; - - } - - @ApiModel("部门") - @Data - @Accessors(chain = true) - public static class Department { - - @ApiModelProperty(value = "部门编号", required = true, example = "1") - private Integer id; - - @ApiModelProperty(value = "部门名称", required = true, example = "研发部") - private String name; - - } - - @ApiModelProperty(value = "管理员编号", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "真实名字", required = true, example = "小王") - private String name; - @ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式") - private Date createTime; - @ApiModelProperty(value = "在职状态", required = true, example = "1", notes = "见 AdminStatusEnum 枚举") - private Integer status; - @ApiModelProperty(value = "登陆账号", required = true, example = "15601691300") - private String username; - - /** - * 角色列表 - */ - private List roles; - /** - * 所在部门 - */ - private Department department; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/vo/AdminVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/vo/AdminVO.java deleted file mode 100644 index 960359e62..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/vo/AdminVO.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.admin.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; - -@ApiModel(value = "管理员 VO") -@Data -@Accessors(chain = true) -public class AdminVO { - - @ApiModelProperty(value = "管理员编号", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "真实名字", required = true, example = "小王") - private String name; - @ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式") - private Date createTime; - @ApiModelProperty(value = "在职状态", required = true, example = "1", notes = "见 AdminStatusEnum 枚举") - private Integer status; - @ApiModelProperty(value = "登陆账号", required = true, example = "15601691300") - private String username; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/vo/DepartmentTreeNodeVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/vo/DepartmentTreeNodeVO.java deleted file mode 100644 index 014a256b1..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/vo/DepartmentTreeNodeVO.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.admin.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.Date; -import java.util.List; - -@ApiModel("部门树节点 VO") -@Data -public class DepartmentTreeNodeVO { - - @ApiModelProperty(value = "部门编号", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "部门名称", required = true, example = "技术部") - private String name; - @ApiModelProperty(value = "排序字段", required = true, example = "1024") - private Integer sort; - @ApiModelProperty(value = "父级部门编号", required = true, example = "2048") - private Integer pid; - @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; - - /** - * 子节点 - */ - private List children; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/vo/DepartmentVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/vo/DepartmentVO.java deleted file mode 100644 index a8fa692b7..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/admin/vo/DepartmentVO.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.admin.vo; - -import lombok.*; -import io.swagger.annotations.*; -import java.util.*; - -@ApiModel("部门 VO") -@Data -public class DepartmentVO { - - @ApiModelProperty(value = "部门编号", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "部门名称", required = true, example = "技术部") - private String name; - @ApiModelProperty(value = "排序字段", required = true, example = "1024") - private Integer sort; - @ApiModelProperty(value = "父级部门编号", required = true, example = "2048") - private Integer pid; - @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/datadict/DataDictController.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/datadict/DataDictController.java deleted file mode 100644 index 87328d264..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/datadict/DataDictController.java +++ /dev/null @@ -1,88 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.datadict; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.managementweb.controller.datadict.dto.DataDictCreateDTO; -import cn.iocoder.mall.managementweb.controller.datadict.dto.DataDictUpdateDTO; -import cn.iocoder.mall.managementweb.controller.datadict.vo.DataDictSimpleVO; -import cn.iocoder.mall.managementweb.controller.datadict.vo.DataDictVO; -import cn.iocoder.mall.managementweb.manager.datadict.DataDictManager; -import cn.iocoder.security.annotations.RequiresPermissions; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.List; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** -* 数据字典 Controller -*/ -@RestController -@RequestMapping("/data-dict") -@Api(tags = "数据字典") -@Validated -public class DataDictController { - - @Autowired - private DataDictManager dataDictManager; - - @PostMapping("/create") - @ApiOperation("创建数据字典") - @RequiresPermissions("system:data-dict:create") - public CommonResult createDataDict(@Valid DataDictCreateDTO createDTO) { - return success(dataDictManager.createDataDict(createDTO)); - } - - @PostMapping("/update") - @ApiOperation("更新数据字典") - @RequiresPermissions("system:data-dict:update") - public CommonResult updateDataDict(@Valid DataDictUpdateDTO updateDTO) { - dataDictManager.updateDataDict(updateDTO); - return success(true); - } - - @PostMapping("/delete") - @ApiOperation("删除数据字典") - @ApiImplicitParam(name = "dataDictId", value = "数据字典编号", required = true) - @RequiresPermissions("system:data-dict:delete") - public CommonResult deleteDataDict(@RequestParam("dataDictId") Integer dataDictId) { - dataDictManager.deleteDataDict(dataDictId); - return success(true); - } - - @GetMapping("/get") - @ApiOperation("获得数据字典") - @ApiImplicitParam(name = "dataDictId", value = "数据字典编号", required = true) - @RequiresPermissions("system:data-dict:list") - public CommonResult getDataDict(@RequestParam("dataDictId") Integer dataDictId) { - return success(dataDictManager.getDataDict(dataDictId)); - } - - @GetMapping("/list") - @ApiOperation("获得数据字典列表") - @ApiImplicitParam(name = "dataDictIds", value = "数据字典编号列表", required = true) - @RequiresPermissions("system:data-dict:list") - public CommonResult> listDataDicts(@RequestParam("dataDictIds") List dataDictIds) { - return success(dataDictManager.listDataDicts(dataDictIds)); - } - - @GetMapping("/list-all") - @ApiOperation("获得全部数据字典列表") - @RequiresPermissions("system:data-dict:list") - public CommonResult> listDataDicts() { - return success(dataDictManager.listDataDicts()); - } - - @GetMapping("/list-all-simple") - @ApiOperation(value = "获得全部数据字典列表", notes = "一般用于管理后台缓存数据字典在本地") - // 无需添加权限认证,因为前端全局都需要 - public CommonResult> listSimpleDataDicts() { - return success(dataDictManager.listSimpleDataDicts()); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/datadict/dto/DataDictCreateDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/datadict/dto/DataDictCreateDTO.java deleted file mode 100644 index 5a5403fd4..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/datadict/dto/DataDictCreateDTO.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.datadict.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("数据字典创建 DTO") -@Data -public class DataDictCreateDTO { - - @ApiModelProperty(value = "大类枚举值", required = true, example = "gender") - @NotEmpty(message = "大类枚举值不能为空") - private String enumValue; - @ApiModelProperty(value = "小类数值", required = true, example = "1") - @NotEmpty(message = "小类数值不能为空") - private String value; - @ApiModelProperty(value = "展示名", required = true, example = "男") - @NotEmpty(message = "展示名不能为空") - private String displayName; - @ApiModelProperty(value = "排序值", required = true, example = "1") - @NotNull(message = "排序值不能为空") - private Integer sort; - @ApiModelProperty(value = "备注", example = "性别 - 男(嗨)") - private String memo; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/datadict/dto/DataDictUpdateDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/datadict/dto/DataDictUpdateDTO.java deleted file mode 100644 index 32c705ab1..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/datadict/dto/DataDictUpdateDTO.java +++ /dev/null @@ -1,32 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.datadict.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("数据字典更新 DTO") -@Data -public class DataDictUpdateDTO { - - @ApiModelProperty(value = "编号", required = true, example = "1024") - @NotNull(message = "编号不能为空") - private Integer id; - @ApiModelProperty(value = "大类枚举值", required = true, example = "gender") - @NotEmpty(message = "大类枚举值不能为空") - private String enumValue; - @ApiModelProperty(value = "小类数值", required = true, example = "1") - @NotEmpty(message = "小类数值不能为空") - private String value; - @ApiModelProperty(value = "展示名", required = true, example = "男") - @NotEmpty(message = "展示名不能为空") - private String displayName; - @ApiModelProperty(value = "排序值", required = true, example = "1") - @NotNull(message = "排序值不能为空") - private Integer sort; - @ApiModelProperty(value = "备注", example = "性别 - 男(嗨)") - private String memo; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/datadict/vo/DataDictSimpleVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/datadict/vo/DataDictSimpleVO.java deleted file mode 100644 index 784b56acc..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/datadict/vo/DataDictSimpleVO.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.datadict.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; - -@ApiModel("数据字典精简 VO") -@Data -public class DataDictSimpleVO { - - @ApiModelProperty(value = "大类枚举值", required = true, example = "gender") - private String enumValue; - @ApiModelProperty(value = "小类数值", required = true, example = "1") - private String value; - @ApiModelProperty(value = "展示名", required = true, example = "男") - private String displayName; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/datadict/vo/DataDictVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/datadict/vo/DataDictVO.java deleted file mode 100644 index 146c8c88a..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/datadict/vo/DataDictVO.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.datadict.vo; - -import lombok.*; -import io.swagger.annotations.*; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.util.*; - -@ApiModel("数据字典 VO") -@Data -public class DataDictVO { - - @ApiModelProperty(value = "编号", required = true, example = "1024") - @NotNull(message = "编号不能为空") - private Integer id; - @ApiModelProperty(value = "大类枚举值", required = true, example = "gender") - @NotEmpty(message = "大类枚举值不能为空") - private String enumValue; - @ApiModelProperty(value = "小类数值", required = true, example = "1") - @NotEmpty(message = "小类数值不能为空") - private String value; - @ApiModelProperty(value = "展示名", required = true, example = "男") - @NotEmpty(message = "展示名不能为空") - private String displayName; - @ApiModelProperty(value = "排序值", required = true, example = "1") - @NotNull(message = "排序值不能为空") - private Integer sort; - @ApiModelProperty(value = "备注", example = "性别 - 男(嗨)") - private String memo; - @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/errorcode/ErrorCodeController.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/errorcode/ErrorCodeController.java deleted file mode 100644 index de43d18d2..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/errorcode/ErrorCodeController.java +++ /dev/null @@ -1,73 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.errorcode; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.errorcode.dto.ErrorCodeCreateDTO; -import cn.iocoder.mall.managementweb.controller.errorcode.dto.ErrorCodePageDTO; -import cn.iocoder.mall.managementweb.controller.errorcode.dto.ErrorCodeUpdateDTO; -import cn.iocoder.mall.managementweb.controller.errorcode.vo.ErrorCodeVO; -import cn.iocoder.mall.managementweb.manager.errorcode.ErrorCodeManager; -import cn.iocoder.security.annotations.RequiresPermissions; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** -* 错误码 Controller -*/ -@RestController -@RequestMapping("/error-code") -@Api(tags = "错误码") -@Validated -public class ErrorCodeController { - - @Autowired - private ErrorCodeManager errorCodeManager; - - @PostMapping("/create") - @ApiOperation("创建错误码") - @RequiresPermissions("system:error-code:create") - public CommonResult createErrorCode(@Valid ErrorCodeCreateDTO createDTO) { - return success(errorCodeManager.createErrorCode(createDTO)); - } - - @PostMapping("/update") - @ApiOperation("更新错误码") - @RequiresPermissions("system:error-code:update") - public CommonResult updateErrorCode(@Valid ErrorCodeUpdateDTO updateDTO) { - errorCodeManager.updateErrorCode(updateDTO); - return success(true); - } - - @PostMapping("/delete") - @ApiOperation("删除错误码") - @ApiImplicitParam(name = "errorCodeId", value = "错误码编号", required = true) - @RequiresPermissions("system:error-code:delete") - public CommonResult deleteErrorCode(@RequestParam("errorCodeId") Integer errorCodeId) { - errorCodeManager.deleteErrorCode(errorCodeId); - return success(true); - } - - @GetMapping("/get") - @ApiOperation("获得错误码") - @ApiImplicitParam(name = "errorCodeId", value = "错误码编号", required = true) - @RequiresPermissions("system:error-code:page") - public CommonResult getErrorCode(@RequestParam("errorCodeId") Integer errorCodeId) { - return success(errorCodeManager.getErrorCode(errorCodeId)); - } - - @GetMapping("/page") - @ApiOperation("获得错误码分页") - @RequiresPermissions("system:error-code:page") - public CommonResult> pageErrorCode(ErrorCodePageDTO pageDTO) { - return success(errorCodeManager.pageErrorCode(pageDTO)); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/errorcode/dto/ErrorCodeCreateDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/errorcode/dto/ErrorCodeCreateDTO.java deleted file mode 100644 index 4abcdba2d..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/errorcode/dto/ErrorCodeCreateDTO.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.errorcode.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("错误码创建 DTO") -@Data -public class ErrorCodeCreateDTO { - - @ApiModelProperty(value = "错误码编码", required = true, example = "10086") - @NotNull(message = "错误码编码不能为空") - private Integer code; - @ApiModelProperty(value = "错误码错误提示", required = true, example = "艿艿长的丑") - @NotEmpty(message = "错误码错误提示不能为空") - private String message; - @ApiModelProperty(value = "错误码分组", required = true, example = "user-service") - @NotEmpty(message = "错误码分组不能为空") - private String group; - @ApiModelProperty(value = "错误码备注", example = "我就是一个备注") - private String memo; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/errorcode/dto/ErrorCodePageDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/errorcode/dto/ErrorCodePageDTO.java deleted file mode 100644 index 23fbc4046..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/errorcode/dto/ErrorCodePageDTO.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.errorcode.dto; - -import cn.iocoder.common.framework.vo.PageParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@ApiModel("错误码分页 DTO") -@Data -@EqualsAndHashCode(callSuper = true) -public class ErrorCodePageDTO extends PageParam { - - @ApiModelProperty(value = "错误码编码", required = true) - private Integer code; - @ApiModelProperty(value = "错误码错误提示", required = true) - private String message; - @ApiModelProperty(value = "错误码分组", required = true) - private String group; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/errorcode/dto/ErrorCodeUpdateDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/errorcode/dto/ErrorCodeUpdateDTO.java deleted file mode 100644 index 1ba866760..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/errorcode/dto/ErrorCodeUpdateDTO.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.errorcode.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("错误码更新 DTO") -@Data -public class ErrorCodeUpdateDTO { - - @ApiModelProperty(value = "错误码编号", required = true, example = "1") - @NotNull(message = "错误码编号不能为空") - private Integer id; - @ApiModelProperty(value = "错误码编码", required = true, example = "10086") - @NotNull(message = "错误码编码不能为空") - private Integer code; - @ApiModelProperty(value = "错误码错误提示", required = true, example = "艿艿长的丑") - @NotEmpty(message = "错误码错误提示不能为空") - private String message; - @ApiModelProperty(value = "错误码分组", required = true, example = "user-service") - @NotEmpty(message = "错误码分组不能为空") - private String group; - @ApiModelProperty(value = "错误码备注", example = "我就是一个备注") - private String memo; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/errorcode/vo/ErrorCodeVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/errorcode/vo/ErrorCodeVO.java deleted file mode 100644 index c86795cb8..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/errorcode/vo/ErrorCodeVO.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.errorcode.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.Date; - -@ApiModel("错误码 VO") -@Data -public class ErrorCodeVO { - - @ApiModelProperty(value = "错误码编号", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "错误码编码", required = true, example = "10086") - private Integer code; - @ApiModelProperty(value = "错误码错误提示", required = true, example = "艿艿长的丑") - private String message; - @ApiModelProperty(value = "错误码类型", required = true, notes = "见 ErrorCodeTypeEnum 枚举", example = "1") - private Integer type; - @ApiModelProperty(value = "错误码分组", required = true, example = "user-service") - private String group; - @ApiModelProperty(value = "错误码备注", example = "我就是一个备注") - private String memo; - @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/passport/PassportController.http b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/passport/PassportController.http deleted file mode 100644 index a6a9418d6..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/passport/PassportController.http +++ /dev/null @@ -1,34 +0,0 @@ -### /passport/login 成功 -POST http://127.0.0.1:18083/management-api/passport/login -Content-Type: application/x-www-form-urlencoded - -username=admin&password=buzhidao - -### /passport/login 密码不正确 -POST http://127.0.0.1:18083/management-api/passport/login -Content-Type: application/x-www-form-urlencoded - -username=admin&password=1024 - -### /passport/login 少传参数 -POST http://127.0.0.1:18083/management-api/passport/login -Content-Type: application/x-www-form-urlencoded - -username=admin - -### /passport/info 成功 -GET http://127.0.0.1:18083/management-api/passport/info -Authorization: Bearer yudaoyuanma - -### /passport/tree-admin-menu 成功 -GET http://127.0.0.1:18083/management-api/passport/tree-admin-menu -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### /passport/list-admin-permission 成功 -GET http://127.0.0.1:18083/management-api/passport/list-admin-permission -Content-Type: application/x-www-form-urlencoded -#Authorization: Bearer yudaoyuanma -Authorization: Bearer 36dce986276b4d6c8f9f4f3b89b22810 - -### diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/passport/PassportController.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/passport/PassportController.java deleted file mode 100644 index 4ebf7ea16..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/passport/PassportController.java +++ /dev/null @@ -1,67 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.passport; - -import cn.iocoder.common.framework.util.HttpUtil; -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.managementweb.controller.passport.dto.PassportLoginDTO; -import cn.iocoder.mall.managementweb.controller.passport.vo.PassportAccessTokenVO; -import cn.iocoder.mall.managementweb.controller.passport.vo.PassportAdminMenuTreeNodeVO; -import cn.iocoder.mall.managementweb.controller.passport.vo.PassportAdminVO; -import cn.iocoder.mall.managementweb.manager.passport.PassportManager; -import cn.iocoder.mall.security.admin.core.context.AdminSecurityContextHolder; -import cn.iocoder.security.annotations.RequiresNone; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; -import java.util.Set; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -@Api(tags = "管理员 Passport API") -@RestController -@RequestMapping("/passport") -public class PassportController { - - @Autowired - private PassportManager passportManager; - - @PostMapping("/login") - @ApiOperation("账号密码登陆") - @RequiresNone - public CommonResult login(PassportLoginDTO loginDTO, - HttpServletRequest request) { - return success(passportManager.login(loginDTO, HttpUtil.getIp(request))); - } - - @GetMapping("/info") - @ApiOperation(value = "获得当前管理员信息") - public CommonResult getInfo() { - return success(passportManager.getAdmin(AdminSecurityContextHolder.getAdminId())); - } - - @PostMapping("/refresh-token") - @ApiOperation("刷新令牌") - @RequiresNone - public CommonResult refreshToken(@RequestParam("refreshToken") String refreshToken, - HttpServletRequest request) { - return success(passportManager.refreshToken(refreshToken, HttpUtil.getIp(request))); - } - - // TODO 优化点:迁移到 PermissionController - @GetMapping("/tree-admin-menu") - @ApiOperation("获得当前管理员的菜单树") - public CommonResult> treeAdminMenu() { - return success(passportManager.treeAdminMenu(AdminSecurityContextHolder.getAdminId())); - } - - // TODO 优化点:迁移到 PermissionController - @GetMapping("/list-admin-permission") - @ApiOperation("获得当前管理员的权限列表") - public CommonResult> listAdminPermission() { - return success(passportManager.listAdminPermission(AdminSecurityContextHolder.getAdminId())); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/passport/dto/PassportLoginDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/passport/dto/PassportLoginDTO.java deleted file mode 100644 index 035bd6531..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/passport/dto/PassportLoginDTO.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.passport.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.Pattern; -import java.io.Serializable; - -@ApiModel("管理登录 DTO") -@Data -@Accessors(chain = true) -public class PassportLoginDTO implements Serializable { - - @ApiModelProperty(value = "用户名", required = true, example = "yudaoyuanma") - @NotEmpty(message = "登陆账号不能为空") - @Length(min = 5, max = 16, message = "账号长度为 5-16 位") - @Pattern(regexp = "^[A-Za-z0-9]+$", message = "账号格式为数字以及字母") - private String username; - - @ApiModelProperty(value = "密码", required = true, example = "buzhidao") - @NotEmpty(message = "密码不能为空") - @Length(min = 4, max = 16, message = "密码长度为 4-16 位") - private String password; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/passport/vo/PassportAccessTokenVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/passport/vo/PassportAccessTokenVO.java deleted file mode 100644 index 48c63dbcd..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/passport/vo/PassportAccessTokenVO.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.passport.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; - -@ApiModel("访问令牌信息 VO") -@Data -@Accessors(chain = true) -public class PassportAccessTokenVO { - - @ApiModelProperty(value = "访问令牌", required = true, example = "001e8f49b20e47f7b3a2de774497cd50") - private String accessToken; - @ApiModelProperty(value = "刷新令牌", required = true, example = "001e8f49b20e47f7b3a2de774497cd50") - private String refreshToken; - @ApiModelProperty(value = "过期时间", required = true) - private Date expiresTime; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/passport/vo/PassportAdminMenuTreeNodeVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/passport/vo/PassportAdminMenuTreeNodeVO.java deleted file mode 100644 index 35e50b1ad..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/passport/vo/PassportAdminMenuTreeNodeVO.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.passport.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.List; - -@ApiModel(value = "管理员拥有的菜单树", description = "一般用于首页菜单") -@Data -@Accessors(chain = true) -public class PassportAdminMenuTreeNodeVO { - - @ApiModelProperty(value = "菜单编号", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "菜单名", required = true, example = "商品管理") - private String name; - @ApiModelProperty(value = "前端路由", required = true, example = "/order/list") - private String route; - @ApiModelProperty(value = "菜单图标", required = true, example = "user") - private String icon; - @ApiModelProperty(value = "前端界面", example = "@/views/example/edit") - private String view; - @ApiModelProperty(value = "父级资源编号", required = true, example = "1", notes = "如果无父资源,则值为 0") - private Integer pid; - - /** - * 子节点数组 - */ - private List children; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/passport/vo/PassportAdminVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/passport/vo/PassportAdminVO.java deleted file mode 100644 index f2db78162..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/passport/vo/PassportAdminVO.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.passport.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -@ApiModel("管理员信息 VO") -@Data -@Accessors(chain = true) -public class PassportAdminVO { - - @ApiModelProperty(value = "真实名字", required = true, example = "小王") - private String name; - @ApiModelProperty(value = "头像", required = true, example = "http://www.iocoder.cn/xxx.jpg") - private String avatar; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/pay/PayTransactionController.http b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/pay/PayTransactionController.http deleted file mode 100644 index 9a4eccefe..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/pay/PayTransactionController.http +++ /dev/null @@ -1,7 +0,0 @@ -### /product-spu/page 成功(全部) -GET http://127.0.0.1:18083/management-api/pay/transaction/page?pageNo=1&pageSize=10 -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma -dubbo-tag: {{dubboTag}} - -### diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/pay/PayTransactionController.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/pay/PayTransactionController.java deleted file mode 100644 index 3cf6bca70..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/pay/PayTransactionController.java +++ /dev/null @@ -1,38 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.pay; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.pay.vo.transaction.PayTransactionPageReqVO; -import cn.iocoder.mall.managementweb.controller.pay.vo.transaction.PayTransactionRespVO; -import cn.iocoder.mall.managementweb.service.pay.transaction.PayTransactionService; -import cn.iocoder.security.annotations.RequiresPermissions; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -@Api("支付交易单 API") -@RestController -@RequestMapping("/pay/transaction") -@Validated -@Slf4j -public class PayTransactionController { - - @Autowired - private PayTransactionService payTransactionService; - - @GetMapping("/page") - @RequiresPermissions("pay:transaction:page") - @ApiOperation("获得交易支付单分页") - public CommonResult> pagePayTransaction(PayTransactionPageReqVO pageReqVO) { - // 执行查询 - return success(payTransactionService.pagePayTransaction(pageReqVO)); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/pay/vo/transaction/PayTransactionPageReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/pay/vo/transaction/PayTransactionPageReqVO.java deleted file mode 100644 index 43fdf8ee2..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/pay/vo/transaction/PayTransactionPageReqVO.java +++ /dev/null @@ -1,44 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.pay.vo.transaction; - -import cn.iocoder.common.framework.vo.PageParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; -import org.springframework.format.annotation.DateTimeFormat; - -import java.util.Date; - -@ApiModel("支付交易分页 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class PayTransactionPageReqVO extends PageParam { - - @ApiModelProperty(value = "创建时间(开始)", example = "2019-10-10 11:12:13") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createBeginTime; - @ApiModelProperty(value = "创建时间(结束)", example = "2019-10-10 11:12:13") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createEndTime; - - @ApiModelProperty(value = "创建时间()", example = "2019-10-10 11:12:13") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date paymentBeginTime; - @ApiModelProperty(value = "创建时间()", example = "2019-10-10 11:12:13") - private Date paymentEndTime; - - @ApiModelProperty(value = "支付状态", example = "1", notes = "参见 PayTransactionStatusEnum 枚举") - private Integer status; - - @ApiModelProperty(value = "是否退款", example = "true") - private Boolean hasRefund; - - @ApiModelProperty(value = "支付渠道", example = "1", notes = "参见 PayChannelEnum 枚举") - private Integer payChannel; - - @ApiModelProperty(value = "商品标题", example = "芋头") - private String orderSubject; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/pay/vo/transaction/PayTransactionRespVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/pay/vo/transaction/PayTransactionRespVO.java deleted file mode 100644 index bf6974189..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/pay/vo/transaction/PayTransactionRespVO.java +++ /dev/null @@ -1,74 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.pay.vo.transaction; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; - -@ApiModel("支付交易单 Response VO") -@Data -@Accessors(chain = true) -public class PayTransactionRespVO { - - @ApiModelProperty(value = "交易编号", required = true, example = "POd4RC6a") - private Integer id; - - @ApiModelProperty(value = "用户编号", required = true, example = "1024") - private Integer userId; - - @ApiModelProperty(value = "应用编号", required = true, example = "POd4RC6a") - private String appId; - - @ApiModelProperty(value = "发起交易的 IP", required = true, example = "192.168.10.1") - private String createIp; - - @ApiModelProperty(value = "订单号不能为空", required = true, example = "1024") - private String orderId; - - @ApiModelProperty(value = "商品名", required = true, example = "芋道源码") - private String orderSubject; - - @ApiModelProperty(value = "订单商品描述", required = true, example = "绵啾啾的") - private String orderDescription; - - @ApiModelProperty(value = "订单商品备注", example = "绵啾啾的") - private String orderMemo; - - @ApiModelProperty(value = "支付金额,单位:分。", required = true, example = "10") - private Integer price; - - @ApiModelProperty(value = "订单状态", required = true, example = "1", notes = "参见 PayTransactionStatusEnum 枚举") - private Integer status; - - @ApiModelProperty(value = "交易过期时间", required = true) - private Date expireTime; - - @ApiModelProperty(value = "回调业务线完成时间") - private Date finishTime; - - @ApiModelProperty(value = "成功支付的交易拓展编号", example = "1024") - private Integer extensionId; - - @ApiModelProperty(value = "支付成功的支付渠道", example = "1", notes = "参见 PayChannelEnum 枚举") - private Integer payChannel; - - @ApiModelProperty(value = "第三方支付成功的时间") - private Date paymentTime; - - @ApiModelProperty(value = "收到第三方系统通知的时间") - private Date notifyTime; - - @ApiModelProperty(value = "第三方的流水号", example = "11122233344444") - private String tradeNo; - - @ApiModelProperty(value = "添加时间", required = true) - private Date createTime; - - // ========== 退款相关 ========== - - @ApiModelProperty(value = "退款总金额,单位:分", example = "100") - private Integer refundTotal; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/PermissionController.http b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/PermissionController.http deleted file mode 100644 index c51cfb85e..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/PermissionController.http +++ /dev/null @@ -1,11 +0,0 @@ -### /permission/list 成功 -GET http://127.0.0.1:18083/management-api/permission/list-role-resource?roleId=1 -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### /permission/list-admin-roles 成功 -GET http://127.0.0.1:18083/management-api/permission/list-admin-roles?adminId=1 -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/PermissionController.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/PermissionController.java deleted file mode 100644 index a1b7c67cb..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/PermissionController.java +++ /dev/null @@ -1,66 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.permission; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.managementweb.controller.permission.dto.PermissionAssignAdminRoleDTO; -import cn.iocoder.mall.managementweb.controller.permission.dto.PermissionAssignRoleResourceDTO; -import cn.iocoder.mall.managementweb.manager.permission.PermissionManager; -import cn.iocoder.security.annotations.RequiresPermissions; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.Set; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** - * 权限 Controller - */ -@RestController -@RequestMapping("/permission") -@Api(tags = "权限") -@Validated -public class PermissionController { - - @Autowired - private PermissionManager permissionManager; - - @GetMapping("/list-role-resources") - @ApiOperation("获得角色拥有的资源编号") - @ApiImplicitParam(name = "roleId", value = "角色编号", required = true) - @RequiresPermissions("system:permission:assign-role-resource") - public CommonResult> listRoleResources(Integer roleId) { - return success(permissionManager.listRoleResources(roleId)); - } - - @PostMapping("/assign-role-resource") - @ApiOperation("赋予角色资源") - @RequiresPermissions("system:permission:assign-role-resource") - public CommonResult assignRoleResource(PermissionAssignRoleResourceDTO assignRoleResourceDTO) { - permissionManager.assignRoleResource(assignRoleResourceDTO); - return success(true); - } - - @GetMapping("/list-admin-roles") - @ApiOperation("获得管理员拥有的角色编号列表") - @RequiresPermissions("system:permission:assign-admin-role") - @ApiImplicitParam(name = "adminId", value = "管理员编号", required = true) - public CommonResult> listAdminRoles(Integer adminId) { - return success(permissionManager.listAdminRoles(adminId)); - } - - @PostMapping("/assign-admin-role") - @ApiOperation("赋予用户角色") - @RequiresPermissions("system:permission:assign-admin-role") - public CommonResult assignAdminRole(PermissionAssignAdminRoleDTO assignAdminRoleDTO) { - permissionManager.assignAdminRole(assignAdminRoleDTO); - return success(true); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/ResourceController.http b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/ResourceController.http deleted file mode 100644 index 3280a34c1..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/ResourceController.http +++ /dev/null @@ -1,37 +0,0 @@ -### /resource/create 成功 -POST http://127.0.0.1:18083/management-api/resource/create -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -name=测试菜单&permission=resource:add&type=1&sort=1&pid=0&route=/resource/list&icon=test - -### /admin/update 成功 -POST http://127.0.0.1:18083/management-api/resource/update -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -id=61&name=测试菜单2&permission=resource:add&type=1&sort=1&pid=0&route=/resource/list&icon=test - -### /resource/delete 成功 -POST http://127.0.0.1:18083/management-api/resource/delete -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -resourceId=61 - -### /resource/get 成功 -GET http://127.0.0.1:18083/management-api/resource/get?resourceId=61 -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### /resource/list 成功 -GET http://127.0.0.1:18083/management-api/resource/list?resourceIds=61,63 -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### /resource/tree 成功 -GET http://127.0.0.1:18083/management-api/resource/tree -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/ResourceController.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/ResourceController.java deleted file mode 100644 index 29e61b371..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/ResourceController.java +++ /dev/null @@ -1,81 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.permission; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.managementweb.controller.permission.dto.ResourceCreateDTO; -import cn.iocoder.mall.managementweb.controller.permission.dto.ResourceUpdateDTO; -import cn.iocoder.mall.managementweb.controller.permission.vo.ResourceTreeNodeVO; -import cn.iocoder.mall.managementweb.controller.permission.vo.ResourceVO; -import cn.iocoder.mall.managementweb.manager.permission.ResourceManager; -import cn.iocoder.mall.security.admin.core.context.AdminSecurityContextHolder; -import cn.iocoder.security.annotations.RequiresPermissions; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.List; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** -* 资源 Controller -*/ -@RestController -@RequestMapping("/resource") -@Api(tags = "资源") -@Validated -public class ResourceController { - - @Autowired - private ResourceManager resourceManager; - - @PostMapping("/create") - @ApiOperation("创建资源") - @RequiresPermissions("system:resource:create") - public CommonResult createResource(@Valid ResourceCreateDTO createDTO) { - return success(resourceManager.createResource(createDTO, AdminSecurityContextHolder.getAdminId())); - } - - @PostMapping("/update") - @ApiOperation("更新资源") - @RequiresPermissions("system:resource:update") - public CommonResult updateResource(@Valid ResourceUpdateDTO updateDTO) { - resourceManager.updateResource(updateDTO); - return success(true); - } - - @PostMapping("/delete") - @ApiOperation("删除资源") - @ApiImplicitParam(name = "resourceId", value = "资源编号", required = true) - @RequiresPermissions("system:resource:delete") - public CommonResult deleteResource(@RequestParam("resourceId") Integer resourceId) { - resourceManager.deleteResource(resourceId); - return success(true); - } - - @GetMapping("/get") - @ApiOperation("获得资源") - @RequiresPermissions("system:resource:tree") - public CommonResult getResource(@RequestParam("resourceId") Integer resourceId) { - return success(resourceManager.getResource(resourceId)); - } - - @GetMapping("/list") - @ApiOperation("获得资源列表") - @ApiImplicitParam(name = "resourceIds", value = "资源编号列表", required = true) - @RequiresPermissions("system:resource:tree") - public CommonResult> listResources(@RequestParam("resourceIds") List resourceIds) { - return success(resourceManager.listResources(resourceIds)); - } - - @GetMapping("/tree") - @ApiOperation("获得资源树") - @RequiresPermissions("system:resource:tree") - public CommonResult> treeResource() { - return success(resourceManager.treeResource()); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/RoleController.http b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/RoleController.http deleted file mode 100644 index 03eba63ab..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/RoleController.http +++ /dev/null @@ -1,44 +0,0 @@ -### /role/create 成功 -POST http://127.0.0.1:18083/management-api/role/create -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma -#Authorization: Bearer 9d250d9b6c034a6c88bf4034cdf1d4cc - -name=测试角色 - -### /role/update 成功 -POST http://127.0.0.1:18083/management-api/role/update -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -id=14&name=test - -### /resource/delete 成功 -POST http://127.0.0.1:18083/management-api/role/delete -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -roleId=14 - -### /role/get 成功 -GET http://127.0.0.1:18083/management-api/role/get?roleId=13 -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### /role/list-all 成功 -GET http://127.0.0.1:18083/management-api/role/list-all -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### /role/list 成功 -GET http://127.0.0.1:18083/management-api/role/list?roleIds=1,13 -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### /role/page 成功 -GET http://127.0.0.1:18083/management-api/role/page?pageNo=1&pageSize=10 -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### - diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/RoleController.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/RoleController.java deleted file mode 100644 index 5c2b6ad23..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/RoleController.java +++ /dev/null @@ -1,90 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.permission; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.permission.dto.RoleCreateDTO; -import cn.iocoder.mall.managementweb.controller.permission.dto.RolePageDTO; -import cn.iocoder.mall.managementweb.controller.permission.dto.RoleUpdateDTO; -import cn.iocoder.mall.managementweb.controller.permission.vo.RoleVO; -import cn.iocoder.mall.managementweb.manager.permission.RoleManager; -import cn.iocoder.mall.security.admin.core.context.AdminSecurityContextHolder; -import cn.iocoder.security.annotations.RequiresPermissions; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.List; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** -* 角色 Controller -*/ -@RestController -@RequestMapping("/role") -@Api(tags = "角色") -@Validated -public class RoleController { - - @Autowired - private RoleManager roleManager; - - @PostMapping("/create") - @ApiOperation("创建角色") - @RequiresPermissions("system:role:create") - public CommonResult createRole(@Valid RoleCreateDTO createDTO) { - return success(roleManager.createRole(createDTO, AdminSecurityContextHolder.getAdminId())); - } - - @PostMapping("/update") - @ApiOperation("更新角色") - @RequiresPermissions("system:role:update") - public CommonResult updateRole(@Valid RoleUpdateDTO updateDTO) { - roleManager.updateRole(updateDTO); - return success(true); - } - - @PostMapping("/delete") - @ApiOperation("删除角色") - @ApiImplicitParam(name = "roleId", value = "角色编号", required = true) - @RequiresPermissions("system:role:delete") - public CommonResult deleteRole(@RequestParam("roleId") Integer roleId) { - roleManager.deleteRole(roleId); - return success(true); - } - - @GetMapping("/get") - @ApiOperation("获得角色") - @ApiImplicitParam(name = "roleId", value = "角色编号", required = true) - @RequiresPermissions("system:admin:page") - public CommonResult role(@RequestParam("roleId") Integer roleId) { - return success(roleManager.getRole(roleId)); - } - - @GetMapping("/list-all") - @ApiOperation("获得所有角色列表") - @RequiresPermissions("system:role:page") - public CommonResult> listAllRoles() { - return success(roleManager.listAllRoles()); - } - - @GetMapping("/list") - @ApiOperation("获得角色列表") - @ApiImplicitParam(name = "roleIds", value = "角色编号列表", required = true) - @RequiresPermissions("system:role:page") - public CommonResult> listRoles(@RequestParam("roleIds") List roleIds) { - return success(roleManager.listRoles(roleIds)); - } - - @GetMapping("/page") - @ApiOperation("获得角色分页") - @RequiresPermissions("system:role:page") - public CommonResult> pageRole(RolePageDTO pageDTO) { - return success(roleManager.pageRole(pageDTO)); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/PermissionAssignAdminRoleDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/PermissionAssignAdminRoleDTO.java deleted file mode 100644 index 4680a95bf..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/PermissionAssignAdminRoleDTO.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.permission.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; -import java.util.Set; - -@ApiModel("赋予用户角色 DTO") -@Data -public class PermissionAssignAdminRoleDTO { - - @ApiModelProperty(value = "管理员编号", required = true, example = "1") - @NotNull(message = "管理员编号不能为空") - private Integer adminId; - @ApiModelProperty(value = "角色编号列表", example = "1,3,5") - private Set roleIds; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/PermissionAssignRoleResourceDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/PermissionAssignRoleResourceDTO.java deleted file mode 100644 index 7742d852b..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/PermissionAssignRoleResourceDTO.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.permission.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; -import java.util.Set; - -@ApiModel("赋予角色资源 DTO") -@Data -public class PermissionAssignRoleResourceDTO { - - @ApiModelProperty(value = "角色名", required = true, example = "1") - @NotNull(message = "角色编号不能为空") - private Integer roleId; - @ApiModelProperty(value = "资源编号列表", example = "1,3,5") - private Set resourceIds; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/ResourceCreateDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/ResourceCreateDTO.java deleted file mode 100644 index 987b8e2a7..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/ResourceCreateDTO.java +++ /dev/null @@ -1,38 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.permission.dto; - -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.systemservice.enums.permission.ResourceTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("资源创建 DTO") -@Data -public class ResourceCreateDTO { - - @ApiModelProperty(value = "菜单名", required = true, example = "商品管理") - @NotEmpty(message = "菜单名不能为空") - private String name; - @ApiModelProperty(value = "权限标识", example = "resource:add") - private String permission; - @ApiModelProperty(value = "资源类型", required = true, example = "1") - @NotNull(message = "资源类型不能为空") - @InEnum(value = ResourceTypeEnum.class, message = "资源类型必须是 {value}") - private Integer type; - @ApiModelProperty(value = "排序", required = true, example = "1") - @NotNull(message = "排序不能为空") - private Integer sort; - @ApiModelProperty(value = "父级资源编号", required = true, example = "1", notes = "如果无父资源,则值为 0") - @NotNull(message = "父级资源编号不能为空") - private Integer pid; - @ApiModelProperty(value = "前端路由", example = "/resource/list") - private String route; - @ApiModelProperty(value = "菜单图标", example = "add") - private String icon; - @ApiModelProperty(value = "前端界面", example = "@/views/example/edit") - private String view; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/ResourceUpdateDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/ResourceUpdateDTO.java deleted file mode 100644 index c4f368802..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/ResourceUpdateDTO.java +++ /dev/null @@ -1,41 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.permission.dto; - -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.systemservice.enums.permission.ResourceTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("资源创建 DTO") -@Data -public class ResourceUpdateDTO { - - @ApiModelProperty(value = "资源编号", required = true, example = "1") - @NotNull(message = "资源编号不能为空") - private Integer id; - @ApiModelProperty(value = "菜单名", required = true, example = "商品管理") - @NotEmpty(message = "菜单名不能为空") - private String name; - @ApiModelProperty(value = "权限标识", example = "resource:add") - private String permission; - @ApiModelProperty(value = "资源类型", required = true, example = "1") - @NotNull(message = "资源类型不能为空") - @InEnum(value = ResourceTypeEnum.class, message = "资源类型必须是 {value}") - private Integer type; - @ApiModelProperty(value = "排序", required = true, example = "1") - @NotNull(message = "排序不能为空") - private Integer sort; - @ApiModelProperty(value = "父级资源编号", required = true, example = "1", notes = "如果无父资源,则值为 0") - @NotNull(message = "父级资源编号不能为空") - private Integer pid; - @ApiModelProperty(value = "前端路由", example = "/resource/list") - private String route; - @ApiModelProperty(value = "菜单图标", example = "add") - private String icon; - @ApiModelProperty(value = "前端界面", example = "@/views/example/edit") - private String view; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/RoleCreateDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/RoleCreateDTO.java deleted file mode 100644 index 36961c2e0..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/RoleCreateDTO.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.permission.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; - -@ApiModel("角色创建 DTO") -@Data -public class RoleCreateDTO { - - @ApiModelProperty(value = "角色名", required = true, example = "管理员") - @NotEmpty(message = "角色名不能为空") - private String name; - @ApiModelProperty(value = "角色编码", example = "ADMIN") - private String code; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/RolePageDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/RolePageDTO.java deleted file mode 100644 index db1b5d8f9..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/RolePageDTO.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.permission.dto; - -import cn.iocoder.common.framework.vo.PageParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@ApiModel("角色分页 DTO") -@Data -public class RolePageDTO extends PageParam { - - @ApiModelProperty(value = "角色名", example = "管理", notes = "模糊匹配") - private String name; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/RoleUpdateDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/RoleUpdateDTO.java deleted file mode 100644 index 5299f4e64..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/dto/RoleUpdateDTO.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.permission.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("角色更新 DTO") -@Data -public class RoleUpdateDTO { - - @ApiModelProperty(value = "角色编号", required = true, example = "1") - @NotNull(message = "角色编号不能为空") - private Integer id; - @ApiModelProperty(value = "角色名", required = true, example = "管理员") - @NotEmpty(message = "角色名不能为空") - private String name; - @ApiModelProperty(value = "角色编码", example = "ADMIN") - private String code; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/vo/ResourceTreeNodeVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/vo/ResourceTreeNodeVO.java deleted file mode 100644 index 6be673b6a..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/vo/ResourceTreeNodeVO.java +++ /dev/null @@ -1,50 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.permission.vo; - -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.systemservice.enums.permission.ResourceTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.util.Date; -import java.util.List; - -@ApiModel("资源树节点 VO") -@Data -public class ResourceTreeNodeVO { - - @ApiModelProperty(value = "资源编号", required = true, example = "1") - @NotNull(message = "资源编号不能为空") - private Integer id; - @ApiModelProperty(value = "菜单名", required = true, example = "商品管理") - @NotEmpty(message = "菜单名不能为空") - private String name; - @ApiModelProperty(value = "权限标识", example = "resource:add") - private String permission; - @ApiModelProperty(value = "资源类型", required = true, example = "1") - @NotNull(message = "资源类型不能为空") - @InEnum(value = ResourceTypeEnum.class, message = "资源类型必须是 {value}") - private Integer type; - @ApiModelProperty(value = "排序", required = true, example = "1") - @NotNull(message = "排序不能为空") - private Integer sort; - @ApiModelProperty(value = "父级资源编号", required = true, example = "1", notes = "如果无父资源,则值为 0") - @NotNull(message = "父级资源编号不能为空") - private Integer pid; - @ApiModelProperty(value = "前端路由", example = "/resource/list") - private String route; - @ApiModelProperty(value = "菜单图标", example = "add") - private String icon; - @ApiModelProperty(value = "前端界面", example = "@/views/example/edit") - private String view; - @ApiModelProperty(value = "添加时间", required = true) - private Date createTime; - - /** - * 子节点 - */ - private List children; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/vo/ResourceVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/vo/ResourceVO.java deleted file mode 100644 index ab1cf1b55..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/vo/ResourceVO.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.permission.vo; - -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.systemservice.enums.permission.ResourceTypeEnum; -import lombok.*; -import io.swagger.annotations.*; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.util.*; - -@ApiModel("资源 VO") -@Data -public class ResourceVO { - - @ApiModelProperty(value = "资源编号", required = true, example = "1") - @NotNull(message = "资源编号不能为空") - private Integer id; - @ApiModelProperty(value = "菜单名", required = true, example = "商品管理") - @NotEmpty(message = "菜单名不能为空") - private String name; - @ApiModelProperty(value = "权限标识", example = "resource:add") - private String permission; - @ApiModelProperty(value = "资源类型", required = true, example = "1") - @NotNull(message = "资源类型不能为空") - @InEnum(value = ResourceTypeEnum.class, message = "资源类型必须是 {value}") - private Integer type; - @ApiModelProperty(value = "排序", required = true, example = "1") - @NotNull(message = "排序不能为空") - private Integer sort; - @ApiModelProperty(value = "父级资源编号", required = true, example = "1", notes = "如果无父资源,则值为 0") - @NotNull(message = "父级资源编号不能为空") - private Integer pid; - @ApiModelProperty(value = "前端路由", example = "/resource/list") - private String route; - @ApiModelProperty(value = "菜单图标", example = "add") - private String icon; - @ApiModelProperty(value = "前端界面", example = "@/views/example/edit") - private String view; - @ApiModelProperty(value = "添加时间", required = true) - private Date createTime; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/vo/RoleVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/vo/RoleVO.java deleted file mode 100644 index f3e26fa0e..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/permission/vo/RoleVO.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.permission.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.Date; - -@ApiModel("角色 VO") -@Data -public class RoleVO { - - @ApiModelProperty(value = "角色编号", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "角色名", required = true, example = "管理员") - private String name; - @ApiModelProperty(value = "角色编码", example = "ADMIN") - private String code; - @ApiModelProperty(value = "角色类型", required = true, example = "1", notes = "见 RoleTypeEnum 枚举") - private Integer type; - @ApiModelProperty(value = "创建管理员编号", required = true, example = "1") - private Integer createAdminId; - @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/SystemAccessLogController.http b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/SystemAccessLogController.http deleted file mode 100644 index 495820cbe..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/SystemAccessLogController.http +++ /dev/null @@ -1,7 +0,0 @@ -### /system-access-log/page 成功 -GET http://127.0.0.1:18083/management-api/system-access-log/page?pageNo=1&pageSize=10 -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### - diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/SystemAccessLogController.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/SystemAccessLogController.java deleted file mode 100644 index 9ed71e060..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/SystemAccessLogController.java +++ /dev/null @@ -1,38 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.systemlog; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.systemlog.dto.SystemAccessLogPageDTO; -import cn.iocoder.mall.managementweb.controller.systemlog.vo.SystemAccessLogVO; -import cn.iocoder.mall.managementweb.manager.systemlog.SystemAccessLogManager; -import cn.iocoder.security.annotations.RequiresPermissions; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** -* 系统访问日志 Controller -*/ -@RestController -@RequestMapping("/system-access-log") -@Api(tags = "系统访问日志") -@Validated -public class SystemAccessLogController { - - @Autowired - private SystemAccessLogManager systemAccessLogManager; - - @GetMapping("/page") - @ApiOperation("获得系统访问日志分页") - @RequiresPermissions("system:system-access-log:page") - public CommonResult> pageSystemAccessLog(SystemAccessLogPageDTO pageDTO) { - return success(systemAccessLogManager.pageSystemAccessLog(pageDTO)); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/SystemExceptionLogController.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/SystemExceptionLogController.java deleted file mode 100644 index cbd43b828..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/SystemExceptionLogController.java +++ /dev/null @@ -1,56 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.systemlog; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.systemlog.dto.SystemExceptionLogPageDTO; -import cn.iocoder.mall.managementweb.controller.systemlog.dto.SystemExceptionLogProcessDTO; -import cn.iocoder.mall.managementweb.controller.systemlog.vo.SystemExceptionLogDetailVO; -import cn.iocoder.mall.managementweb.controller.systemlog.vo.SystemExceptionLogVO; -import cn.iocoder.mall.managementweb.manager.systemlog.SystemExceptionLogManager; -import cn.iocoder.mall.security.admin.core.context.AdminSecurityContextHolder; -import cn.iocoder.security.annotations.RequiresPermissions; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** -* 系统异常日志 Controller -*/ -@RestController -@RequestMapping("/system-exception-log") -@Api(tags = "系统异常日志") -@Validated -public class SystemExceptionLogController { - - @Autowired - private SystemExceptionLogManager systemExceptionLogManager; - - @GetMapping("/get") - @ApiOperation("获得系统异常日志明细") - @ApiImplicitParam(name = "logId", value = "系统异常日志编号", required = true) - @RequiresPermissions("system:system-exception-log:page") - public CommonResult getSystemExceptionLogDetail(@RequestParam("logId") Integer logId) { - return success(systemExceptionLogManager.getSystemExceptionLogDetail(logId)); - } - - @GetMapping("/page") - @ApiOperation("获得系统异常日志分页") - @RequiresPermissions("system:system-exception-log:page") - public CommonResult> pageSystemExceptionLog(SystemExceptionLogPageDTO pageDTO) { - return success(systemExceptionLogManager.pageSystemExceptionLog(pageDTO)); - } - - @PostMapping("/process") - @ApiOperation("处理系统异常日志") - @RequiresPermissions("system:system-exception-log:process") - public CommonResult processSystemExceptionLog(SystemExceptionLogProcessDTO processDTO) { - systemExceptionLogManager.processSystemExceptionLog(AdminSecurityContextHolder.getAdminId(), processDTO); - return CommonResult.success(true); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/dto/SystemAccessLogPageDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/dto/SystemAccessLogPageDTO.java deleted file mode 100644 index e224a3be8..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/dto/SystemAccessLogPageDTO.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.systemlog.dto; - -import cn.iocoder.common.framework.vo.PageParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@ApiModel("系统访问日志分页 DTO") -@Data -public class SystemAccessLogPageDTO extends PageParam { - - @ApiModelProperty(value = "用户编号", example = "1") - private Integer userId; - @ApiModelProperty(value = "用户类型", example = "2") - private Integer userType; - @ApiModelProperty(value = "应用名", example = "xxx-service-application") - private String applicationName; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/dto/SystemExceptionLogPageDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/dto/SystemExceptionLogPageDTO.java deleted file mode 100644 index 376758834..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/dto/SystemExceptionLogPageDTO.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.systemlog.dto; - -import cn.iocoder.common.framework.vo.PageParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@ApiModel("系统异常日志分页 DTO") -@Data -public class SystemExceptionLogPageDTO extends PageParam { - - @ApiModelProperty(value = "用户编号", example = "1") - private Integer userId; - @ApiModelProperty(value = "用户类型", example = "2") - private Integer userType; - @ApiModelProperty(value = "应用名", example = "xxx-service-application") - private String applicationName; - @ApiModelProperty(value = "处理状态", notes = "对应 SystemExceptionLogProcessStatusEnum 枚举类", example = "1") - private Integer processStatus; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/dto/SystemExceptionLogProcessDTO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/dto/SystemExceptionLogProcessDTO.java deleted file mode 100644 index e72382573..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/dto/SystemExceptionLogProcessDTO.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.systemlog.dto; - -import cn.iocoder.common.framework.vo.PageParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@ApiModel("系统异常日志处理 DTO") -@Data -@EqualsAndHashCode(callSuper = true) -public class SystemExceptionLogProcessDTO extends PageParam { - - @ApiModelProperty(value = "系统异常日志编号", required = true, example = "1") - private Integer logId; - @ApiModelProperty(value = "处理状态", required = true, notes = "对应 SystemExceptionLogProcessStatusEnum 枚举类", example = "1") - private Integer processStatus; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/vo/SystemAccessLogVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/vo/SystemAccessLogVO.java deleted file mode 100644 index 5e8fabf31..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/vo/SystemAccessLogVO.java +++ /dev/null @@ -1,40 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.systemlog.vo; - -import lombok.*; -import io.swagger.annotations.*; -import java.util.*; - -@ApiModel("系统访问日志 VO") -@Data -public class SystemAccessLogVO { - - @ApiModelProperty(value = "编号", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "用户编号", example = "1024") - private Integer userId; - @ApiModelProperty(value = "用户类型", example = "1") - private Integer userType; - @ApiModelProperty(value = "链路追踪编号", example = "89aca178-a370-411c-ae02-3f0d672be4ab") - private String traceId; - @ApiModelProperty(value = "应用名", required = true, example = "user-shop-application") - private String applicationName; - @ApiModelProperty(value = "访问地址", required = true, example = "/management-api/system-access-log/page") - private String uri; - @ApiModelProperty(value = "参数", required = true, example = "pageNo=1&pageSize=10") - private String queryString; - @ApiModelProperty(value = "http 方法", required = true, example = "GET") - private String method; - @ApiModelProperty(value = "userAgent", required = true, example = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0") - private String userAgent; - @ApiModelProperty(value = "ip", required = true, example = "127.0.0.1") - private String ip; - @ApiModelProperty(value = "请求时间", required = true) - private Date startTime; - @ApiModelProperty(value = "响应时长 -- 毫秒级", required = true, example = "1024") - private Integer responseTime; - @ApiModelProperty(value = "错误码", required = true, example = "0") - private Integer errorCode; - @ApiModelProperty(value = "错误提示", example = "你的昵称过长~") - private String errorMessage; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/vo/SystemExceptionLogDetailVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/vo/SystemExceptionLogDetailVO.java deleted file mode 100644 index 7ae71698a..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/vo/SystemExceptionLogDetailVO.java +++ /dev/null @@ -1,76 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.systemlog.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; - -@ApiModel("系统异常日志明细 DTO") -@Data -public class SystemExceptionLogDetailVO { - - @ApiModel("管理员") - @Data - @Accessors(chain = true) - public static class Admin { - - @ApiModelProperty(value = "管理员编号", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "真实名字", required = true, example = "小王") - private String name; - - } - - @ApiModelProperty(value = "编号", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "用户编号", example = "1024") - private Integer userId; - @ApiModelProperty(value = "用户类型", example = "1") - private Integer userType; - @ApiModelProperty(value = "链路追踪编号", example = "89aca178-a370-411c-ae02-3f0d672be4ab") - private String traceId; - @ApiModelProperty(value = "应用名", required = true, example = "user-shop-application") - private String applicationName; - @ApiModelProperty(value = "访问地址", required = true, example = "/management-api/system-access-log/page") - private String uri; - @ApiModelProperty(value = "参数", required = true, example = "pageNo=1&pageSize=10") - private String queryString; - @ApiModelProperty(value = "http 方法", required = true, example = "GET") - private String method; - @ApiModelProperty(value = "userAgent", required = true, example = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0") - private String userAgent; - @ApiModelProperty(value = "ip", required = true, example = "127.0.0.1") - private String ip; - @ApiModelProperty(value = "异常发生时间", required = true) - private Date exceptionTime; - @ApiModelProperty(value = "异常名, {@link Throwable#getClass()} 的类全名", required = true) - private String exceptionName; - @ApiModelProperty(value = "异常导致的消息, {@link cn.iocoder.common.framework.util.ExceptionUtil#getMessage(Throwable)}", required = true) - private String exceptionMessage; - @ApiModelProperty(value = "异常导致的根消息, {@link cn.iocoder.common.framework.util.ExceptionUtil#getRootCauseMessage(Throwable)}", required = true) - private String exceptionRootCauseMessage; - @ApiModelProperty(value = "异常的栈轨迹, {@link cn.iocoder.common.framework.util.ExceptionUtil#getServiceException(Exception)}", required = true) - private String exceptionStackTrace; - @ApiModelProperty(value = "异常发生的类全名, {@link StackTraceElement#getClassName()}", required = true) - private String exceptionClassName; - @ApiModelProperty(value = "异常发生的类文件, {@link StackTraceElement#getFileName()}", required = true) - private String exceptionFileName; - @ApiModelProperty(value = "异常发生的方法名, {@link StackTraceElement#getMethodName()}", required = true) - private String exceptionMethodName; - @ApiModelProperty(value = "异常发生的方法所在行, {@link StackTraceElement#getLineNumber()}", required = true) - private Integer exceptionLineNumber; - @ApiModelProperty(value = "处理状态", required = true, notes = "对应 SystemExceptionLogProcessStatusEnum 枚举类", example = "1") - private Integer processStatus; - @ApiModelProperty(value = "处理时间") - private Date processTime; - @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; - - /** - * 处理的管理员信息 - */ - private Admin processAdmin; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/vo/SystemExceptionLogVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/vo/SystemExceptionLogVO.java deleted file mode 100644 index 49a6a3097..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/systemlog/vo/SystemExceptionLogVO.java +++ /dev/null @@ -1,58 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.systemlog.vo; - -import lombok.*; -import io.swagger.annotations.*; -import java.util.*; - -@ApiModel("系统异常日志 VO") -@Data -public class SystemExceptionLogVO { - - @ApiModelProperty(value = "编号", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "用户编号", example = "1024") - private Integer userId; - @ApiModelProperty(value = "用户类型", example = "1") - private Integer userType; - @ApiModelProperty(value = "链路追踪编号", example = "89aca178-a370-411c-ae02-3f0d672be4ab") - private String traceId; - @ApiModelProperty(value = "应用名", required = true, example = "user-shop-application") - private String applicationName; - @ApiModelProperty(value = "访问地址", required = true, example = "/management-api/system-access-log/page") - private String uri; - @ApiModelProperty(value = "参数", required = true, example = "pageNo=1&pageSize=10") - private String queryString; - @ApiModelProperty(value = "http 方法", required = true, example = "GET") - private String method; - @ApiModelProperty(value = "userAgent", required = true, example = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0") - private String userAgent; - @ApiModelProperty(value = "ip", required = true, example = "127.0.0.1") - private String ip; - @ApiModelProperty(value = "异常发生时间", required = true) - private Date exceptionTime; - @ApiModelProperty(value = "异常名, {@link Throwable#getClass()} 的类全名", required = true) - private String exceptionName; - @ApiModelProperty(value = "异常导致的消息, {@link cn.iocoder.common.framework.util.ExceptionUtil#getMessage(Throwable)}", required = true) - private String exceptionMessage; - @ApiModelProperty(value = "异常导致的根消息, {@link cn.iocoder.common.framework.util.ExceptionUtil#getRootCauseMessage(Throwable)}", required = true) - private String exceptionRootCauseMessage; - @ApiModelProperty(value = "异常的栈轨迹, {@link cn.iocoder.common.framework.util.ExceptionUtil#getServiceException(Exception)}", required = true) - private String exceptionStackTrace; - @ApiModelProperty(value = "异常发生的类全名, {@link StackTraceElement#getClassName()}", required = true) - private String exceptionClassName; - @ApiModelProperty(value = "异常发生的类文件, {@link StackTraceElement#getFileName()}", required = true) - private String exceptionFileName; - @ApiModelProperty(value = "异常发生的方法名, {@link StackTraceElement#getMethodName()}", required = true) - private String exceptionMethodName; - @ApiModelProperty(value = "异常发生的方法所在行, {@link StackTraceElement#getLineNumber()}", required = true) - private Integer exceptionLineNumber; - @ApiModelProperty(value = "处理状态", required = true, notes = "对应 SystemExceptionLogProcessStatusEnum 枚举类", example = "1") - private Integer processStatus; - @ApiModelProperty(value = "处理时间") - private Date processTime; - @ApiModelProperty(value = "处理管理员编号", example = "1024") - private Integer processAdminId; - @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/admin/AdminConvert.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/admin/AdminConvert.java deleted file mode 100644 index 1b5ce7db5..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/admin/AdminConvert.java +++ /dev/null @@ -1,41 +0,0 @@ -package cn.iocoder.mall.managementweb.convert.admin; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.admin.dto.AdminUpdateInfoDTO; -import cn.iocoder.mall.managementweb.controller.admin.dto.AdminUpdateStatusDTO; -import cn.iocoder.mall.managementweb.controller.admin.vo.AdminPageItemVO; -import cn.iocoder.mall.systemservice.rpc.admin.dto.AdminCreateDTO; -import cn.iocoder.mall.systemservice.rpc.admin.dto.AdminPageDTO; -import cn.iocoder.mall.systemservice.rpc.admin.dto.AdminUpdateDTO; -import cn.iocoder.mall.systemservice.rpc.admin.vo.AdminVO; -import cn.iocoder.mall.systemservice.rpc.admin.vo.DepartmentVO; -import cn.iocoder.mall.systemservice.rpc.permission.vo.RoleVO; -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface AdminConvert { - - AdminConvert INSTANCE = Mappers.getMapper(AdminConvert.class); - - AdminCreateDTO convert(cn.iocoder.mall.managementweb.controller.admin.dto.AdminCreateDTO bean); - - AdminUpdateDTO convert(AdminUpdateInfoDTO bean); - - @Mapping(source = "adminId", target = "id") - AdminUpdateDTO convert(AdminUpdateStatusDTO bean); - - AdminPageDTO convert(cn.iocoder.mall.managementweb.controller.admin.dto.AdminPageDTO bean); - - PageResult convert(PageResult pageResultData); - - cn.iocoder.mall.managementweb.controller.admin.vo.AdminVO convert(AdminVO bean); - - AdminPageItemVO convert02(AdminVO adminVO); - AdminPageItemVO.Department convert(DepartmentVO bean); - List convertList(List list); - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/admin/DepartmentConvert.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/admin/DepartmentConvert.java deleted file mode 100644 index 5089312da..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/admin/DepartmentConvert.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.iocoder.mall.managementweb.convert.admin; - -import cn.iocoder.mall.managementweb.controller.admin.vo.DepartmentTreeNodeVO; -import cn.iocoder.mall.managementweb.controller.admin.vo.DepartmentVO; -import cn.iocoder.mall.systemservice.rpc.admin.dto.DepartmentCreateDTO; -import cn.iocoder.mall.systemservice.rpc.admin.dto.DepartmentUpdateDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface DepartmentConvert { - - DepartmentConvert INSTANCE = Mappers.getMapper(DepartmentConvert.class); - - DepartmentCreateDTO convert(cn.iocoder.mall.managementweb.controller.admin.dto.DepartmentCreateDTO bean); - - DepartmentUpdateDTO convert(cn.iocoder.mall.managementweb.controller.admin.dto.DepartmentUpdateDTO bean); - - List convertList(List list); - - DepartmentVO convert(cn.iocoder.mall.systemservice.rpc.admin.vo.DepartmentVO bean); - - DepartmentTreeNodeVO convertTreeNode(cn.iocoder.mall.systemservice.rpc.admin.vo.DepartmentVO bean); - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/datadict/DataDictConvert.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/datadict/DataDictConvert.java deleted file mode 100644 index 6e248d214..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/datadict/DataDictConvert.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.iocoder.mall.managementweb.convert.datadict; - -import cn.iocoder.mall.managementweb.controller.datadict.vo.DataDictSimpleVO; -import cn.iocoder.mall.managementweb.controller.datadict.vo.DataDictVO; -import cn.iocoder.mall.systemservice.rpc.datadict.dto.DataDictCreateDTO; -import cn.iocoder.mall.systemservice.rpc.datadict.dto.DataDictUpdateDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface DataDictConvert { - - DataDictConvert INSTANCE = Mappers.getMapper(DataDictConvert.class); - - DataDictCreateDTO convert(cn.iocoder.mall.managementweb.controller.datadict.dto.DataDictCreateDTO bean); - - DataDictUpdateDTO convert(cn.iocoder.mall.managementweb.controller.datadict.dto.DataDictUpdateDTO bean); - - DataDictVO convert(cn.iocoder.mall.systemservice.rpc.datadict.vo.DataDictVO bean); - - List convertList(List list); - - List convertList02(List list); - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/passport/AdminPassportConvert.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/passport/AdminPassportConvert.java deleted file mode 100644 index 6d3ae18ab..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/passport/AdminPassportConvert.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.iocoder.mall.managementweb.convert.passport; - -import cn.iocoder.mall.managementweb.controller.passport.dto.PassportLoginDTO; -import cn.iocoder.mall.managementweb.controller.passport.vo.PassportAccessTokenVO; -import cn.iocoder.mall.managementweb.controller.passport.vo.PassportAdminVO; -import cn.iocoder.mall.systemservice.rpc.admin.dto.AdminVerifyPasswordDTO; -import cn.iocoder.mall.systemservice.rpc.admin.vo.AdminVO; -import cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2AccessTokenRespDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface AdminPassportConvert { - - AdminPassportConvert INSTANCE = Mappers.getMapper(AdminPassportConvert.class); - - AdminVerifyPasswordDTO convert(PassportLoginDTO bean); - - PassportAccessTokenVO convert(OAuth2AccessTokenRespDTO bean); - - PassportAdminVO convert(AdminVO bean); - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/pay/transaction/PayTransactionConvert.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/pay/transaction/PayTransactionConvert.java deleted file mode 100644 index e763c4261..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/pay/transaction/PayTransactionConvert.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.iocoder.mall.managementweb.convert.pay.transaction; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.pay.vo.transaction.PayTransactionPageReqVO; -import cn.iocoder.mall.managementweb.controller.pay.vo.transaction.PayTransactionRespVO; -import cn.iocoder.mall.payservice.rpc.transaction.dto.PayTransactionPageReqDTO; -import cn.iocoder.mall.payservice.rpc.transaction.dto.PayTransactionRespDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface PayTransactionConvert { - - PayTransactionConvert INSTANCE = Mappers.getMapper(PayTransactionConvert.class); - - PayTransactionPageReqDTO convert(PayTransactionPageReqVO bean); - - PageResult convertPage(PageResult bean); - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/permission/PermissionConvert.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/permission/PermissionConvert.java deleted file mode 100644 index bc63a8aad..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/permission/PermissionConvert.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.iocoder.mall.managementweb.convert.permission; - -import cn.iocoder.mall.systemservice.rpc.permission.dto.PermissionAssignAdminRoleDTO; -import cn.iocoder.mall.systemservice.rpc.permission.dto.PermissionAssignRoleResourceDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface PermissionConvert { - - PermissionConvert INSTANCE = Mappers.getMapper(PermissionConvert.class); - - PermissionAssignRoleResourceDTO convert(cn.iocoder.mall.managementweb.controller.permission.dto.PermissionAssignRoleResourceDTO bean); - - PermissionAssignAdminRoleDTO convert(cn.iocoder.mall.managementweb.controller.permission.dto.PermissionAssignAdminRoleDTO bean); - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/permission/ResourceConvert.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/permission/ResourceConvert.java deleted file mode 100644 index c7eb3a096..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/permission/ResourceConvert.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.mall.managementweb.convert.permission; - -import cn.iocoder.mall.managementweb.controller.passport.vo.PassportAdminMenuTreeNodeVO; -import cn.iocoder.mall.managementweb.controller.permission.vo.ResourceTreeNodeVO; -import cn.iocoder.mall.managementweb.controller.permission.vo.ResourceVO; -import cn.iocoder.mall.systemservice.rpc.permission.dto.ResourceCreateDTO; -import cn.iocoder.mall.systemservice.rpc.permission.dto.ResourceUpdateDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface ResourceConvert { - - ResourceConvert INSTANCE = Mappers.getMapper(ResourceConvert.class); - - ResourceCreateDTO convert(cn.iocoder.mall.managementweb.controller.permission.dto.ResourceCreateDTO bean); - - ResourceUpdateDTO convert(cn.iocoder.mall.managementweb.controller.permission.dto.ResourceUpdateDTO bean); - - ResourceVO convert(cn.iocoder.mall.systemservice.rpc.permission.vo.ResourceVO bean); - - List convertList(List list); - - ResourceTreeNodeVO convertTreeNode(cn.iocoder.mall.systemservice.rpc.permission.vo.ResourceVO bean); - - List convert(List list); - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/permission/RoleConvert.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/permission/RoleConvert.java deleted file mode 100644 index 189df7381..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/permission/RoleConvert.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.mall.managementweb.convert.permission; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.permission.vo.RoleVO; -import cn.iocoder.mall.systemservice.rpc.permission.dto.RolePageDTO; -import cn.iocoder.mall.systemservice.rpc.permission.dto.RoleUpdateDTO; -import cn.iocoder.mall.systemservice.rpc.permission.vo.RoleCreateDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface RoleConvert { - - RoleConvert INSTANCE = Mappers.getMapper(RoleConvert.class); - - RoleCreateDTO convert(cn.iocoder.mall.managementweb.controller.permission.dto.RoleCreateDTO bean); - - RoleUpdateDTO convert(cn.iocoder.mall.managementweb.controller.permission.dto.RoleUpdateDTO bean); - - RoleVO convert(cn.iocoder.mall.systemservice.rpc.permission.vo.RoleVO bean); - - List convertList(List list); - - RolePageDTO convert(cn.iocoder.mall.managementweb.controller.permission.dto.RolePageDTO bean); - - PageResult convertPage(PageResult page); - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/systemlog/SystemAccessLogConvert.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/systemlog/SystemAccessLogConvert.java deleted file mode 100644 index 67f0659ec..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/systemlog/SystemAccessLogConvert.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.iocoder.mall.managementweb.convert.systemlog; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.systemlog.vo.SystemAccessLogVO; -import cn.iocoder.mall.systemservice.rpc.systemlog.vo.SystemAccessLogPageDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface SystemAccessLogConvert { - - SystemAccessLogConvert INSTANCE = Mappers.getMapper(SystemAccessLogConvert.class); - - SystemAccessLogPageDTO convert(cn.iocoder.mall.managementweb.controller.systemlog.dto.SystemAccessLogPageDTO bean); - - PageResult convertPage(PageResult page); - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/systemlog/SystemExceptionLogConvert.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/systemlog/SystemExceptionLogConvert.java deleted file mode 100644 index 1076e4481..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/systemlog/SystemExceptionLogConvert.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.iocoder.mall.managementweb.convert.systemlog; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.systemlog.vo.SystemExceptionLogDetailVO; -import cn.iocoder.mall.managementweb.controller.systemlog.vo.SystemExceptionLogVO; -import cn.iocoder.mall.systemservice.rpc.admin.vo.AdminVO; -import cn.iocoder.mall.systemservice.rpc.systemlog.dto.SystemExceptionLogPageDTO; -import cn.iocoder.mall.systemservice.rpc.systemlog.dto.SystemExceptionLogProcessDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface SystemExceptionLogConvert { - - SystemExceptionLogConvert INSTANCE = Mappers.getMapper(SystemExceptionLogConvert.class); - - SystemExceptionLogPageDTO convert(cn.iocoder.mall.managementweb.controller.systemlog.dto.SystemExceptionLogPageDTO bean); - - PageResult convertPage(PageResult page); - - SystemExceptionLogDetailVO convert(cn.iocoder.mall.systemservice.rpc.systemlog.vo.SystemExceptionLogVO bean); - - SystemExceptionLogDetailVO.Admin convert(AdminVO bean); - - SystemExceptionLogProcessDTO convert(cn.iocoder.mall.managementweb.controller.systemlog.dto.SystemExceptionLogProcessDTO bean); - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/admin/AdminManager.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/admin/AdminManager.java deleted file mode 100644 index d2f3f9833..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/admin/AdminManager.java +++ /dev/null @@ -1,121 +0,0 @@ -package cn.iocoder.mall.managementweb.manager.admin; - -import cn.iocoder.common.framework.util.CollectionUtils; -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.admin.dto.AdminCreateDTO; -import cn.iocoder.mall.managementweb.controller.admin.dto.AdminPageDTO; -import cn.iocoder.mall.managementweb.controller.admin.dto.AdminUpdateInfoDTO; -import cn.iocoder.mall.managementweb.controller.admin.dto.AdminUpdateStatusDTO; -import cn.iocoder.mall.managementweb.controller.admin.vo.AdminPageItemVO; -import cn.iocoder.mall.managementweb.controller.admin.vo.AdminVO; -import cn.iocoder.mall.managementweb.convert.admin.AdminConvert; -import cn.iocoder.mall.systemservice.rpc.admin.AdminFeign; -import cn.iocoder.mall.systemservice.rpc.admin.DepartmentFeign; -import cn.iocoder.mall.systemservice.rpc.admin.vo.DepartmentVO; -import cn.iocoder.mall.systemservice.rpc.permission.PermissionFeign; -import cn.iocoder.mall.systemservice.rpc.permission.RoleFeign; -import cn.iocoder.mall.systemservice.rpc.permission.vo.RoleVO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.util.*; - -@Service -@Validated -public class AdminManager { - - @Autowired - private AdminFeign adminFeign; - @Autowired - private RoleFeign roleFeign; - @Autowired - private DepartmentFeign departmentFeign; - @Autowired - private PermissionFeign permissionFeign; - - public PageResult pageAdmin(AdminPageDTO pageDTO) { - CommonResult> pageResult = - adminFeign.pageAdmin(AdminConvert.INSTANCE.convert(pageDTO)); - pageResult.checkError(); - // 转换结果 - PageResult adminPageVO = new PageResult<>(); - adminPageVO.setTotal(pageResult.getData().getTotal()); - adminPageVO.setList(new ArrayList<>(pageResult.getData().getList().size())); - // 拼接结果 - if (!pageResult.getData().getList().isEmpty()) { - // 查询角色数组 - Map> adminRoleMap = this.listAdminRoles(CollectionUtils.convertList(pageResult.getData().getList(), - cn.iocoder.mall.systemservice.rpc.admin.vo.AdminVO::getId)); - // 查询部门 - CommonResult> listDepartmentsResult = departmentFeign.listDepartments( - CollectionUtils.convertSet(pageResult.getData().getList(), - cn.iocoder.mall.systemservice.rpc.admin.vo.AdminVO::getDepartmentId)); - listDepartmentsResult.checkError(); - Map departmentMap = CollectionUtils.convertMap(listDepartmentsResult.getData(), DepartmentVO::getId); - // 拼接数据 - for (cn.iocoder.mall.systemservice.rpc.admin.vo.AdminVO adminVO : pageResult.getData().getList()) { - AdminPageItemVO adminPageItemVO = AdminConvert.INSTANCE.convert02(adminVO); - adminPageVO.getList().add(adminPageItemVO); - // 拼接部门 - adminPageItemVO.setDepartment(AdminConvert.INSTANCE.convert(departmentMap.get(adminVO.getDepartmentId()))); - // 拼接角色 - adminPageItemVO.setRoles( AdminConvert.INSTANCE.convertList(adminRoleMap.get(adminVO.getId()))); - } - } else { - adminPageVO.setList(Collections.emptyList()); - } - return adminPageVO; - } - - private Map> listAdminRoles(List adminIds) { - // 获得管理员拥有的角色 - CommonResult>> mapAdminRoleIdsResult = permissionFeign.mapAdminRoleIds(adminIds); - mapAdminRoleIdsResult.checkError(); - // 获得角色列表 - Set roleIds = new HashSet<>(); - mapAdminRoleIdsResult.getData().values().forEach(roleIds::addAll); - CommonResult> listRolesResult = roleFeign.listRoles(roleIds); - listRolesResult.checkError(); - Map roleVOMap = CollectionUtils.convertMap(listRolesResult.getData(), RoleVO::getId); - // 拼接结果 - Map> adminRoleVOMap = new HashMap<>(); - mapAdminRoleIdsResult.getData().forEach((adminId, adminRoleIds) -> { - List roleVOs = new ArrayList<>(adminRoleIds.size()); - adminRoleIds.forEach(roleId -> { - RoleVO roleVO = roleVOMap.get(roleId); - if (roleVO != null) { - roleVOs.add(roleVO); - } - }); - adminRoleVOMap.put(adminId, roleVOs); - }); - return adminRoleVOMap; - } - - public Integer createAdmin(AdminCreateDTO createDTO, Integer createAdminId, String createIp) { - CommonResult createAdminResult = adminFeign.createAdmin(AdminConvert.INSTANCE.convert(createDTO) - .setCreateAdminId(createAdminId).setCreateIp(createIp)); - createAdminResult.checkError(); - return createAdminResult.getData(); - } - - public void updateAdmin(AdminUpdateInfoDTO updateInfoDTO) { - CommonResult updateAdminResult = adminFeign.updateAdmin(AdminConvert.INSTANCE.convert(updateInfoDTO)); - updateAdminResult.checkError(); - } - - public void updateAdminStatus(@Valid AdminUpdateStatusDTO updateStatusDTO) { - CommonResult updateAdminResult = adminFeign.updateAdmin(AdminConvert.INSTANCE.convert(updateStatusDTO)); - updateAdminResult.checkError(); - } - - public AdminVO getAdmin(Integer adminId) { - CommonResult getAdminResult = adminFeign.getAdmin(adminId); - getAdminResult.checkError(); - return AdminConvert.INSTANCE.convert(getAdminResult.getData()); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/admin/DepartmentManager.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/admin/DepartmentManager.java deleted file mode 100644 index ee6c59ebe..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/admin/DepartmentManager.java +++ /dev/null @@ -1,127 +0,0 @@ -package cn.iocoder.mall.managementweb.manager.admin; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.managementweb.controller.admin.dto.DepartmentCreateDTO; -import cn.iocoder.mall.managementweb.controller.admin.dto.DepartmentUpdateDTO; -import cn.iocoder.mall.managementweb.controller.admin.vo.DepartmentTreeNodeVO; -import cn.iocoder.mall.managementweb.controller.admin.vo.DepartmentVO; -import cn.iocoder.mall.managementweb.convert.admin.DepartmentConvert; -import cn.iocoder.mall.systemservice.enums.admin.DepartmentIdEnum; -import cn.iocoder.mall.systemservice.rpc.admin.DepartmentFeign; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.*; -import java.util.stream.Collectors; - -/** -* 部门 Manager -*/ -@Service -@Slf4j -public class DepartmentManager { - - @Autowired - private DepartmentFeign departmentFeign; - /** - * 创建部门 - * - * @param createDTO 创建部门 DTO - * @return 部门 - */ - public Integer createDepartment(DepartmentCreateDTO createDTO) { - CommonResult createDepartmentResult = departmentFeign.createDepartment(DepartmentConvert.INSTANCE.convert(createDTO)); - createDepartmentResult.checkError(); - return createDepartmentResult.getData(); - } - - /** - * 更新部门 - * - * @param updateDTO 更新部门 DTO - */ - public void updateDepartment(DepartmentUpdateDTO updateDTO) { - CommonResult updateDepartmentResult = departmentFeign.updateDepartment(DepartmentConvert.INSTANCE.convert(updateDTO)); - updateDepartmentResult.checkError(); - } - - /** - * 删除部门 - * - * @param departmentId 部门编号 - */ - public void deleteDepartment(Integer departmentId) { - CommonResult deleteDepartmentResult = departmentFeign.deleteDepartment(departmentId); - deleteDepartmentResult.checkError(); - } - - /** - * 获得部门 - * - * @param departmentId 部门编号 - * @return 部门 - */ - public DepartmentVO getDepartment(Integer departmentId) { - CommonResult getDepartmentResult = departmentFeign.getDepartment(departmentId); - getDepartmentResult.checkError(); - return DepartmentConvert.INSTANCE.convert(getDepartmentResult.getData()); - } - - /** - * 获得部门列表 - * - * @param departmentIds 部门编号列表 - * @return 部门列表 - */ - public List listDepartments(List departmentIds) { - CommonResult> listDepartmentResult = departmentFeign.listDepartments(departmentIds); - listDepartmentResult.checkError(); - return DepartmentConvert.INSTANCE.convertList(listDepartmentResult.getData()); - } - - /** - * 获得部门树结构 - * - * @return 部门树结构 - */ - public List treeDepartment() { - // 获得资源全列表 - CommonResult> listDepartmentResult = departmentFeign.listDepartments(); - listDepartmentResult.checkError(); - // 构建菜单树 - return buildDepartmentTree(listDepartmentResult.getData()); - } - - /** - * 构建部门树 - * - * @param departmentVOs 部门列表 - * @return 部门树 - */ - public static List buildDepartmentTree(List departmentVOs) { - // 排序,保证菜单的有序性 - departmentVOs.sort(Comparator.comparing(cn.iocoder.mall.systemservice.rpc.admin.vo.DepartmentVO::getSort)); - // 构建菜单树 - // 使用 LinkedHashMap 的原因,是为了排序 。实际也可以用 Stream API ,就是太丑了。 - Map treeNodeMap = new LinkedHashMap<>(); - departmentVOs.forEach(departmentVO -> treeNodeMap.put(departmentVO.getId(), DepartmentConvert.INSTANCE.convertTreeNode(departmentVO))); - // 处理父子关系 - treeNodeMap.values().stream().filter(node -> !node.getPid().equals(DepartmentIdEnum.ROOT.getId())).forEach((childNode) -> { - // 获得父节点 - DepartmentTreeNodeVO parentNode = treeNodeMap.get(childNode.getPid()); - if (parentNode == null) { - log.error("[buildDepartmentTree][department({}) 找不到父部门({})]", childNode.getId(), childNode.getPid()); - return; - } - // 将自己添加到父节点中 - if (parentNode.getChildren() == null) { - parentNode.setChildren(new ArrayList<>()); - } - parentNode.getChildren().add(childNode); - }); - // 获得到所有的根节点 - return treeNodeMap.values().stream().filter(node -> node.getPid().equals(DepartmentIdEnum.ROOT.getId())).collect(Collectors.toList()); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/datadict/DataDictManager.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/datadict/DataDictManager.java deleted file mode 100644 index 63f4c5e91..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/datadict/DataDictManager.java +++ /dev/null @@ -1,112 +0,0 @@ -package cn.iocoder.mall.managementweb.manager.datadict; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.managementweb.controller.datadict.dto.DataDictCreateDTO; -import cn.iocoder.mall.managementweb.controller.datadict.dto.DataDictUpdateDTO; -import cn.iocoder.mall.managementweb.controller.datadict.vo.DataDictSimpleVO; -import cn.iocoder.mall.managementweb.controller.datadict.vo.DataDictVO; -import cn.iocoder.mall.managementweb.convert.datadict.DataDictConvert; -import cn.iocoder.mall.systemservice.rpc.datadict.DataDictFeign; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.Comparator; -import java.util.List; - -/** -* 数据字典 Manager -*/ -@Service -public class DataDictManager { - - private static final Comparator COMPARATOR_ENUM_VALUE_SORT = Comparator - .comparing(cn.iocoder.mall.systemservice.rpc.datadict.vo.DataDictVO::getEnumValue) - .thenComparingInt(cn.iocoder.mall.systemservice.rpc.datadict.vo.DataDictVO::getSort); - - @Autowired - private DataDictFeign dataDictFeign; - /** - * 创建数据字典 - * - * @param createDTO 创建数据字典 DTO - * @return 数据字典 - */ - public Integer createDataDict(DataDictCreateDTO createDTO) { - CommonResult createDataDictResult = dataDictFeign.createDataDict(DataDictConvert.INSTANCE.convert(createDTO)); - createDataDictResult.checkError(); - return createDataDictResult.getData(); - } - - /** - * 更新数据字典 - * - * @param updateDTO 更新数据字典 DTO - */ - public void updateDataDict(DataDictUpdateDTO updateDTO) { - CommonResult updateDataDictResult = dataDictFeign.updateDataDict(DataDictConvert.INSTANCE.convert(updateDTO)); - updateDataDictResult.checkError(); - } - - /** - * 删除数据字典 - * - * @param dataDictId 数据字典编号 - */ - public void deleteDataDict(Integer dataDictId) { - CommonResult deleteDataDictResult = dataDictFeign.deleteDataDict(dataDictId); - deleteDataDictResult.checkError(); - } - - /** - * 获得数据字典 - * - * @param dataDictId 数据字典编号 - * @return 数据字典 - */ - public DataDictVO getDataDict(Integer dataDictId) { - CommonResult getDataDictResult = dataDictFeign.getDataDict(dataDictId); - getDataDictResult.checkError(); - return DataDictConvert.INSTANCE.convert(getDataDictResult.getData()); - } - - /** - * 获得数据字典列表 - * - * @param dataDictIds 数据字典编号列表 - * @return 数据字典列表 - */ - public List listDataDicts(List dataDictIds) { - CommonResult> listDataDictResult = dataDictFeign.listDataDicts(dataDictIds); - listDataDictResult.checkError(); - return DataDictConvert.INSTANCE.convertList(listDataDictResult.getData()); - } - - /** - * 获得全部数据字典 - * - * @return 数据字典列表 - */ - public List listDataDicts() { - CommonResult> listDataDictResult = dataDictFeign.listDataDicts(); - listDataDictResult.checkError(); - // 按照 enumValue 和 sort 排序 - listDataDictResult.getData().sort(COMPARATOR_ENUM_VALUE_SORT); - return DataDictConvert.INSTANCE.convertList(listDataDictResult.getData()); - } - - /** - * 获得全部数据字典 - * - * 精简返回字段 - * - * @return 数据字典列表 - */ - public List listSimpleDataDicts() { - CommonResult> listDataDictResult = dataDictFeign.listDataDicts(); - listDataDictResult.checkError(); - // 按照 enumValue 和 sort 排序 - listDataDictResult.getData().sort(COMPARATOR_ENUM_VALUE_SORT); - return DataDictConvert.INSTANCE.convertList02(listDataDictResult.getData()); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/errorcode/ErrorCodeManager.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/errorcode/ErrorCodeManager.java deleted file mode 100644 index a655736c7..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/errorcode/ErrorCodeManager.java +++ /dev/null @@ -1,96 +0,0 @@ -package cn.iocoder.mall.managementweb.manager.errorcode; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.errorcode.dto.ErrorCodeCreateDTO; -import cn.iocoder.mall.managementweb.controller.errorcode.dto.ErrorCodePageDTO; -import cn.iocoder.mall.managementweb.controller.errorcode.dto.ErrorCodeUpdateDTO; -import cn.iocoder.mall.managementweb.controller.errorcode.vo.ErrorCodeVO; -import cn.iocoder.mall.managementweb.convert.errorcode.ErrorCodeConvert; -import cn.iocoder.mall.systemservice.enums.errorcode.ErrorCodeTypeEnum; -import cn.iocoder.mall.systemservice.rpc.errorcode.ErrorCodeFeign; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** -* 错误码 Manager -*/ -@Service -public class ErrorCodeManager { - - @Autowired - private ErrorCodeFeign errorCodeFeign; - /** - * 创建错误码 - * - * @param createDTO 创建错误码 DTO - * @return 错误码 - */ - public Integer createErrorCode(ErrorCodeCreateDTO createDTO) { - CommonResult createErrorCodeResult = errorCodeFeign.createErrorCode(ErrorCodeConvert.INSTANCE.convert(createDTO) - .setType(ErrorCodeTypeEnum.MANUAL_OPERATION.getType())); - createErrorCodeResult.checkError(); - return createErrorCodeResult.getData(); - } - - /** - * 更新错误码 - * - * @param updateDTO 更新错误码 DTO - */ - public void updateErrorCode(ErrorCodeUpdateDTO updateDTO) { - CommonResult updateErrorCodeResult = errorCodeFeign.updateErrorCode(ErrorCodeConvert.INSTANCE.convert(updateDTO) - .setType(ErrorCodeTypeEnum.MANUAL_OPERATION.getType())); - updateErrorCodeResult.checkError(); - } - - /** - * 删除错误码 - * - * @param errorCodeId 错误码编号 - */ - public void deleteErrorCode(Integer errorCodeId) { - CommonResult deleteErrorCodeResult = errorCodeFeign.deleteErrorCode(errorCodeId); - deleteErrorCodeResult.checkError(); - } - - /** - * 获得错误码 - * - * @param errorCodeId 错误码编号 - * @return 错误码 - */ - public ErrorCodeVO getErrorCode(Integer errorCodeId) { - CommonResult getErrorCodeResult = errorCodeFeign.getErrorCode(errorCodeId); - getErrorCodeResult.checkError(); - return ErrorCodeConvert.INSTANCE.convert(getErrorCodeResult.getData()); - } - - /** - * 获得错误码列表 - * - * @param errorCodeIds 错误码编号列表 - * @return 错误码列表 - */ - public List listErrorCodes(List errorCodeIds) { - CommonResult> listErrorCodeResult = errorCodeFeign.listErrorCodes(errorCodeIds); - listErrorCodeResult.checkError(); - return ErrorCodeConvert.INSTANCE.convertList(listErrorCodeResult.getData()); - } - - /** - * 获得错误码分页 - * - * @param pageDTO 错误码分页查询 - * @return 错误码分页结果 - */ - public PageResult pageErrorCode(ErrorCodePageDTO pageDTO) { - CommonResult> pageErrorCodeResult - = errorCodeFeign.pageErrorCode(ErrorCodeConvert.INSTANCE.convert(pageDTO)); - pageErrorCodeResult.checkError(); - return ErrorCodeConvert.INSTANCE.convertPage(pageErrorCodeResult.getData()); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/passport/PassportManager.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/passport/PassportManager.java deleted file mode 100644 index 6752c91fa..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/passport/PassportManager.java +++ /dev/null @@ -1,123 +0,0 @@ -package cn.iocoder.mall.managementweb.manager.passport; - -import cn.iocoder.common.framework.enums.UserTypeEnum; -import cn.iocoder.common.framework.util.CollectionUtils; -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.managementweb.controller.passport.dto.PassportLoginDTO; -import cn.iocoder.mall.managementweb.controller.passport.vo.PassportAccessTokenVO; -import cn.iocoder.mall.managementweb.controller.passport.vo.PassportAdminMenuTreeNodeVO; -import cn.iocoder.mall.managementweb.controller.passport.vo.PassportAdminVO; -import cn.iocoder.mall.managementweb.controller.permission.vo.ResourceTreeNodeVO; -import cn.iocoder.mall.managementweb.convert.passport.AdminPassportConvert; -import cn.iocoder.mall.managementweb.convert.permission.ResourceConvert; -import cn.iocoder.mall.managementweb.manager.permission.ResourceManager; -import cn.iocoder.mall.systemservice.enums.permission.ResourceTypeEnum; -import cn.iocoder.mall.systemservice.rpc.admin.AdminFeign; -import cn.iocoder.mall.systemservice.rpc.admin.vo.AdminVO; -import cn.iocoder.mall.systemservice.rpc.oauth.OAuthFeign; -import cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2AccessTokenRespDTO; -import cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2CreateAccessTokenReqDTO; -import cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2RefreshAccessTokenReqDTO; -import cn.iocoder.mall.systemservice.rpc.permission.ResourceFeign; -import cn.iocoder.mall.systemservice.rpc.permission.RoleFeign; -import cn.iocoder.mall.systemservice.rpc.permission.vo.ResourceVO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.Collections; -import java.util.List; -import java.util.Set; - -@Service -public class PassportManager { - - - @Autowired - private AdminFeign adminFeign; - @Autowired - private OAuthFeign oAuthFeign; - @Autowired - private RoleFeign roleFeign; - @Autowired - private ResourceFeign resourceFeign; - public PassportAccessTokenVO login(PassportLoginDTO loginDTO, String ip) { - // 校验管理员密码 -// CommonResult verifyPasswordResult = adminFeign.verifyPassword(AdminPassportConvert.INSTANCE.convert(loginDTO).setIp(ip)); - CommonResult verifyPasswordResult = adminFeign.verifyPassword(AdminPassportConvert.INSTANCE.convert(loginDTO).setIp(ip)); - verifyPasswordResult.checkError(); - // 创建访问令牌 - CommonResult createAccessTokenResult = oAuthFeign.createAccessToken( - new OAuth2CreateAccessTokenReqDTO().setUserId(verifyPasswordResult.getData().getId()) - .setUserType(UserTypeEnum.ADMIN.getValue()).setCreateIp(ip)); - createAccessTokenResult.checkError(); - // 返回 - return AdminPassportConvert.INSTANCE.convert(createAccessTokenResult.getData()); - } - - public PassportAdminVO getAdmin(Integer adminId) { - CommonResult getAdminResult = adminFeign.getAdmin(adminId); - getAdminResult.checkError(); - return AdminPassportConvert.INSTANCE.convert(getAdminResult.getData()); - } - - public PassportAccessTokenVO refreshToken(String refreshToken, String ip) { - CommonResult refreshAccessTokenResult = oAuthFeign.refreshAccessToken( - new OAuth2RefreshAccessTokenReqDTO().setRefreshToken(refreshToken).setCreateIp(ip)); - refreshAccessTokenResult.checkError(); - return AdminPassportConvert.INSTANCE.convert(refreshAccessTokenResult.getData()); - } - - /** - * 获得指定管理员的权限列表 - * - * @param adminId 管理员编号 - * @return 权限列表 - */ - public Set listAdminPermission(Integer adminId) { - // 获得管理员拥有的角色编号列表 - CommonResult> listAdminRoleIdsResult = roleFeign.listAdminRoleIds(adminId); - listAdminRoleIdsResult.checkError(); - if (CollectionUtils.isEmpty(listAdminRoleIdsResult.getData())) { - return Collections.emptySet(); - } - // 获得角色拥有的资源列表 - CommonResult> resourceVOResult = resourceFeign.listRoleResource( - listAdminRoleIdsResult.getData(), null); - resourceVOResult.checkError(); - return CollectionUtils.convertSet(resourceVOResult.getData(), cn.iocoder.mall.systemservice.rpc.permission.vo.ResourceVO::getPermission); - } - - /** - * 获得管理员的菜单树 - * - * @param adminId 管理员编号 - * @return 菜单树 - */ - public List treeAdminMenu(Integer adminId) { - // 获得管理员拥有的角色编号列表 - CommonResult> listAdminRoleIdsResult = roleFeign.listAdminRoleIds(adminId); - listAdminRoleIdsResult.checkError(); - if (CollectionUtils.isEmpty(listAdminRoleIdsResult.getData())) { - return Collections.emptyList(); - } - // 获得角色拥有的资源(菜单)列表 - CommonResult> resourceVOResult = resourceFeign.listRoleResource( - listAdminRoleIdsResult.getData(), ResourceTypeEnum.MENU.getType()); - resourceVOResult.checkError(); - // 构建菜单树 - return this.buildAdminMenuTree(resourceVOResult.getData()); - } - - /** - * 构建菜单树 - * - * @param resourceVOs 资源(都是菜单)列表 - * @return 菜单树 - */ - private List buildAdminMenuTree(List resourceVOs) { - List treeNodeVOS = ResourceManager.buildResourceTree(resourceVOs); - // 虽然多了一层转换,但是可维护性更好。 - return ResourceConvert.INSTANCE.convert(treeNodeVOS); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/permission/PermissionManager.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/permission/PermissionManager.java deleted file mode 100644 index 64c953656..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/permission/PermissionManager.java +++ /dev/null @@ -1,68 +0,0 @@ -package cn.iocoder.mall.managementweb.manager.permission; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.managementweb.controller.permission.dto.PermissionAssignAdminRoleDTO; -import cn.iocoder.mall.managementweb.controller.permission.dto.PermissionAssignRoleResourceDTO; -import cn.iocoder.mall.managementweb.convert.permission.PermissionConvert; -import cn.iocoder.mall.systemservice.rpc.permission.PermissionFeign; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.Set; - -/** - * 权限 Manager - */ -@Service -public class PermissionManager { - - - @Autowired - private PermissionFeign permissionFeign; - /** - * 获得角色拥有的资源编号列表 - * - * @param roleId 角色编号 - * @return 资源编号列表 - */ - public Set listRoleResources(Integer roleId) { - CommonResult> listRoleResourceIdsResult = permissionFeign.listRoleResourceIds(roleId); - listRoleResourceIdsResult.checkError(); - return listRoleResourceIdsResult.getData(); - } - - /** - * 赋予角色资源 - * - * @param assignRoleResourceDTO 赋予角色资源 DTO - */ - public void assignRoleResource(PermissionAssignRoleResourceDTO assignRoleResourceDTO) { - CommonResult assignRoleResourceResult = permissionFeign.assignRoleResource( - PermissionConvert.INSTANCE.convert(assignRoleResourceDTO)); - assignRoleResourceResult.checkError(); - } - - /** - * 赋予用户角色 - * - * @param assignAdminRoleDTO 赋予用户角色 DTO - */ - public void assignAdminRole(PermissionAssignAdminRoleDTO assignAdminRoleDTO) { - CommonResult assignAdminRoleResult = permissionFeign.assignAdminRole( - PermissionConvert.INSTANCE.convert(assignAdminRoleDTO)); - assignAdminRoleResult.checkError(); - } - - /** - * 获得用户拥有的角色编号列表 - * - * @param adminId 管理员编号 - * @return 角色编号列表 - */ - public Set listAdminRoles(Integer adminId) { - CommonResult> listAdminRoleIdsResult = permissionFeign.listAdminRoleIds(adminId); - listAdminRoleIdsResult.checkError(); - return listAdminRoleIdsResult.getData(); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/permission/ResourceManager.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/permission/ResourceManager.java deleted file mode 100644 index e4afae5c1..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/permission/ResourceManager.java +++ /dev/null @@ -1,131 +0,0 @@ -package cn.iocoder.mall.managementweb.manager.permission; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.managementweb.controller.permission.dto.ResourceCreateDTO; -import cn.iocoder.mall.managementweb.controller.permission.dto.ResourceUpdateDTO; -import cn.iocoder.mall.managementweb.controller.permission.vo.ResourceTreeNodeVO; -import cn.iocoder.mall.managementweb.controller.permission.vo.ResourceVO; -import cn.iocoder.mall.managementweb.convert.permission.ResourceConvert; -import cn.iocoder.mall.systemservice.enums.permission.ResourceIdEnum; -import cn.iocoder.mall.systemservice.rpc.permission.ResourceFeign; -import cn.iocoder.mall.systemservice.rpc.permission.RoleFeign; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.*; -import java.util.stream.Collectors; - -/** -* 资源 Manager -*/ -@Service -@Slf4j -public class ResourceManager { - - - @Autowired - private ResourceFeign resourceFeign; - @Autowired - private RoleFeign roleFeign; - /** - * 创建资源 - * - * @param createDTO 创建资源 DTO - * @return 资源 - */ - public Integer createResource(ResourceCreateDTO createDTO, Integer createAdminId) { - CommonResult createResourceResult = resourceFeign.createResource(ResourceConvert.INSTANCE.convert(createDTO) - .setCreateAdminId(createAdminId)); - createResourceResult.checkError(); - return createResourceResult.getData(); - } - - /** - * 更新资源 - * - * @param updateDTO 更新资源 DTO - */ - public void updateResource(ResourceUpdateDTO updateDTO) { - CommonResult updateResourceResult = resourceFeign.updateResource(ResourceConvert.INSTANCE.convert(updateDTO)); - updateResourceResult.checkError(); - } - - /** - * 删除资源 - * - * @param resourceId 资源编号 - */ - public void deleteResource(Integer resourceId) { - CommonResult deleteResourceResult = resourceFeign.deleteResource(resourceId); - deleteResourceResult.checkError(); - } - - /** - * 获得资源 - * - * @param resourceId 资源编号 - * @return 资源 - */ - public ResourceVO getResource(Integer resourceId) { - CommonResult getResourceResult = resourceFeign.getResource(resourceId); - getResourceResult.checkError(); - return ResourceConvert.INSTANCE.convert(getResourceResult.getData()); - } - - /** - * 获得资源列表 - * - * @param resourceIds 资源编号列表 - * @return 资源列表 - */ - public List listResources(List resourceIds) { - CommonResult> listResourceResult = resourceFeign.listResource(resourceIds); - return ResourceConvert.INSTANCE.convertList(listResourceResult.getData()); - } - - /** - * 获得资源树结构 - * - * @return 资源树结构 - */ - public List treeResource() { - // 获得资源全列表 - CommonResult> listResourceResult = resourceFeign.listResource(); - listResourceResult.checkError(); - // 构建菜单树 - return buildResourceTree(listResourceResult.getData()); - } - - /** - * 构建资源树 - * - * @param resourceVOs 资源列表 - * @return 资源树 - */ - public static List buildResourceTree(List resourceVOs) { - // 排序,保证菜单的有序性 - resourceVOs.sort(Comparator.comparing(cn.iocoder.mall.systemservice.rpc.permission.vo.ResourceVO::getSort)); - // 构建菜单树 - // 使用 LinkedHashMap 的原因,是为了排序 。实际也可以用 Stream API ,就是太丑了。 - Map treeNodeMap = new LinkedHashMap<>(); - resourceVOs.forEach(resourceVO -> treeNodeMap.put(resourceVO.getId(), ResourceConvert.INSTANCE.convertTreeNode(resourceVO))); - // 处理父子关系 - treeNodeMap.values().stream().filter(node -> !node.getPid().equals(ResourceIdEnum.ROOT.getId())).forEach((childNode) -> { - // 获得父节点 - ResourceTreeNodeVO parentNode = treeNodeMap.get(childNode.getPid()); - if (parentNode == null) { - log.error("[buildResourceTree][resource({}) 找不到父资源({})]", childNode.getId(), childNode.getPid()); - return; - } - // 将自己添加到父节点中 - if (parentNode.getChildren() == null) { - parentNode.setChildren(new ArrayList<>()); - } - parentNode.getChildren().add(childNode); - }); - // 获得到所有的根节点 - return treeNodeMap.values().stream().filter(node -> node.getPid().equals(ResourceIdEnum.ROOT.getId())).collect(Collectors.toList()); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/permission/RoleManager.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/permission/RoleManager.java deleted file mode 100644 index 0725d44aa..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/permission/RoleManager.java +++ /dev/null @@ -1,105 +0,0 @@ -package cn.iocoder.mall.managementweb.manager.permission; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.permission.dto.RoleCreateDTO; -import cn.iocoder.mall.managementweb.controller.permission.dto.RolePageDTO; -import cn.iocoder.mall.managementweb.controller.permission.dto.RoleUpdateDTO; -import cn.iocoder.mall.managementweb.controller.permission.vo.RoleVO; -import cn.iocoder.mall.managementweb.convert.permission.RoleConvert; -import cn.iocoder.mall.systemservice.rpc.permission.RoleFeign; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** -* 角色 Manager -*/ -@Service -public class RoleManager { - - - @Autowired - private RoleFeign roleFeign; - /** - * 创建角色 - * - * @param createDTO 创建角色 DTO - * @return 角色 - */ - public Integer createRole(RoleCreateDTO createDTO, Integer createAdminId) { - CommonResult createRoleResult = roleFeign.createRole(RoleConvert.INSTANCE.convert(createDTO).setCreateAdminId(createAdminId)); - createRoleResult.checkError(); - return createRoleResult.getData(); - } - - /** - * 更新角色 - * - * @param updateDTO 更新角色 DTO - */ - public void updateRole(RoleUpdateDTO updateDTO) { - CommonResult updateRoleResult = roleFeign.updateRole(RoleConvert.INSTANCE.convert(updateDTO)); - updateRoleResult.checkError(); - } - - /** - * 删除角色 - * - * @param roleId 角色编号 - */ - public void deleteRole(Integer roleId) { - CommonResult deleteRoleResult = roleFeign.deleteRole(roleId); - deleteRoleResult.checkError(); - } - - /** - * 获得角色 - * - * @param roleId 角色编号 - * @return 角色 - */ - public RoleVO getRole(Integer roleId) { - CommonResult getRoleResult = roleFeign.getRole(roleId); - getRoleResult.checkError(); - return RoleConvert.INSTANCE.convert(getRoleResult.getData()); - } - - /** - * 获得所有角色 - * - * @return 角色列表 - */ - public List listAllRoles() { - CommonResult> listRoleResult = roleFeign.listAllRoles(); - listRoleResult.checkError(); - return RoleConvert.INSTANCE.convertList(listRoleResult.getData()); - } - - /** - * 获得角色列表 - * - * @param roleIds 角色编号列表 - * @return 角色列表 - */ - public List listRoles(List roleIds) { - CommonResult> listRoleResult = roleFeign.listRoles(roleIds); - listRoleResult.checkError(); - return RoleConvert.INSTANCE.convertList(listRoleResult.getData()); - } - - /** - * 获得角色分页 - * - * @param pageDTO 角色编号列表 - * @return 角色列表 - */ - public PageResult pageRole(RolePageDTO pageDTO) { - CommonResult> pageRoleResult = - roleFeign.pageRole(RoleConvert.INSTANCE.convert(pageDTO)); - pageRoleResult.checkError(); - return RoleConvert.INSTANCE.convertPage(pageRoleResult.getData()); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/systemlog/SystemAccessLogManager.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/systemlog/SystemAccessLogManager.java deleted file mode 100644 index 544bce61e..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/systemlog/SystemAccessLogManager.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.iocoder.mall.managementweb.manager.systemlog; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.systemlog.dto.SystemAccessLogPageDTO; -import cn.iocoder.mall.managementweb.controller.systemlog.vo.SystemAccessLogVO; -import cn.iocoder.mall.managementweb.convert.systemlog.SystemAccessLogConvert; -import cn.iocoder.mall.systemservice.rpc.systemlog.SystemAccessLogFeign; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** -* 系统访问日志 Manager -*/ -@Service -public class SystemAccessLogManager { - - @Autowired - private SystemAccessLogFeign systemAccessLogFeign; - /** - * 获得系统访问日志分页 - * - * @param pageDTO 系统访问日志分页查询 - * @return 系统访问日志分页结果 - */ - public PageResult pageSystemAccessLog(SystemAccessLogPageDTO pageDTO) { - CommonResult> pageSystemAccessLogResult = - systemAccessLogFeign.pageSystemAccessLog(SystemAccessLogConvert.INSTANCE.convert(pageDTO)); - pageSystemAccessLogResult.checkError(); - return SystemAccessLogConvert.INSTANCE.convertPage(pageSystemAccessLogResult.getData()); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/systemlog/SystemExceptionLogManager.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/systemlog/SystemExceptionLogManager.java deleted file mode 100644 index cc5512313..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/systemlog/SystemExceptionLogManager.java +++ /dev/null @@ -1,77 +0,0 @@ -package cn.iocoder.mall.managementweb.manager.systemlog; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.systemlog.dto.SystemExceptionLogPageDTO; -import cn.iocoder.mall.managementweb.controller.systemlog.dto.SystemExceptionLogProcessDTO; -import cn.iocoder.mall.managementweb.controller.systemlog.vo.SystemExceptionLogDetailVO; -import cn.iocoder.mall.managementweb.controller.systemlog.vo.SystemExceptionLogVO; -import cn.iocoder.mall.managementweb.convert.systemlog.SystemExceptionLogConvert; -import cn.iocoder.mall.systemservice.rpc.admin.AdminFeign; -import cn.iocoder.mall.systemservice.rpc.admin.vo.AdminVO; -import cn.iocoder.mall.systemservice.rpc.systemlog.SystemExceptionLogFeign; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -; - -/** -* 系统异常日志 Manager -*/ -@Service -public class SystemExceptionLogManager { - @Autowired - private AdminFeign adminFeign; - @Autowired - private SystemExceptionLogFeign systemExceptionLogFeign; - - /** - * 获得系统异常日志 - * - * @param systemExceptionLogId 系统异常日志编号 - * @return 系统异常日志 - */ - public SystemExceptionLogDetailVO getSystemExceptionLogDetail(Integer systemExceptionLogId) { - // 获得系统异常明细 - CommonResult getSystemExceptionLogResult - = systemExceptionLogFeign.getSystemExceptionLog(systemExceptionLogId); - getSystemExceptionLogResult.checkError(); - SystemExceptionLogDetailVO logDetailVO = SystemExceptionLogConvert.INSTANCE.convert(getSystemExceptionLogResult.getData()); - // 拼接处理管理员信息 - if (getSystemExceptionLogResult.getData().getProcessAdminId() != null) { - CommonResult adminVOResult = adminFeign.getAdmin(getSystemExceptionLogResult.getData().getProcessAdminId()); - adminVOResult.checkError(); - if (adminVOResult.getData() != null) { - SystemExceptionLogDetailVO.Admin admin = SystemExceptionLogConvert.INSTANCE.convert(adminVOResult.getData()); - logDetailVO.setProcessAdmin(admin); - } - } - return logDetailVO; - } - - /** - * 获得系统异常日志分页 - * - * @param pageDTO 系统异常日志分页查询 - * @return 系统异常日志分页结果 - */ - public PageResult pageSystemExceptionLog(SystemExceptionLogPageDTO pageDTO) { - CommonResult> pageSystemExceptionLogResult - = systemExceptionLogFeign.pageSystemExceptionLog(SystemExceptionLogConvert.INSTANCE.convert(pageDTO)); - pageSystemExceptionLogResult.checkError(); - return SystemExceptionLogConvert.INSTANCE.convertPage(pageSystemExceptionLogResult.getData()); - } - - /** - * 处理系统异常日志 - * - * @param processAdminId 处理管理员编号 - * @param processDTO 处理系统异常日志 DTO - */ - public void processSystemExceptionLog(Integer processAdminId, SystemExceptionLogProcessDTO processDTO) { - CommonResult processSystemExceptionLogResult = systemExceptionLogFeign.processSystemExceptionLog( - SystemExceptionLogConvert.INSTANCE.convert(processDTO).setProcessAdminId(processAdminId)); - processSystemExceptionLogResult.checkError(); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/service/pay/transaction/PayTransactionService.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/service/pay/transaction/PayTransactionService.java deleted file mode 100644 index ca322453d..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/service/pay/transaction/PayTransactionService.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.mall.managementweb.service.pay.transaction; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.client.pay.transaction.PayTransactionClient; -import cn.iocoder.mall.managementweb.controller.pay.vo.transaction.PayTransactionPageReqVO; -import cn.iocoder.mall.managementweb.controller.pay.vo.transaction.PayTransactionRespVO; -import cn.iocoder.mall.managementweb.convert.pay.transaction.PayTransactionConvert; -import cn.iocoder.mall.payservice.rpc.transaction.dto.PayTransactionRespDTO; -import com.google.common.collect.Lists; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.List; -import java.util.stream.Stream; - -@Service -public class PayTransactionService { - - @Resource - private PayTransactionClient payTransactionClient; - - public PageResult pagePayTransaction(PayTransactionPageReqVO pageReqVO) { - PageResult payTransactionPage = payTransactionClient.pagePayTransaction( - PayTransactionConvert.INSTANCE.convert(pageReqVO)); - return PayTransactionConvert.INSTANCE.convertPage(payTransactionPage); - } - -} diff --git a/归档/management-web-app/src/main/resources/application-dev.yml b/归档/management-web-app/src/main/resources/application-dev.yml deleted file mode 100644 index 9e9f28fb7..000000000 --- a/归档/management-web-app/src/main/resources/application-dev.yml +++ /dev/null @@ -1,18 +0,0 @@ -spring: - # Spring Cloud 配置项 - cloud: - nacos: - # Spring Cloud Nacos Discovery 配置项 - discovery: - server-addr: localhost:8848 # Nacos 服务器地址 - namespace: dev # Nacos 命名空间 - -# Dubbo 配置项 -dubbo: - # Dubbo 注册中心 - registry: - # address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 - -# Mall 认证安全配置 -mall.security.admin.demo: true # 是否开启演示模式 diff --git a/归档/management-web-app/src/main/resources/application-local.yml b/归档/management-web-app/src/main/resources/application-local.yml deleted file mode 100644 index fede4927b..000000000 --- a/归档/management-web-app/src/main/resources/application-local.yml +++ /dev/null @@ -1,15 +0,0 @@ -spring: - # Spring Cloud 配置项 - cloud: - nacos: - # Spring Cloud Nacos Discovery 配置项 - discovery: - server-addr: localhost:8848 # Nacos 服务器地址 - namespace: dev # Nacos 命名空间 - -# Dubbo 配置项 -dubbo: - # Dubbo 注册中心 - registry: - # address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 diff --git a/归档/management-web-app/src/main/resources/application.yml b/归档/management-web-app/src/main/resources/application.yml deleted file mode 100644 index 97ff516da..000000000 --- a/归档/management-web-app/src/main/resources/application.yml +++ /dev/null @@ -1,82 +0,0 @@ -# 服务器的配置项 -server: - port: 18083 - servlet: - context-path: /management-api/ - -spring: - # Application 的配置项 - application: - name: management-web - # Profile 的配置项 - profiles: - active: local - # SpringMVC 配置项 - mvc: - throw-exception-if-no-handler-found: true # 匹配不到路径时,抛出 NoHandlerFoundException 异常 - static-path-pattern: /doc.html # 静态资源的路径 - -# Dubbo 配置项 -dubbo: - # Spring Cloud Alibaba Dubbo 专属配置 - cloud: - subscribed-services: 'system-service' # 设置订阅的应用列表,默认为 * 订阅所有应用 - # Dubbo 服务消费者的配置 - consumer: - timeout: 10000 - validation: true # 开启 Consumer 参数校验 - check: false # 本地启动,不进行校验,不一定会使用到未启动的服务,嘿嘿~ - UserSmsCodeRpc: - version: 1.0.0 - UserRpc: - version: 1.0.0 - OAuth2Rpc: - version: 1.0.0 - AdminRpc: - version: 1.0.0 - ResourceRpc: - version: 1.0.0 - RoleRpc: - version: 1.0.0 - PermissionRpc: - version: 1.0.0 - DepartmentRpc: - version: 1.0.0 - DataDictRpc: - version: 1.0.0 - SystemAccessLogRpc: - version: 1.0.0 - SystemExceptionLogRpc: - version: 1.0.0 - ErrorCodeRpc: - version: 1.0.0 - ProductCategoryRpc: - version: 1.0.0 - ProductBrandRpc: - version: 1.0.0 - ProductSpuRpc: - version: 1.0.0 - ProductAttrRpc: - version: 1.0.0 - CouponTemplateRpc: - version: 1.0.0 - PromotionActivityRpc: - version: 1.0.0 - BannerRpc: - version: 1.0.0 - ProductRecommendRpc: - version: 1.0.0 - PayTransactionRpc: - version: 1.0.0 - -# Swagger 配置项 -swagger: - title: 管理后台 - description: 提供管理员管理的所有功能 - version: 1.0.0 - base-package: cn.iocoder.mall.managementweb.controller - -# Actuator 监控配置项 -management: - server.port: 38087 # 独立端口,避免被暴露出去 - endpoints.web.exposure.include: '*' # 暴露所有监控端点