blob: 0a91750e26e898f61c33d62c5029eff25618d2d6 (
plain)
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
53
54
55
|
package com.cmcc.simulator.job;
import java.util.ArrayList;
import java.util.List;
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.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSONObject;
import com.cmcc.simulator.service.SimulatorService;
import com.cmcc.simulator.xml.FileReadyEvent;
import com.cmcc.simulator.xml.Utils;
@Component
@EnableScheduling
public class ScheduleJob {
private static final Logger logger = LoggerFactory.getLogger(ScheduleJob.class);
@Autowired
private SimulatorService service;
@Value("${ftppath}")
private String ftpPath;
@Scheduled(fixedDelayString = "${fixeddelay}")
public void runThird() throws Exception {
List<String> nsstIds = service.getActivatedSlices();
if (!nsstIds.isEmpty()) {
logger.info("the snssai list is : {}", nsstIds);
service.createAMF(nsstIds);
service.createUPF(nsstIds);
service.gzipFiles();
List<String> list = new ArrayList<String>();
list.add(ftpPath);
FileReadyEvent event = new FileReadyEvent();
event.setCreateat(Utils.getTimeFormat());
event.setDatasource("VIM");
event.setFileuri(list);
event.setNfvoid("10.10.10.1");
event.setSourceid("10011001");
service.notify(event);
service.delFiles();
logger.info("notify pm data success: {}", JSONObject.toJSON(event).toString());
}
}
}
|