记得上下班打卡 | 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
8ce909b2
Commit
8ce909b2
authored
Mar 18, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
goblin 帮助前端用店铺券
parent
abb66d3a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
65 deletions
+76
-65
CouponHelpUseParam.java
...om/liquidnet/service/goblin/param/CouponHelpUseParam.java
+3
-1
CouponHelpUseVo.java
...a/com/liquidnet/service/goblin/param/CouponHelpUseVo.java
+9
-4
GoblinCouponImpl.java
...quidnet/service/goblin/service/impl/GoblinCouponImpl.java
+64
-60
No files found.
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/param/CouponHelpUseParam.java
View file @
8ce909b2
...
@@ -18,8 +18,10 @@ public class CouponHelpUseParam implements Serializable, Cloneable {
...
@@ -18,8 +18,10 @@ public class CouponHelpUseParam implements Serializable, Cloneable {
private
List
<
CouponCanUse2Param
>
param
;
private
List
<
CouponCanUse2Param
>
param
;
@ApiModelProperty
(
dataType
=
"String"
,
name
=
"uid"
,
value
=
"用户id"
,
example
=
"10"
,
required
=
false
)
@ApiModelProperty
(
dataType
=
"String"
,
name
=
"uid"
,
value
=
"用户id"
,
example
=
"10"
,
required
=
false
)
private
String
uid
;
private
String
uid
;
@ApiModelProperty
(
dataType
=
"String"
,
name
=
"ucouponId"
,
value
=
"
券id"
,
required
=
tru
e
)
@ApiModelProperty
(
dataType
=
"String"
,
name
=
"ucouponId"
,
value
=
"
店铺券id"
,
required
=
fals
e
)
private
String
ucouponId
;
private
String
ucouponId
;
@ApiModelProperty
(
dataType
=
"String"
,
name
=
"platformUcouponId"
,
value
=
"平台券id"
,
required
=
false
)
private
String
platformUcouponId
;
private
static
final
CouponHelpUseParam
obj
=
new
CouponHelpUseParam
();
private
static
final
CouponHelpUseParam
obj
=
new
CouponHelpUseParam
();
...
...
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/param/CouponHelpUseVo.java
View file @
8ce909b2
...
@@ -8,17 +8,22 @@ import lombok.Data;
...
@@ -8,17 +8,22 @@ import lombok.Data;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.List
;
@Api
@Api
@Data
@Data
public
class
CouponHelpUseVo
implements
Serializable
,
Cloneable
{
public
class
CouponHelpUseVo
implements
Serializable
,
Cloneable
{
@ApiModelProperty
(
name
=
"param"
,
value
=
"对象"
)
//
@ApiModelProperty(name = "param", value = "对象")
private
List
<
CouponCanUse2Param
>
param
;
//
private List<CouponCanUse2Param> param;
@ApiModelProperty
(
name
=
"couponVo"
,
value
=
"券vo"
)
//
@ApiModelProperty(name = "couponVo", value = "券vo")
private
GoblinUserCouponVo
couponVo
;
//
private GoblinUserCouponVo couponVo;
@ApiModelProperty
(
dataType
=
"String"
,
name
=
"ucouponId"
,
value
=
"券id"
,
required
=
true
)
@ApiModelProperty
(
dataType
=
"String"
,
name
=
"ucouponId"
,
value
=
"券id"
,
required
=
true
)
private
String
ucouponId
;
private
String
ucouponId
;
@ApiModelProperty
(
dataType
=
"String"
,
name
=
"platformUcouponId"
,
value
=
"平台券id"
,
required
=
true
)
private
String
platformUcouponId
;
@ApiModelProperty
(
dataType
=
"number"
,
name
=
"price"
,
value
=
"优惠金额"
,
required
=
true
)
private
BigDecimal
price
;
private
static
final
CouponHelpUseVo
obj
=
new
CouponHelpUseVo
();
private
static
final
CouponHelpUseVo
obj
=
new
CouponHelpUseVo
();
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinCouponImpl.java
View file @
8ce909b2
...
@@ -412,76 +412,80 @@ public class GoblinCouponImpl implements GoblinCouponService {
...
@@ -412,76 +412,80 @@ public class GoblinCouponImpl implements GoblinCouponService {
public
CouponHelpUseVo
helpUseCoupon
(
CouponHelpUseParam
params
)
{
public
CouponHelpUseVo
helpUseCoupon
(
CouponHelpUseParam
params
)
{
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
now
=
LocalDateTime
.
now
();
CouponHelpUseVo
vo
=
CouponHelpUseVo
.
getNew
();
CouponHelpUseVo
vo
=
CouponHelpUseVo
.
getNew
();
List
<
GoblinUserCouponVo
>
voList
=
goblinRedisUtils
.
getUserCouponVos
(
params
.
getUid
());
GoblinUseResultVo
returnVo
;
GoblinUseResultVo
returnVo
=
GoblinUseResultVo
.
getNew
();
String
ucouponId
=
params
.
getUcouponId
();
String
ucouponId
=
params
.
getUcouponId
();
String
platformUcouponId
=
params
.
getPlatformUcouponId
();
for
(
GoblinUserCouponVo
itemVo
:
voList
)
{
//店铺券
if
(
itemVo
.
getUcouponId
().
equals
(
ucouponId
))
{
if
(
ucouponId
!=
null
&&
!
ucouponId
.
equals
(
""
))
{
if
(
itemVo
.
getUcouponId
().
equals
(
ucouponId
)
&&
itemVo
.
getDuedAt
().
isAfter
(
now
)
&&
itemVo
.
getState
().
equals
(
1
))
{
List
<
GoblinUserCouponVo
>
voList
=
goblinRedisUtils
.
getUserCouponVos
(
params
.
getUid
());
BigDecimal
contentPrice
=
BigDecimal
.
ZERO
;
for
(
GoblinUserCouponVo
itemVo
:
voList
)
{
if
(
itemVo
.
getUseScope
().
equals
(
"0"
))
{
//全部
if
(
itemVo
.
getUcouponId
().
equals
(
ucouponId
))
{
for
(
CouponCanUse2Param
item
:
params
.
getParam
())
{
if
(
itemVo
.
getUcouponId
().
equals
(
ucouponId
)
&&
itemVo
.
getDuedAt
().
isAfter
(
now
)
&&
itemVo
.
getState
().
equals
(
1
))
{
contentPrice
=
contentPrice
.
add
(
item
.
getPrice
());
BigDecimal
contentPrice
=
BigDecimal
.
ZERO
;
}
if
(
itemVo
.
getUseScope
().
equals
(
"0"
))
{
//全部
returnVo
=
mathCouponPrice
(
itemVo
,
contentPrice
);
}
else
{
//部分
List
<
String
>
spuIds
=
goblinRedisUtils
.
getStoreCouponSpuIds
(
itemVo
.
getStoreCouponId
());
if
(
spuIds
==
null
||
spuIds
.
size
()
==
0
)
{
break
;
}
//判断是否在可用商品内
for
(
String
spuItem
:
spuIds
)
{
for
(
CouponCanUse2Param
item
:
params
.
getParam
())
{
for
(
CouponCanUse2Param
item
:
params
.
getParam
())
{
String
spuId
=
item
.
getSpuId
();
contentPrice
=
contentPrice
.
add
(
item
.
getPrice
());
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
spuId
);
if
(
pre
!=
null
)
{
spuId
=
spuId
.
split
(
pre
)[
0
];
}
if
(
spuId
.
equals
(
spuItem
))
{
contentPrice
=
contentPrice
.
add
(
item
.
getPrice
());
}
}
}
}
returnVo
=
mathCouponPrice
(
itemVo
,
contentPrice
);
returnVo
=
mathCouponPrice
(
itemVo
,
contentPrice
);
}
else
{
//部分
returnVo
.
setSpuIds
(
spuIds
);
List
<
String
>
spuIds
=
goblinRedisUtils
.
getStoreCouponSpuIds
(
itemVo
.
getStoreCouponId
());
}
if
(
spuIds
==
null
||
spuIds
.
size
()
==
0
)
{
List
<
String
>
spuIdList
=
returnVo
.
getSpuIds
();
break
;
BigDecimal
voucherPrice
=
returnVo
.
getValue
();
if
(
spuIdList
.
size
()
>
0
)
{
for
(
String
spuId
:
spuIdList
)
{
for
(
CouponCanUse2Param
paramItem
:
params
.
getParam
())
{
if
(
paramItem
.
getSpuId
().
contains
(
spuId
))
{
if
(
voucherPrice
.
compareTo
(
BigDecimal
.
ZERO
)
>=
0
)
{
voucherPrice
=
voucherPrice
.
subtract
(
paramItem
.
getPrice
());
if
(
voucherPrice
.
compareTo
(
BigDecimal
.
ZERO
)
>=
0
)
{
paramItem
.
setPrice
(
paramItem
.
getPrice
());
}
else
{
paramItem
.
setPrice
(
voucherPrice
.
add
(
paramItem
.
getPrice
()));
}
}
}
}
}
}
//判断是否在可用商品内
}
else
{
for
(
String
spuItem
:
spuIds
)
{
for
(
CouponCanUse2Param
paramItem
:
params
.
getParam
())
{
for
(
CouponCanUse2Param
item
:
params
.
getParam
())
{
if
(
voucherPrice
.
compareTo
(
BigDecimal
.
ZERO
)
>=
0
)
{
String
spuId
=
item
.
getSpuId
();
voucherPrice
=
voucherPrice
.
subtract
(
paramItem
.
getPrice
());
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
spuId
);
if
(
voucherPrice
.
compareTo
(
BigDecimal
.
ZERO
)
>=
0
)
{
if
(
pre
!=
null
)
{
paramItem
.
setPrice
(
paramItem
.
getPrice
());
spuId
=
spuId
.
split
(
pre
)[
0
];
}
else
{
}
paramItem
.
setPrice
(
voucherPrice
.
add
(
paramItem
.
getPrice
()));
if
(
spuId
.
equals
(
spuItem
))
{
contentPrice
=
contentPrice
.
add
(
item
.
getPrice
());
}
}
}
}
}
returnVo
=
mathCouponPrice
(
itemVo
,
contentPrice
);
// returnVo.setSpuIds(spuIds);
}
}
// List<String> spuIdList = returnVo.getSpuIds();
BigDecimal
voucherPrice
=
returnVo
.
getValue
();
// if (spuIdList.size() > 0) {
// for (String spuId : spuIdList) {
// for (CouponCanUse2Param paramItem : params.getParam()) {
// if (paramItem.getSpuId().contains(spuId)) {
// if (voucherPrice.compareTo(BigDecimal.ZERO) >= 0) {
// voucherPrice = voucherPrice.subtract(paramItem.getPrice());
// if (voucherPrice.compareTo(BigDecimal.ZERO) >= 0) {
// paramItem.setPrice(paramItem.getPrice());
// } else {
// paramItem.setPrice(voucherPrice.add(paramItem.getPrice()));
// }
// }
// }
// }
// }
// } else {
// for (CouponCanUse2Param paramItem : params.getParam()) {
// if (voucherPrice.compareTo(BigDecimal.ZERO) >= 0) {
// voucherPrice = voucherPrice.subtract(paramItem.getPrice());
// if (voucherPrice.compareTo(BigDecimal.ZERO) >= 0) {
// paramItem.setPrice(paramItem.getPrice());
// } else {
// paramItem.setPrice(voucherPrice.add(paramItem.getPrice()));
// }
// }
// }
// }
// vo.setParam(params.getParam());
// vo.setCouponVo(itemVo);
vo
.
setPrice
(
voucherPrice
);
break
;
}
}
vo
.
setParam
(
params
.
getParam
());
vo
.
setCouponVo
(
itemVo
);
break
;
}
}
}
}
}
}
vo
.
setUcouponId
(
ucouponId
);
vo
.
set
UcouponId
(
u
couponId
);
vo
.
set
PlatformUcouponId
(
platformU
couponId
);
return
vo
;
return
vo
;
}
}
...
...
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