记得上下班打卡 | 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
a8147d59
Commit
a8147d59
authored
Sep 01, 2021
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
candy
parent
caa29c2a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
15 deletions
+17
-15
CandyUserCouponBasicDto.java
.../liquidnet/service/candy/dto/CandyUserCouponBasicDto.java
+6
-6
CandyCouponServiceImpl.java
...et/service/candy/service/impl/CandyCouponServiceImpl.java
+9
-7
RedisDataUtils.java
...java/com/liquidnet/service/candy/util/RedisDataUtils.java
+1
-1
sqlmap.properties
...t-service-candy-impl/src/main/resources/sqlmap.properties
+1
-1
No files found.
liquidnet-bus-do/liquidnet-service-candy-do/src/main/java/com/liquidnet/service/candy/dto/CandyUserCouponBasicDto.java
View file @
a8147d59
...
...
@@ -10,7 +10,7 @@ import java.time.LocalDateTime;
import
java.util.List
;
@Data
public
class
CandyUserCouponBasicDto
implements
Serializable
,
Cloneable
{
public
class
CandyUserCouponBasicDto
implements
Serializable
,
Cloneable
{
private
static
final
long
serialVersionUID
=
4073256621782131605L
;
/* com.liquidnet.service.candy.entity.CandyCoupon */
...
...
@@ -106,7 +106,7 @@ public class CandyUserCouponBasicDto implements Serializable ,Cloneable{
return
this
;
}
public
CandyUserCouponBasicDto
copyToRedisBaseCoupon
(
String
uCouponId
,
String
uid
,
String
cCode
,
CandyCouponInfoDto
couponInfoDto
)
{
public
CandyUserCouponBasicDto
copyToRedisBaseCoupon
(
String
uCouponId
,
String
uid
,
String
cCode
,
CandyCouponInfoDto
couponInfoDto
,
LocalDateTime
duedAt
)
{
this
.
setCouponId
(
couponInfoDto
.
getCouponId
());
this
.
setTitle
(
couponInfoDto
.
getTitle
());
this
.
setLabel
(
couponInfoDto
.
getLabel
());
...
...
@@ -132,14 +132,13 @@ public class CandyUserCouponBasicDto implements Serializable ,Cloneable{
this
.
setState
(
1
);
this
.
setBindAt
(
LocalDateTime
.
now
());
// TODO: 2021/9/1
this
.
setDuedAt
(
null
);
this
.
setDuedAt
(
duedAt
);
this
.
setUseRules
(
couponInfoDto
.
getUseRules
());
return
this
;
}
public
CandyUserCouponBasicDto
copyToRedisCommonBaseCoupon
(
String
uCouponId
,
String
uid
,
CandyCommonCouponBasicDto
commonCouponBasicDto
)
{
public
CandyUserCouponBasicDto
copyToRedisCommonBaseCoupon
(
String
uCouponId
,
String
uid
,
CandyCommonCouponBasicDto
commonCouponBasicDto
)
{
this
.
setCouponId
(
commonCouponBasicDto
.
getCouponId
());
this
.
setTitle
(
commonCouponBasicDto
.
getTitle
());
this
.
setLabel
(
commonCouponBasicDto
.
getLabel
());
...
...
@@ -165,7 +164,8 @@ public class CandyUserCouponBasicDto implements Serializable ,Cloneable{
this
.
setState
(
1
);
this
.
setBindAt
(
LocalDateTime
.
now
());
// TODO: 2021/9/1
this
.
setDuedAt
(
null
);
this
.
setBindAt
(
commonCouponBasicDto
.
getEffectAt
());
this
.
setDuedAt
(
commonCouponBasicDto
.
getExpireAt
());
this
.
setUseRules
(
commonCouponBasicDto
.
getUseRules
());
return
this
;
...
...
liquidnet-bus-service/liquidnet-service-candy/liquidnet-service-candy-impl/src/main/java/com/liquidnet/service/candy/service/impl/CandyCouponServiceImpl.java
View file @
a8147d59
...
...
@@ -164,7 +164,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
continue
;
}
}
CandyCouponVo
baseVo
=
CouponBaseUtil
.
getGoodCouponUserVo
(
dtoItem
,
priceTotal
,
goodId
,
dtoList
.
size
());
CandyCouponVo
baseVo
=
CouponBaseUtil
.
getGoodCouponUserVo
(
dtoItem
,
priceTotal
,
goodId
,
dtoList
.
size
());
if
(
dtoItem
.
getExclusive
().
equals
(
1
))
{
//会员券
memberCoupon
.
add
(
baseVo
);
}
else
{
//非会员券
...
...
@@ -186,7 +186,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
List
<
CandyUserCouponBasicDto
>
dtoList
=
redisDataUtils
.
getCouponByUid
(
uid
);
int
canUse
=
0
;
for
(
CandyUserCouponBasicDto
dtoItem
:
dtoList
)
{
CandyCouponVo
baseVo
=
CouponBaseUtil
.
getGoodCouponUserVo
(
dtoItem
,
priceTotal
,
goodId
,
dtoList
.
size
());
CandyCouponVo
baseVo
=
CouponBaseUtil
.
getGoodCouponUserVo
(
dtoItem
,
priceTotal
,
goodId
,
dtoList
.
size
());
if
(
baseVo
.
getState
().
equals
(
1
))
{
//可用
canUse
=
1
;
break
;
...
...
@@ -267,7 +267,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
}
Boolean
isTarget
=
false
;
for
(
CandyCouponRuleDto
ruleItem
:
dto
.
getUseRules
())
{
for
(
CandyCouponRuleDto
ruleItem
:
dto
.
getUseRules
())
{
switch
(
ruleItem
.
getUseScope
())
{
case
80
:
//商品
isTarget
=
CouponBaseUtil
.
isTargetCoupon
(
ruleItem
.
getBusiId
(),
dto
.
getCouType
(),
goodId
,
new
BigDecimal
(
totalPrice
),
dto
.
getValOver
());
...
...
@@ -290,7 +290,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
}
}
if
(!
isTarget
)
{
if
(!
isTarget
)
{
vo
.
setCouType
(-
1
);
vo
.
setValue
(
BigDecimal
.
ZERO
);
}
...
...
@@ -351,6 +351,8 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
public
ResponseDto
<
Boolean
>
receiveCoupon
(
String
ccode
)
{
String
uid
=
CurrentUtil
.
getCurrentUid
();
CandyCouponCodeDto
dto
=
redisDataUtils
.
getCouponByCode
(
ccode
);
LocalDateTime
now
=
LocalDateTime
.
now
();
if
(
dto
==
null
)
{
return
ResponseDto
.
failure
(
"兑换码有误,请重新输入"
);
}
else
if
(
dto
.
getState
().
equals
(
0
))
{
//判断可领
...
...
@@ -360,7 +362,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
}
String
uCouponId
=
IDGenerator
.
get32UUID
();
//构建baseDto
CandyUserCouponBasicDto
baseDto
=
CandyUserCouponBasicDto
.
getNew
().
copyToRedisBaseCoupon
(
uCouponId
,
uid
,
ccode
,
infoDto
);
CandyUserCouponBasicDto
baseDto
=
CandyUserCouponBasicDto
.
getNew
().
copyToRedisBaseCoupon
(
uCouponId
,
uid
,
ccode
,
infoDto
,
now
.
plusDays
(
infoDto
.
getRedeemValidity
())
);
//删除code redis
redisDataUtils
.
delCouponByCode
(
ccode
);
//添加baseDto -> baseDtoList
...
...
@@ -369,7 +371,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
queueUtils
.
sendMsgByRedis
(
MQConst
.
CandyQueue
.
COUPON_RECEIVE
.
getKey
(),
SqlMapping
.
get
(
"candy_coupon.receive"
,
uCouponId
,
uid
,
1
,
infoDto
.
getCouponId
(),
ccode
,
LocalDateTime
.
now
(
)
uCouponId
,
uid
,
1
,
infoDto
.
getCouponId
(),
ccode
,
now
,
now
,
now
.
plusDays
(
infoDto
.
getRedeemValidity
()
)
)
);
}
else
{
...
...
@@ -391,7 +393,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
}
String
uCouponId
=
IDGenerator
.
get32UUID
();
//构建baseDto
CandyUserCouponBasicDto
baseDto
=
CandyUserCouponBasicDto
.
getNew
().
copyToRedisBaseCoupon
(
uCouponId
,
uid
,
ccode
,
infoDto
);
CandyUserCouponBasicDto
baseDto
=
CandyUserCouponBasicDto
.
getNew
().
copyToRedisBaseCoupon
(
uCouponId
,
uid
,
ccode
,
infoDto
,
null
);
return
ResponseDto
.
success
(
CouponBaseUtil
.
getBaseCouponUserVo
(
baseDto
));
}
else
{
return
ResponseDto
.
failure
(
"兑换失败,请稍后再试"
);
...
...
liquidnet-bus-service/liquidnet-service-candy/liquidnet-service-candy-impl/src/main/java/com/liquidnet/service/candy/util/RedisDataUtils.java
View file @
a8147d59
...
...
@@ -49,7 +49,7 @@ public class RedisDataUtils {
if
(
userIds
.
contains
(
item
.
getCcouponId
()))
{
continue
;
}
else
{
CandyUserCouponBasicDto
userCouponBasicDto
=
CandyUserCouponBasicDto
.
getNew
().
copyToRedisCommonBaseCoupon
(
IDGenerator
.
get32UUID
(),
uid
,
item
);
CandyUserCouponBasicDto
userCouponBasicDto
=
CandyUserCouponBasicDto
.
getNew
().
copyToRedisCommonBaseCoupon
(
IDGenerator
.
get32UUID
(),
uid
,
item
);
userDto
.
add
(
userCouponBasicDto
);
}
}
...
...
liquidnet-bus-service/liquidnet-service-candy/liquidnet-service-candy-impl/src/main/resources/sqlmap.properties
View file @
a8147d59
...
...
@@ -5,4 +5,4 @@ candy_coupon.use_insert=INSERT INTO candy_user_coupon (ucoupon_id , uid , state
# -- 回退券 --
candy_coupon.back
=
UPDATE candy_user_coupon SET state = 1 WHERE uid = ? AND ucoupon_id = ?
# -- 领取券 --
candy_coupon.receive
=
INSERT INTO candy_user_coupon (ucoupon_id , uid , state , coupon_id , ccode , bind_at
) VALUE ( ? , ? , ? , ? , ? , ?
)
candy_coupon.receive
=
INSERT INTO candy_user_coupon (ucoupon_id , uid , state , coupon_id , ccode , bind_at
, bind_at, dued_at) VALUE ( ? , ? , ? , ? , ? , ? , ? , ?
)
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