Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
TDLCloud
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
WitCloud
TDLCloud
Commits
6edba52f
Commit
6edba52f
authored
Jan 16, 2019
by
chenying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2018.1.16
(1)添加ABB报警记录接口
parent
36a8c21c
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
1155 additions
and
10 deletions
+1155
-10
AlarmTermABBVo.java
src/main/java/com/example/tdl/domain/vo/AlarmTermABBVo.java
+43
-0
EasyUIResult.java
src/main/java/com/example/tdl/domain/vo/EasyUIResult.java
+67
-0
ResultAlarmLogABBVo.java
...n/java/com/example/tdl/domain/vo/ResultAlarmLogABBVo.java
+73
-0
ResultAlarmLogCountABBVo.java
...a/com/example/tdl/domain/vo/ResultAlarmLogCountABBVo.java
+63
-0
ResultAlarmLogCountPieGraphVo.java
.../example/tdl/domain/vo/ResultAlarmLogCountPieGraphVo.java
+54
-0
ResultAlarmLogHouseCountPieGraphVo.java
...ple/tdl/domain/vo/ResultAlarmLogHouseCountPieGraphVo.java
+63
-0
ResultCircuitForABBVo.java
...java/com/example/tdl/domain/vo/ResultCircuitForABBVo.java
+10
-0
AlarmLogABBMapper.java
src/main/java/com/example/tdl/mapper/AlarmLogABBMapper.java
+36
-0
AlarmLogABBService.java
...main/java/com/example/tdl/service/AlarmLogABBService.java
+62
-0
AlarmLogForABBExcelUtil.java
...in/java/com/example/tdl/util/AlarmLogForABBExcelUtil.java
+214
-0
AliyunOSSClientUtil.java
src/main/java/com/example/tdl/util/AliyunOSSClientUtil.java
+17
-2
OSSClientConstants.java
src/main/java/com/example/tdl/util/OSSClientConstants.java
+2
-0
AlarmLogABBController.java
src/main/java/com/example/tdl/web/AlarmLogABBController.java
+312
-0
application.properties
src/main/resources/application.properties
+3
-3
AlarmLogABBMapper.xml
src/main/resources/mapper/AlarmLogABBMapper.xml
+130
-0
CircuitABBMapper.xml
src/main/resources/mapper/CircuitABBMapper.xml
+5
-5
mybatis-config.xml
src/main/resources/mybatis-config.xml
+1
-0
No files found.
src/main/java/com/example/tdl/domain/vo/AlarmTermABBVo.java
0 → 100644
View file @
6edba52f
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
AlarmTermABBVo
{
private
String
classify
;
private
Long
startTime
;
private
Long
endTime
;
private
String
companyNo
;
public
String
getCompanyNo
()
{
return
companyNo
;
}
public
void
setCompanyNo
(
String
companyNo
)
{
this
.
companyNo
=
companyNo
;
}
public
String
getClassify
()
{
return
classify
;
}
public
void
setClassify
(
String
classify
)
{
this
.
classify
=
classify
;
}
public
Long
getStartTime
()
{
return
startTime
;
}
public
void
setStartTime
(
Long
startTime
)
{
this
.
startTime
=
startTime
;
}
public
Long
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
Long
endTime
)
{
this
.
endTime
=
endTime
;
}
}
src/main/java/com/example/tdl/domain/vo/EasyUIResult.java
0 → 100644
View file @
6edba52f
package
com
.
example
.
tdl
.
domain
.
vo
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
java.util.List
;
public
class
EasyUIResult
{
// 定义jackson对象
private
static
final
ObjectMapper
MAPPER
=
new
ObjectMapper
();
private
Integer
total
;
private
List
<?>
rows
;
public
EasyUIResult
()
{
}
public
EasyUIResult
(
Integer
total
,
List
<?>
rows
)
{
this
.
total
=
total
;
this
.
rows
=
rows
;
}
public
EasyUIResult
(
Long
total
,
List
<?>
rows
)
{
this
.
total
=
total
.
intValue
();
this
.
rows
=
rows
;
}
public
Integer
getTotal
()
{
return
total
;
}
public
void
setTotal
(
Integer
total
)
{
this
.
total
=
total
;
}
public
List
<?>
getRows
()
{
return
rows
;
}
public
void
setRows
(
List
<?>
rows
)
{
this
.
rows
=
rows
;
}
/**
* Object是集合转化
*
* @param jsonData json数据
* @param clazz 集合中的类型
* @return
*/
public
static
EasyUIResult
formatToList
(
String
jsonData
,
Class
<?>
clazz
)
{
try
{
JsonNode
jsonNode
=
MAPPER
.
readTree
(
jsonData
);
JsonNode
data
=
jsonNode
.
get
(
"rows"
);
List
<?>
list
=
null
;
if
(
data
.
isArray
()
&&
data
.
size
()
>
0
)
{
list
=
MAPPER
.
readValue
(
data
.
traverse
(),
MAPPER
.
getTypeFactory
().
constructCollectionType
(
List
.
class
,
clazz
));
}
return
new
EasyUIResult
(
jsonNode
.
get
(
"total"
).
intValue
(),
list
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
}
src/main/java/com/example/tdl/domain/vo/ResultAlarmLogABBVo.java
0 → 100644
View file @
6edba52f
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
ResultAlarmLogABBVo
{
private
String
transportationNo
;
private
String
cargoNo
;
private
String
TDLSN
;
private
String
description
;
private
String
data
;
private
Long
alarmTime
;
private
String
classify
;
public
String
getTransportationNo
()
{
return
transportationNo
;
}
public
void
setTransportationNo
(
String
transportationNo
)
{
this
.
transportationNo
=
transportationNo
;
}
public
String
getCargoNo
()
{
return
cargoNo
;
}
public
void
setCargoNo
(
String
cargoNo
)
{
this
.
cargoNo
=
cargoNo
;
}
public
String
getTDLSN
()
{
return
TDLSN
;
}
public
void
setTDLSN
(
String
TDLSN
)
{
this
.
TDLSN
=
TDLSN
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
String
getData
()
{
return
data
;
}
public
void
setData
(
String
data
)
{
this
.
data
=
data
;
}
public
Long
getAlarmTime
()
{
return
alarmTime
;
}
public
void
setAlarmTime
(
Long
alarmTime
)
{
this
.
alarmTime
=
alarmTime
;
}
public
String
getClassify
()
{
return
classify
;
}
public
void
setClassify
(
String
classify
)
{
this
.
classify
=
classify
;
}
}
src/main/java/com/example/tdl/domain/vo/ResultAlarmLogCountABBVo.java
0 → 100644
View file @
6edba52f
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
ResultAlarmLogCountABBVo
{
private
String
dates
;
private
Integer
tempCountSum
;
private
Integer
humidCountSum
;
private
Integer
shockCountSum
;
private
Integer
leanCountSum
;
private
Integer
countSum
;
public
String
getDates
()
{
return
dates
;
}
public
void
setDates
(
String
dates
)
{
this
.
dates
=
dates
;
}
public
Integer
getTempCountSum
()
{
return
tempCountSum
;
}
public
void
setTempCountSum
(
Integer
tempCountSum
)
{
this
.
tempCountSum
=
tempCountSum
;
}
public
Integer
getHumidCountSum
()
{
return
humidCountSum
;
}
public
void
setHumidCountSum
(
Integer
humidCountSum
)
{
this
.
humidCountSum
=
humidCountSum
;
}
public
Integer
getShockCountSum
()
{
return
shockCountSum
;
}
public
void
setShockCountSum
(
Integer
shockCountSum
)
{
this
.
shockCountSum
=
shockCountSum
;
}
public
Integer
getLeanCountSum
()
{
return
leanCountSum
;
}
public
void
setLeanCountSum
(
Integer
leanCountSum
)
{
this
.
leanCountSum
=
leanCountSum
;
}
public
Integer
getCountSum
()
{
return
countSum
;
}
public
void
setCountSum
(
Integer
countSum
)
{
this
.
countSum
=
countSum
;
}
}
src/main/java/com/example/tdl/domain/vo/ResultAlarmLogCountPieGraphVo.java
0 → 100644
View file @
6edba52f
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
ResultAlarmLogCountPieGraphVo
{
private
Integer
tempCountSum
;
private
Integer
humidCountSum
;
private
Integer
shockCountSum
;
private
Integer
leanCountSum
;
private
Integer
countSum
;
public
Integer
getTempCountSum
()
{
return
tempCountSum
;
}
public
void
setTempCountSum
(
Integer
tempCountSum
)
{
this
.
tempCountSum
=
tempCountSum
;
}
public
Integer
getHumidCountSum
()
{
return
humidCountSum
;
}
public
void
setHumidCountSum
(
Integer
humidCountSum
)
{
this
.
humidCountSum
=
humidCountSum
;
}
public
Integer
getShockCountSum
()
{
return
shockCountSum
;
}
public
void
setShockCountSum
(
Integer
shockCountSum
)
{
this
.
shockCountSum
=
shockCountSum
;
}
public
Integer
getLeanCountSum
()
{
return
leanCountSum
;
}
public
void
setLeanCountSum
(
Integer
leanCountSum
)
{
this
.
leanCountSum
=
leanCountSum
;
}
public
Integer
getCountSum
()
{
return
countSum
;
}
public
void
setCountSum
(
Integer
countSum
)
{
this
.
countSum
=
countSum
;
}
}
src/main/java/com/example/tdl/domain/vo/ResultAlarmLogHouseCountPieGraphVo.java
0 → 100644
View file @
6edba52f
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
ResultAlarmLogHouseCountPieGraphVo
{
private
Integer
house
;
private
Integer
tempCountSum
;
private
Integer
humidCountSum
;
private
Integer
shockCountSum
;
private
Integer
leanCountSum
;
private
Integer
countSum
;
public
Integer
getHouse
()
{
return
house
;
}
public
void
setHouse
(
Integer
house
)
{
this
.
house
=
house
;
}
public
Integer
getTempCountSum
()
{
return
tempCountSum
;
}
public
void
setTempCountSum
(
Integer
tempCountSum
)
{
this
.
tempCountSum
=
tempCountSum
;
}
public
Integer
getHumidCountSum
()
{
return
humidCountSum
;
}
public
void
setHumidCountSum
(
Integer
humidCountSum
)
{
this
.
humidCountSum
=
humidCountSum
;
}
public
Integer
getShockCountSum
()
{
return
shockCountSum
;
}
public
void
setShockCountSum
(
Integer
shockCountSum
)
{
this
.
shockCountSum
=
shockCountSum
;
}
public
Integer
getLeanCountSum
()
{
return
leanCountSum
;
}
public
void
setLeanCountSum
(
Integer
leanCountSum
)
{
this
.
leanCountSum
=
leanCountSum
;
}
public
Integer
getCountSum
()
{
return
countSum
;
}
public
void
setCountSum
(
Integer
countSum
)
{
this
.
countSum
=
countSum
;
}
}
src/main/java/com/example/tdl/domain/vo/ResultCircuitForABBVo.java
View file @
6edba52f
...
@@ -19,6 +19,16 @@ public class ResultCircuitForABBVo {
...
@@ -19,6 +19,16 @@ public class ResultCircuitForABBVo {
private
String
gType
;
private
String
gType
;
private
Long
createTime
;
public
Long
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Long
createTime
)
{
this
.
createTime
=
createTime
;
}
public
String
getTransportationNo
()
{
public
String
getTransportationNo
()
{
return
transportationNo
;
return
transportationNo
;
}
}
...
...
src/main/java/com/example/tdl/mapper/AlarmLogABBMapper.java
0 → 100644
View file @
6edba52f
package
com
.
example
.
tdl
.
mapper
;
import
com.example.tdl.domain.vo.*
;
import
com.example.tdl.entity.AlarmLog
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
@Mapper
public
interface
AlarmLogABBMapper
{
//获取所有的数据
List
<
ResultAlarmLogABBVo
>
getAll
(
@Param
(
"companyNo"
)
String
companyNo
,
@Param
(
"page"
)
Integer
page
,
@Param
(
"rows"
)
Integer
rows
);
Integer
getAllCount
(
@Param
(
"companyNo"
)
String
companyNo
);
List
<
ResultAlarmLogABBVo
>
getByTerm
(
@Param
(
"alarmTermABBVo"
)
AlarmTermABBVo
alarmTermABBVo
,
@Param
(
"page"
)
Integer
page
,
@Param
(
"rows"
)
Integer
rows
);
Integer
getByTermCount
(
AlarmTermABBVo
alarmTermABBVo
);
List
<
ResultAlarmLogABBVo
>
getByTermForDownload
(
AlarmTermABBVo
alarmTermABBVo
);
List
<
ResultAlarmLogCountABBVo
>
getYearCountForLineGraph
();
List
<
ResultAlarmLogCountABBVo
>
getDayCountForLineGraph
();
ResultAlarmLogCountPieGraphVo
getDaySumForPieGraph
();
ResultAlarmLogCountPieGraphVo
getYearSumForPieGraph
();
List
<
ResultAlarmLogHouseCountPieGraphVo
>
getDayHouseSumForPieGraph
();
List
<
ResultAlarmLogHouseCountPieGraphVo
>
getYearHouseSumForPieGraph
();
}
src/main/java/com/example/tdl/service/AlarmLogABBService.java
0 → 100644
View file @
6edba52f
package
com
.
example
.
tdl
.
service
;
import
com.example.tdl.domain.vo.*
;
import
com.example.tdl.entity.AlarmLog
;
import
com.example.tdl.mapper.AlarmLogABBMapper
;
import
com.example.tdl.mapper.AlarmLogMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
@Service
public
class
AlarmLogABBService
{
@Autowired
private
AlarmLogABBMapper
alarmLogABBMapper
;
public
List
<
ResultAlarmLogABBVo
>
getAll
(
String
companyNo
,
Integer
page
,
Integer
rows
){
return
alarmLogABBMapper
.
getAll
(
companyNo
,
page
,
rows
);
}
public
Integer
getAllCount
(
String
companyNo
){
return
alarmLogABBMapper
.
getAllCount
(
companyNo
);
}
public
List
<
ResultAlarmLogABBVo
>
getByTerm
(
AlarmTermABBVo
alarmTermABBVo
,
Integer
page
,
Integer
rows
){
return
alarmLogABBMapper
.
getByTerm
(
alarmTermABBVo
,
page
,
rows
);
}
public
Integer
getByTermCount
(
AlarmTermABBVo
alarmTermABBVo
){
return
alarmLogABBMapper
.
getByTermCount
(
alarmTermABBVo
);
}
public
List
<
ResultAlarmLogABBVo
>
getByTermForDownload
(
AlarmTermABBVo
alarmTermABBVo
){
return
alarmLogABBMapper
.
getByTermForDownload
(
alarmTermABBVo
);
}
public
List
<
ResultAlarmLogCountABBVo
>
getYearCountForLineGraph
(){
return
alarmLogABBMapper
.
getYearCountForLineGraph
();
}
public
List
<
ResultAlarmLogCountABBVo
>
getDayCountForLineGraph
(){
return
alarmLogABBMapper
.
getDayCountForLineGraph
();
}
public
ResultAlarmLogCountPieGraphVo
getDaySumForPieGraph
(){
return
alarmLogABBMapper
.
getDaySumForPieGraph
();
}
public
ResultAlarmLogCountPieGraphVo
getYearSumForPieGraph
(){
return
alarmLogABBMapper
.
getYearSumForPieGraph
();
}
public
List
<
ResultAlarmLogHouseCountPieGraphVo
>
getDayHouseSumForPieGraph
(){
return
alarmLogABBMapper
.
getDayHouseSumForPieGraph
();
}
public
List
<
ResultAlarmLogHouseCountPieGraphVo
>
getYearHouseSumForPieGraph
(){
return
alarmLogABBMapper
.
getYearHouseSumForPieGraph
();
}
}
src/main/java/com/example/tdl/util/AlarmLogForABBExcelUtil.java
0 → 100644
View file @
6edba52f
package
com
.
example
.
tdl
.
util
;
import
com.example.tdl.domain.vo.ResultAlarmLogABBVo
;
import
org.apache.poi.hssf.usermodel.*
;
import
org.apache.poi.hssf.util.HSSFColor
;
import
org.apache.poi.ss.util.CellRangeAddress
;
import
javax.servlet.http.HttpServletResponse
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
* 导出报警日志EXCEL模板
*/
public
class
AlarmLogForABBExcelUtil
{
private
List
<
ResultAlarmLogABBVo
>
resultAlarmLogVos
=
new
ArrayList
<>();
//构造方法,传入要导出的数据
public
AlarmLogForABBExcelUtil
(
List
<
ResultAlarmLogABBVo
>
resultAlarmLogVos
)
{
this
.
resultAlarmLogVos
=
resultAlarmLogVos
;
}
/*
* 导出数据
*/
public
HSSFWorkbook
downloadExcel
()
throws
Exception
{
HSSFWorkbook
workbook
=
new
HSSFWorkbook
();
// 创建工作簿对象
HSSFSheet
sheet
=
workbook
.
createSheet
(
"报警日志数据表"
);
// 创建工作表
HSSFCellStyle
cellTitleStyle
=
getCellTitleStyle
(
workbook
);
HSSFCellStyle
cellStyle
=
getCellStyle
(
workbook
);
HSSFCellStyle
titleStyle
=
getTitleStyle
(
workbook
);
/*
* 创建第一行(标题行)
* */
HSSFRow
rowOne
=
sheet
.
createRow
((
short
)
0
);
HSSFCell
cellOne
=
null
;
//循环创建列
for
(
int
n
=
0
;
n
<
6
;
n
++){
cellOne
=
rowOne
.
createCell
(
n
);
cellOne
.
setCellStyle
(
titleStyle
);
//将标题添加到列中
cellOne
.
setCellValue
(
new
HSSFRichTextString
(
"报 警 日 志 数 据 表"
));
}
//设置行高
rowOne
.
setHeight
((
short
)(
35
*
20
));
//合并单元格(参数1:起始行,参数2:截至行,参数3:起始列,参数4:截至列)
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
0
,
0
,
0
,
6
));
/*
* 创建第二行
* */
HSSFRow
rowTwo
=
sheet
.
createRow
((
short
)
1
);
HSSFCell
cellTwo
=
null
;
cellTwo
=
rowTwo
.
createCell
(
0
);
cellTwo
.
setCellValue
(
"运输编号"
);
cellTwo
.
setCellStyle
(
cellTitleStyle
);
cellTwo
=
rowTwo
.
createCell
(
1
);
cellTwo
.
setCellValue
(
"货物编号"
);
cellTwo
.
setCellStyle
(
cellTitleStyle
);
cellTwo
=
rowTwo
.
createCell
(
2
);
cellTwo
.
setCellValue
(
"传感器序列号"
);
cellTwo
.
setCellStyle
(
cellTitleStyle
);
cellTwo
=
rowTwo
.
createCell
(
3
);
cellTwo
.
setCellValue
(
"描述"
);
cellTwo
.
setCellStyle
(
cellTitleStyle
);
cellTwo
=
rowTwo
.
createCell
(
4
);
cellTwo
.
setCellValue
(
"报警数据"
);
cellTwo
.
setCellStyle
(
cellTitleStyle
);
cellTwo
=
rowTwo
.
createCell
(
5
);
cellTwo
.
setCellValue
(
"报警时间"
);
cellTwo
.
setCellStyle
(
cellTitleStyle
);
cellTwo
=
rowTwo
.
createCell
(
6
);
cellTwo
.
setCellValue
(
"报警参数"
);
cellTwo
.
setCellStyle
(
cellTitleStyle
);
rowTwo
.
setHeight
((
short
)(
30
*
20
));
/*
* 循环创建
* */
int
rowIndex
=
1
;
for
(
int
s
=
0
;
s
<
resultAlarmLogVos
.
size
();
s
++){
//从第4行开始创建
rowIndex
=
rowIndex
+
1
;
//2
HSSFRow
row
=
sheet
.
createRow
(
rowIndex
);
HSSFCell
cell
=
null
;
cell
=
row
.
createCell
(
0
);
cell
.
setCellValue
(
resultAlarmLogVos
.
get
(
s
).
getTransportationNo
());
cell
.
setCellStyle
(
cellStyle
);
cell
=
row
.
createCell
(
1
);
cell
.
setCellValue
(
resultAlarmLogVos
.
get
(
s
).
getCargoNo
());
cell
.
setCellStyle
(
cellStyle
);
cell
=
row
.
createCell
(
2
);
cell
.
setCellValue
(
resultAlarmLogVos
.
get
(
s
).
getTDLSN
());
cell
.
setCellStyle
(
cellStyle
);
cell
=
row
.
createCell
(
3
);
cell
.
setCellValue
(
resultAlarmLogVos
.
get
(
s
).
getDescription
());
cell
.
setCellStyle
(
cellStyle
);
cell
=
row
.
createCell
(
4
);
cell
.
setCellValue
(
resultAlarmLogVos
.
get
(
s
).
getData
());
cell
.
setCellStyle
(
cellStyle
);
cell
=
row
.
createCell
(
5
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
//这个是你要转成后的时间的格式
String
sd
=
sdf
.
format
(
new
Date
(
resultAlarmLogVos
.
get
(
s
).
getAlarmTime
()));
cell
.
setCellValue
(
sd
);
cell
.
setCellStyle
(
cellStyle
);
cell
=
row
.
createCell
(
6
);
cell
.
setCellValue
(
resultAlarmLogVos
.
get
(
s
).
getClassify
());
cell
.
setCellStyle
(
cellStyle
);
row
.
setHeight
((
short
)(
25
*
20
));
}
sheet
.
setColumnWidth
(
0
,
26
*
256
);
sheet
.
setColumnWidth
(
1
,
20
*
256
);
sheet
.
setColumnWidth
(
2
,
20
*
256
);
sheet
.
setColumnWidth
(
3
,
30
*
256
);
sheet
.
setColumnWidth
(
4
,
17
*
256
);
sheet
.
setColumnWidth
(
5
,
25
*
256
);
sheet
.
setColumnWidth
(
6
,
12
*
256
);
return
workbook
;
}
/*
* 标题单元格样式
*/
public
HSSFCellStyle
getTitleStyle
(
HSSFWorkbook
workbook
)
{
// 设置字体
HSSFFont
font
=
workbook
.
createFont
();
//设置字体大小
font
.
setFontHeightInPoints
((
short
)
16
);
//字体加粗
font
.
setBoldweight
(
HSSFFont
.
BOLDWEIGHT_BOLD
);
//设置字体名字
font
.
setFontName
(
"新宋体"
);
//设置样式;
HSSFCellStyle
style
=
workbook
.
createCellStyle
();
//在样式用应用设置的字体;
style
.
setFont
(
font
);
//设置自动换行;
style
.
setWrapText
(
true
);
//设置水平对齐的样式为居中对齐;
style
.
setAlignment
(
HSSFCellStyle
.
ALIGN_CENTER
);
//设置垂直对齐的样式为居中对齐;
style
.
setVerticalAlignment
(
HSSFCellStyle
.
VERTICAL_CENTER
);
return
style
;
}
/*
* 列数据信息单元格样式
*/
public
HSSFCellStyle
getCellTitleStyle
(
HSSFWorkbook
workbook
)
{
HSSFFont
font
=
workbook
.
createFont
();
font
.
setFontHeightInPoints
((
short
)
12
);
font
.
setFontName
(
"Arial"
);
HSSFCellStyle
style
=
workbook
.
createCellStyle
();
style
.
setBorderBottom
(
HSSFCellStyle
.
BORDER_THIN
);
style
.
setBottomBorderColor
(
HSSFColor
.
BLACK
.
index
);
style
.
setBorderLeft
(
HSSFCellStyle
.
BORDER_THIN
);
style
.
setLeftBorderColor
(
HSSFColor
.
BLACK
.
index
);
style
.
setBorderRight
(
HSSFCellStyle
.
BORDER_THIN
);
//设置右边框颜色;
style
.
setRightBorderColor
(
HSSFColor
.
BLACK
.
index
);
//设置顶边框;
style
.
setBorderTop
(
HSSFCellStyle
.
BORDER_THIN
);
//设置顶边框颜色;
style
.
setTopBorderColor
(
HSSFColor
.
BLACK
.
index
);
//在样式用应用设置的字体;
style
.
setFont
(
font
);
//设置自动换行;
style
.
setWrapText
(
true
);
//设置水平对齐的样式为居中对齐;
style
.
setAlignment
(
HSSFCellStyle
.
ALIGN_CENTER
);
//设置垂直对齐的样式为居中对齐;
style
.
setVerticalAlignment
(
HSSFCellStyle
.
VERTICAL_CENTER
);
return
style
;
}
/*
* 列数据信息单元格样式
*/
public
HSSFCellStyle
getCellStyle
(
HSSFWorkbook
workbook
)
{
HSSFFont
font
=
workbook
.
createFont
();
font
.
setFontHeightInPoints
((
short
)
11
);
font
.
setFontName
(
"Arial"
);
HSSFCellStyle
style
=
workbook
.
createCellStyle
();
style
.
setBorderBottom
(
HSSFCellStyle
.
BORDER_THIN
);
style
.
setBottomBorderColor
(
HSSFColor
.
BLACK
.
index
);
style
.
setBorderLeft
(
HSSFCellStyle
.
BORDER_THIN
);
style
.
setLeftBorderColor
(
HSSFColor
.
BLACK
.
index
);
style
.
setBorderRight
(
HSSFCellStyle
.
BORDER_THIN
);
//设置右边框颜色;
style
.
setRightBorderColor
(
HSSFColor
.
BLACK
.
index
);
//设置顶边框;
style
.
setBorderTop
(
HSSFCellStyle
.
BORDER_THIN
);
//设置顶边框颜色;
style
.
setTopBorderColor
(
HSSFColor
.
BLACK
.
index
);
//在样式用应用设置的字体;
style
.
setFont
(
font
);
//设置自动换行;
style
.
setWrapText
(
true
);
//设置水平对齐的样式为居中对齐;
style
.
setAlignment
(
HSSFCellStyle
.
ALIGN_CENTER
);
//设置垂直对齐的样式为居中对齐;
style
.
setVerticalAlignment
(
HSSFCellStyle
.
VERTICAL_CENTER
);
return
style
;
}
}
\ No newline at end of file
src/main/java/com/example/tdl/util/AliyunOSSClientUtil.java
View file @
6edba52f
...
@@ -40,6 +40,8 @@ public class AliyunOSSClientUtil {
...
@@ -40,6 +40,8 @@ public class AliyunOSSClientUtil {
private
static
String
FOLDER6
;
private
static
String
FOLDER6
;
private
static
String
FOLDER7
;
private
static
CannedAccessControlList
acl_pub_readwrite
=
CannedAccessControlList
.
PublicReadWrite
;
private
static
CannedAccessControlList
acl_pub_readwrite
=
CannedAccessControlList
.
PublicReadWrite
;
//初始化属性
//初始化属性
...
@@ -54,6 +56,7 @@ public class AliyunOSSClientUtil {
...
@@ -54,6 +56,7 @@ public class AliyunOSSClientUtil {
FOLDER4
=
OSSClientConstants
.
FOLDER4
;
FOLDER4
=
OSSClientConstants
.
FOLDER4
;
FOLDER5
=
OSSClientConstants
.
FOLDER5
;
FOLDER5
=
OSSClientConstants
.
FOLDER5
;
FOLDER6
=
OSSClientConstants
.
FOLDER6
;
FOLDER6
=
OSSClientConstants
.
FOLDER6
;
FOLDER7
=
OSSClientConstants
.
FOLDER7
;
}
}
public
static
String
getENDPOINT
()
{
public
static
String
getENDPOINT
()
{
...
@@ -136,6 +139,14 @@ public class AliyunOSSClientUtil {
...
@@ -136,6 +139,14 @@ public class AliyunOSSClientUtil {
AliyunOSSClientUtil
.
FOLDER6
=
FOLDER6
;
AliyunOSSClientUtil
.
FOLDER6
=
FOLDER6
;
}
}
public
static
String
getFOLDER7
()
{
return
FOLDER7
;
}
public
static
void
setFOLDER7
(
String
FOLDER7
)
{
AliyunOSSClientUtil
.
FOLDER7
=
FOLDER7
;
}
/**
/**
* 获取阿里云OSS客户端对象
* 获取阿里云OSS客户端对象
* @return ossClient
* @return ossClient
...
@@ -268,9 +279,11 @@ public class AliyunOSSClientUtil {
...
@@ -268,9 +279,11 @@ public class AliyunOSSClientUtil {
}
else
if
(
"truck"
.
equals
(
imageType
)){
}
else
if
(
"truck"
.
equals
(
imageType
)){
key
=
FOLDER3
+
key
;
key
=
FOLDER3
+
key
;
}
else
if
(
"warehouse"
.
equals
(
imageType
)){
}
else
if
(
"warehouse"
.
equals
(
imageType
)){
key
=
FOLDER
4
+
key
;
key
=
FOLDER
5
+
key
;
}
else
if
(
"circuit"
.
equals
(
imageType
)){
}
else
if
(
"circuit"
.
equals
(
imageType
)){
key
=
FOLDER4
+
key
;
key
=
FOLDER6
+
key
;
}
else
if
(
"alarmLogABB"
.
equals
(
imageType
)){
key
=
FOLDER7
+
key
;
}
}
PutObjectResult
putResult
=
ossClient
.
putObject
(
BACKET_NAME
,
key
,
instream
,
objectMetadata
);
PutObjectResult
putResult
=
ossClient
.
putObject
(
BACKET_NAME
,
key
,
instream
,
objectMetadata
);
ret
=
putResult
.
getETag
();
ret
=
putResult
.
getETag
();
...
@@ -379,6 +392,8 @@ public class AliyunOSSClientUtil {
...
@@ -379,6 +392,8 @@ public class AliyunOSSClientUtil {
putResult
=
ossClient
.
putObject
(
BACKET_NAME
,
FOLDER6
+
fileName
,
is
,
metadata
);
putResult
=
ossClient
.
putObject
(
BACKET_NAME
,
FOLDER6
+
fileName
,
is
,
metadata
);
}
else
if
(
fileName
.
contains
(
"仓库温湿度观测记录"
)
||
fileName
.
contains
(
"Warehouse temperature and humidity historic data"
)||
fileName
.
contains
(
"倉庫の温度および湿度の観測記録"
)){
}
else
if
(
fileName
.
contains
(
"仓库温湿度观测记录"
)
||
fileName
.
contains
(
"Warehouse temperature and humidity historic data"
)||
fileName
.
contains
(
"倉庫の温度および湿度の観測記録"
)){
putResult
=
ossClient
.
putObject
(
BACKET_NAME
,
FOLDER5
+
fileName
,
is
,
metadata
);
putResult
=
ossClient
.
putObject
(
BACKET_NAME
,
FOLDER5
+
fileName
,
is
,
metadata
);
}
else
if
(
fileName
.
contains
(
"报警日志数据"
)){
putResult
=
ossClient
.
putObject
(
BACKET_NAME
,
FOLDER7
+
fileName
,
is
,
metadata
);
}
else
{
}
else
{
putResult
=
ossClient
.
putObject
(
BACKET_NAME
,
FOLDER1
+
fileName
,
is
,
metadata
);
putResult
=
ossClient
.
putObject
(
BACKET_NAME
,
FOLDER1
+
fileName
,
is
,
metadata
);
}
}
...
...
src/main/java/com/example/tdl/util/OSSClientConstants.java
View file @
6edba52f
...
@@ -30,6 +30,8 @@ public class OSSClientConstants {
...
@@ -30,6 +30,8 @@ public class OSSClientConstants {
public
static
final
String
FOLDER6
=
"circuit/"
;
//线路数据下载
public
static
final
String
FOLDER6
=
"circuit/"
;
//线路数据下载
public
static
final
String
FOLDER7
=
"abbAlarm/"
;
//线路数据下载
//公共读写
//公共读写
private
static
final
CannedAccessControlList
acl_pub_readwrite
=
CannedAccessControlList
.
PublicReadWrite
;
private
static
final
CannedAccessControlList
acl_pub_readwrite
=
CannedAccessControlList
.
PublicReadWrite
;
...
...
src/main/java/com/example/tdl/web/AlarmLogABBController.java
0 → 100644
View file @
6edba52f
package
com
.
example
.
tdl
.
web
;
import
com.aliyun.oss.OSSClient
;
import
com.example.tdl.common.CommonExcel
;
import
com.example.tdl.domain.dto.CommFeedback
;
import
com.example.tdl.domain.vo.*
;
import
com.example.tdl.service.*
;
import
com.example.tdl.service.redis.TokenRedisService
;
import
com.example.tdl.util.AlarmLogForABBExcelUtil
;
import
com.example.tdl.util.AliyunOSSClientUtil
;
import
com.example.tdl.util.ZipCompressUtil
;
import
com.google.gson.Gson
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.influxdb.dto.Query
;
import
org.influxdb.dto.QueryResult
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.OutputStream
;
import
java.util.ArrayList
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/alarmLogABB"
)
public
class
AlarmLogABBController
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
AlarmLogABBController
.
class
);
Gson
gson
=
new
Gson
();
CommFeedback
fb
=
new
CommFeedback
();
@Autowired
private
AlarmLogABBService
alarmLogABBService
;
@Autowired
private
TokenRedisService
tokenRedisService
;
@Autowired
private
CompanyService
companyService
;
@Autowired
private
I18nController
i18n
;
//获取ABB所有报警记录
@ApiOperation
(
value
=
"获取ABB所有报警记录"
,
notes
=
"获取ABB所有报警记录,"
+
"返回值:"
+
" transportationNo:运输编号,"
+
" cargoNo:货号,"
+
" TDLSN:传感器编号,"
+
" description:报警内容,"
+
" data:报警数据,"
+
" alarmTime:报警时间,"
+
" classify:报警参数"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"AccountLanguage"
,
value
=
"language"
,
required
=
false
,
dataType
=
"String"
),
})
@GetMapping
(
"/getAll"
)
public
Object
getAll
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
value
=
"rows"
,
defaultValue
=
"10"
)
Integer
rows
,
HttpServletRequest
request
){
UserRedisVo
user
=
gson
.
fromJson
(
tokenRedisService
.
get
(
"TOKEN_"
+
request
.
getHeader
(
"Account_token"
)),
UserRedisVo
.
class
);
List
<
ResultAlarmLogABBVo
>
resultAlarmLogABBVos
=
alarmLogABBService
.
getAll
(
user
.
getCompanyNo
(),
(
page
-
1
)*
rows
,
rows
);
Integer
num
=
alarmLogABBService
.
getAllCount
(
user
.
getCompanyNo
());
EasyUIResult
easyUIResult
=
new
EasyUIResult
(
num
,
resultAlarmLogABBVos
);
return
ResponseEntity
.
ok
(
easyUIResult
);
}
//根据条件查询ABB所有报警记录
@ApiOperation
(
value
=
"根据条件查询ABB所有报警记录"
,
notes
=
"根据条件查询ABB所有报警记录,传值说明:"
+
" classify:报警内容,"
+
" startTime:出发时间(时间戳),"
+
" endTime:结束时间(时间戳),"
+
"返回值:"
+
" transportationNo:运输编号,"
+
" cargoNo:货号,"
+
" TDLSN:传感器编号,"
+
" description:报警内容,"
+
" data:报警数据,"
+
" alarmTime:报警时间,"
+
" classify:报警参数"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"AccountLanguage"
,
value
=
"language"
,
required
=
false
,
dataType
=
"String"
),
})
@PostMapping
(
"/getByTerm"
)
public
Object
getByTerm
(
@RequestBody
AlarmTermABBVo
alarmTermABBVo
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
value
=
"rows"
,
defaultValue
=
"10"
)
Integer
rows
,
HttpServletRequest
request
){
UserRedisVo
user
=
gson
.
fromJson
(
tokenRedisService
.
get
(
"TOKEN_"
+
request
.
getHeader
(
"Account_token"
)),
UserRedisVo
.
class
);
if
(
StringUtils
.
isEmpty
(
alarmTermABBVo
.
getClassify
())){
alarmTermABBVo
.
setClassify
(
null
);
}
if
(
alarmTermABBVo
.
getStartTime
()==
null
){
alarmTermABBVo
.
setStartTime
(
null
);
}
if
(
alarmTermABBVo
.
getEndTime
()==
null
){
alarmTermABBVo
.
setEndTime
(
null
);
}
alarmTermABBVo
.
setCompanyNo
(
user
.
getCompanyNo
());
List
<
ResultAlarmLogABBVo
>
resultAlarmLogABBVos
=
alarmLogABBService
.
getByTerm
(
alarmTermABBVo
,
(
page
-
1
)*
rows
,
rows
);
Integer
num
=
alarmLogABBService
.
getByTermCount
(
alarmTermABBVo
);
EasyUIResult
easyUIResult
=
new
EasyUIResult
(
num
,
resultAlarmLogABBVos
);
return
ResponseEntity
.
ok
(
easyUIResult
);
}
//获取近30天的柱状图数据
@ApiOperation
(
value
=
"获取近30天的柱状图数据"
,
notes
=
"获取近30天的柱状图数据"
+
"返回值:"
+
" dates:运输编号,"
+
" tempCountSum:货号,"
+
" humidCountSum:传感器编号,"
+
" shockCountSum:报警内容,"
+
" leanCountSum:报警数据,"
+
" countSum:报警时间"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"AccountLanguage"
,
value
=
"language"
,
required
=
false
,
dataType
=
"String"
),
})
@PostMapping
(
"/getCountForLineGraphForDay"
)
public
Object
getCountForLineGraphForDay
(){
List
<
ResultAlarmLogCountABBVo
>
resultAlarmLogABBVos
=
alarmLogABBService
.
getDayCountForLineGraph
();
return
resultAlarmLogABBVos
;
}
//获取近一年的柱状图数据
@ApiOperation
(
value
=
"获取近一年的柱状图数据"
,
notes
=
"获取近一年的柱状图数据"
+
"返回值:"
+
" dates:运输编号,"
+
" tempCountSum:货号,"
+
" humidCountSum:传感器编号,"
+
" shockCountSum:报警内容,"
+
" leanCountSum:报警数据,"
+
" countSum:报警时间"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"AccountLanguage"
,
value
=
"language"
,
required
=
false
,
dataType
=
"String"
),
})
@PostMapping
(
"/getCountForLineGraphForYear"
)
public
Object
getCountForLineGraphForYear
(){
List
<
ResultAlarmLogCountABBVo
>
resultAlarmLogABBVos
=
alarmLogABBService
.
getYearCountForLineGraph
();
return
resultAlarmLogABBVos
;
}
//获取近30天的饼图数据--报警类型占比
@ApiOperation
(
value
=
"获取近30天的饼图数据--报警类型占比"
,
notes
=
"获取近30天的饼图数据--报警类型占比"
+
"返回值:"
+
" tempCountSum:货号,"
+
" humidCountSum:传感器编号,"
+
" shockCountSum:报警内容,"
+
" leanCountSum:报警数据,"
+
" countSum:报警时间"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"AccountLanguage"
,
value
=
"language"
,
required
=
false
,
dataType
=
"String"
),
})
@PostMapping
(
"/getTypeCountForPieGraphForDay"
)
public
Object
getTypeCountForPieGraphForDay
(){
ResultAlarmLogCountPieGraphVo
resultAlarmLogCountPieGraphVo
=
alarmLogABBService
.
getDaySumForPieGraph
();
return
resultAlarmLogCountPieGraphVo
;
}
//获取近一年的饼图数据--报警类型占比
@ApiOperation
(
value
=
"获取近一年的饼图数据--报警类型占比"
,
notes
=
"获取近一年的饼图数据--报警类型占比"
+
"返回值:"
+
" tempCountSum:货号,"
+
" humidCountSum:传感器编号,"
+
" shockCountSum:报警内容,"
+
" leanCountSum:报警数据,"
+
" countSum:报警时间"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"AccountLanguage"
,
value
=
"language"
,
required
=
false
,
dataType
=
"String"
),
})
@PostMapping
(
"/getTypeCountForPieGraphForYear"
)
public
Object
getTypeCountForPieGraphForYear
(){
ResultAlarmLogCountPieGraphVo
resultAlarmLogCountPieGraphVo
=
alarmLogABBService
.
getYearSumForPieGraph
();
return
resultAlarmLogCountPieGraphVo
;
}
//获取近30天的饼图数据--报警时间段占比
@ApiOperation
(
value
=
"获取近30天的饼图数据--报警时间段占比"
,
notes
=
"获取近30天的饼图数据--报警时间段占比"
+
"返回值:"
+
" house:小时,"
+
" tempCountSum:货号,"
+
" humidCountSum:传感器编号,"
+
" shockCountSum:报警内容,"
+
" leanCountSum:报警数据,"
+
" countSum:报警时间"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"AccountLanguage"
,
value
=
"language"
,
required
=
false
,
dataType
=
"String"
),
})
@PostMapping
(
"/getTimeCountForPieGraphForDay"
)
public
Object
getTimeCountForPieGraphForDay
(){
List
<
ResultAlarmLogHouseCountPieGraphVo
>
resultAlarmLogHouseCountPieGraphVos
=
alarmLogABBService
.
getDayHouseSumForPieGraph
();
return
resultAlarmLogHouseCountPieGraphVos
;
}
//获取近一年的饼图数据--报警时间段占比
@ApiOperation
(
value
=
"获取近一年的饼图数据--报警时间段占比"
,
notes
=
"获取近一年的饼图数据--报警时间段占比"
+
"返回值:"
+
" house:小时,"
+
" tempCountSum:货号,"
+
" humidCountSum:传感器编号,"
+
" shockCountSum:报警内容,"
+
" leanCountSum:报警数据,"
+
" countSum:报警时间"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"AccountLanguage"
,
value
=
"language"
,
required
=
false
,
dataType
=
"String"
),
})
@PostMapping
(
"/getTimeCountForPieGraphForYear"
)
public
Object
getTimeCountForPieGraphForYear
(){
List
<
ResultAlarmLogHouseCountPieGraphVo
>
resultAlarmLogHouseCountPieGraphVos
=
alarmLogABBService
.
getYearHouseSumForPieGraph
();
return
resultAlarmLogHouseCountPieGraphVos
;
}
//报警记录下载
@ApiOperation
(
value
=
"报警记录下载"
,
notes
=
"报警记录下载"
+
" classify:报警内容,"
+
" startTime:出发时间(时间戳),"
+
" endTime:结束时间(时间戳)"
)
@RequestMapping
(
value
=
"/downloadExcel"
,
method
=
RequestMethod
.
POST
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"AccountLanguage"
,
value
=
"language"
,
required
=
false
,
dataType
=
"String"
),
})
public
Object
downloadExcel
(
@RequestBody
AlarmTermABBVo
alarmTermABBVo
,
HttpServletRequest
request
,
HttpServletResponse
response
){
UserRedisVo
user
=
gson
.
fromJson
(
tokenRedisService
.
get
(
"TOKEN_"
+
request
.
getHeader
(
"Account_token"
)),
UserRedisVo
.
class
);
if
(
StringUtils
.
isEmpty
(
alarmTermABBVo
.
getClassify
())){
alarmTermABBVo
.
setClassify
(
null
);
}
if
(
alarmTermABBVo
.
getStartTime
()==
null
||
alarmTermABBVo
.
getStartTime
()==
0
){
alarmTermABBVo
.
setStartTime
(
null
);
}
if
(
alarmTermABBVo
.
getEndTime
()==
null
||
alarmTermABBVo
.
getEndTime
()==
0
){
alarmTermABBVo
.
setEndTime
(
null
);
}
if
(
alarmTermABBVo
.
getEndTime
()!=
null
&&
alarmTermABBVo
.
getStartTime
()!=
null
&&
alarmTermABBVo
.
getEndTime
()
<
alarmTermABBVo
.
getStartTime
()){
fb
.
setCode
(
0
);
fb
.
setMessage
(
"开始时间不能大于结束时间"
);
return
gson
.
toJson
(
fb
);
}
alarmTermABBVo
.
setCompanyNo
(
user
.
getCompanyNo
());
List
<
ResultAlarmLogABBVo
>
resultAlarmLogVos
=
alarmLogABBService
.
getByTermForDownload
(
alarmTermABBVo
);
if
(
resultAlarmLogVos
.
size
()>
0
){
String
fileName
=
"报警日志数据-"
+
System
.
currentTimeMillis
();
String
fileAddress
=
"E:/download"
;
File
f
=
new
File
(
fileAddress
);
if
(!
f
.
exists
()){
f
.
mkdir
();
}
File
file
=
new
File
(
fileAddress
+
"/"
+
fileName
);
AlarmLogForABBExcelUtil
alarmLogForABBExcelUtil
=
new
AlarmLogForABBExcelUtil
(
resultAlarmLogVos
);
try
{
HSSFWorkbook
workbook
=
alarmLogForABBExcelUtil
.
downloadExcel
();
if
(
workbook
!=
null
){
request
.
setCharacterEncoding
(
"utf-8"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setContentType
(
"application/vnd.ms-excel"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment; filename="
+
fileName
);
OutputStream
os
=
new
FileOutputStream
(
new
File
(
file
+
".xls"
));
workbook
.
write
(
os
);
os
.
flush
();
os
.
close
();
ZipCompressUtil
zipCom
=
new
ZipCompressUtil
(
file
+
".zip"
,
file
+
".xls"
);
zipCom
.
zip
();
OSSClient
ossClient
=
AliyunOSSClientUtil
.
getOSSClient
();
String
resultStr
=
AliyunOSSClientUtil
.
uploadObject2OSS
(
ossClient
,
new
File
(
file
+
".zip"
));
if
(
new
File
(
file
+
".xls"
).
delete
()){
fb
.
setCode
(
1
);
fb
.
setMessage
(
"https://tdlcloud.oss-cn-shanghai.aliyuncs.com/abbAlarm/"
+
fileName
+
".zip"
);
return
gson
.
toJson
(
fb
);
}
else
{
fb
.
setCode
(
0
);
fb
.
setMessage
(
"下载失败"
);
return
gson
.
toJson
(
fb
);
}
}
else
{
fb
.
setCode
(
0
);
fb
.
setMessage
(
"下载失败"
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
fb
.
setCode
(
0
);
fb
.
setMessage
(
"下载失败"
);
}
}
else
{
fb
.
setCode
(
0
);
fb
.
setMessage
(
"没有数据可以下载"
);
}
return
gson
.
toJson
(
fb
);
}
}
src/main/resources/application.properties
View file @
6edba52f
spring.datasource.url
=
jdbc:mysql://
47.110.153.44
:3306/tdlcloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.url
=
jdbc:mysql://
localhost
:3306/tdlcloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username
=
root
spring.datasource.username
=
root
spring.datasource.password
=
37774020
spring.datasource.password
=
root
spring.datasource.driver-class-name
=
com.mysql.jdbc.Driver
spring.datasource.driver-class-name
=
com.mysql.jdbc.Driver
threadpool.corepoolsize
=
30
threadpool.corepoolsize
=
30
threadpool.maxpoolsize
=
50
threadpool.maxpoolsize
=
50
server.port
=
8
092
server.port
=
8
888
management.security.enabled
=
false
management.security.enabled
=
false
...
...
src/main/resources/mapper/AlarmLogABBMapper.xml
0 → 100644
View file @
6edba52f
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.example.tdl.mapper.AlarmLogABBMapper"
>
<!--获取所有的报警数据-->
<select
id=
"getAll"
resultType=
"com.example.tdl.domain.vo.ResultAlarmLogABBVo"
>
select a.transportationNo,cargoNo,TDLSN,description,ifnull(`data`,"") `data`,alarmTime,classify
from alarm_log a INNER JOIN circuit c ON a.transportationNo=c.transportationNo
INNER JOIN company co ON c.company_id = co.id
WHERE co.companyNo=#{companyNo,jdbcType=VARCHAR} order by a.alarmTime DESC
LIMIT #{page,jdbcType=INTEGER},#{rows,jdbcType=INTEGER}
</select>
<select
id=
"getAllCount"
resultType=
"java.lang.Integer"
parameterType=
"String"
>
select COUNT(a.id) from alarm_log a INNER JOIN circuit c ON a.transportationNo=c.transportationNo
INNER JOIN company co ON c.company_id = co.id
WHERE co.companyNo=#{companyNo,jdbcType=VARCHAR}
</select>
<select
id=
"getByTerm"
resultType=
"com.example.tdl.domain.vo.ResultAlarmLogABBVo"
>
select a.transportationNo,cargoNo,TDLSN,description,ifnull(`data`,"") `data`,alarmTime,classify
from alarm_log a INNER JOIN circuit c ON a.transportationNo=c.transportationNo
INNER JOIN company co ON c.company_id = co.id
WHERE co.companyNo=#{alarmTermABBVo.companyNo,jdbcType=VARCHAR}
<if
test=
"alarmTermABBVo.classify!=null"
>
AND a.classify=#{alarmTermABBVo.classify,jdbcType=VARCHAR}
</if>
<if
test=
"alarmTermABBVo.startTime!=null and alarmTermABBVo.endTime!=null"
>
AND a.alarmTime BETWEEN #{alarmTermABBVo.startTime,jdbcType=BIGINT} AND #{alarmTermABBVo.endTime,jdbcType=BIGINT}
</if>
order by a.alarmTime DESC
LIMIT #{page,jdbcType=INTEGER},#{rows,jdbcType=INTEGER}
</select>
<select
id=
"getByTermCount"
parameterType=
"com.example.tdl.domain.vo.AlarmTermABBVo"
resultType=
"java.lang.Integer"
>
select COUNT(a.id) from alarm_log a INNER JOIN circuit c ON a.transportationNo=c.transportationNo
INNER JOIN company co ON c.company_id = co.id
WHERE co.companyNo=#{companyNo,jdbcType=VARCHAR}
<if
test=
"classify!=null"
>
AND a.classify=#{classify,jdbcType=VARCHAR}
</if>
<if
test=
"startTime!=null and endTime!=null"
>
AND a.alarmTime BETWEEN #{startTime,jdbcType=BIGINT} AND #{endTime,jdbcType=BIGINT}
</if>
</select>
<select
id=
"getByTermForDownload"
resultType=
"com.example.tdl.domain.vo.ResultAlarmLogABBVo"
parameterType=
"com.example.tdl.domain.vo.AlarmTermABBVo"
>
select a.transportationNo,cargoNo,TDLSN,description,ifnull(`data`,"") `data`,alarmTime,classify
from alarm_log a INNER JOIN circuit c ON a.transportationNo=c.transportationNo
INNER JOIN company co ON c.company_id = co.id
WHERE co.companyNo=#{companyNo,jdbcType=VARCHAR}
<if
test=
"classify!=null"
>
AND a.classify=#{classify,jdbcType=VARCHAR}
</if>
<if
test=
"startTime!=null and endTime!=null"
>
AND a.alarmTime BETWEEN #{startTime,jdbcType=BIGINT} AND #{endTime,jdbcType=BIGINT}
</if>
order by a.alarmTime DESC
</select>
<select
id=
"getYearCountForLineGraph"
resultType=
"com.example.tdl.domain.vo.ResultAlarmLogCountABBVo"
>
SELECT @a :=@a+1 indexs,CONCAT_WS(" ~ ",ADDDATE(CURRENT_DATE,INTERVAL @a-1 MONTH),ADDDATE(CURRENT_DATE,INTERVAL @a MONTH)) dates,
(SELECT IFNULL(SUM(a.tempCount) ,0) FROM alarm_count_abb a WHERE a.`date` BETWEEN ADDDATE(CURRENT_DATE,INTERVAL @a-1 MONTH)
AND ADDDATE(CURRENT_DATE,INTERVAL @a MONTH)) tempCountSum,
(SELECT IFNULL(SUM(a.humidCount) ,0) FROM alarm_count_abb a WHERE a.`date` BETWEEN ADDDATE(CURRENT_DATE,INTERVAL @a-1 MONTH)
AND ADDDATE(CURRENT_DATE,INTERVAL @a MONTH)) humidCountSum,
(SELECT IFNULL(SUM(a.shockCount) ,0) FROM alarm_count_abb a WHERE a.`date` BETWEEN ADDDATE(CURRENT_DATE,INTERVAL @a-1 MONTH)
AND ADDDATE(CURRENT_DATE,INTERVAL @a MONTH)) shockCountSum,
(SELECT IFNULL(SUM(a.leanCount) ,0) FROM alarm_count_abb a WHERE a.`date` BETWEEN ADDDATE(CURRENT_DATE,INTERVAL @a-1 MONTH)
AND ADDDATE(CURRENT_DATE,INTERVAL @a MONTH)) leanCountSum,
(SELECT IFNULL(SUM(a.sum) ,0) FROM alarm_count_abb a WHERE a.`date` BETWEEN ADDDATE(CURRENT_DATE,INTERVAL @a-1 MONTH)
AND ADDDATE(CURRENT_DATE,INTERVAL @a MONTH)) countSum
from mysql.help_topic, (SELECT @a :=-12 ) temp
WHERE @a
<
0;
</select>
<select
id=
"getDayCountForLineGraph"
resultType=
"com.example.tdl.domain.vo.ResultAlarmLogCountABBVo"
>
SELECT @a := @a +1 indexs,ADDDATE(CURRENT_DATE,INTERVAL @a DAY) dates,
(SELECT IFNULL(SUM(a.tempCount),0) FROM alarm_count_abb a WHERE a.`date`=ADDDATE(CURRENT_DATE,INTERVAL @a DAY)) tempCountSum,
(SELECT IFNULL(SUM(a.humidCount),0) FROM alarm_count_abb a WHERE a.`date`=ADDDATE(CURRENT_DATE,INTERVAL @a DAY)) humidCountSum,
(SELECT IFNULL(SUM(a.shockCount),0) FROM alarm_count_abb a WHERE a.`date`=ADDDATE(CURRENT_DATE,INTERVAL @a DAY)) shockCountSum,
(SELECT IFNULL(SUM(a.leanCount),0) FROM alarm_count_abb a WHERE a.`date`=ADDDATE(CURRENT_DATE,INTERVAL @a DAY)) leanCountSum,
(SELECT IFNULL(SUM(a.sum),0) FROM alarm_count_abb a WHERE a.`date`=ADDDATE(CURRENT_DATE,INTERVAL @a DAY)) countSum
from mysql.help_topic,(SELECT @a :=-30) temp
WHERE @a
<
0;
</select>
<select
id=
"getDaySumForPieGraph"
resultType=
"com.example.tdl.domain.vo.ResultAlarmLogCountPieGraphVo"
>
SELECT IFNULL(SUM(a.tempCount),0) tempCountSum,IFNULL(SUM(a.humidCount),0) humidCountSum,IFNULL(SUM(a.shockCount),0) shockCountSum,
IFNULL(SUM(a.leanCount),0) leanCountSum,IFNULL(SUM(a.sum),0) countSum
FROM alarm_count_abb a WHERE a.`date` BETWEEN ADDDATE(CURRENT_DATE,INTERVAL -30 DAY) AND CURRENT_DATE
</select>
<select
id=
"getYearSumForPieGraph"
resultType=
"com.example.tdl.domain.vo.ResultAlarmLogCountPieGraphVo"
>
SELECT IFNULL(SUM(a.tempCount),0) tempCountSum,IFNULL(SUM(a.humidCount),0) humidCountSum,IFNULL(SUM(a.shockCount),0) shockCountSum,
IFNULL(SUM(a.leanCount),0) leanCountSum,IFNULL(SUM(a.sum),0) countSum
FROM alarm_count_abb a WHERE a.`date` BETWEEN ADDDATE(CURRENT_DATE,INTERVAL -1 YEAR) AND CURRENT_DATE
</select>
<select
id=
"getDayHouseSumForPieGraph"
resultType=
"com.example.tdl.domain.vo.ResultAlarmLogHouseCountPieGraphVo"
>
SELECT @a := @a +1 house,
(SELECT IFNULL(SUM(a.tempCount),0) FROM alarm_count_abb a WHERE a.`date` BETWEEN ADDDATE(CURRENT_DATE,INTERVAL -30 DAY)
AND CURRENT_DATE AND house=@a) tempCountSum,
(SELECT IFNULL(SUM(a.humidCount),0) FROM alarm_count_abb a WHERE a.`date` BETWEEN ADDDATE(CURRENT_DATE,INTERVAL -30 DAY)
AND CURRENT_DATE AND house=@a) humidCountSum,
(SELECT IFNULL(SUM(a.shockCount),0) FROM alarm_count_abb a WHERE a.`date` BETWEEN ADDDATE(CURRENT_DATE,INTERVAL -30 DAY)
AND CURRENT_DATE AND house=@a) shockCountSum,
(SELECT IFNULL(SUM(a.leanCount),0) FROM alarm_count_abb a WHERE a.`date` BETWEEN ADDDATE(CURRENT_DATE,INTERVAL -30 DAY)
AND CURRENT_DATE AND house=@a) leanCountSum,
(SELECT IFNULL(SUM(a.sum),0) FROM alarm_count_abb a WHERE a.`date` BETWEEN ADDDATE(CURRENT_DATE,INTERVAL -30 DAY)
AND CURRENT_DATE AND house=@a) countSum
from mysql.help_topic,(SELECT @a :=0) temp
WHERE @a
<
24;
</select>
<select
id=
"getYearHouseSumForPieGraph"
resultType=
"com.example.tdl.domain.vo.ResultAlarmLogHouseCountPieGraphVo"
>
SELECT @a := @a +1 house,
(SELECT IFNULL(SUM(a.tempCount) ,0) FROM alarm_count_abb a WHERE a.`date` BETWEEN ADDDATE(CURRENT_DATE,INTERVAL -1 YEAR)
AND CURRENT_DATE AND house=@a) tempCountSum,
(SELECT IFNULL(SUM(a.humidCount) ,0) FROM alarm_count_abb a WHERE a.`date` BETWEEN ADDDATE(CURRENT_DATE,INTERVAL -1 YEAR)
AND CURRENT_DATE AND house=@a) humidCountSum,
(SELECT IFNULL(SUM(a.shockCount) ,0) FROM alarm_count_abb a WHERE a.`date` BETWEEN ADDDATE(CURRENT_DATE,INTERVAL -1 YEAR)
AND CURRENT_DATE AND house=@a) shockCountSum,
(SELECT IFNULL(SUM(a.leanCount) ,0) FROM alarm_count_abb a WHERE a.`date` BETWEEN ADDDATE(CURRENT_DATE,INTERVAL -1 YEAR)
AND CURRENT_DATE AND house=@a) leanCountSum,
(SELECT IFNULL(SUM(a.sum) ,0) FROM alarm_count_abb a WHERE a.`date` BETWEEN ADDDATE(CURRENT_DATE,INTERVAL -1 YEAR)
AND CURRENT_DATE AND house=@a) countSum
from mysql.help_topic, (SELECT @a :=0 ) temp
WHERE @a
<
24;
</select>
</mapper>
\ No newline at end of file
src/main/resources/mapper/CircuitABBMapper.xml
View file @
6edba52f
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,(select GROUP_CONCAT(DISTINCT classify)
SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,(select GROUP_CONCAT(DISTINCT classify)
from alarm_log al where al.transportationNo = c.transportationNo) alarm,transportation,
from alarm_log al where al.transportationNo = c.transportationNo) alarm,transportation,
(select DISTINCT gatewaySN from tdl_gateway_log WHERE transportationNo=c.transportationNo) gSN,
(select DISTINCT gatewaySN from tdl_gateway_log WHERE transportationNo=c.transportationNo) gSN,
(select DISTINCT gatewayType from tdl_gateway_log WHERE transportationNo=c.transportationNo) gType
(select DISTINCT gatewayType from tdl_gateway_log WHERE transportationNo=c.transportationNo) gType
,c.createTime
from circuit c
from circuit c
where c.state=1
where c.state=1
AND company_id=(SELECT id from company where companyNo=#{companyNo,jdbcType=VARCHAR})
AND company_id=(SELECT id from company where companyNo=#{companyNo,jdbcType=VARCHAR})
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,(select GROUP_CONCAT(DISTINCT classify)
SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,(select GROUP_CONCAT(DISTINCT classify)
from alarm_log al where al.transportationNo = c.transportationNo) alarm,transportation,
from alarm_log al where al.transportationNo = c.transportationNo) alarm,transportation,
(select DISTINCT gatewaySN from tdl_gateway_log WHERE transportationNo=c.transportationNo) gSN,
(select DISTINCT gatewaySN from tdl_gateway_log WHERE transportationNo=c.transportationNo) gSN,
(select DISTINCT gatewayType from tdl_gateway_log WHERE transportationNo=c.transportationNo) gType
(select DISTINCT gatewayType from tdl_gateway_log WHERE transportationNo=c.transportationNo) gType
,c.createTime
from circuit c
from circuit c
where c.state=1
where c.state=1
AND company_id=(SELECT id from company where companyNo=#{companyNo,jdbcType=VARCHAR})
AND company_id=(SELECT id from company where companyNo=#{companyNo,jdbcType=VARCHAR})
...
@@ -109,7 +109,7 @@
...
@@ -109,7 +109,7 @@
SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,(select GROUP_CONCAT(DISTINCT classify)
SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,(select GROUP_CONCAT(DISTINCT classify)
from alarm_log al where al.transportationNo = c.transportationNo) alarm,transportation,
from alarm_log al where al.transportationNo = c.transportationNo) alarm,transportation,
(select DISTINCT gatewaySN from tdl_gateway_log WHERE transportationNo=c.transportationNo) gSN,
(select DISTINCT gatewaySN from tdl_gateway_log WHERE transportationNo=c.transportationNo) gSN,
(select DISTINCT gatewayType from tdl_gateway_log WHERE transportationNo=c.transportationNo) gType
(select DISTINCT gatewayType from tdl_gateway_log WHERE transportationNo=c.transportationNo) gType
,c.createTime
from circuit c
from circuit c
where c.state=1
where c.state=1
AND c.transportationNo=#{transportationNo,jdbcType=VARCHAR}
AND c.transportationNo=#{transportationNo,jdbcType=VARCHAR}
...
@@ -121,7 +121,7 @@
...
@@ -121,7 +121,7 @@
SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,(select GROUP_CONCAT(DISTINCT classify)
SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,(select GROUP_CONCAT(DISTINCT classify)
from alarm_log al where al.transportationNo = c.transportationNo) alarm,transportation,
from alarm_log al where al.transportationNo = c.transportationNo) alarm,transportation,
(select DISTINCT gatewaySN from tdl_gateway_log WHERE transportationNo=c.transportationNo) gSN,
(select DISTINCT gatewaySN from tdl_gateway_log WHERE transportationNo=c.transportationNo) gSN,
(select DISTINCT gatewayType from tdl_gateway_log WHERE transportationNo=c.transportationNo) gType
(select DISTINCT gatewayType from tdl_gateway_log WHERE transportationNo=c.transportationNo) gType
,c.createTime
from circuit c
from circuit c
where c.state=1
where c.state=1
and c.transportationNo=#{transportationNo,jdbcType=VARCHAR}
and c.transportationNo=#{transportationNo,jdbcType=VARCHAR}
...
@@ -137,7 +137,7 @@
...
@@ -137,7 +137,7 @@
SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,(select GROUP_CONCAT(DISTINCT classify)
SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,(select GROUP_CONCAT(DISTINCT classify)
from alarm_log al where al.transportationNo = c.transportationNo) alarm,transportation,
from alarm_log al where al.transportationNo = c.transportationNo) alarm,transportation,
(select DISTINCT gatewaySN from tdl_gateway_log WHERE transportationNo=c.transportationNo) gSN,
(select DISTINCT gatewaySN from tdl_gateway_log WHERE transportationNo=c.transportationNo) gSN,
(select DISTINCT gatewayType from tdl_gateway_log WHERE transportationNo=c.transportationNo) gType
(select DISTINCT gatewayType from tdl_gateway_log WHERE transportationNo=c.transportationNo) gType
,c.createTime
from circuit c where c.state=1
from circuit c where c.state=1
and c.circuitState = 1
and c.circuitState = 1
AND company_id=(SELECT id from company where companyNo=#{companyNo,jdbcType=VARCHAR})
AND company_id=(SELECT id from company where companyNo=#{companyNo,jdbcType=VARCHAR})
...
...
src/main/resources/mybatis-config.xml
View file @
6edba52f
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
<mapper
resource=
"mapper/ModelMapper.xml"
/>
<mapper
resource=
"mapper/ModelMapper.xml"
/>
<mapper
resource=
"mapper/ModelInfoMapper.xml"
/>
<mapper
resource=
"mapper/ModelInfoMapper.xml"
/>
<mapper
resource=
"mapper/AlarmLogMapper.xml"
/>
<mapper
resource=
"mapper/AlarmLogMapper.xml"
/>
<mapper
resource=
"mapper/AlarmLogABBMapper.xml"
/>
<mapper
resource=
"mapper/ConfigMapper.xml"
/>
<mapper
resource=
"mapper/ConfigMapper.xml"
/>
<mapper
resource=
"mapper/ProbesMapper.xml"
/>
<mapper
resource=
"mapper/ProbesMapper.xml"
/>
<mapper
resource=
"mapper/TopicMapper.xml"
/>
<mapper
resource=
"mapper/TopicMapper.xml"
/>
...
...
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