Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hkstld
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李定达
hkstld
Commits
56cea78e
Commit
56cea78e
authored
Aug 23, 2018
by
李定达
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.调整stld的特殊文件的命名规则识别,香港以周日记作一周的第一天且以第一个周日作为该年的第一周;第一个周日之前的时间不计入本年第几周运算
parent
10ccd2cd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
12 deletions
+91
-12
hkstld/main.cpp
+91
-12
No files found.
hkstld/main.cpp
View file @
56cea78e
...
...
@@ -169,19 +169,19 @@ bool readStoreID(QString &storeID)
}
}
bool
copyfiles
(
QFileInfo
fileinfo
,
QString
path
,
QString
day
)
bool
copyfiles
(
QFileInfo
fileinfo
,
QString
path
,
QString
tmp
day
)
{
QFile
file
(
path
+
day
+
"/"
+
fileinfo
.
fileName
());
QFile
file
(
path
+
tmp
day
+
"/"
+
fileinfo
.
fileName
());
file
.
remove
();
QDir
dir
;
dir
.
mkdir
(
path
+
day
);
dir
.
mkdir
(
path
+
tmp
day
);
QLOG_DEBUG
()
<<
"copy file from : "
<<
fileinfo
.
absoluteFilePath
()
<<
" to "
<<
path
+
day
+
"/"
+
fileinfo
.
fileName
();
QLOG_DEBUG
()
<<
"copy file from : "
<<
fileinfo
.
absoluteFilePath
()
<<
" to "
<<
path
+
tmp
day
+
"/"
+
fileinfo
.
fileName
();
return
QFile
::
copy
(
fileinfo
.
absoluteFilePath
(),
path
+
day
+
"/"
+
fileinfo
.
fileName
());
return
QFile
::
copy
(
fileinfo
.
absoluteFilePath
(),
path
+
tmp
day
+
"/"
+
fileinfo
.
fileName
());
}
void
clearDirForPath
(
QString
path
)
...
...
@@ -228,7 +228,7 @@ void echosuccess(QString filename, QString dats)
}
bool
doCopyFileToLocat
()
bool
doCopyFileToLocat
(
QString
tmpday
,
QString
tmpday2
,
QString
weeks
)
{
QDir
dir
(
DEFALUT_FILEPATH
);
dir
.
setFilter
(
QDir
::
Files
);
...
...
@@ -240,23 +240,23 @@ bool doCopyFileToLocat()
QFileInfoList
list
=
dir
.
entryInfoList
();
if
(
IsSuccess
(
stldtmppath
+
day
+
"/"
+
SUCCESS_FILENAME
,
abday
))
if
(
IsSuccess
(
stldtmppath
+
tmp
day
+
"/"
+
SUCCESS_FILENAME
,
abday
))
{
QLOG_WARN
()
<<
"find success file : "
<<
stldtmppath
+
day
+
"/"
+
SUCCESS_FILENAME
;
QLOG_WARN
()
<<
"find success file : "
<<
stldtmppath
+
tmp
day
+
"/"
+
SUCCESS_FILENAME
;
return
true
;
}
clearDirForPath
(
stldtmppath
+
day
+
"/"
);
clearDirForPath
(
stldtmppath
+
tmp
day
+
"/"
);
int
copyfilesnum
=
0
;
foreach
(
QFileInfo
tmp
,
list
)
{
if
(
tmp
.
fileName
().
endsWith
(
".xml.gz"
))
if
(
tmp
.
fileName
().
endsWith
(
".xml.gz"
)
&&
(
tmp
.
fileName
().
contains
(
tmpday2
)
||
tmp
.
fileName
().
contains
(
weeks
))
)
{
QLOG_DEBUG
()
<<
"|"
<<
tmp
.
absoluteFilePath
();
if
(
copyfiles
(
tmp
,
stldtmppath
,
day
))
if
(
copyfiles
(
tmp
,
stldtmppath
,
tmp
day
))
{
++
copyfilesnum
;
if
(
tmp
.
fileName
().
startsWith
(
"DSOS"
,
Qt
::
CaseInsensitive
))
...
...
@@ -277,8 +277,66 @@ bool doCopyFileToLocat()
return
((
copyfilesnum
>=
3
&&
flagDSOS
&&
flagSTLD
&&
flagNP6
)
?
true
:
false
);
}
int
GetWeek
(
int
days
,
int
week
)
{
int
oneweek
=
days
-
week
-
1
;
if
(
oneweek
<
0
)
return
0
;
return
(
oneweek
/
7
+
1
);
}
//int a[] = {31, 28, 31, 30, 31, 30, 31,31, 30, 31, 30, 31};
//void judge_day(int Year, int Month, int Day, int *result_day)
//{
// int Total = 0;
// int i = 0;
// if( (((Year%400) == 0) || ((Year%4) == 0)) && ((Year %100) != 0))
// {
// a[1] = 29;
// }
// for(i=0;i<Month-1;i++)
// {
// Total += a[i];
// }
// Total += Day;
// *result_day = Total;
//}
void
GetWeeks
(
QDateTime
&
tmptime2
,
QString
&
weeks
)
{
// int days = 0;
// int year = tmptime2.toString("YYYY").toInt();
// int mouth = tmptime2.toString("MM").toInt();
// int day = tmptime2.toString("DD").toInt();
// QLOG_DEBUG() << "GetWeeks:year" << year << "GetWeeks:mouth" << mouth << "GetWeeks:day" << day;
// judge_day(year, mouth, day, days);
// tmptime2.date().dayOfWeek();
QLOG_DEBUG
()
<<
"day : "
<<
tmptime2
.
toString
(
"yyyyMMdd"
);
QLOG_DEBUG
()
<<
"days : "
<<
tmptime2
.
date
().
dayOfYear
()
<<
"week : "
<<
tmptime2
.
date
().
dayOfWeek
()
%
7
;
int
tmpweeks
=
GetWeek
(
tmptime2
.
date
().
dayOfYear
(),
tmptime2
.
date
().
dayOfWeek
()
%
7
);
QLOG_INFO
()
<<
"get tmp weeks : "
<<
tmpweeks
;
weeks
=
QString
::
number
(
tmpweeks
)
+
QString
::
number
(
tmptime2
.
date
().
dayOfWeek
()
%
7
)
+
tmptime2
.
toString
(
"yyyy"
);
QLOG_INFO
()
<<
"get weeks : "
<<
weeks
;
}
bool
CopyFileToLocat
()
{
bool
flag
=
false
;
QFile
flagfile
(
DEFALUT_FLAG_FILENAME
);
if
(
!
flagfile
.
exists
())
...
...
@@ -287,7 +345,28 @@ bool CopyFileToLocat()
return
false
;
}
return
doCopyFileToLocat
();
QDateTime
time
=
QDateTime
::
currentDateTime
();
for
(
auto
i
=
0
;
i
>
-
30
;
--
i
)
{
QDateTime
tmptime1
=
time
.
addDays
(
i
);
QDateTime
tmptime2
=
time
.
addDays
(
i
-
1
);
QString
tmppath1
=
tmptime1
.
toString
(
"dd"
);
QString
tmppath2
=
tmptime2
.
toString
(
"YYYYMMdd"
);
QString
weeks
;
GetWeeks
(
tmptime2
,
weeks
);
if
(
doCopyFileToLocat
(
tmppath1
,
tmppath2
,
weeks
))
{
if
(
i
==
0
)
flag
=
true
;
}
}
return
flag
;
}
bool
uploadfile
(
QString
zipfile
,
QString
zipfilename
)
...
...
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