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
f78d54de
Commit
f78d54de
authored
Jul 14, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户信息源修改
parent
32ee590d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
13 deletions
+17
-13
ThemeController.java
.../java/com/tanpu/community/controller/ThemeController.java
+14
-12
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+3
-1
No files found.
community-service/src/main/java/com/tanpu/community/controller/ThemeController.java
View file @
f78d54de
...
@@ -2,6 +2,7 @@ package com.tanpu.community.controller;
...
@@ -2,6 +2,7 @@ package com.tanpu.community.controller;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.auth.UserHolder
;
import
com.tanpu.community.api.beans.qo.ThemeQo
;
import
com.tanpu.community.api.beans.qo.ThemeQo
;
import
com.tanpu.community.api.beans.req.theme.*
;
import
com.tanpu.community.api.beans.req.theme.*
;
import
com.tanpu.community.manager.ThemeManager
;
import
com.tanpu.community.manager.ThemeManager
;
...
@@ -11,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -11,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.List
;
@RestController
@RestController
...
@@ -20,13 +22,14 @@ public class ThemeController {
...
@@ -20,13 +22,14 @@ public class ThemeController {
@Autowired
@Autowired
private
ThemeManager
themeManager
;
private
ThemeManager
themeManager
;
@Resource
private
UserHolder
userHolder
;
@ApiOperation
(
"发表主题"
)
@ApiOperation
(
"发表主题"
)
@PostMapping
(
value
=
"/publish"
)
@PostMapping
(
value
=
"/publish"
)
@ResponseBody
@ResponseBody
public
CommonResp
<
Void
>
publishTheme
(
@Validated
@RequestBody
CreateThemeReq
req
)
{
public
CommonResp
<
Void
>
publishTheme
(
@Validated
@RequestBody
CreateThemeReq
req
)
{
String
userId
=
"liujm"
;
String
userId
=
userHolder
.
getUserId
()
;
themeManager
.
publishTheme
(
req
,
userId
);
themeManager
.
publishTheme
(
req
,
userId
);
return
CommonResp
.
success
();
return
CommonResp
.
success
();
}
}
...
@@ -36,7 +39,7 @@ public class ThemeController {
...
@@ -36,7 +39,7 @@ public class ThemeController {
@PostMapping
(
value
=
"/list"
)
@PostMapping
(
value
=
"/list"
)
@ResponseBody
@ResponseBody
public
CommonResp
<
List
<
ThemeQo
>>
selectInterestList
(
@Validated
@RequestBody
ThemeListReq
req
)
{
public
CommonResp
<
List
<
ThemeQo
>>
selectInterestList
(
@Validated
@RequestBody
ThemeListReq
req
)
{
String
userId
=
"liujm"
;
String
userId
=
userHolder
.
getUserId
()
;
List
<
ThemeQo
>
result
=
themeManager
.
queryThemes
(
req
,
userId
);
List
<
ThemeQo
>
result
=
themeManager
.
queryThemes
(
req
,
userId
);
return
CommonResp
.
success
(
result
);
return
CommonResp
.
success
(
result
);
}
}
...
@@ -46,7 +49,7 @@ public class ThemeController {
...
@@ -46,7 +49,7 @@ public class ThemeController {
@GetMapping
(
value
=
"/detail"
)
@GetMapping
(
value
=
"/detail"
)
@ResponseBody
@ResponseBody
public
CommonResp
<
ThemeQo
>
getThemeMainText
(
@RequestParam
String
themeId
)
{
public
CommonResp
<
ThemeQo
>
getThemeMainText
(
@RequestParam
String
themeId
)
{
String
userId
=
"liujm"
;
String
userId
=
userHolder
.
getUserId
()
;
ThemeQo
themeQo
=
themeManager
.
getDetail
(
themeId
,
userId
);
ThemeQo
themeQo
=
themeManager
.
getDetail
(
themeId
,
userId
);
return
CommonResp
.
success
(
themeQo
);
return
CommonResp
.
success
(
themeQo
);
}
}
...
@@ -55,7 +58,7 @@ public class ThemeController {
...
@@ -55,7 +58,7 @@ public class ThemeController {
@PostMapping
(
value
=
"/forward"
)
@PostMapping
(
value
=
"/forward"
)
@ResponseBody
@ResponseBody
public
CommonResp
forwardTheme
(
@Validated
@RequestBody
ForwardThemeReq
forwardThemeReq
)
{
public
CommonResp
forwardTheme
(
@Validated
@RequestBody
ForwardThemeReq
forwardThemeReq
)
{
String
userId
=
"liujm"
;
String
userId
=
userHolder
.
getUserId
()
;
themeManager
.
forward
(
forwardThemeReq
,
userId
);
themeManager
.
forward
(
forwardThemeReq
,
userId
);
return
CommonResp
.
success
();
return
CommonResp
.
success
();
}
}
...
@@ -64,8 +67,8 @@ public class ThemeController {
...
@@ -64,8 +67,8 @@ public class ThemeController {
@PostMapping
(
value
=
"/like"
)
@PostMapping
(
value
=
"/like"
)
@ResponseBody
@ResponseBody
public
CommonResp
<
Void
>
likeOnTheme
(
@RequestBody
LikeThemeReq
req
)
{
public
CommonResp
<
Void
>
likeOnTheme
(
@RequestBody
LikeThemeReq
req
)
{
String
user
=
"liujm"
;
String
user
Id
=
userHolder
.
getUserId
()
;
themeManager
.
like
(
req
,
user
);
themeManager
.
like
(
req
,
user
Id
);
return
CommonResp
.
success
();
return
CommonResp
.
success
();
}
}
...
@@ -73,7 +76,7 @@ public class ThemeController {
...
@@ -73,7 +76,7 @@ public class ThemeController {
@GetMapping
(
value
=
"/delete"
)
@GetMapping
(
value
=
"/delete"
)
@ResponseBody
@ResponseBody
public
CommonResp
<
Void
>
delete
(
@RequestParam
(
value
=
"themeId"
)
String
themeId
)
{
public
CommonResp
<
Void
>
delete
(
@RequestParam
(
value
=
"themeId"
)
String
themeId
)
{
String
userId
=
"liujm"
;
String
userId
=
userHolder
.
getUserId
()
;
themeManager
.
delete
(
themeId
);
themeManager
.
delete
(
themeId
);
return
CommonResp
.
success
();
return
CommonResp
.
success
();
}
}
...
@@ -82,8 +85,8 @@ public class ThemeController {
...
@@ -82,8 +85,8 @@ public class ThemeController {
@PostMapping
(
value
=
"/collect"
)
@PostMapping
(
value
=
"/collect"
)
@ResponseBody
@ResponseBody
public
CommonResp
<
Void
>
bookTheme
(
@RequestBody
CollectThemeReq
req
)
{
public
CommonResp
<
Void
>
bookTheme
(
@RequestBody
CollectThemeReq
req
)
{
String
user
=
"liujm"
;
String
user
Id
=
userHolder
.
getUserId
()
;
themeManager
.
collect
(
req
,
user
);
themeManager
.
collect
(
req
,
user
Id
);
return
CommonResp
.
success
();
return
CommonResp
.
success
();
}
}
...
@@ -106,8 +109,7 @@ public class ThemeController {
...
@@ -106,8 +109,7 @@ public class ThemeController {
@GetMapping
(
value
=
"/block"
)
@GetMapping
(
value
=
"/block"
)
@ResponseBody
@ResponseBody
public
CommonResp
concealTheme
(
String
themeId
)
{
public
CommonResp
concealTheme
(
String
themeId
)
{
String
user
=
"liujm"
;
String
userId
=
userHolder
.
getUserId
();
// themeManager.blockContent(themeId,user);
return
CommonResp
.
success
();
return
CommonResp
.
success
();
}
}
...
...
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
f78d54de
...
@@ -221,7 +221,9 @@ public class ThemeManager {
...
@@ -221,7 +221,9 @@ public class ThemeManager {
//是否关注作者
//是否关注作者
String
authorId
=
themeQo
.
getAuthorId
();
String
authorId
=
themeQo
.
getAuthorId
();
Set
<
String
>
fansSet
=
new
HashSet
<>(
followRelService
.
queryFansByFollowerId
(
userId
));
Set
<
String
>
fansSet
=
new
HashSet
<>(
followRelService
.
queryFansByFollowerId
(
userId
));
themeQo
.
setFollow
(
fansSet
.
contains
(
authorId
));
if
(
fansSet
!=
null
){
themeQo
.
setFollow
(
fansSet
.
contains
(
authorId
));
}
//是否点赞
//是否点赞
CollectionEntity
likeEntity
=
collectionService
.
getNotDeleteTargetCollection
(
themeId
,
userId
,
CollectionTypeEnum
.
LIKE_THEME
);
CollectionEntity
likeEntity
=
collectionService
.
getNotDeleteTargetCollection
(
themeId
,
userId
,
CollectionTypeEnum
.
LIKE_THEME
);
themeQo
.
setHasLiked
(
likeEntity
!=
null
);
themeQo
.
setHasLiked
(
likeEntity
!=
null
);
...
...
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