|
|
|
|
12
|
import org.jfw.util.bean.BeanFactory;
|
12
|
import org.jfw.util.bean.BeanFactory;
|
13
|
import org.jfw.util.context.JfwAppContext;
|
13
|
import org.jfw.util.context.JfwAppContext;
|
14
|
|
14
|
|
|
|
15
|
import com.ekexiu.portal.service.WeixinService;
|
|
|
16
|
|
15
|
@Bean
|
17
|
@Bean
|
16
|
public class TaskJob implements AfterBeanFactory {
|
18
|
public class TaskJob implements AfterBeanFactory {
|
17
|
private ScheduledExecutorService service;
|
19
|
private ScheduledExecutorService service;
|
|
|
|
|
22
|
TaskJobEntry tje = (TaskJobEntry) bf.getBean("com_ekexiu_portal_job_TaskJobEntry");
|
24
|
TaskJobEntry tje = (TaskJobEntry) bf.getBean("com_ekexiu_portal_job_TaskJobEntry");
|
23
|
// UserLogTaskJobEntry ultje = (UserLogTaskJobEntry) bf.getBean("com_ekexiu_portal_job_UserLogTaskJobEntry");
|
25
|
// UserLogTaskJobEntry ultje = (UserLogTaskJobEntry) bf.getBean("com_ekexiu_portal_job_UserLogTaskJobEntry");
|
24
|
DictTaskJobEntry dtje =(DictTaskJobEntry) bf.getBean("com_ekexiu_portal_job_DictTaskJobEntry");
|
26
|
DictTaskJobEntry dtje =(DictTaskJobEntry) bf.getBean("com_ekexiu_portal_job_DictTaskJobEntry");
|
|
|
27
|
final WeixinService weixin =(WeixinService)bf.getBean("com_ekexiu_portal_service_WeixinService");
|
|
|
28
|
|
25
|
long delayTime = tje.getDelayTime();
|
29
|
long delayTime = tje.getDelayTime();
|
26
|
long task = getTimeMillis(tje.getTaskTime());
|
30
|
long task = getTimeMillis(tje.getTaskTime());
|
27
|
long taskTime = task - System.currentTimeMillis();
|
31
|
long taskTime = task - System.currentTimeMillis();
|
|
|
|
|
32
|
service.scheduleAtFixedRate(tje, taskTime, delayTime, TimeUnit.MILLISECONDS);
|
36
|
service.scheduleAtFixedRate(tje, taskTime, delayTime, TimeUnit.MILLISECONDS);
|
33
|
// service.scheduleAtFixedRate(ultje, taskTime, delayTime, TimeUnit.MILLISECONDS);
|
37
|
// service.scheduleAtFixedRate(ultje, taskTime, delayTime, TimeUnit.MILLISECONDS);
|
34
|
service.scheduleAtFixedRate(dtje, 1, dtje.getDelayTime(), TimeUnit.SECONDS);
|
38
|
service.scheduleAtFixedRate(dtje, 1, dtje.getDelayTime(), TimeUnit.SECONDS);
|
|
|
39
|
service.scheduleAtFixedRate(new Runnable() {
|
|
|
40
|
@Override
|
|
|
41
|
public void run() {
|
|
|
42
|
weixin.refresh();
|
|
|
43
|
}
|
|
|
44
|
}, 0, weixin.getDelayTime(), TimeUnit.SECONDS);
|
35
|
}
|
45
|
}
|
36
|
private static long getTimeMillis(String time) {
|
46
|
private static long getTimeMillis(String time) {
|
37
|
try {
|
47
|
try {
|