Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
streamingUserPortrait
Project
Project
Details
Activity
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
赵威
streamingUserPortrait
Commits
abe587cc
Commit
abe587cc
authored
Feb 05, 2021
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
send info to dingtalk
parent
f84b924f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
61 deletions
+78
-61
Main.scala
src/main/scala/com.gmei.up/Main.scala
+78
-61
No files found.
src/main/scala/com.gmei.up/Main.scala
View file @
abe587cc
...
@@ -53,67 +53,84 @@ object Main extends LazyLogging {
...
@@ -53,67 +53,84 @@ object Main extends LazyLogging {
val
stream
:
DataStream
[
UserInfo
]
=
env
.
addSource
(
kafkaConsumer
)
val
stream
:
DataStream
[
UserInfo
]
=
env
.
addSource
(
kafkaConsumer
)
// stream.map { user =>
stream
.
map
{
user
=>
// try {
try
{
// val deviceId = user.deviceId
val
deviceId
=
user
.
deviceId
// val projects = user.projects.toList
val
projects
=
user
.
projects
.
toList
// val secondDemands = user.secondDemands.toList
val
secondDemands
=
user
.
secondDemands
.
toList
// val secondPositions = user.secondPositions.toList
val
secondPositions
=
user
.
secondPositions
.
toList
// val secondSolutions = user.secondSolutions.toList
val
secondSolutions
=
user
.
secondSolutions
.
toList
// val cityId = user.cityId
val
cityId
=
user
.
cityId
// println(deviceId)
println
(
deviceId
)
// // println(projects.mkString(" "))
// println(projects.mkString(" "))
// val diaryRead = Redis.getRead(deviceId, "diary")
val
diaryRead
=
Redis
.
getRead
(
deviceId
,
"diary"
)
// val tractateRead = Redis.getRead(deviceId, "tractate")
val
tractateRead
=
Redis
.
getRead
(
deviceId
,
"tractate"
)
// val answerRead = Redis.getRead(deviceId, "answer")
val
answerRead
=
Redis
.
getRead
(
deviceId
,
"answer"
)
// val diaryReq =
val
diaryReq
=
// ES.generateDiaryRequest(
ES
.
generateDiaryRequest
(
// projects,
projects
,
// secondDemands,
secondDemands
,
// secondPositions,
secondPositions
,
// secondSolutions,
secondSolutions
,
// diaryRead,
diaryRead
,
// cityId,
cityId
,
// 300
300
// )
)
// val tractateReq =
val
tractateReq
=
// ES.generateTractateRequest(
ES
.
generateTractateRequest
(
// projects,
projects
,
// secondDemands,
secondDemands
,
// secondPositions,
secondPositions
,
// secondSolutions,
secondSolutions
,
// tractateRead,
tractateRead
,
// 300
300
// )
)
// val answerReq =
val
answerReq
=
// ES.generateAnswerRequest(projects, secondDemands, secondPositions, secondSolutions, answerRead, 100)
ES
.
generateAnswerRequest
(
projects
,
secondDemands
,
secondPositions
,
secondSolutions
,
answerRead
,
100
)
// val serviceDiaryReq =
val
serviceDiaryReq
=
// ES.generateServiceDiaryRequest(
ES
.
generateServiceDiaryRequest
(
// projects,
projects
,
// secondDemands,
secondDemands
,
// secondPositions,
secondPositions
,
// secondSolutions,
secondSolutions
,
// diaryRead,
diaryRead
,
// cityId,
cityId
,
// 100
100
// )
)
// Redis.save(ES.request(diaryReq), deviceId, "diary")
Redis
.
save
(
ES
.
request
(
diaryReq
),
deviceId
,
"diary"
)
// Redis.save(ES.request(tractateReq), deviceId, "tractate")
Redis
.
save
(
ES
.
request
(
tractateReq
),
deviceId
,
"tractate"
)
// Redis.save(ES.request(answerReq), deviceId, "answer")
Redis
.
save
(
ES
.
request
(
answerReq
),
deviceId
,
"answer"
)
// Redis.save(ES.request(serviceDiaryReq), deviceId, "service_diary")
Redis
.
save
(
ES
.
request
(
serviceDiaryReq
),
deviceId
,
"service_diary"
)
// logger.info(s"${user.eventCn} ${deviceId}")
logger
.
info
(
s
"${user.eventCn} ${deviceId}"
)
// deviceId
if
(
deviceId
==
"64695DE0-B926-4188-9C62-D987DC20BEDF"
)
{
// } catch {
DingTalk
.
send
(
// case e: Throwable =>
Map
(
// e.printStackTrace()
"deviceId"
->
deviceId
,
// ""
"eventCn"
->
user
.
eventCn
,
// }
"action"
->
user
.
action
,
// }
"cityId"
->
user
.
cityId
.
toString
,
"logTime"
->
user
.
logTime
.
toString
,
"projects"
->
user
.
projects
.
mkString
(
" "
)
)
)
}
deviceId
}
catch
{
case
e
:
Throwable
=>
DingTalk
.
send
(
Map
(
"Main.main"
->
"stream.map"
,
"error"
->
e
.
getStackTrace
.
mkString
(
"\n"
)),
contentType
=
"exception"
)
e
.
printStackTrace
()
""
}
}
stream
.
print
stream
.
print
env
.
execute
(
"flink streaming user portrait"
)
env
.
execute
(
"flink streaming user portrait"
)
...
...
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