Commit cf32f8d8 authored by duanruiming's avatar duanruiming

[add] 态势检测-路口列表手动控制

parent 287fc781
...@@ -3,6 +3,7 @@ package net.wanji.web.controller; ...@@ -3,6 +3,7 @@ package net.wanji.web.controller;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import net.wanji.feign.pojo.result.JsonViewObject; import net.wanji.feign.pojo.result.JsonViewObject;
import net.wanji.web.entity.TCrossControlHist;
import net.wanji.web.entity.TDeviceStatusLog; import net.wanji.web.entity.TDeviceStatusLog;
import net.wanji.web.po.AreaTreePO; import net.wanji.web.po.AreaTreePO;
import net.wanji.web.service.SituationDetectionService; import net.wanji.web.service.SituationDetectionService;
...@@ -202,4 +203,12 @@ public class SituationDetectionController extends BaseController { ...@@ -202,4 +203,12 @@ public class SituationDetectionController extends BaseController {
return jsonViewObject.success(result); return jsonViewObject.success(result);
} }
@ApiOperation(value = "路口列表-手动控制", notes = "路口列表-手动控制")
@GetMapping("/listSignalControlInfos")
public JsonViewObject listSignalControlInfos() {
Map<String, List<TCrossControlHist>> result = situationDetectionService.listSignalControlList();
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(result);
}
} }
...@@ -20,4 +20,6 @@ public interface ControlHistMapper { ...@@ -20,4 +20,6 @@ public interface ControlHistMapper {
int insertOne(@Param("crossId") String crossId, @Param("type") Integer type, @Param("operationUser") String operationUser); int insertOne(@Param("crossId") String crossId, @Param("type") Integer type, @Param("operationUser") String operationUser);
TCrossControlHist selectRecentOne(@Param("crossId") String crossId); TCrossControlHist selectRecentOne(@Param("crossId") String crossId);
List<TCrossControlHist> selectRecentList();
} }
package net.wanji.web.service; package net.wanji.web.service;
import net.wanji.web.entity.TBaseCrossInfo; import net.wanji.web.entity.TBaseCrossInfo;
import net.wanji.web.entity.TCrossControlHist;
import net.wanji.web.entity.TDeviceStatusLog; import net.wanji.web.entity.TDeviceStatusLog;
import net.wanji.web.po.AreaTreePO; import net.wanji.web.po.AreaTreePO;
import net.wanji.web.vo.situationDetection.*; import net.wanji.web.vo.situationDetection.*;
...@@ -44,4 +45,6 @@ public interface SituationDetectionService { ...@@ -44,4 +45,6 @@ public interface SituationDetectionService {
List<TDeviceStatusLog> listSignalFaultInfos(); List<TDeviceStatusLog> listSignalFaultInfos();
DeviceFaultCountVO countSignalFaultInfos(); DeviceFaultCountVO countSignalFaultInfos();
Map<String, List<TCrossControlHist>> listSignalControlList();
} }
...@@ -480,6 +480,22 @@ public class SituationDetectionServiceImpl implements SituationDetectionService ...@@ -480,6 +480,22 @@ public class SituationDetectionServiceImpl implements SituationDetectionService
countVO.setAllCount(tDeviceStatusInfos.size()); countVO.setAllCount(tDeviceStatusInfos.size());
return countVO; return countVO;
} }
@Override
public Map<String, List<TCrossControlHist>> listSignalControlList() {
Map<String, List<TCrossControlHist>> resultMap = new HashMap<>();
List<TCrossControlHist> tCrossControlHists = controlHistMapper.selectRecentList();
List<TCrossControlHist> centerOptList = tCrossControlHists.stream().filter(tCrossControlHist -> tCrossControlHist.getType() == 5).collect(Collectors.toList());
resultMap.put("1", centerOptList); // 中心优化
List<TCrossControlHist> manualControlList = tCrossControlHists.stream().filter(item -> item.getType() < 5 && item.getType() > 1).collect(Collectors.toList());
resultMap.put("2", manualControlList); // 手动控制
List<TCrossControlHist> edgeOptList = tCrossControlHists.stream().filter(tCrossControlHist -> tCrossControlHist.getType() == 6).collect(Collectors.toList());
resultMap.put("3", edgeOptList); // 边缘优化
List<TCrossControlHist> specialServiceList = tCrossControlHists.stream().filter(tCrossControlHist -> tCrossControlHist.getType() == 7).collect(Collectors.toList());
resultMap.put("4", specialServiceList); // 特勤控制
return resultMap;
}
} }
class CrossAlarmComparator implements Comparator<CrossAlarmOutVO> { class CrossAlarmComparator implements Comparator<CrossAlarmOutVO> {
......
...@@ -24,11 +24,12 @@ ...@@ -24,11 +24,12 @@
</sql> </sql>
<select id="selectByCrossId" resultMap="BaseResultMap"> <select id="selectByCrossId" resultMap="BaseResultMap">
select concat(hour(start_time), ':', floor(minute(start_time)/30)*30) as controlTime, select concat(hour(start_time), ':', floor(minute(start_time)/30) * 30) as controlTime,
type as controlType, type as controlType,
count(*) as typeCount count(*) as typeCount
from t_cross_control_hist from t_cross_control_hist
where cross_id = #{crossId} and to_days(#{todayDate}) = to_days(start_time) where cross_id = #{crossId}
and to_days(#{todayDate}) = to_days(start_time)
group by controlTime, controlType group by controlTime, controlType
order by controlTime order by controlTime
</select> </select>
...@@ -40,7 +41,7 @@ ...@@ -40,7 +41,7 @@
<select id="selectRecentOne" resultType="net.wanji.web.entity.TCrossControlHist"> <select id="selectRecentOne" resultType="net.wanji.web.entity.TCrossControlHist">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from t_cross_control_hist from t_cross_control_hist
<where> <where>
<if test="crossId != null and crossId !=''"> <if test="crossId != null and crossId !=''">
...@@ -49,4 +50,15 @@ ...@@ -49,4 +50,15 @@
and start_time = (select max(start_time) from t_cross_control_hist) and start_time = (select max(start_time) from t_cross_control_hist)
</where> </where>
</select> </select>
<select id="selectRecentList" resultMap="tCrossControlHist">
select
<include refid="Base_Column_List"/>
from t_cross_control_hist
where start_time in (select max(start_time)
from t_cross_control_hist
where cross_id in (select id as cross_id
from t_base_cross_info)
group by cross_id);
</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