Merge branch 'tolag3'
This commit is contained in:
parent
48a197de5c
commit
c5dc411286
5
src/main/java/kcc/com/snd/service/SendService.java
Normal file
5
src/main/java/kcc/com/snd/service/SendService.java
Normal file
@ -0,0 +1,5 @@
|
||||
package kcc.com.snd.service;
|
||||
|
||||
public interface SendService {
|
||||
public void sendAt(SendVO sendVO) throws Exception;
|
||||
}
|
||||
22
src/main/java/kcc/com/snd/service/SendVO.java
Normal file
22
src/main/java/kcc/com/snd/service/SendVO.java
Normal file
@ -0,0 +1,22 @@
|
||||
package kcc.com.snd.service;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import kcc.com.cmm.ComDefaultVO;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SendVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String accesstoken;
|
||||
private String type;
|
||||
private String expired;
|
||||
}
|
||||
14
src/main/java/kcc/com/snd/service/impl/SendDAO.java
Normal file
14
src/main/java/kcc/com/snd/service/impl/SendDAO.java
Normal file
@ -0,0 +1,14 @@
|
||||
package kcc.com.snd.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import kcc.com.cmm.service.impl.EgovComAbstractDAO;
|
||||
import kcc.com.snd.service.SendVO;
|
||||
|
||||
@Repository("sendDAO")
|
||||
public class SendDAO extends EgovComAbstractDAO {
|
||||
|
||||
public SendVO selectToken(SendVO sendVO) throws Exception{
|
||||
return (SendVO) select("sendDAO.selectToken", sendVO);
|
||||
}
|
||||
}
|
||||
22
src/main/java/kcc/com/snd/service/impl/SendServiceImpl.java
Normal file
22
src/main/java/kcc/com/snd/service/impl/SendServiceImpl.java
Normal file
@ -0,0 +1,22 @@
|
||||
package kcc.com.snd.service.impl;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
import kcc.com.snd.service.SendService;
|
||||
import kcc.com.snd.service.SendVO;
|
||||
|
||||
@Service("SendService")
|
||||
public class SendServiceImpl extends EgovAbstractServiceImpl implements SendService {
|
||||
|
||||
@Resource(name="sendDAO")
|
||||
private SendDAO sendDAO;
|
||||
|
||||
@Override
|
||||
public void sendAt(SendVO sendVO) throws Exception{
|
||||
sendDAO.selectToken(sendVO);
|
||||
}
|
||||
|
||||
}
|
||||
@ -224,4 +224,9 @@ public class XxxController {
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/web/xxx/xxxPpurioTest.do")
|
||||
public String xxxEmailAjax() {
|
||||
FairnetUtils.getPpurioToken_dev2();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -31,6 +31,16 @@ import javax.net.ssl.X509TrustManager;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.http.conn.ssl.NoopHostnameVerifier;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.ssl.SSLContextBuilder;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@ -387,81 +397,73 @@ public class FairnetUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getPpurioToken_dev2() {
|
||||
|
||||
public static Boolean getBbuioToken_dev() {
|
||||
|
||||
// getBase64()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Boolean atSend_dev() {
|
||||
StringBuffer result = new StringBuffer();
|
||||
|
||||
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) { }
|
||||
}
|
||||
};
|
||||
String token = "";
|
||||
|
||||
SSLContext sc = SSLContext.getInstance("SSL");
|
||||
sc.init(null, trustAllCerts, new java.security.SecureRandom());
|
||||
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
|
||||
PpurioGlobalSet ppurioGlobalSet = new PpurioGlobalSet();
|
||||
|
||||
/** 운영 : 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");
|
||||
try {
|
||||
|
||||
/** 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);
|
||||
/** SSL 인증서 무시 : 비즈뿌리오 API 운영을 접속하는 경우 해당 코드 필요 없음 **/
|
||||
// if(!"real".equals(isLocal)) {
|
||||
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());
|
||||
// }
|
||||
|
||||
/** 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();
|
||||
URL url = new URL(ppurioGlobalSet.getHost() + "/v1/token");
|
||||
|
||||
/** Response **/
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
|
||||
while ((input = in.readLine()) != null) {
|
||||
result.append(input);
|
||||
}
|
||||
/** Connection 설정 **/
|
||||
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("POST");
|
||||
connection.addRequestProperty("Content-Type", "application/json");
|
||||
connection.addRequestProperty("Accept-Charset", "UTF-8");
|
||||
|
||||
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();
|
||||
}
|
||||
//Base64 인코딩
|
||||
String idpw = ppurioGlobalSet.getId() + ":" + ppurioGlobalSet.getPw();
|
||||
String authData = Base64.getEncoder().encodeToString(idpw.getBytes());
|
||||
|
||||
return true;
|
||||
}
|
||||
connection.addRequestProperty("Authorization", "Basic " + authData);
|
||||
|
||||
connection.setDoInput(true);
|
||||
connection.setDoOutput(true);
|
||||
connection.setUseCaches(false);
|
||||
connection.setConnectTimeout(15000);
|
||||
|
||||
private String getBase64(String str) {
|
||||
String encodedStr = Base64.getEncoder().encodeToString(str.getBytes());
|
||||
return encodedStr;
|
||||
/** Request **/
|
||||
OutputStream os = connection.getOutputStream();
|
||||
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());
|
||||
|
||||
JSONObject jObject = new JSONObject(result.toString());
|
||||
token = jObject.getString("accesstoken");
|
||||
|
||||
} catch (IOException e) {
|
||||
System.out.println(e.getMessage());
|
||||
} catch (KeyManagementException e) {
|
||||
System.out.println(e.getMessage());
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
return token;
|
||||
}
|
||||
}
|
||||
@ -240,3 +240,15 @@ email.password=@caseadmin2024
|
||||
|
||||
#\uac80\uc0c9\uc194\ub8e8\uc158
|
||||
search.host=http://192.168.0.60:7578
|
||||
|
||||
#\uc54c\ub9bc\ud1a1
|
||||
ppurio.id=kofair
|
||||
ppurio.pw=kofa2024@
|
||||
ppurio.host=https://dev-api.bizppurio.com
|
||||
ppurio.senderKey=953031f0c131963c2fa9cd004f9965f9d487bdc5
|
||||
ppurio.templateCode1=bizp_2024112810423519814410026
|
||||
ppurio.templateCode2=bizp_2024112810423516931294012
|
||||
ppurio.templateCode3=bizp_2024112810492919814837182
|
||||
ppurio.templateCode4=bizp_2024112810492916931760451
|
||||
ppurio.templateCode5=bizp_2024112810492916931854671
|
||||
ppurio.templateCode6=bizp_2024112810522719814540186
|
||||
@ -245,3 +245,15 @@ email.password=@caseadmin2024
|
||||
|
||||
#\uac80\uc0c9\uc194\ub8e8\uc158
|
||||
search.host=http://192.168.0.60:7578
|
||||
|
||||
#\uc54c\ub9bc\ud1a1
|
||||
ppurio.id=kofair
|
||||
ppurio.pw=kofa2024@
|
||||
ppurio.host=https://dev-api.bizppurio.com
|
||||
ppurio.senderKey=953031f0c131963c2fa9cd004f9965f9d487bdc5
|
||||
ppurio.templateCode1=bizp_2024112810423519814410026
|
||||
ppurio.templateCode2=bizp_2024112810423516931294012
|
||||
ppurio.templateCode3=bizp_2024112810492919814837182
|
||||
ppurio.templateCode4=bizp_2024112810492916931760451
|
||||
ppurio.templateCode5=bizp_2024112810492916931854671
|
||||
ppurio.templateCode6=bizp_2024112810522719814540186
|
||||
@ -419,3 +419,15 @@ email.password=@caseadmin2024
|
||||
|
||||
#\uac80\uc0c9\uc194\ub8e8\uc158
|
||||
search.host=http://192.168.0.60:7578
|
||||
|
||||
#\uc54c\ub9bc\ud1a1
|
||||
ppurio.id=kofair
|
||||
ppurio.pw=kofa2024@
|
||||
ppurio.host=https://api.bizppurio.com
|
||||
ppurio.senderKey=953031f0c131963c2fa9cd004f9965f9d487bdc5
|
||||
ppurio.templateCode1=bizp_2024112810423519814410026
|
||||
ppurio.templateCode2=bizp_2024112810423516931294012
|
||||
ppurio.templateCode3=bizp_2024112810492919814837182
|
||||
ppurio.templateCode4=bizp_2024112810492916931760451
|
||||
ppurio.templateCode5=bizp_2024112810492916931854671
|
||||
ppurio.templateCode6=bizp_2024112810522719814540186
|
||||
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
|
||||
|
||||
<sqlMap namespace="Send">
|
||||
|
||||
<typeAlias alias="egovMap" type="egovframework.rte.psl.dataaccess.util.EgovMap"/>
|
||||
<typeAlias alias="sendVO" type="kcc.com.snd.service.SendVO"/>
|
||||
|
||||
<select id="sendDAO.selectToken" resultClass="sendVO">
|
||||
|
||||
SELECT
|
||||
A.ACCESSTOKEN,
|
||||
A.TYPE,
|
||||
A.EXPIRED
|
||||
FROM
|
||||
PPURIO_TOKEN A
|
||||
|
||||
</select>
|
||||
</sqlMap>
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
|
||||
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
|
||||
|
||||
<sqlMapConfig>
|
||||
<sqlMap resource="egovframework/sqlmap/com/cmm/snd/Send_SQL_Oracle.xml"/>
|
||||
|
||||
</sqlMapConfig>
|
||||
Loading…
Reference in New Issue
Block a user