refactor(sj_1.1.0-beta1): 使用SystemConstants时间格式常量
This commit is contained in:
parent
e5a5f9a9c5
commit
ca73d5f923
@ -30,7 +30,6 @@ import org.aopalliance.intercept.MethodInvocation;
|
|||||||
import org.springframework.aop.AfterAdvice;
|
import org.springframework.aop.AfterAdvice;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||||
import org.springframework.core.env.StandardEnvironment;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
@ -38,6 +37,8 @@ import java.time.LocalDateTime;
|
|||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static com.aizuda.snailjob.common.core.constant.SystemConstants.YYYY_MM_DD_HH_MM_SS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author opensnail
|
* @author opensnail
|
||||||
* @date 2023-08-23
|
* @date 2023-08-23
|
||||||
@ -45,7 +46,7 @@ import java.util.*;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class SnailRetryInterceptor implements MethodInterceptor, AfterAdvice, Serializable, Ordered {
|
public class SnailRetryInterceptor implements MethodInterceptor, AfterAdvice, Serializable, Ordered {
|
||||||
|
|
||||||
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(YYYY_MM_DD_HH_MM_SS);
|
||||||
private static final String retryErrorMoreThresholdTextMessageFormatter =
|
private static final String retryErrorMoreThresholdTextMessageFormatter =
|
||||||
"<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 重试组件异常</font> \n" +
|
"<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 重试组件异常</font> \n" +
|
||||||
"> IP:{} \n" +
|
"> IP:{} \n" +
|
||||||
@ -56,6 +57,7 @@ public class SnailRetryInterceptor implements MethodInterceptor, AfterAdvice, Se
|
|||||||
|
|
||||||
private final RetryStrategy retryStrategy;
|
private final RetryStrategy retryStrategy;
|
||||||
private final int order;
|
private final int order;
|
||||||
|
|
||||||
public SnailRetryInterceptor(int order, RetryStrategy localRetryStrategies) {
|
public SnailRetryInterceptor(int order, RetryStrategy localRetryStrategies) {
|
||||||
this.order = order;
|
this.order = order;
|
||||||
this.retryStrategy = localRetryStrategies;
|
this.retryStrategy = localRetryStrategies;
|
||||||
|
@ -32,6 +32,8 @@ import java.util.Objects;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import static com.aizuda.snailjob.common.core.constant.SystemConstants.YYYY_MM_DD_HH_MM_SS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量异步上报
|
* 批量异步上报
|
||||||
*
|
*
|
||||||
@ -41,8 +43,8 @@ import java.util.concurrent.TimeUnit;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ReportListener implements Listener<RetryTaskDTO> {
|
public class ReportListener implements Listener<RetryTaskDTO> {
|
||||||
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(YYYY_MM_DD_HH_MM_SS);
|
||||||
private static String reportErrorTextMessageFormatter =
|
private static final String reportErrorTextMessageFormatter =
|
||||||
"<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 异步批量上报异常</font> \n" +
|
"<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 异步批量上报异常</font> \n" +
|
||||||
"> IP:{} \n" +
|
"> IP:{} \n" +
|
||||||
"> 空间ID:{} \n" +
|
"> 空间ID:{} \n" +
|
||||||
|
@ -29,6 +29,8 @@ import java.util.Objects;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import static com.aizuda.snailjob.common.core.constant.SystemConstants.YYYY_MM_DD_HH_MM_SS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同步上报数据
|
* 同步上报数据
|
||||||
*
|
*
|
||||||
@ -40,9 +42,9 @@ import java.util.concurrent.TimeUnit;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class SyncReport extends AbstractReport {
|
public class SyncReport extends AbstractReport {
|
||||||
|
|
||||||
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(YYYY_MM_DD_HH_MM_SS);
|
||||||
|
|
||||||
private static String reportErrorTextMessageFormatter =
|
private static final String reportErrorTextMessageFormatter =
|
||||||
"<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 同步上报异常</font> \n" +
|
"<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 同步上报异常</font> \n" +
|
||||||
"> IP:{} \n" +
|
"> IP:{} \n" +
|
||||||
"> 空间ID:{} \n" +
|
"> 空间ID:{} \n" +
|
||||||
|
@ -34,14 +34,16 @@ import java.util.Optional;
|
|||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import static com.aizuda.snailjob.common.core.constant.SystemConstants.YYYY_MM_DD_HH_MM_SS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: opensnail
|
* @author: opensnail
|
||||||
* @date : 2022-03-04 14:40
|
* @date : 2022-03-04 14:40
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public abstract class AbstractRetryStrategies implements RetryStrategy {
|
public abstract class AbstractRetryStrategies implements RetryStrategy {
|
||||||
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(YYYY_MM_DD_HH_MM_SS);
|
||||||
private static String TEXT_MESSAGE_FORMATTER =
|
private static final String TEXT_MESSAGE_FORMATTER =
|
||||||
"<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 重试组件异常</font> \n" +
|
"<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 重试组件异常</font> \n" +
|
||||||
"> IP:{} \n" +
|
"> IP:{} \n" +
|
||||||
"> 空间ID:{} \n" +
|
"> 空间ID:{} \n" +
|
||||||
|
@ -18,6 +18,9 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static com.aizuda.snailjob.common.core.constant.SystemConstants.YYYY_MM_DD;
|
||||||
|
import static com.aizuda.snailjob.common.core.constant.SystemConstants.YYYY_MM_DD_HH_MM_SS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: byteblogs
|
* @author: byteblogs
|
||||||
* @date: 2019/8/3 14:57
|
* @date: 2019/8/3 14:57
|
||||||
@ -124,10 +127,8 @@ public class JsonUtil {
|
|||||||
* 内部类,处理Json
|
* 内部类,处理Json
|
||||||
*/
|
*/
|
||||||
public static class JsonMapper {
|
public static class JsonMapper {
|
||||||
private final static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
|
||||||
private final static String YYYY_MM_DD = "yyyy-MM-dd";
|
|
||||||
|
|
||||||
private static ObjectMapper objectMapper = jacksonObjectMapper();
|
private static final ObjectMapper objectMapper = jacksonObjectMapper();
|
||||||
|
|
||||||
public static ObjectMapper jacksonObjectMapper() {
|
public static ObjectMapper jacksonObjectMapper() {
|
||||||
|
|
||||||
|
@ -6,6 +6,9 @@ import java.time.ZoneOffset;
|
|||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import static com.aizuda.snailjob.common.core.constant.SystemConstants.YYYYMMDDHHMMSS;
|
||||||
|
import static com.aizuda.snailjob.common.core.constant.SystemConstants.YYYY_MM_DD_HH_MM_SS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author opensnail
|
* @author opensnail
|
||||||
* @date 2023-11-02 23:42:53
|
* @date 2023-11-02 23:42:53
|
||||||
@ -13,9 +16,9 @@ import java.util.Date;
|
|||||||
*/
|
*/
|
||||||
public class DateUtils {
|
public class DateUtils {
|
||||||
|
|
||||||
public static final DateTimeFormatter NORM_DATETIME_PATTERN = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
public static final DateTimeFormatter NORM_DATETIME_PATTERN = DateTimeFormatter.ofPattern(YYYY_MM_DD_HH_MM_SS);
|
||||||
|
|
||||||
public static final DateTimeFormatter PURE_DATETIME_MS_PATTERN = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
|
public static final DateTimeFormatter PURE_DATETIME_MS_PATTERN = DateTimeFormatter.ofPattern(YYYYMMDDHHMMSS);
|
||||||
|
|
||||||
private static final ZoneOffset zoneOffset = ZoneOffset.of("+8");
|
private static final ZoneOffset zoneOffset = ZoneOffset.of("+8");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user