ScheduledTask.java
1.64 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
package com.xkl.config;
import com.xkl.domain.XklAmpReportMetaItemsEntity;
import com.xkl.domain.XklAmpReportMetaScoreStandardEntity;
import com.xkl.repository.XklAmpReportMetaItemsRespository;
import com.xkl.repository.XklAmpReportMetaScoreStandardRespository;
import lombok.extern.apachecommons.CommonsLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Iterator;
/**
* Created by win7 on 2016/11/21.
* 定时任务读取打分标准
*/
@Component
@CommonsLog
public class ScheduledTask implements Constants{
@Autowired
private XklAmpReportMetaScoreStandardRespository scoreStandardRespository;
@Autowired
private XklAmpReportMetaItemsRespository metaItemsRespository;
@Scheduled(initialDelay = 0,fixedRate = 24*60*60*1000)
public void getTableMap(){
log.info("Load ScoreStandard Table");
Iterator<XklAmpReportMetaScoreStandardEntity> it=scoreStandardRespository.findAll().iterator();
while(it.hasNext()){
XklAmpReportMetaScoreStandardEntity scoreStandard=it.next();
scoreMap.put(scoreStandard.getItemId(),scoreStandard);
}
}
@Scheduled(initialDelay = 0,fixedRate = 24*60*60*1000)
public void getItemMetaMap(){
log.info("Load ItemMeta Table");
Iterator<XklAmpReportMetaItemsEntity> it = metaItemsRespository.findAll().iterator();
while(it.hasNext()){
XklAmpReportMetaItemsEntity reportMetaItems = it.next();
itemMetaMap.put(reportMetaItems.getItemId(),reportMetaItems);
}
}
}