Commit 841c0ee0 authored by duanruiming's avatar duanruiming

[add] 易华录灯态优化

parent 7716be7f
...@@ -5,7 +5,8 @@ package net.wanji.utc.hisense.controller; ...@@ -5,7 +5,8 @@ package net.wanji.utc.hisense.controller;
* @date 2022/12/1 15:07 * @date 2022/12/1 15:07
*/ */
import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
...@@ -15,10 +16,10 @@ import lombok.extern.slf4j.Slf4j; ...@@ -15,10 +16,10 @@ import lombok.extern.slf4j.Slf4j;
import net.wanji.common.annotation.aspect.AspectLog; import net.wanji.common.annotation.aspect.AspectLog;
import net.wanji.common.enums.BaseEnum; import net.wanji.common.enums.BaseEnum;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.utils.tool.JacksonUtils;
import net.wanji.databus.po.SignalStatusLogPO; import net.wanji.databus.po.SignalStatusLogPO;
import net.wanji.databus.vo.LightsStatusVO; import net.wanji.databus.vo.LightsStatusVO;
import net.wanji.utc.hisense.pojo.convert.EhualuLightStatusPojo; import net.wanji.utc.hisense.pojo.convert.LightStatusPojo;
import net.wanji.utc.hisense.pojo.convert.HisenseLightStatusPojo;
import net.wanji.utc.hisense.service.SignalStatusService; import net.wanji.utc.hisense.service.SignalStatusService;
import org.dom4j.DocumentException; import org.dom4j.DocumentException;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -76,10 +77,10 @@ public class SignalStatusController { ...@@ -76,10 +77,10 @@ public class SignalStatusController {
@AspectLog(description = "接收海信灯态", operationType = BaseEnum.OperationTypeEnum.QUERY) @AspectLog(description = "接收海信灯态", operationType = BaseEnum.OperationTypeEnum.QUERY)
@PostMapping(value = "/receiveLightStatus", produces = MediaType.APPLICATION_JSON) @PostMapping(value = "/receiveLightStatus", produces = MediaType.APPLICATION_JSON)
@ApiOperation(value = "接收海信灯态", notes = "接收海信灯态", response = LightsStatusVO.class, produces = MediaType.APPLICATION_JSON) @ApiOperation(value = "接收海信灯态", notes = "接收海信灯态", response = LightsStatusVO.class, produces = MediaType.APPLICATION_JSON)
public JsonViewObject receiveLightStatus(@RequestBody List<HisenseLightStatusPojo> hisenseLightStatusPojos) throws Exception { public JsonViewObject receiveLightStatus(@RequestBody List<LightStatusPojo> lightStatusPojos) throws Exception {
JsonViewObject jsonViewObject = JsonViewObject.newInstance(); JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try { try {
signalStatusService.receiveLightStatus(hisenseLightStatusPojos); signalStatusService.receiveLightStatus(lightStatusPojos);
} catch (Exception e) { } catch (Exception e) {
log.error("海信接收灯态异常:{}", e); log.error("海信接收灯态异常:{}", e);
} }
...@@ -89,9 +90,11 @@ public class SignalStatusController { ...@@ -89,9 +90,11 @@ public class SignalStatusController {
@AspectLog(description = "接收易华录灯态", operationType = BaseEnum.OperationTypeEnum.QUERY) @AspectLog(description = "接收易华录灯态", operationType = BaseEnum.OperationTypeEnum.QUERY)
@PostMapping(value = "/receiveEhualu", produces = MediaType.APPLICATION_JSON) @PostMapping(value = "/receiveEhualu", produces = MediaType.APPLICATION_JSON)
@ApiOperation(value = "接收海信灯态", notes = "接收海信灯态", response = LightsStatusVO.class, produces = MediaType.APPLICATION_JSON) @ApiOperation(value = "接收海信灯态", notes = "接收海信灯态", response = LightsStatusVO.class, produces = MediaType.APPLICATION_JSON)
public JsonViewObject receiveLightStatusEhualu(@RequestBody List<EhualuLightStatusPojo> ehualuLightStatusPojos) throws Exception { public JsonViewObject receiveLightStatusEhualu(@RequestBody String data) throws Exception {
JsonViewObject jsonViewObject = JsonViewObject.newInstance(); JsonViewObject jsonViewObject = JsonViewObject.newInstance();
ObjectMapper jackson = JacksonUtils.getInstance();
try { try {
List<LightStatusPojo> ehualuLightStatusPojos = jackson.readValue(data, new TypeReference<List<LightStatusPojo>>() {});
signalStatusService.receiveLightStatusEhualu(ehualuLightStatusPojos); signalStatusService.receiveLightStatusEhualu(ehualuLightStatusPojos);
} catch (Exception e) { } catch (Exception e) {
log.error("易华录接收灯态异常:{}", e); log.error("易华录接收灯态异常:{}", e);
......
package net.wanji.utc.hisense.pojo.convert;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author duanruiming
* @date 2025/03/03 17:35
*/
@Data
public class EhualuLightStatusPojo {
private String headers;
private String body;
@ApiModel(value = "来自滴滴海信灯态实体类")
@Data
public static class Headers {
@ApiModelProperty(value = "数据名称")
private String name;
@ApiModelProperty(value = "滴滴数据大脑数据来源")
private String from;
private String taskId;
}
@Data
@ApiModel(value = "来自滴滴海信灯态实体类")
public static class Body {
@ApiModelProperty(value = "灯态数据内容")
private ContentBody content;
@ApiModelProperty(value = "数据源,固定字符串,比如 “haixin”")
private String source;
@ApiModelProperty(value = "数据类型,固定数字2,代表JSON格式")
private Integer type;
}
@Data
@ApiModel(value = "来自滴滴海信灯态实体类")
public static class ContentBody {
@ApiModelProperty(value = "城市名称拼音,如“yinchuan”")
private String cityCode;
@ApiModelProperty(value = "行政区编号,如“640104")
private String regionId;
@ApiModelProperty(value = "置信度,1.0代表100%可信,若遇早晚高峰动态配时,可以降低置信度")
private int confidence;
@ApiModelProperty(value = "控制模式,11:特殊控制-关灯,12:特殊控制-全红,13:特殊控制-黄闪,21:单点多时段控制," +
"22:单点感应控制,23:单点自适应控制,31:线协调控制,41:区域协调控制,51:干预控制-手动控制," +
"52:干预控制-锁定阶段控制,53:干预控制-指定方案,54:干预控制-锁定相位控制")
private int controlMode;
@ApiModelProperty(value = "海信定义路口编号")
private String crossId;
@ApiModelProperty(value = "信号机实时状态,0-正常,1-掉线")
private int crossRealStatus;
@ApiModelProperty(value = "周期剩余时间")
private int cycleCountDown;
@ApiModelProperty(value = "灯态JSON Object")
private List<LampRealInfos> lampRealInfos;
@ApiModelProperty(value = "信号灯周期(单位:秒),所有信号阶段时长之和")
private int period;
@ApiModelProperty(value = "方案编号")
private int planId;
@ApiModelProperty(value = "数据产生时间戳,精确到毫秒,与北京时间校准务必准确")
private Long signalMachineStamp;
private Integer offset;
private Integer periodCountDown;
@Data
@ApiModel(value = "来自滴滴海信灯态实体类")
public static class LampRealInfos {
@ApiModelProperty(value = "当前灯色剩余时间,单位:秒,动态变化的具体数值,时效性要求高")
private Integer countDown;
@ApiModelProperty(value = "当前灯色,22-黄灯,23-绿灯,21-红灯")
private String lampStatus;
@ApiModelProperty(value = "下一灯色持续时长")
private Integer nextCountDown;
@ApiModelProperty(value = "下一灯色")
private Integer nextLampStatus;
/**
* 0 由北向南
* 1 东北向西南
* 2 由东向西
* 3 由东南向西北
* 4 由南向北 顺时针方向
*/
@ApiModelProperty(value = "交通流方向")
private Integer roadDirection;
@ApiModelProperty(value = "交通流流向,11:直行,12:左转,13:右转, 31:掉头,99:其他")
private Integer roadFlowDirection;
@ApiModelProperty(value = "相位编号")
private String phaseId;
private Integer nextNextCountDown;
private Integer nextNextLampStatus;
}
}
}
...@@ -14,7 +14,7 @@ import java.util.List; ...@@ -14,7 +14,7 @@ import java.util.List;
@Data @Data
@ApiModel(value = "来自滴滴海信灯态实体类") @ApiModel(value = "来自滴滴海信灯态实体类")
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
public class HisenseLightStatusPojo { public class LightStatusPojo {
private Headers headers; private Headers headers;
private String body; private String body;
......
...@@ -2,8 +2,7 @@ package net.wanji.utc.hisense.service; ...@@ -2,8 +2,7 @@ package net.wanji.utc.hisense.service;
import net.wanji.databus.po.SignalStatusLogPO; import net.wanji.databus.po.SignalStatusLogPO;
import net.wanji.databus.vo.LightsStatusVO; import net.wanji.databus.vo.LightsStatusVO;
import net.wanji.utc.hisense.pojo.convert.EhualuLightStatusPojo; import net.wanji.utc.hisense.pojo.convert.LightStatusPojo;
import net.wanji.utc.hisense.pojo.convert.HisenseLightStatusPojo;
import org.dom4j.DocumentException; import org.dom4j.DocumentException;
import java.util.List; import java.util.List;
...@@ -23,6 +22,6 @@ public interface SignalStatusService { ...@@ -23,6 +22,6 @@ public interface SignalStatusService {
List<SignalStatusLogPO> runningStatusAlarm(String crossId) throws DocumentException; List<SignalStatusLogPO> runningStatusAlarm(String crossId) throws DocumentException;
List<LightsStatusVO> lightStatus(String crossId); List<LightsStatusVO> lightStatus(String crossId);
void receiveLightStatus(List<HisenseLightStatusPojo> hisenseLightStatusPojos) throws Exception; void receiveLightStatus(List<LightStatusPojo> lightStatusPojos) throws Exception;
void receiveLightStatusEhualu(List<EhualuLightStatusPojo> ehualuLightStatusPojos) throws Exception; void receiveLightStatusEhualu(List<LightStatusPojo> ehualuLightStatusPojos) throws Exception;
} }
...@@ -23,8 +23,7 @@ import net.wanji.utc.hisense.common.enums.DataBrainControlModeEnum; ...@@ -23,8 +23,7 @@ import net.wanji.utc.hisense.common.enums.DataBrainControlModeEnum;
import net.wanji.utc.hisense.common.enums.DataBrainLampStatusEnum; import net.wanji.utc.hisense.common.enums.DataBrainLampStatusEnum;
import net.wanji.utc.hisense.common.enums.DataBrainTurnEnum; import net.wanji.utc.hisense.common.enums.DataBrainTurnEnum;
import net.wanji.utc.hisense.pojo.CrossPhaseDirTurnPojo; import net.wanji.utc.hisense.pojo.CrossPhaseDirTurnPojo;
import net.wanji.utc.hisense.pojo.convert.EhualuLightStatusPojo; import net.wanji.utc.hisense.pojo.convert.LightStatusPojo;
import net.wanji.utc.hisense.pojo.convert.HisenseLightStatusPojo;
import net.wanji.utc.hisense.pojo.dto.CrossSchemePhaseCountDownDTO; import net.wanji.utc.hisense.pojo.dto.CrossSchemePhaseCountDownDTO;
import net.wanji.utc.hisense.pojo.dto.PhaseCountDownDTO; import net.wanji.utc.hisense.pojo.dto.PhaseCountDownDTO;
import net.wanji.utc.hisense.service.SignalStatusService; import net.wanji.utc.hisense.service.SignalStatusService;
...@@ -127,88 +126,25 @@ public class SignalStatusServiceImpl implements SignalStatusService { ...@@ -127,88 +126,25 @@ public class SignalStatusServiceImpl implements SignalStatusService {
return lightsStatusVOS; return lightsStatusVOS;
} }
// @Override
// public List<LightsStatusVO> lightStatus(String crossId) {
// List<LightsStatusVO> lightsStatusVOS = new ArrayList<>();
// Map<String, RunningLightsStatusPojo> runningStateInfoCache = SignalDataCache.runningStateInfoCacheUdp;
// if (!runningStateInfoCache.isEmpty()) {
// RunningLightsStatusPojo runningLightsStatusPojo = runningStateInfoCache.get(crossId);
// LightsStatusVO lightsStatusVO = new LightsStatusVO();
// lightsStatusVO.setCrossId(crossId);
// String runMode = String.valueOf(ControlModelEnum.getWjControlMode(runningLightsStatusPojo.getCCT()));
// lightsStatusVO.setRunMode(runMode);
// lightsStatusVO.setCycleLen(runningLightsStatusPojo.getCC());
// // 相位剩余时长
// List<RunningLightsStatusPojo.Phase> phaseList = runningLightsStatusPojo.getPHASE();
// Integer phaseId = 0;
// Integer phaseCountDown = 0;
// for (RunningLightsStatusPojo.Phase phase : phaseList) {
// Integer ls = phase.getLS();
// if (Objects.equals(ls, 1)) { // 当前相位绿灯
// phaseId = phase.getPHN();
// phaseCountDown = phase.getPCD();
// }
// }
// lightsStatusVO.setCycleCountDown(phaseCountDown);
// lightsStatusVO.setPhaseId(String.valueOf(phaseId));
// lightsStatusVO.setSchemeId(String.valueOf(runningLightsStatusPojo.getPLN()));
//
// RunningLightsStatusPojo.Channel channel = runningLightsStatusPojo.getCHANNEL();
// Map<String, Object> dirLampGroupMap = new HashMap<>();
// List<Integer> scs = channel.getSCS();
// if (!CollectionUtils.isEmpty(scs)) {
// for (int i = 0; i < scs.size(); i++) {
// Map<Integer, String> turnColorMap = new HashMap<>();
// String lightsColor = String.valueOf(scs.get(i));
// String wjLightColor = PhaseLightColorEnum.getWjLightColor(lightsColor);
// Integer turn = null;
// turn = CommonUtils.getTurnByLightsId(i);
//
// // 复杂路口处理
//// Map<String, Map<Integer, Integer>> cacheMap = ComplexCrossCache.getCacheMap();
//// if (cacheMap.containsKey(crossId)) {
//// Map<Integer, Integer> innerMap = cacheMap.get(crossId);
//// if (innerMap.containsKey(i)) {
//// turn = innerMap.get(i);
//// }
//// }
//
// turnColorMap.put(turn, wjLightColor);
// String dir = String.valueOf(CommonUtils.getDirByLightsId(i));
// if (dirLampGroupMap.isEmpty() || Objects.isNull(dirLampGroupMap.get(dir))) {
// dirLampGroupMap.put(dir, turnColorMap);
// } else {
// Map<Integer, String> currentTurnColorMap = (Map<Integer, String>) dirLampGroupMap.get(dir);
// currentTurnColorMap.put(turn, wjLightColor);
// dirLampGroupMap.put(dir, currentTurnColorMap);
// }
// }
// }
// lightsStatusVO.setDirLampGroupMap(dirLampGroupMap);
// lightsStatusVOS.add(lightsStatusVO);
// }
// return lightsStatusVOS;
// }
/** /**
* @param hisenseLightStatusPojos * @param lightStatusPojos
* @throws Exception * @throws Exception
* @description 通过http形式接收海信灯态 * @description 通过http形式接收海信灯态
*/ */
@Override @Override
public void receiveLightStatus(List<HisenseLightStatusPojo> hisenseLightStatusPojos) throws Exception { public void receiveLightStatus(List<LightStatusPojo> lightStatusPojos) throws Exception {
Date date = new Date(); Date date = new Date();
Long time = date.getTime(); Long time = date.getTime();
ObjectMapper jackson = JacksonUtils.getInstance(); ObjectMapper jackson = JacksonUtils.getInstance();
pushOtherCompany(hisenseLightStatusPojos, jackson, shensiUrl, baiduUrl, yiGouUrl, BaseEnum.VendorTypeEnum.HS.getNick()); pushOtherCompany(lightStatusPojos, jackson, shensiUrl, baiduUrl, yiGouUrl, BaseEnum.VendorTypeEnum.HS.getNick());
if (!CollectionUtils.isEmpty(hisenseLightStatusPojos)) { if (!CollectionUtils.isEmpty(lightStatusPojos)) {
for (HisenseLightStatusPojo hisenseLightStatusPojo : hisenseLightStatusPojos) { for (LightStatusPojo lightStatusPojo : lightStatusPojos) {
String bodyStr = hisenseLightStatusPojo.getBody(); String bodyStr = lightStatusPojo.getBody();
List<HisenseLightStatusPojo.Body> bodies = jackson.readValue(bodyStr, new TypeReference<List<HisenseLightStatusPojo.Body>>() {}); List<LightStatusPojo.Body> bodies = jackson.readValue(bodyStr, new TypeReference<List<LightStatusPojo.Body>>() {});
if (!CollectionUtils.isEmpty(bodies)) { if (!CollectionUtils.isEmpty(bodies)) {
for (HisenseLightStatusPojo.Body body : bodies) { for (LightStatusPojo.Body body : bodies) {
HisenseLightStatusPojo.ContentBody content = body.getContent(); LightStatusPojo.ContentBody content = body.getContent();
LightsStatusVO lightsStatusVO = new LightsStatusVO(); LightsStatusVO lightsStatusVO = new LightsStatusVO();
String hiCrossId = content.getCrossId(); String hiCrossId = content.getCrossId();
CrossInfoPO crossInfo = CrossInfoCache.getCrossInfoBySignalCode(hiCrossId); CrossInfoPO crossInfo = CrossInfoCache.getCrossInfoBySignalCode(hiCrossId);
...@@ -265,19 +201,19 @@ public class SignalStatusServiceImpl implements SignalStatusService { ...@@ -265,19 +201,19 @@ public class SignalStatusServiceImpl implements SignalStatusService {
} }
@Override @Override
public void receiveLightStatusEhualu(List<EhualuLightStatusPojo> ehualuLightStatusPojos) throws Exception { public void receiveLightStatusEhualu(List<LightStatusPojo> ehualuLightStatusPojos) throws Exception {
Date date = new Date(); Date date = new Date();
Long time = date.getTime(); Long time = date.getTime();
ObjectMapper jackson = JacksonUtils.getInstance(); ObjectMapper jackson = JacksonUtils.getInstance();
pushOtherCompany(ehualuLightStatusPojos, jackson, shensiUrl, baiduUrl, yiGouUrl, BaseEnum.VendorTypeEnum.EHUALU.getNick()); pushOtherCompany(ehualuLightStatusPojos, jackson, shensiUrl, baiduUrl, yiGouUrl, BaseEnum.VendorTypeEnum.EHUALU.getNick());
if (!CollectionUtils.isEmpty(ehualuLightStatusPojos)) { if (!CollectionUtils.isEmpty(ehualuLightStatusPojos)) {
for (EhualuLightStatusPojo ehualuLightStatusPojo : ehualuLightStatusPojos) { for (LightStatusPojo LightStatusPojo : ehualuLightStatusPojos) {
String bodyStr = ehualuLightStatusPojo.getBody(); String bodyStr = LightStatusPojo.getBody();
List<EhualuLightStatusPojo.Body> bodies = jackson.readValue(bodyStr, new TypeReference<List<EhualuLightStatusPojo.Body>>() {}); List<LightStatusPojo.Body> bodies = jackson.readValue(bodyStr, new TypeReference<List<LightStatusPojo.Body>>() {});
if (!CollectionUtils.isEmpty(bodies)) { if (!CollectionUtils.isEmpty(bodies)) {
for (EhualuLightStatusPojo.Body body : bodies) { for (LightStatusPojo.Body body : bodies) {
EhualuLightStatusPojo.ContentBody content = body.getContent(); LightStatusPojo.ContentBody content = body.getContent();
LightsStatusVO lightsStatusVO = new LightsStatusVO(); LightsStatusVO lightsStatusVO = new LightsStatusVO();
String hiCrossId = content.getCrossId(); String hiCrossId = content.getCrossId();
CrossInfoPO crossInfo = CrossInfoCache.getCrossInfoBySignalCode(hiCrossId); CrossInfoPO crossInfo = CrossInfoCache.getCrossInfoBySignalCode(hiCrossId);
...@@ -320,20 +256,21 @@ public class SignalStatusServiceImpl implements SignalStatusService { ...@@ -320,20 +256,21 @@ public class SignalStatusServiceImpl implements SignalStatusService {
lightsStatusVO.setPhasePlanId(String.valueOf(planId)); lightsStatusVO.setPhasePlanId(String.valueOf(planId));
lightsStatusVO.setManufacturerCode(BaseEnum.VendorTypeEnum.EHUALU.getNick()); lightsStatusVO.setManufacturerCode(BaseEnum.VendorTypeEnum.EHUALU.getNick());
// 易华录每1秒推送 // 易华录每1秒推送
List<EhualuLightStatusPojo.ContentBody.LampRealInfos> lampRealInfos = content.getLampRealInfos(); List<LightStatusPojo.ContentBody.LampRealInfos> lampRealInfos = content.getLampRealInfos();
String currentPhaseId = ""; String currentPhaseId = "";
Integer curCycleCountDown = 0; Integer curCycleCountDown = 0;
if (!CollectionUtils.isEmpty(lampRealInfos)) { if (!CollectionUtils.isEmpty(lampRealInfos)) {
Map<String, Object> dirLampGroupMap = new HashMap<>(); Map<String, Object> dirLampGroupMap = new HashMap<>();
Map<String, Object> phaseMap = new HashMap<>(); Map<String, Object> phaseMap = new HashMap<>();
Map<Integer, List<EhualuLightStatusPojo.ContentBody.LampRealInfos>> dirGroupMap = lampRealInfos.stream().collect(Collectors.groupingBy(EhualuLightStatusPojo.ContentBody.LampRealInfos::getRoadDirection)); Map<Integer, List<LightStatusPojo.ContentBody.LampRealInfos>> dirGroupMap = lampRealInfos.stream()
for (Map.Entry<Integer, List<EhualuLightStatusPojo.ContentBody.LampRealInfos>> entry : dirGroupMap.entrySet()) { .collect(Collectors.groupingBy(net.wanji.utc.hisense.pojo.convert.LightStatusPojo.ContentBody.LampRealInfos::getRoadDirection));
for (Map.Entry<Integer, List<LightStatusPojo.ContentBody.LampRealInfos>> entry : dirGroupMap.entrySet()) {
Integer roadDir = entry.getKey(); Integer roadDir = entry.getKey();
Integer dir = HiseseDirEnum.getWjLightsDir(roadDir); Integer dir = HiseseDirEnum.getWjLightsDir(roadDir);
Map<Integer, String> turnColor = new HashMap<>(); Map<Integer, String> turnColor = new HashMap<>();
Map<Integer, Integer> turnCountDown = new HashMap<>(); Map<Integer, Integer> turnCountDown = new HashMap<>();
List<EhualuLightStatusPojo.ContentBody.LampRealInfos> value = entry.getValue(); List<LightStatusPojo.ContentBody.LampRealInfos> value = entry.getValue();
for (EhualuLightStatusPojo.ContentBody.LampRealInfos lampRealInfo : value) { for (LightStatusPojo.ContentBody.LampRealInfos lampRealInfo : value) {
String lampStatus = lampRealInfo.getLampStatus(); String lampStatus = lampRealInfo.getLampStatus();
String wjLampStatus = DataBrainLampStatusEnum.getWjLampStatus(lampStatus); String wjLampStatus = DataBrainLampStatusEnum.getWjLampStatus(lampStatus);
Integer countDown = lampRealInfo.getCountDown(); Integer countDown = lampRealInfo.getCountDown();
...@@ -356,6 +293,7 @@ public class SignalStatusServiceImpl implements SignalStatusService { ...@@ -356,6 +293,7 @@ public class SignalStatusServiceImpl implements SignalStatusService {
} }
lightsStatusVO.setPhasePlanId(currentPhaseId); lightsStatusVO.setPhasePlanId(currentPhaseId);
lightsStatusVO.setPhaseId(currentPhaseId); lightsStatusVO.setPhaseId(currentPhaseId);
lightsStatusVO.setCycleCountDown(curCycleCountDown);
SignalDataCache.runningStateInfoCache.put(crossId, lightsStatusVO); SignalDataCache.runningStateInfoCache.put(crossId, lightsStatusVO);
log.error("当前路口灯态:{}", lightsStatusVO); log.error("当前路口灯态:{}", lightsStatusVO);
} }
...@@ -390,12 +328,12 @@ public class SignalStatusServiceImpl implements SignalStatusService { ...@@ -390,12 +328,12 @@ public class SignalStatusServiceImpl implements SignalStatusService {
} }
try { try {
if (StringUtils.equalsIgnoreCase(type, BaseEnum.VendorTypeEnum.HS.getNick())) { if (StringUtils.equalsIgnoreCase(type, BaseEnum.VendorTypeEnum.HS.getNick())) {
List<HisenseLightStatusPojo> result = (List<HisenseLightStatusPojo>) hisenseLightStatusPojos; List<LightStatusPojo> result = (List<LightStatusPojo>) hisenseLightStatusPojos;
HisenseLightStatusPojo hisenseLightStatusPojo = result.get(0); LightStatusPojo lightStatusPojo = result.get(0);
String bodyStr = hisenseLightStatusPojo.getBody(); String bodyStr = lightStatusPojo.getBody();
List<HisenseLightStatusPojo.Body> bodies = jackson.readValue(bodyStr, new TypeReference<List<HisenseLightStatusPojo.Body>>() {}); List<LightStatusPojo.Body> bodies = jackson.readValue(bodyStr, new TypeReference<List<LightStatusPojo.Body>>() {});
for (HisenseLightStatusPojo.Body body : bodies) { for (LightStatusPojo.Body body : bodies) {
HisenseLightStatusPojo.ContentBody content = body.getContent(); LightStatusPojo.ContentBody content = body.getContent();
String crossId = content.getCrossId(); String crossId = content.getCrossId();
List<String> list = Arrays.asList("255136", "209723", "198207", "132163"); List<String> list = Arrays.asList("255136", "209723", "198207", "132163");
if (list.contains(crossId)) { if (list.contains(crossId)) {
......
...@@ -214,7 +214,10 @@ public class SignalStatusTask { ...@@ -214,7 +214,10 @@ public class SignalStatusTask {
}); });
} }
if (StringUtils.endsWithIgnoreCase(BasicEnum.ManufacturerEnum.EHULU.getCode(), manufacturerInfoPO.getCode())) { if (StringUtils.endsWithIgnoreCase(BasicEnum.ManufacturerEnum.EHULU.getCode(), manufacturerInfoPO.getCode())) {
JsonViewObject jsonViewObject = eHualuFeignClients.lightStatus(crossId); //JsonViewObject jsonViewObject = eHualuFeignClients.lightStatus(crossId);
//return mapper.convertValue(jsonViewObject.getContent(), new TypeReference<List<LightsStatusVO>>() {
//});
JsonViewObject jsonViewObject = utcHisenseFeignClients.lightStatus(crossId);
return mapper.convertValue(jsonViewObject.getContent(), new TypeReference<List<LightsStatusVO>>() { return mapper.convertValue(jsonViewObject.getContent(), new TypeReference<List<LightsStatusVO>>() {
}); });
} }
......
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