package biz.cms_NhsMasterDataRcv;

import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;

import biz.comm.COMMBiz;
import biz.comm.COMMLog;
import kr.fujitsu.com.ffw.model.GenericDAO;
import kr.fujitsu.com.ffw.model.SqlWrapper;

/**
 * NhsMasterDataRcvDAO
 * A class that has inherited GenericDAO(GenericDAO를 상속받은 클래스)
 * It is responsible for functions to access DB to retrieve respective information(DB에 접속하여 해당 정보를 조회해 오거나)
 * or update DB information(키오스크에서 사용하는 모든 테이블정보를 수신/송신한다.
 * @created on 1.0, 02/11/19
 * @created by Zin Corp Next Happy Station Team.
 * 
 * @modified on
 * @modified by
 * @caused by
 */
public class NhsMasterDataRcvDAO extends GenericDAO{
	private static Logger logger = Logger.getLogger(NhsMasterDataRcvAction.class);
	
	
public  List selMasterData(HashMap hmCommon,  HashMap hm, COMMLog df) throws Exception {
		
		
		SqlWrapper sql = new SqlWrapper();
		SqlWrapper sqlfnd = new SqlWrapper();
		
		List list = null;
		List listCnt =null;
		Map map = new HashMap(); 
		String stor_cd = null;
		String sub_stor_cd =null;
		//cmp_cd는 agument로 넘겨받아 처리함.2019-02-11
		String com_cd =(String)hmCommon.get("CMP_CD");
		int i = 0;    
		int iDay = 0;
		int iMstcnt = 0;
			
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");				/* 날짜포멧 */
		Calendar cDate = Calendar.getInstance();
		
		// 켐페인용 데이터 조회 처리 
		cDate.add(Calendar.DATE, -7);											/* 종료일이 1주일전 데이터 */
		String sCpiDate = sdf.format(cDate.getTime());		
        Date date = sdf.parse((String)hm.get("UPD_DT"));
 
		cDate.setTime(date);	/* 날짜 셋팅 */
		// 회사코드 체크 후 처리 
		if(com_cd.equals("PCKR")){
			iDay = COMMBiz.PARI_DOWNDATE ;
			cDate.add(Calendar.HOUR, iDay * -1 );											/* 전일계산 */

		}else if(com_cd.equals("BRKR")){
			
			iDay = COMMBiz.BRK_DOWNDATE;
			cDate.add(Calendar.HOUR, iDay * -1 );											/* 전일계산 */
		}else if(com_cd.equals("SLKR")){
			iDay = COMMBiz.SL_DOWNDATE;
			cDate.add(Calendar.DATE, iDay * -1 );											/* 전일계산 */
		}else {// 타회사는  파리기준으로 처리 															/*2017.05.23 추가 
			iDay =  COMMBiz.PARI_DOWNDATE;
 			cDate.add(Calendar.HOUR, iDay * -1 );	
		}
			
		//cDate.add(Calendar.DATE, iDay * -1 );											/* 전일계산 */
		String Upddate = sdf.format(cDate.getTime());
		String sMaster_Div = (String)hm.get("INQ_TYPE"); 
		//df.CommLogger("▶  START MASTER RCV  : " + sMaster_Div   + "   upd date1  = " + Upddate  + "upd date2 = " + (String)hm.get("UPD_DT")); 
		 
		
		connect("NHS");
		try {
			
			// 각 마스터 구분별로 쿼리
			if (sMaster_Div.equals("01")){ //NHS_SCREEN 점포별 대기화면
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_SCREEN"));
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				
				/*BR추가*/
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				
			}
			else if (sMaster_Div.equals("02")){ //NHS_SCREEN_CONTENTS 대기화면 레이어별 리소스
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_SCREEN_CONTENTS"));
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				//sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				
				/*BR추가*/
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				
				
			}
			else if (sMaster_Div.equals("03")){ //NHS_SCREEN_LAYER	대기화면 레이어
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_SCREEN_LAYER"));
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				//sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				
				/*BR추가*/
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				
				
			}
			else if (sMaster_Div.equals("04")){ //NHS_STORE_PRD_CATE	점포별 제품카테고리 2019-03-11 삭제
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_STOR_PRD_CATE"));
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
			}
			else if (sMaster_Div.equals("05")){ //NHS_STORE_PRD_KEY	점포별 제품 터치키
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_STOR_PRD_KEY"));
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
			}
			else if (sMaster_Div.equals("06")){ //NHS_UI_TEMPLATE	점포별 UI템플릿
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_UI_TEMPLATE"));
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
			}
			else if (sMaster_Div.equals("07")){ //NHS_CPI_CONTENTS	캠페인 리소스
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_CPI_CONTENTS"));
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
			}
			else if (sMaster_Div.equals("08")){ //NHS_CUST_BUY_HIST	고객구매이력 2019-03-10 삭제
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_CUST_BUY_HIST"));
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("HPC_CUST_CD")).trim());
			}
			else if (sMaster_Div.equals("09")){ //NHS_LANG_MSG	제품 다국어
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_LANG_MSG"));
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
			}
			else if (sMaster_Div.equals("10")){ //NHS_LAYOUT	화면구성
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_LAYOUT"));
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
			}
			else if (sMaster_Div.equals("11")){ //NHS_PRD_CATE_L	제품카테고리(대분류) 2019-03-11 삭제
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_PRD_CATE1"));
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
			}
			else if (sMaster_Div.equals("12")){ //NHS_PRD_CATE_M	제품카테고리(중분류) 2019-03-11 삭제
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_PRD_CATE2"));
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());				
			}
			else if (sMaster_Div.equals("13")){ //NHS_PRD_MST	제품마스터
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_PRD_MST"));
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
			}
			else if (sMaster_Div.equals("14")){ //NHS_OPTN_MST	부가옵션마스터
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_OPTN_MST"));
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
			}
			else if (sMaster_Div.equals("15")){ //NHS_PRD_OPTN_GRP	부가옵션그룹
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_PRD_OPTN_GRP"));
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
			}
			else if (sMaster_Div.equals("16")){ //NHS_PRD_OPTN	제품별 부가옵션
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_PRD_OPTN"));
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
			}
			else if (sMaster_Div.equals("17")){ //NHS_PROD_CATE	제품카테고리 전체
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_PRD_CATE"));
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				
			}
			else if (sMaster_Div.equals("18")){ //NHS_STOR_PROD_TAG	제품 태그 정보
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_STOR_PRD_TAG"));
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
			}
			else if (sMaster_Div.equals("19")){ //NHS_LINK_ITEM	BR 링크 상품 정보
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_LINK_ITEM"));
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
			}
			else if (sMaster_Div.equals("20")){ //NHS_STOR_FLAVOR	제품 플레이버 정보
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_STOR_FLAVOR"));
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
			}
			else if(sMaster_Div.equals("21")){ //점포 포스 옵션
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_MST_POS_OPTN"));  
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("POS_NO")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("POS_NO")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, (String)hm.get("STOR_TYPE"));
				sql.setString(++i, ((String)hm.get("UPD_DT")).trim());
			}
			else if(sMaster_Div.equals("22")){ //결제수단 사용여부
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_FUNC_INFO"));  
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
			}
			else if (sMaster_Div.equals("59")){ //결제/할인 마스터
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_MST_PAY_DC"));
				sql.setString(++i, (String)hmCommon.get("CMP_CD"));
				sql.setString(++i, (String)hm.get("STOR_CD"));	//  
				sql.setString(++i, (String)hm.get("UPD_DT"));
			}
			else if (sMaster_Div.equals("101")){ //NHS_STOR_PRD_LINK_OPTN	제품별 링크옵션
				sql.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_NHS_STOR_PRD_LINK_OPTN"));
				sql.setString(++i, ((String)hmCommon.get("CMP_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("SALES_ORG_CD")).trim());
				sql.setString(++i, ((String)hmCommon.get("STOR_CD")).trim());
			}
			list = executeQuery(sql); 
			
		}catch(SQLException se){

			df.CommLogger("[Sql ERROR]" + se.getMessage());
		}catch (Exception e) {
			df.CommLogger("[ERROR]" + e);
 		} 
		
		return list;
	}

	/*
	 * **************************************************************************
	 * getMakesSendData( 데이터 없을 경우 응답 메세지 생성) 
	 * @param tranYmd
	 * @param hm
	 * @return datamsg
	 * @throws Exception
	 * ***************************************************************************
	 */
	public String getMakeMasterData( String sMasterData  , long lDatalength ,COMMLog df) throws Exception {
		   
		Map map = new HashMap();
		int i = 0;  
		String dataMsg = "";
		try { 
			// 응답 전문 초기화
			map.put("COUNT", lDatalength); 					
			map.put("DATA", sMasterData);				// 메세지 일 경우 MSG_CD 호출  
						
		} catch (Exception e) {
			df.CommLogger("▶ SEL Error : " + e); 
			throw e;
		} finally {  
			dataMsg = COMMBiz.makeMapToSendData(map);// makeBaesinReqSendData(hmData, df);			
			df.CommLogger("★ make: " + dataMsg);
			}
		return dataMsg;
	}
	
	public String getStore_Type(HashMap hmCommon,HashMap hm ) throws Exception {
		SqlWrapper sqlfnd = new SqlWrapper();
		List list = null;
		String slang_type ="";
		int i=0;
		
		try { 
			
			connect("NHS");  
				
			sqlfnd.put(findQuery(COMMBiz.XML_MASTERDATA_SQL, "SEL_STOR_TYPE")); 
			sqlfnd.setString(++i, (String)hmCommon.get("CMP_CD")); 
			sqlfnd.setString(++i, (String)hm.get("STOR_CD")); 
				
			list =executeQuery(sqlfnd);
			
			Map<String, String> mapCnt = (Map<String, String>)list.get(0);
			
			
		    slang_type =  String.valueOf(mapCnt.get("STOR_TYPE")); //(String)mapCnt.get("LANG_TYPE");
		    //값이 없을 경우 default 값으로 
		    if( "".equals(slang_type)){
		    	slang_type="10"; //NULL일때 직영
		    } 
		    
			logger.info("▶   SQL Debug " + sqlfnd.debug());    

		}catch(SQLException e) {
			logger.info( "▶ SQLException  Message=====>"+ e.getMessage());
 			//  Return 20 DB ERROR(20 DB ERROR 리턴) 
			slang_type ="";
		} catch (Exception e) { 
			slang_type ="";  //에러 데이터 발생시 default
			logger.info("[ERROR]" + e.toString());  
		}finally {
		   end(); 
		}
		
		logger.info("▶   SQL Debug " + slang_type);    

		return slang_type;
	}
	
	
	//전송로그 저장
	public int setMasterRcvInfo( HashMap hmCommon,  HashMap hm, COMMLog df ) throws Exception {
		SqlWrapper sql = new SqlWrapper();
		int iret = 0;
		int i=0;
		
		//DB Connection(DB 접속)
		try { 
			connect("NHS");
			begin();
			sql.put(findQuery("nhsmaster-sql", "INS_MASTER_RCV"));
			sql.setString(++i, (String) hmCommon.get("SALE_DT")); 
			sql.setString(++i, (String) hmCommon.get("CMP_CD"));
			sql.setString(++i, (String) hmCommon.get("STOR_CD"));
			sql.setString(++i, (String) hmCommon.get("POS_NO"));
			sql.setString(++i, (String) hm.get("INQ_TYPE"));
			sql.setString(++i, (String) hm.get("UPD_DT")); 
			df.CommLogger("▶ setMasterRcvInfo end " + (String) hm.get("UPD_DT") );
 			iret = executeUpdate(sql);
		}catch(SQLException e) {
			df.CommLogger("▶ SQLException  Message=====>"+ e.getMessage() );
			df.CommLogger("▶ SQLException  Rollback=====>"+ e.getErrorCode() );
			//  Return 20 DB ERROR(20 DB ERROR 리턴) 
			rollback(); 			
			 
		} catch (Exception e) {
			 
			rollback(); 		
			iret = 99;  //에러 데이터 발생
			df.CommLogger("[ERROR]" + e);
			df.CommLogger( "▶ SQL=====>"+ sql.debug());
		}finally {
		   end(); 
		}
		
		return iret;
	}
}
