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
cfd3c83e
Commit
cfd3c83e
authored
Nov 09, 2023
by
zhangsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 td
parent
a61072d4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
161 additions
and
10 deletions
+161
-10
TDBigScreenAnalyseController.java
...le/jxiop/biz/controller/TDBigScreenAnalyseController.java
+13
-8
IdxBizFanHealthIndexMapper.java
.../module/jxiop/biz/mapper2/IdxBizFanHealthIndexMapper.java
+13
-0
IdxBizFanHealthIndexMapper.xml
...n/resources/mapper/cluster/IdxBizFanHealthIndexMapper.xml
+135
-2
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/TDBigScreenAnalyseController.java
View file @
cfd3c83e
...
...
@@ -51,6 +51,8 @@ import java.text.SimpleDateFormat;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
.
DateUtils
.
DATE_TIME_PATTERN
;
@RestController
@Api
(
tags
=
"智能分析 - 大屏API"
)
@RequestMapping
(
value
=
"/tdBigScreenAnalyse"
)
...
...
@@ -111,7 +113,7 @@ public class TDBigScreenAnalyseController extends BaseController {
stringBigDecimalHashMap
.
put
(
"value"
,
Integer
.
valueOf
(
idxBizFanHealthIndexMapper
.
getHealthScoreInfoByStation
(
stationCode
,
tableName
).
toString
().
replace
(
".0"
,
""
)));
return
ResponseHelper
.
buildResponse
(
stringBigDecimalHashMap
);
}
stringBigDecimalHashMap
.
put
(
"value"
,
Integer
.
valueOf
(
idxBizFanHealthIndexMapper
.
getHealthScoreInfo
(
areaCode
,
stationCode
).
toString
().
replace
(
".0"
,
""
)));
stringBigDecimalHashMap
.
put
(
"value"
,
Integer
.
valueOf
(
idxBizFanHealthIndexMapper
.
getHealthScoreInfo
ByLatest
(
areaCode
,
stationCode
).
toString
().
replace
(
".0"
,
""
)));
return
ResponseHelper
.
buildResponse
(
stringBigDecimalHashMap
);
}
...
...
@@ -354,11 +356,11 @@ public class TDBigScreenAnalyseController extends BaseController {
@ApiOperation
(
value
=
"场站预警信息统计图 - 雷达图"
,
httpMethod
=
"GET"
)
@GetMapping
(
"/equipWarningRadarMap"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
assessIndexRadarMap
(
@RequestParam
(
required
=
false
,
value
=
"stationCode"
)
String
stationCode
)
{
if
(
Str
Util
.
isNotEmpty
(
stationCode
))
{
if
(
CharSequence
Util
.
isNotEmpty
(
stationCode
))
{
StationBasic
stationBasic
=
stationBasicMapper
.
selectById
(
stationCode
);
stationCode
=
stationBasic
.
getFanGatewayId
();
}
List
<
Map
<
String
,
Object
>>
list
=
idxBizFanHealthIndexMapper
.
equipWarningRadarMap
(
stationCode
);
List
<
Map
<
String
,
Object
>>
list
=
idxBizFanHealthIndexMapper
.
equipWarningRadarMap
ByTd
(
stationCode
);
Map
<
String
,
Integer
>
warningNumMap
=
list
.
stream
().
collect
(
Collectors
.
toMap
(
t
->
t
.
get
(
"warningName"
).
toString
(),
t
->
Integer
.
parseInt
(
t
.
get
(
"num"
).
toString
())));
List
<
String
>
warningList
=
Arrays
.
asList
(
"危险"
,
"注意"
,
"警告"
);
List
<
Integer
>
data
=
new
ArrayList
<>();
...
...
@@ -532,7 +534,7 @@ public class TDBigScreenAnalyseController extends BaseController {
subSystem
=
java
.
net
.
URLDecoder
.
decode
(
subSystem
,
"UTF-8"
);
StationBasic
stationBasic
=
stationBasicMapper
.
selectById
(
stationId
);
// List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoBySubSystem(subSystem, stationBasic.getFanGatewayId());
List
<
Map
<
String
,
Object
>>
healthListInfo
=
idxBizFanHealthIndexMapper
.
getWarningInfoBySubSystem
(
subSystem
,
stationBasic
.
getFanGatewayId
());
List
<
Map
<
String
,
Object
>>
healthListInfo
=
idxBizFanHealthIndexMapper
.
getWarningInfoBySubSystem
Td
(
subSystem
,
stationBasic
.
getFanGatewayId
());
Map
<
Object
,
String
>
equipmentHealthIndexMap
=
healthListInfo
.
stream
().
collect
(
Collectors
.
toMap
(
t
->
t
.
get
(
"pointName"
),
t
->
t
.
get
(
"warningName"
).
toString
()));
List
<
Map
<
String
,
Object
>>
pointNameList
=
idxBizFanHealthIndexMapper
.
getPointNameListBySumSystem
(
stationBasic
.
getFanGatewayId
(),
subSystem
);
pointNameList
.
forEach
(
item
->
{
...
...
@@ -669,13 +671,16 @@ public class TDBigScreenAnalyseController extends BaseController {
public
ResponseModel
<
Map
<
String
,
Object
>>
getTrendInfoByAddress
(
@RequestParam
(
value
=
"indexAddress"
,
required
=
false
)
String
indexAddress
,
@RequestParam
(
value
=
"stationId"
,
required
=
false
)
String
stationId
,
@RequestParam
(
value
=
"tableName"
,
required
=
false
)
String
tableName
,
@RequestParam
(
value
=
"tableName2"
,
required
=
false
)
String
tableName2
)
{
@RequestParam
(
value
=
"tableName2"
,
required
=
false
)
String
tableName2
)
throws
ParseException
{
StationBasic
stationBasic
=
stationBasicMapper
.
selectById
(
stationId
);
List
<
Map
<
String
,
Object
>>
resultListData
=
new
ArrayList
<>();
String
recDate
=
idxBizFanHealthIndexMapper
.
getRecDateByIndexAddress
(
stationBasic
.
getFanGatewayId
(),
indexAddress
,
tableName
);
String
recDate
=
idxBizFanHealthIndexMapper
.
getRecDateByIndexAddress
Ts
(
stationBasic
.
getFanGatewayId
(),
indexAddress
,
tableName
);
if
(
CharSequenceUtil
.
isNotEmpty
(
recDate
))
{
resultListData
=
idxBizFanHealthIndexMapper
.
getInfoListByTableName
(
stationBasic
.
getFanGatewayId
(),
indexAddress
,
tableName2
,
recDate
);
Date
date
=
DateUtils
.
dateParse
(
recDate
,
DATE_TIME_PATTERN
);
String
datejian8
=
DateUtils
.
dateFormat
(
DateUtils
.
dateAddHours
(
date
,
-
8
),
DATE_TIME_PATTERN
);
String
datejian20
=
DateUtils
.
dateFormat
(
DateUtils
.
dateAddHours
(
date
,
-
20
),
DATE_TIME_PATTERN
);
resultListData
=
idxBizFanHealthIndexMapper
.
getInfoListByTableNameTs
(
stationBasic
.
getFanGatewayId
(),
indexAddress
,
tableName2
,
datejian8
,
datejian20
);
}
HashMap
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
List
<
String
>
time
=
new
ArrayList
<>();
...
...
@@ -683,7 +688,7 @@ public class TDBigScreenAnalyseController extends BaseController {
resultListData
.
forEach
(
item
->
{
String
date
=
""
;
try
{
date
=
DateUtils
.
convertDateToString
(
DateUtils
.
dateParse
(
item
.
get
(
"
REC_DATE
"
).
toString
(),
DateUtils
.
DATE_TIME_PATTERN
),
"MM-dd HH:mm:ss"
);
date
=
DateUtils
.
convertDateToString
(
DateUtils
.
dateParse
(
item
.
get
(
"
rec_date
"
).
toString
(),
DateUtils
.
DATE_TIME_PATTERN
),
"MM-dd HH:mm:ss"
);
}
catch
(
ParseException
e
)
{
}
time
.
add
(
date
);
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/mapper2/IdxBizFanHealthIndexMapper.java
View file @
cfd3c83e
...
...
@@ -22,6 +22,7 @@ import java.util.Map;
public
interface
IdxBizFanHealthIndexMapper
extends
BaseMapper
<
IdxBizFanHealthIndex
>
{
BigDecimal
getHealthScoreInfo
(
@Param
(
"areaCode"
)
String
areaCode
,
@Param
(
"stationCode"
)
String
stationCode
);
BigDecimal
getHealthScoreInfoByLatest
(
@Param
(
"areaCode"
)
String
areaCode
,
@Param
(
"stationCode"
)
String
stationCode
);
BigDecimal
getHealthScoreInfoByStation
(
@Param
(
"stationCode"
)
String
stationCode
,
@Param
(
"tableName"
)
String
tableName
);
...
...
@@ -41,6 +42,8 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List
<
Map
<
String
,
Object
>>
equipWarningRadarMap
(
@Param
(
"stationCode"
)
String
stationCode
);
List
<
Map
<
String
,
Object
>>
equipWarningRadarMapByTd
(
@Param
(
"stationCode"
)
String
stationCode
);
List
<
Map
<
String
,
Object
>>
getAllEquipAlarmInfoAnalysisByStationType
(
@Param
(
"tableName"
)
String
tableName
,
@Param
(
"areaCode"
)
String
areaCode
,
@Param
(
"stationType"
)
String
stationType
);
...
...
@@ -62,6 +65,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List
<
Map
<
String
,
Object
>>
getWarningInfoBySubSystem
(
@Param
(
"subSystem"
)
String
subSystem
,
@Param
(
"gatewayId"
)
String
gatewayId
);
List
<
Map
<
String
,
Object
>>
getWarningInfoBySubSystemTd
(
@Param
(
"subSystem"
)
String
subSystem
,
@Param
(
"gatewayId"
)
String
gatewayId
);
...
...
@@ -137,11 +141,20 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
String
getRecDateByIndexAddress
(
@Param
(
"fanGatewayId"
)
String
fanGatewayId
,
@Param
(
"indexAddress"
)
String
indexAddress
,
@Param
(
"tableName"
)
String
tableName
);
String
getRecDateByIndexAddressTs
(
@Param
(
"fanGatewayId"
)
String
fanGatewayId
,
@Param
(
"indexAddress"
)
String
indexAddress
,
@Param
(
"tableName"
)
String
tableName
);
List
<
Map
<
String
,
Object
>>
getInfoListByTableName
(
@Param
(
"fanGatewayId"
)
String
fanGatewayId
,
@Param
(
"indexAddress"
)
String
indexAddress
,
@Param
(
"tableName"
)
String
tableName
,
@Param
(
"recDate"
)
String
recDate
);
List
<
Map
<
String
,
Object
>>
getInfoListByTableNameTs
(
@Param
(
"fanGatewayId"
)
String
fanGatewayId
,
@Param
(
"indexAddress"
)
String
indexAddress
,
@Param
(
"tableName"
)
String
tableName
,
@Param
(
"recDate"
)
String
recDate
,
@Param
(
"date12"
)
String
date12
);
int
getIsWarningByPointId
(
@Param
(
"indexAddress"
)
String
indexAddress
,
@Param
(
"fanGatewayId"
)
String
fanGatewayId
,
@Param
(
"tableName"
)
String
tableName
);
List
<
Map
<
String
,
Object
>>
queryIndexByArae
(
String
ARAE
,
String
ANALYSISTYPE
,
String
startTimeTop
,
String
endTimeTop
);
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/mapper/cluster/IdxBizFanHealthIndexMapper.xml
View file @
cfd3c83e
...
...
@@ -458,7 +458,7 @@
CEILING(IFNULL( HEALTH_INDEX, 100 )) AS healthIndex,
SUB_SYSTEM AS subSystem
FROM
idx_biz_fan_health_index
fan_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE = '子系统'
AND ANALYSIS_TYPE = '按天'
...
...
@@ -497,7 +497,7 @@
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex,
EQUIPMENT_NAME as equipmentName
FROM
idx_biz_fan_health_index
fan_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE = '设备'
AND ANALYSIS_TYPE = '按天'
...
...
@@ -1616,6 +1616,139 @@
GROUP BY REC_DATE
</select>
<select
id=
"getHealthScoreInfoByLatest"
resultType=
"java.math.BigDecimal"
>
SELECT
CEILING(avg( a.avgHealthIndex )) AS healthIndex
FROM
(
SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex
FROM
fan_health_index_latest_data
<where>
ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if
test=
"areaCode != null and areaCode != ''"
>
AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if
test=
"stationCode != null and stationCode != ''"
>
AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</if>
<if
test=
"(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')"
>
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
</where>
UNION ALL
(
SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex
FROM
pv_health_index_latest_data
<where>
ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if
test=
"areaCode != null and areaCode != ''"
>
AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if
test=
"stationCode != null and stationCode != ''"
>
AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</if>
<if
test=
"(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')"
>
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
</where>
)
) a
</select>
<select
id=
"equipWarningRadarMapByTd"
resultType=
"java.util.Map"
>
select
a.warningName,
count(1) as num
from
(
select
warning_name as warningName
from
analysis_data.fan_warning_record
<where>
((disposotion_state = '未处置')
or (disposotion_state = '已处置'
and ts > now - 3d - 8h))
<if
test=
"stationCode != null and stationCode != ''"
>
and gateway_id = #{stationCode}
</if>
</where>
union all
(select
warning_name as warningName
from
analysis_data.pv_warning_record
<where>
((disposotion_state = '未处置')
or (
disposotion_state = '已处置'
and ts > now - 3d - 8h ))
<if
test=
"stationCode != null and stationCode != ''"
>
and gateway_id = #{stationCode}
</if>
</where>
)
) a
group by
a.warningName
</select>
<select
id=
"getWarningInfoBySubSystemTd"
resultType=
"java.util.Map"
>
SELECT
point_name as pointName,
warning_name as warningName,
last(ts)
FROM
fan_warning_record
<where>
disposotion_state = '未处置'
<if
test=
"subSystem != null and subSystem != ''"
>
AND sub_system = #{subSystem}
</if>
<if
test=
"gatewayId != null and gatewayId != ''"
>
AND gateway_id = #{gatewayId}
</if>
</where>
group by point_name
</select>
<select
id=
"getRecDateByIndexAddressTs"
resultType=
"java.lang.String"
>
SELECT
rec_date
FROM
${tableName}
WHERE
index_address = #{indexAddress}
AND disposotion_state = '未处置'
and gateway_id = #{fanGatewayId}
ORDER BY
ts DESC
LIMIT 1
</select>
<select
id=
"getInfoListByTableNameTs"
resultType=
"java.util.Map"
>
SELECT
*,
CEIL(health_index) as healthIndex
FROM
${tableName}
WHERE
#{recDate} >= ts
AND ts >= #{date12}
AND analysis_type = '按时刻'
AND index_address = #{indexAddress}
AND gateway_id = #{fanGatewayId}
</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