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
31d5ee39
Commit
31d5ee39
authored
Mar 25, 2024
by
litengwei
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop_dl_bugfix' into develop_dl_bugfix
parents
d948c7fd
cec8a2b8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
21 deletions
+43
-21
FileUtils.java
...in/java/com/yeejoin/amos/fas/business/util/FileUtils.java
+19
-4
WordConverterUtils.java
...va/com/yeejoin/amos/fas/core/util/WordConverterUtils.java
+12
-8
WordToHtmlConverter.java
...va/org/apache/poi/hwpf/converter/WordToHtmlConverter.java
+0
-0
YeeAmosFireAutoSysStart.java
...c/main/java/com/yeejoin/amos/YeeAmosFireAutoSysStart.java
+12
-9
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/util/FileUtils.java
View file @
31d5ee39
package
com
.
yeejoin
.
amos
.
fas
.
business
.
util
;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -7,7 +9,6 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.BufferedInputStream
;
import
java.io.BufferedOutputStream
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
...
...
@@ -15,6 +16,9 @@ import java.io.InputStream;
import
java.io.OutputStream
;
import
java.net.HttpURLConnection
;
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.zip.ZipEntry
;
import
java.util.zip.ZipOutputStream
;
...
...
@@ -44,8 +48,8 @@ public class FileUtils {
OutputStream
out
=
null
;
BufferedInputStream
br
=
null
;
try
{
String
fileName
=
new
String
(
zipname
.
getBytes
(
"UTF-8"
),
"iso-8859-1"
);
br
=
new
BufferedInputStream
(
new
FileInputStream
(
zippath
));
String
fileName
=
new
String
(
zipname
.
getBytes
(
StandardCharsets
.
UTF_8
),
StandardCharsets
.
ISO_8859_1
);
br
=
new
BufferedInputStream
(
Files
.
newInputStream
(
Paths
.
get
(
zippath
)
));
byte
[]
buf
=
new
byte
[
1024
];
int
len
=
0
;
response
.
reset
();
...
...
@@ -79,8 +83,19 @@ public class FileUtils {
* @return
*/
public
static
String
fileToZip
(
List
<
String
>
list
,
String
fileName
,
String
ipUrl
)
{
if
(
StringUtils
.
isBlank
(
fileName
))
{
throw
new
RuntimeException
(
"文件名不能为空"
);
}
fileName
=
FilenameUtils
.
normalize
(
fileName
);
// 临时目录
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
=
FilenameUtils
.
normalize
(
tmpdir
+
fileName
);
File
zipFile
=
new
File
(
path
);
zipFile
.
deleteOnExit
();
try
{
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/core/util/WordConverterUtils.java
View file @
31d5ee39
...
...
@@ -6,6 +6,7 @@ import org.apache.poi.xwpf.converter.xhtml.XHTMLConverter;
import
org.apache.poi.xwpf.converter.xhtml.XHTMLOptions
;
import
org.apache.poi.xwpf.usermodel.XWPFDocument
;
import
javax.xml.XMLConstants
;
import
javax.xml.parsers.DocumentBuilderFactory
;
import
javax.xml.transform.OutputKeys
;
import
javax.xml.transform.Transformer
;
...
...
@@ -16,7 +17,7 @@ import java.io.*;
/**
* 文档转换工具
*
*
* @date
* @author nihuanshan
*
...
...
@@ -26,11 +27,11 @@ public class WordConverterUtils {
/**
* 图片存储相对文档路径
*/
private
static
String
imgPath
=
"\\image\\"
;
private
static
String
imgPath
=
File
.
separator
+
"image"
+
File
.
separator
;
/**
* word文档转html文档
*
*
* @author: nihuanshan
* @date: 2018年12月6日 下午2:55:32
* @param srcFile 原文档
...
...
@@ -50,7 +51,7 @@ public class WordConverterUtils {
}
}
}
/**
* word转html字符串
* @param srcFile
...
...
@@ -69,7 +70,7 @@ public class WordConverterUtils {
/**
* .doc文档转换成html
*
*
* @author: nihuanshan
* @date: 2018年12月6日 下午2:53:43
* @param srcFile
...
...
@@ -108,6 +109,7 @@ public class WordConverterUtils {
DOMSource
domSource
=
new
DOMSource
(
htmlDocument
);
StreamResult
streamResult
=
new
StreamResult
(
targetFile
);
TransformerFactory
tf
=
TransformerFactory
.
newInstance
();
tf
.
setFeature
(
XMLConstants
.
FEATURE_SECURE_PROCESSING
,
true
);
Transformer
serializer
=
tf
.
newTransformer
();
serializer
.
setOutputProperty
(
OutputKeys
.
ENCODING
,
"utf-8"
);
serializer
.
setOutputProperty
(
OutputKeys
.
INDENT
,
"yes"
);
...
...
@@ -118,7 +120,7 @@ public class WordConverterUtils {
}
}
/**
* doc转htmlString
* @param srcFile
...
...
@@ -156,12 +158,14 @@ public class WordConverterUtils {
StringWriter
stringWriter
=
new
StringWriter
();
StreamResult
streamResult
=
new
StreamResult
(
stringWriter
);
TransformerFactory
tf
=
TransformerFactory
.
newInstance
();
tf
.
setFeature
(
XMLConstants
.
FEATURE_SECURE_PROCESSING
,
true
);
Transformer
serializer
=
tf
.
newTransformer
();
serializer
.
setOutputProperty
(
OutputKeys
.
ENCODING
,
"utf-8"
);
serializer
.
setOutputProperty
(
OutputKeys
.
INDENT
,
"yes"
);
serializer
.
setOutputProperty
(
OutputKeys
.
METHOD
,
"html"
);
serializer
.
transform
(
domSource
,
streamResult
);
return
stringWriter
.
toString
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -202,9 +206,9 @@ public class WordConverterUtils {
e
.
printStackTrace
();
}
}
/**
*docx转htmlString
*docx转htmlString
* @param srcFile
* @param readUrl
* @return
...
...
YeeAmosFireAutoSysService/src/main/java/org/apache/poi/hwpf/converter/WordToHtmlConverter.java
deleted
100644 → 0
View file @
d948c7fd
This diff is collapsed.
Click to expand it.
YeeAmosFireAutoSysStart/src/main/java/com/yeejoin/amos/YeeAmosFireAutoSysStart.java
View file @
31d5ee39
...
...
@@ -19,6 +19,7 @@ import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.core.env.Environment
;
...
...
@@ -35,7 +36,7 @@ import com.yeejoin.amos.filter.CrossDomainFilter;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
/**
*
*
* <pre>
* 服务启动类
* </pre>
...
...
@@ -70,13 +71,15 @@ public class YeeAmosFireAutoSysStart implements ApplicationContextAware {
*/
public
static
void
main
(
String
[]
args
)
{
log
.
info
(
"start Service.........."
);
try
{
SpringApplication
application
=
new
SpringApplication
(
YeeAmosFireAutoSysStart
.
class
);
Environment
environment
=
application
.
run
(
args
).
getEnvironment
();
log
.
info
(
"SwaggerUI: http://"
+
InetAddress
.
getLocalHost
().
getHostAddress
()
+
":"
+
environment
.
getProperty
(
"server.port"
)
+
environment
.
getProperty
(
"server.servlet.context-path"
)
+
"/swagger-ui.html"
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"error occur when run server! "
+
e
);
}
ApplicationContext
context
=
SpringApplication
.
run
(
YeeAmosFireAutoSysStart
.
class
,
args
);
Environment
env
=
context
.
getEnvironment
();
String
appName
=
env
.
getProperty
(
"spring.application.name"
);
log
.
info
(
"\n----------------------------------------------------------\n\t"
+
"Application {} is running!\n"
+
"----------------------------------------------------------\n"
,
appName
);
}
/**
...
...
@@ -90,7 +93,7 @@ public class YeeAmosFireAutoSysStart implements ApplicationContextAware {
}
/**
*
*
* <pre>
* 跨域处理的FilterBean
* </pre>
...
...
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