Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
街头小贩
Jforum2
提交
a012575d
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,发现更多精彩内容 >>
提交
a012575d
编写于
8月 14, 2020
作者:
街头小贩
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修正会员上次登录显示错误
上级
ce880679
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
43 addition
and
10 deletion
+43
-10
member.impl/src/main/java/com/apobates/forum/member/impl/dao/MemberActiveRecordsDaoImpl.java
...tes/forum/member/impl/dao/MemberActiveRecordsDaoImpl.java
+16
-1
member.impl/src/main/java/com/apobates/forum/member/impl/service/MemberActiveRecordsServiceImpl.java
...m/member/impl/service/MemberActiveRecordsServiceImpl.java
+10
-2
member/src/main/java/com/apobates/forum/member/dao/MemberActiveRecordsDao.java
...com/apobates/forum/member/dao/MemberActiveRecordsDao.java
+11
-1
member/src/main/java/com/apobates/forum/member/service/MemberActiveRecordsService.java
...ates/forum/member/service/MemberActiveRecordsService.java
+2
-2
thrones/src/main/java/com/apobates/forum/thrones/controller/MemberHomeController.java
...obates/forum/thrones/controller/MemberHomeController.java
+3
-3
thrones/src/main/webapp/WEB-INF/layout/page/default/home/index.jsp
...rc/main/webapp/WEB-INF/layout/page/default/home/index.jsp
+1
-1
未找到文件。
member.impl/src/main/java/com/apobates/forum/member/impl/dao/MemberActiveRecordsDaoImpl.java
浏览文件 @
a012575d
...
...
@@ -136,7 +136,12 @@ public class MemberActiveRecordsDaoImpl implements MemberActiveRecordsDao{
.
setMaxResults
(
showSize
)
.
getResultStream
();
}
/**
* @deprecated
* @param memberId
* @param memberNames
* @return
*/
@Override
public
Optional
<
MemberActiveRecords
>
findOneForLastLogin
(
long
memberId
,
String
memberNames
)
{
logger
.
info
(
"[MemberActiveRecordsDao]args member/id:"
+
memberId
+
",names:"
+
memberNames
);
...
...
@@ -157,6 +162,16 @@ public class MemberActiveRecordsDaoImpl implements MemberActiveRecordsDao{
return
Optional
.
empty
();
//.failure("没有找到可以匹配的登录记录");
}
@Override
public
Stream
<
MemberActiveRecords
>
findAllLoginAction
(
long
memberId
,
String
memberNames
,
int
showSize
)
{
return
entityManager
.
createQuery
(
"SELECT mar FROM MemberActiveRecords mar WHERE mar.memberNames = ?1 AND mar.action = ?2 AND mar.succeed = ?3 ORDER BY mar.id DESC"
,
MemberActiveRecords
.
class
)
.
setParameter
(
1
,
memberNames
)
.
setParameter
(
2
,
ForumActionEnum
.
MEMBER_LOGIN
)
.
setParameter
(
3
,
true
)
.
setMaxResults
(
showSize
)
.
getResultStream
();
}
@Override
public
Map
<
ForumActionEnum
,
Long
>
statsMemberAction
(
long
memberId
)
{
Member
m
=
entityManager
.
find
(
Member
.
class
,
memberId
);
...
...
member.impl/src/main/java/com/apobates/forum/member/impl/service/MemberActiveRecordsServiceImpl.java
浏览文件 @
a012575d
...
...
@@ -6,9 +6,12 @@ import com.apobates.forum.member.service.MemberActiveRecordsService;
import
com.apobates.forum.utils.persistence.Page
;
import
com.apobates.forum.utils.persistence.Pageable
;
import
java.time.LocalDateTime
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.TreeMap
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -47,8 +50,13 @@ public class MemberActiveRecordsServiceImpl implements MemberActiveRecordsServic
}
@Override
public
Optional
<
MemberActiveRecords
>
getLastLoginRecord
(
long
memberId
,
String
memberNames
)
{
return
memberActiveRecordsDao
.
findOneForLastLogin
(
memberId
,
memberNames
);
public
Optional
<
MemberActiveRecords
>
getPreviousLoginRecord
(
long
memberId
,
String
memberNames
)
{
List
<
MemberActiveRecords
>
rs
=
memberActiveRecordsDao
.
findAllLoginAction
(
memberId
,
memberNames
,
2
).
sorted
(
Comparator
.
comparing
(
MemberActiveRecords:
:
getActiveDateTime
).
reversed
()).
collect
(
Collectors
.
toList
());
try
{
return
Optional
.
ofNullable
(
rs
.
get
(
1
));
}
catch
(
IndexOutOfBoundsException
e
){
return
Optional
.
empty
();
}
}
@Override
...
...
member/src/main/java/com/apobates/forum/member/dao/MemberActiveRecordsDao.java
浏览文件 @
a012575d
...
...
@@ -59,13 +59,23 @@ public interface MemberActiveRecordsDao extends PagingAndSortingRepository<Membe
/**
* 查看指定会员最近的一条登录记录
*
*
@deprecated
* @param memberId 会员ID
* @param memberNames 登录帐号
* @return
*/
Optional
<
MemberActiveRecords
>
findOneForLastLogin
(
long
memberId
,
String
memberNames
);
/**
* 查看指定会员最近的几次登录记录,只显示成功的
*
* @param memberId 会员ID
* @param memberNames 登录帐号
* @param showSize 显示的数量
* @return
*/
Stream
<
MemberActiveRecords
>
findAllLoginAction
(
long
memberId
,
String
memberNames
,
int
showSize
);
/**
* 统计会员的动作,包括登录,注册数
*
...
...
member/src/main/java/com/apobates/forum/member/service/MemberActiveRecordsService.java
浏览文件 @
a012575d
...
...
@@ -52,13 +52,13 @@ public interface MemberActiveRecordsService {
Optional
<
MemberActiveRecords
>
get
(
long
id
);
/**
* 查看指定会员
最近的一条
登录记录
* 查看指定会员
上次
登录记录
*
* @param memberId 会员ID
* @param memberNames 登录帐号
* @return
*/
Optional
<
MemberActiveRecords
>
get
Last
LoginRecord
(
long
memberId
,
String
memberNames
);
Optional
<
MemberActiveRecords
>
get
Previous
LoginRecord
(
long
memberId
,
String
memberNames
);
/**
* 保存会员操作记录
...
...
thrones/src/main/java/com/apobates/forum/thrones/controller/MemberHomeController.java
浏览文件 @
a012575d
...
...
@@ -127,11 +127,11 @@ public class MemberHomeController {
data
.
put
(
"logonDateTime"
,
DateTimeUtils
.
formatClock
(
m
.
getRegisteDateTime
()));
//上次登录日期
try
{
MemberActiveRecords
lastLoginRecord
=
memberActiveRecordsService
.
get
Last
LoginRecord
(
mbean
.
getMid
(),
mbean
.
getNames
()).
orElse
(
null
);
MemberActiveRecords
lastLoginRecord
=
memberActiveRecordsService
.
get
Previous
LoginRecord
(
mbean
.
getMid
(),
mbean
.
getNames
()).
orElse
(
null
);
String
lldt
=
DateTimeUtils
.
formatClock
(
lastLoginRecord
.
getActiveDateTime
());
data
.
put
(
"
last
LoginDateTime"
,
lldt
);
data
.
put
(
"
prev
LoginDateTime"
,
lldt
);
}
catch
(
NullPointerException
e
)
{
data
.
put
(
"
last
LoginDateTime"
,
"-"
);
data
.
put
(
"
prev
LoginDateTime"
,
"-"
);
}
data
.
put
(
"names"
,
mbean
.
getNames
());
model
.
addAttribute
(
"member"
,
memberProfile
.
toMergeMap
(
data
));
...
...
thrones/src/main/webapp/WEB-INF/layout/page/default/home/index.jsp
浏览文件 @
a012575d
...
...
@@ -30,7 +30,7 @@
<div
class=
"member-profile-avatar"
><span><img
class=
"rounded-circle"
src=
"${BASE}/member/avatar/${member.id}.png"
width=
"100px"
height=
"100px"
/></span></div>
<div
class=
"member-profile-info"
>
<h4
style=
"margin-bottom:0"
>
${member.names} @u${member.id}
</h4>
<p>
上次登录: ${member.
last
LoginDateTime}
</p>
<p>
上次登录: ${member.
prev
LoginDateTime}
</p>
</div>
</div>
<div
class=
"col-md-6 member-profile-ext"
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录