Commit d5997c4dc0c1e3268441fa69e835326bc13b65a9
1 parent
b5695494
修改前端部署路径
Showing
3 changed files
with
33 additions
and
10 deletions
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/job/InfJobController.java
| 1 | 1 | package cn.iocoder.yudao.adminserver.modules.infra.controller.job; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job.*; | |
| 4 | +import cn.iocoder.yudao.adminserver.modules.infra.convert.job.InfJobConvert; | |
| 5 | +import cn.iocoder.yudao.adminserver.modules.infra.dal.dataobject.job.InfJobDO; | |
| 6 | +import cn.iocoder.yudao.adminserver.modules.infra.service.job.InfJobService; | |
| 3 | 7 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 8 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 9 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 6 | 10 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 7 | 11 | import cn.iocoder.yudao.framework.quartz.core.util.CronUtils; |
| 8 | -import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job.*; | |
| 9 | -import cn.iocoder.yudao.adminserver.modules.infra.convert.job.InfJobConvert; | |
| 10 | -import cn.iocoder.yudao.adminserver.modules.infra.dal.dataobject.job.InfJobDO; | |
| 11 | -import cn.iocoder.yudao.adminserver.modules.infra.service.job.InfJobService; | |
| 12 | 12 | import io.swagger.annotations.Api; |
| 13 | 13 | import io.swagger.annotations.ApiImplicitParam; |
| 14 | 14 | import io.swagger.annotations.ApiImplicitParams; |
| 15 | 15 | import io.swagger.annotations.ApiOperation; |
| 16 | +import org.quartz.Scheduler; | |
| 16 | 17 | import org.quartz.SchedulerException; |
| 18 | +import org.quartz.impl.StdScheduler; | |
| 19 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 20 | +import org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor; | |
| 21 | +import org.springframework.scheduling.config.ScheduledTask; | |
| 22 | +import org.springframework.scheduling.quartz.SchedulerFactoryBean; | |
| 17 | 23 | import org.springframework.security.access.prepost.PreAuthorize; |
| 18 | 24 | import org.springframework.validation.annotation.Validated; |
| 19 | 25 | import org.springframework.web.bind.annotation.*; |
| ... | ... | @@ -22,10 +28,7 @@ import javax.annotation.Resource; |
| 22 | 28 | import javax.servlet.http.HttpServletResponse; |
| 23 | 29 | import javax.validation.Valid; |
| 24 | 30 | import java.io.IOException; |
| 25 | -import java.util.Collection; | |
| 26 | -import java.util.Collections; | |
| 27 | -import java.util.Date; | |
| 28 | -import java.util.List; | |
| 31 | +import java.util.*; | |
| 29 | 32 | |
| 30 | 33 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 31 | 34 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| ... | ... | @@ -39,6 +42,15 @@ public class InfJobController { |
| 39 | 42 | @Resource |
| 40 | 43 | private InfJobService jobService; |
| 41 | 44 | |
| 45 | + @Autowired | |
| 46 | + private SchedulerFactoryBean schedulerFactoryBean; | |
| 47 | + | |
| 48 | + @Autowired | |
| 49 | + private StdScheduler stdScheduler; | |
| 50 | + | |
| 51 | + @Autowired | |
| 52 | + private ScheduledAnnotationBeanPostProcessor scheduledAnnotationBeanPostProcessor; | |
| 53 | + | |
| 42 | 54 | @PostMapping("/create") |
| 43 | 55 | @ApiOperation("创建定时任务") |
| 44 | 56 | @PreAuthorize("@ss.hasPermission('infra:job:create')") |
| ... | ... | @@ -111,6 +123,15 @@ public class InfJobController { |
| 111 | 123 | @PreAuthorize("@ss.hasPermission('infra:job:query')") |
| 112 | 124 | public CommonResult<PageResult<InfJobRespVO>> getJobPage(@Valid InfJobPageReqVO pageVO) { |
| 113 | 125 | PageResult<InfJobDO> pageResult = jobService.getJobPage(pageVO); |
| 126 | + Scheduler scheduler = schedulerFactoryBean.getScheduler(); | |
| 127 | + Set<ScheduledTask> scheduledTasks = scheduledAnnotationBeanPostProcessor.getScheduledTasks(); | |
| 128 | + Iterator<ScheduledTask> scheduledTaskIterator = scheduledTasks.iterator(); | |
| 129 | + while (scheduledTaskIterator.hasNext()) { | |
| 130 | + System.err.println("================================="); | |
| 131 | + ScheduledTask scheduledTask = scheduledTaskIterator.next(); | |
| 132 | + scheduledAnnotationBeanPostProcessor.postProcessAfterInitialization(scheduledTask, scheduledTask.toString()); | |
| 133 | + System.err.println("================================="); | |
| 134 | + } | |
| 114 | 135 | return success(InfJobConvert.INSTANCE.convertPage(pageResult)); |
| 115 | 136 | } |
| 116 | 137 | ... | ... |
yudao-admin-ui/.env.production
yudao-admin-ui/Jenkinsfile
| ... | ... | @@ -10,7 +10,7 @@ pipeline { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | environment { |
| 13 | - APP_NAME = 'yudao-admin-ui' | |
| 13 | + APP_NAME = 'yudao-admin' | |
| 14 | 14 | NGINX_WORKDIR = '/home/pi/mydata/nginx/html/' |
| 15 | 15 | } |
| 16 | 16 | |
| ... | ... | @@ -31,7 +31,7 @@ pipeline { |
| 31 | 31 | |
| 32 | 32 | stage('部署') { |
| 33 | 33 | steps { |
| 34 | - sh 'cp -rf ' + "${env.APP_NAME}" + '/dist/. ' + "${env.NGINX_WORKDIR}" | |
| 34 | + sh 'cp -rf ' + "${env.APP_NAME}" + '/dist/. ' + "${env.NGINX_WORKDIR}" + "${env.APP_NAME}" | |
| 35 | 35 | sh 'tar -zcvf ' + "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz ' + "${env.APP_NAME}" + '/dist/' |
| 36 | 36 | archiveArtifacts "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz' |
| 37 | 37 | //TODO 考虑刷新缓存的问题 | ... | ... |