package com.style24.front.support.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import lombok.extern.slf4j.Slf4j;

/**
 * 제휴링크 Interceptor
 * 
 * @author gagamel
 * @since 2020. 9. 11
 */
@Component
@Slf4j
public class TsfAflinkInterceptor extends HandlerInterceptorAdapter {

//	@Autowired
//	private WfoCommonService commonService;

	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//		// Parameter
//		GagaMap params = GagaParameterUtil.getParameterMap(request);
//
//		// 제휴링크코드
//		String afLinkCd = params.getString("afLinkCd");
//
//		if (StringUtils.isNotBlank(afLinkCd)) {
//			if (!afLinkCd.equals(FoSession.getAttribute("afLinkCd"))) {
//				FoSession.setAttribute("afLinkCd", afLinkCd);
//			}
//		} else {
//			afLinkCd = "AF001"; // STYLE24
//			FoSession.setAttribute("afLinkCd", afLinkCd);
//		}
//
//		commonService.createInflowHistory(afLinkCd);

		return super.preHandle(request, response, handler);
	}

	@Override
	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
		ModelAndView modelAndView) throws Exception {
		// Do nothing
	}

}
