干燥机配套车间生产管理系统/云平台服务端
bsw215583320
2023-09-12 a6ccb31191385dd9c3d2e9d75e1bcda7ff6a4ed3
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
package org.jeecg.modules.dry.listener;
 
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.io.ByteStreams;
import org.jeecg.modules.dry.common.CacheConstants;
import org.jeecg.modules.dry.common.CommonDict;
import org.jeecg.modules.dry.vo.DryFault;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
 
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
@Component
public class InitListener implements ApplicationListener<ApplicationStartedEvent> {
    @Override
    public void onApplicationEvent(ApplicationStartedEvent event) {
        InputStream fault = getClass().getResourceAsStream("/fault.json");
        try {
            JSONObject jsonObject = JSONObject.parseObject(fault, JSONObject.class);
            Map<String, String> map = jsonObject.toJavaObject(Map.class);
            CommonDict.faultDict = map;
 
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}