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
d1cbeeae
Commit
d1cbeeae
authored
Jun 09, 2022
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.安全管理报表
2.二维码工具类
parent
6f7e8a74
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
172 additions
and
106 deletions
+172
-106
pom.xml
...e/amos-boot-module-api/amos-boot-module-equip-api/pom.xml
+5
-0
QRCodeUtil.java
...java/com/yeejoin/equipmanage/common/utils/QRCodeUtil.java
+108
-14
WordTemplateUtils.java
...m/yeejoin/equipmanage/common/utils/WordTemplateUtils.java
+43
-86
FireAutoSysManageReportController.java
...pmanage/controller/FireAutoSysManageReportController.java
+3
-4
FilePatrolReportServiceImpl.java
...equipmanage/service/impl/FilePatrolReportServiceImpl.java
+7
-1
FireAutoSysManageReportServiceImpl.java
...nage/service/impl/FireAutoSysManageReportServiceImpl.java
+6
-1
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/pom.xml
View file @
d1cbeeae
...
...
@@ -50,5 +50,10 @@
<groupId>
com.yeejoin
</groupId>
<artifactId>
amos-component-rule
</artifactId>
</dependency>
<dependency>
<groupId>
com.google.zxing
</groupId>
<artifactId>
javase
</artifactId>
<version>
3.3.0
</version>
</dependency>
</dependencies>
</project>
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/utils/QRCodeUtil.java
View file @
d1cbeeae
...
...
@@ -3,14 +3,19 @@ package com.yeejoin.equipmanage.common.utils;
import
com.google.zxing.BarcodeFormat
;
import
com.google.zxing.EncodeHintType
;
import
com.google.zxing.MultiFormatWriter
;
import
com.google.zxing.client.j2se.MatrixToImageWriter
;
import
com.google.zxing.common.BitMatrix
;
import
com.google.zxing.qrcode.QRCodeWriter
;
import
com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
;
import
org.apache.commons.lang3.StringUtils
;
import
javax.imageio.ImageIO
;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.text.SimpleDateFormat
;
import
java.util.Base64
;
import
java.util.Date
;
import
java.util.Hashtable
;
import
java.util.Random
;
...
...
@@ -19,8 +24,8 @@ import java.util.concurrent.locks.ReentrantLock;
/**
* 二维码工具类
* @author Administrator
*
* @author Administrator
*/
public
class
QRCodeUtil
{
...
...
@@ -33,22 +38,20 @@ public class QRCodeUtil {
private
static
final
int
QRCODE_SIZE
=
45
;
private
static
int
randomNumForQrCode
;
/**
*
* <pre>
* 根据当前记录ID生成QRCode
* </pre>
*
* @return
*/
public
static
String
generateQRCode
(
Date
dateCreated
,
String
pointNo
)
{
public
static
String
generateQRCode
(
Date
dateCreated
,
String
pointNo
)
{
return
String
.
valueOf
(
dateCreated
.
getTime
()
+
pointNo
);
}
/**
*
* <pre>
* 生成QRCode
* </pre>
...
...
@@ -56,25 +59,24 @@ public class QRCodeUtil {
* @param id
* @return
*/
public
static
String
generateQRCode
()
{
public
static
String
generateQRCode
()
{
String
res
;
//加锁生成随机数,保证自增后释放
Lock
lock
=
new
ReentrantLock
();
lock
.
lock
();
randomNumForQrCode
+=
1
;
randomNumForQrCode
+=
1
;
//return String.valueOf(dateCreated.getTime() + id);
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
try
{
res
=
simpleDateFormat
.
format
(
new
Date
(
System
.
currentTimeMillis
())).
substring
(
5
,
8
)
+
String
.
valueOf
(
IdWorker
.
getFlowIdWorkerInstance
().
nextId
()).
substring
(
0
,
10
)+
randomNumForQrCode
;
}
catch
(
Exception
e
)
{
res
=
simpleDateFormat
.
format
(
new
Date
(
System
.
currentTimeMillis
())).
substring
(
5
,
8
)
+
String
.
valueOf
(
IdWorker
.
getFlowIdWorkerInstance
().
nextId
()).
substring
(
0
,
10
)
+
randomNumForQrCode
;
}
catch
(
Exception
e
)
{
Random
random
=
new
Random
(
System
.
currentTimeMillis
());
String
tmp
=
""
;
for
(
int
i
=
0
;
i
<
13
;
i
++)
{
for
(
int
i
=
0
;
i
<
13
;
i
++)
{
tmp
+=
random
.
nextInt
(
10
);
}
res
=
simpleDateFormat
.
format
(
new
Date
(
System
.
currentTimeMillis
())).
substring
(
2
,
8
)
+
tmp
.
substring
(
0
,
10
)+
randomNumForQrCode
;
}
finally
{
res
=
simpleDateFormat
.
format
(
new
Date
(
System
.
currentTimeMillis
())).
substring
(
2
,
8
)
+
tmp
.
substring
(
0
,
10
)
+
randomNumForQrCode
;
}
finally
{
lock
.
unlock
();
}
return
res
;
...
...
@@ -88,7 +90,7 @@ public class QRCodeUtil {
*/
public
static
String
temporaryQrCode
()
{
long
qrCode
=
-
1
*
System
.
currentTimeMillis
();
qrCode
+=
(
long
)
(
random
.
nextDouble
()
*
10000000
);
qrCode
+=
(
long
)
(
random
.
nextDouble
()
*
10000000
);
return
String
.
valueOf
(
qrCode
);
}
...
...
@@ -132,4 +134,96 @@ public class QRCodeUtil {
}
return
null
;
}
/**
* 生成简单的二维码
*
* @param text 二维码内容
* @param width 二维码宽度
* @param height 二维码高度
* @return String 图片base64
*/
public
static
String
genQrCodeBase64Png
(
String
text
,
int
width
,
int
height
)
{
ByteArrayOutputStream
outputStream
;
Base64
.
Encoder
encoder
;
try
{
QRCodeWriter
qrCodeWriter
=
new
QRCodeWriter
();
BitMatrix
bitMatrix
=
qrCodeWriter
.
encode
(
text
,
BarcodeFormat
.
QR_CODE
,
width
,
height
);
outputStream
=
new
ByteArrayOutputStream
();
MatrixToImageWriter
.
writeToStream
(
bitMatrix
,
"PNG"
,
outputStream
);
encoder
=
Base64
.
getEncoder
();
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"二维码生成失败"
);
}
return
encoder
.
encodeToString
(
outputStream
.
toByteArray
());
}
/**
* 生成带文字说明的二维码
*
* @param text 二维码内容
* @param width 二维码宽度
* @param height 二维码高度
* @param word 二维码下方文字说明
* @param wordHeight 二维码下方文字高度
* @return String 图片base64
*/
public
static
String
genQrCodeBase64PngWithWord
(
String
text
,
int
width
,
int
height
,
String
word
,
int
wordHeight
)
{
ByteArrayOutputStream
outputStream
;
Base64
.
Encoder
encoder
;
try
{
QRCodeWriter
qrCodeWriter
=
new
QRCodeWriter
();
BitMatrix
bitMatrix
=
qrCodeWriter
.
encode
(
text
,
BarcodeFormat
.
QR_CODE
,
width
,
height
);
BufferedImage
image
=
MatrixToImageWriter
.
toBufferedImage
(
bitMatrix
);
BufferedImage
outImage
=
null
;
if
(
StringUtils
.
isNotBlank
(
word
))
{
outImage
=
new
BufferedImage
(
width
,
wordHeight
,
BufferedImage
.
TYPE_4BYTE_ABGR
);
Graphics2D
outg
=
outImage
.
createGraphics
();
// 画二维码到新的面板
outg
.
drawImage
(
image
,
0
,
0
,
image
.
getWidth
(),
image
.
getHeight
(),
null
);
// 画文字到新的面板
outg
.
setColor
(
Color
.
BLACK
);
// 字体、字型、字号
outg
.
setFont
(
new
Font
(
"微软雅黑"
,
Font
.
PLAIN
,
16
));
int
strWidth
=
outg
.
getFontMetrics
().
stringWidth
(
word
);
int
singleFd
=
outg
.
getFontMetrics
().
stringWidth
(
"2"
);
int
grow
=
width
/
singleFd
-
1
;
//长度过长就截取超出二维码宽度部分换行
if
(
strWidth
>
width
)
{
String
serialNum1
=
word
.
substring
(
0
,
grow
);
String
serialNum2
=
word
.
substring
(
grow
,
word
.
length
());
outg
.
drawString
(
serialNum1
,
5
,
image
.
getHeight
()
+
(
outImage
.
getHeight
()
-
image
.
getHeight
())
/
2
);
BufferedImage
outImage2
=
new
BufferedImage
(
width
,
wordHeight
,
BufferedImage
.
TYPE_4BYTE_ABGR
);
Graphics2D
outg2
=
outImage2
.
createGraphics
();
outg2
.
drawImage
(
outImage
,
0
,
0
,
outImage
.
getWidth
(),
outImage
.
getHeight
(),
null
);
outg2
.
setColor
(
Color
.
BLACK
);
// 字体、字型、字号
outg2
.
setFont
(
new
Font
(
"微软雅黑"
,
Font
.
PLAIN
,
16
));
//参数:显示的内容、起始位置x、起始的y
outg2
.
drawString
(
serialNum2
,
5
,
outImage
.
getHeight
()
+
(
outImage2
.
getHeight
()
-
outImage
.
getHeight
())
/
2
);
outg2
.
dispose
();
outImage2
.
flush
();
outImage
=
outImage2
;
}
else
{
// 画文字
outg
.
drawString
(
word
,
(
width
-
strWidth
)
/
2
,
image
.
getHeight
()
+
(
outImage
.
getHeight
()
-
image
.
getHeight
())
/
3
);
}
outg
.
dispose
();
outImage
.
flush
();
image
.
flush
();
}
outputStream
=
new
ByteArrayOutputStream
();
ImageIO
.
write
(
outImage
,
"PNG"
,
outputStream
);
encoder
=
Base64
.
getEncoder
();
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"二维码生成失败"
);
}
return
encoder
.
encodeToString
(
outputStream
.
toByteArray
());
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
genQrCodeBase64Png
(
"101"
,
100
,
100
));
System
.
out
.
println
(
genQrCodeBase64PngWithWord
(
"101"
,
100
,
100
,
"sd"
,
100
));
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/utils/WordTemplateUtils.java
View file @
d1cbeeae
package
com
.
yeejoin
.
equipmanage
.
common
.
utils
;
import
java.io.BufferedReader
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.OutputStream
;
import
java.io.OutputStreamWriter
;
import
java.io.StringWriter
;
import
java.io.Writer
;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.Properties
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.fileupload.FileItem
;
import
org.apache.commons.fileupload.FileItemFactory
;
import
org.apache.commons.fileupload.disk.DiskFileItemFactory
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang.WordUtils
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.support.PropertiesLoaderUtils
;
import
org.springframework.http.MediaType
;
import
org.springframework.util.ResourceUtils
;
import
com.aspose.words.License
;
import
com.aspose.words.SaveFormat
;
import
com.itextpdf.text.pdf.BaseFont
;
import
freemarker.cache.ClassTemplateLoader
;
import
freemarker.template.Configuration
;
import
freemarker.template.Template
;
import
org.springframework.core.io.support.PropertiesLoaderUtils
;
import
sun.misc.BASE64Encoder
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.net.URLEncoder
;
import
java.util.Map
;
import
java.util.Properties
;
public
class
WordTemplateUtils
{
private
static
String
fileUploadDir
;
private
Configuration
configuration
=
null
;
private
Configuration
configuration
;
private
static
WordTemplateUtils
wordTemplateUtils
;
...
...
@@ -58,8 +29,8 @@ public class WordTemplateUtils {
configuration
.
setDefaultEncoding
(
"utf-8"
);
}
public
static
synchronized
WordTemplateUtils
getInstance
()
{
if
(
wordTemplateUtils
==
null
)
{
public
static
synchronized
WordTemplateUtils
getInstance
()
{
if
(
wordTemplateUtils
==
null
)
{
//添加你的内容
Properties
props
;
try
{
...
...
@@ -77,25 +48,8 @@ public class WordTemplateUtils {
public
void
exportMillCertificateWord
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Map
map
,
String
title
,
String
ftlFile
)
throws
IOException
{
URL
resourcePath
=
this
.
getClass
().
getClassLoader
().
getResource
(
"ftl"
);
Resource
resource
=
new
ClassPathResource
(
"ftl"
);
// 配置路径 /config.xml
configuration
.
setClassForTemplateLoading
(
this
.
getClass
(),
"/ftl"
);
// InputStream is = resource.getInputStream();
// InputStreamReader isr = new InputStreamReader(is);
// BufferedReader br = new BufferedReader(isr);
// String data = null;
// while((data = br.readLine()) != null) {
// //System.out.println(data);
// }
// br.close();
// isr.close();
// is.close();
//String path = ResourceUtils.getURL("classpath:").getPath();
//System.out.println(path);
//configuration.setDirectoryForTemplateLoading(new File(path));
// configuration.setTemplateLoader(new ClassTemplateLoader(
// this.getClass().getClassLoader(), "/ftl"));
Template
freemarkerTemplate
=
configuration
.
getTemplate
(
ftlFile
,
"UTF-8"
);
Template
freemarkerTemplate
=
configuration
.
getTemplate
(
ftlFile
,
"UTF-8"
);
File
file
=
null
;
InputStream
fin
=
null
;
ServletOutputStream
out
=
null
;
...
...
@@ -112,34 +66,31 @@ public class WordTemplateUtils {
"attachment;filename="
.
concat
(
String
.
valueOf
(
URLEncoder
.
encode
(
fileName
,
"UTF-8"
))));
out
=
response
.
getOutputStream
();
byte
[]
buffer
=
new
byte
[
512
];
// 缓冲区
// 缓冲区
byte
[]
buffer
=
new
byte
[
512
];
int
bytesToRead
=
-
1
;
// 通过循环将读入的Word文件的内容输出到浏览器中
while
((
bytesToRead
=
fin
.
read
(
buffer
))
!=
-
1
)
{
out
.
write
(
buffer
,
0
,
bytesToRead
);
}
}
finally
{
if
(
fin
!=
null
){
fin
.
close
();}
if
(
out
!=
null
){
out
.
close
();}
if
(
file
!=
null
){
file
.
delete
();
}
// 删除临时文件
if
(
fin
!=
null
)
{
fin
.
close
();
}
if
(
out
!=
null
)
{
out
.
close
();
}
if
(
file
!=
null
)
{
file
.
delete
();
}
// 删除临时文件
}
}
public
File
getWordFileItem
(
Map
map
,
String
title
,
String
ftlFile
)
throws
IOException
{
URL
resourcePath
=
this
.
getClass
().
getClassLoader
().
getResource
(
"ftl"
);
public
File
getWordFileItem
(
Map
map
,
String
title
,
String
ftlFile
)
throws
IOException
{
configuration
.
setClassForTemplateLoading
(
this
.
getClass
(),
"/ftl"
);
Template
freemarkerTemplate
=
configuration
.
getTemplate
(
ftlFile
,
"UTF-8"
);
FileItemFactory
factory
=
new
DiskFileItemFactory
(
16
,
null
);
String
textFieldName
=
"file"
;
Template
freemarkerTemplate
=
configuration
.
getTemplate
(
ftlFile
,
"UTF-8"
);
File
file
=
null
;
File
filepdf
=
new
File
(
"sellPlan.pdf"
);
int
bytesRead
=
0
;
byte
[]
buffer
=
new
byte
[
10
*
1024
*
1024
];
InputStream
fin
=
null
;
OutputStream
os
=
null
;
try
{
...
...
@@ -150,12 +101,15 @@ public class WordTemplateUtils {
wordTopdfByAspose
(
fin
,
os
);
return
filepdf
;
}
finally
{
if
(
fin
!=
null
){
fin
.
close
();}
if
(
os
!=
null
){
os
.
close
();}
if
(
file
!=
null
){
file
.
delete
();
}
// 删除临时文件
if
(
fin
!=
null
)
{
fin
.
close
();
}
if
(
os
!=
null
)
{
os
.
close
();
}
if
(
file
!=
null
)
{
file
.
delete
();
}
// 删除临时文件
}
}
...
...
@@ -189,7 +143,7 @@ public class WordTemplateUtils {
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
false
;
}
finally
{
}
finally
{
if
(
outputStream
!=
null
)
{
try
{
outputStream
.
flush
();
...
...
@@ -218,15 +172,18 @@ public class WordTemplateUtils {
return
result
;
}
// 获得图片的base64码
/**
* 获得图片的base64码
* @param src 图片路径
* @return String
*/
@SuppressWarnings
(
"deprecation"
)
public
String
getImageBase
(
String
src
)
{
if
(
src
==
null
||
src
==
""
)
{
if
(!
StringUtil
.
isNotEmpty
(
src
)
)
{
return
""
;
}
if
(
StringUtil
.
isNotEmpty
(
src
))
{
src
=
src
.
replaceAll
(
"\\.\\."
,
""
);
}
String
fileName
=
fileUploadDir
+
src
;
File
file
=
new
File
(
fileName
);
if
(!
file
.
exists
())
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/FireAutoSysManageReportController.java
View file @
d1cbeeae
...
...
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.equipmanage.common.dto.AnalysisReportLogDto
;
import
com.yeejoin.equipmanage.service.IFireAutoSysManageReportService
;
import
com.yeejoin.equipmanage.service.IFirePatrolReportService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
...
...
@@ -38,7 +37,7 @@ public class FireAutoSysManageReportController extends BaseController {
@ApiOperation
(
value
=
"下载报表"
,
notes
=
"下载报表"
)
@GetMapping
(
value
=
"/download"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
PUBLIC
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
public
void
download
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@ApiParam
(
value
=
"换流站编码"
,
required
=
true
)
@RequestParam
String
stationCode
,
@ApiParam
(
value
=
"开始日期"
,
required
=
true
)
@RequestParam
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
Date
startDate
,
...
...
@@ -48,7 +47,7 @@ public class FireAutoSysManageReportController extends BaseController {
@ApiOperation
(
value
=
"预览报表"
,
notes
=
"预览报表"
)
@GetMapping
(
value
=
"/preview"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
PUBLIC
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
public
String
preview
(
@ApiParam
(
value
=
"换流站编码"
,
required
=
true
)
@RequestParam
String
stationCode
,
@ApiParam
(
value
=
"开始日期"
,
required
=
true
)
@RequestParam
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
Date
startDate
,
...
...
@@ -59,7 +58,7 @@ public class FireAutoSysManageReportController extends BaseController {
@SuppressWarnings
(
"unchecked"
)
@ApiOperation
(
value
=
"所有站查询列表"
,
notes
=
"所有站查询列表"
)
@GetMapping
(
value
=
"/allPage"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
PUBLIC
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
public
IPage
<
AnalysisReportLogDto
>
allPage
(
Page
page
,
@RequestParam
Integer
reportType
,
@ApiParam
(
value
=
"开始日期"
)
@RequestParam
(
required
=
false
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
Date
startDate
,
@ApiParam
(
value
=
"结束日期"
)
@RequestParam
(
required
=
false
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
Date
endDate
,
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/FilePatrolReportServiceImpl.java
View file @
d1cbeeae
...
...
@@ -277,6 +277,7 @@ public class FilePatrolReportServiceImpl implements IFirePatrolReportService {
*/
public
static
StandardChartTheme
createChartTheme
(
String
fontName
)
{
StandardChartTheme
theme
=
new
StandardChartTheme
(
"unicode"
)
{
@Override
public
void
apply
(
JFreeChart
chart
)
{
chart
.
getRenderingHints
().
put
(
RenderingHints
.
KEY_TEXT_ANTIALIASING
,
RenderingHints
.
VALUE_TEXT_ANTIALIAS_OFF
);
...
...
@@ -379,9 +380,10 @@ public class FilePatrolReportServiceImpl implements IFirePatrolReportService {
WordTemplateUtils
instance
=
WordTemplateUtils
.
getInstance
();
Map
<
String
,
Object
>
map
=
getWordMap
(
code
,
startDate
,
endDate
);
String
urlString
=
""
;
File
filepdf
=
null
;
try
{
//instance.pdfCreate(map, (String) map.get("document_number"), WordTemplateTypeEum.firePatrolReport.getTemplateFile());
File
filepdf
=
instance
.
getWordFileItem
(
map
,(
String
)
map
.
get
(
"document_number"
),
WordTemplateTypeEum
.
firePatrolReport
.
getTemplateFile
());
filepdf
=
instance
.
getWordFileItem
(
map
,(
String
)
map
.
get
(
"document_number"
),
WordTemplateTypeEum
.
firePatrolReport
.
getTemplateFile
());
//MultipartFile multipartFile = new CommonsMultipartFile(item);
filepdf
.
getAbsolutePath
();
// File file = new File("F:\\application-dev.yml");
...
...
@@ -396,6 +398,10 @@ public class FilePatrolReportServiceImpl implements IFirePatrolReportService {
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
filepdf
!=
null
){
filepdf
.
delete
();
}
}
return
urlString
;
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/FireAutoSysManageReportServiceImpl.java
View file @
d1cbeeae
...
...
@@ -259,8 +259,9 @@ public class FireAutoSysManageReportServiceImpl implements IFireAutoSysManageRep
WordTemplateUtils
instance
=
WordTemplateUtils
.
getInstance
();
Map
<
String
,
Object
>
map
=
getWordMap
(
code
,
startDate
,
endDate
);
String
urlString
=
""
;
File
filePdf
=
null
;
try
{
File
filePdf
=
instance
.
getWordFileItem
(
map
,
(
String
)
map
.
get
(
"document_number"
)
,
WordTemplateTypeEum
.
fireAutoSysManageReport
.
getTemplateFile
());
filePdf
=
instance
.
getWordFileItem
(
map
,
"消防自动化综合管理报表"
,
WordTemplateTypeEum
.
fireAutoSysManageReport
.
getTemplateFile
());
MultipartFile
multipartFile
=
new
MyByteArrayMultipartFile
(
"file"
,
"file.pdf"
,
"application/pdf"
,
file2byte
(
filePdf
));
FeignClientResult
<
Map
<
String
,
String
>>
result
=
Systemctl
.
fileStorageClient
.
updateCommonFile
(
multipartFile
);
if
(
result
!=
null
)
{
...
...
@@ -270,6 +271,10 @@ public class FireAutoSysManageReportServiceImpl implements IFireAutoSysManageRep
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
filePdf
!=
null
){
filePdf
.
delete
();
}
}
return
urlString
;
}
...
...
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