zhangherong
3 天以前 0b8e5e2ee3c47e385816165826754d5cbb86faad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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);
    }
}