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
66882c4e
Commit
66882c4e
authored
Dec 01, 2023
by
wuwenlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
order pack check dev;
parent
18424b91
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
12 deletions
+95
-12
ISOrderService.java
...em/src/main/java/share/system/service/ISOrderService.java
+7
-0
PackServiceImpl.java
.../main/java/share/system/service/impl/PackServiceImpl.java
+46
-11
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+37
-0
SStoreServiceImpl.java
...ain/java/share/system/service/impl/SStoreServiceImpl.java
+5
-1
No files found.
share-system/src/main/java/share/system/service/ISOrderService.java
View file @
66882c4e
...
@@ -164,4 +164,11 @@ public interface ISOrderService extends IService<SOrder>
...
@@ -164,4 +164,11 @@ public interface ISOrderService extends IService<SOrder>
* @return
* @return
*/
*/
boolean
autoRefund
(
OrderRefundRequest
request
);
boolean
autoRefund
(
OrderRefundRequest
request
);
/**
* 通过用户ID查询已支付未退款的订单
* @param userId
* @return
*/
List
<
SOrder
>
payedUnrefundListByUserId
(
Long
userId
);
}
}
share-system/src/main/java/share/system/service/impl/PackServiceImpl.java
View file @
66882c4e
package
share
.
system
.
service
.
impl
;
package
share
.
system
.
service
.
impl
;
import
java.util.
ArrayList
;
import
java.util.
*
;
import
java.util.
List
;
import
java.util.
stream.Collectors
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.collections4.CollectionUtils
;
import
share.common.enums.YesNoEnum
;
import
share.common.utils.DateUtils
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SOrder
;
import
share.system.mapper.PackMapper
;
import
share.system.mapper.PackMapper
;
import
share.system.domain.SPack
;
import
share.system.domain.SPack
;
import
share.system.service.IPackService
;
import
share.system.service.IPackService
;
import
share.system.service.ISOrderService
;
import
share.system.service.SConsumerService
;
/**
/**
* 套餐Service业务层处理
* 套餐Service业务层处理
...
@@ -21,7 +27,10 @@ import share.system.service.IPackService;
...
@@ -21,7 +27,10 @@ import share.system.service.IPackService;
@Service
@Service
public
class
PackServiceImpl
extends
ServiceImpl
<
PackMapper
,
SPack
>
implements
IPackService
{
public
class
PackServiceImpl
extends
ServiceImpl
<
PackMapper
,
SPack
>
implements
IPackService
{
@Autowired
@Autowired
private
PackMapper
packMapper
;
private
SConsumerService
consumerService
;
@Autowired
private
ISOrderService
orderService
;
/**
/**
* 查询套餐
* 查询套餐
...
@@ -31,7 +40,7 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
...
@@ -31,7 +40,7 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
*/
*/
@Override
@Override
public
SPack
selectPackById
(
Long
id
)
{
public
SPack
selectPackById
(
Long
id
)
{
return
pack
Mapper
.
selectPackById
(
id
);
return
base
Mapper
.
selectPackById
(
id
);
}
}
/**
/**
...
@@ -42,7 +51,20 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
...
@@ -42,7 +51,20 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
*/
*/
@Override
@Override
public
List
<
SPack
>
selectPackList
(
SPack
SPack
)
{
public
List
<
SPack
>
selectPackList
(
SPack
SPack
)
{
return
packMapper
.
selectPackList
(
SPack
);
List
<
SPack
>
packList
=
baseMapper
.
selectPackList
(
SPack
);
SConsumer
user
=
consumerService
.
getInfo
();
List
<
SOrder
>
orderList
=
new
ArrayList
<>();
if
(
Objects
.
nonNull
(
user
)&&
Objects
.
nonNull
(
user
.
getId
())){
orderList
=
orderService
.
payedUnrefundListByUserId
(
user
.
getId
());
}
List
<
SOrder
>
finalOrderList
=
orderList
;
return
Optional
.
ofNullable
(
packList
).
orElse
(
new
ArrayList
<>()).
stream
().
filter
(
pack
->
{
if
(
YesNoEnum
.
yes
.
getIndex
().
compareTo
(
pack
.
getFirstOrderAvailable
())==
0
&&
CollectionUtils
.
isNotEmpty
(
finalOrderList
)){
return
false
;
}
return
true
;
}).
collect
(
Collectors
.
toList
());
}
}
/**
/**
...
@@ -54,7 +76,7 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
...
@@ -54,7 +76,7 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
@Override
@Override
public
int
insertPack
(
SPack
sPack
)
{
public
int
insertPack
(
SPack
sPack
)
{
sPack
.
setCreateTime
(
DateUtils
.
getNowDate
());
sPack
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
pack
Mapper
.
insertPack
(
sPack
);
return
base
Mapper
.
insertPack
(
sPack
);
}
}
/**
/**
...
@@ -66,7 +88,7 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
...
@@ -66,7 +88,7 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
@Override
@Override
public
int
updatePack
(
SPack
SPack
)
{
public
int
updatePack
(
SPack
SPack
)
{
SPack
.
setUpdateTime
(
DateUtils
.
getNowDate
());
SPack
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
pack
Mapper
.
updatePack
(
SPack
);
return
base
Mapper
.
updatePack
(
SPack
);
}
}
/**
/**
...
@@ -77,7 +99,7 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
...
@@ -77,7 +99,7 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
*/
*/
@Override
@Override
public
int
deletePackByIds
(
Long
[]
ids
)
{
public
int
deletePackByIds
(
Long
[]
ids
)
{
return
pack
Mapper
.
deletePackByIds
(
ids
);
return
base
Mapper
.
deletePackByIds
(
ids
);
}
}
/**
/**
...
@@ -88,7 +110,7 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
...
@@ -88,7 +110,7 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
*/
*/
@Override
@Override
public
int
deletePackById
(
Long
id
)
{
public
int
deletePackById
(
Long
id
)
{
return
pack
Mapper
.
deletePackById
(
id
);
return
base
Mapper
.
deletePackById
(
id
);
}
}
@Override
@Override
...
@@ -98,13 +120,26 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
...
@@ -98,13 +120,26 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
}
}
LambdaQueryWrapper
<
SPack
>
queryWrapper
=
new
LambdaQueryWrapper
();
LambdaQueryWrapper
<
SPack
>
queryWrapper
=
new
LambdaQueryWrapper
();
queryWrapper
.
in
(
SPack:
:
getId
,
packIds
);
queryWrapper
.
in
(
SPack:
:
getId
,
packIds
);
return
packMapper
.
selectList
(
queryWrapper
);
List
<
SPack
>
packList
=
baseMapper
.
selectList
(
queryWrapper
);
SConsumer
user
=
consumerService
.
getInfo
();
List
<
SOrder
>
orderList
=
new
ArrayList
<>();
if
(
Objects
.
nonNull
(
user
)&&
Objects
.
nonNull
(
user
.
getId
())){
orderList
=
orderService
.
payedUnrefundListByUserId
(
user
.
getId
());
}
List
<
SOrder
>
finalOrderList
=
orderList
;
return
Optional
.
ofNullable
(
packList
).
orElse
(
new
ArrayList
<>()).
stream
().
filter
(
pack
->
{
if
(
YesNoEnum
.
yes
.
getIndex
().
compareTo
(
pack
.
getFirstOrderAvailable
())==
0
&&
CollectionUtils
.
isNotEmpty
(
finalOrderList
)){
return
false
;
}
return
true
;
}).
collect
(
Collectors
.
toList
());
}
}
@Override
@Override
public
Long
addPack
(
SPack
sPack
)
{
public
Long
addPack
(
SPack
sPack
)
{
sPack
.
setCreateTime
(
DateUtils
.
getNowDate
());
sPack
.
setCreateTime
(
DateUtils
.
getNowDate
());
pack
Mapper
.
insertPack
(
sPack
);
base
Mapper
.
insertPack
(
sPack
);
return
sPack
.
getId
();
return
sPack
.
getId
();
}
}
}
}
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
66882c4e
...
@@ -303,6 +303,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -303,6 +303,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
checkOrderPrice
(
sOrder
,
user
);
checkOrderPrice
(
sOrder
,
user
);
//校验订单预约时间
//校验订单预约时间
checkOrderDate
(
request
);
checkOrderDate
(
request
);
//校验订单套餐
checkOrderPack
(
request
,
user
);
OrderPayResultResponse
response
=
new
OrderPayResultResponse
();
OrderPayResultResponse
response
=
new
OrderPayResultResponse
();
if
(
request
.
getPayFee
().
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
{
if
(
request
.
getPayFee
().
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
{
response
.
setPayType
(
PayTypeEnum
.
WECHAT
.
getValue
());
response
.
setPayType
(
PayTypeEnum
.
WECHAT
.
getValue
());
...
@@ -348,6 +350,27 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -348,6 +350,27 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
return
response
;
return
response
;
}
}
private
void
checkOrderPack
(
CreateOrderRequest
request
,
SConsumer
user
)
{
if
(
Objects
.
nonNull
(
request
.
getPackId
())
&&
request
.
getPackId
()>
0
){
//判断是否首次订单套餐
SPack
pack
=
packService
.
getById
(
request
.
getPackId
());
if
(
Objects
.
isNull
(
pack
)||
Objects
.
isNull
(
pack
.
getId
())){
throw
new
BaseException
(
"下单套餐不存在!"
);
}
if
(
YesNoEnum
.
yes
.
getIndex
().
compareTo
(
pack
.
getFirstOrderAvailable
())==
0
){
List
<
SOrder
>
orderList
=
payedUnrefundListByUserId
(
user
.
getId
());
if
(
CollectionUtils
.
isNotEmpty
(
orderList
)){
throw
new
BaseException
(
"当前套餐仅首次下单可用!"
);
}
}
Date
now
=
new
Date
();
if
(
now
.
compareTo
(
request
.
getPreStartDate
())>
0
||
now
.
compareTo
(
request
.
getPreEndDate
())<
0
){
throw
new
BaseException
(
"预约时段非套餐可用时段!"
);
}
}
}
private
void
checkOrderDate
(
CreateOrderRequest
request
)
{
private
void
checkOrderDate
(
CreateOrderRequest
request
)
{
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
notIn
(
SOrder:
:
getRefundStatus
,
RefundStatusEnum
.
getRefundedStatus
());
queryWrapper
.
notIn
(
SOrder:
:
getRefundStatus
,
RefundStatusEnum
.
getRefundedStatus
());
...
@@ -730,6 +753,20 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -730,6 +753,20 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
return
execute
;
return
execute
;
}
}
@Override
public
List
<
SOrder
>
payedUnrefundListByUserId
(
Long
userId
)
{
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
SOrder:
:
getPayStatus
,
YesNoEnum
.
yes
.
getIndex
());
queryWrapper
.
eq
(
SOrder:
:
getConsumerId
,
userId
);
queryWrapper
.
notIn
(
SOrder:
:
getRefundStatus
,
RefundStatusEnum
.
getRefundedStatus
());
queryWrapper
.
in
(
SOrder:
:
getStatus
,
new
ArrayList
<
Integer
>(){{
add
(
OrderStatusEnum
.
UNUSED
.
getCode
());
add
(
OrderStatusEnum
.
INUSE
.
getCode
());
add
(
OrderStatusEnum
.
USED
.
getCode
());
}});
return
list
(
queryWrapper
);
}
/**
/**
* 订单DO集合转换VO集合,按距离排序
* 订单DO集合转换VO集合,按距离排序
*
*
...
...
share-system/src/main/java/share/system/service/impl/SStoreServiceImpl.java
View file @
66882c4e
...
@@ -54,6 +54,10 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
...
@@ -54,6 +54,10 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
private
ISCleanRecordsService
cleanRecordsService
;
private
ISCleanRecordsService
cleanRecordsService
;
@Autowired
@Autowired
private
IRoomPackService
roomPackService
;
private
IRoomPackService
roomPackService
;
@Autowired
private
SConsumerService
consumerService
;
@Autowired
private
ISOrderService
orderService
;
/**
/**
* 查询门店
* 查询门店
...
@@ -249,7 +253,7 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
...
@@ -249,7 +253,7 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
List
<
Long
>
roomIds
=
roomVoList
.
stream
().
map
(
SRoomVo:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
roomIds
=
roomVoList
.
stream
().
map
(
SRoomVo:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
SRoomPack
>
roomPacks
=
roomPackService
.
listByRoomIds
(
roomIds
);
List
<
SRoomPack
>
roomPacks
=
roomPackService
.
listByRoomIds
(
roomIds
);
List
<
Long
>
packIds
=
roomPacks
.
stream
().
map
(
SRoomPack:
:
getPackId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
packIds
=
roomPacks
.
stream
().
map
(
SRoomPack:
:
getPackId
).
collect
(
Collectors
.
toList
());
List
<
SPack
>
packs
=
packService
.
l
istByIds
(
packIds
);
List
<
SPack
>
packs
=
packService
.
selectPackL
istByIds
(
packIds
);
Map
<
Long
,
SPack
>
packMap
=
Optional
.
ofNullable
(
packs
).
orElse
(
new
ArrayList
<>()).
stream
().
collect
(
Collectors
.
toMap
(
SPack:
:
getId
,
o
->
o
,(
k1
,
k2
)->
k1
));
Map
<
Long
,
SPack
>
packMap
=
Optional
.
ofNullable
(
packs
).
orElse
(
new
ArrayList
<>()).
stream
().
collect
(
Collectors
.
toMap
(
SPack:
:
getId
,
o
->
o
,(
k1
,
k2
)->
k1
));
roomVoList
.
stream
().
forEach
(
sRoomVo
->
{
roomVoList
.
stream
().
forEach
(
sRoomVo
->
{
List
<
SPack
>
sPacks
=
new
ArrayList
<>();
List
<
SPack
>
sPacks
=
new
ArrayList
<>();
...
...
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