Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
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
station
YeeAmosFireAutoSysRoot
Commits
5fd83797
Commit
5fd83797
authored
Feb 20, 2020
by
taabe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加设备点位数据导出功能;修改FileHelper中downLoadExcel中bug(注释掉response.reset())
parent
e761f0b7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
95 additions
and
15 deletions
+95
-15
ExcelController.java
...yeejoin/amos/fas/business/controller/ExcelController.java
+30
-5
FireEquipmentPointEntity.java
...fas/business/entity/mybatis/FireEquipmentPointEntity.java
+10
-0
FireEquipmentPointParam.java
...join/amos/fas/business/param/FireEquipmentPointParam.java
+28
-7
ExcelServiceImpl.java
...join/amos/fas/business/service/impl/ExcelServiceImpl.java
+21
-0
IExcelService.java
...eejoin/amos/fas/business/service/intfc/IExcelService.java
+2
-0
FileHelper.java
...n/java/com/yeejoin/amos/fas/business/util/FileHelper.java
+1
-1
dbTemplate_fire_equippoint.xml
...c/main/resources/db/mapper/dbTemplate_fire_equippoint.xml
+3
-2
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/ExcelController.java
View file @
5fd83797
...
...
@@ -5,6 +5,7 @@ import com.yeejoin.amos.fas.business.param.FireEquipmentParam;
import
com.yeejoin.amos.fas.business.param.FireEquipmentPointParam
;
import
com.yeejoin.amos.fas.business.service.intfc.IExcelService
;
import
com.yeejoin.amos.fas.business.util.FileHelper
;
import
com.yeejoin.amos.fas.core.util.FileUtil
;
import
com.yeejoin.amos.op.core.common.response.CommonResponse
;
import
com.yeejoin.amos.op.core.util.CommonResponseUtil
;
import
com.yeejoin.amos.security.authorization.Authorization
;
...
...
@@ -14,15 +15,12 @@ import io.swagger.annotations.ApiParam;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestPart
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
@RestController
...
...
@@ -72,6 +70,33 @@ public class ExcelController extends BaseController {
}
@ApiOperation
(
value
=
"导出数据"
,
notes
=
"导出数据"
)
@PostMapping
(
value
=
"/export2"
)
@Authorization
(
ingore
=
true
)
public
void
export2
(
HttpServletResponse
response
,
@ApiParam
(
value
=
"data:导出数据;model:导出模板"
,
required
=
true
)
@RequestParam
String
exportType
,
@ApiParam
(
value
=
"point:监测点;equipment:设备"
,
required
=
true
)
@RequestParam
String
modelName
,
@ApiParam
(
value
=
"查询条件"
)
@RequestBody
(
required
=
false
)
Map
<
String
,
Object
>
paramsMap
)
{
String
fileName
=
UUID
.
randomUUID
().
toString
()
+
".xls"
;
String
title
=
"监测点"
;
Class
cls
=
null
;
if
(
"point"
.
equals
(
modelName
))
{
cls
=
FireEquipmentPointParam
.
class
;
}
else
if
(
"equipment"
.
equals
(
modelName
))
{
cls
=
FireEquipmentParam
.
class
;
}
if
(
cls
!=
null
)
{
List
<?>
list
=
Lists
.
newArrayList
();
// if ("model".equals(exportType)) {
// FileHelper.exportExcel(list, title, title, cls, fileName, response);
// }
if
(
"data"
.
equals
(
exportType
))
{
list
=
iExcelService
.
exportPointData
(
paramsMap
);
}
FileHelper
.
exportExcel
(
list
,
title
,
title
,
cls
,
fileName
,
response
);
}
}
@ApiOperation
(
value
=
"导出数据"
,
notes
=
"导出数据"
)
@PostMapping
(
value
=
"/export"
)
@Authorization
(
ingore
=
true
)
public
void
export
(
HttpServletResponse
response
,
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/entity/mybatis/FireEquipmentPointEntity.java
View file @
5fd83797
...
...
@@ -30,6 +30,8 @@ public class FireEquipmentPointEntity extends FireEquipmentPointExtend {
private
Long
alarmType
;
private
String
fireEquipmentCode
;
public
Long
getId
()
{
return
id
;
}
...
...
@@ -125,4 +127,12 @@ public class FireEquipmentPointEntity extends FireEquipmentPointExtend {
public
void
setAlarmType
(
Long
alarmType
)
{
this
.
alarmType
=
alarmType
;
}
public
String
getFireEquipmentCode
()
{
return
fireEquipmentCode
;
}
public
void
setFireEquipmentCode
(
String
fireEquipmentCode
)
{
this
.
fireEquipmentCode
=
fireEquipmentCode
;
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/param/FireEquipmentPointParam.java
View file @
5fd83797
...
...
@@ -6,25 +6,30 @@ public class FireEquipmentPointParam {
private
Long
id
;
@Excel
(
name
=
"名称"
,
orderNum
=
"1"
)
@Excel
(
name
=
"名称"
,
orderNum
=
"1"
,
width
=
50
)
private
String
name
;
@Excel
(
name
=
"编号"
,
orderNum
=
"2"
)
@Excel
(
name
=
"编号"
,
orderNum
=
"2"
,
width
=
12
)
private
String
code
;
@Excel
(
name
=
"消防装备编号"
,
orderNum
=
"3"
)
@Excel
(
name
=
"消防装备编号"
,
orderNum
=
"3"
,
width
=
15
)
private
String
fireEquipmentCode
;
@Excel
(
name
=
"消防装备名称"
,
orderNum
=
"4"
,
width
=
50
)
private
String
fireEquipmentName
;
private
Long
fireEquipmentId
;
@Excel
(
name
=
"类型"
,
replace
=
{
"模拟量_ANALOGUE"
,
"开关量_SWITCH"
},
orderNum
=
"
4
"
)
@Excel
(
name
=
"类型"
,
replace
=
{
"模拟量_ANALOGUE"
,
"开关量_SWITCH"
},
orderNum
=
"
5
"
)
private
String
type
;
@Excel
(
name
=
"单位"
,
orderNum
=
"5"
)
@Excel
(
name
=
"值"
,
replace
=
{
"是_true"
,
"否_false"
},
orderNum
=
"6"
,
width
=
12
)
private
String
value
;
@Excel
(
name
=
"单位"
,
orderNum
=
"7"
,
width
=
12
)
private
String
unit
;
@Excel
(
name
=
"告警类型"
,
replace
=
{
"火灾告警_1"
,
"电源开关_2"
,
"换流变_6"
,
"液位_3"
,
"流量_4"
,
"容量_5"
},
orderNum
=
"
6
"
)
@Excel
(
name
=
"告警类型"
,
replace
=
{
"火灾告警_1"
,
"电源开关_2"
,
"换流变_6"
,
"液位_3"
,
"流量_4"
,
"容量_5"
},
orderNum
=
"
8
"
)
private
Long
alarmType
;
public
Long
getId
()
{
...
...
@@ -90,4 +95,20 @@ public class FireEquipmentPointParam {
public
void
setFireEquipmentId
(
Long
fireEquipmentId
)
{
this
.
fireEquipmentId
=
fireEquipmentId
;
}
public
String
getFireEquipmentName
()
{
return
fireEquipmentName
;
}
public
void
setFireEquipmentName
(
String
fireEquipmentName
)
{
this
.
fireEquipmentName
=
fireEquipmentName
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ExcelServiceImpl.java
View file @
5fd83797
...
...
@@ -10,11 +10,16 @@ import com.yeejoin.amos.fas.business.entity.mybatis.FireEquipmentPointEntity;
import
com.yeejoin.amos.fas.business.param.FireEquipmentParam
;
import
com.yeejoin.amos.fas.business.param.FireEquipmentPointParam
;
import
com.yeejoin.amos.fas.business.service.intfc.IExcelService
;
import
com.yeejoin.amos.fas.business.service.intfc.IFireEquipPontService
;
import
com.yeejoin.amos.op.core.common.response.CommonResponse
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
...
...
@@ -28,6 +33,9 @@ public class ExcelServiceImpl implements IExcelService {
@Autowired
private
FireEquipPointMapper
fireEquipPointMapper
;
@Autowired
private
IFireEquipPontService
fireEquipPontService
;
@Transactional
@Override
public
void
importFireEquipment
(
List
<
FireEquipmentParam
>
list
)
{
...
...
@@ -90,4 +98,17 @@ public class ExcelServiceImpl implements IExcelService {
fireEquipPointMapper
.
updateBatch
(
updateList
);
}
}
@Override
public
List
<?>
exportPointData
(
Map
<
String
,
Object
>
paramsMap
)
{
CommonResponse
result
=
fireEquipPontService
.
queryByMap
(
paramsMap
);
List
<
FireEquipmentPointEntity
>
fireEquipmentPoints
=
((
PageImpl
)
result
.
getDataList
()).
getContent
();
List
<
FireEquipmentPointParam
>
pointExcelList
=
new
ArrayList
<>();
for
(
FireEquipmentPointEntity
point
:
fireEquipmentPoints
)
{
FireEquipmentPointParam
pointParam
=
new
FireEquipmentPointParam
();
BeanUtils
.
copyProperties
(
point
,
pointParam
);
pointExcelList
.
add
(
pointParam
);
}
return
pointExcelList
;
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IExcelService.java
View file @
5fd83797
...
...
@@ -4,6 +4,7 @@ import com.yeejoin.amos.fas.business.param.FireEquipmentParam;
import
com.yeejoin.amos.fas.business.param.FireEquipmentPointParam
;
import
java.util.List
;
import
java.util.Map
;
public
interface
IExcelService
{
...
...
@@ -11,4 +12,5 @@ public interface IExcelService {
void
importFireEquipmentPoint
(
List
<
FireEquipmentPointParam
>
list
);
List
<?>
exportPointData
(
Map
<
String
,
Object
>
paramsMap
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/util/FileHelper.java
View file @
5fd83797
...
...
@@ -892,7 +892,7 @@ public class FileHelper {
private
static
void
downLoadExcel
(
String
fileName
,
HttpServletResponse
response
,
Workbook
workbook
)
{
try
{
String
name
=
new
String
(
fileName
.
getBytes
(
StandardCharsets
.
UTF_8
),
StandardCharsets
.
ISO_8859_1
);
response
.
reset
();
//
response.reset();
response
.
setHeader
(
"content-Type"
,
"application/vnd.ms-excel"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
name
);
...
...
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/dbTemplate_fire_equippoint.xml
View file @
5fd83797
...
...
@@ -132,7 +132,8 @@
a.unit,
a.org_code as orgCode,
a.alarm_type as alarmType,
b.name as fireEquipmentName
b.name as fireEquipmentName,
b.code as fireEquipmentCode
from
f_fire_equipment_point as a
left join
...
...
@@ -149,7 +150,7 @@
</if>
</where>
order by a.create_date desc
<if
test=
"pageSize!=null and pageNumber!=null"
>
<if
test=
"pageSize!=null and page
Size!=-1 and page
Number!=null"
>
limit #{pageNumber},#{pageSize}
</if>
</select>
...
...
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