Merge branch 'master' of
http://yongjoon.cho@vcs.iten.co.kr:9999/hylee/mjon_api
This commit is contained in:
commit
e735209606
58
pom.xml
58
pom.xml
@ -34,7 +34,7 @@
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<!-- <scope>test</scope>-->
|
||||
<!-- <scope>test</scope>-->
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.modelmapper/modelmapper -->
|
||||
@ -67,26 +67,43 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 수정시 바로 재기동 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
</dependency>
|
||||
<!-- 수정시 바로 재기동 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- DB Logback -->
|
||||
<dependency>
|
||||
<groupId>org.bgee.log4jdbc-log4j2</groupId>
|
||||
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
|
||||
<version>1.16</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JSON Object -->
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- DB Logback -->
|
||||
<dependency>
|
||||
<groupId>org.bgee.log4jdbc-log4j2</groupId>
|
||||
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
|
||||
<version>1.16</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JSON Object -->
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.13</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@ -132,3 +149,4 @@
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ public class MjonApiApplication {
|
||||
SpringApplication.run(MjonApiApplication.class, args);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,71 @@
|
||||
package com.itn.mjonApi.cmn.config;
|
||||
|
||||
import com.itn.mjonApi.cmn.interceptor.RestTemplateLogInterceptor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.client.BufferingClientHttpRequestFactory;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Duration;
|
||||
|
||||
/**
|
||||
* packageName : com.itn.mjonApi.cmn.config
|
||||
* fileName : RestTemplateConfig
|
||||
* author : hylee
|
||||
* date : 2023-05-08
|
||||
* description :
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* 2023-05-08 hylee 최초 생성
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
public class RestTemplateConfig {
|
||||
|
||||
@Value("${api.root.url}")
|
||||
private String rootUrl;
|
||||
|
||||
@Bean
|
||||
public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
|
||||
|
||||
// Apache HttpComponents
|
||||
HttpClient httpClient = HttpClientBuilder.create()
|
||||
.setMaxConnTotal(50)//최대 커넥션 수
|
||||
.setMaxConnPerRoute(20)
|
||||
.build(); //각 호스트(IP와 Port 의 조합)당 커넥션 풀에 생성가능한 커넥션 수
|
||||
|
||||
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory();
|
||||
factory.setHttpClient(httpClient);
|
||||
|
||||
RestTemplate restTemplate = restTemplateBuilder
|
||||
.requestFactory(() -> factory)
|
||||
.rootUri(String.format(rootUrl))
|
||||
.setReadTimeout(Duration.ofSeconds(5)) // read timeout
|
||||
.setConnectTimeout(Duration.ofSeconds(5)) // connection timeout
|
||||
.additionalMessageConverters(new StringHttpMessageConverter(StandardCharsets.UTF_8)) //메시지 컨버터 추가
|
||||
.additionalInterceptors(new RestTemplateLogInterceptor())
|
||||
.build();
|
||||
|
||||
// 로깅 레벨에 따라 BufferingClientHttpRequest 사용
|
||||
// if (log.isDebugEnabled()) {
|
||||
if (log.isInfoEnabled()) {
|
||||
ClientHttpRequestFactory clientHttpRequestFactory = new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory());
|
||||
restTemplate.setRequestFactory(clientHttpRequestFactory);
|
||||
return restTemplate;
|
||||
}
|
||||
return restTemplate;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
62
src/main/java/com/itn/mjonApi/cmn/config/SwaggerConfig.java
Normal file
62
src/main/java/com/itn/mjonApi/cmn/config/SwaggerConfig.java
Normal file
@ -0,0 +1,62 @@
|
||||
package com.itn.mjonApi.cmn.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* packageName : com.itn.mjonApi.cmn.config
|
||||
* fileName : SwaggerConfig
|
||||
* author : hylee
|
||||
* date : 2023-05-10
|
||||
* description :
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* 2023-05-10 hylee 최초 생성
|
||||
*/
|
||||
@Configuration
|
||||
@EnableWebMvc
|
||||
public class SwaggerConfig {
|
||||
|
||||
|
||||
private ApiInfo swaggerInfo() {
|
||||
return new ApiInfoBuilder().title("munjaon API")
|
||||
.description("munjaon API Docs").build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Docket swaggerApi() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.consumes(getConsumeContentTypes())
|
||||
.produces(getProduceContentTypes())
|
||||
.apiInfo(swaggerInfo()).select()
|
||||
.apis(RequestHandlerSelectors.basePackage("com.itn.mjonApi.mjon"))
|
||||
.paths(PathSelectors.any())
|
||||
.build()
|
||||
.useDefaultResponseMessages(false);
|
||||
}
|
||||
|
||||
private Set<String> getConsumeContentTypes() {
|
||||
Set<String> consumes = new HashSet<>();
|
||||
consumes.add("application/json;charset=UTF-8");
|
||||
consumes.add("application/x-www-form-urlencoded");
|
||||
return consumes;
|
||||
}
|
||||
|
||||
private Set<String> getProduceContentTypes() {
|
||||
Set<String> produces = new HashSet<>();
|
||||
produces.add("application/json;charset=UTF-8");
|
||||
return produces;
|
||||
}
|
||||
|
||||
}
|
||||
@ -5,7 +5,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import com.itn.mjonApi.cmn.interceptor.CertificationInterceptor;
|
||||
import com.itn.mjonApi.cmn.interceptor.CertifInterceptor;
|
||||
|
||||
/**
|
||||
* packageName : com.itn.mjonApi.mjon.send.web
|
||||
@ -23,8 +23,8 @@ import com.itn.mjonApi.cmn.interceptor.CertificationInterceptor;
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
|
||||
@Bean
|
||||
public CertificationInterceptor certificationInterceptor(){
|
||||
return new CertificationInterceptor();
|
||||
public CertifInterceptor certificationInterceptor(){
|
||||
return new CertifInterceptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
38
src/main/java/com/itn/mjonApi/cmn/context/ContextIdgen.java
Normal file
38
src/main/java/com/itn/mjonApi/cmn/context/ContextIdgen.java
Normal file
@ -0,0 +1,38 @@
|
||||
package com.itn.mjonApi.cmn.context;
|
||||
|
||||
import com.itn.mjonApi.cmn.idgen.service.impl.IdgenServiceImpl;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* packageName : com.itn.mjonApi.cmn.context
|
||||
* fileName : ContextIdgen
|
||||
* author : hylee
|
||||
* date : 2023-04-24
|
||||
* description :
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* 2023-04-24 hylee 최초 생성
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class ContextIdgen {
|
||||
|
||||
/**
|
||||
* @discription apiLog Ids
|
||||
* @return
|
||||
*/
|
||||
@Bean(name="apiLog")
|
||||
public IdgenServiceImpl apiLog(){
|
||||
IdgenServiceImpl idgenServiceImpl = new IdgenServiceImpl();
|
||||
idgenServiceImpl.setCipers(13); // cipers: prefix를 제외한 아이디의 길이 지정
|
||||
idgenServiceImpl.setFillChar('0'); // fillChar: 0을 대신하여 표현되는 문자
|
||||
idgenServiceImpl.setPrefix("APILOG_"); // prefix: 아이디의 앞에 고정적으로 붙이고자 하는 설정값 지정
|
||||
idgenServiceImpl.setTableName("API_LOG_ID"); // tableName - dataSoure 에 설정된 DB에 SEQ 테이블에 tableName 컬럼에 참조할 값
|
||||
return idgenServiceImpl;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,14 +1,16 @@
|
||||
package com.itn.mjonApi.cmn.idgen.mapper;
|
||||
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.IdgenVO;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface IdgenMapper {
|
||||
|
||||
// @Select("select * from ids")
|
||||
List<IdgenVO> findByTableName(String tableName);
|
||||
@Select("select * from ids where TABLE_NAME = #{tableName}")
|
||||
IdgenVO findByTableName(String tableName);
|
||||
|
||||
@Insert("INSERT INTO IDS VALUES (#{tableName}, #{nextId}) ON DUPLICATE KEY UPDATE NEXT_ID=#{nextId}")
|
||||
void save(IdgenVO idgenVO);
|
||||
}
|
||||
|
||||
@ -15,16 +15,8 @@ import java.io.Serializable;
|
||||
public class IdgenVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -7865729705175845268L;
|
||||
private Integer msgId; /*auto_increment comment '문자 고유아이디' primary key*/
|
||||
private String mberId; /*comment '회원 아이디'*/
|
||||
private String esntlId; /*null comment '회원고유 아이디'*/
|
||||
private String subject; /*null comment '문자 제목'*/
|
||||
private String smsTxt; /*null comment '문자 내용'*/
|
||||
private String smsLen; /*null comment '문자 길이'*/
|
||||
private String atchFileId1; /*null comment '첨부파일번호'*/
|
||||
private String atchFileId2; /*null comment '첨부파일번호'*/
|
||||
private String atchFileId3; /*null comment '첨부파일번호'*/
|
||||
private String regdate; /*null comment '등록일자'*/
|
||||
private String msgType; /*default 'S' null comment '문자종류'*/
|
||||
|
||||
private String tableName;
|
||||
private int nextId;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
package com.itn.mjonApi.cmn.idgen.service;
|
||||
|
||||
/**
|
||||
* packageName : com.itn.mjonApi.cmn.idgen.service
|
||||
* fileName : IdgenService
|
||||
* author : hylee
|
||||
* date : 2023-04-24
|
||||
* description :
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* 2023-04-24 hylee 최초 생성
|
||||
*/
|
||||
public interface IdgenService {
|
||||
public String getNextStringId();
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
package com.itn.mjonApi.cmn.idgen.service.impl;
|
||||
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.IdgenMapper;
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.IdgenVO;
|
||||
import com.itn.mjonApi.cmn.idgen.service.IdgenService;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* packageName : com.itn.mjonApi.cmn.context
|
||||
* fileName : ContextIdgen
|
||||
* author : hylee
|
||||
* date : 2023-04-24
|
||||
* description : 전자정부 IDS 구현
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* 2023-04-24 hylee 최초 생성
|
||||
*/
|
||||
@Slf4j
|
||||
@Setter
|
||||
public class IdgenServiceImpl implements IdgenService {
|
||||
|
||||
private String prefix;
|
||||
private int cipers;
|
||||
private char fillChar;
|
||||
private String tableName;
|
||||
|
||||
@Autowired
|
||||
private IdgenMapper idgenMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public String getNextStringId() {
|
||||
|
||||
String prefixTemp = prefix;
|
||||
|
||||
// 기존에 있는 tableName인지 확인
|
||||
IdgenVO idgenVO = idgenMapper.findByTableName(tableName);
|
||||
|
||||
// select 한 idgen이 없으면 초기 셋팅
|
||||
if(idgenVO == null){
|
||||
idgenVO = new IdgenVO();
|
||||
idgenVO.setNextId(1);
|
||||
idgenVO.setTableName(tableName);
|
||||
}else{
|
||||
// select 한 idgen이 있으면 +1
|
||||
idgenVO.setNextId(idgenVO.getNextId()+1);
|
||||
}
|
||||
|
||||
// nextId를 제외한 String 만들기
|
||||
prefixTemp = this.getMakeNextIdFirstString(prefixTemp, idgenVO);
|
||||
|
||||
// upsert 쿼리 실행
|
||||
idgenMapper.save(idgenVO);
|
||||
|
||||
// nextId 값 만들기
|
||||
String nextId = prefixTemp + idgenVO.getNextId();
|
||||
|
||||
log.info(" userId : [{}]", nextId);
|
||||
return nextId;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param prefixTemp
|
||||
* @param idgenVO
|
||||
* @author hylee
|
||||
* @discription nextId를 제외한 String 만들기
|
||||
* @date 2023-04-24
|
||||
* @return
|
||||
*/
|
||||
private String getMakeNextIdFirstString(String prefixTemp, IdgenVO idgenVO) {
|
||||
// fillChar 값이 들어갈 자리값 계산
|
||||
int fillCharSize = cipers - (int)(Math.log10(idgenVO.getNextId())+1);
|
||||
// prefix와 NextId를 제외한 자리에 fillchar값 넣기
|
||||
for(int i=0; i<fillCharSize; i++){
|
||||
prefixTemp = prefixTemp +fillChar;
|
||||
}
|
||||
return prefixTemp;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,184 @@
|
||||
package com.itn.mjonApi.cmn.interceptor;
|
||||
|
||||
//import java.sql.Date;
|
||||
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO;
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.LettnLoginLogVO;
|
||||
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.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 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 CertifInterceptor implements HandlerInterceptor{
|
||||
|
||||
@Autowired
|
||||
private AccessKeyService accessKeyService;
|
||||
|
||||
@Autowired
|
||||
private LettnLoginLogService lettnLoginLogService;
|
||||
|
||||
@Resource(name = "apiLog")
|
||||
private IdgenService idgenApiLogId;
|
||||
|
||||
|
||||
@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==");
|
||||
|
||||
|
||||
|
||||
//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));
|
||||
}
|
||||
|
||||
// logId :: idgen 사용으로 수정 => 2023-04-25
|
||||
lettnLoginLogVO.setLogId(idgenApiLogId.getNextStringId());
|
||||
lettnLoginLogService.insert(lettnLoginLogVO);
|
||||
|
||||
|
||||
//step0-2.IP 체크
|
||||
lettnLoginLogVO = lettnLoginLogService.selectIgnoreIpCnt(lettnLoginLogVO);
|
||||
int i_ignoreCnt = lettnLoginLogVO.getCnt();
|
||||
|
||||
if (i_ignoreCnt>0) {
|
||||
//제한 아이피인 경우는 화면 안나옴 처리
|
||||
response.setContentType("application/json");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.getWriter().write("{\"resultCode\":\"403\",\"message\":\"Forbidden\"}");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}catch(Exception ex) {
|
||||
ex.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//step1.키 검증 - accessKey & mberId 는 검증을 위한 필수값
|
||||
{
|
||||
try{
|
||||
AccessKeyVO accessKeyVO = new AccessKeyVO();
|
||||
accessKeyVO.setAccessKey(request.getParameter("accessKey"));
|
||||
accessKeyVO.setMberId(request.getParameter("mberId"));
|
||||
|
||||
accessKeyVO = accessKeyService.selectRKey(accessKeyVO);
|
||||
|
||||
if (accessKeyVO ==null) {
|
||||
response.setContentType("application/json");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.getWriter().write("{\"resultCode\":\"401\",\"message\":\"Unauthorized\"}");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}catch(Exception ex) {
|
||||
ex.printStackTrace();
|
||||
|
||||
response.setContentType("application/json");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.getWriter().write("{\"resultCode\":\"401\",\"message\":\"Unauthorized\"}");
|
||||
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,10 +1,5 @@
|
||||
package com.itn.mjonApi.cmn.interceptor;
|
||||
|
||||
//import java.sql.Date;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@ -17,7 +12,7 @@ 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.service.AccessKeyService;
|
||||
import com.itn.mjonApi.mjon.api.access.service.AccessKeyService;
|
||||
import com.itn.mjonApi.mjon.log.service.LettnLoginLogService;
|
||||
|
||||
/**
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
package com.itn.mjonApi.cmn.interceptor;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpRequest;
|
||||
import org.springframework.http.client.ClientHttpRequestExecution;
|
||||
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||
import org.springframework.http.client.ClientHttpResponse;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* packageName : com.itn.mjonApi.cmn.interceptor
|
||||
* fileName : RestTemplateLoggingInterceptor
|
||||
* author : hylee
|
||||
* date : 2023-05-08
|
||||
* description :
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* 2023-05-08 hylee 최초 생성
|
||||
*/
|
||||
@Slf4j
|
||||
public class RestTemplateLogInterceptor implements ClientHttpRequestInterceptor {
|
||||
|
||||
@Override
|
||||
public ClientHttpResponse intercept(HttpRequest req, byte[] body, ClientHttpRequestExecution ex) throws IOException {
|
||||
final String sessionNumber = makeSessionNumber();
|
||||
printRequest(sessionNumber, req, body);
|
||||
ClientHttpResponse response = ex.execute(req, body);
|
||||
printResponse(sessionNumber, response);
|
||||
return response;
|
||||
}
|
||||
|
||||
private String makeSessionNumber() {
|
||||
return Integer.toString((int) (Math.random() * 1000000));
|
||||
}
|
||||
|
||||
private void printRequest(final String sessionNumber, final HttpRequest req, final byte[] body) {
|
||||
log.info("\n [[Request]] \n[{}] \n URI: {}\n, Method: {}\n, Headers:{}\n, Body:{} \n",
|
||||
sessionNumber, req.getURI(), req.getMethod(), req.getHeaders(), new String(body, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
private void printResponse(final String sessionNumber, final ClientHttpResponse res) throws IOException {
|
||||
String body = new BufferedReader(new InputStreamReader(res.getBody(), StandardCharsets.UTF_8)).lines()
|
||||
.collect(Collectors.joining("\n"));
|
||||
|
||||
log.info("\n [[Response]] \n[{}] \n Status: {}\n, Headers:{}\n, Body:{}\n ",
|
||||
sessionNumber, res.getStatusCode(), res.getHeaders(), body);
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.itn.mjonApi.mjon.api.service;
|
||||
package com.itn.mjonApi.mjon.api.access.service;
|
||||
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO;
|
||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.itn.mjonApi.mjon.api.service;
|
||||
package com.itn.mjonApi.mjon.api.access.service;
|
||||
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO;
|
||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.itn.mjonApi.mjon.api.service.impl;
|
||||
package com.itn.mjonApi.mjon.api.access.service.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
@ -8,10 +8,9 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO;
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.IdgenVO;
|
||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||
import com.itn.mjonApi.mjon.api.service.AccessKeyService;
|
||||
import com.itn.mjonApi.mjon.api.service.mapper.AccessKeyMapper;
|
||||
import com.itn.mjonApi.mjon.api.access.service.AccessKeyService;
|
||||
import com.itn.mjonApi.mjon.api.access.service.mapper.AccessKeyMapper;
|
||||
|
||||
@Service
|
||||
public class AccessKeyServiceImpl implements AccessKeyService {
|
||||
@ -1,4 +1,4 @@
|
||||
package com.itn.mjonApi.mjon.api.service.impl;
|
||||
package com.itn.mjonApi.mjon.api.access.service.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
@ -10,8 +10,8 @@ import org.springframework.stereotype.Service;
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO;
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.IdgenVO;
|
||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||
import com.itn.mjonApi.mjon.api.service.AccessTokenService;
|
||||
import com.itn.mjonApi.mjon.api.service.mapper.AccessTokenMapper;
|
||||
import com.itn.mjonApi.mjon.api.access.service.AccessTokenService;
|
||||
import com.itn.mjonApi.mjon.api.access.service.mapper.AccessTokenMapper;
|
||||
|
||||
@Service
|
||||
public class AccessTokenServiceImpl implements AccessTokenService {
|
||||
@ -1,9 +1,7 @@
|
||||
package com.itn.mjonApi.mjon.api.service.mapper;
|
||||
package com.itn.mjonApi.mjon.api.access.service.mapper;
|
||||
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO;
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.IdgenVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package com.itn.mjonApi.mjon.api.service.mapper;
|
||||
package com.itn.mjonApi.mjon.api.access.service.mapper;
|
||||
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO;
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.IdgenVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -0,0 +1,262 @@
|
||||
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 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.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @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
|
||||
*
|
||||
*/
|
||||
@GetMapping("/api/accessKey/SendMsg")
|
||||
public ResponseEntity<RestResponse> apiaccessKeysendMsg(
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,175 @@
|
||||
package com.itn.mjonApi.mjon.api.send.mapper.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* packageName : com.itn.mjonApi.mjon.api.send.mapper.domain
|
||||
* fileName : MjonMsgVO
|
||||
* author : hylee
|
||||
* date : 2023-05-09
|
||||
* description :
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* 2023-05-09 hylee 최초 생성
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MjonMsgVO implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String msgId ;// '문자ID',
|
||||
private String userId ; // '문자온 일반회원ID',
|
||||
private String agentFlag ;//'전송사코드(1:아이하트,2:...)',
|
||||
private String userData; //'(I)사용자 정의 코드(참조용으로 사용되는 것으로 메시지 전송 시에는 사용되지 않는다-문자온/아이하트 참조키용)',
|
||||
private String msgSeq; // '(I)메시지의 고유번호. 자동 증가하는 것으로 MSG_DATA의 PRIMARY KEY가 된다.',
|
||||
private String curState; // '상태 값(발송요청:0, 전송 중:1, 전송:2, 결과수신:3)',
|
||||
private String sentDate; // '메시지를 전송한 시각',
|
||||
private String rsltDate; // '핸드폰에 전달된 시간 (이통사가 핸드폰이 수신했다고 주장하는 시간)',
|
||||
private String reportDate; // '레포트 처리한 시간',
|
||||
private String reqDate; // '예약일시',
|
||||
private String rsltCode; // '결과처리코드',
|
||||
private String rsltCode2; // '결과처리 상세코드',
|
||||
private String rsltNet; // '결과처리 통신사',
|
||||
private String callTo; // '수신번호 (하이픈 등의 문자를 제외한 12byte이하의 숫자로 입력한다.)',
|
||||
private String[] callToList; // '수신번호리스트',
|
||||
private String callFrom; // '발신번호 (하이픈 등의 문자를 제외한 12byte이하의 숫자로 입력한다.)',
|
||||
private String subject; // 'MMS용 메시지제목',
|
||||
private String smsTxt; // 'SMS용 메시지본문',
|
||||
private String smsTxtArea;//문자 작성 화면 본문 내용
|
||||
private String msgType; // '메시지의 (4: SMS 전송, 5: URL 전송, 6: MMS전송, 7: BARCODE전송, 8: 카카오 알림톡 전송)',
|
||||
private String msgKind; // '문자 종류 일반:N, 광고:A, 선거:C',
|
||||
private String msgPayCode; // '재전송 기능에 의한 최종전송콘텐트 종류 저장',
|
||||
private String contSeq; // COMMENT 'MMS의 콘텐츠 Key(MMS_CONTENTS_INFO의 CONT_SEQ)',
|
||||
private String msgTypeResend; // '재전송할 문자 타입. 값이 있으면 재전송. 없으면 단 건 전송',
|
||||
private String centerSeqResend; // '재전송할 센터. NPro 내부적으로 사용함.',
|
||||
private String msgNoticetalkSenderKey; // '카카오 알림톡에 등록된 사용자 고유키',
|
||||
private String msgNoticetalkTmpKey; // '카카오 알림톡에 등록된 문자 템플릿 고유키',
|
||||
private String msgResendCount; // '첫 번째 전송 값 실패하여 재전송한 카운트.(기본값 : 0, 전송 : 1, 재전송 : 2)',
|
||||
private String msgResenddate; // '재전송된 시간',
|
||||
private String sentDatePre; // '이전 메시지를 전송한 시각',
|
||||
private String rsltDatePre; // '이전 핸드폰에 전달된 시간',
|
||||
private String reportDatePre; // '이전 레포트 처리한 시간',
|
||||
private String rsltCodePre; // '이전 결과처리코드',
|
||||
private String rsltCode2Pre; // '이전 결과처리 상세코드 (결과코드는 아래 표 참조)',
|
||||
private String rsltNetPre; // '이전 결과처리 통신사',
|
||||
private String conectMthd; // '접속한 기기(01:웹 , 02:모바일, 03: 애드온모듈)',
|
||||
private String conectMthdTxt; // '접속한 기기텍스트(01:웹 , 02:모바일, 03: 애드온모듈)',
|
||||
private String repAgent; // e대표전송사
|
||||
private String agentCode; // '전송사(01:아이하트 , ...)',
|
||||
private String agentCodeTxt; // '전송사텍스트(01:아이하트 , ...)',
|
||||
private String curStateTxt; // '현제상태텍스트(01:아이하트 , ...)',
|
||||
private String msgTypeTxt; // '메세지타입(4: SMS 전송, 5: URL 전송, 6: MMS전송, 7: BARCODE전송, 8: 카카오 알림톡 전송)',
|
||||
private String sentDateTxt; // '전송시간 TXT',
|
||||
private String searchCondition2; // '조회조건2',
|
||||
private String searchCondition3; // '조회조건3',
|
||||
private String searchCondition4; // '조회조건3',
|
||||
private String searchCondition5; // '조회조건3',
|
||||
private String delFlag; // '사용자 삭제여부(N:미삭제, Y:삭제)'
|
||||
private String delFlagTxt; // '사용자 삭제여부 텍스트(N:미삭제, Y:삭제)'
|
||||
private String mmsSubject; // '메세지 타이틀'
|
||||
private String fileCnt; // 첨부파일 갯수
|
||||
private String fileType1; // '파일 타입1'
|
||||
private String fileName1; // '파일이름1'
|
||||
private String fileType2; // '파일 타입2'
|
||||
private String fileName2; // '파일이름2'
|
||||
private String fileType3; // '파일 타입3'
|
||||
private String fileName3; // '파일이름3'
|
||||
private String msgGroupId; // 전송그룹ID (대량문자의 경우 하나의 그룹으로 세팅)
|
||||
private String msgGroupCnt; // 전송그룹 카운트
|
||||
private String[] imgFilePath; // 그림 이미지 경로
|
||||
private String neoType; // 아이엠오 장문, 그림 타입 지정
|
||||
private int msgCnt; // 아이엠오 장문, 그림 타입 지정
|
||||
private String eachPrice ; // 전송문자 개별가격
|
||||
private String totPrice ; // 전송문자 토탈가격
|
||||
private String beforeUrl ; //이전 url
|
||||
private String reserveYn ; //예약문자 여부
|
||||
private String reserveCYn ; //예약문자 취소 여부
|
||||
private String cancelDate; //예약 취소 일자
|
||||
|
||||
|
||||
private String sendRate; // 전송 배분률
|
||||
private float sendRateInfo; // 전송 배분 현황
|
||||
|
||||
private String ntceBgnde; // 검색일(현시점 범위 검색은 아님) : 04-21
|
||||
private String ntceEndde; // 검색일(현시점 범위 검색은 아님) : 04-21
|
||||
private String[] imgFileId; //이미지 atchId 배열
|
||||
private String[] templateYn; //템플릿 이미지 사용 여부
|
||||
|
||||
private String divideChk; //분할문자 사용 여부
|
||||
private String divideCnt; //분할문자 건수
|
||||
private String divideTime; //분할문자 간격
|
||||
private String befCash; //문자전송 이전 가지고 있는 캐시
|
||||
private String befPoint; //문자전송 이전 가지고 있는 포인트
|
||||
private String thisPoint; //문자전송 잔액 있는 포인트
|
||||
private String recommId; //추천인 아이디 정보
|
||||
|
||||
private String[] nameList; // '치환 이름 리스트'
|
||||
private String[] rep1List; // '치환 문자1 리스트'
|
||||
private String[] rep2List; // '치환 문자2 리스트'
|
||||
private String[] rep3List; // '치환 문자3 리스트'
|
||||
private String[] rep4List; // '치환 문자4 리스트'
|
||||
|
||||
private String startDate, endDate ; //사용자 페이지 날자 조회
|
||||
private String maxRegDate; // 최근 등록일자
|
||||
private String minRegDate; // 최초 등록일자
|
||||
private String regDate; // 등록일자
|
||||
private int phoneNumberCnt;
|
||||
private String phmAuthType; //'인증타입(01:휴대폰번호등록, 02:(일반)유선번호등록 , 03:서류인증요청)',
|
||||
private String refundYn; //문자전송 실패시 환불처리 완료 여부
|
||||
|
||||
private String filePath1; //그림이미지1 경로
|
||||
private String filePath2; //그림이미지2 경로
|
||||
private String filePath3; //그림이미지3 경로
|
||||
|
||||
private String smiId; //스팸 이용정지 문자 내용 아이디(mj_spam_member_info 테이블)
|
||||
|
||||
private String smishingYn; // 스미싱 의심여부
|
||||
|
||||
private List<String> dividDay;
|
||||
|
||||
private String userNm;
|
||||
private String mbtlnum;
|
||||
private String emailAdres;
|
||||
private String authorCode;
|
||||
|
||||
private String adminSmsNoticeYn;
|
||||
private String searchAdminSmsNoticeYn;
|
||||
private String searchExceptSpamYn;
|
||||
|
||||
private String eventYn; //이벤트
|
||||
private String payCnt; //결제수
|
||||
private String payPct; //결제율
|
||||
|
||||
private String spamKeyword; //스팸 키워드
|
||||
private String spamMsgGroupId; //스팸문자 문자전송 아이디
|
||||
private String spamStatus; //스팸문자 유무 (Y/N)
|
||||
private String vipYn; //VIP 유무 (Y/N)
|
||||
private String approvalPnttm; // 승인일자
|
||||
private String atchFiles; // 그림문자 파일정보
|
||||
|
||||
private String reserveType; // 전송완료 : D, 예약전송 : R
|
||||
private String todayYn;
|
||||
private String nowDate;
|
||||
private String msgDiv; // S: 단문, L: 장문, P: 그림
|
||||
private Float agentPrice;
|
||||
|
||||
private float smsPrice; // sms 단가
|
||||
private float mmsPrice; // mms 단가
|
||||
private float kakaoAtPrice; // 카카오 알림톡 단가
|
||||
private float kakaoFtPrice; // 카카오 친구톡 단가
|
||||
private float kakaoFtImgPrice;// 카카오 이미지 단가
|
||||
private float kakaoFtWideImgPrice; // 카카오 와이드 이미지 단가
|
||||
|
||||
private String txtReplYn; //변환문자 유무
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
package com.itn.mjonApi.mjon.api.send.web;
|
||||
|
||||
import com.itn.mjonApi.mjon.api.send.mapper.domain.MjonMsgVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* packageName : com.itn.mjonApi.mjon.send.web
|
||||
* fileName : SendRestController
|
||||
* author : hylee
|
||||
* date : 2023-02-15
|
||||
* description :
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* 2023-02-15 hylee 최초 생성
|
||||
*/
|
||||
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class SendRestController {
|
||||
|
||||
private final RestTemplate restTemplate;
|
||||
|
||||
public SendRestController(RestTemplate restTemplate) {
|
||||
this.restTemplate = restTemplate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param mjonMsgVO
|
||||
* @Discription 문자 발송 테스트
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/api/sendTest")
|
||||
public Object sendTest(MjonMsgVO mjonMsgVO){
|
||||
|
||||
return restTemplate.postForEntity(
|
||||
"/web/user/login/sendMsgDataAjax.do"
|
||||
,mjonMsgVO
|
||||
, Object.class
|
||||
);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param mjonMsgVO
|
||||
* @Discription 스팸문자 테스트
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/api/selectSpamTxtChkAjax")
|
||||
public Object selectSpamTxtChkAjax(MjonMsgVO mjonMsgVO){
|
||||
log.info(" :: START/api/selectSpamTxtChkAjax");
|
||||
return restTemplate.postForEntity(
|
||||
"/web/user/login/selectSpamTxtChkAjax.do"
|
||||
,mjonMsgVO
|
||||
, Object.class
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param mjonMsgVO
|
||||
* @Discription 리턴 데이터 테스트
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/api/returnTest")
|
||||
public Object returnTest(MjonMsgVO mjonMsgVO){
|
||||
|
||||
return restTemplate.postForEntity(
|
||||
"/web/user/login/returnTest.do"
|
||||
, mjonMsgVO
|
||||
, Object.class
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -14,8 +14,8 @@ 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.service.AccessKeyService;
|
||||
import com.itn.mjonApi.mjon.api.service.AccessTokenService;
|
||||
import com.itn.mjonApi.mjon.api.access.service.AccessKeyService;
|
||||
import com.itn.mjonApi.mjon.api.access.service.AccessTokenService;
|
||||
|
||||
/**
|
||||
* @author User
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
package com.itn.mjonApi.mjon.member.mapper;
|
||||
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.IdgenVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface MyMsgMapper {
|
||||
|
||||
/**/
|
||||
List<IdgenVO> findAll();
|
||||
|
||||
@Select("select * from MJ_MYMSG")
|
||||
List<IdgenVO> findAll_2();
|
||||
}
|
||||
package com.itn.mjonApi.mjon.member.mapper;
|
||||
|
||||
import com.itn.mjonApi.mjon.member.mapper.domain.MyMsgVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface MyMsgMapper {
|
||||
|
||||
/**/
|
||||
List<MyMsgVO> findAll();
|
||||
|
||||
@Select("select * from MJ_MYMSG")
|
||||
List<MyMsgVO> findAll_2();
|
||||
}
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
package com.itn.mjonApi.mjon.member.mapper.domain;
|
||||
/*
|
||||
table : mj_mymsg
|
||||
comment : '내문자 보관함';
|
||||
*/
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MyMsgVO implements Serializable {
|
||||
|
||||
|
||||
private Integer msgId; /*auto_increment comment '문자 고유아이디' primary key*/
|
||||
private String mberId; /*comment '회원 아이디'*/
|
||||
private String esntlId; /*null comment '회원고유 아이디'*/
|
||||
private String subject; /*null comment '문자 제목'*/
|
||||
private String smsTxt; /*null comment '문자 내용'*/
|
||||
private String smsLen; /*null comment '문자 길이'*/
|
||||
private String atchFileId1; /*null comment '첨부파일번호'*/
|
||||
private String atchFileId2; /*null comment '첨부파일번호'*/
|
||||
private String atchFileId3; /*null comment '첨부파일번호'*/
|
||||
private String regdate; /*null comment '등록일자'*/
|
||||
private String msgType; /*default 'S' null comment '문자종류'*/
|
||||
|
||||
}
|
||||
@ -2,7 +2,7 @@ package com.itn.mjonApi.mjon.member.service.impl;
|
||||
|
||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||
import com.itn.mjonApi.mjon.member.mapper.MyMsgMapper;
|
||||
import com.itn.mjonApi.cmn.idgen.mapper.domain.IdgenVO;
|
||||
import com.itn.mjonApi.mjon.member.mapper.domain.MyMsgVO;
|
||||
import com.itn.mjonApi.mjon.member.service.MemberService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@ -17,16 +17,15 @@ public class MemberServiceImpl implements MemberService {
|
||||
@Autowired
|
||||
MyMsgMapper myMsgMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public RestResponse findAll() {
|
||||
List<IdgenVO> MyMsgListVO = myMsgMapper.findAll();
|
||||
List<MyMsgVO> MyMsgListVO = myMsgMapper.findAll();
|
||||
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestResponse findAll2() {
|
||||
List<IdgenVO> MyMsgListVO = myMsgMapper.findAll_2();
|
||||
List<MyMsgVO> MyMsgListVO = myMsgMapper.findAll_2();
|
||||
return new RestResponse(HttpStatus.OK, "성공", LocalDateTime.now(), MyMsgListVO);
|
||||
}
|
||||
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
package com.itn.mjonApi.mjon.send.web;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* packageName : com.itn.mjonApi.mjon.send.web
|
||||
* fileName : SendRestController
|
||||
* author : hylee
|
||||
* date : 2023-02-15
|
||||
* description :
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* 2023-02-15 hylee 최초 생성
|
||||
*/
|
||||
@RestController
|
||||
public class SendRestController {
|
||||
|
||||
|
||||
}
|
||||
@ -10,6 +10,8 @@ spring.datasource.url=jdbc:log4jdbc:mysql://192.168.0.125:3306/mjon?serverTimezo
|
||||
spring.datasource.username=mjonUr
|
||||
spring.datasource.password=mjon!@#$
|
||||
|
||||
|
||||
server.port=8088
|
||||
|
||||
logging.level.root=info
|
||||
|
||||
api.root.url=http://localhost:8080
|
||||
18
src/main/resources/application-prod.properties
Normal file
18
src/main/resources/application-prod.properties
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
# DB INFO
|
||||
#spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
|
||||
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
#spring.datasource.url=jdbc:mysql://192.168.0.125:3306/mjon?serverTimezone=Asia/Seoul
|
||||
spring.datasource.driverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
spring.datasource.url=jdbc:log4jdbc:mysql://192.168.0.125:3306/mjon?serverTimezone=Asia/Seoul
|
||||
|
||||
spring.datasource.username=mjonUr
|
||||
spring.datasource.password=mjon!@#$
|
||||
|
||||
|
||||
server.port=9100
|
||||
|
||||
logging.level.root=info
|
||||
|
||||
api.root.url=http://localhost:8080
|
||||
@ -1,16 +1,20 @@
|
||||
|
||||
|
||||
spring.profiles.active=dev
|
||||
|
||||
|
||||
# mybatis setting
|
||||
mybatis.mapper-locations=classpath:mapper/**/*.xml
|
||||
# model camel case set
|
||||
mybatis.configuration.map-underscore-to-camel-case=true
|
||||
|
||||
#sql \ucd9c\ub825 log \uc124\uc815
|
||||
logging.level.jdbc.sqlonly=off
|
||||
logging.level.jdbc.sqltiming=info
|
||||
logging.level.jdbc.audit=off
|
||||
logging.level.jdbc.resultset=off
|
||||
logging.level.jdbc.resultsettable=off
|
||||
|
||||
|
||||
spring.profiles.active=dev
|
||||
|
||||
|
||||
# mybatis setting
|
||||
mybatis.mapper-locations=classpath:mapper/**/*.xml
|
||||
# model camel case set
|
||||
mybatis.configuration.map-underscore-to-camel-case=true
|
||||
|
||||
#sql \ucd9c\ub825 log \uc124\uc815
|
||||
logging.level.jdbc.sqlonly=off
|
||||
logging.level.jdbc.sqltiming=info
|
||||
logging.level.jdbc.audit=off
|
||||
logging.level.jdbc.resultset=off
|
||||
logging.level.jdbc.resultsettable=off
|
||||
|
||||
|
||||
spring.devtools.restart.enabled=true
|
||||
spring.devtools.livereload.enabled=true
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.itn.mjonApi.mjon.api.service.mapper.AccessKeyMapper">
|
||||
<mapper namespace="com.itn.mjonApi.mjon.api.access.service.mapper.AccessKeyMapper">
|
||||
|
||||
<select id="findAll" resultType="com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO">
|
||||
SELECT
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.itn.mjonApi.mjon.api.service.mapper.AccessTokenMapper">
|
||||
<mapper namespace="com.itn.mjonApi.mjon.api.access.service.mapper.AccessTokenMapper">
|
||||
|
||||
<select id="findAll" resultType="com.itn.mjonApi.cmn.idgen.mapper.domain.AccessKeyVO">
|
||||
SELECT
|
||||
|
||||
@ -47,7 +47,8 @@
|
||||
INSERT INTO <include refid="table_name"/> (
|
||||
<include refid="column_name"/>
|
||||
)
|
||||
SELECT concat('API_',lpad(ifnull(replace(MAX(log_id),'API_',''),0)+1,16,'0'))
|
||||
VALUE (
|
||||
#{logId}
|
||||
, #{conectId}
|
||||
, #{conectIp}
|
||||
, #{userAt} /**A:관리자, U:홈페이지 */
|
||||
@ -57,9 +58,7 @@
|
||||
, #{menuNm}
|
||||
, #{url}
|
||||
, now()
|
||||
|
||||
FROM LETTNLOGINLOG
|
||||
WHERE log_id LIKE 'API_%'
|
||||
)
|
||||
|
||||
</insert>
|
||||
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.itn.mjonApi.mjon.member.mapper.MyMsgMapper">
|
||||
|
||||
<select id="findAll" resultType="com.itn.mjonApi.cmn.idgen.mapper.domain.IdgenVO">
|
||||
SELECT
|
||||
*
|
||||
FROM MJ_MYMSG
|
||||
</select>
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.itn.mjonApi.mjon.member.mapper.MyMsgMapper">
|
||||
|
||||
<select id="findAll">
|
||||
SELECT
|
||||
*
|
||||
FROM MJ_MYMSG
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user