|
|
@@ -118,7 +118,8 @@ public class CamelDataUtil {
|
|
|
if(scheduleVo!=null){
|
|
|
try{
|
|
|
JSONArray lines = JSONUtil.parseObj(scheduleVo.getPathInfo()).getJSONArray("pathLine");
|
|
|
- List<JSONObject> lines1 = lines.toList(JSONObject.class);
|
|
|
+ List<JSONObject> lines1 = new ArrayList<>();
|
|
|
+ RedisUtils.setCacheObject(StringUtils.format("car_{}_{}_current_station",carInfoVo1.getCarNum(),DateFormatUtils.format( scheduleVo.getScheduleDate(),DateUtils.YYYYMMDDHHMMSS)),"");
|
|
|
for (JSONObject jsonObject : lines.toList(JSONObject.class)) {
|
|
|
double distance = DistanceCalculator.calculateDistance(jsonObject.getStr("location"),StringUtils.format("{},{}", gpsData.getLng(),gpsData.getLat()));
|
|
|
String configdistance = SpringUtils.getBean(ISysConfigService.class).selectConfigByKey("sys.car.distance");
|
|
|
@@ -144,8 +145,10 @@ public class CamelDataUtil {
|
|
|
JSONObject jsonObject = lines1.get(0);
|
|
|
String stationName = RedisUtils.getCacheObject(StringUtils.format("car_{}_{}_tip",carInfoVo1.getCarNum(),DateFormatUtils.format( scheduleVo.getScheduleDate(),DateUtils.YYYYMMDDHHMMSS) ));
|
|
|
stationName=stationName==null?"":stationName;
|
|
|
- RedisUtils.setCacheObject(StringUtils.format("car_{}_{}_tip",carInfoVo1.getCarNum(), DateFormatUtils.format( scheduleVo.getScheduleDate(),DateUtils.YYYYMMDDHHMMSS) ), stationName+","+jsonObject.getStr("stationName"),Duration.ofSeconds(3600*24));
|
|
|
- //开始播报
|
|
|
+ if(!stationName.contains(jsonObject.getStr("stationName"))){
|
|
|
+ RedisUtils.setCacheObject(StringUtils.format("car_{}_{}_tip",carInfoVo1.getCarNum(), DateFormatUtils.format( scheduleVo.getScheduleDate(),DateUtils.YYYYMMDDHHMMSS) ), stationName+","+jsonObject.getStr("stationName"),Duration.ofSeconds(3600*24));
|
|
|
+ }
|
|
|
+ //开始播报
|
|
|
//获取站点设备信息
|
|
|
SysDictDataBo sysDictData = new SysDictDataBo();
|
|
|
sysDictData.setDictLabel(jsonObject.getStr("stationName"));
|
|
|
@@ -153,16 +156,19 @@ public class CamelDataUtil {
|
|
|
List<SysDictDataVo> stations = sysDictDataService.selectDictDataList(sysDictData);
|
|
|
if(stations.size()>0){
|
|
|
//满足条件播报(led or 广播)
|
|
|
- String message = StringUtils.format("{}即将到达,请准备接车,请等待。。。", carInfoVo1.getCarNum());
|
|
|
- List<JSONObject> devicedatas = JSONUtil.parseArray( stations.get(0).getRemark()).toList(JSONObject.class);
|
|
|
- for (JSONObject i :devicedatas) {
|
|
|
- if(i.getStr("type").equals("led")){
|
|
|
- MessageUtils.sendLed(i.getStr("code"), message);
|
|
|
- }
|
|
|
- if(i.getStr("type").equals("tts")){
|
|
|
- MessageUtils.sendTTs(i.getStr("code"), message);
|
|
|
+ String message = StringUtils.format("{}即将到达{},即将到达,请准备接货。", carInfoVo1.getCarNum(),stations.get(0).getDictLabel());
|
|
|
+ if(StringUtils.isNotEmpty(stations.get(0).getRemark())){
|
|
|
+ List<JSONObject> devicedatas = JSONUtil.parseArray( stations.get(0).getRemark()).toList(JSONObject.class);
|
|
|
+ for (JSONObject i :devicedatas) {
|
|
|
+ if(i.getStr("type").equals("led")){
|
|
|
+ MessageUtils.sendLed(i.getStr("code"), message);
|
|
|
+ }
|
|
|
+ if(i.getStr("type").equals("tts")){
|
|
|
+ MessageUtils.sendTTs(i.getStr("code"), message);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
@@ -173,6 +179,7 @@ public class CamelDataUtil {
|
|
|
}catch (Exception e){
|
|
|
log.error("---------------------");
|
|
|
log.error(e.getMessage());
|
|
|
+
|
|
|
log.error("---------------------");
|
|
|
}
|
|
|
}
|