zbj//大屏获取暂降事件最新50条数据
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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') >= date_format(#{startTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
and date_format(ed.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
|
||||
</if>
|
||||
</where>
|
||||
order by time desc
|
||||
limit 50
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -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;
|
||||
@@ -196,14 +197,14 @@ public class LargeScreenServiceImpl implements LargeScreenService {
|
||||
Map<LocalDate, Integer> eventMap = new HashedMap();
|
||||
|
||||
for (Map<String, Object> map : maps) {
|
||||
eventMap.put(LocalDate.parse(map.get("day").toString()),Integer.parseInt(map.get("count").toString()));
|
||||
eventMap.put(LocalDate.parse(map.get("day").toString()), Integer.parseInt(map.get("count").toString()));
|
||||
}
|
||||
|
||||
// 创建返回结果的Map集合
|
||||
Map<LocalDate, Integer> resultMap = new HashMap<>();
|
||||
// 定义事件日期区间
|
||||
LocalDate start = LocalDate.parse(largeScreenParam.getSearchBeginTime()); // 开始日期
|
||||
LocalDate end = LocalDate.parse( largeScreenParam.getSearchEndTime()); // 结束日期
|
||||
LocalDate end = LocalDate.parse(largeScreenParam.getSearchEndTime()); // 结束日期
|
||||
// 循环遍历事件日期区间中的每一天,并尝试从事件日期的Map集合中获取对应的值
|
||||
for (LocalDate date = start; !date.isAfter(end); date = date.plusDays(1)) {
|
||||
Integer value = eventMap.get(date);
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user