修改 定时任务 2021年11月12日12:02:06
parent
09f4d9be0c
commit
17f9e600b1
|
|
@ -228,7 +228,6 @@ public class UrlRequestController extends BaseController {
|
||||||
return this.jumpPage("admin/permission/add");
|
return this.jumpPage("admin/permission/add");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiIgnore
|
|
||||||
@GetMapping("/permission/edit")
|
@GetMapping("/permission/edit")
|
||||||
public ModelAndView permission_edit(Model model, String permissionId) {
|
public ModelAndView permission_edit(Model model, String permissionId) {
|
||||||
if (CommonUtil.isNotNull(permissionId)) {
|
if (CommonUtil.isNotNull(permissionId)) {
|
||||||
|
|
@ -239,7 +238,6 @@ public class UrlRequestController extends BaseController {
|
||||||
return this.jumpPage("admin/permission/edit");
|
return this.jumpPage("admin/permission/edit");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiIgnore
|
|
||||||
@GetMapping("/article/index")
|
@GetMapping("/article/index")
|
||||||
public ModelAndView article_index(Model model,Long categoryId) {
|
public ModelAndView article_index(Model model,Long categoryId) {
|
||||||
List<Category> categoryList = this.categoryFeign.findAll();
|
List<Category> categoryList = this.categoryFeign.findAll();
|
||||||
|
|
@ -248,7 +246,6 @@ public class UrlRequestController extends BaseController {
|
||||||
return this.jumpPage("admin/article/list");
|
return this.jumpPage("admin/article/list");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiIgnore
|
|
||||||
@GetMapping("/article/add")
|
@GetMapping("/article/add")
|
||||||
public ModelAndView article_add(Model model) {
|
public ModelAndView article_add(Model model) {
|
||||||
//查询分类
|
//查询分类
|
||||||
|
|
@ -257,7 +254,6 @@ public class UrlRequestController extends BaseController {
|
||||||
return this.jumpPage("admin/article/add");
|
return this.jumpPage("admin/article/add");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiIgnore
|
|
||||||
@GetMapping("/article/edit")
|
@GetMapping("/article/edit")
|
||||||
public ModelAndView article_edit(Model model,String articleId) {
|
public ModelAndView article_edit(Model model,String articleId) {
|
||||||
if (CommonUtil.isNotNull(articleId)){
|
if (CommonUtil.isNotNull(articleId)){
|
||||||
|
|
@ -310,13 +306,11 @@ public class UrlRequestController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiIgnore
|
|
||||||
@GetMapping("/quartz/index")
|
@GetMapping("/quartz/index")
|
||||||
public ModelAndView quartz_index(){
|
public ModelAndView quartz_index(){
|
||||||
return this.jumpPage("admin/job/job-list");
|
return this.jumpPage("admin/job/job-list");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiIgnore
|
|
||||||
@GetMapping("/quartz/add")
|
@GetMapping("/quartz/add")
|
||||||
public ModelAndView quartz_add(Model model){
|
public ModelAndView quartz_add(Model model){
|
||||||
Set<String> names = this.quartzFeign.spring_bean_list();
|
Set<String> names = this.quartzFeign.spring_bean_list();
|
||||||
|
|
@ -324,7 +318,6 @@ public class UrlRequestController extends BaseController {
|
||||||
return this.jumpPage("admin/job/job-add");
|
return this.jumpPage("admin/job/job-add");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiIgnore
|
|
||||||
@GetMapping("/quartz/edit")
|
@GetMapping("/quartz/edit")
|
||||||
public ModelAndView quartz_edit(Model model,String jobId){
|
public ModelAndView quartz_edit(Model model,String jobId){
|
||||||
Set<String> names = this.quartzFeign.spring_bean_list();
|
Set<String> names = this.quartzFeign.spring_bean_list();
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,13 @@ var user_oauth_url = "mystyle-cloud-oauth";
|
||||||
var blog_url = "mystyle-cloud-blog";
|
var blog_url = "mystyle-cloud-blog";
|
||||||
//文件微服务
|
//文件微服务
|
||||||
var file_url = "mystyle-cloud-file";
|
var file_url = "mystyle-cloud-file";
|
||||||
|
//定时任务微服务
|
||||||
|
var quartz_url = "mystyle-cloud-quartz";
|
||||||
//验证码
|
//验证码
|
||||||
var v_code = gate_way_url + "/" + admin_manager_url + "/verificationCode/generate";
|
var v_code = gate_way_url + "/" + admin_manager_url + "/verificationCode/generate";
|
||||||
var access_token = localStorage.getItem("access_token");
|
var access_token = localStorage.getItem("access_token");
|
||||||
var access_token_url = "?access_token=" + access_token;
|
var access_token_url = "?access_token=" + access_token;
|
||||||
|
var Authorization = "bearer " + access_token;
|
||||||
//获取当前用户
|
//获取当前用户
|
||||||
var current_user_url = gate_way_url + "/" + admin_manager_url + "/user/current" + access_token_url;
|
var current_user_url = gate_way_url + "/" + admin_manager_url + "/user/current" + access_token_url;
|
||||||
//登录地址
|
//登录地址
|
||||||
|
|
@ -93,7 +96,21 @@ var category_delete_url = gate_way_url + "/" + blog_url + "/category/delete";
|
||||||
var category_batchRemove_url = gate_way_url + "/" + blog_url + "/category/batchRemove";
|
var category_batchRemove_url = gate_way_url + "/" + blog_url + "/category/batchRemove";
|
||||||
//分类保存
|
//分类保存
|
||||||
var category_save_url = gate_way_url + "/" + blog_url + "/category/save";
|
var category_save_url = gate_way_url + "/" + blog_url + "/category/save";
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
//定时任务
|
||||||
|
var quartz_list_url = gate_way_url + "/" + quartz_url + "/quartz/list";
|
||||||
|
//新增定时任务
|
||||||
|
var quartz_add_url = gate_way_url + "/" + admin_manager_url + "/quartz/add" + access_token_url;
|
||||||
|
//保存定时任务
|
||||||
|
var quartz_save_url = gate_way_url + "/" + quartz_url + "/quartz/save";
|
||||||
|
//编辑定时任务
|
||||||
|
var quartz_edit_url = gate_way_url + "/" + admin_manager_url + "/quartz/edit" + access_token_url;
|
||||||
|
//校验cron 表达式
|
||||||
|
var checkCron_url = gate_way_url + "/" + quartz_url + "/quartz/cron" + access_token_url;
|
||||||
|
//定时任务删除
|
||||||
|
var quartz_delete_url = gate_way_url + "/" + quartz_url + "/quartz/delete" ;
|
||||||
|
//定时任务批量删除
|
||||||
|
var quartz_batchRemove_url = gate_way_url + "/" + quartz_url + "/quartz/batchRemove" ;
|
||||||
|
|
||||||
//页面跳转
|
//页面跳转
|
||||||
function postToPage(url, token) {
|
function postToPage(url, token) {
|
||||||
|
|
|
||||||
|
|
@ -26,3 +26,7 @@
|
||||||
@import url("module/card.css");
|
@import url("module/card.css");
|
||||||
@import url("module/tab.css");
|
@import url("module/tab.css");
|
||||||
@import url("module/tag.css");
|
@import url("module/tag.css");
|
||||||
|
|
||||||
|
.layui-table-header, .layui-table-header th {
|
||||||
|
background-color: #e2e2e2 !important;
|
||||||
|
}
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>定时任务添加</title>
|
<title>定时任务添加</title>
|
||||||
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/system/component/pear/css/pear.css" />
|
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/css/pear.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form class="layui-form" action="">
|
<form class="layui-form" action="">
|
||||||
|
|
@ -61,9 +61,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<script src="${springMacroRequestContext.contextPath}/system/component/layui/layui.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/layui/layui.js"></script>
|
||||||
<script src="${springMacroRequestContext.contextPath}/js/jquery.min.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/js/jquery.min.js"></script>
|
||||||
<script src="${springMacroRequestContext.contextPath}/system/component/pear/pear.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/pear.js"></script>
|
||||||
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/admin/js/mystyle-admin.js"></script>
|
||||||
<script>
|
<script>
|
||||||
layui.use(['form','jquery'],function(){
|
layui.use(['form','jquery'],function(){
|
||||||
let form = layui.form;
|
let form = layui.form;
|
||||||
|
|
@ -71,10 +72,10 @@
|
||||||
|
|
||||||
form.on('submit(job-save)', function(data){
|
form.on('submit(job-save)', function(data){
|
||||||
var obj = data.field;
|
var obj = data.field;
|
||||||
obj['token'] = localStorage.getItem("token");
|
obj['access_token'] = access_token;
|
||||||
// 请求后台
|
// 请求后台
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/job/save",
|
url: quartz_save_url,
|
||||||
type: "post",
|
type: "post",
|
||||||
data: obj,
|
data: obj,
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>定时任务修改</title>
|
<title>定时任务修改</title>
|
||||||
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/system/component/pear/css/pear.css"/>
|
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/css/pear.css"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form class="layui-form" action="">
|
<form class="layui-form" action="">
|
||||||
|
|
@ -73,9 +73,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<script src="${springMacroRequestContext.contextPath}/system/component/layui/layui.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/layui/layui.js"></script>
|
||||||
<script src="${springMacroRequestContext.contextPath}/js/jquery.min.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/js/jquery.min.js"></script>
|
||||||
<script src="${springMacroRequestContext.contextPath}/system/component/pear/pear.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/pear.js"></script>
|
||||||
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/admin/js/mystyle-admin.js"></script>
|
||||||
<script>
|
<script>
|
||||||
layui.use(['form', 'jquery'], function () {
|
layui.use(['form', 'jquery'], function () {
|
||||||
let form = layui.form;
|
let form = layui.form;
|
||||||
|
|
@ -83,20 +84,20 @@
|
||||||
|
|
||||||
form.on('submit(job-save)', function (data) {
|
form.on('submit(job-save)', function (data) {
|
||||||
var obj = data.field;
|
var obj = data.field;
|
||||||
obj['token'] = localStorage.getItem("token");
|
obj['access_token'] = access_token;
|
||||||
// 请求后台
|
// 请求后台
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/job/save",
|
url: quartz_save_url,
|
||||||
type: "post",
|
type: "post",
|
||||||
data: obj,
|
data: obj,
|
||||||
success: function (response) {
|
success: function (result) {
|
||||||
if (result.flag) {
|
if (result.flag) {
|
||||||
layer.msg(result.message, {icon: 1, time: 1000}, function () {
|
layer.msg(result.message, {icon: 1, time: 1000}, function () {
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
|
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
|
||||||
parent.layui.table.reload("user-table");
|
parent.layui.table.reload("user-table");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
layer.msg(result.msg, {icon: 2, time: 1000});
|
layer.msg(result.message, {icon: 2, time: 1000});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (xhr, textStatus, errorThrown) {
|
error: function (xhr, textStatus, errorThrown) {
|
||||||
|
|
@ -115,7 +116,7 @@
|
||||||
if (cron != "") {
|
if (cron != "") {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'get',
|
type: 'get',
|
||||||
url: '/job/cron?cron=' + cron + "&token=" + localStorage.getItem("token"),
|
url: checkCron_url + "&cron=" + cron,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
var msg = "正确";
|
var msg = "正确";
|
||||||
if (!data) {
|
if (!data) {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>定时任务列表</title>
|
<title>定时任务列表</title>
|
||||||
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/system/component/pear/css/pear.css"/>
|
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/css/pear.css"/>
|
||||||
</head>
|
</head>
|
||||||
<body class="pear-container">
|
<body class="pear-container">
|
||||||
<div class="layui-card">
|
<div class="layui-card">
|
||||||
|
|
@ -82,8 +82,9 @@
|
||||||
{{layui.util.toDateString(d.addTime, 'yyyy-MM-dd HH:mm:ss')}}
|
{{layui.util.toDateString(d.addTime, 'yyyy-MM-dd HH:mm:ss')}}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="${springMacroRequestContext.contextPath}/system/component/layui/layui.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/layui/layui.js"></script>
|
||||||
<script src="${springMacroRequestContext.contextPath}/system/component/pear/pear.js"></script>
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/pear.js"></script>
|
||||||
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/admin/js/mystyle-admin.js"></script>
|
||||||
<script>
|
<script>
|
||||||
layui.use(['table', 'form', 'jquery', 'common', 'laydate'], function () {
|
layui.use(['table', 'form', 'jquery', 'common', 'laydate'], function () {
|
||||||
let table = layui.table;
|
let table = layui.table;
|
||||||
|
|
@ -91,7 +92,6 @@
|
||||||
let $ = layui.jquery;
|
let $ = layui.jquery;
|
||||||
let common = layui.common;
|
let common = layui.common;
|
||||||
var laydate = layui.laydate;
|
var laydate = layui.laydate;
|
||||||
let token = localStorage.getItem("token");
|
|
||||||
let cols = [
|
let cols = [
|
||||||
[{
|
[{
|
||||||
type: 'checkbox'
|
type: 'checkbox'
|
||||||
|
|
@ -145,11 +145,13 @@
|
||||||
|
|
||||||
table.render({
|
table.render({
|
||||||
elem: '#job-table',
|
elem: '#job-table',
|
||||||
url: '/job/list',
|
url: quartz_list_url,
|
||||||
headers: {token: localStorage.getItem("token")},
|
headers: {
|
||||||
|
access_token : access_token
|
||||||
|
},
|
||||||
page: true,
|
page: true,
|
||||||
cols: cols,
|
cols: cols,
|
||||||
skin: 'line',
|
skin: 'rows',
|
||||||
toolbar: '#job-toolbar',
|
toolbar: '#job-toolbar',
|
||||||
defaultToolbar: [{
|
defaultToolbar: [{
|
||||||
title: '刷新',
|
title: '刷新',
|
||||||
|
|
@ -212,7 +214,7 @@
|
||||||
title: '添加定时任务',
|
title: '添加定时任务',
|
||||||
shade: 0.1,
|
shade: 0.1,
|
||||||
area: [common.isModile() ? '100%' : '900px', common.isModile() ? '100%' : '600px'],
|
area: [common.isModile() ? '100%' : '900px', common.isModile() ? '100%' : '600px'],
|
||||||
content: '/job/add?token=' + token
|
content: quartz_add_url
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -222,7 +224,7 @@
|
||||||
title: '修改',
|
title: '修改',
|
||||||
shade: 0.1,
|
shade: 0.1,
|
||||||
area: ['900px', '600px'],
|
area: ['900px', '600px'],
|
||||||
content: '/job/edit?jobId=' + obj.data.id + '&token=' + localStorage.getItem("token")
|
content: quartz_edit_url + '&jobId=' + obj.data.id
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -235,10 +237,10 @@
|
||||||
let loading = layer.load();
|
let loading = layer.load();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/job/delete",
|
url: quartz_delete_url,
|
||||||
data: {
|
data: {
|
||||||
jobId: obj.data['id'],
|
jobId: obj.data['id'],
|
||||||
token: token
|
access_token: access_token
|
||||||
},
|
},
|
||||||
type: 'post',
|
type: 'post',
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
|
|
@ -277,11 +279,11 @@
|
||||||
layer.close(index);
|
layer.close(index);
|
||||||
let loading = layer.load();
|
let loading = layer.load();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/job/batchRemove",
|
url:quartz_batchRemove_url,
|
||||||
type: 'post',
|
type: 'post',
|
||||||
data: {
|
data: {
|
||||||
ids: checkIds,
|
ids: checkIds,
|
||||||
token:token
|
access_token:access_token
|
||||||
},
|
},
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
layer.close(loading);
|
layer.close(loading);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ public interface QuartzControllerApi {
|
||||||
public Result update(@RequestBody QuartzJob job);
|
public Result update(@RequestBody QuartzJob job);
|
||||||
|
|
||||||
@ApiOperation("根据id获取定时任务")
|
@ApiOperation("根据id获取定时任务")
|
||||||
public QuartzJob getById(@PathVariable Long id);
|
public QuartzJob findById(@PathVariable Long id);
|
||||||
|
|
||||||
@ApiOperation("删除定时任务")
|
@ApiOperation("删除定时任务")
|
||||||
public Result delete( @RequestParam("jobId") Long jobId);
|
public Result delete( @RequestParam("jobId") Long jobId);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
package com.zhangmeng.quartz.config;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
|
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
|
||||||
|
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
|
||||||
|
import org.springframework.security.oauth2.provider.token.TokenStore;
|
||||||
|
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
|
||||||
|
import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 转身的背影在心底里沉沦
|
||||||
|
* @date 2021年9月14日16:45:29
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@EnableResourceServer
|
||||||
|
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)// 激活方法上的PreAuthorize注解
|
||||||
|
public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
|
||||||
|
|
||||||
|
// 公钥
|
||||||
|
private static final String PUBLIC_KEY = "public.key";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SecurityProperty securityProperty;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 定义JwtTokenStore
|
||||||
|
* @param jwtAccessTokenConverter
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public TokenStore tokenStore(JwtAccessTokenConverter jwtAccessTokenConverter) {
|
||||||
|
return new JwtTokenStore(jwtAccessTokenConverter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 定义JJwtAccessTokenConverter
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public JwtAccessTokenConverter jwtAccessTokenConverter() {
|
||||||
|
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
|
||||||
|
converter.setVerifierKey(getPubKey()); //秘钥的一部分
|
||||||
|
return converter;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取非对称加密公钥 Key
|
||||||
|
* @return 公钥 Key
|
||||||
|
*/
|
||||||
|
private String getPubKey() {
|
||||||
|
Resource resource = new ClassPathResource(PUBLIC_KEY);
|
||||||
|
try {
|
||||||
|
InputStreamReader inputStreamReader = new InputStreamReader(resource.getInputStream());
|
||||||
|
BufferedReader br = new BufferedReader(inputStreamReader);
|
||||||
|
return br.lines().collect(Collectors.joining("\n"));
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* SpringSecurity
|
||||||
|
* Http安全配置,对每个到达系统的http请求链接进行校验
|
||||||
|
* @param http
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void configure(HttpSecurity http) throws Exception {
|
||||||
|
|
||||||
|
http.headers().frameOptions().disable();
|
||||||
|
|
||||||
|
// 所有请求必须认证通过
|
||||||
|
http.authorizeRequests()
|
||||||
|
// 跨域预检请求
|
||||||
|
.antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
|
||||||
|
.anyRequest().
|
||||||
|
authenticated(); // 其他地址需要认证授权
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
package com.zhangmeng.quartz.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 转身的背影在心底里沉沦
|
||||||
|
* @date 2021年9月14日16:50:47
|
||||||
|
* @version 1.0
|
||||||
|
* */
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties("mystyle.security")
|
||||||
|
public class SecurityProperty {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 超级管理员不认证
|
||||||
|
* */
|
||||||
|
private boolean superAuthOpen;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不验证权限用户名
|
||||||
|
* */
|
||||||
|
private String superAdmin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记住密码标识
|
||||||
|
* */
|
||||||
|
private String rememberKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开放接口列表
|
||||||
|
* */
|
||||||
|
private String[] openApi;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否允许多账号在线
|
||||||
|
* */
|
||||||
|
private Integer maximum = 1;
|
||||||
|
|
||||||
|
public boolean isSuperAuthOpen() {
|
||||||
|
return superAuthOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuperAuthOpen(boolean superAuthOpen) {
|
||||||
|
this.superAuthOpen = superAuthOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSuperAdmin() {
|
||||||
|
return superAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuperAdmin(String superAdmin) {
|
||||||
|
this.superAdmin = superAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRememberKey() {
|
||||||
|
return rememberKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRememberKey(String rememberKey) {
|
||||||
|
this.rememberKey = rememberKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getOpenApi() {
|
||||||
|
return openApi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenApi(String[] openApi) {
|
||||||
|
this.openApi = openApi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMaximum() {
|
||||||
|
return maximum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaximum(Integer maximum) {
|
||||||
|
this.maximum = maximum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -97,9 +97,9 @@ public class QuartzController extends BaseController implements QuartzController
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/findById")
|
||||||
public QuartzJob getById(@PathVariable Long id) {
|
public QuartzJob findById(@RequestParam("jobId") Long jobId){
|
||||||
return this.quartzJobService.findById(id);
|
return this.quartzJobService.findById(jobId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ public class QuartzJobServiceImpl extends AbstractBaseServiceImpl<QuartzJob> imp
|
||||||
} else {
|
} else {
|
||||||
scheduler.scheduleJob(jobDetail, cronTrigger);
|
scheduler.scheduleJob(jobDetail, cronTrigger);
|
||||||
}
|
}
|
||||||
Condition condition = new Condition(Job.class);
|
Condition condition = new Condition(QuartzJob.class);
|
||||||
Example.Criteria criteria = condition.createCriteria();
|
Example.Criteria criteria = condition.createCriteria();
|
||||||
criteria.andEqualTo("jobName",name);
|
criteria.andEqualTo("jobName",name);
|
||||||
List<QuartzJob> jobs = this.findByCondition(condition);
|
List<QuartzJob> jobs = this.findByCondition(condition);
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,28 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 127.0.0.1:8848
|
||||||
|
quartz:
|
||||||
|
properties:
|
||||||
|
org:
|
||||||
|
quartz:
|
||||||
|
scheduler:
|
||||||
|
instanceName: DefaultQuartzScheduler
|
||||||
|
instanceId: AUTO
|
||||||
|
jobStore:
|
||||||
|
class: org.quartz.impl.jdbcjobstore.JobStoreTX
|
||||||
|
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
|
||||||
|
tablePrefix: QRTZ_
|
||||||
|
isClustered: false
|
||||||
|
clusterCheckinInterval: 10000
|
||||||
|
useProperties: false
|
||||||
|
threadPool:
|
||||||
|
class: org.quartz.simpl.SimpleThreadPool
|
||||||
|
threadCount: 10
|
||||||
|
threadPriority: 5
|
||||||
|
threadsInheritContextClassLoaderOfInitializingThread: true
|
||||||
|
job-store-type: jdbc
|
||||||
|
jdbc:
|
||||||
|
initialize-schema: always
|
||||||
feign:
|
feign:
|
||||||
sentinel:
|
sentinel:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue