Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
21413db6
Commit
21413db6
authored
Dec 22, 2020
by
董建华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
监听用户事件
parent
7c328d51
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
13 deletions
+37
-13
UserDetailUpdateEventListener.java
.../quantgroup/xyqb/event/UserDetailUpdateEventListener.java
+1
-0
UserExtInfoSaveEventListener.java
...n/quantgroup/xyqb/event/UserExtInfoSaveEventListener.java
+35
-12
UserEventCollectingUtil.java
...xyqb/risk/uereventcollecting/UserEventCollectingUtil.java
+1
-1
No files found.
src/main/java/cn/quantgroup/xyqb/event/UserDetailUpdateEventListener.java
View file @
21413db6
...
...
@@ -53,6 +53,7 @@ public class UserDetailUpdateEventListener implements ApplicationListener<UserDe
baseInfoBuilder
.
userUuid
(
user
.
getUuid
());
builder
.
businessEventBaseInfo
(
baseInfoBuilder
.
build
());
builder
.
subEventType
(
UserBaseInfoEvent
.
SubEventType
.
user_certification
);
UserEventCollectingUtil
.
addEvent
(
builder
.
build
());
log
.
info
(
"用户实名认证事件监听结束userId:{}"
,
userDetail
.
getUserId
());
...
...
src/main/java/cn/quantgroup/xyqb/event/UserExtInfoSaveEventListener.java
View file @
21413db6
package
cn
.
quantgroup
.
xyqb
.
event
;
import
cn.qg.ec.model.base.BusinessEventBaseInfo
;
import
cn.qg.ec.model.base.EventInfo
;
import
cn.qg.ec.model.user.UserBaseInfoEvent
;
import
cn.quantgroup.user.enums.EducationEnum
;
import
cn.quantgroup.user.enums.IncomeRangeEnum
;
...
...
@@ -41,30 +42,52 @@ public class UserExtInfoSaveEventListener implements ApplicationListener<UserExt
MaritalStatus
marryStatus
=
userExtInfo
.
getMarryStatus
();
OccupationEnum
occupationEnum
=
userExtInfo
.
getOccupationEnum
();
UserBaseInfoEvent
.
UserBaseInfoEventBuilder
builder
=
UserBaseInfoEvent
.
builder
();
builder
.
subEventType
(
UserBaseInfoEvent
.
SubEventType
.
user_occupation
);
User
user
=
userService
.
findById
(
userExtInfo
.
getUserId
());
if
(
null
==
user
)
{
log
.
error
(
"没找到用户,应该不存在这种情况"
);
return
;
}
String
uuid
=
user
.
getUuid
();
if
(
null
!=
educationEnum
)
{
builder
.
education
(
String
.
valueOf
(
educationEnum
.
ordinal
()));
send
(
UserBaseInfoEvent
.
SubEventType
.
user_education
,
uuid
,
String
.
valueOf
(
educationEnum
.
ordinal
()));
}
if
(
null
!=
incomeRangeEnum
)
{
builder
.
income
(
String
.
valueOf
(
incomeRangeEnum
.
ordinal
()));
send
(
UserBaseInfoEvent
.
SubEventType
.
user_income
,
uuid
,
String
.
valueOf
(
incomeRangeEnum
.
ordinal
()));
}
if
(
null
!=
marryStatus
)
{
builder
.
maritalStatus
(
String
.
valueOf
(
marryStatus
.
ordinal
()));
send
(
UserBaseInfoEvent
.
SubEventType
.
user_marital_status
,
uuid
,
String
.
valueOf
(
marryStatus
.
ordinal
()));
}
if
(
null
!=
occupationEnum
)
{
builder
.
occupation
(
String
.
valueOf
(
occupationEnum
.
ordinal
()));
send
(
UserBaseInfoEvent
.
SubEventType
.
user_occupation
,
uuid
,
String
.
valueOf
(
occupationEnum
.
ordinal
()));
}
}
private
void
send
(
UserBaseInfoEvent
.
SubEventType
eventType
,
String
uuid
,
String
val
)
{
UserBaseInfoEvent
.
UserBaseInfoEventBuilder
builder
=
UserBaseInfoEvent
.
builder
();
BusinessEventBaseInfo
.
BusinessEventBaseInfoBuilder
baseInfoBuilder
=
BusinessEventBaseInfo
.
builder
();
baseInfoBuilder
.
userId
(
uuid
);
User
user
=
userService
.
findById
(
userExtInfo
.
getUserId
());
if
(
null
==
user
)
{
log
.
error
(
"没找到用户,应该不存在这种情况"
);
}
baseInfoBuilder
.
userId
(
user
.
getUuid
());
builder
.
businessEventBaseInfo
(
baseInfoBuilder
.
build
());
builder
.
subEventType
(
eventType
);
switch
(
eventType
)
{
case
user_education:
builder
.
education
(
val
);
break
;
case
user_income:
builder
.
income
(
val
);
break
;
case
user_marital_status:
builder
.
maritalStatus
(
val
);
break
;
case
user_occupation:
builder
.
occupation
(
val
);
break
;
default
:
log
.
warn
(
"没有这个类型"
);
return
;
}
UserEventCollectingUtil
.
addEvent
(
builder
.
build
());
}
}
src/main/java/cn/quantgroup/xyqb/risk/uereventcollecting/UserEventCollectingUtil.java
View file @
21413db6
...
...
@@ -2,6 +2,7 @@ package cn.quantgroup.xyqb.risk.uereventcollecting;
import
cn.qg.ec.kinesis.KinesisProducerClient
;
import
cn.qg.ec.model.base.EventInfo
;
import
cn.qg.ec.model.user.UserLoginRegEvent
;
import
com.alibaba.fastjson.JSON
;
import
com.amazonaws.services.kinesis.producer.UserRecordResult
;
import
com.google.common.util.concurrent.FutureCallback
;
...
...
@@ -29,7 +30,6 @@ public class UserEventCollectingUtil {
try
{
ListenableFuture
<
UserRecordResult
>
future
=
client
.
SendRecord
(
eventInfo
);
Futures
.
addCallback
(
future
,
CALL_BACK
);
}
catch
(
UnsupportedEncodingException
e
)
{
log
.
error
(
"发送事件异常UnsupportedEncodingException:{}"
,
e
);
}
catch
(
Exception
e
)
{
...
...
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