package com.lxzn.modules.master.job;
|
|
import com.lxzn.modules.assembly2.entity.TcOpstate;
|
import com.lxzn.modules.assembly2.service.ITcOpstateService;
|
import com.lxzn.modules.master.entity.Assembly2TcOpstate;
|
import com.lxzn.modules.master.service.IAssembly2TcOpstateService;
|
import com.lxzn.modules.master.service.IEquipmentLogService;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.stereotype.Component;
|
import org.springframework.util.CollectionUtils;
|
|
import java.util.List;
|
import java.util.Map;
|
|
@Slf4j
|
@Component
|
public class EquipmentLogCollectJob {
|
@Autowired
|
private IAssembly2TcOpstateService assembly2TcOpstateService;
|
@Autowired
|
private ITcOpstateService tcOpstateService;
|
@Autowired
|
private IEquipmentLogService equipmentLogService;
|
|
@Scheduled(initialDelay = 10000, fixedDelay = 15000)
|
public void equipmentLogCollect() {
|
log.info("------------2#装配线采集设备状态开始------------");
|
long startTime = System.currentTimeMillis();
|
try {
|
//上次采集数据
|
Map<String, Assembly2TcOpstate> oldStateMap = assembly2TcOpstateService.listStateMap();
|
//本次读取
|
List<TcOpstate> nevStateList = tcOpstateService.list();
|
if (CollectionUtils.isEmpty(nevStateList)) {
|
return;
|
}
|
|
} catch (Exception e) {
|
log.error(e.getMessage(), e);
|
}
|
long endTime = System.currentTimeMillis();
|
long duration = (endTime - startTime) / 1000;
|
log.info("------------2#装配线采集设备状态结束:消耗时长:{}S------------", duration);
|
}
|
}
|