记得上下班打卡 | 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
df1f0b38
Commit
df1f0b38
authored
Feb 25, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交券
parent
6a29283f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
122 additions
and
56 deletions
+122
-56
liquidnet-service-goblin-dev.yml
...-config/liquidnet-config/liquidnet-service-goblin-dev.yml
+2
-2
GoblinCouponImpl.java
...quidnet/service/goblin/service/impl/GoblinCouponImpl.java
+101
-47
GoblinOrderServiceImpl.java
...t/service/goblin/service/impl/GoblinOrderServiceImpl.java
+19
-7
No files found.
liquidnet-bus-config/liquidnet-config/liquidnet-service-goblin-dev.yml
View file @
df1f0b38
...
...
@@ -16,7 +16,7 @@ liquidnet:
pattern-rolling-file-name
:
${liquidnet.logfile.path}/${liquidnet.logfile.name}-%d{yyyy-MM-dd}.%i.log
level
:
debug
mysql
:
database-name
:
dev
_ln_scene
database-name
:
test
_ln_scene
mongodb
:
sslEnabled
:
false
database
:
dev_ln_scene
\ No newline at end of file
database
:
test_ln_scene
\ No newline at end of file
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinCouponImpl.java
View file @
df1f0b38
...
...
@@ -127,25 +127,46 @@ public class GoblinCouponImpl implements GoblinCouponService {
for
(
GoblinUserCouponVo
vo
:
voList
)
{
//判断券状态 和 触发金额
if
(
vo
.
getState
().
equals
(
1
)
&&
vo
.
getTriggers
().
compareTo
(
totalPrice
)
<=
0
)
{
List
<
String
>
spuIds
=
goblinRedisUtils
.
getStoreCouponSpuIds
(
vo
.
getStoreCouponId
());
//判断是否在可用商品内
for
(
String
item
:
spuIds
)
{
List
<
String
>
spuList
=
Arrays
.
asList
(
spuId
.
split
(
","
));
if
(
spuList
.
contains
(
item
))
{
BigDecimal
tempPrice
=
BigDecimal
.
ZERO
;
if
(
vo
.
getType
().
equals
(
"1"
))
{
//代金券
tempPrice
=
vo
.
getValFace
();
}
else
if
(
vo
.
getType
().
equals
(
"2"
))
{
//折扣
tempPrice
=
totalPrice
.
multiply
(
vo
.
getDiscount
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
if
(
tempPrice
.
compareTo
(
vo
.
getDeduction
())
>
0
)
{
tempPrice
=
vo
.
getDeduction
();
}
}
else
if
(
vo
.
getType
().
equals
(
"3"
)
&&
vo
.
getTriggers
().
compareTo
(
totalPrice
)
<=
0
)
{
//满减
tempPrice
=
vo
.
getValMinus
();
if
(
vo
.
getUseScope
().
equals
(
"0"
))
{
BigDecimal
tempPrice
=
BigDecimal
.
ZERO
;
if
(
vo
.
getType
().
equals
(
"1"
))
{
//代金券
tempPrice
=
vo
.
getValFace
();
}
else
if
(
vo
.
getType
().
equals
(
"2"
))
{
//折扣
tempPrice
=
totalPrice
.
multiply
(
vo
.
getDiscount
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
if
(
tempPrice
.
compareTo
(
vo
.
getDeduction
())
>
0
)
{
tempPrice
=
vo
.
getDeduction
();
}
if
(
maxPrice
.
compareTo
(
tempPrice
)
<
0
)
{
maxPrice
=
tempPrice
;
returnVo
=
vo
;
}
else
if
(
vo
.
getType
().
equals
(
"3"
)
&&
vo
.
getTriggers
().
compareTo
(
totalPrice
)
<=
0
)
{
//满减
tempPrice
=
vo
.
getValMinus
();
}
if
(
maxPrice
.
compareTo
(
tempPrice
)
<
0
)
{
maxPrice
=
tempPrice
;
returnVo
=
vo
;
}
}
else
{
List
<
String
>
spuIds
=
goblinRedisUtils
.
getStoreCouponSpuIds
(
vo
.
getStoreCouponId
());
if
(
spuId
==
null
)
{
continue
;
}
//判断是否在可用商品内
for
(
String
item
:
spuIds
)
{
List
<
String
>
spuList
=
Arrays
.
asList
(
spuId
.
split
(
","
));
if
(
spuList
.
contains
(
item
))
{
BigDecimal
tempPrice
=
BigDecimal
.
ZERO
;
if
(
vo
.
getType
().
equals
(
"1"
))
{
//代金券
tempPrice
=
vo
.
getValFace
();
}
else
if
(
vo
.
getType
().
equals
(
"2"
))
{
//折扣
tempPrice
=
totalPrice
.
multiply
(
vo
.
getDiscount
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
if
(
tempPrice
.
compareTo
(
vo
.
getDeduction
())
>
0
)
{
tempPrice
=
vo
.
getDeduction
();
}
}
else
if
(
vo
.
getType
().
equals
(
"3"
)
&&
vo
.
getTriggers
().
compareTo
(
totalPrice
)
<=
0
)
{
//满减
tempPrice
=
vo
.
getValMinus
();
}
if
(
maxPrice
.
compareTo
(
tempPrice
)
<
0
)
{
maxPrice
=
tempPrice
;
returnVo
=
vo
;
}
}
}
}
...
...
@@ -160,15 +181,22 @@ public class GoblinCouponImpl implements GoblinCouponService {
List
<
GoblinUserCouponVo
>
returnList
=
ObjectUtil
.
getGoblinUserCouponVo
();
for
(
GoblinUserCouponVo
vo
:
voList
)
{
//判断券状态 和 触发金额
if
(
vo
.
getState
().
equals
(
1
)
&&
vo
.
getTriggers
().
compareTo
(
totalPrice
)
>=
0
)
{
List
<
String
>
spuIds
=
goblinRedisUtils
.
getStoreCouponSpuIds
(
vo
.
getStoreCouponId
());
//判断是否在可用商品内
for
(
String
item
:
spuIds
)
{
List
<
String
>
spuList
=
Arrays
.
asList
(
spuId
.
split
(
","
));
if
(
spuList
.
contains
(
item
))
{
returnList
.
add
(
vo
);
if
(
vo
.
getState
().
equals
(
1
)
&&
vo
.
getTriggers
().
compareTo
(
totalPrice
)
<=
0
)
{
if
(
vo
.
getUseScope
().
equals
(
"0"
))
{
returnList
.
add
(
vo
);
}
else
{
List
<
String
>
spuIds
=
goblinRedisUtils
.
getStoreCouponSpuIds
(
vo
.
getStoreCouponId
());
if
(
spuId
==
null
)
{
break
;
}
//判断是否在可用商品内
for
(
String
item
:
spuIds
)
{
List
<
String
>
spuList
=
Arrays
.
asList
(
spuId
.
split
(
","
));
if
(
spuList
.
contains
(
item
))
{
returnList
.
add
(
vo
);
break
;
}
}
}
}
}
...
...
@@ -186,30 +214,56 @@ public class GoblinCouponImpl implements GoblinCouponService {
if
(
vo
.
getUcouponId
().
equals
(
ucouponId
))
{
//判断券状态 和 触发金额
if
(
vo
.
getState
().
equals
(
1
)
&&
vo
.
getTriggers
().
compareTo
(
totalPrice
)
<=
0
)
{
List
<
String
>
spuIds
=
goblinRedisUtils
.
getStoreCouponSpuIds
(
vo
.
getStoreCouponId
());
//判断是否在可用商品内
for
(
String
item
:
spuIds
)
{
List
<
String
>
spuList
=
Arrays
.
asList
(
spuId
.
split
(
","
));
if
(
spuList
.
contains
(
item
))
{
if
(
vo
.
getType
().
equals
(
"1"
))
{
//代金券
returnVo
.
setValue
(
vo
.
getValFace
());
returnVo
.
setCouType
(
vo
.
getType
());
}
else
if
(
vo
.
getType
().
equals
(
"2"
))
{
//折扣
BigDecimal
tempPrice
=
totalPrice
.
multiply
(
vo
.
getDiscount
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
if
(
tempPrice
.
compareTo
(
vo
.
getDeduction
())
>
0
)
{
tempPrice
=
vo
.
getDeduction
();
if
(
vo
.
getUseScope
().
equals
(
"0"
))
{
if
(
vo
.
getType
().
equals
(
"1"
))
{
//代金券
returnVo
.
setValue
(
vo
.
getValFace
());
returnVo
.
setCouType
(
vo
.
getType
());
}
else
if
(
vo
.
getType
().
equals
(
"2"
))
{
//折扣
BigDecimal
tempPrice
=
totalPrice
.
multiply
(
vo
.
getDiscount
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
if
(
tempPrice
.
compareTo
(
vo
.
getDeduction
())
>
0
)
{
tempPrice
=
vo
.
getDeduction
();
}
returnVo
.
setValue
(
tempPrice
);
returnVo
.
setCouType
(
vo
.
getType
());
}
else
if
(
vo
.
getType
().
equals
(
"3"
)
&&
vo
.
getTriggers
().
compareTo
(
totalPrice
)
<=
0
)
{
//满减
returnVo
.
setValue
(
vo
.
getValMinus
());
returnVo
.
setCouType
(
vo
.
getType
());
}
vo
.
setState
(
5
);
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
()));
break
;
}
else
{
List
<
String
>
spuIds
=
goblinRedisUtils
.
getStoreCouponSpuIds
(
vo
.
getStoreCouponId
());
if
(
spuId
==
null
)
{
continue
;
}
//判断是否在可用商品内
for
(
String
item
:
spuIds
)
{
List
<
String
>
spuList
=
Arrays
.
asList
(
spuId
.
split
(
","
));
if
(
spuList
.
contains
(
item
))
{
if
(
vo
.
getType
().
equals
(
"1"
))
{
//代金券
returnVo
.
setValue
(
vo
.
getValFace
());
returnVo
.
setCouType
(
vo
.
getType
());
}
else
if
(
vo
.
getType
().
equals
(
"2"
))
{
//折扣
BigDecimal
tempPrice
=
totalPrice
.
multiply
(
vo
.
getDiscount
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
if
(
tempPrice
.
compareTo
(
vo
.
getDeduction
())
>
0
)
{
tempPrice
=
vo
.
getDeduction
();
}
returnVo
.
setValue
(
tempPrice
);
returnVo
.
setCouType
(
vo
.
getType
());
}
else
if
(
vo
.
getType
().
equals
(
"3"
)
&&
vo
.
getTriggers
().
compareTo
(
totalPrice
)
<=
0
)
{
//满减
returnVo
.
setValue
(
vo
.
getValMinus
());
returnVo
.
setCouType
(
vo
.
getType
());
}
returnVo
.
setValue
(
tempPrice
);
returnVo
.
setCouType
(
vo
.
getType
()
);
}
else
if
(
vo
.
getType
().
equals
(
"3"
)
&&
vo
.
getTriggers
().
compareTo
(
totalPrice
)
<=
0
)
{
//满减
returnVo
.
setValue
(
vo
.
getValMinus
());
returnVo
.
setCouType
(
vo
.
getType
(
));
vo
.
setState
(
5
);
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
()
));
}
vo
.
setState
(
5
);
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
()));
break
;
}
}
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinOrderServiceImpl.java
View file @
df1f0b38
...
...
@@ -292,9 +292,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
for
(
GoblinOrderSkuParam
item
:
storeParam
.
getGoblinOrderSkuParamArrayList
())
{
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
item
.
getSpuId
());
if
(
pre
!=
null
)
{
spuIds
=
spuIds
.
concat
(
item
.
getSpuId
().
split
(
pre
)[
0
]
+
","
);
spuIds
=
spuIds
.
concat
(
item
.
getSpuId
().
split
(
pre
)[
0
]
+
","
);
}
else
{
spuIds
=
spuIds
.
concat
(
item
.
getSpuId
()
+
","
);
spuIds
=
spuIds
.
concat
(
item
.
getSpuId
()
+
","
);
}
}
if
(
tempCouponVo
!=
null
)
{
...
...
@@ -305,7 +305,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
}
}
}
else
{
HashMap
<
String
,
Object
>
hashMap
=
orderUtils
.
useCoupon
(
platVoucherCode
,
"购买商品["
+
orderCode
+
"]"
,
storeTotalPrice
,
spuIds
,
uid
);
HashMap
<
String
,
Object
>
hashMap
=
orderUtils
.
useCoupon
(
platVoucherCode
,
"购买商品["
+
orderCode
+
"]"
,
storeTotalPrice
,
spuIds
,
uid
);
voucherPrice
=
(
BigDecimal
)
hashMap
.
get
(
"voucher"
);
Integer
typeVoucher
=
(
Integer
)
hashMap
.
get
(
"type"
);
if
(
typeVoucher
.
equals
(-
1
))
{
...
...
@@ -322,9 +322,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
for
(
GoblinOrderSkuParam
item
:
storeParam
.
getGoblinOrderSkuParamArrayList
())
{
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
item
.
getSpuId
());
if
(
pre
!=
null
)
{
spuIds
=
spuIds
.
concat
(
item
.
getSpuId
().
split
(
pre
)[
0
]+
","
);
spuIds
=
spuIds
.
concat
(
item
.
getSpuId
().
split
(
pre
)[
0
]
+
","
);
}
else
{
spuIds
=
spuIds
.
concat
(
item
.
getSpuId
()+
","
);
spuIds
=
spuIds
.
concat
(
item
.
getSpuId
()
+
","
);
}
}
GoblinUseResultVo
storeCouponVo
=
goblinCouponService
.
useCoupon
(
storeVoucherCode
,
"购买商品["
+
orderCode
+
"]"
,
storeTotalPrice
,
spuIds
,
uid
);
...
...
@@ -857,6 +857,18 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
orderVo
.
setPriceRefund
(
orderVo
.
getPriceRefund
().
add
(
price
));
if
(
orderVo
.
getPriceRefund
().
compareTo
(
orderVo
.
getPriceActual
())
>=
0
)
{
orderVo
.
setStatus
(
GoblinStatusConst
.
Status
.
ORDER_STATUS_6
.
getValue
());
if
(!(
orderVo
.
getUcouponId
()
==
null
||
orderVo
.
getUcouponId
().
equals
(
""
)))
{
orderUtils
.
backCoupon
(
orderVo
.
getUcouponId
(),
orderVo
.
getUserId
());
}
if
(!(
orderVo
.
getStoreCouponId
()
==
null
||
orderVo
.
getStoreCouponId
().
equals
(
""
)))
{
List
<
BackCouponParam
>
params
=
ObjectUtil
.
getBackCouponParam
();
BackCouponParam
backCouponParam
=
BackCouponParam
.
getNew
();
backCouponParam
.
setuCouponIds
(
orderVo
.
getStoreCouponId
());
backCouponParam
.
setUid
(
orderVo
.
getUserId
());
params
.
add
(
backCouponParam
);
goblinCouponService
.
backCoupon
(
params
);
}
}
backOrderVo
.
setStatus
(
GoblinStatusConst
.
Status
.
ORDER_BACK_STATUS_2
.
getValue
());
backOrderVo
.
setRefundAt
(
nowStr
);
...
...
@@ -913,9 +925,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
SqlMapping
.
gets
(
sqls
,
sqlsOrder
,
sqlsOrderSku
,
sqlsBackOrder
));
}
else
if
(
0
==
status
)
{
}
return
"success"
;
}
return
"success"
;
}
@Override
public
ResponseDto
<
List
<
GoblinMailVo
>>
getMail
(
String
orderId
,
String
mailId
)
{
...
...
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