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
86342a55
Commit
86342a55
authored
Jul 14, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comment 真实用户
parent
0c9f7e93
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
11 deletions
+32
-11
CommunityApplication.java
...c/main/java/com/tanpu/community/CommunityApplication.java
+0
-2
CommonImportConfig.java
...n/java/com/tanpu/community/config/CommonImportConfig.java
+3
-2
WebConfiguration.java
...ain/java/com/tanpu/community/config/WebConfiguration.java
+26
-0
CommentController.java
...ava/com/tanpu/community/controller/CommentController.java
+3
-7
No files found.
community-service/src/main/java/com/tanpu/community/CommunityApplication.java
View file @
86342a55
...
@@ -4,7 +4,6 @@ import org.springframework.boot.SpringApplication;
...
@@ -4,7 +4,6 @@ import org.springframework.boot.SpringApplication;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
...
@@ -12,7 +11,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
...
@@ -12,7 +11,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableTransactionManagement
@EnableTransactionManagement
@EnableCaching
@EnableCaching
@EnableScheduling
@EnableScheduling
@ComponentScan
({
"com.tanpu.common"
,
"com.tanpu.community"
})
@EnableFeignClients
@EnableFeignClients
public
class
CommunityApplication
{
public
class
CommunityApplication
{
...
...
community-service/src/main/java/com/tanpu/community/config/CommonImportConfig.java
View file @
86342a55
...
@@ -29,11 +29,12 @@ public class CommonImportConfig {
...
@@ -29,11 +29,12 @@ public class CommonImportConfig {
webLogAdvisor
.
setOrder
(
Ordered
.
HIGHEST_PRECEDENCE
);
webLogAdvisor
.
setOrder
(
Ordered
.
HIGHEST_PRECEDENCE
);
AspectJExpressionPointcut
pointcut
=
new
AspectJExpressionPointcut
();
AspectJExpressionPointcut
pointcut
=
new
AspectJExpressionPointcut
();
pointcut
.
setExpression
(
"execution(* com.tanpu.trade.web.*Controller.*(..))"
);
pointcut
.
setExpression
(
"execution(* com.tanpu.community.controller.*Controller.*(..))"
);
webLogAdvisor
.
setPointcut
(
pointcut
);
webLogAdvisor
.
setPointcut
(
pointcut
);
webLogAdvisor
.
setAdvice
(
webLogInterceptor
);
webLogAdvisor
.
setAdvice
(
webLogInterceptor
);
return
webLogAdvisor
;
return
webLogAdvisor
;
}
}
}
}
community-service/src/main/java/com/tanpu/community/config/WebConfiguration.java
0 → 100644
View file @
86342a55
package
com
.
tanpu
.
community
.
config
;
import
com.tanpu.common.auth.LoginInterceptor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
javax.annotation.Resource
;
/**
* created by xd on 2021/6/21
*/
@Slf4j
@Configuration
public
class
WebConfiguration
implements
WebMvcConfigurer
{
@Resource
private
LoginInterceptor
loginInterceptor
;
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
log
.
info
(
"addInterceptors"
);
registry
.
addInterceptor
(
loginInterceptor
).
addPathPatterns
(
"/**"
);
}
}
community-service/src/main/java/com/tanpu/community/controller/CommentController.java
View file @
86342a55
...
@@ -35,8 +35,7 @@ public class CommentController {
...
@@ -35,8 +35,7 @@ public class CommentController {
@PostMapping
(
value
=
"/publishComment"
)
@PostMapping
(
value
=
"/publishComment"
)
@ResponseBody
@ResponseBody
public
CommonResp
<
Void
>
publishCommet
(
@RequestBody
CreateCommentReq
req
)
{
public
CommonResp
<
Void
>
publishCommet
(
@RequestBody
CreateCommentReq
req
)
{
// String userId = userHolder.getUserInfo().getId();
String
userId
=
userHolder
.
getUserId
();
String
userId
=
"liujm"
;
commentManager
.
comment
(
req
,
userId
);
commentManager
.
comment
(
req
,
userId
);
return
CommonResp
.
success
();
return
CommonResp
.
success
();
}
}
...
@@ -46,9 +45,7 @@ public class CommentController {
...
@@ -46,9 +45,7 @@ public class CommentController {
@PostMapping
(
value
=
"/queryComment"
)
@PostMapping
(
value
=
"/queryComment"
)
@ResponseBody
@ResponseBody
public
CommonResp
<
Page
<
CommentQo
>>
queryComment
(
@RequestBody
QueryCommentReq
req
)
{
public
CommonResp
<
Page
<
CommentQo
>>
queryComment
(
@RequestBody
QueryCommentReq
req
)
{
//todo
String
userId
=
userHolder
.
getUserId
();
// String userId = userHolder.getUserInfo().getId();
String
userId
=
"liujm"
;
List
<
CommentQo
>
result
=
commentManager
.
queryComments
(
req
.
getThemeId
(),
userId
);
List
<
CommentQo
>
result
=
commentManager
.
queryComments
(
req
.
getThemeId
(),
userId
);
return
CommonResp
.
success
(
PageUtils
.
page
(
req
.
getPage
(),
result
));
return
CommonResp
.
success
(
PageUtils
.
page
(
req
.
getPage
(),
result
));
}
}
...
@@ -57,8 +54,7 @@ public class CommentController {
...
@@ -57,8 +54,7 @@ public class CommentController {
@PostMapping
(
value
=
"/likeComment"
)
@PostMapping
(
value
=
"/likeComment"
)
@ResponseBody
@ResponseBody
public
CommonResp
<
Void
>
likeComment
(
@RequestBody
LikeCommentReq
req
)
{
public
CommonResp
<
Void
>
likeComment
(
@RequestBody
LikeCommentReq
req
)
{
// String userId = userHolder.getUserId();
String
userId
=
userHolder
.
getUserId
();
String
userId
=
"liujm"
;
commentManager
.
likeComment
(
req
,
userId
);
commentManager
.
likeComment
(
req
,
userId
);
return
CommonResp
.
success
();
return
CommonResp
.
success
();
}
}
...
...
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