Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-zx-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Jobs
Commits
Open sidebar
项目统一框架
一体化_户用光伏项目代码
amos-boot-zx-biz
Commits
fda92693
Commit
fda92693
authored
Oct 18, 2024
by
hezhuozhi
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer_bw' into developer_bw
parents
2f6f416d
11d5757d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
12 deletions
+46
-12
CommonController.java
...mos/boot/module/hygf/biz/controller/CommonController.java
+17
-0
CommonServiceImpl.java
.../boot/module/hygf/biz/service/impl/CommonServiceImpl.java
+29
-12
informationTemp.xlsx
...ygf-biz/src/main/resources/templates/informationTemp.xlsx
+0
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/CommonController.java
View file @
fda92693
...
...
@@ -58,6 +58,23 @@ public class CommonController {
System
.
out
.
println
(
"zip下载成功"
);
}
/**
* 设备信息下载
*
* @return
*/
@GetMapping
(
value
=
"/test"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"资料下载"
,
notes
=
"资料下载"
)
public
void
test
(
HttpServletResponse
response
)
throws
IOException
{
// 设置响应头
response
.
setContentType
(
"application/zip"
);
commonService
.
test
(
response
);
System
.
out
.
println
(
"zip下载成功"
);
}
/**
* 设备信息下载
*
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/CommonServiceImpl.java
View file @
fda92693
...
...
@@ -550,13 +550,16 @@ public class CommonServiceImpl {
Path
currentWorkingDir
=
Paths
.
get
(
""
);
// 获取当前工作目录
Path
rootDir
=
currentWorkingDir
;
Path
ziLiaoDir
=
rootDir
.
resolve
(
"批量资料"
);
Path
ziLiaoDir
=
createUniqueDirectory
(
rootDir
,
"批量资料"
);
// Path ziLiaoDir =rootDir.resolve("批量资料");
for
(
String
peasantHouseholdId
:
peasantHouseholdIds
)
{
SurveyInfoAllDto
returnDto
=
surveyInformationServiceImpl
.
querySurveyInfo
(
surveyInformationId
,
peasantHouseholdId
,
processInstanceId
,
null
);
fileName
=
returnDto
.
getSurveyInformation
().
getOwnersName
();
int
current
=
0
;
redisUtils
.
set
(
redisKey
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
current
).
build
());
if
(!
redisKey
.
contains
(
","
)){
redisUtils
.
set
(
redisKey
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
currentBili
).
build
());
}
String
powerStationInstanceId
=
powerStationMapper
.
getInstanceIdByhouseId
(
peasantHouseholdId
);
String
financingInstanceId
=
financingAuditingMapper
.
getInstanceIdByhouseId
(
peasantHouseholdId
);
List
<
LinkedHashMap
>
powerStationWorkLog
=
new
ArrayList
<>();
...
...
@@ -654,9 +657,11 @@ public class CommonServiceImpl {
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
current
=
current
+
15
;
redisUtils
.
set
(
redisKey
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
current
).
build
());
if
(!
redisKey
.
contains
(
","
)){
currentBili
=
currentBili
+
15
;
redisUtils
.
set
(
redisKey
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
currentBili
).
build
());
}
List
<
HygfRectificationOrder
>
areaOrdersCon
=
new
ArrayList
<>();
if
(
ObjectUtils
.
isNotEmpty
(
returnDto
.
getHygfOnGrid
()))
{
areaOrdersCon
=
Optional
.
ofNullable
(
returnDto
.
getPowerStationConstructionData
().
getAreaOrders
())
...
...
@@ -857,20 +862,22 @@ public class CommonServiceImpl {
}
// response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename="+returnDto.getSurveyInformation().getOwnersName()+".zip");
currentBili
=
currentBili
+
baifenbi
;
redisUtils
.
set
(
redisKey
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
currentBili
).
build
());
if
(
redisKey
.
contains
(
","
)){
currentBili
=
currentBili
+
baifenbi
;
redisUtils
.
set
(
redisKey
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
currentBili
).
build
());
}
}
String
encodedFilename
=
""
;
response
.
setHeader
(
"Access-Control-Expose-Headers"
,
"Content-Disposition"
);
if
(
peasantHouseholdIds
.
size
()
>
1
){
fileName
=
"批量资料"
;
encodedFilename
=
URLEncoder
.
encode
(
"批量资料.zip"
,
StandardCharsets
.
UTF_8
.
name
());
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
fileName
+
".zip"
,
"UTF-8"
));
createZipFile
(
ziLiaoDir
,
fileName
,
response
);
}
else
{
encodedFilename
=
URLEncoder
.
encode
(
fileName
+
".zip"
,
StandardCharsets
.
UTF_8
.
name
());
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
fileName
+
".zip"
,
"UTF-8"
));
createZipFile
(
ziLiaoDir
,
"批量资料/"
+
fileName
,
response
);
}
...
...
@@ -881,6 +888,16 @@ public class CommonServiceImpl {
cleanup
(
ziLiaoDir
);
}
public
void
test
(
HttpServletResponse
response
)
throws
UnsupportedEncodingException
{
String
fileName
=
"批量资料"
;
Path
currentWorkingDir
=
Paths
.
get
(
""
);
// 获取当前工作目录
Path
rootDir
=
currentWorkingDir
;
Path
ziLiaoDir
=
rootDir
.
resolve
(
"批量资料"
);
String
encodedFilename
=
URLEncoder
.
encode
(
fileName
+
".zip"
,
StandardCharsets
.
UTF_8
.
name
());
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
fileName
+
".zip"
,
"UTF-8"
));
createZipFile
(
ziLiaoDir
,
"批量资料"
,
response
);
}
private
void
fillSheet
(
Sheet
sheet
,
Object
data
)
{
if
(
Objects
.
isNull
(
data
)){
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/resources/templates/informationTemp.xlsx
View file @
fda92693
No preview for this file type
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