Commit 19376395 authored by duanruiming's avatar duanruiming

[update] 优化实时灯态方向转向倒计时

parent da8bb6a8
......@@ -203,7 +203,7 @@ public class SchemeConfigServiceImpl implements SchemeConfigService {
phaseListElement.setYellowFlash(1);
}
phaseListElement.setAccompanyPhaseNoList(new ArrayList<>());
Integer phaseId = crossPhaseMapper.selectIdByCrossIdAndCoordPhaseNo(crossId, schemeId, phaseNo);
Integer phaseId = crossPhaseMapper.selectIdByCrossIdAndPhaseNo(crossId, schemeId, phaseNo);
List<SaveSchemeConfigDTO.DirListElement> dirList = buildDirList(crossId, phaseId);
phaseListElement.setDirList(dirList);
......@@ -307,7 +307,7 @@ public class SchemeConfigServiceImpl implements SchemeConfigService {
phaseListElement.setGreenFlash(1);
}
// 伴随相位的母相位列表
Integer phaseId = crossPhaseMapper.selectIdByCrossIdAndCoordPhaseNo(crossId, schemeId, phaseNo);
Integer phaseId = crossPhaseMapper.selectIdByCrossIdAndPhaseNo(crossId, schemeId, phaseNo);
if (phaseType == 3) {
List<String> superPhaseNoList = new ArrayList<>();
List<Integer> superIdList = crossAccompanyPhaseMapper.selectByPhaseId(phaseId);
......@@ -453,7 +453,7 @@ public class SchemeConfigServiceImpl implements SchemeConfigService {
String schemeNo = phaseScheme.getSchemeNo();
Integer schemeId = baseCrossSchemeMapper.selectIdByCrossIdAndSchemeNo(crossId, schemeNo);
String coordPhaseNo = phaseScheme.getCoordPhaseNo();
Integer phaseId = crossPhaseMapper.selectIdByCrossIdAndCoordPhaseNo(crossId, schemeId, coordPhaseNo);
Integer phaseId = crossPhaseMapper.selectIdByCrossIdAndPhaseNo(crossId, schemeId, coordPhaseNo);
if (phaseId != null) {
baseCrossSchemeMapper.updateCoordPhase(crossId, schemeNo, phaseId);
}
......@@ -585,7 +585,7 @@ public class SchemeConfigServiceImpl implements SchemeConfigService {
CrossAccompanyPhasePO crossAccompanyPhasePO = new CrossAccompanyPhasePO();
crossAccompanyPhasePO.setCrossId(crossId);
crossAccompanyPhasePO.setPhaseId(accompanyPhaseId);
Integer superPhaseId = crossPhaseMapper.selectIdByCrossIdAndCoordPhaseNo(
Integer superPhaseId = crossPhaseMapper.selectIdByCrossIdAndPhaseNo(
crossId, schemeId, superPhaseNo);
crossAccompanyPhasePO.setSuperId(superPhaseId);
crossAccompanyPhasePOList.add(crossAccompanyPhasePO);
......
......@@ -7,10 +7,10 @@ import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.wanji.databus.dao.entity.BaseCrossSchemePO;
import net.wanji.databus.dao.entity.CrossLightsPO;
import net.wanji.databus.dao.mapper.CrossInfoMapper;
import net.wanji.databus.dao.mapper.CrossLightsMapper;
import net.wanji.databus.dao.mapper.ManufacturerInfoMapper;
import net.wanji.databus.dao.entity.CrossPhaseLightsPO;
import net.wanji.databus.dao.mapper.*;
import net.wanji.databus.po.CrossInfoPO;
import net.wanji.databus.po.ManufacturerInfoPO;
import net.wanji.databus.vo.BaseCrossInfo;
......@@ -39,6 +39,9 @@ public class HkLightsStatusServiceImpl implements HkLightsStatusService {
private final CrossLightsMapper crossLightsMapper;
private final CrossInfoMapper crossInfoMapper;
private final ManufacturerInfoMapper manufacturerInfoMapper;
private final CrossPhaseMapper crossPhaseMapper;
private final CrossPhaseLightsMapper crossPhaseLightsMapper;
private final CrossSchemeMapper crossSchemeMapper;
public static Map<String, String> runModeParseMap = new HashMap<String, String>();
......@@ -93,7 +96,7 @@ public class HkLightsStatusServiceImpl implements HkLightsStatusService {
List<LightsStatusVO> result = new ArrayList<>();
CrossInfoPO crossInfoPO = crossInfoMapper.selectByPrimaryKey(crossId);
List<CrossLightsPO> CrossLightsPOList = crossLightsMapper.selectByCrossId(crossId);
List<CrossLightsPO> crossLightsPOList = crossLightsMapper.selectByCrossId(crossId);
if (Objects.nonNull(crossInfoPO)) {
String signalCode = crossInfoPO.getCode();
......@@ -106,6 +109,7 @@ public class HkLightsStatusServiceImpl implements HkLightsStatusService {
for (RealTimeStateInfoPO resultPO : realTimeStateInfoListPO.getList()) {
infoVo = new LightsStatusVO();
Integer patternNo = resultPO.getPatternNo();
BaseCrossSchemePO baseCrossSchemePO = crossSchemeMapper.selectByCrossIdAndSchemeNo(crossId, patternNo);
List<RingsPO> rings = resultPO.getRings(); // 环列表
List<ChannelStatePO> channelState = resultPO.getChannelState();// 灯组列表
String HKControlType = resultPO.getControlType();
......@@ -132,13 +136,27 @@ public class HkLightsStatusServiceImpl implements HkLightsStatusService {
List<PhaseInfoPO> phaseList = ring.getPhaseList();
for (PhaseInfoPO phaseInfoPO : phaseList) {
Integer phaseNo = phaseInfoPO.getPhaseNo();
Integer countdown = phaseInfoPO.getCountdown();
Integer phaseId = crossPhaseMapper.selectPhaseId(crossId, baseCrossSchemePO.getId(), phaseNo);
List<CrossPhaseLightsPO> crossPhaseLightsPOList = crossPhaseLightsMapper.selectByCrossId(crossId);
for (CrossPhaseLightsPO crossPhaseLightsPO : crossPhaseLightsPOList) {
if (Objects.equals(phaseId, crossPhaseLightsPO.getPhaseId())) {
Integer lightsId = crossPhaseLightsPO.getLightsId();
for (CrossLightsPO crossLightsPO : crossLightsPOList) {
if (Objects.equals(lightsId, crossLightsPO.getId())) {
Integer dir = crossLightsPO.getDir();
Integer turn = crossLightsPO.getTurn();
phaseMap.put(String.join("-", String.valueOf(dir), String.valueOf(turn)), countdown);
}
}
}
}
Integer vehicleStatus = phaseInfoPO.getVehicleStatus();
Integer phaseLength = phaseInfoPO.getPhaseLength();
Integer red = phaseInfoPO.getRed();
Integer yellow = phaseInfoPO.getYellow();
Integer green = phaseLength - yellow - red;
// 修改逻辑,value为相位倒计时
phaseMap.put(String.valueOf(phaseNo), phaseInfoPO.getCountdown());
if (2 != vehicleStatus) { // 2红灯
infoVo.setPhaseId(String.valueOf(phaseNo));
}
......@@ -152,7 +170,7 @@ public class HkLightsStatusServiceImpl implements HkLightsStatusService {
Integer channelNo = channelStatePO.getChannelNo();
Integer state = channelStatePO.getState();
String color = transferHKLampGroup(state);
for (CrossLightsPO po : CrossLightsPOList) {
for (CrossLightsPO po : crossLightsPOList) {
if (StringUtils.equals(po.getLightsNo(), String.valueOf(channelNo))) {
String direction = po.getDir().toString();
String turn = po.getTurn().toString();
......
......@@ -14,9 +14,9 @@ import java.util.List;
@Repository
public interface BaseCrossPhaseMapper {
Integer selectIdByCrossIdAndCoordPhaseNo(@Param("crossId") String crossId,
@Param("schemeId") Integer schemeId,
@Param("coordPhaseNo") String coordPhaseNo);
Integer selectIdByCrossIdAndPhaseNo(@Param("crossId") String crossId,
@Param("schemeId") Integer schemeId,
@Param("phaseNo") String phaseNo);
void insertOne(CrossPhasePO crossPhasePO);
......
......@@ -23,4 +23,6 @@ public interface CrossPhaseMapper {
List<CrossPhasePO> selectByCrossId(@Param("crossId") String crossId);
void deleteByCrossId(String crossId);
Integer selectPhaseId(@Param("crossId") String crossId, @Param("schemeId") Integer schemeId, @Param("phaseNo") Integer phaseNo);
}
......@@ -35,7 +35,7 @@ public class LightsStatusVO extends BaseCrossInfo {
private String schemeId;
@ApiModelProperty(value = "灯组状态")
private Map<String,Object> dirLampGroupMap;
@ApiModelProperty(value = "相位对象:key相位编号,value绿灯时长,", notes = "目前没有用到")
@ApiModelProperty(value = "方向转向倒计时")
private Map<String,Object> phaseMap;
public void setCycleCountDown(Integer cycleCountDown) {
......
......@@ -120,9 +120,9 @@
where cross_id = #{crossId}
</delete>
<select id="selectIdByCrossIdAndCoordPhaseNo" resultType="java.lang.Integer">
<select id="selectIdByCrossIdAndPhaseNo" resultType="java.lang.Integer">
select id from t_base_cross_phase
where cross_id = #{crossId} and plan_id = #{schemeId} and phase_no = #{coordPhaseNo}
where cross_id = #{crossId} and plan_id = #{schemeId} and phase_no = #{phaseNo}
</select>
<select id="selectById" resultMap="BaseResultMap">
......
......@@ -71,6 +71,11 @@
where cross_id = #{crossId} and phase_no = #{phaseNo}
</select>
<select id="selectPhaseId" resultType="java.lang.Integer">
select id from t_cross_phase
where cross_id = #{crossId} and plan_id = #{schemeId} and phase_no = #{phaseNo}
</select>
<select id="selectByCrossId" resultMap="BaseResultMap">
select
id,phase_no,name,sort,cross_id,plan_id,ring_no,control_mode,phase_time,green_time,green_flash_time,ped_flash_time,yellow_time,red_time,min_green_time,max_green_time,gmt_create,gmt_modified
......
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