mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix code
This commit is contained in:
parent
19eba6086f
commit
282e1e9090
@ -108,11 +108,7 @@ public enum Month {
|
|||||||
* @return 此月份最后一天的值
|
* @return 此月份最后一天的值
|
||||||
*/
|
*/
|
||||||
public int getLastDay(boolean isLeapYear) {
|
public int getLastDay(boolean isLeapYear) {
|
||||||
int lastDay = DAYS_OF_MONTH[value];
|
return getLastDay(this.value, isLeapYear);
|
||||||
if (isLeapYear && Calendar.FEBRUARY == value){
|
|
||||||
lastDay += 1;
|
|
||||||
}
|
|
||||||
return lastDay;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -166,4 +162,20 @@ public enum Month {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得指定月的最后一天
|
||||||
|
* @param month 月份
|
||||||
|
* @param isLeapYear 是否为闰年,闰年只对二月有影响
|
||||||
|
* @return 最后一天,可能为28,29,30,31
|
||||||
|
* @since 5.4.7
|
||||||
|
*/
|
||||||
|
public static int getLastDay(int month, boolean isLeapYear){
|
||||||
|
int lastDay = DAYS_OF_MONTH[month];
|
||||||
|
if (isLeapYear && Calendar.FEBRUARY == month){
|
||||||
|
// 二月
|
||||||
|
lastDay += 1;
|
||||||
|
}
|
||||||
|
return lastDay;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import java.io.Serializable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时任务计时器<br>
|
* 定时任务计时器<br>
|
||||||
* 计时器线程每隔一分钟检查一次任务列表,一旦匹配到执行对应的Task
|
* 计时器线程每隔一分钟(一秒钟)检查一次任务列表,一旦匹配到执行对应的Task
|
||||||
* @author Looly
|
* @author Looly
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -57,7 +57,7 @@ public class CronTimer extends Thread implements Serializable {
|
|||||||
spawnLauncher(thisTime);
|
spawnLauncher(thisTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.debug("Hutool-cron timer stoped.");
|
log.debug("Hutool-cron timer stopped.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -111,8 +111,6 @@ public class CronPattern {
|
|||||||
/**
|
/**
|
||||||
* 构造
|
* 构造
|
||||||
*
|
*
|
||||||
* @see CronPattern
|
|
||||||
*
|
|
||||||
* @param pattern 表达式
|
* @param pattern 表达式
|
||||||
*/
|
*/
|
||||||
public CronPattern(String pattern) {
|
public CronPattern(String pattern) {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package cn.hutool.cron.pattern.matcher;
|
package cn.hutool.cron.pattern.matcher;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将表达式中的数字值列表转换为Boolean数组,匹配时匹配相应数组位
|
* 将表达式中的数字值列表转换为Boolean数组,匹配时匹配相应数组位
|
||||||
* @author Looly
|
* @author Looly
|
||||||
@ -31,6 +31,6 @@ public class BoolArrayValueMatcher implements ValueMatcher{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return StrUtil.format("Matcher:{}", (Object)this.bValues);
|
return StrUtil.format("Matcher:{}", new Object[]{this.bValues});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package cn.hutool.cron.pattern.matcher;
|
package cn.hutool.cron.pattern.matcher;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.Month;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 每月第几天匹配<br>
|
* 每月第几天匹配<br>
|
||||||
* 考虑每月的天数不同,切存在闰年情况,日匹配单独使用
|
* 考虑每月的天数不同,且存在闰年情况,日匹配单独使用
|
||||||
*
|
*
|
||||||
* @author Looly
|
* @author Looly
|
||||||
*
|
*
|
||||||
@ -49,10 +51,6 @@ public class DayOfMonthValueMatcher extends BoolArrayValueMatcher {
|
|||||||
* @return 是否为本月最后一天
|
* @return 是否为本月最后一天
|
||||||
*/
|
*/
|
||||||
private static boolean isLastDayOfMonth(int value, int month, boolean isLeapYear) {
|
private static boolean isLastDayOfMonth(int value, int month, boolean isLeapYear) {
|
||||||
if (isLeapYear && month == 2) {
|
return value == Month.getLastDay(month, isLeapYear);
|
||||||
return value == 29;
|
|
||||||
} else {
|
|
||||||
return value == LAST_DAYS[month - 1];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import cn.hutool.core.lang.Console;
|
|||||||
import cn.hutool.core.net.multipart.UploadFile;
|
import cn.hutool.core.net.multipart.UploadFile;
|
||||||
import cn.hutool.http.ContentType;
|
import cn.hutool.http.ContentType;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
|
||||||
public class SimpleServerTest {
|
public class SimpleServerTest {
|
||||||
|
|
||||||
@ -17,9 +18,13 @@ public class SimpleServerTest {
|
|||||||
response.write(request.getURI().toString(), ContentType.TEXT_PLAIN.toString())
|
response.write(request.getURI().toString(), ContentType.TEXT_PLAIN.toString())
|
||||||
)
|
)
|
||||||
// 返回JSON数据测试
|
// 返回JSON数据测试
|
||||||
.addAction("/restTest", (request, response) ->
|
.addAction("/restTest", (request, response) -> {
|
||||||
response.write("{\"id\": 1, \"msg\": \"OK\"}", ContentType.JSON.toString())
|
String res = JSONUtil.createObj()
|
||||||
)
|
.set("id", 1)
|
||||||
|
.set("method", request.getMethod())
|
||||||
|
.toStringPretty();
|
||||||
|
response.write(res, ContentType.JSON.toString());
|
||||||
|
})
|
||||||
// 获取表单数据测试
|
// 获取表单数据测试
|
||||||
// http://localhost:8888/formTest?a=1&a=2&b=3
|
// http://localhost:8888/formTest?a=1&a=2&b=3
|
||||||
.addAction("/formTest", (request, response) ->
|
.addAction("/formTest", (request, response) ->
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.hutool.http.test;
|
package cn.hutool.http.test;
|
||||||
|
|
||||||
import cn.hutool.core.lang.Console;
|
import cn.hutool.core.lang.Console;
|
||||||
|
import cn.hutool.http.Header;
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
@ -46,8 +47,9 @@ public class RestTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore
|
@Ignore
|
||||||
public void postTest3() {
|
public void getWithBodyTest() {
|
||||||
HttpRequest request = HttpRequest.post("http://211.162.39.204:8181/jeesite-simple/a/open/bizGwbnService/test")//
|
HttpRequest request = HttpRequest.get("http://localhost:8888/restTest")//
|
||||||
|
.header(Header.CONTENT_TYPE, "application/json")
|
||||||
.body(JSONUtil.createObj()
|
.body(JSONUtil.createObj()
|
||||||
.set("aaa", "aaaValue")
|
.set("aaa", "aaaValue")
|
||||||
.set("键2", "值2").toString());
|
.set("键2", "值2").toString());
|
||||||
|
@ -965,7 +965,7 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
|
|||||||
* @param y Y坐标,从0计数,即行号
|
* @param y Y坐标,从0计数,即行号
|
||||||
* @return {@link CellStyle}
|
* @return {@link CellStyle}
|
||||||
* @since 4.0.9
|
* @since 4.0.9
|
||||||
* @deprecated 请使用{@link #createCellStyle(int, int)}
|
* @deprecated 请使用 {@link #createCellStyle(int, int)}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public CellStyle createStyleForCell(int x, int y) {
|
public CellStyle createStyleForCell(int x, int y) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user