Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
工
工位预约
Project
Project
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
jiatao
工位预约
Commits
f59e4670
Commit
f59e4670
authored
Nov 13, 2025
by
jiatao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交初始化配置
parent
14c61009
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
396 additions
and
218 deletions
+396
-218
CasAuthService.java
ruoyi-admin/src/main/java/com/ruoyi/cas/CasAuthService.java
+14
-113
CasController.java
ruoyi-admin/src/main/java/com/ruoyi/cas/CasController.java
+5
-11
ReservationApprovalController.java
.../web/controller/system/ReservationApprovalController.java
+37
-10
SchoolBuildController.java
...om/ruoyi/web/controller/system/SchoolBuildController.java
+5
-5
SchoolCampusController.java
...m/ruoyi/web/controller/system/SchoolCampusController.java
+4
-4
SchoolFloorController.java
...om/ruoyi/web/controller/system/SchoolFloorController.java
+5
-5
SchoolStudentInfoController.java
...yi/web/controller/system/SchoolStudentInfoController.java
+1
-1
SpaceController.java
...java/com/ruoyi/web/controller/system/SpaceController.java
+5
-5
SpaceSeatController.java
.../com/ruoyi/web/controller/system/SpaceSeatController.java
+5
-17
SysLoginController.java
...a/com/ruoyi/web/controller/system/SysLoginController.java
+1
-0
application-dev.yml
ruoyi-admin/src/main/resources/application-dev.yml
+2
-1
application-prod.yml
ruoyi-admin/src/main/resources/application-prod.yml
+1
-0
application.yml
ruoyi-admin/src/main/resources/application.yml
+1
-1
cas_success_response.xml
ruoyi-admin/src/main/resources/cas/cas_success_response.xml
+15
-13
pom.xml
ruoyi-common/pom.xml
+17
-0
Attributes.java
...system/src/main/java/com/ruoyi/system/cas/Attributes.java
+142
-0
AuthenticationSuccess.java
...main/java/com/ruoyi/system/cas/AuthenticationSuccess.java
+34
-0
CasUserInfo.java
...ystem/src/main/java/com/ruoyi/system/cas/CasUserInfo.java
+48
-30
CasXmlParser.java
...stem/src/main/java/com/ruoyi/system/cas/CasXmlParser.java
+22
-0
ReservationApprovalImpl.java
...om/ruoyi/system/service/impl/ReservationApprovalImpl.java
+2
-0
SchoolStudentInfoServiceImpl.java
...oyi/system/service/impl/SchoolStudentInfoServiceImpl.java
+2
-1
SchoolTeacherInfoServiceImpl.java
...oyi/system/service/impl/SchoolTeacherInfoServiceImpl.java
+1
-0
SpaceServiceImpl.java
.../java/com/ruoyi/system/service/impl/SpaceServiceImpl.java
+14
-1
AlreadyApprovalProcessor.java
...k/verifyReservationApproval/AlreadyApprovalProcessor.java
+13
-0
No files found.
ruoyi-admin/src/main/java/com/ruoyi/cas/CasAuthService.java
View file @
f59e4670
...
...
@@ -16,6 +16,7 @@ import com.ruoyi.framework.web.service.SysLoginService;
import
com.ruoyi.framework.web.service.SysPermissionService
;
import
com.ruoyi.system.cas.CasUserInfo
;
import
com.ruoyi.system.cas.CasValidationResult
;
import
com.ruoyi.system.cas.CasXmlParser
;
import
com.ruoyi.system.service.ISysDeptService
;
import
com.ruoyi.system.service.ISysRoleService
;
import
com.ruoyi.system.service.ISysUserService
;
...
...
@@ -102,9 +103,9 @@ public class CasAuthService {
public
AjaxResult
validateTicket
(
String
ticket
,
String
service
)
{
try
{
// 构建验证URL
String
validateUrl
=
StringUtils
.
format
(
"{}/serviceValidate?service={}&ticket={}
&format=XML
"
,
String
validateUrl
=
StringUtils
.
format
(
"{}/serviceValidate?service={}&ticket={}"
,
casServerUrl
,
URLEncoder
.
encode
(
service
,
StandardCharsets
.
UTF_8
.
toString
())
,
service
,
ticket
);
logger
.
info
(
"CAS验证URL: {}"
,
validateUrl
);
...
...
@@ -117,14 +118,10 @@ public class CasAuthService {
logger
.
info
(
"CAS验证响应: {}"
,
xmlResponse
);
// 解析响应
CasValidationResult
result
=
parseCasResponse
(
xmlResponse
);
if
(
result
.
isSuccess
())
{
return
handleSuccessfulLogin
(
result
.
getUserInfo
());
}
else
{
return
AjaxResult
.
error
(
"CAS认证失败: "
+
result
.
getErrorCode
());
}
CasUserInfo
userInfo
=
CasXmlParser
.
parseCasResponse
(
xmlResponse
);
return
handleSuccessfulLogin
(
userInfo
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"CAS票据验证异常"
,
e
);
...
...
@@ -132,96 +129,7 @@ public class CasAuthService {
}
}
/**
* 解析CAS响应
*/
private
CasValidationResult
parseCasResponse
(
String
xmlResponse
)
throws
Exception
{
CasValidationResult
result
=
new
CasValidationResult
();
if
(
StringUtils
.
isBlank
(
xmlResponse
))
{
result
.
setSuccess
(
false
);
result
.
setErrorCode
(
"EMPTY_RESPONSE"
);
return
result
;
}
// 检查是否包含认证成功标签
if
(
xmlResponse
.
contains
(
"<cas:authenticationSuccess>"
))
{
// 使用DOM解析XML
DocumentBuilderFactory
factory
=
DocumentBuilderFactory
.
newInstance
();
DocumentBuilder
builder
=
factory
.
newDocumentBuilder
();
Document
doc
=
builder
.
parse
(
new
InputSource
(
new
StringReader
(
xmlResponse
)));
// 获取用户名
NodeList
userNodes
=
doc
.
getElementsByTagName
(
"cas:user"
);
if
(
userNodes
.
getLength
()
>
0
)
{
String
username
=
userNodes
.
item
(
0
).
getTextContent
();
CasUserInfo
userInfo
=
new
CasUserInfo
();
userInfo
.
setUsername
(
username
);
// 解析属性
parseUserAttributes
(
doc
,
userInfo
);
result
.
setSuccess
(
true
);
result
.
setUserInfo
(
userInfo
);
}
else
{
result
.
setSuccess
(
false
);
result
.
setErrorCode
(
"NO_USER_FOUND"
);
}
}
else
{
// 认证失败
result
.
setSuccess
(
false
);
// 尝试提取错误信息
if
(
xmlResponse
.
contains
(
"INVALID_TICKET"
))
{
result
.
setErrorCode
(
"INVALID_TICKET"
);
}
else
if
(
xmlResponse
.
contains
(
"INVALID_SERVICE"
))
{
result
.
setErrorCode
(
"INVALID_SERVICE"
);
}
else
{
result
.
setErrorCode
(
"AUTH_FAILED"
);
}
}
return
result
;
}
/**
* 解析用户属性
*/
private
void
parseUserAttributes
(
Document
doc
,
CasUserInfo
userInfo
)
{
try
{
NodeList
attributeNodes
=
doc
.
getElementsByTagName
(
"cas:attribute"
);
for
(
int
i
=
0
;
i
<
attributeNodes
.
getLength
();
i
++)
{
Node
node
=
attributeNodes
.
item
(
i
);
if
(
node
.
getNodeType
()
==
Node
.
ELEMENT_NODE
)
{
Element
element
=
(
Element
)
node
;
String
name
=
element
.
getAttribute
(
"name"
);
String
value
=
element
.
getTextContent
();
switch
(
name
)
{
case
"name"
:
userInfo
.
setName
(
value
);
break
;
case
"userId"
:
userInfo
.
setUserId
(
value
);
break
;
case
"userName"
:
userInfo
.
setUsername
(
value
);
break
;
case
"identityTypeCode"
:
userInfo
.
setIdentityTypeCode
(
value
);
break
;
case
"organizationCode"
:
userInfo
.
setOrganizationCode
(
value
);
break
;
case
"organizationName"
:
userInfo
.
setOrganizationName
(
value
);
break
;
}
}
}
}
catch
(
Exception
e
)
{
logger
.
warn
(
"解析用户属性失败"
,
e
);
}
}
/**
* 处理登录成功
...
...
@@ -256,7 +164,7 @@ public class CasAuthService {
// 返回登录结果
Map
<
String
,
Object
>
authResult
=
new
HashMap
<>();
authResult
.
put
(
"token"
,
token
);
authResult
.
put
(
"loginType"
,
"cas"
);
return
AjaxResult
.
success
(
"CAS认证成功"
,
authResult
);
...
...
@@ -270,6 +178,8 @@ public class CasAuthService {
* 根据CAS信息创建用户
*/
private
SysUser
createUserFromCasInfo
(
CasUserInfo
userInfo
)
{
log
.
info
(
"组装的用户信息:{}"
,
userInfo
);
// 根据业务需求实现用户自动创建逻辑
// 这里可以根据CAS返回的身份代码决定用户角色等
logger
.
info
(
"自动创建用户: {}"
,
userInfo
.
getUsername
());
...
...
@@ -277,7 +187,7 @@ public class CasAuthService {
SysUser
user
=
new
SysUser
();
user
.
setUserName
(
userInfo
.
getUsername
());
user
.
setNickName
(
userInfo
.
getName
());
user
.
setPassword
((
SecurityUtils
.
encryptPassword
(
RuoYiConfig
.
getDefaultPassword
()
)));
user
.
setPassword
((
SecurityUtils
.
encryptPassword
(
"xjtugwyy@."
)));
user
.
setStatus
(
"0"
);
user
.
setCreateBy
(
userInfo
.
getUsername
());
user
.
setCreateTime
(
new
Date
());
...
...
@@ -316,14 +226,10 @@ public class CasAuthService {
* 构建CAS登录URL
*/
public
String
buildLoginUrl
(
String
redirectUrl
)
{
try
{
String
service
=
URLEncoder
.
encode
(
clientHostUrl
+
redirectUrl
,
"UTF-8"
);
String
service
=
clientHostUrl
+
redirectUrl
;
return
casServerUrl
+
"/login?service="
+
service
;
}
catch
(
UnsupportedEncodingException
e
)
{
logger
.
error
(
"构建CAS登录URL失败"
,
e
);
throw
new
ServiceException
(
"构建CAS登录URL失败,请刷新重试"
);
}
}
...
...
@@ -332,12 +238,7 @@ public class CasAuthService {
*/
public
String
buildLogoutUrl
(
String
redirectUrl
)
{
if
(
StringUtils
.
isNotEmpty
(
redirectUrl
))
{
try
{
return
casServerUrl
+
"/logout?service="
+
URLEncoder
.
encode
(
redirectUrl
,
String
.
valueOf
(
StandardCharsets
.
UTF_8
));
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
casServerUrl
+
"/logout?service="
+
clientHostUrl
+
redirectUrl
;
}
return
casServerUrl
+
"/logout"
;
}
...
...
ruoyi-admin/src/main/java/com/ruoyi/cas/CasController.java
View file @
f59e4670
...
...
@@ -3,6 +3,7 @@ package com.ruoyi.cas;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.core.domain.model.LoginUser
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.framework.web.service.TokenService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -54,9 +55,9 @@ public class CasController extends BaseController {
* 退出登录
*/
@PostMapping
(
"/logout"
)
public
AjaxResult
logout
(
HttpServletRequest
request
,
@RequestParam
(
required
=
false
)
String
redirect
)
{
public
AjaxResult
logout
(
@RequestParam
(
required
=
false
)
String
redirect
)
{
// 获取当前登录用户
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
LoginUser
loginUser
=
SecurityUtils
.
getLoginUser
(
);
if
(
loginUser
!=
null
)
{
// 删除本地用户缓存
tokenService
.
delLoginUser
(
loginUser
.
getToken
());
...
...
@@ -73,15 +74,8 @@ public class CasController extends BaseController {
*/
private
String
buildServiceUrl
(
String
redirect
)
{
String
baseUrl
=
getBaseUrl
();
String
service
=
baseUrl
+
"/api/cas/callback"
;
if
(
StringUtils
.
isNotEmpty
(
redirect
))
{
try
{
service
+=
"?redirect="
+
URLEncoder
.
encode
(
redirect
,
String
.
valueOf
(
StandardCharsets
.
UTF_8
));
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
return
service
;
return
baseUrl
+
redirect
;
}
/**
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ReservationApprovalController.java
View file @
f59e4670
package
com
.
ruoyi
.
web
.
controller
.
system
;
import
cn.hutool.core.date.DateUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
...
...
@@ -19,6 +20,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -100,9 +102,18 @@ public class ReservationApprovalController extends BaseController {
List
<
ReservationApproval
>
list
=
reservationApprovalService
.
list
(
new
LambdaQueryWrapper
<
ReservationApproval
>()
.
eq
(
ReservationApproval:
:
getSubmitBy
,
SecurityUtils
.
getUsername
())
.
in
(
ReservationApproval:
:
getStatus
,
ApprovalStatus
.
PASS
.
getCode
(),
ApprovalStatus
.
WAITING
.
getCode
())
.
in
(
ReservationApproval:
:
getStatus
,
ApprovalStatus
.
PASS
.
getCode
(),
ApprovalStatus
.
WAITING
.
getCode
()
,
ApprovalStatus
.
ALREADY_SIGN
.
getCode
()
)
.
ge
(
ReservationApproval:
:
getStartAt
,
new
Date
())
.
last
(
"limit 0,3"
));
.
last
(
"limit 0,3"
))
//按特定顺序排序 待签到 -> 待审核 -> 已签到
.
stream
().
sorted
(
Comparator
.
comparingInt
(
r
->{
int
status
=
Integer
.
parseInt
(
r
.
getStatus
());
if
(
status
==
1
)
return
0
;
else
if
(
status
==
0
)
return
1
;
else
if
(
status
==
2
)
return
2
;
else
return
3
;
})).
collect
(
Collectors
.
toList
());
List
<
String
>
seatCodes
=
list
.
stream
().
map
(
ReservationApproval:
:
getSeatCode
).
collect
(
Collectors
.
toList
());
...
...
@@ -122,6 +133,7 @@ public class ReservationApprovalController extends BaseController {
* @param reservationApproval
* @return
*/
@PreAuthorize
(
"@ss.hasPermi('system:approval:submit')"
)
@PostMapping
(
"/submit"
)
public
AjaxResult
submit
(
@RequestBody
ReservationApproval
reservationApproval
){
return
AjaxResult
.
success
(
reservationApprovalService
.
submitApproval
(
reservationApproval
));
...
...
@@ -134,6 +146,7 @@ public class ReservationApprovalController extends BaseController {
* @param reservationApproval
* @return
*/
@PreAuthorize
(
"@ss.hasPermi('system:approval:approval')"
)
@PostMapping
(
"/approval"
)
public
AjaxResult
approval
(
@RequestBody
ReservationApproval
reservationApproval
){
...
...
@@ -169,6 +182,7 @@ public class ReservationApprovalController extends BaseController {
* @param approvalId
* @return
*/
@PreAuthorize
(
"@ss.hasPermi('system:approval:submit')"
)
@PostMapping
(
"/sign/{approvalId}"
)
public
AjaxResult
sign
(
@PathVariable
(
"approvalId"
)
Long
approvalId
){
...
...
@@ -179,14 +193,14 @@ public class ReservationApprovalController extends BaseController {
throw
new
ServiceException
(
"参数错误,查询不到指定的申请"
);
}
//
Date currDate = new Date();
//
if (currDate.getTime() < DateUtil.offsetMinute(reservationApproval.getStartAt(),-10).getTime()){
//
throw new ServiceException("还未到签到时间");
//
}
//
//
if (currDate.getTime() > reservationApproval.getEndAt().getTime()){
//
throw new ServiceException("已过签到时间");
//
}
Date
currDate
=
new
Date
();
if
(
currDate
.
getTime
()
<
DateUtil
.
offsetMinute
(
reservationApproval
.
getStartAt
(),-
10
).
getTime
()){
throw
new
ServiceException
(
"还未到签到时间"
);
}
if
(
currDate
.
getTime
()
>
reservationApproval
.
getEndAt
().
getTime
()){
throw
new
ServiceException
(
"已过签到时间"
);
}
reservationApproval
.
setStatus
(
ApprovalStatus
.
ALREADY_SIGN
.
getCode
());
...
...
@@ -201,6 +215,7 @@ public class ReservationApprovalController extends BaseController {
* @param approvalId
* @return
*/
@PreAuthorize
(
"@ss.hasPermi('system:approval:submit')"
)
@PostMapping
(
"/cancel/{approvalId}"
)
public
AjaxResult
cancelApproval
(
@PathVariable
(
"approvalId"
)
Long
approvalId
){
...
...
@@ -213,4 +228,16 @@ public class ReservationApprovalController extends BaseController {
}
/**
* 删除申请信息
* @param approvalId
* @return
*/
@PreAuthorize
(
"@ss.hasPermi('system:approval:del')"
)
@DeleteMapping
(
"/del/{approvalId}"
)
public
AjaxResult
del
(
@PathVariable
(
"approvalId"
)
Long
approvalId
){
return
AjaxResult
.
success
(
reservationApprovalService
.
removeById
(
approvalId
));
}
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SchoolBuildController.java
View file @
f59e4670
...
...
@@ -38,7 +38,7 @@ public class SchoolBuildController extends BaseController
/**
* 查询楼宇列表
*/
@PreAuthorize
(
"@ss.hasPermi('
system:build
:list')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:builds
:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SchoolBuild
schoolBuild
)
{
...
...
@@ -54,7 +54,7 @@ public class SchoolBuildController extends BaseController
/**
* 获取楼宇详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('
system:build:query
')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:builds:list
')"
)
@GetMapping
(
value
=
"/{buildId}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"buildId"
)
Long
buildId
)
{
...
...
@@ -64,7 +64,7 @@ public class SchoolBuildController extends BaseController
/**
* 新增楼宇
*/
@PreAuthorize
(
"@ss.hasPermi('
system:build
:add')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:builds
:add')"
)
@Log
(
title
=
"楼宇"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
SchoolBuild
schoolBuild
)
...
...
@@ -75,7 +75,7 @@ public class SchoolBuildController extends BaseController
/**
* 修改楼宇
*/
@PreAuthorize
(
"@ss.hasPermi('
system:build:edit
')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:builds:update
')"
)
@Log
(
title
=
"楼宇"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
SchoolBuild
schoolBuild
)
...
...
@@ -86,7 +86,7 @@ public class SchoolBuildController extends BaseController
/**
* 删除楼宇
*/
@PreAuthorize
(
"@ss.hasPermi('
system:build:remov
e')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:builds:delet
e')"
)
@Log
(
title
=
"楼宇"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{buildId}"
)
public
AjaxResult
remove
(
@PathVariable
Long
buildId
)
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SchoolCampusController.java
View file @
f59e4670
...
...
@@ -50,7 +50,7 @@ public class SchoolCampusController extends BaseController
/**
* 查询校区列表
*/
@PreAuthorize
(
"@ss.hasPermi('
system
:campus:list')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic
:campus:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SchoolCampus
schoolCampus
)
{
...
...
@@ -65,7 +65,7 @@ public class SchoolCampusController extends BaseController
/**
* 获取校区详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('
system:campus:query
')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:campus:list
')"
)
@GetMapping
(
value
=
"/{campusId}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"campusId"
)
Long
campusId
)
{
...
...
@@ -86,7 +86,7 @@ public class SchoolCampusController extends BaseController
/**
* 修改校区
*/
@PreAuthorize
(
"@ss.hasPermi('
system:campus:edit
')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:campus:update
')"
)
@Log
(
title
=
"校区"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
SchoolCampus
schoolCampus
)
...
...
@@ -97,7 +97,7 @@ public class SchoolCampusController extends BaseController
/**
* 删除校区
*/
@PreAuthorize
(
"@ss.hasPermi('
system:campus:remov
e')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:campus:delet
e')"
)
@Log
(
title
=
"校区"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{campusId}"
)
public
AjaxResult
remove
(
@PathVariable
Long
campusId
)
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SchoolFloorController.java
View file @
f59e4670
...
...
@@ -38,7 +38,7 @@ public class SchoolFloorController extends BaseController
/**
* 查询楼层列表
*/
@PreAuthorize
(
"@ss.hasPermi('
system:floor
:list')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:floors
:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SchoolFloor
schoolFloor
)
{
...
...
@@ -54,7 +54,7 @@ public class SchoolFloorController extends BaseController
/**
* 获取楼层详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('
system:floor:query
')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:floors:list
')"
)
@GetMapping
(
value
=
"/{floorId}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"floorId"
)
Long
floorId
)
{
...
...
@@ -64,7 +64,7 @@ public class SchoolFloorController extends BaseController
/**
* 新增楼层
*/
@PreAuthorize
(
"@ss.hasPermi('
system:floor
:add')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:floors
:add')"
)
@Log
(
title
=
"楼层"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
SchoolFloor
schoolFloor
)
...
...
@@ -75,7 +75,7 @@ public class SchoolFloorController extends BaseController
/**
* 修改楼层
*/
@PreAuthorize
(
"@ss.hasPermi('
system:floor:edit
')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:floors:update
')"
)
@Log
(
title
=
"楼层"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
SchoolFloor
schoolFloor
)
...
...
@@ -86,7 +86,7 @@ public class SchoolFloorController extends BaseController
/**
* 删除楼层
*/
@PreAuthorize
(
"@ss.hasPermi('
system:floor:remov
e')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:floors:delet
e')"
)
@Log
(
title
=
"楼层"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{floorId}"
)
public
AjaxResult
remove
(
@PathVariable
Long
floorId
)
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SchoolStudentInfoController.java
View file @
f59e4670
...
...
@@ -32,7 +32,7 @@ public class SchoolStudentInfoController extends BaseController
/**
* 查询【请填写功能名称】列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:
info
:list')"
)
@PreAuthorize
(
"@ss.hasPermi('system:
student
:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SchoolStudentInfo
schoolStudentInfo
)
{
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SpaceController.java
View file @
f59e4670
...
...
@@ -41,7 +41,7 @@ public class SpaceController extends BaseController
/**
* 查询房间列表
*/
@PreAuthorize
(
"@ss.hasPermi('
system:space
:list')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:spaces
:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
Space
space
)
{
...
...
@@ -73,7 +73,7 @@ public class SpaceController extends BaseController
/**
* 获取房间详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('
system:space:query
')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:spaces:list
')"
)
@GetMapping
(
value
=
"/{spaceId}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"spaceId"
)
Long
spaceId
)
{
...
...
@@ -83,7 +83,7 @@ public class SpaceController extends BaseController
/**
* 新增房间
*/
@PreAuthorize
(
"@ss.hasPermi('
system:space
:add')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:spaces
:add')"
)
@Log
(
title
=
"房间"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
Space
space
)
...
...
@@ -95,7 +95,7 @@ public class SpaceController extends BaseController
/**
* 修改房间
*/
@PreAuthorize
(
"@ss.hasPermi('
system:space:edit
')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:spaces:update
')"
)
@Log
(
title
=
"房间"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
Space
space
)
...
...
@@ -108,7 +108,7 @@ public class SpaceController extends BaseController
/**
* 删除房间
*/
@PreAuthorize
(
"@ss.hasPermi('
system:space:remov
e')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:spaces:delet
e')"
)
@Log
(
title
=
"房间"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{spaceIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
spaceIds
)
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SpaceSeatController.java
View file @
f59e4670
...
...
@@ -37,7 +37,7 @@ public class SpaceSeatController extends BaseController
/**
* 查询座位列表
*/
@PreAuthorize
(
"@ss.hasPermi('
system
:seat:list')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic
:seat:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SpaceSeat
spaceSeat
)
{
...
...
@@ -46,23 +46,11 @@ public class SpaceSeatController extends BaseController
return
getDataTable
(
list
);
}
/**
* 导出座位列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:seat:export')"
)
@Log
(
title
=
"座位"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
SpaceSeat
spaceSeat
)
{
List
<
SpaceSeat
>
list
=
spaceSeatService
.
selectSpaceSeatList
(
spaceSeat
);
ExcelUtil
<
SpaceSeat
>
util
=
new
ExcelUtil
<
SpaceSeat
>(
SpaceSeat
.
class
);
util
.
exportExcel
(
response
,
list
,
"座位数据"
);
}
/**
* 获取座位详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('
system:seat:query
')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:seat:list
')"
)
@GetMapping
(
value
=
"/{seatId}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"seatId"
)
Long
seatId
)
{
...
...
@@ -72,7 +60,7 @@ public class SpaceSeatController extends BaseController
/**
* 新增座位
*/
@PreAuthorize
(
"@ss.hasPermi('
system
:seat:add')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic
:seat:add')"
)
@Log
(
title
=
"座位"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
SpaceSeat
spaceSeat
)
...
...
@@ -83,7 +71,7 @@ public class SpaceSeatController extends BaseController
/**
* 修改座位
*/
@PreAuthorize
(
"@ss.hasPermi('
system:seat:edit
')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:seat:update
')"
)
@Log
(
title
=
"座位"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
SpaceSeat
spaceSeat
)
...
...
@@ -94,7 +82,7 @@ public class SpaceSeatController extends BaseController
/**
* 删除座位
*/
@PreAuthorize
(
"@ss.hasPermi('
system:seat:remov
e')"
)
@PreAuthorize
(
"@ss.hasPermi('
basic:seat:delet
e')"
)
@Log
(
title
=
"座位"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{seatIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
seatIds
)
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
View file @
f59e4670
...
...
@@ -61,6 +61,7 @@ public class SysLoginController
String
token
=
loginService
.
login
(
loginBody
.
getUsername
(),
loginBody
.
getPassword
(),
loginBody
.
getCode
(),
loginBody
.
getUuid
());
ajax
.
put
(
Constants
.
TOKEN
,
token
);
ajax
.
put
(
"loginType"
,
"console"
);
return
ajax
;
}
...
...
ruoyi-admin/src/main/resources/application-dev.yml
View file @
f59e4670
...
...
@@ -36,8 +36,9 @@ spring:
password
:
123456
# 从库数据源
slave
:
enabled
:
true
# 从数据源开关/默认关闭
url
:
jdbc:mysql://192.168.1.7:3306/lms
_
laboratory?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url
:
jdbc:mysql://192.168.1.7:3306/lms
-
laboratory?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username
:
root
password
:
123456
# 初始连接数
...
...
ruoyi-admin/src/main/resources/application-prod.yml
View file @
f59e4670
...
...
@@ -36,6 +36,7 @@ spring:
password
:
${SPRING_DATASOURCE_PASSWORD}
# 从库数据源
slave
:
enabled
:
false
# 从数据源开关/默认关闭
url
:
jdbc:mysql://10.184.203.56:3306/lms-laboratory?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username
:
rs_service
...
...
ruoyi-admin/src/main/resources/application.yml
View file @
f59e4670
...
...
@@ -35,7 +35,7 @@ server:
# 日志配置
logging
:
level
:
com.ruoyi
:
debug
com.ruoyi
:
info
org.springframework
:
warn
# 用户配置
...
...
ruoyi-admin/src/main/resources/cas/cas_success_response.xml
View file @
f59e4670
<cas:serviceResponse
xmlns:cas=
"http://www.yale.edu/tp/cas"
>
<cas:serviceResponse
xmlns:cas=
'http://www.yale.edu/tp/cas'
>
<cas:authenticationSuccess>
<cas:user>
test001
</cas:user>
<cas:user>
0202019370
</cas:user>
<cas:attributes>
<cas:attribute
name=
"name"
>
测试用户
</cas:attribute>
<cas:attribute
name=
"accountId"
>
1001
</cas:attribute>
<cas:attribute
name=
"userId"
>
1001
</cas:attribute>
<cas:attribute
name=
"userName"
>
student003
</cas:attribute>
<cas:attribute
name=
"identityTypeId"
>
1
</cas:attribute>
<cas:attribute
name=
"identityTypeCode"
>
S01
</cas:attribute>
<cas:attribute
name=
"identityTypeName"
>
本科生
</cas:attribute>
<cas:attribute
name=
"organizationId"
>
1
</cas:attribute>
<cas:attribute
name=
"organizationCode"
>
13002000
</cas:attribute>
<cas:attribute
name=
"organizationName"
>
计算机学院
</cas:attribute>
<cas:accountName>
0202019370
</cas:accountName>
<cas:identityTypeName>
教职工
</cas:identityTypeName>
<cas:organizationId>
3deb96c046b511f0b3f80af204f479f0
</cas:organizationId>
<cas:lang>
en
</cas:lang>
<cas:identityTypeCode>
T01
</cas:identityTypeCode>
<cas:organizationName>
未知
</cas:organizationName>
<cas:userName>
校友测试01
</cas:userName>
<cas:userId>
0b55d730473111f0b3f80af204f479f0
</cas:userId>
<cas:accountId>
0b57abf0473111f0b3f80af204f479f0
</cas:accountId>
<cas:organizationCode>
99999999
</cas:organizationCode>
<cas:name>
校友测试01
</cas:name>
<cas:identityTypeId>
3f63ab50412411f01845fe72bb852ecf
</cas:identityTypeId>
</cas:attributes>
</cas:authenticationSuccess>
</cas:serviceResponse>
ruoyi-common/pom.xml
View file @
f59e4670
...
...
@@ -151,6 +151,23 @@
<version>
3.6.4
</version>
</dependency>
<dependency>
<groupId>
javax.xml.bind
</groupId>
<artifactId>
jaxb-api
</artifactId>
<version>
2.3.1
</version>
</dependency>
<dependency>
<groupId>
com.sun.xml.bind
</groupId>
<artifactId>
jaxb-impl
</artifactId>
<version>
2.3.3
</version>
</dependency>
<dependency>
<groupId>
com.sun.xml.bind
</groupId>
<artifactId>
jaxb-core
</artifactId>
<version>
2.3.0.1
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
ruoyi-system/src/main/java/com/ruoyi/system/cas/Attributes.java
0 → 100644
View file @
f59e4670
package
com
.
ruoyi
.
system
.
cas
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlElement
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
class
Attributes
{
@XmlElement
(
name
=
"accountName"
,
namespace
=
"http://www.yale.edu/tp/cas"
)
private
String
accountName
;
@XmlElement
(
name
=
"identityTypeName"
,
namespace
=
"http://www.yale.edu/tp/cas"
)
private
String
identityTypeName
;
@XmlElement
(
name
=
"organizationId"
,
namespace
=
"http://www.yale.edu/tp/cas"
)
private
String
organizationId
;
@XmlElement
(
name
=
"lang"
,
namespace
=
"http://www.yale.edu/tp/cas"
)
private
String
lang
;
@XmlElement
(
name
=
"identityTypeCode"
,
namespace
=
"http://www.yale.edu/tp/cas"
)
private
String
identityTypeCode
;
@XmlElement
(
name
=
"organizationName"
,
namespace
=
"http://www.yale.edu/tp/cas"
)
private
String
organizationName
;
@XmlElement
(
name
=
"userName"
,
namespace
=
"http://www.yale.edu/tp/cas"
)
private
String
userName
;
@XmlElement
(
name
=
"userId"
,
namespace
=
"http://www.yale.edu/tp/cas"
)
private
String
userId
;
@XmlElement
(
name
=
"accountId"
,
namespace
=
"http://www.yale.edu/tp/cas"
)
private
String
accountId
;
@XmlElement
(
name
=
"organizationCode"
,
namespace
=
"http://www.yale.edu/tp/cas"
)
private
String
organizationCode
;
@XmlElement
(
name
=
"name"
,
namespace
=
"http://www.yale.edu/tp/cas"
)
private
String
name
;
@XmlElement
(
name
=
"identityTypeId"
,
namespace
=
"http://www.yale.edu/tp/cas"
)
private
String
identityTypeId
;
// Getters and Setters
public
String
getAccountName
()
{
return
accountName
;
}
public
void
setAccountName
(
String
accountName
)
{
this
.
accountName
=
accountName
;
}
public
String
getIdentityTypeName
()
{
return
identityTypeName
;
}
public
void
setIdentityTypeName
(
String
identityTypeName
)
{
this
.
identityTypeName
=
identityTypeName
;
}
public
String
getOrganizationId
()
{
return
organizationId
;
}
public
void
setOrganizationId
(
String
organizationId
)
{
this
.
organizationId
=
organizationId
;
}
public
String
getLang
()
{
return
lang
;
}
public
void
setLang
(
String
lang
)
{
this
.
lang
=
lang
;
}
public
String
getIdentityTypeCode
()
{
return
identityTypeCode
;
}
public
void
setIdentityTypeCode
(
String
identityTypeCode
)
{
this
.
identityTypeCode
=
identityTypeCode
;
}
public
String
getOrganizationName
()
{
return
organizationName
;
}
public
void
setOrganizationName
(
String
organizationName
)
{
this
.
organizationName
=
organizationName
;
}
public
String
getUserName
()
{
return
userName
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
public
String
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
}
public
String
getAccountId
()
{
return
accountId
;
}
public
void
setAccountId
(
String
accountId
)
{
this
.
accountId
=
accountId
;
}
public
String
getOrganizationCode
()
{
return
organizationCode
;
}
public
void
setOrganizationCode
(
String
organizationCode
)
{
this
.
organizationCode
=
organizationCode
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getIdentityTypeId
()
{
return
identityTypeId
;
}
public
void
setIdentityTypeId
(
String
identityTypeId
)
{
this
.
identityTypeId
=
identityTypeId
;
}
}
\ No newline at end of file
ruoyi-system/src/main/java/com/ruoyi/system/cas/AuthenticationSuccess.java
0 → 100644
View file @
f59e4670
package
com
.
ruoyi
.
system
.
cas
;
import
lombok.Data
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlElement
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
class
AuthenticationSuccess
{
@XmlElement
(
name
=
"user"
,
namespace
=
"http://www.yale.edu/tp/cas"
)
private
String
user
;
@XmlElement
(
name
=
"attributes"
,
namespace
=
"http://www.yale.edu/tp/cas"
)
private
Attributes
attributes
;
// Getters and Setters
public
String
getUser
()
{
return
user
;
}
public
void
setUser
(
String
user
)
{
this
.
user
=
user
;
}
public
Attributes
getAttributes
()
{
return
attributes
;
}
public
void
setAttributes
(
Attributes
attributes
)
{
this
.
attributes
=
attributes
;
}
}
\ No newline at end of file
ruoyi-system/src/main/java/com/ruoyi/system/cas/CasUserInfo.java
View file @
f59e4670
...
...
@@ -2,36 +2,54 @@ package com.ruoyi.system.cas;
import
lombok.Data
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlRootElement
;
@XmlRootElement
(
name
=
"serviceResponse"
,
namespace
=
"http://www.yale.edu/tp/cas"
)
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
@Data
public
class
CasUserInfo
{
/**
* 用户名(登录账号)
*/
private
String
username
;
/**
* 姓名
*/
private
String
name
;
/**
* 用户ID
*/
private
String
userId
;
/**
* 身份代码
*/
private
String
identityTypeCode
;
/**
* 组织机构编码
*/
private
String
organizationCode
;
/**
* 组织机构名称
*/
private
String
organizationName
;
@XmlElement
(
name
=
"authenticationSuccess"
,
namespace
=
"http://www.yale.edu/tp/cas"
)
private
AuthenticationSuccess
authenticationSuccess
;
// Getters and Setters
public
AuthenticationSuccess
getAuthenticationSuccess
()
{
return
authenticationSuccess
;
}
public
void
setAuthenticationSuccess
(
AuthenticationSuccess
authenticationSuccess
)
{
this
.
authenticationSuccess
=
authenticationSuccess
;
}
// 便捷方法,直接获取用户信息
public
String
getUsername
()
{
return
authenticationSuccess
!=
null
?
authenticationSuccess
.
getUser
()
:
null
;
}
public
String
getName
()
{
return
authenticationSuccess
!=
null
&&
authenticationSuccess
.
getAttributes
()
!=
null
?
authenticationSuccess
.
getAttributes
().
getName
()
:
null
;
}
public
String
getUserId
()
{
return
authenticationSuccess
!=
null
&&
authenticationSuccess
.
getAttributes
()
!=
null
?
authenticationSuccess
.
getAttributes
().
getUserId
()
:
null
;
}
public
String
getIdentityTypeCode
()
{
return
authenticationSuccess
!=
null
&&
authenticationSuccess
.
getAttributes
()
!=
null
?
authenticationSuccess
.
getAttributes
().
getIdentityTypeCode
()
:
null
;
}
public
String
getOrganizationCode
()
{
return
authenticationSuccess
!=
null
&&
authenticationSuccess
.
getAttributes
()
!=
null
?
authenticationSuccess
.
getAttributes
().
getOrganizationCode
()
:
null
;
}
public
String
getOrganizationName
()
{
return
authenticationSuccess
!=
null
&&
authenticationSuccess
.
getAttributes
()
!=
null
?
authenticationSuccess
.
getAttributes
().
getOrganizationName
()
:
null
;
}
}
\ No newline at end of file
ruoyi-system/src/main/java/com/ruoyi/system/cas/CasXmlParser.java
0 → 100644
View file @
f59e4670
package
com
.
ruoyi
.
system
.
cas
;
import
javax.xml.bind.JAXBContext
;
import
javax.xml.bind.JAXBException
;
import
javax.xml.bind.Unmarshaller
;
import
java.io.StringReader
;
public
class
CasXmlParser
{
public
static
CasUserInfo
parseCasResponse
(
String
xmlString
)
{
try
{
JAXBContext
jaxbContext
=
JAXBContext
.
newInstance
(
CasUserInfo
.
class
);
Unmarshaller
unmarshaller
=
jaxbContext
.
createUnmarshaller
();
StringReader
reader
=
new
StringReader
(
xmlString
);
return
(
CasUserInfo
)
unmarshaller
.
unmarshal
(
reader
);
}
catch
(
JAXBException
e
)
{
throw
new
RuntimeException
(
"解析CAS响应失败"
,
e
);
}
}
}
\ No newline at end of file
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ReservationApprovalImpl.java
View file @
f59e4670
...
...
@@ -49,6 +49,8 @@ public class ReservationApprovalImpl extends ServiceImpl<ReservationApprovalMapp
for
(
VerifyReservationApprovalProcessor
processor
:
processors
)
{
processor
.
VerifyReservationApproval
(
reservationApproval
);
}
reservationApproval
.
setSubmitAt
(
new
Date
());
reservationApproval
.
setSubmitBy
(
SecurityUtils
.
getUsername
());
reservationApproval
.
setStatus
(
ApprovalStatus
.
WAITING
.
getCode
());
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SchoolStudentInfoServiceImpl.java
View file @
f59e4670
...
...
@@ -18,7 +18,7 @@ import com.ruoyi.system.service.ISchoolStudentInfoService;
* @date 2025-11-10
*/
@Service
@DataSource
(
DataSourceType
.
SLAVE
)
public
class
SchoolStudentInfoServiceImpl
implements
ISchoolStudentInfoService
{
@Autowired
...
...
@@ -43,6 +43,7 @@ public class SchoolStudentInfoServiceImpl implements ISchoolStudentInfoService
* @return 【请填写功能名称】
*/
@Override
@DataSource
(
value
=
DataSourceType
.
SLAVE
)
public
List
<
SchoolStudentInfo
>
selectSchoolStudentInfoList
(
SchoolStudentInfo
schoolStudentInfo
)
{
return
schoolStudentInfoMapper
.
selectSchoolStudentInfoList
(
schoolStudentInfo
);
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SchoolTeacherInfoServiceImpl.java
View file @
f59e4670
...
...
@@ -43,6 +43,7 @@ public class SchoolTeacherInfoServiceImpl implements ISchoolTeacherInfoService
* @return 【请填写功能名称】
*/
@Override
@DataSource
(
value
=
DataSourceType
.
SLAVE
)
public
List
<
SchoolTeacherInfo
>
selectSchoolTeacherInfoList
(
SchoolTeacherInfo
schoolTeacherInfo
)
{
return
schoolTeacherInfoMapper
.
selectSchoolTeacherInfoList
(
schoolTeacherInfo
);
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SpaceServiceImpl.java
View file @
f59e4670
...
...
@@ -7,8 +7,11 @@ import cn.hutool.core.date.DateUtil;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.ruoyi.common.enums.ApprovalStatus
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.system.domain.ReservationApproval
;
import
com.ruoyi.system.domain.SpaceSeat
;
import
com.ruoyi.system.service.IReservationApprovalService
;
import
com.ruoyi.system.service.ISpaceSeatService
;
...
...
@@ -71,6 +74,13 @@ public class SpaceServiceImpl extends ServiceImpl<SpaceMapper,Space> implements
throw
new
ServiceException
(
"房间信息错误"
);
}
long
submitNum
=
reservationApprovalService
.
count
(
new
LambdaQueryWrapper
<
ReservationApproval
>()
.
eq
(
ReservationApproval:
:
getSubmitBy
,
SecurityUtils
.
getUsername
())
.
in
(
ReservationApproval:
:
getStatus
,
ApprovalStatus
.
WAITING
.
getCode
(),
ApprovalStatus
.
ALREADY_SIGN
.
getCode
(),
ApprovalStatus
.
PASS
.
getCode
())
.
ge
(
ReservationApproval:
:
getEndAt
,
startAt
)
.
le
(
ReservationApproval:
:
getStartAt
,
endAt
));
List
<
SpaceSeat
>
spaceSeats
=
spaceSeatService
.
list
(
new
LambdaQueryWrapper
<
SpaceSeat
>()
.
select
(
SpaceSeat:
:
getSeatId
,
SpaceSeat:
:
getSeatCode
,
SpaceSeat:
:
getSpaceCode
,
SpaceSeat:
:
getSeatName
)
.
eq
(
SpaceSeat:
:
getSpaceCode
,
space
.
getSpaceCode
()));
...
...
@@ -86,11 +96,14 @@ public class SpaceServiceImpl extends ServiceImpl<SpaceMapper,Space> implements
for
(
SpaceSeat
spaceSeat
:
spaceSeats
)
{
spaceSeat
.
setReservable
(
!
reservedSeatCodes
.
contains
(
spaceSeat
.
getSeatCode
())
//是否占用
//是否占用
!
reservedSeatCodes
.
contains
(
spaceSeat
.
getSeatCode
())
//是否达到最小预约时长
&&
DateUtil
.
between
(
startAt
,
endAt
,
DateUnit
.
MINUTE
)
>=
space
.
getMiniMumDuration
()
// 是否达到最小预约间隔
&&
DateUtil
.
between
(
new
Date
(),
startAt
,
DateUnit
.
DAY
)
>=
space
.
getInAdvanceDuration
()
// 同时段不能有申请
&&
submitNum
==
0
);
}
...
...
ruoyi-system/src/main/java/com/ruoyi/system/task/verifyReservationApproval/AlreadyApprovalProcessor.java
View file @
f59e4670
...
...
@@ -28,6 +28,19 @@ public class AlreadyApprovalProcessor implements VerifyReservationApprovalProces
public
void
VerifyReservationApproval
(
ReservationApproval
reservationApproval
)
{
long
submitNum
=
reservationApprovalService
.
count
(
new
LambdaQueryWrapper
<
ReservationApproval
>()
.
eq
(
ReservationApproval:
:
getSubmitBy
,
reservationApproval
.
getSubmitBy
())
.
in
(
ReservationApproval:
:
getStatus
,
ApprovalStatus
.
WAITING
.
getCode
(),
ApprovalStatus
.
ALREADY_SIGN
.
getCode
(),
ApprovalStatus
.
PASS
.
getCode
())
.
ge
(
ReservationApproval:
:
getEndAt
,
reservationApproval
.
getStartAt
())
.
le
(
ReservationApproval:
:
getStartAt
,
reservationApproval
.
getEndAt
()));
if
(
submitNum
>
0
){
throw
new
ServiceException
(
"你存在一个时间重合的申请,请重新选择时段"
);
}
int
maxWait
=
Integer
.
parseInt
(
configService
.
selectConfigByKey
(
CONFIG_KEY
));
long
count
=
reservationApprovalService
.
count
(
new
LambdaQueryWrapper
<
ReservationApproval
>()
...
...
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