Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mock-neo4j-data
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
丁强
mock-neo4j-data
Commits
09d9128e
Commit
09d9128e
authored
Apr 21, 2020
by
丁强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交模拟数据代码
parent
7a48441d
Pipeline
#518
canceled with stages
Changes
6
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
568 additions
and
0 deletions
+568
-0
.gitignore
.gitignore
+36
-0
pom.xml
pom.xml
+54
-0
Application.java
src/main/java/cn/quantgroup/Application.java
+13
-0
DateUtil.java
src/main/java/cn/quantgroup/mock/DateUtil.java
+392
-0
MockData.java
src/main/java/cn/quantgroup/mock/MockData.java
+71
-0
up.sh
up.sh
+2
-0
No files found.
.gitignore
0 → 100644
View file @
09d9128e
*.class
# Package Files #
*.jar
*.war
*.ear
build/*
target/*
**/build/*
**/target/*
out/*
**/out/*
**/.idea/workspace.xml
**/.idea/tasks.xml
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
*.iml
.idea/**
## File-based project format:
*.ipr
*.iws
### 建议使用本地gradle,服务器环境中也需要安装gradle
**/.gradle/*
**/gradle/*
gradlew*
**/target/**
**/._.DS_Store
**/*.bak
**/*.log
!/lib/*.jar
\ No newline at end of file
pom.xml
0 → 100644
View file @
09d9128e
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
cn.quantgroup
</groupId>
<artifactId>
mock-neo4j-data
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<java.version>
1.8
</java.version>
</properties>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
1.5.2.RELEASE
</version>
</parent>
<dependencies>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.12
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-io
</artifactId>
<version>
1.3.2
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
src/main/java/cn/quantgroup/Application.java
0 → 100644
View file @
09d9128e
package
cn
.
quantgroup
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
public
class
Application
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
Application
.
class
,
args
);
}
}
src/main/java/cn/quantgroup/mock/DateUtil.java
0 → 100644
View file @
09d9128e
This diff is collapsed.
Click to expand it.
src/main/java/cn/quantgroup/mock/MockData.java
0 → 100644
View file @
09d9128e
package
cn
.
quantgroup
.
mock
;
import
org.apache.commons.io.IOUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.util.*
;
/**
* @author Aladdin(qiang.ding)
* @date 2020/4/16
*/
@Component
public
class
MockData
{
@Value
(
"${header.user}"
)
private
String
userHeader
;
@Value
(
"${header.order}"
)
private
String
orderHeader
;
@Value
(
"${path.data}"
)
private
String
dataPath
;
@Value
(
"${totalCount}"
)
private
int
totalCount
;
private
static
final
List
<
String
>
PHONE_SET
=
new
ArrayList
<>(
1000000
);
static
{
for
(
int
i
=
1000000
;
i
<
2000000
;
i
++)
{
PHONE_SET
.
add
(
"1512"
+
i
);
}
}
@PostConstruct
public
void
mockData
()
{
try
{
File
user
=
new
File
(
dataPath
+
"user.csv"
);
FileOutputStream
userOutputStream
=
new
FileOutputStream
(
user
,
true
);
IOUtils
.
write
(
userHeader
,
userOutputStream
);
IOUtils
.
write
(
"\n"
,
userOutputStream
);
IOUtils
.
writeLines
(
PHONE_SET
,
null
,
userOutputStream
);
File
order
=
new
File
(
dataPath
+
"order.csv"
);
FileOutputStream
orderOutputStream
=
new
FileOutputStream
(
order
,
true
);
IOUtils
.
write
(
orderHeader
,
orderOutputStream
);
IOUtils
.
write
(
"\n"
,
orderOutputStream
);
List
<
String
>
orders
=
new
LinkedList
<>();
Random
ran
=
new
Random
();
for
(
int
i
=
0
;
i
<
totalCount
;
i
++)
{
String
orderPhone
=
PHONE_SET
.
get
(
i
%
PHONE_SET
.
size
());
String
receiverPhone
=
PHONE_SET
.
get
(
ran
.
nextInt
(
PHONE_SET
.
size
()));
String
orderId
=
UUID
.
randomUUID
().
toString
();
long
t
=
ran
.
nextInt
((
int
)(
DateUtil
.
ONE_YEAR
/
1000
))
*
1000L
+
1555171200000L
;
String
orderTime
=
DateUtil
.
format
(
new
Date
(
t
));
String
orderStatus
=
i
%
3
+
""
;
orders
.
add
(
orderPhone
+
","
+
receiverPhone
+
","
+
orderId
+
","
+
orderTime
+
","
+
orderStatus
);
}
IOUtils
.
writeLines
(
orders
,
null
,
orderOutputStream
);
System
.
out
.
println
(
"数据生成完毕。"
);
System
.
exit
(
0
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
System
.
exit
(
1
);
}
}
}
up.sh
0 → 100644
View file @
09d9128e
mvn clean package
--offline
scp target/remote-hdfs-1.0-SNAPSHOT.jar sysapp@172.18.3.97:~/
\ No newline at end of file
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