mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 09:35:29 +08:00
sso server支持vue页面
This commit is contained in:
parent
e3b0d5ff7b
commit
9d7b76da3d
@ -15,6 +15,11 @@ import org.springframework.context.annotation.Bean;
|
||||
@EnableConfigurationProperties(SocialProperties.class)
|
||||
public class SocialAutoConfiguration {
|
||||
|
||||
|
||||
public SocialAutoConfiguration() {
|
||||
System.out.println("[AutoConfiguration] |- SDK 自动装配启动");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AuthStateCache authStateCache() {
|
||||
return new AuthRedisStateCache();
|
||||
|
||||
@ -27,6 +27,10 @@
|
||||
<artifactId>ruoyi-common-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.dev33</groupId>
|
||||
<artifactId>sa-token-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
package org.dromara.common.tenant.helper;
|
||||
|
||||
import cn.dev33.satoken.session.SaSession;
|
||||
import cn.dev33.satoken.stp.SaLoginModel;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.dromara.common.core.constant.TenantConstants;
|
||||
import org.dromara.common.core.constant.UserConstants;
|
||||
import org.dromara.common.core.domain.model.LoginUser;
|
||||
import org.dromara.common.core.enums.UserType;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 登录鉴权助手
|
||||
* <p>
|
||||
* user_type 为 用户类型 同一个用户表 可以有多种用户类型 例如 pc,app
|
||||
* deivce 为 设备类型 同一个用户类型 可以有 多种设备类型 例如 web,ios
|
||||
* 可以组成 用户类型与设备类型多对多的 权限灵活控制
|
||||
* <p>
|
||||
* 多用户体系 针对 多种用户类型 但权限控制不一致
|
||||
* 可以组成 多用户类型表与多设备类型 分别控制权限
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class LoginHelper {
|
||||
public static final String TENANT_KEY = "tenantId";
|
||||
public static final String USER_KEY = "userId";
|
||||
|
||||
public static final String CLIENT_KEY = "clientid";
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户id
|
||||
*/
|
||||
public static Long getUserId() {
|
||||
return Convert.toLong(getExtra(USER_KEY));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取租户ID
|
||||
*/
|
||||
public static String getTenantId() {
|
||||
return Convert.toStr(getExtra(TENANT_KEY));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前 Token 的扩展信息
|
||||
*
|
||||
* @param key 键值
|
||||
* @return 对应的扩展数据
|
||||
*/
|
||||
private static Object getExtra(String key) {
|
||||
try {
|
||||
return StpUtil.getExtra(key);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -14,7 +14,6 @@ import org.dromara.common.core.utils.SpringUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.core.utils.reflect.ReflectUtils;
|
||||
import org.dromara.common.redis.utils.RedisUtils;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
|
||||
import java.util.Stack;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@ -3,7 +3,7 @@ FROM bellsoft/liberica-openjdk-debian:17.0.11-cds
|
||||
#FROM bellsoft/liberica-openjdk-debian:21.0.3-cds
|
||||
#FROM findepi/graalvm:java17-native
|
||||
|
||||
LABEL maintainer="Lion Li"
|
||||
LABEL maintainer="lizhw"
|
||||
|
||||
RUN mkdir -p /ruoyi/gateway/logs \
|
||||
/ruoyi/gateway/temp \
|
||||
@ -11,7 +11,7 @@ RUN mkdir -p /ruoyi/gateway/logs \
|
||||
|
||||
WORKDIR /ruoyi/gateway
|
||||
|
||||
ENV SERVER_PORT=8080 LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS=""
|
||||
ENV SERVER_PORT=18000 LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS=""
|
||||
|
||||
EXPOSE ${SERVER_PORT}
|
||||
|
||||
|
||||
@ -34,11 +34,12 @@ public class AuthFilter {
|
||||
.addInclude("/**")
|
||||
.addExclude("/actuator", "/actuator/**")
|
||||
.addExclude("/favicon.ico", "/sso/getSsoAuthUrl", "/sso/isLogin", "/sso/doLoginByTicket")
|
||||
.addExclude(ignoreWhite.getWhites().toArray(new String[0]))
|
||||
// 鉴权方法:每次访问进入
|
||||
.setAuth(obj -> {
|
||||
// 登录校验 -- 拦截所有路由
|
||||
SaRouter.match("/**")
|
||||
.notMatch(ignoreWhite.getWhites())
|
||||
// .notMatch(ignoreWhite.getWhites())
|
||||
.check(r -> {
|
||||
ServerHttpRequest request = SaReactorSyncHolder.getContext().getRequest();
|
||||
// 检查是否登录 是否有token
|
||||
|
||||
@ -9,6 +9,7 @@ import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.dev33.satoken.util.SaFoxUtil;
|
||||
import cn.dev33.satoken.util.SaResult;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -72,8 +73,8 @@ public class SsoController {
|
||||
clientLoginUrl = joinParam(clientLoginUrl, paramName.back, back);
|
||||
}
|
||||
|
||||
// 返回
|
||||
return joinParam(serverUrl, paramName.redirect, clientLoginUrl);
|
||||
// 返回 ticket
|
||||
return joinParam(serverUrl, paramName.redirect, SaFoxUtil.encodeUrl(clientLoginUrl));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -119,4 +120,12 @@ public class SsoController {
|
||||
return SaSsoClientProcessor.instance.dister();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/sso/getUserInfo")
|
||||
public SaResult getUserInfo() {
|
||||
//TODO 后续改成统一从指定用户服务取,用户应该通一接口
|
||||
return SaResult.data(StpUtil.getTokenSession().get("loginUser"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
package org.dromara.gateway.sso;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.dev33.satoken.util.SaResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class UserController {
|
||||
|
||||
@GetMapping("/user/getUserInfo")
|
||||
public SaResult getUserInfo() {
|
||||
//TODO 后续改成统一从指定用户服务取,用户应该通一接口
|
||||
return SaResult.data(StpUtil.getTokenSession().get("loginUser"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
102
ruoyi-site/ruoyi-gateway/src/main/resources/application-dev.yml
Normal file
102
ruoyi-site/ruoyi-gateway/src/main/resources/application-dev.yml
Normal file
@ -0,0 +1,102 @@
|
||||
# 安全配置
|
||||
security:
|
||||
# 不校验白名单
|
||||
ignore:
|
||||
whites:
|
||||
- /auth/code
|
||||
- /auth/logout
|
||||
- /auth/login
|
||||
- /auth/binding/*
|
||||
- /auth/social/callback
|
||||
- /auth/register
|
||||
- /auth/tenant/list
|
||||
- /resource/sms/code
|
||||
- /resource/sse/close
|
||||
- /*/v3/api-docs
|
||||
- /*/error
|
||||
- /csrf
|
||||
- /sso/getSsoAuthUrl
|
||||
- /sso/isLogin
|
||||
- /sso/doLoginByTicket
|
||||
|
||||
# sa-token配置
|
||||
sa-token:
|
||||
sign:
|
||||
# API client和server之间调用 接口签名秘钥 (随便乱摁几个字母即可)
|
||||
secret-key: kQwIOrYbtXmSDkwEiFngrKidMcdrgKor
|
||||
# token名称 (同时也是cookie名称)
|
||||
token-name: Authorization
|
||||
# 允许动态设置 token 有效期
|
||||
dynamic-active-timeout: true
|
||||
# 允许从 header 读取 token
|
||||
is-read-header: true
|
||||
# 关闭 cookie 鉴权 从根源杜绝 csrf 漏洞风险
|
||||
is-read-cookie: false
|
||||
# SSO-相关配置
|
||||
sso-client:
|
||||
# SSO-Server 端主机地址
|
||||
server-url: http://sa-sso-server.com:19000
|
||||
auth-url: http://sa-sso-server.com:8701/?mode=ticket#/sso-login
|
||||
client: "e5cd7e4891bf95d1d19206ce24a7b32e"
|
||||
#jwt密钥
|
||||
jwt-secret-key: abcdcosctlklmnopqrstuvwxyz
|
||||
token-prefix: Bearer
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
# 网关配置
|
||||
gateway:
|
||||
# 打印请求日志(自定义)
|
||||
requestLog: true
|
||||
discovery:
|
||||
locator:
|
||||
lowerCaseServiceId: true
|
||||
enabled: true
|
||||
routes:
|
||||
# 认证中心
|
||||
- id: ruoyi-auth
|
||||
uri: lb://ruoyi-auth
|
||||
predicates:
|
||||
- Path=/auth/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
# 代码生成
|
||||
- id: ruoyi-gen
|
||||
uri: lb://ruoyi-gen
|
||||
predicates:
|
||||
- Path=/tool/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
# 系统模块
|
||||
- id: ruoyi-system
|
||||
uri: lb://ruoyi-system
|
||||
predicates:
|
||||
- Path=/system/**,/monitor/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
# 资源服务
|
||||
- id: ruoyi-resource
|
||||
uri: lb://ruoyi-resource
|
||||
predicates:
|
||||
- Path=/resource/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
# workflow服务
|
||||
- id: ruoyi-workflow
|
||||
uri: lb://ruoyi-workflow
|
||||
predicates:
|
||||
- Path=/workflow/**
|
||||
# 演示服务
|
||||
- id: ruoyi-demo
|
||||
uri: lb://ruoyi-demo
|
||||
predicates:
|
||||
- Path=/demo/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
# MQ演示服务
|
||||
- id: ruoyi-h5
|
||||
uri: lb://ruoyi-h5
|
||||
predicates:
|
||||
- Path=/ruoyi-h5/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
@ -14,29 +14,6 @@ spring:
|
||||
active: @profiles.active@
|
||||
|
||||
|
||||
# sa-token配置
|
||||
sa-token:
|
||||
sign:
|
||||
# API client和server之间调用 接口签名秘钥 (随便乱摁几个字母即可)
|
||||
secret-key: kQwIOrYbtXmSDkwEiFngrKidMcdrgKor
|
||||
# token名称 (同时也是cookie名称)
|
||||
token-name: Authorization
|
||||
# 允许动态设置 token 有效期
|
||||
dynamic-active-timeout: true
|
||||
# 允许从 header 读取 token
|
||||
is-read-header: true
|
||||
# 关闭 cookie 鉴权 从根源杜绝 csrf 漏洞风险
|
||||
is-read-cookie: false
|
||||
# SSO-相关配置
|
||||
sso-client:
|
||||
# SSO-Server 端主机地址
|
||||
server-url: http://sa-sso-server.com:19000
|
||||
auth-url: http://localhost:9000/#/sso-login
|
||||
client: "pc"
|
||||
#jwt密钥
|
||||
jwt-secret-key: abcdcosctlklmnopqrstuvwxyz
|
||||
token-prefix: Bearer
|
||||
|
||||
--- # nacos 配置
|
||||
spring:
|
||||
cloud:
|
||||
@ -54,4 +31,4 @@ spring:
|
||||
config:
|
||||
import:
|
||||
- optional:nacos:application-common.yml
|
||||
- optional:nacos:${spring.application.name}.yml
|
||||
# - optional:nacos:${spring.application.name}.yml
|
||||
|
||||
@ -6,7 +6,7 @@ server:
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: mall-h5
|
||||
name: ruoyi-h5
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: @profiles.active@
|
||||
|
||||
@ -122,10 +122,10 @@
|
||||
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-nacos-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.dubbo</groupId>-->
|
||||
<!-- <artifactId>dubbo-nacos-spring-boot-starter</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
|
||||
<!-- JustAuth 的依赖配置-->
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
package org.dromara.sso;
|
||||
|
||||
import cn.dev33.satoken.sso.SaSsoManager;
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@EnableDubbo
|
||||
@SpringBootApplication(scanBasePackages = {"org.dromara"})
|
||||
public class SaSsoServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SaSsoServerApplication.class, args);
|
||||
|
||||
System.out.println();
|
||||
System.out.println("---------------------- Sa-Token SSO 统一认证中心启动成功 ----------------------");
|
||||
System.out.println("配置信息:" + SaSsoManager.getServerConfig());
|
||||
System.out.println("统一认证登录地址:http://sa-sso-server.com:19000/sso/auth");
|
||||
System.out.println("测试前需要根据官网文档修改hosts文件,测试账号密码:sa / 123456");
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.captcha;
|
||||
package org.dromara.sso.captcha;
|
||||
|
||||
import cn.hutool.captcha.generator.CodeGenerator;
|
||||
import cn.hutool.core.math.Calculator;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.config;
|
||||
package org.dromara.sso.config;
|
||||
|
||||
import cn.hutool.captcha.CaptchaUtil;
|
||||
import cn.hutool.captcha.CircleCaptcha;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.config;
|
||||
package org.dromara.sso.config;
|
||||
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.config;
|
||||
package org.dromara.sso.config;
|
||||
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
@ -1,12 +1,11 @@
|
||||
package org.ruoyi.sso.server.config;
|
||||
package org.dromara.sso.config;
|
||||
|
||||
import cn.dev33.satoken.jwt.StpLogicJwtForSimple;
|
||||
import cn.dev33.satoken.stp.StpInterface;
|
||||
import cn.dev33.satoken.stp.StpLogic;
|
||||
import org.ruoyi.sso.server.config.satoken.SaPermissionImpl;
|
||||
import org.ruoyi.sso.server.config.satoken.SaTokenExceptionHandler;
|
||||
import org.ruoyi.sso.server.config.satoken.LoginSaasHelper;
|
||||
import org.dromara.common.log.aspect.CommonLogTenantIntercept;
|
||||
import org.dromara.sso.config.satoken.LoginSaasHelper;
|
||||
import org.dromara.sso.config.satoken.SaPermissionImpl;
|
||||
import org.dromara.system.api.model.LoginUser;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@ -33,13 +32,13 @@ public class SaTokenSsoConfig {
|
||||
return new SaPermissionImpl();
|
||||
}
|
||||
|
||||
/**
|
||||
* 异常处理器
|
||||
*/
|
||||
@Bean
|
||||
public SaTokenExceptionHandler saTokenExceptionHandler() {
|
||||
return new SaTokenExceptionHandler();
|
||||
}
|
||||
// /**
|
||||
// * 异常处理器
|
||||
// */
|
||||
// @Bean
|
||||
// public SaTokenExceptionHandler saTokenExceptionHandler() {
|
||||
// return new SaTokenExceptionHandler();
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.config.satoken;
|
||||
package org.dromara.sso.config.satoken;
|
||||
|
||||
import cn.dev33.satoken.session.SaSession;
|
||||
import cn.dev33.satoken.stp.SaLoginModel;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.config.satoken;
|
||||
package org.dromara.sso.config.satoken;
|
||||
|
||||
import cn.dev33.satoken.stp.StpInterface;
|
||||
import org.dromara.common.core.enums.UserType;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.config.satoken;
|
||||
package org.dromara.sso.config.satoken;
|
||||
|
||||
import cn.dev33.satoken.exception.NotLoginException;
|
||||
import cn.dev33.satoken.exception.NotPermissionException;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.controller;
|
||||
package org.dromara.sso.controller;
|
||||
|
||||
import cn.dev33.satoken.context.SaHolder;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.controller;
|
||||
package org.dromara.sso.controller;
|
||||
|
||||
import cn.dev33.satoken.context.SaHolder;
|
||||
import cn.dev33.satoken.context.model.SaRequest;
|
||||
@ -32,15 +32,15 @@ import org.dromara.common.json.utils.JsonUtils;
|
||||
import org.dromara.common.ratelimiter.annotation.RateLimiter;
|
||||
import org.dromara.common.ratelimiter.enums.LimitType;
|
||||
import org.dromara.common.redis.utils.RedisUtils;
|
||||
import org.dromara.sso.properties.CaptchaProperties;
|
||||
import org.dromara.sso.service.IAuthStrategy;
|
||||
import org.dromara.sso.service.SysLoginService;
|
||||
import org.dromara.system.api.RemoteClientService;
|
||||
import org.dromara.system.api.domain.vo.RemoteClientVo;
|
||||
import org.ruoyi.sso.server.config.satoken.LoginSaasHelper;
|
||||
import org.ruoyi.sso.server.domain.vo.CaptchaVo;
|
||||
import org.ruoyi.sso.server.domain.vo.LoginVo;
|
||||
import org.ruoyi.sso.server.enums.CaptchaType;
|
||||
import org.ruoyi.sso.server.properties.CaptchaProperties;
|
||||
import org.ruoyi.sso.server.service.IAuthStrategy;
|
||||
import org.ruoyi.sso.server.service.SysLoginService;
|
||||
import org.dromara.sso.config.satoken.LoginSaasHelper;
|
||||
import org.dromara.sso.domain.vo.CaptchaVo;
|
||||
import org.dromara.sso.domain.vo.LoginVo;
|
||||
import org.dromara.sso.enums.CaptchaType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.ExpressionParser;
|
||||
@ -165,14 +165,21 @@ public class SsoServerController {
|
||||
}
|
||||
// 已登录情况下,构建 redirectUrl
|
||||
redirect = SaFoxUtil.decoderUrl(redirect);
|
||||
if (SaSsoConsts.MODE_SIMPLE.equals(mode)) {
|
||||
if (SaSsoConsts.MODE_SIMPLE.equals(mode)) {
|
||||
// 模式一
|
||||
SaSsoUtil.checkRedirectUrl(redirect);
|
||||
return SaResult.data(redirect);
|
||||
} else {
|
||||
//支持vue页面
|
||||
String routerUrlSuffix = "";
|
||||
int routerUrlIdx = redirect.indexOf("#/");
|
||||
if (routerUrlIdx != -1) {
|
||||
routerUrlSuffix = redirect.substring(routerUrlIdx);
|
||||
redirect = redirect.substring(0, routerUrlIdx);
|
||||
}
|
||||
// 模式二或模式三
|
||||
String redirectUrl = SaSsoUtil.buildRedirectUrl(StpUtil.getLoginId(), client, redirect);
|
||||
return SaResult.data(redirectUrl);
|
||||
return SaResult.data(redirectUrl + routerUrlSuffix);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
package org.ruoyi.sso.server.controller;
|
||||
package org.dromara.sso.controller;
|
||||
|
||||
import cn.dev33.satoken.exception.NotLoginException;
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.ruoyi.sso.server.domain.vo.LoginTenantVo;
|
||||
import org.ruoyi.sso.server.domain.vo.LoginVo;
|
||||
import org.ruoyi.sso.server.domain.vo.TenantListVo;
|
||||
import org.ruoyi.sso.server.form.RegisterBody;
|
||||
import org.ruoyi.sso.server.form.SocialLoginBody;
|
||||
import org.ruoyi.sso.server.service.IAuthStrategy;
|
||||
import org.ruoyi.sso.server.service.SysLoginService;
|
||||
import org.ruoyi.sso.server.config.satoken.LoginSaasHelper;
|
||||
import org.dromara.sso.form.RegisterBody;
|
||||
import org.dromara.sso.form.SocialLoginBody;
|
||||
import org.dromara.sso.service.IAuthStrategy;
|
||||
import org.dromara.sso.service.SysLoginService;
|
||||
import org.dromara.sso.domain.vo.LoginTenantVo;
|
||||
import org.dromara.sso.domain.vo.LoginVo;
|
||||
import org.dromara.sso.domain.vo.TenantListVo;
|
||||
import org.dromara.sso.config.satoken.LoginSaasHelper;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -1,7 +1,7 @@
|
||||
package org.ruoyi.sso.server.domain.convert;
|
||||
package org.dromara.sso.domain.convert;
|
||||
|
||||
import io.github.linpeilie.BaseMapper;
|
||||
import org.ruoyi.sso.server.domain.vo.TenantListVo;
|
||||
import org.dromara.sso.domain.vo.TenantListVo;
|
||||
import org.dromara.system.api.domain.vo.RemoteTenantVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.MappingConstants;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.domain.vo;
|
||||
package org.dromara.sso.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.domain.vo;
|
||||
package org.dromara.sso.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.domain.vo;
|
||||
package org.dromara.sso.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.domain.vo;
|
||||
package org.dromara.sso.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.enums;
|
||||
package org.dromara.sso.enums;
|
||||
|
||||
import cn.hutool.captcha.AbstractCaptcha;
|
||||
import cn.hutool.captcha.CircleCaptcha;
|
||||
@ -1,8 +1,8 @@
|
||||
package org.ruoyi.sso.server.enums;
|
||||
package org.dromara.sso.enums;
|
||||
|
||||
import cn.hutool.captcha.generator.CodeGenerator;
|
||||
import cn.hutool.captcha.generator.RandomGenerator;
|
||||
import org.ruoyi.sso.server.captcha.UnsignedMathGenerator;
|
||||
import org.dromara.sso.captcha.UnsignedMathGenerator;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.form;
|
||||
package org.dromara.sso.form;
|
||||
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.form;
|
||||
package org.dromara.sso.form;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.form;
|
||||
package org.dromara.sso.form;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.form;
|
||||
package org.dromara.sso.form;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.form;
|
||||
package org.dromara.sso.form;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.form;
|
||||
package org.dromara.sso.form;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.listener;
|
||||
package org.dromara.sso.listener;
|
||||
|
||||
import cn.dev33.satoken.config.SaTokenConfig;
|
||||
import cn.dev33.satoken.listener.SaTokenListener;
|
||||
@ -8,7 +8,7 @@ import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.http.useragent.UserAgent;
|
||||
import cn.hutool.http.useragent.UserAgentUtil;
|
||||
import org.dromara.system.api.model.SysSaasUserOnlineDTO;
|
||||
import org.ruoyi.sso.server.config.satoken.LoginSaasHelper;
|
||||
import org.dromara.sso.config.satoken.LoginSaasHelper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
@ -1,8 +1,8 @@
|
||||
package org.ruoyi.sso.server.properties;
|
||||
package org.dromara.sso.properties;
|
||||
|
||||
import lombok.Data;
|
||||
import org.ruoyi.sso.server.enums.CaptchaCategory;
|
||||
import org.ruoyi.sso.server.enums.CaptchaType;
|
||||
import org.dromara.sso.enums.CaptchaCategory;
|
||||
import org.dromara.sso.enums.CaptchaType;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.properties;
|
||||
package org.dromara.sso.properties;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
@ -1,6 +1,6 @@
|
||||
package org.ruoyi.sso.server.service;
|
||||
package org.dromara.sso.service;
|
||||
|
||||
import org.ruoyi.sso.server.domain.vo.LoginVo;
|
||||
import org.dromara.sso.domain.vo.LoginVo;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.SpringUtils;
|
||||
import org.dromara.system.api.domain.vo.RemoteClientVo;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.service;
|
||||
package org.dromara.sso.service;
|
||||
|
||||
import cn.dev33.satoken.exception.NotLoginException;
|
||||
import cn.dev33.satoken.secure.BCrypt;
|
||||
@ -7,10 +7,10 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.lock.annotation.Lock4j;
|
||||
import org.ruoyi.sso.server.form.RegisterBody;
|
||||
import org.ruoyi.sso.server.properties.CaptchaProperties;
|
||||
import org.ruoyi.sso.server.properties.UserPasswordProperties;
|
||||
import org.ruoyi.sso.server.config.satoken.LoginSaasHelper;
|
||||
import org.dromara.sso.properties.CaptchaProperties;
|
||||
import org.dromara.sso.properties.UserPasswordProperties;
|
||||
import org.dromara.sso.form.RegisterBody;
|
||||
import org.dromara.sso.config.satoken.LoginSaasHelper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.zhyd.oauth.model.AuthUser;
|
||||
@ -1,12 +1,12 @@
|
||||
package org.ruoyi.sso.server.service.impl;
|
||||
package org.dromara.sso.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.SaLoginModel;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import org.ruoyi.sso.server.domain.vo.LoginVo;
|
||||
import org.ruoyi.sso.server.form.EmailLoginBody;
|
||||
import org.ruoyi.sso.server.service.IAuthStrategy;
|
||||
import org.ruoyi.sso.server.service.SysLoginService;
|
||||
import org.ruoyi.sso.server.config.satoken.LoginSaasHelper;
|
||||
import org.dromara.sso.domain.vo.LoginVo;
|
||||
import org.dromara.sso.form.EmailLoginBody;
|
||||
import org.dromara.sso.service.IAuthStrategy;
|
||||
import org.dromara.sso.service.SysLoginService;
|
||||
import org.dromara.sso.config.satoken.LoginSaasHelper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
@ -1,14 +1,14 @@
|
||||
package org.ruoyi.sso.server.service.impl;
|
||||
package org.dromara.sso.service.impl;
|
||||
|
||||
import cn.dev33.satoken.secure.BCrypt;
|
||||
import cn.dev33.satoken.stp.SaLoginModel;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import org.ruoyi.sso.server.domain.vo.LoginVo;
|
||||
import org.ruoyi.sso.server.form.PasswordLoginBody;
|
||||
import org.ruoyi.sso.server.properties.CaptchaProperties;
|
||||
import org.ruoyi.sso.server.service.IAuthStrategy;
|
||||
import org.ruoyi.sso.server.service.SysLoginService;
|
||||
import org.ruoyi.sso.server.config.satoken.LoginSaasHelper;
|
||||
import org.dromara.sso.domain.vo.LoginVo;
|
||||
import org.dromara.sso.form.PasswordLoginBody;
|
||||
import org.dromara.sso.properties.CaptchaProperties;
|
||||
import org.dromara.sso.service.IAuthStrategy;
|
||||
import org.dromara.sso.service.SysLoginService;
|
||||
import org.dromara.sso.config.satoken.LoginSaasHelper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
@ -1,12 +1,12 @@
|
||||
package org.ruoyi.sso.server.service.impl;
|
||||
package org.dromara.sso.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.SaLoginModel;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import org.ruoyi.sso.server.domain.vo.LoginVo;
|
||||
import org.ruoyi.sso.server.form.SmsLoginBody;
|
||||
import org.ruoyi.sso.server.service.IAuthStrategy;
|
||||
import org.ruoyi.sso.server.service.SysLoginService;
|
||||
import org.ruoyi.sso.server.config.satoken.LoginSaasHelper;
|
||||
import org.dromara.sso.form.SmsLoginBody;
|
||||
import org.dromara.sso.service.IAuthStrategy;
|
||||
import org.dromara.sso.service.SysLoginService;
|
||||
import org.dromara.sso.domain.vo.LoginVo;
|
||||
import org.dromara.sso.config.satoken.LoginSaasHelper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.ruoyi.sso.server.service.impl;
|
||||
package org.dromara.sso.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.SaLoginModel;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
@ -6,15 +6,15 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.http.Method;
|
||||
import org.ruoyi.sso.server.config.satoken.LoginSaasHelper;
|
||||
import org.dromara.sso.form.SocialLoginBody;
|
||||
import org.dromara.sso.service.IAuthStrategy;
|
||||
import org.dromara.sso.config.satoken.LoginSaasHelper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.zhyd.oauth.model.AuthResponse;
|
||||
import me.zhyd.oauth.model.AuthUser;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.ruoyi.sso.server.domain.vo.LoginVo;
|
||||
import org.ruoyi.sso.server.form.SocialLoginBody;
|
||||
import org.ruoyi.sso.server.service.IAuthStrategy;
|
||||
import org.dromara.sso.domain.vo.LoginVo;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.StreamUtils;
|
||||
import org.dromara.common.core.utils.ValidatorUtils;
|
||||
@ -1,12 +1,12 @@
|
||||
package org.ruoyi.sso.server.service.impl;
|
||||
package org.dromara.sso.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.SaLoginModel;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import org.ruoyi.sso.server.domain.vo.LoginVo;
|
||||
import org.ruoyi.sso.server.form.XcxLoginBody;
|
||||
import org.ruoyi.sso.server.service.IAuthStrategy;
|
||||
import org.ruoyi.sso.server.service.SysLoginService;
|
||||
import org.ruoyi.sso.server.config.satoken.LoginSaasHelper;
|
||||
import org.dromara.sso.form.XcxLoginBody;
|
||||
import org.dromara.sso.service.IAuthStrategy;
|
||||
import org.dromara.sso.service.SysLoginService;
|
||||
import org.dromara.sso.domain.vo.LoginVo;
|
||||
import org.dromara.sso.config.satoken.LoginSaasHelper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
@ -1,23 +0,0 @@
|
||||
package org.ruoyi.sso.server;
|
||||
|
||||
import cn.dev33.satoken.sso.SaSsoManager;
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@EnableDubbo
|
||||
@SpringBootApplication
|
||||
public class SaSsoServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SaSsoServerApplication.class, args);
|
||||
|
||||
System.out.println();
|
||||
System.out.println("---------------------- Sa-Token SSO 统一认证中心启动成功 ----------------------");
|
||||
System.out.println("配置信息:" + SaSsoManager.getServerConfig());
|
||||
System.out.println("统一认证登录地址:http://sa-sso-server.com:19000/sso/auth");
|
||||
System.out.println("测试前需要根据官网文档修改hosts文件,测试账号密码:sa / 123456");
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
}
|
||||
@ -138,3 +138,79 @@ dubbo:
|
||||
retries: 0
|
||||
# 初始化检查
|
||||
check: false
|
||||
|
||||
--- # 三方授权
|
||||
justauth:
|
||||
# 前端外网访问地址
|
||||
address: http://localhost:80
|
||||
type:
|
||||
maxkey:
|
||||
# maxkey 服务器地址
|
||||
# 注意 如下均配置均不需要修改 maxkey 已经内置好了数据
|
||||
server-url: http://sso.maxkey.top
|
||||
client-id: 876892492581044224
|
||||
client-secret: x1Y5MTMwNzIwMjMxNTM4NDc3Mzche8
|
||||
redirect-uri: ${justauth.address}/social-callback?source=maxkey
|
||||
topiam:
|
||||
# topiam 服务器地址
|
||||
server-url: http://127.0.0.1:1989/api/v1/authorize/y0q************spq***********8ol
|
||||
client-id: 449c4*********937************759
|
||||
client-secret: ac7***********1e0************28d
|
||||
redirect-uri: ${justauth.address}/social-callback?source=topiam
|
||||
scopes: [openid, email, phone, profile]
|
||||
qq:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=qq
|
||||
union-id: false
|
||||
weibo:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=weibo
|
||||
gitee:
|
||||
client-id: 91436b7940090d09c72c7daf85b959cfd5f215d67eea73acbf61b6b590751a98
|
||||
client-secret: 02c6fcfd70342980cd8dd2f2c06c1a350645d76c754d7a264c4e125f9ba915ac
|
||||
redirect-uri: ${justauth.address}/social-callback?source=gitee
|
||||
dingtalk:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=dingtalk
|
||||
baidu:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=baidu
|
||||
csdn:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=csdn
|
||||
coding:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=coding
|
||||
coding-group-name: xx
|
||||
oschina:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=oschina
|
||||
alipay_wallet:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=alipay_wallet
|
||||
alipay-public-key: MIIB**************DAQAB
|
||||
wechat_open:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=wechat_open
|
||||
wechat_mp:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=wechat_mp
|
||||
wechat_enterprise:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=wechat_enterprise
|
||||
agent-id: 1000002
|
||||
gitlab:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=gitlab
|
||||
|
||||
@ -22,10 +22,6 @@ spring:
|
||||
max-idle: 10
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: http://127.0.0.1:8848
|
||||
|
||||
# Sa-Token配置
|
||||
sa-token:
|
||||
@ -138,3 +134,79 @@ dubbo:
|
||||
retries: 0
|
||||
# 初始化检查
|
||||
check: false
|
||||
|
||||
--- # 三方授权
|
||||
justauth:
|
||||
# 前端外网访问地址
|
||||
address: http://localhost:80
|
||||
type:
|
||||
maxkey:
|
||||
# maxkey 服务器地址
|
||||
# 注意 如下均配置均不需要修改 maxkey 已经内置好了数据
|
||||
server-url: http://sso.maxkey.top
|
||||
client-id: 876892492581044224
|
||||
client-secret: x1Y5MTMwNzIwMjMxNTM4NDc3Mzche8
|
||||
redirect-uri: ${justauth.address}/social-callback?source=maxkey
|
||||
topiam:
|
||||
# topiam 服务器地址
|
||||
server-url: http://127.0.0.1:1989/api/v1/authorize/y0q************spq***********8ol
|
||||
client-id: 449c4*********937************759
|
||||
client-secret: ac7***********1e0************28d
|
||||
redirect-uri: ${justauth.address}/social-callback?source=topiam
|
||||
scopes: [openid, email, phone, profile]
|
||||
qq:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=qq
|
||||
union-id: false
|
||||
weibo:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=weibo
|
||||
gitee:
|
||||
client-id: 91436b7940090d09c72c7daf85b959cfd5f215d67eea73acbf61b6b590751a98
|
||||
client-secret: 02c6fcfd70342980cd8dd2f2c06c1a350645d76c754d7a264c4e125f9ba915ac
|
||||
redirect-uri: ${justauth.address}/social-callback?source=gitee
|
||||
dingtalk:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=dingtalk
|
||||
baidu:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=baidu
|
||||
csdn:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=csdn
|
||||
coding:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=coding
|
||||
coding-group-name: xx
|
||||
oschina:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=oschina
|
||||
alipay_wallet:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=alipay_wallet
|
||||
alipay-public-key: MIIB**************DAQAB
|
||||
wechat_open:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=wechat_open
|
||||
wechat_mp:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=wechat_mp
|
||||
wechat_enterprise:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=wechat_enterprise
|
||||
agent-id: 1000002
|
||||
gitlab:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=gitlab
|
||||
|
||||
26
ruoyi-site/ruoyi-user-sso/Dockerfile
Normal file
26
ruoyi-site/ruoyi-user-sso/Dockerfile
Normal file
@ -0,0 +1,26 @@
|
||||
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
||||
FROM bellsoft/liberica-openjdk-debian:17.0.11-cds
|
||||
#FROM bellsoft/liberica-openjdk-debian:21.0.3-cds
|
||||
#FROM findepi/graalvm:java17-native
|
||||
|
||||
LABEL maintainer="lizhw"
|
||||
|
||||
RUN mkdir -p /ruoyi/resource/logs \
|
||||
/ruoyi/resource/temp \
|
||||
/ruoyi/skywalking/agent
|
||||
|
||||
WORKDIR /ruoyi/resource
|
||||
|
||||
ENV SERVER_PORT=19200 LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS=""
|
||||
|
||||
EXPOSE ${SERVER_PORT}
|
||||
|
||||
ADD ./target/ruoyi-h5.jar ./app.jar
|
||||
|
||||
ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -Dserver.port=${SERVER_PORT} \
|
||||
# 应用名称 如果想区分集群节点监控 改成不同的名称即可
|
||||
#-Dskywalking.agent.service_name=ruoyi-h5 \
|
||||
#-javaagent:/ruoyi/skywalking/agent/skywalking-agent.jar \
|
||||
-XX:+HeapDumpOnOutOfMemoryError -XX:+UseZGC ${JAVA_OPTS} \
|
||||
-jar app.jar
|
||||
|
||||
106
ruoyi-site/ruoyi-user-sso/pom.xml
Normal file
106
ruoyi-site/ruoyi-user-sso/pom.xml
Normal file
@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-site</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-user-sso</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-user-sso
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 租户模块 -->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-tenant</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- mybatis -->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-doc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 远程调用模块 TODO rename -->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-api-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql驱动包 -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-encrypt</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.alibaba.cloud</groupId>-->
|
||||
<!-- <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- SpringBoot Web依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Apache Dubbo 配置 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-nacos-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,20 @@
|
||||
package com.luban.api;
|
||||
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 鲁班H5 api启动类
|
||||
*
|
||||
* @author WeiHongBin
|
||||
*/
|
||||
@EnableDubbo
|
||||
@SpringBootApplication
|
||||
public class MallH5Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MallH5Application.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.luban.api.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* JSON 配置,修改默认 时间序列化格式
|
||||
*
|
||||
* @author WeiHongBin
|
||||
*/
|
||||
@Configuration
|
||||
public class JsonConfig {
|
||||
@Bean
|
||||
public ObjectMapper mapperObject() {
|
||||
JavaTimeModule module = new JavaTimeModule();
|
||||
module.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
module.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
module.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
||||
return new ObjectMapper().registerModule(module);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.luban.api.config;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
|
||||
import org.dromara.common.mybatis.config.MybatisPlusConfig;
|
||||
import org.dromara.common.tenant.properties.TenantProperties;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnBean(MybatisPlusConfig.class)
|
||||
@AutoConfiguration(after = {MybatisPlusConfig.class})
|
||||
public class MybatisPlusAutoConfigTenant {
|
||||
|
||||
@Bean
|
||||
public TenantLineInnerInterceptor tenantLineInnerInterceptor(TenantProperties tenantProperties) {
|
||||
return new TenantLineInnerInterceptor(new PlusTenantLineHandler(tenantProperties));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package com.luban.api.config;
|
||||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.jsqlparser.expression.Expression;
|
||||
import net.sf.jsqlparser.expression.NullValue;
|
||||
import net.sf.jsqlparser.expression.StringValue;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.tenant.helper.TenantHelper;
|
||||
import org.dromara.common.tenant.properties.TenantProperties;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自定义租户处理器
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class PlusTenantLineHandler implements TenantLineHandler {
|
||||
|
||||
private final TenantProperties tenantProperties;
|
||||
|
||||
@Override
|
||||
public Expression getTenantId() {
|
||||
String tenantId = TenantHelper.getTenantId();
|
||||
if (StringUtils.isBlank(tenantId)) {
|
||||
log.error("无法获取有效的租户id -> Null");
|
||||
return new NullValue();
|
||||
}
|
||||
// 返回固定租户
|
||||
return new StringValue(tenantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ignoreTable(String tableName) {
|
||||
String tenantId = TenantHelper.getTenantId();
|
||||
// 判断是否有租户
|
||||
if (StringUtils.isNotBlank(tenantId)) {
|
||||
// 不需要过滤租户的表
|
||||
List<String> excludes = tenantProperties.getExcludes();
|
||||
// 非业务表
|
||||
List<String> tables = ListUtil.toList(
|
||||
"gen_table",
|
||||
"gen_table_column"
|
||||
);
|
||||
tables.addAll(excludes);
|
||||
return tables.contains(tableName);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.luban.api.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
@EnableWebMvc
|
||||
public class WebMvcConfig implements WebMvcConfigurer {
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
//兼容swagger老版本v1,v2
|
||||
registry.addResourceHandler("/statics/**").addResourceLocations("classpath:/statics/");
|
||||
registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
|
||||
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/");
|
||||
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/").setCachePeriod(0);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.luban.api.constant;
|
||||
|
||||
/**
|
||||
* 包名常量
|
||||
*
|
||||
* @author WeiHongBin
|
||||
*/
|
||||
public final class PackageConstant {
|
||||
|
||||
|
||||
public static final String BASE_PACKAGE = "com.luban.api";
|
||||
|
||||
public static final String CONTROLLER_PACKAGE = BASE_PACKAGE + ".controller";
|
||||
|
||||
public static final String DAO_PACKAGE = BASE_PACKAGE + ".dao";
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package com.luban.api.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.luban.api.entity.Scripts;
|
||||
import com.luban.api.convert.ScriptsConvert;
|
||||
import com.luban.api.service.ScriptsService;
|
||||
import com.luban.api.vo.ScriptsVO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 作品 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lizhengwei
|
||||
* @since 2024-06-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/scripts")
|
||||
public class ScriptsController {
|
||||
|
||||
|
||||
private final ScriptsService scriptsService;
|
||||
|
||||
public ScriptsController(ScriptsService scriptsService) {
|
||||
this.scriptsService = scriptsService;
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "根据scriptsId查询")
|
||||
@GetMapping("/{id}")
|
||||
public ScriptsVO findScriptsById(@PathVariable Long id) {
|
||||
return ScriptsConvert.toVO(scriptsService.getById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "查询所有scripts")
|
||||
@GetMapping
|
||||
public List<ScriptsVO> listAllScriptss(@RequestParam Integer _limit) {
|
||||
QueryWrapper<Scripts> wrapper = new QueryWrapper<>();
|
||||
wrapper.last("limit " + _limit);
|
||||
return scriptsService.list(wrapper).stream().map(ScriptsConvert::toVO).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
package com.luban.api.controller;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.luban.api.exception.UnifiedException;
|
||||
import com.luban.api.vo.FileVO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author WeiHongBin
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/upload")
|
||||
@Tag(name = "上传文件")
|
||||
@Slf4j
|
||||
public class UploadController {
|
||||
|
||||
// @Value("${upload-path}") todo 改成公共文件上传下载
|
||||
|
||||
public String uploadPath = "data";
|
||||
|
||||
@Operation(summary = "文件上传")
|
||||
@PostMapping
|
||||
public List<FileVO> upload(@Validated MultipartFile files) {
|
||||
String originalFilename = files.getOriginalFilename();
|
||||
assert originalFilename != null;
|
||||
String suffix = originalFilename.substring(originalFilename.lastIndexOf(".") + 1);
|
||||
String key = IdUtil.fastSimpleUUID() + "." + suffix;
|
||||
try {
|
||||
files.transferTo(new File(uploadPath + key));
|
||||
} catch (IOException e) {
|
||||
throw new UnifiedException("文件上传失败");
|
||||
}
|
||||
return new ArrayList<FileVO>() {{
|
||||
add(new FileVO() {{
|
||||
setUrl(key);
|
||||
}});
|
||||
}};
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,175 @@
|
||||
package com.luban.api.controller;
|
||||
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.luban.api.convert.WorkConvert;
|
||||
import com.luban.api.dto.WorkCreateDTO;
|
||||
import com.luban.api.dto.WorkQueryDTO;
|
||||
import com.luban.api.dto.WorkUpdateDTO;
|
||||
import com.luban.api.entity.Work;
|
||||
import com.luban.api.service.WorkService;
|
||||
import com.luban.api.vo.WorkVO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
* <p>
|
||||
* 由于业务都非常简单,并没有把业务代码下沉到 service 层
|
||||
*
|
||||
* @author WeiHongBin
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/works")
|
||||
@Tag(name = "作品管理", description = "作品管理")
|
||||
@Slf4j
|
||||
public class WorkController {
|
||||
|
||||
|
||||
private final WorkService workService;
|
||||
|
||||
public WorkController(WorkService workService) {
|
||||
this.workService = workService;
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "根据workId查询")
|
||||
@GetMapping("/has-forms")
|
||||
public List<WorkVO> hasForms() {
|
||||
return WorkConvert.toVO(workService.list());
|
||||
}
|
||||
|
||||
@Operation(summary = "根据workId查询")
|
||||
@GetMapping("/{id}")
|
||||
public WorkVO findWorkById(@PathVariable Long id) {
|
||||
return WorkConvert.toVO(workService.getById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "查询所有work")
|
||||
@GetMapping
|
||||
public List<WorkVO> listAllWorks(@Valid WorkQueryDTO dto) {
|
||||
WorkVO vo = new WorkVO();
|
||||
vo.setTemplate(Boolean.parseBoolean(dto.getIs_template()));
|
||||
BeanUtils.copyProperties(dto, vo);
|
||||
return workService.list(new QueryWrapper<>(WorkConvert.toEntity(vo))).stream().map(WorkConvert::toVO).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "分页查询works")
|
||||
@GetMapping("/pageable")
|
||||
public IPage<WorkVO> listWorks(@Valid WorkQueryDTO dto) {
|
||||
WorkVO vo = new WorkVO();
|
||||
vo.setTemplate(Boolean.parseBoolean(dto.getIs_template()));
|
||||
BeanUtils.copyProperties(dto, vo);
|
||||
IPage<Work> page = workService.page(new Page<>(dto.getCurrent(), dto.getSize()), new LambdaQueryWrapper<>(WorkConvert.toEntity(vo)).orderByDesc(Work::getCreateTime));
|
||||
List<WorkVO> voList = page.getRecords().stream().map(WorkConvert::toVO).collect(Collectors.toList());
|
||||
return new Page<WorkVO>(page.getCurrent(), page.getSize(), page.getTotal()).setPages(page.getPages()).setRecords(voList);
|
||||
}
|
||||
|
||||
@Operation(summary = "创建work")
|
||||
@PostMapping
|
||||
public WorkVO createWork(@RequestBody @Valid WorkCreateDTO dto) {
|
||||
WorkVO vo = new WorkVO();
|
||||
BeanUtils.copyProperties(dto, vo);
|
||||
Work work = WorkConvert.toEntity(vo);
|
||||
workService.save(work);
|
||||
return WorkConvert.toVO(work);
|
||||
}
|
||||
|
||||
@Operation(summary = "更新work")
|
||||
@PutMapping("/{id}")
|
||||
public WorkVO updateWork(@PathVariable Long id, @RequestBody @Valid WorkUpdateDTO dto) {
|
||||
Work work = workService.getById(id);
|
||||
if (!StringUtils.isEmpty(dto.getTitle())) {
|
||||
work.setTitle(dto.getTitle());
|
||||
}
|
||||
if (!StringUtils.isEmpty(dto.getDescription())) {
|
||||
work.setDescription(dto.getDescription());
|
||||
}
|
||||
if (!StringUtils.isEmpty(dto.getCoverImageUrl())) {
|
||||
work.setCoverImageUrl(dto.getCoverImageUrl());
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(dto.getPages())) {
|
||||
work.setPages(JSONUtil.toJsonStr(dto.getPages()));
|
||||
}
|
||||
work.setIsTemplate(dto.isTemplate());
|
||||
work.setIsPublish(dto.isPublish());
|
||||
work.setWidth(dto.getWidth());
|
||||
work.setHeight(dto.getWidth());
|
||||
work.setPageMode(dto.getWidth());
|
||||
|
||||
work.setUpdateTime(LocalDateTime.now());
|
||||
workService.saveOrUpdate(work);
|
||||
return WorkConvert.toVO(work);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "删除work")
|
||||
@DeleteMapping("/{id}")
|
||||
public void deleteWorkById(@PathVariable Long id) {
|
||||
workService.removeById(id);
|
||||
}
|
||||
|
||||
@Operation(summary = "设为模板")
|
||||
@PostMapping("/set-as-template/{id}")
|
||||
public WorkVO markWorkAsTemplate(@PathVariable Long id) {
|
||||
Work work = workService.getById(id);
|
||||
work.setIsTemplate(true);
|
||||
work.setUpdateTime(LocalDateTime.now());
|
||||
workService.updateById(work);
|
||||
return WorkConvert.toVO(work);
|
||||
}
|
||||
|
||||
@Operation(summary = "统计作品总数")
|
||||
@GetMapping("/count")
|
||||
public long countWork() {
|
||||
return workService.count();
|
||||
}
|
||||
|
||||
@Operation(summary = "使用模板")
|
||||
@PostMapping("/use-template/{id}")
|
||||
public WorkVO useTemplate(@PathVariable Long id) {
|
||||
Work work = workService.getById(id);
|
||||
work.setId(null);
|
||||
work.setIsTemplate(false);
|
||||
work.setIsPublish(false);
|
||||
workService.save(work);
|
||||
return WorkConvert.toVO(work);
|
||||
}
|
||||
|
||||
@Operation(summary = "使用模板")
|
||||
@GetMapping("/preview/{id}")
|
||||
public ModelAndView useTemplate(@PathVariable Long id, @RequestParam(value = "view_mode", required = false) String viewMode) {
|
||||
Work work = workService.getById(id);
|
||||
|
||||
// 非预览模式, 查看不到内容
|
||||
boolean canRender = "preview".equals(viewMode) || work.getIsPublish();
|
||||
|
||||
if (!canRender) {
|
||||
work.setPages("[]");
|
||||
}
|
||||
ModelAndView mv = new ModelAndView("engine");
|
||||
//TODO 后端处理前端,这种方式不是很好,最后改成纯前端处理
|
||||
mv.addObject("workString", JSONUtil.toJsonStr(WorkConvert.toVO(work)));
|
||||
mv.addObject("work", work);
|
||||
return mv;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
package com.luban.api.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author WeiHongBin
|
||||
* @since 2019-11-26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/work-forms")
|
||||
public class WorkFormsController {
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
package com.luban.api.convert;
|
||||
|
||||
import com.luban.api.entity.Scripts;
|
||||
import com.luban.api.vo.ScriptsVO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
/**
|
||||
* Scripts 转换器
|
||||
*
|
||||
* @author WeiHongBin
|
||||
*/
|
||||
public class ScriptsConvert {
|
||||
|
||||
|
||||
public static ScriptsVO toVO(Scripts entity) {
|
||||
ScriptsVO vo = new ScriptsVO();
|
||||
BeanUtils.copyProperties(entity, vo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.luban.api.convert;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.luban.api.entity.Work;
|
||||
import com.luban.api.vo.WorkVO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Work 转换器
|
||||
*
|
||||
* @author WeiHongBin
|
||||
*/
|
||||
public class WorkConvert {
|
||||
|
||||
|
||||
public static WorkVO toVO(Work entity) {
|
||||
WorkVO vo = new WorkVO();
|
||||
BeanUtils.copyProperties(entity, vo);
|
||||
if (!StringUtils.isEmpty(entity.getPages())) {
|
||||
vo.setPages(JSONUtil.parseArray(entity.getPages()));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
public static List<WorkVO> toVO(List<Work> entitys) {
|
||||
List<WorkVO> workVOS = new ArrayList<>();
|
||||
for (Work entity : entitys) {
|
||||
workVOS.add(toVO(entity));
|
||||
}
|
||||
return workVOS;
|
||||
}
|
||||
|
||||
public static Work toEntity(WorkVO vo) {
|
||||
Work work = new Work();
|
||||
BeanUtils.copyProperties(vo, work);
|
||||
if (!CollectionUtils.isEmpty(vo.getPages())) {
|
||||
work.setPages(JSONUtil.toJsonStr(vo.getPages()));
|
||||
}
|
||||
return work;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.luban.api.dao;
|
||||
|
||||
import com.luban.api.entity.Scripts;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 作品 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author lizhengwei
|
||||
* @since 2024-06-21
|
||||
*/
|
||||
@Mapper
|
||||
public interface ScriptsDao extends BaseMapper<Scripts> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.luban.api.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.luban.api.entity.Work;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author WeiHongBin
|
||||
* @since 2019-11-26
|
||||
*/
|
||||
@Mapper
|
||||
public interface WorkDao extends BaseMapper<Work> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.luban.api.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.luban.api.entity.WorkForms;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author WeiHongBin
|
||||
* @since 2019-11-26
|
||||
*/
|
||||
@Mapper
|
||||
public interface WorkFormsDao extends BaseMapper<WorkForms> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.luban.api.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 分页基类
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@Data
|
||||
public class PageDtoBase {
|
||||
/**
|
||||
* 每页行数
|
||||
*/
|
||||
@Schema(title = "每页行数")
|
||||
protected Integer size = 10;
|
||||
|
||||
/**
|
||||
* 页码
|
||||
*/
|
||||
@Schema(title = "页码")
|
||||
protected Integer current = 1;
|
||||
|
||||
|
||||
public void setSize(Integer size) {
|
||||
if (size != null) {
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
|
||||
public void setCurrent(Integer current) {
|
||||
if (current != null) {
|
||||
this.current = current;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.luban.api.dto;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "WorkQueryDTO")
|
||||
public class ScriptsQueryDTO {
|
||||
private Integer _limit;
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.luban.api.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author WeiHongBin
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "WorkCreateDTO")
|
||||
public class WorkCreateDTO {
|
||||
|
||||
private String title;
|
||||
|
||||
private String description;
|
||||
|
||||
private String coverImageUrl;
|
||||
|
||||
private List<Object> pages;
|
||||
|
||||
private LocalDateTime createTime = LocalDateTime.now();
|
||||
|
||||
private LocalDateTime updateTime = LocalDateTime.now();
|
||||
|
||||
private boolean isPublish = false;
|
||||
|
||||
private boolean isTemplate = false;
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.luban.api.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author WeiHongBin
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "WorkQueryDTO")
|
||||
public class WorkQueryDTO extends PageDtoBase {
|
||||
|
||||
private String title;
|
||||
|
||||
private String description;
|
||||
|
||||
private String coverImageUrl;
|
||||
|
||||
private List<Object> pages;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
private String is_publish;
|
||||
|
||||
private String is_template;
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.luban.api.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author WeiHongBin
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "WorkQueryDTO")
|
||||
public class WorkUpdateDTO {
|
||||
|
||||
private String title;
|
||||
|
||||
private String description;
|
||||
|
||||
private String coverImageUrl;
|
||||
|
||||
private String width;
|
||||
|
||||
private String height;
|
||||
|
||||
/**
|
||||
* 页面模式:h5_swipper、h5_long_page、h5_form
|
||||
*/
|
||||
private String pageMode;
|
||||
|
||||
private List<Object> pages;
|
||||
|
||||
private LocalDateTime updateTime = LocalDateTime.now();
|
||||
|
||||
private boolean isPublish;
|
||||
|
||||
private boolean isTemplate;
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.luban.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 作品
|
||||
* </p>
|
||||
*
|
||||
* @author lizhengwei
|
||||
* @since 2024-06-21
|
||||
*/
|
||||
@Data
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@Schema(name = "Scripts对象", description = "作品")
|
||||
public class Scripts implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@Schema(title = "标题")
|
||||
private String title;
|
||||
|
||||
@Schema(title = "内容")
|
||||
private String content;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.luban.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author WeiHongBin
|
||||
* @since 2019-11-26
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "Work对象")
|
||||
public class Work implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(title = "标题")
|
||||
private String title;
|
||||
|
||||
@Schema(title = "描述")
|
||||
private String description;
|
||||
|
||||
private String coverImageUrl;
|
||||
|
||||
private String pages;
|
||||
|
||||
private String width;
|
||||
|
||||
private String height;
|
||||
|
||||
/**
|
||||
* 页面模式:h5_swipper、h5_long_page、h5_form
|
||||
*/
|
||||
private String pageMode;
|
||||
|
||||
private Boolean isPublish;
|
||||
|
||||
private Boolean isTemplate;
|
||||
|
||||
@Schema(title = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(title = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package com.luban.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author WeiHongBin
|
||||
* @since 2019-11-26
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "WorkForms对象")
|
||||
public class WorkForms implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private String form;
|
||||
|
||||
private Long workId;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,113 @@
|
||||
package com.luban.api.exception;
|
||||
|
||||
|
||||
import com.luban.api.util.JSON;
|
||||
import com.luban.api.vo.Result;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.validation.FieldError;
|
||||
import org.springframework.validation.ObjectError;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 异常处理
|
||||
*
|
||||
* @author WeiHongBin
|
||||
*/
|
||||
@Slf4j
|
||||
@RestControllerAdvice
|
||||
public class ExceptionHandle {
|
||||
|
||||
|
||||
@Autowired
|
||||
private JSON json;
|
||||
|
||||
/**
|
||||
* 统一异常处理器
|
||||
*
|
||||
* @param e UnifiedException
|
||||
* @return 响应实体
|
||||
*/
|
||||
@ExceptionHandler(value = UnifiedException.class)
|
||||
public ResponseEntity<Result<String>> unifiedExceptionHandle(UnifiedException e) {
|
||||
Result<String> result = new Result<>(e.getMessage(), e.getStatus());
|
||||
if (e.getStatus() == HttpStatus.INTERNAL_SERVER_ERROR) {
|
||||
log.error(e.getMessage(), e);
|
||||
} else {
|
||||
log.warn(e.getMessage(), e);
|
||||
}
|
||||
return new ResponseEntity<>(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理参数校验异常
|
||||
*
|
||||
* @param e BindException
|
||||
* @return 响应实体
|
||||
*/
|
||||
@ExceptionHandler(value = MethodArgumentNotValidException.class)
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public Result<Object> methodArgumentNotValidExceptionHandle(MethodArgumentNotValidException e) {
|
||||
// 获取全部错误对象
|
||||
List<ObjectError> allErrors = e.getBindingResult().getAllErrors();
|
||||
String errorMsg = objectErrorHandle(allErrors);
|
||||
log.warn("MethodArgumentNotValidException:", e);
|
||||
return new Result<>().error(HttpStatus.BAD_REQUEST, errorMsg);
|
||||
}
|
||||
|
||||
private String objectErrorHandle(List<ObjectError> allErrors) {
|
||||
Map<String, String> map = new HashMap<>(allErrors.size());
|
||||
// 把错误对象转成 k,v 存入Map
|
||||
allErrors.forEach(error -> {
|
||||
String key = error.getObjectName();
|
||||
if (error instanceof FieldError) {
|
||||
FieldError fieldError = (FieldError) error;
|
||||
key = fieldError.getField();
|
||||
}
|
||||
map.put(key, error.getDefaultMessage());
|
||||
});
|
||||
return json.toJSON(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理参数校验异常
|
||||
*
|
||||
* @param e BindException
|
||||
* @return 响应实体
|
||||
*/
|
||||
@ExceptionHandler(value = BindException.class)
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public Result<Object> bindExceptionHandle(BindException e) {
|
||||
// 获取全部错误对象
|
||||
List<ObjectError> allErrors = e.getAllErrors();
|
||||
String errorMsg = objectErrorHandle(allErrors);
|
||||
log.warn("BindException:", e);
|
||||
return new Result<>().error(HttpStatus.BAD_REQUEST, errorMsg);
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = NoHandlerFoundException.class)
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public Result<Object> noHandlerFoundExceptionHandle(NoHandlerFoundException e) {
|
||||
log.warn("NoHandlerFoundException 异常:", e);
|
||||
return new Result<>().error(HttpStatus.NOT_FOUND, e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = Exception.class)
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public Result<Object> exceptionHandle(Exception e) {
|
||||
log.error("Exception 异常:", e);
|
||||
return new Result<>().error(HttpStatus.INTERNAL_SERVER_ERROR, "服务繁忙,请稍后再试!");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
package com.luban.api.exception;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 统一异常
|
||||
*
|
||||
* @author WeiHongBin
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
public class UnifiedException extends RuntimeException {
|
||||
private HttpStatus status;
|
||||
private String message;
|
||||
|
||||
|
||||
/**
|
||||
* Unified exception
|
||||
* 统一异常
|
||||
*/
|
||||
public UnifiedException() {
|
||||
super("服务器忙,请稍候重试");
|
||||
this.status = HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
this.message = "服务器忙,请稍候重试";
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一异常
|
||||
*
|
||||
* @param status 异常状态码
|
||||
* @param message 异常消息
|
||||
*/
|
||||
public UnifiedException(HttpStatus status, String message) {
|
||||
super(message);
|
||||
this.status = status;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一异常
|
||||
*
|
||||
* @param message 异常消息
|
||||
*/
|
||||
public UnifiedException(String message) {
|
||||
super(message);
|
||||
this.status = HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public UnifiedException(String message, Throwable e) {
|
||||
super(message, e);
|
||||
this.status = HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public UnifiedException unauthorized(String message) {
|
||||
return new UnifiedException(HttpStatus.UNAUTHORIZED, message);
|
||||
}
|
||||
|
||||
public UnifiedException verifyError(Map map) {
|
||||
JavaTimeModule module = new JavaTimeModule();
|
||||
module.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
module.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
module.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
||||
ObjectMapper mapper = new ObjectMapper().registerModule(module);
|
||||
String asString = "";
|
||||
try {
|
||||
asString = mapper.writeValueAsString(map);
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("JSON 转换异常", e);
|
||||
}
|
||||
return new UnifiedException(HttpStatus.BAD_REQUEST, asString);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
package com.luban.api.log;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.p6spy.engine.spy.appender.MessageFormattingStrategy;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* P6Spy 日志自定义处理
|
||||
*
|
||||
* @author WeiHongBin
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class P6SpyLogger implements MessageFormattingStrategy {
|
||||
@Override
|
||||
public String formatMessage(int connectionId, String now, long elapsed, String category, String prepared, String sql, String url) {
|
||||
return StringUtils.isNotEmpty(sql) ? " Consume Time:" + elapsed + " ms " + now +
|
||||
"\n Execute SQL:" + sql.replaceAll("[\\s]+", " ") + "\n" : null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.luban.api.log;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 修改SQL执行输出到 日志,便于分析
|
||||
*
|
||||
* @author WeiHongBin
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class StdoutLogger extends com.p6spy.engine.spy.appender.StdoutLogger {
|
||||
@Override
|
||||
public void logText(String text) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.luban.api.service;
|
||||
|
||||
import com.luban.api.entity.Scripts;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 作品 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author lizhengwei
|
||||
* @since 2024-06-21
|
||||
*/
|
||||
public interface ScriptsService extends IService<Scripts> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.luban.api.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.luban.api.entity.WorkForms;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author WeiHongBin
|
||||
* @since 2019-11-26
|
||||
*/
|
||||
public interface WorkFormsService extends IService<WorkForms> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.luban.api.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.luban.api.entity.Work;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author WeiHongBin
|
||||
* @since 2019-11-26
|
||||
*/
|
||||
public interface WorkService extends IService<Work> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.luban.api.service.impl;
|
||||
|
||||
import com.luban.api.dao.ScriptsDao;
|
||||
import com.luban.api.entity.Scripts;
|
||||
import com.luban.api.service.ScriptsService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 作品 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author lizhengwei
|
||||
* @since 2024-06-21
|
||||
*/
|
||||
@Service
|
||||
public class ScriptsServiceImpl extends ServiceImpl<ScriptsDao, Scripts> implements ScriptsService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.luban.api.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.luban.api.dao.WorkFormsDao;
|
||||
import com.luban.api.entity.WorkForms;
|
||||
import com.luban.api.service.WorkFormsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author WeiHongBin
|
||||
* @since 2019-11-26
|
||||
*/
|
||||
@Service
|
||||
public class WorkFormsServiceImpl extends ServiceImpl<WorkFormsDao, WorkForms> implements WorkFormsService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.luban.api.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.luban.api.dao.WorkDao;
|
||||
import com.luban.api.entity.Work;
|
||||
import com.luban.api.service.WorkService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author WeiHongBin
|
||||
* @since 2019-11-26
|
||||
*/
|
||||
@Service
|
||||
public class WorkServiceImpl extends ServiceImpl<WorkDao, Work> implements WorkService {
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package com.luban.api.util;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* JSON 转换工具
|
||||
*
|
||||
* @author WeiHongBin
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class JSON {
|
||||
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
public String toJSON(Object jsonObj) {
|
||||
try {
|
||||
return objectMapper.writeValueAsString(jsonObj);
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("JSON 转换异常 转换异常的数据类型: " + jsonObj.getClass().getName(), e);
|
||||
}
|
||||
return jsonObj.toString();
|
||||
}
|
||||
|
||||
|
||||
public Map toMap(String json) {
|
||||
try {
|
||||
return objectMapper.readValue(json, Map.class);
|
||||
} catch (IOException e) {
|
||||
log.error("JSON 转换异常", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Map<String, String>> toListMapStr(String json) {
|
||||
try {
|
||||
return objectMapper.readValue(json, new TypeReference<List<Map<String, String>>>() {
|
||||
});
|
||||
} catch (IOException e) {
|
||||
log.error("JSON 转换异常", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public List<String> toListString(String json) {
|
||||
try {
|
||||
return objectMapper.readValue(json, new TypeReference<List<String>>() {
|
||||
});
|
||||
} catch (IOException e) {
|
||||
log.error("JSON 转换异常", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.luban.api.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author WeiHongBin
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "文件视图对象")
|
||||
public class FileVO {
|
||||
private String url;
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
package com.luban.api.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 统一返回
|
||||
*
|
||||
* @author WeiHongBin
|
||||
*/
|
||||
@Schema(description = "返回响应数据")
|
||||
@Component
|
||||
@Data
|
||||
public class Result<T> {
|
||||
@Schema(title = "返回状态码")
|
||||
private Integer code;
|
||||
@Schema(title = "返回消息")
|
||||
private String msg;
|
||||
@Schema(title = "返回当前状态")
|
||||
private HttpStatus status;
|
||||
@Schema(title = "返回对象")
|
||||
private T data;
|
||||
|
||||
public Result() {
|
||||
this.msg = "成功";
|
||||
setStatus(HttpStatus.OK);
|
||||
}
|
||||
|
||||
public void setStatus(HttpStatus status) {
|
||||
this.status = status;
|
||||
setCode(status.value());
|
||||
}
|
||||
|
||||
private void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public Result(T data) {
|
||||
setStatus(HttpStatus.OK);
|
||||
this.msg = "成功";
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public Result(String msg, HttpStatus status, T data) {
|
||||
this.msg = msg;
|
||||
setStatus(status);
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public Result(String msg, HttpStatus status) {
|
||||
this.msg = msg;
|
||||
setStatus(status);
|
||||
}
|
||||
|
||||
public Result<T> ok(T data) {
|
||||
setStatus(HttpStatus.OK);
|
||||
this.msg = "成功";
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Result<T> error(HttpStatus status, String msg) {
|
||||
setStatus(status);
|
||||
this.msg = msg;
|
||||
this.data = null;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isOK() {
|
||||
return this.getStatus() == HttpStatus.OK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Result{" +
|
||||
"code=" + code +
|
||||
", msg='" + msg + '\'' +
|
||||
", status=" + status +
|
||||
", data=" + data +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.luban.api.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "Script视图对象")
|
||||
public class ScriptsVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String title;
|
||||
|
||||
private String content;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.luban.api.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author WeiHongBin
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "Work视图对象")
|
||||
public class WorkVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String title;
|
||||
|
||||
private String description;
|
||||
|
||||
private String coverImageUrl;
|
||||
|
||||
private List<Object> pages;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
private boolean isPublish;
|
||||
|
||||
private boolean isTemplate;
|
||||
}
|
||||
174
ruoyi-site/ruoyi-user-sso/src/main/resources/application-dev.yml
Normal file
174
ruoyi-site/ruoyi-user-sso/src/main/resources/application-dev.yml
Normal file
@ -0,0 +1,174 @@
|
||||
--- # spring 配置
|
||||
spring:
|
||||
# 资源信息
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 10MB
|
||||
thymeleaf:
|
||||
cache: false
|
||||
prefix: classpath:/templates/
|
||||
check-template-location: true
|
||||
mode: HTML
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
# 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
|
||||
dynamic:
|
||||
# 性能分析插件(有性能损耗 不建议生产环境使用)
|
||||
p6spy: false
|
||||
# 设置默认的数据源或者数据源组,默认值即为 master
|
||||
primary: master
|
||||
# 严格模式 匹配不到数据源则报错
|
||||
strict: true
|
||||
datasource:
|
||||
# 主库数据源
|
||||
master:
|
||||
type: ${spring.datasource.type}
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||
url: jdbc:mysql://mysql:3306/mall-h5-core?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||
username: root
|
||||
password: root
|
||||
# 从库数据源
|
||||
slave:
|
||||
lazy: true
|
||||
type: ${spring.datasource.type}
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://mysql:3306/mall-h5-core?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||
username:
|
||||
password:
|
||||
hikari:
|
||||
# 最大连接池数量
|
||||
maxPoolSize: 20
|
||||
# 最小空闲线程数量
|
||||
minIdle: 10
|
||||
# 配置获取连接等待超时的时间
|
||||
connectionTimeout: 30000
|
||||
# 校验超时时间
|
||||
validationTimeout: 5000
|
||||
# 空闲连接存活最大时间,默认10分钟
|
||||
idleTimeout: 600000
|
||||
# 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认30分钟
|
||||
maxLifetime: 1800000
|
||||
# 多久检查一次连接的活性
|
||||
keepaliveTime: 30000
|
||||
data:
|
||||
redis:
|
||||
# Redis数据库索引(默认为0)
|
||||
database: 0
|
||||
# Redis服务器地址
|
||||
host: redis
|
||||
# Redis服务器连接端口
|
||||
port: 6379
|
||||
# Redis服务器连接密码(默认为空)
|
||||
password: Lzw8800580/
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池最大连接数
|
||||
max-active: 200
|
||||
# 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 10
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
|
||||
|
||||
springdoc:
|
||||
api-docs:
|
||||
# 是否开启接口文档
|
||||
enabled: true
|
||||
# swagger-ui:
|
||||
# # 持久化认证数据
|
||||
# persistAuthorization: true
|
||||
info:
|
||||
# 标题
|
||||
title: '标题:${spring.application.name}多租户管理系统_接口文档'
|
||||
# 描述
|
||||
description: '描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...'
|
||||
# 版本
|
||||
version: '版本号: 1.0.0'
|
||||
# 作者信息
|
||||
contact:
|
||||
name: Lion Li
|
||||
email: crazylionli@163.com
|
||||
url: https://gitee.com/dromara/RuoYi-Vue-Plus
|
||||
components:
|
||||
# 鉴权方式配置
|
||||
security-schemes:
|
||||
apiKey:
|
||||
type: APIKEY
|
||||
in: HEADER
|
||||
name: Authorization
|
||||
#这里定义了两个分组,可定义多个,也可以不定义
|
||||
group-configs:
|
||||
- group: 1.演示模块
|
||||
packages-to-scan: org.dromara.demo
|
||||
- group: 2.通用模块
|
||||
packages-to-scan: org.dromara.web
|
||||
- group: 3.系统模块
|
||||
packages-to-scan: org.dromara.system
|
||||
- group: 4.代码生成模块
|
||||
packages-to-scan: org.dromara.generator
|
||||
|
||||
|
||||
|
||||
|
||||
# 多租户配置
|
||||
tenant:
|
||||
# 是否开启
|
||||
enable: true
|
||||
# 排除表
|
||||
excludes:
|
||||
- sys_menu
|
||||
- sys_tenant
|
||||
- sys_tenant_package
|
||||
- sys_saas_user_role
|
||||
|
||||
|
||||
|
||||
# MyBatisPlus配置
|
||||
# https://baomidou.com/config/
|
||||
mybatis-plus:
|
||||
# 多包名使用 例如 org.dromara.**.mapper,org.xxx.**.mapper
|
||||
mapperPackage: com.luban.api.dao
|
||||
# # 实体扫描,多个package用逗号或者分号分隔
|
||||
# typeAliasesPackage: com.luban.api.entity
|
||||
global-config:
|
||||
dbConfig:
|
||||
# 主键类型
|
||||
# AUTO 自增 NONE 空 INPUT 用户输入 ASSIGN_ID 雪花 ASSIGN_UUID 唯一 UUID
|
||||
# 如需改为自增 需要将数据库表全部设置为自增
|
||||
idType: ASSIGN_ID
|
||||
|
||||
# dubbo
|
||||
dubbo:
|
||||
protocol:
|
||||
name: tri
|
||||
port: 20880
|
||||
application:
|
||||
qos-enable: false
|
||||
logger: slf4j
|
||||
name: ${spring.application.name}
|
||||
# 注册中心配置
|
||||
registry:
|
||||
address: nacos://nacos-registry:8848
|
||||
group: DUBBO_GROUP
|
||||
parameters:
|
||||
namespace: c5c00044-93e6-4e66-8060-3f39aa7ab82b
|
||||
# 消费者相关配置
|
||||
consumer:
|
||||
# 结果缓存(LRU算法)
|
||||
# 会有数据不一致问题 建议在注解局部开启
|
||||
cache: false
|
||||
# 支持校验注解
|
||||
validation: jvalidationNew
|
||||
# 调用重试 不包括第一次 0为不需要重试
|
||||
retries: 0
|
||||
# 初始化检查
|
||||
check: false
|
||||
@ -0,0 +1,174 @@
|
||||
--- # spring 配置
|
||||
spring:
|
||||
# 资源信息
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 10MB
|
||||
thymeleaf:
|
||||
cache: false
|
||||
prefix: classpath:/templates/
|
||||
check-template-location: true
|
||||
mode: HTML
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
# 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
|
||||
dynamic:
|
||||
# 性能分析插件(有性能损耗 不建议生产环境使用)
|
||||
p6spy: false
|
||||
# 设置默认的数据源或者数据源组,默认值即为 master
|
||||
primary: master
|
||||
# 严格模式 匹配不到数据源则报错
|
||||
strict: true
|
||||
datasource:
|
||||
# 主库数据源
|
||||
master:
|
||||
type: ${spring.datasource.type}
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||
url: jdbc:mysql://localhost:3306/mall-h5-core?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||
username: root
|
||||
password: root
|
||||
# 从库数据源
|
||||
slave:
|
||||
lazy: true
|
||||
type: ${spring.datasource.type}
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/mall-h5-core?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||
username:
|
||||
password:
|
||||
hikari:
|
||||
# 最大连接池数量
|
||||
maxPoolSize: 20
|
||||
# 最小空闲线程数量
|
||||
minIdle: 10
|
||||
# 配置获取连接等待超时的时间
|
||||
connectionTimeout: 30000
|
||||
# 校验超时时间
|
||||
validationTimeout: 5000
|
||||
# 空闲连接存活最大时间,默认10分钟
|
||||
idleTimeout: 600000
|
||||
# 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认30分钟
|
||||
maxLifetime: 1800000
|
||||
# 多久检查一次连接的活性
|
||||
keepaliveTime: 30000
|
||||
data:
|
||||
redis:
|
||||
# Redis数据库索引(默认为0)
|
||||
database: 0
|
||||
# Redis服务器地址
|
||||
host: 127.0.0.1
|
||||
# Redis服务器连接端口
|
||||
port: 6379
|
||||
# Redis服务器连接密码(默认为空)
|
||||
password: Lzw8800580/
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池最大连接数
|
||||
max-active: 200
|
||||
# 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 10
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
|
||||
|
||||
springdoc:
|
||||
api-docs:
|
||||
# 是否开启接口文档
|
||||
enabled: true
|
||||
# swagger-ui:
|
||||
# # 持久化认证数据
|
||||
# persistAuthorization: true
|
||||
info:
|
||||
# 标题
|
||||
title: '标题:${spring.application.name}多租户管理系统_接口文档'
|
||||
# 描述
|
||||
description: '描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...'
|
||||
# 版本
|
||||
version: '版本号: 1.0.0'
|
||||
# 作者信息
|
||||
contact:
|
||||
name: Lion Li
|
||||
email: crazylionli@163.com
|
||||
url: https://gitee.com/dromara/RuoYi-Vue-Plus
|
||||
components:
|
||||
# 鉴权方式配置
|
||||
security-schemes:
|
||||
apiKey:
|
||||
type: APIKEY
|
||||
in: HEADER
|
||||
name: Authorization
|
||||
#这里定义了两个分组,可定义多个,也可以不定义
|
||||
group-configs:
|
||||
- group: 1.演示模块
|
||||
packages-to-scan: org.dromara.demo
|
||||
- group: 2.通用模块
|
||||
packages-to-scan: org.dromara.web
|
||||
- group: 3.系统模块
|
||||
packages-to-scan: org.dromara.system
|
||||
- group: 4.代码生成模块
|
||||
packages-to-scan: org.dromara.generator
|
||||
|
||||
|
||||
|
||||
|
||||
# 多租户配置
|
||||
tenant:
|
||||
# 是否开启
|
||||
enable: true
|
||||
# 排除表
|
||||
excludes:
|
||||
- sys_menu
|
||||
- sys_tenant
|
||||
- sys_tenant_package
|
||||
- sys_saas_user_role
|
||||
|
||||
|
||||
|
||||
# MyBatisPlus配置
|
||||
# https://baomidou.com/config/
|
||||
mybatis-plus:
|
||||
# 多包名使用 例如 org.dromara.**.mapper,org.xxx.**.mapper
|
||||
mapperPackage: com.luban.api.dao
|
||||
# # 实体扫描,多个package用逗号或者分号分隔
|
||||
# typeAliasesPackage: com.luban.api.entity
|
||||
global-config:
|
||||
dbConfig:
|
||||
# 主键类型
|
||||
# AUTO 自增 NONE 空 INPUT 用户输入 ASSIGN_ID 雪花 ASSIGN_UUID 唯一 UUID
|
||||
# 如需改为自增 需要将数据库表全部设置为自增
|
||||
idType: ASSIGN_ID
|
||||
|
||||
# dubbo
|
||||
dubbo:
|
||||
protocol:
|
||||
name: tri
|
||||
port: 20880
|
||||
application:
|
||||
qos-enable: false
|
||||
logger: slf4j
|
||||
name: ${spring.application.name}
|
||||
# 注册中心配置
|
||||
registry:
|
||||
address: nacos://127.0.0.1:8848
|
||||
group: DUBBO_GROUP
|
||||
parameters:
|
||||
namespace: c5c00044-93e6-4e66-8060-3f39aa7ab82b
|
||||
# 消费者相关配置
|
||||
consumer:
|
||||
# 结果缓存(LRU算法)
|
||||
# 会有数据不一致问题 建议在注解局部开启
|
||||
cache: false
|
||||
# 支持校验注解
|
||||
validation: jvalidationNew
|
||||
# 调用重试 不包括第一次 0为不需要重试
|
||||
retries: 0
|
||||
# 初始化检查
|
||||
check: false
|
||||
12
ruoyi-site/ruoyi-user-sso/src/main/resources/application.yml
Normal file
12
ruoyi-site/ruoyi-user-sso/src/main/resources/application.yml
Normal file
@ -0,0 +1,12 @@
|
||||
# Tomcat
|
||||
server:
|
||||
port: 19200
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: mall-h5
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: @profiles.active@
|
||||
205925
ruoyi-site/ruoyi-user-sso/src/main/resources/engine-assets/engine.umd.js
Normal file
205925
ruoyi-site/ruoyi-user-sso/src/main/resources/engine-assets/engine.umd.js
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,4 @@
|
||||
#错误消息
|
||||
user.phonenumber.not.blank=用户手机号不能为空
|
||||
user.jcaptcha.expire=验证码已失效
|
||||
user.not.exists=对不起, 您的账号:{0} 不存在.
|
||||
@ -0,0 +1,5 @@
|
||||
#错误消息
|
||||
not.null=* Required fill in
|
||||
user.phonenumber.not.blank=用户手机号不能为空
|
||||
user.jcaptcha.expire=Captcha invalid
|
||||
user.not.exists=Sorry, your account: {0} does not exist
|
||||
@ -0,0 +1,5 @@
|
||||
#错误消息
|
||||
not.null=* 必须填写
|
||||
user.phonenumber.not.blank=用户手机号不能为空
|
||||
user.jcaptcha.expire=验证码已失效
|
||||
user.not.exists=对不起, 您的账号:{0} 不存在.
|
||||
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.luban.api.dao.ScriptsDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.luban.api.entity.Scripts">
|
||||
<id column="id" property="id" />
|
||||
<result column="title" property="title" />
|
||||
<result column="content" property="content" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.luban.api.dao.WorkDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.luban.api.entity.Work">
|
||||
<id column="id" property="id"/>
|
||||
<result column="title" property="title"/>
|
||||
<result column="description" property="description"/>
|
||||
<result column="cover_image_url" property="coverImageUrl"/>
|
||||
<result column="pages" property="pages"/>
|
||||
<result column="is_publish" property="isPublish"/>
|
||||
<result column="is_template" property="isTemplate"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.luban.api.dao.WorkFormsDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.luban.api.entity.WorkForms">
|
||||
<id column="id" property="id"/>
|
||||
<result column="form" property="form"/>
|
||||
<result column="work_id" property="workId"/>
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user