Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
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
station
YeeAmosFireAutoSysRoot
Commits
7e23a914
Commit
7e23a914
authored
Mar 25, 2024
by
李秀明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 使用硬编码文件分隔符会导致可移植性问题
Links
https://docs.qq.com/sheet/DTkRSaWhSZXBlaldN?tab=000008&_t=1711087563249
(No.16)
parent
dcef3c7c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
FileUtils.java
...in/java/com/yeejoin/amos/fas/business/util/FileUtils.java
+13
-3
WordConverterUtils.java
...va/com/yeejoin/amos/fas/core/util/WordConverterUtils.java
+1
-1
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/util/FileUtils.java
View file @
7e23a914
package
com
.
yeejoin
.
amos
.
fas
.
business
.
util
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
util
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
...
@@ -15,6 +16,9 @@ import java.io.InputStream;
...
@@ -15,6 +16,9 @@ import java.io.InputStream;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.net.HttpURLConnection
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.net.URL
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.util.List
;
import
java.util.List
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipOutputStream
;
import
java.util.zip.ZipOutputStream
;
...
@@ -44,8 +48,8 @@ public class FileUtils {
...
@@ -44,8 +48,8 @@ public class FileUtils {
OutputStream
out
=
null
;
OutputStream
out
=
null
;
BufferedInputStream
br
=
null
;
BufferedInputStream
br
=
null
;
try
{
try
{
String
fileName
=
new
String
(
zipname
.
getBytes
(
"UTF-8"
),
"iso-8859-1"
);
String
fileName
=
new
String
(
zipname
.
getBytes
(
StandardCharsets
.
UTF_8
),
StandardCharsets
.
ISO_8859_1
);
br
=
new
BufferedInputStream
(
new
FileInputStream
(
zippath
));
br
=
new
BufferedInputStream
(
Files
.
newInputStream
(
Paths
.
get
(
zippath
)
));
byte
[]
buf
=
new
byte
[
1024
];
byte
[]
buf
=
new
byte
[
1024
];
int
len
=
0
;
int
len
=
0
;
response
.
reset
();
response
.
reset
();
...
@@ -81,7 +85,13 @@ public class FileUtils {
...
@@ -81,7 +85,13 @@ public class FileUtils {
ZipOutputStream
zos
=
null
;
ZipOutputStream
zos
=
null
;
// 临时目录
// 临时目录
String
path
=
System
.
getProperty
(
"java.io.tmpdir"
)
+
fileName
;
String
tmpdir
=
System
.
getProperty
(
"java.io.tmpdir"
);
if
(
StringUtils
.
isNotBlank
(
tmpdir
)
&&
!
tmpdir
.
endsWith
(
File
.
separator
))
{
tmpdir
+=
File
.
separator
;
}
else
if
(
StringUtils
.
isBlank
(
tmpdir
)){
tmpdir
=
""
;
}
String
path
=
tmpdir
+
fileName
;
try
{
try
{
File
zipFile
=
new
File
(
path
);
File
zipFile
=
new
File
(
path
);
zipFile
.
deleteOnExit
();
zipFile
.
deleteOnExit
();
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/core/util/WordConverterUtils.java
View file @
7e23a914
...
@@ -26,7 +26,7 @@ public class WordConverterUtils {
...
@@ -26,7 +26,7 @@ public class WordConverterUtils {
/**
/**
* 图片存储相对文档路径
* 图片存储相对文档路径
*/
*/
private
static
String
imgPath
=
"\\image\\"
;
private
static
String
imgPath
=
File
.
separator
+
"image"
+
File
.
separator
;
/**
/**
* word文档转html文档
* word文档转html文档
...
...
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