Compare commits

..

No commits in common. "2186c581221fb568a46e53efccdf6f93db91a2e2" and "e2897c4bb7c3856f85e49acc3aa79f7dbe54be9f" have entirely different histories.

1 changed files with 9 additions and 12 deletions

View File

@ -25,12 +25,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
*
* @author liuxinyue
@ -55,6 +49,7 @@ public class MqttConfigure {
@Autowired
private MessageTemplateTypeCacheService messageTemplateTypeCacheService;
@Autowired
private KafkaProducer kafkaProducer;
@ -129,23 +124,25 @@ public class MqttConfigure {
SysCar carByVin = null;
List<SysCarVo> carList = service.get("carList");
if(carList==null){
throw new RuntimeException("Redis未获取到车辆数据!!!");
log.info("redis未取到数据");
}else{
// 使用 HashMap 存储车信息,以 VIN 作为键
Map<String, SysCarVo> carMap = carList.stream()
.collect(Collectors.toMap(SysCarVo::getCarVin, Function.identity()));
carByVin = carMap.get(carVin);
for (SysCarVo sysCarVo : carList) {
if(sysCarVo.getCarVin().equals(carVin)){
carByVin = sysCarVo;
}
}
}
log.info("车辆信息为:" + carByVin);
//对应车辆所对应的报文模版
Integer templateId = carByVin.getTemplateId();
List<MessageTemplateType> templateTypeList=null;
List<MessageTemplateType> messageTemplateTypes=null;
String redisKey = "messageTemplateTypeList";
//key存在
Boolean b = redisService.hasKey(redisKey);
if (b) {
messageTemplateTypes = messageTemplateTypeCacheService.get(redisKey);
}else{
throw new RuntimeException("请先将配置存入Redis!!!");
}