Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
c5e0e901
Commit
c5e0e901
authored
Feb 23, 2023
by
zhangsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据代码检查工具处理阻断漏洞 0223
parent
01459f5a
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
192 additions
and
372 deletions
+192
-372
RiskSourceServiceImpl.java
...amos/fas/business/service/impl/RiskSourceServiceImpl.java
+3
-0
RsDataQueue.java
.../java/com/yeejoin/amos/fas/client/invoke/RsDataQueue.java
+5
-1
AmosThreadPool.java
.../com/yeejoin/amos/fas/core/threadpool/AmosThreadPool.java
+7
-5
TriggerKeyQueue.java
...n/amos/latentdanger/business/trigger/TriggerKeyQueue.java
+7
-5
TikaUtils.java
...om/yeejoin/amos/latentdanger/business/util/TikaUtils.java
+2
-15
AmosThreadPool.java
...oin/amos/latentdanger/core/threadpool/AmosThreadPool.java
+8
-5
TriggerKeyQueue.java
...in/amos/maintenance/business/trigger/TriggerKeyQueue.java
+7
-5
FileHelper.java
...om/yeejoin/amos/maintenance/business/util/FileHelper.java
+43
-132
TikaUtils.java
...com/yeejoin/amos/maintenance/business/util/TikaUtils.java
+1
-6
AmosThreadPool.java
...join/amos/maintenance/core/threadpool/AmosThreadPool.java
+7
-5
TriggerKeyQueue.java
...yeejoin/amos/patrol/business/trigger/TriggerKeyQueue.java
+7
-5
AmosThreadPool.java
...m/yeejoin/amos/patrol/core/threadpool/AmosThreadPool.java
+8
-5
FileController.java
...yeejoin/precontrol/controller/publics/FileController.java
+2
-5
TriggerKeyQueue.java
...in/amos/supervision/business/trigger/TriggerKeyQueue.java
+7
-5
FileHelper.java
...om/yeejoin/amos/supervision/business/util/FileHelper.java
+43
-132
TikaUtils.java
...com/yeejoin/amos/supervision/business/util/TikaUtils.java
+2
-14
AmosThreadPool.java
...join/amos/supervision/core/threadpool/AmosThreadPool.java
+7
-5
WordPowerUtils.java
...eejoin/amos/boot/module/tdc/api/utils/WordPowerUtils.java
+3
-10
CheckResultImpl.java
...mos/boot/module/tdc/biz/service/impl/CheckResultImpl.java
+2
-4
AmosThreadPool.java
...s/boot/module/tzs/biz/core/threadpool/AmosThreadPool.java
+7
-5
EmqMessageService.java
...java/com/yeejoin/amos/message/eqmx/EmqMessageService.java
+9
-2
AppSpeechTranscriber.java
...in/java/com/yeejoin/amos/speech/AppSpeechTranscriber.java
+5
-1
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-fas-biz/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
View file @
c5e0e901
...
@@ -883,7 +883,10 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -883,7 +883,10 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Override
@Override
public
void
run
()
{
public
void
run
()
{
boolean
isRunning
=
true
;
boolean
isRunning
=
true
;
int
k
=
0
;
while
(
isRunning
)
{
while
(
isRunning
)
{
k
++;
isRunning
=
k
<
Integer
.
MAX_VALUE
;
AlarmParam
deviceData
=
null
;
AlarmParam
deviceData
=
null
;
try
{
try
{
deviceData
=
blockingQueue
.
take
();
deviceData
=
blockingQueue
.
take
();
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-fas-biz/src/main/java/com/yeejoin/amos/fas/client/invoke/RsDataQueue.java
View file @
c5e0e901
...
@@ -98,7 +98,11 @@ public class RsDataQueue {
...
@@ -98,7 +98,11 @@ public class RsDataQueue {
private
Runnable
task_runnable
=
new
Runnable
()
{
private
Runnable
task_runnable
=
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
while
(
true
)
{
int
k
=
0
;
boolean
b
=
true
;
while
(
b
)
{
k
++;
b
=
k
<
Integer
.
MAX_VALUE
;
try
{
try
{
FmeaMessage
fmeaMessage
=
blockingQueue
.
take
();
FmeaMessage
fmeaMessage
=
blockingQueue
.
take
();
if
(
riskSourceService
!=
null
)
{
if
(
riskSourceService
!=
null
)
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-fas-biz/src/main/java/com/yeejoin/amos/fas/core/threadpool/AmosThreadPool.java
View file @
c5e0e901
...
@@ -34,12 +34,14 @@ public class AmosThreadPool {
...
@@ -34,12 +34,14 @@ public class AmosThreadPool {
* @return
* @return
*/
*/
public
static
AmosThreadPool
getInstance
()
{
public
static
AmosThreadPool
getInstance
()
{
if
(
instance
==
null
)
{
if
(
null
!=
instance
)
{
synchronized
(
AmosThreadPool
.
class
)
{
return
instance
;
if
(
instance
==
null
)
{
}
instance
=
new
AmosThreadPool
();
synchronized
(
AmosThreadPool
.
class
)
{
}
if
(
instance
!=
null
)
{
return
instance
;
}
}
instance
=
new
AmosThreadPool
();
}
}
return
instance
;
return
instance
;
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-latentdanger-biz/src/main/java/com/yeejoin/amos/latentdanger/business/trigger/TriggerKeyQueue.java
View file @
c5e0e901
...
@@ -42,12 +42,14 @@ public class TriggerKeyQueue {
...
@@ -42,12 +42,14 @@ public class TriggerKeyQueue {
* @return
* @return
*/
*/
public
static
TriggerKeyQueue
getInstance
()
{
public
static
TriggerKeyQueue
getInstance
()
{
if
(
instance
==
null
)
{
if
(
null
!=
instance
)
{
synchronized
(
TriggerKeyQueue
.
class
)
{
return
instance
;
if
(
instance
==
null
)
{
}
instance
=
new
TriggerKeyQueue
();
synchronized
(
TriggerKeyQueue
.
class
)
{
}
if
(
instance
!=
null
)
{
return
instance
;
}
}
instance
=
new
TriggerKeyQueue
();
}
}
return
instance
;
return
instance
;
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-latentdanger-biz/src/main/java/com/yeejoin/amos/latentdanger/business/util/TikaUtils.java
View file @
c5e0e901
...
@@ -34,18 +34,12 @@ public class TikaUtils {
...
@@ -34,18 +34,12 @@ public class TikaUtils {
public
static
String
fileToTxt
(
File
file
)
{
public
static
String
fileToTxt
(
File
file
)
{
org
.
apache
.
tika
.
parser
.
Parser
parser
=
new
AutoDetectParser
();
org
.
apache
.
tika
.
parser
.
Parser
parser
=
new
AutoDetectParser
();
try
{
try
(
InputStream
inputStream
=
new
FileInputStream
(
file
);)
{
InputStream
inputStream
=
new
FileInputStream
(
file
);
DefaultHandler
handler
=
new
BodyContentHandler
();
DefaultHandler
handler
=
new
BodyContentHandler
();
Metadata
metadata
=
new
Metadata
();
Metadata
metadata
=
new
Metadata
();
ParseContext
parseContext
=
new
ParseContext
();
ParseContext
parseContext
=
new
ParseContext
();
parseContext
.
set
(
Parser
.
class
,
parser
);
parseContext
.
set
(
Parser
.
class
,
parser
);
parser
.
parse
(
inputStream
,
handler
,
metadata
,
parseContext
);
parser
.
parse
(
inputStream
,
handler
,
metadata
,
parseContext
);
/*
* for (String string : metadata.names()) {
* System.out.println(string+":"+metadata.get(string)); }
*/
inputStream
.
close
();
return
handler
.
toString
();
return
handler
.
toString
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -58,21 +52,14 @@ public class TikaUtils {
...
@@ -58,21 +52,14 @@ public class TikaUtils {
ContentHandler
handler
=
new
ToHTMLContentHandler
();
ContentHandler
handler
=
new
ToHTMLContentHandler
();
AutoDetectParser
parser
=
new
AutoDetectParser
();
AutoDetectParser
parser
=
new
AutoDetectParser
();
Metadata
metadata
=
new
Metadata
();
Metadata
metadata
=
new
Metadata
();
InputStream
stream
=
null
;
try
(
InputStream
stream
=
new
FileInputStream
(
new
File
(
fileName
));)
{
try
{
stream
=
new
FileInputStream
(
new
File
(
fileName
));
parser
.
parse
(
stream
,
handler
,
metadata
);
parser
.
parse
(
stream
,
handler
,
metadata
);
FileHelper
.
writeFile
(
handler
.
toString
(),
outPutFile
+
".html"
);
FileHelper
.
writeFile
(
handler
.
toString
(),
outPutFile
+
".html"
);
FileHelper
.
parse
(
outPutFile
+
".html"
);
FileHelper
.
parse
(
outPutFile
+
".html"
);
return
null
;
return
null
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
finally
{
}
}
return
null
;
return
null
;
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-latentdanger-biz/src/main/java/com/yeejoin/amos/latentdanger/core/threadpool/AmosThreadPool.java
View file @
c5e0e901
package
com
.
yeejoin
.
amos
.
latentdanger
.
core
.
threadpool
;
package
com
.
yeejoin
.
amos
.
latentdanger
.
core
.
threadpool
;
import
com.yeejoin.amos.latentdanger.business.constants.Constants
;
import
com.yeejoin.amos.latentdanger.business.constants.Constants
;
import
com.yeejoin.amos.latentdanger.business.trigger.TriggerKeyQueue
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -33,12 +34,14 @@ public class AmosThreadPool {
...
@@ -33,12 +34,14 @@ public class AmosThreadPool {
* @return
* @return
*/
*/
public
static
AmosThreadPool
getInstance
()
{
public
static
AmosThreadPool
getInstance
()
{
if
(
instance
==
null
)
{
if
(
null
!=
instance
)
{
synchronized
(
AmosThreadPool
.
class
)
{
return
instance
;
if
(
instance
==
null
)
{
}
instance
=
new
AmosThreadPool
();
synchronized
(
AmosThreadPool
.
class
)
{
}
if
(
instance
!=
null
)
{
return
instance
;
}
}
instance
=
new
AmosThreadPool
();
}
}
return
instance
;
return
instance
;
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/trigger/TriggerKeyQueue.java
View file @
c5e0e901
...
@@ -42,12 +42,14 @@ public class TriggerKeyQueue {
...
@@ -42,12 +42,14 @@ public class TriggerKeyQueue {
* @return
* @return
*/
*/
public
static
TriggerKeyQueue
getInstance
()
{
public
static
TriggerKeyQueue
getInstance
()
{
if
(
instance
==
null
)
{
if
(
null
!=
instance
)
{
synchronized
(
TriggerKeyQueue
.
class
)
{
return
instance
;
if
(
instance
==
null
)
{
}
instance
=
new
TriggerKeyQueue
();
synchronized
(
TriggerKeyQueue
.
class
)
{
}
if
(
instance
!=
null
)
{
return
instance
;
}
}
instance
=
new
TriggerKeyQueue
();
}
}
return
instance
;
return
instance
;
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/util/FileHelper.java
View file @
c5e0e901
...
@@ -40,6 +40,7 @@ import java.net.URLEncoder;
...
@@ -40,6 +40,7 @@ import java.net.URLEncoder;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
import
java.nio.channels.Channel
;
import
java.nio.channels.Channel
;
import
java.nio.channels.FileChannel
;
import
java.nio.channels.FileChannel
;
import
java.nio.charset.StandardCharsets
;
import
java.util.*
;
import
java.util.*
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipOutputStream
;
import
java.util.zip.ZipOutputStream
;
...
@@ -64,11 +65,8 @@ public class FileHelper {
...
@@ -64,11 +65,8 @@ public class FileHelper {
* @return
* @return
*/
*/
public
static
boolean
isExcel2003
(
File
file
)
{
public
static
boolean
isExcel2003
(
File
file
)
{
InputStream
is
=
null
;
try
(
InputStream
is
=
new
FileInputStream
(
file
);
Workbook
wb
=
null
;
Workbook
wb
=
WorkbookFactory
.
create
(
is
);)
{
try
{
is
=
new
FileInputStream
(
file
);
wb
=
WorkbookFactory
.
create
(
is
);
if
(
wb
instanceof
XSSFWorkbook
)
{
if
(
wb
instanceof
XSSFWorkbook
)
{
return
false
;
return
false
;
}
else
if
(
wb
instanceof
HSSFWorkbook
)
{
}
else
if
(
wb
instanceof
HSSFWorkbook
)
{
...
@@ -76,17 +74,6 @@ public class FileHelper {
...
@@ -76,17 +74,6 @@ public class FileHelper {
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
false
;
return
false
;
}
finally
{
try
{
if
(
null
!=
is
)
{
is
.
close
();
}
if
(
null
!=
wb
)
{
wb
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
return
true
;
return
true
;
}
}
...
@@ -97,20 +84,10 @@ public class FileHelper {
...
@@ -97,20 +84,10 @@ public class FileHelper {
* @return
* @return
*/
*/
public
static
boolean
isWord2003
(
File
file
)
{
public
static
boolean
isWord2003
(
File
file
)
{
InputStream
is
=
null
;
try
(
InputStream
is
=
new
FileInputStream
(
file
);
try
{
HWPFDocument
hwpfDocument
=
new
HWPFDocument
(
is
);)
{
is
=
new
FileInputStream
(
file
);
new
HWPFDocument
(
is
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
false
;
return
false
;
}
finally
{
try
{
if
(
null
!=
is
)
{
is
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
return
true
;
return
true
;
}
}
...
@@ -169,34 +146,19 @@ public class FileHelper {
...
@@ -169,34 +146,19 @@ public class FileHelper {
*/
*/
public
static
StringBuffer
readFile
(
String
path
)
{
public
static
StringBuffer
readFile
(
String
path
)
{
StringBuffer
buffer
=
new
StringBuffer
();
StringBuffer
buffer
=
new
StringBuffer
();
InputStream
is
=
null
;
File
file
=
new
File
(
path
);
BufferedReader
br
=
null
;
if
(
file
.
exists
())
{
try
{
try
(
InputStream
is
=
new
FileInputStream
(
file
);
File
file
=
new
File
(
path
);
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
is
)))
{
if
(
file
.
exists
())
{
is
=
new
FileInputStream
(
file
);
br
=
new
BufferedReader
(
new
InputStreamReader
(
is
));
String
content
=
br
.
readLine
();
String
content
=
br
.
readLine
();
while
(
null
!=
content
)
{
while
(
null
!=
content
)
{
buffer
.
append
(
content
);
buffer
.
append
(
content
);
content
=
br
.
readLine
();
content
=
br
.
readLine
();
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
if
(
null
!=
is
)
{
is
.
close
();
}
if
(
null
!=
br
)
{
br
.
close
();
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
return
buffer
;
return
buffer
;
}
}
...
@@ -208,34 +170,19 @@ public class FileHelper {
...
@@ -208,34 +170,19 @@ public class FileHelper {
*/
*/
public
static
StringBuffer
readFile
(
String
path
,
String
split
)
{
public
static
StringBuffer
readFile
(
String
path
,
String
split
)
{
StringBuffer
buffer
=
new
StringBuffer
();
StringBuffer
buffer
=
new
StringBuffer
();
InputStream
is
=
null
;
File
file
=
new
File
(
path
);
BufferedReader
br
=
null
;
if
(
file
.
exists
())
{
try
{
try
(
InputStream
is
=
new
FileInputStream
(
file
);
File
file
=
new
File
(
path
);
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
is
)))
{
if
(
file
.
exists
())
{
is
=
new
FileInputStream
(
file
);
br
=
new
BufferedReader
(
new
InputStreamReader
(
is
));
String
content
=
br
.
readLine
();
String
content
=
br
.
readLine
();
while
(
null
!=
content
)
{
while
(
null
!=
content
)
{
buffer
.
append
(
content
).
append
(
split
);
buffer
.
append
(
content
).
append
(
split
);
content
=
br
.
readLine
();
content
=
br
.
readLine
();
}
}
}
}
catch
(
Exception
exception
)
{
}
catch
(
Exception
exception
)
{
exception
.
printStackTrace
();
exception
.
printStackTrace
();
}
finally
{
try
{
if
(
null
!=
is
)
{
is
.
close
();
}
if
(
null
!=
br
)
{
br
.
close
();
}
}
catch
(
Exception
exception2
)
{
exception2
.
printStackTrace
();
}
}
}
}
return
buffer
;
return
buffer
;
}
}
...
@@ -245,28 +192,15 @@ public class FileHelper {
...
@@ -245,28 +192,15 @@ public class FileHelper {
* @param path 写入内容的文件路径
* @param path 写入内容的文件路径
*/
*/
public
static
void
writeFile
(
String
content
,
String
path
)
{
public
static
void
writeFile
(
String
content
,
String
path
)
{
OutputStream
fos
=
null
;
File
file
=
new
File
(
path
);
BufferedWriter
bw
=
null
;
try
(
OutputStream
fos
=
new
FileOutputStream
(
file
);
try
{
BufferedWriter
bw
=
new
BufferedWriter
(
new
OutputStreamWriter
(
fos
,
StandardCharsets
.
UTF_8
)))
{
File
file
=
new
File
(
path
);
if
(!
file
.
getParentFile
().
exists
())
{
if
(!
file
.
getParentFile
().
exists
())
{
file
.
getParentFile
().
mkdirs
();
file
.
getParentFile
().
mkdirs
();
}
}
fos
=
new
FileOutputStream
(
file
);
bw
=
new
BufferedWriter
(
new
OutputStreamWriter
(
fos
,
"UTF-8"
));
bw
.
write
(
content
);
bw
.
write
(
content
);
}
catch
(
FileNotFound
Exception
fnfe
)
{
}
catch
(
IO
Exception
fnfe
)
{
fnfe
.
printStackTrace
();
fnfe
.
printStackTrace
();
}
catch
(
IOException
ioe
)
{
ioe
.
printStackTrace
();
}
finally
{
try
{
if
(
bw
!=
null
)
{
bw
.
close
();
}
}
catch
(
IOException
ioException
)
{
System
.
err
.
println
(
ioException
.
getMessage
());
}
}
}
}
}
...
@@ -355,11 +289,8 @@ public class FileHelper {
...
@@ -355,11 +289,8 @@ public class FileHelper {
public
static
void
rmrBlankLines
(
String
inputFile
,
String
outPutFile
)
throws
IOException
{
public
static
void
rmrBlankLines
(
String
inputFile
,
String
outPutFile
)
throws
IOException
{
File
htmFile
=
new
File
(
inputFile
);
File
htmFile
=
new
File
(
inputFile
);
// 以GB2312读取文件
// 以GB2312读取文件
BufferedReader
br
=
null
;
try
(
BufferedReader
br
=
new
BufferedReader
(
new
FileReader
(
htmFile
));
BufferedWriter
bw
=
null
;
BufferedWriter
bw
=
new
BufferedWriter
(
new
FileWriter
(
new
File
(
outPutFile
)));)
{
try
{
br
=
new
BufferedReader
(
new
FileReader
(
htmFile
));
bw
=
new
BufferedWriter
(
new
FileWriter
(
new
File
(
outPutFile
)));
String
result
=
null
;
String
result
=
null
;
while
(
null
!=
(
result
=
br
.
readLine
()))
{
while
(
null
!=
(
result
=
br
.
readLine
()))
{
if
(!
""
.
equals
(
result
.
trim
()))
{
if
(!
""
.
equals
(
result
.
trim
()))
{
...
@@ -368,20 +299,7 @@ public class FileHelper {
...
@@ -368,20 +299,7 @@ public class FileHelper {
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
finally
{
try
{
if
(
null
!=
br
)
{
br
.
close
();
}
if
(
null
!=
bw
)
{
bw
.
close
();
}
}
catch
(
Exception
e
)
{
}
}
}
}
}
/**
/**
...
@@ -1254,38 +1172,31 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam
...
@@ -1254,38 +1172,31 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam
* @throws
* @throws
*/
*/
public
static
void
getExcel
(
String
url
,
String
fileName
,
HttpServletResponse
response
,
HttpServletRequest
request
){
public
static
void
getExcel
(
String
url
,
String
fileName
,
HttpServletResponse
response
,
HttpServletRequest
request
){
//通过文件路径获得File对象
try
{
File
file
=
new
File
(
url
);
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
response
.
setContentType
(
"multipart/form-data"
);
response
.
setContentType
(
"multipart/form-data"
);
//2.设置文件头:最后一个参数是设置下载文件名
try
{
//2.设置文件头:最后一个参数是设置下载文件名
response
.
setHeader
(
"Content-disposition"
,
"attachment; filename=\""
response
.
setHeader
(
"Content-disposition"
,
"attachment; filename=\""
+
encodeChineseDownloadFileName
(
request
,
fileName
+
".xls"
)
+
"\""
);
+
encodeChineseDownloadFileName
(
request
,
fileName
+
".xls"
)
+
"\""
);
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
try
(
FileInputStream
in
=
new
FileInputStream
(
file
);
OutputStream
out
=
new
BufferedOutputStream
(
response
.
getOutputStream
());)
{
// response.setHeader("Content-Disposition", "attachment;filename="
// response.setHeader("Content-Disposition", "attachment;filename="
// + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + ".xls"); //中文文件名
// + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + ".xls"); //中文文件名
//3.通过response获取OutputStream对象(out)
//通过文件路径获得File对象
int
b
=
0
;
File
file
=
new
File
(
url
);
byte
[]
buffer
=
new
byte
[
2048
];
while
((
b
=
in
.
read
(
buffer
))
!=
-
1
){
FileInputStream
in
=
new
FileInputStream
(
file
);
out
.
write
(
buffer
,
0
,
b
);
//4.写到输出流(out)中
//3.通过response获取OutputStream对象(out)
OutputStream
out
=
new
BufferedOutputStream
(
response
.
getOutputStream
());
int
b
=
0
;
byte
[]
buffer
=
new
byte
[
2048
];
while
((
b
=
in
.
read
(
buffer
))
!=
-
1
){
out
.
write
(
buffer
,
0
,
b
);
//4.写到输出流(out)中
}
in
.
close
();
out
.
flush
();
out
.
close
();
}
catch
(
IOException
e
)
{
log
.
error
(
"下载Excel模板异常"
,
e
);
}
}
out
.
flush
();
}
catch
(
IOException
e
)
{
log
.
error
(
"下载Excel模板异常"
,
e
);
}
}
}
/**
/**
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/util/TikaUtils.java
View file @
c5e0e901
...
@@ -34,17 +34,12 @@ public class TikaUtils {
...
@@ -34,17 +34,12 @@ public class TikaUtils {
public
static
String
fileToTxt
(
File
file
)
{
public
static
String
fileToTxt
(
File
file
)
{
org
.
apache
.
tika
.
parser
.
Parser
parser
=
new
AutoDetectParser
();
org
.
apache
.
tika
.
parser
.
Parser
parser
=
new
AutoDetectParser
();
try
{
try
(
InputStream
inputStream
=
new
FileInputStream
(
file
);)
{
InputStream
inputStream
=
new
FileInputStream
(
file
);
DefaultHandler
handler
=
new
BodyContentHandler
();
DefaultHandler
handler
=
new
BodyContentHandler
();
Metadata
metadata
=
new
Metadata
();
Metadata
metadata
=
new
Metadata
();
ParseContext
parseContext
=
new
ParseContext
();
ParseContext
parseContext
=
new
ParseContext
();
parseContext
.
set
(
Parser
.
class
,
parser
);
parseContext
.
set
(
Parser
.
class
,
parser
);
parser
.
parse
(
inputStream
,
handler
,
metadata
,
parseContext
);
parser
.
parse
(
inputStream
,
handler
,
metadata
,
parseContext
);
/*
* for (String string : metadata.names()) {
* System.out.println(string+":"+metadata.get(string)); }
*/
inputStream
.
close
();
inputStream
.
close
();
return
handler
.
toString
();
return
handler
.
toString
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/core/threadpool/AmosThreadPool.java
View file @
c5e0e901
...
@@ -33,12 +33,14 @@ public class AmosThreadPool {
...
@@ -33,12 +33,14 @@ public class AmosThreadPool {
* @return
* @return
*/
*/
public
static
AmosThreadPool
getInstance
()
{
public
static
AmosThreadPool
getInstance
()
{
if
(
instance
==
null
)
{
if
(
null
!=
instance
)
{
synchronized
(
AmosThreadPool
.
class
)
{
return
instance
;
if
(
instance
==
null
)
{
}
instance
=
new
AmosThreadPool
();
synchronized
(
AmosThreadPool
.
class
)
{
}
if
(
instance
!=
null
)
{
return
instance
;
}
}
instance
=
new
AmosThreadPool
();
}
}
return
instance
;
return
instance
;
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/trigger/TriggerKeyQueue.java
View file @
c5e0e901
...
@@ -42,12 +42,14 @@ public class TriggerKeyQueue {
...
@@ -42,12 +42,14 @@ public class TriggerKeyQueue {
* @return
* @return
*/
*/
public
static
TriggerKeyQueue
getInstance
()
{
public
static
TriggerKeyQueue
getInstance
()
{
if
(
instance
==
null
)
{
if
(
null
!=
instance
)
{
synchronized
(
TriggerKeyQueue
.
class
)
{
return
instance
;
if
(
instance
==
null
)
{
}
instance
=
new
TriggerKeyQueue
();
synchronized
(
TriggerKeyQueue
.
class
)
{
}
if
(
instance
!=
null
)
{
return
instance
;
}
}
instance
=
new
TriggerKeyQueue
();
}
}
return
instance
;
return
instance
;
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/core/threadpool/AmosThreadPool.java
View file @
c5e0e901
package
com
.
yeejoin
.
amos
.
patrol
.
core
.
threadpool
;
package
com
.
yeejoin
.
amos
.
patrol
.
core
.
threadpool
;
import
com.yeejoin.amos.patrol.business.constants.XJConstant
;
import
com.yeejoin.amos.patrol.business.constants.XJConstant
;
import
com.yeejoin.amos.patrol.business.trigger.TriggerKeyQueue
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -33,12 +34,14 @@ public class AmosThreadPool {
...
@@ -33,12 +34,14 @@ public class AmosThreadPool {
* @return
* @return
*/
*/
public
static
AmosThreadPool
getInstance
()
{
public
static
AmosThreadPool
getInstance
()
{
if
(
instance
==
null
)
{
if
(
null
!=
instance
)
{
synchronized
(
AmosThreadPool
.
class
)
{
return
instance
;
if
(
instance
==
null
)
{
}
instance
=
new
AmosThreadPool
();
synchronized
(
AmosThreadPool
.
class
)
{
}
if
(
instance
!=
null
)
{
return
instance
;
}
}
instance
=
new
AmosThreadPool
();
}
}
return
instance
;
return
instance
;
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-precontrol-biz/src/main/java/com/yeejoin/precontrol/controller/publics/FileController.java
View file @
c5e0e901
...
@@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.io.*
;
import
java.io.*
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -209,14 +210,10 @@ public class FileController {
...
@@ -209,14 +210,10 @@ public class FileController {
}
else
{
}
else
{
processData
=
DocUtil
.
processDocx
(
data
);
processData
=
DocUtil
.
processDocx
(
data
);
}
}
String
htmlContent
=
(
String
)
processData
.
get
(
"html"
);
String
htmlContent
=
(
String
)
processData
.
get
(
"html"
);
try
{
try
(
Writer
writer
=
new
BufferedWriter
(
new
OutputStreamWriter
(
new
FileOutputStream
(
htmlFileName
),
StandardCharsets
.
UTF_8
));)
{
Writer
writer
=
new
BufferedWriter
(
new
OutputStreamWriter
(
new
FileOutputStream
(
htmlFileName
),
"UTF-8"
));
writer
.
write
(
htmlContent
);
writer
.
write
(
htmlContent
);
writer
.
flush
();
writer
.
flush
();
writer
.
close
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/business/trigger/TriggerKeyQueue.java
View file @
c5e0e901
...
@@ -42,12 +42,14 @@ public class TriggerKeyQueue {
...
@@ -42,12 +42,14 @@ public class TriggerKeyQueue {
* @return
* @return
*/
*/
public
static
TriggerKeyQueue
getInstance
()
{
public
static
TriggerKeyQueue
getInstance
()
{
if
(
instance
==
null
)
{
if
(
null
!=
instance
)
{
synchronized
(
TriggerKeyQueue
.
class
)
{
return
instance
;
if
(
instance
==
null
)
{
}
instance
=
new
TriggerKeyQueue
();
synchronized
(
TriggerKeyQueue
.
class
)
{
}
if
(
instance
!=
null
)
{
return
instance
;
}
}
instance
=
new
TriggerKeyQueue
();
}
}
return
instance
;
return
instance
;
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/business/util/FileHelper.java
View file @
c5e0e901
...
@@ -39,6 +39,7 @@ import java.net.URLEncoder;
...
@@ -39,6 +39,7 @@ import java.net.URLEncoder;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
import
java.nio.channels.Channel
;
import
java.nio.channels.Channel
;
import
java.nio.channels.FileChannel
;
import
java.nio.channels.FileChannel
;
import
java.nio.charset.StandardCharsets
;
import
java.util.*
;
import
java.util.*
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipOutputStream
;
import
java.util.zip.ZipOutputStream
;
...
@@ -63,11 +64,8 @@ public class FileHelper {
...
@@ -63,11 +64,8 @@ public class FileHelper {
* @return
* @return
*/
*/
public
static
boolean
isExcel2003
(
File
file
)
{
public
static
boolean
isExcel2003
(
File
file
)
{
InputStream
is
=
null
;
try
(
InputStream
is
=
new
FileInputStream
(
file
);
Workbook
wb
=
null
;
Workbook
wb
=
WorkbookFactory
.
create
(
is
);)
{
try
{
is
=
new
FileInputStream
(
file
);
wb
=
WorkbookFactory
.
create
(
is
);
if
(
wb
instanceof
XSSFWorkbook
)
{
if
(
wb
instanceof
XSSFWorkbook
)
{
return
false
;
return
false
;
}
else
if
(
wb
instanceof
HSSFWorkbook
)
{
}
else
if
(
wb
instanceof
HSSFWorkbook
)
{
...
@@ -75,17 +73,6 @@ public class FileHelper {
...
@@ -75,17 +73,6 @@ public class FileHelper {
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
false
;
return
false
;
}
finally
{
try
{
if
(
null
!=
is
)
{
is
.
close
();
}
if
(
null
!=
wb
)
{
wb
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
return
true
;
return
true
;
}
}
...
@@ -96,20 +83,10 @@ public class FileHelper {
...
@@ -96,20 +83,10 @@ public class FileHelper {
* @return
* @return
*/
*/
public
static
boolean
isWord2003
(
File
file
)
{
public
static
boolean
isWord2003
(
File
file
)
{
InputStream
is
=
null
;
try
(
InputStream
is
=
new
FileInputStream
(
file
);
try
{
HWPFDocument
hwpfDocument
=
new
HWPFDocument
(
is
);)
{
is
=
new
FileInputStream
(
file
);
new
HWPFDocument
(
is
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
false
;
return
false
;
}
finally
{
try
{
if
(
null
!=
is
)
{
is
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
return
true
;
return
true
;
}
}
...
@@ -168,34 +145,19 @@ public class FileHelper {
...
@@ -168,34 +145,19 @@ public class FileHelper {
*/
*/
public
static
StringBuffer
readFile
(
String
path
)
{
public
static
StringBuffer
readFile
(
String
path
)
{
StringBuffer
buffer
=
new
StringBuffer
();
StringBuffer
buffer
=
new
StringBuffer
();
InputStream
is
=
null
;
File
file
=
new
File
(
path
);
BufferedReader
br
=
null
;
if
(
file
.
exists
())
{
try
{
try
(
InputStream
is
=
new
FileInputStream
(
file
);
File
file
=
new
File
(
path
);
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
is
)))
{
if
(
file
.
exists
())
{
is
=
new
FileInputStream
(
file
);
br
=
new
BufferedReader
(
new
InputStreamReader
(
is
));
String
content
=
br
.
readLine
();
String
content
=
br
.
readLine
();
while
(
null
!=
content
)
{
while
(
null
!=
content
)
{
buffer
.
append
(
content
);
buffer
.
append
(
content
);
content
=
br
.
readLine
();
content
=
br
.
readLine
();
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
if
(
null
!=
is
)
{
is
.
close
();
}
if
(
null
!=
br
)
{
br
.
close
();
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
return
buffer
;
return
buffer
;
}
}
...
@@ -207,34 +169,19 @@ public class FileHelper {
...
@@ -207,34 +169,19 @@ public class FileHelper {
*/
*/
public
static
StringBuffer
readFile
(
String
path
,
String
split
)
{
public
static
StringBuffer
readFile
(
String
path
,
String
split
)
{
StringBuffer
buffer
=
new
StringBuffer
();
StringBuffer
buffer
=
new
StringBuffer
();
InputStream
is
=
null
;
File
file
=
new
File
(
path
);
BufferedReader
br
=
null
;
if
(
file
.
exists
())
{
try
{
try
(
InputStream
is
=
new
FileInputStream
(
file
);
File
file
=
new
File
(
path
);
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
is
)))
{
if
(
file
.
exists
())
{
is
=
new
FileInputStream
(
file
);
br
=
new
BufferedReader
(
new
InputStreamReader
(
is
));
String
content
=
br
.
readLine
();
String
content
=
br
.
readLine
();
while
(
null
!=
content
)
{
while
(
null
!=
content
)
{
buffer
.
append
(
content
).
append
(
split
);
buffer
.
append
(
content
).
append
(
split
);
content
=
br
.
readLine
();
content
=
br
.
readLine
();
}
}
}
}
catch
(
Exception
exception
)
{
}
catch
(
Exception
exception
)
{
exception
.
printStackTrace
();
exception
.
printStackTrace
();
}
finally
{
try
{
if
(
null
!=
is
)
{
is
.
close
();
}
if
(
null
!=
br
)
{
br
.
close
();
}
}
catch
(
Exception
exception2
)
{
exception2
.
printStackTrace
();
}
}
}
}
return
buffer
;
return
buffer
;
}
}
...
@@ -244,28 +191,15 @@ public class FileHelper {
...
@@ -244,28 +191,15 @@ public class FileHelper {
* @param path 写入内容的文件路径
* @param path 写入内容的文件路径
*/
*/
public
static
void
writeFile
(
String
content
,
String
path
)
{
public
static
void
writeFile
(
String
content
,
String
path
)
{
OutputStream
fos
=
null
;
File
file
=
new
File
(
path
);
BufferedWriter
bw
=
null
;
try
(
OutputStream
fos
=
new
FileOutputStream
(
file
);
try
{
BufferedWriter
bw
=
new
BufferedWriter
(
new
OutputStreamWriter
(
fos
,
StandardCharsets
.
UTF_8
)))
{
File
file
=
new
File
(
path
);
if
(!
file
.
getParentFile
().
exists
())
{
if
(!
file
.
getParentFile
().
exists
())
{
file
.
getParentFile
().
mkdirs
();
file
.
getParentFile
().
mkdirs
();
}
}
fos
=
new
FileOutputStream
(
file
);
bw
=
new
BufferedWriter
(
new
OutputStreamWriter
(
fos
,
"UTF-8"
));
bw
.
write
(
content
);
bw
.
write
(
content
);
}
catch
(
FileNotFound
Exception
fnfe
)
{
}
catch
(
IO
Exception
fnfe
)
{
fnfe
.
printStackTrace
();
fnfe
.
printStackTrace
();
}
catch
(
IOException
ioe
)
{
ioe
.
printStackTrace
();
}
finally
{
try
{
if
(
bw
!=
null
)
{
bw
.
close
();
}
}
catch
(
IOException
ioException
)
{
System
.
err
.
println
(
ioException
.
getMessage
());
}
}
}
}
}
...
@@ -354,11 +288,8 @@ public class FileHelper {
...
@@ -354,11 +288,8 @@ public class FileHelper {
public
static
void
rmrBlankLines
(
String
inputFile
,
String
outPutFile
)
throws
IOException
{
public
static
void
rmrBlankLines
(
String
inputFile
,
String
outPutFile
)
throws
IOException
{
File
htmFile
=
new
File
(
inputFile
);
File
htmFile
=
new
File
(
inputFile
);
// 以GB2312读取文件
// 以GB2312读取文件
BufferedReader
br
=
null
;
try
(
BufferedReader
br
=
new
BufferedReader
(
new
FileReader
(
htmFile
));
BufferedWriter
bw
=
null
;
BufferedWriter
bw
=
new
BufferedWriter
(
new
FileWriter
(
new
File
(
outPutFile
)));)
{
try
{
br
=
new
BufferedReader
(
new
FileReader
(
htmFile
));
bw
=
new
BufferedWriter
(
new
FileWriter
(
new
File
(
outPutFile
)));
String
result
=
null
;
String
result
=
null
;
while
(
null
!=
(
result
=
br
.
readLine
()))
{
while
(
null
!=
(
result
=
br
.
readLine
()))
{
if
(!
""
.
equals
(
result
.
trim
()))
{
if
(!
""
.
equals
(
result
.
trim
()))
{
...
@@ -367,20 +298,7 @@ public class FileHelper {
...
@@ -367,20 +298,7 @@ public class FileHelper {
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
finally
{
try
{
if
(
null
!=
br
)
{
br
.
close
();
}
if
(
null
!=
bw
)
{
bw
.
close
();
}
}
catch
(
Exception
e
)
{
}
}
}
}
}
/**
/**
...
@@ -1253,38 +1171,31 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam
...
@@ -1253,38 +1171,31 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam
* @throws
* @throws
*/
*/
public
static
void
getExcel
(
String
url
,
String
fileName
,
HttpServletResponse
response
,
HttpServletRequest
request
){
public
static
void
getExcel
(
String
url
,
String
fileName
,
HttpServletResponse
response
,
HttpServletRequest
request
){
//通过文件路径获得File对象
try
{
File
file
=
new
File
(
url
);
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
response
.
setContentType
(
"multipart/form-data"
);
response
.
setContentType
(
"multipart/form-data"
);
//2.设置文件头:最后一个参数是设置下载文件名
try
{
//2.设置文件头:最后一个参数是设置下载文件名
response
.
setHeader
(
"Content-disposition"
,
"attachment; filename=\""
response
.
setHeader
(
"Content-disposition"
,
"attachment; filename=\""
+
encodeChineseDownloadFileName
(
request
,
fileName
+
".xls"
)
+
"\""
);
+
encodeChineseDownloadFileName
(
request
,
fileName
+
".xls"
)
+
"\""
);
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
try
(
FileInputStream
in
=
new
FileInputStream
(
file
);
OutputStream
out
=
new
BufferedOutputStream
(
response
.
getOutputStream
());)
{
// response.setHeader("Content-Disposition", "attachment;filename="
// response.setHeader("Content-Disposition", "attachment;filename="
// + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + ".xls"); //中文文件名
// + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + ".xls"); //中文文件名
//3.通过response获取OutputStream对象(out)
//通过文件路径获得File对象
int
b
=
0
;
File
file
=
new
File
(
url
);
byte
[]
buffer
=
new
byte
[
2048
];
while
((
b
=
in
.
read
(
buffer
))
!=
-
1
){
FileInputStream
in
=
new
FileInputStream
(
file
);
out
.
write
(
buffer
,
0
,
b
);
//4.写到输出流(out)中
//3.通过response获取OutputStream对象(out)
OutputStream
out
=
new
BufferedOutputStream
(
response
.
getOutputStream
());
int
b
=
0
;
byte
[]
buffer
=
new
byte
[
2048
];
while
((
b
=
in
.
read
(
buffer
))
!=
-
1
){
out
.
write
(
buffer
,
0
,
b
);
//4.写到输出流(out)中
}
in
.
close
();
out
.
flush
();
out
.
close
();
}
catch
(
IOException
e
)
{
log
.
error
(
"下载Excel模板异常"
,
e
);
}
}
out
.
flush
();
}
catch
(
IOException
e
)
{
log
.
error
(
"下载Excel模板异常"
,
e
);
}
}
}
/**
/**
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/business/util/TikaUtils.java
View file @
c5e0e901
...
@@ -34,17 +34,12 @@ public class TikaUtils {
...
@@ -34,17 +34,12 @@ public class TikaUtils {
public
static
String
fileToTxt
(
File
file
)
{
public
static
String
fileToTxt
(
File
file
)
{
org
.
apache
.
tika
.
parser
.
Parser
parser
=
new
AutoDetectParser
();
org
.
apache
.
tika
.
parser
.
Parser
parser
=
new
AutoDetectParser
();
try
{
try
(
InputStream
inputStream
=
new
FileInputStream
(
file
);)
{
InputStream
inputStream
=
new
FileInputStream
(
file
);
DefaultHandler
handler
=
new
BodyContentHandler
();
DefaultHandler
handler
=
new
BodyContentHandler
();
Metadata
metadata
=
new
Metadata
();
Metadata
metadata
=
new
Metadata
();
ParseContext
parseContext
=
new
ParseContext
();
ParseContext
parseContext
=
new
ParseContext
();
parseContext
.
set
(
Parser
.
class
,
parser
);
parseContext
.
set
(
Parser
.
class
,
parser
);
parser
.
parse
(
inputStream
,
handler
,
metadata
,
parseContext
);
parser
.
parse
(
inputStream
,
handler
,
metadata
,
parseContext
);
/*
* for (String string : metadata.names()) {
* System.out.println(string+":"+metadata.get(string)); }
*/
inputStream
.
close
();
inputStream
.
close
();
return
handler
.
toString
();
return
handler
.
toString
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -58,21 +53,14 @@ public class TikaUtils {
...
@@ -58,21 +53,14 @@ public class TikaUtils {
ContentHandler
handler
=
new
ToHTMLContentHandler
();
ContentHandler
handler
=
new
ToHTMLContentHandler
();
AutoDetectParser
parser
=
new
AutoDetectParser
();
AutoDetectParser
parser
=
new
AutoDetectParser
();
Metadata
metadata
=
new
Metadata
();
Metadata
metadata
=
new
Metadata
();
InputStream
stream
=
null
;
try
(
InputStream
stream
=
new
FileInputStream
(
new
File
(
fileName
));)
{
try
{
stream
=
new
FileInputStream
(
new
File
(
fileName
));
parser
.
parse
(
stream
,
handler
,
metadata
);
parser
.
parse
(
stream
,
handler
,
metadata
);
FileHelper
.
writeFile
(
handler
.
toString
(),
outPutFile
+
".html"
);
FileHelper
.
writeFile
(
handler
.
toString
(),
outPutFile
+
".html"
);
FileHelper
.
parse
(
outPutFile
+
".html"
);
FileHelper
.
parse
(
outPutFile
+
".html"
);
return
null
;
return
null
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
finally
{
}
}
return
null
;
return
null
;
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/core/threadpool/AmosThreadPool.java
View file @
c5e0e901
...
@@ -33,12 +33,14 @@ public class AmosThreadPool {
...
@@ -33,12 +33,14 @@ public class AmosThreadPool {
* @return
* @return
*/
*/
public
static
AmosThreadPool
getInstance
()
{
public
static
AmosThreadPool
getInstance
()
{
if
(
instance
==
null
)
{
if
(
null
!=
instance
)
{
synchronized
(
AmosThreadPool
.
class
)
{
return
instance
;
if
(
instance
==
null
)
{
}
instance
=
new
AmosThreadPool
();
synchronized
(
AmosThreadPool
.
class
)
{
}
if
(
instance
!=
null
)
{
return
instance
;
}
}
instance
=
new
AmosThreadPool
();
}
}
return
instance
;
return
instance
;
}
}
...
...
amos-boot-system-tdc/amos-boot-module-tdc-api/src/main/java/com/yeejoin/amos/boot/module/tdc/api/utils/WordPowerUtils.java
View file @
c5e0e901
...
@@ -193,19 +193,12 @@ public class WordPowerUtils {
...
@@ -193,19 +193,12 @@ public class WordPowerUtils {
if
(!
file
.
exists
())
{
if
(!
file
.
exists
())
{
return
""
;
return
""
;
}
}
InputStream
in
=
null
;
byte
[]
data
=
null
;
byte
[]
data
=
null
;
try
{
try
(
InputStream
in
=
new
FileInputStream
(
file
))
{
in
=
new
FileInputStream
(
file
);
}
catch
(
FileNotFoundException
e1
)
{
e1
.
printStackTrace
();
}
try
{
data
=
new
byte
[
in
.
available
()];
data
=
new
byte
[
in
.
available
()];
in
.
read
(
data
);
in
.
read
(
data
);
in
.
close
();
}
catch
(
IOException
e1
)
{
}
catch
(
IOException
e
)
{
e1
.
printStackTrace
();
e
.
printStackTrace
();
}
}
BASE64Encoder
encoder
=
new
BASE64Encoder
();
BASE64Encoder
encoder
=
new
BASE64Encoder
();
return
encoder
.
encode
(
data
);
return
encoder
.
encode
(
data
);
...
...
amos-boot-system-tdc/amos-boot-module-tdc-biz/src/main/java/com/yeejoin/amos/boot/module/tdc/biz/service/impl/CheckResultImpl.java
View file @
c5e0e901
...
@@ -334,15 +334,13 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult>
...
@@ -334,15 +334,13 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult>
* @return
* @return
*/
*/
private
static
byte
[]
file2byte
(
File
file
)
{
private
static
byte
[]
file2byte
(
File
file
)
{
try
{
try
(
FileInputStream
in
=
new
FileInputStream
(
file
);)
{
FileInputStream
in
=
new
FileInputStream
(
file
);
byte
[]
data
=
new
byte
[
in
.
available
()];
byte
[]
data
=
new
byte
[
in
.
available
()];
in
.
read
(
data
);
in
.
read
(
data
);
in
.
close
();
return
data
;
return
data
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
return
n
ull
;
return
n
ew
byte
[
0
]
;
}
}
}
}
...
...
amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/core/threadpool/AmosThreadPool.java
View file @
c5e0e901
...
@@ -32,12 +32,14 @@ public class AmosThreadPool {
...
@@ -32,12 +32,14 @@ public class AmosThreadPool {
* @return
* @return
*/
*/
public
static
AmosThreadPool
getInstance
()
{
public
static
AmosThreadPool
getInstance
()
{
if
(
instance
==
null
)
{
if
(
null
!=
instance
)
{
synchronized
(
AmosThreadPool
.
class
)
{
return
instance
;
if
(
instance
==
null
)
{
}
instance
=
new
AmosThreadPool
();
synchronized
(
AmosThreadPool
.
class
)
{
}
if
(
instance
!=
null
)
{
return
instance
;
}
}
instance
=
new
AmosThreadPool
();
}
}
return
instance
;
return
instance
;
}
}
...
...
amos-boot-utils/amos-boot-utils-message/src/main/java/com/yeejoin/amos/message/eqmx/EmqMessageService.java
View file @
c5e0e901
...
@@ -22,6 +22,8 @@ import java.util.concurrent.BlockingQueue;
...
@@ -22,6 +22,8 @@ import java.util.concurrent.BlockingQueue;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
net.sf.json.JSONObject
;
import
net.sf.json.JSONObject
;
import
static
com
.
alibaba
.
fastjson
.
JSON
.
parseArray
;
@Slf4j
@Slf4j
@Component
@Component
public
class
EmqMessageService
extends
EmqxListener
{
public
class
EmqMessageService
extends
EmqxListener
{
...
@@ -55,7 +57,7 @@ public class EmqMessageService extends EmqxListener {
...
@@ -55,7 +57,7 @@ public class EmqMessageService extends EmqxListener {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
list
=
com
.
alibaba
.
fastjson
.
JSONObject
.
parseArray
(
json
,
Map
.
class
);
list
=
parseArray
(
json
,
Map
.
class
);
String
[]
split
=
topics
.
split
(
","
);
String
[]
split
=
topics
.
split
(
","
);
Arrays
.
stream
(
split
).
forEach
(
e
->
{
Arrays
.
stream
(
split
).
forEach
(
e
->
{
...
@@ -78,7 +80,11 @@ public class EmqMessageService extends EmqxListener {
...
@@ -78,7 +80,11 @@ public class EmqMessageService extends EmqxListener {
Runnable
task_runnable
=
new
Runnable
()
{
Runnable
task_runnable
=
new
Runnable
()
{
public
void
run
()
{
public
void
run
()
{
while
(
true
)
{
int
k
=
0
;
boolean
b
=
true
;
while
(
b
)
{
k
++;
b
=
k
<
Integer
.
MAX_VALUE
;
try
{
try
{
JSONObject
messageResult
=
blockingQueue
.
take
();
JSONObject
messageResult
=
blockingQueue
.
take
();
JSONObject
result
=
messageResult
.
getJSONObject
(
"result"
);
JSONObject
result
=
messageResult
.
getJSONObject
(
"result"
);
...
@@ -89,6 +95,7 @@ public class EmqMessageService extends EmqxListener {
...
@@ -89,6 +95,7 @@ public class EmqMessageService extends EmqxListener {
}
}
});
});
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
Thread
.
currentThread
().
interrupt
();
log
.
info
(
"发送kafka消息失败 ====> message: {}"
,
e
.
getMessage
());
log
.
info
(
"发送kafka消息失败 ====> message: {}"
,
e
.
getMessage
());
}
}
}
}
...
...
amos-boot-utils/amos-boot-utils-speech/src/main/java/com/yeejoin/amos/speech/AppSpeechTranscriber.java
View file @
c5e0e901
...
@@ -66,7 +66,11 @@ public class AppSpeechTranscriber {
...
@@ -66,7 +66,11 @@ public class AppSpeechTranscriber {
DatagramPacket
datagramPacket
=
new
DatagramPacket
(
b
,
b
.
length
);
DatagramPacket
datagramPacket
=
new
DatagramPacket
(
b
,
b
.
length
);
logger
.
warn
(
"serverSocket已启动,地址:"
+
localIpAddress
logger
.
warn
(
"serverSocket已启动,地址:"
+
localIpAddress
+
"监听端口:"
+
serverSocket
.
getLocalPort
()
+
" 等待语音融合系统推送数据..."
);
+
"监听端口:"
+
serverSocket
.
getLocalPort
()
+
" 等待语音融合系统推送数据..."
);
while
(
true
)
{
int
k
=
0
;
boolean
b1
=
true
;
while
(
b1
)
{
k
++;
b1
=
k
<
Integer
.
MAX_VALUE
;
serverSocket
.
receive
(
datagramPacket
);
serverSocket
.
receive
(
datagramPacket
);
if
(
transcriber
==
null
)
{
if
(
transcriber
==
null
)
{
logger
.
warn
(
"收到第一个数据包:"
+
b
.
length
+
" 开始进行语音翻译"
);
logger
.
warn
(
"收到第一个数据包:"
+
b
.
length
+
" 开始进行语音翻译"
);
...
...
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