Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
safe-campus-bbs
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
万成波
safe-campus-bbs
Commits
2f3f5e92
Commit
2f3f5e92
authored
Sep 08, 2025
by
万成波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码
parent
63de3ec6
Changes
56
Hide whitespace changes
Inline
Side-by-side
Showing
56 changed files
with
229 additions
and
876 deletions
+229
-876
safe-campus-admin/src/main/java/com/tangguo/web/controller/system/SysLoginController.java
...com/tangguo/web/controller/system/SysLoginController.java
+30
-0
safe-campus-bbs-ui/src/views/comment/index.vue
safe-campus-bbs-ui/src/views/comment/index.vue
+3
-3
safe-campus-bbs-ui/src/views/moments/DetailDialog.vue
safe-campus-bbs-ui/src/views/moments/DetailDialog.vue
+3
-3
safe-campus-bbs-ui/src/views/moments/index.vue
safe-campus-bbs-ui/src/views/moments/index.vue
+3
-3
safe-campus-bbs-ui/src/views/pointsExchange/index.vue
safe-campus-bbs-ui/src/views/pointsExchange/index.vue
+2
-2
safe-campus-bbs-ui/src/views/pointsManage/ExchangeDialog.vue
safe-campus-bbs-ui/src/views/pointsManage/ExchangeDialog.vue
+6
-6
safe-campus-bbs-ui/src/views/pointsManage/index.vue
safe-campus-bbs-ui/src/views/pointsManage/index.vue
+3
-3
safe-campus-bbs-uniapp/components/Comment-Item.vue
safe-campus-bbs-uniapp/components/Comment-Item.vue
+4
-4
safe-campus-bbs-uniapp/components/Dynamic-Item.vue
safe-campus-bbs-uniapp/components/Dynamic-Item.vue
+6
-6
safe-campus-bbs-uniapp/components/PublishComment.vue
safe-campus-bbs-uniapp/components/PublishComment.vue
+2
-2
safe-campus-bbs-uniapp/pages/mine/mine.vue
safe-campus-bbs-uniapp/pages/mine/mine.vue
+2
-2
safe-campus-bbs-uniapp/pages/pk-detail/pk-detail.vue
safe-campus-bbs-uniapp/pages/pk-detail/pk-detail.vue
+3
-3
safe-campus-common/src/main/java/com/tangguo/common/core/domain/model/WxcpCodeLogin.java
...a/com/tangguo/common/core/domain/model/WxcpCodeLogin.java
+2
-2
safe-campus-common/src/main/java/com/tangguo/common/domain/QwmhUserInfo.java
...src/main/java/com/tangguo/common/domain/QwmhUserInfo.java
+0
-54
safe-campus-common/src/main/java/com/tangguo/common/mauth/Mobile401Exception.java
...ain/java/com/tangguo/common/mauth/Mobile401Exception.java
+0
-37
safe-campus-common/src/main/java/com/tangguo/common/mauth/Mobile403Exception.java
...ain/java/com/tangguo/common/mauth/Mobile403Exception.java
+0
-37
safe-campus-common/src/main/java/com/tangguo/common/mauth/MobileAuth.java
...on/src/main/java/com/tangguo/common/mauth/MobileAuth.java
+0
-16
safe-campus-common/src/main/java/com/tangguo/common/mauth/MobileProperties.java
.../main/java/com/tangguo/common/mauth/MobileProperties.java
+0
-57
safe-campus-common/src/main/java/com/tangguo/common/mauth/MobileTokenHelper.java
...main/java/com/tangguo/common/mauth/MobileTokenHelper.java
+0
-222
safe-campus-framework/src/main/java/com/tangguo/framework/config/ResourcesConfig.java
...in/java/com/tangguo/framework/config/ResourcesConfig.java
+1
-6
safe-campus-framework/src/main/java/com/tangguo/framework/config/SecurityConfig.java
...ain/java/com/tangguo/framework/config/SecurityConfig.java
+1
-9
safe-campus-framework/src/main/java/com/tangguo/framework/mauth/MobileAuthInterceptor.java
...va/com/tangguo/framework/mauth/MobileAuthInterceptor.java
+0
-46
safe-campus-framework/src/main/java/com/tangguo/framework/mauth/MobileWebMvcConfig.java
.../java/com/tangguo/framework/mauth/MobileWebMvcConfig.java
+0
-32
safe-campus-framework/src/main/java/com/tangguo/framework/web/exception/GlobalExceptionHandler.java
...ngguo/framework/web/exception/GlobalExceptionHandler.java
+0
-20
safe-campus-framework/src/main/java/com/tangguo/framework/web/service/SysLoginService.java
...va/com/tangguo/framework/web/service/SysLoginService.java
+48
-0
safe-campus-framework/src/main/java/com/tangguo/framework/web/service/UserDetailsServiceImpl.java
...tangguo/framework/web/service/UserDetailsServiceImpl.java
+17
-0
safe-campus-moment/src/main/java/com/tangguo/controller/mobile/MBbsMomentController.java
...a/com/tangguo/controller/mobile/MBbsMomentController.java
+3
-16
safe-campus-moment/src/main/java/com/tangguo/controller/mobile/MBbsTopicController.java
...va/com/tangguo/controller/mobile/MBbsTopicController.java
+0
-5
safe-campus-moment/src/main/java/com/tangguo/controller/mobile/MBbsUserController.java
...ava/com/tangguo/controller/mobile/MBbsUserController.java
+6
-39
safe-campus-moment/src/main/java/com/tangguo/domain/BbsMoment.java
...us-moment/src/main/java/com/tangguo/domain/BbsMoment.java
+1
-1
safe-campus-moment/src/main/java/com/tangguo/domain/BbsMomentComment.java
...nt/src/main/java/com/tangguo/domain/BbsMomentComment.java
+1
-1
safe-campus-moment/src/main/java/com/tangguo/domain/vo/BbsCommentDetailVO.java
...c/main/java/com/tangguo/domain/vo/BbsCommentDetailVO.java
+1
-1
safe-campus-moment/src/main/java/com/tangguo/domain/vo/BbsCommentVO.java
...ent/src/main/java/com/tangguo/domain/vo/BbsCommentVO.java
+1
-1
safe-campus-moment/src/main/java/com/tangguo/domain/vo/BbsMomentDetailVO.java
...rc/main/java/com/tangguo/domain/vo/BbsMomentDetailVO.java
+1
-1
safe-campus-moment/src/main/java/com/tangguo/domain/vo/BbsMomentListVO.java
.../src/main/java/com/tangguo/domain/vo/BbsMomentListVO.java
+1
-1
safe-campus-moment/src/main/java/com/tangguo/domain/vo/BbsVoteVO.java
...moment/src/main/java/com/tangguo/domain/vo/BbsVoteVO.java
+1
-1
safe-campus-moment/src/main/java/com/tangguo/mapper/BbsUserMapper.java
...oment/src/main/java/com/tangguo/mapper/BbsUserMapper.java
+0
-16
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsMomentServiceImpl.java
...n/java/com/tangguo/service/impl/BbsMomentServiceImpl.java
+14
-13
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsTopicServiceImpl.java
...in/java/com/tangguo/service/impl/BbsTopicServiceImpl.java
+2
-2
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsUserService.java
...rc/main/java/com/tangguo/service/impl/BbsUserService.java
+0
-81
safe-campus-moment/src/main/resources/mapper/BbsMomentCommentMapper.xml
...ment/src/main/resources/mapper/BbsMomentCommentMapper.xml
+4
-4
safe-campus-moment/src/main/resources/mapper/BbsMomentMapper.xml
...mpus-moment/src/main/resources/mapper/BbsMomentMapper.xml
+9
-7
safe-campus-moment/src/main/resources/mapper/BbsMomentVoteMapper.xml
...-moment/src/main/resources/mapper/BbsMomentVoteMapper.xml
+1
-1
safe-campus-moment/src/main/resources/mapper/BbsUserMapper.xml
...campus-moment/src/main/resources/mapper/BbsUserMapper.xml
+0
-25
safe-campus-points/src/main/java/com/tangguo/controller/BbsUserPointsExchangeController.java
...m/tangguo/controller/BbsUserPointsExchangeController.java
+0
-17
safe-campus-points/src/main/java/com/tangguo/domain/BbsUserPoints.java
...oints/src/main/java/com/tangguo/domain/BbsUserPoints.java
+1
-1
safe-campus-points/src/main/java/com/tangguo/domain/BbsUserPointsExchange.java
...c/main/java/com/tangguo/domain/BbsUserPointsExchange.java
+1
-1
safe-campus-points/src/main/java/com/tangguo/mapper/BbsUserPointsExchangeMapper.java
.../java/com/tangguo/mapper/BbsUserPointsExchangeMapper.java
+0
-4
safe-campus-points/src/main/java/com/tangguo/mapper/BbsUserPointsMapper.java
...src/main/java/com/tangguo/mapper/BbsUserPointsMapper.java
+1
-8
safe-campus-points/src/main/java/com/tangguo/service/IBbsUserPointsService.java
.../main/java/com/tangguo/service/IBbsUserPointsService.java
+9
-0
safe-campus-points/src/main/java/com/tangguo/service/impl/BbsUserPointsExchangeServiceImpl.java
...angguo/service/impl/BbsUserPointsExchangeServiceImpl.java
+1
-1
safe-campus-points/src/main/java/com/tangguo/service/impl/BbsUserPointsServiceImpl.java
...va/com/tangguo/service/impl/BbsUserPointsServiceImpl.java
+20
-6
safe-campus-points/src/main/resources/mapper/BbsGradeMapper.xml
...ampus-points/src/main/resources/mapper/BbsGradeMapper.xml
+0
-2
safe-campus-points/src/main/resources/mapper/BbsPointsSettingMapper.xml
...ints/src/main/resources/mapper/BbsPointsSettingMapper.xml
+0
-1
safe-campus-points/src/main/resources/mapper/BbsUserPointsExchangeMapper.xml
...src/main/resources/mapper/BbsUserPointsExchangeMapper.xml
+2
-27
safe-campus-points/src/main/resources/mapper/BbsUserPointsMapper.xml
...-points/src/main/resources/mapper/BbsUserPointsMapper.xml
+12
-17
No files found.
safe-campus-admin/src/main/java/com/tangguo/web/controller/system/SysLoginController.java
View file @
2f3f5e92
...
...
@@ -6,6 +6,7 @@ import com.tangguo.common.core.domain.entity.SysMenu;
import
com.tangguo.common.core.domain.entity.SysUser
;
import
com.tangguo.common.core.domain.model.LoginBody
;
import
com.tangguo.common.utils.SecurityUtils
;
import
com.tangguo.common.core.domain.model.WxcpCodeLogin
;
import
com.tangguo.framework.web.service.SysLoginService
;
import
com.tangguo.framework.web.service.SysPermissionService
;
import
com.tangguo.system.service.ISysMenuService
;
...
...
@@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
/**
...
...
@@ -80,4 +82,32 @@ public class SysLoginController {
List
<
SysMenu
>
menus
=
menuService
.
selectMenuTreeByUserId
(
userId
);
return
AjaxResult
.
success
(
menuService
.
buildMenus
(
menus
));
}
/**
* 企微用户Code登录
*
* @param bo 登录参数
* @return 登录结果
*/
@PostMapping
(
"/bbs/mobile/user/code/login"
)
public
AjaxResult
codeLogin
(
@RequestBody
WxcpCodeLogin
bo
)
{
Map
<
String
,
Object
>
tokenMap
=
this
.
loginService
.
codeLogin
(
bo
);
return
AjaxResult
.
success
(
tokenMap
);
}
/**
* 查询用户信息
*
* @return 用户信息
*/
@GetMapping
(
"/bbs/mobile/user/profile"
)
public
AjaxResult
getUserProfile
()
{
SysUser
sysUser
=
SecurityUtils
.
getLoginUser
().
getUser
();
return
AjaxResult
.
success
(
sysUser
);
}
}
safe-campus-bbs-ui/src/views/comment/index.vue
View file @
2f3f5e92
...
...
@@ -6,7 +6,7 @@
<el-input
v-model=
"queryParams.content"
placeholder=
"请输入"
></el-input>
</el-form-item>
<el-form-item
label=
"姓名"
>
<el-input
v-model=
"queryParams.ni
ke
Name"
placeholder=
"请输入"
></el-input>
<el-input
v-model=
"queryParams.ni
ck
Name"
placeholder=
"请输入"
></el-input>
</el-form-item>
<el-form-item
label=
"账号"
>
<el-input
v-model=
"queryParams.userName"
placeholder=
"请输入"
></el-input>
...
...
@@ -24,7 +24,7 @@
<el-table-column
label=
"评论内容"
prop=
"content"
align=
"center"
></el-table-column>
<el-table-column
label=
"所属动态"
prop=
"momentContent"
align=
"center"
></el-table-column>
<el-table-column
label=
"账号"
prop=
"userName"
align=
"center"
></el-table-column>
<el-table-column
label=
"姓名"
prop=
"ni
ke
Name"
align=
"center"
></el-table-column>
<el-table-column
label=
"姓名"
prop=
"ni
ck
Name"
align=
"center"
></el-table-column>
<el-table-column
label=
"创建时间"
prop=
"createTime"
align=
"center"
></el-table-column>
<el-table-column
label=
"操作"
align=
"center"
>
<template
#default
="
{ row }">
...
...
@@ -110,4 +110,4 @@ export default {
overflow
:
auto
;
}
}
</
style
>
\ No newline at end of file
</
style
>
safe-campus-bbs-ui/src/views/moments/DetailDialog.vue
View file @
2f3f5e92
...
...
@@ -3,7 +3,7 @@
<div
class=
"dynamic-item"
>
<div
class=
"user-info-box"
>
<img
class=
"avatar"
src=
"@/assets/images/default-avatar.png"
></img>
<div
class=
"user-name"
>
{{
form
.
ni
ke
Name
}}
</div>
<div
class=
"user-name"
>
{{
form
.
ni
ck
Name
}}
</div>
<img
class=
"more-icon"
src=
"@/assets/images/more-icon.png"
></img>
</div>
<div
class=
"topics-box"
v-if=
"form.topicNames && form.topicNames.length > 0"
>
...
...
@@ -54,7 +54,7 @@
<div
class=
"comment-display-box"
v-if=
"form.comments && form.comments.length > 0"
>
<div
class=
"comment-item"
v-for=
"(item, index) in form.comments"
>
<div
class=
"user-info"
>
<div
class=
"username"
>
{{ item.ni
ke
Name }}:
</div>
<div
class=
"username"
>
{{ item.ni
ck
Name }}:
</div>
<div
class=
"datetime"
>
2025-07-01 04:21:21
</div>
</div>
<div
class=
"content"
>
{{ item.content }}
</div>
...
...
@@ -333,4 +333,4 @@ export default {
}
}
}
</
style
>
\ No newline at end of file
</
style
>
safe-campus-bbs-ui/src/views/moments/index.vue
View file @
2f3f5e92
...
...
@@ -23,7 +23,7 @@
<el-table-column
label=
"动态内容"
prop=
"content"
align=
"center"
></el-table-column>
<el-table-column
label=
"话题"
align=
"center"
prop=
"topicNames"
width=
"240"
></el-table-column>
<el-table-column
label=
"帐号"
prop=
"userName"
align=
"center"
width=
"140"
></el-table-column>
<el-table-column
label=
"姓名"
prop=
"ni
ke
Name"
align=
"center"
width=
"120"
></el-table-column>
<el-table-column
label=
"姓名"
prop=
"ni
ck
Name"
align=
"center"
width=
"120"
></el-table-column>
<el-table-column
label=
"点赞数"
prop=
"likeCount"
align=
"center"
width=
"100"
></el-table-column>
<el-table-column
label=
"评论数"
prop=
"commentCount"
align=
"center"
width=
"100"
></el-table-column>
<el-table-column
label=
"创建时间"
prop=
"createTime"
align=
"center"
width=
"160"
></el-table-column>
...
...
@@ -76,7 +76,7 @@ export default {
this
.
total
=
res
.
total
})
},
// 新增
handleDetail
(
row
)
{
this
.
$refs
.
detailDialogRef
.
openModal
(
row
)
...
...
@@ -121,4 +121,4 @@ export default {
overflow
:
auto
;
}
}
</
style
>
\ No newline at end of file
</
style
>
safe-campus-bbs-ui/src/views/pointsExchange/index.vue
View file @
2f3f5e92
...
...
@@ -30,7 +30,7 @@
</el-row>
<el-table
:data=
"tableList"
>
<el-table-column
label=
"序号"
width=
"55"
type=
"index"
align=
"center"
></el-table-column>
<el-table-column
label=
"兑换人"
prop=
"ni
ke
Name"
align=
"center"
></el-table-column>
<el-table-column
label=
"兑换人"
prop=
"ni
ck
Name"
align=
"center"
></el-table-column>
<el-table-column
label=
"兑换商品"
align=
"center"
prop=
"goodsName"
></el-table-column>
<el-table-column
label=
"兑换积分"
prop=
"goodsExchangePoints"
align=
"center"
></el-table-column>
<el-table-column
label=
"兑换时间"
prop=
"createTime"
align=
"center"
></el-table-column>
...
...
@@ -145,4 +145,4 @@ export default {
overflow
:
auto
;
}
}
</
style
>
\ No newline at end of file
</
style
>
safe-campus-bbs-ui/src/views/pointsManage/ExchangeDialog.vue
View file @
2f3f5e92
...
...
@@ -4,7 +4,7 @@
<el-form-item
label=
"兑换人"
>
<el-select
placeholder=
"请选择"
style=
"width: 100%;"
v-model=
"form.userName"
@
change=
"handleUserChange"
>
<el-option
v-for=
"(item, index) in userList"
:key=
"index"
:value=
"item.userName"
:label=
"item.ni
ke
Name"
></el-option>
:label=
"item.ni
ck
Name"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"会员等级"
>
...
...
@@ -60,7 +60,7 @@ export default {
if
(
row
&&
row
.
userName
)
{
res
.
data
.
forEach
((
item
)
=>
{
if
(
item
.
userName
==
row
.
userName
)
{
this
.
form
.
ni
keName
=
item
.
nike
Name
;
this
.
form
.
ni
ckName
=
item
.
nick
Name
;
this
.
form
.
gradeName
=
item
.
gradeName
}
})
...
...
@@ -71,7 +71,7 @@ export default {
handleUserChange
(
val
)
{
this
.
userList
.
forEach
((
item
)
=>
{
if
(
item
.
userName
==
val
)
{
this
.
form
.
ni
keName
=
item
.
nike
Name
;
this
.
form
.
ni
ckName
=
item
.
nick
Name
;
this
.
form
.
gradeName
=
item
.
gradeName
this
.
form
.
currentPoints
=
item
.
currentPoints
}
...
...
@@ -85,8 +85,8 @@ export default {
})
},
handleConfirm
()
{
let
{
ni
ke
Name
,
userName
,
userGradeName
,
goodsCode
}
=
this
.
form
let
data
=
{
ni
ke
Name
,
userName
,
userGradeName
,
goodsCode
}
let
{
ni
ck
Name
,
userName
,
userGradeName
,
goodsCode
}
=
this
.
form
let
data
=
{
ni
ck
Name
,
userName
,
userGradeName
,
goodsCode
}
this
.
$refs
.
formRef
.
validate
((
valid
)
=>
{
if
(
valid
)
{
exchange
(
data
).
then
(
res
=>
{
...
...
@@ -115,4 +115,4 @@ export default {
padding
:
0
20px
!
important
;
}
}
</
style
>
\ No newline at end of file
</
style
>
safe-campus-bbs-ui/src/views/pointsManage/index.vue
View file @
2f3f5e92
...
...
@@ -3,7 +3,7 @@
<div
class=
"page-container"
>
<el-form
:model=
"queryParams"
:inline=
"true"
label-width=
"80px"
>
<el-form-item
label=
"姓名"
>
<el-input
v-model=
"queryParams.ni
ke
Name"
placeholder=
"请输入"
style=
"width: 220px;"
></el-input>
<el-input
v-model=
"queryParams.ni
ck
Name"
placeholder=
"请输入"
style=
"width: 220px;"
></el-input>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"handleQuery"
>
查询
</el-button>
...
...
@@ -17,7 +17,7 @@
</el-row>
<el-table
:data=
"tableList"
>
<el-table-column
label=
"序号"
width=
"55"
type=
"index"
align=
"center"
></el-table-column>
<el-table-column
label=
"姓名"
prop=
"ni
ke
Name"
align=
"center"
></el-table-column>
<el-table-column
label=
"姓名"
prop=
"ni
ck
Name"
align=
"center"
></el-table-column>
<el-table-column
label=
"帐号"
prop=
"userName"
align=
"center"
></el-table-column>
<el-table-column
label=
"部门"
prop=
"deptName"
align=
"center"
></el-table-column>
<el-table-column
label=
"总积分"
prop=
"accumulatedPoints"
align=
"center"
></el-table-column>
...
...
@@ -180,4 +180,4 @@ export default {
overflow
:
auto
;
}
}
</
style
>
\ No newline at end of file
</
style
>
safe-campus-bbs-uniapp/components/Comment-Item.vue
View file @
2f3f5e92
...
...
@@ -12,7 +12,7 @@
<view
class=
"comment-display-box"
v-else
>
<view
class=
"comment-item"
v-for=
"(item,index) in list"
>
<view
class=
"user-info"
>
<view
class=
"username"
>
{{
item
.
ni
ke
Name
}}
:
</view>
<view
class=
"username"
>
{{
item
.
ni
ck
Name
}}
:
</view>
<view
class=
"datetime"
>
{{
item
.
createTime
}}
</view>
</view>
<view
class=
"content"
>
...
...
@@ -28,7 +28,7 @@
<view
v-if=
"form.isSelf==1&&activeIndex==1"
@
click=
"handleDelete(item)"
>
删除
</view>
</view>
</view>
</view>
</view>
...
...
@@ -221,7 +221,7 @@
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
}
.add-text
{
...
...
@@ -231,4 +231,4 @@
}
}
}
</
style
>
\ No newline at end of file
</
style
>
safe-campus-bbs-uniapp/components/Dynamic-Item.vue
View file @
2f3f5e92
...
...
@@ -3,7 +3,7 @@
<view
class=
"dynamic-item"
@
click=
"toDynamicDetailPage"
>
<view
class=
"user-info-box"
>
<image
class=
"avatar"
src=
"/static/images/default-avatar.png"
></image>
<view
class=
"user-name"
>
{{
form
.
ni
ke
Name
}}
</view>
<view
class=
"user-name"
>
{{
form
.
ni
ck
Name
}}
</view>
<image
class=
"more-icon"
src=
"/static/images/more-icon.png"
></image>
</view>
<view
class=
"topics-box"
v-if=
"form.topicNames && form.topicNames.length >0"
>
...
...
@@ -67,7 +67,7 @@
<view
class=
"results-item right-item"
></view>
</view>
</view>
<view
class=
"results-sum"
@
click.stop=
"toPKDetailPage(0)"
>
<view>
{{form.voteCount}}人参与
</view>
<image
src=
"/static/images/detail-icon.png"
class=
"icon"
></image>
...
...
@@ -79,7 +79,7 @@
<view
class=
"comment-display-box"
v-if=
"form.comments&& form.comments.length>0"
>
<view
class=
"comment-item"
v-for=
"(item,index) in form.comments"
>
<view
class=
"user-info"
>
<view
class=
"username"
>
{{item.ni
ke
Name}}:
</view>
<view
class=
"username"
>
{{item.ni
ck
Name}}:
</view>
<view
class=
"datetime"
>
2025-07-01 04:21:21
</view>
</view>
<view
class=
"content"
v-if=
"!item.replyNikeName"
@
click.stop=
"handleReplayComment(item)"
>
{{item.content}}
</view>
...
...
@@ -99,7 +99,7 @@
<
script
>
import
{
dynamicLikeUnlike
,
dynamicVote
}
from
'
@/api/api.js
'
import
PublishComment
from
'
./PublishComment.vue
'
;
...
...
@@ -145,7 +145,7 @@
console
.
log
(
item
)
this
.
$refs
.
publishCommentRef
.
openModal
(
item
)
},
// 投票
handleVote
(
item
)
{
let
data
=
{
...
...
@@ -190,4 +190,4 @@
<
style
lang=
"scss"
>
@import
'@/static/styles/index.scss'
;
</
style
>
\ No newline at end of file
</
style
>
safe-campus-bbs-uniapp/components/PublishComment.vue
View file @
2f3f5e92
...
...
@@ -34,7 +34,7 @@
if
(
item
){
// 不为空为回复
this
.
parentId
=
item
.
id
;
this
.
placeholder
=
'
回复:
'
+
item
.
ni
ke
Name
this
.
placeholder
=
'
回复:
'
+
item
.
ni
ck
Name
}
},
// 关闭评论区
...
...
@@ -66,4 +66,4 @@
<
style
lang=
"scss"
>
@import
'@/static/styles/index.scss'
;
</
style
>
\ No newline at end of file
</
style
>
safe-campus-bbs-uniapp/pages/mine/mine.vue
View file @
2f3f5e92
...
...
@@ -6,7 +6,7 @@
<image
v-if=
"!userInfo.avatarUrl"
src=
"/static/images/default-avatar.png"
class=
"avatar"
></image>
<image
v-else
:src=
"userInfo.avatarUrl"
class=
"avatar"
></image>
<view
class=
"name-class"
>
<view
class=
"name"
>
{{
userInfo
.
ni
ke
Name
}}
</view>
<view
class=
"name"
>
{{
userInfo
.
ni
ck
Name
}}
</view>
<view
class=
"class-name"
>
{{
userInfo
.
deptName
}}
</view>
</view>
<image
src=
"/static/images/mine/detail-icon-white.png"
class=
"more"
></image>
...
...
@@ -172,4 +172,4 @@
margin-top
:
40rpx
;
height
:
calc
(
100vh
-
570rpx
);
}
</
style
>
\ No newline at end of file
</
style
>
safe-campus-bbs-uniapp/pages/pk-detail/pk-detail.vue
View file @
2f3f5e92
...
...
@@ -9,11 +9,11 @@
<scroll-view
class=
"scroll-view-pk"
v-if=
"list.length>0"
>
<view
class=
"list-item"
v-for=
"(item,index) in list"
>
<image
src=
"/static/images/default-avatar.png"
class=
"avatar"
></image>
<view
class=
"name"
>
{{
item
.
ni
ke
Name
}}
</view>
<view
class=
"name"
>
{{
item
.
ni
ck
Name
}}
</view>
<view
class=
"datetime"
>
{{
item
.
createTime
}}
</view>
</view>
</scroll-view>
</view>
</
template
>
...
...
@@ -127,4 +127,4 @@
}
}
}
</
style
>
\ No newline at end of file
</
style
>
safe-campus-
moment/src/main/java/com/tangguo/domain/bo/CodeLoginBO
.java
→
safe-campus-
common/src/main/java/com/tangguo/common/core/domain/model/WxcpCodeLogin
.java
View file @
2f3f5e92
package
com
.
tangguo
.
domain
.
bo
;
package
com
.
tangguo
.
common
.
core
.
domain
.
model
;
import
lombok.Data
;
...
...
@@ -9,7 +9,7 @@ import lombok.Data;
* @createTime 2025-09-02 14:53:19 星期二
*/
@Data
public
class
CodeLoginBO
{
public
class
WxcpCodeLogin
{
/**
* 企微Code
...
...
safe-campus-common/src/main/java/com/tangguo/common/domain/QwmhUserInfo.java
deleted
100644 → 0
View file @
63de3ec6
package
com
.
tangguo
.
common
.
domain
;
import
lombok.Data
;
/**
* 企微门户用户
*
* @author 谈笑
* @createTime 2025-08-29 16:13:32 星期五
*/
@Data
public
class
QwmhUserInfo
{
/**
* 用户Id
*/
private
String
userId
;
/**
* 用户名
*/
private
String
userName
;
/**
* 用户姓名
*/
private
String
nikeName
;
/**
* 用户头像
*/
private
String
avatarUrl
;
/**
* 部门名称
*/
private
String
deptName
;
/**
* 用户等级
*/
private
String
gradeName
;
/**
* 当前积分
*/
private
Integer
currentPoints
;
/**
* 累计积分
*/
private
Integer
accumulatedPoints
;
}
safe-campus-common/src/main/java/com/tangguo/common/mauth/Mobile401Exception.java
deleted
100644 → 0
View file @
63de3ec6
package
com
.
tangguo
.
common
.
mauth
;
import
lombok.Getter
;
/**
* 移动端用户身份认证失败异常类
*
* @author 谈笑
* @createTime 2025-09-02 14:42:17 星期二
*/
@Getter
public
class
Mobile401Exception
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
-
4189845692674690824L
;
/**
* 状态码
*/
private
final
int
code
=
401
;
/**
* 异常消息
*/
private
final
String
message
;
public
Mobile401Exception
(
String
message
)
{
this
.
message
=
message
;
}
public
Mobile401Exception
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
this
.
message
=
message
;
}
}
safe-campus-common/src/main/java/com/tangguo/common/mauth/Mobile403Exception.java
deleted
100644 → 0
View file @
63de3ec6
package
com
.
tangguo
.
common
.
mauth
;
import
lombok.Getter
;
/**
* 移动端用户鉴权失败异常类
*
* @author 谈笑
* @createTime 2025-09-02 14:42:17 星期二
*/
@Getter
public
class
Mobile403Exception
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
4027402152375922779L
;
/**
* 状态码
*/
private
final
int
code
=
403
;
/**
* 异常消息
*/
private
final
String
message
;
public
Mobile403Exception
(
String
message
)
{
this
.
message
=
message
;
}
public
Mobile403Exception
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
this
.
message
=
message
;
}
}
safe-campus-common/src/main/java/com/tangguo/common/mauth/MobileAuth.java
deleted
100644 → 0
View file @
63de3ec6
package
com
.
tangguo
.
common
.
mauth
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* 移动端用户身份认证注解
*
*/
@Target
(
ElementType
.
METHOD
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
MobileAuth
{
}
safe-campus-common/src/main/java/com/tangguo/common/mauth/MobileProperties.java
deleted
100644 → 0
View file @
63de3ec6
package
com
.
tangguo
.
common
.
mauth
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.stereotype.Component
;
import
java.time.Duration
;
/**
* 移动端用户Token配置参数
*
* @author 谈笑
* @createTime 2025-09-02 14:42:17 星期二
*/
@Getter
@Setter
@Component
@ConfigurationProperties
(
prefix
=
"mobile.auth"
)
public
class
MobileProperties
{
/**
* 生成时Token参数名
*/
private
String
resTokenName
;
/**
* 请求时Token参数名
*/
private
String
reqTokenName
;
/**
* Token签发人
*/
private
String
issuer
=
"MobileAuth"
;
/**
* Token签名算法
*/
private
String
algorithmId
=
"HS512"
;
/**
* Token签名密钥
*/
private
String
signKey
=
"SignKey2025@."
;
/**
* Token有效时间
*/
private
Duration
effectiveTime
=
Duration
.
ofDays
(
7
);
/**
* 拦截器拦截路径
*/
private
String
[]
pathPatterns
=
{
"/mobile/**"
};
}
safe-campus-common/src/main/java/com/tangguo/common/mauth/MobileTokenHelper.java
deleted
100644 → 0
View file @
63de3ec6
package
com
.
tangguo
.
common
.
mauth
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.map.MapUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.jwt.JWT
;
import
cn.hutool.jwt.JWTValidator
;
import
cn.hutool.jwt.signers.JWTSigner
;
import
cn.hutool.jwt.signers.JWTSignerUtil
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.request.RequestAttributes
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.time.Instant
;
import
java.util.Date
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.Objects
;
/**
* 移动端用户Token处理
*
* @author 谈笑
* @createTime 2025-09-02 14:42:17 星期二
*/
@Component
public
class
MobileTokenHelper
{
private
static
MobileProperties
properties
;
@Resource
public
void
setProperties
(
MobileProperties
properties
)
{
MobileTokenHelper
.
properties
=
properties
;
}
/**
* 计算Token过期时间
*
* @return Token过期时间
*/
private
static
Date
getTokenExpiredTime
()
{
return
Date
.
from
(
Instant
.
now
().
plus
(
properties
.
getEffectiveTime
()));
}
/**
* 获取Token签名器
*
* @return Token签名器
*/
private
static
JWTSigner
getTokenSigner
()
{
return
JWTSignerUtil
.
createSigner
(
properties
.
getAlgorithmId
(),
properties
.
getSignKey
().
getBytes
()
);
}
/**
* 构建JWT实体 (只填充了关键参数,并未签名。)
*
* @return JWT实体
*/
private
static
JWT
buildJWT
()
{
JWT
jwtToken
=
JWT
.
create
();
jwtToken
.
setIssuer
(
properties
.
getIssuer
());
jwtToken
.
setIssuedAt
(
new
Date
());
jwtToken
.
setExpiresAt
(
getTokenExpiredTime
());
jwtToken
.
setSigner
(
getTokenSigner
());
return
jwtToken
;
}
/**
* 创建Token
*
* @param payloads 荷载参数
* @return Token字符串
*/
public
static
String
createToken
(
Map
<
String
,
Object
>
payloads
)
{
JWT
jwtToken
=
buildJWT
();
if
(
MapUtil
.
isNotEmpty
(
payloads
))
{
payloads
.
forEach
(
jwtToken:
:
setPayload
);
}
return
jwtToken
.
sign
();
}
/**
* 创建Token,并返回Token明细信息。
*
* @param payloads 荷载参数
* @return Token字符串
*/
public
static
Map
<
String
,
Object
>
createDetailToken
(
Map
<
String
,
Object
>
payloads
)
{
String
token
=
createToken
(
payloads
);
Map
<
String
,
Object
>
detailTokenMap
=
new
LinkedHashMap
<>(
2
);
detailTokenMap
.
put
(
properties
.
getResTokenName
(),
token
);
detailTokenMap
.
put
(
"expiredTime"
,
DateUtil
.
formatDateTime
(
getTokenExpiredTime
()));
return
detailTokenMap
;
}
/**
* 获取当前用户Token
*
* @return 用户Token
*/
public
static
String
getCurrentToken
()
{
try
{
RequestAttributes
attributes
=
RequestContextHolder
.
getRequestAttributes
();
ServletRequestAttributes
requestAttributes
=
(
ServletRequestAttributes
)
attributes
;
if
(
Objects
.
isNull
(
requestAttributes
))
{
return
null
;
}
HttpServletRequest
request
=
requestAttributes
.
getRequest
();
String
tokenValue
=
request
.
getHeader
(
properties
.
getReqTokenName
());
if
(
tokenValue
.
startsWith
(
"Bearer"
))
{
tokenValue
=
tokenValue
.
replace
(
"Bearer "
,
""
);
}
return
tokenValue
;
}
catch
(
Exception
e
)
{
return
null
;
}
}
/**
* 验证Token
*
* @param token Token字符串
* @return 验证结果
*/
public
static
boolean
verifyToken
(
String
token
)
{
if
(
StrUtil
.
isBlank
(
token
))
{
return
false
;
}
try
{
// 验证Token的签名和时效
return
JWT
.
of
(
token
).
setSigner
(
getTokenSigner
()).
validate
(
0L
);
}
catch
(
Exception
e
)
{
return
false
;
}
}
/**
* 校验Token
*
* @param token Token字符串
*/
public
static
JWT
verifyParseToken
(
String
token
)
{
if
(
StrUtil
.
isBlank
(
token
))
{
throw
new
Mobile401Exception
(
"身份认证失败,未获取到用户认证信息。"
);
}
try
{
// 验证Token的签名和时效
JWTValidator
.
of
(
token
).
validateAlgorithm
(
getTokenSigner
()).
validateDate
();
return
JWT
.
of
(
token
);
}
catch
(
Exception
e
)
{
throw
new
Mobile401Exception
(
"身份认证失败,当前用户认证信息已失效或已过期。"
);
}
}
/**
* 获取当前用户Token荷载信息
*
* @return Token荷载信息
*/
public
static
JSONObject
getTokenPayloads
()
{
return
verifyParseToken
(
getCurrentToken
()).
getPayloads
();
}
/**
* 获取当前用户名
*
* @return 用户名
*/
public
static
String
getUserName
()
{
try
{
String
username
=
getTokenPayloads
().
getStr
(
"userName"
);
if
(
StrUtil
.
isNotBlank
(
username
))
{
return
username
;
}
else
{
throw
new
Mobile401Exception
(
"身份认证失败,未获取到当前用户身份信息。"
);
}
}
catch
(
Mobile401Exception
e
)
{
throw
e
;
}
catch
(
Exception
e
)
{
throw
new
Mobile401Exception
(
"获取当前用户身份信息获取失败。"
);
}
}
/**
* 获取当前用户姓名
*
* @return 用户名
*/
public
static
String
getNikeName
()
{
try
{
String
nikeName
=
getTokenPayloads
().
getStr
(
"nikeName"
);
if
(
StrUtil
.
isNotBlank
(
nikeName
))
{
return
nikeName
;
}
else
{
throw
new
Mobile401Exception
(
"身份认证失败,未获取到当前用户身份信息。"
);
}
}
catch
(
Mobile401Exception
e
)
{
throw
e
;
}
catch
(
Exception
e
)
{
throw
new
Mobile401Exception
(
"获取当前用户身份信息获取失败。"
);
}
}
}
safe-campus-framework/src/main/java/com/tangguo/framework/config/ResourcesConfig.java
View file @
2f3f5e92
...
...
@@ -2,7 +2,6 @@ package com.tangguo.framework.config;
import
com.tangguo.common.config.RuoYiConfig
;
import
com.tangguo.common.constant.Constants
;
import
com.tangguo.common.mauth.MobileProperties
;
import
com.tangguo.framework.interceptor.RepeatSubmitInterceptor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
...
...
@@ -28,9 +27,6 @@ public class ResourcesConfig implements WebMvcConfigurer {
@Autowired
private
RepeatSubmitInterceptor
repeatSubmitInterceptor
;
@Resource
private
MobileProperties
mobileProperties
;
@Override
public
void
addResourceHandlers
(
ResourceHandlerRegistry
registry
)
{
...
...
@@ -50,8 +46,7 @@ public class ResourcesConfig implements WebMvcConfigurer {
*/
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
registry
.
addInterceptor
(
repeatSubmitInterceptor
).
addPathPatterns
(
"/**"
)
.
excludePathPatterns
(
this
.
mobileProperties
.
getPathPatterns
());
registry
.
addInterceptor
(
repeatSubmitInterceptor
).
addPathPatterns
(
"/**"
);
}
/**
...
...
safe-campus-framework/src/main/java/com/tangguo/framework/config/SecurityConfig.java
View file @
2f3f5e92
package
com
.
tangguo
.
framework
.
config
;
import
com.tangguo.common.mauth.MobileProperties
;
import
com.tangguo.framework.config.properties.PermitAllUrlProperties
;
import
com.tangguo.framework.security.filter.JwtAuthenticationTokenFilter
;
import
com.tangguo.framework.security.handle.AuthenticationEntryPointImpl
;
...
...
@@ -66,10 +65,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private
PermitAllUrlProperties
permitAllUrl
;
@Resource
private
MobileProperties
mobileProperties
;
/**
* 解决 无法直接注入 AuthenticationManager
*
...
...
@@ -115,14 +110,11 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// 过滤请求
.
authorizeRequests
()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
.
antMatchers
(
"/login"
,
"/register"
,
"/captchaImage"
).
permitAll
()
.
antMatchers
(
"/login"
,
"/
bbs/mobile/user/code/login"
,
"/
register"
,
"/captchaImage"
).
permitAll
()
// 静态资源,可匿名访问
.
antMatchers
(
HttpMethod
.
GET
,
"/"
,
"/*.html"
,
"/**/*.html"
,
"/**/*.css"
,
"/**/*.js"
,
"/profile/**"
).
permitAll
()
.
antMatchers
(
"/swagger-ui.html"
,
"/swagger-resources/**"
,
"/webjars/**"
,
"/*/api-docs"
,
"/druid/**"
).
permitAll
()
// 移动端接口
.
antMatchers
(
this
.
mobileProperties
.
getPathPatterns
()).
permitAll
()
// 除上面外的所有请求全部需要鉴权认证
.
anyRequest
().
authenticated
()
.
and
()
...
...
safe-campus-framework/src/main/java/com/tangguo/framework/mauth/MobileAuthInterceptor.java
deleted
100644 → 0
View file @
63de3ec6
package
com
.
tangguo
.
framework
.
mauth
;
import
com.tangguo.common.mauth.MobileAuth
;
import
com.tangguo.common.mauth.MobileTokenHelper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.servlet.HandlerInterceptor
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.lang.reflect.Method
;
import
java.util.Objects
;
/**
* 移动端用户认证拦截器
*
* @author 谈笑
* @createTime 2025-09-02 14:42:17 星期二
*/
@Slf4j
@Component
public
class
MobileAuthInterceptor
implements
HandlerInterceptor
{
/**
* 请求被处理之前调用
*/
@Override
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
{
if
(!(
handler
instanceof
HandlerMethod
))
{
return
true
;
}
// 获取处理器方法上的标识注解
Method
method
=
((
HandlerMethod
)
handler
).
getMethod
();
MobileAuth
mobileAuth
=
method
.
getAnnotation
(
MobileAuth
.
class
);
if
(
Objects
.
isNull
(
mobileAuth
))
{
return
true
;
}
String
username
=
MobileTokenHelper
.
getUserName
();
log
.
info
(
"=> 当前移动端请求用户:{}"
,
username
);
return
true
;
}
}
safe-campus-framework/src/main/java/com/tangguo/framework/mauth/MobileWebMvcConfig.java
deleted
100644 → 0
View file @
63de3ec6
package
com
.
tangguo
.
framework
.
mauth
;
import
com.tangguo.common.mauth.MobileProperties
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
/**
* 移动端Web配置
*
* @author 谈笑
* @createTime 2025-09-02 14:42:17 星期二
*/
@RequiredArgsConstructor
@Configuration
public
class
MobileWebMvcConfig
implements
WebMvcConfigurer
{
private
final
MobileProperties
mobileProperties
;
private
final
MobileAuthInterceptor
mobileAuthInterceptor
;
/**
* 自定义拦截规则
*/
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
registry
.
addInterceptor
(
this
.
mobileAuthInterceptor
).
addPathPatterns
(
this
.
mobileProperties
.
getPathPatterns
());
}
}
safe-campus-framework/src/main/java/com/tangguo/framework/web/exception/GlobalExceptionHandler.java
View file @
2f3f5e92
...
...
@@ -5,8 +5,6 @@ import com.tangguo.common.core.domain.AjaxResult;
import
com.tangguo.common.core.domain.R
;
import
com.tangguo.common.exception.DemoModeException
;
import
com.tangguo.common.exception.ServiceException
;
import
com.tangguo.common.mauth.Mobile401Exception
;
import
com.tangguo.common.mauth.Mobile403Exception
;
import
com.tangguo.common.utils.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -107,22 +105,4 @@ public class GlobalExceptionHandler {
return
AjaxResult
.
error
(
"演示模式,不允许操作"
);
}
/**
* 处理用户身份认证失败异常
*/
@ExceptionHandler
(
Mobile401Exception
.
class
)
public
R
<
Object
>
mobile401Exception
(
Mobile401Exception
e
)
{
return
R
.
fail
(
401
,
e
.
getMessage
());
}
/**
* 处理用户权限校验失败异常
*/
@ExceptionHandler
(
Mobile403Exception
.
class
)
public
R
<
Object
>
mobile403Exception
(
Mobile403Exception
e
)
{
return
R
.
fail
(
403
,
e
.
getMessage
());
}
}
safe-campus-framework/src/main/java/com/tangguo/framework/web/service/SysLoginService.java
View file @
2f3f5e92
...
...
@@ -5,6 +5,7 @@ import com.tangguo.common.constant.Constants;
import
com.tangguo.common.constant.UserConstants
;
import
com.tangguo.common.core.domain.entity.SysUser
;
import
com.tangguo.common.core.domain.model.LoginUser
;
import
com.tangguo.common.core.domain.model.WxcpCodeLogin
;
import
com.tangguo.common.core.redis.RedisCache
;
import
com.tangguo.common.exception.ServiceException
;
import
com.tangguo.common.exception.user.*
;
...
...
@@ -17,20 +18,29 @@ import com.tangguo.framework.manager.factory.AsyncFactory;
import
com.tangguo.framework.security.context.AuthenticationContextHolder
;
import
com.tangguo.system.service.ISysConfigService
;
import
com.tangguo.system.service.ISysUserService
;
import
lombok.extern.slf4j.Slf4j
;
import
me.chanjar.weixin.common.error.WxErrorException
;
import
me.chanjar.weixin.cp.api.WxCpService
;
import
me.chanjar.weixin.cp.bean.WxCpOauth2UserInfo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.authentication.AuthenticationManager
;
import
org.springframework.security.authentication.BadCredentialsException
;
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.Objects
;
/**
* 登录校验方法
*
* @author ruoyi
*/
@Slf4j
@Component
public
class
SysLoginService
{
@Autowired
...
...
@@ -48,6 +58,13 @@ public class SysLoginService {
@Autowired
private
ISysConfigService
configService
;
@Autowired
private
UserDetailsServiceImpl
userDetailsServiceImpl
;
@Autowired
private
WxCpService
wxCpService
;
/**
* 登录验证
*
...
...
@@ -156,4 +173,35 @@ public class SysLoginService {
sysUser
.
setLoginDate
(
DateUtils
.
getNowDate
());
userService
.
updateUserProfile
(
sysUser
);
}
/**
* 企微用户Code登录
*
* @param bo 登录参数
* @return 登录结果
*/
public
Map
<
String
,
Object
>
codeLogin
(
WxcpCodeLogin
bo
)
{
String
userName
;
try
{
log
.
info
(
"=> 移动端用户登录:{}"
,
bo
);
WxCpOauth2UserInfo
authUserInfo
=
this
.
wxCpService
.
getOauth2Service
().
getAuthUserInfo
(
bo
.
getCode
());
userName
=
authUserInfo
.
getUserId
();
}
catch
(
WxErrorException
e
)
{
log
.
error
(
"=> 移动端用户登录失败,查询当前企微用户数据失败:"
,
e
);
throw
new
ServiceException
(
"登录失败,查询当前企微用户数据失败。"
);
}
try
{
UserDetails
userDetails
=
this
.
userDetailsServiceImpl
.
loadUserByUsername2
(
userName
);
String
token
=
this
.
tokenService
.
createToken
((
LoginUser
)
userDetails
);
Map
<
String
,
Object
>
resultMap
=
new
LinkedHashMap
<>(
2
);
resultMap
.
put
(
"token"
,
token
);
return
resultMap
;
}
catch
(
Exception
e
)
{
log
.
error
(
"=> 移动端用户登录失败,生成用户Token失败:"
,
e
);
throw
new
ServiceException
(
"登录失败:"
+
e
.
getMessage
());
}
}
}
safe-campus-framework/src/main/java/com/tangguo/framework/web/service/UserDetailsServiceImpl.java
View file @
2f3f5e92
...
...
@@ -51,6 +51,23 @@ public class UserDetailsServiceImpl implements UserDetailsService {
return
createLoginUser
(
user
);
}
public
UserDetails
loadUserByUsername2
(
String
username
)
throws
UsernameNotFoundException
{
SysUser
user
=
userService
.
selectUserByUserName
(
username
);
if
(
StringUtils
.
isNull
(
user
))
{
log
.
info
(
"登录用户:{} 不存在."
,
username
);
throw
new
ServiceException
(
"登录用户:"
+
username
+
" 不存在"
);
}
else
if
(
UserStatus
.
DELETED
.
getCode
().
equals
(
user
.
getDelFlag
()))
{
log
.
info
(
"登录用户:{} 已被删除."
,
username
);
throw
new
ServiceException
(
"对不起,您的账号:"
+
username
+
" 已被删除"
);
}
else
if
(
UserStatus
.
DISABLE
.
getCode
().
equals
(
user
.
getStatus
()))
{
log
.
info
(
"登录用户:{} 已被停用."
,
username
);
throw
new
ServiceException
(
"对不起,您的账号:"
+
username
+
" 已停用"
);
}
return
createLoginUser
(
user
);
}
public
UserDetails
createLoginUser
(
SysUser
user
)
{
return
new
LoginUser
(
user
.
getUserId
(),
user
.
getDeptId
(),
user
,
permissionService
.
getMenuPermission
(
user
));
}
...
...
safe-campus-moment/src/main/java/com/tangguo/controller/mobile/MBbsMomentController.java
View file @
2f3f5e92
...
...
@@ -2,9 +2,8 @@ package com.tangguo.controller.mobile;
import
com.tangguo.common.core.domain.AjaxResult
;
import
com.tangguo.common.core.page.TableDataInfo
;
import
com.tangguo.common.mauth.MobileAuth
;
import
com.tangguo.common.mauth.MobileTokenHelper
;
import
com.tangguo.common.utils.PageUtils
;
import
com.tangguo.common.utils.SecurityUtils
;
import
com.tangguo.common.utils.ValidateOperations
;
import
com.tangguo.domain.bo.*
;
import
com.tangguo.domain.vo.BbsCommentDetailVO
;
...
...
@@ -50,7 +49,6 @@ public class MBbsMomentController {
*
* @return 动态
*/
@MobileAuth
@GetMapping
(
"/moments"
)
public
TableDataInfo
getMoments
(
QueryMomentBO
bo
)
{
PageUtils
.
clearPage
();
...
...
@@ -64,7 +62,6 @@ public class MBbsMomentController {
*
* @return 动态
*/
@MobileAuth
@GetMapping
(
"/{id}"
)
public
AjaxResult
getMomentDetail
(
@PathVariable
Long
id
)
{
BbsMomentListVO
dbMoment
=
this
.
momentService
.
getMomentDetail
(
id
);
...
...
@@ -78,7 +75,6 @@ public class MBbsMomentController {
* @param bo 动态
* @return 创建结果
*/
@MobileAuth
@PostMapping
(
"/create"
)
public
AjaxResult
createMoment
(
@RequestBody
CreateMomentBO
bo
)
{
this
.
momentService
.
userCreateMoment
(
bo
);
...
...
@@ -92,7 +88,6 @@ public class MBbsMomentController {
* @param momentId 动态Id
* @return 删除结果
*/
@MobileAuth
@DeleteMapping
(
"/delete/{momentId}"
)
public
AjaxResult
deleteMoment
(
@PathVariable
Long
momentId
)
{
this
.
momentService
.
userDeleteMoment
(
momentId
);
...
...
@@ -106,7 +101,6 @@ public class MBbsMomentController {
* @param bo 动态
* @return 点赞结果
*/
@MobileAuth
@PostMapping
(
"/like"
)
public
AjaxResult
likeMoment
(
@RequestBody
LikeMomentBO
bo
)
{
ValidateOperations
.
generalValidate
(
bo
);
...
...
@@ -123,7 +117,6 @@ public class MBbsMomentController {
* @param bo 动态
* @return 投票结果
*/
@MobileAuth
@PostMapping
(
"/vote"
)
public
AjaxResult
voteMoment
(
@RequestBody
VoteMomentBO
bo
)
{
ValidateOperations
.
generalValidate
(
bo
);
...
...
@@ -140,7 +133,6 @@ public class MBbsMomentController {
* @param momentId 动态Id
* @return 投票结果
*/
@MobileAuth
@GetMapping
(
"/vote/count"
)
public
AjaxResult
getMomentVoteCount
(
@RequestParam
Long
momentId
)
{
List
<
BbsVoteOptionVO
>
dbOptionCount
=
this
.
momentVoteOptionService
.
getVoteOptionCount
(
momentId
);
...
...
@@ -158,7 +150,6 @@ public class MBbsMomentController {
* @param momentId 动态Id
* @return 投票记录
*/
@MobileAuth
@GetMapping
(
"/votes"
)
public
TableDataInfo
getMomentVotes
(
@RequestParam
Long
momentId
,
@RequestParam
String
optionCode
)
{
PageUtils
.
startPage
();
...
...
@@ -172,12 +163,11 @@ public class MBbsMomentController {
*
* @return 动态
*/
@MobileAuth
@GetMapping
(
"/comments"
)
public
TableDataInfo
getMomentComments
(
@RequestParam
Long
momentId
)
{
String
user
Name
=
MobileTokenHelper
.
getUserN
ame
();
String
user
name
=
SecurityUtils
.
getUsern
ame
();
PageUtils
.
clearPage
();
List
<
BbsCommentDetailVO
>
dbComments
=
this
.
momentCommentService
.
getMomentComments
(
momentId
,
user
N
ame
);
List
<
BbsCommentDetailVO
>
dbComments
=
this
.
momentCommentService
.
getMomentComments
(
momentId
,
user
n
ame
);
return
TableDataInfo
.
getDataTable
(
dbComments
);
}
...
...
@@ -188,7 +178,6 @@ public class MBbsMomentController {
* @param bo 动态
* @return 投票结果
*/
@MobileAuth
@PostMapping
(
"/comment"
)
public
AjaxResult
commentMoment
(
@RequestBody
CommentMomentBO
bo
)
{
ValidateOperations
.
generalValidate
(
bo
);
...
...
@@ -205,7 +194,6 @@ public class MBbsMomentController {
* @param commentId 评论Id
* @return 删除结果
*/
@MobileAuth
@DeleteMapping
(
"/comment/delete/{commentId}"
)
public
AjaxResult
deleteComment
(
@PathVariable
Long
commentId
)
{
this
.
momentService
.
userDeleteComment
(
commentId
);
...
...
@@ -219,7 +207,6 @@ public class MBbsMomentController {
* @param bo 评论
* @return 精选结果
*/
@MobileAuth
@PostMapping
(
"/comment/featured"
)
public
AjaxResult
featuredComment
(
@RequestBody
FeaturedCommentBO
bo
)
{
ValidateOperations
.
generalValidate
(
bo
);
...
...
safe-campus-moment/src/main/java/com/tangguo/controller/mobile/MBbsTopicController.java
View file @
2f3f5e92
...
...
@@ -2,7 +2,6 @@ package com.tangguo.controller.mobile;
import
com.tangguo.common.core.domain.AjaxResult
;
import
com.tangguo.common.core.page.TableDataInfo
;
import
com.tangguo.common.mauth.MobileAuth
;
import
com.tangguo.common.utils.PageUtils
;
import
com.tangguo.common.utils.ValidateOperations
;
import
com.tangguo.domain.bo.CreateTopicBO
;
...
...
@@ -39,7 +38,6 @@ public class MBbsTopicController {
* @param name 话题名称
* @return 话题
*/
@MobileAuth
@GetMapping
(
"/select"
)
public
TableDataInfo
getSelectTopics
(
String
name
)
{
PageUtils
.
startPage
();
...
...
@@ -54,7 +52,6 @@ public class MBbsTopicController {
* @param bo 话题
* @return 创建结果
*/
@MobileAuth
@PostMapping
(
"/create"
)
public
AjaxResult
createTopic
(
@RequestBody
CreateTopicBO
bo
)
{
ValidateOperations
.
generalValidate
(
bo
);
...
...
@@ -68,7 +65,6 @@ public class MBbsTopicController {
*
* @return 话题
*/
@MobileAuth
@GetMapping
(
"/ranking"
)
public
AjaxResult
getRankingTopic
()
{
List
<
BbsTopicListVO
>
dbTopics
=
this
.
topicService
.
getRankingTopic
();
...
...
@@ -82,7 +78,6 @@ public class MBbsTopicController {
* @param bo 查询参数
* @return 话题明细
*/
@MobileAuth
@GetMapping
(
"/moments"
)
public
TableDataInfo
getTopicMoments
(
QueryMomentBO
bo
)
{
PageUtils
.
clearPage
();
...
...
safe-campus-moment/src/main/java/com/tangguo/controller/mobile/MBbsUserController.java
View file @
2f3f5e92
...
...
@@ -2,19 +2,17 @@ package com.tangguo.controller.mobile;
import
com.tangguo.common.core.domain.AjaxResult
;
import
com.tangguo.common.core.page.TableDataInfo
;
import
com.tangguo.common.mauth.MobileAuth
;
import
com.tangguo.common.mauth.MobileTokenHelper
;
import
com.tangguo.common.utils.PageUtils
;
import
com.tangguo.
domain.bo.CodeLoginBO
;
import
com.tangguo.
common.utils.SecurityUtils
;
import
com.tangguo.domain.vo.BbsMomentListVO
;
import
com.tangguo.domain.vo.BbsUserMomentCountVO
;
import
com.tangguo.service.IBbsMomentService
;
import
com.tangguo.service.impl.BbsUserService
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Map
;
/**
* 移动端用户控制器
...
...
@@ -26,48 +24,18 @@ import java.util.Map;
@RequestMapping
(
"/bbs/mobile/user"
)
public
class
MBbsUserController
{
@Resource
private
BbsUserService
bbsUserService
;
@Resource
private
IBbsMomentService
momentService
;
/**
* 企微用户Code登录
*
* @param bo 登录参数
* @return 登录结果
*/
@PostMapping
(
"/code/login"
)
public
AjaxResult
codeLogin
(
@RequestBody
CodeLoginBO
bo
)
{
Map
<
String
,
Object
>
tokenMap
=
this
.
bbsUserService
.
codeLogin
(
bo
);
return
AjaxResult
.
success
(
tokenMap
);
}
/**
* 查询用户信息
*
* @return 用户信息
*/
@MobileAuth
@GetMapping
(
"/profile"
)
public
AjaxResult
getUserProfile
()
{
Map
<
String
,
Object
>
profileMap
=
this
.
bbsUserService
.
getUserProfile
();
return
AjaxResult
.
success
(
profileMap
);
}
/**
* 查询用户动态统计
*
* @return 动态统计
*/
@MobileAuth
@GetMapping
(
"/moment/count"
)
public
AjaxResult
getUserMomentCount
()
{
String
username
=
MobileTokenHelper
.
getUserN
ame
();
String
username
=
SecurityUtils
.
getUsern
ame
();
BbsUserMomentCountVO
momentCount
=
this
.
momentService
.
getUserMomentCount
(
username
);
return
AjaxResult
.
success
(
momentCount
);
}
...
...
@@ -78,10 +46,9 @@ public class MBbsUserController {
*
* @return 动态
*/
@MobileAuth
@GetMapping
(
"/moments"
)
public
TableDataInfo
getUserMoments
(
String
content
)
{
String
username
=
MobileTokenHelper
.
getUserN
ame
();
String
username
=
SecurityUtils
.
getUsern
ame
();
PageUtils
.
clearPage
();
List
<
BbsMomentListVO
>
moments
=
this
.
momentService
.
getUserMoments
(
username
,
content
);
return
TableDataInfo
.
getDataTable
(
moments
);
...
...
safe-campus-moment/src/main/java/com/tangguo/domain/BbsMoment.java
View file @
2f3f5e92
...
...
@@ -121,7 +121,7 @@ public class BbsMoment extends BaseEntity {
/** 用户姓名 */
@TableField
(
exist
=
false
)
private
String
ni
ke
Name
;
private
String
ni
ck
Name
;
/** 用户部门 */
@TableField
(
exist
=
false
)
...
...
safe-campus-moment/src/main/java/com/tangguo/domain/BbsMomentComment.java
View file @
2f3f5e92
...
...
@@ -43,7 +43,7 @@ public class BbsMomentComment extends BaseEntity {
/** 评论用户姓名 */
@Excel
(
name
=
"评论用户姓名"
)
@ApiModelProperty
(
"评论用户姓名"
)
private
String
ni
ke
Name
;
private
String
ni
ck
Name
;
/** 评论用户名 */
@Excel
(
name
=
"评论用户名"
)
...
...
safe-campus-moment/src/main/java/com/tangguo/domain/vo/BbsCommentDetailVO.java
View file @
2f3f5e92
...
...
@@ -22,7 +22,7 @@ public class BbsCommentDetailVO {
private
Date
createTime
;
/** 评论用户姓名 */
private
String
ni
ke
Name
;
private
String
ni
ck
Name
;
/** 评论用户名 */
private
String
userName
;
...
...
safe-campus-moment/src/main/java/com/tangguo/domain/vo/BbsCommentVO.java
View file @
2f3f5e92
...
...
@@ -22,7 +22,7 @@ public class BbsCommentVO {
private
Date
createTime
;
/** 评论用户姓名 */
private
String
ni
ke
Name
;
private
String
ni
ck
Name
;
/** 评论用户名 */
private
String
userName
;
...
...
safe-campus-moment/src/main/java/com/tangguo/domain/vo/BbsMomentDetailVO.java
View file @
2f3f5e92
...
...
@@ -25,7 +25,7 @@ public class BbsMomentDetailVO {
private
Long
id
;
/** 发布人用户姓名 */
private
String
ni
ke
Name
;
private
String
ni
ck
Name
;
/** 发布人用户名 */
private
String
userName
;
...
...
safe-campus-moment/src/main/java/com/tangguo/domain/vo/BbsMomentListVO.java
View file @
2f3f5e92
...
...
@@ -25,7 +25,7 @@ public class BbsMomentListVO {
private
Long
id
;
/** 发布人用户姓名 */
private
String
ni
ke
Name
;
private
String
ni
ck
Name
;
/** 发布人用户名 */
private
String
userName
;
...
...
safe-campus-moment/src/main/java/com/tangguo/domain/vo/BbsVoteVO.java
View file @
2f3f5e92
...
...
@@ -19,6 +19,6 @@ public class BbsVoteVO {
private
Date
createTime
;
/** 用户姓名 */
private
String
ni
ke
Name
;
private
String
ni
ck
Name
;
}
safe-campus-moment/src/main/java/com/tangguo/mapper/BbsUserMapper.java
deleted
100644 → 0
View file @
63de3ec6
package
com
.
tangguo
.
mapper
;
import
com.tangguo.common.domain.QwmhUserInfo
;
import
org.apache.ibatis.annotations.Param
;
/**
* 动态用户Mapper
*
* @author 谈笑
* @createTime 2025-09-02 15:30:05 星期二
*/
public
interface
BbsUserMapper
{
QwmhUserInfo
selectQwmhUserInfo
(
@Param
(
"userName"
)
String
userName
);
}
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsMomentServiceImpl.java
View file @
2f3f5e92
...
...
@@ -5,9 +5,9 @@ import cn.hutool.core.util.StrUtil;
import
cn.hutool.dfa.FoundWord
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.tangguo.common.core.domain.entity.SysUser
;
import
com.tangguo.common.enums.*
;
import
com.tangguo.common.exception.ServiceException
;
import
com.tangguo.common.mauth.MobileTokenHelper
;
import
com.tangguo.common.utils.SecurityUtils
;
import
com.tangguo.common.utils.SensitiveWordUtils
;
import
com.tangguo.domain.BbsMoment
;
...
...
@@ -131,7 +131,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
*/
@Override
public
List
<
BbsMomentListVO
>
getMoments
(
QueryMomentBO
bo
)
{
String
userName
=
MobileTokenHelper
.
getUserN
ame
();
String
userName
=
SecurityUtils
.
getUsern
ame
();
List
<
BbsMomentListVO
>
dbMoments
=
this
.
baseMapper
.
selectMoments
(
userName
,
bo
);
this
.
fillMoment
(
dbMoments
,
userName
);
return
dbMoments
;
...
...
@@ -146,7 +146,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
*/
@Override
public
BbsMomentListVO
getMomentDetail
(
Long
momentId
)
{
String
userName
=
MobileTokenHelper
.
getUserN
ame
();
String
userName
=
SecurityUtils
.
getUsern
ame
();
BbsMomentListVO
dbMoment
=
this
.
baseMapper
.
selectMomentDetail
(
momentId
,
userName
);
this
.
fillMoment
(
Collections
.
singletonList
(
dbMoment
),
userName
);
dbMoment
.
setComments
(
null
);
...
...
@@ -163,7 +163,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
@Override
public
void
userCreateMoment
(
CreateMomentBO
bo
)
{
// 添加动态
String
username
=
MobileTokenHelper
.
getUserN
ame
();
String
username
=
SecurityUtils
.
getUsern
ame
();
BbsMoment
newMoment
=
this
.
buildMoment
(
bo
);
newMoment
.
setUserName
(
username
);
this
.
save
(
newMoment
);
...
...
@@ -190,7 +190,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
userDeleteMoment
(
Long
momentId
)
{
String
username
=
MobileTokenHelper
.
getUserN
ame
();
String
username
=
SecurityUtils
.
getUsern
ame
();
BbsMoment
dbMoment
=
this
.
getById
(
momentId
);
if
(
Objects
.
isNull
(
dbMoment
))
{
throw
new
ServiceException
(
"删除失败,未查询到当前动态数据。"
);
...
...
@@ -215,7 +215,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
throw
new
ServiceException
(
"点赞失败,未查询到当前动态数据。"
);
}
String
userName
=
MobileTokenHelper
.
getUserN
ame
();
String
userName
=
SecurityUtils
.
getUsern
ame
();
long
likeStatus
=
this
.
likeService
.
getUserMomentLikeCount
(
dbMoment
.
getId
(),
userName
);
int
likeCount
=
dbMoment
.
getLikeCount
();
...
...
@@ -259,7 +259,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
throw
new
ServiceException
(
"投票失败,当前动态未开启投票。"
);
}
String
username
=
MobileTokenHelper
.
getUserN
ame
();
String
username
=
SecurityUtils
.
getUsern
ame
();
long
voteCount
=
this
.
voteService
.
getUserMomentVoteCount
(
dbMoment
.
getId
(),
username
);
if
(
voteCount
>
0
)
{
throw
new
ServiceException
(
"投票失败,已对当前动态投票。"
);
...
...
@@ -313,10 +313,11 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
}
// 添加动态评论
SysUser
dbUser
=
SecurityUtils
.
getLoginUser
().
getUser
();
BbsMomentComment
newComment
=
new
BbsMomentComment
();
newComment
.
setMomentId
(
dbMoment
.
getId
());
newComment
.
setUserName
(
MobileTokenHelp
er
.
getUserName
());
newComment
.
setNi
keName
(
MobileTokenHelper
.
getNike
Name
());
newComment
.
setUserName
(
dbUs
er
.
getUserName
());
newComment
.
setNi
ckName
(
dbUser
.
getNick
Name
());
newComment
.
setContent
(
bo
.
getContent
());
newComment
.
setStatus
(
CommentStatus
.
ZC
.
getStatus
());
newComment
.
setIsFeatured
(
0
);
...
...
@@ -327,7 +328,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
updComment
.
setId
(
newComment
.
getId
());
if
(
Objects
.
nonNull
(
dbParentComment
))
{
updComment
.
setParentId
(
dbParentComment
.
getId
());
updComment
.
setReplyNikeName
(
dbParentComment
.
getNi
ke
Name
());
updComment
.
setReplyNikeName
(
dbParentComment
.
getNi
ck
Name
());
updComment
.
setAncestorPath
(
dbParentComment
.
getAncestorPath
()
+
","
+
newComment
.
getId
());
}
else
{
updComment
.
setAncestorPath
(
String
.
valueOf
(
newComment
.
getId
()));
...
...
@@ -355,7 +356,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
throw
new
ServiceException
(
"删除失败,未查询到当前动态评论数据。"
);
}
String
userName
=
MobileTokenHelper
.
getUserN
ame
();
String
userName
=
SecurityUtils
.
getUsern
ame
();
if
(!
dbComment
.
getUserName
().
equals
(
userName
))
{
throw
new
ServiceException
(
"删除失败,没有对当前动态评论的操作权限。"
);
}
...
...
@@ -380,7 +381,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
throw
new
ServiceException
(
"操作失败,未查询到当前动态数据。"
);
}
String
userName
=
MobileTokenHelper
.
getUserN
ame
();
String
userName
=
SecurityUtils
.
getUsern
ame
();
if
(!
dbMoment
.
getUserName
().
equals
(
userName
))
{
throw
new
ServiceException
(
"操作失败,没有对当前动态评论的操作权限。"
);
}
...
...
@@ -585,7 +586,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
BbsCommentVO
cv
=
new
BbsCommentVO
();
cv
.
setId
(
c
.
getId
());
cv
.
setCreateTime
(
c
.
getCreateTime
());
cv
.
setNi
keName
(
c
.
getNike
Name
());
cv
.
setNi
ckName
(
c
.
getNick
Name
());
cv
.
setUserName
(
c
.
getUserName
());
cv
.
setContent
(
c
.
getContent
());
cvs
.
add
(
cv
);
...
...
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsTopicServiceImpl.java
View file @
2f3f5e92
...
...
@@ -10,7 +10,7 @@ import com.tangguo.common.constant.TopicConstant;
import
com.tangguo.common.core.redis.RedisCache
;
import
com.tangguo.common.enums.TopicTopStatus
;
import
com.tangguo.common.exception.ServiceException
;
import
com.tangguo.common.
mauth.MobileTokenHelper
;
import
com.tangguo.common.
utils.SecurityUtils
;
import
com.tangguo.common.utils.SensitiveWordUtils
;
import
com.tangguo.common.utils.StringUtils
;
import
com.tangguo.domain.BbsTopic
;
...
...
@@ -211,7 +211,7 @@ public class BbsTopicServiceImpl extends ServiceImpl<BbsTopicMapper, BbsTopic> i
}
BbsTopic
newTopic
=
new
BbsTopic
();
newTopic
.
setCreateBy
(
MobileTokenHelper
.
getUserN
ame
());
newTopic
.
setCreateBy
(
SecurityUtils
.
getUsern
ame
());
newTopic
.
setSource
(
"移动端用户"
);
newTopic
.
setName
(
topicName
);
this
.
save
(
newTopic
);
...
...
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsUserService.java
deleted
100644 → 0
View file @
63de3ec6
package
com
.
tangguo
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.tangguo.common.domain.QwmhUserInfo
;
import
com.tangguo.common.exception.ServiceException
;
import
com.tangguo.common.mauth.MobileTokenHelper
;
import
com.tangguo.domain.bo.CodeLoginBO
;
import
com.tangguo.mapper.BbsUserMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
me.chanjar.weixin.common.error.WxErrorException
;
import
me.chanjar.weixin.cp.api.WxCpService
;
import
me.chanjar.weixin.cp.bean.WxCpOauth2UserInfo
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.Objects
;
/**
* 动态用户业务类
*
* @author 谈笑
* @createTime 2025-09-02 14:55:04 星期二
*/
@Slf4j
@Service
public
class
BbsUserService
{
@Resource
private
WxCpService
wxCpService
;
@Resource
private
BbsUserMapper
bbsUserMapper
;
/**
* 企微用户Code登录
*
* @param bo 登录参数
* @return 登录结果
*/
public
Map
<
String
,
Object
>
codeLogin
(
CodeLoginBO
bo
)
{
String
userName
;
try
{
log
.
info
(
"=> 移动端用户登录:{}"
,
bo
);
WxCpOauth2UserInfo
authUserInfo
=
this
.
wxCpService
.
getOauth2Service
().
getAuthUserInfo
(
bo
.
getCode
());
userName
=
authUserInfo
.
getUserId
();
}
catch
(
WxErrorException
e
)
{
log
.
error
(
"=> 移动端用户登录失败,查询当前企微用户数据失败:"
,
e
);
throw
new
ServiceException
(
"登录失败,查询当前企微用户数据失败。"
);
}
QwmhUserInfo
dbUser
=
this
.
bbsUserMapper
.
selectQwmhUserInfo
(
userName
);
if
(
Objects
.
nonNull
(
dbUser
))
{
Map
<
String
,
Object
>
payloads
=
new
LinkedHashMap
<>(
2
);
payloads
.
put
(
"userName"
,
dbUser
.
getUserName
());
payloads
.
put
(
"nikeName"
,
dbUser
.
getNikeName
());
return
MobileTokenHelper
.
createDetailToken
(
payloads
);
}
else
{
throw
new
ServiceException
(
"登录失败,未查询到当前登录用户数据。"
);
}
}
/**
* 查询用户信息
*
* @return 用户信息
*/
public
Map
<
String
,
Object
>
getUserProfile
()
{
String
username
=
MobileTokenHelper
.
getUserName
();
QwmhUserInfo
dbUser
=
this
.
bbsUserMapper
.
selectQwmhUserInfo
(
username
);
if
(
Objects
.
nonNull
(
dbUser
))
{
return
BeanUtil
.
beanToMap
(
dbUser
,
false
,
false
);
}
else
{
throw
new
ServiceException
(
"操作失败,未查询到当前登录用户信息。"
);
}
}
}
safe-campus-moment/src/main/resources/mapper/BbsMomentCommentMapper.xml
View file @
2f3f5e92
...
...
@@ -45,11 +45,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
c.id,
c.create_time,
c.moment_id,
c.ni
ke
_name,
c.ni
ck
_name,
c.user_name,
c.content,
c.parent_id,
c.reply_ni
ke
_name,
c.reply_ni
ck
_name,
ROW_NUMBER() OVER (PARTITION BY moment_id ORDER BY create_time) AS rn
FROM
bbs_moment_comment c
...
...
@@ -85,11 +85,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
c.id,
c.create_time,
c.moment_id,
c.ni
ke
_name,
c.ni
ck
_name,
c.user_name,
c.content,
c.parent_id,
c.reply_ni
ke
_name,
c.reply_ni
ck
_name,
c.is_featured,
IF(c.user_name = #{userName}, 1, 0) AS is_self
FROM
...
...
safe-campus-moment/src/main/resources/mapper/BbsMomentMapper.xml
View file @
2f3f5e92
...
...
@@ -7,12 +7,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"selectBbsMomentList"
resultType=
"com.tangguo.domain.BbsMoment"
>
SELECT
m.*,
uv.ni
ke
_name,
u
v
.dept_name
uv.ni
ck
_name,
u
d
.dept_name
FROM
bbs_moment m
LEFT JOIN
qwmh_sys_user_view uv ON uv.user_name = m.user_name
sys_user uv ON uv.user_name = m.user_name
LEFT JOIN
sys_dept ud ON ud.dept_id = uv.dept_id
<where>
<if
test=
"moment.content != null and moment.content != ''"
>
m.content LIKE CONCAT('%', #{moment.content}, '%')
...
...
@@ -78,14 +80,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"selectMoments"
resultType=
"com.tangguo.domain.vo.BbsMomentListVO"
>
SELECT
m.*,
uv.ni
ke
_name,
uv.ni
ck
_name,
IF(l.id IS NOT NULL, 1, 0) AS is_like,
IF(v.id IS NOT NULL, 1, 0) AS is_vote,
IF(m.user_name = #{userName}, 1, 0) AS is_self
FROM
bbs_moment m
LEFT JOIN
qwmh_sys_user_view
uv ON uv.user_name = m.user_name
sys_user
uv ON uv.user_name = m.user_name
LEFT JOIN
(
SELECT
...
...
@@ -120,14 +122,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"selectMomentDetail"
resultType=
"com.tangguo.domain.vo.BbsMomentListVO"
>
SELECT
m.*,
uv.ni
ke
_name,
uv.ni
ck
_name,
IF(l.id IS NOT NULL, 1, 0) AS is_like,
IF(v.id IS NOT NULL, 1, 0) AS is_vote,
IF(m.user_name = #{userName}, 1, 0) AS is_self
FROM
bbs_moment m
LEFT JOIN
qwmh_sys_user_view
uv ON uv.user_name = m.user_name
sys_user
uv ON uv.user_name = m.user_name
LEFT JOIN
(
SELECT
...
...
safe-campus-moment/src/main/resources/mapper/BbsMomentVoteMapper.xml
View file @
2f3f5e92
...
...
@@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"selectVotes"
resultType=
"com.tangguo.domain.vo.BbsVoteVO"
>
SELECT
v.create_time,
uv.ni
ke
_name
uv.ni
ck
_name
FROM
bbs_moment_vote v
LEFT JOIN
...
...
safe-campus-moment/src/main/resources/mapper/BbsUserMapper.xml
deleted
100644 → 0
View file @
63de3ec6
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.tangguo.mapper.BbsUserMapper"
>
<select
id=
"selectQwmhUserInfo"
resultType=
"com.tangguo.common.domain.QwmhUserInfo"
>
SELECT
uv.nike_name,
uv.user_name,
uv.dept_name,
IFNULL(p.current_points, 0) AS current_points,
IFNULL(p.accumulated_points, 0) AS accumulated_points,
IFNULL(p.grade_name, ug.name) AS grade_name
FROM
qwmh_sys_user_view uv
LEFT JOIN
bbs_user_points p ON p.user_name = uv.user_name
CROSS JOIN (
SELECT (SELECT name FROM bbs_grade WHERE is_initial = 1 ORDER BY create_time DESC LIMIT 1) AS name
) ug
WHERE
uv.user_name = #{userName}
</select>
</mapper>
safe-campus-points/src/main/java/com/tangguo/controller/BbsUserPointsExchangeController.java
View file @
2f3f5e92
...
...
@@ -7,12 +7,10 @@ import com.tangguo.common.annotation.RepeatSubmit;
import
com.tangguo.common.core.controller.BaseController
;
import
com.tangguo.common.core.domain.AjaxResult
;
import
com.tangguo.common.core.page.TableDataInfo
;
import
com.tangguo.common.domain.QwmhUserInfo
;
import
com.tangguo.common.enums.BusinessType
;
import
com.tangguo.common.utils.poi.ExcelUtil
;
import
com.tangguo.domain.BbsPointsGoods
;
import
com.tangguo.domain.BbsUserPointsExchange
;
import
com.tangguo.mapper.BbsUserPointsExchangeMapper
;
import
com.tangguo.service.IBbsPointsGoodsService
;
import
com.tangguo.service.IBbsUserPointsExchangeService
;
import
io.swagger.annotations.Api
;
...
...
@@ -35,9 +33,6 @@ import java.util.List;
@RequestMapping
(
"/bbs/points/exchange"
)
public
class
BbsUserPointsExchangeController
extends
BaseController
{
@Resource
private
BbsUserPointsExchangeMapper
userPointsExchangeMapper
;
@Resource
private
IBbsUserPointsExchangeService
bbsUserPointsExchangeService
;
...
...
@@ -45,18 +40,6 @@ public class BbsUserPointsExchangeController extends BaseController {
private
IBbsPointsGoodsService
pointsGoodsService
;
/**
* 查询兑换人
*/
@ApiOperation
(
"查询兑换人"
)
@PreAuthorize
(
"@ss.hasPermi('points:points:list')"
)
@GetMapping
(
"/select/users"
)
public
AjaxResult
selectUsers
(
String
keyword
)
{
List
<
QwmhUserInfo
>
users
=
this
.
userPointsExchangeMapper
.
selectPointsUsers
(
keyword
);
return
AjaxResult
.
success
(
users
);
}
/**
* 查询兑换商品
*/
...
...
safe-campus-points/src/main/java/com/tangguo/domain/BbsUserPoints.java
View file @
2f3f5e92
...
...
@@ -71,7 +71,7 @@ public class BbsUserPoints extends BaseEntity {
*/
@Excel
(
name
=
"用户姓名"
)
@TableField
(
exist
=
false
)
private
String
ni
ke
Name
;
private
String
ni
ck
Name
;
/**
* 用户部门
...
...
safe-campus-points/src/main/java/com/tangguo/domain/BbsUserPointsExchange.java
View file @
2f3f5e92
...
...
@@ -35,7 +35,7 @@ public class BbsUserPointsExchange extends BaseEntity {
/** 用户姓名 */
@Excel
(
name
=
"用户姓名"
)
@ApiModelProperty
(
"用户姓名"
)
private
String
ni
ke
Name
;
private
String
ni
ck
Name
;
/** 用户名 */
@Excel
(
name
=
"用户名"
)
...
...
safe-campus-points/src/main/java/com/tangguo/mapper/BbsUserPointsExchangeMapper.java
View file @
2f3f5e92
package
com
.
tangguo
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.tangguo.common.domain.QwmhUserInfo
;
import
com.tangguo.domain.BbsUserPointsExchange
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -17,7 +16,4 @@ public interface BbsUserPointsExchangeMapper extends BaseMapper<BbsUserPointsExc
List
<
BbsUserPointsExchange
>
selectBbsUserPointsExchangeList
(
@Param
(
"exchange"
)
BbsUserPointsExchange
exchange
);
List
<
QwmhUserInfo
>
selectPointsUsers
(
@Param
(
"keyword"
)
String
keyword
);
}
safe-campus-points/src/main/java/com/tangguo/mapper/BbsUserPointsMapper.java
View file @
2f3f5e92
package
com
.
tangguo
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.tangguo.common.domain.QwmhUserInfo
;
import
com.tangguo.domain.BbsUserPoints
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -18,13 +17,7 @@ public interface BbsUserPointsMapper extends BaseMapper<BbsUserPoints> {
List
<
BbsUserPoints
>
selectBbsUserPointsList
(
@Param
(
"points"
)
BbsUserPoints
points
);
QwmhUserInfo
selectQwmhUser
(
@Param
(
"userName"
)
String
userName
);
BbsUserPoints
selectUserPoints
(
@Param
(
"userName"
)
String
userName
);
int
initUserPointsGrade
();
int
selectUserCount
(
@Param
(
"userName"
)
String
userName
);
int
refreshUserPointsGrade
();
...
...
safe-campus-points/src/main/java/com/tangguo/service/IBbsUserPointsService.java
View file @
2f3f5e92
...
...
@@ -23,6 +23,15 @@ public interface IBbsUserPointsService extends IService<BbsUserPoints> {
List
<
BbsUserPoints
>
selectBbsUserPointsList
(
BbsUserPoints
bbsUserPoints
);
/**
* 查询用户积分
*
* @param userName 用户名
* @return 积分
*/
BbsUserPoints
getUserPoints
(
String
userName
);
/**
* 查询用户积分
*
...
...
safe-campus-points/src/main/java/com/tangguo/service/impl/BbsUserPointsExchangeServiceImpl.java
View file @
2f3f5e92
...
...
@@ -95,7 +95,7 @@ public class BbsUserPointsExchangeServiceImpl extends ServiceImpl<BbsUserPointsE
// 添加兑换记录
BbsUserPointsExchange
addExchange
=
new
BbsUserPointsExchange
();
addExchange
.
setNi
keName
(
exchange
.
getNike
Name
());
addExchange
.
setNi
ckName
(
exchange
.
getNick
Name
());
addExchange
.
setUserName
(
dbUserPoints
.
getUserName
());
addExchange
.
setUserGradeName
(
dbUserPoints
.
getGradeName
());
addExchange
.
setGoodsName
(
dbGoods
.
getName
());
...
...
safe-campus-points/src/main/java/com/tangguo/service/impl/BbsUserPointsServiceImpl.java
View file @
2f3f5e92
package
com
.
tangguo
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.tangguo.common.domain.PointsDetail
;
import
com.tangguo.common.domain.QwmhUserInfo
;
import
com.tangguo.common.exception.ServiceException
;
import
com.tangguo.common.utils.SecurityUtils
;
import
com.tangguo.domain.BbsGrade
;
...
...
@@ -55,6 +55,20 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B
}
/**
* 查询用户积分
*
* @param userName 用户名
* @return 积分
*/
@Override
public
BbsUserPoints
getUserPoints
(
String
userName
)
{
return
this
.
getOne
(
Wrappers
.
lambdaQuery
(
BbsUserPoints
.
class
).
eq
(
BbsUserPoints:
:
getUserName
,
userName
)
);
}
/**
* 查询用户积分
*
...
...
@@ -64,12 +78,10 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
@Override
public
BbsUserPoints
getAndInitUserPoints
(
String
userName
)
{
BbsUserPoints
dbUserPoints
=
this
.
baseMapper
.
selec
tUserPoints
(
userName
);
BbsUserPoints
dbUserPoints
=
this
.
ge
tUserPoints
(
userName
);
if
(
Objects
.
isNull
(
dbUserPoints
))
{
QwmhUserInfo
qwmhSysUser
=
this
.
baseMapper
.
selectQwmhUser
(
userName
);
if
(
Objects
.
isNull
(
qwmhSysUser
))
{
throw
new
ServiceException
(
"查询用户积分失败,未查询到当前用户数据。"
);
}
else
{
int
dbUserCount
=
this
.
baseMapper
.
selectUserCount
(
userName
);
if
(
dbUserCount
>
0
)
{
// 初始积分
dbUserPoints
=
new
BbsUserPoints
();
dbUserPoints
.
setUserName
(
userName
);
...
...
@@ -83,6 +95,8 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B
dbUserPoints
.
setLastUpgradeTime
(
new
Date
());
}
this
.
save
(
dbUserPoints
);
}
else
{
throw
new
ServiceException
(
"查询用户积分失败,未查询到当前用户数据。"
);
}
}
return
dbUserPoints
;
...
...
safe-campus-points/src/main/resources/mapper/BbsGradeMapper.xml
View file @
2f3f5e92
...
...
@@ -4,6 +4,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.tangguo.mapper.BbsGradeMapper"
>
</mapper>
safe-campus-points/src/main/resources/mapper/BbsPointsSettingMapper.xml
View file @
2f3f5e92
...
...
@@ -4,5 +4,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.tangguo.mapper.BbsPointsSettingMapper"
>
</mapper>
safe-campus-points/src/main/resources/mapper/BbsUserPointsExchangeMapper.xml
View file @
2f3f5e92
...
...
@@ -10,8 +10,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
bbs_user_points_exchange e
<where>
<if
test=
"exchange.ni
keName != null and exchange.nike
Name != ''"
>
e.ni
ke_name LIKE CONCAT('%', #{exchange.nike
Name}, '%')
<if
test=
"exchange.ni
ckName != null and exchange.nick
Name != ''"
>
e.ni
ck_name LIKE CONCAT('%', #{exchange.nick
Name}, '%')
</if>
<if
test=
"exchange.userName != null and exchange.userName != ''"
>
AND e.user_name LIKE CONCAT('%', #{exchange.userName}, '%')
...
...
@@ -33,29 +33,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
e.create_time DESC
</select>
<select
id=
"selectPointsUsers"
resultType=
"com.tangguo.common.domain.QwmhUserInfo"
>
SELECT
uv.nike_name,
uv.user_name,
uv.dept_name,
IFNULL(p.current_points, 0) AS current_points,
IFNULL(p.accumulated_points, 0) AS accumulated_points,
IFNULL(p.grade_name, ug.name) AS grade_name
FROM
qwmh_sys_user_view uv
LEFT JOIN
bbs_user_points p ON p.user_name = uv.user_name
CROSS JOIN (
SELECT (SELECT name FROM bbs_grade WHERE is_initial = 1 ORDER BY create_time DESC LIMIT 1) AS name
) ug
<where>
<if
test=
"keyword != null and keyword != ''"
>
nike_name LIKE CONCAT('%', #{keyword}, '%') OR user_name LIKE CONCAT('%', #{keyword}, '%')
</if>
</where>
ORDER BY
uv.create_time DESC
</select>
</mapper>
safe-campus-points/src/main/resources/mapper/BbsUserPointsMapper.xml
View file @
2f3f5e92
...
...
@@ -6,22 +6,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"selectBbsUserPointsList"
resultType=
"com.tangguo.domain.BbsUserPoints"
>
SELECT
uv.ni
ke
_name,
uv.ni
ck_name AS nick
_name,
uv.user_name,
u
v
.dept_name,
u
d
.dept_name,
IFNULL(p.current_points, 0) AS current_points,
IFNULL(p.accumulated_points, 0) AS accumulated_points,
IFNULL(p.grade_name, ug.name) AS grade_name
FROM
qwmh_sys_user_view uv
sys_user uv
LEFT JOIN
sys_dept ud ON ud.dept_id = uv.dept_id
LEFT JOIN
bbs_user_points p ON p.user_name = uv.user_name
CROSS JOIN (
SELECT (SELECT name FROM bbs_grade WHERE is_initial = 1 ORDER BY create_time DESC LIMIT 1) AS name
) ug
<where>
<if
test=
"points.nikeName != null and points.nikeName != ''"
>
uv.nike_name LIKE CONCAT('%', #{points.nikeName}, '%')
<if
test=
"points.keyword != null and points.keyword != ''"
>
uv.nick_name LIKE CONCAT('%', #{points.keyword}, '%') OR uv.user_name LIKE CONCAT('%', #{points.keyword}, '%')
</if>
<if
test=
"points.nickName != null and points.nickName != ''"
>
AND uv.nick_name LIKE CONCAT('%', #{points.nickName}, '%')
</if>
<if
test=
"points.userName != null and points.userName != ''"
>
AND uv.user_name LIKE CONCAT('%', #{points.userName}, '%')
...
...
@@ -38,21 +43,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select
id=
"selectQwmhUser"
resultType=
"com.tangguo.common.domain.QwmhUserInfo"
>
SELECT * FROM qwmh_sys_user_view WHERE user_name = #{userName}
</select>
<select
id=
"selectUserPoints"
resultType=
"com.tangguo.domain.BbsUserPoints"
>
SELECT * FROM bbs_user_points WHERE user_name = #{userName}
<select
id=
"selectUserCount"
resultType=
"java.lang.Integer"
>
SELECT COUNT(*) FROM sys_user WHERE user_name = #{userName}
</select>
<update
id=
"initUserPointsGrade"
>
</update>
<update
id=
"refreshUserPointsGrade"
>
UPDATE
bbs_user_points p
...
...
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