Merge remote-tracking branch 'origin/feature/1.4.0'
This commit is contained in:
@@ -36,7 +36,7 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* asgc编译器
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/8/17
|
||||
*/
|
||||
@@ -58,10 +58,17 @@ public class AsgcCompiler {
|
||||
private final List<Diagnostic<? extends JavaFileObject>> errors = new ArrayList<Diagnostic<? extends JavaFileObject>>();
|
||||
private final List<Diagnostic<? extends JavaFileObject>> warnings = new ArrayList<Diagnostic<? extends JavaFileObject>>();
|
||||
|
||||
/**
|
||||
* 构造编译器
|
||||
*/
|
||||
public AsgcCompiler() {
|
||||
this(ClassLoader.getSystemClassLoader());
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造编译器
|
||||
* @param classLoader
|
||||
*/
|
||||
public AsgcCompiler(ClassLoader classLoader) {
|
||||
if (null == javaCompiler) {
|
||||
throw new RuntimeException("Can not load JavaCompiler from javax.tools.ToolProvider#getSystemJavaCompiler(),\n please confirm the application running in JDK not JRE.");
|
||||
@@ -78,6 +85,10 @@ public class AsgcCompiler {
|
||||
addOption("-target", "1.8");
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加类路径
|
||||
* @param classpath
|
||||
*/
|
||||
public void addClasspath(String classpath) {
|
||||
if (this.classpathList.contains(classpath)) {
|
||||
return;
|
||||
@@ -85,18 +96,34 @@ public class AsgcCompiler {
|
||||
this.classpathList.add(classpath);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否保存类文件
|
||||
* @param saveClassFile
|
||||
*/
|
||||
public void setSaveClassFile(boolean saveClassFile) {
|
||||
this.isSaveClassFile = saveClassFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否保存源代码文件
|
||||
* @param saveSourceCodeFile
|
||||
*/
|
||||
public void setSaveSourceCodeFile(boolean saveSourceCodeFile) {
|
||||
isSaveSourceCodeFile = saveSourceCodeFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置保存代码路径
|
||||
* @param generatorCodeSavePath
|
||||
*/
|
||||
public void setGeneratorCodeSavePath(String generatorCodeSavePath) {
|
||||
this.generatorCodeSavePath = generatorCodeSavePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取options
|
||||
* @return
|
||||
*/
|
||||
private List<String> getOptions() {
|
||||
List<String> list = Lists.newArrayList(options);
|
||||
List<String> cp = getClasspathList();
|
||||
@@ -107,19 +134,37 @@ public class AsgcCompiler {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加option
|
||||
* @param option
|
||||
*/
|
||||
private void addOption(String option) {
|
||||
this.options.add(option);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加option
|
||||
* @param key
|
||||
* @param val
|
||||
*/
|
||||
private void addOption(String key, String val) {
|
||||
this.options.add(key);
|
||||
this.options.add(val);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加源代码
|
||||
* @param className
|
||||
* @param source
|
||||
*/
|
||||
private void addSource(String className, String source) {
|
||||
addSource(new StringSource(className, source));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加源代码
|
||||
* @param javaFileObject
|
||||
*/
|
||||
private void addSource(JavaFileObject javaFileObject) {
|
||||
compilationUnits.add(javaFileObject);
|
||||
}
|
||||
@@ -165,6 +210,11 @@ public class AsgcCompiler {
|
||||
return dynamicClassLoader.findClass(pkg + "." + className);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取编译诊断信息
|
||||
* @param diagnostics
|
||||
* @return
|
||||
*/
|
||||
private List<String> diagnosticToString(List<Diagnostic<? extends JavaFileObject>> diagnostics) {
|
||||
|
||||
List<String> diagnosticMessages = new ArrayList<String>();
|
||||
@@ -178,14 +228,25 @@ public class AsgcCompiler {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取异常信息
|
||||
* @return
|
||||
*/
|
||||
public List<String> getErrors() {
|
||||
return diagnosticToString(errors);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取警告信息
|
||||
* @return
|
||||
*/
|
||||
public List<String> getWarnings() {
|
||||
return diagnosticToString(warnings);
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印编译日志
|
||||
*/
|
||||
private void log() {
|
||||
List<String> warnings = getWarnings();
|
||||
List<String> errors = getErrors();
|
||||
@@ -193,10 +254,14 @@ public class AsgcCompiler {
|
||||
// log.warn(warnings.stream().collect(Collectors.joining()));
|
||||
// }
|
||||
if (!CollectionUtil.isEmpty(errors)) {
|
||||
log.warn(errors.stream().collect(Collectors.joining()));
|
||||
log.error(errors.stream().collect(Collectors.joining()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取URL类路径加载器
|
||||
* @return
|
||||
*/
|
||||
private URLClassLoader getURLClassLoader() {
|
||||
ClassLoader ret = Thread.currentThread().getContextClassLoader();
|
||||
if (null == ret) {
|
||||
@@ -205,6 +270,10 @@ public class AsgcCompiler {
|
||||
return (ret instanceof URLClassLoader) ? (URLClassLoader)ret : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取类路径列表
|
||||
* @return
|
||||
*/
|
||||
public List<String> getClasspathList() {
|
||||
List<String> classpathList = new ArrayList<>();
|
||||
List<String> defaultClasspathList = getDefaultClasspathList();
|
||||
@@ -218,6 +287,10 @@ public class AsgcCompiler {
|
||||
return classpathList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取默认的类路径列表
|
||||
* @return
|
||||
*/
|
||||
private synchronized List<String> getDefaultClasspathList() {
|
||||
if (!CollectionUtil.isEmpty(defaultClassPathList)) {
|
||||
return defaultClassPathList;
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ import java.io.*;
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
*
|
||||
* 自定义java文件对象
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/8/25
|
||||
*/
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
/**
|
||||
*
|
||||
* 动态类加载器
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/8/25
|
||||
*/
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* 动态java文件管理器
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/8/17
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
/**
|
||||
*
|
||||
* 内存字节码
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/8/25
|
||||
*/
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ import java.util.List;
|
||||
import java.util.jar.JarEntry;
|
||||
|
||||
/**
|
||||
*
|
||||
* 包内部查询器
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/8/25
|
||||
*/
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
*
|
||||
* 字符串源码
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/8/25
|
||||
*/
|
||||
|
||||
+2
-2
@@ -19,9 +19,10 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.core.bean;
|
||||
package fun.asgc.neutrino.core.bean.factory;
|
||||
|
||||
import fun.asgc.neutrino.core.base.CustomThreadFactory;
|
||||
import fun.asgc.neutrino.core.bean.*;
|
||||
import fun.asgc.neutrino.core.context.Environment;
|
||||
import fun.asgc.neutrino.core.context.LifeCycle;
|
||||
import fun.asgc.neutrino.core.context.LifeCycleManager;
|
||||
@@ -35,7 +36,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
+2
-1
@@ -19,8 +19,9 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.core.bean;
|
||||
package fun.asgc.neutrino.core.bean.factory;
|
||||
|
||||
import fun.asgc.neutrino.core.bean.BeanIdentity;
|
||||
import fun.asgc.neutrino.core.exception.BeanException;
|
||||
|
||||
import java.util.List;
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.core.bean;
|
||||
package fun.asgc.neutrino.core.bean.factory;
|
||||
|
||||
/**
|
||||
* 用于标识需要beanFactory的组件
|
||||
+2
-1
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.core.bean;
|
||||
package fun.asgc.neutrino.core.bean.factory;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import fun.asgc.neutrino.core.annotation.*;
|
||||
@@ -28,6 +28,7 @@ import fun.asgc.neutrino.core.aop.interceptor.ExceptionHandler;
|
||||
import fun.asgc.neutrino.core.aop.interceptor.Filter;
|
||||
import fun.asgc.neutrino.core.aop.interceptor.Interceptor;
|
||||
import fun.asgc.neutrino.core.aop.interceptor.ResultAdvice;
|
||||
import fun.asgc.neutrino.core.bean.*;
|
||||
import fun.asgc.neutrino.core.exception.BeanException;
|
||||
import fun.asgc.neutrino.core.context.ApplicationRunner;
|
||||
import fun.asgc.neutrino.core.util.*;
|
||||
@@ -24,8 +24,8 @@ package fun.asgc.neutrino.core.context;
|
||||
|
||||
import fun.asgc.neutrino.core.annotation.PreLoad;
|
||||
import fun.asgc.neutrino.core.base.GlobalConfig;
|
||||
import fun.asgc.neutrino.core.bean.BeanFactoryAware;
|
||||
import fun.asgc.neutrino.core.bean.SimpleBeanFactory;
|
||||
import fun.asgc.neutrino.core.bean.factory.BeanFactoryAware;
|
||||
import fun.asgc.neutrino.core.bean.factory.SimpleBeanFactory;
|
||||
import fun.asgc.neutrino.core.util.*;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ package fun.asgc.neutrino.core.context;
|
||||
import fun.asgc.neutrino.core.annotation.Autowired;
|
||||
import fun.asgc.neutrino.core.annotation.Component;
|
||||
import fun.asgc.neutrino.core.annotation.NonIntercept;
|
||||
import fun.asgc.neutrino.core.bean.SimpleBeanFactory;
|
||||
import fun.asgc.neutrino.core.bean.factory.SimpleBeanFactory;
|
||||
import fun.asgc.neutrino.core.web.context.WebApplicationContext;
|
||||
import fun.asgc.neutrino.core.web.context.WebContextHolder;
|
||||
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public abstract class PreparedStatementJdbcCallback<T> implements JdbcCallback<T
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if (ArrayUtil.notEmpty(params)) {
|
||||
for(Object o : params){
|
||||
sb.append(o.toString()).append(",");
|
||||
sb.append(o).append(",");
|
||||
}
|
||||
|
||||
if(sb.length() > 0 && sb.charAt(sb.length() - 1) == ','){
|
||||
|
||||
@@ -56,6 +56,7 @@ public class JobExecutor implements ApplicationRunner, IJobExecutor {
|
||||
private Map<String, IJobHandler> jobHandlerMap = new ConcurrentHashMap<>();
|
||||
private Set<String> runJobSet = Sets.newHashSet();
|
||||
private IJobCallback jobCallback;
|
||||
private Map<String, TriggerKey> triggerKeyMap = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public void run(String[] args) throws JobException {
|
||||
@@ -71,7 +72,6 @@ public class JobExecutor implements ApplicationRunner, IJobExecutor {
|
||||
continue;
|
||||
}
|
||||
jobHandlerMap.put(jobHandler.name(), item);
|
||||
runJobSet.add(jobHandler.name());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,55 +106,89 @@ public class JobExecutor implements ApplicationRunner, IJobExecutor {
|
||||
for (JobInfo jobInfo : jobInfoList) {
|
||||
add(jobInfo);
|
||||
}
|
||||
log.info("Job初始化完成.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void add(JobInfo jobInfo) throws JobException {
|
||||
if (null == jobInfo || StringUtil.isEmpty(jobInfo.getName()) || StringUtil.isEmpty(jobInfo.getCron()) || jobInfoMap.containsKey(jobInfo.getName())) {
|
||||
public void add(JobInfo jobInfo) throws JobException {
|
||||
if (null == jobInfo || StringUtil.isEmpty(jobInfo.getId()) || StringUtil.isEmpty(jobInfo.getName()) ||
|
||||
StringUtil.isEmpty(jobInfo.getCron()) || runJobSet.contains(jobInfo.getName())) {
|
||||
return;
|
||||
}
|
||||
jobInfoMap.put(jobInfo.getName(), jobInfo);
|
||||
synchronized (jobInfo.getId()) {
|
||||
runJobSet.add(jobInfo.getName());
|
||||
jobInfoMap.put(jobInfo.getId(), jobInfo);
|
||||
|
||||
TriggerKey triggerKey = TriggerKey.triggerKey(jobInfo.getName());
|
||||
JobKey jobKey = new JobKey(jobInfo.getName());
|
||||
TriggerKey triggerKey = TriggerKey.triggerKey(jobInfo.getId());
|
||||
triggerKeyMap.put(jobInfo.getId(), triggerKey);
|
||||
JobKey jobKey = new JobKey(jobInfo.getName());
|
||||
|
||||
CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(jobInfo.getCron()).withMisfireHandlingInstructionDoNothing();
|
||||
CronTrigger cronTrigger = TriggerBuilder.newTrigger().withIdentity(triggerKey).withSchedule(cronScheduleBuilder).build();
|
||||
JobDetail jobDetail = JobBuilder.newJob(JobBean.class).withIdentity(jobKey).build();
|
||||
CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(jobInfo.getCron()).withMisfireHandlingInstructionDoNothing();
|
||||
CronTrigger cronTrigger = TriggerBuilder.newTrigger().withIdentity(triggerKey).withSchedule(cronScheduleBuilder).build();
|
||||
JobDetail jobDetail = JobBuilder.newJob(JobBean.class).withIdentity(jobKey).build();
|
||||
|
||||
try {
|
||||
scheduler.scheduleJob(jobDetail, cronTrigger);
|
||||
scheduler.start();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(String.format("新增job[name=%s]异常", jobInfo.getName()));
|
||||
try {
|
||||
scheduler.scheduleJob(jobDetail, cronTrigger);
|
||||
scheduler.start();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(String.format("新增job[name=%s]异常", jobInfo.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(String jobName) {
|
||||
runJobSet.remove(jobName);
|
||||
public void remove(String jobId) {
|
||||
JobInfo jobInfo = jobInfoMap.get(jobId);
|
||||
if (null == jobInfo) {
|
||||
return;
|
||||
}
|
||||
synchronized (jobId) {
|
||||
runJobSet.remove(jobInfo.getName());
|
||||
unscheduleJob(jobId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trigger(String jobId, String param) {
|
||||
|
||||
doExecute(jobId, param);
|
||||
}
|
||||
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
if (null == context || null == context.getTrigger()) {
|
||||
return;
|
||||
}
|
||||
if (!jobInfoMap.containsKey(context.getTrigger().getKey().getName())
|
||||
|| !jobHandlerMap.containsKey(context.getTrigger().getKey().getName())) {
|
||||
String jobId = context.getTrigger().getKey().getName();
|
||||
JobInfo jobInfo = jobInfoMap.get(jobId);
|
||||
if (null == jobInfo) {
|
||||
unscheduleJob(jobId);
|
||||
return;
|
||||
}
|
||||
doExecute(jobId, jobInfo.getParam());
|
||||
}
|
||||
|
||||
threadPoolExecutor.submit(() -> {
|
||||
JobInfo jobInfo = jobInfoMap.get(context.getTrigger().getKey().getName());
|
||||
IJobHandler jobHandler =jobHandlerMap.get(jobInfo.getName());
|
||||
|
||||
private void unscheduleJob(String jobId) {
|
||||
TriggerKey triggerKey = triggerKeyMap.get(jobId);
|
||||
if (null != triggerKey) {
|
||||
try {
|
||||
jobHandler.execute(jobInfo.getParam());
|
||||
scheduler.unscheduleJob(triggerKey);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void doExecute(String jobId, String param) {
|
||||
JobInfo jobInfo = jobInfoMap.get(jobId);
|
||||
if (null == jobInfo) {
|
||||
return;
|
||||
}
|
||||
IJobHandler jobHandler =jobHandlerMap.get(jobInfo.getName());
|
||||
if (null == jobHandler) {
|
||||
return;
|
||||
}
|
||||
threadPoolExecutor.submit(() -> {
|
||||
try {
|
||||
jobHandler.execute(param);
|
||||
if (null != jobCallback) {
|
||||
jobCallback.executeLog(jobInfo, null);
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
package fun.asgc.neutrino.core.util;
|
||||
|
||||
import fun.asgc.neutrino.core.annotation.Component;
|
||||
import fun.asgc.neutrino.core.bean.BeanFactory;
|
||||
import fun.asgc.neutrino.core.bean.BeanFactoryAware;
|
||||
import fun.asgc.neutrino.core.bean.factory.BeanFactory;
|
||||
import fun.asgc.neutrino.core.bean.factory.BeanFactoryAware;
|
||||
import fun.asgc.neutrino.core.bean.BeanIdentity;
|
||||
import fun.asgc.neutrino.core.exception.BeanException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ package fun.asgc.neutrino.core.web.context;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import fun.asgc.neutrino.core.annotation.*;
|
||||
import fun.asgc.neutrino.core.bean.SimpleBeanFactory;
|
||||
import fun.asgc.neutrino.core.bean.factory.SimpleBeanFactory;
|
||||
import fun.asgc.neutrino.core.context.ApplicationContext;
|
||||
import fun.asgc.neutrino.core.context.ApplicationRunner;
|
||||
import fun.asgc.neutrino.core.web.HttpRequestHandler;
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import fun.asgc.neutrino.core.annotation.Component;
|
||||
import fun.asgc.neutrino.core.annotation.Init;
|
||||
import fun.asgc.neutrino.core.annotation.NonIntercept;
|
||||
import fun.asgc.neutrino.core.bean.BeanWrapper;
|
||||
import fun.asgc.neutrino.core.bean.SimpleBeanFactory;
|
||||
import fun.asgc.neutrino.core.bean.factory.SimpleBeanFactory;
|
||||
import fun.asgc.neutrino.core.context.ApplicationConfig;
|
||||
import fun.asgc.neutrino.core.util.*;
|
||||
import fun.asgc.neutrino.core.web.annotation.RestController;
|
||||
|
||||
@@ -24,7 +24,7 @@ package fun.asgc.neutrino.core.bean.test1;
|
||||
import fun.asgc.neutrino.core.annotation.*;
|
||||
import fun.asgc.neutrino.core.base.GlobalConfig;
|
||||
import fun.asgc.neutrino.core.bean.BeanMatchMode;
|
||||
import fun.asgc.neutrino.core.bean.SimpleBeanFactory;
|
||||
import fun.asgc.neutrino.core.bean.factory.SimpleBeanFactory;
|
||||
import fun.asgc.neutrino.core.context.NeutrinoLauncher;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function fetchList(query) {
|
||||
return request({
|
||||
url: '/job-info/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function updateEnableStatus(id, enable) {
|
||||
return request({
|
||||
url: '/job-info/update/enable-status',
|
||||
method: 'post',
|
||||
data: {
|
||||
id: id,
|
||||
enable: enable
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function execute(data) {
|
||||
return request({
|
||||
url: '/job-info/execute',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateJobInfo(data) {
|
||||
return request({
|
||||
url: '/job-info/update',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<a href="https://github.com/PanJiaChen/vue-element-admin" target="_blank" class="github-corner" aria-label="View source on Github">
|
||||
<a href="https://gitee.com/asgc/neutrino-proxy" target="_blank" class="github-corner" aria-label="View source on Gitee">
|
||||
<svg width="80" height="80" viewBox="0 0 250 250" style="fill:#40c9c6; color:#fff; position: absolute; top: 84px; border: 0; right: 0;"
|
||||
aria-hidden="true">
|
||||
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export default {
|
||||
route: {
|
||||
dashboard: '首页',
|
||||
home: '首页',
|
||||
introduction: '简述',
|
||||
documentation: '文档',
|
||||
permission: '权限测试页',
|
||||
@@ -49,7 +50,8 @@ export default {
|
||||
portPool: '端口池管理',
|
||||
proxy: '代理配置',
|
||||
license: 'License管理',
|
||||
portMapping: '端口映射'
|
||||
portMapping: '端口映射',
|
||||
jobManager: '调度管理'
|
||||
},
|
||||
navbar: {
|
||||
logOut: '退出登录',
|
||||
@@ -123,7 +125,13 @@ export default {
|
||||
isOnline: '在线状态',
|
||||
enableStatus: '启用状态',
|
||||
serverPort: '服务端口',
|
||||
proxyClient: '代理客户端'
|
||||
proxyClient: '代理客户端',
|
||||
desc: '描述',
|
||||
handler: '处理器',
|
||||
cron: 'cron',
|
||||
jobParam: '任务参数',
|
||||
alarmEmail: '任务报警邮箱',
|
||||
alarmDing: '任务报警钉钉'
|
||||
},
|
||||
errorLog: {
|
||||
tips: '请点击右上角bug小图标',
|
||||
|
||||
@@ -29,15 +29,26 @@ export const constantRouterMap = [
|
||||
{ path: '/authredirect', component: _import('login/authredirect'), hidden: true },
|
||||
{ path: '/404', component: _import('errorPage/404'), hidden: true },
|
||||
{ path: '/401', component: _import('errorPage/401'), hidden: true },
|
||||
// {
|
||||
// path: '',
|
||||
// component: Layout,
|
||||
// redirect: 'dashboard',
|
||||
// children: [{
|
||||
// path: 'dashboard',
|
||||
// component: _import('dashboard/index'),
|
||||
// name: 'dashboard',
|
||||
// meta: { title: 'dashboard', icon: 'dashboard', noCache: true }
|
||||
// }]
|
||||
// },
|
||||
{
|
||||
path: '',
|
||||
component: Layout,
|
||||
redirect: 'dashboard',
|
||||
redirect: 'home',
|
||||
children: [{
|
||||
path: 'dashboard',
|
||||
component: _import('dashboard/index'),
|
||||
name: 'dashboard',
|
||||
meta: { title: 'dashboard', icon: 'dashboard', noCache: true }
|
||||
path: 'home',
|
||||
component: _import('home/index'),
|
||||
name: 'home',
|
||||
meta: { title: 'home', icon: 'dashboard', noCache: true }
|
||||
}]
|
||||
}
|
||||
|
||||
@@ -89,29 +100,29 @@ export const asyncRouterMap = [
|
||||
// }]
|
||||
// },
|
||||
//
|
||||
{
|
||||
path: '/components',
|
||||
component: Layout,
|
||||
redirect: 'noredirect',
|
||||
name: 'component-demo',
|
||||
meta: {
|
||||
title: 'components',
|
||||
icon: 'component'
|
||||
},
|
||||
children: [
|
||||
{ path: 'tinymce', component: _import('components-demo/tinymce'), name: 'tinymce-demo', meta: { title: 'tinymce' }},
|
||||
{ path: 'markdown', component: _import('components-demo/markdown'), name: 'markdown-demo', meta: { title: 'markdown' }},
|
||||
{ path: 'json-editor', component: _import('components-demo/jsonEditor'), name: 'jsonEditor-demo', meta: { title: 'jsonEditor' }},
|
||||
{ path: 'dnd-list', component: _import('components-demo/dndList'), name: 'dndList-demo', meta: { title: 'dndList' }},
|
||||
{ path: 'splitpane', component: _import('components-demo/splitpane'), name: 'splitpane-demo', meta: { title: 'splitPane' }},
|
||||
{ path: 'avatar-upload', component: _import('components-demo/avatarUpload'), name: 'avatarUpload-demo', meta: { title: 'avatarUpload' }},
|
||||
{ path: 'dropzone', component: _import('components-demo/dropzone'), name: 'dropzone-demo', meta: { title: 'dropzone' }},
|
||||
{ path: 'sticky', component: _import('components-demo/sticky'), name: 'sticky-demo', meta: { title: 'sticky' }},
|
||||
{ path: 'count-to', component: _import('components-demo/countTo'), name: 'countTo-demo', meta: { title: 'countTo' }},
|
||||
{ path: 'mixin', component: _import('components-demo/mixin'), name: 'componentMixin-demo', meta: { title: 'componentMixin' }},
|
||||
{ path: 'back-to-top', component: _import('components-demo/backToTop'), name: 'backToTop-demo', meta: { title: 'backToTop' }}
|
||||
]
|
||||
},
|
||||
// {
|
||||
// path: '/components',
|
||||
// component: Layout,
|
||||
// redirect: 'noredirect',
|
||||
// name: 'component-demo',
|
||||
// meta: {
|
||||
// title: 'components',
|
||||
// icon: 'component'
|
||||
// },
|
||||
// children: [
|
||||
// { path: 'tinymce', component: _import('components-demo/tinymce'), name: 'tinymce-demo', meta: { title: 'tinymce' }},
|
||||
// { path: 'markdown', component: _import('components-demo/markdown'), name: 'markdown-demo', meta: { title: 'markdown' }},
|
||||
// { path: 'json-editor', component: _import('components-demo/jsonEditor'), name: 'jsonEditor-demo', meta: { title: 'jsonEditor' }},
|
||||
// { path: 'dnd-list', component: _import('components-demo/dndList'), name: 'dndList-demo', meta: { title: 'dndList' }},
|
||||
// { path: 'splitpane', component: _import('components-demo/splitpane'), name: 'splitpane-demo', meta: { title: 'splitPane' }},
|
||||
// { path: 'avatar-upload', component: _import('components-demo/avatarUpload'), name: 'avatarUpload-demo', meta: { title: 'avatarUpload' }},
|
||||
// { path: 'dropzone', component: _import('components-demo/dropzone'), name: 'dropzone-demo', meta: { title: 'dropzone' }},
|
||||
// { path: 'sticky', component: _import('components-demo/sticky'), name: 'sticky-demo', meta: { title: 'sticky' }},
|
||||
// { path: 'count-to', component: _import('components-demo/countTo'), name: 'countTo-demo', meta: { title: 'countTo' }},
|
||||
// { path: 'mixin', component: _import('components-demo/mixin'), name: 'componentMixin-demo', meta: { title: 'componentMixin' }},
|
||||
// { path: 'back-to-top', component: _import('components-demo/backToTop'), name: 'backToTop-demo', meta: { title: 'backToTop' }}
|
||||
// ]
|
||||
// },
|
||||
//
|
||||
// {
|
||||
// path: '/charts',
|
||||
@@ -265,7 +276,8 @@ export const asyncRouterMap = [
|
||||
},
|
||||
children: [
|
||||
{ path: 'user', component: _import('system/user'), name: 'user', meta: { title: 'user' }},
|
||||
{ path: 'portPool', component: _import('system/portPool'), name: 'portPool', meta: { title: 'portPool' }}
|
||||
{ path: 'portPool', component: _import('system/portPool'), name: 'portPool', meta: { title: 'portPool' }},
|
||||
{ path: 'jobManager', component: _import('system/jobManager'), name: 'jobManager', meta: { title: 'jobManager' }}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<ul class="list-unstyled">
|
||||
<li>或者你可以去:</li>
|
||||
<li class="link-type">
|
||||
<router-link to="/dashboard">回首页</router-link>
|
||||
<router-link to="/home">回首页</router-link>
|
||||
</li>
|
||||
<li class="link-type"><a href="https://www.taobao.com/">随便看看</a></li>
|
||||
<li><a @click.prevent="dialogVisible=true" href="#">点我看图</a></li>
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<div :class="className" :style="{height:height,width:width}"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import echarts from 'echarts'
|
||||
require('echarts/theme/macarons') // echarts theme
|
||||
import { debounce } from '@/utils'
|
||||
|
||||
const animationDuration = 6000
|
||||
|
||||
export default {
|
||||
props: {
|
||||
className: {
|
||||
type: String,
|
||||
default: 'chart'
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '100%'
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '300px'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
chart: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initChart()
|
||||
this.__resizeHanlder = debounce(() => {
|
||||
if (this.chart) {
|
||||
this.chart.resize()
|
||||
}
|
||||
}, 100)
|
||||
window.addEventListener('resize', this.__resizeHanlder)
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (!this.chart) {
|
||||
return
|
||||
}
|
||||
window.removeEventListener('resize', this.__resizeHanlder)
|
||||
this.chart.dispose()
|
||||
this.chart = null
|
||||
},
|
||||
methods: {
|
||||
initChart() {
|
||||
this.chart = echarts.init(this.$el, 'macarons')
|
||||
|
||||
this.chart.setOption({
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
||||
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
top: 10,
|
||||
left: '2%',
|
||||
right: '2%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: [{
|
||||
type: 'category',
|
||||
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
||||
axisTick: {
|
||||
alignWithLabel: true
|
||||
}
|
||||
}],
|
||||
yAxis: [{
|
||||
type: 'value',
|
||||
axisTick: {
|
||||
show: false
|
||||
}
|
||||
}],
|
||||
series: [{
|
||||
name: 'pageA',
|
||||
type: 'bar',
|
||||
stack: 'vistors',
|
||||
barWidth: '60%',
|
||||
data: [79, 52, 200, 334, 390, 330, 220],
|
||||
animationDuration
|
||||
}, {
|
||||
name: 'pageB',
|
||||
type: 'bar',
|
||||
stack: 'vistors',
|
||||
barWidth: '60%',
|
||||
data: [80, 52, 200, 334, 390, 330, 220],
|
||||
animationDuration
|
||||
}, {
|
||||
name: 'pageC',
|
||||
type: 'bar',
|
||||
stack: 'vistors',
|
||||
barWidth: '60%',
|
||||
data: [30, 52, 200, 334, 390, 330, 220],
|
||||
animationDuration
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,118 @@
|
||||
<template>
|
||||
<el-card class="box-card-component" style="margin-left:8px;">
|
||||
<div slot="header" class="box-card-header">
|
||||
<img src='https://wpimg.wallstcn.com/e7d23d71-cf19-4b90-a1cc-f56af8c0903d.png'>
|
||||
</div>
|
||||
<div style="position:relative;">
|
||||
<pan-thumb class="panThumb" :image="avatar"></pan-thumb>
|
||||
<mallki className='mallki-text' text='vue-element-admin'></mallki>
|
||||
<div style="padding-top:35px;" class='progress-item'>
|
||||
<span>Vue</span>
|
||||
<el-progress :percentage="70"></el-progress>
|
||||
</div>
|
||||
<div class='progress-item'>
|
||||
<span>JavaScript</span>
|
||||
<el-progress :percentage="18"></el-progress>
|
||||
</div>
|
||||
<div class='progress-item'>
|
||||
<span>Css</span>
|
||||
<el-progress :percentage="12"></el-progress>
|
||||
</div>
|
||||
<div class='progress-item'>
|
||||
<span>ESLint</span>
|
||||
<el-progress :percentage="100" status="success"></el-progress>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import PanThumb from '@/components/PanThumb'
|
||||
import Mallki from '@/components/TextHoverEffect/Mallki'
|
||||
|
||||
export default {
|
||||
components: { PanThumb, Mallki },
|
||||
|
||||
data() {
|
||||
return {
|
||||
statisticsData: {
|
||||
article_count: 1024,
|
||||
pageviews_count: 1024
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'name',
|
||||
'avatar',
|
||||
'roles'
|
||||
])
|
||||
},
|
||||
filters: {
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
success: 'success',
|
||||
pending: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" >
|
||||
.box-card-component{
|
||||
.el-card__header {
|
||||
padding: 0px!important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.box-card-component {
|
||||
.box-card-header {
|
||||
position: relative;
|
||||
height: 220px;
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
transition: all 0.2s linear;
|
||||
&:hover {
|
||||
transform: scale(1.1, 1.1);
|
||||
filter: contrast(130%);
|
||||
}
|
||||
}
|
||||
}
|
||||
.mallki-text {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.panThumb {
|
||||
z-index: 100;
|
||||
height: 70px!important;
|
||||
width: 70px!important;
|
||||
position: absolute!important;
|
||||
top: -45px;
|
||||
left: 0px;
|
||||
border: 5px solid #ffffff;
|
||||
background-color: #fff;
|
||||
margin: auto;
|
||||
box-shadow: none!important;
|
||||
/deep/ .pan-info {
|
||||
box-shadow: none!important;
|
||||
}
|
||||
}
|
||||
.progress-item {
|
||||
margin-bottom: 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
@media only screen and (max-width: 1510px){
|
||||
.mallki-text{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,150 @@
|
||||
<template>
|
||||
<div :class="className" :style="{height:height,width:width}"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import echarts from 'echarts'
|
||||
require('echarts/theme/macarons') // echarts theme
|
||||
import { debounce } from '@/utils'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
className: {
|
||||
type: String,
|
||||
default: 'chart'
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '100%'
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '350px'
|
||||
},
|
||||
autoResize: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
chartData: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
chart: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initChart()
|
||||
if (this.autoResize) {
|
||||
this.__resizeHanlder = debounce(() => {
|
||||
if (this.chart) {
|
||||
this.chart.resize()
|
||||
}
|
||||
}, 100)
|
||||
window.addEventListener('resize', this.__resizeHanlder)
|
||||
}
|
||||
|
||||
// 监听侧边栏的变化
|
||||
const sidebarElm = document.getElementsByClassName('sidebar-container')[0]
|
||||
sidebarElm.addEventListener('transitionend', this.__resizeHanlder)
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (!this.chart) {
|
||||
return
|
||||
}
|
||||
if (this.autoResize) {
|
||||
window.removeEventListener('resize', this.__resizeHanlder)
|
||||
}
|
||||
|
||||
const sidebarElm = document.getElementsByClassName('sidebar-container')[0]
|
||||
sidebarElm.removeEventListener('transitionend', this.__resizeHanlder)
|
||||
|
||||
this.chart.dispose()
|
||||
this.chart = null
|
||||
},
|
||||
watch: {
|
||||
chartData: {
|
||||
deep: true,
|
||||
handler(val) {
|
||||
this.setOptions(val)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setOptions({ expectedData, actualData } = {}) {
|
||||
this.chart.setOption({
|
||||
xAxis: {
|
||||
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
||||
boundaryGap: false,
|
||||
axisTick: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: 10,
|
||||
right: 10,
|
||||
bottom: 20,
|
||||
top: 30,
|
||||
containLabel: true
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'cross'
|
||||
},
|
||||
padding: [5, 10]
|
||||
},
|
||||
yAxis: {
|
||||
axisTick: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
data: ['expected', 'actual']
|
||||
},
|
||||
series: [{
|
||||
name: 'expected', itemStyle: {
|
||||
normal: {
|
||||
color: '#FF005A',
|
||||
lineStyle: {
|
||||
color: '#FF005A',
|
||||
width: 2
|
||||
}
|
||||
}
|
||||
},
|
||||
smooth: true,
|
||||
type: 'line',
|
||||
data: expectedData,
|
||||
animationDuration: 2800,
|
||||
animationEasing: 'cubicInOut'
|
||||
},
|
||||
{
|
||||
name: 'actual',
|
||||
smooth: true,
|
||||
type: 'line',
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#3888fa',
|
||||
lineStyle: {
|
||||
color: '#3888fa',
|
||||
width: 2
|
||||
},
|
||||
areaStyle: {
|
||||
color: '#f3f8ff'
|
||||
}
|
||||
}
|
||||
},
|
||||
data: actualData,
|
||||
animationDuration: 2800,
|
||||
animationEasing: 'quadraticOut'
|
||||
}]
|
||||
})
|
||||
},
|
||||
initChart() {
|
||||
this.chart = echarts.init(this.$el, 'macarons')
|
||||
this.setOptions(this.chartData)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,138 @@
|
||||
<template>
|
||||
<el-row class="panel-group" :gutter="40">
|
||||
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
|
||||
<div class='card-panel' @click="handleSetLineChartData('newVisitis')">
|
||||
<div class="card-panel-icon-wrapper icon-people">
|
||||
<svg-icon icon-class="peoples" class-name="card-panel-icon" />
|
||||
</div>
|
||||
<div class="card-panel-description">
|
||||
<div class="card-panel-text">New Visits</div>
|
||||
<count-to class="card-panel-num" :startVal="0" :endVal="102400" :duration="2600"></count-to>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
|
||||
<div class="card-panel" @click="handleSetLineChartData('messages')">
|
||||
<div class="card-panel-icon-wrapper icon-message">
|
||||
<svg-icon icon-class="message" class-name="card-panel-icon" />
|
||||
</div>
|
||||
<div class="card-panel-description">
|
||||
<div class="card-panel-text">Messages</div>
|
||||
<count-to class="card-panel-num" :startVal="0" :endVal="81212" :duration="3000"></count-to>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
|
||||
<div class="card-panel" @click="handleSetLineChartData('purchases')">
|
||||
<div class="card-panel-icon-wrapper icon-money">
|
||||
<svg-icon icon-class="money" class-name="card-panel-icon" />
|
||||
</div>
|
||||
<div class="card-panel-description">
|
||||
<div class="card-panel-text">Purchases</div>
|
||||
<count-to class="card-panel-num" :startVal="0" :endVal="9280" :duration="3200"></count-to>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
|
||||
<div class="card-panel" @click="handleSetLineChartData('shoppings')">
|
||||
<div class="card-panel-icon-wrapper icon-shoppingCard">
|
||||
<svg-icon icon-class="shoppingCard" class-name="card-panel-icon" />
|
||||
</div>
|
||||
<div class="card-panel-description">
|
||||
<div class="card-panel-text">Shoppings</div>
|
||||
<count-to class="card-panel-num" :startVal="0" :endVal="13600" :duration="3600"></count-to>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CountTo from 'vue-count-to'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
CountTo
|
||||
},
|
||||
methods: {
|
||||
handleSetLineChartData(type) {
|
||||
this.$emit('handleSetLineChartData', type)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.panel-group {
|
||||
margin-top: 18px;
|
||||
.card-panel-col{
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
.card-panel {
|
||||
height: 108px;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
color: #666;
|
||||
background: #fff;
|
||||
box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
|
||||
border-color: rgba(0, 0, 0, .05);
|
||||
&:hover {
|
||||
.card-panel-icon-wrapper {
|
||||
color: #fff;
|
||||
}
|
||||
.icon-people {
|
||||
background: #40c9c6;
|
||||
}
|
||||
.icon-message {
|
||||
background: #36a3f7;
|
||||
}
|
||||
.icon-money {
|
||||
background: #f4516c;
|
||||
}
|
||||
.icon-shoppingCard {
|
||||
background: #34bfa3
|
||||
}
|
||||
}
|
||||
.icon-people {
|
||||
color: #40c9c6;
|
||||
}
|
||||
.icon-message {
|
||||
color: #36a3f7;
|
||||
}
|
||||
.icon-money {
|
||||
color: #f4516c;
|
||||
}
|
||||
.icon-shoppingCard {
|
||||
color: #34bfa3
|
||||
}
|
||||
.card-panel-icon-wrapper {
|
||||
float: left;
|
||||
margin: 14px 0 0 14px;
|
||||
padding: 16px;
|
||||
transition: all 0.38s ease-out;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.card-panel-icon {
|
||||
float: left;
|
||||
font-size: 48px;
|
||||
}
|
||||
.card-panel-description {
|
||||
float: right;
|
||||
font-weight: bold;
|
||||
margin: 26px;
|
||||
margin-left: 0px;
|
||||
.card-panel-text {
|
||||
line-height: 18px;
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
font-size: 16px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.card-panel-num {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<div :class="className" :style="{height:height,width:width}"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import echarts from 'echarts'
|
||||
require('echarts/theme/macarons') // echarts theme
|
||||
import { debounce } from '@/utils'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
className: {
|
||||
type: String,
|
||||
default: 'chart'
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '100%'
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '300px'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
chart: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initChart()
|
||||
this.__resizeHanlder = debounce(() => {
|
||||
if (this.chart) {
|
||||
this.chart.resize()
|
||||
}
|
||||
}, 100)
|
||||
window.addEventListener('resize', this.__resizeHanlder)
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (!this.chart) {
|
||||
return
|
||||
}
|
||||
window.removeEventListener('resize', this.__resizeHanlder)
|
||||
this.chart.dispose()
|
||||
this.chart = null
|
||||
},
|
||||
methods: {
|
||||
initChart() {
|
||||
this.chart = echarts.init(this.$el, 'macarons')
|
||||
|
||||
this.chart.setOption({
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: '{a} <br/>{b} : {c} ({d}%)'
|
||||
},
|
||||
legend: {
|
||||
left: 'center',
|
||||
bottom: '10',
|
||||
data: ['Industries', 'Technology', 'Forex', 'Gold', 'Forecasts']
|
||||
},
|
||||
calculable: true,
|
||||
series: [
|
||||
{
|
||||
name: 'WEEKLY WRITE ARTICLES',
|
||||
type: 'pie',
|
||||
roseType: 'radius',
|
||||
radius: [15, 95],
|
||||
center: ['50%', '38%'],
|
||||
data: [
|
||||
{ value: 320, name: 'Industries' },
|
||||
{ value: 240, name: 'Technology' },
|
||||
{ value: 149, name: 'Forex' },
|
||||
{ value: 100, name: 'Gold' },
|
||||
{ value: 59, name: 'Forecasts' }
|
||||
],
|
||||
animationEasing: 'cubicInOut',
|
||||
animationDuration: 2600
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,120 @@
|
||||
<template>
|
||||
<div :class="className" :style="{height:height,width:width}"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import echarts from 'echarts'
|
||||
require('echarts/theme/macarons') // echarts theme
|
||||
import { debounce } from '@/utils'
|
||||
|
||||
const animationDuration = 3000
|
||||
|
||||
export default {
|
||||
props: {
|
||||
className: {
|
||||
type: String,
|
||||
default: 'chart'
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '100%'
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '300px'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
chart: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initChart()
|
||||
this.__resizeHanlder = debounce(() => {
|
||||
if (this.chart) {
|
||||
this.chart.resize()
|
||||
}
|
||||
}, 100)
|
||||
window.addEventListener('resize', this.__resizeHanlder)
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (!this.chart) {
|
||||
return
|
||||
}
|
||||
window.removeEventListener('resize', this.__resizeHanlder)
|
||||
this.chart.dispose()
|
||||
this.chart = null
|
||||
},
|
||||
methods: {
|
||||
initChart() {
|
||||
this.chart = echarts.init(this.$el, 'macarons')
|
||||
|
||||
this.chart.setOption({
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
||||
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
||||
}
|
||||
},
|
||||
radar: {
|
||||
radius: '66%',
|
||||
center: ['50%', '42%'],
|
||||
splitNumber: 8,
|
||||
splitArea: {
|
||||
areaStyle: {
|
||||
color: 'rgba(127,95,132,.3)',
|
||||
opacity: 1,
|
||||
shadowBlur: 45,
|
||||
shadowColor: 'rgba(0,0,0,.5)',
|
||||
shadowOffsetX: 0,
|
||||
shadowOffsetY: 15
|
||||
}
|
||||
},
|
||||
indicator: [
|
||||
{ name: 'Sales', max: 10000 },
|
||||
{ name: 'Administration', max: 20000 },
|
||||
{ name: 'Information Techology', max: 20000 },
|
||||
{ name: 'Customer Support', max: 20000 },
|
||||
{ name: 'Development', max: 20000 },
|
||||
{ name: 'Marketing', max: 20000 }
|
||||
]
|
||||
},
|
||||
legend: {
|
||||
left: 'center',
|
||||
bottom: '10',
|
||||
data: ['Allocated Budget', 'Expected Spending', 'Actual Spending']
|
||||
},
|
||||
series: [{
|
||||
type: 'radar',
|
||||
symbolSize: 0,
|
||||
areaStyle: {
|
||||
normal: {
|
||||
shadowBlur: 13,
|
||||
shadowColor: 'rgba(0,0,0,.2)',
|
||||
shadowOffsetX: 0,
|
||||
shadowOffsetY: 10,
|
||||
opacity: 1
|
||||
}
|
||||
},
|
||||
data: [
|
||||
{
|
||||
value: [5000, 7000, 12000, 11000, 15000, 14000],
|
||||
name: 'Allocated Budget'
|
||||
},
|
||||
{
|
||||
value: [4000, 9000, 15000, 15000, 13000, 11000],
|
||||
name: 'Expected Spending'
|
||||
},
|
||||
{
|
||||
value: [5500, 11000, 12000, 15000, 12000, 12000],
|
||||
name: 'Actual Spending'
|
||||
}
|
||||
],
|
||||
animationDuration: animationDuration
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<li class="todo" :class="{ completed: todo.done, editing: editing }">
|
||||
<div class="view">
|
||||
<input class="toggle"
|
||||
type="checkbox"
|
||||
:checked="todo.done"
|
||||
@change="toggleTodo( todo)">
|
||||
<label v-text="todo.text" @dblclick="editing = true"></label>
|
||||
<button class="destroy" @click="deleteTodo( todo )"></button>
|
||||
</div>
|
||||
<input class="edit"
|
||||
v-show="editing"
|
||||
v-focus="editing"
|
||||
:value="todo.text"
|
||||
@keyup.enter="doneEdit"
|
||||
@keyup.esc="cancelEdit"
|
||||
@blur="doneEdit">
|
||||
</li>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Todo',
|
||||
props: ['todo'],
|
||||
data() {
|
||||
return {
|
||||
editing: false
|
||||
}
|
||||
},
|
||||
directives: {
|
||||
focus(el, { value }, { context }) {
|
||||
if (value) {
|
||||
context.$nextTick(() => {
|
||||
el.focus()
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
deleteTodo(todo) {
|
||||
this.$emit('deleteTodo', todo)
|
||||
},
|
||||
editTodo({ todo, value }) {
|
||||
this.$emit('editTodo', { todo, value })
|
||||
},
|
||||
toggleTodo(todo) {
|
||||
this.$emit('toggleTodo', todo)
|
||||
},
|
||||
doneEdit(e) {
|
||||
const value = e.target.value.trim()
|
||||
const { todo } = this
|
||||
if (!value) {
|
||||
this.deleteTodo({
|
||||
todo
|
||||
})
|
||||
} else if (this.editing) {
|
||||
this.editTodo({
|
||||
todo,
|
||||
value
|
||||
})
|
||||
this.editing = false
|
||||
}
|
||||
},
|
||||
cancelEdit(e) {
|
||||
e.target.value = this.todo.text
|
||||
this.editing = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,317 @@
|
||||
.todoapp {
|
||||
font: 14px 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
line-height: 1.4em;
|
||||
color: #4d4d4d;
|
||||
min-width: 230px;
|
||||
max-width: 550px;
|
||||
margin: 0 auto ;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
font-weight: 300;
|
||||
background: #fff;
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
button {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: none;
|
||||
font-size: 100%;
|
||||
vertical-align: baseline;
|
||||
font-family: inherit;
|
||||
font-weight: inherit;
|
||||
color: inherit;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
:focus {
|
||||
outline: 0;
|
||||
}
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
.todoapp {
|
||||
background: #fff;
|
||||
margin: 130px 0 40px 0;
|
||||
position: relative;
|
||||
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.todoapp input::-webkit-input-placeholder {
|
||||
font-style: italic;
|
||||
font-weight: 300;
|
||||
color: #e6e6e6;
|
||||
}
|
||||
.todoapp input::-moz-placeholder {
|
||||
font-style: italic;
|
||||
font-weight: 300;
|
||||
color: #e6e6e6;
|
||||
}
|
||||
.todoapp input::input-placeholder {
|
||||
font-style: italic;
|
||||
font-weight: 300;
|
||||
color: #e6e6e6;
|
||||
}
|
||||
.todoapp h1 {
|
||||
position: absolute;
|
||||
top: -155px;
|
||||
width: 100%;
|
||||
font-size: 100px;
|
||||
font-weight: 100;
|
||||
text-align: center;
|
||||
color: rgba(175, 47, 47, 0.15);
|
||||
-webkit-text-rendering: optimizeLegibility;
|
||||
-moz-text-rendering: optimizeLegibility;
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
.new-todo,
|
||||
.edit {
|
||||
position: relative;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
font-size: 18px;
|
||||
font-family: inherit;
|
||||
font-weight: inherit;
|
||||
line-height: 1.4em;
|
||||
border: 0;
|
||||
color: inherit;
|
||||
padding: 6px;
|
||||
border: 1px solid #999;
|
||||
box-shadow: inset 0 -1px 5px 0 rgba(0, 0, 0, 0.2);
|
||||
box-sizing: border-box;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
.new-todo {
|
||||
padding: 10px 16px 16px 60px;
|
||||
border: none;
|
||||
background: rgba(0, 0, 0, 0.003);
|
||||
box-shadow: inset 0 -2px 1px rgba(0, 0, 0, 0.03);
|
||||
}
|
||||
.main {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
border-top: 1px solid #e6e6e6;
|
||||
}
|
||||
.toggle-all {
|
||||
text-align: center;
|
||||
border: none;
|
||||
/* Mobile Safari */
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
}
|
||||
.toggle-all+label {
|
||||
width: 60px;
|
||||
height: 34px;
|
||||
font-size: 0;
|
||||
position: absolute;
|
||||
top: -52px;
|
||||
left: -13px;
|
||||
-webkit-transform: rotate(90deg);
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
.toggle-all+label:before {
|
||||
content: '❯';
|
||||
font-size: 22px;
|
||||
color: #e6e6e6;
|
||||
padding: 10px 27px 10px 27px;
|
||||
}
|
||||
.toggle-all:checked+label:before {
|
||||
color: #737373;
|
||||
}
|
||||
.todo-list {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.todo-list li {
|
||||
position: relative;
|
||||
font-size: 24px;
|
||||
border-bottom: 1px solid #ededed;
|
||||
}
|
||||
.todo-list li:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.todo-list li.editing {
|
||||
border-bottom: none;
|
||||
padding: 0;
|
||||
}
|
||||
.todo-list li.editing .edit {
|
||||
display: block;
|
||||
width: 506px;
|
||||
padding: 12px 16px;
|
||||
margin: 0 0 0 43px;
|
||||
}
|
||||
.todo-list li.editing .view {
|
||||
display: none;
|
||||
}
|
||||
.todo-list li .toggle {
|
||||
text-align: center;
|
||||
width: 40px;
|
||||
/* auto, since non-WebKit browsers doesn't support input styling */
|
||||
height: auto;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
margin: auto 0;
|
||||
border: none;
|
||||
/* Mobile Safari */
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
.todo-list li .toggle {
|
||||
opacity: 0;
|
||||
}
|
||||
.todo-list li .toggle+label {
|
||||
/*
|
||||
Firefox requires `#` to be escaped - https://bugzilla.mozilla.org/show_bug.cgi?id=922433
|
||||
IE and Edge requires *everything* to be escaped to render, so we do that instead of just the `#` - https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/7157459/
|
||||
*/
|
||||
background-image: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23ededed%22%20stroke-width%3D%223%22/%3E%3C/svg%3E');
|
||||
background-repeat: no-repeat;
|
||||
background-position: center left;
|
||||
background-size: 36px;
|
||||
}
|
||||
.todo-list li .toggle:checked+label {
|
||||
background-size: 36px;
|
||||
background-image: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23bddad5%22%20stroke-width%3D%223%22/%3E%3Cpath%20fill%3D%22%235dc2af%22%20d%3D%22M72%2025L42%2071%2027%2056l-4%204%2020%2020%2034-52z%22/%3E%3C/svg%3E');
|
||||
}
|
||||
.todo-list li label {
|
||||
word-break: break-all;
|
||||
padding: 15px 15px 15px 50px;
|
||||
display: block;
|
||||
line-height: 1.0;
|
||||
font-size: 14px;
|
||||
transition: color 0.4s;
|
||||
}
|
||||
.todo-list li.completed label {
|
||||
color: #d9d9d9;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
.todo-list li .destroy {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 10px;
|
||||
bottom: 0;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin: auto 0;
|
||||
font-size: 30px;
|
||||
color: #cc9a9a;
|
||||
transition: color 0.2s ease-out;
|
||||
}
|
||||
.todo-list li .destroy:hover {
|
||||
color: #af5b5e;
|
||||
}
|
||||
.todo-list li .destroy:after {
|
||||
content: '×';
|
||||
}
|
||||
.todo-list li:hover .destroy {
|
||||
display: block;
|
||||
}
|
||||
.todo-list li .edit {
|
||||
display: none;
|
||||
}
|
||||
.todo-list li.editing:last-child {
|
||||
margin-bottom: -1px;
|
||||
}
|
||||
.footer {
|
||||
color: #777;
|
||||
position: relative;
|
||||
padding: 10px 15px;
|
||||
height: 40px;
|
||||
text-align: center;
|
||||
border-top: 1px solid #e6e6e6;
|
||||
}
|
||||
.footer:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
height: 50px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 8px 0 -3px #f6f6f6, 0 9px 1px -3px rgba(0, 0, 0, 0.2), 0 16px 0 -6px #f6f6f6, 0 17px 2px -6px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
.todo-count {
|
||||
float: left;
|
||||
text-align: left;
|
||||
}
|
||||
.todo-count strong {
|
||||
font-weight: 300;
|
||||
}
|
||||
.filters {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.filters li {
|
||||
display: inline;
|
||||
}
|
||||
.filters li a {
|
||||
color: inherit;
|
||||
font-size: 12px;
|
||||
padding: 3px 7px;
|
||||
text-decoration: none;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.filters li a:hover {
|
||||
border-color: rgba(175, 47, 47, 0.1);
|
||||
}
|
||||
.filters li a.selected {
|
||||
border-color: rgba(175, 47, 47, 0.2);
|
||||
}
|
||||
.clear-completed,
|
||||
html .clear-completed:active {
|
||||
float: right;
|
||||
position: relative;
|
||||
line-height: 20px;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
.clear-completed:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.info {
|
||||
margin: 65px auto 0;
|
||||
color: #bfbfbf;
|
||||
font-size: 10px;
|
||||
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
|
||||
text-align: center;
|
||||
}
|
||||
.info p {
|
||||
line-height: 1;
|
||||
}
|
||||
.info a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
font-weight: 400;
|
||||
}
|
||||
.info a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
/*
|
||||
Hack to remove background from Mobile Safari.
|
||||
Can't use it globally since it destroys checkboxes in Firefox
|
||||
*/
|
||||
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
||||
.toggle-all,
|
||||
.todo-list li .toggle {
|
||||
background: none;
|
||||
}
|
||||
.todo-list li .toggle {
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
@media (max-width: 430px) {
|
||||
.footer {
|
||||
height: 50px;
|
||||
}
|
||||
.filters {
|
||||
bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
<template>
|
||||
<section class="todoapp">
|
||||
<!-- header -->
|
||||
<header class="header">
|
||||
<input class="new-todo" autocomplete="off" placeholder="Todo List" @keyup.enter="addTodo">
|
||||
</header>
|
||||
<!-- main section -->
|
||||
<section class="main" v-show="todos.length">
|
||||
<input class="toggle-all" id="toggle-all" type="checkbox" :checked="allChecked" @change="toggleAll({ done: !allChecked })">
|
||||
<label for="toggle-all"></label>
|
||||
<ul class="todo-list">
|
||||
<todo @toggleTodo='toggleTodo' @editTodo='editTodo' @deleteTodo='deleteTodo' v-for="(todo, index) in filteredTodos" :key="index"
|
||||
:todo="todo"></todo>
|
||||
</ul>
|
||||
</section>
|
||||
<!-- footer -->
|
||||
<footer class="footer" v-show="todos.length">
|
||||
<span class="todo-count">
|
||||
<strong>{{ remaining }}</strong>
|
||||
{{ remaining | pluralize('item') }} left
|
||||
</span>
|
||||
<ul class="filters">
|
||||
<li v-for="(val, key) in filters" :key="key">
|
||||
<a :class="{ selected: visibility === key }" @click.prevent="visibility = key">{{ key | capitalize }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- <button class="clear-completed" v-show="todos.length > remaining" @click="clearCompleted">
|
||||
Clear completed
|
||||
</button> -->
|
||||
</footer>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Todo from './Todo.vue'
|
||||
|
||||
const STORAGE_KEY = 'todos'
|
||||
const filters = {
|
||||
all: todos => todos,
|
||||
active: todos => todos.filter(todo => !todo.done),
|
||||
completed: todos => todos.filter(todo => todo.done)
|
||||
}
|
||||
const defalutList = [
|
||||
{ text: 'star this repository', done: false },
|
||||
{ text: 'fork this repository', done: false },
|
||||
{ text: 'follow author', done: false },
|
||||
{ text: 'vue-element-admin', done: true },
|
||||
{ text: 'vue', done: true },
|
||||
{ text: 'element-ui', done: true },
|
||||
{ text: 'axios', done: true },
|
||||
{ text: 'webpack', done: true }
|
||||
]
|
||||
export default {
|
||||
components: { Todo },
|
||||
data() {
|
||||
return {
|
||||
visibility: 'all',
|
||||
filters,
|
||||
// todos: JSON.parse(window.localStorage.getItem(STORAGE_KEY)) || defalutList
|
||||
todos: defalutList
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
allChecked() {
|
||||
return this.todos.every(todo => todo.done)
|
||||
},
|
||||
filteredTodos() {
|
||||
return filters[this.visibility](this.todos)
|
||||
},
|
||||
remaining() {
|
||||
return this.todos.filter(todo => !todo.done).length
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setLocalStorgae() {
|
||||
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(this.todos))
|
||||
},
|
||||
addTodo(e) {
|
||||
const text = e.target.value
|
||||
if (text.trim()) {
|
||||
this.todos.push({
|
||||
text,
|
||||
done: false
|
||||
})
|
||||
this.setLocalStorgae()
|
||||
}
|
||||
e.target.value = ''
|
||||
},
|
||||
toggleTodo(val) {
|
||||
val.done = !val.done
|
||||
this.setLocalStorgae()
|
||||
},
|
||||
deleteTodo(todo) {
|
||||
this.todos.splice(this.todos.indexOf(todo), 1)
|
||||
this.setLocalStorgae()
|
||||
},
|
||||
editTodo({ todo, value }) {
|
||||
todo.text = value
|
||||
this.setLocalStorgae()
|
||||
},
|
||||
clearCompleted() {
|
||||
this.todos = this.todos.filter(todo => !todo.done)
|
||||
this.setLocalStorgae()
|
||||
},
|
||||
toggleAll({ done }) {
|
||||
this.todos.forEach(todo => {
|
||||
todo.done = done
|
||||
this.setLocalStorgae()
|
||||
})
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
pluralize: (n, w) => n === 1 ? w : w + 's',
|
||||
capitalize: s => s.charAt(0).toUpperCase() + s.slice(1)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import './index.scss';
|
||||
</style>
|
||||
@@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<el-table :data="list" style="width: 100%;padding-top: 15px;">
|
||||
<el-table-column label="Order_No" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.order_no}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="Price" width="195" align="center">
|
||||
<template slot-scope="scope">
|
||||
¥{{scope.row.price | toThousandslsFilter}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="Status" width="100" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.status | statusFilter"> {{scope.row.status}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { fetchList } from '@/api/transaction'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
list: null
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
success: 'success',
|
||||
pending: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
fetchData() {
|
||||
fetchList().then(response => {
|
||||
this.list = response.data.items.slice(0, 7)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,110 @@
|
||||
<template>
|
||||
<div class="dashboard-editor-container">
|
||||
<github-corner></github-corner>
|
||||
|
||||
<panel-group @handleSetLineChartData="handleSetLineChartData"></panel-group>
|
||||
|
||||
<el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
|
||||
<line-chart :chart-data="lineChartData"></line-chart>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="32">
|
||||
<el-col :xs="24" :sm="24" :lg="8">
|
||||
<div class="chart-wrapper">
|
||||
<raddar-chart></raddar-chart>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="24" :lg="8">
|
||||
<div class="chart-wrapper">
|
||||
<pie-chart></pie-chart>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="24" :lg="8">
|
||||
<div class="chart-wrapper">
|
||||
<bar-chart></bar-chart>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="8">
|
||||
<el-col :xs="{span: 24}" :sm="{span: 24}" :md="{span: 24}" :lg="{span: 12}" :xl="{span: 12}" style="padding-right:8px;margin-bottom:30px;">
|
||||
<transaction-table></transaction-table>
|
||||
</el-col>
|
||||
<el-col :xs="{span: 12}" :sm="{span: 12}" :md="{span: 12}" :lg="{span: 6}" :xl="{span: 5}">
|
||||
<todo-list></todo-list>
|
||||
</el-col>
|
||||
<el-col :xs="{span: 12}" :sm="{span: 12}" :md="{span: 12}" :lg="{span: 6}" :xl="{span: 5}">
|
||||
<box-card></box-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import GithubCorner from '@/components/GithubCorner'
|
||||
import PanelGroup from './components/PanelGroup'
|
||||
import LineChart from './components/LineChart'
|
||||
import RaddarChart from './components/RaddarChart'
|
||||
import PieChart from './components/PieChart'
|
||||
import BarChart from './components/BarChart'
|
||||
import TransactionTable from './components/TransactionTable'
|
||||
import TodoList from './components/TodoList'
|
||||
import BoxCard from './components/BoxCard'
|
||||
|
||||
const lineChartData = {
|
||||
newVisitis: {
|
||||
expectedData: [100, 120, 161, 134, 105, 160, 165],
|
||||
actualData: [120, 82, 91, 154, 162, 140, 145]
|
||||
},
|
||||
messages: {
|
||||
expectedData: [200, 192, 120, 144, 160, 130, 140],
|
||||
actualData: [180, 160, 151, 106, 145, 150, 130]
|
||||
},
|
||||
purchases: {
|
||||
expectedData: [80, 100, 121, 104, 105, 90, 100],
|
||||
actualData: [120, 90, 100, 138, 142, 130, 130]
|
||||
},
|
||||
shoppings: {
|
||||
expectedData: [130, 140, 141, 142, 145, 150, 160],
|
||||
actualData: [120, 82, 91, 154, 162, 140, 130]
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'dashboard-admin',
|
||||
components: {
|
||||
GithubCorner,
|
||||
PanelGroup,
|
||||
LineChart,
|
||||
RaddarChart,
|
||||
PieChart,
|
||||
BarChart,
|
||||
TransactionTable,
|
||||
TodoList,
|
||||
BoxCard
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
lineChartData: lineChartData.newVisitis
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleSetLineChartData(type) {
|
||||
this.lineChartData = lineChartData[type]
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.dashboard-editor-container {
|
||||
padding: 32px;
|
||||
background-color: rgb(240, 242, 245);
|
||||
.chart-wrapper {
|
||||
background: #fff;
|
||||
padding: 16px 16px 0;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,74 @@
|
||||
<template>
|
||||
<div class="dashboard-editor-container">
|
||||
<div class=" clearfix">
|
||||
<pan-thumb style="float: left" :image="avatar"> Your roles:
|
||||
<span class="pan-info-roles" :key='item' v-for="item in roles">{{item}}</span>
|
||||
</pan-thumb>
|
||||
<github-corner></github-corner>
|
||||
<div class="info-container">
|
||||
<span class="display_name">{{name}}</span>
|
||||
<span style="font-size:20px;padding-top:20px;display:inline-block;">editor : dashboard</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<img class="emptyGif" :src="emptyGif">
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import PanThumb from '@/components/PanThumb'
|
||||
import GithubCorner from '@/components/GithubCorner'
|
||||
|
||||
export default {
|
||||
name: 'dashboard-editor',
|
||||
components: { PanThumb, GithubCorner },
|
||||
data() {
|
||||
return {
|
||||
emptyGif: 'https://wpimg.wallstcn.com/0e03b7da-db9e-4819-ba10-9016ddfdaed3'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'name',
|
||||
'avatar',
|
||||
'roles'
|
||||
])
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.emptyGif {
|
||||
display: block;
|
||||
width: 45%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.dashboard-editor-container {
|
||||
background-color: #e3e3e3;
|
||||
min-height: 100vh;
|
||||
margin-top: -50px;
|
||||
padding: 100px 60px 0px;
|
||||
.pan-info-roles {
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
color: #333;
|
||||
display: block;
|
||||
}
|
||||
.info-container {
|
||||
position: relative;
|
||||
margin-left: 190px;
|
||||
height: 150px;
|
||||
line-height: 200px;
|
||||
.display_name {
|
||||
font-size: 48px;
|
||||
line-height: 48px;
|
||||
color: #212121;
|
||||
position: absolute;
|
||||
top: 25px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<div class="dashboard-container">
|
||||
<component :is="currentRole"></component>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import adminDashboard from './admin'
|
||||
import editorDashboard from './editor'
|
||||
|
||||
export default {
|
||||
name: 'dashboard',
|
||||
components: { adminDashboard, editorDashboard },
|
||||
data() {
|
||||
return {
|
||||
currentRole: 'adminDashboard'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'roles'
|
||||
])
|
||||
},
|
||||
created() {
|
||||
if (!this.roles.includes('admin')) {
|
||||
this.currentRole = 'editorDashboard'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,228 @@
|
||||
<template>
|
||||
<div class="app-container calendar-list-container">
|
||||
<div class="filter-container">
|
||||
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{$t('table.search')}}</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit highlight-current-row style="width: 100%">
|
||||
<el-table-column align="center" :label="$t('table.id')" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.id}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.desc')" width="200">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.desc}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.handler')" width="200">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.handler}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.cron')" width="200">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.cron}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150px" align="center" :label="$t('table.createTime')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.createTime | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150px" align="center" :label="$t('table.updateTime')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.updateTime | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column class-name="status-col" :label="$t('table.enableStatus')" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.enable | statusFilter">{{scope.row.enable | statusName}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.actions')" width="230" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="primary" @click="handleEditClick(scope.row)">编辑</el-button>
|
||||
<el-button size="mini" type="primary" @click="handleExecuteClick(scope.row)">执行</el-button>
|
||||
<el-button v-if="scope.row.enable === 1" size="mini" type="danger" @click="handleModifyStatus(scope.row,2)">停止</el-button>
|
||||
<el-button v-if="scope.row.enable === 2" size="mini" type="success" @click="handleModifyStatus(scope.row,1)">启动</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.currentPage"
|
||||
:page-sizes="[10,20,30, 50]" :page-size="listQuery.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
<el-dialog title="执行" :visible.sync="executeVisible">
|
||||
<el-form ref="dataForm" :model="temp" label-position="right" label-width="70px">
|
||||
<el-form-item :label="$t('table.jobParam')" prop="param">
|
||||
<el-input v-model="temp.param" type="textarea" :rows="4" placeholder="请输入任务执行参数" :maxlength="200" show-word-limit style="padding-right: 20px"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="executeVisible = false">{{$t('table.cancel')}}</el-button>
|
||||
<el-button type="primary" @click="commitExecute">{{$t('table.confirm')}}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="编辑" :visible.sync="editVisible">
|
||||
<el-form ref="editForm" :rules="editRules" :model="edit" label-position="right" label-width="100px" style="padding-right: 20px">
|
||||
<el-form-item :label="$t('table.handler')" prop="handler">
|
||||
<el-input v-model="edit.handler" :placeholder="'请输入'+$t('table.handler')" disabled/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('table.cron')" prop="cron">
|
||||
<el-input v-model="edit.cron" :placeholder="'请输入'+$t('table.cron')"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('table.desc')" prop="desc">
|
||||
<el-input v-model="edit.desc" type="textarea" :rows="2" :placeholder="'请输入'+$t('table.desc')" show-word-limit/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('table.jobParam')" prop="param">
|
||||
<el-input v-model="edit.param" type="textarea" :rows="2" :placeholder="'请输入'+$t('table.jobParam')" show-word-limit/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('table.alarmEmail')" prop="alarmEmail">
|
||||
<el-input v-model="edit.alarmEmail" :placeholder="'请输入'+$t('table.alarmEmail')"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('table.alarmDing')" prop="alarmDing">
|
||||
<el-input v-model="edit.alarmDing" :placeholder="'请输入'+$t('table.alarmDing')"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="editVisible = false">{{$t('table.cancel')}}</el-button>
|
||||
<el-button type="primary" @click="commitEdit">{{$t('table.confirm')}}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { fetchList, updateEnableStatus, execute, updateJobInfo } from '@/api/jobInfo'
|
||||
import waves from '@/directive/waves' // 水波纹指令
|
||||
|
||||
export default {
|
||||
name: 'jobManager',
|
||||
directives: {
|
||||
waves
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableKey: 0,
|
||||
list: null,
|
||||
total: null,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
importance: undefined,
|
||||
title: undefined,
|
||||
type: undefined
|
||||
},
|
||||
temp: {
|
||||
id: '',
|
||||
param: ''
|
||||
},
|
||||
executeVisible: false,
|
||||
editVisible: false,
|
||||
edit: {
|
||||
id: '',
|
||||
desc: '',
|
||||
handler: '',
|
||||
cron: '',
|
||||
alarmEmail: '',
|
||||
alarmDing: '',
|
||||
param: ''
|
||||
},
|
||||
editRules: {
|
||||
desc: [{ required: true, message: '描述必填', trigger: 'blur' }],
|
||||
handler: [{ required: true, message: '处理器必填', trigger: 'blur' }],
|
||||
cron: [{ required: true, message: 'cron必填', trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
statusName(status) {
|
||||
const statusMap = {
|
||||
1: '启动',
|
||||
2: '停止'
|
||||
}
|
||||
return statusMap[status]
|
||||
},
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
1: 'success',
|
||||
2: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
fetchList(this.listQuery).then(response => {
|
||||
this.list = response.data.data.records
|
||||
this.total = response.data.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.currentPage = 1
|
||||
this.getList()
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.listQuery.pageSize = val
|
||||
this.getList()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.listQuery.currentPage = val
|
||||
this.getList()
|
||||
},
|
||||
handleModifyStatus(row, enable) {
|
||||
updateEnableStatus(row.id, enable).then(response => {
|
||||
if (response.data.data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
handleExecuteClick(row) {
|
||||
this.temp.id = row.id
|
||||
this.temp.param = row.param
|
||||
this.executeVisible = true
|
||||
},
|
||||
handleEditClick(row) {
|
||||
this.edit = row
|
||||
this.editVisible = true
|
||||
},
|
||||
commitExecute() {
|
||||
execute(this.temp).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.executeVisible = false
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
commitEdit() {
|
||||
updateJobInfo(this.edit).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.editVisible = false
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -37,8 +37,7 @@ import fun.asgc.neutrino.core.context.NeutrinoLauncher;
|
||||
public class ProxyServer {
|
||||
|
||||
public static void main(String[] args) {
|
||||
GlobalConfig.setIsSaveGeneratorCode(true);
|
||||
NeutrinoLauncher.run(ProxyServer.class, args).sync();
|
||||
NeutrinoLauncher.run(ProxyServer.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-2
@@ -25,8 +25,8 @@ import fun.asgc.neutrino.core.annotation.Autowired;
|
||||
import fun.asgc.neutrino.core.annotation.Bean;
|
||||
import fun.asgc.neutrino.core.annotation.Component;
|
||||
import fun.asgc.neutrino.core.base.CustomThreadFactory;
|
||||
import fun.asgc.neutrino.core.quartz.DefaultJobSource;
|
||||
import fun.asgc.neutrino.core.quartz.JobExecutor;
|
||||
import fun.asgc.neutrino.proxy.server.service.JobInfoService;
|
||||
import fun.asgc.neutrino.proxy.server.service.JobLogService;
|
||||
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
@@ -42,11 +42,13 @@ import java.util.concurrent.TimeUnit;
|
||||
public class JobConfig {
|
||||
@Autowired
|
||||
private JobLogService jobLogService;
|
||||
@Autowired
|
||||
private JobInfoService jobInfoService;
|
||||
|
||||
@Bean
|
||||
public JobExecutor jobExecutor() {
|
||||
JobExecutor executor = new JobExecutor();
|
||||
executor.setJobSource(new DefaultJobSource());
|
||||
executor.setJobSource(jobInfoService);
|
||||
executor.setThreadPoolExecutor(new ThreadPoolExecutor(5, 20, 10L, TimeUnit.SECONDS,
|
||||
new LinkedBlockingQueue<>(), new CustomThreadFactory("JobPool")));
|
||||
executor.setJobCallback(jobLogService);
|
||||
|
||||
+2
@@ -51,6 +51,8 @@ public enum ExceptionConstant {
|
||||
// 端口映射管理(14000)
|
||||
PORT_MAPPING_NOT_EXIST(14000, "端口映射记录不存在"),
|
||||
PORT_CANNOT_REPEAT_MAPPING(14001, "服务端口[{}]不能重复映射"),
|
||||
// 调度管理(15000)
|
||||
JOB_INFO_NOT_EXIST(15000, "调度管理记录不存在"),
|
||||
SYSTEM_ERROR(500, "系统异常"),
|
||||
;
|
||||
|
||||
|
||||
+44
-2
@@ -21,18 +21,60 @@
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller;
|
||||
|
||||
import fun.asgc.neutrino.core.annotation.Autowired;
|
||||
import fun.asgc.neutrino.core.annotation.NonIntercept;
|
||||
import fun.asgc.neutrino.core.web.annotation.RequestMapping;
|
||||
import fun.asgc.neutrino.core.web.annotation.RestController;
|
||||
import fun.asgc.neutrino.core.db.page.Page;
|
||||
import fun.asgc.neutrino.core.db.page.PageQuery;
|
||||
import fun.asgc.neutrino.core.web.annotation.*;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.annotation.OnlyAdmin;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.*;
|
||||
import fun.asgc.neutrino.proxy.server.service.JobInfoService;
|
||||
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/9/5
|
||||
*/
|
||||
@Slf4j
|
||||
@NonIntercept
|
||||
@RequestMapping("job-info")
|
||||
@RestController
|
||||
public class JobInfoController {
|
||||
@Autowired
|
||||
private JobInfoService jobInfoService;
|
||||
|
||||
@GetMapping("page")
|
||||
public Page<JobInfoListRes> page(PageQuery pageQuery, JobInfoListReq req) {
|
||||
ParamCheckUtil.checkNotNull(pageQuery, "pageQuery");
|
||||
return jobInfoService.page(pageQuery, req);
|
||||
}
|
||||
|
||||
@OnlyAdmin
|
||||
@PostMapping("update/enable-status")
|
||||
public JobInfoUpdateEnableStatusRes updateEnableStatus(@RequestBody JobInfoUpdateEnableStatusReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getId(), "id");
|
||||
ParamCheckUtil.checkNotNull(req.getEnable(), "enable");
|
||||
return jobInfoService.updateEnableStatus(req);
|
||||
}
|
||||
|
||||
@OnlyAdmin
|
||||
@PostMapping("execute")
|
||||
public JobInfoExecuteRes execute(@RequestBody JobInfoExecuteReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getId(), "id");
|
||||
|
||||
return jobInfoService.execute(req);
|
||||
}
|
||||
|
||||
@PostMapping("update")
|
||||
public JobInfoUpdateRes update(@RequestBody JobInfoUpdateReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
|
||||
return jobInfoService.update(req);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller;
|
||||
|
||||
import fun.asgc.neutrino.core.annotation.NonIntercept;
|
||||
import fun.asgc.neutrino.core.web.annotation.GetMapping;
|
||||
import fun.asgc.neutrino.core.web.annotation.RequestMapping;
|
||||
import fun.asgc.neutrino.core.web.annotation.RestController;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.ReportDataViewRes;
|
||||
|
||||
/**
|
||||
* 报表管理
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/9/12
|
||||
*/
|
||||
@NonIntercept
|
||||
@RequestMapping("report")
|
||||
@RestController
|
||||
public class ReportController {
|
||||
|
||||
@GetMapping("data-view")
|
||||
public ReportDataViewRes dataView() {
|
||||
return new ReportDataViewRes()
|
||||
.setUserOnlineNumber(2).setEnableUserNumber(3).setUserNumber(5)
|
||||
.setLicenseNumber(3).setEnableLicenseNumber(6).setLicenseNumber(6)
|
||||
.setServerPortOnlineNumber(3).setEnableServerPortNumber(5).setServerPortNumber(6)
|
||||
.setTotalUpstreamFlow("23K").setTotalDownwardFlow("47M")
|
||||
;
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 调度管理执行请求
|
||||
* @author: zCans
|
||||
* @date: 2022/9/12
|
||||
*/
|
||||
@Data
|
||||
public class JobInfoExecuteReq {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 任务参数
|
||||
*/
|
||||
private String param;
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 端口映射列表请求
|
||||
* @author: zCans
|
||||
* @date: 2022/9/12
|
||||
*/
|
||||
@Data
|
||||
public class JobInfoListReq {
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 调度管理更新启用状态请求
|
||||
* @author: zCans
|
||||
* @date: 2022/9/12
|
||||
*/
|
||||
@Data
|
||||
public class JobInfoUpdateEnableStatusReq {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 启用状态
|
||||
*/
|
||||
private Integer enable;
|
||||
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 调度管理更新请求
|
||||
* @author: zCans
|
||||
* @date: 2022/9/17
|
||||
*/
|
||||
@Data
|
||||
public class JobInfoUpdateReq {
|
||||
private Integer id;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String desc;
|
||||
/**
|
||||
* 处理器
|
||||
*/
|
||||
private String handler;
|
||||
/**
|
||||
* cron
|
||||
*/
|
||||
private String cron;
|
||||
/**
|
||||
* 任务参数
|
||||
*/
|
||||
private String param;
|
||||
/**
|
||||
* 任务报警邮箱
|
||||
*/
|
||||
private String alarmEmail;
|
||||
/**
|
||||
* 任务报警钉钉
|
||||
*/
|
||||
private String alarmDing;
|
||||
/**
|
||||
* 启用状态
|
||||
* {@link fun.asgc.neutrino.proxy.server.constant.EnableStatusEnum}
|
||||
*/
|
||||
private Integer enable;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 调度管理执行响应
|
||||
* @author: zCans
|
||||
* @date: 2022/9/12
|
||||
*/
|
||||
@Data
|
||||
public class JobInfoExecuteRes {
|
||||
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 调度管理列表响应
|
||||
* @author: zCans
|
||||
* @date: 2022/9/12
|
||||
*/
|
||||
@Data
|
||||
public class JobInfoListRes {
|
||||
private Integer id;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String desc;
|
||||
/**
|
||||
* 处理器
|
||||
*/
|
||||
private String handler;
|
||||
/**
|
||||
* cron
|
||||
*/
|
||||
private String cron;
|
||||
/**
|
||||
* 任务参数
|
||||
*/
|
||||
private String param;
|
||||
/**
|
||||
* 任务报警邮箱
|
||||
*/
|
||||
private String alarmEmail;
|
||||
/**
|
||||
* 任务报警钉钉
|
||||
*/
|
||||
private String alarmDing;
|
||||
/**
|
||||
* 启用状态
|
||||
* {@link fun.asgc.neutrino.proxy.server.constant.EnableStatusEnum}
|
||||
*/
|
||||
private Integer enable;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 调度管理列表响应
|
||||
* @author: zCans
|
||||
* @date: 2022/9/12
|
||||
*/
|
||||
@Data
|
||||
public class JobInfoUpdateEnableStatusRes {
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 调度管理更新响应
|
||||
* @author: zCans
|
||||
* @date: 2022/9/12
|
||||
*/
|
||||
@Data
|
||||
public class JobInfoUpdateRes {
|
||||
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/9/12
|
||||
*/
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
public class ReportDataViewRes {
|
||||
/**
|
||||
* 在线用户数
|
||||
*/
|
||||
private Integer userOnlineNumber;
|
||||
/**
|
||||
* 启用用户数
|
||||
*/
|
||||
private Integer enableUserNumber;
|
||||
/**
|
||||
* 用户总数
|
||||
*/
|
||||
private Integer userNumber;
|
||||
/**
|
||||
* 在线license数
|
||||
*/
|
||||
private Integer licenseOnlineNumber;
|
||||
/**
|
||||
* 启用license数
|
||||
*/
|
||||
private Integer enableLicenseNumber;
|
||||
/**
|
||||
* license总数
|
||||
*/
|
||||
private Integer licenseNumber;
|
||||
/**
|
||||
* 服务端口在线数
|
||||
*/
|
||||
private Integer serverPortOnlineNumber;
|
||||
/**
|
||||
* 启用服务端口数
|
||||
*/
|
||||
private Integer enableServerPortNumber;
|
||||
/**
|
||||
* 总的服务端口数
|
||||
*/
|
||||
private Integer serverPortNumber;
|
||||
/**
|
||||
* 累计上行流量
|
||||
*/
|
||||
private String totalUpstreamFlow;
|
||||
/**
|
||||
* 累计下行流量
|
||||
*/
|
||||
private String totalDownwardFlow;
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package fun.asgc.neutrino.proxy.server.dal;
|
||||
|
||||
import fun.asgc.neutrino.core.annotation.Component;
|
||||
import fun.asgc.neutrino.core.aop.Intercept;
|
||||
import fun.asgc.neutrino.core.db.annotation.Delete;
|
||||
import fun.asgc.neutrino.core.db.mapper.SqlMapper;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/9/17
|
||||
*/
|
||||
@Intercept(ignoreGlobal = true)
|
||||
@Component
|
||||
public interface DataCleanMapper extends SqlMapper {
|
||||
|
||||
@Delete("delete from `job_log` where create_time < ?")
|
||||
void cleanJobLog(Date date);
|
||||
|
||||
}
|
||||
+26
@@ -22,8 +22,19 @@
|
||||
package fun.asgc.neutrino.proxy.server.dal;
|
||||
|
||||
import fun.asgc.neutrino.core.annotation.Component;
|
||||
import fun.asgc.neutrino.core.annotation.Param;
|
||||
import fun.asgc.neutrino.core.aop.Intercept;
|
||||
import fun.asgc.neutrino.core.db.annotation.ResultType;
|
||||
import fun.asgc.neutrino.core.db.annotation.Select;
|
||||
import fun.asgc.neutrino.core.db.annotation.Update;
|
||||
import fun.asgc.neutrino.core.db.mapper.SqlMapper;
|
||||
import fun.asgc.neutrino.core.db.page.Page;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.JobInfoListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.JobInfoListRes;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.JobInfoDO;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -34,4 +45,19 @@ import fun.asgc.neutrino.core.db.mapper.SqlMapper;
|
||||
@Component
|
||||
public interface JobInfoMapper extends SqlMapper {
|
||||
|
||||
@ResultType(JobInfoListRes.class)
|
||||
@Select("select * from job_info")
|
||||
void page(Page page, JobInfoListReq req);
|
||||
|
||||
@Select("select * from job_info where id = ?")
|
||||
JobInfoDO findById(Integer id);
|
||||
|
||||
@Update("update `job_info` set enable = :enable,update_time = :updateTime where id = :id")
|
||||
void updateEnableStatus(@Param("id") Integer id, @Param("enable") Integer enable, @Param("updateTime") Date updateTime);
|
||||
|
||||
@ResultType(JobInfoDO.class)
|
||||
@Select("select * from job_info where enable = 1")
|
||||
List<JobInfoDO> findEnableList();
|
||||
|
||||
void update(JobInfoDO jobInfoDO);
|
||||
}
|
||||
|
||||
+5
@@ -23,7 +23,10 @@ package fun.asgc.neutrino.proxy.server.dal;
|
||||
|
||||
import fun.asgc.neutrino.core.annotation.Component;
|
||||
import fun.asgc.neutrino.core.aop.Intercept;
|
||||
import fun.asgc.neutrino.core.db.annotation.Insert;
|
||||
import fun.asgc.neutrino.core.db.mapper.SqlMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.JobInfoDO;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.JobLogDO;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -34,4 +37,6 @@ import fun.asgc.neutrino.core.db.mapper.SqlMapper;
|
||||
@Component
|
||||
public interface JobLogMapper extends SqlMapper {
|
||||
|
||||
@Insert("insert into job_log(`job_id`,`handler`,`param`,`code`,`msg`,`alarm_status`,`create_time`) values(:jobId,:handler,:param,:code,:msg,:alarmStatus,:createTime)")
|
||||
void add(JobLogDO jobLog);
|
||||
}
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ import java.util.Date;
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
@Table("job_log")
|
||||
public class JobLog {
|
||||
public class JobLogDO {
|
||||
@Autowired
|
||||
private Integer id;
|
||||
private Integer jobId;
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package fun.asgc.neutrino.proxy.server.job;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import fun.asgc.neutrino.core.annotation.Autowired;
|
||||
import fun.asgc.neutrino.core.annotation.Component;
|
||||
import fun.asgc.neutrino.core.annotation.NonIntercept;
|
||||
import fun.asgc.neutrino.core.quartz.IJobHandler;
|
||||
import fun.asgc.neutrino.core.quartz.annotation.JobHandler;
|
||||
import fun.asgc.neutrino.core.util.DateUtil;
|
||||
import fun.asgc.neutrino.proxy.server.dal.DataCleanMapper;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 日志清理Job
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/9/17
|
||||
*/
|
||||
@Slf4j
|
||||
@NonIntercept
|
||||
@Component
|
||||
@JobHandler(name = "DataCleanJob", cron = "0 0 1 * * ?")
|
||||
public class DataCleanJob implements IJobHandler {
|
||||
@Autowired
|
||||
private DataCleanMapper dataCleanMapper;
|
||||
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
/**
|
||||
* Job日志保存天数
|
||||
*/
|
||||
private static final Integer JOB_LOG_KEEP_DAYS = 7;
|
||||
|
||||
@Override
|
||||
public void execute(String s) throws Exception {
|
||||
JobParams jobParams = getParams(s);
|
||||
|
||||
Date date = DateUtil.addDate(new Date(), Calendar.DATE, jobParams.getJobLogKeepDays());
|
||||
log.info("清理调度管理日志 date:{}", sdf.format(date));
|
||||
dataCleanMapper.cleanJobLog(date);
|
||||
}
|
||||
|
||||
public static JobParams getParams(String s) {
|
||||
try {
|
||||
return JSONObject.parseObject(s, JobParams.class);
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
return new JobParams()
|
||||
.setJobLogKeepDays(JOB_LOG_KEEP_DAYS);
|
||||
}
|
||||
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
public static class JobParams {
|
||||
private Integer jobLogKeepDays;
|
||||
}
|
||||
}
|
||||
+87
-1
@@ -21,10 +21,29 @@
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.service;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import fun.asgc.neutrino.core.annotation.Autowired;
|
||||
import fun.asgc.neutrino.core.annotation.Component;
|
||||
import fun.asgc.neutrino.core.annotation.NonIntercept;
|
||||
import fun.asgc.neutrino.core.db.page.Page;
|
||||
import fun.asgc.neutrino.core.db.page.PageQuery;
|
||||
import fun.asgc.neutrino.core.quartz.IJobSource;
|
||||
import fun.asgc.neutrino.core.quartz.JobExecutor;
|
||||
import fun.asgc.neutrino.core.quartz.JobInfo;
|
||||
import fun.asgc.neutrino.core.util.BeanManager;
|
||||
import fun.asgc.neutrino.core.util.CollectionUtil;
|
||||
import fun.asgc.neutrino.proxy.server.constant.EnableStatusEnum;
|
||||
import fun.asgc.neutrino.proxy.server.constant.ExceptionConstant;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.*;
|
||||
import fun.asgc.neutrino.proxy.server.dal.JobInfoMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.JobInfoDO;
|
||||
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: aoshiguchen
|
||||
@@ -33,6 +52,73 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Slf4j
|
||||
@NonIntercept
|
||||
@Component
|
||||
public class JobInfoService {
|
||||
public class JobInfoService implements IJobSource {
|
||||
|
||||
@Autowired
|
||||
private JobInfoMapper jobInfoMapper;
|
||||
|
||||
public Page<JobInfoListRes> page(PageQuery pageQuery, JobInfoListReq req) {
|
||||
Page<JobInfoListRes> page = Page.create(pageQuery);
|
||||
jobInfoMapper.page(page, req);
|
||||
return page;
|
||||
}
|
||||
|
||||
public JobInfoUpdateEnableStatusRes updateEnableStatus(JobInfoUpdateEnableStatusReq req) {
|
||||
JobInfoDO jobInfoDO = jobInfoMapper.findById(req.getId());
|
||||
ParamCheckUtil.checkNotNull(jobInfoDO, ExceptionConstant.JOB_INFO_NOT_EXIST);
|
||||
jobInfoMapper.updateEnableStatus(req.getId(), req.getEnable(), new Date());
|
||||
if (EnableStatusEnum.ENABLE.getStatus().equals(req.getEnable())) {
|
||||
BeanManager.getBean(JobExecutor.class).add(new JobInfo()
|
||||
.setId(String.valueOf(jobInfoDO.getId()))
|
||||
.setName(jobInfoDO.getHandler())
|
||||
.setDesc(jobInfoDO.getDesc())
|
||||
.setCron(jobInfoDO.getCron())
|
||||
.setParam(jobInfoDO.getParam())
|
||||
);
|
||||
} else {
|
||||
BeanManager.getBean(JobExecutor.class).remove(String.valueOf(req.getId()));
|
||||
}
|
||||
return new JobInfoUpdateEnableStatusRes();
|
||||
}
|
||||
|
||||
public JobInfoExecuteRes execute(JobInfoExecuteReq req) {
|
||||
BeanManager.getBean(JobExecutor.class).trigger(String.valueOf(req.getId()), req.getParam());
|
||||
return new JobInfoExecuteRes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JobInfo> sourceList() {
|
||||
List<JobInfo> jobInfoList = Lists.newArrayList();
|
||||
List<JobInfoDO> jobInfoDOList = jobInfoMapper.findEnableList();
|
||||
if (CollectionUtil.isEmpty(jobInfoDOList)) {
|
||||
return jobInfoList;
|
||||
}
|
||||
for (JobInfoDO item : jobInfoDOList) {
|
||||
jobInfoList.add(new JobInfo()
|
||||
.setId(String.valueOf(item.getId()))
|
||||
.setName(item.getHandler())
|
||||
.setDesc(item.getDesc())
|
||||
.setCron(item.getCron())
|
||||
.setParam(item.getParam())
|
||||
);
|
||||
}
|
||||
|
||||
return jobInfoList;
|
||||
}
|
||||
|
||||
public JobInfoUpdateRes update(JobInfoUpdateReq req) {
|
||||
JobInfoDO jobInfoDO = jobInfoMapper.findById(req.getId());
|
||||
ParamCheckUtil.checkNotNull( jobInfoDO, ExceptionConstant.PORT_MAPPING_NOT_EXIST);
|
||||
JobInfoDO jobInfo = new JobInfoDO();
|
||||
jobInfo.setId(req.getId());
|
||||
jobInfo.setCron(req.getCron());
|
||||
jobInfo.setDesc(req.getDesc());
|
||||
jobInfo.setAlarmEmail(req.getAlarmEmail());
|
||||
jobInfo.setAlarmDing(req.getAlarmDing());
|
||||
jobInfo.setParam(req.getParam());
|
||||
jobInfo.setUpdateTime(new Date());
|
||||
|
||||
jobInfoMapper.update( jobInfo);
|
||||
return new JobInfoUpdateRes();
|
||||
}
|
||||
}
|
||||
|
||||
+22
@@ -21,11 +21,17 @@
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.service;
|
||||
|
||||
import fun.asgc.neutrino.core.annotation.Autowired;
|
||||
import fun.asgc.neutrino.core.annotation.Component;
|
||||
import fun.asgc.neutrino.core.annotation.NonIntercept;
|
||||
import fun.asgc.neutrino.core.quartz.IJobCallback;
|
||||
import fun.asgc.neutrino.core.quartz.JobInfo;
|
||||
import fun.asgc.neutrino.proxy.server.dal.JobLogMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.JobLogDO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -36,14 +42,30 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@NonIntercept
|
||||
@Component
|
||||
public class JobLogService implements IJobCallback {
|
||||
@Autowired
|
||||
private JobLogMapper jobLogMapper;
|
||||
|
||||
@Override
|
||||
public void executeLog(JobInfo jobInfo, Throwable throwable) {
|
||||
Integer code = 0;
|
||||
String msg = "";
|
||||
if (null == throwable) {
|
||||
msg = "执行成功";
|
||||
log.info("job[id={},name={}]执行完毕", jobInfo.getId(), jobInfo.getName());
|
||||
} else {
|
||||
log.error("job[id={},name={}]执行异常", jobInfo.getId(), jobInfo.getName(), throwable);
|
||||
msg = "执行异常:\r\n" + ExceptionUtils.getStackTrace(throwable);
|
||||
code = -1;
|
||||
}
|
||||
jobLogMapper.add(new JobLogDO()
|
||||
.setJobId(Integer.valueOf(jobInfo.getId()))
|
||||
.setHandler(jobInfo.getName())
|
||||
.setParam(jobInfo.getParam())
|
||||
.setCode(code)
|
||||
.setMsg(msg)
|
||||
.setAlarmStatus(0)
|
||||
.setCreateTime(new Date())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -103,7 +103,7 @@ public class LicenseService {
|
||||
*/
|
||||
public LicenseCreateRes create(LicenseCreateReq req) {
|
||||
LicenseDO licenseDO = licenseMapper.checkRepeat(req.getUserId(), req.getName());
|
||||
ParamCheckUtil.checkExpression(null == licenseDO, ExceptionConstant.LICENSE_NAME_CANNOT_REPEAT);
|
||||
ParamCheckUtil.checkNotNull(licenseDO, ExceptionConstant.LICENSE_NAME_CANNOT_REPEAT);
|
||||
|
||||
String key = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
Date now = new Date();
|
||||
@@ -122,10 +122,10 @@ public class LicenseService {
|
||||
|
||||
public LicenseUpdateRes update(LicenseUpdateReq req) {
|
||||
LicenseDO oldLicenseDO = licenseMapper.findById(req.getId());
|
||||
ParamCheckUtil.checkExpression(null != oldLicenseDO, ExceptionConstant.LICENSE_NOT_EXIST);
|
||||
ParamCheckUtil.checkNotNull(oldLicenseDO, ExceptionConstant.LICENSE_NOT_EXIST);
|
||||
|
||||
LicenseDO licenseCheck = licenseMapper.checkRepeat(oldLicenseDO.getUserId(), req.getName(), Sets.newHashSet(oldLicenseDO.getId()));
|
||||
ParamCheckUtil.checkExpression(null == licenseCheck, ExceptionConstant.LICENSE_NAME_CANNOT_REPEAT);
|
||||
ParamCheckUtil.checkNotNull(licenseCheck, ExceptionConstant.LICENSE_NAME_CANNOT_REPEAT);
|
||||
|
||||
licenseMapper.update(req.getId(), req.getName(), new Date());
|
||||
return new LicenseUpdateRes();
|
||||
|
||||
+10
-10
@@ -100,14 +100,14 @@ public class PortMappingService {
|
||||
|
||||
public PortMappingCreateRes create(PortMappingCreateReq req) {
|
||||
LicenseDO licenseDO = licenseMapper.findById(req.getLicenseId());
|
||||
ParamCheckUtil.checkExpression(null != licenseDO, ExceptionConstant.LICENSE_NOT_EXIST);
|
||||
ParamCheckUtil.checkNotNull(licenseDO, ExceptionConstant.LICENSE_NOT_EXIST);
|
||||
if (!SystemContextHolder.isAdmin()) {
|
||||
// 临时处理,如果当前用户不是管理院,则操作userId不能为1
|
||||
ParamCheckUtil.checkExpression(!licenseDO.getUserId().equals(1), ExceptionConstant.NO_PERMISSION_VISIT);
|
||||
}
|
||||
PortPoolDO portPoolDO = portPoolMapper.findByPort(req.getServerPort());
|
||||
ParamCheckUtil.checkExpression(null != portPoolDO, ExceptionConstant.PORT_NOT_EXIST);
|
||||
ParamCheckUtil.checkExpression(null == portMappingMapper.findByPort(req.getServerPort()), ExceptionConstant.PORT_CANNOT_REPEAT_MAPPING, req.getServerPort());
|
||||
ParamCheckUtil.checkNotNull(portPoolDO, ExceptionConstant.PORT_NOT_EXIST);
|
||||
ParamCheckUtil.checkNotNull(portMappingMapper.findByPort(req.getServerPort()), ExceptionConstant.PORT_CANNOT_REPEAT_MAPPING, req.getServerPort());
|
||||
|
||||
|
||||
Date now = new Date();
|
||||
@@ -126,14 +126,14 @@ public class PortMappingService {
|
||||
|
||||
public PortMappingUpdateRes update(PortMappingUpdateReq req) {
|
||||
LicenseDO licenseDO = licenseMapper.findById(req.getLicenseId());
|
||||
ParamCheckUtil.checkExpression(null != licenseDO, ExceptionConstant.LICENSE_NOT_EXIST);
|
||||
ParamCheckUtil.checkNotNull(licenseDO, ExceptionConstant.LICENSE_NOT_EXIST);
|
||||
if (!SystemContextHolder.isAdmin()) {
|
||||
// 临时处理,如果当前用户不是管理员,则操作userId不能为1
|
||||
ParamCheckUtil.checkExpression(!licenseDO.getUserId().equals(1), ExceptionConstant.NO_PERMISSION_VISIT);
|
||||
}
|
||||
PortPoolDO portPoolDO = portPoolMapper.findByPort(req.getServerPort());
|
||||
ParamCheckUtil.checkExpression(null != portPoolDO, ExceptionConstant.PORT_NOT_EXIST);
|
||||
ParamCheckUtil.checkExpression(null == portMappingMapper.findByPort(req.getServerPort(), Sets.newHashSet(req.getId())), ExceptionConstant.PORT_CANNOT_REPEAT_MAPPING, req.getServerPort());
|
||||
ParamCheckUtil.checkNotNull(portPoolDO, ExceptionConstant.PORT_NOT_EXIST);
|
||||
ParamCheckUtil.checkNotNull(portMappingMapper.findByPort(req.getServerPort(), Sets.newHashSet(req.getId())), ExceptionConstant.PORT_CANNOT_REPEAT_MAPPING, req.getServerPort());
|
||||
|
||||
PortMappingDO portMappingDO = new PortMappingDO();
|
||||
portMappingDO.setId(req.getId());
|
||||
@@ -177,10 +177,10 @@ public class PortMappingService {
|
||||
|
||||
public PortMappingUpdateEnableStatusRes updateEnableStatus(PortMappingUpdateEnableStatusReq req) {
|
||||
PortMappingDO portMappingDO = portMappingMapper.findById(req.getId());
|
||||
ParamCheckUtil.checkExpression(null != portMappingDO, ExceptionConstant.PORT_MAPPING_NOT_EXIST);
|
||||
ParamCheckUtil.checkNotNull(portMappingDO, ExceptionConstant.PORT_MAPPING_NOT_EXIST);
|
||||
|
||||
LicenseDO licenseDO = licenseMapper.findById(portMappingDO.getLicenseId());
|
||||
ParamCheckUtil.checkExpression(null != licenseDO, ExceptionConstant.LICENSE_NOT_EXIST);
|
||||
ParamCheckUtil.checkNotNull(licenseDO, ExceptionConstant.LICENSE_NOT_EXIST);
|
||||
if (!SystemContextHolder.isAdmin()) {
|
||||
// 临时处理,如果当前用户不是管理员,则操作userId不能为1
|
||||
ParamCheckUtil.checkExpression(!licenseDO.getUserId().equals(1), ExceptionConstant.NO_PERMISSION_VISIT);
|
||||
@@ -193,10 +193,10 @@ public class PortMappingService {
|
||||
|
||||
public void delete(Integer id) {
|
||||
PortMappingDO portMappingDO = portMappingMapper.findById(id);
|
||||
ParamCheckUtil.checkExpression(null != portMappingDO, ExceptionConstant.PORT_MAPPING_NOT_EXIST);
|
||||
ParamCheckUtil.checkNotNull(portMappingDO, ExceptionConstant.PORT_MAPPING_NOT_EXIST);
|
||||
|
||||
LicenseDO licenseDO = licenseMapper.findById(portMappingDO.getLicenseId());
|
||||
ParamCheckUtil.checkExpression(null != licenseDO, ExceptionConstant.LICENSE_NOT_EXIST);
|
||||
ParamCheckUtil.checkNotNull(licenseDO, ExceptionConstant.LICENSE_NOT_EXIST);
|
||||
if (!SystemContextHolder.isAdmin()) {
|
||||
// 临时处理,如果当前用户不是管理员,则操作userId不能为1
|
||||
ParamCheckUtil.checkExpression(!licenseDO.getUserId().equals(1), ExceptionConstant.NO_PERMISSION_VISIT);
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ public class PortPoolService {
|
||||
|
||||
public PortPoolCreateRes create(PortPoolCreateReq req) {
|
||||
PortPoolDO oldPortPoolDO = portPoolMapper.findByPort(req.getPort());
|
||||
ParamCheckUtil.checkExpression(null == oldPortPoolDO, ExceptionConstant.PORT_CANNOT_REPEAT);
|
||||
ParamCheckUtil.checkNotNull(oldPortPoolDO, ExceptionConstant.PORT_CANNOT_REPEAT);
|
||||
|
||||
Date now = new Date();
|
||||
|
||||
|
||||
+30
@@ -66,6 +66,36 @@ public class ParamCheckUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkNotNull(Object obj, ExceptionConstant constant, Object... params) {
|
||||
if (null == obj) {
|
||||
throw ServiceException.create(constant, params);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkNotEmpty(String str, ExceptionConstant constant, Object... params) {
|
||||
if (StringUtil.isEmpty(str)) {
|
||||
throw ServiceException.create(constant, params);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkNotEmpty(Collection collection, ExceptionConstant constant, Object... params) {
|
||||
if (null == collection || collection.isEmpty()) {
|
||||
throw ServiceException.create(constant, params);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkNotEmpty(Map map, ExceptionConstant constant, Object... params) {
|
||||
if (null == map || map.isEmpty()) {
|
||||
throw ServiceException.create(constant, params);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkNotEmpty(Set set, ExceptionConstant constant, Object... params) {
|
||||
if (null == set || set.isEmpty()) {
|
||||
throw ServiceException.create(constant, params);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkExpression(boolean expression, ExceptionConstant constant, Object... params) {
|
||||
if (!expression) {
|
||||
throw ServiceException.create(constant, params);
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<mapper namespace = "fun.asgc.neutrino.proxy.server.dal.JobInfoMapper">
|
||||
|
||||
<update id="update">
|
||||
update `job_info`
|
||||
set cron = :cron,desc = :desc,alarm_email=:alarmEmail,alarm_ding=:alarmDing,param=:param,update_time=:updateTime
|
||||
where id =:id
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -101,7 +101,7 @@ CREATE TABLE IF NOT EXISTS `user_connect_record` (
|
||||
CREATE TABLE IF NOT EXISTS `job_info` (
|
||||
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
`desc` VARCHAR(255) NOT NULL,
|
||||
`handler` VARCHAR(255) DEFAULT NULL,
|
||||
`handler` VARCHAR(255) NOT NULL,
|
||||
`cron` VARCHAR(128) NOT NULL ,
|
||||
`param` VARCHAR(512) DEFAULT NULL,
|
||||
`alarm_email` VARCHAR(255) DEFAULT NULL,
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#job_qrtz_trigger_info
|
||||
insert into job_info(`id`, `desc`, `handler`, `cron`, `param`, `enable`, `create_time`, `update_time`) values
|
||||
(1, '示例Job', 'DemoJob', '0/10 * * * * ?', '{"a":101}', 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
insert into job_info(`id`, `desc`, `handler`, `cron`, `param`, `enable`, `create_time`, `update_time`) values
|
||||
(2, '数据清理任务', 'DataCleanJob', '0 0 1 * * ?', '', 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
@@ -1 +0,0 @@
|
||||
#job_qrtz_trigger_info
|
||||
Reference in New Issue
Block a user