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
4ab7e743
Commit
4ab7e743
authored
Jan 05, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
保洁完成增加查询当前房间当前时间加5分钟有没有预约订单
parent
c46efc2b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
8 deletions
+30
-8
SCleanRecordsServiceImpl.java
...a/share/system/service/impl/SCleanRecordsServiceImpl.java
+30
-8
No files found.
share-system/src/main/java/share/system/service/impl/SCleanRecordsServiceImpl.java
View file @
4ab7e743
package
share
.
system
.
service
.
impl
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.date.DateUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.collections4.CollectionUtils
;
import
share.common.constant.Constants
;
import
share.common.enums.CleaningStatusEnum
;
import
share.common.enums.OpTypeEnum
;
import
share.common.enums.RoleTypeEnum
;
import
share.common.enums.*
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SRoom
;
import
share.system.domain.SStore
;
import
share.system.domain.*
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.mapper.SCleanRecordsMapper
;
import
share.system.domain.SCleanRecords
;
import
share.system.mapper.SConsumerMapper
;
import
share.system.mapper.SRoomMapper
;
import
share.system.mapper.SStoreMapper
;
import
share.system.service.DeviceOpService
;
import
share.system.service.ISCleanRecordsService
;
import
share.system.service.ISOrderService
;
import
share.system.service.SmsService
;
/**
...
...
@@ -46,12 +46,16 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
private
SmsService
smsService
;
@Autowired
private
DeviceOpService
deviceOpService
;
@Autowired
private
ISOrderService
orderService
;
//管理员手机号
private
static
final
String
phone
=
"13888888888"
;
//5秒延迟
private
static
final
Long
FIVE
=
5L
;
private
static
final
int
CLEANING
=
5
;
/**
* 查询保洁记录
*
...
...
@@ -201,12 +205,30 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
if
(
list
.
size
()
==
0
)
{
return
Boolean
.
FALSE
;
}
//获取List的房间集合
List
<
Long
>
roomIds
=
list
.
stream
().
map
(
SCleanRecords:
:
getRoomId
).
collect
(
Collectors
.
toList
());
LambdaQueryWrapper
<
SOrder
>
sOrderLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
sOrderLambdaQueryWrapper
.
in
(
SOrder:
:
getRoomId
,
roomIds
);
sOrderLambdaQueryWrapper
.
eq
(
SOrder:
:
getOrderType
,
OrderTypeEnum
.
RESERVER
.
getCode
());
sOrderLambdaQueryWrapper
.
between
(
SOrder:
:
getPreStartDate
,
now
,
DateUtil
.
offsetMinute
(
now
,
CLEANING
));
List
<
SOrder
>
orderList
=
orderService
.
list
(
sOrderLambdaQueryWrapper
);
if
(
CollectionUtils
.
isNotEmpty
(
orderList
))
{
List
<
Long
>
orderRoomIds
=
orderList
.
stream
().
map
(
SOrder:
:
getRoomId
).
collect
(
Collectors
.
toList
());
list
=
list
.
stream
().
filter
(
item
->
orderRoomIds
.
contains
(
item
.
getRoomId
())).
collect
(
Collectors
.
toList
());
}
//查询当前房间当前时间加5分钟有没有预约订单
for
(
SCleanRecords
sCleanRecords
:
list
)
{
sCleanRecords
.
setStatus
(
2
);
sCleanRecords
.
setStartDate
(
now
);
sCleanRecords
.
setEndDate
(
now
);
sCleanRecords
.
setUpdateTime
(
now
);
deviceOpService
.
openOrCloseDevice
(
sCleanRecords
.
getRoomId
(),
phone
,
OpTypeEnum
.
CUT_ELECTRIC
.
getCode
(),
true
,
FIVE
);
List
<
Long
>
unusedOrderRoomIds
=
Optional
.
ofNullable
(
orderList
).
orElse
(
new
ArrayList
<>()).
stream
().
filter
(
order
->
order
.
getStatus
().
equals
(
OrderStatusEnum
.
UNUSED
.
getCode
()))
.
map
(
SOrder:
:
getRoomId
).
collect
(
Collectors
.
toList
());
if
(
unusedOrderRoomIds
.
contains
(
sCleanRecords
.
getRoomId
()))
{
deviceOpService
.
openOrCloseDevice
(
sCleanRecords
.
getRoomId
(),
phone
,
OpTypeEnum
.
CUT_ELECTRIC
.
getCode
(),
true
,
FIVE
);
}
}
return
0
<
baseMapper
.
updateBatch
(
list
);
}
...
...
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