Commit 15230d6d authored by duanruiming's avatar duanruiming

[update] 添加本地配置文件,优化灯态数据解析

parent 4171d22c
......@@ -58,10 +58,11 @@ public class SignalStatusController {
@ApiResponse(code = 200, message = "OK", response = LightsStatusVO.class)
})
public JsonViewObject lightStatus() throws Exception {
List<LightsStatusVO> lightsStatusVOList = signalStatusService.lightStatus();
// List<LightsStatusVO> lightsStatusVOList = signalStatusService.lightStatus();
List<LightsStatusVO> lightsStatusVOList1 = signalStatusService.lightStatus("12F7L08J8S0");
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(lightsStatusVOList);
return jsonViewObject.success(lightsStatusVOList1);
}
}
package net.wanji.utc.service.runninginfo.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject;
......@@ -47,14 +49,13 @@ public class WanJiCommonRunningStatusServiceImpl implements WanJiCommonRunningSt
@Override
public List<LightsStatusVO> lightsStatus(List<String> crossIdList) throws Exception {
Set<String> set = new HashSet<>();
List<LightsStatusVO> result = new ArrayList<>();
for (String crossId : crossIdList) {
String manufacturerIdCode = crossInfoCache.getManufacturerCodeByCrossId(crossId);
set.add(manufacturerIdCode);
}
List<LightsStatusVO> result = new ArrayList<>();
for (String manufacturerIdCode : set) {
JsonViewObject jsonViewObject = utcFeignClientCache.getUtcFeignClientService(manufacturerIdCode).lightStatus();
result = (List<LightsStatusVO>) jsonViewObject.getContent();
JsonViewObject jsonViewObject = utcFeignClientCache.getUtcFeignClientService(manufacturerIdCode).lightStatus(crossId);
ObjectMapper objectMapper = new ObjectMapper();
result = objectMapper.convertValue(jsonViewObject.getContent(), new TypeReference<List<LightsStatusVO>>() {});
}
return result;
}
......
......@@ -2,7 +2,6 @@ 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;
......@@ -86,7 +85,7 @@ public class SignalStatusTask {
} else {
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));
......
spring:
application:
# dubbo启动需要程序名称
name: utc
main:
allow-circular-references: true
cloud:
nacos:
config:
server-addr: 10.102.1.182:8848
file-extension: yaml
group: signal
namespace: signal
username: nacos
password: nacos
\ No newline at end of file
spring:
profiles:
active: dev
\ No newline at end of file
active: local
\ No newline at end of file
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