+ * There exist different variants of these global identifiers. The methods of
+ * this class are for manipulating the Leach-Salz variant, although the
+ * constructors allow the creation of any variant of UUID (described below).
+ *
+ *
+ * The layout of a variant 2 (Leach-Salz) UUID is as follows:
+ *
+ * The most significant long consists of the following unsigned fields:
+ *
+ *
+ * The 60 bit timestamp value is constructed from the time_low, time_mid,
+ * and time_hi fields of this UUID. The resulting timestamp is
+ * measured in 100-nanosecond units since midnight, October 15, 1582 UTC.
+ *
+ *
+ * The timestamp value is only meaningful in a time-based UUID, which has
+ * version type 1. If this UUID is not a time-based UUID then
+ * this method throws UnsupportedOperationException.
+ *
+ * @throws UnsupportedOperationException
+ * if this UUID is not a version 1 UUID.
+ */
+ public long timestamp() {
+ if (version() != 1) {
+ throw new UnsupportedOperationException("Not a time-based UUID");
+ }
+ long result = timestamp;
+ if (result < 0) {
+ result = (mostSigBits & 0x0000000000000FFFL) << 48;
+ result |= ((mostSigBits >> 16) & 0xFFFFL) << 32;
+ result |= mostSigBits >>> 32;
+ timestamp = result;
+ }
+ return result;
+ }
+
+ /**
+ * The clock sequence value associated with this UUID.
+ *
+ *
+ * The 14 bit clock sequence value is constructed from the clock sequence
+ * field of this UUID. The clock sequence field is used to guarantee
+ * temporal uniqueness in a time-based UUID.
+ *
+ *
+ * The clockSequence value is only meaningful in a time-based UUID, which
+ * has version type 1. If this UUID is not a time-based UUID then this
+ * method throws UnsupportedOperationException.
+ *
+ * @return the clock sequence of this UUID.
+ * @throws UnsupportedOperationException
+ * if this UUID is not a version 1 UUID.
+ */
+ public int clockSequence() {
+ if (version() != 1) {
+ throw new UnsupportedOperationException("Not a time-based UUID");
+ }
+ if (sequence < 0) {
+ sequence = (int) ((leastSigBits & 0x3FFF000000000000L) >>> 48);
+ }
+ return sequence;
+ }
+
+ /**
+ * The node value associated with this UUID.
+ *
+ *
+ * The 48 bit node value is constructed from the node field of this UUID.
+ * This field is intended to hold the IEEE 802 address of the machine that
+ * generated this UUID to guarantee spatial uniqueness.
+ *
+ *
+ * The node value is only meaningful in a time-based UUID, which has version
+ * type 1. If this UUID is not a time-based UUID then this method throws
+ * UnsupportedOperationException.
+ *
+ * @return the node value of this UUID.
+ * @throws UnsupportedOperationException
+ * if this UUID is not a version 1 UUID.
+ */
+ public long node() {
+ if (version() != 1) {
+ throw new UnsupportedOperationException("Not a time-based UUID");
+ }
+ if (node < 0) {
+ node = leastSigBits & 0x0000FFFFFFFFFFFFL;
+ }
+ return node;
+ }
+
+ // Object Inherited Methods
+
+ /**
+ * Returns a String object representing this
+ * UUID.
+ *
+ *
+ * The UUID string representation is as described by this BNF :
+ *
+ *
+ * The first of two UUIDs follows the second if the most significant field
+ * in which the UUIDs differ is greater for the first UUID.
+ *
+ * @param val
+ * UUID to which this UUID is to be
+ * compared.
+ * @return -1, 0 or 1 as this UUID is less than, equal to, or
+ * greater than val.
+ */
+ public int compareTo(EgovFormBasedUUID val) {
+ // The ordering is intentionally set up so that the UUIDs
+ // can simply be numerically compared as two numbers
+ return (this.mostSigBits < val.mostSigBits ? -1
+ : (this.mostSigBits > val.mostSigBits ? 1
+ : (this.leastSigBits < val.leastSigBits ? -1
+ : (this.leastSigBits > val.leastSigBits ? 1 : 0))));
+ }
+
+ /**
+ * Reconstitute the UUID instance from a stream (that is,
+ * deserialize it). This is necessary to set the transient fields to their
+ * correct uninitialized value so they will be recomputed on demand.
+ */
+ private void readObject(java.io.ObjectInputStream in)
+ throws java.io.IOException, ClassNotFoundException {
+
+ in.defaultReadObject();
+
+ // Set "cached computation" fields to their initial values
+ version = -1;
+ variant = -1;
+ timestamp = -1;
+ sequence = -1;
+ node = -1;
+ hashCode = -1;
+ }
+}
\ No newline at end of file
diff --git a/legacy/nlib/src/main/java/egovframework/com/utl/fcc/service/EgovFormatCheckUtil.java b/legacy/nlib/src/main/java/egovframework/com/utl/fcc/service/EgovFormatCheckUtil.java
new file mode 100644
index 00000000..87d999ef
--- /dev/null
+++ b/legacy/nlib/src/main/java/egovframework/com/utl/fcc/service/EgovFormatCheckUtil.java
@@ -0,0 +1,207 @@
+package egovframework.com.utl.fcc.service;
+
+/**
+ *
+ * 포맷유효성체크 에 대한 Util 클래스
+ * @author 공통컴포넌트 개발팀 윤성록
+ * @since 2009.06.23
+ * @version 1.0
+ * @see
+ *
+ *
+ *
+ *
+ * @param 전화번호 문자열( 3개 )
+ * @return 유효한 전화번호 형식인지 여부 (True/False)
+ */
+ public static boolean checkFormatTell(String tell1, String tell2, String tell3) {
+
+ String[] check = {"02", "031", "032", "033", "041", "042", "043", "051", "052", "053", "054", "055", "061",
+ "062", "063", "070", "080", "0505"}; //존재하는 국번 데이터
+ String temp = tell1 + tell2 + tell3;
+
+ for(int i=0; i < temp.length(); i++){
+ if (temp.charAt(i) < '0' || temp.charAt(i) > '9')
+ return false;
+ } //숫자가 아닌 값이 들어왔는지를 확인
+
+ for(int i = 0; i < check.length; i++){
+ if(tell1.equals(check[i])) break;
+ if(i == check.length - 1) return false;
+ } //국번입력이 제대로 되었는지를 확인
+
+ if(tell2.charAt(0) == '0') return false;
+
+ if(tell1.equals("02")){
+ if(tell2.length() != 3 && tell2.length() !=4) return false;
+ if(tell3.length() != 4) return false; //서울지역(02)국번 입력때의 전화 번호 형식유효성 체크
+ }else{
+ if(tell2.length() != 3) return false;
+ if(tell3.length() != 4) return false;
+ } //서울을 제외한 지역(국번 입력때의 전화 번호 형식유효성 체크
+
+ return true;
+ }
+
+ /**
+ * xxx - xxx- xxxx 형식의 전화번호 하나를 입력 받아 유요한 전화번호형식인지 검사.
+ *
+ *
+ * @param 전화번호 문자열 (1개)
+ * @return 유효한 전화번호 형식인지 여부 (True/False)
+ */
+ public static boolean checkFormatTell(String tellNumber) {
+
+ String temp1;
+ String temp2;
+ String temp3;
+ String tell = tellNumber;
+
+ tell = tell.replace("-", "");
+
+ if(tell.length() < 9 || tell.length() > 11 || tell.charAt(0) != '0') return false; //전화번호 길이에 대한 체크
+
+ if(tell.charAt(1) =='2'){ //서울지역 (02)국번의 경우일때
+ temp1 = tell.substring(0,2);
+ if(tell.length() == 9){
+ temp2 = tell.substring(2,5);
+ temp3 = tell.substring(5,9);
+ }else if(tell.length() == 10){
+ temp2 = tell.substring(2,6);
+ temp3 = tell.substring(6,10);
+ }else
+ return false;
+ } else if(tell.substring(0,4).equals("0505")){ //평생번호(0505)국번의 경우일때
+ if(tell.length() != 11) return false;
+ temp1 = tell.substring(0,4);
+ temp2 = tell.substring(4,7);
+ temp3 = tell.substring(7,11);
+ } else { // 서울지역 및 "0505" 를 제외한 일반적인 경우일때
+ if(tell.length() != 10) return false;
+ temp1 = tell.substring(0,3);
+ temp2 = tell.substring(3,6);
+ temp3 = tell.substring(6,10);
+ }
+
+ return checkFormatTell(temp1, temp2, temp3);
+ }
+
+ /**
+ * xxx - xxx- xxxx 형식의 휴대폰번호 앞, 중간, 뒤 문자열 3개 입력 받아 유요한 휴대폰번호형식인지 검사.
+ *
+ *
+ * @param 휴대폰번호 문자열,(3개)
+ * @return 유효한 휴대폰번호 형식인지 여부 (True/False)
+ */
+ public static boolean checkFormatCell(String cell1, String cell2, String cell3) {
+ String[] check = {"010", "011", "016", "017", "018", "019"}; //유효한 휴대폰 첫자리 번호 데이터
+ String temp = cell1 + cell2 + cell3;
+
+ for(int i=0; i < temp.length(); i++){
+ if (temp.charAt(i) < '0' || temp.charAt(i) > '9')
+ return false;
+ } //숫자가 아닌 값이 들어왔는지를 확인
+
+ for(int i = 0; i < check.length; i++){
+ if(cell1.equals(check[i])) break;
+ if(i == check.length - 1) return false;
+ } // 휴대폰 첫자리 번호입력의 유효성 체크
+
+ if(cell2.charAt(0) == '0') return false;
+
+ if(cell2.length() != 3 && cell2.length() !=4) return false;
+ if(cell3.length() != 4) return false;
+
+ return true;
+ }
+
+ /**
+ * XXXXXXXXXX 형식의 휴대폰번호 문자열 3개 입력 받아 유요한 휴대폰번호형식인지 검사.
+ *
+ *
+ * @param 휴대폰번호 문자열(1개)
+ * @return 유효한 휴대폰번호 형식인지 여부 (True/False)
+ */
+ public static boolean checkFormatCell(String cellNumber) {
+
+ String temp1;
+ String temp2;
+ String temp3;
+
+ String cell = cellNumber;
+ cell = cell.replace("-", "");
+
+ if(cell.length() < 10 || cell.length() > 11 || cell.charAt(0) != '0') return false;
+
+ if(cell.length() == 10){ //전체 10자리 휴대폰 번호일 경우
+ temp1 = cell.substring(0,3);
+ temp2 = cell.substring(3,6);
+ temp3 = cell.substring(6,10);
+ }else{ //전체 11자리 휴대폰 번호일 경우
+ temp1 = cell.substring(0,3);
+ temp2 = cell.substring(3,7);
+ temp3 = cell.substring(7,11);
+ }
+
+ return checkFormatCell(temp1, temp2, temp3);
+ }
+
+ /**
+ * 이메일의 앞, 뒤 문자열 2개 입력 받아 유요한 이메일형식인지 검사.
+ *
+ *
+ * @param 이메일 문자열 (2개)
+ * @return 유효한 이메일 형식인지 여부 (True/False)
+ */
+ public static boolean checkFormatMail(String mail1, String mail2) {
+
+ int count = 0;
+
+ for(int i = 0; i < mail1.length(); i++){
+ if(mail1.charAt(i) <= 'z' && mail1.charAt(i) >= 'a') continue;
+ else if(mail1.charAt(i) <= 'Z' && mail1.charAt(i) >= 'A') continue;
+ else if(mail1.charAt(i) <= '9' && mail1.charAt(i) >= '0') continue;
+ else if(mail1.charAt(i) == '-' && mail1.charAt(i) == '_') continue;
+ else return false;
+ } // 유효한 문자, 숫자인지 체크
+
+ for(int i = 0; i < mail2.length(); i++){
+ if(mail2.charAt(i) <= 'z' && mail2.charAt(i) >= 'a') continue;
+ else if(mail2.charAt(i) == '.'){ count++; continue;}
+ else return false;
+ } // 메일 주소의 형식 체크(xxx.xxx 형태)
+
+ if(count == 1) return true;
+ else return false;
+
+ }
+
+ /**
+ * 이메일의 전체문자열 1개 입력 받아 유요한 이메일형식인지 검사.
+ *
+ *
+ * @param 이메일 문자열 (1개)
+ * @return 유효한 이메일 형식인지 여부 (True/False)
+ */
+ public static boolean checkFormatMail(String mail) {
+
+ String[] temp = mail.split("@"); // '@' 를 기점으로 앞, 뒤 문자열 구분
+
+ if(temp.length == 2) return checkFormatMail(temp[0], temp[1]);
+ else return false;
+ }
+
+}
+
diff --git a/legacy/nlib/src/main/java/egovframework/com/utl/fcc/service/EgovNumberCheckUtil.java b/legacy/nlib/src/main/java/egovframework/com/utl/fcc/service/EgovNumberCheckUtil.java
new file mode 100644
index 00000000..485f3c0e
--- /dev/null
+++ b/legacy/nlib/src/main/java/egovframework/com/utl/fcc/service/EgovNumberCheckUtil.java
@@ -0,0 +1,246 @@
+package egovframework.com.utl.fcc.service;
+
+/**
+ *
+ * 번호유효성체크 에 대한 Util 클래스
+ * @author 공통컴포넌트 개발팀 윤성록
+ * @since 2009.06.10
+ * @version 1.0
+ * @see
+ *
+ *
+ * << 개정이력(Modification Information) >>
+ *
+ * 수정일 수정자 수정내용
+ * ------- -------- ---------------------------
+ * 2009.06.10 윤성록 최초 생성
+ * 2012.02.27 이기하 법인번호 체크로직 수정
+ *
+ *
+ */
+public class EgovNumberCheckUtil {
+
+ /**
+ * XXXXXX - XXXXXXX 형식의 주민번호 앞, 뒤 문자열 2개 입력 받아 유효한 주민번호인지 검사.
+ *
+ *
+ * @param 6자리 주민앞번호 문자열 , 7자리 주민뒷번호 문자열
+ * @return 유효한 주민번호인지 여부 (True/False)
+ */
+ @SuppressWarnings("static-access")
+ public static boolean checkJuminNumber(String jumin1, String jumin2) {
+
+ EgovDateUtil egovDateUtil = new EgovDateUtil();
+ String juminNumber = jumin1 + jumin2;
+ String IDAdd = "234567892345"; // 주민등록번호에 가산할 값
+
+ int count_num = 0;
+ int add_num = 0;
+ int total_id = 0; //검증을 위한 변수선언
+
+ if (juminNumber.length() != 13) return false; // 주민등록번호 자리수가 맞는가를 확인
+
+ for (int i = 0; i <12 ; i++){
+ if(juminNumber.charAt(i)< '0' || juminNumber.charAt(i) > '9') return false; //숫자가 아닌 값이 들어왔는지를 확인
+ count_num = Character.getNumericValue(juminNumber.charAt(i));
+ add_num = Character.getNumericValue(IDAdd.charAt(i));
+ total_id += count_num * add_num; //유효자리 검증식을 적용
+ }
+
+ if(Character.getNumericValue(juminNumber.charAt(0)) == 0 || Character.getNumericValue(juminNumber.charAt(0)) == 1){
+ if(Character.getNumericValue(juminNumber.charAt(6)) > 4) return false;
+ String temp = "20" + juminNumber.substring(0,6);
+ if(!egovDateUtil.checkDate(temp)) return false;
+ }else{
+ if(Character.getNumericValue(juminNumber.charAt(6)) > 2) return false;
+ String temp = "19" + juminNumber.substring(0,6);
+ if(!egovDateUtil.checkDate(temp)) return false;
+ } //주민번호 앞자리 날짜유효성체크 & 성별구분 숫자 체크
+
+ if(Character.getNumericValue(juminNumber.charAt(12)) == (11 - (total_id % 11)) % 10) //마지막 유효숫자와 검증식을 통한 값의 비교
+ return true;
+ else
+ return false;
+ }
+
+ /**
+ * XXXXXXXXXXXXX 형식의 13자리 주민번호 1개를 입력 받아 유효한 주민번호인지 검사.
+ *
+ *
+ * @param 13자리 주민번호 문자열
+ * @return 유효한 주민번호인지 여부 (True/False)
+ */
+ public static boolean checkJuminNumber(String jumin) {
+
+ if(jumin.length() != 13) return false;
+
+ return checkJuminNumber(jumin.substring(0,6), jumin.substring(6,13)); //주민번호
+ }
+
+ /**
+ * XXXXXX - XXXXXXX 형식의 법인번호 앞, 뒤 문자열 2개 입력 받아 유효한 법인번호인지 검사.
+ *
+ *
+ * @param 6자리 법인앞번호 문자열 , 7자리 법인뒷번호 문자열
+ * @return 유효한 법인번호인지 여부 (True/False)
+ */
+ public static boolean checkBubinNumber(String bubin1, String bubin2) {
+
+ String bubinNumber = bubin1 + bubin2;
+
+ int hap = 0;
+ int temp = 1; //유효검증식에 사용하기 위한 변수
+
+ if(bubinNumber.length() != 13) return false; //법인번호의 자리수가 맞는 지를 확인
+
+ for(int i=0; i < 13; i++){
+ if (bubinNumber.charAt(i) < '0' || bubinNumber.charAt(i) > '9') //숫자가 아닌 값이 들어왔는지를 확인
+ return false;
+ }
+
+
+ // 2012.02.27 법인번호 체크로직 수정( i<13 -> i<12 )
+ // 맨끝 자리 수는 전산시스템으로 오류를 검증하기 위해 부여되는 검증번호임
+ for ( int i=0; i<12; i++){
+ if(temp ==3) temp = 1;
+ hap = hap + (Character.getNumericValue(bubinNumber.charAt(i)) * temp);
+ temp++;
+ } //검증을 위한 식의 계산
+
+ if ((10 - (hap%10))%10 == Character.getNumericValue(bubinNumber.charAt(12))) //마지막 유효숫자와 검증식을 통한 값의 비교
+ return true;
+ else
+ return false;
+ }
+
+ /**
+ * XXXXXXXXXXXXX 형식의 13자리 법인번호 1개를 입력 받아 유효한 법인번호인지 검사.
+ *
+ *
+ * @param 13자리 법인번호 문자열
+ * @return 유효한 법인번호인지 여부 (True/False)
+ */
+ public static boolean checkBubinNumber(String bubin) {
+
+ if(bubin.length() != 13) return false;
+
+ return checkBubinNumber(bubin.substring(0,6), bubin.substring(6,13));
+ }
+
+
+ /**
+ * xxx - xx - xxxx 형식의 사업자번호 앞,중간, 뒤 문자열 3개 입력 받아 유효한 사업자번호인지 검사.
+ *
+ *
+ * @param 3자리 사업자앞번호 문자열 , 2자리 사업자중간번호 문자열, 5자리 사업자뒷번호 문자열
+ * @return 유효한 사업자번호인지 여부 (True/False)
+ */
+ public static boolean checkCompNumber(String comp1, String comp2, String comp3) {
+
+ String compNumber = comp1 + comp2 + comp3;
+
+ int hap = 0;
+ int temp = 0;
+ int check[] = {1,3,7,1,3,7,1,3,5}; //사업자번호 유효성 체크 필요한 수
+
+ if(compNumber.length() != 10) //사업자번호의 길이가 맞는지를 확인한다.
+ return false;
+
+ for(int i=0; i < 9; i++){
+ if(compNumber.charAt(i) < '0' || compNumber.charAt(i) > '9') //숫자가 아닌 값이 들어왔는지를 확인한다.
+ return false;
+
+ hap = hap + (Character.getNumericValue(compNumber.charAt(i)) * check[temp]); //검증식 적용
+ temp++;
+ }
+
+ hap += (Character.getNumericValue(compNumber.charAt(8))*5)/10;
+
+ if ((10 - (hap%10))%10 == Character.getNumericValue(compNumber.charAt(9))) //마지막 유효숫자와 검증식을 통한 값의 비교
+ return true;
+ else
+ return false;
+ }
+
+ /**
+ * XXXXXXXXXX 형식의 10자리 사업자번호 3개를 입력 받아 유효한 사업자번호인지 검사.
+ *
+ *
+ * @param 10자리 사업자번호 문자열
+ * @return 유효한 사업자번호인지 여부 (True/False)
+ */
+ public static boolean checkCompNumber(String comp) {
+
+ if(comp.length() != 10) return false;
+ return checkCompNumber(comp.substring(0,3), comp.substring(3,5), comp.substring(5,10));
+ }
+
+ /**
+ * XXXXXX - XXXXXXX 형식의 외국인등록번호 앞, 뒤 문자열 2개 입력 받아 유효한 외국인등록번호인지 검사.
+ *
+ *
+ * @param 6자리 외국인등록앞번호 문자열 , 7자리 외국인등록뒷번호 문자열
+ * @return 유효한 외국인등록번호인지 여부 (True/False)
+ */
+ @SuppressWarnings("static-access")
+ public static boolean checkforeignNumber( String foreign1, String foreign2 ) {
+
+ EgovDateUtil egovDateUtil = new EgovDateUtil();
+ String foreignNumber = foreign1 + foreign2;
+ int check = 0;
+
+ if( foreignNumber.length() != 13 ) //외국인등록번호의 길이가 맞는지 확인한다.
+ return false;
+
+ for(int i=0; i < 13; i++){
+ if (foreignNumber.charAt(i) < '0' || foreignNumber.charAt(i) > '9') //숫자가 아닌 값이 들어왔는지를 확인한다.
+ return false;
+ }
+
+ if(Character.getNumericValue(foreignNumber.charAt(0)) == 0 || Character.getNumericValue(foreignNumber.charAt(0)) == 1){
+ if(Character.getNumericValue(foreignNumber.charAt(6)) == 5 && Character.getNumericValue(foreignNumber.charAt(6)) == 6) return false;
+ String temp = "20" + foreignNumber.substring(0,6);
+ if(!egovDateUtil.checkDate(temp)) return false;
+ }else{
+ if(Character.getNumericValue(foreignNumber.charAt(6)) == 5 && Character.getNumericValue(foreignNumber.charAt(6)) == 6) return false;
+ String temp = "19" + foreignNumber.substring(0,6);
+ if(!egovDateUtil.checkDate(temp)) return false;
+ } //외국인등록번호 앞자리 날짜유효성체크 & 성별구분 숫자 체크
+
+ for( int i = 0 ; i < 12 ; i++ ) {
+ check += ( ( 9 - i % 8 ) * Character.getNumericValue( foreignNumber.charAt( i ) ) );
+ }
+
+ if ( check % 11 == 0 ){
+ check = 1;
+ }else if ( check % 11==10 ){
+ check = 0;
+ }else
+ check = check % 11;
+
+ if ( check + 2 > 9 ){
+ check = check + 2- 10;
+ }else check = check+2; //검증식을 통합 값의 도출
+
+ if( check == Character.getNumericValue( foreignNumber.charAt( 12 ) ) ) //마지막 유효숫자와 검증식을 통한 값의 비교
+ return true;
+ else
+ return false;
+ }
+
+
+ /**
+ * XXXXXXXXXXXXX 형식의 13자리 외국인등록번호 1개를 입력 받아 유효한 외국인등록번호인지 검사.
+ *
+ *
+ * @param 13자리 외국인등록번호 문자열
+ * @return 유효한 외국인등록번호인지 여부 (True/False)
+ */
+ public static boolean checkforeignNumber( String foreign ) {
+
+ if(foreign.length() != 13) return false;
+ return checkforeignNumber(foreign.substring(0,6), foreign.substring(6,13));
+ }
+}
+
+
diff --git a/legacy/nlib/src/main/java/egovframework/com/utl/fcc/service/EgovNumberFormat.java b/legacy/nlib/src/main/java/egovframework/com/utl/fcc/service/EgovNumberFormat.java
new file mode 100644
index 00000000..701eda4e
--- /dev/null
+++ b/legacy/nlib/src/main/java/egovframework/com/utl/fcc/service/EgovNumberFormat.java
@@ -0,0 +1,258 @@
+package egovframework.com.utl.fcc.service;
+
+import java.text.NumberFormat;
+import java.util.Locale;
+
+/**
+ * 숫자, 통화, 퍼센트에 대한 형식 변환을 수행하는 클래스
+ */
+public class EgovNumberFormat {
+
+ private static final int MAX_FRACTION_DIGIT = 3;
+ private static final boolean GROUPING_USED = true;
+
+ /**
+ * 기본 Locale에 해당하는 형식으로 숫자를 변환한다.
+ *
+ * @param number 숫자
+ * @return 숫자 문자열
+ */
+ public static String formatNumber(Number number) {
+ return formatNumber(number, GROUPING_USED, MAX_FRACTION_DIGIT);
+ }
+
+ /**
+ * Locale에 해당하는 형식으로 숫자를 변환한다.
+ *
+ * @param locale 로케일
+ * @param number 숫자
+ * @return 숫자 문자열
+ */
+ public static String formatNumber(Locale locale, Number number) {
+ return formatNumber(locale, number, GROUPING_USED, MAX_FRACTION_DIGIT);
+ }
+
+ /**
+ * 기본 Locale에 해당하는 형식으로 숫자를 변환한다.
+ *
+ * @param number 숫자
+ * @param groupingUsed 그룹 분리기호 포함 여부
+ * @return 숫자 문자열
+ */
+ public static String formatNumber(Number number, boolean groupingUsed) {
+ return formatNumber(number, groupingUsed, MAX_FRACTION_DIGIT);
+ }
+
+ /**
+ * Locale에 해당하는 형식으로 숫자를 변환한다.
+ *
+ * @param locale 로케일
+ * @param number 숫자
+ * @param groupingUsed 그룹 분리기호 포함 여부
+ * @return 숫자 문자열
+ */
+ public static String formatNumber(Locale locale, Number number, boolean groupingUsed) {
+ return formatNumber(locale, number, groupingUsed, MAX_FRACTION_DIGIT);
+ }
+
+ /**
+ * 기본 Locale에 해당하는 형식으로 숫자를 변환한다.
+ *
+ * @param number 숫자
+ * @param maxFactionDigits 변환된 문자열에서 출력할 소수점 이하 최대 자리수
+ * @return 숫자 문자열
+ */
+ public static String formatNumber(Number number, int maxFactionDigits) {
+ return formatNumber(number, GROUPING_USED, maxFactionDigits);
+ }
+
+ /**
+ * Locale에 해당하는 형식으로 숫자를 변환한다.
+ *
+ * @param locale 로케일
+ * @param number 숫자
+ * @param maxFactionDigits 변환된 문자열에서 출력할 소수점 이하 최대 자리수
+ * @return 숫자 문자열
+ */
+ public static String formatNumber(Locale locale, Number number, int maxFactionDigits) {
+ return formatNumber(locale, number, GROUPING_USED, maxFactionDigits);
+ }
+
+ /**
+ * 기본 Locale에 해당하는 형식으로 숫자를 변환한다.
+ *
+ * @param number 숫자
+ * @param groupingUsed 그룹 분리기호 포함 여부
+ * @param maxFactionDigits 변환된 문자열에서 출력할 소수점 이하 최대 자리수
+ * @return 숫자 문자열
+ */
+ public static String formatNumber(Number number, boolean groupingUsed, int maxFactionDigits) {
+ NumberFormat numberberFormat = NumberFormat.getNumberInstance();
+ numberberFormat.setGroupingUsed(groupingUsed);
+ numberberFormat.setMaximumFractionDigits(maxFactionDigits);
+ return numberberFormat.format(number);
+ }
+
+ /**
+ * Locale에 해당하는 형식으로 숫자를 변환한다.
+ *
+ * @param locale 로케일
+ * @param number 숫자
+ * @param groupingUsed 그룹 분리기호 포함 여부
+ * @param maxFactionDigits 변환된 문자열에서 출력할 소수점 이하 최대 자리수
+ * @return 숫자 문자열
+ */
+ public static String formatNumber(Locale locale, Number number, boolean groupingUsed, int maxFactionDigits) {
+ NumberFormat numberberFormat = NumberFormat.getNumberInstance(locale);
+ numberberFormat.setGroupingUsed(groupingUsed);
+ numberberFormat.setMaximumFractionDigits(maxFactionDigits);
+ return numberberFormat.format(number);
+ }
+
+ /**
+ * 기본 Locale에 해당하는 형식으로 통화를 변환한다.
+ *
+ * @param number 숫자
+ * @return 통화 문자열
+ */
+ public static String formatCurrency(Number number) {
+ return formatCurrency(number, GROUPING_USED);
+ }
+
+ /**
+ * Locale에 해당하는 형식으로 통화를 변환한다.
+ *
+ * @param locale 로케일
+ * @param number 숫자
+ * @return 통화 문자열
+ */
+ public static String formatCurrency(Locale locale, Number number) {
+ return formatCurrency(locale, number, GROUPING_USED);
+ }
+
+ /**
+ * 기본 Locale에 해당하는 형식으로 통화를 변환한다.
+ *
+ * @param number 숫자
+ * @param groupingUsed 그룹 분리기호 포함 여부
+ * @return 통화 문자열
+ */
+ public static String formatCurrency(Number number, boolean groupingUsed) {
+ NumberFormat numberberFormat = NumberFormat.getCurrencyInstance();
+ numberberFormat.setGroupingUsed(groupingUsed);
+ return numberberFormat.format(number);
+ }
+
+ /**
+ * Locale에 해당하는 형식으로 통화를 변환한다.
+ *
+ * @param locale 로케일
+ * @param number 숫자
+ * @param groupingUsed 그룹 분리기호 포함 여부
+ * @return 통화 문자열
+ */
+ public static String formatCurrency(Locale locale, Number number, boolean groupingUsed) {
+ NumberFormat numberberFormat = NumberFormat.getCurrencyInstance(locale);
+ numberberFormat.setGroupingUsed(groupingUsed);
+ return numberberFormat.format(number);
+ }
+
+ /**
+ * 기본 Locale에 해당하는 형식으로 퍼센트를 변환한다.
+ *
+ * @param number 숫자
+ * @return 퍼센트 문자열
+ */
+ public static String formatPercent(Number number) {
+ return formatPercent(number, GROUPING_USED, MAX_FRACTION_DIGIT);
+ }
+
+ /**
+ * Locale에 해당하는 형식으로 퍼센트를 변환한다.
+ *
+ * @param locale 로케일
+ * @param number 숫자
+ * @return 퍼센트 문자열
+ */
+ public static String formatPercent(Locale locale, Number number) {
+ return formatPercent(locale, number, GROUPING_USED, MAX_FRACTION_DIGIT);
+ }
+
+ /**
+ * 기본 Locale에 해당하는 형식으로 퍼센트를 변환한다.
+ *
+ * @param number 숫자
+ * @param groupingUsed 그룹 분리기호 포함 여부
+ * @return 퍼센트 문자열
+ */
+ public static String formatPercent(Number number, boolean groupingUsed) {
+ return formatPercent(number, groupingUsed, MAX_FRACTION_DIGIT);
+ }
+
+ /**
+ * Locale에 해당하는 형식으로 퍼센트를 변환한다.
+ *
+ * @param locale 로케일
+ * @param number 숫자
+ * @param groupingUsed 그룹 분리기호 포함 여부
+ * @return 퍼센트 문자열
+ */
+ public static String formatPercent(Locale locale, Number number, boolean groupingUsed) {
+ return formatPercent(locale, number, groupingUsed, MAX_FRACTION_DIGIT);
+ }
+
+ /**
+ * 기본 Locale에 해당하는 형식으로 퍼센트를 변환한다.
+ *
+ * @param number 숫자
+ * @param maxFactionDigits 변환된 문자열에서 출력할 소수점 이하 최대 자리수
+ * @return 퍼센트 문자열
+ */
+ public static String formatPercent(Number number, int maxFactionDigits) {
+ return formatPercent(number, GROUPING_USED, maxFactionDigits);
+ }
+
+ /**
+ * Locale에 해당하는 형식으로 퍼센트를 변환한다.
+ *
+ * @param locale 로케일
+ * @param number 숫자
+ * @param maxFactionDigits 변환된 문자열에서 출력할 소수점 이하 최대 자리수
+ * @return 퍼센트 문자열
+ */
+ public static String formatPercent(Locale locale, Number number, int maxFactionDigits) {
+ return formatPercent(locale, number, GROUPING_USED, maxFactionDigits);
+ }
+
+ /**
+ * 기본 Locale에 해당하는 형식으로 퍼센트를 변환한다.
+ *
+ * @param number 숫자
+ * @param groupingUsed 그룹 분리기호 포함 여부
+ * @param maxFactionDigits 변환된 문자열에서 출력할 소수점 이하 최대 자리수
+ * @return 퍼센트 문자열
+ */
+ public static String formatPercent(Number number, boolean groupingUsed, int maxFactionDigits) {
+ NumberFormat numberberFormat = NumberFormat.getPercentInstance();
+ numberberFormat.setGroupingUsed(groupingUsed);
+ numberberFormat.setMaximumFractionDigits(maxFactionDigits);
+ return numberberFormat.format(number);
+ }
+
+ /**
+ * Locale에 해당하는 형식으로 퍼센트를 변환한다.
+ *
+ * @param locale 로케일
+ * @param number 숫자
+ * @param groupingUsed 그룹 분리기호 포함 여부
+ * @param maxFactionDigits 변환된 문자열에서 출력할 소수점 이하 최대 자리수
+ * @return 퍼센트 문자열
+ */
+ public static String formatPercent(Locale locale, Number number, boolean groupingUsed, int maxFactionDigits) {
+ NumberFormat numberberFormat = NumberFormat.getPercentInstance(locale);
+ numberberFormat.setGroupingUsed(groupingUsed);
+ numberberFormat.setMaximumFractionDigits(maxFactionDigits);
+ return numberberFormat.format(number);
+ }
+
+}
\ No newline at end of file
diff --git a/legacy/nlib/src/main/java/egovframework/com/utl/fcc/service/EgovNumberUtil.java b/legacy/nlib/src/main/java/egovframework/com/utl/fcc/service/EgovNumberUtil.java
new file mode 100644
index 00000000..2735e8bc
--- /dev/null
+++ b/legacy/nlib/src/main/java/egovframework/com/utl/fcc/service/EgovNumberUtil.java
@@ -0,0 +1,216 @@
+/**
+ * @Class Name : EgovNumberUtil.java
+ * @Description : 숫자 데이터 처리 관련 유틸리티
+ * @Modification Information
+ *
+ * 수정일 수정자 수정내용
+ * ------- -------- ---------------------------
+ * 2009.02.13 이삼섭 최초 생성
+ *
+ * @author 공통 서비스 개발팀 이삼섭
+ * @since 2009. 02. 13
+ * @version 1.0
+ * @see
+ *
+ */
+
+package egovframework.com.utl.fcc.service;
+
+import java.security.SecureRandom;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+public class EgovNumberUtil {
+
+ /**
+ * 특정숫자 집합에서 랜덤 숫자를 구하는 기능 시작숫자와 종료숫자 사이에서 구한 랜덤 숫자를 반환한다
+ *
+ * @param startNum - 시작숫자
+ * @param endNum - 종료숫자
+ * @return 랜덤숫자
+ * @see
+ */
+ public static int getRandomNum(int startNum, int endNum) {
+ int randomNum = 0;
+
+ // 랜덤 객체 생성
+ SecureRandom rnd = new SecureRandom();
+
+ do {
+ // 종료숫자내에서 랜덤 숫자를 발생시킨다.
+ randomNum = rnd.nextInt(endNum + 1);
+ } while (randomNum < startNum); // 랜덤 숫자가 시작숫자보다 작을경우 다시 랜덤숫자를 발생시킨다.
+
+ return randomNum;
+ }
+
+ /**
+ * 특정 숫자 집합에서 특정 숫자가 있는지 체크하는 기능 12345678에서 7이 있는지 없는지 체크하는 기능을 제공함
+ *
+ * @param sourceInt - 특정숫자집합
+ * @param searchInt - 검색숫자
+ * @return 존재여부
+ * @see
+ */
+ public static Boolean getNumSearchCheck(int sourceInt, int searchInt) {
+ String sourceStr = String.valueOf(sourceInt);
+ String searchStr = String.valueOf(searchInt);
+
+ // 특정숫자가 존재하는지 하여 위치값을 리턴한다. 없을 시 -1
+ if (sourceStr.indexOf(searchStr) == -1) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ /**
+ * 숫자타입을 문자열로 변환하는 기능 숫자 20081212를 문자열 '20081212'로 변환하는 기능
+ *
+ * @param srcNumber - 숫자
+ * @return 문자열
+ * @see
+ */
+ public static String getNumToStrCnvr(int srcNumber) {
+ String rtnStr = null;
+
+ rtnStr = String.valueOf(srcNumber);
+
+ return rtnStr;
+ }
+
+ /**
+ * 숫자타입을 데이트 타입으로 변환하는 기능
+ * 숫자 20081212를 데이트타입 '2008-12-12'로 변환하는 기능
+ * @param srcNumber - 숫자
+ * @return String
+ * @see
+ */
+ public static String getNumToDateCnvr(int srcNumber) {
+
+ String pattern = null;
+ String cnvrStr = null;
+
+ String srcStr = String.valueOf(srcNumber);
+
+ // Date 형태인 8자리 및 14자리만 정상처리
+ if (srcStr.length() != 8 && srcStr.length() != 14) {
+ throw new IllegalArgumentException("Invalid Number: " + srcStr + " Length=" + srcStr.trim().length());
+ }
+
+ if (srcStr.length() == 8) {
+ pattern = "yyyyMMdd";
+ } else if (srcStr.length() == 14) {
+ pattern = "yyyyMMddhhmmss";
+ }
+
+ SimpleDateFormat dateFormatter = new SimpleDateFormat(pattern, Locale.KOREA);
+
+ Date cnvrDate = null;
+
+ try {
+ cnvrDate = dateFormatter.parse(srcStr);
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+
+ cnvrStr = String.format("%1$tY-%1$tm-%1$td", cnvrDate);
+
+ return cnvrStr;
+
+ }
+
+ /**
+ * 체크할 숫자 중에서 숫자인지 아닌지 체크하는 기능
+ * 숫자이면 True, 아니면 False를 반환한다
+ * @param checkStr - 체크문자열
+ * @return 숫자여부
+ * @see
+ */
+ public static Boolean getNumberValidCheck(String checkStr) {
+
+ int i;
+ //String sourceStr = String.valueOf(sourceInt);
+
+ int checkStrLt = checkStr.length();
+
+ for (i = 0; i < checkStrLt; i++) {
+
+ // 아스키코드값( '0'-> 48, '9' -> 57)
+ if (checkStr.charAt(i) > 47 && checkStr.charAt(i) < 58) {
+ continue;
+ } else {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * 특정숫자를 다른 숫자로 치환하는 기능 숫자 12345678에서 123를 999로 변환하는 기능을 제공(99945678)
+ *
+ * @param srcNumber - 숫자집합
+ * @param cnvrSrcNumber - 원래숫자
+ * @param cnvrTrgtNumber - 치환숫자
+ * @return 치환숫자
+ * @see
+ */
+ public static int getNumberCnvr(int srcNumber, int cnvrSrcNumber, int cnvrTrgtNumber) {
+
+ // 입력받은 숫자를 문자열로 변환
+ String source = String.valueOf(srcNumber);
+ String subject = String.valueOf(cnvrSrcNumber);
+ String object = String.valueOf(cnvrTrgtNumber);
+
+ StringBuffer rtnStr = new StringBuffer();
+ String preStr = "";
+ String nextStr = source;
+
+ // 원본숫자에서 변환대상숫자의 위치를 찾는다.
+ while (source.indexOf(subject) >= 0) {
+ preStr = source.substring(0, source.indexOf(subject)); // 변환대상숫자 위치까지 숫자를 잘라낸다
+ nextStr = source.substring(source.indexOf(subject) + subject.length(), source.length());
+ source = nextStr;
+ rtnStr.append(preStr).append(object); // 변환대상위치 숫자에 변환할 숫자를 붙여준다.
+ }
+ rtnStr.append(nextStr); // 변환대상 숫자 이후 숫자를 붙여준다.
+
+ return Integer.parseInt(rtnStr.toString());
+ }
+
+ /**
+ * 특정숫자가 실수인지, 정수인지, 음수인지 체크하는 기능 123이 실수인지, 정수인지, 음수인지 체크하는 기능을 제공함
+ *
+ * @param srcNumber - 숫자집합
+ * @return -1(음수), 0(정수), 1(실수)
+ * @see
+ */
+ public static int checkRlnoInteger(double srcNumber) {
+
+ // byte 1바이트 ▶소수점이 없는 숫자로, 범위 -2^7 ~ 2^7 -1
+ // short 2바이트 ▶소수점이 없는 숫자로, 범위 -2^15 ~ 2^15 -1
+ // int 4바이트 ▶소수점이 없는 숫자로, 범위 -2^31 ~ 2^31 - 1
+ // long 8바이트 ▶소수점이 없는 숫자로, 범위 -2^63 ~ 2^63-1
+
+ // float 4바이트 ▶소수점이 있는 숫자로, 끝에 F 또는 f 가 붙는 숫자 (예:3.14f)
+ // double 8바이트 ▶소수점이 있는 숫자로, 끝에 아무것도 붙지 않는 숫자 (예:3.14)
+ // ▶소수점이 있는 숫자로, 끝에 D 또는 d 가 붙는 숫자(예:3.14d)
+
+ String cnvrString = null;
+
+ if (srcNumber < 0) {
+ return -1;
+ } else {
+ cnvrString = String.valueOf(srcNumber);
+
+ if (cnvrString.indexOf(".") == -1) {
+ return 0;
+ } else {
+ return 1;
+ }
+ }
+ }
+}
diff --git a/legacy/nlib/src/main/java/egovframework/com/utl/fcc/service/EgovStringUtil.java b/legacy/nlib/src/main/java/egovframework/com/utl/fcc/service/EgovStringUtil.java
new file mode 100644
index 00000000..96f1324d
--- /dev/null
+++ b/legacy/nlib/src/main/java/egovframework/com/utl/fcc/service/EgovStringUtil.java
@@ -0,0 +1,904 @@
+/**
+ * @Class Name : EgovStringUtil.java
+ * @Description : 문자열 데이터 처리 관련 유틸리티
+ * @Modification Information
+ *
+ * 수정일 수정자 수정내용
+ * ------- -------- ---------------------------
+ * 2009.01.13 박정규 최초 생성
+ * 2009.02.13 이삼섭 내용 추가
+ *
+ * @author 공통 서비스 개발팀 박정규
+ * @since 2009. 01. 13
+ * @version 1.0
+ * @see
+ *
+ */
+
+package egovframework.com.utl.fcc.service;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the ";License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS"; BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
+import java.security.SecureRandom;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.Locale;
+
+public class EgovStringUtil {
+ /**
+ * 빈 문자열 "".
+ */
+ public static final String EMPTY = "";
+
+ /**
+ * Padding을 할 수 있는 최대 수치
+ */
+ // private static final int PAD_LIMIT = 8192;
+
+ /**
+ * An array of Strings used for padding.
+ * Used for efficient space padding. The length of each String expands as needed.
+ */
+ /*
+ private static final String[] PADDING = new String[Character.MAX_VALUE];
+
+ static {
+ // space padding is most common, start with 64 chars
+ PADDING[32] = " ";
+ }
+ */
+
+ /**
+ * 문자열이 지정한 길이를 초과했을때 지정한길이에다가 해당 문자열을 붙여주는 메서드.
+ * @param source 원본 문자열 배열
+ * @param output 더할문자열
+ * @param slength 지정길이
+ * @return 지정길이로 잘라서 더할분자열 합친 문자열
+ */
+ public static String cutString(String source, String output, int slength) {
+ String returnVal = null;
+ if (source != null) {
+ if (source.length() > slength) {
+ returnVal = source.substring(0, slength) + output;
+ } else
+ returnVal = source;
+ }
+ return returnVal;
+ }
+
+ /**
+ * 문자열이 지정한 길이를 초과했을때 해당 문자열을 삭제하는 메서드
+ * @param source 원본 문자열 배열
+ * @param slength 지정길이
+ * @return 지정길이로 잘라서 더할분자열 합친 문자열
+ */
+ public static String cutString(String source, int slength) {
+ String result = null;
+ if (source != null) {
+ if (source.length() > slength) {
+ result = source.substring(0, slength);
+ } else
+ result = source;
+ }
+ return result;
+ }
+
+ /**
+ *
+ * String이 비었거나("") 혹은 null 인지 검증한다.
+ *
+ *
+ *
+ * StringUtil.isEmpty(null) = true
+ * StringUtil.isEmpty("") = true
+ * StringUtil.isEmpty(" ") = false
+ * StringUtil.isEmpty("bob") = false
+ * StringUtil.isEmpty(" bob ") = false
+ *
+ *
+ * @param str - 체크 대상 스트링오브젝트이며 null을 허용함
+ * @return true - 입력받은 String 이 빈 문자열 또는 null인 경우
+ */
+ public static boolean isEmpty(String str) {
+ return str == null || str.length() == 0;
+ }
+
+ /**
+ * 기준 문자열에 포함된 모든 대상 문자(char)를 제거한다.
+ *
+ *
+ * StringUtil.remove(null, *) = null
+ * StringUtil.remove("", *) = ""
+ * StringUtil.remove("queued", 'u') = "qeed"
+ * StringUtil.remove("queued", 'z') = "queued"
+ *
+ *
+ * @param str 입력받는 기준 문자열
+ * @param remove 입력받는 문자열에서 제거할 대상 문자열
+ * @return 제거대상 문자열이 제거된 입력문자열. 입력문자열이 null인 경우 출력문자열은 null
+ */
+ public static String remove(String str, char remove) {
+ if (isEmpty(str) || str.indexOf(remove) == -1) {
+ return str;
+ }
+ char[] chars = str.toCharArray();
+ int pos = 0;
+ for (int i = 0; i < chars.length; i++) {
+ if (chars[i] != remove) {
+ chars[pos++] = chars[i];
+ }
+ }
+ return new String(chars, 0, pos);
+ }
+
+ /**
+ * 문자열 내부의 콤마 character(,)를 모두 제거한다.
+ *
+ *
+ * StringUtil.removeCommaChar(null) = null
+ * StringUtil.removeCommaChar("") = ""
+ * StringUtil.removeCommaChar("asdfg,qweqe") = "asdfgqweqe"
+ *
+ *
+ * @param str 입력받는 기준 문자열
+ * @return " , "가 제거된 입력문자열
+ * 입력문자열이 null인 경우 출력문자열은 null
+ */
+ public static String removeCommaChar(String str) {
+ return remove(str, ',');
+ }
+
+ /**
+ * 문자열 내부의 마이너스 character(-)를 모두 제거한다.
+ *
+ *
+ * StringUtil.removeMinusChar(null) = null
+ * StringUtil.removeMinusChar("") = ""
+ * StringUtil.removeMinusChar("a-sdfg-qweqe") = "asdfgqweqe"
+ *
+ *
+ * @param str 입력받는 기준 문자열
+ * @return " - "가 제거된 입력문자열
+ * 입력문자열이 null인 경우 출력문자열은 null
+ */
+ public static String removeMinusChar(String str) {
+ return remove(str, '-');
+ }
+
+ /**
+ * 원본 문자열의 포함된 특정 문자열을 새로운 문자열로 변환하는 메서드
+ * @param source 원본 문자열
+ * @param subject 원본 문자열에 포함된 특정 문자열
+ * @param object 변환할 문자열
+ * @return sb.toString() 새로운 문자열로 변환된 문자열
+ */
+ public static String replace(String source, String subject, String object) {
+ StringBuffer rtnStr = new StringBuffer();
+ String preStr = "";
+ String nextStr = source;
+ String srcStr = source;
+
+ while (srcStr.indexOf(subject) >= 0) {
+ preStr = srcStr.substring(0, srcStr.indexOf(subject));
+ nextStr = srcStr.substring(srcStr.indexOf(subject) + subject.length(), srcStr.length());
+ srcStr = nextStr;
+ rtnStr.append(preStr).append(object);
+ }
+ rtnStr.append(nextStr);
+
+ return rtnStr.toString();
+ }
+
+ /**
+ * 원본 문자열의 포함된 특정 문자열 첫번째 한개만 새로운 문자열로 변환하는 메서드
+ * @param source 원본 문자열
+ * @param subject 원본 문자열에 포함된 특정 문자열
+ * @param object 변환할 문자열
+ * @return sb.toString() 새로운 문자열로 변환된 문자열 / source 특정문자열이 없는 경우 원본 문자열
+ */
+ public static String replaceOnce(String source, String subject, String object) {
+ StringBuffer rtnStr = new StringBuffer();
+ String preStr = "";
+ String nextStr = source;
+ if (source.indexOf(subject) >= 0) {
+ preStr = source.substring(0, source.indexOf(subject));
+ nextStr = source.substring(source.indexOf(subject) + subject.length(), source.length());
+ rtnStr.append(preStr).append(object).append(nextStr);
+
+ return rtnStr.toString();
+ } else {
+ return source;
+ }
+ }
+
+ /**
+ * subject에 포함된 각각의 문자를 object로 변환한다.
+ *
+ * @param source 원본 문자열
+ * @param subject 원본 문자열에 포함된 특정 문자열
+ * @param object 변환할 문자열
+ * @return sb.toString() 새로운 문자열로 변환된 문자열
+ */
+ public static String replaceChar(String source, String subject, String object) {
+ StringBuffer rtnStr = new StringBuffer();
+ String preStr = "";
+ String nextStr = source;
+ String srcStr = source;
+
+ char chA;
+
+ for (int i = 0; i < subject.length(); i++) {
+ chA = subject.charAt(i);
+
+ if (srcStr.indexOf(chA) >= 0) {
+ preStr = srcStr.substring(0, srcStr.indexOf(chA));
+ nextStr = srcStr.substring(srcStr.indexOf(chA) + 1, srcStr.length());
+ srcStr = rtnStr.append(preStr).append(object).append(nextStr).toString();
+ }
+ }
+
+ return srcStr;
+ }
+
+ /**
+ * str 중 searchStr의 시작(index) 위치를 반환.
+ *
+ * 입력값 중 null이 있을 경우 -1을 반환.
+ *
+ *
+ * StringUtil.indexOf(null, *) = -1
+ * StringUtil.indexOf(*, null) = -1
+ * StringUtil.indexOf("", "") = 0
+ * StringUtil.indexOf("aabaabaa", "a") = 0
+ * StringUtil.indexOf("aabaabaa", "b") = 2
+ * StringUtil.indexOf("aabaabaa", "ab") = 1
+ * StringUtil.indexOf("aabaabaa", "") = 0
+ *
+ *
+ * @param str 검색 문자열
+ * @param searchStr 검색 대상문자열
+ * @return 검색 문자열 중 검색 대상문자열이 있는 시작 위치 검색대상 문자열이 없거나 null인 경우 -1
+ */
+ public static int indexOf(String str, String searchStr) {
+ if (str == null || searchStr == null) {
+ return -1;
+ }
+
+ return str.indexOf(searchStr);
+ }
+
+ /**
+ * 오라클의 decode 함수와 동일한 기능을 가진 메서드이다.
+ * sourStr과 compareStr의 값이 같으면
+ * returStr을 반환하며, 다르면 defaultStr을 반환한다.
+ *
+ *
+ *
+ * StringUtil.decode(null, null, "foo", "bar")= "foo"
+ * StringUtil.decode("", null, "foo", "bar") = "bar"
+ * StringUtil.decode(null, "", "foo", "bar") = "bar"
+ * StringUtil.decode("하이", "하이", null, "bar") = null
+ * StringUtil.decode("하이", "하이 ", "foo", null) = null
+ * StringUtil.decode("하이", "하이", "foo", "bar") = "foo"
+ * StringUtil.decode("하이", "하이 ", "foo", "bar") = "bar"
+ *
+ *
+ * @param sourceStr 비교할 문자열
+ * @param compareStr 비교 대상 문자열
+ * @param returnStr sourceStr와 compareStr의 값이 같을 때 반환할 문자열
+ * @param defaultStr sourceStr와 compareStr의 값이 다를 때 반환할 문자열
+ * @return sourceStr과 compareStr의 값이 동일(equal)할 때 returnStr을 반환하며,
+ *
다르면 defaultStr을 반환한다.
+ */
+ public static String decode(String sourceStr, String compareStr, String returnStr, String defaultStr) {
+ if (sourceStr == null && compareStr == null) {
+ return returnStr;
+ }
+
+ if (sourceStr == null && compareStr != null) {
+ return defaultStr;
+ }
+
+ if (sourceStr.trim().equals(compareStr)) {
+ return returnStr;
+ }
+
+ return defaultStr;
+ }
+
+ /**
+ * 오라클의 decode 함수와 동일한 기능을 가진 메서드이다.
+ * sourStr과 compareStr의 값이 같으면
+ * returStr을 반환하며, 다르면 sourceStr을 반환한다.
+ *
+ *
+ *
+ * StringUtil.decode(null, null, "foo") = "foo"
+ * StringUtil.decode("", null, "foo") = ""
+ * StringUtil.decode(null, "", "foo") = null
+ * StringUtil.decode("하이", "하이", "foo") = "foo"
+ * StringUtil.decode("하이", "하이 ", "foo") = "하이"
+ * StringUtil.decode("하이", "바이", "foo") = "하이"
+ *
+ *
+ * @param sourceStr 비교할 문자열
+ * @param compareStr 비교 대상 문자열
+ * @param returnStr sourceStr와 compareStr의 값이 같을 때 반환할 문자열
+ * @return sourceStr과 compareStr의 값이 동일(equal)할 때 returnStr을 반환하며,
+ *
다르면 sourceStr을 반환한다.
+ */
+ public static String decode(String sourceStr, String compareStr, String returnStr) {
+ return decode(sourceStr, compareStr, returnStr, sourceStr);
+ }
+
+ /**
+ * 객체가 null인지 확인하고 null인 경우 "" 로 바꾸는 메서드
+ * @param object 원본 객체
+ * @return resultVal 문자열
+ */
+ public static String isNullToString(Object object) {
+ String string = "";
+
+ if (object != null) {
+ string = object.toString().trim();
+ }
+
+ return string;
+ }
+
+ /**
+ *
+ * 인자로 받은 String이 null일 경우 ""로 리턴한다.
+ * @param src null값일 가능성이 있는 String 값.
+ * @return 만약 String이 null 값일 경우 ""로 바꾼 String 값.
+ *
+ */
+ public static String nullConvert(Object src) {
+ //if (src != null && src.getClass().getName().equals("java.math.BigDecimal")) {
+ if (src != null && src instanceof java.math.BigDecimal) {
+ return ((BigDecimal) src).toString();
+ }
+
+ if (src == null || src.equals("null")) {
+ return "";
+ } else {
+ return ((String) src).trim();
+ }
+ }
+
+ /**
+ *
+ * 인자로 받은 String이 null일 경우 ""로 리턴한다.
+ * @param src null값일 가능성이 있는 String 값.
+ * @return 만약 String이 null 값일 경우 ""로 바꾼 String 값.
+ *
+ */
+ public static String nullConvertInt(Object src) {
+ //if (src != null && src.getClass().getName().equals("java.math.BigDecimal")) {
+ if (src != null && src instanceof java.math.BigDecimal) {
+ return ((BigDecimal) src).toString();
+ }
+
+ if (src == null || src.equals("null")) {
+ return "0";
+ } else {
+ return ((String) src).trim();
+ }
+ }
+
+ /**
+ *
+ * 인자로 받은 String이 null일 경우 ""로 리턴한다.
+ * @param src null값일 가능성이 있는 String 값.
+ * @return 만약 String이 null 값일 경우 ""로 바꾼 String 값.
+ *
+ */
+ public static String nullConvert(String src) {
+
+ if (src == null || src.equals("null") || "".equals(src) || " ".equals(src)) {
+ return "";
+ } else {
+ return src.trim();
+ }
+ }
+
+ /**
+ *
+ * 인자로 받은 String이 null일 경우 "0"로 리턴한다.
+ * @param src null값일 가능성이 있는 String 값.
+ * @return 만약 String이 null 값일 경우 "0"로 바꾼 String 값.
+ *
+ */
+ public static int zeroConvert(Object src) {
+
+ if (src == null || src.equals("null")) {
+ return 0;
+ } else {
+ return Integer.parseInt(((String) src).trim());
+ }
+ }
+
+ /**
+ *
+ * 인자로 받은 String이 null일 경우 ""로 리턴한다.
+ * @param src null값일 가능성이 있는 String 값.
+ * @return 만약 String이 null 값일 경우 ""로 바꾼 String 값.
+ *
+ */
+ public static int zeroConvert(String src) {
+
+ if (src == null || src.equals("null") || "".equals(src) || " ".equals(src)) {
+ return 0;
+ } else {
+ return Integer.parseInt(src.trim());
+ }
+ }
+
+ /**
+ * 문자열에서 {@link Character#isWhitespace(char)}에 정의된
+ * 모든 공백문자를 제거한다.
+ *
+ *
+ * StringUtil.removeWhitespace(null) = null
+ * StringUtil.removeWhitespace("") = ""
+ * StringUtil.removeWhitespace("abc") = "abc"
+ * StringUtil.removeWhitespace(" ab c ") = "abc"
+ *
+ *
+ * @param str 공백문자가 제거도어야 할 문자열
+ * @return the 공백문자가 제거된 문자열, null이 입력되면 null이 리턴
+ */
+ public static String removeWhitespace(String str) {
+ if (isEmpty(str)) {
+ return str;
+ }
+ int sz = str.length();
+ char[] chs = new char[sz];
+ int count = 0;
+ for (int i = 0; i < sz; i++) {
+ if (!Character.isWhitespace(str.charAt(i))) {
+ chs[count++] = str.charAt(i);
+ }
+ }
+ if (count == sz) {
+ return str;
+ }
+
+ return new String(chs, 0, count);
+ }
+
+ /**
+ * Html 코드가 들어간 문서를 표시할때 태그에 손상없이 보이기 위한 메서드
+ *
+ * @param strString
+ * @return HTML 태그를 치환한 문자열
+ */
+ public static String checkHtmlView(String strString) {
+ String strNew = "";
+
+ StringBuffer strTxt = new StringBuffer("");
+
+ char chrBuff;
+ int len = strString.length();
+
+ for (int i = 0; i < len; i++) {
+ chrBuff = (char) strString.charAt(i);
+
+ switch (chrBuff) {
+ case '<':
+ strTxt.append("<");
+ break;
+ case '>':
+ strTxt.append(">");
+ break;
+ case '"':
+ strTxt.append(""");
+ break;
+ case 10:
+ strTxt.append("
");
+ break;
+ case ' ':
+ strTxt.append(" ");
+ break;
+ //case '&' :
+ //strTxt.append("&");
+ //break;
+ default:
+ strTxt.append(chrBuff);
+ }
+ }
+
+ strNew = strTxt.toString();
+
+ return strNew;
+ }
+
+ /**
+ * 문자열을 지정한 분리자에 의해 배열로 리턴하는 메서드.
+ * @param source 원본 문자열
+ * @param separator 분리자
+ * @return result 분리자로 나뉘어진 문자열 배열
+ */
+ public static String[] split(String source, String separator) throws NullPointerException {
+ String[] returnVal = null;
+ int cnt = 1;
+
+ int index = source.indexOf(separator);
+ int index0 = 0;
+ while (index >= 0) {
+ cnt++;
+ index = source.indexOf(separator, index + 1);
+ }
+ returnVal = new String[cnt];
+ cnt = 0;
+ index = source.indexOf(separator);
+ while (index >= 0) {
+ returnVal[cnt] = source.substring(index0, index);
+ index0 = index + 1;
+ index = source.indexOf(separator, index + 1);
+ cnt++;
+ }
+ returnVal[cnt] = source.substring(index0);
+
+ return returnVal;
+ }
+
+ /**
+ * {@link String#toLowerCase()}를 이용하여 소문자로 변환한다.
+ *
+ *
+ * StringUtil.lowerCase(null) = null
+ * StringUtil.lowerCase("") = ""
+ * StringUtil.lowerCase("aBc") = "abc"
+ *
+ *
+ * @param str 소문자로 변환되어야 할 문자열
+ * @return 소문자로 변환된 문자열, null이 입력되면 null 리턴
+ */
+ public static String lowerCase(String str) {
+ if (str == null) {
+ return null;
+ }
+
+ return str.toLowerCase();
+ }
+
+ /**
+ * {@link String#toUpperCase()}를 이용하여 대문자로 변환한다.
+ *
+ *
+ * StringUtil.upperCase(null) = null
+ * StringUtil.upperCase("") = ""
+ * StringUtil.upperCase("aBc") = "ABC"
+ *
+ *
+ * @param str 대문자로 변환되어야 할 문자열
+ * @return 대문자로 변환된 문자열, null이 입력되면 null 리턴
+ */
+ public static String upperCase(String str) {
+ if (str == null) {
+ return null;
+ }
+
+ return str.toUpperCase();
+ }
+
+ /**
+ * 입력된 String의 앞쪽에서 두번째 인자로 전달된 문자(stripChars)를 모두 제거한다.
+ *
+ *
+ * StringUtil.stripStart(null, *) = null
+ * StringUtil.stripStart("", *) = ""
+ * StringUtil.stripStart("abc", "") = "abc"
+ * StringUtil.stripStart("abc", null) = "abc"
+ * StringUtil.stripStart(" abc", null) = "abc"
+ * StringUtil.stripStart("abc ", null) = "abc "
+ * StringUtil.stripStart(" abc ", null) = "abc "
+ * StringUtil.stripStart("yxabc ", "xyz") = "abc "
+ *
+ *
+ * @param str 지정된 문자가 제거되어야 할 문자열
+ * @param stripChars 제거대상 문자열
+ * @return 지정된 문자가 제거된 문자열, null이 입력되면 null 리턴
+ */
+ public static String stripStart(String str, String stripChars) {
+ int strLen;
+ if (str == null || (strLen = str.length()) == 0) {
+ return str;
+ }
+ int start = 0;
+ if (stripChars == null) {
+ while ((start != strLen) && Character.isWhitespace(str.charAt(start))) {
+ start++;
+ }
+ } else if (stripChars.length() == 0) {
+ return str;
+ } else {
+ while ((start != strLen) && (stripChars.indexOf(str.charAt(start)) != -1)) {
+ start++;
+ }
+ }
+
+ return str.substring(start);
+ }
+
+ /**
+ * 입력된 String의 뒤쪽에서 두번째 인자로 전달된 문자(stripChars)를 모두 제거한다.
+ *
+ *
+ * StringUtil.stripEnd(null, *) = null
+ * StringUtil.stripEnd("", *) = ""
+ * StringUtil.stripEnd("abc", "") = "abc"
+ * StringUtil.stripEnd("abc", null) = "abc"
+ * StringUtil.stripEnd(" abc", null) = " abc"
+ * StringUtil.stripEnd("abc ", null) = "abc"
+ * StringUtil.stripEnd(" abc ", null) = " abc"
+ * StringUtil.stripEnd(" abcyx", "xyz") = " abc"
+ *
+ *
+ * @param str 지정된 문자가 제거되어야 할 문자열
+ * @param stripChars 제거대상 문자열
+ * @return 지정된 문자가 제거된 문자열, null이 입력되면 null 리턴
+ */
+ public static String stripEnd(String str, String stripChars) {
+ int end;
+ if (str == null || (end = str.length()) == 0) {
+ return str;
+ }
+
+ if (stripChars == null) {
+ while ((end != 0) && Character.isWhitespace(str.charAt(end - 1))) {
+ end--;
+ }
+ } else if (stripChars.length() == 0) {
+ return str;
+ } else {
+ while ((end != 0) && (stripChars.indexOf(str.charAt(end - 1)) != -1)) {
+ end--;
+ }
+ }
+
+ return str.substring(0, end);
+ }
+
+ /**
+ * 입력된 String의 앞, 뒤에서 두번째 인자로 전달된 문자(stripChars)를 모두 제거한다.
+ *
+ *
+ * StringUtil.strip(null, *) = null
+ * StringUtil.strip("", *) = ""
+ * StringUtil.strip("abc", null) = "abc"
+ * StringUtil.strip(" abc", null) = "abc"
+ * StringUtil.strip("abc ", null) = "abc"
+ * StringUtil.strip(" abc ", null) = "abc"
+ * StringUtil.strip(" abcyx", "xyz") = " abc"
+ *
+ *
+ * @param str 지정된 문자가 제거되어야 할 문자열
+ * @param stripChars 제거대상 문자열
+ * @return 지정된 문자가 제거된 문자열, null이 입력되면 null 리턴
+ */
+ public static String strip(String str, String stripChars) {
+ if (isEmpty(str)) {
+ return str;
+ }
+
+ String srcStr = str;
+ srcStr = stripStart(srcStr, stripChars);
+
+ return stripEnd(srcStr, stripChars);
+ }
+
+ /**
+ * 문자열을 지정한 분리자에 의해 지정된 길이의 배열로 리턴하는 메서드.
+ * @param source 원본 문자열
+ * @param separator 분리자
+ * @param arraylength 배열 길이
+ * @return 분리자로 나뉘어진 문자열 배열
+ */
+ public static String[] split(String source, String separator, int arraylength) throws NullPointerException {
+ String[] returnVal = new String[arraylength];
+ int cnt = 0;
+ int index0 = 0;
+ int index = source.indexOf(separator);
+ while (index >= 0 && cnt < (arraylength - 1)) {
+ returnVal[cnt] = source.substring(index0, index);
+ index0 = index + 1;
+ index = source.indexOf(separator, index + 1);
+ cnt++;
+ }
+ returnVal[cnt] = source.substring(index0);
+ if (cnt < (arraylength - 1)) {
+ for (int i = cnt + 1; i < arraylength; i++) {
+ returnVal[i] = "";
+ }
+ }
+
+ return returnVal;
+ }
+
+ /**
+ * 문자열 A에서 Z사이의 랜덤 문자열을 구하는 기능을 제공 시작문자열과 종료문자열 사이의 랜덤 문자열을 구하는 기능
+ *
+ * @param startChr - 첫 문자
+ * @param endChr - 마지막문자
+ * @return 랜덤문자
+ * @exception MyException
+ * @see
+ */
+ public static String getRandomStr(char startChr, char endChr) {
+
+ int randomInt;
+ String randomStr = null;
+
+ // 시작문자 및 종료문자를 아스키숫자로 변환한다.
+ int startInt = Integer.valueOf(startChr);
+ int endInt = Integer.valueOf(endChr);
+
+ // 시작문자열이 종료문자열보가 클경우
+ if (startInt > endInt) {
+ throw new IllegalArgumentException("Start String: " + startChr + " End String: " + endChr);
+ }
+
+ // 랜덤 객체 생성
+ SecureRandom rnd = new SecureRandom();
+
+ do {
+ // 시작문자 및 종료문자 중에서 랜덤 숫자를 발생시킨다.
+ randomInt = rnd.nextInt(endInt + 1);
+ } while (randomInt < startInt); // 입력받은 문자 'A'(65)보다 작으면 다시 랜덤 숫자 발생.
+
+ // 랜덤 숫자를 문자로 변환 후 스트링으로 다시 변환
+ randomStr = (char) randomInt + "";
+
+ // 랜덤문자열를 리턴
+ return randomStr;
+ }
+
+ /**
+ * 문자열을 다양한 문자셋(EUC-KR[KSC5601],UTF-8..)을 사용하여 인코딩하는 기능 역으로 디코딩하여 원래의 문자열을
+ * 복원하는 기능을 제공함 String temp = new String(문자열.getBytes("바꾸기전 인코딩"),"바꿀 인코딩");
+ * String temp = new String(문자열.getBytes("8859_1"),"KSC5601"); => UTF-8 에서
+ * EUC-KR
+ *
+ * @param srcString - 문자열
+ * @param srcCharsetNm - 원래 CharsetNm
+ * @param charsetNm - CharsetNm
+ * @return 인(디)코딩 문자열
+ * @exception MyException
+ * @see
+ */
+ public static String getEncdDcd(String srcString, String srcCharsetNm, String cnvrCharsetNm) {
+
+ String rtnStr = null;
+
+ if (srcString == null)
+ return null;
+
+ try {
+ rtnStr = new String(srcString.getBytes(srcCharsetNm), cnvrCharsetNm);
+ } catch (UnsupportedEncodingException e) {
+ rtnStr = null;
+ }
+
+ return rtnStr;
+ }
+
+ /**
+ * 특수문자를 웹 브라우저에서 정상적으로 보이기 위해 특수문자를 처리('<' -> & lT)하는 기능이다
+ * @param srcString - '<'
+ * @return 변환문자열('<' -> "<"
+ * @exception MyException
+ * @see
+ */
+ public static String getSpclStrCnvr(String srcString) {
+
+ String rtnStr = null;
+
+ StringBuffer strTxt = new StringBuffer("");
+
+ char chrBuff;
+ int len = srcString.length();
+
+ for (int i = 0; i < len; i++) {
+ chrBuff = (char) srcString.charAt(i);
+
+ switch (chrBuff) {
+ case '<':
+ strTxt.append("<");
+ break;
+ case '>':
+ strTxt.append(">");
+ break;
+ case '&':
+ strTxt.append("&");
+ break;
+ default:
+ strTxt.append(chrBuff);
+ }
+ }
+
+ rtnStr = strTxt.toString();
+
+ return rtnStr;
+ }
+
+ /**
+ * 응용어플리케이션에서 고유값을 사용하기 위해 시스템에서17자리의TIMESTAMP값을 구하는 기능
+ *
+ * @param
+ * @return Timestamp 값
+ * @exception MyException
+ * @see
+ */
+ public static String getTimeStamp() {
+
+ String rtnStr = null;
+
+ // 문자열로 변환하기 위한 패턴 설정(년도-월-일 시:분:초:초(자정이후 초))
+ String pattern = "yyyyMMddhhmmssSSS";
+
+ SimpleDateFormat sdfCurrent = new SimpleDateFormat(pattern, Locale.KOREA);
+ Timestamp ts = new Timestamp(System.currentTimeMillis());
+
+ rtnStr = sdfCurrent.format(ts.getTime());
+
+ return rtnStr;
+ }
+
+ /**
+ * html의 특수문자를 표현하기 위해
+ *
+ * @param srcString
+ * @return String
+ * @exception Exception
+ * @see
+ */
+ public static String getHtmlStrCnvr(String srcString) {
+
+ String tmpString = srcString;
+
+ tmpString = tmpString.replaceAll("<", "<");
+ tmpString = tmpString.replaceAll(">", ">");
+ tmpString = tmpString.replaceAll("&", "&");
+ tmpString = tmpString.replaceAll(" ", " ");
+ tmpString = tmpString.replaceAll("'", "\'");
+ tmpString = tmpString.replaceAll(""", "\"");
+
+ return tmpString;
+
+ }
+
+ /**
+ * 날짜 형식의 문자열 내부에 마이너스 character(-)를 추가한다.
+ *
+ *
+ * StringUtil.addMinusChar("20100901") = "2010-09-01"
+ *
+ *
+ * @param date 입력받는 문자열
+ * @return " - "가 추가된 입력문자열
+ */
+ public static String addMinusChar(String date) {
+ if (date.length() == 8) {
+ return date.substring(0, 4).concat("-").concat(date.substring(4, 6)).concat("-").concat(date.substring(6, 8));
+ } else {
+ return "";
+ }
+ }
+}
diff --git a/legacy/nlib/src/main/java/egovframework/com/utl/sim/service/EgovFileScrty.java b/legacy/nlib/src/main/java/egovframework/com/utl/sim/service/EgovFileScrty.java
new file mode 100644
index 00000000..56d9a0b1
--- /dev/null
+++ b/legacy/nlib/src/main/java/egovframework/com/utl/sim/service/EgovFileScrty.java
@@ -0,0 +1,288 @@
+/**
+ * Class Name : EgovFileScrty.java
+ * Description : Base64인코딩/디코딩 방식을 이용한 데이터를 암호화/복호화하는 Business Interface class
+ * Modification Information
+ *
+ * 수정일 수정자 수정내용
+ * ------- -------- ---------------------------
+ * 2009.02.04 박지욱 최초 생성
+ *
+ * @author 공통 서비스 개발팀 박지욱
+ * @since 2009. 02. 04
+ * @version 1.0
+ * @see
+ *
+ * Copyright (C) 2009 by MOPAS All right reserved.
+ */
+package egovframework.com.utl.sim.service;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStreamReader;
+import java.security.MessageDigest;
+
+import egovframework.com.cmm.util.EgovResourceCloseHelper;
+
+import org.apache.commons.codec.binary.Base64;
+
+public class EgovFileScrty {
+
+ // 파일구분자
+ static final char FILE_SEPARATOR = File.separatorChar;
+
+ static final int BUFFER_SIZE = 1024;
+
+ /**
+ * 파일을 암호화하는 기능
+ *
+ * @param String source 암호화할 파일
+ * @param String target 암호화된 파일
+ * @return boolean result 암호화여부 True/False
+ * @exception Exception
+ */
+ public static boolean encryptFile(String source, String target) throws Exception {
+
+ // 암호화 여부
+ boolean result = false;
+
+ String sourceFile = source.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR);
+ String targetFile = target.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR);
+ File srcFile = new File(sourceFile);
+
+ BufferedInputStream input = null;
+ BufferedOutputStream output = null;
+
+ byte[] buffer = new byte[BUFFER_SIZE];
+
+ try {
+ if (srcFile.exists() && srcFile.isFile()) {
+
+ input = new BufferedInputStream(new FileInputStream(srcFile));
+ output = new BufferedOutputStream(new FileOutputStream(targetFile));
+
+ int length = 0;
+ while ((length = input.read(buffer)) >= 0) {
+ byte[] data = new byte[length];
+ System.arraycopy(buffer, 0, data, 0, length);
+ output.write(encodeBinary(data).getBytes());
+ output.write(System.getProperty("line.separator").getBytes());
+ }
+ result = true;
+ }
+ } finally {
+ EgovResourceCloseHelper.close(input, output);
+ }
+
+ return result;
+ }
+
+ /**
+ * 파일을 복호화하는 기능
+ *
+ * @param String source 복호화할 파일
+ * @param String target 복호화된 파일
+ * @return boolean result 복호화여부 True/False
+ * @exception Exception
+ */
+ public static boolean decryptFile(String source, String target) throws Exception {
+
+ // 복호화 여부
+ boolean result = false;
+
+ String sourceFile = source.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR);
+ String targetFile = target.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR);
+ File srcFile = new File(sourceFile);
+
+ BufferedReader input = null;
+ BufferedOutputStream output = null;
+
+ //byte[] buffer = new byte[BUFFER_SIZE];
+ String line = null;
+
+ try {
+ if (srcFile.exists() && srcFile.isFile()) {
+
+ input = new BufferedReader(new InputStreamReader(new FileInputStream(srcFile)));
+ output = new BufferedOutputStream(new FileOutputStream(targetFile));
+
+ while ((line = input.readLine()) != null) {
+ byte[] data = line.getBytes();
+ output.write(decodeBinary(new String(data)));
+ }
+
+ result = true;
+ }
+ } finally {
+ EgovResourceCloseHelper.close(input, output);
+ }
+
+ return result;
+ }
+
+ /**
+ * 데이터를 암호화하는 기능
+ *
+ * @param byte[] data 암호화할 데이터
+ * @return String result 암호화된 데이터
+ * @exception Exception
+ */
+ public static String encodeBinary(byte[] data) throws Exception {
+ if (data == null) {
+ return "";
+ }
+
+ return new String(Base64.encodeBase64(data));
+ }
+
+ /**
+ * 데이터를 암호화하는 기능
+ *
+ * @param String data 암호화할 데이터
+ * @return String result 암호화된 데이터
+ * @exception Exception
+ */
+ @Deprecated
+ public static String encode(String data) throws Exception {
+ return encodeBinary(data.getBytes());
+ }
+
+ /**
+ * 데이터를 복호화하는 기능
+ *
+ * @param String data 복호화할 데이터
+ * @return String result 복호화된 데이터
+ * @exception Exception
+ */
+ public static byte[] decodeBinary(String data) throws Exception {
+ return Base64.decodeBase64(data.getBytes());
+ }
+
+ /**
+ * 데이터를 복호화하는 기능
+ *
+ * @param String data 복호화할 데이터
+ * @return String result 복호화된 데이터
+ * @exception Exception
+ */
+ @Deprecated
+ public static String decode(String data) throws Exception {
+ return new String(decodeBinary(data));
+ }
+
+ /**
+ * 비밀번호를 암호화하는 기능(복호화가 되면 안되므로 SHA-256 인코딩 방식 적용).
+ *
+ * deprecated : 보안 강화를 위하여 salt로 ID를 지정하는 encryptPassword(password, id) 사용
+ *
+ * @param String data 암호화할 비밀번호
+ * @return String result 암호화된 비밀번호
+ * @exception Exception
+ */
+ @Deprecated
+ public static String encryptPassword(String data) throws Exception {
+
+ if (data == null) {
+ return "";
+ }
+
+ byte[] plainText = null; // 평문
+ byte[] hashValue = null; // 해쉬값
+ plainText = data.getBytes();
+
+ MessageDigest md = MessageDigest.getInstance("SHA-256");
+
+ // 변경 시 기존 hash 값에 검증 불가.. => deprecated 시키고 유지
+ /*
+ // Random 방식의 salt 추가
+ SecureRandom ng = new SecureRandom();
+ byte[] randomBytes = new byte[16];
+ ng.nextBytes(randomBytes);
+
+ md.reset();
+ md.update(randomBytes);
+
+ */
+ hashValue = md.digest(plainText);
+
+ /*
+ BASE64Encoder encoder = new BASE64Encoder();
+ return encoder.encode(hashValue);
+ */
+ return new String(Base64.encodeBase64(hashValue));
+ }
+
+ /**
+ * 비밀번호를 암호화하는 기능(복호화가 되면 안되므로 SHA-256 인코딩 방식 적용)
+ *
+ * @param password 암호화될 패스워드
+ * @param id salt로 사용될 사용자 ID 지정
+ * @return
+ * @throws Exception
+ */
+ public static String encryptPassword(String password, String id) throws Exception {
+
+ if (password == null) return "";
+ if (id == null) return ""; // KISA 보안약점 조치 (2018-12-11, 신용호)
+
+ byte[] hashValue = null; // 해쉬값
+
+ MessageDigest md = MessageDigest.getInstance("SHA-256");
+
+ md.reset();
+ md.update(id.getBytes());
+
+ hashValue = md.digest(password.getBytes());
+
+ return new String(Base64.encodeBase64(hashValue));
+ }
+
+ /**
+ * 비밀번호를 암호화하는 기능(복호화가 되면 안되므로 SHA-256 인코딩 방식 적용)
+ * @param data 암호화할 비밀번호
+ * @param salt Salt
+ * @return 암호화된 비밀번호
+ * @throws Exception
+ */
+ public static String encryptPassword(String data, byte[] salt) throws Exception {
+
+ if (data == null) {
+ return "";
+ }
+
+ byte[] hashValue = null; // 해쉬값
+
+ MessageDigest md = MessageDigest.getInstance("SHA-256");
+
+ md.reset();
+ md.update(salt);
+
+ hashValue = md.digest(data.getBytes());
+
+ return new String(Base64.encodeBase64(hashValue));
+ }
+
+ /**
+ * 비밀번호를 암호화된 패스워드 검증(salt가 사용된 경우만 적용).
+ *
+ * @param data 원 패스워드
+ * @param encoded 해쉬처리된 패스워드(Base64 인코딩)
+ * @return
+ * @throws Exception
+ */
+ public static boolean checkPassword(String data, String encoded, byte[] salt) throws Exception {
+ byte[] hashValue = null; // 해쉬값
+
+ MessageDigest md = MessageDigest.getInstance("SHA-256");
+
+ md.reset();
+ md.update(salt);
+ hashValue = md.digest(data.getBytes());
+
+ return MessageDigest.isEqual(hashValue, Base64.decodeBase64(encoded.getBytes()));
+ }
+
+}
\ No newline at end of file
diff --git a/legacy/nlib/src/main/java/nlib/bbs/service/ArticleVO.java b/legacy/nlib/src/main/java/nlib/bbs/service/ArticleVO.java
new file mode 100644
index 00000000..dd82b9f7
--- /dev/null
+++ b/legacy/nlib/src/main/java/nlib/bbs/service/ArticleVO.java
@@ -0,0 +1,395 @@
+package nlib.bbs.service;
+
+import java.util.List;
+import org.apache.commons.lang.StringEscapeUtils;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import nlib.cmm.service.PagingVO;
+import nlib.util.StringUtil;
+
+/**
+ *
+ * @Class Name : ArticleVO.java
+ *
+ * @Description : 게시물 공통 VO
+ *
+ *
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ *
+ *
+ * @ ------------ -------- ---------------------------
+ * @ 수정일 수정자 수정내용
+ * @ ------------ -------- ---------------------------
+ * @ 2021. 09. 13. KNKIM 최초 생성
+ *
+ *
+ * @author 이씨플라자 * DIGITALSHIP KNKIM
+ * @since 2021. 09. 13.
+ * @version 1.0
+ *
+ */
+public class ArticleVO extends PagingVO {
+
+ private String articleId; /* 게시글ID */
+ private String mngOrgCd; /* 관리문화원코드 */
+ private String mngOrgNm; /* 관리문화원명 */
+ @JsonIgnore
+ private String bdType; /* 게시판유형 */
+ @JsonIgnore
+ private String bdTypeName; /* 게시판유형명 */
+ private String title; /* 제목 */
+ private String content; /* 내용 */
+
+ // 공지사항관련
+ private String notiYn; /* 공지여부 */
+ private String openYn; /* 공개여부 */
+ @JsonIgnore
+ private String postStartDate; /* 게시시작일자 */
+ @JsonIgnore
+ private String postEndDate; /* 게시종료일자 */
+
+ // FAQ, QNA관련
+ private String answer; /* 답변 */
+ private String answerYn; /* 답변여부 */
+ @JsonIgnore
+ private String useYn; /* 사용여부 */
+ private String questionType; /* 질문유형 */
+ private String questionTypeName; /* 질문유형명 */
+ private String secretYn; /* 비밀글여부 */
+ private String emailRecvYn; /* 답변이미엘수신여부 */
+ private String email; /* 이메일 */
+ private int viewCnt; /* 조회수 */
+ private String bdAttachFileId; /* 첨부파일아이디 */
+ private String attachYn; /* 첨부파일존재여부 */
+ private List attachFiles; /* 첨부파일목록 */
+ private List removedAttachFiles; /* 삭제첨부파일목록 */
+
+ @JsonIgnore
+ private String regId; /* 등록자아이디 */
+ private String regNm; /* 등록자명 */
+ private String regDd; /* 등록일자 */
+ @JsonIgnore
+ private String modId; /* 등록자아이디 */
+ private String modDd; /* 등록일자 */
+ private int rno; /* 글번호 */
+ @JsonIgnore
+ private String loginedMbInfoId; /* 로그인 사용자 ID */
+ private String loginedName; /* 로그인 사용자명 */
+ private String myQnaYn; /* 내가한 질문인지 여부 */
+
+ // 검색관련
+ private String searchType; /* 검색대상구분 */
+ private String searchKeyword; /* 검색어 */
+ private String searchQuestionType; /* 검색FAQ유형 */
+ @JsonIgnore
+ private String searchMbInfoId; /* 로그인한 사용자ID */
+
+ // 처리결과 관련
+ private String resultMessage = null; /* 처리결과메시지 */
+ private String resultCode = null; /* 처리결과코드 */
+
+ public int getAttachFileCnt() {
+ if(attachFiles == null) return 0;
+ return attachFiles.size();
+ }
+
+ public String getSanitizedContent() {
+ return StringUtil.sanitizeHtml(content);
+ }
+
+ // SETTER & GETTER
+ public String getArticleId() {
+ return articleId;
+ }
+ public void setArticleId(String articleId) {
+ // 쿼리 조건으로 사용되는 항목에 대하여 SQL 인젝션으로 처리될만한 문자 강체 치환 처리
+ this.articleId = StringUtil.getValidCodeString(articleId);
+ }
+ public String getMngOrgCd() {
+ return mngOrgCd;
+ }
+ public void setMngOrgCd(String mngOrgCd) {
+ // 쿼리 조건으로 사용되는 항목에 대하여 SQL 인젝션으로 처리될만한 문자 강체 치환 처리
+ this.mngOrgCd = StringUtil.getValidCodeString(mngOrgCd);
+ }
+ public String getBdType() {
+ return bdType;
+ }
+ public void setBdType(String bdType) {
+ this.bdType = bdType;
+ }
+ public String getUnescapeTitle() {
+ return StringEscapeUtils.unescapeHtml(title);
+ }
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+
+ /*
+ * 통합자료관관리시스템과 동일하게 게시글 저장 처리를 수행하며,
+ * 제목의 경우, DB에 일부 특수문자에 대하여 치환되어 저장되고,
+ * 내용의 경우, HTML 요청된 그대로 저장하되 표출할 때 HTML Sanitizing하여 표출토록 처리하기로 협의됨에 따라
+ * 제목 설정시 치환되어 저장토록 함 (2021.12.21, 이규모차장님)
+ */
+ this.title = StringUtil.getRemovedQuotesStr(title);
+ }
+ public String getContent() {
+ return content;
+ }
+ public void setContent(String content) {
+ this.content = content;
+ }
+ public String getNotiYn() {
+ return notiYn;
+ }
+ public void setNotiYn(String notiYn) {
+ this.notiYn = notiYn;
+ }
+ public String getOpenYn() {
+ return openYn;
+ }
+ public void setOpenYn(String openYn) {
+ this.openYn = openYn;
+ }
+ public String getPostStartDate() {
+ return postStartDate;
+ }
+ public void setPostStartDate(String postStartDate) {
+ this.postStartDate = postStartDate;
+ }
+ public String getPostEndDate() {
+ return postEndDate;
+ }
+ public void setPostEndDate(String postEndDate) {
+ this.postEndDate = postEndDate;
+ }
+ public int getViewCnt() {
+ return viewCnt;
+ }
+ public void setViewCnt(int viewCnt) {
+ this.viewCnt = viewCnt;
+ }
+ public String getBdAttachFileId() {
+ return bdAttachFileId;
+ }
+ public void setBdAttachFileId(String bdAttachFileId) {
+ this.bdAttachFileId = bdAttachFileId;
+ }
+ public String getRegId() {
+ return regId;
+ }
+ public void setRegId(String regId) {
+ this.regId = regId;
+ }
+ public String getRegDd() {
+ return regDd;
+ }
+ public void setRegDd(String regDd) {
+ this.regDd = regDd;
+ }
+ public String getModId() {
+ return modId;
+ }
+ public void setModId(String modId) {
+ this.modId = modId;
+ }
+ public String getModDd() {
+ return modDd;
+ }
+ public void setModDd(String modDd) {
+ this.modDd = modDd;
+ }
+ public String getRegNm() {
+ return regNm;
+ }
+ public String getRegNmSec() {
+ if(StringUtil.isEmpty(regNm)) return null;
+ return StringUtil.maskName(regNm);
+ }
+ public void setRegNm(String regNm) {
+ this.regNm = regNm;
+ }
+ public int getRno() {
+ return rno;
+ }
+ public void setRno(int rno) {
+ this.rno = rno;
+ }
+ public String getSearchType() {
+ return searchType;
+ }
+ public void setSearchType(String searchType) {
+ this.searchType = searchType;
+ }
+ public String getSearchKeyword() {
+ return searchKeyword;
+ }
+ public String getEscapeSearchKeyword() {
+ return StringUtil.getSqlSearchKeyword(searchKeyword);
+ }
+ public void setSearchKeyword(String searchKeyword) {
+ this.searchKeyword = searchKeyword;
+ }
+ public String getAttachYn() {
+ return attachYn;
+ }
+ public void setAttachYn(String attachYn) {
+ this.attachYn = attachYn;
+ }
+ public String getMngOrgNm() {
+ return mngOrgNm;
+ }
+ public void setMngOrgNm(String mngOrgNm) {
+ this.mngOrgNm = mngOrgNm;
+ }
+ public String getBdTypeName() {
+ return bdTypeName;
+ }
+ public void setBdTypeName(String bdTypeName) {
+ this.bdTypeName = bdTypeName;
+ }
+ public List getAttachFiles() {
+ return attachFiles;
+ }
+ public void setAttachFiles(List attachFiles) {
+ if(attachFiles == null || attachFiles.size() < 1) this.attachFiles = null;
+ this.attachFiles = attachFiles;
+ }
+
+ public String getAnswerYn() {
+ return StringUtil.isEmpty(answerYn) ? "N" : answerYn;
+ }
+
+ public void setAnswerYn(String answerYn) {
+ this.answerYn = answerYn;
+ }
+
+ public String getUseYn() {
+ return useYn;
+ }
+
+ public void setUseYn(String useYn) {
+ this.useYn = useYn;
+ }
+
+ public String getQuestionType() {
+ return questionType;
+ }
+
+ public void setQuestionType(String questionType) {
+ this.questionType = questionType;
+ }
+
+ public String getQuestionTypeName() {
+ return questionTypeName;
+ }
+
+ public void setQuestionTypeName(String questionTypeName) {
+ this.questionTypeName = questionTypeName;
+ }
+
+ public String getAnswer() {
+ return answer;
+ }
+
+ public String getSanitizedAnswer() {
+ return StringUtil.sanitizeHtml(answer);
+ }
+
+ public void setAnswer(String answer) {
+ this.answer = answer;
+ }
+
+ public String getSearchQuestionType() {
+ return searchQuestionType;
+ }
+
+ public void setSearchQuestionType(String searchQuestionType) {
+ this.searchQuestionType = searchQuestionType;
+ }
+
+ public String getSearchMbInfoId() {
+ return searchMbInfoId;
+ }
+
+ public void setSearchMbInfoId(String searchMbInfoId) {
+ // 쿼리 조건으로 사용되는 항목에 대하여 SQL 인젝션으로 처리될만한 문자 강체 치환 처리
+ this.searchMbInfoId = StringUtil.getValidCodeString(searchMbInfoId);
+ }
+
+ public String getSecretYn() {
+ return secretYn;
+ }
+
+ public void setSecretYn(String secretYn) {
+ this.secretYn = secretYn;
+ }
+
+ public String getLoginedMbInfoId() {
+ return loginedMbInfoId;
+ }
+
+ public void setLoginedMbInfoId(String loginedMbInfoId) {
+ // 쿼리 조건으로 사용되는 항목에 대하여 SQL 인젝션으로 처리될만한 문자 강체 치환 처리
+ this.loginedMbInfoId = StringUtil.getValidCodeString(loginedMbInfoId);
+ }
+
+ public String getMyQnaYn() {
+ return StringUtil.isEmpty(myQnaYn) ? "N" : myQnaYn;
+ }
+
+ public void setMyQnaYn(String myQnaYn) {
+ this.myQnaYn = myQnaYn;
+ }
+
+ public String getLoginedName() {
+ return loginedName;
+ }
+
+ public void setLoginedName(String loginedName) {
+ this.loginedName = loginedName;
+ }
+
+ public String getEmailRecvYn() {
+ return StringUtil.isEmpty(emailRecvYn) ? "N" : emailRecvYn;
+ }
+
+ public void setEmailRecvYn(String emailRecvYn) {
+ this.emailRecvYn = emailRecvYn;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getResultMessage() {
+ return resultMessage;
+ }
+
+ public void setResultMessage(String resultMessage) {
+ this.resultMessage = resultMessage;
+ }
+
+ public String getResultCode() {
+ return resultCode;
+ }
+
+ public void setResultCode(String resultCode) {
+ this.resultCode = resultCode;
+ }
+
+ public List getRemovedAttachFiles() {
+ return removedAttachFiles;
+ }
+
+ public void setRemovedAttachFiles(List removedAttachFiles) {
+ this.removedAttachFiles = removedAttachFiles;
+ }
+
+}
diff --git a/legacy/nlib/src/main/java/nlib/bbs/service/AttachFileService.java b/legacy/nlib/src/main/java/nlib/bbs/service/AttachFileService.java
new file mode 100644
index 00000000..643a5501
--- /dev/null
+++ b/legacy/nlib/src/main/java/nlib/bbs/service/AttachFileService.java
@@ -0,0 +1,109 @@
+
+package nlib.bbs.service;
+
+import java.util.List;
+
+/**
+ *
+ * @Class Name : AttachFileService.java
+ *
+ * @Description : 첨부파일을 관리하는 서비스 인터페이스
+ *
+ *
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ *
+ *
+ * @ ------------ -------- ---------------------------
+ * @ 수정일 수정자 수정내용
+ * @ ------------ -------- ---------------------------
+ * @ 2021. 9. 16. KNKIM 최초 생성
+ *
+ *
+ * @author 이씨플라자 * DIGITALSHIP KNKIM
+ * @since 2021. 9. 16.
+ * @version 1.0
+ *
+ */
+public interface AttachFileService
+{
+
+ /**
+ * 첨부파일 개수를 조회한다.
+ *
+ * @param attachFileId
+ * @return
+ * @throws Exception
+ */
+ public int countAttachFiles(String attachFileId) throws Exception;
+
+ /**
+ * 첨부파일 목록을 조회한다.
+ *
+ * @param attachFileId
+ * @return
+ * @throws Exception
+ */
+ public List listAttachFiles(String attachFileId) throws Exception;
+
+
+ /**
+ * 첨부파일그룹 등록한다.
+ *
+ * @param attachFileVO
+ * @return
+ * @throws Exception
+ */
+ public int insertAttachFileGroup(AttachFileVO attachFileVO) throws Exception;
+
+
+ /**
+ * 첨부파일 등록한다.
+ *
+ * @param attachFileVO
+ * @return
+ * @throws Exception
+ */
+ public int insertAttachFile(AttachFileVO attachFileVO) throws Exception;
+
+
+ /**
+ * 첨부파일그룹을 삭제한다.
+ *
+ * @param attachFileVO
+ * @return
+ * @throws Exception
+ */
+ public int deleteAttachFileGroup(String attachFileId) throws Exception;
+
+ /**
+ * 첨부파일 삭제한다.
+ *
+ * @param attachFileVO
+ * @return
+ * @throws Exception
+ */
+ public int deleteAttachFile(AttachFileVO attachFileVO) throws Exception;
+
+
+ /**
+ * 첨부파일 정보를 조회한다.
+ *
+ * @param attachFileVO
+ * @return
+ * @throws Exception
+ */
+ public AttachFileVO selectAttachFile(AttachFileVO attachFileVO) throws Exception;
+
+
+ /**
+ * 다운로드 가능 여부를 확인하다.
+ *
+ * @param attachFileVO
+ * @return
+ * @throws Exception
+ */
+ public boolean checkAttachFileDownload(AttachFileVO attachFileVO) throws Exception;
+
+}
+
diff --git a/legacy/nlib/src/main/java/nlib/bbs/service/AttachFileVO.java b/legacy/nlib/src/main/java/nlib/bbs/service/AttachFileVO.java
new file mode 100644
index 00000000..4c662d23
--- /dev/null
+++ b/legacy/nlib/src/main/java/nlib/bbs/service/AttachFileVO.java
@@ -0,0 +1,111 @@
+package nlib.bbs.service;
+
+/**
+ *
+ * @Class Name : AttachFileVO.java
+ *
+ * @Description : 첨부파일 정보 VO
+ *
+ *
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ *
+ *
+ * @ ------------ -------- ---------------------------
+ * @ 수정일 수정자 수정내용
+ * @ ------------ -------- ---------------------------
+ * @ 2021. 9. 14. KNKIM 최초 생성
+ * @ 2021.11. 24. KNKIM DB컬럼명 수정에 따른 변경 처리 (FILE_STRE_COURS -> FILE_STRE_PATH, FILE_EXTSN -> FILE_EXT)
+ *
+ *
+ * @author 이씨플라자 * DIGITALSHIP KNKIM
+ * @since 2021. 9. 14.
+ * @version 1.0
+ *
+ */
+public class AttachFileVO {
+
+ private String bdType; /* 첨부된 게시판 유형 : ancmnt, faq, qna */
+ private String mbInfoId; /* 사용자ID (권한체크 등에 사용) */
+
+ private String subPathKey; /* 첨부파일서브경로 */
+
+ private String attachFileId; /* 첨부파일아이디 */
+ private int fileSn; /* 파일 순번 */
+ private String fileStrePath; /* 파일 저장결올 */
+ private String streFileNm; /* 저장파일명 */
+ private String orignlFileNm; /* 원본파일명 */
+ private String fileExt; /* 파일확장자 */
+ private int fileSize; /* 파일 사이즈 */
+ private String useAt; /* 사용영부 */
+
+
+ // GET/SET
+ public String getSubPathKey() {
+ return subPathKey;
+ }
+ public void setSubPathKey(String subPathKey) {
+ this.subPathKey = subPathKey;
+ }
+ public String getAttachFileId() {
+ return attachFileId;
+ }
+ public void setAttachFileId(String attachFileId) {
+ this.attachFileId = attachFileId;
+ }
+ public int getFileSn() {
+ return fileSn;
+ }
+ public void setFileSn(int fileSn) {
+ this.fileSn = fileSn;
+ }
+ public String getFileStrePath() {
+ return fileStrePath;
+ }
+ public void setFileStrePath(String fileStrePath) {
+ this.fileStrePath = fileStrePath;
+ }
+ public String getStreFileNm() {
+ return streFileNm;
+ }
+ public void setStreFileNm(String streFileNm) {
+ this.streFileNm = streFileNm;
+ }
+ public String getOrignlFileNm() {
+ return orignlFileNm;
+ }
+ public void setOrignlFileNm(String orignlFileNm) {
+ this.orignlFileNm = orignlFileNm;
+ }
+ public String getFileExt() {
+ return fileExt;
+ }
+ public void setFileExt(String fileExt) {
+ this.fileExt = (fileExt == null ? null : fileExt.toLowerCase());
+ }
+ public int getFileSize() {
+ return fileSize;
+ }
+ public void setFileSize(int fileSize) {
+ this.fileSize = fileSize;
+ }
+ public String getUseAt() {
+ return useAt;
+ }
+ public void setUseAt(String useAt) {
+ this.useAt = useAt;
+ }
+ public String getMbInfoId() {
+ return mbInfoId;
+ }
+ public void setMbInfoId(String mbInfoId) {
+ this.mbInfoId = mbInfoId;
+ }
+ public String getBdType() {
+ return bdType;
+ }
+ public void setBdType(String bdType) {
+ this.bdType = bdType;
+ }
+
+}
diff --git a/legacy/nlib/src/main/java/nlib/bbs/service/BoardService.java b/legacy/nlib/src/main/java/nlib/bbs/service/BoardService.java
new file mode 100644
index 00000000..837bb604
--- /dev/null
+++ b/legacy/nlib/src/main/java/nlib/bbs/service/BoardService.java
@@ -0,0 +1,61 @@
+
+package nlib.bbs.service;
+
+import java.util.List;
+
+/**
+ *
+ * @Class Name : BoardService.java
+ *
+ * @Description : 게시물 관련 공통 서비스 인터페이스
+ *
+ *
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ *
+ *
+ * @ ------------ -------- ---------------------------
+ * @ 수정일 수정자 수정내용
+ * @ ------------ -------- ---------------------------
+ * @ 2021. 07. 1. KNKIM 최초 생성
+ *
+ *
+ * @author 이씨플라자 * DIGITALSHIP KNKIM
+ * @since 2021. 07. 1.
+ * @version 1.0
+ *
+ */
+public interface BoardService
+{
+
+ /**
+ * 게시글 목록을 조회한다.
+ */
+ public List listArticles(ArticleVO ArticleVO) throws Exception;
+
+
+ /**
+ * 게시글 건수를 조회한다.
+ */
+ public int countArticles(ArticleVO articleVO) throws Exception;
+
+ /**
+ * 조회수를 증가시킨다.
+ *
+ * @param
+ * @return
+ * @throws Exception
+ */
+ public int updateRead(ArticleVO articleVO) throws Exception;
+
+ /**
+ * 게시글 상세 내용을 조회한다.
+ *
+ * @param
+ * @return
+ * @throws Exception
+ */
+ public ArticleVO selectArticle(ArticleVO articleVO) throws Exception;
+
+}
+
diff --git a/legacy/nlib/src/main/java/nlib/bbs/service/QnaService.java b/legacy/nlib/src/main/java/nlib/bbs/service/QnaService.java
new file mode 100644
index 00000000..e1c2d2ec
--- /dev/null
+++ b/legacy/nlib/src/main/java/nlib/bbs/service/QnaService.java
@@ -0,0 +1,91 @@
+
+package nlib.bbs.service;
+
+/**
+ *
+ * @Class Name : QnaService.java
+ *
+ * @Description : 공통 게시물관리 서비스를 상속받아 Q&A 추가 기능을 명시한 서비스 인터페이스
+ *
+ *
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ *
+ *
+ * @ ------------ -------- ---------------------------
+ * @ 수정일 수정자 수정내용
+ * @ ------------ -------- ---------------------------
+ * @ 2021. 09. 29. KNKIM 최초 생성
+ *
+ *
+ * @author 이씨플라자 * DIGITALSHIP KNKIM
+ * @since 2021. 09. 29.
+ * @version 1.0
+ *
+ */
+public interface QnaService extends BoardService
+{
+
+ /**
+ * 공통적인 게시판 목록, 조회관련한 맴버함수는 BoardService 에서 상속하고,
+ * QnaService에 추가된 멤버함순만 추가 정의 한다.
+ *
+ */
+
+ /**
+ * 게시글을 등록한다.
+ *
+ * @param
+ * @return
+ * @throws Exception
+ */
+ public ArticleVO insertArticle(ArticleVO articleVO) throws Exception;
+
+ /**
+ * 게시글을 수정한다.
+ *
+ * @param
+ * @return
+ * @throws Exception
+ */
+ public int updateArticle(ArticleVO articleVO) throws Exception;
+
+ /**
+ * 게시글을 삭제한다.
+ *
+ * @param
+ * @return
+ * @throws Exception
+ */
+ public int deleteArticle(ArticleVO articleVO) throws Exception;
+
+
+ /**
+ * 해당 QNA 글을 변경할 수 있는지 여부를 확인한다.
+ *
+ * @param articleVO
+ * @return
+ * @throws Exception
+ */
+ public String canModify(ArticleVO articleVO) throws Exception;
+
+ /**
+ * 해당 QNA 글을 변경할 수 있는지 여부를 확인한다.
+ *
+ * @param articleVO
+ * @return
+ * @throws Exception
+ */
+ public String canModify(ArticleVO articleVO, String mbInfoId) throws Exception;
+
+ /**
+ * 해당 QNA 글을 읽을 수 있는지 여부를 확인한다.
+ *
+ * @param articleVO
+ * @return
+ * @throws Exception
+ */
+ public String canRead(ArticleVO articleVO) throws Exception;
+
+}
+
diff --git a/legacy/nlib/src/main/java/nlib/bbs/service/impl/AncmntDAO.java b/legacy/nlib/src/main/java/nlib/bbs/service/impl/AncmntDAO.java
new file mode 100644
index 00000000..38dc7468
--- /dev/null
+++ b/legacy/nlib/src/main/java/nlib/bbs/service/impl/AncmntDAO.java
@@ -0,0 +1,34 @@
+package nlib.bbs.service.impl;
+
+import egovframework.rte.psl.dataaccess.mapper.Mapper;
+
+/**
+ *
+ * @Class Name : AncmntDAO.java
+ *
+ * @Description : 공지사항 정보 제공 DAO
+ *
+ *
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ *
+ *
+ * @ ------------ -------- ---------------------------
+ * @ 수정일 수정자 수정내용
+ * @ ------------ -------- ---------------------------
+ * @ 2021. 9. 13. KNKIM 최초 생성
+ *
+ *
+ * @author 이씨플라자 * DIGITALSHIP KNKIM
+ * @since 2021. 9. 13.
+ * @version 1.0
+ *
+ */
+@Mapper("ancmntDAO")
+public interface AncmntDAO extends BoardDAO {
+
+ /*
+ * BoardDAO 상속 내용과 동일
+ */
+
+}
diff --git a/legacy/nlib/src/main/java/nlib/bbs/service/impl/AncmntServiceImpl.java b/legacy/nlib/src/main/java/nlib/bbs/service/impl/AncmntServiceImpl.java
new file mode 100644
index 00000000..3382f97c
--- /dev/null
+++ b/legacy/nlib/src/main/java/nlib/bbs/service/impl/AncmntServiceImpl.java
@@ -0,0 +1,43 @@
+package nlib.bbs.service.impl;
+
+import javax.annotation.Resource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * @Class Name : AncmntServiceImpl.java
+ *
+ * @Description : 공지사항 서비스 구현
+ *
+ *
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ *
+ *
+ * @ ------------ -------- ---------------------------
+ * @ 수정일 수정자 수정내용
+ * @ ------------ -------- ---------------------------
+ * @ 2021. 09. 13. KNKIM 최초 생성
+ *
+ *
+ * @author 이씨플라자 * DIGITALSHIP KNKIM
+ * @since 2021. 09. 13.
+ * @version 1.0
+ *
+ */
+@Service("ancmntService")
+public class AncmntServiceImpl extends BoardServiceImpl
+{
+ static Logger log = LoggerFactory.getLogger(AncmntServiceImpl.class);
+
+ @Resource(name="ancmntDAO")
+ AncmntDAO ancmntDAO;
+
+ @Override
+ public BoardDAO getBoardDAO() {
+ return ancmntDAO;
+ }
+
+}
\ No newline at end of file
diff --git a/legacy/nlib/src/main/java/nlib/bbs/service/impl/AttachFileDAO.java b/legacy/nlib/src/main/java/nlib/bbs/service/impl/AttachFileDAO.java
new file mode 100644
index 00000000..6d6271c8
--- /dev/null
+++ b/legacy/nlib/src/main/java/nlib/bbs/service/impl/AttachFileDAO.java
@@ -0,0 +1,115 @@
+package nlib.bbs.service.impl;
+
+import java.util.List;
+import egovframework.rte.psl.dataaccess.mapper.Mapper;
+import nlib.bbs.service.AttachFileVO;
+
+/**
+ *
+ * @Class Name : AttachFileDAO.java
+ *
+ * @Description : 게시판 첨부파일 관리 DAO
+ *
+ *
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ *
+ *
+ * @ ------------ -------- ---------------------------
+ * @ 수정일 수정자 수정내용
+ * @ ------------ -------- ---------------------------
+ * @ 2021. 9. 16. KNKIM 최초 생성
+ *
+ *
+ * @author 이씨플라자 * DIGITALSHIP KNKIM
+ * @since 2021. 9. 16.
+ * @version 1.0
+ *
+ */
+@Mapper("attachFileDAO")
+public interface AttachFileDAO {
+
+
+ /**
+ * 첨부파일 개수를 조회한다.
+ *
+ * @param attachFileId
+ * @return
+ * @throws Exception
+ */
+ public int countAttachFiles(String attachFileId) throws Exception;
+
+ /**
+ * 첨부파일 목록을 조회한다.
+ *
+ * @param
+ * @return
+ * @throws Exception
+ */
+ public List listAttachFiles(String attachFileId) throws Exception;
+
+
+ /**
+ * 첨부파일그룹을 등록한다.
+ *
+ * @param
+ * @return
+ * @throws Exception
+ */
+ public int insertAttachFileGroup(AttachFileVO attachFileVO) throws Exception;
+
+
+ /**
+ * 첨부파일 등록한다.
+ *
+ * @param
+ * @return
+ * @throws Exception
+ */
+ public int insertAttachFile(AttachFileVO attachFileVO) throws Exception;
+
+ /**
+ * 첨부파일그룹을 삭제한다.
+ *
+ * @param
+ * @return
+ * @throws Exception
+ */
+ public int deleteAttachFileGroup(String attachFileId) throws Exception;
+
+ /**
+ * 첨부파일그룹에 속한 모든 파일을 삭제한다.
+ *
+ * @param attachFileVO
+ * @return
+ * @throws Exception
+ */
+ public int deleteAllFilesOfAttachFileGroup(String attachFileId) throws Exception;
+
+ /**
+ * 첨부파일 삭제한다.
+ *
+ * @param
+ * @return
+ * @throws Exception
+ */
+ public int deleteAttachFile(AttachFileVO attachFileVO) throws Exception;
+
+ /**
+ * 첨부파일 정보를 조회한다.
+ *
+ * @param attachFileVO
+ * @return
+ * @throws Exception
+ */
+ public AttachFileVO selectAttachFile(AttachFileVO attachFileVO) throws Exception;
+
+ /**
+ * 다운로드 가능 여부를 확인하다.
+ *
+ * @param attachFileVO
+ * @return
+ * @throws Exception
+ */
+ public String checkAttachFileDownload(AttachFileVO attachFileVO) throws Exception;
+}
diff --git a/legacy/nlib/src/main/java/nlib/bbs/service/impl/AttachFileServiceImpl.java b/legacy/nlib/src/main/java/nlib/bbs/service/impl/AttachFileServiceImpl.java
new file mode 100644
index 00000000..ac3ca0d8
--- /dev/null
+++ b/legacy/nlib/src/main/java/nlib/bbs/service/impl/AttachFileServiceImpl.java
@@ -0,0 +1,158 @@
+package nlib.bbs.service.impl;
+
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import nlib.bbs.service.AttachFileService;
+import nlib.bbs.service.AttachFileVO;
+import nlib.bbs.service.QnaService;
+import nlib.util.StringUtil;
+
+/**
+ *
+ * @Class Name : AttachFileServiceImpl.java
+ *
+ * @Description : 첨부파일을 관리하는 서비스 클래스
+ *
+ *
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ *
+ *
+ * @ ------------ -------- ---------------------------
+ * @ 수정일 수정자 수정내용
+ * @ ------------ -------- ---------------------------
+ * @ 2021. 9. 16. KNKIM 최초 생성
+ *
+ *
+ * @author 이씨플라자 * DIGITALSHIP KNKIM
+ * @since 2021. 9. 16.
+ * @version 1.0
+ *
+ */
+@Service("attachFileService")
+public class AttachFileServiceImpl implements AttachFileService
+{
+ static Logger log = LoggerFactory.getLogger(AttachFileServiceImpl.class);
+
+ @Resource(name="attachFileDAO")
+ AttachFileDAO attachFileDAO;
+
+ @Resource(name = "qnaService")
+ private QnaService qnaService;
+
+
+ /**
+ * 첨부파일 개수를 조회한다.
+ *
+ * @param attachFileId
+ * @return
+ * @throws Exception
+ */
+ public int countAttachFiles(String attachFileId) throws Exception {
+ return attachFileDAO.countAttachFiles(attachFileId);
+ }
+
+ /**
+ * 첨부파일 목록을 조회한다.
+ *
+ * @param
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public List listAttachFiles(String attachFileId) throws Exception {
+ return attachFileDAO.listAttachFiles(attachFileId);
+ }
+
+ /**
+ * 첨부파일그룹 등록한다.
+ *
+ * @param
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public int insertAttachFileGroup(AttachFileVO attachFileVO) throws Exception {
+ return attachFileDAO.insertAttachFileGroup(attachFileVO);
+ }
+
+ /**
+ * 첨부파일 등록한다.
+ *
+ * @param
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public int insertAttachFile(AttachFileVO attachFileVO) throws Exception {
+ return attachFileDAO.insertAttachFile(attachFileVO);
+ }
+
+ /**
+ * 첨부파일그룹을 삭제한다.
+ *
+ * @param
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public int deleteAttachFileGroup(String attachFileId) throws Exception {
+ int ret = attachFileDAO.deleteAttachFileGroup(attachFileId);
+ attachFileDAO.deleteAllFilesOfAttachFileGroup(attachFileId);
+ return ret;
+ }
+
+ /**
+ * 첨부파일 삭제한다.
+ *
+ * @param
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public int deleteAttachFile(AttachFileVO attachFileVO) throws Exception {
+ return attachFileDAO.deleteAttachFile(attachFileVO);
+ }
+
+
+
+ /**
+ * 첨부파일 정보를 조회한다.
+ *
+ * @param attachFileVO
+ * @return
+ * @throws Exception
+ */
+ public AttachFileVO selectAttachFile(AttachFileVO attachFileVO) throws Exception {
+
+ if(attachFileVO == null) return null;
+ if(StringUtil.isEmpty(attachFileVO.getAttachFileId())) return null;
+ if(attachFileVO.getFileSn() < 0) return null;
+
+ return attachFileDAO.selectAttachFile(attachFileVO);
+ }
+
+ /**
+ * 다운로드 가능 여부를 확인하다.
+ *
+ * @param attachFileVO
+ * @return
+ * @throws Exception
+ */
+ public boolean checkAttachFileDownload(AttachFileVO attachFileVO) throws Exception {
+
+ String bdType = attachFileVO.getBdType();
+ if(StringUtil.isEmpty(bdType)) return false;
+
+ String ret = "Y";
+ ret = attachFileDAO.checkAttachFileDownload(attachFileVO);
+
+ return StringUtil.isEmpty(ret) ? false : (ret.charAt(0) == 'Y');
+ }
+}
\ No newline at end of file
diff --git a/legacy/nlib/src/main/java/nlib/bbs/service/impl/BoardDAO.java b/legacy/nlib/src/main/java/nlib/bbs/service/impl/BoardDAO.java
new file mode 100644
index 00000000..159e12b9
--- /dev/null
+++ b/legacy/nlib/src/main/java/nlib/bbs/service/impl/BoardDAO.java
@@ -0,0 +1,59 @@
+package nlib.bbs.service.impl;
+
+import java.util.List;
+import nlib.bbs.service.ArticleVO;
+
+/**
+ *
+ * @Class Name : BoardDAO.java
+ *
+ * @Description : 공지사항 정보 제공 DAO
+ *
+ *
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ *
+ *
+ * @ ------------ -------- ---------------------------
+ * @ 수정일 수정자 수정내용
+ * @ ------------ -------- ---------------------------
+ * @ 2021. 9. 13. KNKIM 최초 생성
+ *
+ *
+ * @author 이씨플라자 * DIGITALSHIP KNKIM
+ * @since 2021. 9. 13.
+ * @version 1.0
+ *
+ */
+
+public interface BoardDAO {
+
+ /*
+ * 게시글 목록을 조회한다.
+ */
+ public abstract List listArticles(ArticleVO ArticleVO) throws Exception;
+
+ /**
+ * 게시글 건수를 조회한다.
+ */
+ public abstract int countArticles(ArticleVO ArticleVO) throws Exception;
+
+ /**
+ * 조회수를 증가시킨다.
+ *
+ * @param
+ * @return
+ * @throws Exception
+ */
+ public abstract int updateRead(ArticleVO notiVO) throws Exception;
+
+ /**
+ * 게시글 상세 내용을 조회한다.
+ *
+ * @param
+ * @return
+ * @throws Exception
+ */
+ public abstract ArticleVO selectArticle(ArticleVO notiVO) throws Exception;
+
+}
diff --git a/legacy/nlib/src/main/java/nlib/bbs/service/impl/BoardServiceImpl.java b/legacy/nlib/src/main/java/nlib/bbs/service/impl/BoardServiceImpl.java
new file mode 100644
index 00000000..a12b8f56
--- /dev/null
+++ b/legacy/nlib/src/main/java/nlib/bbs/service/impl/BoardServiceImpl.java
@@ -0,0 +1,100 @@
+package nlib.bbs.service.impl;
+
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import nlib.bbs.service.ArticleVO;
+import nlib.bbs.service.AttachFileService;
+import nlib.bbs.service.AttachFileVO;
+import nlib.bbs.service.BoardService;
+import nlib.util.StringUtil;
+
+/**
+ *
+ * @Class Name : BoardServiceImpl.java
+ *
+ * @Description : 게시판 서비스 추상 클래스
+ *
+ *
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ *
+ *
+ * @ ------------ -------- ---------------------------
+ * @ 수정일 수정자 수정내용
+ * @ ------------ -------- ---------------------------
+ * @ 2021. 07. 01. KNKIM 최초 생성
+ *
+ *
+ * @author 이씨플라자 * DIGITALSHIP KNKIM
+ * @since 2021. 07. 01.
+ * @version 1.0
+ *
+ */
+public abstract class BoardServiceImpl implements BoardService
+{
+ static Logger log = LoggerFactory.getLogger(BoardServiceImpl.class);
+
+ @Resource(name="attachFileService")
+ AttachFileService attachFileService;
+
+ public abstract BoardDAO getBoardDAO();
+
+ /*
+ * 게시글 목록을 조회한다.
+ */
+ public List listArticles(ArticleVO articleVO) throws Exception {
+
+ return getBoardDAO().listArticles(articleVO);
+ }
+
+ /**
+ * 게시글 건수를 조회한다.
+ */
+ public int countArticles(ArticleVO articleVO) throws Exception {
+
+ return getBoardDAO().countArticles(articleVO);
+ }
+
+
+ /**
+ * 조회수를 증가시킨다.
+ *
+ * @param
+ * @return
+ * @throws Exception
+ */
+ public int updateRead(ArticleVO articleVO) throws Exception {
+ return getBoardDAO().updateRead(articleVO);
+ }
+
+ /**
+ * 게시글 상세 내용을 조회한다.
+ *
+ * @param
+ * @return
+ * @throws Exception
+ */
+ public ArticleVO selectArticle(ArticleVO articleVO) throws Exception {
+
+ if(StringUtil.isEmpty(articleVO.getArticleId())) return null;
+
+ // 게시글 조회
+ ArticleVO retVO = getBoardDAO().selectArticle(articleVO);
+ // 첨부파일 조회
+ if(StringUtil.isNotEmpty(retVO.getBdAttachFileId())) {
+ String attachFileId = retVO.getBdAttachFileId();
+ List listFile = attachFileService.listAttachFiles(attachFileId);
+ retVO.setAttachFiles(listFile);
+ }
+ // 조회수 증가
+ updateRead(articleVO);
+
+ return retVO;
+ }
+
+}
\ No newline at end of file
diff --git a/legacy/nlib/src/main/java/nlib/bbs/service/impl/FaqDAO.java b/legacy/nlib/src/main/java/nlib/bbs/service/impl/FaqDAO.java
new file mode 100644
index 00000000..4b3ce7ad
--- /dev/null
+++ b/legacy/nlib/src/main/java/nlib/bbs/service/impl/FaqDAO.java
@@ -0,0 +1,34 @@
+package nlib.bbs.service.impl;
+
+import egovframework.rte.psl.dataaccess.mapper.Mapper;
+
+/**
+ *
+ * @Class Name : FaqDAO.java
+ *
+ * @Description : FAQ DAO 클래스
+ *
+ *
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ *
+ *
+ * @ ------------ -------- ---------------------------
+ * @ 수정일 수정자 수정내용
+ * @ ------------ -------- ---------------------------
+ * @ 2021. 09. 15. KNKIM 최초 생성
+ *
+ *
+ * @author 이씨플라자 * DIGITALSHIP KNKIM
+ * @since 2021. 09. 15.
+ * @version 1.0
+ *
+ */
+@Mapper("faqDAO")
+public interface FaqDAO extends BoardDAO {
+
+ /*
+ * BoardDAO 상속 내용과 동일
+ */
+
+}
diff --git a/legacy/nlib/src/main/java/nlib/bbs/service/impl/FaqServiceImpl.java b/legacy/nlib/src/main/java/nlib/bbs/service/impl/FaqServiceImpl.java
new file mode 100644
index 00000000..7fe1a5e7
--- /dev/null
+++ b/legacy/nlib/src/main/java/nlib/bbs/service/impl/FaqServiceImpl.java
@@ -0,0 +1,44 @@
+package nlib.bbs.service.impl;
+
+import javax.annotation.Resource;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * @Class Name : FaqServiceImpl.java
+ *
+ * @Description : FAQ 서비스 구현
+ *
+ *
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ *
+ *
+ * @ ------------ -------- ---------------------------
+ * @ 수정일 수정자 수정내용
+ * @ ------------ -------- ---------------------------
+ * @ 2021. 09. 15. KNKIM 최초 생성
+ *
+ *
+ * @author 이씨플라자 * DIGITALSHIP KNKIM
+ * @since 2021. 09. 15.
+ * @version 1.0
+ *
+ */
+@Service("faqService")
+public class FaqServiceImpl extends BoardServiceImpl
+{
+ static Logger log = LoggerFactory.getLogger(FaqServiceImpl.class);
+
+ @Resource(name="faqDAO")
+ FaqDAO faqDAO;
+
+ @Override
+ public BoardDAO getBoardDAO() {
+ return faqDAO;
+ }
+
+}
\ No newline at end of file
diff --git a/legacy/nlib/src/main/java/nlib/bbs/service/impl/QnaDAO.java b/legacy/nlib/src/main/java/nlib/bbs/service/impl/QnaDAO.java
new file mode 100644
index 00000000..a5e1ffbe
--- /dev/null
+++ b/legacy/nlib/src/main/java/nlib/bbs/service/impl/QnaDAO.java
@@ -0,0 +1,60 @@
+package nlib.bbs.service.impl;
+
+import egovframework.rte.psl.dataaccess.mapper.Mapper;
+import nlib.bbs.service.ArticleVO;
+
+
+/**
+ *
+ * @Class Name : QnaDAO.java
+ *
+ * @Description : Q&A DAO 클래스
+ *
+ *
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ *
+ *
+ * @ ------------ -------- ---------------------------
+ * @ 수정일 수정자 수정내용
+ * @ ------------ -------- ---------------------------
+ * @ 2021. 09. 15. KNKIM 최초 생성
+ *
+ *
+ * @author 이씨플라자 * DIGITALSHIP KNKIM
+ * @since 2021. 09. 15.
+ * @version 1.0
+ *
+ */
+@Mapper("qnaDAO")
+public interface QnaDAO extends BoardDAO {
+
+ /*
+ * BoardDAO 상속 내용과 동일
+ */
+
+ /**
+ * Q&A 게시글을 등록한다.
+ *
+ * @param reqVO
+ * @return
+ */
+ public int insertArticle(ArticleVO articleVO);
+
+ /**
+ * Q&A 게시글을 수정한다.
+ *
+ * @param reqVO
+ * @return
+ */
+ public int updateArticle(ArticleVO articleVO);
+
+ /**
+ * Q&A 게시글을 삭제한다.
+ *
+ * @param reqVO
+ * @return
+ */
+ public int deleteArticle(ArticleVO articleVO);
+
+}
diff --git a/legacy/nlib/src/main/java/nlib/bbs/service/impl/QnaServiceImpl.java b/legacy/nlib/src/main/java/nlib/bbs/service/impl/QnaServiceImpl.java
new file mode 100644
index 00000000..170705bb
--- /dev/null
+++ b/legacy/nlib/src/main/java/nlib/bbs/service/impl/QnaServiceImpl.java
@@ -0,0 +1,270 @@
+package nlib.bbs.service.impl;
+
+import java.util.List;
+import javax.annotation.Resource;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import nlib.bbs.service.ArticleVO;
+import nlib.bbs.service.AttachFileService;
+import nlib.bbs.service.AttachFileVO;
+import nlib.bbs.service.QnaService;
+import nlib.cmm.service.NlibProperty;
+import nlib.util.StringUtil;
+import nlib.util.UUID;
+
+/**
+ *
+ * @Class Name : QnaServiceImpl.java
+ *
+ * @Description : Q&A 서비스 구현
+ *
+ *
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ *
+ *
+ * @ ------------ -------- ---------------------------
+ * @ 수정일 수정자 수정내용
+ * @ ------------ -------- ---------------------------
+ * @ 2021. 09. 15. KNKIM 최초 생성
+ *
+ *
+ * @author 이씨플라자 * DIGITALSHIP KNKIM
+ * @since 2021. 09. 15.
+ * @version 1.0
+ *
+ */
+@Service("qnaService")
+public class QnaServiceImpl extends BoardServiceImpl implements QnaService
+{
+ static Logger log = LoggerFactory.getLogger(QnaServiceImpl.class);
+
+ @Resource(name="qnaDAO")
+ QnaDAO qnaDAO;
+
+ @Resource(name="attachFileService")
+ AttachFileService attachFileService;
+
+ @Override
+ public BoardDAO getBoardDAO() {
+ return qnaDAO;
+ }
+
+
+ /**
+ * Q&A 게시글을 등록한다.
+ *
+ * @param reqVO
+ * @return
+ */
+ public ArticleVO insertArticle(ArticleVO articleVO) throws Exception {
+ articleVO.setArticleId(UUID.getNlibCommonID("NQ", 35));
+ int ret = qnaDAO.insertArticle(articleVO);
+
+ if(ret < 1) {
+ throw new Exception("등록에 실패하였습니다.");
+ }
+
+ articleVO.setResultCode("S001");
+
+ if(articleVO.getAttachFileCnt() > 0) {
+ addAttachFiles(articleVO);
+ }
+
+ articleVO.setResultMessage("정상적으로 등록되었습니다." + (StringUtil.isNotEmpty(articleVO.getResultMessage())? "\\\\n " + articleVO.getResultMessage() : ""));
+
+ return articleVO;
+ }
+
+ /**
+ * 첨부파일을 추가한다.
+ *
+ * @param articleVO
+ * @throws Exception
+ */
+ public void addAttachFiles(ArticleVO articleVO) throws Exception {
+ int savedCnt = 0;
+ List attachFileList = articleVO.getAttachFiles();
+
+ // 최대 개수
+ int maxFileCount = NlibProperty.getInt("fileupload.max.files", 5);
+
+ // 첨부파일그룹 등록
+ int groupCnt = attachFileService.insertAttachFileGroup(attachFileList.get(0));
+
+ if(groupCnt > 0) {
+
+ int curFileCount = attachFileService.countAttachFiles(articleVO.getBdAttachFileId());
+ int addingCount = maxFileCount - curFileCount;
+
+ // 첨부파일 등록
+ if(addingCount > 0) {
+ for(int i=0; i= addingCount) {
+ String message = "최대 허용 개수가 도달하여 등록을 중단합니다.";
+ log.error(message);
+ articleVO.setResultMessage(message);
+ break;
+ }
+
+ AttachFileVO attachFileVO = attachFileList.get(i);
+ int retAttFile = attachFileService.insertAttachFile(attachFileVO);
+ savedCnt += retAttFile;
+ if(retAttFile < 1) {
+ log.error("insertArticle > 첨부파일 등록에 실패하였습니다 : " + attachFileVO.getOrignlFileNm());
+ }
+ }
+ }
+
+ if(savedCnt != articleVO.getAttachFileCnt()) {
+ articleVO.setResultMessage("총 " + articleVO.getAttachFileCnt() + "개 파일 중 " + savedCnt + "개 파일만 정상등록되었습니다.");
+ }
+
+ } else {
+ articleVO.setResultMessage("게시글은 등록되었으나, 첨부파일그룹 등록에 실패하여 첨부파일 등록처리가 수행되지 않았습니다.");
+ }
+ }
+
+
+ /**
+ * 첨부파일을 삭제한다.
+ *
+ * @param articleVO
+ * @throws Exception
+ */
+ public void removeAttachFiles(ArticleVO articleVO) throws Exception {
+ int savedCnt = 0;
+ List attachFileList = articleVO.getRemovedAttachFiles();
+
+ if(attachFileList == null || attachFileList.size() < 1) return;
+
+ String attachFileId = attachFileList.get(0).getAttachFileId();
+
+ if(StringUtil.isNotEmpty(attachFileId)) {
+
+ // 첨부파일 삭제
+ for(int i=0; i 첨부파일 삭제에 실패하였습니다 : " + attachFileVO.getOrignlFileNm());
+ }
+ }
+
+ if(savedCnt != attachFileList.size()) {
+ articleVO.setResultMessage(String.format("총 %d개 파일 중 %개 파일만 정상 삭제되었습니다.", attachFileList.size(), savedCnt));
+ }
+
+ } else {
+ articleVO.setResultMessage("첨부파일그룹ID 정보가 누락되어 첨부파일 삭제가 불가합니다.");
+ }
+
+ return;
+ }
+
+ /**
+ * Q&A 게시글을 수정한다.
+ *
+ * @param reqVO
+ * @return
+ */
+ public int updateArticle(ArticleVO articleVO) throws Exception {
+
+ int updateRet = qnaDAO.updateArticle(articleVO);
+
+ // 첨부파일 삭제
+ List removedAttachFiles = articleVO.getRemovedAttachFiles();
+ if(removedAttachFiles != null && removedAttachFiles.size() > 0) {
+ removeAttachFiles(articleVO);
+ }
+
+ // 첨부파일 추가
+ List addedFiles = articleVO.getAttachFiles();
+ if(addedFiles != null && addedFiles.size() > 0) {
+ addAttachFiles(articleVO);
+ }
+
+ return updateRet;
+ }
+
+ /**
+ * Q&A 게시글을 삭제한다.
+ *
+ * @param reqVO
+ * @return
+ */
+ public int deleteArticle(ArticleVO articleVO) throws Exception {
+ int ret = qnaDAO.deleteArticle(articleVO);
+ attachFileService.deleteAttachFileGroup(articleVO.getBdAttachFileId());
+ return ret;
+ }
+
+ /**
+ * 해당 QNA 글을 변경할 수 있는지 여부를 확인한다.
+ * (articleVO.getLoginedMbInfoId() 값을 확인하여 DB에 저장된 게시글을 조회하여 검사하므로 호출 전 설정 필요)
+ *
+ * @param articleVO
+ * @return
+ * @throws Exception
+ */
+ public String canModify(ArticleVO articleVO) throws Exception {
+
+ if(StringUtil.isEmpty(articleVO.getLoginedMbInfoId())) {
+ return "로그인 후, 이용하실 수 있습니다.";
+ }
+
+ return canModify(selectArticle(articleVO), articleVO.getLoginedMbInfoId());
+ }
+
+ /**
+ * 해당 QNA 글을 변경할 수 있는지 여부를 확인한다.
+ *
+ * @param articleVO
+ * @return
+ * @throws Exception
+ */
+ public String canModify(ArticleVO articleVO, String mbInfoId) throws Exception {
+ if(StringUtil.isEmpty(mbInfoId)) {
+ return "로그인 후, 이용하실 수 있습니다.";
+ }
+
+ if(articleVO == null) {
+ return "대상 게시글 정보가 없습니다.";
+ }
+
+ if(!"Y".equals(articleVO.getMyQnaYn())) {
+ return "본인의 글만 변경할 수 있습니다.";
+ }
+
+ if("Y".equals(articleVO.getAnswerYn())) {
+ return "이미 답변완료된 글은 변경할 수 없습니다.";
+ }
+
+ return null;
+ }
+
+ /**
+ * 해당 QNA 글을 읽을 수 있는지 여부를 확인한다.
+ *
+ * @param articleVO
+ * @return
+ * @throws Exception
+ */
+ public String canRead(ArticleVO articleVO) throws Exception {
+
+ ArticleVO savedArticleVO = selectArticle(articleVO);
+
+ if("Y".equals(savedArticleVO.getMyQnaYn())) return null;
+
+ if("Y".equals(savedArticleVO.getSecretYn())) {
+ return "다른 사용자의 비밀글은 조회할 수 없습니다.";
+ }
+
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/legacy/nlib/src/main/java/nlib/bbs/web/AncmntController.java b/legacy/nlib/src/main/java/nlib/bbs/web/AncmntController.java
new file mode 100644
index 00000000..828ac8be
--- /dev/null
+++ b/legacy/nlib/src/main/java/nlib/bbs/web/AncmntController.java
@@ -0,0 +1,159 @@
+
+package nlib.bbs.web;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.core.Authentication;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.WebDataBinder;
+import org.springframework.web.bind.annotation.InitBinder;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import nlib.bbs.service.ArticleVO;
+import nlib.bbs.service.BoardService;
+import nlib.cmm.NlibCommonController;
+import nlib.cmm.service.NlibProperty;
+import nlib.cmm.service.PagingVO;
+
+/**
+ *
+ * @Class Name : AncmntController.java
+ *
+ * @Description : 공지사항 컨트롤러 클래스
+ *
+ *
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ *
+ *
+ * @ ------------ -------- ---------------------------
+ * @ 수정일 수정자 수정내용
+ * @ ------------ -------- ---------------------------
+ * @ 2021. 09. 13. KNKIM 최초 생성
+ *
+ *
+ * @author 이씨플라자 * DIGITALSHIP KNKIM
+ * @since 2021. 09. 13.
+ * @version 1.0
+ *
+ */
+@Controller
+public class AncmntController extends NlibCommonController
+{
+ private static final Logger log = LoggerFactory.getLogger(AncmntController.class);
+
+ static final int DEFUALT_PAGE_SIZE = NlibProperty.getInt("list.paging.page.size", 10);
+
+ @Resource(name = "ancmntService")
+ private BoardService ancmntService;
+
+ final String[] DISALLOWED_FIELDS = new String[] {
+ "mngOrgCd",
+ "mngOrgNm",
+ "bdType",
+ "title",
+ "content",
+ "notiYn",
+ "bdAttachFileId",
+ "attachYn",
+ "resultMessage",
+ "resultCode"
+ };
+
+ @InitBinder
+ public void initBinder(WebDataBinder binder) {
+ binder.setDisallowedFields(DISALLOWED_FIELDS);
+ }
+
+ /**
+ * 목록 화면을 표시한다.
+ *
+ * @param req
+ * @return
+ */
+ @RequestMapping("/bbs/listAncmnts.do")
+ public String listAncmnts(
+ HttpServletRequest req,
+ @RequestParam Map paramMap,
+ ArticleVO searchArticleVO,
+ ModelMap model
+ ) throws Exception {
+
+ model.addAttribute("searchArticle", searchArticleVO);
+
+ return "nlib/bbs/listAncmnts";
+ }
+
+ /**
+ * 목록 조회한다.
+ *
+ * @param request
+ * @return
+ */
+ @RequestMapping(value="/bbs/listAncmntsAjax.do")
+ public ResponseEntity listAncmntsAjax(
+ HttpServletRequest request,
+ Authentication authentication,
+ @RequestBody ArticleVO searchArticleVO) throws Exception {
+
+ if(searchArticleVO.getPageIndex() < 1) searchArticleVO.setPageIndex(1);
+ if(searchArticleVO.getPageSize() < 1) searchArticleVO.setPageSize(DEFUALT_PAGE_SIZE);
+ searchArticleVO.setMngOrgCd(getCurCouncilCd(request));
+
+ List list = ancmntService.listArticles(searchArticleVO);
+
+ int totRecordCount = ancmntService.countArticles(searchArticleVO);
+
+ //-------------------------------
+ // JSON변환 응답 처리
+ //-------------------------------
+ // JS-GRID 페이징 처리를 포함한 응답값 처리
+ // {data: [{...}],
+ // itemsCount: 255
+ // }
+ HashMap retMap = new HashMap();
+ retMap.put("data", list);
+ retMap.put("itemsCount", totRecordCount);
+
+ PagingVO pageVO = new PagingVO();
+ pageVO.setPagingVO(totRecordCount, searchArticleVO.getPageIndex(), searchArticleVO.getPageSize());
+ retMap.put("pagingPageIndex" , pageVO.getPageIndex());
+ retMap.put("pagingTotRecordCount", pageVO.getTotRecordCount());
+ retMap.put("pagingStartPage" , pageVO.getStartPage());
+ retMap.put("pagingEndPage" , pageVO.getEndPage());
+ retMap.put("pagingLastPage" , pageVO.getLastPage());
+
+ return makeResponseEntityJson(retMap);
+ }
+
+
+ /**
+ * 알림 상세 내용 조회한다.
+ *
+ * @param req
+ * @return
+ */
+ @RequestMapping("/bbs/selectAncmntArticle.do")
+ public String selectAncmntArticle(HttpServletRequest req, Authentication authentication, ArticleVO searchArticleVO, ModelMap model) throws Exception {
+
+ // 읽음처리 및 상세내용 조회
+ ArticleVO articleVO = ancmntService.selectArticle(searchArticleVO);
+
+ model.addAttribute("searchArticle", searchArticleVO);
+ model.addAttribute("article", articleVO);
+
+ return "nlib/bbs/selectAncmntArticle";
+ }
+
+}
\ No newline at end of file
diff --git a/legacy/nlib/src/main/java/nlib/bbs/web/FaqController.java b/legacy/nlib/src/main/java/nlib/bbs/web/FaqController.java
new file mode 100644
index 00000000..81658842
--- /dev/null
+++ b/legacy/nlib/src/main/java/nlib/bbs/web/FaqController.java
@@ -0,0 +1,158 @@
+
+package nlib.bbs.web;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.core.Authentication;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import nlib.bbs.service.ArticleVO;
+import nlib.bbs.service.BoardService;
+import nlib.cmm.NlibCommonController;
+import nlib.cmm.service.CodeService;
+import nlib.cmm.service.NlibProperty;
+import nlib.cmm.service.PagingVO;
+
+/**
+ *
+ * @Class Name : FaqController.java
+ *
+ * @Description : FAQ 컨트롤러 클래스
+ *
+ *
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ *
+ *
+ * @ ------------ -------- ---------------------------
+ * @ 수정일 수정자 수정내용
+ * @ ------------ -------- ---------------------------
+ * @ 2021. 09. 13. KNKIM 최초 생성
+ *
+ *
+ * @author 이씨플라자 * DIGITALSHIP KNKIM
+ * @since 2021. 09. 13.
+ * @version 1.0
+ *
+ */
+@Controller
+public class FaqController extends NlibCommonController {
+
+ private static final Logger log = LoggerFactory.getLogger(FaqController.class);
+
+ static final int DEFUALT_PAGE_SIZE = NlibProperty.getInt("list.paging.page.size", 10);
+
+ @Resource(name = "faqService")
+ private BoardService faqService;
+
+ @Resource(name="codeService")
+ private CodeService codeService;
+
+ /**
+ * 목록 화면을 표시한다.
+ *
+ * @param req
+ * @return
+ */
+ @RequestMapping("/bbs/listFaqs.do")
+ public String listFaqs(
+ HttpServletRequest req,
+ @RequestParam Map paramMap,
+ ArticleVO searchArticleVO,
+ ModelMap model
+ ) throws Exception {
+
+
+ List