记得上下班打卡 | 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
1736d17a
Commit
1736d17a
authored
Jul 14, 2022
by
GaoHu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
演出预告分类区别【0-提前购买|1-分段购买|2-预约|3-普通数字藏品】
parent
ac54e7e6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
297 additions
and
15 deletions
+297
-15
NoticeGoblinGoodsSkuInfoVo.java
...net/service/goblin/dto/vo/NoticeGoblinGoodsSkuInfoVo.java
+12
-0
DataUtils.java
...ain/java/com/liquidnet/service/kylin/utils/DataUtils.java
+34
-15
GoblinMongodbUtils.java
...com/liquidnet/service/kylin/utils/GoblinMongodbUtils.java
+23
-0
GoblinRedisUtils.java
...a/com/liquidnet/service/kylin/utils/GoblinRedisUtils.java
+218
-0
ObjectUtil.java
...in/java/com/liquidnet/service/kylin/utils/ObjectUtil.java
+10
-0
No files found.
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/dto/vo/NoticeGoblinGoodsSkuInfoVo.java
View file @
1736d17a
...
@@ -82,6 +82,16 @@ public class NoticeGoblinGoodsSkuInfoVo implements Serializable, Cloneable {
...
@@ -82,6 +82,16 @@ public class NoticeGoblinGoodsSkuInfoVo implements Serializable, Cloneable {
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
DateUtil
.
DATE_FULL_STR
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
DateUtil
.
DATE_FULL_STR
)
@ApiModelProperty
(
value
=
"预约停止时间"
)
@ApiModelProperty
(
value
=
"预约停止时间"
)
private
LocalDateTime
aboutStopTime
;
private
LocalDateTime
aboutStopTime
;
@ApiModelProperty
(
value
=
"上架处理方式[1-等待手动上架|2-直接上架售卖|3-预约定时上架]"
)
private
String
shelvesHandle
;
@ApiModelProperty
(
value
=
"预约上架时间[上架处理方式为3-预约定时上架时需要指定]"
)
private
String
shelvesTime
;
@ApiModelProperty
(
position
=
62
,
value
=
"标签[0-提前购买|1-分段购买|2-预约|3-普通数字藏品]"
)
private
Integer
tagType
;
@ApiModelProperty
(
position
=
70
,
value
=
"分批购活动id"
)
private
String
listId
;
private
static
final
NoticeGoblinGoodsSkuInfoVo
obj
=
new
NoticeGoblinGoodsSkuInfoVo
();
private
static
final
NoticeGoblinGoodsSkuInfoVo
obj
=
new
NoticeGoblinGoodsSkuInfoVo
();
...
@@ -122,6 +132,8 @@ public class NoticeGoblinGoodsSkuInfoVo implements Serializable, Cloneable {
...
@@ -122,6 +132,8 @@ public class NoticeGoblinGoodsSkuInfoVo implements Serializable, Cloneable {
this
.
subtitle
=
goblinGoodsSkuInfoVo
.
getSubtitle
();
this
.
subtitle
=
goblinGoodsSkuInfoVo
.
getSubtitle
();
this
.
upchain
=
goblinGoodsSkuInfoVo
.
getUpchain
();
this
.
upchain
=
goblinGoodsSkuInfoVo
.
getUpchain
();
this
.
watchType
=
goblinGoodsSkuInfoVo
.
getWatchType
();
this
.
watchType
=
goblinGoodsSkuInfoVo
.
getWatchType
();
this
.
shelvesHandle
=
goblinGoodsSkuInfoVo
.
getShelvesHandle
();
this
.
shelvesTime
=
goblinGoodsSkuInfoVo
.
getShelvesTime
();
return
this
;
return
this
;
}
}
...
...
liquidnet-bus-service/liquidnet-service-kylin/liquidnet-service-kylin-impl/src/main/java/com/liquidnet/service/kylin/utils/DataUtils.java
View file @
1736d17a
...
@@ -47,6 +47,9 @@ public class DataUtils {
...
@@ -47,6 +47,9 @@ public class DataUtils {
@Autowired
@Autowired
private
RedisUtil
redisUtil
;
private
RedisUtil
redisUtil
;
@Autowired
GoblinRedisUtils
goblinRedisUtils
;
/**
/**
* 转赠订单
* 转赠订单
...
@@ -410,9 +413,7 @@ public class DataUtils {
...
@@ -410,9 +413,7 @@ public class DataUtils {
//三天
//三天
List
<
GoblinMixDetailsVo
>
threeDayCombinationList
=
getGoblinMixDetailsVos
(
threeDayCombinationIds
);
List
<
GoblinMixDetailsVo
>
threeDayCombinationList
=
getGoblinMixDetailsVos
(
threeDayCombinationIds
);
List
<
NoticeGoblinMixDetailsVo
>
threeDayCombinationVoList
=
threeDayCombinationList
.
stream
().
map
(
goblinMixDetailsVo
->
{
List
<
NoticeGoblinMixDetailsVo
>
threeDayCombinationVoList
=
threeDayCombinationList
.
stream
().
map
(
goblinMixDetailsVo
->
NoticeGoblinMixDetailsVo
.
getNew
().
copy
(
goblinMixDetailsVo
)).
collect
(
Collectors
.
toList
());
return
NoticeGoblinMixDetailsVo
.
getNew
().
copy
(
goblinMixDetailsVo
);
}).
collect
(
Collectors
.
toList
());
HashMap
<
String
,
Object
>
info
=
CollectionUtil
.
mapStringObject
();
HashMap
<
String
,
Object
>
info
=
CollectionUtil
.
mapStringObject
();
info
.
put
(
"toDayList"
,
toDayList
);
info
.
put
(
"toDayList"
,
toDayList
);
...
@@ -434,12 +435,27 @@ public class DataUtils {
...
@@ -434,12 +435,27 @@ public class DataUtils {
}
}
private
List
<
NoticeGoblinGoodsSkuInfoVo
>
aboutDayNftVoList
(
List
<
GoblinGoodsSkuInfoVo
>
toDaysNftList
,
String
anticipateKey
)
{
private
List
<
NoticeGoblinGoodsSkuInfoVo
>
aboutDayNftVoList
(
List
<
GoblinGoodsSkuInfoVo
>
toDaysNftList
,
String
anticipateKey
)
{
LocalDateTime
now
=
LocalDateTime
.
now
();
List
<
NoticeGoblinGoodsSkuInfoVo
>
toDayNftVoList
=
toDaysNftList
.
stream
().
map
(
goblinGoodsSkuInfoVo
->
{
List
<
NoticeGoblinGoodsSkuInfoVo
>
toDayNftVoList
=
toDaysNftList
.
stream
().
map
(
goblinGoodsSkuInfoVo
->
{
NoticeGoblinGoodsSkuInfoVo
noticeGoblinGoodsSkuInfoVo
=
NoticeGoblinGoodsSkuInfoVo
.
getNew
().
copy
(
goblinGoodsSkuInfoVo
);
NoticeGoblinGoodsSkuInfoVo
noticeGoblinGoodsSkuInfoVo
=
NoticeGoblinGoodsSkuInfoVo
.
getNew
().
copy
(
goblinGoodsSkuInfoVo
);
//获取预约开始结束时间
//获取预约开始结束时间
Object
valueVo
=
redisUtil
.
get
(
anticipateKey
.
concat
(
goblinGoodsSkuInfoVo
.
getSkuId
()));
Object
valueVo
=
redisUtil
.
get
(
anticipateKey
.
concat
(
goblinGoodsSkuInfoVo
.
getSkuId
()));
if
(
valueVo
!=
null
){
if
(
valueVo
!=
null
)
{
noticeGoblinGoodsSkuInfoVo
=
noticeGoblinGoodsSkuInfoVo
.
valueCopy
((
GoblinGoodsAnticipateValueVo
)
valueVo
);
noticeGoblinGoodsSkuInfoVo
=
noticeGoblinGoodsSkuInfoVo
.
valueCopy
((
GoblinGoodsAnticipateValueVo
)
valueVo
);
noticeGoblinGoodsSkuInfoVo
.
setTagType
(
2
);
}
else
{
//非预约sku 查询优先购分批购
HashMap
<
String
,
Object
>
map
=
goblinRedisUtils
.
getGoodsSkuInfoVo
(
now
,
goblinGoodsSkuInfoVo
.
getSkuId
());
if
(
map
!=
null
)
{
Integer
tagType
=
(
Integer
)
map
.
get
(
"tagType"
);
String
listId
=
(
String
)
map
.
get
(
"listId"
);
noticeGoblinGoodsSkuInfoVo
.
setTagType
(
tagType
);
noticeGoblinGoodsSkuInfoVo
.
setListId
(
listId
);
}
}
//普通数字藏品
if
(
noticeGoblinGoodsSkuInfoVo
.
getTagType
()
==
null
)
{
noticeGoblinGoodsSkuInfoVo
.
setTagType
(
3
);
}
}
return
noticeGoblinGoodsSkuInfoVo
;
return
noticeGoblinGoodsSkuInfoVo
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
...
@@ -526,7 +542,7 @@ public class DataUtils {
...
@@ -526,7 +542,7 @@ public class DataUtils {
Object
obj
=
redisUtil
.
get
(
key
+
id
);
Object
obj
=
redisUtil
.
get
(
key
+
id
);
if
(
obj
!=
null
)
{
if
(
obj
!=
null
)
{
toDayList
.
add
((
KylinPerformanceVo
)
obj
);
toDayList
.
add
((
KylinPerformanceVo
)
obj
);
}
else
{
}
else
{
Query
query
=
new
Query
();
Query
query
=
new
Query
();
query
.
fields
().
exclude
(
"details"
);
query
.
fields
().
exclude
(
"details"
);
query
.
fields
().
exclude
(
"noticeImage"
);
query
.
fields
().
exclude
(
"noticeImage"
);
...
@@ -534,9 +550,9 @@ public class DataUtils {
...
@@ -534,9 +550,9 @@ public class DataUtils {
query
.
fields
().
exclude
(
"describeElectronic"
);
query
.
fields
().
exclude
(
"describeElectronic"
);
query
.
addCriteria
(
Criteria
.
where
(
"performancesId"
).
is
(
id
));
query
.
addCriteria
(
Criteria
.
where
(
"performancesId"
).
is
(
id
));
KylinPerformanceVo
one
=
mongoTemplate
.
findOne
(
query
,
KylinPerformanceVo
.
class
,
KylinPerformanceVo
.
class
.
getSimpleName
());
KylinPerformanceVo
one
=
mongoTemplate
.
findOne
(
query
,
KylinPerformanceVo
.
class
,
KylinPerformanceVo
.
class
.
getSimpleName
());
if
(
one
!=
null
)
{
if
(
one
!=
null
)
{
//增加redis缓存
//增加redis缓存
redisUtil
.
set
(
key
+
id
,
one
);
redisUtil
.
set
(
key
+
id
,
one
);
toDayList
.
add
(
one
);
toDayList
.
add
(
one
);
}
}
}
}
...
@@ -1241,19 +1257,22 @@ public class DataUtils {
...
@@ -1241,19 +1257,22 @@ public class DataUtils {
// 获取用户状态
// 获取用户状态
public
String
getUserStatus
(
String
userId
)
{
public
String
getUserStatus
(
String
userId
)
{
return
(
String
)
redisUtil
.
get
(
KylinRedisConst
.
ACTIVE_TICKET_AR_USER
+
userId
);
return
(
String
)
redisUtil
.
get
(
KylinRedisConst
.
ACTIVE_TICKET_AR_USER
+
userId
);
}
}
//获得 ar券
//获得 ar券
public
KylinTicketActive
getArTicket
(
String
code
){
public
KylinTicketActive
getArTicket
(
String
code
)
{
return
(
KylinTicketActive
)
redisUtil
.
get
(
KylinRedisConst
.
ACTIVE_TICKET_AR_TICKET
+
code
);
return
(
KylinTicketActive
)
redisUtil
.
get
(
KylinRedisConst
.
ACTIVE_TICKET_AR_TICKET
+
code
);
}
}
//设置 tikcet
//设置 tikcet
public
void
setArTicket
(
KylinTicketActive
kylinTicketActive
){
public
void
setArTicket
(
KylinTicketActive
kylinTicketActive
)
{
redisUtil
.
set
(
KylinRedisConst
.
ACTIVE_TICKET_AR_TICKET
+
kylinTicketActive
.
getCode
(),
kylinTicketActive
);
redisUtil
.
set
(
KylinRedisConst
.
ACTIVE_TICKET_AR_TICKET
+
kylinTicketActive
.
getCode
(),
kylinTicketActive
);
}
}
//设置用户状态。
//设置用户状态。
public
void
setUser
(
String
userId
,
String
value
)
{
public
void
setUser
(
String
userId
,
String
value
)
{
redisUtil
.
set
(
KylinRedisConst
.
ACTIVE_TICKET_AR_USER
+
userId
,
value
);
redisUtil
.
set
(
KylinRedisConst
.
ACTIVE_TICKET_AR_USER
+
userId
,
value
);
}
}
...
...
liquidnet-bus-service/liquidnet-service-kylin/liquidnet-service-kylin-impl/src/main/java/com/liquidnet/service/kylin/utils/GoblinMongodbUtils.java
0 → 100644
View file @
1736d17a
package
com
.
liquidnet
.
service
.
kylin
.
utils
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Component
;
@Component
public
class
GoblinMongodbUtils
{
@Autowired
MongoTemplate
mongoTemplate
;
// SKU信息
public
GoblinGoodsSkuInfoVo
getGoodsSkuInfoVo
(
String
skuId
)
{
// return mongoTemplate.findOne(Query.query(Criteria.where("skuId").is(skuId).and("delFlg").is("0").and("shelvesStatus").is("3")),
// return mongoTemplate.findOne(Query.query(Criteria.where("skuId").is(skuId).and("delFlg").is("0")),
return
mongoTemplate
.
findOne
(
Query
.
query
(
Criteria
.
where
(
"skuId"
).
is
(
skuId
)),
GoblinGoodsSkuInfoVo
.
class
,
GoblinGoodsSkuInfoVo
.
class
.
getSimpleName
());
}
}
liquidnet-bus-service/liquidnet-service-kylin/liquidnet-service-kylin-impl/src/main/java/com/liquidnet/service/kylin/utils/GoblinRedisUtils.java
0 → 100644
View file @
1736d17a
package
com
.
liquidnet
.
service
.
kylin
.
utils
;
import
com.liquidnet.common.cache.redis.util.RedisUtil
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
import
com.liquidnet.service.goblin.constant.GoblinRedisConst
;
import
com.liquidnet.service.goblin.constant.GoblinStatusConst
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinListCollectVo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.time.LocalDateTime
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Component
public
class
GoblinRedisUtils
{
@Autowired
RedisUtil
redisUtil
;
@Autowired
GoblinMongodbUtils
goblinMongoUtils
;
/**
* 获取 包含分段购的sku详情 HASHMAP
*
* @param now 当前时间
* @param skuId skuId
* @return
*/
public
HashMap
<
String
,
Object
>
getGoodsSkuInfoVo
(
LocalDateTime
now
,
String
skuId
)
{
GoblinGoodsSkuInfoVo
vo
=
getGoodsSkuInfoVo
(
skuId
);
if
(
null
==
vo
)
{
return
null
;
}
HashMap
<
String
,
Object
>
map
=
CollectionUtil
.
mapStringObject
();
LocalDateTime
nextSaleStartTime
=
null
;
if
(
null
==
vo
.
getSaleStartTime
()
||
now
.
isAfter
(
vo
.
getSaleStartTime
()))
{
//普通商品已开售
map
.
put
(
"vo"
,
vo
);
map
.
put
(
"tagType"
,
null
);
map
.
put
(
"listId"
,
null
);
map
.
put
(
"whiteType"
,
null
);
map
.
put
(
"baseSaleStartTime"
,
vo
.
getSaleStartTime
());
map
.
put
(
"nextSaleStartTime"
,
null
);
}
else
{
//未开售
GoblinListCollectVo
collectVo
=
getCollectByNow
(
now
,
skuId
);
Integer
tagType
=
null
;
Integer
whiteType
=
null
;
String
listId
=
null
;
LocalDateTime
baseSaleStartTime
=
vo
.
getSaleStartTime
();
if
(
collectVo
!=
null
)
{
vo
.
setPrice
(
collectVo
.
getPrice
());
vo
.
setPriceV
(
collectVo
.
getPriceV
());
vo
.
setProductId
(
collectVo
.
getProductId
());
vo
.
setSaleStartTime
(
collectVo
.
getTimeStart
());
vo
.
setSaleStopTime
(
collectVo
.
getTimeEnd
());
listId
=
collectVo
.
getListId
();
whiteType
=
collectVo
.
getWhiteType
();
tagType
=
collectVo
.
getTagType
();
}
GoblinListCollectVo
collectNext
=
getCollectByNowNext
(
now
,
skuId
);
if
(
collectNext
!=
null
)
{
if
(
tagType
==
null
)
{
tagType
=
collectNext
.
getTagType
();
}
//todo 逻辑修改 开售时间
if
(
collectVo
==
null
)
{
vo
.
setSaleStartTime
(
collectNext
.
getTimeStart
());
vo
.
setSaleStopTime
(
collectNext
.
getTimeEnd
());
}
nextSaleStartTime
=
collectNext
.
getTimeStart
();
}
map
.
put
(
"vo"
,
vo
);
map
.
put
(
"tagType"
,
tagType
);
map
.
put
(
"listId"
,
listId
);
map
.
put
(
"whiteType"
,
whiteType
);
map
.
put
(
"baseSaleStartTime"
,
baseSaleStartTime
);
map
.
put
(
"nextSaleStartTime"
,
nextSaleStartTime
);
}
return
map
;
}
/**
* 单品信息
*
* @param skuId 单品ID
* @return GoblinGoodsSkuInfoVo
*/
public
GoblinGoodsSkuInfoVo
getGoodsSkuInfoVo
(
String
skuId
)
{
String
pre
=
GoblinStatusConst
.
MarketPreStatus
.
getPre
(
skuId
);
if
(
pre
!=
null
&&
pre
.
equals
(
GoblinStatusConst
.
MarketPreStatus
.
MARKET_PRE_ZHENGZAI
.
getValue
()))
{
String
rk
=
GoblinRedisConst
.
BASIC_GOODS_SKU
.
concat
(
skuId
.
split
(
GoblinStatusConst
.
MarketPreStatus
.
MARKET_PRE_ZHENGZAI
.
getValue
())[
0
]);
GoblinGoodsSkuInfoVo
vo
=
(
GoblinGoodsSkuInfoVo
)
redisUtil
.
get
(
rk
);
if
(
null
==
vo
&&
null
!=
(
vo
=
goblinMongoUtils
.
getGoodsSkuInfoVo
(
skuId
)))
{
redisUtil
.
set
(
rk
,
vo
);
}
if
(
vo
==
null
)
{
return
vo
;
}
String
marketrk
=
GoblinRedisConst
.
BASIC_GOODS_SKU
.
concat
(
skuId
);
GoblinGoodsSkuInfoVo
marketVo
=
(
GoblinGoodsSkuInfoVo
)
redisUtil
.
get
(
marketrk
);
if
(
null
==
marketVo
&&
null
!=
(
marketVo
=
goblinMongoUtils
.
getGoodsSkuInfoVo
(
skuId
)))
{
redisUtil
.
set
(
marketrk
,
marketVo
);
}
if
(
marketVo
==
null
)
{
return
marketVo
;
}
vo
.
setSpuId
(
marketVo
.
getSpuId
());
vo
.
setSkuId
(
marketVo
.
getSkuId
());
vo
.
setPrice
(
marketVo
.
getPrice
());
vo
.
setPriceMember
(
marketVo
.
getPriceMember
());
vo
.
setSkuStock
(
marketVo
.
getSkuStock
());
vo
.
setBuyLimit
(
marketVo
.
getBuyLimit
());
vo
.
setBuyRoster
(
marketVo
.
getBuyRoster
());
vo
.
setBuyFactor
(
marketVo
.
getBuyFactor
());
// vo.setDelFlg("0");
vo
.
setDelFlg
(
marketVo
.
getDelFlg
().
equals
(
"1"
)
?
marketVo
.
getDelFlg
()
:
vo
.
getDelFlg
());
vo
.
setMarketId
(
marketVo
.
getMarketId
());
vo
.
setCreatedAt
(
LocalDateTime
.
now
());
return
vo
;
}
else
{
String
rk
=
GoblinRedisConst
.
BASIC_GOODS_SKU
.
concat
(
skuId
);
GoblinGoodsSkuInfoVo
vo
=
(
GoblinGoodsSkuInfoVo
)
redisUtil
.
get
(
rk
);
if
(
null
==
vo
&&
null
!=
(
vo
=
goblinMongoUtils
.
getGoodsSkuInfoVo
(
skuId
)))
{
redisUtil
.
set
(
rk
,
vo
);
}
return
vo
;
}
}
/**
* 根据时间获取当前分段购vo 如果当前没有返回下一个
*
* @param now
* @param skuId
* @return
*/
public
GoblinListCollectVo
getCollectByNowNext
(
LocalDateTime
now
,
String
skuId
)
{
GoblinListCollectVo
collectVo
=
null
;
GoblinListCollectVo
collectTemp
=
null
;
GoblinListCollectVo
collectNext
=
null
;
List
<
GoblinListCollectVo
>
collectVos
=
getGoblinListCollect
(
skuId
);
for
(
int
i
=
0
;
i
<
collectVos
.
size
();
i
++)
{
GoblinListCollectVo
collectVoItem
=
collectVos
.
get
(
i
);
if
(
now
.
isAfter
(
collectVoItem
.
getTimeStart
())
&&
collectVoItem
.
getTimeEnd
()
==
null
)
{
if
(
collectTemp
==
null
||
collectTemp
.
getTimeStart
().
isBefore
(
collectVoItem
.
getTimeStart
()))
{
collectTemp
=
collectVoItem
;
}
}
else
if
(
now
.
isAfter
(
collectVoItem
.
getTimeStart
())
&&
now
.
isBefore
(
collectVoItem
.
getTimeEnd
()))
{
collectVo
=
collectVoItem
;
}
else
if
(
now
.
isBefore
(
collectVoItem
.
getTimeStart
()))
{
if
(
collectNext
==
null
||
collectNext
.
getTimeStart
().
isAfter
(
collectNext
.
getTimeStart
()))
{
collectNext
=
collectVoItem
;
}
}
else
if
(
collectVoItem
.
getTimeEnd
()
!=
null
&&
now
.
isAfter
(
collectVoItem
.
getTimeEnd
()))
{
collectTemp
=
null
;
}
}
// if (collectVo == null && collectTemp != null) {
// collectVo = collectTemp;
// } else
// if (collectVo == null) {
// collectVo = collectNext;
// }
// return collectVo;
return
collectNext
;
}
public
List
<
GoblinListCollectVo
>
getGoblinListCollect
(
String
skuId
)
{
Object
obj
=
redisUtil
.
get
(
GoblinRedisConst
.
LIST_COLLECT
.
concat
(
skuId
));
if
(
obj
==
null
)
{
return
ObjectUtil
.
getGoblinListCollectVo
();
}
else
{
List
<
GoblinListCollectVo
>
list
=
(
List
<
GoblinListCollectVo
>)
obj
;
list
=
list
.
stream
().
sorted
(
Comparator
.
comparing
(
GoblinListCollectVo:
:
getTimeStart
)).
collect
(
Collectors
.
toList
());
return
list
;
}
}
/**
* 根据时间获取当前分段购vo
*
* @param now
* @param skuId
* @return
*/
public
GoblinListCollectVo
getCollectByNow
(
LocalDateTime
now
,
String
skuId
)
{
GoblinListCollectVo
collectVo
=
null
;
GoblinListCollectVo
collectTemp
=
null
;
List
<
GoblinListCollectVo
>
collectVos
=
getGoblinListCollect
(
skuId
);
for
(
int
i
=
0
;
i
<
collectVos
.
size
();
i
++)
{
GoblinListCollectVo
collectVoItem
=
collectVos
.
get
(
i
);
if
(
now
.
isAfter
(
collectVoItem
.
getTimeStart
())
&&
collectVoItem
.
getTimeEnd
()
==
null
)
{
if
(
collectTemp
==
null
||
collectTemp
.
getTimeStart
().
isBefore
(
collectVoItem
.
getTimeStart
()))
{
collectTemp
=
collectVoItem
;
}
}
else
if
(
now
.
isAfter
(
collectVoItem
.
getTimeStart
())
&&
now
.
isBefore
(
collectVoItem
.
getTimeEnd
()))
{
collectVo
=
collectVoItem
;
break
;
}
else
if
(
collectVoItem
.
getTimeEnd
()
!=
null
&&
now
.
isAfter
(
collectVoItem
.
getTimeEnd
()))
{
collectTemp
=
null
;
}
}
if
(
collectVo
==
null
)
{
collectVo
=
collectTemp
;
}
return
collectVo
;
}
}
liquidnet-bus-service/liquidnet-service-kylin/liquidnet-service-kylin-impl/src/main/java/com/liquidnet/service/kylin/utils/ObjectUtil.java
View file @
1736d17a
...
@@ -2,6 +2,7 @@ package com.liquidnet.service.kylin.utils;
...
@@ -2,6 +2,7 @@ package com.liquidnet.service.kylin.utils;
import
com.liquidnet.service.adam.dto.vo.AdamEntersVo
;
import
com.liquidnet.service.adam.dto.vo.AdamEntersVo
;
import
com.liquidnet.service.base.PagedResult
;
import
com.liquidnet.service.base.PagedResult
;
import
com.liquidnet.service.goblin.dto.vo.GoblinListCollectVo
;
import
com.liquidnet.service.kylin.dto.vo.KylinApiCameraDevicesVo
;
import
com.liquidnet.service.kylin.dto.vo.KylinApiCameraDevicesVo
;
import
com.liquidnet.service.kylin.dto.vo.admin.OrderRefundPoundage
;
import
com.liquidnet.service.kylin.dto.vo.admin.OrderRefundPoundage
;
import
com.liquidnet.service.kylin.dto.vo.middle.KylinTicketTimesVo
;
import
com.liquidnet.service.kylin.dto.vo.middle.KylinTicketTimesVo
;
...
@@ -33,6 +34,9 @@ public class ObjectUtil {
...
@@ -33,6 +34,9 @@ public class ObjectUtil {
private
static
final
ArrayList
<
KylinOrderCoupons
>
kylinOrderCouponsArrayList
=
new
ArrayList
<>();
private
static
final
ArrayList
<
KylinOrderCoupons
>
kylinOrderCouponsArrayList
=
new
ArrayList
<>();
private
static
final
ArrayList
<
KylinApiCameraDevicesVo
>
kylinApiCameraDevicesVoArrayList
=
new
ArrayList
<>();
private
static
final
ArrayList
<
KylinApiCameraDevicesVo
>
kylinApiCameraDevicesVoArrayList
=
new
ArrayList
<>();
/*正在热卖*/
private
static
final
ArrayList
<
GoblinListCollectVo
>
goblinListCollectVo
=
new
ArrayList
<>();
public
static
ArrayList
<
KylinStationPerformanceVo
>
getKylinStationPerformanceVoArrayList
()
{
public
static
ArrayList
<
KylinStationPerformanceVo
>
getKylinStationPerformanceVoArrayList
()
{
return
(
ArrayList
<
KylinStationPerformanceVo
>)
kylinStationPerformanceVoArrayList
.
clone
();
return
(
ArrayList
<
KylinStationPerformanceVo
>)
kylinStationPerformanceVoArrayList
.
clone
();
...
@@ -97,4 +101,10 @@ public class ObjectUtil {
...
@@ -97,4 +101,10 @@ public class ObjectUtil {
public
static
ArrayList
<
KylinApiCameraDevicesVo
>
getKylinApiCameraDevicesVoArrayList
()
{
public
static
ArrayList
<
KylinApiCameraDevicesVo
>
getKylinApiCameraDevicesVoArrayList
()
{
return
(
ArrayList
<
KylinApiCameraDevicesVo
>)
kylinApiCameraDevicesVoArrayList
.
clone
();
return
(
ArrayList
<
KylinApiCameraDevicesVo
>)
kylinApiCameraDevicesVoArrayList
.
clone
();
}
}
/*正在热卖*/
public
static
ArrayList
<
GoblinListCollectVo
>
getGoblinListCollectVo
()
{
return
(
ArrayList
<
GoblinListCollectVo
>)
goblinListCollectVo
.
clone
();
}
}
}
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