Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
education
Project
Project
Details
Activity
Releases
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
李丛阳
education
Commits
12bf4565
Commit
12bf4565
authored
Oct 23, 2019
by
zhangqingle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改接口
parent
6b21b775
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
23 deletions
+34
-23
BChapterServiceImpl.java
...t/business/bchapter/service/impl/BChapterServiceImpl.java
+26
-19
BViewrangeRepository.java
...rg/rcisoft/business/blesson/dao/BViewrangeRepository.java
+1
-1
OfficeToPdf.java
src/main/java/org/rcisoft/core/util/OfficeToPdf.java
+5
-1
application-mt.yml
src/main/resources/application-mt.yml
+2
-2
No files found.
src/main/java/org/rcisoft/business/bchapter/service/impl/BChapterServiceImpl.java
View file @
12bf4565
...
@@ -307,14 +307,17 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -307,14 +307,17 @@ public class BChapterServiceImpl implements BChapterService {
public
String
changeFile
(
BFile
bFile
){
public
String
changeFile
(
BFile
bFile
){
String
filePath
=
global
.
getBASE_UPLOAD_SERVER_LOCATION
()+
File
.
separator
+
global
.
getCOURSE_LOCATION
()+
File
.
separator
+
bFile
.
getLessonId
();
String
name
=
bFile
.
getVideoUrl
().
substring
(
bFile
.
getVideoUrl
().
lastIndexOf
(
"/"
)+
1
);
String
returnBasePath
=
global
.
getRETURN_UPLOAD_SERVER_LOCATION
()+
File
.
separator
+
global
.
getCOURSE_LOCATION
()+
bFile
.
getLessonId
();
String
filePath
=
global
.
getBASE_UPLOAD_SERVER_LOCATION
()
+
global
.
getCOURSE_LOCATION
()+
File
.
separator
+
bFile
.
getLessonId
();
String
returnBasePath
=
global
.
getRETURN_UPLOAD_SERVER_LOCATION
()+
global
.
getCOURSE_LOCATION
()+
File
.
separator
+
bFile
.
getLessonId
();
File
file
=
new
File
(
filePath
);
File
file
=
new
File
(
filePath
);
//2. pdf 本地是否存在, word ppt 转换后的pdf是否存在
//2. pdf 本地是否存在, word ppt 转换后的pdf是否存在
log
.
debug
(
"------------------z1-----------------------------"
+
filePath
);
log
.
debug
(
"------------------z1-----------------------------"
+
filePath
);
File
fileOld
=
new
File
(
filePath
+
File
.
separator
+
bFile
.
getFileName
()
);
File
fileOld
=
new
File
(
filePath
+
File
.
separator
+
name
);
log
.
debug
(
"------------------z2-----------------------------"
+
fileOld
);
log
.
debug
(
"------------------z2-----------------------------"
+
fileOld
);
String
newName
=
bFile
.
getFileName
().
substring
(
0
,
bFile
.
getFileName
()
.
indexOf
(
"."
))
+
"-pdf.pdf"
;
String
newName
=
name
.
substring
(
0
,
name
.
indexOf
(
"."
))
+
"-pdf.pdf"
;
log
.
debug
(
"------------------z3-----------------------------"
+
newName
);
log
.
debug
(
"------------------z3-----------------------------"
+
newName
);
//转换后的路径
//转换后的路径
File
fileNew
=
new
File
(
filePath
+
File
.
separator
+
newName
);
File
fileNew
=
new
File
(
filePath
+
File
.
separator
+
newName
);
...
@@ -323,7 +326,7 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -323,7 +326,7 @@ public class BChapterServiceImpl implements BChapterService {
log
.
debug
(
"------------------z5-----------------------------"
);
log
.
debug
(
"------------------z5-----------------------------"
);
if
(
fileOld
.
exists
())
{
if
(
fileOld
.
exists
())
{
log
.
debug
(
"------------------z6-----------------------------"
+
fileOld
);
log
.
debug
(
"------------------z6-----------------------------"
+
fileOld
);
return
returnBasePath
+
File
.
separator
+
bFile
.
getFileName
()
;
return
returnBasePath
+
File
.
separator
+
name
;
}
else
{
}
else
{
String
downLoadName
=
downLoadFile
(
bFile
,
file
,
filePath
);
String
downLoadName
=
downLoadFile
(
bFile
,
file
,
filePath
);
log
.
debug
(
"------------------z7-----------------------------"
+
downLoadName
);
log
.
debug
(
"------------------z7-----------------------------"
+
downLoadName
);
...
@@ -332,30 +335,32 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -332,30 +335,32 @@ public class BChapterServiceImpl implements BChapterService {
}
}
//3. pdf不存在,下载 , 删除word ppt,重新下载,转换
//3. pdf不存在,下载 , 删除word ppt,重新下载,转换
if
(
"2"
.
equals
(
bFile
.
getType
())
||
"4"
.
equals
(
bFile
.
getType
()))
{
if
(
"2"
.
equals
(
bFile
.
getType
())
||
"4"
.
equals
(
bFile
.
getType
()))
{
log
.
debug
(
"------------------z
1
-----------------------------"
);
log
.
debug
(
"------------------z
8
-----------------------------"
);
if
(
fileNew
.
exists
())
{
if
(
fileNew
.
exists
())
{
log
.
debug
(
"------------------z
1
-----------------------------"
);
log
.
debug
(
"------------------z
9
-----------------------------"
);
return
returnBasePath
+
File
.
separator
+
newName
;
return
returnBasePath
+
File
.
separator
+
newName
;
}
else
{
}
else
{
log
.
debug
(
"------------------z1-----------------------------"
);
log
.
debug
(
"------------------z1
0
-----------------------------"
);
fileOld
.
delete
();
fileOld
.
delete
();
log
.
debug
(
"------------------z1-----------------------------"
);
log
.
debug
(
"------------------z1
1
-----------------------------"
);
String
downLoadFileUrl
=
downLoadFile
(
bFile
,
file
,
filePath
);
String
downLoadFileUrl
=
downLoadFile
(
bFile
,
file
,
filePath
);
log
.
debug
(
"------------------z1-----------------------------"
);
log
.
debug
(
"------------------z12-----------------------------downLoadFileUrl:"
+
filePath
+
File
.
separator
+
downLoadFileUrl
);
int
result
=
officeToPdf
.
transformToPdf
(
downLoadFileUrl
,
filePath
+
File
.
separator
+
newName
);
log
.
debug
(
"------------------z12-----------------------------filePath:"
+
filePath
+
File
.
separator
+
newName
);
log
.
debug
(
"------------------z1-----------------------------"
);
int
result
=
officeToPdf
.
transformToPdf
(
filePath
+
File
.
separator
+
downLoadFileUrl
,
filePath
+
File
.
separator
+
newName
);
log
.
debug
(
"------------------z13-----------------------------"
);
if
(
result
<
1
)
{
if
(
result
<
1
)
{
log
.
error
(
"文件转换异常"
);
log
.
error
(
"文件转换异常"
);
throw
new
ServiceException
(
ResultServiceEnums
.
CHANGE_FILE_ERROR
);
throw
new
ServiceException
(
ResultServiceEnums
.
CHANGE_FILE_ERROR
);
}
}
//4. 更新在 bfile 表 , ppt和word 存一下转换之后的url filePath
//4. 更新在 bfile 表 , ppt和word 存一下转换之后的url filePath
if
(
StringUtils
.
isNotEmpty
(
bFile
.
getChapterId
())){
if
(
StringUtils
.
isNotEmpty
(
bFile
.
getChapterId
())){
log
.
debug
(
"------------------z1-----------------------------"
);
log
.
debug
(
"------------------z1
4
-----------------------------"
);
bFile
.
setFileUrl
(
filePath
+
File
.
separator
+
newName
);
bFile
.
setFileUrl
(
filePath
+
File
.
separator
+
newName
);
log
.
debug
(
"------------------z1-----------------------------"
);
log
.
debug
(
"------------------z1
5
-----------------------------"
);
bFileRepository
.
updateByPrimaryKeySelective
(
bFile
);
bFileRepository
.
updateByPrimaryKeySelective
(
bFile
);
}
}
log
.
debug
(
"------------------z1-----------------------------"
);
log
.
debug
(
"------------------z1
6
-----------------------------"
);
return
returnBasePath
+
File
.
separator
+
newName
;
return
returnBasePath
+
File
.
separator
+
newName
;
}
}
}
else
{
}
else
{
...
@@ -366,6 +371,8 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -366,6 +371,8 @@ public class BChapterServiceImpl implements BChapterService {
//下载
//下载
public
String
downLoadFile
(
BFile
bFile
,
File
file
,
String
filePath
)
{
public
String
downLoadFile
(
BFile
bFile
,
File
file
,
String
filePath
)
{
String
name
=
bFile
.
getVideoUrl
().
substring
(
bFile
.
getVideoUrl
().
lastIndexOf
(
"/"
)+
1
);
log
.
debug
(
"------------------D1-----------------------------"
+
filePath
);
log
.
debug
(
"------------------D1-----------------------------"
+
filePath
);
//判断文件夹是否存在
//判断文件夹是否存在
if
(!
file
.
exists
())
{
if
(!
file
.
exists
())
{
...
@@ -403,7 +410,7 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -403,7 +410,7 @@ public class BChapterServiceImpl implements BChapterService {
filePath
+=
File
.
separator
;
filePath
+=
File
.
separator
;
}
}
//写入到文件(注意文件保存路径的后面一定要加上文件的名称)
//写入到文件(注意文件保存路径的后面一定要加上文件的名称)
fileOut
=
new
FileOutputStream
(
filePath
+
bFile
.
getFileName
()
);
fileOut
=
new
FileOutputStream
(
filePath
+
name
);
log
.
debug
(
"------------------D10-----------------------------"
);
log
.
debug
(
"------------------D10-----------------------------"
);
BufferedOutputStream
bos
=
new
BufferedOutputStream
(
fileOut
);
BufferedOutputStream
bos
=
new
BufferedOutputStream
(
fileOut
);
log
.
debug
(
"------------------D11-----------------------------"
);
log
.
debug
(
"------------------D11-----------------------------"
);
...
@@ -422,8 +429,8 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -422,8 +429,8 @@ public class BChapterServiceImpl implements BChapterService {
log
.
error
(
e
.
getMessage
()
+
"下载文件异常"
);
log
.
error
(
e
.
getMessage
()
+
"下载文件异常"
);
throw
new
ServiceException
(
ResultServiceEnums
.
DOWNLOAD_ERROR
);
throw
new
ServiceException
(
ResultServiceEnums
.
DOWNLOAD_ERROR
);
}
}
log
.
debug
(
"------------------D13-----------------------------"
+
bFile
.
getFileName
()
);
log
.
debug
(
"------------------D13-----------------------------"
+
name
);
return
bFile
.
getFileName
()
;
return
name
;
}
}
@Override
@Override
...
...
src/main/java/org/rcisoft/business/blesson/dao/BViewrangeRepository.java
View file @
12bf4565
...
@@ -35,7 +35,7 @@ public interface BViewrangeRepository extends BaseMapper<BViewrange> {
...
@@ -35,7 +35,7 @@ public interface BViewrangeRepository extends BaseMapper<BViewrange> {
" <if test='delFlag != null'>del_flag=#{delFlag},</if> "
,
" <if test='delFlag != null'>del_flag=#{delFlag},</if> "
,
" <if test='flag != null'>flag=#{flag},</if> "
,
" <if test='flag != null'>flag=#{flag},</if> "
,
" <if test='remarks != null'>remarks=#{remarks},</if> "
,
" <if test='remarks != null'>remarks=#{remarks},</if> "
,
" <if test='lesson
_i
d != null'>lesson_id=#{lessonId},</if> "
,
" <if test='lesson
I
d != null'>lesson_id=#{lessonId},</if> "
,
" <if test='type != null'>type=#{type},</if> "
,
" <if test='type != null'>type=#{type},</if> "
,
" <if test='corp_id != null'>corp_id=#{corp_id},</if> "
,
" <if test='corp_id != null'>corp_id=#{corp_id},</if> "
,
" </set>"
,
" </set>"
,
...
...
src/main/java/org/rcisoft/core/util/OfficeToPdf.java
View file @
12bf4565
...
@@ -90,19 +90,23 @@ public class OfficeToPdf {
...
@@ -90,19 +90,23 @@ public class OfficeToPdf {
if
(!
inputFile
.
exists
())
{
if
(!
inputFile
.
exists
())
{
return
-
1
;
// 找不到源文件, 则返回-1
return
-
1
;
// 找不到源文件, 则返回-1
}
}
log
.
debug
(
"----------ZH------------"
);
// 如果目标路径不存在, 则新建该路径
// 如果目标路径不存在, 则新建该路径
File
outputFile
=
new
File
(
destFile
);
File
outputFile
=
new
File
(
destFile
);
if
(!
outputFile
.
getParentFile
().
exists
())
{
if
(!
outputFile
.
getParentFile
().
exists
())
{
outputFile
.
getParentFile
().
mkdirs
();
outputFile
.
getParentFile
().
mkdirs
();
}
}
log
.
debug
(
"----------ZH------------"
);
// connect to an OpenOffice.org instance running on port 8100
// connect to an OpenOffice.org instance running on port 8100
connection
=
new
SocketOpenOfficeConnection
(
connection
=
new
SocketOpenOfficeConnection
(
global
.
getLibreofficeIp
(),
global
.
getLibreofficePort
());
global
.
getLibreofficeIp
(),
global
.
getLibreofficePort
());
connection
.
connect
();
connection
.
connect
();
// convert
// convert
log
.
debug
(
"----------ZH------------"
);
DocumentConverter
converter
=
new
OpenOfficeDocumentConverter
(
DocumentConverter
converter
=
new
OpenOfficeDocumentConverter
(
connection
);
connection
);
DocumentFormatRegistry
factory
=
new
BasicDocumentFormatRegistry
();
DocumentFormatRegistry
factory
=
new
BasicDocumentFormatRegistry
();
log
.
debug
(
"----------ZH------------"
);
DocumentFormat
inputDocumentFormat
=
factory
DocumentFormat
inputDocumentFormat
=
factory
.
getFormatByFileExtension
(
FileUtil
.
getFilePostfix
(
sourceFile
));
.
getFormatByFileExtension
(
FileUtil
.
getFilePostfix
(
sourceFile
));
DocumentFormat
outputDocumentFormat
=
factory
DocumentFormat
outputDocumentFormat
=
factory
...
@@ -120,7 +124,7 @@ public class OfficeToPdf {
...
@@ -120,7 +124,7 @@ public class OfficeToPdf {
if
(
connection
!=
null
)
{
if
(
connection
!=
null
)
{
connection
.
disconnect
();
connection
.
disconnect
();
}
else
{
}
else
{
throw
new
ServiceException
(
ResultServiceEnums
.
UPLOAD
_ERROR
);
throw
new
ServiceException
(
ResultServiceEnums
.
CHANGE_FILE
_ERROR
);
}
}
}
}
return
1
;
return
1
;
...
...
src/main/resources/application-mt.yml
View file @
12bf4565
...
@@ -74,7 +74,7 @@ global:
...
@@ -74,7 +74,7 @@ global:
licPath
:
/lk/license.lic
licPath
:
/lk/license.lic
pubPath
:
/lk/publicCerts.store
pubPath
:
/lk/publicCerts.store
path
:
path
:
base_upload_server_location
:
/working/
resource/
eduServer/
base_upload_server_location
:
/working/eduServer/
return_upload_server_location
:
http://192.168.5.201:18080/eduServer/
return_upload_server_location
:
http://192.168.5.201:18080/eduServer/
course_location
:
course
course_location
:
course
lesson_location
:
lesson
lesson_location
:
lesson
...
@@ -93,7 +93,7 @@ global:
...
@@ -93,7 +93,7 @@ global:
cut_pdf_num
:
30
cut_pdf_num
:
30
libreoffice
:
libreoffice
:
ip
:
mt_
offic
e
ip
:
mt_
libr
e
port
:
8997
port
:
8997
mt
:
mt
:
api
:
http://192.168.5.201/api/
api
:
http://192.168.5.201/api/
...
...
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