记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
董敬伟
liquidnet-bus-v1
Commits
f031a619
Commit
f031a619
authored
Aug 20, 2021
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交 缺兑换券接口
parent
14796110
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
271 additions
and
21 deletions
+271
-21
CandyCouponRule.java
...a/com/liquidnet/service/candy/entity/CandyCouponRule.java
+1
-1
CandyCouponController.java
...idnet/service/candy/controller/CandyCouponController.java
+147
-10
CouponBaseUtil.java
...java/com/liquidnet/service/candy/util/CouponBaseUtil.java
+84
-10
RedisDataUtils.java
...java/com/liquidnet/service/candy/util/RedisDataUtils.java
+11
-0
CandyUseResultVo.java
...java/com/liquidnet/service/candy/vo/CandyUseResultVo.java
+28
-0
No files found.
liquidnet-bus-do/liquidnet-service-candy-do/src/main/java/com/liquidnet/service/candy/entity/CandyCouponRule.java
View file @
f031a619
...
@@ -28,7 +28,7 @@ public class CandyCouponRule implements Serializable {
...
@@ -28,7 +28,7 @@ public class CandyCouponRule implements Serializable {
private
String
couponId
;
private
String
couponId
;
/**
/**
* 适用范围[100-全场|90-演出|91-场次|92-票|80-商品]
* 适用范围[100-全场|90-演出|91-场次|92-票|80-商品
|81-款式
]
*/
*/
private
Integer
useScope
;
private
Integer
useScope
;
...
...
liquidnet-bus-service/liquidnet-service-candy/liquidnet-service-candy-impl/src/main/java/com/liquidnet/service/candy/controller/CandyCouponController.java
View file @
f031a619
This diff is collapsed.
Click to expand it.
liquidnet-bus-service/liquidnet-service-candy/liquidnet-service-candy-impl/src/main/java/com/liquidnet/service/candy/util/CouponBaseUtil.java
View file @
f031a619
...
@@ -55,7 +55,7 @@ public class CouponBaseUtil {
...
@@ -55,7 +55,7 @@ public class CouponBaseUtil {
}
}
/**
/**
* 获取
基础券vo
* 获取
演出维度 券列表
*
*
* @param dtoItem CandyUserCouponBasicDto
* @param dtoItem CandyUserCouponBasicDto
* @return
* @return
...
@@ -89,13 +89,73 @@ public class CouponBaseUtil {
...
@@ -89,13 +89,73 @@ public class CouponBaseUtil {
rulesVoList
.
add
(
voRules
);
rulesVoList
.
add
(
voRules
);
switch
(
ruleItem
.
getUseScope
())
{
switch
(
ruleItem
.
getUseScope
())
{
case
90
:
//演出
case
90
:
//演出
isTarget
=
isTargetCoupon
(
ruleItem
.
getBusiId
(),
performanceId
,
priceTotal
,
dtoItem
.
getValOver
(),
dtoItem
.
getValMinus
());
isTarget
=
isTargetCoupon
(
ruleItem
.
getBusiId
(),
dtoItem
.
getCouType
(),
performanceId
,
priceTotal
,
dtoItem
.
getValOver
());
break
;
break
;
case
91
:
//场次
case
91
:
//场次
isTarget
=
isTargetCoupon
(
ruleItem
.
getBusiId
(),
timeId
,
priceTotal
,
dtoItem
.
getValOver
(),
dtoItem
.
getValMinus
());
isTarget
=
isTargetCoupon
(
ruleItem
.
getBusiId
(),
dtoItem
.
getCouType
(),
timeId
,
priceTotal
,
dtoItem
.
getValOver
());
break
;
break
;
case
92
:
//票
case
92
:
//票
isTarget
=
isTargetCoupon
(
ruleItem
.
getBusiId
(),
ticketId
,
priceTotal
,
dtoItem
.
getValOver
(),
dtoItem
.
getValMinus
());
isTarget
=
isTargetCoupon
(
ruleItem
.
getBusiId
(),
dtoItem
.
getCouType
(),
ticketId
,
priceTotal
,
dtoItem
.
getValOver
());
break
;
default
:
isTarget
=
false
;
break
;
}
}
//券类别
if
(
dtoItem
.
getBusiType
().
equals
(
3
))
{
vo
.
setCouType
(
101
);
}
else
{
vo
.
setCouType
(
dtoItem
.
getCouType
());
}
int
state
=
getCouponState
(
now
,
dtoItem
.
getExpireAt
(),
dtoItem
.
getState
());
if
(
isTarget
)
{
vo
.
setState
(
state
);
}
else
{
vo
.
setState
(
state
==
1
?
21
:
state
);
//不在目标范围 如果可用改为不可用21
}
vo
.
setUseRules
(
rulesVoList
);
return
vo
;
}
/**
* 获取 商品维度 券列表
*
* @param dtoItem CandyUserCouponBasicDto
* @return
*/
public
static
CandyCouponVo
getGoodCouponUserVo
(
CandyUserCouponBasicDto
dtoItem
,
BigDecimal
priceTotal
,
String
goodId
,
String
produceId
)
{
boolean
isTarget
=
false
;
LocalDateTime
now
=
LocalDateTime
.
now
();
CandyCouponVo
vo
=
CandyCouponVo
.
getNew
();
List
<
CandyCouponRulesVo
>
rulesVoList
=
ObjectUtil
.
getCandyCouponRulesVos
();
vo
.
setTitle
(
dtoItem
.
getTitle
());
vo
.
setExpireAt
(
DateUtil
.
format
(
dtoItem
.
getExpireAt
(),
DateUtil
.
Formatter
.
yyyy_MM_dd
));
vo
.
setValFace
(
dtoItem
.
getValFace
());
vo
.
setValOver
(
dtoItem
.
getValOver
());
vo
.
setValMinus
(
dtoItem
.
getValMinus
());
vo
.
setBindType
(
dtoItem
.
getBindType
());
vo
.
setLabel
(
dtoItem
.
getLabel
());
vo
.
setNotice
(
dtoItem
.
getNotice
());
vo
.
setUcouponId
(
dtoItem
.
getUcouponId
());
vo
.
setUsedAt
(
DateUtil
.
format
(
dtoItem
.
getUsedAt
(),
DateUtil
.
Formatter
.
yyyy_MM_dd
));
vo
.
setUsedFor
(
dtoItem
.
getUsedFor
());
//适用范围 规则
for
(
CandyCouponRuleDto
ruleItem
:
dtoItem
.
getUseRules
())
{
CandyCouponRulesVo
voRules
=
CandyCouponRulesVo
.
getNew
();
voRules
.
setUseScope
(
ruleItem
.
getUseScope
());
voRules
.
setBusiId
(
ruleItem
.
getBusiId
());
voRules
.
setBusiName
(
ruleItem
.
getBusiName
());
rulesVoList
.
add
(
voRules
);
switch
(
ruleItem
.
getUseScope
())
{
case
80
:
//商品
isTarget
=
isTargetCoupon
(
ruleItem
.
getBusiId
(),
dtoItem
.
getCouType
(),
goodId
,
priceTotal
,
dtoItem
.
getValOver
());
break
;
case
81
:
//款式
isTarget
=
isTargetCoupon
(
ruleItem
.
getBusiId
(),
dtoItem
.
getCouType
(),
produceId
,
priceTotal
,
dtoItem
.
getValOver
());
break
;
break
;
default
:
default
:
isTarget
=
false
;
isTarget
=
false
;
...
@@ -123,20 +183,23 @@ public class CouponBaseUtil {
...
@@ -123,20 +183,23 @@ public class CouponBaseUtil {
* @param targetId 目标id(例如 演出id,场次id,票种id)
* @param targetId 目标id(例如 演出id,场次id,票种id)
* @param priceTotal 待支付总金额
* @param priceTotal 待支付总金额
* @param valOver 满减~满
* @param valOver 满减~满
* @param valMinus 满减~减
* @return
* @return
*/
*/
public
static
Boolean
isTargetCoupon
(
String
busiId
,
public
static
Boolean
isTargetCoupon
(
String
busiId
,
Integer
couType
,
String
targetId
,
String
targetId
,
BigDecimal
priceTotal
,
BigDecimal
priceTotal
,
BigDecimal
valOver
,
BigDecimal
valOver
)
{
BigDecimal
valMinus
)
{
boolean
isTarget
=
false
;
boolean
isTarget
=
false
;
if
(
busiId
.
equals
(
targetId
))
{
//判断id 对应
if
(
busiId
.
equals
(
targetId
))
{
//判断id 对应
if
(
couType
.
equals
(
2
))
{
if
(
priceTotal
.
compareTo
(
valOver
)
>=
0
)
{
isTarget
=
true
;
}
}
else
{
isTarget
=
true
;
}
}
}
return
isTarget
;
return
isTarget
;
}
}
...
@@ -230,4 +293,15 @@ public class CouponBaseUtil {
...
@@ -230,4 +293,15 @@ public class CouponBaseUtil {
}
}
return
dtoList
;
return
dtoList
;
}
}
/**
* 领取券/兑换券
* @param uid 用户id
* @param ccode 领取/兑换码
* @return
*/
public
static
boolean
receiveCoupon
(
String
uid
,
String
ccode
)
{
boolean
result
=
false
;
return
result
;
}
}
}
liquidnet-bus-service/liquidnet-service-candy/liquidnet-service-candy-impl/src/main/java/com/liquidnet/service/candy/util/RedisDataUtils.java
View file @
f031a619
...
@@ -30,4 +30,15 @@ public class RedisDataUtils {
...
@@ -30,4 +30,15 @@ public class RedisDataUtils {
String
redisKey
=
CandyRedisConst
.
BASIC_USER_COUPON
.
concat
(
uid
);
String
redisKey
=
CandyRedisConst
.
BASIC_USER_COUPON
.
concat
(
uid
);
redisUtil
.
set
(
redisKey
,
dtoList
);
redisUtil
.
set
(
redisKey
,
dtoList
);
}
}
public
List
<
CandyUserCouponBasicDto
>
getCouponByCode
(
String
ccode
){
String
redisKey
=
CandyRedisConst
.
BASIC_COUPON_CODE
.
concat
(
ccode
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
if
(
obj
==
null
){
//降级
return
new
ArrayList
();
}
else
{
return
(
List
<
CandyUserCouponBasicDto
>)
obj
;
}
}
}
}
liquidnet-bus-service/liquidnet-service-candy/liquidnet-service-candy-impl/src/main/java/com/liquidnet/service/candy/vo/CandyUseResultVo.java
0 → 100644
View file @
f031a619
package
com
.
liquidnet
.
service
.
candy
.
vo
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.List
;
@Data
public
class
CandyUseResultVo
implements
Serializable
,
Cloneable
{
private
static
final
long
serialVersionUID
=
4073256621782131607L
;
private
BigDecimal
value
;
private
Integer
couType
;
private
static
final
CandyUseResultVo
obj
=
new
CandyUseResultVo
();
public
static
CandyUseResultVo
getNew
()
{
try
{
return
(
CandyUseResultVo
)
obj
.
clone
();
}
catch
(
CloneNotSupportedException
e
)
{
e
.
printStackTrace
();
}
return
new
CandyUseResultVo
();
}
}
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