记得上下班打卡 | 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
e33e076c
Commit
e33e076c
authored
May 24, 2022
by
Administrator
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pre' into 'master'
Pre See merge request
!242
parents
83b5501e
6d8e1032
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
188 additions
and
191 deletions
+188
-191
GoblinNftGoodsSkuInfoVo.java
...uidnet/service/goblin/dto/vo/GoblinNftGoodsSkuInfoVo.java
+5
-0
GoblinUserDigitalArtworkInfoVo.java
...service/goblin/dto/vo/GoblinUserDigitalArtworkInfoVo.java
+5
-1
liquidnet-service-goblin.yml
...-bus-config/liquidnet-config/liquidnet-service-goblin.yml
+1
-0
GoblinGoodsSku.java
...a/com/liquidnet/service/goblin/entity/GoblinGoodsSku.java
+0
-3
AbstractDataUtils.java
...com/liquidnet/service/galaxy/utils/AbstractDataUtils.java
+1
-1
sqlmap-galaxy.properties
...goblin-common/src/main/resources/sqlmap-galaxy.properties
+1
-1
GoblinGoodsAnticipateServiceImpl.java
...goblin/service/impl/GoblinGoodsAnticipateServiceImpl.java
+13
-9
GoblinNftGoodsAppServiceImpl.java
...ice/goblin/service/impl/GoblinNftGoodsAppServiceImpl.java
+3
-0
GoblinNftOrderAppServiceImpl.java
...ice/goblin/service/impl/GoblinNftOrderAppServiceImpl.java
+1
-1
GoblinUserDigitalArtworkServiceImpl.java
...lin/service/impl/GoblinUserDigitalArtworkServiceImpl.java
+5
-0
GoblinNftJobServiceImpl.java
...ce/goblin/service/impl/inner/GoblinNftJobServiceImpl.java
+1
-1
GoblinListServiceImpl.java
...ice/goblin/service/impl/manage/GoblinListServiceImpl.java
+16
-6
GoblinMongoUtils.java
...a/com/liquidnet/service/goblin/util/GoblinMongoUtils.java
+23
-16
GoblinRedisUtils.java
...a/com/liquidnet/service/goblin/util/GoblinRedisUtils.java
+42
-39
errors.properties
...-service-goblin-impl/src/main/resources/errors.properties
+2
-1
GoblinNftOrderServiceImpl.java
...service/order/service/impl/GoblinNftOrderServiceImpl.java
+12
-9
GoblinNftOrderUtils.java
...om/liquidnet/service/order/utils/GoblinNftOrderUtils.java
+4
-1
GoblinRedisUtils.java
...a/com/liquidnet/service/order/utils/GoblinRedisUtils.java
+6
-72
GoblinNftExSkuServiceImpl.java
...atform/service/impl/goblin/GoblinNftExSkuServiceImpl.java
+47
-30
No files found.
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/dto/vo/GoblinNftGoodsSkuInfoVo.java
View file @
e33e076c
...
...
@@ -100,6 +100,11 @@ public class GoblinNftGoodsSkuInfoVo implements Serializable, Cloneable {
private
String
arUrlAndroid
;
@ApiModelProperty
(
position
=
67
,
value
=
"标签[0-提前购买|1-分段购买]"
)
private
Integer
tagType
;
@ApiModelProperty
(
position
=
68
,
value
=
"分批购活动id"
)
private
String
listId
;
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
DateUtil
.
DATE_FULL_STR
)
@ApiModelProperty
(
position
=
69
,
value
=
"sku正常开售时间"
)
private
LocalDateTime
baseSaleStartTime
;
private
static
final
GoblinNftGoodsSkuInfoVo
obj
=
new
GoblinNftGoodsSkuInfoVo
();
...
...
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/dto/vo/GoblinUserDigitalArtworkInfoVo.java
View file @
e33e076c
...
...
@@ -42,11 +42,14 @@ public class GoblinUserDigitalArtworkInfoVo implements Serializable, Cloneable {
@ApiModelProperty
(
position
=
23
,
value
=
"藏品详情"
)
private
String
details
;
@ApiModelProperty
(
position
=
2
3
,
value
=
"单品AR文件URL-iOS版"
)
@ApiModelProperty
(
position
=
2
4
,
value
=
"单品AR文件URL-iOS版"
)
private
String
arUrlIos
;
@ApiModelProperty
(
position
=
25
,
value
=
"单品AR文件URL-android版"
)
private
String
arUrlAndroid
;
@ApiModelProperty
(
position
=
26
,
value
=
"单品ID"
)
private
String
skuId
;
private
static
final
GoblinUserDigitalArtworkInfoVo
obj
=
new
GoblinUserDigitalArtworkInfoVo
();
public
static
GoblinUserDigitalArtworkInfoVo
getNew
()
{
...
...
@@ -71,6 +74,7 @@ public class GoblinUserDigitalArtworkInfoVo implements Serializable, Cloneable {
// this.setAuthor();
// this.setPublisher();
// this.setDetails();
this
.
setSkuId
(
source
.
getSkuId
());
return
this
;
}
}
liquidnet-bus-config/liquidnet-config/liquidnet-service-goblin.yml
View file @
e33e076c
...
...
@@ -117,6 +117,7 @@ global-auth:
-
${liquidnet.info.context}/nftTrade/**
-
${liquidnet.info.context}/nftTradeQuery/**
-
${liquidnet.info.context}/nftUser/**
-
${liquidnet.info.context}/nftGoods/payType
oncheck-url-pattern
:
-
# -----------------------------------------------------------
...
...
liquidnet-bus-do/liquidnet-service-goblin-do/src/main/java/com/liquidnet/service/goblin/entity/GoblinGoodsSku.java
View file @
e33e076c
...
...
@@ -249,9 +249,6 @@ public class GoblinGoodsSku implements Serializable {
private
LocalDateTime
deletedAt
;
private
Integer
upchain
;
/**
* 物流模版id
*/
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-common/src/main/java/com/liquidnet/service/galaxy/utils/AbstractDataUtils.java
View file @
e33e076c
...
...
@@ -72,7 +72,7 @@ public abstract class AbstractDataUtils {
this
.
getQueueUtil
().
sendMySqlRedis
(
SqlMapping
.
get
(
"galaxy_user_info.update"
),
new
Object
[]{
userInfoBo
.
getUserName
(),
userInfoBo
.
getIdCardType
(),
userInfoBo
.
getIdCard
(),
userInfoBo
.
getMobile
()
,
userInfoBo
.
getBlockChainAddress
(),
new
Date
(),
userInfoBo
.
getRouterType
(),
userInfoBo
.
getUserId
()
,
userInfoBo
.
getBlockChainAddress
(),
userInfoBo
.
getUserIdentification
(),
new
Date
(),
userInfoBo
.
getRouterType
(),
userInfoBo
.
getUserId
()
}
,
MQConst
.
GalaxyQueue
.
SQL_USER_INFO
.
getKey
()
);
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-common/src/main/resources/sqlmap-galaxy.properties
View file @
e33e076c
...
...
@@ -12,7 +12,7 @@ galaxy_nft_trade_info.insert=insert into galaxy_nft_trade_info (user_id, nft_id,
galaxy_nft_order_fail_log.insert
=
insert into galaxy_nft_order_fail_log (nft_order_pay_id, user_id, nft_id, nft_name, series_name, series_id,series_code, taskId, fail_reason_desc, fail_reason_desc_second, deal_with_status, trade_type,router_type, created_at, updated_at)values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
# ------------------------更新用户注册信息----------------------------
galaxy_user_info.update
=
update galaxy_user_info set user_name = ?,id_card_type = ?,id_card = ?,mobile = ?,block_chain_address = ?,updated_at =? where router_type = ? and user_id = ?
galaxy_user_info.update
=
update galaxy_user_info set user_name = ?,id_card_type = ?,id_card = ?,mobile = ?,block_chain_address = ?,u
ser_identification = ?,u
pdated_at =? where router_type = ? and user_id = ?
# ------------------------更新系列声明信息----------------------------
galaxy_series_info.updateSeriesIdAndStatus
=
update galaxy_series_info t set t.series_id = ?,t.chain_timestamp = ?,t.trade_hash = ?,t.series_claim_status = ? ,t.updated_at =? where t.series_code = ?
# ------------------------更新系列NFT信息----------------------------
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinGoodsAnticipateServiceImpl.java
View file @
e33e076c
...
...
@@ -230,6 +230,19 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
//mongodb缓存
// goblinMongoUtils.setHelpVo(helpVo);
//记录助力人数头像(前六个)
List
<
String
>
helpUserAvatar
=
goblinRedisUtils
.
getHelpUserAvatar
(
sid
);
if
(
helpUserAvatar
.
size
()
<=
6
)
{
//获取用户头像保存
AdamUserInfoVo
userInfo
=
goblinAnticipateUtils
.
getUserInfo
();
if
(
userInfo
!=
null
){
//新增助力头像
goblinRedisUtils
.
setHelpUserAvatar
(
sid
,
userInfo
.
getAvatar
());
}
else
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
150008
));
}
}
//加入redis缓存
Duration
between
=
Duration
.
between
(
shareVo
.
getAboutStartDate
(),
shareVo
.
getAboutEndDate
());
goblinRedisUtils
.
setHelpByUidAndSid
(
uid
,
sid
,
between
.
toDays
());
...
...
@@ -246,15 +259,6 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
});
sendRedis
(
"goblin_goods_anticipate_help"
,
sqlValue
);
//记录助力人数头像(前六个)
List
<
String
>
helpUserAvatar
=
goblinRedisUtils
.
getHelpUserAvatar
(
sid
);
if
(
helpUserAvatar
.
size
()
<=
6
)
{
//获取用户头像保存
AdamUserInfoVo
userInfo
=
goblinAnticipateUtils
.
getUserInfo
();
//新增助力头像
goblinRedisUtils
.
setHelpUserAvatar
(
sid
,
userInfo
.
getAvatar
());
}
//判断主力人数是否达标,达标则自动预约
if
(
shareVo
.
getPeopleType
().
equals
(
goblinRedisUtils
.
getHelpSidAddHelp
(
sid
))){
//主力人数达到可预约条件
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinNftGoodsAppServiceImpl.java
View file @
e33e076c
...
...
@@ -147,6 +147,7 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService {
GoblinGoodsSkuInfoVo
skuInfoVo
=
(
GoblinGoodsSkuInfoVo
)
map
.
get
(
"vo"
);
Integer
tagType
=
(
Integer
)
map
.
get
(
"tagType"
);
String
listId
=
(
String
)
map
.
get
(
"listId"
);
LocalDateTime
baseSaleStartTime
=
(
LocalDateTime
)
map
.
get
(
"baseSaleStartTime"
);
if
(
goblinRedisUtils
.
getSkuAllStatusShow
(
skuInfoVo
))
{
//获取预约相关
AnticipateValueVo
anticipateValueVo
=
goblinGoodsAnticipateMgService
.
getAnticipateValueBySkuId
(
skuId
,
1
);
...
...
@@ -175,6 +176,8 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService {
// 系统时间
nftGoodsSkuInfoVo
.
setSystime
(
LocalDateTime
.
now
());
nftGoodsSkuInfoVo
.
setTagType
(
tagType
);
nftGoodsSkuInfoVo
.
setListId
(
listId
);
nftGoodsSkuInfoVo
.
setBaseSaleStartTime
(
baseSaleStartTime
);
// 是否开启兑换
nftGoodsSkuInfoVo
.
setIsExchange
(
goblinRedisUtils
.
getIsExchange
(
skuId
));
return
nftGoodsSkuInfoVo
;
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinNftOrderAppServiceImpl.java
View file @
e33e076c
...
...
@@ -104,7 +104,7 @@ public class GoblinNftOrderAppServiceImpl implements IGoblinNftOrderAppService {
// 分批、提前购黑、白名单
Integer
isListCanBuy
=
1
;
if
(
null
!=
tagType
)
{
if
(
null
!=
listId
)
{
Boolean
listCanBuy
=
goblinRedisUtils
.
getListCanBuy
(
listId
,
skuId
,
mobile
,
uid
,
whiteType
);
if
(!
listCanBuy
)
{
isListCanBuy
=
0
;
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinUserDigitalArtworkServiceImpl.java
View file @
e33e076c
...
...
@@ -21,6 +21,7 @@ import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import
com.liquidnet.service.goblin.util.ObjectUtil
;
import
com.liquidnet.service.goblin.util.QueueUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -113,6 +114,10 @@ public class GoblinUserDigitalArtworkServiceImpl implements IGoblinUserDigitalAr
GoblinGoodsSkuInfoVo
goodsSkuInfoVo
=
goblinRedisUtils
.
getGoodsSkuInfoVo
(
userDigitalArtworkVo
.
getSkuId
());
GoblinGoodsInfoVo
goodsInfoVo
=
goblinRedisUtils
.
getGoodsInfoVo
(
goodsSkuInfoVo
.
getSpuId
());
GoblinNftOrderVo
nftOrder
=
goblinRedisUtils
.
getGoblinNftOrder
(
userDigitalArtworkVo
.
getOrderId
());
if
(
null
!=
nftOrder
&&
StringUtils
.
isNotBlank
(
nftOrder
.
getBoxSkuId
()))
{
artworkInfoVo
.
setSkuId
(
nftOrder
.
getSkuId
());
}
artworkInfoVo
.
setCoverPic
(
goodsSkuInfoVo
.
getSkuPic
());
artworkInfoVo
.
setName
(
goodsSkuInfoVo
.
getName
());
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/inner/GoblinNftJobServiceImpl.java
View file @
e33e076c
...
...
@@ -286,7 +286,7 @@ public class GoblinNftJobServiceImpl {
List
<
GoblinNftGoodsSkuListJobVo
>
notStartSkuInfoVos
=
mongoTemplate
.
find
(
query1
,
GoblinNftGoodsSkuListJobVo
.
class
,
GoblinGoodsSkuInfoVo
.
class
.
getSimpleName
());
for
(
GoblinNftGoodsSkuListJobVo
item
:
notStartSkuInfoVos
)
{
goblinRedisUtils
.
goblinNftListStock
(
now
,
item
.
getSkuId
());
goblinRedisUtils
.
goblinNftListStock
(
now
,
item
.
getSkuId
()
,
item
.
getSaleStartTime
()
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/manage/GoblinListServiceImpl.java
View file @
e33e076c
...
...
@@ -115,6 +115,10 @@ public class GoblinListServiceImpl implements IGoblinListService {
if
(
param
.
getItemParams
().
size
()
>
1
)
{
return
ResponseDto
.
failure
(
"只能配置一个sku"
);
}
//判断重名
if
(
mongoUtils
.
hasGoblinListDetailsVoByName
(
param
.
getName
())){
return
ResponseDto
.
failure
(
"活动名称重复"
);
}
String
skuId
=
param
.
getItemParams
().
get
(
0
).
getSkuId
();
GoblinGoodsSkuInfoVo
skuInfoVo
=
redisUtils
.
getGoodsSkuInfoVo
(
skuId
);
LocalDateTime
st
=
LocalDateTime
.
parse
(
param
.
getTimeStart
(),
DTF_YMD_HMS
);
...
...
@@ -175,9 +179,9 @@ public class GoblinListServiceImpl implements IGoblinListService {
vo
.
setCreatedAt
(
DateUtil
.
format
(
now
,
DateUtil
.
Formatter
.
yyyyMMddHHmmss
));
//判断 白名单类型
if
(
param
.
getWhiteType
().
equals
(
1
))
{
//需要xls文件
if
(
param
.
getWhiteUrl
()
==
null
||
param
.
getWhiteUrl
().
equals
(
""
))
{
return
ResponseDto
.
failure
(
"未上传指定用户文件"
);
}
//
if (param.getWhiteUrl() == null || param.getWhiteUrl().equals("")) {
//
return ResponseDto.failure("未上传指定用户文件");
//
}
vo
.
setWhiteUrl
(
param
.
getWhiteUrl
());
vo
.
setWhiteName
(
param
.
getWhiteName
());
}
else
{
//不需要xls文件
...
...
@@ -211,6 +215,9 @@ public class GoblinListServiceImpl implements IGoblinListService {
collectVo
.
setPriceV
(
itemVo
.
getPriceV
());
collectVo
.
setProductId
(
itemVo
.
getProductId
());
collectVo
.
setWhiteType
(
vo
.
getWhiteType
());
if
(
vo
.
getWhiteType
().
equals
(
1
)
&&
vo
.
getWhiteUrl
().
equals
(
""
)){
collectVo
.
setWhiteType
(-
1
);
}
collectVo
.
setTimeStart
(
st
);
collectVo
.
setTimeEnd
(
et
);
collectVo
.
setTagType
(
vo
.
getTagType
());
...
...
@@ -249,9 +256,9 @@ public class GoblinListServiceImpl implements IGoblinListService {
//判断 白名单类型
vo
.
setWhiteType
(
param
.
getWhiteType
());
if
(
param
.
getWhiteType
().
equals
(
1
))
{
//需要xls文件
if
(
param
.
getWhiteUrl
()
==
null
||
param
.
getWhiteUrl
().
equals
(
""
))
{
return
ResponseDto
.
failure
(
"未上传指定用户文件"
);
}
//
if (param.getWhiteUrl() == null || param.getWhiteUrl().equals("")) {
//
return ResponseDto.failure("未上传指定用户文件");
//
}
vo
.
setWhiteUrl
(
param
.
getWhiteUrl
());
vo
.
setWhiteName
(
param
.
getWhiteName
());
}
else
{
//不需要xls文件
...
...
@@ -270,6 +277,9 @@ public class GoblinListServiceImpl implements IGoblinListService {
for
(
GoblinListCollectVo
itemVo
:
collectVos
)
{
if
(
itemVo
.
getListId
().
equals
(
param
.
getListId
()))
{
itemVo
.
setWhiteType
(
vo
.
getWhiteType
());
if
(
vo
.
getWhiteType
().
equals
(
1
)
&&
vo
.
getWhiteUrl
().
equals
(
""
)){
itemVo
.
setWhiteType
(-
1
);
}
break
;
}
}
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/util/GoblinMongoUtils.java
View file @
e33e076c
...
...
@@ -62,14 +62,14 @@ public class GoblinMongoUtils {
HashMap
<
String
,
Object
>
info
=
CollectionUtil
.
mapStringObject
();
Pageable
pageable
=
PageRequest
.
of
(
goblinGoodsAnticipateValueParam
.
getPageNum
()
-
1
,
20
,
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"createdDate"
));
Criteria
criteria
=
Criteria
.
where
(
"delTag"
).
is
(
0
).
and
(
"uid"
).
is
(
uid
);
if
(
goblinGoodsAnticipateValueParam
.
getType
()
!=
null
)
{
if
(
goblinGoodsAnticipateValueParam
.
getType
()
==
1
)
{
if
(
goblinGoodsAnticipateValueParam
.
getType
()
!=
null
)
{
if
(
goblinGoodsAnticipateValueParam
.
getType
()
==
1
)
{
//预约提醒
criteria
=
criteria
.
and
(
"type"
).
is
(
goblinGoodsAnticipateValueParam
.
getType
());
}
else
if
(
goblinGoodsAnticipateValueParam
.
getType
()==
2
)
{
}
else
if
(
goblinGoodsAnticipateValueParam
.
getType
()
==
2
)
{
//预约购买
criteria
=
criteria
.
and
(
"type"
).
is
(
2
).
and
(
"peopleType"
).
is
(
0
);
}
else
if
(
goblinGoodsAnticipateValueParam
.
getType
()==
3
)
{
}
else
if
(
goblinGoodsAnticipateValueParam
.
getType
()
==
3
)
{
//预约助力
criteria
=
criteria
.
and
(
"type"
).
is
(
2
).
and
(
"peopleType"
).
gt
(
0
);
}
...
...
@@ -207,14 +207,14 @@ public class GoblinMongoUtils {
/**
* 存入用户创建分享 不需要mongodb存储
*/
public
void
setGoblinGoodsAnticipateShareVo
(
GoblinGoodsAnticipateShareVo
goblinGoodsAnticipateShareVo
){
mongoTemplate
.
insert
(
goblinGoodsAnticipateShareVo
,
GoblinGoodsAnticipateShareVo
.
class
.
getSimpleName
());
public
void
setGoblinGoodsAnticipateShareVo
(
GoblinGoodsAnticipateShareVo
goblinGoodsAnticipateShareVo
)
{
mongoTemplate
.
insert
(
goblinGoodsAnticipateShareVo
,
GoblinGoodsAnticipateShareVo
.
class
.
getSimpleName
());
}
/**
* 根据创建id查询分享信息
*/
public
GoblinGoodsAnticipateShareVo
getShareVoBySid
(
String
sid
){
public
GoblinGoodsAnticipateShareVo
getShareVoBySid
(
String
sid
)
{
return
mongoTemplate
.
findOne
(
Query
.
query
(
Criteria
.
where
(
"sid"
).
is
(
sid
)),
GoblinGoodsAnticipateShareVo
.
class
,
GoblinGoodsAnticipateShareVo
.
class
.
getSimpleName
());
}
...
...
@@ -222,17 +222,18 @@ public class GoblinMongoUtils {
/**
* 分享id和助力人id 查询助力信息 不存mongodb
*/
public
GoblinGoodsAnticipateHelpVo
getHelpVo
(
String
sid
,
String
uid
)
{
public
GoblinGoodsAnticipateHelpVo
getHelpVo
(
String
sid
,
String
uid
)
{
return
mongoTemplate
.
findOne
(
Query
.
query
(
Criteria
.
where
(
"sid"
).
is
(
sid
).
and
(
"helpUid"
).
is
(
uid
)),
GoblinGoodsAnticipateHelpVo
.
class
,
GoblinGoodsAnticipateHelpVo
.
class
.
getSimpleName
());
}
/**
* 助力vo 之后删去不需要储存
*
* @param goodsAnticipateHelpVo
*/
public
void
setHelpVo
(
GoblinGoodsAnticipateHelpVo
goodsAnticipateHelpVo
){
mongoTemplate
.
insert
(
goodsAnticipateHelpVo
,
GoblinGoodsAnticipateHelpVo
.
class
.
getSimpleName
());
public
void
setHelpVo
(
GoblinGoodsAnticipateHelpVo
goodsAnticipateHelpVo
)
{
mongoTemplate
.
insert
(
goodsAnticipateHelpVo
,
GoblinGoodsAnticipateHelpVo
.
class
.
getSimpleName
());
}
/* ---------------------------------------- 平台分类数据源 ---------------------------------------- */
...
...
@@ -1171,7 +1172,7 @@ public class GoblinMongoUtils {
if
(
spuName
!=
null
)
{
Query
q1
=
Query
.
query
(
Criteria
.
where
(
"name"
).
regex
(
".*"
+
spuName
+
".*"
));
q1
.
fields
().
include
(
"spuId"
);
List
<
String
>
spuIds
=
mongoTemplate
.
find
(
q1
,
GoblinGoodsInfoVo
.
class
,
GoblinGoodsInfoVo
.
class
.
getSimpleName
()).
stream
().
map
(
GoblinGoodsInfoVo:
:
getSpuId
).
collect
(
Collectors
.
toList
());
List
<
String
>
spuIds
=
mongoTemplate
.
find
(
q1
,
GoblinGoodsInfoVo
.
class
,
GoblinGoodsInfoVo
.
class
.
getSimpleName
()).
stream
().
map
(
GoblinGoodsInfoVo:
:
getSpuId
).
collect
(
Collectors
.
toList
());
criteriaCount
=
criteriaCount
.
and
(
"spuId"
).
in
(
spuIds
);
}
//查询总数量
...
...
@@ -1620,9 +1621,9 @@ public class GoblinMongoUtils {
criteria
.
and
(
"name"
).
regex
(
pattern
);
}
if
(
StringUtils
.
isNotBlank
(
filterParam
.
getShelvesStatus
()))
{
if
(
"4"
.
equals
(
filterParam
.
getShelvesStatus
())){
if
(
"4"
.
equals
(
filterParam
.
getShelvesStatus
()))
{
criteria
.
and
(
"shelvesStatus"
).
is
(
"3"
).
and
(
"saleStartTime"
).
gte
(
now
());
}
else
{
}
else
{
criteria
.
and
(
"shelvesStatus"
).
is
(
filterParam
.
getShelvesStatus
());
}
}
...
...
@@ -1650,10 +1651,10 @@ public class GoblinMongoUtils {
continue
;
}
GoblinGoodsSkuInfoVo
itemVo
=
redisUtils
.
getGoodsSkuInfoVo
(
skuIdItem
);
if
(
"4"
.
equals
(
filterParam
.
getShelvesStatus
()))
{
if
(
"4"
.
equals
(
filterParam
.
getShelvesStatus
()))
{
stock
+=
redisUtils
.
getSkuAllStatusStockStatus4
(
itemVo
);
}
else
{
stock
+=
redisUtils
.
getSkuAllStatusStock
(
itemVo
,
null
);
}
else
{
stock
+=
redisUtils
.
getSkuAllStatusStock
(
itemVo
,
null
);
}
}
mgtGoodsSkuListVo
.
setSurplusStock
(
stock
);
...
...
@@ -1697,6 +1698,12 @@ public class GoblinMongoUtils {
mongoTemplate
.
insert
(
vo
,
GoblinListDetailsVo
.
class
.
getSimpleName
());
}
public
Boolean
hasGoblinListDetailsVoByName
(
String
name
)
{
Criteria
criteria
=
Criteria
.
where
(
"name"
).
is
(
name
);
Query
query
=
Query
.
query
(
criteria
);
return
mongoTemplate
.
exists
(
query
,
GoblinListDetailsVo
.
class
,
GoblinListDetailsVo
.
class
.
getSimpleName
());
}
public
void
removeGoblinListDetailsVo
(
String
listId
)
{
mongoTemplate
.
remove
(
Query
.
query
(
Criteria
.
where
(
"listId"
).
is
(
listId
)),
GoblinListDetailsVo
.
class
.
getSimpleName
());
}
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/util/GoblinRedisUtils.java
View file @
e33e076c
...
...
@@ -811,16 +811,17 @@ public class GoblinRedisUtils {
GoblinGoodsSkuInfoVo
vo
=
getGoodsSkuInfoVo
(
skuId
);
HashMap
<
String
,
Object
>
map
=
CollectionUtil
.
mapStringObject
();
if
(
null
==
vo
.
getSaleStartTime
()
||
now
.
isAfter
(
vo
.
getSaleStartTime
()))
{
//普通商品已开售
lastStockToLastStock
(
0
,
getGoblinListCollect
(
skuId
),
null
,
skuId
);
map
.
put
(
"vo"
,
vo
);
map
.
put
(
"tagType"
,
null
);
map
.
put
(
"listId"
,
null
);
map
.
put
(
"whiteType"
,
null
);
map
.
put
(
"baseSaleStartTime"
,
vo
.
getSaleStartTime
());
}
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
());
...
...
@@ -833,11 +834,15 @@ public class GoblinRedisUtils {
GoblinListCollectVo
collectNext
=
getCollectByNowNext
(
now
,
skuId
);
if
(
collectNext
!=
null
)
{
tagType
=
collectNext
.
getTagType
();
//todo 逻辑修改 开售时间
vo
.
setSaleStartTime
(
collectNext
.
getTimeStart
());
vo
.
setSaleStopTime
(
collectNext
.
getTimeEnd
());
}
map
.
put
(
"vo"
,
vo
);
map
.
put
(
"tagType"
,
tagType
);
map
.
put
(
"listId"
,
listId
);
map
.
put
(
"whiteType"
,
whiteType
);
map
.
put
(
"baseSaleStartTime"
,
baseSaleStartTime
);
}
return
map
;
}
...
...
@@ -862,23 +867,13 @@ public class GoblinRedisUtils {
}
else
if
(
now
.
isAfter
(
collectVoItem
.
getTimeStart
())
&&
now
.
isBefore
(
collectVoItem
.
getTimeEnd
()))
{
collectVo
=
collectVoItem
;
break
;
}
else
if
(
collectVoItem
.
getTimeEnd
()
!=
null
&&
now
.
isAfter
(
collectVoItem
.
getTimeEnd
()))
{
}
else
if
(
collectVoItem
.
getTimeEnd
()
!=
null
&&
now
.
isAfter
(
collectVoItem
.
getTimeEnd
()))
{
collectTemp
=
null
;
}
}
if
(
collectVo
==
null
)
{
collectVo
=
collectTemp
;
}
if
(
collectVo
==
null
)
{
GoblinListCollectVo
collectNext
=
getCollectByNowNext
(
now
,
skuId
);
if
(
collectNext
==
null
)
{
lastStockToLastStock
(
0
,
collectVos
,
null
,
skuId
);
}
else
{
lastStockToLastStock
(
1
,
collectVos
,
collectNext
,
skuId
);
}
}
else
{
lastStockToLastStock
(
1
,
collectVos
,
collectVo
,
skuId
);
}
return
collectVo
;
}
...
...
@@ -889,10 +884,13 @@ public class GoblinRedisUtils {
* @param skuId
* @return
*/
public
GoblinListCollectVo
goblinNftListStock
(
LocalDateTime
now
,
String
skuId
)
{
public
void
goblinNftListStock
(
LocalDateTime
now
,
String
skuId
,
LocalDateTime
saleStartTime
)
{
GoblinListCollectVo
collectVo
=
null
;
GoblinListCollectVo
collectTemp
=
null
;
List
<
GoblinListCollectVo
>
collectVos
=
getGoblinListCollect
(
skuId
);
if
(
now
.
isAfter
(
saleStartTime
)){
lastStockToLastStock
(
0
,
collectVos
,
null
,
skuId
);
}
else
{
for
(
int
i
=
0
;
i
<
collectVos
.
size
();
i
++)
{
GoblinListCollectVo
collectVoItem
=
collectVos
.
get
(
i
);
if
(
now
.
isAfter
(
collectVoItem
.
getTimeStart
())
&&
collectVoItem
.
getTimeEnd
()
==
null
)
{
...
...
@@ -902,7 +900,7 @@ public class GoblinRedisUtils {
}
else
if
(
now
.
isAfter
(
collectVoItem
.
getTimeStart
())
&&
now
.
isBefore
(
collectVoItem
.
getTimeEnd
()))
{
collectVo
=
collectVoItem
;
break
;
}
else
if
(
collectVoItem
.
getTimeEnd
()
!=
null
&&
now
.
isAfter
(
collectVoItem
.
getTimeEnd
()))
{
}
else
if
(
collectVoItem
.
getTimeEnd
()
!=
null
&&
now
.
isAfter
(
collectVoItem
.
getTimeEnd
()))
{
collectTemp
=
null
;
}
}
...
...
@@ -919,7 +917,8 @@ public class GoblinRedisUtils {
}
else
{
lastStockToLastStock
(
1
,
collectVos
,
collectVo
,
skuId
);
}
return
collectVo
;
}
// return collectVo;
}
/**
...
...
@@ -946,7 +945,7 @@ public class GoblinRedisUtils {
if
(
collectNext
==
null
||
collectNext
.
getTimeStart
().
isAfter
(
collectNext
.
getTimeStart
()))
{
collectNext
=
collectVoItem
;
}
}
else
if
(
collectVoItem
.
getTimeEnd
()
!=
null
&&
now
.
isAfter
(
collectVoItem
.
getTimeEnd
()))
{
}
else
if
(
collectVoItem
.
getTimeEnd
()
!=
null
&&
now
.
isAfter
(
collectVoItem
.
getTimeEnd
()))
{
collectTemp
=
null
;
}
}
...
...
@@ -970,7 +969,7 @@ public class GoblinRedisUtils {
if
(
vo
==
null
&&
type
==
0
)
{
//已开售逻辑
for
(
GoblinListCollectVo
collectVoItem
:
collectVos
)
{
int
lastStock
=
getSkuStock
(
collectVoItem
.
getListId
(),
skuId
);
log
.
debug
(
"all stock = "
+
lastStock
);
log
.
debug
(
"all stock = "
+
lastStock
);
int
restStock
=
decrSkuStock
(
collectVoItem
.
getListId
(),
skuId
,
lastStock
);
if
(
restStock
<
0
)
{
incrSkuStock
(
collectVoItem
.
getListId
(),
skuId
,
lastStock
);
...
...
@@ -1015,7 +1014,7 @@ public class GoblinRedisUtils {
for
(
GoblinListCollectVo
itemVo
:
collectVosList
)
{
//减少上个时间段sku库存
int
lastStock
=
getSkuStock
(
itemVo
.
getListId
(),
skuId
);
log
.
debug
(
"temp stock = "
+
lastStock
);
log
.
debug
(
"temp stock = "
+
lastStock
);
int
restStock
=
decrSkuStock
(
itemVo
.
getListId
(),
skuId
,
lastStock
);
if
(
restStock
<
0
)
{
//库存超过销售量 操作失败回滚库存
...
...
@@ -1047,7 +1046,9 @@ public class GoblinRedisUtils {
if
(
bResult
)
{
return
false
;
}
if
(
whiteType
==
0
)
{
//会员
if
(
whiteType
==
-
1
)
{
return
true
;
}
else
if
(
whiteType
==
0
)
{
//会员
return
memberStage
!=
null
;
}
else
{
//白名单
return
wResult
;
...
...
@@ -2002,6 +2003,7 @@ public class GoblinRedisUtils {
String
redisKey
=
GoblinRedisConst
.
REDIS_GOBLIN_NFT_GOODS_LIST_INFO
.
concat
(
skuId
);
redisUtil
.
set
(
redisKey
,
data
);
}
public
GoblinNftGoodsSkuListVo
getGoblinNftGoodsListInfoVo
(
String
skuId
)
{
String
redisKey
=
GoblinRedisConst
.
REDIS_GOBLIN_NFT_GOODS_LIST_INFO
.
concat
(
skuId
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
...
...
@@ -2036,6 +2038,7 @@ public class GoblinRedisUtils {
return
(
GoblinUserNftAccInfoVo
)
obj
;
}
}
public
void
setOpenAccountInfo
(
String
userId
,
GoblinUserNftAccInfoVo
nftAccInfoVo
)
{
String
redisKey
=
GoblinRedisConst
.
REDIS_GOBLIN_NFT_NUM_ACCOUNT_INFO
.
concat
(
userId
);
redisUtil
.
set
(
redisKey
,
nftAccInfoVo
);
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/resources/errors.properties
View file @
e33e076c
...
...
@@ -84,3 +84,4 @@
150005
=
SKU
\u
4E0D
\u
5B58
\u5728
150006
=
\u9884\u
7EA6
\u
672A
\u
5F00
\u
59CB
\u6216\u
5DF2
\u
7ED3
\u
675F
150007
=
\u
8BE5
\u5546\u
54C1
\u9884\u
7EA6
\u
5C1A
\u
672A
\u
5F00
\u
59CB
\u6216\u
5DF2
\u
7ECF
\u
7ED3
\u
675F
\u
FF0C
\u
4E0D
\u
53EF
\u9884\u
7EA6
150008
=
\u
52A9
\u7406\u5931\u
8D25
\u
FF0C
\u
8BF7
\u
91CD
\u
8BD5
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/service/impl/GoblinNftOrderServiceImpl.java
View file @
e33e076c
...
...
@@ -74,11 +74,6 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
return
ResponseDto
.
failure
(
"您还未开通数字账户~"
);
}
// 若开启了预约 判断用户是否预约
boolean
userAboutAut
=
nftOrderUtils
.
getUserAboutAut
(
payParam
.
getSkuId
(),
uid
);
if
(!
userAboutAut
)
{
return
ResponseDto
.
failure
(
"此数字藏品仅限预约用户购买~"
);
}
// 基础参数
String
mobile
=
StringUtils
.
defaultString
(((
String
)
CurrentUtil
.
getTokenClaims
().
get
(
CurrentUtil
.
TOKEN_MOBILE
)),
""
);
...
...
@@ -91,8 +86,16 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
String
listId
=
(
String
)
map
.
get
(
"listId"
);
Integer
whiteType
=
(
Integer
)
map
.
get
(
"whiteType"
);
// 若没有分批购 若开启了预约 判断用户是否预约
if
(
null
==
listId
)
{
boolean
userAboutAut
=
nftOrderUtils
.
getUserAboutAut
(
payParam
.
getSkuId
(),
uid
);
if
(!
userAboutAut
)
{
return
ResponseDto
.
failure
(
"此数字藏品仅限预约用户购买~"
);
}
}
// 分批、提前购黑、白名单
if
(
null
!=
tagType
)
{
if
(
null
!=
listId
)
{
Boolean
listCanBuy
=
goblinRedisUtils
.
getListCanBuy
(
listId
,
skuId
,
mobile
,
uid
,
whiteType
);
if
(!
listCanBuy
)
{
return
ResponseDto
.
failure
(
"该藏品仅对部分用户开放~"
);
...
...
@@ -157,11 +160,11 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
return
ResponseDto
.
failure
(
"该商品SPU不存在~"
);
}
else
{
HashMap
<
String
,
Object
>
lotteryDrawMap
=
lotteryDraw
(
skuIdList
,
number
,
nowTime
);
GoblinGoodsSkuInfoVo
skuInfoVo
=
(
GoblinGoodsSkuInfoVo
)
lotteryDrawMap
.
get
(
"goodsSkuInfoVo"
);
if
(
null
==
skuInfoVo
)
{
if
(
null
==
lotteryDrawMap
)
{
goblinRedisUtils
.
decrSkuCountByUid
(
uid
,
skuId
,
number
);
return
ResponseDto
.
failure
(
"盲盒库存不足啦~"
);
}
GoblinGoodsSkuInfoVo
skuInfoVo
=
(
GoblinGoodsSkuInfoVo
)
lotteryDrawMap
.
get
(
"goodsSkuInfoVo"
);
boxSkuId
=
skuInfoVo
.
getSkuId
();
stockSkuId
=
boxSkuId
;
listId
=
(
String
)
lotteryDrawMap
.
get
(
"listId"
);
...
...
@@ -344,7 +347,7 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
GoblinNftOrderPayParam
payParam
,
String
storeId
,
String
uid
,
String
spuId
,
int
number
,
String
orderId
,
String
orderCode
,
BigDecimal
totalPrice
,
BigDecimal
voucherPrice
,
BigDecimal
storeVoucherPrice
,
String
boxSkuId
,
String
skuTitle
,
int
orderType
,
int
orderType
)
{
try
{
LocalDateTime
now
=
LocalDateTime
.
now
();
...
...
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/utils/GoblinNftOrderUtils.java
View file @
e33e076c
...
...
@@ -9,6 +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.manage.vo.GoblinGoodsAnticipateValueVo
;
import
com.liquidnet.service.goblin.dto.vo.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -179,11 +180,13 @@ public class GoblinNftOrderUtils {
// skuId 是否开启预约
public
boolean
getValueBySkuId
(
String
skuId
)
{
String
redisKey
=
GoblinRedisConst
.
ANTICIPATE_VALUE_SKUID
.
concat
(
skuId
);
Object
obj
=
redisUtil
.
get
(
redisKey
);
if
(
obj
==
null
)
{
return
false
;
}
else
{
return
true
;
GoblinGoodsAnticipateValueVo
anticipateValueVo
=
(
GoblinGoodsAnticipateValueVo
)
obj
;
return
anticipateValueVo
.
getType
()
!=
1
;
}
}
// 是否预约过 没开启true
...
...
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/utils/GoblinRedisUtils.java
View file @
e33e076c
...
...
@@ -180,7 +180,6 @@ public class GoblinRedisUtils {
GoblinGoodsSkuInfoVo
vo
=
getGoodsSkuInfoVo
(
skuId
);
HashMap
<
String
,
Object
>
map
=
CollectionUtil
.
mapStringObject
();
if
(
now
.
isAfter
(
vo
.
getSaleStartTime
()))
{
//普通商品已开售
lastStockToLastStock
(
0
,
getGoblinListCollect
(
skuId
),
null
,
skuId
);
map
.
put
(
"vo"
,
vo
);
map
.
put
(
"tagType"
,
null
);
map
.
put
(
"listId"
,
null
);
...
...
@@ -203,6 +202,9 @@ public class GoblinRedisUtils {
GoblinListCollectVo
collectNext
=
getCollectByNowNext
(
now
,
skuId
);
if
(
collectNext
!=
null
)
{
tagType
=
collectNext
.
getTagType
();
//todo 逻辑修改 开售时间
vo
.
setSaleStartTime
(
collectNext
.
getTimeStart
());
vo
.
setSaleStopTime
(
collectNext
.
getTimeEnd
());
}
map
.
put
(
"vo"
,
vo
);
map
.
put
(
"tagType"
,
tagType
);
...
...
@@ -239,7 +241,6 @@ public class GoblinRedisUtils {
if
(
collectVo
==
null
)
{
collectVo
=
collectTemp
;
}
lastStockToLastStock
(
1
,
collectVos
,
collectVo
,
skuId
);
return
collectVo
;
}
...
...
@@ -279,75 +280,6 @@ public class GoblinRedisUtils {
return
collectVo
;
}
/**
* 处理上个时间段的库存
*
* @param type 类型[0-开售|1-未开售]
* @param collectVos
* @param vo
* @param skuId
*/
public
void
lastStockToLastStock
(
Integer
type
,
List
<
GoblinListCollectVo
>
collectVos
,
GoblinListCollectVo
vo
,
String
skuId
)
{
if
(
vo
==
null
&&
type
==
0
)
{
//已开售逻辑
for
(
GoblinListCollectVo
collectVoItem
:
collectVos
)
{
int
lastStock
=
getSkuStock
(
collectVoItem
.
getListId
(),
skuId
);
int
restStock
=
decrSkuStock
(
collectVoItem
.
getListId
(),
skuId
,
lastStock
);
if
(
restStock
<
0
)
{
incrSkuStock
(
collectVoItem
.
getListId
(),
skuId
,
lastStock
);
}
else
{
incrSkuStock
(
null
,
skuId
,
lastStock
);
}
}
}
else
if
(
vo
!=
null
&&
type
==
1
)
{
LocalDateTime
st
=
vo
.
getTimeStart
();
// GoblinListCollectVo collectVo = null;
// GoblinListCollectVo collectTemp = null;
//获取上个分配购的vo
List
<
GoblinListCollectVo
>
collectVosList
=
ObjectUtil
.
getGoblinListCollectVo
();
for
(
GoblinListCollectVo
collectVoItem
:
collectVos
)
{
if
(
st
.
isAfter
(
collectVoItem
.
getTimeStart
())
&&
collectVoItem
.
getTimeEnd
()
==
null
)
{
// collectTemp = collectVoItem;
collectVosList
.
add
(
collectVoItem
);
}
else
if
(
collectVoItem
.
getTimeEnd
()
!=
null
&&
st
.
isAfter
(
collectVoItem
.
getTimeEnd
()))
{
// collectVo = collectVoItem;
collectVosList
.
add
(
collectVoItem
);
}
else
if
(
st
.
isAfter
(
collectVoItem
.
getTimeStart
())
&&
st
.
isBefore
(
collectVoItem
.
getTimeEnd
()))
{
// collectVo = collectVoItem;
collectVosList
.
add
(
collectVoItem
);
break
;
}
}
// if (collectVo == null) {
// collectVo = collectTemp;
// }
// if (collectVo != null) {
// //减少上个时间段sku库存
// int lastStock = getSkuStock(collectVo.getListId(), skuId);
// int restStock = decrSkuStock(collectVo.getListId(), skuId, lastStock);
// if (restStock < 0) {
// //库存超过销售量 操作失败回滚库存
// incrSkuStock(collectVo.getListId(), skuId, lastStock);
// } else {
// //上个时间段的库存增加到当前时间段
// incrSkuStock(vo.getListId(), skuId, lastStock);
// }
// }
for
(
GoblinListCollectVo
itemVo
:
collectVosList
){
//减少上个时间段sku库存
int
lastStock
=
getSkuStock
(
itemVo
.
getListId
(),
skuId
);
int
restStock
=
decrSkuStock
(
itemVo
.
getListId
(),
skuId
,
lastStock
);
if
(
restStock
<
0
)
{
//库存超过销售量 操作失败回滚库存
incrSkuStock
(
itemVo
.
getListId
(),
skuId
,
lastStock
);
}
else
{
//上个时间段的库存增加到当前时间段
incrSkuStock
(
vo
.
getListId
(),
skuId
,
lastStock
);
}
}
}
}
/**
* 分段购获取
*
...
...
@@ -384,7 +316,9 @@ public class GoblinRedisUtils {
if
(
bResult
)
{
return
false
;
}
if
(
whiteType
==
0
)
{
//会员
if
(
whiteType
==
-
1
)
{
return
true
;
}
else
if
(
whiteType
==
0
)
{
//会员
return
memberStage
!=
null
;
}
else
{
//白名单
return
wResult
;
...
...
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/service/impl/goblin/GoblinNftExSkuServiceImpl.java
View file @
e33e076c
package
com
.
liquidnet
.
service
.
platform
.
service
.
impl
.
goblin
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
import
com.liquidnet.commons.lang.util.IDGenerator
;
import
com.liquidnet.commons.lang.util.StringUtil
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinNftExCodeVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinNftExSkuVo
;
import
com.liquidnet.service.goblin.entity.*
;
import
com.liquidnet.service.goblin.mapper.*
;
import
com.liquidnet.service.goblin.entity.GoblinGoodsSku
;
import
com.liquidnet.service.goblin.entity.GoblinNftExCodeTask
;
import
com.liquidnet.service.goblin.entity.GoblinNftExCodeTaskRelation
;
import
com.liquidnet.service.goblin.mapper.GoblinGoodsSkuMapper
;
import
com.liquidnet.service.goblin.mapper.GoblinNftExCodeTaskMapper
;
import
com.liquidnet.service.goblin.mapper.GoblinNftExCodeTaskRelationMapper
;
import
com.liquidnet.service.goblin.param.GoblinNftExSkuParam
;
import
com.liquidnet.service.goblin.service.IGoblinNftExSkuService
;
import
com.liquidnet.service.platform.utils.GoblinRedisUtils
;
import
com.liquidnet.service.platform.utils.ObjectUtil
;
import
com.microsoft.schemas.office.visio.x2012.main.ShapeSheetType
;
import
io.swagger.models.auth.In
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.time.Duration
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @Author: wll
...
...
@@ -124,7 +121,7 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
}
//是否购买
if
(!
goblinGoodsSku
.
getSkuCanbuy
().
equals
(
"1"
)){
if
(!
goblinGoodsSku
.
getSkuCanbuy
().
equals
(
"1"
))
{
continue
;
}
// 不能购买的 没库存的 概率是0的 过滤
...
...
@@ -135,7 +132,7 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
}
}
if
(
checkNumberSku
<=
0
){
if
(
checkNumberSku
<=
0
)
{
return
ResponseDto
.
failure
(
"盲盒下没有可生成兑换码的sku!"
);
}
...
...
@@ -149,7 +146,6 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
List
<
GoblinNftExCodeTask
>
goblinNftExCodeTasks
=
ObjectUtil
.
getGoblinNftExCodeTaskArrayList
();
// 构建对象
for
(
GoblinNftExSkuParam
goblinNftExSkuParam
:
goblinNftExSkuParams
)
{
...
...
@@ -182,6 +178,10 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
Integer
sNumber
=
0
;
for
(
String
key
:
skuMap
.
keySet
())
{
Integer
stockNum
=
skuMap
.
get
(
key
);
log
.
debug
(
"skuId:"
+
key
+
"库存:"
+
stockNum
);
if
(
stockNum
<=
0
)
{
continue
;
}
// 根据sku减库存
int
stock
=
goblinRedisUtils
.
decrSkuStock
(
null
,
key
,
stockNum
);
if
(
stock
<
0
)
{
...
...
@@ -284,28 +284,44 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
Map
<
String
,
Map
<
String
,
Object
>>
mapMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<>();
objectMap
.
put
(
"hitRatio"
,
2
0
);
objectMap
.
put
(
"stock"
,
10
00
);
objectMap
.
put
(
"hitRatio"
,
3
0
);
objectMap
.
put
(
"stock"
,
9
00
);
mapMap
.
put
(
"1"
,
objectMap
);
Map
<
String
,
Object
>
objectMap1
=
new
HashMap
<>();
objectMap1
.
put
(
"hitRatio"
,
30
);
objectMap1
.
put
(
"stock"
,
4
);
//
mapMap.put("2", objectMap1);
objectMap1
.
put
(
"hitRatio"
,
0.3
);
objectMap1
.
put
(
"stock"
,
9
);
mapMap
.
put
(
"2"
,
objectMap1
);
Map
<
String
,
Object
>
objectMap2
=
new
HashMap
<>();
objectMap2
.
put
(
"hitRatio"
,
30
);
objectMap2
.
put
(
"stock"
,
1000
);
//
mapMap.put("3", objectMap2);
objectMap2
.
put
(
"hitRatio"
,
23.3
);
objectMap2
.
put
(
"stock"
,
697
);
mapMap
.
put
(
"3"
,
objectMap2
);
Map
<
String
,
Object
>
objectMap3
=
new
HashMap
<>();
objectMap3
.
put
(
"hitRatio"
,
10
);
objectMap3
.
put
(
"stock"
,
1000
);
// mapMap.put("4", objectMap3);
objectMap3
.
put
(
"hitRatio"
,
2.2
);
objectMap3
.
put
(
"stock"
,
66
);
mapMap
.
put
(
"4"
,
objectMap3
);
Map
<
String
,
Object
>
objectMap4
=
new
HashMap
<>();
objectMap4
.
put
(
"hitRatio"
,
26.7
);
objectMap4
.
put
(
"stock"
,
797
);
mapMap
.
put
(
"5"
,
objectMap4
);
Map
<
String
,
Object
>
objectMap5
=
new
HashMap
<>();
objectMap5
.
put
(
"hitRatio"
,
2.2
);
objectMap5
.
put
(
"stock"
,
66
);
mapMap
.
put
(
"6"
,
objectMap5
);
Map
<
String
,
Object
>
objectMap6
=
new
HashMap
<>();
objectMap6
.
put
(
"hitRatio"
,
15.3
);
objectMap6
.
put
(
"stock"
,
458
);
mapMap
.
put
(
"7"
,
objectMap6
);
Map
<
String
,
Integer
>
stockMap
=
new
HashMap
<>();
ArrayList
<
String
>
eliminateSkuIdList
=
CollectionUtil
.
arrayListString
();
getStock
(
7
,
new
BigDecimal
(
20
),
mapMap
,
stockMap
,
1032
,
eliminateSkuIdList
);
getStock
(
594
,
new
BigDecimal
(
100
),
mapMap
,
stockMap
,
2993
,
eliminateSkuIdList
);
for
(
String
key
:
stockMap
.
keySet
())
{
System
.
out
.
println
(
"skuId"
+
key
+
"***********数量"
+
stockMap
.
get
(
key
));
}
...
...
@@ -369,8 +385,9 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
for
(
int
k
=
0
;
k
<
usNumber
;
k
++)
{
String
subKey
=
""
;
double
maxValue
=
Double
.
MAX_VALUE
;
for
(
String
key
:
bigDecimalHashMap
.
keySet
())
{
if
(
skuIdList
.
contains
(
key
))
{
if
(
skuIdList
.
contains
(
key
)
||
stockMap
.
get
(
key
)
==
0
)
{
continue
;
}
Double
compare
=
Double
.
valueOf
(
bigDecimalHashMap
.
get
(
key
).
toString
());
...
...
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