mirror of
https://gitee.com/xiaochemgzi/RuoYi-Wvp.git
synced 2025-12-30 04:42:25 +00:00
v1.3.0
This commit is contained in:
6
pom.xml
6
pom.xml
@@ -264,6 +264,12 @@
|
||||
<version>1.18.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>me.zhyd.oauth</groupId>
|
||||
<artifactId>JustAuth</artifactId>
|
||||
<version>1.16.7</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
||||
@@ -62,6 +62,18 @@
|
||||
<artifactId>ruoyi-generator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- ruoyi-springboot2 / swagger knife4j 配置 -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>me.zhyd.oauth</groupId>
|
||||
<artifactId>JustAuth</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -6,6 +6,9 @@ import java.util.concurrent.TimeUnit;
|
||||
import javax.annotation.Resource;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.FastByteArrayOutputStream;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -22,9 +25,10 @@ import com.ruoyi.system.service.ISysConfigService;
|
||||
|
||||
/**
|
||||
* 验证码操作处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api("验证码操作处理")
|
||||
@RestController
|
||||
public class CaptchaController
|
||||
{
|
||||
@@ -36,12 +40,14 @@ public class CaptchaController
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
/**
|
||||
* 生成验证码
|
||||
*/
|
||||
@ApiOperation("生成验证码")
|
||||
@GetMapping("/captchaImage")
|
||||
public AjaxResult getCode(HttpServletResponse response) throws IOException
|
||||
{
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
package com.ruoyi.web.controller.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.file.FileUtils;
|
||||
import com.ruoyi.framework.config.ServerConfig;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -13,19 +19,18 @@ 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 com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.file.FileUtils;
|
||||
import com.ruoyi.framework.config.ServerConfig;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通用请求处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api("通用请求处理")
|
||||
@RestController
|
||||
@RequestMapping("/common")
|
||||
public class CommonController
|
||||
@@ -39,12 +44,14 @@ public class CommonController
|
||||
|
||||
/**
|
||||
* 通用下载请求
|
||||
*
|
||||
*
|
||||
* @param fileName 文件名称
|
||||
* @param delete 是否删除
|
||||
*/
|
||||
@ApiOperation("通用下载请求")
|
||||
@GetMapping("/download")
|
||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
||||
public void fileDownload(@ApiParam(name = "fileName", value = "文件名称",required = true) String fileName,
|
||||
@ApiParam(name = "delete", value = "是否删除") Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -72,8 +79,9 @@ public class CommonController
|
||||
/**
|
||||
* 通用上传请求(单个)
|
||||
*/
|
||||
@ApiOperation("通用上传请求(单个)")
|
||||
@PostMapping("/upload")
|
||||
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
||||
public AjaxResult uploadFile(@ApiParam(name = "file", value = "文件",required = true) MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -98,8 +106,9 @@ public class CommonController
|
||||
/**
|
||||
* 通用上传请求(多个)
|
||||
*/
|
||||
@ApiOperation("通用上传请求(多个)")
|
||||
@PostMapping("/uploads")
|
||||
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
|
||||
public AjaxResult uploadFiles(@ApiParam(name = "files", value = "文件",required = true) List<MultipartFile> files) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -135,8 +144,9 @@ public class CommonController
|
||||
/**
|
||||
* 本地资源通用下载
|
||||
*/
|
||||
@ApiOperation("本地资源通用下载")
|
||||
@GetMapping("/download/resource")
|
||||
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
||||
public void resourceDownload(@ApiParam(name = "resource", value = "资源",required = true) String resource, HttpServletRequest request, HttpServletResponse response)
|
||||
throws Exception
|
||||
{
|
||||
try
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.config.JustAuthConfig;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
@@ -13,12 +16,21 @@ import com.ruoyi.framework.web.service.SysPermissionService;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
import me.zhyd.oauth.config.AuthConfig;
|
||||
import me.zhyd.oauth.model.AuthCallback;
|
||||
import me.zhyd.oauth.model.AuthResponse;
|
||||
import me.zhyd.oauth.model.AuthUser;
|
||||
import me.zhyd.oauth.request.AuthGiteeRequest;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import me.zhyd.oauth.utils.AuthStateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -47,6 +59,48 @@ public class SysLoginController {
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@Autowired
|
||||
private JustAuthConfig justAuthConfig;
|
||||
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Anonymous
|
||||
@GetMapping("/gitee-login")
|
||||
public AjaxResult giteeLogin() throws IOException {
|
||||
AuthRequest authRequest = getAuthRequest();
|
||||
return AjaxResult.success(authRequest.authorize(AuthStateUtils.createState()));
|
||||
}
|
||||
|
||||
@Anonymous
|
||||
@GetMapping("/gitee-callback")
|
||||
public void login(AuthCallback callback,HttpServletResponse response) throws IOException {
|
||||
AuthRequest authRequest = getAuthRequest();
|
||||
AuthResponse<AuthUser> login = authRequest.login(callback);
|
||||
String accessToken = login.getData().getToken().getAccessToken();
|
||||
|
||||
String url = "https://gitee.com/api/v5/user/starred/xiaochemgzi/RuoYi-Wvp?access_token="+accessToken;
|
||||
//get请求有参并设置超时时间 单位为毫秒
|
||||
String result = HttpUtil.get(url, 30000);
|
||||
System.out.println(result);
|
||||
if("".equals(result)){
|
||||
System.out.println("已关注");
|
||||
response.sendRedirect(justAuthConfig.getGiteeFrontUrl() + "?redirect=/index&code=true");
|
||||
}else {
|
||||
response.sendRedirect(justAuthConfig.getGiteeFrontUrl() + "?redirect=/index&code=false");
|
||||
}
|
||||
}
|
||||
|
||||
private AuthRequest getAuthRequest() {
|
||||
return new AuthGiteeRequest(AuthConfig.builder()
|
||||
.clientId(justAuthConfig.getGiteeClientId())
|
||||
.clientSecret(justAuthConfig.getGiteeSecret())
|
||||
.redirectUri(justAuthConfig.getGiteeRedirectUri())
|
||||
.build());
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
|
||||
@@ -24,7 +24,7 @@ import springfox.documentation.spring.web.plugins.Docket;
|
||||
|
||||
/**
|
||||
* Swagger2的接口配置
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Configuration
|
||||
@@ -56,10 +56,11 @@ public class SwaggerConfig
|
||||
// 设置哪些接口暴露给Swagger展示
|
||||
.select()
|
||||
// 扫描所有有注解的api,用这种方式更灵活
|
||||
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||
// .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||
// 扫描指定包中的swagger注解
|
||||
// .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
|
||||
// 扫描所有 .apis(RequestHandlerSelectors.any())
|
||||
// .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
|
||||
// 扫描所有
|
||||
.apis(RequestHandlerSelectors.any())
|
||||
.paths(PathSelectors.any())
|
||||
.build()
|
||||
/* 设置安全模式,swagger可以设置访问token */
|
||||
@@ -113,9 +114,9 @@ public class SwaggerConfig
|
||||
// 用ApiInfoBuilder进行定制
|
||||
return new ApiInfoBuilder()
|
||||
// 设置标题
|
||||
.title("标题:若依管理系统_接口文档")
|
||||
.title("标题:ruoyi-wvp管理系统_接口文档")
|
||||
// 描述
|
||||
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
|
||||
.description("描述:基于ruoyi-vue的流媒体平台,开箱即用、完全开源、使用MIT许可协议")
|
||||
// 作者信息
|
||||
.contact(new Contact(ruoyiConfig.getName(), null, null))
|
||||
// 版本
|
||||
|
||||
@@ -6,9 +6,9 @@ spring:
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/ry-wvp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true&allowMultiQueries=true
|
||||
username: ry-wvp
|
||||
password: ry-wvp
|
||||
url: jdbc:mysql://192.168.158.200:3306/ry-wvp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true&allowMultiQueries=true
|
||||
username: root
|
||||
password: haoxin
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: RuoYi-Wvp
|
||||
name: RuoYi
|
||||
# 版本
|
||||
version: 3.8.9
|
||||
# 版权年份
|
||||
@@ -9,9 +9,11 @@ ruoyi:
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: D:/ruoyi/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
addressEnabled: true
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
# 公众号code
|
||||
publicCode: ruoyi-wvp666
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
@@ -144,6 +146,7 @@ xss:
|
||||
|
||||
# 作为28181服务器的配置
|
||||
sip:
|
||||
# ip: 0.0.0.0
|
||||
# [可选] 28181服务监听的端口
|
||||
port: 8116
|
||||
# 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007)
|
||||
@@ -160,13 +163,15 @@ sip:
|
||||
|
||||
##zlm 默认服务器配置
|
||||
media:
|
||||
id: zlmediakit-local
|
||||
id: haoxin-zlm-1
|
||||
# [必须修改] zlm服务器的内网IP
|
||||
ip: 127.0.0.1
|
||||
ip: 192.168.158.199
|
||||
# [必须修改] zlm服务器的http.port
|
||||
http-port: 8092
|
||||
# [可选] zlm服务器的hook所使用的IP, 默认使用sip.ip
|
||||
hook-ip: 192.168.158.199
|
||||
# [必选选] zlm服务器的hook.admin_params=secret
|
||||
secret: TWSYFgYJOQWB4ftgeYut8DW4wbs7pQnj
|
||||
secret: haoxin
|
||||
# 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试
|
||||
rtp:
|
||||
# [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输
|
||||
@@ -176,6 +181,46 @@ media:
|
||||
# [可选] 国标级联在此范围内选择端口发送媒体流,
|
||||
send-port-range: 40000,40300 # 端口范围
|
||||
|
||||
##zlm 默认服务器配置
|
||||
#media:
|
||||
# id: hxkj_zlm
|
||||
# # [必须修改] zlm服务器的内网IP
|
||||
# ip: 192.168.1.113
|
||||
# # [必须修改] zlm服务器的http.port
|
||||
# http-port: 8092
|
||||
# # [可选] zlm服务器的hook所使用的IP, 默认使用sip.ip
|
||||
# hook-ip: 192.168.1.113
|
||||
# # [必选选] zlm服务器的hook.admin_params=secret
|
||||
# secret: hxkj_zlm
|
||||
# # 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试
|
||||
# rtp:
|
||||
# # [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输
|
||||
# enable: true
|
||||
# # [可选] 在此范围内选择端口用于媒体流传输, 必须提前在zlm上配置该属性,不然自动配置此属性可能不成功
|
||||
# port-range: 30000,30500 # 端口范围
|
||||
# # [可选] 国标级联在此范围内选择端口发送媒体流,
|
||||
# send-port-range: 30000,30500 # 端口范围
|
||||
|
||||
#zlm 默认服务器配置
|
||||
#media:
|
||||
# id: hxkj_zlm
|
||||
# # [必须修改] zlm服务器的内网IP
|
||||
# ip: 192.168.158.200
|
||||
# # [必须修改] zlm服务器的http.port
|
||||
# http-port: 8092
|
||||
# # [可选] zlm服务器的hook所使用的IP, 默认使用sip.ip
|
||||
# hook-ip: 192.168.158.200
|
||||
# # [必选选] zlm服务器的hook.admin_params=secret
|
||||
# secret: hxkj_zlm
|
||||
# # 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试
|
||||
# rtp:
|
||||
# # [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输
|
||||
# enable: true
|
||||
# # [可选] 在此范围内选择端口用于媒体流传输, 必须提前在zlm上配置该属性,不然自动配置此属性可能不成功
|
||||
# port-range: 30000,30500 # 端口范围
|
||||
# # [可选] 国标级联在此范围内选择端口发送媒体流,
|
||||
# send-port-range: 30000,30500 # 端口范围
|
||||
|
||||
|
||||
# [根据业务需求配置]
|
||||
user-settings:
|
||||
@@ -189,3 +234,29 @@ user-settings:
|
||||
record-sip: false
|
||||
# 国标点播 按需拉流, true:有人观看拉流,无人观看释放, false:拉起后不自动释放
|
||||
stream-on-demand: true
|
||||
# 开启sip日志
|
||||
sip-log: true
|
||||
|
||||
# ISUP配置
|
||||
isup:
|
||||
#注册服务器监听地址(服务器本地地址)
|
||||
IP: 192.168.158.200
|
||||
route: Isup
|
||||
cmsServer:
|
||||
Port: 7660
|
||||
# 取流服务器地址端口(公网对接填入公网地址和端口)
|
||||
smsServer:
|
||||
Port: 7665
|
||||
#取流服务器监听地址端口(服务器本地地址)
|
||||
ListenIP: 192.168.158.200
|
||||
ListenPort: 7665
|
||||
# ISUP5.0登录秘钥
|
||||
isupKey: 12345678
|
||||
|
||||
# 第三方登录配置
|
||||
just-auth:
|
||||
gitee:
|
||||
client-id: 83a7af513fefb6e95e80e4fc871c4ec6457bb9d57c5a1100bc6ffb2fc5f48d9c
|
||||
secret: f7c53db06026179509df79ff5157eb9412771a4a58ce0385a1d840d79997af29
|
||||
redirect-uri: http://192.168.158.200:8080/gitee-callback
|
||||
front-url: http://localhost/login
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.ruoyi.common.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* JustAuth配置 第三方登录配置
|
||||
*
|
||||
* @author fengcheng
|
||||
*/
|
||||
@Component
|
||||
@Configuration
|
||||
public class JustAuthConfig {
|
||||
|
||||
@Value("${just-auth.gitee.client-id}")
|
||||
private String giteeClientId;
|
||||
|
||||
@Value("${just-auth.gitee.secret}")
|
||||
private String giteeSecret;
|
||||
|
||||
@Value("${just-auth.gitee.redirect-uri}")
|
||||
private String giteeRedirectUri;
|
||||
|
||||
@Value("${just-auth.gitee.front-url}")
|
||||
private String giteeFrontUrl;
|
||||
|
||||
public String getGiteeClientId() {
|
||||
return giteeClientId;
|
||||
}
|
||||
|
||||
public void setGiteeClientId(String giteeClientId) {
|
||||
this.giteeClientId = giteeClientId;
|
||||
}
|
||||
|
||||
public String getGiteeSecret() {
|
||||
return giteeSecret;
|
||||
}
|
||||
|
||||
public void setGiteeSecret(String giteeSecret) {
|
||||
this.giteeSecret = giteeSecret;
|
||||
}
|
||||
|
||||
public String getGiteeRedirectUri() {
|
||||
return giteeRedirectUri;
|
||||
}
|
||||
|
||||
public void setGiteeRedirectUri(String giteeRedirectUri) {
|
||||
this.giteeRedirectUri = giteeRedirectUri;
|
||||
}
|
||||
|
||||
public String getGiteeFrontUrl() {
|
||||
return giteeFrontUrl;
|
||||
}
|
||||
|
||||
public void setGiteeFrontUrl(String giteeFrontUrl) {
|
||||
this.giteeFrontUrl = giteeFrontUrl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.ruoyi.common.core.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Entity基类
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class WvpBaseEntity implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 搜索值 */
|
||||
@JsonIgnore
|
||||
private String searchValue;
|
||||
|
||||
/** 创建者 */
|
||||
private String createBy;
|
||||
|
||||
/** 更新者 */
|
||||
private String updateBy;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 请求参数 */
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private Map<String, Object> params;
|
||||
|
||||
public String getSearchValue()
|
||||
{
|
||||
return searchValue;
|
||||
}
|
||||
|
||||
public void setSearchValue(String searchValue)
|
||||
{
|
||||
this.searchValue = searchValue;
|
||||
}
|
||||
|
||||
public String getCreateBy()
|
||||
{
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy)
|
||||
{
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public String getUpdateBy()
|
||||
{
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy)
|
||||
{
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
public String getRemark()
|
||||
{
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark)
|
||||
{
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public Map<String, Object> getParams()
|
||||
{
|
||||
if (params == null)
|
||||
{
|
||||
params = new HashMap<>();
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(Map<String, Object> params)
|
||||
{
|
||||
this.params = params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ruoyi.common.enums;
|
||||
|
||||
/**
|
||||
* 全局错误码
|
||||
*/
|
||||
public enum ErrorCode {
|
||||
SUCCESS(0, "成功"),
|
||||
ERROR100(100, "失败"),
|
||||
ERROR400(400, "参数或方法错误"),
|
||||
ERROR404(404, "资源未找到"),
|
||||
ERROR403(403, "无权限操作"),
|
||||
ERROR401(401, "请登录后重新请求"),
|
||||
ERROR500(500, "系统异常");
|
||||
|
||||
private final int code;
|
||||
private final String msg;
|
||||
|
||||
ErrorCode(int code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.common.exception;
|
||||
|
||||
import com.ruoyi.common.enums.ErrorCode;
|
||||
|
||||
/**
|
||||
* 自定义异常,controller出现错误时直接抛出异常由全局异常捕获并返回结果
|
||||
*/
|
||||
public final class ControllerException extends RuntimeException{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 错误码
|
||||
*/
|
||||
private Integer code;
|
||||
|
||||
/**
|
||||
* 错误提示
|
||||
*/
|
||||
private String message;
|
||||
|
||||
|
||||
/**
|
||||
* 错误明细,内部调试错误
|
||||
*
|
||||
* 和 {@link CommonResult#getDetailMessage()} 一致的设计
|
||||
*/
|
||||
private String detailMessage;
|
||||
|
||||
public ControllerException(int code, String msg) {
|
||||
this.code = code;
|
||||
this.message = msg;
|
||||
}
|
||||
public ControllerException(ErrorCode errorCode) {
|
||||
this.code = errorCode.getCode();
|
||||
this.message = errorCode.getMsg();
|
||||
}
|
||||
|
||||
public String getDetailMessage()
|
||||
{
|
||||
return detailMessage;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.ruoyi.common.exception;
|
||||
|
||||
/**
|
||||
* 事务未找到异常
|
||||
*
|
||||
* @author lin
|
||||
*/
|
||||
public class SsrcTransactionNotFoundException extends Exception{
|
||||
private String deviceId;
|
||||
private String channelId;
|
||||
private String callId;
|
||||
private String stream;
|
||||
|
||||
|
||||
|
||||
public SsrcTransactionNotFoundException(String deviceId, String channelId, String callId, String stream) {
|
||||
this.deviceId = deviceId;
|
||||
this.channelId = channelId;
|
||||
this.callId = callId;
|
||||
this.stream = stream;
|
||||
}
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public String getChannelId() {
|
||||
return channelId;
|
||||
}
|
||||
|
||||
public String getCallId() {
|
||||
return callId;
|
||||
}
|
||||
|
||||
public String getStream() {
|
||||
return stream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
StringBuffer msg = new StringBuffer();
|
||||
msg.append(String.format("缓存事务信息未找到,device:%s channel: %s ", deviceId, channelId));
|
||||
if (callId != null) {
|
||||
msg.append(",callId: " + callId);
|
||||
}
|
||||
if (stream != null) {
|
||||
msg.append(",stream: " + stream);
|
||||
}
|
||||
return msg.toString();
|
||||
}
|
||||
}
|
||||
@@ -68,16 +68,16 @@
|
||||
|
||||
<!--在线文档 -->
|
||||
<!--在线文档 -->
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-ui</artifactId>
|
||||
<version>1.6.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-security</artifactId>
|
||||
<version>1.6.10</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springdoc</groupId>-->
|
||||
<!-- <artifactId>springdoc-openapi-ui</artifactId>-->
|
||||
<!-- <version>1.6.10</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springdoc</groupId>-->
|
||||
<!-- <artifactId>springdoc-openapi-security</artifactId>-->
|
||||
<!-- <version>1.6.10</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- https://mvnrepository.com/artifact/com.baomidou/dynamic-datasource-spring-boot-starter -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
@@ -85,20 +85,6 @@
|
||||
<version>3.6.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!--在线文档 -->
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-ui</artifactId>
|
||||
<version>1.6.10</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-springdoc-ui</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<!--参数校验 -->
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
@@ -118,13 +104,6 @@
|
||||
<version>1.2.307</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 取代log4j -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>log4j-over-slf4j</artifactId>
|
||||
<version>1.7.36</version>
|
||||
</dependency>
|
||||
|
||||
<!-- xml解析库 -->
|
||||
<dependency>
|
||||
<groupId>org.dom4j</groupId>
|
||||
|
||||
Reference in New Issue
Block a user