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
a8a2a392
Commit
a8a2a392
authored
Oct 14, 2025
by
yuwenwen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.tangguo.ren/2300064869/safe-campus-bbs
parents
32a19360
41b338c0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
14 deletions
+18
-14
safe-campus-admin/src/main/java/com/tangguo/web/controller/system/SysLoginController.java
...com/tangguo/web/controller/system/SysLoginController.java
+6
-5
safe-campus-admin/src/main/resources/application-dev.yml
safe-campus-admin/src/main/resources/application-dev.yml
+1
-0
safe-campus-admin/src/main/resources/application-jxfz.yml
safe-campus-admin/src/main/resources/application-jxfz.yml
+1
-0
safe-campus-admin/src/main/resources/application.yml
safe-campus-admin/src/main/resources/application.yml
+3
-3
safe-campus-framework/src/main/java/com/tangguo/framework/config/ServerConfig.java
.../main/java/com/tangguo/framework/config/ServerConfig.java
+1
-0
safe-campus-framework/src/main/java/com/tangguo/framework/security/handle/AuthenticationEntryPointImpl.java
...amework/security/handle/AuthenticationEntryPointImpl.java
+4
-5
safe-campus-moment/src/main/java/com/tangguo/domain/BbsMoment.java
...us-moment/src/main/java/com/tangguo/domain/BbsMoment.java
+2
-1
No files found.
safe-campus-admin/src/main/java/com/tangguo/web/controller/system/SysLoginController.java
View file @
a8a2a392
...
@@ -27,6 +27,7 @@ import me.chanjar.weixin.cp.api.WxCpOAuth2Service;
...
@@ -27,6 +27,7 @@ import me.chanjar.weixin.cp.api.WxCpOAuth2Service;
import
me.chanjar.weixin.cp.api.WxCpService
;
import
me.chanjar.weixin.cp.api.WxCpService
;
import
me.chanjar.weixin.cp.bean.WxCpOauth2UserInfo
;
import
me.chanjar.weixin.cp.bean.WxCpOauth2UserInfo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -66,6 +67,10 @@ public class SysLoginController {
...
@@ -66,6 +67,10 @@ public class SysLoginController {
@Autowired
@Autowired
private
ISysUserService
userService
;
private
ISysUserService
userService
;
@Value
(
"${wx.cp.redirect-url}"
)
private
String
redirectUrl
;
/**
/**
* 登录方法
* 登录方法
...
@@ -131,11 +136,9 @@ public class SysLoginController {
...
@@ -131,11 +136,9 @@ public class SysLoginController {
// 企微登录认证链接
// 企微登录认证链接
String
authCode
=
bo
.
getCode
();
String
authCode
=
bo
.
getCode
();
String
baseUrl
=
this
.
serverConfig
.
getUrl
();
String
redirectUrl
=
baseUrl
+
"/bbs/h5/pages/login/login/"
;
WxCpOAuth2Service
oauth2Service
=
this
.
wxCpService
.
getOauth2Service
();
WxCpOAuth2Service
oauth2Service
=
this
.
wxCpService
.
getOauth2Service
();
if
(
Objects
.
isNull
(
loginUser
)
&&
StrUtil
.
isBlank
(
authCode
))
{
if
(
Objects
.
isNull
(
loginUser
)
&&
StrUtil
.
isBlank
(
authCode
))
{
String
oauth2Url
=
oauth2Service
.
buildAuthorizationUrl
(
redirectUrl
,
null
);
String
oauth2Url
=
oauth2Service
.
buildAuthorizationUrl
(
this
.
redirectUrl
,
null
);
log
.
info
(
"=> 认证失败,返回Oauth2登录链接:{}"
,
oauth2Url
);
log
.
info
(
"=> 认证失败,返回Oauth2登录链接:{}"
,
oauth2Url
);
return
AjaxResult
.
error
(
401
,
"身份认证失败"
,
oauth2Url
);
return
AjaxResult
.
error
(
401
,
"身份认证失败"
,
oauth2Url
);
}
}
...
@@ -188,11 +191,9 @@ public class SysLoginController {
...
@@ -188,11 +191,9 @@ public class SysLoginController {
SysUser
updUser
=
new
SysUser
();
SysUser
updUser
=
new
SysUser
();
updUser
.
setUserId
(
loginUser
.
getUserId
());
updUser
.
setUserId
(
loginUser
.
getUserId
());
updUser
.
setAvatar
(
user
.
getAvatar
());
updUser
.
setAvatar
(
user
.
getAvatar
());
updUser
.
setNickName
(
user
.
getNickName
());
if
(
this
.
userService
.
updateUserProfile
(
updUser
)
>
0
)
{
if
(
this
.
userService
.
updateUserProfile
(
updUser
)
>
0
)
{
SysUser
sysUser
=
loginUser
.
getUser
();
SysUser
sysUser
=
loginUser
.
getUser
();
sysUser
.
setAvatar
(
user
.
getAvatar
());
sysUser
.
setAvatar
(
user
.
getAvatar
());
sysUser
.
setNickName
(
user
.
getNickName
());
tokenService
.
setLoginUser
(
loginUser
);
tokenService
.
setLoginUser
(
loginUser
);
return
AjaxResult
.
success
();
return
AjaxResult
.
success
();
}
}
...
...
safe-campus-admin/src/main/resources/application-dev.yml
View file @
a8a2a392
...
@@ -95,6 +95,7 @@ spring:
...
@@ -95,6 +95,7 @@ spring:
# 企业微信配置
# 企业微信配置
wx
:
wx
:
cp
:
cp
:
redirect-url
:
https://test.tangguo.ren/bbsh5/pages/login/login
corp-id
:
ww63ca87d5f8647514
corp-id
:
ww63ca87d5f8647514
app-config
:
app-config
:
agent-id
:
1000072
agent-id
:
1000072
...
...
safe-campus-admin/src/main/resources/application-jxfz.yml
View file @
a8a2a392
...
@@ -95,6 +95,7 @@ spring:
...
@@ -95,6 +95,7 @@ spring:
# 企业微信配置
# 企业微信配置
wx
:
wx
:
cp
:
cp
:
redirect-url
:
https://wecom.jift.edu.cn/bbsh5/pages/login/login
corp-id
:
wxd2a84aa7529d3801
corp-id
:
wxd2a84aa7529d3801
app-config
:
app-config
:
agent-id
:
1000218
agent-id
:
1000218
...
...
safe-campus-admin/src/main/resources/application.yml
View file @
a8a2a392
...
@@ -16,7 +16,7 @@ ruoyi:
...
@@ -16,7 +16,7 @@ ruoyi:
# 开发环境配置
# 开发环境配置
server
:
server
:
# 服务器的HTTP端口,默认为8080
# 服务器的HTTP端口,默认为8080
port
:
808
0
port
:
808
9
servlet
:
servlet
:
# 应用的访问路径
# 应用的访问路径
context-path
:
/
context-path
:
/
...
@@ -67,8 +67,8 @@ token:
...
@@ -67,8 +67,8 @@ token:
header
:
Authorization
header
:
Authorization
# 令牌密钥
# 令牌密钥
secret
:
abcdefghijklmnopqrstuvwxyz
secret
:
abcdefghijklmnopqrstuvwxyz
# 令牌有效期(默认3
0分钟
)
# 令牌有效期(默认3
小时
)
expireTime
:
3000
00000
expireTime
:
108
00000
# MyBatis Plus配置
# MyBatis Plus配置
mybatis-plus
:
mybatis-plus
:
...
...
safe-campus-framework/src/main/java/com/tangguo/framework/config/ServerConfig.java
View file @
a8a2a392
package
com
.
tangguo
.
framework
.
config
;
package
com
.
tangguo
.
framework
.
config
;
import
cn.hutool.core.util.StrUtil
;
import
com.tangguo.common.utils.ServletUtils
;
import
com.tangguo.common.utils.ServletUtils
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
...
safe-campus-framework/src/main/java/com/tangguo/framework/security/handle/AuthenticationEntryPointImpl.java
View file @
a8a2a392
...
@@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
import
me.chanjar.weixin.cp.api.WxCpOAuth2Service
;
import
me.chanjar.weixin.cp.api.WxCpOAuth2Service
;
import
me.chanjar.weixin.cp.api.WxCpService
;
import
me.chanjar.weixin.cp.api.WxCpService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.security.core.AuthenticationException
;
import
org.springframework.security.core.AuthenticationException
;
import
org.springframework.security.web.AuthenticationEntryPoint
;
import
org.springframework.security.web.AuthenticationEntryPoint
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -34,8 +35,8 @@ public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, S
...
@@ -34,8 +35,8 @@ public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, S
@Autowired
@Autowired
private
WxCpService
wxCpService
;
private
WxCpService
wxCpService
;
@
Autowired
@
Value
(
"${wx.cp.redirect-url}"
)
private
S
erverConfig
serverConfig
;
private
S
tring
redirectUrl
;
@Override
@Override
public
void
commence
(
HttpServletRequest
request
,
HttpServletResponse
response
,
AuthenticationException
e
)
public
void
commence
(
HttpServletRequest
request
,
HttpServletResponse
response
,
AuthenticationException
e
)
...
@@ -46,10 +47,8 @@ public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, S
...
@@ -46,10 +47,8 @@ public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, S
log
.
info
(
"=> 身份认证失败,Token:{}"
,
request
.
getHeader
(
"Authorization"
));
log
.
info
(
"=> 身份认证失败,Token:{}"
,
request
.
getHeader
(
"Authorization"
));
if
(
uri
.
startsWith
(
"/bbs/mobile"
))
{
if
(
uri
.
startsWith
(
"/bbs/mobile"
))
{
String
baseUrl
=
this
.
serverConfig
.
getUrl
();
String
redirectUrl
=
baseUrl
+
"/bbs/h5/pages/login/login/"
;
WxCpOAuth2Service
oauth2Service
=
this
.
wxCpService
.
getOauth2Service
();
WxCpOAuth2Service
oauth2Service
=
this
.
wxCpService
.
getOauth2Service
();
String
oauth2Url
=
oauth2Service
.
buildAuthorizationUrl
(
redirectUrl
,
null
);
String
oauth2Url
=
oauth2Service
.
buildAuthorizationUrl
(
this
.
redirectUrl
,
null
);
ServletUtils
.
renderString
(
response
,
JSON
.
toJSONString
(
AjaxResult
.
error
(
401
,
"身份认证失败"
,
oauth2Url
)));
ServletUtils
.
renderString
(
response
,
JSON
.
toJSONString
(
AjaxResult
.
error
(
401
,
"身份认证失败"
,
oauth2Url
)));
}
else
{
}
else
{
String
msg
=
StringUtils
.
format
(
"请求访问:{},认证失败,无法访问系统资源"
,
uri
);
String
msg
=
StringUtils
.
format
(
"请求访问:{},认证失败,无法访问系统资源"
,
uri
);
...
...
safe-campus-moment/src/main/java/com/tangguo/domain/BbsMoment.java
View file @
a8a2a392
...
@@ -114,13 +114,14 @@ public class BbsMoment extends BaseEntity {
...
@@ -114,13 +114,14 @@ public class BbsMoment extends BaseEntity {
private
String
nickName
;
private
String
nickName
;
/** 用户部门 */
/** 用户部门 */
@Excel
(
name
=
"
所在部门
"
,
sort
=
3
)
@Excel
(
name
=
"
部门(班级)
"
,
sort
=
3
)
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
String
deptName
;
private
String
deptName
;
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
String
ancestors
;
private
String
ancestors
;
@Excel
(
name
=
"上级部门(学院)"
,
sort
=
4
)
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
String
fullDeptName
;
private
String
fullDeptName
;
...
...
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