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
9ca5203f
Commit
9ca5203f
authored
Jul 21, 2023
by
suhuiguang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop_tzs' of
http://39.98.45.134:8090/moa/amos-boot-biz
into develop_tzs
parents
19a89992
a2dd619b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
22 deletions
+25
-22
EquipmentCategoryController.java
...odule/ymt/biz/controller/EquipmentCategoryController.java
+16
-12
EquipmentCategoryServiceImpl.java
...le/ymt/biz/service/impl/EquipmentCategoryServiceImpl.java
+7
-9
ImageUtils.java
...om/yeejoin/amos/boot/module/ymt/biz/utils/ImageUtils.java
+2
-1
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 @
9ca5203f
...
...
@@ -395,26 +395,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-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/service/impl/EquipmentCategoryServiceImpl.java
View file @
9ca5203f
...
...
@@ -466,11 +466,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
if
(
equipCategory
.
startsWith
(
"3"
)
&&
!
XIAN
.
equals
(
city
))
{
//判断数据是否携带96333电梯码,携带则使用,不携带则生成
if
(
"null"
.
equals
(
code96333
)){
prefix
=
getPrefix
(
EquipmentCategoryEnum
.
XZQHDT
.
getCode
(),
city
);
Map
<
String
,
Object
>
elevatorMap
=
equipmentCategoryMapper
.
getAdministrativeDivision
(
EquipmentCategoryEnum
.
XZQHDT
.
getCode
(),
county
);
prefix
=
ObjectUtils
.
isEmpty
(
elevatorMap
)
?
equipmentCategoryMapper
.
getAdministrativeDivision
(
EquipmentCategoryEnum
.
XZQHDT
.
getCode
(),
city
).
get
(
"code"
).
toString
()
:
elevatorMap
.
get
(
"code"
).
toString
();
//查询未使用的电梯码
categoryOtherInfo
=
categoryOtherInfoMapper
.
selectElevatorCode
(
prefix
,
EquipmentCategoryEnum
.
WSY
.
getCode
());
//如果存在未使用的电梯码则启用未使用的否则创建
String
elevator
=
ObjectUtils
.
isEmpty
(
categoryOtherInfo
)
?
createElevatorCode
(
city
,
county
)
:
categoryOtherInfo
.
getCode
();
String
elevator
=
ObjectUtils
.
isEmpty
(
categoryOtherInfo
)
?
createElevatorCode
(
prefix
)
:
categoryOtherInfo
.
getCode
();
if
(!
ObjectUtils
.
isEmpty
(
categoryOtherInfo
)){
supervisoryCodeInfoMapper
.
delete
(
new
QueryWrapper
<
SupervisoryCodeInfo
>().
eq
(
"code96333"
,
categoryOtherInfo
.
getCode
()));
}
...
...
@@ -555,20 +556,17 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
/**
* 生成96333电梯识别码
*
* @param city 行政区划市
* @param county 行政区划区
* @param prefix 电梯码前缀
* @return 96333电梯识别码
*/
public
String
createElevatorCode
(
String
city
,
String
county
)
{
public
String
createElevatorCode
(
String
prefix
)
{
StringBuilder
elevatorCode
=
new
StringBuilder
();
//生成生成96333电梯码前缀
Map
<
String
,
Object
>
elevatorMap
=
equipmentCategoryMapper
.
getAdministrativeDivision
(
EquipmentCategoryEnum
.
XZQHDT
.
getCode
(),
county
);
String
elevator
=
ObjectUtils
.
isEmpty
(
elevatorMap
)
?
equipmentCategoryMapper
.
getAdministrativeDivision
(
EquipmentCategoryEnum
.
XZQHDT
.
getCode
(),
city
).
get
(
"code"
).
toString
()
:
elevatorMap
.
get
(
"code"
).
toString
();
elevatorCode
.
append
(
elevator
);
elevatorCode
.
append
(
prefix
);
String
initCode
=
elevatorCode
+
EquipmentCategoryEnum
.
getValue
.
get
(
elevatorCode
.
toString
());
CategoryOtherInfo
initSupervisoryCode
=
categoryOtherInfoMapper
.
queryInitCode
(
initCode
);
// 查询是否已经生成过初始值
if
(
ValidationUtil
.
isEmpty
(
initSupervisoryCode
))
{
elevatorCode
.
append
(
EquipmentCategoryEnum
.
getValue
.
get
(
elevator
));
elevatorCode
.
append
(
EquipmentCategoryEnum
.
getValue
.
get
(
prefix
));
}
else
{
//获取行政区划区县、市是否存在历史96333电梯码
CategoryOtherInfo
elevatorOtherInfo
=
categoryOtherInfoMapper
.
selectElevatorCode
(
elevatorCode
.
toString
(),
null
);
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/utils/ImageUtils.java
View file @
9ca5203f
...
...
@@ -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