Commit 5c08ba31 authored by zhoushiguang's avatar zhoushiguang

Merge remote-tracking branch 'origin/master'

parents 45bfebfd dd2fd02a
...@@ -19,8 +19,8 @@ public enum EventInfoTypeEnum { ...@@ -19,8 +19,8 @@ public enum EventInfoTypeEnum {
CROSS_OVERFLOW(3, "703","路口溢出"), CROSS_OVERFLOW(3, "703","路口溢出"),
// 当前没有 // 当前没有
//CROSS_DEADLOCK(4, "704","路口死锁"), //CROSS_DEADLOCK(4, "704","路口死锁"),
GREEN_SLOW(6, "705","干线-缓行"), GREEN_SLOW(6, "705","干线缓行"),
GREEN_CONGEST(7, "706","干线-拥堵"), GREEN_CONGEST(7, "706","干线拥堵"),
CROSS_CONGEST(2, "707","路口拥堵"), CROSS_CONGEST(2, "707","路口拥堵"),
GREEN_SMOOTH(8, "708","干线畅通"); GREEN_SMOOTH(8, "708","干线畅通");
......
...@@ -7,6 +7,8 @@ import io.swagger.annotations.ApiResponses; ...@@ -7,6 +7,8 @@ import io.swagger.annotations.ApiResponses;
import net.wanji.common.annotation.aspect.AspectLog; import net.wanji.common.annotation.aspect.AspectLog;
import net.wanji.common.enums.BaseEnum; import net.wanji.common.enums.BaseEnum;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.bo.CrossIdBO;
import net.wanji.databus.vo.ControlCommandVO;
import net.wanji.databus.vo.SchemeOptSendVO; import net.wanji.databus.vo.SchemeOptSendVO;
import net.wanji.opt.service.signalcontrol.FeignProxyService; import net.wanji.opt.service.signalcontrol.FeignProxyService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -23,7 +25,7 @@ import javax.ws.rs.core.MediaType; ...@@ -23,7 +25,7 @@ import javax.ws.rs.core.MediaType;
* @author duanruiming * @author duanruiming
* @date 2023/03/01 20:44 * @date 2023/03/01 20:44
*/ */
@Api(value = "SignalCommandOptController", description = "信号优化") @Api(value = "SignalCommandOptController", description = "信号机控制")
@RequestMapping("/signalControl") @RequestMapping("/signalControl")
@RestController @RestController
public class SignalCommandOptController { public class SignalCommandOptController {
...@@ -53,4 +55,64 @@ public class SignalCommandOptController { ...@@ -53,4 +55,64 @@ public class SignalCommandOptController {
return jsonViewObject; return jsonViewObject;
} }
@AspectLog(description = "全红控制", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "全红控制", notes = "全红控制", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/allRedControl",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class)})
public JsonViewObject allRedControl(@RequestBody ControlCommandVO vo) throws Exception {
//JsonViewObject jsonViewObject = feignProxyService.allRedControl(vo);
JsonViewObject jsonViewObject = JsonViewObject.newInstance().success();
return jsonViewObject;
}
@AspectLog(description = "黄闪控制", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "黄闪控制", notes = "黄闪控制", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/yellowLightControl",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class)})
public JsonViewObject yellowLightControl(@RequestBody ControlCommandVO vo) throws Exception {
//JsonViewObject jsonViewObject = feignProxyService.yellowLightControl(vo);
JsonViewObject jsonViewObject = JsonViewObject.newInstance().success();
return jsonViewObject;
}
@AspectLog(description = "步进控制", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "步进控制", notes = "步进控制", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/stepControl",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class)})
public JsonViewObject stepControl(String crossId, Integer command, Integer stepNum) throws Exception {
//JsonViewObject jsonViewObject = feignProxyService.stepControl(crossId, command, stepNum);
JsonViewObject jsonViewObject = JsonViewObject.newInstance().success();
return jsonViewObject;
}
@AspectLog(description = "相位锁定", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "相位锁定", notes = "相位锁定", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/lockControl",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class)})
public JsonViewObject lockControl(@RequestBody ControlCommandVO vo) throws Exception {
//JsonViewObject jsonViewObject = feignProxyService.lockControl(vo);
JsonViewObject jsonViewObject = JsonViewObject.newInstance().success();
return jsonViewObject;
}
@AspectLog(description = "恢复时间表", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "恢复时间表", notes = "恢复时间表", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/recoverSchedule",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class)})
public JsonViewObject recoverSchedule(@RequestBody CrossIdBO crossIdBO) throws Exception {
//JsonViewObject jsonViewObject = feignProxyService.recoverSchedule(crossIdBO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance().success();
return jsonViewObject;
}
} }
package net.wanji.opt.controllerv2;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.servicev2.CrossService;
import net.wanji.opt.synthesis.pojo.CrossRealTimeAlarmEntity;
import net.wanji.opt.synthesis.pojo.CrossStatusDisOptTimeEntity;
import net.wanji.opt.vo2.CrossRealTimeAlarmVO;
import net.wanji.opt.vo2.CrossStatusDistributionVO;
import org.springframework.http.HttpMethod;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.*;
/**
* @author zhengyifan
* @date 2025/3/15
*/
@Api(value = "CrossController", description = "监测详情-路口事件详情")
@RequestMapping(value = "/cross")
@RestController
@Slf4j
public class CrossController {
@Resource
private CrossService crossService;
//@ApiOperation(value = "路口状态分布", notes = "路口状态分布", response = JsonViewObject.class, httpMethod="GET")
@GetMapping("/getCrossStatusDistribution")
@ApiOperation(httpMethod="GET",value="路口状态分布", notes="路口状态分布")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossID", value = "路口ID", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "groupType", value = "时间粒度 0--5分钟 1--15分钟 2--30分钟 3--60分钟", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "date", value = "日期 格式:yyyy-MM-dd", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "objectType", value = "范围 1:方向级指标 2:转向级指标 3:车道级指标 4:路口级指标", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "directionName", value = "方向", required = false, dataType = "String",defaultValue = "北进口"),
})
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossStatusDistributionVO.class),
})
public JsonViewObject getCrossStatusDistribution(String crossID, String date, String groupType, Integer objectType, @RequestParam(defaultValue = "") String directionName) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
Map<String, List<?>> result;
try {
result = crossService.getCrossStatusDistribution(crossID, date, groupType, objectType, directionName);
} catch (Exception e) {
log.error("监测详情-路口事件详情-路口状态分布: ", e);
return jsonViewObject.fail("路口状态分布查询失败");
}
return jsonViewObject.success(result);
}
@ApiOperation(value = "路口实时告警", notes = "路口实时告警", response = JsonViewObject.class, httpMethod="GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossID", value = "路口ID", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "time", value = "时间 格式:yyyy-MM-dd HH:ii:ss", dataType = "String", paramType = "query"),
})
@GetMapping(value = "/getCrossRealTimeAlarm")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossRealTimeAlarmVO.class),
})
public JsonViewObject getCrossRealTimeAlarm(String crossID, @RequestParam(defaultValue = "") String time) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
List<CrossRealTimeAlarmEntity> result;
try {
result = crossService.getCrossRealTimeAlarm(crossID, time);
} catch (Exception e) {
log.error("监测详情-路口事件详情-路口实时告警: ", e);
return jsonViewObject.fail("路口实时告警查询失败");
}
return jsonViewObject.success(result);
}
}
...@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiResponse; ...@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.utils.tool.StringUtils;
import net.wanji.opt.servicev2.TrendServiceV2; import net.wanji.opt.servicev2.TrendServiceV2;
import net.wanji.opt.vo2.*; import net.wanji.opt.vo2.*;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -145,10 +146,16 @@ public class TrendControllerV2 { ...@@ -145,10 +146,16 @@ public class TrendControllerV2 {
@ApiResponses({ @ApiResponses({
@ApiResponse(code = 200, message = "OK", response = OptMonitoringVO.class), @ApiResponse(code = 200, message = "OK", response = OptMonitoringVO.class),
}) })
public JsonViewObject eventAlarmRealTimeList() throws Exception { public JsonViewObject eventAlarmRealTimeList(String type) throws Exception {
List<OptMonitoringVO> list = Collections.emptyList(); List<OptMonitoringVO> list = Collections.emptyList();
try { try {
if (StringUtils.isBlank(type)) {
list = trendServiceV2.eventAlarmRealTimeList(); list = trendServiceV2.eventAlarmRealTimeList();
} else {
list = trendServiceV2.eventAlarmRealTimeList().stream()
.filter(vo -> StringUtils.equalsIgnoreCase(type, vo.getType()))
.collect(Collectors.toList());
}
} catch (Exception e) { } catch (Exception e) {
log.error("态势监测-事件告警-实时列表:", e); log.error("态势监测-事件告警-实时列表:", e);
JsonViewObject.newInstance().success(list); JsonViewObject.newInstance().success(list);
...@@ -211,4 +218,22 @@ public class TrendControllerV2 { ...@@ -211,4 +218,22 @@ public class TrendControllerV2 {
} }
return JsonViewObject.newInstance().success(results); return JsonViewObject.newInstance().success(results);
} }
@ApiOperation(value = "态势监测-策略推荐-优化策略", notes = "态势监测-策略推荐-优化策略",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/optStrategyResultInfo")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = OptMonitoringVO.class),
})
public JsonViewObject optStrategyResultInfo(String id) throws Exception {
String result = "畅通-专家方案";
try {
result = trendServiceV2.optStrategyResultInfo(id);
} catch (Exception e) {
log.error("态势监测-事件告警-历史列表:", e);
JsonViewObject.newInstance().success(result);
}
return JsonViewObject.newInstance().success(result);
}
} }
\ No newline at end of file
package net.wanji.opt.controllerv2;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.po.base.EventStatisticPo;
import net.wanji.opt.servicev2.TrendServiceV2;
import net.wanji.opt.servicev2.TrunkLineService;
import net.wanji.opt.servicev2.TrunkLineStatusDisService;
import net.wanji.opt.synthesis.pojo.TrunkLineProblemDescribeEntity;
import net.wanji.opt.vo2.*;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.ws.rs.core.MediaType;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author zhengyifan
* @date 2025/3/14
*/
@Api(value = "TrunkLineController", description = "监测详情-干线")
@RequestMapping("/trunkLine")
@RestController
@Slf4j
public class TrunkLineController {
@Resource
private TrunkLineStatusDisService trunkLineStatusDisService;
@Resource
private TrunkLineService trunkLineService;
@GetMapping("/statusDisInfoList")
@ApiOperation(httpMethod="GET",value="干线数据", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "greenID", value = "干线ID", required = true, dataType = "String",defaultValue = ""),
@ApiImplicitParam(name = "date", value = "日期", required = true, dataType = "String",defaultValue = ""),
@ApiImplicitParam(name = "timeGranule", value = "时间颗粒度", required = true, dataType = "String",defaultValue = ""),
})
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = EventStatisticPo.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject statusDisInfoList(String greenID, String date, String timeGranule) {
try {
JsonViewObject object = JsonViewObject.newInstance();
JSONObject list = trunkLineStatusDisService.trunkLineStatusDisInfoList(greenID, date, timeGranule);
return object.success(list);
} catch (Exception e) {
log.error("监测详情-干线事件详情-干线交通状态分布趋势: ", e);
return JsonViewObject.newInstance().fail("请求失败");
}
}
@GetMapping("/problemDescribe")
@ApiOperation(httpMethod="GET",value="干线问题描述", notes="干线问题描述", response = JsonViewObject.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "greenID", value = "干线ID", required = true, dataType = "String",defaultValue = ""),
@ApiImplicitParam(name = "time", value = "日期", required = false, dataType = "String",defaultValue = ""),
})
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = TrunkLineProblemDescribeVO.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject problemDescribe(String greenID , String time ) {
try {
JsonViewObject object = JsonViewObject.newInstance();
List<TrunkLineProblemDescribeEntity> list = trunkLineService.getTrunkLineProblemDescribe(greenID,time);
return object.success(list);
} catch (Exception e) {
log.error("监测详情-干线详情-干线问题描述: ", e);
return JsonViewObject.newInstance().fail("干线问题描述查询失败");
}
}
@ApiOperation(value = "干线实时告警", notes = "干线实时告警", response = JsonViewObject.class, httpMethod="GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "greenID", value = "绿波ID", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "time", value = "时间 格式:yyyy-MM-dd HH:ii:ss", dataType = "String", paramType = "query"),
})
@GetMapping(value = "/getTrunkLineRealTimeAlarm")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossRealTimeAlarmVO.class),
})
public JsonViewObject getTrunkLineRealTimeAlarm(Integer greenID, @RequestParam(defaultValue = "") String time) {
try {
JsonViewObject object = JsonViewObject.newInstance();
List<CrossRealTimeAlarmVO> list = trunkLineService.getTrunkLineRealTimeAlarm(greenID,time);
return object.success(list);
} catch (Exception e) {
log.error("获取干线实时告警失败: ", e);
return JsonViewObject.newInstance().fail("获取干线实时告警失败");
}
}
}
package net.wanji.opt.dao.mapper;
import net.wanji.databus.po.CrossDataHistPO;
import net.wanji.opt.synthesis.pojo.CrossRealTimeAlarmEntity;
import net.wanji.opt.synthesis.pojo.CrossStatusDisOptTimeEntity;
import net.wanji.opt.synthesis.pojo.StrategyCrossResultEntity;
import java.util.List;
import java.util.Map;
/**
* <p>
* 监测详情-路口事件详情
* </p>
* @author zhengyifan
* @date 2025/3/15
*/
public interface CrossMapper {
/**
* 监测详情-路口事件详情-路口状态分布趋势-优化时间
* @param crossID 路口ID
* @return
*/
List<CrossStatusDisOptTimeEntity> getOptTimes(String crossID);
/**
* 监测详情-路口事件详情-路口实时告警
* @param crossID
* @param time
* @return
*/
List<CrossRealTimeAlarmEntity> getCrossRealTimeAlarms(String crossID, String time);
}
package net.wanji.opt.dao.mapper;
import io.lettuce.core.dynamic.annotation.Param;
import net.wanji.opt.synthesis.pojo.TrunkLineProblemDescribeEntity;
import net.wanji.opt.vo2.CrossRealTimeAlarmVO;
import java.util.List;
/**
* <p>
* 监测详情-干线详情
* </p>
* @author zhengyifan
* @date 2025/3/16
*/
public interface TrunkLineMapper{
/**
* 获取干线问题描述
* @return
*/
List<TrunkLineProblemDescribeEntity> getTrunkLineProblemDescribe(@Param("greenID") String greenID , @Param("time") String time);
/**
* 获取干线实时告警
* @return
*/
List<CrossRealTimeAlarmVO> getTrunkLineRealTimeAlarm(@Param("greenID") Integer greenID,@Param("time") String time);
}
package net.wanji.opt.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.opt.entity.GreenwaveHist;
import net.wanji.opt.vo2.TrunkLineStatusDisInfoVO;
import java.util.List;
import java.util.Map;
/**
* <p>
* 监测详情-干线
* </p>
*
* @author zhengyifan
* @date 2025-3-14
*/
public interface TrunkLineStatusDisMapper extends BaseMapper<GreenwaveHist> {
/**
* 监测详情-干线事件-干线交通状态分布趋势
* @param params
* @return
*/
List<TrunkLineStatusDisInfoVO> findStatusDistribution(Map<String, Object> params);
List<TrunkLineStatusDisInfoVO> findPlanTime(Map<String, Object> params);
}
package net.wanji.opt.service.signalcontrol; package net.wanji.opt.service.signalcontrol;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.bo.CrossIdBO;
import net.wanji.databus.vo.ControlCommandVO;
import net.wanji.databus.vo.SchemeOptSendVO; import net.wanji.databus.vo.SchemeOptSendVO;
/** /**
...@@ -10,4 +12,20 @@ import net.wanji.databus.vo.SchemeOptSendVO; ...@@ -10,4 +12,20 @@ import net.wanji.databus.vo.SchemeOptSendVO;
public interface FeignProxyService { public interface FeignProxyService {
JsonViewObject schemeOptSend(SchemeOptSendVO schemeOptSendVO) throws Exception; JsonViewObject schemeOptSend(SchemeOptSendVO schemeOptSendVO) throws Exception;
JsonViewObject schemeOptRestore(String crossId) throws Exception; JsonViewObject schemeOptRestore(String crossId) throws Exception;
/** 增加路口红闪,黄闪,步进,相位锁定服务 20250315 /
*
* @param vo
* @return
* @throws Exception
*/
JsonViewObject allRedControl(ControlCommandVO vo) throws Exception;
JsonViewObject yellowLightControl(ControlCommandVO vo) throws Exception;
JsonViewObject stepControl(String crossId, Integer command, Integer stepNum) throws Exception;
JsonViewObject lockControl(ControlCommandVO vo) throws Exception;
JsonViewObject recoverSchedule(CrossIdBO crossIdBO) throws Exception;
} }
...@@ -4,7 +4,10 @@ import lombok.RequiredArgsConstructor; ...@@ -4,7 +4,10 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.exception.FeignServiceException; import net.wanji.common.framework.exception.FeignServiceException;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.bo.CrossIdBO;
import net.wanji.databus.entity.develop.servicedevelop.develop.StatusCodeEnum; import net.wanji.databus.entity.develop.servicedevelop.develop.StatusCodeEnum;
import net.wanji.databus.vo.ControlCommandVO;
import net.wanji.databus.vo.LockControlVO;
import net.wanji.databus.vo.SchemeSendVO; import net.wanji.databus.vo.SchemeSendVO;
import net.wanji.feign.service.UtcFeignClients; import net.wanji.feign.service.UtcFeignClients;
import net.wanji.opt.cache.CrossDirTurnPhaseCache; import net.wanji.opt.cache.CrossDirTurnPhaseCache;
...@@ -127,4 +130,35 @@ public class FeignProxyServiceImpl implements FeignProxyService { ...@@ -127,4 +130,35 @@ public class FeignProxyServiceImpl implements FeignProxyService {
} }
return crossSchemeOptLogPOS; return crossSchemeOptLogPOS;
} }
@Override
public JsonViewObject allRedControl(ControlCommandVO vo) throws Exception {
return utcFeignClients.allRedControl(vo);
}
@Override
public JsonViewObject yellowLightControl(ControlCommandVO vo) throws Exception {
return utcFeignClients.yellowLightControl(vo);
}
@Override
public JsonViewObject stepControl(String crossId, Integer command, Integer stepNum) throws Exception {
return utcFeignClients.stepControl(crossId, command, stepNum);
}
@Override
public JsonViewObject lockControl(ControlCommandVO vo) throws Exception {
LockControlVO lockControlVO = new LockControlVO();
lockControlVO.setCrossCode(vo.getCrossCode());
lockControlVO.setCommand(vo.getCommand());
lockControlVO.setDuration(vo.getDuration());
lockControlVO.setPhaseList(vo.getPhaseList());
return utcFeignClients.lockControl(lockControlVO);
}
@Override
public JsonViewObject recoverSchedule(CrossIdBO crossIdBO) throws Exception {
return utcFeignClients.recoverSchedule(crossIdBO.getCrossId());
}
} }
package net.wanji.opt.servicev2;
import net.wanji.opt.synthesis.pojo.CrossRealTimeAlarmEntity;
import net.wanji.opt.vo2.CrossStatusDistributionVO;
import java.util.List;
import java.util.Map;
/**
* <p>
* 监测详情-路口事件详情
* </p>
* @author zhengyifan
* @date 2025/3/15
*/
public interface CrossService {
/**
* 获取路口状态分布
* @param crossID 路口ID
* @param date 日期
* @param groupType 时间粒度 参数要求:0--5分钟 1--15分钟 2--30分钟 3--60分钟
* @param objectType 范围 参数要求:1--方向级 2--转向级 3--车道级 4--路口级
* @param directionName 方向
* @return 包含状态分布信息列表与优化时间列表
*/
Map<String, List<?>> getCrossStatusDistribution(String crossID, String date, String groupType, Integer objectType, String directionName);
/**
* 获取路口实时告警
* @param crossID
* @param time 可选参数
* @return
*/
List<CrossRealTimeAlarmEntity> getCrossRealTimeAlarm(String crossID, String time);
}
...@@ -29,4 +29,6 @@ public interface TrendServiceV2 { ...@@ -29,4 +29,6 @@ public interface TrendServiceV2 {
PageInfo<StatisticsEventTypeCountTimeVO> selectCrossGreenHistList(int pageNo, int pageSize) throws Exception; PageInfo<StatisticsEventTypeCountTimeVO> selectCrossGreenHistList(int pageNo, int pageSize) throws Exception;
String optStrategyResultInfo(String id) throws Exception;
} }
\ No newline at end of file
package net.wanji.opt.servicev2;
import net.wanji.opt.synthesis.pojo.TrunkLineProblemDescribeEntity;
import net.wanji.opt.vo2.CrossRealTimeAlarmVO;
import net.wanji.opt.vo2.TrunkLineProblemDescribeVO;
import java.util.List;
/**
* 监测详情-干线事件
* @author zhengyifan
* @date 2025/3/16
*/
public interface TrunkLineService {
/**
* 获取干线事件描述
* @return
*/
List<TrunkLineProblemDescribeEntity> getTrunkLineProblemDescribe(String greenID , String time);
/**
* 获取干线实时告警
*/
List<CrossRealTimeAlarmVO> getTrunkLineRealTimeAlarm(Integer greenID, String time);
}
package net.wanji.opt.servicev2;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import net.wanji.opt.vo2.TrunkLineStatusDisInfoVO;
import java.util.List;
/**
* @author zhengyifan
* @date 2025/3/14
*/
public interface TrunkLineStatusDisService {
/**
* 监测详情-干线事件分布趋势
* @param greenID 绿波ID
* @param date 日期
* @param timeGranule 时间粒度 支持5min 15min 30min 60min
* @return
*/
JSONObject trunkLineStatusDisInfoList(String greenID, String date, String timeGranule);
}
package net.wanji.opt.servicev2.implv2;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.enums.BaseEnum;
import net.wanji.common.utils.tool.StringUtils;
import net.wanji.opt.dao.mapper.CrossMapper;
import net.wanji.opt.dao.mapper.GreenwaveHistoryMapper;
import net.wanji.opt.po.base.CrossLaneDataHistPoExtend;
import net.wanji.opt.servicev2.CrossService;
import net.wanji.opt.synthesis.pojo.CrossRealTimeAlarmEntity;
import net.wanji.opt.synthesis.pojo.CrossStatusDisOptTimeEntity;
import net.wanji.opt.synthesis.pojo.StrategyCrossResultEntity;
import net.wanji.opt.vo2.CrossStatusDistributionVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import java.util.*;
/**
* <p>
* 监测详情-路口事件详情
* @author zhengyifan
* @date 2025/3/15
*/
@Service
@Slf4j
public class CrossServiceImpl implements CrossService {
@Resource
private CrossMapper crossMapper;
@Resource
private GreenwaveHistoryMapper greenwaveHistoryMapper;
/**
* 路口状态分布
* @param crossID 路口ID
* @param date 日期
* @param groupType 时间粒度 参数要求:0--5分钟 1--15分钟 2--30分钟 3--60分钟
* @param objectType 范围 参数要求:1--方向级 2--转向级 3--车道级 4--路口级
* @param directionName 方向
* @return
*/
@Override
public Map<String, List<?>> getCrossStatusDistribution(String crossID, String date, String groupType, Integer objectType, String directionName) {
Map<String, Object> params = new HashMap<>();
params.put("crossId", crossID);
params.put("startDate", date+" 00:00:00");
params.put("endDate", date + " 23:59:59");
params.put("groupType", groupType);
params.put("objectType", objectType);
if (StringUtils.isNotBlank(directionName)) {
params.put("dir", BaseEnum.SignalDirectionEnum.getCodeByName(directionName.substring(0, directionName.indexOf("进口"))));
}
List<CrossLaneDataHistPoExtend> firstList = greenwaveHistoryMapper.findCrossObjectIndex(params);
List<CrossStatusDisOptTimeEntity> optTimeList = crossMapper.getOptTimes(crossID);
List<CrossStatusDistributionVO> infoList = new ArrayList<>();
for (CrossLaneDataHistPoExtend c : firstList) {
CrossStatusDistributionVO info = new CrossStatusDistributionVO();
info.setSpeed(c.getSpeed());
info.setQueueLength(c.getAvgQueueLength());
info.setDelayTime(c.getDelayTime());
info.setStopTimes(c.getStopTimes());
info.setStartTime(c.getStartTime().toString().substring(11,16));
infoList.add(info);
}
Map<String, List<?>> result = new HashMap<>();
result.put("infoList", infoList);
result.put("optTimeList", optTimeList);
return result;
}
/**
* 路口实时告警
* @param crossID
* @param time 可选参数
* @return
*/
@Override
public List<CrossRealTimeAlarmEntity> getCrossRealTimeAlarm(String crossID, String time) {
return crossMapper.getCrossRealTimeAlarms(crossID, time);
}
}
...@@ -16,6 +16,8 @@ import net.wanji.opt.dao.mapper.HoloEventMapper; ...@@ -16,6 +16,8 @@ import net.wanji.opt.dao.mapper.HoloEventMapper;
import net.wanji.opt.dao.mapper.StrategyCrossResultMapper; import net.wanji.opt.dao.mapper.StrategyCrossResultMapper;
import net.wanji.opt.dao.mapper.StrategyGreenOptHistMapper; import net.wanji.opt.dao.mapper.StrategyGreenOptHistMapper;
import net.wanji.opt.servicev2.TrendServiceV2; import net.wanji.opt.servicev2.TrendServiceV2;
import net.wanji.opt.synthesis.pojo.StrategyCrossResultEntity;
import net.wanji.opt.synthesis.service.StrategyControlService;
import net.wanji.opt.vo2.*; import net.wanji.opt.vo2.*;
import net.wanji.opt.vo2.dto.CrossLastOptResultDTO; import net.wanji.opt.vo2.dto.CrossLastOptResultDTO;
import net.wanji.opt.vo2.dto.GreenLastOptResultDTO; import net.wanji.opt.vo2.dto.GreenLastOptResultDTO;
...@@ -51,6 +53,10 @@ public class TrendServiceV2Impl implements TrendServiceV2 { ...@@ -51,6 +53,10 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
@Resource @Resource
private StrategyGreenOptHistMapper greenOptHistMapper; private StrategyGreenOptHistMapper greenOptHistMapper;
private static List<OptMonitoringVO> greenListCache = new ArrayList<>(10);
private static List<OptMonitoringVO> crossListCache = new ArrayList<>(80);
@Override @Override
public List<CrossGreenStatusTimeRateVO> crossGreenStatusTimeRate() { public List<CrossGreenStatusTimeRateVO> crossGreenStatusTimeRate() {
List<CrossGreenStatusTimeRateVO> crossGreenStatusTimeRateVOS = holoEventMapper.selectCrossGreenStatusTimeRate(); List<CrossGreenStatusTimeRateVO> crossGreenStatusTimeRateVOS = holoEventMapper.selectCrossGreenStatusTimeRate();
...@@ -204,6 +210,7 @@ public class TrendServiceV2Impl implements TrendServiceV2 { ...@@ -204,6 +210,7 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
} }
} }
}); });
greenListCache = optMonitoringVOS;
return optMonitoringVOS; return optMonitoringVOS;
} }
...@@ -216,14 +223,14 @@ public class TrendServiceV2Impl implements TrendServiceV2 { ...@@ -216,14 +223,14 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
String crossId = optMonitoringVO.getId(); String crossId = optMonitoringVO.getId();
for (CrossLastOptResultDTO optResultDTO : optResultDTOS) { for (CrossLastOptResultDTO optResultDTO : optResultDTOS) {
String id = optResultDTO.getId(); String id = optResultDTO.getId();
String type = optMonitoringVO.getType();
optMonitoringVO.setTypeDesc(EventInfoTypeEnum.getOptDesc(type));
if (StringUtils.endsWithIgnoreCase(id, crossId)) { if (StringUtils.endsWithIgnoreCase(id, crossId)) {
Date optTime = optResultDTO.getOptTime(); Date optTime = optResultDTO.getOptTime();
Integer duration = optResultDTO.getDuration(); Integer duration = optResultDTO.getDuration();
String type = optResultDTO.getType();
// 优化时间计算 // 优化时间计算
optMonitoringVO.setOptTime(optTime); optMonitoringVO.setOptTime(optTime);
optMonitoringVO.setOptStatus(0); optMonitoringVO.setOptStatus(0);
optMonitoringVO.setTypeDesc(EventInfoTypeEnum.getOptDesc(type));
if (Objects.nonNull(optTime)) { if (Objects.nonNull(optTime)) {
// 空放优化中,6秒钟结束,当前时间小于开始时间+持续时间 // 空放优化中,6秒钟结束,当前时间小于开始时间+持续时间
if (Objects.equals(EventInfoTypeEnum.PHASE_EMPTY.getEventType(), type) && (current - optTime.getTime() > 6 * 1000)) { if (Objects.equals(EventInfoTypeEnum.PHASE_EMPTY.getEventType(), type) && (current - optTime.getTime() > 6 * 1000)) {
...@@ -238,14 +245,25 @@ public class TrendServiceV2Impl implements TrendServiceV2 { ...@@ -238,14 +245,25 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
} }
} }
}); });
crossListCache = optMonitoringVOS;
return optMonitoringVOS; return optMonitoringVOS;
} }
@Override @Override
public List<OptMonitoringVO> eventAlarmRealTimeList() throws Exception { public List<OptMonitoringVO> eventAlarmRealTimeList() throws Exception {
List<OptMonitoringVO> results = new ArrayList<>(80); List<OptMonitoringVO> results = new ArrayList<>(90);
List<OptMonitoringVO> greenList = crossOptMonitoringList(); List<OptMonitoringVO> greenList = new ArrayList<>(10);
List<OptMonitoringVO> crossList = greenOptMonitoringList(); List<OptMonitoringVO> crossList = new ArrayList<>(80);
if (!CollectionUtils.isEmpty(greenListCache)) {
greenList = greenListCache;
} else {
greenList = greenOptMonitoringList();
}
if (!CollectionUtils.isEmpty(crossListCache)) {
crossList = crossListCache;
} else {
crossList = crossOptMonitoringList();
}
results.addAll(greenList); results.addAll(greenList);
results.addAll(crossList); results.addAll(crossList);
List<OptMonitoringVO> sort = results.stream().sorted(Comparator.comparing(OptMonitoringVO::getStartTime).reversed()).collect(Collectors.toList()); List<OptMonitoringVO> sort = results.stream().sorted(Comparator.comparing(OptMonitoringVO::getStartTime).reversed()).collect(Collectors.toList());
...@@ -303,4 +321,32 @@ public class TrendServiceV2Impl implements TrendServiceV2 { ...@@ -303,4 +321,32 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
List<StatisticsEventTypeCountTimeVO> results = holoEventMapper.selectCrossGreenHistList(); List<StatisticsEventTypeCountTimeVO> results = holoEventMapper.selectCrossGreenHistList();
return new PageInfo<>(results); return new PageInfo<>(results);
} }
@Override
public String optStrategyResultInfo(String id) throws Exception {
LambdaQueryWrapper<StrategyCrossResultEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StrategyCrossResultEntity::getCrossId, id);
queryWrapper.orderByDesc(StrategyCrossResultEntity::getIssueTime);
queryWrapper.last("limit 1");
StringBuilder sb = new StringBuilder();
List<StrategyCrossResultEntity> results = strategyCrossResultMapper.selectList(queryWrapper);
if (!CollectionUtils.isEmpty(results)) {
for (StrategyCrossResultEntity result : results) {
Integer currentAlgo = result.getCurrentAlgo();
if (Objects.equals(1, currentAlgo)) {
sb.append("相位空放").append("-").append("均衡调控").append("-").append("神思策略");
}
if (Objects.equals(2, currentAlgo)) {
sb.append("路口失衡").append("-").append("效率提升").append("-").append("神思策略");
}
if (Objects.equals(3, currentAlgo)) {
sb.append("路口溢出").append("-").append("均衡调控").append("-").append("神思策略");
}
if (Objects.equals(4, currentAlgo)) {
sb.append("路口拥堵").append("-").append("均衡调控").append("-").append("神思策略");
}
}
}
return sb.toString();
}
} }
\ No newline at end of file
package net.wanji.opt.servicev2.implv2;
import lombok.extern.slf4j.Slf4j;
import net.wanji.opt.dao.mapper.TrunkLineMapper;
import net.wanji.opt.servicev2.TrunkLineService;
import net.wanji.opt.synthesis.pojo.TrunkLineProblemDescribeEntity;
import net.wanji.opt.vo2.CrossRealTimeAlarmVO;
import net.wanji.opt.vo2.TrunkLineProblemDescribeVO;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
@Service
@Slf4j
public class TrunkLineImpl implements TrunkLineService {
@Resource
private TrunkLineMapper trunkLineMapper;
@Override
public List<TrunkLineProblemDescribeEntity> getTrunkLineProblemDescribe(String greenID , String time) {
List<TrunkLineProblemDescribeEntity> list = trunkLineMapper.getTrunkLineProblemDescribe(greenID,time);
return list;
}
@Override
public List<CrossRealTimeAlarmVO> getTrunkLineRealTimeAlarm(Integer greenID, String time) {
return trunkLineMapper.getTrunkLineRealTimeAlarm(greenID, time);
}
@NotNull
private static TrunkLineProblemDescribeVO getTrunkLineProblemDescribeVO(List<TrunkLineProblemDescribeEntity> list, int i) {
TrunkLineProblemDescribeVO vo = new TrunkLineProblemDescribeVO();
TrunkLineProblemDescribeEntity e = list.get(i);
TrunkLineProblemDescribeEntity e2= list.get(i +1);
vo.setGreenID(e.getGreenID());
vo.setTime(e.getTime());
vo.setStatus(e.getStatus());
vo.setDir(e.getDir());
vo.setStatusCN(e.getStatusCN());
vo.setDir2(e2.getDir());
vo.setStatus2(e.getStatus());
vo.setStatusCN2(e.getStatusCN());
return vo;
}
}
package net.wanji.opt.servicev2.implv2;
import com.alibaba.fastjson.JSONObject;
import groovy.util.logging.Slf4j;
import net.wanji.opt.dao.mapper.TrunkLineStatusDisMapper;
import net.wanji.opt.entity.GreenwaveHist;
import net.wanji.opt.servicev2.TrunkLineStatusDisService;
import net.wanji.opt.vo2.TrunkLineStatusDisInfoVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
/**
* @author zhengyifan
* @date 2025/3/14
*/
@Service
@Slf4j
public class TrunkLineStatusDisImpl implements TrunkLineStatusDisService {
@Resource
private TrunkLineStatusDisMapper trunkLineStatusDisMapper;
@Override
public JSONObject trunkLineStatusDisInfoList(String greenID, String date, String timeGranule) {
Map<String, Object> params = new HashMap<>();
params.put("greenID", greenID);
params.put("date", date);
params.put("timeGranule", timeGranule);
List<TrunkLineStatusDisInfoVO> list= trunkLineStatusDisMapper.findStatusDistribution(params);
List<TrunkLineStatusDisInfoVO> list1= trunkLineStatusDisMapper.findPlanTime(params);
JSONObject jsonObject = new JSONObject();
jsonObject.put("dataList", list);
jsonObject.put("timeList", list1);
return jsonObject;
}
}
package net.wanji.opt.synthesis.pojo;
import lombok.Data;
@Data
public class CrossRealTimeAlarmEntity {
private String type;
private String startTime;
private String dir;
}
package net.wanji.opt.synthesis.pojo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 监测详情-路口事件详情-路口状态分布趋势-优化时间
*/
@Data
public class CrossStatusDisOptTimeEntity {
private String startTime;
private String endTime;
}
package net.wanji.opt.synthesis.pojo;
import lombok.Data;
@Data
public class TrunkLineProblemDescribeEntity {
private Integer greenID;
private String time;
private Integer status;
private String dir;
private String statusCN;
}
package net.wanji.opt.vo2;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "CrossRealTimeAlarmVO", description = "监测详情-路口事件-路口实时告警")
public class CrossRealTimeAlarmVO {
@ApiModelProperty(value = "事件类型")
private String type;
@ApiModelProperty(value = "事件时间")
private String startTime;
@ApiModelProperty(value = "事件方向")
private String dir;
}
package net.wanji.opt.vo2;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.synthesis.pojo.CrossStatusDisOptTimeEntity;
import java.util.Date;
import java.util.List;
@Data
@ApiModel(value = "CrossStatusDistributionVO", description = "监测详情-路口事件详情-路口状态分布")
public class CrossStatusDistributionVO {
@ApiModelProperty(value = "平均速度")
private Double speed;
@ApiModelProperty(value = "排队长度")
private Integer queueLength;
@ApiModelProperty(value = "平均延误")
private Integer delayTime;
@ApiModelProperty(value = "平均停车次数")
private Double stopTimes;
@ApiModelProperty(value = "时间")
private String startTime;
}
package net.wanji.opt.vo2;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "TrunkLineProblemDescribeVO", description = "监测详情-干线详情-问题描述")
public class TrunkLineProblemDescribeVO {
@ApiModelProperty(value = "greenID")
private Integer greenID;
@ApiModelProperty(value = "时间")
private String time;
@ApiModelProperty(value = "方向")
private String dir;
@ApiModelProperty(value = "状态")
private Integer status;
@ApiModelProperty(value = "状态中文")
private String statusCN;
@ApiModelProperty(value = "方向2")
private String dir2;
@ApiModelProperty(value = "状态2")
private Integer status2;
@ApiModelProperty(value = "状态中文2")
private String statusCN2;
}
package net.wanji.opt.vo2;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
@ApiModel(value = "TrunkLineStatusDisInfoVO", description = "监测详情-干线事件详情-干线交通状态分布趋势")
public class TrunkLineStatusDisInfoVO {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "行程速度")
private Double speed;
@ApiModelProperty(value = "行程时间")
private Double travelTime;
@ApiModelProperty(value = "平均延误")
private Double delayTime;
@ApiModelProperty(value = "停车次数")
private Double stopTimes;
@ApiModelProperty(value = "方向")
private String direction;
@ApiModelProperty(value = "绿波id")
private String greenId;
@ApiModelProperty(value = "时间颗粒度")
private String startTime;
@ApiModelProperty(value = "结束时间")
private String endTime;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.CrossMapper">
<resultMap id="BaseResultMap" type="net.wanji.opt.synthesis.pojo.CrossStatusDisOptTimeEntity">
<result property="startTime" column="startTime"></result>
<result property="endTime" column="endTime"></result>
</resultMap>
<resultMap id="CrossRealTimeAlarmsResultMap" type="net.wanji.opt.synthesis.pojo.CrossRealTimeAlarmEntity">
<result property="type" column="type"></result>
<result property="startTime" column="startTime"></result>
<result property="dir" column="dir"></result>
</resultMap>
<select id="getOptTimes" resultMap="BaseResultMap" parameterType="String">
select distinct DATE_FORMAT(issue_time, '%H:%i') as startTime,
DATE_FORMAT(newtime, '%H:%i') as endTime
from
(
select
a.issue_time,
DATE_ADD(a.issue_time, interval a.count_down second) newTime
from
t_strategy_cross_result a
where
1 = 1
and a.cross_id = #{crossID}
and sign(a.rtn_type) = -1
and a.current_algo = 1
and a.issue_time >= CURDATE()
union
select
a.issue_time,
DATE_ADD(a.issue_time, interval a.duration second) newTime
from
t_strategy_cross_result a
where
1 = 1
and a.cross_id = #{crossID}
and a.current_algo = 2
and a.response_code = 200
and a.issue_time >= CURDATE()
union
select
a.issue_time,
DATE_ADD(a.issue_time , interval a.duration second) newTime
from
t_strategy_cross_result a
where
1 = 1
and a.cross_id = #{crossID}
and a.current_algo = 3
and a.response_code = 200
and a.issue_time >= CURDATE()
) b
order by b.issue_time
</select>
<select id="getCrossRealTimeAlarms" parameterType="String" resultMap="CrossRealTimeAlarmsResultMap">
select
a.type ,
MAX(a.start_time) as startTime ,
SUBSTR(a.dir, 2, length(a.dir)-2) as dir
from
t_event_info a
where 1=1
and a.cross_id = #{crossID}
<if test="time != null and time != ''">
and a.start_time <![CDATA[ <= ]]> DATE_FORMAT(#{time}, '%Y-%m-%d %H:%i:%s')
</if>
union
select
'' as type,
max(b.issue_time) as startTime ,
'' as dir
from
(
select
max(a.issue_time) as issue_time
from
t_strategy_cross_result a
where 1=1
and a.cross_id = #{crossID}
and (a.current_algo in (2, 3)
and a.response_code = 200)
<if test="time != null and time != ''">
and a.issue_time <![CDATA[ <= ]]> DATE_FORMAT(#{time}, '%Y-%m-%d %H:%i:%s')
</if>
union
select
max(a.issue_time) as issue_time
from
t_strategy_cross_result a
where 1=1
and a.cross_id = #{crossID}
and (SIGN(a.rtn_type) = -1
and a.current_algo = 1)
<if test="time != null and time != ''">
and a.issue_time <![CDATA[ <= ]]> DATE_FORMAT(#{time}, '%Y-%m-%d %H:%i:%s')
</if>
) b
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.TrunkLineMapper">
<resultMap id="tlProblemDescribe" type="net.wanji.opt.synthesis.pojo.TrunkLineProblemDescribeEntity">
<result column="greenID" property="greenID"/>
<result column="time" property="time" />
<result column="status" property="status"/>
<result column="status_cn" property="statusCN"/>
</resultMap>
<resultMap id="tlRealTimeAlarmsResultMap" type="net.wanji.opt.synthesis.pojo.CrossRealTimeAlarmEntity">
<result property="type" column="type"></result>
<result property="startTime" column="startTime"></result>
<result property="dir" column="dir"></result>
</resultMap>
<select id="getTrunkLineProblemDescribe" parameterType="String" resultMap="tlProblemDescribe">
select b.greenID ,b.status ,b.time , (
case
b.status
when 1 then '畅通'
when 2 then '缓行'
when 3 then '拥堵'
when 4 then '严重拥堵'
when 5 then '畅通'
end
) status_cn
from
(select DISTINCT
a.green_id as greenID,
max(a.start_time) time,
max(a.status) as status
from
t_greenwave_hist a
where a.green_id = #{greenID}
<if test="time != null and time != '' ">
and DATE_FORMAT(start_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> DATE_FORMAT(#{time},'%Y-%m-%d %H:%i:%s')
</if>
) b
</select>
<select id="getTrunkLineRealTimeAlarm" parameterType="map" resultMap="tlRealTimeAlarmsResultMap">
select
a.type ,
MAX(a.start_time) as startTime ,
SUBSTR(a.dir, 2, length(a.dir)-2) as dir
from
t_event_info a
where
1 = 1
and a.green_id = #{greenID}
<if test="time != null and time != ''">
and a.start_time <![CDATA[ <= ]]> DATE_FORMAT(#{time}, '%Y-%m-%d %H:%i:%s')
</if>
and a.type in (705, 706)
union
select
'' as type,
max(b.issue_time) as startTime ,
'' as dir
from
(
select
distinct max(a.control_time) as issue_time
from
t_strategy_green_opt_hist a
where
1 = 1
and a.green_id = #{greenID}
and a.response_code = 200
<if test="time != null and time != ''">
and a.control_time <![CDATA[ <= ]]> DATE_FORMAT(#{time}, '%Y-%m-%d %H:%i:%s')
</if>
) b
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.TrunkLineStatusDisMapper">
<!-- 绿波路口查询 -->
<select id="findStatusDistribution" parameterType="map" resultType="net.wanji.opt.vo2.TrunkLineStatusDisInfoVO">
select c.green_id as greenId,c.road_direction as direction, c.start_time as startTime , AVG(c.speed) AS speed ,AVG(c.trval_time) as travelTime, AVG(c.delay_time) as delayTime,AVG(c.stop_times) as stopTimes
from
(select b.green_id,b.road_direction,b.speed ,b.trval_time, b.delay_time,b.stop_times,
DATE_FORMAT(FROM_UNIXTIME(CEIL(UNIX_TIMESTAMP(b.start_time) / #{timeGranule}) * #{timeGranule}), '%H:%i') as start_time
from
(select a.green_id,a.road_direction,IFNULL(a.speed,0) as speed,IFNULL(a.trval_time,0) as trval_time,a.delay_time,a.stop_times,
DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:00') as start_time
from t_greenwave_hist a
where DATE_FORMAT(a.start_time,'%Y-%m-%d') = DATE_FORMAT(#{date},'%Y-%m-%d')
and a.green_id = #{greenID}) b ) c
group by c.green_id,c.road_direction, c.start_time
</select>
<select id="findPlanTime" parameterType="map" resultType="net.wanji.opt.vo2.TrunkLineStatusDisInfoVO">
select DISTINCT DATE_FORMAT(a.control_time,'%H:%i') as startTime ,DATE_FORMAT(DATE_ADD(a.control_time, INTERVAL a.duration SECOND),'%H:%i') as endTime
from t_strategy_green_opt_hist a where DATE_FORMAT(a.control_time,'%Y-%m-%d') = DATE_FORMAT(#{date},'%Y-%m-%d') and a.response_code = 200
and a.green_id = #{greenID}
</select>
</mapper>
...@@ -28,7 +28,7 @@ public class ControlCommandVO { ...@@ -28,7 +28,7 @@ public class ControlCommandVO {
@Min(value = 0, message = "控制类型:1是;0否") @Min(value = 0, message = "控制类型:1是;0否")
private Integer command; private Integer command;
@ApiModelProperty(value = "1关灯 2黄闪 3全红") @ApiModelProperty(value = "1关灯 2黄闪 3全红 锁定步进时,不需要发送")
private Integer controlType; private Integer controlType;
@ApiModelProperty(value = "持续时间") @ApiModelProperty(value = "持续时间")
......
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