mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-08 04:39:00 +08:00
feat(codegen): 删除不再使用的 GenConfig、TableEntity、SqlDto、PayErrorCodes 等类文件
- 移除冗余的代码文件以简化项目结构 - 清理旧的工具类和实体类,提升代码可维护性 (cherry picked from commit f6eb09a169a2a1bd52501b543018aef15f74e21e)
This commit is contained in:
1 parent
cf917b5988
commit
72ac720fb6
12 files changed
-1066
No files matched your search
-69
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2026, lengleng All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*/
|
||||
|
||||
package com.pig4cloud.pigx.codegen.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2018/8/2 生成配置
|
||||
*/
|
||||
@Data
|
||||
public class GenConfig {
|
||||
|
||||
/**
|
||||
* 数据源name
|
||||
*/
|
||||
private String dsName;
|
||||
|
||||
/**
|
||||
* 包名
|
||||
*/
|
||||
private String packageName;
|
||||
|
||||
/**
|
||||
* 作者
|
||||
*/
|
||||
private String author;
|
||||
|
||||
/**
|
||||
* 模块名称
|
||||
*/
|
||||
private String moduleName;
|
||||
|
||||
/**
|
||||
* 表前缀
|
||||
*/
|
||||
private String tablePrefix;
|
||||
|
||||
/**
|
||||
* 表名称
|
||||
*/
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 表备注
|
||||
*/
|
||||
private String comments;
|
||||
|
||||
/**
|
||||
* 代码风格 0 - avue 1 - element 2 - uview
|
||||
*/
|
||||
private String style;
|
||||
|
||||
}
|
||||
-66
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2026, lengleng All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*/
|
||||
|
||||
package com.pig4cloud.pigx.codegen.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2018/07/29 表属性: https://blog.csdn.net/lkforce/article/details/79557482
|
||||
*/
|
||||
@Data
|
||||
public class TableEntity {
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String comments;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private ColumnEntity pk;
|
||||
|
||||
/**
|
||||
* 列名
|
||||
*/
|
||||
private List<ColumnEntity> columns;
|
||||
|
||||
/**
|
||||
* 驼峰类型
|
||||
*/
|
||||
private String caseClassName;
|
||||
|
||||
/**
|
||||
* 普通类型
|
||||
*/
|
||||
private String lowerClassName;
|
||||
|
||||
/**
|
||||
* 数据库类型 (用于根据数据库个性化)
|
||||
*/
|
||||
private String dbType;
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.pig4cloud.pigx.codegen.util.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2022/5/2
|
||||
*/
|
||||
@Data
|
||||
public class SqlDto {
|
||||
|
||||
/**
|
||||
* 数据源ID
|
||||
*/
|
||||
private String dsName;
|
||||
|
||||
/**
|
||||
* sql脚本
|
||||
*/
|
||||
private String sql;
|
||||
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
package com.pig4cloud.pigx.pay.utils;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2023/3/1
|
||||
*
|
||||
* 支付异常错误
|
||||
*/
|
||||
public interface PayErrorCodes {
|
||||
|
||||
String UNSUPPORTED_OPERATION = "unsupported_operation";
|
||||
|
||||
}
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
//package com.xxl.job.admin.framework.web.interceptor;
|
||||
//
|
||||
//import com.xxl.job.admin.framework.util.I18nUtil;
|
||||
//import com.xxl.tool.freemarker.FtlTool;
|
||||
//import jakarta.servlet.http.HttpServletRequest;
|
||||
//import jakarta.servlet.http.HttpServletResponse;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.web.servlet.AsyncHandlerInterceptor;
|
||||
//import org.springframework.web.servlet.ModelAndView;
|
||||
//import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
//
|
||||
/// **
|
||||
// * push cookies to model as cookieMap
|
||||
// *
|
||||
// * @author xuxueli 2015-12-12 18:09:04
|
||||
// */
|
||||
//@Configuration
|
||||
//public class CommonDataInterceptor implements WebMvcConfigurer {
|
||||
//
|
||||
// @Override
|
||||
// public void addInterceptors(InterceptorRegistry registry) {
|
||||
// registry.addInterceptor(new AsyncHandlerInterceptor() {
|
||||
// @Override
|
||||
// public void postHandle(HttpServletRequest request,
|
||||
// HttpServletResponse response,
|
||||
// Object handler,
|
||||
// ModelAndView modelAndView) throws Exception {
|
||||
//
|
||||
// // static method
|
||||
// if (modelAndView != null) {
|
||||
// modelAndView.addObject("I18nUtil", FtlTool.generateStaticModel(I18nUtil.class.getName()));
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }).addPathPatterns("/**");
|
||||
// }
|
||||
//
|
||||
//}
|
||||
-98
@@ -1,98 +0,0 @@
|
||||
//package com.xxl.job.admin.util;
|
||||
//
|
||||
//import jakarta.servlet.http.Cookie;
|
||||
//import jakarta.servlet.http.HttpServletRequest;
|
||||
//import jakarta.servlet.http.HttpServletResponse;
|
||||
//
|
||||
/// **
|
||||
// * Cookie.Util
|
||||
// *
|
||||
// * @author xuxueli 2015-12-12 18:01:06
|
||||
// */
|
||||
//public class CookieUtil {
|
||||
//
|
||||
// // 默认缓存时间,单位/秒, 2H
|
||||
// private static final int COOKIE_MAX_AGE = Integer.MAX_VALUE;
|
||||
// // 保存路径,根路径
|
||||
// private static final String COOKIE_PATH = "/";
|
||||
//
|
||||
// /**
|
||||
// * 保存
|
||||
// *
|
||||
// * @param response
|
||||
// * @param key
|
||||
// * @param value
|
||||
// * @param ifRemember
|
||||
// */
|
||||
// public static void set(HttpServletResponse response, String key, String value, boolean ifRemember) {
|
||||
// int age = ifRemember?COOKIE_MAX_AGE:-1;
|
||||
// set(response, key, value, null, COOKIE_PATH, age, true);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 保存
|
||||
// *
|
||||
// * @param response
|
||||
// * @param key
|
||||
// * @param value
|
||||
// * @param maxAge
|
||||
// */
|
||||
// private static void set(HttpServletResponse response, String key, String value, String domain, String path, int maxAge, boolean isHttpOnly) {
|
||||
// Cookie cookie = new Cookie(key, value);
|
||||
// if (domain != null) {
|
||||
// cookie.setDomain(domain);
|
||||
// }
|
||||
// cookie.setPath(path);
|
||||
// cookie.setMaxAge(maxAge);
|
||||
// cookie.setHttpOnly(isHttpOnly);
|
||||
// response.addCookie(cookie);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 查询value
|
||||
// *
|
||||
// * @param request
|
||||
// * @param key
|
||||
// * @return
|
||||
// */
|
||||
// public static String getValue(HttpServletRequest request, String key) {
|
||||
// Cookie cookie = get(request, key);
|
||||
// if (cookie != null) {
|
||||
// return cookie.getValue();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 查询Cookie
|
||||
// *
|
||||
// * @param request
|
||||
// * @param key
|
||||
// */
|
||||
// private static Cookie get(HttpServletRequest request, String key) {
|
||||
// Cookie[] arr_cookie = request.getCookies();
|
||||
// if (arr_cookie != null && arr_cookie.length > 0) {
|
||||
// for (Cookie cookie : arr_cookie) {
|
||||
// if (cookie.getName().equals(key)) {
|
||||
// return cookie;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 删除Cookie
|
||||
// *
|
||||
// * @param request
|
||||
// * @param response
|
||||
// * @param key
|
||||
// */
|
||||
// public static void remove(HttpServletRequest request, HttpServletResponse response, String key) {
|
||||
// Cookie cookie = get(request, key);
|
||||
// if (cookie != null) {
|
||||
// set(response, key, "", null, COOKIE_PATH, 0, true);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
-31
@@ -1,31 +0,0 @@
|
||||
//package com.xxl.job.admin.util;
|
||||
//
|
||||
//import freemarker.ext.beans.BeansWrapper;
|
||||
//import freemarker.ext.beans.BeansWrapperBuilder;
|
||||
//import freemarker.template.Configuration;
|
||||
//import freemarker.template.TemplateHashModel;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//
|
||||
/// **
|
||||
// * ftl util
|
||||
// *
|
||||
// * @author xuxueli 2018-01-17 20:37:48
|
||||
// */
|
||||
//public class FtlUtil {
|
||||
// private static Logger logger = LoggerFactory.getLogger(FtlUtil.class);
|
||||
//
|
||||
// private static BeansWrapper wrapper = new BeansWrapperBuilder(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS).build(); //BeansWrapper.getDefaultInstance();
|
||||
//
|
||||
// public static TemplateHashModel generateStaticModel(String packageName) {
|
||||
// try {
|
||||
// TemplateHashModel staticModels = wrapper.getStaticModels();
|
||||
// TemplateHashModel fileStatics = (TemplateHashModel) staticModels.get(packageName);
|
||||
// return fileStatics;
|
||||
// } catch (Exception e) {
|
||||
// logger.error(e.getMessage(), e);
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
-92
@@ -1,92 +0,0 @@
|
||||
//package com.xxl.job.admin.framework.util.old;
|
||||
//
|
||||
//import com.fasterxml.jackson.core.JsonGenerationException;
|
||||
//import com.fasterxml.jackson.core.JsonParseException;
|
||||
//import com.fasterxml.jackson.databind.JavaType;
|
||||
//import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
//import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//
|
||||
//import java.io.IOException;
|
||||
//
|
||||
/// **
|
||||
// * Jackson util
|
||||
// *
|
||||
// * 1、obj need private and set/get;
|
||||
// * 2、do not support inner class;
|
||||
// *
|
||||
// * @author xuxueli 2015-9-25 18:02:56
|
||||
// */
|
||||
//public class JacksonUtil {
|
||||
// private static Logger logger = LoggerFactory.getLogger(JacksonUtil.class);
|
||||
//
|
||||
// private final static ObjectMapper objectMapper = new ObjectMapper();
|
||||
// public static ObjectMapper getInstance() {
|
||||
// return objectMapper;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * bean、array、List、Map --> json
|
||||
// *
|
||||
// * @param obj
|
||||
// * @return json string
|
||||
// * @throws Exception
|
||||
// */
|
||||
// public static String writeValueAsString(Object obj) {
|
||||
// try {
|
||||
// return getInstance().writeValueAsString(obj);
|
||||
// } catch (JsonGenerationException e) {
|
||||
// logger.error(e.getMessage(), e);
|
||||
// } catch (JsonMappingException e) {
|
||||
// logger.error(e.getMessage(), e);
|
||||
// } catch (IOException e) {
|
||||
// logger.error(e.getMessage(), e);
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * string --> bean、Map、List(array)
|
||||
// *
|
||||
// * @param jsonStr
|
||||
// * @param clazz
|
||||
// * @return obj
|
||||
// * @throws Exception
|
||||
// */
|
||||
// public static <T> T readValue(String jsonStr, Class<T> clazz) {
|
||||
// try {
|
||||
// return getInstance().readValue(jsonStr, clazz);
|
||||
// } catch (JsonParseException e) {
|
||||
// logger.error(e.getMessage(), e);
|
||||
// } catch (JsonMappingException e) {
|
||||
// logger.error(e.getMessage(), e);
|
||||
// } catch (IOException e) {
|
||||
// logger.error(e.getMessage(), e);
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * string --> List<Bean>...
|
||||
// *
|
||||
// * @param jsonStr
|
||||
// * @param parametrized
|
||||
// * @param parameterClasses
|
||||
// * @param <T>
|
||||
// * @return
|
||||
// */
|
||||
// public static <T> T readValue(String jsonStr, Class<?> parametrized, Class<?>... parameterClasses) {
|
||||
// try {
|
||||
// JavaType javaType = getInstance().getTypeFactory().constructParametricType(parametrized, parameterClasses);
|
||||
// return getInstance().readValue(jsonStr, javaType);
|
||||
// } catch (JsonParseException e) {
|
||||
// logger.error(e.getMessage(), e);
|
||||
// } catch (JsonMappingException e) {
|
||||
// logger.error(e.getMessage(), e);
|
||||
// } catch (IOException e) {
|
||||
// logger.error(e.getMessage(), e);
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//}
|
||||
-133
@@ -1,133 +0,0 @@
|
||||
//package com.xxl.job.admin.util;
|
||||
//
|
||||
//import java.util.concurrent.ConcurrentHashMap;
|
||||
//import java.util.concurrent.ConcurrentMap;
|
||||
//
|
||||
/// **
|
||||
// * local cache tool
|
||||
// *
|
||||
// * @author xuxueli 2018-01-22 21:37:34
|
||||
// */
|
||||
//public class LocalCacheUtil {
|
||||
//
|
||||
// private static ConcurrentMap<String, LocalCacheData> cacheRepository = new ConcurrentHashMap<String, LocalCacheData>(); // 类型建议用抽象父类,兼容性更好;
|
||||
// private static class LocalCacheData{
|
||||
// private String key;
|
||||
// private Object val;
|
||||
// private long timeoutTime;
|
||||
//
|
||||
// public LocalCacheData() {
|
||||
// }
|
||||
//
|
||||
// public LocalCacheData(String key, Object val, long timeoutTime) {
|
||||
// this.key = key;
|
||||
// this.val = val;
|
||||
// this.timeoutTime = timeoutTime;
|
||||
// }
|
||||
//
|
||||
// public String getKey() {
|
||||
// return key;
|
||||
// }
|
||||
//
|
||||
// public void setKey(String key) {
|
||||
// this.key = key;
|
||||
// }
|
||||
//
|
||||
// public Object getVal() {
|
||||
// return val;
|
||||
// }
|
||||
//
|
||||
// public void setVal(Object val) {
|
||||
// this.val = val;
|
||||
// }
|
||||
//
|
||||
// public long getTimeoutTime() {
|
||||
// return timeoutTime;
|
||||
// }
|
||||
//
|
||||
// public void setTimeoutTime(long timeoutTime) {
|
||||
// this.timeoutTime = timeoutTime;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * set cache
|
||||
// *
|
||||
// * @param key
|
||||
// * @param val
|
||||
// * @param cacheTime
|
||||
// * @return
|
||||
// */
|
||||
// public static boolean set(String key, Object val, long cacheTime){
|
||||
//
|
||||
// // clean timeout cache, before set new cache (avoid cache too much)
|
||||
// cleanTimeoutCache();
|
||||
//
|
||||
// // set new cache
|
||||
// if (key==null || key.trim().length()==0) {
|
||||
// return false;
|
||||
// }
|
||||
// if (val == null) {
|
||||
// remove(key);
|
||||
// }
|
||||
// if (cacheTime <= 0) {
|
||||
// remove(key);
|
||||
// }
|
||||
// long timeoutTime = System.currentTimeMillis() + cacheTime;
|
||||
// LocalCacheData localCacheData = new LocalCacheData(key, val, timeoutTime);
|
||||
// cacheRepository.put(localCacheData.getKey(), localCacheData);
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * remove cache
|
||||
// *
|
||||
// * @param key
|
||||
// * @return
|
||||
// */
|
||||
// public static boolean remove(String key){
|
||||
// if (key==null || key.trim().length()==0) {
|
||||
// return false;
|
||||
// }
|
||||
// cacheRepository.remove(key);
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * get cache
|
||||
// *
|
||||
// * @param key
|
||||
// * @return
|
||||
// */
|
||||
// public static Object get(String key){
|
||||
// if (key==null || key.trim().length()==0) {
|
||||
// return null;
|
||||
// }
|
||||
// LocalCacheData localCacheData = cacheRepository.get(key);
|
||||
// if (localCacheData!=null && System.currentTimeMillis()<localCacheData.getTimeoutTime()) {
|
||||
// return localCacheData.getVal();
|
||||
// } else {
|
||||
// remove(key);
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * clean timeout cache
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
// public static boolean cleanTimeoutCache(){
|
||||
// if (!cacheRepository.keySet().isEmpty()) {
|
||||
// for (String key: cacheRepository.keySet()) {
|
||||
// LocalCacheData localCacheData = cacheRepository.get(key);
|
||||
// if (localCacheData!=null && System.currentTimeMillis()>=localCacheData.getTimeoutTime()) {
|
||||
// cacheRepository.remove(key);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
//package com.xxl.job.admin.core.jobbean;
|
||||
//
|
||||
//import com.xxl.job.admin.core.thread.JobTriggerPoolHelper;
|
||||
//import com.xxl.job.admin.core.trigger.TriggerTypeEnum;
|
||||
//import org.quartz.JobExecutionContext;
|
||||
//import org.quartz.JobExecutionException;
|
||||
//import org.quartz.JobKey;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||
//
|
||||
/// **
|
||||
// * http job bean
|
||||
// * “@DisallowConcurrentExecution” disable concurrent, thread size can not be only one, better given more
|
||||
// * @author xuxueli 2015-12-17 18:20:34
|
||||
// */
|
||||
////@DisallowConcurrentExecution
|
||||
//public class RemoteHttpJobBean extends QuartzJobBean {
|
||||
// private static Logger logger = LoggerFactory.getLogger(RemoteHttpJobBean.class);
|
||||
//
|
||||
// @Override
|
||||
// protected void executeInternal(JobExecutionContext context)
|
||||
// throws JobExecutionException {
|
||||
//
|
||||
// // load jobId
|
||||
// JobKey jobKey = context.getTrigger().getJobKey();
|
||||
// Integer jobId = Integer.valueOf(jobKey.getName());
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
//}
|
||||
-413
@@ -1,413 +0,0 @@
|
||||
//package com.xxl.job.admin.core.schedule;
|
||||
//
|
||||
//import com.xxl.job.admin.core.conf.XxlJobAdminConfig;
|
||||
//import com.xxl.job.admin.core.jobbean.RemoteHttpJobBean;
|
||||
//import com.xxl.job.admin.core.model.XxlJobInfo;
|
||||
//import com.xxl.job.admin.core.thread.JobFailMonitorHelper;
|
||||
//import com.xxl.job.admin.core.thread.JobRegistryMonitorHelper;
|
||||
//import com.xxl.job.admin.core.thread.JobTriggerPoolHelper;
|
||||
//import com.xxl.job.admin.core.util.I18nUtil;
|
||||
//import com.xxl.job.core.biz.AdminBiz;
|
||||
//import com.xxl.job.core.biz.ExecutorBiz;
|
||||
//import com.xxl.job.core.enums.ExecutorBlockStrategyEnum;
|
||||
//import com.xxl.rpc.remoting.invoker.XxlRpcInvokerFactory;
|
||||
//import com.xxl.rpc.remoting.invoker.call.CallType;
|
||||
//import com.xxl.rpc.remoting.invoker.reference.XxlRpcReferenceBean;
|
||||
//import com.xxl.rpc.remoting.invoker.route.LoadBalance;
|
||||
//import com.xxl.rpc.remoting.net.NetEnum;
|
||||
//import com.xxl.rpc.remoting.net.impl.servlet.server.ServletServerHandler;
|
||||
//import com.xxl.rpc.remoting.provider.XxlRpcProviderFactory;
|
||||
//import com.xxl.rpc.serialize.Serializer;
|
||||
//import org.quartz.*;
|
||||
//import org.quartz.Trigger.TriggerState;
|
||||
//import org.quartz.impl.triggers.CronTriggerImpl;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//import org.springframework.util.Assert;
|
||||
//
|
||||
//import javax.servlet.ServletException;
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import javax.servlet.http.HttpServletResponse;
|
||||
//import java.io.IOException;
|
||||
//import java.util.Date;
|
||||
//import java.util.concurrent.ConcurrentHashMap;
|
||||
//
|
||||
/// **
|
||||
// * base quartz scheduler util
|
||||
// * @author xuxueli 2015-12-19 16:13:53
|
||||
// */
|
||||
//public final class XxlJobDynamicScheduler {
|
||||
// private static final Logger logger = LoggerFactory.getLogger(XxlJobDynamicScheduler_old.class);
|
||||
//
|
||||
// // ---------------------- param ----------------------
|
||||
//
|
||||
// // scheduler
|
||||
// private static Scheduler scheduler;
|
||||
// public void setScheduler(Scheduler scheduler) {
|
||||
// XxlJobDynamicScheduler_old.scheduler = scheduler;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // ---------------------- init + destroy ----------------------
|
||||
// public void start() throws Exception {
|
||||
// // valid
|
||||
// Assert.notNull(scheduler, "quartz scheduler is null");
|
||||
//
|
||||
// // init i18n
|
||||
// initI18n();
|
||||
//
|
||||
// // admin registry monitor run
|
||||
// JobRegistryMonitorHelper.getInstance().start();
|
||||
//
|
||||
// // admin monitor run
|
||||
// JobFailMonitorHelper.getInstance().start();
|
||||
//
|
||||
// // admin-server
|
||||
// initRpcProvider();
|
||||
//
|
||||
// logger.info(">>>>>>>>> init xxl-job admin success.");
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public void destroy() throws Exception {
|
||||
// // admin trigger pool stop
|
||||
// JobTriggerPoolHelper.toStop();
|
||||
//
|
||||
// // admin registry stop
|
||||
// JobRegistryMonitorHelper.getInstance().toStop();
|
||||
//
|
||||
// // admin monitor stop
|
||||
// JobFailMonitorHelper.getInstance().toStop();
|
||||
//
|
||||
// // admin-server
|
||||
// stopRpcProvider();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // ---------------------- I18n ----------------------
|
||||
//
|
||||
// private void initI18n(){
|
||||
// for (ExecutorBlockStrategyEnum item:ExecutorBlockStrategyEnum.values()) {
|
||||
// item.setTitle(I18nUtil.getString("jobconf_block_".concat(item.name())));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // ---------------------- admin rpc provider (no server version) ----------------------
|
||||
// private static ServletServerHandler servletServerHandler;
|
||||
// private void initRpcProvider(){
|
||||
// // init
|
||||
// XxlRpcProviderFactory xxlRpcProviderFactory = new XxlRpcProviderFactory();
|
||||
// xxlRpcProviderFactory.initConfig(
|
||||
// NetEnum.NETTY_HTTP,
|
||||
// Serializer.SerializeEnum.HESSIAN.getSerializer(),
|
||||
// null,
|
||||
// 0,
|
||||
// XxlJobAdminConfig.getAdminConfig().getAccessToken(),
|
||||
// null,
|
||||
// null);
|
||||
//
|
||||
// // add services
|
||||
// xxlRpcProviderFactory.addService(AdminBiz.class.getName(), null, XxlJobAdminConfig.getAdminConfig().getAdminBiz());
|
||||
//
|
||||
// // servlet handler
|
||||
// servletServerHandler = new ServletServerHandler(xxlRpcProviderFactory);
|
||||
// }
|
||||
// private void stopRpcProvider() throws Exception {
|
||||
// XxlRpcInvokerFactory.getInstance().stop();
|
||||
// }
|
||||
// public static void invokeAdminService(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
||||
// servletServerHandler.handle(null, request, response);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // ---------------------- executor-client ----------------------
|
||||
// private static ConcurrentHashMap<String, ExecutorBiz> executorBizRepository = new ConcurrentHashMap<String, ExecutorBiz>();
|
||||
// public static ExecutorBiz getExecutorBiz(String address) throws Exception {
|
||||
// // valid
|
||||
// if (address==null || address.trim().length()==0) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// // load-cache
|
||||
// address = address.trim();
|
||||
// ExecutorBiz executorBiz = executorBizRepository.get(address);
|
||||
// if (executorBiz != null) {
|
||||
// return executorBiz;
|
||||
// }
|
||||
//
|
||||
// // set-cache
|
||||
// executorBiz = (ExecutorBiz) new XxlRpcReferenceBean(
|
||||
// NetEnum.NETTY_HTTP,
|
||||
// Serializer.SerializeEnum.HESSIAN.getSerializer(),
|
||||
// CallType.SYNC,
|
||||
// LoadBalance.ROUND,
|
||||
// ExecutorBiz.class,
|
||||
// null,
|
||||
// 5000,
|
||||
// address,
|
||||
// XxlJobAdminConfig.getAdminConfig().getAccessToken(),
|
||||
// null,
|
||||
// null).getObject();
|
||||
//
|
||||
// executorBizRepository.put(address, executorBiz);
|
||||
// return executorBiz;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // ---------------------- schedule util ----------------------
|
||||
//
|
||||
// /**
|
||||
// * fill job info
|
||||
// *
|
||||
// * @param jobInfo
|
||||
// */
|
||||
// public static void fillJobInfo(XxlJobInfo jobInfo) {
|
||||
//
|
||||
// String name = String.valueOf(jobInfo.getId());
|
||||
//
|
||||
// // trigger key
|
||||
// TriggerKey triggerKey = TriggerKey.triggerKey(name);
|
||||
// try {
|
||||
//
|
||||
// // trigger cron
|
||||
// Trigger trigger = scheduler.getTrigger(triggerKey);
|
||||
// if (trigger!=null && trigger instanceof CronTriggerImpl) {
|
||||
// String cronExpression = ((CronTriggerImpl) trigger).getCronExpression();
|
||||
// jobInfo.setJobCron(cronExpression);
|
||||
// }
|
||||
//
|
||||
// // trigger state
|
||||
// TriggerState triggerState = scheduler.getTriggerState(triggerKey);
|
||||
// if (triggerState!=null) {
|
||||
// jobInfo.setJobStatus(triggerState.name());
|
||||
// }
|
||||
//
|
||||
// //JobKey jobKey = new JobKey(jobInfo.getJobName(), String.valueOf(jobInfo.getJobGroup()));
|
||||
// //JobDetail jobDetail = scheduler.getJobDetail(jobKey);
|
||||
// //String jobClass = jobDetail.getJobClass().getName();
|
||||
//
|
||||
// } catch (SchedulerException e) {
|
||||
// logger.error(e.getMessage(), e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * add trigger + job
|
||||
// *
|
||||
// * @param jobName
|
||||
// * @param cronExpression
|
||||
// * @return
|
||||
// * @throws SchedulerException
|
||||
// */
|
||||
// public static boolean addJob(String jobName, String cronExpression) throws SchedulerException {
|
||||
// // 1、job key
|
||||
// TriggerKey triggerKey = TriggerKey.triggerKey(jobName);
|
||||
// JobKey jobKey = new JobKey(jobName);
|
||||
//
|
||||
// // 2、valid
|
||||
// if (scheduler.checkExists(triggerKey)) {
|
||||
// return true; // PASS
|
||||
// }
|
||||
//
|
||||
// // 3、corn trigger
|
||||
// CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(cronExpression).withMisfireHandlingInstructionDoNothing(); // withMisfireHandlingInstructionDoNothing 忽略掉调度终止过程中忽略的调度
|
||||
// CronTrigger cronTrigger = TriggerBuilder.newTrigger().withIdentity(triggerKey).withSchedule(cronScheduleBuilder).build();
|
||||
//
|
||||
// // 4、job detail
|
||||
// Class<? extends Job> jobClass_ = RemoteHttpJobBean.class; // Class.forName(jobInfo.getJobClass());
|
||||
// JobDetail jobDetail = JobBuilder.newJob(jobClass_).withIdentity(jobKey).build();
|
||||
//
|
||||
// /*if (jobInfo.getJobData()!=null) {
|
||||
// JobDataMap jobDataMap = jobDetail.getJobDataMap();
|
||||
// jobDataMap.putAll(JacksonUtil.readValue(jobInfo.getJobData(), Map.class));
|
||||
// // JobExecutionContext context.getMergedJobDataMap().get("mailGuid");
|
||||
// }*/
|
||||
//
|
||||
// // 5、schedule job
|
||||
// Date date = scheduler.scheduleJob(jobDetail, cronTrigger);
|
||||
//
|
||||
// logger.info(">>>>>>>>>>> addJob success(quartz), jobDetail:{}, cronTrigger:{}, date:{}", jobDetail, cronTrigger, date);
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * remove trigger + job
|
||||
// *
|
||||
// * @param jobName
|
||||
// * @return
|
||||
// * @throws SchedulerException
|
||||
// */
|
||||
// public static boolean removeJob(String jobName) throws SchedulerException {
|
||||
//
|
||||
// JobKey jobKey = new JobKey(jobName);
|
||||
// scheduler.deleteJob(jobKey);
|
||||
//
|
||||
// /*TriggerKey triggerKey = TriggerKey.triggerKey(jobName);
|
||||
// if (scheduler.checkExists(triggerKey)) {
|
||||
// scheduler.unscheduleJob(triggerKey); // trigger + job
|
||||
// }*/
|
||||
//
|
||||
// logger.info(">>>>>>>>>>> removeJob success(quartz), jobKey:{}", jobKey);
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * updateJobCron
|
||||
// *
|
||||
// * @param jobName
|
||||
// * @param cronExpression
|
||||
// * @return
|
||||
// * @throws SchedulerException
|
||||
// */
|
||||
// public static boolean updateJobCron(String jobName, String cronExpression) throws SchedulerException {
|
||||
//
|
||||
// // 1、job key
|
||||
// TriggerKey triggerKey = TriggerKey.triggerKey(jobName);
|
||||
//
|
||||
// // 2、valid
|
||||
// if (!scheduler.checkExists(triggerKey)) {
|
||||
// return true; // PASS
|
||||
// }
|
||||
//
|
||||
// CronTrigger oldTrigger = (CronTrigger) scheduler.getTrigger(triggerKey);
|
||||
//
|
||||
// // 3、avoid repeat cron
|
||||
// String oldCron = oldTrigger.getCronExpression();
|
||||
// if (oldCron.equals(cronExpression)){
|
||||
// return true; // PASS
|
||||
// }
|
||||
//
|
||||
// // 4、new cron trigger
|
||||
// CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(cronExpression).withMisfireHandlingInstructionDoNothing();
|
||||
// oldTrigger = oldTrigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(cronScheduleBuilder).build();
|
||||
//
|
||||
// // 5、rescheduleJob
|
||||
// scheduler.rescheduleJob(triggerKey, oldTrigger);
|
||||
//
|
||||
// /*
|
||||
// JobKey jobKey = new JobKey(jobName);
|
||||
//
|
||||
// // old job detail
|
||||
// JobDetail jobDetail = scheduler.getJobDetail(jobKey);
|
||||
//
|
||||
// // new trigger
|
||||
// HashSet<Trigger> triggerSet = new HashSet<Trigger>();
|
||||
// triggerSet.add(cronTrigger);
|
||||
// // cover trigger of job detail
|
||||
// scheduler.scheduleJob(jobDetail, triggerSet, true);*/
|
||||
//
|
||||
// logger.info(">>>>>>>>>>> resumeJob success, JobName:{}", jobName);
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * pause
|
||||
// *
|
||||
// * @param jobName
|
||||
// * @return
|
||||
// * @throws SchedulerException
|
||||
// */
|
||||
// /*public static boolean pauseJob(String jobName) throws SchedulerException {
|
||||
//
|
||||
// TriggerKey triggerKey = TriggerKey.triggerKey(jobName);
|
||||
//
|
||||
// boolean result = false;
|
||||
// if (scheduler.checkExists(triggerKey)) {
|
||||
// scheduler.pauseTrigger(triggerKey);
|
||||
// result = true;
|
||||
// }
|
||||
//
|
||||
// logger.info(">>>>>>>>>>> pauseJob {}, triggerKey:{}", (result?"success":"fail"),triggerKey);
|
||||
// return result;
|
||||
// }*/
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * resume
|
||||
// *
|
||||
// * @param jobName
|
||||
// * @return
|
||||
// * @throws SchedulerException
|
||||
// */
|
||||
// /*public static boolean resumeJob(String jobName) throws SchedulerException {
|
||||
//
|
||||
// TriggerKey triggerKey = TriggerKey.triggerKey(jobName);
|
||||
//
|
||||
// boolean result = false;
|
||||
// if (scheduler.checkExists(triggerKey)) {
|
||||
// scheduler.resumeTrigger(triggerKey);
|
||||
// result = true;
|
||||
// }
|
||||
//
|
||||
// logger.info(">>>>>>>>>>> resumeJob {}, triggerKey:{}", (result?"success":"fail"), triggerKey);
|
||||
// return result;
|
||||
// }*/
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * run
|
||||
// *
|
||||
// * @param jobName
|
||||
// * @return
|
||||
// * @throws SchedulerException
|
||||
// */
|
||||
// /*public static boolean triggerJob(String jobName) throws SchedulerException {
|
||||
// // TriggerKey : name + group
|
||||
// JobKey jobKey = new JobKey(jobName);
|
||||
// TriggerKey triggerKey = TriggerKey.triggerKey(jobName);
|
||||
//
|
||||
// boolean result = false;
|
||||
// if (scheduler.checkExists(triggerKey)) {
|
||||
// scheduler.triggerJob(jobKey);
|
||||
// result = true;
|
||||
// logger.info(">>>>>>>>>>> runJob success, jobKey:{}", jobKey);
|
||||
// } else {
|
||||
// logger.info(">>>>>>>>>>> runJob fail, jobKey:{}", jobKey);
|
||||
// }
|
||||
// return result;
|
||||
// }*/
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * finaAllJobList
|
||||
// *
|
||||
// * @return
|
||||
// *//*
|
||||
// @Deprecated
|
||||
// public static List<Map<String, Object>> finaAllJobList(){
|
||||
// List<Map<String, Object>> jobList = new ArrayList<Map<String,Object>>();
|
||||
//
|
||||
// try {
|
||||
// if (scheduler.getJobGroupNames()==null || scheduler.getJobGroupNames().size()==0) {
|
||||
// return null;
|
||||
// }
|
||||
// String groupName = scheduler.getJobGroupNames().get(0);
|
||||
// Set<JobKey> jobKeys = scheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName));
|
||||
// if (jobKeys!=null && jobKeys.size()>0) {
|
||||
// for (JobKey jobKey : jobKeys) {
|
||||
// TriggerKey triggerKey = TriggerKey.triggerKey(jobKey.getName(), Scheduler.DEFAULT_GROUP);
|
||||
// Trigger trigger = scheduler.getTrigger(triggerKey);
|
||||
// JobDetail jobDetail = scheduler.getJobDetail(jobKey);
|
||||
// TriggerState triggerState = scheduler.getTriggerState(triggerKey);
|
||||
// Map<String, Object> jobMap = new HashMap<String, Object>();
|
||||
// jobMap.put("TriggerKey", triggerKey);
|
||||
// jobMap.put("Trigger", trigger);
|
||||
// jobMap.put("JobDetail", jobDetail);
|
||||
// jobMap.put("TriggerState", triggerState);
|
||||
// jobList.add(jobMap);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// } catch (SchedulerException e) {
|
||||
// logger.error(e.getMessage(), e);
|
||||
// return null;
|
||||
// }
|
||||
// return jobList;
|
||||
// }*/
|
||||
//
|
||||
//}
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
//package com.xxl.job.admin.core.quartz;
|
||||
//
|
||||
//import org.quartz.SchedulerConfigException;
|
||||
//import org.quartz.spi.ThreadPool;
|
||||
//
|
||||
/// **
|
||||
// * single thread pool, for async trigger
|
||||
// *
|
||||
// * @author xuxueli 2019-03-06
|
||||
// */
|
||||
//public class XxlJobThreadPool implements ThreadPool {
|
||||
//
|
||||
// @Override
|
||||
// public boolean runInThread(Runnable runnable) {
|
||||
//
|
||||
// // async run
|
||||
// runnable.run();
|
||||
// return true;
|
||||
//
|
||||
// //return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int blockForAvailableThreads() {
|
||||
// return 1;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void initialize() throws SchedulerConfigException {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void shutdown(boolean waitForJobsToComplete) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getPoolSize() {
|
||||
// return 1;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setInstanceId(String schedInstId) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setInstanceName(String schedName) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// // support
|
||||
// public void setThreadCount(int count) {
|
||||
// //
|
||||
// }
|
||||
//
|
||||
//}
|
||||
Reference in new issue
Block a user