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
7bb538d0
Commit
7bb538d0
authored
Jan 11, 2024
by
wuwenlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check coupon dev;
parent
0da87a87
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
4 deletions
+27
-4
DateUtils.java
share-common/src/main/java/share/common/utils/DateUtils.java
+2
-0
CouponRequest.java
...tem/src/main/java/share/system/request/CouponRequest.java
+8
-0
SConsumerCouponServiceImpl.java
...share/system/service/impl/SConsumerCouponServiceImpl.java
+0
-0
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+17
-4
No files found.
share-common/src/main/java/share/common/utils/DateUtils.java
View file @
7bb538d0
...
@@ -28,6 +28,8 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
...
@@ -28,6 +28,8 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
public
static
String
YYYY_MM_DD_HH
=
"yyyy-MM-dd HH"
;
public
static
String
YYYY_MM_DD_HH
=
"yyyy-MM-dd HH"
;
public
static
String
YYYY_MM_DD_HH_MM
=
"yyyy-MM-dd HH:mm"
;
public
static
String
YYYYMMDDHHMMSS
=
"yyyyMMddHHmmss"
;
public
static
String
YYYYMMDDHHMMSS
=
"yyyyMMddHHmmss"
;
public
static
String
YYYY_MM_DD_HH_MM_SS
=
"yyyy-MM-dd HH:mm:ss"
;
public
static
String
YYYY_MM_DD_HH_MM_SS
=
"yyyy-MM-dd HH:mm:ss"
;
...
...
share-system/src/main/java/share/system/request/CouponRequest.java
View file @
7bb538d0
...
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
...
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
import
share.common.annotation.Excel
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotEmpty
;
...
@@ -29,6 +30,13 @@ public class CouponRequest {
...
@@ -29,6 +30,13 @@ public class CouponRequest {
@NotNull
(
message
=
"下单模式不能为空"
)
@NotNull
(
message
=
"下单模式不能为空"
)
private
Integer
orderMode
;
private
Integer
orderMode
;
@ApiModelProperty
(
value
=
"下单类型(1:预定,2:续单)"
,
required
=
true
)
@NotNull
(
message
=
"下单类型不能为空"
)
private
Integer
orderType
;
@ApiModelProperty
(
value
=
"套餐ID"
)
private
Long
packageId
;
/**
/**
* 预约开始时间
* 预约开始时间
*/
*/
...
...
share-system/src/main/java/share/system/service/impl/SConsumerCouponServiceImpl.java
View file @
7bb538d0
This diff is collapsed.
Click to expand it.
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
7bb538d0
...
@@ -1048,7 +1048,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1048,7 +1048,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
// 判断优惠券是否可以使用
// 判断优惠券是否可以使用
if
(
Objects
.
nonNull
(
user
)&&
Objects
.
nonNull
(
request
.
getCouponId
()))
{
if
(
Objects
.
nonNull
(
user
)&&
Objects
.
nonNull
(
request
.
getCouponId
()))
{
SConsumerCoupon
consumerCoupon
=
consumerCouponService
.
getById
(
request
.
getCouponId
());
SConsumerCoupon
consumerCoupon
=
consumerCouponService
.
getById
(
request
.
getCouponId
());
computedCouponPrice
(
priceResponse
,
user
,
consumerCoupon
);
computedCouponPrice
(
request
,
priceResponse
,
user
,
consumerCoupon
);
}
}
}
}
return
priceResponse
;
return
priceResponse
;
...
@@ -1065,7 +1065,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1065,7 +1065,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
/**
/**
* 计算使用优惠券后的订单金额
* 计算使用优惠券后的订单金额
*/
*/
private
void
computedCouponPrice
(
ComputedOrderPriceResponse
priceResponse
,
SConsumer
user
,
SConsumerCoupon
consumerCoupon
)
{
private
void
computedCouponPrice
(
OrderComputedPriceRequest
request
,
ComputedOrderPriceResponse
priceResponse
,
SConsumer
user
,
SConsumerCoupon
consumerCoupon
)
{
if
(
ObjectUtil
.
isNull
(
consumerCoupon
)
||
!
consumerCoupon
.
getConsumerId
().
equals
(
user
.
getId
()))
{
if
(
ObjectUtil
.
isNull
(
consumerCoupon
)
||
!
consumerCoupon
.
getConsumerId
().
equals
(
user
.
getId
()))
{
throw
new
BaseException
(
"优惠券领取记录不存在!"
);
throw
new
BaseException
(
"优惠券领取记录不存在!"
);
}
}
...
@@ -1085,7 +1086,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1085,7 +1086,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
case
DISCOUNT:
//TODO 折扣券
case
DISCOUNT:
//TODO 折扣券
break
;
break
;
case
PACKAGE:
//套餐券
case
PACKAGE:
//套餐券
case
CASH:
//现金券
case
CASH:
//现金券
(团购券)
//判断优惠券最小使用金额
//判断优惠券最小使用金额
if
(
consumerCoupon
.
getMinPrice
().
compareTo
(
priceResponse
.
getTotalFee
())
>
0
)
{
if
(
consumerCoupon
.
getMinPrice
().
compareTo
(
priceResponse
.
getTotalFee
())
>
0
)
{
throw
new
BaseException
(
"总金额小于优惠券最小使用金额"
);
throw
new
BaseException
(
"总金额小于优惠券最小使用金额"
);
...
@@ -1099,7 +1100,19 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1099,7 +1100,19 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse
.
setPayFee
(
subtract
);
priceResponse
.
setPayFee
(
subtract
);
}
}
break
;
break
;
case
DURATION:
//TODO 时长券
case
DURATION:
//时长券
BigDecimal
timeLong
=
DateUtils
.
differentHour
(
request
.
getPreStartDate
(),
request
.
getPreEndDate
());
if
(
new
BigDecimal
(
consumerCoupon
.
getMinDuration
()).
compareTo
(
timeLong
)>
0
){
throw
new
BaseException
(
"总时长小于优惠券最小使用时长"
);
}
BigDecimal
duration
=
new
BigDecimal
(
consumerCoupon
.
getDuration
());
if
(
duration
.
compareTo
(
timeLong
)>=
0
){
priceResponse
.
setPayFee
(
BigDecimal
.
ZERO
);
}
else
{
BigDecimal
unitPrice
=
priceResponse
.
getTotalFee
().
divide
(
timeLong
);
priceResponse
.
setPayFee
(
unitPrice
.
multiply
(
timeLong
.
subtract
(
duration
)));
priceResponse
.
setCouponFee
(
priceResponse
.
getTotalFee
().
subtract
(
priceResponse
.
getPayFee
()));
}
break
;
break
;
default
:
default
:
break
;
break
;
...
...
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