记得上下班打卡 | 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
2ce4b3c3
Commit
2ce4b3c3
authored
Mar 10, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交日志
parent
ace5b09c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
25 deletions
+22
-25
GoblinOrderServiceImpl.java
...et/service/order/service/impl/GoblinOrderServiceImpl.java
+22
-25
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 @
2ce4b3c3
...
...
@@ -68,10 +68,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
List
<
String
>
skuAndPreListAndNumber
=
CollectionUtil
.
arrayListString
();
List
<
String
>
platformCodeList
=
CollectionUtil
.
arrayListString
();
List
<
String
>
storeCodeList
=
CollectionUtil
.
arrayListString
();
List
<
GoblinOrderSqlParam
>
orderSqlParams
=
ObjectUtil
.
getGoblinOrderSqlParamArrayListList
();
String
orderMasterCode
=
IDGenerator
.
storeMasterCode
();
//总订单id
GoblinOrderPreParam
preParam
=
GoblinOrderPreParam
.
getNew
();
preParam
.
setAuthCode
(
param
.
getAuthCode
());
preParam
.
setPayType
(
param
.
getPayType
());
...
...
@@ -91,11 +90,13 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
AddressVo
addressesVo
=
null
;
if
(
noZhengzaiOrder
(
uid
))
{
addressesVo
=
param
.
getAddressesVo
();
long
time3
=
System
.
currentTimeMillis
();
if
(
orderUtils
.
getMember
(
uid
)
!=
null
)
{
isMember
=
true
;
}
else
{
isMember
=
false
;
}
log
.
error
(
"获取会员信息:"
+(
System
.
currentTimeMillis
()-
time3
)+
"ms"
);
}
else
{
isMember
=
false
;
}
...
...
@@ -107,7 +108,7 @@ 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"
);
log
.
error
(
"获取skuVo"
+
(
System
.
currentTimeMillis
()
-
time3
)
+
"ms"
);
if
(!(
skuVo
.
getStatus
().
equals
(
"3"
)
&&
skuVo
.
getShelvesStatus
().
equals
(
"3"
))
||
skuVo
.
getDelFlg
().
equals
(
"1"
))
{
throw
new
Exception
(
"不可购买"
);
}
...
...
@@ -129,7 +130,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
.
error
(
"判断逻辑 "
+
(
System
.
currentTimeMillis
()
-
time3
)
+
"ms"
);
//库存回滚
if
(
surplusGeneral
<
0
)
{
redisUtils
.
incrSkuStock
(
pre
,
skuId
,
number
);
...
...
@@ -137,9 +138,7 @@ 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
());
...
...
@@ -237,6 +236,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
Long
time3
=
System
.
currentTimeMillis
();
GoblinGoodsSkuInfoVo
skuVo
=
redisUtils
.
getGoodsSkuInfoVo
(
skuParam
.
getSkuId
());
GoblinGoodsInfoVo
spuVo
=
redisUtils
.
getGoodsInfoVo
(
skuParam
.
getSpuId
());
log
.
error
(
"获取会员sku&spu:"
+(
System
.
currentTimeMillis
()-
time3
)+
"ms"
);
//todo
if
(!
spuVo
.
getStoreId
().
equals
(
storeParam
.
getStoreId
())
||
!
skuVo
.
getStoreId
().
equals
(
storeParam
.
getStoreId
()))
{
throw
new
Exception
(
"非法参数"
);
...
...
@@ -254,18 +254,18 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
}
//活动价格
time3
=
System
.
currentTimeMillis
();
if
(
pre
!=
null
)
{
GoblinGoodsSkuInfoVo
skuMarketVo
=
redisUtils
.
getGoodsSkuInfoVo
(
skuParam
.
getSkuId
().
split
(
pre
)[
0
]);
priceBase
=
skuMarketVo
.
getPrice
();
if
(
isMember
)
{
priceBase
=
skuMarketVo
.
getPriceMember
();
}
}
else
{
//
if (pre != null) {
//
GoblinGoodsSkuInfoVo skuMarketVo = redisUtils.getGoodsSkuInfoVo(skuParam.getSkuId().split(pre)[0]);
//
priceBase = skuMarketVo.getPrice();
//
if (isMember) {
//
priceBase = skuMarketVo.getPriceMember();
//
}
//
} else {
priceBase
=
skuVo
.
getPrice
();
if
(
isMember
)
{
priceBase
=
skuVo
.
getPriceMember
();
}
}
//
}
//todo
//获得活动优惠价格
// priceBase = priceBase.multiply(BigDecimal.valueOf(skuParam.getNumber()));
...
...
@@ -315,7 +315,6 @@ 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
)
{
...
...
@@ -340,9 +339,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
spuIds
=
spuIds
.
concat
(
item
.
getSpuId
()
+
","
);
}
}
long
time1
=
System
.
currentTimeMillis
();
GoblinUseResultVo
storeCouponVo
=
orderUtils
.
useStoreCoupon
(
storeVoucherCode
,
"购买商品["
+
orderCode
+
"]"
,
storeTotalPrice
,
spuIds
,
uid
);
log
.
info
(
"goblin接口调用:"
+
(
System
.
currentTimeMillis
()
-
time1
)
+
"秒"
);
String
typeVoucher
;
if
(
storeCouponVo
!=
null
)
{
storeVoucherPrice
=
storeCouponVo
.
getValue
();
...
...
@@ -356,6 +353,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
}
long
time3
=
System
.
currentTimeMillis
();
GoblinStoreInfoVo
storeInfoVo
=
redisUtils
.
getStoreInfoVo
(
storeId
);
log
.
error
(
"获取店铺信息:"
+(
System
.
currentTimeMillis
()-
time3
)+
"ms"
);
//生成订单
GoblinStoreOrder
storeOrder
=
GoblinStoreOrder
.
getNew
();
storeOrder
.
setMasterOrderCode
(
orderMasterCode
);
...
...
@@ -426,7 +424,8 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
return
preParam
;
}
private
ResponseDto
<
GoblinPayInnerResultVo
>
payOrder
(
GoblinOrderPreParam
preParam
,
List
<
GoblinOrderSqlParam
>
sqlParams
,
String
uid
)
{
private
ResponseDto
<
GoblinPayInnerResultVo
>
payOrder
(
GoblinOrderPreParam
preParam
,
List
<
GoblinOrderSqlParam
>
sqlParams
,
String
uid
)
{
long
timeAll
=
System
.
currentTimeMillis
();
//是否免费
boolean
isFree
=
false
;
...
...
@@ -525,8 +524,6 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
LinkedList
<
Object
[]>
sqlDataAttr
=
CollectionUtil
.
linkedListObjectArr
();
List
<
GoblinStoreOrderVo
>
orderVoList
=
ObjectUtil
.
getGoblinStoreOrderVoArrayList
();
List
<
GoblinOrderSkuVo
>
skuVoList
=
ObjectUtil
.
getGoblinOrderSkuVoArrayList
();
time3
=
System
.
currentTimeMillis
();
for
(
GoblinOrderSqlParam
item
:
sqlParams
)
{
long
time2
=
System
.
currentTimeMillis
();
List
<
String
>
goblinOrderSkuIdList
=
CollectionUtil
.
linkedListString
();
...
...
@@ -537,7 +534,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
});
//订单 orderSku Vo
GoblinOrderSkuVo
orderSkuVo
=
GoblinOrderSkuVo
.
getNew
().
copy
(
orderSku
);
//
redisUtils.setGoblinOrderSku(orderSkuVo.getOrderSkuId(), orderSkuVo);
redisUtils
.
setGoblinOrderSku
(
orderSkuVo
.
getOrderSkuId
(),
orderSkuVo
);
goblinOrderSkuIdList
.
add
(
orderSkuVo
.
getOrderSkuId
());
skuVoList
.
add
(
orderSkuVo
);
}
...
...
@@ -567,7 +564,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
orderVo
.
setOrderSkuVoIds
(
goblinOrderSkuIdList
);
orderVo
.
setCreatedAt
(
getNowTime
());
time2
=
System
.
currentTimeMillis
();
//
redisUtils.setGoblinOrder(orderVo.getOrderId(), orderVo);
redisUtils
.
setGoblinOrder
(
orderVo
.
getOrderId
(),
orderVo
);
redisUtils
.
setMasterCode
(
orderVo
.
getMasterOrderCode
(),
preParam
.
getOrderIdList
().
substring
(
1
));
orderVoList
.
add
(
orderVo
);
...
...
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