|
|
|
|
@ -1,10 +1,15 @@
|
|
|
|
|
package externalsystem.testpool;
|
|
|
|
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
|
|
import org.egovframe.rte.fdl.string.EgovStringUtil;
|
|
|
|
|
|
|
|
|
|
public class RandomUtil {
|
|
|
|
|
|
|
|
|
|
public static String randomHangulName() {
|
|
|
|
|
@ -54,4 +59,55 @@ public class RandomUtil {
|
|
|
|
|
|
|
|
|
|
return front_digit + middle.get(0) + back_digit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String randomPhone() {
|
|
|
|
|
List<String> middle = Arrays.asList(
|
|
|
|
|
"1111", "5555", "7777"
|
|
|
|
|
);
|
|
|
|
|
Collections.shuffle(middle);
|
|
|
|
|
|
|
|
|
|
Random random = new Random();
|
|
|
|
|
|
|
|
|
|
String end_digit1 = Integer.toString(random.nextInt(99));
|
|
|
|
|
end_digit1 = EgovStringUtil.lPad(end_digit1, 2, '0');
|
|
|
|
|
|
|
|
|
|
String end_digit2 = Integer.toString(random.nextInt(99-11)+11);
|
|
|
|
|
|
|
|
|
|
return "010" + middle + end_digit1 + end_digit2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String randomYmd(String startYmd, String endYmd) throws ParseException {
|
|
|
|
|
SimpleDateFormat in_ymdFormat = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
|
Date d1 = in_ymdFormat.parse(startYmd);
|
|
|
|
|
Date d2 = in_ymdFormat.parse(endYmd);
|
|
|
|
|
|
|
|
|
|
long d1Sec = d1.getTime();
|
|
|
|
|
long d2Sec = d2.getTime();
|
|
|
|
|
|
|
|
|
|
Random random = new Random();
|
|
|
|
|
long newDateLong = random.nextLong(d2Sec - d1Sec) + d1Sec;
|
|
|
|
|
|
|
|
|
|
SimpleDateFormat out_ymdFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
String newDate = out_ymdFormat.format(newDateLong);
|
|
|
|
|
|
|
|
|
|
return newDate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String randomYmdhhmmss(String startYmdhhmmss, String endYmdhhmmss) throws ParseException {
|
|
|
|
|
SimpleDateFormat in_ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
|
|
Date d1 = in_ymdhmsFormat.parse(startYmdhhmmss);
|
|
|
|
|
Date d2 = in_ymdhmsFormat.parse(endYmdhhmmss);
|
|
|
|
|
|
|
|
|
|
long d1Sec = d1.getTime();
|
|
|
|
|
long d2Sec = d2.getTime();
|
|
|
|
|
|
|
|
|
|
Random random = new Random();
|
|
|
|
|
long newDateLong = random.nextLong(d2Sec - d1Sec) + d1Sec;
|
|
|
|
|
|
|
|
|
|
SimpleDateFormat out_ymdhmsFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
String newDate = out_ymdhmsFormat.format(newDateLong);
|
|
|
|
|
|
|
|
|
|
return newDate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|