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
caa5e5c9
Commit
caa5e5c9
authored
Oct 20, 2023
by
wuwenlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
room status opt;
order computer price opt; create order dev %30;
parent
c4eae0b5
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
273 additions
and
46 deletions
+273
-46
OrderStatusEnum.java
...mon/src/main/java/share/common/enums/OrderStatusEnum.java
+36
-0
PayTypeEnum.java
...-common/src/main/java/share/common/enums/PayTypeEnum.java
+42
-0
RefundStatusEnum.java
...on/src/main/java/share/common/enums/RefundStatusEnum.java
+36
-0
SOrder.java
share-system/src/main/java/share/system/domain/SOrder.java
+74
-41
CreateOrderRequest.java
...rc/main/java/share/system/request/CreateOrderRequest.java
+24
-1
OrderComputedPriceRequest.java
.../java/share/system/request/OrderComputedPriceRequest.java
+8
-1
ComputedOrderPriceResponse.java
...ava/share/system/response/ComputedOrderPriceResponse.java
+1
-1
RoomStatusServiceImpl.java
...java/share/system/service/impl/RoomStatusServiceImpl.java
+8
-0
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+44
-2
No files found.
share-common/src/main/java/share/common/enums/OrderStatusEnum.java
0 → 100644
View file @
caa5e5c9
package
share
.
common
.
enums
;
/**
* @Author wwl
* @Date 2023/10/20 10:57
*/
public
enum
OrderStatusEnum
{
UNUSED
(
0
,
"待使用/已预约"
),
INUSE
(
1
,
"使用中"
),
USED
(
2
,
"已使用"
);
private
Integer
code
;
private
String
name
;
OrderStatusEnum
(
Integer
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
public
static
OrderStatusEnum
getEnumByCode
(
Integer
code
){
for
(
OrderStatusEnum
type
:
OrderStatusEnum
.
values
())
{
if
(
type
.
code
.
compareTo
(
code
)==
0
)
{
return
type
;
}
}
return
null
;
}
public
Integer
getCode
(){
return
code
;
}
public
String
getName
()
{
return
name
;
}
}
share-common/src/main/java/share/common/enums/PayTypeEnum.java
0 → 100644
View file @
caa5e5c9
package
share
.
common
.
enums
;
/**
* @Author wwl
* @Date 2023/10/20 10:57
*/
public
enum
PayTypeEnum
{
WECHAT
(
1
,
"wechat"
,
"微信支付"
),
ALIPAY
(
2
,
"alipay"
,
"支付宝"
);
private
Integer
code
;
private
String
value
;
private
String
name
;
PayTypeEnum
(
Integer
code
,
String
value
,
String
name
)
{
this
.
code
=
code
;
this
.
value
=
value
;
this
.
name
=
name
;
}
public
static
PayTypeEnum
getEnumByCode
(
Integer
code
){
for
(
PayTypeEnum
type
:
PayTypeEnum
.
values
())
{
if
(
type
.
code
.
compareTo
(
code
)==
0
)
{
return
type
;
}
}
return
null
;
}
public
Integer
getCode
(){
return
code
;
}
public
String
getValue
()
{
return
value
;
}
public
String
getName
()
{
return
name
;
}
}
share-common/src/main/java/share/common/enums/RefundStatusEnum.java
0 → 100644
View file @
caa5e5c9
package
share
.
common
.
enums
;
/**
* @Author wwl
* @Date 2023/10/20 10:57
*/
public
enum
RefundStatusEnum
{
UNREFUND
(
0
,
"未退款"
),
INREFUND
(
1
,
"退款中"
),
REFUNDED
(
2
,
"已退款"
);
private
Integer
code
;
private
String
name
;
RefundStatusEnum
(
Integer
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
public
static
RefundStatusEnum
getEnumByCode
(
Integer
code
){
for
(
RefundStatusEnum
type
:
RefundStatusEnum
.
values
())
{
if
(
type
.
code
.
compareTo
(
code
)==
0
)
{
return
type
;
}
}
return
null
;
}
public
Integer
getCode
(){
return
code
;
}
public
String
getName
()
{
return
name
;
}
}
share-system/src/main/java/share/system/domain/SOrder.java
View file @
caa5e5c9
package
share
.
system
.
domain
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
javax.validation.constraints.NotBlank
;
/**
* 订单对象 s_order
*
...
...
@@ -22,17 +29,25 @@ public class SOrder extends BaseEntity
/** 订单ID */
private
Long
id
;
private
Long
storeId
;
private
Long
roomId
;
/** 订单流水号 */
@Excel
(
name
=
"订单编号"
)
private
String
orderNo
;
/** 订单类型(0:订房订单,1:续房订单,2:充值订单) */
@Excel
(
name
=
"订单类型(0:订房订单,1:续房订单,2:充值订单)"
)
private
Integer
orderType
;
/** 订单流水号 */
@Excel
(
name
=
"订单流水号"
)
private
Long
serialNumber
;
@Excel
(
name
=
"支付类型(1:微信,2:支付宝)"
)
private
Integer
payType
;
@Excel
(
name
=
"支付状态(0:未支付,1:已支付)"
)
private
Integer
payStatus
;
@Excel
(
name
=
"门店ID"
)
private
Long
storeId
;
@Excel
(
name
=
"房间ID"
)
private
Long
roomId
;
/** 用户ID */
@Excel
(
name
=
"用户ID"
)
...
...
@@ -42,41 +57,44 @@ public class SOrder extends BaseEntity
@Excel
(
name
=
"用户名称"
)
private
String
consumerName
;
/**
消费描述(例:中包/4小时59套餐)
*/
@Excel
(
name
=
"
消费描述(例:中包/4小时59套餐)
"
)
private
String
description
;
/**
用户手机号
*/
@Excel
(
name
=
"
用户手机号
"
)
private
String
consumerPhone
;
/** 订单总价 */
@Excel
(
name
=
"订单总价"
)
private
Integer
originalPrice
;
@ApiModelProperty
(
value
=
"套餐ID"
)
private
Long
packId
;
/** 1.余额支付,2:微信支付 */
@Excel
(
name
=
"1.余额支付,2:微信支付"
)
private
Integer
payWays
;
@ApiModelProperty
(
value
=
"套餐金额"
)
private
BigDecimal
packPrice
;
/**
订单实付
*/
@Excel
(
name
=
"
订单实付
"
)
private
Integer
realPrice
;
/**
优惠券id
*/
@Excel
(
name
=
"
优惠券id
"
)
private
String
couponId
;
/** 是否使用优惠券(0:否,1:是) */
@Excel
(
name
=
"是否使用优惠券(0:否,1:是)"
)
private
Integer
isUseCoupon
;
@Excel
(
name
=
"优惠券金额"
)
private
BigDecimal
couponPrice
;
/** 优惠券类型 */
@Excel
(
name
=
"优惠券类型"
)
private
String
couponType
;
@Excel
(
name
=
"订单总价"
)
private
BigDecimal
totalPrice
;
/** 优惠券名称 */
@Excel
(
name
=
"优惠券名称"
)
private
String
couponName
;
@Excel
(
name
=
"实际支付金额"
)
private
BigDecimal
payPrice
;
/** 优惠券id */
@Excel
(
name
=
"优惠券id"
)
private
String
couponId
;
@ApiModelProperty
(
value
=
"支付时间"
)
private
Date
payTime
;
/** 订单状态(0:待使用/已预约,1:使用中,2:已使用,3:已取消预约/退款中,4:审核中,5:已退费) */
@Excel
(
name
=
"订单状态(0:待使用/已预约,1:使用中,2:已使用,3:已取消预约/退款中,4:审核中,5:已退费)"
)
private
Integer
status
;
@Excel
(
name
=
"订单时长(H)"
)
private
String
timeLong
;
/** 预约开始时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
)
@Excel
(
name
=
"预约开始时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd HH:mm"
)
private
Date
preStartDate
;
/** 预约结束时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
)
@Excel
(
name
=
"预约结束时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd HH:mm"
)
private
Date
preEndDate
;
/** 开始时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
)
...
...
@@ -88,14 +106,29 @@ public class SOrder extends BaseEntity
@Excel
(
name
=
"结束时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd HH:mm"
)
private
Date
endDate
;
/** 预约开始时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
)
@Excel
(
name
=
"预约开始时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd HH:mm"
)
private
Date
preStartDate
;
/** 订单状态(0:待使用/已预约,1:使用中,2:已使用,3:已取消预约/退款中) */
@Excel
(
name
=
"订单状态(0:待使用/已预约,1:使用中,2:已使用)"
)
private
Integer
status
;
/** 预约结束时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
)
@Excel
(
name
=
"预约结束时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd HH:mm"
)
private
Date
preEndDate
;
@ApiModelProperty
(
value
=
"0 未退款 1 申请中 2 已退款 3 退款中"
)
@TableField
(
value
=
"refund_status"
)
private
Integer
refundStatus
;
@ApiModelProperty
(
value
=
"退款说明"
)
@TableField
(
value
=
"refund_reason"
)
private
String
refundReason
;
@ApiModelProperty
(
value
=
"退款时间"
)
@TableField
(
value
=
"refund_reason_time"
)
private
Date
refundReasonTime
;
@ApiModelProperty
(
value
=
"退款金额"
)
@TableField
(
value
=
"refund_price"
)
private
BigDecimal
refundPrice
;
//逻辑删除注解(0 未删除 1 已删除)
@TableLogic
@TableField
(
select
=
false
)
private
Integer
isDelete
;
}
share-system/src/main/java/share/system/request/CreateOrderRequest.java
View file @
caa5e5c9
...
...
@@ -7,6 +7,7 @@ import lombok.EqualsAndHashCode;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotBlank
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
...
...
@@ -28,12 +29,23 @@ public class CreateOrderRequest {
private
Long
roomId
;
@ApiModelProperty
(
value
=
"优惠券id"
)
private
Integer
couponId
;
private
Long
couponId
;
@ApiModelProperty
(
value
=
"套餐ID"
)
private
Long
packId
;
@ApiModelProperty
(
value
=
"订单类型(0:订房订单,1:续房订单,2:充值订单)"
,
required
=
true
)
@NotBlank
(
message
=
"订单类型不能为空"
)
private
Integer
orderType
;
@ApiModelProperty
(
value
=
"购买方式(1:小时,2:套餐)"
,
required
=
true
)
@NotBlank
(
message
=
"购买方式不能为空"
)
private
Integer
buyType
;
@ApiModelProperty
(
value
=
"支付类型(1:微信,2:支付宝)"
,
required
=
true
)
@NotBlank
(
message
=
"支付类型不能为空"
)
private
Integer
payType
;
/** 预约开始时间 */
@ApiModelProperty
(
value
=
"预约开始时间 yyyy-MM-dd HH:mm"
,
required
=
true
)
@NotBlank
(
message
=
"预约开始时间不能为空"
)
...
...
@@ -43,4 +55,15 @@ public class CreateOrderRequest {
@ApiModelProperty
(
value
=
"预约结束时间 yyyy-MM-dd HH:mm"
,
required
=
true
)
@NotBlank
(
message
=
"预约结束时间不能为空"
)
private
Date
preEndDate
;
@ApiModelProperty
(
value
=
"总金额"
)
@NotBlank
(
message
=
"总金额不能为空"
)
private
BigDecimal
totalFee
;
@ApiModelProperty
(
value
=
"优惠券优惠金额"
)
private
BigDecimal
couponFee
;
@ApiModelProperty
(
value
=
"实际支付金额"
)
@NotBlank
(
message
=
"实际支付金额不能为空"
)
private
BigDecimal
payFee
;
}
share-system/src/main/java/share/system/request/OrderComputedPriceRequest.java
View file @
caa5e5c9
...
...
@@ -27,12 +27,19 @@ public class OrderComputedPriceRequest {
private
Long
roomId
;
@ApiModelProperty
(
value
=
"优惠券id"
)
private
Integer
couponId
;
private
Long
couponId
;
@ApiModelProperty
(
value
=
"套餐ID"
)
private
Long
packId
;
@ApiModelProperty
(
value
=
"订单类型(0:订房订单,1:续房订单,2:充值订单)"
,
required
=
true
)
@NotBlank
(
message
=
"订单类型不能为空"
)
private
Integer
orderType
;
@ApiModelProperty
(
value
=
"购买方式(1:小时,2:套餐)"
,
required
=
true
)
@NotBlank
(
message
=
"购买方式不能为空"
)
private
Integer
buyType
;
/** 预约开始时间 */
@ApiModelProperty
(
value
=
"预约开始时间 yyyy-MM-dd HH:mm"
,
required
=
true
)
@NotBlank
(
message
=
"预约开始时间不能为空"
)
...
...
share-system/src/main/java/share/system/response/ComputedOrderPriceResponse.java
View file @
caa5e5c9
...
...
@@ -29,7 +29,7 @@ public class ComputedOrderPriceResponse implements Serializable {
@ApiModelProperty
(
value
=
"实际支付金额"
)
private
BigDecimal
payFee
;
@ApiModelProperty
(
value
=
"
商品
总金额"
)
@ApiModelProperty
(
value
=
"总金额"
)
private
BigDecimal
totalFee
;
}
...
...
share-system/src/main/java/share/system/service/impl/RoomStatusServiceImpl.java
View file @
caa5e5c9
...
...
@@ -6,8 +6,10 @@ import org.springframework.stereotype.Service;
import
share.common.enums.RoomStatusEnum
;
import
share.common.utils.DateUtils
;
import
share.common.utils.StringUtils
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SOrder
;
import
share.system.domain.SStore
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.RoomStatusVo
;
import
share.system.service.ISOrderService
;
import
share.system.service.ISStoreService
;
...
...
@@ -122,10 +124,16 @@ public class RoomStatusServiceImpl implements RoomStatusService {
}
private
void
checkTimeHourToOrder
(
RoomStatusVo
vo
,
Date
timeHourDate
,
List
<
SOrder
>
orderList
){
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
if
(
CollectionUtils
.
isNotEmpty
(
orderList
)){
orderList
.
stream
().
forEach
(
order
->
{
Date
orderStartDate
=
Objects
.
nonNull
(
order
.
getStartDate
())?
order
.
getStartDate
():
order
.
getPreStartDate
();
Date
orderEndDate
=
Objects
.
nonNull
(
order
.
getEndDate
())?
order
.
getEndDate
():
order
.
getPreEndDate
();
//如果当前用户已登陆,并且在已下单的房间下单,不计算当前订单的保洁时间
//否则结束时间+30分钟保洁时间
if
(
Objects
.
isNull
(
user
)||
Objects
.
isNull
(
user
.
getId
())||
order
.
getConsumerId
().
compareTo
(
user
.
getId
())!=
0
){
orderEndDate
=
DateUtils
.
addMinutes
(
orderEndDate
,
30
);
}
if
(
timeHourDate
.
compareTo
(
orderStartDate
)==
1
&&
timeHourDate
.
compareTo
(
orderEndDate
)==
0
){
vo
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
//判断订单开始时间是否是同一个小时,如果是同一个小时,占用结束时间为订单开始时间
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
caa5e5c9
...
...
@@ -3,6 +3,7 @@ package share.system.service.impl;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.collection.CollUtil
;
...
...
@@ -12,16 +13,18 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.math.NumberUtils
;
import
share.common.enums.CouponStatusEnum
;
import
share.common.enums.CouponTypeEnum
;
import
share.common.enums.*
;
import
share.common.exception.base.BaseException
;
import
share.common.utils.BaseUtil
;
import
share.common.utils.DateUtil
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.utils.bean.BeanUtils
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SRoom
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.domain.vo.MyRecord
;
import
share.system.mapper.SOrderMapper
;
import
share.system.domain.SOrder
;
...
...
@@ -143,9 +146,48 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
@Override
public
MyRecord
createOrder
(
CreateOrderRequest
request
)
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
if
(
ObjectUtil
.
isNull
(
user
))
{
throw
new
BaseException
(
"您的登录已过期,请先登录"
);
}
SOrder
sOrder
=
generatSOrder
(
request
,
user
);
//校验订单金额
checkOrderPrice
(
sOrder
,
user
);
//校验订单预约时间
return
null
;
}
private
void
checkOrderPrice
(
SOrder
order
,
SConsumer
user
){
OrderComputedPriceRequest
request
=
new
OrderComputedPriceRequest
();
BeanUtils
.
copyProperties
(
order
,
request
);
ComputedOrderPriceResponse
priceResponse
=
computedPrice
(
request
,
user
);
if
(
priceResponse
.
getPayFee
().
compareTo
(
order
.
getPayPrice
())!=
0
){
throw
new
BaseException
(
"订单金额异常!"
);
}
}
private
SOrder
generatSOrder
(
CreateOrderRequest
request
,
SConsumer
user
){
SOrder
sOrder
=
new
SOrder
();
BeanUtils
.
copyProperties
(
request
,
sOrder
);
//设置订单号
sOrder
.
setOrderNo
(
BaseUtil
.
getOrderNo
(
PayTypeEnum
.
getEnumByCode
(
request
.
getPayType
()).
getValue
()));
sOrder
.
setConsumerId
(
user
.
getId
());
sOrder
.
setConsumerPhone
(
user
.
getPhone
());
sOrder
.
setConsumerName
(
user
.
getNickName
());
sOrder
.
setPayStatus
(
YesNoEnum
.
no
.
getIndex
());
sOrder
.
setStatus
(
OrderStatusEnum
.
UNUSED
.
getCode
());
sOrder
.
setRefundStatus
(
RefundStatusEnum
.
UNREFUND
.
getCode
());
//计算订单时长
sOrder
.
setTimeLong
(
DateUtils
.
differentHour
(
sOrder
.
getPreStartDate
(),
sOrder
.
getPreEndDate
()).
toString
());
if
(
Objects
.
nonNull
(
sOrder
.
getPackId
())&&
sOrder
.
getPackId
()
!=
0
){
//TODO 套餐订单,设置套餐金额
sOrder
.
setPackPrice
(
new
BigDecimal
(
0
));
}
return
sOrder
;
}
/**
* 计算订单价格
* @param request 计算订单价格请求对象
...
...
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