记得上下班打卡 | 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
9357af17
Commit
9357af17
authored
Feb 25, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改券接口
parent
a33dd465
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
13 deletions
+21
-13
GoblinCouponService.java
...liquidnet/service/goblin/service/GoblinCouponService.java
+1
-1
GoblinCouponController.java
...net/service/goblin/controller/GoblinCouponController.java
+2
-2
GoblinCouponImpl.java
...quidnet/service/goblin/service/impl/GoblinCouponImpl.java
+18
-10
No files found.
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/service/GoblinCouponService.java
View file @
9357af17
...
...
@@ -23,7 +23,7 @@ public interface GoblinCouponService {
List
<
GoblinUserCouponVo
>
getList
(
String
type
);
//是否可用券 [价格] [spuId逗号隔开] [uid]
Boolean
canUse
(
BigDecimal
totalPrice
,
String
spuId
,
String
uid
);
GoblinUserCouponVo
canUse
(
BigDecimal
totalPrice
,
String
spuId
,
String
uid
);
//可用券列表 [价格] [spuId逗号隔开] [uid]
List
<
GoblinUserCouponVo
>
useList
(
BigDecimal
totalPrice
,
String
spuId
,
String
uid
);
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/GoblinCouponController.java
View file @
9357af17
...
...
@@ -101,14 +101,14 @@ public class GoblinCouponController {
}
@PostMapping
(
"can/use"
)
@ApiOperation
(
"是否可用券"
)
@ApiOperation
(
"是否可用券
[计算价格最高并返回vo]
"
)
@ApiResponse
(
code
=
200
,
message
=
"接口返回对象参数"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"Number"
,
name
=
"totalPrice"
,
value
=
"spuId"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"spuId"
,
value
=
"逗号隔开"
),
@ApiImplicitParam
(
type
=
"form"
,
required
=
true
,
dataType
=
"String"
,
name
=
"uid"
,
value
=
"用户id"
),
})
public
ResponseDto
<
Boolean
>
canUse
(
@RequestParam
(
"totalPrice"
)
@Valid
BigDecimal
totalPrice
,
public
ResponseDto
<
GoblinUserCouponVo
>
canUse
(
@RequestParam
(
"totalPrice"
)
@Valid
BigDecimal
totalPrice
,
@RequestParam
(
"spuId"
)
@Valid
String
spuId
,
@RequestParam
(
value
=
"uid"
,
required
=
false
)
@Valid
String
uid
)
{
if
(
uid
==
null
)
{
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinCouponImpl.java
View file @
9357af17
...
...
@@ -122,9 +122,10 @@ public class GoblinCouponImpl implements GoblinCouponService {
}
@Override
public
Boolean
canUse
(
BigDecimal
totalPrice
,
String
spuId
,
String
uid
)
{
public
GoblinUserCouponVo
canUse
(
BigDecimal
totalPrice
,
String
spuId
,
String
uid
)
{
BigDecimal
maxPrice
=
BigDecimal
.
ZERO
;
GoblinUserCouponVo
returnVo
=
GoblinUserCouponVo
.
getNew
();
List
<
GoblinUserCouponVo
>
voList
=
goblinRedisUtils
.
getUserCouponVos
(
uid
);
Boolean
canUse
=
false
;
for
(
GoblinUserCouponVo
vo
:
voList
)
{
//判断券状态 和 触发金额
if
(
vo
.
getState
().
equals
(
1
)
&&
vo
.
getTriggers
().
compareTo
(
totalPrice
)
>=
0
)
{
...
...
@@ -133,16 +134,23 @@ public class GoblinCouponImpl implements GoblinCouponService {
for
(
String
item
:
spuIds
)
{
List
<
String
>
spuList
=
Arrays
.
asList
(
spuId
.
split
(
","
));
if
(
spuList
.
contains
(
item
))
{
canUse
=
true
;
break
;
BigDecimal
tempPrice
=
BigDecimal
.
ZERO
;
if
(
vo
.
getType
().
equals
(
"1"
))
{
//代金券
tempPrice
=
vo
.
getValFace
();
}
else
if
(
vo
.
getType
().
equals
(
"2"
))
{
//折扣
tempPrice
=
totalPrice
.
multiply
(
vo
.
getDeduction
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
else
if
(
vo
.
getType
().
equals
(
"3"
)
&&
vo
.
getTriggers
().
compareTo
(
totalPrice
)
>=
0
)
{
//满减
tempPrice
=
vo
.
getValMinus
();
}
if
(
maxPrice
.
compareTo
(
tempPrice
)
<
0
)
{
maxPrice
=
tempPrice
;
returnVo
=
vo
;
}
}
}
}
if
(
canUse
)
{
break
;
}
}
return
canUse
;
return
returnVo
;
}
@Override
...
...
@@ -195,7 +203,7 @@ public class GoblinCouponImpl implements GoblinCouponService {
vo
.
setUsedFor
(
content
);
goblinMongoUtils
.
changeCouponVos
(
vo
.
getUcouponId
(),
vo
);
queueUtils
.
sendMsgByRedis
(
MQConst
.
GoblinQueue
.
SQL_STORE
.
getKey
(),
SqlMapping
.
get
(
"goblin_user_coupon.updateState"
,
vo
.
getState
(),
vo
.
getUsedFor
(),
LocalDateTime
.
now
()));
SqlMapping
.
get
(
"goblin_user_coupon.updateState"
,
vo
.
getState
(),
vo
.
getUsedFor
(),
LocalDateTime
.
now
()));
break
;
}
}
...
...
@@ -222,7 +230,7 @@ public class GoblinCouponImpl implements GoblinCouponService {
goblinRedisUtils
.
setUserCouponVos
(
item
.
getUid
(),
voList
);
goblinMongoUtils
.
changeCouponVos
(
vo
.
getUcouponId
(),
vo
);
queueUtils
.
sendMsgByRedis
(
MQConst
.
GoblinQueue
.
SQL_STORE
.
getKey
(),
SqlMapping
.
get
(
"goblin_user_coupon.updateState"
,
vo
.
getState
(),
vo
.
getUsedFor
(),
LocalDateTime
.
now
()));
SqlMapping
.
get
(
"goblin_user_coupon.updateState"
,
vo
.
getState
(),
vo
.
getUsedFor
(),
LocalDateTime
.
now
()));
}
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