Commit 904b68d2 authored by duanruiming's avatar duanruiming

[update] 优化实时灯态

parent c879b5f0
......@@ -157,7 +157,7 @@ public class DTSignalStatusServiceImpl implements SignalStatusService {
if (Objects.nonNull(resultPojo) && StringUtils.isNotBlank(resultPojo.getHexMessageResult())) {
String hexMessageResult = resultPojo.getHexMessageResult();
String body = hexMessageResult.substring(32, hexMessageResult.length() - 2);
int size = body.length() / 14;
int size = body.length() / 46;
String matchStr = "0603%s%s";
int index = 0;
for (int i = 0; i < size; i++) {
......@@ -204,17 +204,17 @@ public class DTSignalStatusServiceImpl implements SignalStatusService {
if (Objects.equals(schemeInfoPojo.getSchemeId(), currentSchemeId)) {
lightsStatusVO.setSchemeId(String.valueOf(currentSchemeId));
lightsStatusVO.setCycleLen(schemeInfoPojo.getCycle());
List<SchemeInfoPojo.SchemeStagePojo> stageInfoList = SchemeInfoPojo.getStageInfoList(schemeInfoPojo);
List<PhaseStageInfoPojo> phaseStageInfoPojos = SignalDataCache.phaseStageInfoCache.get(crossId);
if (!CollectionUtils.isEmpty(phaseStageInfoPojos)) {
for (PhaseStageInfoPojo phaseStageInfoPojo : phaseStageInfoPojos) {
if (Objects.equals(phaseStageInfoPojo.getPhaseStageId(), currentPhaseStageId)) {
List<Integer> phaseList = phaseStageInfoPojo.getPhaseList();
String phaseId = StringUtils.join(phaseList, "|");
lightsStatusVO.setPhaseId(phaseId);
}
}
}
lightsStatusVO.setPhaseId(String.valueOf(currentPhaseStageId));
// List<SchemeInfoPojo.SchemeStagePojo> stageInfoList = SchemeInfoPojo.getStageInfoList(schemeInfoPojo);
// List<PhaseStageInfoPojo> phaseStageInfoPojos = SignalDataCache.phaseStageInfoCache.get(crossId);
// if (!CollectionUtils.isEmpty(phaseStageInfoPojos)) {
// for (PhaseStageInfoPojo phaseStageInfoPojo : phaseStageInfoPojos) {
// if (Objects.equals(phaseStageInfoPojo.getPhaseStageId(), currentPhaseStageId)) {
// List<Integer> phaseList = phaseStageInfoPojo.getPhaseList();
// lightsStatusVO.setPhaseId(phaseId);
// }
// }
// }
Map<String, Object> dirLampGroupMap = new HashMap<>();
if (!CollectionUtils.isEmpty(lightsStatus)) {
for (int i = 0; i < lightsStatus.size(); i++) {
......
......@@ -7,7 +7,8 @@ public class BasicEnum {
@Getter
@AllArgsConstructor
public enum ManufacturerEnum {
HK("海康", "HK");
HK("海康", "HK"),
DT("东土", "DT");
private String nick;
private String code;
......
......@@ -2,6 +2,7 @@ package net.wanji.utc.task;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject;
......@@ -82,10 +83,11 @@ public class SignalStatusTask {
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectById(crossInfoPO.getManufacturerId());
if (StringUtils.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerInfoPO.getCode())) {
lightsStatusVOS = hkLightsStatusService.getHkLightsStatus(crossId);
} else {
} else if (StringUtils.equals(BasicEnum.ManufacturerEnum.DT.getCode(), manufacturerInfoPO.getCode())){
JsonViewObject jsonViewObject = utcDTFeignClients.lightStatus(crossId);
ObjectMapper mapper = new ObjectMapper();
// lightsStatusVOS = mapper.convertValue(jsonViewObject.getContent(), new TypeReference<List<LightsStatusVO>>() {});
lightsStatusVOS = mapper.convertValue(jsonViewObject.getContent(), new TypeReference<List<LightsStatusVO>>() {});
}
long end = System.currentTimeMillis();
log.info("当前路口编号:{},海康返回灯态时间:{}ms", crossId, (end - start));
......
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