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 | package cn.iocoder.yudao.adminserver.modules.infra.controller.job; | 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 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 7 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 8 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | 9 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 6 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | 10 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 7 | import cn.iocoder.yudao.framework.quartz.core.util.CronUtils; | 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 | import io.swagger.annotations.Api; | 12 | import io.swagger.annotations.Api; |
| 13 | import io.swagger.annotations.ApiImplicitParam; | 13 | import io.swagger.annotations.ApiImplicitParam; |
| 14 | import io.swagger.annotations.ApiImplicitParams; | 14 | import io.swagger.annotations.ApiImplicitParams; |
| 15 | import io.swagger.annotations.ApiOperation; | 15 | import io.swagger.annotations.ApiOperation; |
| 16 | +import org.quartz.Scheduler; | ||
| 16 | import org.quartz.SchedulerException; | 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 | import org.springframework.security.access.prepost.PreAuthorize; | 23 | import org.springframework.security.access.prepost.PreAuthorize; |
| 18 | import org.springframework.validation.annotation.Validated; | 24 | import org.springframework.validation.annotation.Validated; |
| 19 | import org.springframework.web.bind.annotation.*; | 25 | import org.springframework.web.bind.annotation.*; |
| @@ -22,10 +28,7 @@ import javax.annotation.Resource; | @@ -22,10 +28,7 @@ import javax.annotation.Resource; | ||
| 22 | import javax.servlet.http.HttpServletResponse; | 28 | import javax.servlet.http.HttpServletResponse; |
| 23 | import javax.validation.Valid; | 29 | import javax.validation.Valid; |
| 24 | import java.io.IOException; | 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 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 33 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 31 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | 34 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| @@ -39,6 +42,15 @@ public class InfJobController { | @@ -39,6 +42,15 @@ public class InfJobController { | ||
| 39 | @Resource | 42 | @Resource |
| 40 | private InfJobService jobService; | 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 | @PostMapping("/create") | 54 | @PostMapping("/create") |
| 43 | @ApiOperation("创建定时任务") | 55 | @ApiOperation("创建定时任务") |
| 44 | @PreAuthorize("@ss.hasPermission('infra:job:create')") | 56 | @PreAuthorize("@ss.hasPermission('infra:job:create')") |
| @@ -111,6 +123,15 @@ public class InfJobController { | @@ -111,6 +123,15 @@ public class InfJobController { | ||
| 111 | @PreAuthorize("@ss.hasPermission('infra:job:query')") | 123 | @PreAuthorize("@ss.hasPermission('infra:job:query')") |
| 112 | public CommonResult<PageResult<InfJobRespVO>> getJobPage(@Valid InfJobPageReqVO pageVO) { | 124 | public CommonResult<PageResult<InfJobRespVO>> getJobPage(@Valid InfJobPageReqVO pageVO) { |
| 113 | PageResult<InfJobDO> pageResult = jobService.getJobPage(pageVO); | 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 | return success(InfJobConvert.INSTANCE.convertPage(pageResult)); | 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,7 +10,7 @@ pipeline { | ||
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | environment { | 12 | environment { |
| 13 | - APP_NAME = 'yudao-admin-ui' | 13 | + APP_NAME = 'yudao-admin' |
| 14 | NGINX_WORKDIR = '/home/pi/mydata/nginx/html/' | 14 | NGINX_WORKDIR = '/home/pi/mydata/nginx/html/' |
| 15 | } | 15 | } |
| 16 | 16 | ||
| @@ -31,7 +31,7 @@ pipeline { | @@ -31,7 +31,7 @@ pipeline { | ||
| 31 | 31 | ||
| 32 | stage('部署') { | 32 | stage('部署') { |
| 33 | steps { | 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 | sh 'tar -zcvf ' + "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz ' + "${env.APP_NAME}" + '/dist/' | 35 | sh 'tar -zcvf ' + "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz ' + "${env.APP_NAME}" + '/dist/' |
| 36 | archiveArtifacts "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz' | 36 | archiveArtifacts "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz' |
| 37 | //TODO 考虑刷新缓存的问题 | 37 | //TODO 考虑刷新缓存的问题 |