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
897337b0
Commit
897337b0
authored
Nov 09, 2023
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
大屏 TD接口开发
parent
25285773
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
242 additions
and
7 deletions
+242
-7
AnalyseController.java
...s/boot/module/jxiop/biz/controller/AnalyseController.java
+1
-1
BigScreenAnalyseController.java
...dule/jxiop/biz/controller/BigScreenAnalyseController.java
+3
-0
TDBigScreenAnalyseController.java
...le/jxiop/biz/controller/TDBigScreenAnalyseController.java
+70
-5
FanWaringRecordMapper.java
...oot/module/jxiop/biz/tdMapper2/FanWaringRecordMapper.java
+10
-1
PvWaringRecordMapper.java
...boot/module/jxiop/biz/tdMapper2/PvWaringRecordMapper.java
+2
-0
FanWarningRecord.xml
.../src/main/resources/mapper/tdengine2/FanWarningRecord.xml
+143
-0
PvWarningRecord.xml
...z/src/main/resources/mapper/tdengine2/PvWarningRecord.xml
+13
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/AnalyseController.java
View file @
897337b0
...
...
@@ -265,7 +265,7 @@ public class AnalyseController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"预警详情信息-光伏"
,
notes
=
"预警详情信息-光伏"
)
@GetMapping
(
value
=
"/queryIndexByArae"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
queryIndexByArae
(
String
area
,
String
analysisType
,
String
startTimeTop
,
String
endTimeTop
)
{
public
ResponseModel
<
Map
<
String
,
Object
>>
queryIndexByArae
(
@RequestParam
(
required
=
false
)
String
area
,
String
analysisType
,
String
startTimeTop
,
String
endTimeTop
)
{
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
if
(
null
!=
endTimeTop
){
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/BigScreenAnalyseController.java
View file @
897337b0
...
...
@@ -20,6 +20,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRuleSetServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRuleSetServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanWaringRecordMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
...
...
@@ -56,6 +57,8 @@ public class BigScreenAnalyseController extends BaseController {
@Autowired
IdxBizPvHealthLevelMapper
idxBizPvHealthLevelMapper
;
@Autowired
FanWaringRecordMapper
fanWaringRecordMapper
;
@Autowired
StationBasicMapper
stationBasicMapper
;
...
...
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 @
897337b0
...
...
@@ -21,6 +21,14 @@ import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvHealthLevelMapper;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRuleSetServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRuleSetServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanWaringRecordMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvHealthIndexMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvWaringRecordMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvWarningRecord
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
...
...
@@ -28,6 +36,7 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
...
...
@@ -38,6 +47,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import
java.io.UnsupportedEncodingException
;
import
java.sql.Timestamp
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -57,6 +67,10 @@ public class TDBigScreenAnalyseController extends BaseController {
@Autowired
FanHealthIndexMapper
fanHealthIndexMapper
;
@Autowired
PvHealthIndexMapper
pvHealthIndexMapper
;
@Autowired
StationBasicMapper
stationBasicMapper
;
@Autowired
...
...
@@ -71,6 +85,12 @@ public class TDBigScreenAnalyseController extends BaseController {
@Autowired
RiskWarningFeign
riskWarningFeign
;
@Autowired
FanWaringRecordMapper
fanWaringRecordMapper
;
@Autowired
PvWaringRecordMapper
pvWaringRecordMapper
;
@Autowired
private
IdxBizFanWarningRuleSetServiceImpl
idxBizFanWarningRuleSetService
;
...
...
@@ -128,7 +148,13 @@ public class TDBigScreenAnalyseController extends BaseController {
@GetMapping
(
value
=
"/getAllEquipAlarmInfo"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getAllEquipAlarmInfo
(
@RequestParam
(
required
=
false
)
String
tableName
)
throws
Exception
{
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
List
<
Map
<
String
,
Object
>>
allEquipAlarmInfo
=
idxBizFanHealthIndexMapper
.
getAllEquipAlarmInfo
(
tableName
);
List
<
Map
<
String
,
Object
>>
allEquipAlarmInfo
=
new
ArrayList
<>();
if
(
tableName
.
contains
(
"fan"
)){
allEquipAlarmInfo
=
fanWaringRecordMapper
.
getAllEquipAlarmInfo
();
}
else
{
allEquipAlarmInfo
=
pvWaringRecordMapper
.
getAllEquipAlarmInfo
();
}
HashMap
<
String
,
Integer
>
wxMap
=
new
HashMap
<>();
HashMap
<
String
,
Integer
>
zyMap
=
new
HashMap
<>();
HashMap
<
String
,
Integer
>
jgMap
=
new
HashMap
<>();
...
...
@@ -226,7 +252,7 @@ public class TDBigScreenAnalyseController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"全域各场站设备实时预警处置信息"
,
notes
=
"全域各场站设备实时预警处置信息"
)
@GetMapping
(
value
=
"/getEquipWarningInfoByPage"
)
public
ResponseModel
<
IPage
<
IdxBiz
FanWarningRecord
>>
getEquipWarningInfoByPage
(
@RequestParam
(
value
=
"arae"
,
required
=
false
)
String
arae
,
public
ResponseModel
<
IPage
<
FanWarningRecord
>>
getEquipWarningInfoByPage
(
@RequestParam
(
value
=
"arae"
,
required
=
false
)
String
arae
,
@RequestParam
(
value
=
"station"
,
required
=
false
)
String
station
,
@RequestParam
(
value
=
"stationType"
,
required
=
false
)
String
stationType
,
@RequestParam
(
value
=
"current"
,
required
=
false
)
Integer
current
,
...
...
@@ -241,9 +267,11 @@ public class TDBigScreenAnalyseController extends BaseController {
StationBasic
stationBasic
=
stationBasicMapper
.
selectById
(
stationId
);
stationId
=
stationBasic
.
getFanGatewayId
();
}
Integer
count
=
idxBizFanWarningRecordMapper
.
getEquipWarningInfoByPageCount
(
arae
,
station
,
stationType
,
warningName
,
stationId
,
startDate
,
endDate
);
List
<
IdxBizFanWarningRecord
>
idxBizFanWarningRecordIPage
=
idxBizFanWarningRecordMapper
.
getEquipWarningInfoByPage
(
arae
,
station
,
stationType
,
(
current
-
1
)
*
size
,
size
,
warningName
,
stationId
,
startDate
,
endDate
);
Page
<
IdxBizFanWarningRecord
>
idxBizFanWarningRecordPage
=
new
Page
<>(
current
,
size
);
Integer
count
=
fanWaringRecordMapper
.
getEquipWarningInfoByPageCount
(
arae
,
station
,
stationType
,
warningName
,
stationId
,
startDate
,
endDate
);
// List<IdxBizFanWarningRecord> idxBizFanWarningRecordIPage = idxBizFanWarningRecordMapper.getEquipWarningInfoByPage(arae, station, stationType, (current - 1) * size, size, warningName, stationId, startDate, endDate);
List
<
FanWarningRecord
>
idxBizFanWarningRecordIPage
=
fanWaringRecordMapper
.
getEquipWarningInfoByPage
(
arae
,
station
,
stationType
,
(
current
-
1
)
*
size
,
size
,
warningName
,
stationId
,
startDate
,
endDate
);
Page
<
FanWarningRecord
>
idxBizFanWarningRecordPage
=
new
Page
<>(
current
,
size
);
idxBizFanWarningRecordPage
.
setRecords
(
idxBizFanWarningRecordIPage
);
idxBizFanWarningRecordPage
.
setTotal
(
count
);
return
ResponseHelper
.
buildResponse
(
idxBizFanWarningRecordPage
);
...
...
@@ -1108,4 +1136,41 @@ public class TDBigScreenAnalyseController extends BaseController {
return
ResponseHelper
.
buildResponse
(
true
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"预警详情信息-光伏"
,
notes
=
"预警详情信息-光伏"
)
@GetMapping
(
value
=
"/queryIndexByArae"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
queryIndexByArae
(
@RequestParam
(
required
=
false
)
String
area
,
String
analysisType
,
String
startTimeTop
,
String
endTimeTop
)
{
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
if
(
null
!=
endTimeTop
){
Date
endDate
=
DateUtils
.
dateAddHours
(
DateUtils
.
longStr2Date
(
endTimeTop
),
-
8
);
endTimeTop
=
formatter
.
format
(
endDate
);
}
Date
startDate
=
DateUtils
.
dateAddHours
(
DateUtils
.
longStr2Date
(
startTimeTop
),
-
8
);
startTimeTop
=
formatter
.
format
(
startDate
);
List
<
FanHealthIndex
>
fanHealthIndices
=
fanHealthIndexMapper
.
selectData
(
null
,
area
,
null
,
null
,
analysisType
,
"片区"
,
null
,
null
,
null
,
startTimeTop
,
endTimeTop
);
List
<
PvHealthIndex
>
pvHealthIndices
=
pvHealthIndexMapper
.
selectData
(
null
,
area
,
null
,
null
,
analysisType
,
"片区"
,
null
,
null
,
null
,
startTimeTop
,
endTimeTop
);
for
(
PvHealthIndex
pvHealthIndex
:
pvHealthIndices
)
{
FanHealthIndex
fanHealthIndex
=
new
FanHealthIndex
();
BeanUtils
.
copyProperties
(
pvHealthIndex
,
fanHealthIndex
);
fanHealthIndices
.
add
(
fanHealthIndex
);
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
List
<
Object
>
axisData
=
new
ArrayList
<>();
List
<
Object
>
seriesData
=
new
ArrayList
<>();
Map
<
String
,
List
<
FanHealthIndex
>>
mapList
=
fanHealthIndices
.
stream
().
collect
(
Collectors
.
groupingBy
(
FanHealthIndex:
:
getAnalysisTime
));
for
(
String
s
:
mapList
.
keySet
())
{
List
<
FanHealthIndex
>
fanHealthIndices1
=
mapList
.
get
(
s
);
Double
healtnIndex
=
fanHealthIndices1
.
stream
().
collect
(
Collectors
.
averagingDouble
(
FanHealthIndex:
:
getHealthIndex
));
seriesData
.
add
(
healtnIndex
.
intValue
());
axisData
.
add
(
s
);
}
map
.
put
(
"axisData"
,
axisData
);
map
.
put
(
"seriesData"
,
seriesData
);
return
ResponseHelper
.
buildResponse
(
map
);
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/tdMapper2/FanWaringRecordMapper.java
View file @
897337b0
...
...
@@ -25,6 +25,7 @@ public interface FanWaringRecordMapper extends BaseMapper<FanWarningRecord> {
int
saveBatchWarningRecords
(
@Param
(
"list"
)
List
<
FanWarningRecord
>
list
);
List
<
Map
<
String
,
Object
>>
getAllEquipAlarmInfo
();
List
<
FanWarningRecord
>
getInfoByPage
(
@Param
(
"dto"
)
FanHealthIndexDto
dto
);
...
...
@@ -33,5 +34,13 @@ public interface FanWaringRecordMapper extends BaseMapper<FanWarningRecord> {
FanWarningRecord
getInfoByTs
(
@Param
(
"ts"
)
Long
ts
);
int
updateStatusByTs
(
@Param
(
"list"
)
List
<
FanWarningRecord
>
list
);
Integer
getEquipWarningInfoByPageCount
(
@Param
(
"arae"
)
String
arae
,
@Param
(
"station"
)
String
station
,
@Param
(
"stationType"
)
String
stationType
,
@Param
(
"warningName"
)
String
warningName
,
@Param
(
"stationId"
)
String
stationId
,
@Param
(
"startDate"
)
String
startDate
,
@Param
(
"endDate"
)
String
endDate
);
List
<
FanWarningRecord
>
getEquipWarningInfoByPage
(
String
arae
,
String
station
,
String
stationType
,
Integer
current
,
Integer
size
,
String
warningName
,
String
stationId
,
String
startDate
,
String
endDate
);
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/tdMapper2/PvWaringRecordMapper.java
View file @
897337b0
...
...
@@ -29,4 +29,6 @@ public interface PvWaringRecordMapper extends BaseMapper<PvWarningRecord> {
PvWarningRecord
getInfoByTs
(
@Param
(
"ts"
)
Long
ts
);
int
updateStatusByTs
(
@Param
(
"list"
)
List
<
PvWarningRecord
>
list
);
List
<
Map
<
String
,
Object
>>
getAllEquipAlarmInfo
();
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/mapper/tdengine2/FanWarningRecord.xml
View file @
897337b0
...
...
@@ -233,4 +233,147 @@
</foreach>
</insert>
<select
id=
"getAllEquipAlarmInfo"
resultType=
"map"
>
select arae as area,
warning_name as warningname,
count(1) as num
from analysis_data.fan_warning_record a
where (a.disposotion_state = '未处置')
or (a.disposotion_state = '已处置' and a.disposotion_date >(now()-3d -8h ))
group by arae,
warning_name
</select>
<select
id=
"getEquipWarningInfoByPage"
resultType=
"com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord"
>
select
a.*
from
(
select
rec_date as recdate,
station as station,
equipment_name as equipmentname,
content as content,
warning_name as warningname,
disposotion_state as disposotionstate,
arae as arae,
'pv' as stationtype,
gateway_id,
concat(point_name, '异常') as pointname,
disposotion_date as disposotiondate,
(case when warning_name = '注意' then 1
when warning_name = '警告' then 2
when warning_name = '危险' then 3
end) as sort
from
analysis_data.pv_warning_record union all
select
rec_date as recdate,
station as station,
equipment_name as equipmentname,
content as content,
warning_name as warningname,
disposotion_state as disposotionstate,
arae as arae,
'fan' as stationtype,
gateway_id,
concat(point_name, '异常') as pointname,
disposotion_date as disposotiondate,
(case when warning_name = '注意' then 1
when warning_name = '警告' then 2
when warning_name = '危险' then 3
end) as sort
from
analysis_data.fan_warning_record
) a
<where>
(a.disposotionstate = '未处置') or (a.disposotionstate = '已处置' and a.disposotiondate >( now()- 3d - 8h ))
<if
test=
"arae != '' and arae != null"
>
and a.arae like concat('%', #{arae}, '%')
</if>
<if
test=
"station != '' and station != null"
>
and a.station = #{station}
</if>
<if
test=
"stationtype != '' and stationtype != null"
>
and a.stationtype = #{stationtype}
</if>
<if
test=
"warningname != '' and warningname != null"
>
and a.warningname = #{warningname}
</if>
<if
test=
"stationid != '' and stationid != null"
>
and a.gateway_id = #{stationid}
</if>
<if
test=
"startdate != '' and startdate != null"
>
and a.recdate >= concat(#{startdate}, ' 00:00:00')
</if>
<if
test=
"enddate != '' and enddate != null"
>
and concat(#{enddate}, ' 23:59:59') >= a.recdate
</if>
</where>
order by sort desc, recdate desc
limit #{current}, #{size}
</select>
<select
id=
"getEquipWarningInfoByPageCount"
resultType=
"integer"
>
select count(1) from
(select
a.*
from
(
select
rec_date as recdate,
station as station,
equipment_name as equipmentname,
content as content,
warning_name as warningname,
disposotion_state as disposotionstate,
arae as arae,
'pv' as stationtype,
gateway_id,
disposotion_date as disposotiondate
from
analysis_data.pv_warning_record union all
select
rec_date as recdate,
station as station,
equipment_name as equipmentname,
content as content,
warning_name as warningname,
disposotion_state as disposotionstate,
arae as arae,
'fan' as stationtype,
gateway_id,
disposotion_date as disposotiondate
from
analysis_data.fan_warning_record
) a
<where>
a.disposotionstate = '未处置' or (a.disposotionstate = '已处置' and a.disposotiondate > ( now() - 3D - 8h ))
<if
test=
"arae != '' and arae != null"
>
and a.arae like concat('%', #{arae}, '%')
</if>
<if
test=
"station != '' and station != null"
>
and a.station = #{station}
</if>
<if
test=
"stationtype != '' and stationtype != null"
>
and a.stationtype = #{stationtype}
</if>
<if
test=
"warningname != '' and warningname != null"
>
and a.warningname = #{warningname}
</if>
<if
test=
"stationid != '' and stationid != null"
>
and a.gateway_id = #{stationid}
</if>
<if
test=
"startdate != '' and startdate != null"
>
and a.recdate >= concat(#{startdate}, ' 00:00:00')
</if>
<if
test=
"enddate != '' and enddate != null"
>
and concat(#{enddate}, ' 23:59:59') >= a.recdate
</if>
</where>
) b
</select>
</mapper>
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/mapper/tdengine2/PvWarningRecord.xml
View file @
897337b0
...
...
@@ -248,4 +248,17 @@
#{item.status, jdbcType=VARCHAR})
</foreach>
</insert>
<select
id=
"getAllEquipAlarmInfo"
resultType=
"map"
>
select arae as area,
warning_name as warningname,
count(1) as num
from analysis_data.pv_warning_record a
where (a.disposotion_state = '未处置')
or (a.disposotion_state = '已处置' and a.disposotion_date >(now()-3d -8h ))
group by arae,
warning_name
</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