Commit 72354af8 authored by zhouleilei's avatar zhouleilei

信控系统-易华录环图查询匹配方向转向

parent 09c5fc13
......@@ -216,7 +216,6 @@ public class WanJiCommonStaticInfoServiceImpl implements WanJiCommonStaticInfoSe
FeignCommon utcFeignClientService = utcFeignClientCache.getUtcFeignClientService(manufacturerIdCode);
jsonViewObject = utcFeignClientService.crossSchemeRings(crossSchemeRingsDTO);
} else {
//TODO
CrossSchemeRings crossSchemeRings = getCrossSchemeRings(crossSchemeRingsDTO);
if (ObjectUtil.isNotEmpty(crossSchemeRings)) {
jsonViewObject = JsonViewObject.newInstance().success(crossSchemeRings);
......@@ -245,6 +244,15 @@ public class WanJiCommonStaticInfoServiceImpl implements WanJiCommonStaticInfoSe
//通过方案查询相位信息
List<CrossPhasePO> phasePOList = crossPhaseMapper.selectByCrossIdAndPlanId(crossId, String.valueOf(schemeId));
if (ObjectUtil.isNotEmpty(phasePOList)) {
List<String> dirList = new ArrayList<>();
//更新方向转向信息
for (CrossPhasePO crossPhasePO : phasePOList) {
List<CrossLightsPO> crossLightsPOS = crossLightsMapper.selectByphaseId(crossPhasePO.getId());
String[] array = crossLightsPOS.stream().map(x -> x.getDir() + "_" + x.getTurn()).toArray(String[] :: new);
String join = StringUtils.join(array, ",");
dirList.add(join);
}
crossSchemeRings = new CrossSchemeRings();
List<Integer> greenList = phasePOList.stream().map(x -> x.getGreenTime()).collect(Collectors.toList());
List<Integer> redList = phasePOList.stream().map(x -> x.getRedTime()).collect(Collectors.toList());
......@@ -265,7 +273,7 @@ public class WanJiCommonStaticInfoServiceImpl implements WanJiCommonStaticInfoSe
phase.setRedTime(changeTimeList(redList,16));
phase.setYellowTime(changeTimeList(yellowList,16));
phase.setGreenTime(changeTimeList(greenList,16));
phase.setDirection(changeTimeList(null,16));
phase.setDirection(changePhase(dirList,16));
phase.setMinGTime(changeTimeList(minGreenList,16));
phase.setMaxGTime(changeTimeList(maxGreenList,16));
phase.setChannelDim(changeTimeList(null,16));
......@@ -305,6 +313,26 @@ public class WanJiCommonStaticInfoServiceImpl implements WanJiCommonStaticInfoSe
return join;
}
/**
* @return java.lang.String
* @Description 包装数据,将list数据转换为String ,中间用空格隔开
* @Param [list, length]
**/
private static String changePhase(List<String> list, int length) {
if (ObjectUtil.isEmpty(list)) {
list = new ArrayList<>();
}
int size = list.size();
List<String> addList = new ArrayList<>();
for (int i = 0; i < length - size; i++){
addList.add("0");
}
list.addAll(addList);
String[] array = list.stream().map(String::valueOf).toArray(String[] :: new);
String join = StringUtils.join(array, " ");
return join;
}
@Override
public JsonViewObject schemeOptLog(CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception {
LambdaQueryWrapper<CrossSchemeStageOptLogPO> queryWrapper = new LambdaQueryWrapper<>();
......
......@@ -20,4 +20,6 @@ public interface CrossLightsMapper {
void deleteByCrossId(String crossId);
CrossLightsPO selectEntity(@Param("entity") CrossLightsPO entity);
List<CrossLightsPO> selectByphaseId(@Param("phaseId") Integer phaseId);
}
......@@ -43,5 +43,14 @@
where cross_id = #{entity.crossId} and lights_no = #{entity.lightsNo}
</select>
<select id="selectByphaseId" resultMap="BaseResultMap">
SELECT
id,lights_no,name,type,dir,turn,cross_id,in_out_type,gmt_create,gmt_modified
FROM
t_cross_lights
WHERE
id IN ( SELECT lights_id FROM t_cross_phase_lights WHERE phase_id = #{phaseId})
</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