Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hg-smart
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
platform
hg-smart
Commits
1a4aa715
Commit
1a4aa715
authored
Oct 12, 2024
by
宋祥
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-sx' of
http://git.pseer.com:8800/platform/hg-smart
into dev
parents
97636a5c
4974c17c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
13 deletions
+55
-13
FileTools.java
src/main/java/com/baosight/hggp/core/tools/FileTools.java
+37
-0
ServiceHGWD001.java
.../java/com/baosight/hggp/hg/wd/service/ServiceHGWD001.java
+16
-0
ClearZipJob.java
src/main/java/com/baosight/hggp/job/ClearZipJob.java
+2
-13
No files found.
src/main/java/com/baosight/hggp/core/tools/FileTools.java
0 → 100644
View file @
1a4aa715
package
com
.
baosight
.
hggp
.
core
.
tools
;
import
com.baosight.hggp.core.constant.OSConstant
;
import
com.baosight.hggp.util.DateUtils
;
import
com.baosight.hggp.util.FileUtils
;
import
java.io.File
;
import
java.time.LocalDate
;
import
lombok.extern.slf4j.Slf4j
;
/**
* @author:songx
* @date:2024/10/12,10:27
*/
@Slf4j
public
class
FileTools
{
/**
* 清理ZIP文件
*/
public
static
void
clearZip
()
{
File
zipFolder
=
new
File
(
OSConstant
.
ZIP_DIR
);
File
[]
zipFolderFiles
=
zipFolder
.
listFiles
();
if
(
zipFolderFiles
.
length
==
0
)
{
log
.
warn
(
"清理ZIP文件:无有效的文件"
);
}
for
(
File
zipFolderFile
:
zipFolderFiles
)
{
String
folderName
=
zipFolderFile
.
getName
();
// 当天以前的文件夹全部删除
if
(
LocalDate
.
parse
(
folderName
,
DateUtils
.
SHORT_DATE
).
isBefore
(
LocalDate
.
now
()))
{
FileUtils
.
deleteFiles
(
zipFolderFile
);
}
}
log
.
info
(
"清理ZIP文件成功!!!"
);
}
}
src/main/java/com/baosight/hggp/hg/wd/service/ServiceHGWD001.java
View file @
1a4aa715
...
@@ -7,6 +7,7 @@ import com.baosight.hggp.core.constant.CommonConstant;
...
@@ -7,6 +7,7 @@ import com.baosight.hggp.core.constant.CommonConstant;
import
com.baosight.hggp.core.dao.DaoUtils
;
import
com.baosight.hggp.core.dao.DaoUtils
;
import
com.baosight.hggp.core.enums.OrgTypeEnum
;
import
com.baosight.hggp.core.enums.OrgTypeEnum
;
import
com.baosight.hggp.core.security.UserSessionUtils
;
import
com.baosight.hggp.core.security.UserSessionUtils
;
import
com.baosight.hggp.core.tools.FileTools
;
import
com.baosight.hggp.core.tools.Iplat4jTools
;
import
com.baosight.hggp.core.tools.Iplat4jTools
;
import
com.baosight.hggp.core.utils.Iplat4jUtils
;
import
com.baosight.hggp.core.utils.Iplat4jUtils
;
import
com.baosight.hggp.hg.constant.HGConstant
;
import
com.baosight.hggp.hg.constant.HGConstant
;
...
@@ -581,4 +582,19 @@ public class ServiceHGWD001 extends ServiceEPBase {
...
@@ -581,4 +582,19 @@ public class ServiceHGWD001 extends ServiceEPBase {
return
inInfo
;
return
inInfo
;
}
}
/**
* 清理下载的文件
*
* @param inInfo
* @return
*/
public
EiInfo
clearDownload
(
EiInfo
inInfo
)
{
try
{
FileTools
.
clearZip
();
}
catch
(
Exception
e
)
{
LogUtils
.
setMsg
(
inInfo
,
e
,
"清理下载的文件失败"
);
}
return
inInfo
;
}
}
}
src/main/java/com/baosight/hggp/job/ClearZipJob.java
View file @
1a4aa715
package
com
.
baosight
.
hggp
.
job
;
package
com
.
baosight
.
hggp
.
job
;
import
com.baosight.hggp.core.constant.OSConstant
;
import
com.baosight.hggp.core.constant.OSConstant
;
import
com.baosight.hggp.core.tools.FileTools
;
import
com.baosight.hggp.util.DateUtil
;
import
com.baosight.hggp.util.DateUtil
;
import
com.baosight.hggp.util.DateUtils
;
import
com.baosight.hggp.util.DateUtils
;
import
com.baosight.hggp.util.FileUtils
;
import
com.baosight.hggp.util.FileUtils
;
...
@@ -29,19 +30,7 @@ public class ClearZipJob {
...
@@ -29,19 +30,7 @@ public class ClearZipJob {
@Scheduled
(
cron
=
"0 45 0/3 * * ? "
)
@Scheduled
(
cron
=
"0 45 0/3 * * ? "
)
public
void
clearZipFile
()
{
public
void
clearZipFile
()
{
try
{
try
{
File
zipFolder
=
new
File
(
OSConstant
.
ZIP_DIR
);
FileTools
.
clearZip
();
File
[]
zipFolderFiles
=
zipFolder
.
listFiles
();
if
(
zipFolderFiles
.
length
==
0
)
{
log
.
warn
(
"清理ZIP文件:无有效的文件"
);
}
for
(
File
zipFolderFile
:
zipFolderFiles
)
{
String
folderName
=
zipFolderFile
.
getName
();
// 当天以前的文件夹全部删除
if
(
LocalDate
.
parse
(
folderName
,
DateUtils
.
SHORT_DATE
).
isBefore
(
LocalDate
.
now
()))
{
FileUtils
.
deleteFiles
(
zipFolderFile
);
}
}
log
.
info
(
"清理ZIP文件成功!!!"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"清理ZIP文件失败:{}"
,
e
.
getMessage
(),
e
);
log
.
error
(
"清理ZIP文件失败:{}"
,
e
.
getMessage
(),
e
);
}
}
...
...
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