zbj//大屏获取暂降事件最新50条数据

This commit is contained in:
zhangbaojian
2023-04-03 14:58:20 +08:00
parent 965f7af233
commit 91bdf291ab
6 changed files with 116 additions and 6 deletions

View File

@@ -0,0 +1,53 @@
package com.njcn.device.pq.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @version 1.0.0
* @author: zbj
* @date: 2023/04/03
*/
@Data
public class EventVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 发生时间
*/
@ApiModelProperty("发生时间")
private String time;
/**
* 监测点名称
*/
@ApiModelProperty("监测点名称")
private String name;
/**
* 暂降原因
*/
@ApiModelProperty("暂降原因")
private String reason;
/**
* 暂降类型
*/
@ApiModelProperty("暂降类型")
private String type;
/**
* 暂降幅值
*/
@ApiModelProperty("暂降幅值")
private String amplitude;
/**
* 持续时间
*/
@ApiModelProperty("持续时间")
private String duration;
}

View File

@@ -6,10 +6,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pq.pojo.param.LargeScreenParam;
import com.njcn.device.pq.pojo.vo.AreaDownVO;
import com.njcn.device.pq.pojo.vo.DownTimeVO;
import com.njcn.device.pq.pojo.vo.LoadTypeVO;
import com.njcn.device.pq.pojo.vo.MonitoringPointScaleVO;
import com.njcn.device.pq.pojo.vo.*;
import com.njcn.event.service.majornetwork.LargeScreenService;
import com.njcn.web.controller.BaseController;
@@ -78,4 +75,17 @@ public class LargeScreenController extends BaseController {
List<DownTimeVO> result = largeScreenService.getTimeCount(largeScreenParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
/**
* 大屏获取暂降事件最新50条数据
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/eventLists")
@ApiOperation("大屏获取暂降事件最新50条数据")
@ApiImplicitParam(name = "largeScreenParam", value = "大屏获取暂降事件最新50条数据", required = true)
public HttpResult<List<EventVO>> eventLists(@RequestBody @Validated LargeScreenParam largeScreenParam) {
String methodDescribe = getMethodDescribe("eventLists");
List<EventVO> result = largeScreenService.eventLists(largeScreenParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
}

View File

@@ -18,4 +18,5 @@ public interface LargeScreenMapper {
List<Map<String, Object>> getTimeCount(@Param("lineIds") List<String> lineIds, @Param("startTime") String startTime, @Param("endTime") String endTime);
List<Map<String, Object>> eventLists(@Param("startTime") String startTime, @Param("endTime") String endTime);
}

View File

@@ -53,4 +53,24 @@
</if>
group by day
</select>
<select id="eventLists" resultType="java.util.Map">
SELECT
ed.create_time "time",pl.`Name` "name",sdd.`Name` reason,sdd.`Name` "type",ed.feature_amplitude amplitude,ed.duration
from r_mp_event_detail ed
left join pq_line pl on pl.id = ed.measurement_point_id
left join sys_dict_data sdd on sdd.id = ed.advance_reason
left join sys_dict_data sdd2 on sdd.id = ed.advance_type
<where>
<if test="startTime != null and startTime != ''">
and date_format(ed.create_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d')
</if>
<if test="endTime != null and endTime != ''">
and date_format(ed.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if>
</where>
order by time desc
limit 50
</select>
</mapper>

View File

@@ -7,6 +7,7 @@ import com.njcn.device.pq.pojo.param.LargeScreenParam;
import com.njcn.device.pq.pojo.param.MonitoringPointScaleParam;
import com.njcn.device.pq.pojo.vo.AreaDownVO;
import com.njcn.device.pq.pojo.vo.DownTimeVO;
import com.njcn.device.pq.pojo.vo.EventVO;
import com.njcn.device.pq.pojo.vo.LoadTypeVO;
import com.njcn.event.mapper.majornetwork.LargeScreenMapper;
import com.njcn.event.service.majornetwork.LargeScreenService;
@@ -227,4 +228,26 @@ public class LargeScreenServiceImpl implements LargeScreenService {
}
return result;
}
/**
* 大屏获取暂降事件最新50条数据
*/
@Override
public List<EventVO> eventLists(LargeScreenParam largeScreenParam) {
List<EventVO> result = new ArrayList<>();
List<Map<String, Object>> maps = largeScreenMapper.eventLists(largeScreenParam.getSearchBeginTime(), largeScreenParam.getSearchEndTime());
for (Map<String, Object> map : maps) {
EventVO eventVO = new EventVO();
eventVO.setTime(map.get("time").toString());
eventVO.setName(map.get("name").toString());
eventVO.setReason(map.get("reason").toString());
eventVO.setType(map.get("type").toString());
eventVO.setAmplitude(map.get("amplitude").toString());
eventVO.setDuration(map.get("duration").toString());
result.add(eventVO);
}
return result;
}
}

View File

@@ -3,6 +3,7 @@ package com.njcn.event.service.majornetwork;
import com.njcn.device.pq.pojo.param.LargeScreenParam;
import com.njcn.device.pq.pojo.vo.AreaDownVO;
import com.njcn.device.pq.pojo.vo.DownTimeVO;
import com.njcn.device.pq.pojo.vo.EventVO;
import com.njcn.device.pq.pojo.vo.LoadTypeVO;
import java.util.List;
@@ -20,4 +21,6 @@ public interface LargeScreenService {
List<LoadTypeVO> getLoadType(LargeScreenParam largeScreenParam);
List<DownTimeVO> getTimeCount(LargeScreenParam largeScreenParam);
List<EventVO> eventLists(LargeScreenParam largeScreenParam);
}