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
2bbf0109
Commit
2bbf0109
authored
Dec 31, 2017
by
mhqpx
Committed by
klboke
Dec 31, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件预览:移除needE参数
parent
eb3d36e5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
13 deletions
+16
-13
DownloadUtils.java
...web/src/main/java/com/yudianbank/utils/DownloadUtils.java
+8
-4
SimTextUtil.java
...r-web/src/main/java/com/yudianbank/utils/SimTextUtil.java
+2
-2
OnlinePreviewController.java
...om/yudianbank/web/controller/OnlinePreviewController.java
+4
-4
compress.ftl
jodconverter-web/src/main/resources/web/compress.ftl
+1
-2
index.ftl
jodconverter-web/src/main/resources/web/index.ftl
+1
-1
No files found.
jodconverter-web/src/main/java/com/yudianbank/utils/DownloadUtils.java
View file @
2bbf0109
...
@@ -27,10 +27,11 @@ public class DownloadUtils {
...
@@ -27,10 +27,11 @@ public class DownloadUtils {
* @param type
* @param type
* @return
* @return
*/
*/
public
ReturnResponse
<
String
>
downLoad
(
String
urlAddress
,
String
type
,
String
fileName
,
String
needEncode
){
public
ReturnResponse
<
String
>
downLoad
(
String
urlAddress
,
String
type
,
String
fileName
){
ReturnResponse
<
String
>
response
=
new
ReturnResponse
<>(
0
,
"下载成功!!!"
,
""
);
ReturnResponse
<
String
>
response
=
new
ReturnResponse
<>(
0
,
"下载成功!!!"
,
""
);
URL
url
=
null
;
URL
url
=
null
;
try
{
try
{
urlAddress
=
replacePlusMark
(
urlAddress
);
urlAddress
=
encodeUrlParam
(
urlAddress
);
urlAddress
=
encodeUrlParam
(
urlAddress
);
// 因为tomcat不能处理'+'号,所以讲'+'号替换成'%20%'
// 因为tomcat不能处理'+'号,所以讲'+'号替换成'%20%'
urlAddress
=
urlAddress
.
replaceAll
(
"\\+"
,
"%20"
);
urlAddress
=
urlAddress
.
replaceAll
(
"\\+"
,
"%20"
);
...
@@ -92,9 +93,12 @@ public class DownloadUtils {
...
@@ -92,9 +93,12 @@ public class DownloadUtils {
* @return
* @return
*/
*/
private
String
replacePlusMark
(
String
urlAddress
)
{
private
String
replacePlusMark
(
String
urlAddress
)
{
String
nonParamStr
=
urlAddress
.
substring
(
0
,
urlAddress
.
indexOf
(
"?"
)
+
1
);
if
(
urlAddress
.
contains
(
"?"
))
{
String
paramStr
=
urlAddress
.
substring
(
nonParamStr
.
length
());
String
nonParamStr
=
urlAddress
.
substring
(
0
,
urlAddress
.
indexOf
(
"?"
)
+
1
);
return
nonParamStr
+
paramStr
.
replace
(
" "
,
"+"
);
String
paramStr
=
urlAddress
.
substring
(
nonParamStr
.
length
());
return
nonParamStr
+
paramStr
.
replace
(
" "
,
"+"
);
}
return
urlAddress
;
}
}
/**
/**
...
...
jodconverter-web/src/main/java/com/yudianbank/utils/SimTextUtil.java
View file @
2bbf0109
...
@@ -17,8 +17,8 @@ public class SimTextUtil {
...
@@ -17,8 +17,8 @@ public class SimTextUtil {
@Autowired
@Autowired
DownloadUtils
downloadUtils
;
DownloadUtils
downloadUtils
;
public
ReturnResponse
<
String
>
readSimText
(
String
url
,
String
fileName
,
String
needEncode
){
public
ReturnResponse
<
String
>
readSimText
(
String
url
,
String
fileName
){
ReturnResponse
<
String
>
response
=
downloadUtils
.
downLoad
(
url
,
"txt"
,
fileName
,
needEncode
);
ReturnResponse
<
String
>
response
=
downloadUtils
.
downLoad
(
url
,
"txt"
,
fileName
);
return
response
;
return
response
;
}
}
}
}
jodconverter-web/src/main/java/com/yudianbank/web/controller/OnlinePreviewController.java
View file @
2bbf0109
...
@@ -50,7 +50,7 @@ public class OnlinePreviewController {
...
@@ -50,7 +50,7 @@ public class OnlinePreviewController {
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"onlinePreview"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"onlinePreview"
,
method
=
RequestMethod
.
GET
)
public
String
onlinePreview
(
String
url
,
String
needEncode
,
Model
model
,
HttpServletRequest
req
)
throws
UnsupportedEncodingException
{
public
String
onlinePreview
(
String
url
,
Model
model
,
HttpServletRequest
req
)
throws
UnsupportedEncodingException
{
// 路径转码
// 路径转码
String
decodedUrl
=
URLDecoder
.
decode
(
url
,
"utf-8"
);
String
decodedUrl
=
URLDecoder
.
decode
(
url
,
"utf-8"
);
String
type
=
typeFromUrl
(
url
);
String
type
=
typeFromUrl
(
url
);
...
@@ -62,7 +62,7 @@ public class OnlinePreviewController {
...
@@ -62,7 +62,7 @@ public class OnlinePreviewController {
model
.
addAttribute
(
"imgurl"
,
url
);
model
.
addAttribute
(
"imgurl"
,
url
);
return
"picture"
;
return
"picture"
;
}
else
if
(
type
.
equalsIgnoreCase
(
"simText"
)){
}
else
if
(
type
.
equalsIgnoreCase
(
"simText"
)){
ReturnResponse
<
String
>
response
=
simTextUtil
.
readSimText
(
decodedUrl
,
fileName
,
needEncode
);
ReturnResponse
<
String
>
response
=
simTextUtil
.
readSimText
(
decodedUrl
,
fileName
);
if
(
0
!=
response
.
getCode
())
{
if
(
0
!=
response
.
getCode
())
{
model
.
addAttribute
(
"msg"
,
response
.
getMsg
());
model
.
addAttribute
(
"msg"
,
response
.
getMsg
());
return
"fileNotSupported"
;
return
"fileNotSupported"
;
...
@@ -76,7 +76,7 @@ public class OnlinePreviewController {
...
@@ -76,7 +76,7 @@ public class OnlinePreviewController {
String
fileTree
=
null
;
String
fileTree
=
null
;
// 判断文件名是否存在(redis缓存读取)
// 判断文件名是否存在(redis缓存读取)
if
(!
StringUtils
.
hasText
(
fileUtils
.
getConvertedFile
(
fileName
)))
{
if
(!
StringUtils
.
hasText
(
fileUtils
.
getConvertedFile
(
fileName
)))
{
ReturnResponse
<
String
>
response
=
downloadUtils
.
downLoad
(
decodedUrl
,
suffix
,
fileName
,
needEncode
);
ReturnResponse
<
String
>
response
=
downloadUtils
.
downLoad
(
decodedUrl
,
suffix
,
fileName
);
if
(
0
!=
response
.
getCode
())
{
if
(
0
!=
response
.
getCode
())
{
model
.
addAttribute
(
"msg"
,
response
.
getMsg
());
model
.
addAttribute
(
"msg"
,
response
.
getMsg
());
return
"fileNotSupported"
;
return
"fileNotSupported"
;
...
@@ -109,7 +109,7 @@ public class OnlinePreviewController {
...
@@ -109,7 +109,7 @@ public class OnlinePreviewController {
if
(!
fileUtils
.
listConvertedFiles
().
containsKey
(
pdfName
))
{
if
(!
fileUtils
.
listConvertedFiles
().
containsKey
(
pdfName
))
{
String
filePath
=
fileDir
+
fileName
;
String
filePath
=
fileDir
+
fileName
;
if
(!
new
File
(
filePath
).
exists
())
{
if
(!
new
File
(
filePath
).
exists
())
{
ReturnResponse
<
String
>
response
=
downloadUtils
.
downLoad
(
decodedUrl
,
suffix
,
null
,
needEncode
);
ReturnResponse
<
String
>
response
=
downloadUtils
.
downLoad
(
decodedUrl
,
suffix
,
null
);
if
(
0
!=
response
.
getCode
())
{
if
(
0
!=
response
.
getCode
())
{
model
.
addAttribute
(
"msg"
,
response
.
getMsg
());
model
.
addAttribute
(
"msg"
,
response
.
getMsg
());
return
"fileNotSupported"
;
return
"fileNotSupported"
;
...
...
jodconverter-web/src/main/resources/web/compress.ftl
View file @
2bbf0109
...
@@ -69,8 +69,7 @@
...
@@ -69,8 +69,7 @@
fulls
+=
",resizable"
;
// 对于不支持screen属性的浏览器,可以手工进行最大化。 manually
fulls
+=
",resizable"
;
// 对于不支持screen属性的浏览器,可以手工进行最大化。 manually
}
}
window
.
open
(
"onlinePreview?url="
window
.
open
(
"onlinePreview?url="
+
encodeURIComponent
(
"${baseUrl}"
+
treeNode
.
fileName
)
+
encodeURIComponent
(
"${baseUrl}"
+
treeNode
.
fileName
),
"_blank"
,
fulls
);
+
"&needEncode=1"
,
"_blank"
,
fulls
);
}
}
}
}
}
}
...
...
jodconverter-web/src/main/resources/web/index.ftl
View file @
2bbf0109
...
@@ -125,7 +125,7 @@
...
@@ -125,7 +125,7 @@
// 每个data添加一列用来操作
// 每个data添加一列用来操作
$
(
data
).
each
(
function
(
index
,
item
)
{
$
(
data
).
each
(
function
(
index
,
item
)
{
item
.
action
=
"<a class='btn btn-default' target='_blank' href='${baseUrl}onlinePreview?url="
item
.
action
=
"<a class='btn btn-default' target='_blank' href='${baseUrl}onlinePreview?url="
+
encodeURIComponent
(
'${baseUrl}'
+
item
.
fileName
)
+
"
&needEncode=1
'>预览</a>"
+
+
encodeURIComponent
(
'${baseUrl}'
+
item
.
fileName
)
+
"'>预览</a>"
+
"<a class='btn btn-default' target='_blank' href='javascript:void(0);' onclick='deleteFile(
\"
"
+
item
.
fileName
+
"
\"
)'>删除</a>"
;
"<a class='btn btn-default' target='_blank' href='javascript:void(0);' onclick='deleteFile(
\"
"
+
item
.
fileName
+
"
\"
)'>删除</a>"
;
});
});
return
data
;
return
data
;
...
...
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