记得上下班打卡 | 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
707a9caf
Commit
707a9caf
authored
Mar 09, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加日志
parent
41fb55f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
7 deletions
+17
-7
GoblinOrderServiceImpl.java
...et/service/order/service/impl/GoblinOrderServiceImpl.java
+17
-7
No files found.
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/service/impl/GoblinOrderServiceImpl.java
View file @
707a9caf
...
...
@@ -107,10 +107,12 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
String
skuId
=
skuParam
.
getSkuId
();
int
number
=
skuParam
.
getNumber
();
GoblinGoodsSkuInfoVo
skuVo
=
redisUtils
.
getGoodsSkuInfoVo
(
skuId
);
log
.
info
(
"获取skuVo"
+
(
System
.
currentTimeMillis
()
-
time3
)
+
"ms"
);
if
(!(
skuVo
.
getStatus
().
equals
(
"3"
)
&&
skuVo
.
getShelvesStatus
().
equals
(
"3"
))
||
skuVo
.
getDelFlg
().
equals
(
"1"
))
{
throw
new
Exception
(
"不可购买"
);
}
// 判断库存
time3
=
System
.
currentTimeMillis
();
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
skuId
);
int
limitCount
=
skuVo
.
getBuyLimit
()
==
0
?
Integer
.
MAX_VALUE
:
skuVo
.
getBuyLimit
();
//判断限购
...
...
@@ -127,7 +129,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
}
int
surplusGeneral
=
redisUtils
.
decrSkuStock
(
pre
,
skuId
,
number
);
skuAndPreListAndNumber
.
add
(
skuId
+
","
+
pre
+
","
+
number
);
log
.
info
(
"判断逻辑 "
+(
System
.
currentTimeMillis
()-
time3
)+
"ms"
);
log
.
info
(
"判断逻辑 "
+
(
System
.
currentTimeMillis
()
-
time3
)
+
"ms"
);
//库存回滚
if
(
surplusGeneral
<
0
)
{
redisUtils
.
incrSkuStock
(
pre
,
skuId
,
number
);
...
...
@@ -135,7 +137,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
}
}
//GoblinOrderSkuParam
//下单
Long
orderTime
=
System
.
currentTimeMillis
();
GoblinOrderPreParam
pre
=
order
(
param
,
storeParam
,
uid
,
isMember
,
addressesVo
,
orderMasterCode
,
orderId
,
orderCode
,
platformCodeList
,
storeCodeList
);
log
.
error
(
"下单接口耗时"
+
(
System
.
currentTimeMillis
()
-
orderTime
)
+
"ms"
);
preParam
.
setPriceActual
(
preParam
.
getPriceActual
().
add
(
pre
.
getPriceActual
()));
preParam
.
setStoreName
(
preParam
.
getStoreName
()
+
","
+
pre
.
getStoreName
());
preParam
.
setSkuName
(
preParam
.
getSkuName
()
+
","
+
pre
.
getSkuName
());
...
...
@@ -181,7 +185,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
if
(
params
.
size
()
>
0
)
{
orderUtils
.
backStoreCoupon
(
params
);
}
log
.
info
(
"回滚逻辑 "
+(
System
.
currentTimeMillis
()-
time3
)+
"ms"
);
log
.
info
(
"回滚逻辑 "
+
(
System
.
currentTimeMillis
()
-
time3
)
+
"ms"
);
if
(
e
.
getMessage
()
==
null
)
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"20018"
));
//乱七八糟异常
}
else
if
(
e
.
getMessage
().
equals
(
"无权购买"
))
{
...
...
@@ -230,8 +234,10 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
String
marketType
=
""
;
for
(
GoblinOrderSkuParam
skuParam
:
storeParam
.
getGoblinOrderSkuParamArrayList
())
{
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
skuParam
.
getSkuId
());
Long
time3
=
System
.
currentTimeMillis
();
GoblinGoodsSkuInfoVo
skuVo
=
redisUtils
.
getGoodsSkuInfoVo
(
skuParam
.
getSkuId
());
GoblinGoodsInfoVo
spuVo
=
redisUtils
.
getGoodsInfoVo
(
skuParam
.
getSpuId
());
//todo
if
(!
spuVo
.
getStoreId
().
equals
(
storeParam
.
getStoreId
())
||
!
skuVo
.
getStoreId
().
equals
(
storeParam
.
getStoreId
()))
{
throw
new
Exception
(
"非法参数"
);
}
...
...
@@ -247,6 +253,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
price
=
skuVo
.
getPriceMember
();
}
//活动价格
time3
=
System
.
currentTimeMillis
();
if
(
pre
!=
null
)
{
GoblinGoodsSkuInfoVo
skuMarketVo
=
redisUtils
.
getGoodsSkuInfoVo
(
skuParam
.
getSkuId
().
split
(
pre
)[
0
]);
priceBase
=
skuMarketVo
.
getPrice
();
...
...
@@ -259,6 +266,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
priceBase
=
skuVo
.
getPriceMember
();
}
}
//todo
//获得活动优惠价格
// priceBase = priceBase.multiply(BigDecimal.valueOf(skuParam.getNumber()));
price
=
price
.
multiply
(
BigDecimal
.
valueOf
(
skuParam
.
getNumber
()));
...
...
@@ -307,7 +315,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
spuIds
=
spuIds
.
concat
(
item
.
getSpuId
()
+
","
);
}
}
long
time3
=
System
.
currentTimeMillis
();
HashMap
<
String
,
Object
>
hashMap
=
orderUtils
.
useCoupon
(
platVoucherCode
,
"购买商品["
+
orderCode
+
"]"
,
storeTotalPrice
,
spuIds
,
uid
);
//todo
if
(
hashMap
!=
null
)
{
voucherPrice
=
(
BigDecimal
)
hashMap
.
get
(
"voucher"
);
Integer
typeVoucher
=
(
Integer
)
hashMap
.
get
(
"type"
);
...
...
@@ -344,7 +354,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
}
}
}
long
time3
=
System
.
currentTimeMillis
();
GoblinStoreInfoVo
storeInfoVo
=
redisUtils
.
getStoreInfoVo
(
storeId
);
//生成订单
GoblinStoreOrder
storeOrder
=
GoblinStoreOrder
.
getNew
();
...
...
@@ -505,7 +515,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
}
payInnerResultVo
.
setOrderMasterCode
(
preParam
.
getOrderMasterCode
());
long
time3
=
System
.
currentTimeMillis
();
LinkedList
<
String
>
sqls
=
CollectionUtil
.
linkedListString
();
sqls
.
add
(
SqlMapping
.
get
(
"goblin.order.create.sku_insert"
));
sqls
.
add
(
SqlMapping
.
get
(
"goblin.order.create.order_insert"
));
...
...
@@ -515,7 +525,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
LinkedList
<
Object
[]>
sqlDataAttr
=
CollectionUtil
.
linkedListObjectArr
();
List
<
GoblinStoreOrderVo
>
orderVoList
=
ObjectUtil
.
getGoblinStoreOrderVoArrayList
();
List
<
GoblinOrderSkuVo
>
skuVoList
=
ObjectUtil
.
getGoblinOrderSkuVoArrayList
();
long
time3
=
System
.
currentTimeMillis
();
for
(
GoblinOrderSqlParam
item
:
sqlParams
)
{
long
time2
=
System
.
currentTimeMillis
();
List
<
String
>
goblinOrderSkuIdList
=
CollectionUtil
.
linkedListString
();
...
...
@@ -553,7 +563,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
log
.
info
(
"复制vo:"
+
(
System
.
currentTimeMillis
()
-
time2
)
+
"ms"
);
time2
=
System
.
currentTimeMillis
();
//待支付发送队列
//待支付发送队列
todo
// queueUtils.sendMsgByRedisGoblinStock(orderVo.getMasterOrderCode(), storeOrder.getCreatedAt());
log
.
info
(
"发送队列 待支付订单:"
+
(
System
.
currentTimeMillis
()
-
time2
)
+
"ms"
);
//redis 赋值
...
...
@@ -588,7 +598,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
queueUtils
.
sendMsgByRedis
(
MQConst
.
GoblinQueue
.
GOBLIN_ORDER_CREATE_PAY
.
getKey
(),
sqlData
);
log
.
info
(
UserPathDto
.
setData
(
"下单(唤起支付)"
,
preParam
,
payInnerResultVo
));
log
.
info
(
"支付单接口耗时:"
+
(
System
.
currentTimeMillis
()
-
timeAll
)
+
"ms"
);
log
.
error
(
"支付单接口耗时:"
+
(
System
.
currentTimeMillis
()
-
timeAll
)
+
"ms"
);
if
(
isFree
&&
preParam
.
getPayType
().
equals
(
"huifu"
))
{
return
ResponseDto
.
success
(
payInnerResultVo
);
}
else
if
(
isFree
)
{
...
...
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