|
@@ -4,13 +4,15 @@ import com.its.traf.dto.its.IfscCngsDto;
|
|
|
import com.its.traf.global.eTrafPrcsJob;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
-import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+import org.springframework.test.context.ActiveProfiles;
|
|
|
|
|
|
+import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
@Slf4j
|
|
|
-@SpringBootTest
|
|
|
+//@SpringBootTest
|
|
|
+@ActiveProfiles(profiles = "dev")
|
|
|
public class TrafPrcsServerApplicationTests {
|
|
|
|
|
|
enum LogLevel {
|
|
@@ -20,6 +22,50 @@ public class TrafPrcsServerApplicationTests {
|
|
|
WARN,
|
|
|
ERROR,
|
|
|
}
|
|
|
+
|
|
|
+ public String getCurr05MinString(Date paramDt) {
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ cal.setTime(paramDt);
|
|
|
+ cal.set(Calendar.SECOND, 0);
|
|
|
+ cal.set(Calendar.MILLISECOND, 0);
|
|
|
+ int min = cal.get(Calendar.MINUTE);
|
|
|
+ cal.add(Calendar.MINUTE, -(min % 5));
|
|
|
+ return new SimpleDateFormat("yyyyMMddHHmmss").format(cal.getTime());
|
|
|
+ }
|
|
|
+ public String getCurr15MinString(Date paramDt) {
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ cal.setTime(paramDt);
|
|
|
+ cal.set(Calendar.SECOND, 0);
|
|
|
+ cal.set(Calendar.MILLISECOND, 0);
|
|
|
+ int min = cal.get(Calendar.MINUTE);
|
|
|
+ cal.add(Calendar.MINUTE, -(min % 15));
|
|
|
+ return new SimpleDateFormat("yyyyMMddHHmmss").format(cal.getTime());
|
|
|
+ }
|
|
|
+ public Date convertString2Date(String paramTime) {
|
|
|
+ SimpleDateFormat transFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
+ Date to = null;
|
|
|
+ try {
|
|
|
+ to = transFormat.parse(paramTime);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return to;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ void testTime() {
|
|
|
+ String[] timeArr = {
|
|
|
+ "20230309160000", "20230309160500", "20230309161000", "20230309161500",
|
|
|
+ "20230309162000", "20230309162500", "20230309163000", "20230309163500",
|
|
|
+ "20230309164000", "20230309164500", "20230309165000", "20230309165500",};
|
|
|
+ for (String t : timeArr) {
|
|
|
+ String str05M = getCurr05MinString(convertString2Date(t));
|
|
|
+ String str15M = getCurr15MinString(convertString2Date(str05M));
|
|
|
+ log.info("{}", str05M);
|
|
|
+ log.info("{}", str15M);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
void test1() {
|
|
|
for (int ii = 0; ii < 24; ii++) {
|