Commit 05b41154 authored by hanbing's avatar hanbing

[add] 新信号评价-干线评价-底部曲线图范围下拉列表

parent 46665809
...@@ -249,13 +249,13 @@ public class CrossConfigServiceImpl implements CrossConfigService { ...@@ -249,13 +249,13 @@ public class CrossConfigServiceImpl implements CrossConfigService {
// 删除数据库中有,前端对象中没有的方向 // 删除数据库中有,前端对象中没有的方向
for (Integer dirFromDb : dirListFromDb) { for (Integer dirFromDb : dirListFromDb) {
if (!dirList.contains(dirFromDb)) { if (!dirList.contains(dirFromDb)) {
List<LaneInfoPO> laneInfoPOList = laneInfoMapper.selectByCrossIdAndDir(crossId, dirFromDb); List<LaneInfoPO> laneInfoPOList = laneInfoMapper.selectInDirByCrossIdAndDir(crossId, dirFromDb);
cleanDataBase(crossId, dirFromDb, laneInfoPOList); cleanDataBase(crossId, dirFromDb, laneInfoPOList);
} }
} }
for (DirListElement dirListElement : dirList) { for (DirListElement dirListElement : dirList) {
Integer dir = dirListElement.getDir(); Integer dir = dirListElement.getDir();
List<LaneInfoPO> laneInfoPOList = laneInfoMapper.selectByCrossIdAndDir(crossId, dir); List<LaneInfoPO> laneInfoPOList = laneInfoMapper.selectInDirByCrossIdAndDir(crossId, dir);
List<LaneListElement> laneListFromClient = dirListElement.getLaneList(); List<LaneListElement> laneListFromClient = dirListElement.getLaneList();
List<LaneListElement> laneListFromDb = buildLaneListFromDb(laneInfoPOList); List<LaneListElement> laneListFromDb = buildLaneListFromDb(laneInfoPOList);
// 比较入参数据与已有数据 // 比较入参数据与已有数据
...@@ -420,7 +420,7 @@ public class CrossConfigServiceImpl implements CrossConfigService { ...@@ -420,7 +420,7 @@ public class CrossConfigServiceImpl implements CrossConfigService {
for (CrossDirInfoPO crossDirInfoPO : crossDirInfoPOList) { for (CrossDirInfoPO crossDirInfoPO : crossDirInfoPOList) {
List<DirListElement> dirList = saveLaneInfoDTO.getDirList(); List<DirListElement> dirList = saveLaneInfoDTO.getDirList();
Integer dirType = crossDirInfoPO.getDirType(); Integer dirType = crossDirInfoPO.getDirType();
List<LaneInfoPO> laneInfoPOList1 = laneInfoMapper.selectByCrossIdAndDir(crossId, dirType); List<LaneInfoPO> laneInfoPOList1 = laneInfoMapper.selectInDirByCrossIdAndDir(crossId, dirType);
if (CollectionUtil.isEmpty(laneInfoPOList1)) { if (CollectionUtil.isEmpty(laneInfoPOList1)) {
DirListElement dirListElement = new DirListElement(); DirListElement dirListElement = new DirListElement();
dirListElement.setDir(crossDirInfoPO.getDirType()); dirListElement.setDir(crossDirInfoPO.getDirType());
......
package net.wanji.opt.bo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2023/6/9 13:52
*/
@Data
@ApiModel(value = "BottomMenuBO", description = "底部曲线图范围下拉列表")
public class BottomMenuBO {
@ApiModelProperty(value = "路口ID")
private String crossId;
@ApiModelProperty(value = "范围 1进口道 2方向 3车道")
private Integer scope;
}
package net.wanji.opt.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.bo.BottomMenuBO;
import net.wanji.opt.service.impl.MainlineEvaluateServiceImpl;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.ws.rs.core.MediaType;
import java.util.List;
@Api(value = "MainlineEvaluateController", description = "干线评价")
@RequestMapping("/mainlineEvaluate")
@RestController
public class MainlineEvaluateController {
private final MainlineEvaluateServiceImpl mainlineEvaluateService;
public MainlineEvaluateController(MainlineEvaluateServiceImpl mainlineEvaluateService) {
this.mainlineEvaluateService = mainlineEvaluateService;
}
@ApiOperation(value = "底部曲线图范围下拉列表", notes = "底部曲线图范围下拉列表", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/bottomMenu",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class),
})
public JsonViewObject bottomMenu(@RequestBody BottomMenuBO bo) {
List<String> res = mainlineEvaluateService.bottomMenu(bo);
return JsonViewObject.newInstance().success(res);
}
}
\ No newline at end of file
package net.wanji.opt.service;
import net.wanji.opt.bo.BottomMenuBO;
import java.util.List;
public interface MainlineEvaluateService {
List<String> bottomMenu(BottomMenuBO bo);
}
...@@ -544,7 +544,7 @@ public class DiagnoServiceImpl implements DiagnoService { ...@@ -544,7 +544,7 @@ public class DiagnoServiceImpl implements DiagnoService {
for (BaseCrossDirInfoPO baseCrossDirInfoPO : baseCrossDirInfoPOList) { for (BaseCrossDirInfoPO baseCrossDirInfoPO : baseCrossDirInfoPOList) {
List<DirListElement> dirList = saveLaneInfoDTO.getDirList(); List<DirListElement> dirList = saveLaneInfoDTO.getDirList();
Integer dirType = baseCrossDirInfoPO.getDirType(); Integer dirType = baseCrossDirInfoPO.getDirType();
List<LaneInfoPO> laneInfoPOList1 = laneInfoMapper.selectByCrossIdAndDir(crossId, dirType); List<LaneInfoPO> laneInfoPOList1 = laneInfoMapper.selectInDirByCrossIdAndDir(crossId, dirType);
if (CollectionUtil.isEmpty(laneInfoPOList1)) { if (CollectionUtil.isEmpty(laneInfoPOList1)) {
DirListElement dirListElement = new DirListElement(); DirListElement dirListElement = new DirListElement();
dirListElement.setDir(baseCrossDirInfoPO.getDirType()); dirListElement.setDir(baseCrossDirInfoPO.getDirType());
......
package net.wanji.opt.service.impl;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.enums.BaseEnum;
import net.wanji.common.enums.TurnConvertEnum;
import net.wanji.databus.dao.entity.BaseCrossDirInfoPO;
import net.wanji.databus.dao.mapper.BaseCrossDirInfoMapper;
import net.wanji.databus.dao.mapper.BaseCrossTurnInfoMapper;
import net.wanji.databus.dao.mapper.CrossBaseLaneInfoMapper;
import net.wanji.databus.dao.mapper.LaneInfoMapper;
import net.wanji.databus.po.CrossTurnInfoPO;
import net.wanji.databus.po.LaneInfoPO;
import net.wanji.opt.bo.BottomMenuBO;
import net.wanji.opt.service.MainlineEvaluateService;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author Kent HAN
* @date 2023/9/19 15:24
*/
@Slf4j
@Service
public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
private final BaseCrossDirInfoMapper baseCrossDirInfoMapper;
private final BaseCrossTurnInfoMapper baseCrossTurnInfoMapper;
private final LaneInfoMapper laneInfoMapper;
public MainlineEvaluateServiceImpl(@Qualifier("baseCrossDirInfoMapper") BaseCrossDirInfoMapper baseCrossDirInfoMapper,
@Qualifier("baseCrossTurnInfoMapper") BaseCrossTurnInfoMapper baseCrossTurnInfoMapper,
CrossBaseLaneInfoMapper crossBaseLaneInfoMapper, @Qualifier("laneInfoMapper") LaneInfoMapper laneInfoMapper) {
this.baseCrossDirInfoMapper = baseCrossDirInfoMapper;
this.baseCrossTurnInfoMapper = baseCrossTurnInfoMapper;
this.laneInfoMapper = laneInfoMapper;
}
@Override
public List<String> bottomMenu(BottomMenuBO bo) {
String crossId = bo.getCrossId();
Integer scope = bo.getScope();
if (scope == 1) {
return buildDirMenu(crossId);
} else if (scope == 2) {
return buildTurnMenu(crossId);
} else if (scope == 3) {
return buildLaneMenu(crossId);
}
return null;
}
private List<String> buildLaneMenu(String crossId) {
List<BaseCrossDirInfoPO> poList = baseCrossDirInfoMapper.selectByCrossId(crossId);
List<BaseCrossDirInfoPO> dirList = poList.stream()
.filter(po -> po.getInOutType() == 1)
.collect(Collectors.toList());
List<String> res = new ArrayList<>();
for (BaseCrossDirInfoPO dirPo : dirList) {
Integer dirType = dirPo.getDirType();
String dirName = BaseEnum.SignalDirectionEnum.getNameByCode(dirType);
List<LaneInfoPO> laneList = laneInfoMapper.selectInDirByCrossIdAndDir(crossId, dirType);
for (LaneInfoPO lanePO : laneList) {
Integer turn = lanePO.getTurn();
String turnDesc = TurnConvertEnum.getDescByKey(turn);
Integer sort = lanePO.getSort();
res.add(dirName + "进口" + turnDesc + sort + "车道");
}
}
return res;
}
private List<String> buildTurnMenu(String crossId) {
List<BaseCrossDirInfoPO> poList = baseCrossDirInfoMapper.selectByCrossId(crossId);
List<BaseCrossDirInfoPO> dirList = poList.stream()
.filter(po -> po.getInOutType() == 1)
.collect(Collectors.toList());
List<String> res = new ArrayList<>();
for (BaseCrossDirInfoPO dirPo : dirList) {
Integer dirType = dirPo.getDirType();
String dirName = BaseEnum.SignalDirectionEnum.getNameByCode(dirType);
List<CrossTurnInfoPO> turnList = baseCrossTurnInfoMapper.selectByCrossIdAndDir(crossId, dirType);
for (CrossTurnInfoPO turnPO : turnList) {
String turnType = turnPO.getTurnType();
String turnDesc = TurnConvertEnum.getDescByCode(turnType);
res.add(dirName + "进口" + turnDesc);
}
}
return res;
}
private List<String> buildDirMenu(String crossId) {
List<BaseCrossDirInfoPO> poList = baseCrossDirInfoMapper.selectByCrossId(crossId);
List<BaseCrossDirInfoPO> filteredList = poList.stream()
.filter(po -> po.getInOutType() == 1)
.collect(Collectors.toList());
List<String> res = new ArrayList<>();
for (BaseCrossDirInfoPO po : filteredList) {
Integer dirType = po.getDirType();
String dirName = BaseEnum.SignalDirectionEnum.getNameByCode(dirType);
res.add(dirName + "进口");
}
return res;
}
}
...@@ -33,7 +33,7 @@ public class StrategyAndMetricsEnum { ...@@ -33,7 +33,7 @@ public class StrategyAndMetricsEnum {
@Getter @Getter
public enum Metrics { public enum Metrics {
NO_STOP_RATE("1", "不停车通过率", "%", "noStopRate"), NO_STOP_RATE("1", "不停车通过率", "%", "noStopRate"),
STOP_RATE("2", "一/二/三次及以上停车通过率", "%", "oneStopRate"), STOP_RATE("2", "停车通过率", "%", "oneStopRate"),
AVERAGE_DELAY("3", "平均延误", "s", "delayTime"), AVERAGE_DELAY("3", "平均延误", "s", "delayTime"),
MAX_QUEUE_LENGTH("4", "最大排队长度", "m", "queueLength"), MAX_QUEUE_LENGTH("4", "最大排队长度", "m", "queueLength"),
STOP_TIMES("5", "停车次数", "次", "stopTimes"), STOP_TIMES("5", "停车次数", "次", "stopTimes"),
......
...@@ -20,17 +20,17 @@ public enum TurnConvertEnum { ...@@ -20,17 +20,17 @@ public enum TurnConvertEnum {
S(2, "s", "直行"), S(2, "s", "直行"),
R(3, "r", "右转"), R(3, "r", "右转"),
U(4, "u", "掉头"), U(4, "u", "掉头"),
L_S(5, "l_s", "左转+直行"), L_S(5, "l_s", "直左"),
S_R(6, "s_r", "直行+右转"), S_R(6, "s_r", "直"),
L_S_R(7, "l_s_r", "左转+直行+右转"), L_S_R(7, "l_s_r", "左直右"),
L_R(8, "l_r", "左转+右转"), L_R(8, "l_r", "左"),
L_U(9, "l_u", "左转+掉头"), L_U(9, "l_u", "左转掉头"),
S_U(10, "s_u", "直行+掉头"), S_U(10, "s_u", "直行掉头"),
R_U(11, "r_u", "右转+掉头"), R_U(11, "r_u", "右转掉头"),
L_S_U(12, "l_s_u", "左转+直行+掉头"), L_S_U(12, "l_s_u", "左掉头"),
U_S_R(13, "u_s_r", "直行+右转+掉头"), U_S_R(13, "u_s_r", "直掉头"),
L_S_R_U(14, "l_s_r_u", "左转+直行+右转+掉头"), L_S_R_U(14, "l_s_r_u", "左直右掉头"),
L_R_U(15, "l_r_u", "左转+右转+掉头"); L_R_U(15, "l_r_u", "左掉头");
private Integer key; private Integer key;
private String code; private String code;
...@@ -74,12 +74,21 @@ public enum TurnConvertEnum { ...@@ -74,12 +74,21 @@ public enum TurnConvertEnum {
public static String getDescByCode(String code){ public static String getDescByCode(String code){
for (TurnConvertEnum e : TurnConvertEnum.values()) { for (TurnConvertEnum e : TurnConvertEnum.values()) {
if(e.code.contains(code)){ if(e.code.equals(code)){
return e.desc; return e.desc;
} }
} }
return null; return null;
} }
public static String getDescByKey(Integer key){
for (TurnConvertEnum e : TurnConvertEnum.values()) {
if(e.key.equals(key)){
return e.desc;
}
}
return null;
}
public static List<Integer> getKeyListBySingleCode(String singleCode){ public static List<Integer> getKeyListBySingleCode(String singleCode){
List<Integer> res = new ArrayList<>(); List<Integer> res = new ArrayList<>();
......
...@@ -4,10 +4,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -4,10 +4,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.databus.po.CrossBaseLaneInfoPO; import net.wanji.databus.po.CrossBaseLaneInfoPO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* @author duanruiming * @author duanruiming
* @date 2023/03/10 20:32 * @date 2023/03/10 20:32
*/ */
@Mapper @Mapper
public interface CrossBaseLaneInfoMapper extends BaseMapper<CrossBaseLaneInfoPO> { public interface CrossBaseLaneInfoMapper extends BaseMapper<CrossBaseLaneInfoPO> {
List<CrossBaseLaneInfoPO> selectInDirByCrossIdAndDir(String crossId, Integer dirType);
} }
...@@ -13,7 +13,7 @@ import java.util.List; ...@@ -13,7 +13,7 @@ import java.util.List;
@Repository @Repository
public interface LaneInfoMapper { public interface LaneInfoMapper {
// todo 只返回进口车道 // todo 只返回进口车道
List<LaneInfoPO> selectByCrossIdAndDir(@Param("crossId") String crossId, @Param("dir") Integer dir); List<LaneInfoPO> selectInDirByCrossIdAndDir(@Param("crossId") String crossId, @Param("dir") Integer dir);
void deleteByCrossIdAndDir(@Param("crossId") String crossId, @Param("dir") Integer dir); void deleteByCrossIdAndDir(@Param("crossId") String crossId, @Param("dir") Integer dir);
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
where cross_id = #{crossId} and dir = #{dir} and type = 2 where cross_id = #{crossId} and dir = #{dir} and type = 2
</delete> </delete>
<select id="selectByCrossIdAndDir" resultMap="BaseResultMap"> <select id="selectInDirByCrossIdAndDir" resultMap="BaseResultMap">
select select
id,code,sort,type,dir,turn,category,cross_id,rid,length,width,wkt,gmt_create,gmt_modified id,code,sort,type,dir,turn,category,cross_id,rid,length,width,wkt,gmt_create,gmt_modified
from t_base_lane_info from t_base_lane_info
......
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