74 changed files with 4928 additions and 0 deletions
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<parent> |
||||
<artifactId>ruoyi</artifactId> |
||||
<groupId>com.ruoyi</groupId> |
||||
<version>3.8.1</version> |
||||
</parent> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
|
||||
<artifactId>hl-wechat</artifactId> |
||||
|
||||
<properties> |
||||
<maven.compiler.source>8</maven.compiler.source> |
||||
<maven.compiler.target>8</maven.compiler.target> |
||||
</properties> |
||||
|
||||
</project> |
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
package com.ruoyi.system.config; |
||||
|
||||
import lombok.Data; |
||||
import org.springframework.beans.factory.annotation.Value; |
||||
|
||||
@Data |
||||
public class VideoConfig { |
||||
@Value("video.baseUrl") |
||||
private String baseUrl; |
||||
} |
@ -0,0 +1,58 @@
@@ -0,0 +1,58 @@
|
||||
package com.ruoyi.system.config; |
||||
|
||||
|
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
import org.springframework.beans.factory.annotation.Value; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
@Component |
||||
public class WxConfig { |
||||
|
||||
@Value("${wx.public.secret}") |
||||
@Getter |
||||
@Setter |
||||
private String publicSecret; |
||||
|
||||
@Value("${wx.public.appid}") |
||||
@Getter |
||||
@Setter |
||||
private String publicAppid; |
||||
|
||||
|
||||
@Value("${wx.public.redirect_uri}") |
||||
@Getter |
||||
@Setter |
||||
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"; |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public enum SignType { |
||||
MD5, HMACSHA256; |
||||
} |
||||
public enum ResultCode{ |
||||
FAIL,SUCCESS |
||||
} |
||||
|
||||
public static final String HMACSHA256 = "HMAC-SHA256"; |
||||
public static final String MD5 = "MD5"; |
||||
|
||||
public static final String FIELD_SIGN = "sign"; |
||||
public static final String FIELD_SIGN_TYPE = "sign_type"; |
||||
|
||||
|
||||
//获取程序码的请求接口
|
||||
public static final int UNLIMITED_TYPE_IMAGE=1;//byte[]
|
||||
public static final int UNLIMITED_TYPE_FAIL=3;//错误
|
||||
public static final int UNLIMITED_TYPE_JSON=2;//json
|
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
package com.ruoyi.system.controller; |
||||
|
||||
import cn.hutool.core.util.StrUtil; |
||||
|
||||
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 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; |
||||
|
||||
@RestController |
||||
@RequestMapping("/wx") |
||||
public class WxController { |
||||
|
||||
@Autowired |
||||
private MiniWeChatClients weChatClients; |
||||
|
||||
@Autowired |
||||
private WxService wxService; |
||||
|
||||
@Autowired |
||||
private WxConfig wxConfig; |
||||
|
||||
|
||||
@RequestMapping("/getAuth/{id}") |
||||
public AjaxResult open(@PathVariable String id){ |
||||
return AjaxResult.success(String.format(wxConfig.getAuthUrl(),wxConfig.getPublicAppid(),wxConfig.getRedirectUrl(),id )); |
||||
} |
||||
|
||||
/*@RequestMapping("/code2videourl/{code}/{id}") |
||||
public AjaxResult code2videourl(@PathVariable String id,@PathVariable String code){ |
||||
String openid="a"; |
||||
WxPublicCode2UserInfoRes wxPublicCode2UserInfoRes=weChatClients.code2userinfo(wxConfig.getPublicAppid(),wxConfig.getPublicSecret(),code); |
||||
if (wxPublicCode2UserInfoRes.getErrcode()!=0){ |
||||
return AjaxResult.error("获取openid错误"); |
||||
} |
||||
openid=wxPublicCode2UserInfoRes.getOpenid(); |
||||
return wxService.getOwnVideo(id,openid); |
||||
}*/ |
||||
} |
@ -0,0 +1,76 @@
@@ -0,0 +1,76 @@
|
||||
package com.ruoyi.system.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 java.util.Map; |
||||
|
||||
@BaseRequest(baseURL = "${wechat_clients_url}") |
||||
public interface MiniWeChatClients { |
||||
|
||||
/** |
||||
* 获取access_token |
||||
* @param appid |
||||
* @param secret |
||||
* @return |
||||
*/ |
||||
@GetRequest(url = "/cgi-bin/token?grant_type=client_credential&appid=${appid}&secret=${secret}", |
||||
dataType ="json",interceptor = WriteLogInterceptor.class |
||||
) |
||||
WxMiniTokenRes token(@Var("appid") String appid, @Var("secret") String secret); |
||||
|
||||
/** |
||||
* 获取信息 |
||||
* |
||||
* @return |
||||
*/ |
||||
@GetRequest(url = "/cgi-bin/user/info?access_token=${token}&openid=${openid}&lang=zh_CN", |
||||
dataType ="json",interceptor = WriteLogInterceptor.class |
||||
) |
||||
WxUserInfoRes userInfo(@Var("token") String token, @Var("openid") String openid); |
||||
|
||||
|
||||
/** |
||||
* 获取用户信息 |
||||
* @param appid |
||||
* @param secret |
||||
* @param code |
||||
* @return |
||||
*/ |
||||
@GetRequest( |
||||
url = "/sns/jscode2session?appid=${appid}&secret=${secret}&js_code=${code}&grant_type=authorization_code", |
||||
interceptor = WriteLogInterceptor.class,dataType = "json" |
||||
) |
||||
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 |
||||
* @param params |
||||
*/ |
||||
@PostRequest(url = "/wxa/getwxacodeunlimit?access_token=${token}", |
||||
contentType = "application/json", |
||||
interceptor = UnlimitedInterceptor.class) |
||||
byte[] getUnlimited(@Var("token")String token, @Body Map<String,String> params); |
||||
|
||||
} |
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
package com.ruoyi.system.forest.interceptor; |
||||
|
||||
|
||||
import com.dtflys.forest.exceptions.ForestRuntimeException; |
||||
import com.dtflys.forest.http.ForestRequest; |
||||
import com.dtflys.forest.http.ForestResponse; |
||||
import com.dtflys.forest.interceptor.Interceptor; |
||||
|
||||
|
||||
import com.ruoyi.common.utils.BytesUtil; |
||||
import com.ruoyi.system.config.WxConfig; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
@Slf4j |
||||
public class UnlimitedInterceptor implements Interceptor<Object> { |
||||
|
||||
@Override |
||||
public void onError(ForestRuntimeException e, ForestRequest forestRequest, ForestResponse forestResponse) { |
||||
log.error("---> UnlimitedInterceptor error: ",e); |
||||
int type= WxConfig.UNLIMITED_TYPE_FAIL; |
||||
byte[] bytes= BytesUtil.typeAndPayloadMerger(BytesUtil.int2Bytes(type),new byte[0]); |
||||
forestResponse.setResult(bytes); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void onSuccess(Object s, ForestRequest forestRequest, ForestResponse forestResponse) { |
||||
int type= WxConfig.UNLIMITED_TYPE_FAIL; |
||||
if (forestResponse.getContentType().isApplication()&&forestResponse.getContentType().isJson()){ |
||||
type=WxConfig.UNLIMITED_TYPE_JSON; |
||||
}else if (forestResponse.getContentType().isImage()){ |
||||
type=WxConfig.UNLIMITED_TYPE_IMAGE; |
||||
} |
||||
byte[] bytes=BytesUtil.typeAndPayloadMerger(BytesUtil.int2Bytes(type),(byte[])s);//设定前4(含)位是返回内容格式,后4位是内容
|
||||
forestResponse.setResult(bytes); |
||||
|
||||
} |
||||
} |
@ -0,0 +1,29 @@
@@ -0,0 +1,29 @@
|
||||
package com.ruoyi.system.forest.interceptor; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.dtflys.forest.exceptions.ForestRuntimeException; |
||||
import com.dtflys.forest.http.ForestRequest; |
||||
import com.dtflys.forest.http.ForestResponse; |
||||
import com.dtflys.forest.interceptor.Interceptor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
@Slf4j |
||||
public class WriteLogInterceptor implements Interceptor<Object> { |
||||
|
||||
|
||||
@Override |
||||
public void onError(ForestRuntimeException ex, ForestRequest request, ForestResponse response) { |
||||
log.error("forest error",ex); |
||||
} |
||||
|
||||
@Override |
||||
public void onSuccess(Object data, ForestRequest request, ForestResponse response) { |
||||
try { |
||||
|
||||
log.debug("forest result content:{}", JSONObject.toJSONString(data)); |
||||
}catch (Exception e){ |
||||
log.warn("forest parse json fail"); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
package com.ruoyi.system.forest.ptoto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class WxAuthAccessTokenRes extends WxRes{ |
||||
private String openid; |
||||
private String scope; |
||||
private String refreshToken; |
||||
private String accessToken; |
||||
private Long expiresIn; |
||||
|
||||
} |
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
package com.ruoyi.system.forest.ptoto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class WxGetUnlimitedRes extends WxRes{ |
||||
private String contentType; |
||||
private byte[] buffer; |
||||
} |
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.system.forest.ptoto; |
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
@AllArgsConstructor |
||||
public class WxMiniCode2SessionRes extends WxRes{ |
||||
private String openid; |
||||
private String sessionKey; |
||||
private String unionid; |
||||
|
||||
|
||||
|
||||
public WxMiniCode2SessionRes() { |
||||
} |
||||
} |
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
package com.ruoyi.system.forest.ptoto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class WxMiniTokenRes extends WxRes{ |
||||
private String accessToken; |
||||
private Long expiresIn; |
||||
|
||||
} |
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.system.forest.ptoto; |
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
@AllArgsConstructor |
||||
public class WxPublicCode2UserInfoRes extends WxRes{ |
||||
private String openid;//用户唯一标识
|
||||
private String refreshToken;//用户刷新access_token
|
||||
private String accessToken;//网页授权接口调用凭证,注意:此access_token与基础支持的access_token不同
|
||||
private String scope;//用户授权的作用域,使用逗号(,)分隔
|
||||
private Long expiresIn;//access_token接口调用凭证超时时间,单位(秒)
|
||||
|
||||
public WxPublicCode2UserInfoRes() { |
||||
} |
||||
} |
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
package com.ruoyi.system.forest.ptoto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class WxPublickTokenRes extends WxRes{ |
||||
private String accessToken; |
||||
private Long expiresIn; |
||||
|
||||
} |
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
package com.ruoyi.system.forest.ptoto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class WxRes { |
||||
private String errmsg; |
||||
private Integer errcode; |
||||
|
||||
public boolean isSuccess(){ |
||||
return this.errcode!=null&&this.errcode==0; |
||||
} |
||||
} |
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
package com.ruoyi.system.forest.ptoto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class WxSendTemplateRes extends WxRes{ |
||||
|
||||
private String msgId; |
||||
} |
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
package com.ruoyi.system.forest.ptoto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Data |
||||
public class WxUserInfoRes{ |
||||
private int subscribe; |
||||
private String openid; |
||||
private String nickname; |
||||
private String headimgurl; |
||||
private int sex; |
||||
private String language; |
||||
private String city; |
||||
private String province; |
||||
private String country; |
||||
private long subscribeTime; |
||||
private String unionid; |
||||
private String remark; |
||||
private int groupid; |
||||
private List<String> tagidList; |
||||
private String subscribeScene; |
||||
private long qrScene; |
||||
private String qrSceneStr; |
||||
} |
@ -0,0 +1,48 @@
@@ -0,0 +1,48 @@
|
||||
package com.ruoyi.system.service; |
||||
|
||||
import cn.hutool.core.util.StrUtil; |
||||
|
||||
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 IBVideosService videosService; |
||||
|
||||
@Autowired |
||||
private VideoConfig videoConfig; |
||||
|
||||
|
||||
public synchronized AjaxResult getOwnVideo(String id, String openid){ |
||||
|
||||
BVideoAllow bVideoAllow =new BVideoAllow(); |
||||
bVideoAllow.setAllowId(id); |
||||
List<BVideoAllow> list= ibVideoAllowService.selectBVideoAllowList(bVideoAllow); |
||||
if (list==null||list.size()==0){ |
||||
return AjaxResult.error(404,"未找到链接"); |
||||
} |
||||
BVideoAllow allow=list.get(0);//允许对象
|
||||
|
||||
String loadOpenid=allow.getWxOpenid(); |
||||
if (StrUtil.isBlankIfStr(loadOpenid)){ |
||||
allow.setWxOpenid(openid); |
||||
ibVideoAllowService.updateBVideoAllow(allow); |
||||
|
||||
}else if (!loadOpenid.equals(openid)){ |
||||
return AjaxResult.error(401,"视频已被绑定"); |
||||
} |
||||
BVideos videos=videosService.selectBVideosById(allow.getVideoId()); |
||||
if (videos==null){ |
||||
return AjaxResult.error(404,"未找到视频"); |
||||
} |
||||
|
||||
return AjaxResult.success(id+"----"+openid); |
||||
}*/ |
||||
} |
@ -0,0 +1,111 @@
@@ -0,0 +1,111 @@
|
||||
package com.ruoyi.system.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 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; |
||||
|
||||
|
||||
import java.util.concurrent.TimeUnit; |
||||
|
||||
@Service |
||||
@Slf4j |
||||
public class WxTokenService implements CommandLineRunner { |
||||
|
||||
private static String pTokenK = "k_wx_public_token_29"; |
||||
|
||||
|
||||
|
||||
@Autowired |
||||
private MiniWeChatClients miniWeChatClients; |
||||
|
||||
|
||||
//@Autowired
|
||||
private RedisCache redisCache; |
||||
|
||||
@Autowired |
||||
private WxConfig wxConfig; |
||||
|
||||
@Override |
||||
public void run(String... args) throws Exception { |
||||
//refreshToken();//刷新token
|
||||
} |
||||
|
||||
|
||||
public String getPublickToken() { |
||||
String pToken = redisCache.getCacheObject(pTokenK); |
||||
if (StrUtil.isBlankIfStr(pToken)) { |
||||
log.info("---> expire, refresh token"); |
||||
return refreshPublicToken(); |
||||
} |
||||
return pToken; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 每分钟检测redis里的token是否到期 |
||||
*/ |
||||
//@Scheduled(cron = "0 * * * * ?")
|
||||
public void refreshToken() { |
||||
String pToken = redisCache.getCacheObject(pTokenK); |
||||
if (pToken == null || pToken.equals("token")) { |
||||
refreshPublicToken(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 刷新公众号token |
||||
*/ |
||||
public synchronized String refreshPublicToken() { |
||||
String pToken = redisCache.getCacheObject(pTokenK); |
||||
if (!StrUtil.isBlankIfStr(pToken)) { |
||||
log.info("---> valid token"); |
||||
return pToken; |
||||
} |
||||
|
||||
|
||||
|
||||
String token=null; |
||||
try { |
||||
log.info("--> refreshPublicToken refresh start"); |
||||
|
||||
String publicSecret= wxConfig.getPublicSecret(); |
||||
String publicAppid= wxConfig.getPublicAppid(); |
||||
if (StrUtil.isBlank(publicSecret) || StrUtil.isBlank(publicAppid)) { |
||||
log.info("---> pSecretV or pAppidV is empty"); |
||||
return token; |
||||
} |
||||
|
||||
WxMiniTokenRes wxMiniTokenRes = miniWeChatClients.token(publicAppid, publicSecret); |
||||
if (wxMiniTokenRes.getAccessToken() != null && wxMiniTokenRes.getExpiresIn() != null) { |
||||
token = wxMiniTokenRes.getAccessToken(); |
||||
Long expireTime = wxMiniTokenRes.getExpiresIn() - (wxMiniTokenRes.getExpiresIn() / 4);//redis超时时间是原时间的3/4
|
||||
|
||||
|
||||
|
||||
redisCache.setCacheObject(pTokenK, token, expireTime.intValue(), TimeUnit.SECONDS); |
||||
//stringRedisTemplate.opsForValue().set(pTokenK, token, expireTime, TimeUnit.SECONDS);//token存放到redis,设置超时时间
|
||||
|
||||
log.info("---> public expireTime:{}, token:{}", expireTime, token); |
||||
} else { |
||||
log.info("---> refresh public token fail, msg:{}, code:{}", wxMiniTokenRes.getErrmsg(), wxMiniTokenRes.getErrcode()); |
||||
} |
||||
log.info("--> refreshPublicToken refresh end"); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
log.error("---> refreshPublicToken() exception, ", e); |
||||
} |
||||
return token; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,123 @@
@@ -0,0 +1,123 @@
|
||||
#微信配置 |
||||
|
||||
wx: |
||||
public: |
||||
redirect_uri: http://asdf.com |
||||
appid: aa |
||||
secret: bb |
||||
|
||||
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端口,默认为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/* |
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
package hl.config; |
||||
|
||||
import lombok.Data; |
||||
import org.springframework.beans.factory.annotation.Value; |
||||
|
||||
@Data |
||||
public class VideoConfig { |
||||
@Value("video.baseUrl") |
||||
private String baseUrl; |
||||
} |
@ -0,0 +1,58 @@
@@ -0,0 +1,58 @@
|
||||
package hl.config; |
||||
|
||||
|
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
import org.springframework.beans.factory.annotation.Value; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
@Component |
||||
public class WxConfig { |
||||
|
||||
@Value("${wx.public.secret}") |
||||
@Getter |
||||
@Setter |
||||
private String publicSecret; |
||||
|
||||
@Value("${wx.public.appid}") |
||||
@Getter |
||||
@Setter |
||||
private String publicAppid; |
||||
|
||||
|
||||
@Value("${wx.public.redirect_uri}") |
||||
@Getter |
||||
@Setter |
||||
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"; |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public enum SignType { |
||||
MD5, HMACSHA256; |
||||
} |
||||
public enum ResultCode{ |
||||
FAIL,SUCCESS |
||||
} |
||||
|
||||
public static final String HMACSHA256 = "HMAC-SHA256"; |
||||
public static final String MD5 = "MD5"; |
||||
|
||||
public static final String FIELD_SIGN = "sign"; |
||||
public static final String FIELD_SIGN_TYPE = "sign_type"; |
||||
|
||||
|
||||
//获取程序码的请求接口
|
||||
public static final int UNLIMITED_TYPE_IMAGE=1;//byte[]
|
||||
public static final int UNLIMITED_TYPE_FAIL=3;//错误
|
||||
public static final int UNLIMITED_TYPE_JSON=2;//json
|
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
package hl.controller; |
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult; |
||||
import hl.config.WxConfig; |
||||
import hl.forest.clients.MiniWeChatClients; |
||||
import hl.service.WxService; |
||||
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; |
||||
|
||||
@RestController |
||||
@RequestMapping("/wx") |
||||
public class WxController { |
||||
|
||||
@Autowired |
||||
private MiniWeChatClients weChatClients; |
||||
|
||||
@Autowired |
||||
private WxService wxService; |
||||
|
||||
@Autowired |
||||
private WxConfig wxConfig; |
||||
|
||||
|
||||
@RequestMapping("/getAuth/{id}") |
||||
public AjaxResult open(@PathVariable String id) { |
||||
return AjaxResult.success(String.format(wxConfig.getAuthUrl(), wxConfig.getPublicAppid(), wxConfig.getRedirectUrl(), id)); |
||||
} |
||||
|
||||
/*@RequestMapping("/code2videourl/{code}/{id}") |
||||
public AjaxResult code2videourl(@PathVariable String id,@PathVariable String code){ |
||||
String openid="a"; |
||||
WxPublicCode2UserInfoRes wxPublicCode2UserInfoRes=weChatClients.code2userinfo(wxConfig.getPublicAppid(),wxConfig.getPublicSecret(),code); |
||||
if (wxPublicCode2UserInfoRes.getErrcode()!=0){ |
||||
return AjaxResult.error("获取openid错误"); |
||||
} |
||||
openid=wxPublicCode2UserInfoRes.getOpenid(); |
||||
return wxService.getOwnVideo(id,openid); |
||||
}*/ |
||||
} |
@ -0,0 +1,76 @@
@@ -0,0 +1,76 @@
|
||||
package 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 java.util.Map; |
||||
|
||||
@BaseRequest(baseURL = "${wechat_clients_url}") |
||||
public interface MiniWeChatClients { |
||||
|
||||
/** |
||||
* 获取access_token |
||||
* @param appid |
||||
* @param secret |
||||
* @return |
||||
*/ |
||||
@GetRequest(url = "/cgi-bin/token?grant_type=client_credential&appid=${appid}&secret=${secret}", |
||||
dataType ="json",interceptor = WriteLogInterceptor.class |
||||
) |
||||
WxMiniTokenRes token(@Var("appid") String appid, @Var("secret") String secret); |
||||
|
||||
/** |
||||
* 获取信息 |
||||
* |
||||
* @return |
||||
*/ |
||||
@GetRequest(url = "/cgi-bin/user/info?access_token=${token}&openid=${openid}&lang=zh_CN", |
||||
dataType ="json",interceptor = WriteLogInterceptor.class |
||||
) |
||||
WxUserInfoRes userInfo(@Var("token") String token, @Var("openid") String openid); |
||||
|
||||
|
||||
/** |
||||
* 获取用户信息 |
||||
* @param appid |
||||
* @param secret |
||||
* @param code |
||||
* @return |
||||
*/ |
||||
@GetRequest( |
||||
url = "/sns/jscode2session?appid=${appid}&secret=${secret}&js_code=${code}&grant_type=authorization_code", |
||||
interceptor = WriteLogInterceptor.class,dataType = "json" |
||||
) |
||||
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 |
||||
* @param params |
||||
*/ |
||||
@PostRequest(url = "/wxa/getwxacodeunlimit?access_token=${token}", |
||||
contentType = "application/json", |
||||
interceptor = UnlimitedInterceptor.class) |
||||
byte[] getUnlimited(@Var("token")String token, @Body Map<String,String> params); |
||||
|
||||
} |
@ -0,0 +1,37 @@
@@ -0,0 +1,37 @@
|
||||
package hl.forest.interceptor; |
||||
|
||||
|
||||
import com.dtflys.forest.exceptions.ForestRuntimeException; |
||||
import com.dtflys.forest.http.ForestRequest; |
||||
import com.dtflys.forest.http.ForestResponse; |
||||
import com.dtflys.forest.interceptor.Interceptor; |
||||
import com.ruoyi.common.utils.BytesUtil; |
||||
|
||||
import hl.config.WxConfig; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
@Slf4j |
||||
public class UnlimitedInterceptor implements Interceptor<Object> { |
||||
|
||||
@Override |
||||
public void onError(ForestRuntimeException e, ForestRequest forestRequest, ForestResponse forestResponse) { |
||||
log.error("---> UnlimitedInterceptor error: ",e); |
||||
int type= WxConfig.UNLIMITED_TYPE_FAIL; |
||||
byte[] bytes= BytesUtil.typeAndPayloadMerger(BytesUtil.int2Bytes(type),new byte[0]); |
||||
forestResponse.setResult(bytes); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void onSuccess(Object s, ForestRequest forestRequest, ForestResponse forestResponse) { |
||||
int type= WxConfig.UNLIMITED_TYPE_FAIL; |
||||
if (forestResponse.getContentType().isApplication()&&forestResponse.getContentType().isJson()){ |
||||
type=WxConfig.UNLIMITED_TYPE_JSON; |
||||
}else if (forestResponse.getContentType().isImage()){ |
||||
type=WxConfig.UNLIMITED_TYPE_IMAGE; |
||||
} |
||||
byte[] bytes=BytesUtil.typeAndPayloadMerger(BytesUtil.int2Bytes(type),(byte[])s);//设定前4(含)位是返回内容格式,后4位是内容
|
||||
forestResponse.setResult(bytes); |
||||
|
||||
} |
||||
} |
@ -0,0 +1,29 @@
@@ -0,0 +1,29 @@
|
||||
package hl.forest.interceptor; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.dtflys.forest.exceptions.ForestRuntimeException; |
||||
import com.dtflys.forest.http.ForestRequest; |
||||
import com.dtflys.forest.http.ForestResponse; |
||||
import com.dtflys.forest.interceptor.Interceptor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
@Slf4j |
||||
public class WriteLogInterceptor implements Interceptor<Object> { |
||||
|
||||
|
||||
@Override |
||||
public void onError(ForestRuntimeException ex, ForestRequest request, ForestResponse response) { |
||||
log.error("forest error",ex); |
||||
} |
||||
|
||||
@Override |
||||
public void onSuccess(Object data, ForestRequest request, ForestResponse response) { |
||||
try { |
||||
|
||||
log.debug("forest result content:{}", JSONObject.toJSONString(data)); |
||||
}catch (Exception e){ |
||||
log.warn("forest parse json fail"); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
package hl.forest.ptoto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class WxAuthAccessTokenRes extends WxRes { |
||||
private String openid; |
||||
private String scope; |
||||
private String refreshToken; |
||||
private String accessToken; |
||||
private Long expiresIn; |
||||
|
||||
} |
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
package hl.forest.ptoto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class WxGetUnlimitedRes extends WxRes { |
||||
private String contentType; |
||||
private byte[] buffer; |
||||
} |
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
package hl.forest.ptoto; |
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
@AllArgsConstructor |
||||
public class WxMiniCode2SessionRes extends WxRes { |
||||
private String openid; |
||||
private String sessionKey; |
||||
private String unionid; |
||||
|
||||
|
||||
|
||||
public WxMiniCode2SessionRes() { |
||||
} |
||||
} |
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
package hl.forest.ptoto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class WxMiniTokenRes extends WxRes { |
||||
private String accessToken; |
||||
private Long expiresIn; |
||||
|
||||
} |
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
package hl.forest.ptoto; |
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
@AllArgsConstructor |
||||
public class WxPublicCode2UserInfoRes extends WxRes{ |
||||
private String openid;//用户唯一标识
|
||||
private String refreshToken;//用户刷新access_token
|
||||
private String accessToken;//网页授权接口调用凭证,注意:此access_token与基础支持的access_token不同
|
||||
private String scope;//用户授权的作用域,使用逗号(,)分隔
|
||||
private Long expiresIn;//access_token接口调用凭证超时时间,单位(秒)
|
||||
|
||||
public WxPublicCode2UserInfoRes() { |
||||
} |
||||
} |
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
package hl.forest.ptoto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class WxPublickTokenRes extends WxRes{ |
||||
private String accessToken; |
||||
private Long expiresIn; |
||||
|
||||
} |
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
package hl.forest.ptoto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class WxRes { |
||||
private String errmsg; |
||||
private Integer errcode; |
||||
|
||||
public boolean isSuccess(){ |
||||
return this.errcode!=null&&this.errcode==0; |
||||
} |
||||
} |
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
package hl.forest.ptoto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class WxSendTemplateRes extends WxRes { |
||||
|
||||
private String msgId; |
||||
} |
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
package hl.forest.ptoto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Data |
||||
public class WxUserInfoRes{ |
||||
private int subscribe; |
||||
private String openid; |
||||
private String nickname; |
||||
private String headimgurl; |
||||
private int sex; |
||||
private String language; |
||||
private String city; |
||||
private String province; |
||||
private String country; |
||||
private long subscribeTime; |
||||
private String unionid; |
||||
private String remark; |
||||
private int groupid; |
||||
private List<String> tagidList; |
||||
private String subscribeScene; |
||||
private long qrScene; |
||||
private String qrSceneStr; |
||||
} |
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
package hl.service; |
||||
|
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@Service |
||||
public class WxService { |
||||
|
||||
/*@Autowired |
||||
private IBVideoAllowService ibVideoAllowService; |
||||
|
||||
@Autowired |
||||
private IBVideosService videosService; |
||||
|
||||
@Autowired |
||||
private VideoConfig videoConfig; |
||||
|
||||
|
||||
public synchronized AjaxResult getOwnVideo(String id, String openid){ |
||||
|
||||
BVideoAllow bVideoAllow =new BVideoAllow(); |
||||
bVideoAllow.setAllowId(id); |
||||
List<BVideoAllow> list= ibVideoAllowService.selectBVideoAllowList(bVideoAllow); |
||||
if (list==null||list.size()==0){ |
||||
return AjaxResult.error(404,"未找到链接"); |
||||
} |
||||
BVideoAllow allow=list.get(0);//允许对象
|
||||
|
||||
String loadOpenid=allow.getWxOpenid(); |
||||
if (StrUtil.isBlankIfStr(loadOpenid)){ |
||||
allow.setWxOpenid(openid); |
||||
ibVideoAllowService.updateBVideoAllow(allow); |
||||
|
||||
}else if (!loadOpenid.equals(openid)){ |
||||
return AjaxResult.error(401,"视频已被绑定"); |
||||
} |
||||
BVideos videos=videosService.selectBVideosById(allow.getVideoId()); |
||||
if (videos==null){ |
||||
return AjaxResult.error(404,"未找到视频"); |
||||
} |
||||
|
||||
return AjaxResult.success(id+"----"+openid); |
||||
}*/ |
||||
} |
@ -0,0 +1,108 @@
@@ -0,0 +1,108 @@
|
||||
package 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 lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.boot.CommandLineRunner; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.concurrent.TimeUnit; |
||||
|
||||
@Service |
||||
@Slf4j |
||||
public class WxTokenService implements CommandLineRunner { |
||||
|
||||
private static String pTokenK = "k_wx_public_token_29"; |
||||
|
||||
|
||||
|
||||
@Autowired |
||||
private MiniWeChatClients miniWeChatClients; |
||||
|
||||
|
||||
//@Autowired
|
||||
private RedisCache redisCache; |
||||
|
||||
@Autowired |
||||
private WxConfig wxConfig; |
||||
|
||||
@Override |
||||
public void run(String... args) throws Exception { |
||||
//refreshToken();//刷新token
|
||||
} |
||||
|
||||
|
||||
public String getPublickToken() { |
||||
String pToken = redisCache.getCacheObject(pTokenK); |
||||
if (StrUtil.isBlankIfStr(pToken)) { |
||||
log.info("---> expire, refresh token"); |
||||
return refreshPublicToken(); |
||||
} |
||||
return pToken; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 每分钟检测redis里的token是否到期 |
||||
*/ |
||||
//@Scheduled(cron = "0 * * * * ?")
|
||||
public void refreshToken() { |
||||
String pToken = redisCache.getCacheObject(pTokenK); |
||||
if (pToken == null || pToken.equals("token")) { |
||||
refreshPublicToken(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 刷新公众号token |
||||
*/ |
||||
public synchronized String refreshPublicToken() { |
||||
String pToken = redisCache.getCacheObject(pTokenK); |
||||
if (!StrUtil.isBlankIfStr(pToken)) { |
||||
log.info("---> valid token"); |
||||
return pToken; |
||||
} |
||||
|
||||
|
||||
|
||||
String token=null; |
||||
try { |
||||
log.info("--> refreshPublicToken refresh start"); |
||||
|
||||
String publicSecret= wxConfig.getPublicSecret(); |
||||
String publicAppid= wxConfig.getPublicAppid(); |
||||
if (StrUtil.isBlank(publicSecret) || StrUtil.isBlank(publicAppid)) { |
||||
log.info("---> pSecretV or pAppidV is empty"); |
||||
return token; |
||||
} |
||||
|
||||
WxMiniTokenRes wxMiniTokenRes = miniWeChatClients.token(publicAppid, publicSecret); |
||||
if (wxMiniTokenRes.getAccessToken() != null && wxMiniTokenRes.getExpiresIn() != null) { |
||||
token = wxMiniTokenRes.getAccessToken(); |
||||
Long expireTime = wxMiniTokenRes.getExpiresIn() - (wxMiniTokenRes.getExpiresIn() / 4);//redis超时时间是原时间的3/4
|
||||
|
||||
|
||||
|
||||
redisCache.setCacheObject(pTokenK, token, expireTime.intValue(), TimeUnit.SECONDS); |
||||
//stringRedisTemplate.opsForValue().set(pTokenK, token, expireTime, TimeUnit.SECONDS);//token存放到redis,设置超时时间
|
||||
|
||||
log.info("---> public expireTime:{}, token:{}", expireTime, token); |
||||
} else { |
||||
log.info("---> refresh public token fail, msg:{}, code:{}", wxMiniTokenRes.getErrmsg(), wxMiniTokenRes.getErrcode()); |
||||
} |
||||
log.info("--> refreshPublicToken refresh end"); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
log.error("---> refreshPublicToken() exception, ", e); |
||||
} |
||||
return token; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
package com.ruoyi.web.controller.listener; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class PutProcessData { |
||||
private Long id; |
||||
private String process; |
||||
|
||||
} |
@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
|
||||
package com.ruoyi.web.controller.mapper;public class FileDao { |
||||
} |
@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
|
||||
package com.ruoyi.web.controller.mapper; |
||||
|
||||
import org.apache.ibatis.annotations.Mapper; |
||||
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}") |
||||
List<Long> findByParentId(long id); |
||||
} |
@ -0,0 +1,104 @@
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.system.controller; |
||||
|
||||
import java.util.List; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
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 com.ruoyi.common.annotation.Log; |
||||
import com.ruoyi.common.core.controller.BaseController; |
||||
import com.ruoyi.common.core.domain.AjaxResult; |
||||
import com.ruoyi.common.enums.BusinessType; |
||||
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; |
||||
|
||||
/** |
||||
* 【请填写功能名称】Controller |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-03-09 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/system/file") |
||||
public class BFileController extends BaseController |
||||
{ |
||||
@Autowired |
||||
private IBFileService bFileService; |
||||
|
||||
/** |
||||
* 查询【请填写功能名称】列表 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:file:list')") |
||||
@GetMapping("/list") |
||||
public TableDataInfo list(BFile bFile) |
||||
{ |
||||
startPage(); |
||||
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) |
||||
{ |
||||
return AjaxResult.success(bFileService.selectBFileById(id)); |
||||
} |
||||
|
||||
/** |
||||
* 新增【请填写功能名称】 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:file:add')") |
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT) |
||||
@PostMapping |
||||
public AjaxResult add(@RequestBody BFile bFile) |
||||
{ |
||||
return toAjax(bFileService.insertBFile(bFile)); |
||||
} |
||||
|
||||
/** |
||||
* 修改【请填写功能名称】 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:file:edit')") |
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE) |
||||
@PutMapping |
||||
public AjaxResult edit(@RequestBody BFile bFile) |
||||
{ |
||||
return toAjax(bFileService.updateBFile(bFile)); |
||||
} |
||||
|
||||
/** |
||||
* 删除【请填写功能名称】 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:file:remove')") |
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE) |
||||
@DeleteMapping("/{ids}") |
||||
public AjaxResult remove(@PathVariable Long[] ids) |
||||
{ |
||||
return toAjax(bFileService.deleteBFileByIds(ids)); |
||||
} |
||||
} |
@ -0,0 +1,104 @@
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.system.controller; |
||||
|
||||
import java.util.List; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
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 com.ruoyi.common.annotation.Log; |
||||
import com.ruoyi.common.core.controller.BaseController; |
||||
import com.ruoyi.common.core.domain.AjaxResult; |
||||
import com.ruoyi.common.enums.BusinessType; |
||||
import com.ruoyi.system.domain.BVideoAllow; |
||||
import com.ruoyi.system.service.IBVideoAllowService; |
||||
import com.ruoyi.common.utils.poi.ExcelUtil; |
||||
import com.ruoyi.common.core.page.TableDataInfo; |
||||
|
||||
/** |
||||
* 允许列Controller |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-03-10 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/system/allow") |
||||
public class BVideoAllowController extends BaseController |
||||
{ |
||||
@Autowired |
||||
private IBVideoAllowService bVideoAllowService; |
||||
|
||||
/** |
||||
* 查询允许列列表 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:allow:list')") |
||||
@GetMapping("/list") |
||||
public TableDataInfo list(BVideoAllow bVideoAllow) |
||||
{ |
||||
startPage(); |
||||
List<BVideoAllow> list = bVideoAllowService.selectBVideoAllowList(bVideoAllow); |
||||
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) |
||||
{ |
||||
return AjaxResult.success(bVideoAllowService.selectBVideoAllowById(id)); |
||||
} |
||||
|
||||
/** |
||||
* 新增允许列 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:allow:add')") |
||||
@Log(title = "允许列", businessType = BusinessType.INSERT) |
||||
@PostMapping |
||||
public AjaxResult add(@RequestBody BVideoAllow bVideoAllow) |
||||
{ |
||||
return toAjax(bVideoAllowService.insertBVideoAllow(bVideoAllow)); |
||||
} |
||||
|
||||
/** |
||||
* 修改允许列 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:allow:edit')") |
||||
@Log(title = "允许列", businessType = BusinessType.UPDATE) |
||||
@PutMapping |
||||
public AjaxResult edit(@RequestBody BVideoAllow bVideoAllow) |
||||
{ |
||||
return toAjax(bVideoAllowService.updateBVideoAllow(bVideoAllow)); |
||||
} |
||||
|
||||
/** |
||||
* 删除允许列 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:allow:remove')") |
||||
@Log(title = "允许列", businessType = BusinessType.DELETE) |
||||
@DeleteMapping("/{ids}") |
||||
public AjaxResult remove(@PathVariable Long[] ids) |
||||
{ |
||||
return toAjax(bVideoAllowService.deleteBVideoAllowByIds(ids)); |
||||
} |
||||
} |
@ -0,0 +1,104 @@
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.system.controller; |
||||
|
||||
import java.util.List; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
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 com.ruoyi.common.annotation.Log; |
||||
import com.ruoyi.common.core.controller.BaseController; |
||||
import com.ruoyi.common.core.domain.AjaxResult; |
||||
import com.ruoyi.common.enums.BusinessType; |
||||
import com.ruoyi.system.domain.BVideos; |
||||
import com.ruoyi.system.service.IBVideosService; |
||||
import com.ruoyi.common.utils.poi.ExcelUtil; |
||||
import com.ruoyi.common.core.page.TableDataInfo; |
||||
|
||||
/** |
||||
* 视频信息Controller |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-03-09 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/system/videos") |
||||
public class BVideosController extends BaseController |
||||
{ |
||||
@Autowired |
||||
private IBVideosService bVideosService; |
||||
|
||||
/** |
||||
* 查询视频信息列表 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:videos:list')") |
||||
@GetMapping("/list") |
||||
public TableDataInfo list(BVideos bVideos) |
||||
{ |
||||
startPage(); |
||||
List<BVideos> list = bVideosService.selectBVideosList(bVideos); |
||||
return getDataTable(list); |
||||
} |
||||
|
||||
/** |
||||
* 导出视频信息列表 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:videos:export')") |
||||
@Log(title = "视频信息", businessType = BusinessType.EXPORT) |
||||
@PostMapping("/export") |
||||
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, "视频信息数据"); |
||||
} |
||||
|
||||
/** |
||||
* 获取视频信息详细信息 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:videos:query')") |
||||
@GetMapping(value = "/{id}") |
||||
public AjaxResult getInfo(@PathVariable("id") Long id) |
||||
{ |
||||
return AjaxResult.success(bVideosService.selectBVideosById(id)); |
||||
} |
||||
|
||||
/** |
||||
* 新增视频信息 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:videos:add')") |
||||
@Log(title = "视频信息", businessType = BusinessType.INSERT) |
||||
@PostMapping |
||||
public AjaxResult add(@RequestBody BVideos bVideos) |
||||
{ |
||||
return toAjax(bVideosService.insertBVideos(bVideos)); |
||||
} |
||||
|
||||
/** |
||||
* 修改视频信息 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:videos:edit')") |
||||
@Log(title = "视频信息", businessType = BusinessType.UPDATE) |
||||
@PutMapping |
||||
public AjaxResult edit(@RequestBody BVideos bVideos) |
||||
{ |
||||
return toAjax(bVideosService.updateBVideos(bVideos)); |
||||
} |
||||
|
||||
/** |
||||
* 删除视频信息 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:videos:remove')") |
||||
@Log(title = "视频信息", businessType = BusinessType.DELETE) |
||||
@DeleteMapping("/{ids}") |
||||
public AjaxResult remove(@PathVariable Long[] ids) |
||||
{ |
||||
return toAjax(bVideosService.deleteBVideosByIds(ids)); |
||||
} |
||||
} |
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
package com.ruoyi.web.controller.upload; |
||||
|
||||
import cn.hutool.core.util.RandomUtil; |
||||
import com.ruoyi.common.core.page.TableDataInfo; |
||||
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 { |
||||
|
||||
@Autowired |
||||
private RedisCache redisCache; |
||||
|
||||
|
||||
/** |
||||
* 查询允许列列表 |
||||
*/ |
||||
|
||||
@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)); |
||||
|
||||
return downloadView; |
||||
} |
||||
} |
@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
|
||||
package com.ruoyi.web.controller.upload;public class UploadFileController { |
||||
} |
@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
|
||||
package com.ruoyi.web.serveice;public class UploadService { |
||||
} |
@ -0,0 +1,237 @@
@@ -0,0 +1,237 @@
|
||||
/* |
||||
* |
||||
* * Copyright (C) 2018 the sun<463540703@qq.com> |
||||
* |
||||
* * AG-Enterprise 企业版源码 |
||||
* * 郑重声明: |
||||
* * 如果你从其他途径获取到,请告知老A传播人,奖励1000。 |
||||
* * 老A将追究授予人和传播人的法律责任! |
||||
* |
||||
* * This program is free software; you can redistribute it and/or modify |
||||
* * it under the terms of the GNU General Public License as published by |
||||
* * the Free Software Foundation; either version 2 of the License, or |
||||
* * (at your option) any later version. |
||||
* |
||||
* * This program is distributed in the hope that it will be useful, |
||||
* * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* * GNU General Public License for more details. |
||||
* |
||||
* * You should have received a copy of the GNU General Public License along |
||||
* * with this program; if not, write to the Free Software Foundation, Inc., |
||||
* * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
||||
* |
||||
*/ |
||||
|
||||
package com.ruoyi.common.config; |
||||
|
||||
import org.hibernate.validator.constraints.Range; |
||||
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
import org.springframework.context.annotation.Configuration; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* 云存储配置信息 |
||||
* @author ace |
||||
*/ |
||||
@Configuration |
||||
@ConfigurationProperties(prefix = "oss") |
||||
public class CloudStorageConfig implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
//类型 1:七牛 2:阿里云 3:腾讯云
|
||||
@Range(min=1, max=3, message = "类型错误") |
||||
private Integer type; |
||||
|
||||
//七牛绑定的域名
|
||||
private String qiniuDomain; |
||||
//七牛路径前缀
|
||||
private String qiniuPrefix; |
||||
//七牛ACCESS_KEY
|
||||
private String qiniuAccessKey; |
||||
//七牛SECRET_KEY
|
||||
private String qiniuSecretKey; |
||||
//七牛存储空间名
|
||||
private String qiniuBucketName; |
||||
|
||||
//阿里云绑定的域名
|
||||
private String aliyunDomain; |
||||
//阿里云路径前缀
|
||||
private String aliyunPrefix; |
||||
//阿里云EndPoint
|
||||
private String aliyunEndPoint; |
||||
//阿里云AccessKeyId
|
||||
private String aliyunAccessKeyId; |
||||
//阿里云AccessKeySecret
|
||||
private String aliyunAccessKeySecret; |
||||
//阿里云BucketName
|
||||
private String aliyunBucketName; |
||||
|
||||
//腾讯云绑定的域名
|
||||
private String qcloudDomain; |
||||
//腾讯云路径前缀
|
||||
private String qcloudPrefix; |
||||
//腾讯云AppId
|
||||
private Integer qcloudAppId; |
||||
//腾讯云SecretId
|
||||
private String qcloudSecretId; |
||||
//腾讯云SecretKey
|
||||
private String qcloudSecretKey; |
||||
//腾讯云BucketName
|
||||
private String qcloudBucketName; |
||||
//腾讯云COS所属地区
|
||||
private String qcloudRegion; |
||||
|
||||
public Integer getType() { |
||||
return type; |
||||
} |
||||
|
||||
public void setType(Integer type) { |
||||
this.type = type; |
||||
} |
||||
|
||||
public String getQiniuDomain() { |
||||
return qiniuDomain; |
||||
} |
||||
|
||||
public void setQiniuDomain(String qiniuDomain) { |
||||
this.qiniuDomain = qiniuDomain; |
||||
} |
||||
|
||||
public String getQiniuAccessKey() { |
||||
return qiniuAccessKey; |
||||
} |
||||
|
||||
public void setQiniuAccessKey(String qiniuAccessKey) { |
||||
this.qiniuAccessKey = qiniuAccessKey; |
||||
} |
||||
|
||||
public String getQiniuSecretKey() { |
||||
return qiniuSecretKey; |
||||
} |
||||
|
||||
public void setQiniuSecretKey(String qiniuSecretKey) { |
||||
this.qiniuSecretKey = qiniuSecretKey; |
||||
} |
||||
|
||||
public String getQiniuBucketName() { |
||||
return qiniuBucketName; |
||||
} |
||||
|
||||
public void setQiniuBucketName(String qiniuBucketName) { |
||||
this.qiniuBucketName = qiniuBucketName; |
||||
} |
||||
|
||||
public String getQiniuPrefix() { |
||||
return qiniuPrefix; |
||||
} |
||||
|
||||
public void setQiniuPrefix(String qiniuPrefix) { |
||||
this.qiniuPrefix = qiniuPrefix; |
||||
} |
||||
|
||||
public String getAliyunDomain() { |
||||
return aliyunDomain; |
||||
} |
||||
|
||||
public void setAliyunDomain(String aliyunDomain) { |
||||
this.aliyunDomain = aliyunDomain; |
||||
} |
||||
|
||||
public String getAliyunPrefix() { |
||||
return aliyunPrefix; |
||||
} |
||||
|
||||
public void setAliyunPrefix(String aliyunPrefix) { |
||||
this.aliyunPrefix = aliyunPrefix; |
||||
} |
||||
|
||||
public String getAliyunEndPoint() { |
||||
return aliyunEndPoint; |
||||
} |
||||
|
||||
public void setAliyunEndPoint(String aliyunEndPoint) { |
||||
this.aliyunEndPoint = aliyunEndPoint; |
||||
} |
||||
|
||||
public String getAliyunAccessKeyId() { |
||||
return aliyunAccessKeyId; |
||||
} |
||||
|
||||
public void setAliyunAccessKeyId(String aliyunAccessKeyId) { |
||||
this.aliyunAccessKeyId = aliyunAccessKeyId; |
||||
} |
||||
|
||||
public String getAliyunAccessKeySecret() { |
||||
return aliyunAccessKeySecret; |
||||
} |
||||
|
||||
public void setAliyunAccessKeySecret(String aliyunAccessKeySecret) { |
||||
this.aliyunAccessKeySecret = aliyunAccessKeySecret; |
||||
} |
||||
|
||||
public String getAliyunBucketName() { |
||||
return aliyunBucketName; |
||||
} |
||||
|
||||
public void setAliyunBucketName(String aliyunBucketName) { |
||||
this.aliyunBucketName = aliyunBucketName; |
||||
} |
||||
|
||||
public String getQcloudDomain() { |
||||
return qcloudDomain; |
||||
} |
||||
|
||||
public void setQcloudDomain(String qcloudDomain) { |
||||
this.qcloudDomain = qcloudDomain; |
||||
} |
||||
|
||||
public String getQcloudPrefix() { |
||||
return qcloudPrefix; |
||||
} |
||||
|
||||
public void setQcloudPrefix(String qcloudPrefix) { |
||||
this.qcloudPrefix = qcloudPrefix; |
||||
} |
||||
|
||||
public Integer getQcloudAppId() { |
||||
return qcloudAppId; |
||||
} |
||||
|
||||
public void setQcloudAppId(Integer qcloudAppId) { |
||||
this.qcloudAppId = qcloudAppId; |
||||
} |
||||
|
||||
public String getQcloudSecretId() { |
||||
return qcloudSecretId; |
||||
} |
||||
|
||||
public void setQcloudSecretId(String qcloudSecretId) { |
||||
this.qcloudSecretId = qcloudSecretId; |
||||
} |
||||
|
||||
public String getQcloudSecretKey() { |
||||
return qcloudSecretKey; |
||||
} |
||||
|
||||
public void setQcloudSecretKey(String qcloudSecretKey) { |
||||
this.qcloudSecretKey = qcloudSecretKey; |
||||
} |
||||
|
||||
public String getQcloudBucketName() { |
||||
return qcloudBucketName; |
||||
} |
||||
|
||||
public void setQcloudBucketName(String qcloudBucketName) { |
||||
this.qcloudBucketName = qcloudBucketName; |
||||
} |
||||
|
||||
public String getQcloudRegion() { |
||||
return qcloudRegion; |
||||
} |
||||
|
||||
public void setQcloudRegion(String qcloudRegion) { |
||||
this.qcloudRegion = qcloudRegion; |
||||
} |
||||
} |
@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
|
||||
/* |
||||
* |
||||
* * Copyright (C) 2018 the sun<463540703@qq.com> |
||||
* |
||||
* * AG-Enterprise 企业版源码 |
||||
* * 郑重声明: |
||||
* * 如果你从其他途径获取到,请告知老A传播人,奖励1000。 |
||||
* * 老A将追究授予人和传播人的法律责任! |
||||
* |
||||
* * This program is free software; you can redistribute it and/or modify |
||||
* * it under the terms of the GNU General Public License as published by |
||||
* * the Free Software Foundation; either version 2 of the License, or |
||||
* * (at your option) any later version. |
||||
* |
||||
* * This program is distributed in the hope that it will be useful, |
||||
* * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* * GNU General Public License for more details. |
||||
* |
||||
* * You should have received a copy of the GNU General Public License along |
||||
* * with this program; if not, write to the Free Software Foundation, Inc., |
||||
* * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
||||
* |
||||
*/ |
||||
|
||||
package com.ruoyi.common.config; |
||||
|
||||
import lombok.Data; |
||||
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
import org.springframework.context.annotation.Configuration; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 配置信息 |
||||
* @author ace |
||||
*/ |
||||
@Configuration |
||||
@ConfigurationProperties(prefix = "tool") |
||||
@Data |
||||
public class ToolConfig implements Serializable { |
||||
|
||||
private String ffmpegPath; |
||||
|
||||
private String saveVideoPath; |
||||
|
||||
|
||||
private List<String> downloadUrls; |
||||
} |
@ -0,0 +1,78 @@
@@ -0,0 +1,78 @@
|
||||
package com.github.wxiaoqi.security.common.util; |
||||
|
||||
import java.util.Arrays; |
||||
|
||||
/** |
||||
* Created by huangchongguo on 2020/7/1. |
||||
* Description:No |
||||
*/ |
||||
public class BytesUtil { |
||||
|
||||
/*public static <R> R RgetClassObject(Object classObject, byte[] bytes){ |
||||
bytes=getContentByBytes(bytes); |
||||
Class<?> []classZ=new Class[]{classObject.getClass()}; |
||||
return (R)InvokeMethodOpen.invokeMethod(classObject.getClass(),classObject,"parseFrom",classZ,bytes); |
||||
}*/ |
||||
|
||||
//获取类型(ClassType)
|
||||
public static int getClassTypeByBytes(byte[] bytes){ |
||||
return BytesUtil.bytes2Int(Arrays.copyOfRange(bytes,0,4)); |
||||
} |
||||
|
||||
//获取内容(payload)
|
||||
public static byte[] getContentByBytes(byte[] bytes){ |
||||
if (bytes.length<=3){ |
||||
throw new RuntimeException("getContentByBytes length is short"); |
||||
} |
||||
return Arrays.copyOfRange(bytes,4,bytes.length); |
||||
} |
||||
|
||||
//融合classType和实际内容
|
||||
public static byte[] typeAndPayloadMerger(byte[] bt1,byte[] bt2){ |
||||
|
||||
//byte[] bt1=BytesUtil.int2Bytes(classType.getType());//classType
|
||||
|
||||
byte[] bt3 = new byte[bt1.length+bt2.length]; |
||||
System.arraycopy(bt1, 0, bt3, 0, bt1.length); |
||||
System.arraycopy(bt2, 0, bt3, bt1.length, bt2.length); |
||||
|
||||
return bt3; |
||||
} |
||||
|
||||
|
||||
public static int bytes2Int(byte[] bytes) { |
||||
int result = 0; |
||||
//将每个byte依次搬运到int相应的位置
|
||||
result = bytes[0] & 0xff; |
||||
result = result << 8 | bytes[1] & 0xff; |
||||
result = result << 8 | bytes[2] & 0xff; |
||||
result = result << 8 | bytes[3] & 0xff; |
||||
return result; |
||||
} |
||||
|
||||
public static byte[] int2Bytes(int num) { |
||||
byte[] bytes = new byte[4]; |
||||
//通过移位运算,截取低8位的方式,将int保存到byte数组
|
||||
bytes[0] = (byte)(num >>> 24); |
||||
bytes[1] = (byte)(num >>> 16); |
||||
bytes[2] = (byte)(num >>> 8); |
||||
bytes[3] = (byte)num; |
||||
return bytes; |
||||
} |
||||
public static Byte[] byte2Byte(byte[] bytesPrim) { |
||||
Byte[] bytes = new Byte[bytesPrim.length]; |
||||
|
||||
int i = 0; |
||||
for (byte b : bytesPrim) bytes[i++] = b; // Autoboxing
|
||||
|
||||
return bytes; |
||||
} |
||||
public static byte[] Byte2Byte(Byte[] bytesPrim) { |
||||
byte[] bytes = new byte[bytesPrim.length]; |
||||
|
||||
int i = 0; |
||||
for (Byte b : bytesPrim) bytes[i++] = b; // Autoboxing
|
||||
|
||||
return bytes; |
||||
} |
||||
} |
@ -0,0 +1,79 @@
@@ -0,0 +1,79 @@
|
||||
package com.ruoyi.web.controller.ilisteners; |
||||
|
||||
import com.aliyun.oss.event.ProgressEvent; |
||||
import com.aliyun.oss.event.ProgressEventType; |
||||
import com.aliyun.oss.event.ProgressListener; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
@Slf4j |
||||
public class PutObjectProgressListener implements ProgressListener { |
||||
private PutProcessData session; |
||||
private long bytesWritten = 0; |
||||
private long totalBytes = -1; |
||||
private boolean succeed = false; |
||||
private int percent = 0; |
||||
int sum = 0; |
||||
private boolean fail = false; |
||||
|
||||
// 构造方法中加入session
|
||||
public PutObjectProgressListener() { |
||||
} |
||||
|
||||
public PutObjectProgressListener(PutProcessData mSession, int sum) { |
||||
this.session = mSession; |
||||
this.sum = sum; |
||||
this.session.setProcess("0 %"); |
||||
|
||||
log.info("========================{}============================", session.getId()); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void progressChanged(ProgressEvent progressEvent) { |
||||
long bytes = progressEvent.getBytes(); |
||||
ProgressEventType eventType = progressEvent.getEventType(); |
||||
switch (eventType) { |
||||
case TRANSFER_STARTED_EVENT: |
||||
// logger.info("Start to upload......");
|
||||
break; |
||||
case REQUEST_CONTENT_LENGTH_EVENT: |
||||
this.totalBytes = bytes; |
||||
// logger.info(this.totalBytes +
|
||||
// " bytes in total will be uploaded to OSS");
|
||||
break; |
||||
case REQUEST_BYTE_TRANSFER_EVENT: |
||||
this.bytesWritten += bytes; |
||||
if (this.totalBytes != -1) { |
||||
percent = (int) (this.bytesWritten * 100.0 / this.totalBytes); |
||||
// 将进度percent放入session中
|
||||
this.session.setProcess(percent + " %"); |
||||
//session.setAttribute("upload_percent", percent);
|
||||
} else { |
||||
|
||||
} |
||||
break; |
||||
case TRANSFER_COMPLETED_EVENT: |
||||
this.succeed = true; |
||||
|
||||
break; |
||||
case TRANSFER_FAILED_EVENT: |
||||
fail = true; |
||||
break; |
||||
default: |
||||
break; |
||||
} |
||||
|
||||
//控制台打印进度
|
||||
log.info("upload process id:{}, percent:{}", session.getId(), percent); |
||||
//System.out.println("percent:" + percent);
|
||||
|
||||
} |
||||
|
||||
public boolean isFail() { |
||||
return fail; |
||||
} |
||||
|
||||
public boolean isSucceed() { |
||||
return succeed; |
||||
} |
||||
} |
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
package com.ruoyi.web.controller.ilisteners; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class PutProcessData { |
||||
private Long id; |
||||
private String process; |
||||
|
||||
} |
@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
|
||||
package com.ruoyi.system.service;public class AliOSSService { |
||||
} |
@ -0,0 +1,81 @@
@@ -0,0 +1,81 @@
|
||||
package com.ruoyi.system.domain; |
||||
|
||||
import java.util.Date; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
import com.ruoyi.common.annotation.Excel; |
||||
import com.ruoyi.common.core.domain.BaseEntity; |
||||
|
||||
/** |
||||
* 【请填写功能名称】对象 b_file |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-03-09 |
||||
*/ |
||||
public class BFile extends BaseEntity |
||||
{ |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** $column.columnComment */ |
||||
private Long id; |
||||
|
||||
/** 文件id */ |
||||
@Excel(name = "文件id") |
||||
private String uuid; |
||||
|
||||
/** 备注 */ |
||||
@Excel(name = "备注") |
||||
private String memo; |
||||
|
||||
/** $column.columnComment */ |
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") |
||||
private Date gmtCreate; |
||||
|
||||
public void setId(Long id) |
||||
{ |
||||
this.id = id; |
||||
} |
||||
|
||||
public Long getId() |
||||
{ |
||||
return id; |
||||
} |
||||
public void setUuid(String uuid) |
||||
{ |
||||
this.uuid = uuid; |
||||
} |
||||
|
||||
public String getUuid() |
||||
{ |
||||
return uuid; |
||||
} |
||||
public void setMemo(String memo) |
||||
{ |
||||
this.memo = memo; |
||||
} |
||||
|
||||
public String getMemo() |
||||
{ |
||||
return memo; |
||||
} |
||||
public void setGmtCreate(Date gmtCreate) |
||||
{ |
||||
this.gmtCreate = gmtCreate; |
||||
} |
||||
|
||||
public Date getGmtCreate() |
||||
{ |
||||
return gmtCreate; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
||||
.append("id", getId()) |
||||
.append("uuid", getUuid()) |
||||
.append("memo", getMemo()) |
||||
.append("gmtCreate", getGmtCreate()) |
||||
.toString(); |
||||
} |
||||
} |
@ -0,0 +1,109 @@
@@ -0,0 +1,109 @@
|
||||
package com.ruoyi.system.domain; |
||||
|
||||
import java.util.Date; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
import com.ruoyi.common.annotation.Excel; |
||||
import com.ruoyi.common.core.domain.BaseEntity; |
||||
|
||||
/** |
||||
* 允许列对象 b_video_allow |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-03-09 |
||||
*/ |
||||
public class BVideoAllow extends BaseEntity |
||||
{ |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** $column.columnComment */ |
||||
private Long id; |
||||
|
||||
/** $column.columnComment */ |
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") |
||||
private String allowId; |
||||
|
||||
/** 公众号openid */ |
||||
@Excel(name = "公众号openid") |
||||
private String wxOpenid; |
||||
|
||||
/** 微信公众号昵称 */ |
||||
@Excel(name = "微信公众号昵称") |
||||
private String wxNickname; |
||||
|
||||
/** $column.columnComment */ |
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") |
||||
private Date gmtCreate; |
||||
|
||||
/** $column.columnComment */ |
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") |
||||
private Long videoId; |
||||
|
||||
public void setId(Long id) |
||||
{ |
||||
this.id = id; |
||||
} |
||||
|
||||
public Long getId() |
||||
{ |
||||
return id; |
||||
} |
||||
public void setAllowId(String allowId) |
||||
{ |
||||
this.allowId = allowId; |
||||
} |
||||
|
||||
public String getAllowId() |
||||
{ |
||||
return allowId; |
||||
} |
||||
public void setWxOpenid(String wxOpenid) |
||||
{ |
||||
this.wxOpenid = wxOpenid; |
||||
} |
||||
|
||||
public String getWxOpenid() |
||||
{ |
||||
return wxOpenid; |
||||
} |
||||
public void setWxNickname(String wxNickname) |
||||
{ |
||||
this.wxNickname = wxNickname; |
||||
} |
||||
|
||||
public String getWxNickname() |
||||
{ |
||||
return wxNickname; |
||||
} |
||||
public void setGmtCreate(Date gmtCreate) |
||||
{ |
||||
this.gmtCreate = gmtCreate; |
||||
} |
||||
|
||||
public Date getGmtCreate() |
||||
{ |
||||
return gmtCreate; |
||||
} |
||||
public void setVideoId(Long videoId) |
||||
{ |
||||
this.videoId = videoId; |
||||
} |
||||
|
||||
public Long getVideoId() |
||||
{ |
||||
return videoId; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
||||
.append("id", getId()) |
||||
.append("allowId", getAllowId()) |
||||
.append("wxOpenid", getWxOpenid()) |
||||
.append("wxNickname", getWxNickname()) |
||||
.append("gmtCreate", getGmtCreate()) |
||||
.append("videoId", getVideoId()) |
||||
.toString(); |
||||
} |
||||
} |
@ -0,0 +1,137 @@
@@ -0,0 +1,137 @@
|
||||
package com.ruoyi.system.domain; |
||||
|
||||
import java.util.Date; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
import com.ruoyi.common.annotation.Excel; |
||||
import com.ruoyi.common.core.domain.BaseEntity; |
||||
|
||||
/** |
||||
* 视频信息对象 b_videos |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-03-09 |
||||
*/ |
||||
public class BVideos extends BaseEntity |
||||
{ |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** $column.columnComment */ |
||||
private Long id; |
||||
|
||||
/** $column.columnComment */ |
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") |
||||
private String name; |
||||
|
||||
/** $column.columnComment */ |
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") |
||||
private String path; |
||||
|
||||
/** 文件类型:1:目录,2:文件,3:链接 */ |
||||
@Excel(name = "文件类型:1:目录,2:文件,3:链接") |
||||
private Long type; |
||||
|
||||
/** $column.columnComment */ |
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") |
||||
private Date gmtModified; |
||||
|
||||
/** $column.columnComment */ |
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") |
||||
private Date gmtCreate; |
||||
|
||||
/** $column.columnComment */ |
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") |
||||
private Long parentId; |
||||
|
||||
/** 文件id */ |
||||
@Excel(name = "文件id") |
||||
private Long fileId; |
||||
|
||||
public void setId(Long id) |
||||
{ |
||||
this.id = id; |
||||
} |
||||
|
||||
public Long getId() |
||||
{ |
||||
return id; |
||||
} |
||||
public void setName(String name) |
||||
{ |
||||
this.name = name; |
||||
} |
||||
|
||||
public String getName() |
||||
{ |
||||
return name; |
||||
} |
||||
public void setPath(String path) |
||||
{ |
||||
this.path = path; |
||||
} |
||||
|
||||
public String getPath() |
||||
{ |
||||
return path; |
||||
} |
||||
public void setType(Long type) |
||||
{ |
||||
this.type = type; |
||||
} |
||||
|
||||
public Long getType() |
||||
{ |
||||
return type; |
||||
} |
||||
public void setGmtModified(Date gmtModified) |
||||
{ |
||||
this.gmtModified = gmtModified; |
||||
} |
||||
|
||||
public Date getGmtModified() |
||||
{ |
||||
return gmtModified; |
||||
} |
||||
public void setGmtCreate(Date gmtCreate) |
||||
{ |
||||
this.gmtCreate = gmtCreate; |
||||
} |
||||
|
||||
public Date getGmtCreate() |
||||
{ |
||||
return gmtCreate; |
||||
} |
||||
public void setParentId(Long parentId) |
||||
{ |
||||
this.parentId = parentId; |
||||
} |
||||
|
||||
public Long getParentId() |
||||
{ |
||||
return parentId; |
||||
} |
||||
public void setFileId(Long fileId) |
||||
{ |
||||
this.fileId = fileId; |
||||
} |
||||
|
||||
public Long getFileId() |
||||
{ |
||||
return fileId; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
||||
.append("id", getId()) |
||||
.append("name", getName()) |
||||
.append("path", getPath()) |
||||
.append("type", getType()) |
||||
.append("gmtModified", getGmtModified()) |
||||
.append("gmtCreate", getGmtCreate()) |
||||
.append("parentId", getParentId()) |
||||
.append("fileId", getFileId()) |
||||
.toString(); |
||||
} |
||||
} |
@ -0,0 +1,61 @@
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper; |
||||
|
||||
import java.util.List; |
||||
import com.ruoyi.system.domain.BFile; |
||||
|
||||
/** |
||||
* 【请填写功能名称】Mapper接口 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-03-09 |
||||
*/ |
||||
public interface BFileMapper |
||||
{ |
||||
/** |
||||
* 查询【请填写功能名称】 |
||||
* |
||||
* @param id 【请填写功能名称】主键 |
||||
* @return 【请填写功能名称】 |
||||
*/ |
||||
public BFile selectBFileById(Long id); |
||||
|
||||
/** |
||||
* 查询【请填写功能名称】列表 |
||||
* |
||||
* @param bFile 【请填写功能名称】 |
||||
* @return 【请填写功能名称】集合 |
||||
*/ |
||||
public List<BFile> selectBFileList(BFile bFile); |
||||
|
||||
/** |
||||
* 新增【请填写功能名称】 |
||||
* |
||||
* @param bFile 【请填写功能名称】 |
||||
* @return 结果 |
||||
*/ |
||||
public int insertBFile(BFile bFile); |
||||
|
||||
/** |
||||
* 修改【请填写功能名称】 |
||||
* |
||||
* @param bFile 【请填写功能名称】 |
||||
* @return 结果 |
||||
*/ |
||||
public int updateBFile(BFile bFile); |
||||
|
||||
/** |
||||
* 删除【请填写功能名称】 |
||||
* |
||||
* @param id 【请填写功能名称】主键 |
||||
* @return 结果 |
||||
*/ |
||||
public int deleteBFileById(Long id); |
||||
|
||||
/** |
||||
* 批量删除【请填写功能名称】 |
||||
* |
||||
* @param ids 需要删除的数据主键集合 |
||||
* @return 结果 |
||||
*/ |
||||
public int deleteBFileByIds(Long[] ids); |
||||
} |
@ -0,0 +1,61 @@
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper; |
||||
|
||||
import java.util.List; |
||||
import com.ruoyi.system.domain.BVideoAllow; |
||||
|
||||
/** |
||||
* 允许列Mapper接口 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-03-09 |
||||
*/ |
||||
public interface BVideoAllowMapper |
||||
{ |
||||
/** |
||||
* 查询允许列 |
||||
* |
||||
* @param id 允许列主键 |
||||
* @return 允许列 |
||||
*/ |
||||
public BVideoAllow selectBVideoAllowById(Long id); |
||||
|
||||
/** |
||||
* 查询允许列列表 |
||||
* |
||||
* @param bVideoAllow 允许列 |
||||
* @return 允许列集合 |
||||
*/ |
||||
public List<BVideoAllow> selectBVideoAllowList(BVideoAllow bVideoAllow); |
||||
|
||||
/** |
||||
* 新增允许列 |
||||
* |
||||
* @param bVideoAllow 允许列 |
||||
* @return 结果 |
||||
*/ |
||||
public int insertBVideoAllow(BVideoAllow bVideoAllow); |
||||
|
||||
/** |
||||
* 修改允许列 |
||||
* |
||||
* @param bVideoAllow 允许列 |
||||
* @return 结果 |
||||
*/ |
||||
public int updateBVideoAllow(BVideoAllow bVideoAllow); |
||||
|
||||
/** |
||||
* 删除允许列 |
||||
* |
||||
* @param id 允许列主键 |
||||
* @return 结果 |
||||
*/ |
||||
public int deleteBVideoAllowById(Long id); |
||||
|
||||
/** |
||||
* 批量删除允许列 |
||||
* |
||||
* @param ids 需要删除的数据主键集合 |
||||
* @return 结果 |
||||
*/ |
||||
public int deleteBVideoAllowByIds(Long[] ids); |
||||
} |
@ -0,0 +1,61 @@
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper; |
||||
|
||||
import java.util.List; |
||||
import com.ruoyi.system.domain.BVideos; |
||||
|
||||
/** |
||||
* 视频信息Mapper接口 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-03-09 |
||||
*/ |
||||
public interface BVideosMapper |
||||
{ |
||||
/** |
||||
* 查询视频信息 |
||||
* |
||||
* @param id 视频信息主键 |
||||
* @return 视频信息 |
||||
*/ |
||||
public BVideos selectBVideosById(Long id); |
||||
|
||||
/** |
||||
* 查询视频信息列表 |
||||
* |
||||
* @param bVideos 视频信息 |
||||
* @return 视频信息集合 |
||||
*/ |
||||
public List<BVideos> selectBVideosList(BVideos bVideos); |
||||
|
||||
/** |
||||
* 新增视频信息 |
||||
* |
||||
* @param bVideos 视频信息 |
||||
* @return 结果 |
||||
*/ |
||||
public int insertBVideos(BVideos bVideos); |
||||
|
||||
/** |
||||
* 修改视频信息 |
||||
* |
||||
* @param bVideos 视频信息 |
||||
* @return 结果 |
||||
*/ |
||||
public int updateBVideos(BVideos bVideos); |
||||
|
||||
/** |
||||
* 删除视频信息 |
||||
* |
||||
* @param id 视频信息主键 |
||||
* @return 结果 |
||||
*/ |
||||
public int deleteBVideosById(Long id); |
||||
|
||||
/** |
||||
* 批量删除视频信息 |
||||
* |
||||
* @param ids 需要删除的数据主键集合 |
||||
* @return 结果 |
||||
*/ |
||||
public int deleteBVideosByIds(Long[] ids); |
||||
} |
@ -0,0 +1,61 @@
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.service; |
||||
|
||||
import java.util.List; |
||||
import com.ruoyi.system.domain.BFile; |
||||
|
||||
/** |
||||
* 【请填写功能名称】Service接口 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-03-09 |
||||
*/ |
||||
public interface IBFileService |
||||
{ |
||||
/** |
||||
* 查询【请填写功能名称】 |
||||
* |
||||
* @param id 【请填写功能名称】主键 |
||||
* @return 【请填写功能名称】 |
||||
*/ |
||||
public BFile selectBFileById(Long id); |
||||
|
||||
/** |
||||
* 查询【请填写功能名称】列表 |
||||
* |
||||
* @param bFile 【请填写功能名称】 |
||||
* @return 【请填写功能名称】集合 |
||||
*/ |
||||
public List<BFile> selectBFileList(BFile bFile); |
||||
|
||||
/** |
||||
* 新增【请填写功能名称】 |
||||
* |
||||
* @param bFile 【请填写功能名称】 |
||||
* @return 结果 |
||||
*/ |
||||
public int insertBFile(BFile bFile); |
||||
|
||||
/** |
||||
* 修改【请填写功能名称】 |
||||
* |
||||
* @param bFile 【请填写功能名称】 |
||||
* @return 结果 |
||||
*/ |
||||
public int updateBFile(BFile bFile); |
||||
|
||||
/** |
||||
* 批量删除【请填写功能名称】 |
||||
* |
||||
* @param ids 需要删除的【请填写功能名称】主键集合 |
||||
* @return 结果 |
||||
*/ |
||||
public int deleteBFileByIds(Long[] ids); |
||||
|
||||
/** |
||||
* 删除【请填写功能名称】信息 |
||||
* |
||||
* @param id 【请填写功能名称】主键 |
||||
* @return 结果 |
||||
*/ |
||||
public int deleteBFileById(Long id); |
||||
} |
@ -0,0 +1,61 @@
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.service; |
||||
|
||||
import java.util.List; |
||||
import com.ruoyi.system.domain.BVideoAllow; |
||||
|
||||
/** |
||||
* 允许列Service接口 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-03-09 |
||||
*/ |
||||
public interface IBVideoAllowService |
||||
{ |
||||
/** |
||||
* 查询允许列 |
||||
* |
||||
* @param id 允许列主键 |
||||
* @return 允许列 |
||||
*/ |
||||
public BVideoAllow selectBVideoAllowById(Long id); |
||||
|
||||
/** |
||||
* 查询允许列列表 |
||||
* |
||||
* @param bVideoAllow 允许列 |
||||
* @return 允许列集合 |
||||
*/ |
||||
public List<BVideoAllow> selectBVideoAllowList(BVideoAllow bVideoAllow); |
||||
|
||||
/** |
||||
* 新增允许列 |
||||
* |
||||
* @param bVideoAllow 允许列 |
||||
* @return 结果 |
||||
*/ |
||||
public int insertBVideoAllow(BVideoAllow bVideoAllow); |
||||
|
||||
/** |
||||
* 修改允许列 |
||||
* |
||||
* @param bVideoAllow 允许列 |
||||
* @return 结果 |
||||
*/ |
||||
public int updateBVideoAllow(BVideoAllow bVideoAllow); |
||||
|
||||
/** |
||||
* 批量删除允许列 |
||||
* |
||||
* @param ids 需要删除的允许列主键集合 |
||||
* @return 结果 |
||||
*/ |
||||
public int deleteBVideoAllowByIds(Long[] ids); |
||||
|
||||
/** |
||||
* 删除允许列信息 |
||||
* |
||||
* @param id 允许列主键 |
||||
* @return 结果 |
||||
*/ |
||||
public int deleteBVideoAllowById(Long id); |
||||
} |
@ -0,0 +1,61 @@
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.service; |
||||
|
||||
import java.util.List; |
||||
import com.ruoyi.system.domain.BVideos; |
||||
|
||||
/** |
||||
* 视频信息Service接口 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-03-09 |
||||
*/ |
||||
public interface IBVideosService |
||||
{ |
||||
/** |
||||
* 查询视频信息 |
||||
* |
||||
* @param id 视频信息主键 |
||||
* @return 视频信息 |
||||
*/ |
||||
public BVideos selectBVideosById(Long id); |
||||
|
||||
/** |
||||
* 查询视频信息列表 |
||||
* |
||||
* @param bVideos 视频信息 |
||||
* @return 视频信息集合 |
||||
*/ |
||||
public List<BVideos> selectBVideosList(BVideos bVideos); |
||||
|
||||
/** |
||||
* 新增视频信息 |
||||
* |
||||
* @param bVideos 视频信息 |
||||
* @return 结果 |
||||
*/ |
||||
public int insertBVideos(BVideos bVideos); |
||||
|
||||
/** |
||||
* 修改视频信息 |
||||
* |
||||
* @param bVideos 视频信息 |
||||
* @return 结果 |
||||
*/ |
||||
public int updateBVideos(BVideos bVideos); |
||||
|
||||
/** |
||||
* 批量删除视频信息 |
||||
* |
||||
* @param ids 需要删除的视频信息主键集合 |
||||
* @return 结果 |
||||
*/ |
||||
public int deleteBVideosByIds(Long[] ids); |
||||
|
||||
/** |
||||
* 删除视频信息信息 |
||||
* |
||||
* @param id 视频信息主键 |
||||
* @return 结果 |
||||
*/ |
||||
public int deleteBVideosById(Long id); |
||||
} |
@ -0,0 +1,93 @@
@@ -0,0 +1,93 @@
|
||||
package com.ruoyi.system.service.impl; |
||||
|
||||
import java.util.List; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
import com.ruoyi.system.mapper.BFileMapper; |
||||
import com.ruoyi.system.domain.BFile; |
||||
import com.ruoyi.system.service.IBFileService; |
||||
|
||||
/** |
||||
* 【请填写功能名称】Service业务层处理 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-03-09 |
||||
*/ |
||||
@Service |
||||
public class BFileServiceImpl implements IBFileService |
||||
{ |
||||
@Autowired |
||||
private BFileMapper bFileMapper; |
||||
|
||||
/** |
||||
* 查询【请填写功能名称】 |
||||
* |
||||
* @param id 【请填写功能名称】主键 |
||||
* @return 【请填写功能名称】 |
||||
*/ |
||||
@Override |
||||
public BFile selectBFileById(Long id) |
||||
{ |
||||
return bFileMapper.selectBFileById(id); |
||||
} |
||||
|
||||
/** |
||||
* 查询【请填写功能名称】列表 |
||||
* |
||||
* @param bFile 【请填写功能名称】 |
||||
* @return 【请填写功能名称】 |
||||
*/ |
||||
@Override |
||||
public List<BFile> selectBFileList(BFile bFile) |
||||
{ |
||||
return bFileMapper.selectBFileList(bFile); |
||||
} |
||||
|
||||
/** |
||||
* 新增【请填写功能名称】 |
||||
* |
||||
* @param bFile 【请填写功能名称】 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int insertBFile(BFile bFile) |
||||
{ |
||||
return bFileMapper.insertBFile(bFile); |
||||
} |
||||
|
||||
/** |
||||
* 修改【请填写功能名称】 |
||||
* |
||||
* @param bFile 【请填写功能名称】 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int updateBFile(BFile bFile) |
||||
{ |
||||
return bFileMapper.updateBFile(bFile); |
||||
} |
||||
|
||||
/** |
||||
* 批量删除【请填写功能名称】 |
||||
* |
||||
* @param ids 需要删除的【请填写功能名称】主键 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int deleteBFileByIds(Long[] ids) |
||||
{ |
||||
return bFileMapper.deleteBFileByIds(ids); |
||||
} |
||||
|
||||
/** |
||||
* 删除【请填写功能名称】信息 |
||||
* |
||||
* @param id 【请填写功能名称】主键 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int deleteBFileById(Long id) |
||||
{ |
||||
return bFileMapper.deleteBFileById(id); |
||||
} |
||||
} |
@ -0,0 +1,93 @@
@@ -0,0 +1,93 @@
|
||||
package com.ruoyi.system.service.impl; |
||||
|
||||
import java.util.List; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
import com.ruoyi.system.mapper.BVideoAllowMapper; |
||||
import com.ruoyi.system.domain.BVideoAllow; |
||||
import com.ruoyi.system.service.IBVideoAllowService; |
||||
|
||||
/** |
||||
* 允许列Service业务层处理 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-03-09 |
||||
*/ |
||||
@Service |
||||
public class BVideoAllowServiceImpl implements IBVideoAllowService |
||||
{ |
||||
@Autowired |
||||
private BVideoAllowMapper bVideoAllowMapper; |
||||
|
||||
/** |
||||
* 查询允许列 |
||||
* |
||||
* @param id 允许列主键 |
||||
* @return 允许列 |
||||
*/ |
||||
@Override |
||||
public BVideoAllow selectBVideoAllowById(Long id) |
||||
{ |
||||
return bVideoAllowMapper.selectBVideoAllowById(id); |
||||
} |
||||
|
||||
/** |
||||
* 查询允许列列表 |
||||
* |
||||
* @param bVideoAllow 允许列 |
||||
* @return 允许列 |
||||
*/ |
||||
@Override |
||||
public List<BVideoAllow> selectBVideoAllowList(BVideoAllow bVideoAllow) |
||||
{ |
||||
return bVideoAllowMapper.selectBVideoAllowList(bVideoAllow); |
||||
} |
||||
|
||||
/** |
||||
* 新增允许列 |
||||
* |
||||
* @param bVideoAllow 允许列 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int insertBVideoAllow(BVideoAllow bVideoAllow) |
||||
{ |
||||
return bVideoAllowMapper.insertBVideoAllow(bVideoAllow); |
||||
} |
||||
|
||||
/** |
||||
* 修改允许列 |
||||
* |
||||
* @param bVideoAllow 允许列 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int updateBVideoAllow(BVideoAllow bVideoAllow) |
||||
{ |
||||
return bVideoAllowMapper.updateBVideoAllow(bVideoAllow); |
||||
} |
||||
|
||||
/** |
||||
* 批量删除允许列 |
||||
* |
||||
* @param ids 需要删除的允许列主键 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int deleteBVideoAllowByIds(Long[] ids) |
||||
{ |
||||
return bVideoAllowMapper.deleteBVideoAllowByIds(ids); |
||||
} |
||||
|
||||
/** |
||||
* 删除允许列信息 |
||||
* |
||||
* @param id 允许列主键 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int deleteBVideoAllowById(Long id) |
||||
{ |
||||
return bVideoAllowMapper.deleteBVideoAllowById(id); |
||||
} |
||||
} |
@ -0,0 +1,93 @@
@@ -0,0 +1,93 @@
|
||||
package com.ruoyi.system.service.impl; |
||||
|
||||
import java.util.List; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
import com.ruoyi.system.mapper.BVideosMapper; |
||||
import com.ruoyi.system.domain.BVideos; |
||||
import com.ruoyi.system.service.IBVideosService; |
||||
|
||||
/** |
||||
* 视频信息Service业务层处理 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-03-09 |
||||
*/ |
||||
@Service |
||||
public class BVideosServiceImpl implements IBVideosService |
||||
{ |
||||
@Autowired |
||||
private BVideosMapper bVideosMapper; |
||||
|
||||
/** |
||||
* 查询视频信息 |
||||
* |
||||
* @param id 视频信息主键 |
||||
* @return 视频信息 |
||||
*/ |
||||
@Override |
||||
public BVideos selectBVideosById(Long id) |
||||
{ |
||||
return bVideosMapper.selectBVideosById(id); |
||||
} |
||||
|
||||
/** |
||||
* 查询视频信息列表 |
||||
* |
||||
* @param bVideos 视频信息 |
||||
* @return 视频信息 |
||||
*/ |
||||
@Override |
||||
public List<BVideos> selectBVideosList(BVideos bVideos) |
||||
{ |
||||
return bVideosMapper.selectBVideosList(bVideos); |
||||
} |
||||
|
||||
/** |
||||
* 新增视频信息 |
||||
* |
||||
* @param bVideos 视频信息 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int insertBVideos(BVideos bVideos) |
||||
{ |
||||
return bVideosMapper.insertBVideos(bVideos); |
||||
} |
||||
|
||||
/** |
||||
* 修改视频信息 |
||||
* |
||||
* @param bVideos 视频信息 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int updateBVideos(BVideos bVideos) |
||||
{ |
||||
return bVideosMapper.updateBVideos(bVideos); |
||||
} |
||||
|
||||
/** |
||||
* 批量删除视频信息 |
||||
* |
||||
* @param ids 需要删除的视频信息主键 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int deleteBVideosByIds(Long[] ids) |
||||
{ |
||||
return bVideosMapper.deleteBVideosByIds(ids); |
||||
} |
||||
|
||||
/** |
||||
* 删除视频信息信息 |
||||
* |
||||
* @param id 视频信息主键 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int deleteBVideosById(Long id) |
||||
{ |
||||
return bVideosMapper.deleteBVideosById(id); |
||||
} |
||||
} |
@ -0,0 +1,66 @@
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper |
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.ruoyi.system.mapper.BFileMapper"> |
||||
|
||||
<resultMap type="BFile" id="BFileResult"> |
||||
<result property="id" column="id" /> |
||||
<result property="uuid" column="uuid" /> |
||||
<result property="memo" column="memo" /> |
||||
<result property="gmtCreate" column="gmt_create" /> |
||||
</resultMap> |
||||
|
||||
<sql id="selectBFileVo"> |
||||
select id, uuid, memo, gmt_create 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="memo != null and memo != ''"> and memo = #{memo}</if> |
||||
<if test="gmtCreate != null "> and gmt_create = #{gmtCreate}</if> |
||||
</where> |
||||
</select> |
||||
|
||||
<select id="selectBFileById" parameterType="Long" resultMap="BFileResult"> |
||||
<include refid="selectBFileVo"/> |
||||
where id = #{id} |
||||
</select> |
||||
|
||||
<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="memo != null">memo,</if> |
||||
<if test="gmtCreate != null">gmt_create,</if> |
||||
</trim> |
||||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
<if test="uuid != null">#{uuid},</if> |
||||
<if test="memo != null">#{memo},</if> |
||||
<if test="gmtCreate != null">#{gmtCreate},</if> |
||||
</trim> |
||||
</insert> |
||||
|
||||
<update id="updateBFile" parameterType="BFile"> |
||||
update b_file |
||||
<trim prefix="SET" suffixOverrides=","> |
||||
<if test="uuid != null">uuid = #{uuid},</if> |
||||
<if test="memo != null">memo = #{memo},</if> |
||||
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if> |
||||
</trim> |
||||
where id = #{id} |
||||
</update> |
||||
|
||||
<delete id="deleteBFileById" parameterType="Long"> |
||||
delete from b_file where id = #{id} |
||||
</delete> |
||||
|
||||
<delete id="deleteBFileByIds" parameterType="String"> |
||||
delete from b_file where id in |
||||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
||||
#{id} |
||||
</foreach> |
||||
</delete> |
||||
</mapper> |
@ -0,0 +1,76 @@
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper |
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.ruoyi.system.mapper.BVideoAllowMapper"> |
||||
|
||||
<resultMap type="BVideoAllow" id="BVideoAllowResult"> |
||||
<result property="id" column="id" /> |
||||
<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="videoId" column="video_id" /> |
||||
</resultMap> |
||||
|
||||
<sql id="selectBVideoAllowVo"> |
||||
select id, allow_id, wx_openid, wx_nickname, gmt_create, video_id from b_video_allow |
||||
</sql> |
||||
|
||||
<select id="selectBVideoAllowList" parameterType="BVideoAllow" resultMap="BVideoAllowResult"> |
||||
<include refid="selectBVideoAllowVo"/> |
||||
<where> |
||||
<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="videoId != null "> and video_id = #{videoId}</if> |
||||
</where> |
||||
</select> |
||||
|
||||
<select id="selectBVideoAllowById" parameterType="Long" resultMap="BVideoAllowResult"> |
||||
<include refid="selectBVideoAllowVo"/> |
||||
where id = #{id} |
||||
</select> |
||||
|
||||
<insert id="insertBVideoAllow" parameterType="BVideoAllow" useGeneratedKeys="true" keyProperty="id"> |
||||
insert into b_video_allow |
||||
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
<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="videoId != null">video_id,</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="videoId != null">#{videoId},</if> |
||||
</trim> |
||||
</insert> |
||||
|
||||
<update id="updateBVideoAllow" parameterType="BVideoAllow"> |
||||
update b_video_allow |
||||
<trim prefix="SET" suffixOverrides=","> |
||||
<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="videoId != null">video_id = #{videoId},</if> |
||||
</trim> |
||||
where id = #{id} |
||||
</update> |
||||
|
||||
<delete id="deleteBVideoAllowById" parameterType="Long"> |
||||
delete from b_video_allow where id = #{id} |
||||
</delete> |
||||
|
||||
<delete id="deleteBVideoAllowByIds" parameterType="String"> |
||||
delete from b_video_allow where id in |
||||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
||||
#{id} |
||||
</foreach> |
||||
</delete> |
||||
</mapper> |
@ -0,0 +1,86 @@
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper |
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.ruoyi.system.mapper.BVideosMapper"> |
||||
|
||||
<resultMap type="BVideos" id="BVideosResult"> |
||||
<result property="id" column="id" /> |
||||
<result property="name" column="name" /> |
||||
<result property="path" column="path" /> |
||||
<result property="type" column="type" /> |
||||
<result property="gmtModified" column="gmt_modified" /> |
||||
<result property="gmtCreate" column="gmt_create" /> |
||||
<result property="parentId" column="parent_id" /> |
||||
<result property="fileId" column="file_id" /> |
||||
</resultMap> |
||||
|
||||
<sql id="selectBVideosVo"> |
||||
select id, name, path, type, gmt_modified, gmt_create, parent_id, file_id from b_videos |
||||
</sql> |
||||
|
||||
<select id="selectBVideosList" parameterType="BVideos" resultMap="BVideosResult"> |
||||
<include refid="selectBVideosVo"/> |
||||
<where> |
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> |
||||
<if test="path != null and path != ''"> and path = #{path}</if> |
||||
<if test="type != null "> and type = #{type}</if> |
||||
<if test="gmtModified != null "> and gmt_modified = #{gmtModified}</if> |
||||
<if test="gmtCreate != null "> and gmt_create = #{gmtCreate}</if> |
||||
<if test="parentId != null "> and parent_id = #{parentId}</if> |
||||
<if test="fileId != null "> and file_id = #{fileId}</if> |
||||
</where> |
||||
</select> |
||||
|
||||
<select id="selectBVideosById" parameterType="Long" resultMap="BVideosResult"> |
||||
<include refid="selectBVideosVo"/> |
||||
where id = #{id} |
||||
</select> |
||||
|
||||
<insert id="insertBVideos" parameterType="BVideos" useGeneratedKeys="true" keyProperty="id"> |
||||
insert into b_videos |
||||
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
<if test="name != null">name,</if> |
||||
<if test="path != null">path,</if> |
||||
<if test="type != null">type,</if> |
||||
<if test="gmtModified != null">gmt_modified,</if> |
||||
<if test="gmtCreate != null">gmt_create,</if> |
||||
<if test="parentId != null">parent_id,</if> |
||||
<if test="fileId != null">file_id,</if> |
||||
</trim> |
||||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
<if test="name != null">#{name},</if> |
||||
<if test="path != null">#{path},</if> |
||||
<if test="type != null">#{type},</if> |
||||
<if test="gmtModified != null">#{gmtModified},</if> |
||||
<if test="gmtCreate != null">#{gmtCreate},</if> |
||||
<if test="parentId != null">#{parentId},</if> |
||||
<if test="fileId != null">#{fileId},</if> |
||||
</trim> |
||||
</insert> |
||||
|
||||
<update id="updateBVideos" parameterType="BVideos"> |
||||
update b_videos |
||||
<trim prefix="SET" suffixOverrides=","> |
||||
<if test="name != null">name = #{name},</if> |
||||
<if test="path != null">path = #{path},</if> |
||||
<if test="type != null">type = #{type},</if> |
||||
<if test="gmtModified != null">gmt_modified = #{gmtModified},</if> |
||||
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if> |
||||
<if test="parentId != null">parent_id = #{parentId},</if> |
||||
<if test="fileId != null">file_id = #{fileId},</if> |
||||
</trim> |
||||
where id = #{id} |
||||
</update> |
||||
|
||||
<delete id="deleteBVideosById" parameterType="Long"> |
||||
delete from b_videos where id = #{id} |
||||
</delete> |
||||
|
||||
<delete id="deleteBVideosByIds" parameterType="String"> |
||||
delete from b_videos where id in |
||||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
||||
#{id} |
||||
</foreach> |
||||
</delete> |
||||
</mapper> |
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
// 查询允许列列表
|
||||
export function listAllow(query) { |
||||
return request({ |
||||
url: '/system/allow/list', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 查询允许列详细
|
||||
export function getAllow(id) { |
||||
return request({ |
||||
url: '/system/allow/' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
// 新增允许列
|
||||
export function addAllow(data) { |
||||
return request({ |
||||
url: '/system/allow', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 修改允许列
|
||||
export function updateAllow(data) { |
||||
return request({ |
||||
url: '/system/allow', |
||||
method: 'put', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 删除允许列
|
||||
export function delAllow(id) { |
||||
return request({ |
||||
url: '/system/allow/' + id, |
||||
method: 'delete' |
||||
}) |
||||
} |
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
// 查询【请填写功能名称】列表
|
||||
export function listFile(query) { |
||||
return request({ |
||||
url: '/system/file/list', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 查询【请填写功能名称】详细
|
||||
export function getFile(id) { |
||||
return request({ |
||||
url: '/system/file/' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
// 新增【请填写功能名称】
|
||||
export function addFile(data) { |
||||
return request({ |
||||
url: '/system/file', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 修改【请填写功能名称】
|
||||
export function updateFile(data) { |
||||
return request({ |
||||
url: '/system/file', |
||||
method: 'put', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 删除【请填写功能名称】
|
||||
export function delFile(id) { |
||||
return request({ |
||||
url: '/system/file/' + id, |
||||
method: 'delete' |
||||
}) |
||||
} |
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
// 查询视频信息列表
|
||||
export function listVideos(query) { |
||||
return request({ |
||||
url: '/system/videos/list', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
// 查询视频信息详细
|
||||
export function getVideos(id) { |
||||
return request({ |
||||
url: '/system/videos/' + id, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
// 新增视频信息
|
||||
export function addVideos(data) { |
||||
return request({ |
||||
url: '/system/videos', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 修改视频信息
|
||||
export function updateVideos(data) { |
||||
return request({ |
||||
url: '/system/videos', |
||||
method: 'put', |
||||
data: data |
||||
}) |
||||
} |
||||
|
||||
// 删除视频信息
|
||||
export function delVideos(id) { |
||||
return request({ |
||||
url: '/system/videos/' + id, |
||||
method: 'delete' |
||||
}) |
||||
} |
@ -0,0 +1,310 @@
@@ -0,0 +1,310 @@
|
||||
<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-input |
||||
v-model="queryParams.videoId" |
||||
placeholder="请输入${comment}" |
||||
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> |
||||
</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:allow: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:allow:edit']" |
||||
>修改</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:allow: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:allow:export']" |
||||
>导出</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"> |
||||
<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 |
||||
size="mini" |
||||
type="text" |
||||
icon="el-icon-edit" |
||||
@click="handleUpdate(scope.row)" |
||||
v-hasPermi="['system:allow:edit']" |
||||
>修改</el-button> |
||||
<el-button |
||||
size="mini" |
||||
type="text" |
||||
icon="el-icon-delete" |
||||
@click="handleDelete(scope.row)" |
||||
v-hasPermi="['system:allow: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" :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> |
||||
</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> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { listAllow, getAllow, delAllow, addAllow, updateAllow } from "@/api/system/allow"; |
||||
|
||||
export default { |
||||
name: "Allow", |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 选中数组 |
||||
ids: [], |
||||
// 非单个禁用 |
||||
single: true, |
||||
// 非多个禁用 |
||||
multiple: true, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 允许列表格数据 |
||||
allowList: [], |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNum: 1, |
||||
pageSize: 10, |
||||
allowId: null, |
||||
wxOpenid: null, |
||||
wxNickname: null, |
||||
gmtCreate: null, |
||||
videoId: null |
||||
}, |
||||
// 表单参数 |
||||
form: {}, |
||||
// 表单校验 |
||||
rules: { |
||||
} |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询允许列列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
listAllow(this.queryParams).then(response => { |
||||
this.allowList = response.rows; |
||||
this.total = response.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
// 取消按钮 |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
// 表单重置 |
||||
reset() { |
||||
this.form = { |
||||
id: null, |
||||
allowId: null, |
||||
wxOpenid: null, |
||||
wxNickname: null, |
||||
gmtCreate: null, |
||||
videoId: null |
||||
}; |
||||
this.resetForm("form"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNum = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
// 多选框选中数据 |
||||
handleSelectionChange(selection) { |
||||
this.ids = selection.map(item => item.id) |
||||
this.single = selection.length!==1 |
||||
this.multiple = !selection.length |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.reset(); |
||||
this.open = true; |
||||
this.title = "添加允许列"; |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
handleUpdate(row) { |
||||
this.reset(); |
||||
const id = row.id || this.ids |
||||
getAllow(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) { |
||||
updateAllow(this.form).then(response => { |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
} else { |
||||
addAllow(this.form).then(response => { |
||||
this.$modal.msgSuccess("新增成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
handleDelete(row) { |
||||
const ids = row.id || this.ids; |
||||
this.$modal.confirm('是否确认删除允许列编号为"' + ids + '"的数据项?').then(function() { |
||||
return delAllow(ids); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess("删除成功"); |
||||
}).catch(() => {}); |
||||
}, |
||||
/** 导出按钮操作 */ |
||||
handleExport() { |
||||
this.download('system/allow/export', { |
||||
...this.queryParams |
||||
}, `allow_${new Date().getTime()}.xlsx`) |
||||
} |
||||
} |
||||
}; |
||||
</script> |
@ -0,0 +1,282 @@
@@ -0,0 +1,282 @@
|
||||
<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-input |
||||
v-model="queryParams.memo" |
||||
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> |
||||
<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="success" |
||||
plain |
||||
icon="el-icon-edit" |
||||
size="mini" |
||||
:disabled="single" |
||||
@click="handleUpdate" |
||||
v-hasPermi="['system:file:edit']" |
||||
>修改</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="${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"> |
||||
<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" :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> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
<el-button @click="cancel">取 消</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { listFile, getFile, delFile, addFile, updateFile } from "@/api/system/file"; |
||||
|
||||
export default { |
||||
name: "File", |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 选中数组 |
||||
ids: [], |
||||
// 非单个禁用 |
||||
single: true, |
||||
// 非多个禁用 |
||||
multiple: true, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 【请填写功能名称】表格数据 |
||||
fileList: [], |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNum: 1, |
||||
pageSize: 10, |
||||
uuid: null, |
||||
memo: null, |
||||
gmtCreate: null |
||||
}, |
||||
// 表单参数 |
||||
form: {}, |
||||
// 表单校验 |
||||
rules: { |
||||
} |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询【请填写功能名称】列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
listFile(this.queryParams).then(response => { |
||||
this.fileList = response.rows; |
||||
this.total = response.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
// 取消按钮 |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
// 表单重置 |
||||
reset() { |
||||
this.form = { |
||||
id: null, |
||||
uuid: null, |
||||
memo: null, |
||||
gmtCreate: null |
||||
}; |
||||
this.resetForm("form"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNum = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
// 多选框选中数据 |
||||
handleSelectionChange(selection) { |
||||
this.ids = selection.map(item => item.id) |
||||
this.single = selection.length!==1 |
||||
this.multiple = !selection.length |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.reset(); |
||||
this.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(); |
||||
}); |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
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`) |
||||
} |
||||
} |
||||
}; |
||||
</script> |
@ -0,0 +1,279 @@
@@ -0,0 +1,279 @@
|
||||
<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="目录名称" prop="name"> |
||||
<el-input |
||||
v-model="queryParams.name" |
||||
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> |
||||
</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: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" |
||||
plain |
||||
icon="el-icon-delete" |
||||
size="mini" |
||||
:disabled="multiple" |
||||
@click="handleDelete" |
||||
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="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: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" |
||||
icon="el-icon-delete" |
||||
@click="handleDelete(scope.row)" |
||||
v-hasPermi="['system:videos: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" :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> |
||||
</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> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { listVideos, getVideos, delVideos, addVideos, updateVideos } from "@/api/system/videos"; |
||||
|
||||
export default { |
||||
name: "ManageFile", |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 选中数组 |
||||
ids: [], |
||||
// 非单个禁用 |
||||
single: true, |
||||
// 非多个禁用 |
||||
multiple: true, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 视频信息表格数据 |
||||
videosList: [], |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNum: 1, |
||||
pageSize: 10, |
||||
name: null, |
||||
path: null, |
||||
type: null, |
||||
gmtModified: null, |
||||
gmtCreate: null, |
||||
parentId: null, |
||||
fileId: null |
||||
}, |
||||
// 表单参数 |
||||
form: {}, |
||||
// 表单校验 |
||||
rules: { |
||||
} |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
console.log(this.$route.params) |
||||
}, |
||||
methods: { |
||||
/** 查询视频信息列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
listVideos(this.queryParams).then(response => { |
||||
this.videosList = response.rows; |
||||
this.total = response.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
// 取消按钮 |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
// 表单重置 |
||||
reset() { |
||||
this.form = { |
||||
id: null, |
||||
name: null, |
||||
path: null, |
||||
type: null, |
||||
gmtModified: null, |
||||
gmtCreate: null, |
||||
parentId: null, |
||||
fileId: null |
||||
}; |
||||
this.resetForm("form"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNum = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
// 多选框选中数据 |
||||
handleSelectionChange(selection) { |
||||
this.ids = selection.map(item => item.id) |
||||
this.single = selection.length!==1 |
||||
this.multiple = !selection.length |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.reset(); |
||||
this.open = true; |
||||
this.title = "添加视频信息"; |
||||
this.form.type=1 |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
handleUpdate(row) { |
||||
this.reset(); |
||||
const id = row.id || this.ids |
||||
getVideos(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) { |
||||
updateVideos(this.form).then(response => { |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
} else { |
||||
addVideos(this.form).then(response => { |
||||
this.$modal.msgSuccess("新增成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
handleDelete(row) { |
||||
const ids = row.id || this.ids; |
||||
this.$modal.confirm('是否确认删除视频信息编号为"' + ids + '"的数据项?').then(function() { |
||||
return delVideos(ids); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess("删除成功"); |
||||
}).catch(() => {}); |
||||
}, |
||||
/** 管理文件 */ |
||||
handleFiles(row) { |
||||
|
||||
this.$tab.openPage("管理"+row.id+"的文件", "/system/allow"); |
||||
}, |
||||
/** 导出按钮操作 */ |
||||
handleExport() { |
||||
this.download('system/videos/export', { |
||||
...this.queryParams |
||||
}, `videos_${new Date().getTime()}.xlsx`) |
||||
} |
||||
} |
||||
}; |
||||
</script> |
@ -0,0 +1,343 @@
@@ -0,0 +1,343 @@
|
||||
<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-input |
||||
v-model="queryParams.memo" |
||||
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> |
||||
</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>仅允许导入xls、xlsx格式文件。</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="submitFileForm">确 定</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 { 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" |
||||
}, |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 选中数组 |
||||
ids: [], |
||||
// 非单个禁用 |
||||
single: true, |
||||
// 非多个禁用 |
||||
multiple: true, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 【请填写功能名称】表格数据 |
||||
fileList: [], |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNum: 1, |
||||
pageSize: 10, |
||||
uuid: null, |
||||
memo: null, |
||||
gmtCreate: null |
||||
}, |
||||
// 表单参数 |
||||
form: {}, |
||||
// 表单校验 |
||||
rules: { |
||||
|
||||
} |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询【请填写功能名称】列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
listFile(this.queryParams).then(response => { |
||||
this.fileList = response.rows; |
||||
this.total = response.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
onOpen(){ |
||||
return false |
||||
}, |
||||
// 取消按钮 |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
// 表单重置 |
||||
reset() { |
||||
this.formData = { |
||||
field101: null, |
||||
field102: undefined, |
||||
} |
||||
this.resetForm("form"); |
||||
this.resetForm("elForm"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNum = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
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(); |
||||
}); |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
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`) |
||||
} |
||||
} |
||||
}; |
||||
</script> |
@ -0,0 +1,336 @@
@@ -0,0 +1,336 @@
|
||||
<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-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" |
||||
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> |
||||
</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: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" |
||||
plain |
||||
icon="el-icon-delete" |
||||
size="mini" |
||||
:disabled="multiple" |
||||
@click="handleDelete" |
||||
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="${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="文件类型: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"> |
||||
<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 |
||||
size="mini" |
||||
type="text" |
||||
icon="el-icon-edit" |
||||
@click="handleUpdate(scope.row)" |
||||
v-hasPermi="['system:videos:edit']" |
||||
>修改</el-button> |
||||
<el-button |
||||
size="mini" |
||||
type="text" |
||||
icon="el-icon-delete" |
||||
@click="handleDelete(scope.row)" |
||||
v-hasPermi="['system:videos: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" :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> |
||||
</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> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { listVideos, getVideos, delVideos, addVideos, updateVideos } from "@/api/system/videos"; |
||||
|
||||
export default { |
||||
name: "Videos", |
||||
data() { |
||||
return { |
||||
// 遮罩层 |
||||
loading: true, |
||||
// 选中数组 |
||||
ids: [], |
||||
// 非单个禁用 |
||||
single: true, |
||||
// 非多个禁用 |
||||
multiple: true, |
||||
// 显示搜索条件 |
||||
showSearch: true, |
||||
// 总条数 |
||||
total: 0, |
||||
// 视频信息表格数据 |
||||
videosList: [], |
||||
// 弹出层标题 |
||||
title: "", |
||||
// 是否显示弹出层 |
||||
open: false, |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNum: 1, |
||||
pageSize: 10, |
||||
name: null, |
||||
path: null, |
||||
type: null, |
||||
gmtModified: null, |
||||
gmtCreate: null, |
||||
parentId: null, |
||||
fileId: null |
||||
}, |
||||
// 表单参数 |
||||
form: {}, |
||||
// 表单校验 |
||||
rules: { |
||||
} |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询视频信息列表 */ |
||||
getList() { |
||||
this.loading = true; |
||||
listVideos(this.queryParams).then(response => { |
||||
this.videosList = response.rows; |
||||
this.total = response.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
// 取消按钮 |
||||
cancel() { |
||||
this.open = false; |
||||
this.reset(); |
||||
}, |
||||
// 表单重置 |
||||
reset() { |
||||
this.form = { |
||||
id: null, |
||||
name: null, |
||||
path: null, |
||||
type: null, |
||||
gmtModified: null, |
||||
gmtCreate: null, |
||||
parentId: null, |
||||
fileId: null |
||||
}; |
||||
this.resetForm("form"); |
||||
}, |
||||
/** 搜索按钮操作 */ |
||||
handleQuery() { |
||||
this.queryParams.pageNum = 1; |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery() { |
||||
this.resetForm("queryForm"); |
||||
this.handleQuery(); |
||||
}, |
||||
// 多选框选中数据 |
||||
handleSelectionChange(selection) { |
||||
this.ids = selection.map(item => item.id) |
||||
this.single = selection.length!==1 |
||||
this.multiple = !selection.length |
||||
}, |
||||
/** 新增按钮操作 */ |
||||
handleAdd() { |
||||
this.reset(); |
||||
this.open = true; |
||||
this.title = "添加视频信息"; |
||||
}, |
||||
/** 修改按钮操作 */ |
||||
handleUpdate(row) { |
||||
this.reset(); |
||||
const id = row.id || this.ids |
||||
getVideos(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) { |
||||
updateVideos(this.form).then(response => { |
||||
this.$modal.msgSuccess("修改成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
} else { |
||||
addVideos(this.form).then(response => { |
||||
this.$modal.msgSuccess("新增成功"); |
||||
this.open = false; |
||||
this.getList(); |
||||
}); |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
/** 删除按钮操作 */ |
||||
handleDelete(row) { |
||||
const ids = row.id || this.ids; |
||||
this.$modal.confirm('是否确认删除视频信息编号为"' + ids + '"的数据项?').then(function() { |
||||
return delVideos(ids); |
||||
}).then(() => { |
||||
this.getList(); |
||||
this.$modal.msgSuccess("删除成功"); |
||||
}).catch(() => {}); |
||||
}, |
||||
/** 导出按钮操作 */ |
||||
handleExport() { |
||||
this.download('system/videos/export', { |
||||
...this.queryParams |
||||
}, `videos_${new Date().getTime()}.xlsx`) |
||||
} |
||||
} |
||||
}; |
||||
</script> |
Loading…
Reference in new issue