Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
街头小贩
Jforum2
提交
258c0567
J
Jforum2
项目概览
街头小贩
/
Jforum2
通知
2
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
1
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
Jforum2
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
258c0567
编写于
8月 17, 2020
作者:
街头小贩
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
重构更新
上级
6d36bf68
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
31 addition
and
28 deletion
+31
-28
core.impl/src/main/java/com/apobates/forum/core/impl/CoreAppConfig.java
...main/java/com/apobates/forum/core/impl/CoreAppConfig.java
+6
-2
core.impl/src/main/java/com/apobates/forum/core/impl/CoreModuleActionEventAspect.java
...apobates/forum/core/impl/CoreModuleActionEventAspect.java
+11
-11
core.impl/src/main/java/com/apobates/forum/core/impl/event/listener/BoardConfigListener.java
...s/forum/core/impl/event/listener/BoardConfigListener.java
+2
-4
core.impl/src/main/java/com/apobates/forum/core/impl/service/AlbumServiceImpl.java
...om/apobates/forum/core/impl/service/AlbumServiceImpl.java
+2
-3
core/src/main/java/com/apobates/forum/core/entity/BoardGroup.java
.../main/java/com/apobates/forum/core/entity/BoardGroup.java
+1
-2
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminBoardModeratorController.java
...rones/admin/controller/AdminBoardModeratorController.java
+3
-3
utils/src/main/java/com/apobates/forum/utils/cache/AbstractCubbyHole.java
...ava/com/apobates/forum/utils/cache/AbstractCubbyHole.java
+4
-2
utils/src/main/java/com/apobates/forum/utils/cache/CubbyHoleLinkedDeque.java
.../com/apobates/forum/utils/cache/CubbyHoleLinkedDeque.java
+2
-1
未找到文件。
core.impl/src/main/java/com/apobates/forum/core/impl/CoreAppConfig.java
浏览文件 @
258c0567
package
com.apobates.forum.core.impl
;
import
com.apobates.forum.core.entity.ActionEventDescriptor
;
import
com.apobates.forum.utils.cache.AbstractCubbyHole
;
import
com.apobates.forum.utils.cache.CubbyHoleLinkedDeque
;
import
com.apobates.forum.utils.cache.CubbyHoleProcessor
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
...
...
@@ -22,7 +26,7 @@ public class CoreAppConfig {
public
CoreModuleActionEventAspect
buildCmae
()
{
return
new
com
.
apobates
.
forum
.
core
.
impl
.
CoreModuleActionEventAspect
();
}
/*
@Bean
public
CubbyHoleProcessor
<
ActionEventDescriptor
>
getCubbyHoleProcessor
(){
return
new
ActionEventCubbyHoleProcessor
();
...
...
@@ -31,5 +35,5 @@ public class CoreAppConfig {
@Bean
(
"cubbyHole"
)
public
AbstractCubbyHole
<
ActionEventDescriptor
>
getCubbyHole
(
CubbyHoleProcessor
<
ActionEventDescriptor
>
cubbyHoleProcessor
){
return
new
CubbyHoleLinkedDeque
<>(
cubbyHoleProcessor
);
}
*/
}
}
\ No newline at end of file
core.impl/src/main/java/com/apobates/forum/core/impl/CoreModuleActionEventAspect.java
浏览文件 @
258c0567
package
com.apobates.forum.core.impl
;
import
com.apobates.forum.core.dao.BoardActionCollectionDao
;
import
com.apobates.forum.core.dao.BoardDao
;
import
com.apobates.forum.core.dao.PostsDao
;
import
com.apobates.forum.core.dao.TopicActionCollectionDao
;
import
com.apobates.forum.core.dao.TopicDao
;
import
com.apobates.forum.core.entity.ActionEventDescriptor
;
import
com.apobates.forum.core.entity.Board
;
import
com.apobates.forum.core.entity.BoardActionCollection
;
import
com.apobates.forum.core.entity.Posts
;
...
...
@@ -12,6 +11,7 @@ import com.apobates.forum.core.entity.Topic;
import
com.apobates.forum.core.entity.TopicActionCollection
;
import
com.apobates.forum.event.elderly.ActionEventCulpritor
;
import
com.apobates.forum.event.elderly.ForumActionEnum
;
import
com.apobates.forum.utils.cache.AbstractCubbyHole
;
import
java.util.Optional
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.annotation.AfterReturning
;
...
...
@@ -35,12 +35,12 @@ public class CoreModuleActionEventAspect {
private
TopicDao
topicDao
;
@Autowired
private
PostsDao
postsDao
;
//@Autowired
//private AbstractCubbyHole<ActionEventDescriptor> cubbyHole;
@Autowired
private
BoardActionCollectionDao
boardActionCollectionDao
;
@Autowired
private
TopicActionCollectionDao
topicActionCollectionDao
;
private
AbstractCubbyHole
<
ActionEventDescriptor
>
cubbyHole
;
//@Autowired
//private BoardActionCollectionDao boardActionCollectionDao;
//@Autowired
//private TopicActionCollectionDao topicActionCollectionDao;
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CoreModuleActionEventAspect
.
class
);
@Before
(
"execution(* com.apobates.forum.core.impl.service.*.*(..)) && @annotation(actionDescriptor)"
)
...
...
@@ -108,8 +108,8 @@ public class CoreModuleActionEventAspect {
}
else
{
entity
=
buildTopicAction
(
id
,
culpritor
,
actionDescriptor
);
}
topicActionCollectionDao
.
save
(
entity
);
//
cubbyHole.put(entity);
//
topicActionCollectionDao.save(entity);
cubbyHole
.
put
(
entity
);
}
private
TopicActionCollection
buildTopicAction
(
long
topicId
,
ActionEventCulpritor
culpritor
,
ActionDescriptor
actionDescriptor
){
...
...
@@ -150,8 +150,8 @@ public class CoreModuleActionEventAspect {
long
rodeMember
=
culpritor
.
getMemberId
();
logger
.
info
(
"[CAT]12>7.1 board id: "
+
board
.
getId
()+
", title: "
+
board
.
getTitle
());
BoardActionCollection
entity
=
new
BoardActionCollection
(
actionDescriptor
.
action
(),
board
.
getTitle
(),
primaryKey
,
culpritor
,
rodeMember
);
boardActionCollectionDao
.
save
(
entity
);
//
cubbyHole.put(entity);
//
boardActionCollectionDao.save(entity);
cubbyHole
.
put
(
entity
);
}
private
Long
getPrimaryKey
(
Object
[]
paramValues
,
String
[]
paramNames
,
String
keyName
)
{
...
...
core.impl/src/main/java/com/apobates/forum/core/impl/event/listener/BoardConfigListener.java
浏览文件 @
258c0567
...
...
@@ -4,6 +4,7 @@ import com.apobates.forum.core.dao.BoardConfigDao;
import
com.apobates.forum.core.entity.Board
;
import
com.apobates.forum.core.entity.BoardConfig
;
import
com.apobates.forum.core.impl.event.BoardCreateEvent
;
import
java.util.Optional
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -25,10 +26,7 @@ public class BoardConfigListener implements ApplicationListener<BoardCreateEvent
public
void
onApplicationEvent
(
BoardCreateEvent
event
)
{
logger
.
info
(
"[Event][Board][1]版块配置文件开始执行"
);
Board
board
=
event
.
getBoard
();
BoardConfig
boardConfig
=
event
.
getBoardConfig
();
if
(
null
==
boardConfig
)
{
boardConfig
=
BoardConfig
.
defaultConfig
(
board
.
getId
());
}
BoardConfig
boardConfig
=
Optional
.
ofNullable
(
event
.
getBoardConfig
()).
orElse
(
BoardConfig
.
defaultConfig
(
board
.
getId
()));
//版块配置
boardConfigDao
.
save
(
boardConfig
);
logger
.
info
(
"[Event][Board][2]版块配置文件执行结束"
);
...
...
core.impl/src/main/java/com/apobates/forum/core/impl/service/AlbumServiceImpl.java
浏览文件 @
258c0567
...
...
@@ -135,12 +135,11 @@ public class AlbumServiceImpl implements AlbumService{
}
@Override
public
Stream
<
Album
>
getAll
(
Set
<
Long
>
topicIdSet
,
ImageIOMeta
imageIO
,
final
String
scale
,
final
String
defaultPicture
)
{
public
Stream
<
Album
>
getAll
(
final
Set
<
Long
>
topicIdSet
,
final
ImageIOMeta
imageIO
,
final
String
scale
,
final
String
defaultPicture
)
{
if
(
null
==
topicIdSet
||
topicIdSet
.
isEmpty
())
{
return
Stream
.
empty
();
}
List
<
Long
>
topicIds
=
topicIdSet
.
stream
().
filter
(
topicId
->
topicId
>
0
).
collect
(
Collectors
.
toList
());
List
<
Album
>
abs
=
albumDao
.
findAllByTopic
(
topicIds
).
collect
(
Collectors
.
toList
());
//上传图片的路径转换
final
UploadImagePathConvert
uipc
=
new
UploadImagePathConvert
(
imageIO
.
getImageBucketDomain
(),
imageIO
.
getUploadImageDirectName
());
Consumer
<
Album
>
action
=
album
->{
...
...
@@ -156,7 +155,7 @@ public class AlbumServiceImpl implements AlbumService{
}
}
};
return
a
bs
.
stream
(
).
peek
(
action
);
return
a
lbumDao
.
findAllByTopic
(
topicIds
).
peek
(
action
);
}
@Override
...
...
core/src/main/java/com/apobates/forum/core/entity/BoardGroup.java
浏览文件 @
258c0567
...
...
@@ -166,8 +166,7 @@ public class BoardGroup implements Serializable, Comparable<BoardGroup> {
//默认版块组(卷),用于分组
@Transient
public
static
BoardGroup
defaultInstance
()
{
//getDefault
BoardGroup
bg
=
new
BoardGroup
(
"默认版块组"
,
"no description"
,
null
,
true
,
0
);
return
bg
;
return
defaultInstance
(
0
);
}
@Transient
public
static
BoardGroup
defaultInstance
(
int
ranking
)
{
//getDefault
...
...
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminBoardModeratorController.java
浏览文件 @
258c0567
...
...
@@ -112,15 +112,15 @@ public class AdminBoardModeratorController {
bm
.
setStatus
(
form
.
getBooleanStatus
());
bm
.
setLevel
(
form
.
getEnumLevel
());
boolean
symbol
;
boolean
symbol
=
false
;
String
jumpLink
=
"/board/moderator/?board="
+
bm
.
getBoardId
()
+
"&volume="
+
bm
.
getVolumesId
();
if
(
form
.
isUpdate
())
{
symbol
=
boardModeratorService
.
edit
(
form
.
getLongRecord
(),
bm
).
orElse
(
false
);
}
else
{
Member
m
=
memberService
.
get
(
bm
.
getMemberId
()).
orElse
(
Member
.
empty
(
bm
.
getMemberId
()));
Optional
<
BoardModerator
>
rObj
=
boardModeratorService
.
create
(
bm
.
getVolumesId
(),
bm
.
getBoardId
(),
m
,
bm
.
getLevel
());
symbol
=
rObj
.
isPresent
();
if
(
symbol
)
{
if
(
rObj
.
isPresent
())
{
symbol
=
true
;
jumpLink
=
"/board/moderator/permission?id="
+
rObj
.
get
().
getId
();
//进行授权
}
}
...
...
utils/src/main/java/com/apobates/forum/utils/cache/AbstractCubbyHole.java
浏览文件 @
258c0567
...
...
@@ -58,7 +58,9 @@ public abstract class AbstractCubbyHole<T> {
if
(
null
==
data
||
data
.
isEmpty
()){
return
""
;
}
String
v
=
data
.
entrySet
().
stream
().
filter
(
entry
->
!
entry
.
getKey
().
toLowerCase
().
equalsIgnoreCase
(
"id"
)
&&
Commons
.
isNotBlank
(
entry
.
getValue
().
toString
())).
map
(
entry
->
entry
.
getKey
()
+
"="
+
entry
.
getValue
()).
collect
(
Collectors
.
joining
(
","
));
return
Commons
.
md5
(
v
);
String
v
=
data
.
entrySet
().
stream
().
filter
(
entry
->
!
entry
.
getKey
().
toLowerCase
().
equalsIgnoreCase
(
"id"
)
&&
null
!=
entry
.
getValue
()
&&
Commons
.
isNotBlank
(
entry
.
getValue
().
toString
())).
map
(
entry
->
entry
.
getKey
()
+
"="
+
entry
.
getValue
()).
collect
(
Collectors
.
joining
(
","
));
String
key
=
Commons
.
md5
(
v
);
logger
.
info
(
"[CH][Abs]"
+
v
+
",key="
+
key
);
return
key
;
}
}
\ No newline at end of file
utils/src/main/java/com/apobates/forum/utils/cache/CubbyHoleLinkedDeque.java
浏览文件 @
258c0567
...
...
@@ -68,6 +68,7 @@ public final class CubbyHoleLinkedDeque<T> extends AbstractCubbyHole<T>{
return
;
}
final
Set
<
String
>
affect
=
processor
.
process
(
data
);
queue
.
removeIf
(
aed
->
affect
.
contains
(
CubbyHoleLinkedDeque
.
toChecksum
(
aed
)));
boolean
bol
=
queue
.
removeIf
(
aed
->
affect
.
contains
(
CubbyHoleLinkedDeque
.
toChecksum
(
aed
)));
logger
.
info
(
"[CH][Dequre]Clear Keys: "
+
String
.
join
(
","
,
affect
)+
", result: "
+
bol
);
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录