DataInitializer.java
1.14 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
package cn.com.glsx.kafka.init;
import cn.com.glsx.kafka.service.EshieldAlarmService;
import cn.com.glsx.stdinterface.dto.AlarmWarnAlarmTypeDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
/**
* 初始化警情中心
*
* @author yangll
*/
@Component
@Order(Ordered.HIGHEST_PRECEDENCE + 1)
public class DataInitializer implements CommandLineRunner {
@Autowired
private EshieldAlarmService eshieldAlarmService;
/**
* 初始化用户数据
**/
public static HashMap<String, Integer> cacheAlarmType = new HashMap<>();
@Override
public void run(String... strings) {
initAlarmType();
}
public void initAlarmType() {
List<AlarmWarnAlarmTypeDTO> alarmTypeList = eshieldAlarmService.getAllAlarmType();
for (AlarmWarnAlarmTypeDTO eat : alarmTypeList) {
cacheAlarmType.put(eat.getTypeDesc(), eat.getAlarmType());
}
}
}