2023-05-12 15:59 불필요한 파일 삭제 및 API 접속 TEST URL 생성
This commit is contained in:
parent
e735209606
commit
4aa7dd81fe
@ -23,15 +23,15 @@ import com.itn.mjonApi.cmn.interceptor.CertifInterceptor;
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
|
||||
@Bean
|
||||
public CertifInterceptor certificationInterceptor(){
|
||||
public CertifInterceptor certifInterceptor(){
|
||||
return new CertifInterceptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(certificationInterceptor())
|
||||
.addPathPatterns("/api/accessKey/**")
|
||||
registry.addInterceptor(certifInterceptor())
|
||||
.addPathPatterns("/api/accessKey/**")
|
||||
//.addPathPatterns("/api/accessTest/**")
|
||||
;
|
||||
//.excludePathPatterns("/css/**", "/images/**", "/js/**");
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import com.itn.mjonApi.cmn.idgen.service.IdgenService;
|
||||
import com.itn.mjonApi.mjon.api.access.service.AccessKeyService;
|
||||
import com.itn.mjonApi.mjon.log.service.LettnLoginLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
@ -44,19 +45,10 @@ public class CertifInterceptor implements HandlerInterceptor{
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||
throws Exception {
|
||||
//HttpSession session = request.getSession();
|
||||
|
||||
System.out.println("=====preHandle=4=apikey==");
|
||||
System.out.println("=====preHandle=4=apikey=="+request.getRequestURI());
|
||||
|
||||
System.out.println("=====preHandle=4=apikey=="+request.getRemoteAddr());
|
||||
System.out.println("=====preHandle=4=apikey=="+request.getRemoteHost());
|
||||
System.out.println("=====preHandle=4=apikey=="+request.getRemotePort());
|
||||
System.out.println("=====preHandle=4=apikey=="+request.getRemoteUser());
|
||||
System.out.println("=====preHandle=4=apikey=="+request.getRequestedSessionId());
|
||||
System.out.println("=====preHandle=4=apikey==");
|
||||
|
||||
|
||||
// URL 접속정보
|
||||
String referer = request.getHeader("Referer");
|
||||
//System.out.println("=====preHandle=5=apikey=refer="+referer);
|
||||
|
||||
//step0-1.log 남기기
|
||||
//step0-2.IP 체크
|
||||
@ -79,7 +71,7 @@ public class CertifInterceptor implements HandlerInterceptor{
|
||||
lettnLoginLogVO.setConectId(request.getParameter("mberId"));
|
||||
|
||||
//device type
|
||||
if(isMobile(request)){
|
||||
if(_isMobile(request)){
|
||||
lettnLoginLogVO.setDeviceType("M");
|
||||
}else{
|
||||
lettnLoginLogVO.setDeviceType("P");
|
||||
@ -106,18 +98,19 @@ public class CertifInterceptor implements HandlerInterceptor{
|
||||
lettnLoginLogVO = lettnLoginLogService.selectIgnoreIpCnt(lettnLoginLogVO);
|
||||
int i_ignoreCnt = lettnLoginLogVO.getCnt();
|
||||
|
||||
//IP 접근 제어
|
||||
if (i_ignoreCnt>0) {
|
||||
//제한 아이피인 경우는 화면 안나옴 처리
|
||||
response.setContentType("application/json");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.getWriter().write("{\"resultCode\":\"403\",\"message\":\"Forbidden\"}");
|
||||
|
||||
this._jsonResult(response, HttpStatus.FORBIDDEN);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}catch(Exception ex) {
|
||||
ex.printStackTrace();
|
||||
|
||||
//내부 오류
|
||||
this._jsonResult(response, HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@ -128,28 +121,27 @@ public class CertifInterceptor implements HandlerInterceptor{
|
||||
AccessKeyVO accessKeyVO = new AccessKeyVO();
|
||||
accessKeyVO.setAccessKey(request.getParameter("accessKey"));
|
||||
accessKeyVO.setMberId(request.getParameter("mberId"));
|
||||
accessKeyVO.setCallInfo(referer);
|
||||
|
||||
accessKeyVO = accessKeyService.selectRKey(accessKeyVO);
|
||||
|
||||
//인증 실패
|
||||
if (accessKeyVO ==null) {
|
||||
response.setContentType("application/json");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.getWriter().write("{\"resultCode\":\"401\",\"message\":\"Unauthorized\"}");
|
||||
|
||||
this._jsonResult(response, HttpStatus.UNAUTHORIZED);
|
||||
return false;
|
||||
}
|
||||
|
||||
}catch(Exception ex) {
|
||||
ex.printStackTrace();
|
||||
|
||||
response.setContentType("application/json");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.getWriter().write("{\"resultCode\":\"401\",\"message\":\"Unauthorized\"}");
|
||||
|
||||
//내부 오류
|
||||
this._jsonResult(response, HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -170,8 +162,10 @@ public class CertifInterceptor implements HandlerInterceptor{
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/*모바일접속 유무*/
|
||||
private boolean isMobile(HttpServletRequest request) {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
private boolean _isMobile(HttpServletRequest request) throws Exception{
|
||||
String userAgent = request.getHeader("user-agent");
|
||||
boolean mobile1 = userAgent.matches(".*(iPhone|iPod|Android|Windows CE|BlackBerry|Symbian|Windows Phone|webOS|Opera Mini|Opera Mobi|POLARIS|IEMobile|lgtelecom|nokia|SonyEricsson).*");
|
||||
boolean mobile2 = userAgent.matches(".*(LG|SAMSUNG|Samsung).*");
|
||||
@ -180,5 +174,16 @@ public class CertifInterceptor implements HandlerInterceptor{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void _jsonResult(
|
||||
HttpServletResponse p_response
|
||||
, HttpStatus p_HttpStatus
|
||||
) throws Exception{
|
||||
p_response.setContentType("application/json");
|
||||
p_response.setCharacterEncoding("UTF-8");
|
||||
p_response.getWriter().write("{\"resultCode\":\""+p_HttpStatus.value()+"\",\"message\":\""+p_HttpStatus.getReasonPhrase()+"\"}");
|
||||
|
||||
//return "{\"resultCode\":\""+p_HttpStatus.value()+"\",\"message\":\""+p_HttpStatus.getReasonPhrase()+"\"}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,180 +0,0 @@
|
||||
package com.itn.mjonApi.cmn.interceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO;
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.LettnLoginLogVO;
|
||||
import com.itn.mjonApi.mjon.api.access.service.AccessKeyService;
|
||||
import com.itn.mjonApi.mjon.log.service.LettnLoginLogService;
|
||||
|
||||
/**
|
||||
* packageName : com.itn.mjonApi.mjon.send.web
|
||||
* fileName : SendRestController
|
||||
* author : hylee
|
||||
* date : 2023-02-15
|
||||
* description :
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* 2023-02-15 hylee 최초 생성
|
||||
*/
|
||||
//@Component
|
||||
public class CertificationInterceptor implements HandlerInterceptor{
|
||||
|
||||
@Autowired
|
||||
private AccessKeyService accessKeyService;
|
||||
|
||||
@Autowired
|
||||
private LettnLoginLogService lettnLoginLogService;
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||
throws Exception {
|
||||
|
||||
// URL 접속정보
|
||||
String referer = request.getHeader("Referer");
|
||||
//System.out.println("=====preHandle=5=apikey=refer="+referer);
|
||||
|
||||
//step0-1.log 남기기
|
||||
//step0-2.IP 체크
|
||||
{
|
||||
try{
|
||||
//step0-1.log 남기기
|
||||
LettnLoginLogVO lettnLoginLogVO = new LettnLoginLogVO();
|
||||
|
||||
//ip
|
||||
HttpServletRequest req = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest();
|
||||
String ip = req.getHeader("X-FORWARDED-FOR");
|
||||
if (ip == null){ ip = req.getRemoteAddr();}
|
||||
|
||||
lettnLoginLogVO.setConectIp(ip);
|
||||
|
||||
//사용자 여부
|
||||
lettnLoginLogVO.setUserAt("U");
|
||||
|
||||
//사용자 ID
|
||||
lettnLoginLogVO.setConectId(request.getParameter("mberId"));
|
||||
|
||||
//device type
|
||||
if(_isMobile(request)){
|
||||
lettnLoginLogVO.setDeviceType("M");
|
||||
}else{
|
||||
lettnLoginLogVO.setDeviceType("P");
|
||||
}
|
||||
|
||||
//program_nm
|
||||
lettnLoginLogVO.setProgrmFileNm("API");
|
||||
lettnLoginLogVO.setMenuNm("API");
|
||||
lettnLoginLogVO.setMenuNo("100");
|
||||
|
||||
//url
|
||||
lettnLoginLogVO.setUrl(request.getRequestURI());
|
||||
//IP 컬럼 길이를 늘려서 비교 조건 제거함 2023-04-05
|
||||
if (lettnLoginLogVO.getUrl().length()>200){ //길이문제로 오류가 발생하는 경우도 처리하도록 수정
|
||||
lettnLoginLogVO.setUrl(lettnLoginLogVO.getUrl().substring(0,199));
|
||||
}
|
||||
|
||||
lettnLoginLogService.insert(lettnLoginLogVO);
|
||||
|
||||
|
||||
//step0-2.IP 체크(호출IP체크)
|
||||
lettnLoginLogVO = lettnLoginLogService.selectIgnoreIpCnt(lettnLoginLogVO);
|
||||
int i_ignoreCnt = lettnLoginLogVO.getCnt();
|
||||
|
||||
//IP 접근 제어
|
||||
if (i_ignoreCnt>0) {
|
||||
//제한 아이피인 경우는 화면 안나옴 처리
|
||||
this._jsonResult(response, HttpStatus.FORBIDDEN);
|
||||
return false;
|
||||
}
|
||||
|
||||
}catch(Exception ex) {
|
||||
ex.printStackTrace();
|
||||
|
||||
//내부 오류
|
||||
this._jsonResult(response, HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//step1.키 검증 - accessKey & mberId 는 검증을 위한 필수값
|
||||
{
|
||||
try{
|
||||
AccessKeyVO accessKeyVO = new AccessKeyVO();
|
||||
accessKeyVO.setAccessKey(request.getParameter("accessKey"));
|
||||
accessKeyVO.setMberId(request.getParameter("mberId"));
|
||||
accessKeyVO.setCallInfo(referer);
|
||||
|
||||
accessKeyVO = accessKeyService.selectRKey(accessKeyVO);
|
||||
|
||||
//인증 실패
|
||||
if (accessKeyVO ==null) {
|
||||
|
||||
this._jsonResult(response, HttpStatus.UNAUTHORIZED);
|
||||
return false;
|
||||
}
|
||||
|
||||
}catch(Exception ex) {
|
||||
ex.printStackTrace();
|
||||
|
||||
//내부 오류
|
||||
this._jsonResult(response, HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
|
||||
ModelAndView modelAndView) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
System.out.println("=====postHandle=4=apikey==");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
|
||||
throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
System.out.println("=====afterCompletion=4=apikey==");
|
||||
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/*모바일접속 유무*/
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
private boolean _isMobile(HttpServletRequest request) throws Exception{
|
||||
String userAgent = request.getHeader("user-agent");
|
||||
boolean mobile1 = userAgent.matches(".*(iPhone|iPod|Android|Windows CE|BlackBerry|Symbian|Windows Phone|webOS|Opera Mini|Opera Mobi|POLARIS|IEMobile|lgtelecom|nokia|SonyEricsson).*");
|
||||
boolean mobile2 = userAgent.matches(".*(LG|SAMSUNG|Samsung).*");
|
||||
if(mobile1 || mobile2) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void _jsonResult(
|
||||
HttpServletResponse p_response
|
||||
, HttpStatus p_HttpStatus
|
||||
) throws Exception{
|
||||
p_response.setContentType("application/json");
|
||||
p_response.setCharacterEncoding("UTF-8");
|
||||
p_response.getWriter().write("{\"resultCode\":\""+p_HttpStatus.value()+"\",\"message\":\""+p_HttpStatus.getReasonPhrase()+"\"}");
|
||||
|
||||
//return "{\"resultCode\":\""+p_HttpStatus.value()+"\",\"message\":\""+p_HttpStatus.getReasonPhrase()+"\"}";
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,19 +1,23 @@
|
||||
package com.itn.mjonApi.mjon.api.access.web;
|
||||
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.SendMsgVO;
|
||||
import com.itn.mjonApi.cmn.msg.PlainResponse;
|
||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||
import com.itn.mjonApi.mjon.api.access.service.AccessKeyService;
|
||||
import com.itn.mjonApi.mjon.api.access.service.AccessTokenService;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.SendMsgVO;
|
||||
import com.itn.mjonApi.cmn.msg.PlainResponse;
|
||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||
import com.itn.mjonApi.mjon.api.access.service.AccessKeyService;
|
||||
import com.itn.mjonApi.mjon.api.access.service.AccessTokenService;
|
||||
|
||||
/**
|
||||
* @author User
|
||||
@ -30,6 +34,46 @@ public class AccessKeyRestController {
|
||||
@Autowired
|
||||
private AccessTokenService accessTokenService;
|
||||
|
||||
//
|
||||
/**
|
||||
* api test for get
|
||||
* @return
|
||||
*
|
||||
*/
|
||||
@RequestMapping(value="/api/accessTest/Test", method= {RequestMethod.GET, RequestMethod.POST})
|
||||
public ResponseEntity<RestResponse> apiAccessTestTestGet(
|
||||
SendMsgVO sendMsgVO
|
||||
){
|
||||
|
||||
return ResponseEntity.ok(
|
||||
new RestResponse(
|
||||
HttpStatus.OK
|
||||
, HttpStatus.OK.getReasonPhrase()
|
||||
, LocalDateTime.now()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
/**
|
||||
* api test for post
|
||||
* @return
|
||||
*
|
||||
*/
|
||||
@PostMapping("/api/accessTest/TestPost")
|
||||
public ResponseEntity<RestResponse> apiAccessTestTestPost(
|
||||
SendMsgVO sendMsgVO
|
||||
){
|
||||
|
||||
return ResponseEntity.ok(
|
||||
new RestResponse(
|
||||
HttpStatus.OK
|
||||
, HttpStatus.OK.getReasonPhrase()
|
||||
, LocalDateTime.now()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
/**
|
||||
* @param p_name_1
|
||||
|
||||
@ -1,265 +0,0 @@
|
||||
package com.itn.mjonApi.mjon.api.web;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.SendMsgVO;
|
||||
import com.itn.mjonApi.cmn.msg.PlainResponse;
|
||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||
import com.itn.mjonApi.mjon.api.access.service.AccessKeyService;
|
||||
import com.itn.mjonApi.mjon.api.access.service.AccessTokenService;
|
||||
|
||||
/**
|
||||
* @author User
|
||||
*
|
||||
* access key( + user_id) 방식의 STEP1 api 구현
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
public class AccessKeyRestController {
|
||||
|
||||
@Autowired
|
||||
private AccessKeyService accessKeyService;
|
||||
|
||||
@Autowired
|
||||
private AccessTokenService accessTokenService;
|
||||
|
||||
//
|
||||
/**
|
||||
* @param p_name_1
|
||||
* @param p_name_2
|
||||
* @return
|
||||
*
|
||||
* 동일 내용을 1천명(?) 까지 보내기 가능
|
||||
*
|
||||
* grp_id, 결과코드, 결과msg
|
||||
*
|
||||
* 3가지 형태로 제공 가능
|
||||
* 1.json
|
||||
* 2.plain text
|
||||
*
|
||||
*/
|
||||
@PostMapping("/api/accessKey/SendMsg")
|
||||
//@GetMapping("/api/accessKey/SendMsg")
|
||||
public ResponseEntity<RestResponse> apiaccessKeysendMsg(
|
||||
@ModelAttribute SendMsgVO sendMsgVO
|
||||
){
|
||||
//step2.api 처리
|
||||
//단문 문자 발송 처리
|
||||
|
||||
//step3.결과 전달
|
||||
System.out.println("name_1");
|
||||
System.out.println(sendMsgVO.getAccessKey());
|
||||
System.out.println(sendMsgVO.getMberId());
|
||||
System.out.println(sendMsgVO.getSender());
|
||||
System.out.println(sendMsgVO.getReceiver());
|
||||
System.out.println(sendMsgVO.getMsg());
|
||||
System.out.println(sendMsgVO.getMsg_type());
|
||||
System.out.println(sendMsgVO.getTitle());
|
||||
System.out.println(sendMsgVO.getRdate());
|
||||
System.out.println(sendMsgVO.getRtime());
|
||||
System.out.println(sendMsgVO.getTestmodeYn());
|
||||
System.out.println("name_12");
|
||||
|
||||
//System.out.println(p_name_1);
|
||||
//System.out.println(p_name_2);
|
||||
|
||||
//sendMsg 문자 발송 전 체크 사항
|
||||
//step1.발신자 전화번호 사용 가능 여부 체크(해당 사용자의 기 등록된 번호만 발송 가능)
|
||||
// 1010
|
||||
|
||||
//step2.수신자 전화번호 정상 여부 체크(정상 번호에 대해서만 발송 가능)
|
||||
// 1020
|
||||
|
||||
//step3.문자 내용 정상 여부 확인 - 스미싱 문구는 발송 안됨
|
||||
// 1030
|
||||
|
||||
//step4.치환명 정상 여부 확인
|
||||
// 1040
|
||||
|
||||
//step5.발송일시 정상여부 확인
|
||||
// 1050
|
||||
|
||||
//step6.문자 타입에 따른 비용 처리 가능 여부 확인
|
||||
// 1060
|
||||
|
||||
return ResponseEntity.ok(
|
||||
new RestResponse(
|
||||
HttpStatus.OK
|
||||
, ""
|
||||
, LocalDateTime.now()
|
||||
, "grp100"
|
||||
)
|
||||
);
|
||||
|
||||
//AccessKeyVO
|
||||
}
|
||||
|
||||
@GetMapping("/api/accessKey/SendMsgPlain")
|
||||
public String apiaccessKeysendMsgPlain(
|
||||
@ModelAttribute SendMsgVO sendMsgVO
|
||||
){
|
||||
//step2.api 처리
|
||||
//단문 문자 발송 처리
|
||||
|
||||
//step3.결과 전달
|
||||
System.out.println("name_1");
|
||||
System.out.println(sendMsgVO.getAccessKey());
|
||||
System.out.println(sendMsgVO.getMberId());
|
||||
System.out.println(sendMsgVO.getSender());
|
||||
System.out.println(sendMsgVO.getReceiver());
|
||||
System.out.println(sendMsgVO.getMsg());
|
||||
System.out.println(sendMsgVO.getMsg_type());
|
||||
System.out.println(sendMsgVO.getTitle());
|
||||
System.out.println(sendMsgVO.getRdate());
|
||||
System.out.println(sendMsgVO.getRtime());
|
||||
System.out.println(sendMsgVO.getTestmodeYn());
|
||||
System.out.println("name_12");
|
||||
|
||||
//System.out.println(p_name_1);
|
||||
//System.out.println(p_name_2);
|
||||
|
||||
//sendMsg 문자 발송 전 체크 사항
|
||||
//step1.발신자 전화번호 사용 가능 여부 체크(해당 사용자의 기 등록된 번호만 발송 가능)
|
||||
// 1010
|
||||
|
||||
//step2.수신자 전화번호 정상 여부 체크(정상 번호에 대해서만 발송 가능)
|
||||
// 1020
|
||||
|
||||
//step3.문자 내용 정상 여부 확인 - 스미싱 문구는 발송 안됨
|
||||
// 1030
|
||||
|
||||
//step4.치환명 정상 여부 확인
|
||||
// 1040
|
||||
|
||||
//step5.발송일시 정상여부 확인
|
||||
// 1050
|
||||
|
||||
//step6.문자 타입에 따른 비용 처리 가능 여부 확인
|
||||
// 1060
|
||||
|
||||
return this.MakePlainResponseResult(
|
||||
new PlainResponse(
|
||||
HttpStatus.OK
|
||||
, ""
|
||||
, LocalDateTime.now()
|
||||
)
|
||||
, "grp100"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
/**
|
||||
* @param p_name_1
|
||||
* @param p_name_2
|
||||
* @return
|
||||
*
|
||||
* 잔액 확인
|
||||
* 2가지 형태로 제공 가능
|
||||
* 1.json
|
||||
* 2.plain text
|
||||
*
|
||||
*/
|
||||
@GetMapping("/api/accessKey/Remain")
|
||||
public ResponseEntity<RestResponse> apiaccessKeysendRemain(
|
||||
@ModelAttribute SendMsgVO sendMsgVO
|
||||
){
|
||||
//step2.api 처리
|
||||
//단문 문자 발송 처리
|
||||
|
||||
//step3.결과 전달
|
||||
System.out.println("name_1");
|
||||
System.out.println(sendMsgVO.getAccessKey());
|
||||
System.out.println(sendMsgVO.getMberId());
|
||||
System.out.println("name_12");
|
||||
|
||||
//System.out.println(p_name_1);
|
||||
//System.out.println(p_name_2);
|
||||
|
||||
//remain 체크 사항
|
||||
//step1.잔액 확인 여부 체크
|
||||
// 5010
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
||||
jsonObject.put("SMS", "50");
|
||||
jsonObject.put("LMS", "30");
|
||||
jsonObject.put("MMS", "20");
|
||||
|
||||
return ResponseEntity.ok(
|
||||
new RestResponse(
|
||||
HttpStatus.OK
|
||||
, ""
|
||||
, LocalDateTime.now()
|
||||
, jsonObject
|
||||
)
|
||||
);
|
||||
|
||||
//AccessKeyVO
|
||||
}
|
||||
|
||||
//
|
||||
/**
|
||||
* @param p_name_1
|
||||
* @param p_name_2
|
||||
* @return
|
||||
*
|
||||
* 잔액 확인
|
||||
*
|
||||
*/
|
||||
@GetMapping("/api/accessKey/RemainPlain")
|
||||
public String apiaccessKeysendRemainPlain(
|
||||
@ModelAttribute SendMsgVO sendMsgVO
|
||||
){
|
||||
//step2.api 처리
|
||||
//단문 문자 발송 처리
|
||||
|
||||
//step3.결과 전달
|
||||
System.out.println("name_1");
|
||||
System.out.println(sendMsgVO.getAccessKey());
|
||||
System.out.println(sendMsgVO.getMberId());
|
||||
System.out.println("name_12");
|
||||
|
||||
//System.out.println(p_name_1);
|
||||
//System.out.println(p_name_2);
|
||||
|
||||
//remain 체크 사항
|
||||
//step1.잔액 확인 여부 체크
|
||||
// 5010
|
||||
|
||||
return this.MakePlainResponseResult(
|
||||
new PlainResponse(
|
||||
HttpStatus.OK
|
||||
, ""
|
||||
, LocalDateTime.now()
|
||||
)
|
||||
, "50|30|20"
|
||||
);
|
||||
|
||||
//AccessKeyVO
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
// private function
|
||||
//
|
||||
//
|
||||
private String MakePlainResponseResult(PlainResponse plainResponse, String p_code) {
|
||||
String v_ret = "";
|
||||
v_ret = Integer.toString(plainResponse.getResultCode())
|
||||
+ "|" + plainResponse.getMessage()
|
||||
+ "|" + p_code;
|
||||
|
||||
return v_ret;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user