记得上下班打卡 | 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
cb595393
Commit
cb595393
authored
May 30, 2022
by
张禹
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pre' into 'master'
Pre See merge request
!245
parents
8d5049a1
e82653ff
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
169 additions
and
33 deletions
+169
-33
ZxlnftSdkServiceImpl.java
...ommon/third/zxlnft/service/impl/ZxlnftSdkServiceImpl.java
+3
-7
ZxlnftSdkUtil.java
...com/liquidnet/common/third/zxlnft/util/ZxlnftSdkUtil.java
+5
-0
GoblinNftExCodeMapper.java
...iquidnet/service/goblin/mapper/GoblinNftExCodeMapper.java
+8
-0
GoblinNftExCodeMapper.xml
...liquidnet.service.goblin.mapper/GoblinNftExCodeMapper.xml
+52
-0
ZxinUserCommonBiz.java
...net/service/galaxy/router/zxin/biz/ZxinUserCommonBiz.java
+15
-6
GoblinNftExCodeServiceImpl.java
...tform/service/impl/goblin/GoblinNftExCodeServiceImpl.java
+1
-1
GoblinNftExSkuServiceImpl.java
...atform/service/impl/goblin/GoblinNftExSkuServiceImpl.java
+85
-19
No files found.
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/service/impl/ZxlnftSdkServiceImpl.java
View file @
cb595393
...
...
@@ -116,9 +116,9 @@ public class ZxlnftSdkServiceImpl implements ZxlnftSdkService
}
log
.
info
(
"nft003RegisterPersonPlatform--->>> response : {} "
,
response
);
if
(
StringUtils
.
isEmpty
(
response
))
{
return
null
;
}
//
if (StringUtils.isEmpty(response)) {
//
return null;
//
}
/**
* 构造返回结果
...
...
@@ -488,10 +488,6 @@ public class ZxlnftSdkServiceImpl implements ZxlnftSdkService
}
log
.
info
(
"nft014IdentityBindSubmitByTrusted--->>> response : {} "
,
response
);
if
(
StringUtils
.
isEmpty
(
response
))
{
return
null
;
}
/**
* 构造返回结果
*/
...
...
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/util/ZxlnftSdkUtil.java
View file @
cb595393
...
...
@@ -2,6 +2,7 @@ package com.liquidnet.common.third.zxlnft.util;
import
com.liquidnet.common.third.zxlnft.biz.ZxlnftBiz
;
import
com.liquidnet.common.third.zxlnft.config.ZxlnftConfig
;
import
com.liquidnet.common.third.zxlnft.constant.ZxlErrorEnum
;
import
com.liquidnet.common.third.zxlnft.dto.*
;
import
com.liquidnet.common.third.zxlnft.dto.nft.*
;
import
com.liquidnet.common.third.zxlnft.exception.ZxlNftException
;
...
...
@@ -90,6 +91,8 @@ public class ZxlnftSdkUtil {
BeanUtil
.
copy
(
resp
,
respDto
);
}
catch
(
ZxlNftException
e
){
return
ZxlnftResponseDto
.
failure
(
e
.
getCode
()+
","
+
e
.
getMessage
());
}
catch
(
Exception
e
){
return
ZxlnftResponseDto
.
failure
(
ZxlErrorEnum
.
SERVER_INNER_ERROR
.
getCode
(),
ZxlErrorEnum
.
SERVER_INNER_ERROR
.
getMsg
());
}
return
ZxlnftResponseDto
.
success
(
respDto
);
}
...
...
@@ -316,6 +319,8 @@ public class ZxlnftSdkUtil {
BeanUtil
.
copy
(
resp
,
respDto
);
}
catch
(
ZxlNftException
e
){
return
ZxlnftResponseDto
.
failure
(
e
.
getCode
()+
","
+
e
.
getMessage
());
}
catch
(
Exception
e
){
return
ZxlnftResponseDto
.
failure
(
ZxlErrorEnum
.
SERVER_INNER_ERROR
.
getCode
(),
ZxlErrorEnum
.
SERVER_INNER_ERROR
.
getMsg
());
}
return
ZxlnftResponseDto
.
success
(
respDto
);
}
...
...
liquidnet-bus-do/liquidnet-service-goblin-do/src/main/java/com/liquidnet/service/goblin/mapper/GoblinNftExCodeMapper.java
View file @
cb595393
...
...
@@ -94,4 +94,12 @@ public interface GoblinNftExCodeMapper extends BaseMapper<GoblinNftExCode> {
* @return
*/
int
updateCodeAdminUids
(
@Param
(
"codes"
)
String
codes
,
@Param
(
"adminUid"
)
String
adminUid
);
/**
* excel导出打乱兑换码顺序
* @param goblinNftExCode
* @return
*/
List
<
GoblinNftExCode
>
selectGoblinNftCodeExcel
(
GoblinNftExCode
goblinNftExCode
);
}
liquidnet-bus-do/liquidnet-service-goblin-do/src/main/resources/com.liquidnet.service.goblin.mapper/GoblinNftExCodeMapper.xml
View file @
cb595393
...
...
@@ -129,6 +129,58 @@
</select>
<select
id=
"selectGoblinNftCodeExcel"
parameterType=
"com.liquidnet.service.goblin.entity.GoblinNftExCode"
resultMap=
"BeseResult"
>
select
DISTINCT
gnec.code,gnec.code_id,gnec.sku_id,gnec.box_sku_id,gnec.activity_id,gnec.state,gnec.redeem_uid,gnec.redeem_at,gnec.admin_uid,gnec.created_at
from goblin_nft_ex_code gnec inner join goblin_nft_ex_sku gnes on gnec.sku_id = gnes.sku_id and gnes.activity_id
= gnec.activity_id
<where>
<if
test=
"code != null and code != ''"
>
and gnec.code = #{code,jdbcType=VARCHAR}
</if>
<if
test=
"activityId != null and activityId != ''"
>
and gnec.activity_id = #{activityId,jdbcType=VARCHAR}
</if>
<if
test=
"state != null"
>
<choose>
<when
test=
"state == 1"
>
and (now() BETWEEN gnes.ex_start_time and gnes.ex_stop_time) and
gnec.state =1
</when>
<when
test=
"state == 2"
>
and gnec.state = 2
</when>
<when
test=
"state == 3"
>
and (((now()
>
gnes.ex_stop_time) AND gnec.state = 1) ||
gnec.state = 3)
</when>
</choose>
</if>
<if
test=
"redeemUid != null and redeemUid != ''"
>
and gnec.redeem_uid = #{redeemUid,jdbcType=VARCHAR}
</if>
<if
test=
"skuId != null and skuId != ''"
>
and gnec.sku_id in
<foreach
collection=
"skuId.split(',')"
item=
"sId"
open=
"("
separator=
","
close=
")"
>
#{sId,jdbcType=VARCHAR}
</foreach>
</if>
<if
test=
"isDrivi != null"
>
<choose>
<when
test=
"isDrivi == 1"
>
and gnec.admin_uid = ''
</when>
<when
test=
"isDrivi == 2"
>
and gnec.admin_uid != ''
</when>
</choose>
</if>
</where>
ORDER BY gnec.code desc
</select>
<select
id=
"selectCodeAvailableByActivityId"
resultMap=
"BeseResult"
>
select DISTINCT gnec.code,
gnec.code_id,
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-common/src/main/java/com/liquidnet/service/galaxy/router/zxin/biz/ZxinUserCommonBiz.java
View file @
cb595393
...
...
@@ -172,7 +172,11 @@ public class ZxinUserCommonBiz {
userIdentification
=
nft003Resp
.
getData
().
getUserIdentification
();
isRealNameAuthSuccess
=
true
;
}
else
{
throw
new
GalaxyNftUserException
(
nft003Resp
.
getCode
(),
nft003Resp
.
getMessage
());
if
(
nft003Resp
.
getCode
().
equals
(
ZxlErrorEnum
.
SERVER_INNER_ERROR
.
getCode
())){
throw
new
ZxlNftException
(
nft003Resp
.
getCode
(),
nft003Resp
.
getMessage
());
}
else
{
throw
new
GalaxyNftUserException
(
nft003Resp
.
getCode
(),
nft003Resp
.
getMessage
());
}
}
//如果实名认证成功,并且该身份证已经开通过数字账户
...
...
@@ -291,8 +295,8 @@ public class ZxinUserCommonBiz {
//是否开通数字账户
boolean
isOpenAccount
=
false
;
//开通失败错误信息
String
resultCode
=
null
;
String
resultMessage
=
null
;
String
resultCode
=
NftAccStatusEnum
.
StatusAcc
.
ING
.
getCode
()
;
String
resultMessage
=
NftAccStatusEnum
.
StatusAcc
.
ING
.
getMsg
()
;
//实名成功+绑定区块链地址成功
if
(
isRealNameAuthSuccess
&&
isBindBlockAddressSuccess
){
...
...
@@ -305,8 +309,13 @@ public class ZxinUserCommonBiz {
if
(!
isOpenAccount
){
//实名失败
if
(!
isRealNameAuthSuccess
){
resultCode
=
NftAccStatusEnum
.
StatusAcc
.
FAILURE1
.
getCode
();
resultMessage
=
NftAccStatusEnum
.
StatusAcc
.
FAILURE1
.
getMsg
();
if
(
StringUtil
.
isNotEmpty
(
bizFailDesc
)){
resultCode
=
NftAccStatusEnum
.
StatusAcc
.
FAILURE1
.
getCode
();
resultMessage
=
NftAccStatusEnum
.
StatusAcc
.
FAILURE1
.
getMsg
();
}
else
if
(
StringUtil
.
isNotEmpty
(
sysFailDesc
)){
resultCode
=
NftAccStatusEnum
.
StatusAcc
.
FAILURE2
.
getCode
();
resultMessage
=
NftAccStatusEnum
.
StatusAcc
.
FAILURE2
.
getMsg
();
}
}
else
{
//地址绑定失败
if
(!
isBindBlockAddressSuccess
){
...
...
@@ -350,7 +359,7 @@ public class ZxinUserCommonBiz {
}
//设置错误信息到redis
if
(
StringUtil
.
isNotEmpty
(
resultCode
)&&
!
resultCode
.
equalsIgnoreCase
(
NftAccStatusEnum
.
StatusAcc
.
SUCCESS
.
getCode
())){
if
(
StringUtil
.
isNotEmpty
(
resultCode
)&&
resultCode
.
equalsIgnoreCase
(
NftAccStatusEnum
.
StatusAcc
.
FAILURE1
.
getCode
())){
//开户失败记录缓存 {goblin:nft:certmeta:{idType+idNo},{idname,mobile}}
dataUtils
.
getRedisUtil
().
set
(
GoblinRedisConst
.
REDIS_GOBLIN_NFT_CERTMETA_JUNK
.
concat
(
reqDto
.
getIdCardType
().
concat
(
reqDto
.
getIdCard
()))
,
reqDto
.
getUserName
().
concat
(
","
).
concat
(
reqDto
.
getMobile
()),
openAccFailKeyExpireTime
);
...
...
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/service/impl/goblin/GoblinNftExCodeServiceImpl.java
View file @
cb595393
...
...
@@ -284,7 +284,7 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService {
// PageHelper.startPage(goblinNftExCodeParam.getPageNum(), 20, true);
List
<
GoblinNftExCode
>
goblinNftExCodes
=
goblinNftExCodeMapper
.
selectGoblinNftCode
(
goblinNftExCode
);
List
<
GoblinNftExCode
>
goblinNftExCodes
=
goblinNftExCodeMapper
.
selectGoblinNftCode
Excel
(
goblinNftExCode
);
StringBuffer
skuIds
=
new
StringBuffer
();
StringBuffer
acticityIds
=
new
StringBuffer
();
...
...
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/service/impl/goblin/GoblinNftExSkuServiceImpl.java
View file @
cb595393
...
...
@@ -106,10 +106,18 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
List
<
GoblinGoodsSku
>
goblinGoodsSkus
=
goblinGoodsSkuMapper
.
selectBySpuIds
(
spuIds
.
toString
());
int
countStockNumber
=
0
;
int
checkNumberSku
=
0
;
// 是否存在概率为空
boolean
isHit
=
false
;
// 概率相加
BigDecimal
hitRatioCount
=
new
BigDecimal
(
0
);
for
(
GoblinGoodsSku
goblinGoodsSku
:
goblinGoodsSkus
)
{
if
(
goblinGoodsSku
.
getUnbox
().
equals
(
"1"
))
{
continue
;
}
// 判断开售、停售时间
LocalDateTime
saleStartTime
=
goblinGoodsSku
.
getSaleStartTime
();
LocalDateTime
saleStopTime
=
goblinGoodsSku
.
getSaleStopTime
();
...
...
@@ -124,8 +132,15 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
if
(!
goblinGoodsSku
.
getSkuCanbuy
().
equals
(
"1"
))
{
continue
;
}
// 不能购买的 没库存的 概率是0的 过滤
if
(
getSkuAllStatusShow
(
goblinGoodsSku
)
&&
goblinRedisUtils
.
getSkuAllStatusStock
(
goblinGoodsSku
)
>
0
&&
goblinGoodsSku
.
getHitRatio
()
!=
null
)
{
if
(
getSkuAllStatusShow
(
goblinGoodsSku
)
&&
goblinRedisUtils
.
getSkuAllStatusStock
(
goblinGoodsSku
)
>
0
)
{
log
.
debug
(
"skuId:"
+
goblinGoodsSku
.
getSkuId
()+
"----hitRatio:"
+
goblinGoodsSku
.
getHitRatio
());
if
(
goblinGoodsSku
.
getHitRatio
()
==
null
)
{
isHit
=
true
;
}
else
{
hitRatioCount
=
hitRatioCount
.
add
(
goblinGoodsSku
.
getHitRatio
());
}
countStockNumber
+=
goblinRedisUtils
.
getSkuStock
(
goblinGoodsSku
.
getSkuId
());
map
.
put
(
goblinGoodsSku
.
getSkuId
(),
goblinGoodsSku
.
getHitRatio
());
checkNumberSku
++;
...
...
@@ -140,6 +155,12 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
ResponseDto
.
failure
(
"配置库存大于sku总库存!"
);
}
if
(
isHit
&&
hitRatioCount
.
doubleValue
()
<
100.00
&&
map
.
size
()
>
0
)
{
arrangeHitRatioMap
(
map
,
hitRatioCount
);
}
}
...
...
@@ -220,6 +241,7 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
return
ResponseDto
.
success
(
true
);
}
/**
* 获取每个sku的兑换码生成数量
* <p>
...
...
@@ -284,50 +306,94 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
Map
<
String
,
Map
<
String
,
Object
>>
mapMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<>();
objectMap
.
put
(
"hitRatio"
,
3
0
);
objectMap
.
put
(
"stock"
,
9
00
);
objectMap
.
put
(
"hitRatio"
,
3
.33
);
objectMap
.
put
(
"stock"
,
1
00
);
mapMap
.
put
(
"1"
,
objectMap
);
Map
<
String
,
Object
>
objectMap1
=
new
HashMap
<>();
objectMap1
.
put
(
"hitRatio"
,
0.3
);
objectMap1
.
put
(
"stock"
,
9
);
objectMap1
.
put
(
"hitRatio"
,
57.7
);
objectMap1
.
put
(
"stock"
,
20
);
mapMap
.
put
(
"2"
,
objectMap1
);
Map
<
String
,
Object
>
objectMap2
=
new
HashMap
<>();
objectMap2
.
put
(
"hitRatio"
,
23.3
);
objectMap2
.
put
(
"stock"
,
697
);
objectMap2
.
put
(
"hitRatio"
,
9
);
objectMap2
.
put
(
"stock"
,
30
);
mapMap
.
put
(
"3"
,
objectMap2
);
Map
<
String
,
Object
>
objectMap3
=
new
HashMap
<>();
objectMap3
.
put
(
"hitRatio"
,
2.2
);
objectMap3
.
put
(
"stock"
,
66
);
objectMap3
.
put
(
"hitRatio"
,
1
);
objectMap3
.
put
(
"stock"
,
50
);
mapMap
.
put
(
"4"
,
objectMap3
);
Map
<
String
,
Object
>
objectMap4
=
new
HashMap
<>();
/*
Map<String, Object> objectMap4 = new HashMap<>();
objectMap4.put("hitRatio", 26.7);
objectMap4
.
put
(
"stock"
,
797
);
objectMap4.put("stock",
165
);
mapMap.put("5", objectMap4);
Map<String, Object> objectMap5 = new HashMap<>();
objectMap5.put("hitRatio", 2.2);
objectMap5
.
put
(
"stock"
,
66
);
objectMap5.put("stock",
12
);
mapMap.put("6", objectMap5);
Map<String, Object> objectMap6 = new HashMap<>();
objectMap6
.
put
(
"hitRatio"
,
15.
3
);
objectMap6
.
put
(
"stock"
,
458
);
mapMap
.
put
(
"7"
,
objectMap6
);
objectMap6.put("hitRatio", 15.
6
);
objectMap6.put("stock",
90
);
mapMap.put("7", objectMap6);
*/
Map
<
String
,
Integer
>
stockMap
=
new
HashMap
<>();
ArrayList
<
String
>
eliminateSkuIdList
=
CollectionUtil
.
arrayListString
();
getStock
(
594
,
new
BigDecimal
(
100
),
mapMap
,
stockMap
,
2993
,
eliminateSkuIdList
);
getStock
(
155
,
new
BigDecimal
(
71.03
),
mapMap
,
stockMap
,
179
,
eliminateSkuIdList
);
for
(
String
key
:
stockMap
.
keySet
())
{
System
.
out
.
println
(
"skuId
"
+
key
+
"***********数量
"
+
stockMap
.
get
(
key
));
System
.
out
.
println
(
"skuId
:"
+
key
+
"***********数量:
"
+
stockMap
.
get
(
key
));
}
System
.
out
.
println
(
"kkk"
);
/* Map<String, BigDecimal> hmap = new HashMap<>();
hmap.put("1", new BigDecimal(40));
hmap.put("2", new BigDecimal(49));
hmap.put("3", null);
hmap.put("4", null);
hmap.put("5", null);
arrangeHitRatioMap(hmap, new BigDecimal(89));
for (String key : hmap.keySet()) {
}*/
}
/**
* 整理map集合中存在空概率的值
*
* @param map,hitRatioCount
*/
private
static
void
arrangeHitRatioMap
(
Map
<
String
,
BigDecimal
>
map
,
BigDecimal
hitRatioCount
)
{
// 定义最大概率
BigDecimal
maxHitRatio
=
new
BigDecimal
(
100
);
// 剩余概率
BigDecimal
remainHitRatio
=
maxHitRatio
.
subtract
(
hitRatioCount
);
// 获取值为空的数量
int
number
=
0
;
for
(
String
key
:
map
.
keySet
())
{
if
(
map
.
get
(
key
)
==
null
)
{
number
++;
}
}
// 平均值
BigDecimal
averageNumber
=
remainHitRatio
.
divide
(
BigDecimal
.
valueOf
(
number
),
2
,
BigDecimal
.
ROUND_DOWN
);
for
(
String
key
:
map
.
keySet
())
{
if
(
map
.
get
(
key
)
==
null
)
{
map
.
put
(
key
,
averageNumber
);
}
}
}
/**
* 获取单个sku库存
*
...
...
@@ -351,11 +417,11 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
continue
;
}
BigDecimal
bigDecimal
=
BigDecimal
.
valueOf
(
exStock
).
multiply
((
new
BigDecimal
(
hitRatio
.
toString
()).
divide
(
hitRatioCount
,
2
,
BigDecimal
.
ROUND_HALF_UP
)));
BigDecimal
bigDecimal
=
BigDecimal
.
valueOf
(
exStock
).
multiply
((
new
BigDecimal
(
hitRatio
.
toString
()).
divide
(
hitRatioCount
,
5
,
BigDecimal
.
ROUND_HALF_UP
)));
bigDecimalHashMap
.
put
(
key
,
bigDecimal
);
// 要减去的库存
int
subStock
=
BigDecimal
.
valueOf
(
exStock
).
multiply
((
new
BigDecimal
(
hitRatio
.
toString
()).
divide
(
hitRatioCount
,
2
,
BigDecimal
.
ROUND_HALF_UP
))).
setScale
(
0
,
BigDecimal
.
ROUND_UP
).
intValue
();
int
subStock
=
BigDecimal
.
valueOf
(
exStock
).
multiply
((
new
BigDecimal
(
hitRatio
.
toString
()).
divide
(
hitRatioCount
,
5
,
BigDecimal
.
ROUND_HALF_UP
))).
setScale
(
0
,
BigDecimal
.
ROUND_UP
).
intValue
();
if
(
subStock
>
Integer
.
valueOf
(
stock
.
toString
()))
{
subNumber
+=
Integer
.
valueOf
(
stock
.
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