Commit dfa508df authored by duanruiming's avatar duanruiming

[update] 添加异常判断处理

parent da45144c
......@@ -12,6 +12,7 @@ import net.wanji.common.enums.DateStyle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.gts.GeometryUtil;
import net.wanji.common.utils.tool.CrossUtil;
import net.wanji.common.utils.tool.StringUtils;
import net.wanji.databus.bo.AreaDetailBO;
import net.wanji.databus.bo.AreaIdBO;
import net.wanji.databus.bo.CrossIdBO;
......@@ -46,6 +47,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
......@@ -207,7 +209,7 @@ public class CrossManageServiceImpl implements CrossManageService {
}
private AreaIdBO handleAreaInfoPO(Integer type, String areaName, String remark, List<String> crossIdList, String wkt,
BaseAreaInfoPO baseAreaInfoPO) {
BaseAreaInfoPO baseAreaInfoPO) {
baseAreaInfoPO.setCode(0);
baseAreaInfoPO.setLocation("");
baseAreaInfoPO.setName(areaName);
......@@ -315,7 +317,7 @@ public class CrossManageServiceImpl implements CrossManageService {
}
Map content = (Map) jsonViewObject.getContent();
if (content != null) {
areaDetailPOExt.setCode((String)content.get("code"));
areaDetailPOExt.setCode((String) content.get("code"));
areaDetailPOExt.setManufacturerId((Integer) content.get("manufacturerId"));
areaDetailPOExt.setIp((String) content.get("ip"));
areaDetailPOExt.setPort((Integer) content.get("port"));
......@@ -381,7 +383,7 @@ public class CrossManageServiceImpl implements CrossManageService {
}
// 筛选控制模式
if (controlMode != null) {
if (currentCrossSection != null){
if (currentCrossSection != null) {
Integer currentControlMode = currentCrossSection.getControlMode();
if (controlMode.equals(currentControlMode)) {
areaDetailVO.setControlMode(currentControlMode);
......@@ -459,20 +461,24 @@ public class CrossManageServiceImpl implements CrossManageService {
}
private List<String> buildWktList(String polylines) {
String[] strArray = polylines.substring(1, polylines.length() - 1).split(", ");
String[] strArray = new String[0];
if (StringUtils.isNotBlank(polylines)) {
strArray = polylines.substring(1, polylines.length() - 1).split(", ");
}
return Arrays.asList(strArray);
}
private List<CrossIdAndNameVO> buildCrossIdAndNameList(Integer areaId) {
List<CrossIdAndNameVO> res = new ArrayList<>();
List<String> crossIds = areaCrossMapper.selectCrossIdsByAreaId(areaId);
List<BaseCrossInfoPO> baseCrossInfoPOList = crossInfoMapper.selectByCrossIds(crossIds);
for (BaseCrossInfoPO baseCrossInfoPO : baseCrossInfoPOList) {
CrossIdAndNameVO crossIdAndNameVO = new CrossIdAndNameVO();
crossIdAndNameVO.setCrossId(baseCrossInfoPO.getId());
crossIdAndNameVO.setCrossName(baseCrossInfoPO.getName());
res.add(crossIdAndNameVO);
if (!CollectionUtils.isEmpty(crossIds)) {
List<BaseCrossInfoPO> baseCrossInfoPOList = crossInfoMapper.selectByCrossIds(crossIds);
for (BaseCrossInfoPO baseCrossInfoPO : baseCrossInfoPOList) {
CrossIdAndNameVO crossIdAndNameVO = new CrossIdAndNameVO();
crossIdAndNameVO.setCrossId(baseCrossInfoPO.getId());
crossIdAndNameVO.setCrossName(baseCrossInfoPO.getName());
res.add(crossIdAndNameVO);
}
}
return res;
}
......
......@@ -372,7 +372,10 @@ public class CrossConfigServiceImpl implements CrossConfigService {
dirListElement.setDir(key);
// 获取是否有行人道
CrossDirInfoPO crossDirInfoPO = crossDirInfoMapper.selectByCrossIdAndDirType(crossId, key);
Integer isPedestrian = crossDirInfoPO.getIsPedestrian();
Integer isPedestrian = 0;
if (Objects.nonNull(crossDirInfoPO)) {
isPedestrian = crossDirInfoPO.getIsPedestrian();
}
dirListElement.setIsPersonCross(isPedestrian);
// 构造laneList
List<LaneInfoPO> value = entry.getValue();
......
......@@ -376,6 +376,7 @@ public class DiagnoServiceImpl implements DiagnoService {
// 获取当前时间之前45分钟的10位时间戳
long currentSeconds = DateUtil.currentSeconds();
long optStartTime = currentSeconds - 2 * 60 * 60;
//long optStartTime = 1689525900l;
// 优化开始时间,两个小时内最早时间
CrossSchemeOptLogPO optStartEntity = crossSchemeOptLogMapper.selectOptStartEntity(crossId, optReason, optStartTime);
if (Objects.nonNull(optStartEntity)) {
......
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