记得上下班打卡 | 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
b3e40357
Commit
b3e40357
authored
Apr 11, 2022
by
jiangxiulong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
藏品下单、抽奖各种状态判断的整理
parent
cc18c8f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
40 deletions
+52
-40
GoblinNftOrderServiceImpl.java
...service/order/service/impl/GoblinNftOrderServiceImpl.java
+9
-36
GoblinNftOrderUtils.java
...om/liquidnet/service/order/utils/GoblinNftOrderUtils.java
+43
-4
No files found.
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/service/impl/GoblinNftOrderServiceImpl.java
View file @
b3e40357
...
...
@@ -73,23 +73,15 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
String
skuId
=
payParam
.
getSkuId
();
int
number
=
1
;
GoblinGoodsSkuInfoVo
skuVo
=
goblinRedisUtils
.
getGoodsSkuInfoVo
(
skuId
);
if
(
null
==
skuVo
||
(
null
!=
skuVo
.
getSkuAppear
()
&&
skuVo
.
getSkuAppear
().
equals
(
"1"
)
))
{
if
(
!
nftOrderUtils
.
getSkuAllStatusShow
(
skuVo
))
{
return
ResponseDto
.
failure
(
"该商品不存在~"
);
}
String
spuId
=
skuVo
.
getSpuId
();
// 判断是否藏品
if
(!
Objects
.
equals
(
1
,
skuVo
.
getSkuType
()))
{
return
ResponseDto
.
failure
(
"该商品不属于藏品~"
);
}
// 3审核通过 3已上架 0未删除 才可购买
if
(
!
skuVo
.
getStatus
().
equals
(
"3"
)
||
!
skuVo
.
getShelvesStatus
().
equals
(
"3"
)
||
skuVo
.
getDelFlg
().
equals
(
"1"
)
||
(
null
!=
skuVo
.
getSkuCanbuy
()
&&
skuVo
.
getSkuCanbuy
().
equals
(
"0"
))
)
{
// 单独设置的是否可购买
if
(
null
!=
skuVo
.
getSkuCanbuy
()
&&
skuVo
.
getSkuCanbuy
().
equals
(
"0"
))
{
return
ResponseDto
.
failure
(
"该商品当前状态不可购买~"
);
}
//
主动
设置的售罄
//
单独
设置的售罄
if
(
null
!=
skuVo
.
getSoldoutStatus
()
&&
skuVo
.
getSoldoutStatus
().
equals
(
1
))
{
return
ResponseDto
.
failure
(
"该商品已售罄~"
);
}
...
...
@@ -128,6 +120,7 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
String
boxSkuId
=
""
;
// 购买盲盒回滚抽到的库存 购买藏品回滚购买的库存
String
stockSkuId
=
skuId
;
String
spuId
=
skuVo
.
getSpuId
();
if
(
skuVo
.
getUnbox
().
equals
(
"1"
))
{
// 盲盒逻辑
GoblinGoodsInfoVo
spuInfoVo
=
goblinRedisUtils
.
getGoodsInfoVo
(
spuId
);
List
<
String
>
skuIdList
=
spuInfoVo
.
getSkuIdList
();
...
...
@@ -215,32 +208,12 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
ArrayList
<
GoblinGoodsSkuInfoVo
>
skuInfoVos
=
ObjectUtil
.
cloneArrayGoblinGoodsSkuInfoListVo
();
for
(
String
kid
:
skuIdList
)
{
GoblinGoodsSkuInfoVo
skuInfoVo
=
goblinRedisUtils
.
getGoodsSkuInfoVo
(
kid
);
// 不能购买的过滤
if
(
null
==
skuInfoVo
||
!
skuInfoVo
.
getStatus
().
equals
(
"3"
)
||
!
skuInfoVo
.
getShelvesStatus
().
equals
(
"3"
)
||
skuInfoVo
.
getSoldoutStatus
().
equals
(
"1"
)
||
skuInfoVo
.
getSkuAppear
().
equals
(
"1"
)
||
skuInfoVo
.
getSkuCanbuy
().
equals
(
"0"
)
||
skuInfoVo
.
getDelFlg
().
equals
(
"1"
)
)
{
continue
;
}
// 开售停售时间
LocalDateTime
saleStartTime
=
skuInfoVo
.
getSaleStartTime
();
LocalDateTime
saleStopTime
=
skuInfoVo
.
getSaleStopTime
();
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
if
(
nowTime
.
isBefore
(
saleStartTime
))
{
// 不能购买的 没库存的过滤
if
(!
nftOrderUtils
.
getSkuAllStatusShow
(
skuInfoVo
)
&&
nftOrderUtils
.
getSkuAllStatusStock
(
skuInfoVo
)
>
0
)
{
continue
;
}
else
if
(
null
!=
saleStopTime
&&
nowTime
.
isAfter
(
saleStopTime
))
{
continue
;
}
// 库存
int
skuStock
=
goblinRedisUtils
.
getSkuStock
(
kid
);
if
(
skuStock
>
0
)
{
// 有库存的加入奖池
skuInfoVos
.
add
(
skuInfoVo
);
}
// 有库存的加入奖池
skuInfoVos
.
add
(
skuInfoVo
);
}
if
(
CollectionUtil
.
isEmpty
(
skuInfoVos
))
{
return
null
;
...
...
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/utils/GoblinNftOrderUtils.java
View file @
b3e40357
...
...
@@ -9,10 +9,7 @@ import com.liquidnet.service.base.constant.MQConst;
import
com.liquidnet.service.candy.vo.CandyUseResultVo
;
import
com.liquidnet.service.goblin.constant.GoblinRedisConst
;
import
com.liquidnet.service.goblin.constant.GoblinStatusConst
;
import
com.liquidnet.service.goblin.dto.vo.GoblinNftOrderRefundVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinNftOrderVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinUseResultVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinUserCouponVo
;
import
com.liquidnet.service.goblin.dto.vo.*
;
import
com.liquidnet.service.goblin.entity.GoblinNftOrderRefund
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -335,4 +332,46 @@ public class GoblinNftOrderUtils {
return
false
;
}
}
/**
* private int skuType 商品类型[0-常规|1-数字藏品]
* private String status 审核状态[0-初始编辑|1-审核中|2-审核不通过|3-审核通过];
* private String shelvesStatus 单品上架状态[0-待上架|1-下架|2-违规|3-上架];
* private String skuAppear 是否隐藏[0-默认展示|1-隐藏];
* private String delFlg 删除标记[0-未删除|1-删除];
*
* private LocalDateTime saleStartTime 开售时间;
* private LocalDateTime saleStopTime 停售时间 预留 暂时不做处理;
* private String soldoutStatus 是否售罄[0-否|1-是];
*
* private String skuCanbuy 是否购买[0-否|1-是] 这个用来预览 前端自己判断;
*/
// 获取盲盒下藏品的库存 各种状态下不能算库存的排除掉
public
int
getSkuAllStatusStock
(
GoblinGoodsSkuInfoVo
info
)
{
if
(
info
!=
null
&&
LocalDateTime
.
now
().
isAfter
(
info
.
getSaleStartTime
())
&&
(
null
==
info
.
getSoldoutStatus
()
||
info
.
getSoldoutStatus
().
equals
(
"0"
))
&&
info
.
getSkuCanbuy
().
equals
(
"1"
)
)
{
// 可以返回库存
return
goblinRedisUtils
.
getSkuStock
(
info
.
getSkuId
());
}
else
{
// 不计入库存
return
0
;
}
}
// 各种状态下判断藏品是否可以展示
public
boolean
getSkuAllStatusShow
(
GoblinGoodsSkuInfoVo
info
)
{
if
(
info
!=
null
&&
info
.
getSkuType
()
==
1
&&
info
.
getStatus
().
equals
(
"3"
)
&&
info
.
getShelvesStatus
().
equals
(
"3"
)
&&
info
.
getSkuAppear
().
equals
(
"0"
)
&&
info
.
getDelFlg
().
equals
(
"0"
)
)
{
return
true
;
}
else
{
return
false
;
}
}
}
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