Commit 7747c69b authored by zhangsen's avatar zhangsen

分析需求API

parent 50a037b2
...@@ -31,6 +31,12 @@ ...@@ -31,6 +31,12 @@
<version>5.7.22</version> <version>5.7.22</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-jxiop-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId> <groupId>com.yeejoin</groupId>
<artifactId>amos-component-influxdb</artifactId> <artifactId>amos-component-influxdb</artifactId>
<version>1.8.5-SNAPSHOT</version> <version>1.8.5-SNAPSHOT</version>
......
...@@ -2,12 +2,15 @@ package com.yeejoin.amos.boot.module.jxiop.biz.entity; ...@@ -2,12 +2,15 @@ package com.yeejoin.amos.boot.module.jxiop.biz.entity;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
/** /**
* *
...@@ -39,7 +42,7 @@ public class IdxBizFanWarningRecord{ ...@@ -39,7 +42,7 @@ public class IdxBizFanWarningRecord{
* *
*/ */
@TableField("REC_DATE") @TableField("REC_DATE")
private LocalDateTime recDate; private Date recDate;
/** /**
* *
......
...@@ -2,6 +2,11 @@ package com.yeejoin.amos.boot.module.jxiop.biz.mapper2; ...@@ -2,6 +2,11 @@ package com.yeejoin.amos.boot.module.jxiop.biz.mapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/** /**
* Mapper 接口 * Mapper 接口
...@@ -11,4 +16,16 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex; ...@@ -11,4 +16,16 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex;
*/ */
public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIndex> { public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIndex> {
BigDecimal getHealthScoreInfo(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode);
List<Map<String, Object>> getHealthListInfo(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode);
List<Map<String, Object>> getAllEquipAlarmInfo(@Param("tableName") String tableName);
List<Map<String, Object>> getHealthInfoByArea();
List<Map<String, Object>> getAllEquipAlarmInfoByStation();
List<Map<String, Object>> getHealthInfoByStation(@Param("areaCode") String areaCode);
} }
...@@ -2,6 +2,9 @@ package com.yeejoin.amos.boot.module.jxiop.biz.mapper2; ...@@ -2,6 +2,9 @@ package com.yeejoin.amos.boot.module.jxiop.biz.mapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* Mapper 接口 * Mapper 接口
...@@ -11,4 +14,13 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord; ...@@ -11,4 +14,13 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord;
*/ */
public interface IdxBizFanWarningRecordMapper extends BaseMapper<IdxBizFanWarningRecord> { public interface IdxBizFanWarningRecordMapper extends BaseMapper<IdxBizFanWarningRecord> {
List<IdxBizFanWarningRecord> getEquipWarningInfoByPage(@Param("arae") String arae,
@Param("station") String station,
@Param("stationType") String stationType,
@Param("current") Integer current,
@Param("size") Integer size);
Integer getEquipWarningInfoByPageCount(@Param("arae") String arae,
@Param("station") String station,
@Param("stationType") String stationType);
} }
...@@ -2,4 +2,220 @@ ...@@ -2,4 +2,220 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper">
<select id="getHealthScoreInfo" resultType="java.math.BigDecimal">
SELECT
avg( a.avgHealthIndex ) AS healthIndex
FROM
(
SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex
FROM
idx_biz_fan_health_index
<where>ANALYSIS_TYPE = '按天'
AND
DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" )
<if test="areaCode != null and areaCode != ''">
AND ARAE = #{areaCode}
</if>
<if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode}
</if>
<if test="stationCode == null or stationCode == ''">
AND ( STATION IS NULL OR STATION = '' )
</if>
</where>
UNION ALL
(
SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex
FROM
idx_biz_pv_health_index
<where>
ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" )
<if test="areaCode != null and areaCode != ''">
AND ARAE = #{areaCode}
</if>
<if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode}
</if>
<if test="stationCode == null or stationCode == ''">
AND ( STATION IS NULL OR STATION = '' )
</if>
</where>
)
) a
</select>
<select id="getHealthListInfo" resultType="java.util.Map">
SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex,
a.date
FROM
(
SELECT
DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD( now(), INTERVAL - 15 DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date,
@s := @s + 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
DATEDIFF( now(), DATE( DATE_ADD( now(), INTERVAL - 15 DAY )) ) >= @s
) a
LEFT JOIN (
SELECT
HEALTH_INDEX,
DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) AS recDate
FROM
idx_biz_pv_health_index
<where>
ANALYSIS_TYPE = '按天'
<if test="areaCode != null and areaCode != ''">
AND ARAE = #{areaCode}
</if>
<if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode}
</if>
<if test="stationCode == null or stationCode == ''">
AND ( STATION IS NULL OR STATION = '' )
</if>
</where>
UNION ALL
(
SELECT
HEALTH_INDEX,
DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) AS recDate
FROM
idx_biz_fan_health_index
<where>
ANALYSIS_TYPE = '按天'
<if test="areaCode != null and areaCode != ''">
AND ARAE = #{areaCode}
</if>
<if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode}
</if>
<if test="stationCode == null or stationCode == ''">
AND ( STATION IS NULL OR STATION = '' )
</if>
</where>
)
) b ON DATE_FORMAT( b.recDate, "%Y-%m-%d" ) = a.date
GROUP BY
a.date
</select>
<select id="getAllEquipAlarmInfo" resultType="java.util.Map">
SELECT
ARAE as area,
WARNING_NAME as warningName,
count(1) as num
FROM
${tableName} a
group by ARAE,
WARNING_NAME
</select>
<select id="getHealthInfoByArea" resultType="java.util.Map">
SELECT
ARAE as area,
avg( a.avgHealthIndex ) AS healthIndex
FROM
(
SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex,
ARAE
FROM
idx_biz_fan_health_index
WHERE
( STATION IS NULL OR STATION = '' )
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" )
GROUP BY
ARAE UNION ALL
(
SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex,
ARAE
FROM
idx_biz_pv_health_index
WHERE
( STATION IS NULL OR STATION = '' )
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" )
GROUP BY
ARAE
)
) a
GROUP BY
a.ARAE
</select>
<select id="getAllEquipAlarmInfoByStation" resultType="java.util.Map">
SELECT
STATION as station,
WARNING_NAME as warningName,
count(1) as num
FROM
idx_biz_fan_warning_record
group by STATION,
WARNING_NAME
union all
SELECT
STATION as station,
WARNING_NAME as warningName,
count(1) as num
FROM
idx_biz_pv_warning_record
group by STATION,
WARNING_NAME
</select>
<select id="getHealthInfoByStation" resultType="java.util.Map">
SELECT
a.STATION as station,
avg( a.avgHealthIndex ) AS healthIndex
FROM
(
SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex,
STATION
FROM
idx_biz_fan_health_index
<where>
( STATION IS NOT NULL OR STATION != '' )
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" )
<if test="areaCode != null and areaCode != ''">
AND ARAE = #{areaCode}
</if>
</where>
GROUP BY
STATION UNION ALL
(
SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex,
ARAE
FROM
idx_biz_pv_health_index
<where>
( STATION IS NOT NULL OR STATION != '' )
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" )
<if test="areaCode != null and areaCode != ''">
AND ARAE = #{areaCode}
</if>
</where>
GROUP BY
STATION
)
) a
GROUP BY
a.STATION
</select>
</mapper> </mapper>
...@@ -2,4 +2,87 @@ ...@@ -2,4 +2,87 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanWarningRecordMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanWarningRecordMapper">
<select id="getEquipWarningInfoByPage"
resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord">
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
FROM
idx_biz_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
FROM
idx_biz_fan_warning_record
) a
<where>
<if test="arae != '' and arae != null">
AND a.arae = #{arae}
</if>
<if test="station != '' and station != null">
AND a.station = #{station}
</if>
<if test="stationType != '' and stationType != null">
AND a.stationType = #{stationType}
</if>
</where>
limit #{current}, #{size}
</select>
<select id="getEquipWarningInfoByPageCount" resultType="java.lang.Integer">
SELECT
count(1)
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
FROM
idx_biz_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
FROM
idx_biz_fan_warning_record
) a
<where>
<if test="arae != '' and arae != null">
AND a.arae = #{arae}
</if>
<if test="station != '' and station != null">
AND a.station = #{station}
</if>
<if test="stationType != '' and stationType != null">
AND a.stationType = #{stationType}
</if>
</where>
</select>
</mapper> </mapper>
...@@ -992,7 +992,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -992,7 +992,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
//构建平台数据 //构建平台数据
DataGridMock DataGridMock = new DataGridMock(current, resultList.size(), false, current, resultList); DataGridMock DataGridMock = new DataGridMock(current, resultList.size(), false, current, resultList);
ColModel colModelEquipmentNumber = new ColModel("equipmentNumber", "equipmentNumber", "风机编码", "风机编码", "dataGrid", "equipmentNumber"); ColModel colModelEquipmentNumber = new ColModel("equipmentNumber", "equipmentNumber", "风机编码", "风机编码", "dataGrid", "equipmentNumber");
ColModel colModelPower = new ColModel("power", "power", "有功功率(MV)", "有功功率(MV)", "dataGrid", "power"); ColModel colModelPower = new ColModel("power", "power", "有功功率(kW)", "有功功率(kW)", "dataGrid", "power");
ColModel colModelWindSpeed = new ColModel("windSpeed", "windSpeed", "风速(m/s)", "风速(m/s)", "dataGrid", "windSpeed"); ColModel colModelWindSpeed = new ColModel("windSpeed", "windSpeed", "风速(m/s)", "风速(m/s)", "dataGrid", "windSpeed");
ColModel colModelWind = new ColModel("wind", "wind", "风向(°)", "风向(°)", "dataGrid", "wind"); ColModel colModelWind = new ColModel("wind", "wind", "风向(°)", "风向(°)", "dataGrid", "wind");
ColModel colModelElectricity = new ColModel("electricity", "electricity", "日发电量(万KWh)", "日发电量(万KWh)", "dataGrid", "electricity"); ColModel colModelElectricity = new ColModel("electricity", "electricity", "日发电量(万KWh)", "日发电量(万KWh)", "dataGrid", "electricity");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment