Merge branch 'tolag3'
This commit is contained in:
commit
48a197de5c
@ -1,6 +1,15 @@
|
|||||||
package seed.utils;
|
package seed.utils;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.security.KeyManagementException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Base64;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -15,6 +24,10 @@ import javax.mail.Session;
|
|||||||
import javax.mail.Transport;
|
import javax.mail.Transport;
|
||||||
import javax.mail.internet.InternetAddress;
|
import javax.mail.internet.InternetAddress;
|
||||||
import javax.mail.internet.MimeMessage;
|
import javax.mail.internet.MimeMessage;
|
||||||
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.TrustManager;
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
@ -28,7 +41,7 @@ import com.fasterxml.jackson.databind.node.TextNode;
|
|||||||
import com.ibm.icu.text.SimpleDateFormat;
|
import com.ibm.icu.text.SimpleDateFormat;
|
||||||
|
|
||||||
import kcc.com.srch.service.SearchVO;
|
import kcc.com.srch.service.SearchVO;
|
||||||
import kcc.let.uat.uia.service.CertVO;
|
import kcc.let.uat.uia.service.CertVO;
|
||||||
|
|
||||||
public class FairnetUtils {
|
public class FairnetUtils {
|
||||||
|
|
||||||
@ -374,4 +387,81 @@ public class FairnetUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static Boolean getBbuioToken_dev() {
|
||||||
|
|
||||||
|
// getBase64()
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean atSend_dev() {
|
||||||
|
|
||||||
|
String input = null;
|
||||||
|
StringBuffer result = new StringBuffer();
|
||||||
|
URL url = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
/** SSL 인증서 무시 : 비즈뿌리오 API 운영을 접속하는 경우 해당 코드 필요 없음 **/
|
||||||
|
TrustManager[] trustAllCerts = new TrustManager[] {
|
||||||
|
new X509TrustManager() {
|
||||||
|
public X509Certificate[] getAcceptedIssuers() { return null; }
|
||||||
|
public void checkClientTrusted(X509Certificate[] chain, String authType) { }
|
||||||
|
public void checkServerTrusted(X509Certificate[] chain, String authType) { }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
SSLContext sc = SSLContext.getInstance("SSL");
|
||||||
|
sc.init(null, trustAllCerts, new java.security.SecureRandom());
|
||||||
|
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
|
||||||
|
|
||||||
|
/** 운영 : https://api.bizppurio.com, 개발 : https://dev-api.bizppurio.com **/
|
||||||
|
url = new URL("https://dev-api.bizppurio.com/v3/message");
|
||||||
|
//url = new URL("https://api.bizppurio.com/v3/message");
|
||||||
|
|
||||||
|
/** Connection 설정 **/
|
||||||
|
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
|
||||||
|
connection.setRequestMethod("POST");
|
||||||
|
connection.addRequestProperty("Content-Type", "application/json");
|
||||||
|
connection.addRequestProperty("Accept-Charset", "UTF-8");
|
||||||
|
connection.addRequestProperty("Authorization", "Bearer " + "{인증 토큰}");
|
||||||
|
connection.setDoInput(true);
|
||||||
|
connection.setDoOutput(true);
|
||||||
|
connection.setUseCaches(false);
|
||||||
|
connection.setConnectTimeout(15000);
|
||||||
|
|
||||||
|
/** Request **/
|
||||||
|
OutputStream os = connection.getOutputStream();
|
||||||
|
String sms = "{\"account\":\"test\",\"refkey\":\"1234\","
|
||||||
|
+ "\"type\":\"sms\",\"from\":\"07000000000\",\"to\":\"01000000000\","
|
||||||
|
+ "\"content\":{\"sms\":{\"message\":\"SMS 전송!\"}}}";
|
||||||
|
os.write(sms.getBytes("UTF-8"));
|
||||||
|
os.flush();
|
||||||
|
|
||||||
|
/** Response **/
|
||||||
|
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
|
||||||
|
while ((input = in.readLine()) != null) {
|
||||||
|
result.append(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
connection.disconnect();
|
||||||
|
System.out.println("Response : " + result.toString());
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
} catch (KeyManagementException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String getBase64(String str) {
|
||||||
|
String encodedStr = Base64.getEncoder().encodeToString(str.getBytes());
|
||||||
|
return encodedStr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
110
src/main/java/seed/utils/PpurioGlobalSet.java
Normal file
110
src/main/java/seed/utils/PpurioGlobalSet.java
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
package seed.utils;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class PpurioGlobalSet {
|
||||||
|
|
||||||
|
private static String id;
|
||||||
|
private static String pw;
|
||||||
|
private static String host;
|
||||||
|
private static String senderKey;
|
||||||
|
private static String templateCode1;
|
||||||
|
private static String templateCode2;
|
||||||
|
private static String templateCode3;
|
||||||
|
private static String templateCode4;
|
||||||
|
private static String templateCode5;
|
||||||
|
private static String templateCode6;
|
||||||
|
|
||||||
|
@Value("#{globalSettings['ppurio.id']}")
|
||||||
|
public void setId(String id) {
|
||||||
|
PpurioGlobalSet.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Value("#{globalSettings['ppurio.pw']}")
|
||||||
|
public void setPw(String pw) {
|
||||||
|
PpurioGlobalSet.pw = pw;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getPw() {
|
||||||
|
return pw;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Value("#{globalSettings['ppurio.host']}")
|
||||||
|
public void setHost(String host) {
|
||||||
|
PpurioGlobalSet.host = host;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getHost() {
|
||||||
|
return host;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Value("#{globalSettings['ppurio.senderKey']}")
|
||||||
|
public void setSenderKey(String senderKey) {
|
||||||
|
PpurioGlobalSet.senderKey = senderKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getSenderKey() {
|
||||||
|
return senderKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Value("#{globalSettings['ppurio.templateCode1']}")
|
||||||
|
public void setTemplateCode1(String templateCode1) {
|
||||||
|
PpurioGlobalSet.templateCode1 = templateCode1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getTemplateCode1() {
|
||||||
|
return templateCode1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Value("#{globalSettings['ppurio.templateCode2']}")
|
||||||
|
public void setTemplateCode2(String templateCode2) {
|
||||||
|
PpurioGlobalSet.templateCode2 = templateCode2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getTemplateCode2() {
|
||||||
|
return templateCode2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Value("#{globalSettings['ppurio.templateCode3']}")
|
||||||
|
public void setTemplateCode3(String templateCode3) {
|
||||||
|
PpurioGlobalSet.templateCode3 = templateCode3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getTemplateCode3() {
|
||||||
|
return templateCode3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Value("#{globalSettings['ppurio.templateCode4']}")
|
||||||
|
public void setTemplateCode4(String templateCode4) {
|
||||||
|
PpurioGlobalSet.templateCode4 = templateCode4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getTemplateCode4() {
|
||||||
|
return templateCode4;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Value("#{globalSettings['ppurio.templateCode5']}")
|
||||||
|
public void setTemplateCode5(String templateCode5) {
|
||||||
|
PpurioGlobalSet.templateCode5 = templateCode5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getTemplateCode5() {
|
||||||
|
return templateCode5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Value("#{globalSettings['ppurio.templateCode6']}")
|
||||||
|
public void setTemplateCode6(String templateCode6) {
|
||||||
|
PpurioGlobalSet.templateCode6 = templateCode6;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getTemplateCode6() {
|
||||||
|
return templateCode6;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user