Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
jgjk
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
任建宇
jgjk
Commits
d0665a21
提交
d0665a21
authored
9月 14, 2020
作者:
liupengfei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
d2974490
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
184 行增加
和
245 行删除
+184
-245
DatabaseController.java
.../zrqx/resource/bg/controller/task/DatabaseController.java
+184
-245
没有找到文件。
app/resource/src/main/java/com/zrqx/resource/bg/controller/task/DatabaseController.java
浏览文件 @
d0665a21
...
...
@@ -35,10 +35,10 @@ import io.swagger.annotations.ApiOperation;
@Api
(
description
=
"资源管理-导出任务"
)
public
class
DatabaseController
{
private
String
url
=
"jdbc:mysql://192.168.2.229:3306/
zzfszzy-
resource"
;
private
String
fileurl
=
"jdbc:mysql://192.168.2.229:3306/
zzfszzy-
file"
;
private
String
url
=
"jdbc:mysql://192.168.2.229:3306/
hxwza_
resource"
;
private
String
fileurl
=
"jdbc:mysql://192.168.2.229:3306/
hxwza_
file"
;
private
String
userName
=
"root"
;
private
String
password
=
"
root
"
;
private
String
password
=
"
zrqx2020
"
;
@ApiOperation
(
value
=
"批量导出文件"
,
notes
=
"批量导出文件"
)
@GetMapping
(
value
=
"/file"
)
...
...
@@ -46,7 +46,7 @@ public class DatabaseController {
HttpSession
session
=
request
.
getSession
();
session
.
setAttribute
(
"percentage"
,
"0%"
);
String
basePath
=
"/opt/upload/
zzfszzy
/"
;
String
basePath
=
"/opt/upload/
hxwza
/"
;
String
zipPath
=
"zip/"
+
UUIDUtil
.
getUUID
()
+
".zip"
;
String
zipFileName
=
basePath
+
zipPath
;
ZipOutputStream
out
=
new
ZipOutputStream
(
new
BufferedOutputStream
(
new
FileOutputStream
(
zipFileName
)));
...
...
@@ -124,8 +124,8 @@ public class DatabaseController {
// 前置路径
String
command
=
"/usr/bin/mysqldump -f -c -q "
;
Process
process
=
null
;
String
fileinfo
=
"-uroot -proot -t -h192.168.2.229
zzfszzy
-file"
;
String
resource
=
"-uroot -proot -t -h192.168.2.229
zzfszzy
-resource"
;
String
fileinfo
=
"-uroot -proot -t -h192.168.2.229
hxwza
-file"
;
String
resource
=
"-uroot -proot -t -h192.168.2.229
hxwza
-resource"
;
// 导出fileinfo库
Set
<
String
>
fileList
=
new
HashSet
<
String
>();
if
(
codes
.
contains
(
","
))
{
...
...
@@ -150,60 +150,45 @@ public class DatabaseController {
// 导出 resource库
// 附件库
if
(
resourceType
==
null
||
resourceType
.
contains
(
AllResourceTypeEnum
.
ANNEX
.
getCode
().
toString
()))
{
StringBuffer
ids
=
new
StringBuffer
();
try
(
Connection
conn
=
DriverManager
.
getConnection
(
url
,
userName
,
password
))
{
if
(
codes
.
contains
(
","
))
{
String
[]
codeStr
=
codes
.
split
(
","
);
String
sql
=
"select r.id from res_annex_library r inner join res_annex_library_diy_type rt on r.id =rt.annexid where"
;
String
sql1
=
""
;
for
(
String
code
:
codeStr
)
{
sql
+=
" rt.code like '"
+
code
+
"%' or"
;
sql1
+=
" code like '"
+
code
+
"%' or"
;
}
sql
=
sql
.
substring
(
0
,
sql
.
length
()
-
2
);
sql1
=
sql1
.
substring
(
0
,
sql1
.
length
()
-
2
);
try
(
PreparedStatement
ps
=
conn
.
prepareStatement
(
sql
))
{
ResultSet
resultSet
=
ps
.
executeQuery
();
while
(
resultSet
.
next
())
{
ids
.
append
(
"'"
).
append
(
resultSet
.
getString
(
"id"
)).
append
(
"',"
);
}
}
String
cmdannextype
=
command
+
resource
+
" res_annex_library_diy_type --where \""
+
sql1
+
"\" > "
+
path
+
"annextype.sql"
;
process
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"/bin/sh"
,
"-c"
,
cmdannextype
});
process
.
waitFor
();
}
else
{
try
(
PreparedStatement
ps
=
conn
.
prepareStatement
(
"select r.id from res_annex_library r inner join res_annex_library_diy_type rt on r.id =rt.annexid where rt.code like '"
+
codes
+
"%'"
))
{
ResultSet
resultSet
=
ps
.
executeQuery
();
while
(
resultSet
.
next
())
{
ids
.
append
(
"'"
).
append
(
resultSet
.
getString
(
"id"
)).
append
(
"',"
);
}
}
String
cmdannextype
=
command
+
resource
+
" res_annex_library_diy_type --where \"code like '"
+
codes
+
"%'\" > "
+
path
+
"annextype.sql"
;
process
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"/bin/sh"
,
"-c"
,
cmdannextype
});
process
.
waitFor
();
}
}
if
(
ids
.
length
()
>
0
)
{
ids
=
ids
.
deleteCharAt
(
ids
.
length
()
-
1
);
String
cmdannex
=
command
+
resource
+
" res_annex_library --where \"id in ("
+
ids
+
")\" > "
+
path
+
"annex.sql"
;
process
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"/bin/sh"
,
"-c"
,
cmdannex
});
process
.
waitFor
();
String
cmdannexcontent
=
command
+
resource
+
" res_annex_library_label_content_diy_type --where \"annexId in ("
+
ids
+
")\" > "
+
path
+
"annexcontent.sql"
;
process
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"/bin/sh"
,
"-c"
,
cmdannexcontent
});
process
.
waitFor
();
}
}
/*
* if (resourceType == null ||
* resourceType.contains(AllResourceTypeEnum.ANNEX.getCode().toString())) {
* StringBuffer ids = new StringBuffer(); try (Connection conn =
* DriverManager.getConnection(url, userName, password)) { if
* (codes.contains(",")) { String[] codeStr = codes.split(","); String sql =
* "select r.id from res_annex_library r inner join res_annex_library_diy_type rt on r.id =rt.annexid where"
* ; String sql1 = ""; for (String code : codeStr) { sql += " rt.code like '" +
* code + "%' or"; sql1 += " code like '" + code + "%' or"; } sql =
* sql.substring(0, sql.length() - 2); sql1 = sql1.substring(0, sql1.length() -
* 2); try (PreparedStatement ps = conn.prepareStatement(sql)) { ResultSet
* resultSet = ps.executeQuery(); while (resultSet.next()) {
* ids.append("'").append(resultSet.getString("id")).append("',"); } } String
* cmdannextype = command + resource + " res_annex_library_diy_type --where \""
* + sql1 + "\" > " + path + "annextype.sql";
*
* process = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c",
* cmdannextype }); process.waitFor(); } else { try (PreparedStatement ps =
* conn.prepareStatement(
* "select r.id from res_annex_library r inner join res_annex_library_diy_type rt on r.id =rt.annexid where rt.code like '"
* + codes + "%'")) { ResultSet resultSet = ps.executeQuery(); while
* (resultSet.next()) {
* ids.append("'").append(resultSet.getString("id")).append("',"); }
*
* } String cmdannextype = command + resource +
* " res_annex_library_diy_type --where \"code like '" + codes + "%'\" > " +
* path + "annextype.sql"; process = Runtime.getRuntime().exec(new String[] {
* "/bin/sh", "-c", cmdannextype }); process.waitFor(); }
*
* } if (ids.length() > 0) { ids = ids.deleteCharAt(ids.length() - 1); String
* cmdannex = command + resource + " res_annex_library --where \"id in (" + ids
* + ")\" > " + path + "annex.sql"; process = Runtime.getRuntime().exec(new
* String[] { "/bin/sh", "-c", cmdannex }); process.waitFor(); String
* cmdannexcontent = command + resource +
* " res_annex_library_label_content_diy_type --where \"annexId in (" + ids +
* ")\" > " + path + "annexcontent.sql"; process =
* Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannexcontent });
* process.waitFor(); } }
*/
// 音频
if
(
resourceType
==
null
||
resourceType
.
contains
(
AllResourceTypeEnum
.
AUDIO
.
getCode
().
toString
()))
{
StringBuffer
ids
=
new
StringBuffer
();
...
...
@@ -260,60 +245,46 @@ public class DatabaseController {
}
// 图片
if
(
resourceType
==
null
||
resourceType
.
contains
(
AllResourceTypeEnum
.
IMAGE
.
getCode
().
toString
()))
{
StringBuffer
ids
=
new
StringBuffer
();
try
(
Connection
conn
=
DriverManager
.
getConnection
(
url
,
userName
,
password
))
{
if
(
codes
.
contains
(
","
))
{
String
[]
codeStr
=
codes
.
split
(
","
);
String
sql
=
"select r.id from res_image_Library r inner join res_image_Library_diy_type rt on r.id =rt.ilid where"
;
String
sql1
=
""
;
for
(
String
code
:
codeStr
)
{
sql
+=
" rt.code like '"
+
code
+
"%' or"
;
sql1
+=
" code like '"
+
code
+
"%' or"
;
}
sql
=
sql
.
substring
(
0
,
sql
.
length
()
-
2
);
sql1
=
sql1
.
substring
(
0
,
sql1
.
length
()
-
2
);
try
(
PreparedStatement
ps
=
conn
.
prepareStatement
(
sql
))
{
ResultSet
resultSet
=
ps
.
executeQuery
();
while
(
resultSet
.
next
())
{
ids
.
append
(
"'"
).
append
(
resultSet
.
getString
(
"id"
)).
append
(
"',"
);
}
}
String
cmdannextype
=
command
+
resource
+
" res_image_Library_diy_type --where \""
+
sql1
+
"\" > "
+
path
+
"audiotype.sql"
;
process
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"/bin/sh"
,
"-c"
,
cmdannextype
});
process
.
waitFor
();
}
else
{
try
(
PreparedStatement
ps
=
conn
.
prepareStatement
(
"select r.id from res_image_Library r inner join res_image_Library_diy_type rt on r.id =rt.ilid where rt.code like '"
+
codes
+
"%'"
))
{
ResultSet
resultSet
=
ps
.
executeQuery
();
while
(
resultSet
.
next
())
{
ids
.
append
(
"'"
).
append
(
resultSet
.
getString
(
"id"
)).
append
(
"',"
);
}
}
String
cmdannextype
=
command
+
resource
+
" res_image_Library_diy_type --where \"code like '"
+
codes
+
"%'\" > "
+
path
+
"imagetype.sql"
;
process
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"/bin/sh"
,
"-c"
,
cmdannextype
});
process
.
waitFor
();
}
}
if
(
ids
.
length
()
>
0
)
{
ids
=
ids
.
deleteCharAt
(
ids
.
length
()
-
1
);
String
cmdannex
=
command
+
resource
+
" res_image_Library --where \"id in ("
+
ids
+
")\" > "
+
path
+
"image.sql"
;
process
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"/bin/sh"
,
"-c"
,
cmdannex
});
process
.
waitFor
();
String
cmdannexcontent
=
command
+
resource
+
" res_image_Library_label_content_diy_type --where \"imageId in ("
+
ids
+
")\" > "
+
path
+
"imagecontent.sql"
;
process
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"/bin/sh"
,
"-c"
,
cmdannexcontent
});
process
.
waitFor
();
}
}
/*
* if (resourceType == null ||
* resourceType.contains(AllResourceTypeEnum.IMAGE.getCode().toString())) {
* StringBuffer ids = new StringBuffer(); try (Connection conn =
* DriverManager.getConnection(url, userName, password)) { if
* (codes.contains(",")) { String[] codeStr = codes.split(","); String sql =
* "select r.id from res_image_Library r inner join res_image_Library_diy_type rt on r.id =rt.ilid where"
* ; String sql1 = ""; for (String code : codeStr) { sql += " rt.code like '" +
* code + "%' or"; sql1 += " code like '" + code + "%' or"; } sql =
* sql.substring(0, sql.length() - 2); sql1 = sql1.substring(0, sql1.length() -
* 2); try (PreparedStatement ps = conn.prepareStatement(sql)) { ResultSet
* resultSet = ps.executeQuery(); while (resultSet.next()) {
* ids.append("'").append(resultSet.getString("id")).append("',"); } } String
* cmdannextype = command + resource + " res_image_Library_diy_type --where \""
* + sql1 + "\" > " + path + "audiotype.sql"; process =
* Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannextype });
* process.waitFor(); } else { try (PreparedStatement ps =
* conn.prepareStatement(
* "select r.id from res_image_Library r inner join res_image_Library_diy_type rt on r.id =rt.ilid where rt.code like '"
* + codes + "%'")) { ResultSet resultSet = ps.executeQuery(); while
* (resultSet.next()) {
* ids.append("'").append(resultSet.getString("id")).append("',"); }
*
* } String cmdannextype = command + resource +
* " res_image_Library_diy_type --where \"code like '" + codes + "%'\" > " +
* path + "imagetype.sql"; process = Runtime.getRuntime().exec(new String[] {
* "/bin/sh", "-c", cmdannextype }); process.waitFor(); }
*
* } if (ids.length() > 0) { ids = ids.deleteCharAt(ids.length() - 1); String
* cmdannex = command + resource + " res_image_Library --where \"id in (" + ids
* + ")\" > " + path + "image.sql"; process = Runtime.getRuntime().exec(new
* String[] { "/bin/sh", "-c", cmdannex }); process.waitFor(); String
* cmdannexcontent = command + resource +
* " res_image_Library_label_content_diy_type --where \"imageId in (" + ids +
* ")\" > " + path + "imagecontent.sql"; process =
* Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannexcontent });
* process.waitFor(); }
*
* }
*/
// pdf
/*if (resourceType == null || resourceType.contains(AllResourceTypeEnum.PDF.getCode().toString())) {
StringBuffer ids = new StringBuffer();
...
...
@@ -370,7 +341,7 @@ public class DatabaseController {
try
(
Connection
conn
=
DriverManager
.
getConnection
(
url
,
userName
,
password
))
{
if
(
codes
.
contains
(
","
))
{
String
[]
codeStr
=
codes
.
split
(
","
);
String
sql
=
"select r.id from res_video_Library r inner join res_video_Library_diy_type rt on r.id =rt.v
l
id where"
;
String
sql
=
"select r.id from res_video_Library r inner join res_video_Library_diy_type rt on r.id =rt.v
ideo
id where"
;
String
sql1
=
""
;
for
(
String
code
:
codeStr
)
{
sql
+=
" rt.code like '"
+
code
+
"%' or"
;
...
...
@@ -390,7 +361,7 @@ public class DatabaseController {
process
.
waitFor
();
}
else
{
try
(
PreparedStatement
ps
=
conn
.
prepareStatement
(
"select r.id from res_video_library r inner join res_video_library_diy_type rt on r.id =rt.v
l
id where rt.code like '"
"select r.id from res_video_library r inner join res_video_library_diy_type rt on r.id =rt.v
ideo
id where rt.code like '"
+
codes
+
"%'"
))
{
ResultSet
resultSet
=
ps
.
executeQuery
();
while
(
resultSet
.
next
())
{
...
...
@@ -412,7 +383,7 @@ public class DatabaseController {
process
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"/bin/sh"
,
"-c"
,
cmdannex
});
process
.
waitFor
();
String
cmdannexcontent
=
command
+
resource
+
" res_video_library_label_content_diy_type --where \"v
l
id in ("
+
ids
+
")\" > "
+
path
+
" res_video_library_label_content_diy_type --where \"v
ideo
id in ("
+
ids
+
")\" > "
+
path
+
"videocontent.sql"
;
process
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"/bin/sh"
,
"-c"
,
cmdannexcontent
});
process
.
waitFor
();
...
...
@@ -420,60 +391,46 @@ public class DatabaseController {
}
// 课程
if
(
resourceType
==
null
||
resourceType
.
contains
(
AllResourceTypeEnum
.
COURSE
.
getCode
().
toString
()))
{
StringBuffer
ids
=
new
StringBuffer
();
try
(
Connection
conn
=
DriverManager
.
getConnection
(
url
,
userName
,
password
))
{
if
(
codes
.
contains
(
","
))
{
String
[]
codeStr
=
codes
.
split
(
","
);
String
sql
=
"select r.id from res_course_library r inner join res_course_library_diy_type rt on r.id =rt.courseLibraryId where"
;
String
sql1
=
""
;
for
(
String
code
:
codeStr
)
{
sql
+=
" rt.code like '"
+
code
+
"%' or"
;
sql1
+=
" code like '"
+
code
+
"%' or"
;
}
sql
=
sql
.
substring
(
0
,
sql
.
length
()
-
2
);
sql1
=
sql1
.
substring
(
0
,
sql1
.
length
()
-
2
);
try
(
PreparedStatement
ps
=
conn
.
prepareStatement
(
sql
))
{
ResultSet
resultSet
=
ps
.
executeQuery
();
while
(
resultSet
.
next
())
{
ids
.
append
(
"'"
).
append
(
resultSet
.
getString
(
"id"
)).
append
(
"',"
);
}
}
String
cmdannextype
=
command
+
resource
+
" res_course_library_diy_type --where \""
+
sql1
+
"\" > "
+
path
+
"coursetype.sql"
;
process
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"/bin/sh"
,
"-c"
,
cmdannextype
});
process
.
waitFor
();
}
else
{
try
(
PreparedStatement
ps
=
conn
.
prepareStatement
(
"select r.id from res_video_library r inner join res_course_library_diy_type rt on r.id =rt.courseLibraryId where rt.code like '"
+
codes
+
"%'"
))
{
ResultSet
resultSet
=
ps
.
executeQuery
();
while
(
resultSet
.
next
())
{
ids
.
append
(
"'"
).
append
(
resultSet
.
getString
(
"id"
)).
append
(
"',"
);
}
}
String
cmdannextype
=
command
+
resource
+
" res_video_library_diy_type --where \"code like '"
+
codes
+
"%'\" > "
+
path
+
"coursetype.sql"
;
process
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"/bin/sh"
,
"-c"
,
cmdannextype
});
process
.
waitFor
();
}
}
if
(
ids
.
length
()
>
0
)
{
ids
=
ids
.
deleteCharAt
(
ids
.
length
()
-
1
);
String
cmdannex
=
command
+
resource
+
" res_course_library --where \"id in ("
+
ids
+
")\" > "
+
path
+
"course.sql"
;
process
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"/bin/sh"
,
"-c"
,
cmdannex
});
process
.
waitFor
();
String
cmdannexcontent
=
command
+
resource
+
" res_course_library_label_content_diy_type --where \"courseLibraryId in ("
+
ids
+
")\" > "
+
path
+
"coursecontent.sql"
;
process
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"/bin/sh"
,
"-c"
,
cmdannexcontent
});
process
.
waitFor
();
}
}
/*
* if (resourceType == null ||
* resourceType.contains(AllResourceTypeEnum.COURSE.getCode().toString())) {
* StringBuffer ids = new StringBuffer(); try (Connection conn =
* DriverManager.getConnection(url, userName, password)) { if
* (codes.contains(",")) { String[] codeStr = codes.split(","); String sql =
* "select r.id from res_course_library r inner join res_course_library_diy_type rt on r.id =rt.courseLibraryId where"
* ; String sql1 = ""; for (String code : codeStr) { sql += " rt.code like '" +
* code + "%' or"; sql1 += " code like '" + code + "%' or"; } sql =
* sql.substring(0, sql.length() - 2); sql1 = sql1.substring(0, sql1.length() -
* 2); try (PreparedStatement ps = conn.prepareStatement(sql)) { ResultSet
* resultSet = ps.executeQuery(); while (resultSet.next()) {
* ids.append("'").append(resultSet.getString("id")).append("',"); } } String
* cmdannextype = command + resource + " res_course_library_diy_type --where \""
* + sql1 + "\" > " + path + "coursetype.sql"; process =
* Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannextype });
* process.waitFor(); } else { try (PreparedStatement ps =
* conn.prepareStatement(
* "select r.id from res_video_library r inner join res_course_library_diy_type rt on r.id =rt.courseLibraryId where rt.code like '"
* + codes + "%'")) { ResultSet resultSet = ps.executeQuery(); while
* (resultSet.next()) {
* ids.append("'").append(resultSet.getString("id")).append("',"); }
*
* } String cmdannextype = command + resource +
* " res_video_library_diy_type --where \"code like '" + codes + "%'\" > " +
* path + "coursetype.sql"; process = Runtime.getRuntime().exec(new String[] {
* "/bin/sh", "-c", cmdannextype }); process.waitFor(); }
*
* } if (ids.length() > 0) { ids = ids.deleteCharAt(ids.length() - 1); String
* cmdannex = command + resource + " res_course_library --where \"id in (" + ids
* + ")\" > " + path + "course.sql"; process = Runtime.getRuntime().exec(new
* String[] { "/bin/sh", "-c", cmdannex }); process.waitFor(); String
* cmdannexcontent = command + resource +
* " res_course_library_label_content_diy_type --where \"courseLibraryId in (" +
* ids + ")\" > " + path + "coursecontent.sql"; process =
* Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", cmdannexcontent });
* process.waitFor(); }
*
* }
*/
// 文章
if
(
resourceType
==
null
||
resourceType
.
contains
(
AllResourceTypeEnum
.
ARTICLE
.
getCode
().
toString
()))
{
StringBuffer
ids
=
new
StringBuffer
();
...
...
@@ -522,7 +479,7 @@ public class DatabaseController {
process
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"/bin/sh"
,
"-c"
,
cmdannex
});
process
.
waitFor
();
String
cmdannexcontent
=
command
+
resource
+
" res_article_library_label_content_diy_type --where \"v
l
id in ("
+
ids
+
")\" > "
+
path
+
" res_article_library_label_content_diy_type --where \"v
ideo
id in ("
+
ids
+
")\" > "
+
path
+
"articlecontent.sql"
;
process
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"/bin/sh"
,
"-c"
,
cmdannexcontent
});
process
.
waitFor
();
...
...
@@ -580,7 +537,7 @@ public class DatabaseController {
+
"ebook.sql"
;
process
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"/bin/sh"
,
"-c"
,
cmdebook
});
process
.
waitFor
();
String
cmdebookcontent
=
command
+
resource
+
" res_ebook_label_content_diy_type --where \"v
l
id in ("
String
cmdebookcontent
=
command
+
resource
+
" res_ebook_label_content_diy_type --where \"v
ideo
id in ("
+
ids
+
")\" > "
+
path
+
"ebookcontent.sql"
;
process
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"/bin/sh"
,
"-c"
,
cmdebookcontent
});
process
.
waitFor
();
...
...
@@ -599,7 +556,7 @@ public class DatabaseController {
}
}
//打包生成zip
String
basePath
=
"/opt/upload/
zzfszzy
/"
;
String
basePath
=
"/opt/upload/
hxwza
/"
;
String
zipPath
=
"zip/"
+
UUIDUtil
.
getUUID
()
+
".zip"
;
String
zipFileName
=
basePath
+
zipPath
;
ZipOutputStream
out
=
new
ZipOutputStream
(
new
BufferedOutputStream
(
new
FileOutputStream
(
zipFileName
)));
...
...
@@ -628,49 +585,44 @@ public class DatabaseController {
Set
<
String
>
fileList
=
new
HashSet
<
String
>();
// 附件
if
(
resourceType
==
null
||
resourceType
.
contains
(
AllResourceTypeEnum
.
ANNEX
.
getCode
().
toString
()))
{
try
(
Connection
conn
=
DriverManager
.
getConnection
(
url
,
userName
,
password
))
{
try
(
PreparedStatement
ps
=
conn
.
prepareStatement
(
"select r.annex,r.cover from res_annex_library r inner join res_annex_library_diy_type rt on r.id =rt.annexid where rt.code like '"
+
code
+
"%'"
))
{
ResultSet
resultSet
=
ps
.
executeQuery
();
while
(
resultSet
.
next
())
{
if
(
resultSet
.
getString
(
"annex"
)
!=
null
)
{
fileList
.
add
(
resultSet
.
getString
(
"annex"
));
}
if
(
resultSet
.
getString
(
"cover"
)
!=
null
)
{
fileList
.
add
(
resultSet
.
getString
(
"cover"
));
}
}
}
}
}
/*
* if (resourceType == null ||
* resourceType.contains(AllResourceTypeEnum.ANNEX.getCode().toString())) { try
* (Connection conn = DriverManager.getConnection(url, userName, password)) {
* try (PreparedStatement ps = conn.prepareStatement(
* "select r.annex,r.cover from res_annex_library r inner join res_annex_library_diy_type rt on r.id =rt.annexid where rt.code like '"
* + code + "%'")) { ResultSet resultSet = ps.executeQuery(); while
* (resultSet.next()) { if (resultSet.getString("annex") != null) {
* fileList.add(resultSet.getString("annex")); } if
* (resultSet.getString("cover") != null) {
* fileList.add(resultSet.getString("cover")); } } } } }
*/
// 文章
if
(
resourceType
==
null
||
resourceType
.
contains
(
AllResourceTypeEnum
.
ARTICLE
.
getCode
().
toString
()))
{
try
(
Connection
conn
=
DriverManager
.
getConnection
(
url
,
userName
,
password
))
{
try
(
PreparedStatement
ps
=
conn
.
prepareStatement
(
"select r.pdf,r.
img
from res_article_library r inner join res_article_library_diy_type rt on r.id =rt.alid where rt.code like '"
"select r.pdf,r.
cover
from res_article_library r inner join res_article_library_diy_type rt on r.id =rt.alid where rt.code like '"
+
code
+
"%'"
))
{
ResultSet
resultSet
=
ps
.
executeQuery
();
while
(
resultSet
.
next
())
{
if
(
resultSet
.
getString
(
"pdf"
)
!=
null
)
{
fileList
.
add
(
resultSet
.
getString
(
"pdf"
));
}
if
(
resultSet
.
getString
(
"
img
"
)
!=
null
)
{
fileList
.
add
(
resultSet
.
getString
(
"
img
"
));
if
(
resultSet
.
getString
(
"
cover
"
)
!=
null
)
{
fileList
.
add
(
resultSet
.
getString
(
"
cover
"
));
}
}
}
try
(
PreparedStatement
ps
=
conn
.
prepareStatement
(
"select r.pdf,r.
img
from res_article_library r inner join res_ebook_diy_type rt on r.bookId =rt.ebookId where rt.code like '"
"select r.pdf,r.
cover
from res_article_library r inner join res_ebook_diy_type rt on r.bookId =rt.ebookId where rt.code like '"
+
code
+
"%'"
))
{
ResultSet
resultSet
=
ps
.
executeQuery
();
while
(
resultSet
.
next
())
{
if
(
resultSet
.
getString
(
"pdf"
)
!=
null
)
{
fileList
.
add
(
resultSet
.
getString
(
"pdf"
));
}
if
(
resultSet
.
getString
(
"
img
"
)
!=
null
)
{
fileList
.
add
(
resultSet
.
getString
(
"
img
"
));
if
(
resultSet
.
getString
(
"
cover
"
)
!=
null
)
{
fileList
.
add
(
resultSet
.
getString
(
"
cover
"
));
}
}
}
...
...
@@ -696,38 +648,28 @@ public class DatabaseController {
}
}
// 图片
if
(
resourceType
==
null
||
resourceType
.
contains
(
AllResourceTypeEnum
.
IMAGE
.
getCode
().
toString
()))
{
try
(
Connection
conn
=
DriverManager
.
getConnection
(
url
,
userName
,
password
))
{
try
(
PreparedStatement
ps
=
conn
.
prepareStatement
(
"select r.image,r.image_sl from res_image_library r inner join res_image_library_diy_type rt on r.id =rt.ilid where rt.code like '"
+
code
+
"%'"
))
{
ResultSet
resultSet
=
ps
.
executeQuery
();
while
(
resultSet
.
next
())
{
if
(
resultSet
.
getString
(
"image"
)
!=
null
)
{
fileList
.
add
(
resultSet
.
getString
(
"image"
));
}
if
(
resultSet
.
getString
(
"image_sl"
)
!=
null
)
{
fileList
.
add
(
resultSet
.
getString
(
"image_sl"
));
}
}
}
try
(
PreparedStatement
ps
=
conn
.
prepareStatement
(
"select r.image,r.image_sl from res_image_library r inner join res_ebook_diy_type rt on r.bookId =rt.ebookId where rt.code like '"
+
code
+
"%'"
))
{
ResultSet
resultSet
=
ps
.
executeQuery
();
while
(
resultSet
.
next
())
{
if
(
resultSet
.
getString
(
"image"
)
!=
null
)
{
fileList
.
add
(
resultSet
.
getString
(
"image"
));
}
if
(
resultSet
.
getString
(
"image_sl"
)
!=
null
)
{
fileList
.
add
(
resultSet
.
getString
(
"image_sl"
));
}
}
}
}
}
/*
* if (resourceType == null ||
* resourceType.contains(AllResourceTypeEnum.IMAGE.getCode().toString())) { try
* (Connection conn = DriverManager.getConnection(url, userName, password)) {
* try (PreparedStatement ps = conn.prepareStatement(
* "select r.image,r.image_sl from res_image_library r inner join res_image_library_diy_type rt on r.id =rt.ilid where rt.code like '"
* + code + "%'")) { ResultSet resultSet = ps.executeQuery(); while
* (resultSet.next()) { if (resultSet.getString("image") != null) {
* fileList.add(resultSet.getString("image")); } if
* (resultSet.getString("image_sl") != null) {
* fileList.add(resultSet.getString("image_sl")); } }
*
* } try (PreparedStatement ps = conn.prepareStatement(
* "select r.image,r.image_sl from res_image_library r inner join res_ebook_diy_type rt on r.bookId =rt.ebookId where rt.code like '"
* + code + "%'")) { ResultSet resultSet = ps.executeQuery(); while
* (resultSet.next()) { if (resultSet.getString("image") != null) {
* fileList.add(resultSet.getString("image")); } if
* (resultSet.getString("image_sl") != null) {
* fileList.add(resultSet.getString("image_sl")); } }
*
* } } }
*/
// pdf
/*if (resourceType == null || resourceType.contains(AllResourceTypeEnum.PDF.getCode().toString())) {
try (Connection conn = DriverManager.getConnection(url, userName, password)) {
...
...
@@ -748,7 +690,7 @@ public class DatabaseController {
if
(
resourceType
==
null
||
resourceType
.
contains
(
AllResourceTypeEnum
.
VIDEO
.
getCode
().
toString
()))
{
try
(
Connection
conn
=
DriverManager
.
getConnection
(
url
,
userName
,
password
))
{
try
(
PreparedStatement
ps
=
conn
.
prepareStatement
(
"select r.video,r.cover from res_video_library r inner join res_video_library_diy_type rt on r.id =rt.v
l
id where rt.code like '"
"select r.video,r.cover from res_video_library r inner join res_video_library_diy_type rt on r.id =rt.v
ideo
id where rt.code like '"
+
code
+
"%'"
))
{
ResultSet
resultSet
=
ps
.
executeQuery
();
while
(
resultSet
.
next
())
{
...
...
@@ -764,21 +706,18 @@ public class DatabaseController {
}
}
// 课程
if
(
resourceType
==
null
||
resourceType
.
contains
(
AllResourceTypeEnum
.
COURSE
.
getCode
().
toString
()))
{
try
(
Connection
conn
=
DriverManager
.
getConnection
(
url
,
userName
,
password
))
{
try
(
PreparedStatement
ps
=
conn
.
prepareStatement
(
"select r.cover from res_course_library r inner join res_course_library_diy_type rt on r.id =rt.courseLibraryId where rt.code like '"
+
code
+
"%'"
))
{
ResultSet
resultSet
=
ps
.
executeQuery
();
while
(
resultSet
.
next
())
{
if
(
resultSet
.
getString
(
"cover"
)
!=
null
)
{
fileList
.
add
(
resultSet
.
getString
(
"cover"
));
}
}
}
}
}
/*
* if (resourceType == null ||
* resourceType.contains(AllResourceTypeEnum.COURSE.getCode().toString())) { try
* (Connection conn = DriverManager.getConnection(url, userName, password)) {
* try (PreparedStatement ps = conn.prepareStatement(
* "select r.cover from res_course_library r inner join res_course_library_diy_type rt on r.id =rt.courseLibraryId where rt.code like '"
* + code + "%'")) { ResultSet resultSet = ps.executeQuery(); while
* (resultSet.next()) { if (resultSet.getString("cover") != null) {
* fileList.add(resultSet.getString("cover")); } }
*
* } } }
*/
// 图书
if
(
resourceType
==
null
||
resourceType
.
contains
(
AllResourceTypeEnum
.
BOOK
.
getCode
().
toString
()))
{
try
(
Connection
conn
=
DriverManager
.
getConnection
(
url
,
userName
,
password
))
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论