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
e0f4be20
Commit
e0f4be20
authored
Nov 23, 2023
by
wuwenlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
order bug fix ;
order code opt;
parent
fb0c4c41
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
110 additions
and
117 deletions
+110
-117
SOrderController.java
...in/java/share/web/controller/system/SOrderController.java
+0
-2
SOrderController.java
...in/java/share/web/controller/system/SOrderController.java
+1
-1
SOrder.java
share-system/src/main/java/share/system/domain/SOrder.java
+0
-28
SOrderVo.java
...system/src/main/java/share/system/domain/vo/SOrderVo.java
+8
-0
ISOrderService.java
...em/src/main/java/share/system/service/ISOrderService.java
+8
-0
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+93
-86
No files found.
share-admin/src/main/java/share/web/controller/system/SOrderController.java
View file @
e0f4be20
...
...
@@ -5,8 +5,6 @@ import javax.servlet.http.HttpServletResponse;
import
io.swagger.annotations.ApiOperation
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
...
...
share-front/src/main/java/share/web/controller/system/SOrderController.java
View file @
e0f4be20
...
...
@@ -58,7 +58,7 @@ public class SOrderController extends BaseController
startPage
();
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
sOrder
.
setConsumerId
(
user
.
getId
());
List
<
SOrder
>
list
=
sOrderService
.
selectSOrder
List
(
sOrder
);
List
<
SOrder
Vo
>
list
=
sOrderService
.
selectSOrderVo
List
(
sOrder
);
return
getDataTable
(
list
);
}
...
...
share-system/src/main/java/share/system/domain/SOrder.java
View file @
e0f4be20
...
...
@@ -137,34 +137,6 @@ public class SOrder extends BaseEntity
@TableField
(
select
=
false
)
private
Integer
isDelete
;
@TableField
(
exist
=
false
)
private
Integer
buyType
;
//优惠卷名称
@TableField
(
exist
=
false
)
private
String
couponName
;
//套餐名称
@TableField
(
exist
=
false
)
private
String
packName
;
//门店名称
@TableField
(
exist
=
false
)
private
String
storeName
;
//房间名称
@TableField
(
exist
=
false
)
private
String
roomName
;
//房间图片
@TableField
(
exist
=
false
)
private
String
roomImages
;
//是否可以申请退款
@TableField
(
exist
=
false
)
private
Boolean
isRefund
;
}
share-system/src/main/java/share/system/domain/vo/SOrderVo.java
View file @
e0f4be20
...
...
@@ -197,4 +197,12 @@ public class SOrderVo
@ApiModelProperty
(
name
=
"是否可以申请退款"
)
private
Boolean
isRefund
;
//优惠卷名称
@ApiModelProperty
(
name
=
"优惠卷名称"
)
private
String
couponName
;
//套餐名称
@ApiModelProperty
(
name
=
"套餐名称"
)
private
String
packName
;
}
share-system/src/main/java/share/system/service/ISOrderService.java
View file @
e0f4be20
...
...
@@ -37,6 +37,14 @@ public interface ISOrderService extends IService<SOrder>
public
List
<
SOrder
>
selectSOrderList
(
SOrder
sOrder
);
/**
* 查询订单列表
*
* @param sOrder 订单
* @return 订单集合
*/
public
List
<
SOrderVo
>
selectSOrderVoList
(
SOrder
sOrder
);
/**
* 新增订单
*
* @param sOrder 订单
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
e0f4be20
...
...
@@ -51,9 +51,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
private
Long
allowRefundTime
;
@Autowired
private
SOrderMapper
sOrderMapper
;
@Autowired
private
SConsumerService
sConsumerService
;
@Autowired
...
...
@@ -100,7 +97,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
*/
@Override
public
SOrder
selectSOrderById
(
Long
id
)
{
return
sOrder
Mapper
.
selectSOrderById
(
id
);
return
base
Mapper
.
selectSOrderById
(
id
);
}
/**
...
...
@@ -111,58 +108,69 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
*/
@Override
public
List
<
SOrder
>
selectSOrderList
(
SOrder
sOrder
)
{
List
<
SOrder
>
sOrders
=
new
ArrayList
<>();
if
(
ObjectUtil
.
isNotEmpty
(
sOrder
.
getStatus
()))
{
List
<
SOrder
>
orders
=
new
ArrayList
<>();
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
SOrder:
:
getPayStatus
,
YesNoEnum
.
yes
.
getIndex
());
if
(
sOrder
.
getStatus
().
equals
(
OrderStatusEnum
.
CANCEL
.
getCode
()))
{
if
(
ObjectUtil
.
isNotEmpty
(
sOrder
.
getStatus
()))
{
OrderStatusEnum
orderStatusEnum
=
OrderStatusEnum
.
getEnumByCode
(
sOrder
.
getStatus
());
switch
(
orderStatusEnum
){
case
CANCEL:
queryWrapper
.
in
(
SOrder:
:
getStatus
,
new
ArrayList
<
Integer
>()
{{
add
(
OrderStatusEnum
.
CANCEL
.
getCode
());
add
(
OrderStatusEnum
.
REFUNDING
.
getCode
());
add
(
OrderStatusEnum
.
REFUNDED
.
getCode
());
}});
}
else
if
(
sOrder
.
getStatus
().
equals
(
OrderStatusEnum
.
UNUSED
.
getCode
()))
{
queryWrapper
.
eq
(
SOrder:
:
getStatus
,
OrderStatusEnum
.
UNUSED
.
getCode
());
}
else
if
(
sOrder
.
getStatus
().
equals
(
OrderStatusEnum
.
INUSE
.
getCode
()))
{
queryWrapper
.
eq
(
SOrder:
:
getStatus
,
OrderStatusEnum
.
INUSE
.
getCode
());
}
else
if
(
sOrder
.
getStatus
().
equals
(
OrderStatusEnum
.
USED
.
getCode
()))
{
queryWrapper
.
eq
(
SOrder:
:
getStatus
,
OrderStatusEnum
.
USED
.
getCode
());
}
if
(
ObjectUtil
.
isNotEmpty
(
sOrder
.
getConsumerId
()))
{
queryWrapper
.
eq
(
SOrder:
:
getConsumerId
,
sOrder
.
getConsumerId
());
break
;
case
UNUSED:
case
INUSE:
case
USED:
queryWrapper
.
eq
(
SOrder:
:
getStatus
,
sOrder
.
getStatus
());
break
;
default
:
break
;
}
sOrders
=
sOrder
Mapper
.
selectList
(
queryWrapper
);
orders
=
base
Mapper
.
selectList
(
queryWrapper
);
}
else
{
sOrders
=
sOrder
Mapper
.
selectSOrderList
(
sOrder
);
orders
=
base
Mapper
.
selectSOrderList
(
sOrder
);
}
if
(
CollectionUtils
.
isNotEmpty
(
sOrders
))
{
sOrders
.
stream
().
forEach
(
item
->
{
if
(
ObjectUtil
.
isNotNull
(
item
.
getCouponId
()))
{
SConsumerCoupon
byId
=
consumerCouponService
.
getById
(
item
.
getCouponId
());
item
.
setCouponName
(
byId
.
getName
());
// 判断是否可以退款
item
.
setIsRefund
(
isRefund
(
item
,
byId
));
}
else
{
// 判断是否可以退款
item
.
setIsRefund
(
isRefund
(
item
,
null
));
return
orders
;
}
if
(
ObjectUtil
.
isNotNull
(
item
.
getPackId
()))
{
SPack
byId
=
packService
.
getById
(
item
.
getPackId
());
item
.
setPackName
(
byId
.
getName
());
/**
* 查询订单列表
*
* @param sOrder 订单
* @return 订单
*/
@Override
public
List
<
SOrderVo
>
selectSOrderVoList
(
SOrder
sOrder
)
{
return
convertDosToVos
(
selectSOrderList
(
sOrder
));
}
if
(
ObjectUtil
.
isNotNull
(
item
.
getStoreId
()))
{
SStore
byId
=
storeService
.
getById
(
item
.
getStoreId
());
item
.
setStoreName
(
byId
.
getName
());
/**
* 验证是否可以申请退款
* @param orderVo 订单信息
* @param coupon 优惠券信息
* @return
*/
private
boolean
isRefund
(
SOrderVo
orderVo
,
SConsumerCoupon
coupon
)
{
if
(
coupon
!=
null
&&
!
PlatformTypeEnum
.
SELF
.
getCode
().
equals
(
coupon
.
getPlatformType
()))
{
return
Boolean
.
FALSE
;
}
else
if
(
orderVo
!=
null
&&
OrderStatusEnum
.
UNUSED
.
getCode
().
equals
(
orderVo
.
getStatus
())){
Date
startTime
=
orderVo
.
getPreStartDate
();
Date
nowTime
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
date
();
if
(
startTime
.
compareTo
(
nowTime
)
<=
0
)
{
return
Boolean
.
FALSE
;
}
if
(
ObjectUtil
.
isNotNull
(
item
.
getRoomId
()))
{
SRoom
byId
=
roomService
.
getById
(
item
.
getRoomId
());
item
.
setRoomName
(
byId
.
getName
());
long
between
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
between
(
nowTime
,
startTime
,
DateUnit
.
SECOND
);
if
(
between
>
allowRefundTime
&&
RefundStatusEnum
.
UNREFUND
.
getCode
().
equals
(
orderVo
.
getRefundStatus
()))
{
return
Boolean
.
TRUE
;
}
});
}
return
sOrders
;
return
Boolean
.
FALSE
;
}
/**
...
...
@@ -188,7 +196,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
return
Boolean
.
FALSE
;
}
/**
* 新增订单
*
...
...
@@ -198,7 +205,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Override
public
int
insertSOrder
(
SOrder
sOrder
)
{
sOrder
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
sOrder
Mapper
.
insertSOrder
(
sOrder
);
return
base
Mapper
.
insertSOrder
(
sOrder
);
}
/**
...
...
@@ -210,7 +217,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Override
public
int
updateSOrder
(
SOrder
sOrder
)
{
sOrder
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
sOrder
Mapper
.
updateSOrder
(
sOrder
);
return
base
Mapper
.
updateSOrder
(
sOrder
);
}
/**
...
...
@@ -221,7 +228,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
*/
@Override
public
int
deleteSOrderByIds
(
Long
[]
ids
)
{
return
sOrder
Mapper
.
deleteSOrderByIds
(
ids
);
return
base
Mapper
.
deleteSOrderByIds
(
ids
);
}
/**
...
...
@@ -232,7 +239,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
*/
@Override
public
int
deleteSOrderById
(
Long
id
)
{
return
sOrder
Mapper
.
deleteSOrderById
(
id
);
return
base
Mapper
.
deleteSOrderById
(
id
);
}
@Override
...
...
@@ -396,15 +403,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
LambdaQueryWrapper
<
SOrder
>
lqw
=
Wrappers
.
lambdaQuery
();
lqw
.
eq
(
SOrder:
:
getOrderNo
,
orderNo
);
SOrder
order
=
getOne
(
lqw
);
if
(
ObjectUtil
.
isNotNull
(
order
.
getCouponId
()))
{
SConsumerCoupon
byId
=
consumerCouponService
.
getById
(
order
.
getCouponId
());
order
.
setCouponName
(
byId
.
getName
());
// 判断是否可以退款
order
.
setIsRefund
(
isRefund
(
order
,
byId
));
}
else
{
// 判断是否可以退款
order
.
setIsRefund
(
isRefund
(
order
,
null
));
}
return
order
;
}
...
...
@@ -494,7 +492,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
SOrder:
:
getPayStatus
,
PayStatusEnum
.
PAID
.
getCode
());
queryWrapper
.
ne
(
SOrder:
:
getRefundStatus
,
RefundStatusEnum
.
UNREFUND
.
getCode
());
return
sOrder
Mapper
.
selectList
(
queryWrapper
);
return
base
Mapper
.
selectList
(
queryWrapper
);
}
@Override
...
...
@@ -524,28 +522,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
SOrder:
:
getOrderNo
,
orderNo
);
SOrder
one
=
getOne
(
queryWrapper
);
if
(
ObjectUtil
.
isNotEmpty
(
one
.
getCouponId
()))
{
SConsumerCoupon
consumerCoupon
=
consumerCouponService
.
getById
(
one
.
getCouponId
());
one
.
setCouponName
(
consumerCoupon
.
getName
());
// 判断是否可以退款
one
.
setIsRefund
(
isRefund
(
one
,
consumerCoupon
));
}
else
{
// 判断是否可以退款
one
.
setIsRefund
(
isRefund
(
one
,
null
));
}
if
(
ObjectUtil
.
isNotEmpty
(
one
.
getPackId
()))
{
SPack
byId
=
packService
.
getById
(
one
.
getPackId
());
one
.
setPackName
(
byId
.
getName
());
}
if
(
ObjectUtil
.
isNotEmpty
(
one
.
getStoreId
()))
{
SStore
sStore
=
storeService
.
getById
(
one
.
getStoreId
());
one
.
setStoreName
(
sStore
.
getName
());
}
if
(
ObjectUtil
.
isNotEmpty
(
one
.
getRoomId
()))
{
SRoom
sRoom
=
roomService
.
getById
(
one
.
getRoomId
());
one
.
setRoomImages
(
sRoom
.
getImages
());
one
.
setRoomName
(
sRoom
.
getName
());
}
return
one
;
}
...
...
@@ -564,6 +540,19 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
vo
.
setLatitude
(
store
.
getLatitude
());
vo
.
setManager
(
store
.
getManager
());
vo
.
setPhone
(
store
.
getPhone
());
if
(
ObjectUtil
.
isNotEmpty
(
vo
.
getCouponId
()))
{
SConsumerCoupon
consumerCoupon
=
consumerCouponService
.
getById
(
vo
.
getCouponId
());
vo
.
setCouponName
(
consumerCoupon
.
getName
());
// 判断是否可以退款
vo
.
setIsRefund
(
isRefund
(
vo
,
consumerCoupon
));
}
else
{
// 判断是否可以退款
vo
.
setIsRefund
(
isRefund
(
vo
,
null
));
}
if
(
ObjectUtil
.
isNotEmpty
(
vo
.
getPackId
()))
{
SPack
byId
=
packService
.
getById
(
vo
.
getPackId
());
vo
.
setPackName
(
byId
.
getName
());
}
return
vo
;
}
...
...
@@ -583,7 +572,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Override
public
void
paymentSuccessful
(
SOrder
sOrder
)
{
sOrder
Mapper
.
updateById
(
sOrder
);
base
Mapper
.
updateById
(
sOrder
);
Long
couponId
=
sOrder
.
getCouponId
();
if
(
couponId
!=
null
&&
couponId
>
0
)
{
SConsumerCoupon
consumerCoupon
=
consumerCouponService
.
getById
(
couponId
);
...
...
@@ -597,7 +586,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SConsumptionRecords
sConsumptionRecords
=
new
SConsumptionRecords
();
sConsumptionRecords
.
setConsumerId
(
sOrder
.
getConsumerId
());
sConsumptionRecords
.
setOrderId
(
sOrder
.
getId
());
sConsumptionRecords
.
setName
(
sOrder
.
getPackName
());
if
(
Objects
.
nonNull
(
sOrder
.
getPackId
()))
{
SPack
pack
=
packService
.
getById
(
sOrder
.
getPackId
());
sConsumptionRecords
.
setName
(
Objects
.
nonNull
(
pack
)?
pack
.
getName
():
null
);
}
sConsumptionRecords
.
setPrice
(
sOrder
.
getPayPrice
());
sConsumptionRecordsService
.
insertSConsumptionRecords
(
sConsumptionRecords
);
}
...
...
@@ -681,8 +673,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if
(
CollectionUtils
.
isNotEmpty
(
orderList
))
{
List
<
Long
>
storeIds
=
orderList
.
stream
().
map
(
SOrder:
:
getStoreId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
roomIds
=
orderList
.
stream
().
map
(
SOrder:
:
getRoomId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
couponIds
=
orderList
.
stream
().
map
(
SOrder:
:
getCouponId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
packIds
=
orderList
.
stream
().
map
(
SOrder:
:
getPackId
).
collect
(
Collectors
.
toList
());
List
<
SStore
>
storeList
=
storeService
.
listByIds
(
storeIds
);
List
<
SRoom
>
roomList
=
roomService
.
listByIds
(
roomIds
);
List
<
SConsumerCoupon
>
userCouponList
=
consumerCouponService
.
listByIds
(
couponIds
);
List
<
SPack
>
packList
=
packService
.
listByIds
(
packIds
);
orderList
.
stream
().
forEach
(
o
->
{
SOrderVo
vo
=
new
SOrderVo
();
BeanUtils
.
copyProperties
(
o
,
vo
);
...
...
@@ -697,14 +693,25 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
vo
.
setRoomName
(
room
.
getName
());
}
});
if
(
ObjectUtil
.
isNotEmpty
(
o
.
getCouponId
()))
{
SConsumerCoupon
consumerCoupon
=
consumerCouponService
.
getById
(
o
.
getCouponId
());
if
(
Objects
.
nonNull
(
vo
.
getCouponId
()))
{
userCouponList
.
stream
().
forEach
(
userCoupon
->
{
if
(
userCoupon
.
getId
().
equals
(
vo
.
getCouponId
()))
{
// 判断是否可以退款
vo
.
setIsRefund
(
isRefund
(
o
,
consumerCoupon
));
}
else
{
vo
.
setIsRefund
(
isRefund
(
vo
,
userCoupon
));
}
});
}
else
{
// 判断是否可以退款
vo
.
setIsRefund
(
isRefund
(
o
,
null
));
}
if
(
Objects
.
nonNull
(
vo
.
getPackId
()))
{
packList
.
stream
().
forEach
(
pack
->
{
if
(
pack
.
getId
().
equals
(
vo
.
getPackId
()))
{
vo
.
setPackName
(
pack
.
getName
());
}
});
}
voList
.
add
(
vo
);
});
}
...
...
@@ -716,7 +723,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
public
String
openDoor
(
String
orderNo
)
{
LambdaQueryWrapper
<
SOrder
>
orderLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
orderLambdaQueryWrapper
.
eq
(
SOrder:
:
getOrderNo
,
orderNo
);
SOrder
sOrder
=
sOrder
Mapper
.
selectOne
(
orderLambdaQueryWrapper
);
SOrder
sOrder
=
base
Mapper
.
selectOne
(
orderLambdaQueryWrapper
);
if
(
Objects
.
isNull
(
sOrder
))
{
throw
new
BaseException
(
"订单不存在!"
);
}
...
...
@@ -744,7 +751,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
map
.
put
(
"expirationTime"
,
sOrder
.
getStartDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
redisUtils
.
set
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
sOrder
Mapper
.
updateById
(
sOrder
);
base
Mapper
.
updateById
(
sOrder
);
//查询非当前用户,预约时间或使用时间为当前时间的订单,如果存在,房间不可开门
}
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
...
...
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