随行结束的时候关灯

杭州-烟草
LAPTOP-S9HJSOEB\昊天 9 months ago
parent 4e6515d521
commit c660047d5a

@ -80,23 +80,23 @@ public class CronTab {
lightTimeMap.put(streetId,System.currentTimeMillis());
}
@Scheduled(cron = "0 0/1 * * * ?")
public void lightStatus() {
log.debug(" lightStatus");
long timeStamp = System.currentTimeMillis();
Iterator<Map.Entry<Integer, Long>> it = lightTimeMap.entrySet().iterator();
while (it.hasNext()){
Map.Entry<Integer, Long> entry = it.next();
if((BigInteger.valueOf(timeStamp).subtract(BigInteger.valueOf(entry.getValue()))).compareTo(timeDIff) > 0){
List<LightSource> lightSources = lightSourceMapper.selectList(new QueryWrapper<LightSource>().eq("street_id",entry.getKey()));
lightSources.forEach(lightSource -> {
lightSourceService.controllerLightSource(lightSource,0);
});
it.remove();
}
}
}
// @Scheduled(cron = "0 0/1 * * * ?")
// public void lightStatus() {
// log.debug(" lightStatus");
// long timeStamp = System.currentTimeMillis();
//
// Iterator<Map.Entry<Integer, Long>> it = lightTimeMap.entrySet().iterator();
// while (it.hasNext()){
// Map.Entry<Integer, Long> entry = it.next();
// if((BigInteger.valueOf(timeStamp).subtract(BigInteger.valueOf(entry.getValue()))).compareTo(timeDIff) > 0){
// List<LightSource> lightSources = lightSourceMapper.selectList(new QueryWrapper<LightSource>().eq("street_id",entry.getKey()));
// lightSources.forEach(lightSource -> {
// lightSourceService.controllerLightSource(lightSource,0);
// });
// it.remove();
// }
// }
// }
public static void checkFileTime(File dir,int days) {

@ -103,6 +103,7 @@ public class PlcService {
*/
public void orderStart(PlcCmdInfo plcCmdInfo) {
Street street = streetService.getStreetByPlcId(plcCmdInfo.getPlcId());
List<LightSource> lightSources = lightSourceMapper.selectList(new QueryWrapper<LightSource>().eq("street_id",street.getId()));
lightSources.forEach(lightSource -> {
lightSourceService.controllerLightSource(lightSource,1);
@ -193,6 +194,10 @@ public class PlcService {
if (street == null) {
return;
}
List<LightSource> lightSources = lightSourceMapper.selectList(new QueryWrapper<LightSource>().eq("street_id",street.getId()));
lightSources.forEach(lightSource -> {
lightSourceService.controllerLightSource(lightSource,0);
});
Order order = orderMapper.getOneByOrderNum(plcCmdInfo.getOrderNum());
if (order == null) {
log.error("订单结束信号订单不存在orderNum:{}", plcCmdInfo.getOrderNum());

@ -3,6 +3,7 @@ package com.zhehekeji.web.service;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhehekeji.web.entity.LightSource;
import com.zhehekeji.web.entity.SteeringEngine;
import com.zhehekeji.web.mapper.SteeringEngineMapper;
import com.zhehekeji.web.mapper.StockLogMapper;
@ -45,6 +46,7 @@ public class SteeringEngineService extends ServiceImpl<SteeringEngineMapper,Stee
// 在跑随行
if (!newEngine.getJobnum().equals("0")) {
log.info("随行开始");
plcService.orderStart(SteeringEngine.getPlcCmdInfo(newEngine));
}
// 随行结束

Loading…
Cancel
Save