Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
30e71f2b
Commit
30e71f2b
authored
Aug 06, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 'master'
Dev See merge request
!6
parents
74eaf872
39f251c0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
10 deletions
+18
-10
HomePageManager.java
...ain/java/com/tanpu/community/manager/HomePageManager.java
+8
-0
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+10
-10
No files found.
community-service/src/main/java/com/tanpu/community/manager/HomePageManager.java
View file @
30e71f2b
...
@@ -18,6 +18,7 @@ import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoOrg;
...
@@ -18,6 +18,7 @@ import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoOrg;
import
com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp
;
import
com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp
;
import
com.tanpu.community.api.beans.vo.feign.fund.FundCompanySimpleVO
;
import
com.tanpu.community.api.beans.vo.feign.fund.FundCompanySimpleVO
;
import
com.tanpu.community.api.enums.*
;
import
com.tanpu.community.api.enums.*
;
import
com.tanpu.community.cache.RedisCache
;
import
com.tanpu.community.dao.entity.community.FollowRelEntity
;
import
com.tanpu.community.dao.entity.community.FollowRelEntity
;
import
com.tanpu.community.dao.mapper.community.FollowRelMapper
;
import
com.tanpu.community.dao.mapper.community.FollowRelMapper
;
import
com.tanpu.community.feign.course.FeignClientForCourse
;
import
com.tanpu.community.feign.course.FeignClientForCourse
;
...
@@ -38,6 +39,8 @@ import java.util.*;
...
@@ -38,6 +39,8 @@ import java.util.*;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
static
com
.
tanpu
.
community
.
api
.
constants
.
RedisKeyConstant
.
CACHE_FEIGN_USER_INFO
;
@Service
@Service
public
class
HomePageManager
{
public
class
HomePageManager
{
...
@@ -55,6 +58,8 @@ public class HomePageManager {
...
@@ -55,6 +58,8 @@ public class HomePageManager {
private
FeignForFund
feignForFund
;
private
FeignForFund
feignForFund
;
@Resource
@Resource
private
FeignForPublicFund
feignForPublicFund
;
private
FeignForPublicFund
feignForPublicFund
;
@Resource
private
RedisCache
redisCache
;
//查询 个人中心 相关信息
//查询 个人中心 相关信息
public
UserInfoResp
queryUsersInfo
(
String
userIdMyself
,
String
userId
)
{
public
UserInfoResp
queryUsersInfo
(
String
userIdMyself
,
String
userId
)
{
...
@@ -155,6 +160,9 @@ public class HomePageManager {
...
@@ -155,6 +160,9 @@ public class HomePageManager {
CommonResp
<
Integer
>
integerCommonResp
=
feignClientForCourse
.
getStudyCourseCount
(
userId
);
CommonResp
<
Integer
>
integerCommonResp
=
feignClientForCourse
.
getStudyCourseCount
(
userId
);
if
(
integerCommonResp
.
isSuccess
())
userInfoNew
.
setCourseNumber
(
integerCommonResp
.
getData
());
if
(
integerCommonResp
.
isSuccess
())
userInfoNew
.
setCourseNumber
(
integerCommonResp
.
getData
());
}
}
//刷新用户缓存
redisCache
.
put
(
StringUtils
.
joinWith
(
"_"
,
CACHE_FEIGN_USER_INFO
,
userId
),
userInfoNew
,
60
);
return
userInfoNew
;
return
userInfoNew
;
}
}
...
...
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
30e71f2b
...
@@ -173,7 +173,6 @@ public class ThemeManager {
...
@@ -173,7 +173,6 @@ public class ThemeManager {
themeEntity
.
setContent
(
JsonUtil
.
toJson
(
req
.
getContent
()));
themeEntity
.
setContent
(
JsonUtil
.
toJson
(
req
.
getContent
()));
if
(
StringUtils
.
isBlank
(
req
.
getEditThemeId
()))
{
if
(
StringUtils
.
isBlank
(
req
.
getEditThemeId
()))
{
// 新建
// 新建
themeService
.
insertTheme
(
themeEntity
);
themeService
.
insertTheme
(
themeEntity
);
...
@@ -209,11 +208,11 @@ public class ThemeManager {
...
@@ -209,11 +208,11 @@ public class ThemeManager {
*/
*/
private
void
checkAttachment
(
List
<
ThemeContentReq
>
themeAttachments
)
{
private
void
checkAttachment
(
List
<
ThemeContentReq
>
themeAttachments
)
{
for
(
ThemeContentReq
content
:
themeAttachments
)
{
for
(
ThemeContentReq
content
:
themeAttachments
)
{
if
(
content
.
getType
()
==
null
)
{
if
(
content
.
getType
()
==
null
)
{
throw
new
IllegalArgumentException
(
"主题内容ThemeContentReq缺少类型"
);
throw
new
IllegalArgumentException
(
"主题内容ThemeContentReq缺少类型"
);
}
}
Set
<
String
>
types
=
Arrays
.
stream
(
RelTypeEnum
.
values
()).
map
(
o
->
o
.
type
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
types
=
Arrays
.
stream
(
RelTypeEnum
.
values
()).
map
(
o
->
o
.
type
).
collect
(
Collectors
.
toSet
());
if
(!
types
.
contains
(
content
.
getType
())){
if
(!
types
.
contains
(
content
.
getType
()))
{
throw
new
IllegalArgumentException
(
"主题内容ThemeContentReq类型错误"
);
throw
new
IllegalArgumentException
(
"主题内容ThemeContentReq类型错误"
);
}
}
if
(
content
.
getType
().
equals
(
RelTypeEnum
.
FUND
.
type
))
{
if
(
content
.
getType
().
equals
(
RelTypeEnum
.
FUND
.
type
))
{
...
@@ -258,7 +257,6 @@ public class ThemeManager {
...
@@ -258,7 +257,6 @@ public class ThemeManager {
/**
/**
* 查询主题列表:推荐/关注/热门/最新
* 查询主题列表:推荐/关注/热门/最新
*
*/
*/
// 查询主题列表:推荐/关注/热门/最新
// 查询主题列表:推荐/关注/热门/最新
public
ThemeListResp
queryList
(
ThemeListReq
req
,
String
userId
)
{
public
ThemeListResp
queryList
(
ThemeListReq
req
,
String
userId
)
{
...
@@ -358,7 +356,6 @@ public class ThemeManager {
...
@@ -358,7 +356,6 @@ public class ThemeManager {
themeQo
.
setFormerTheme
(
former
);
themeQo
.
setFormerTheme
(
former
);
// 点赞,收藏,转发
// 点赞,收藏,转发
Integer
likeCount
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
"_"
,
THEME_LIKE_COUNT
,
themeId
),
60
,
Integer
likeCount
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
"_"
,
THEME_LIKE_COUNT
,
themeId
),
60
,
()
->
collectionService
.
getCountByTypeAndId
(
themeId
,
CollectionTypeEnum
.
LIKE_THEME
),
Integer
.
class
);
()
->
collectionService
.
getCountByTypeAndId
(
themeId
,
CollectionTypeEnum
.
LIKE_THEME
),
Integer
.
class
);
...
@@ -436,15 +433,18 @@ public class ThemeManager {
...
@@ -436,15 +433,18 @@ public class ThemeManager {
}
}
List
<
ThemeQo
>
themeQos
=
convertEntityToQo
(
themeEntities
,
userId
);
List
<
ThemeQo
>
themeQos
=
convertEntityToQo
(
themeEntities
,
userId
);
if
(
userId
.
equals
(
req
.
getUserId
())
&&
!
ThemeRecordTypeEnum
.
COLLECT_LIST
.
getCode
().
equals
(
req
.
getRecordType
())
if
(
userId
.
equals
(
req
.
getUserId
()))
{
&&
!
ThemeRecordTypeEnum
.
LIKE_LIST
.
getCode
().
equals
(
req
.
getRecordType
()))
{
//如果用户是查询自己的帖子,需要实时查询用户自己的个人信息,防止数据不一致(非收藏类型)
//如果用户是查询自己的帖子,需要实时查询用户自己的个人信息,防止数据不一致(非收藏类型)
CommonResp
<
UserInfoResp
>
userInfoNewCommonResp
=
feignClientForFatools
.
queryUsersListNew
(
userId
);
CommonResp
<
UserInfoResp
>
userInfoNewCommonResp
=
feignClientForFatools
.
queryUsersListNew
(
userId
);
if
(
userInfoNewCommonResp
.
isNotSuccess
())
{
if
(
userInfoNewCommonResp
.
isNotSuccess
())
{
throw
new
BizException
(
"内部接口调用失败"
);
throw
new
BizException
(
"内部接口调用失败"
);
}
}
UserInfoResp
user
=
userInfoNewCommonResp
.
getData
();
UserInfoResp
user
=
userInfoNewCommonResp
.
getData
();
themeQos
.
stream
().
forEach
(
o
->
reBuildAuthorInfo
(
o
,
user
));
themeQos
.
forEach
(
o
->
{
if
(
o
.
getAuthorId
().
equals
(
userId
))
{
reBuildAuthorInfo
(
o
,
user
);
}
});
redisCache
.
put
(
StringUtils
.
joinWith
(
"_"
,
CACHE_FEIGN_USER_INFO
,
userId
),
user
,
60
);
redisCache
.
put
(
StringUtils
.
joinWith
(
"_"
,
CACHE_FEIGN_USER_INFO
,
userId
),
user
,
60
);
}
}
...
@@ -693,7 +693,7 @@ public class ThemeManager {
...
@@ -693,7 +693,7 @@ public class ThemeManager {
themeQo
.
setWorkshopIntroduction
(
userInfo
.
getWorkshopIntroduction
());
themeQo
.
setWorkshopIntroduction
(
userInfo
.
getWorkshopIntroduction
());
}
}
private
void
evictThemeCache
(
String
themeId
){
private
void
evictThemeCache
(
String
themeId
)
{
redisCache
.
evict
(
StringUtils
.
joinWith
(
"_"
,
CACHE_FORWARD_THEME_ID
,
themeId
));
redisCache
.
evict
(
StringUtils
.
joinWith
(
"_"
,
CACHE_FORWARD_THEME_ID
,
themeId
));
redisCache
.
evict
(
StringUtils
.
joinWith
(
"_"
,
CACHE_THEME_ID
,
themeId
));
redisCache
.
evict
(
StringUtils
.
joinWith
(
"_"
,
CACHE_THEME_ID
,
themeId
));
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment