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
49ea1c13
Commit
49ea1c13
authored
May 15, 2024
by
韩桐桐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(jg):压力管道基本信息汇总表导出zip接口
parent
3246ce83
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
25 deletions
+43
-25
JgUseRegistrationServiceImpl.java
...ule/jg/biz/service/impl/JgUseRegistrationServiceImpl.java
+42
-24
PressurePipeBasicInformationSummary.docx
...n/resources/docx/PressurePipeBasicInformationSummary.docx
+0
-0
SummaryOfBasicCylinderInformation.docx
...ain/resources/docx/SummaryOfBasicCylinderInformation.docx
+0
-0
CylinderBasicInformationSummary.ftl
...n/resources/templates/CylinderBasicInformationSummary.ftl
+1
-1
PressurePipeBasicInformationSummary.ftl
...sources/templates/PressurePipeBasicInformationSummary.ftl
+0
-0
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgUseRegistrationServiceImpl.java
View file @
49ea1c13
...
@@ -77,6 +77,7 @@ import java.io.IOException;
...
@@ -77,6 +77,7 @@ import java.io.IOException;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.ZoneId
;
import
java.time.ZoneId
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
...
@@ -109,6 +110,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -109,6 +110,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
@Autowired
@Autowired
IdxBizJgRegisterInfoMapper
idxBizJgRegisterInfoMapper
;
IdxBizJgRegisterInfoMapper
idxBizJgRegisterInfoMapper
;
@Autowired
@Autowired
TzsUserInfoMapper
userInfoMapper
;
@Autowired
ICommonService
commonService
;
ICommonService
commonService
;
@Autowired
@Autowired
CommonServiceImpl
commonServiceImpl
;
CommonServiceImpl
commonServiceImpl
;
...
@@ -1569,8 +1572,13 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -1569,8 +1572,13 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
total
=
equipmentLists
.
size
();
total
=
equipmentLists
.
size
();
JgUseRegistration
jgUseRegistration
=
jgUseRegistrationMapper
.
selectOne
(
new
QueryWrapper
<
JgUseRegistration
>().
lambda
()
JgUseRegistration
jgUseRegistration
=
jgUseRegistrationMapper
.
selectOne
(
new
QueryWrapper
<
JgUseRegistration
>().
lambda
()
.
eq
(
JgUseRegistration:
:
getSequenceNbr
,
sequenceNbr
));
.
eq
(
JgUseRegistration:
:
getSequenceNbr
,
sequenceNbr
));
if
(
"0"
.
equals
(
category
))
{
TzsUserInfo
tzsUserInfo
=
new
TzsUserInfo
();
// 压力管道基本信息汇总表
if
(!
ValidationUtil
.
isEmpty
(
jgUseRegistration
.
getCreateUserId
()))
{
tzsUserInfo
=
userInfoMapper
.
selectOne
(
new
QueryWrapper
<
TzsUserInfo
>().
lambda
()
.
eq
(
TzsUserInfo:
:
getIsDelete
,
false
)
.
eq
(
TzsUserInfo:
:
getAmosUserId
,
jgUseRegistration
.
getCreateUserId
()));
}
if
(
"8300"
.
equals
(
category
))
{
// 压力管道基本信息汇总表
// 模板
// 模板
String
wordPath
=
"PressurePipeBasicInformationSummary.ftl"
;
String
wordPath
=
"PressurePipeBasicInformationSummary.ftl"
;
// 文件名前缀
// 文件名前缀
...
@@ -1579,23 +1587,22 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -1579,23 +1587,22 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
String
customFileName
=
filePrefix
+
jgUseRegistration
.
getApplyNo
()
+
".zip"
;
String
customFileName
=
filePrefix
+
jgUseRegistration
.
getApplyNo
()
+
".zip"
;
// 总页数
// 总页数
int
page
=
(
int
)
Math
.
ceil
(
total
/
size
);
int
page
=
(
int
)
Math
.
ceil
(
total
/
size
);
// 异步获取数据
List
<
CompletableFuture
<
byte
[]>>
futures
=
pressurePipeDataPreparation
(
page
,
jsonObject
,
size
,
total
,
equipmentLists
,
wordPath
,
filePrefix
);
List
<
CompletableFuture
<
byte
[]>>
futures
=
pressurePipeDataPreparation
(
page
,
jsonObject
,
size
,
total
,
equipmentLists
,
wordPath
,
filePrefix
,
tzsUserInfo
);
// byte[]压缩zip
toZipFile
(
response
,
futures
,
filePrefix
,
customFileName
);
toZipFile
(
response
,
futures
,
filePrefix
,
customFileName
);
}
else
if
(
"1"
.
equals
(
category
))
{
}
else
if
(
"2300"
.
equals
(
category
))
{
// 气瓶基本信息汇总表
// 气瓶基本信息汇总表
// 模板
// 模板
String
wordPath
=
"
SummaryOfBasicCylinderInformation
.ftl"
;
String
wordPath
=
"
CylinderBasicInformationSummary
.ftl"
;
// 文件名前缀
// 文件名前缀
String
filePrefix
=
"气瓶基本信息汇总表_"
;
String
filePrefix
=
"气瓶基本信息汇总表_"
;
// 压力包名称
// 压力包名称
String
customFileName
=
filePrefix
+
jgUseRegistration
.
getApplyNo
()
+
".zip"
;
String
customFileName
=
filePrefix
+
jgUseRegistration
.
getApplyNo
()
+
".zip"
;
// 总页数
// 总页数
int
page
=
(
int
)
Math
.
ceil
(
total
/
size
);
int
page
=
(
int
)
Math
.
ceil
(
total
/
size
);
// 异步获取数据
List
<
CompletableFuture
<
byte
[]>>
futures
=
cylinderDataPreparation
(
page
,
jsonObject
,
size
,
total
,
equipmentLists
,
wordPath
,
filePrefix
);
List
<
CompletableFuture
<
byte
[]>>
futures
=
cylinderDataPreparation
(
page
,
jsonObject
,
size
,
total
,
equipmentLists
,
wordPath
,
filePrefix
,
tzsUserInfo
);
// byte[]压缩zip
toZipFile
(
response
,
futures
,
filePrefix
,
customFileName
);
toZipFile
(
response
,
futures
,
filePrefix
,
customFileName
);
}
}
}
}
...
@@ -1605,24 +1612,28 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -1605,24 +1612,28 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
*
*
* @return
* @return
*/
*/
private
List
<
CompletableFuture
<
byte
[]>>
cylinderDataPreparation
(
int
page
,
JSONObject
jsonObject
,
int
size
,
double
total
,
JSONArray
equipmentLists
,
String
wordPath
,
String
filePrefix
)
{
private
List
<
CompletableFuture
<
byte
[]>>
cylinderDataPreparation
(
int
page
,
JSONObject
jsonObject
,
int
size
,
double
total
,
JSONArray
equipmentLists
,
String
wordPath
,
String
filePrefix
,
TzsUserInfo
tzsUserInfo
)
{
List
<
CompletableFuture
<
byte
[]>>
futures
=
IntStream
.
rangeClosed
(
1
,
page
)
List
<
CompletableFuture
<
byte
[]>>
futures
=
IntStream
.
rangeClosed
(
1
,
page
)
.
mapToObj
(
current
->
CompletableFuture
.
supplyAsync
(()
->
{
.
mapToObj
(
current
->
CompletableFuture
.
supplyAsync
(()
->
{
Map
<
String
,
Object
>
exportParamsMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
exportParamsMap
=
new
HashMap
<>();
exportParamsMap
.
put
(
"current"
,
current
);
exportParamsMap
.
put
(
"current"
,
current
);
exportParamsMap
.
put
(
"page"
,
page
);
exportParamsMap
.
put
(
"page"
,
page
);
exportParamsMap
.
put
(
"printDate"
,
new
Date
());
LocalDate
currentDate
=
LocalDate
.
now
();
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
String
formattedDate
=
currentDate
.
format
(
formatter
);
exportParamsMap
.
put
(
"printDate"
,
formattedDate
);
// 使用单位
// 使用单位
exportParamsMap
.
put
(
"useUnitName"
,
jsonObject
.
get
(
"useUnitName"
));
exportParamsMap
.
put
(
"useUnitName"
,
jsonObject
.
get
(
"useUnitName"
));
// 联系电话
// 联系电话
exportParamsMap
.
put
(
"phone"
,
""
);
exportParamsMap
.
put
(
"phone"
,
ValidationUtil
.
isEmpty
(
tzsUserInfo
.
getPhone
())
?
""
:
tzsUserInfo
.
getPhone
()
);
// 经办人
// 经办人
exportParamsMap
.
put
(
"agent"
,
""
);
exportParamsMap
.
put
(
"agent"
,
ValidationUtil
.
isEmpty
(
tzsUserInfo
.
getName
())
?
""
:
tzsUserInfo
.
getName
()
);
// 电子邮箱
// 电子邮箱
exportParamsMap
.
put
(
"email"
,
""
);
exportParamsMap
.
put
(
"email"
,
ValidationUtil
.
isEmpty
(
tzsUserInfo
.
getEmail
())
?
""
:
tzsUserInfo
.
getEmail
()
);
// 数据分页
// 数据分页
int
start
=
(
current
-
1
)
*
size
;
int
start
=
(
current
-
1
)
*
size
;
int
end
=
((
current
-
1
)
*
size
+
size
)
<
total
?
(
current
-
1
)
*
size
+
size
:
(
int
)
total
;
int
end
=
((
current
-
1
)
*
size
+
size
)
<
total
?
(
current
-
1
)
*
size
+
size
:
(
int
)
total
;
// 数据截取
List
<
Object
>
equData
=
equipmentLists
.
subList
(
start
,
end
);
List
<
Object
>
equData
=
equipmentLists
.
subList
(
start
,
end
);
// 设备数据填充
// 设备数据填充
this
.
fillInCylinderEquData
(
exportParamsMap
,
equData
,
size
);
this
.
fillInCylinderEquData
(
exportParamsMap
,
equData
,
size
);
...
@@ -1637,29 +1648,36 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -1637,29 +1648,36 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
*
*
* @return
* @return
*/
*/
private
List
<
CompletableFuture
<
byte
[]>>
pressurePipeDataPreparation
(
int
page
,
JSONObject
jsonObject
,
int
size
,
double
total
,
JSONArray
equipmentLists
,
String
wordPath
,
String
filePrefix
)
{
private
List
<
CompletableFuture
<
byte
[]>>
pressurePipeDataPreparation
(
int
page
,
JSONObject
jsonObject
,
int
size
,
double
total
,
JSONArray
equipmentLists
,
String
wordPath
,
String
filePrefix
,
TzsUserInfo
tzsUserInfo
)
{
List
<
CompletableFuture
<
byte
[]>>
futures
=
IntStream
.
rangeClosed
(
1
,
page
)
List
<
CompletableFuture
<
byte
[]>>
futures
=
IntStream
.
rangeClosed
(
1
,
page
)
.
mapToObj
(
current
->
CompletableFuture
.
supplyAsync
(()
->
{
.
mapToObj
(
current
->
CompletableFuture
.
supplyAsync
(()
->
{
Map
<
String
,
Object
>
exportParamsMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
exportParamsMap
=
new
HashMap
<>();
exportParamsMap
.
put
(
"current"
,
current
);
exportParamsMap
.
put
(
"current"
,
current
);
exportParamsMap
.
put
(
"page"
,
page
);
exportParamsMap
.
put
(
"page"
,
page
);
exportParamsMap
.
put
(
"printDate"
,
new
Date
());
LocalDate
currentDate
=
LocalDate
.
now
();
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
String
formattedDate
=
currentDate
.
format
(
formatter
);
exportParamsMap
.
put
(
"printDate"
,
formattedDate
);
// 使用单位
// 使用单位
exportParamsMap
.
put
(
"useUnitName"
,
jsonObject
.
get
(
"useUnitName"
));
exportParamsMap
.
put
(
"useUnitName"
,
jsonObject
.
get
(
"useUnitName"
));
// 使用单位地址
// 使用单位地址
exportParamsMap
.
put
(
"
"
,
jsonObject
.
get
(
"
"
));
exportParamsMap
.
put
(
"
address"
,
jsonObject
.
get
(
"address
"
));
// 工程(装置)名称
// 工程(装置)名称
exportParamsMap
.
put
(
"nameOfProjectDevice"
,
""
);
// 安全管理部门
// 安全管理部门
exportParamsMap
.
put
(
"orgBranchName"
,
String
.
valueOf
(
jsonObject
.
get
(
"orgBranchCode"
)).
split
(
"_"
)[
1
]);
// 安全管理员
// 安全管理员
exportParamsMap
.
put
(
"safetyManager"
,
String
.
valueOf
(
jsonObject
.
get
(
"safetyManager"
)).
split
(
"_"
)[
1
]);
// 联系电话
// 联系电话
exportParamsMap
.
put
(
"phone"
,
"13209090909"
);
exportParamsMap
.
put
(
"phone"
,
ValidationUtil
.
isEmpty
(
tzsUserInfo
.
getPhone
())
?
""
:
tzsUserInfo
.
getPhone
()
);
// 经办人
// 经办人
exportParamsMap
.
put
(
"agent"
,
"张三"
);
exportParamsMap
.
put
(
"agent"
,
ValidationUtil
.
isEmpty
(
tzsUserInfo
.
getName
())
?
""
:
tzsUserInfo
.
getName
()
);
// 电子邮箱
// 电子邮箱
exportParamsMap
.
put
(
"email"
,
"htt@yeah.net"
);
exportParamsMap
.
put
(
"email"
,
ValidationUtil
.
isEmpty
(
tzsUserInfo
.
getEmail
())
?
""
:
tzsUserInfo
.
getEmail
()
);
// 数据分页
// 数据分页
int
start
=
(
current
-
1
)
*
size
;
int
start
=
(
current
-
1
)
*
size
;
int
end
=
((
current
-
1
)
*
size
+
size
)
<
total
?
(
current
-
1
)
*
size
+
size
:
(
int
)
total
;
int
end
=
((
current
-
1
)
*
size
+
size
)
<
total
?
(
current
-
1
)
*
size
+
size
:
(
int
)
total
;
// 数据截取
List
<
Object
>
equData
=
equipmentLists
.
subList
(
start
,
end
);
List
<
Object
>
equData
=
equipmentLists
.
subList
(
start
,
end
);
// 设备数据填充
// 设备数据填充
this
.
pressurePipeEquData
(
exportParamsMap
,
equData
,
size
);
this
.
pressurePipeEquData
(
exportParamsMap
,
equData
,
size
);
...
@@ -1682,7 +1700,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -1682,7 +1700,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
JSONObject
obj
=
(
JSONObject
)
equData
.
get
(
curr
);
JSONObject
obj
=
(
JSONObject
)
equData
.
get
(
curr
);
int
serialNum
=
curr
+
1
;
int
serialNum
=
curr
+
1
;
for
(
String
fieldName
:
fieldNames
)
{
for
(
String
fieldName
:
fieldNames
)
{
exportParamsMap
.
put
(
fieldName
+
serialNum
,
obj
.
get
(
fieldName
));
exportParamsMap
.
put
(
fieldName
+
serialNum
,
ValidationUtil
.
isEmpty
(
obj
.
get
(
fieldName
))
?
""
:
obj
.
get
(
fieldName
));
}
}
}
}
...
@@ -1708,7 +1726,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
...
@@ -1708,7 +1726,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
JSONObject
obj
=
(
JSONObject
)
equData
.
get
(
curr
);
JSONObject
obj
=
(
JSONObject
)
equData
.
get
(
curr
);
int
serialNum
=
curr
+
1
;
int
serialNum
=
curr
+
1
;
for
(
String
fieldName
:
fieldNames
)
{
for
(
String
fieldName
:
fieldNames
)
{
exportParamsMap
.
put
(
fieldName
+
serialNum
,
obj
.
get
(
fieldName
));
exportParamsMap
.
put
(
fieldName
+
serialNum
,
ValidationUtil
.
isEmpty
(
obj
.
get
(
fieldName
))
?
""
:
obj
.
get
(
fieldName
));
}
}
}
}
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/resources/docx/PressurePipeBasicInformationSummary.docx
0 → 100644
View file @
49ea1c13
File added
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/resources/
templates
/SummaryOfBasicCylinderInformation.docx
→
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/resources/
docx
/SummaryOfBasicCylinderInformation.docx
View file @
49ea1c13
File moved
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/resources/templates/
SummaryOfBasicCylinderInformation
.ftl
→
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/resources/templates/
CylinderBasicInformationSummary
.ftl
View file @
49ea1c13
...
@@ -3567,7 +3567,7 @@
...
@@ -3567,7 +3567,7 @@
<w:sz
w:val=
"15"
/>
<w:sz
w:val=
"15"
/>
<w:szCs
w:val=
"15"
/>
<w:szCs
w:val=
"15"
/>
</w:rPr>
</w:rPr>
<w:t>
${printDate
?string('yyyy-MM-dd')
}
</w:t>
<w:t>
${printDate}
</w:t>
</w:r>
</w:r>
<w:r
w:rsidRPr=
"00635746"
>
<w:r
w:rsidRPr=
"00635746"
>
<w:rPr>
<w:rPr>
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/resources/templates/PressurePipeBasicInformationSummary.ftl
0 → 100644
View file @
49ea1c13
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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