Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
app-collection
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
徐顺
app-collection
Commits
39076c6e
Commit
39076c6e
authored
Jan 26, 2021
by
RingEric
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据处理方法
parent
2f59826e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
src/main/scala/qm/flink/Analysis.scala
src/main/scala/qm/flink/Analysis.scala
+55
-0
No files found.
src/main/scala/qm/flink/Analysis.scala
0 → 100644
View file @
39076c6e
package
qm.flink
import
qm.jackson.Jackson
import
java.util
import
scala.collection.JavaConversions._
import
scala.collection.mutable.ArrayBuffer
/**
* @ClassName: Analysis
* @Description: TODO
* @Create by: LinYoung
* @Date: 2020/12/24 12:33
*/
object
Analysis
{
/**
* 对接过来的数据进行处理,返回多个平台比价
*
* @param x 要处理的数据,json字符串
* @return 返回搜索结果
*/
def
analysis
(
x
:
String
)
:
Array
[(
String
,
Any
)]
=
{
val
tuples
:
ArrayBuffer
[(
String
,
Any
)]
=
new
ArrayBuffer
[(
String
,
Any
)]()
val
collections
:
Array
[
String
]
=
x
.
split
(
"#QM#MQ#"
)
if
(
collections
.
length
<
2
)
{
return
Array
((
""
,
""
))
}
val
head
:
String
=
collections
(
0
)
val
tail
:
String
=
collections
(
1
)
//用jackson处理json字符串
val
headMap
=
new
util
.
HashMap
[
String
,
Any
]()
val
tailMap
=
new
util
.
HashMap
[
String
,
Any
]()
Jackson
.
autoParseJson
(
head
,
headMap
)
Jackson
.
autoParseJson
(
tail
,
tailMap
)
val
keys
=
headMap
.
keySet
()
val
tails
=
tailMap
.
keySet
()
for
(
key
<-
keys
)
{
tuples
.
append
((
key
,
headMap
.
get
(
key
)))
}
for
(
tailKey
<-
tails
)
{
tuples
.
append
((
tailKey
,
tailMap
.
get
(
tailKey
)))
}
tuples
.
toArray
}
}
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