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
735d42aa
Commit
735d42aa
authored
Aug 15, 2024
by
李秀明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: BUG#21964 告警统计增加时间筛选
parent
104db640
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
56 deletions
+79
-56
AlarmStatisticController.java
...join/equipmanage/controller/AlarmStatisticController.java
+11
-4
FireFightingSystemMapper.java
.../yeejoin/equipmanage/mapper/FireFightingSystemMapper.java
+2
-2
IFireFightingSystemService.java
...ejoin/equipmanage/service/IFireFightingSystemService.java
+2
-2
FireFightingSystemServiceImpl.java
...uipmanage/service/impl/FireFightingSystemServiceImpl.java
+15
-6
FireFightingSystemMapper.xml
...ip/src/main/resources/mapper/FireFightingSystemMapper.xml
+49
-42
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/AlarmStatisticController.java
View file @
735d42aa
...
...
@@ -82,14 +82,21 @@ public class AlarmStatisticController extends AbstractBaseController {
@GetMapping
(
"/statistic/trend"
)
public
ResponseModel
getSystemAlarmTrend
(
@RequestParam
(
value
=
"systemCode"
,
required
=
false
)
String
systemCode
,
@RequestParam
(
value
=
"updateTime"
,
required
=
false
)
String
updateTime
,
@RequestParam
(
value
=
"bizOrgCode"
,
required
=
false
)
String
bizOrgCode
)
{
return
CommonResponseUtil
.
success
(
iFireFightingSystemService
.
getCenterSystemAlarmTrend
(
systemCode
,
updateTime
,
bizOrgCode
));
@RequestParam
(
value
=
"bizOrgCode"
,
required
=
false
)
String
bizOrgCode
,
@RequestParam
(
value
=
"startDate"
,
required
=
false
)
String
startDate
,
@RequestParam
(
value
=
"endDate"
,
required
=
false
)
String
endDate
)
{
return
CommonResponseUtil
.
success
(
iFireFightingSystemService
.
getCenterSystemAlarmTrend
(
systemCode
,
updateTime
,
bizOrgCode
,
startDate
,
endDate
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
value
=
"系统告警事件数量占比"
)
@GetMapping
(
"/num"
)
public
ResponseModel
getSystemAlarmNum
(
@RequestParam
(
value
=
"bizOrgCode"
,
required
=
false
)
String
bizOrgCode
)
{
return
CommonResponseUtil
.
success
(
iFireFightingSystemService
.
getSystemAlarmNum
(
bizOrgCode
));
public
ResponseModel
getSystemAlarmNum
(
@RequestParam
(
value
=
"bizOrgCode"
,
required
=
false
)
String
bizOrgCode
,
@RequestParam
(
value
=
"startDate"
,
required
=
false
)
String
startDate
,
@RequestParam
(
value
=
"endDate"
,
required
=
false
)
String
endDate
)
{
return
CommonResponseUtil
.
success
(
iFireFightingSystemService
.
getSystemAlarmNum
(
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 @
735d42aa
...
...
@@ -742,7 +742,7 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
Map
<
String
,
String
>
getSystemAlarmStatistic
(
@Param
(
"systemCode"
)
String
systemCode
,
@Param
(
"startDate"
)
String
startDate
,
@Param
(
"endDate"
)
String
endDate
);
List
<
Map
<
String
,
Object
>>
getSystemAlarmTrend
(
@Param
(
"systemCode"
)
String
systemCode
,
@Param
(
"updateTime"
)
String
updateTime
,
@Param
(
"bizOrgCode"
)
String
bizOrgCode
);
List
<
Map
<
String
,
Object
>>
getSystemAlarmTrend
(
@Param
(
"systemCode"
)
String
systemCode
,
@Param
(
"updateTime"
)
String
updateTime
,
@Param
(
"
intervalDays"
)
Long
intervalDays
,
@Param
(
"
bizOrgCode"
)
String
bizOrgCode
);
List
<
Map
<
String
,
Object
>>
getSystemAlarmTrendForSbpt
(
@Param
(
"systemCode"
)
String
systemCode
,
@Param
(
"updateTime"
)
String
updateTime
);
...
...
@@ -768,7 +768,7 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List
<
Map
<
String
,
Object
>>
getFireCannonInfo
(
@Param
(
"bizOrgCode"
)
String
bizOrgCode
,
@Param
(
"list"
)
String
[]
strings
);
List
<
Map
<
String
,
Object
>>
getSystemAlarmNum
(
@Param
(
"bizOrgCode"
)
String
bizOrgCode
);
List
<
Map
<
String
,
Object
>>
getSystemAlarmNum
(
@Param
(
"bizOrgCode"
)
String
bizOrgCode
,
String
startDate
,
String
endDate
);
List
<
Map
<
String
,
Object
>>
getSystemTypes
(
String
bizOrgCode
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IFireFightingSystemService.java
View file @
735d42aa
...
...
@@ -351,7 +351,7 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
Map
<
String
,
Object
>
getSystemAlarmTrend
(
String
systemCode
,
String
updateTime
,
String
bizOrgCode
);
Map
<
String
,
Object
>
getCenterSystemAlarmTrend
(
String
systemCode
,
String
updateTime
,
String
bizOrgCode
);
Map
<
String
,
Object
>
getCenterSystemAlarmTrend
(
String
systemCode
,
String
updateTime
,
String
bizOrgCode
,
String
startDate
,
String
endDate
);
List
<
Map
<
String
,
Object
>>
getFireCannonInfo
(
String
bizOrgCode
);
...
...
@@ -359,5 +359,5 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
List
<
OrgMenuDto
>
getSystemEquipTree
(
String
systemCode
);
List
<
Map
<
String
,
Object
>>
getSystemAlarmNum
(
String
bizOrgCode
);
List
<
Map
<
String
,
Object
>>
getSystemAlarmNum
(
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 @
735d42aa
...
...
@@ -68,6 +68,8 @@ import java.net.SocketException;
import
java.nio.charset.StandardCharsets
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
import
java.time.temporal.ChronoUnit
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
...
...
@@ -2765,7 +2767,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
if
(!
StringUtil
.
isNotEmpty
(
updateTime
))
{
updateTime
=
new
SimpleDateFormat
(
DateUtils
.
DATE_PATTERN
).
format
(
new
Date
());
}
List
<
Map
<
String
,
Object
>>
result
=
fireFightingSystemMapper
.
getSystemAlarmTrend
(
systemCode
,
updateTime
,
bizOrgCode
);
List
<
Map
<
String
,
Object
>>
result
=
fireFightingSystemMapper
.
getSystemAlarmTrend
(
systemCode
,
updateTime
,
null
,
bizOrgCode
);
Map
<
String
,
Object
>
resMap
=
new
HashMap
<>();
resMap
.
put
(
"xAxisData"
,
result
.
stream
().
map
(
x
->
x
.
get
(
"date"
)).
collect
(
Collectors
.
toList
()));
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
...
...
@@ -2786,11 +2788,18 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
@Override
public
Map
<
String
,
Object
>
getCenterSystemAlarmTrend
(
String
systemCode
,
String
updateTime
,
String
bizOrgCode
)
{
if
(!
StringUtil
.
isNotEmpty
(
updateTime
))
{
public
Map
<
String
,
Object
>
getCenterSystemAlarmTrend
(
String
systemCode
,
String
updateTime
,
String
bizOrgCode
,
String
startDate
,
String
endDate
)
{
Long
intervalDays
=
null
;
if
(
StringUtils
.
isEmpty
(
updateTime
))
{
updateTime
=
new
SimpleDateFormat
(
DateUtils
.
DATE_PATTERN
).
format
(
new
Date
());
}
List
<
Map
<
String
,
Object
>>
result
=
fireFightingSystemMapper
.
getSystemAlarmTrend
(
systemCode
,
updateTime
,
bizOrgCode
);
if
(
StringUtils
.
hasText
(
startDate
)
&&
StringUtils
.
hasText
(
endDate
))
{
updateTime
=
endDate
;
LocalDate
date1
=
LocalDate
.
parse
(
startDate
,
DateTimeFormatter
.
ofPattern
(
DateUtils
.
DATE_TIME_PATTERN
));
LocalDate
date2
=
LocalDate
.
parse
(
endDate
,
DateTimeFormatter
.
ofPattern
(
DateUtils
.
DATE_TIME_PATTERN
));
intervalDays
=
date1
.
until
(
date2
,
ChronoUnit
.
DAYS
);
}
List
<
Map
<
String
,
Object
>>
result
=
fireFightingSystemMapper
.
getSystemAlarmTrend
(
systemCode
,
updateTime
,
intervalDays
,
bizOrgCode
);
Map
<
String
,
Object
>
resMap
=
new
HashMap
<>();
resMap
.
put
(
"xAxisData"
,
result
.
stream
().
map
(
x
->
x
.
get
(
"date"
)).
collect
(
Collectors
.
toList
()));
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
...
...
@@ -2876,8 +2885,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
@Override
public
List
<
Map
<
String
,
Object
>>
getSystemAlarmNum
(
String
bizOrgCode
)
{
return
fireFightingSystemMapper
.
getSystemAlarmNum
(
bizOrgCode
);
public
List
<
Map
<
String
,
Object
>>
getSystemAlarmNum
(
String
bizOrgCode
,
String
startDate
,
String
endDate
)
{
return
fireFightingSystemMapper
.
getSystemAlarmNum
(
bizOrgCode
,
startDate
,
endDate
);
}
@Override
...
...
amos-boot-system-equip/src/main/resources/mapper/FireFightingSystemMapper.xml
View file @
735d42aa
...
...
@@ -6672,54 +6672,54 @@
<select
id=
"getSystemAlarmTrend"
resultType=
"Map"
>
SELECT
s1.date,
IFNULL( s2.faultNum, 0 ) AS faultNum,
IFNULL( s2.alarmNum, 0 ) AS alarmNum,
IFNULL( s2.faultNum, 0 ) AS shieldNum
s1.date,
IFNULL( s2.faultNum, 0 ) AS faultNum,
IFNULL( s2.alarmNum, 0 ) AS alarmNum,
IFNULL( s2.faultNum, 0 ) AS shieldNum
FROM
(
SELECT
@s := @s + 1 AS `index`,
DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD(#{updateTime}, INTERVAL - 6
DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date
FROM
mysql.help_topic,
( SELECT @s := - 1 ) temp
WHERE
@s
<
6
) s1
(
SELECT
@s := @s + 1 AS `index`,
DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD(#{updateTime}, INTERVAL - IFNULL(#{intervalDays}, 6)
DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date
FROM
mysql.help_topic,
( SELECT @s := - 1 ) temp
WHERE
@s
<
IFNULL(#{intervalDays}, 6)
) s1
LEFT JOIN (
SELECT
s.*
FROM
(
SELECT
IFNULL(SUM(IF(r.`status` = 0, 1, 0)), 0) AS normalNum,
IFNULL(SUM(IF((r.type = 'BREAKDOWN' AND r.`status` = 1), 1, 0)), 0) AS faultNum,
IFNULL(SUM(IF((r.type = 'FIREALARM' AND r.`status` = 1), 1, 0)), 0) AS alarmNum,
IFNULL(SUM(IF((r.type = 'SHIELD' AND r.`status` = 1), 1, 0)), 0) AS shieldNum,
DATE_FORMAT( r.update_date, '%Y-%m-%d') AS date
s.*
FROM
wl_equipment_specific_alarm_log r
LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET( fs.id, r.system_ids )
<where>
r.update_date BETWEEN date_sub( now(), INTERVAL 6 MONTH ) AND now()
<if
test=
"systemCode != null and systemCode != ''"
>
AND fs.`code` = #{systemCode}
</if>
<if
test=
"bizOrgCode!=null and bizOrgCode!=''"
>
r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
GROUP BY
LEFT ( r.update_date, 10 )
ORDER BY
r.update_date
) s
(
SELECT
IFNULL(SUM(IF(r.`status` = 0, 1, 0)), 0) AS normalNum,
IFNULL(SUM(IF((r.type = 'BREAKDOWN' AND r.`status` = 1), 1, 0)), 0) AS faultNum,
IFNULL(SUM(IF((r.type = 'FIREALARM' AND r.`status` = 1), 1, 0)), 0) AS alarmNum,
IFNULL(SUM(IF((r.type = 'SHIELD' AND r.`status` = 1), 1, 0)), 0) AS shieldNum,
DATE_FORMAT( r.update_date, '%Y-%m-%d') AS date
FROM
wl_equipment_specific_alarm_log r
LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET( fs.id, r.system_ids )
<where>
r.update_date BETWEEN date_sub( now(), INTERVAL 6 MONTH ) AND now()
<if
test=
"systemCode != null and systemCode != ''"
>
AND fs.`code` = #{systemCode}
</if>
<if
test=
"bizOrgCode!=null and bizOrgCode!=''"
>
r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
GROUP BY
LEFT ( r.update_date, 10 )
ORDER BY
r.update_date
) s
) s2 ON s2.date = s1.date
GROUP BY
s1.date
s1.date
ORDER BY
s1.date
s1.date
</select>
<select
id=
"getSystemAlarmTrendForSbpt"
resultType=
"Map"
>
...
...
@@ -7045,11 +7045,18 @@
FROM
wl_equipment_specific_alarm_log wlesal
LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET( fs.id, wlesal.system_ids )
<![CDATA[<>]]>
0
<where>
<if
test=
"bizOrgCode!=null and bizOrgCode!=''"
>
AND wlesal.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if>
<if
test=
"startDate!=null and startDate!=''"
>
AND wlesal.create_date
>
= #{startDate}
</if>
<if
test=
"endDate!=null and endDate!=''"
>
AND wlesal.create_date
<
= #{endDate}
</if>
</where>
GROUP BY fs.system_type_code
</select>
<select
id=
"getSystemTypes"
resultType=
"Map"
>
...
...
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