Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mete-data-compressor
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
fengyuncheng
mete-data-compressor
Commits
14a31efa
Commit
14a31efa
authored
Oct 18, 2022
by
fengyuncheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v1
parent
20a5d840
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
242 deletions
+14
-242
00.txt
00.txt
+0
-239
ReadMe.md
ReadMe.md
+7
-0
Main.java
src/main/java/com/hgny/protobuf/Main.java
+7
-3
No files found.
00.txt
deleted
100644 → 0
View file @
20a5d840
This diff is collapsed.
Click to expand it.
ReadMe.md
0 → 100644
View file @
14a31efa
采集器数据转换压缩
将
`./data/`
一级文件夹下所有以
`.tar.gz`
结尾的压缩文件解压并压缩至csv文件中
header在
`./tools/node/data.js`
中,还有一个额外的Key:
`time`
,采用timestamp存储并去掉了毫秒信息
压缩后的csv文件将存放在
`./output`
,按照
`td_mctd/meter_sn/td_mctd@meter_sn@yyyyMM.csv.bz2`
的格式存放,存放一个采集器的一整个月的数据
\ No newline at end of file
src/main/java/com/hgny/protobuf/Main.java
View file @
14a31efa
...
...
@@ -12,6 +12,7 @@ import com.hgny.protobuf.test3.AddressBook3;
import
com.hgny.protobuf.test3.Person3
;
import
com.hgny.protobuf.utils.Constant
;
import
com.hgny.protobuf.utils.Tools
;
import
org.apache.commons.compress.utils.IOUtils
;
import
javax.tools.Tool
;
import
java.io.*
;
...
...
@@ -42,6 +43,9 @@ public class Main {
continue
;
}
String
gzName
=
gz
.
getName
();
if
(!
gzName
.
contains
(
".tar.gz"
))
{
continue
;
}
System
.
out
.
println
(
"parse: "
+
gzName
);
String
folderName
=
Tools
.
extraTarGz
(
gz
,
"./data"
);
// 遍历目录解压tar.bz2
...
...
@@ -56,8 +60,8 @@ public class Main {
int
index
=
gzName
.
indexOf
(
"."
);
String
fName
=
folderName
.
substring
(
0
,
index
);
deleteFolder
(
new
File
(
"./data/"
+
fName
));
Tools
.
compressTarGz
(
"./output/"
+
fName
,
new
File
(
"./output/"
+
fName
+
".tar.gz"
));
deleteFolder
(
new
File
(
"./output/"
+
fName
));
//
Tools.compressTarGz("./output/" + fName, new File("./output/" + fName + ".tar.gz"));
//
deleteFolder(new File("./output/" + fName));
System
.
out
.
println
(
"spend: "
+
(
System
.
currentTimeMillis
()
-
start
)
+
"ms"
);
start
=
System
.
currentTimeMillis
();
}
...
...
@@ -137,7 +141,7 @@ public class Main {
String
s2
=
s1
.
substring
(
0
,
index
);
String
month
=
s1
.
substring
(
index
+
1
);
String
fileName
=
s2
.
replaceAll
(
"/"
,
"@"
)
+
month
;
File
file
=
new
File
(
savePath
+
"/"
+
fileName
+
".bz2"
);
File
file
=
new
File
(
savePath
+
"/"
+
fileName
+
".
csv.
bz2"
);
String
s
=
group
.
stream
().
map
(
list
->
String
.
join
(
"\n"
,
list
)).
collect
(
Collectors
.
joining
(
"\n"
));
Tools
.
compressBZip2
(
s
,
file
);
}
else
if
(
level
==
4
)
{
...
...
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