[feat]合并商城、管理和vlog
This commit is contained in:
parent
90b3286aeb
commit
4957cd8023
1
pom.xml
1
pom.xml
@ -372,6 +372,7 @@
|
||||
<module>ruoyi-common</module>
|
||||
<module>ruoyi-extend</module>
|
||||
<module>ruoyi-modules</module>
|
||||
<module>ruoyi-front</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
@ -138,7 +138,7 @@ mybatis-plus:
|
||||
# 对应的 XML 文件位置
|
||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||
# 实体扫描,多个package用逗号或者分号分隔
|
||||
typeAliasesPackage: org.dromara.**.domain
|
||||
typeAliasesPackage: org.dromara.**.domain,com.wzj.soopin.**
|
||||
global-config:
|
||||
dbConfig:
|
||||
# 主键类型
|
||||
|
18
ruoyi-front/pom.xml
Normal file
18
ruoyi-front/pom.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?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-vue-plus</artifactId>
|
||||
<groupId>org.dromara</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>ruoyi-front</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>ruoyi-consumer</module>
|
||||
<module>ruoyi-manager</module>
|
||||
</modules>
|
||||
</project>
|
103
ruoyi-front/ruoyi-consumer/pom.xml
Normal file
103
ruoyi-front/ruoyi-consumer/pom.xml
Normal file
@ -0,0 +1,103 @@
|
||||
<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/maven-v4_0_0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-front</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-consumer</artifactId>
|
||||
|
||||
<description>
|
||||
system系统模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-doc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-translation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- OSS功能模块 -->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-oss</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- excel-->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SMS功能模块 -->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-sms</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-tenant</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-idempotent</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-sensitive</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-encrypt</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-sse</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
@ -0,0 +1,117 @@
|
||||
package com.wzj.soopin.consumer.content.config;
|
||||
|
||||
import com.imooc.intercepter.PassportInterceptor;
|
||||
import com.imooc.intercepter.UserTokenInterceptor;
|
||||
import org.apache.http.conn.ssl.NoopHostnameVerifier;
|
||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
import org.apache.http.ssl.SSLContexts;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Configuration
|
||||
public class InterceptorConfig implements WebMvcConfigurer {
|
||||
|
||||
private String[] CORS_HTTP_METHODS = { HttpMethod.HEAD.name(), HttpMethod.GET.name(), HttpMethod.POST.name(),
|
||||
HttpMethod.PUT.name(), HttpMethod.DELETE.name(), HttpMethod.OPTIONS.name(), HttpMethod.PATCH.name() };
|
||||
|
||||
private static final long CORS_MAX_AGE = 30 * 24 * 60 * 60;
|
||||
|
||||
@Bean
|
||||
public PassportInterceptor passportInterceptor() {
|
||||
return new PassportInterceptor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public UserTokenInterceptor userTokenInterceptor() {
|
||||
return new UserTokenInterceptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(passportInterceptor()).addPathPatterns("/passport/getSMSCode");
|
||||
|
||||
registry.addInterceptor(userTokenInterceptor()).addPathPatterns("/userInfo/modifyUserInfo")
|
||||
.addPathPatterns("/userInfo/modifyImage");
|
||||
}
|
||||
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
// 添加跨域配置信息
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
// 设置访问源地址
|
||||
config.addAllowedOriginPattern("*");
|
||||
// 设置访问源请求头
|
||||
config.addAllowedHeader("*");
|
||||
// 设置是否发送Cookie信息
|
||||
config.setAllowCredentials(true);
|
||||
// 设置访问源请求方法
|
||||
Arrays.stream(CORS_HTTP_METHODS).forEach(method -> config.addAllowedMethod(method));
|
||||
// 设置请求最大有效时长
|
||||
config.setMaxAge(CORS_MAX_AGE);
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
// 配置跨域
|
||||
source.registerCorsConfiguration("/**", config);
|
||||
return new CorsFilter(source);
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public RestTemplate restTemplate() {
|
||||
PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager();
|
||||
// 连接池最大连接数
|
||||
connManager.setMaxTotal(1000);
|
||||
// 每个主机的并发
|
||||
connManager.setDefaultMaxPerRoute(500);
|
||||
|
||||
CloseableHttpClient httpClient = HttpClients.custom()//
|
||||
.setConnectionManager(connManager)// 设置HTTP连接管理器
|
||||
.build();
|
||||
return buildRestTemplate(httpClient);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RestTemplate restTemplateIgnoreSSL()
|
||||
throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException {
|
||||
SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, (chain, authType) -> true).build();
|
||||
SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(sslContext,
|
||||
NoopHostnameVerifier.INSTANCE);
|
||||
|
||||
CloseableHttpClient httpClient = HttpClients.custom()//
|
||||
.setSSLSocketFactory(sslSocketFactory)//
|
||||
.build();
|
||||
return buildRestTemplate(httpClient);
|
||||
}
|
||||
|
||||
private RestTemplate buildRestTemplate(CloseableHttpClient httpClient) {
|
||||
HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory(
|
||||
httpClient);
|
||||
// 获取链接超时时间
|
||||
httpRequestFactory.setConnectionRequestTimeout(3000);
|
||||
// 指客户端和服务器建立连接的timeout
|
||||
httpRequestFactory.setConnectTimeout(3000);
|
||||
// 读取数据的超时时间
|
||||
httpRequestFactory.setReadTimeout(120000);
|
||||
return new RestTemplate(httpRequestFactory);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.wzj.soopin.consumer.content.config;
|
||||
|
||||
import com.imooc.utils.MinIOUtils;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@Data
|
||||
public class MinIOConfig {
|
||||
|
||||
@Value("${minio.endpoint}")
|
||||
private String endpoint;
|
||||
@Value("${minio.fileHost}")
|
||||
private String fileHost;
|
||||
@Value("${minio.bucketName}")
|
||||
private String bucketName;
|
||||
@Value("${minio.accessKey}")
|
||||
private String accessKey;
|
||||
@Value("${minio.secretKey}")
|
||||
private String secretKey;
|
||||
|
||||
@Value("${minio.imgSize}")
|
||||
private Integer imgSize;
|
||||
@Value("${minio.fileSize}")
|
||||
private Integer fileSize;
|
||||
|
||||
@Bean
|
||||
public MinIOUtils creatMinioClient() {
|
||||
return new MinIOUtils(endpoint, bucketName, accessKey, secretKey, imgSize, fileSize);
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.wzj.soopin.consumer.content.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.redisson.spring.data.connection.RedissonConnectionFactory;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@ConditionalOnClass(RedissonClient.class)
|
||||
public class RedisConfig {
|
||||
|
||||
private static final RedisSerializer<String> STRING_SERIALIZER = new StringRedisSerializer();
|
||||
|
||||
@Bean
|
||||
RedissonConnectionFactory redisConnectionFactory(RedissonClient redisson) {
|
||||
log.info("------------->>>配置自定义RedissonConnectionFactory");
|
||||
return new RedissonConnectionFactory(redisson);
|
||||
}
|
||||
|
||||
@Bean
|
||||
RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
||||
log.info("------------->>>配置自定义RedisTemplate");
|
||||
return buildRedisTemplate(redisConnectionFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置redisTemplate
|
||||
*
|
||||
* @param redisConnectionFactory
|
||||
* @param enableTransactionSupport
|
||||
* @return
|
||||
*/
|
||||
private RedisTemplate<String, Object> buildRedisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
||||
// 配置redisTemplate
|
||||
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
|
||||
redisTemplate.setConnectionFactory(redisConnectionFactory);
|
||||
// key序列化
|
||||
redisTemplate.setKeySerializer(STRING_SERIALIZER);
|
||||
// value序列化
|
||||
redisTemplate.setValueSerializer(STRING_SERIALIZER);
|
||||
// Hash key序列化
|
||||
redisTemplate.setHashKeySerializer(STRING_SERIALIZER);
|
||||
// Hash value序列化
|
||||
redisTemplate.setHashValueSerializer(STRING_SERIALIZER);
|
||||
// 初始化RedisTemplate
|
||||
redisTemplate.afterPropertiesSet();
|
||||
return redisTemplate;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.wzj.soopin.consumer.content.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
/**
|
||||
* spring security配置类.
|
||||
*
|
||||
* @author lzc
|
||||
* @version 1.0
|
||||
*/
|
||||
@Configuration
|
||||
public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.authorizeRequests().antMatchers("/**").permitAll() // 所有请求都可以访问
|
||||
.and().csrf().disable() // 跨域请求关闭
|
||||
.headers().frameOptions().disable(); // 资源下载权限关闭
|
||||
}
|
||||
|
||||
@Bean
|
||||
PasswordEncoder passwordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.wzj.soopin.consumer.content.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
|
||||
|
||||
/**
|
||||
* @author vercen
|
||||
* @version 1.0
|
||||
* @date 2023/5/20 19:55
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2WebMvc
|
||||
public class knife4jConfig {
|
||||
@Bean
|
||||
public Docket defaultApi2() {
|
||||
Docket docket=new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(new ApiInfoBuilder()
|
||||
//.title("swagger-bootstrap-ui-demo RESTful APIs")
|
||||
.description("短视频实战接口文档")
|
||||
.termsOfServiceUrl("http://www.xx.com/")
|
||||
.contact(new Contact("lee", "http://www.imooc.com/", "abc@imooc.com"))
|
||||
.version("1.0")
|
||||
.build())
|
||||
//分组名称
|
||||
.groupName("2.X版本")
|
||||
.select()
|
||||
//这里指定Controller扫描包路径
|
||||
.apis(RequestHandlerSelectors.basePackage("com.imooc.controller"))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
return docket;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.wzj.soopin.consumer.content.controller;
|
||||
|
||||
//public class BaseController {
|
||||
//
|
||||
// @Autowired
|
||||
// public RedisOperator redis;
|
||||
//
|
||||
// public static final String MOBILE_SMSCODE = "mobile:smscode";
|
||||
// public static final String REDIS_USER_TOKEN = "redis_user_token";
|
||||
// public static final String REDIS_USER_INFO = "redis_user_info";
|
||||
//
|
||||
//}
|
@ -0,0 +1,46 @@
|
||||
package com.wzj.soopin.consumer.content.controller;//package com.imooc.controller;
|
||||
//
|
||||
//import com.github.pagehelper.PageInfo;
|
||||
//import com.imooc.utils.RedisOperator;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.validation.BindingResult;
|
||||
//import org.springframework.validation.FieldError;
|
||||
//
|
||||
//import java.util.HashMap;
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//
|
||||
//public class BaseInfoProperties {
|
||||
//
|
||||
// @Autowired
|
||||
// public RedisOperator redis;
|
||||
//
|
||||
// public static final Integer COMMON_START_PAGE = 1;
|
||||
// public static final Integer COMMON_PAGE_SIZE = 10;
|
||||
//
|
||||
// public static final String MOBILE_SMSCODE = "mobile:smscode";
|
||||
// public static final String REDIS_USER_TOKEN = "redis_user_token";
|
||||
// public static final String REDIS_USER_INFO = "redis_user_info";
|
||||
//
|
||||
//
|
||||
// //我的关注总数
|
||||
// public static final String REDIS_MY_FOLLOWS_COUNTS = "redis_my_follows_counts";
|
||||
// // 我的粉丝总数
|
||||
// public static final String REDIS_MY_FANS_COUNTS = "redis_my_fans_counts";
|
||||
//
|
||||
// // 视频和发布者获赞数
|
||||
// public static final String REDIS_VLOG_BE_LIKED_COUNTS = "redis_vlog_be_liked_counts";
|
||||
// public static final String REDIS_VLOGER_BE_LIKED_COUNTS = "redis_vloger_be_liked_counts";
|
||||
//
|
||||
// public PagedGridResult setterPagedGrid(List<?> list,
|
||||
// Integer page) {
|
||||
// PageInfo<?> pageList = new PageInfo<>(list);
|
||||
// PagedGridResult gridResult = new PagedGridResult();
|
||||
// gridResult.setRows(list);
|
||||
// gridResult.setPage(page);
|
||||
// gridResult.setRecords(pageList.getTotal());
|
||||
// gridResult.setTotal(pageList.getPages());
|
||||
// return gridResult;
|
||||
// }
|
||||
//
|
||||
//}
|
@ -0,0 +1,114 @@
|
||||
package com.wzj.soopin.consumer.content.controller;
|
||||
|
||||
import com.imooc.base.BaseInfoProperties;
|
||||
import com.imooc.bo.CommentBO;
|
||||
import com.imooc.enums.MessageEnum;
|
||||
import com.imooc.grace.result.GraceJSONResult;
|
||||
import com.imooc.pojo.Comment;
|
||||
import com.imooc.pojo.Vlog;
|
||||
import com.imooc.service.CommentService;
|
||||
import com.imooc.service.MsgService;
|
||||
import com.imooc.service.VlogService;
|
||||
import com.imooc.vo.CommentVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "CommentController 评论模块的接口")
|
||||
@RequestMapping("comment")
|
||||
@RestController
|
||||
public class CommentController extends BaseInfoProperties {
|
||||
|
||||
@Autowired
|
||||
private CommentService commentService;
|
||||
@Autowired
|
||||
private MsgService msgService;
|
||||
@Autowired
|
||||
private VlogService vlogService;
|
||||
//
|
||||
@PostMapping("create")
|
||||
public GraceJSONResult create(@RequestBody @Valid CommentBO commentBO)
|
||||
throws Exception {
|
||||
|
||||
CommentVO commentVO = commentService.createComment(commentBO);
|
||||
return GraceJSONResult.ok(commentVO);
|
||||
}
|
||||
//
|
||||
@GetMapping("counts")
|
||||
public GraceJSONResult counts(@RequestParam String vlogId) {
|
||||
|
||||
String countsStr = redis.get(REDIS_VLOG_COMMENT_COUNTS + ":" + vlogId);
|
||||
if (StringUtils.isBlank(countsStr)) {
|
||||
countsStr = "0";
|
||||
}
|
||||
|
||||
return GraceJSONResult.ok(Integer.valueOf(countsStr));
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
public GraceJSONResult list(@RequestParam String vlogId,
|
||||
@RequestParam(defaultValue = "") String userId,
|
||||
@RequestParam Integer page,
|
||||
@RequestParam Integer pageSize) {
|
||||
|
||||
return GraceJSONResult.ok(
|
||||
commentService.queryVlogComments(
|
||||
vlogId,
|
||||
userId,
|
||||
page,
|
||||
pageSize));
|
||||
}
|
||||
|
||||
@DeleteMapping("delete")
|
||||
public GraceJSONResult delete(@RequestParam String commentUserId,
|
||||
@RequestParam String commentId,
|
||||
@RequestParam String vlogId) {
|
||||
commentService.deleteComment(commentUserId,
|
||||
commentId,
|
||||
vlogId);
|
||||
return GraceJSONResult.ok();
|
||||
}
|
||||
|
||||
@PostMapping("like")
|
||||
public GraceJSONResult like(@RequestParam String commentId,
|
||||
@RequestParam String userId) {
|
||||
|
||||
// 故意犯错,bigkey
|
||||
redis.incrementHash(REDIS_VLOG_COMMENT_LIKED_COUNTS, commentId, 1);
|
||||
redis.setHashValue(REDIS_USER_LIKE_COMMENT, userId + ":" + commentId, "1");
|
||||
// redis.hset(REDIS_USER_LIKE_COMMENT, userId, "1");
|
||||
|
||||
|
||||
// 系统消息:点赞评论
|
||||
Comment comment = commentService.getComment(commentId);
|
||||
Vlog vlog = vlogService.getVlog(comment.getVlogId());
|
||||
Map msgContent = new HashMap();
|
||||
msgContent.put("vlogId", vlog.getId());
|
||||
msgContent.put("vlogCover", vlog.getCover());
|
||||
msgContent.put("commentId", commentId);
|
||||
msgService.createMsg(userId,
|
||||
comment.getCommentUserId(),
|
||||
MessageEnum.LIKE_COMMENT.type,
|
||||
msgContent);
|
||||
|
||||
|
||||
return GraceJSONResult.ok();
|
||||
}
|
||||
|
||||
@PostMapping("unlike")
|
||||
public GraceJSONResult unlike(@RequestParam String commentId,
|
||||
@RequestParam String userId) {
|
||||
|
||||
redis.decrementHash(REDIS_VLOG_COMMENT_LIKED_COUNTS, commentId, 1);
|
||||
redis.hdel(REDIS_USER_LIKE_COMMENT, userId + ":" + commentId);
|
||||
|
||||
return GraceJSONResult.ok();
|
||||
}
|
||||
}
|
@ -0,0 +1,298 @@
|
||||
package com.wzj.soopin.consumer.content.controller;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.imooc.base.BaseInfoProperties;
|
||||
import com.imooc.grace.result.GraceJSONResult;
|
||||
import com.imooc.grace.result.ResponseStatusEnum;
|
||||
import com.imooc.pojo.Users;
|
||||
import com.imooc.service.FansService;
|
||||
import com.imooc.service.UserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "FansController 粉丝相关业务功能的接口")
|
||||
@RequestMapping("fans")
|
||||
@RestController
|
||||
public class FansController extends BaseInfoProperties {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private FansService fansService;
|
||||
|
||||
@PostMapping("follow")
|
||||
public GraceJSONResult follow(@RequestParam String myId,
|
||||
@RequestParam String vlogerId) {
|
||||
// 从redis中获取拉黑信息
|
||||
String redisKey = REDIS_USER_BLOCK + ":" + myId;
|
||||
Boolean hasKey = redis.keyIsExist(redisKey);
|
||||
if(hasKey){
|
||||
List<String> blockUserList = new ArrayList<>();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<String> reports = redis.lrange(redisKey, 0, -1); // 查询用户的所有举报记录
|
||||
|
||||
for (String report : reports) {
|
||||
try {
|
||||
Map<String, Object> reportMap = objectMapper.readValue(report, new TypeReference<Map<String, Object>>() {});
|
||||
// 处理拉黑信息
|
||||
String queryvlogerId = (String) reportMap.get("vlogerId");
|
||||
blockUserList.add(queryvlogerId);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
System.out.println(blockUserList);
|
||||
Boolean isBlock = blockUserList.contains(vlogerId);
|
||||
if(isBlock){
|
||||
return GraceJSONResult.errorCustom(ResponseStatusEnum.ON_BLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
// 判断两个id不能为空
|
||||
if (StringUtils.isBlank(myId) || StringUtils.isBlank(vlogerId)) {
|
||||
return GraceJSONResult.errorCustom(ResponseStatusEnum.SYSTEM_ERROR);
|
||||
}
|
||||
|
||||
// 判断当前用户,自己不能关注自己
|
||||
if (myId.equalsIgnoreCase(vlogerId)) {
|
||||
return GraceJSONResult.errorCustom(ResponseStatusEnum.SYSTEM_RESPONSE_NO_INFO);
|
||||
}
|
||||
|
||||
// 是否已经存在关系
|
||||
Boolean flow = fansService.queryDoIFollowVloger(myId,vlogerId);
|
||||
if(flow){
|
||||
return GraceJSONResult.errorCustom(ResponseStatusEnum.FANS_INFO_UPDATED_ISFAN_EXIST_ERROR);
|
||||
}
|
||||
|
||||
// 判断两个id对应的用户是否存在
|
||||
Users vloger = userService.getUser(vlogerId);
|
||||
Users myInfo = userService.getUser(myId);
|
||||
|
||||
// fixme: 两个用户id的数据库查询后的判断,是分开好?还是合并判断好?
|
||||
if (myInfo == null || vloger == null) {
|
||||
return GraceJSONResult.errorCustom(ResponseStatusEnum.SYSTEM_RESPONSE_NO_INFO);
|
||||
}
|
||||
//
|
||||
// 保存粉丝关系到数据库
|
||||
fansService.doFollow(myId, vlogerId);
|
||||
|
||||
// 博主的粉丝+1,我的关注+1
|
||||
redis.increment(REDIS_MY_FOLLOWS_COUNTS + ":" + myId, 1);
|
||||
redis.increment(REDIS_MY_FANS_COUNTS + ":" + vlogerId, 1);
|
||||
|
||||
// 我和博主的关联关系,依赖redis,不要存储数据库,避免db的性能瓶颈
|
||||
redis.set(REDIS_FANS_AND_VLOGGER_RELATIONSHIP + ":" + myId + ":" + vlogerId, "1");
|
||||
//
|
||||
return GraceJSONResult.ok();
|
||||
}
|
||||
|
||||
@PostMapping("cancel")
|
||||
public GraceJSONResult cancel(@RequestParam String myId,
|
||||
@RequestParam String vlogerId) {
|
||||
// 判断两个id不能为空
|
||||
if (StringUtils.isBlank(myId) || StringUtils.isBlank(vlogerId)) {
|
||||
return GraceJSONResult.errorCustom(ResponseStatusEnum.SYSTEM_ERROR);
|
||||
}
|
||||
// 是否已经存在关系
|
||||
Boolean flow = fansService.queryDoIFollowVloger(myId,vlogerId);
|
||||
if(!flow){
|
||||
return GraceJSONResult.errorCustom(ResponseStatusEnum.FANS_INFO_UPDATED_ISFLOW_EXIST_ERROR);
|
||||
}
|
||||
// 删除业务的执行
|
||||
fansService.doCancel(myId, vlogerId);
|
||||
|
||||
// 博主的粉丝-1,我的关注-1
|
||||
redis.decrement(REDIS_MY_FOLLOWS_COUNTS + ":" + myId, 1);
|
||||
redis.decrement(REDIS_MY_FANS_COUNTS + ":" + vlogerId, 1);
|
||||
|
||||
// 我和博主的关联关系,依赖redis,不要存储数据库,避免db的性能瓶颈
|
||||
redis.del(REDIS_FANS_AND_VLOGGER_RELATIONSHIP + ":" + myId + ":" + vlogerId);
|
||||
|
||||
return GraceJSONResult.ok();
|
||||
}
|
||||
|
||||
@GetMapping("queryBlockVloger")
|
||||
public GraceJSONResult queryBlockVloger(@RequestParam String myId,
|
||||
@RequestParam String vlogerId) {
|
||||
// 从redis中获取拉黑信息
|
||||
String redisKey = REDIS_USER_BLOCK + ":" + myId;
|
||||
Boolean hasKey = redis.keyIsExist(redisKey);
|
||||
if(hasKey){
|
||||
List<String> blockUserList = new ArrayList<>();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<String> reports = redis.lrange(redisKey, 0, -1); // 查询用户的所有举报记录
|
||||
|
||||
for (String report : reports) {
|
||||
try {
|
||||
Map<String, Object> reportMap = objectMapper.readValue(report, new TypeReference<Map<String, Object>>() {});
|
||||
// 处理拉黑信息
|
||||
String queryvlogerId = (String) reportMap.get("vlogerId");
|
||||
blockUserList.add(queryvlogerId);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
System.out.println(blockUserList);
|
||||
return GraceJSONResult.ok(blockUserList.contains(vlogerId));
|
||||
}else{
|
||||
return GraceJSONResult.ok(false);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("block")
|
||||
public GraceJSONResult block(@RequestParam String myId,
|
||||
@RequestParam String vlogerId) {
|
||||
// 先执行cancel
|
||||
// 判断两个id不能为空
|
||||
if (StringUtils.isBlank(myId) || StringUtils.isBlank(vlogerId)) {
|
||||
return GraceJSONResult.errorCustom(ResponseStatusEnum.SYSTEM_ERROR);
|
||||
}
|
||||
// 是否已经存在关系
|
||||
Boolean flow = fansService.queryDoIFollowVloger(myId,vlogerId);
|
||||
if(flow){
|
||||
// 删除业务的执行
|
||||
fansService.doCancel(myId, vlogerId);
|
||||
|
||||
// 博主的粉丝-1,我的关注-1
|
||||
redis.decrement(REDIS_MY_FOLLOWS_COUNTS + ":" + myId, 1);
|
||||
redis.decrement(REDIS_MY_FANS_COUNTS + ":" + vlogerId, 1);
|
||||
|
||||
// 我和博主的关联关系,依赖redis,不要存储数据库,避免db的性能瓶颈
|
||||
redis.del(REDIS_FANS_AND_VLOGGER_RELATIONSHIP + ":" + myId + ":" + vlogerId);
|
||||
}
|
||||
// 拉黑
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
String blockTime = LocalDateTime.now().format(formatter);
|
||||
try{
|
||||
Map<String, String> blockInfo = new HashMap<>();
|
||||
blockInfo.put("vlogerId", vlogerId);
|
||||
blockInfo.put("myId", myId);
|
||||
blockInfo.put("time", blockTime);
|
||||
// 转成 JSON 字符串
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String blockJson = objectMapper.writeValueAsString(blockInfo);
|
||||
String redisKey = REDIS_USER_BLOCK + ":" + myId ;
|
||||
log.info("写入Redis => key: {}, value: {}", redisKey, blockJson);
|
||||
redis.rpush(redisKey , blockJson);
|
||||
|
||||
return GraceJSONResult.ok();
|
||||
}catch (JsonProcessingException e){
|
||||
// 打日志,或者抛出业务异常
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("JSON序列化失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("cancelBlock")
|
||||
public GraceJSONResult cancelBlock(@RequestParam String myId,
|
||||
@RequestParam String vlogerId) {
|
||||
// 判断两个id不能为空
|
||||
if (StringUtils.isBlank(myId) || StringUtils.isBlank(vlogerId)) {
|
||||
return GraceJSONResult.errorCustom(ResponseStatusEnum.SYSTEM_ERROR);
|
||||
}
|
||||
// 解除拉黑
|
||||
String redisKey = REDIS_USER_BLOCK + ":" + myId;
|
||||
Boolean hasKey = redis.keyIsExist(redisKey);
|
||||
if(hasKey){
|
||||
List<String> blockList = redis.lrange(redisKey, 0, -1);
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
if (blockList != null && !blockList.isEmpty()) {
|
||||
for (String item : blockList) {
|
||||
try {
|
||||
Map<String, String> itemMap = objectMapper.readValue(item, new TypeReference<Map<String, String>>() {});
|
||||
String storedVlogerId = itemMap.get("vlogerId");
|
||||
|
||||
if (storedVlogerId != null && storedVlogerId.equals(vlogerId)) {
|
||||
redis.lrem(redisKey, 1, item); // 删除找到的 JSON 字符串
|
||||
break;
|
||||
}
|
||||
}catch (JsonProcessingException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return GraceJSONResult.ok();
|
||||
}else{
|
||||
return GraceJSONResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("blockVideo")
|
||||
public GraceJSONResult blockVideo(@RequestParam String myId,
|
||||
@RequestParam String vlogId,
|
||||
@RequestParam String reason,
|
||||
@RequestParam(defaultValue = "") String description) {
|
||||
// 判断两个id不能为空
|
||||
if (StringUtils.isBlank(myId) || StringUtils.isBlank(vlogId)) {
|
||||
return GraceJSONResult.errorCustom(ResponseStatusEnum.SYSTEM_ERROR);
|
||||
}
|
||||
// 拉黑
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
String blockTime = LocalDateTime.now().format(formatter);
|
||||
//
|
||||
try{
|
||||
Map<String, String> blockInfo = new HashMap<>();
|
||||
blockInfo.put("vlogId", vlogId);
|
||||
blockInfo.put("reporter", myId);
|
||||
blockInfo.put("time", blockTime);
|
||||
blockInfo.put("reason", reason);
|
||||
blockInfo.put("description", description);
|
||||
// 转成 JSON 字符串
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String blockJson = objectMapper.writeValueAsString(blockInfo);
|
||||
|
||||
String redisKey = REDIS_VIDEO_BLOCK + ":" + myId ;
|
||||
log.info("写入Redis => key: {}, value: {}", redisKey, blockJson);
|
||||
redis.rpush(redisKey , blockJson);
|
||||
|
||||
return GraceJSONResult.ok();
|
||||
}catch (JsonProcessingException e){
|
||||
// 打日志,或者抛出业务异常
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("JSON序列化失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("queryDoIFollowVloger")
|
||||
public GraceJSONResult queryDoIFollowVloger(@RequestParam String myId,
|
||||
@RequestParam String vlogerId) {
|
||||
return GraceJSONResult.ok(fansService.queryDoIFollowVloger(myId, vlogerId));
|
||||
}
|
||||
|
||||
@GetMapping("queryMyFollows")
|
||||
public GraceJSONResult queryMyFollows(@RequestParam String myId,
|
||||
@RequestParam Integer page,
|
||||
@RequestParam Integer pageSize) {
|
||||
return GraceJSONResult.ok(
|
||||
fansService.queryMyFollows(
|
||||
myId,
|
||||
page,
|
||||
pageSize));
|
||||
}
|
||||
|
||||
@GetMapping("queryMyFans")
|
||||
public GraceJSONResult queryMyFans(@RequestParam String myId,
|
||||
@RequestParam Integer page,
|
||||
@RequestParam Integer pageSize) {
|
||||
return GraceJSONResult.ok(
|
||||
fansService.queryMyFans(
|
||||
myId,
|
||||
page,
|
||||
pageSize));
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.wzj.soopin.consumer.content.controller;
|
||||
|
||||
|
||||
import com.imooc.config.MinIOConfig;
|
||||
import com.imooc.grace.result.GraceJSONResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "FileController 文件上传测试的接口")
|
||||
@RestController
|
||||
public class FileController {
|
||||
|
||||
@Autowired
|
||||
private MinIOConfig minIOConfig;
|
||||
|
||||
@PostMapping("upload")
|
||||
public GraceJSONResult upload(MultipartFile file) throws Exception {
|
||||
// 获取 vlogdata 目录路径
|
||||
// String storagePath = new File(System.getProperty("user.dir"), "vlogdata").getAbsolutePath();
|
||||
String storagePath = "/data/vlogdata"; // 生产
|
||||
// String storagePath = "/Users/wuzhongjie/Desktop/vlog-1.0.0/vlogdata"; // 本地
|
||||
|
||||
log.info(storagePath);
|
||||
File storageDir = new File(storagePath);
|
||||
if (!storageDir.exists()) {
|
||||
storageDir.mkdirs(); // 确保目录存在
|
||||
}
|
||||
|
||||
// 组装完整的存储路径
|
||||
File destFile = new File(storageDir, file.getOriginalFilename());
|
||||
log.info(destFile.getAbsolutePath());
|
||||
String imgUrl = destFile.getAbsolutePath();
|
||||
// 使用流手动存储文件
|
||||
try (InputStream inputStream = file.getInputStream();
|
||||
OutputStream outputStream = new FileOutputStream(destFile)) {
|
||||
byte[] buffer = new byte[1024];
|
||||
int bytesRead;
|
||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
outputStream.write(buffer, 0, bytesRead);
|
||||
}
|
||||
}
|
||||
|
||||
log.info("本地文件存储成功: " + destFile.getAbsolutePath());
|
||||
|
||||
// String fileName = file.getOriginalFilename();
|
||||
//
|
||||
//
|
||||
//
|
||||
// MinIOUtils.uploadFile(minIOConfig.getBucketName(),
|
||||
// fileName,
|
||||
// file.getInputStream());
|
||||
//
|
||||
// String imgUrl = minIOConfig.getFileHost()
|
||||
// + "/"
|
||||
// + minIOConfig.getBucketName()
|
||||
// + "/"
|
||||
// + fileName;
|
||||
|
||||
return GraceJSONResult.ok(imgUrl);
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.wzj.soopin.consumer.content.controller;
|
||||
|
||||
import com.imooc.base.BaseInfoProperties;
|
||||
import com.imooc.grace.result.GraceJSONResult;
|
||||
import com.imooc.mo.MessageMO;
|
||||
import com.imooc.service.MsgService;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "MsgController 消息功能模块的接口")
|
||||
@RequestMapping("msg")
|
||||
@RestController
|
||||
public class MsgController extends BaseInfoProperties {
|
||||
|
||||
@Autowired
|
||||
private MsgService msgService;
|
||||
|
||||
@GetMapping("list")
|
||||
public GraceJSONResult list(@RequestParam String userId,
|
||||
@RequestParam Integer page,
|
||||
@RequestParam Integer pageSize) {
|
||||
|
||||
// mongodb 从0分页,区别于数据库
|
||||
if (page == null) {
|
||||
page = COMMON_START_PAGE_ZERO;
|
||||
}
|
||||
if (pageSize == null) {
|
||||
pageSize = COMMON_PAGE_SIZE;
|
||||
}
|
||||
|
||||
List<MessageMO> list = msgService.queryList(userId, page, pageSize);
|
||||
|
||||
return GraceJSONResult.ok(list);
|
||||
}
|
||||
}
|
@ -0,0 +1,210 @@
|
||||
package com.wzj.soopin.consumer.content.controller;
|
||||
|
||||
import com.imooc.base.BaseInfoProperties;
|
||||
import com.imooc.bo.LoginWithPasswordBO;
|
||||
import com.imooc.bo.RegistLoginBO;
|
||||
import com.imooc.grace.result.GraceJSONResult;
|
||||
import com.imooc.grace.result.ResponseStatusEnum;
|
||||
import com.imooc.pojo.Users;
|
||||
import com.imooc.service.UserService;
|
||||
import com.imooc.utils.GsonUtil;
|
||||
import com.imooc.utils.IPUtil;
|
||||
import com.imooc.utils.SMSUtils;
|
||||
import com.imooc.vo.UsersVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author vercen
|
||||
* @version 1.0
|
||||
* @date 2023/5/25 10:47
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("passport")
|
||||
@Api(tags = "通行证,验证码登录注册")
|
||||
public class PassportController extends BaseInfoProperties {
|
||||
@Autowired
|
||||
private SMSUtils smsUtils;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private PasswordEncoder passwordEncoder;
|
||||
|
||||
@PostMapping("getSMSCode")
|
||||
public Object getSMSCode(@RequestParam String mobile, HttpServletRequest request) throws Exception {
|
||||
if (StringUtils.isBlank(mobile)) {
|
||||
return GraceJSONResult.ok();
|
||||
}
|
||||
|
||||
// TODO 获得用户ip 限制时间60s只能1次
|
||||
String userIp = IPUtil.getRequestIp(request);
|
||||
|
||||
redis.setnx60s(MOBILE_SMSCODE + ":" + userIp, userIp);
|
||||
String code = (int) ((Math.random() * 9 + 1) * 100000) + "";
|
||||
|
||||
smsUtils.sendSMS(mobile, code);
|
||||
|
||||
log.info(code);
|
||||
redis.set(MOBILE_SMSCODE + ":" + mobile, code, 30 * 60);
|
||||
// TODO 验证码放入redis
|
||||
return GraceJSONResult.ok();
|
||||
}
|
||||
|
||||
@PostMapping("login")
|
||||
public Object login(@Valid @RequestBody RegistLoginBO registLoginBO) {
|
||||
|
||||
String rediscode = redis.get(MOBILE_SMSCODE + ":" + registLoginBO.getMobile());
|
||||
|
||||
if (StringUtils.isBlank(rediscode) || !rediscode.equalsIgnoreCase(registLoginBO.getSmsCode())) {
|
||||
System.out.println("rediscode" + rediscode);
|
||||
System.out.println("registLoginBO.getMobile()" + registLoginBO.getSmsCode());
|
||||
return GraceJSONResult.errorCustom(ResponseStatusEnum.SMS_CODE_ERROR);
|
||||
}
|
||||
|
||||
Users user = userService.queryMobileIsExist(registLoginBO.getMobile());
|
||||
if (user == null) {
|
||||
user = userService.createUser(registLoginBO.getMobile());
|
||||
}
|
||||
String uToken = UUID.randomUUID().toString();
|
||||
log.info(uToken);
|
||||
redis.set(REDIS_USER_TOKEN + ":" + user.getId(), uToken);
|
||||
|
||||
// 清除验证码
|
||||
redis.del(MOBILE_SMSCODE + ":" + user.getMobile());
|
||||
|
||||
// 返回给前端
|
||||
UsersVO usersVO = new UsersVO();
|
||||
BeanUtils.copyProperties(user, usersVO);
|
||||
usersVO.setUserToken(uToken);
|
||||
|
||||
return GraceJSONResult.ok(usersVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从商城系统登录
|
||||
*
|
||||
* @param mobile
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("loginFromShop")
|
||||
public String loginFromShop(String mobile, String memberId) {
|
||||
// 创建短视频系统账号
|
||||
return Optional.ofNullable(userService.createUserFromShop(mobile, memberId))//
|
||||
.map(user -> {
|
||||
String uToken = UUID.randomUUID().toString();
|
||||
log.info(uToken);
|
||||
redis.set(REDIS_USER_TOKEN + ":" + user.getId(), uToken);
|
||||
// 返回给前端
|
||||
UsersVO usersVO = new UsersVO();
|
||||
BeanUtils.copyProperties(user, usersVO);
|
||||
usersVO.setUserToken(uToken);
|
||||
|
||||
return GsonUtil.beanToJson(usersVO);
|
||||
})//
|
||||
.orElseGet(() -> StringUtils.EMPTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从商城登录获取短视频账户信息
|
||||
*
|
||||
* @param memberId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("getUserFromShop")
|
||||
public String getUserFromShop(String memberId) {
|
||||
return userService.getUserInfoFromShop(memberId);
|
||||
}
|
||||
|
||||
/*@PostMapping("login")
|
||||
public Object login(@Valid @RequestBody RegistLoginBO registLoginBO) {
|
||||
String rediscode = redis.get(MOBILE_SMSCODE + ":" + registLoginBO.getMobile());
|
||||
|
||||
if (StringUtils.isBlank(rediscode) || !rediscode.equalsIgnoreCase(registLoginBO.getSmsCode())) {
|
||||
System.out.println("rediscode" + rediscode);
|
||||
System.out.println("registLoginBO.getMobile()" + registLoginBO.getSmsCode());
|
||||
return GraceJSONResult.errorCustom(ResponseStatusEnum.SMS_CODE_ERROR);
|
||||
}
|
||||
|
||||
// 手机号
|
||||
String mobile = registLoginBO.getMobile();
|
||||
Users user = userService.queryMobileIsExist(mobile);
|
||||
Token shopToken = null;
|
||||
if (user == null) {
|
||||
Map<String, Object> result = userService.createUserNew(mobile);
|
||||
if (CommonUtil.isEmpty(result)) {
|
||||
return GraceJSONResult.errorCustom(ResponseStatusEnum.FAILED);
|
||||
}
|
||||
user = (Users) result.get("user");
|
||||
shopToken = (Token) result.get("token");
|
||||
} else {
|
||||
shopToken = userService.getShopToken(user.getId());
|
||||
}
|
||||
|
||||
String uToken = UUID.randomUUID().toString();
|
||||
log.info(uToken);
|
||||
redis.set(REDIS_USER_TOKEN + ":" + user.getId(), uToken);
|
||||
|
||||
// 清除验证码
|
||||
redis.del(MOBILE_SMSCODE + ":" + user.getMobile());
|
||||
|
||||
// 返回给前端
|
||||
UsersVO usersVO = new UsersVO();
|
||||
BeanUtils.copyProperties(user, usersVO);
|
||||
usersVO.setUserToken(uToken);
|
||||
//usersVO.setShopToken(shopToken);
|
||||
|
||||
return GraceJSONResult.ok(usersVO);
|
||||
}*/
|
||||
|
||||
@PostMapping("loginWithPassword")
|
||||
public Object loginWithPassword(@Valid @RequestBody LoginWithPasswordBO loginWithPasswordBO) {
|
||||
String phone = loginWithPasswordBO.getMobile();
|
||||
String password = loginWithPasswordBO.getPassword();
|
||||
log.info(phone);
|
||||
log.info(password);
|
||||
Users user = userService.queryMobileIsExist(phone);
|
||||
if (user == null) {
|
||||
return GraceJSONResult.errorCustom(ResponseStatusEnum.USER_NOT_EXIST_ERROR);
|
||||
}
|
||||
if (!passwordEncoder.matches(password, user.getPassword())) {
|
||||
return GraceJSONResult.errorCustom(ResponseStatusEnum.USER_PASSWORD_ERROR);
|
||||
}
|
||||
|
||||
String uToken = UUID.randomUUID().toString();
|
||||
log.info(uToken);
|
||||
redis.set(REDIS_USER_TOKEN + ":" + user.getId(), uToken);
|
||||
// 商城token
|
||||
// Token shopToken = userService.getShopToken(user.getId());
|
||||
|
||||
// 返回给前端
|
||||
UsersVO usersVO = new UsersVO();
|
||||
BeanUtils.copyProperties(user, usersVO);
|
||||
usersVO.setUserToken(uToken);
|
||||
// usersVO.setShopToken(shopToken);
|
||||
|
||||
return GraceJSONResult.ok(usersVO);
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("logout")
|
||||
public Object logout(@RequestParam String userId) {
|
||||
|
||||
redis.del(REDIS_USER_TOKEN + ":" + userId);
|
||||
|
||||
return GraceJSONResult.ok();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package com.wzj.soopin.consumer.content.controller;
|
||||
|
||||
import com.imooc.base.RabbitMQConfig;
|
||||
import com.imooc.enums.MessageEnum;
|
||||
import com.imooc.exceptions.GraceException;
|
||||
import com.imooc.grace.result.ResponseStatusEnum;
|
||||
import com.imooc.mo.MessageMO;
|
||||
import com.imooc.service.MsgService;
|
||||
import com.imooc.utils.JsonUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class RabbitMQConsumer {
|
||||
|
||||
@Autowired
|
||||
private MsgService msgService;
|
||||
|
||||
@RabbitListener(queues = {RabbitMQConfig.QUEUE_SYS_MSG})
|
||||
public void watchQueue(String payload, Message message) {
|
||||
log.info(payload);
|
||||
|
||||
MessageMO messageMO = JsonUtils.jsonToPojo(payload, MessageMO.class);
|
||||
|
||||
String routingKey = message.getMessageProperties().getReceivedRoutingKey();
|
||||
log.info(routingKey);
|
||||
|
||||
// TODO: 下面这段代码可以优化,一个地方是参数优化,另外是枚举的判断优化
|
||||
|
||||
if (routingKey.equalsIgnoreCase("sys.msg." + MessageEnum.FOLLOW_YOU.enValue)) {
|
||||
msgService.createMsg(messageMO.getFromUserId(),
|
||||
messageMO.getToUserId(),
|
||||
MessageEnum.FOLLOW_YOU.type,
|
||||
null);
|
||||
} else if (routingKey.equalsIgnoreCase("sys.msg." + MessageEnum.LIKE_VLOG.enValue)) {
|
||||
msgService.createMsg(messageMO.getFromUserId(),
|
||||
messageMO.getToUserId(),
|
||||
MessageEnum.FOLLOW_YOU.type,
|
||||
messageMO.getMsgContent());
|
||||
} else if (routingKey.equalsIgnoreCase("sys.msg." + MessageEnum.COMMENT_VLOG.enValue)) {
|
||||
msgService.createMsg(messageMO.getFromUserId(),
|
||||
messageMO.getToUserId(),
|
||||
MessageEnum.COMMENT_VLOG.type,
|
||||
messageMO.getMsgContent());
|
||||
} else if (routingKey.equalsIgnoreCase("sys.msg." + MessageEnum.REPLY_YOU.enValue)) {
|
||||
msgService.createMsg(messageMO.getFromUserId(),
|
||||
messageMO.getToUserId(),
|
||||
MessageEnum.REPLY_YOU.type,
|
||||
messageMO.getMsgContent());
|
||||
} else if (routingKey.equalsIgnoreCase("sys.msg." + MessageEnum.LIKE_COMMENT.enValue)) {
|
||||
msgService.createMsg(messageMO.getFromUserId(),
|
||||
messageMO.getToUserId(),
|
||||
MessageEnum.LIKE_COMMENT.type,
|
||||
messageMO.getMsgContent());
|
||||
} else {
|
||||
GraceException.display(ResponseStatusEnum.SYSTEM_OPERATION_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,148 @@
|
||||
package com.wzj.soopin.consumer.content.controller;
|
||||
|
||||
import com.imooc.base.BaseInfoProperties;
|
||||
import com.imooc.bo.UpdatedUserBO;
|
||||
import com.imooc.config.MinIOConfig;
|
||||
import com.imooc.enums.FileTypeEnum;
|
||||
import com.imooc.enums.UserInfoModifyType;
|
||||
import com.imooc.grace.result.GraceJSONResult;
|
||||
import com.imooc.grace.result.ResponseStatusEnum;
|
||||
import com.imooc.pojo.Users;
|
||||
import com.imooc.service.UserService;
|
||||
import com.imooc.utils.MinIOUtils;
|
||||
import com.imooc.vo.UsersVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* @author vercen
|
||||
* @version 1.0
|
||||
* @date 2023/5/20 14:32
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
@Api(tags = "UserInfoController用户信息接口模块")
|
||||
@RequestMapping("userInfo")
|
||||
public class UserInfoController extends BaseInfoProperties {
|
||||
|
||||
@Autowired
|
||||
UserService userService;
|
||||
|
||||
// @ResponseBody
|
||||
@ApiOperation(value = "根据userId返回个人信息")
|
||||
@GetMapping("query")
|
||||
public Object query(@RequestParam String userId){
|
||||
Users user = userService.getUser(userId);
|
||||
|
||||
UsersVO usersVO = new UsersVO();
|
||||
BeanUtils.copyProperties(user, usersVO);
|
||||
|
||||
|
||||
// 我的关注博主总数量
|
||||
String myFollowsCountsStr = redis.get(REDIS_MY_FOLLOWS_COUNTS + ":" + userId);
|
||||
// 我的粉丝总数
|
||||
String myFansCountsStr = redis.get(REDIS_MY_FANS_COUNTS + ":" + userId);
|
||||
// 用户获赞总数,视频博主(点赞/喜欢)总和
|
||||
// String likedVlogCountsStr = redis.get(REDIS_VLOG_BE_LIKED_COUNTS + ":" + userId);
|
||||
String likedVlogerCountsStr = redis.get(REDIS_VLOGER_BE_LIKED_COUNTS + ":" + userId);
|
||||
|
||||
Integer myFollowsCounts = 0;
|
||||
Integer myFansCounts = 0;
|
||||
Integer likedVlogCounts = 0;
|
||||
Integer likedVlogerCounts = 0;
|
||||
Integer totalLikeMeCounts = 0;
|
||||
|
||||
|
||||
if (StringUtils.isNotBlank(myFollowsCountsStr)) {
|
||||
myFollowsCounts = Integer.valueOf(myFollowsCountsStr);
|
||||
}
|
||||
if (StringUtils.isNotBlank(myFansCountsStr)) {
|
||||
myFansCounts = Integer.valueOf(myFansCountsStr);
|
||||
}
|
||||
// if (StringUtils.isNotBlank(likedVlogCountsStr)) {
|
||||
// likedVlogCounts = Integer.valueOf(likedVlogCountsStr);
|
||||
// }
|
||||
if (StringUtils.isNotBlank(likedVlogerCountsStr)) {
|
||||
likedVlogerCounts = Integer.valueOf(likedVlogerCountsStr);
|
||||
}
|
||||
totalLikeMeCounts = likedVlogCounts + likedVlogerCounts;
|
||||
|
||||
usersVO.setMyFollowsCounts(myFollowsCounts);
|
||||
usersVO.setMyFansCounts(myFansCounts);
|
||||
usersVO.setTotalLikeMeCounts(totalLikeMeCounts);
|
||||
|
||||
//usersVO.setMyFansCounts((Integer) myFansCounts);
|
||||
|
||||
return GraceJSONResult.ok(usersVO);
|
||||
}
|
||||
|
||||
@PostMapping("modifyUserInfo")
|
||||
public GraceJSONResult modifyUserInfo(@RequestBody UpdatedUserBO updatedUserBO, @RequestParam Integer type) throws Exception {
|
||||
|
||||
UserInfoModifyType.checkUserInfoTypeIsRight(type);
|
||||
Users newUserInfo = userService.updateUserInfo(updatedUserBO, type);
|
||||
return GraceJSONResult.ok(newUserInfo);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private MinIOConfig minIOConfig;
|
||||
|
||||
@PostMapping("modifyImage")
|
||||
public GraceJSONResult modifyImage(@RequestParam String userId,
|
||||
@RequestParam Integer type,
|
||||
MultipartFile file) throws Exception {
|
||||
|
||||
if (type != FileTypeEnum.BGIMG.type && type != FileTypeEnum.FACE.type) {
|
||||
return GraceJSONResult.errorCustom(ResponseStatusEnum.FILE_UPLOAD_FAILD);
|
||||
}
|
||||
|
||||
String fileName = file.getOriginalFilename();
|
||||
|
||||
MinIOUtils.uploadFile(minIOConfig.getBucketName(),
|
||||
fileName,
|
||||
file.getInputStream());
|
||||
|
||||
String imgUrl = minIOConfig.getFileHost()
|
||||
+ "/"
|
||||
+ minIOConfig.getBucketName()
|
||||
+ "/"
|
||||
+ fileName;
|
||||
|
||||
|
||||
// 修改图片地址到数据库
|
||||
UpdatedUserBO updatedUserBO = new UpdatedUserBO();
|
||||
updatedUserBO.setId(userId);
|
||||
|
||||
if (type == FileTypeEnum.BGIMG.type) {
|
||||
updatedUserBO.setBgImg(imgUrl);
|
||||
} else {
|
||||
updatedUserBO.setFace(imgUrl);
|
||||
}
|
||||
Users users = userService.updateUserInfo(updatedUserBO);
|
||||
|
||||
return GraceJSONResult.ok(users);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据昵称搜索用户")
|
||||
@GetMapping("searchByNickname")
|
||||
public GraceJSONResult searchByNickname(@RequestParam String nickname,
|
||||
@RequestParam(defaultValue = "") String id,
|
||||
@RequestParam Integer page,
|
||||
@RequestParam Integer pageSize){
|
||||
try {
|
||||
return GraceJSONResult.ok(userService.searchByNickname(nickname, page, pageSize,id));
|
||||
} catch (Exception e) {
|
||||
// 记录异常日志
|
||||
log.error("搜索用户时发生异常,nickname: {}, page: {}, pageSize: {}", nickname, page, pageSize, e);
|
||||
return GraceJSONResult.errorMsg("搜索用户时发生异常,请稍后重试");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,370 @@
|
||||
package com.wzj.soopin.consumer.content.controller;
|
||||
|
||||
|
||||
import com.imooc.base.BaseInfoProperties;
|
||||
import com.imooc.bo.VlogBO;
|
||||
import com.imooc.config.MinIOConfig;
|
||||
import com.imooc.enums.YesOrNo;
|
||||
import com.imooc.grace.result.GraceJSONResult;
|
||||
import com.imooc.service.VlogService;
|
||||
import com.imooc.utils.PagedGridResult;
|
||||
import com.imooc.utils.QcCloud;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "VlogController 短视频相关业务功能的接口")
|
||||
@RequestMapping("vlog")
|
||||
@RestController
|
||||
@RefreshScope
|
||||
public class VlogController extends BaseInfoProperties {
|
||||
@Autowired
|
||||
private VlogService vlogService;
|
||||
@Autowired
|
||||
private QcCloud qcCloud;
|
||||
@Autowired
|
||||
private MinIOConfig minIOConfig;
|
||||
|
||||
@PostMapping("vodCallBack")
|
||||
public GraceJSONResult vodCallBack(@RequestBody Map<String, Object> callbackData) {
|
||||
try {
|
||||
// 解析回调事件类型
|
||||
String eventType = (String) callbackData.get("EventType");
|
||||
log.info("收到腾讯云 VOD 回调, 事件类型: {}", eventType);
|
||||
log.info(callbackData.toString());
|
||||
|
||||
if ("ProcedureStateChanged".equals(eventType)) {
|
||||
// 获取 ProcedureStateChangeEvent
|
||||
Object eventObject = callbackData.get("ProcedureStateChangeEvent");
|
||||
if (eventObject instanceof Map) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> procedureStateChangeEvent = (Map<String, Object>) eventObject;
|
||||
String fileId = (String) procedureStateChangeEvent.get("FileId");
|
||||
String fileUrl = (String) procedureStateChangeEvent.get("FileUrl"); // 原视频地址
|
||||
String status = (String) procedureStateChangeEvent.get("Status"); // FINISH
|
||||
// 只处理完成状态
|
||||
if ("FINISH".equals(status)) {
|
||||
// 获取 MediaProcessResultSet,可能包含任务流信息
|
||||
List<Map<String, Object>> mediaProcessResultSet =
|
||||
(List<Map<String, Object>>) procedureStateChangeEvent.get("MediaProcessResultSet");
|
||||
|
||||
if (mediaProcessResultSet != null) {
|
||||
String coverUrl=null; // 首帧图
|
||||
String transVdUrl=null; // 转码后的视频地址
|
||||
for (Map<String, Object> processResult : mediaProcessResultSet) {
|
||||
String type = (String) processResult.get("Type");
|
||||
if ("CoverBySnapshot".equals(type)) {
|
||||
// 任务流:首帧截图
|
||||
Map<String, Object> coverBySnapshotTask =
|
||||
(Map<String, Object>) processResult.get("CoverBySnapshotTask");
|
||||
Map<String, Object> output = (Map<String, Object>) coverBySnapshotTask.get("Output");
|
||||
coverUrl = (String) output.get("CoverUrl"); // 正确获取 CoverUrl
|
||||
|
||||
}
|
||||
if("Transcode".equals(type)){
|
||||
// 拿到output中的url
|
||||
Map<String, Object> TranscodeTask =
|
||||
(Map<String, Object>) processResult.get("TranscodeTask");
|
||||
Map<String, Object> output = (Map<String, Object>) TranscodeTask.get("Output");
|
||||
transVdUrl = (String) output.get("Url");
|
||||
}
|
||||
}
|
||||
log.info("任务流 [截取首帧,视频转码] 完成, FileId: {}, 封面图 URL: {},视频地址: {}", fileId, coverUrl,transVdUrl);
|
||||
// TODO: 更新数据库,存储首帧图,设置云端地址,删除minio视频文件
|
||||
vlogService.updateVlogFirstImg(fileId,coverUrl,transVdUrl);
|
||||
|
||||
} else {
|
||||
log.warn("MediaProcessResultSet 为空,回调数据: {}", callbackData);
|
||||
}
|
||||
}
|
||||
log.info("任务流完成, FileId: {}, Status: {}", fileId, status);
|
||||
} else {
|
||||
log.warn("ProcedureStateChangeEvent 为空或格式错误,回调数据: {}", callbackData);
|
||||
}
|
||||
}
|
||||
if("ReviewAudioVideoComplete".equals(eventType)){
|
||||
//处理审核结果
|
||||
Map<String, Object> reviewEvent = (Map<String, Object>) callbackData.get("ReviewAudioVideoCompleteEvent");
|
||||
if (reviewEvent != null) {
|
||||
String status = (String) reviewEvent.get("Status"); // FINISH
|
||||
if ("FINISH".equals(status)) {
|
||||
Map<String, Object> input = (Map<String, Object>) reviewEvent.get("Input");
|
||||
String fileId = (String) input.get("FileId"); // 查询的唯一标识
|
||||
// 获取审核结果
|
||||
Map<String, Object> output = (Map<String, Object>) reviewEvent.get("Output");
|
||||
String suggestion = (String) output.get("Suggestion");
|
||||
if ("block".equals(suggestion)) {
|
||||
// 审核不通过,修改视频状态为2,写入reason,发送站内消息,告知审核结果
|
||||
// label
|
||||
//Porn:色情;
|
||||
//Terror:暴力;
|
||||
//Polity:不适宜的信息;
|
||||
//Ad:广告;
|
||||
//Illegal:违法;
|
||||
//Abuse:谩骂;
|
||||
//Moan:娇喘。
|
||||
String label = (String) output.get("Label"); // 违规内容
|
||||
String subLabel = (String) output.get("SubLabel"); // 违规子标签
|
||||
log.info("视频文件 {} 审核驳回, 原因: {} - {}", fileId, label, subLabel);
|
||||
// TODO: 更新数据库,发送站内信
|
||||
vlogService.updateVlogStatus(fileId,2,label);
|
||||
} else if ("pass".equals(suggestion)) {
|
||||
// 审核通过,处理通过逻辑,修改视频状态为1,发送站内消息,告知审核结果
|
||||
log.info("视频文件 {} 审核通过", fileId);
|
||||
// TODO: 更新数据库,发送站内信
|
||||
vlogService.updateVlogStatus(fileId,1,"通过");
|
||||
|
||||
} else if ("review".equals(suggestion)){
|
||||
// 建议复审,修改状态为3,发送站内消息,告知审核结果
|
||||
String label = (String) output.get("Label"); // 违规内容
|
||||
String subLabel = (String) output.get("SubLabel"); // 违规子标签
|
||||
log.info("视频文件 {} 建议复审, 原因: {} - {}", fileId, label, subLabel);
|
||||
// TODO: 更新数据库,发送站内信
|
||||
vlogService.updateVlogStatus(fileId,3,"等待复审");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 处理完成,返回成功,防止腾讯云重复发送回调
|
||||
return GraceJSONResult.ok();
|
||||
} catch (Exception e) {
|
||||
log.error("处理腾讯云 VOD 回调异常: ", e);
|
||||
return GraceJSONResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("publish")
|
||||
public GraceJSONResult publish(@RequestBody VlogBO vlogBO) throws Exception {
|
||||
String url = vlogBO.getUrl();
|
||||
log.info("未审核视频地址:"+url);
|
||||
String fileName = url.substring(url.lastIndexOf("/") + 1);
|
||||
log.info("视频文件名称:"+fileName);
|
||||
log.info("开始上传腾讯云点播:"+fileName);
|
||||
String fileId = qcCloud.uploadViaTempFile(fileName);
|
||||
log.info("视频发布ID:"+fileId);
|
||||
vlogBO.setFileId(fileId);
|
||||
// 删除minio文件
|
||||
// MinIOUtils.removeFile(minIOConfig.getBucketName(),fileName);
|
||||
// log.info("删除minio文件:"+fileName);
|
||||
|
||||
// FIXME 校验VlogBO
|
||||
vlogService.createVlog(vlogBO);
|
||||
|
||||
return GraceJSONResult.ok();
|
||||
}
|
||||
|
||||
@GetMapping("indexList")
|
||||
public GraceJSONResult indexList(@RequestParam(defaultValue = "") String userId,
|
||||
@RequestParam(defaultValue = "") String search,
|
||||
@RequestParam(defaultValue = "") String cityCode,
|
||||
@RequestParam(defaultValue = "") String status,
|
||||
@RequestParam Integer page,
|
||||
@RequestParam Integer pageSize) {
|
||||
|
||||
if (page == null) {
|
||||
page = COMMON_START_PAGE;
|
||||
}
|
||||
if (pageSize == null) {
|
||||
pageSize = COMMON_PAGE_SIZE;
|
||||
}
|
||||
|
||||
PagedGridResult gridResult = vlogService.getIndexVlogList(userId, search, cityCode,status, page, pageSize);
|
||||
return GraceJSONResult.ok(gridResult);
|
||||
}
|
||||
|
||||
@GetMapping("detail")
|
||||
public GraceJSONResult detail(@RequestParam(defaultValue = "") String userId,
|
||||
@RequestParam String vlogId) {
|
||||
return GraceJSONResult.ok(vlogService.getVlogDetailById(userId, vlogId));
|
||||
}
|
||||
@PostMapping("changeVlogStatus")
|
||||
public GraceJSONResult changeVlogStatus(@RequestParam String userId,
|
||||
@RequestParam String vlogId,
|
||||
@RequestParam Integer status) {
|
||||
vlogService.changeVlogStatus(userId, vlogId,status);
|
||||
return GraceJSONResult.ok();
|
||||
}
|
||||
|
||||
@PostMapping("changeToPrivate")
|
||||
public GraceJSONResult changeToPrivate(@RequestParam String userId,
|
||||
@RequestParam String vlogId) {
|
||||
vlogService.changeToPrivateOrPublic(userId,
|
||||
vlogId,
|
||||
YesOrNo.YES.type);
|
||||
return GraceJSONResult.ok();
|
||||
}
|
||||
|
||||
@PostMapping("changeToPublic")
|
||||
public GraceJSONResult changeToPublic(@RequestParam String userId,
|
||||
@RequestParam String vlogId) {
|
||||
vlogService.changeToPrivateOrPublic(userId,
|
||||
vlogId,
|
||||
YesOrNo.NO.type);
|
||||
return GraceJSONResult.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("myPublicList")
|
||||
public GraceJSONResult myPublicList(@RequestParam String userId,
|
||||
@RequestParam(defaultValue = "") String myId,
|
||||
@RequestParam Integer page,
|
||||
@RequestParam Integer pageSize) {
|
||||
|
||||
if (page == null) {
|
||||
page = COMMON_START_PAGE;
|
||||
}
|
||||
if (pageSize == null) {
|
||||
pageSize = COMMON_PAGE_SIZE;
|
||||
}
|
||||
|
||||
PagedGridResult gridResult = vlogService.queryMyVlogList(userId,
|
||||
myId,
|
||||
page,
|
||||
pageSize,
|
||||
YesOrNo.NO.type);
|
||||
return GraceJSONResult.ok(gridResult);
|
||||
}
|
||||
|
||||
@GetMapping("myPrivateList")
|
||||
public GraceJSONResult myPrivateList(@RequestParam String userId,
|
||||
@RequestParam(defaultValue = "") String myId,
|
||||
@RequestParam Integer page,
|
||||
@RequestParam Integer pageSize) {
|
||||
|
||||
if (page == null) {
|
||||
page = COMMON_START_PAGE;
|
||||
}
|
||||
if (pageSize == null) {
|
||||
pageSize = COMMON_PAGE_SIZE;
|
||||
}
|
||||
|
||||
PagedGridResult gridResult = vlogService.queryMyVlogList(userId,
|
||||
myId,
|
||||
page,
|
||||
pageSize,
|
||||
YesOrNo.YES.type);
|
||||
return GraceJSONResult.ok(gridResult);
|
||||
}
|
||||
|
||||
@GetMapping("myLikedList")
|
||||
public GraceJSONResult myLikedList(@RequestParam String userId,
|
||||
@RequestParam(defaultValue = "") String myId,
|
||||
@RequestParam Integer page,
|
||||
@RequestParam Integer pageSize) {
|
||||
|
||||
if (page == null) {
|
||||
page = COMMON_START_PAGE;
|
||||
}
|
||||
if (pageSize == null) {
|
||||
pageSize = COMMON_PAGE_SIZE;
|
||||
}
|
||||
|
||||
PagedGridResult gridResult = vlogService.getMyLikedVlogList(userId,
|
||||
myId,
|
||||
page,
|
||||
pageSize);
|
||||
return GraceJSONResult.ok(gridResult);
|
||||
}
|
||||
|
||||
@Value(("${nacos.counts}"))
|
||||
private Integer nacosConuts;
|
||||
|
||||
|
||||
@PostMapping("like")
|
||||
public GraceJSONResult like(@RequestParam String userId,
|
||||
@RequestParam String vlogerId,
|
||||
@RequestParam String vlogId) {
|
||||
|
||||
// 我点赞的视频,关联关系保存到数据库
|
||||
vlogService.userLikeVlog(userId, vlogId);
|
||||
|
||||
// 点赞后,视频和视频发布者的获赞都会 +1
|
||||
redis.increment(REDIS_VLOGER_BE_LIKED_COUNTS + ":" + vlogerId, 1);
|
||||
redis.increment(REDIS_VLOG_BE_LIKED_COUNTS + ":" + vlogId, 1);
|
||||
|
||||
// 我点赞的视频,需要在redis中保存关联关系
|
||||
redis.set(REDIS_USER_LIKE_VLOG + ":" + userId + ":" + vlogId, "1");
|
||||
|
||||
log.info("nacosConuts="+nacosConuts);
|
||||
|
||||
String countsStr = redis.get(REDIS_VLOG_BE_LIKED_COUNTS + ":" + vlogId);
|
||||
Integer counts=0;
|
||||
if (StringUtils.isNotBlank(countsStr)){
|
||||
|
||||
counts=Integer.valueOf(countsStr);
|
||||
if (counts>=nacosConuts){
|
||||
|
||||
vlogService.flushCounts(vlogId, counts);
|
||||
}
|
||||
}
|
||||
|
||||
return GraceJSONResult.ok();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("unlike")
|
||||
public GraceJSONResult unlike(@RequestParam String userId,
|
||||
@RequestParam String vlogerId,
|
||||
@RequestParam String vlogId) {
|
||||
|
||||
// 我取消点赞的视频,关联关系删除
|
||||
vlogService.userUnLikeVlog(userId, vlogId);
|
||||
|
||||
redis.decrement(REDIS_VLOGER_BE_LIKED_COUNTS + ":" + vlogerId, 1);
|
||||
redis.decrement(REDIS_VLOG_BE_LIKED_COUNTS + ":" + vlogId, 1);
|
||||
redis.del(REDIS_USER_LIKE_VLOG + ":" + userId + ":" + vlogId);
|
||||
|
||||
return GraceJSONResult.ok();
|
||||
}
|
||||
|
||||
@PostMapping("totalLikedCounts")
|
||||
public GraceJSONResult totalLikedCounts(@RequestParam String vlogId) {
|
||||
return GraceJSONResult.ok(vlogService.getVlogBeLikedCounts(vlogId));
|
||||
}
|
||||
|
||||
@GetMapping("followList")
|
||||
public GraceJSONResult followList(@RequestParam String myId,
|
||||
@RequestParam Integer page,
|
||||
@RequestParam Integer pageSize) {
|
||||
|
||||
if (page == null) {
|
||||
page = COMMON_START_PAGE;
|
||||
}
|
||||
if (pageSize == null) {
|
||||
pageSize = COMMON_PAGE_SIZE;
|
||||
}
|
||||
|
||||
PagedGridResult gridResult = vlogService.getMyFollowVlogList(myId,
|
||||
page,
|
||||
pageSize);
|
||||
return GraceJSONResult.ok(gridResult);
|
||||
}
|
||||
|
||||
@GetMapping("friendList")
|
||||
public GraceJSONResult friendList(@RequestParam String myId,
|
||||
@RequestParam Integer page,
|
||||
@RequestParam Integer pageSize) {
|
||||
|
||||
if (page == null) {
|
||||
page = COMMON_START_PAGE;
|
||||
}
|
||||
if (pageSize == null) {
|
||||
pageSize = COMMON_PAGE_SIZE;
|
||||
}
|
||||
|
||||
PagedGridResult gridResult = vlogService.getMyFriendVlogList(myId,
|
||||
page,
|
||||
pageSize);
|
||||
return GraceJSONResult.ok(gridResult);
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.wzj.soopin.consumer.content.intercepter;
|
||||
|
||||
import com.imooc.base.BaseInfoProperties;
|
||||
import com.imooc.exceptions.GraceException;
|
||||
import com.imooc.grace.result.ResponseStatusEnum;
|
||||
import com.imooc.utils.IPUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@Slf4j
|
||||
public class PassportInterceptor extends BaseInfoProperties implements HandlerInterceptor {
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request,
|
||||
HttpServletResponse response, Object handler) throws Exception {
|
||||
|
||||
// 获得用户的ip
|
||||
String userIp = IPUtil.getRequestIp(request);
|
||||
|
||||
// 得到是否存在的判断
|
||||
boolean keyIsExist = redis.keyIsExist(MOBILE_SMSCODE + ":" + userIp);
|
||||
|
||||
if (keyIsExist) {
|
||||
GraceException.display(ResponseStatusEnum.SMS_NEED_WAIT_ERROR);
|
||||
log.info("短信发送频率太大!");
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* true: 请求放行
|
||||
* false: 请求拦截
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.wzj.soopin.consumer.content.intercepter;
|
||||
|
||||
import com.imooc.base.BaseInfoProperties;
|
||||
import com.imooc.exceptions.GraceException;
|
||||
import com.imooc.grace.result.ResponseStatusEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@Slf4j
|
||||
public class UserTokenInterceptor extends BaseInfoProperties implements HandlerInterceptor {
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request,
|
||||
HttpServletResponse response, Object handler) throws Exception {
|
||||
|
||||
|
||||
// 从header中获得用户id和token
|
||||
String userId = request.getHeader("headerUserId");
|
||||
String userToken = request.getHeader("headerUserToken");
|
||||
|
||||
// 判断header中用户id和token不能为空
|
||||
if (StringUtils.isNotBlank(userId) && StringUtils.isNotBlank(userToken)) {
|
||||
String redisToken = redis.get(REDIS_USER_TOKEN + ":" + userId);
|
||||
if (StringUtils.isBlank(redisToken)) {
|
||||
GraceException.display(ResponseStatusEnum.UN_LOGIN);
|
||||
return false;
|
||||
} else {
|
||||
// 比较token是否一致,如果不一致,表示用户在别的手机端登录
|
||||
if (!redisToken.equalsIgnoreCase(userToken)) {
|
||||
GraceException.display(ResponseStatusEnum.TICKET_INVALID);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
GraceException.display(ResponseStatusEnum.UN_LOGIN);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* true: 请求放行
|
||||
* false: 请求拦截
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||
}
|
||||
}
|
105
ruoyi-front/ruoyi-manager/pom.xml
Normal file
105
ruoyi-front/ruoyi-manager/pom.xml
Normal file
@ -0,0 +1,105 @@
|
||||
<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/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-front</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-manager</artifactId>
|
||||
|
||||
<description>
|
||||
system系统模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-doc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-translation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- OSS功能模块 -->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-oss</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- excel-->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SMS功能模块 -->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-sms</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-tenant</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-idempotent</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-sensitive</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-encrypt</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-sse</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-system</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -1,4 +1,4 @@
|
||||
package org.dromara.system.controller.system;
|
||||
package com.wzj.soopin.manager.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.dromara.system.controller.system;
|
||||
package com.wzj.soopin.manager.system.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.dromara.common.core.domain.R;
|
@ -1,4 +1,4 @@
|
||||
package org.dromara.system.controller.system;
|
||||
package com.wzj.soopin.manager.system.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.convert.Convert;
|
@ -1,4 +1,4 @@
|
||||
package org.dromara.system.controller.system;
|
||||
package com.wzj.soopin.manager.system.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
@ -1,4 +1,4 @@
|
||||
package org.dromara.system.controller.system;
|
||||
package com.wzj.soopin.manager.system.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.dromara.common.core.domain.R;
|
@ -1,4 +1,4 @@
|
||||
package org.dromara.system.controller.system;
|
||||
package com.wzj.soopin.manager.system.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaCheckRole;
|
@ -1,4 +1,4 @@
|
||||
package org.dromara.system.controller.system;
|
||||
package com.wzj.soopin.manager.system.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import lombok.RequiredArgsConstructor;
|
@ -1,4 +1,4 @@
|
||||
package org.dromara.system.controller.system;
|
||||
package com.wzj.soopin.manager.system.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.dromara.common.core.domain.R;
|
@ -1,4 +1,4 @@
|
||||
package org.dromara.system.controller.system;
|
||||
package com.wzj.soopin.manager.system.controller;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
@ -1,4 +1,4 @@
|
||||
package org.dromara.system.controller.system;
|
||||
package com.wzj.soopin.manager.system.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
@ -1,4 +1,4 @@
|
||||
package org.dromara.system.controller.system;
|
||||
package com.wzj.soopin.manager.system.controller;
|
||||
|
||||
import cn.dev33.satoken.secure.BCrypt;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
@ -1,4 +1,4 @@
|
||||
package org.dromara.system.controller.system;
|
||||
package com.wzj.soopin.manager.system.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
@ -1,4 +1,4 @@
|
||||
package org.dromara.system.controller.system;
|
||||
package com.wzj.soopin.manager.system.controller;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
@ -1,4 +1,4 @@
|
||||
package org.dromara.system.controller.system;
|
||||
package com.wzj.soopin.manager.system.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaCheckRole;
|
@ -1,4 +1,4 @@
|
||||
package org.dromara.system.controller.system;
|
||||
package com.wzj.soopin.manager.system.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaCheckRole;
|
@ -1,4 +1,4 @@
|
||||
package org.dromara.system.controller.system;
|
||||
package com.wzj.soopin.manager.system.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.secure.BCrypt;
|
@ -15,6 +15,11 @@
|
||||
<module>ruoyi-job</module>
|
||||
<module>ruoyi-system</module>
|
||||
<module>ruoyi-workflow</module>
|
||||
<module>ruoyi-order</module>
|
||||
<module>ruoyi-goods</module>
|
||||
<module>ruoyi-member</module>
|
||||
<module>ruoyi-content</module>
|
||||
<module>ruoyi-im</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>ruoyi-modules</artifactId>
|
||||
|
102
ruoyi-modules/ruoyi-content/pom.xml
Normal file
102
ruoyi-modules/ruoyi-content/pom.xml
Normal file
@ -0,0 +1,102 @@
|
||||
<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/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-modules</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-content</artifactId>
|
||||
|
||||
<description>
|
||||
system系统模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-doc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-translation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- OSS功能模块 -->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-oss</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- excel-->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SMS功能模块 -->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-sms</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-tenant</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-idempotent</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-sensitive</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-encrypt</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-sse</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
@ -0,0 +1,32 @@
|
||||
package com.wzj.soopin.content.domain.bo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class CommentBO {
|
||||
|
||||
@NotBlank(message = "留言信息不完整")
|
||||
private String vlogerId;
|
||||
|
||||
@NotBlank(message = "留言信息不完整")
|
||||
private String fatherCommentId;
|
||||
|
||||
@NotBlank(message = "留言信息不完整")
|
||||
private String vlogId;
|
||||
|
||||
@NotBlank(message = "当前用户信息不正确,请尝试重新登录")
|
||||
private String commentUserId;
|
||||
|
||||
@NotBlank(message = "评论内容不能为空")
|
||||
@Length(max = 50, message = "评论内容长度不能超过50")
|
||||
private String content;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.wzj.soopin.content.domain.bo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 密码登陆中, 对前端数据映射的实体类.
|
||||
*
|
||||
* @author lzc
|
||||
* @version 1.0
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class LoginWithPasswordBO {
|
||||
|
||||
@NotBlank(message = "账号不能为空!")
|
||||
@Length(min = 5, max = 16, message = "账号格式不正确!")
|
||||
private String mobile;
|
||||
|
||||
@NotBlank(message = "密码不能为空!")
|
||||
@Length(min = 5, max = 16, message = "密码格式不正确!")
|
||||
private String password;
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.wzj.soopin.content.domain.bo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RegistLoginBO {
|
||||
|
||||
@NotBlank(message = "手机号不能为空")
|
||||
@Length(min = 11, max = 11, message = "手机长度不正确")
|
||||
private String mobile;
|
||||
@NotBlank(message = "验证码不能为空")
|
||||
private String smsCode;
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.wzj.soopin.content.domain.bo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class UpdatedUserBO {
|
||||
private String id;
|
||||
private String nickname;
|
||||
private String imoocNum;
|
||||
private String face;
|
||||
private Integer sex;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date birthday;
|
||||
private String country;
|
||||
private String province;
|
||||
private String city;
|
||||
private String district;
|
||||
private String description;
|
||||
private String bgImg;
|
||||
private Integer canImoocNumBeUpdated;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.wzj.soopin.content.domain.bo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class VlogBO {
|
||||
private String id;
|
||||
private String vlogerId;
|
||||
private String url;
|
||||
private String cover;
|
||||
private String title;
|
||||
private Integer width;
|
||||
private Integer height;
|
||||
private Integer likeCounts;
|
||||
private Integer commentsCounts;
|
||||
private String fileId;
|
||||
private Integer status;
|
||||
private String reason;
|
||||
private Integer cityCode;
|
||||
private String firstFrameImg;
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.wzj.soopin.content.domain.mo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
import org.springframework.data.mongodb.core.mapping.Field;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
@Document("message")
|
||||
public class MessageMO {
|
||||
|
||||
@Id
|
||||
private String id; // 消息主键id
|
||||
|
||||
@Field("fromUserId")
|
||||
private String fromUserId; // 消息来自的用户id
|
||||
@Field("fromNickname")
|
||||
private String fromNickname; // 消息来自的用户昵称
|
||||
@Field("fromFace")
|
||||
private String fromFace; // 消息来自的用户头像
|
||||
|
||||
@Field("toUserId")
|
||||
private String toUserId; // 消息发送到某对象的用户id
|
||||
|
||||
@Field("msgType")
|
||||
private Integer msgType; // 消息类型 枚举
|
||||
@Field("msgContent")
|
||||
private Map msgContent; // 消息内容
|
||||
|
||||
@Field("createTime")
|
||||
private Date createTime; // 消息创建时间
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.wzj.soopin.content.domain.mo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Token {
|
||||
/**
|
||||
* 访问token
|
||||
*/
|
||||
private String accessToken;
|
||||
|
||||
/**
|
||||
* 刷新token
|
||||
*/
|
||||
private String refreshToken;
|
||||
}
|
@ -0,0 +1,193 @@
|
||||
package com.wzj.soopin.content.domain.pojo;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.Date;
|
||||
|
||||
@Table(name="t_comment")
|
||||
public class Comment {
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 评论的视频是哪个作者(vloger)的关联id
|
||||
*/
|
||||
@Column(name = "vloger_id")
|
||||
private String vlogerId;
|
||||
|
||||
/**
|
||||
* 如果是回复留言,则本条为子留言,需要关联查询
|
||||
*/
|
||||
@Column(name = "father_comment_id")
|
||||
private String fatherCommentId;
|
||||
|
||||
/**
|
||||
* 回复的那个视频id
|
||||
*/
|
||||
@Column(name = "vlog_id")
|
||||
private String vlogId;
|
||||
|
||||
/**
|
||||
* 发布留言的用户id
|
||||
*/
|
||||
@Column(name = "comment_user_id")
|
||||
private String commentUserId;
|
||||
|
||||
/**
|
||||
* 留言内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 留言的点赞总数
|
||||
*/
|
||||
@Column(name = "like_counts")
|
||||
private Integer likeCounts;
|
||||
|
||||
/**
|
||||
* 留言时间
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* @return id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取评论的视频是哪个作者(vloger)的关联id
|
||||
*
|
||||
* @return vloger_id - 评论的视频是哪个作者(vloger)的关联id
|
||||
*/
|
||||
public String getVlogerId() {
|
||||
return vlogerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置评论的视频是哪个作者(vloger)的关联id
|
||||
*
|
||||
* @param vlogerId 评论的视频是哪个作者(vloger)的关联id
|
||||
*/
|
||||
public void setVlogerId(String vlogerId) {
|
||||
this.vlogerId = vlogerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取如果是回复留言,则本条为子留言,需要关联查询
|
||||
*
|
||||
* @return father_comment_id - 如果是回复留言,则本条为子留言,需要关联查询
|
||||
*/
|
||||
public String getFatherCommentId() {
|
||||
return fatherCommentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置如果是回复留言,则本条为子留言,需要关联查询
|
||||
*
|
||||
* @param fatherCommentId 如果是回复留言,则本条为子留言,需要关联查询
|
||||
*/
|
||||
public void setFatherCommentId(String fatherCommentId) {
|
||||
this.fatherCommentId = fatherCommentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取回复的那个视频id
|
||||
*
|
||||
* @return vlog_id - 回复的那个视频id
|
||||
*/
|
||||
public String getVlogId() {
|
||||
return vlogId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置回复的那个视频id
|
||||
*
|
||||
* @param vlogId 回复的那个视频id
|
||||
*/
|
||||
public void setVlogId(String vlogId) {
|
||||
this.vlogId = vlogId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发布留言的用户id
|
||||
*
|
||||
* @return comment_user_id - 发布留言的用户id
|
||||
*/
|
||||
public String getCommentUserId() {
|
||||
return commentUserId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置发布留言的用户id
|
||||
*
|
||||
* @param commentUserId 发布留言的用户id
|
||||
*/
|
||||
public void setCommentUserId(String commentUserId) {
|
||||
this.commentUserId = commentUserId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取留言内容
|
||||
*
|
||||
* @return content - 留言内容
|
||||
*/
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置留言内容
|
||||
*
|
||||
* @param content 留言内容
|
||||
*/
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取留言的点赞总数
|
||||
*
|
||||
* @return like_counts - 留言的点赞总数
|
||||
*/
|
||||
public Integer getLikeCounts() {
|
||||
return likeCounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置留言的点赞总数
|
||||
*
|
||||
* @param likeCounts 留言的点赞总数
|
||||
*/
|
||||
public void setLikeCounts(Integer likeCounts) {
|
||||
this.likeCounts = likeCounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取留言时间
|
||||
*
|
||||
* @return create_time - 留言时间
|
||||
*/
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置留言时间
|
||||
*
|
||||
* @param createTime 留言时间
|
||||
*/
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
package com.wzj.soopin.content.domain.pojo;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Table;
|
||||
import java.util.Date;
|
||||
|
||||
@Table(name = "t_fans")
|
||||
public class Fans {
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 作家用户id
|
||||
*/
|
||||
@Column(name = "vloger_id")
|
||||
private String vlogerId;
|
||||
|
||||
@Column(name = "created_time")
|
||||
private Date createdTime;
|
||||
|
||||
|
||||
/**
|
||||
* 粉丝用户id
|
||||
*/
|
||||
@Column(name = "fan_id")
|
||||
private String fanId;
|
||||
|
||||
/**
|
||||
* 粉丝是否是vloger的朋友,如果成为朋友,则本表的双方此字段都需要设置为1,如果有一人取关,则两边都需要设置为0
|
||||
*/
|
||||
@Column(name = "is_fan_friend_of_mine")
|
||||
private Integer isFanFriendOfMine;
|
||||
|
||||
/**
|
||||
* @return id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取作家用户id
|
||||
*
|
||||
* @return vloger_id - 作家用户id
|
||||
*/
|
||||
public String getVlogerId() {
|
||||
return vlogerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置作家用户id
|
||||
*
|
||||
* @param vlogerId 作家用户id
|
||||
*/
|
||||
public void setVlogerId(String vlogerId) {
|
||||
this.vlogerId = vlogerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取粉丝用户id
|
||||
*
|
||||
* @return fan_id - 粉丝用户id
|
||||
*/
|
||||
public String getFanId() {
|
||||
return fanId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置粉丝用户id
|
||||
*
|
||||
* @param fanId 粉丝用户id
|
||||
*/
|
||||
public void setFanId(String fanId) {
|
||||
this.fanId = fanId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取粉丝是否是vloger的朋友,如果成为朋友,则本表的双方此字段都需要设置为1,如果有一人取关,则两边都需要设置为0
|
||||
*
|
||||
* @return is_fan_friend_of_mine - 粉丝是否是vloger的朋友,如果成为朋友,则本表的双方此字段都需要设置为1,如果有一人取关,则两边都需要设置为0
|
||||
*/
|
||||
public Integer getIsFanFriendOfMine() {
|
||||
return isFanFriendOfMine;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置粉丝是否是vloger的朋友,如果成为朋友,则本表的双方此字段都需要设置为1,如果有一人取关,则两边都需要设置为0
|
||||
*
|
||||
* @param isFanFriendOfMine 粉丝是否是vloger的朋友,如果成为朋友,则本表的双方此字段都需要设置为1,如果有一人取关,则两边都需要设置为0
|
||||
*/
|
||||
public void setIsFanFriendOfMine(Integer isFanFriendOfMine) {
|
||||
this.isFanFriendOfMine = isFanFriendOfMine;
|
||||
}
|
||||
|
||||
public void setCreateTime() {
|
||||
}
|
||||
|
||||
public Date getCreatedTime() {
|
||||
return createdTime;
|
||||
}
|
||||
|
||||
public void setCreatedTime(Date createdTime) {
|
||||
this.createdTime = createdTime;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
package com.wzj.soopin.content.domain.pojo;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Table;
|
||||
import java.util.Date;
|
||||
|
||||
@Table(name = "t_my_liked_vlog")
|
||||
public class MyLikedVlog {
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Column(name = "user_id")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 喜欢的短视频id
|
||||
*/
|
||||
@Column(name = "vlog_id")
|
||||
private String vlogId;
|
||||
|
||||
@Column(name = "created_time")
|
||||
private Date createdTime;
|
||||
|
||||
/**
|
||||
* @return id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户id
|
||||
*
|
||||
* @return user_id - 用户id
|
||||
*/
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户id
|
||||
*
|
||||
* @param userId 用户id
|
||||
*/
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取喜欢的短视频id
|
||||
*
|
||||
* @return vlog_id - 喜欢的短视频id
|
||||
*/
|
||||
public String getVlogId() {
|
||||
return vlogId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置喜欢的短视频id
|
||||
*
|
||||
* @param vlogId 喜欢的短视频id
|
||||
*/
|
||||
public void setVlogId(String vlogId) {
|
||||
this.vlogId = vlogId;
|
||||
}
|
||||
|
||||
|
||||
public void setCreatedTime(Date date) {
|
||||
this.createdTime = date;
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.wzj.soopin.content.domain.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Table(name = "r_user_member")
|
||||
public class UserMember {
|
||||
private String userId;
|
||||
private String memberId;
|
||||
}
|
@ -0,0 +1,387 @@
|
||||
package com.wzj.soopin.content.domain.pojo;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.Date;
|
||||
|
||||
@Table(name="t_users")
|
||||
public class Users {
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String mobile;
|
||||
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 昵称,媒体号
|
||||
*/
|
||||
private String nickname;
|
||||
|
||||
|
||||
/**
|
||||
* 慕课号,类似头条号,抖音号,公众号,唯一标识,需要限制修改次数,比如终生1次,每年1次,每半年1次等,可以用于付费修改。
|
||||
*/
|
||||
@Column(name = "imooc_num")
|
||||
private String imoocNum;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
private String face;
|
||||
|
||||
/**
|
||||
* 性别 1:男 0:女 2:保密
|
||||
*/
|
||||
private Integer sex;
|
||||
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
private Date birthday;
|
||||
|
||||
/**
|
||||
* 国家
|
||||
*/
|
||||
private String country;
|
||||
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 区县
|
||||
*/
|
||||
private String district;
|
||||
|
||||
/**
|
||||
* 简介
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 个人介绍的背景图
|
||||
*/
|
||||
@Column(name = "bg_img")
|
||||
private String bgImg;
|
||||
|
||||
/**
|
||||
* 慕课号能否被修改,1:默认,可以修改;0,无法修改
|
||||
*/
|
||||
@Column(name = "can_imooc_num_be_updated")
|
||||
private Integer canImoocNumBeUpdated;
|
||||
|
||||
/**
|
||||
* 创建时间 创建时间
|
||||
*/
|
||||
@Column(name = "created_time")
|
||||
private Date createdTime;
|
||||
|
||||
/**
|
||||
* 更新时间 更新时间
|
||||
*/
|
||||
@Column(name = "updated_time")
|
||||
private Date updatedTime;
|
||||
|
||||
/**
|
||||
* @return id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取手机号
|
||||
*
|
||||
* @return mobile - 手机号
|
||||
*/
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置手机号
|
||||
*
|
||||
* @param mobile 手机号
|
||||
*/
|
||||
public void setMobile(String mobile) {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取昵称,媒体号
|
||||
*
|
||||
* @return nickname - 昵称,媒体号
|
||||
*/
|
||||
public String getNickname() {
|
||||
return nickname;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置昵称,媒体号
|
||||
*
|
||||
* @param nickname 昵称,媒体号
|
||||
*/
|
||||
public void setNickname(String nickname) {
|
||||
this.nickname = nickname;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取慕课号,类似头条号,抖音号,公众号,唯一标识,需要限制修改次数,比如终生1次,每年1次,每半年1次等,可以用于付费修改。
|
||||
*
|
||||
* @return imooc_num - 慕课号,类似头条号,抖音号,公众号,唯一标识,需要限制修改次数,比如终生1次,每年1次,每半年1次等,可以用于付费修改。
|
||||
*/
|
||||
public String getImoocNum() {
|
||||
return imoocNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置慕课号,类似头条号,抖音号,公众号,唯一标识,需要限制修改次数,比如终生1次,每年1次,每半年1次等,可以用于付费修改。
|
||||
*
|
||||
* @param imoocNum 慕课号,类似头条号,抖音号,公众号,唯一标识,需要限制修改次数,比如终生1次,每年1次,每半年1次等,可以用于付费修改。
|
||||
*/
|
||||
public void setImoocNum(String imoocNum) {
|
||||
this.imoocNum = imoocNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取头像
|
||||
*
|
||||
* @return face - 头像
|
||||
*/
|
||||
public String getFace() {
|
||||
return face;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置头像
|
||||
*
|
||||
* @param face 头像
|
||||
*/
|
||||
public void setFace(String face) {
|
||||
this.face = face;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取性别 1:男 0:女 2:保密
|
||||
*
|
||||
* @return sex - 性别 1:男 0:女 2:保密
|
||||
*/
|
||||
public Integer getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置性别 1:男 0:女 2:保密
|
||||
*
|
||||
* @param sex 性别 1:男 0:女 2:保密
|
||||
*/
|
||||
public void setSex(Integer sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取生日
|
||||
*
|
||||
* @return birthday - 生日
|
||||
*/
|
||||
public Date getBirthday() {
|
||||
return birthday;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置生日
|
||||
*
|
||||
* @param birthday 生日
|
||||
*/
|
||||
public void setBirthday(Date birthday) {
|
||||
this.birthday = birthday;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取国家
|
||||
*
|
||||
* @return country - 国家
|
||||
*/
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置国家
|
||||
*
|
||||
* @param country 国家
|
||||
*/
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取省份
|
||||
*
|
||||
* @return province - 省份
|
||||
*/
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置省份
|
||||
*
|
||||
* @param province 省份
|
||||
*/
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取城市
|
||||
*
|
||||
* @return city - 城市
|
||||
*/
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置城市
|
||||
*
|
||||
* @param city 城市
|
||||
*/
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取区县
|
||||
*
|
||||
* @return district - 区县
|
||||
*/
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置区县
|
||||
*
|
||||
* @param district 区县
|
||||
*/
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取简介
|
||||
*
|
||||
* @return description - 简介
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置简介
|
||||
*
|
||||
* @param description 简介
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取个人介绍的背景图
|
||||
*
|
||||
* @return bg_img - 个人介绍的背景图
|
||||
*/
|
||||
public String getBgImg() {
|
||||
return bgImg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置个人介绍的背景图
|
||||
*
|
||||
* @param bgImg 个人介绍的背景图
|
||||
*/
|
||||
public void setBgImg(String bgImg) {
|
||||
this.bgImg = bgImg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取慕课号能否被修改,1:默认,可以修改;0,无法修改
|
||||
*
|
||||
* @return can_imooc_num_be_updated - 慕课号能否被修改,1:默认,可以修改;0,无法修改
|
||||
*/
|
||||
public Integer getCanImoocNumBeUpdated() {
|
||||
return canImoocNumBeUpdated;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置慕课号能否被修改,1:默认,可以修改;0,无法修改
|
||||
*
|
||||
* @param canImoocNumBeUpdated 慕课号能否被修改,1:默认,可以修改;0,无法修改
|
||||
*/
|
||||
public void setCanImoocNumBeUpdated(Integer canImoocNumBeUpdated) {
|
||||
this.canImoocNumBeUpdated = canImoocNumBeUpdated;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取创建时间 创建时间
|
||||
*
|
||||
* @return created_time - 创建时间 创建时间
|
||||
*/
|
||||
public Date getCreatedTime() {
|
||||
return createdTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置创建时间 创建时间
|
||||
*
|
||||
* @param createdTime 创建时间 创建时间
|
||||
*/
|
||||
public void setCreatedTime(Date createdTime) {
|
||||
this.createdTime = createdTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取更新时间 更新时间
|
||||
*
|
||||
* @return updated_time - 更新时间 更新时间
|
||||
*/
|
||||
public Date getUpdatedTime() {
|
||||
return updatedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置更新时间 更新时间
|
||||
*
|
||||
* @param updatedTime 更新时间 更新时间
|
||||
*/
|
||||
public void setUpdatedTime(Date updatedTime) {
|
||||
this.updatedTime = updatedTime;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
}
|
@ -0,0 +1,361 @@
|
||||
package com.wzj.soopin.content.domain.pojo;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.Date;
|
||||
|
||||
@Table(name="t_vlog")
|
||||
public class Vlog {
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 对应用户表id,vlog视频发布者
|
||||
*/
|
||||
@Column(name = "vloger_id")
|
||||
private String vlogerId;
|
||||
|
||||
/**
|
||||
* 视频播放地址
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 视频封面
|
||||
*/
|
||||
private String cover;
|
||||
|
||||
/**
|
||||
* 视频标题,可以为空
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 视频width
|
||||
*/
|
||||
private Integer width;
|
||||
|
||||
/**
|
||||
* 视频height
|
||||
*/
|
||||
private Integer height;
|
||||
|
||||
/**
|
||||
* 点赞总数
|
||||
*/
|
||||
@Column(name = "like_counts")
|
||||
private Integer likeCounts;
|
||||
|
||||
/**
|
||||
* 评论总数
|
||||
*/
|
||||
@Column(name = "comments_counts")
|
||||
private Integer commentsCounts;
|
||||
|
||||
/**
|
||||
* 是否私密,用户可以设置私密,如此可以不公开给比人看
|
||||
*/
|
||||
@Column(name = "is_private")
|
||||
private Integer isPrivate;
|
||||
|
||||
/**
|
||||
* 创建时间 创建时间
|
||||
*/
|
||||
@Column(name = "created_time")
|
||||
private Date createdTime;
|
||||
|
||||
/**
|
||||
* 更新时间 更新时间
|
||||
*/
|
||||
@Column(name = "updated_time")
|
||||
private Date updatedTime;
|
||||
|
||||
/**
|
||||
* 视频状态
|
||||
*/
|
||||
@Column(name = "status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 云点播文件ID
|
||||
*/
|
||||
@Column(name = "file_id")
|
||||
private String fileId;
|
||||
|
||||
/**
|
||||
* 审核结果
|
||||
*/
|
||||
@Column(name = "reason")
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 视频归属地
|
||||
*/
|
||||
@Column(name = "city_code")
|
||||
private Integer cityCode;
|
||||
|
||||
/**
|
||||
* 首帧图
|
||||
*/
|
||||
@Column(name = "first_frame_img")
|
||||
private String firstFrameImg;
|
||||
|
||||
/**
|
||||
* @return id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对应用户表id,vlog视频发布者
|
||||
*
|
||||
* @return vloger_id - 对应用户表id,vlog视频发布者
|
||||
*/
|
||||
public String getVlogerId() {
|
||||
return vlogerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置对应用户表id,vlog视频发布者
|
||||
*
|
||||
* @param vlogerId 对应用户表id,vlog视频发布者
|
||||
*/
|
||||
public void setVlogerId(String vlogerId) {
|
||||
this.vlogerId = vlogerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取视频播放地址
|
||||
*
|
||||
* @return url - 视频播放地址
|
||||
*/
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置视频播放地址
|
||||
*
|
||||
* @param url 视频播放地址
|
||||
*/
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取视频封面
|
||||
*
|
||||
* @return cover - 视频封面
|
||||
*/
|
||||
public String getCover() {
|
||||
return cover;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置视频封面
|
||||
*
|
||||
* @param cover 视频封面
|
||||
*/
|
||||
public void setCover(String cover) {
|
||||
this.cover = cover;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取视频标题,可以为空
|
||||
*
|
||||
* @return title - 视频标题,可以为空
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置视频标题,可以为空
|
||||
*
|
||||
* @param title 视频标题,可以为空
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取视频width
|
||||
*
|
||||
* @return width - 视频width
|
||||
*/
|
||||
public Integer getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置视频width
|
||||
*
|
||||
* @param width 视频width
|
||||
*/
|
||||
public void setWidth(Integer width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取视频height
|
||||
*
|
||||
* @return height - 视频height
|
||||
*/
|
||||
public Integer getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置视频height
|
||||
*
|
||||
* @param height 视频height
|
||||
*/
|
||||
public void setHeight(Integer height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取点赞总数
|
||||
*
|
||||
* @return like_counts - 点赞总数
|
||||
*/
|
||||
public Integer getLikeCounts() {
|
||||
return likeCounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置点赞总数
|
||||
*
|
||||
* @param likeCounts 点赞总数
|
||||
*/
|
||||
public void setLikeCounts(Integer likeCounts) {
|
||||
this.likeCounts = likeCounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取评论总数
|
||||
*
|
||||
* @return comments_counts - 评论总数
|
||||
*/
|
||||
public Integer getCommentsCounts() {
|
||||
return commentsCounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置评论总数
|
||||
*
|
||||
* @param commentsCounts 评论总数
|
||||
*/
|
||||
public void setCommentsCounts(Integer commentsCounts) {
|
||||
this.commentsCounts = commentsCounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取是否私密,用户可以设置私密,如此可以不公开给比人看
|
||||
*
|
||||
* @return is_private - 是否私密,用户可以设置私密,如此可以不公开给比人看
|
||||
*/
|
||||
public Integer getIsPrivate() {
|
||||
return isPrivate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否私密,用户可以设置私密,如此可以不公开给比人看
|
||||
*
|
||||
* @param isPrivate 是否私密,用户可以设置私密,如此可以不公开给比人看
|
||||
*/
|
||||
public void setIsPrivate(Integer isPrivate) {
|
||||
this.isPrivate = isPrivate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取创建时间 创建时间
|
||||
*
|
||||
* @return created_time - 创建时间 创建时间
|
||||
*/
|
||||
public Date getCreatedTime() {
|
||||
return createdTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置创建时间 创建时间
|
||||
*
|
||||
* @param createdTime 创建时间 创建时间
|
||||
*/
|
||||
public void setCreatedTime(Date createdTime) {
|
||||
this.createdTime = createdTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取更新时间 更新时间
|
||||
*
|
||||
* @return updated_time - 更新时间 更新时间
|
||||
*/
|
||||
public Date getUpdatedTime() {
|
||||
return updatedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置更新时间 更新时间
|
||||
*
|
||||
* @param updatedTime 更新时间 更新时间
|
||||
*/
|
||||
public void setUpdatedTime(Date updatedTime) {
|
||||
this.updatedTime = updatedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置视频状态
|
||||
*/
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置视频状态
|
||||
*/
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getFileId() {
|
||||
return fileId;
|
||||
}
|
||||
|
||||
public void setFileId(String fileId) {
|
||||
this.fileId = fileId;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public Integer getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public void setCityCode(Integer cityCode) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public String getFirstFrameImg() {
|
||||
return firstFrameImg;
|
||||
}
|
||||
|
||||
public void setFirstFrameImg(String firstFrameImg) {
|
||||
this.firstFrameImg = firstFrameImg;
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.wzj.soopin.content.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class CommentVO {
|
||||
private String id;
|
||||
private String commentId;
|
||||
private String vlogerId;
|
||||
private String fatherCommentId;
|
||||
private String vlogId;
|
||||
private String commentUserId;
|
||||
private String commentUserNickname;
|
||||
private String commentUserFace;
|
||||
private String content;
|
||||
private Integer likeCounts;
|
||||
private String replyedUserNickname;
|
||||
private Date createTime;
|
||||
private Integer isLike = 0;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.wzj.soopin.content.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class FansVO {
|
||||
private String fanId;
|
||||
private String nickname;
|
||||
private String face;
|
||||
private boolean isFriend = false;
|
||||
private int bothFriend;
|
||||
private String createdTime;
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.wzj.soopin.content.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class IndexVlogVO {
|
||||
private String vlogId;
|
||||
private String vlogerId;
|
||||
private String vlogerFace;
|
||||
private String vlogerName;
|
||||
private String content;
|
||||
private String url;
|
||||
private String cover;
|
||||
private Integer width;
|
||||
private Integer height;
|
||||
private Integer likeCounts;
|
||||
private Integer commentsCounts;
|
||||
private Integer isPrivate;
|
||||
private boolean isPlay = false;
|
||||
private boolean doIFollowVloger = false;
|
||||
private boolean doILikeThisVlog = false;
|
||||
private Integer status;
|
||||
private String reason;
|
||||
private Integer cityCode;
|
||||
private String fileId;
|
||||
private String firstFrameImg;
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.wzj.soopin.content.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class UsersVO {
|
||||
private String id;
|
||||
private String mobile;
|
||||
private String nickname;
|
||||
private String imoocNum;
|
||||
private String face;
|
||||
private Integer sex;
|
||||
private Date birthday;
|
||||
private String country;
|
||||
private String province;
|
||||
private String city;
|
||||
private String district;
|
||||
private String description;
|
||||
private String bgImg;
|
||||
private Integer canImoocNumBeUpdated;
|
||||
private Date createdTime;
|
||||
private Date updatedTime;
|
||||
|
||||
private String userToken; // 用户token,传递给前端
|
||||
|
||||
private Integer myFollowsCounts; // 我关注的
|
||||
private Integer myFansCounts; // 我的粉丝数量
|
||||
// private Integer myLikedVlogCounts;
|
||||
private Integer totalLikeMeCounts;
|
||||
//private Token shopToken;
|
||||
|
||||
private boolean IsFollowed; // 关注状态
|
||||
private String FollowStatus; // 关注状态
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.wzj.soopin.content.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class VlogerVO {
|
||||
private String vlogerId;
|
||||
private String nickname;
|
||||
private String face;
|
||||
private boolean isFollowed = true;
|
||||
private int bothFriend;
|
||||
private String createdTime;
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.wzj.soopin.content.mapper.mapper;
|
||||
|
||||
import com.imooc.pojo.Comment;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface CommentMapper extends MyMapper<Comment> {
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.wzj.soopin.content.mapper.mapper;
|
||||
|
||||
import com.imooc.vo.CommentVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Repository
|
||||
public interface CommentMapperCustom {
|
||||
|
||||
public List<CommentVO> getCommentList(@Param("paramMap") Map<String, Object> map);
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.wzj.soopin.content.mapper.mapper;
|
||||
|
||||
import com.imooc.pojo.Fans;
|
||||
import com.imooc.vo.VlogerVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
//@Repository
|
||||
//public interface FansMapper extends MyMapper<Fans> {
|
||||
// int updateByPrimaryKeySelective(Fans record);
|
||||
//
|
||||
//
|
||||
// @Select("<script> " +
|
||||
// "SELECT vloger_id, is_fan_friend_of_mine FROM t_fans " +
|
||||
// "WHERE fan_id = #{currentUserId} " +
|
||||
// "AND vloger_id IN " +
|
||||
// "<foreach collection='vlogerIds' item='vlogerId' open='(' separator=',' close=')'> " +
|
||||
// "#{vlogerId} " +
|
||||
// "</foreach> " +
|
||||
// "</script>")
|
||||
// List<Map<String, Object>> getFollowedVlogerIds(@Param("currentUserId")String currentUserId,@Param("vlogerIds")List<String> vlogerIds);
|
||||
//// Set<String> getFollowedVlogerIds(
|
||||
//// @Param("currentUserId") String currentUserId,
|
||||
//// @Param("vlogerIds") List<String> vlogerIds
|
||||
//// );
|
||||
//
|
||||
//}
|
||||
|
||||
@Repository
|
||||
public interface FansMapper {
|
||||
int updateByPrimaryKeySelective(Fans record);
|
||||
public List<Map<String, Object>> getFollowedVlogerIds(@Param("currentUserId")String currentUserId,@Param("vlogerIds")List<String> vlogerIds);
|
||||
|
||||
int insert(@Param("fansData") Map<String, Object> vlogData);
|
||||
|
||||
public List<VlogerVO> selectByExample(@Param("paramMap") Map<String, Object> map);
|
||||
|
||||
int delete(@Param("id") String id);
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.wzj.soopin.content.mapper.mapper;
|
||||
|
||||
import com.imooc.pojo.Fans;
|
||||
import com.imooc.vo.FansVO;
|
||||
import com.imooc.vo.VlogerVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Repository
|
||||
public interface FansMapperCustom extends MyMapper<Fans> {
|
||||
|
||||
public List<VlogerVO> queryMyFollows(@Param("paramMap") Map<String, Object> map);
|
||||
|
||||
public List<FansVO> queryMyFans(@Param("paramMap") Map<String, Object> map);
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.wzj.soopin.content.mapper.mapper;
|
||||
|
||||
import com.imooc.pojo.MyLikedVlog;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface MyLikedVlogMapper extends MyMapper<MyLikedVlog> {
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014-2016 abel533@gmail.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.wzj.soopin.content.mapper.mapper;
|
||||
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
import tk.mybatis.mapper.common.MySqlMapper;
|
||||
|
||||
/**
|
||||
* 继承自己的MyMapper
|
||||
*/
|
||||
public interface MyMapper<T> extends Mapper<T>, MySqlMapper<T> {
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.wzj.soopin.content.mapper.mapper;
|
||||
|
||||
import com.imooc.pojo.UserMember;
|
||||
import com.imooc.pojo.Users;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 短视频用户与商城会员数据处理层
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserMemberMapper extends MyMapper<UserMember> {
|
||||
|
||||
Users getUserByMemberId(String memberId);
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.wzj.soopin.content.mapper.mapper;
|
||||
|
||||
import com.imooc.bo.UpdatedUserBO;
|
||||
import com.imooc.pojo.Users;
|
||||
import com.imooc.vo.UsersVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface UsersMapper extends MyMapper<Users> {
|
||||
|
||||
@Select("SELECT * FROM t_users WHERE nickname LIKE CONCAT('%', #{nickname}, '%')")
|
||||
List<UsersVO> searchByNickname(String nickname);
|
||||
@Update("UPDATE t_users SET nickname = #{nickname} WHERE id = #{id}")
|
||||
int updateNickname(UpdatedUserBO user);
|
||||
@Update("UPDATE t_users SET sex = #{sex} WHERE id = #{id}")
|
||||
int updateSex(UpdatedUserBO user);
|
||||
@Update("UPDATE t_users SET birthday = #{birthday} WHERE id = #{id}")
|
||||
int updateBirthday(UpdatedUserBO user);
|
||||
@Update("UPDATE t_users SET description = #{description} WHERE id = #{id}")
|
||||
int updateDescription(UpdatedUserBO user);
|
||||
@Update("UPDATE t_users SET province = #{province},city = #{city},district = #{district} WHERE id = #{id}")
|
||||
int updateLocation(UpdatedUserBO user);
|
||||
@Update("UPDATE t_users SET imooc_num = #{imoocNum},can_imooc_num_be_updated = 0 WHERE id = #{id}")
|
||||
int updateVnum(UpdatedUserBO user);
|
||||
@Select("SELECT * FROM t_users WHERE imooc_num = #{imoocNum}")
|
||||
List<UsersVO> selectByImoocNum(@Param("imoocNum") String imoocNum);
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package com.wzj.soopin.content.mapper.mapper;
|
||||
|
||||
import com.imooc.vo.IndexVlogVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
//@Repository
|
||||
//public interface VlogMapper extends MyMapper<Vlog> {
|
||||
//}
|
||||
@Repository
|
||||
public interface VlogMapper {
|
||||
// public List<IndexVlogVO> updateVlogStatus(@Param("paramMap") Map<String, Object> map);
|
||||
/**
|
||||
* 通用动态更新方法
|
||||
* @param primaryKey 主键字段名
|
||||
* @param idValue 主键值
|
||||
* @param updateFields 待更新的字段Map(key=字段名, value=字段值)
|
||||
* @return 影响的行数
|
||||
*/
|
||||
int dynamicUpdate(
|
||||
@Param("primaryKey") String primaryKey,
|
||||
@Param("idValue") Object idValue,
|
||||
@Param("updateFields") Map<String, Object> updateFields
|
||||
);
|
||||
|
||||
/**
|
||||
* Vlog表多条件动态更新
|
||||
* @param updateFields 需要更新的字段及值(Map结构)
|
||||
* @param conditions 更新条件(Map结构)
|
||||
* @return 受影响的行数
|
||||
*/
|
||||
int updateVlogByConditions(
|
||||
@Param("updates") Map<String, Object> updateFields,
|
||||
@Param("conditions") Map<String, Object> conditions
|
||||
);
|
||||
|
||||
/**
|
||||
* 单条插入vlog记录
|
||||
* @param vlogData 插入数据的键值对(key=列名, value=列值)
|
||||
* @return 影响的行数
|
||||
*/
|
||||
int dynamicInsert(@Param("vlogData") Map<String, Object> vlogData);
|
||||
|
||||
/**
|
||||
* 批量插入vlog记录
|
||||
* @param vlogList 插入数据列表(每个Map代表一行数据)
|
||||
* @return 影响的行数
|
||||
*/
|
||||
int dynamicBatchInsert(@Param("vlogList") List<Map<String, Object>> vlogList);
|
||||
|
||||
public List<IndexVlogVO> selectMyPublic(@Param("paramMap")Map<String, Object> map);
|
||||
public List<IndexVlogVO> getVlogDetailFromId(@Param("paramMap")Map<String, Object> map);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.wzj.soopin.content.mapper.mapper;
|
||||
|
||||
import com.imooc.vo.IndexVlogVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Repository
|
||||
public interface VlogMapperCustom {
|
||||
|
||||
public List<IndexVlogVO> getIndexVlogList(@Param("paramMap")Map<String, Object> map);
|
||||
|
||||
public List<IndexVlogVO> getVlogDetailById(@Param("paramMap")Map<String, Object> map);
|
||||
|
||||
public List<IndexVlogVO> getMyLikedVlogList(@Param("paramMap")Map<String, Object> map);
|
||||
|
||||
public List<IndexVlogVO> getMyFollowVlogList(@Param("paramMap")Map<String, Object> map);
|
||||
|
||||
public List<IndexVlogVO> getMyFriendVlogList(@Param("paramMap")Map<String, Object> map);
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.wzj.soopin.content.mapper.repository;
|
||||
|
||||
import com.imooc.mo.MessageMO;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface MessageRepository extends MongoRepository<MessageMO, String> {
|
||||
|
||||
// 通过实现Repository,自定义条件查询
|
||||
List<MessageMO> findAllByToUserIdEqualsOrderByCreateTimeDesc(String toUserId,
|
||||
Pageable pageable);
|
||||
// void deleteAllByFromUserIdAndToUserIdAndMsgType();
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.wzj.soopin.content.service;
|
||||
|
||||
import com.imooc.bo.CommentBO;
|
||||
import com.imooc.pojo.Comment;
|
||||
import com.imooc.utils.PagedGridResult;
|
||||
import com.imooc.vo.CommentVO;
|
||||
|
||||
public interface CommentService {
|
||||
|
||||
/**
|
||||
* 发表评论
|
||||
*/
|
||||
public CommentVO createComment(CommentBO commentBO);
|
||||
|
||||
/**
|
||||
* 查询评论的列表
|
||||
*/
|
||||
public PagedGridResult queryVlogComments(String vlogId,
|
||||
String userId,
|
||||
Integer page,
|
||||
Integer pageSize);
|
||||
|
||||
/**
|
||||
* 删除评论
|
||||
*/
|
||||
public void deleteComment(String commentUserId,
|
||||
String commentId,
|
||||
String vlogId);
|
||||
|
||||
/**
|
||||
* 根据主键查询comment
|
||||
*/
|
||||
public Comment getComment(String id);
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.wzj.soopin.content.service;
|
||||
|
||||
import com.imooc.utils.PagedGridResult;
|
||||
|
||||
public interface FansService {
|
||||
|
||||
/**
|
||||
* 关注
|
||||
*/
|
||||
public void doFollow(String myId, String vlogerId);
|
||||
|
||||
/**
|
||||
* 取关
|
||||
*/
|
||||
public void doCancel(String myId, String vlogerId);
|
||||
|
||||
/**
|
||||
* 查询用户是否关注博主
|
||||
*/
|
||||
public boolean queryDoIFollowVloger(String myId, String vlogerId);
|
||||
|
||||
/**
|
||||
* 查询我关注的博主列表
|
||||
*/
|
||||
public PagedGridResult queryMyFollows(String myId,
|
||||
Integer page,
|
||||
Integer pageSize);
|
||||
|
||||
/**
|
||||
* 查询我的粉丝列表
|
||||
*/
|
||||
public PagedGridResult queryMyFans(String myId,
|
||||
Integer page,
|
||||
Integer pageSize);
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.wzj.soopin.content.service;
|
||||
|
||||
import com.imooc.mo.MessageMO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface MsgService {
|
||||
|
||||
/**
|
||||
* 创建消息
|
||||
*/
|
||||
public void createMsg(String fromUserId,
|
||||
String toUserId,
|
||||
Integer type,
|
||||
Map msgContent);
|
||||
|
||||
/**
|
||||
* 查询消息列表
|
||||
*/
|
||||
public List<MessageMO> queryList(String toUserId,
|
||||
Integer page,
|
||||
Integer pageSize);
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.wzj.soopin.content.service;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 短视频用户与商城会员业务层
|
||||
*/
|
||||
public interface UserMemberService {
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package com.wzj.soopin.content.service;
|
||||
|
||||
import com.imooc.bo.UpdatedUserBO;
|
||||
import com.imooc.mo.Token;
|
||||
import com.imooc.pojo.Users;
|
||||
import com.imooc.vo.UsersVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author vercen
|
||||
* @version 1.0
|
||||
* @date 2023/5/25 21:02
|
||||
*/
|
||||
public interface UserService {
|
||||
/**
|
||||
* 判断用户是否存在,如果存在则返回用户信息
|
||||
*/
|
||||
public Users queryMobileIsExist(String mobile);
|
||||
|
||||
/**
|
||||
* 创建用户信息,并且返回用户对象
|
||||
*/
|
||||
public Users createUser(String mobile);
|
||||
|
||||
/**
|
||||
* 根据用户主键查询用户信息
|
||||
*/
|
||||
public Users getUser(String userId);
|
||||
|
||||
/**
|
||||
* 用户信息修改
|
||||
*/
|
||||
public Users updateUserInfo(UpdatedUserBO updatedUserBO);
|
||||
|
||||
/**
|
||||
* 用户信息修改
|
||||
*/
|
||||
public Users updateUserInfo(UpdatedUserBO updatedUserBO, Integer type);
|
||||
|
||||
/**
|
||||
* 创建用户打通短视频和商城系统
|
||||
*
|
||||
* @param mobile
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> createUserNew(String mobile);
|
||||
|
||||
/**
|
||||
* 获取商城token
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Token getShopToken(String userId);
|
||||
|
||||
/**
|
||||
* 从商城系统创建账号
|
||||
*
|
||||
* @param mobile
|
||||
* @return
|
||||
*/
|
||||
Users createUserFromShop(String mobile, String memberId);
|
||||
|
||||
/**
|
||||
* 从商城系统获取短视频账户信息
|
||||
* @param memberId
|
||||
* @return
|
||||
*/
|
||||
String getUserInfoFromShop(String memberId);
|
||||
|
||||
/**
|
||||
* 根据昵称搜索用户
|
||||
* @param nickname
|
||||
* @param page
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
List<UsersVO> searchByNickname(String nickname, Integer page, Integer pageSize, String id);
|
||||
}
|
@ -0,0 +1,171 @@
|
||||
package com.wzj.soopin.content.service;
|
||||
|
||||
import com.imooc.bo.VlogBO;
|
||||
import com.imooc.pojo.Vlog;
|
||||
import com.imooc.utils.PagedGridResult;
|
||||
import com.imooc.vo.IndexVlogVO;
|
||||
|
||||
public interface VlogService {
|
||||
/**
|
||||
* 修改视频首帧图
|
||||
*/
|
||||
public void updateVlogFirstImg(String fileId,String url,String fileUrl);
|
||||
/**
|
||||
* 修改视频状态
|
||||
*/
|
||||
public void updateVlogStatus(String fileId,Integer status,String reason);
|
||||
|
||||
/**
|
||||
* 新增vlog视频
|
||||
*/
|
||||
public void createVlog(VlogBO vlogBO);
|
||||
|
||||
/**
|
||||
* 查询首页/搜索的vlog列表
|
||||
*/
|
||||
public PagedGridResult getIndexVlogList(String userId,
|
||||
String search,
|
||||
String cityCode,
|
||||
String status,
|
||||
Integer page,
|
||||
Integer pageSize);
|
||||
|
||||
/**
|
||||
* 根据视频主键查询vlog
|
||||
*/
|
||||
public IndexVlogVO getVlogDetailById(String userId, String vlogId);
|
||||
|
||||
/**
|
||||
* 用户把视频改为公开/私密的视频
|
||||
*/
|
||||
public void changeToPrivateOrPublic(String userId,
|
||||
String vlogId,
|
||||
Integer yesOrNo);
|
||||
|
||||
public void changeVlogStatus(String userId,
|
||||
String vlogId,
|
||||
Integer status);
|
||||
/**
|
||||
* 查询用的公开/私密的视频列表
|
||||
*/
|
||||
public PagedGridResult queryMyVlogList(String userId,
|
||||
String myId,
|
||||
Integer page,
|
||||
Integer pageSize,
|
||||
Integer yesOrNo);
|
||||
|
||||
/**
|
||||
* 用户点赞/喜欢视频
|
||||
*/
|
||||
public void userLikeVlog(String userId, String vlogId);
|
||||
|
||||
/**
|
||||
* 用户取消点赞/喜欢视频
|
||||
*/
|
||||
public void userUnLikeVlog(String userId, String vlogId);
|
||||
|
||||
/**
|
||||
* 获得用户点赞视频的总数
|
||||
*/
|
||||
public Integer getVlogBeLikedCounts(String vlogId);
|
||||
|
||||
/**
|
||||
* 查询用户点赞过的短视频
|
||||
*/
|
||||
public PagedGridResult getMyLikedVlogList(String userId,
|
||||
String myId,
|
||||
Integer page,
|
||||
Integer pageSize);
|
||||
|
||||
/**
|
||||
* 查询用户关注的博主发布的短视频列表
|
||||
*/
|
||||
public PagedGridResult getMyFollowVlogList(String myId,
|
||||
Integer page,
|
||||
Integer pageSize);
|
||||
|
||||
/**
|
||||
* 查询朋友发布的短视频列表
|
||||
*/
|
||||
public PagedGridResult getMyFriendVlogList(String myId,
|
||||
Integer page,
|
||||
Integer pageSize);
|
||||
|
||||
/**
|
||||
* 根据主键查询vlog
|
||||
*/
|
||||
public Vlog getVlog(String id);
|
||||
|
||||
/**
|
||||
* 把counts输入数据库
|
||||
*/
|
||||
public void flushCounts(String vlogId, Integer counts);
|
||||
// /**
|
||||
// * 查询首页/搜索的vlog列表
|
||||
// */
|
||||
// public PagedGridResult getIndexVlogList(String userId,
|
||||
// String search,
|
||||
// Integer page,
|
||||
// Integer pageSize);
|
||||
//
|
||||
// /**
|
||||
// * 根据视频主键查询vlog
|
||||
// */
|
||||
// public IndexVlogVO getVlogDetailById(String userId, String vlogId);
|
||||
//
|
||||
// /**
|
||||
// * 用户把视频改为公开/私密的视频
|
||||
// */
|
||||
// public void changeToPrivateOrPublic(String userId,
|
||||
// String vlogId,
|
||||
// Integer yesOrNo);
|
||||
//
|
||||
// /**
|
||||
// * 查询用的公开/私密的视频列表
|
||||
// */
|
||||
// public PagedGridResult queryMyVlogList(String userId,
|
||||
// Integer page,
|
||||
// Integer pageSize,
|
||||
// Integer yesOrNo);
|
||||
//
|
||||
// /**
|
||||
// * 用户点赞/喜欢视频
|
||||
// */
|
||||
// public void userLikeVlog(String userId, String vlogId);
|
||||
//
|
||||
// /**
|
||||
// * 用户取消点赞/喜欢视频
|
||||
// */
|
||||
// public void userUnLikeVlog(String userId, String vlogId);
|
||||
//
|
||||
// /**
|
||||
// * 获得用户点赞视频的总数
|
||||
// */
|
||||
// public Integer getVlogBeLikedCounts(String vlogId);
|
||||
//
|
||||
// /**
|
||||
// * 查询用户点赞过的短视频
|
||||
// */
|
||||
// public PagedGridResult getMyLikedVlogList(String userId,
|
||||
// Integer page,
|
||||
// Integer pageSize);
|
||||
//
|
||||
// /**
|
||||
// * 查询用户关注的博主发布的短视频列表
|
||||
// */
|
||||
// public PagedGridResult getMyFollowVlogList(String myId,
|
||||
// Integer page,
|
||||
// Integer pageSize);
|
||||
//
|
||||
// /**
|
||||
// * 查询朋友发布的短视频列表
|
||||
// */
|
||||
// public PagedGridResult getMyFriendVlogList(String myId,
|
||||
// Integer page,
|
||||
// Integer pageSize);
|
||||
//
|
||||
// /**
|
||||
// * 根据主键查询vlog
|
||||
// */
|
||||
// public Vlog getVlog(String id);
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
package com.wzj.soopin.content.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.imooc.base.BaseInfoProperties;
|
||||
import com.imooc.bo.CommentBO;
|
||||
import com.imooc.enums.MessageEnum;
|
||||
import com.imooc.enums.YesOrNo;
|
||||
import com.imooc.mapper.CommentMapper;
|
||||
import com.imooc.mapper.CommentMapperCustom;
|
||||
import com.imooc.pojo.Comment;
|
||||
import com.imooc.pojo.Vlog;
|
||||
import com.imooc.service.CommentService;
|
||||
import com.imooc.service.MsgService;
|
||||
import com.imooc.service.VlogService;
|
||||
import com.imooc.utils.PagedGridResult;
|
||||
import com.imooc.vo.CommentVO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.n3r.idworker.Sid;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class CommentServiceImpl extends BaseInfoProperties implements CommentService {
|
||||
//
|
||||
@Autowired
|
||||
private CommentMapper commentMapper;
|
||||
//
|
||||
@Autowired
|
||||
private CommentMapperCustom commentMapperCustom;
|
||||
//
|
||||
@Autowired
|
||||
private VlogService vlogService;
|
||||
@Autowired
|
||||
private MsgService msgService;
|
||||
//
|
||||
@Autowired
|
||||
private Sid sid;
|
||||
//
|
||||
@Override
|
||||
public CommentVO createComment(CommentBO commentBO) {
|
||||
|
||||
String commentId = sid.nextShort();
|
||||
|
||||
Comment comment = new Comment();
|
||||
comment.setId(commentId);
|
||||
|
||||
comment.setVlogId(commentBO.getVlogId());
|
||||
comment.setVlogerId(commentBO.getVlogerId());
|
||||
|
||||
comment.setCommentUserId(commentBO.getCommentUserId());
|
||||
comment.setFatherCommentId(commentBO.getFatherCommentId());
|
||||
comment.setContent(commentBO.getContent());
|
||||
|
||||
comment.setLikeCounts(0);
|
||||
comment.setCreateTime(new Date());
|
||||
|
||||
commentMapper.insert(comment);
|
||||
|
||||
// redis操作放在service中,评论总数的累加
|
||||
redis.increment(REDIS_VLOG_COMMENT_COUNTS + ":" + commentBO.getVlogId(), 1);
|
||||
|
||||
// 留言后的最新评论需要返回给前端进行展示
|
||||
CommentVO commentVO = new CommentVO();
|
||||
BeanUtils.copyProperties(comment, commentVO);
|
||||
|
||||
|
||||
|
||||
// 系统消息:评论/回复
|
||||
Vlog vlog = vlogService.getVlog(commentBO.getVlogId());
|
||||
Map msgContent = new HashMap();
|
||||
msgContent.put("vlogId", vlog.getId());
|
||||
msgContent.put("vlogCover", vlog.getCover());
|
||||
msgContent.put("commentId", commentId);
|
||||
msgContent.put("commentContent", commentBO.getContent());
|
||||
Integer type = MessageEnum.COMMENT_VLOG.type;
|
||||
if (StringUtils.isNotBlank(commentBO.getFatherCommentId()) &&
|
||||
!commentBO.getFatherCommentId().equalsIgnoreCase("0") ) {
|
||||
type = MessageEnum.REPLY_YOU.type;
|
||||
}
|
||||
|
||||
msgService.createMsg(commentBO.getCommentUserId(),
|
||||
commentBO.getVlogerId(),
|
||||
type,
|
||||
msgContent);
|
||||
//
|
||||
//
|
||||
//
|
||||
return commentVO;
|
||||
}
|
||||
//
|
||||
@Override
|
||||
public PagedGridResult queryVlogComments(String vlogId,
|
||||
String userId,
|
||||
Integer page,
|
||||
Integer pageSize) {
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("vlogId", vlogId);
|
||||
|
||||
PageHelper.startPage(page, pageSize);
|
||||
|
||||
List<CommentVO> list = commentMapperCustom.getCommentList(map);
|
||||
|
||||
for (CommentVO cv:list) {
|
||||
String commentId = cv.getCommentId();
|
||||
|
||||
// 当前短视频的某个评论的点赞总数
|
||||
String countsStr = redis.getHashValue(REDIS_VLOG_COMMENT_LIKED_COUNTS, commentId);
|
||||
Integer counts = 0;
|
||||
if (StringUtils.isNotBlank(countsStr)) {
|
||||
counts = Integer.valueOf(countsStr);
|
||||
}
|
||||
cv.setLikeCounts(counts);
|
||||
|
||||
// 判断当前用户是否点赞过该评论
|
||||
String doILike = redis.hget(REDIS_USER_LIKE_COMMENT, userId + ":" + commentId);
|
||||
if (StringUtils.isNotBlank(doILike) && doILike.equalsIgnoreCase("1")) {
|
||||
cv.setIsLike(YesOrNo.YES.type);
|
||||
}
|
||||
}
|
||||
|
||||
return setterPagedGrid(list, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteComment(String commentUserId,
|
||||
String commentId,
|
||||
String vlogId) {
|
||||
|
||||
Comment pendingDelete = new Comment();
|
||||
pendingDelete.setId(commentId);
|
||||
pendingDelete.setCommentUserId(commentUserId);
|
||||
|
||||
commentMapper.delete(pendingDelete);
|
||||
|
||||
// 评论总数的累减
|
||||
redis.decrement(REDIS_VLOG_COMMENT_COUNTS + ":" + vlogId, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comment getComment(String id) {
|
||||
return commentMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,189 @@
|
||||
package com.wzj.soopin.content.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.imooc.base.BaseInfoProperties;
|
||||
import com.imooc.base.RabbitMQConfig;
|
||||
import com.imooc.enums.MessageEnum;
|
||||
import com.imooc.enums.YesOrNo;
|
||||
import com.imooc.mapper.FansMapper;
|
||||
import com.imooc.mapper.FansMapperCustom;
|
||||
import com.imooc.mo.MessageMO;
|
||||
import com.imooc.pojo.Fans;
|
||||
import com.imooc.service.FansService;
|
||||
import com.imooc.service.MsgService;
|
||||
import com.imooc.utils.JsonUtils;
|
||||
import com.imooc.utils.PagedGridResult;
|
||||
import com.imooc.vo.FansVO;
|
||||
import com.imooc.vo.VlogerVO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.n3r.idworker.Sid;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class FansServiceImpl extends BaseInfoProperties implements FansService {
|
||||
|
||||
@Autowired
|
||||
private FansMapper fansMapper;
|
||||
@Autowired
|
||||
private FansMapperCustom fansMapperCustom;
|
||||
//
|
||||
@Autowired
|
||||
private MsgService msgService;
|
||||
|
||||
@Autowired
|
||||
public RabbitTemplate rabbitTemplate;
|
||||
//
|
||||
@Autowired
|
||||
private Sid sid;
|
||||
//
|
||||
@Transactional
|
||||
@Override
|
||||
public void doFollow(String myId, String vlogerId) {
|
||||
|
||||
String fid = sid.nextShort();
|
||||
|
||||
// Fans fans = new Fans();
|
||||
// fans.setId(fid);
|
||||
// fans.setFanId(myId);
|
||||
// fans.setVlogerId(vlogerId);
|
||||
// fans.setCreatedTime(new Date());
|
||||
|
||||
Map<String, Object> fans = new HashMap<>();
|
||||
fans.put("id", fid);
|
||||
fans.put("fan_id", myId);
|
||||
fans.put("vloger_id", vlogerId);
|
||||
fans.put("created_time", new Date());
|
||||
|
||||
// 判断对方是否关注我,如果关注我,那么双方都要互为朋友关系
|
||||
Fans vloger = queryFansRelationship(vlogerId, myId);
|
||||
System.out.println(vloger);
|
||||
if (vloger != null) {
|
||||
// fans.setIsFanFriendOfMine(YesOrNo.YES.type);
|
||||
fans.put("is_fan_friend_of_mine",YesOrNo.YES.type);
|
||||
vloger.setIsFanFriendOfMine(YesOrNo.YES.type);
|
||||
fansMapper.updateByPrimaryKeySelective(vloger);
|
||||
System.out.println(vloger.getIsFanFriendOfMine());
|
||||
} else {
|
||||
// fans.setIsFanFriendOfMine(YesOrNo.NO.type);
|
||||
fans.put("is_fan_friend_of_mine",YesOrNo.NO.type);
|
||||
}
|
||||
fansMapper.insert(fans);
|
||||
|
||||
|
||||
// 系统消息:关注
|
||||
// msgService.createMsg(myId, vlogerId, MessageEnum.FOLLOW_YOU.type, null);
|
||||
//优化使用mQEXCHANGE_MSG
|
||||
|
||||
MessageMO messageMO = new MessageMO();
|
||||
|
||||
messageMO.setFromUserId(myId);
|
||||
messageMO.setToUserId(vlogerId);
|
||||
rabbitTemplate.convertAndSend(RabbitMQConfig.EXCHANGE_MSG, "sys.msg."+ MessageEnum.FOLLOW_YOU.enValue, JsonUtils.objectToJson(messageMO));
|
||||
}
|
||||
|
||||
public Fans queryFansRelationship(String fanId, String vlogerId) {
|
||||
// Example example = new Example(Fans.class);
|
||||
// Example.Criteria criteria = example.createCriteria();
|
||||
// criteria.andEqualTo("vlogerId", vlogerId);
|
||||
// criteria.andEqualTo("fanId", fanId);
|
||||
|
||||
|
||||
Map<String, Object> mapexample = new HashMap<>();
|
||||
mapexample.put("vlogerId", vlogerId);
|
||||
mapexample.put("fanId", fanId);
|
||||
|
||||
List list = fansMapper.selectByExample(mapexample);
|
||||
|
||||
Fans fan = null;
|
||||
if (list != null && list.size() > 0 && !list.isEmpty()) {
|
||||
fan = (Fans)list.get(0);
|
||||
}
|
||||
|
||||
return fan;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void doCancel(String myId, String vlogerId) {
|
||||
|
||||
// 判断我们是否朋友关系,如果是,则需要取消双方的关系
|
||||
Fans fan = queryFansRelationship(myId, vlogerId);
|
||||
if (fan != null && fan.getIsFanFriendOfMine() == YesOrNo.YES.type) {
|
||||
// 抹除双方的朋友关系,自己的关系删除即可
|
||||
Fans pendingFan = queryFansRelationship(vlogerId, myId);
|
||||
pendingFan.setIsFanFriendOfMine(YesOrNo.NO.type);
|
||||
System.out.println(pendingFan.getIsFanFriendOfMine());
|
||||
fansMapper.updateByPrimaryKeySelective(pendingFan);
|
||||
}
|
||||
|
||||
// 删除自己的关注关联表记录
|
||||
String fanId = fan.getId();
|
||||
fansMapper.delete(fanId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean queryDoIFollowVloger(String myId, String vlogerId) {
|
||||
Fans vloger = queryFansRelationship(myId, vlogerId);
|
||||
return vloger != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PagedGridResult queryMyFollows(String myId,
|
||||
Integer page,
|
||||
Integer pageSize) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("myId", myId);
|
||||
|
||||
PageHelper.startPage(page, pageSize);
|
||||
|
||||
List<VlogerVO> list = fansMapperCustom.queryMyFollows(map);
|
||||
|
||||
return setterPagedGrid(list, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PagedGridResult queryMyFans(String myId,
|
||||
Integer page,
|
||||
Integer pageSize) {
|
||||
|
||||
/**
|
||||
* <判断粉丝是否是我的朋友(互粉互关)>
|
||||
* 普通做法:
|
||||
* 多表关联+嵌套关联查询,这样会违反多表关联的规范,不可取,高并发下回出现性能问题
|
||||
*
|
||||
* 常规做法:
|
||||
* 1. 避免过多的表关联查询,先查询我的粉丝列表,获得fansList
|
||||
* 2. 判断粉丝关注我,并且我也关注粉丝 -> 循环fansList,获得每一个粉丝,再去数据库查询我是否关注他
|
||||
* 3. 如果我也关注他(粉丝),说明,我俩互为朋友关系(互关互粉),则标记flag为true,否则false
|
||||
*
|
||||
* 高端做法:
|
||||
* 1. 关注/取关的时候,关联关系保存在redis中,不要依赖数据库
|
||||
* 2. 数据库查询后,直接循环查询redis,避免第二次循环查询数据库的尴尬局面
|
||||
*/
|
||||
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("myId", myId);
|
||||
|
||||
PageHelper.startPage(page, pageSize);
|
||||
|
||||
List<FansVO> list = fansMapperCustom.queryMyFans(map);
|
||||
|
||||
for (FansVO f : list) {
|
||||
String relationship = redis.get(REDIS_FANS_AND_VLOGGER_RELATIONSHIP + ":" + myId + ":" + f.getFanId());
|
||||
if (StringUtils.isNotBlank(relationship) && relationship.equalsIgnoreCase("1")) {
|
||||
f.setFriend(true);
|
||||
}
|
||||
}
|
||||
|
||||
return setterPagedGrid(list, page);
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package com.wzj.soopin.content.service.impl;
|
||||
|
||||
import com.imooc.base.BaseInfoProperties;
|
||||
import com.imooc.enums.MessageEnum;
|
||||
import com.imooc.mo.MessageMO;
|
||||
import com.imooc.pojo.Users;
|
||||
import com.imooc.repository.MessageRepository;
|
||||
import com.imooc.service.MsgService;
|
||||
import com.imooc.service.UserService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class MsgServiceImpl extends BaseInfoProperties implements MsgService {
|
||||
|
||||
@Autowired
|
||||
private MessageRepository messageRepository;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Override
|
||||
public void createMsg(String fromUserId,
|
||||
String toUserId,
|
||||
Integer type,
|
||||
Map msgContent) {
|
||||
|
||||
Users fromUser = userService.getUser(fromUserId);
|
||||
|
||||
MessageMO messageMO = new MessageMO();
|
||||
|
||||
messageMO.setFromUserId(fromUserId);
|
||||
messageMO.setFromNickname(fromUser.getNickname());
|
||||
messageMO.setFromFace(fromUser.getFace());
|
||||
|
||||
messageMO.setToUserId(toUserId);
|
||||
|
||||
messageMO.setMsgType(type);
|
||||
if (msgContent != null) {
|
||||
messageMO.setMsgContent(msgContent);
|
||||
}
|
||||
|
||||
messageMO.setCreateTime(new Date());
|
||||
|
||||
messageRepository.save(messageMO);
|
||||
}
|
||||
//
|
||||
@Override
|
||||
public List<MessageMO> queryList(String toUserId,
|
||||
Integer page,
|
||||
Integer pageSize) {
|
||||
|
||||
Pageable pageable = PageRequest.of(page,
|
||||
pageSize,
|
||||
Sort.Direction.DESC,
|
||||
"createTime");
|
||||
|
||||
List<MessageMO> list = messageRepository
|
||||
.findAllByToUserIdEqualsOrderByCreateTimeDesc(toUserId,
|
||||
pageable);
|
||||
for (MessageMO msg : list) {
|
||||
// 如果类型是关注消息,则需要查询我之前有没有关注过他,用于在前端标记“互粉”“互关”
|
||||
if (msg.getMsgType() != null && msg.getMsgType() == MessageEnum.FOLLOW_YOU.type) {
|
||||
Map map = msg.getMsgContent();
|
||||
if (map == null) {
|
||||
map = new HashMap();
|
||||
}
|
||||
|
||||
String relationship = redis.get(REDIS_FANS_AND_VLOGGER_RELATIONSHIP + ":" + msg.getToUserId() + ":" + msg.getFromUserId());
|
||||
if (StringUtils.isNotBlank(relationship) && relationship.equalsIgnoreCase("1")) {
|
||||
map.put("isFriend", true);
|
||||
} else {
|
||||
map.put("isFriend", false);
|
||||
}
|
||||
msg.setMsgContent(map);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.wzj.soopin.content.service.impl;
|
||||
|
||||
import com.imooc.mapper.UserMemberMapper;
|
||||
import com.imooc.service.UserMemberService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 会员接口业务层实现
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2021-03-29 14:10:16
|
||||
*/
|
||||
@Service
|
||||
public class UserMemberServiceImpl implements UserMemberService {
|
||||
|
||||
@Autowired
|
||||
private UserMemberMapper userMemberMapper;
|
||||
}
|
@ -0,0 +1,428 @@
|
||||
package com.wzj.soopin.content.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.imooc.base.BaseInfoProperties;
|
||||
import com.imooc.bo.UpdatedUserBO;
|
||||
import com.imooc.enums.Sex;
|
||||
import com.imooc.enums.UserInfoModifyType;
|
||||
import com.imooc.enums.YesOrNo;
|
||||
import com.imooc.exceptions.GraceException;
|
||||
import com.imooc.grace.result.ResponseStatusEnum;
|
||||
import com.imooc.mapper.FansMapper;
|
||||
import com.imooc.mapper.FansMapperCustom;
|
||||
import com.imooc.mapper.UserMemberMapper;
|
||||
import com.imooc.mapper.UsersMapper;
|
||||
import com.imooc.mo.Token;
|
||||
import com.imooc.pojo.UserMember;
|
||||
import com.imooc.pojo.Users;
|
||||
import com.imooc.service.FansService;
|
||||
import com.imooc.service.UserService;
|
||||
import com.imooc.utils.*;
|
||||
import com.imooc.vo.UsersVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.n3r.idworker.Sid;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.imooc.base.BaseInfoProperties.REDIS_USER_TOKEN;
|
||||
|
||||
/**
|
||||
* @author vercen
|
||||
* @version 1.0
|
||||
* @date 2023/5/25 21:02
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class UserServiceImpl extends BaseInfoProperties implements UserService {
|
||||
@Autowired
|
||||
private UsersMapper usersMapper;
|
||||
@Autowired
|
||||
private FansMapperCustom fansMapperCustom;
|
||||
@Autowired
|
||||
private FansService fansService;
|
||||
|
||||
@Resource
|
||||
private PasswordEncoder passwordEncoder;
|
||||
|
||||
@Autowired
|
||||
private UserMemberMapper userMemberMapper;
|
||||
|
||||
@Autowired
|
||||
private FansMapper fansMapper;
|
||||
|
||||
//@Autowired
|
||||
//public RedisOperator redis;
|
||||
|
||||
@Resource(name = "redisTemplate")
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
@Autowired
|
||||
private Sid sid;
|
||||
private static final String USER_FACE1 = "http://43.143.227.203:29000/bucket/logo.png";
|
||||
|
||||
@Override
|
||||
public Users queryMobileIsExist(String mobile) {
|
||||
Example userExample = new Example(Users.class);
|
||||
Example.Criteria criteria = userExample.createCriteria();
|
||||
criteria.andEqualTo("mobile", mobile);
|
||||
Users user = usersMapper.selectOneByExample(userExample);
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Users createUser(String mobile) {
|
||||
// 获得全局唯一主键
|
||||
String userId = sid.nextShort();
|
||||
|
||||
Users user = new Users();
|
||||
user.setId(userId);
|
||||
user.setPassword(mobile);
|
||||
user.setMobile(mobile);
|
||||
user.setNickname("用户:" + DesensitizationUtil.commonDisplay(mobile));
|
||||
user.setImoocNum("用户:" + DesensitizationUtil.commonDisplay(mobile));
|
||||
user.setFace(USER_FACE1);
|
||||
|
||||
user.setBirthday(DateUtil.stringToDate("1999-01-01"));
|
||||
user.setSex(Sex.secret.type);
|
||||
user.setBgImg(USER_FACE1);
|
||||
user.setCountry("中国");
|
||||
user.setProvince("");
|
||||
user.setCity("");
|
||||
user.setDistrict("");
|
||||
user.setDescription("这家伙很懒,什么都没留下~");
|
||||
user.setCanImoocNumBeUpdated(YesOrNo.YES.type);
|
||||
user.setCreatedTime(new Date());
|
||||
user.setUpdatedTime(new Date());
|
||||
|
||||
usersMapper.insert(user);
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Users getUser(String userId) {
|
||||
Users users = usersMapper.selectByPrimaryKey(userId);
|
||||
return users;
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public Users updateUserInfo(UpdatedUserBO updatedUserBO) {
|
||||
|
||||
Users users = new Users();
|
||||
BeanUtils.copyProperties(updatedUserBO, users);
|
||||
usersMapper.updateByPrimaryKeySelective(users);
|
||||
return getUser(updatedUserBO.getId());
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public Users updateUserInfo(UpdatedUserBO updatedUserBO, Integer type) {
|
||||
if (type == UserInfoModifyType.NICKNAME.type) {
|
||||
usersMapper.updateNickname(updatedUserBO);
|
||||
}
|
||||
if (type == UserInfoModifyType.SEX.type) {
|
||||
usersMapper.updateSex(updatedUserBO);
|
||||
}
|
||||
if (type == UserInfoModifyType.BIRTHDAY.type) {
|
||||
usersMapper.updateBirthday(updatedUserBO);
|
||||
}
|
||||
if (type == UserInfoModifyType.LOCATION.type) {
|
||||
usersMapper.updateLocation(updatedUserBO);
|
||||
}
|
||||
if (type == UserInfoModifyType.DESC.type) {
|
||||
usersMapper.updateDescription(updatedUserBO);
|
||||
}
|
||||
if (type == UserInfoModifyType.IMOOCNUM.type) {
|
||||
if (updatedUserBO.getCanImoocNumBeUpdated() == YesOrNo.NO.type) {
|
||||
GraceException.display(ResponseStatusEnum.USER_INFO_CANT_UPDATED_IMOOCNUM_ERROR);
|
||||
}
|
||||
// 校验唯一性
|
||||
List<UsersVO> haveImooc = usersMapper.selectByImoocNum(updatedUserBO.getImoocNum());
|
||||
if (haveImooc != null && !haveImooc.isEmpty()) {
|
||||
GraceException.display(ResponseStatusEnum.USER_INFO_UPDATED_IMOOCNUM_EXIST_ERROR);
|
||||
}
|
||||
usersMapper.updateVnum(updatedUserBO);
|
||||
}
|
||||
|
||||
|
||||
return getUser(updatedUserBO.getId());
|
||||
|
||||
// Example example = new Example(Users.class);
|
||||
// Example.Criteria criteria = example.createCriteria();
|
||||
// if (type == UserInfoModifyType.NICKNAME.type) {
|
||||
// criteria.andEqualTo("nickname", updatedUserBO.getNickname());
|
||||
// Users user = usersMapper.selectOneByExample(example);
|
||||
// if (user != null) {
|
||||
// GraceException.display(ResponseStatusEnum.USER_INFO_UPDATED_NICKNAME_EXIST_ERROR);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (type == UserInfoModifyType.IMOOCNUM.type) {
|
||||
// criteria.andEqualTo("imoocNum", updatedUserBO.getImoocNum());
|
||||
// Users user = usersMapper.selectOneByExample(example);
|
||||
// if (user != null) {
|
||||
// GraceException.display(ResponseStatusEnum.USER_INFO_UPDATED_NICKNAME_EXIST_ERROR);
|
||||
// }
|
||||
//
|
||||
// Users tempUser = getUser(updatedUserBO.getId());
|
||||
// if (tempUser.getCanImoocNumBeUpdated() == YesOrNo.NO.type) {
|
||||
// GraceException.display(ResponseStatusEnum.USER_INFO_CANT_UPDATED_IMOOCNUM_ERROR);
|
||||
// }
|
||||
//
|
||||
// updatedUserBO.setCanImoocNumBeUpdated(YesOrNo.NO.type);
|
||||
// }
|
||||
//
|
||||
// return updateUserInfo(updatedUserBO);
|
||||
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = RuntimeException.class)
|
||||
@Override
|
||||
public Map<String, Object> createUserNew(String mobile) {
|
||||
// 获得全局唯一主键
|
||||
String userId = sid.nextShort();
|
||||
// 创建短视频系统账号
|
||||
Users user = new Users();
|
||||
user.setId(userId);
|
||||
user.setPassword(passwordEncoder.encode(mobile));
|
||||
user.setMobile(mobile);
|
||||
user.setNickname("用户:" + DesensitizationUtil.commonDisplay(mobile));
|
||||
user.setImoocNum("用户:" + DesensitizationUtil.commonDisplay(mobile));
|
||||
user.setFace(USER_FACE1);
|
||||
user.setBirthday(DateUtil.stringToDate("1999-01-01"));
|
||||
user.setSex(Sex.secret.type);
|
||||
user.setBgImg(USER_FACE1);
|
||||
user.setCountry("中国");
|
||||
user.setProvince("");
|
||||
user.setCity("");
|
||||
user.setDistrict("");
|
||||
user.setDescription("这家伙很懒,什么都没留下~");
|
||||
user.setBgImg("");
|
||||
user.setCanImoocNumBeUpdated(YesOrNo.YES.type);
|
||||
user.setCreatedTime(new Date());
|
||||
user.setUpdatedTime(new Date());
|
||||
|
||||
int row = usersMapper.insert(user);
|
||||
|
||||
if (row > 0) {
|
||||
Map<String, Object> result = Maps.newHashMap();
|
||||
result.put("user", user);
|
||||
// 创建商城系统账号,获取商城系统token
|
||||
String url = "http://localhost:8888/buyer/passport/member/registerFromTik";
|
||||
MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
|
||||
param.add("userName", mobile);
|
||||
param.add("password", mobile);
|
||||
param.add("mobilePhone", mobile);
|
||||
param.add("userId", user.getId());
|
||||
|
||||
RestTemplateUtil.post(null, null, null, url, param, String.class, t -> {
|
||||
if (t.getStatusCode() == HttpStatus.OK) {
|
||||
String content = t.getBody();
|
||||
if (StringUtils.isNotBlank(content)) {
|
||||
Token token = GsonUtil.jsonToBean(content, Token.class);
|
||||
result.put("token", token);
|
||||
} else {
|
||||
throw new RuntimeException("账号注册异常");
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("账号注册异常");
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Token getShopToken(String userId) {
|
||||
Token[] tokens = { null };
|
||||
String url = "http://localhost:8888/buyer/passport/member/getTokenFromTik";
|
||||
MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
|
||||
param.add("userId", userId);
|
||||
RestTemplateUtil.post(null, null, null, url, param, String.class, t -> {
|
||||
if (t.getStatusCode() == HttpStatus.OK) {
|
||||
String content = t.getBody();
|
||||
if (StringUtils.isNotBlank(content)) {
|
||||
tokens[0] = GsonUtil.jsonToBean(content, Token.class);
|
||||
} else {
|
||||
throw new RuntimeException("账号注册异常");
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("账号注册异常");
|
||||
}
|
||||
});
|
||||
return tokens[0];
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = RuntimeException.class)
|
||||
@Override
|
||||
public Users createUserFromShop(String mobile, String memberId) {
|
||||
String tempMobile = StringUtils.isBlank(mobile) ? "unionID" : mobile;
|
||||
// 获得全局唯一主键
|
||||
String userId = sid.nextShort();
|
||||
Users user = new Users();
|
||||
user.setId(userId);
|
||||
user.setPassword(tempMobile);
|
||||
user.setMobile(tempMobile);
|
||||
user.setNickname("用户:" + DesensitizationUtil.commonDisplay(tempMobile));
|
||||
user.setImoocNum("WZJ" + (System.currentTimeMillis() / 1000) + (int)(Math.random() * 1000));
|
||||
user.setFace(USER_FACE1);
|
||||
user.setBirthday(DateUtil.stringToDate("1999-01-01"));
|
||||
user.setSex(Sex.secret.type);
|
||||
user.setBgImg("https://wuzhongjie.com.cn/download/logo.png"); // 测试用地址
|
||||
user.setCountry("中国");
|
||||
user.setProvince("");
|
||||
user.setCity("");
|
||||
user.setDistrict("");
|
||||
user.setDescription("这家伙很懒,什么都没留下~");
|
||||
user.setCanImoocNumBeUpdated(YesOrNo.YES.type);
|
||||
user.setCreatedTime(new Date());
|
||||
user.setUpdatedTime(new Date());
|
||||
|
||||
// 短视频用户与商城账号关系
|
||||
UserMember userMember = new UserMember();
|
||||
userMember.setUserId(user.getId());
|
||||
userMember.setMemberId(memberId);
|
||||
|
||||
if (usersMapper.insert(user) > 0 && userMemberMapper.insert(userMember) > 0) {
|
||||
return user;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserInfoFromShop(String memberId) {
|
||||
return Optional.ofNullable(userMemberMapper.getUserByMemberId(memberId))//
|
||||
.map(user -> {
|
||||
String uToken = UUID.randomUUID().toString();
|
||||
//redis.set(REDIS_USER_TOKEN + ":" + user.getId(), uToken);
|
||||
redisTemplate.opsForValue().set(REDIS_USER_TOKEN + ":" + user.getId(), uToken);
|
||||
// 返回给前端
|
||||
UsersVO usersVO = new UsersVO();
|
||||
BeanUtils.copyProperties(user, usersVO);
|
||||
usersVO.setUserToken(uToken);
|
||||
|
||||
return GsonUtil.beanToJson(usersVO);
|
||||
})//
|
||||
.orElseGet(() -> StringUtils.EMPTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UsersVO> searchByNickname(String nickname, Integer page, Integer pageSize, String currentUserId) {
|
||||
try {
|
||||
PageHelper.startPage(page, pageSize);
|
||||
List<UsersVO> userList = usersMapper.searchByNickname(nickname);
|
||||
|
||||
if(currentUserId.isEmpty()){
|
||||
return userList;
|
||||
}
|
||||
|
||||
// 提取模糊查询出的用户 ID 列表
|
||||
List<String> vlogerIds = userList.stream().map(UsersVO::getId).collect(Collectors.toList());
|
||||
log.info("用户列表" + vlogerIds);
|
||||
if (vlogerIds.isEmpty()) {
|
||||
log.info("没有查询到用户 ID,跳过关注关系查询");
|
||||
return userList;
|
||||
}
|
||||
//
|
||||
userList.forEach(usersVO -> {
|
||||
// 当前用户是否关注博主
|
||||
Boolean isFollowed = fansService.queryDoIFollowVloger(currentUserId,usersVO.getId());
|
||||
// 我的粉丝总数
|
||||
String myFansCountsStr = redis.get(REDIS_MY_FANS_COUNTS + ":" + usersVO.getId());
|
||||
// 获赞总数
|
||||
String likedVlogerCountsStr = redis.get(REDIS_VLOGER_BE_LIKED_COUNTS + ":" + usersVO.getId());
|
||||
|
||||
int fansCount = 0;
|
||||
int likeCount = 0;
|
||||
if (myFansCountsStr != null) {
|
||||
try {
|
||||
fansCount = Integer.parseInt(myFansCountsStr);
|
||||
} catch (NumberFormatException e) {
|
||||
// 可选:记录日志或处理异常
|
||||
fansCount = 0;
|
||||
}
|
||||
}
|
||||
if (likedVlogerCountsStr != null) {
|
||||
try {
|
||||
likeCount = Integer.parseInt(likedVlogerCountsStr);
|
||||
} catch (NumberFormatException e) {
|
||||
// 可选:记录日志或处理异常
|
||||
likeCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
usersVO.setMyFansCounts(fansCount);
|
||||
usersVO.setTotalLikeMeCounts(likeCount);
|
||||
|
||||
if (isFollowed) {
|
||||
String relationship = redis.get(REDIS_FANS_AND_VLOGGER_RELATIONSHIP + ":" + usersVO.getId() + ":" + currentUserId);
|
||||
if (StringUtils.isNotBlank(relationship) && relationship.equalsIgnoreCase("1")) {
|
||||
usersVO.setFollowStatus("互相关注");
|
||||
}else {
|
||||
usersVO.setFollowStatus("已关注");
|
||||
}
|
||||
} else {
|
||||
usersVO.setFollowStatus("未关注");
|
||||
}
|
||||
});
|
||||
return userList;
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// // 获取当前用户关注的
|
||||
// List<java.util.Map<String, Object>> followedRelations = fansMapper.getFollowedVlogerIds(currentUserId, vlogerIds);
|
||||
// log.info("获取当前用户关注的: {}", followedRelations);
|
||||
// // 构建 vlogerId 到 is_fan_friend_of_mine 的映射
|
||||
// java.util.Map<String, Integer> relationMap = followedRelations.stream()
|
||||
// .filter(Objects::nonNull) // 排除整个 map 为 null 的情况
|
||||
// .collect(Collectors.toMap(
|
||||
// map -> (String) map.get("vloger_id"),
|
||||
// map -> (Integer) map.get("is_fan_friend_of_mine")
|
||||
// ));
|
||||
// log.info("构造的 relationMap: {}", relationMap);
|
||||
// Set<String> followedVlogerIds = relationMap.keySet();
|
||||
//
|
||||
// // 遍历设置每个用户的关注状态及展示状态
|
||||
// userList.forEach(usersVO -> {
|
||||
// boolean isFollowed = followedVlogerIds.contains(usersVO.getId());
|
||||
// usersVO.setIsFollowed(isFollowed);
|
||||
// if (isFollowed) {
|
||||
// Integer isFanFriendOfMine = relationMap.get(usersVO.getId());
|
||||
// if (isFanFriendOfMine != null && isFanFriendOfMine == 1) {
|
||||
// usersVO.setFollowStatus("互相关注"); // 假设 UsersVO 有此方法设置展示状态
|
||||
// } else {
|
||||
// usersVO.setFollowStatus("已关注");
|
||||
// }
|
||||
// } else {
|
||||
// usersVO.setFollowStatus("未关注");
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// log.info("用户列表" + userList);
|
||||
// return userList;
|
||||
} catch (Exception e) {
|
||||
log.error("搜索用户时发生异常", e);
|
||||
throw new RuntimeException("搜索用户时发生异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,626 @@
|
||||
package com.wzj.soopin.content.service.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.imooc.base.BaseInfoProperties;
|
||||
import com.imooc.bo.VlogBO;
|
||||
import com.imooc.enums.MessageEnum;
|
||||
import com.imooc.enums.YesOrNo;
|
||||
import com.imooc.mapper.MyLikedVlogMapper;
|
||||
import com.imooc.mapper.VlogMapper;
|
||||
import com.imooc.mapper.VlogMapperCustom;
|
||||
import com.imooc.pojo.MyLikedVlog;
|
||||
import com.imooc.pojo.Vlog;
|
||||
import com.imooc.service.FansService;
|
||||
import com.imooc.service.MsgService;
|
||||
import com.imooc.service.VlogService;
|
||||
import com.imooc.utils.PagedGridResult;
|
||||
import com.imooc.vo.IndexVlogVO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.n3r.idworker.Sid;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class VlogServiceImpl extends BaseInfoProperties implements VlogService {
|
||||
|
||||
@Autowired
|
||||
private VlogMapper vlogMapper;
|
||||
|
||||
@Autowired
|
||||
private VlogMapperCustom vlogMapperCustom;
|
||||
|
||||
@Autowired
|
||||
private MyLikedVlogMapper myLikedVlogMapper;
|
||||
|
||||
@Autowired
|
||||
private FansService fansService;
|
||||
@Autowired
|
||||
private MsgService msgService;
|
||||
|
||||
@Autowired
|
||||
private Sid sid;
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void updateVlogStatus(String fileId,Integer status,String reason) {
|
||||
// Example example = new Example(Vlog.class);
|
||||
// Example.Criteria criteria = example.createCriteria();
|
||||
// criteria.andEqualTo("fileId", fileId);
|
||||
//
|
||||
// Vlog pendingVlog = new Vlog();
|
||||
// pendingVlog.setStatus(status);
|
||||
// pendingVlog.setReason(reason);
|
||||
// vlogMapper.updateVlogStatus(fileId, example);
|
||||
|
||||
// 示例:更新 vlog 表
|
||||
Map<String, Object> updateFields = new HashMap<>();
|
||||
updateFields.put("status", status);
|
||||
updateFields.put("reason", reason);
|
||||
|
||||
vlogMapper.dynamicUpdate(
|
||||
"file_id", // 主键字段名
|
||||
fileId, // 主键值
|
||||
updateFields // 更新字段
|
||||
);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void updateVlogFirstImg(String fileId,String url,String fileUrl) {
|
||||
// Example example = new Example(Vlog.class);
|
||||
// Example.Criteria criteria = example.createCriteria();
|
||||
// criteria.andEqualTo("fileId", fileId);
|
||||
// Vlog pendingVlog = new Vlog();
|
||||
// pendingVlog.setFirstFrameImg(url);
|
||||
// pendingVlog.setUrl(fileUrl);
|
||||
//
|
||||
// vlogMapper.updateByExampleSelective(pendingVlog, example);
|
||||
// 示例:更新 vlog 表
|
||||
Map<String, Object> updateFields = new HashMap<>();
|
||||
updateFields.put("first_frame_img", url);
|
||||
updateFields.put("url", fileUrl);
|
||||
|
||||
vlogMapper.dynamicUpdate(
|
||||
"file_id", // 主键字段名
|
||||
fileId, // 主键值
|
||||
updateFields // 更新字段
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void createVlog(VlogBO vlogBO) {
|
||||
|
||||
// String vid = sid.nextShort();
|
||||
//
|
||||
// Vlog vlog = new Vlog();
|
||||
// BeanUtils.copyProperties(vlogBO, vlog);
|
||||
//
|
||||
// vlog.setId(vid);
|
||||
//
|
||||
// vlog.setLikeCounts(0);
|
||||
// vlog.setCommentsCounts(0);
|
||||
// vlog.setStatus(0);
|
||||
// vlog.setIsPrivate(YesOrNo.NO.type);
|
||||
//
|
||||
// vlog.setCreatedTime(new Date());
|
||||
// vlog.setUpdatedTime(new Date());
|
||||
//
|
||||
// vlogMapper.insert(vlog);
|
||||
String vid = sid.nextShort();
|
||||
Map<String, Object> vlog = new HashMap<>();
|
||||
|
||||
vlog.put("id", vid);
|
||||
vlog.put("vloger_id", vlogBO.getVlogerId());
|
||||
vlog.put("url", vlogBO.getUrl());
|
||||
vlog.put("title", vlogBO.getTitle());
|
||||
vlog.put("width", vlogBO.getWidth());
|
||||
vlog.put("height", vlogBO.getHeight());
|
||||
vlog.put("is_private", YesOrNo.NO.type);
|
||||
vlog.put("created_time", new Date());
|
||||
vlog.put("updated_time", new Date());
|
||||
vlog.put("city_code", vlogBO.getCityCode());
|
||||
vlog.put("file_id", vlogBO.getFileId());
|
||||
vlog.put("first_frame_img", vlogBO.getFirstFrameImg());
|
||||
|
||||
|
||||
vlogMapper.dynamicInsert(vlog);
|
||||
|
||||
//多条导入
|
||||
// List<Map<String, Object>> vlogList = new ArrayList<>();
|
||||
//
|
||||
// Map<String, Object> vlog1 = new HashMap<>();
|
||||
// vlog1.put("id", sid.nextShort());
|
||||
// vlog1.put("title", "视频1");
|
||||
// vlogList.add(vlog1);
|
||||
//
|
||||
// Map<String, Object> vlog2 = new HashMap<>();
|
||||
// vlog2.put("id", sid.nextShort());
|
||||
// vlog2.put("title", "视频2");
|
||||
// vlogList.add(vlog2);
|
||||
//
|
||||
// vlogMapper.dynamicBatchInsert(vlogList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PagedGridResult getIndexVlogList(String userId,
|
||||
String search,
|
||||
String cityCode,
|
||||
String status,
|
||||
Integer page,
|
||||
Integer pageSize) {
|
||||
|
||||
PageHelper.startPage(page, pageSize);
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if (StringUtils.isNotBlank(search)) {
|
||||
map.put("search", search);
|
||||
}
|
||||
if (StringUtils.isNotBlank(cityCode)) {
|
||||
map.put("cityCode", cityCode);
|
||||
}
|
||||
if (StringUtils.isNotBlank(status)) {
|
||||
map.put("status", status);
|
||||
}
|
||||
if(StringUtils.isNotBlank(userId)){
|
||||
// 从redis中获取举报信息
|
||||
String redisKey = REDIS_VIDEO_BLOCK + ":" + userId;
|
||||
Boolean hasKey = redis.keyIsExist(redisKey);
|
||||
if(hasKey){
|
||||
List<String> blockVdList = new ArrayList<>();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<String> reports = redis.lrange(redisKey, 0, -1); // 查询用户的所有举报记录
|
||||
|
||||
for (String report : reports) {
|
||||
try {
|
||||
Map<String, Object> reportMap = objectMapper.readValue(report, new TypeReference<Map<String, Object>>() {});
|
||||
// 处理举报信息
|
||||
String vlogId = (String) reportMap.get("vlogId");
|
||||
blockVdList.add(vlogId);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
map.put("blockVd",blockVdList);
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(userId)){
|
||||
// 从redis中获取拉黑信息
|
||||
String redisKey = REDIS_USER_BLOCK + ":" + userId;
|
||||
Boolean hasKey = redis.keyIsExist(redisKey);
|
||||
if(hasKey){
|
||||
List<String> blockUserList = new ArrayList<>();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<String> reports = redis.lrange(redisKey, 0, -1); // 查询用户的所有举报记录
|
||||
|
||||
for (String report : reports) {
|
||||
try {
|
||||
Map<String, Object> reportMap = objectMapper.readValue(report, new TypeReference<Map<String, Object>>() {});
|
||||
// 处理拉黑信息
|
||||
String vlogerId = (String) reportMap.get("vlogerId");
|
||||
blockUserList.add(vlogerId);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
map.put("blockUser",blockUserList);
|
||||
}
|
||||
}
|
||||
|
||||
List<IndexVlogVO> list = vlogMapperCustom.getIndexVlogList(map);
|
||||
|
||||
for (IndexVlogVO v : list) {
|
||||
String vlogerId = v.getVlogerId();
|
||||
String vlogId = v.getVlogId();
|
||||
|
||||
if (StringUtils.isNotBlank(userId)) {
|
||||
// 用户是否关注该博主
|
||||
boolean doIFollowVloger = fansService.queryDoIFollowVloger(userId, vlogerId);
|
||||
v.setDoIFollowVloger(doIFollowVloger);
|
||||
|
||||
// 判断当前用户是否点赞过视频
|
||||
v.setDoILikeThisVlog(doILikeVlog(userId, vlogId));
|
||||
}
|
||||
|
||||
// 获得当前视频被点赞过的总数
|
||||
v.setLikeCounts(getVlogBeLikedCounts(vlogId));
|
||||
// 评论数
|
||||
v.setCommentsCounts(getVlogComment(vlogId));
|
||||
}
|
||||
|
||||
// return list;
|
||||
return setterPagedGrid(list, page);
|
||||
}
|
||||
|
||||
private IndexVlogVO setterVO(IndexVlogVO v, String userId) {
|
||||
String vlogerId = v.getVlogerId();
|
||||
String vlogId = v.getVlogId();
|
||||
|
||||
if (StringUtils.isNotBlank(userId)) {
|
||||
// 用户是否关注该博主
|
||||
boolean doIFollowVloger = fansService.queryDoIFollowVloger(userId, vlogerId);
|
||||
v.setDoIFollowVloger(doIFollowVloger);
|
||||
|
||||
// 判断当前用户是否点赞过视频
|
||||
v.setDoILikeThisVlog(doILikeVlog(userId, vlogId));
|
||||
}
|
||||
|
||||
// 获得当前视频被点赞过的总数
|
||||
v.setLikeCounts(getVlogBeLikedCounts(vlogId));
|
||||
|
||||
return v;
|
||||
}
|
||||
//
|
||||
@Override
|
||||
public Integer getVlogBeLikedCounts(String vlogId) {
|
||||
String countsStr = redis.get(REDIS_VLOG_BE_LIKED_COUNTS + ":" + vlogId);
|
||||
if (StringUtils.isBlank(countsStr)) {
|
||||
countsStr = "0";
|
||||
}
|
||||
return Integer.valueOf(countsStr);
|
||||
}
|
||||
|
||||
private Integer getVlogComment(String vlogId) {
|
||||
String countsStr = redis.get(REDIS_VLOG_COMMENT_COUNTS + ":" + vlogId);
|
||||
if (StringUtils.isBlank(countsStr)) {
|
||||
countsStr = "0";
|
||||
}
|
||||
return Integer.valueOf(countsStr);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
private boolean doILikeVlog(String myId, String vlogId) {
|
||||
|
||||
String doILike = redis.get(REDIS_USER_LIKE_VLOG + ":" + myId + ":" + vlogId);
|
||||
boolean isLike = false;
|
||||
if (StringUtils.isNotBlank(doILike) && doILike.equalsIgnoreCase("1")) {
|
||||
isLike = true;
|
||||
}
|
||||
return isLike;
|
||||
}
|
||||
//
|
||||
@Override
|
||||
public IndexVlogVO getVlogDetailById(String userId, String vlogId) {
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("vlogId", vlogId);
|
||||
|
||||
List<IndexVlogVO> list = vlogMapperCustom.getVlogDetailById(map);
|
||||
|
||||
if (list != null && list.size() > 0 && !list.isEmpty()) {
|
||||
IndexVlogVO vlogVO = list.get(0);
|
||||
// return vlogVO;
|
||||
return setterVO(vlogVO, userId);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void changeToPrivateOrPublic(String userId,
|
||||
String vlogId,
|
||||
Integer yesOrNo) {
|
||||
// Example example = new Example(Vlog.class);
|
||||
// Example.Criteria criteria = example.createCriteria();
|
||||
// criteria.andEqualTo("id", vlogId);
|
||||
// criteria.andEqualTo("vlogerId", userId);
|
||||
//
|
||||
// Vlog pendingVlog = new Vlog();
|
||||
// pendingVlog.setIsPrivate(yesOrNo);
|
||||
|
||||
Map<String, Object> updates = new HashMap<>();
|
||||
updates.put("is_private", 2);
|
||||
Map<String, Object> conditions = new HashMap<>();
|
||||
conditions.put("id", vlogId);
|
||||
conditions.put("vloger_id", userId);
|
||||
vlogMapper.updateVlogByConditions(
|
||||
updates,
|
||||
conditions
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void changeVlogStatus(String userId,
|
||||
String vlogId,
|
||||
Integer status) {
|
||||
Map<String, Object> updates = new HashMap<>();
|
||||
updates.put("status", status);
|
||||
Map<String, Object> conditions = new HashMap<>();
|
||||
conditions.put("id", vlogId);
|
||||
conditions.put("vloger_id", userId);
|
||||
vlogMapper.updateVlogByConditions(
|
||||
updates,
|
||||
conditions
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PagedGridResult queryMyVlogList(String userId,
|
||||
String myId,
|
||||
Integer page,
|
||||
Integer pageSize,
|
||||
Integer yesOrNo) {
|
||||
|
||||
|
||||
PageHelper.startPage(page, pageSize);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// if (StringUtils.isNotBlank(search)) {
|
||||
// map.put("search", search);
|
||||
// }
|
||||
// if (StringUtils.isNotBlank(cityCode)) {
|
||||
// map.put("cityCode", cityCode);
|
||||
// }
|
||||
// if (StringUtils.isNotBlank(status)) {
|
||||
// map.put("status", status);
|
||||
// }
|
||||
|
||||
map.put("vlogerId", userId);
|
||||
if (StringUtils.isNotBlank(myId)) {
|
||||
// 从redis中获取举报信息
|
||||
String redisKeyRp = REDIS_VIDEO_BLOCK + ":" + myId;
|
||||
Boolean hasKeyRp = redis.keyIsExist(redisKeyRp);
|
||||
if(hasKeyRp){
|
||||
List<String> blockVdList = new ArrayList<>();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<String> reports = redis.lrange(redisKeyRp, 0, -1); // 查询用户的所有举报记录
|
||||
|
||||
for (String report : reports) {
|
||||
try {
|
||||
Map<String, Object> reportMap = objectMapper.readValue(report, new TypeReference<Map<String, Object>>() {});
|
||||
// 处理举报信息
|
||||
String vlogId = (String) reportMap.get("vlogId");
|
||||
blockVdList.add(vlogId);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
map.put("blockVd",blockVdList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
List<IndexVlogVO> list = vlogMapper.selectMyPublic(map);
|
||||
|
||||
for (IndexVlogVO v : list) {
|
||||
String vlogId = v.getVlogId();
|
||||
// 获得当前视频被点赞过的总数
|
||||
v.setLikeCounts(getVlogBeLikedCounts(vlogId));
|
||||
// 评论数
|
||||
v.setCommentsCounts(getVlogComment(vlogId));
|
||||
}
|
||||
return setterPagedGrid(list, page);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void userLikeVlog(String userId, String vlogId) {
|
||||
|
||||
String rid = sid.nextShort();
|
||||
|
||||
MyLikedVlog likedVlog = new MyLikedVlog();
|
||||
likedVlog.setId(rid);
|
||||
likedVlog.setVlogId(vlogId);
|
||||
likedVlog.setUserId(userId);
|
||||
likedVlog.setCreatedTime(new Date());
|
||||
|
||||
myLikedVlogMapper.insert(likedVlog);
|
||||
// System.out.println(vlogId);
|
||||
//
|
||||
// Vlog vlog = new Vlog();
|
||||
// vlog.setId(vlogId);
|
||||
// Vlog vlog1 = vlogMapper.selectOne(vlog);
|
||||
// System.out.println(vlog1.toString());
|
||||
//// System.out.println(vlog1.getCreatedTime());
|
||||
|
||||
// Vlog vlog2 = vlogMapper.selectByPrimaryKey(vlogId);
|
||||
// System.out.println(vlog2.toString());
|
||||
|
||||
// Vlog vlog1 = vlogMapper.selectOne(new Vlog().setId(vlogId));
|
||||
// Vlog vlog = vlog1
|
||||
// System.out.println(vlog);
|
||||
|
||||
// 系统消息:点赞短视频
|
||||
Vlog vlog = this.getVlog(vlogId);
|
||||
Map msgContent = new HashMap();
|
||||
msgContent.put("vlogId", vlogId);
|
||||
msgContent.put("vlogCover", vlog.getCover());
|
||||
msgService.createMsg(userId,
|
||||
vlog.getVlogerId(),
|
||||
MessageEnum.LIKE_VLOG.type,
|
||||
msgContent);
|
||||
}
|
||||
//
|
||||
@Override
|
||||
public Vlog getVlog(String id) {
|
||||
// Vlog vlog = vlogMapper.selectByPrimaryKey(id);
|
||||
// return vlog;
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("vlogId", id);
|
||||
|
||||
List<IndexVlogVO> list = vlogMapper.getVlogDetailFromId(map);
|
||||
|
||||
if (list != null && list.size() > 0 && !list.isEmpty()) {
|
||||
IndexVlogVO result = list.get(0);
|
||||
Vlog vlogVO = new Vlog();
|
||||
BeanUtils.copyProperties(result, vlogVO);
|
||||
return vlogVO;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void flushCounts(String vlogId, Integer counts) {
|
||||
//
|
||||
// Vlog vlog = new Vlog();
|
||||
// vlog.setId(vlogId);
|
||||
// vlog.setLikeCounts(counts);
|
||||
// int i = vlogMapper.updateByPrimaryKeySelective(vlog);
|
||||
|
||||
// 示例:更新 vlog 表
|
||||
Map<String, Object> updateFields = new HashMap<>();
|
||||
updateFields.put("like_counts", counts);
|
||||
|
||||
vlogMapper.dynamicUpdate(
|
||||
"id", // 主键字段名
|
||||
vlogId, // 主键值
|
||||
updateFields // 更新字段
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
@Transactional
|
||||
@Override
|
||||
public void userUnLikeVlog(String userId, String vlogId) {
|
||||
|
||||
MyLikedVlog likedVlog = new MyLikedVlog();
|
||||
likedVlog.setVlogId(vlogId);
|
||||
likedVlog.setUserId(userId);
|
||||
|
||||
myLikedVlogMapper.delete(likedVlog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PagedGridResult getMyLikedVlogList(String userId,
|
||||
String myId,
|
||||
Integer page,
|
||||
Integer pageSize) {
|
||||
PageHelper.startPage(page, pageSize);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("userId", userId);
|
||||
String useWho;
|
||||
if (StringUtils.isNotBlank(myId)) {
|
||||
useWho = myId;
|
||||
}else{
|
||||
useWho = userId;
|
||||
}
|
||||
// 从redis中获取拉黑信息
|
||||
String redisKey = REDIS_USER_BLOCK + ":" + useWho;
|
||||
Boolean hasKey = redis.keyIsExist(redisKey);
|
||||
if(hasKey){
|
||||
List<String> blockUserList = new ArrayList<>();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<String> reports = redis.lrange(redisKey, 0, -1); // 查询用户的所有举报记录
|
||||
|
||||
for (String report : reports) {
|
||||
try {
|
||||
Map<String, Object> reportMap = objectMapper.readValue(report, new TypeReference<Map<String, Object>>() {});
|
||||
// 处理拉黑信息
|
||||
String vlogerId = (String) reportMap.get("vlogerId");
|
||||
blockUserList.add(vlogerId);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
map.put("blockUser",blockUserList);
|
||||
System.out.println(blockUserList);
|
||||
}
|
||||
|
||||
// 从redis中获取举报信息
|
||||
String redisKeyRp = REDIS_VIDEO_BLOCK + ":" + useWho;
|
||||
Boolean hasKeyRp = redis.keyIsExist(redisKeyRp);
|
||||
if(hasKeyRp){
|
||||
List<String> blockVdList = new ArrayList<>();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<String> reports = redis.lrange(redisKeyRp, 0, -1); // 查询用户的所有举报记录
|
||||
|
||||
for (String report : reports) {
|
||||
try {
|
||||
Map<String, Object> reportMap = objectMapper.readValue(report, new TypeReference<Map<String, Object>>() {});
|
||||
// 处理举报信息
|
||||
String vlogId = (String) reportMap.get("vlogId");
|
||||
blockVdList.add(vlogId);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
map.put("blockVd",blockVdList);
|
||||
}
|
||||
|
||||
|
||||
List<IndexVlogVO> list = vlogMapperCustom.getMyLikedVlogList(map);
|
||||
|
||||
return setterPagedGrid(list, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PagedGridResult getMyFollowVlogList(String myId,
|
||||
Integer page,
|
||||
Integer pageSize) {
|
||||
PageHelper.startPage(page, pageSize);
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("myId", myId);
|
||||
|
||||
List<IndexVlogVO> list = vlogMapperCustom.getMyFollowVlogList(map);
|
||||
|
||||
for (IndexVlogVO v : list) {
|
||||
String vlogerId = v.getVlogerId();
|
||||
String vlogId = v.getVlogId();
|
||||
|
||||
if (StringUtils.isNotBlank(myId)) {
|
||||
// 用户必定关注该博主
|
||||
v.setDoIFollowVloger(true);
|
||||
|
||||
// 判断当前用户是否点赞过视频
|
||||
v.setDoILikeThisVlog(doILikeVlog(myId, vlogId));
|
||||
}
|
||||
|
||||
// 获得当前视频被点赞过的总数
|
||||
v.setLikeCounts(getVlogBeLikedCounts(vlogId));
|
||||
}
|
||||
|
||||
return setterPagedGrid(list, page);
|
||||
}
|
||||
//
|
||||
@Override
|
||||
public PagedGridResult getMyFriendVlogList(String myId,
|
||||
Integer page,
|
||||
Integer pageSize) {
|
||||
|
||||
PageHelper.startPage(page, pageSize);
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("myId", myId);
|
||||
|
||||
List<IndexVlogVO> list = vlogMapperCustom.getMyFriendVlogList(map);
|
||||
|
||||
for (IndexVlogVO v : list) {
|
||||
String vlogerId = v.getVlogerId();
|
||||
String vlogId = v.getVlogId();
|
||||
|
||||
if (StringUtils.isNotBlank(myId)) {
|
||||
// 用户必定关注该博主
|
||||
v.setDoIFollowVloger(true);
|
||||
|
||||
// 判断当前用户是否点赞过视频
|
||||
v.setDoILikeThisVlog(doILikeVlog(myId, vlogId));
|
||||
}
|
||||
|
||||
// 获得当前视频被点赞过的总数
|
||||
v.setLikeCounts(getVlogBeLikedCounts(vlogId));
|
||||
}
|
||||
|
||||
return setterPagedGrid(list, page);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Vlog getVlog(String id) {
|
||||
// return null;
|
||||
// }
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?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.imooc.mapper.CommentMapper" >
|
||||
<resultMap id="BaseResultMap" type="com.imooc.pojo.Comment" >
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" property="id" jdbcType="VARCHAR" />
|
||||
<result column="vloger_id" property="vlogerId" jdbcType="VARCHAR" />
|
||||
<result column="father_comment_id" property="fatherCommentId" jdbcType="VARCHAR" />
|
||||
<result column="vlog_id" property="vlogId" jdbcType="VARCHAR" />
|
||||
<result column="comment_user_id" property="commentUserId" jdbcType="VARCHAR" />
|
||||
<result column="content" property="content" jdbcType="VARCHAR" />
|
||||
<result column="like_counts" property="likeCounts" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
</resultMap>
|
||||
</mapper>
|
@ -0,0 +1,46 @@
|
||||
<?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.imooc.mapper.CommentMapperCustom" >
|
||||
|
||||
<!--
|
||||
FIXME
|
||||
思考:阿里规范明确规定不能超过三表关联,这里达到了四张表
|
||||
我们应该如何优化呢?使得sql脚本查询表位三表或者两表查询
|
||||
来实现呢又或者说我们能不能不使用数据库,使用别的手段(中间件)?mycat
|
||||
-->
|
||||
<select id="getCommentList" parameterType="map" resultType="com.imooc.vo.CommentVO">
|
||||
|
||||
SELECT
|
||||
c.id as commentId,
|
||||
c.vlog_id as vlogId,
|
||||
u.id as vlogerId,
|
||||
u.nickname as commentUserNickname,
|
||||
u.face as commentUserFace,
|
||||
c.father_comment_id as fatherCommentId,
|
||||
c.comment_user_id as commentUserId,
|
||||
c.content as content,
|
||||
c.like_counts as likeCounts,
|
||||
fu.nickname as replyedUserNickname,
|
||||
c.create_time as createTime
|
||||
FROM
|
||||
`t_comment` as c
|
||||
LEFT JOIN
|
||||
t_users as u
|
||||
ON
|
||||
c.comment_user_id = u.id
|
||||
LEFT JOIN
|
||||
`t_comment` as fc
|
||||
ON
|
||||
c.father_comment_id = fc.id
|
||||
LEFT JOIN
|
||||
t_users as fu
|
||||
ON
|
||||
fc.comment_user_id = fu.id
|
||||
WHERE
|
||||
c.vlog_id = #{paramMap.vlogId}
|
||||
ORDER BY
|
||||
c.like_counts DESC,
|
||||
c.create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,73 @@
|
||||
<?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.imooc.mapper.FansMapper" >
|
||||
<resultMap id="BaseResultMap" type="com.imooc.pojo.Fans" >
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" property="id" jdbcType="VARCHAR" />
|
||||
<result column="vloger_id" property="vlogerId" jdbcType="VARCHAR" />
|
||||
<result column="fan_id" property="fanId" jdbcType="VARCHAR" />
|
||||
<result column="is_fan_friend_of_mine" property="isFanFriendOfMine" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.imooc.pojo.Fans">
|
||||
UPDATE t_fans
|
||||
<set>
|
||||
<if test="vlogerId != null"> vloger_id = #{vlogerId}, </if>
|
||||
<if test="fanId != null"> fan_id = #{fanId}, </if>
|
||||
<if test="isFanFriendOfMine != null"> is_fan_friend_of_mine = #{isFanFriendOfMine}, </if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 单条插入 -->
|
||||
<insert id="insert">
|
||||
INSERT INTO t_fans
|
||||
<foreach collection="fansData.keys" item="key" open="(" separator="," close=")">
|
||||
${key}
|
||||
</foreach>
|
||||
VALUES
|
||||
<foreach collection="fansData.values" item="value" open="(" separator="," close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 查询 -->
|
||||
<select id="selectByExample" resultType="com.imooc.pojo.Fans" parameterType="map">
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
t_fans f
|
||||
WHERE
|
||||
vloger_id = #{paramMap.vlogerId}
|
||||
AND fan_id = #{paramMap.fanId}
|
||||
|
||||
</select>
|
||||
|
||||
<delete id="delete" parameterType="com.imooc.pojo.Fans">
|
||||
DELETE FROM t_fans
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="getFollowedVlogerIds" resultType="com.imooc.pojo.Fans" parameterType="map">
|
||||
|
||||
SELECT vloger_id, is_fan_friend_of_mine FROM t_fans
|
||||
WHERE fan_id = #{currentUserId}
|
||||
AND vloger_id IN
|
||||
<foreach collection='vlogerIds' item='vlogerId' open='(' separator=',' close=')'>
|
||||
#{vlogerId}
|
||||
</foreach>
|
||||
|
||||
</select>
|
||||
<!-- <select id="getFollowedVlogerIds" resultType="com.imooc.pojo.Fans" parameterType="map">-->
|
||||
<!-- SELECT vloger_id, MAX(is_fan_friend_of_mine) AS is_fan_friend_of_mine-->
|
||||
<!-- FROM t_fans-->
|
||||
<!-- WHERE fan_id = #{currentUserId}-->
|
||||
<!-- AND vloger_id IN-->
|
||||
<!-- <foreach collection='vlogerIds' item='vlogerId' open='(' separator=',' close=')'>-->
|
||||
<!-- #{vlogerId}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- GROUP BY vloger_id-->
|
||||
<!-- </select>-->
|
||||
</mapper>
|
@ -0,0 +1,49 @@
|
||||
<?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.imooc.mapper.FansMapperCustom" >
|
||||
|
||||
<select id="queryMyFollows" resultType="com.imooc.vo.VlogerVO" parameterType="map">
|
||||
|
||||
SELECT
|
||||
u.id as vlogerId,
|
||||
u.nickname as nickname,
|
||||
u.face as face,
|
||||
f.is_fan_friend_of_mine as bothFriend,
|
||||
f.created_time as createdTime
|
||||
FROM
|
||||
t_fans f
|
||||
LEFT JOIN
|
||||
t_users u
|
||||
ON
|
||||
f.vloger_id = u.id
|
||||
WHERE
|
||||
f.fan_id = #{paramMap.myId}
|
||||
ORDER BY
|
||||
f.created_time
|
||||
ASC
|
||||
|
||||
</select>
|
||||
|
||||
<select id="queryMyFans" resultType="com.imooc.vo.FansVO" parameterType="map">
|
||||
|
||||
SELECT
|
||||
u.id as fanId,
|
||||
u.nickname as nickname,
|
||||
u.face as face,
|
||||
f.is_fan_friend_of_mine as bothFriend,
|
||||
f.created_time as createdTime
|
||||
FROM
|
||||
t_fans f
|
||||
LEFT JOIN
|
||||
t_users u
|
||||
ON
|
||||
f.fan_id = u.id
|
||||
WHERE
|
||||
f.vloger_id = #{paramMap.myId}
|
||||
ORDER BY
|
||||
u.nickname
|
||||
ASC
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.imooc.mapper.MyLikedVlogMapper" >
|
||||
<resultMap id="BaseResultMap" type="com.imooc.pojo.MyLikedVlog" >
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" property="id" jdbcType="VARCHAR" />
|
||||
<result column="user_id" property="userId" jdbcType="VARCHAR" />
|
||||
<result column="vlog_id" property="vlogId" jdbcType="VARCHAR" />
|
||||
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP" />
|
||||
|
||||
</resultMap>
|
||||
</mapper>
|
@ -0,0 +1,45 @@
|
||||
<?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.imooc.mapper.UserMemberMapper">
|
||||
|
||||
<resultMap id="BaseResultMap"
|
||||
type="com.imooc.pojo.Users">
|
||||
<id column="id" property="id" jdbcType="VARCHAR" />
|
||||
<result column="mobile" property="mobile" jdbcType="VARCHAR" />
|
||||
<result column="nickname" property="nickname" jdbcType="VARCHAR" />
|
||||
<result column="imooc_num" property="imoocNum" jdbcType="VARCHAR" />
|
||||
<result column="face" property="face" jdbcType="VARCHAR" />
|
||||
<result column="sex" property="sex" jdbcType="INTEGER" />
|
||||
<result column="birthday" property="birthday" jdbcType="DATE" />
|
||||
<result column="country" property="country" jdbcType="VARCHAR" />
|
||||
<result column="province" property="province" jdbcType="VARCHAR" />
|
||||
<result column="city" property="city" jdbcType="VARCHAR" />
|
||||
<result column="district" property="district" jdbcType="VARCHAR" />
|
||||
<result column="description" property="description" jdbcType="VARCHAR" />
|
||||
<result column="bg_img" property="bgImg" jdbcType="VARCHAR" />
|
||||
<result column="can_imooc_num_be_updated" property="canImoocNumBeUpdated" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="getUserByMemberId" resultMap="BaseResultMap"
|
||||
parameterType="string">
|
||||
SELECT
|
||||
t1.id,
|
||||
t1.mobile,
|
||||
t1.nickname,
|
||||
t1.imooc_num,
|
||||
t1.face,
|
||||
t1.sex,
|
||||
t1.birthday,
|
||||
t1.country,
|
||||
t1.province,
|
||||
t1.city,
|
||||
t1.district,
|
||||
t1.description,
|
||||
t1.bg_img,
|
||||
t1.can_imooc_num_be_updated
|
||||
FROM t_users t1 INNER JOIN
|
||||
r_user_member t2 ON t1.id=t2.user_id
|
||||
WHERE t2.member_id=#{memberId}
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,27 @@
|
||||
<?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.imooc.mapper.UsersMapper" >
|
||||
<resultMap id="BaseResultMap" type="com.imooc.pojo.Users" >
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" property="id" jdbcType="VARCHAR" />
|
||||
<result column="mobile" property="mobile" jdbcType="VARCHAR" />
|
||||
<result column="nickname" property="nickname" jdbcType="VARCHAR" />
|
||||
<result column="imooc_num" property="imoocNum" jdbcType="VARCHAR" />
|
||||
<result column="face" property="face" jdbcType="VARCHAR" />
|
||||
<result column="sex" property="sex" jdbcType="INTEGER" />
|
||||
<result column="birthday" property="birthday" jdbcType="DATE" />
|
||||
<result column="country" property="country" jdbcType="VARCHAR" />
|
||||
<result column="province" property="province" jdbcType="VARCHAR" />
|
||||
<result column="city" property="city" jdbcType="VARCHAR" />
|
||||
<result column="district" property="district" jdbcType="VARCHAR" />
|
||||
<result column="description" property="description" jdbcType="VARCHAR" />
|
||||
<result column="bg_img" property="bgImg" jdbcType="VARCHAR" />
|
||||
<result column="can_imooc_num_be_updated" property="canImoocNumBeUpdated" jdbcType="INTEGER" />
|
||||
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP" />
|
||||
<result column="updated_time" property="updatedTime" jdbcType="TIMESTAMP" />
|
||||
<result column="password" property="password" jdbcType="VARCHAR" />
|
||||
|
||||
</resultMap>
|
||||
</mapper>
|
@ -0,0 +1,160 @@
|
||||
<?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.imooc.mapper.VlogMapper">
|
||||
<!-- 通用更新 -->
|
||||
<update id="dynamicUpdate">
|
||||
UPDATE t_vlog
|
||||
<set>
|
||||
<foreach collection="updateFields" index="key" item="value" separator=",">
|
||||
${key} = #{value}
|
||||
</foreach>
|
||||
</set>
|
||||
WHERE ${primaryKey} = #{idValue}
|
||||
</update>
|
||||
|
||||
<update id="updateVlogByConditions">
|
||||
UPDATE t_vlog
|
||||
<set>
|
||||
<foreach collection="updates" item="value" index="key" separator=",">
|
||||
${key} = #{value}
|
||||
</foreach>
|
||||
</set>
|
||||
<where>
|
||||
<foreach collection="conditions" item="value" index="key" separator=" AND ">
|
||||
<choose>
|
||||
<!-- 处理null值条件 -->
|
||||
<when test="value == null">
|
||||
${key} IS NULL
|
||||
</when>
|
||||
<!-- 处理IN条件 -->
|
||||
<when test="value instanceof java.util.Collection">
|
||||
${key} IN
|
||||
<foreach collection="value" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</when>
|
||||
<!-- 处理普通条件 -->
|
||||
<otherwise>
|
||||
${key} = #{value}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<!-- 单条插入 -->
|
||||
<insert id="dynamicInsert">
|
||||
INSERT INTO t_vlog
|
||||
<foreach collection="vlogData.keys" item="key" open="(" separator="," close=")">
|
||||
${key}
|
||||
</foreach>
|
||||
VALUES
|
||||
<foreach collection="vlogData.values" item="value" open="(" separator="," close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量插入 -->
|
||||
<insert id="dynamicBatchInsert">
|
||||
INSERT INTO t_vlog
|
||||
<foreach collection="vlogList[0].keys" item="key" open="(" separator="," close=")">
|
||||
${key}
|
||||
</foreach>
|
||||
VALUES
|
||||
<foreach collection="vlogList" item="vlogData" separator=",">
|
||||
<foreach collection="vlogData.values" item="value" open="(" separator="," close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 查询 -->
|
||||
<select id="selectMyPublic" parameterType="map" resultType="com.imooc.vo.IndexVlogVO">
|
||||
SELECT
|
||||
v.id as vlogId,
|
||||
v.vloger_id as vlogerId,
|
||||
u.face as vlogerFace,
|
||||
u.nickname as vlogerName,
|
||||
v.title as content,
|
||||
v.url as url,
|
||||
v.cover as cover,
|
||||
v.width as width,
|
||||
v.height as height,
|
||||
v.like_counts as likeCounts,
|
||||
v.comments_counts as commentsCounts,
|
||||
v.is_private as isPrivate,
|
||||
v.city_code as cityCode,
|
||||
v.reason as reason,
|
||||
v.file_id as fileId,
|
||||
v.status as status,
|
||||
v.first_frame_img as firstFrameImg
|
||||
FROM
|
||||
t_vlog v
|
||||
LEFT JOIN
|
||||
t_users u
|
||||
ON
|
||||
v.vloger_id = u.id
|
||||
WHERE
|
||||
v.is_private = 0
|
||||
AND v.vloger_id = #{paramMap.vlogerId}
|
||||
<choose>
|
||||
<when test="paramMap.status != null and paramMap.status!=''">
|
||||
AND v.status = #{paramMap.status}
|
||||
</when>
|
||||
<otherwise>
|
||||
AND v.status = 1
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="paramMap.cityCode != null and paramMap.cityCode != ''">
|
||||
AND v.city_code = #{paramMap.cityCode}
|
||||
</if>
|
||||
<if test="paramMap.search != null and paramMap.search != ''">
|
||||
AND v.title like '%${paramMap.search}%'
|
||||
</if>
|
||||
<if test="paramMap.blockVd != null and paramMap.blockVd.size() > 0">
|
||||
AND v.id NOT IN
|
||||
<foreach collection="paramMap.blockVd" item="vlogId" open="(" separator="," close=")">
|
||||
#{vlogId}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY
|
||||
v.created_time
|
||||
DESC
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getVlogDetailFromId" parameterType="map" resultType="com.imooc.vo.IndexVlogVO">
|
||||
SELECT
|
||||
v.id as vlogId,
|
||||
v.vloger_id as vlogerId,
|
||||
u.face as vlogerFace,
|
||||
u.nickname as vlogerName,
|
||||
v.title as content,
|
||||
v.url as url,
|
||||
v.cover as cover,
|
||||
v.width as width,
|
||||
v.height as height,
|
||||
v.like_counts as likeCounts,
|
||||
v.comments_counts as commentsCounts,
|
||||
v.is_private as isPrivate,
|
||||
v.city_code as cityCode,
|
||||
v.reason as reason,
|
||||
v.file_id as fileId,
|
||||
v.status as status,
|
||||
v.first_frame_img as firstFrameImg
|
||||
FROM
|
||||
t_vlog v
|
||||
LEFT JOIN
|
||||
t_users u
|
||||
ON
|
||||
v.vloger_id = u.id
|
||||
WHERE
|
||||
v.id = #{paramMap.vlogId}
|
||||
AND v.status = 1
|
||||
AND v.first_frame_img IS NOT NULL
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
@ -0,0 +1,229 @@
|
||||
<?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.imooc.mapper.VlogMapperCustom" >
|
||||
|
||||
<select id="getIndexVlogList" parameterType="map" resultType="com.imooc.vo.IndexVlogVO">
|
||||
SELECT
|
||||
v.id as vlogId,
|
||||
v.vloger_id as vlogerId,
|
||||
u.face as vlogerFace,
|
||||
u.nickname as vlogerName,
|
||||
v.title as content,
|
||||
v.url as url,
|
||||
v.cover as cover,
|
||||
v.width as width,
|
||||
v.height as height,
|
||||
v.like_counts as likeCounts,
|
||||
v.comments_counts as commentsCounts,
|
||||
v.is_private as isPrivate,
|
||||
v.city_code as cityCode,
|
||||
v.reason as reason,
|
||||
v.file_id as fileId,
|
||||
v.status as status,
|
||||
v.first_frame_img as firstFrameImg
|
||||
FROM
|
||||
t_vlog v
|
||||
LEFT JOIN
|
||||
t_users u
|
||||
ON
|
||||
v.vloger_id = u.id
|
||||
WHERE
|
||||
v.is_private = 0
|
||||
<choose>
|
||||
<when test="paramMap.status != null and paramMap.status!=''">
|
||||
AND v.status = #{paramMap.status}
|
||||
</when>
|
||||
<otherwise>
|
||||
AND v.status = 1
|
||||
</otherwise>
|
||||
</choose>
|
||||
AND v.first_frame_img IS NOT NULL
|
||||
<if test="paramMap.cityCode != null and paramMap.cityCode != ''">
|
||||
AND v.city_code = #{paramMap.cityCode}
|
||||
</if>
|
||||
<if test="paramMap.search != null and paramMap.search != ''">
|
||||
AND v.title like '%${paramMap.search}%'
|
||||
</if>
|
||||
<if test="paramMap.blockVd != null and paramMap.blockVd.size() > 0">
|
||||
AND v.id NOT IN
|
||||
<foreach collection="paramMap.blockVd" item="vlogId" open="(" separator="," close=")">
|
||||
#{vlogId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="paramMap.blockUser != null and paramMap.blockUser.size() > 0">
|
||||
AND v.vloger_id NOT IN
|
||||
<foreach collection="paramMap.blockUser" item="vlogerId" open="(" separator="," close=")">
|
||||
#{vlogerId}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY
|
||||
v.created_time
|
||||
DESC
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getVlogDetailById" parameterType="map" resultType="com.imooc.vo.IndexVlogVO">
|
||||
SELECT
|
||||
v.id as vlogId,
|
||||
v.vloger_id as vlogerId,
|
||||
u.face as vlogerFace,
|
||||
u.nickname as vlogerName,
|
||||
v.title as content,
|
||||
v.url as url,
|
||||
v.cover as cover,
|
||||
v.width as width,
|
||||
v.height as height,
|
||||
v.like_counts as likeCounts,
|
||||
v.comments_counts as commentsCounts,
|
||||
v.is_private as isPrivate,
|
||||
v.city_code as cityCode,
|
||||
v.reason as reason,
|
||||
v.file_id as fileId,
|
||||
v.status as status,
|
||||
v.first_frame_img as firstFrameImg
|
||||
FROM
|
||||
t_vlog v
|
||||
LEFT JOIN
|
||||
t_users u
|
||||
ON
|
||||
v.vloger_id = u.id
|
||||
WHERE
|
||||
v.id = #{paramMap.vlogId}
|
||||
AND v.status = 1
|
||||
AND v.first_frame_img IS NOT NULL
|
||||
</select>
|
||||
|
||||
<select id="getMyLikedVlogList" parameterType="map" resultType="com.imooc.vo.IndexVlogVO">
|
||||
SELECT
|
||||
v.id as vlogId,
|
||||
v.vloger_id as vlogerId,
|
||||
-- u.face as vlogerFace,
|
||||
-- u.nickname as vlogerName,
|
||||
v.title as content,
|
||||
v.url as url,
|
||||
v.cover as cover,
|
||||
v.width as width,
|
||||
v.height as height,
|
||||
v.like_counts as likeCounts,
|
||||
v.comments_counts as commentsCounts,
|
||||
v.is_private as isPrivate,
|
||||
v.city_code as cityCode,
|
||||
v.reason as reason,
|
||||
v.status as status,
|
||||
v.file_id as fileId,
|
||||
v.first_frame_img as firstFrameImg
|
||||
FROM
|
||||
t_vlog v
|
||||
LEFT JOIN
|
||||
t_my_liked_vlog mlv
|
||||
ON
|
||||
v.id = mlv.vlog_id
|
||||
LEFT JOIN
|
||||
t_users u
|
||||
ON
|
||||
mlv.user_id = u.id
|
||||
WHERE
|
||||
u.id = #{paramMap.userId}
|
||||
AND v.status = 1
|
||||
AND v.first_frame_img IS NOT NULL
|
||||
AND v.is_private = 0
|
||||
<if test="paramMap.blockVd != null and paramMap.blockVd.size() > 0">
|
||||
AND v.id NOT IN
|
||||
<foreach collection="paramMap.blockVd" item="vlogId" open="(" separator="," close=")">
|
||||
#{vlogId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="paramMap.blockUser != null and paramMap.blockUser.size() > 0">
|
||||
AND v.vloger_id NOT IN
|
||||
<foreach collection="paramMap.blockUser" item="vlogerId" open="(" separator="," close=")">
|
||||
#{vlogerId}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY
|
||||
v.created_time
|
||||
DESC
|
||||
</select>
|
||||
|
||||
<select id="getMyFollowVlogList" parameterType="map" resultType="com.imooc.vo.IndexVlogVO">
|
||||
SELECT
|
||||
v.id as vlogId,
|
||||
v.vloger_id as vlogerId,
|
||||
u.face as vlogerFace,
|
||||
u.nickname as vlogerName,
|
||||
v.title as content,
|
||||
v.url as url,
|
||||
v.cover as cover,
|
||||
v.width as width,
|
||||
v.height as height,
|
||||
v.like_counts as likeCounts,
|
||||
v.comments_counts as commentsCounts,
|
||||
v.is_private as isPrivate,
|
||||
v.city_code as cityCode,
|
||||
v.reason as reason,
|
||||
v.status as status,
|
||||
v.file_id as fileId,
|
||||
v.first_frame_img as firstFrameImg
|
||||
FROM
|
||||
t_vlog v
|
||||
LEFT JOIN
|
||||
t_fans f
|
||||
ON
|
||||
v.vloger_id = f.vloger_id
|
||||
LEFT JOIN
|
||||
t_users u
|
||||
ON
|
||||
f.vloger_id = u.id
|
||||
WHERE
|
||||
v.is_private = 0
|
||||
AND v.status = 1
|
||||
AND v.first_frame_img IS NOT NULL
|
||||
AND
|
||||
f.fan_id = #{paramMap.myId}
|
||||
ORDER BY
|
||||
v.created_time
|
||||
DESC
|
||||
</select>
|
||||
|
||||
<select id="getMyFriendVlogList" parameterType="map" resultType="com.imooc.vo.IndexVlogVO">
|
||||
SELECT
|
||||
v.id as vlogId,
|
||||
v.vloger_id as vlogerId,
|
||||
u.face as vlogerFace,
|
||||
u.nickname as vlogerName,
|
||||
v.title as content,
|
||||
v.url as url,
|
||||
v.cover as cover,
|
||||
v.width as width,
|
||||
v.height as height,
|
||||
v.like_counts as likeCounts,
|
||||
v.comments_counts as commentsCounts,
|
||||
v.is_private as isPrivate,
|
||||
v.city_code as cityCode,
|
||||
v.reason as reason,
|
||||
v.status as status,
|
||||
v.file_id as fileId,
|
||||
v.first_frame_img as firstFrameImg
|
||||
FROM
|
||||
t_vlog v
|
||||
LEFT JOIN
|
||||
t_fans f
|
||||
ON
|
||||
v.vloger_id = f.fan_id
|
||||
LEFT JOIN
|
||||
t_users u
|
||||
ON
|
||||
f.fan_id = u.id
|
||||
WHERE
|
||||
v.is_private = 0
|
||||
AND v.status = 1
|
||||
AND v.first_frame_img IS NOT NULL
|
||||
AND
|
||||
f.vloger_id = #{paramMap.myId}
|
||||
AND
|
||||
f.is_fan_friend_of_mine = 1
|
||||
ORDER BY
|
||||
v.created_time
|
||||
DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
102
ruoyi-modules/ruoyi-goods/pom.xml
Normal file
102
ruoyi-modules/ruoyi-goods/pom.xml
Normal file
@ -0,0 +1,102 @@
|
||||
<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>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-modules</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-goods</artifactId>
|
||||
|
||||
<description>
|
||||
system系统模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-doc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-translation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- OSS功能模块 -->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-oss</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- excel-->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SMS功能模块 -->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-sms</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-tenant</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-idempotent</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-sensitive</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-encrypt</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-sse</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
@ -0,0 +1,82 @@
|
||||
package com.wzj.soopin.goods.controller;
|
||||
|
||||
|
||||
import com.wzj.soopin.goods.service.BrandService;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 品牌管理Controller
|
||||
*
|
||||
* @author zcc
|
||||
* @date 2022-11-28
|
||||
*/
|
||||
@Api(description ="品牌管理接口列表")
|
||||
@RestController
|
||||
@RequestMapping("/pms/brand")
|
||||
public class BrandController extends BaseController {
|
||||
@Autowired
|
||||
private BrandService service;
|
||||
@Autowired
|
||||
private BrandConvert convert;
|
||||
|
||||
@ApiOperation("查询品牌管理列表")
|
||||
@PreAuthorize("@ss.hasPermi('pms:brand:list')")
|
||||
@PostMapping("/list")
|
||||
public ResponseEntity<Page<Brand>> list(@RequestBody BrandQuery query, Pageable page) {
|
||||
List<Brand> list = service.selectList(query, page);
|
||||
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal()));
|
||||
}
|
||||
@ApiOperation("所有品牌管理列表")
|
||||
@PreAuthorize("@ss.hasPermi('pms:brand:list')")
|
||||
@PostMapping("/all")
|
||||
public ResponseEntity<List<Brand>> all(@RequestBody BrandQuery query) {
|
||||
return ResponseEntity.ok(service.selectList(query, null));
|
||||
}
|
||||
|
||||
@ApiOperation("导出品牌管理列表")
|
||||
@PreAuthorize("@ss.hasPermi('pms:brand:export')")
|
||||
@Log(title = "品牌管理", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public ResponseEntity<String> export(BrandQuery query) {
|
||||
List<Brand> list = service.selectList(query, null);
|
||||
ExcelUtil<BrandVO> util = new ExcelUtil<>(BrandVO.class);
|
||||
return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "品牌管理数据"));
|
||||
}
|
||||
|
||||
@ApiOperation("获取品牌管理详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('pms:brand:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResponseEntity<Brand> getInfo(@PathVariable("id") Long id) {
|
||||
return ResponseEntity.ok(service.selectById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("新增品牌管理")
|
||||
@PreAuthorize("@ss.hasPermi('pms:brand:add')")
|
||||
@Log(title = "品牌管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public ResponseEntity<Integer> add(@RequestBody Brand brand) {
|
||||
return ResponseEntity.ok(service.insert(brand));
|
||||
}
|
||||
|
||||
@ApiOperation("修改品牌管理")
|
||||
@PreAuthorize("@ss.hasPermi('pms:brand:edit')")
|
||||
@Log(title = "品牌管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public ResponseEntity<Integer> edit(@RequestBody Brand brand) {
|
||||
return ResponseEntity.ok(service.update(brand));
|
||||
}
|
||||
|
||||
@ApiOperation("删除品牌管理")
|
||||
@PreAuthorize("@ss.hasPermi('pms:brand:remove')")
|
||||
@Log(title = "品牌管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseEntity<Integer> remove(@PathVariable Long id) {
|
||||
return ResponseEntity.ok(service.deleteById(id));
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package com.wzj.soopin.goods.controller;
|
||||
|
||||
import com.cyl.manager.pms.convert.ProductCategoryConvert;
|
||||
import com.cyl.manager.pms.domain.entity.ProductCategory;
|
||||
import com.cyl.manager.pms.domain.query.ProductCategoryQuery;
|
||||
import com.cyl.manager.pms.domain.vo.ProductCategoryVO;
|
||||
import com.cyl.manager.pms.service.ProductCategoryService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品分类Controller
|
||||
*
|
||||
* @author zcc
|
||||
* @date 2022-11-28
|
||||
*/
|
||||
@Api(description ="商品分类接口列表")
|
||||
@RestController
|
||||
@RequestMapping("/pms/productCategory")
|
||||
public class ProductCategoryController extends BaseController {
|
||||
@Autowired
|
||||
private ProductCategoryService service;
|
||||
@Autowired
|
||||
private ProductCategoryConvert convert;
|
||||
|
||||
@ApiOperation("查询商品分类列表")
|
||||
@PreAuthorize("@ss.hasPermi('pms:productCategory:list')")
|
||||
@PostMapping("/list")
|
||||
public ResponseEntity<List<ProductCategoryVO>> list(@RequestBody ProductCategoryQuery query) {
|
||||
List<ProductCategoryVO> list = service.selectList(query, null);
|
||||
return ResponseEntity.ok(list);
|
||||
}
|
||||
|
||||
@ApiOperation("获取商品分类详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('pms:productCategory:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResponseEntity<ProductCategory> getInfo(@PathVariable("id") Long id) {
|
||||
return ResponseEntity.ok(service.selectById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("新增商品分类")
|
||||
@PreAuthorize("@ss.hasPermi('pms:productCategory:add')")
|
||||
@Log(title = "商品分类", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public ResponseEntity<Integer> add(@RequestBody ProductCategory productCategory) {
|
||||
return ResponseEntity.ok(service.insert(productCategory));
|
||||
}
|
||||
|
||||
@ApiOperation("修改商品分类")
|
||||
@PreAuthorize("@ss.hasPermi('pms:productCategory:edit')")
|
||||
@Log(title = "商品分类", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public ResponseEntity<Integer> edit(@RequestBody ProductCategory productCategory) {
|
||||
return ResponseEntity.ok(service.update(productCategory));
|
||||
}
|
||||
|
||||
@ApiOperation("删除商品分类")
|
||||
@PreAuthorize("@ss.hasPermi('pms:productCategory:remove')")
|
||||
@Log(title = "商品分类", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseEntity<Integer> remove(@PathVariable Long id) {
|
||||
return ResponseEntity.ok(service.deleteById(id));
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package com.wzj.soopin.goods.controller;
|
||||
|
||||
import com.cyl.manager.pms.convert.ProductConvert;
|
||||
import com.cyl.manager.pms.domain.entity.Product;
|
||||
import com.cyl.manager.pms.domain.query.ProductQuery;
|
||||
import com.cyl.manager.pms.domain.vo.ProductVO;
|
||||
import com.cyl.manager.pms.service.ProductService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 商品信息Controller
|
||||
*
|
||||
* @author zcc
|
||||
* @date 2022-11-28
|
||||
*/
|
||||
@Api(description ="商品信息接口列表")
|
||||
@RestController
|
||||
@RequestMapping("/pms/product")
|
||||
public class ProductController extends BaseController {
|
||||
@Autowired
|
||||
private ProductService service;
|
||||
@Autowired
|
||||
private ProductConvert convert;
|
||||
|
||||
@ApiOperation("查询商品信息列表")
|
||||
@PreAuthorize("@ss.hasPermi('pms:product:list')")
|
||||
@PostMapping("/list")
|
||||
public ResponseEntity<Page<Product>> list(@RequestBody ProductQuery query, Pageable page) {
|
||||
List<Product> list = service.selectList(query, page);
|
||||
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("导出商品信息列表")
|
||||
@PreAuthorize("@ss.hasPermi('pms:product:export')")
|
||||
@Log(title = "商品信息", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public ResponseEntity<String> export(ProductQuery query) {
|
||||
List<Product> list = service.selectList(query, null);
|
||||
ExcelUtil<ProductVO> util = new ExcelUtil<>(ProductVO.class);
|
||||
return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "商品信息数据"));
|
||||
}
|
||||
|
||||
@ApiOperation("获取商品信息详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('pms:product:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResponseEntity<ProductVO> getInfo(@PathVariable("id") Long id) {
|
||||
return ResponseEntity.ok(service.selectById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("新增商品信息")
|
||||
@PreAuthorize("@ss.hasPermi('pms:product:add')")
|
||||
@Log(title = "商品信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public ResponseEntity<Integer> add(@RequestBody ProductVO product) {
|
||||
return ResponseEntity.ok(service.insert(product));
|
||||
}
|
||||
|
||||
@ApiOperation("修改商品信息")
|
||||
@PreAuthorize("@ss.hasPermi('pms:product:edit')")
|
||||
@Log(title = "商品信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public ResponseEntity<Integer> edit(@RequestBody ProductVO product) {
|
||||
return ResponseEntity.ok(service.update(product));
|
||||
}
|
||||
|
||||
@ApiOperation("删除商品信息")
|
||||
@PreAuthorize("@ss.hasPermi('pms:product:remove')")
|
||||
@Log(title = "商品信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseEntity<Integer> remove(@PathVariable Long id) {
|
||||
return ResponseEntity.ok(service.deleteById(id));
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package com.wzj.soopin.goods.controller;
|
||||
|
||||
import com.cyl.manager.pms.convert.SkuConvert;
|
||||
import com.cyl.manager.pms.domain.entity.Sku;
|
||||
import com.cyl.manager.pms.domain.query.SkuQuery;
|
||||
import com.cyl.manager.pms.domain.vo.SkuVO;
|
||||
import com.cyl.manager.pms.service.SkuService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* sku信息Controller
|
||||
*
|
||||
* @author zcc
|
||||
* @date 2022-11-28
|
||||
*/
|
||||
@Api(description ="sku信息接口列表")
|
||||
@RestController
|
||||
@RequestMapping("/pms/sku")
|
||||
public class SkuController extends BaseController {
|
||||
@Autowired
|
||||
private SkuService service;
|
||||
@Autowired
|
||||
private SkuConvert convert;
|
||||
|
||||
@ApiOperation("查询sku信息列表")
|
||||
@PreAuthorize("@ss.hasPermi('pms:sku:list')")
|
||||
@PostMapping("/list")
|
||||
public ResponseEntity<Page<Sku>> list(@RequestBody SkuQuery query, Pageable page) {
|
||||
List<Sku> list = service.selectList(query, page);
|
||||
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("导出sku信息列表")
|
||||
@PreAuthorize("@ss.hasPermi('pms:sku:export')")
|
||||
@Log(title = "sku信息", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public ResponseEntity<String> export(SkuQuery query) {
|
||||
List<Sku> list = service.selectList(query, null);
|
||||
ExcelUtil<SkuVO> util = new ExcelUtil<>(SkuVO.class);
|
||||
return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "sku信息数据"));
|
||||
}
|
||||
|
||||
@ApiOperation("获取sku信息详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('pms:sku:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResponseEntity<Sku> getInfo(@PathVariable("id") Long id) {
|
||||
return ResponseEntity.ok(service.selectById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("新增sku信息")
|
||||
@PreAuthorize("@ss.hasPermi('pms:sku:add')")
|
||||
@Log(title = "sku信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public ResponseEntity<Integer> add(@RequestBody Sku sku) {
|
||||
return ResponseEntity.ok(service.insert(sku));
|
||||
}
|
||||
|
||||
@ApiOperation("修改sku信息")
|
||||
@PreAuthorize("@ss.hasPermi('pms:sku:edit')")
|
||||
@Log(title = "sku信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public ResponseEntity<Integer> edit(@RequestBody Sku sku) {
|
||||
return ResponseEntity.ok(service.update(sku));
|
||||
}
|
||||
|
||||
@ApiOperation("删除sku信息")
|
||||
@PreAuthorize("@ss.hasPermi('pms:sku:remove')")
|
||||
@Log(title = "sku信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseEntity<Integer> remove(@PathVariable Long id) {
|
||||
return ResponseEntity.ok(service.deleteById(id));
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.wzj.soopin.goods.convert;
|
||||
|
||||
import com.cyl.manager.pms.domain.entity.Brand;
|
||||
import com.cyl.manager.pms.domain.vo.BrandVO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 品牌管理 DO <=> DTO <=> VO / BO / Query
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface BrandConvert {
|
||||
|
||||
List<BrandVO> dos2vos(List<Brand> list);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.wzj.soopin.goods.convert;
|
||||
|
||||
import com.cyl.h5.domain.dto.CategoryDTO;
|
||||
import com.cyl.manager.pms.domain.entity.ProductCategory;
|
||||
import com.cyl.manager.pms.domain.vo.ProductCategoryVO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 商品分类 DO <=> DTO <=> VO / BO / Query
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface ProductCategoryConvert {
|
||||
|
||||
List<ProductCategoryVO> dos2vos(List<ProductCategory> list);
|
||||
|
||||
CategoryDTO do2dto(ProductCategory it);
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.wzj.soopin.goods.convert;
|
||||
|
||||
import com.cyl.h5.domain.vo.H5ProductVO;
|
||||
import com.cyl.manager.pms.domain.entity.Product;
|
||||
import com.cyl.manager.pms.domain.vo.ProductVO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 商品信息 DO <=> DTO <=> VO / BO / Query
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface ProductConvert {
|
||||
|
||||
List<ProductVO> dos2vos(List<Product> list);
|
||||
Product vo2do(ProductVO productVO);
|
||||
ProductVO do2vo(Product product);
|
||||
|
||||
List<H5ProductVO> dos2dtos(List<Product> products);
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.wzj.soopin.goods.convert;
|
||||
|
||||
import com.cyl.manager.pms.domain.entity.Sku;
|
||||
import com.cyl.manager.pms.domain.vo.SkuVO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* sku信息 DO <=> DTO <=> VO / BO / Query
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface SkuConvert {
|
||||
|
||||
List<SkuVO> dos2vos(List<Sku> list);
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.wzj.soopin.goods.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseAudit;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
/**
|
||||
* 品牌管理对象 pms_brand
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@ApiModel(description="品牌管理对象")
|
||||
@Data
|
||||
@TableName("pms_brand")
|
||||
public class Brand extends BaseAudit {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("NAME")
|
||||
@Excel(name = "NAME")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("SORT")
|
||||
@Excel(name = "SORT")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty("SHOW_STATUS")
|
||||
@Excel(name = "SHOW_STATUS")
|
||||
private Integer showStatus;
|
||||
|
||||
@ApiModelProperty("品牌logo")
|
||||
@Excel(name = "品牌logo")
|
||||
private String logo;
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user