diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/job/InfJobController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/job/InfJobController.java index 1cd3c8dc7..2fe29304d 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/job/InfJobController.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/job/InfJobController.java @@ -1,19 +1,25 @@ package cn.iocoder.yudao.adminserver.modules.infra.controller.job; +import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job.*; +import cn.iocoder.yudao.adminserver.modules.infra.convert.job.InfJobConvert; +import cn.iocoder.yudao.adminserver.modules.infra.dal.dataobject.job.InfJobDO; +import cn.iocoder.yudao.adminserver.modules.infra.service.job.InfJobService; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import cn.iocoder.yudao.framework.quartz.core.util.CronUtils; -import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job.*; -import cn.iocoder.yudao.adminserver.modules.infra.convert.job.InfJobConvert; -import cn.iocoder.yudao.adminserver.modules.infra.dal.dataobject.job.InfJobDO; -import cn.iocoder.yudao.adminserver.modules.infra.service.job.InfJobService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.quartz.Scheduler; import org.quartz.SchedulerException; +import org.quartz.impl.StdScheduler; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor; +import org.springframework.scheduling.config.ScheduledTask; +import org.springframework.scheduling.quartz.SchedulerFactoryBean; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -22,10 +28,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.IOException; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.List; +import java.util.*; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; @@ -39,6 +42,15 @@ public class InfJobController { @Resource private InfJobService jobService; + @Autowired + private SchedulerFactoryBean schedulerFactoryBean; + + @Autowired + private StdScheduler stdScheduler; + + @Autowired + private ScheduledAnnotationBeanPostProcessor scheduledAnnotationBeanPostProcessor; + @PostMapping("/create") @ApiOperation("创建定时任务") @PreAuthorize("@ss.hasPermission('infra:job:create')") @@ -111,6 +123,15 @@ public class InfJobController { @PreAuthorize("@ss.hasPermission('infra:job:query')") public CommonResult> getJobPage(@Valid InfJobPageReqVO pageVO) { PageResult pageResult = jobService.getJobPage(pageVO); + Scheduler scheduler = schedulerFactoryBean.getScheduler(); + Set scheduledTasks = scheduledAnnotationBeanPostProcessor.getScheduledTasks(); + Iterator scheduledTaskIterator = scheduledTasks.iterator(); + while (scheduledTaskIterator.hasNext()) { + System.err.println("================================="); + ScheduledTask scheduledTask = scheduledTaskIterator.next(); + scheduledAnnotationBeanPostProcessor.postProcessAfterInitialization(scheduledTask, scheduledTask.toString()); + System.err.println("================================="); + } return success(InfJobConvert.INSTANCE.convertPage(pageResult)); } diff --git a/yudao-admin-ui/.env.production b/yudao-admin-ui/.env.production index e00052eb6..850530aca 100644 --- a/yudao-admin-ui/.env.production +++ b/yudao-admin-ui/.env.production @@ -3,3 +3,5 @@ ENV = 'production' # 芋道管理系统/生产环境 VUE_APP_BASE_API = '/prod-api' +# 静态资源地址 +PUBLIC_PATH = 'yudao-admin' diff --git a/yudao-admin-ui/Jenkinsfile b/yudao-admin-ui/Jenkinsfile index 06a4ba34e..68490b579 100644 --- a/yudao-admin-ui/Jenkinsfile +++ b/yudao-admin-ui/Jenkinsfile @@ -10,7 +10,7 @@ pipeline { } environment { - APP_NAME = 'yudao-admin-ui' + APP_NAME = 'yudao-admin' NGINX_WORKDIR = '/home/pi/mydata/nginx/html/' } @@ -31,7 +31,7 @@ pipeline { stage('部署') { steps { - sh 'cp -rf ' + "${env.APP_NAME}" + '/dist/. ' + "${env.NGINX_WORKDIR}" + sh 'cp -rf ' + "${env.APP_NAME}" + '/dist/. ' + "${env.NGINX_WORKDIR}" + "${env.APP_NAME}" sh 'tar -zcvf ' + "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz ' + "${env.APP_NAME}" + '/dist/' archiveArtifacts "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz' //TODO 考虑刷新缓存的问题