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
9e1f6b59
Commit
9e1f6b59
authored
Aug 24, 2022
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加物联报表--月分析报表生成pdf接口
parent
0852cbf5
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
683 additions
and
21 deletions
+683
-21
WordTemplateTypeEum.java
...yeejoin/equipmanage/common/enums/WordTemplateTypeEum.java
+4
-1
ChartsUtils.java
...ava/com/yeejoin/equipmanage/common/utils/ChartsUtils.java
+252
-0
ConfigureController.java
...m/yeejoin/equipmanage/controller/ConfigureController.java
+21
-0
FireFightingSystemMapper.java
.../yeejoin/equipmanage/mapper/FireFightingSystemMapper.java
+13
-0
IFireFightingSystemService.java
...ejoin/equipmanage/service/IFireFightingSystemService.java
+3
-0
FireFightingSystemServiceImpl.java
...uipmanage/service/impl/FireFightingSystemServiceImpl.java
+205
-20
iotMonthReport.ftl
...ot-system-equip/src/main/resources/ftl/iotMonthReport.ftl
+0
-0
systemIndex.json
...oot-system-equip/src/main/resources/json/systemIndex.json
+15
-0
FireFightingSystemMapper.xml
...ip/src/main/resources/mapper/FireFightingSystemMapper.xml
+170
-0
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/enums/WordTemplateTypeEum.java
View file @
9e1f6b59
...
...
@@ -12,7 +12,10 @@ public enum WordTemplateTypeEum {
*/
resume
(
"简历"
,
"jianli.ftl"
),
firePatrolReport
(
"消防巡查报表"
,
"FirePatrolReport.ftl"
),
fireAutoSysManageReport
(
"消防自动化综合管理报表"
,
"fireAutoSysManageReport.ftl"
);
fireAutoSysManageReport
(
"消防自动化综合管理报表"
,
"fireAutoSysManageReport.ftl"
),
iotMonthReport
(
"物联报表-月分析报表"
,
"iotMonthReport.ftl"
);
private
String
label
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/utils/ChartsUtils.java
0 → 100644
View file @
9e1f6b59
package
com
.
yeejoin
.
equipmanage
.
common
.
utils
;
import
org.jfree.chart.ChartFactory
;
import
org.jfree.chart.ChartUtilities
;
import
org.jfree.chart.JFreeChart
;
import
org.jfree.chart.axis.CategoryAxis
;
import
org.jfree.chart.axis.NumberAxis
;
import
org.jfree.chart.axis.ValueAxis
;
import
org.jfree.chart.block.BlockBorder
;
import
org.jfree.chart.labels.StandardCategoryItemLabelGenerator
;
import
org.jfree.chart.labels.StandardPieSectionLabelGenerator
;
import
org.jfree.chart.plot.CategoryPlot
;
import
org.jfree.chart.plot.PiePlot
;
import
org.jfree.chart.plot.PlotOrientation
;
import
org.jfree.chart.renderer.category.LineAndShapeRenderer
;
import
org.jfree.data.category.DefaultCategoryDataset
;
import
org.jfree.data.general.DefaultPieDataset
;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Base64
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
/**
* @author lisong
* @date 2022-08-23.
*/
public
class
ChartsUtils
{
public
static
String
pieChart
(
List
<
Map
<
String
,
Object
>>
data
,
String
title
)
{
//如 果不使用Font,中文将显示不出来
Font
font
=
new
Font
(
"新宋体"
,
Font
.
BOLD
,
15
);
// 创建数据:饼状图就是名称和值(比例)
Map
<
String
,
Double
>
map
=
new
HashMap
<
String
,
Double
>();
// for (int i = 0; i < name.size(); i++) {
// map.put(name.get(i), value.get(i));
// }
for
(
Map
<
String
,
Object
>
item
:
data
)
{
map
.
put
(
String
.
valueOf
(
item
.
get
(
"type"
)),
Double
.
parseDouble
(
String
.
valueOf
(
item
.
get
(
"value"
))));
}
// 创建JFreeChart
JFreeChart
chart
=
createPieChart
(
title
,
map
,
font
);
BufferedImage
image
=
chart
.
createBufferedImage
(
600
,
600
);
byte
[]
bytes
=
null
;
try
{
bytes
=
ChartUtilities
.
encodeAsPNG
(
image
);
}
catch
(
IOException
e1
)
{
System
.
out
.
println
(
"生成饼图失败"
);
}
return
Base64
.
getEncoder
().
encodeToString
(
bytes
);
}
private
static
byte
[]
fileToByte
(
File
file
)
{
byte
[]
fileBytes
=
null
;
FileInputStream
fis
=
null
;
try
{
fis
=
new
FileInputStream
(
file
);
fileBytes
=
new
byte
[(
int
)
file
.
length
()];
fis
.
read
(
fileBytes
);
fis
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
fileBytes
;
}
/**
* 生成饼图
*
* @param title
* @param data
* @param font
* @return
*/
public
static
JFreeChart
createPieChart
(
String
title
,
Map
<
String
,
Double
>
data
,
Font
font
)
{
try
{
Set
<
Map
.
Entry
<
String
,
Double
>>
set
=
data
.
entrySet
();
DefaultPieDataset
pds
=
new
DefaultPieDataset
();
Iterator
iterator
=
set
.
iterator
();
Map
.
Entry
entry
;
while
(
iterator
.
hasNext
())
{
entry
=
(
Map
.
Entry
)
iterator
.
next
();
pds
.
setValue
(
entry
.
getKey
().
toString
(),
Double
.
parseDouble
(
entry
.
getValue
().
toString
()));
}
// 生成一个饼图的图表:显示图表的标题、组装的数据、是否显示图例、是否生成贴士以及是否生成URL链接
JFreeChart
chart
=
ChartFactory
.
createPieChart
(
title
,
pds
,
true
,
false
,
true
);
// 设置图片标题的字体
chart
.
getTitle
().
setFont
(
font
);
// 得到图块,准备设置标签的字体
PiePlot
plot
=
(
PiePlot
)
chart
.
getPlot
();
//设置分裂效果,需要指定分裂出去的key
// plot.setExplodePercent("摄像机", 0.1); 分裂效果,可选
// 设置标签字体
plot
.
setLabelFont
(
font
);
// 设置图例项目字体
chart
.
getLegend
().
setItemFont
(
font
);
// 设置开始角度
// plot.setStartAngle(new Float(3.14f / 2f)); 开始角度,意义不大
//设置plot的前景色透明度
plot
.
setForegroundAlpha
(
0.7f
);
//设置plot的背景色透明度
plot
.
setBackgroundAlpha
(
0.0f
);
//设置标签生成器(默认{0})
//{0}:key {1}:value {2}:百分比 {3}:sum
plot
.
setLabelGenerator
(
new
StandardPieSectionLabelGenerator
(
"{0}({1})/{2}"
));
// 一般在{1}后面加单位,如:{0}({1}次)/{2}
//将内存中的图片写到本地硬盘
// ChartUtilities.saveChartAsJPEG(new File("H:/a.png"), chart, 600, 300);
// 标注位于上侧
// chart.getLegend().setPosition(RectangleEdge.TOP);
// 设置标注无边框
chart
.
getLegend
().
setFrame
(
new
BlockBorder
(
Color
.
WHITE
));
return
chart
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
public
static
String
manyLineChart
(
List
<
Map
<
String
,
Object
>>
value
)
{
// 绘图数据集
DefaultCategoryDataset
dataSet
=
new
DefaultCategoryDataset
();
for
(
Map
<
String
,
Object
>
map
:
value
)
{
dataSet
.
setValue
(
Double
.
valueOf
(
String
.
valueOf
(
map
.
get
(
"y"
))),
String
.
valueOf
(
map
.
get
(
"title"
)),
String
.
valueOf
(
map
.
get
(
"x"
)).
substring
(
8
,
10
));
}
JFreeChart
chart
=
createManyLineChart
(
dataSet
);
BufferedImage
image
=
chart
.
createBufferedImage
(
1000
,
800
);
byte
[]
bytes
=
null
;
try
{
bytes
=
ChartUtilities
.
encodeAsPNG
(
image
);
}
catch
(
IOException
e1
)
{
System
.
out
.
println
(
"生成折线图失败"
);
}
return
Base64
.
getEncoder
().
encodeToString
(
bytes
);
}
/**
* 生成折线图 多条
*
* @return
*/
public
static
JFreeChart
createManyLineChart
(
DefaultCategoryDataset
dataSet
)
{
//如果把createLineChart改为createLineChart3D就变为了3D效果的折线图
JFreeChart
chart
=
ChartFactory
.
createLineChart
(
"月报警信息"
,
"日期"
,
"告警数量"
,
dataSet
,
PlotOrientation
.
VERTICAL
,
// 绘制方向
true
,
// 显示图例
true
,
// 采用标准生成器
false
// 是否生成超链接
);
//如 果不使用Font,中文将显示不出来
Font
font
=
new
Font
(
"新宋体"
,
Font
.
BOLD
,
10
);
chart
.
getTitle
().
setFont
(
font
);
// 设置标题字体
chart
.
getLegend
().
setItemFont
(
font
);
// 设置图例类别字体
// chart.setBackgroundPaint();// 设置背景色
//获取绘图区对象
CategoryPlot
plot
=
chart
.
getCategoryPlot
();
plot
.
setBackgroundPaint
(
Color
.
LIGHT_GRAY
);
// 设置绘图区背景色
plot
.
setRangeGridlinePaint
(
Color
.
gray
);
// 设置水平方向背景线颜色
// 设置背景透明度
plot
.
setBackgroundAlpha
(
0.1f
);
// 设置网格横线颜色
plot
.
setRangeGridlinePaint
(
Color
.
gray
);
// 设置网格横线大小
plot
.
setDomainGridlineStroke
(
new
BasicStroke
(
0.2
F
));
plot
.
setRangeGridlineStroke
(
new
BasicStroke
(
0.2
F
));
plot
.
setRangeGridlinesVisible
(
true
);
// 设置是否显示水平方向背景线,默认值为true
plot
.
setDomainGridlinePaint
(
Color
.
WHITE
);
// 设置垂直方向背景线颜色
plot
.
setDomainGridlinesVisible
(
true
);
// 设置是否显示垂直方向背景线,默认值为false
CategoryAxis
domainAxis
=
plot
.
getDomainAxis
();
domainAxis
.
setLabelFont
(
font
);
// 设置横轴字体
domainAxis
.
setTickLabelFont
(
font
);
// 设置坐标轴标尺值字体
domainAxis
.
setLowerMargin
(
0.01
);
// 左边距 边框距离
domainAxis
.
setUpperMargin
(
0.06
);
// 右边距 边框距离,防止最后边的一个数据靠近了坐标轴。
domainAxis
.
setMaximumCategoryLabelLines
(
2
);
ValueAxis
rangeAxis
=
plot
.
getRangeAxis
();
rangeAxis
.
setLabelFont
(
font
);
rangeAxis
.
setStandardTickUnits
(
NumberAxis
.
createIntegerTickUnits
());
//Y轴显示整数
rangeAxis
.
setAutoRangeMinimumSize
(
1
);
//最小跨度
rangeAxis
.
setUpperMargin
(
0.18
);
//上边距,防止最大的一个数据靠近了坐标轴。
rangeAxis
.
setLowerBound
(
0
);
//最小值显示0
rangeAxis
.
setAutoRange
(
false
);
//不自动分配Y轴数据
rangeAxis
.
setTickMarkStroke
(
new
BasicStroke
(
1.6f
));
// 设置坐标标记大小
rangeAxis
.
setTickMarkPaint
(
Color
.
BLACK
);
// 设置坐标标记颜色
// 获取折线对象
LineAndShapeRenderer
renderer
=
(
LineAndShapeRenderer
)
plot
.
getRenderer
();
BasicStroke
realLine
=
new
BasicStroke
(
1.8f
);
// 设置实线
// 设置虚线
float
dashes
[]
=
{
5.0f
};
BasicStroke
brokenLine
=
new
BasicStroke
(
2.2f
,
// 线条粗细
BasicStroke
.
CAP_ROUND
,
// 端点风格
BasicStroke
.
JOIN_ROUND
,
// 折点风格
8
f
,
dashes
,
0.6f
);
for
(
int
i
=
0
;
i
<
dataSet
.
getRowCount
();
i
++)
{
if
(
i
%
2
==
0
)
{
renderer
.
setSeriesStroke
(
i
,
realLine
);
// 利用实线绘制
}
else
{
renderer
.
setSeriesStroke
(
i
,
brokenLine
);
// 利用虚线绘制
}
// 生成折线图上的数字
//绘图区域(红色矩形框的部分)
renderer
.
setBaseItemLabelGenerator
(
new
StandardCategoryItemLabelGenerator
());
//设置图表上的数字可见
renderer
.
setBaseItemLabelsVisible
(
true
);
//设置图表上的数字字体
renderer
.
setBaseItemLabelFont
(
new
Font
(
"宋体"
,
Font
.
BOLD
,
15
));
//设置折线图拐角上的正方形
//创建一个正方形
Rectangle
shape
=
new
Rectangle
(
4
,
4
);
renderer
.
setSeriesShape
(
0
,
shape
);
//设置拐角上图形可见
renderer
.
setSeriesShapesVisible
(
0
,
true
);
}
plot
.
setNoDataMessage
(
"无对应的数据,请重新查询。"
);
plot
.
setNoDataMessageFont
(
font
);
//字体的大小
plot
.
setNoDataMessagePaint
(
Color
.
RED
);
//字体颜色
return
chart
;
}
}
\ No newline at end of file
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/ConfigureController.java
View file @
9e1f6b59
...
...
@@ -634,4 +634,25 @@ public class ConfigureController extends AbstractBaseController {
}
@PersonIdentify
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/iotMonthReport"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"物联报表-月"
,
notes
=
"物联报表-月"
)
public
ResponseModel
equipList
(
@RequestParam
(
value
=
"bizOrgCode"
,
required
=
false
)
String
bizOrgCode
,
@RequestParam
(
value
=
"startDate"
)
String
startDate
,
@RequestParam
(
value
=
"endDate"
)
String
endDate
)
{
if
(
ObjectUtils
.
isEmpty
(
bizOrgCode
))
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
ReginParams
.
PersonIdentity
personIdentity
=
reginParams
.
getPersonIdentity
();
if
(!
ValidationUtil
.
isEmpty
(
personIdentity
))
{
bizOrgCode
=
personIdentity
.
getBizOrgCode
();
}
}
if
(
ObjectUtils
.
isEmpty
(
bizOrgCode
)){
return
CommonResponseUtil
.
success
(
null
);
}
return
CommonResponseUtil
.
success
(
iFireFightingSystemService
.
iotMonthReport
(
bizOrgCode
,
startDate
,
endDate
));
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/FireFightingSystemMapper.java
View file @
9e1f6b59
...
...
@@ -468,4 +468,17 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
String
queryByCompanyCode
(
@Param
(
"companyCode"
)
String
companyCode
);
List
<
Map
<
String
,
Object
>>
selectSystemByBizOrgCode
(
@Param
(
"bizOrgCode"
)
String
bizOrgCode
);
List
<
Map
<
String
,
Object
>>
selectAlarmList
(
@Param
(
"bizOrgCode"
)
String
bizOrgCode
,
@Param
(
"month"
)
String
month
,
@Param
(
"systemId"
)
String
systemId
);
Map
<
String
,
Object
>
selectMonthSummarize
(
@Param
(
"month"
)
String
month
,
@Param
(
"systemId"
)
String
systemId
);
List
<
Map
<
String
,
Object
>>
selectMonthPieChart
(
@Param
(
"systemCode"
)
String
month
,
@Param
(
"startDate"
)
String
startDate
,
@Param
(
"endDate"
)
String
endDate
);
List
<
Map
<
String
,
Object
>>
selectMonthPieChartTwo
(
@Param
(
"systemCode"
)
String
sysCode
,
@Param
(
"startDate"
)
String
startDate
,
@Param
(
"endDate"
)
String
endDate
,
@Param
(
"indicator"
)
List
<
String
>
indicator
);
List
<
Map
<
String
,
Object
>>
selectMonthPolyline
(
@Param
(
"systemCode"
)
String
sysCode
,
@Param
(
"startDate"
)
String
startDate
,
@Param
(
"endDate"
)
String
endDate
,
@Param
(
"indicator"
)
List
<
String
>
indicator
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IFireFightingSystemService.java
View file @
9e1f6b59
...
...
@@ -273,4 +273,7 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
BigScreenVo
getSystemAlarmInfoNum
(
String
companyCode
);
BigScreenVo
getCarInfo
(
String
companyCode
);
String
iotMonthReport
(
String
bizOrgCode
,
String
startDate
,
String
endDate
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/FireFightingSystemServiceImpl.java
View file @
9e1f6b59
...
...
@@ -26,8 +26,10 @@ import com.yeejoin.equipmanage.common.entity.*;
import
com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO
;
import
com.yeejoin.equipmanage.common.entity.vo.*
;
import
com.yeejoin.equipmanage.common.enums.*
;
import
com.yeejoin.equipmanage.common.utils.ChartsUtils
;
import
com.yeejoin.equipmanage.common.utils.CommonPageInfoParam
;
import
com.yeejoin.equipmanage.common.utils.StringUtil
;
import
com.yeejoin.equipmanage.common.utils.WordTemplateUtils
;
import
com.yeejoin.equipmanage.common.vo.*
;
import
com.yeejoin.equipmanage.mapper.*
;
import
com.yeejoin.equipmanage.remote.RemoteSecurityService
;
...
...
@@ -37,21 +39,30 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.core.io.Resource
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.net.Inet4Address
;
import
java.net.InetAddress
;
import
java.net.NetworkInterface
;
import
java.net.SocketException
;
import
java.nio.charset.StandardCharsets
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
java
.
lang
.
String
.
valueOf
;
import
org.apache.commons.io.IOUtils
;
@Slf4j
@Service
...
...
@@ -92,6 +103,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Value
(
"${systemctl.dict.iot-core-param}"
)
private
String
iotCoreParam
;
@Value
(
"classpath:/json/systemIndex.json"
)
private
Resource
systemIndex
;
@Autowired
private
IEqDynamicFormGroupService
iEqDynamicFormGroupService
;
...
...
@@ -156,7 +170,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
List
<
EquipmentManageVo
>
dataList
=
(
List
<
EquipmentManageVo
>)
map
.
get
(
"dataList"
);
StringBuilder
stb
=
new
StringBuilder
();
dataList
.
forEach
(
y
->
{
if
(
StringUtil
.
isNotEmpty
(
String
.
valueOf
(
stb
)))
{
if
(
StringUtil
.
isNotEmpty
(
valueOf
(
stb
)))
{
stb
.
append
(
","
+
y
.
getChargePerson
());
}
else
{
stb
.
append
(
y
.
getChargePerson
());
...
...
@@ -172,7 +186,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
dataList
.
forEach
(
x
->
{
// x.setChargePerson(userMap.get(x.getChargePerson()));
x
.
setSystemimg
(
equipmentManageMapper
.
getFiles
(
String
.
valueOf
(
x
.
getId
()),
"face"
));
x
.
setSystemimg
(
equipmentManageMapper
.
getFiles
(
valueOf
(
x
.
getId
()),
"face"
));
});
map
.
put
(
"dataList"
,
dataList
);
return
map
;
...
...
@@ -200,7 +214,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
vo
.
setRecUserId
(
userId
);
// 冗余名称,数据同步使用
// this.setChargePersonName(vo);
String
s
=
String
.
valueOf
(
System
.
currentTimeMillis
());
String
s
=
valueOf
(
System
.
currentTimeMillis
());
vo
.
setId
(
s
);
vo
.
setSort
(
s
);
DynamicFormGroup
dynamicFormGroup
=
iEqDynamicFormGroupService
.
getById
(
vo
.
getFormGroupId
());
...
...
@@ -342,7 +356,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// 2.更新业务关联的画布id
Long
systemId
=
Long
.
valueOf
(
resourceDTO
.
getCode
());
FireFightingSystemVo
systemVo
=
new
FireFightingSystemVo
();
systemVo
.
setId
(
String
.
valueOf
(
systemId
));
systemVo
.
setId
(
valueOf
(
systemId
));
systemVo
.
setSceneId
(
resourceDTO
.
getId
());
fireFightingSystemMapper
.
setSceneId
(
systemVo
);
// 3.保存场景关联信息表
...
...
@@ -350,7 +364,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
.
selectOne
(
new
LambdaQueryWrapper
<
SourceScene
>().
eq
(
SourceScene:
:
getSceneId
,
resourceDTO
.
getId
()));
if
(
sourceScene
==
null
)
{
sourceScene
=
new
SourceScene
();
sourceScene
.
setProjectId
(
String
.
valueOf
(
projectSeq
));
sourceScene
.
setProjectId
(
valueOf
(
projectSeq
));
sourceScene
.
setSourceId
(
systemId
);
sourceScene
.
setSourceName
(
resourceDTO
.
getName
());
sourceScene
.
setSceneId
(
resourceDTO
.
getId
());
...
...
@@ -426,7 +440,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
List
<
FileUploadVo
>
video
=
vo
.
getVideo
();
if
(
video
.
size
()
>
0
)
{
for
(
FileUploadVo
f
:
video
)
{
f
.
setId
(
String
.
valueOf
(
System
.
currentTimeMillis
()));
f
.
setId
(
valueOf
(
System
.
currentTimeMillis
()));
f
.
setUserId
(
vo
.
getRecUserId
());
f
.
setFileType
(
"video"
);
f
.
setObjectId
(
vo
.
getId
());
...
...
@@ -436,7 +450,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
List
<
FileUploadVo
>
faceimg
=
vo
.
getFaceimg
();
if
(
faceimg
.
size
()
>
0
)
{
for
(
FileUploadVo
f
:
faceimg
)
{
f
.
setId
(
String
.
valueOf
(
System
.
currentTimeMillis
()));
f
.
setId
(
valueOf
(
System
.
currentTimeMillis
()));
f
.
setUserId
(
vo
.
getRecUserId
());
f
.
setFileType
(
"face"
);
f
.
setObjectId
(
vo
.
getId
());
...
...
@@ -446,7 +460,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
List
<
FileUploadVo
>
instruction
=
vo
.
getInstruction
();
if
(
instruction
.
size
()
>
0
)
{
for
(
FileUploadVo
f
:
instruction
)
{
f
.
setId
(
String
.
valueOf
(
System
.
currentTimeMillis
()));
f
.
setId
(
valueOf
(
System
.
currentTimeMillis
()));
f
.
setUserId
(
vo
.
getRecUserId
());
f
.
setFileType
(
"instruction"
);
f
.
setObjectId
(
vo
.
getId
());
...
...
@@ -456,7 +470,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
List
<
FileUploadVo
>
asser
=
vo
.
getAsser
();
if
(
asser
.
size
()
>
0
)
{
for
(
FileUploadVo
f
:
asser
)
{
f
.
setId
(
String
.
valueOf
(
System
.
currentTimeMillis
()));
f
.
setId
(
valueOf
(
System
.
currentTimeMillis
()));
f
.
setUserId
(
vo
.
getRecUserId
());
f
.
setFileType
(
"certificate"
);
f
.
setObjectId
(
vo
.
getId
());
...
...
@@ -467,7 +481,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
List
<
FileUploadVo
>
spotimg
=
vo
.
getSpotimg
();
if
(
spotimg
.
size
()
>
0
)
{
for
(
FileUploadVo
f
:
spotimg
)
{
f
.
setId
(
String
.
valueOf
(
System
.
currentTimeMillis
()));
f
.
setId
(
valueOf
(
System
.
currentTimeMillis
()));
f
.
setUserId
(
vo
.
getRecUserId
());
f
.
setFileType
(
"spotimg"
);
f
.
setObjectId
(
vo
.
getId
());
...
...
@@ -478,7 +492,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
List
<
FileUploadVo
>
tdmod
=
vo
.
getTdmod
();
if
(
tdmod
.
size
()
>
0
)
{
for
(
FileUploadVo
f
:
tdmod
)
{
f
.
setId
(
String
.
valueOf
(
System
.
currentTimeMillis
()));
f
.
setId
(
valueOf
(
System
.
currentTimeMillis
()));
f
.
setUserId
(
vo
.
getRecUserId
());
f
.
setFileType
(
"tdmod"
);
f
.
setObjectId
(
vo
.
getId
());
...
...
@@ -528,7 +542,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
p
.
setDataConfig
(
map
);
if
(
StringUtils
.
isEmpty
(
id
))
{
// 建筑
if
(
equipSpecificIds
.
contains
(
String
.
valueOf
(
equipSpecificId
)))
{
if
(
equipSpecificIds
.
contains
(
valueOf
(
equipSpecificId
)))
{
p
.
setBinding
(
true
);
}
else
{
p
.
setBinding
(
false
);
...
...
@@ -538,7 +552,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
String
pointInScene
=
sourceSceneMap
.
get
(
buildOrSysId
);
if
(!
StringUtils
.
isEmpty
(
pointInScene
))
{
// 系统
if
(
pointInScene
.
contains
(
String
.
valueOf
(
equipSpecificId
)))
{
if
(
pointInScene
.
contains
(
valueOf
(
equipSpecificId
)))
{
p
.
setBinding
(
true
);
}
else
{
p
.
setBinding
(
false
);
...
...
@@ -609,7 +623,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
p
.
setDataConfig
(
map
);
if
(
StringUtils
.
isEmpty
(
id
))
{
// 建筑
if
(
equipSpecificIds
.
contains
(
String
.
valueOf
(
equipSpecificId
)))
{
if
(
equipSpecificIds
.
contains
(
valueOf
(
equipSpecificId
)))
{
p
.
setBinding
(
true
);
}
else
{
p
.
setBinding
(
false
);
...
...
@@ -619,7 +633,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
String
pointInScene
=
sourceSceneMap
.
get
(
buildOrSysId
);
if
(!
StringUtils
.
isEmpty
(
pointInScene
))
{
// 系统
if
(
pointInScene
.
contains
(
String
.
valueOf
(
equipSpecificId
)))
{
if
(
pointInScene
.
contains
(
valueOf
(
equipSpecificId
)))
{
p
.
setBinding
(
true
);
}
else
{
p
.
setBinding
(
false
);
...
...
@@ -787,7 +801,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
formInstanceMapper
.
clearSystemId
(
id
);
// 解除装备与消防系统关系
this
.
removeBondSystemId
(
id
);
this
.
baseMapper
.
deleteFilre
(
String
.
valueOf
(
id
));
this
.
baseMapper
.
deleteFilre
(
valueOf
(
id
));
int
i
=
this
.
baseMapper
.
deleteById
(
id
);
if
(
i
>
0
&&
syncSwitch
)
{
syncDataService
.
syncDeletedFireFightingSystem
(
Arrays
.
asList
(
id
));
...
...
@@ -1051,7 +1065,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
List
<
OrgUsrDto
>
orgUsrLists
=
jcsRemoteService
.
getCompanyDeptListWithAuth
(
"COMPANY,DEPARTMENT"
,
bizOrgCode
);
List
<
FireFightingSystemTreeVo
>
fireFightingSystemTreeList
=
orgUsrLists
.
stream
().
map
(
key
->
{
FireFightingSystemTreeVo
vo
=
new
FireFightingSystemTreeVo
();
vo
.
setId
(
String
.
valueOf
(
key
.
getSequenceNbr
()));
vo
.
setId
(
valueOf
(
key
.
getSequenceNbr
()));
vo
.
setName
(
key
.
getBizOrgName
());
vo
.
setType
(
key
.
getBizOrgType
());
vo
.
setBizOrgCode
(
key
.
getBizOrgCode
());
...
...
@@ -1067,7 +1081,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
List
<
FireFightingSystemEntity
>
fireFightingSystemEntityList
=
this
.
baseMapper
.
selectList
(
wrapper
);
List
<
FireFightingSystemTreeVo
>
systemList
=
fireFightingSystemEntityList
.
stream
().
map
(
key
->
{
FireFightingSystemTreeVo
vo
=
new
FireFightingSystemTreeVo
();
vo
.
setId
(
String
.
valueOf
(
key
.
getId
()));
vo
.
setId
(
valueOf
(
key
.
getId
()));
vo
.
setName
(
key
.
getName
());
vo
.
setType
(
"system"
);
vo
.
setBizOrgCode
(
key
.
getBizOrgCode
());
...
...
@@ -1111,7 +1125,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
});
vo
.
setType
(
item
.
getGroupType
());
vo
.
setId
(
String
.
valueOf
(
item
.
getId
()));
vo
.
setId
(
valueOf
(
item
.
getId
()));
return
vo
;
}).
collect
(
Collectors
.
toList
());
// 计算总数
...
...
@@ -1127,7 +1141,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
parentNode
.
setName
(
"全部分类"
);
parentNode
.
setId
(
"-1"
);
parentNode
.
setParentId
(
"-1"
);
parentNode
.
setTotal
(
String
.
valueOf
(
total
));
parentNode
.
setTotal
(
valueOf
(
total
));
parentNode
.
setChildren
(
childrenList
);
return
Collections
.
singletonList
(
parentNode
);
}
...
...
@@ -1437,4 +1451,175 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
bigScreenVo
.
setBreakdownInfo
(
breakdown
);
return
bigScreenVo
;
}
private
Map
<
String
,
Object
>
getData
(
String
bizOrgCode
,
String
startDate
,
String
endDate
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
// 查询该站信息以及所有系统
List
<
Map
<
String
,
Object
>>
system
=
fireFightingSystemMapper
.
selectSystemByBizOrgCode
(
bizOrgCode
);
String
json
=
null
;
try
{
json
=
IOUtils
.
toString
(
systemIndex
.
getInputStream
(),
java
.
lang
.
String
.
valueOf
(
StandardCharsets
.
UTF_8
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
// 系统对应指标配置
List
<
Map
>
indicatorConfiguration
=
JSONObject
.
parseArray
(
json
,
Map
.
class
);
// 系统循环数据填充
ArrayList
<
Map
<
String
,
Object
>>
systemList
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
system
))
{
map
.
put
(
"station"
,
"锦屏"
);
map
.
put
(
"time"
,
"2022-07"
);
// 单个系统数据
for
(
Map
<
String
,
Object
>
sys
:
system
)
{
HashMap
<
String
,
Object
>
systemData
=
new
HashMap
<>();
List
<
Map
>
collect
=
indicatorConfiguration
.
stream
().
filter
(
item
->
item
.
get
(
"code"
).
equals
(
String
.
valueOf
(
sys
.
get
(
"typeCode"
)))).
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
collect
))
{
// 系统名称
systemData
.
put
(
"systemName"
,
ObjectUtils
.
isEmpty
(
sys
.
get
(
"name"
))
?
""
:
String
.
valueOf
(
sys
.
get
(
"name"
)));
// 系统对应指标
String
indicator
=
String
.
valueOf
(
collect
.
get
(
0
).
get
(
"index"
));
List
<
Map
<
String
,
Object
>>
alarmMessageList
=
fireFightingSystemMapper
.
selectAlarmList
(
bizOrgCode
,
startDate
.
substring
(
0
,
7
),
String
.
valueOf
(
sys
.
get
(
"id"
)));
// 单个系统循环列表
ArrayList
<
Map
<
String
,
Object
>>
maps
=
new
ArrayList
<>();
// 系统下告警统计列表
if
(!
CollectionUtils
.
isEmpty
(
alarmMessageList
))
{
for
(
Map
<
String
,
Object
>
alarm
:
alarmMessageList
)
{
HashMap
<
String
,
Object
>
alarmMap
=
new
HashMap
<>();
// 设备类型
alarmMap
.
put
(
"equipment_name"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"equipment_name"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"equipment_name"
)));
// 设备总数
alarmMap
.
put
(
"num"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"num"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"num"
)));
// 正常设备总数
alarmMap
.
put
(
"normalEquipNum"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"normalEquipNum"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"normalEquipNum"
)));
// 设备正确率
alarmMap
.
put
(
"normalEquipPercent"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"normalEquipPercent"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"normalEquipPercent"
)));
// 设备故障总数
alarmMap
.
put
(
"fault_equip_num"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"fault_equip_num"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"fault_equip_num"
)));
// 故障信息条数
alarmMap
.
put
(
"alarm_info_num"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"alarm_info_num"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"alarm_info_num"
)));
// 设备故障率
alarmMap
.
put
(
"faultEquipPercent"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"faultEquipPercent"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"faultEquipPercent"
)));
// 报警设备总数
alarmMap
.
put
(
"alarm_equip_num"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"alarm_equip_num"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"alarm_equip_num"
)));
// 报警设备占比
alarmMap
.
put
(
"alarmEquipPercent"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"alarmEquipPercent"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"alarmEquipPercent"
)));
// 信息总数
alarmMap
.
put
(
"total_info_num"
,
ObjectUtils
.
isEmpty
(
alarm
.
get
(
"total_info_num"
))
?
""
:
String
.
valueOf
(
alarm
.
get
(
"total_info_num"
)));
maps
.
add
(
alarmMap
);
}
}
else
{
HashMap
<
String
,
Object
>
alarmMap
=
new
HashMap
<>();
alarmMap
.
put
(
"equipment_name"
,
""
);
alarmMap
.
put
(
"num"
,
""
);
alarmMap
.
put
(
"normalEquipNum"
,
""
);
alarmMap
.
put
(
"normalEquipPercent"
,
""
);
alarmMap
.
put
(
"fault_equip_num"
,
""
);
alarmMap
.
put
(
"alarm_info_num"
,
""
);
alarmMap
.
put
(
"faultEquipPercent"
,
""
);
alarmMap
.
put
(
"alarm_equip_num"
,
""
);
alarmMap
.
put
(
"alarmEquipPercent"
,
""
);
alarmMap
.
put
(
"total_info_num"
,
""
);
maps
.
add
(
alarmMap
);
}
systemData
.
put
(
"list"
,
maps
);
// 系统对应总结
Map
<
String
,
Object
>
summarize
=
fireFightingSystemMapper
.
selectMonthSummarize
(
startDate
.
substring
(
0
,
7
),
String
.
valueOf
(
sys
.
get
(
"id"
)));
if
(!
ObjectUtils
.
isEmpty
(
summarize
))
{
systemData
.
put
(
"summarize"
,
ObjectUtils
.
isEmpty
(
summarize
.
get
(
"summary_info"
))
?
""
:
String
.
valueOf
(
summarize
.
get
(
"summary_info"
)));
}
else
{
systemData
.
put
(
"summarize"
,
""
);
}
// echarts图
String
[]
split
=
indicator
.
split
(
","
);
List
<
String
>
indicatorList
=
Arrays
.
asList
(
split
);
List
<
Map
<
String
,
Object
>>
pieChartList
=
fireFightingSystemMapper
.
selectMonthPieChart
(
String
.
valueOf
(
sys
.
get
(
"code"
)),
startDate
,
endDate
);
List
<
Map
<
String
,
Object
>>
pieChartListTwo
=
fireFightingSystemMapper
.
selectMonthPieChartTwo
(
String
.
valueOf
(
sys
.
get
(
"code"
)),
startDate
,
endDate
,
indicatorList
);
List
<
Map
<
String
,
Object
>>
selectMonthPolyline
=
fireFightingSystemMapper
.
selectMonthPolyline
(
String
.
valueOf
(
sys
.
get
(
"code"
)),
startDate
,
endDate
,
indicatorList
);
String
pieChart
=
ChartsUtils
.
pieChart
(
pieChartList
,
"设备告警统计"
);
systemData
.
put
(
"bing1"
,
pieChart
);
if
(!
CollectionUtils
.
isEmpty
(
pieChartListTwo
))
{
String
pieChart1
=
ChartsUtils
.
pieChart
(
pieChartListTwo
,
"告警类别统计"
);
systemData
.
put
(
"bing2"
,
pieChart1
);
}
else
{
List
<
Map
<
String
,
Object
>>
data
=
new
ArrayList
<>();
HashMap
<
String
,
Object
>
dataMap
=
new
HashMap
<>();
dataMap
.
put
(
"type"
,
"火警"
);
dataMap
.
put
(
"value"
,
0
);
data
.
add
(
dataMap
);
String
pieChart1
=
ChartsUtils
.
pieChart
(
data
,
"告警类别统计"
);
systemData
.
put
(
"bing2"
,
pieChart1
);
}
if
(!
CollectionUtils
.
isEmpty
(
selectMonthPolyline
))
{
String
pieChart2
=
ChartsUtils
.
manyLineChart
(
selectMonthPolyline
);
systemData
.
put
(
"bing3"
,
pieChart2
);
}
else
{
systemData
.
put
(
"bing3"
,
""
);
}
systemList
.
add
(
systemData
);
map
.
put
(
"datalist"
,
systemList
);
}
}
}
return
map
;
}
private
static
byte
[]
file2byte
(
File
file
)
{
try
{
FileInputStream
in
=
new
FileInputStream
(
file
);
byte
[]
data
=
new
byte
[
in
.
available
()];
in
.
read
(
data
);
in
.
close
();
return
data
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
@Override
public
String
iotMonthReport
(
String
bizOrgCode
,
String
startDate
,
String
endDate
)
{
Map
<
String
,
Object
>
DataMap
=
getData
(
bizOrgCode
,
startDate
,
endDate
);
WordTemplateUtils
instance
=
WordTemplateUtils
.
getInstance
();
String
pdfUrlString
=
""
;
File
filepdf
=
null
;
try
{
filepdf
=
instance
.
getWordFileItem
(
DataMap
,
null
,
WordTemplateTypeEum
.
iotMonthReport
.
getTemplateFile
());
filepdf
.
getAbsolutePath
();
MultipartFile
multipartFile
=
new
MyByteArrayMultipartFile
(
"file"
,
"file.pdf"
,
"application/pdf"
,
file2byte
(
filepdf
));
FeignClientResult
<
Map
<
String
,
String
>>
result
=
Systemctl
.
fileStorageClient
.
updateCommonFile
(
multipartFile
);
if
(
result
!=
null
)
{
Iterator
<
String
>
it
=
result
.
getResult
().
keySet
().
iterator
();
while
(
it
.
hasNext
())
{
pdfUrlString
=
it
.
next
();
}
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
filepdf
!=
null
)
{
filepdf
.
delete
();
}
}
return
pdfUrlString
;
}
}
amos-boot-system-equip/src/main/resources/ftl/iotMonthReport.ftl
0 → 100644
View file @
9e1f6b59
This source diff could not be displayed because it is too large. You can
view the blob
instead.
amos-boot-system-equip/src/main/resources/json/systemIndex.json
0 → 100644
View file @
9e1f6b59
[
{
"code"
:
"92040000"
,
"index"
:
"FireAlarm,Fault,Shield"
},
{
"code"
:
"92990000"
,
"index"
:
"FireAlarm,Fault,Shield"
}
]
\ No newline at end of file
amos-boot-system-equip/src/main/resources/mapper/FireFightingSystemMapper.xml
View file @
9e1f6b59
...
...
@@ -3520,4 +3520,174 @@
AND code = #{companyCode}
</if>
</select>
<select
id=
"selectSystemByBizOrgCode"
resultType=
"java.util.Map"
>
SELECT ffs.id,ffs.`code`,ffs.system_type as type,ffs.biz_org_name as stationName, ffs.name,wec.code AS typeCode
FROM `f_fire_fighting_system` ffs
LEFT JOIN wl_equipment_category wec
on ffs.system_type = wec.id
WHERE biz_org_code = #{bizOrgCode}
</select>
<select
id=
"selectAlarmList"
resultType=
"java.util.Map"
>
select
a1.*,
(a1.num - a1.alarm_equip_num) as normalEquipNum,
if(a1.num > 0 , concat(ROUND((a1.num - a1.alarm_equip_num)/a1.num,2)*100,'%'), '-') as normalEquipPercent,
if(a1.num > 0 , concat(ROUND(a1.fault_equip_num/a1.num,2)*100,'%'), '-') as faultEquipPercent,
if(a1.num > 0 , concat(ROUND(a1.alarm_equip_num/a1.num,2)*100,'%'), '-') as alarmEquipPercent
from
wl_analysis_report_month a1
where
a1.report_month = #{month} and system_id = #{systemId}
</select>
<select
id=
"selectMonthSummarize"
resultType=
"java.util.Map"
>
SELECT
rs.system_id,
rs.summary_info,
rs.report_date,
rs.report_type
FROM
`wl_analysis_report_summary` rs
where
rs.report_date like concat(#{month},'%')
and rs.report_type = 3
and system_id = #{systemId}
</select>
<select
id=
"selectMonthPieChart"
resultType=
"java.util.Map"
>
SELECT
`name` as `type`,
(SELECT count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.index_type LIKE CONCAT('%','Fault')
and report.index_true_num >0
and report.report_date BETWEEN #{startDate}
and #{endDate}
) as `value`
FROM(
SELECT
s.id as system_id,
equipment.code,
equipment.name
FROM
wl_equipment_specific spec
LEFT JOIN wl_equipment_detail detail ON spec.equipment_detail_id = detail.id
LEFT JOIN wl_equipment equipment ON equipment.id =detail.equipment_id
left join f_fire_fighting_system s on FIND_IN_SET(s.id,spec.system_id)
where spec.system_id is not null
AND s.code = #{systemCode}
GROUP BY code,s.id, name ORDER BY system_id, code ) a
</select>
<select
id=
"selectMonthPieChartTwo"
resultType=
"java.util.Map"
>
SELECT
ss.alarm_type_name as type,
SUM(index_true_num) as value
from
(
SELECT
rep.alarm_type,
rep.alarm_type_name,
rep.index_true_num
FROM
wl_equipment_alarm_report_day rep,
(
SELECT
s.id as system_id,
equipment.code,
equipment.name
FROM
wl_equipment_specific spec
LEFT JOIN wl_equipment_detail detail ON spec.equipment_detail_id = detail.id
LEFT JOIN wl_equipment equipment ON equipment.id =detail.equipment_id
left join f_fire_fighting_system s on FIND_IN_SET(s.id,spec.system_id)
where spec.system_id is not null
and s.code = #{systemCode}
GROUP BY s.id, code, name ORDER BY s.id, code
) a
where rep.equipment_code = a.code and FIND_IN_SET(a.system_id,rep.system_ids)
<foreach
collection=
"indicator"
item=
"index"
open=
"AND("
separator=
"or"
close=
")"
>
rep.index_type like concat ('%', #{index})
</foreach>
and rep.index_true_num >0
and rep.alarm_type is not null
and rep.report_date BETWEEN #{startDate}
and #{endDate}
) ss
GROUP BY ss.alarm_type_name
</select>
<select
id=
"selectMonthPolyline"
resultType=
"java.util.Map"
>
SELECT * FROM (
SELECT A.name as title, A.date as x, IFNULL(B.num,0) AS y from
(
SELECT * from (
SELECT
DATE( DATE_ADD(#{startDate}, INTERVAL @s DAY ) ) AS date,
'报警总条数' as name,
@s := @s + 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 0 ) temp ) s1
WHERE
s1.`index`
<
= DATEDIFF(#{endDate},#{startDate})
) A
LEFT JOIN (
SELECT
SUM( report.index_true_num ) AS num,
report.report_date AS reportDate
FROM
wl_equipment_alarm_report_day report
LEFT JOIN f_fire_fighting_system s ON FIND_IN_SET( s.id, report.system_ids)
WHERE report.system_ids is not null
<foreach
collection=
"indicator"
item=
"index"
open=
"AND("
separator=
"or"
close=
")"
>
report.index_type like concat ('%', #{index})
</foreach>
and s.code = #{systemCode}
GROUP BY
report.report_date,
s.id
) B on B.reportDate = A.date
UNION all
SELECT A.name, A.date , IFNULL(B.num,0) AS num from
(
select * from (
SELECT
DATE( DATE_ADD( #{startDate}, INTERVAL @s2 DAY ) ) AS date,
'报警设备总数' as name,
@s2 := @s2 + 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s2 := 0 ) temp ) s1
WHERE
s1.`index`
<
= DATEDIFF(#{endDate},#{startDate})
) A
LEFT JOIN (
SELECT
COUNT( distinct(report.equipment_specific_id)) AS num,
report.report_date AS reportDate
FROM
wl_equipment_alarm_report_day report
LEFT JOIN f_fire_fighting_system s ON FIND_IN_SET( s.id, report.system_ids)
WHERE
report.system_ids is not null
and s.code = #{systemCode}
and report.index_true_num >0
<foreach
collection=
"indicator"
item=
"index"
open=
"AND("
separator=
"or"
close=
")"
>
report.index_type like concat ('%', #{index})
</foreach>
GROUP BY
report.report_date,
s.id
) B on B.reportDate = A.date ) C
ORDER BY title,x
</select>
</mapper>
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