Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
slm-fileview
Project
Project
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
梁杰芳
slm-fileview
Commits
31187ccb
Commit
31187ccb
authored
Jul 05, 2021
by
陈精华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复:PPT预览使用PDF模式无效
parent
d4b72b06
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
34 deletions
+6
-34
FileType.java
server/src/main/java/cn/keking/model/FileType.java
+1
-6
FileConvertQueueTask.java
...src/main/java/cn/keking/service/FileConvertQueueTask.java
+1
-1
OfficeFilePreviewImpl.java
...in/java/cn/keking/service/impl/OfficeFilePreviewImpl.java
+4
-1
PptFilePreviewImpl.java
.../main/java/cn/keking/service/impl/PptFilePreviewImpl.java
+0
-26
No files found.
server/src/main/java/cn/keking/model/FileType.java
View file @
31187ccb
...
...
@@ -24,12 +24,10 @@ public enum FileType {
FLV
(
"flvFilePreviewImpl"
),
CAD
(
"cadFilePreviewImpl"
),
TIFF
(
"tiffFilePreviewImpl"
),
PPT
(
"pptFilePreviewImpl"
),
OFD
(
"ofdFilePreviewImpl"
);
private
static
final
String
[]
OFFICE_TYPES
=
{
"docx"
,
"wps"
,
"doc"
,
"xls"
,
"xlsx"
};
private
static
final
String
[]
PPT_TYPES
=
{
"ppt"
,
"pptx"
};
private
static
final
String
[]
OFFICE_TYPES
=
{
"docx"
,
"wps"
,
"doc"
,
"xls"
,
"xlsx"
,
"ppt"
,
"pptx"
};
private
static
final
String
[]
PICTURE_TYPES
=
{
"jpg"
,
"jpeg"
,
"png"
,
"gif"
,
"bmp"
,
"ico"
,
"raw"
};
private
static
final
String
[]
ARCHIVE_TYPES
=
{
"rar"
,
"zip"
,
"jar"
,
"7-zip"
,
"tar"
,
"gzip"
,
"7z"
};
private
static
final
String
[]
TIFF_TYPES
=
{
"tif"
,
"tiff"
};
...
...
@@ -68,9 +66,6 @@ public enum FileType {
for
(
String
ofd
:
OFD_TYPES
)
{
FILE_TYPE_MAPPER
.
put
(
ofd
,
FileType
.
OFD
);
}
for
(
String
ppt
:
PPT_TYPES
)
{
FILE_TYPE_MAPPER
.
put
(
ppt
,
FileType
.
PPT
);
}
FILE_TYPE_MAPPER
.
put
(
"md"
,
FileType
.
MARKDOWN
);
FILE_TYPE_MAPPER
.
put
(
"xml"
,
FileType
.
XML
);
FILE_TYPE_MAPPER
.
put
(
"pdf"
,
FileType
.
PDF
);
...
...
server/src/main/java/cn/keking/service/FileConvertQueueTask.java
View file @
31187ccb
...
...
@@ -81,7 +81,7 @@ public class FileConvertQueueTask {
}
public
boolean
isNeedConvert
(
FileType
fileType
)
{
return
fileType
.
equals
(
FileType
.
COMPRESS
)
||
fileType
.
equals
(
FileType
.
OFFICE
)
||
fileType
.
equals
(
FileType
.
CAD
)
||
fileType
.
equals
(
FileType
.
PPT
)
;
return
fileType
.
equals
(
FileType
.
COMPRESS
)
||
fileType
.
equals
(
FileType
.
OFFICE
)
||
fileType
.
equals
(
FileType
.
CAD
);
}
}
...
...
server/src/main/java/cn/keking/service/impl/OfficeFilePreviewImpl.java
View file @
31187ccb
...
...
@@ -73,6 +73,8 @@ public class OfficeFilePreviewImpl implements FilePreview {
}
static
String
getPreviewType
(
Model
model
,
FileAttribute
fileAttribute
,
String
officePreviewType
,
String
baseUrl
,
String
pdfName
,
String
outFilePath
,
FileHandlerService
fileHandlerService
,
String
officePreviewTypeImage
,
OtherFilePreviewImpl
otherFilePreview
)
{
String
suffix
=
fileAttribute
.
getSuffix
();
boolean
isPPT
=
suffix
.
equalsIgnoreCase
(
"ppt"
)
||
suffix
.
equalsIgnoreCase
(
"pptx"
);
List
<
String
>
imageUrls
=
fileHandlerService
.
pdf2jpg
(
outFilePath
,
pdfName
,
baseUrl
);
if
(
imageUrls
==
null
||
imageUrls
.
size
()
<
1
)
{
return
otherFilePreview
.
notSupportedFile
(
model
,
fileAttribute
,
"office转图片异常,请联系管理员"
);
...
...
@@ -80,7 +82,8 @@ public class OfficeFilePreviewImpl implements FilePreview {
model
.
addAttribute
(
"imgurls"
,
imageUrls
);
model
.
addAttribute
(
"currentUrl"
,
imageUrls
.
get
(
0
));
if
(
officePreviewTypeImage
.
equals
(
officePreviewType
))
{
return
OFFICE_PICTURE_FILE_PREVIEW_PAGE
;
// PPT 图片模式使用专用预览页面
return
(
isPPT
?
PPT_FILE_PREVIEW_PAGE
:
OFFICE_PICTURE_FILE_PREVIEW_PAGE
);
}
else
{
return
PICTURE_FILE_PREVIEW_PAGE
;
}
...
...
server/src/main/java/cn/keking/service/impl/PptFilePreviewImpl.java
deleted
100644 → 0
View file @
d4b72b06
package
cn
.
keking
.
service
.
impl
;
import
cn.keking.model.FileAttribute
;
import
cn.keking.service.FilePreview
;
import
org.springframework.stereotype.Service
;
import
org.springframework.ui.Model
;
/**
* @author kl (http://kailing.pub)
* @since 2021/6/17
*/
@Service
public
class
PptFilePreviewImpl
implements
FilePreview
{
private
final
OfficeFilePreviewImpl
officeFilePreview
;
public
PptFilePreviewImpl
(
OfficeFilePreviewImpl
officeFilePreview
)
{
this
.
officeFilePreview
=
officeFilePreview
;
}
@Override
public
String
filePreviewHandle
(
String
url
,
Model
model
,
FileAttribute
fileAttribute
)
{
officeFilePreview
.
filePreviewHandle
(
url
,
model
,
fileAttribute
);
return
PPT_FILE_PREVIEW_PAGE
;
}
}
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