|
@ -27,7 +27,7 @@ import java.util.*;
|
|
|
*/
|
|
|
@Service
|
|
|
public class JobService {
|
|
|
private Long sleepTime = 10000L;
|
|
|
private Long sleepTime = 5000L;
|
|
|
|
|
|
@Autowired
|
|
|
private QuartzHelper quartzHelper;
|
|
@ -47,7 +47,7 @@ public class JobService {
|
|
|
if (quartzJobConfig != null) {
|
|
|
for (int j = 1; j <= 2; j++) {
|
|
|
quartzHelper.removeJob(quartzJobConfig.getId() + "-" + j);
|
|
|
quartzJobConfig.setStatus("0");
|
|
|
wlyyJobConfigDao.updateStatus(quartzJobConfig.getId(),"0") ;;
|
|
|
}
|
|
|
} else {
|
|
|
throw new Exception("任务已经停止");
|
|
@ -72,7 +72,8 @@ public class JobService {
|
|
|
for (QuartzJobConfig quartzJobConfig : quartzJobConfigs) {
|
|
|
for (int j = 1; j <= 2; j++) {
|
|
|
quartzHelper.removeJob(quartzJobConfig.getId() + "-" + j);
|
|
|
quartzJobConfig.setStatus("0");
|
|
|
|
|
|
wlyyJobConfigDao.updateStatus(quartzJobConfig.getId(),"0") ;;
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
@ -98,6 +99,7 @@ public class JobService {
|
|
|
* @param quartzJobConfig
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@Transactional
|
|
|
private void startOneJob(QuartzJobConfig quartzJobConfig) throws Exception {
|
|
|
|
|
|
WlyyJobConfigVO wlyyJobConfigVO = new WlyyJobConfigVO();
|
|
@ -109,7 +111,7 @@ public class JobService {
|
|
|
for (int j = 1; j <= 2; j++) {
|
|
|
//往quartz框架添加任务
|
|
|
quartzHelper.addJob(getRightClass(quartzJobConfig), quartzJobConfig.getQuartzCron(), quartzJobConfig.getId() + "-" + j, params);
|
|
|
quartzJobConfig.setStatus("1");//设置任务状态是启动 }
|
|
|
wlyyJobConfigDao.updateStatus(quartzJobConfig.getId(),"1") ;//设置任务状态是启动 }
|
|
|
}
|
|
|
}
|
|
|
}
|