diff --git a/common/common-generator/src/main/java/cn/bunny/common/generator/generator/WebGeneratorCode.java b/common/common-generator/src/main/java/cn/bunny/common/generator/generator/WebGeneratorCode.java index 7edb594..48602e7 100644 --- a/common/common-generator/src/main/java/cn/bunny/common/generator/generator/WebGeneratorCode.java +++ b/common/common-generator/src/main/java/cn/bunny/common/generator/generator/WebGeneratorCode.java @@ -36,7 +36,7 @@ import java.util.stream.Stream; @Service public class WebGeneratorCode { // 公共路径 - public static String commonPath = "D:\\MyFolder\\auth-admin\\auth-web\\src"; + public static String commonPath = "D:\\Project\\web\\PC\\auth\\auth-web\\src"; // 生成API请求路径 public static String apiPath = commonPath + "\\api\\v1\\"; // 生成vue路径 @@ -44,11 +44,11 @@ public class WebGeneratorCode { // 生成仓库路径 public static String storePath = commonPath + "\\store\\monitor\\"; // 后端controller - public static String controllerPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\controller\\"; - public static String servicePath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\"; - public static String serviceImplPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\impl\\"; - public static String mapperPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\mapper\\"; - public static String resourceMapperPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\resources\\mapper\\"; + public static String controllerPath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\controller\\"; + public static String servicePath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\"; + public static String serviceImplPath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\impl\\"; + public static String mapperPath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\mapper\\"; + public static String resourceMapperPath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\resources\\mapper\\"; public static void main(String[] args) throws Exception { Class originalClass = Schedulers.class; diff --git a/common/common-generator/src/main/resources/vms/web/dialog.vm b/common/common-generator/src/main/resources/vms/web/dialog.vm index f3ce2c6..2464e6d 100644 --- a/common/common-generator/src/main/resources/vms/web/dialog.vm +++ b/common/common-generator/src/main/resources/vms/web/dialog.vm @@ -27,7 +27,7 @@ #foreach($item in $baseFieldList) - + #end diff --git a/service/src/main/java/cn/bunny/services/controller/SchedulersController.java b/service/src/main/java/cn/bunny/services/controller/SchedulersController.java index 0331b47..bc3d4e7 100644 --- a/service/src/main/java/cn/bunny/services/controller/SchedulersController.java +++ b/service/src/main/java/cn/bunny/services/controller/SchedulersController.java @@ -47,7 +47,7 @@ public class SchedulersController { return Mono.just(Result.success(pageResult)); } - @Operation(summary = "添加Schedulers视图", description = "添加Schedulers视图") + @Operation(summary = "添加Schedulers任务", description = "添加Schedulers任务") @PostMapping("addSchedulers") public Mono> addSchedulers(@Valid @RequestBody SchedulersAddDto dto) { schedulersService.addSchedulers(dto); diff --git a/service/src/main/java/cn/bunny/services/service/impl/SchedulersServiceImpl.java b/service/src/main/java/cn/bunny/services/service/impl/SchedulersServiceImpl.java index af017b2..2a0097c 100644 --- a/service/src/main/java/cn/bunny/services/service/impl/SchedulersServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/impl/SchedulersServiceImpl.java @@ -18,7 +18,6 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.lang.reflect.Constructor; import java.util.List; /** @@ -70,28 +69,25 @@ public class SchedulersServiceImpl extends ServiceImpl className = Class.forName(jobClassName); - Constructor constructor = className.getConstructor(); // 获取无参构造函数 - constructor.newInstance(); // 创建实例 + Class className = Class.forName(dto.getJobClassName()); + + // 获取无参构造函数 + className.getConstructor().newInstance(); // 创建任务 - JobDetail jobDetail = JobBuilder.newJob((Class) className).withIdentity(jobName, jobGroup) - .withDescription(description).build(); - jobDetail.getJobDataMap().put("jobMethodName", jobMethodName); + JobDetail jobDetail = JobBuilder.newJob((Class) className) + .withIdentity(dto.getJobName(), dto.getJobGroup()) + .withDescription(dto.getDescription()) + .build(); + jobDetail.getJobDataMap().put("jobMethodName", dto.getJobMethodName()); // 执行任务 - CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(cronExpression); - CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity("trigger" + jobName, jobGroup) - .startNow().withSchedule(cronScheduleBuilder).build(); + CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(dto.getCronExpression()); + CronTrigger trigger = TriggerBuilder.newTrigger() + .withIdentity("trigger" + dto.getJobName(), dto.getJobGroup()) + .startNow() + .withSchedule(cronScheduleBuilder).build(); scheduler.scheduleJob(jobDetail, trigger); } catch (Exception exception) { throw new BunnyException(exception.getMessage());