Merge branch 'hylee'
This commit is contained in:
commit
7d0ec4e8a3
7
pom.xml
7
pom.xml
@ -128,6 +128,13 @@
|
|||||||
<version>16.0.1</version>
|
<version>16.0.1</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-validation -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@ -20,6 +20,8 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* packageName : com.itn.mjonApi.cmn.aop
|
* packageName : com.itn.mjonApi.cmn.aop
|
||||||
@ -96,34 +98,83 @@ public class LogAspect {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 메소드 종료 후 return 값에 따른 로그 처리
|
* @description 메소드 종료 후 return 값에 따른 로그 처리
|
||||||
* - 매개변수 RestResponse는 메소드의 return 값과 일치해야 함
|
|
||||||
* @param joinPoint
|
* @param joinPoint
|
||||||
* @param returnValue
|
* @param returnValue
|
||||||
* @throws JsonProcessingException
|
* @throws JsonProcessingException
|
||||||
|
* @important 메소드의 매개변수 RestResponse는 메소드의 return 값과 일치해야 함
|
||||||
*/
|
*/
|
||||||
@AfterReturning(pointcut = "execution(* com.itn.mjonApi.mjon.api.*..*Impl.*(..))", returning = "returnValue")
|
@AfterReturning(pointcut = "execution(* com.itn.mjonApi.mjon.api.*..*Impl.*(..))", returning = "returnValue")
|
||||||
public void afterReturning(JoinPoint joinPoint, RestResponse returnValue) throws JsonProcessingException {
|
public void afterReturning(JoinPoint joinPoint, Object returnValue) throws Exception {
|
||||||
log.info(" :: AfterReturning :: ");
|
log.info(" :: AfterReturning :: ");
|
||||||
|
|
||||||
String resutlCode = "";
|
String resutlCode = "";
|
||||||
// HttpServletRequest 객체를 가져옴
|
// HttpServletRequest 객체를 가져옴
|
||||||
HttpServletRequest request = this.getHttpServletRequest();
|
HttpServletRequest request = this.getHttpServletRequest();
|
||||||
|
|
||||||
// @Befer에서 저장한 logId를 가져옴
|
// @Befer에서 저장한 logId를 가져옴
|
||||||
String logId = (String) request.getAttribute("logId");
|
String logId = (String) request.getAttribute("logId");
|
||||||
|
|
||||||
RestResponse restResponse = (RestResponse) returnValue;
|
|
||||||
|
|
||||||
// lettngnrlmber_access_log 응답값 Udpate
|
// lettngnrlmber_access_log 응답값 Udpate
|
||||||
LettnAccessLogVO lettnAccessLogVO = new LettnAccessLogVO()
|
LettnAccessLogVO lettnAccessLogVO = new LettnAccessLogVO()
|
||||||
.builder()
|
.builder()
|
||||||
.logId(logId)
|
.logId(logId)
|
||||||
.resCn(this.getJsonToString(restResponse))
|
.resCn(this.mapToJson(this.getStringObjectMap(returnValue)))
|
||||||
.resCode(resutlCode)
|
.resCode(resutlCode)
|
||||||
.build();
|
.build();
|
||||||
lettnAccessLogMapper.update(lettnAccessLogVO);
|
lettnAccessLogMapper.update(lettnAccessLogVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Map<String, Object> getStringObjectMap(Object returnValue) throws IllegalAccessException {
|
||||||
|
Map<String, Object> returnMap = new HashMap<String, Object>();
|
||||||
|
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||||
|
String val = "";
|
||||||
|
|
||||||
|
|
||||||
|
// for(Field field : returnValue.getClass().getDeclaredFields()){
|
||||||
|
// field.setAccessible(true);
|
||||||
|
//
|
||||||
|
// if("data".equals(field.getName()))
|
||||||
|
// {
|
||||||
|
// Object dataObj = field.get(returnValue);
|
||||||
|
// for(Field dataF : dataObj.getClass().getDeclaredFields()){
|
||||||
|
// dataF.setAccessible(true);
|
||||||
|
// log.info("dataF.getName() :: [{}]", dataF.getName());
|
||||||
|
// log.info("dataF.get(dataObj) :: [{}]", dataF.get(dataObj));
|
||||||
|
// dataMap.put(dataF.getName(), this.getValChk(dataF.get(dataObj)));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// returnMap.put(field.getName(), dataMap);
|
||||||
|
// continue;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// //field.get(returnValue) null check
|
||||||
|
// returnMap.put(field.getName(), this.getValChk(field.get(returnValue)));
|
||||||
|
// }
|
||||||
|
return returnMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : field.get(returnValue) null check
|
||||||
|
* null 이면 nullPointException 발생
|
||||||
|
* @param returnValue
|
||||||
|
* @return
|
||||||
|
* @throws IllegalAccessException
|
||||||
|
*/
|
||||||
|
private static String getValChk(Object returnValue) {
|
||||||
|
String val;
|
||||||
|
if(returnValue == null) val = "";
|
||||||
|
else val = returnValue.toString();
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String mapToJson(Map<String, Object> map) throws Exception
|
||||||
|
{
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
return mapper.writeValueAsString(map);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description : VO를 json으로 변환
|
* @description : VO를 json으로 변환
|
||||||
* @param restResponse
|
* @param restResponse
|
||||||
|
|||||||
@ -265,6 +265,17 @@ public class SendServiceImpl implements SendService {
|
|||||||
.callFrom(callFrom)
|
.callFrom(callFrom)
|
||||||
.callToList(new String[]{callTo})
|
.callToList(new String[]{callTo})
|
||||||
.smsTxt(value.toString())
|
.smsTxt(value.toString())
|
||||||
|
.eachPrice("0") // 디폴트
|
||||||
|
.sPrice("0") // 디폴트
|
||||||
|
.totPrice("0") // 디폴트
|
||||||
|
.fileCnt("0") // 디폴트
|
||||||
|
.msgType("4") // 디폴트
|
||||||
|
.smsPrice(0) // 디폴트
|
||||||
|
.mmsPrice(0) // 디폴트
|
||||||
|
.imgFilePath(new String[0]) // 디폴트
|
||||||
|
.txtReplYn("N") // 디폴트
|
||||||
|
.reserveYn("N") // 디폴트
|
||||||
|
.msgKind("N") // 디폴트
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
// 초기화
|
// 초기화
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user