记得上下班打卡 | 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
fc82f198
Commit
fc82f198
authored
May 17, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 nft商品列表定时任务
parent
f48655a6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
15 deletions
+24
-15
GoblinNftGoodsSkuListJobVo.java
...net/service/goblin/dto/vo/GoblinNftGoodsSkuListJobVo.java
+1
-0
GoblinNftJobServiceImpl.java
...ce/goblin/service/impl/inner/GoblinNftJobServiceImpl.java
+20
-12
GoblinRedisUtils.java
...a/com/liquidnet/service/goblin/util/GoblinRedisUtils.java
+3
-3
No files found.
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/dto/vo/GoblinNftGoodsSkuListJobVo.java
View file @
fc82f198
...
...
@@ -21,6 +21,7 @@ public class GoblinNftGoodsSkuListJobVo implements Serializable {
private
String
spuId
;
@ApiModelProperty
(
position
=
16
,
value
=
"是否盲盒[0-否|1-是]"
)
private
String
unbox
;
private
String
listId
;
@ApiModelProperty
(
position
=
27
,
value
=
"开售时间"
)
private
LocalDateTime
saleStartTime
;
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/inner/GoblinNftJobServiceImpl.java
View file @
fc82f198
...
...
@@ -19,10 +19,8 @@ import org.springframework.data.mongodb.core.query.Query;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
@Slf4j
...
...
@@ -82,24 +80,35 @@ public class GoblinNftJobServiceImpl {
List
<
String
>
notStartSkuIdList
=
CollectionUtil
.
arrayListString
();
List
<
String
>
soldOutSkuIdList
=
CollectionUtil
.
arrayListString
();
ArrayList
<
GoblinNftGoodsSkuListJobVo
>
jobVoArrayList
=
ObjectUtil
.
getGoblinNftGoodsSkuListJobVoArrayList
();
jobVoArrayList
.
addAll
(
notStartSkuInfoVos
);
jobVoArrayList
.
addAll
(
startSkuInfoVos
);
for
(
GoblinNftGoodsSkuListJobVo
info
:
notStartSkuInfoVos
)
{
HashMap
<
String
,
Object
>
mapData
=
goblinRedisUtils
.
getGoodsSkuInfoVo
(
nowTime
,
info
.
getSkuId
());
GoblinGoodsSkuInfoVo
skuInfoVo
=
(
GoblinGoodsSkuInfoVo
)
mapData
.
get
(
"vo"
);
String
listId
=
(
String
)
mapData
.
get
(
"listId"
);
info
.
setSaleStartTime
(
skuInfoVo
.
getSaleStartTime
());
info
.
setListId
(
listId
);
}
notStartSkuInfoVos
=
notStartSkuInfoVos
.
stream
().
sorted
(
Comparator
.
comparing
(
GoblinNftGoodsSkuListJobVo:
:
getSaleStartTime
)).
collect
(
Collectors
.
toList
());
for
(
GoblinNftGoodsSkuListJobVo
info
:
jobVoArrayList
)
{
for
(
GoblinNftGoodsSkuListJobVo
info
:
startSkuInfoVos
)
{
HashMap
<
String
,
Object
>
mapData
=
goblinRedisUtils
.
getGoodsSkuInfoVo
(
nowTime
,
info
.
getSkuId
());
GoblinGoodsSkuInfoVo
skuInfoVo
=
(
GoblinGoodsSkuInfoVo
)
mapData
.
get
(
"vo"
);
String
listId
=
(
String
)
mapData
.
get
(
"listId"
);
info
.
setSaleStartTime
(
skuInfoVo
.
getSaleStartTime
());
info
.
setListId
(
listId
);
}
startSkuInfoVos
=
startSkuInfoVos
.
stream
().
sorted
(
Comparator
.
comparing
(
GoblinNftGoodsSkuListJobVo:
:
getSaleStartTime
,
Comparator
.
reverseOrder
())).
collect
(
Collectors
.
toList
());
List
<
GoblinNftGoodsSkuListJobVo
>
jobVoArrayList
=
ObjectUtil
.
getGoblinNftGoodsSkuListJobVoArrayList
();
jobVoArrayList
.
addAll
(
notStartSkuInfoVos
);
jobVoArrayList
.
addAll
(
startSkuInfoVos
);
for
(
GoblinNftGoodsSkuListJobVo
info
:
jobVoArrayList
)
{
if
(
nowTime
.
compareTo
(
info
.
getSaleStartTime
())
>
0
)
{
// 已开卖
List
<
String
>
skuIdList
=
CollectionUtil
.
arrayListString
();
if
(
info
.
getUnbox
().
equals
(
"1"
))
{
// 是盲盒,非盲盒少查一次spu
skuIdList
=
goblinRedisUtils
.
getGoodsInfoVo
(
info
.
getSpuId
()).
getSkuIdList
();
}
// HashMap<String, Object> map = goblinRedisUtils.getGoodsSkuInfoVo(nowTime, info.getSkuId());
// String listId = (String) map.get("listId");
HashMap
<
String
,
Integer
>
stockHashMap
=
goblinOrderUtils
.
getIsStock
(
listId
,
info
.
getSkuId
(),
info
.
getUnbox
(),
info
.
getSoldoutStatus
(),
skuIdList
);
HashMap
<
String
,
Integer
>
stockHashMap
=
goblinOrderUtils
.
getIsStock
(
info
.
getListId
(),
info
.
getSkuId
(),
info
.
getUnbox
(),
info
.
getSoldoutStatus
(),
skuIdList
);
if
(
stockHashMap
.
get
(
"isStock"
)
==
1
)
{
// 已开卖-未售罄
startSkuIdList
.
add
(
info
.
getSkuId
());
}
else
{
// 已开卖-已售罄 时间正序
...
...
@@ -111,7 +120,6 @@ public class GoblinNftJobServiceImpl {
}
// 已开卖 时间倒序
Collections
.
reverse
(
soldOutSkuIdList
);
// 写入缓存
goblinRedisUtils
.
setGoblinNftGoodsInfoListVo
(
startSkuIdList
,
"1"
);
goblinRedisUtils
.
setGoblinNftGoodsInfoListVo
(
notStartSkuIdList
,
"2"
);
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/util/GoblinRedisUtils.java
View file @
fc82f198
...
...
@@ -935,10 +935,10 @@ public class GoblinRedisUtils {
if
(
st
.
isAfter
(
collectVoItem
.
getTimeStart
())
&&
collectVoItem
.
getTimeEnd
()
==
null
)
{
// collectTemp = collectVoItem;
collectVosList
.
add
(
collectVoItem
);
}
else
if
(
st
.
isAfter
(
collectVoItem
.
getTimeEnd
())
&&
collectVoItem
.
getTimeEnd
()
!=
null
)
{
}
else
if
(
collectVoItem
.
getTimeEnd
()
!=
null
&&
st
.
isAfter
(
collectVoItem
.
getTimeEnd
())
)
{
// collectVo = collectVoItem;
collectVosList
.
add
(
collectVoItem
);
}
else
if
(
st
.
isAfter
(
collectVoItem
.
getTimeStart
())
&&
st
.
isBefore
(
collectVoItem
.
getTimeEnd
()))
{
}
else
if
(
st
.
isAfter
(
collectVoItem
.
getTimeStart
())
&&
st
.
isBefore
(
collectVoItem
.
getTimeEnd
()))
{
// collectVo = collectVoItem;
collectVosList
.
add
(
collectVoItem
);
break
;
...
...
@@ -959,7 +959,7 @@ public class GoblinRedisUtils {
// incrSkuStock(vo.getListId(), skuId, lastStock);
// }
// }
for
(
GoblinListCollectVo
itemVo
:
collectVosList
){
for
(
GoblinListCollectVo
itemVo
:
collectVosList
)
{
//减少上个时间段sku库存
int
lastStock
=
getSkuStock
(
itemVo
.
getListId
(),
skuId
);
int
restStock
=
decrSkuStock
(
itemVo
.
getListId
(),
skuId
,
lastStock
);
...
...
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