From 368beb362d7ffb017174d7d79a16032d0647776f Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期一, 26 八月 2024 13:48:11 +0800
Subject: [PATCH] model

---
 /dev/null                                                                                       |  161 ----------------------------------------
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/api/MdkApiImpl.java |   25 ++++++
 2 files changed, 25 insertions(+), 161 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/api/MdkApiImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/api/MdkApiImpl.java
new file mode 100644
index 0000000..cac50e7
--- /dev/null
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/api/MdkApiImpl.java
@@ -0,0 +1,25 @@
+package com.iailab.module.api;
+
+import com.iailab.api.mdk.MdkApi;
+import com.iailab.api.mdk.dto.MdkPredictReqDTO;
+import com.iailab.framework.common.pojo.CommonResult;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.RestController;
+
+import static com.iailab.framework.common.pojo.CommonResult.success;
+
+/**
+ * @author PanZhibao
+ * @Description
+ * @createTime 2024年08月26日
+ */
+@RestController
+@Validated
+public class MdkApiImpl implements MdkApi {
+
+    @Override
+    public CommonResult<Boolean> predict(MdkPredictReqDTO reqDTO) {
+
+        return success(true);
+    }
+}
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/config/ScheduleConfig.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/config/ScheduleConfig.java
deleted file mode 100644
index 0a3101e..0000000
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/config/ScheduleConfig.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.iailab.module.job.config;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.quartz.SchedulerFactoryBean;
-
-import javax.sql.DataSource;
-import java.util.Properties;
-
-/**
- * 定时任务配置
- *
- * @author Mark sunlightcs@gmail.com
- */
-@Configuration
-public class ScheduleConfig {
-
-    @Bean
-    public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) {
-        SchedulerFactoryBean factory = new SchedulerFactoryBean();
-        factory.setDataSource(dataSource);
-
-        //quartz参数
-        Properties prop = new Properties();
-        prop.put("org.quartz.scheduler.instanceName", "IailabModelScheduler");
-        prop.put("org.quartz.scheduler.instanceId", "AUTO");
-        //线程池配置
-        prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
-        prop.put("org.quartz.threadPool.threadCount", "20");
-        prop.put("org.quartz.threadPool.threadPriority", "5");
-        //JobStore配置
-        prop.put("org.quartz.jobStore.class", "org.springframework.scheduling.quartz.LocalDataSourceJobStore");
-        //集群配置
-        prop.put("org.quartz.jobStore.isClustered", "true");
-        prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000");
-        prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1");
-
-        prop.put("org.quartz.jobStore.misfireThreshold", "12000");
-        prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
-        prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?");
-
-        //PostgreSQL数据库,需要打开此注释
-        //prop.put("org.quartz.jobStore.driverDelegateClass", "org.quartz.impl.jdbcjobstore.PostgreSQLDelegate");
-
-        factory.setQuartzProperties(prop);
-
-        factory.setSchedulerName("IailabModelScheduler");
-        //延时启动
-        factory.setStartupDelay(30);
-        factory.setApplicationContextSchedulerContextKey("applicationContextKey");
-        //可选,QuartzScheduler 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了
-        factory.setOverwriteExistingJobs(true);
-        //设置自动启动,默认为true
-        factory.setAutoStartup(true);
-
-        return factory;
-    }
-}
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/controller/ScheduleJobController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/controller/ScheduleJobController.java
deleted file mode 100644
index 5a7cb19..0000000
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/controller/ScheduleJobController.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package com.iailab.module.job.controller;
-
-import com.iailab.framework.common.page.PageData;
-import com.iailab.common.utils.Constant;
-import com.iailab.framework.common.pojo.CommonResult;
-import com.iailab.framework.common.util.validation.ValidationUtils;
-import com.iailab.framework.common.validation.group.AddGroup;
-import com.iailab.framework.common.validation.group.DefaultGroup;
-import com.iailab.framework.common.validation.group.UpdateGroup;
-import com.iailab.module.job.dto.ScheduleJobDTO;
-import com.iailab.module.job.service.ScheduleJobService;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.Parameters;
-import javax.annotation.Resource;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-
-import java.util.Map;
-
-/**
- * 定时任务
- *
- * @author Mark sunlightcs@gmail.com
- */
-@RestController
-@RequestMapping("mcs/schedule")
-@Tag(name = "定时任务")
-public class ScheduleJobController {
-	@Resource
-	private ScheduleJobService scheduleJobService;
-
-	@GetMapping("page")
-	@Operation(summary = "分页")
-	@Parameters({
-		@Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true) ,
-		@Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true) ,
-		@Parameter(name = Constant.ORDER_FIELD, description = "排序字段") ,
-		@Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)") ,
-		@Parameter(name = "beanName", description = "beanName")
-	})
-	public CommonResult<PageData<ScheduleJobDTO>> page(@RequestParam Map<String, Object> params){
-		PageData<ScheduleJobDTO> page = scheduleJobService.page(params);
-
-		return new CommonResult<PageData<ScheduleJobDTO>>().setData(page);
-	}
-
-	@GetMapping("{id}")
-	@Operation(summary = "信息")
-	public CommonResult<ScheduleJobDTO> info(@PathVariable("id") Long id){
-		ScheduleJobDTO schedule = scheduleJobService.get(id);
-		
-		return new CommonResult<ScheduleJobDTO>().setData(schedule);
-	}
-
-	@PostMapping
-	@Operation(summary = "保存")
-	@PreAuthorize("@ss.hasPermission('mcs:schedule:save')")
-	public CommonResult save(@RequestBody ScheduleJobDTO dto){
-		ValidationUtils.validate(dto, AddGroup.class, DefaultGroup.class);
-		
-		scheduleJobService.save(dto);
-		
-		return new CommonResult();
-	}
-
-	@PutMapping
-	@Operation(summary = "修改")
-	@PreAuthorize("@ss.hasPermission('mcs:schedule:update')")
-	public CommonResult update(@RequestBody ScheduleJobDTO dto){
-		ValidationUtils.validate(dto, UpdateGroup.class, DefaultGroup.class);
-				
-		scheduleJobService.update(dto);
-		
-		return new CommonResult();
-	}
-
-	@DeleteMapping
-	@Operation(summary = "删除")
-	@PreAuthorize("@ss.hasPermission('mcs:schedule:delete')")
-	public CommonResult delete(@RequestBody Long[] ids){
-		scheduleJobService.deleteBatch(ids);
-		
-		return new CommonResult();
-	}
-
-	@PutMapping("/run")
-	@Operation(summary = "立即执行")
-	@PreAuthorize("@ss.hasPermission('mcs:schedule:run')")
-	public CommonResult run(@RequestBody Long[] ids){
-		scheduleJobService.run(ids);
-		
-		return new CommonResult();
-	}
-
-	@PutMapping("/pause")
-	@Operation(summary = "暂停")
-	@PreAuthorize("@ss.hasPermission('mcs:schedule:pause')")
-	public CommonResult pause(@RequestBody Long[] ids){
-		scheduleJobService.pause(ids);
-		
-		return new CommonResult();
-	}
-
-	@PutMapping("/resume")
-	@Operation(summary = "恢复")
-	@PreAuthorize("@ss.hasPermission('mcs:schedule:resume')")
-	public CommonResult resume(@RequestBody Long[] ids){
-		scheduleJobService.resume(ids);
-		return new CommonResult();
-	}
-
-}
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/controller/ScheduleJobLogController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/controller/ScheduleJobLogController.java
deleted file mode 100644
index b66e558..0000000
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/controller/ScheduleJobLogController.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.iailab.module.job.controller;
-
-import com.iailab.framework.common.page.PageData;
-import com.iailab.common.utils.Constant;
-import com.iailab.framework.common.pojo.CommonResult;
-import com.iailab.module.job.dto.ScheduleJobLogDTO;
-import com.iailab.module.job.service.ScheduleJobLogService;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.Parameters;
-import javax.annotation.Resource;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-
-import java.util.Map;
-
-/**
- * 定时任务日志
- *
- * @author Mark sunlightcs@gmail.com
- */
-@RestController
-@RequestMapping("/mcs/scheduleLog")
-@Tag(name = "定时任务日志")
-public class ScheduleJobLogController {
-	@Resource
-	private ScheduleJobLogService scheduleJobLogService;
-
-	@GetMapping("page")
-	@Operation(summary = "分页")
-	@Parameters({
-		@Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true) ,
-		@Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true) ,
-		@Parameter(name = Constant.ORDER_FIELD, description = "排序字段") ,
-		@Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)") ,
-		@Parameter(name = "jobId", description = "jobId")
-	})
-	@PreAuthorize("@ss.hasPermission('mcs:schedule:log')")
-	public CommonResult<PageData<ScheduleJobLogDTO>> page(@RequestParam Map<String, Object> params){
-		PageData<ScheduleJobLogDTO> page = scheduleJobLogService.page(params);
-		
-		return new CommonResult<PageData<ScheduleJobLogDTO>>().setData(page);
-	}
-
-	@GetMapping("{id}")
-	@Operation(summary = "信息")
-	@PreAuthorize("@ss.hasPermission('mcs:schedule:log')")
-	public CommonResult<ScheduleJobLogDTO> info(@PathVariable("id") Long id){
-		ScheduleJobLogDTO log = scheduleJobLogService.get(id);
-		
-		return new CommonResult<ScheduleJobLogDTO>().setData(log);
-	}
-}
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/dao/ScheduleJobDao.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/dao/ScheduleJobDao.java
deleted file mode 100644
index 1bc0880..0000000
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/dao/ScheduleJobDao.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.iailab.module.job.dao;
-
-import com.iailab.framework.common.dao.BaseDao;
-import com.iailab.module.job.entity.ScheduleJobEntity;
-import org.apache.ibatis.annotations.Mapper;
-
-import java.util.Map;
-
-/**
- * 定时任务
- *
- * @author Mark sunlightcs@gmail.com
- */
-@Mapper
-public interface ScheduleJobDao extends BaseDao<ScheduleJobEntity> {
-	
-	/**
-	 * 批量更新状态
-	 */
-	int updateBatch(Map<String, Object> map);
-}
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/dao/ScheduleJobLogDao.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/dao/ScheduleJobLogDao.java
deleted file mode 100644
index 89954da..0000000
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/dao/ScheduleJobLogDao.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.iailab.module.job.dao;
-
-import com.iailab.framework.common.dao.BaseDao;
-import com.iailab.module.job.entity.ScheduleJobLogEntity;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * 定时任务日志
- *
- * @author Mark sunlightcs@gmail.com
- */
-@Mapper
-public interface ScheduleJobLogDao extends BaseDao<ScheduleJobLogEntity> {
-	
-}
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/dto/ScheduleJobDTO.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/dto/ScheduleJobDTO.java
deleted file mode 100644
index 3b8ab42..0000000
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/dto/ScheduleJobDTO.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.iailab.module.job.dto;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.iailab.framework.common.validation.group.AddGroup;
-import com.iailab.framework.common.validation.group.DefaultGroup;
-import com.iailab.framework.common.validation.group.UpdateGroup;
-import io.swagger.v3.oas.annotations.media.Schema;
-
-import lombok.Data;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Null;
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * 定时任务
- *
- * @author Mark sunlightcs@gmail.com
- * @since 1.0.0
- */
-@Data
-@Schema(name = "定时任务")
-public class ScheduleJobDTO implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    @Schema(name = "id")
-    @Null(message="{id.null}", groups = AddGroup.class)
-    @NotNull(message="{id.require}", groups = UpdateGroup.class)
-    private Long id;
-
-    @Schema(name = "spring bean名称")
-    @NotBlank(message = "{schedule.bean.require}", groups = DefaultGroup.class)
-    private String beanName;
-
-    @Schema(name = "参数")
-    private String params;
-
-    @Schema(name = "cron表达式")
-    @NotBlank(message = "{schedule.cron.require}", groups = DefaultGroup.class)
-    private String cronExpression;
-
-    @Schema(name = "任务状态  0:暂停  1:正常")
-//    @Range(min=0, max=1, message = "{schedule.status.range}", groups = DefaultGroup.class)
-    private Integer status;
-
-    @Schema(name = "备注")
-    private String remark;
-
-    @Schema(name = "创建时间")
-    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
-    private Date createDate;
-
-}
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/dto/ScheduleJobLogDTO.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/dto/ScheduleJobLogDTO.java
deleted file mode 100644
index 7fa7cd7..0000000
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/dto/ScheduleJobLogDTO.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.iailab.module.job.dto;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-
-import lombok.Data;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * 定时任务日志
- *
- * @author Mark sunlightcs@gmail.com
- * @since 1.0.0
- */
-@Data
-@Schema(name = "定时任务日志")
-public class ScheduleJobLogDTO implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    @Schema(name = "id")
-    private Long id;
-
-    @Schema(name = "任务id")
-    private Long jobId;
-
-    @Schema(name = "spring bean名称")
-    private String beanName;
-
-    @Schema(name = "参数")
-    private String params;
-
-    @Schema(name = "任务状态    0:失败    1:成功")
-    private Integer status;
-
-    @Schema(name = "失败信息")
-    private String error;
-
-    @Schema(name = "耗时(单位:毫秒)")
-    private Integer times;
-
-    @Schema(name = "创建时间")
-    private Date createDate;
-
-}
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/entity/ScheduleJobEntity.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/entity/ScheduleJobEntity.java
deleted file mode 100644
index 06c4ede..0000000
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/entity/ScheduleJobEntity.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Copyright (c) 2018 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package com.iailab.module.job.entity;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.iailab.framework.common.entity.BaseEntity;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.util.Date;
-
-/**
- * 定时任务
- *
- * @author Mark sunlightcs@gmail.com
- */
-@Data
-@EqualsAndHashCode(callSuper=false)
-@TableName("schedule_job")
-public class ScheduleJobEntity extends BaseEntity {
-	private static final long serialVersionUID = 1L;
-
-	/**
-	 * spring bean名称
-	 */
-	private String beanName;
-	/**
-	 * 参数
-	 */
-	private String params;
-	/**
-	 * cron表达式
-	 */
-	private String cronExpression;
-	/**
-	 * 任务状态  0:暂停  1:正常
-	 */
-	private Integer status;
-	/**
-	 * 备注
-	 */
-	private String remark;
-	/**
-	 * 更新者
-	 */
-	@TableField(fill = FieldFill.INSERT_UPDATE)
-	private Long updater;
-	/**
-	 * 更新时间
-	 */
-	@TableField(fill = FieldFill.INSERT_UPDATE)
-	private Date updateDate;
-}
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/entity/ScheduleJobLogEntity.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/entity/ScheduleJobLogEntity.java
deleted file mode 100644
index 8fee21e..0000000
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/entity/ScheduleJobLogEntity.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Copyright (c) 2018 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package com.iailab.module.job.entity;
-
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * 定时任务日志
- *
- * @author Mark sunlightcs@gmail.com
- */
-@Data
-@TableName("schedule_job_log")
-public class ScheduleJobLogEntity implements Serializable {
-	private static final long serialVersionUID = 1L;
-
-	/**
-	 * id
-	 */
-	@TableId
-	private Long id;
-	/**
-	 * 任务id
-	 */
-	private Long jobId;
-	/**
-	 * spring bean名称
-	 */
-	private String beanName;
-	/**
-	 * 参数
-	 */
-	private String params;
-	/**
-	 * 任务状态    0:失败    1:成功
-	 */
-	private Integer status;
-	/**
-	 * 失败信息
-	 */
-	private String error;
-	/**
-	 * 耗时(单位:毫秒)
-	 */
-	private Integer times;
-	/**
-	 * 创建时间
-	 */
-	private Date createDate;
-
-}
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/init/JobCommandLineRunner.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/init/JobCommandLineRunner.java
deleted file mode 100644
index 76dd2c0..0000000
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/init/JobCommandLineRunner.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Copyright (c) 2018 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package com.iailab.module.job.init;
-
-import com.iailab.module.job.dao.ScheduleJobDao;
-import com.iailab.module.job.entity.ScheduleJobEntity;
-import com.iailab.module.job.utils.ScheduleUtils;
-import org.quartz.CronTrigger;
-import org.quartz.Scheduler;
-import javax.annotation.Resource;
-import org.springframework.boot.CommandLineRunner;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-
-/**
- * 初始化定时任务数据
- *
- * @author Mark sunlightcs@gmail.com
- */
-@Component
-public class JobCommandLineRunner implements CommandLineRunner {
-    @Resource
-    private Scheduler scheduler;
-    @Resource
-    private ScheduleJobDao scheduleJobDao;
-
-    @Override
-    public void run(String... args) {
-        List<ScheduleJobEntity> scheduleJobList = scheduleJobDao.selectList(null);
-        for(ScheduleJobEntity scheduleJob : scheduleJobList){
-            CronTrigger cronTrigger = ScheduleUtils.getCronTrigger(scheduler, scheduleJob.getId());
-            //如果不存在,则创建
-            if(cronTrigger == null) {
-                ScheduleUtils.createScheduleJob(scheduler, scheduleJob);
-            }else {
-                ScheduleUtils.updateScheduleJob(scheduler, scheduleJob);
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/service/ScheduleJobLogService.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/service/ScheduleJobLogService.java
deleted file mode 100644
index 85b899a..0000000
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/service/ScheduleJobLogService.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Copyright (c) 2018 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package com.iailab.module.job.service;
-
-import com.iailab.framework.common.page.PageData;
-import com.iailab.framework.common.service.BaseService;
-import com.iailab.module.job.dto.ScheduleJobLogDTO;
-import com.iailab.module.job.entity.ScheduleJobLogEntity;
-
-import java.util.Map;
-
-/**
- * 定时任务日志
- *
- * @author Mark sunlightcs@gmail.com
- */
-public interface ScheduleJobLogService extends BaseService<ScheduleJobLogEntity> {
-
-	PageData<ScheduleJobLogDTO> page(Map<String, Object> params);
-
-	ScheduleJobLogDTO get(Long id);
-}
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/service/ScheduleJobService.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/service/ScheduleJobService.java
deleted file mode 100644
index 5d1242f..0000000
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/service/ScheduleJobService.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Copyright (c) 2018 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package com.iailab.module.job.service;
-
-import com.iailab.framework.common.page.PageData;
-import com.iailab.framework.common.service.BaseService;
-import com.iailab.module.job.dto.ScheduleJobDTO;
-import com.iailab.module.job.entity.ScheduleJobEntity;
-
-import java.util.Map;
-
-/**
- * 定时任务
- *
- * @author Mark sunlightcs@gmail.com
- */
-public interface ScheduleJobService extends BaseService<ScheduleJobEntity> {
-
-	PageData<ScheduleJobDTO> page(Map<String, Object> params);
-
-	ScheduleJobDTO get(Long id);
-
-	/**
-	 * 保存定时任务
-	 */
-	void save(ScheduleJobDTO dto);
-	
-	/**
-	 * 更新定时任务
-	 */
-	void update(ScheduleJobDTO dto);
-	
-	/**
-	 * 批量删除定时任务
-	 */
-	void deleteBatch(Long[] ids);
-	
-	/**
-	 * 批量更新定时任务状态
-	 */
-	int updateBatch(Long[] ids, int status);
-	
-	/**
-	 * 立即执行
-	 */
-	void run(Long[] ids);
-	
-	/**
-	 * 暂停运行
-	 */
-	void pause(Long[] ids);
-	
-	/**
-	 * 恢复运行
-	 */
-	void resume(Long[] ids);
-}
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/service/impl/ScheduleJobLogServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/service/impl/ScheduleJobLogServiceImpl.java
deleted file mode 100644
index 5f0d220..0000000
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/service/impl/ScheduleJobLogServiceImpl.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Copyright (c) 2018 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package com.iailab.module.job.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.iailab.framework.common.constant.Constant;
-import com.iailab.framework.common.page.PageData;
-import com.iailab.framework.common.service.impl.BaseServiceImpl;
-import com.iailab.framework.common.util.object.ConvertUtils;
-import com.iailab.module.job.dao.ScheduleJobLogDao;
-import com.iailab.module.job.dto.ScheduleJobLogDTO;
-import com.iailab.module.job.entity.ScheduleJobLogEntity;
-import com.iailab.module.job.service.ScheduleJobLogService;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.stereotype.Service;
-
-import java.util.Map;
-
-@Service
-public class ScheduleJobLogServiceImpl extends BaseServiceImpl<ScheduleJobLogDao, ScheduleJobLogEntity> implements ScheduleJobLogService {
-
-	@Override
-	public PageData<ScheduleJobLogDTO> page(Map<String, Object> params) {
-		IPage<ScheduleJobLogEntity> page = baseDao.selectPage(
-			getPage(params, Constant.CREATE_DATE, false),
-			getWrapper(params)
-		);
-		return getPageData(page, ScheduleJobLogDTO.class);
-	}
-
-	private QueryWrapper<ScheduleJobLogEntity> getWrapper(Map<String, Object> params){
-		String jobId = (String)params.get("jobId");
-
-		QueryWrapper<ScheduleJobLogEntity> wrapper = new QueryWrapper<>();
-		wrapper.eq(StringUtils.isNotBlank(jobId), "job_id", jobId);
-
-		return wrapper;
-	}
-
-	@Override
-	public ScheduleJobLogDTO get(Long id) {
-		ScheduleJobLogEntity entity = baseDao.selectById(id);
-
-		return ConvertUtils.sourceToTarget(entity, ScheduleJobLogDTO.class);
-	}
-
-}
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/service/impl/ScheduleJobServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/service/impl/ScheduleJobServiceImpl.java
deleted file mode 100644
index 2cd5602..0000000
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/service/impl/ScheduleJobServiceImpl.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- * Copyright (c) 2018 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package com.iailab.module.job.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.iailab.framework.common.constant.Constant;
-import com.iailab.framework.common.page.PageData;
-import com.iailab.framework.common.service.impl.BaseServiceImpl;
-import com.iailab.framework.common.util.object.ConvertUtils;
-import com.iailab.module.job.dao.ScheduleJobDao;
-import com.iailab.module.job.dto.ScheduleJobDTO;
-import com.iailab.module.job.entity.ScheduleJobEntity;
-import com.iailab.module.job.service.ScheduleJobService;
-import com.iailab.module.job.utils.ScheduleUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.quartz.Scheduler;
-import javax.annotation.Resource;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-@Service
-public class ScheduleJobServiceImpl extends BaseServiceImpl<ScheduleJobDao, ScheduleJobEntity> implements ScheduleJobService {
-	@Resource
-	private Scheduler scheduler;
-
-	@Override
-	public PageData<ScheduleJobDTO> page(Map<String, Object> params) {
-		IPage<ScheduleJobEntity> page = baseDao.selectPage(
-			getPage(params, Constant.CREATE_DATE, false),
-			getWrapper(params)
-		);
-		return getPageData(page, ScheduleJobDTO.class);
-	}
-
-	@Override
-	public ScheduleJobDTO get(Long id) {
-		ScheduleJobEntity entity = baseDao.selectById(id);
-
-		return ConvertUtils.sourceToTarget(entity, ScheduleJobDTO.class);
-	}
-
-	private QueryWrapper<ScheduleJobEntity> getWrapper(Map<String, Object> params){
-		String beanName = (String)params.get("beanName");
-
-		QueryWrapper<ScheduleJobEntity> wrapper = new QueryWrapper<>();
-		wrapper.like(StringUtils.isNotBlank(beanName), "bean_name", beanName);
-
-		return wrapper;
-	}
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public void save(ScheduleJobDTO dto) {
-		ScheduleJobEntity entity = ConvertUtils.sourceToTarget(dto, ScheduleJobEntity.class);
-		entity.setCreateDate(new Date());
-		entity.setStatus(Constant.ScheduleStatus.NORMAL.getValue());
-        this.insert(entity);
-        
-        ScheduleUtils.createScheduleJob(scheduler, entity);
-    }
-	
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public void update(ScheduleJobDTO dto) {
-		ScheduleJobEntity entity = ConvertUtils.sourceToTarget(dto, ScheduleJobEntity.class);
-		entity.setUpdateDate(new Date());
-        ScheduleUtils.updateScheduleJob(scheduler, entity);
-                
-        this.updateById(entity);
-    }
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-    public void deleteBatch(Long[] ids) {
-    	for(Long id : ids){
-    		ScheduleUtils.deleteScheduleJob(scheduler, id);
-    	}
-    	
-    	//删除数据
-    	this.deleteBatchIds(Arrays.asList(ids));
-	}
-
-	@Override
-    public int updateBatch(Long[] ids, int status){
-    	Map<String, Object> map = new HashMap<>(2);
-    	map.put("ids", ids);
-    	map.put("status", status);
-    	return baseDao.updateBatch(map);
-    }
-    
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-    public void run(Long[] ids) {
-    	for(Long id : ids){
-    		ScheduleUtils.run(scheduler, this.selectById(id));
-    	}
-    }
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-    public void pause(Long[] ids) {
-        for(Long id : ids){
-    		ScheduleUtils.pauseJob(scheduler, id);
-    	}
-        
-    	updateBatch(ids, Constant.ScheduleStatus.PAUSE.getValue());
-    }
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-    public void resume(Long[] ids) {
-    	for(Long id : ids){
-    		ScheduleUtils.resumeJob(scheduler, id);
-    	}
-
-    	updateBatch(ids, Constant.ScheduleStatus.NORMAL.getValue());
-    }
-    
-}
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/task/ITask.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/task/ITask.java
deleted file mode 100644
index 345badb..0000000
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/task/ITask.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (c) 2018 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package com.iailab.module.job.task;
-
-/**
- * 定时任务接口,所有定时任务都要实现该接口
- *
- * @author Mark sunlightcs@gmail.com
- * @since 1.0.0
- */
-public interface ITask {
-
-    /**
-     * 执行定时任务接口
-     *
-     * @param params   参数,多参数使用JSON数据
-     */
-    void run(String params);
-}
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/utils/ScheduleJob.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/utils/ScheduleJob.java
deleted file mode 100644
index 91c497a..0000000
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/utils/ScheduleJob.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * Copyright (c) 2018 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package com.iailab.module.job.utils;
-
-import com.iailab.framework.common.constant.Constant;
-import com.iailab.framework.common.exception.ExceptionUtils;
-import com.iailab.framework.common.util.spring.SpringContextUtils;
-import com.iailab.module.job.entity.ScheduleJobEntity;
-import com.iailab.module.job.entity.ScheduleJobLogEntity;
-import org.quartz.JobExecutionContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.scheduling.quartz.QuartzJobBean;
-
-import java.lang.reflect.Method;
-import java.util.Date;
-
-
-/**
- * 定时任务
- *
- * @author Mark sunlightcs@gmail.com
- */
-public class ScheduleJob extends QuartzJobBean {
-	private Logger logger = LoggerFactory.getLogger(getClass());
-
-	@Override
-	protected void executeInternal(JobExecutionContext context) {
-		ScheduleJobEntity scheduleJob = (ScheduleJobEntity) context.getMergedJobDataMap().
-				get(ScheduleUtils.JOB_PARAM_KEY);
-
-		//数据库保存执行记录
-		ScheduleJobLogEntity log = new ScheduleJobLogEntity();
-		log.setJobId(scheduleJob.getId());
-		log.setBeanName(scheduleJob.getBeanName());
-		log.setParams(scheduleJob.getParams());
-		log.setCreateDate(new Date());
-
-		//任务开始时间
-		long startTime = System.currentTimeMillis();
-
-		try {
-			//执行任务
-			logger.info("任务准备执行,任务ID:{}", scheduleJob.getId());
-			Object target = SpringContextUtils.getBean(scheduleJob.getBeanName());
-			Method method = target.getClass().getDeclaredMethod("run", String.class);
-			method.invoke(target, scheduleJob.getParams());
-
-			//任务执行总时长
-			long times = System.currentTimeMillis() - startTime;
-			log.setTimes((int)times);
-			//任务状态
-			log.setStatus(Constant.SUCCESS);
-
-			logger.info("任务执行完毕,任务ID:{}  总共耗时:{} 毫秒", scheduleJob.getId(), times);
-		} catch (Exception e) {
-			logger.error("任务执行失败,任务ID:{}", scheduleJob.getId(), e);
-
-			//任务执行总时长
-			long times = System.currentTimeMillis() - startTime;
-			log.setTimes((int)times);
-
-			//任务状态
-			log.setStatus(Constant.FAIL);
-			log.setError(ExceptionUtils.getErrorStackTrace(e));
-		}finally {
-			//获取spring bean
-			/*ScheduleJobLogService scheduleJobLogService = SpringContextUtils.getBean(ScheduleJobLogService.class);
-			scheduleJobLogService.insert(log);*/
-		}
-	}
-}
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/utils/ScheduleUtils.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/utils/ScheduleUtils.java
deleted file mode 100644
index 49ac389..0000000
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/job/utils/ScheduleUtils.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/**
- * Copyright (c) 2018 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
-package com.iailab.module.job.utils;
-
-import com.iailab.framework.common.constant.Constant;
-import com.iailab.framework.common.enums.ErrorCode;
-import com.iailab.framework.common.exception.ServerException;
-import com.iailab.module.job.entity.ScheduleJobEntity;
-import org.quartz.*;
-
-/**
- * 定时任务工具类
- *
- * @author Mark sunlightcs@gmail.com
- */
-public class ScheduleUtils {
-    private final static String JOB_NAME = "TASK_";
-    /**
-     * 任务调度参数key
-     */
-    public static final String JOB_PARAM_KEY = "JOB_PARAM_KEY";
-
-    /**
-     * 获取触发器key
-     */
-    public static TriggerKey getTriggerKey(Long jobId) {
-        return TriggerKey.triggerKey(JOB_NAME + jobId);
-    }
-
-    /**
-     * 获取jobKey
-     */
-    public static JobKey getJobKey(Long jobId) {
-        return JobKey.jobKey(JOB_NAME + jobId);
-    }
-
-    /**
-     * 获取表达式触发器
-     */
-    public static CronTrigger getCronTrigger(Scheduler scheduler, Long jobId) {
-        try {
-            return (CronTrigger) scheduler.getTrigger(getTriggerKey(jobId));
-        } catch (SchedulerException e) {
-            throw new ServerException(ErrorCode.JOB_ERROR, e.getMessage());
-        }
-    }
-
-    /**
-     * 创建定时任务
-     */
-    public static void createScheduleJob(Scheduler scheduler, ScheduleJobEntity scheduleJob) {
-        try {
-            //构建job信息
-            JobDetail jobDetail = JobBuilder.newJob(ScheduleJob.class).withIdentity(getJobKey(scheduleJob.getId())).build();
-
-            //表达式调度构建器
-            CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression())
-                    .withMisfireHandlingInstructionDoNothing();
-
-            //按新的cronExpression表达式构建一个新的trigger
-            CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(scheduleJob.getId())).withSchedule(scheduleBuilder).build();
-
-            //放入参数,运行时的方法可以获取
-            jobDetail.getJobDataMap().put(JOB_PARAM_KEY, scheduleJob);
-
-            scheduler.scheduleJob(jobDetail, trigger);
-
-            //暂停任务
-            if(scheduleJob.getStatus() == Constant.ScheduleStatus.PAUSE.getValue()){
-                pauseJob(scheduler, scheduleJob.getId());
-            }
-        } catch (SchedulerException e) {
-            throw new ServerException(ErrorCode.JOB_ERROR, e.getMessage());
-        }
-    }
-
-    /**
-     * 更新定时任务
-     */
-    public static void updateScheduleJob(Scheduler scheduler, ScheduleJobEntity scheduleJob) {
-        try {
-            TriggerKey triggerKey = getTriggerKey(scheduleJob.getId());
-
-            //表达式调度构建器
-            CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression())
-                    .withMisfireHandlingInstructionDoNothing();
-
-            CronTrigger trigger = getCronTrigger(scheduler, scheduleJob.getId());
-
-            //按新的cronExpression表达式重新构建trigger
-            trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build();
-
-            //参数
-            trigger.getJobDataMap().put(JOB_PARAM_KEY, scheduleJob);
-
-            scheduler.rescheduleJob(triggerKey, trigger);
-
-            //暂停任务
-            if(scheduleJob.getStatus() == Constant.ScheduleStatus.PAUSE.getValue()){
-                pauseJob(scheduler, scheduleJob.getId());
-            }
-
-        } catch (SchedulerException e) {
-            throw new ServerException(ErrorCode.JOB_ERROR, e.getMessage());
-        }
-    }
-
-    /**
-     * 立即执行任务
-     */
-    public static void run(Scheduler scheduler, ScheduleJobEntity scheduleJob) {
-        try {
-            //参数
-            JobDataMap dataMap = new JobDataMap();
-            dataMap.put(JOB_PARAM_KEY, scheduleJob);
-
-            scheduler.triggerJob(getJobKey(scheduleJob.getId()), dataMap);
-        } catch (SchedulerException e) {
-            throw new ServerException(ErrorCode.JOB_ERROR, e.getMessage());
-        }
-    }
-
-    /**
-     * 暂停任务
-     */
-    public static void pauseJob(Scheduler scheduler, Long jobId) {
-        try {
-            scheduler.pauseJob(getJobKey(jobId));
-        } catch (SchedulerException e) {
-            throw new ServerException(ErrorCode.JOB_ERROR, e.getMessage());
-        }
-    }
-
-    /**
-     * 恢复任务
-     */
-    public static void resumeJob(Scheduler scheduler, Long jobId) {
-        try {
-            scheduler.resumeJob(getJobKey(jobId));
-        } catch (SchedulerException e) {
-            throw new ServerException(ErrorCode.JOB_ERROR, e.getMessage());
-        }
-    }
-
-    /**
-     * 删除定时任务
-     */
-    public static void deleteScheduleJob(Scheduler scheduler, Long jobId) {
-        try {
-            scheduler.deleteJob(getJobKey(jobId));
-        } catch (SchedulerException e) {
-            throw new ServerException(ErrorCode.JOB_ERROR, e.getMessage());
-        }
-    }
-}
\ No newline at end of file

--
Gitblit v1.9.3