| | |
| | | {
|
| | | "name": "ruoyi",
|
| | | "version": "2.1.0",
|
| | | "version": "2.2.0",
|
| | | "description": "è¥ä¾ç®¡çç³»ç»",
|
| | | "author": "è¥ä¾",
|
| | | "license": "MIT",
|
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // æ¥è¯¢å®æ¶ä»»å¡è°åº¦å表 |
| | | export function listJob(query) { |
| | | return request({ |
| | | url: '/monitor/job/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | // æ¥è¯¢å®æ¶ä»»å¡è°åº¦è¯¦ç» |
| | | export function getJob(jobId) { |
| | | return request({ |
| | | url: '/monitor/job/' + jobId, |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | // æ°å¢å®æ¶ä»»å¡è°åº¦ |
| | | export function addJob(data) { |
| | | return request({ |
| | | url: '/monitor/job', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // ä¿®æ¹å®æ¶ä»»å¡è°åº¦ |
| | | export function updateJob(data) { |
| | | return request({ |
| | | url: '/monitor/job', |
| | | method: 'put', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // å é¤å®æ¶ä»»å¡è°åº¦ |
| | | export function delJob(jobId) { |
| | | return request({ |
| | | url: '/monitor/job/' + jobId, |
| | | method: 'delete' |
| | | }) |
| | | } |
| | | |
| | | // 导åºå®æ¶ä»»å¡è°åº¦ |
| | | export function exportJob(query) { |
| | | return request({ |
| | | url: '/monitor/job/export', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | // ä»»å¡ç¶æä¿®æ¹ |
| | | export function changeJobStatus(jobId, status) { |
| | | const data = { |
| | | jobId, |
| | | status |
| | | } |
| | | return request({ |
| | | url: '/monitor/job/changeStatus', |
| | | method: 'put', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | |
| | | // 宿¶ä»»å¡ç«å³æ§è¡ä¸æ¬¡ |
| | | export function runJob(jobId, jobGroup) { |
| | | const data = { |
| | | jobId, |
| | | jobGroup |
| | | } |
| | | return request({ |
| | | url: '/monitor/job/run', |
| | | method: 'put', |
| | | data: data |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // æ¥è¯¢è°åº¦æ¥å¿å表 |
| | | export function listJobLog(query) { |
| | | return request({ |
| | | url: '/monitor/jobLog/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | // å é¤è°åº¦æ¥å¿ |
| | | export function delJobLog(jobLogId) { |
| | | return request({ |
| | | url: '/monitor/jobLog/' + jobLogId, |
| | | method: 'delete' |
| | | }) |
| | | } |
| | | |
| | | // æ¸
空è°åº¦æ¥å¿ |
| | | export function cleanJobLog() { |
| | | return request({ |
| | | url: '/monitor/jobLog/clean', |
| | | method: 'delete' |
| | | }) |
| | | } |
| | | |
| | | // 导åºè°åº¦æ¥å¿ |
| | | export function exportJobLog(query) { |
| | | return request({ |
| | | url: '/monitor/jobLog/export', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | |
| | | <template>
|
| | | <div v-if="isExternal" :style="styleExternalIcon" class="svg-external-icon svg-icon" v-on="$listeners" />
|
| | | <svg v-else :class="svgClass" aria-hidden="true" v-on="$listeners">
|
| | | <use :xlink:href="iconName" />
|
| | | <use :href="iconName" />
|
| | | </svg>
|
| | | </template>
|
| | |
|
| | |
| | | toLastView(visitedViews, view) {
|
| | | const latestView = visitedViews.slice(-1)[0]
|
| | | if (latestView) {
|
| | | this.$router.push(latestView)
|
| | | this.$router.push(latestView.fullPath)
|
| | | } else {
|
| | | // now the default is to redirect to the home page if there is no tags-view,
|
| | | // you can adjust it according to your needs.
|
| | |
| | | ]
|
| | | },
|
| | | {
|
| | | path: '/job',
|
| | | component: Layout,
|
| | | hidden: true,
|
| | | children: [
|
| | | {
|
| | | path: 'log',
|
| | | component: () => import('@/views/monitor/job/log'),
|
| | | name: 'JobLog',
|
| | | meta: { title: 'è°åº¦æ¥å¿' }
|
| | | }
|
| | | ]
|
| | | },
|
| | | {
|
| | | path: '/gen',
|
| | | component: Layout,
|
| | | hidden: true,
|
| | |
| | | }
|
| | | },
|
| | | DEL_CACHED_VIEW: (state, view) => {
|
| | | for (const i of state.cachedViews) {
|
| | | if (i === view.name) {
|
| | | const index = state.cachedViews.indexOf(i)
|
| | | state.cachedViews.splice(index, 1)
|
| | | break
|
| | | }
|
| | | }
|
| | | const index = state.cachedViews.indexOf(view.name)
|
| | | index > -1 && state.cachedViews.splice(index, 1)
|
| | | },
|
| | |
|
| | | DEL_OTHERS_VISITED_VIEWS: (state, view) => {
|
| | |
| | | })
|
| | | },
|
| | | DEL_OTHERS_CACHED_VIEWS: (state, view) => {
|
| | | for (const i of state.cachedViews) {
|
| | | if (i === view.name) {
|
| | | const index = state.cachedViews.indexOf(i)
|
| | | state.cachedViews = state.cachedViews.slice(index, index + 1)
|
| | | break
|
| | | }
|
| | | if (index > -1) {
|
| | | state.cachedViews = state.cachedViews.slice(index, index + 1)
|
| | | } else {
|
| | | state.cachedViews = []
|
| | | }
|
| | | },
|
| | |
|
| | |
| | | <template>
|
| | | <div class="app-container">
|
| | | 宿¶ä»»å¡
|
| | | <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
|
| | | <el-form-item label="ä»»å¡åç§°" prop="jobName">
|
| | | <el-input
|
| | | v-model="queryParams.jobName"
|
| | | placeholder="请è¾å
¥ä»»å¡åç§°"
|
| | | clearable
|
| | | size="small"
|
| | | @keyup.enter.native="handleQuery"
|
| | | />
|
| | | </el-form-item>
|
| | | <el-form-item label="ä»»å¡ç»å" prop="jobGroup">
|
| | | <el-select v-model="queryParams.jobGroup" placeholder="è¯·éæ©ä»»å¡ç»å" clearable size="small">
|
| | | <el-option
|
| | | v-for="dict in jobGroupOptions"
|
| | | :key="dict.dictValue"
|
| | | :label="dict.dictLabel"
|
| | | :value="dict.dictValue"
|
| | | />
|
| | | </el-select>
|
| | | </el-form-item>
|
| | | <el-form-item label="ä»»å¡ç¶æ" prop="status">
|
| | | <el-select v-model="queryParams.status" placeholder="è¯·éæ©ä»»å¡ç¶æ" clearable size="small">
|
| | | <el-option
|
| | | v-for="dict in statusOptions"
|
| | | :key="dict.dictValue"
|
| | | :label="dict.dictLabel"
|
| | | :value="dict.dictValue"
|
| | | />
|
| | | </el-select>
|
| | | </el-form-item>
|
| | | <el-form-item>
|
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">æç´¢</el-button>
|
| | | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">éç½®</el-button>
|
| | | </el-form-item>
|
| | | </el-form>
|
| | |
|
| | | <el-row :gutter="10" class="mb8">
|
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="primary"
|
| | | icon="el-icon-plus"
|
| | | size="mini"
|
| | | @click="handleAdd"
|
| | | v-hasPermi="['monitor:job:add']"
|
| | | >æ°å¢</el-button>
|
| | | </el-col>
|
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="success"
|
| | | icon="el-icon-edit"
|
| | | size="mini"
|
| | | :disabled="single"
|
| | | @click="handleUpdate"
|
| | | v-hasPermi="['monitor:job:edit']"
|
| | | >ä¿®æ¹</el-button>
|
| | | </el-col>
|
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="danger"
|
| | | icon="el-icon-delete"
|
| | | size="mini"
|
| | | :disabled="multiple"
|
| | | @click="handleDelete"
|
| | | v-hasPermi="['monitor:job:remove']"
|
| | | >å é¤</el-button>
|
| | | </el-col>
|
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="warning"
|
| | | icon="el-icon-download"
|
| | | size="mini"
|
| | | @click="handleExport"
|
| | | v-hasPermi="['monitor:job:export']"
|
| | | >导åº</el-button>
|
| | | </el-col>
|
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="info"
|
| | | icon="el-icon-s-operation"
|
| | | size="mini"
|
| | | @click="handleJobLog"
|
| | | v-hasPermi="['monitor:job:query']"
|
| | | >æ¥å¿</el-button>
|
| | | </el-col>
|
| | | </el-row>
|
| | |
|
| | | <el-table v-loading="loading" :data="jobList" @selection-change="handleSelectionChange">
|
| | | <el-table-column type="selection" width="55" align="center" />
|
| | | <el-table-column label="ä»»å¡ç¼å·" align="center" prop="jobId" />
|
| | | <el-table-column label="ä»»å¡åç§°" align="center" prop="jobName" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="ä»»å¡ç»å" align="center" prop="jobGroup" :formatter="jobGroupFormat" />
|
| | | <el-table-column label="è°ç¨ç®æ å符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="cronæ§è¡è¡¨è¾¾å¼" align="center" prop="cronExpression" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="ç¶æ" align="center">
|
| | | <template slot-scope="scope">
|
| | | <el-switch
|
| | | v-model="scope.row.status"
|
| | | active-value="0"
|
| | | inactive-value="1"
|
| | | @change="handleStatusChange(scope.row)"
|
| | | ></el-switch>
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column label="æä½" align="center" class-name="small-padding fixed-width">
|
| | | <template slot-scope="scope">
|
| | | <el-button
|
| | | size="mini"
|
| | | type="text"
|
| | | icon="el-icon-caret-right"
|
| | | @click="handleRun(scope.row)"
|
| | | v-hasPermi="['monitor:job:edit']"
|
| | | >æ§è¡ä¸æ¬¡</el-button>
|
| | | <el-button
|
| | | size="mini"
|
| | | type="text"
|
| | | icon="el-icon-view"
|
| | | @click="handleView(scope.row)"
|
| | | v-hasPermi="['monitor:job:query']"
|
| | | >详ç»</el-button>
|
| | | </template>
|
| | | </el-table-column>
|
| | | </el-table>
|
| | |
|
| | | <pagination
|
| | | v-show="total>0"
|
| | | :total="total"
|
| | | :page.sync="queryParams.pageNum"
|
| | | :limit.sync="queryParams.pageSize"
|
| | | @pagination="getList"
|
| | | />
|
| | |
|
| | | <!-- æ·»å æä¿®æ¹å®æ¶ä»»å¡å¯¹è¯æ¡ -->
|
| | | <el-dialog :title="title" :visible.sync="open" width="700px">
|
| | | <el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
| | | <el-row>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="ä»»å¡åç§°" prop="jobName">
|
| | | <el-input v-model="form.jobName" placeholder="请è¾å
¥ä»»å¡åç§°" />
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="ä»»å¡åç»" prop="jobGroup">
|
| | | <el-select v-model="form.jobGroup" placeholder="è¯·éæ©">
|
| | | <el-option
|
| | | v-for="dict in jobGroupOptions"
|
| | | :key="dict.dictValue"
|
| | | :label="dict.dictLabel"
|
| | | :value="dict.dictValue"
|
| | | ></el-option>
|
| | | </el-select>
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="24">
|
| | | <el-form-item prop="invokeTarget">
|
| | | <span slot="label">
|
| | | è°ç¨æ¹æ³
|
| | | <el-tooltip placement="top">
|
| | | <div slot="content">
|
| | | Beanè°ç¨ç¤ºä¾ï¼ryTask.ryParams('ry')
|
| | | <br />Classç±»è°ç¨ç¤ºä¾ï¼com.ruoyi.quartz.task.RyTask.ryParams('ry')
|
| | | <br />åæ°è¯´æï¼æ¯æå符串ï¼å¸å°ç±»åï¼é¿æ´åï¼æµ®ç¹åï¼æ´å
|
| | | </div>
|
| | | <i class="el-icon-question"></i>
|
| | | </el-tooltip>
|
| | | </span>
|
| | | <el-input v-model="form.invokeTarget" placeholder="请è¾å
¥è°ç¨ç®æ å符串" />
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="cron表达å¼" prop="cronExpression">
|
| | | <el-input v-model="form.cronExpression" placeholder="请è¾å
¥cronæ§è¡è¡¨è¾¾å¼" />
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="æ¯å¦å¹¶å" prop="concurrent">
|
| | | <el-radio-group v-model="form.concurrent" size="small">
|
| | | <el-radio-button label="0">å
许</el-radio-button>
|
| | | <el-radio-button label="1">ç¦æ¢</el-radio-button>
|
| | | </el-radio-group>
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="24">
|
| | | <el-form-item label="é误çç¥" prop="misfirePolicy">
|
| | | <el-radio-group v-model="form.misfirePolicy" size="small">
|
| | | <el-radio-button label="1">ç«å³æ§è¡</el-radio-button>
|
| | | <el-radio-button label="2">æ§è¡ä¸æ¬¡</el-radio-button>
|
| | | <el-radio-button label="3">æ¾å¼æ§è¡</el-radio-button>
|
| | | </el-radio-group>
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="24">
|
| | | <el-form-item label="ç¶æ">
|
| | | <el-radio-group v-model="form.status">
|
| | | <el-radio
|
| | | v-for="dict in statusOptions"
|
| | | :key="dict.dictValue"
|
| | | :label="dict.dictValue"
|
| | | >{{dict.dictLabel}}</el-radio>
|
| | | </el-radio-group>
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | </el-row>
|
| | | </el-form>
|
| | | <div slot="footer" class="dialog-footer">
|
| | | <el-button type="primary" @click="submitForm">ç¡® å®</el-button>
|
| | | <el-button @click="cancel">å æ¶</el-button>
|
| | | </div>
|
| | | </el-dialog>
|
| | |
|
| | | <!-- 任塿¥å¿è¯¦ç» -->
|
| | | <el-dialog title="ä»»å¡è¯¦ç»" :visible.sync="openView" width="700px">
|
| | | <el-form ref="form" :model="form" label-width="120px" size="mini">
|
| | | <el-row>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="ä»»å¡ç¼å·ï¼">{{ form.jobId }}</el-form-item>
|
| | | <el-form-item label="ä»»å¡åç§°ï¼">{{ form.jobName }}</el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="ä»»å¡åç»ï¼">{{ jobGroupFormat(form) }}</el-form-item>
|
| | | <el-form-item label="å建æ¶é´ï¼">{{ form.createTime }}</el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="cron表达å¼ï¼">{{ form.cronExpression }}</el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="䏿¬¡æ§è¡æ¶é´ï¼">{{ parseTime(form.nextValidTime) }}</el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="24">
|
| | | <el-form-item label="è°ç¨ç®æ æ¹æ³ï¼">{{ form.invokeTarget }}</el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="ä»»å¡ç¶æï¼">
|
| | | <div v-if="form.status == 0">æ£å¸¸</div>
|
| | | <div v-else-if="form.status == 1">失败</div>
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="æ¯å¦å¹¶åï¼">
|
| | | <div v-if="form.status == 0">å
许</div>
|
| | | <div v-else-if="form.status == 1">ç¦æ¢</div>
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="æ§è¡çç¥ï¼">
|
| | | <div v-if="form.misfirePolicy == 0">é»è®¤çç¥</div>
|
| | | <div v-else-if="form.misfirePolicy == 1">ç«å³æ§è¡</div>
|
| | | <div v-else-if="form.misfirePolicy == 2">æ§è¡ä¸æ¬¡</div>
|
| | | <div v-else-if="form.misfirePolicy == 3">æ¾å¼æ§è¡</div>
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | </el-row>
|
| | | </el-form>
|
| | | <div slot="footer" class="dialog-footer">
|
| | | <el-button @click="openView = false">å
³ é</el-button>
|
| | | </div>
|
| | | </el-dialog>
|
| | | </div>
|
| | | </template> |
| | | </template>
|
| | |
|
| | | <script>
|
| | | import { listJob, getJob, delJob, addJob, updateJob, exportJob, runJob, changeJobStatus } from "@/api/monitor/job";
|
| | |
|
| | | export default {
|
| | | name: "Job",
|
| | | data() {
|
| | | return {
|
| | | // é®ç½©å±
|
| | | loading: true,
|
| | | // é䏿°ç»
|
| | | ids: [],
|
| | | // éå个ç¦ç¨
|
| | | single: true,
|
| | | // éå¤ä¸ªç¦ç¨
|
| | | multiple: true,
|
| | | // æ»æ¡æ°
|
| | | total: 0,
|
| | | // 宿¶ä»»å¡è¡¨æ ¼æ°æ®
|
| | | jobList: [],
|
| | | // å¼¹åºå±æ é¢
|
| | | title: "",
|
| | | // æ¯å¦æ¾ç¤ºå¼¹åºå±
|
| | | open: false,
|
| | | // æ¯å¦æ¾ç¤ºè¯¦ç»å¼¹åºå±
|
| | | openView: false,
|
| | | // ä»»å¡ç»ååå
¸
|
| | | jobGroupOptions: [],
|
| | | // ç¶æåå
¸
|
| | | statusOptions: [],
|
| | | // æ¥è¯¢åæ°
|
| | | queryParams: {
|
| | | pageNum: 1,
|
| | | pageSize: 10,
|
| | | jobName: undefined,
|
| | | jobGroup: undefined,
|
| | | status: undefined
|
| | | },
|
| | | // 表ååæ°
|
| | | form: {},
|
| | | // è¡¨åæ ¡éª
|
| | | rules: {
|
| | | jobName: [
|
| | | { required: true, message: "ä»»å¡åç§°ä¸è½ä¸ºç©º", trigger: "blur" }
|
| | | ],
|
| | | invokeTarget: [
|
| | | { required: true, message: "è°ç¨ç®æ å符串ä¸è½ä¸ºç©º", trigger: "blur" }
|
| | | ],
|
| | | cronExpression: [
|
| | | { required: true, message: "cronæ§è¡è¡¨è¾¾å¼ä¸è½ä¸ºç©º", trigger: "blur" }
|
| | | ]
|
| | | }
|
| | | };
|
| | | },
|
| | | created() {
|
| | | this.getList();
|
| | | this.getDicts("sys_job_group").then(response => {
|
| | | this.jobGroupOptions = response.data;
|
| | | });
|
| | | this.getDicts("sys_job_status").then(response => {
|
| | | this.statusOptions = response.data;
|
| | | });
|
| | | },
|
| | | methods: {
|
| | | /** æ¥è¯¢å®æ¶ä»»å¡å表 */
|
| | | getList() {
|
| | | this.loading = true;
|
| | | listJob(this.queryParams).then(response => {
|
| | | this.jobList = response.rows;
|
| | | this.total = response.total;
|
| | | this.loading = false;
|
| | | });
|
| | | },
|
| | | // ä»»å¡ç»ååå
¸ç¿»è¯
|
| | | jobGroupFormat(row, column) {
|
| | | return this.selectDictLabel(this.jobGroupOptions, row.jobGroup);
|
| | | },
|
| | | // ç¶æåå
¸ç¿»è¯
|
| | | statusFormat(row, column) {
|
| | | return this.selectDictLabel(this.statusOptions, row.status);
|
| | | },
|
| | | // åæ¶æé®
|
| | | cancel() {
|
| | | this.open = false;
|
| | | this.reset();
|
| | | },
|
| | | // 表åéç½®
|
| | | reset() {
|
| | | this.form = {
|
| | | jobId: undefined,
|
| | | jobName: undefined,
|
| | | jobGroup: undefined,
|
| | | invokeTarget: undefined,
|
| | | cronExpression: undefined,
|
| | | misfirePolicy: 1,
|
| | | concurrent: 1,
|
| | | status: "0"
|
| | | };
|
| | | this.resetForm("form");
|
| | | },
|
| | | /** æç´¢æé®æä½ */
|
| | | handleQuery() {
|
| | | this.queryParams.pageNum = 1;
|
| | | this.getList();
|
| | | },
|
| | | /** éç½®æé®æä½ */
|
| | | resetQuery() {
|
| | | this.resetForm("queryForm");
|
| | | this.handleQuery();
|
| | | },
|
| | | // å¤éæ¡é䏿°æ®
|
| | | handleSelectionChange(selection) {
|
| | | this.ids = selection.map(item => item.jobId);
|
| | | this.single = selection.length != 1;
|
| | | this.multiple = !selection.length;
|
| | | },
|
| | | // ä»»å¡ç¶æä¿®æ¹
|
| | | handleStatusChange(row) {
|
| | | let text = row.status === "0" ? "å¯ç¨" : "åç¨";
|
| | | this.$confirm('确认è¦"' + text + '""' + row.jobName + '"ä»»å¡å?', "è¦å", {
|
| | | confirmButtonText: "ç¡®å®",
|
| | | cancelButtonText: "åæ¶",
|
| | | type: "warning"
|
| | | }).then(function() {
|
| | | return changeJobStatus(row.jobId, row.status);
|
| | | }).then(() => {
|
| | | this.msgSuccess(text + "æå");
|
| | | }).catch(function() {
|
| | | row.status = row.status === "0" ? "1" : "0";
|
| | | });
|
| | | },
|
| | | /* ç«å³æ§è¡ä¸æ¬¡ */
|
| | | handleRun(row) {
|
| | | this.$confirm('确认è¦ç«å³æ§è¡ä¸æ¬¡"' + row.jobName + '"ä»»å¡å?', "è¦å", {
|
| | | confirmButtonText: "ç¡®å®",
|
| | | cancelButtonText: "åæ¶",
|
| | | type: "warning"
|
| | | }).then(function() {
|
| | | return runJob(row.jobId, row.jobGroup);
|
| | | }).then(function() {
|
| | | this.msgSuccess("æ§è¡æå");
|
| | | }).catch(function() {});
|
| | | },
|
| | | /** ä»»å¡è¯¦ç»ä¿¡æ¯ */
|
| | | handleView(row) {
|
| | | getJob(row.jobId).then(response => {
|
| | | this.form = response.data;
|
| | | this.openView = true;
|
| | | });
|
| | | },
|
| | | /** 任塿¥å¿å表æ¥è¯¢ */
|
| | | handleJobLog() {
|
| | | this.$router.push("/job/log");
|
| | | },
|
| | | /** æ°å¢æé®æä½ */
|
| | | handleAdd() {
|
| | | this.reset();
|
| | | this.open = true;
|
| | | this.title = "æ·»å ä»»å¡";
|
| | | },
|
| | | /** ä¿®æ¹æé®æä½ */
|
| | | handleUpdate(row) {
|
| | | this.reset();
|
| | | const jobId = row.jobId || this.ids;
|
| | | getJob(jobId).then(response => {
|
| | | this.form = response.data;
|
| | | this.open = true;
|
| | | this.title = "ä¿®æ¹ä»»å¡";
|
| | | });
|
| | | },
|
| | | /** æäº¤æé® */
|
| | | submitForm: function() {
|
| | | this.$refs["form"].validate(valid => {
|
| | | if (valid) {
|
| | | if (this.form.jobId != undefined) {
|
| | | updateJob(this.form).then(response => {
|
| | | if (response.code === 200) {
|
| | | this.msgSuccess("ä¿®æ¹æå");
|
| | | this.open = false;
|
| | | this.getList();
|
| | | } else {
|
| | | this.msgError(response.msg);
|
| | | }
|
| | | });
|
| | | } else {
|
| | | addJob(this.form).then(response => {
|
| | | if (response.code === 200) {
|
| | | this.msgSuccess("æ°å¢æå");
|
| | | this.open = false;
|
| | | this.getList();
|
| | | } else {
|
| | | this.msgError(response.msg);
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | | });
|
| | | },
|
| | | /** å é¤æé®æä½ */
|
| | | handleDelete(row) {
|
| | | const jobIds = row.jobId || this.ids;
|
| | | this.$confirm('æ¯å¦ç¡®è®¤å é¤å®æ¶ä»»å¡ç¼å·ä¸º"' + jobIds + '"çæ°æ®é¡¹?', "è¦å", {
|
| | | confirmButtonText: "ç¡®å®",
|
| | | cancelButtonText: "åæ¶",
|
| | | type: "warning"
|
| | | }).then(function() {
|
| | | return delJob(jobIds);
|
| | | }).then(() => {
|
| | | this.getList();
|
| | | this.msgSuccess("å 餿å");
|
| | | }).catch(function() {});
|
| | | },
|
| | | /** å¯¼åºæé®æä½ */
|
| | | handleExport() {
|
| | | const queryParams = this.queryParams;
|
| | | this.$confirm("æ¯å¦ç¡®è®¤å¯¼åºææå®æ¶ä»»å¡æ°æ®é¡¹?", "è¦å", {
|
| | | confirmButtonText: "ç¡®å®",
|
| | | cancelButtonText: "åæ¶",
|
| | | type: "warning"
|
| | | }).then(function() {
|
| | | return exportJob(queryParams);
|
| | | }).then(response => {
|
| | | this.download(response.msg);
|
| | | }).catch(function() {});
|
| | | }
|
| | | }
|
| | | };
|
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> |
| | | <el-form-item label="ä»»å¡åç§°" prop="jobName"> |
| | | <el-input |
| | | v-model="queryParams.jobName" |
| | | placeholder="请è¾å
¥ä»»å¡åç§°" |
| | | clearable |
| | | size="small" |
| | | style="width: 240px" |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="ä»»å¡ç»å" prop="jobGroup"> |
| | | <el-select |
| | | v-model="queryParams.jobGroup" |
| | | placeholder="请任å¡ç»å" |
| | | clearable |
| | | size="small" |
| | | style="width: 240px" |
| | | > |
| | | <el-option |
| | | v-for="dict in jobGroupOptions" |
| | | :key="dict.dictValue" |
| | | :label="dict.dictLabel" |
| | | :value="dict.dictValue" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æ§è¡ç¶æ" prop="status"> |
| | | <el-select |
| | | v-model="queryParams.status" |
| | | placeholder="è¯·éæ©æ§è¡ç¶æ" |
| | | clearable |
| | | size="small" |
| | | style="width: 240px" |
| | | > |
| | | <el-option |
| | | v-for="dict in statusOptions" |
| | | :key="dict.dictValue" |
| | | :label="dict.dictLabel" |
| | | :value="dict.dictValue" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æ§è¡æ¶é´"> |
| | | <el-date-picker |
| | | v-model="dateRange" |
| | | size="small" |
| | | style="width: 240px" |
| | | value-format="yyyy-MM-dd" |
| | | type="daterange" |
| | | range-separator="-" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | ></el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="danger" |
| | | icon="el-icon-delete" |
| | | size="mini" |
| | | :disabled="multiple" |
| | | @click="handleDelete" |
| | | v-hasPermi="['monitor:job:remove']" |
| | | >å é¤</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="danger" |
| | | icon="el-icon-delete" |
| | | size="mini" |
| | | @click="handleClean" |
| | | v-hasPermi="['monitor:job:remove']" |
| | | >æ¸
空</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="warning" |
| | | icon="el-icon-download" |
| | | size="mini" |
| | | @click="handleExport" |
| | | v-hasPermi="['monitor:jobLog:export']" |
| | | >导åº</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-table v-loading="loading" :data="jobLogList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="æ¥å¿ç¼å·" width="80" align="center" prop="jobLogId" /> |
| | | <el-table-column label="ä»»å¡åç§°" align="center" prop="jobName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="ä»»å¡ç»å" align="center" prop="jobGroup" :formatter="jobGroupFormat" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="è°ç¨ç®æ å符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="æ¥å¿ä¿¡æ¯" align="center" prop="jobMessage" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="æ§è¡ç¶æ" align="center" prop="status" :formatter="statusFormat" /> |
| | | <el-table-column label="æ§è¡æ¶é´" align="center" prop="createTime" width="180"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ parseTime(scope.row.createTime) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" align="center" class-name="small-padding fixed-width"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-view" |
| | | @click="handleView(scope.row)" |
| | | v-hasPermi="['monitor:job:query']" |
| | | >详ç»</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination |
| | | v-show="total>0" |
| | | :total="total" |
| | | :page.sync="queryParams.pageNum" |
| | | :limit.sync="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | |
| | | <!-- è°åº¦æ¥å¿è¯¦ç» --> |
| | | <el-dialog title="è°åº¦æ¥å¿è¯¦ç»" :visible.sync="open" width="700px"> |
| | | <el-form ref="form" :model="form" label-width="100px" size="mini"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ¥å¿åºå·ï¼">{{ form.jobLogId }}</el-form-item> |
| | | <el-form-item label="ä»»å¡åç§°ï¼">{{ form.jobName }}</el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä»»å¡åç»ï¼">{{ form.jobGroup }}</el-form-item> |
| | | <el-form-item label="æ§è¡æ¶é´ï¼">{{ form.createTime }}</el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="è°ç¨æ¹æ³ï¼">{{ form.invokeTarget }}</el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="æ¥å¿ä¿¡æ¯ï¼">{{ form.jobMessage }}</el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="æ§è¡ç¶æï¼"> |
| | | <div v-if="form.status == 0">æ£å¸¸</div> |
| | | <div v-else-if="form.status == 1">失败</div> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="å¼å¸¸ä¿¡æ¯ï¼" v-if="form.status == 1">{{ form.exceptionInfo }}</el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="open = false">å
³ é</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { listJobLog, delJobLog, exportJobLog, cleanJobLog } from "@/api/monitor/jobLog"; |
| | | |
| | | export default { |
| | | name: "JobLog", |
| | | data() { |
| | | return { |
| | | // é®ç½©å± |
| | | loading: true, |
| | | // é䏿°ç» |
| | | ids: [], |
| | | // éå¤ä¸ªç¦ç¨ |
| | | multiple: true, |
| | | // æ»æ¡æ° |
| | | total: 0, |
| | | // è°åº¦æ¥å¿è¡¨æ ¼æ°æ® |
| | | jobLogList: [], |
| | | // æ¯å¦æ¾ç¤ºå¼¹åºå± |
| | | open: false, |
| | | // æ¥æèå´ |
| | | dateRange: [], |
| | | // 表ååæ° |
| | | form: {}, |
| | | // æ§è¡ç¶æåå
¸ |
| | | statusOptions: [], |
| | | // ä»»å¡ç»ååå
¸ |
| | | jobGroupOptions: [], |
| | | // æ¥è¯¢åæ° |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | jobName: undefined, |
| | | jobGroup: undefined, |
| | | status: undefined |
| | | }, |
| | | // 表ååæ° |
| | | form: {} |
| | | }; |
| | | }, |
| | | created() { |
| | | this.getList(); |
| | | this.getDicts("sys_job_status").then(response => { |
| | | this.statusOptions = response.data; |
| | | }); |
| | | this.getDicts("sys_job_group").then(response => { |
| | | this.jobGroupOptions = response.data; |
| | | }); |
| | | }, |
| | | methods: { |
| | | /** æ¥è¯¢è°åº¦æ¥å¿å表 */ |
| | | getList() { |
| | | this.loading = true; |
| | | listJobLog(this.addDateRange(this.queryParams, this.dateRange)).then(response => { |
| | | this.jobLogList = response.rows; |
| | | this.total = response.total; |
| | | this.loading = false; |
| | | } |
| | | ); |
| | | }, |
| | | // æ§è¡ç¶æåå
¸ç¿»è¯ |
| | | statusFormat(row, column) { |
| | | return this.selectDictLabel(this.statusOptions, row.status); |
| | | }, |
| | | // ä»»å¡ç»ååå
¸ç¿»è¯ |
| | | jobGroupFormat(row, column) { |
| | | return this.selectDictLabel(this.jobGroupOptions, row.jobGroup); |
| | | }, |
| | | /** æç´¢æé®æä½ */ |
| | | handleQuery() { |
| | | this.queryParams.pageNum = 1; |
| | | this.getList(); |
| | | }, |
| | | /** éç½®æé®æä½ */ |
| | | resetQuery() { |
| | | this.dateRange = []; |
| | | this.resetForm("queryForm"); |
| | | this.handleQuery(); |
| | | }, |
| | | // å¤éæ¡é䏿°æ® |
| | | handleSelectionChange(selection) { |
| | | this.ids = selection.map(item => item.jobLogId); |
| | | this.multiple = !selection.length; |
| | | }, |
| | | /** è¯¦ç»æé®æä½ */ |
| | | handleView(row) { |
| | | this.open = true; |
| | | this.form = row; |
| | | }, |
| | | /** å é¤æé®æä½ */ |
| | | handleDelete(row) { |
| | | const jobLogIds = this.ids; |
| | | this.$confirm('æ¯å¦ç¡®è®¤å é¤è°åº¦æ¥å¿ç¼å·ä¸º"' + jobLogIds + '"çæ°æ®é¡¹?', "è¦å", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }).then(function() { |
| | | return delJobLog(jobLogIds); |
| | | }).then(() => { |
| | | this.getList(); |
| | | this.msgSuccess("å 餿å"); |
| | | }).catch(function() {}); |
| | | }, |
| | | /** æ¸
空æé®æä½ */ |
| | | handleClean() { |
| | | this.$confirm("æ¯å¦ç¡®è®¤æ¸
空ææè°åº¦æ¥å¿æ°æ®é¡¹?", "è¦å", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }).then(function() { |
| | | return cleanJobLog(); |
| | | }).then(() => { |
| | | this.getList(); |
| | | this.msgSuccess("æ¸
空æå"); |
| | | }).catch(function() {}); |
| | | }, |
| | | /** å¯¼åºæé®æä½ */ |
| | | handleExport() { |
| | | const queryParams = this.queryParams; |
| | | this.$confirm("æ¯å¦ç¡®è®¤å¯¼åºææè°åº¦æ¥å¿æ°æ®é¡¹?", "è¦å", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }).then(function() { |
| | | return exportJobLog(queryParams); |
| | | }).then(response => { |
| | | this.download(response.msg); |
| | | }).catch(function() {}); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | |
| | |
|
| | | <groupId>com.ruoyi</groupId>
|
| | | <artifactId>ruoyi</artifactId>
|
| | | <version>2.1.0</version>
|
| | | <version>2.2.0</version>
|
| | | <packaging>jar</packaging>
|
| | |
|
| | | <name>ruoyi</name>
|
| | |
| | | <artifactId>poi-ooxml</artifactId>
|
| | | <version>${poi.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <!--velocity代ç çæä½¿ç¨æ¨¡æ¿ -->
|
| | | <dependency>
|
| | | <groupId>org.apache.velocity</groupId>
|
| | | <artifactId>velocity</artifactId>
|
| | | <version>${velocity.version}</version>
|
| | | </dependency>
|
| | | |
| | | <!-- 宿¶ä»»å¡ -->
|
| | | <dependency>
|
| | | <groupId>org.quartz-scheduler</groupId>
|
| | | <artifactId>quartz</artifactId>
|
| | | <exclusions>
|
| | | <exclusion>
|
| | | <groupId>com.mchange</groupId>
|
| | | <artifactId>c3p0</artifactId>
|
| | | </exclusion>
|
| | | </exclusions>
|
| | | </dependency>
|
| | |
|
| | | </dependencies>
|
| | |
|
¶Ô±ÈÐÂÎļþ |
| | |
| | | -- ---------------------------- |
| | | -- 1ãå卿¯ä¸ä¸ªå·²é
ç½®ç jobDetail ç详ç»ä¿¡æ¯ |
| | | -- ---------------------------- |
| | | drop table if exists QRTZ_JOB_DETAILS; |
| | | create table QRTZ_JOB_DETAILS ( |
| | | sched_name varchar(120) not null, |
| | | job_name varchar(200) not null, |
| | | job_group varchar(200) not null, |
| | | description varchar(250) null, |
| | | job_class_name varchar(250) not null, |
| | | is_durable varchar(1) not null, |
| | | is_nonconcurrent varchar(1) not null, |
| | | is_update_data varchar(1) not null, |
| | | requests_recovery varchar(1) not null, |
| | | job_data blob null, |
| | | primary key (sched_name,job_name,job_group) |
| | | ) engine=innodb; |
| | | |
| | | -- ---------------------------- |
| | | -- 2ã åå¨å·²é
ç½®ç Trigger çä¿¡æ¯ |
| | | -- ---------------------------- |
| | | drop table if exists QRTZ_TRIGGERS; |
| | | create table QRTZ_TRIGGERS ( |
| | | sched_name varchar(120) not null, |
| | | trigger_name varchar(200) not null, |
| | | trigger_group varchar(200) not null, |
| | | job_name varchar(200) not null, |
| | | job_group varchar(200) not null, |
| | | description varchar(250) null, |
| | | next_fire_time bigint(13) null, |
| | | prev_fire_time bigint(13) null, |
| | | priority integer null, |
| | | trigger_state varchar(16) not null, |
| | | trigger_type varchar(8) not null, |
| | | start_time bigint(13) not null, |
| | | end_time bigint(13) null, |
| | | calendar_name varchar(200) null, |
| | | misfire_instr smallint(2) null, |
| | | job_data blob null, |
| | | primary key (sched_name,trigger_name,trigger_group), |
| | | foreign key (sched_name,job_name,job_group) references QRTZ_JOB_DETAILS(sched_name,job_name,job_group) |
| | | ) engine=innodb; |
| | | |
| | | -- ---------------------------- |
| | | -- 3ã åå¨ç®åç Triggerï¼å
æ¬é夿¬¡æ°ï¼é´éï¼ä»¥å已触åçæ¬¡æ° |
| | | -- ---------------------------- |
| | | drop table if exists QRTZ_SIMPLE_TRIGGERS; |
| | | create table QRTZ_SIMPLE_TRIGGERS ( |
| | | sched_name varchar(120) not null, |
| | | trigger_name varchar(200) not null, |
| | | trigger_group varchar(200) not null, |
| | | repeat_count bigint(7) not null, |
| | | repeat_interval bigint(12) not null, |
| | | times_triggered bigint(10) not null, |
| | | primary key (sched_name,trigger_name,trigger_group), |
| | | foreign key (sched_name,trigger_name,trigger_group) references QRTZ_TRIGGERS(sched_name,trigger_name,trigger_group) |
| | | ) engine=innodb; |
| | | |
| | | -- ---------------------------- |
| | | -- 4ã åå¨ Cron Triggerï¼å
æ¬ Cron 表达å¼åæ¶åºä¿¡æ¯ |
| | | -- ---------------------------- |
| | | drop table if exists QRTZ_CRON_TRIGGERS; |
| | | create table QRTZ_CRON_TRIGGERS ( |
| | | sched_name varchar(120) not null, |
| | | trigger_name varchar(200) not null, |
| | | trigger_group varchar(200) not null, |
| | | cron_expression varchar(200) not null, |
| | | time_zone_id varchar(80), |
| | | primary key (sched_name,trigger_name,trigger_group), |
| | | foreign key (sched_name,trigger_name,trigger_group) references QRTZ_TRIGGERS(sched_name,trigger_name,trigger_group) |
| | | ) engine=innodb; |
| | | |
| | | -- ---------------------------- |
| | | -- 5ã Trigger ä½ä¸º Blob ç±»ååå¨(ç¨äº Quartz ç¨æ·ç¨ JDBC å建ä»ä»¬èªå·±å®å¶ç Trigger ç±»åï¼JobStore å¹¶ä¸ç¥éå¦ä½åå¨å®ä¾çæ¶å) |
| | | -- ---------------------------- |
| | | drop table if exists QRTZ_BLOB_TRIGGERS; |
| | | create table QRTZ_BLOB_TRIGGERS ( |
| | | sched_name varchar(120) not null, |
| | | trigger_name varchar(200) not null, |
| | | trigger_group varchar(200) not null, |
| | | blob_data blob null, |
| | | primary key (sched_name,trigger_name,trigger_group), |
| | | foreign key (sched_name,trigger_name,trigger_group) references QRTZ_TRIGGERS(sched_name,trigger_name,trigger_group) |
| | | ) engine=innodb; |
| | | |
| | | -- ---------------------------- |
| | | -- 6ã 以 Blob ç±»ååå¨åæ¾æ¥åä¿¡æ¯ï¼ quartzå¯é
ç½®ä¸ä¸ªæ¥åæ¥æå®ä¸ä¸ªæ¶é´èå´ |
| | | -- ---------------------------- |
| | | drop table if exists QRTZ_CALENDARS; |
| | | create table QRTZ_CALENDARS ( |
| | | sched_name varchar(120) not null, |
| | | calendar_name varchar(200) not null, |
| | | calendar blob not null, |
| | | primary key (sched_name,calendar_name) |
| | | ) engine=innodb; |
| | | |
| | | -- ---------------------------- |
| | | -- 7ã åå¨å·²æåç Trigger ç»çä¿¡æ¯ |
| | | -- ---------------------------- |
| | | drop table if exists QRTZ_PAUSED_TRIGGER_GRPS; |
| | | create table QRTZ_PAUSED_TRIGGER_GRPS ( |
| | | sched_name varchar(120) not null, |
| | | trigger_group varchar(200) not null, |
| | | primary key (sched_name,trigger_group) |
| | | ) engine=innodb; |
| | | |
| | | -- ---------------------------- |
| | | -- 8ã åå¨ä¸å·²è§¦åç Trigger ç¸å
³çç¶æä¿¡æ¯ï¼ä»¥åç¸è Job çæ§è¡ä¿¡æ¯ |
| | | -- ---------------------------- |
| | | drop table if exists QRTZ_FIRED_TRIGGERS; |
| | | create table QRTZ_FIRED_TRIGGERS ( |
| | | sched_name varchar(120) not null, |
| | | entry_id varchar(95) not null, |
| | | trigger_name varchar(200) not null, |
| | | trigger_group varchar(200) not null, |
| | | instance_name varchar(200) not null, |
| | | fired_time bigint(13) not null, |
| | | sched_time bigint(13) not null, |
| | | priority integer not null, |
| | | state varchar(16) not null, |
| | | job_name varchar(200) null, |
| | | job_group varchar(200) null, |
| | | is_nonconcurrent varchar(1) null, |
| | | requests_recovery varchar(1) null, |
| | | primary key (sched_name,entry_id) |
| | | ) engine=innodb; |
| | | |
| | | -- ---------------------------- |
| | | -- 9ã åå¨å°éçæå
³ Scheduler çç¶æä¿¡æ¯ï¼å妿¯ç¨äºé群ä¸ï¼å¯ä»¥çå°å
¶ä»ç Scheduler å®ä¾ |
| | | -- ---------------------------- |
| | | drop table if exists QRTZ_SCHEDULER_STATE; |
| | | create table QRTZ_SCHEDULER_STATE ( |
| | | sched_name varchar(120) not null, |
| | | instance_name varchar(200) not null, |
| | | last_checkin_time bigint(13) not null, |
| | | checkin_interval bigint(13) not null, |
| | | primary key (sched_name,instance_name) |
| | | ) engine=innodb; |
| | | |
| | | -- ---------------------------- |
| | | -- 10ã åå¨ç¨åºçæ²è§éçä¿¡æ¯(åå¦ä½¿ç¨äºæ²è§é) |
| | | -- ---------------------------- |
| | | drop table if exists QRTZ_LOCKS; |
| | | create table QRTZ_LOCKS ( |
| | | sched_name varchar(120) not null, |
| | | lock_name varchar(40) not null, |
| | | primary key (sched_name,lock_name) |
| | | ) engine=innodb; |
| | | |
| | | drop table if exists QRTZ_SIMPROP_TRIGGERS; |
| | | create table QRTZ_SIMPROP_TRIGGERS ( |
| | | sched_name varchar(120) not null, |
| | | trigger_name varchar(200) not null, |
| | | trigger_group varchar(200) not null, |
| | | str_prop_1 varchar(512) null, |
| | | str_prop_2 varchar(512) null, |
| | | str_prop_3 varchar(512) null, |
| | | int_prop_1 int null, |
| | | int_prop_2 int null, |
| | | long_prop_1 bigint null, |
| | | long_prop_2 bigint null, |
| | | dec_prop_1 numeric(13,4) null, |
| | | dec_prop_2 numeric(13,4) null, |
| | | bool_prop_1 varchar(1) null, |
| | | bool_prop_2 varchar(1) null, |
| | | primary key (sched_name,trigger_name,trigger_group), |
| | | foreign key (sched_name,trigger_name,trigger_group) references QRTZ_TRIGGERS(sched_name,trigger_name,trigger_group) |
| | | ) engine=innodb; |
| | | |
| | | commit; |
| | |
| | | {
|
| | | public static void main(String[] args)
|
| | | {
|
| | | // System.setProperty("spring.devtools.restart.enabled", "false");
|
| | | System.setProperty("spring.devtools.restart.enabled", "false");
|
| | | SpringApplication.run(RuoYiApplication.class, args);
|
| | | System.out.println("(â¥â â¿â )ï¾ï¾ è¥ä¾å¯å¨æå á(´ڡ`á)ï¾ \n" +
|
| | | " .-------. ____ __ \n" +
|
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.constant; |
| | | |
| | | /** |
| | | * ä»»å¡è°åº¦éç¨å¸¸é |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public interface ScheduleConstants |
| | | { |
| | | public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME"; |
| | | |
| | | /** æ§è¡ç®æ key */ |
| | | public static final String TASK_PROPERTIES = "TASK_PROPERTIES"; |
| | | |
| | | /** é»è®¤ */ |
| | | public static final String MISFIRE_DEFAULT = "0"; |
| | | |
| | | /** ç«å³è§¦åæ§è¡ */ |
| | | public static final String MISFIRE_IGNORE_MISFIRES = "1"; |
| | | |
| | | /** 触å䏿¬¡æ§è¡ */ |
| | | public static final String MISFIRE_FIRE_AND_PROCEED = "2"; |
| | | |
| | | /** ä¸è§¦åç«å³æ§è¡ */ |
| | | public static final String MISFIRE_DO_NOTHING = "3"; |
| | | |
| | | public enum Status |
| | | { |
| | | /** |
| | | * æ£å¸¸ |
| | | */ |
| | | NORMAL("0"), |
| | | /** |
| | | * æå |
| | | */ |
| | | PAUSE("1"); |
| | | |
| | | private String value; |
| | | |
| | | private Status(String value) |
| | | { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getValue() |
| | | { |
| | | return value; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.exception.job; |
| | | |
| | | /** |
| | | * 计åçç¥å¼å¸¸ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class TaskException extends Exception |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private Code code; |
| | | |
| | | public TaskException(String msg, Code code) |
| | | { |
| | | this(msg, code, null); |
| | | } |
| | | |
| | | public TaskException(String msg, Code code, Exception nestedEx) |
| | | { |
| | | super(msg, nestedEx); |
| | | this.code = code; |
| | | } |
| | | |
| | | public Code getCode() |
| | | { |
| | | return code; |
| | | } |
| | | |
| | | public enum Code |
| | | { |
| | | TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.io.StringWriter; |
| | | import org.apache.commons.lang3.exception.ExceptionUtils; |
| | | |
| | | /** |
| | | * é误信æ¯å¤çç±»ã |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class ExceptionUtil |
| | | { |
| | | /** |
| | | * è·åexceptionç详ç»é误信æ¯ã |
| | | */ |
| | | public static String getExceptionMessage(Throwable e) |
| | | { |
| | | StringWriter sw = new StringWriter(); |
| | | e.printStackTrace(new PrintWriter(sw, true)); |
| | | String str = sw.toString(); |
| | | return str; |
| | | } |
| | | |
| | | public static String getRootErrorMseeage(Exception e) |
| | | { |
| | | Throwable root = ExceptionUtils.getRootCause(e); |
| | | root = (root == null ? e : root); |
| | | if (root == null) |
| | | { |
| | | return ""; |
| | | } |
| | | String msg = root.getMessage(); |
| | | if (msg == null) |
| | | { |
| | | return "null"; |
| | | } |
| | | return StringUtils.defaultString(msg); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.bean; |
| | | |
| | | import java.lang.reflect.Method; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * Bean å·¥å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class BeanUtils extends org.springframework.beans.BeanUtils |
| | | { |
| | | /** Beanæ¹æ³åä¸å±æ§åå¼å§ç䏿 */ |
| | | private static final int BEAN_METHOD_PROP_INDEX = 3; |
| | | |
| | | /** * å¹é
getteræ¹æ³çæ£åè¡¨è¾¾å¼ */ |
| | | private static final Pattern GET_PATTERN = Pattern.compile("get(\\p{javaUpperCase}\\w*)"); |
| | | |
| | | /** * å¹é
setteræ¹æ³çæ£åè¡¨è¾¾å¼ */ |
| | | private static final Pattern SET_PATTERN = Pattern.compile("set(\\p{javaUpperCase}\\w*)"); |
| | | |
| | | /** |
| | | * Bean屿§å¤å¶å·¥å
·æ¹æ³ã |
| | | * |
| | | * @param dest ç®æ 对象 |
| | | * @param src æºå¯¹è±¡ |
| | | */ |
| | | public static void copyBeanProp(Object dest, Object src) |
| | | { |
| | | try |
| | | { |
| | | copyProperties(src, dest); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·å对象çsetteræ¹æ³ã |
| | | * |
| | | * @param obj 对象 |
| | | * @return 对象çsetteræ¹æ³å表 |
| | | */ |
| | | public static List<Method> getSetterMethods(Object obj) |
| | | { |
| | | // setteræ¹æ³å表 |
| | | List<Method> setterMethods = new ArrayList<Method>(); |
| | | |
| | | // è·åæææ¹æ³ |
| | | Method[] methods = obj.getClass().getMethods(); |
| | | |
| | | // æ¥æ¾setteræ¹æ³ |
| | | |
| | | for (Method method : methods) |
| | | { |
| | | Matcher m = SET_PATTERN.matcher(method.getName()); |
| | | if (m.matches() && (method.getParameterTypes().length == 1)) |
| | | { |
| | | setterMethods.add(method); |
| | | } |
| | | } |
| | | // è¿åsetteræ¹æ³å表 |
| | | return setterMethods; |
| | | } |
| | | |
| | | /** |
| | | * è·å对象çgetteræ¹æ³ã |
| | | * |
| | | * @param obj 对象 |
| | | * @return 对象çgetteræ¹æ³å表 |
| | | */ |
| | | |
| | | public static List<Method> getGetterMethods(Object obj) |
| | | { |
| | | // getteræ¹æ³å表 |
| | | List<Method> getterMethods = new ArrayList<Method>(); |
| | | // è·åæææ¹æ³ |
| | | Method[] methods = obj.getClass().getMethods(); |
| | | // æ¥æ¾getteræ¹æ³ |
| | | for (Method method : methods) |
| | | { |
| | | Matcher m = GET_PATTERN.matcher(method.getName()); |
| | | if (m.matches() && (method.getParameterTypes().length == 0)) |
| | | { |
| | | getterMethods.add(method); |
| | | } |
| | | } |
| | | // è¿ågetteræ¹æ³å表 |
| | | return getterMethods; |
| | | } |
| | | |
| | | /** |
| | | * æ£æ¥Beanæ¹æ³åä¸ç屿§åæ¯å¦ç¸çã<br> |
| | | * å¦getName()åsetName()屿§å䏿 ·ï¼getName()åsetAge()屿§åä¸ä¸æ ·ã |
| | | * |
| | | * @param m1 æ¹æ³å1 |
| | | * @param m2 æ¹æ³å2 |
| | | * @return 屿§å䏿 ·è¿åtrueï¼å¦åè¿åfalse |
| | | */ |
| | | |
| | | public static boolean isMethodPropEquals(String m1, String m2) |
| | | { |
| | | return m1.substring(BEAN_METHOD_PROP_INDEX).equals(m2.substring(BEAN_METHOD_PROP_INDEX)); |
| | | } |
| | | } |
| | |
| | | |
| | | public static String getBodyString(ServletRequest request) |
| | | { |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | BufferedReader reader = null; |
| | | try (InputStream inputStream = request.getInputStream()) |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.job; |
| | | |
| | | import java.util.Date; |
| | | import org.quartz.Job; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.constant.ScheduleConstants; |
| | | import com.ruoyi.common.utils.ExceptionUtil; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.ruoyi.project.monitor.domain.SysJob; |
| | | import com.ruoyi.project.monitor.domain.SysJobLog; |
| | | import com.ruoyi.project.monitor.service.ISysJobLogService; |
| | | |
| | | /** |
| | | * æ½è±¡quartzè°ç¨ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public abstract class AbstractQuartzJob implements Job |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(AbstractQuartzJob.class); |
| | | |
| | | /** |
| | | * çº¿ç¨æ¬å°åé |
| | | */ |
| | | private static ThreadLocal<Date> threadLocal = new ThreadLocal<>(); |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext context) throws JobExecutionException |
| | | { |
| | | SysJob sysJob = new SysJob(); |
| | | BeanUtils.copyBeanProp(sysJob, context.getMergedJobDataMap().get(ScheduleConstants.TASK_PROPERTIES)); |
| | | try |
| | | { |
| | | before(context, sysJob); |
| | | if (sysJob != null) |
| | | { |
| | | doExecute(context, sysJob); |
| | | } |
| | | after(context, sysJob, null); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("任塿§è¡å¼å¸¸ - ï¼", e); |
| | | after(context, sysJob, e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ§è¡å |
| | | * |
| | | * @param context 工使§è¡ä¸ä¸æå¯¹è±¡ |
| | | * @param sysJob ç³»ç»è®¡åä»»å¡ |
| | | */ |
| | | protected void before(JobExecutionContext context, SysJob sysJob) |
| | | { |
| | | threadLocal.set(new Date()); |
| | | } |
| | | |
| | | /** |
| | | * æ§è¡å |
| | | * |
| | | * @param context 工使§è¡ä¸ä¸æå¯¹è±¡ |
| | | * @param sysScheduleJob ç³»ç»è®¡åä»»å¡ |
| | | */ |
| | | protected void after(JobExecutionContext context, SysJob sysJob, Exception e) |
| | | { |
| | | Date startTime = threadLocal.get(); |
| | | threadLocal.remove(); |
| | | |
| | | final SysJobLog sysJobLog = new SysJobLog(); |
| | | sysJobLog.setJobName(sysJob.getJobName()); |
| | | sysJobLog.setJobGroup(sysJob.getJobGroup()); |
| | | sysJobLog.setInvokeTarget(sysJob.getInvokeTarget()); |
| | | sysJobLog.setStartTime(startTime); |
| | | sysJobLog.setStopTime(new Date()); |
| | | long runMs = sysJobLog.getStopTime().getTime() - sysJobLog.getStartTime().getTime(); |
| | | sysJobLog.setJobMessage(sysJobLog.getJobName() + " æ»å
±èæ¶ï¼" + runMs + "毫ç§"); |
| | | if (e != null) |
| | | { |
| | | sysJobLog.setStatus(Constants.FAIL); |
| | | String errorMsg = StringUtils.substring(ExceptionUtil.getExceptionMessage(e), 0, 2000); |
| | | sysJobLog.setExceptionInfo(errorMsg); |
| | | } |
| | | else |
| | | { |
| | | sysJobLog.setStatus(Constants.SUCCESS); |
| | | } |
| | | |
| | | // åå
¥æ°æ®åºå½ä¸ |
| | | SpringUtils.getBean(ISysJobLogService.class).addJobLog(sysJobLog); |
| | | } |
| | | |
| | | /** |
| | | * æ§è¡æ¹æ³ï¼ç±åç±»éè½½ |
| | | * |
| | | * @param context 工使§è¡ä¸ä¸æå¯¹è±¡ |
| | | * @param sysJob ç³»ç»è®¡åä»»å¡ |
| | | * @throws Exception æ§è¡è¿ç¨ä¸çå¼å¸¸ |
| | | */ |
| | | protected abstract void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.job; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.Date; |
| | | import org.quartz.CronExpression; |
| | | |
| | | /** |
| | | * cron表达å¼å·¥å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | * |
| | | */ |
| | | public class CronUtils |
| | | { |
| | | /** |
| | | * è¿åä¸ä¸ªå¸å°å¼ä»£è¡¨ä¸ä¸ªç»å®çCron表达å¼çæææ§ |
| | | * |
| | | * @param cronExpression Cronè¡¨è¾¾å¼ |
| | | * @return boolean è¡¨è¾¾å¼æ¯å¦ææ |
| | | */ |
| | | public static boolean isValid(String cronExpression) |
| | | { |
| | | return CronExpression.isValidExpression(cronExpression); |
| | | } |
| | | |
| | | /** |
| | | * è¿åä¸ä¸ªå符串å¼,è¡¨ç¤ºè¯¥æ¶æ¯æ æCron表达å¼ç»åºæææ§ |
| | | * |
| | | * @param cronExpression Cronè¡¨è¾¾å¼ |
| | | * @return String æ ææ¶è¿å表达å¼é误æè¿°,妿ææè¿ånull |
| | | */ |
| | | public static String getInvalidMessage(String cronExpression) |
| | | { |
| | | try |
| | | { |
| | | new CronExpression(cronExpression); |
| | | return null; |
| | | } |
| | | catch (ParseException pe) |
| | | { |
| | | return pe.getMessage(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è¿åä¸ä¸ä¸ªæ§è¡æ¶é´æ ¹æ®ç»å®çCronè¡¨è¾¾å¼ |
| | | * |
| | | * @param cronExpression Cronè¡¨è¾¾å¼ |
| | | * @return Date 䏿¬¡Cronè¡¨è¾¾å¼æ§è¡æ¶é´ |
| | | */ |
| | | public static Date getNextExecution(String cronExpression) |
| | | { |
| | | try |
| | | { |
| | | CronExpression cron = new CronExpression(cronExpression); |
| | | return cron.getNextValidTimeAfter(new Date(System.currentTimeMillis())); |
| | | } |
| | | catch (ParseException e) |
| | | { |
| | | throw new IllegalArgumentException(e.getMessage()); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.job; |
| | | |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.lang.reflect.Method; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.ruoyi.project.monitor.domain.SysJob; |
| | | |
| | | /** |
| | | * 任塿§è¡å·¥å
· |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class JobInvokeUtil |
| | | { |
| | | /** |
| | | * æ§è¡æ¹æ³ |
| | | * |
| | | * @param sysJob ç³»ç»ä»»å¡ |
| | | */ |
| | | public static void invokeMethod(SysJob sysJob) throws Exception |
| | | { |
| | | String invokeTarget = sysJob.getInvokeTarget(); |
| | | String beanName = getBeanName(invokeTarget); |
| | | String methodName = getMethodName(invokeTarget); |
| | | List<Object[]> methodParams = getMethodParams(invokeTarget); |
| | | |
| | | if (!isValidClassName(beanName)) |
| | | { |
| | | Object bean = SpringUtils.getBean(beanName); |
| | | invokeMethod(bean, methodName, methodParams); |
| | | } |
| | | else |
| | | { |
| | | Object bean = Class.forName(beanName).newInstance(); |
| | | invokeMethod(bean, methodName, methodParams); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è°ç¨ä»»å¡æ¹æ³ |
| | | * |
| | | * @param bean ç®æ 对象 |
| | | * @param methodName æ¹æ³åç§° |
| | | * @param methodParams æ¹æ³åæ° |
| | | */ |
| | | private static void invokeMethod(Object bean, String methodName, List<Object[]> methodParams) |
| | | throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, |
| | | InvocationTargetException |
| | | { |
| | | if (StringUtils.isNotNull(methodParams) && methodParams.size() > 0) |
| | | { |
| | | Method method = bean.getClass().getDeclaredMethod(methodName, getMethodParamsType(methodParams)); |
| | | method.invoke(bean, getMethodParamsValue(methodParams)); |
| | | } |
| | | else |
| | | { |
| | | Method method = bean.getClass().getDeclaredMethod(methodName); |
| | | method.invoke(bean); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªæ¯å¦ä¸ºä¸ºclasså
å |
| | | * |
| | | * @param str åç§° |
| | | * @return trueæ¯ falseå¦ |
| | | */ |
| | | public static boolean isValidClassName(String invokeTarget) |
| | | { |
| | | return StringUtils.countMatches(invokeTarget, ".") > 1; |
| | | } |
| | | |
| | | /** |
| | | * è·åbeanåç§° |
| | | * |
| | | * @param invokeTarget ç®æ å符串 |
| | | * @return beanåç§° |
| | | */ |
| | | public static String getBeanName(String invokeTarget) |
| | | { |
| | | String beanName = StringUtils.substringBefore(invokeTarget, "("); |
| | | return StringUtils.substringBeforeLast(beanName, "."); |
| | | } |
| | | |
| | | /** |
| | | * è·åbeanæ¹æ³ |
| | | * |
| | | * @param invokeTarget ç®æ å符串 |
| | | * @return methodæ¹æ³ |
| | | */ |
| | | public static String getMethodName(String invokeTarget) |
| | | { |
| | | String methodName = StringUtils.substringBefore(invokeTarget, "("); |
| | | return StringUtils.substringAfterLast(methodName, "."); |
| | | } |
| | | |
| | | /** |
| | | * è·åmethodæ¹æ³åæ°ç¸å
³å表 |
| | | * |
| | | * @param invokeTarget ç®æ å符串 |
| | | * @return methodæ¹æ³ç¸å
³åæ°å表 |
| | | */ |
| | | public static List<Object[]> getMethodParams(String invokeTarget) |
| | | { |
| | | String methodStr = StringUtils.substringBetween(invokeTarget, "(", ")"); |
| | | if (StringUtils.isEmpty(methodStr)) |
| | | { |
| | | return null; |
| | | } |
| | | String[] methodParams = methodStr.split(","); |
| | | List<Object[]> classs = new LinkedList<>(); |
| | | for (int i = 0; i < methodParams.length; i++) |
| | | { |
| | | String str = StringUtils.trimToEmpty(methodParams[i]); |
| | | // Stringå符串类åï¼å
å«' |
| | | if (StringUtils.contains(str, "'")) |
| | | { |
| | | classs.add(new Object[] { StringUtils.replace(str, "'", ""), String.class }); |
| | | } |
| | | // booleanå¸å°ç±»åï¼çäºtrueæè
false |
| | | else if (StringUtils.equals(str, "true") || StringUtils.equalsIgnoreCase(str, "false")) |
| | | { |
| | | classs.add(new Object[] { Boolean.valueOf(str), Boolean.class }); |
| | | } |
| | | // longé¿æ´å½¢ï¼å
å«L |
| | | else if (StringUtils.containsIgnoreCase(str, "L")) |
| | | { |
| | | classs.add(new Object[] { Long.valueOf(StringUtils.replaceIgnoreCase(str, "L", "")), Long.class }); |
| | | } |
| | | // doubleæµ®ç¹ç±»åï¼å
å«D |
| | | else if (StringUtils.containsIgnoreCase(str, "D")) |
| | | { |
| | | classs.add(new Object[] { Double.valueOf(StringUtils.replaceIgnoreCase(str, "D", "")), Double.class }); |
| | | } |
| | | // å
¶ä»ç±»åå½ç±»ä¸ºæ´å½¢ |
| | | else |
| | | { |
| | | classs.add(new Object[] { Integer.valueOf(str), Integer.class }); |
| | | } |
| | | } |
| | | return classs; |
| | | } |
| | | |
| | | /** |
| | | * è·ååæ°ç±»å |
| | | * |
| | | * @param methodParams åæ°ç¸å
³å表 |
| | | * @return åæ°ç±»åå表 |
| | | */ |
| | | public static Class<?>[] getMethodParamsType(List<Object[]> methodParams) |
| | | { |
| | | Class<?>[] classs = new Class<?>[methodParams.size()]; |
| | | int index = 0; |
| | | for (Object[] os : methodParams) |
| | | { |
| | | classs[index] = (Class<?>) os[1]; |
| | | index++; |
| | | } |
| | | return classs; |
| | | } |
| | | |
| | | /** |
| | | * è·ååæ°å¼ |
| | | * |
| | | * @param methodParams åæ°ç¸å
³å表 |
| | | * @return åæ°å¼å表 |
| | | */ |
| | | public static Object[] getMethodParamsValue(List<Object[]> methodParams) |
| | | { |
| | | Object[] classs = new Object[methodParams.size()]; |
| | | int index = 0; |
| | | for (Object[] os : methodParams) |
| | | { |
| | | classs[index] = (Object) os[0]; |
| | | index++; |
| | | } |
| | | return classs; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.job; |
| | | |
| | | import org.quartz.DisallowConcurrentExecution; |
| | | import org.quartz.JobExecutionContext; |
| | | import com.ruoyi.project.monitor.domain.SysJob; |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡å¤çï¼ç¦æ¢å¹¶åæ§è¡ï¼ |
| | | * |
| | | * @author ruoyi |
| | | * |
| | | */ |
| | | @DisallowConcurrentExecution |
| | | public class QuartzDisallowConcurrentExecution extends AbstractQuartzJob |
| | | { |
| | | @Override |
| | | protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception |
| | | { |
| | | JobInvokeUtil.invokeMethod(sysJob); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.job; |
| | | |
| | | import org.quartz.JobExecutionContext; |
| | | import com.ruoyi.project.monitor.domain.SysJob; |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡å¤çï¼å
è®¸å¹¶åæ§è¡ï¼ |
| | | * |
| | | * @author ruoyi |
| | | * |
| | | */ |
| | | public class QuartzJobExecution extends AbstractQuartzJob |
| | | { |
| | | @Override |
| | | protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception |
| | | { |
| | | JobInvokeUtil.invokeMethod(sysJob); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.job; |
| | | |
| | | import org.quartz.CronScheduleBuilder; |
| | | import org.quartz.CronTrigger; |
| | | import org.quartz.Job; |
| | | import org.quartz.JobBuilder; |
| | | import org.quartz.JobDetail; |
| | | import org.quartz.JobKey; |
| | | import org.quartz.Scheduler; |
| | | import org.quartz.SchedulerException; |
| | | import org.quartz.TriggerBuilder; |
| | | import org.quartz.TriggerKey; |
| | | import com.ruoyi.common.constant.ScheduleConstants; |
| | | import com.ruoyi.common.exception.job.TaskException; |
| | | import com.ruoyi.common.exception.job.TaskException.Code; |
| | | import com.ruoyi.project.monitor.domain.SysJob; |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡å·¥å
·ç±» |
| | | * |
| | | * @author ruoyi |
| | | * |
| | | */ |
| | | public class ScheduleUtils |
| | | { |
| | | /** |
| | | * å¾å°quartzä»»å¡ç±» |
| | | * |
| | | * @param sysJob æ§è¡è®¡å |
| | | * @return å
·ä½æ§è¡ä»»å¡ç±» |
| | | */ |
| | | private static Class<? extends Job> getQuartzJobClass(SysJob sysJob) |
| | | { |
| | | boolean isConcurrent = "0".equals(sysJob.getConcurrent()); |
| | | return isConcurrent ? QuartzJobExecution.class : QuartzDisallowConcurrentExecution.class; |
| | | } |
| | | |
| | | /** |
| | | * æå»ºä»»å¡è§¦å对象 |
| | | */ |
| | | public static TriggerKey getTriggerKey(Long jobId, String jobGroup) |
| | | { |
| | | return TriggerKey.triggerKey(ScheduleConstants.TASK_CLASS_NAME + jobId, jobGroup); |
| | | } |
| | | |
| | | /** |
| | | * æå»ºä»»å¡é®å¯¹è±¡ |
| | | */ |
| | | public static JobKey getJobKey(Long jobId, String jobGroup) |
| | | { |
| | | return JobKey.jobKey(ScheduleConstants.TASK_CLASS_NAME + jobId, jobGroup); |
| | | } |
| | | |
| | | /** |
| | | * åå»ºå®æ¶ä»»å¡ |
| | | */ |
| | | public static void createScheduleJob(Scheduler scheduler, SysJob job) throws SchedulerException, TaskException |
| | | { |
| | | Class<? extends Job> jobClass = getQuartzJobClass(job); |
| | | // æå»ºjobä¿¡æ¯ |
| | | Long jobId = job.getJobId(); |
| | | String jobGroup = job.getJobGroup(); |
| | | JobDetail jobDetail = JobBuilder.newJob(jobClass).withIdentity(getJobKey(jobId, jobGroup)).build(); |
| | | |
| | | // 表达å¼è°åº¦æå»ºå¨ |
| | | CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression()); |
| | | cronScheduleBuilder = handleCronScheduleMisfirePolicy(job, cronScheduleBuilder); |
| | | |
| | | // ææ°çcronExpressionè¡¨è¾¾å¼æå»ºä¸ä¸ªæ°çtrigger |
| | | CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(jobId, jobGroup)) |
| | | .withSchedule(cronScheduleBuilder).build(); |
| | | |
| | | // æ¾å
¥åæ°ï¼è¿è¡æ¶çæ¹æ³å¯ä»¥è·å |
| | | jobDetail.getJobDataMap().put(ScheduleConstants.TASK_PROPERTIES, job); |
| | | |
| | | // 夿æ¯å¦åå¨ |
| | | if (scheduler.checkExists(getJobKey(jobId, jobGroup))) |
| | | { |
| | | // 鲿¢å建æ¶å卿°æ®é®é¢ å
ç§»é¤ï¼ç¶å卿§è¡å建æä½ |
| | | scheduler.deleteJob(getJobKey(jobId, jobGroup)); |
| | | } |
| | | |
| | | scheduler.scheduleJob(jobDetail, trigger); |
| | | |
| | | // æåä»»å¡ |
| | | if (job.getStatus().equals(ScheduleConstants.Status.PAUSE.getValue())) |
| | | { |
| | | scheduler.pauseJob(ScheduleUtils.getJobKey(jobId, jobGroup)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è®¾ç½®å®æ¶ä»»å¡çç¥ |
| | | */ |
| | | public static CronScheduleBuilder handleCronScheduleMisfirePolicy(SysJob job, CronScheduleBuilder cb) |
| | | throws TaskException |
| | | { |
| | | switch (job.getMisfirePolicy()) |
| | | { |
| | | case ScheduleConstants.MISFIRE_DEFAULT: |
| | | return cb; |
| | | case ScheduleConstants.MISFIRE_IGNORE_MISFIRES: |
| | | return cb.withMisfireHandlingInstructionIgnoreMisfires(); |
| | | case ScheduleConstants.MISFIRE_FIRE_AND_PROCEED: |
| | | return cb.withMisfireHandlingInstructionFireAndProceed(); |
| | | case ScheduleConstants.MISFIRE_DO_NOTHING: |
| | | return cb.withMisfireHandlingInstructionDoNothing(); |
| | | default: |
| | | throw new TaskException("The task misfire policy '" + job.getMisfirePolicy() |
| | | + "' cannot be used in cron schedule tasks", Code.CONFIG_ERROR); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.framework.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 ruoyi |
| | | */ |
| | | @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", "RuoyiScheduler"); |
| | | 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.quartz.impl.jdbcjobstore.JobStoreTX"); |
| | | // é群é
ç½® |
| | | 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.txIsolationLevelSerializable", "true"); |
| | | |
| | | // sqlserver å¯ç¨ |
| | | // prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?"); |
| | | prop.put("org.quartz.jobStore.misfireThreshold", "12000"); |
| | | prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_"); |
| | | factory.setQuartzProperties(prop); |
| | | |
| | | factory.setSchedulerName("RuoyiScheduler"); |
| | | // å»¶æ¶å¯å¨ |
| | | factory.setStartupDelay(1); |
| | | factory.setApplicationContextSchedulerContextKey("applicationContextKey"); |
| | | // å¯éï¼QuartzScheduler |
| | | // å¯å¨æ¶æ´æ°å·±åå¨çJobï¼è¿æ ·å°±ä¸ç¨æ¯æ¬¡ä¿®æ¹targetObjectåå é¤qrtz_job_details表对åºè®°å½äº |
| | | factory.setOverwriteExistingJobs(true); |
| | | // 设置èªå¨å¯å¨ï¼é»è®¤ä¸ºtrue |
| | | factory.setAutoStartup(true); |
| | | |
| | | return factory; |
| | | } |
| | | } |
| | |
| | | ).permitAll()
|
| | | .antMatchers("/profile/**").anonymous()
|
| | | .antMatchers("/common/download**").anonymous()
|
| | | .antMatchers("/common/download/resource**").anonymous()
|
| | | .antMatchers("/swagger-ui.html").anonymous()
|
| | | .antMatchers("/swagger-resources/**").anonymous()
|
| | | .antMatchers("/webjars/**").anonymous()
|
| | |
| | | nowDataMap.put(REPEAT_PARAMS, nowParams); |
| | | nowDataMap.put(REPEAT_TIME, System.currentTimeMillis()); |
| | | |
| | | // 请æ±å°åï¼ä½ä¸ºåæ¾sessionçkeyå¼ï¼ |
| | | // 请æ±å°åï¼ä½ä¸ºåæ¾cacheçkeyå¼ï¼ |
| | | String url = request.getRequestURI(); |
| | | |
| | | Object sessionObj = redisCache.getCacheObject(CACHE_REPEAT_KEY); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.framework.task; |
| | | |
| | | import org.springframework.stereotype.Component; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡è°åº¦æµè¯ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component("ryTask") |
| | | public class RyTask |
| | | { |
| | | public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) |
| | | { |
| | | System.out.println(StringUtils.format("æ§è¡å¤åæ¹æ³ï¼ å符串类å{}ï¼å¸å°ç±»å{}ï¼é¿æ´å{}ï¼æµ®ç¹å{}ï¼æ´å½¢{}", s, b, l, d, i)); |
| | | } |
| | | |
| | | public void ryParams(String params) |
| | | { |
| | | System.out.println("æ§è¡æåæ¹æ³ï¼" + params); |
| | | } |
| | | |
| | | public void ryNoParams() |
| | | { |
| | | System.out.println("æ§è¡æ åæ¹æ³"); |
| | | } |
| | | } |
| | |
| | | */
|
| | | public class Server
|
| | | {
|
| | | |
| | | private static final int OSHI_WAIT_SECOND = 1000;
|
| | |
|
| | | /**
|
| | |
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.common.utils.file.FileUploadUtils;
|
| | | import com.ruoyi.common.utils.file.FileUtils;
|
| | |
| | | return AjaxResult.error(e.getMessage());
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ¬å°èµæºéç¨ä¸è½½
|
| | | */
|
| | | @GetMapping("/common/download/resource")
|
| | | public void resourceDownload(String name, HttpServletRequest request, HttpServletResponse response) throws Exception
|
| | | {
|
| | | // æ¬å°èµæºè·¯å¾
|
| | | String localPath = RuoYiConfig.getProfile();
|
| | | // æ°æ®åºèµæºå°å
|
| | | String downloadPath = localPath + StringUtils.substringAfter(name, Constants.RESOURCE_PREFIX);
|
| | | // ä¸è½½åç§°
|
| | | String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
| | | response.setCharacterEncoding("utf-8");
|
| | | response.setContentType("multipart/form-data");
|
| | | response.setHeader("Content-Disposition",
|
| | | "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName));
|
| | | FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
| | | }
|
| | | }
|
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.project.monitor.controller; |
| | | |
| | | import java.util.List; |
| | | import org.quartz.SchedulerException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.exception.job.TaskException; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.monitor.domain.SysJob; |
| | | import com.ruoyi.project.monitor.service.ISysJobService; |
| | | |
| | | /** |
| | | * è°åº¦ä»»å¡ä¿¡æ¯æä½å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/job") |
| | | public class SysJobController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysJobService jobService; |
| | | |
| | | /** |
| | | * æ¥è¯¢å®æ¶ä»»å¡å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysJob sysJob) |
| | | { |
| | | startPage(); |
| | | List<SysJob> list = jobService.selectJobList(sysJob); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 导åºå®æ¶ä»»å¡å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:export')") |
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/export") |
| | | public AjaxResult export(SysJob sysJob) |
| | | { |
| | | List<SysJob> list = jobService.selectJobList(sysJob); |
| | | ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class); |
| | | return util.exportExcel(list, "宿¶ä»»å¡"); |
| | | } |
| | | |
| | | /** |
| | | * è·å宿¶ä»»å¡è¯¦ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:query')") |
| | | @GetMapping(value = "/{jobId}") |
| | | public AjaxResult getInfo(@PathVariable("jobId") Long jobId) |
| | | { |
| | | return AjaxResult.success(jobService.selectJobById(jobId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢å®æ¶ä»»å¡ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:add')") |
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody SysJob sysJob) throws SchedulerException, TaskException |
| | | { |
| | | return toAjax(jobService.insertJob(sysJob)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹å®æ¶ä»»å¡ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:edit')") |
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody SysJob sysJob) throws SchedulerException, TaskException |
| | | { |
| | | return toAjax(jobService.updateJob(sysJob)); |
| | | } |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡ç¶æä¿®æ¹ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") |
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public AjaxResult changeStatus(@RequestBody SysJob job) throws SchedulerException |
| | | { |
| | | SysJob newJob = jobService.selectJobById(job.getJobId()); |
| | | newJob.setStatus(job.getStatus()); |
| | | return toAjax(jobService.changeStatus(newJob)); |
| | | } |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡ç«å³æ§è¡ä¸æ¬¡ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") |
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/run") |
| | | public AjaxResult run(@RequestBody SysJob job) throws SchedulerException |
| | | { |
| | | jobService.run(job); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * å é¤å®æ¶ä»»å¡ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:remove')") |
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{jobIds}") |
| | | public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException, TaskException |
| | | { |
| | | jobService.deleteJobByIds(jobIds); |
| | | return AjaxResult.success(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.project.monitor.controller; |
| | | |
| | | import java.util.List; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.project.monitor.domain.SysJobLog; |
| | | import com.ruoyi.project.monitor.service.ISysJobLogService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | |
| | | /** |
| | | * è°åº¦æ¥å¿æä½å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/jobLog") |
| | | public class SysJobLogController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysJobLogService jobLogService; |
| | | |
| | | /** |
| | | * æ¥è¯¢å®æ¶ä»»å¡è°åº¦æ¥å¿å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysJobLog sysJobLog) |
| | | { |
| | | startPage(); |
| | | List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 导åºå®æ¶ä»»å¡è°åº¦æ¥å¿å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:export')") |
| | | @Log(title = "ä»»å¡è°åº¦æ¥å¿", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/export") |
| | | public AjaxResult export(SysJobLog sysJobLog) |
| | | { |
| | | List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog); |
| | | ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class); |
| | | return util.exportExcel(list, "è°åº¦æ¥å¿"); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®è°åº¦ç¼å·è·å详ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:query')") |
| | | @GetMapping(value = "/{configId}") |
| | | public AjaxResult getInfo(@PathVariable Long jobLogId) |
| | | { |
| | | return AjaxResult.success(jobLogService.selectJobLogById(jobLogId)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å é¤å®æ¶ä»»å¡è°åº¦æ¥å¿ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:remove')") |
| | | @Log(title = "宿¶ä»»å¡è°åº¦æ¥å¿", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{jobLogIds}") |
| | | public AjaxResult remove(@PathVariable Long[] jobLogIds) |
| | | { |
| | | return toAjax(jobLogService.deleteJobLogByIds(jobLogIds)); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:remove')") |
| | | @Log(title = "è°åº¦æ¥å¿", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/clean") |
| | | public AjaxResult clean() |
| | | { |
| | | jobLogService.cleanJobLog(); |
| | | return AjaxResult.success(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.project.monitor.domain; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Size; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.ruoyi.common.constant.ScheduleConstants; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.job.CronUtils; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel.ColumnType; |
| | | import com.ruoyi.framework.web.domain.BaseEntity; |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡è°åº¦è¡¨ sys_job |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SysJob extends BaseEntity implements Serializable |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** ä»»å¡ID */ |
| | | @Excel(name = "ä»»å¡åºå·", cellType = ColumnType.NUMERIC) |
| | | private Long jobId; |
| | | |
| | | /** ä»»å¡åç§° */ |
| | | @Excel(name = "ä»»å¡åç§°") |
| | | private String jobName; |
| | | |
| | | /** ä»»å¡ç»å */ |
| | | @Excel(name = "ä»»å¡ç»å") |
| | | private String jobGroup; |
| | | |
| | | /** è°ç¨ç®æ å符串 */ |
| | | @Excel(name = "è°ç¨ç®æ å符串") |
| | | private String invokeTarget; |
| | | |
| | | /** cronæ§è¡è¡¨è¾¾å¼ */ |
| | | @Excel(name = "æ§è¡è¡¨è¾¾å¼ ") |
| | | private String cronExpression; |
| | | |
| | | /** cron计åçç¥ */ |
| | | @Excel(name = "计åçç¥ ", readConverterExp = "0=é»è®¤,1=ç«å³è§¦åæ§è¡,2=触å䏿¬¡æ§è¡,3=ä¸è§¦åç«å³æ§è¡") |
| | | private String misfirePolicy = ScheduleConstants.MISFIRE_DEFAULT; |
| | | |
| | | /** æ¯å¦å¹¶åæ§è¡ï¼0å
许 1ç¦æ¢ï¼ */ |
| | | @Excel(name = "å¹¶åæ§è¡", readConverterExp = "0=å
许,1=ç¦æ¢") |
| | | private String concurrent; |
| | | |
| | | /** ä»»å¡ç¶æï¼0æ£å¸¸ 1æåï¼ */ |
| | | @Excel(name = "ä»»å¡ç¶æ", readConverterExp = "0=æ£å¸¸,1=æå") |
| | | private String status; |
| | | |
| | | public Long getJobId() |
| | | { |
| | | return jobId; |
| | | } |
| | | |
| | | public void setJobId(Long jobId) |
| | | { |
| | | this.jobId = jobId; |
| | | } |
| | | |
| | | @NotBlank(message = "ä»»å¡åç§°ä¸è½ä¸ºç©º") |
| | | @Size(min = 0, max = 64, message = "ä»»å¡åç§°ä¸è½è¶
è¿64个å符") |
| | | public String getJobName() |
| | | { |
| | | return jobName; |
| | | } |
| | | |
| | | public void setJobName(String jobName) |
| | | { |
| | | this.jobName = jobName; |
| | | } |
| | | |
| | | public String getJobGroup() |
| | | { |
| | | return jobGroup; |
| | | } |
| | | |
| | | public void setJobGroup(String jobGroup) |
| | | { |
| | | this.jobGroup = jobGroup; |
| | | } |
| | | |
| | | @NotBlank(message = "è°ç¨ç®æ å符串ä¸è½ä¸ºç©º") |
| | | @Size(min = 0, max = 1000, message = "è°ç¨ç®æ å符串é¿åº¦ä¸è½è¶
è¿500个å符") |
| | | public String getInvokeTarget() |
| | | { |
| | | return invokeTarget; |
| | | } |
| | | |
| | | public void setInvokeTarget(String invokeTarget) |
| | | { |
| | | this.invokeTarget = invokeTarget; |
| | | } |
| | | |
| | | @NotBlank(message = "Cronæ§è¡è¡¨è¾¾å¼ä¸è½ä¸ºç©º") |
| | | @Size(min = 0, max = 255, message = "Cronæ§è¡è¡¨è¾¾å¼ä¸è½è¶
è¿255个å符") |
| | | public String getCronExpression() |
| | | { |
| | | return cronExpression; |
| | | } |
| | | |
| | | public void setCronExpression(String cronExpression) |
| | | { |
| | | this.cronExpression = cronExpression; |
| | | } |
| | | |
| | | public Date getNextValidTime() |
| | | { |
| | | if (StringUtils.isNotEmpty(cronExpression)) |
| | | { |
| | | return CronUtils.getNextExecution(cronExpression); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getMisfirePolicy() |
| | | { |
| | | return misfirePolicy; |
| | | } |
| | | |
| | | public void setMisfirePolicy(String misfirePolicy) |
| | | { |
| | | this.misfirePolicy = misfirePolicy; |
| | | } |
| | | |
| | | public String getConcurrent() |
| | | { |
| | | return concurrent; |
| | | } |
| | | |
| | | public void setConcurrent(String concurrent) |
| | | { |
| | | this.concurrent = concurrent; |
| | | } |
| | | |
| | | public String getStatus() |
| | | { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) |
| | | { |
| | | this.status = status; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("jobId", getJobId()) |
| | | .append("jobName", getJobName()) |
| | | .append("jobGroup", getJobGroup()) |
| | | .append("cronExpression", getCronExpression()) |
| | | .append("nextValidTime", getNextValidTime()) |
| | | .append("misfirePolicy", getMisfirePolicy()) |
| | | .append("concurrent", getConcurrent()) |
| | | .append("status", getStatus()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("remark", getRemark()) |
| | | .toString(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.project.monitor.domain; |
| | | |
| | | import java.util.Date; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.framework.web.domain.BaseEntity; |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡è°åº¦æ¥å¿è¡¨ sys_job_log |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SysJobLog extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** ID */ |
| | | @Excel(name = "æ¥å¿åºå·") |
| | | private Long jobLogId; |
| | | |
| | | /** ä»»å¡åç§° */ |
| | | @Excel(name = "ä»»å¡åç§°") |
| | | private String jobName; |
| | | |
| | | /** ä»»å¡ç»å */ |
| | | @Excel(name = "ä»»å¡ç»å") |
| | | private String jobGroup; |
| | | |
| | | /** è°ç¨ç®æ å符串 */ |
| | | @Excel(name = "è°ç¨ç®æ å符串") |
| | | private String invokeTarget; |
| | | |
| | | /** æ¥å¿ä¿¡æ¯ */ |
| | | @Excel(name = "æ¥å¿ä¿¡æ¯") |
| | | private String jobMessage; |
| | | |
| | | /** æ§è¡ç¶æï¼0æ£å¸¸ 1å¤±è´¥ï¼ */ |
| | | @Excel(name = "æ§è¡ç¶æ", readConverterExp = "0=æ£å¸¸,1=失败") |
| | | private String status; |
| | | |
| | | /** å¼å¸¸ä¿¡æ¯ */ |
| | | @Excel(name = "å¼å¸¸ä¿¡æ¯") |
| | | private String exceptionInfo; |
| | | |
| | | /** å¼å§æ¶é´ */ |
| | | private Date startTime; |
| | | |
| | | /** 忢æ¶é´ */ |
| | | private Date stopTime; |
| | | |
| | | public Long getJobLogId() |
| | | { |
| | | return jobLogId; |
| | | } |
| | | |
| | | public void setJobLogId(Long jobLogId) |
| | | { |
| | | this.jobLogId = jobLogId; |
| | | } |
| | | |
| | | public String getJobName() |
| | | { |
| | | return jobName; |
| | | } |
| | | |
| | | public void setJobName(String jobName) |
| | | { |
| | | this.jobName = jobName; |
| | | } |
| | | |
| | | public String getJobGroup() |
| | | { |
| | | return jobGroup; |
| | | } |
| | | |
| | | public void setJobGroup(String jobGroup) |
| | | { |
| | | this.jobGroup = jobGroup; |
| | | } |
| | | |
| | | public String getInvokeTarget() |
| | | { |
| | | return invokeTarget; |
| | | } |
| | | |
| | | public void setInvokeTarget(String invokeTarget) |
| | | { |
| | | this.invokeTarget = invokeTarget; |
| | | } |
| | | |
| | | public String getJobMessage() |
| | | { |
| | | return jobMessage; |
| | | } |
| | | |
| | | public void setJobMessage(String jobMessage) |
| | | { |
| | | this.jobMessage = jobMessage; |
| | | } |
| | | |
| | | public String getStatus() |
| | | { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) |
| | | { |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getExceptionInfo() |
| | | { |
| | | return exceptionInfo; |
| | | } |
| | | |
| | | public void setExceptionInfo(String exceptionInfo) |
| | | { |
| | | this.exceptionInfo = exceptionInfo; |
| | | } |
| | | |
| | | public Date getStartTime() |
| | | { |
| | | return startTime; |
| | | } |
| | | |
| | | public void setStartTime(Date startTime) |
| | | { |
| | | this.startTime = startTime; |
| | | } |
| | | |
| | | public Date getStopTime() |
| | | { |
| | | return stopTime; |
| | | } |
| | | |
| | | public void setStopTime(Date stopTime) |
| | | { |
| | | this.stopTime = stopTime; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("jobLogId", getJobLogId()) |
| | | .append("jobName", getJobName()) |
| | | .append("jobGroup", getJobGroup()) |
| | | .append("jobMessage", getJobMessage()) |
| | | .append("status", getStatus()) |
| | | .append("exceptionInfo", getExceptionInfo()) |
| | | .append("startTime", getStartTime()) |
| | | .append("stopTime", getStopTime()) |
| | | .toString(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.project.monitor.mapper; |
| | | |
| | | import java.util.List; |
| | | import com.ruoyi.project.monitor.domain.SysJobLog; |
| | | |
| | | /** |
| | | * è°åº¦ä»»å¡æ¥å¿ä¿¡æ¯ æ°æ®å± |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public interface SysJobLogMapper |
| | | { |
| | | /** |
| | | * è·åquartzè°åº¦å¨æ¥å¿ç计åä»»å¡ |
| | | * |
| | | * @param jobLog è°åº¦æ¥å¿ä¿¡æ¯ |
| | | * @return è°åº¦ä»»å¡æ¥å¿éå |
| | | */ |
| | | public List<SysJobLog> selectJobLogList(SysJobLog jobLog); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææè°åº¦ä»»å¡æ¥å¿ |
| | | * |
| | | * @return è°åº¦ä»»å¡æ¥å¿å表 |
| | | */ |
| | | public List<SysJobLog> selectJobLogAll(); |
| | | |
| | | /** |
| | | * éè¿è°åº¦ä»»å¡æ¥å¿IDæ¥è¯¢è°åº¦ä¿¡æ¯ |
| | | * |
| | | * @param jobLogId è°åº¦ä»»å¡æ¥å¿ID |
| | | * @return è°åº¦ä»»å¡æ¥å¿å¯¹è±¡ä¿¡æ¯ |
| | | */ |
| | | public SysJobLog selectJobLogById(Long jobLogId); |
| | | |
| | | /** |
| | | * æ°å¢ä»»å¡æ¥å¿ |
| | | * |
| | | * @param jobLog è°åº¦æ¥å¿ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | public int insertJobLog(SysJobLog jobLog); |
| | | |
| | | /** |
| | | * æ¹éå é¤è°åº¦æ¥å¿ä¿¡æ¯ |
| | | * |
| | | * @param logIds éè¦å é¤çæ°æ®ID |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteJobLogByIds(Long[] logIds); |
| | | |
| | | /** |
| | | * å é¤ä»»å¡æ¥å¿ |
| | | * |
| | | * @param jobId è°åº¦æ¥å¿ID |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteJobLogById(Long jobId); |
| | | |
| | | /** |
| | | * æ¸
ç©ºä»»å¡æ¥å¿ |
| | | */ |
| | | public void cleanJobLog(); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.project.monitor.mapper; |
| | | |
| | | import java.util.List; |
| | | import com.ruoyi.project.monitor.domain.SysJob; |
| | | |
| | | /** |
| | | * è°åº¦ä»»å¡ä¿¡æ¯ æ°æ®å± |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public interface SysJobMapper |
| | | { |
| | | /** |
| | | * æ¥è¯¢è°åº¦ä»»å¡æ¥å¿éå |
| | | * |
| | | * @param job è°åº¦ä¿¡æ¯ |
| | | * @return æä½æ¥å¿éå |
| | | */ |
| | | public List<SysJob> selectJobList(SysJob job); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææè°åº¦ä»»å¡ |
| | | * |
| | | * @return è°åº¦ä»»å¡å表 |
| | | */ |
| | | public List<SysJob> selectJobAll(); |
| | | |
| | | /** |
| | | * éè¿è°åº¦IDæ¥è¯¢è°åº¦ä»»å¡ä¿¡æ¯ |
| | | * |
| | | * @param jobId è°åº¦ID |
| | | * @return è§è²å¯¹è±¡ä¿¡æ¯ |
| | | */ |
| | | public SysJob selectJobById(Long jobId); |
| | | |
| | | /** |
| | | * éè¿è°åº¦IDå é¤è°åº¦ä»»å¡ä¿¡æ¯ |
| | | * |
| | | * @param jobId è°åº¦ID |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteJobById(Long jobId); |
| | | |
| | | /** |
| | | * æ¹éå é¤è°åº¦ä»»å¡ä¿¡æ¯ |
| | | * |
| | | * @param ids éè¦å é¤çæ°æ®ID |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteJobByIds(Long[] ids); |
| | | |
| | | /** |
| | | * ä¿®æ¹è°åº¦ä»»å¡ä¿¡æ¯ |
| | | * |
| | | * @param job è°åº¦ä»»å¡ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | public int updateJob(SysJob job); |
| | | |
| | | /** |
| | | * æ°å¢è°åº¦ä»»å¡ä¿¡æ¯ |
| | | * |
| | | * @param job è°åº¦ä»»å¡ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | public int insertJob(SysJob job); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.project.monitor.service; |
| | | |
| | | import java.util.List; |
| | | import com.ruoyi.project.monitor.domain.SysJobLog; |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡è°åº¦æ¥å¿ä¿¡æ¯ä¿¡æ¯ æå¡å± |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public interface ISysJobLogService |
| | | { |
| | | /** |
| | | * è·åquartzè°åº¦å¨æ¥å¿ç计åä»»å¡ |
| | | * |
| | | * @param jobLog è°åº¦æ¥å¿ä¿¡æ¯ |
| | | * @return è°åº¦ä»»å¡æ¥å¿éå |
| | | */ |
| | | public List<SysJobLog> selectJobLogList(SysJobLog jobLog); |
| | | |
| | | /** |
| | | * éè¿è°åº¦ä»»å¡æ¥å¿IDæ¥è¯¢è°åº¦ä¿¡æ¯ |
| | | * |
| | | * @param jobLogId è°åº¦ä»»å¡æ¥å¿ID |
| | | * @return è°åº¦ä»»å¡æ¥å¿å¯¹è±¡ä¿¡æ¯ |
| | | */ |
| | | public SysJobLog selectJobLogById(Long jobLogId); |
| | | |
| | | /** |
| | | * æ°å¢ä»»å¡æ¥å¿ |
| | | * |
| | | * @param jobLog è°åº¦æ¥å¿ä¿¡æ¯ |
| | | */ |
| | | public void addJobLog(SysJobLog jobLog); |
| | | |
| | | /** |
| | | * æ¹éå é¤è°åº¦æ¥å¿ä¿¡æ¯ |
| | | * |
| | | * @param logIds éè¦å é¤çæ¥å¿ID |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteJobLogByIds(Long[] logIds); |
| | | |
| | | /** |
| | | * å é¤ä»»å¡æ¥å¿ |
| | | * |
| | | * @param jobId è°åº¦æ¥å¿ID |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteJobLogById(Long jobId); |
| | | |
| | | /** |
| | | * æ¸
ç©ºä»»å¡æ¥å¿ |
| | | */ |
| | | public void cleanJobLog(); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.project.monitor.service; |
| | | |
| | | import java.util.List; |
| | | import org.quartz.SchedulerException; |
| | | import com.ruoyi.common.exception.job.TaskException; |
| | | import com.ruoyi.project.monitor.domain.SysJob; |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡è°åº¦ä¿¡æ¯ä¿¡æ¯ æå¡å± |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public interface ISysJobService |
| | | { |
| | | /** |
| | | * è·åquartzè°åº¦å¨ç计åä»»å¡ |
| | | * |
| | | * @param job è°åº¦ä¿¡æ¯ |
| | | * @return è°åº¦ä»»å¡éå |
| | | */ |
| | | public List<SysJob> selectJobList(SysJob job); |
| | | |
| | | /** |
| | | * éè¿è°åº¦ä»»å¡IDæ¥è¯¢è°åº¦ä¿¡æ¯ |
| | | * |
| | | * @param jobId è°åº¦ä»»å¡ID |
| | | * @return è°åº¦ä»»å¡å¯¹è±¡ä¿¡æ¯ |
| | | */ |
| | | public SysJob selectJobById(Long jobId); |
| | | |
| | | /** |
| | | * æåä»»å¡ |
| | | * |
| | | * @param job è°åº¦ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | public int pauseJob(SysJob job) throws SchedulerException; |
| | | |
| | | /** |
| | | * æ¢å¤ä»»å¡ |
| | | * |
| | | * @param job è°åº¦ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | public int resumeJob(SysJob job) throws SchedulerException; |
| | | |
| | | /** |
| | | * å é¤ä»»å¡åï¼æå¯¹åºçtriggerä¹å°è¢«å é¤ |
| | | * |
| | | * @param job è°åº¦ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteJob(SysJob job) throws SchedulerException; |
| | | |
| | | /** |
| | | * æ¹éå é¤è°åº¦ä¿¡æ¯ |
| | | * |
| | | * @param jobIds éè¦å é¤çä»»å¡ID |
| | | * @return ç»æ |
| | | */ |
| | | public void deleteJobByIds(Long[] jobIds) throws SchedulerException; |
| | | |
| | | /** |
| | | * ä»»å¡è°åº¦ç¶æä¿®æ¹ |
| | | * |
| | | * @param job è°åº¦ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | public int changeStatus(SysJob job) throws SchedulerException; |
| | | |
| | | /** |
| | | * ç«å³è¿è¡ä»»å¡ |
| | | * |
| | | * @param job è°åº¦ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | public void run(SysJob job) throws SchedulerException; |
| | | |
| | | /** |
| | | * æ°å¢ä»»å¡ |
| | | * |
| | | * @param job è°åº¦ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | public int insertJob(SysJob job) throws SchedulerException, TaskException; |
| | | |
| | | /** |
| | | * æ´æ°ä»»å¡ |
| | | * |
| | | * @param job è°åº¦ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | public int updateJob(SysJob job) throws SchedulerException, TaskException; |
| | | |
| | | /** |
| | | * æ ¡éªcronè¡¨è¾¾å¼æ¯å¦ææ |
| | | * |
| | | * @param cronExpression è¡¨è¾¾å¼ |
| | | * @return ç»æ |
| | | */ |
| | | public boolean checkCronExpressionIsValid(String cronExpression); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.project.monitor.service.impl; |
| | | |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.ruoyi.project.monitor.domain.SysJobLog; |
| | | import com.ruoyi.project.monitor.mapper.SysJobLogMapper; |
| | | import com.ruoyi.project.monitor.service.ISysJobLogService; |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡è°åº¦æ¥å¿ä¿¡æ¯ æå¡å± |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Service |
| | | public class SysJobLogServiceImpl implements ISysJobLogService |
| | | { |
| | | @Autowired |
| | | private SysJobLogMapper jobLogMapper; |
| | | |
| | | /** |
| | | * è·åquartzè°åº¦å¨æ¥å¿ç计åä»»å¡ |
| | | * |
| | | * @param jobLog è°åº¦æ¥å¿ä¿¡æ¯ |
| | | * @return è°åº¦ä»»å¡æ¥å¿éå |
| | | */ |
| | | @Override |
| | | public List<SysJobLog> selectJobLogList(SysJobLog jobLog) |
| | | { |
| | | return jobLogMapper.selectJobLogList(jobLog); |
| | | } |
| | | |
| | | /** |
| | | * éè¿è°åº¦ä»»å¡æ¥å¿IDæ¥è¯¢è°åº¦ä¿¡æ¯ |
| | | * |
| | | * @param jobLogId è°åº¦ä»»å¡æ¥å¿ID |
| | | * @return è°åº¦ä»»å¡æ¥å¿å¯¹è±¡ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public SysJobLog selectJobLogById(Long jobLogId) |
| | | { |
| | | return jobLogMapper.selectJobLogById(jobLogId); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ä»»å¡æ¥å¿ |
| | | * |
| | | * @param jobLog è°åº¦æ¥å¿ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public void addJobLog(SysJobLog jobLog) |
| | | { |
| | | jobLogMapper.insertJobLog(jobLog); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤è°åº¦æ¥å¿ä¿¡æ¯ |
| | | * |
| | | * @param logIds éè¦å é¤çæ°æ®ID |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteJobLogByIds(Long[] logIds) |
| | | { |
| | | return jobLogMapper.deleteJobLogByIds(logIds); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ä»»å¡æ¥å¿ |
| | | * |
| | | * @param jobId è°åº¦æ¥å¿ID |
| | | */ |
| | | @Override |
| | | public int deleteJobLogById(Long jobId) |
| | | { |
| | | return jobLogMapper.deleteJobLogById(jobId); |
| | | } |
| | | |
| | | /** |
| | | * æ¸
ç©ºä»»å¡æ¥å¿ |
| | | */ |
| | | @Override |
| | | public void cleanJobLog() |
| | | { |
| | | jobLogMapper.cleanJobLog(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.project.monitor.service.impl; |
| | | |
| | | import java.util.List; |
| | | import javax.annotation.PostConstruct; |
| | | import org.quartz.JobDataMap; |
| | | import org.quartz.JobKey; |
| | | import org.quartz.Scheduler; |
| | | import org.quartz.SchedulerException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.ruoyi.common.constant.ScheduleConstants; |
| | | import com.ruoyi.common.exception.job.TaskException; |
| | | import com.ruoyi.common.utils.job.CronUtils; |
| | | import com.ruoyi.common.utils.job.ScheduleUtils; |
| | | import com.ruoyi.project.monitor.domain.SysJob; |
| | | import com.ruoyi.project.monitor.mapper.SysJobMapper; |
| | | import com.ruoyi.project.monitor.service.ISysJobService; |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡è°åº¦ä¿¡æ¯ æå¡å± |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Service |
| | | public class SysJobServiceImpl implements ISysJobService |
| | | { |
| | | @Autowired |
| | | private Scheduler scheduler; |
| | | |
| | | @Autowired |
| | | private SysJobMapper jobMapper; |
| | | |
| | | /** |
| | | * 项ç®å¯å¨æ¶ï¼åå§å宿¶å¨ ä¸»è¦æ¯é²æ¢æå¨ä¿®æ¹æ°æ®åºå¯¼è´æªåæ¥å°å®æ¶ä»»å¡å¤çï¼æ³¨ï¼ä¸è½æå¨ä¿®æ¹æ°æ®åºIDåä»»å¡ç»åï¼å¦åä¼å¯¼è´èæ°æ®ï¼ |
| | | */ |
| | | @PostConstruct |
| | | public void init() throws SchedulerException, TaskException |
| | | { |
| | | scheduler.clear(); |
| | | List<SysJob> jobList = jobMapper.selectJobAll(); |
| | | for (SysJob job : jobList) |
| | | { |
| | | ScheduleUtils.createScheduleJob(scheduler, job); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åquartzè°åº¦å¨ç计åä»»å¡å表 |
| | | * |
| | | * @param job è°åº¦ä¿¡æ¯ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<SysJob> selectJobList(SysJob job) |
| | | { |
| | | return jobMapper.selectJobList(job); |
| | | } |
| | | |
| | | /** |
| | | * éè¿è°åº¦ä»»å¡IDæ¥è¯¢è°åº¦ä¿¡æ¯ |
| | | * |
| | | * @param jobId è°åº¦ä»»å¡ID |
| | | * @return è°åº¦ä»»å¡å¯¹è±¡ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public SysJob selectJobById(Long jobId) |
| | | { |
| | | return jobMapper.selectJobById(jobId); |
| | | } |
| | | |
| | | /** |
| | | * æåä»»å¡ |
| | | * |
| | | * @param job è°åº¦ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int pauseJob(SysJob job) throws SchedulerException |
| | | { |
| | | Long jobId = job.getJobId(); |
| | | String jobGroup = job.getJobGroup(); |
| | | job.setStatus(ScheduleConstants.Status.PAUSE.getValue()); |
| | | int rows = jobMapper.updateJob(job); |
| | | if (rows > 0) |
| | | { |
| | | scheduler.pauseJob(ScheduleUtils.getJobKey(jobId, jobGroup)); |
| | | } |
| | | return rows; |
| | | } |
| | | |
| | | /** |
| | | * æ¢å¤ä»»å¡ |
| | | * |
| | | * @param job è°åº¦ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int resumeJob(SysJob job) throws SchedulerException |
| | | { |
| | | Long jobId = job.getJobId(); |
| | | String jobGroup = job.getJobGroup(); |
| | | job.setStatus(ScheduleConstants.Status.NORMAL.getValue()); |
| | | int rows = jobMapper.updateJob(job); |
| | | if (rows > 0) |
| | | { |
| | | scheduler.resumeJob(ScheduleUtils.getJobKey(jobId, jobGroup)); |
| | | } |
| | | return rows; |
| | | } |
| | | |
| | | /** |
| | | * å é¤ä»»å¡åï¼æå¯¹åºçtriggerä¹å°è¢«å é¤ |
| | | * |
| | | * @param job è°åº¦ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int deleteJob(SysJob job) throws SchedulerException |
| | | { |
| | | Long jobId = job.getJobId(); |
| | | String jobGroup = job.getJobGroup(); |
| | | int rows = jobMapper.deleteJobById(jobId); |
| | | if (rows > 0) |
| | | { |
| | | scheduler.deleteJob(ScheduleUtils.getJobKey(jobId, jobGroup)); |
| | | } |
| | | return rows; |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤è°åº¦ä¿¡æ¯ |
| | | * |
| | | * @param jobIds éè¦å é¤çä»»å¡ID |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public void deleteJobByIds(Long[] jobIds) throws SchedulerException |
| | | { |
| | | for (Long jobId : jobIds) |
| | | { |
| | | SysJob job = jobMapper.selectJobById(jobId); |
| | | deleteJob(job); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä»»å¡è°åº¦ç¶æä¿®æ¹ |
| | | * |
| | | * @param job è°åº¦ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int changeStatus(SysJob job) throws SchedulerException |
| | | { |
| | | int rows = 0; |
| | | String status = job.getStatus(); |
| | | if (ScheduleConstants.Status.NORMAL.getValue().equals(status)) |
| | | { |
| | | rows = resumeJob(job); |
| | | } |
| | | else if (ScheduleConstants.Status.PAUSE.getValue().equals(status)) |
| | | { |
| | | rows = pauseJob(job); |
| | | } |
| | | return rows; |
| | | } |
| | | |
| | | /** |
| | | * ç«å³è¿è¡ä»»å¡ |
| | | * |
| | | * @param job è°åº¦ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public void run(SysJob job) throws SchedulerException |
| | | { |
| | | Long jobId = job.getJobId(); |
| | | String jobGroup = job.getJobGroup(); |
| | | SysJob properties = selectJobById(job.getJobId()); |
| | | // åæ° |
| | | JobDataMap dataMap = new JobDataMap(); |
| | | dataMap.put(ScheduleConstants.TASK_PROPERTIES, properties); |
| | | scheduler.triggerJob(ScheduleUtils.getJobKey(jobId, jobGroup), dataMap); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ä»»å¡ |
| | | * |
| | | * @param job è°åº¦ä¿¡æ¯ è°åº¦ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int insertJob(SysJob job) throws SchedulerException, TaskException |
| | | { |
| | | job.setStatus(ScheduleConstants.Status.PAUSE.getValue()); |
| | | int rows = jobMapper.insertJob(job); |
| | | if (rows > 0) |
| | | { |
| | | ScheduleUtils.createScheduleJob(scheduler, job); |
| | | } |
| | | return rows; |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°ä»»å¡çæ¶é´è¡¨è¾¾å¼ |
| | | * |
| | | * @param job è°åº¦ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int updateJob(SysJob job) throws SchedulerException, TaskException |
| | | { |
| | | SysJob properties = selectJobById(job.getJobId()); |
| | | int rows = jobMapper.updateJob(job); |
| | | if (rows > 0) |
| | | { |
| | | updateSchedulerJob(job, properties.getJobGroup()); |
| | | } |
| | | return rows; |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°ä»»å¡ |
| | | * |
| | | * @param job ä»»å¡å¯¹è±¡ |
| | | * @param jobGroup ä»»å¡ç»å |
| | | */ |
| | | public void updateSchedulerJob(SysJob job, String jobGroup) throws SchedulerException, TaskException |
| | | { |
| | | Long jobId = job.getJobId(); |
| | | // 夿æ¯å¦åå¨ |
| | | JobKey jobKey = ScheduleUtils.getJobKey(jobId, jobGroup); |
| | | if (scheduler.checkExists(jobKey)) |
| | | { |
| | | // 鲿¢å建æ¶å卿°æ®é®é¢ å
ç§»é¤ï¼ç¶å卿§è¡å建æä½ |
| | | scheduler.deleteJob(jobKey); |
| | | } |
| | | ScheduleUtils.createScheduleJob(scheduler, job); |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªcronè¡¨è¾¾å¼æ¯å¦ææ |
| | | * |
| | | * @param cronExpression è¡¨è¾¾å¼ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public boolean checkCronExpressionIsValid(String cronExpression) |
| | | { |
| | | return CronUtils.isValid(cronExpression); |
| | | } |
| | | } |
| | |
| | | # åç§°
|
| | | name: RuoYi
|
| | | # çæ¬
|
| | | version: 2.1.0
|
| | | version: 2.2.0
|
| | | # çæå¹´ä»½
|
| | | copyrightYear: 2019
|
| | | # å®ä¾æ¼ç¤ºå¼å
³
|
| | |
| | | max-threads: 800
|
| | | # Tomcatå¯å¨åå§åççº¿ç¨æ°ï¼é»è®¤å¼25
|
| | | min-spare-threads: 30
|
| | |
|
| | |
|
| | | # æ¥å¿é
ç½®
|
| | | logging:
|
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.project.monitor.mapper.SysJobLogMapper"> |
| | | |
| | | <resultMap type="SysJobLog" id="SysJobLogResult"> |
| | | <id property="jobLogId" column="job_log_id" /> |
| | | <result property="jobName" column="job_name" /> |
| | | <result property="jobGroup" column="job_group" /> |
| | | <result property="invokeTarget" column="invoke_target" /> |
| | | <result property="jobMessage" column="job_message" /> |
| | | <result property="status" column="status" /> |
| | | <result property="exceptionInfo" column="exception_info" /> |
| | | <result property="createTime" column="create_time" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectJobLogVo"> |
| | | select job_log_id, job_name, job_group, invoke_target, job_message, status, exception_info, create_time |
| | | from sys_job_log |
| | | </sql> |
| | | |
| | | <select id="selectJobLogList" parameterType="SysJobLog" resultMap="SysJobLogResult"> |
| | | <include refid="selectJobLogVo"/> |
| | | <where> |
| | | <if test="jobName != null and jobName != ''"> |
| | | AND job_name like concat('%', #{jobName}, '%') |
| | | </if> |
| | | <if test="jobGroup != null and jobGroup != ''"> |
| | | AND job_group = #{jobGroup} |
| | | </if> |
| | | <if test="status != null and status != ''"> |
| | | AND status = #{status} |
| | | </if> |
| | | <if test="invokeTarget != null and invokeTarget != ''"> |
| | | AND invoke_target like concat('%', #{invokeTarget}, '%') |
| | | </if> |
| | | <if test="beginTime != null and beginTime != ''"><!-- å¼å§æ¶é´æ£ç´¢ --> |
| | | and date_format(create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d') |
| | | </if> |
| | | <if test="endTime != null and endTime != ''"><!-- ç»ææ¶é´æ£ç´¢ --> |
| | | and date_format(create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectJobLogAll" resultMap="SysJobLogResult"> |
| | | <include refid="selectJobLogVo"/> |
| | | </select> |
| | | |
| | | <select id="selectJobLogById" parameterType="Long" resultMap="SysJobLogResult"> |
| | | <include refid="selectJobLogVo"/> |
| | | where job_log_id = #{jobLogId} |
| | | </select> |
| | | |
| | | <delete id="deleteJobLogById" parameterType="Long"> |
| | | delete from sys_job_log where job_log_id = #{jobLogId} |
| | | </delete> |
| | | |
| | | <delete id="deleteJobLogByIds" parameterType="Long"> |
| | | delete from sys_job_log where job_log_id in |
| | | <foreach collection="array" item="jobLogId" open="(" separator="," close=")"> |
| | | #{jobLogId} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <update id="cleanJobLog"> |
| | | truncate table sys_job_log |
| | | </update> |
| | | |
| | | <insert id="insertJobLog" parameterType="SysJobLog"> |
| | | insert into sys_job_log( |
| | | <if test="jobLogId != null and jobLogId != 0">job_log_id,</if> |
| | | <if test="jobName != null and jobName != ''">job_name,</if> |
| | | <if test="jobGroup != null and jobGroup != ''">job_group,</if> |
| | | <if test="invokeTarget != null and invokeTarget != ''">invoke_target,</if> |
| | | <if test="jobMessage != null and jobMessage != ''">job_message,</if> |
| | | <if test="status != null and status != ''">status,</if> |
| | | <if test="exceptionInfo != null and exceptionInfo != ''">exception_info,</if> |
| | | create_time |
| | | )values( |
| | | <if test="jobLogId != null and jobLogId != 0">#{jobLogId},</if> |
| | | <if test="jobName != null and jobName != ''">#{jobName},</if> |
| | | <if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if> |
| | | <if test="invokeTarget != null and invokeTarget != ''">#{invokeTarget},</if> |
| | | <if test="jobMessage != null and jobMessage != ''">#{jobMessage},</if> |
| | | <if test="status != null and status != ''">#{status},</if> |
| | | <if test="exceptionInfo != null and exceptionInfo != ''">#{exceptionInfo},</if> |
| | | sysdate() |
| | | ) |
| | | </insert> |
| | | |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.project.monitor.mapper.SysJobMapper"> |
| | | |
| | | <resultMap type="SysJob" id="SysJobResult"> |
| | | <id property="jobId" column="job_id" /> |
| | | <result property="jobName" column="job_name" /> |
| | | <result property="jobGroup" column="job_group" /> |
| | | <result property="invokeTarget" column="invoke_target" /> |
| | | <result property="cronExpression" column="cron_expression" /> |
| | | <result property="misfirePolicy" column="misfire_policy" /> |
| | | <result property="concurrent" column="concurrent" /> |
| | | <result property="status" column="status" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="remark" column="remark" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectJobVo"> |
| | | select job_id, job_name, job_group, invoke_target, cron_expression, misfire_policy, concurrent, status, create_by, create_time, remark |
| | | from sys_job |
| | | </sql> |
| | | |
| | | <select id="selectJobList" parameterType="SysJob" resultMap="SysJobResult"> |
| | | <include refid="selectJobVo"/> |
| | | <where> |
| | | <if test="jobName != null and jobName != ''"> |
| | | AND job_name like concat('%', #{jobName}, '%') |
| | | </if> |
| | | <if test="jobGroup != null and jobGroup != ''"> |
| | | AND job_group = #{jobGroup} |
| | | </if> |
| | | <if test="status != null and status != ''"> |
| | | AND status = #{status} |
| | | </if> |
| | | <if test="invokeTarget != null and invokeTarget != ''"> |
| | | AND invoke_target like concat('%', #{invokeTarget}, '%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectJobAll" resultMap="SysJobResult"> |
| | | <include refid="selectJobVo"/> |
| | | </select> |
| | | |
| | | <select id="selectJobById" parameterType="Long" resultMap="SysJobResult"> |
| | | <include refid="selectJobVo"/> |
| | | where job_id = #{jobId} |
| | | </select> |
| | | |
| | | <delete id="deleteJobById" parameterType="Long"> |
| | | delete from sys_job where job_id = #{jobId} |
| | | </delete> |
| | | |
| | | <delete id="deleteJobByIds" parameterType="Long"> |
| | | delete from sys_job where job_id in |
| | | <foreach collection="array" item="jobId" open="(" separator="," close=")"> |
| | | #{jobId} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <update id="updateJob" parameterType="SysJob"> |
| | | update sys_job |
| | | <set> |
| | | <if test="jobName != null and jobName != ''">job_name = #{jobName},</if> |
| | | <if test="jobGroup != null and jobGroup != ''">job_group = #{jobGroup},</if> |
| | | <if test="invokeTarget != null and invokeTarget != ''">invoke_target = #{invokeTarget},</if> |
| | | <if test="cronExpression != null and cronExpression != ''">cron_expression = #{cronExpression},</if> |
| | | <if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy = #{misfirePolicy},</if> |
| | | <if test="concurrent != null and concurrent != ''">concurrent = #{concurrent},</if> |
| | | <if test="status !=null">status = #{status},</if> |
| | | <if test="remark != null and remark != ''">remark = #{remark},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | | where job_id = #{jobId} |
| | | </update> |
| | | |
| | | <insert id="insertJob" parameterType="SysJob" useGeneratedKeys="true" keyProperty="jobId"> |
| | | insert into sys_job( |
| | | <if test="jobId != null and jobId != 0">job_id,</if> |
| | | <if test="jobName != null and jobName != ''">job_name,</if> |
| | | <if test="jobGroup != null and jobGroup != ''">job_group,</if> |
| | | <if test="invokeTarget != null and invokeTarget != ''">invoke_target,</if> |
| | | <if test="cronExpression != null and cronExpression != ''">cron_expression,</if> |
| | | <if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy,</if> |
| | | <if test="concurrent != null and concurrent != ''">concurrent,</if> |
| | | <if test="status != null and status != ''">status,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | create_time |
| | | )values( |
| | | <if test="jobId != null and jobId != 0">#{jobId},</if> |
| | | <if test="jobName != null and jobName != ''">#{jobName},</if> |
| | | <if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if> |
| | | <if test="invokeTarget != null and invokeTarget != ''">#{invokeTarget},</if> |
| | | <if test="cronExpression != null and cronExpression != ''">#{cronExpression},</if> |
| | | <if test="misfirePolicy != null and misfirePolicy != ''">#{misfirePolicy},</if> |
| | | <if test="concurrent != null and concurrent != ''">#{concurrent},</if> |
| | | <if test="status != null and status != ''">#{status},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | | ) |
| | | </insert> |
| | | |
| | | </mapper> |