Commit bd5fccc3 authored by zhangsen's avatar zhangsen

bug修改

parent d9a8b33b
......@@ -29,6 +29,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.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -228,15 +229,17 @@ public class BigScreenAnalyseController extends BaseController {
@RequestParam(value = "current", required = false) Integer current,
@RequestParam(value = "size", required = false) Integer size,
@RequestParam(value = "warningName", required = false) String warningName,
@RequestParam(value = "stationId", required = false) String stationId) {
@RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate) {
if (StrUtil.isNotEmpty(stationId)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
stationId = stationBasic.getFanGatewayId();
}
Integer count = idxBizFanWarningRecordMapper.getEquipWarningInfoByPageCount(arae, station, stationType, warningName, stationId);
List<IdxBizFanWarningRecord> idxBizFanWarningRecordIPage = idxBizFanWarningRecordMapper.getEquipWarningInfoByPage(arae, station, stationType, (current - 1) * size, size, warningName, stationId);
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);
idxBizFanWarningRecordPage.setRecords(idxBizFanWarningRecordIPage);
idxBizFanWarningRecordPage.setTotal(count);
......@@ -367,9 +370,9 @@ public class BigScreenAnalyseController extends BaseController {
if (CharSequenceUtil.isNotEmpty(stationType)) {
if ("fan".equals(stationType)) {
allEquipAlarmInfo = idxBizFanHealthIndexMapper.getAllEquipAlarmInfoAnalysisByStationType("idx_biz_fan_warning_record", areaCode, "idx_biz_fan_point_process_variable_classification", "风电");
allEquipAlarmInfo = idxBizFanHealthIndexMapper.getAllEquipAlarmInfoAnalysisByStationType("idx_biz_fan_warning_record", areaCode, "风电");
} else if ("pv".equals(stationType)) {
allEquipAlarmInfo = idxBizFanHealthIndexMapper.getAllEquipAlarmInfoAnalysisByStationType("idx_biz_pv_warning_record", areaCode, "idx_biz_pv_point_process_variable_classification", "光伏");
allEquipAlarmInfo = idxBizFanHealthIndexMapper.getAllEquipAlarmInfoAnalysisByStationType("idx_biz_pv_warning_record", areaCode, "光伏");
}
} else {
allEquipAlarmInfo = idxBizFanHealthIndexMapper.getAllEquipAlarmInfoAnalysisByArea(areaCode);
......
......@@ -16,6 +16,7 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.component.emq.EmqxListener;
import javax.annotation.PostConstruct;
import java.util.Date;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
......@@ -74,12 +75,14 @@ public class WarningRecordStatusMessage extends EmqxListener {
LambdaUpdateWrapper<IdxBizFanWarningRecord> lambda = new LambdaUpdateWrapper<>();
lambda.set(IdxBizFanWarningRecord::getDisposotionState, "已处置");
lambda.set(IdxBizFanWarningRecord::getStatus, "1");
lambda.set(IdxBizFanWarningRecord::getDisposotionDate, new Date());
lambda.eq(IdxBizFanWarningRecord::getSequenceNbr, analysisResult.get("objectId"));
idxBizFanWarningRecordService.update(lambda);
} else if (ObjectUtils.isNotEmpty(analysisResult) && analysisResult.get("warningObjectType").toString().equals("fan")) {
LambdaUpdateWrapper<IdxBizPvWarningRecord> lambda = new LambdaUpdateWrapper<>();
lambda.set(IdxBizPvWarningRecord::getDisposotionState, "已处置");
lambda.set(IdxBizPvWarningRecord::getStatus, "1");
lambda.set(IdxBizPvWarningRecord::getDisposotionDate, new Date());
lambda.eq(IdxBizPvWarningRecord::getSequenceNbr, analysisResult.get("objectId"));
idxBizPvWarningRecordService.update(lambda);
}
......
......@@ -16,6 +16,7 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.component.emq.EmqxListener;
import javax.annotation.PostConstruct;
import java.util.Date;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
......@@ -80,6 +81,7 @@ public class WarningRecordStatusMessage2 extends EmqxListener {
LambdaUpdateWrapper<IdxBizFanWarningRecord> lambda = new LambdaUpdateWrapper<>();
lambda.set(IdxBizFanWarningRecord::getDisposotionState, "已处置");
lambda.set(IdxBizFanWarningRecord::getStatus, "1");
lambda.set(IdxBizFanWarningRecord::getDisposotionDate, new Date());
List<String> traceIds = (List<String>) analysisResult.get("traceIds");
lambda.in(IdxBizFanWarningRecord::getSequenceNbr, traceIds);
idxBizFanWarningRecordService.update(lambda);
......@@ -87,6 +89,7 @@ public class WarningRecordStatusMessage2 extends EmqxListener {
LambdaUpdateWrapper<IdxBizPvWarningRecord> lambda = new LambdaUpdateWrapper<>();
lambda.set(IdxBizPvWarningRecord::getDisposotionState, "已处置");
lambda.set(IdxBizPvWarningRecord::getStatus, "1");
lambda.set(IdxBizPvWarningRecord::getDisposotionDate, new Date());
List<String> traceIds = (List<String>) analysisResult.get("traceIds");
lambda.eq(IdxBizPvWarningRecord::getSequenceNbr, traceIds);
idxBizPvWarningRecordService.update(lambda);
......
......@@ -141,4 +141,8 @@ public class IdxBizFanWarningRecord{
@TableField("HEALTH_LEVEL")
private String healthLevel;
@TableField("DISPOSOTION_DATE")
private Date disposotionDate;
}
......@@ -143,4 +143,7 @@ public class IdxBizPvWarningRecord{
private String pointName;
@TableField("HEALTH_LEVEL")
private String healthLevel;
@TableField("DISPOSOTION_DATE")
private Date disposotionDate;
}
......@@ -38,7 +38,6 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, Object>> getAllEquipAlarmInfoAnalysisByStationType(@Param("tableName") String tableName,
@Param("areaCode") String areaCode,
@Param("tableName2") String tableName2,
@Param("stationType") String stationType);
List<Map<String, Object>> getAllEquipAlarmInfoAnalysisByArea(@Param("areaCode") String areaCode);
......
......@@ -20,11 +20,15 @@ public interface IdxBizFanWarningRecordMapper extends BaseMapper<IdxBizFanWarnin
@Param("current") Integer current,
@Param("size") Integer size,
@Param("warningName") String warningName,
@Param("stationId") String stationId);
@Param("stationId") String stationId,
@Param("startDate") String startDate,
@Param("endDate") String endDate);
Integer getEquipWarningInfoByPageCount(@Param("arae") String arae,
@Param("station") String station,
@Param("stationType") String stationType,
@Param("warningName") String warningName,
@Param("stationId") String stationId);
@Param("stationId") String stationId,
@Param("startDate") String startDate,
@Param("endDate") String endDate);
}
......@@ -182,22 +182,36 @@
<select id="getAllEquipAlarmInfoByStation" resultType="java.util.Map">
SELECT
STATION as station,
WARNING_NAME as warningName,
count(1) as num
a.*
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
STATION AS station,
WARNING_NAME AS warningName,
count( 1 ) AS num,
( SELECT count( 1 ) FROM idx_biz_fan_warning_record wr WHERE wr.DISPOSOTION_STATE = '未处置' AND wr.STATION = STATION ) AS allNum
FROM
idx_biz_fan_warning_record
WHERE
DISPOSOTION_STATE = '未处置'
GROUP BY
STATION,
WARNING_NAME UNION ALL
SELECT
STATION AS station,
WARNING_NAME AS warningName,
count( 1 ) AS num,
( SELECT count( 1 ) FROM idx_biz_pv_warning_record wr WHERE wr.DISPOSOTION_STATE = '未处置' AND wr.STATION = STATION ) AS allNum
FROM
idx_biz_pv_warning_record
WHERE
DISPOSOTION_STATE = '未处置'
GROUP BY
STATION,
WARNING_NAME
) a
ORDER BY
a.allNum DESC
</select>
......@@ -278,21 +292,22 @@
<select id="getAllEquipAlarmInfoAnalysisByStationType" resultType="java.util.Map">
SELECT
<!-- ( SELECT POINT_NAME FROM ${tableName2} WHERE GATEWAY_ID = a.GATEWAY_ID AND INDEX_ADDRESS = a.INDEX_ADDRESS ) AS pointName,-->
concat(#{stationType}, '-', b.POINT_NAME) as pointName,
concat(#{stationType}, '-', a.POINT_NAME) as pointName,
a.WARNING_NAME as warningName,
count(1) as num
FROM
${tableName} a
LEFT JOIN ${tableName2} b on b.GATEWAY_ID = a.GATEWAY_ID and b.INDEX_ADDRESS = a.INDEX_ADDRESS
<where>
a.DISPOSOTION_STATE = '未处置'
<if test="areaCode != null and areaCode != ''">
a.ARAE like concat('%', #{areaCode}, '%')
and a.ARAE like concat('%', #{areaCode}, '%')
</if>
</where>
group by pointName,
a.WARNING_NAME
warningName
having pointName IS NOT NULL
AND pointName != ''
order by num desc
</select>
<select id="getAllEquipAlarmInfoAnalysisByArea" resultType="java.util.Map">
......@@ -307,8 +322,9 @@
FROM
idx_biz_pv_warning_record wr
<where>
wr.DISPOSOTION_STATE = '未处置'
<if test="areaCode != null and areaCode != ''">
wr.ARAE like concat('%', #{areaCode}, '%')
and wr.ARAE like concat('%', #{areaCode}, '%')
</if>
</where>
GROUP BY
......@@ -321,8 +337,9 @@
FROM
idx_biz_fan_warning_record wr
<where>
wr.DISPOSOTION_STATE = '未处置'
<if test="areaCode != null and areaCode != ''">
wr.ARAE like concat('%', #{areaCode}, '%')
and wr.ARAE like concat('%', #{areaCode}, '%')
</if>
</where>
GROUP BY
......@@ -332,6 +349,7 @@
WHERE
a.pointName IS NOT NULL
AND a.pointName != ''
order by a.num desc
</select>
<select id="getSubSystemInfo" resultType="java.util.Map">
......
......@@ -17,7 +17,9 @@
DISPOSOTION_STATE AS disposotionState,
ARAE AS arae,
'pv' AS stationType,
GATEWAY_ID
GATEWAY_ID,
concat(POINT_NAME, '异常') AS pointName,
DISPOSOTION_DATE as disposotionDate
FROM
idx_biz_pv_warning_record UNION ALL
SELECT
......@@ -29,11 +31,14 @@
DISPOSOTION_STATE AS disposotionState,
ARAE AS arae,
'fan' AS stationType,
GATEWAY_ID
GATEWAY_ID,
concat(POINT_NAME, '异常') AS pointName,
DISPOSOTION_DATE as disposotionDate
FROM
idx_biz_fan_warning_record
) a
<where>
((a.disposotionState = '未处置') or (a.disposotionState = '已处置' AND DATE_FORMAT( a.disposotionState, '%Y-%m-%d' ) = CURRENT_DATE))
<if test="arae != '' and arae != null">
AND a.arae like concat('%', #{arae}, '%')
</if>
......@@ -49,14 +54,21 @@
<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(#{startDate}, ' 59:59:59') >= a.recDate
</if>
</where>
order by recDate DESC
order by warningName DESC, recDate DESC
limit #{current}, #{size}
</select>
<select id="getEquipWarningInfoByPageCount" resultType="java.lang.Integer">
SELECT
count(1)
select count(1) from
(SELECT
a.*
FROM
(
SELECT
......@@ -68,7 +80,8 @@
DISPOSOTION_STATE AS disposotionState,
ARAE AS arae,
'pv' AS stationType,
GATEWAY_ID
GATEWAY_ID,
DISPOSOTION_DATE as disposotionDate
FROM
idx_biz_pv_warning_record UNION ALL
SELECT
......@@ -80,11 +93,13 @@
DISPOSOTION_STATE AS disposotionState,
ARAE AS arae,
'fan' AS stationType,
GATEWAY_ID
GATEWAY_ID,
DISPOSOTION_DATE as disposotionDate
FROM
idx_biz_fan_warning_record
) a
<where>
((a.disposotionState = '未处置') or (a.disposotionState = '已处置' AND DATE_FORMAT( a.disposotionDate, '%Y-%m-%d' ) = CURRENT_DATE))
<if test="arae != '' and arae != null">
AND a.arae like concat('%', #{arae}, '%')
</if>
......@@ -92,7 +107,7 @@
AND a.station = #{station}
</if>
<if test="stationType != '' and stationType != null">
AND a.stationType = #{stationType}
AND a.stationType = #{stationType}
</if>
<if test="warningName != '' and warningName != null">
AND a.warningName = #{warningName}
......@@ -100,6 +115,12 @@
<if test="stationId != '' and stationId != null">
AND a.GATEWAY_ID = #{stationId}
</if>
</where>
<if test="startDate != '' and startDate != null">
AND a.recDate >= concat(#{startDate}, ' 00:00:00')
</if>
<if test="endDate != '' and endDate != null">
AND concat(#{startDate}, ' 59:59:59') >= a.recDate
</if>
</where>) b
</select>
</mapper>
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