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
83ac5e1b
Commit
83ac5e1b
authored
Feb 07, 2021
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get time
parent
ee417a0d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
Main.scala
src/main/scala/com.gmei.up/Main.scala
+5
-6
Redis.scala
src/main/scala/com.gmei.up/utils/Redis.scala
+2
-3
No files found.
src/main/scala/com.gmei.up/Main.scala
View file @
83ac5e1b
package
com.gmei.up
import
java.util.Properties
import
java.time.Instant
import
com.typesafe.scalalogging.LazyLogging
import
org.apache.flink.api.scala._
import
org.apache.flink.streaming.api.scala.
{
StreamExecutionEnvironment
,
DataStream
}
...
...
@@ -63,7 +62,7 @@ object Main extends LazyLogging {
val
secondPositions
=
user
.
secondPositions
.
toList
val
secondSolutions
=
user
.
secondSolutions
.
toList
val
cityId
=
user
.
cityId
val
stream
BeginTimestamp
:
Long
=
Instant
.
now
.
getEpochSecond
val
stream
TimeBegin
:
Long
=
System
.
currentTimeMillis
println
(
deviceId
)
// println(projects.mkString(" "))
...
...
@@ -103,10 +102,10 @@ object Main extends LazyLogging {
100
)
Redis
.
save
(
ES
.
request
(
diaryReq
),
deviceId
,
"diary"
,
stream
BeginTimestamp
)
Redis
.
save
(
ES
.
request
(
tractateReq
),
deviceId
,
"tractate"
,
stream
BeginTimestamp
)
Redis
.
save
(
ES
.
request
(
answerReq
),
deviceId
,
"answer"
,
stream
BeginTimestamp
)
Redis
.
save
(
ES
.
request
(
serviceDiaryReq
),
deviceId
,
"service_diary"
,
stream
BeginTimestamp
)
Redis
.
save
(
ES
.
request
(
diaryReq
),
deviceId
,
"diary"
,
stream
TimeBegin
)
Redis
.
save
(
ES
.
request
(
tractateReq
),
deviceId
,
"tractate"
,
stream
TimeBegin
)
Redis
.
save
(
ES
.
request
(
answerReq
),
deviceId
,
"answer"
,
stream
TimeBegin
)
Redis
.
save
(
ES
.
request
(
serviceDiaryReq
),
deviceId
,
"service_diary"
,
stream
TimeBegin
)
// current time
logger
.
info
(
s
"${user.eventCn} ${deviceId}"
)
...
...
src/main/scala/com.gmei.up/utils/Redis.scala
View file @
83ac5e1b
...
...
@@ -2,7 +2,6 @@ package com.gmei.up.utils
import
scala.concurrent.Future
import
scala.collection.JavaConverters._
import
java.time.Instant
import
com.alibaba.fastjson.JSON
import
com.redis.
{
RedisClient
,
RedisClientPool
}
...
...
@@ -27,7 +26,7 @@ object Redis {
contentEitherFuture
:
Either
[
Throwable
,
Future
[
IndexedSeq
[
Content
]]],
deviceId
:
String
,
contentType
:
String
,
time
stamp
Begin
:
Long
timeBegin
:
Long
)
:
Unit
=
{
val
key
=
s
"streaming:candidate:${contentType}:device_id:${deviceId}"
...
...
@@ -50,7 +49,7 @@ object Redis {
"method"
->
"Redis.save"
,
"deviceId"
->
deviceId
,
"contentType"
->
contentType
,
"streamTotalSeconds"
->
s
"${(
Instant.now.getEpochSecond * 1000 - timestamp
Begin * 1000)}ms"
"streamTotalSeconds"
->
s
"${(
System.currentTimeMillis - time
Begin * 1000)}ms"
)
)
}
...
...
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