Netty+SpringBoot+FastDFS+Html5实现
Netty+SpringBoot+FastDFS+Html5实现聊天App
github链接: https://github.com/ShimmerPig/PigChat
数据库

用户表
face_image为用户的头像,需要保存小图与大图,qrcode为该用户对应的二维码

朋友关系表

好友申请表
记录发送好友请求申请的数据表

聊天记录表
sign_flag表示消息的签收状态,为0表示未签收,为1表示已签收

项目结构

utils包
1)FileUtils 主要提供了一些与文件相关的操作
2)IMoocJSONResult 是自定义的响应给前端的数据结构
3)JsonUtils 提供了一些关于json转换的操作
4)MD5Utils 提供了对字符串进行md5加密的操作
5)QRCodeUtils 提供了一些关于二维码的相关操作
6)FastDFSClient 提供了各种上传文件以及删除文件的操作
enums包
1)MsgActionEnum 发送消息的动作的枚举,类似于消息的类型
2)MsgSignFlagEnum 消息签收状态的枚举
3)OperatorFriendRequestTypeEnum 忽略或者通过好友请求的枚举
4)SearchFriendsStatusEnum 添加好友前置状态的枚举
pojo包
增加了bo包与vo包,分别存放business object与value object / view object;
mapper包
增加了一个自定义的UsersMapperCustom,在其中自定义了查询好友请求列表,查询好友列表,以及批量签收聊天消息的方法;
service包
提供如下方法:
1)queryUsernameIsExist 判断用户名是否存在
2)queryUserForLogin 查询用户是否存在
3)saveUser 用户注册
4)updateUserInfo 修改用户记录
5)preconditionSearchFriends 搜索朋友的前置条件
6)queryUserInfoByUsername 根据用户名查询用户对象
7)sendFriendRequest 添加好友请求记录,保存到数据库
8)queryFriendRequestList 查询好友请求
9)deleteFriendRequest 删除好友请求记录
10)passFriendRequest 通过好友请求
11)queryMyFriends 查询好友列表
12)saveMsg 保存聊天消息到数据库
13)updateMsgSigned 批量签收消息
14)getUnReadMsgList 获取未签收消息列表
controller包
提供如下接口:
1)registOrLogin 用户注册/登录
2)uploadFaceBase64 上传用户头像
3)setNickname 设置用户昵称
4)searchUser 搜索好友
5)addFriendRequest 发送添加好友的请求
6)queryFriendRequests 发送添加好友的请求
7)operFriendRequest 接受方通过或者忽略朋友请求
8)myFriends 查询我的好友列表
9)getUnReadMsgList 用户手机端获取未签收的消息列表
测试效果
注册与登录

个人信息

更换头像

添加好友

二维码添加好友



接受好友请求后开始聊天

