记得上下班打卡 | 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
94058b07
Commit
94058b07
authored
May 06, 2022
by
wanglele
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
批量空投
parent
9d581e43
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
44 deletions
+71
-44
AbstractHttpRedisReceiver.java
...ce/consumer/kylin/receiver/AbstractHttpRedisReceiver.java
+3
-2
GoblinNftExCodeServiceImpl.java
...tform/service/impl/goblin/GoblinNftExCodeServiceImpl.java
+68
-42
No files found.
liquidnet-bus-service/liquidnet-service-consumer-all/liquidnet-service-consumer-kylin/src/main/java/com/liquidnet/service/consumer/kylin/receiver/AbstractHttpRedisReceiver.java
View file @
94058b07
...
...
@@ -70,6 +70,8 @@ public abstract class AbstractHttpRedisReceiver implements StreamListener<String
});
if
(
rsp
.
isSuccess
())
{
addLink
.
add
(
new
Object
[]{
adminUid
,
codeList
.
get
(
i
)});
}
else
{
log
.
error
(
"airdrop send fail:[{}]"
+
userIdList
.
get
(
i
));
}
}
...
...
@@ -79,8 +81,7 @@ public abstract class AbstractHttpRedisReceiver implements StreamListener<String
sendMsgByRedis
(
MQConst
.
GoblinQueue
.
GOBLIN_CODE_OPERA
.
getKey
(),
sqlData
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
"发送空投失败!"
);
log
.
error
(
"airdrop send fail:[{}]"
);
}
return
true
;
...
...
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/service/impl/goblin/GoblinNftExCodeServiceImpl.java
View file @
94058b07
...
...
@@ -129,7 +129,7 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService {
if
(
gnc
.
getState
().
equals
(
2
))
{
if
(
StringUtil
.
isNotBlank
(
gnc
.
getBoxSkuId
())
&&
gnc
.
getBoxSkuId
().
equals
(
goblinGoodsSku
.
getSkuId
()))
{
goblinNftExCodeVo
.
setResultSkuName
(
goblinGoodsSku
.
getName
());
}
else
if
(
StringUtil
.
isBlank
(
gnc
.
getBoxSkuId
())
&&
gnc
.
getSkuId
().
equals
(
goblinGoodsSku
.
getSkuId
())){
}
else
if
(
StringUtil
.
isBlank
(
gnc
.
getBoxSkuId
())
&&
gnc
.
getSkuId
().
equals
(
goblinGoodsSku
.
getSkuId
()))
{
goblinNftExCodeVo
.
setResultSkuName
(
goblinGoodsSku
.
getName
());
}
}
...
...
@@ -377,63 +377,72 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService {
@Override
public
ResponseDto
<
Boolean
>
addAirdrops
(
MultipartFile
file
,
String
activityId
,
String
adminUid
)
{
// 手机号集合
StringBuffer
phonestr
=
new
StringBuffer
();
List
<
String
>
phoneList
=
CollectionUtil
.
arrayListString
();
try
{
// 手机号集合
StringBuffer
phonestr
=
new
StringBuffer
();
EasyExcel
.
read
(
file
.
getInputStream
(),
GoblinNftExCodeFetchExcelVo
.
class
,
new
PageReadListener
<
GoblinNftExCodeFetchExcelVo
>(
dataList
->
{
for
(
GoblinNftExCodeFetchExcelVo
data
:
dataList
)
{
if
(
data
.
getPhone
()
==
null
)
{
continue
;
}
phonestr
.
append
(
data
.
getPhone
()).
append
(
","
);
phoneList
.
add
(
data
.
getPhone
());
}
})).
sheet
().
doRead
();
if
(
StringUtil
.
isNotBlank
(
phonestr
))
{
phonestr
.
deleteCharAt
(
phonestr
.
length
()
-
1
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
ResponseDto
.
failure
(
"解析文件失败!"
);
}
if
(
StringUtil
.
isNotBlank
(
phonestr
))
{
phonestr
.
deleteCharAt
(
phonestr
.
length
()
-
1
);
}
// 根据手机号获取用户
List
<
AdamUserInfoDto
>
adamUserInfoDtoList
=
adamUserMapper
.
selectByPhones
(
phonestr
.
toString
());
if
(
adamUserInfoDtoList
==
null
||
adamUserInfoDtoList
.
size
()
<=
0
){
return
ResponseDto
.
failure
(
"根据手机号未能查询到用户!"
);
}
ArrayList
<
String
>
phoneCheckList
=
CollectionUtil
.
arrayListString
();
for
(
AdamUserInfoDto
adamUserInfoDto
:
adamUserInfoDtoList
)
{
phoneCheckList
.
add
(
adamUserInfoDto
.
getMobile
());
}
// 根据手机号获取用户
List
<
AdamUserInfoDto
>
adamUserMappers
=
adamUserMapper
.
selectByPhones
(
phonestr
.
toString
());
// 根据活动id获取可用兑换码
List
<
GoblinNftExCode
>
goblinNftExCodes
=
goblinNftExCodeMapper
.
selectCodeAvailableByActivityId
(
activityId
);
if
(
goblinNftExCodes
.
size
()
<
phoneList
.
size
())
{
return
ResponseDto
.
failure
(
"可用兑换码数量不足!"
);
}
// 根据活动id获取可用兑换码
List
<
GoblinNftExCode
>
goblinNftExCodes
=
goblinNftExCodeMapper
.
selectCodeAvailableByActivityId
(
activityId
);
if
(
goblinNftExCodes
.
size
()
<
adamUserMappers
.
size
())
{
return
ResponseDto
.
failure
(
"可用兑换码数量不足!"
);
// 页条数
int
pageSize
=
1
;
ArrayList
<
String
>
userIdList
=
CollectionUtil
.
arrayListString
();
StringBuffer
userIds
=
new
StringBuffer
();
int
i
=
1
;
for
(
String
phone
:
phoneList
)
{
if
(!
phoneCheckList
.
contains
(
phone
))
{
log
.
error
(
"mobile select not user :[{}]"
+
phone
);
continue
;
}
// 页条数
int
pageSize
=
1
;
ArrayList
<
String
>
userIdList
=
CollectionUtil
.
arrayListString
();
StringBuffer
userIds
=
new
StringBuffer
();
int
i
=
1
;
for
(
AdamUserInfoDto
adamUserInfoDto
:
adamUserMappers
)
{
userIdList
.
add
(
adamUserInfoDto
.
getUid
());
userIds
.
append
(
adamUserInfoDto
.
getUid
()).
append
(
","
);
if
(
userIdList
.
size
()
==
pageSize
)
{
StringBuffer
codes
=
new
StringBuffer
();
PageHelper
.
startPage
(
i
,
pageSize
,
true
);
List
<
GoblinNftExCode
>
goblinNftExCodeList
=
goblinNftExCodeMapper
.
selectCodeAvailableByActivityId
(
activityId
);
for
(
GoblinNftExCode
goblinNftExCode
:
goblinNftExCodeList
)
{
codes
.
append
(
goblinNftExCode
.
getCode
()).
append
(
","
);
}
HashMap
<
String
,
String
>
hashMap
=
CollectionUtil
.
mapStringString
();
codes
.
deleteCharAt
(
codes
.
length
()
-
1
);
userIds
.
deleteCharAt
(
userIds
.
length
()
-
1
);
hashMap
.
put
(
"codes"
,
codes
.
toString
());
hashMap
.
put
(
"userIds"
,
userIds
.
toString
());
hashMap
.
put
(
"adminUid"
,
adminUid
);
queueUtils
.
sendMssPhoneCodeRedis
(
hashMap
);
userIdList
.
clear
();
i
++;
AdamUserInfoDto
adamUserInfo
=
null
;
for
(
AdamUserInfoDto
adamUserInfoDto
:
adamUserInfoDtoList
)
{
if
(
phone
.
equals
(
adamUserInfoDto
.
getMobile
()))
{
adamUserInfo
=
adamUserInfoDto
;
}
}
if
(
userIdList
.
size
()
>
0
)
{
userIdList
.
add
(
adamUserInfo
.
getUid
());
userIds
.
append
(
adamUserInfo
.
getUid
()).
append
(
","
);
if
(
userIdList
.
size
()
==
pageSize
)
{
StringBuffer
codes
=
new
StringBuffer
();
PageHelper
.
startPage
(
i
,
pageSize
,
true
);
List
<
GoblinNftExCode
>
goblinNftExCodeList
=
goblinNftExCodeMapper
.
selectCodeAvailableByActivityId
(
activityId
);
StringBuffer
codes
=
new
StringBuffer
();
for
(
GoblinNftExCode
goblinNftExCode
:
goblinNftExCodeList
)
{
codes
.
append
(
goblinNftExCode
.
getCode
()).
append
(
","
);
}
...
...
@@ -445,13 +454,30 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService {
hashMap
.
put
(
"adminUid"
,
adminUid
);
queueUtils
.
sendMssPhoneCodeRedis
(
hashMap
);
userIdList
.
clear
();
userIds
=
new
StringBuffer
();
i
++;
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
if
(
userIdList
.
size
()
>
0
)
{
PageHelper
.
startPage
(
i
,
pageSize
,
true
);
List
<
GoblinNftExCode
>
goblinNftExCodeList
=
goblinNftExCodeMapper
.
selectCodeAvailableByActivityId
(
activityId
);
StringBuffer
codes
=
new
StringBuffer
();
for
(
GoblinNftExCode
goblinNftExCode
:
goblinNftExCodeList
)
{
codes
.
append
(
goblinNftExCode
.
getCode
()).
append
(
","
);
}
HashMap
<
String
,
String
>
hashMap
=
CollectionUtil
.
mapStringString
();
codes
.
deleteCharAt
(
codes
.
length
()
-
1
);
userIds
.
deleteCharAt
(
userIds
.
length
()
-
1
);
hashMap
.
put
(
"codes"
,
codes
.
toString
());
hashMap
.
put
(
"userIds"
,
userIds
.
toString
());
hashMap
.
put
(
"adminUid"
,
adminUid
);
queueUtils
.
sendMssPhoneCodeRedis
(
hashMap
);
userIdList
.
clear
();
}
return
null
;
return
ResponseDto
.
success
(
true
);
}
public
static
void
main
(
String
[]
args
)
{
...
...
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