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
af462e53
Commit
af462e53
authored
Sep 06, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改差异
parent
e942d99d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
143 additions
and
1 deletions
+143
-1
RoomStatusServiceImpl.java
...java/share/system/service/impl/RoomStatusServiceImpl.java
+1
-1
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+142
-0
No files found.
share-system/src/main/java/share/system/service/impl/RoomStatusServiceImpl.java
View file @
af462e53
...
...
@@ -112,7 +112,7 @@ public class RoomStatusServiceImpl implements RoomStatusService {
queryWrapper
.
ge
(
SOrder:
:
getEndDate
,
DateUtils
.
addMinutes
(
DateUtils
.
getNowDate
(),
-
15
));
SOrder
one
=
orderService
.
getOne
(
queryWrapper
);
if
(
ObjectUtils
.
isEmpty
(
one
))
{
isAvailable
=
fals
e
;
isAvailable
=
tru
e
;
}
else
{
isAvailable
=
true
;
}
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
af462e53
...
...
@@ -3098,4 +3098,146 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
return
baseMapper
.
couponIds
(
sOrder
);
}
@Override
public
List
<
OrderVo
>
statisticsOrderList
(
OrderStatisticsRequest
request
)
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
if
(!
user
.
getRoleType
().
equals
(
RoleTypeEnum
.
CLEANER
.
getCode
()))
{
throw
new
RuntimeException
(
"当前用户不是店员"
);
}
List
<
SOrder
>
orderList
=
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
SOrder
>()
.
eq
(
SOrder:
:
getStoreId
,
request
.
getStoreId
())
.
eq
(
SOrder:
:
getIsDelete
,
YesNoEnum
.
no
.
getIndex
())
.
eq
(
SOrder:
:
getPayStatus
,
YesNoEnum
.
yes
.
getIndex
())
.
ge
(
SOrder:
:
getCreateTime
,
request
.
getStartTime
())
.
le
(
SOrder:
:
getCreateTime
,
request
.
getEndTime
())
.
orderByDesc
(
SOrder:
:
getCreateTime
)
);
List
<
OrderVo
>
orderVoList
=
new
ArrayList
<>();
if
(
CollectionUtil
.
isEmpty
(
orderList
))
{
return
new
ArrayList
<>();
}
List
<
Long
>
longs
=
storeConsumerMapper
.
selectByConsumerId
(
user
.
getId
(),
PositionEnum
.
MANAGE
.
getCode
());
if
(
CollectionUtils
.
isEmpty
(
longs
))
{
throw
new
RuntimeException
(
"当前用户不是门店管理人员"
);
}
//判断longs是否包含request.getStoreId()
if
(!
longs
.
contains
(
request
.
getStoreId
()))
{
throw
new
RuntimeException
(
"当前用户不是该门店管理人员"
);
}
Map
<
Long
,
SCoupon
>
sCouponMap
=
sCouponService
.
list
().
stream
().
collect
(
Collectors
.
toMap
(
SCoupon:
:
getId
,
Function
.
identity
()));
Map
<
Long
,
SStore
>
sStoreMap
=
storeService
.
list
().
stream
().
collect
(
Collectors
.
toMap
(
SStore:
:
getId
,
Function
.
identity
()));
Map
<
Long
,
SRoom
>
sRoomMap
=
roomService
.
list
().
stream
().
collect
(
Collectors
.
toMap
(
SRoom:
:
getId
,
Function
.
identity
()));
Map
<
Long
,
SConsumerCoupon
>
map
=
new
HashMap
<>();
//优惠券id集合,去掉为null的
List
<
Long
>
ids
=
orderList
.
stream
().
map
(
SOrder:
:
getCouponId
).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toList
());
List
<
Long
>
consumerIds
=
orderList
.
stream
().
map
(
SOrder:
:
getConsumerId
).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toList
());
Map
<
Long
,
SConsumer
>
consumerMap
=
sConsumerService
.
listByIds
(
consumerIds
).
stream
().
collect
(
Collectors
.
toMap
(
SConsumer:
:
getId
,
Function
.
identity
()));
if
(
CollectionUtil
.
isNotEmpty
(
ids
))
{
map
.
putAll
(
consumerCouponService
.
selectByIds
(
ids
).
stream
().
collect
(
Collectors
.
toMap
(
SConsumerCoupon:
:
getId
,
Function
.
identity
())));
}
List
<
OrderVo
>
finalOrderVoList
=
orderVoList
;
//计算开始时间和结束时间相差多少天
if
(
ObjectUtil
.
isNotEmpty
(
request
.
getStartTime
())
&&
ObjectUtil
.
isNotEmpty
(
request
.
getEndTime
()))
{
long
between
=
DateUtil
.
getTwoDateDays
(
request
.
getStartTime
(),
request
.
getEndTime
());
//大于30天,截取结束时间减30天的订单
if
(
between
>
30
)
{
Date
date
=
DateUtil
.
addDay
(
request
.
getEndTime
(),
-
30
);
orderList
=
orderList
.
stream
().
filter
(
order
->
order
.
getCreateTime
().
after
(
date
)).
collect
(
Collectors
.
toList
());
}
}
orderList
.
stream
().
forEach
(
order
->
{
OrderVo
orderVo
=
new
OrderVo
();
SConsumer
sConsumer
=
consumerMap
.
get
(
order
.
getConsumerId
());
if
(
ObjectUtil
.
isNotEmpty
(
sConsumer
))
{
orderVo
.
setNickName
(
sConsumer
.
getNickName
());
orderVo
.
setAvatar
(
sConsumer
.
getAvatar
());
}
BeanUtils
.
copyProperties
(
order
,
orderVo
);
orderVo
.
setOrderNo
(
order
.
getOrderNo
());
orderVo
.
setPayType
(
order
.
getPayType
());
orderVo
.
setOrderType
(
order
.
getOrderType
());
orderVo
.
setStoreName
(
sStoreMap
.
get
(
order
.
getStoreId
()).
getName
());
orderVo
.
setRoomName
(
sRoomMap
.
get
(
order
.
getRoomId
()).
getName
());
orderVo
.
setCreateTime
(
order
.
getCreateTime
());
orderVo
.
setCouponPayPrice
(
BigDecimal
.
ZERO
);
if
(
order
.
getStatus
().
equals
(
OrderStatusEnum
.
CANCEL
.
getCode
())
&&
order
.
getRefundStatus
().
equals
(
RefundStatusEnum
.
REFUNDED
.
getCode
()))
{
if
(!
map
.
isEmpty
())
{
if
(
ObjectUtil
.
isNotEmpty
(
order
.
getCouponId
()))
{
SConsumerCoupon
sConsumerCoupon
=
map
.
get
(
order
.
getCouponId
());
if
(
ObjectUtil
.
isEmpty
(
sConsumerCoupon
))
{
return
;
}
orderVo
.
setCouponCode
(
sConsumerCoupon
.
getCouponCode
());
if
(
sConsumerCoupon
.
getCouponType
().
equals
(
CouponTypeEnum
.
CASH
.
getCode
()))
{
if
(
sConsumerCoupon
.
getPlatformType
().
equals
(
PlatformTypeEnum
.
MEITUAN
.
getCode
()))
{
orderVo
.
setPlatformType
(
PlatformTypeEnum
.
MEITUAN
.
getCode
());
if
(
sConsumerCoupon
.
getUseStatus
().
equals
(
UserStatusEnum
.
EXPIRED
.
getCode
()))
{
orderVo
.
setCouponPayPrice
(
BigDecimal
.
ZERO
);
}
else
{
if
(
ObjectUtil
.
isNotEmpty
(
sConsumerCoupon
.
getCouponPayPrice
()))
{
orderVo
.
setCouponPayPrice
(
sConsumerCoupon
.
getCouponPayPrice
());
}
else
{
SCoupon
sCoupon
=
sCouponMap
.
get
(
sConsumerCoupon
.
getCouponId
());
orderVo
.
setCouponPayPrice
(
sCoupon
.
getCouponPayPrice
());
}
}
}
else
if
(
sConsumerCoupon
.
getPlatformType
().
equals
(
PlatformTypeEnum
.
TIKTOK
.
getCode
()))
{
orderVo
.
setPlatformType
(
PlatformTypeEnum
.
TIKTOK
.
getCode
());
if
(
sConsumerCoupon
.
getUseStatus
().
equals
(
UserStatusEnum
.
EXPIRED
.
getCode
()))
{
orderVo
.
setCouponPayPrice
(
BigDecimal
.
ZERO
);
}
else
{
if
(
ObjectUtil
.
isNotEmpty
(
sConsumerCoupon
.
getCouponPayPrice
()))
{
orderVo
.
setCouponPayPrice
(
sConsumerCoupon
.
getCouponPayPrice
());
}
else
{
SCoupon
sCoupon
=
sCouponMap
.
get
(
sConsumerCoupon
.
getCouponId
());
orderVo
.
setCouponPayPrice
(
sCoupon
.
getCouponPayPrice
());
}
}
}
}
}
}
}
if
(!
map
.
isEmpty
())
{
if
(
ObjectUtil
.
isNotEmpty
(
order
.
getCouponId
()))
{
SConsumerCoupon
sConsumerCoupon
=
map
.
get
(
order
.
getCouponId
());
if
(
ObjectUtil
.
isEmpty
(
sConsumerCoupon
))
{
return
;
}
orderVo
.
setCouponCode
(
sConsumerCoupon
.
getCouponCode
());
if
(
sConsumerCoupon
.
getCouponType
().
equals
(
CouponTypeEnum
.
CASH
.
getCode
()))
{
if
(
sConsumerCoupon
.
getPlatformType
().
equals
(
PlatformTypeEnum
.
MEITUAN
.
getCode
()))
{
orderVo
.
setPlatformType
(
PlatformTypeEnum
.
MEITUAN
.
getCode
());
if
(
sConsumerCoupon
.
getUseStatus
().
equals
(
UserStatusEnum
.
EXPIRED
.
getCode
()))
{
orderVo
.
setCouponPayPrice
(
BigDecimal
.
ZERO
);
}
else
{
if
(
ObjectUtil
.
isNotEmpty
(
sConsumerCoupon
.
getCouponPayPrice
()))
{
orderVo
.
setCouponPayPrice
(
sConsumerCoupon
.
getCouponPayPrice
());
}
else
{
SCoupon
sCoupon
=
sCouponMap
.
get
(
sConsumerCoupon
.
getCouponId
());
orderVo
.
setCouponPayPrice
(
sCoupon
.
getCouponPayPrice
());
}
}
}
else
if
(
sConsumerCoupon
.
getPlatformType
().
equals
(
PlatformTypeEnum
.
TIKTOK
.
getCode
()))
{
orderVo
.
setPlatformType
(
PlatformTypeEnum
.
TIKTOK
.
getCode
());
if
(
sConsumerCoupon
.
getUseStatus
().
equals
(
UserStatusEnum
.
EXPIRED
.
getCode
()))
{
orderVo
.
setCouponPayPrice
(
BigDecimal
.
ZERO
);
}
else
{
if
(
ObjectUtil
.
isNotEmpty
(
sConsumerCoupon
.
getCouponPayPrice
()))
{
orderVo
.
setCouponPayPrice
(
sConsumerCoupon
.
getCouponPayPrice
());
}
else
{
SCoupon
sCoupon
=
sCouponMap
.
get
(
sConsumerCoupon
.
getCouponId
());
orderVo
.
setCouponPayPrice
(
sCoupon
.
getCouponPayPrice
());
}
}
}
}
}
}
finalOrderVoList
.
add
(
orderVo
);
});
return
orderVoList
;
}
}
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