Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Jpom
Commits
5a622f8f
Commit
5a622f8f
authored
5 years ago
by
bwcx_jzy
Browse files
Options
Download
Email Patches
Plain Diff
构建删除..
parent
be9b7a88
master
2.6.x
backup-dev
backup-thymeleaf
change-tab
dev
rsync-dev
v2.9.15
v2.9.14
v2.9.13
v2.9.12
v2.9.11
v2.9.10
v2.9.9
v2.9.9.fix
v2.9.8
v2.9.7
v2.9.6
v2.9.5
v2.9.4
v2.9.3
v2.9.2
v2.9.1
v2.9.0
v2.8.25
v2.8.24
v2.8.23
v2.8.22
v2.8.21
v2.8.20
v2.8.19
v2.8.18
v2.8.17
v2.8.16
v2.8.15
v2.8.14
v2.8.13
v2.8.12
v2.8.11
v2.8.10
v2.8.9
v2.8.8
v2.8.7
v2.8.6
v2.8.5
v2.8.4
v2.8.3
v2.8.2
v2.8.1
v2.8.0
v2.8.0-fix
v2.7.3
v2.7.2
v2.7.1
v2.7.0
v2.6.4
v2.6.3
v2.6.2
v2.6.1
v2.6.0
v2.5.2
v2.5.1
v2.5.0.1_fix_docs
v2.5.0
v2.4.9
v2.4.8
v2.4.7
fix-2.8.0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/server/src/main/java/io/jpom/service/dblog/DbBuildHistoryLogService.java
+12
-9
.../java/io/jpom/service/dblog/DbBuildHistoryLogService.java
with
12 additions
and
9 deletions
+12
-9
modules/server/src/main/java/io/jpom/service/dblog/DbBuildHistoryLogService.java
+
12
-
9
View file @
5a622f8f
...
...
@@ -75,10 +75,10 @@ public class DbBuildHistoryLogService extends BaseDbLogService<BuildHistoryLog>
* @param logId 记录id
* @return json
*/
public
JsonMessage
deleteLogAndFile
(
String
logId
)
{
public
JsonMessage
<
String
>
deleteLogAndFile
(
String
logId
)
{
BuildHistoryLog
buildHistoryLog
=
getByKey
(
logId
);
if
(
buildHistoryLog
==
null
)
{
return
new
JsonMessage
(
405
,
"没有对应构建记录"
);
return
new
JsonMessage
<>
(
405
,
"没有对应构建记录"
);
}
BuildModel
item
=
buildService
.
getItem
(
buildHistoryLog
.
getBuildDataId
());
if
(
item
!=
null
)
{
...
...
@@ -87,12 +87,12 @@ public class DbBuildHistoryLogService extends BaseDbLogService<BuildHistoryLog>
if
(
dataFile
.
exists
())
{
boolean
s
=
FileUtil
.
del
(
dataFile
);
if
(!
s
)
{
return
new
JsonMessage
(
500
,
"清理文件失败"
);
return
new
JsonMessage
<>
(
500
,
"清理文件失败"
);
}
}
}
int
count
=
delByKey
(
logId
);
return
new
JsonMessage
<>(
200
,
"删除成功"
,
count
);
return
new
JsonMessage
<>(
200
,
"删除成功"
,
count
+
""
);
}
@Override
...
...
@@ -101,17 +101,20 @@ public class DbBuildHistoryLogService extends BaseDbLogService<BuildHistoryLog>
// 清理总数据
int
buildMaxHistoryCount
=
ServerExtConfigBean
.
getInstance
().
getBuildMaxHistoryCount
();
DbConfig
.
autoClear
(
getTableName
(),
"startTime"
,
buildMaxHistoryCount
,
aLong
->
doClearPage
(
1
,
aLong
));
aLong
->
doClearPage
(
1
,
aLong
,
null
));
// 清理单个
int
buildItemMaxHistoryCount
=
ServerExtConfigBean
.
getInstance
().
getBuildItemMaxHistoryCount
();
DbConfig
.
autoClear
(
getTableName
(),
"startTime"
,
buildItemMaxHistoryCount
,
entity
->
entity
.
set
(
"buildDataId"
,
buildHistoryLog
.
getBuildDataId
()),
aLong
->
doClearPage
(
1
,
aLong
));
aLong
->
doClearPage
(
1
,
aLong
,
buildHistoryLog
.
getBuildDataId
()
));
}
private
void
doClearPage
(
int
pageNo
,
long
time
)
{
private
void
doClearPage
(
int
pageNo
,
long
time
,
String
buildDataId
)
{
Entity
entity
=
Entity
.
create
(
getTableName
());
entity
.
set
(
"startTime"
,
"< "
+
time
);
if
(
buildDataId
!=
null
)
{
entity
.
set
(
"buildDataId"
,
buildDataId
);
}
Page
page
=
new
Page
(
pageNo
,
10
);
page
.
addOrder
(
new
Order
(
"startTime"
,
Direction
.
DESC
));
PageResult
<
Entity
>
pageResult
;
...
...
@@ -126,13 +129,13 @@ public class DbBuildHistoryLogService extends BaseDbLogService<BuildHistoryLog>
copyOptions
.
setIgnoreCase
(
true
);
BuildHistoryLog
v1
=
BeanUtil
.
mapToBean
(
entity1
,
BuildHistoryLog
.
class
,
copyOptions
);
String
id
=
v1
.
getId
();
JsonMessage
jsonMessage
=
deleteLogAndFile
(
id
);
JsonMessage
<
String
>
jsonMessage
=
deleteLogAndFile
(
id
);
if
(
jsonMessage
.
getCode
()
!=
HttpStatus
.
HTTP_OK
)
{
DefaultSystemLog
.
getLog
().
info
(
jsonMessage
.
toString
());
}
});
if
(
pageResult
.
getTotalPage
()
>
pageResult
.
getPage
())
{
doClearPage
(
pageNo
+
1
,
time
);
doClearPage
(
pageNo
+
1
,
time
,
buildDataId
);
}
}
catch
(
SQLException
e
)
{
DefaultSystemLog
.
getLog
().
error
(
"数据库查询异常"
,
e
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help