Commit bd5fccc3 authored by zhangsen's avatar zhangsen

bug修改

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