fix(): 代码规范更改
parent
97cfbe27ca
commit
1e65257478
|
@ -21,134 +21,134 @@ public @interface Excel {
|
||||||
/**
|
/**
|
||||||
* 导出时在excel中排序
|
* 导出时在excel中排序
|
||||||
*/
|
*/
|
||||||
public int sort () default Integer.MAX_VALUE;
|
int sort() default Integer.MAX_VALUE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出到Excel中的名字.
|
* 导出到Excel中的名字.
|
||||||
*/
|
*/
|
||||||
public String name () default "";
|
String name() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日期格式, 如: yyyy-MM-dd
|
* 日期格式, 如: yyyy-MM-dd
|
||||||
*/
|
*/
|
||||||
public String dateFormat () default "";
|
String dateFormat() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
|
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
|
||||||
*/
|
*/
|
||||||
public String readConverterExp () default "";
|
String readConverterExp() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分隔符,读取字符串组内容
|
* 分隔符,读取字符串组内容
|
||||||
*/
|
*/
|
||||||
public String separator () default ",";
|
String separator() default ",";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
|
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
|
||||||
*/
|
*/
|
||||||
public int scale () default -1;
|
int scale () default -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
|
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
|
||||||
*/
|
*/
|
||||||
public int roundingMode () default BigDecimal.ROUND_HALF_EVEN;
|
int roundingMode () default BigDecimal.ROUND_HALF_EVEN;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出时在excel中每个列的高度
|
* 导出时在excel中每个列的高度
|
||||||
*/
|
*/
|
||||||
public double height () default 14;
|
double height () default 14;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出时在excel中每个列的宽度
|
* 导出时在excel中每个列的宽度
|
||||||
*/
|
*/
|
||||||
public double width () default 16;
|
double width () default 16;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文字后缀,如% 90 变成90%
|
* 文字后缀,如% 90 变成90%
|
||||||
*/
|
*/
|
||||||
public String suffix () default "";
|
String suffix () default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当值为空时,字段的默认值
|
* 当值为空时,字段的默认值
|
||||||
*/
|
*/
|
||||||
public String defaultValue () default "";
|
String defaultValue () default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提示信息
|
* 提示信息
|
||||||
*/
|
*/
|
||||||
public String prompt () default "";
|
String prompt () default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置只能选择不能输入的列内容.
|
* 设置只能选择不能输入的列内容.
|
||||||
*/
|
*/
|
||||||
public String[] combo () default {};
|
String[] combo () default {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否需要纵向合并单元格,应对需求:含有list集合单元格)
|
* 是否需要纵向合并单元格,应对需求:含有list集合单元格)
|
||||||
*/
|
*/
|
||||||
public boolean needMerge () default false;
|
boolean needMerge () default false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
|
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
|
||||||
*/
|
*/
|
||||||
public boolean isExport () default true;
|
boolean isExport () default true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 另一个类中的属性名称,支持多级获取,以小数点隔开
|
* 另一个类中的属性名称,支持多级获取,以小数点隔开
|
||||||
*/
|
*/
|
||||||
public String targetAttr () default "";
|
String targetAttr () default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否自动统计数据,在最后追加一行统计数据总和
|
* 是否自动统计数据,在最后追加一行统计数据总和
|
||||||
*/
|
*/
|
||||||
public boolean isStatistics () default false;
|
boolean isStatistics () default false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出类型(0数字 1字符串)
|
* 导出类型(0:数字 1:字符串)
|
||||||
*/
|
*/
|
||||||
public ColumnType cellType () default ColumnType.STRING;
|
ColumnType cellType () default ColumnType.STRING;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出列头背景颜色
|
* 导出列头背景颜色
|
||||||
*/
|
*/
|
||||||
public IndexedColors headerBackgroundColor () default IndexedColors.GREY_50_PERCENT;
|
IndexedColors headerBackgroundColor () default IndexedColors.GREY_50_PERCENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出列头字体颜色
|
* 导出列头字体颜色
|
||||||
*/
|
*/
|
||||||
public IndexedColors headerColor () default IndexedColors.WHITE;
|
IndexedColors headerColor () default IndexedColors.WHITE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出单元格背景颜色
|
* 导出单元格背景颜色
|
||||||
*/
|
*/
|
||||||
public IndexedColors backgroundColor () default IndexedColors.WHITE;
|
IndexedColors backgroundColor () default IndexedColors.WHITE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出单元格字体颜色
|
* 导出单元格字体颜色
|
||||||
*/
|
*/
|
||||||
public IndexedColors color () default IndexedColors.BLACK;
|
IndexedColors color () default IndexedColors.BLACK;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出字段对齐方式
|
* 导出字段对齐方式
|
||||||
*/
|
*/
|
||||||
public HorizontalAlignment align () default HorizontalAlignment.CENTER;
|
HorizontalAlignment align () default HorizontalAlignment.CENTER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义数据处理器
|
* 自定义数据处理器
|
||||||
*/
|
*/
|
||||||
public Class<?> handler () default ExcelHandlerAdapter.class;
|
Class<?> handler () default ExcelHandlerAdapter.class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义数据处理器参数
|
* 自定义数据处理器参数
|
||||||
*/
|
*/
|
||||||
public String[] args () default {};
|
String[] args () default {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
|
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
|
||||||
*/
|
*/
|
||||||
Type type () default Type.ALL;
|
Type type () default Type.ALL;
|
||||||
|
|
||||||
public enum Type {
|
enum Type {
|
||||||
ALL(0), EXPORT(1), IMPORT(2);
|
ALL(0), EXPORT(1), IMPORT(2);
|
||||||
private final int value;
|
private final int value;
|
||||||
|
|
||||||
|
@ -156,12 +156,12 @@ public @interface Excel {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int value () {
|
int value () {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ColumnType {
|
enum ColumnType {
|
||||||
NUMERIC(0), STRING(1), IMAGE(2);
|
NUMERIC(0), STRING(1), IMAGE(2);
|
||||||
private final int value;
|
private final int value;
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ public @interface Excel {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int value () {
|
int value () {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,16 @@ public class EscapeUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
// special HTML characters
|
// special HTML characters
|
||||||
TEXT['\''] = "'".toCharArray(); // 单引号
|
// 单引号
|
||||||
TEXT['"'] = """.toCharArray(); // 双引号
|
TEXT['\''] = "'".toCharArray();
|
||||||
TEXT['&'] = "&".toCharArray(); // &符
|
// 双引号
|
||||||
TEXT['<'] = "<".toCharArray(); // 小于号
|
TEXT['"'] = """.toCharArray();
|
||||||
TEXT['>'] = ">".toCharArray(); // 大于号
|
// &符
|
||||||
|
TEXT['&'] = "&".toCharArray();
|
||||||
|
// 小于号
|
||||||
|
TEXT['<'] = "<".toCharArray();
|
||||||
|
// 大于号
|
||||||
|
TEXT['>'] = ">".toCharArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -119,7 +119,8 @@ public final class HTMLFilter {
|
||||||
vSelfClosingTags = new String[]{"img"};
|
vSelfClosingTags = new String[]{"img"};
|
||||||
vNeedClosingTags = new String[]{"a", "b", "strong", "i", "em"};
|
vNeedClosingTags = new String[]{"a", "b", "strong", "i", "em"};
|
||||||
vDisallowed = new String[]{};
|
vDisallowed = new String[]{};
|
||||||
vAllowedProtocols = new String[]{"http", "mailto", "https"}; // no ftp.
|
// no ftp.
|
||||||
|
vAllowedProtocols = new String[]{"http", "mailto", "https"};
|
||||||
vProtocolAtts = new String[]{"src", "href"};
|
vProtocolAtts = new String[]{"src", "href"};
|
||||||
vRemoveBlanks = new String[]{"a", "b", "strong", "i", "em"};
|
vRemoveBlanks = new String[]{"a", "b", "strong", "i", "em"};
|
||||||
vAllowedEntities = new String[]{"amp", "gt", "lt", "quot"};
|
vAllowedEntities = new String[]{"amp", "gt", "lt", "quot"};
|
||||||
|
@ -206,7 +207,7 @@ public final class HTMLFilter {
|
||||||
|
|
||||||
s = escapeComments(s);
|
s = escapeComments(s);
|
||||||
|
|
||||||
s = balanceHTML(s);
|
s = balanceHtml(s);
|
||||||
|
|
||||||
s = checkTags(s);
|
s = checkTags(s);
|
||||||
|
|
||||||
|
@ -227,9 +228,10 @@ public final class HTMLFilter {
|
||||||
|
|
||||||
private String escapeComments (final String s) {
|
private String escapeComments (final String s) {
|
||||||
final Matcher m = P_COMMENTS.matcher(s);
|
final Matcher m = P_COMMENTS.matcher(s);
|
||||||
final StringBuffer buf = new StringBuffer();
|
final StringBuilder buf = new StringBuilder();
|
||||||
if (m.find()) {
|
if (m.find()) {
|
||||||
final String match = m.group(1); // (.*?)
|
// (.*?)
|
||||||
|
final String match = m.group(1);
|
||||||
m.appendReplacement(buf, Matcher.quoteReplacement("<!--" + htmlSpecialChars(match) + "-->"));
|
m.appendReplacement(buf, Matcher.quoteReplacement("<!--" + htmlSpecialChars(match) + "-->"));
|
||||||
}
|
}
|
||||||
m.appendTail(buf);
|
m.appendTail(buf);
|
||||||
|
@ -237,7 +239,7 @@ public final class HTMLFilter {
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String balanceHTML (String s) {
|
private String balanceHtml(String s) {
|
||||||
if (alwaysMakeTags) {
|
if (alwaysMakeTags) {
|
||||||
//
|
//
|
||||||
// try and form html
|
// try and form html
|
||||||
|
@ -466,9 +468,12 @@ public final class HTMLFilter {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
Matcher m = P_VALID_QUOTES.matcher(s);
|
Matcher m = P_VALID_QUOTES.matcher(s);
|
||||||
while (m.find()) {
|
while (m.find()) {
|
||||||
final String one = m.group(1); // (>|^)
|
// (>|^)
|
||||||
final String two = m.group(2); // ([^<]+?)
|
final String one = m.group(1);
|
||||||
final String three = m.group(3); // (<|$)
|
// ([^<]+?)
|
||||||
|
final String two = m.group(2);
|
||||||
|
// (<|$)
|
||||||
|
final String three = m.group(3);
|
||||||
// 不替换双引号为",防止json格式无效 regexReplace(P_QUOTE, """, two)
|
// 不替换双引号为",防止json格式无效 regexReplace(P_QUOTE, """, two)
|
||||||
m.appendReplacement(buf, Matcher.quoteReplacement(one + two + three));
|
m.appendReplacement(buf, Matcher.quoteReplacement(one + two + three));
|
||||||
}
|
}
|
||||||
|
|
|
@ -266,7 +266,7 @@ public class IpUtils {
|
||||||
String[] s1 = ipWildCard.split("\\.");
|
String[] s1 = ipWildCard.split("\\.");
|
||||||
String[] s2 = ip.split("\\.");
|
String[] s2 = ip.split("\\.");
|
||||||
boolean isMatchedSeg = true;
|
boolean isMatchedSeg = true;
|
||||||
for (int i = 0 ; i < s1.length && !s1[i].equals("*") ; i++) {
|
for (int i = 0; i < s1.length && !"*".equals(s1[i]) ; i++) {
|
||||||
if (!s1[i].equals(s2[i])) {
|
if (!s1[i].equals(s2[i])) {
|
||||||
isMatchedSeg = false;
|
isMatchedSeg = false;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -869,7 +869,8 @@ public class ExcelUtil<T> {
|
||||||
*/
|
*/
|
||||||
public void setXSSFValidationWithHidden (Sheet sheet, String[] textlist, String promptContent, int firstRow, int endRow, int firstCol, int endCol) {
|
public void setXSSFValidationWithHidden (Sheet sheet, String[] textlist, String promptContent, int firstRow, int endRow, int firstCol, int endCol) {
|
||||||
String hideSheetName = "combo_" + firstCol + "_" + endCol;
|
String hideSheetName = "combo_" + firstCol + "_" + endCol;
|
||||||
Sheet hideSheet = wb.createSheet(hideSheetName); // 用于存储 下拉菜单数据
|
// 用于存储 下拉菜单数据
|
||||||
|
Sheet hideSheet = wb.createSheet(hideSheetName);
|
||||||
for (int i = 0 ; i < textlist.length ; i++) {
|
for (int i = 0 ; i < textlist.length ; i++) {
|
||||||
hideSheet.createRow(i).createCell(0).setCellValue(textlist[i]);
|
hideSheet.createRow(i).createCell(0).setCellValue(textlist[i]);
|
||||||
}
|
}
|
||||||
|
@ -1112,7 +1113,8 @@ public class ExcelUtil<T> {
|
||||||
if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA) {
|
if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA) {
|
||||||
val = cell.getNumericCellValue();
|
val = cell.getNumericCellValue();
|
||||||
if (DateUtil.isCellDateFormatted(cell)) {
|
if (DateUtil.isCellDateFormatted(cell)) {
|
||||||
val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换
|
// POI Excel 日期格式转换
|
||||||
|
val = DateUtil.getJavaDate((Double) val);
|
||||||
} else {
|
} else {
|
||||||
if ((Double) val % 1 != 0) {
|
if ((Double) val % 1 != 0) {
|
||||||
val = new BigDecimal(val.toString());
|
val = new BigDecimal(val.toString());
|
||||||
|
|
|
@ -82,9 +82,7 @@ public final class Base64 {
|
||||||
int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
|
int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
|
||||||
int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP;
|
int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP;
|
||||||
int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets;
|
int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets;
|
||||||
char encodedData[] = null;
|
char[] encodedData = new char[numberQuartet * 4];
|
||||||
|
|
||||||
encodedData = new char[numberQuartet * 4];
|
|
||||||
|
|
||||||
byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0;
|
byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0;
|
||||||
|
|
||||||
|
@ -152,7 +150,8 @@ public final class Base64 {
|
||||||
int len = removeWhiteSpace(base64Data);
|
int len = removeWhiteSpace(base64Data);
|
||||||
|
|
||||||
if (len % FOURBYTE != 0) {
|
if (len % FOURBYTE != 0) {
|
||||||
return null;// should be divisible by four
|
// should be divisible by four
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
int numberQuadruple = (len / FOURBYTE);
|
int numberQuadruple = (len / FOURBYTE);
|
||||||
|
@ -161,7 +160,7 @@ public final class Base64 {
|
||||||
return new byte[0];
|
return new byte[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
byte decodedData[] = null;
|
byte[] decodedData = null;
|
||||||
byte b1 = 0, b2 = 0, b3 = 0, b4 = 0;
|
byte b1 = 0, b2 = 0, b3 = 0, b4 = 0;
|
||||||
char d1 = 0, d2 = 0, d3 = 0, d4 = 0;
|
char d1 = 0, d2 = 0, d3 = 0, d4 = 0;
|
||||||
|
|
||||||
|
@ -188,7 +187,8 @@ public final class Base64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) {
|
if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) {
|
||||||
return null;// if found "no data" just return null
|
// 如果发现 “没有数据” 只是返回null
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
b1 = base64Alphabet[d1];
|
b1 = base64Alphabet[d1];
|
||||||
|
@ -196,9 +196,11 @@ public final class Base64 {
|
||||||
|
|
||||||
d3 = base64Data[dataIndex++];
|
d3 = base64Data[dataIndex++];
|
||||||
d4 = base64Data[dataIndex++];
|
d4 = base64Data[dataIndex++];
|
||||||
if (!isData((d3)) || !isData((d4))) {// Check if they are PAD characters
|
// 检查它们是否是填充字符
|
||||||
|
if (!isData((d3)) || !isData((d4))) {
|
||||||
if (isPad(d3) && isPad(d4)) {
|
if (isPad(d3) && isPad(d4)) {
|
||||||
if ((b2 & 0xf) != 0)// last 4 bits should be zero
|
// 最后4位应为零
|
||||||
|
if ((b2 & 0xf) != 0)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -208,7 +210,8 @@ public final class Base64 {
|
||||||
return tmp;
|
return tmp;
|
||||||
} else if (!isPad(d3) && isPad(d4)) {
|
} else if (!isPad(d3) && isPad(d4)) {
|
||||||
b3 = base64Alphabet[d3];
|
b3 = base64Alphabet[d3];
|
||||||
if ((b3 & 0x3) != 0)// last 2 bits should be zero
|
// 最后2位应为零
|
||||||
|
if ((b3 & 0x3) != 0)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -220,7 +223,8 @@ public final class Base64 {
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else { // No PAD e.g 3cQl
|
} else {
|
||||||
|
// 无衬垫 e.g 3cQl
|
||||||
b3 = base64Alphabet[d3];
|
b3 = base64Alphabet[d3];
|
||||||
b4 = base64Alphabet[d4];
|
b4 = base64Alphabet[d4];
|
||||||
decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
|
decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
|
||||||
|
@ -232,18 +236,18 @@ public final class Base64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* remove WhiteSpace from MIME containing encoded Base64 data.
|
* 从包含编码的Base64数据的MIME中删除空白。
|
||||||
*
|
*
|
||||||
* @param data the byte array of base64 data (with WS)
|
* @param data base64数据的字节数组 (带WS)
|
||||||
*
|
*
|
||||||
* @return the new length
|
* @return 新的长度
|
||||||
*/
|
*/
|
||||||
private static int removeWhiteSpace (char[] data) {
|
private static int removeWhiteSpace (char[] data) {
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// count characters that's not whitespace
|
// 计数不是空格的字符
|
||||||
int newSize = 0;
|
int newSize = 0;
|
||||||
int len = data.length;
|
int len = data.length;
|
||||||
for (int i = 0 ; i < len ; i++) {
|
for (int i = 0 ; i < len ; i++) {
|
||||||
|
|
|
@ -84,10 +84,14 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
|
||||||
|
|
||||||
byte[] randomBytes = new byte[16];
|
byte[] randomBytes = new byte[16];
|
||||||
ng.nextBytes(randomBytes);
|
ng.nextBytes(randomBytes);
|
||||||
randomBytes[6] &= 0x0f; /* clear version */
|
/* clear version */
|
||||||
randomBytes[6] |= 0x40; /* set to version 4 */
|
randomBytes[6] &= 0x0f;
|
||||||
randomBytes[8] &= 0x3f; /* clear variant */
|
/* set to version 4 */
|
||||||
randomBytes[8] |= 0x80; /* set to IETF variant */
|
randomBytes[6] |= 0x40;
|
||||||
|
/* clear variant */
|
||||||
|
randomBytes[8] &= 0x3f;
|
||||||
|
/* set to IETF variant */
|
||||||
|
randomBytes[8] |= (byte) 0x80;
|
||||||
return new UUID(randomBytes);
|
return new UUID(randomBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +102,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
|
||||||
*
|
*
|
||||||
* @return 根据指定数组生成的 {@code UUID}
|
* @return 根据指定数组生成的 {@code UUID}
|
||||||
*/
|
*/
|
||||||
public static UUID nameUUIDFromBytes (byte[] name) {
|
public static UUID nameUuidFromBytes (byte[] name) {
|
||||||
MessageDigest md;
|
MessageDigest md;
|
||||||
try {
|
try {
|
||||||
md = MessageDigest.getInstance("MD5");
|
md = MessageDigest.getInstance("MD5");
|
||||||
|
@ -106,10 +110,14 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
|
||||||
throw new InternalError("MD5 not supported");
|
throw new InternalError("MD5 not supported");
|
||||||
}
|
}
|
||||||
byte[] md5Bytes = md.digest(name);
|
byte[] md5Bytes = md.digest(name);
|
||||||
md5Bytes[6] &= 0x0f; /* clear version */
|
/* clear version */
|
||||||
md5Bytes[6] |= 0x30; /* set to version 3 */
|
md5Bytes[6] &= 0x0f;
|
||||||
md5Bytes[8] &= 0x3f; /* clear variant */
|
/* set to version 3 */
|
||||||
md5Bytes[8] |= 0x80; /* set to IETF variant */
|
md5Bytes[6] |= 0x30;
|
||||||
|
/* clear variant */
|
||||||
|
md5Bytes[8] &= 0x3f;
|
||||||
|
/* set to IETF variant */
|
||||||
|
md5Bytes[8] |= 0x80;
|
||||||
return new UUID(md5Bytes);
|
return new UUID(md5Bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,8 +261,8 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
|
||||||
*/
|
*/
|
||||||
public long timestamp () throws UnsupportedOperationException {
|
public long timestamp () throws UnsupportedOperationException {
|
||||||
checkTimeBase();
|
checkTimeBase();
|
||||||
return (mostSigBits & 0x0FFFL) << 48//
|
return (mostSigBits & 0x0FFFL) << 48
|
||||||
| ((mostSigBits >> 16) & 0x0FFFFL) << 32//
|
| ((mostSigBits >> 16) & 0x0FFFFL) << 32
|
||||||
| mostSigBits >>> 32;
|
| mostSigBits >>> 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,11 +433,9 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
|
||||||
public int compareTo (UUID val) {
|
public int compareTo (UUID val) {
|
||||||
// The ordering is intentionally set up so that the UUIDs
|
// The ordering is intentionally set up so that the UUIDs
|
||||||
// can simply be numerically compared as two numbers
|
// can simply be numerically compared as two numbers
|
||||||
return (this.mostSigBits < val.mostSigBits ? -1 : //
|
return (this.mostSigBits < val.mostSigBits ? -1 :
|
||||||
(this.mostSigBits > val.mostSigBits ? 1 : //
|
(this.mostSigBits > val.mostSigBits ? 1 :
|
||||||
(this.leastSigBits < val.leastSigBits ? -1 : //
|
(Long.compare(this.leastSigBits, val.leastSigBits))));
|
||||||
(this.leastSigBits > val.leastSigBits ? 1 : //
|
|
||||||
0))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -95,8 +95,9 @@ public class AccessLogFilter implements GlobalFilter, Ordered {
|
||||||
private Mono<Void> filterWithoutRequestBody(ServerWebExchange exchange, GatewayFilterChain chain, AccessLog accessLog) {
|
private Mono<Void> filterWithoutRequestBody(ServerWebExchange exchange, GatewayFilterChain chain, AccessLog accessLog) {
|
||||||
// 包装 Response,用于记录 Response Body
|
// 包装 Response,用于记录 Response Body
|
||||||
ServerHttpResponseDecorator decoratedResponse = recordResponseLog(exchange, accessLog);
|
ServerHttpResponseDecorator decoratedResponse = recordResponseLog(exchange, accessLog);
|
||||||
|
// 打印日志
|
||||||
return chain.filter(exchange.mutate().response(decoratedResponse).build())
|
return chain.filter(exchange.mutate().response(decoratedResponse).build())
|
||||||
.then(Mono.fromRunnable(() -> writeAccessLog(accessLog))); // 打印日志
|
.then(Mono.fromRunnable(() -> writeAccessLog(accessLog)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -119,7 +120,8 @@ public class AccessLogFilter implements GlobalFilter, Ordered {
|
||||||
headers.putAll(exchange.getRequest().getHeaders());
|
headers.putAll(exchange.getRequest().getHeaders());
|
||||||
// the new content type will be computed by bodyInserter
|
// the new content type will be computed by bodyInserter
|
||||||
// and then set in the request decorator
|
// and then set in the request decorator
|
||||||
headers.remove(HttpHeaders.CONTENT_LENGTH); // 移除
|
// 移除
|
||||||
|
headers.remove(HttpHeaders.CONTENT_LENGTH);
|
||||||
CachedBodyOutputMessage outputMessage = new CachedBodyOutputMessage(exchange, headers);
|
CachedBodyOutputMessage outputMessage = new CachedBodyOutputMessage(exchange, headers);
|
||||||
// 通过 BodyInserter 将 Request Body 写入到 CachedBodyOutputMessage 中
|
// 通过 BodyInserter 将 Request Body 写入到 CachedBodyOutputMessage 中
|
||||||
return bodyInserter.insert(outputMessage, new BodyInserterContext()).then(Mono.defer(() -> {
|
return bodyInserter.insert(outputMessage, new BodyInserterContext()).then(Mono.defer(() -> {
|
||||||
|
|
|
@ -54,9 +54,12 @@ public class JobGroupController {
|
||||||
|
|
||||||
// package result
|
// package result
|
||||||
Map<String, Object> maps = new HashMap<String, Object>();
|
Map<String, Object> maps = new HashMap<String, Object>();
|
||||||
maps.put("recordsTotal", list_count); // 总记录数
|
// 总记录数
|
||||||
maps.put("recordsFiltered", list_count); // 过滤后的总记录数
|
maps.put("recordsTotal", list_count);
|
||||||
maps.put("data", list); // 分页列表
|
// 过滤后的总记录数
|
||||||
|
maps.put("recordsFiltered", list_count);
|
||||||
|
// 分页列表
|
||||||
|
maps.put("data", list);
|
||||||
return maps;
|
return maps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,9 @@ public class JobAlarmer implements ApplicationContextAware, InitializingBean {
|
||||||
public boolean alarm(XxlJobInfo info, XxlJobLog jobLog) {
|
public boolean alarm(XxlJobInfo info, XxlJobLog jobLog) {
|
||||||
|
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
if (jobAlarmList!=null && jobAlarmList.size()>0) {
|
if (jobAlarmList!=null && !jobAlarmList.isEmpty()) {
|
||||||
result = true; // success means all-success
|
// success means all-success
|
||||||
|
result = true;
|
||||||
for (JobAlarm alarm: jobAlarmList) {
|
for (JobAlarm alarm: jobAlarmList) {
|
||||||
boolean resultItem = false;
|
boolean resultItem = false;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -210,8 +210,10 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
protected static final int MONTH = 4;
|
protected static final int MONTH = 4;
|
||||||
protected static final int DAY_OF_WEEK = 5;
|
protected static final int DAY_OF_WEEK = 5;
|
||||||
protected static final int YEAR = 6;
|
protected static final int YEAR = 6;
|
||||||
protected static final int ALL_SPEC_INT = 99; // '*'
|
// '*'
|
||||||
protected static final int NO_SPEC_INT = 98; // '?'
|
protected static final int ALL_SPEC_INT = 99;
|
||||||
|
// '?'
|
||||||
|
protected static final int NO_SPEC_INT = 98;
|
||||||
protected static final Integer ALL_SPEC = ALL_SPEC_INT;
|
protected static final Integer ALL_SPEC = ALL_SPEC_INT;
|
||||||
protected static final Integer NO_SPEC = NO_SPEC_INT;
|
protected static final Integer NO_SPEC = NO_SPEC_INT;
|
||||||
|
|
||||||
|
@ -437,7 +439,7 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
protected void buildExpression(String expression) throws ParseException {
|
private void buildExpression(String expression) throws ParseException {
|
||||||
expressionParsed = true;
|
expressionParsed = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -487,7 +489,7 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
StringTokenizer vTok = new StringTokenizer(expr, ",");
|
StringTokenizer vTok = new StringTokenizer(expr, ",");
|
||||||
while (vTok.hasMoreTokens()) {
|
while (vTok.hasMoreTokens()) {
|
||||||
String v = vTok.nextToken();
|
String v = vTok.nextToken();
|
||||||
storeExpressionVals(0, v, exprOn);
|
storeExpressionVals(v, exprOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
exprOn++;
|
exprOn++;
|
||||||
|
@ -499,7 +501,7 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exprOn <= YEAR) {
|
if (exprOn <= YEAR) {
|
||||||
storeExpressionVals(0, "*", YEAR);
|
storeExpressionVals("*", YEAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeSet<Integer> dow = getSet(DAY_OF_WEEK);
|
TreeSet<Integer> dow = getSet(DAY_OF_WEEK);
|
||||||
|
@ -523,16 +525,16 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int storeExpressionVals(int pos, String s, int type)
|
private void storeExpressionVals(String s, int type)
|
||||||
throws ParseException {
|
throws ParseException {
|
||||||
|
|
||||||
int incr = 0;
|
int incr = 0;
|
||||||
int i = skipWhiteSpace(pos, s);
|
int i = skipWhiteSpace(0, s);
|
||||||
if (i >= s.length()) {
|
if (i >= s.length()) {
|
||||||
return i;
|
return;
|
||||||
}
|
}
|
||||||
char c = s.charAt(i);
|
char c = s.charAt(i);
|
||||||
if ((c >= 'A') && (c <= 'Z') && (!s.equals("L")) && (!s.equals("LW")) && (!s.matches("^L-[0-9]*[W]?"))) {
|
if ((c >= 'A') && (c <= 'Z') && (!"L".equals(s)) && (!"LW".equals(s)) && (!s.matches("^L-[0-9]*W?"))) {
|
||||||
String sub = s.substring(i, i + 3);
|
String sub = s.substring(i, i + 3);
|
||||||
int sval = -1;
|
int sval = -1;
|
||||||
int eval = -1;
|
int eval = -1;
|
||||||
|
@ -596,7 +598,7 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
incr = 1;
|
incr = 1;
|
||||||
}
|
}
|
||||||
addToSet(sval, eval, incr, type);
|
addToSet(sval, eval, incr, type);
|
||||||
return (i + 3);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == '?') {
|
if (c == '?') {
|
||||||
|
@ -621,13 +623,13 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
addToSet(NO_SPEC_INT, -1, 0, type);
|
addToSet(NO_SPEC_INT, -1, 0, type);
|
||||||
return i;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == '*' || c == '/') {
|
if (c == '*' || c == '/') {
|
||||||
if (c == '*' && (i + 1) >= s.length()) {
|
if (c == '*' && (i + 1) >= s.length()) {
|
||||||
addToSet(ALL_SPEC_INT, -1, incr, type);
|
addToSet(ALL_SPEC_INT, -1, incr, type);
|
||||||
return i + 1;
|
return;
|
||||||
} else if (c == '/'
|
} else if (c == '/'
|
||||||
&& ((i + 1) >= s.length() || s.charAt(i + 1) == ' ' || s
|
&& ((i + 1) >= s.length() || s.charAt(i + 1) == ' ' || s
|
||||||
.charAt(i + 1) == '\t')) {
|
.charAt(i + 1) == '\t')) {
|
||||||
|
@ -636,7 +638,8 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
c = s.charAt(i);
|
c = s.charAt(i);
|
||||||
if (c == '/') { // is an increment specified?
|
// 是否指定了增量?
|
||||||
|
if (c == '/') {
|
||||||
i++;
|
i++;
|
||||||
if (i >= s.length()) {
|
if (i >= s.length()) {
|
||||||
throw new ParseException("Unexpected end of string.", i);
|
throw new ParseException("Unexpected end of string.", i);
|
||||||
|
@ -654,7 +657,6 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
addToSet(ALL_SPEC_INT, -1, incr, type);
|
addToSet(ALL_SPEC_INT, -1, incr, type);
|
||||||
return i;
|
|
||||||
} else if (c == 'L') {
|
} else if (c == 'L') {
|
||||||
i++;
|
i++;
|
||||||
if (type == DAY_OF_MONTH) {
|
if (type == DAY_OF_MONTH) {
|
||||||
|
@ -669,7 +671,7 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
ValueSet vs = getValue(0, s, i+1);
|
ValueSet vs = getValue(0, s, i+1);
|
||||||
lastdayOffset = vs.value;
|
lastdayOffset = vs.value;
|
||||||
if(lastdayOffset > 30) {
|
if(lastdayOffset > 30) {
|
||||||
throw new ParseException("Offset from last day must be <= 30", i + 1);
|
throw new ParseException("与最后一天的偏移量必须 <= 30", i + 1);
|
||||||
}
|
}
|
||||||
i = vs.pos;
|
i = vs.pos;
|
||||||
}
|
}
|
||||||
|
@ -681,7 +683,6 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return i;
|
|
||||||
} else if (c >= '0' && c <= '9') {
|
} else if (c >= '0' && c <= '9') {
|
||||||
int val = Integer.parseInt(String.valueOf(c));
|
int val = Integer.parseInt(String.valueOf(c));
|
||||||
i++;
|
i++;
|
||||||
|
@ -695,13 +696,11 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
i = vs.pos;
|
i = vs.pos;
|
||||||
}
|
}
|
||||||
i = checkNext(i, s, val, type);
|
i = checkNext(i, s, val, type);
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new ParseException("Unexpected character: " + c, i);
|
throw new ParseException("Unexpected character: " + c, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkIncrementRange(int incr, int type, int idxPos) throws ParseException {
|
private void checkIncrementRange(int incr, int type, int idxPos) throws ParseException {
|
||||||
|
@ -1017,14 +1016,15 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
|
|
||||||
if (val == ALL_SPEC_INT && incr <= 0) {
|
if (val == ALL_SPEC_INT && incr <= 0) {
|
||||||
incr = 1;
|
incr = 1;
|
||||||
set.add(ALL_SPEC); // put in a marker, but also fill values
|
// put in a marker, but also fill values
|
||||||
|
set.add(ALL_SPEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == SECOND || type == MINUTE) {
|
if (type == SECOND || type == MINUTE) {
|
||||||
if (stopAt == -1) {
|
if (stopAt == -1) {
|
||||||
stopAt = 59;
|
stopAt = 59;
|
||||||
}
|
}
|
||||||
if (startAt == -1 || startAt == ALL_SPEC_INT) {
|
if (startAt == ALL_SPEC_INT) {
|
||||||
startAt = 0;
|
startAt = 0;
|
||||||
}
|
}
|
||||||
} else if (type == HOUR) {
|
} else if (type == HOUR) {
|
||||||
|
@ -1188,7 +1188,8 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
while (!gotOne) {
|
while (!gotOne) {
|
||||||
|
|
||||||
//if (endTime != null && cl.getTime().after(endTime)) return null;
|
//if (endTime != null && cl.getTime().after(endTime)) return null;
|
||||||
if(cl.get(Calendar.YEAR) > 2999) { // prevent endless loop...
|
// prevent endless loop...
|
||||||
|
if(cl.get(Calendar.YEAR) > 2999) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1262,7 +1263,8 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
// get day...................................................
|
// get day...................................................
|
||||||
boolean dayOfMSpec = !daysOfMonth.contains(NO_SPEC);
|
boolean dayOfMSpec = !daysOfMonth.contains(NO_SPEC);
|
||||||
boolean dayOfWSpec = !daysOfWeek.contains(NO_SPEC);
|
boolean dayOfWSpec = !daysOfWeek.contains(NO_SPEC);
|
||||||
if (dayOfMSpec && !dayOfWSpec) { // get day by day of month rule
|
// get day by day of month rule
|
||||||
|
if (dayOfMSpec && !dayOfWSpec) {
|
||||||
st = daysOfMonth.tailSet(day);
|
st = daysOfMonth.tailSet(day);
|
||||||
if (lastdayOfMonth) {
|
if (lastdayOfMonth) {
|
||||||
if(!nearestWeekday) {
|
if(!nearestWeekday) {
|
||||||
|
@ -1273,7 +1275,8 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
mon++;
|
mon++;
|
||||||
if(mon > 12) {
|
if(mon > 12) {
|
||||||
mon = 1;
|
mon = 1;
|
||||||
tmon = 3333; // ensure test of mon != tmon further below fails
|
// 确保mon的测试!= 下面进一步的tmon失败
|
||||||
|
tmon = 3333;
|
||||||
cl.add(Calendar.YEAR, 1);
|
cl.add(Calendar.YEAR, 1);
|
||||||
}
|
}
|
||||||
day = 1;
|
day = 1;
|
||||||
|
@ -1375,12 +1378,14 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
// are 1-based
|
// are 1-based
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if (dayOfWSpec && !dayOfMSpec) { // get day by day of week rule
|
// get day by day of week rule
|
||||||
if (lastdayOfWeek) { // are we looking for the last XXX day of
|
} else if (dayOfWSpec && !dayOfMSpec) {
|
||||||
// the month?
|
// are we looking for the last XXX day of
|
||||||
int dow = daysOfWeek.first(); // desired
|
if (lastdayOfWeek) {
|
||||||
// d-o-w
|
// the month? // desired
|
||||||
int cDow = cl.get(Calendar.DAY_OF_WEEK); // current d-o-w
|
int dow = daysOfWeek.first();
|
||||||
|
// d-o-w // current d-o-w
|
||||||
|
int cDow = cl.get(Calendar.DAY_OF_WEEK);
|
||||||
int daysToAdd = 0;
|
int daysToAdd = 0;
|
||||||
if (cDow < dow) {
|
if (cDow < dow) {
|
||||||
daysToAdd = dow - cDow;
|
daysToAdd = dow - cDow;
|
||||||
|
@ -1390,8 +1395,8 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
int lDay = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
|
int lDay = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
|
||||||
|
// did we already miss the
|
||||||
if (day + daysToAdd > lDay) { // did we already miss the
|
if (day + daysToAdd > lDay) {
|
||||||
// last one?
|
// last one?
|
||||||
cl.set(Calendar.SECOND, 0);
|
cl.set(Calendar.SECOND, 0);
|
||||||
cl.set(Calendar.MINUTE, 0);
|
cl.set(Calendar.MINUTE, 0);
|
||||||
|
@ -1422,8 +1427,8 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
} else if (nthdayOfWeek != 0) {
|
} else if (nthdayOfWeek != 0) {
|
||||||
// are we looking for the Nth XXX day in the month?
|
// are we looking for the Nth XXX day in the month?
|
||||||
int dow = daysOfWeek.first(); // desired
|
int dow = daysOfWeek.first(); // desired
|
||||||
// d-o-w
|
// d-o-w // current d-o-w
|
||||||
int cDow = cl.get(Calendar.DAY_OF_WEEK); // current d-o-w
|
int cDow = cl.get(Calendar.DAY_OF_WEEK);
|
||||||
int daysToAdd = 0;
|
int daysToAdd = 0;
|
||||||
if (cDow < dow) {
|
if (cDow < dow) {
|
||||||
daysToAdd = dow - cDow;
|
daysToAdd = dow - cDow;
|
||||||
|
@ -1464,8 +1469,10 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int cDow = cl.get(Calendar.DAY_OF_WEEK); // current d-o-w
|
// current d-o-w
|
||||||
int dow = daysOfWeek.first(); // desired
|
int cDow = cl.get(Calendar.DAY_OF_WEEK);
|
||||||
|
// desired
|
||||||
|
int dow = daysOfWeek.first();
|
||||||
// d-o-w
|
// d-o-w
|
||||||
st = daysOfWeek.tailSet(cDow);
|
st = daysOfWeek.tailSet(cDow);
|
||||||
if (st != null && st.size() > 0) {
|
if (st != null && st.size() > 0) {
|
||||||
|
@ -1481,8 +1488,8 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
int lDay = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
|
int lDay = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
|
||||||
|
// will we pass the end of
|
||||||
if (day + daysToAdd > lDay) { // will we pass the end of
|
if (day + daysToAdd > lDay) {
|
||||||
// the month?
|
// the month?
|
||||||
cl.set(Calendar.SECOND, 0);
|
cl.set(Calendar.SECOND, 0);
|
||||||
cl.set(Calendar.MINUTE, 0);
|
cl.set(Calendar.MINUTE, 0);
|
||||||
|
@ -1491,7 +1498,8 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
cl.set(Calendar.MONTH, mon);
|
cl.set(Calendar.MONTH, mon);
|
||||||
// no '- 1' here because we are promoting the month
|
// no '- 1' here because we are promoting the month
|
||||||
continue;
|
continue;
|
||||||
} else if (daysToAdd > 0) { // are we swithing days?
|
// are we swithing days?
|
||||||
|
} else if (daysToAdd > 0) {
|
||||||
cl.set(Calendar.SECOND, 0);
|
cl.set(Calendar.SECOND, 0);
|
||||||
cl.set(Calendar.MINUTE, 0);
|
cl.set(Calendar.MINUTE, 0);
|
||||||
cl.set(Calendar.HOUR_OF_DAY, 0);
|
cl.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
@ -1553,7 +1561,8 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
t = year;
|
t = year;
|
||||||
year = st.first();
|
year = st.first();
|
||||||
} else {
|
} else {
|
||||||
return null; // ran out of years...
|
// ran out of years...
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (year != t) {
|
if (year != t) {
|
||||||
|
|
|
@ -29,10 +29,12 @@ public class ExecutorRouteLFU extends ExecutorRouter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// lfu item init
|
// lfu item init
|
||||||
HashMap<String, Integer> lfuItemMap = jobLfuMap.get(jobId); // Key排序可以用TreeMap+构造入参Compare;Value排序暂时只能通过ArrayList;
|
// Key排序可以用TreeMap+构造入参Compare;Value排序暂时只能通过ArrayList;
|
||||||
|
HashMap<String, Integer> lfuItemMap = jobLfuMap.get(jobId);
|
||||||
if (lfuItemMap == null) {
|
if (lfuItemMap == null) {
|
||||||
lfuItemMap = new HashMap<String, Integer>();
|
lfuItemMap = new HashMap<>();
|
||||||
jobLfuMap.putIfAbsent(jobId, lfuItemMap); // 避免重复覆盖
|
// 避免重复覆盖
|
||||||
|
jobLfuMap.putIfAbsent(jobId, lfuItemMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
// put new
|
// put new
|
||||||
|
|
|
@ -158,7 +158,8 @@ public class JobCompleteHelper {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, "log item not found.");
|
return new ReturnT<String>(ReturnT.FAIL_CODE, "log item not found.");
|
||||||
}
|
}
|
||||||
if (log.getHandleCode() > 0) {
|
if (log.getHandleCode() > 0) {
|
||||||
return new ReturnT<String>(ReturnT.FAIL_CODE, "log repeate callback."); // avoid repeat callback, trigger child job etc
|
// avoid repeat callback, trigger child job etc
|
||||||
|
return new ReturnT<String>(ReturnT.FAIL_CODE, "log repeate callback.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle msg
|
// handle msg
|
||||||
|
|
|
@ -14,8 +14,8 @@ import org.slf4j.LoggerFactory;
|
||||||
*/
|
*/
|
||||||
public class FtlUtil {
|
public class FtlUtil {
|
||||||
private static Logger logger = LoggerFactory.getLogger(FtlUtil.class);
|
private static Logger logger = LoggerFactory.getLogger(FtlUtil.class);
|
||||||
|
//BeansWrapper.getDefaultInstance();
|
||||||
private static BeansWrapper wrapper = new BeansWrapperBuilder(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS).build(); //BeansWrapper.getDefaultInstance();
|
private static BeansWrapper wrapper = new BeansWrapperBuilder(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS).build();
|
||||||
|
|
||||||
public static TemplateHashModel generateStaticModel(String packageName) {
|
public static TemplateHashModel generateStaticModel(String packageName) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -9,8 +9,8 @@ import java.util.concurrent.ConcurrentMap;
|
||||||
* @author xuxueli 2018-01-22 21:37:34
|
* @author xuxueli 2018-01-22 21:37:34
|
||||||
*/
|
*/
|
||||||
public class LocalCacheUtil {
|
public class LocalCacheUtil {
|
||||||
|
// 类型建议用抽象父类,兼容性更好;
|
||||||
private static ConcurrentMap<String, LocalCacheData> cacheRepository = new ConcurrentHashMap<String, LocalCacheData>(); // 类型建议用抽象父类,兼容性更好;
|
private static final ConcurrentMap<String, LocalCacheData> cacheRepository = new ConcurrentHashMap<String, LocalCacheData>();
|
||||||
private static class LocalCacheData{
|
private static class LocalCacheData{
|
||||||
private String key;
|
private String key;
|
||||||
private Object val;
|
private Object val;
|
||||||
|
|
|
@ -36,7 +36,8 @@ public class LoginService {
|
||||||
private XxlJobUser parseToken(String tokenHex){
|
private XxlJobUser parseToken(String tokenHex){
|
||||||
XxlJobUser xxlJobUser = null;
|
XxlJobUser xxlJobUser = null;
|
||||||
if (tokenHex != null) {
|
if (tokenHex != null) {
|
||||||
String tokenJson = new String(new BigInteger(tokenHex, 16).toByteArray()); // username_password(md5)
|
// username_password(md5)
|
||||||
|
String tokenJson = new String(new BigInteger(tokenHex, 16).toByteArray());
|
||||||
xxlJobUser = JacksonUtil.readValue(tokenJson, XxlJobUser.class);
|
xxlJobUser = JacksonUtil.readValue(tokenJson, XxlJobUser.class);
|
||||||
}
|
}
|
||||||
return xxlJobUser;
|
return xxlJobUser;
|
||||||
|
|
|
@ -102,7 +102,8 @@ public class EmbedServer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
thread.setDaemon(true); // daemon, service jvm, user thread leave >>> daemon leave >>> jvm leave
|
// 守护进程,服务jvm,用户线程离开 >>> 守护进程离开 >>> jvm离开
|
||||||
|
thread.setDaemon(true);
|
||||||
thread.start();
|
thread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue