Commit 34102153 authored by wujiang's avatar wujiang

提交

parent f4bfa9eb
......@@ -69,7 +69,7 @@ public class CompanyAndPersonTask {
/**
* 每天凌晨2点
*/
@Scheduled(cron = "0 0 2 * * ?")
//@Scheduled(cron = "0 0 2 * * ?")
public void run() {
log.info("启动完成后执行rides缓存数据任务开始--------------->");
try {
......
......@@ -18,7 +18,7 @@ public class PlatFormTokenTask {
@Autowired
StartPlatformTokenService startPlatformTokenService;
@Scheduled(cron = "0 0 1 * * ?")
//@Scheduled(cron = "0 0 1 * * ?")
public void getToken() {
log.info("定时任务刷新token开始--------------->");
startPlatformTokenService.getToken();
......
......@@ -34,7 +34,7 @@ public class JxiopCarReCountTimeBean {
Car car = iCarService.getOne(new QueryWrapper<Car>().eq("iot_code", wlCarMileageList.get(i).getIotCode()));
if(ObjectUtils.isNotEmpty(car)){
String coordinate = String.valueOf(car.getLongitude()) + "," + String.valueOf(car.getLatitude());
redisTemplate.opsForValue().set(car.getIotCode(), coordinate, 10, TimeUnit.MINUTES);
redisTemplate.opsForValue().set(car.getIotCode(), coordinate, 5, TimeUnit.MINUTES);
}
}
log.info("---------------------车辆重新开始计时::结束-------------------------");
......
......@@ -21,6 +21,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
......@@ -35,13 +36,19 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@Component
@EnableAsync
public class CarIotNewListener extends EmqxListener {
Logger logger = LoggerFactory.getLogger(CarIotNewListener.class);
@Autowired
private JxiopCarIotListerServiceImpl jxiopCarIotListerServiceImpl;
public final static ExecutorService pooledExecutor =
Executors.newFixedThreadPool(100 + Runtime.getRuntime().availableProcessors());
// @Autowired
// private IWlCarMileageService iWlCarMileageService;
//
......@@ -74,10 +81,11 @@ public class CarIotNewListener extends EmqxListener {
@Async
public void processMessage(String topic, MqttMessage message) throws Exception {
logger.info("----收到物联消息::topic---------------" + topic);
//logger.info("----收到物联消息::topic---------------" + topic);
logger.info("----收到物联消息::message---------------" + message);
jxiopCarIotListerServiceImpl.processMessage(topic,message);
pooledExecutor.submit(() -> {
jxiopCarIotListerServiceImpl.processMessage(topic,message);
});
// String measurement = topic.split("/")[0];
// String deviceName = topic.split("/")[1];
// //根据topic 组装iotCode
......
......@@ -101,12 +101,12 @@ public class JxiopCarIotListerServiceImpl {
this.updateCarLocation(jsonObject, iotCode);
String coordinate = jsonObject.getString("FireCar_Longitude") + "," + jsonObject.getString("FireCar_Latitude");
if (ObjectUtils.isEmpty(redisTemplate.opsForValue().get(iotCode))) {
redisTemplate.opsForValue().set(iotCode, coordinate, 10, TimeUnit.MINUTES);
logger.info("插入数据到::redis");
redisTemplate.opsForValue().set(iotCode, coordinate, 5, TimeUnit.MINUTES);
logger.info("首次入库redis:{}", iotCode);
} else {
if (!String.valueOf(redisTemplate.opsForValue().get(iotCode)).equals(coordinate)) {
redisTemplate.opsForValue().set(iotCode, coordinate, 10, TimeUnit.MINUTES);
logger.info("插入数据到::redis");
logger.info("更新入库redis:{},旧:{},新:{}", iotCode, redisTemplate.opsForValue().get(iotCode), coordinate);
redisTemplate.opsForValue().set(iotCode, coordinate, 5, TimeUnit.MINUTES);
}
}
}
......
......@@ -409,14 +409,14 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
@Scheduled(cron = "${mileage.splitmileage.cron}")
@Async
public void endCarMileageTask() {
log.info("========开始轨迹切分任务===========");
List<WlCarMileage> list = wlCarMileageMapper.selectList(new QueryWrapper<WlCarMileage>().isNull("end_time").isNotNull("start_time"));
list.forEach(item -> {
log.info("1获取code:{}", item.getIotCode());
log.info("2获取值:{}", redisTemplate.opsForValue().get(item.getIotCode()));
log.info("3获取结果:{}", ObjectUtils.isEmpty(redisTemplate.opsForValue().get(item.getIotCode())));
log.info("2获取结果:{}", ObjectUtils.isEmpty(redisTemplate.opsForValue().get(item.getIotCode())));
if (ObjectUtils.isEmpty(redisTemplate.opsForValue().get(item.getIotCode()))) {
if (!ObjectUtils.isEmpty(item.getIotCode()) && item.getIotCode().length() > 8) {
log.info("4处理结束坐标轨迹iocCode:{}", item.getIotCode());
log.info("3处理结束坐标轨迹iocCode:{}", item.getIotCode());
// 查询车辆上报信息
Date date = new Date();
ResponseModel<List<Object>> result = iotFeign.getLiveData(item.getIotCode().substring(0, 8), item.getIotCode().substring(8),
......
......@@ -55,7 +55,7 @@ public class RsDataQueue {
public void start() {
service_apdu = Executors.newSingleThreadScheduledExecutor();
// 第二个参数为首次执行的延时时间,第三个参数为定时执行的间隔时间
service_apdu.execute(task_runnable);
// service_apdu.execute(task_runnable);
}
public void addUpdateMessage(Long fmeaId,String userName) {
......
......@@ -143,7 +143,7 @@ message.alarm.char=\u51FA\u73B0
mileage.parameter=0.5
# 电建项目配置
mileage.segmentation.cron=0 0 0 * * ?
mileage.splitmileage.cron=0 0/1 * * * ?
mileage.splitmileage.cron=0/30 * * * * ?
mileage.clippingtime=600000
equip.car.alarmBattery= 10
equip.car.maxTravel=400
......
......@@ -88,6 +88,6 @@ public class FireAutoSysApplication implements ApplicationContextAware {
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
// 缓存spring上下文
IotContext.getInstance().setApplicationContext(applicationContext);
RsDataQueue.getInstance().start();
//RsDataQueue.getInstance().start();
}
}
\ 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