Loading escheduler-alert/pom.xml +0 −4 Original line number Diff line number Diff line Loading @@ -90,10 +90,6 @@ <artifactId>commons-io</artifactId> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-collections4</artifactId> </dependency> <!--excel poi--> <dependency> Loading escheduler-api/pom.xml +0 −11 Original line number Diff line number Diff line Loading @@ -38,13 +38,6 @@ </dependency> <!--springboot--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>${spring.boot.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> Loading @@ -54,10 +47,6 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </exclusion> </exclusions> </dependency> Loading escheduler-api/src/main/java/cn/escheduler/api/configuration/AppConfiguration.java +2 −5 Original line number Diff line number Diff line Loading @@ -19,16 +19,13 @@ package cn.escheduler.api.configuration; import cn.escheduler.api.interceptor.LoginHandlerInterceptor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.*; /** * application configuration */ @Configuration public class AppConfiguration extends WebMvcConfigurerAdapter { public class AppConfiguration implements WebMvcConfigurer { public static final String LOGIN_INTERCEPTOR_PATH_PATTERN = "/**/*"; public static final String LOGIN_PATH_PATTERN = "/login"; Loading escheduler-common/pom.xml +0 −4 Original line number Diff line number Diff line Loading @@ -240,10 +240,6 @@ <artifactId>postgresql</artifactId> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> </dependency> <dependency> <groupId>org.apache.hive</groupId> <artifactId>hive-jdbc</artifactId> Loading escheduler-common/src/main/java/cn/escheduler/common/utils/DateUtils.java +304 −261 Original line number Diff line number Diff line Loading @@ -20,8 +20,10 @@ import cn.escheduler.common.Constants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Calendar; import java.util.Date; Loading @@ -32,6 +34,27 @@ public class DateUtils { private static final Logger logger = LoggerFactory.getLogger(DateUtils.class); /** * <code>java.util.Date</code> to <code>java.time.LocalDateTime</code> * use default zone * @param date * @return */ private static LocalDateTime date2LocalDateTime(Date date) { return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); } /** * <code>java.time.LocalDateTime</code> to <code>java.util.Date</code> * use default zone * @param localDateTime * @return */ private static Date localDateTime2Date(LocalDateTime localDateTime) { Instant instant = localDateTime.atZone(ZoneId.systemDefault()).toInstant(); return Date.from(instant); } /** * @return get the formatted date string for the current time */ Loading @@ -44,7 +67,8 @@ public class DateUtils { * @return get the date string in the specified format of the current time */ public static String getCurrentTime(String format) { return new SimpleDateFormat(format).format(new Date()); // return new SimpleDateFormat(format).format(new Date()); return LocalDateTime.now().format(DateTimeFormatter.ofPattern(format)); } /** Loading @@ -53,7 +77,17 @@ public class DateUtils { * @return get the formatted date string */ public static String format(Date date, String format) { return new SimpleDateFormat(format).format(date); // return new SimpleDateFormat(format).format(date); return format(date2LocalDateTime(date), format); } /** * @param localDateTime * @param format e.g. yyyy-MM-dd HH:mm:ss * @return get the formatted date string */ public static String format(LocalDateTime localDateTime, String format) { return localDateTime.format(DateTimeFormatter.ofPattern(format)); } /** Loading @@ -71,7 +105,9 @@ public class DateUtils { */ public static Date parse(String date, String format) { try { return new SimpleDateFormat(format).parse(date); // return new SimpleDateFormat(format).parse(date); LocalDateTime ldt = LocalDateTime.parse(date, DateTimeFormatter.ofPattern(format)); return localDateTime2Date(ldt); } catch (Exception e) { logger.error("error while parse date:" + date, e); } Loading @@ -80,6 +116,7 @@ public class DateUtils { /** * convert date str to yyyy-MM-dd HH:mm:ss format * * @param str * @return */ Loading Loading @@ -135,6 +172,7 @@ public class DateUtils { /** * get the date of the specified date in the days before and after * * @param date * @param day * @return Loading @@ -159,6 +197,7 @@ public class DateUtils { /** * convert schedule string to date * * @param schedule * @return */ Loading @@ -185,7 +224,7 @@ public class DateUtils { /** * get monday * * <p> * note: Set the first day of the week to Monday, the default is Sunday */ public static Date getMonday(Date date) { Loading @@ -201,7 +240,7 @@ public class DateUtils { /** * get sunday * * <p> * note: Set the first day of the week to Monday, the default is Sunday */ public static Date getSunday(Date date) { Loading Loading @@ -257,6 +296,7 @@ public class DateUtils { /** * return YYYY-MM-DD 00:00:00 * * @param inputDay * @return */ Loading @@ -271,6 +311,7 @@ public class DateUtils { /** * return YYYY-MM-DD 23:59:59 * * @param inputDay * @return */ Loading @@ -285,6 +326,7 @@ public class DateUtils { /** * return YYYY-MM-DD 00:00:00 * * @param inputDay * @return */ Loading @@ -298,6 +340,7 @@ public class DateUtils { /** * return YYYY-MM-DD 23:59:59 * * @param inputDay * @return */ Loading Loading
escheduler-alert/pom.xml +0 −4 Original line number Diff line number Diff line Loading @@ -90,10 +90,6 @@ <artifactId>commons-io</artifactId> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-collections4</artifactId> </dependency> <!--excel poi--> <dependency> Loading
escheduler-api/pom.xml +0 −11 Original line number Diff line number Diff line Loading @@ -38,13 +38,6 @@ </dependency> <!--springboot--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>${spring.boot.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> Loading @@ -54,10 +47,6 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </exclusion> </exclusions> </dependency> Loading
escheduler-api/src/main/java/cn/escheduler/api/configuration/AppConfiguration.java +2 −5 Original line number Diff line number Diff line Loading @@ -19,16 +19,13 @@ package cn.escheduler.api.configuration; import cn.escheduler.api.interceptor.LoginHandlerInterceptor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.*; /** * application configuration */ @Configuration public class AppConfiguration extends WebMvcConfigurerAdapter { public class AppConfiguration implements WebMvcConfigurer { public static final String LOGIN_INTERCEPTOR_PATH_PATTERN = "/**/*"; public static final String LOGIN_PATH_PATTERN = "/login"; Loading
escheduler-common/pom.xml +0 −4 Original line number Diff line number Diff line Loading @@ -240,10 +240,6 @@ <artifactId>postgresql</artifactId> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> </dependency> <dependency> <groupId>org.apache.hive</groupId> <artifactId>hive-jdbc</artifactId> Loading
escheduler-common/src/main/java/cn/escheduler/common/utils/DateUtils.java +304 −261 Original line number Diff line number Diff line Loading @@ -20,8 +20,10 @@ import cn.escheduler.common.Constants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Calendar; import java.util.Date; Loading @@ -32,6 +34,27 @@ public class DateUtils { private static final Logger logger = LoggerFactory.getLogger(DateUtils.class); /** * <code>java.util.Date</code> to <code>java.time.LocalDateTime</code> * use default zone * @param date * @return */ private static LocalDateTime date2LocalDateTime(Date date) { return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); } /** * <code>java.time.LocalDateTime</code> to <code>java.util.Date</code> * use default zone * @param localDateTime * @return */ private static Date localDateTime2Date(LocalDateTime localDateTime) { Instant instant = localDateTime.atZone(ZoneId.systemDefault()).toInstant(); return Date.from(instant); } /** * @return get the formatted date string for the current time */ Loading @@ -44,7 +67,8 @@ public class DateUtils { * @return get the date string in the specified format of the current time */ public static String getCurrentTime(String format) { return new SimpleDateFormat(format).format(new Date()); // return new SimpleDateFormat(format).format(new Date()); return LocalDateTime.now().format(DateTimeFormatter.ofPattern(format)); } /** Loading @@ -53,7 +77,17 @@ public class DateUtils { * @return get the formatted date string */ public static String format(Date date, String format) { return new SimpleDateFormat(format).format(date); // return new SimpleDateFormat(format).format(date); return format(date2LocalDateTime(date), format); } /** * @param localDateTime * @param format e.g. yyyy-MM-dd HH:mm:ss * @return get the formatted date string */ public static String format(LocalDateTime localDateTime, String format) { return localDateTime.format(DateTimeFormatter.ofPattern(format)); } /** Loading @@ -71,7 +105,9 @@ public class DateUtils { */ public static Date parse(String date, String format) { try { return new SimpleDateFormat(format).parse(date); // return new SimpleDateFormat(format).parse(date); LocalDateTime ldt = LocalDateTime.parse(date, DateTimeFormatter.ofPattern(format)); return localDateTime2Date(ldt); } catch (Exception e) { logger.error("error while parse date:" + date, e); } Loading @@ -80,6 +116,7 @@ public class DateUtils { /** * convert date str to yyyy-MM-dd HH:mm:ss format * * @param str * @return */ Loading Loading @@ -135,6 +172,7 @@ public class DateUtils { /** * get the date of the specified date in the days before and after * * @param date * @param day * @return Loading @@ -159,6 +197,7 @@ public class DateUtils { /** * convert schedule string to date * * @param schedule * @return */ Loading @@ -185,7 +224,7 @@ public class DateUtils { /** * get monday * * <p> * note: Set the first day of the week to Monday, the default is Sunday */ public static Date getMonday(Date date) { Loading @@ -201,7 +240,7 @@ public class DateUtils { /** * get sunday * * <p> * note: Set the first day of the week to Monday, the default is Sunday */ public static Date getSunday(Date date) { Loading Loading @@ -257,6 +296,7 @@ public class DateUtils { /** * return YYYY-MM-DD 00:00:00 * * @param inputDay * @return */ Loading @@ -271,6 +311,7 @@ public class DateUtils { /** * return YYYY-MM-DD 23:59:59 * * @param inputDay * @return */ Loading @@ -285,6 +326,7 @@ public class DateUtils { /** * return YYYY-MM-DD 00:00:00 * * @param inputDay * @return */ Loading @@ -298,6 +340,7 @@ public class DateUtils { /** * return YYYY-MM-DD 23:59:59 * * @param inputDay * @return */ Loading