Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pseer
gxpt_ht
Commits
595d122e
Commit
595d122e
authored
Mar 02, 2024
by
wuwenlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增房间状态(上架,下架,维护),下架时用户端房间列表不展示,下架与维护中下单限制,房间预约时段锁定
parent
5dd55333
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
74 additions
and
40 deletions
+74
-40
RoomStatEnum.java
...common/src/main/java/share/common/enums/RoomStatEnum.java
+14
-2
SCleanRecordsController.java
.../share/web/controller/system/SCleanRecordsController.java
+0
-2
SRoomController.java
...ain/java/share/web/controller/system/SRoomController.java
+2
-5
SRoom.java
share-system/src/main/java/share/system/domain/SRoom.java
+5
-0
SRoomVo.java
...-system/src/main/java/share/system/domain/vo/SRoomVo.java
+1
-1
RoomStatusService.java
...src/main/java/share/system/service/RoomStatusService.java
+2
-1
RoomStatusServiceImpl.java
...java/share/system/service/impl/RoomStatusServiceImpl.java
+34
-22
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+12
-5
SRoomServiceImpl.java
...main/java/share/system/service/impl/SRoomServiceImpl.java
+2
-2
SRoomMapper.xml
...e-system/src/main/resources/mapper/system/SRoomMapper.xml
+2
-0
No files found.
share-common/src/main/java/share/common/enums/RoomStatEnum.java
View file @
595d122e
package
share
.
common
.
enums
;
import
share.common.utils.StringUtils
;
/**
* @className: share.common.enums.RoomStatEnum
* @description: 门店房间上下架
...
...
@@ -7,8 +9,8 @@ package share.common.enums;
* @create: 2024-02-28 13:46
*/
public
enum
RoomStatEnum
{
GROUNDING
(
1
,
"上架"
),
UNDERCARRIAGE
(
2
,
"下架"
),
ITEM_UP_SHELF
(
1
,
"上架"
),
ITEM_DOWN_SHELF
(
2
,
"下架"
),
MAINTENANCE
(
3
,
"维护"
);
private
Integer
value
;
...
...
@@ -19,6 +21,16 @@ public enum RoomStatEnum {
this
.
name
=
name
;
}
public
static
RoomStatEnum
getEnumByValue
(
Integer
value
){
if
(
value
!=
null
)
{
for
(
RoomStatEnum
stat
:
RoomStatEnum
.
values
())
{
if
(
stat
.
value
.
compareTo
(
value
)
==
0
)
{
return
stat
;
}
}
}
return
null
;
}
public
Integer
getValue
()
{
return
value
;
...
...
share-front/src/main/java/share/web/controller/system/SCleanRecordsController.java
View file @
595d122e
...
...
@@ -48,8 +48,6 @@ public class SCleanRecordsController extends BaseController
{
@Autowired
private
ISCleanRecordsService
sCleanRecordsService
;
@Autowired
private
SStoreConsumerMapper
storeConsumerMapper
;
/**
* 查询保洁记录列表
...
...
share-front/src/main/java/share/web/controller/system/SRoomController.java
View file @
595d122e
...
...
@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.*
;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.R
;
import
share.common.enums.RoomStatEnum
;
import
share.system.domain.SPack
;
import
share.system.domain.SRoom
;
import
share.system.domain.vo.RoomStatusVo
;
...
...
@@ -36,17 +37,13 @@ public class SRoomController extends BaseController {
@Autowired
private
RoomStatusService
roomStatusService
;
@Autowired
private
IPackService
packService
;
@Autowired
private
DeviceLogService
deviceLogService
;
/**
* 查询房间列表
*/
@ApiOperation
(
value
=
"房间列表"
)
@GetMapping
(
"/list"
)
public
R
<
List
<
SRoomVo
>>
list
(
SRoom
sRoom
)
{
sRoom
.
setQueryNotRoomStat
(
RoomStatEnum
.
ITEM_DOWN_SHELF
.
getValue
());
List
<
SRoomVo
>
list
=
sRoomService
.
selectSRoomVoList
(
sRoom
);
return
R
.
ok
(
list
);
}
...
...
share-system/src/main/java/share/system/domain/SRoom.java
View file @
595d122e
...
...
@@ -132,4 +132,9 @@ public class SRoom extends BaseEntity
@TableField
(
exist
=
false
)
private
String
storeName
;
/** 查询条件:非此房间状态 */
@TableField
(
exist
=
false
)
private
Integer
queryNotRoomStat
;
}
share-system/src/main/java/share/system/domain/vo/SRoomVo.java
View file @
595d122e
...
...
@@ -98,7 +98,7 @@ public class SRoomVo extends BaseEntity
/**
* 房间上下架(1-上架,2-下架,3-维护)
*/
@
Excel
(
name
=
"房间上下架
"
)
@
ApiModelProperty
(
value
=
"房间上下架(1-上架,2-下架,3-维护)
"
)
private
Integer
roomStat
;
/**
...
...
share-system/src/main/java/share/system/service/RoomStatusService.java
View file @
595d122e
package
share
.
system
.
service
;
import
share.system.domain.SRoom
;
import
share.system.domain.vo.RoomStatusVo
;
import
java.util.Date
;
...
...
@@ -27,6 +28,6 @@ public interface RoomStatusService {
* @param roomIds
* @return List<RoomStatusVo>
*/
List
<
RoomStatusVo
>
listRoomStatus
(
Long
storeId
,
List
<
Long
>
roomIds
);
List
<
RoomStatusVo
>
listRoomStatus
(
Long
storeId
,
List
<
SRoom
>
roomList
);
}
share-system/src/main/java/share/system/service/impl/RoomStatusServiceImpl.java
View file @
595d122e
...
...
@@ -4,16 +4,10 @@ import org.apache.commons.collections4.CollectionUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.constant.Constants
;
import
share.common.enums.CleaningStatusEnum
;
import
share.common.enums.OrderStatusEnum
;
import
share.common.enums.OrderTypeEnum
;
import
share.common.enums.RoomStatusEnum
;
import
share.common.enums.*
;
import
share.common.utils.DateUtils
;
import
share.common.utils.StringUtils
;
import
share.system.domain.SCleanRecords
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SOrder
;
import
share.system.domain.SStore
;
import
share.system.domain.*
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.RoomStatusVo
;
import
share.system.service.*
;
...
...
@@ -43,6 +37,9 @@ public class RoomStatusServiceImpl implements RoomStatusService {
@Autowired
private
ISCleanRecordsService
cleanRecordsService
;
@Autowired
private
ISRoomService
roomService
;
@Override
public
List
<
RoomStatusVo
>
roomStatus
(
Long
storeId
,
Long
roomId
,
Date
day
,
Integer
orderType
)
{
SConsumer
user
=
consumerService
.
getInfo
();
...
...
@@ -54,13 +51,14 @@ public class RoomStatusServiceImpl implements RoomStatusService {
// 通过门店及房间查询指定日期T+1的订单
List
<
SOrder
>
orderList
=
orderService
.
listByRoomInfo
(
storeId
,
new
ArrayList
<
Long
>(){{
add
(
roomId
);}},
day
);
SCleanRecords
cleanRecords
=
cleanRecordsService
.
lastCleanByRoomId
(
roomId
);
List
<
RoomStatusVo
>
voList
=
generatorRoomStatusList
(
store
,
roomId
,
orderList
,
cleanRecords
,
day
,
orderType
,
user
);
voList
.
addAll
(
generatorRoomStatusList
(
store
,
roomId
,
orderList
,
cleanRecords
,
DateUtils
.
addDays
(
day
,
1
),
orderType
,
user
));
SRoom
room
=
roomService
.
getById
(
roomId
);
List
<
RoomStatusVo
>
voList
=
generatorRoomStatusList
(
store
,
room
,
orderList
,
cleanRecords
,
day
,
orderType
,
user
);
voList
.
addAll
(
generatorRoomStatusList
(
store
,
room
,
orderList
,
cleanRecords
,
DateUtils
.
addDays
(
day
,
1
),
orderType
,
user
));
return
voList
;
}
@Override
public
List
<
RoomStatusVo
>
listRoomStatus
(
Long
storeId
,
List
<
Long
>
roomIds
)
{
public
List
<
RoomStatusVo
>
listRoomStatus
(
Long
storeId
,
List
<
SRoom
>
roomList
)
{
SConsumer
user
=
consumerService
.
getInfo
();
if
(
user
!=
null
){
FrontTokenComponent
.
loginSConsumerEntryThreadLocal
.
set
(
user
);
...
...
@@ -68,6 +66,7 @@ public class RoomStatusServiceImpl implements RoomStatusService {
Date
day
=
new
Date
();
//查询门店营业时间
SStore
store
=
storeService
.
getById
(
storeId
);
List
<
Long
>
roomIds
=
roomList
.
stream
().
map
(
SRoom:
:
getId
).
collect
(
Collectors
.
toList
());
// 通过门店及房间查询指定日期T+1的订单
List
<
SOrder
>
orderList
=
orderService
.
listByRoomInfo
(
storeId
,
roomIds
,
day
);
Map
<
Long
,
List
<
SOrder
>>
orderMap
=
Optional
.
ofNullable
(
orderList
).
orElse
(
new
ArrayList
<>()).
parallelStream
().
collect
(
Collectors
.
groupingBy
(
SOrder:
:
getRoomId
));
...
...
@@ -77,9 +76,9 @@ public class RoomStatusServiceImpl implements RoomStatusService {
}
List
<
RoomStatusVo
>
voList
=
new
ArrayList
<>();
Map
<
Long
,
SCleanRecords
>
finalCleanRecordMap
=
cleanRecordMap
;
room
Ids
.
stream
().
forEach
(
roomId
->
{
voList
.
addAll
(
generatorRoomStatusList
(
store
,
room
Id
,
orderMap
.
get
(
roomId
),
finalCleanRecordMap
.
get
(
roomId
),
day
,
OrderTypeEnum
.
RESERVER
.
getCode
(),
user
));
voList
.
addAll
(
generatorRoomStatusList
(
store
,
room
Id
,
orderMap
.
get
(
roomId
),
finalCleanRecordMap
.
get
(
roomId
),
DateUtils
.
addDays
(
day
,
1
),
OrderTypeEnum
.
RESERVER
.
getCode
(),
user
));
room
List
.
stream
().
forEach
(
room
->
{
voList
.
addAll
(
generatorRoomStatusList
(
store
,
room
,
orderMap
.
get
(
room
.
getId
()),
finalCleanRecordMap
.
get
(
room
.
getId
()
),
day
,
OrderTypeEnum
.
RESERVER
.
getCode
(),
user
));
voList
.
addAll
(
generatorRoomStatusList
(
store
,
room
,
orderMap
.
get
(
room
.
getId
()),
finalCleanRecordMap
.
get
(
room
.
getId
()
),
DateUtils
.
addDays
(
day
,
1
),
OrderTypeEnum
.
RESERVER
.
getCode
(),
user
));
});
return
voList
;
}
...
...
@@ -87,7 +86,7 @@ public class RoomStatusServiceImpl implements RoomStatusService {
private
List
<
RoomStatusVo
>
generatorRoomStatusList
(
SStore
store
,
Long
roomId
,
List
<
SOrder
>
orderList
,
SCleanRecords
cleanRecords
,
Date
day
,
Integer
orderType
,
SConsumer
user
){
private
List
<
RoomStatusVo
>
generatorRoomStatusList
(
SStore
store
,
SRoom
room
,
List
<
SOrder
>
orderList
,
SCleanRecords
cleanRecords
,
Date
day
,
Integer
orderType
,
SConsumer
user
){
String
nowTime
=
"00:00"
;
String
dayStr
=
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
day
);
Boolean
isToday
=
StringUtils
.
equals
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
day
)
...
...
@@ -108,22 +107,35 @@ public class RoomStatusServiceImpl implements RoomStatusService {
timeHour
=
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
day
)
+
" "
+
lock
;
}
vo
.
setStoreId
(
store
.
getId
());
vo
.
setRoomId
(
room
Id
);
vo
.
setRoomId
(
room
.
getId
()
);
vo
.
setTimeHour
(
timeHour
);
Date
timeHourDate
=
DateUtils
.
parseDate
(
timeHour
);
setTimeHourStatus
(
vo
,
timeHourDate
,
store
,
orderList
,
cleanRecords
,
dayStr
,
finalNowTime
,
isToday
,
orderType
,
user
);
setTimeHourStatus
(
vo
,
timeHourDate
,
store
,
room
,
orderList
,
cleanRecords
,
dayStr
,
finalNowTime
,
isToday
,
orderType
,
user
);
voList
.
add
(
vo
);
});
return
voList
;
}
//设置时间段房间可预约状态(可预约:大于营业开始时间,小于营业结束时间,大于当前时间,当前时间没有订单)
private
void
setTimeHourStatus
(
RoomStatusVo
vo
,
Date
timeHourDate
,
SStore
store
,
List
<
SOrder
>
orderList
,
SCleanRecords
cleanRecords
,
String
day
,
String
finalNowTime
,
Boolean
isToday
,
Integer
orderType
,
SConsumer
user
){
private
void
setTimeHourStatus
(
RoomStatusVo
vo
,
Date
timeHourDate
,
SStore
store
,
SRoom
room
,
List
<
SOrder
>
orderList
,
SCleanRecords
cleanRecords
,
String
day
,
String
finalNowTime
,
Boolean
isToday
,
Integer
orderType
,
SConsumer
user
){
vo
.
setStatus
(
RoomStatusEnum
.
FREE
.
getValue
());
checkIsDirtyRoom
(
vo
,
timeHourDate
,
store
,
cleanRecords
,
day
);
checkTimeHourToSysDate
(
vo
,
timeHourDate
,
day
,
finalNowTime
,
isToday
);
checkTimeHourToBusiness
(
vo
,
timeHourDate
,
store
,
day
);
checkTimeHourToOrder
(
vo
,
timeHourDate
,
orderList
,
cleanRecords
,
orderType
,
user
);
if
(
checkRoomUpShelf
(
vo
,
timeHourDate
,
room
))
{
checkIsDirtyRoom
(
vo
,
timeHourDate
,
store
,
cleanRecords
,
day
);
checkTimeHourToSysDate
(
vo
,
timeHourDate
,
day
,
finalNowTime
,
isToday
);
checkTimeHourToBusiness
(
vo
,
timeHourDate
,
store
,
day
);
checkTimeHourToOrder
(
vo
,
timeHourDate
,
orderList
,
cleanRecords
,
orderType
,
user
);
}
}
//校验房间是否维修中,维修中不可预定
private
Boolean
checkRoomUpShelf
(
RoomStatusVo
vo
,
Date
timeHourDate
,
SRoom
room
){
if
(
room
.
getRoomStat
()!=
null
&&
RoomStatEnum
.
ITEM_UP_SHELF
.
getValue
().
compareTo
(
room
.
getRoomStat
())!=
0
){
vo
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
changeStartHoldTime
(
vo
,
timeHourDate
);
changeEndHoldTime
(
vo
,
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
return
false
;
}
return
true
;
}
private
void
checkIsDirtyRoom
(
RoomStatusVo
vo
,
Date
timeHourDate
,
SStore
store
,
SCleanRecords
cleanRecords
,
String
day
){
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
595d122e
...
...
@@ -510,9 +510,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
List
<
SStore
>
stores
=
storeService
.
list
();
SRoom
room
=
roomService
.
getById
(
request
.
getRoomId
());
if
(
ObjectUtil
.
isNotEmpty
(
room
)
&&
room
.
getIsDirtyRoom
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
throw
new
BaseException
(
"未保洁,不能预定!"
);
}
checkOrderRoomStat
(
room
);
//生成订单
SOrder
sOrder
=
generatSOrder
(
request
,
user
);
//校验订单金额
...
...
@@ -603,11 +601,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
RENEWAL_SUCCESS
.
getCode
(),
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
cn
.
hutool
.
core
.
date
.
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
SRoom
sRoom
=
roomService
.
getById
(
sOrder
.
getRoomId
());
//
SRoom sRoom = roomService.getById(sOrder.getRoomId());
//通知保洁人员
sConsumerService
.
selectListByStoreId
(
sOrder
.
getStoreId
()).
stream
().
forEach
(
item
->
{
// 循环发送短信提示门店保洁打扫卫生
smsService
.
sendSmsCleanRecordsStopRemind
(
item
.
getPhone
(),
stores
.
stream
().
filter
(
store
->
store
.
getId
().
equals
(
request
.
getStoreId
())).
findFirst
().
get
(),
sR
oom
);
smsService
.
sendSmsCleanRecordsStopRemind
(
item
.
getPhone
(),
stores
.
stream
().
filter
(
store
->
store
.
getId
().
equals
(
request
.
getStoreId
())).
findFirst
().
get
(),
r
oom
);
});
}
}
...
...
@@ -742,6 +740,15 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
}
private
void
checkOrderRoomStat
(
SRoom
room
)
{
if
(
ObjectUtil
.
isNotEmpty
(
room
)){
throw
new
BaseException
(
"房间不存在!"
);
}
if
(
room
.
getRoomStat
()!=
null
&&
RoomStatEnum
.
ITEM_UP_SHELF
.
getValue
().
compareTo
(
room
.
getRoomStat
())!=
0
){
throw
new
BaseException
(
"房间维护中,不可预定!"
);
}
}
private
void
checkOrderPrice
(
SOrder
order
,
SConsumer
user
)
{
OrderComputedPriceRequest
request
=
new
OrderComputedPriceRequest
();
BeanUtils
.
copyProperties
(
order
,
request
);
...
...
share-system/src/main/java/share/system/service/impl/SRoomServiceImpl.java
View file @
595d122e
...
...
@@ -125,7 +125,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
Map
<
Long
,
List
<
SRoomPack
>>
roomPackMap
=
Optional
.
ofNullable
(
roomPacks
).
orElse
(
new
ArrayList
<>()).
stream
().
collect
(
Collectors
.
groupingBy
(
SRoomPack:
:
getRoomId
));
List
<
Long
>
packIdList
=
Optional
.
ofNullable
(
roomPacks
).
orElse
(
new
ArrayList
<>()).
stream
().
map
(
SRoomPack:
:
getPackId
).
collect
(
Collectors
.
toList
());
List
<
SPack
>
packList
=
packService
.
selectPackListByIds
(
packIdList
);
List
<
RoomStatusVo
>
roomStatusVoList
=
roomStatusService
.
listRoomStatus
(
store
.
getId
(),
room
Ids
);
List
<
RoomStatusVo
>
roomStatusVoList
=
roomStatusService
.
listRoomStatus
(
store
.
getId
(),
room
List
);
Map
<
Long
,
List
<
RoomStatusVo
>>
roomStatusMap
=
Optional
.
ofNullable
(
roomStatusVoList
).
orElse
(
new
ArrayList
<>()).
stream
().
collect
(
Collectors
.
groupingBy
(
RoomStatusVo:
:
getRoomId
));
roomList
.
stream
().
forEach
(
sRoom
->
{
SRoomVo
vo
=
new
SRoomVo
();
...
...
@@ -209,7 +209,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
@Override
public
int
updateSRoom
(
SRoom
sRoom
)
{
SRoom
room
=
baseMapper
.
selectSRoomById
(
sRoom
.
getId
());
if
(
RoomStatEnum
.
UNDERCARRIAGE
.
getValue
().
equals
(
sRoom
.
getRoomStat
())
&&
if
(
RoomStatEnum
.
ITEM_DOWN_SHELF
.
getValue
().
equals
(
sRoom
.
getRoomStat
())
&&
!
sRoom
.
getRoomStat
().
equals
(
room
.
getRoomStat
()))
{
// 房间下架验证是否存在使用中、待使用的订单
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
();
...
...
share-system/src/main/resources/mapper/system/SRoomMapper.xml
View file @
595d122e
...
...
@@ -73,6 +73,8 @@
<if
test=
"params1 != null and params1 != ''"
>
and params1 = #{params1}
</if>
<if
test=
"params2 != null and params2 != ''"
>
and params2 = #{params2}
</if>
<if
test=
"roomStat != null"
>
and room_stat = #{roomStat}
</if>
<if
test=
"queryNotRoomStat != null "
>
and room_stat != #{queryNotRoomStat}
</if>
</where>
order by sort desc
...
...
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