Commit ffa69dc2 authored by duanruiming's avatar duanruiming

Merge remote-tracking branch 'origin/master'

parents 410327b3 f4e905a2
......@@ -5,10 +5,11 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.common.annotation.aspect.AspectLog;
import net.wanji.databus.bo.CrossIdBO;
import net.wanji.common.enums.BaseEnum;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.bo.CrossIdBO;
import net.wanji.web.dto.*;
import net.wanji.web.po.RingPhasePO;
import net.wanji.web.service.impl.PlanSendServiceImpl;
import net.wanji.web.vo.PhaseListByTimeVO;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -16,8 +17,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author hanbing
* @date 2023/01/04 16:10
......@@ -92,7 +91,7 @@ public class PlanSendController {
@AspectLog(description = "信号机方案同步", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "信号机方案同步", notes = "信号机方案同步")
@PostMapping("/syncScheme")
public JsonViewObject syncScheme(@RequestBody CrossIdBO crossIdBO) throws Exception{
public JsonViewObject syncScheme(@RequestBody CrossIdBO crossIdBO) throws Exception {
JsonViewObject jsonViewObject = planSendService.syncScheme(crossIdBO);
return jsonViewObject;
}
......@@ -100,7 +99,7 @@ public class PlanSendController {
@AspectLog(description = "信号机调度日计划同步", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "信号机调度日计划同步", notes = "信号机调度日计划同步")
@PostMapping("/syncSchedules")
public JsonViewObject syncSchedules(@RequestBody CrossIdBO crossIdBO) throws Exception{
public JsonViewObject syncSchedules(@RequestBody CrossIdBO crossIdBO) throws Exception {
// planSendService.syncSchedules(crossIdBO.getCrossId());
return JsonViewObject.newInstance().success("");
}
......@@ -125,11 +124,10 @@ public class PlanSendController {
@ApiResponse(code = 200, message = "OK", response = SaveSchemeConfigDTO.PhaseListElement.class),
})
public JsonViewObject phaseListByTimeSingleRing(@RequestBody CrossIdAndTimeDTO crossIdAndTimeDTO) {
List<SaveSchemeConfigDTO.PhaseListElement> phaseListByTime
= planSendService.phaseListByTimeSingleRing(crossIdAndTimeDTO);
RingPhasePO ringPhasePO = planSendService.phaseListByTimeSingleRing(crossIdAndTimeDTO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(phaseListByTime);
return jsonViewObject.success(ringPhasePO);
}
@AspectLog(description = "下发数据到UTC", operationType = BaseEnum.OperationTypeEnum.UPDATE)
......
package net.wanji.web.po;
import lombok.Data;
import net.wanji.web.dto.SaveSchemeConfigDTO;
import java.util.List;
/**
* @ClassName RingPhasePO
* @Description 根据当前时间返回相位列表
* @Author zhouleilei
* @Date 2024/11/24 15:54
*/
@Data
public class RingPhasePO {
//优化前的方案列表
private List<SaveSchemeConfigDTO.PhaseListElement> oriPhaseList;
//优化后的方案列表
private List<SaveSchemeConfigDTO.PhaseListElement> optPhaseList;
}
package net.wanji.web.service;
import net.wanji.databus.bo.CrossIdBO;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.web.dto.*;
import net.wanji.databus.bo.CrossIdBO;
import net.wanji.web.dto.CrossIdAndPhaseIdsDTO;
import net.wanji.web.dto.CrossIdAndTimeDTO;
import net.wanji.web.dto.ScheduleIdDTO;
import net.wanji.web.dto.SchemeIdDTO;
import net.wanji.web.po.RingPhasePO;
import net.wanji.web.vo.PhaseListByTimeVO;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/3 16:14
......@@ -30,7 +32,7 @@ public interface PlanSendService {
PhaseListByTimeVO phaseListByTime(CrossIdAndTimeDTO crossIdAndTimeDTO);
List<SaveSchemeConfigDTO.PhaseListElement> phaseListByTimeSingleRing(CrossIdAndTimeDTO crossIdAndTimeDTO);
RingPhasePO phaseListByTimeSingleRing(CrossIdAndTimeDTO crossIdAndTimeDTO);
/**
* 下发数据到utc数据库
......
......@@ -122,6 +122,10 @@ public interface FeignCommon {
@PostMapping("/staticInfo/crossSchemeNo")
JsonViewObject getSchemeNo(@RequestParam String crossId);
// 海信-获取方案号
@PostMapping("/staticInfo/crossSchemeNoStr")
JsonViewObject getSchemeNoStr(@RequestParam String crossId);
// 海信-下发临时方案
@PostMapping("/controlCommand/tempSchemeDetail")
JsonViewObject tempSchemeDetail(@RequestBody TempSchemeSendVO tempDetailVo);
......
utc.service.url=http://173.0.0.1:32000/utc
utc.dt.service.url=http://173.0.0.1:39002/utc-dt
utc.hisense.service.url=http://173.0.0.1:39003/utc-hisense
control.url=http://173.0.0.1:32001/web
ehualu.url=http://173.0.0.1:30015
\ No newline at end of file
utc.service.url=http://173.17.0.1:32000/utc
utc.dt.service.url=http://173.17.0.1:39002/utc-dt
utc.hisense.service.url=http://173.17.0.1:39003/utc-hisense
control.url=http://173.17.0.1:32001/web
ehualu.url=http://173.17.0.1:30015
\ No newline at end of file
......@@ -211,13 +211,11 @@ public class DiagnoServiceImpl implements DiagnoService {
@Override
public List<SchemeOptVO.PhaseOptTime> queryOptTime(CrossIdAndSchemeIdDTO crossIdAndSchemeIdDTO) {
//TODO
String crossId = crossIdAndSchemeIdDTO.getCrossId();
Integer schemeId = crossIdAndSchemeIdDTO.getSchemeId();
List<SchemeOptVO.PhaseOptTime> phaseOptTimeList = new ArrayList<>();
CrossSchemeRingsDTO crossSchemeRingsDTO = new CrossSchemeRingsDTO();
crossSchemeRingsDTO.setCrossId(crossId);
//方案号*3-2
crossSchemeRingsDTO.setPattern(String.valueOf(schemeId));
//通过路口号和方案号查询方案id
......
......@@ -9,12 +9,11 @@ import net.wanji.common.annotation.aspect.AspectLog;
import net.wanji.common.enums.BaseEnum;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.dao.entity.CrossSchedulesPO;
import net.wanji.databus.dao.entity.CrossSchemeStageOptLogPO;
import net.wanji.databus.dto.*;
import net.wanji.databus.po.CoordinationStatus;
import net.wanji.databus.po.CrossInfoPO;
import net.wanji.databus.vo.PlanSectionVO;
import net.wanji.databus.vo.SchemePhaseLightsVO;
import net.wanji.utc.hisense.pojo.result.CoordinationStatus;
import net.wanji.utc.hisense.pojo.result.CrossSchemeRings;
import net.wanji.utc.hisense.service.StaticInfoService;
import org.apache.commons.lang3.ObjectUtils;
......@@ -102,7 +101,7 @@ public class StaticInfoController {
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CoordinationStatus.class)
})
public JsonViewObject crossPlanId(@NotNull String crossId) throws Exception {
public JsonViewObject crossPlanId(@NotNull String crossId) throws Exception {
CoordinationStatus coordinationStatus = staticInfoService.crossPlan(crossId);
if (ObjectUtils.isNotEmpty(coordinationStatus)) {
return JsonViewObject.newInstance().success(coordinationStatus);
......@@ -137,12 +136,6 @@ public class StaticInfoController {
@ApiResponse(code = 200, message = "OK", response = CrossSchemeRings.class)
})
public JsonViewObject schemeOptLog(@RequestBody @Validated CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception {
List<CrossSchemeStageOptLogPO> crossSchemeStageOptLogPOList = staticInfoService.schemeOptLog(crossSchemeRingsDTO);
if (ObjectUtils.isNotEmpty(crossSchemeStageOptLogPOList)) {
return JsonViewObject.newInstance().success(crossSchemeStageOptLogPOList);
} else {
return JsonViewObject.newInstance().fail("查询方案优化记录 失败");
}
return JsonViewObject.newInstance().success(staticInfoService.schemeOptLog(crossSchemeRingsDTO));
}
}
......@@ -6,7 +6,7 @@ import net.wanji.databus.dto.*;
import net.wanji.databus.po.CrossInfoPO;
import net.wanji.databus.vo.PlanSectionVO;
import net.wanji.databus.vo.SchemePhaseLightsVO;
import net.wanji.utc.hisense.pojo.result.CoordinationStatus;
import net.wanji.databus.po.CoordinationStatus;
import net.wanji.utc.hisense.pojo.result.CrossSchemeRings;
import java.util.List;
......
package net.wanji.utc.hisense.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
......@@ -34,6 +35,7 @@ import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* @author duanruiming
......@@ -379,8 +381,10 @@ public class ControlCommandServiceImpl implements ControlCommandService {
String pattern = tempSchemeSendVO.getPattern();
crossSchemeRingsDTO.setCrossId(crossId);
crossSchemeRingsDTO.setPattern(pattern);
boolean isOk = true;
//方案环图请求
CrossSchemeRings crossSchemeRings = staticInfoService.crossSchemeRings(crossSchemeRingsDTO);
long currentTimeMillis = System.currentTimeMillis();
if (Optional.ofNullable(crossSchemeRings).isPresent()) {
//环数
int ringCount = Integer.parseInt(crossSchemeRings.getRingCount());
......@@ -406,10 +410,18 @@ public class ControlCommandServiceImpl implements ControlCommandService {
try {
stagePhaseDTOList = staticInfoServiceImpl.stagePhaseList(cycle, ringCount, ringPhasesMap);
} catch (Exception e) {
CrossSchemeStageOptLogPO crossSchemeStageOptLogPO = new CrossSchemeStageOptLogPO();
crossSchemeStageOptLogPO.setCrossId(crossId);
//方案号处理
int schemeId = (Integer.valueOf(crossSchemeRingsDTO.getPattern()) + 2) / 3;
crossSchemeStageOptLogPO.setSchemeId(schemeId);
crossSchemeStageOptLogPO.setOptResult(2);
crossSchemeStageOptLogPO.setDataInfo(JSONObject.toJSONString(tempSchemeSendVO));
crossSchemeStageOptLogPO.setBatchTime(currentTimeMillis);
crossSchemeStageOptLogMapper.insert(crossSchemeStageOptLogPO);
log.error("绿信比有误!");
throw new RuntimeException(e);
}
long currentTimeMillis = System.currentTimeMillis();
if (ObjectUtil.isNotEmpty(stagePhaseDTOList)) {
for (StagePhaseDTO stagePhaseDTO : stagePhaseDTOList) {
CrossSchemeStageOptLogPO crossSchemeStageOptLogPO = new CrossSchemeStageOptLogPO();
......@@ -422,19 +434,31 @@ public class ControlCommandServiceImpl implements ControlCommandService {
crossSchemeStageOptLogPO.setOptResult(1);
crossSchemeStageOptLogPO.setDataInfo(JSONObject.toJSONString(tempSchemeSendVO));
crossSchemeStageOptLogPO.setBatchTime(currentTimeMillis);
List<RingPhaseDTO> ringPhaseList = stagePhaseDTO.getRingPhaseList();
List<Integer> list = ringPhaseList.stream().map(RingPhaseDTO::getPhaseId).collect(Collectors.toList());
String phases = CollectionUtil.join(list,",");
crossSchemeStageOptLogPO.setPhaseList(phases);
crossSchemeStageOptLogMapper.insert(crossSchemeStageOptLogPO);
}
} else {
CrossSchemeStageOptLogPO crossSchemeStageOptLogPO = new CrossSchemeStageOptLogPO();
crossSchemeStageOptLogPO.setCrossId(crossId);
//方案号处理
int schemeId = (Integer.valueOf(crossSchemeRingsDTO.getPattern()) + 2) / 3;
crossSchemeStageOptLogPO.setSchemeId(schemeId);
crossSchemeStageOptLogPO.setOptResult(2);
crossSchemeStageOptLogPO.setDataInfo(JSONObject.toJSONString(tempSchemeSendVO));
crossSchemeStageOptLogPO.setBatchTime(currentTimeMillis);
crossSchemeStageOptLogMapper.insert(crossSchemeStageOptLogPO);
isOk = false;
}
} else {
isOk = false;
}
if (!isOk) {
CrossSchemeStageOptLogPO crossSchemeStageOptLogPO = new CrossSchemeStageOptLogPO();
crossSchemeStageOptLogPO.setCrossId(crossId);
//方案号处理
int schemeId = (Integer.valueOf(crossSchemeRingsDTO.getPattern()) + 2) / 3;
crossSchemeStageOptLogPO.setSchemeId(schemeId);
crossSchemeStageOptLogPO.setOptResult(2);
crossSchemeStageOptLogPO.setDataInfo(JSONObject.toJSONString(tempSchemeSendVO));
crossSchemeStageOptLogPO.setBatchTime(currentTimeMillis);
crossSchemeStageOptLogMapper.insert(crossSchemeStageOptLogPO);
}
}
......
......@@ -22,7 +22,7 @@ import net.wanji.utc.hisense.common.constants.HttpConstants;
import net.wanji.utc.hisense.mapper.*;
import net.wanji.utc.hisense.pojo.dto.RingPhaseDTO;
import net.wanji.utc.hisense.pojo.dto.StagePhaseDTO;
import net.wanji.utc.hisense.pojo.result.CoordinationStatus;
import net.wanji.databus.po.CoordinationStatus;
import net.wanji.utc.hisense.pojo.result.CrossSchemeRings;
import net.wanji.utc.hisense.pojo.view.*;
import net.wanji.utc.hisense.service.StaticInfoService;
......@@ -69,7 +69,7 @@ public class StaticInfoServiceImpl implements StaticInfoService {
private VNtcipChannelViewMapper vNtcipChannelViewMapper;
@Resource
private VNtcipPatternMapper vNtcipPatternMapper;
@Resource
@Resource
private CrossSchemeStageOptLogMapper crossSchemeStageOptLogMapper;
@Override
......@@ -180,7 +180,7 @@ public class StaticInfoServiceImpl implements StaticInfoService {
* @Param greenTime 绿
* @Param yellowTime 黄
**/
public Map<Integer, List<RingPhaseDTO>> getRingPhasesMap(int ringCount, JSONObject cycleJSONObject, CrossSchemeRings.Phase phaseDto) {
public Map<Integer, List<RingPhaseDTO>> getRingPhasesMap(int ringCount, JSONObject cycleJSONObject, CrossSchemeRings.Phase phaseDto) {
//16 个相位的红灯时间(单位秒),中间用空格隔开,不存在的相位置 0。
String[] redTime = phaseDto.getRedTime().split(" ");
//16 个相位的绿灯时间(单位秒),中间用空格隔开,不存在的相位置 0。
......@@ -246,11 +246,11 @@ public class StaticInfoServiceImpl implements StaticInfoService {
}
/**
* @Description 环封装阶段
* @Param [cycle, ringCount, ringPhasesMap]
* @return java.util.List<net.wanji.utc.hisense.pojo.dto.StagePhaseDTO>
**/
public List<StagePhaseDTO> stagePhaseList(int cycle, int ringCount,Map<Integer, List<RingPhaseDTO>> ringPhasesMap){
* @return java.util.List<net.wanji.utc.hisense.pojo.dto.StagePhaseDTO>
* @Description 环封装阶段
* @Param [cycle, ringCount, ringPhasesMap]
**/
public List<StagePhaseDTO> stagePhaseList(int cycle, int ringCount, Map<Integer, List<RingPhaseDTO>> ringPhasesMap) {
//已经计算的阶段时长
int stageTime = 0;
//循环次数,也代表阶段号
......@@ -298,27 +298,36 @@ public class StaticInfoServiceImpl implements StaticInfoService {
//取最后一位
RingPhaseDTO phaseDTO = collect.get(collect.size() - 1);
//状态最后一次出现的1的下一个相位
int index = ringPhaseDTOS.lastIndexOf(phaseDTO)+1;
RingPhaseDTO ringPhaseDTO = ringPhaseDTOS.get(index);
//计算该相位及走过的所有时间
int totalTime = ringPhaseDTOS.stream().filter(x -> ringPhaseDTOS.indexOf(x) <= index).mapToInt(RingPhaseDTO::getPhaseTime).sum();
//totalTime - stageTime 为该相位剩余时间
Integer phaseTime = totalTime - stageTime;
if (firstPhaseTime == 0) {
int index = ringPhaseDTOS.lastIndexOf(phaseDTO) + 1;
RingPhaseDTO ringPhaseDTO = null;
/*if (index >= ringPhaseDTOS.size()) {
firstRingPhaseDTO = ringPhaseDTOS.get(ringPhaseDTOS.size() - 1);
int phaseTime = cycle - stageTime;
firstPhaseTime = phaseTime;
firstRingPhaseDTO = ringPhaseDTO;
minStageMap.put(i, index);
} else {
if (phaseTime <= firstPhaseTime) {
if (phaseTime < firstPhaseTime) {
//清空缓存
minStageMap.clear();
}
minStageMap.put(i, index - 1);
} else {*/
ringPhaseDTO = ringPhaseDTOS.get(index);
//计算该相位及走过的所有时间
int totalTime = ringPhaseDTOS.stream().filter(x -> ringPhaseDTOS.indexOf(x) <= index).mapToInt(RingPhaseDTO::getPhaseTime).sum();
//totalTime - stageTime 为该相位剩余时间
Integer phaseTime = totalTime - stageTime;
if (firstPhaseTime == 0) {
firstPhaseTime = phaseTime;
firstRingPhaseDTO = ringPhaseDTO;
minStageMap.put(i, index);
} else {
if (phaseTime <= firstPhaseTime) {
if (phaseTime < firstPhaseTime) {
//清空缓存
minStageMap.clear();
}
firstPhaseTime = phaseTime;
firstRingPhaseDTO = ringPhaseDTO;
minStageMap.put(i, index);
}
}
}
// }
stageList.add(ringPhaseDTO);
} else {
//在第一个相位
......@@ -464,6 +473,8 @@ public class StaticInfoServiceImpl implements StaticInfoService {
crossLightsPO.setType(3);
} else if (wjPerson == 0 && wjLightsDir > 0) {
crossLightsPO.setType(1);
} else if (wjLightsDir == 7) {
crossLightsPO.setType(1);
}
//key
String lightMapKey = String.valueOf(wjLightsDir).concat(String.valueOf(wjLightsTurn)).concat(String.valueOf(crossLightsPO.getType()));
......@@ -771,9 +782,9 @@ public class StaticInfoServiceImpl implements StaticInfoService {
@Override
public List<CrossSchemeStageOptLogPO> schemeOptLog(CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception {
LambdaQueryWrapper<CrossSchemeStageOptLogPO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CrossSchemeStageOptLogPO::getCrossId, crossSchemeRingsDTO.getCrossId())
.eq(CrossSchemeStageOptLogPO::getSchemeId,crossSchemeRingsDTO.getPattern())
.inSql(CrossSchemeStageOptLogPO::getBatchTime, "select max(batch_time) from t_cross_scheme_opt_log where cross_id = '"+crossSchemeRingsDTO.getCrossId()+"' and scheme_id = "+crossSchemeRingsDTO.getPattern());
queryWrapper.eq(CrossSchemeStageOptLogPO::getCrossId, crossSchemeRingsDTO.getCrossId())
.eq(CrossSchemeStageOptLogPO::getSchemeId, crossSchemeRingsDTO.getPattern())
.inSql(CrossSchemeStageOptLogPO::getBatchTime, "select max(batch_time) from t_cross_scheme_opt_log where cross_id = '" + crossSchemeRingsDTO.getCrossId() + "' and scheme_id = " + crossSchemeRingsDTO.getPattern());
List<CrossSchemeStageOptLogPO> crossSchemeStageOptLogPOS = crossSchemeStageOptLogMapper.selectList(queryWrapper);
return crossSchemeStageOptLogPOS;
}
......
......@@ -147,6 +147,18 @@ public class StaticInfoController {
public JsonViewObject crossSchemeNo(@Validated @RequestBody CrossIdDTO crossIdDTO) throws Exception {
return staticInfoService.crossSchemeNo(crossIdDTO.getCrossId());
}
@AspectLog(description = "获取当前运行方案号", operationType = BaseEnum.OperationTypeEnum.QUERY)
@PostMapping(value = "/crossSchemeNoStr", produces = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossSchedulesPO.class)
})
@ApiOperation(value = "获取当前运行方案号", notes = "获取当前运行方案号")
public JsonViewObject gwr( String crossId) throws Exception {
return staticInfoService.crossSchemeNo(crossId);
}
@AspectLog(description = "方案环图请求", operationType = BaseEnum.OperationTypeEnum.QUERY)
@PostMapping(value = "/crossSchemeRings", produces = MediaType.APPLICATION_JSON)
@ApiOperation(value = "方案环图请求", notes = "方案环图请求")
......
......@@ -25,6 +25,9 @@ public class CrossSchemeStageOptLogPO {
@ApiModelProperty(value = "相位编号")
private String phaseNo;
@ApiModelProperty(value = "阶段对应的相位号")
private String phaseList;
@ApiModelProperty(value = "相位时长")
private Integer phaseTime;
......
package net.wanji.databus.dao.mapper;
import net.wanji.databus.dao.entity.BaseCrossSchemePO;
import net.wanji.databus.po.CrossSchemeInfoPO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -58,4 +59,5 @@ public interface BaseCrossSchemeMapper {
List<BaseCrossSchemePO> selectAll();
BaseCrossSchemePO selectByCrossIdAndSchemeId(String crossId, Integer schemeId);
List<CrossSchemeInfoPO> selectSchemeInfoByCrossIdAndSchemeId(String crossId, Integer schemeId);
}
package net.wanji.utc.hisense.pojo.result;
package net.wanji.databus.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
......
package net.wanji.databus.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @ClassName CrossSchemeInfoPO
* @Description 路口方案及相位等信息
* @Author zhouleilei
* @Date 2024/11/24 21:26
*/
@Data
public class CrossSchemeInfoPO {
@ApiModelProperty(name = "路口编号", notes = "")
private String crossId;
@ApiModelProperty(name = "方案id", notes = "")
private String schemeId;
@ApiModelProperty(name = "方案号", notes = "")
private String schemeNo;
@ApiModelProperty(name = "相位号", notes = "")
private String phaseNo;
@ApiModelProperty(name = "相位时间", notes = "")
private String phaseTime;
@ApiModelProperty(name = "相位id", notes = "")
private String phaseId;
@ApiModelProperty(name = "绿灯时间", notes = "")
private String greenTime;
@ApiModelProperty(name = "黄灯时间", notes = "")
private String yellowTime;
@ApiModelProperty(name = "红灯时间", notes = "")
private String redTime;
@ApiModelProperty(name = "灯组id", notes = "")
private String lightsId;
@ApiModelProperty(name = "灯组方向", notes = "")
private String dir;
@ApiModelProperty(name = "车道id", notes = "")
private String landId;
@ApiModelProperty(name = "车道转向", notes = "1左转;2直行;3右转;4掉头;5直左;6直右;7左直右;8左右;9左转掉头;10直行掉头;11右转掉头;12左直掉头;13直右掉头;14左直右掉头;15左右掉头")
private String turn;
@ApiModelProperty(name = "车道类别", notes = "1机动车;2非机动车;3公交专用;4可变;5潮汐")
private String laneType;
}
......@@ -4,7 +4,7 @@
<!-- 通用查询映射结果 -->
<resultMap type="net.wanji.databus.dao.entity.BaseCrossSchemePO" id="BaseResultMap">
<result property="id" column="id" />
<result property="id" column="id"/>
<result property="schemeNo" column="scheme_no"/>
<result property="name" column="name"/>
<result property="crossId" column="cross_id"/>
......@@ -118,7 +118,7 @@
<select id="selectByCrossId" resultMap="BaseResultMap">
select
id,scheme_no,name,cross_id,cycle,coord_phase,offset,source,is_deleted,status,gmt_create,gmt_modified
id,scheme_no,name,cross_id,cycle,coord_phase,offset,source,is_deleted,status,gmt_create,gmt_modified
from t_base_cross_scheme
where cross_id = #{crossId}
</select>
......@@ -130,14 +130,14 @@
<select id="selectByCrossIdAndSchemeName" resultMap="BaseResultMap">
select
id,scheme_no,name,cross_id,cycle,coord_phase,offset,source,is_deleted,status,gmt_create,gmt_modified
id,scheme_no,name,cross_id,cycle,coord_phase,offset,source,is_deleted,status,gmt_create,gmt_modified
from t_base_cross_scheme
where cross_id = #{crossId} and name = #{schemeName}
</select>
<select id="selectById" resultType="net.wanji.databus.dao.entity.BaseCrossSchemePO">
select
id,scheme_no,name,cross_id,cycle,coord_phase,offset,source,is_deleted,status,gmt_create,gmt_modified
id,scheme_no,name,cross_id,cycle,coord_phase,offset,source,is_deleted,status,gmt_create,gmt_modified
from t_base_cross_scheme
where id = #{id}
</select>
......@@ -157,32 +157,67 @@
<select id="selectByCrossIdAndSchemeNo" resultType="net.wanji.databus.dao.entity.BaseCrossSchemePO">
select
id,scheme_no,name,cross_id,cycle,coord_phase,offset,source,is_deleted,status,gmt_create,gmt_modified
id,scheme_no,name,cross_id,cycle,coord_phase,offset,source,is_deleted,status,gmt_create,gmt_modified
from t_base_cross_scheme
where cross_id = #{crossId} and scheme_no = #{schemeNo}
</select>
<select id="selectByCrossIdAndPartialSchemeName"
resultType="net.wanji.databus.dao.entity.BaseCrossSchemePO">
select <include refid="baseColumnList"/>
resultType="net.wanji.databus.dao.entity.BaseCrossSchemePO">
select
<include refid="baseColumnList"/>
from t_base_cross_scheme
where cross_id = #{crossId}
<if test="schemeName != null and schemeName != ''">
AND name LIKE CONCAT('%',#{schemeName},'%')
</if>
<if test="schemeName != null and schemeName != ''">
AND name LIKE CONCAT('%',#{schemeName},'%')
</if>
</select>
<select id="selectAll" resultType="net.wanji.databus.dao.entity.BaseCrossSchemePO">
select
id,scheme_no,name,cross_id,cycle,coord_phase,offset,source,is_deleted,status,gmt_create,gmt_modified
id,scheme_no,name,cross_id,cycle,coord_phase,offset,source,is_deleted,status,gmt_create,gmt_modified
from t_base_cross_scheme
</select>
<select id="selectByCrossIdAndSchemeId" resultType="net.wanji.databus.dao.entity.BaseCrossSchemePO">
select
id,scheme_no,name,cross_id,cycle,coord_phase,offset,source,is_deleted,status,gmt_create,gmt_modified
id,scheme_no,name,cross_id,cycle,coord_phase,offset,source,is_deleted,status,gmt_create,gmt_modified
from t_base_cross_scheme
where cross_id = #{crossId} and id = #{schemeId}
</select>
<select id="selectSchemeInfoByCrossIdAndSchemeId" resultType="net.wanji.databus.po.CrossSchemeInfoPO">
SELECT
sche.id AS schemeId,
sche.cross_id AS crossId,
sche.scheme_no AS schemeNo,
phase.phase_no AS phaseNo,
phase.phase_time AS phaseTime,
phase.id AS phaseId,
phase.green_time AS greenTime,
phase.yellow_time AS yellowTime,
phase.red_time AS redTime,
pl.lights_id AS lightsId,
light.dir,
ll.lane_id AS landId,
lane.turn,
lane.category AS laneType
FROM
t_base_cross_scheme sche
LEFT JOIN t_base_cross_phase phase ON sche.cross_id = phase.cross_id
AND sche.id = phase.plan_id
LEFT JOIN t_base_cross_phase_lights pl ON pl.cross_id = phase.cross_id
AND pl.phase_id = phase.id
LEFT JOIN t_base_cross_lights light ON light.cross_id = phase.cross_id
AND light.id = pl.lights_id
LEFT JOIN t_base_cross_lane_lights ll ON ll.cross_id = light.cross_id
AND ll.lights_id = light.id
LEFT JOIN t_base_lane_info lane ON lane.cross_id = ll.cross_id
AND lane.id = ll.lane_id
WHERE
sche.cross_id = #{crossId}
AND sche.scheme_no = #{schemeId}
ORDER BY
phaseNo ASC
</select>
</mapper>
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