package incheon.res.rdm.oe.seol.service.impl;

import incheon.res.rdm.oe.seol.mapper.RdmOeSeolMapper;
import incheon.res.rdm.oe.seol.service.RdmOeSeolService;
import incheon.res.rdm.oe.seol.vo.RdmOeSeolVO;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class RdmOeSeolServiceImpl implements RdmOeSeolService {

	protected Log log = LogFactory.getLog(this.getClass());
	
	@Resource
    private RdmOeSeolMapper rdmOeSeolMapper;
	

	/**
	 * @MethodDESC : 새올민원행정접수 정보 목록
	 */
	public List selectSeolList(RdmOeSeolVO vo) throws Exception{
		return rdmOeSeolMapper.selectSeolList(vo);
	}    

	/**
	 * @MethodDESC : 새올민원행정접수 count
	 */
	public int countSeol(RdmOeSeolVO vo) throws Exception {
		return rdmOeSeolMapper.countSeol(vo);
	}
	
	/**
	 * @MethodDESC : 새올민원행정접수 상세조회
	 */
	public RdmOeSeolVO selectSeol(RdmOeSeolVO vo) throws Exception {
		RdmOeSeolVO resultVo = null;
		resultVo = rdmOeSeolMapper.selectSeol(vo);

		//접수시간 HH:MM:SS형식으로 변환
		if(resultVo != null){
			if(resultVo.getRcptHr() != null && !"".equalsIgnoreCase(resultVo.getRcptHr())){
				String recTim = resultVo.getRcptHr();
				String recTimHh = recTim.substring(0, 2);
				String recTimMm = recTim.substring(2, 4);
				String recTimSs = recTim.substring(4, 6);
				String resRecTim = recTimHh + ":" + recTimMm + ":" + recTimSs;
				resultVo.setRcptHr(resRecTim);
			}
		}

		return resultVo;
	} 
}