Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
training-project
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hqzhdj
training-project
Commits
80594f69
Commit
80594f69
authored
Jan 02, 2025
by
阳浪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查看我的投稿接口
parent
2af2275a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
0 deletions
+63
-0
cloud-training-project-service/src/main/java/com/yizhi/training/application/controller/TpCommentController.java
+63
-0
No files found.
cloud-training-project-service/src/main/java/com/yizhi/training/application/controller/TpCommentController.java
View file @
80594f69
package
com
.
yizhi
.
training
.
application
.
controller
;
package
com
.
yizhi
.
training
.
application
.
controller
;
import
cn.hutool.core.collection.CollUtil
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.yizhi.application.orm.id.IdGenerator
;
import
com.yizhi.application.orm.id.IdGenerator
;
...
@@ -28,6 +29,7 @@ import org.springframework.util.CollectionUtils;
...
@@ -28,6 +29,7 @@ import org.springframework.util.CollectionUtils;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
/**
* <p>
* <p>
...
@@ -95,7 +97,68 @@ public class TpCommentController {
...
@@ -95,7 +97,68 @@ public class TpCommentController {
Page
<
PageCommentVo
>
page
=
iTpCommentService
.
getCommentPage
(
ContextHolder
.
get
().
getAccountId
(),
trainingProjectId
,
bizType
,
accountId
,
pageNo
,
pageSize
,
type
);
Page
<
PageCommentVo
>
page
=
iTpCommentService
.
getCommentPage
(
ContextHolder
.
get
().
getAccountId
(),
trainingProjectId
,
bizType
,
accountId
,
pageNo
,
pageSize
,
type
);
String
fullName
;
String
fullName
;
String
name
;
String
name
;
if
(
page
==
null
||
CollUtil
.
isEmpty
(
page
.
getRecords
())){
return
page
;
}
List
<
Long
>
ids
=
page
.
getRecords
().
stream
().
map
(
PageCommentVo:
:
getId
).
collect
(
Collectors
.
toList
());
TpCommentReply
reply
=
new
TpCommentReply
();
if
(
type
!=
0
)
{
reply
.
setState
(
0
);
}
reply
.
setAuditStatus
(
"0"
);
EntityWrapper
<
TpCommentReply
>
wrapper
=
new
EntityWrapper
<
TpCommentReply
>(
reply
);
List
<
String
>
list
=
new
ArrayList
<
String
>();
list
.
add
(
"createTime"
);
wrapper
.
in
(
"tp_comment_id"
,
ids
);
wrapper
.
orderDesc
(
list
);
List
<
TpCommentReply
>
replies
=
iTpCommentReplyService
.
selectList
(
wrapper
);
Map
<
Long
,
List
<
TpCommentReply
>>
listMap
=
new
HashMap
<>();
for
(
TpCommentReply
revert
:
replies
)
{
revert
.
setContent
(
StringEscapeUtils
.
unescapeJava
(
revert
.
getContent
()));
if
(
listMap
.
containsKey
(
revert
.
getTpCommentId
()))
{
listMap
.
get
(
revert
.
getTpCommentId
()).
add
(
revert
);
}
else
{
List
<
TpCommentReply
>
repliesResult
=
new
ArrayList
<>();
repliesResult
.
add
(
revert
);
listMap
.
put
(
revert
.
getTpCommentId
(),
repliesResult
);
}
if
(
null
!=
revert
.
getReplyParentId
()
&&
0
!=
revert
.
getReplyParentId
())
{
TpCommentReply
reply2
=
iTpCommentReplyService
.
selectById
(
revert
.
getReplyParentId
());
if
(
null
!=
reply2
)
{
AccountVO
findById
=
accountClient
.
findById
(
reply2
.
getCreateById
());
revert
.
setParentAccountFullName
(
null
==
findById
.
getFullName
()
||
""
==
findById
.
getFullName
()
?
findById
.
getName
()
:
findById
.
getFullName
());
}
else
{
AccountVO
findById
=
accountClient
.
findById
(
iTpCommentService
.
selectById
(
revert
.
getTpCommentId
()).
getCreateById
());
revert
.
setParentAccountFullName
(
null
==
findById
.
getFullName
()
||
""
==
findById
.
getFullName
()
?
findById
.
getName
()
:
findById
.
getFullName
());
}
}
else
{
AccountVO
findById
=
accountClient
.
findById
(
iTpCommentService
.
selectById
(
revert
.
getTpCommentId
()).
getCreateById
());
revert
.
setParentAccountFullName
(
null
==
findById
.
getFullName
()
||
""
==
findById
.
getFullName
()
?
findById
.
getName
()
:
findById
.
getFullName
());
}
AccountVO
accountVO
=
accountClient
.
findById
(
revert
.
getCreateById
());
fullName
=
accountVO
.
getFullName
();
name
=
accountVO
.
getName
();
revert
.
setCreateByName
(
name
);
revert
.
setCreateByFullName
(
null
==
fullName
||
""
==
fullName
?
name
:
fullName
);
}
for
(
PageCommentVo
listCommentVo
:
page
.
getRecords
())
{
for
(
PageCommentVo
listCommentVo
:
page
.
getRecords
())
{
List
<
TpCommentReply
>
list1
=
listMap
.
get
(
listCommentVo
.
getId
());
List
<
TpCommentReplyVo
>
list2
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
list1
))
{
for
(
TpCommentReply
tr
:
list1
)
{
TpCommentReplyVo
trv
=
new
TpCommentReplyVo
();
BeanUtils
.
copyProperties
(
tr
,
trv
);
list2
.
add
(
trv
);
}
}
listCommentVo
.
setContent
(
StringEscapeUtils
.
unescapeJava
(
listCommentVo
.
getContent
()));
if
(
listMap
.
containsKey
(
listCommentVo
.
getId
()))
{
listCommentVo
.
setTpCommentReplies
(
list2
);
listCommentVo
.
setReplys
(
listMap
.
get
(
listCommentVo
.
getId
()).
size
());
}
listCommentVo
.
setContent
(
StringEscapeUtils
.
unescapeJava
(
listCommentVo
.
getContent
()));
listCommentVo
.
setContent
(
StringEscapeUtils
.
unescapeJava
(
listCommentVo
.
getContent
()));
AccountVO
accountVO
=
accountClient
.
findById
(
listCommentVo
.
getAccountId
());
AccountVO
accountVO
=
accountClient
.
findById
(
listCommentVo
.
getAccountId
());
fullName
=
accountVO
.
getFullName
();
fullName
=
accountVO
.
getFullName
();
...
...
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