├── project-screenshot
├── default.png
├── 微信图片_20240910165649.jpg
├── 微信图片_20240910165704.jpg
├── 微信图片_20240910165709.jpg
├── 微信图片_20240910165714.jpg
├── 微信图片_20240910165718.jpg
├── 微信图片_20240910165723.jpg
├── 微信图片_20240910165728.jpg
├── 微信图片_20240910165733.jpg
├── 微信图片_20240910165738.jpg
├── 微信图片_20240910165743.jpg
├── 微信图片_20240910165942.jpg
└── Screenshot_20240910_165224.png
├── .idea
├── .gitignore
├── vcs.xml
├── sqldialects.xml
├── UniappTool.xml
├── JavaSceneConfigState.xml
├── UniappProjectData.xml
├── misc.xml
├── ProjectStorage.xml
├── dataSources.xml
└── encodings.xml
├── xfs-common
├── common-mybatis
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ └── META-INF
│ │ │ │ └── spring.factories
│ │ │ └── java
│ │ │ └── com
│ │ │ └── yyh
│ │ │ └── xfs
│ │ │ └── common
│ │ │ └── mybatis
│ │ │ ├── config
│ │ │ └── MybatisPlusConfig.java
│ │ │ └── handler
│ │ │ └── MyMetaObjectHandler.java
│ └── pom.xml
├── common-base
│ ├── src
│ │ └── main
│ │ │ └── java
│ │ │ └── com
│ │ │ └── yyh
│ │ │ └── xfs
│ │ │ └── common
│ │ │ ├── utils
│ │ │ ├── Md5Util.java
│ │ │ ├── TimeUtil.java
│ │ │ ├── FieldValidationUtil.java
│ │ │ ├── HtmlParseUtils.java
│ │ │ ├── ResultUtil.java
│ │ │ └── CodeUtil.java
│ │ │ ├── domain
│ │ │ ├── Result.java
│ │ │ └── PageParam.java
│ │ │ ├── constant
│ │ │ ├── RocketMQTopicConstant.java
│ │ │ ├── RocketMQConsumerGroupConstant.java
│ │ │ └── StatusCode.java
│ │ │ └── myEnum
│ │ │ ├── MessageTypeEnum.java
│ │ │ └── ExceptionMsgEnum.java
│ └── pom.xml
├── common-redis
│ ├── src
│ │ └── main
│ │ │ ├── resources
│ │ │ └── META-INF
│ │ │ │ └── spring.factories
│ │ │ └── java
│ │ │ └── com
│ │ │ └── yyh
│ │ │ └── xfs
│ │ │ └── common
│ │ │ └── redis
│ │ │ ├── utils
│ │ │ └── RedisKey.java
│ │ │ ├── constant
│ │ │ └── BloomFilterMap.java
│ │ │ ├── properties
│ │ │ └── RedisProperties.java
│ │ │ └── config
│ │ │ ├── RedissonConfig.java
│ │ │ └── CustomRedisConfig.java
│ └── pom.xml
├── common-web
│ ├── src
│ │ └── main
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── yyh
│ │ │ │ └── xfs
│ │ │ │ └── common
│ │ │ │ └── web
│ │ │ │ ├── aop
│ │ │ │ ├── bloomFilter
│ │ │ │ │ └── BloomFilterProcessing.java
│ │ │ │ └── idempotent
│ │ │ │ │ └── Idempotent.java
│ │ │ │ ├── properties
│ │ │ │ ├── GaoDeMapProperties.java
│ │ │ │ ├── TrtcProperties.java
│ │ │ │ └── JwtProperties.java
│ │ │ │ ├── exception
│ │ │ │ ├── OnlyWarnException.java
│ │ │ │ ├── SystemException.java
│ │ │ │ ├── BusinessException.java
│ │ │ │ └── handler
│ │ │ │ │ └── GlobalExceptionHandler.java
│ │ │ │ ├── config
│ │ │ │ ├── FeignConfig.java
│ │ │ │ ├── SwaggerConfig.java
│ │ │ │ └── WebMvcConfig.java
│ │ │ │ └── utils
│ │ │ │ └── JWTUtil.java
│ │ │ └── resources
│ │ │ └── META-INF
│ │ │ └── spring.factories
│ └── pom.xml
└── pom.xml
├── config
├── init-message.js
├── run.sh
├── elasticsearch.yml
└── broker.conf
├── xfs-modules-server
├── xfs-search-server
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── yyh
│ │ │ │ └── xfs
│ │ │ │ └── search
│ │ │ │ ├── service
│ │ │ │ ├── ElasticSearchInitService.java
│ │ │ │ ├── UserSearchService.java
│ │ │ │ ├── NotesSearchService.java
│ │ │ │ └── impl
│ │ │ │ │ └── ElasticSearchInitServiceImpl.java
│ │ │ │ ├── feign
│ │ │ │ └── UserFeign.java
│ │ │ │ ├── SearchApplication.java
│ │ │ │ ├── consumer
│ │ │ │ ├── notes
│ │ │ │ │ ├── NotesDeleteEsConsumer.java
│ │ │ │ │ ├── NotesAddEsConsumer.java
│ │ │ │ │ ├── NotesUpdateEsConsumer.java
│ │ │ │ │ └── NotesUpdateCountConsumer.java
│ │ │ │ └── user
│ │ │ │ │ ├── UserUpdateEsConsumer.java
│ │ │ │ │ └── UserAddEsConsumer.java
│ │ │ │ ├── controller
│ │ │ │ ├── UserSearchController.java
│ │ │ │ ├── ElasticSearchInitController.java
│ │ │ │ └── NotesSearchController.java
│ │ │ │ └── config
│ │ │ │ └── EsConfig.java
│ │ └── resources
│ │ │ └── bootstrap.yml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── yyh
│ │ └── xfs
│ │ └── search
│ │ └── SearchApplicationTest.java
├── xfs-notes-server
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── yyh
│ │ │ └── xfs
│ │ │ └── notes
│ │ │ ├── service
│ │ │ ├── NotesCategoryService.java
│ │ │ ├── impl
│ │ │ │ └── NotesCategoryServiceImpl.java
│ │ │ └── NotesService.java
│ │ │ ├── mapper
│ │ │ ├── NotesTopicMapper.java
│ │ │ ├── UserLikeNotesMapper.java
│ │ │ ├── UserCollectNotesMapper.java
│ │ │ ├── NotesTopicRelationMapper.java
│ │ │ ├── UserViewsRecordNotesMapper.java
│ │ │ ├── NotesCategoryMapper.java
│ │ │ └── NotesMapper.java
│ │ │ ├── config
│ │ │ ├── BaiduAiConfig.java
│ │ │ └── NotesConfig.java
│ │ │ ├── NotesApplication.java
│ │ │ ├── feign
│ │ │ └── UserFeign.java
│ │ │ ├── controller
│ │ │ └── NotesCategoryController.java
│ │ │ └── consumer
│ │ │ └── RemoveCacheConsumer.java
│ │ └── resources
│ │ ├── bootstrap.yml
│ │ └── mapper
│ │ ├── NotesTopicRelationMapper.xml
│ │ ├── UserLikeNotesMapper.xml
│ │ ├── UserCollectNotesMapper.xml
│ │ ├── NotesCategoryMapper.xml
│ │ ├── UserViewsRecordNotesMapper.xml
│ │ └── NotesTopicMapper.xml
├── xfs-im-server
│ └── src
│ │ ├── main
│ │ ├── resources
│ │ │ └── bootstrap.yml
│ │ └── java
│ │ │ └── com
│ │ │ └── yyh
│ │ │ └── xfs
│ │ │ └── im
│ │ │ ├── handler
│ │ │ └── types
│ │ │ │ └── AttentionHandler.java
│ │ │ ├── config
│ │ │ └── ImConfig.java
│ │ │ ├── IMApplication.java
│ │ │ ├── feign
│ │ │ └── user
│ │ │ │ └── UserFeign.java
│ │ │ ├── initialzer
│ │ │ └── IMServerInitialzer.java
│ │ │ └── consumer
│ │ │ ├── PraiseAndCollectNotificationConsumer.java
│ │ │ └── FindUserConsumer.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── yyh
│ │ └── xfs
│ │ └── im
│ │ └── IMApplicationTest.java
├── xfs-user-server
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── yyh
│ │ │ └── xfs
│ │ │ └── user
│ │ │ ├── mapper
│ │ │ ├── UserMapper.java
│ │ │ ├── UserBlackMapper.java
│ │ │ ├── UserFansMapper.java
│ │ │ └── UserAttentionMapper.java
│ │ │ ├── UserApplication.java
│ │ │ ├── service
│ │ │ └── UserRelationService.java
│ │ │ └── config
│ │ │ └── UserConfig.java
│ │ └── resources
│ │ ├── bootstrap.yml
│ │ └── mapper
│ │ ├── UserBlackMapper.xml
│ │ ├── UserFansMapper.xml
│ │ ├── UserAttentionMapper.xml
│ │ └── UserMapper.xml
├── xfs-comment-server
│ └── src
│ │ ├── main
│ │ ├── resources
│ │ │ └── bootstrap.yml
│ │ └── java
│ │ │ └── com
│ │ │ └── yyh
│ │ │ └── xfs
│ │ │ └── comment
│ │ │ ├── feign
│ │ │ ├── NotesFeign.java
│ │ │ └── UserFeign.java
│ │ │ ├── CommentApplication.java
│ │ │ ├── service
│ │ │ └── CommentService.java
│ │ │ └── consumer
│ │ │ └── NotesDeleteCommentConsumer.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── yyh
│ │ └── xfs
│ │ └── comment
│ │ └── CommentApplicationTest.java
└── pom.xml
├── xfs-job-server
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── yyh
│ │ └── xfs
│ │ └── job
│ │ ├── service
│ │ ├── impl
│ │ │ └── UserServiceImpl.java
│ │ ├── UserService.java
│ │ └── NotesService.java
│ │ ├── mapper
│ │ ├── user
│ │ │ └── UserMapper.java
│ │ └── notes
│ │ │ └── NotesMapper.java
│ │ ├── JobApplication.java
│ │ └── config
│ │ ├── XxlJobConfig.java
│ │ ├── NotesDataSourceConfig.java
│ │ └── UserDataSourceConfig.java
│ └── resources
│ ├── bootstrap.yml
│ └── mapper
│ ├── notes
│ └── NotesMapper.xml
│ └── user
│ └── UserMapper.xml
├── xfs-modules-api
├── xfs-notes-api
│ ├── src
│ │ └── main
│ │ │ └── java
│ │ │ └── com
│ │ │ └── yyh
│ │ │ └── xfs
│ │ │ └── notes
│ │ │ ├── dto
│ │ │ └── ResourcesDTO.java
│ │ │ ├── vo
│ │ │ ├── NotesPageVO.java
│ │ │ ├── NotesPublishVO.java
│ │ │ └── NotesVO.java
│ │ │ └── domain
│ │ │ ├── NotesTopicRelationDO.java
│ │ │ ├── UserLikeNotesDO.java
│ │ │ ├── UserViewsRecordNotesDO.java
│ │ │ ├── UserCollectNotesDO.java
│ │ │ ├── NotesCategoryDO.java
│ │ │ ├── NotesTopicDO.java
│ │ │ └── NotesDO.java
│ └── pom.xml
├── xfs-user-api
│ ├── src
│ │ └── main
│ │ │ └── java
│ │ │ └── com
│ │ │ └── yyh
│ │ │ └── xfs
│ │ │ └── user
│ │ │ ├── vo
│ │ │ ├── PasswordVO.java
│ │ │ ├── UserTrtcVO.java
│ │ │ ├── UserBindThirdStateVO.java
│ │ │ ├── RegisterInfoVO.java
│ │ │ ├── UserRelationVO.java
│ │ │ └── ViewUserVO.java
│ │ │ └── domain
│ │ │ ├── UserFansDO.java
│ │ │ ├── UserBlackDO.java
│ │ │ └── UserAttentionDO.java
│ └── pom.xml
├── xfs-comment-api
│ ├── src
│ │ └── main
│ │ │ └── java
│ │ │ └── com
│ │ │ └── yyh
│ │ │ └── xfs
│ │ │ └── comment
│ │ │ ├── vo
│ │ │ └── CommentVO.java
│ │ │ └── domain
│ │ │ └── CommentDO.java
│ └── pom.xml
├── xfs-im-api
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── com
│ │ └── yyh
│ │ └── xfs
│ │ └── im
│ │ ├── domain
│ │ └── MessageDO.java
│ │ └── vo
│ │ └── MessageVO.java
├── xfs-search-api
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── com
│ │ └── yyh
│ │ └── xfs
│ │ └── search
│ │ └── domain
│ │ ├── UserEsDO.java
│ │ └── NotesEsDO.java
└── pom.xml
├── xfs-third-server
└── src
│ └── main
│ ├── resources
│ └── bootstrap.yml
│ └── java
│ └── com
│ └── yyh
│ └── xfs
│ └── third
│ ├── ThirdApplication.java
│ ├── sevice
│ ├── AliyunOssService.java
│ └── AliyunSmsService.java
│ ├── config
│ ├── AliyunOss.java
│ └── AliyunSms.java
│ └── controller
│ └── UploadFileController.java
├── xfs-gateway
└── src
│ └── main
│ ├── resources
│ └── bootstrap.yml
│ └── java
│ └── com
│ └── yyh
│ └── xfs
│ └── gateway
│ ├── GatewayApplication.java
│ ├── properties
│ ├── ReleasePath.java
│ └── JwtProperties.java
│ └── utils
│ └── JWTUtil.java
├── xfs-auth
└── src
│ └── main
│ ├── resources
│ └── bootstrap.yml
│ └── java
│ └── com
│ └── yyh
│ └── xfs
│ └── auth
│ ├── AuthApplication.java
│ └── utils
│ └── UserInfoUtil.java
├── xiaofanshu-arm.dockerfile
├── xiaofanshu-amd.dockerfile
├── .gitignore
└── xiaofanshu-docker.md
/project-screenshot/default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/123yyh123/xiaofanshu/HEAD/project-screenshot/default.png
--------------------------------------------------------------------------------
/project-screenshot/微信图片_20240910165649.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/123yyh123/xiaofanshu/HEAD/project-screenshot/微信图片_20240910165649.jpg
--------------------------------------------------------------------------------
/project-screenshot/微信图片_20240910165704.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/123yyh123/xiaofanshu/HEAD/project-screenshot/微信图片_20240910165704.jpg
--------------------------------------------------------------------------------
/project-screenshot/微信图片_20240910165709.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/123yyh123/xiaofanshu/HEAD/project-screenshot/微信图片_20240910165709.jpg
--------------------------------------------------------------------------------
/project-screenshot/微信图片_20240910165714.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/123yyh123/xiaofanshu/HEAD/project-screenshot/微信图片_20240910165714.jpg
--------------------------------------------------------------------------------
/project-screenshot/微信图片_20240910165718.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/123yyh123/xiaofanshu/HEAD/project-screenshot/微信图片_20240910165718.jpg
--------------------------------------------------------------------------------
/project-screenshot/微信图片_20240910165723.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/123yyh123/xiaofanshu/HEAD/project-screenshot/微信图片_20240910165723.jpg
--------------------------------------------------------------------------------
/project-screenshot/微信图片_20240910165728.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/123yyh123/xiaofanshu/HEAD/project-screenshot/微信图片_20240910165728.jpg
--------------------------------------------------------------------------------
/project-screenshot/微信图片_20240910165733.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/123yyh123/xiaofanshu/HEAD/project-screenshot/微信图片_20240910165733.jpg
--------------------------------------------------------------------------------
/project-screenshot/微信图片_20240910165738.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/123yyh123/xiaofanshu/HEAD/project-screenshot/微信图片_20240910165738.jpg
--------------------------------------------------------------------------------
/project-screenshot/微信图片_20240910165743.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/123yyh123/xiaofanshu/HEAD/project-screenshot/微信图片_20240910165743.jpg
--------------------------------------------------------------------------------
/project-screenshot/微信图片_20240910165942.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/123yyh123/xiaofanshu/HEAD/project-screenshot/微信图片_20240910165942.jpg
--------------------------------------------------------------------------------
/project-screenshot/Screenshot_20240910_165224.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/123yyh123/xiaofanshu/HEAD/project-screenshot/Screenshot_20240910_165224.png
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # 默认忽略的文件
2 | /shelf/
3 | /workspace.xml
4 | # 基于编辑器的 HTTP 客户端请求
5 | /httpRequests/
6 | # Datasource local storage ignored files
7 | /dataSources/
8 | /dataSources.local.xml
9 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/xfs-common/common-mybatis/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
2 | com.yyh.xfs.common.mybatis.config.MybatisPlusConfig,\
3 | com.yyh.xfs.common.mybatis.handler.MyMetaObjectHandler
--------------------------------------------------------------------------------
/config/init-message.js:
--------------------------------------------------------------------------------
1 | // 切换到 messagedb 数据库(不存在会自动创建)
2 | db = db.getSiblingDB('messagedb');
3 |
4 | // 创建用户 admin,密码 123456,拥有 messagedb 的读写权限
5 | db.createUser({
6 | user: "admin",
7 | pwd: "123456",
8 | roles: [
9 | { role: "readWrite", db: "messagedb" }
10 | ]
11 | });
12 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-search-server/src/main/java/com/yyh/xfs/search/service/ElasticSearchInitService.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.search.service;
2 |
3 | /**
4 | * @author yyh
5 | * @date 2024-01-24
6 | */
7 | public interface ElasticSearchInitService {
8 | void initElasticSearch();
9 | }
10 |
--------------------------------------------------------------------------------
/.idea/sqldialects.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/xfs-job-server/src/main/java/com/yyh/xfs/job/service/impl/UserServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.job.service.impl;
2 |
3 | import com.yyh.xfs.job.service.UserService;
4 | import org.springframework.stereotype.Service;
5 | /**
6 | * @author yyh
7 | * @date 2023-12-23
8 | */
9 | @Service
10 | public class UserServiceImpl implements UserService {
11 | }
12 |
--------------------------------------------------------------------------------
/xfs-common/common-base/src/main/java/com/yyh/xfs/common/utils/Md5Util.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.utils;
2 |
3 | import org.apache.commons.codec.digest.DigestUtils;
4 |
5 | /**
6 | * @author yyh
7 | * @date 2023-12-09
8 | */
9 | public class Md5Util {
10 | public static String getMd5(String str) {
11 | return DigestUtils.md5Hex(str);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/xfs-job-server/src/main/java/com/yyh/xfs/job/service/UserService.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.job.service;
2 |
3 | import com.baomidou.mybatisplus.extension.service.IService;
4 | import com.yyh.xfs.user.domain.UserDO;
5 | import com.yyh.xfs.user.vo.UserVO;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * @author yyh
11 | * @date 2023-12-23
12 | */
13 | public interface UserService{
14 | }
15 |
--------------------------------------------------------------------------------
/xfs-common/common-redis/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
2 | com.yyh.xfs.common.redis.config.CustomRedisConfig,\
3 | com.yyh.xfs.common.redis.config.RedissonConfig,\
4 | com.yyh.xfs.common.redis.properties.RedisProperties,\
5 | com.yyh.xfs.common.redis.utils.BloomFilterUtils,\
6 | com.yyh.xfs.common.redis.utils.RedisCache
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-notes-api/src/main/java/com/yyh/xfs/notes/dto/ResourcesDTO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.dto;
2 |
3 | import lombok.Data;
4 | import lombok.Getter;
5 | import lombok.Setter;
6 |
7 | import java.io.Serializable;
8 |
9 | /**
10 | * @author yyh
11 | * @date 2024-02-02
12 | */
13 | @Data
14 | public class ResourcesDTO implements Serializable {
15 | private String url;
16 | }
17 |
--------------------------------------------------------------------------------
/xfs-third-server/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: xfs-third
4 | ## 开发环境
5 | profiles:
6 | active: dev
7 | cloud:
8 | nacos:
9 | ## Nacos服务注册中心地址
10 | config:
11 | ## 配置文件所在的命名空间
12 | namespace: 54c5b22b-7b63-4073-9a77-f07142769f1f
13 | file-extension: yaml
14 | server-addr: 192.168.124.100:8848
15 | shared-configs: redis.yaml
16 |
--------------------------------------------------------------------------------
/xfs-gateway/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: xfs-gateway
4 | ## 开发环境
5 | profiles:
6 | active: dev
7 | cloud:
8 | nacos:
9 | ## Nacos服务注册中心地址
10 | config:
11 | ## 配置文件所在的命名空间
12 | namespace: 54c5b22b-7b63-4073-9a77-f07142769f1f
13 | file-extension: yaml
14 | server-addr: 192.168.124.100:8848
15 | shared-configs: jwt.yaml,redis.yaml
16 |
--------------------------------------------------------------------------------
/xfs-job-server/src/main/java/com/yyh/xfs/job/mapper/user/UserMapper.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.job.mapper.user;
2 |
3 | import com.yyh.xfs.user.domain.UserDO;
4 | import io.lettuce.core.ScanIterator;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * @author yyh
10 | * @date 2024-02-09
11 | */
12 | public interface UserMapper{
13 | void updateUser(UserDO user);
14 |
15 | List getAllUserId();
16 | }
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-user-api/src/main/java/com/yyh/xfs/user/vo/PasswordVO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.user.vo;
2 |
3 | import lombok.Data;
4 | import lombok.Getter;
5 | import lombok.Setter;
6 |
7 | import java.io.Serializable;
8 |
9 | /**
10 | * @author yyh
11 | * @date 2024-02-21
12 | */
13 | @Data
14 | public class PasswordVO implements Serializable {
15 | private String oldPassword;
16 | private String newPassword;
17 | }
18 |
--------------------------------------------------------------------------------
/xfs-auth/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: xfs-auth
4 | ## 开发环境
5 | profiles:
6 | active: dev
7 | cloud:
8 | nacos:
9 | ## Nacos服务注册中心地址
10 | config:
11 | ## 配置文件所在的命名空间
12 | namespace: 54c5b22b-7b63-4073-9a77-f07142769f1f
13 | file-extension: yaml
14 | server-addr: 192.168.124.100:8848
15 | shared-configs: mybatis-plus.yaml,redis.yaml,jwt.yaml
--------------------------------------------------------------------------------
/xfs-job-server/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: xfs-job
4 | ## 开发环境
5 | profiles:
6 | active: dev
7 | cloud:
8 | nacos:
9 | ## Nacos服务注册中心地址
10 | config:
11 | ## 配置文件所在的命名空间
12 | namespace: 54c5b22b-7b63-4073-9a77-f07142769f1f
13 | file-extension: yaml
14 | server-addr: 192.168.124.100:8848
15 | shared-configs: redis.yaml,thread-pool.yaml
16 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/java/com/yyh/xfs/notes/service/NotesCategoryService.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.service;
2 |
3 | import com.yyh.xfs.common.domain.Result;
4 | import com.yyh.xfs.notes.domain.NotesCategoryDO;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * @author yyh
10 | * @date 2024-02-23
11 | */
12 | public interface NotesCategoryService {
13 | Result>getNotesCategory();
14 | }
15 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/java/com/yyh/xfs/notes/mapper/NotesTopicMapper.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.yyh.xfs.notes.domain.NotesTopicDO;
5 | import org.apache.ibatis.annotations.Mapper;
6 |
7 | /**
8 | * @author yyh
9 | * @date 2024-01-22
10 | */
11 | @Mapper
12 | public interface NotesTopicMapper extends BaseMapper {
13 | }
14 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-search-server/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: xfs-search
4 | ## 开发环境
5 | profiles:
6 | active: dev
7 | cloud:
8 | nacos:
9 | ## Nacos服务注册中心地址
10 | config:
11 | ## 配置文件所在的命名空间
12 | namespace: 54c5b22b-7b63-4073-9a77-f07142769f1f
13 | file-extension: yaml
14 | server-addr: 192.168.124.100:8848
15 | shared-configs: redis.yaml,jwt.yaml
--------------------------------------------------------------------------------
/xfs-common/common-base/src/main/java/com/yyh/xfs/common/domain/Result.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.domain;
2 |
3 | import lombok.*;
4 | import java.io.Serializable;
5 |
6 | /**
7 | * @author yyh
8 | * @date 2023-12-11
9 | * @desc 返回结果
10 | */
11 |
12 | @Data
13 | @AllArgsConstructor
14 | @NoArgsConstructor
15 | public class Result implements Serializable {
16 | private Integer code;
17 | private String msg;
18 | private T data;
19 | }
20 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/java/com/yyh/xfs/notes/mapper/UserLikeNotesMapper.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.yyh.xfs.notes.domain.UserLikeNotesDO;
5 | import org.apache.ibatis.annotations.Mapper;
6 |
7 | /**
8 | * @author yyh
9 | * @date 2024-01-28
10 | */
11 | @Mapper
12 | public interface UserLikeNotesMapper extends BaseMapper{
13 | }
14 |
--------------------------------------------------------------------------------
/xfs-common/common-redis/src/main/java/com/yyh/xfs/common/redis/utils/RedisKey.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.redis.utils;
2 |
3 | /**
4 | * @author yyh
5 | * @date 2023-12-15
6 | */
7 | public class RedisKey {
8 | /**
9 | * 构建redis key
10 | * @param prefix 前缀
11 | * @param key key
12 | * @return redis key
13 | */
14 | public static String build(String prefix, String key) {
15 | return prefix + key;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/xfs-common/common-web/src/main/java/com/yyh/xfs/common/web/aop/bloomFilter/BloomFilterProcessing.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.web.aop.bloomFilter;
2 |
3 | import java.lang.annotation.*;
4 |
5 | /**
6 | * @author yyh
7 | * @date 2024-02-24
8 | */
9 | @Target({ElementType.METHOD})
10 | @Retention(RetentionPolicy.RUNTIME)
11 | @Documented
12 | public @interface BloomFilterProcessing {
13 | String map() default "";
14 | String[] keys() default {};
15 | }
16 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-im-server/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: xfs-im
4 | ## 开发环境
5 | profiles:
6 | active: dev
7 | cloud:
8 | nacos:
9 | ## Nacos服务注册中心地址
10 | config:
11 | ## 配置文件所在的命名空间
12 | namespace: 54c5b22b-7b63-4073-9a77-f07142769f1f
13 | file-extension: yaml
14 | server-addr: 192.168.124.100:8848
15 | shared-configs: redis.yaml,jwt.yaml,thread-pool.yaml
16 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: xfs-notes
4 | ## 开发环境
5 | profiles:
6 | active: dev
7 | cloud:
8 | nacos:
9 | ## Nacos服务注册中心地址
10 | config:
11 | ## 配置文件所在的命名空间
12 | namespace: 54c5b22b-7b63-4073-9a77-f07142769f1f
13 | file-extension: yaml
14 | server-addr: 192.168.124.100:8848
15 | shared-configs: mybatis-plus.yaml,redis.yaml,jwt.yaml
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-user-server/src/main/java/com/yyh/xfs/user/mapper/UserMapper.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.user.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.yyh.xfs.user.domain.UserDO;
5 | import org.apache.ibatis.annotations.Mapper;
6 |
7 | /**
8 | * @author yyh
9 | * @date 2023-12-23
10 | * @desc 用户表
11 | */
12 | @Mapper
13 | public interface UserMapper extends BaseMapper {
14 |
15 | }
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-user-server/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: xfs-user
4 | ## 开发环境
5 | profiles:
6 | active: dev
7 | cloud:
8 | nacos:
9 | ## Nacos服务注册中心地址
10 | config:
11 | ## 配置文件所在的命名空间
12 | namespace: 54c5b22b-7b63-4073-9a77-f07142769f1f
13 | file-extension: yaml
14 | server-addr: 192.168.124.100:8848
15 | shared-configs: mybatis-plus.yaml,redis.yaml,jwt.yaml
--------------------------------------------------------------------------------
/.idea/UniappTool.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/xfs-job-server/src/main/java/com/yyh/xfs/job/service/NotesService.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.job.service;
2 |
3 | /**
4 | * @author yyh
5 | * @date 2024-02-08
6 | */
7 | public interface NotesService {
8 | void updateNotesLikeNum(String key,Long notesId, Integer notesLikeNum);
9 |
10 | void updateNotesCollectionNum(String key, Long notesId, Integer notesCollectionNum);
11 |
12 | void updateNotesViewNum(String key, Long notesId, Integer notesViewNum);
13 | }
14 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/java/com/yyh/xfs/notes/mapper/UserCollectNotesMapper.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.yyh.xfs.notes.domain.UserCollectNotesDO;
5 | import org.apache.ibatis.annotations.Mapper;
6 |
7 | /**
8 | * @author yyh
9 | * @date 2024-01-28
10 | */
11 | @Mapper
12 | public interface UserCollectNotesMapper extends BaseMapper{
13 | }
14 |
--------------------------------------------------------------------------------
/.idea/JavaSceneConfigState.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/UniappProjectData.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/xfs-common/common-base/src/main/java/com/yyh/xfs/common/domain/PageParam.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.domain;
2 |
3 | import lombok.Data;
4 |
5 | import java.io.Serializable;
6 |
7 | /**
8 | * @author yyh
9 | * @date 2024-01-29
10 | */
11 | @Data
12 | public class PageParam implements Serializable {
13 | private Integer page;
14 | private Integer pageSize;
15 | private Double longitude;
16 | private Double latitude;
17 | private String keyword;
18 | }
19 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-notes-api/src/main/java/com/yyh/xfs/notes/vo/NotesPageVO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.vo;
2 |
3 | import lombok.Data;
4 |
5 | import java.io.Serializable;
6 | import java.util.List;
7 |
8 | /**
9 | * @author yyh
10 | * @date 2024-01-26
11 | */
12 | @Data
13 | public class NotesPageVO implements Serializable {
14 | private List list;
15 | private Integer total;
16 | private Integer page;
17 | private Integer pageSize;
18 | }
19 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-comment-server/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: xfs-comment
4 | ## 开发环境
5 | profiles:
6 | active: dev
7 | cloud:
8 | nacos:
9 | ## Nacos服务注册中心地址
10 | config:
11 | ## 配置文件所在的命名空间
12 | namespace: 54c5b22b-7b63-4073-9a77-f07142769f1f
13 | file-extension: yaml
14 | server-addr: 192.168.124.100:8848
15 | shared-configs: redis.yaml,thread-pool.yaml,jwt.yaml
16 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/java/com/yyh/xfs/notes/mapper/NotesTopicRelationMapper.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.yyh.xfs.notes.domain.NotesTopicRelationDO;
5 | import org.apache.ibatis.annotations.Mapper;
6 |
7 | /**
8 | * @author yyh
9 | * @date 2024-01-22
10 | */
11 | @Mapper
12 | public interface NotesTopicRelationMapper extends BaseMapper {
13 | }
14 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/java/com/yyh/xfs/notes/mapper/UserViewsRecordNotesMapper.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.yyh.xfs.notes.domain.UserViewsRecordNotesDO;
5 | import org.apache.ibatis.annotations.Mapper;
6 |
7 | /**
8 | * @author yyh
9 | * @date 2024-01-28
10 | */
11 | @Mapper
12 | public interface UserViewsRecordNotesMapper extends BaseMapper{
13 | }
14 |
--------------------------------------------------------------------------------
/xfs-third-server/src/main/java/com/yyh/xfs/third/ThirdApplication.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.third;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author yyh
8 | * @date 2023-12-12
9 | */
10 | @SpringBootApplication
11 | public class ThirdApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(ThirdApplication.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/xiaofanshu-arm.dockerfile:
--------------------------------------------------------------------------------
1 | FROM fmww/alpine-jdk8
2 | MAINTAINER yyh
3 | EXPOSE 9000
4 | # 创建应用目录
5 | WORKDIR /app
6 | # 复制 JAR 包和启动脚本到容器中
7 | COPY jar/*.jar /app/
8 | COPY config/run.sh /app/run.sh
9 |
10 | #创建启动脚本
11 | RUN chmod 777 /app/run.sh
12 |
13 | # 创建日志目录
14 | RUN mkdir /app/logs
15 |
16 | # 设置时区
17 | RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
18 | RUN echo "Asia/Shanghai" > /etc/timezone
19 |
20 | #执行命令
21 | ENTRYPOINT ["sh","/app/run.sh"]
--------------------------------------------------------------------------------
/xfs-gateway/src/main/java/com/yyh/xfs/gateway/GatewayApplication.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.gateway;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author yyh
8 | * @date 2023-12-09
9 | */
10 | @SpringBootApplication
11 | public class GatewayApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(GatewayApplication.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/xiaofanshu-amd.dockerfile:
--------------------------------------------------------------------------------
1 | FROM openjdk:8-jdk-alpine
2 | MAINTAINER yyh
3 | EXPOSE 9000
4 | # 创建应用目录
5 | WORKDIR /app
6 | # 复制 JAR 包和启动脚本到容器中
7 | COPY jar/*.jar /app/
8 | COPY config/run.sh /app/run.sh
9 |
10 | #创建启动脚本
11 | RUN chmod 777 /app/run.sh
12 |
13 | # 创建日志目录
14 | RUN mkdir /app/logs
15 |
16 | # 设置时区
17 | RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
18 | RUN echo "Asia/Shanghai" > /etc/timezone
19 |
20 | #执行命令
21 | ENTRYPOINT ["sh","/app/run.sh"]
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-user-server/src/main/java/com/yyh/xfs/user/UserApplication.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.user;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author yyh
8 | * @date 2023-12-11
9 | */
10 | @SpringBootApplication
11 | public class UserApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(UserApplication.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/config/run.sh:
--------------------------------------------------------------------------------
1 | # 定义 JAR 文件所在目录
2 | jar_directory="/app"
3 |
4 | # 循环启动每个 JAR 文件
5 | for jar_file in "$jar_directory"/*.jar
6 | do
7 | # 获取 JAR 文件名(不带路径)
8 | project=$(basename "$jar_file" .jar)
9 |
10 | echo "启动 $project..."
11 | java -Dfile.encoding=utf-8 -jar "$jar_file" --spring.cloud.nacos.config.server-addr="172.17.0.1:8848" > "$jar_directory/logs/$project.log" 2>&1 &
12 | echo "$project 已启动并输出到 $jar_directory/logs/$project.log"
13 | done
14 |
15 | echo "所有项目已启动。"
16 |
17 | # 保持容器运行
18 | wait
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-user-api/src/main/java/com/yyh/xfs/user/vo/UserTrtcVO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.user.vo;
2 |
3 | import lombok.Data;
4 | import lombok.Getter;
5 | import lombok.Setter;
6 |
7 | import java.io.Serializable;
8 |
9 | /**
10 | * @author yyh
11 | * @date 2024-01-13
12 | */
13 | @Data
14 | public class UserTrtcVO implements Serializable {
15 | private static final long serialVersionUID = 1L;
16 | private String userId;
17 | private long sdkAppId;
18 | private String userSig;
19 | }
20 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-user-server/src/main/java/com/yyh/xfs/user/mapper/UserBlackMapper.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.user.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.yyh.xfs.user.domain.UserBlackDO;
5 | import org.apache.ibatis.annotations.Mapper;
6 |
7 | /**
8 | * @author yyh
9 | * @date 2023-12-30
10 | */
11 | @Mapper
12 | public interface UserBlackMapper extends BaseMapper {
13 | Boolean selectOneByUserIdAndBlackIdIsExist(Long userId, Long blackId);
14 | }
15 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-user-api/src/main/java/com/yyh/xfs/user/vo/UserBindThirdStateVO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.user.vo;
2 |
3 | import lombok.Data;
4 | import lombok.Getter;
5 | import lombok.Setter;
6 |
7 | import java.io.Serializable;
8 |
9 | /**
10 | * @author yyh
11 | * @date 2024-02-20
12 | */
13 | @Data
14 | public class UserBindThirdStateVO implements Serializable {
15 | private static final long serialVersionUID = 1L;
16 | private Boolean wechatBind;
17 | private Boolean qqBind;
18 | private Boolean facebookBind;
19 | }
20 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-search-server/src/main/java/com/yyh/xfs/search/service/UserSearchService.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.search.service;
2 |
3 | import com.yyh.xfs.common.domain.Result;
4 | import com.yyh.xfs.search.domain.UserEsDO;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * @author yyh
10 | * @date 2024-02-21
11 | */
12 | public interface UserSearchService {
13 | Result> getUser(String keyword, Integer page, Integer pageSize);
14 |
15 | void addUser(UserEsDO userEsDO);
16 |
17 | void updateUser(UserEsDO userEsDO);
18 | }
19 |
--------------------------------------------------------------------------------
/config/elasticsearch.yml:
--------------------------------------------------------------------------------
1 | #集群名称
2 | cluster.name: my-application
3 | #节点名称
4 | node.name: es-node-1
5 | #数据和日志的存储目录
6 | path.data: /usr/share/elasticsearch/data
7 | path.logs: /usr/share/elasticsearch/logs
8 | ##设置绑定的ip,设置为0.0.0.0以后就可以让任何计算机节点访问到了
9 | network.host: 0.0.0.0
10 | #端口
11 | http.port: 9200
12 | ##设置在集群中的所有节点名称,这个节点名称就是之前所修改的,当然你也可以采用默认的也行,目前 是单机,放入一个节点即可
13 | cluster.initial_master_nodes: ["es-node-1"]
14 | xpack.security.enabled: true
15 | xpack.license.self_generated.type: basic
16 | xpack.security.transport.ssl.enabled: true
17 | ingest.geoip.downloader.enabled: false
--------------------------------------------------------------------------------
/xfs-common/common-base/src/main/java/com/yyh/xfs/common/utils/TimeUtil.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.utils;
2 |
3 | import java.time.LocalDate;
4 | import java.time.Period;
5 |
6 | /**
7 | * @author yyh
8 | * @date 2023-12-22
9 | */
10 | public class TimeUtil {
11 | public static int calculateAge(LocalDate birthDate) {
12 | LocalDate currentDate = LocalDate.now();
13 | if (birthDate != null) {
14 | return Period.between(birthDate, currentDate).getYears();
15 | } else {
16 | return 0;
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-comment-server/src/main/java/com/yyh/xfs/comment/feign/NotesFeign.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.comment.feign;
2 |
3 | import org.springframework.cloud.openfeign.FeignClient;
4 | import org.springframework.web.bind.annotation.GetMapping;
5 | import org.springframework.web.bind.annotation.RequestParam;
6 |
7 | /**
8 | * @author yyh
9 | * @date 2024-02-11
10 | */
11 | @FeignClient("xfs-notes")
12 | public interface NotesFeign {
13 |
14 | @GetMapping("/notes/getNotesBelongUser")
15 | Long getNotesBelongUser(@RequestParam("notesId") Long notesId);
16 | }
17 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/java/com/yyh/xfs/notes/config/BaiduAiConfig.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.config;
2 |
3 | import lombok.Getter;
4 | import org.springframework.beans.factory.annotation.Value;
5 | import org.springframework.context.annotation.Configuration;
6 |
7 | /**
8 | * @author yyh
9 | * @date 2024-01-22
10 | */
11 | @Configuration
12 | @Getter
13 | public class BaiduAiConfig {
14 | @Value("${baiduyun.ai.apiKey}")
15 | private String apiKey;
16 |
17 | @Value("${baiduyun.ai.secretKey}")
18 | private String secretKey;
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/xfs-common/common-web/src/main/java/com/yyh/xfs/common/web/aop/idempotent/Idempotent.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.web.aop.idempotent;
2 |
3 | import java.lang.annotation.*;
4 |
5 | /**
6 | * @author yyh
7 | * @date 2024-02-26
8 | */
9 | @Target({ElementType.METHOD})
10 | @Retention(RetentionPolicy.RUNTIME)
11 | @Documented
12 |
13 | public @interface Idempotent {
14 | /**
15 | * 唯一标识
16 | * @return String
17 | */
18 | String value() default "";
19 | /**
20 | * 过期时间
21 | * @return long 单位毫秒
22 | */
23 | long expireTime() default 1000;
24 | }
25 |
--------------------------------------------------------------------------------
/xfs-gateway/src/main/java/com/yyh/xfs/gateway/properties/ReleasePath.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.gateway.properties;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 | import org.springframework.boot.context.properties.ConfigurationProperties;
6 | import org.springframework.stereotype.Component;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author yyh
12 | * @date 2023-12-11
13 | * @desc 不需要token的路径
14 | */
15 | @Component
16 | @Getter
17 | @Setter
18 | @ConfigurationProperties(prefix = "release.auth")
19 | public class ReleasePath {
20 | private List path;
21 | }
22 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/java/com/yyh/xfs/notes/NotesApplication.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.openfeign.EnableFeignClients;
6 |
7 | /**
8 | * @author yyh
9 | * @date 2024-01-19
10 | */
11 | @SpringBootApplication
12 | @EnableFeignClients
13 | public class NotesApplication {
14 | public static void main(String[] args) {
15 | SpringApplication.run(NotesApplication.class, args);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/xfs-job-server/src/main/java/com/yyh/xfs/job/JobApplication.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.job;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
6 |
7 | /**
8 | * @author yyh
9 | * @date 2023-12-23
10 | */
11 | @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
12 | public class JobApplication {
13 | public static void main(String[] args) {
14 | SpringApplication.run(JobApplication.class, args);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-comment-server/src/main/java/com/yyh/xfs/comment/CommentApplication.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.comment;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.openfeign.EnableFeignClients;
6 |
7 | /**
8 | * @author yyh
9 | * @date 2024-02-05
10 | */
11 | @SpringBootApplication
12 | @EnableFeignClients
13 | public class CommentApplication {
14 | public static void main(String[] args) {
15 | SpringApplication.run(CommentApplication.class, args);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-comment-server/src/main/java/com/yyh/xfs/comment/feign/UserFeign.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.comment.feign;
2 |
3 | import com.yyh.xfs.common.domain.Result;
4 | import org.springframework.cloud.openfeign.FeignClient;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RequestParam;
7 |
8 | /**
9 | * @author yyh
10 | * @date 2024-01-26
11 | */
12 | @FeignClient("xfs-user")
13 | public interface UserFeign {
14 |
15 | @GetMapping("/user/getUserInfo")
16 | Result> getUserInfo(@RequestParam("userId") Long userId);
17 | }
18 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-search-server/src/main/java/com/yyh/xfs/search/feign/UserFeign.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.search.feign;
2 |
3 | import com.yyh.xfs.common.domain.Result;
4 | import org.springframework.cloud.openfeign.FeignClient;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RequestParam;
7 |
8 | /**
9 | * @author yyh
10 | * @date 2024-01-26
11 | */
12 | @FeignClient("xfs-user")
13 | public interface UserFeign {
14 |
15 | @GetMapping("/user/getUserInfo")
16 | Result> getUserInfo(@RequestParam("userId") Long userId);
17 | }
18 |
--------------------------------------------------------------------------------
/xfs-third-server/src/main/java/com/yyh/xfs/third/sevice/AliyunOssService.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.third.sevice;
2 |
3 | import com.yyh.xfs.common.domain.Result;
4 | import org.springframework.web.multipart.MultipartFile;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * @author yyh
10 | * @date 2023-12-21
11 | */
12 | public interface AliyunOssService {
13 | Result uploadImg(MultipartFile file);
14 |
15 | Result> uploadImgs(MultipartFile[] file);
16 |
17 | Result uploadAudio(MultipartFile file);
18 |
19 | Result uploadVideo(MultipartFile file);
20 | }
21 |
--------------------------------------------------------------------------------
/xfs-common/common-web/src/main/java/com/yyh/xfs/common/web/properties/GaoDeMapProperties.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.web.properties;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 | import org.springframework.beans.factory.annotation.Value;
6 | import org.springframework.boot.context.properties.ConfigurationProperties;
7 | import org.springframework.context.annotation.Configuration;
8 |
9 | /**
10 | * @author yyh
11 | * @date 2024-02-03
12 | */
13 | @Configuration
14 | @Getter
15 | @Setter
16 | @ConfigurationProperties(prefix = "gaode.map")
17 | public class GaoDeMapProperties {
18 | private String key;
19 | }
20 |
--------------------------------------------------------------------------------
/xfs-auth/src/main/java/com/yyh/xfs/auth/AuthApplication.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.auth;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.context.annotation.ComponentScan;
6 |
7 | /**
8 | * @author yyh
9 | * @date 2023-12-09
10 | */
11 | @SpringBootApplication
12 | @ComponentScan(basePackages = {"com.yyh.xfs.auth", "com.yyh.xfs.user", "com.yyh.xfs.common"})
13 | public class AuthApplication {
14 | public static void main(String[] args) {
15 | SpringApplication.run(AuthApplication.class, args);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/xfs-common/common-web/src/main/java/com/yyh/xfs/common/web/properties/TrtcProperties.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.web.properties;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 | import org.springframework.boot.context.properties.ConfigurationProperties;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | /**
9 | * @author yyh
10 | * @date 2024-01-13
11 | */
12 | @Configuration
13 | @ConfigurationProperties(prefix = "tencentyun.trtc")
14 | @Getter
15 | @Setter
16 | public class TrtcProperties {
17 | private long sdkAppId;
18 | private String secretKey;
19 | private long expireTime;
20 | }
21 |
--------------------------------------------------------------------------------
/xfs-common/common-redis/src/main/java/com/yyh/xfs/common/redis/constant/BloomFilterMap.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.redis.constant;
2 |
3 | /**
4 | * @author yyh
5 | * @date 2024-02-24
6 | */
7 | public class BloomFilterMap {
8 | /**
9 | * 笔记id布隆过滤器
10 | */
11 | public static final String NOTES_ID_BLOOM_FILTER = "notesIdBloomFilter";
12 | /**
13 | * 用户id布隆过滤器
14 | */
15 | public static final String USER_ID_BLOOM_FILTER = "userIdBloomFilter";
16 | /**
17 | * rocketmq幂等布隆过滤器
18 | */
19 | public static final String ROCKETMQ_IDEMPOTENT_BLOOM_FILTER = "rocketmqIdempotentBloomFilter";
20 | }
21 |
--------------------------------------------------------------------------------
/xfs-common/common-redis/src/main/java/com/yyh/xfs/common/redis/properties/RedisProperties.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.redis.properties;
2 |
3 | import lombok.Data;
4 | import org.springframework.boot.context.properties.ConfigurationProperties;
5 | import org.springframework.stereotype.Component;
6 |
7 | /**
8 | * @author yyh
9 | * @date 2024-02-24
10 | */
11 | @Data
12 | @Component
13 | @ConfigurationProperties(prefix = "spring.redis")
14 | public class RedisProperties {
15 | private String host;
16 | private int port;
17 | private String password;
18 | private int database;
19 | private int lockWatchdogTimeout;
20 | }
21 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-user-api/src/main/java/com/yyh/xfs/user/vo/RegisterInfoVO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.user.vo;
2 |
3 | import lombok.Data;
4 | import lombok.Getter;
5 | import lombok.Setter;
6 |
7 | import java.io.Serializable;
8 |
9 | /**
10 | * @author yyh
11 | * @date 2023-12-12
12 | */
13 | @Data
14 | public class RegisterInfoVO implements Serializable {
15 | private static final long serialVersionUID = 1L;
16 | private String phoneNumber;
17 | private String password;
18 | private String smsCode;
19 | private Integer registerType;
20 | private String openId;
21 | private String nickname;
22 | private String avatarUrl;
23 | }
24 |
--------------------------------------------------------------------------------
/xfs-gateway/src/main/java/com/yyh/xfs/gateway/properties/JwtProperties.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.gateway.properties;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 | import org.springframework.boot.context.properties.ConfigurationProperties;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | /**
9 | * @author yyh
10 | * @date 2023-12-11
11 | */
12 | @Configuration
13 | @ConfigurationProperties(prefix = "jwt")
14 | @Getter
15 | @Setter
16 | public class JwtProperties {
17 | // 密钥
18 | private String secret;
19 | // token过期时间
20 | private long expireTime;
21 | // 剩余多久时间刷新token
22 | private long refreshTime;
23 | }
24 |
--------------------------------------------------------------------------------
/config/broker.conf:
--------------------------------------------------------------------------------
1 | terName = DefaultCluster
2 | #broker名称,master和slave使用相同的名称,表明他们的主从关系
3 | autoCreateTopicEnable = true
4 | brokerName = broker-a
5 | #0表示Master,大于0表示不同的slave
6 | brokerId = 0
7 | #表示几点做消息删除动作,默认是凌晨4点
8 | deleteWhen = 04
9 | #在磁盘上保留消息的时长,单位是小时
10 | fileReservedTime = 48
11 | #有三个值:SYNC_MASTER,ASYNC_MASTER,SLAVE;同步和异步表示Master和Slave之间同步数据的机制;
12 | brokerRole = ASYNC_MASTER
13 | #刷盘策略,取值为:ASYNC_FLUSH,SYNC_FLUSH表示同步刷盘和异步刷盘;SYNC_FLUSH消息写入磁盘后才返回成功状态,ASYNC_FLUSH不需要;
14 | flushDiskType = ASYNC_FLUSH
15 | #ip为宿主机的ip,如192.168.12.17,不是docker容器的ip
16 | brokerIP1 = 127.0.0.1
17 | # 磁盘使用达到95%之后,生产者再写入消息会报错 CODE: 14 DESC: service not available now, maybe disk full
18 | diskMaxUsedSpaceRatio=95
--------------------------------------------------------------------------------
/xfs-third-server/src/main/java/com/yyh/xfs/third/sevice/AliyunSmsService.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.third.sevice;
2 |
3 | import com.yyh.xfs.common.domain.Result;
4 |
5 | /**
6 | * @author yyh
7 | * @date 2023-12-15
8 | */
9 | public interface AliyunSmsService {
10 | Result> sendBindPhoneSms(String phoneNumber);
11 |
12 | Result> sendResetPhoneSms(String phoneNumber);
13 |
14 | Result> sendRegisterPhoneSms(String phoneNumber);
15 |
16 | Result checkResetSmsCode(String phoneNumber, String smsCode);
17 |
18 | Result checkBindSmsCode(String phoneNumber, String smsCode);
19 |
20 | Result> sendLoginPhoneSms(String phoneNumber);
21 | }
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 | !**/src/main/**/target/
4 | !**/src/test/**/target/
5 |
6 | ### 日志 ###
7 | logs
8 |
9 | ### IntelliJ IDEA ###
10 | .idea/modules.xml
11 | .idea/jarRepositories.xml
12 | .idea/compiler.xml
13 | .idea/libraries/
14 | *.iws
15 | *.iml
16 | *.ipr
17 |
18 | ### Eclipse ###
19 | .apt_generated
20 | .classpath
21 | .factorypath
22 | .project
23 | .settings
24 | .springBeans
25 | .sts4-cache
26 |
27 | ### NetBeans ###
28 | /nbproject/private/
29 | /nbbuild/
30 | /dist/
31 | /nbdist/
32 | /.nb-gradle/
33 | build/
34 | !**/src/main/**/build/
35 | !**/src/test/**/build/
36 |
37 | ### VS Code ###
38 | .vscode/
39 |
40 | ### Mac OS ###
41 | .DS_Store
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-user-api/src/main/java/com/yyh/xfs/user/vo/UserRelationVO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.user.vo;
2 |
3 | import lombok.Data;
4 |
5 | /**
6 | * @author yyh
7 | * @date 2024-01-15
8 | * @desc 用户关系视图对象
9 | */
10 | @Data
11 | public class UserRelationVO {
12 | /**
13 | * 用户id
14 | */
15 | private Long userId;
16 |
17 | /**
18 | * 用户昵称(当有备注时,显示备注)
19 | */
20 | private String nickname;
21 |
22 | /**
23 | * 用户头像
24 | */
25 | private String avatarUrl;
26 |
27 | /**
28 | * 用户简介
29 | */
30 | private String selfIntroduction;
31 |
32 | /**
33 | * 是否为双向关系
34 | */
35 | private Boolean bidirectional;
36 | }
37 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-search-server/src/test/java/com/yyh/xfs/search/SearchApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.search;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.boot.test.context.SpringBootTest;
6 | import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
7 |
8 | /**
9 | * @author yyh
10 | * @date 2024-01-24
11 | */
12 | @SpringBootTest
13 | public class SearchApplicationTest {
14 | @Autowired
15 | private ElasticsearchRestTemplate elasticsearchRestTemplate;
16 | @Test
17 | void test1() {
18 | System.out.println(elasticsearchRestTemplate);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/xfs-common/common-web/src/main/java/com/yyh/xfs/common/web/properties/JwtProperties.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.web.properties;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 | import org.springframework.boot.context.properties.ConfigurationProperties;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | /**
9 | * @author yyh
10 | * @date 2023-12-11
11 | * @desc jwt配置
12 | */
13 | @Configuration
14 | @ConfigurationProperties(prefix = "jwt")
15 | @Getter
16 | @Setter
17 |
18 | public class JwtProperties {
19 | // 密钥
20 | private String secret;
21 | // token过期时间
22 | private long expireTime;
23 | // 剩余多久时间刷新token
24 | private long refreshTime;
25 | }
26 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-search-server/src/main/java/com/yyh/xfs/search/SearchApplication.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.search;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
6 | import org.springframework.cloud.openfeign.EnableFeignClients;
7 |
8 | /**
9 | * @author yyh
10 | * @date 2024-01-24
11 | */
12 | @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
13 | @EnableFeignClients
14 | public class SearchApplication {
15 | public static void main(String[] args) {
16 | SpringApplication.run(SearchApplication.class, args);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/resources/mapper/NotesTopicRelationMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | id, notes_id, topic_id
14 |
15 |
16 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/java/com/yyh/xfs/notes/mapper/NotesCategoryMapper.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.yyh.xfs.notes.domain.NotesCategoryDO;
5 | import org.apache.ibatis.annotations.Mapper;
6 | import org.apache.ibatis.annotations.Select;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author yyh
12 | * @date 2024-01-22
13 | */
14 | @Mapper
15 | public interface NotesCategoryMapper extends BaseMapper {
16 |
17 | /**
18 | * 获取笔记分类,去除id为1的默认分类,按照category_sort排序
19 | * @return 笔记分类
20 | */
21 | @Select("select * from notes_category where id != 1 order by category_sort")
22 | List getNotesCategory();
23 | }
24 |
--------------------------------------------------------------------------------
/xfs-common/common-web/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
2 | com.yyh.xfs.common.web.config.FeignConfig,\
3 | com.yyh.xfs.common.web.config.WebMvcConfig,\
4 | com.yyh.xfs.common.web.config.SwaggerConfig,\
5 | com.yyh.xfs.common.web.config.ThreadPoolConfig,\
6 | com.yyh.xfs.common.web.utils.JWTUtil,\
7 | com.yyh.xfs.common.web.utils.AddressUtil,\
8 | com.yyh.xfs.common.web.properties.JwtProperties,\
9 | com.yyh.xfs.common.web.properties.TrtcProperties,\
10 | com.yyh.xfs.common.web.properties.GaoDeMapProperties,\
11 | com.yyh.xfs.common.web.aop.bloomFilter.BloomFilterAspect,\
12 | com.yyh.xfs.common.web.aop.idempotent.IdempotentAspect,\
13 | com.yyh.xfs.common.web.exception.handler.GlobalExceptionHandler
--------------------------------------------------------------------------------
/xfs-common/common-web/src/main/java/com/yyh/xfs/common/web/exception/OnlyWarnException.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.web.exception;
2 |
3 | import com.yyh.xfs.common.myEnum.ExceptionMsgEnum;
4 | import lombok.Getter;
5 | import lombok.Setter;
6 | import lombok.ToString;
7 |
8 | /**
9 | * @author yyh
10 | * @date 2023-12-23
11 | */
12 | @Getter
13 | @Setter
14 | @ToString
15 | public class OnlyWarnException extends RuntimeException{
16 | private ExceptionMsgEnum exceptionMsgEnum;
17 | public OnlyWarnException(ExceptionMsgEnum exceptionMsgEnum) {
18 | this.exceptionMsgEnum=exceptionMsgEnum;
19 | }
20 | public OnlyWarnException(ExceptionMsgEnum exceptionMsgEnum,Throwable e){
21 | super(e);
22 | this.exceptionMsgEnum=exceptionMsgEnum;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/xfs-common/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.example
8 | xiaofanshu
9 | 1.0-SNAPSHOT
10 |
11 | xfs-common
12 | pom
13 |
14 | common-web
15 | common-base
16 | common-mybatis
17 | common-redis
18 |
19 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-notes-api/src/main/java/com/yyh/xfs/notes/domain/NotesTopicRelationDO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.domain;
2 |
3 | import com.baomidou.mybatisplus.annotation.TableId;
4 | import com.baomidou.mybatisplus.annotation.TableName;
5 | import lombok.Data;
6 |
7 | import java.io.Serializable;
8 |
9 | /**
10 | * @author yyh
11 | * @date 2024-01-22
12 | */
13 | @Data
14 | @TableName("notes_topic_relation")
15 | public class NotesTopicRelationDO implements Serializable {
16 |
17 | private static final long serialVersionUID = 1L;
18 |
19 | @TableId
20 | private Long id;
21 |
22 | /**
23 | * 笔记id
24 | */
25 | private Long notesId;
26 |
27 | /**
28 | * 话题id
29 | */
30 | private Long topicId;
31 | }
32 |
--------------------------------------------------------------------------------
/xfs-common/common-web/src/main/java/com/yyh/xfs/common/web/exception/SystemException.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.web.exception;
2 |
3 | import com.yyh.xfs.common.myEnum.ExceptionMsgEnum;
4 | import lombok.Getter;
5 | import lombok.Setter;
6 | import lombok.ToString;
7 |
8 | /**
9 | * @author yyh
10 | * @date 2023-12-15
11 | * @desc 系统异常
12 | */
13 | @Getter
14 | @Setter
15 | @ToString
16 | public class SystemException extends RuntimeException{
17 | private ExceptionMsgEnum exceptionMsgEnum;
18 | public SystemException(ExceptionMsgEnum exceptionMsgEnum) {
19 | this.exceptionMsgEnum=exceptionMsgEnum;
20 | }
21 | public SystemException(ExceptionMsgEnum exceptionMsgEnum,Throwable e){
22 | super(e);
23 | this.exceptionMsgEnum=exceptionMsgEnum;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-notes-api/src/main/java/com/yyh/xfs/notes/domain/UserLikeNotesDO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.domain;
2 |
3 | import com.baomidou.mybatisplus.annotation.TableId;
4 | import com.baomidou.mybatisplus.annotation.TableName;
5 | import lombok.Data;
6 |
7 | import java.io.Serializable;
8 | import java.util.Date;
9 |
10 | /**
11 | * @author yyh
12 | * @date 2024-01-28
13 | */
14 | @Data
15 | @TableName("user_like_notes")
16 | public class UserLikeNotesDO implements Serializable {
17 |
18 | private static final long serialVersionUID = 1L;
19 |
20 | @TableId
21 | private Long id;
22 |
23 | /**
24 | * 用户id
25 | */
26 | private Long userId;
27 |
28 | /**
29 | * 笔记id
30 | */
31 | private Long notesId;
32 |
33 | private Date createTime;
34 | }
35 |
--------------------------------------------------------------------------------
/xfs-common/common-web/src/main/java/com/yyh/xfs/common/web/exception/BusinessException.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.web.exception;
2 |
3 | import com.yyh.xfs.common.myEnum.ExceptionMsgEnum;
4 | import lombok.Getter;
5 | import lombok.Setter;
6 | import lombok.ToString;
7 |
8 | /**
9 | * @author yyh
10 | * @date 2023-12-15
11 | * @desc 业务异常类
12 | */
13 | @Getter
14 | @Setter
15 | @ToString
16 | public class BusinessException extends RuntimeException{
17 | private ExceptionMsgEnum exceptionMsgEnum;
18 | public BusinessException(ExceptionMsgEnum exceptionMsgEnum) {
19 | this.exceptionMsgEnum=exceptionMsgEnum;
20 | }
21 | public BusinessException(ExceptionMsgEnum exceptionMsgEnum,Throwable e){
22 | super(e);
23 | this.exceptionMsgEnum=exceptionMsgEnum;
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/xfs-common/common-web/src/main/java/com/yyh/xfs/common/web/config/FeignConfig.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.web.config;
2 |
3 | import feign.RequestInterceptor;
4 | import feign.RequestTemplate;
5 | import org.springframework.context.annotation.Configuration;
6 |
7 | import javax.servlet.http.HttpServletRequest;
8 |
9 | /**
10 | * @author yyh
11 | * @date 2023-12-11
12 | */
13 | @Configuration
14 | public class FeignConfig implements RequestInterceptor {
15 | private final HttpServletRequest request;
16 |
17 | public FeignConfig(HttpServletRequest request) {
18 | this.request = request;
19 | }
20 |
21 | @Override
22 | public void apply(RequestTemplate requestTemplate) {
23 | String token = request.getHeader("token");
24 | requestTemplate.header("token",token);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-notes-api/src/main/java/com/yyh/xfs/notes/vo/NotesPublishVO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.vo;
2 |
3 | import lombok.Data;
4 |
5 | import java.io.Serializable;
6 |
7 | /**
8 | * @author yyh
9 | * @date 2024-01-22
10 | */
11 | @Data
12 | public class NotesPublishVO implements Serializable {
13 | private static final long serialVersionUID = 1L;
14 | private Long notesId;
15 | private String title;
16 | private String realContent;
17 | private String content;
18 | private Integer belongCategory;
19 | private Long belongUserId;
20 | private Integer notesType;
21 | private String coverPicture;
22 | private String notesResources;
23 | private String address;
24 | private Double longitude;
25 | private Double latitude;
26 | private Integer authority;
27 | }
28 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-user-server/src/main/java/com/yyh/xfs/user/mapper/UserFansMapper.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.user.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.yyh.xfs.user.domain.UserFansDO;
5 | import com.yyh.xfs.user.vo.UserRelationVO;
6 | import com.yyh.xfs.user.vo.ViewUserVO;
7 | import org.apache.ibatis.annotations.Mapper;
8 | import org.apache.ibatis.annotations.Select;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * @author yyh
14 | * @date 2023-12-30
15 | */
16 | @Mapper
17 | public interface UserFansMapper extends BaseMapper {
18 |
19 | @Select("select count(*) from user_fans where user_id=#{userId}")
20 | Integer getCountById(Long userId);
21 |
22 | List selectFansList(Long userId, Integer offset, Integer pageSize);
23 | }
24 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-notes-api/src/main/java/com/yyh/xfs/notes/domain/UserViewsRecordNotesDO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.domain;
2 |
3 | import com.baomidou.mybatisplus.annotation.TableId;
4 | import com.baomidou.mybatisplus.annotation.TableName;
5 | import lombok.Data;
6 |
7 | import java.io.Serializable;
8 | import java.util.Date;
9 |
10 | /**
11 | * @author yyh
12 | * @date 2024-01-28
13 | */
14 | @Data
15 | @TableName("user_views_record_notes")
16 | public class UserViewsRecordNotesDO implements Serializable {
17 |
18 | private static final long serialVersionUID = 1L;
19 |
20 | @TableId
21 | private Long id;
22 |
23 | /**
24 | * 用户id
25 | */
26 | private Long userId;
27 |
28 | /**
29 | * 笔记id
30 | */
31 | private Long notesId;
32 |
33 | private Date createTime;
34 | }
35 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/resources/mapper/UserLikeNotesMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | id, user_id, notes_id, create_time
14 |
15 |
16 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-user-api/src/main/java/com/yyh/xfs/user/vo/ViewUserVO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.user.vo;
2 | import lombok.Data;
3 | import lombok.Getter;
4 | import lombok.Setter;
5 |
6 | import java.io.Serializable;
7 |
8 | /**
9 | * @author yyh
10 | * @date 2024-01-15
11 | */
12 | @Data
13 | public class ViewUserVO implements Serializable {
14 | private static final long serialVersionUID = 1L;
15 | private Long id;
16 | private String uid;
17 | private String nickname;
18 | private String avatarUrl;
19 | private Integer age;
20 | private Integer sex;
21 | private String area;
22 | private String birthday;
23 | private String selfIntroduction;
24 | private String homePageBackground;
25 | private Integer attentionNum;
26 | private Integer fansNum;
27 | private Integer attentionStatus;
28 | }
29 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/resources/mapper/UserCollectNotesMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | id, user_id, notes_id, create_time
14 |
15 |
16 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-notes-api/src/main/java/com/yyh/xfs/notes/domain/UserCollectNotesDO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.domain;
2 |
3 | import com.baomidou.mybatisplus.annotation.TableId;
4 | import com.baomidou.mybatisplus.annotation.TableName;
5 | import lombok.Data;
6 |
7 | import java.io.Serializable;
8 | import java.util.Date;
9 |
10 | /**
11 | * @author yyh
12 | * @date 2024-01-28
13 | */
14 | @Data
15 | @TableName("user_collect_notes")
16 | public class UserCollectNotesDO implements Serializable {
17 |
18 | private static final long serialVersionUID = 1L;
19 |
20 | @TableId
21 | private Long id;
22 | /**
23 | * 用户id
24 | */
25 | private Long userId;
26 |
27 | /**
28 | * 笔记id
29 | */
30 | private Long notesId;
31 |
32 | /**
33 | * 创建时间
34 | */
35 | private Date createTime;
36 | }
37 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/resources/mapper/NotesCategoryMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | id, category_name, category_sort, icon
14 |
15 |
16 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-user-api/src/main/java/com/yyh/xfs/user/domain/UserFansDO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.user.domain;
2 |
3 | import com.baomidou.mybatisplus.annotation.IdType;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableName;
7 | import lombok.Data;
8 |
9 | import java.io.Serializable;
10 | import java.util.Date;
11 |
12 | /**
13 | * @author yyh
14 | * @date 2023-12-30
15 | */
16 | @Data
17 | @TableName("user_fans")
18 | public class UserFansDO implements Serializable {
19 | @TableField(exist = false)
20 | private static final long serialVersionUID = 1L;
21 | @TableId(type = IdType.AUTO)
22 | private Long id;
23 |
24 | private Long userId;
25 |
26 | private Long fansId;
27 |
28 | private Date createTime;
29 | }
30 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/resources/mapper/UserViewsRecordNotesMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | id, user_id, notes_id, create_time
14 |
15 |
16 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-search-server/src/main/java/com/yyh/xfs/search/service/NotesSearchService.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.search.service;
2 |
3 | import com.yyh.xfs.common.domain.PageParam;
4 | import com.yyh.xfs.common.domain.Result;
5 | import com.yyh.xfs.notes.domain.NotesDO;
6 | import com.yyh.xfs.notes.vo.NotesPageVO;
7 |
8 | import java.util.Map;
9 |
10 | /**
11 | * @author yyh
12 | * @date 2024-01-24
13 | */
14 | public interface NotesSearchService {
15 | void addNotes(NotesDO notesDO);
16 |
17 | Result getNotesNearBy(PageParam pageParam);
18 |
19 | void updateNotes(NotesDO notesDO);
20 |
21 | void deleteNotes(Long notesId);
22 |
23 | Result getNotesByKeyword(String keyword, Integer page, Integer pageSize, Integer noteType, Integer hot);
24 |
25 | void updateCount(Map map);
26 | }
27 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-user-api/src/main/java/com/yyh/xfs/user/domain/UserBlackDO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.user.domain;
2 |
3 | import com.baomidou.mybatisplus.annotation.IdType;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableName;
7 | import lombok.Data;
8 |
9 | import java.io.Serializable;
10 | import java.util.Date;
11 |
12 | /**
13 | * @author yyh
14 | * @date 2023-12-30
15 | */
16 | @Data
17 | @TableName("user_black_list")
18 | public class UserBlackDO implements Serializable {
19 | @TableField(exist = false)
20 | private static final long serialVersionUID = 1L;
21 | @TableId(type = IdType.AUTO)
22 | private Long id;
23 |
24 | private Long userId;
25 |
26 | private Long blackId;
27 |
28 | private Date createTime;
29 | }
30 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-im-server/src/test/java/com/yyh/xfs/im/IMApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.im;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import org.junit.jupiter.api.Test;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.boot.test.context.SpringBootTest;
7 | import org.springframework.data.mongodb.core.MongoTemplate;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | /**
13 | * @author yyh
14 | * @date 2023-12-25
15 | */
16 | @SpringBootTest
17 | public class IMApplicationTest {
18 | @Autowired
19 | private MongoTemplate mongoTemplate;
20 | @Test
21 | void test1() {
22 | System.out.println("IMApplicationTest");
23 | }
24 |
25 | @Test
26 | void test2() {
27 | System.out.println(Runtime.getRuntime().availableProcessors());
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-im-server/src/main/java/com/yyh/xfs/im/handler/types/AttentionHandler.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.im.handler.types;
2 |
3 | import com.yyh.xfs.im.vo.MessageVO;
4 | import io.netty.channel.Channel;
5 | import lombok.extern.slf4j.Slf4j;
6 | import org.springframework.stereotype.Component;
7 | import static com.yyh.xfs.im.handler.IMServerHandler.USER_CHANNEL_MAP;
8 |
9 | /**
10 | * @author yyh
11 | * @date 2024-01-16
12 | */
13 | @Component
14 | @Slf4j
15 | public class AttentionHandler {
16 | private final ChatHandler chatHandler;
17 |
18 | public AttentionHandler(ChatHandler chatHandler) {
19 | this.chatHandler = chatHandler;
20 | }
21 |
22 | public void execute(MessageVO messageVO) {
23 | Channel channel = USER_CHANNEL_MAP.get(messageVO.getTo());
24 | chatHandler.sendMessage(channel, messageVO);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-comment-api/src/main/java/com/yyh/xfs/comment/vo/CommentVO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.comment.vo;
2 |
3 | import lombok.Data;
4 |
5 | import java.io.Serializable;
6 |
7 | /**
8 | * @author yyh
9 | * @date 2024-02-05
10 | */
11 | @Data
12 | public class CommentVO implements Serializable {
13 | private String id;
14 | private String content;
15 | private String province;
16 | private Long commentUserId;
17 | private String commentUserName;
18 | private String commentUserAvatar;
19 | private String parentId;
20 | private Long replyUserId;
21 | private String replyUserName;
22 | private String pictureUrl;
23 | private Integer commentLikeNum;
24 | // 评论回复数,只在为一级评论时有效
25 | private Integer commentReplyNum;
26 | private Long notesId;
27 | private Boolean isTop;
28 | private Boolean isLike;
29 | private Long createTime;
30 | }
31 |
--------------------------------------------------------------------------------
/xfs-common/common-mybatis/src/main/java/com/yyh/xfs/common/mybatis/config/MybatisPlusConfig.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.mybatis.config;
2 |
3 | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
4 | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | /**
9 | * @author yyh
10 | * @date 2023-12-09
11 | */
12 | @Configuration
13 | public class MybatisPlusConfig {
14 |
15 | /**
16 | * 配置分页插件
17 | */
18 | @Bean
19 | public MybatisPlusInterceptor mybatisPlusInterceptor(){
20 | MybatisPlusInterceptor mybatisPlusInterceptor=new MybatisPlusInterceptor();
21 | mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
22 | return mybatisPlusInterceptor;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/resources/mapper/NotesTopicMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | id, topic_name, topic_desc, create_time, create_user
16 |
17 |
18 |
--------------------------------------------------------------------------------
/xfs-third-server/src/main/java/com/yyh/xfs/third/config/AliyunOss.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.third.config;
2 |
3 | import lombok.Getter;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.springframework.beans.factory.annotation.Value;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | /**
9 | * @author yyh
10 | * @date 2023-12-21
11 | */
12 | @Configuration
13 | @Slf4j
14 | @Getter
15 | public class AliyunOss {
16 | @Value("${aliyun.oss.endpoint}")
17 | private String endpoint;
18 | @Value("${aliyun.oss.accessKeyId}")
19 | private String accessKeyId;
20 | @Value("${aliyun.oss.accessKeySecret}")
21 | private String accessKeySecret;
22 | @Value("${aliyun.oss.bucketName}")
23 | private String bucketName;
24 | @Value("${spring.servlet.multipart.max-file-size}")
25 | private String maxFileSize;
26 | @Value("${spring.servlet.multipart.max-request-size}")
27 | private String maxRequestSize;
28 | }
29 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/java/com/yyh/xfs/notes/feign/UserFeign.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.feign;
2 |
3 | import com.yyh.xfs.common.domain.Result;
4 | import org.springframework.cloud.openfeign.FeignClient;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RequestParam;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author yyh
12 | * @date 2024-01-26
13 | */
14 | @FeignClient("xfs-user")
15 | public interface UserFeign {
16 |
17 | @GetMapping("/user/getUserInfo")
18 | Result> getUserInfo(@RequestParam("userId") Long userId);
19 |
20 | @GetMapping("/user/relation/isAttention")
21 | Result selectOneByUserIdAndAttentionIdIsExist(@RequestParam("toId") Long toId, @RequestParam("fromId") Long fromId);
22 |
23 | @GetMapping("/user/relation/getAttentionUserId")
24 | Result> getAttentionUserId(@RequestParam("userId") Long userId);
25 | }
26 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-user-api/src/main/java/com/yyh/xfs/user/domain/UserAttentionDO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.user.domain;
2 |
3 | import com.baomidou.mybatisplus.annotation.IdType;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableName;
7 | import io.swagger.annotations.ApiModel;
8 | import lombok.Data;
9 |
10 | import java.io.Serializable;
11 | import java.util.Date;
12 |
13 | /**
14 | * @author yyh
15 | * @date 2023-12-30
16 | */
17 | @Data
18 | @TableName("user_attention")
19 | public class UserAttentionDO implements Serializable {
20 | @TableField(exist = false)
21 | private static final long serialVersionUID = 1L;
22 |
23 | @TableId(type = IdType.AUTO)
24 | private Long id;
25 |
26 | private Long userId;
27 |
28 | private Long attentionId;
29 | private String remarkName;
30 |
31 | private Date createTime;
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/xfs-common/common-base/src/main/java/com/yyh/xfs/common/utils/FieldValidationUtil.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.utils;
2 |
3 | /**
4 | * @author yyh
5 | * @date 2023-12-11
6 | */
7 | public class FieldValidationUtil {
8 | /**
9 | * 判断是否是手机号
10 | * @param phoneNumber 手机号
11 | * @return 是否是手机号
12 | */
13 | public static boolean isPhoneNumber(String phoneNumber) {
14 | return phoneNumber.matches("^1[3-9]\\d{9}$");
15 | }
16 |
17 | /**
18 | * 判断密码是否合法,密码长度为6-16位,必须包含数字和字母,可以包含特殊字符
19 | * @param password 密码
20 | * @return 是否合法
21 | */
22 | public static boolean isPassword(String password) {
23 | return password.matches("^(?=.*[0-9])(?=.*[a-zA-Z])(.{6,16})$");
24 | }
25 |
26 | /**
27 | * 判断验证码格式是否正确,验证码为6位数字组成的字符串
28 | * @param smsCode 验证码
29 | * @return 是否合法
30 | */
31 | public static boolean isSmsCode(String smsCode) {
32 | return smsCode.matches("^\\d{6}$");
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-comment-server/src/test/java/com/yyh/xfs/comment/CommentApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.comment;
2 |
3 | import com.yyh.xfs.comment.domain.CommentDO;
4 | import org.junit.jupiter.api.Test;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.boot.test.context.SpringBootTest;
7 | import org.springframework.data.mongodb.core.MongoTemplate;
8 |
9 | /**
10 | * @author yyh
11 | * @date 2024-02-05
12 | */
13 | @SpringBootTest
14 | public class CommentApplicationTest {
15 | @Autowired
16 | private MongoTemplate mongoTemplate;
17 | @Test
18 | void test1() {
19 | CommentDO commentDO = new CommentDO();
20 | commentDO.setCommentUserId(234343242L);
21 | commentDO.setNotesId(234343242L);
22 | commentDO.setContent("test");
23 | mongoTemplate.insert(commentDO);
24 | System.out.println(commentDO.getId());
25 | System.out.println(commentDO);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-notes-api/src/main/java/com/yyh/xfs/notes/domain/NotesCategoryDO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.domain;
2 |
3 | import com.baomidou.mybatisplus.annotation.TableId;
4 | import com.baomidou.mybatisplus.annotation.TableName;
5 | import lombok.AllArgsConstructor;
6 | import lombok.Data;
7 | import lombok.NoArgsConstructor;
8 |
9 | import java.io.Serializable;
10 |
11 | /**
12 | * @author yyh
13 | * @date 2024-01-22
14 | */
15 |
16 | @Data
17 | @TableName("notes_category")
18 | @AllArgsConstructor
19 | @NoArgsConstructor
20 | public class NotesCategoryDO implements Serializable {
21 |
22 | private static final long serialVersionUID = 1L;
23 |
24 | /**
25 | * 分类id
26 | */
27 | @TableId
28 | private Integer id;
29 |
30 | /**
31 | * 分类名称
32 | */
33 | private String categoryName;
34 |
35 | /**
36 | * 排序,越大越靠前
37 | */
38 | private Integer categorySort;
39 |
40 | /**
41 | * 图标
42 | */
43 | private String icon;
44 | }
45 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-comment-server/src/main/java/com/yyh/xfs/comment/service/CommentService.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.comment.service;
2 |
3 | import com.yyh.xfs.comment.domain.CommentDO;
4 | import com.yyh.xfs.comment.vo.CommentVO;
5 | import com.yyh.xfs.common.domain.Result;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * @author yyh
11 | * @date 2024-02-05
12 | */
13 | public interface CommentService {
14 | Result addComment(CommentDO commentDO);
15 |
16 | Result getCommentCount(Long notesId);
17 |
18 | Result> getCommentFirstList(Long notesId, Integer page, Integer pageSize);
19 |
20 | Result> getCommentSecondList(Long notesId,String parentId, Integer page, Integer pageSize);
21 |
22 | Result praiseComment(String commentId, Long userId, Long targetUserId);
23 |
24 | Result setTopComment(String commentId);
25 |
26 | Result deleteComment(String commentId);
27 |
28 | void deleteCommentByNotesId(Long notesId);
29 | }
30 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-user-server/src/main/java/com/yyh/xfs/user/service/UserRelationService.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.user.service;
2 |
3 | import com.yyh.xfs.common.domain.Result;
4 | import com.yyh.xfs.user.vo.UserRelationVO;
5 | import com.yyh.xfs.user.vo.ViewUserVO;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * @author yyh
11 | * @date 2024-01-15
12 | */
13 | public interface UserRelationService {
14 | Result selectOneByUserIdAndBlackIdIsExist(Long toId, Long fromId);
15 |
16 | Result selectOneByUserIdAndAttentionIdIsExist(Long toId, Long fromId);
17 |
18 | Result> selectAttentionList(Long userId, Integer pageNum, Integer pageSize);
19 |
20 | Result> selectFansList(Long userId, Integer pageNum, Integer pageSize);
21 |
22 | Result attention(Long userId, Long targetUserId);
23 |
24 | Result> updateRemarkName(Long userId, Long targetUserId, String remarkName);
25 |
26 | Result> getAttentionUserId(Long userId);
27 | }
28 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-user-server/src/main/resources/mapper/UserBlackMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
23 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-im-api/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.example
8 | xfs-modules-api
9 | 1.0-SNAPSHOT
10 |
11 |
12 | xfs-im-api
13 |
14 |
15 | 8
16 | 8
17 | UTF-8
18 |
19 |
20 |
21 | org.springframework.boot
22 | spring-boot-starter-data-mongodb
23 |
24 |
25 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-notes-api/src/main/java/com/yyh/xfs/notes/vo/NotesVO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.vo;
2 |
3 | import com.yyh.xfs.notes.dto.ResourcesDTO;
4 | import lombok.Data;
5 | import java.io.Serializable;
6 | import java.util.Date;
7 | import java.util.List;
8 |
9 | /**
10 | * @author yyh
11 | * @date 2024-01-26
12 | */
13 | @Data
14 | public class NotesVO implements Serializable {
15 | private Long id;
16 | private String title;
17 | private String content;
18 | private String coverPicture;
19 | private String nickname;
20 | private String avatarUrl;
21 | private Long belongUserId;
22 | private Integer notesLikeNum;
23 | private Integer notesCollectNum;
24 | private Integer notesViewNum;
25 | private Integer notesType;
26 | private Boolean isLike;
27 | private Boolean isCollect;
28 | private Boolean isFollow;
29 | private List notesResources;
30 | private String address;
31 | private String province;
32 | private Date createTime;
33 | private Date updateTime;
34 | }
35 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-comment-api/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.example
8 | xfs-modules-api
9 | 1.0-SNAPSHOT
10 |
11 |
12 | xfs-comment-api
13 |
14 |
15 | 8
16 | 8
17 | UTF-8
18 |
19 |
20 |
21 | org.springframework.boot
22 | spring-boot-starter-data-mongodb
23 |
24 |
25 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-search-api/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.example
8 | xfs-modules-api
9 | 1.0-SNAPSHOT
10 |
11 |
12 | xfs-search-api
13 |
14 |
15 | 8
16 | 8
17 | UTF-8
18 |
19 |
20 |
21 |
22 | org.springframework.boot
23 | spring-boot-starter-data-elasticsearch
24 |
25 |
26 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-user-api/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.example
8 | xfs-modules-api
9 | 1.0-SNAPSHOT
10 |
11 |
12 | xfs-user-api
13 |
14 |
15 | 8
16 | 8
17 | UTF-8
18 |
19 |
20 |
21 |
22 | org.example
23 | common-mybatis
24 | 1.0-SNAPSHOT
25 |
26 |
27 |
--------------------------------------------------------------------------------
/xfs-common/common-mybatis/src/main/java/com/yyh/xfs/common/mybatis/handler/MyMetaObjectHandler.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.mybatis.handler;
2 |
3 | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
4 | import org.apache.ibatis.reflection.MetaObject;
5 | import org.springframework.context.annotation.Configuration;
6 |
7 | import java.util.Date;
8 |
9 | /**
10 | * @author yyh
11 | * @date 2023-12-09
12 | */
13 | @Configuration
14 | public class MyMetaObjectHandler implements MetaObjectHandler {
15 | @Override
16 | public void insertFill(MetaObject metaObject) {
17 |
18 | if (metaObject.hasGetter("createTime")) {
19 | metaObject.setValue("createTime", new Date());
20 | }
21 | if (metaObject.hasGetter("updateTime")) {
22 | metaObject.setValue("updateTime", new Date());
23 | }
24 | }
25 |
26 | @Override
27 | public void updateFill(MetaObject metaObject) {
28 | if(metaObject.hasGetter("updateTime")) {
29 | metaObject.setValue("updateTime", new Date());
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-notes-api/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.example
8 | xfs-modules-api
9 | 1.0-SNAPSHOT
10 |
11 |
12 | xfs-notes-api
13 |
14 |
15 | 8
16 | 8
17 | UTF-8
18 |
19 |
20 |
21 |
22 | org.example
23 | common-mybatis
24 | 1.0-SNAPSHOT
25 |
26 |
27 |
--------------------------------------------------------------------------------
/xfs-modules-server/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.example
8 | xiaofanshu
9 | 1.0-SNAPSHOT
10 |
11 |
12 | xfs-modules-server
13 | pom
14 |
15 | xfs-user-server
16 | xfs-im-server
17 | xfs-notes-server
18 | xfs-search-server
19 | xfs-comment-server
20 |
21 |
22 |
23 | 8
24 | 8
25 | UTF-8
26 |
27 |
28 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-notes-api/src/main/java/com/yyh/xfs/notes/domain/NotesTopicDO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.domain;
2 |
3 | import com.baomidou.mybatisplus.annotation.FieldFill;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableName;
7 | import lombok.Data;
8 |
9 | import java.io.Serializable;
10 | import java.util.Date;
11 |
12 | /**
13 | * @author yyh
14 | * @date 2024-01-22
15 | */
16 | @Data
17 | @TableName("notes_topic")
18 | public class NotesTopicDO implements Serializable {
19 |
20 | private static final long serialVersionUID = 1L;
21 |
22 | /**
23 | * 话题id
24 | */
25 | @TableId
26 | private Long id;
27 |
28 | /**
29 | * 话题名称
30 | */
31 | private String topicName;
32 |
33 | /**
34 | * 话题描述
35 | */
36 | private String topicDesc;
37 |
38 | /**
39 | * 创建时间
40 | */
41 | @TableField(fill = FieldFill.INSERT)
42 | private Date createTime;
43 |
44 | /**
45 | * 创建人
46 | */
47 | private Long createUser;
48 | }
49 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-im-api/src/main/java/com/yyh/xfs/im/domain/MessageDO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.im.domain;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 | import org.springframework.data.mongodb.core.mapping.Document;
7 |
8 | import java.io.Serializable;
9 |
10 | /**
11 | * @author yyh
12 | * @date 2023-12-25
13 | */
14 | @Data
15 | @AllArgsConstructor
16 | @NoArgsConstructor
17 | @Document(value = "message")
18 | public class MessageDO implements Serializable {
19 | /**
20 | * 发送者id
21 | */
22 | private String from;
23 | /**
24 | * 接收者id
25 | */
26 | private String to;
27 | /**
28 | * 消息内容
29 | */
30 | private String content;
31 | /**
32 | * 发送时间
33 | */
34 | private Long time;
35 | /**
36 | * 0:不是聊天信息
37 | * 1:文本信息
38 | * 2:图片信息
39 | * 3:文件信息
40 | * 4:语音信息
41 | */
42 | private Integer chatType;
43 | /**
44 | * 0:好友消息
45 | * 1:陌生人消息
46 | */
47 | private Integer friendType;
48 | /**
49 | * 语音时长,单位秒
50 | */
51 | private Integer audioTime;
52 | }
53 |
--------------------------------------------------------------------------------
/xfs-gateway/src/main/java/com/yyh/xfs/gateway/utils/JWTUtil.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.gateway.utils;
2 |
3 | import com.yyh.xfs.gateway.properties.JwtProperties;
4 | import io.jsonwebtoken.Jwts;
5 | import io.jsonwebtoken.SignatureAlgorithm;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.context.annotation.Configuration;
8 |
9 | import java.util.Map;
10 |
11 | /**
12 | * @author yyh
13 | * @date 2023-12-09
14 | */
15 | @Configuration
16 | public class JWTUtil {
17 |
18 | private static JwtProperties jwtProperties;
19 |
20 | @Autowired
21 | private void setJwtProperties(JwtProperties jwtProperties) {
22 | JWTUtil.jwtProperties = jwtProperties;
23 | }
24 | public static String createToken(Map claims){
25 | return Jwts.builder()
26 | .setClaims(claims)
27 | .signWith(SignatureAlgorithm.HS512,jwtProperties.getSecret()).compact();
28 | }
29 |
30 | public static Map parseToken(String token){
31 | return Jwts.parser().setSigningKey(jwtProperties.getSecret()).parseClaimsJws(token).getBody();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-im-server/src/main/java/com/yyh/xfs/im/config/ImConfig.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.im.config;
2 |
3 | import com.yyh.xfs.common.redis.constant.BloomFilterMap;
4 | import com.yyh.xfs.common.redis.utils.BloomFilterUtils;
5 | import org.springframework.context.annotation.Configuration;
6 |
7 | import javax.annotation.PostConstruct;
8 |
9 | /**
10 | * @author yyh
11 | * @date 2024-02-25
12 | */
13 | @Configuration
14 | public class ImConfig {
15 | private final BloomFilterUtils bloomFilterUtils;
16 |
17 | public ImConfig(BloomFilterUtils bloomFilterUtils) {
18 | this.bloomFilterUtils = bloomFilterUtils;
19 | }
20 |
21 | /**
22 | * 初始化布隆过滤器
23 | */
24 | @PostConstruct
25 | public void initBloomFilter() {
26 | // 先判断有没有该布隆过滤器,没有则初始化
27 | long expectedInsertionsBloomFilter = bloomFilterUtils.getExpectedInsertionsBloomFilter(BloomFilterMap.ROCKETMQ_IDEMPOTENT_BLOOM_FILTER);
28 | if (expectedInsertionsBloomFilter > 0) {
29 | return;
30 | }
31 | bloomFilterUtils.initBloomFilter(BloomFilterMap.ROCKETMQ_IDEMPOTENT_BLOOM_FILTER, 100000, 0.01);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-search-api/src/main/java/com/yyh/xfs/search/domain/UserEsDO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.search.domain;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 | import org.springframework.data.annotation.Id;
7 | import org.springframework.data.elasticsearch.annotations.Document;
8 | import org.springframework.data.elasticsearch.annotations.Field;
9 | import org.springframework.data.elasticsearch.annotations.FieldType;
10 |
11 | /**
12 | * @author yyh
13 | * @date 2024-02-21
14 | */
15 | @Data
16 | @AllArgsConstructor
17 | @NoArgsConstructor
18 | @Document(indexName = "user")
19 | public class UserEsDO {
20 | @Id
21 | @Field(type = FieldType.Long)
22 | private Long id;
23 |
24 | /**
25 | * 用户名
26 | */
27 | @Field(type = FieldType.Text, analyzer = "ik_smart",searchAnalyzer = "ik_smart")
28 | private String nickname;
29 |
30 | /**
31 | * 用户头像
32 | */
33 | @Field(type = FieldType.Text)
34 | private String avatarUrl;
35 |
36 | /**
37 | * 用户小番薯号
38 | */
39 | @Field(type = FieldType.Text)
40 | private String uid;
41 |
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/java/com/yyh/xfs/notes/controller/NotesCategoryController.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.controller;
2 |
3 | import com.yyh.xfs.common.domain.Result;
4 | import com.yyh.xfs.notes.domain.NotesCategoryDO;
5 | import com.yyh.xfs.notes.service.NotesCategoryService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.web.bind.annotation.GetMapping;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | import java.util.List;
12 |
13 | /**
14 | * @author yyh
15 | * @date 2024-02-23
16 | */
17 | @RestController
18 | @RequestMapping("/notes/category")
19 | public class NotesCategoryController {
20 | private final NotesCategoryService notesCategoryService;
21 |
22 | public NotesCategoryController(NotesCategoryService notesCategoryService) {
23 | this.notesCategoryService = notesCategoryService;
24 | }
25 |
26 | @GetMapping("/getNotesCategoryList")
27 | public Result> getNotesCategory() {
28 | return notesCategoryService.getNotesCategory();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/xfs-common/common-mybatis/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.example
8 | xfs-common
9 | 1.0-SNAPSHOT
10 |
11 |
12 | common-mybatis
13 |
14 |
15 | 8
16 | 8
17 | UTF-8
18 |
19 |
20 |
21 |
22 | mysql
23 | mysql-connector-java
24 |
25 |
26 | com.baomidou
27 | mybatis-plus-boot-starter
28 |
29 |
30 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-im-server/src/main/java/com/yyh/xfs/im/IMApplication.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.im;
2 |
3 | import com.yyh.xfs.common.web.config.FeignConfig;
4 | import com.yyh.xfs.im.server.IMServer;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.boot.CommandLineRunner;
7 | import org.springframework.boot.SpringApplication;
8 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
9 | import org.springframework.boot.autoconfigure.SpringBootApplication;
10 | import org.springframework.cloud.openfeign.EnableFeignClients;
11 |
12 | /**
13 | * @author yyh
14 | * @date 2023-12-24
15 | * @desc im启动类
16 | * 排除FeignConfig.class,因为websocket无法获取header,所以需要在参数中传递,不需要FeignConfig.class
17 | */
18 | @SpringBootApplication(exclude = {FeignConfig.class})
19 | @EnableFeignClients
20 | public class IMApplication implements CommandLineRunner {
21 | @Autowired
22 | private IMServer imServer;
23 | public static void main(String[] args) {
24 | SpringApplication.run(IMApplication.class, args);
25 | }
26 | /**
27 | * 项目启动后执行
28 | */
29 | @Override
30 | public void run(String... args) {
31 | // 启动netty
32 | imServer.start();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/xfs-common/common-base/src/main/java/com/yyh/xfs/common/constant/RocketMQTopicConstant.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.constant;
2 |
3 | /**
4 | * @author yyh
5 | * @date 2024-02-25
6 | */
7 | public class RocketMQTopicConstant {
8 | public static final String NOTES_DELETE_COMMENT_TOPIC = "notes-delete-comment-topic";
9 | public static final String FIND_USER_TOPIC = "find-user-topic";
10 | public static final String PRAISE_AND_COLLECT_REMIND_TOPIC = "notes-praiseAndCollect-remind-topic";
11 | public static final String NOTES_REMIND_TARGET_TOPIC = "notes-remind-target-topic";
12 | public static final String NOTES_REMOVE_REDIS_TOPIC = "notes-remove-redis-topic";
13 | public static final String NOTES_ADD_ES_TOPIC = "notes-add-es-topic";
14 | public static final String NOTES_DELETE_ES_TOPIC = "notes-delete-es-topic";
15 | public static final String NOTES_UPDATE_ES_TOPIC = "notes-update-es-topic";
16 | public static final String NOTES_UPDATE_COUNT_TOPIC = "notes-update-count-topic";
17 | public static final String USER_ADD_ES_TOPIC = "user-add-es-topic";
18 | public static final String USER_UPDATE_ES_TOPIC = "user-update-es-topic";
19 | public static final String NOTES_ADD_TRANSACTION_TOPIC = "notes-add-transaction-topic";
20 | }
21 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/java/com/yyh/xfs/notes/service/impl/NotesCategoryServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.service.impl;
2 |
3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 | import com.yyh.xfs.common.domain.Result;
5 | import com.yyh.xfs.common.utils.ResultUtil;
6 | import com.yyh.xfs.notes.domain.NotesCategoryDO;
7 | import com.yyh.xfs.notes.mapper.NotesCategoryMapper;
8 | import com.yyh.xfs.notes.service.NotesCategoryService;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.stereotype.Service;
11 |
12 | import java.util.List;
13 |
14 | /**
15 | * @author yyh
16 | * @date 2024-02-23
17 | */
18 | @Service
19 | public class NotesCategoryServiceImpl implements NotesCategoryService {
20 | private final NotesCategoryMapper notesCategoryMapper;
21 |
22 | public NotesCategoryServiceImpl(NotesCategoryMapper notesCategoryMapper) {
23 | this.notesCategoryMapper = notesCategoryMapper;
24 | }
25 |
26 | @Override
27 | public Result> getNotesCategory() {
28 | List notesCategoryList = notesCategoryMapper.getNotesCategory();
29 | return ResultUtil.successGet(notesCategoryList);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/xfs-common/common-base/src/main/java/com/yyh/xfs/common/myEnum/MessageTypeEnum.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.myEnum;
2 |
3 | import lombok.Getter;
4 | import lombok.ToString;
5 |
6 | /**
7 | * @author yyh
8 | * @date 2023-12-25
9 | */
10 | @Getter
11 | @ToString
12 | public class MessageTypeEnum {
13 | /**
14 | * 0:连接信息
15 | * 1:心跳信息
16 | * 2:系统信息
17 | * 3:聊天信息
18 | * 4:新增关注信息
19 | * 5:服务器应答信息
20 | */
21 | public static final Integer CONNECT_MESSAGE = 0;
22 | public static final Integer HEART_MESSAGE = 1;
23 | public static final Integer SYSTEM_MESSAGE = 2;
24 | public static final Integer CHAT_MESSAGE = 3;
25 | public static final Integer FOLLOW_MESSAGE = 4;
26 | public static final Integer SERVER_ANSWER_MESSAGE = 5;
27 | /**
28 | * 0:不是聊天信息
29 | * 1:文本信息
30 | * 2:图片信息
31 | * 3:文件信息
32 | */
33 | public static final Integer NOT_CHAT_MESSAGE = 0;
34 | public static final Integer TEXT_MESSAGE = 1;
35 | public static final Integer IMAGE_MESSAGE = 2;
36 | public static final Integer FILE_MESSAGE = 3;
37 | /**
38 | * 0:好友消息
39 | * 1:陌生人消息
40 | */
41 | public static final Integer FRIEND_MESSAGE = 0;
42 | public static final Integer STRANGER_MESSAGE = 1;
43 | }
44 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/java/com/yyh/xfs/notes/consumer/RemoveCacheConsumer.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.consumer;
2 |
3 | import com.yyh.xfs.common.constant.RocketMQConsumerGroupConstant;
4 | import com.yyh.xfs.common.constant.RocketMQTopicConstant;
5 | import com.yyh.xfs.common.redis.utils.RedisCache;
6 | import lombok.extern.slf4j.Slf4j;
7 | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
8 | import org.apache.rocketmq.spring.core.RocketMQListener;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.stereotype.Component;
11 |
12 | /**
13 | * @author yyh
14 | * @date 2024-02-24
15 | */
16 | @Component
17 | @Slf4j
18 | @RocketMQMessageListener(topic = RocketMQTopicConstant.NOTES_REMOVE_REDIS_TOPIC,
19 | consumerGroup = RocketMQConsumerGroupConstant.NOTES_REMOVE_REDIS_CONSUMER_GROUP)
20 | public class RemoveCacheConsumer implements RocketMQListener {
21 |
22 | private final RedisCache redisCache;
23 |
24 | public RemoveCacheConsumer(RedisCache redisCache) {
25 | this.redisCache = redisCache;
26 | }
27 |
28 | @Override
29 | public void onMessage(String s) {
30 | log.info("remove cache: {}", s);
31 | redisCache.delAllPrefix(s);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/xfs-third-server/src/main/java/com/yyh/xfs/third/config/AliyunSms.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.third.config;
2 |
3 | import com.aliyun.dysmsapi20170525.Client;
4 | import com.aliyun.teaopenapi.models.Config;
5 | import com.yyh.xfs.common.myEnum.ExceptionMsgEnum;
6 | import com.yyh.xfs.common.web.exception.SystemException;
7 | import lombok.extern.slf4j.Slf4j;
8 | import org.springframework.beans.factory.annotation.Value;
9 | import org.springframework.context.annotation.Bean;
10 | import org.springframework.context.annotation.Configuration;
11 |
12 | /**
13 | * @author yyh
14 | * @date 2023-12-12
15 | */
16 | @Configuration
17 | @Slf4j
18 | public class AliyunSms {
19 | @Value("${aliyun.sms.accessKeyId}")
20 | private String accessKeyId;
21 | @Value("${aliyun.sms.accessKeySecret}")
22 | private String accessKeySecret;
23 | private static final String ENDPOINT = "dysmsapi.aliyuncs.com";
24 |
25 | @Bean
26 | public Client smsClient() {
27 | Config config = new Config().setAccessKeyId(accessKeyId).setAccessKeySecret(accessKeySecret);
28 | config.endpoint = ENDPOINT;
29 | try {
30 | return new Client(config);
31 | } catch (Exception e) {
32 | throw new SystemException(ExceptionMsgEnum.ALIYUN_SMS_INIT_ERROR, e);
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-user-server/src/main/java/com/yyh/xfs/user/mapper/UserAttentionMapper.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.user.mapper;
2 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
3 | import com.yyh.xfs.user.domain.UserAttentionDO;
4 | import com.yyh.xfs.user.vo.UserRelationVO;
5 | import com.yyh.xfs.user.vo.ViewUserVO;
6 | import org.apache.ibatis.annotations.Mapper;
7 | import org.apache.ibatis.annotations.Select;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * @author yyh
13 | * @date 2023-12-30
14 | */
15 | @Mapper
16 | public interface UserAttentionMapper extends BaseMapper {
17 | Boolean selectOneByUserIdAndAttentionIdIsExist(Long userId, Long attentionId);
18 |
19 | @Select("select count(*) from user_attention where user_id=#{userId}")
20 | Integer getCountById(Long userId);
21 |
22 | List selectAttentionList(Long userId, Integer offset, Integer pageSize);
23 |
24 | @Select("select * from user_attention where user_id=#{userId} and attention_id=#{targetUserId}")
25 | UserAttentionDO getExist(Long userId, Long targetUserId);
26 |
27 | /**
28 | * 获取用户关注的用户id
29 | * @param userId 用户id
30 | * @return 用户关注的用户id
31 | */
32 | @Select("select attention_id from user_attention where user_id=#{userId}")
33 | List getAttentionUserId(Long userId);
34 | }
35 |
--------------------------------------------------------------------------------
/xfs-common/common-web/src/main/java/com/yyh/xfs/common/web/utils/JWTUtil.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.web.utils;
2 |
3 | import com.yyh.xfs.common.web.properties.JwtProperties;
4 | import io.jsonwebtoken.Jwts;
5 | import io.jsonwebtoken.SignatureAlgorithm;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.beans.factory.annotation.Value;
8 | import org.springframework.context.annotation.Configuration;
9 |
10 | import java.util.Map;
11 |
12 | /**
13 | * @author yyh
14 | * @date 2023-12-09
15 | */
16 | @Configuration
17 | public class JWTUtil {
18 |
19 | private static JwtProperties jwtProperties;
20 |
21 | @Autowired
22 | private void setJwtProperties(JwtProperties jwtProperties) {
23 | JWTUtil.jwtProperties = jwtProperties;
24 | }
25 | public static String createToken(Map claims){
26 | return Jwts.builder()
27 | .setClaims(claims)
28 | .signWith(SignatureAlgorithm.HS512,jwtProperties.getSecret()).compact();
29 | }
30 |
31 | public static Map parseToken(String token){
32 | return Jwts.parser().setSigningKey(jwtProperties.getSecret()).parseClaimsJws(token).getBody();
33 | }
34 |
35 | public static Long getCurrentUserId(String token){
36 | return (Long) parseToken(token).get("userId");
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/xfs-auth/src/main/java/com/yyh/xfs/auth/utils/UserInfoUtil.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.auth.utils;
2 | import com.tencentyun.TLSSigAPIv2;
3 | import com.yyh.xfs.common.myEnum.ExceptionMsgEnum;
4 | import com.yyh.xfs.common.web.exception.BusinessException;
5 | import com.yyh.xfs.common.web.utils.JWTUtil;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.context.annotation.Configuration;
8 |
9 | import javax.servlet.http.HttpServletRequest;
10 | import java.util.Map;
11 |
12 | /**
13 | * @author yyh
14 | * @date 2023-10-01
15 | */
16 | @Configuration
17 | public class UserInfoUtil {
18 | public static Long getUserId(HttpServletRequest request) {
19 | String token = null;
20 | try {
21 | token = request.getHeader("token");
22 | } catch (Exception e) {
23 | throw new BusinessException(ExceptionMsgEnum.NOT_LOGIN, e);
24 | }
25 | if(token == null){
26 | throw new BusinessException(ExceptionMsgEnum.NOT_LOGIN);
27 | }
28 | Long userId=null;
29 | try {
30 | Map map = JWTUtil.parseToken(token);
31 | userId = (Long) map.get("userId");
32 | } catch (Exception e) {
33 | throw new BusinessException(ExceptionMsgEnum.TOKEN_INVALID, e);
34 | }
35 | return userId;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/xfs-common/common-base/src/main/java/com/yyh/xfs/common/constant/RocketMQConsumerGroupConstant.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.constant;
2 |
3 | /**
4 | * @author yyh
5 | * @date 2024-02-25
6 | */
7 | public class RocketMQConsumerGroupConstant {
8 | public static final String NOTES_DELETE_COMMENT_CONSUMER_GROUP = "notes-delete-comment-consumer-group";
9 | public static final String FIND_USER_CONSUMER_GROUP = "find-user-consumer-group";
10 | public static final String PRAISE_AND_COLLECT_REMIND_CONSUMER_GROUP = "praise-and-collect-notification-consumer-group";
11 | public static final String NOTES_REMIND_TARGET_CONSUMER_GROUP = "notes-remind-target-consumer-group";
12 | public static final String NOTES_REMOVE_REDIS_CONSUMER_GROUP = "notes-remove-redis-consumer-group";
13 | public static final String NOTES_ADD_ES_CONSUMER_GROUP = "notes-add-es-consumer-group";
14 | public static final String NOTES_DELETE_ES_CONSUMER_GROUP = "notes-delete-es-consumer-group";
15 | public static final String NOTES_UPDATE_ES_CONSUMER_GROUP = "notes-update-es-consumer-group";
16 | public static final String NOTES_UPDATE_COUNT_CONSUMER_GROUP = "notes-update-count-consumer-group";
17 | public static final String USER_ADD_ES_CONSUMER_GROUP = "user-add-es-consumer-group";
18 | public static final String USER_UPDATE_ES_CONSUMER_GROUP = "user-update-es-consumer-group";
19 | }
20 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-search-server/src/main/java/com/yyh/xfs/search/consumer/notes/NotesDeleteEsConsumer.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.search.consumer.notes;
2 |
3 | import com.yyh.xfs.common.constant.RocketMQConsumerGroupConstant;
4 | import com.yyh.xfs.common.constant.RocketMQTopicConstant;
5 | import com.yyh.xfs.search.service.NotesSearchService;
6 | import lombok.extern.slf4j.Slf4j;
7 | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
8 | import org.apache.rocketmq.spring.core.RocketMQListener;
9 | import org.springframework.stereotype.Component;
10 |
11 | /**
12 | * @author yyh
13 | * @date 2024-02-17
14 | */
15 | @Component
16 | @Slf4j
17 | @RocketMQMessageListener(topic = RocketMQTopicConstant.NOTES_DELETE_ES_TOPIC,
18 | consumerGroup = RocketMQConsumerGroupConstant.NOTES_DELETE_ES_CONSUMER_GROUP)
19 | public class NotesDeleteEsConsumer implements RocketMQListener {
20 |
21 | private final NotesSearchService notesSearchService;
22 |
23 | public NotesDeleteEsConsumer(NotesSearchService notesSearchService) {
24 | this.notesSearchService = notesSearchService;
25 | }
26 |
27 | @Override
28 | public void onMessage(String s) {
29 | log.info("收到消息:{}", s);
30 | Long notesId = Long.valueOf(s);
31 | log.info("notesId:{}", notesId);
32 | notesSearchService.deleteNotes(notesId);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-im-api/src/main/java/com/yyh/xfs/im/vo/MessageVO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.im.vo;
2 | import lombok.*;
3 |
4 | import java.io.Serializable;
5 |
6 | /**
7 | * @author yyh
8 | * @date 2023-12-25
9 | * 消息前后端传输对象
10 | */
11 | @Data
12 | @AllArgsConstructor
13 | @NoArgsConstructor
14 | public class MessageVO implements Serializable {
15 | private Integer id;
16 | /**
17 | * 发送者id
18 | */
19 | private String from;
20 | /**
21 | * 发送者名称
22 | */
23 | private String fromName;
24 | /**
25 | * 发送者头像
26 | */
27 | private String fromAvatar;
28 | /**
29 | * 接收者id
30 | */
31 | private String to;
32 | /**
33 | * 消息内容
34 | */
35 | private String content;
36 | /**
37 | * 发送时间
38 | */
39 | private Long time;
40 | /**
41 | * 0:连接信息
42 | * 1:心跳信息
43 | * 2:系统信息
44 | * 3:聊天信息
45 | * 4:新增关注信息
46 | * 5:服务器应答信息
47 | * 6:token鉴权信息
48 | * 7:@消息
49 | * 8:赞与收藏信息
50 | */
51 | private Integer messageType;
52 | /**
53 | * 0:不是聊天信息
54 | * 1:文本信息
55 | * 2:图片信息
56 | * 3:文件信息
57 | * 4:语音信息
58 | */
59 | private Integer chatType;
60 | /**
61 | * 0:好友消息
62 | * 1:陌生人消息
63 | */
64 | private Integer friendType;
65 | /**
66 | * 语音时长,单位秒
67 | */
68 | private Integer audioTime;
69 | }
70 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/java/com/yyh/xfs/notes/mapper/NotesMapper.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.yyh.xfs.notes.domain.NotesDO;
5 | import org.apache.ibatis.annotations.Mapper;
6 | import org.apache.ibatis.annotations.Select;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author yyh
12 | * @date 2024-01-19
13 | */
14 | @Mapper
15 | public interface NotesMapper extends BaseMapper {
16 |
17 | List selectPageByTime(Integer offset, Integer pageSize);
18 |
19 | List selectPageByUserId(Integer offset, Integer pageSize, Long userId, Integer authority);
20 |
21 | List selectPageByUserIdAndLike(Integer offset, Integer pageSize, Long userId);
22 |
23 | List selectPageByUserIdAndCollect(Integer offset, Integer pageSize, Long userId);
24 |
25 | Integer getPraiseCountByUserId(Long userId);
26 |
27 | Integer getCollectCountByUserId(Long userId);
28 |
29 | List selectPageByAttentionUserId(Integer offset, Integer pageSize, List attentionUserId);
30 |
31 | List selectPageByCategoryIdByUpdateTime(Integer offset, Integer pageSize, Integer categoryId,Integer notesType);
32 |
33 | List selectPageByCategoryIdOrderByPraise(Integer offset, Integer pageSize, Integer categoryId,Integer notesType);
34 | }
35 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-im-server/src/main/java/com/yyh/xfs/im/feign/user/UserFeign.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.im.feign.user;
2 |
3 | import com.yyh.xfs.common.domain.Result;
4 | import org.springframework.cloud.openfeign.FeignClient;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RequestHeader;
7 | import org.springframework.web.bind.annotation.RequestParam;
8 |
9 | /**
10 | * @author yyh
11 | * @date 2024-01-15
12 | */
13 | @FeignClient("xfs-user")
14 | public interface UserFeign {
15 | /**
16 | * 查询用户是否被拉黑
17 | *
18 | * @param toId 被拉黑用户id
19 | * @param fromId 拉黑用户id
20 | * @param token token,由于websocket无法获取header,所以需要在参数中传递
21 | * @return 是否被拉黑
22 | */
23 | @GetMapping(value = "/user/relation/isBlack")
24 | Result selectOneByUserIdAndBlackIdIsExist(@RequestParam("toId") Long toId, @RequestParam("fromId") Long fromId, @RequestHeader("token") String token);
25 |
26 | /**
27 | * 查询用户是否被关注
28 | *
29 | * @param toId 被关注用户id
30 | * @param fromId 关注用户id
31 | * @param token token,由于websocket无法获取header,所以需要在参数中传递
32 | * @return 是否被关注
33 | */
34 | @GetMapping("/user/relation/isAttention")
35 | Result selectOneByUserIdAndAttentionIdIsExist(@RequestParam("toId") Long toId, @RequestParam("fromId") Long fromId, @RequestHeader("token") String token);
36 | }
37 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-user-server/src/main/resources/mapper/UserFansMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-comment-server/src/main/java/com/yyh/xfs/comment/consumer/NotesDeleteCommentConsumer.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.comment.consumer;
2 |
3 | import com.yyh.xfs.comment.service.CommentService;
4 | import com.yyh.xfs.common.constant.RocketMQConsumerGroupConstant;
5 | import com.yyh.xfs.common.constant.RocketMQTopicConstant;
6 | import lombok.extern.slf4j.Slf4j;
7 | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
8 | import org.apache.rocketmq.spring.core.RocketMQListener;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.stereotype.Component;
11 |
12 | /**
13 | * @author yyh
14 | * @date 2024-02-17
15 | */
16 | @Component
17 | @Slf4j
18 | @RocketMQMessageListener(topic = RocketMQTopicConstant.NOTES_DELETE_COMMENT_TOPIC, consumerGroup = RocketMQConsumerGroupConstant.NOTES_DELETE_COMMENT_CONSUMER_GROUP)
19 | public class NotesDeleteCommentConsumer implements RocketMQListener {
20 |
21 | private final CommentService commentService;
22 |
23 | public NotesDeleteCommentConsumer(CommentService commentService) {
24 | this.commentService = commentService;
25 | }
26 |
27 | @Override
28 | public void onMessage(String s) {
29 | log.info("收到消息:{}", s);
30 | Long notesId = Long.valueOf(s);
31 | log.info("notesId:{}", notesId);
32 | commentService.deleteCommentByNotesId(notesId);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-search-server/src/main/java/com/yyh/xfs/search/consumer/notes/NotesAddEsConsumer.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.search.consumer.notes;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import com.yyh.xfs.common.constant.RocketMQConsumerGroupConstant;
5 | import com.yyh.xfs.common.constant.RocketMQTopicConstant;
6 | import com.yyh.xfs.notes.domain.NotesDO;
7 | import com.yyh.xfs.search.service.NotesSearchService;
8 | import lombok.extern.slf4j.Slf4j;
9 | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
10 | import org.apache.rocketmq.spring.core.RocketMQListener;
11 | import org.springframework.stereotype.Component;
12 |
13 | /**
14 | * @author yyh
15 | * @date 2024-01-24
16 | */
17 | @Component
18 | @Slf4j
19 | @RocketMQMessageListener(topic = RocketMQTopicConstant.NOTES_ADD_ES_TOPIC,
20 | consumerGroup = RocketMQConsumerGroupConstant.NOTES_ADD_ES_CONSUMER_GROUP)
21 | public class NotesAddEsConsumer implements RocketMQListener {
22 |
23 | private final NotesSearchService notesSearchService;
24 |
25 | public NotesAddEsConsumer(NotesSearchService notesSearchService) {
26 | this.notesSearchService = notesSearchService;
27 | }
28 |
29 | @Override
30 | public void onMessage(String s) {
31 | log.info("收到消息:{}", s);
32 | NotesDO notesDO = JSON.parseObject(s, NotesDO.class);
33 | log.info("notesDO:{}", notesDO);
34 | notesSearchService.addNotes(notesDO);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-search-server/src/main/java/com/yyh/xfs/search/consumer/user/UserUpdateEsConsumer.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.search.consumer.user;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import com.yyh.xfs.common.constant.RocketMQConsumerGroupConstant;
5 | import com.yyh.xfs.common.constant.RocketMQTopicConstant;
6 | import com.yyh.xfs.search.domain.UserEsDO;
7 | import com.yyh.xfs.search.service.UserSearchService;
8 | import lombok.extern.slf4j.Slf4j;
9 | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
10 | import org.apache.rocketmq.spring.core.RocketMQListener;
11 | import org.springframework.stereotype.Component;
12 |
13 | /**
14 | * @author yyh
15 | * @date 2024-02-21
16 | */
17 | @Component
18 | @Slf4j
19 | @RocketMQMessageListener(topic = RocketMQTopicConstant.USER_UPDATE_ES_TOPIC,
20 | consumerGroup = RocketMQConsumerGroupConstant.USER_UPDATE_ES_CONSUMER_GROUP)
21 | public class UserUpdateEsConsumer implements RocketMQListener {
22 | private final UserSearchService userSearchService;
23 |
24 | public UserUpdateEsConsumer(UserSearchService userSearchService) {
25 | this.userSearchService = userSearchService;
26 | }
27 |
28 | @Override
29 | public void onMessage(String s) {
30 | log.info("收到消息:{}", s);
31 | UserEsDO userEsDO = JSON.parseObject(s, UserEsDO.class);
32 | log.info("转换后的对象:{}", userEsDO);
33 | userSearchService.updateUser(userEsDO);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/xfs-common/common-web/src/main/java/com/yyh/xfs/common/web/config/SwaggerConfig.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.web.config;
2 |
3 | import org.springframework.context.annotation.Bean;
4 | import org.springframework.context.annotation.Configuration;
5 | import springfox.documentation.builders.ApiInfoBuilder;
6 | import springfox.documentation.builders.PathSelectors;
7 | import springfox.documentation.builders.RequestHandlerSelectors;
8 | import springfox.documentation.service.ApiInfo;
9 | import springfox.documentation.service.Contact;
10 | import springfox.documentation.spi.DocumentationType;
11 | import springfox.documentation.spring.web.plugins.Docket;
12 |
13 | /**
14 | * @author yyh
15 | * @date 2023-09-17
16 | */
17 | @Configuration
18 | public class SwaggerConfig {
19 | @Bean
20 | public Docket createRestApi() {
21 | return new Docket(DocumentationType.SWAGGER_2)
22 | .useDefaultResponseMessages(false)
23 | .apiInfo(apiInfo())
24 | .select()
25 | .apis(RequestHandlerSelectors.basePackage("com.yyh.xfs.*.controller"))
26 | .paths(PathSelectors.any())
27 | .build();
28 |
29 | }
30 | private ApiInfo apiInfo() {
31 | return new ApiInfoBuilder()
32 | .description("小番薯接口文档")
33 | .contact(new Contact("杨亚豪", "", "yahaoyang929@vip.qq.com"))
34 | .version("v1.0")
35 | .title("接口文档")
36 | .build();
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-search-server/src/main/java/com/yyh/xfs/search/consumer/user/UserAddEsConsumer.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.search.consumer.user;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import com.yyh.xfs.common.constant.RocketMQConsumerGroupConstant;
5 | import com.yyh.xfs.common.constant.RocketMQTopicConstant;
6 | import com.yyh.xfs.search.domain.UserEsDO;
7 | import com.yyh.xfs.search.service.UserSearchService;
8 | import lombok.extern.slf4j.Slf4j;
9 | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
10 | import org.apache.rocketmq.spring.core.RocketMQListener;
11 | import org.springframework.beans.factory.annotation.Autowired;
12 | import org.springframework.stereotype.Component;
13 |
14 | /**
15 | * @author yyh
16 | * @date 2024-02-21
17 | */
18 | @Component
19 | @Slf4j
20 | @RocketMQMessageListener(topic = RocketMQTopicConstant.USER_ADD_ES_TOPIC,
21 | consumerGroup = RocketMQConsumerGroupConstant.USER_ADD_ES_CONSUMER_GROUP)
22 | public class UserAddEsConsumer implements RocketMQListener {
23 | private final UserSearchService userSearchService;
24 |
25 | public UserAddEsConsumer(UserSearchService userSearchService) {
26 | this.userSearchService = userSearchService;
27 | }
28 |
29 | @Override
30 | public void onMessage(String s) {
31 | log.info("收到消息:{}", s);
32 | UserEsDO userEsDO = JSON.parseObject(s, UserEsDO.class);
33 | log.info("转换后的对象:{}", userEsDO);
34 | userSearchService.addUser(userEsDO);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-search-server/src/main/java/com/yyh/xfs/search/service/impl/ElasticSearchInitServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.search.service.impl;
2 |
3 | import com.yyh.xfs.common.myEnum.ExceptionMsgEnum;
4 | import com.yyh.xfs.common.web.exception.SystemException;
5 | import com.yyh.xfs.search.domain.NotesEsDO;
6 | import com.yyh.xfs.search.service.ElasticSearchInitService;
7 | import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
8 | import org.springframework.stereotype.Service;
9 |
10 | /**
11 | * @author yyh
12 | * @date 2024-01-24
13 | */
14 | @Service
15 | public class ElasticSearchInitServiceImpl implements ElasticSearchInitService {
16 | private final ElasticsearchRestTemplate elasticsearchRestTemplate;
17 |
18 | public ElasticSearchInitServiceImpl(ElasticsearchRestTemplate elasticsearchRestTemplate) {
19 | this.elasticsearchRestTemplate = elasticsearchRestTemplate;
20 | }
21 |
22 | @Override
23 | public void initElasticSearch() {
24 | // 判断索引是否存在
25 | try {
26 | if (!elasticsearchRestTemplate.indexOps(NotesEsDO.class).exists()) {
27 | // 创建索引
28 | elasticsearchRestTemplate.indexOps(NotesEsDO.class).create();
29 | // 创建映射
30 | elasticsearchRestTemplate.indexOps(NotesEsDO.class).putMapping();
31 | }
32 | } catch (Exception e) {
33 | throw new SystemException(ExceptionMsgEnum.ELASTICSEARCH_INIT_ERROR, e);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-search-server/src/main/java/com/yyh/xfs/search/consumer/notes/NotesUpdateEsConsumer.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.search.consumer.notes;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import com.yyh.xfs.common.constant.RocketMQConsumerGroupConstant;
5 | import com.yyh.xfs.common.constant.RocketMQTopicConstant;
6 | import com.yyh.xfs.notes.domain.NotesDO;
7 | import com.yyh.xfs.search.service.NotesSearchService;
8 | import lombok.extern.slf4j.Slf4j;
9 | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
10 | import org.apache.rocketmq.spring.core.RocketMQListener;
11 | import org.springframework.beans.factory.annotation.Autowired;
12 | import org.springframework.stereotype.Component;
13 |
14 | /**
15 | * @author yyh
16 | * @date 2024-02-17
17 | */
18 | @Component
19 | @Slf4j
20 | @RocketMQMessageListener(topic = RocketMQTopicConstant.NOTES_UPDATE_ES_TOPIC,
21 | consumerGroup = RocketMQConsumerGroupConstant.NOTES_UPDATE_ES_CONSUMER_GROUP)
22 | public class NotesUpdateEsConsumer implements RocketMQListener {
23 |
24 | private final NotesSearchService notesSearchService;
25 |
26 | public NotesUpdateEsConsumer(NotesSearchService notesSearchService) {
27 | this.notesSearchService = notesSearchService;
28 | }
29 |
30 | @Override
31 | public void onMessage(String s) {
32 | log.info("收到消息:{}", s);
33 | NotesDO notesDO = JSON.parseObject(s, NotesDO.class);
34 | log.info("notesDO:{}", notesDO);
35 | notesSearchService.updateNotes(notesDO);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-im-server/src/main/java/com/yyh/xfs/im/initialzer/IMServerInitialzer.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.im.initialzer;
2 |
3 | import com.yyh.xfs.im.handler.IMServerHandler;
4 | import io.netty.channel.ChannelInitializer;
5 | import io.netty.channel.ChannelPipeline;
6 | import io.netty.channel.socket.SocketChannel;
7 | import io.netty.handler.codec.http.HttpObjectAggregator;
8 | import io.netty.handler.codec.http.HttpServerCodec;
9 | import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler;
10 | import io.netty.handler.stream.ChunkedWriteHandler;
11 | import io.netty.handler.timeout.IdleStateHandler;
12 | import org.springframework.stereotype.Component;
13 |
14 | /**
15 | * @author yyh
16 | * @date 2023-12-24
17 | */
18 | @Component
19 | public class IMServerInitialzer extends ChannelInitializer {
20 | private final IMServerHandler imServerHandler;
21 |
22 | public IMServerInitialzer(IMServerHandler imServerHandler) {
23 | this.imServerHandler = imServerHandler;
24 | }
25 | @Override
26 | protected void initChannel(SocketChannel socketChannel) throws Exception {
27 | ChannelPipeline pipeline = socketChannel.pipeline();
28 | pipeline.addLast(new HttpServerCodec())
29 | .addLast(new ChunkedWriteHandler())
30 | .addLast(new HttpObjectAggregator(1024*64))
31 | .addLast(new WebSocketServerProtocolHandler("/ws/xfs"))
32 | .addLast(new IdleStateHandler(5, 0, 0))
33 | .addLast(imServerHandler);
34 | }
35 | }
--------------------------------------------------------------------------------
/xfs-common/common-base/src/main/java/com/yyh/xfs/common/utils/HtmlParseUtils.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.utils;
2 |
3 | import java.util.regex.Matcher;
4 | import java.util.regex.Pattern;
5 |
6 | /**
7 | * @author yyh
8 | * @date 2024-02-19
9 | */
10 | public class HtmlParseUtils {
11 |
12 | /**
13 | * 将html转换为纯文本
14 | *
15 | * @param html html
16 | * @return 纯文本
17 | */
18 | public static String htmlToText(String html) {
19 | // 移除样式、脚本、iframe标签及其内容
20 | String cleanedHtml = html.replaceAll("<(style|script|iframe)[^>]*?>[\\s\\S]+?\\1\\s*>", "");
21 | // 提取图片标签中的alt属性内容
22 | Pattern imgPattern = Pattern.compile("
]+alt=[\"']([^\"']+)[\"'][^>]*>");
23 | String textWithAlt = getString(imgPattern, cleanedHtml);
24 | // 移除其他HTML标签
25 | String textWithoutTags = textWithAlt.replaceAll("<[^>]+?>", "");
26 | // 将多个连续的空白字符替换为单个空格
27 | String textWithSingleSpace = textWithoutTags.replaceAll("\\s+", " ").trim();
28 | // 移除多余的大于号
29 | return textWithSingleSpace.replaceAll(" >", ">");
30 | }
31 |
32 | private static String getString(Pattern imgPattern, String cleanedHtml) {
33 | Matcher imgMatcher = imgPattern.matcher(cleanedHtml);
34 | StringBuffer resultBuffer = new StringBuffer();
35 | while (imgMatcher.find()) {
36 | imgMatcher.appendReplacement(resultBuffer, " " + imgMatcher.group(1) + " ");
37 | }
38 | imgMatcher.appendTail(resultBuffer);
39 | return resultBuffer.toString();
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-search-server/src/main/java/com/yyh/xfs/search/controller/UserSearchController.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.search.controller;
2 |
3 | import com.yyh.xfs.common.domain.Result;
4 | import com.yyh.xfs.common.myEnum.ExceptionMsgEnum;
5 | import com.yyh.xfs.common.web.exception.BusinessException;
6 | import com.yyh.xfs.search.domain.UserEsDO;
7 | import com.yyh.xfs.search.service.UserSearchService;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.web.bind.annotation.GetMapping;
10 | import org.springframework.web.bind.annotation.RequestMapping;
11 | import org.springframework.web.bind.annotation.RestController;
12 |
13 | import java.util.List;
14 |
15 | /**
16 | * @author yyh
17 | * @date 2024-02-21
18 | */
19 | @RestController
20 | @RequestMapping("/search/user")
21 | public class UserSearchController {
22 | private final UserSearchService userSearchService;
23 |
24 | public UserSearchController(UserSearchService userSearchService) {
25 | this.userSearchService = userSearchService;
26 | }
27 |
28 | @GetMapping("/getUser")
29 | public Result> getUser(String keyword, Integer page, Integer pageSize){
30 | if (page == null || pageSize == null) {
31 | throw new BusinessException(ExceptionMsgEnum.PARAMETER_ERROR);
32 | }
33 | if (page < 1) {
34 | page = 1;
35 | }
36 | if (pageSize < 1) {
37 | pageSize = 10;
38 | }
39 | return userSearchService.getUser(keyword, page, pageSize);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/xfs-modules-api/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.example
8 | xiaofanshu
9 | 1.0-SNAPSHOT
10 |
11 |
12 | xfs-modules-api
13 | pom
14 |
15 | xfs-user-api
16 | xfs-im-api
17 | xfs-notes-api
18 | xfs-search-api
19 | xfs-comment-api
20 |
21 |
22 |
23 | 8
24 | 8
25 | UTF-8
26 |
27 |
28 |
29 |
30 | org.example
31 | common-base
32 | 1.0-SNAPSHOT
33 |
34 |
35 | com.github.xiaoymin
36 | knife4j-openapi2-spring-boot-starter
37 | ${knife4j.version}
38 |
39 |
40 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-search-server/src/main/java/com/yyh/xfs/search/config/EsConfig.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.search.config;
2 |
3 | import org.springframework.context.annotation.Configuration;
4 | import org.springframework.core.annotation.AnnotationUtils;
5 | import org.springframework.data.elasticsearch.annotations.Document;
6 | import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
7 | import org.springframework.data.elasticsearch.core.IndexOperations;
8 | import org.springframework.data.util.AnnotatedTypeScanner;
9 |
10 | import javax.annotation.PostConstruct;
11 |
12 | /**
13 | * @author yyh
14 | * @date 2024-02-19
15 | */
16 | @Configuration
17 | public class EsConfig {
18 | private final ElasticsearchRestTemplate elasticsearchRestTemplate;
19 |
20 | public EsConfig(ElasticsearchRestTemplate elasticsearchRestTemplate) {
21 | this.elasticsearchRestTemplate = elasticsearchRestTemplate;
22 | }
23 |
24 | @PostConstruct
25 | public void createIndex() {
26 | AnnotatedTypeScanner scanner = new AnnotatedTypeScanner(false, Document.class);
27 | for (Class clazz : scanner.findTypes("com.yyh.xfs.search.domain")) {
28 | Document doc = AnnotationUtils.findAnnotation(clazz, Document.class);
29 | assert doc != null;
30 | IndexOperations ops = elasticsearchRestTemplate.indexOps(clazz);
31 | if (!ops.exists()) {
32 | ops.create();
33 | ops.refresh();
34 | ops.putMapping(ops.createMapping());
35 | }
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-search-server/src/main/java/com/yyh/xfs/search/consumer/notes/NotesUpdateCountConsumer.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.search.consumer.notes;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import com.yyh.xfs.common.constant.RocketMQConsumerGroupConstant;
5 | import com.yyh.xfs.common.constant.RocketMQTopicConstant;
6 | import com.yyh.xfs.search.service.NotesSearchService;
7 | import lombok.extern.slf4j.Slf4j;
8 | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
9 | import org.apache.rocketmq.spring.core.RocketMQListener;
10 | import org.springframework.stereotype.Component;
11 |
12 | import java.util.Map;
13 |
14 | /**
15 | * @author yyh
16 | * @date 2024-02-19
17 | */
18 | @Component
19 | @Slf4j
20 | @RocketMQMessageListener(topic = RocketMQTopicConstant.NOTES_UPDATE_COUNT_TOPIC,
21 | consumerGroup = RocketMQConsumerGroupConstant.NOTES_UPDATE_COUNT_CONSUMER_GROUP)
22 | public class NotesUpdateCountConsumer implements RocketMQListener {
23 | private final NotesSearchService notesSearchService;
24 |
25 | public NotesUpdateCountConsumer(NotesSearchService notesSearchService) {
26 | this.notesSearchService = notesSearchService;
27 | }
28 |
29 | @Override
30 | public void onMessage(String message) {
31 | log.info("notes-update-count-topic receive message:{}", message);
32 | Map map = JSON.parseObject(message, Map.class);
33 | log.info("notesId:{},notesLikeNum:{},type:{}", map.get("notesId"), map.get("notesLikeNum"), map.get("type"));
34 | notesSearchService.updateCount(map);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/xfs-common/common-redis/src/main/java/com/yyh/xfs/common/redis/config/RedissonConfig.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.redis.config;
2 |
3 | import com.yyh.xfs.common.redis.properties.RedisProperties;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.redisson.Redisson;
6 | import org.redisson.api.RedissonClient;
7 | import org.redisson.config.Config;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.context.annotation.Bean;
10 | import org.springframework.context.annotation.Configuration;
11 |
12 | /**
13 | * @author yyh
14 | * @date 2024-02-24
15 | */
16 | @Slf4j
17 | @Configuration
18 | public class RedissonConfig {
19 |
20 | private static RedisProperties redisProperties;
21 |
22 | @Autowired
23 | private void setRedisProperties(RedisProperties redisProperties) {
24 | RedissonConfig.redisProperties = redisProperties;
25 | }
26 |
27 | @Bean
28 | public RedissonClient redissonClient() {
29 | RedissonClient redissonClient;
30 | Config config = new Config();
31 | //starter依赖进来的redisson要以redis://开头,其他不用
32 | String url = "redis://"+ redisProperties.getHost() + ":" + redisProperties.getPort();
33 | config.useSingleServer().setAddress(url)
34 | .setDatabase(redisProperties.getDatabase());
35 |
36 | try {
37 | redissonClient = Redisson.create(config);
38 | return redissonClient;
39 | } catch (Exception e) {
40 | log.error("RedissonClient init redis url:[{}], Exception:", url, e);
41 | return null;
42 | }
43 | }
44 |
45 | }
--------------------------------------------------------------------------------
/xfs-modules-api/xfs-comment-api/src/main/java/com/yyh/xfs/comment/domain/CommentDO.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.comment.domain;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 | import org.springframework.data.annotation.Id;
7 | import org.springframework.data.mongodb.core.mapping.Document;
8 |
9 | import java.io.Serializable;
10 |
11 | /**
12 | * @author yyh
13 | * @date 2024-02-05
14 | */
15 | @Data
16 | @AllArgsConstructor
17 | @NoArgsConstructor
18 | @Document(value = "comment")
19 | public class CommentDO implements Serializable {
20 |
21 | @Id
22 | private String id;
23 | /**
24 | * 评论内容
25 | */
26 | private String content;
27 |
28 | /**
29 | * 评论者id
30 | */
31 | private Long commentUserId;
32 |
33 | /**
34 | * 评论者省份
35 | */
36 | private String province;
37 |
38 | /**
39 | * 评论父级id,如果是一级评论则为0
40 | */
41 | private String parentId;
42 |
43 | /**
44 | * 评论回复者id
45 | */
46 | private Long replyUserId;
47 |
48 | /**
49 | * 评论回复者名称
50 | */
51 | private String replyUserName;
52 |
53 | /**
54 | * 评论图片
55 | */
56 | private String pictureUrl;
57 |
58 | /**
59 | * 评论点赞数
60 | */
61 | private Integer commentLikeNum;
62 |
63 | /**
64 | * 评论所属笔记id
65 | */
66 | private Long notesId;
67 |
68 | /**
69 | * 是否为置顶评论
70 | */
71 | private Boolean isTop;
72 |
73 | /**
74 | * 是否为热门评论,前10条赞数最多的为热门评论,超过10条则按时间排序
75 | */
76 | private Boolean isHot;
77 | /**
78 | * 评论时间
79 | */
80 | private Long createTime;
81 | }
82 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-user-server/src/main/java/com/yyh/xfs/user/config/UserConfig.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.user.config;
2 |
3 | import com.yyh.xfs.common.redis.constant.BloomFilterMap;
4 | import com.yyh.xfs.common.redis.utils.BloomFilterUtils;
5 | import com.yyh.xfs.user.mapper.UserMapper;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.context.annotation.Configuration;
8 |
9 | import javax.annotation.PostConstruct;
10 | import java.util.List;
11 | import java.util.stream.Collectors;
12 |
13 | /**
14 | * @author yyh
15 | * @date 2024-02-24
16 | */
17 | @Configuration
18 | public class UserConfig {
19 | private final UserMapper userMapper;
20 | private final BloomFilterUtils bloomFilterUtils;
21 |
22 | public UserConfig(UserMapper userMapper, BloomFilterUtils bloomFilterUtils) {
23 | this.userMapper = userMapper;
24 | this.bloomFilterUtils = bloomFilterUtils;
25 | }
26 |
27 | /**
28 | * 初始化布隆过滤器
29 | */
30 | @PostConstruct
31 | public void initBloomFilter() {
32 | List list = userMapper.selectList(null).stream().map(userDO -> String.valueOf(userDO.getId())).collect(Collectors.toList());
33 | // 先判断有没有该布隆过滤器,没有则初始化
34 | long bloomFilterSize = bloomFilterUtils.getBloomFilterSize(BloomFilterMap.USER_ID_BLOOM_FILTER);
35 | if(bloomFilterSize==list.size()){
36 | return;
37 | }
38 | bloomFilterUtils.initBloomFilter(BloomFilterMap.USER_ID_BLOOM_FILTER, list.isEmpty() ? 10000 : list.size() * 4L, 0.01);
39 | bloomFilterUtils.addAllBloomFilter(BloomFilterMap.USER_ID_BLOOM_FILTER, list);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/xfs-job-server/src/main/java/com/yyh/xfs/job/mapper/notes/NotesMapper.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.job.mapper.notes;
2 |
3 | import com.yyh.xfs.notes.domain.UserCollectNotesDO;
4 | import com.yyh.xfs.notes.domain.UserLikeNotesDO;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * 笔记mapper
10 | * @author yyh
11 | * @date 2023-12-23
12 | */
13 | public interface NotesMapper {
14 | /**
15 | * 更新笔记点赞数
16 | * @param notesId 笔记id
17 | * @param likeNum 点赞数
18 | */
19 | boolean updateNotesLikeNum(Long notesId, Integer likeNum);
20 |
21 | /**
22 | * 更新笔记收藏数
23 | * @param notesId 笔记id
24 | * @param collectNum 收藏数
25 | */
26 | boolean updateNotesCollectionNum(Long notesId, Integer collectNum);
27 |
28 | /**
29 | * 插入用户点赞笔记
30 | * @param userLikeNotesDO 用户点赞笔记
31 | */
32 | boolean insertUserLikeNotes(UserLikeNotesDO userLikeNotesDO);
33 |
34 | /**
35 | * 删除用户点赞笔记
36 | * @param userLikeNotesDO 用户点赞笔记
37 | */
38 | void deleteUserLikeNotes(UserLikeNotesDO userLikeNotesDO);
39 |
40 | /**
41 | * 插入用户收藏笔记
42 | * @param userCollectNotesDO 用户收藏笔记
43 | */
44 | boolean insertUserCollectNotes(UserCollectNotesDO userCollectNotesDO);
45 |
46 | /**
47 | * 删除用户收藏笔记
48 | * @param userCollectNotesDO 用户收藏笔记
49 | */
50 | void deleteUserCollectNotes(UserCollectNotesDO userCollectNotesDO);
51 |
52 | /**
53 | * 更新笔记浏览数
54 | * @param notesId 笔记id
55 | * @param viewNum 浏览数
56 | */
57 | boolean updateNotesViewNum(Long notesId, Integer viewNum);
58 |
59 | /**
60 | * 获取所有笔记id
61 | */
62 | List getAllNotesId();
63 | }
64 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/java/com/yyh/xfs/notes/config/NotesConfig.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.config;
2 |
3 | import com.yyh.xfs.common.redis.constant.BloomFilterMap;
4 | import com.yyh.xfs.common.redis.utils.BloomFilterUtils;
5 | import com.yyh.xfs.notes.domain.NotesDO;
6 | import com.yyh.xfs.notes.mapper.NotesMapper;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.context.annotation.Configuration;
9 |
10 | import javax.annotation.PostConstruct;
11 | import java.util.List;
12 | import java.util.stream.Collectors;
13 |
14 | /**
15 | * @author yyh
16 | * @date 2024-02-24
17 | */
18 | @Configuration
19 | public class NotesConfig {
20 |
21 | private final BloomFilterUtils bloomFilterUtils;
22 |
23 | private final NotesMapper notesMapper;
24 |
25 | public NotesConfig(BloomFilterUtils bloomFilterUtils, NotesMapper notesMapper) {
26 | this.bloomFilterUtils = bloomFilterUtils;
27 | this.notesMapper = notesMapper;
28 | }
29 |
30 | /**
31 | * 初始化布隆过滤器
32 | */
33 | @PostConstruct
34 | public void initBloomFilter() {
35 | List list = notesMapper.selectList(null).stream().map(notesDO -> String.valueOf(notesDO.getId())).collect(Collectors.toList());
36 | // 先判断有没有该布隆过滤器,没有则初始化
37 | long bloomFilterSize = bloomFilterUtils.getBloomFilterSize(BloomFilterMap.NOTES_ID_BLOOM_FILTER);
38 | if(bloomFilterSize==list.size()){
39 | return;
40 | }
41 | bloomFilterUtils.initBloomFilter(BloomFilterMap.NOTES_ID_BLOOM_FILTER, list.isEmpty() ? 10000 : list.size() * 4L, 0.01);
42 | bloomFilterUtils.addAllBloomFilter(BloomFilterMap.NOTES_ID_BLOOM_FILTER, list);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/xfs-common/common-web/src/main/java/com/yyh/xfs/common/web/exception/handler/GlobalExceptionHandler.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.common.web.exception.handler;
2 |
3 | import com.yyh.xfs.common.domain.Result;
4 | import com.yyh.xfs.common.web.exception.BusinessException;
5 | import com.yyh.xfs.common.web.exception.OnlyWarnException;
6 | import com.yyh.xfs.common.web.exception.SystemException;
7 | import lombok.extern.slf4j.Slf4j;
8 | import org.springframework.web.bind.annotation.ExceptionHandler;
9 | import org.springframework.web.bind.annotation.RestControllerAdvice;
10 | /**
11 | * @author yyh
12 | * @date 2023-12-15
13 | */
14 | @Slf4j
15 | @RestControllerAdvice
16 | public class GlobalExceptionHandler {
17 |
18 | @ExceptionHandler(BusinessException.class)
19 | public Result> handleAuthException(BusinessException businessException){
20 | log.error("业务异常:{}",businessException.getExceptionMsgEnum());
21 | return new Result<>(
22 | businessException.getExceptionMsgEnum().getCode(),
23 | businessException.getExceptionMsgEnum().getMsg(),
24 | null);
25 | }
26 |
27 | @ExceptionHandler(SystemException.class)
28 | public Result> handleAuthException(SystemException systemException){
29 | log.error("系统异常状态:{};系统异常:",systemException.getExceptionMsgEnum(),systemException);
30 | return new Result<>(
31 | systemException.getExceptionMsgEnum().getCode(),
32 | systemException.getExceptionMsgEnum().getMsg(),
33 | null);
34 | }
35 | @ExceptionHandler(OnlyWarnException.class)
36 | public void handleAuthException(OnlyWarnException onlyWarnException){
37 | log.warn("警告异常:{};异常信息:",onlyWarnException.getExceptionMsgEnum(),onlyWarnException);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/xfs-common/common-redis/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.example
8 | xfs-common
9 | 1.0-SNAPSHOT
10 |
11 |
12 | common-redis
13 |
14 |
15 | 8
16 | 8
17 | UTF-8
18 |
19 |
20 |
21 |
22 | org.springframework.boot
23 | spring-boot-starter-data-redis
24 |
25 |
26 | org.redisson
27 | redisson-spring-boot-starter
28 | 3.16.2
29 |
30 |
31 | com.fasterxml.jackson.core
32 | jackson-databind
33 |
34 |
35 | com.fasterxml.jackson.core
36 | jackson-annotations
37 |
38 |
39 | org.projectlombok
40 | lombok
41 | provided
42 |
43 |
44 |
--------------------------------------------------------------------------------
/xfs-common/common-base/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.example
8 | xfs-common
9 | 1.0-SNAPSHOT
10 |
11 |
12 | common-base
13 |
14 |
15 | 8
16 | 8
17 | UTF-8
18 |
19 |
20 |
21 |
22 | org.projectlombok
23 | lombok
24 |
25 |
26 | commons-codec
27 | commons-codec
28 |
29 |
30 | cn.hutool
31 | hutool-http
32 |
33 |
34 | com.alibaba
35 | fastjson
36 |
37 |
38 | com.fasterxml.jackson.core
39 | jackson-databind
40 |
41 |
42 | com.fasterxml.jackson.core
43 | jackson-annotations
44 |
45 |
46 |
--------------------------------------------------------------------------------
/.idea/ProjectStorage.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/xfs-modules-server/xfs-notes-server/src/main/java/com/yyh/xfs/notes/service/NotesService.java:
--------------------------------------------------------------------------------
1 | package com.yyh.xfs.notes.service;
2 |
3 | import com.baomidou.mybatisplus.extension.service.IService;
4 | import com.yyh.xfs.common.domain.PageParam;
5 | import com.yyh.xfs.common.domain.Result;
6 | import com.yyh.xfs.notes.domain.NotesDO;
7 | import com.yyh.xfs.notes.vo.NotesPageVO;
8 | import com.yyh.xfs.notes.vo.NotesPublishVO;
9 | import com.yyh.xfs.notes.vo.NotesVO;
10 |
11 | import java.util.Map;
12 |
13 | /**
14 | * @author yyh
15 | * @date 2024-01-19
16 | */
17 | public interface NotesService extends IService {
18 | Result> addNotes(NotesPublishVO notesPublishVO);
19 |
20 | Result getLastNotesByPage(Integer page, Integer pageSize);
21 |
22 | Result> initNotesLike(Long notesId);
23 |
24 | Result> initNotesCollect(Long notesId);
25 |
26 | Result getNotesByUserId(Integer page, Integer pageSize, Integer authority, Integer type);
27 |
28 | Result getNotesByNotesId(Long notesId);
29 |
30 | Result> praiseNotes(Long notesId, Long userId, Long targetUserId);
31 |
32 | Result> collectNotes(Long notesId, Long userId, Long targetUserId);
33 |
34 | Result> viewNotes(Long notesId);
35 |
36 | Result> updateNotes(NotesPublishVO notesPublishVO);
37 |
38 | Result> deleteNotes(Long notesId);
39 |
40 | Result> changeNotesAuthority(Long notesId, Integer authority);
41 |
42 | Result