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
c6a67cd9
Commit
c6a67cd9
authored
Jul 20, 2023
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改文件名bug
parent
c96e3ccc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
13 deletions
+18
-13
EquipmentCategoryController.java
...odule/tzs/biz/controller/EquipmentCategoryController.java
+16
-12
ImageUtils.java
...om/yeejoin/amos/boot/module/tzs/biz/utils/ImageUtils.java
+2
-1
No files found.
amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/EquipmentCategoryController.java
View file @
c6a67cd9
...
...
@@ -396,26 +396,30 @@ public class EquipmentCategoryController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/exportImageZip"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"设备
信息导出"
,
notes
=
"设备信息导出
"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"设备
监管码、电梯码批量导出压缩包"
,
notes
=
"设备监管码、电梯码批量导出压缩包
"
)
public
void
exportImageZip
(
HttpServletResponse
response
,
EquipExportDto
dto
,
@RequestParam
(
"type"
)
String
type
)
throws
IOException
{
ImageSizeEnums
imageSizeEnums
=
ImageSizeEnums
.
getEnumByCode
(
type
);
//创建list 存放图片
List
<
File
>
fileList
=
new
ArrayList
<>();
List
<
EquipExportVo
>
equipExportData
=
equipmentCategoryServiceImpl
.
getEquipExportData
(
dto
);
List
<
EquipExportVo
>
unique
=
equipExportData
.
stream
().
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
o
->
o
.
getSupervisoryCode
()
+
";"
+
o
.
getCode96333
()))),
ArrayList:
:
new
)
List
<
EquipExportVo
>
unique
=
equipExportData
.
stream
().
filter
(
item
->
!
ObjectUtils
.
isEmpty
(
item
.
getSupervisoryCode
())).
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
EquipExportVo:
:
getSupervisoryCode
))),
ArrayList:
:
new
)
);
List
<
EquipExportVo
>
collect
=
unique
.
stream
().
filter
(
item
->
!
ObjectUtils
.
isEmpty
(
item
.
getCode96333
())).
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
EquipExportVo:
:
getCode96333
))),
ArrayList:
:
new
)
);
for
(
EquipExportVo
equipExportDatum
:
unique
)
{
InputStream
bgImgFile
=
getClass
().
getClassLoader
().
getResourceAsStream
(
"temp/"
+
imageSizeEnums
.
getBgPath
());
for
(
EquipExportVo
equipExportDatum
:
collect
)
{
InputStream
bgImgFile
=
getClass
().
getClassLoader
().
getResourceAsStream
(
"temp/"
+
imageSizeEnums
.
getBgPath
());
if
(
"DT"
.
equals
(
type
)
&&
!
ObjectUtils
.
isEmpty
(
equipExportDatum
.
getCode96333
()))
{
File
QrCodeFile
=
File
.
createTempFile
(
equipExportDatum
.
getCode96333
(),
".png"
);
ImageUtils
.
creatQRCode
(
QrCodeFile
,
bgImgFile
,
imageSizeEnums
.
getWith
(),
imageSizeEnums
.
getHeight
(),
REGULATORY_CODE_PREFIX
+
equipExportDatum
.
getCode96333
(),
""
,
equipExportDatum
.
getCode96333
(),
imageSizeEnums
.
getSize
(),
imageSizeEnums
.
getImagesX
(),
imageSizeEnums
.
getImagesY
(),
imageSizeEnums
.
getText1X
(),
imageSizeEnums
.
getText1Y
(),
imageSizeEnums
.
getText2X
(),
imageSizeEnums
.
getText2Y
());
fileList
.
add
(
new
File
(
QrCodeFile
.
getAbsolutePath
()));
File
QrCodeFile
=
File
.
createTempFile
(
equipExportDatum
.
getCode96333
()
+
"+"
,
".png"
);
ImageUtils
.
creatQRCode
(
QrCodeFile
,
bgImgFile
,
imageSizeEnums
.
getWith
(),
imageSizeEnums
.
getHeight
(),
REGULATORY_CODE_PREFIX
+
equipExportDatum
.
getCode96333
(),
""
,
equipExportDatum
.
getCode96333
(),
imageSizeEnums
.
getSize
(),
imageSizeEnums
.
getImagesX
(),
imageSizeEnums
.
getImagesY
(),
imageSizeEnums
.
getText1X
(),
imageSizeEnums
.
getText1Y
(),
imageSizeEnums
.
getText2X
(),
imageSizeEnums
.
getText2Y
());
fileList
.
add
(
new
File
(
QrCodeFile
.
getAbsolutePath
()));
}
else
if
(!
ObjectUtils
.
isEmpty
(
equipExportDatum
.
getSupervisoryCode
()))
{
File
QrCodeFile
=
File
.
createTempFile
(
equipExportDatum
.
getSupervisoryCode
(),
".png"
);
ImageUtils
.
creatQRCode
(
QrCodeFile
,
bgImgFile
,
imageSizeEnums
.
getWith
(),
imageSizeEnums
.
getHeight
(),
REGULATORY_CODE_PREFIX
+
equipExportDatum
.
getSupervisoryCode
(),
""
,
equipExportDatum
.
getSupervisoryCode
(),
imageSizeEnums
.
getSize
(),
imageSizeEnums
.
getImagesX
(),
imageSizeEnums
.
getImagesY
(),
imageSizeEnums
.
getText1X
(),
imageSizeEnums
.
getText1Y
(),
imageSizeEnums
.
getText2X
(),
imageSizeEnums
.
getText2Y
());
fileList
.
add
(
new
File
(
QrCodeFile
.
getAbsolutePath
()));
File
QrCodeFile
=
File
.
createTempFile
(
equipExportDatum
.
getSupervisoryCode
()
+
"+"
,
".png"
);
ImageUtils
.
creatQRCode
(
QrCodeFile
,
bgImgFile
,
imageSizeEnums
.
getWith
(),
imageSizeEnums
.
getHeight
(),
REGULATORY_CODE_PREFIX
+
equipExportDatum
.
getSupervisoryCode
(),
""
,
equipExportDatum
.
getSupervisoryCode
(),
imageSizeEnums
.
getSize
(),
imageSizeEnums
.
getImagesX
(),
imageSizeEnums
.
getImagesY
(),
imageSizeEnums
.
getText1X
(),
imageSizeEnums
.
getText1Y
(),
imageSizeEnums
.
getText2X
(),
imageSizeEnums
.
getText2Y
());
fileList
.
add
(
new
File
(
QrCodeFile
.
getAbsolutePath
()));
}
bgImgFile
.
close
();
}
...
...
amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/utils/ImageUtils.java
View file @
c6a67cd9
...
...
@@ -5,6 +5,7 @@ import com.google.zxing.EncodeHintType;
import
com.google.zxing.MultiFormatWriter
;
import
com.google.zxing.common.BitMatrix
;
import
com.itextpdf.text.pdf.qrcode.ErrorCorrectionLevel
;
import
org.apache.commons.lang.StringUtils
;
import
javax.imageio.ImageIO
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -254,7 +255,7 @@ public class ImageUtils {
for
(
File
srcFile
:
srcFiles
)
{
fileInputStream
=
new
FileInputStream
(
srcFile
);
// 实例化 ZipEntry 对象,源文件数组中的当前文件
zipEntry
=
new
ZipEntry
(
srcFile
.
getName
()
);
zipEntry
=
new
ZipEntry
(
StringUtils
.
substringBefore
(
srcFile
.
getName
(),
"+"
)
+
".png"
);
zipOutputStream
.
putNextEntry
(
zipEntry
);
// 该变量记录每次真正读的字节个数
int
len
;
...
...
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