From a63c400ff367e3cec30db6425a142d67dbaf158d Mon Sep 17 00:00:00 2001
From: liriming <1343021927@qq.com>
Date: 星期一, 02 十二月 2024 09:28:24 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dao/ScheduleJobLogDao.java                     |    2 
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/impl/ScheduleJobServiceImpl.java       |   53 ++--
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/controller/admin/ScheduleJobController.java    |   82 ++----
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/entity/ScheduleJobEntity.java                  |    5 
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/utils/ScheduleJob.java                         |   14 -
 shasteel-biz/src/main/java/com/iailab/module/shasteel/config/FeignTokenInterceptor.java                  |   41 +++
 shasteel-biz/pom.xml                                                                                     |   26 ++
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/impl/ScheduleJobLogServiceImpl.java    |   11 
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/ITask.java                                |    8 
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dto/ScheduleJobLogDTO.java                     |   19 -
 pom.xml                                                                                                  |    2 
 shasteel-biz/src/main/java/com/iailab/module/shasteel/util/token/IailabClient.java                       |  158 ++++++++++++++
 shasteel-biz/src/main/java/com/iailab/module/shasteel/util/SpringContextUtils.java                       |   47 ++++
 /dev/null                                                                                                |    1 
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/init/JobCommandLineRunner.java                 |    8 
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunPredictModuleTask.java                 |   45 ++++
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/ScheduleJobService.java                |   13 
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/entity/ScheduleJobLogEntity.java               |    5 
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/controller/admin/ScheduleJobLogController.java |   37 --
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/utils/ScheduleUtils.java                       |   15 
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dao/ScheduleJobDao.java                        |   17 -
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dto/ScheduleJobDTO.java                        |   30 --
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/ScheduleJobLogService.java             |   10 
 23 files changed, 402 insertions(+), 247 deletions(-)

diff --git a/pom.xml b/pom.xml
index c3ffb09..37b3502 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
         快速开发框架,默认基础system,data,model
     </description>
     <modules>
-        <module>shasteel-api</module>
+<!--        <module>shasteel-api</module>-->
         <module>shasteel-biz</module>
     </modules>
 
diff --git a/shasteel-biz/pom.xml b/shasteel-biz/pom.xml
index c16d8c6..0166a9e 100644
--- a/shasteel-biz/pom.xml
+++ b/shasteel-biz/pom.xml
@@ -19,14 +19,19 @@
     <dependencies>
 
         <!-- 依赖服务 -->
+<!--        <dependency>-->
+<!--            <groupId>com.iailab</groupId>-->
+<!--            <artifactId>shasteel-api</artifactId>-->
+<!--            <version>${revision}</version>-->
+<!--        </dependency>-->
         <dependency>
             <groupId>com.iailab</groupId>
-            <artifactId>shasteel-api</artifactId>
+            <artifactId>iailab-module-infra-api</artifactId>
             <version>${revision}</version>
         </dependency>
         <dependency>
             <groupId>com.iailab</groupId>
-            <artifactId>iailab-module-infra-api</artifactId>
+            <artifactId>iailab-module-model-api</artifactId>
             <version>${revision}</version>
         </dependency>
 
@@ -131,6 +136,23 @@
             <artifactId>tencentcloud-sdk-java-sms</artifactId> <!-- 短信(腾讯云) -->
         </dependency>
 
+        <!-- 定时任务 -->
+        <dependency>
+            <groupId>org.quartz-scheduler</groupId>
+            <artifactId>quartz</artifactId>
+            <version>2.3.2</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.mchange</groupId>
+                    <artifactId>c3p0</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.zaxxer</groupId>
+                    <artifactId>HikariCP-java6</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
 
         <dependency>
             <groupId>org.quartz-scheduler</groupId>
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/config/FeignTokenInterceptor.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/config/FeignTokenInterceptor.java
new file mode 100644
index 0000000..7a2bbbb
--- /dev/null
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/config/FeignTokenInterceptor.java
@@ -0,0 +1,41 @@
+package com.iailab.module.shasteel.config;
+
+import com.iailab.module.shasteel.util.token.IailabClient;
+import feign.RequestInterceptor;
+import feign.RequestTemplate;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.HttpHeaders;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+@Configuration
+public class FeignTokenInterceptor implements RequestInterceptor {
+
+    @Override
+    public void apply(RequestTemplate requestTemplate) {
+        // 从当前请求上下文中获取Token
+        String token = getTokenFromCurrentRequest();
+
+        if (token == null) {
+            // 如果没有获取到Token,从system-server中获取token
+            token = IailabClient.getToken();
+        }
+
+        if (token!= null) {
+            requestTemplate.header(HttpHeaders.AUTHORIZATION, token);
+        }
+
+        Long tenantId = IailabClient.getTenantId();
+        if (tenantId != null) {
+            requestTemplate.header("tenant-id", String.valueOf(tenantId));
+        }
+    }
+
+    private String getTokenFromCurrentRequest() {
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        if (attributes!= null) {
+            return attributes.getRequest().getHeader(HttpHeaders.AUTHORIZATION);
+        }
+        return null;
+    }
+}
\ No newline at end of file
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/admin/demo/DemoController.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/admin/demo/DemoController.java
deleted file mode 100644
index 0a83bdf..0000000
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/admin/demo/DemoController.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package com.iailab.module.shasteel.controller.admin.demo;
-
-import com.iailab.framework.apilog.core.annotation.ApiAccessLog;
-import com.iailab.framework.common.pojo.CommonResult;
-import com.iailab.framework.common.pojo.PageParam;
-import com.iailab.framework.common.pojo.PageResult;
-import com.iailab.framework.common.util.object.BeanUtils;
-import com.iailab.framework.excel.core.util.ExcelUtils;
-import com.iailab.module.shasteel.controller.admin.demo.vo.DemoPageReqVO;
-import com.iailab.module.shasteel.controller.admin.demo.vo.DemoRespVO;
-import com.iailab.module.shasteel.controller.admin.demo.vo.DemoSaveReqVO;
-import com.iailab.module.shasteel.dal.dataobject.demo.DemoDO;
-import com.iailab.module.shasteel.service.demo.DemoService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
-import javax.validation.Valid;
-import java.io.IOException;
-import java.util.List;
-
-import static com.iailab.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
-import static com.iailab.framework.common.pojo.CommonResult.success;
-
-@Tag(name = "管理后台 - 演示管理")
-@RestController
-@RequestMapping("/shasteel/demo")
-public class DemoController {
-
-    @Resource
-    private DemoService demoService;
-
-    @PostMapping("/create")
-    @Operation(summary = "创建演示")
-    @PreAuthorize("@ss.hasPermission('shasteel:demo:create')")
-    public CommonResult<Long> createDemo(@Valid @RequestBody DemoSaveReqVO createReqVO) {
-        return success(demoService.create(createReqVO));
-    }
-
-    @PutMapping("/update")
-    @Operation(summary = "更新演示")
-    @PreAuthorize("@ss.hasPermission('shasteel:demo:update')")
-    public CommonResult<Boolean> updateDemo(@Valid @RequestBody DemoSaveReqVO updateReqVO) {
-        demoService.update(updateReqVO);
-        return success(true);
-    }
-
-    @DeleteMapping("/delete")
-    @Operation(summary = "删除演示")
-    @Parameter(name = "id", description = "ID", required = true, example = "1024")
-    @PreAuthorize("@ss.hasPermission('shasteel:demo:delete')")
-    public CommonResult<Boolean> deleteDemo(@RequestParam("id") Long id) {
-        demoService.delete(id);
-        return success(true);
-    }
-
-    @GetMapping("/get")
-    @Operation(summary = "获得演示")
-    @Parameter(name = "id", description = "ID", required = true, example = "1024")
-    @PreAuthorize("@ss.hasPermission('shasteel:demo:query')")
-    public CommonResult<DemoRespVO> getTenant(@RequestParam("id") Long id) {
-        DemoDO data = demoService.getInfo(id);
-        return success(BeanUtils.toBean(data, DemoRespVO.class));
-    }
-
-    @GetMapping("/page")
-    @Operation(summary = "获得分页")
-    @PreAuthorize("@ss.hasPermission('shasteel:demo:query')")
-    public CommonResult<PageResult<DemoRespVO>> getTenantPage(@Valid DemoPageReqVO pageVO) {
-        PageResult<DemoDO> pageResult = demoService.getPage(pageVO);
-        return success(BeanUtils.toBean(pageResult, DemoRespVO.class));
-    }
-
-    @GetMapping("/export-excel")
-    @Operation(summary = "导出租户 Excel")
-    @PreAuthorize("@ss.hasPermission('system:tenant:export')")
-    @ApiAccessLog(operateType = EXPORT)
-    public void exportTenantExcel(@Valid DemoPageReqVO exportReqVO,
-                                  HttpServletResponse response) throws IOException {
-        exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
-        List<DemoDO> list = demoService.getPage(exportReqVO).getList();
-        // 导出 Excel
-        ExcelUtils.write(response, "租户.xls", "数据", DemoRespVO.class,
-                BeanUtils.toBean(list, DemoRespVO.class));
-    }
-}
\ No newline at end of file
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/admin/demo/vo/DemoPageReqVO.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/admin/demo/vo/DemoPageReqVO.java
deleted file mode 100644
index 38f6179..0000000
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/admin/demo/vo/DemoPageReqVO.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.iailab.module.shasteel.controller.admin.demo.vo;
-
-import com.iailab.framework.common.pojo.PageParam;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
-
-/**
- * @author PanZhibao
- * @Description
- * @createTime 2024年08月17日
- */
-@Schema(description = "管理后台 - 租户分页 Request VO")
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
-public class DemoPageReqVO extends PageParam {
-
-    private String code;
-
-    private String name;
-}
\ No newline at end of file
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/admin/demo/vo/DemoRespVO.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/admin/demo/vo/DemoRespVO.java
deleted file mode 100644
index 1adec10..0000000
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/admin/demo/vo/DemoRespVO.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.iailab.module.shasteel.controller.admin.demo.vo;
-
-import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
-import com.alibaba.excel.annotation.ExcelProperty;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import java.time.LocalDateTime;
-
-/**
- * @author PanZhibao
- * @Description
- * @createTime 2024年08月18日
- */
-@Schema(description = "管理后台 - 演示 Response VO")
-@Data
-@ExcelIgnoreUnannotated
-public class DemoRespVO {
-
-    @Schema(description = "演示编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
-    @ExcelProperty("演示编号")
-    private Long id;
-
-    @Schema(description = "演示编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "演示编号")
-    @ExcelProperty("演示编号")
-    private String code;
-
-    @Schema(description = "演示名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "演示名称")
-    @ExcelProperty("演示名称")
-    private String name;
-
-    @Schema(description = "演示图标", requiredMode = Schema.RequiredMode.REQUIRED, example = "演示图标")
-    @ExcelProperty("演示图标")
-    private String icon;
-
-    @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "排序")
-    @ExcelProperty("排序")
-    private Integer orderNum;
-
-    @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "状态")
-    @ExcelProperty("状态")
-    private Integer status;
-
-    @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "备注")
-    @ExcelProperty("备注")
-    private String remark;
-
-    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
-    @ExcelProperty("创建时间")
-    private LocalDateTime createTime;
-
-    @Schema(description = "演示菜单ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "演示菜单ID")
-    private Long appMenuId;
-
-    /**
-     * 演示类型(1-系统菜单, 2-演示菜单)
-     */
-    private Integer appType;
-}
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/admin/demo/vo/DemoSaveReqVO.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/admin/demo/vo/DemoSaveReqVO.java
deleted file mode 100644
index ba37943..0000000
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/admin/demo/vo/DemoSaveReqVO.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.iailab.module.shasteel.controller.admin.demo.vo;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import javax.validation.constraints.NotNull;
-
-/**
- * @author PanZhibao
- * @Description
- * @createTime 2024年08月17日
- */
-@Schema(description = "管理后台 - 演示创建/修改 Request VO")
-@Data
-public class DemoSaveReqVO {
-
-    @Schema(description = "ID")
-    private Long id;
-
-    @Schema(description = "演示编号", requiredMode = Schema.RequiredMode.REQUIRED)
-    @NotNull(message = "演示编号不能为空")
-    private String code;
-
-    @Schema(description = "演示名称", requiredMode = Schema.RequiredMode.REQUIRED)
-    @NotNull(message = "演示名称不能为空")
-    private String name;
-
-    @Schema(description = "演示图标", example = "")
-    private String icon;
-
-    @Schema(description = "排序", example = "")
-    private Integer orderNum;
-
-    @Schema(description = "状态", example = "")
-    private Integer status;
-
-    @Schema(description = "备注", example = "")
-    private String remark;
-}
\ No newline at end of file
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/admin/package-info.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/admin/package-info.java
deleted file mode 100644
index ed86623..0000000
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/admin/package-info.java
+++ /dev/null
@@ -1 +0,0 @@
-package com.iailab.module.shasteel.controller.admin;
\ No newline at end of file
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/app/ip/AppAreaController.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/app/ip/AppAreaController.java
deleted file mode 100644
index 19f676a..0000000
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/app/ip/AppAreaController.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.iailab.module.shasteel.controller.app.ip;
-
-import cn.hutool.core.lang.Assert;
-import com.iailab.framework.common.pojo.CommonResult;
-import com.iailab.framework.common.util.object.BeanUtils;
-import com.iailab.framework.ip.core.Area;
-import com.iailab.framework.ip.core.utils.AreaUtils;
-import com.iailab.module.shasteel.controller.app.ip.vo.AppAreaNodeRespVO;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-
-import static com.iailab.framework.common.pojo.CommonResult.success;
-
-@Tag(name = "用户 App - 地区")
-@RestController
-@RequestMapping("/system/area")
-@Validated
-public class AppAreaController {
-
-    @GetMapping("/tree")
-    @Operation(summary = "获得地区树")
-    public CommonResult<List<AppAreaNodeRespVO>> getAreaTree() {
-        Area area = AreaUtils.getArea(Area.ID_CHINA);
-        Assert.notNull(area, "获取不到中国");
-        return success(BeanUtils.toBean(area.getChildren(), AppAreaNodeRespVO.class));
-    }
-
-}
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/app/ip/vo/AppAreaNodeRespVO.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/app/ip/vo/AppAreaNodeRespVO.java
deleted file mode 100644
index 05f579c..0000000
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/app/ip/vo/AppAreaNodeRespVO.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.iailab.module.shasteel.controller.app.ip.vo;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-
-import java.util.List;
-
-@Schema(description = "用户 App - 地区节点 Response VO")
-@Data
-public class AppAreaNodeRespVO {
-
-    @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "110000")
-    private Integer id;
-
-    @Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "北京")
-    private String name;
-
-    /**
-     * 子节点
-     */
-    private List<AppAreaNodeRespVO> children;
-
-}
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/app/package-info.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/app/package-info.java
deleted file mode 100644
index 028f7df..0000000
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/app/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * 占位,避免 package 无法提交到 Git 仓库
- */
-package com.iailab.module.shasteel.controller.app;
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/package-info.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/package-info.java
deleted file mode 100644
index 4efb2a7..0000000
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/controller/package-info.java
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * 提供 RESTful API 给前端:
- * 1. admin 包:提供给管理后台 iailab-ui-admin 前端项目
- * 2. app 包:提供给用户 APP iailab-ui-app 前端项目,它的 Controller 和 VO 都要添加 App 前缀,用于和管理后台进行区分
- */
-package com.iailab.module.shasteel.controller;
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/dal/dataobject/demo/DemoDO.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/dal/dataobject/demo/DemoDO.java
deleted file mode 100644
index 0cadcfc..0000000
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/dal/dataobject/demo/DemoDO.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.iailab.module.shasteel.dal.dataobject.demo;
-
-import com.baomidou.mybatisplus.annotation.KeySequence;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.iailab.framework.tenant.core.db.TenantBaseDO;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-/**
- * 演示表
- *
- * @author Houzhongjian
- * @Description
- * @createTime 2024年09月05日
- */
-@TableName("demo")
-@KeySequence("demo_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class DemoDO extends TenantBaseDO {
-
-    public static final Long PARENT_ID_ROOT = 0L;
-
-    /**
-     * ID
-     */
-    @TableId
-    private Long id;
-
-    /**
-     * 编号
-     */
-    private String code;
-
-    /**
-     * 名称
-     */
-    private String name;
-
-
-    /**
-     * 图标
-     */
-    private String icon;
-
-    /**
-     * 排序
-     */
-    private Integer orderNum;
-
-    /**
-     * 状态
-     */
-    private Integer status;
-
-    /**
-     * 备注
-     */
-    private String remark;
-
-}
\ No newline at end of file
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/dal/dataobject/package-info.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/dal/dataobject/package-info.java
deleted file mode 100644
index 76a212b..0000000
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/dal/dataobject/package-info.java
+++ /dev/null
@@ -1 +0,0 @@
-package com.iailab.module.shasteel.dal.dataobject;
\ No newline at end of file
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/dal/mysql/demo/DemoMapper.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/dal/mysql/demo/DemoMapper.java
deleted file mode 100644
index 6fd8042..0000000
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/dal/mysql/demo/DemoMapper.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.iailab.module.shasteel.dal.mysql.demo;
-
-import com.iailab.framework.common.pojo.PageResult;
-import com.iailab.framework.mybatis.core.mapper.BaseMapperX;
-import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX;
-import com.iailab.module.shasteel.controller.admin.demo.vo.DemoPageReqVO;
-import com.iailab.module.shasteel.dal.dataobject.demo.DemoDO;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * @author Houzhongjian
- * @Description
- * @createTime 2024年09月05日
- */
-@Mapper
-public interface DemoMapper extends BaseMapperX<DemoDO> {
-
-    default PageResult<DemoDO> selectPage(DemoPageReqVO reqVO) {
-        return selectPage(reqVO, new LambdaQueryWrapperX<DemoDO>()
-                .likeIfPresent(DemoDO::getCode, reqVO.getCode())
-                .likeIfPresent(DemoDO::getName, reqVO.getName())
-                .orderByDesc(DemoDO::getId));
-    }
-}
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/dal/mysql/package-info.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/dal/mysql/package-info.java
deleted file mode 100644
index 4e7cb10..0000000
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/dal/mysql/package-info.java
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * DAL = Data Access Layer 数据访问层
- * 1. data object:数据对象
- * 2. redis:Redis 的 CRUD 操作
- * 3. mysql:MySQL 的 CRUD 操作
- *
- * 其中,MySQL 的表以 system_ 作为前缀
- */
-package com.iailab.module.shasteel.dal.mysql;
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/controller/admin/ScheduleJobController.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/controller/admin/ScheduleJobController.java
index d2e8659..02d59d2 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/controller/admin/ScheduleJobController.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/controller/admin/ScheduleJobController.java
@@ -1,24 +1,14 @@
 package com.iailab.module.shasteel.job.controller.admin;
 
+import com.iailab.framework.common.page.PageData;
 import com.iailab.framework.common.pojo.CommonResult;
-import com.iailab.framework.common.pojo.PageResult;
-import com.iailab.framework.common.util.object.BeanUtils;
-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.framework.tenant.core.context.TenantContextHolder;
 import com.iailab.module.shasteel.job.dto.ScheduleJobDTO;
-import com.iailab.module.shasteel.job.entity.ScheduleJobEntity;
 import com.iailab.module.shasteel.job.service.ScheduleJobService;
-import com.iailab.module.shasteel.job.vo.ScheduleJobReqVO;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
-import javax.annotation.Resource;
+import java.util.Map;
 
 import static com.iailab.framework.common.pojo.CommonResult.success;
 
@@ -29,89 +19,73 @@
  */
 @RestController
 @RequestMapping("/shasteel/job/schedule")
-@Tag(name = "定时任务")
 public class ScheduleJobController {
-	@Resource
+	@Autowired
 	private ScheduleJobService scheduleJobService;
 
 	@GetMapping("page")
-	@Operation(summary = "分页")
-	@PreAuthorize("@ss.hasPermission('shasteel:schedule:query')")
-	public CommonResult<PageResult<ScheduleJobDTO>> page(@Validated ScheduleJobReqVO reqVO){
-		reqVO.setTenantId(TenantContextHolder.getTenantId());
-		PageResult<ScheduleJobEntity> page = scheduleJobService.page(reqVO);
+	@PreAuthorize("@ss.hasPermission('shasteel:job:query')")
+	public CommonResult<PageData<ScheduleJobDTO>> page(@RequestParam Map<String, Object> params){
+		PageData<ScheduleJobDTO> page = scheduleJobService.page(params);
 
-		return success(BeanUtils.toBean(page, ScheduleJobDTO.class));
+		return success(page);
 	}
 
-	@GetMapping("info")
-	@Operation(summary = "信息")
-	@PreAuthorize("@ss.hasPermission('shasteel:schedule:query')")
-	public CommonResult<ScheduleJobDTO> info(@RequestParam("id") Long id){
+	@GetMapping("{id}")
+	@PreAuthorize("@ss.hasPermission('shasteel:job:query')")
+	public CommonResult<ScheduleJobDTO> info(@PathVariable("id") Long id){
 		ScheduleJobDTO schedule = scheduleJobService.get(id);
 		
-		return new CommonResult<ScheduleJobDTO>().setData(schedule);
+		return success(schedule);
 	}
 
-	@PostMapping("/create")
-	@Operation(summary = "保存")
-	@PreAuthorize("@ss.hasPermission('shasteel:schedule:create')")
+	@PostMapping
+	@PreAuthorize("@ss.hasPermission('shasteel:job:create')")
 	public CommonResult save(@RequestBody ScheduleJobDTO dto){
-		ValidationUtils.validate(dto, AddGroup.class, DefaultGroup.class);
-		
 		scheduleJobService.save(dto);
 		
-		return new CommonResult();
+		return success();
 	}
 
-	@PutMapping("/update")
-	@Operation(summary = "修改")
-	@PreAuthorize("@ss.hasPermission('shasteel:schedule:update')")
+	@PutMapping
+	@PreAuthorize("@ss.hasPermission('shasteel:job:update')")
 	public CommonResult update(@RequestBody ScheduleJobDTO dto){
-		ValidationUtils.validate(dto, UpdateGroup.class, DefaultGroup.class);
-				
 		scheduleJobService.update(dto);
 		
-		return new CommonResult();
+		return success();
 	}
 
-	@DeleteMapping("/delete")
-	@Operation(summary = "删除")
-	@PreAuthorize("@ss.hasPermission('shasteel:schedule:delete')")
-	public CommonResult delete(@RequestParam("id") Long id){
-		scheduleJobService.deleteBatch(id);
-		
-		return new CommonResult();
+	@DeleteMapping
+	@PreAuthorize("@ss.hasPermission('shasteel:job:delete')")
+	public CommonResult delete(@RequestParam Long id){
+		scheduleJobService.deleteById(id);
+
+		return success();
 	}
 
 	@PutMapping("/run")
-	@Operation(summary = "立即执行")
 	public CommonResult run(@RequestParam("id") Long id){
-		Long[] ids = new Long[1];
-		ids[0] = id;
-		scheduleJobService.run(ids);
+		scheduleJobService.run(id);
 		
-		return new CommonResult();
+		return success();
 	}
 
 	@PutMapping("/pause")
-	@Operation(summary = "暂停")
 	public CommonResult pause(@RequestParam("id") Long id){
 		Long[] ids = new Long[1];
 		ids[0] = id;
 		scheduleJobService.pause(ids);
 		
-		return new CommonResult();
+		return success();
 	}
 
 	@PutMapping("/resume")
-	@Operation(summary = "恢复")
 	public CommonResult resume(@RequestParam("id") Long id){
 		Long[] ids = new Long[1];
 		ids[0] = id;
 		scheduleJobService.resume(ids);
 		
-		return new CommonResult();
+		return success();
 	}
 
 }
\ No newline at end of file
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/controller/admin/ScheduleJobLogController.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/controller/admin/ScheduleJobLogController.java
index 7d9d0a4..794a205 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/controller/admin/ScheduleJobLogController.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/controller/admin/ScheduleJobLogController.java
@@ -1,27 +1,16 @@
-/**
- * Copyright (c) 2018 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
 package com.iailab.module.shasteel.job.controller.admin;
 
-import com.iailab.framework.common.constant.Constant;
 import com.iailab.framework.common.page.PageData;
 import com.iailab.framework.common.pojo.CommonResult;
 import com.iailab.module.shasteel.job.dto.ScheduleJobLogDTO;
 import com.iailab.module.shasteel.job.service.ScheduleJobLogService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.Parameters;
-import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
-import javax.annotation.Resource;
 import java.util.Map;
+
+import static com.iailab.framework.common.pojo.CommonResult.success;
 
 /**
  * 定时任务日志
@@ -29,34 +18,22 @@
  * @author Mark sunlightcs@gmail.com
  */
 @RestController
-@RequestMapping("/sys/scheduleLog")
-@Tag(name = "定时任务日志")
+@RequestMapping("/mcs/scheduleLog")
 public class ScheduleJobLogController {
-	@Resource
+	@Autowired
 	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('sys: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);
+		return success(page);
 	}
 
 	@GetMapping("{id}")
-	@Operation(summary = "信息")
-	@PreAuthorize("@ss.hasPermission('sys:schedule:log')")
 	public CommonResult<ScheduleJobLogDTO> info(@PathVariable("id") Long id){
 		ScheduleJobLogDTO log = scheduleJobLogService.get(id);
 		
-		return new CommonResult<ScheduleJobLogDTO>().setData(log);
+		return success(log);
 	}
 }
\ No newline at end of file
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dao/ScheduleJobDao.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dao/ScheduleJobDao.java
index 0792a00..bf7ca74 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dao/ScheduleJobDao.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dao/ScheduleJobDao.java
@@ -1,11 +1,7 @@
 package com.iailab.module.shasteel.job.dao;
 
-import com.baomidou.dynamic.datasource.annotation.Master;
-import com.iailab.framework.common.pojo.PageResult;
-import com.iailab.framework.mybatis.core.mapper.BaseMapperX;
-import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX;
+import com.iailab.framework.common.dao.BaseDao;
 import com.iailab.module.shasteel.job.entity.ScheduleJobEntity;
-import com.iailab.module.shasteel.job.vo.ScheduleJobReqVO;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.Map;
@@ -15,17 +11,8 @@
  *
  * @author Mark sunlightcs@gmail.com
  */
-@Master
 @Mapper
-public interface ScheduleJobDao extends BaseMapperX<ScheduleJobEntity> {
-
-	default PageResult<ScheduleJobEntity> selectPage(ScheduleJobReqVO reqVO) {
-		return selectPage(reqVO, new LambdaQueryWrapperX<ScheduleJobEntity>()
-				.likeIfPresent(ScheduleJobEntity::getBeanName, reqVO.getBeanName())
-				.eqIfPresent(ScheduleJobEntity::getTenantId, reqVO.getTenantId())
-				.orderByDesc(ScheduleJobEntity::getCreateDate));
-
-	}
+public interface ScheduleJobDao extends BaseDao<ScheduleJobEntity> {
 	
 	/**
 	 * 批量更新状态
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dao/ScheduleJobLogDao.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dao/ScheduleJobLogDao.java
index c31d870..439ade7 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dao/ScheduleJobLogDao.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dao/ScheduleJobLogDao.java
@@ -1,6 +1,5 @@
 package com.iailab.module.shasteel.job.dao;
 
-import com.baomidou.dynamic.datasource.annotation.Master;
 import com.iailab.framework.common.dao.BaseDao;
 import com.iailab.module.shasteel.job.entity.ScheduleJobLogEntity;
 import org.apache.ibatis.annotations.Mapper;
@@ -10,7 +9,6 @@
  *
  * @author Mark sunlightcs@gmail.com
  */
-@Master
 @Mapper
 public interface ScheduleJobLogDao extends BaseDao<ScheduleJobLogEntity> {
 	
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dto/ScheduleJobDTO.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dto/ScheduleJobDTO.java
index 42d5775..f5fb494 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dto/ScheduleJobDTO.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dto/ScheduleJobDTO.java
@@ -1,24 +1,7 @@
-/**
- * Copyright (c) 2018 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
 package com.iailab.module.shasteel.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 io.swagger.v3.oas.annotations.tags.Tag;
 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;
 
@@ -29,34 +12,21 @@
  * @since 1.0.0
  */
 @Data
-@Tag(name = "定时任务")
 public class ScheduleJobDTO implements Serializable {
     private static final long serialVersionUID = 1L;
 
-    @Schema(description = "id")
-    @Null(message="{id.null}", groups = AddGroup.class)
-    @NotNull(message="{id.require}", groups = UpdateGroup.class)
     private Long id;
 
-    @Schema(description = "spring bean名称")
-    @NotBlank(message = "{schedule.bean.require}", groups = DefaultGroup.class)
     private String beanName;
 
-    @Schema(description = "参数")
     private String params;
 
-    @Schema(description = "cron表达式")
-    @NotBlank(message = "{schedule.cron.require}", groups = DefaultGroup.class)
     private String cronExpression;
 
-    @Schema(description = "任务状态  0:暂停  1:正常")
     private Integer status;
 
-    @Schema(description = "备注")
     private String remark;
 
-    @Schema(description = "创建时间")
-    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
     private Date createDate;
 
 }
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dto/ScheduleJobLogDTO.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dto/ScheduleJobLogDTO.java
index ae3158b..9434e0e 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dto/ScheduleJobLogDTO.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/dto/ScheduleJobLogDTO.java
@@ -1,15 +1,5 @@
-/**
- * Copyright (c) 2018 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
 package com.iailab.module.shasteel.job.dto;
 
-import io.swagger.v3.oas.annotations.media.Schema;
-import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -22,32 +12,23 @@
  * @since 1.0.0
  */
 @Data
-@Tag(name = "定时任务日志")
 public class ScheduleJobLogDTO implements Serializable {
     private static final long serialVersionUID = 1L;
 
-    @Schema(description = "id")
     private Long id;
 
-    @Schema(description = "任务id")
     private Long jobId;
 
-    @Schema(description = "spring bean名称")
     private String beanName;
 
-    @Schema(description = "参数")
     private String params;
 
-    @Schema(description = "任务状态    0:失败    1:成功")
     private Integer status;
 
-    @Schema(description = "失败信息")
     private String error;
 
-    @Schema(description = "耗时(单位:毫秒)")
     private Integer times;
 
-    @Schema(description = "创建时间")
     private Date createDate;
 
 }
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/entity/ScheduleJobEntity.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/entity/ScheduleJobEntity.java
index 33050e6..1a3e020 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/entity/ScheduleJobEntity.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/entity/ScheduleJobEntity.java
@@ -50,9 +50,4 @@
 	 */
 	@TableField(fill = FieldFill.INSERT_UPDATE)
 	private Date updateDate;
-
-	/**
-	 * 多租户编号
-	 */
-	private Long tenantId;
 }
\ No newline at end of file
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/entity/ScheduleJobLogEntity.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/entity/ScheduleJobLogEntity.java
index d417cab..8f587c4 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/entity/ScheduleJobLogEntity.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/entity/ScheduleJobLogEntity.java
@@ -51,9 +51,4 @@
 	 */
 	private Date createDate;
 
-	/**
-	 * 多租户编号
-	 */
-	private Long tenantId;
-
 }
\ No newline at end of file
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/init/JobCommandLineRunner.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/init/JobCommandLineRunner.java
index e9f61e8..71d5694 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/init/JobCommandLineRunner.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/init/JobCommandLineRunner.java
@@ -6,20 +6,22 @@
 import com.iailab.module.shasteel.job.utils.ScheduleUtils;
 import org.quartz.CronTrigger;
 import org.quartz.Scheduler;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.CommandLineRunner;
 import org.springframework.stereotype.Component;
 
-import javax.annotation.Resource;
 import java.util.List;
 
 /**
  * 初始化定时任务数据
+ *
+ * @author Mark sunlightcs@gmail.com
  */
 @Component
 public class JobCommandLineRunner implements CommandLineRunner {
-    @Resource
+    @Autowired
     private Scheduler scheduler;
-    @Resource
+    @Autowired
     private ScheduleJobDao scheduleJobDao;
 
     @Override
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/ScheduleJobLogService.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/ScheduleJobLogService.java
index 73a0b95..9cb446a 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/ScheduleJobLogService.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/ScheduleJobLogService.java
@@ -1,18 +1,10 @@
-/**
- * Copyright (c) 2018 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
 package com.iailab.module.shasteel.job.service;
+
 
 import com.iailab.framework.common.page.PageData;
 import com.iailab.framework.common.service.BaseService;
 import com.iailab.module.shasteel.job.dto.ScheduleJobLogDTO;
 import com.iailab.module.shasteel.job.entity.ScheduleJobLogEntity;
-import com.iailab.module.shasteel.job.dto.ScheduleJobLogDTO;
 
 import java.util.Map;
 
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/ScheduleJobService.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/ScheduleJobService.java
index 12b5c29..9cb3dbf 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/ScheduleJobService.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/ScheduleJobService.java
@@ -1,20 +1,21 @@
 package com.iailab.module.shasteel.job.service;
 
-import com.iailab.framework.common.pojo.PageResult;
+
+import com.iailab.framework.common.page.PageData;
 import com.iailab.framework.common.service.BaseService;
 import com.iailab.module.shasteel.job.dto.ScheduleJobDTO;
 import com.iailab.module.shasteel.job.entity.ScheduleJobEntity;
-import com.iailab.module.shasteel.job.vo.ScheduleJobReqVO;
 
+import java.util.Map;
 
 /**
  * 定时任务
  *
  * @author Mark sunlightcs@gmail.com
  */
-public interface ScheduleJobService{
+public interface ScheduleJobService extends BaseService<ScheduleJobEntity> {
 
-	PageResult<ScheduleJobEntity> page(ScheduleJobReqVO reqVO);
+	PageData<ScheduleJobDTO> page(Map<String, Object> params);
 
 	ScheduleJobDTO get(Long id);
 
@@ -31,7 +32,7 @@
 	/**
 	 * 批量删除定时任务
 	 */
-	void deleteBatch(Long id);
+	void deleteBatch(Long[] ids);
 	
 	/**
 	 * 批量更新定时任务状态
@@ -41,7 +42,7 @@
 	/**
 	 * 立即执行
 	 */
-	void run(Long[] ids);
+	void run(Long id);
 	
 	/**
 	 * 暂停运行
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/impl/ScheduleJobLogServiceImpl.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/impl/ScheduleJobLogServiceImpl.java
index eb57384..4937e90 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/impl/ScheduleJobLogServiceImpl.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/impl/ScheduleJobLogServiceImpl.java
@@ -1,16 +1,7 @@
-/**
- * Copyright (c) 2018 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
 package com.iailab.module.shasteel.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;
@@ -29,7 +20,7 @@
 	@Override
 	public PageData<ScheduleJobLogDTO> page(Map<String, Object> params) {
 		IPage<ScheduleJobLogEntity> page = baseDao.selectPage(
-			getPage(params, Constant.CREATE_DATE, false),
+			getPage(params, "create_date", false),
 			getWrapper(params)
 		);
 		return getPageData(page, ScheduleJobLogDTO.class);
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/impl/ScheduleJobServiceImpl.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/impl/ScheduleJobServiceImpl.java
index ad9b2ad..53da04f 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/impl/ScheduleJobServiceImpl.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/service/impl/ScheduleJobServiceImpl.java
@@ -1,45 +1,45 @@
 package com.iailab.module.shasteel.job.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.iailab.framework.common.constant.Constant;
-import com.iailab.framework.common.pojo.PageResult;
+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.framework.security.core.util.SecurityFrameworkUtils;
-import com.iailab.framework.tenant.core.context.TenantContextHolder;
 import com.iailab.module.shasteel.job.dao.ScheduleJobDao;
 import com.iailab.module.shasteel.job.dto.ScheduleJobDTO;
 import com.iailab.module.shasteel.job.entity.ScheduleJobEntity;
 import com.iailab.module.shasteel.job.service.ScheduleJobService;
 import com.iailab.module.shasteel.job.utils.ScheduleUtils;
-import com.iailab.module.shasteel.job.vo.ScheduleJobReqVO;
 import org.apache.commons.lang3.StringUtils;
 import org.quartz.Scheduler;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import javax.annotation.Resource;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
 @Service
-public class ScheduleJobServiceImpl extends ServiceImpl<ScheduleJobDao, ScheduleJobEntity> implements ScheduleJobService {
-	@Resource
+public class ScheduleJobServiceImpl extends BaseServiceImpl<ScheduleJobDao, ScheduleJobEntity> implements ScheduleJobService {
+	@Autowired
 	private Scheduler scheduler;
 
-	@Resource
-	private ScheduleJobDao scheduleJobDao;
-
 	@Override
-	public PageResult<ScheduleJobEntity> page(ScheduleJobReqVO reqVO) {
-		return scheduleJobDao.selectPage(reqVO);
+	public PageData<ScheduleJobDTO> page(Map<String, Object> params) {
+		IPage<ScheduleJobEntity> page = baseDao.selectPage(
+			getPage(params, "create_date", false),
+			getWrapper(params)
+		);
+		return getPageData(page, ScheduleJobDTO.class);
 	}
 
 	@Override
 	public ScheduleJobDTO get(Long id) {
-		ScheduleJobEntity entity = scheduleJobDao.selectById(id);
+		ScheduleJobEntity entity = baseDao.selectById(id);
 
 		return ConvertUtils.sourceToTarget(entity, ScheduleJobDTO.class);
 	}
@@ -56,14 +56,12 @@
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public void save(ScheduleJobDTO dto) {
-		Long tenantId = TenantContextHolder.getRequiredTenantId();
 		ScheduleJobEntity entity = ConvertUtils.sourceToTarget(dto, ScheduleJobEntity.class);
 		entity.setId(System.currentTimeMillis());
-		entity.setStatus(Constant.ScheduleStatus.NORMAL.getValue());
-		entity.setTenantId(tenantId);
-		entity.setCreator(SecurityFrameworkUtils.getLoginUser().getId());
 		entity.setCreateDate(new Date());
-		scheduleJobDao.insert(entity);
+		entity.setCreator(SecurityFrameworkUtils.getLoginUser().getId());
+		entity.setStatus(Constant.ScheduleStatus.NORMAL.getValue());
+        this.insert(entity);
         
         ScheduleUtils.createScheduleJob(scheduler, entity);
     }
@@ -71,11 +69,9 @@
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public void update(ScheduleJobDTO dto) {
-		Long tenantId = TenantContextHolder.getRequiredTenantId();
 		ScheduleJobEntity entity = ConvertUtils.sourceToTarget(dto, ScheduleJobEntity.class);
 		entity.setUpdateDate(new Date());
 		entity.setUpdater(SecurityFrameworkUtils.getLoginUser().getId());
-		entity.setTenantId(tenantId);
         ScheduleUtils.updateScheduleJob(scheduler, entity);
                 
         this.updateById(entity);
@@ -83,10 +79,13 @@
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-    public void deleteBatch(Long id) {
-		ScheduleUtils.deleteScheduleJob(scheduler, id);
+    public void deleteBatch(Long[] ids) {
+    	for(Long id : ids){
+    		ScheduleUtils.deleteScheduleJob(scheduler, id);
+    	}
 
-		scheduleJobDao.deleteById(id);
+    	//删除数据
+    	this.deleteBatchIds(Arrays.asList(ids));
 	}
 
 	@Override
@@ -94,15 +93,13 @@
     	Map<String, Object> map = new HashMap<>(2);
     	map.put("ids", ids);
     	map.put("status", status);
-    	return scheduleJobDao.updateBatch(map);
+    	return baseDao.updateBatch(map);
     }
     
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-    public void run(Long[] ids) {
-    	for(Long id : ids){
-    		ScheduleUtils.run(scheduler, scheduleJobDao.selectById(id));
-    	}
+    public void run(Long id) {
+		ScheduleUtils.run(scheduler, this.selectById(id));
     }
 
 	@Override
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/ITask.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/ITask.java
index 6166e57..b694838 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/ITask.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/ITask.java
@@ -1,11 +1,3 @@
-/**
- * Copyright (c) 2018 人人开源 All rights reserved.
- *
- * https://www.renren.io
- *
- * 版权所有,侵权必究!
- */
-
 package com.iailab.module.shasteel.job.task;
 
 /**
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunPredictModuleTask.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunPredictModuleTask.java
new file mode 100644
index 0000000..f6e5f46
--- /dev/null
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunPredictModuleTask.java
@@ -0,0 +1,45 @@
+package com.iailab.module.shasteel.job.task;
+
+import com.iailab.module.model.api.mdk.MdkApi;
+import com.iailab.module.model.api.mdk.dto.MdkPredictReqDTO;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Calendar;
+
+/**
+ * 执行模块预测定时任务
+ *
+ */
+@Component("runPredictModuleTask")
+public class RunPredictModuleTask implements ITask {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    MdkApi mdkApi;
+
+
+    @Override
+    public void run(String params) {
+        logger.info("runPredictModuleTask定时任务正在执行,参数为:{}",params );
+        try {
+            Calendar calendar = Calendar.getInstance();
+            calendar.set(Calendar.SECOND,0);
+            calendar.set(Calendar.MILLISECOND,0);
+
+            MdkPredictReqDTO dto = new MdkPredictReqDTO();
+            dto.setPredictTime(calendar.getTime());
+            dto.setModuleType(params);
+            mdkApi.predictModule(dto);
+            logger.info(params + "模块预测完成");
+
+
+        } catch (Exception ex) {
+            logger.error("runPredictModuleTask运行异常");
+            ex.printStackTrace();
+        }
+        logger.info("runPredictModuleTask运行完成");
+    }
+}
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/utils/ScheduleJob.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/utils/ScheduleJob.java
index 2ced982..80626ad 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/utils/ScheduleJob.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/utils/ScheduleJob.java
@@ -2,11 +2,9 @@
 
 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.framework.tenant.core.context.TenantContextHolder;
 import com.iailab.module.shasteel.job.entity.ScheduleJobEntity;
 import com.iailab.module.shasteel.job.entity.ScheduleJobLogEntity;
-import com.iailab.module.shasteel.job.service.ScheduleJobLogService;
+import com.iailab.module.shasteel.util.SpringContextUtils;
 import org.quartz.DisallowConcurrentExecution;
 import org.quartz.JobExecutionContext;
 import org.slf4j.Logger;
@@ -31,18 +29,12 @@
         ScheduleJobEntity scheduleJob = (ScheduleJobEntity) context.getMergedJobDataMap().
 				get(ScheduleUtils.JOB_PARAM_KEY);
 
-        //设置当前租户
-		TenantContextHolder.setTenantId(scheduleJob.getTenantId());
-		Long tenantId = TenantContextHolder.getRequiredTenantId();
-
         //数据库保存执行记录
         ScheduleJobLogEntity log = new ScheduleJobLogEntity();
-		log.setId(System.currentTimeMillis());
         log.setJobId(scheduleJob.getId());
         log.setBeanName(scheduleJob.getBeanName());
         log.setParams(scheduleJob.getParams());
 		log.setCreateDate(new Date());
-		log.setTenantId(tenantId);
 
         //任务开始时间
         long startTime = System.currentTimeMillis();
@@ -73,8 +65,8 @@
 			log.setError(ExceptionUtils.getErrorStackTrace(e));
 		}finally {
 			//获取spring bean
-			ScheduleJobLogService scheduleJobLogService = SpringContextUtils.getBean(ScheduleJobLogService.class);
-			scheduleJobLogService.insert(log);
+			/*ScheduleJobLogService scheduleJobLogService = SpringContextUtils.getBean(ScheduleJobLogService.class);
+			scheduleJobLogService.insert(log);*/
 		}
     }
 }
\ No newline at end of file
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/utils/ScheduleUtils.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/utils/ScheduleUtils.java
index 4f1c9f0..0433c16 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/utils/ScheduleUtils.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/utils/ScheduleUtils.java
@@ -2,7 +2,6 @@
 
 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.shasteel.job.entity.ScheduleJobEntity;
 import org.quartz.*;
 
@@ -39,7 +38,7 @@
         try {
             return (CronTrigger) scheduler.getTrigger(getTriggerKey(jobId));
         } catch (SchedulerException e) {
-            throw new ServerException(ErrorCode.JOB_ERROR, e.getMessage());
+            throw new RuntimeException("获取表达式触发器异常", e);
         }
     }
 
@@ -68,7 +67,7 @@
             	pauseJob(scheduler, scheduleJob.getId());
             }
         } catch (SchedulerException e) {
-            throw new ServerException(ErrorCode.JOB_ERROR, e.getMessage());
+            throw new RuntimeException("创建定时任务异常", e);
         }
     }
     
@@ -99,7 +98,7 @@
             }
             
         } catch (SchedulerException e) {
-            throw new ServerException(ErrorCode.JOB_ERROR, e.getMessage());
+            throw new RuntimeException("更新定时任务异常", e);
         }
     }
 
@@ -114,7 +113,7 @@
         	
             scheduler.triggerJob(getJobKey(scheduleJob.getId()), dataMap);
         } catch (SchedulerException e) {
-            throw new ServerException(ErrorCode.JOB_ERROR, e.getMessage());
+            throw new RuntimeException("立即执行任务异常", e);
         }
     }
 
@@ -125,7 +124,7 @@
         try {
             scheduler.pauseJob(getJobKey(jobId));
         } catch (SchedulerException e) {
-            throw new ServerException(ErrorCode.JOB_ERROR, e.getMessage());
+            throw new RuntimeException("暂停任务异常", e);
         }
     }
 
@@ -136,7 +135,7 @@
         try {
             scheduler.resumeJob(getJobKey(jobId));
         } catch (SchedulerException e) {
-            throw new ServerException(ErrorCode.JOB_ERROR, e.getMessage());
+            throw new RuntimeException("恢复任务异常", e);
         }
     }
 
@@ -147,7 +146,7 @@
         try {
             scheduler.deleteJob(getJobKey(jobId));
         } catch (SchedulerException e) {
-            throw new ServerException(ErrorCode.JOB_ERROR, e.getMessage());
+            throw new RuntimeException("删除定时任务异常", e);
         }
     }
 }
\ No newline at end of file
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/service/demo/DemoService.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/service/demo/DemoService.java
deleted file mode 100644
index fc3d662..0000000
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/service/demo/DemoService.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.iailab.module.shasteel.service.demo;
-
-import com.iailab.framework.common.pojo.PageResult;
-import com.iailab.module.shasteel.controller.admin.demo.vo.DemoPageReqVO;
-import com.iailab.module.shasteel.controller.admin.demo.vo.DemoSaveReqVO;
-import com.iailab.module.shasteel.dal.dataobject.demo.DemoDO;
-
-/**
- * @author PanZhibao
- * @Description
- * @createTime 2024年08月17日
- */
-public interface DemoService {
-
-    Long create(DemoSaveReqVO createReqVO);
-
-    Long update(DemoSaveReqVO createReqVO);
-
-    void delete(Long id);
-
-    DemoDO getInfo(Long id);
-
-    PageResult<DemoDO> getPage(DemoPageReqVO pageReqVO);
-}
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/service/demo/DemoServiceImpl.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/service/demo/DemoServiceImpl.java
deleted file mode 100644
index 0cca8ef..0000000
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/service/demo/DemoServiceImpl.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.iailab.module.shasteel.service.demo;
-
-import com.iailab.framework.common.pojo.PageResult;
-import com.iailab.framework.common.util.object.BeanUtils;
-import com.iailab.module.shasteel.controller.admin.demo.vo.DemoPageReqVO;
-import com.iailab.module.shasteel.controller.admin.demo.vo.DemoSaveReqVO;
-import com.iailab.module.shasteel.dal.dataobject.demo.DemoDO;
-import com.iailab.module.shasteel.dal.mysql.demo.DemoMapper;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-
-/**
- * @author PanZhibao
- * @Description
- * @createTime 2024年08月17日
- */
-@Service
-@Slf4j
-public class DemoServiceImpl implements DemoService {
-
-    @Resource
-    private DemoMapper demoMapper;
-
-
-    @Override
-    public Long create(DemoSaveReqVO createReqVO) {
-        DemoDO demo = BeanUtils.toBean(createReqVO, DemoDO.class);
-        demoMapper.insert(demo);
-        return demo.getId();
-    }
-
-    @Override
-    public Long update(DemoSaveReqVO createReqVO) {
-        DemoDO demo = BeanUtils.toBean(createReqVO, DemoDO.class);
-        demoMapper.updateById(demo);
-        return demo.getId();
-    }
-
-    @Override
-    public void delete(Long id) {
-        demoMapper.deleteById(id);
-    }
-
-    @Override
-    public DemoDO getInfo(Long id) {
-        return demoMapper.selectById(id);
-    }
-
-    @Override
-    public PageResult<DemoDO> getPage(DemoPageReqVO pageReqVO) {
-        return demoMapper.selectPage(pageReqVO);
-    }
-
-}
\ No newline at end of file
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/service/package-info.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/service/package-info.java
deleted file mode 100644
index 781426d..0000000
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/service/package-info.java
+++ /dev/null
@@ -1 +0,0 @@
-package com.iailab.module.shasteel.service;
\ No newline at end of file
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/util/SpringContextUtils.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/util/SpringContextUtils.java
new file mode 100644
index 0000000..2208ef4
--- /dev/null
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/util/SpringContextUtils.java
@@ -0,0 +1,47 @@
+package com.iailab.module.shasteel.util;
+
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Component;
+
+/**
+ * Spring Context 工具类
+ * 
+ * @author Mark sunlightcs@gmail.com
+ */
+@Component
+public class SpringContextUtils implements ApplicationContextAware {
+	public static ApplicationContext applicationContext; 
+
+	@Override
+	public void setApplicationContext(ApplicationContext applicationContext)
+			throws BeansException {
+		SpringContextUtils.applicationContext = applicationContext;
+	}
+
+	public static Object getBean(String name) {
+		return applicationContext.getBean(name);
+	}
+
+	public static <T> T getBean(Class<T> requiredType) {
+		return applicationContext.getBean(requiredType);
+	}
+
+	public static <T> T getBean(String name, Class<T> requiredType) {
+		return applicationContext.getBean(name, requiredType);
+	}
+
+	public static boolean containsBean(String name) {
+		return applicationContext.containsBean(name);
+	}
+
+	public static boolean isSingleton(String name) {
+		return applicationContext.isSingleton(name);
+	}
+
+	public static Class<? extends Object> getType(String name) {
+		return applicationContext.getType(name);
+	}
+
+}
\ No newline at end of file
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/util/token/IailabClient.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/util/token/IailabClient.java
new file mode 100644
index 0000000..fe3fcc5
--- /dev/null
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/util/token/IailabClient.java
@@ -0,0 +1,158 @@
+package com.iailab.module.shasteel.util.token;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.util.Assert;
+import org.springframework.util.Base64Utils;
+import org.springframework.util.ObjectUtils;
+import org.springframework.web.client.RestTemplate;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Map;
+
+/**
+ * @author PanZhibao
+ * @Description
+ * @createTime 2024年11月21日
+ */
+@Slf4j
+public class IailabClient {
+
+    /**
+     * 平台地址
+     */
+    public static String BASE_URL;
+
+    /**
+     * 租户编号
+     */
+    public static Long TENANT_ID;
+
+    /**
+     * 客户端信息
+     */
+    private static String CLIENT_ID;
+    private static String CLIENT_SECRET;
+    private static String USERNAME;
+    private static String PASSWORD;
+    private static final String GRAND_TYPE = "password";
+    private static final String SCOPE = "user.read user.write";
+
+
+    private static final RestTemplate restTemplate = new RestTemplate();
+
+    // 鉴权token
+    public static String accessToken;
+    // 刷新token
+    public static String refreshToken;
+    // 鉴权token过期时间
+    public static Long expireTime;
+
+    private static final IailabClient iailabClient = new IailabClient();
+
+    private IailabClient() {
+//        BASE_URL = PlatApplicationContext.getProperty("iailab.baseUrl");
+//        TENANT_ID = Long.parseLong(PlatApplicationContext.getProperty("iailab.tenantId"));
+//        CLIENT_ID = PlatApplicationContext.getProperty("iailab.clientId");
+//        CLIENT_SECRET = PlatApplicationContext.getProperty("iailab.clientSecret");
+//        USERNAME = PlatApplicationContext.getProperty("iailab.username");
+//        PASSWORD = PlatApplicationContext.getProperty("iailab.password");
+
+        BASE_URL = "http://127.0.0.1:48080/admin-api/system";
+        TENANT_ID = 172L;
+        CLIENT_ID = "shasteel";
+        CLIENT_SECRET = "shasteel111111111111111";
+        USERNAME = "shasteel";
+        PASSWORD = "123456";
+    }
+
+    public static IailabClient getInstance() {
+        return iailabClient;
+    }
+
+    /**
+     * 用户名密码方式获取平台token
+     */
+    private static synchronized void authenticate() {
+        log.info("获取平台token");
+        // 1.1 构建请求头
+        HttpHeaders headers = new HttpHeaders();
+        addClientHeader(headers);
+        // 1.2 构建authenticate请求URL
+        String authenticateUrl = BASE_URL + "/oauth2/token?"
+                // 密码模式的参数
+                + "grant_type=" + GRAND_TYPE
+                + "&username=" + USERNAME
+                + "&password=" + PASSWORD
+                + "&scope=" + SCOPE;
+        // 2. 执行请求
+        ResponseEntity<Map<String, Object>> exchange = restTemplate.exchange(
+                authenticateUrl,
+                HttpMethod.POST,
+                new org.springframework.http.HttpEntity<>(headers),
+                new ParameterizedTypeReference<Map<String, Object>>() {
+                });
+        Assert.isTrue(exchange.getStatusCode().is2xxSuccessful(), "响应必须是 200 成功");
+        log.info(exchange.toString());
+        Map<String, Object> authMap = exchange.getBody();
+        accessToken = authMap.get("access_token").toString();
+        refreshToken = authMap.get("refresh_token").toString();
+        expireTime = Long.valueOf(authMap.get("expires_time").toString());
+    }
+
+    private static synchronized void refreshToken() {
+        log.info("刷新token");
+        // 1.1 构建请求头
+        HttpHeaders headers = new HttpHeaders();
+        addClientHeader(headers);
+        // 1.2 构建authenticate请求URL
+        String authenticateUrl = BASE_URL + "/system/auth/client-refresh-token?refreshToken=" + refreshToken
+                + "&clientId=" + CLIENT_ID;
+        // 2. 执行请求
+        ResponseEntity<Map<String, Object>> exchange = restTemplate.exchange(
+                authenticateUrl,
+                HttpMethod.POST,
+                new org.springframework.http.HttpEntity<>(headers),
+                new ParameterizedTypeReference<Map<String, Object>>() {
+                });
+        Assert.isTrue(exchange.getStatusCode().is2xxSuccessful(), "响应必须是 200 成功");
+        Map<String, Object> authMap = exchange.getBody();
+        //刷新token过期,重新获取token
+        if (!ObjectUtils.isEmpty(authMap.get("code"))) {
+            Integer code = Integer.valueOf(authMap.get("code").toString());
+            if (code == 401) {
+                authenticate();
+            }
+        } else {
+            accessToken = authMap.get("access_token").toString();
+            expireTime = Long.valueOf(authMap.get("expires_time").toString());
+        }
+    }
+
+    private static void addClientHeader(HttpHeaders headers) {
+        // client 拼接,需要 BASE64 编码
+        String client = CLIENT_ID + ":" + CLIENT_SECRET;
+        client = Base64Utils.encodeToString(client.getBytes(StandardCharsets.UTF_8));
+        headers.add("Authorization", "Basic " + client);
+        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+        headers.set("tenant-id", TENANT_ID.toString());
+    }
+
+    public static String getToken() {
+        //第一次请求或者token过期,需要重新获取token
+        if(ObjectUtils.isEmpty(IailabClient.accessToken)) {
+            IailabClient.authenticate();
+        } else if (IailabClient.expireTime < System.currentTimeMillis() / 1000) {
+            IailabClient.refreshToken();
+        }
+        
+        return accessToken;
+    }
+    public static Long getTenantId() {
+        return TENANT_ID;
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.3