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
432e521b
Commit
432e521b
authored
Mar 21, 2023
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新接口
parent
e9d81d5d
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
199 additions
and
62 deletions
+199
-62
HouseholdPvExport.java
...oin/amos/boot/module/jxiop/api/dto/HouseholdPvExport.java
+54
-0
HouseholdPvMapper.java
.../amos/boot/module/jxiop/api/mapper/HouseholdPvMapper.java
+5
-1
IHouseholdPvService.java
...os/boot/module/jxiop/api/service/IHouseholdPvService.java
+2
-1
HouseholdPvMapper.xml
...jxiop-api/src/main/resources/mapper/HouseholdPvMapper.xml
+37
-2
HouseholdPvController.java
...ot/module/jxiop/biz/controller/HouseholdPvController.java
+60
-48
HouseholdPvServiceImpl.java
...module/jxiop/biz/service/impl/HouseholdPvServiceImpl.java
+41
-10
householdExport.xls
...jxiop-biz/src/main/resource/templates/householdExport.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/HouseholdPvExport.java
0 → 100644
View file @
432e521b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
dto
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
HouseholdPvExport
{
private
Long
id
;
/**
* 基础信息
*/
private
String
platformCompanyId
;
private
String
number
;
private
String
name
;
private
String
sex
;
private
String
idNumber
;
private
String
expiryTime
;
private
String
issuingAuthority
;
private
String
residenceAddress
;
private
String
phone
;
private
String
address
;
private
String
postcode
;
private
String
serviceAddress
;
/**
* 合同信息
*/
private
String
contactNumber
;
private
String
period
;
private
String
description
;
/**
* 设备信息
*/
private
String
equipmentMessage
;
/**
* 租赁物信息
*/
private
String
installAddress
;
private
String
installDate
;
private
String
estimatedPower
;
private
String
monolithicPower
;
private
String
installCount
;
private
String
actualCapacity
;
private
String
stationType
;
private
String
moduleType
;
/**
* 安装信息
*/
private
String
installDescription
;
private
String
installStation
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/mapper/HouseholdPvMapper.java
View file @
432e521b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
mapper
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
mapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvDeviceDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvExport
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvImport
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvImport
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPv
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPv
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
...
@@ -16,5 +18,7 @@ import java.util.List;
...
@@ -16,5 +18,7 @@ import java.util.List;
*/
*/
public
interface
HouseholdPvMapper
extends
BaseMapper
<
HouseholdPv
>
{
public
interface
HouseholdPvMapper
extends
BaseMapper
<
HouseholdPv
>
{
List
<
HouseholdPvImport
>
selectExportList
(
@Param
(
"dto"
)
HouseholdPvDto
dto
);
List
<
HouseholdPvExport
>
selectExportList
(
@Param
(
"dto"
)
HouseholdPvDto
dto
);
List
<
HouseholdPvDeviceDto
>
selectEquipList
(
@Param
(
"id"
)
Long
id
);
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/service/IHouseholdPvService.java
View file @
432e521b
...
@@ -5,6 +5,7 @@ import java.util.List;
...
@@ -5,6 +5,7 @@ import java.util.List;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvExport
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvImport
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvImport
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPv
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPv
;
...
@@ -18,7 +19,7 @@ public interface IHouseholdPvService extends IService<HouseholdPv>{
...
@@ -18,7 +19,7 @@ public interface IHouseholdPvService extends IService<HouseholdPv>{
void
importData
(
List
<
HouseholdPvImport
>
list
);
void
importData
(
List
<
HouseholdPvImport
>
list
);
List
<
HouseholdPv
Im
port
>
selectExportList
(
HouseholdPvDto
dto
);
List
<
HouseholdPv
Ex
port
>
selectExportList
(
HouseholdPvDto
dto
);
void
deleteBatch
(
List
<
Long
>
ids
);
void
deleteBatch
(
List
<
Long
>
ids
);
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/resources/mapper/HouseholdPvMapper.xml
View file @
432e521b
...
@@ -2,8 +2,40 @@
...
@@ -2,8 +2,40 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.boot.module.jxiop.api.mapper.HouseholdPvMapper"
>
<mapper
namespace=
"com.yeejoin.amos.boot.module.jxiop.api.mapper.HouseholdPvMapper"
>
<select
id=
"selectExportList"
resultType=
"com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvImport"
>
<select
id=
"selectExportList"
resultType=
"com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvExport"
>
SELECT * FROM `household_pv` hp
SELECT
hp.sequence_nbr as id,
hp.platform_company_id AS platformCompanyId,
hp.number,
hp.`name`,
hp.sex,
hp.ID_number AS idNumber,
hp.expiry_time AS expiryTime,
hp.issuing_authority AS issuingAuthority,
hp.residence_address AS residenceAddress,
hp.phone,
hp.address,
hp.postcode,
hp.service_address AS serviceAddress,
hpc.number AS contactNumber,
hpc.period,
hpc.description ,
hpl.install_address as installAddress,
hpl.install_date as installDate,
hpl.estimated_power as estimatedPower,
hpl.monolithic_power as monolithicPower,
hpl.actual_capacity as actualCapacity,
hpl.station_type as stationType,
hpl.module_type as moduleType,
hpl.install_count as installCount,
hpi.description as installDescription,
hpi.platform_company_id AS installStation
FROM
household_pv hp
LEFT JOIN household_pv_contact hpc on hp.sequence_nbr = hpc.household_pv_id
LEFT JOIN household_pv_lease hpl on hp.sequence_nbr = hpl.household_pv_id
LEFT JOIN household_pv_install hpi on hp.sequence_nbr = hpi.household_pv_id
<where>
<where>
<if
test=
"dto.name != null and dto.name != ''"
>
<if
test=
"dto.name != null and dto.name != ''"
>
and hp.name like concat('%',#{dto.name},'%')
and hp.name like concat('%',#{dto.name},'%')
...
@@ -19,4 +51,7 @@
...
@@ -19,4 +51,7 @@
</if>
</if>
</where>
</where>
</select>
</select>
<select
id=
"selectEquipList"
resultType=
"com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvDeviceDto"
>
SELECT * from household_pv_device hpd WHERE hpd.household_pv_id = #{id}
</select>
</mapper>
</mapper>
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/HouseholdPvController.java
View file @
432e521b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
controller
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
controller
;
import
cn.afterturn.easypoi.excel.ExcelImportUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.EasyExcelFactory
;
import
com.alibaba.excel.ExcelReader
;
import
com.alibaba.excel.ExcelWriter
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.excel.ExcelUtil
;
import
com.yeejoin.amos.boot.biz.common.excel.ExcelUtil
;
import
com.yeejoin.amos.boot.
biz.common.utils.ExcelUtils
;
import
com.yeejoin.amos.boot.
module.jxiop.api.dto.HouseholdPvDto
;
import
com.yeejoin.amos.boot.
biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.
module.jxiop.api.dto.HouseholdPvExport
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvImport
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvImport
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPv
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPv
;
import
com.yeejoin.amos.boot.module.jxiop.api.service.IHouseholdPvService
;
import
com.yeejoin.amos.boot.module.jxiop.api.service.IHouseholdPvService
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.HouseholdPvServiceImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.usermodel.Cell
;
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.Workbook
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.joda.time.LocalDateTime
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
java.io.*
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.HouseholdPvServiceImpl
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.net.URLEncoder
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
java.util.List
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvDto
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
/**
/**
* 户用光伏表
* 户用光伏表
...
@@ -203,10 +182,9 @@ public class HouseholdPvController extends BaseController {
...
@@ -203,10 +182,9 @@ public class HouseholdPvController extends BaseController {
@GetMapping
(
value
=
"/importData"
)
@GetMapping
(
value
=
"/importData"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"
模板下载"
,
notes
=
"模板下载
"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"
基础数据导入"
,
notes
=
"基础数据导入
"
)
public
ResponseModel
<
Object
>
importData
(
@RequestPart
(
"file"
)
MultipartFile
multipartFile
)
throws
Exception
{
public
ResponseModel
<
Object
>
importData
(
@RequestPart
(
"file"
)
MultipartFile
multipartFile
)
throws
Exception
{
try
{
try
{
// ExcelReader reader = EasyExcelFactory.read(multipartFile.getInputStream()).build();
List
<
HouseholdPvImport
>
list
=
ExcelUtil
.
readFirstSheetExcel
(
multipartFile
,
HouseholdPvImport
.
class
,
2
);
List
<
HouseholdPvImport
>
list
=
ExcelUtil
.
readFirstSheetExcel
(
multipartFile
,
HouseholdPvImport
.
class
,
2
);
iHouseholdPvService
.
importData
(
list
);
iHouseholdPvService
.
importData
(
list
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
@@ -220,18 +198,52 @@ public class HouseholdPvController extends BaseController {
...
@@ -220,18 +198,52 @@ public class HouseholdPvController extends BaseController {
@GetMapping
(
value
=
"/exportData"
)
@GetMapping
(
value
=
"/exportData"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"数据导出"
,
notes
=
"数据导出"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"数据导出"
,
notes
=
"数据导出"
)
public
void
export
Data
(
HttpServletResponse
response
,
HouseholdPvDto
dto
)
{
public
void
export
Message
(
HttpServletResponse
response
,
HouseholdPvDto
dto
)
throws
IOException
{
try
{
try
{
ClassPathResource
cpr
=
new
ClassPathResource
(
"templates/householdExport.xls"
);
InputStream
is
=
cpr
.
getInputStream
();
Workbook
workbook
=
new
XSSFWorkbook
(
is
);
Sheet
sheet
=
workbook
.
getSheetAt
(
0
);
//这里作为演示,造几个演示数据,模拟数据库里查数据
List
<
HouseholdPvExport
>
list
=
iHouseholdPvService
.
selectExportList
(
dto
);
//基础信息
list
.
forEach
(
item
->
{
// 当前获取最后一行
int
lastRowNum
=
sheet
.
getLastRowNum
()
+
1
;
Row
row
=
sheet
.
createRow
((
short
)
(
lastRowNum
));
row
.
createCell
(
0
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getPlatformCompanyId
())
?
""
:
item
.
getPlatformCompanyId
());
row
.
createCell
(
1
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getNumber
())
?
""
:
item
.
getNumber
());
row
.
createCell
(
3
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getName
())
?
""
:
item
.
getName
());
row
.
createCell
(
4
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getIdNumber
())
?
""
:
item
.
getIdNumber
());
row
.
createCell
(
5
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getExpiryTime
())
?
""
:
item
.
getExpiryTime
());
row
.
createCell
(
6
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getIssuingAuthority
())
?
""
:
item
.
getIssuingAuthority
());
row
.
createCell
(
7
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getResidenceAddress
())
?
""
:
item
.
getResidenceAddress
());
row
.
createCell
(
8
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getPhone
())
?
""
:
item
.
getPhone
());
row
.
createCell
(
9
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getAddress
())
?
""
:
item
.
getAddress
());
row
.
createCell
(
10
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getPostcode
())
?
""
:
item
.
getPostcode
());
row
.
createCell
(
11
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getServiceAddress
())
?
""
:
item
.
getServiceAddress
());
row
.
createCell
(
12
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getContactNumber
())
?
""
:
item
.
getContactNumber
());
row
.
createCell
(
13
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getPeriod
())
?
""
:
item
.
getPeriod
());
row
.
createCell
(
14
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getDescription
())
?
""
:
item
.
getDescription
());
row
.
createCell
(
15
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getEquipmentMessage
())
?
""
:
item
.
getEquipmentMessage
());
row
.
createCell
(
16
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getInstallAddress
())
?
""
:
item
.
getInstallAddress
());
row
.
createCell
(
17
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getInstallDate
())
?
""
:
item
.
getInstallDate
());
row
.
createCell
(
18
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getEstimatedPower
())
?
""
:
item
.
getEstimatedPower
());
row
.
createCell
(
19
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getMonolithicPower
())
?
""
:
item
.
getMonolithicPower
());
row
.
createCell
(
20
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getInstallCount
())
?
""
:
item
.
getInstallCount
());
row
.
createCell
(
21
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getActualCapacity
())
?
""
:
item
.
getActualCapacity
());
row
.
createCell
(
22
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getStationType
())
?
""
:
item
.
getStationType
());
row
.
createCell
(
23
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getModuleType
())
?
""
:
item
.
getModuleType
());
row
.
createCell
(
24
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getInstallStation
())
?
""
:
item
.
getInstallStation
());
row
.
createCell
(
25
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getInstallDescription
())
?
""
:
item
.
getInstallDescription
());
});
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setHeader
(
"content-Type"
,
"application/vnd.ms-excel"
);
response
.
setHeader
(
"content-Type"
,
"application/vnd.ms-excel"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
"组织机构信息.xlsx"
,
"UTF-8"
));
response
.
setHeader
(
"Content-Disposition"
,
response
.
setHeader
(
"Access-Control-Expose-Headers"
,
"Content-Disposition"
);
"attachment;filename=\""
+
URLEncoder
.
encode
(
"户用光伏信息.xls"
,
"UTF-8"
)
+
"\""
);
ExcelWriter
writer
=
EasyExcelFactory
.
write
(
response
.
getOutputStream
(),
HouseholdPvImport
.
class
).
build
();
workbook
.
write
(
response
.
getOutputStream
());
WriteSheet
sheet
=
EasyExcelFactory
.
writerSheet
(
0
,
String
.
valueOf
(
System
.
currentTimeMillis
())).
build
();
}
catch
(
FileNotFoundException
e
)
{
List
<
HouseholdPvImport
>
list
=
iHouseholdPvService
.
selectExportList
(
dto
);
writer
.
write
(
list
,
sheet
);
writer
.
finish
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
...
@@ -241,7 +253,7 @@ public class HouseholdPvController extends BaseController {
...
@@ -241,7 +253,7 @@ public class HouseholdPvController extends BaseController {
@PostMapping
(
value
=
"/deleteBatch"
)
@PostMapping
(
value
=
"/deleteBatch"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"批量删除"
,
notes
=
"批量删除"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"批量删除"
,
notes
=
"批量删除"
)
public
ResponseModel
<
Object
>
deleteBatch
(
@RequestBody
JSONObject
object
)
{
public
ResponseModel
<
Object
>
deleteBatch
(
@RequestBody
JSONObject
object
)
{
List
<
Long
>
ids
=
(
List
<
Long
>)
object
.
get
(
"ids"
);
List
<
Long
>
ids
=
(
List
<
Long
>)
object
.
get
(
"ids"
);
iHouseholdPvService
.
deleteBatch
(
ids
);
iHouseholdPvService
.
deleteBatch
(
ids
);
return
ResponseHelper
.
buildResponse
(
"ok"
);
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
}
...
...
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 @
432e521b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
.
impl
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.List
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.*
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.joda.time.LocalDateTime
;
import
org.joda.time.LocalDateTime
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
...
@@ -17,11 +18,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...
@@ -17,11 +18,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvContactDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvImport
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvInstallDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvLeaseDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPv
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPv
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPvContact
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPvContact
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPvInstall
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPvInstall
;
...
@@ -103,8 +99,43 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
...
@@ -103,8 +99,43 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
}
}
@Override
@Override
public
List
<
HouseholdPvImport
>
selectExportList
(
HouseholdPvDto
dto
)
{
public
List
<
HouseholdPvExport
>
selectExportList
(
HouseholdPvDto
dto
)
{
return
householdPvMapper
.
selectExportList
(
dto
);
List
<
HouseholdPvExport
>
householdPvExports
=
householdPvMapper
.
selectExportList
(
dto
);
householdPvExports
.
forEach
(
item
->
{
if
(!
ObjectUtils
.
isEmpty
(
item
.
getPeriod
()))
{
JSONArray
objects
=
JSON
.
parseArray
(
item
.
getPeriod
());
if
(!
ObjectUtils
.
isEmpty
(
objects
)
&&
objects
.
size
()
>=
2
)
{
item
.
setPeriod
(
objects
.
get
(
0
)
+
"-"
+
objects
.
get
(
1
));
}
}
List
<
HouseholdPvDeviceDto
>
equipList
=
householdPvMapper
.
selectEquipList
(
item
.
getId
());
if
(!
ObjectUtils
.
isEmpty
(
equipList
))
{
StringBuilder
stringBuilder
=
equipMessage
(
equipList
);
item
.
setEquipmentMessage
(
stringBuilder
.
toString
());
}
});
return
householdPvExports
;
}
private
StringBuilder
equipMessage
(
List
<
HouseholdPvDeviceDto
>
list
)
{
StringBuilder
stringBuilder
=
new
StringBuilder
();
list
.
forEach
(
item
->
{
stringBuilder
.
append
(
"类型:"
).
append
(
ObjectUtils
.
isEmpty
(
item
.
getType
())
?
""
:
item
.
getType
());
stringBuilder
.
append
(
" 名称:"
).
append
(
ObjectUtils
.
isEmpty
(
item
.
getName
())
?
""
:
item
.
getName
());
stringBuilder
.
append
(
" 品牌:"
).
append
(
ObjectUtils
.
isEmpty
(
item
.
getBrand
())
?
""
:
item
.
getBrand
());
stringBuilder
.
append
(
" SN编码:"
).
append
(
ObjectUtils
.
isEmpty
(
item
.
getSnCode
())
?
""
:
item
.
getSnCode
());
if
(!
ObjectUtils
.
isEmpty
(
item
.
getType
())
&&
item
.
getType
().
equals
(
"逆变器"
))
{
stringBuilder
.
append
(
" 序列号:"
).
append
(
ObjectUtils
.
isEmpty
(
item
.
getSerialNumber
())
?
""
:
item
.
getSerialNumber
());
stringBuilder
.
append
(
" 功率:"
).
append
(
ObjectUtils
.
isEmpty
(
item
.
getPower
())
?
""
:
item
.
getPower
());
}
if
(!
ObjectUtils
.
isEmpty
(
item
.
getType
())
&&
item
.
getType
().
equals
(
"其他"
))
{
stringBuilder
.
append
(
" 描述:"
).
append
(
ObjectUtils
.
isEmpty
(
item
.
getDescription
())
?
""
:
item
.
getDescription
());
}
stringBuilder
.
append
(
"\r\n"
);
});
return
stringBuilder
;
}
}
@Override
@Override
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/resource/templates/householdExport.xls
0 → 100644
View file @
432e521b
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