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
88ee2160
Commit
88ee2160
authored
Nov 01, 2023
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查询优惠卷可用接口增加下单模式
parent
787e98b0
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
49 additions
and
68 deletions
+49
-68
CouponTypeEnum.java
...mmon/src/main/java/share/common/enums/CouponTypeEnum.java
+2
-4
PackController.java
...main/java/share/web/controller/system/PackController.java
+0
-43
SConsumerCoupon.java
...em/src/main/java/share/system/domain/SConsumerCoupon.java
+1
-1
SCoupon.java
share-system/src/main/java/share/system/domain/SCoupon.java
+1
-1
SRoomPack.java
...e-system/src/main/java/share/system/domain/SRoomPack.java
+4
-0
CouponRequest.java
...tem/src/main/java/share/system/request/CouponRequest.java
+4
-0
RoomPackServiceImpl.java
...n/java/share/system/service/impl/RoomPackServiceImpl.java
+8
-2
SConsumerCouponServiceImpl.java
...share/system/service/impl/SConsumerCouponServiceImpl.java
+29
-17
No files found.
share-common/src/main/java/share/common/enums/CouponTypeEnum.java
View file @
88ee2160
...
...
@@ -5,13 +5,11 @@ package share.common.enums;
* @Date 2023/10/19 17:06
*/
public
enum
CouponTypeEnum
{
//1:折扣券,2,团购券,3:满减券,4
:核销券,5:充值送金额,6
:套餐劵
//1:折扣券,2,团购券,3:满减券,4:套餐劵
DISCOUNT
(
1
,
"1"
,
"折扣券"
),
CASH
(
2
,
"2"
,
"满减券(现金券)"
),
DURATION
(
3
,
"3"
,
"时长券"
),
VERIFICATION
(
4
,
"4"
,
"核销券"
),
RECHARGE
(
5
,
"5"
,
"充值送金额"
),
PACKAGE
(
6
,
"6"
,
"套餐劵"
),
PACKAGE
(
4
,
"4"
,
"套餐劵"
),
;
private
Integer
code
;
...
...
share-front/src/main/java/share/web/controller/system/PackController.java
View file @
88ee2160
...
...
@@ -30,7 +30,6 @@ public class PackController extends BaseController {
/**
* 查询套餐列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:pack:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SPack
SPack
)
{
startPage
();
...
...
@@ -39,53 +38,11 @@ public class PackController extends BaseController {
}
/**
* 导出套餐列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:pack:export')"
)
@Log
(
title
=
"套餐"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
SPack
SPack
)
{
List
<
SPack
>
list
=
packService
.
selectPackList
(
SPack
);
ExcelUtil
<
SPack
>
util
=
new
ExcelUtil
<
SPack
>(
SPack
.
class
);
util
.
exportExcel
(
response
,
list
,
"套餐数据"
);
}
/**
* 获取套餐详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:pack:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
success
(
packService
.
selectPackById
(
id
));
}
/**
* 新增套餐
*/
@PreAuthorize
(
"@ss.hasPermi('system:pack:add')"
)
@Log
(
title
=
"套餐"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
SPack
SPack
)
{
return
toAjax
(
packService
.
insertPack
(
SPack
));
}
/**
* 修改套餐
*/
@PreAuthorize
(
"@ss.hasPermi('system:pack:edit')"
)
@Log
(
title
=
"套餐"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
SPack
SPack
)
{
return
toAjax
(
packService
.
updatePack
(
SPack
));
}
/**
* 删除套餐
*/
@PreAuthorize
(
"@ss.hasPermi('system:pack:remove')"
)
@Log
(
title
=
"套餐"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
packService
.
deletePackByIds
(
ids
));
}
}
share-system/src/main/java/share/system/domain/SConsumerCoupon.java
View file @
88ee2160
...
...
@@ -57,7 +57,7 @@ public class SConsumerCoupon extends BaseEntity
private
String
couponTimeEnd
;
/** 优惠券类型(1:折扣券,2,满减券,3:时长券) */
@Excel
(
name
=
"优惠券类型(1:折扣券,2,团购券,3:满减券,4
:核销券,5:充值送金额,6
:套餐劵)"
)
@Excel
(
name
=
"优惠券类型(1:折扣券,2,团购券,3:满减券,4:套餐劵)"
)
private
Integer
couponType
;
/** 门槛时长 */
...
...
share-system/src/main/java/share/system/domain/SCoupon.java
View file @
88ee2160
...
...
@@ -54,7 +54,7 @@ public class SCoupon extends BaseEntity
private
String
roomType
;
/** 优惠券类型(1:折扣券,2,团购券,3:满减券,4:核销券,5:充值送金额) */
@Excel
(
name
=
"优惠券类型(1:折扣券,2,团购券,3:满减券,4
:核销券,5:充值送金额,6
:套餐劵)"
)
@Excel
(
name
=
"优惠券类型(1:折扣券,2,团购券,3:满减券,4:套餐劵)"
)
private
Integer
couponType
;
/** 门槛时长 */
...
...
share-system/src/main/java/share/system/domain/SRoomPack.java
View file @
88ee2160
package
share
.
system
.
domain
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
share.common.annotation.Excel
;
...
...
@@ -33,6 +34,9 @@ public class SRoomPack extends BaseEntity {
@Excel
(
name
=
"套餐id"
)
private
Long
packId
;
@TableField
(
exist
=
false
)
private
String
roomName
;
@Override
public
String
toString
()
{
...
...
share-system/src/main/java/share/system/request/CouponRequest.java
View file @
88ee2160
...
...
@@ -25,6 +25,10 @@ public class CouponRequest {
@NotNull
(
message
=
"房间ID不能为空"
)
private
Long
roomId
;
@ApiModelProperty
(
value
=
"下单模式(1:小时模式,2:套餐模式)"
,
required
=
true
)
@NotNull
(
message
=
"下单模式不能为空"
)
private
Integer
orderMode
;
/**
* 预约开始时间
*/
...
...
share-system/src/main/java/share/system/service/impl/RoomPackServiceImpl.java
View file @
88ee2160
...
...
@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
share.system.mapper.RoomPackMapper
;
import
share.system.domain.SRoomPack
;
import
share.system.mapper.SRoomMapper
;
import
share.system.service.IRoomPackService
;
/**
...
...
@@ -21,6 +22,8 @@ import share.system.service.IRoomPackService;
public
class
RoomPackServiceImpl
extends
ServiceImpl
<
RoomPackMapper
,
SRoomPack
>
implements
IRoomPackService
{
@Autowired
private
RoomPackMapper
roomPackMapper
;
@Autowired
private
SRoomMapper
sRoomMapper
;
/**
* 查询包房套餐关系
...
...
@@ -104,9 +107,12 @@ public class RoomPackServiceImpl extends ServiceImpl<RoomPackMapper, SRoomPack>
@Override
public
List
<
SRoomPack
>
selectRoomPackByPackId
(
Long
id
)
{
LambdaQueryWrapper
<
SRoomPack
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
SRoomPack:
:
getPackId
,
id
);
return
roomPackMapper
.
selectList
(
queryWrapper
);
List
<
SRoomPack
>
sRoomPackList
=
roomPackMapper
.
selectList
(
queryWrapper
);
sRoomPackList
.
forEach
(
item
->
{
item
.
setRoomName
(
sRoomMapper
.
selectById
(
item
.
getRoomId
()).
getName
());
});
return
sRoomPackList
;
}
}
share-system/src/main/java/share/system/service/impl/SConsumerCouponServiceImpl.java
View file @
88ee2160
...
...
@@ -145,7 +145,15 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
SStore
sStore
=
sStoreService
.
getById
(
couponRequest
.
getStoreId
());
SRoom
byId
=
sRoomService
.
getById
(
couponRequest
.
getRoomId
());
BigDecimal
subtract
=
new
BigDecimal
(
item
.
getMinDuration
());
if
(
item
.
getCouponType
().
equals
(
CouponTypeEnum
.
DURATION
.
getCode
()))
{
if
(
item
.
getCouponType
().
equals
(
CouponTypeEnum
.
PACKAGE
.
getCode
()))
{
if
(
couponRequest
.
getOrderMode
().
equals
(
BuyTypeEnum
.
PACK
.
getCode
()))
{
//计算价格
extracted
(
item
,
bigDecimal
,
byId
,
subtract
,
sStore
);
}
else
{
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setReason
(
"仅支持套餐模式下单使用"
);
}
}
else
if
(
item
.
getCouponType
().
equals
(
CouponTypeEnum
.
DURATION
.
getCode
()))
{
//判断门槛时长
if
(
bigDecimal
.
compareTo
(
subtract
)
>=
0
)
{
//判断门店类型
...
...
@@ -155,22 +163,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
item
.
setReason
(
"下单时长等于"
+
bigDecimal
+
"小时,不满足优惠券门槛时长"
);
}
}
else
{
//计算价格
BigDecimal
multiply
=
bigDecimal
.
multiply
(
byId
.
getPrice
());
//判断是否满足优惠券门槛
if
(
item
.
getMinPrice
().
compareTo
(
multiply
)
<=
0
)
{
//判断门槛时长
if
(
bigDecimal
.
compareTo
(
subtract
)
>=
0
)
{
//判断门店类型
isStoreType
(
item
,
sStore
,
byId
);
}
else
{
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setReason
(
"下单时长低于"
+
item
.
getMinDuration
()
+
"小时 "
);
}
}
else
{
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setReason
(
"消费金额低于"
+
item
.
getMinPrice
()
+
"元"
);
}
extracted
(
item
,
bigDecimal
,
byId
,
subtract
,
sStore
);
}
}
else
{
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
...
...
@@ -184,6 +177,25 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
return
sConsumerCoupons
;
}
private
void
extracted
(
SConsumerCoupon
item
,
BigDecimal
bigDecimal
,
SRoom
byId
,
BigDecimal
subtract
,
SStore
sStore
)
{
//计算价格
BigDecimal
multiply
=
bigDecimal
.
multiply
(
byId
.
getPrice
());
//判断是否满足优惠券门槛
if
(
item
.
getMinPrice
().
compareTo
(
multiply
)
<=
0
)
{
//判断门槛时长
if
(
bigDecimal
.
compareTo
(
subtract
)
>=
0
)
{
//判断门店类型
isStoreType
(
item
,
sStore
,
byId
);
}
else
{
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setReason
(
"下单时长低于"
+
item
.
getMinDuration
()
+
"小时 "
);
}
}
else
{
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setReason
(
"消费金额低于"
+
item
.
getMinPrice
()
+
"元"
);
}
}
private
void
isStoreType
(
SConsumerCoupon
item
,
SStore
sStore
,
SRoom
byId
)
{
if
(
item
.
getStoreType
().
contains
(
sStore
.
getStoreType
()))
{
//判断房间类型
...
...
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