package itn.let.mjo.sttst.service;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import itn.let.mjo.msg.service.MjonMsgVO;
import itn.let.sym.log.lgm.service.EgovSysLogService;

/**
 * 시스템 로그 요약을 위한 스케쥴링 클래스
 * @author 공통서비스개발팀 이삼섭
 * @since 2009.03.11
 * @version 1.0
 * @see
 *
 * <pre>
 * << 개정이력(Modification Information) >>
 *   
 *   수정일      수정자           수정내용
 *  -------    --------    ---------------------------
 *   2009.03.11  이삼섭          최초 생성
 *   2011.07.01  이기하          패키지 분리(sym.log -> sym.log.lgm)
 *   2011.08.31  JJY            경량환경 템플릿 커스터마이징버전 생성 
 *
 * </pre>
 */
@Service("sttstMsgScheduling")
public class SttstMsgScheduling{

	@Resource(name="EgovSysLogService")
	private EgovSysLogService sysLogService;

	@Resource(name="mjonSttstService")
	private MjonSttstService mjonSttstService;
    
	/** 설정값 가져오기 */
	@Value("#{globalSettings['Globals.Env']}")
	private String GlobalsEnv;
	
	/**
	 * mj_sttst_msg 테이블 통계 데이터 생성 (한시간 한번) 
	 * 매시간 43분 47초 실행
	 * insert or update 처리	 
	 * @param
	 * @return
	 * @throws Exception
	 */
	public void mjSttstMsgSmmmary() throws Exception {

		System.out.println("=============SttstMsgScheduling=============mjSttstMsgSmmmary()==============");
		
		try {
			System.out.println("=============this is =============>"+GlobalsEnv);
			
			if(!GlobalsEnv.equals("local")) {//local에서 실행 안되도록 처리	
				System.out.println("=============DO =============");
				
				MjonMsgVO mjonMsgVO	=	new MjonMsgVO();
				//mjonSttstService.insertMjSttstMsgBulk(mjonMsgVO);
				
				
			}else {	
				System.out.println("=============skipped!!! =============");				
			}
			// do something...
			
		}catch(Exception ex) {
			ex.printStackTrace();
		}		
	}
	
	/**
	 * mj_sttst_msg 테이블 통계 데이터 생성 (매일한번)
	 * 새벽 3시 30분 47초 한번실행
	 * insert or update 처리	 
	 * @param
	 * @return
	 * @throws Exception
	 */
	public void mjSttstMsgDaySmmmary() throws Exception {

		System.out.println("=============SttstMsgScheduling=============mjSttstMsgDaySmmmary()==============");
		
		try {
			System.out.println("=============this is =============>"+GlobalsEnv);
			
			if(!GlobalsEnv.equals("local")) {//local에서 실행 안되도록 처리	
				System.out.println("=============DO =============");
				
				MjonMsgVO mjonMsgVO	=	new MjonMsgVO();
				mjonSttstService.insertMjSttstMsgDayBulk(mjonMsgVO);
				
				
			}else {	
				System.out.println("=============skipped!!! =============");				
			}
			// do something...
			
		}catch(Exception ex) {
			ex.printStackTrace();
		}		
	}
	
	/**
	 * mj_sttst_msg_rank 테이블 통계 데이터 생성 
	 * insert or update 처리	 
	 * @param
	 * @return
	 * @throws Exception
	 */
	public void mjSttstMsgRankSmmmary() throws Exception {
		
		System.out.println("=============SttstMsgScheduling=============mjSttstMsgRankSmmmary()==============");
		
		try {
			System.out.println("=============this is =============>"+GlobalsEnv);
						
			if(!GlobalsEnv.equals("local")) {//local에서 실행 안되도록 처리					
				System.out.println("=============DO =============");
				
				MjonMsgVO mjonMsgVO	=	new MjonMsgVO();
				//mjonSttstService.insertMjSttstMsgRankBulk(mjonMsgVO);
			}else {	
				System.out.println("=============skipped!!! =============");
			}
			// do something...			
			
		}catch(Exception ex) {
			ex.printStackTrace();
		}		
	}
	
	/**
	 * mj_sttst_msg_rank 테이블 통계 데이터 생성(매일 한번) 
	 * insert or update 처리	 
	 * @param
	 * @return
	 * @throws Exception
	 */
	public void mjSttstMsgRankDaySmmmary() throws Exception {
		
		System.out.println("=============SttstMsgScheduling=============mjSttstMsgRankDaySmmmary()==============");
		
		try {
			System.out.println("=============this is =============>"+GlobalsEnv);
						
			if(!GlobalsEnv.equals("local")) {//local에서 실행 안되도록 처리					
				System.out.println("=============DO =============");
				
				MjonMsgVO mjonMsgVO	=	new MjonMsgVO();
				//mjonSttstService.insertMjSttstMsgRankDayBulk(mjonMsgVO);
			}else {	
				System.out.println("=============skipped!!! =============");
			}
			// do something...			
			
		}catch(Exception ex) {
			ex.printStackTrace();
		}		
	}
	
}
