Commit 88b89f8f authored by hanbing's avatar hanbing

方案管理-信号方案同步异常处理

parent 999f703a
package net.wanji.web.common.exception;
/**
* 灯组无车道信息异常
*
* @author Kent HAN
* @date 2022/11/10 9:09
*/
public class NoLanesException extends RuntimeException {
public NoLanesException(String message) {
super(message);
}
public NoLanesException(String message, Exception e) {
super(message,e);
}
}
...@@ -35,4 +35,10 @@ public class SignalGlobalExceptionHandler { ...@@ -35,4 +35,10 @@ public class SignalGlobalExceptionHandler {
JsonViewObject jsonViewObject = JsonViewObject.newInstance(); JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.fail(e); return jsonViewObject.fail(e);
} }
@ExceptionHandler(value = NoLanesException.class)
public JsonViewObject noLanesExceptionHandler(NoLanesException e) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.fail(e);
}
} }
\ No newline at end of file
...@@ -2,9 +2,10 @@ package net.wanji.web.service.scheme.impl; ...@@ -2,9 +2,10 @@ package net.wanji.web.service.scheme.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import net.wanji.common.dto.CrossIdDTO;
import net.wanji.web.common.constant.ControlModeConst; import net.wanji.web.common.constant.ControlModeConst;
import net.wanji.web.common.exception.NoLanesException;
import net.wanji.web.common.exception.PhaseNoNotUniqueException; import net.wanji.web.common.exception.PhaseNoNotUniqueException;
import net.wanji.common.dto.CrossIdDTO;
import net.wanji.web.dto.LaneIdDTO; import net.wanji.web.dto.LaneIdDTO;
import net.wanji.web.dto.LightIdDTO; import net.wanji.web.dto.LightIdDTO;
import net.wanji.web.dto.SaveSchemeConfigDTO; import net.wanji.web.dto.SaveSchemeConfigDTO;
...@@ -98,6 +99,9 @@ public class SchemeConfigServiceImpl implements SchemeConfigService { ...@@ -98,6 +99,9 @@ public class SchemeConfigServiceImpl implements SchemeConfigService {
List<String> laneIds = crossLaneLightsPOList.stream() List<String> laneIds = crossLaneLightsPOList.stream()
.map(CrossLaneLightsPO::getLaneId) .map(CrossLaneLightsPO::getLaneId)
.collect(Collectors.toList()); .collect(Collectors.toList());
if (CollectionUtil.isEmpty(laneIds)) {
throw new NoLanesException("灯组没有对应的车道信息,请先完成灯组配置");
}
List<LaneInfoPO> laneInfoPOList = laneInfoMapper.selectByLaneIds(laneIds); List<LaneInfoPO> laneInfoPOList = laneInfoMapper.selectByLaneIds(laneIds);
laneIdsVO.setLanes(laneInfoPOList); laneIdsVO.setLanes(laneInfoPOList);
......
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