Commit f65dfedb authored by Zheng Yi Fan's avatar Zheng Yi Fan

Merge remote-tracking branch 'origin/master'

parents c16350de 795a3da3
......@@ -7,6 +7,8 @@ import io.swagger.annotations.ApiResponses;
import net.wanji.common.annotation.aspect.AspectLog;
import net.wanji.common.enums.BaseEnum;
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.opt.service.signalcontrol.FeignProxyService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -23,7 +25,7 @@ import javax.ws.rs.core.MediaType;
* @author duanruiming
* @date 2023/03/01 20:44
*/
@Api(value = "SignalCommandOptController", description = "信号优化")
@Api(value = "SignalCommandOptController", description = "信号机控制")
@RequestMapping("/signalControl")
@RestController
public class SignalCommandOptController {
......@@ -53,4 +55,59 @@ public class SignalCommandOptController {
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);
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);
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);
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);
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);
return jsonViewObject;
}
}
......@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.utils.tool.StringUtils;
import net.wanji.opt.servicev2.TrendServiceV2;
import net.wanji.opt.vo2.*;
import org.springframework.web.bind.annotation.*;
......@@ -145,10 +146,16 @@ public class TrendControllerV2 {
@ApiResponses({
@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();
try {
list = trendServiceV2.eventAlarmRealTimeList();
if (StringUtils.isBlank(type)) {
list = trendServiceV2.eventAlarmRealTimeList();
} else {
list = trendServiceV2.eventAlarmRealTimeList().stream()
.filter(vo -> StringUtils.equalsIgnoreCase(type, vo.getType()))
.collect(Collectors.toList());
}
} catch (Exception e) {
log.error("态势监测-事件告警-实时列表:", e);
JsonViewObject.newInstance().success(list);
......
package net.wanji.opt.service.signalcontrol;
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;
/**
......@@ -10,4 +12,20 @@ import net.wanji.databus.vo.SchemeOptSendVO;
public interface FeignProxyService {
JsonViewObject schemeOptSend(SchemeOptSendVO schemeOptSendVO) 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;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.exception.FeignServiceException;
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.vo.ControlCommandVO;
import net.wanji.databus.vo.LockControlVO;
import net.wanji.databus.vo.SchemeSendVO;
import net.wanji.feign.service.UtcFeignClients;
import net.wanji.opt.cache.CrossDirTurnPhaseCache;
......@@ -127,4 +130,35 @@ public class FeignProxyServiceImpl implements FeignProxyService {
}
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());
}
}
......@@ -51,6 +51,9 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
@Resource
private StrategyGreenOptHistMapper greenOptHistMapper;
private static List<OptMonitoringVO> greenListCache = new ArrayList<>(10);
private static List<OptMonitoringVO> crossListCache = new ArrayList<>(80);
@Override
public List<CrossGreenStatusTimeRateVO> crossGreenStatusTimeRate() {
List<CrossGreenStatusTimeRateVO> crossGreenStatusTimeRateVOS = holoEventMapper.selectCrossGreenStatusTimeRate();
......@@ -204,6 +207,7 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
}
}
});
greenListCache = optMonitoringVOS;
return optMonitoringVOS;
}
......@@ -216,14 +220,14 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
String crossId = optMonitoringVO.getId();
for (CrossLastOptResultDTO optResultDTO : optResultDTOS) {
String id = optResultDTO.getId();
String type = optMonitoringVO.getType();
optMonitoringVO.setTypeDesc(EventInfoTypeEnum.getOptDesc(type));
if (StringUtils.endsWithIgnoreCase(id, crossId)) {
Date optTime = optResultDTO.getOptTime();
Integer duration = optResultDTO.getDuration();
String type = optResultDTO.getType();
// 优化时间计算
optMonitoringVO.setOptTime(optTime);
optMonitoringVO.setOptStatus(0);
optMonitoringVO.setTypeDesc(EventInfoTypeEnum.getOptDesc(type));
if (Objects.nonNull(optTime)) {
// 空放优化中,6秒钟结束,当前时间小于开始时间+持续时间
if (Objects.equals(EventInfoTypeEnum.PHASE_EMPTY.getEventType(), type) && (current - optTime.getTime() > 6 * 1000)) {
......@@ -238,14 +242,25 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
}
}
});
crossListCache = optMonitoringVOS;
return optMonitoringVOS;
}
@Override
public List<OptMonitoringVO> eventAlarmRealTimeList() throws Exception {
List<OptMonitoringVO> results = new ArrayList<>(80);
List<OptMonitoringVO> greenList = crossOptMonitoringList();
List<OptMonitoringVO> crossList = greenOptMonitoringList();
List<OptMonitoringVO> results = new ArrayList<>(90);
List<OptMonitoringVO> greenList = new ArrayList<>(10);
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(crossList);
List<OptMonitoringVO> sort = results.stream().sorted(Comparator.comparing(OptMonitoringVO::getStartTime).reversed()).collect(Collectors.toList());
......
......@@ -28,7 +28,7 @@ public class ControlCommandVO {
@Min(value = 0, message = "控制类型:1是;0否")
private Integer command;
@ApiModelProperty(value = "1关灯 2黄闪 3全红")
@ApiModelProperty(value = "1关灯 2黄闪 3全红 锁定步进时,不需要发送")
private Integer controlType;
@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