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
add127c1
Commit
add127c1
authored
Jul 22, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除无用方法
parent
8e4d5c03
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
146 additions
and
137 deletions
+146
-137
CommentManager.java
...main/java/com/tanpu/community/manager/CommentManager.java
+5
-11
FileManager.java
...rc/main/java/com/tanpu/community/manager/FileManager.java
+2
-2
HomePageManager.java
...ain/java/com/tanpu/community/manager/HomePageManager.java
+10
-9
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+97
-93
TopicManager.java
...c/main/java/com/tanpu/community/manager/TopicManager.java
+1
-2
VisitSummaryManager.java
...java/com/tanpu/community/manager/VisitSummaryManager.java
+0
-4
RankService.java
...rc/main/java/com/tanpu/community/service/RankService.java
+1
-1
ThemeService.java
...c/main/java/com/tanpu/community/service/ThemeService.java
+5
-7
ConvertUtil.java
...e/src/main/java/com/tanpu/community/util/ConvertUtil.java
+6
-7
RankUtils.java
...ice/src/main/java/com/tanpu/community/util/RankUtils.java
+4
-0
TimeUtils.java
...ice/src/main/java/com/tanpu/community/util/TimeUtils.java
+15
-1
No files found.
community-service/src/main/java/com/tanpu/community/manager/CommentManager.java
View file @
add127c1
...
...
@@ -41,7 +41,7 @@ public class CommentManager {
@Resource
private
ReportLogService
reportLogService
;
// 评论(对主题)
//
发表
评论(对主题)
public
void
comment
(
CreateCommentReq
req
,
String
userId
)
{
CommentEntity
commentEntity
=
CommentEntity
.
builder
()
.
themeId
(
req
.
getThemeId
())
...
...
@@ -55,16 +55,14 @@ public class CommentManager {
commentService
.
insertComment
(
commentEntity
);
}
//查询
//查询
评论
public
List
<
CommentQo
>
queryComments
(
String
themeId
,
String
userId
)
{
List
<
CommentEntity
>
commentEntities
=
commentService
.
selectByThemeIdAndParentId
(
themeId
,
null
);
List
<
CommentQo
>
commentQos
=
ConvertUtil
.
commentEntity2Qos
(
commentEntities
);
Set
<
String
>
likeCommentList
=
collectionService
.
getListByUser
(
userId
,
CollectionTypeEnum
.
LIKE_COMMENT
);
for
(
CommentQo
commentQo
:
commentQos
)
{
//用户信息
//
查询
用户信息
String
authorId
=
commentQo
.
getAuthorId
();
CommonResp
<
UserInfoNew
>
userInfoNewCommonResp
=
feignClientForFatools
.
queryUsersListNew
(
authorId
);
if
(
userInfoNewCommonResp
.
isNotSuccess
())
{
...
...
@@ -86,10 +84,6 @@ public class CommentManager {
Integer
countByTypeAndId
=
collectionService
.
getCountByTypeAndId
(
commentId
,
CollectionTypeEnum
.
LIKE_COMMENT
);
commentQo
.
setLikeCount
(
countByTypeAndId
);
//二级评论,本期不上线
// List<CommentEntity> CommentLv2Entities = commentService.selectByThemeIdAndParentId(themeId, commentId);
// List<CommentLv2Qo> commentLv2Qos = ConvertUtil.commentLv2Entity2Qos(CommentLv2Entities);
// commentQo.setCommentLv2Qos(commentLv2Qos);
}
//排序:点赞降序+时间降序
return
commentQos
.
stream
().
sorted
(
Comparator
.
comparing
(
CommentQo:
:
getLikeCount
,
Comparator
.
reverseOrder
()).
...
...
@@ -111,8 +105,8 @@ public class CommentManager {
public
void
report
(
ReportCommentReq
req
,
String
userId
)
{
//更改举报状态
commentService
.
updateReportStatus
(
req
.
getCommentId
());
//写入举报
日志
//写入举报
记录表
CommentEntity
commentEntity
=
commentService
.
queryByCommentId
(
req
.
getCommentId
());
reportLogService
.
insert
(
ReportTypeEnum
.
COMMENT
,
userId
,
req
.
getCommentId
(),
commentEntity
.
getAuthorId
(),
req
.
getReason
());
reportLogService
.
insert
(
ReportTypeEnum
.
COMMENT
,
userId
,
req
.
getCommentId
(),
commentEntity
.
getAuthorId
(),
req
.
getReason
());
}
}
community-service/src/main/java/com/tanpu/community/manager/FileManager.java
View file @
add127c1
...
...
@@ -38,14 +38,14 @@ public class FileManager {
String
originalName
=
file
.
getOriginalFilename
();
if
(
data
.
length
==
0
||
StringUtils
.
isEmpty
(
originalName
)){
if
(
data
.
length
==
0
||
StringUtils
.
isEmpty
(
originalName
))
{
throw
new
BizException
(
"上传文件为空"
);
}
FileRecordEntity
fileRecordEntity
=
ossFileService
.
uploadFile
(
data
,
originalName
);
return
ConvertUtil
.
fileRecordEntity2Resp
(
fileRecordEntity
);
}
public
Map
<
String
,
String
>
getFileUrlByIds
(
List
<
String
>
fileIds
)
{
public
Map
<
String
,
String
>
getFileUrlByIds
(
List
<
String
>
fileIds
)
{
return
ossFileService
.
queryByIds
(
fileIds
).
stream
()
.
collect
(
Collectors
.
toMap
(
FileRecordEntity:
:
getFileId
,
FileRecordEntity:
:
getUrl
));
}
...
...
community-service/src/main/java/com/tanpu/community/manager/HomePageManager.java
View file @
add127c1
...
...
@@ -69,13 +69,13 @@ public class HomePageManager {
//查询 个人中心 相关信息
public
UserInfoNew
queryUsersListNew
(
String
userIdMyself
,
String
userId
)
{
CommonResp
<
UserInfoNew
>
queryUsersListNew
=
feignClientForFatools
.
queryUsersListNew
(
StringUtils
.
isNotBlank
(
userId
)
?
userId
:
userIdMyself
);
if
(
queryUsersListNew
.
isNotSuccess
())
new
BizException
(
"内部接口调用失败"
);
if
(
queryUsersListNew
.
isNotSuccess
())
new
BizException
(
"内部接口调用失败"
);
UserInfoNew
userInfoNew
=
queryUsersListNew
.
getData
();
if
(
StringUtils
.
isNotBlank
(
userId
)
&&
!
StringUtils
.
equals
(
userIdMyself
,
userId
))
{
//查询别人的个人主页
// 关注 按钮的显示逻辑
FollowRelEntity
followRelEntity
=
followRelService
.
queryRecord
(
userId
,
userIdMyself
);
if
(
ObjectUtils
.
allNotNull
(
followRelEntity
)
&&
BizStatus
.
DeleteTag
.
tag_init
==
followRelEntity
.
getDeleteTag
()){
if
(
ObjectUtils
.
allNotNull
(
followRelEntity
)
&&
BizStatus
.
DeleteTag
.
tag_init
==
followRelEntity
.
getDeleteTag
())
{
userInfoNew
.
setShowFollowStatus
(
ShowFollowStatusEnum
.
FOLLOWED
.
getCode
());
// 已关注
}
else
{
userInfoNew
.
setShowFollowStatus
(
ShowFollowStatusEnum
.
NOT_FOLLOWED
.
getCode
());
// 未关注
...
...
@@ -89,7 +89,7 @@ public class HomePageManager {
getFansNUmAndFollowNum
(
userInfoNew
);
// 主页类型 显示逻辑
if
(
UserLevelEnum
.
USER_CHIEF_FINANCIAL_ADVISER
.
getCode
()
==
userInfoNew
.
getLevelGrade
()){
if
(
UserLevelEnum
.
USER_CHIEF_FINANCIAL_ADVISER
.
getCode
()
==
userInfoNew
.
getLevelGrade
())
{
// 首席投顾
userInfoNew
.
setPersonalCenterType
(
PersonalCenterTypeEnum
.
CHIEF
.
getCode
());
// 成功案例客户
...
...
@@ -103,10 +103,10 @@ public class HomePageManager {
userInfoNew
.
getUserInfoNewChief
().
setClientId
(
null
);
}
}
}
else
if
(
UserTypeEnum
.
USER_ORG
.
getCode
()
==
userInfoNew
.
getUserType
()){
}
else
if
(
UserTypeEnum
.
USER_ORG
.
getCode
()
==
userInfoNew
.
getUserType
())
{
// 机构账号
userInfoNew
.
setPersonalCenterType
(
PersonalCenterTypeEnum
.
ORG
.
getCode
());
if
(
FundCompanyTypeEnum
.
PUBLIC
.
getCode
()
==
userInfoNew
.
getUserInfoNewOrg
().
getBelongOrgType
()
&&
StringUtils
.
isNotBlank
(
userInfoNew
.
getUserInfoNewOrg
().
getBelongOrgId
())){
// 公募
if
(
FundCompanyTypeEnum
.
PUBLIC
.
getCode
()
==
userInfoNew
.
getUserInfoNewOrg
().
getBelongOrgType
()
&&
StringUtils
.
isNotBlank
(
userInfoNew
.
getUserInfoNewOrg
().
getBelongOrgId
()))
{
// 公募
//设置 基金数
MfAdvisorscalerank
mfAdvisorscalerank
=
mfAdvisorscalerankMapper
.
selectOne
(
new
LambdaQueryWrapper
<
MfAdvisorscalerank
>()
.
eq
(
MfAdvisorscalerank:
:
getInvestadvisorcode
,
userInfoNew
.
getUserInfoNewOrg
().
getBelongOrgId
())
...
...
@@ -118,7 +118,7 @@ public class HomePageManager {
.
last
(
"limit 1"
));
userInfoNew
.
setFounded
(
ObjectUtils
.
anyNotNull
(
mfInvestadvisoroutline
)
?
mfInvestadvisoroutline
.
getEstablishmentdate
().
getTime
()
:
null
);
}
if
(
FundCompanyTypeEnum
.
PRIVATE
.
getCode
()
==
userInfoNew
.
getUserInfoNewOrg
().
getBelongOrgType
()
&&
StringUtils
.
isNotBlank
(
userInfoNew
.
getUserInfoNewOrg
().
getBelongOrgId
()))
{
// 私募
if
(
FundCompanyTypeEnum
.
PRIVATE
.
getCode
()
==
userInfoNew
.
getUserInfoNewOrg
().
getBelongOrgType
()
&&
StringUtils
.
isNotBlank
(
userInfoNew
.
getUserInfoNewOrg
().
getBelongOrgId
()))
{
// 私募
//设置 基金数
Integer
integer
=
fundInfoMapper
.
selectCount
(
new
LambdaQueryWrapper
<
FundInfo
>().
eq
(
FundInfo:
:
getTrustId
,
userInfoNew
.
getUserInfoNewOrg
().
getBelongOrgId
()));
userInfoNew
.
setFundNumber
(
integer
);
...
...
@@ -132,7 +132,7 @@ public class HomePageManager {
}
//设置团队成员
CommonResp
<
List
<
UserInfoOrg
>>
usetInfoByOrgUserId
=
feignClientForFatools
.
getUsetInfoByOrgUserId
(
userId
);
if
(
usetInfoByOrgUserId
.
isSuccess
()){
if
(
usetInfoByOrgUserId
.
isSuccess
())
{
List
<
UserInfoOrg
>
userInfoOrgs
=
usetInfoByOrgUserId
.
getData
();
// 设置关注列表
List
<
String
>
collect
=
userInfoOrgs
.
stream
().
map
(
UserInfoOrg:
:
getUserId
).
collect
(
Collectors
.
toList
());
...
...
@@ -142,7 +142,8 @@ public class HomePageManager {
.
eq
(
FollowRelEntity:
:
getDeleteTag
,
BizStatus
.
DeleteTag
.
tag_init
));
Map
<
String
,
FollowRelEntity
>
collect1
=
followRelEntities
.
stream
().
collect
(
Collectors
.
toMap
(
FollowRelEntity:
:
getFollowUserId
,
Function
.
identity
()));
userInfoOrgs
.
forEach
(
userInfoOrg
->
{
if
(
collect1
.
containsKey
(
userInfoOrg
.
getUserId
()))
userInfoOrg
.
setIsFollower
(
ShowFollowStatusEnum
.
FOLLOWED
.
getCode
());
//1已关注
if
(
collect1
.
containsKey
(
userInfoOrg
.
getUserId
()))
userInfoOrg
.
setIsFollower
(
ShowFollowStatusEnum
.
FOLLOWED
.
getCode
());
//1已关注
});
userInfoNew
.
setUserInfoOrgList
(
userInfoOrgs
);
}
...
...
@@ -165,6 +166,7 @@ public class HomePageManager {
userInfoNew
.
setFollowNumber
(
followNumber
);
userInfoNew
.
setFansNumber
(
fansNumber
);
}
public
List
<
Customer
>
queryUserCustomerList
(
String
userId
)
{
CommonResp
<
List
<
Customer
>>
ifaCustomerList
=
feignClientForDiagnose
.
getIfaCustomerList
(
userId
);
if
(
ifaCustomerList
.
isSuccess
())
return
ifaCustomerList
.
getData
();
...
...
@@ -208,5 +210,4 @@ public class HomePageManager {
}
}
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
add127c1
This diff is collapsed.
Click to expand it.
community-service/src/main/java/com/tanpu/community/manager/TopicManager.java
View file @
add127c1
...
...
@@ -43,7 +43,7 @@ public class TopicManager {
//新增话题
public
void
insertTopic
(
String
topicTitle
,
String
userId
)
{
if
(
topicService
.
queryByTitile
(
topicTitle
)
==
null
)
{
throw
new
BizException
(
"话题名称已存在:"
+
topicTitle
);
throw
new
BizException
(
"话题名称已存在:"
+
topicTitle
);
}
topicService
.
addTopic
(
topicTitle
,
userId
);
...
...
@@ -66,7 +66,6 @@ public class TopicManager {
}
public
void
refreshRedisCache
()
{
List
<
TopicEntity
>
topicEntities
=
topicService
.
queryAll
();
for
(
TopicEntity
topic
:
topicEntities
)
{
...
...
community-service/src/main/java/com/tanpu/community/manager/VisitSummaryManager.java
View file @
add127c1
...
...
@@ -40,10 +40,6 @@ public class VisitSummaryManager {
}
public
void
addTopicPageView
(
String
topicId
)
{
String
userId
=
userHolder
.
getUserId
();
visitSummaryService
.
addPageView
(
userId
,
topicId
,
VisitTypeEnum
.
TOPIC_PAGE_VIEW
);
...
...
community-service/src/main/java/com/tanpu/community/service/RankService.java
View file @
add127c1
...
...
@@ -38,7 +38,7 @@ public class RankService {
* 计算主题热度排行
*/
public
void
rankThemes
()
{
List
<
ThemeEntity
>
themeEntities
=
themeService
.
query
All
();
List
<
ThemeEntity
>
themeEntities
=
themeService
.
query
Recent14days
();
List
<
ThemeAnalysDO
>
themeAnalysDOS
=
ConvertUtil
.
themeEntityToAnalysDOs
(
themeEntities
);
for
(
ThemeAnalysDO
theme
:
themeAnalysDOS
)
{
String
themeId
=
theme
.
getThemeId
();
...
...
community-service/src/main/java/com/tanpu/community/service/ThemeService.java
View file @
add127c1
...
...
@@ -8,6 +8,7 @@ import com.tanpu.community.api.enums.DeleteTagEnum;
import
com.tanpu.community.api.enums.ReportStatusEnum
;
import
com.tanpu.community.dao.entity.community.ThemeEntity
;
import
com.tanpu.community.dao.mapper.community.ThemeMapper
;
import
com.tanpu.community.util.TimeUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -41,14 +42,11 @@ public class ThemeService {
themeMapper
.
update
(
themeEntity
,
new
LambdaUpdateWrapper
<
ThemeEntity
>().
eq
(
ThemeEntity:
:
getThemeId
,
themeId
));
}
/**
* 根据主题Id查询列表
*
* @return
*/
public
List
<
ThemeEntity
>
queryAll
()
{
//14天内所有主题
public
List
<
ThemeEntity
>
queryRecent14days
()
{
LambdaQueryWrapper
<
ThemeEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<
ThemeEntity
>()
.
eq
(
ThemeEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
.
getCode
());
.
eq
(
ThemeEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
.
getCode
())
.
gt
(
ThemeEntity:
:
getCreateTime
,
TimeUtils
.
getDaysBefore
(
14
));
return
themeMapper
.
selectList
(
queryWrapper
);
}
...
...
community-service/src/main/java/com/tanpu/community/util/ConvertUtil.java
View file @
add127c1
...
...
@@ -15,7 +15,6 @@ import com.tanpu.community.api.enums.RelTypeEnum;
import
com.tanpu.community.api.enums.TopicStatusEnum
;
import
com.tanpu.community.dao.entity.community.*
;
import
com.tanpu.community.dao.entity.user.UserInfoEntity
;
import
org.elasticsearch.common.recycler.Recycler
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.util.StringUtils
;
...
...
@@ -38,9 +37,9 @@ public class ConvertUtil {
}
ThemeQo
themeQO
=
new
ThemeQo
();
BeanUtils
.
copyProperties
(
themeEntity
,
themeQO
);
themeQO
.
setUpdateTime
(
TimeUtil
.
getTimestampOfDateTime
(
themeEntity
.
getUpdateTime
()));
themeQO
.
setCreateTime
(
TimeUtil
.
getTimestampOfDateTime
(
themeEntity
.
getCreateTime
()));
themeQO
.
setUpToNowTime
(
TimeUtil
.
calUpToNowTime
(
themeEntity
.
getCreateTime
()));
themeQO
.
setUpdateTime
(
TimeUtil
s
.
getTimestampOfDateTime
(
themeEntity
.
getUpdateTime
()));
themeQO
.
setCreateTime
(
TimeUtil
s
.
getTimestampOfDateTime
(
themeEntity
.
getCreateTime
()));
themeQO
.
setUpToNowTime
(
TimeUtil
s
.
calUpToNowTime
(
themeEntity
.
getCreateTime
()));
List
<
ThemeContentQo
>
themeContentQos
=
JsonUtil
.
toBean
(
themeEntity
.
getContent
(),
new
TypeReference
<
List
<
ThemeContentQo
>>()
{
});
themeQO
.
setContent
(
themeContentQos
);
...
...
@@ -53,7 +52,7 @@ public class ConvertUtil {
}
ThemeAnalysDO
themeAnalysDO
=
new
ThemeAnalysDO
();
BeanUtils
.
copyProperties
(
themeEntity
,
themeAnalysDO
);
themeAnalysDO
.
setMinuteTillNow
(
TimeUtil
.
calMinuteTillNow
(
themeEntity
.
getCreateTime
()));
themeAnalysDO
.
setMinuteTillNow
(
TimeUtil
s
.
calMinuteTillNow
(
themeEntity
.
getCreateTime
()));
return
themeAnalysDO
;
}
...
...
@@ -106,7 +105,7 @@ public class ConvertUtil {
TopicRankQo
topicRankQo
=
new
TopicRankQo
();
BeanUtils
.
copyProperties
(
topicEntity
,
topicRankQo
);
//2小时内发帖,添加新话题标签
if
(
TimeUtil
.
calMinuteTillNow
(
topicEntity
.
getCreateTime
())<
120
){
if
(
TimeUtil
s
.
calMinuteTillNow
(
topicEntity
.
getCreateTime
())<
120
){
topicRankQo
.
setType
(
TopicStatusEnum
.
NEWEST
.
getCode
());
}
return
topicRankQo
;
...
...
@@ -128,7 +127,7 @@ public class ConvertUtil {
public
static
CommentQo
commentEntity2Qo
(
CommentEntity
entity
)
{
CommentQo
qo
=
new
CommentQo
();
BeanUtils
.
copyProperties
(
entity
,
qo
);
qo
.
setUpdateTime
(
TimeUtil
.
getTimestampOfDateTime
(
entity
.
getUpdateTime
()));
qo
.
setUpdateTime
(
TimeUtil
s
.
getTimestampOfDateTime
(
entity
.
getUpdateTime
()));
return
qo
;
}
...
...
community-service/src/main/java/com/tanpu/community/util/RankUtils.java
0 → 100644
View file @
add127c1
package
com
.
tanpu
.
community
.
util
;
public
class
RankUtils
{
}
community-service/src/main/java/com/tanpu/community/util/TimeUtil.java
→
community-service/src/main/java/com/tanpu/community/util/TimeUtil
s
.java
View file @
add127c1
package
com
.
tanpu
.
community
.
util
;
import
java.text.SimpleDateFormat
;
import
java.time.Duration
;
import
java.time.Instant
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.format.DateTimeFormatter
;
import
java.util.Calendar
;
public
class
TimeUtil
{
public
class
TimeUtil
s
{
public
static
long
getTimestampOfDateTime
(
LocalDateTime
localDateTime
)
{
ZoneId
zone
=
ZoneId
.
systemDefault
();
Instant
instant
=
localDateTime
.
atZone
(
zone
).
toInstant
();
...
...
@@ -41,4 +43,16 @@ public class TimeUtil {
return
between
.
toMinutes
();
}
//计算n天前的时间
public
static
LocalDateTime
getDaysBefore
(
Integer
number
){
Calendar
calendar
=
Calendar
.
getInstance
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
calendar
.
add
(
Calendar
.
DATE
,
number
);
String
three_days_after
=
sdf
.
format
(
calendar
.
getTime
());
DateTimeFormatter
df
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
LocalDateTime
ldt
=
LocalDateTime
.
parse
(
three_days_after
,
df
);
return
ldt
;
}
}
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