package com.eactive.eai.common.sessioninfo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.eactive.eai.common.dao.BaseDAO;
import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.sessioninfo.loader.SessionHistoryLogger;
import com.eactive.eai.common.sessioninfo.mapper.SessionHistoryMapper;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.data.entity.onl.sessioninfo.SessionHistory;

@Service
@Transactional
public class SessionHistoryDAO extends BaseDAO {
	private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
	
	@Autowired
	private SessionHistoryLogger sessionHistoryLogger;

	@Autowired
	private SessionHistoryMapper sessionHistoryMapper;
	
	public void insertSessionHistory(SessionHistoryVO sessionHistoryVo) throws DAOException {
		try {
			SessionHistory entity = sessionHistoryMapper.toEntity(sessionHistoryVo);
			sessionHistoryLogger.save(entity);
		} catch (Exception e) {
			throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICKE118"));
		}
	}

}
