瀏覽代碼

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

liuwenbin 7 年之前
父節點
當前提交
4c2fbd8130

+ 5 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/dao/QuartzJobConfigDao.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.statistics.dao;
import com.yihu.wlyy.entity.job.QuartzJobConfig;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -24,4 +25,8 @@ public interface QuartzJobConfigDao extends PagingAndSortingRepository<QuartzJob
    @Query(" FROM QuartzJobConfig a WHERE a.id=?1 and a.del='1'")
    QuartzJobConfig findById(String id);
    @Modifying
    @Query(" update QuartzJobConfig a set a.status=?2 where a.id=?1 ")
    int updateStatus(String id, String status);
}

+ 6 - 4
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/service/JobService.java

@ -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") ;//设置任务状态是启动 }
            }
        }
    }

+ 5 - 6
patient-co/patient-co-statistics-es/src/main/resources/quartz.properties

@ -2,7 +2,7 @@
# to create a Quartz Scheduler Instance, if a different
# properties file is not explicitly specified.
#
 
org.quartz.scheduler.instanceName: DefaultQuartzScheduler
org.quartz.scheduler.rmi.export: false
org.quartz.scheduler.rmi.proxy: false
@ -12,18 +12,17 @@ org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount: 20
org.quartz.threadPool.threadPriority: 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread: true
 
org.quartz.jobStore.misfireThreshold: 18000000
 
org.quartz.jobStore.misfireThreshold: 60000
#============================================================================
# Configure JobStore
#============================================================================
 
# RAM
# org.quartz.jobStore.class: org.quartz.simpl.RAMJobStore
# Configure JobStore Cluster
org.quartz.jobStore.class:org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.useProperties=true
org.quartz.jobStore.driverDelegateClass:org.quartz.impl.jdbcjobstore.StdJDBCDelegate
#datasource׺
org.quartz.jobStore.tablePrefix:QRTZ_