nolan 4 years ago
parent
commit
ce0a9eae40
  1. 15
      hl-wechat/pom.xml
  2. 2
      hl-wechat/src/main/java/com/ruoyi/hl/config/VideoConfig.java
  3. 2
      hl-wechat/src/main/java/com/ruoyi/hl/config/WxConfig.java
  4. 15
      hl-wechat/src/main/java/com/ruoyi/hl/controller/WxController.java
  5. 28
      hl-wechat/src/main/java/com/ruoyi/hl/forest/clients/MiniWeChatClients.java
  6. 4
      hl-wechat/src/main/java/com/ruoyi/hl/forest/interceptor/UnlimitedInterceptor.java
  7. 2
      hl-wechat/src/main/java/com/ruoyi/hl/forest/interceptor/WriteLogInterceptor.java
  8. 2
      hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxAuthAccessTokenRes.java
  9. 2
      hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxGetUnlimitedRes.java
  10. 2
      hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxMiniCode2SessionRes.java
  11. 2
      hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxMiniTokenRes.java
  12. 2
      hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxPublicCode2UserInfoRes.java
  13. 2
      hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxPublickTokenRes.java
  14. 2
      hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxRes.java
  15. 2
      hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxSendTemplateRes.java
  16. 2
      hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxUserInfoRes.java
  17. 2
      hl-wechat/src/main/java/com/ruoyi/hl/service/WxService.java
  18. 10
      hl-wechat/src/main/java/com/ruoyi/hl/service/WxTokenService.java
  19. 99
      hl-wechat/src/main/resources/application.yml
  20. 19
      pom.xml
  21. 6
      ruoyi-admin/pom.xml
  22. 14
      ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
  23. 4
      ruoyi-admin/src/main/java/com/ruoyi/hl/config/VideoConfig.java
  24. 4
      ruoyi-admin/src/main/java/com/ruoyi/hl/config/WxConfig.java
  25. 88
      ruoyi-admin/src/main/java/com/ruoyi/hl/controller/WxController.java
  26. 18
      ruoyi-admin/src/main/java/com/ruoyi/hl/forest/clients/MiniWeChatClients.java
  27. 4
      ruoyi-admin/src/main/java/com/ruoyi/hl/forest/interceptor/UnlimitedInterceptor.java
  28. 2
      ruoyi-admin/src/main/java/com/ruoyi/hl/forest/interceptor/WriteLogInterceptor.java
  29. 2
      ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxAuthAccessTokenRes.java
  30. 2
      ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxGetUnlimitedRes.java
  31. 2
      ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxMiniCode2SessionRes.java
  32. 2
      ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxMiniTokenRes.java
  33. 2
      ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxPublicCode2UserInfoRes.java
  34. 2
      ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxPublickTokenRes.java
  35. 2
      ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxRes.java
  36. 2
      ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxSendTemplateRes.java
  37. 2
      ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxUserInfoRes.java
  38. 25
      ruoyi-admin/src/main/java/com/ruoyi/hl/service/WxService.java
  39. 17
      ruoyi-admin/src/main/java/com/ruoyi/hl/service/WxTokenService.java
  40. 8
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java
  41. 2
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/ilisteners/PutProcessData.java
  42. 26
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/mapper/FileDao.java
  43. 4
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/mapper/VideoDao.java
  44. 300
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/upload/BFileController.java
  45. 73
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/upload/BVideoAllowController.java
  46. 99
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/upload/BVideosController.java
  47. 12
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/upload/ShortLinkController.java
  48. 31
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/upload/VideosController.java
  49. 34
      ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java
  50. 86
      ruoyi-admin/src/main/java/com/ruoyi/web/serveice/UploadService.java
  51. 2
      ruoyi-admin/src/main/resources/application-druid.yml
  52. 56
      ruoyi-admin/src/main/resources/application.yml
  53. 12
      ruoyi-common/pom.xml
  54. 4
      ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java
  55. 2
      ruoyi-common/src/main/java/com/ruoyi/common/utils/BytesUtil.java
  56. 5
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
  57. 46
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/ilisteners/PutObjectProgressListener.java
  58. 6
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/ilisteners/PutProcessData.java
  59. 119
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AliOSSService.java
  60. 60
      ruoyi-system/src/main/java/com/ruoyi/system/domain/BFile.java
  61. 44
      ruoyi-system/src/main/java/com/ruoyi/system/domain/BVideoAllow.java
  62. 2
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/BFileMapper.java
  63. 2
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/BVideoAllowMapper.java
  64. 2
      ruoyi-system/src/main/java/com/ruoyi/system/service/IBFileService.java
  65. 2
      ruoyi-system/src/main/java/com/ruoyi/system/service/IBVideoAllowService.java
  66. 2
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BFileServiceImpl.java
  67. 2
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BVideoAllowServiceImpl.java
  68. 27
      ruoyi-system/src/main/resources/mapper/system/BFileMapper.xml
  69. 22
      ruoyi-system/src/main/resources/mapper/system/BVideoAllowMapper.xml
  70. 16
      ruoyi-ui/.env.production
  71. 20
      ruoyi-ui/.env.staging
  72. 180
      ruoyi-ui/package.json
  73. 417
      ruoyi-ui/public/index.html
  74. 18
      ruoyi-ui/src/api/system/file.js
  75. 8
      ruoyi-ui/src/api/system/videos.js
  76. 28
      ruoyi-ui/src/router/index.js
  77. 144
      ruoyi-ui/src/views/system/allow/index.vue
  78. 212
      ruoyi-ui/src/views/system/file/index.vue
  79. 58
      ruoyi-ui/src/views/system/manage/files.vue
  80. 368
      ruoyi-ui/src/views/system/manage/selectFiles.vue
  81. 1228
      ruoyi-ui/src/views/system/role/index.vue
  82. 123
      ruoyi-ui/src/views/system/videos/index.vue

15
hl-wechat/pom.xml

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
<version>3.8.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>hl-wechat</artifactId>
@ -16,4 +17,18 @@ @@ -16,4 +17,18 @@
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<!-- 通用工具-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
</dependency>
<dependency>
<groupId>com.dtflys.forest</groupId>
<artifactId>forest-spring-boot-starter</artifactId>
<version>1.5.16</version>
</dependency>
</dependencies>
</project>

2
hl-wechat/src/main/java/com/ruoyi/hl/config/VideoConfig.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package com.ruoyi.system.config;
package com.ruoyi.hl.config;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;

2
hl-wechat/src/main/java/com/ruoyi/hl/config/WxConfig.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package com.ruoyi.system.config;
package com.ruoyi.hl.config;
import lombok.Getter;

15
hl-wechat/src/main/java/com/ruoyi/hl/controller/WxController.java

@ -1,12 +1,9 @@ @@ -1,12 +1,9 @@
package com.ruoyi.system.controller;
import cn.hutool.core.util.StrUtil;
package com.ruoyi.hl.controller;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.config.WxConfig;
import com.ruoyi.system.forest.clients.MiniWeChatClients;
import com.ruoyi.system.forest.ptoto.WxPublicCode2UserInfoRes;
import com.ruoyi.system.service.WxService;
import com.ruoyi.hl.config.WxConfig;
import com.ruoyi.hl.forest.clients.MiniWeChatClients;
import com.ruoyi.hl.service.WxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@ -27,8 +24,8 @@ public class WxController { @@ -27,8 +24,8 @@ public class WxController {
@RequestMapping("/getAuth/{id}")
public AjaxResult open(@PathVariable String id){
return AjaxResult.success(String.format(wxConfig.getAuthUrl(),wxConfig.getPublicAppid(),wxConfig.getRedirectUrl(),id ));
public AjaxResult open(@PathVariable String id) {
return AjaxResult.success(String.format(wxConfig.getAuthUrl(), wxConfig.getPublicAppid(), wxConfig.getRedirectUrl(), id));
}
/*@RequestMapping("/code2videourl/{code}/{id}")

28
hl-wechat/src/main/java/com/ruoyi/hl/forest/clients/MiniWeChatClients.java

@ -1,13 +1,13 @@ @@ -1,13 +1,13 @@
package com.ruoyi.system.forest.clients;
package com.ruoyi.hl.forest.clients;
import com.dtflys.forest.annotation.*;
import com.ruoyi.system.forest.interceptor.UnlimitedInterceptor;
import com.ruoyi.system.forest.interceptor.WriteLogInterceptor;
import com.ruoyi.system.forest.ptoto.WxMiniCode2SessionRes;
import com.ruoyi.system.forest.ptoto.WxMiniTokenRes;
import com.ruoyi.system.forest.ptoto.WxPublicCode2UserInfoRes;
import com.ruoyi.system.forest.ptoto.WxUserInfoRes;
import com.ruoyi.hl.forest.ptoto.WxMiniCode2SessionRes;
import com.ruoyi.hl.forest.ptoto.WxMiniTokenRes;
import com.ruoyi.hl.forest.ptoto.WxPublicCode2UserInfoRes;
import com.ruoyi.hl.forest.ptoto.WxUserInfoRes;
import com.ruoyi.hl.forest.interceptor.UnlimitedInterceptor;
import com.ruoyi.hl.forest.interceptor.WriteLogInterceptor;
import java.util.Map;
@ -49,20 +49,6 @@ public interface MiniWeChatClients { @@ -49,20 +49,6 @@ public interface MiniWeChatClients {
)
WxMiniCode2SessionRes code2session(@Var("appid") String appid, @Var("secret") String secret, @Var("code") String code);
/**
* 获取公众号用户信息
* @param appid
* @param secret
* @param code
* @return
*/
@GetRequest(
url = "/sns/oauth2/access_token?appid=${appid}&secret=${secret}&code=${code}&grant_type=authorization_code",
interceptor = WriteLogInterceptor.class,dataType = "json"
)
WxPublicCode2UserInfoRes code2userinfo(@Var("appid") String appid, @Var("secret") String secret, @Var("code") String code);
/**
* 获取分享码
* @param token

4
hl-wechat/src/main/java/com/ruoyi/hl/forest/interceptor/UnlimitedInterceptor.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package com.ruoyi.system.forest.interceptor;
package com.ruoyi.hl.forest.interceptor;
import com.dtflys.forest.exceptions.ForestRuntimeException;
@ -8,7 +8,7 @@ import com.dtflys.forest.interceptor.Interceptor; @@ -8,7 +8,7 @@ import com.dtflys.forest.interceptor.Interceptor;
import com.ruoyi.common.utils.BytesUtil;
import com.ruoyi.system.config.WxConfig;
import com.ruoyi.hl.config.WxConfig;
import lombok.extern.slf4j.Slf4j;
@Slf4j

2
hl-wechat/src/main/java/com/ruoyi/hl/forest/interceptor/WriteLogInterceptor.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package com.ruoyi.system.forest.interceptor;
package com.ruoyi.hl.forest.interceptor;
import com.alibaba.fastjson.JSONObject;
import com.dtflys.forest.exceptions.ForestRuntimeException;

2
hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxAuthAccessTokenRes.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package com.ruoyi.system.forest.ptoto;
package com.ruoyi.hl.forest.ptoto;
import lombok.Data;

2
hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxGetUnlimitedRes.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package com.ruoyi.system.forest.ptoto;
package com.ruoyi.hl.forest.ptoto;
import lombok.Data;

2
hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxMiniCode2SessionRes.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package com.ruoyi.system.forest.ptoto;
package com.ruoyi.hl.forest.ptoto;
import lombok.AllArgsConstructor;
import lombok.Data;

2
hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxMiniTokenRes.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package com.ruoyi.system.forest.ptoto;
package com.ruoyi.hl.forest.ptoto;
import lombok.Data;

2
hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxPublicCode2UserInfoRes.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package com.ruoyi.system.forest.ptoto;
package com.ruoyi.hl.forest.ptoto;
import lombok.AllArgsConstructor;
import lombok.Data;

2
hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxPublickTokenRes.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package com.ruoyi.system.forest.ptoto;
package com.ruoyi.hl.forest.ptoto;
import lombok.Data;

2
hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxRes.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package com.ruoyi.system.forest.ptoto;
package com.ruoyi.hl.forest.ptoto;
import lombok.Data;

2
hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxSendTemplateRes.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package com.ruoyi.system.forest.ptoto;
package com.ruoyi.hl.forest.ptoto;
import lombok.Data;

2
hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxUserInfoRes.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package com.ruoyi.system.forest.ptoto;
package com.ruoyi.hl.forest.ptoto;
import lombok.Data;

2
hl-wechat/src/main/java/com/ruoyi/hl/service/WxService.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package com.ruoyi.system.service;
package com.ruoyi.hl.service;
import cn.hutool.core.util.StrUtil;

10
hl-wechat/src/main/java/com/ruoyi/hl/service/WxTokenService.java

@ -1,17 +1,15 @@ @@ -1,17 +1,15 @@
package com.ruoyi.system.service;
package com.ruoyi.hl.service;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.system.config.WxConfig;
import com.ruoyi.system.forest.clients.MiniWeChatClients;
import com.ruoyi.system.forest.ptoto.WxMiniTokenRes;
import com.ruoyi.hl.forest.ptoto.WxMiniTokenRes;
import com.ruoyi.hl.config.WxConfig;
import com.ruoyi.hl.forest.clients.MiniWeChatClients;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

99
hl-wechat/src/main/resources/application.yml

@ -1,5 +1,4 @@ @@ -1,5 +1,4 @@
#微信配置
wx:
public:
redirect_uri: http://asdf.com
@ -23,101 +22,3 @@ forest: @@ -23,101 +22,3 @@ forest:
# 开发环境配置
server:
# 服务器的HTTP端口,默认为8081
port: 8081
servlet:
# 应用的访问路径
context-path: /
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# 连接数满后的排队数,默认为100
accept-count: 1000
threads:
# tomcat最大线程数,默认为200
max: 800
# Tomcat启动初始化的线程数,默认值10
min-spare: 100
# 日志配置
logging:
level:
com.ruoyi: debug
org.springframework: warn
# Spring配置
spring:
# 资源信息
messages:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: druid
# 文件上传
servlet:
multipart:
# 单个文件大小
max-file-size: 10MB
# 设置总上传的文件大小
max-request-size: 20MB
# 服务模块
devtools:
restart:
# 热部署开关
enabled: true
# redis 配置
redis:
# 地址
host: 192.168.1.182
# 端口,默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
password:
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# MyBatis配置
mybatis:
# 搜索指定包别名
typeAliasesPackage: com.ruoyi.**.domain
# 配置mapper的扫描,找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
# PageHelper分页插件
pagehelper:
helperDialect: mysql
supportMethodsArguments: true
params: count=countSql
# Swagger配置
swagger:
# 是否开启swagger
enabled: true
# 请求前缀
pathMapping: /wechat
# 防止XSS攻击
xss:
# 过滤开关
enabled: true
# 排除链接(多个用逗号分隔)
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*

19
pom.xml

@ -39,6 +39,17 @@ @@ -39,6 +39,17 @@
<dependencyManagement>
<dependencies>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
<version>5.6.0</version>
</dependency>
<dependency>
<groupId>com.dtflys.forest</groupId>
<artifactId>forest-spring-boot-starter</artifactId>
<version>1.5.16</version>
</dependency>
<!-- SpringBoot的依赖配置-->
<dependency>
<groupId>org.springframework.boot</groupId>
@ -199,6 +210,7 @@ @@ -199,6 +210,7 @@
<version>${ruoyi.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
@ -214,7 +226,12 @@ @@ -214,7 +226,12 @@
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>

6
ruoyi-admin/pom.xml

@ -61,6 +61,12 @@ @@ -61,6 +61,12 @@
<artifactId>ruoyi-generator</artifactId>
</dependency>
<dependency>
<groupId>com.dtflys.forest</groupId>
<artifactId>forest-spring-boot-starter</artifactId>
<version>1.5.16</version>
</dependency>
</dependencies>
<build>

14
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java

@ -3,17 +3,19 @@ package com.ruoyi; @@ -3,17 +3,19 @@ package com.ruoyi;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* 启动程序
*
*
* @author ruoyi
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class RuoYiApplication
{
public static void main(String[] args)
{
@EnableScheduling
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class RuoYiApplication {
public static void main(String[] args) {
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +

4
ruoyi-admin/src/main/java/com/ruoyi/hl/config/VideoConfig.java

@ -1,9 +1,11 @@ @@ -1,9 +1,11 @@
package hl.config;
package com.ruoyi.hl.config;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Data
@Component
public class VideoConfig {
@Value("video.baseUrl")
private String baseUrl;

4
ruoyi-admin/src/main/java/com/ruoyi/hl/config/WxConfig.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package hl.config;
package com.ruoyi.hl.config;
import lombok.Getter;
@ -26,7 +26,7 @@ public class WxConfig { @@ -26,7 +26,7 @@ public class WxConfig {
private String redirectUrl;
@Getter
private String authUrl="https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_base&state=%s#wechat_redirect";
private String authUrl="https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_userinfo&state=%s#wechat_redirect";

88
ruoyi-admin/src/main/java/com/ruoyi/hl/controller/WxController.java

@ -1,14 +1,31 @@ @@ -1,14 +1,31 @@
package hl.controller;
package com.ruoyi.hl.controller;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.core.domain.AjaxResult;
import hl.config.WxConfig;
import hl.forest.clients.MiniWeChatClients;
import hl.service.WxService;
import com.ruoyi.framework.web.service.AliOSSService;
import com.ruoyi.hl.config.WxConfig;
import com.ruoyi.hl.forest.clients.MiniWeChatClients;
import com.ruoyi.hl.forest.ptoto.WxPublicCode2UserInfoRes;
import com.ruoyi.hl.forest.ptoto.WxUserInfoRes;
import com.ruoyi.hl.service.WxService;
import com.ruoyi.hl.service.WxTokenService;
import com.ruoyi.system.domain.BFile;
import com.ruoyi.system.domain.BVideoAllow;
import com.ruoyi.system.domain.BVideos;
import com.ruoyi.system.service.IBFileService;
import com.ruoyi.system.service.IBVideoAllowService;
import com.ruoyi.system.service.IBVideosService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Slf4j
@RestController
@RequestMapping("/wx")
public class WxController {
@ -22,20 +39,71 @@ public class WxController { @@ -22,20 +39,71 @@ public class WxController {
@Autowired
private WxConfig wxConfig;
@Autowired
private IBVideoAllowService bVideoAllowService;
@Autowired
private IBVideosService videosService;
@Autowired
private IBFileService fileService;
@Autowired
private WxTokenService wxTokenService;
@Autowired
private AliOSSService ossService;
@RequestMapping("/getAuth/{id}")
public AjaxResult open(@PathVariable String id) {
return AjaxResult.success(String.format(wxConfig.getAuthUrl(), wxConfig.getPublicAppid(), wxConfig.getRedirectUrl(), id));
String auth=String.format(wxConfig.getAuthUrl(), wxConfig.getPublicAppid(), wxConfig.getRedirectUrl(), id);
log.debug("authUrl:{}",auth);
return AjaxResult.success("ok",auth);
}
/*@RequestMapping("/code2videourl/{code}/{id}")
@RequestMapping("/code2videourl/{code}/{id}")
public AjaxResult code2videourl(@PathVariable String id,@PathVariable String code){
String openid="a";
String openid="45";
WxPublicCode2UserInfoRes wxPublicCode2UserInfoRes=weChatClients.code2userinfo(wxConfig.getPublicAppid(),wxConfig.getPublicSecret(),code);
if (wxPublicCode2UserInfoRes.getErrcode()!=0){
if (wxPublicCode2UserInfoRes==null){
log.info("wxPublicCode2UserInfoRes is null");
}
if (StrUtil.isBlankIfStr(wxPublicCode2UserInfoRes.getOpenid())){
return AjaxResult.error("获取openid错误");
}
openid=wxPublicCode2UserInfoRes.getOpenid();
return wxService.getOwnVideo(id,openid);
}*/
log.info("openId:{}, accessToken:{}",openid,wxPublicCode2UserInfoRes.getAccessToken());
WxUserInfoRes wxUserInfoRes=weChatClients.userInfo(wxPublicCode2UserInfoRes.getAccessToken(),openid);
String nickname=wxUserInfoRes.getNickname();
return wxService.getOwnVideo(id,openid,nickname);
//return AjaxResult.success("ok",id+"----"+openid);
}
@RequestMapping("/list/{openIds}")
public AjaxResult list(@PathVariable String openIds){
String[] ids=openIds.split("----");
String allowId=ids[0];
String openId=ids[1];
BVideoAllow bVideoAllow=new BVideoAllow();
bVideoAllow.setAllowId(allowId);
bVideoAllow.setWxOpenid(openId);
List<BVideoAllow> allowList= bVideoAllowService.selectBVideoAllowList(bVideoAllow);
if (allowList!=null&&allowList.size()>0){
BVideoAllow allow=allowList.get(0);
BVideos bVideos=new BVideos();
bVideos.setParentId(allow.getVideoId());
List<BVideos> videosList=videosService.selectBVideosList(bVideos);
videosList.forEach(v->{
BFile file=fileService.selectBFileById(v.getFileId());
v.setPath(ossService.getDomain() + "/" + file.getUuid());
});
return AjaxResult.success(videosList);
}else {
return AjaxResult.success(new ArrayList<>());
}
}
}

18
ruoyi-admin/src/main/java/com/ruoyi/hl/forest/clients/MiniWeChatClients.java

@ -1,13 +1,13 @@ @@ -1,13 +1,13 @@
package hl.forest.clients;
package com.ruoyi.hl.forest.clients;
import com.dtflys.forest.annotation.*;
import hl.forest.interceptor.UnlimitedInterceptor;
import hl.forest.interceptor.WriteLogInterceptor;
import hl.forest.ptoto.WxMiniCode2SessionRes;
import hl.forest.ptoto.WxMiniTokenRes;
import hl.forest.ptoto.WxPublicCode2UserInfoRes;
import hl.forest.ptoto.WxUserInfoRes;
import com.ruoyi.hl.forest.interceptor.UnlimitedInterceptor;
import com.ruoyi.hl.forest.interceptor.WriteLogInterceptor;
import com.ruoyi.hl.forest.ptoto.WxMiniCode2SessionRes;
import com.ruoyi.hl.forest.ptoto.WxMiniTokenRes;
import com.ruoyi.hl.forest.ptoto.WxPublicCode2UserInfoRes;
import com.ruoyi.hl.forest.ptoto.WxUserInfoRes;
import java.util.Map;
@ -30,7 +30,7 @@ public interface MiniWeChatClients { @@ -30,7 +30,7 @@ public interface MiniWeChatClients {
*
* @return
*/
@GetRequest(url = "/cgi-bin/user/info?access_token=${token}&openid=${openid}&lang=zh_CN",
@GetRequest(url = "/sns/userinfo?access_token=${token}&openid=${openid}&lang=zh_CN",
dataType ="json",interceptor = WriteLogInterceptor.class
)
WxUserInfoRes userInfo(@Var("token") String token, @Var("openid") String openid);
@ -50,7 +50,7 @@ public interface MiniWeChatClients { @@ -50,7 +50,7 @@ public interface MiniWeChatClients {
WxMiniCode2SessionRes code2session(@Var("appid") String appid, @Var("secret") String secret, @Var("code") String code);
/**
* 获取公众号用户信息
* 获取信息
* @param appid
* @param secret
* @param code

4
ruoyi-admin/src/main/java/com/ruoyi/hl/forest/interceptor/UnlimitedInterceptor.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package hl.forest.interceptor;
package com.ruoyi.hl.forest.interceptor;
import com.dtflys.forest.exceptions.ForestRuntimeException;
@ -7,7 +7,7 @@ import com.dtflys.forest.http.ForestResponse; @@ -7,7 +7,7 @@ import com.dtflys.forest.http.ForestResponse;
import com.dtflys.forest.interceptor.Interceptor;
import com.ruoyi.common.utils.BytesUtil;
import hl.config.WxConfig;
import com.ruoyi.hl.config.WxConfig;
import lombok.extern.slf4j.Slf4j;
@Slf4j

2
ruoyi-admin/src/main/java/com/ruoyi/hl/forest/interceptor/WriteLogInterceptor.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package hl.forest.interceptor;
package com.ruoyi.hl.forest.interceptor;
import com.alibaba.fastjson.JSONObject;
import com.dtflys.forest.exceptions.ForestRuntimeException;

2
ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxAuthAccessTokenRes.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package hl.forest.ptoto;
package com.ruoyi.hl.forest.ptoto;
import lombok.Data;

2
ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxGetUnlimitedRes.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package hl.forest.ptoto;
package com.ruoyi.hl.forest.ptoto;
import lombok.Data;

2
ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxMiniCode2SessionRes.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package hl.forest.ptoto;
package com.ruoyi.hl.forest.ptoto;
import lombok.AllArgsConstructor;
import lombok.Data;

2
ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxMiniTokenRes.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package hl.forest.ptoto;
package com.ruoyi.hl.forest.ptoto;
import lombok.Data;

2
ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxPublicCode2UserInfoRes.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package hl.forest.ptoto;
package com.ruoyi.hl.forest.ptoto;
import lombok.AllArgsConstructor;
import lombok.Data;

2
ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxPublickTokenRes.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package hl.forest.ptoto;
package com.ruoyi.hl.forest.ptoto;
import lombok.Data;

2
ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxRes.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package hl.forest.ptoto;
package com.ruoyi.hl.forest.ptoto;
import lombok.Data;

2
ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxSendTemplateRes.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package hl.forest.ptoto;
package com.ruoyi.hl.forest.ptoto;
import lombok.Data;

2
ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxUserInfoRes.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package hl.forest.ptoto;
package com.ruoyi.hl.forest.ptoto;
import lombok.Data;

25
ruoyi-admin/src/main/java/com/ruoyi/hl/service/WxService.java

@ -1,12 +1,22 @@ @@ -1,12 +1,22 @@
package hl.service;
package com.ruoyi.hl.service;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.hl.config.VideoConfig;
import com.ruoyi.system.domain.BVideoAllow;
import com.ruoyi.system.domain.BVideos;
import com.ruoyi.system.service.IBVideoAllowService;
import com.ruoyi.system.service.IBVideosService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class WxService {
/*@Autowired
private IBVideoAllowService ibVideoAllowService;
@Autowired
private IBVideoAllowService ibVideoAllowService;
@Autowired
private IBVideosService videosService;
@ -15,7 +25,7 @@ public class WxService { @@ -15,7 +25,7 @@ public class WxService {
private VideoConfig videoConfig;
public synchronized AjaxResult getOwnVideo(String id, String openid){
public synchronized AjaxResult getOwnVideo(String id, String openid,String nickname){
BVideoAllow bVideoAllow =new BVideoAllow();
bVideoAllow.setAllowId(id);
@ -28,6 +38,7 @@ public class WxService { @@ -28,6 +38,7 @@ public class WxService {
String loadOpenid=allow.getWxOpenid();
if (StrUtil.isBlankIfStr(loadOpenid)){
allow.setWxOpenid(openid);
allow.setWxNickname(nickname);
ibVideoAllowService.updateBVideoAllow(allow);
}else if (!loadOpenid.equals(openid)){
@ -38,6 +49,6 @@ public class WxService { @@ -38,6 +49,6 @@ public class WxService {
return AjaxResult.error(404,"未找到视频");
}
return AjaxResult.success(id+"----"+openid);
}*/
return AjaxResult.success("ok",id+"----"+openid);
}
}

17
ruoyi-admin/src/main/java/com/ruoyi/hl/service/WxTokenService.java

@ -1,15 +1,16 @@ @@ -1,15 +1,16 @@
package hl.service;
package com.ruoyi.hl.service;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.core.redis.RedisCache;
import hl.config.WxConfig;
import hl.forest.clients.MiniWeChatClients;
import hl.forest.ptoto.WxMiniTokenRes;
import com.ruoyi.hl.config.WxConfig;
import com.ruoyi.hl.forest.clients.MiniWeChatClients;
import com.ruoyi.hl.forest.ptoto.WxMiniTokenRes;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import java.util.concurrent.TimeUnit;
@ -26,7 +27,7 @@ public class WxTokenService implements CommandLineRunner { @@ -26,7 +27,7 @@ public class WxTokenService implements CommandLineRunner {
private MiniWeChatClients miniWeChatClients;
//@Autowired
@Autowired
private RedisCache redisCache;
@Autowired
@ -34,7 +35,7 @@ public class WxTokenService implements CommandLineRunner { @@ -34,7 +35,7 @@ public class WxTokenService implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
//refreshToken();//刷新token
refreshToken();//刷新token
}
@ -51,11 +52,11 @@ public class WxTokenService implements CommandLineRunner { @@ -51,11 +52,11 @@ public class WxTokenService implements CommandLineRunner {
/**
* 每分钟检测redis里的token是否到期
*/
//@Scheduled(cron = "0 * * * * ?")
@Scheduled(cron = "0 * * * * ?")
public void refreshToken() {
String pToken = redisCache.getCacheObject(pTokenK);
if (pToken == null || pToken.equals("token")) {
refreshPublicToken();
//refreshPublicToken();
}
}

8
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java

@ -6,7 +6,10 @@ import java.util.concurrent.TimeUnit; @@ -6,7 +6,10 @@ import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.web.controller.mapper.VideoDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.web.bind.annotation.GetMapping;
@ -38,6 +41,11 @@ public class CaptchaController @@ -38,6 +41,11 @@ public class CaptchaController
@Autowired
private ISysConfigService configService;
@Autowired
private VideoDao videoDao;
/**
* 生成验证码
*/

2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/ilisteners/PutProcessData.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package com.ruoyi.web.controller.listener;
package com.ruoyi.web.controller.ilisteners;
import lombok.Data;

26
ruoyi-admin/src/main/java/com/ruoyi/web/controller/mapper/FileDao.java

@ -1,2 +1,26 @@ @@ -1,2 +1,26 @@
package com.ruoyi.web.controller.mapper;public class FileDao {
package com.ruoyi.web.controller.mapper;
import com.ruoyi.system.domain.BFile;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
import java.util.List;
@Mapper
public interface FileDao {
@Select("<script>" +
"select * from b_file " +
"" + " <where> done =1 and id \n" +
"NOT IN" +
"<foreach item='t' collection='list' open='(' separator=',' close=')'>" +
"#{t}" +
"</foreach>" +
"</where>" +
"</script>")
@Results({
@Result(column="video_name", property="videoName", jdbcType= JdbcType.VARCHAR),
})
public List<BFile> findByNoIds(@Param("list") List<Long> ids);
}

4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/mapper/VideoDao.java

@ -6,7 +6,7 @@ import org.apache.ibatis.annotations.Select; @@ -6,7 +6,7 @@ import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface Dao {
@Select("select file_id from b_video where parent_id= #{id}")
public interface VideoDao {
@Select("select file_id from b_videos where parent_id= #{id}")
List<Long> findByParentId(long id);
}

300
ruoyi-admin/src/main/java/com/ruoyi/web/controller/upload/BFileController.java

@ -1,17 +1,31 @@ @@ -1,17 +1,31 @@
package com.ruoyi.system.controller;
package com.ruoyi.web.controller.upload;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.oss.OSS;
import com.github.pagehelper.PageHelper;
import com.ruoyi.framework.web.ilisteners.PutProcessData;
import com.ruoyi.framework.web.service.AliOSSService;
import com.ruoyi.system.domain.BVideos;
import com.ruoyi.system.service.IBVideosService;
import com.ruoyi.web.controller.mapper.FileDao;
import com.ruoyi.web.controller.mapper.VideoDao;
import com.ruoyi.web.serveice.UploadService;
import org.springframework.security.access.prepost.PreAuthorize;
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.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -20,64 +34,227 @@ import com.ruoyi.system.domain.BFile; @@ -20,64 +34,227 @@ import com.ruoyi.system.domain.BFile;
import com.ruoyi.system.service.IBFileService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* 请填写功能名称Controller
*
*
* @author ruoyi
* @date 2022-03-09
*/
@RestController
@RequestMapping("/system/file")
public class BFileController extends BaseController
{
@RequestMapping("/videos/file")
public class BFileController extends BaseController {
@Autowired
private IBFileService bFileService;
@Autowired
private IBVideosService videosService;
@Autowired
private AliOSSService ossService;
@Autowired
private VideoDao videoDao;
@Autowired
private FileDao fileDao;
@Autowired
private UploadService uploadService;
/**
* 查询请填写功能名称列表
*/
@PreAuthorize("@ss.hasPermi('system:file:list')")
@GetMapping("/list")
public TableDataInfo list(BFile bFile)
{
public TableDataInfo list(BFile bFile) {
startPage();
PageHelper.orderBy("id desc");
List<BFile> list = bFileService.selectBFileList(bFile);
return getDataTable(list);
}
/**
* 导出请填写功能名称列表
*/
@PreAuthorize("@ss.hasPermi('system:file:export')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BFile bFile)
{
List<BFile> list = bFileService.selectBFileList(bFile);
ExcelUtil<BFile> util = new ExcelUtil<BFile>(BFile.class);
util.exportExcel(response, list, "【请填写功能名称】数据");
}
/**
* 获取请填写功能名称详细信息
*/
@PreAuthorize("@ss.hasPermi('system:file:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(bFileService.selectBFileById(id));
}
/*
*/
/**
* 新增请填写功能名称
*//*
@PreAuthorize("@ss.hasPermi('system:file:add')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
@PostMapping("/addFile")
public AjaxResult addFile(@RequestParam("file") MultipartFile multipartFile, @RequestParam("remark") String remark, @RequestParam("videoName") String videoName) {
BFile bFile = new BFile();
OSS client = ossService.newOss();
Date now = new Date();
String filename = now.getTime() + "." + FileUtil.getSuffix(multipartFile.getOriginalFilename());
String suffix = "/" + filename;
String path = ossService.getPath(ossService.getPrefix(), suffix);
try {
//System.out.println(ossService.getDomain() + "/" + path);
bFile.setGmtCreate(now);
bFile.setVideoName(videoName);
bFile.setPercent("0%");
bFile.setMemo(remark);
bFile.setUuid(path);
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error(e.getMessage());
}
if (bFileService.insertBFile(bFile) > 0) {
File f = null;
try {
f = File.createTempFile("tmp", null);
multipartFile.transferTo(f);
PutProcessData processData = new PutProcessData();
processData.setId(filename);
File finalF = f;
executorService2.execute(new Runnable() {
@Override
public void run() {
ossService.uploadSuffix(client, processData, filename, finalF, suffix);
}
});
executorService.execute(new Runnable() {
@Override
public void run() {
BFile bFile = new BFile();
bFile.setUuid(path);
List<BFile> bFileList = bFileService.selectBFileList(bFile);
BFile findFile = bFileList != null && bFileList.size() > 0 ? bFileList.get(0) : null;
if (findFile == null) {
logger.info("findFile is null");
return;
}
try {
logger.info("upload start");
//ossService.uploadSuffix(client, multipartFile.getBytes(), suffix);
while (true) {
logger.info("v1 upload path:{}, success:{}, fail:{}", path, processData.isSuccess(), processData.isFail());
if (processData.isSuccess() || processData.isFail()) {
if (processData.isSuccess()) {
findFile.setPercent("100%");
findFile.setDone(1L);
} else if (processData.isFail()) {
findFile.setPercent("-1%");
findFile.setDone(2L);
}
bFileService.updateBFile(findFile);
break;
} else {
findFile.setPercent(processData.getProcess() + "%");
bFileService.updateBFile(findFile);
}
Thread.sleep(1000);
}
} catch (Exception e) {
e.printStackTrace();
}
logger.info("upload success, url:{}", path);
}
});
} catch (Exception e) {
e.printStackTrace();
} finally {
if (f != null) {
f.delete();
}
}
return toAjax(1);
} else {
return toAjax(0);
}
}
*/
/**
* 新增请填写功能名称
*/
@PreAuthorize("@ss.hasPermi('system:file:add')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BFile bFile)
{
return toAjax(bFileService.insertBFile(bFile));
@PostMapping("/addFile")
public AjaxResult addFile(@RequestParam("file") MultipartFile multipartFile, @RequestParam("remark") String remark, @RequestParam("videoName") String videoName) {
BFile bFile = new BFile();
Date now = new Date();
String filename = now.getTime() + "." + FileUtil.getSuffix(multipartFile.getOriginalFilename());
String suffix = "/" + filename;
String path = ossService.getPath(ossService.getPrefix(), suffix);
try {
//System.out.println(ossService.getDomain() + "/" + path);
bFile.setGmtCreate(now);
bFile.setVideoName(videoName);
bFile.setPercent("0%");
bFile.setMemo(remark);
bFile.setUuid(path);
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error(e.getMessage());
}
if (bFileService.insertBFile(bFile) > 0) {
File f = new File("/root/jars/tmp/"+filename);
BFile findFile=null;
try {
if (!f.createNewFile()){
logger.info("create file fail");
return AjaxResult.error("创建文件失败");
}
multipartFile.transferTo(f);
BFile param = new BFile();
param.setUuid(path);
List<BFile> bFileList = bFileService.selectBFileList(param);
findFile = bFileList != null && bFileList.size() > 0 ? bFileList.get(0) : null;
if (findFile == null) {
logger.info("findFile is null");
return AjaxResult.error("保存文件失败");
}
uploadService.uploadFile(findFile,filename,f,suffix);
} catch (IOException e) {
e.printStackTrace();
}
return toAjax(1);
} else {
return toAjax(0);
}
}
/**
@ -86,8 +263,7 @@ public class BFileController extends BaseController @@ -86,8 +263,7 @@ public class BFileController extends BaseController
@PreAuthorize("@ss.hasPermi('system:file:edit')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BFile bFile)
{
public AjaxResult edit(@RequestBody BFile bFile) {
return toAjax(bFileService.updateBFile(bFile));
}
@ -96,9 +272,55 @@ public class BFileController extends BaseController @@ -96,9 +272,55 @@ public class BFileController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('system:file:remove')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(bFileService.deleteBFileByIds(ids));
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
int updRow = 0;
OSS client = ossService.newOss();
for (Long id : ids) {
BFile bFile = bFileService.selectBFileById(id);
if (bFile != null) {
try {
ossService.remove(client, ossService.getBucketName(), bFile.getUuid());
updRow += bFileService.deleteBFileById(id);
BVideos bVideos = new BVideos();
bVideos.setFileId(bFile.getId());
List<BVideos> a = videosService.selectBVideosList(bVideos);
if (a != null && a.size() > 0) {
a.forEach(v -> {
videosService.deleteBVideosById(v.getId());
});
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
return toAjax(updRow);
}
@PreAuthorize("@ss.hasPermi('system:file:query')")
@Log(title = "【请填写功能名称】")
@GetMapping("/getNoAuthFiles")
public AjaxResult getNoAuthFiles(@RequestParam("videoId") Long id, @RequestParam("memo") String memo) {
List<Long> ids = videoDao.findByParentId(id);
if (ids.size() == 0) {
ids.add(-1L);
}
List<BFile> files = fileDao.findByNoIds(ids);
if (StrUtil.isNotBlank(memo)){
files=files.stream().filter(v->{
return v.getMemo().contains(memo);
}).collect(Collectors.toList());
}
return AjaxResult.success(files);
}
}

73
ruoyi-admin/src/main/java/com/ruoyi/web/controller/upload/BVideoAllowController.java

@ -1,7 +1,13 @@ @@ -1,7 +1,13 @@
package com.ruoyi.system.controller;
package com.ruoyi.web.controller.upload;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.RandomUtil;
import com.ruoyi.common.core.redis.RedisCache;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -23,49 +29,62 @@ import com.ruoyi.common.core.page.TableDataInfo; @@ -23,49 +29,62 @@ import com.ruoyi.common.core.page.TableDataInfo;
/**
* 允许列Controller
*
*
* @author ruoyi
* @date 2022-03-10
*/
@RestController
@RequestMapping("/system/allow")
public class BVideoAllowController extends BaseController
{
public class BVideoAllowController extends BaseController {
public static String short_link_key = "short_link_";
public static String short_link_code_key = "short_link_code_";
public static final String ranString=RandomUtil.BASE_CHAR.toUpperCase()+RandomUtil.BASE_CHAR_NUMBER;
@Autowired
private IBVideoAllowService bVideoAllowService;
@Value("${hl.share_domain}")
private String share_domain;
@Value("${hl.share_short_domain}")
private String share_short_domain;
@Autowired
private RedisCache redisCache;
/**
* 查询允许列列表
*/
@PreAuthorize("@ss.hasPermi('system:allow:list')")
@GetMapping("/list")
public TableDataInfo list(BVideoAllow bVideoAllow)
{
public TableDataInfo list(BVideoAllow bVideoAllow) {
startPage();
List<BVideoAllow> list = bVideoAllowService.selectBVideoAllowList(bVideoAllow);
list.forEach(v -> {
String short_link = redisCache.getCacheObject(short_link_key + v.getId());
if (short_link == null) {
String code = RandomUtil.randomString(ranString,7);
redisCache.setCacheObject(short_link_key + v.getId(), share_short_domain + code);
redisCache.setCacheObject(short_link_code_key + code, share_domain + "?isFirst=true&allowId=" + v.getAllowId());
}
v.setLink(short_link);
});
return getDataTable(list);
}
/**
* 导出允许列列表
*/
@PreAuthorize("@ss.hasPermi('system:allow:export')")
@Log(title = "允许列", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BVideoAllow bVideoAllow)
{
List<BVideoAllow> list = bVideoAllowService.selectBVideoAllowList(bVideoAllow);
ExcelUtil<BVideoAllow> util = new ExcelUtil<BVideoAllow>(BVideoAllow.class);
util.exportExcel(response, list, "允许列数据");
}
/**
* 获取允许列详细信息
*/
@PreAuthorize("@ss.hasPermi('system:allow:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(bVideoAllowService.selectBVideoAllowById(id));
}
@ -75,8 +94,10 @@ public class BVideoAllowController extends BaseController @@ -75,8 +94,10 @@ public class BVideoAllowController extends BaseController
@PreAuthorize("@ss.hasPermi('system:allow:add')")
@Log(title = "允许列", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BVideoAllow bVideoAllow)
{
public AjaxResult add(@RequestBody BVideoAllow bVideoAllow) {
Date now = new Date();
bVideoAllow.setGmtCreate(now);
bVideoAllow.setAllowId(UUID.randomUUID().toString());
return toAjax(bVideoAllowService.insertBVideoAllow(bVideoAllow));
}
@ -86,8 +107,7 @@ public class BVideoAllowController extends BaseController @@ -86,8 +107,7 @@ public class BVideoAllowController extends BaseController
@PreAuthorize("@ss.hasPermi('system:allow:edit')")
@Log(title = "允许列", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BVideoAllow bVideoAllow)
{
public AjaxResult edit(@RequestBody BVideoAllow bVideoAllow) {
return toAjax(bVideoAllowService.updateBVideoAllow(bVideoAllow));
}
@ -96,9 +116,8 @@ public class BVideoAllowController extends BaseController @@ -96,9 +116,8 @@ public class BVideoAllowController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('system:allow:remove')")
@Log(title = "允许列", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(bVideoAllowService.deleteBVideoAllowByIds(ids));
}
}

99
ruoyi-admin/src/main/java/com/ruoyi/web/controller/upload/BVideosController.java

@ -1,17 +1,19 @@ @@ -1,17 +1,19 @@
package com.ruoyi.system.controller;
package com.ruoyi.web.controller.upload;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import javax.xml.crypto.Data;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.system.domain.BFile;
import com.ruoyi.system.service.IBFileService;
import com.sun.imageio.plugins.common.BitFile;
import org.springframework.security.access.prepost.PreAuthorize;
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.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -23,27 +25,77 @@ import com.ruoyi.common.core.page.TableDataInfo; @@ -23,27 +25,77 @@ import com.ruoyi.common.core.page.TableDataInfo;
/**
* 视频信息Controller
*
*
* @author ruoyi
* @date 2022-03-09
*/
@RestController
@RequestMapping("/system/videos")
public class BVideosController extends BaseController
{
public class BVideosController extends BaseController {
@Autowired
private IBVideosService bVideosService;
@Autowired
private IBFileService ibFileService;
@PreAuthorize("@ss.hasPermi('system:videos:manageFiles')")
@Log(title = "【请填写功能名称】")
@PostMapping("/insertVideos")
public AjaxResult insert(@RequestBody JSONObject jsonObject) {
Date now = new Date();
JSONArray fileIds = jsonObject.getJSONArray("ids");
for (int i = 0; i < fileIds.size(); i++) {
Long fileId = ((Integer) fileIds.get(i)).longValue();
BFile bFile = ibFileService.selectBFileById(fileId);
BVideos bVideos = new BVideos();
bVideos.setGmtCreate(now);
bVideos.setGmtModified(now);
bVideos.setFileId(fileId);
bVideos.setName(bFile.getVideoName());
bVideos.setParentId(jsonObject.getLong("videoId"));
bVideos.setFileId(fileId);
bVideos.setType(2L);
bVideosService.insertBVideos(bVideos);
}
return AjaxResult.success();
}
/**
* 查询视频信息列表
*/
@PreAuthorize("@ss.hasPermi('system:videos:list')")
@GetMapping("/list")
public TableDataInfo list(BVideos bVideos)
{
public TableDataInfo list(BVideos bVideos) {
startPage();
List<BVideos> list = bVideosService.selectBVideosList(bVideos);
return getDataTable(list);
JSONArray res = new JSONArray();
for (int i = 0; i < list.size(); i++) {
BVideos videos = list.get(i);
BVideos queryParam = new BVideos();
queryParam.setParentId(videos.getId());
List<BVideos> videoChildren = bVideosService.selectBVideosList(queryParam);
List<String> filenames = new ArrayList<>();
videoChildren.forEach(v -> {
BFile file = ibFileService.selectBFileById(v.getFileId());
if (file != null&&filenames.size()<10)
filenames.add(file.getVideoName());
});
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(videos);
jsonObject.put("filenames", String.join(",", filenames));
res.add(jsonObject);
}
TableDataInfo rspData=getDataTable(list);
rspData.setRows(res);
return rspData;
}
/**
@ -52,8 +104,7 @@ public class BVideosController extends BaseController @@ -52,8 +104,7 @@ public class BVideosController extends BaseController
@PreAuthorize("@ss.hasPermi('system:videos:export')")
@Log(title = "视频信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BVideos bVideos)
{
public void export(HttpServletResponse response, BVideos bVideos) {
List<BVideos> list = bVideosService.selectBVideosList(bVideos);
ExcelUtil<BVideos> util = new ExcelUtil<BVideos>(BVideos.class);
util.exportExcel(response, list, "视频信息数据");
@ -64,8 +115,7 @@ public class BVideosController extends BaseController @@ -64,8 +115,7 @@ public class BVideosController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('system:videos:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(bVideosService.selectBVideosById(id));
}
@ -75,8 +125,7 @@ public class BVideosController extends BaseController @@ -75,8 +125,7 @@ public class BVideosController extends BaseController
@PreAuthorize("@ss.hasPermi('system:videos:add')")
@Log(title = "视频信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BVideos bVideos)
{
public AjaxResult add(@RequestBody BVideos bVideos) {
return toAjax(bVideosService.insertBVideos(bVideos));
}
@ -86,8 +135,7 @@ public class BVideosController extends BaseController @@ -86,8 +135,7 @@ public class BVideosController extends BaseController
@PreAuthorize("@ss.hasPermi('system:videos:edit')")
@Log(title = "视频信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BVideos bVideos)
{
public AjaxResult edit(@RequestBody BVideos bVideos) {
return toAjax(bVideosService.updateBVideos(bVideos));
}
@ -96,9 +144,8 @@ public class BVideosController extends BaseController @@ -96,9 +144,8 @@ public class BVideosController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('system:videos:remove')")
@Log(title = "视频信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(bVideosService.deleteBVideosByIds(ids));
}
}

12
ruoyi-admin/src/main/java/com/ruoyi/web/controller/upload/ShortLinkController.java

@ -1,26 +1,20 @@ @@ -1,26 +1,20 @@
package com.ruoyi.web.controller.upload;
import cn.hutool.core.util.RandomUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.system.domain.BVideoAllow;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;
import static com.ruoyi.framework.datasource.DynamicDataSourceContextHolder.log;
@Slf4j
@Controller
@RequestMapping("/s")
public class ShortController {
public class ShortLinkController {
@Autowired
private RedisCache redisCache;
@ -33,9 +27,7 @@ public class ShortController { @@ -33,9 +27,7 @@ public class ShortController {
@GetMapping("/{code}")
public ModelAndView list(@PathVariable("code") String code)
{
String completeUrl=redisCache.getCacheObject(BVideoAllowController.short_link_code_key+code);
log.info("jump to completeUrl:{}",completeUrl);
ModelAndView downloadView = new ModelAndView(new RedirectView(completeUrl));

31
ruoyi-admin/src/main/java/com/ruoyi/web/controller/upload/VideosController.java

@ -1,2 +1,31 @@ @@ -1,2 +1,31 @@
package com.ruoyi.web.controller.upload;public class UploadFileController {
package com.ruoyi.web.controller.upload;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.SysConfig;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import static com.ruoyi.common.utils.PageUtils.startPage;
@RestController
@RequestMapping("/videos")
public class VideosController {
/**
* 获取参数配置列表
*/
/*@PreAuthorize("@ss.hasPermi('videos:list')")
@GetMapping("/list")
public TableDataInfo list(SysConfig config)
{
startPage();
List<SysConfig> list = configService.selectConfigList(config);
return getDataTable(list);
}*/
}

34
ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java

@ -2,6 +2,7 @@ package com.ruoyi.web.core.config; @@ -2,6 +2,7 @@ package com.ruoyi.web.core.config;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
@ -24,21 +25,27 @@ import springfox.documentation.spring.web.plugins.Docket; @@ -24,21 +25,27 @@ import springfox.documentation.spring.web.plugins.Docket;
/**
* Swagger2的接口配置
*
*
* @author ruoyi
*/
@Configuration
public class SwaggerConfig
{
/** 系统基础配置 */
public class SwaggerConfig {
/**
* 系统基础配置
*/
@Autowired
private RuoYiConfig ruoyiConfig;
/** 是否开启swagger */
/**
* 是否开启swagger
*/
@Value("${swagger.enabled}")
private boolean enabled;
/** 设置请求的统一前缀 */
/**
* 设置请求的统一前缀
*/
@Value("${swagger.pathMapping}")
private String pathMapping;
@ -46,8 +53,7 @@ public class SwaggerConfig @@ -46,8 +53,7 @@ public class SwaggerConfig
* 创建API
*/
@Bean
public Docket createRestApi()
{
public Docket createRestApi() {
return new Docket(DocumentationType.OAS_30)
// 是否启用Swagger
.enable(enabled)
@ -71,8 +77,7 @@ public class SwaggerConfig @@ -71,8 +77,7 @@ public class SwaggerConfig
/**
* 安全模式这里指定token通过Authorization头请求头传递
*/
private List<SecurityScheme> securitySchemes()
{
private List<SecurityScheme> securitySchemes() {
List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
return apiKeyList;
@ -81,8 +86,7 @@ public class SwaggerConfig @@ -81,8 +86,7 @@ public class SwaggerConfig
/**
* 安全上下文
*/
private List<SecurityContext> securityContexts()
{
private List<SecurityContext> securityContexts() {
List<SecurityContext> securityContexts = new ArrayList<>();
securityContexts.add(
SecurityContext.builder()
@ -95,8 +99,7 @@ public class SwaggerConfig @@ -95,8 +99,7 @@ public class SwaggerConfig
/**
* 默认的安全上引用
*/
private List<SecurityReference> defaultAuth()
{
private List<SecurityReference> defaultAuth() {
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
@ -108,8 +111,7 @@ public class SwaggerConfig @@ -108,8 +111,7 @@ public class SwaggerConfig
/**
* 添加摘要信息
*/
private ApiInfo apiInfo()
{
private ApiInfo apiInfo() {
// 用ApiInfoBuilder进行定制
return new ApiInfoBuilder()
// 设置标题

86
ruoyi-admin/src/main/java/com/ruoyi/web/serveice/UploadService.java

@ -1,2 +1,86 @@ @@ -1,2 +1,86 @@
package com.ruoyi.web.serveice;public class UploadService {
package com.ruoyi.web.serveice;
import com.aliyun.oss.OSS;
import com.ruoyi.framework.web.ilisteners.PutProcessData;
import com.ruoyi.framework.web.service.AliOSSService;
import com.ruoyi.system.domain.BFile;
import com.ruoyi.system.service.IBFileService;
import com.ruoyi.system.service.IBVideosService;
import com.ruoyi.web.controller.mapper.FileDao;
import com.ruoyi.web.controller.mapper.VideoDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.File;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@Slf4j
@Component
public class UploadService {
private ExecutorService executorService = Executors.newSingleThreadExecutor();
@Autowired
private IBFileService bFileService;
@Autowired
private IBVideosService videosService;
@Autowired
private AliOSSService ossService;
@Autowired
private VideoDao videoDao;
@Autowired
private FileDao fileDao;
public void uploadFile(BFile bfile, String filename, File f, String suffix){
OSS client = ossService.newOss();
executorService.submit(new Runnable() {
@Override
public void run() {
log.info("upload start v1");
try {
//ossService.uploadSuffix(client, multipartFile.getBytes(), suffix);
PutProcessData processData = new PutProcessData();
processData.setId(filename);
bfile.setDone(3L);
bFileService.updateBFile(bfile);
ossService.uploadSuffix(client, processData, filename, f, suffix,bFileService,bfile);
/*while (true) {
logger.info("upload path:{}, success:{}, fail:{}", path, processData.isSuccess(), processData.isFail());
if (processData.isSuccess() || processData.isFail()) {
if (processData.isSuccess()) {
bfile.setPercent("100%");
bfile.setDone(1L);
} else if (processData.isFail()) {
bfile.setPercent("-1%");
bfile.setDone(2L);
}
bFileService.updateBFile(bfile);
break;
} else {
bfile.setPercent(processData.getProcess() + "%");
bFileService.updateBFile(bfile);
}
Thread.sleep(1000);
}*/
} catch (Exception e) {
e.printStackTrace();
} finally {
f.delete();
}
}
});
}
}

2
ruoyi-admin/src/main/resources/application-druid.yml

@ -8,7 +8,7 @@ spring: @@ -8,7 +8,7 @@ spring:
master:
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: password
password: nolan5146
# 从库数据源
slave:
# 从数据源开关/默认关闭

56
ruoyi-admin/src/main/resources/application.yml

@ -14,15 +14,67 @@ ruoyi: @@ -14,15 +14,67 @@ ruoyi:
addressEnabled: false
# 验证码类型 math 数组计算 char 字符验证
captchaType: math
ali:
oss:
prefix: videos
domain: https://xd-video-0.oss-cn-shanghai.aliyuncs.com
bucketName: jelkfjoiweur
endpoint: oss-cn-shanghai.aliyuncs.com
accessKey: LTAI5tQLkBCyQGRmKmXyibjK
secret: RJ4kUelf1QySoDVW4JCzcasRHDocsA
# oss:
# prefix: oss
# domain: https://xd-video-0.oss-cn-shanghai.aliyuncs.com
# bucketName: xd-video-0
# endpoint: oss-cn-shanghai.aliyuncs.com
# accessKey: LTAI4G1Rfc8i5sRdBKREgcVV
# secret: V5MRq7o1V1imCgWfKRyGy7cTPpbuku
hl:
#跳转地址
share_domain: http://fajslkdjf.com
share_short_domain: http://fajslkdjf.com
#微信配置
wx:
public:
#微信授权地址
redirect_uri: https://admin.sibaotech.com/test
appid: wxcb8766dc193524dd
secret: ae75181cb64cc5d4156a3d3b805d6fcc
video:
baseUrl:
forest:
variables:
wechat_clients_url: https://api.weixin.qq.com
wechat_mch_clients_url: https://api.mch.weixin.qq.com
## 日志总开关,打开/关闭Forest请求/响应日志
log-enabled: true
## 打开/关闭Forest请求日志
log-request: false
## 打开/关闭Forest响应状态日志
log-response-status: true
## 打开/关闭Forest响应内容日志
log-response-content: true
# 开发环境配置
server:
# 服务器的HTTP端口,默认为8080
port: 8080
servlet:
# 应用的访问路径
context-path: /
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# 连接数满后的排队数,默认为100
@ -51,7 +103,7 @@ spring: @@ -51,7 +103,7 @@ spring:
servlet:
multipart:
# 单个文件大小
max-file-size: 10MB
max-file-size: 1024MB
# 设置总上传的文件大小
max-request-size: 20MB
# 服务模块
@ -99,6 +151,8 @@ mybatis: @@ -99,6 +151,8 @@ mybatis:
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
configuration:
map-underscore-to-camel-case: true
# PageHelper分页插件
pagehelper:

12
ruoyi-common/pom.xml

@ -16,6 +16,12 @@ @@ -16,6 +16,12 @@
</description>
<dependencies>
<!--阿里oss-->
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.10.2</version>
</dependency>
<!-- Spring框架基本的核心工具 -->
<dependency>
@ -124,7 +130,11 @@ @@ -124,7 +130,11 @@
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
<version>5.6.0</version>
</dependency>
</dependencies>
</project>

4
ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java

@ -20,8 +20,8 @@ import org.springframework.stereotype.Component; @@ -20,8 +20,8 @@ import org.springframework.stereotype.Component;
**/
@SuppressWarnings(value = { "unchecked", "rawtypes" })
@Component
public class RedisCache
{
public class RedisCache {
@Autowired
public RedisTemplate redisTemplate;

2
ruoyi-common/src/main/java/com/ruoyi/common/utils/BytesUtil.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package com.github.wxiaoqi.security.common.util;
package com.ruoyi.common.utils;
import java.util.Arrays;

5
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@ -97,17 +97,18 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter @@ -97,17 +97,18 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求
.authorizeRequests()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
.antMatchers("/login", "/register", "/captchaImage").anonymous()
.antMatchers("/login", "/register", "/captchaImage", "/s/*").anonymous()
.antMatchers(
HttpMethod.GET,
"/",
"/*.html",
"/**/*.html",
"/**/*.html","/wx/**",
"/**/*.css",
"/**/*.js",
"/profile/**"
).permitAll()
.antMatchers("/swagger-ui.html").anonymous()
.antMatchers("/wx/**").anonymous()
.antMatchers("/swagger-resources/**").anonymous()
.antMatchers("/webjars/**").anonymous()
.antMatchers("/*/api-docs").anonymous()

46
ruoyi-framework/src/main/java/com/ruoyi/framework/web/ilisteners/PutObjectProgressListener.java

@ -1,8 +1,10 @@ @@ -1,8 +1,10 @@
package com.ruoyi.web.controller.ilisteners;
package com.ruoyi.framework.web.ilisteners;
import com.aliyun.oss.event.ProgressEvent;
import com.aliyun.oss.event.ProgressEventType;
import com.aliyun.oss.event.ProgressListener;
import com.ruoyi.system.domain.BFile;
import com.ruoyi.system.service.IBFileService;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@ -12,17 +14,36 @@ public class PutObjectProgressListener implements ProgressListener { @@ -12,17 +14,36 @@ public class PutObjectProgressListener implements ProgressListener {
private long totalBytes = -1;
private boolean succeed = false;
private int percent = 0;
int sum = 0;
private boolean fail = false;
private int lastPercent=0;
private IBFileService bFileService ;
private BFile bile;
public void onSuccess(String percent){
bile.setPercent(percent+"%");
bFileService.updateBFile(bile);
}
public void onFail(){
bile.setPercent("-1%");
bile.setDone(2L);
bFileService.updateBFile(bile);
}
public void onCompleted(){
bile.setPercent("100%");
bile.setDone(1L);
bFileService.updateBFile(bile);
}
// 构造方法中加入session
public PutObjectProgressListener() {
}
public PutObjectProgressListener(PutProcessData mSession, int sum) {
public PutObjectProgressListener(PutProcessData mSession,IBFileService bFileService, BFile bile) {
this.session = mSession;
this.sum = sum;
this.session.setProcess("0 %");
this.bFileService=bFileService;
this.bile=bile;
log.info("========================{}============================", session.getId());
@ -46,25 +67,34 @@ public class PutObjectProgressListener implements ProgressListener { @@ -46,25 +67,34 @@ public class PutObjectProgressListener implements ProgressListener {
if (this.totalBytes != -1) {
percent = (int) (this.bytesWritten * 100.0 / this.totalBytes);
// 将进度percent放入session中
this.session.setProcess(percent + " %");
//session.setAttribute("upload_percent", percent);
if (lastPercent!=percent){
lastPercent=percent;
onSuccess(percent+"");
log.info("v1 upload process id:{}, percent:{}", session.getId(), percent);
}
} else {
}
break;
case TRANSFER_COMPLETED_EVENT:
this.succeed = true;
this.session.setSuccess(true);
onCompleted();
break;
case TRANSFER_FAILED_EVENT:
fail = true;
this.session.setFail(true);
onFail();
break;
default:
break;
}
//控制台打印进度
log.info("upload process id:{}, percent:{}", session.getId(), percent);
this.session.setProcess(percent + " %");
//System.out.println("percent:" + percent);
}

6
ruoyi-framework/src/main/java/com/ruoyi/framework/web/ilisteners/PutProcessData.java

@ -1,10 +1,12 @@ @@ -1,10 +1,12 @@
package com.ruoyi.web.controller.ilisteners;
package com.ruoyi.framework.web.ilisteners;
import lombok.Data;
@Data
public class PutProcessData {
private Long id;
private String id;
private String process;
private boolean success=false;
private boolean fail=false;
}

119
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AliOSSService.java

@ -1,2 +1,119 @@ @@ -1,2 +1,119 @@
package com.ruoyi.system.service;public class AliOSSService {
package com.ruoyi.framework.web.service;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.model.PutObjectRequest;
import com.aliyun.oss.model.PutObjectResult;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.framework.web.ilisteners.PutObjectProgressListener;
import com.ruoyi.framework.web.ilisteners.PutProcessData;
import com.ruoyi.system.domain.BFile;
import com.ruoyi.system.service.IBFileService;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
import java.util.UUID;
@Data
@Slf4j
@Service
public class AliOSSService {
@Value("${ali.oss.endpoint}")
private String endpoint = "yourEndpoint";
// 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。
@Value("${ali.oss.accessKey}")
private String accessKeyId = "yourAccessKeyId";
@Value("${ali.oss.secret}")
private String accessKeySecret = "yourAccessKeySecret";
//阿里云BucketName
@Value("${ali.oss.bucketName}")
private String bucketName;
//阿里云绑定的域名
@Value("${ali.oss.domain}")
private String domain;
//阿里云路径前缀
@Value("${ali.oss.prefix}")
private String prefix;
public OSS newOss() {
log.info("new oss accessKeyId:{}", accessKeyId);
return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
}
public void remove(OSS client, String objectName, String path) {
if (client.doesObjectExist(objectName, path)){
client.deleteObject(bucketName, path);
}
}
public String upload(OSS client, InputStream inputStream, String path) {
try {
client.putObject(bucketName, path, inputStream);
} catch (Exception e) {
throw new BaseException("上传文件失败,请检查配置信息");
}
return domain + "/" + path;
}
public String upload(OSS client, PutProcessData processData , String fileName, File f, String path, IBFileService bFileService, BFile bile) {
try {
/*PutObjectResult putObjectResult=client.putObject(bucketName, path, inputStream);*/
client
.putObject(new PutObjectRequest(bucketName,
path, f)
.<PutObjectRequest> withProgressListener(
new PutObjectProgressListener(processData,bFileService,bile)
));
} catch (Exception e) {
throw new BaseException("上传文件失败,请检查配置信息");
}
return domain + "/" + path;
}
public String uploadSuffix(OSS client, PutProcessData processData , String fileName, File f, String suffix,IBFileService bFileService, BFile bile) {
return upload(client, processData, fileName, f, getPath(getPrefix(), suffix),bFileService,bile);
}
public String uploadSuffix(OSS client, byte[] data, String suffix) {
return upload(client, new ByteArrayInputStream(data), getPath(getPrefix(), suffix));
}
public String uploadSuffix(OSS client, InputStream inputStream, String suffix) {
return upload(client, inputStream, getPath(getPrefix(), suffix));
}
public String getPath(String prefix, String suffix) {
//生成uuid
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
//文件路径
String path = DateUtil.today().replaceAll("-", "");
if (StrUtil.isNotBlank(prefix)) {
path = prefix + "/" + path;
}
return path + suffix;
}
}

60
ruoyi-system/src/main/java/com/ruoyi/system/domain/BFile.java

@ -11,7 +11,7 @@ import com.ruoyi.common.core.domain.BaseEntity; @@ -11,7 +11,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
* 请填写功能名称对象 b_file
*
* @author ruoyi
* @date 2022-03-09
* @date 2022-03-14
*/
public class BFile extends BaseEntity
{
@ -20,9 +20,9 @@ public class BFile extends BaseEntity @@ -20,9 +20,9 @@ public class BFile extends BaseEntity
/** $column.columnComment */
private Long id;
/** 文件id */
@Excel(name = "文件id")
private String uuid;
/** 视频名称 */
@Excel(name = "视频名称")
private String videoName;
/** 备注 */
@Excel(name = "备注")
@ -32,6 +32,18 @@ public class BFile extends BaseEntity @@ -32,6 +32,18 @@ public class BFile extends BaseEntity
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Date gmtCreate;
/** 文件id */
@Excel(name = "文件id")
private String uuid;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String percent;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long done;
public void setId(Long id)
{
this.id = id;
@ -41,14 +53,14 @@ public class BFile extends BaseEntity @@ -41,14 +53,14 @@ public class BFile extends BaseEntity
{
return id;
}
public void setUuid(String uuid)
public void setVideoName(String videoName)
{
this.uuid = uuid;
this.videoName = videoName;
}
public String getUuid()
public String getVideoName()
{
return uuid;
return videoName;
}
public void setMemo(String memo)
{
@ -68,14 +80,44 @@ public class BFile extends BaseEntity @@ -68,14 +80,44 @@ public class BFile extends BaseEntity
{
return gmtCreate;
}
public void setUuid(String uuid)
{
this.uuid = uuid;
}
public String getUuid()
{
return uuid;
}
public void setPercent(String percent)
{
this.percent = percent;
}
public String getPercent()
{
return percent;
}
public void setDone(Long done)
{
this.done = done;
}
public Long getDone()
{
return done;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("uuid", getUuid())
.append("videoName", getVideoName())
.append("memo", getMemo())
.append("gmtCreate", getGmtCreate())
.append("uuid", getUuid())
.append("percent", getPercent())
.append("done", getDone())
.toString();
}
}

44
ruoyi-system/src/main/java/com/ruoyi/system/domain/BVideoAllow.java

@ -11,7 +11,7 @@ import com.ruoyi.common.core.domain.BaseEntity; @@ -11,7 +11,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
* 允许列对象 b_video_allow
*
* @author ruoyi
* @date 2022-03-09
* @date 2022-03-10
*/
public class BVideoAllow extends BaseEntity
{
@ -32,13 +32,21 @@ public class BVideoAllow extends BaseEntity @@ -32,13 +32,21 @@ public class BVideoAllow extends BaseEntity
@Excel(name = "微信公众号昵称")
private String wxNickname;
/** 备注 */
@Excel(name = "备注")
private String memo;
/** 分享链接 */
@Excel(name = "分享链接")
private String link;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Date gmtCreate;
private Long videoId;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long videoId;
private Date gmtCreate;
public void setId(Long id)
{
@ -76,14 +84,23 @@ public class BVideoAllow extends BaseEntity @@ -76,14 +84,23 @@ public class BVideoAllow extends BaseEntity
{
return wxNickname;
}
public void setGmtCreate(Date gmtCreate)
public void setMemo(String memo)
{
this.gmtCreate = gmtCreate;
this.memo = memo;
}
public Date getGmtCreate()
public String getMemo()
{
return gmtCreate;
return memo;
}
public void setLink(String link)
{
this.link = link;
}
public String getLink()
{
return link;
}
public void setVideoId(Long videoId)
{
@ -94,6 +111,15 @@ public class BVideoAllow extends BaseEntity @@ -94,6 +111,15 @@ public class BVideoAllow extends BaseEntity
{
return videoId;
}
public void setGmtCreate(Date gmtCreate)
{
this.gmtCreate = gmtCreate;
}
public Date getGmtCreate()
{
return gmtCreate;
}
@Override
public String toString() {
@ -102,8 +128,10 @@ public class BVideoAllow extends BaseEntity @@ -102,8 +128,10 @@ public class BVideoAllow extends BaseEntity
.append("allowId", getAllowId())
.append("wxOpenid", getWxOpenid())
.append("wxNickname", getWxNickname())
.append("gmtCreate", getGmtCreate())
.append("memo", getMemo())
.append("link", getLink())
.append("videoId", getVideoId())
.append("gmtCreate", getGmtCreate())
.toString();
}
}

2
ruoyi-system/src/main/java/com/ruoyi/system/mapper/BFileMapper.java

@ -7,7 +7,7 @@ import com.ruoyi.system.domain.BFile; @@ -7,7 +7,7 @@ import com.ruoyi.system.domain.BFile;
* 请填写功能名称Mapper接口
*
* @author ruoyi
* @date 2022-03-09
* @date 2022-03-14
*/
public interface BFileMapper
{

2
ruoyi-system/src/main/java/com/ruoyi/system/mapper/BVideoAllowMapper.java

@ -7,7 +7,7 @@ import com.ruoyi.system.domain.BVideoAllow; @@ -7,7 +7,7 @@ import com.ruoyi.system.domain.BVideoAllow;
* 允许列Mapper接口
*
* @author ruoyi
* @date 2022-03-09
* @date 2022-03-10
*/
public interface BVideoAllowMapper
{

2
ruoyi-system/src/main/java/com/ruoyi/system/service/IBFileService.java

@ -7,7 +7,7 @@ import com.ruoyi.system.domain.BFile; @@ -7,7 +7,7 @@ import com.ruoyi.system.domain.BFile;
* 请填写功能名称Service接口
*
* @author ruoyi
* @date 2022-03-09
* @date 2022-03-14
*/
public interface IBFileService
{

2
ruoyi-system/src/main/java/com/ruoyi/system/service/IBVideoAllowService.java

@ -7,7 +7,7 @@ import com.ruoyi.system.domain.BVideoAllow; @@ -7,7 +7,7 @@ import com.ruoyi.system.domain.BVideoAllow;
* 允许列Service接口
*
* @author ruoyi
* @date 2022-03-09
* @date 2022-03-10
*/
public interface IBVideoAllowService
{

2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BFileServiceImpl.java

@ -11,7 +11,7 @@ import com.ruoyi.system.service.IBFileService; @@ -11,7 +11,7 @@ import com.ruoyi.system.service.IBFileService;
* 请填写功能名称Service业务层处理
*
* @author ruoyi
* @date 2022-03-09
* @date 2022-03-14
*/
@Service
public class BFileServiceImpl implements IBFileService

2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BVideoAllowServiceImpl.java

@ -11,7 +11,7 @@ import com.ruoyi.system.service.IBVideoAllowService; @@ -11,7 +11,7 @@ import com.ruoyi.system.service.IBVideoAllowService;
* 允许列Service业务层处理
*
* @author ruoyi
* @date 2022-03-09
* @date 2022-03-10
*/
@Service
public class BVideoAllowServiceImpl implements IBVideoAllowService

27
ruoyi-system/src/main/resources/mapper/system/BFileMapper.xml

@ -6,21 +6,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -6,21 +6,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="BFile" id="BFileResult">
<result property="id" column="id" />
<result property="uuid" column="uuid" />
<result property="videoName" column="video_name" />
<result property="memo" column="memo" />
<result property="gmtCreate" column="gmt_create" />
<result property="uuid" column="uuid" />
<result property="percent" column="percent" />
<result property="done" column="done" />
</resultMap>
<sql id="selectBFileVo">
select id, uuid, memo, gmt_create from b_file
select id, video_name, memo, gmt_create, uuid, percent, done from b_file
</sql>
<select id="selectBFileList" parameterType="BFile" resultMap="BFileResult">
<include refid="selectBFileVo"/>
<where>
<if test="uuid != null and uuid != ''"> and uuid = #{uuid}</if>
<if test="videoName != null and videoName != ''"> and video_name like concat('%', #{videoName}, '%')</if>
<if test="memo != null and memo != ''"> and memo = #{memo}</if>
<if test="gmtCreate != null "> and gmt_create = #{gmtCreate}</if>
<if test="uuid != null and uuid != ''"> and uuid = #{uuid}</if>
<if test="percent != null and percent != ''"> and percent = #{percent}</if>
<if test="done != null "> and done = #{done}</if>
</where>
</select>
@ -32,23 +38,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -32,23 +38,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertBFile" parameterType="BFile" useGeneratedKeys="true" keyProperty="id">
insert into b_file
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="uuid != null">uuid,</if>
<if test="videoName != null">video_name,</if>
<if test="memo != null">memo,</if>
<if test="gmtCreate != null">gmt_create,</if>
<if test="uuid != null">uuid,</if>
<if test="percent != null">percent,</if>
<if test="done != null">done,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="uuid != null">#{uuid},</if>
<if test="videoName != null">#{videoName},</if>
<if test="memo != null">#{memo},</if>
<if test="gmtCreate != null">#{gmtCreate},</if>
<if test="uuid != null">#{uuid},</if>
<if test="percent != null">#{percent},</if>
<if test="done != null">#{done},</if>
</trim>
</insert>
<update id="updateBFile" parameterType="BFile">
update b_file
<trim prefix="SET" suffixOverrides=",">
<if test="uuid != null">uuid = #{uuid},</if>
<if test="videoName != null">video_name = #{videoName},</if>
<if test="memo != null">memo = #{memo},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="uuid != null">uuid = #{uuid},</if>
<if test="percent != null">percent = #{percent},</if>
<if test="done != null">done = #{done},</if>
</trim>
where id = #{id}
</update>

22
ruoyi-system/src/main/resources/mapper/system/BVideoAllowMapper.xml

@ -9,12 +9,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -9,12 +9,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="allowId" column="allow_id" />
<result property="wxOpenid" column="wx_openid" />
<result property="wxNickname" column="wx_nickname" />
<result property="gmtCreate" column="gmt_create" />
<result property="memo" column="memo" />
<result property="link" column="link" />
<result property="videoId" column="video_id" />
<result property="gmtCreate" column="gmt_create" />
</resultMap>
<sql id="selectBVideoAllowVo">
select id, allow_id, wx_openid, wx_nickname, gmt_create, video_id from b_video_allow
select id, allow_id, wx_openid, wx_nickname, memo, link, video_id, gmt_create from b_video_allow
</sql>
<select id="selectBVideoAllowList" parameterType="BVideoAllow" resultMap="BVideoAllowResult">
@ -23,8 +25,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -23,8 +25,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="allowId != null and allowId != ''"> and allow_id = #{allowId}</if>
<if test="wxOpenid != null and wxOpenid != ''"> and wx_openid = #{wxOpenid}</if>
<if test="wxNickname != null and wxNickname != ''"> and wx_nickname like concat('%', #{wxNickname}, '%')</if>
<if test="gmtCreate != null "> and gmt_create = #{gmtCreate}</if>
<if test="memo != null and memo != ''"> and memo = #{memo}</if>
<if test="link != null and link != ''"> and link = #{link}</if>
<if test="videoId != null "> and video_id = #{videoId}</if>
<if test="gmtCreate != null "> and gmt_create = #{gmtCreate}</if>
</where>
</select>
@ -39,15 +43,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -39,15 +43,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="allowId != null">allow_id,</if>
<if test="wxOpenid != null">wx_openid,</if>
<if test="wxNickname != null">wx_nickname,</if>
<if test="gmtCreate != null">gmt_create,</if>
<if test="memo != null">memo,</if>
<if test="link != null">link,</if>
<if test="videoId != null">video_id,</if>
<if test="gmtCreate != null">gmt_create,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="allowId != null">#{allowId},</if>
<if test="wxOpenid != null">#{wxOpenid},</if>
<if test="wxNickname != null">#{wxNickname},</if>
<if test="gmtCreate != null">#{gmtCreate},</if>
<if test="memo != null">#{memo},</if>
<if test="link != null">#{link},</if>
<if test="videoId != null">#{videoId},</if>
<if test="gmtCreate != null">#{gmtCreate},</if>
</trim>
</insert>
@ -57,8 +65,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -57,8 +65,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="allowId != null">allow_id = #{allowId},</if>
<if test="wxOpenid != null">wx_openid = #{wxOpenid},</if>
<if test="wxNickname != null">wx_nickname = #{wxNickname},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="memo != null">memo = #{memo},</if>
<if test="link != null">link = #{link},</if>
<if test="videoId != null">video_id = #{videoId},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
</trim>
where id = #{id}
</update>

16
ruoyi-ui/.env.production

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
# 页面标题
VUE_APP_TITLE = 若依管理系统
# 生产环境配置
ENV = 'production'
# 若依管理系统/生产环境
VUE_APP_BASE_API = '/prod-api'
# 页面标题
VUE_APP_TITLE = 若依管理系统
# 生产环境配置
ENV = 'production'
# 若依管理系统/生产环境
VUE_APP_BASE_API = 'http://106.15.102.28:8080'

20
ruoyi-ui/.env.staging

@ -1,10 +1,10 @@ @@ -1,10 +1,10 @@
# 页面标题
VUE_APP_TITLE = 若依管理系统
NODE_ENV = production
# 测试环境配置
ENV = 'staging'
# 若依管理系统/测试环境
VUE_APP_BASE_API = '/stage-api'
# 页面标题
VUE_APP_TITLE = 若依管理系统
NODE_ENV = production
# 测试环境配置
ENV = 'staging'
# 若依管理系统/测试环境
VUE_APP_BASE_API = 'http://106.15.102.28:8080'

180
ruoyi-ui/package.json

@ -1,90 +1,90 @@ @@ -1,90 +1,90 @@
{
"name": "ruoyi",
"version": "3.8.1",
"description": "若依管理系统",
"author": "若依",
"license": "MIT",
"scripts": {
"dev": "vue-cli-service serve",
"build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.{js,vue}": [
"eslint --fix",
"git add"
]
},
"keywords": [
"vue",
"admin",
"dashboard",
"element-ui",
"boilerplate",
"admin-template",
"management-system"
],
"repository": {
"type": "git",
"url": "https://gitee.com/y_project/RuoYi-Vue.git"
},
"dependencies": {
"@riophae/vue-treeselect": "0.4.0",
"axios": "0.24.0",
"clipboard": "2.0.8",
"core-js": "3.19.1",
"echarts": "4.9.0",
"element-ui": "2.15.6",
"file-saver": "2.0.5",
"fuse.js": "6.4.3",
"highlight.js": "9.18.5",
"js-beautify": "1.13.0",
"js-cookie": "3.0.1",
"jsencrypt": "3.2.1",
"nprogress": "0.2.0",
"quill": "1.3.7",
"screenfull": "5.0.2",
"sortablejs": "1.10.2",
"vue": "2.6.12",
"vue-count-to": "1.0.13",
"vue-cropper": "0.5.5",
"vue-meta": "2.4.0",
"vue-router": "3.4.9",
"vuedraggable": "2.24.3",
"vuex": "3.6.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "4.4.6",
"@vue/cli-plugin-eslint": "4.4.6",
"@vue/cli-service": "4.4.6",
"babel-eslint": "10.1.0",
"babel-plugin-dynamic-import-node": "2.3.3",
"chalk": "4.1.0",
"compression-webpack-plugin": "5.0.2",
"connect": "3.6.6",
"eslint": "7.15.0",
"eslint-plugin-vue": "7.2.0",
"lint-staged": "10.5.3",
"runjs": "4.4.2",
"sass": "1.32.13",
"sass-loader": "10.1.1",
"script-ext-html-webpack-plugin": "2.1.5",
"svg-sprite-loader": "5.1.1",
"vue-template-compiler": "2.6.12"
},
"engines": {
"node": ">=8.9",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}
{
"name": "ruoyi",
"version": "3.8.1",
"description": "若依管理系统",
"author": "若依",
"license": "MIT",
"scripts": {
"dev": "vue-cli-service serve",
"build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.{js,vue}": [
"eslint --fix",
"git add"
]
},
"keywords": [
"vue",
"admin",
"dashboard",
"element-ui",
"boilerplate",
"admin-template",
"management-system"
],
"repository": {
"type": "git",
"url": "https://gitee.com/y_project/RuoYi-Vue.git"
},
"dependencies": {
"@riophae/vue-treeselect": "0.4.0",
"axios": "0.24.0",
"clipboard": "2.0.8",
"core-js": "3.19.1",
"echarts": "4.9.0",
"element-ui": "2.15.6",
"file-saver": "2.0.5",
"fuse.js": "6.4.3",
"highlight.js": "9.18.5",
"js-beautify": "1.13.0",
"js-cookie": "3.0.1",
"jsencrypt": "3.2.1",
"nprogress": "0.2.0",
"quill": "1.3.7",
"screenfull": "5.0.2",
"sortablejs": "1.10.2",
"vue": "2.6.12",
"vue-count-to": "1.0.13",
"vue-cropper": "0.5.5",
"vue-meta": "2.4.0",
"vue-router": "3.4.9",
"vuedraggable": "2.24.3",
"vuex": "3.6.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "4.4.6",
"@vue/cli-plugin-eslint": "4.4.6",
"@vue/cli-service": "4.4.6",
"babel-eslint": "10.1.0",
"babel-plugin-dynamic-import-node": "2.3.3",
"chalk": "4.1.0",
"compression-webpack-plugin": "5.0.2",
"connect": "3.6.6",
"eslint": "7.15.0",
"eslint-plugin-vue": "7.2.0",
"lint-staged": "10.5.3",
"runjs": "4.4.2",
"sass": "1.32.13",
"sass-loader": "10.1.1",
"script-ext-html-webpack-plugin": "2.1.5",
"svg-sprite-loader": "5.1.1",
"vue-template-compiler": "2.6.12"
},
"engines": {
"node": ">=8.9",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}

417
ruoyi-ui/public/index.html

@ -1,208 +1,209 @@ @@ -1,208 +1,209 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= webpackConfig.name %></title>
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
<style>
html,
body,
#app {
height: 100%;
margin: 0px;
padding: 0px;
}
.chromeframe {
margin: 0.2em 0;
background: #ccc;
color: #000;
padding: 0.2em 0;
}
#loader-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999999;
}
#loader {
display: block;
position: relative;
left: 50%;
top: 50%;
width: 150px;
height: 150px;
margin: -75px 0 0 -75px;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #FFF;
-webkit-animation: spin 2s linear infinite;
-ms-animation: spin 2s linear infinite;
-moz-animation: spin 2s linear infinite;
-o-animation: spin 2s linear infinite;
animation: spin 2s linear infinite;
z-index: 1001;
}
#loader:before {
content: "";
position: absolute;
top: 5px;
left: 5px;
right: 5px;
bottom: 5px;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #FFF;
-webkit-animation: spin 3s linear infinite;
-moz-animation: spin 3s linear infinite;
-o-animation: spin 3s linear infinite;
-ms-animation: spin 3s linear infinite;
animation: spin 3s linear infinite;
}
#loader:after {
content: "";
position: absolute;
top: 15px;
left: 15px;
right: 15px;
bottom: 15px;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #FFF;
-moz-animation: spin 1.5s linear infinite;
-o-animation: spin 1.5s linear infinite;
-ms-animation: spin 1.5s linear infinite;
-webkit-animation: spin 1.5s linear infinite;
animation: spin 1.5s linear infinite;
}
@-webkit-keyframes spin {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes spin {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#loader-wrapper .loader-section {
position: fixed;
top: 0;
width: 51%;
height: 100%;
background: #7171C6;
z-index: 1000;
-webkit-transform: translateX(0);
-ms-transform: translateX(0);
transform: translateX(0);
}
#loader-wrapper .loader-section.section-left {
left: 0;
}
#loader-wrapper .loader-section.section-right {
right: 0;
}
.loaded #loader-wrapper .loader-section.section-left {
-webkit-transform: translateX(-100%);
-ms-transform: translateX(-100%);
transform: translateX(-100%);
-webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
}
.loaded #loader-wrapper .loader-section.section-right {
-webkit-transform: translateX(100%);
-ms-transform: translateX(100%);
transform: translateX(100%);
-webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
}
.loaded #loader {
opacity: 0;
-webkit-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.loaded #loader-wrapper {
visibility: hidden;
-webkit-transform: translateY(-100%);
-ms-transform: translateY(-100%);
transform: translateY(-100%);
-webkit-transition: all 0.3s 1s ease-out;
transition: all 0.3s 1s ease-out;
}
.no-js #loader-wrapper {
display: none;
}
.no-js h1 {
color: #222222;
}
#loader-wrapper .load_title {
font-family: 'Open Sans';
color: #FFF;
font-size: 19px;
width: 100%;
text-align: center;
z-index: 9999999999999;
position: absolute;
top: 60%;
opacity: 1;
line-height: 30px;
}
#loader-wrapper .load_title span {
font-weight: normal;
font-style: italic;
font-size: 13px;
color: #FFF;
opacity: 0.5;
}
</style>
</head>
<body>
<div id="app">
<div id="loader-wrapper">
<div id="loader"></div>
<div class="loader-section section-left"></div>
<div class="loader-section section-right"></div>
<div class="load_title">正在加载系统资源,请耐心等待</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= webpackConfig.name %></title>
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
<style>
html,
body,
#app {
height: 100%;
margin: 0px;
padding: 0px;
}
.chromeframe {
margin: 0.2em 0;
background: #ccc;
color: #000;
padding: 0.2em 0;
}
#loader-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999999;
}
#loader {
display: block;
position: relative;
left: 50%;
top: 50%;
width: 150px;
height: 150px;
margin: -75px 0 0 -75px;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #FFF;
-webkit-animation: spin 2s linear infinite;
-ms-animation: spin 2s linear infinite;
-moz-animation: spin 2s linear infinite;
-o-animation: spin 2s linear infinite;
animation: spin 2s linear infinite;
z-index: 1001;
}
#loader:before {
content: "";
position: absolute;
top: 5px;
left: 5px;
right: 5px;
bottom: 5px;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #FFF;
-webkit-animation: spin 3s linear infinite;
-moz-animation: spin 3s linear infinite;
-o-animation: spin 3s linear infinite;
-ms-animation: spin 3s linear infinite;
animation: spin 3s linear infinite;
}
#loader:after {
content: "";
position: absolute;
top: 15px;
left: 15px;
right: 15px;
bottom: 15px;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #FFF;
-moz-animation: spin 1.5s linear infinite;
-o-animation: spin 1.5s linear infinite;
-ms-animation: spin 1.5s linear infinite;
-webkit-animation: spin 1.5s linear infinite;
animation: spin 1.5s linear infinite;
}
@-webkit-keyframes spin {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes spin {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#loader-wrapper .loader-section {
position: fixed;
top: 0;
width: 51%;
height: 100%;
background: #7171C6;
z-index: 1000;
-webkit-transform: translateX(0);
-ms-transform: translateX(0);
transform: translateX(0);
}
#loader-wrapper .loader-section.section-left {
left: 0;
}
#loader-wrapper .loader-section.section-right {
right: 0;
}
.loaded #loader-wrapper .loader-section.section-left {
-webkit-transform: translateX(-100%);
-ms-transform: translateX(-100%);
transform: translateX(-100%);
-webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
}
.loaded #loader-wrapper .loader-section.section-right {
-webkit-transform: translateX(100%);
-ms-transform: translateX(100%);
transform: translateX(100%);
-webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
}
.loaded #loader {
opacity: 0;
-webkit-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.loaded #loader-wrapper {
visibility: hidden;
-webkit-transform: translateY(-100%);
-ms-transform: translateY(-100%);
transform: translateY(-100%);
-webkit-transition: all 0.3s 1s ease-out;
transition: all 0.3s 1s ease-out;
}
.no-js #loader-wrapper {
display: none;
}
.no-js h1 {
color: #222222;
}
#loader-wrapper .load_title {
font-family: 'Open Sans';
color: #FFF;
font-size: 19px;
width: 100%;
text-align: center;
z-index: 9999999999999;
position: absolute;
top: 60%;
opacity: 1;
line-height: 30px;
}
#loader-wrapper .load_title span {
font-weight: normal;
font-style: italic;
font-size: 13px;
color: #FFF;
opacity: 0.5;
}
</style>
</head>
<body>
<div id="app">
<div id="loader-wrapper">
<div id="loader"></div>
<div class="loader-section section-left"></div>
<div class="loader-section section-right"></div>
<div class="load_title">正在加载系统资源,请耐心等待</div>
</div>
</div>
</body>
</html>

18
ruoyi-ui/src/api/system/file.js

@ -3,7 +3,15 @@ import request from '@/utils/request' @@ -3,7 +3,15 @@ import request from '@/utils/request'
// 查询【请填写功能名称】列表
export function listFile(query) {
return request({
url: '/system/file/list',
url: '/videos/file/list',
method: 'get',
params: query
})
}
// 未被选中的列表
export function getNoAuthFiles(query) {
return request({
url: '/videos/file/getNoAuthFiles',
method: 'get',
params: query
})
@ -12,7 +20,7 @@ export function listFile(query) { @@ -12,7 +20,7 @@ export function listFile(query) {
// 查询【请填写功能名称】详细
export function getFile(id) {
return request({
url: '/system/file/' + id,
url: '/videos/file/' + id,
method: 'get'
})
}
@ -20,7 +28,7 @@ export function getFile(id) { @@ -20,7 +28,7 @@ export function getFile(id) {
// 新增【请填写功能名称】
export function addFile(data) {
return request({
url: '/system/file',
url: '/videos/file',
method: 'post',
data: data
})
@ -29,7 +37,7 @@ export function addFile(data) { @@ -29,7 +37,7 @@ export function addFile(data) {
// 修改【请填写功能名称】
export function updateFile(data) {
return request({
url: '/system/file',
url: '/videos/file',
method: 'put',
data: data
})
@ -38,7 +46,7 @@ export function updateFile(data) { @@ -38,7 +46,7 @@ export function updateFile(data) {
// 删除【请填写功能名称】
export function delFile(id) {
return request({
url: '/system/file/' + id,
url: '/videos/file/' + id,
method: 'delete'
})
}

8
ruoyi-ui/src/api/system/videos.js

@ -25,6 +25,14 @@ export function addVideos(data) { @@ -25,6 +25,14 @@ export function addVideos(data) {
data: data
})
}
// 给分享链接
export function addShareFile(data) {
return request({
url: '/system/videos/insertVideos',
method: 'post',
data: data
})
}
// 修改视频信息
export function updateVideos(data) {

28
ruoyi-ui/src/router/index.js

@ -120,6 +120,34 @@ export const dynamicRoutes = [ @@ -120,6 +120,34 @@ export const dynamicRoutes = [
}
]
},
{
path: '/system/manage',
component: Layout,
hidden: true,
permissions: ['system:videos:manage'],
children: [
{
path: 'user/:videoId(\\d+)',
component: () => import('@/views/system/manage/files'),
name: 'AuthUser',
meta: { }
}
]
},
{
path: '/system/allow',
component: Layout,
hidden: true,
permissions: ['system:videos:manage'],
children: [
{
path: 'user/:videoId(\\d+)',
component: () => import('@/views/system/allow/index'),
name: 'AuthUser',
meta: { }
}
]
},
{
path: '/system/dict-data',
component: Layout,

144
ruoyi-ui/src/views/system/allow/index.vue

@ -1,42 +1,11 @@ @@ -1,42 +1,11 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="${comment}" prop="allowId">
<el-input
v-model="queryParams.allowId"
placeholder="请输入${comment}"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="公众号openid" prop="wxOpenid">
<el-input
v-model="queryParams.wxOpenid"
placeholder="请输入公众号openid"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="微信公众号昵称" prop="wxNickname">
<el-input
v-model="queryParams.wxNickname"
placeholder="请输入微信公众号昵称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="${comment}" prop="gmtCreate">
<el-date-picker clearable
v-model="queryParams.gmtCreate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择${comment}">
</el-date-picker>
</el-form-item>
<el-form-item label="${comment}" prop="videoId">
<el-form-item label="备注" prop="memo">
<el-input
v-model="queryParams.videoId"
placeholder="请输入${comment}"
v-model="queryParams.memo"
placeholder="请输入备注"
clearable
@keyup.enter.native="handleQuery"
/>
@ -56,7 +25,8 @@ @@ -56,7 +25,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['system:allow:add']"
>新增</el-button>
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -67,7 +37,8 @@ @@ -67,7 +37,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:allow:edit']"
>修改</el-button>
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -78,7 +49,8 @@ @@ -78,7 +49,8 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:allow:remove']"
>删除</el-button>
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -88,23 +60,33 @@ @@ -88,23 +60,33 @@
size="mini"
@click="handleExport"
v-hasPermi="['system:allow:export']"
>导出</el-button>
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="allowList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="${comment}" align="center" prop="id" />
<el-table-column label="${comment}" align="center" prop="allowId" />
<el-table-column label="公众号openid" align="center" prop="wxOpenid" />
<el-table-column label="微信公众号昵称" align="center" prop="wxNickname" />
<el-table-column label="${comment}" align="center" prop="gmtCreate" width="180">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="id" align="center" prop="id"/>
<el-table-column label="公众号openid" align="center" prop="wxOpenid"/>
<el-table-column label="微信公众号昵称" align="center" prop="wxNickname"/>
<el-table-column label="备注" align="center" prop="memo"/>
<el-table-column label="分享链接" align="center" prop="allowId">
<template slot-scope="scope">
<el-button
v-clipboard:copy="clipboardLink(scope.row.link)"
v-clipboard:success="clipboardLinkOk"
v-clipboard:error="clipboardLinkFail"
>复制
</el-button>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="gmtCreate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.gmtCreate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="${comment}" align="center" prop="videoId" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -113,18 +95,20 @@ @@ -113,18 +95,20 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:allow:edit']"
>修改</el-button>
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:allow:remove']"
>删除</el-button>
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
@ -136,25 +120,8 @@ @@ -136,25 +120,8 @@
<!-- 添加或修改允许列对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="${comment}" prop="allowId">
<el-input v-model="form.allowId" placeholder="请输入${comment}" />
</el-form-item>
<el-form-item label="公众号openid" prop="wxOpenid">
<el-input v-model="form.wxOpenid" placeholder="请输入公众号openid" />
</el-form-item>
<el-form-item label="微信公众号昵称" prop="wxNickname">
<el-input v-model="form.wxNickname" placeholder="请输入微信公众号昵称" />
</el-form-item>
<el-form-item label="${comment}" prop="gmtCreate">
<el-date-picker clearable
v-model="form.gmtCreate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择${comment}">
</el-date-picker>
</el-form-item>
<el-form-item label="${comment}" prop="videoId">
<el-input v-model="form.videoId" placeholder="请输入${comment}" />
<el-form-item label="备注" prop="memo">
<el-input v-model="form.memo" placeholder="请输入备注"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -166,7 +133,8 @@ @@ -166,7 +133,8 @@
</template>
<script>
import { listAllow, getAllow, delAllow, addAllow, updateAllow } from "@/api/system/allow";
import Clipboard from "clipboard";
import {listAllow, getAllow, delAllow, addAllow, updateAllow} from "@/api/system/allow";
export default {
name: "Allow",
@ -197,17 +165,20 @@ export default { @@ -197,17 +165,20 @@ export default {
allowId: null,
wxOpenid: null,
wxNickname: null,
gmtCreate: null,
videoId: null
memo: null,
link: null,
videoId: null,
gmtCreate: null
},
//
form: {},
//
rules: {
}
rules: {}
};
},
created() {
const videoId = this.$route.params && this.$route.params.videoId;
this.queryParams.videoId = videoId
this.getList();
},
methods: {
@ -232,11 +203,25 @@ export default { @@ -232,11 +203,25 @@ export default {
allowId: null,
wxOpenid: null,
wxNickname: null,
gmtCreate: null,
videoId: null
memo: null,
link: null,
videoId: null,
gmtCreate: null
};
this.resetForm("form");
},
clipboardLink(link) {
return link;
},
clipboardLinkOk(link) {
this.$modal.msgSuccess("已复制" + link);
},
clipboardLinkFail(link) {
//this.$modal.msgError("");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
@ -250,7 +235,7 @@ export default { @@ -250,7 +235,7 @@ export default {
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
@ -271,6 +256,8 @@ export default { @@ -271,6 +256,8 @@ export default {
},
/** 提交按钮 */
submitForm() {
const videoId = this.$route.params && this.$route.params.videoId;
this.form.videoId = videoId
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
@ -292,12 +279,13 @@ export default { @@ -292,12 +279,13 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除允许列编号为"' + ids + '"的数据项?').then(function() {
this.$modal.confirm('是否确认删除允许列编号为"' + ids + '"的数据项?').then(function () {
return delAllow(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {

212
ruoyi-ui/src/views/system/file/index.vue

@ -17,14 +17,7 @@ @@ -17,14 +17,7 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="${comment}" prop="gmtCreate">
<el-date-picker clearable
v-model="queryParams.gmtCreate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择${comment}">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -40,18 +33,8 @@ @@ -40,18 +33,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['system:file:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:file:edit']"
>修改</el-button>
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -62,7 +45,8 @@ @@ -62,7 +45,8 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:file:remove']"
>删除</el-button>
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -72,17 +56,20 @@ @@ -72,17 +56,20 @@
size="mini"
@click="handleExport"
v-hasPermi="['system:file:export']"
>导出</el-button>
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="fileList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="${comment}" align="center" prop="id" />
<el-table-column label="文件id" align="center" prop="uuid" />
<el-table-column label="备注" align="center" prop="memo" />
<el-table-column label="${comment}" align="center" prop="gmtCreate" width="180">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="文件id" align="center" prop="uuid"/>
<el-table-column label="视频名称" align="center" prop="videoName"/>
<el-table-column label="阿里上传百分比" align="center" prop="percent"/>
<el-table-column label="阿里上传状态 1:成功,0:初始化,2:失败,3:上传中" align="center" prop="done"/>
<el-table-column label="备注" align="center" prop="memo"/>
<el-table-column label="创建时间" align="center" prop="gmtCreate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.gmtCreate, '{y}-{m}-{d}') }}</span>
</template>
@ -95,18 +82,20 @@ @@ -95,18 +82,20 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:file:edit']"
>修改</el-button>
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:file:remove']"
>删除</el-button>
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
@ -116,38 +105,83 @@ @@ -116,38 +105,83 @@
/>
<!-- 添加或修改请填写功能名称对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="文件id" prop="uuid">
<el-input v-model="form.uuid" placeholder="请输入文件id" />
</el-form-item>
<el-form-item label="备注" prop="memo">
<el-input v-model="form.memo" placeholder="请输入备注" />
</el-form-item>
<el-form-item label="${comment}" prop="gmtCreate">
<el-date-picker clearable
v-model="form.gmtCreate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择${comment}">
</el-date-picker>
</el-form-item>
</el-form>
<!-- <el-dialog :title="title" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="备注" prop="memo">
<el-input v-model="form.memo" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>-->
<!-- 用户导入对话框 -->
<el-dialog v-loading="uploadLoading" :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
ref="upload"
:limit="1"
accept="*.*"
:headers="upload.headers"
:action="upload.url + '?remark=' + upload.updateSupport+'&videoName=' + upload.fileName"
:disabled="upload.isUploading"
:on-change="fileChange"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<div class="el-upload__tip" slot="tip">
视频名称<el-input v-model="upload.fileName" />
</div>
<div class="el-upload__tip" slot="tip">
备注<el-input v-model="upload.updateSupport" />
</div>
<!-- <span>仅允许导入xlsxlsx格式文件</span>
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>-->
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
<el-button type="primary" :disabled="btnChangeEnable" @click="submitFileForm">{{sureName}}</el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listFile, getFile, delFile, addFile, updateFile } from "@/api/system/file";
import {listFile, getFile, delFile, addFile, updateFile} from "@/api/system/file";
import { getToken } from "@/utils/auth";
export default {
inheritAttrs: false,
name: "File",
data() {
return {
upload: {
//
open: false,
//
title: "",
//
isUploading: false,
//
updateSupport: '',
fileName: '',
//
headers: { Authorization: "Bearer " + getToken() },
//
url: process.env.VUE_APP_BASE_API + "/videos/file/addFile"
},
//
btnChangeEnable:false,
sureName:"确 定",
uploadLoading:true,
//
loading: true,
//
@ -178,11 +212,15 @@ export default { @@ -178,11 +212,15 @@ export default {
form: {},
//
rules: {
}
};
},
created() {
this.getList();
/*setInterval(function (){
this.getList()
},5000)*/
},
methods: {
/** 查询【请填写功能名称】列表 */
@ -194,6 +232,9 @@ export default { @@ -194,6 +232,9 @@ export default {
this.loading = false;
});
},
onOpen(){
return false
},
//
cancel() {
this.open = false;
@ -201,13 +242,15 @@ export default { @@ -201,13 +242,15 @@ export default {
},
//
reset() {
this.form = {
id: null,
uuid: null,
memo: null,
gmtCreate: null
};
this.upload.fileName=''
this.btnChangeEnable=false
this.sureName="确 定"
this.formData = {
field101: null,
field102: undefined,
}
this.resetForm("form");
this.resetForm("elForm");
},
/** 搜索按钮操作 */
handleQuery() {
@ -222,14 +265,54 @@ export default { @@ -222,14 +265,54 @@ export default {
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.single = selection.length !== 1
this.multiple = !selection.length
},
onClose() {
},
close() {
this.$emit('update:visible', false)
},
handleConfirm() {
console.log(this.fileList.length)
console.log(this.formData.field102)
this.$refs['elForm'].validate(valid => {
if (!valid) return
this.close()
})
},
//
fileChange(file, fileList) {
this.upload.fileName=file.name
},
//
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
//
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
this.getList();
},
//
submitFileForm() {
this.sureName="上 传 中"
this.btnChangeEnable=true
this.$refs.upload.submit();
this.loading = false;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加【请填写功能名称】";
this.upload.open = true;
this.title = "添加";
},
/** 修改按钮操作 */
handleUpdate(row) {
@ -238,7 +321,7 @@ export default { @@ -238,7 +321,7 @@ export default {
getFile(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改【请填写功能名称】";
this.title = "修改";
});
},
/** 提交按钮 */
@ -264,12 +347,13 @@ export default { @@ -264,12 +347,13 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除【请填写功能名称】编号为"' + ids + '"的数据项?').then(function() {
this.$modal.confirm('是否确认删除编号为"' + ids + '"的数据项?').then(function () {
return delFile(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {

58
ruoyi-ui/src/views/system/manage/files.vue

@ -27,17 +27,7 @@ @@ -27,17 +27,7 @@
v-hasPermi="['system:videos:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:videos:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
@ -49,25 +39,14 @@ @@ -49,25 +39,14 @@
v-hasPermi="['system:videos:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:videos:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="videosList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="id" />
<el-table-column label="目录名称" align="center" prop="name" />
<el-table-column label="文件类型:1:目录,2:文件,3:链接" align="center" prop="type" />
<el-table-column label="文件名称" align="center" prop="name" />
<el-table-column label="创建时间" align="center" prop="gmtCreate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.gmtCreate, '{y}-{m}-{d}') }}</span>
@ -82,13 +61,6 @@ @@ -82,13 +61,6 @@
@click="handleUpdate(scope.row)"
v-hasPermi="['system:videos:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleFiles(scope.row)"
v-hasPermi="['system:videos:manageFiles']"
>管理文件</el-button>
<el-button
size="mini"
type="text"
@ -111,8 +83,8 @@ @@ -111,8 +83,8 @@
<!-- 添加或修改视频信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="目录名称" prop="name">
<el-input v-model="form.name" placeholder="请输入目录名称" />
<el-form-item label="文件名称" prop="name">
<el-input v-model="form.name" placeholder="请输入文件名称" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -120,16 +92,22 @@ @@ -120,16 +92,22 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<select-file ref="select" :video-id="parentId" @ok="handleQuery" > </select-file>
</div>
</template>
<script>
import { listVideos, getVideos, delVideos, addVideos, updateVideos } from "@/api/system/videos";
import { listVideos, getVideos, delVideos, addVideos, updateVideos,addShareFile } from "@/api/system/videos";
import selectFile from "./selectFiles";
export default {
name: "ManageFile",
components:{
selectFile
},
data() {
return {
parentId:-1,
//
loading: true,
//
@ -168,8 +146,11 @@ export default { @@ -168,8 +146,11 @@ export default {
};
},
created() {
const videoId = this.$route.params && this.$route.params.videoId;
this.parentId=videoId
this.queryParams.parentId=videoId
this.getList();
console.log(this.$route.params)
},
methods: {
/** 查询视频信息列表 */
@ -195,7 +176,7 @@ export default { @@ -195,7 +176,7 @@ export default {
type: null,
gmtModified: null,
gmtCreate: null,
parentId: null,
parentId: this.parentId,
fileId: null
};
this.resetForm("form");
@ -218,10 +199,7 @@ export default { @@ -218,10 +199,7 @@ export default {
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加视频信息";
this.form.type=1
this.$refs.select.show();
},
/** 修改按钮操作 */
handleUpdate(row) {

368
ruoyi-ui/src/views/system/manage/selectFiles.vue

@ -1,15 +1,8 @@ @@ -1,15 +1,8 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="文件id" prop="uuid">
<el-input
v-model="queryParams.uuid"
placeholder="请输入文件id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="备注" prop="memo">
<!-- 授权用户 -->
<el-dialog title="选择文件" :visible.sync="visible" width="800px" top="5vh" append-to-body>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
<el-form-item label="备注名称" prop="videoName">
<el-input
v-model="queryParams.memo"
placeholder="请输入备注"
@ -17,227 +10,93 @@ @@ -17,227 +10,93 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:file:add']"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:file:remove']"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:file:export']"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="fileList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="文件id" align="center" prop="uuid"/>
<el-table-column label="视频名称" align="center" prop="videoName"/>
<el-table-column label="备注" align="center" prop="memo"/>
<el-table-column label="创建时间" align="center" prop="gmtCreate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.gmtCreate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:file:edit']"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:file:remove']"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改请填写功能名称对话框 -->
<!-- <el-dialog :title="title" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="备注" prop="memo">
<el-input v-model="form.memo" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>-->
<!-- 用户导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
ref="upload"
:limit="1"
accept=".mp4"
:headers="upload.headers"
:action="upload.url + '?remark=' + upload.updateSupport+'&videoName=' + upload.fileName"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<div class="el-upload__tip" slot="tip">
视频名称<el-input v-model="upload.fileName" />
</div>
<div class="el-upload__tip" slot="tip">
备注<el-input v-model="upload.updateSupport" />
</div>
<!-- <span>仅允许导入xlsxlsx格式文件</span>
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>-->
</div>
</el-upload>
<el-row>
<el-table @row-click="clickRow" ref="table" :data="shareList" @selection-change="handleSelectionChange" height="260px">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="id" align="center" prop="id"/>
<el-table-column label="文件id" align="center" prop="uuid"/>
<el-table-column label="视频名称" align="center" prop="videoName"/>
<el-table-column label="备注" align="center" prop="memo"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm"> </el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
</div>
</el-table>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleSelectUser"> </el-button>
<el-button @click="visible = false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import {listFile, getFile, delFile, addFile, updateFile} from "@/api/system/file";
import {listFile, getFile, delFile, addFile, updateFile,getNoAuthFiles} from "@/api/system/file";
import { listVideos, getVideos, delVideos, addVideos, updateVideos,addShareFile } from "@/api/system/videos";
import { getToken } from "@/utils/auth";
export default {
inheritAttrs: false,
name: "File",
dicts: ['sys_normal_disable'],
props: {
//
videoId: {
type: [Number, String]
}
},
data() {
return {
upload: {
//
open: false,
//
title: "",
//
isUploading: false,
//
updateSupport: '',
fileName: '',
//
headers: { Authorization: "Bearer " + getToken() },
//
url: process.env.VUE_APP_BASE_API + "/videos/file/addFile"
},
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
visible: false,
//
shareIds: [],
//
total: 0,
//
fileList: [],
//
title: "",
//
open: false,
//
shareList: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
uuid: null,
memo: null,
gmtCreate: null
},
//
form: {},
//
rules: {
videoId: null,
memo: '',
videoName: undefined,
}
};
},
created() {
this.getList();
},created() {
const videoId = this.$route.params && this.$route.params.videoId;
console.log("selectFile",videoId)
},
methods: {
/** 查询【请填写功能名称】列表 */
getList() {
this.loading = true;
listFile(this.queryParams).then(response => {
this.fileList = response.rows;
this.total = response.total;
this.loading = false;
});
//
show() {
this.queryParams.videoId = this.videoId;
this.getList();
this.visible = true;
},
onOpen(){
return false
clickRow(row) {
this.$refs.table.toggleRowSelection(row);
},
//
cancel() {
this.open = false;
this.reset();
//
handleSelectionChange(selection) {
this.shareIds = selection.map(item => item.id);
},
//
reset() {
this.formData = {
field101: null,
field102: undefined,
}
this.resetForm("form");
this.resetForm("elForm");
//
getList() {
this.shareList=[]
getNoAuthFiles(this.queryParams).then(res => {
this.shareList = res.data;
console.log(res.data)
});
},
/** 搜索按钮操作 */
handleQuery() {
@ -249,94 +108,21 @@ export default { @@ -249,94 +108,21 @@ export default {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
onClose() {
},
close() {
this.$emit('update:visible', false)
},
handleConfirm() {
console.log(this.fileList.length)
console.log(this.formData.field102)
this.$refs['elForm'].validate(valid => {
if (!valid) return
this.close()
})
},
//
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
//
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
this.getList();
},
//
submitFileForm() {
this.$refs.upload.submit();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.upload.open = true;
this.title = "添加";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getFile(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateFile(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addFile(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
/** 选择授权用户操作 */
handleSelectUser() {
const videoId = this.queryParams.videoId;
const shareIds = this.shareIds.join(",");
if (shareIds == "") {
this.$modal.msgError("请选择要分配的用户");
return;
}
addShareFile({videoId: videoId,ids:this.shareIds}).then(res => {
this.$modal.msgSuccess(res.msg);
if (res.code === 200) {
this.visible = false;
this.$emit("ok");
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除编号为"' + ids + '"的数据项?').then(function () {
return delFile(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/file/export', {
...this.queryParams
}, `file_${new Date().getTime()}.xlsx`)
}
}
};

1228
ruoyi-ui/src/views/system/role/index.vue

File diff suppressed because it is too large Load Diff

123
ruoyi-ui/src/views/system/videos/index.vue

@ -1,54 +1,15 @@ @@ -1,54 +1,15 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="${comment}" prop="name">
<el-form-item label="目录名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入${comment}"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="${comment}" prop="path">
<el-input
v-model="queryParams.path"
placeholder="请输入${comment}"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="${comment}" prop="gmtModified">
<el-date-picker clearable
v-model="queryParams.gmtModified"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择${comment}">
</el-date-picker>
</el-form-item>
<el-form-item label="${comment}" prop="gmtCreate">
<el-date-picker clearable
v-model="queryParams.gmtCreate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择${comment}">
</el-date-picker>
</el-form-item>
<el-form-item label="${comment}" prop="parentId">
<el-input
v-model="queryParams.parentId"
placeholder="请输入${comment}"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="文件id" prop="fileId">
<el-input
v-model="queryParams.fileId"
placeholder="请输入文件id"
placeholder="目录名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -103,22 +64,16 @@ @@ -103,22 +64,16 @@
<el-table v-loading="loading" :data="videosList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="${comment}" align="center" prop="id" />
<el-table-column label="${comment}" align="center" prop="name" />
<el-table-column label="${comment}" align="center" prop="path" />
<el-table-column label="id" align="center" prop="id" />
<el-table-column label="目录名称" align="center" prop="name" />
<el-table-column label="目录下的文件" align="center" prop="filenames" />
<el-table-column label="文件类型:1:目录,2:文件,3:链接" align="center" prop="type" />
<el-table-column label="${comment}" align="center" prop="gmtModified" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.gmtModified, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="${comment}" align="center" prop="gmtCreate" width="180">
<el-table-column label="创建时间" align="center" prop="gmtCreate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.gmtCreate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="${comment}" align="center" prop="parentId" />
<el-table-column label="文件id" align="center" prop="fileId" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -128,6 +83,22 @@ @@ -128,6 +83,22 @@
@click="handleUpdate(scope.row)"
v-hasPermi="['system:videos:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleFiles(scope.row)"
v-hasPermi="['system:videos:manageFiles']"
>管理文件</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleShares(scope.row)"
v-hasPermi="['system:videos:manageFiles']"
>分享链接</el-button>
<el-button
size="mini"
type="text"
@ -138,7 +109,7 @@ @@ -138,7 +109,7 @@
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
@ -150,33 +121,8 @@ @@ -150,33 +121,8 @@
<!-- 添加或修改视频信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="${comment}" prop="name">
<el-input v-model="form.name" placeholder="请输入${comment}" />
</el-form-item>
<el-form-item label="${comment}" prop="path">
<el-input v-model="form.path" placeholder="请输入${comment}" />
</el-form-item>
<el-form-item label="${comment}" prop="gmtModified">
<el-date-picker clearable
v-model="form.gmtModified"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择${comment}">
</el-date-picker>
</el-form-item>
<el-form-item label="${comment}" prop="gmtCreate">
<el-date-picker clearable
v-model="form.gmtCreate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择${comment}">
</el-date-picker>
</el-form-item>
<el-form-item label="${comment}" prop="parentId">
<el-input v-model="form.parentId" placeholder="请输入${comment}" />
</el-form-item>
<el-form-item label="文件id" prop="fileId">
<el-input v-model="form.fileId" placeholder="请输入文件id" />
<el-form-item label="目录名称" prop="name">
<el-input v-model="form.name" placeholder="请输入目录名称" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -221,7 +167,7 @@ export default { @@ -221,7 +167,7 @@ export default {
type: null,
gmtModified: null,
gmtCreate: null,
parentId: null,
parentId: 0,
fileId: null
},
//
@ -258,7 +204,7 @@ export default { @@ -258,7 +204,7 @@ export default {
type: null,
gmtModified: null,
gmtCreate: null,
parentId: null,
parentId: 0,
fileId: null
};
this.resetForm("form");
@ -284,6 +230,7 @@ export default { @@ -284,6 +230,7 @@ export default {
this.reset();
this.open = true;
this.title = "添加视频信息";
this.form.type=1
},
/** 修改按钮操作 */
handleUpdate(row) {
@ -325,6 +272,16 @@ export default { @@ -325,6 +272,16 @@ export default {
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 管理文件 */
handleFiles(row) {
this.$tab.openPage("管理"+row.id+"的文件", "/system/manage/user/"+row.id);
},
/** 管理文件 */
handleShares(row) {
this.$tab.openPage("管理分享"+row.id+"的链接", "/system/allow/user/"+row.id);
},
/** 导出按钮操作 */
handleExport() {
this.download('system/videos/export', {

Loading…
Cancel
Save