Pārlūkot izejas kodu

AES키 변경 및 Customer 수정

jsshin 5 gadi atpakaļ
vecāks
revīzija
4ccb9c1c83

+ 1 - 1
src/main/java/com/style24/core/support/util/CryptoUtils.java

@@ -13,7 +13,7 @@ import com.gagaframework.web.util.GagaCryptoUtil;
 public class CryptoUtils {
 
 	// AES키
-	private static final String aesKey = "style24-tsit^^";
+	private static final String aesKey = "dPtm24dnpqtjqltmdkaghsmsqlalf!@#";
 
 	/**
 	 * AES 암호화 처리

+ 42 - 28
src/main/java/com/style24/persistence/domain/Customer.java

@@ -7,6 +7,7 @@ import com.style24.core.support.util.MaskingUtils;
 import com.style24.persistence.TscBaseDomain;
 import com.style24.persistence.TscPageRequest;
 import lombok.Data;
+import org.apache.commons.lang3.StringUtils;
 
 /**
  * 회원 Domain
@@ -83,63 +84,65 @@ public class Customer extends TscBaseDomain {
 	private String encData;
 	private String authMethod;		// 인증방법(고객정보, 휴대폰인증, 아이핀 인증)
 
+
 	// 암호화 대상 복호화 처리
 	public String getCustNm() {
-		custNm = CryptoUtils.decryptAES(custNm);
-		return custNm;
+		this.custNm = CryptoUtils.decryptAES(this.custNm);
+		return this.custNm;
 	}
 
 	public String getSexGb() {
-		sexGb = CryptoUtils.decryptAES(sexGb);
-		return sexGb;
+		this.sexGb = CryptoUtils.decryptAES(this.sexGb);
+		return this.sexGb;
 	}
 
 	public String getEmail() {
-		email = CryptoUtils.decryptAES(email);
-		return email;
+		this.email = CryptoUtils.decryptAES(this.email);
+		return this.email;
 	}
 
 	public String getBirthYmd() {
-		birthYmd = CryptoUtils.decryptAES(birthYmd);
-		return birthYmd;
+		this.birthYmd = CryptoUtils.decryptAES(this.birthYmd);
+		return this.birthYmd;
 	}
 
 	public String getCellPhnno() {
-		cellPhnno = CryptoUtils.decryptAES(cellPhnno);
-		return cellPhnno;
+		this.cellPhnno = CryptoUtils.decryptAES(this.cellPhnno);
+		return this.cellPhnno;
 	}
 
 	public String getHomeBaseAddr() {
-		homeBaseAddr = CryptoUtils.decryptAES(homeBaseAddr);
-		return homeBaseAddr;
+		this.homeBaseAddr = CryptoUtils.decryptAES(this.homeBaseAddr);
+		return this.homeBaseAddr;
 	}
 
 	public String getHomeDtlAddr() {
-		homeDtlAddr = CryptoUtils.decryptAES(homeDtlAddr);
-		return homeDtlAddr;
+		this.homeDtlAddr = CryptoUtils.decryptAES(this.homeDtlAddr);
+		return this.homeDtlAddr;
 	}
 
 	// Masking
 	public String getMaskingCustId() {
-		return TscSession.getAttribute("maskingYn").equals("Y") ? MaskingUtils.id(custId) : custId;
+		return TscSession.getAttribute("maskingYn").equals("Y") ? MaskingUtils.id(this.custId) : this.custId;
 	}
 
 	public String getMaskingCustNm() {
-		custNm = CryptoUtils.decryptAES(custNm);
-		return TscSession.getAttribute("maskingYn").equals("Y") ? MaskingUtils.name(custNm) : custNm;
+		this.custNm = CryptoUtils.decryptAES(this.custNm);
+		return TscSession.getAttribute("maskingYn").equals("Y") ? MaskingUtils.name(this.custNm) : this.custNm;
 
 	}
 
 	public String getMaskingCellPhnno() {
-		cellPhnno = CryptoUtils.decryptAES(cellPhnno);
-		return TscSession.getAttribute("maskingYn").equals("Y") ? MaskingUtils.phoneNo(cellPhnno) : cellPhnno;
+		this.cellPhnno = CryptoUtils.decryptAES(this.cellPhnno);
+		return TscSession.getAttribute("maskingYn").equals("Y") ? MaskingUtils.phoneNo(this.cellPhnno) : this.cellPhnno;
 	}
 
 	public String getMaskingEmail() {
-		email = CryptoUtils.decryptAES(email);
-		return TscSession.getAttribute("maskingYn").equals("Y") ? MaskingUtils.email(email) : email;
+		this.email = CryptoUtils.decryptAES(this.email);
+		return TscSession.getAttribute("maskingYn").equals("Y") ? MaskingUtils.email(this.email) : this.email;
 	}
 
+
 	// Pagination
 	private TscPageRequest pageable;
 	private int pageNo = 1;
@@ -148,13 +151,24 @@ public class Customer extends TscBaseDomain {
 
 	// 암호화 대상 데이터 암호화 처리
 	public void encryptData () {
-		encodedCustNm = CryptoUtils.encryptAES(custNm);
-		encodedSexGb = CryptoUtils.encryptAES(sexGb);
-		encodedEmail = CryptoUtils.encryptAES(email);
-		encodedCellPhnno = CryptoUtils.encryptAES(cellPhnno);
-		encodedBirthYmd = CryptoUtils.encryptAES(birthYmd);
-		encodedHomeBaseAddr  = CryptoUtils.encryptAES(homeBaseAddr);
-		encodedHomeDtlAddr = CryptoUtils.encryptAES(homeDtlAddr);
+		this.encodedCustNm = CryptoUtils.encryptAES(this.custNm);
+		this.encodedSexGb = CryptoUtils.encryptAES(this.sexGb);
+		this.encodedEmail = CryptoUtils.encryptAES(this.email);
+		this.encodedCellPhnno = CryptoUtils.encryptAES(this.cellPhnno);
+		this.encodedBirthYmd = CryptoUtils.encryptAES(this.birthYmd);
+		this.encodedHomeBaseAddr  = CryptoUtils.encryptAES(this.homeBaseAddr);
+		this.encodedHomeDtlAddr = CryptoUtils.encryptAES(this.homeDtlAddr);
+	}
+
+	// 휴대폰 번호 대쉬 붙이기
+	public void setHypenCellPhone() {
+		if (StringUtils.isNotBlank(this.cellPhnno)) {
+			if (this.cellPhnno.length() > 10) {
+				this.cellPhnno = this.cellPhnno.substring(0, 3) + "-" + this.cellPhnno.substring(3, 7) + "-" + this.cellPhnno.substring(7, 11);
+			} else {
+				this.cellPhnno = this.cellPhnno.substring(0, 3) + "-" + this.cellPhnno.substring(3, 6) + "-" + this.cellPhnno.substring(6, 10);
+			}
+		}
 	}
 
 }