记得上下班打卡 | 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
4e7a6ed5
Commit
4e7a6ed5
authored
Aug 02, 2022
by
zhengfuxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
开发前端获取活动详情
parent
e32cb2c3
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
343 additions
and
51 deletions
+343
-51
KylinRecommendActiveRelationVo.java
.../service/kylin/dto/vo/KylinRecommendActiveRelationVo.java
+9
-0
KylinRecommendActiveVo.java
...iquidnet/service/kylin/dto/vo/KylinRecommendActiveVo.java
+10
-0
IKylinRecommendActiveService.java
...t/service/kylin/service/IKylinRecommendActiveService.java
+1
-1
KylinRecommendActiveController.java
...vice/kylin/controller/KylinRecommendActiveController.java
+3
-3
KylinRecommendActiveServiceImpl.java
...e/kylin/service/impl/KylinRecommendActiveServiceImpl.java
+97
-46
KylinRedisUtils.java
...va/com/liquidnet/service/kylin/utils/KylinRedisUtils.java
+218
-0
ObjectUtil.java
...in/java/com/liquidnet/service/kylin/utils/ObjectUtil.java
+5
-1
No files found.
liquidnet-bus-api/liquidnet-service-kylin-api/src/main/java/com/liquidnet/service/kylin/dto/vo/KylinRecommendActiveRelationVo.java
View file @
4e7a6ed5
...
...
@@ -77,6 +77,15 @@ public class KylinRecommendActiveRelationVo implements Serializable {
@ApiModelProperty
(
value
=
"演出的vo"
)
private
KylinPerformanceVo
kylinPerformanceVo
;
private
Object
goblinNftGoodsSkuInfoVo
;
private
Object
goblinGoodsInfoVo
;
private
Object
goblinMixAppDetailsVo
;
/* @ApiModelProperty(value = "演出的vo")
private GoblinNftGoodsSkuInfoVo goblinNftGoodsSkuInfoVo;*/
private
static
final
KylinRecommendActiveRelationVo
obj
=
new
KylinRecommendActiveRelationVo
();
public
static
KylinRecommendActiveRelationVo
getNew
()
{
try
{
...
...
liquidnet-bus-api/liquidnet-service-kylin-api/src/main/java/com/liquidnet/service/kylin/dto/vo/KylinRecommendActiveVo.java
View file @
4e7a6ed5
...
...
@@ -2,6 +2,7 @@ package com.liquidnet.service.kylin.dto.vo;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.liquidnet.commons.lang.util.DateUtil
;
import
com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
...
...
@@ -88,6 +89,15 @@ public class KylinRecommendActiveVo implements Serializable {
@ApiModelProperty
(
value
=
"推荐活动"
)
private
List
<
KylinRecommendActiveRelationVo
>
list
;
@ApiModelProperty
(
value
=
"演出的vo"
)
private
KylinPerformanceVo
kylinPerformanceVo
;
private
Object
goblinNftGoodsSkuInfoVo
;
private
Object
goblinGoodsInfoVo
;
private
Object
goblinMixAppDetailsVo
;
private
String
name
;
private
static
final
KylinRecommendActiveVo
obj
=
new
KylinRecommendActiveVo
();
public
static
KylinRecommendActiveVo
getNew
()
{
...
...
liquidnet-bus-api/liquidnet-service-kylin-api/src/main/java/com/liquidnet/service/kylin/service/IKylinRecommendActiveService.java
View file @
4e7a6ed5
...
...
@@ -9,5 +9,5 @@ import java.util.List;
* 推荐活动接口
*/
public
interface
IKylinRecommendActiveService
{
List
<
KylinRecommendActiveVo
>
getRecommendById
(
List
<
KylinRecommendActive
>
list
);
KylinRecommendActiveVo
getRecommendById
(
List
<
KylinRecommendActive
>
list
);
}
liquidnet-bus-service/liquidnet-service-kylin/liquidnet-service-kylin-impl/src/main/java/com/liquidnet/service/kylin/controller/KylinRecommendActiveController.java
View file @
4e7a6ed5
...
...
@@ -3,6 +3,7 @@ package com.liquidnet.service.kylin.controller;
import
com.liquidnet.commons.lang.util.CurrentUtil
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.kylin.dto.vo.KylinRecommendActiveVo
;
import
com.liquidnet.service.kylin.entity.KylinRecommendActive
;
import
com.liquidnet.service.kylin.service.impl.KylinRecommendActiveServiceImpl
;
import
com.liquidnet.service.kylin.utils.DataUtils
;
...
...
@@ -36,16 +37,15 @@ public class KylinRecommendActiveController {
@PostMapping
(
"getRecommendById"
)
@ApiOperation
(
"获取推荐活动详情"
)
public
ResponseDto
<
List
<
KylinRecommendActive
>
>
getRecommendById
(
@RequestParam
(
value
=
"bindId"
)
String
bindId
)
{
public
ResponseDto
<
KylinRecommendActiveVo
>
getRecommendById
(
@RequestParam
(
value
=
"bindId"
)
String
bindId
)
{
String
uid
=
CurrentUtil
.
getCurrentUid
();
List
<
KylinRecommendActive
>
list
=
dataUtils
.
getRecommendActive
(
bindId
);
if
(
null
==
list
){
return
null
;
}
else
{
//循环遍历,查到绑定的详情
kylinRecommendActiveService
.
getRecommendById
(
list
);
return
ResponseDto
.
success
(
kylinRecommendActiveService
.
getRecommendById
(
list
)
);
}
return
null
;
}
...
...
liquidnet-bus-service/liquidnet-service-kylin/liquidnet-service-kylin-impl/src/main/java/com/liquidnet/service/kylin/service/impl/KylinRecommendActiveServiceImpl.java
View file @
4e7a6ed5
package
com
.
liquidnet
.
service
.
kylin
.
service
.
impl
;
import
com.liquidnet.commons.lang.util.StringUtil
;
import
com.liquidnet.service.goblin.dto.vo.*
;
import
com.liquidnet.service.kylin.dto.vo.KylinRecommendActiveRelationVo
;
import
com.liquidnet.service.kylin.dto.vo.KylinRecommendActiveVo
;
import
com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo
;
import
com.liquidnet.service.kylin.entity.KylinRecommendActive
;
...
...
@@ -11,6 +13,8 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDateTime
;
import
java.util.HashMap
;
import
java.util.List
;
/**
...
...
@@ -27,32 +31,63 @@ public class KylinRecommendActiveServiceImpl implements IKylinRecommendActiveSer
private
KylinRedisUtils
kylinRedisUtils
;
@Override
public
List
<
KylinRecommendActiveVo
>
getRecommendById
(
List
<
KylinRecommendActive
>
list
)
{
public
KylinRecommendActiveVo
getRecommendById
(
List
<
KylinRecommendActive
>
list
)
{
for
(
KylinRecommendActive
kylinRecommendActive:
list
){
//查看时间是否在当前范围内
if
(
LocalDateTime
.
now
().
isAfter
(
kylinRecommendActive
.
getStartTime
())&&
LocalDateTime
.
now
().
isBefore
(
kylinRecommendActive
.
getEndTime
())){
KylinRecommendActiveVo
kylinRecommendActiveVo
=
KylinRecommendActiveVo
.
getNew
();
BeanUtils
.
copyProperties
(
kylinRecommendActive
,
kylinRecommendActiveVo
);
if
(
StringUtil
.
isNotBlank
(
kylinRecommendActiveVo
.
getActiveBindId
())&&
null
!=
kylinRecommendActiveVo
.
getActiveType
()){
//找到绑定的详情
if
(
kylinRecommendActiveVo
.
getActiveType
()==
3
){
//演出
KylinPerformanceVo
performancesInfo
=
dataUtils
.
getPerformanceVo
(
kylinRecommendActiveVo
.
getActiveBindId
());
kylinRecommendActiveVo
.
setKylinPerformanceVo
(
performancesInfo
);
}
else
if
(
kylinRecommendActiveVo
.
getActiveType
()==
1
){
//NFT
GoblinNftGoodsSkuInfoVo
goblinNftGoodsSkuInfoVo
=
goodsDetail
(
kylinRecommendActiveVo
.
getActiveBindId
());
kylinRecommendActiveVo
.
setGoblinNftGoodsSkuInfoVo
(
goblinNftGoodsSkuInfoVo
);
}
else
if
(
kylinRecommendActiveVo
.
getActiveType
()==
4
){
//商品
kylinRedisUtils
.
getGoodsInfoVo
(
kylinRecommendActiveVo
.
getActiveBindId
());
GoblinGoodsInfoVo
goblinGoodsInfoVo
=
kylinRedisUtils
.
getGoodsInfoVo
(
kylinRecommendActiveVo
.
getActiveBindId
());
kylinRecommendActiveVo
.
setGoblinGoodsInfoVo
(
goblinGoodsInfoVo
);
}
else
if
(
kylinRecommendActiveVo
.
getActiveType
()==
2
){
//组合购
GoblinMixAppDetailsVo
goblinMixAppDetailsVo
=
mixDetails
(
kylinRecommendActiveVo
.
getActiveBindId
());
kylinRecommendActiveVo
.
setGoblinMixAppDetailsVo
(
goblinMixAppDetailsVo
);
}
}
//遍历list
List
<
KylinRecommendActiveRelationVo
>
kylinRecommendActiveVoList
=
kylinRecommendActiveVo
.
getList
();
for
(
KylinRecommendActiveRelationVo
kylinRecommendActiveRelationVo:
kylinRecommendActiveVoList
){
if
(
kylinRecommendActiveRelationVo
.
getType
()==
1
){
//NFT
GoblinNftGoodsSkuInfoVo
goblinNftGoodsSkuInfoVo
=
goodsDetail
(
kylinRecommendActiveRelationVo
.
getRecommendBindId
());
kylinRecommendActiveRelationVo
.
setGoblinNftGoodsSkuInfoVo
(
goblinNftGoodsSkuInfoVo
);
}
else
if
(
kylinRecommendActiveRelationVo
.
getType
()==
2
){
//组合购
GoblinMixAppDetailsVo
goblinMixAppDetailsVo
=
mixDetails
(
kylinRecommendActiveRelationVo
.
getRecommendBindId
());
kylinRecommendActiveRelationVo
.
setGoblinMixAppDetailsVo
(
goblinMixAppDetailsVo
);
}
else
if
(
kylinRecommendActiveRelationVo
.
getType
()==
3
){
//演出
KylinPerformanceVo
performancesInfo
=
dataUtils
.
getPerformanceVo
(
kylinRecommendActiveRelationVo
.
getRecommendBindId
());
kylinRecommendActiveRelationVo
.
setKylinPerformanceVo
(
performancesInfo
);
}
else
if
(
kylinRecommendActiveRelationVo
.
getType
()==
4
){
//商品 //商品
GoblinGoodsInfoVo
goblinGoodsInfoVo
=
kylinRedisUtils
.
getGoodsInfoVo
(
kylinRecommendActiveRelationVo
.
getRecommendBindId
());
kylinRecommendActiveRelationVo
.
setGoblinGoodsInfoVo
(
goblinGoodsInfoVo
);
}
}
}
}
return
null
;
}
/*public GoblinNftGoodsSkuInfoVo getNft(String skuId){
/**
*NFT 获取详情
*/
public
GoblinNftGoodsSkuInfoVo
goodsDetail
(
String
skuId
)
{
// 1
LocalDateTime
now
=
LocalDateTime
.
now
();
HashMap
<
String
,
Object
>
map
=
kylinRedisUtils
.
getGoodsSkuInfoVo
(
now
,
skuId
);
if
(
null
==
map
)
{
...
...
@@ -63,44 +98,60 @@ public class KylinRecommendActiveServiceImpl implements IKylinRecommendActiveSer
String
listId
=
(
String
)
map
.
get
(
"listId"
);
LocalDateTime
baseSaleStartTime
=
(
LocalDateTime
)
map
.
get
(
"baseSaleStartTime"
);
LocalDateTime
nextSaleStartTime
=
(
LocalDateTime
)
map
.
get
(
"nextSaleStartTime"
);
if (goblinRedisUtils.getSkuAllStatusShow(skuInfoVo)) {
//获取预约相关
AnticipateValueVo anticipateValueVo = goblinGoodsAnticipateMgService.getAnticipateValueBySkuId(skuId, 1);
if
(
kylinRedisUtils
.
getSkuAllStatusShow
(
skuInfoVo
))
{
GoblinNftGoodsSkuInfoVo nftGoodsSkuInfoVo = GoblinNftGoodsSkuInfoVo.getNew().copy(skuInfoVo, anticipateValueVo);
// 限购数量
Integer buyCount = 0;
String userId = CurrentUtil.getCurrentUid();
if (StringUtils.isNotBlank(userId)) {
buyCount = goblinRedisUtils.getSkuCountByUid(userId, skuId);
}
if (null != skuInfoVo.getBuyLimit() && 0 != skuInfoVo.getBuyLimit()) {
nftGoodsSkuInfoVo.setCanBuyNum(skuInfoVo.getBuyLimit() - buyCount);
}
GoblinNftGoodsSkuInfoVo
nftGoodsSkuInfoVo
=
GoblinNftGoodsSkuInfoVo
.
getNew
().
copy
(
skuInfoVo
,
null
);
// spu信息
GoblinGoodsInfoVo goodsInfoVo =
gob
linRedisUtils.getGoodsInfoVo(skuInfoVo.getSpuId());
GoblinGoodsInfoVo
goodsInfoVo
=
ky
linRedisUtils
.
getGoodsInfoVo
(
skuInfoVo
.
getSpuId
());
GoblinNftGoodsDetailSpuInfoVo
nftGoodsDetailSpuInfoVo
=
GoblinNftGoodsDetailSpuInfoVo
.
getNew
().
copy
(
goodsInfoVo
);
nftGoodsSkuInfoVo
.
setGoblinNftGoodsDetailSpuInfoVo
(
nftGoodsDetailSpuInfoVo
);
// 库存
HashMap<String, Integer> stockHashMap = goblinOrderUtils.getIsStock(listId, skuId, skuInfoVo.getUnbox(), skuInfoVo.getSoldoutStatus(), goodsInfoVo.getSkuIdList());
nftGoodsSkuInfoVo.setIsStock(stockHashMap.get("isStock"));
// 总库存
if (skuInfoVo.getUnbox().equals("1")) {
nftGoodsSkuInfoVo.setSkuStock(stockHashMap.get("totalStock"));
}
// 系统时间
nftGoodsSkuInfoVo
.
setSystime
(
LocalDateTime
.
now
());
nftGoodsSkuInfoVo
.
setTagType
(
tagType
);
nftGoodsSkuInfoVo
.
setListId
(
listId
);
nftGoodsSkuInfoVo
.
setBaseSaleStartTime
(
baseSaleStartTime
);
nftGoodsSkuInfoVo
.
setNextSaleStartTime
(
nextSaleStartTime
);
// 是否开启兑换
nftGoodsSkuInfoVo.setIsExchange(goblinRedisUtils.getIsExchange(skuId));
// 待支付订单数量
nftGoodsSkuInfoVo.setNotPayNum(goblinRedisUtils.getNotPayNum(skuId, listId));
return
nftGoodsSkuInfoVo
;
}
else
{
return
null
;
}
}
public
GoblinMixAppDetailsVo
mixDetails
(
String
mixId
)
{
GoblinMixDetailsVo
baseVo
=
kylinRedisUtils
.
getMixDetails
(
mixId
);
//GoblinStoreInfoVo storeInfoVo = redisUtils.getStoreInfoVo(baseVo.getStoreId());
GoblinMixAppDetailsVo
vo
=
GoblinMixAppDetailsVo
.
getNew
().
copy
(
baseVo
,
""
);
/*int stock = 0;
for (GoblinMixDetailsItemVo item : vo.getItem()) {
GoblinGoodsSkuInfoVo skuInfoVo = redisUtils.getGoodsSkuInfoVo(item.getSkuId());
GoblinGoodsInfoVo spuInfoVo = redisUtils.getGoodsInfoVo(skuInfoVo.getSpuId());
item.setSkuPic(skuInfoVo.getSkuPic());
item.setStock(0);
item.setSkuName(skuInfoVo.getName());
item.setSpuName(spuInfoVo.getName());
if (skuInfoVo.getUnbox().equals("1")) {
List<String> relationIds = redisUtils.getGoblinMixRelationBox(item.getSkuId(), vo.getMixId());
for (String skuId : relationIds) {
stock += redisUtils.getSkuStock(vo.getMixId(), skuId);
}
} else {
stock += redisUtils.getSkuStock(vo.getMixId(), item.getSkuId());
}
}
if (stock == 0) {
vo.setStatus(8);
} else {
LocalDateTime nt = LocalDateTime.now();
LocalDateTime st = LocalDateTime.parse(vo.getTimeStart(), DTF_YMD_HMS);
LocalDateTime et = LocalDateTime.parse(vo.getTimeEnd(), DTF_YMD_HMS);
if (nt.isBefore(st)) {
vo.setStatus(9);
} else if (nt.isAfter(et)) {
vo.setStatus(10);
} else {
vo.setStatus(6);
}
}*/
return
vo
;
}
}
liquidnet-bus-service/liquidnet-service-kylin/liquidnet-service-kylin-impl/src/main/java/com/liquidnet/service/kylin/utils/KylinRedisUtils.java
View file @
4e7a6ed5
...
...
@@ -4,12 +4,20 @@ 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.manage.vo.GoblinGoodsAnticipateValueVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinListCollectVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinMixDetailsVo
;
import
lombok.extern.slf4j.Slf4j
;
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
;
@Slf4j
@Component
...
...
@@ -60,4 +68,214 @@ public class KylinRedisUtils {
return
vo
;
}
}
/**
* 获取 包含分段购的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
(
vo
==
null
)
{
return
vo
;
}
String
marketrk
=
GoblinRedisConst
.
BASIC_GOODS_SKU
.
concat
(
skuId
);
GoblinGoodsSkuInfoVo
marketVo
=
(
GoblinGoodsSkuInfoVo
)
redisUtil
.
get
(
marketrk
);
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
);
return
vo
;
}
}
/**
* 根据时间获取当前分段购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
;
}
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
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
boolean
getSkuAllStatusShow
(
GoblinGoodsSkuInfoVo
info
)
{
if
(
info
!=
null
&&
info
.
getSkuType
()
==
1
&&
info
.
getStatus
().
equals
(
"3"
)
&&
info
.
getShelvesStatus
().
equals
(
"3"
)
&&
(
info
.
getSkuAppear
()
==
null
||
info
.
getSkuAppear
().
equals
(
"0"
))
&&
info
.
getDelFlg
().
equals
(
"0"
)
&&
((
info
.
getUnbox
().
equals
(
"0"
)
&&
info
.
getUpchain
()
==
1
)
||
info
.
getUnbox
().
equals
(
"1"
))
// && (info.getUnbox().equals("1") || info.getUpchain() == 1)
)
{
return
true
;
}
else
{
return
false
;
}
}
/**
* 根据skuId获取valueVo
*/
public
GoblinGoodsAnticipateValueVo
getValueBySkuId
(
String
skuId
)
{
return
(
GoblinGoodsAnticipateValueVo
)
redisUtil
.
get
(
GoblinRedisConst
.
ANTICIPATE_VALUE_SKUID
.
concat
(
skuId
));
}
// 获取 组合售数据
public
GoblinMixDetailsVo
getMixDetails
(
String
mixId
)
{
String
rdk
=
GoblinRedisConst
.
GOBLIN_MIX_DETAILS
.
concat
(
mixId
);
Object
obj
=
redisUtil
.
get
(
rdk
);
if
(
obj
==
null
)
{
return
GoblinMixDetailsVo
.
getNew
();
}
else
{
return
(
GoblinMixDetailsVo
)
obj
;
}
}
}
liquidnet-bus-service/liquidnet-service-kylin/liquidnet-service-kylin-impl/src/main/java/com/liquidnet/service/kylin/utils/ObjectUtil.java
View file @
4e7a6ed5
...
...
@@ -2,6 +2,7 @@ package com.liquidnet.service.kylin.utils;
import
com.liquidnet.service.adam.dto.vo.AdamEntersVo
;
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.admin.OrderRefundPoundage
;
import
com.liquidnet.service.kylin.dto.vo.middle.KylinTicketTimesVo
;
...
...
@@ -34,7 +35,7 @@ public class ObjectUtil {
private
static
final
ArrayList
<
KylinOrderCoupons
>
kylinOrderCouponsArrayList
=
new
ArrayList
<>();
private
static
final
ArrayList
<
KylinApiCameraDevicesVo
>
kylinApiCameraDevicesVoArrayList
=
new
ArrayList
<>();
private
static
final
ArrayList
<
KylinCandyVo
>
kylinCandyVos
=
new
ArrayList
<>();
private
static
final
ArrayList
<
GoblinListCollectVo
>
goblinListCollectVo
=
new
ArrayList
<>();
public
static
ArrayList
<
KylinCandyVo
>
kylinCandyVos
()
{
return
(
ArrayList
<
KylinCandyVo
>)
kylinCandyVos
.
clone
();
}
...
...
@@ -102,4 +103,7 @@ public class ObjectUtil {
public
static
ArrayList
<
KylinApiCameraDevicesVo
>
getKylinApiCameraDevicesVoArrayList
()
{
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