Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦境迷离
Sim
提交
b62d72dd
S
Sim
项目概览
梦境迷离
/
Sim
9 个月 前同步成功
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Sim
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b62d72dd
编写于
11月 26, 2021
作者:
梦境迷离
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
使用宏工具scala-macro-tools
上级
e76d0450
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
164 addition
and
196 deletion
+164
-196
build.gradle
build.gradle
+9
-1
src/main/scala/io/github/dreamylost/config/Swagger2Config.scala
...in/scala/io/github/dreamylost/config/Swagger2Config.scala
+1
-1
src/main/scala/io/github/dreamylost/constant/SystemConstant.scala
.../scala/io/github/dreamylost/constant/SystemConstant.scala
+1
-1
src/main/scala/io/github/dreamylost/controller/UserController.scala
...cala/io/github/dreamylost/controller/UserController.scala
+6
-5
src/main/scala/io/github/dreamylost/model/FriendAndGroupInfo.scala
...scala/io/github/dreamylost/model/FriendAndGroupInfo.scala
+18
-0
src/main/scala/io/github/dreamylost/model/Group.scala
src/main/scala/io/github/dreamylost/model/Group.scala
+13
-0
src/main/scala/io/github/dreamylost/model/Mine.scala
src/main/scala/io/github/dreamylost/model/Mine.scala
+11
-0
src/main/scala/io/github/dreamylost/model/To.scala
src/main/scala/io/github/dreamylost/model/To.scala
+19
-0
src/main/scala/io/github/dreamylost/model/domains.scala
src/main/scala/io/github/dreamylost/model/domains.scala
+27
-78
src/main/scala/io/github/dreamylost/model/entities.scala
src/main/scala/io/github/dreamylost/model/entities.scala
+25
-67
src/main/scala/io/github/dreamylost/model/package.scala
src/main/scala/io/github/dreamylost/model/package.scala
+0
-25
src/main/scala/io/github/dreamylost/repository/UserRepository.scala
...cala/io/github/dreamylost/repository/UserRepository.scala
+9
-9
src/main/scala/io/github/dreamylost/service/CookieService.scala
...in/scala/io/github/dreamylost/service/CookieService.scala
+1
-1
src/main/scala/io/github/dreamylost/service/UserService.scala
...main/scala/io/github/dreamylost/service/UserService.scala
+2
-2
src/main/scala/io/github/dreamylost/websocket/Protocols.scala
...main/scala/io/github/dreamylost/websocket/Protocols.scala
+1
-1
src/main/scala/io/github/dreamylost/websocket/WebSocketService.scala
...ala/io/github/dreamylost/websocket/WebSocketService.scala
+5
-5
src/test/scala/io/github/dreamylost/test/JavaCompatibleSpec.scala
.../scala/io/github/dreamylost/test/JavaCompatibleSpec.scala
+16
-0
未找到文件。
build.gradle
浏览文件 @
b62d72dd
...
...
@@ -104,6 +104,9 @@ dependencies {
implementation
'com.fasterxml.jackson.module:jackson-module-scala_2.13:2.13.0'
runtimeOnly
'com.fasterxml.jackson.module:jackson-modules-java8:2.13.0'
// 自己写的的工具
implementation
'io.github.jxnu-liguobin:scala-macro-tools_2.13:0.3.2'
//test
testCompile
(
"org.springframework.boot:spring-boot-starter-test"
)
testCompile
(
"junit:junit:4.12"
)
...
...
@@ -118,4 +121,9 @@ spotless {
bootRepackage
.
enabled
=
true
mainClassName
=
"io.github.dreamylost.Application"
[
compileScala
,
compileTestScala
]*.
options
*.
encoding
=
'UTF-8'
\ No newline at end of file
[
compileScala
,
compileTestScala
]*.
options
*.
encoding
=
'UTF-8'
// 宏工具必须要配置编译参数
tasks
.
withType
(
ScalaCompile
)
{
scalaCompileOptions
.
additionalParameters
=
[
"-Ymacro-annotations"
]
}
\ No newline at end of file
src/main/scala/io/github/dreamylost/config/Swagger2Config.scala
浏览文件 @
b62d72dd
...
...
@@ -33,7 +33,7 @@ class Swagger2Config {
private
lazy
val
apiInfo
:
()
=>
ApiInfo
=
()
=>
new
ApiInfoBuilder
()
// 页面标题
.
title
(
"
LayIM
"
)
.
title
(
"
Sim
"
)
// 创建人
.
description
(
"梦境迷离:https://github.com/jxnu-liguobin"
)
.
termsOfServiceUrl
(
"https://github.com/jxnu-liguobin"
)
...
...
src/main/scala/io/github/dreamylost/constant/SystemConstant.scala
浏览文件 @
b62d72dd
...
...
@@ -55,7 +55,7 @@ object SystemConstant {
final
val
ERROR_ADD_REPETITION
=
"已是好友,请勿重复添加"
//电子邮件相关
final
val
SUBJECT
=
"
LayIM
即时通讯系统邮箱激活邮件"
final
val
SUBJECT
=
"
Sim
即时通讯系统邮箱激活邮件"
//Redis Key相关
final
val
ONLINE_USER
=
"ONLINE_USER"
...
...
src/main/scala/io/github/dreamylost/controller/UserController.scala
浏览文件 @
b62d72dd
...
...
@@ -4,11 +4,11 @@ import com.github.pagehelper.PageHelper
import
io.github.dreamylost.ResultPageSet
import
io.github.dreamylost.ResultSet
import
io.github.dreamylost.constant.SystemConstant
import
io.github.dreamylost.model.domain.UserVo
import
io.github.dreamylost.model.domain._
import
io.github.dreamylost.model.entit
y
.FriendGroup
import
io.github.dreamylost.model.entit
y
.GroupList
import
io.github.dreamylost.model.entit
y
.User
import
io.github.dreamylost.model.domain
s
.UserVo
import
io.github.dreamylost.model.domain
s
._
import
io.github.dreamylost.model.entit
ies
.FriendGroup
import
io.github.dreamylost.model.entit
ies
.GroupList
import
io.github.dreamylost.model.entit
ies
.User
import
io.github.dreamylost.service.CookieService
import
io.github.dreamylost.service.UserService
import
io.github.dreamylost.util.FileUtil
...
...
@@ -22,6 +22,7 @@ import org.springframework.stereotype.Controller
import
org.springframework.ui.Model
import
org.springframework.web.bind.annotation._
import
org.springframework.web.multipart.MultipartFile
import
io.github.dreamylost.model._
import
java.util
import
javax.servlet.http.HttpServletRequest
...
...
src/main/scala/io/github/dreamylost/model/FriendAndGroupInfo.scala
0 → 100644
浏览文件 @
b62d72dd
package
io.github.dreamylost.model
import
io.github.dreamylost.JavaCompatible
import
io.github.dreamylost.model.domains.FriendList
import
io.github.dreamylost.model.entities.GroupList
import
io.github.dreamylost.model.entities.User
/** 好友和群组整个信息集
*
* @param mine 我的信息
* @param friend 好友列表
* @param group 群组信息列表
*/
@JavaCompatible
case
class
FriendAndGroupInfo
(
mine
:
User
,
friend
:
List
[
FriendList
],
group
:
List
[
GroupList
]
)
src/main/scala/io/github/dreamylost/model/Group.scala
0 → 100644
浏览文件 @
b62d72dd
package
io.github.dreamylost.model
import
scala.beans.BeanProperty
/** 群组
*
* @param id 群组id
* @param groupname 群组名
*/
@SerialVersionUID
(
1L
)
class
Group
(
@BeanProperty
val
id
:
Int
,
@BeanProperty
val
groupname
:
String
)
src/main/scala/io/github/dreamylost/model/Mine.scala
0 → 100644
浏览文件 @
b62d72dd
package
io.github.dreamylost.model
/** 我发送的消息和我的信息
*
* @param id 我的id
* @param username 我的昵称
* @param mine 是否我发的消息
* @param avatar 我的头像
* @param content 消息内容
*/
case
class
Mine
(
id
:
Int
,
username
:
String
,
mine
:
Boolean
,
avatar
:
String
,
content
:
String
)
src/main/scala/io/github/dreamylost/model/To.scala
0 → 100644
浏览文件 @
b62d72dd
package
io.github.dreamylost.model
/** 发送给...的信息
*
* @param id 对方的id
* @param username 名字
* @param sign 签名
* @param avatar 头像
* @param status 状态
* @param `type` 聊天类型,一般分friend和group两种,group即群聊
*/
case
class
To
(
id
:
Int
,
username
:
String
,
sign
:
String
,
avatar
:
String
,
status
:
String
,
`type`
:
String
)
src/main/scala/io/github/dreamylost/model/domain.scala
→
src/main/scala/io/github/dreamylost/model/domain
s
.scala
浏览文件 @
b62d72dd
package
io.github.dreamylost.model
import
io.github.dreamylost.model.entity.GroupList
import
io.github.dreamylost.model.entity.User
import
scala.beans.BeanProperty
import
io.github.dreamylost.model.entities.User
import
io.github.dreamylost.JavaCompatible
/** @author 梦境迷离
* @since 2021/11/21
* @version 1.0
*/
object
domain
{
/** 我发送的消息和我的信息
*
* @param id 我的id
* @param username 我的昵称
* @param mine 是否我发的消息
* @param avatar 我的头像
* @param content 消息内容
*/
case
class
Mine
(
id
:
Int
,
username
:
String
,
mine
:
Boolean
,
avatar
:
String
,
content
:
String
)
/** 发送给...的信息
*
* @param id 对方的id
* @param username 名字
* @param sign 签名
* @param avatar 头像
* @param status 状态
* @param `type` 聊天类型,一般分friend和group两种,group即群聊
*/
case
class
To
(
id
:
Int
,
username
:
String
,
sign
:
String
,
avatar
:
String
,
status
:
String
,
`type`
:
String
)
object
domains
{
/** 聊天记录
*
...
...
@@ -47,24 +17,12 @@ object domain {
* @param content 消息内容
* @param timestamp 时间
*/
case
class
ChatHistory
(
@BeanProperty
id
:
Int
,
@BeanProperty
username
:
String
,
@BeanProperty
avatar
:
String
,
@BeanProperty
content
:
String
,
@BeanProperty
timestamp
:
Long
)
/** 好友和群组整个信息集
*
* @param mine 我的信息
* @param friend 好友列表
* @param group 群组信息列表
*/
case
class
FriendAndGroupInfo
(
@BeanProperty
mine
:
User
,
@BeanProperty
friend
:
List
[
FriendList
],
@BeanProperty
group
:
List
[
GroupList
]
@JavaCompatible
case
class
ChatHistory
(
id
:
Int
,
username
:
String
,
avatar
:
String
,
content
:
String
,
timestamp
:
Long
)
/** 好友列表
...
...
@@ -77,15 +35,11 @@ object domain {
* @param groupname 列表名称
* @param list 用户列表
*/
case
class
FriendList
(
@BeanProperty
override
val
id
:
Int
,
@BeanProperty
override
val
groupname
:
String
,
@BeanProperty
list
:
java.util.List
[
User
]
)
extends
Group
(
id
,
groupname
)
{
def
this
()
=
{
this
(
0
,
null
,
null
)
}
}
@JavaCompatible
case
class
FriendList
(
override
val
id
:
Int
,
override
val
groupname
:
String
,
list
:
java.util.List
[
User
]
// 使用@JavaCompatible注解时,嵌套对象User不能定义在同一个object中
)
extends
Group
(
id
,
groupname
)
/** 返回个人信息更新
*
...
...
@@ -136,24 +90,19 @@ object domain {
* @param time 时间
* @param user 消息发送者
*/
case
class
AddInfo
(
@BeanProperty
id
:
Int
,
@BeanProperty
uid
:
Int
,
@BeanProperty
content
:
String
,
@BeanProperty
from
:
Int
,
@BeanProperty
from_group
:
Int
,
@BeanProperty
`type`
:
Int
,
@BeanProperty
remark
:
String
,
@BeanProperty
href
:
String
,
@BeanProperty
read
:
Int
,
@BeanProperty
time
:
String
,
@BeanProperty
user
:
User
)
{
// TODO mybatis用的类都需要无参构造
def
this
()
{
this
(
0
,
0
,
null
,
0
,
0
,
0
,
null
,
null
,
0
,
null
,
null
)
}
}
@JavaCompatible
case
class
AddInfo
(
id
:
Int
,
uid
:
Int
,
content
:
String
,
from
:
Int
,
from_group
:
Int
,
`type`
:
Int
,
remark
:
String
,
href
:
String
,
read
:
Int
,
time
:
String
,
user
:
User
)
/** 收到的消息
*
...
...
src/main/scala/io/github/dreamylost/model/entit
y
.scala
→
src/main/scala/io/github/dreamylost/model/entit
ies
.scala
浏览文件 @
b62d72dd
package
io.github.dreamylost.model
import
io.github.dreamylost.model.domain.Mine
import
io.github.dreamylost.model.domain.To
import
io.github.dreamylost.JavaCompatible
import
java.util.Date
import
scala.beans.BeanProperty
/** @author 梦境迷离
* @since 2021/11/21
* @version 1.0
*/
object
entit
y
{
object
entit
ies
{
/** 用户
*
...
...
@@ -26,35 +24,18 @@ object entity {
* @param status 状态
* @param active 激活码
*/
case
class
User
(
@BeanProperty
id
:
Int
,
@BeanProperty
username
:
String
,
@BeanProperty
password
:
String
,
@BeanProperty
sign
:
String
,
@BeanProperty
avatar
:
String
,
@BeanProperty
email
:
String
,
@BeanProperty
createDate
:
Date
,
@BeanProperty
sex
:
Int
,
@BeanProperty
status
:
String
,
@BeanProperty
active
:
String
)
{
// mybatis 使用
def
this
()
=
{
this
(
id
=
0
,
username
=
null
,
password
=
null
,
sign
=
null
,
avatar
=
null
,
email
=
null
,
createDate
=
null
,
sex
=
0
,
status
=
null
,
active
=
null
)
}
}
@JavaCompatible
case
class
User
(
id
:
Int
,
username
:
String
,
password
:
String
,
sign
:
String
,
avatar
:
String
,
email
:
String
,
createDate
:
Date
,
sex
:
Int
,
status
:
String
,
active
:
String
)
object
User
{
def
apply
(
id
:
Int
,
status
:
String
)
:
User
=
...
...
@@ -84,7 +65,7 @@ object entity {
* @param `type` 类型,可能是添加好友或群组
* @param time 申请时间
*/
case
class
AddMessage
(
@JavaCompatible
case
class
AddMessage
(
id
:
Int
,
fromUid
:
Int
,
toUid
:
Int
,
...
...
@@ -93,13 +74,7 @@ object entity {
agree
:
Int
,
`type`
:
Int
,
time
:
Date
)
{
def
this
()
=
{
this
(
0
,
0
,
0
,
0
,
null
,
0
,
0
,
null
)
}
}
)
object
AddMessage
{
def
apply
(
id
:
Int
,
agree
:
Int
)
:
AddMessage
=
...
...
@@ -131,11 +106,7 @@ object entity {
* @param uid 用户id,该分组所属的用户ID
* @param groupname 群组名称
*/
case
class
FriendGroup
(
uid
:
Int
,
groupname
:
String
)
{
def
this
()
=
{
this
(
0
,
null
)
}
}
@JavaCompatible
case
class
FriendGroup
(
uid
:
Int
,
groupname
:
String
)
/** 群组信息
*
...
...
@@ -145,17 +116,12 @@ object entity {
* @param avatar 头像
* @param createId 创建人ID
*/
case
class
GroupList
(
@BeanProperty
override
val
id
:
Int
,
@BeanProperty
override
val
groupname
:
String
,
@BeanProperty
avatar
:
String
,
@BeanProperty
createId
:
Int
)
extends
Group
(
id
,
groupname
)
{
def
this
()
=
{
this
(
0
,
null
,
null
,
0
)
}
}
@JavaCompatible
case
class
GroupList
(
override
val
id
:
Int
,
override
val
groupname
:
String
,
avatar
:
String
,
createId
:
Int
)
extends
Group
(
id
,
groupname
)
/** 群组成员
*
...
...
@@ -163,11 +129,7 @@ object entity {
* @param gid 群组编号
* @param uid 用户编号
*/
case
class
GroupMember
(
gid
:
Int
,
uid
:
Int
)
{
def
this
()
=
{
this
(
0
,
0
)
}
}
@JavaCompatible
case
class
GroupMember
(
gid
:
Int
,
uid
:
Int
)
/** 消息
*
...
...
@@ -177,10 +139,6 @@ object entity {
* @param to 对方信息
* @param msg 额外的信息
*/
case
class
Message
(
`type`
:
String
,
mine
:
Mine
,
to
:
To
,
msg
:
String
)
{
def
this
()
=
{
this
(
null
,
null
,
null
,
null
)
}
}
@JavaCompatible
case
class
Message
(
`type`
:
String
,
mine
:
Mine
,
to
:
To
,
msg
:
String
)
}
src/main/scala/io/github/dreamylost/model/package.scala
已删除
100644 → 0
浏览文件 @
e76d0450
package
io.github.dreamylost
import
scala.beans.BeanProperty
/** @author 梦境迷离
* @since 2021/11/24
* @version 1.0
*/
package
object
model
{
/** 群组
*
* @param id 群组id
* @param groupname 群组名
*/
@SerialVersionUID
(
1L
)
class
Group
(
@BeanProperty
val
id
:
Int
,
@BeanProperty
val
groupname
:
String
)
{
def
this
()
=
{
this
(
0
,
null
)
}
}
}
src/main/scala/io/github/dreamylost/repository/UserRepository.scala
浏览文件 @
b62d72dd
package
io.github.dreamylost.repository
import
io.github.dreamylost.model.domain.AddFriends
import
io.github.dreamylost.model.domain.AddInfo
import
io.github.dreamylost.model.domain.FriendList
import
io.github.dreamylost.model.domain.Receive
import
io.github.dreamylost.model.entit
y
.AddMessage
import
io.github.dreamylost.model.entit
y
.FriendGroup
import
io.github.dreamylost.model.entit
y
.GroupList
import
io.github.dreamylost.model.entit
y
.GroupMember
import
io.github.dreamylost.model.entit
y
.User
import
io.github.dreamylost.model.domain
s
.AddFriends
import
io.github.dreamylost.model.domain
s
.AddInfo
import
io.github.dreamylost.model.domain
s
.FriendList
import
io.github.dreamylost.model.domain
s
.Receive
import
io.github.dreamylost.model.entit
ies
.AddMessage
import
io.github.dreamylost.model.entit
ies
.FriendGroup
import
io.github.dreamylost.model.entit
ies
.GroupList
import
io.github.dreamylost.model.entit
ies
.GroupMember
import
io.github.dreamylost.model.entit
ies
.User
import
org.apache.ibatis.annotations._
import
java.util
...
...
src/main/scala/io/github/dreamylost/service/CookieService.scala
浏览文件 @
b62d72dd
package
io.github.dreamylost.service
import
io.github.dreamylost.model.entit
y
.User
import
io.github.dreamylost.model.entit
ies
.User
import
org.slf4j.Logger
import
org.slf4j.LoggerFactory
import
org.springframework.stereotype.Service
...
...
src/main/scala/io/github/dreamylost/service/UserService.scala
浏览文件 @
b62d72dd
package
io.github.dreamylost.service
import
io.github.dreamylost.constant.SystemConstant
import
io.github.dreamylost.model.domain._
import
io.github.dreamylost.model.entit
y
._
import
io.github.dreamylost.model.domain
s
._
import
io.github.dreamylost.model.entit
ies
._
import
io.github.dreamylost.repository.UserRepository
import
io.github.dreamylost.util.DateUtil
import
io.github.dreamylost.util.SecurityUtil
...
...
src/main/scala/io/github/dreamylost/websocket/Protocols.scala
浏览文件 @
b62d72dd
package
io.github.dreamylost.websocket
import
akka.actor.ActorRef
import
io.github.dreamylost.model.entit
y
.Message
import
io.github.dreamylost.model.entit
ies
.Message
import
io.github.dreamylost.util.Jackson
/** @author li.guobin@immomo.com
...
...
src/main/scala/io/github/dreamylost/websocket/WebSocketService.scala
浏览文件 @
b62d72dd
...
...
@@ -4,11 +4,11 @@ import akka.actor.ActorRef
import
com.fasterxml.jackson.databind.ObjectMapper
import
com.fasterxml.jackson.module.scala.ScalaObjectMapper
import
io.github.dreamylost.constant.SystemConstant
import
io.github.dreamylost.model.domain.Add
import
io.github.dreamylost.model.domain.Receive
import
io.github.dreamylost.model.entit
y
.AddMessage
import
io.github.dreamylost.model.entit
y
.Message
import
io.github.dreamylost.model.entit
y
.User
import
io.github.dreamylost.model.domain
s
.Add
import
io.github.dreamylost.model.domain
s
.Receive
import
io.github.dreamylost.model.entit
ies
.AddMessage
import
io.github.dreamylost.model.entit
ies
.Message
import
io.github.dreamylost.model.entit
ies
.User
import
io.github.dreamylost.service.UserService
import
io.github.dreamylost.util.DateUtil
import
org.slf4j.Logger
...
...
src/test/scala/io/github/dreamylost/test/JavaCompatibleSpec.scala
0 → 100644
浏览文件 @
b62d72dd
package
io.github.dreamylost.test
import
io.github.dreamylost.model.domains.AddInfo
/** @author li.guobin@immomo.com
* @version 1.0,2021/11/26
*/
object
JavaCompatibleSpec
extends
App
{
// 无参构造使用宏生成的,IDEA暂不支持,需要后续在scala-macro-tools插件中支持这个注解
val
addInfo
=
new
AddInfo
()
println
(
addInfo
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录