KlData.java
1.26 KB
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
48
49
50
51
52
package com.bsth.data.kl;
import com.bsth.entity.Kl;
import com.bsth.service.Kl.KlService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* @author ym
* @ClassName: KlData
* @Description: TODO(客流数据加载定时器)
* @date 2024年7月18日09:59:40
*/
@Component
public class KlData {
static Logger logger = LoggerFactory.getLogger(KlData.class);
//客流数据
private static Map<String, Kl> KlData = new HashMap<>();
@Autowired
private KlService klService;
@Value("${passengerFlow.url}")
private String url;
/* @Scheduled(cron = "0/10 * * * * ?")
public void loadKl() {
Map<String,Kl> map= new HashMap<>();
List<Kl> list = klService.loadKl();
for (Kl kl : list) {
String photo=kl.getPhoto();
kl.setPhoto(url+photo);
map.put(kl.getDeviceId(),kl);
}
KlData =map;
}*/
public static Kl getKl(String deviceId){
//return KlData.get( KlData.keySet().toArray()[0]);
return KlData.get(deviceId);
}
}