Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
谢明辉
/
oss-update-application
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 1b54623e
authored
Aug 12, 2019
by
谢明辉
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
下载时可指定时间段
1 parent
916f6d30
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
9 deletions
src/main/java/com/vion/Application.java
src/main/resources/application-pro.properties
src/main/java/com/vion/Application.java
View file @
1b54623
...
...
@@ -18,10 +18,11 @@ import org.springframework.scheduling.concurrent.DefaultManagedAwareThreadFactor
import
javax.annotation.Resource
;
import
java.io.File
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.ThreadFactory
;
import
java.util.concurrent.ThreadPoolExecutor
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -53,12 +54,18 @@ public class Application implements CommandLineRunner {
private
String
serialnumStr
;
@Value
(
"${file_path:}"
)
private
String
filePath
;
@Value
(
"${date.begin:}"
)
private
String
dateBeginStr
;
@Value
(
"${date.end:}"
)
private
String
dateEndStr
;
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
ThreadPoolExecutor
threadPool
=
new
ThreadPoolExecutor
(
50
,
100
,
10
,
TimeUnit
.
MINUTES
,
new
LinkedBlockingQueue
<>(),
new
DefaultManagedAwareThreadFactory
());
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyyMMdd"
);
ThreadPoolExecutor
threadPool
=
new
ThreadPoolExecutor
(
50
,
100
,
10
,
TimeUnit
.
MINUTES
,
new
LinkedBlockingQueue
<>(),
new
DefaultManagedAwareThreadFactory
());
if
(!
""
.
equals
(
filePath
))
{
try
{
...
...
@@ -70,12 +77,29 @@ public class Application implements CommandLineRunner {
System
.
exit
(
0
);
}
List
<
String
>
dateList
=
new
ArrayList
<>();
if
(!
dateBeginStr
.
isEmpty
()
&&
!
dateEndStr
.
isEmpty
())
{
LocalDate
beginDate
=
LocalDate
.
parse
(
dateBeginStr
,
formatter
);
LocalDate
endDate
=
LocalDate
.
parse
(
dateEndStr
,
formatter
);
while
(
beginDate
.
compareTo
(
endDate
)
<
1
)
{
dateList
.
add
(
formatter
.
format
(
beginDate
));
beginDate
=
beginDate
.
plusDays
(
1
);
}
}
List
<
String
>
filePathList
=
new
ArrayList
<>();
if
(!
serialnumStr
.
isEmpty
())
{
String
[]
serialnums
=
serialnumStr
.
split
(
","
);
for
(
String
serialnum
:
serialnums
)
{
filePathList
.
add
(
prefix
+
serialnum
+
"/"
);
if
(
dateList
.
size
()
>
0
)
{
for
(
String
dateStr
:
dateList
)
{
filePathList
.
add
(
prefix
+
dateStr
+
"/"
+
serialnum
+
"/"
);
}
}
else
{
filePathList
.
add
(
prefix
+
serialnum
+
"/"
);
}
}
}
else
{
filePathList
.
add
(
prefix
);
...
...
src/main/resources/application-pro.properties
View file @
1b54623
oss.config.bucket
=
vion-retail
oss.config.endPoint
=
oss-cn-beijing.aliyuncs.com
oss.config.accessKeyId
=
LTAI9WfUr3GDne4c
...
...
@@ -9,9 +8,9 @@ path.picture=D:\\face\\
path.feature
=
D:
\\
feature
\\
#########################the application will upload the data in [beginDate,endDate]
#########################begin date######################
date.begin
=
201
80825
date.begin
=
201
90701
#########################end date###################
date.end
=
201
80825
date.end
=
201
900810
########################Path format\uFF1Aface/date/channel_serialNum, Database connection using postgreSql,flag = postgre
#spring.datasource.driver-class-name=org.postgresql.Driver
#spring.datasource.url=jdbc:postgresql://192.168.9.221:5432/shoppingMall_snapshot
...
...
@@ -26,9 +25,11 @@ date.end=20180825
flag
=
mysql
server.port
=
8888
##########
prefix
=
picture/face/20190725/
serialnumStr
=
555F-DEB5-EF7E-2EAB-01
# \u56FE\u7247\u62FC\u63A5\u89C4\u5219\uFF1A\u5982\u679Cfile_path\u6307\u5B9A\u4E86\uFF0C\u76F4\u63A5\u4E0B\u8F7Dfile_path\u6307\u5B9A\u7684\u56FE\u7247
# \u9996\u5148\u62FC\u63A5prefix,\u7136\u540E\u5224\u65ADdate.begin\u548Cdate.end\u662F\u5426\u5B58\u5728,\u5B58\u5728\u5219\u4F1A\u5FAA\u73AF\u62FC\u63A5date\u6BB5(\u7528\u4E8E\u4E0B\u8F7D\u591A\u5929\u56FE\u7247),\u7136\u540E\u62FC\u63A5\u5FAA\u73AF\u62FC\u63A5serialnumStr,
# \u4E4B\u540E\u4E0B\u8F7D\u62FC\u63A5\u597D\u540E\u7684\u76EE\u5F55\u4E0B\u7684\u6240\u6709\u56FE\u7247
prefix
=
picture/face/
serialnumStr
=
4050-30B6-0DE3-1699-01,D53F-ECEC-2793-BD8B-01,E310-B059-CF45-3E0B-01,4735-8F23-7EF3-168D-01,4519-5AD3-4F72-8219-01,624A-7253-1428-271E-01,3DB8-5BB2-5ED4-4FAF-01,FD88-FB41-3AD0-959A-01
#### assigned to a specific file\u2018s path
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment