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
6c9d2a9d
Commit
6c9d2a9d
authored
Apr 21, 2023
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改光伏导入、导出、模板
parent
13f5d1ee
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
22 deletions
+64
-22
HouseholdPvImport.java
...oin/amos/boot/module/jxiop/api/dto/HouseholdPvImport.java
+13
-13
HouseholdPvController.java
...ot/module/jxiop/biz/controller/HouseholdPvController.java
+45
-3
HouseholdPvServiceImpl.java
...module/jxiop/biz/service/impl/HouseholdPvServiceImpl.java
+6
-6
householdExportNew.xls
...p-biz/src/main/resources/templates/householdExportNew.xls
+0
-0
householdTemplatesNew.xls
...iz/src/main/resources/templates/householdTemplatesNew.xls
+0
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/dto/HouseholdPvImport.java
View file @
6c9d2a9d
...
@@ -7,43 +7,43 @@ import lombok.Data;
...
@@ -7,43 +7,43 @@ import lombok.Data;
@Data
@Data
public
class
HouseholdPvImport
{
public
class
HouseholdPvImport
{
@ColumnWidth
(
15
)
@ColumnWidth
(
15
)
@ExcelProperty
(
value
=
"所属场站"
,
index
=
0
)
@ExcelProperty
(
value
=
"所属场站"
,
index
=
1
)
private
String
platformCompanyId
;
private
String
platformCompanyId
;
@ColumnWidth
(
15
)
@ColumnWidth
(
15
)
@ExcelProperty
(
value
=
"乡镇"
,
index
=
1
)
@ExcelProperty
(
value
=
"乡镇"
,
index
=
2
)
private
String
districtId
;
private
String
districtId
;
@ColumnWidth
(
15
)
@ColumnWidth
(
15
)
@ExcelProperty
(
value
=
"户号"
,
index
=
2
)
@ExcelProperty
(
value
=
"户号"
,
index
=
3
)
private
String
number
;
private
String
number
;
@ColumnWidth
(
15
)
@ColumnWidth
(
15
)
@ExcelProperty
(
value
=
"户主姓名"
,
index
=
3
)
@ExcelProperty
(
value
=
"户主姓名"
,
index
=
4
)
private
String
name
;
private
String
name
;
@ColumnWidth
(
15
)
@ColumnWidth
(
15
)
@ExcelProperty
(
value
=
"性别"
,
index
=
4
)
@ExcelProperty
(
value
=
"性别"
,
index
=
5
)
private
String
sex
;
private
String
sex
;
@ColumnWidth
(
15
)
@ColumnWidth
(
15
)
@ExcelProperty
(
value
=
"身份证号"
,
index
=
5
)
@ExcelProperty
(
value
=
"身份证号"
,
index
=
6
)
private
String
idNumber
;
private
String
idNumber
;
@ColumnWidth
(
20
)
@ColumnWidth
(
20
)
@ExcelProperty
(
value
=
"证件过期时间"
,
index
=
6
)
@ExcelProperty
(
value
=
"证件过期时间"
,
index
=
7
)
private
String
expiryTime
;
private
String
expiryTime
;
@ColumnWidth
(
15
)
@ColumnWidth
(
15
)
@ExcelProperty
(
value
=
"签发机关"
,
index
=
7
)
@ExcelProperty
(
value
=
"签发机关"
,
index
=
8
)
private
String
issuingAuthority
;
private
String
issuingAuthority
;
@ColumnWidth
(
15
)
@ColumnWidth
(
15
)
@ExcelProperty
(
value
=
"户籍地址"
,
index
=
8
)
@ExcelProperty
(
value
=
"户籍地址"
,
index
=
9
)
private
String
residenceAddress
;
private
String
residenceAddress
;
@ColumnWidth
(
15
)
@ColumnWidth
(
15
)
@ExcelProperty
(
value
=
"手机号码"
,
index
=
9
)
@ExcelProperty
(
value
=
"手机号码"
,
index
=
10
)
private
String
phone
;
private
String
phone
;
@ColumnWidth
(
15
)
@ColumnWidth
(
15
)
@ExcelProperty
(
value
=
"居住地"
,
index
=
1
0
)
@ExcelProperty
(
value
=
"居住地"
,
index
=
1
1
)
private
String
address
;
private
String
address
;
@ColumnWidth
(
15
)
@ColumnWidth
(
15
)
@ExcelProperty
(
value
=
"居住地邮编"
,
index
=
1
1
)
@ExcelProperty
(
value
=
"居住地邮编"
,
index
=
1
2
)
private
String
postcode
;
private
String
postcode
;
@ColumnWidth
(
15
)
@ColumnWidth
(
15
)
@ExcelProperty
(
value
=
"送达地址"
,
index
=
1
2
)
@ExcelProperty
(
value
=
"送达地址"
,
index
=
1
3
)
private
String
serviceAddress
;
private
String
serviceAddress
;
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/HouseholdPvController.java
View file @
6c9d2a9d
...
@@ -19,6 +19,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.HouseholdPvServiceImp
...
@@ -19,6 +19,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.HouseholdPvServiceImp
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.poi.ss.usermodel.CellStyle
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.ss.usermodel.Workbook
;
...
@@ -156,7 +157,7 @@ public class HouseholdPvController extends BaseController {
...
@@ -156,7 +157,7 @@ public class HouseholdPvController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"模板下载"
,
notes
=
"模板下载"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"模板下载"
,
notes
=
"模板下载"
)
public
void
exportTemplates
(
HttpServletResponse
response
)
{
public
void
exportTemplates
(
HttpServletResponse
response
)
{
FileUtil
.
downloadResource
(
"户用光伏导入模板.xlsx"
,
"templates/householdTemplates.xls"
,
response
);
FileUtil
.
downloadResource
(
"户用光伏导入模板.xlsx"
,
"templates/householdTemplates
New
.xls"
,
response
);
}
}
...
@@ -176,7 +177,7 @@ public class HouseholdPvController extends BaseController {
...
@@ -176,7 +177,7 @@ public class HouseholdPvController extends BaseController {
@GetMapping
(
value
=
"/exportData"
)
@GetMapping
(
value
=
"/exportData
Old
"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"数据导出"
,
notes
=
"数据导出"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"数据导出"
,
notes
=
"数据导出"
)
public
void
exportMessage
(
HttpServletResponse
response
,
HouseholdPvDto
dto
)
throws
IOException
{
public
void
exportMessage
(
HttpServletResponse
response
,
HouseholdPvDto
dto
)
throws
IOException
{
...
@@ -231,7 +232,48 @@ public class HouseholdPvController extends BaseController {
...
@@ -231,7 +232,48 @@ public class HouseholdPvController extends BaseController {
}
}
}
}
@GetMapping
(
value
=
"/exportData"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"数据导出"
,
notes
=
"数据导出"
)
public
void
exportMessageNew
(
HttpServletResponse
response
,
HouseholdPvDto
dto
)
throws
IOException
{
try
{
ClassPathResource
cpr
=
new
ClassPathResource
(
"templates/householdExportNew.xls"
);
InputStream
is
=
cpr
.
getInputStream
();
Workbook
workbook
=
new
XSSFWorkbook
(
is
);
Sheet
sheet
=
workbook
.
getSheetAt
(
0
);
List
<
HouseholdPvExport
>
list
=
iHouseholdPvService
.
selectExportList
(
dto
,
dto
.
getIds
());
// 序号
int
num
=
1
;
for
(
HouseholdPvExport
item
:
list
)
{
// 获取当前插入数据行号
int
lastRowNum
=
sheet
.
getLastRowNum
()
+
1
;
Row
row
=
sheet
.
createRow
((
short
)
(
lastRowNum
));
row
.
createCell
(
0
).
setCellValue
(
num
);
num
++;
row
.
createCell
(
1
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getNumber
())
?
""
:
item
.
getNumber
());
row
.
createCell
(
2
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getName
())
?
""
:
item
.
getName
());
row
.
createCell
(
3
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getIdNumber
())
?
""
:
item
.
getIdNumber
());
row
.
createCell
(
4
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getPhone
())
?
""
:
item
.
getPhone
());
row
.
createCell
(
5
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getInstallAddress
())
?
""
:
item
.
getInstallAddress
());
// 安装总功率
if
(!
ObjectUtils
.
isEmpty
(
item
)&&
!
ObjectUtils
.
isEmpty
(
item
.
getActualCapacity
())
&&
!
ObjectUtils
.
isEmpty
(
item
.
getInstallCount
()))
{
row
.
createCell
(
6
).
setCellValue
(
Math
.
multiplyExact
(
Long
.
valueOf
(
item
.
getActualCapacity
()),
Long
.
valueOf
(
item
.
getInstallCount
())));
}
else
{
row
.
createCell
(
6
).
setCellValue
(
0
);
}
row
.
createCell
(
7
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getContactNumber
())
?
""
:
item
.
getContactNumber
());
row
.
createCell
(
8
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getGenerationNumber
())
?
""
:
item
.
getGenerationNumber
());
row
.
createCell
(
9
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getInverterSerialNumber
())
?
""
:
item
.
getInverterSerialNumber
());
}
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setHeader
(
"content-Type"
,
"application/vnd.ms-excel"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename=\""
+
URLEncoder
.
encode
(
"户用光伏信息.xls"
,
"UTF-8"
)
+
"\""
);
workbook
.
write
(
response
.
getOutputStream
());
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/deleteBatch"
)
@PostMapping
(
value
=
"/deleteBatch"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"批量删除"
,
notes
=
"批量删除"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"批量删除"
,
notes
=
"批量删除"
)
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/HouseholdPvServiceImpl.java
View file @
6c9d2a9d
...
@@ -176,9 +176,9 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
...
@@ -176,9 +176,9 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
if
(
ObjectUtils
.
isEmpty
(
dto
.
getPostcode
()))
{
if
(
ObjectUtils
.
isEmpty
(
dto
.
getPostcode
()))
{
return
"第 "
+
line
+
" 行居住地邮编不能为空!"
;
return
"第 "
+
line
+
" 行居住地邮编不能为空!"
;
}
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getServiceAddress
()))
{
//
if (ObjectUtils.isEmpty(dto.getServiceAddress())) {
return
"第 "
+
line
+
" 行送达地址不能为空!"
;
//
return "第 " + line + " 行送达地址不能为空!";
}
//
}
// 导入文件中数据校验
// 导入文件中数据校验
List
<
HouseholdPvImport
>
collect
=
list
.
stream
().
filter
(
item
->
dto
.
getNumber
().
equals
(
item
.
getNumber
())).
collect
(
Collectors
.
toList
());
List
<
HouseholdPvImport
>
collect
=
list
.
stream
().
filter
(
item
->
dto
.
getNumber
().
equals
(
item
.
getNumber
())).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
collect
)
&&
collect
.
size
()
>=
2
)
{
if
(!
ObjectUtils
.
isEmpty
(
collect
)
&&
collect
.
size
()
>=
2
)
{
...
@@ -220,9 +220,9 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
...
@@ -220,9 +220,9 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
if
(
dto
.
getPostcode
().
length
()
>
10
)
{
if
(
dto
.
getPostcode
().
length
()
>
10
)
{
return
"第"
+
line
+
" 行居住地邮编最多输入10个字符!"
;
return
"第"
+
line
+
" 行居住地邮编最多输入10个字符!"
;
}
}
if
(
dto
.
getServiceAddress
().
length
()
>
200
)
{
//
if (dto.getServiceAddress().length() > 200) {
return
"第"
+
line
+
" 行送达地址最多输入200个字符!"
;
//
return "第" + line + " 行送达地址最多输入200个字符!";
}
//
}
if
(
dto
.
getResidenceAddress
().
length
()
>
400
)
{
if
(
dto
.
getResidenceAddress
().
length
()
>
400
)
{
return
"第"
+
line
+
" 户籍地址最多输入400个字符!"
;
return
"第"
+
line
+
" 户籍地址最多输入400个字符!"
;
}
}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/resources/templates/householdExportNew.xls
0 → 100644
View file @
6c9d2a9d
File added
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/resources/templates/householdTemplatesNew.xls
0 → 100644
View file @
6c9d2a9d
File added
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