diff --git a/src/main/java/kcc/com/snd/service/SendService.java b/src/main/java/kcc/com/snd/service/SendService.java new file mode 100644 index 00000000..5e9d5b3f --- /dev/null +++ b/src/main/java/kcc/com/snd/service/SendService.java @@ -0,0 +1,5 @@ +package kcc.com.snd.service; + +public interface SendService { + public void sendAt(SendVO sendVO) throws Exception; +} \ No newline at end of file diff --git a/src/main/java/kcc/com/snd/service/SendVO.java b/src/main/java/kcc/com/snd/service/SendVO.java new file mode 100644 index 00000000..3178b70e --- /dev/null +++ b/src/main/java/kcc/com/snd/service/SendVO.java @@ -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; +} \ No newline at end of file diff --git a/src/main/java/kcc/com/snd/service/impl/SendDAO.java b/src/main/java/kcc/com/snd/service/impl/SendDAO.java new file mode 100644 index 00000000..eeaba21d --- /dev/null +++ b/src/main/java/kcc/com/snd/service/impl/SendDAO.java @@ -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); + } +} diff --git a/src/main/java/kcc/com/snd/service/impl/SendServiceImpl.java b/src/main/java/kcc/com/snd/service/impl/SendServiceImpl.java new file mode 100644 index 00000000..117e6c86 --- /dev/null +++ b/src/main/java/kcc/com/snd/service/impl/SendServiceImpl.java @@ -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); + } + +} diff --git a/src/main/java/kcc/xxx/web/XxxController.java b/src/main/java/kcc/xxx/web/XxxController.java index 2f10eab4..22aa4cc5 100644 --- a/src/main/java/kcc/xxx/web/XxxController.java +++ b/src/main/java/kcc/xxx/web/XxxController.java @@ -224,4 +224,9 @@ public class XxxController { } } + @RequestMapping("/web/xxx/xxxPpurioTest.do") + public String xxxEmailAjax() { + FairnetUtils.getPpurioToken_dev2(); + return null; + } } \ No newline at end of file diff --git a/src/main/java/seed/utils/FairnetUtils.java b/src/main/java/seed/utils/FairnetUtils.java index 899442d3..5514e92e 100644 --- a/src/main/java/seed/utils/FairnetUtils.java +++ b/src/main/java/seed/utils/FairnetUtils.java @@ -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; @@ -41,7 +51,7 @@ import com.fasterxml.jackson.databind.node.TextNode; import com.ibm.icu.text.SimpleDateFormat; import kcc.com.srch.service.SearchVO; -import kcc.let.uat.uia.service.CertVO; +import kcc.let.uat.uia.service.CertVO; public class FairnetUtils { @@ -387,81 +397,73 @@ public class FairnetUtils { return null; } - - public static Boolean getBbuioToken_dev() { + public static String getPpurioToken_dev2() { -// 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) { } - } - }; - - 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(); - } + String token = ""; - return true; - } - - - private String getBase64(String str) { - String encodedStr = Base64.getEncoder().encodeToString(str.getBytes()); - return encodedStr; + PpurioGlobalSet ppurioGlobalSet = new PpurioGlobalSet(); + + try { + + /** 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()); +// } + + URL url = new URL(ppurioGlobalSet.getHost() + "/v1/token"); + + /** Connection 설정 **/ + HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); + connection.setRequestMethod("POST"); + connection.addRequestProperty("Content-Type", "application/json"); + connection.addRequestProperty("Accept-Charset", "UTF-8"); + + //Base64 인코딩 + String idpw = ppurioGlobalSet.getId() + ":" + ppurioGlobalSet.getPw(); + String authData = Base64.getEncoder().encodeToString(idpw.getBytes()); + + connection.addRequestProperty("Authorization", "Basic " + authData); + + connection.setDoInput(true); + connection.setDoOutput(true); + connection.setUseCaches(false); + connection.setConnectTimeout(15000); + + /** 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; } } \ No newline at end of file diff --git a/src/main/resources/egovframework/egovProps/globals_dev.properties b/src/main/resources/egovframework/egovProps/globals_dev.properties index bf630a5c..a35d5086 100644 --- a/src/main/resources/egovframework/egovProps/globals_dev.properties +++ b/src/main/resources/egovframework/egovProps/globals_dev.properties @@ -239,4 +239,16 @@ email.username=caseadmin@kofair.or.kr email.password=@caseadmin2024 #\uac80\uc0c9\uc194\ub8e8\uc158 -search.host=http://192.168.0.60:7578 \ No newline at end of file +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 \ No newline at end of file diff --git a/src/main/resources/egovframework/egovProps/globals_local.properties b/src/main/resources/egovframework/egovProps/globals_local.properties index 65f0b6b9..99f9f78c 100644 --- a/src/main/resources/egovframework/egovProps/globals_local.properties +++ b/src/main/resources/egovframework/egovProps/globals_local.properties @@ -244,4 +244,16 @@ email.username=caseadmin@kofair.or.kr email.password=@caseadmin2024 #\uac80\uc0c9\uc194\ub8e8\uc158 -search.host=http://192.168.0.60:7578 \ No newline at end of file +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 \ No newline at end of file diff --git a/src/main/resources/egovframework/egovProps/globals_svr.properties b/src/main/resources/egovframework/egovProps/globals_svr.properties index 869a4e36..9d5303fc 100644 --- a/src/main/resources/egovframework/egovProps/globals_svr.properties +++ b/src/main/resources/egovframework/egovProps/globals_svr.properties @@ -418,4 +418,16 @@ email.username=caseadmin@kofair.or.kr email.password=@caseadmin2024 #\uac80\uc0c9\uc194\ub8e8\uc158 -search.host=http://192.168.0.60:7578 \ No newline at end of file +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 \ No newline at end of file diff --git a/src/main/resources/egovframework/sqlmap/com/cmm/snd/Send_SQL_Oracle.xml b/src/main/resources/egovframework/sqlmap/com/cmm/snd/Send_SQL_Oracle.xml new file mode 100644 index 00000000..90bb30b8 --- /dev/null +++ b/src/main/resources/egovframework/sqlmap/com/cmm/snd/Send_SQL_Oracle.xml @@ -0,0 +1,19 @@ + + + + + + + + + + diff --git a/src/main/resources/egovframework/sqlmap/config/oracle/sql-map-config-oracle-com-snd.xml b/src/main/resources/egovframework/sqlmap/config/oracle/sql-map-config-oracle-com-snd.xml new file mode 100644 index 00000000..6d98f1e8 --- /dev/null +++ b/src/main/resources/egovframework/sqlmap/config/oracle/sql-map-config-oracle-com-snd.xml @@ -0,0 +1,8 @@ + + + + + + +