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
6a571763
Commit
6a571763
authored
Aug 22, 2023
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
一码通监管码导出bug修改
parent
b76fadb1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
33 deletions
+27
-33
EquipmentCategoryController.java
...odule/ymt/biz/controller/EquipmentCategoryController.java
+27
-33
No files found.
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/controller/EquipmentCategoryController.java
View file @
6a571763
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ymt
.
biz
.
controller
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ymt
.
biz
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
...
@@ -44,12 +45,7 @@ import java.io.File;
...
@@ -44,12 +45,7 @@ import java.io.File;
import
java.io.FileNotFoundException
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Collection
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.TreeSet
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -425,31 +421,25 @@ public class EquipmentCategoryController extends BaseController {
...
@@ -425,31 +421,25 @@ public class EquipmentCategoryController extends BaseController {
QrCodeFile
.
delete
();
QrCodeFile
.
delete
();
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/exportImageZip"
)
@GetMapping
(
value
=
"/exportImageZip"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"设备监管码、电梯码批量导出压缩包"
,
notes
=
"设备监管码、电梯码批量导出压缩包"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"设备监管码、电梯码批量导出压缩包"
,
notes
=
"设备监管码、电梯码批量导出压缩包"
)
public
void
exportImageZip
(
HttpServletResponse
response
,
EquipExportDto
dto
,
@RequestParam
(
"type"
)
String
type
,
@RequestParam
(
"pageNum"
)
Long
pageNum
,
@RequestParam
(
"size"
)
Long
size
)
throws
IOException
{
public
void
exportImageZip
(
HttpServletResponse
response
,
@RequestParam
Map
<
String
,
Object
>
map
)
throws
IOException
{
String
type
=
String
.
valueOf
(
map
.
get
(
"type"
));
ImageSizeEnums
imageSizeEnums
=
ImageSizeEnums
.
getEnumByCode
(
type
);
ImageSizeEnums
imageSizeEnums
=
ImageSizeEnums
.
getEnumByCode
(
type
);
//创建list 存放图片
//创建list 存放图片
List
<
File
>
fileList
=
new
ArrayList
<>();
List
<
File
>
fileList
=
new
ArrayList
<>();
if
(!
ObjectUtils
.
isEmpty
(
dto
.
getUSE_PLACE
()))
{
JSONObject
jsonObject
=
new
JSONObject
(
map
);
String
address
=
dto
.
getUSE_PLACE
().
substring
(
1
,
dto
.
getUSE_PLACE
().
length
()
-
1
);
Page
<
JSONObject
>
pageList
=
equipmentCategoryServiceImpl
.
queryByKeys
(
jsonObject
);
address
=
address
.
replace
(
", "
,
"/"
);
List
<
JSONObject
>
equipExportData
;
dto
.
setUSE_PLACE
(
address
);
if
(
map
.
containsKey
(
"ids"
)
&&
!
ObjectUtils
.
isEmpty
(
map
.
get
(
"ids"
)))
{
}
List
<
String
>
strings
=
Arrays
.
asList
(
String
.
valueOf
(
map
.
get
(
"ids"
)).
split
(
","
));
List
<
EquipExportVo
>
equipExportData
=
equipmentCategoryServiceImpl
.
exportImageZip
(
dto
,
pageNum
,
size
);
equipExportData
=
pageList
.
getRecords
().
stream
().
filter
(
item
->
strings
.
contains
(
String
.
valueOf
(
item
.
get
(
"SEQUENCE_NBR"
)))).
collect
(
Collectors
.
toList
());
List
<
EquipExportVo
>
unique
=
equipExportData
.
stream
().
filter
(
item
->
!
ObjectUtils
.
isEmpty
(
item
.
getSupervisoryCode
())).
collect
(
}
else
{
Collectors
.
collectingAndThen
(
equipExportData
=
pageList
.
getRecords
();
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
EquipExportVo:
:
getSupervisoryCode
))),
ArrayList:
:
new
)
);
if
(
ImageSizeEnums
.
DT
.
getCode
().
equals
(
type
)){
unique
=
unique
.
stream
().
filter
(
item
->
!
ObjectUtils
.
isEmpty
(
item
.
getCode96333
())).
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
EquipExportVo:
:
getCode96333
))),
ArrayList:
:
new
)
);
}
}
if
(
ObjectUtils
.
isEmpty
(
unique
)){
if
(
ObjectUtils
.
isEmpty
(
equipExportData
))
{
File
zipFile
=
File
.
createTempFile
(
"设备码信息"
,
".zip"
);
File
zipFile
=
File
.
createTempFile
(
"设备码信息"
,
".zip"
);
File
nullFile
=
File
.
createTempFile
(
"当前导出数据为空+"
,
".txt"
);
File
nullFile
=
File
.
createTempFile
(
"当前导出数据为空+"
,
".txt"
);
fileList
.
add
(
nullFile
);
fileList
.
add
(
nullFile
);
...
@@ -458,18 +448,22 @@ public class EquipmentCategoryController extends BaseController {
...
@@ -458,18 +448,22 @@ public class EquipmentCategoryController extends BaseController {
ImageUtils
.
downloadResourceZip
(
"设备码信息.zip"
,
zipFile
.
getAbsolutePath
(),
response
);
ImageUtils
.
downloadResourceZip
(
"设备码信息.zip"
,
zipFile
.
getAbsolutePath
(),
response
);
zipFile
.
delete
();
zipFile
.
delete
();
}
}
for
(
EquipExportVo
equipExportDatum
:
unique
)
{
if
(
ImageSizeEnums
.
DT
.
getCode
().
equals
(
type
)
)
{
InputStream
bgImgFile
=
getClass
().
getClassLoader
().
getResourceAsStream
(
"temp/"
+
imageSizeEnums
.
getBgPath
());
for
(
JSONObject
equipExportDatum
:
equipExportData
.
stream
().
filter
(
item
->
!
ObjectUtils
.
isEmpty
(
item
.
get
(
"CODE96333"
))).
collect
(
Collectors
.
toList
()))
{
if
(
ImageSizeEnums
.
DT
.
getCode
().
equals
(
type
)
&&
!
ObjectUtils
.
isEmpty
(
equipExportDatum
.
getCode96333
())
&&
!
ObjectUtils
.
isEmpty
(
equipExportDatum
.
getSupervisoryCode
()))
{
InputStream
bgImgFile
=
getClass
().
getClassLoader
().
getResourceAsStream
(
"temp/"
+
imageSizeEnums
.
getBgPath
());
File
QrCodeFile
=
File
.
createTempFile
(
equipExportDatum
.
get
Code96333
(
)
+
"+"
,
".png"
);
File
QrCodeFile
=
File
.
createTempFile
(
equipExportDatum
.
get
(
"CODE96333"
)
+
"+"
,
".png"
);
ImageUtils
.
creatQRCode
(
QrCodeFile
,
bgImgFile
,
imageSizeEnums
.
getWith
(),
imageSizeEnums
.
getHeight
(),
REGULATORY_CODE_PREFIX
+
equipExportDatum
.
get
SupervisoryCode
(),
""
,
equipExportDatum
.
getCode96333
(
),
imageSizeEnums
.
getSize
(),
imageSizeEnums
.
getImagesX
(),
imageSizeEnums
.
getImagesY
(),
imageSizeEnums
.
getText1X
(),
imageSizeEnums
.
getText1Y
(),
imageSizeEnums
.
getText2X
(),
imageSizeEnums
.
getText2Y
());
ImageUtils
.
creatQRCode
(
QrCodeFile
,
bgImgFile
,
imageSizeEnums
.
getWith
(),
imageSizeEnums
.
getHeight
(),
REGULATORY_CODE_PREFIX
+
equipExportDatum
.
get
(
"SUPERVISORY_CODE"
),
""
,
String
.
valueOf
(
equipExportDatum
.
get
(
"CODE96333"
)
),
imageSizeEnums
.
getSize
(),
imageSizeEnums
.
getImagesX
(),
imageSizeEnums
.
getImagesY
(),
imageSizeEnums
.
getText1X
(),
imageSizeEnums
.
getText1Y
(),
imageSizeEnums
.
getText2X
(),
imageSizeEnums
.
getText2Y
());
fileList
.
add
(
new
File
(
QrCodeFile
.
getAbsolutePath
()));
fileList
.
add
(
new
File
(
QrCodeFile
.
getAbsolutePath
()));
}
else
if
(!
ObjectUtils
.
isEmpty
(
equipExportDatum
.
getSupervisoryCode
()))
{
bgImgFile
.
close
();
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
());
}
else
{
for
(
JSONObject
equipExportDatum
:
equipExportData
.
stream
().
filter
(
item
->
!
ObjectUtils
.
isEmpty
(
item
.
get
(
"SUPERVISORY_CODE"
))).
collect
(
Collectors
.
toList
()))
{
InputStream
bgImgFile
=
getClass
().
getClassLoader
().
getResourceAsStream
(
"temp/"
+
imageSizeEnums
.
getBgPath
());
File
QrCodeFile
=
File
.
createTempFile
(
equipExportDatum
.
get
(
"SUPERVISORY_CODE"
)
+
"+"
,
".png"
);
ImageUtils
.
creatQRCode
(
QrCodeFile
,
bgImgFile
,
imageSizeEnums
.
getWith
(),
imageSizeEnums
.
getHeight
(),
REGULATORY_CODE_PREFIX
+
equipExportDatum
.
get
(
"SUPERVISORY_CODE"
),
""
,
String
.
valueOf
(
equipExportDatum
.
get
(
"SUPERVISORY_CODE"
)),
imageSizeEnums
.
getSize
(),
imageSizeEnums
.
getImagesX
(),
imageSizeEnums
.
getImagesY
(),
imageSizeEnums
.
getText1X
(),
imageSizeEnums
.
getText1Y
(),
imageSizeEnums
.
getText2X
(),
imageSizeEnums
.
getText2Y
());
fileList
.
add
(
new
File
(
QrCodeFile
.
getAbsolutePath
()));
fileList
.
add
(
new
File
(
QrCodeFile
.
getAbsolutePath
()));
bgImgFile
.
close
();
}
}
bgImgFile
.
close
();
}
}
File
zipFile
=
File
.
createTempFile
(
"设备码信息"
,
".zip"
);
File
zipFile
=
File
.
createTempFile
(
"设备码信息"
,
".zip"
);
// 调用压缩方法
// 调用压缩方法
...
...
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