/**
 * @(#)file    ContIntBiz.java
 * @(#)author  Kim Myung Ho
 * @(#)version 1.0
 * @(#)date    2014-07-15
 * @(#)since   JDK 1.4.2
 */
package kr.co.udapsoft.ebid.supplier.portal.cont.biz;


import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;

import oracle.toplink.internal.ox.StrBuffer;
import kr.co.hsnc.common.base.WAFLogger;
import kr.co.hsnc.common.base.WAFMessages;
import kr.co.hsnc.common.sql.Row;
import kr.co.hsnc.common.sql.RowSet;
import kr.co.hsnc.common.sql.RowSetImpl;
import kr.co.hsnc.common.sql.WAFSQLException;
import kr.co.hsnc.common.sql.persistent.Persistent;
import kr.co.hsnc.common.sql.persistent.PersistentImpl;
import kr.co.hsnc.common.sql.search.Search;
import kr.co.hsnc.common.sql.search.SearchImpl;
import kr.co.hsnc.common.sql.util.RowSetUtility;
import kr.co.hsnc.common.util.ValueObject;
import kr.co.udapsoft.common.code.CommCodeManager;
import kr.co.udapsoft.common.sender.MessageSend;
import kr.co.udapsoft.common.util.PDFMaker;
import kr.co.udapsoft.common.util.Crosscert;
import kr.co.udapsoft.ebid.buyer.common.file.FileManager;
import kr.co.udapsoft.ebid.buyer.sycs.user.biz.UserCommon;

import com.udapsoft.modular.web.ibsheet7.IBSheet7Factory;
import com.udapsoft.modular.web.ibsheet7.util.IBSheet7Utils;
import com.udapsoft.waf.common.ui.InitCombo;
import com.udapsoft.waf.common.util.StringUtils;
import com.udapsoft.waf.system.Biz;
import com.udapsoft.waf.system.HandlerStorage;


public class SuppContBiz extends Biz {

	public SuppContBiz(HandlerStorage storage) {
		super(storage);
	}

	public void doBiz() throws Exception {
        ValueObject user = new ValueObject();
//        //System.out.println("BidIngListBiz :  ~" + storage.getUser());
//		//System.out.println("Outside event : #" + storage.getEvent());
		//System.out.println("Outside params : " + params);
		boolean success = false;
		
		if(storage.compareEvent("")){
			
		}else if(storage.compareEvent("SHEET_SELECT")){
			params.set("sheet1", getContList(params));
			
			storage.addObject("ibsheet7Data", IBSheet7Factory.createIBSheet7(params, storage.request));
			
		}else if(storage.compareEvent("FORM_SHEET_SELECT")){
			
			params.set("sheet2", getStampList(params));
			storage.addObject("ibsheet7Data", IBSheet7Factory.createIBSheet7(params, storage.request));
			
		}else if(storage.compareEvent("FORM_SELECT")){
            user = getContRequestValueObject(params.get("SUB_CONT_MOD_ID"));
            storage.addValueObject("ContInfo", user);

			//저장된 HTML 정보
            RowSet template = getTemplateInfo(params.get("SUB_CONT_MOD_ID"));
            storage.addRowSet("template", template);
            
			//자동 저장 파일
			RowSet rowSet = getTemplateFile(params.get("SUB_CONT_MOD_ID"));
			storage.addRowSet("AUTOFILE_LIST", rowSet);            

			//보증 정보 가져오기
			params.set("MOD_NO", user.get("MOD_NO"));
			
	        String wonCont = "K";
	        
	        if(!params.get("MOD_NO").equals("0")){
	        	wonCont = getWarrGubun(params.get("PUR_CONT_MOD_ID") );
	        }
	        
	        params.set("WON_WARR", wonCont);
	        
			RowSet warrList = getWarrList(params);
			storage.addRowSet("warrList", warrList);            

			//보증완료된 정보
			RowSet warrCount = getWarrCount(params);
			storage.addRowSet("warrCount", warrCount);            

		}else if(storage.compareEvent("SIGN_OK")){
			
			String sMsg="";
			Crosscert crossErt = new Crosscert();
			sMsg = crossErt.chkSignVerify(params.get("CONT_SIGNDATA"));
			//System.out.println("sMsg ======= : " + sMsg);
			
			if(sMsg.equals("SIGN_SUCCESS")){
				/*if( params.get("stamp_duty_issue_gb").equals("20") ) {
					updateStampDuty(super.conn.getConnection(), params);
				}*/
				CONT_SignOk(super.conn.getConnection(), params);	//서명저장
				params.set("pStatusCD", "30");
				ContStatusUp(super.conn.getConnection(), params);	//서명 완료
				//ContStatusUp pStatusCD

				Send(params, storage.getEvent());		//서명요청 메일과 SMS 전송

				super.storage.setSuccess(true);
			}else{
				super.storage.setSuccess(false);	
				super.storage.setMessage("인증서 검증에 실패 하였습니다.");
			}
		}else if(storage.compareEvent("EDIT_CALL")){	//수정요청
		
			/*if( params.get("stamp_duty_issue_gb").equals("20") ) {
				updateStampDuty(super.conn.getConnection(), params);
			}*/
			
			params.set("pStatusCD", "40");
			ContStatusUp(super.conn.getConnection(), params);	//계약 수정 요청 상태 변경

			Send(params, storage.getEvent());		//서명요청 메일과 SMS 전송
			
			super.storage.setSuccess(true);
		}
	}
	

	private ValueObject getfilelist(String filegb,String id,String returnid){
		ValueObject vo = new ValueObject();
		RowSet rowSet = FileManager.getFileList(filegb, id);
		String str="";
	        for(int i=0;i<rowSet.size();i++){
	        	Row row=rowSet.getRow(i);
	        	str += (i+1)+" : "+row.get("FILE_NAME")+" ("+ row.get("FILE_SIZE")+")";
	        	if(i+1!=rowSet.size()){
	        		str +="\r\n";
	        	}
	        }
	        vo.set(returnid, str);
		return vo;
	}
	
	
	
	
	 /**
     * 저장된 계약서식 조회 
	 * @param 
	 * @param 
	 * @return RowSet 
	 */
	public RowSet getTemplateInfo(String sub_cont_cd){

        Search search = new SearchImpl();
        RowSet listRowSet = null;
        String sqlstr = "";
        
        try {
            sqlstr += " SELECT            							\n"
					+ "	  SEQ,                                      \n"
					+ "	  TEMPLATE_NAME,                            \n"
					+ "	  TEMPLATE_HTML,                            \n"
					+ "	  TEMPLATE_STYLE,                           \n"
					+ "	  CHECK_YN,                              \n"
					+ "	  OPTION_YN	                                \n"
                    + " FROM CONT_OUT_HTML      					\n"
                    + " WHERE SUB_CONT_MOD_ID =  '"+sub_cont_cd+"'		\n"
		            + " 	AND CHECK_YN IN ('Y','A')      				\n"
            		+ " ORDER BY SEQ ASC      				\n";
             
            search.setStatement(sqlstr);
            listRowSet = search.execute();
			
		}catch(Exception e){
			e.printStackTrace();
		}finally{

			if( listRowSet == null ){
            	listRowSet = new RowSetImpl();
            }
            
			return listRowSet;
		}
	}
	
	 /**
     * 계약서식 조회 combo 조회
	 * @param 
	 * @param 
	 * @return RowSet 
	 */
	public RowSet getTemplateFile(String sub_cont_cd){

        Search search = new SearchImpl();
        RowSet listRowSet = null;
        String sqlstr = "";
        
        try {
            sqlstr += " SELECT FILE_ID, UNIQUE_FILE_NAME, FILE_PATH, FILE_EXT,          \n"   
            		+ "		TRIM(          \n"              
            		+ "        CASE                         \n"
				    + "       WHEN FILE_SIZE < 1024 THEN TO_CHAR(FILE_SIZE, '999,999') || ' Byte'          \n"
				    + "       ELSE          \n"
				    + "            CASE                WHEN FILE_SIZE < (1024*1024) THEN TO_CHAR(FLOOR(FILE_SIZE / 1024), '999,999') || ' KByte'          \n"
				    + "             ELSE  TO_CHAR(FLOOR(FILE_SIZE / (1024*1024)), '999,999,999') || ' MByte'          \n"
				    + "            END                           \n"                              
				    + "      END ) AS FILE_SIZE, FILE_NAME         \n"
                    + " FROM CONT_OUT_FILE      					\n"
                    + " WHERE SUB_CONT_MOD_ID =  '"+sub_cont_cd+"'		\n"
		            + " ORDER BY FILE_ID ASC      				\n";
             
            search.setStatement(sqlstr);
            listRowSet = search.execute();
			
		}catch(Exception e){
			e.printStackTrace();
		}finally{

			if( listRowSet == null ){
            	listRowSet = new RowSetImpl();
            }
            
			return listRowSet;
		}
	}

	/**
	 * 계약 대상리스트 조회
	 * @param Params
	 * @return
	 */
	private RowSet getContList(ValueObject param) {

		Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        ValueObject user = storage.getUser();
        
     //   String sqlstr = "";
        StrBuffer sqlstr = new StrBuffer();
        try{
        	sqlstr.append(" 	SELECT A.SUB_CONT_MOD_ID	\n");
        	sqlstr.append(" 	     ,A.CON_DOC_NO	\n");
        	sqlstr.append(" 	     ,A.MOD_NO	\n");
        	sqlstr.append(" 	     ,A.DEPT_NAME	\n");
        	sqlstr.append(" 	     ,A.BUILD_NAME	\n");
        	sqlstr.append(" 	     ,TO_CHAR(A.CON_DATE, 'YYYY-MM-DD') AS CON_DATE	\n");
        	sqlstr.append(" 	     ,F.MEMBER_NAME	\n");
        	sqlstr.append(" 	     ,A.CON_AMT	\n");
        	sqlstr.append(" 	     ,A.CON_SUPPLY_AMT	\n");
        	sqlstr.append(" 	     ,TO_CHAR(A.START_WORK_DATE, 'YYYY-MM-DD') || '~' || TO_CHAR(A.END_WORK_DATE, 'YYYY-MM-DD') AS WORK_START_END_DATE	\n");
        	sqlstr.append(" 	     ,A.START_WORK_DATE	\n");
        	sqlstr.append(" 	     ,A.END_WORK_DATE	\n");
        	sqlstr.append(" 	     ,A.CON_GB 	\n");
        	sqlstr.append(" 	     ,A.STATUS_CD 	\n");
        	sqlstr.append(" 	     ,F_GET_CODE_NAME('CONT_STATUS_CD', A.STATUS_CD) AS STATUS_CD_NM	\n");
        	sqlstr.append(" 	     ,A.TEMPLATE_CD \n");
        	sqlstr.append(" 	     ,B.TEMPLATE_NAME \n");
        	sqlstr.append(" 	     ,C.CHG_CONT_YN \n");
        	sqlstr.append(" 	     ,A.CON_CUR_CD 	\n");
        	sqlstr.append(" 	     ,G.CHG_CODE01 SOSUNUM 	\n"); //2018.11.1
        	sqlstr.append(" 	  FROM SUB2000T A, CONT_OUT_HTML B, CONT_TEMPLATE C, CONT_OUT_SUPP F, EBID_COM911T G	\n");
        	sqlstr.append("   WHERE 1=1					\n");
        	sqlstr.append("   	AND A.SUB_CONT_MOD_ID = B.SUB_CONT_MOD_ID					\n");
        	sqlstr.append("   	AND A.TEMPLATE_CD = C.TEMPLATE_CD					\n");
        	sqlstr.append("   	AND B.SEQ=0					\n");
        	sqlstr.append("   	AND C.SEQ=0					\n");
    		sqlstr.append("   	AND A.SUB_CONT_MOD_ID = F.SUB_CONT_MOD_ID				\n");
    		sqlstr.append("   	AND A.CON_CUR_CD = G.DETAILCD(+)				\n");
    		sqlstr.append("   	AND G.BASECD(+) ='911'				\n");
    		sqlstr.append("   	AND F.SIGN_SEQ = 2				\n");
    		sqlstr.append("   	AND A.ELEC_CON_YN = 'Y'				\n");
    		sqlstr.append("   	AND F.CORP_ID = "+ user.get("CORP_ID") +"			\n");
        	if(!param.get("P_DEPT_CD").isEmpty())
        		sqlstr.append("   AND A.DEPT_CD = '"+param.get("P_DEPT_CD")+"'			\n");
        	if(!param.get("P_DEPT_NM").isEmpty())	//현장명을 텍스트 검색으로 함
        		sqlstr.append("   AND A.DEPT_NAME LIKE '%'|| '"+param.get("P_DEPT_NM")+"' ||'%'			\n");
        	if(!param.get("P_BUILD_NM").isEmpty())
        		sqlstr.append("   AND A.BUILD_NAME LIKE '%"+param.get("P_BUILD_NM")+"%'				\n");
        	if(!param.get("ContFromDt").isEmpty())		//계약기간
        		sqlstr.append("   AND TO_CHAR(A.CON_DATE, 'YYYY-MM-DD') >= '"+param.get("ContFromDt")+"'				\n");
        	if(!param.get("ContToDt").isEmpty())
        		sqlstr.append("   AND TO_CHAR(A.CON_DATE, 'YYYY-MM-DD') <= '"+param.get("ContToDt")+"'				\n");
        	if(!param.get("P_CONT_STATUS").isEmpty())
        		sqlstr.append("   AND A.STATUS_CD IN ("+param.get("P_CONT_STATUS")+")				\n");
        	
        	sqlstr.append("   ORDER BY A.CON_DATE DESC, A.SUB_CONT_ID DESC, A.MOD_NO DESC	\n");
        	
			search.setStatement(sqlstr.toString());
            rowSet = search.execute();
        }
        catch (WAFSQLException se) {
            super.doException(se);
            this.storage.setSuccess(false);  
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
            //System.out.println("### WAFSQLException : " + se.getMessage());
        }
        finally {    
            if(rowSet == null){
            	rowSet = new RowSetImpl();
            }
        }
        //System.out.println("### rowSet size : " + rowSet.size());
        return rowSet;
	}
	

	
	/**
	 * 계약 상세 정보
	 * @param Params
	 * @return
	 */
	private ValueObject getContRequestValueObject(String SUB_CONT_MOD_ID) {

		Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        ValueObject valueobject = null;
     //   String sqlstr = "";
        StrBuffer sqlstr = new StrBuffer();
        try{
	        	sqlstr.append(" 	SELECT A.SUB_CONT_MOD_ID	\n");
	        	sqlstr.append(" 	     , A.CON_DOC_NO	\n");
	        	sqlstr.append(" 	     , A.MOD_NO	\n");	
	        	sqlstr.append(" 	     , A.DEPT_NAME	\n");	
	        	sqlstr.append(" 	     , A.BUILD_NAME	\n");	
	        	sqlstr.append(" 	     , A.CON_DATE	\n");	
	        	sqlstr.append(" 	     , A.DEALER_NM	\n");	
	        	sqlstr.append(" 	     , A.CON_AMT	\n");	
	        	sqlstr.append(" 	     , A.START_WORK_DATE	\n");	
	        	sqlstr.append(" 	     , A.ELEC_CON_YN	\n");	
	        	sqlstr.append(" 	     , TO_CHAR(A.START_WORK_DATE,'YYYY') AS START_WORK_DATE_YEAR 	\n");	
	        	sqlstr.append(" 	     , TO_CHAR(A.START_WORK_DATE,'MM') AS START_WORK_DATE_MONTH 	\n");	
	        	sqlstr.append(" 	     , TO_CHAR(A.START_WORK_DATE,'DD') AS START_WORK_DATE_DAY 	\n");	
	        	sqlstr.append(" 	     , A.END_WORK_DATE	\n");	
	        	sqlstr.append(" 	     , TO_CHAR(A.END_WORK_DATE,'YYYY') AS END_WORK_DATE_YEAR 	\n");	
	        	sqlstr.append(" 	     , TO_CHAR(A.END_WORK_DATE,'MM') AS END_WORK_DATE_MONTH 	\n");	
	        	sqlstr.append(" 	     , TO_CHAR(A.END_WORK_DATE,'DD') AS END_WORK_DATE_DAY 	\n");	
	        	sqlstr.append(" 	     , A.CON_GB 	\n");	
	        	sqlstr.append(" 	     , A.UND_CON_NAME 	\n");	
	        	sqlstr.append(" 	     , A.SUB_UND_CON_NAME 	\n");	
	        	sqlstr.append(" 	     , A.WORK_PLACE 	\n");	
	        	sqlstr.append(" 	     , A.CON_SUPPLY_AMT 	\n");	
	        	sqlstr.append(" 	     , A.LABOR_AMT 	\n");	     	
	        	sqlstr.append(" 	     , A.CON_SUPPLY_TAMT 	\n");	
	        	sqlstr.append(" 	     , A.CON_SUPPLY_NAMT 	\n");	
	        	sqlstr.append(" 	     , A.CON_SURTAX_AMT 	\n");	
	        	sqlstr.append(" 	     , A.PREPAY_AMT 	\n");	
	        	sqlstr.append(" 	     , A.PREPAY_RATE 	\n");	
	        	sqlstr.append(" 	     , A.PAY_WAY_BILL 	\n");	
	        	sqlstr.append(" 	     , A.PAY_WAY_CASH 	\n");	

	        	sqlstr.append(" 	     , A.PREPAY_SUPPLY_AMT 	\n");	
	        	sqlstr.append(" 	     , A.PREPAY_SUPPLY_TAMT 	\n");	
	        	sqlstr.append(" 	     , A.PREPAY_SUPPLY_NAMT 	\n");	
	        	sqlstr.append(" 	     , A.PREPAY_SURTAX_AMT 	\n");	
	        	sqlstr.append(" 	     , A.CON_EST_GUAR_AMT 	\n");	
	        	sqlstr.append(" 	     , A.CON_EST_GUAR_RATE 	\n");	
	        	sqlstr.append(" 	     , A.DEF_EST_GUAR_RATE 	\n");	
	        	sqlstr.append(" 	     , A.DELAY_RATE 	\n");	
	        	sqlstr.append(" 	     , TO_CHAR(A.CON_DATE,'YYYY') AS CON_DATE_YEAR 	\n");	
	        	sqlstr.append(" 	     , TO_CHAR(A.CON_DATE,'MM') AS CON_DATE_MONTH 	\n");	
	        	sqlstr.append(" 	     , TO_CHAR(A.CON_DATE,'DD') AS CON_DATE_DAY 	\n");	
	        	sqlstr.append(" 	     , A.STATUS_CD 	\n");	
	        	sqlstr.append(" 	     , A.MONTH_ACMP_CNT 	\n");	
	        	sqlstr.append(" 	     , A.OBJ_RCPT_DAY 	\n");	
	        	sqlstr.append(" 	     , A.TEMPLATE_CD 	\n");	
	        	sqlstr.append(" 	     , A.TRUE_RANDOM 	\n");	
	        	sqlstr.append(" 	     , A.CONT_HASH 	\n");	
	        	sqlstr.append(" 	     , A.MODI_REQ_REASON 	\n");	
	        	sqlstr.append(" 	     , A.MODI_REQ_DT 	\n");	
	        	
	        	sqlstr.append(" 	     , A.STAMP_DUTY_GB	\n");
	        		        	
	        	sqlstr.append(" 	     , B.DEMANDED_NO	\n");	
	        	sqlstr.append(" 	     , B.DEMANDED_TITLE	\n");	
	        	sqlstr.append(" 	     , TO_CHAR(B.REQUEST_DATE,'YYYY-MM-DD') AS REQUEST_DATE	\n");	
	        	sqlstr.append(" 	     , B.REQ_DEPT_NM	\n");	
	        	sqlstr.append(" 	     , B.EMP_NO	\n");	
	        	sqlstr.append(" 	     , B.EMP_NM	\n");	
	        	sqlstr.append(" 	     , F_GET_PAY_ITEM_VIEW(B.PAY_ITEM,B.COST_CODE,B.COST_TYPE,B.DEPT_CD) AS PAY_ITEM	\n");	
	        	sqlstr.append(" 	     , DECODE(D.CORP_ID, '', 0, D.CORP_ID)  AS O_CORP_ID	\n");	
	        	sqlstr.append(" 	     , DECODE(D.MEMBER_NAME, '', C.CORP_KOR, D.MEMBER_NAME)  AS O_MEMBER_NAME	\n");	
	        	sqlstr.append(" 	     , DECODE(D.ADDRESS, '', C.ADDRESS, D.ADDRESS) AS O_ADDRESS	\n");	
	        	sqlstr.append(" 	     , DECODE(D.BOSS_NAME, '', C.REP_NAME, D.BOSS_NAME) AS O_BOSS_NAME	\n");	
	        	sqlstr.append(" 	     , D.USER_NAME AS O_USER_NAME	\n");	
	        	sqlstr.append(" 	     , D.TEL_NUM AS O_TEL_NUM	\n");	
	        	sqlstr.append(" 	     , D.DIVISION AS O_DIVISION	\n");	
	        	sqlstr.append(" 	     , D.POSITION AS O_POSITION	\n");	
	        	sqlstr.append(" 	     , D.HP AS O_HP	\n");	
	        	sqlstr.append(" 	     , D.EMAIL AS O_EMAIL	\n");	
	        	sqlstr.append(" 	     , TO_CHAR(D.SIGN_DATE,'YYYY-MM-DD HH24:MI:SS') AS O_SIGN_DATE	\n");
	        	sqlstr.append(" 	     , D.VENDCD AS O_VENDCD	\n");		        	
	        	sqlstr.append(" 	     , E.CORP_ID  AS C_CORP_ID	\n");	
	        	sqlstr.append(" 	     , E.MEMBER_NAME AS C_MEMBER_NAME	\n");	
	        	sqlstr.append(" 	     , E.ADDRESS AS C_ADDRESS	\n");	
	        	sqlstr.append(" 	     , E.BOSS_NAME AS C_BOSS_NAME	\n");	
	        	sqlstr.append(" 	     , E.USER_NAME AS C_USER_NAME	\n");	
	        	sqlstr.append(" 	     , E.TEL_NUM AS C_TEL_NUM	\n");	
	        	sqlstr.append(" 	     , E.DIVISION AS C_DIVISION	\n");	
	        	sqlstr.append(" 	     , E.POSITION AS C_POSITION	\n");	
	        	sqlstr.append(" 	     , E.HP AS C_HP	\n");	
	        	sqlstr.append(" 	     , E.VENDCD AS C_VENDCD	\n");		        	
	        	sqlstr.append(" 	     , E.EMAIL AS C_EMAIL	\n");	
	        	sqlstr.append(" 	     , TO_CHAR(E.SIGN_DATE,'YYYY-MM-DD HH24:MI:SS') AS C_SIGN_DATE	\n");

	        	sqlstr.append(" 	     , NVL(F.STAMP_DUTY_ISSUE_GB,'00') AS STAMP_DUTY_ISSUE_GB	\n");
	        	sqlstr.append(" 	     , F.STAMP_DUTY_NO											\n");
	        	sqlstr.append(" 	     , F.STAMP_DUTY_TAX											\n");
	        	sqlstr.append(" 	     , F.STAMP_DUTY_DATE										\n");
	        	sqlstr.append(" 	     , F.REMARK													\n");
	        	sqlstr.append(" 	     , F.STAMP_DUTY_ID											\n");
	        	
				sqlstr.append("  FROM SUB2000T A, BID_MASTER B, HEAD_OFFICE_INFO C, CONT_OUT_SUPP D, CONT_OUT_SUPP E, STAMP_DUTY F	\n");
				sqlstr.append("  WHERE A.BID_NO = B.BID_NO(+) 	\n");
				sqlstr.append("  AND A.BID_DEG = B.BID_DEG(+)	\n");
				sqlstr.append("  AND A.SUB_CONT_MOD_ID = D.SUB_CONT_MOD_ID(+)	\n");
				sqlstr.append("  AND D.SIGN_SEQ(+) = 1 --원사업자	\n");
				sqlstr.append("  AND A.SUB_CONT_MOD_ID = E.SUB_CONT_MOD_ID(+)	\n");
				sqlstr.append("  AND E.SIGN_SEQ(+) = 2 --계약업체정보  	\n");
				sqlstr.append("  AND A.SUB_CONT_MOD_ID = '"+SUB_CONT_MOD_ID+"'							\n");
				sqlstr.append("  AND A.SUB_CONT_MOD_ID = F.CONT_MOD_ID(+)	\n");
				sqlstr.append("  AND F.STAMP_DUTY_TYPE(+) = '20'			\n");

			search.setStatement(sqlstr.toString());
            rowSet = search.execute();
            
            if( rowSet != null && rowSet.size() > 0 ){
            	valueobject = RowSetUtility.getValueObject(rowSet.getRow(0));
            }
            	
        }
        catch(WAFSQLException se) {
        	super.doException(se);
            this.storage.setSuccess(false);
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
            //System.out.println(sqlstr.toString());
            //System.out.println("WAFSQLException : " + se.getMessage());
        }
        finally {

        	if( valueobject == null ) valueobject = new ValueObject();
        	//System.out.println("### valueobject size : " + valueobject.size());
            return valueobject;
        }
	}

	/**
	 * 보증 대상리스트 조회
	 * @param Params
	 * @return
	 */
	private RowSet getWarrList(ValueObject param) {

		Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        
     //   String sqlstr = "";
        /*
		보증서 종류
		  002 : 계약이행
		  003 : 하자
		  004 : 선금
		  005 : 근로자재해
		  39 : 하도급대금지급         * 
         * */
        StrBuffer sqlstr = new StrBuffer();
        try{
        	if(param.get("MOD_NO").equals("0")){
	        	sqlstr.append("	SELECT  WARR_GUBUN	\n");
	        	sqlstr.append("	    , WARR_GUBUN_NM	\n");
	        	sqlstr.append("	    , MAX(MOD_NO) AS MOD_NO	\n");
	        	sqlstr.append("	    , MAX(WARR_SEQ) AS WARR_SEQ	\n");
	        	sqlstr.append("	    , MAX(WARR_WAMT) AS WARR_WAMT	\n");
	        	sqlstr.append("	    , MAX(VIEW_DIV) AS VIEW_DIV	\n");
	        	sqlstr.append("	    , MAX(CAUSECODE) AS CAUSECODE	\n");
	        	sqlstr.append("	    , MAX(CAUSECODE_NM) AS CAUSECODE_NM	\n");
	        	sqlstr.append("	    , MAX(GUAR_ORGAN_CODE) AS GUAR_ORGAN_CODE	\n");
	        	sqlstr.append("	    , MAX(WARR_GOFFICE_ID) AS WARR_GOFFICE_ID	\n");
	        	sqlstr.append("	    , MAX(WARR_GOFFICE) AS WARR_GOFFICE	\n");
	        	sqlstr.append("	    , MAX(GUAR_STATUS) AS GUAR_STATUS	\n");
	        	sqlstr.append("	    , MAX(GUAR_STATUS_NM) AS GUAR_STATUS_NM	\n");
	        	sqlstr.append("	    , MAX(PAPERDATE) AS PAPERDATE	\n");
	        	sqlstr.append("	    , MAX(WARR_WGNO) AS WARR_WGNO	\n");
	        	sqlstr.append("	    , MAX(WARR_SDATE) AS WARR_SDATE	\n");
	        	sqlstr.append("	    , MAX(WARR_EDATE) AS WARR_EDATE	\n");
	        	sqlstr.append("	    , MAX(GUAR_ONOFF_NM) AS GUAR_ONOFF_NM	\n");
	        	sqlstr.append("	    , MAX(GUAR_ONOFF_YN) AS GUAR_ONOFF_YN	\n");
	        	sqlstr.append("	    , MAX(GRTREQNO) AS GRTREQNO	\n");
	        	sqlstr.append("	     FROM (	\n");
	        	sqlstr.append("	              SELECT WARR_GUBUN	\n");
	        	sqlstr.append("	                   , F_GET_CODE_NAME('GAUR_KIND',WARR_GUBUN) AS WARR_GUBUN_NM	\n");
	        	sqlstr.append("	                   , MOD_NO	\n");
	        	sqlstr.append("	                   , WARR_SEQ	\n");
	        	sqlstr.append("	                   , WARR_WAMT	\n");
	        	sqlstr.append("	                   , VIEW_DIV	\n");
	        	sqlstr.append("	                   , CAUSECODE	\n");
	        	sqlstr.append("	                   , F_GET_CODE_NAME('CAUSECODE',CAUSECODE) AS CAUSECODE_NM	\n");
	        	sqlstr.append("	                   , GUAR_ORGAN_CODE	\n");
	        	sqlstr.append("	                   , F_GET_CODE_NAME('GUAROFFICEID',GUAR_ORGAN_CODE) AS WARR_GOFFICE_ID	\n");
	        	sqlstr.append("	                   , F_GET_CODE_NAME('GUARORGAN',GUAR_ORGAN_CODE) AS WARR_GOFFICE	\n");
	        	sqlstr.append("	                   , GUAR_STATUS	\n");
	        	sqlstr.append("	                   , F_GET_CODE_NAME('GUAR_STATUS',GUAR_STATUS) AS GUAR_STATUS_NM	\n");
	        	sqlstr.append("	                   , PAPERDATE	\n");
	        	sqlstr.append("	                   , WARR_WGNO	\n");
	        	sqlstr.append("	                   , WARR_SDATE	\n");
	        	sqlstr.append("	                   , WARR_EDATE 	\n");
	        	sqlstr.append("	                   , DECODE(GUAR_ONOFF_YN,'Y','온라인','N','오프라인') AS GUAR_ONOFF_NM	\n");
	        	sqlstr.append("	                   , GUAR_ONOFF_YN 	\n");
	        	sqlstr.append("	                   , GRTREQNO 	\n");
	        	sqlstr.append("	                FROM CONT_OUT_WARR 	\n");
	        	sqlstr.append("	               WHERE SUB_CONT_MOD_ID = '"+ param.get("SUB_CONT_MOD_ID") +"' 	\n");
	        	sqlstr.append("	                     AND WARR_GUBUN IN ('1','4')	\n");
	        	sqlstr.append("		\n");
	        	sqlstr.append("	              UNION ALL	\n");
	        	sqlstr.append("		\n");
	        	sqlstr.append("	              SELECT '1' AS WARR_GUBUN	\n");
	        	sqlstr.append("	                   , '계약이행보증' AS WARR_GUBUN_NM	\n");
	        	sqlstr.append("	                   , MOD_NO	\n");
	        	sqlstr.append("	                   , 1 AS WARR_SEQ	\n");
	        	sqlstr.append("	                   , 0 AS WARR_WAMT	\n");
	        	sqlstr.append("	                   , 'CONT' AS VIEW_DIV	\n");
	        	sqlstr.append("	                   , '01' AS CAUSECODE	\n");
	        	sqlstr.append("	                   , F_GET_CODE_NAME('CAUSECODE','01') AS CAUSECODE_NM	\n");
	        	sqlstr.append("	                   , '' AS GUAR_ORGAN_CODE	\n");
	        	sqlstr.append("	                   , '' AS WARR_GOFFICE_ID	\n");
	        	sqlstr.append("	                   , '' AS WARR_GOFFICE	\n");
	        	sqlstr.append("	                   , '' AS GUAR_STATUS	\n");
	        	sqlstr.append("	                   , '' AS GUAR_STATUS_NM	\n");
	        	sqlstr.append("	                   , '' AS PAPERDATE	\n");
	        	sqlstr.append("	                   , '' AS WARR_WGNO	\n");
	        	sqlstr.append("	                   , '' AS WARR_SDATE	\n");
	        	sqlstr.append("	                   , '' AS WARR_EDATE 	\n");
	        	sqlstr.append("	                   , '' AS GUAR_ONOFF_NM 	\n");
	        	sqlstr.append("	                   , '' AS GUAR_ONOFF_YN 	\n");
	        	sqlstr.append("	                   , '' AS GRTREQNO 	\n");
	        	sqlstr.append("	                FROM DUAL A, SUB2000T B  	\n");
	        	sqlstr.append("	               WHERE SUB_CONT_MOD_ID = '"+ param.get("SUB_CONT_MOD_ID") +"' 	\n");
	        	sqlstr.append("	                     AND B.CON_EST_GUAR_AMT > 0	\n");
	        	sqlstr.append("	                	\n");
	        	sqlstr.append("	              UNION ALL	\n");
	        	sqlstr.append("		\n");
	        	sqlstr.append("	              SELECT '4' AS WARR_GUBUN	\n");
	        	sqlstr.append("	                   , '근로자재해보증' AS WARR_GUBUN_NM	\n");
	        	sqlstr.append("	                   , MOD_NO	\n");
	        	sqlstr.append("	                   , 2 AS WARR_SEQ	\n");
	        	sqlstr.append("	                   , 0 AS WARR_WAMT	\n");
	        	sqlstr.append("	                   , 'CONT' AS VIEW_DIV	\n");
	        	sqlstr.append("	                   , '01' AS CAUSECODE	\n");
	        	sqlstr.append("	                   , F_GET_CODE_NAME('CAUSECODE','01') AS CAUSECODE_NM	\n");
	        	sqlstr.append("	                   , '' AS GUAR_ORGAN_CODE	\n");
	        	sqlstr.append("	                   , '' AS WARR_GOFFICE_ID	\n");
	        	sqlstr.append("	                   , '' AS WARR_GOFFICE	\n");
	        	sqlstr.append("	                   , '' AS GUAR_STATUS	\n");
	        	sqlstr.append("	                   , '' AS GUAR_STATUS_NM	\n");
	        	sqlstr.append("	                   , '' AS PAPERDATE	\n");
	        	sqlstr.append("	                   , '' AS WARR_WGNO	\n");
	        	sqlstr.append("	                   , '' AS WARR_SDATE	\n");
	        	sqlstr.append("	                   , '' AS WARR_EDATE 	\n");
	        	sqlstr.append("	                   , '' AS GUAR_ONOFF_NM 	\n");
	        	sqlstr.append("	                   , '' AS GUAR_ONOFF_YN 	\n");
	        	sqlstr.append("	                   , '' AS GRTREQNO 	\n");
	        	sqlstr.append("	                FROM DUAL A, SUB2000T B  	\n");
	        	sqlstr.append("	               WHERE SUB_CONT_MOD_ID = '"+ param.get("SUB_CONT_MOD_ID") +"' 	\n");
	        	sqlstr.append("	                     AND B.LABOR_AMT > 0	\n");
	        	sqlstr.append("	     )	\n");
	        	sqlstr.append("	GROUP BY  WARR_GUBUN, WARR_GUBUN_NM	\n");
	        	sqlstr.append("	ORDER BY  WARR_GUBUN	\n");
	        	sqlstr.append("	--, WARR_SEQ, WARR_WAMT, VIEW_DIV, CAUSECODE, WARR_GOFFICE, GUAR_STATUS, PAPERDATE, WARR_WGNO, WARR_SDATE, WARR_EDATE 	\n");
        	}else{	//변경 계약일경우 
        		
        		if(!param.get("WON_WARR").equals("S")){
        			
        			sqlstr.append("	SELECT  WARR_GUBUN	\n");
        			sqlstr.append("	    , WARR_GUBUN_NM	\n");
        			sqlstr.append("	    , MAX(MOD_NO) AS MOD_NO	\n");
        			sqlstr.append("	    , WARR_SEQ	\n");
        			sqlstr.append("	    , MAX(WARR_WAMT) AS WARR_WAMT	\n");
        			sqlstr.append("	    , MAX(VIEW_DIV) AS VIEW_DIV	\n");
        			sqlstr.append("	    , CAUSECODE AS CAUSECODE	\n");
        			sqlstr.append("	    , CAUSECODE_NM AS CAUSECODE_NM	\n");
        			sqlstr.append("	    , MAX(GUAR_ORGAN_CODE) AS GUAR_ORGAN_CODE	\n");
        			sqlstr.append("	    , MAX(WARR_GOFFICE_ID) AS WARR_GOFFICE_ID	\n");
        			sqlstr.append("	    , MAX(WARR_GOFFICE) AS WARR_GOFFICE	\n");
        			sqlstr.append("	    , MAX(GUAR_STATUS) AS GUAR_STATUS	\n");
        			sqlstr.append("	    , MAX(GUAR_STATUS_NM) AS GUAR_STATUS_NM	\n");
        			sqlstr.append("	    , MAX(PAPERDATE) AS PAPERDATE	\n");
        			sqlstr.append("	    , MAX(WARR_WGNO) AS WARR_WGNO	\n");
        			sqlstr.append("	    , MAX(WARR_SDATE) AS WARR_SDATE	\n");
        			sqlstr.append("	    , MAX(WARR_EDATE) AS WARR_EDATE	\n");
        			sqlstr.append("	    , MAX(GUAR_ONOFF_NM) AS GUAR_ONOFF_NM	\n");
        			sqlstr.append("	    , MAX(GUAR_ONOFF_YN) AS GUAR_ONOFF_YN	\n");
        			sqlstr.append("	    , MAX(GRTREQNO) AS GRTREQNO	\n");
        			sqlstr.append("	     FROM (	\n");
        			sqlstr.append("	              SELECT WARR_GUBUN	\n");
        			sqlstr.append("	                   , F_GET_CODE_NAME('GAUR_KIND',WARR_GUBUN) AS WARR_GUBUN_NM	\n");
        			sqlstr.append("	                   , MOD_NO	\n");
        			sqlstr.append("	                   , WARR_SEQ	\n");
        			sqlstr.append("	                   , WARR_WAMT	\n");
        			sqlstr.append("	                   , VIEW_DIV	\n");
        			sqlstr.append("	                   , CAUSECODE	\n");
        			sqlstr.append("	                   , F_GET_CODE_NAME('CAUSECODE',CAUSECODE) AS CAUSECODE_NM	\n");
        			sqlstr.append("	                   , GUAR_ORGAN_CODE	\n");
        			sqlstr.append("	                   , F_GET_CODE_NAME('GUAROFFICEID',GUAR_ORGAN_CODE) AS WARR_GOFFICE_ID	\n");
        			sqlstr.append("	                   , F_GET_CODE_NAME('GUARORGAN',GUAR_ORGAN_CODE) AS WARR_GOFFICE	\n");
        			sqlstr.append("	                   , GUAR_STATUS	\n");
        			sqlstr.append("	                   , F_GET_CODE_NAME('GUAR_STATUS',GUAR_STATUS) AS GUAR_STATUS_NM	\n");
        			sqlstr.append("	                   , PAPERDATE	\n");
        			sqlstr.append("	                   , WARR_WGNO	\n");
        			sqlstr.append("	                   , WARR_SDATE	\n");
        			sqlstr.append("	                   , WARR_EDATE 	\n");
        			sqlstr.append("	                   , DECODE(GUAR_ONOFF_YN,'Y','온라인','N','오프라인') AS GUAR_ONOFF_NM	\n");
        			sqlstr.append("	                   , GUAR_ONOFF_YN 	\n");
        			sqlstr.append("	                   , GRTREQNO 	\n");
        			sqlstr.append("	                FROM CONT_OUT_WARR 	\n");
        			sqlstr.append("	               WHERE SUB_CONT_MOD_ID = '"+ param.get("SUB_CONT_MOD_ID") +"' 	\n");
        			sqlstr.append("	                     AND WARR_GUBUN IN ('1','4')	\n");
        			sqlstr.append("		\n");
        			sqlstr.append("	              UNION ALL	\n");
        			sqlstr.append("		\n");
        			sqlstr.append("	              SELECT '1' AS WARR_GUBUN	\n");
        			sqlstr.append("	                   , '계약이행보증' AS WARR_GUBUN_NM	\n");
        			sqlstr.append("	                   , MOD_NO	\n");
        			sqlstr.append("	                   , 1 AS WARR_SEQ	\n");
        			sqlstr.append("	                   , 0 AS WARR_WAMT	\n");
        			sqlstr.append("	                   , 'CONT' AS VIEW_DIV	\n");
        			sqlstr.append("	                   , DECODE(SUBSTR(MOD_GB,1,1),1,'02',2,'08') AS CAUSECODE	\n");
        			sqlstr.append("	                   , F_GET_CODE_NAME('CAUSECODE',DECODE(SUBSTR(MOD_GB,1,1),1,'02',2,'08')) AS CAUSECODE_NM	\n");
        			sqlstr.append("	                   , '' AS GUAR_ORGAN_CODE	\n");
        			sqlstr.append("	                   , '' AS WARR_GOFFICE_ID	\n");
        			sqlstr.append("	                   , '' AS WARR_GOFFICE	\n");
        			sqlstr.append("	                   , '' AS GUAR_STATUS	\n");
        			sqlstr.append("	                   , '' AS GUAR_STATUS_NM	\n");
        			sqlstr.append("	                   , '' AS PAPERDATE	\n");
        			sqlstr.append("	                   , '' AS WARR_WGNO	\n");
        			sqlstr.append("	                   , '' AS WARR_SDATE	\n");
        			sqlstr.append("	                   , '' AS WARR_EDATE 	\n");
        			sqlstr.append("	                   , '' AS GUAR_ONOFF_NM 	\n");
        			sqlstr.append("	                   , '' AS GUAR_ONOFF_YN 	\n");
        			sqlstr.append("	                   , '' AS GRTREQNO 	\n");
        			sqlstr.append("	                FROM DUAL A, SUB2000T B  	\n");
        			sqlstr.append("	               WHERE SUB_CONT_MOD_ID = '"+ param.get("SUB_CONT_MOD_ID") +"' 	\n");
        			sqlstr.append("	                     AND B.CON_EST_GUAR_AMT > 0	\n");
        			sqlstr.append("	                     AND B.MOD_GB NOT IN ('99', '98')	\n"); //2019.10.18 타절계약 추가
        			sqlstr.append("	                     AND SUBSTR(MOD_GB,1,1) !=0	\n");
        			sqlstr.append("	                	\n");
        			sqlstr.append("	              UNION ALL	\n");
        			sqlstr.append("		\n");
        			sqlstr.append("	              SELECT '1' AS WARR_GUBUN	\n");
        			sqlstr.append("	                   , '계약이행보증' AS WARR_GUBUN_NM	\n");
        			sqlstr.append("	                   , MOD_NO	\n");
        			sqlstr.append("	                   , 2 AS WARR_SEQ	\n");
        			sqlstr.append("	                   , 0 AS WARR_WAMT	\n");
        			sqlstr.append("	                   , 'CONT' AS VIEW_DIV	\n");
        			sqlstr.append("	                   , DECODE(SUBSTR(MOD_GB,2,1),1,'03',2,'09') AS CAUSECODE	\n");
        			sqlstr.append("	                   , F_GET_CODE_NAME('CAUSECODE',DECODE(SUBSTR(MOD_GB,2,1),1,'03',2,'09')) AS CAUSECODE_NM	\n");
        			sqlstr.append("	                   , '' AS GUAR_ORGAN_CODE	\n");
        			sqlstr.append("	                   , '' AS WARR_GOFFICE_ID	\n");
        			sqlstr.append("	                   , '' AS WARR_GOFFICE	\n");
        			sqlstr.append("	                   , '' AS GUAR_STATUS	\n");
        			sqlstr.append("	                   , '' AS GUAR_STATUS_NM	\n");
        			sqlstr.append("	                   , '' AS PAPERDATE	\n");
        			sqlstr.append("	                   , '' AS WARR_WGNO	\n");
        			sqlstr.append("	                   , '' AS WARR_SDATE	\n");
        			sqlstr.append("	                   , '' AS WARR_EDATE 	\n");
        			sqlstr.append("	                   , '' AS GUAR_ONOFF_NM 	\n");
        			sqlstr.append("	                   , '' AS GUAR_ONOFF_YN 	\n");
        			sqlstr.append("	                   , '' AS GRTREQNO 	\n");
        			sqlstr.append("	                FROM DUAL A, SUB2000T B  	\n");
        			sqlstr.append("	               WHERE SUB_CONT_MOD_ID = '"+ param.get("SUB_CONT_MOD_ID") +"' 	\n");
        			sqlstr.append("	                     AND B.CON_EST_GUAR_AMT > 0	\n");
        			sqlstr.append("	                     AND B.MOD_GB NOT IN ('99', '98')	\n"); //2019.10.18 타절계약 추가
        			sqlstr.append("	                     AND SUBSTR(MOD_GB,2,1) !=0	\n");
        			sqlstr.append("	              UNION ALL	\n");
        			sqlstr.append("		\n");
        			sqlstr.append("	              SELECT '4' AS WARR_GUBUN	\n");
        			sqlstr.append("	                   , '근로자재해보증' AS WARR_GUBUN_NM	\n");
        			sqlstr.append("	                   , MOD_NO	\n");
        			sqlstr.append("	                   , 3 AS WARR_SEQ	\n");
        			sqlstr.append("	                   , 0 AS WARR_WAMT	\n");
        			sqlstr.append("	                   , 'CONT' AS VIEW_DIV	\n");
        			sqlstr.append("	                   , DECODE(MOD_GB,'01','03','11','04','12','06','10','02','21','05','22','07','20','08','02','09') AS CAUSECODE	\n");
        			sqlstr.append("	                   , F_GET_CODE_NAME('CAUSECODE',DECODE(MOD_GB,'01','03','11','04','12','06','10','02','21','05','22','07','20','08','02','09')) AS CAUSECODE_NM	\n");
        			sqlstr.append("	                   , '' AS GUAR_ORGAN_CODE	\n");
        			sqlstr.append("	                   , '' AS WARR_GOFFICE_ID	\n");
        			sqlstr.append("	                   , '' AS WARR_GOFFICE	\n");
        			sqlstr.append("	                   , '' AS GUAR_STATUS	\n");
        			sqlstr.append("	                   , '' AS GUAR_STATUS_NM	\n");
        			sqlstr.append("	                   , '' AS PAPERDATE	\n");
        			sqlstr.append("	                   , '' AS WARR_WGNO	\n");
        			sqlstr.append("	                   , '' AS WARR_SDATE	\n");
        			sqlstr.append("	                   , '' AS WARR_EDATE 	\n");
        			sqlstr.append("	                   , '' AS GUAR_ONOFF_NM 	\n");
        			sqlstr.append("	                   , '' AS GUAR_ONOFF_YN 	\n");
        			sqlstr.append("	                   , '' AS GRTREQNO 	\n");
        			sqlstr.append("	                FROM DUAL A, SUB2000T B  	\n");
        			sqlstr.append("	               WHERE SUB_CONT_MOD_ID = '"+ param.get("SUB_CONT_MOD_ID") +"' 	\n");
        			sqlstr.append("	                     AND B.LABOR_AMT > 0 AND MOD_GB NOT IN ('99', '98')	\n"); //2019.10.18 타절계약 추가
        			
        			sqlstr.append("	     )	\n");
        			sqlstr.append("	GROUP BY  WARR_GUBUN, WARR_GUBUN_NM, WARR_SEQ, CAUSECODE, CAUSECODE_NM	\n");
        			sqlstr.append("	ORDER BY  WARR_GUBUN	\n");
        			sqlstr.append("	--, WARR_SEQ, WARR_WAMT, VIEW_DIV, CAUSECODE, WARR_GOFFICE, GUAR_STATUS, PAPERDATE, WARR_WGNO, WARR_SDATE, WARR_EDATE 	\n");        		
        		}else{
        			
        			sqlstr.append("	SELECT  WARR_GUBUN	\n");
        			sqlstr.append("	    , WARR_GUBUN_NM	\n");
        			sqlstr.append("	    , MAX(MOD_NO) AS MOD_NO	\n");
        			sqlstr.append("	    , WARR_SEQ	\n");
        			sqlstr.append("	    , MAX(WARR_WAMT) AS WARR_WAMT	\n");
        			sqlstr.append("	    , MAX(VIEW_DIV) AS VIEW_DIV	\n");
        			sqlstr.append("	    , CAUSECODE AS CAUSECODE	\n");
        			sqlstr.append("	    , CAUSECODE_NM AS CAUSECODE_NM	\n");
        			sqlstr.append("	    , MAX(GUAR_ORGAN_CODE) AS GUAR_ORGAN_CODE	\n");
        			sqlstr.append("	    , MAX(WARR_GOFFICE_ID) AS WARR_GOFFICE_ID	\n");
        			sqlstr.append("	    , MAX(WARR_GOFFICE) AS WARR_GOFFICE	\n");
        			sqlstr.append("	    , MAX(GUAR_STATUS) AS GUAR_STATUS	\n");
        			sqlstr.append("	    , MAX(GUAR_STATUS_NM) AS GUAR_STATUS_NM	\n");
        			sqlstr.append("	    , MAX(PAPERDATE) AS PAPERDATE	\n");
        			sqlstr.append("	    , MAX(WARR_WGNO) AS WARR_WGNO	\n");
        			sqlstr.append("	    , MAX(WARR_SDATE) AS WARR_SDATE	\n");
        			sqlstr.append("	    , MAX(WARR_EDATE) AS WARR_EDATE	\n");
        			sqlstr.append("	    , MAX(GUAR_ONOFF_NM) AS GUAR_ONOFF_NM	\n");
        			sqlstr.append("	    , MAX(GUAR_ONOFF_YN) AS GUAR_ONOFF_YN	\n");
        			sqlstr.append("	    , MAX(GRTREQNO) AS GRTREQNO	\n");
        			sqlstr.append("	     FROM (	\n");
        			sqlstr.append("	              SELECT WARR_GUBUN	\n");
        			sqlstr.append("	                   , F_GET_CODE_NAME('GAUR_KIND',WARR_GUBUN) AS WARR_GUBUN_NM	\n");
        			sqlstr.append("	                   , MOD_NO	\n");
        			sqlstr.append("	                   , WARR_SEQ	\n");
        			sqlstr.append("	                   , WARR_WAMT	\n");
        			sqlstr.append("	                   , VIEW_DIV	\n");
        			sqlstr.append("	                   , CAUSECODE	\n");
        			sqlstr.append("	                   , F_GET_CODE_NAME('CAUSECODE',CAUSECODE) AS CAUSECODE_NM	\n");
        			sqlstr.append("	                   , GUAR_ORGAN_CODE	\n");
        			sqlstr.append("	                   , F_GET_CODE_NAME('GUAROFFICEID',GUAR_ORGAN_CODE) AS WARR_GOFFICE_ID	\n");
        			sqlstr.append("	                   , F_GET_CODE_NAME('GUARORGAN',GUAR_ORGAN_CODE) AS WARR_GOFFICE	\n");
        			sqlstr.append("	                   , GUAR_STATUS	\n");
        			sqlstr.append("	                   , F_GET_CODE_NAME('GUAR_STATUS',GUAR_STATUS) AS GUAR_STATUS_NM	\n");
        			sqlstr.append("	                   , PAPERDATE	\n");
        			sqlstr.append("	                   , WARR_WGNO	\n");
        			sqlstr.append("	                   , WARR_SDATE	\n");
        			sqlstr.append("	                   , WARR_EDATE 	\n");
        			sqlstr.append("	                   , DECODE(GUAR_ONOFF_YN,'Y','온라인','N','오프라인') AS GUAR_ONOFF_NM	\n");
        			sqlstr.append("	                   , GUAR_ONOFF_YN 	\n");
        			sqlstr.append("	                   , GRTREQNO 	\n");
        			sqlstr.append("	                FROM CONT_OUT_WARR 	\n");
        			sqlstr.append("	               WHERE SUB_CONT_MOD_ID = '"+ param.get("SUB_CONT_MOD_ID") +"' 	\n");
        			sqlstr.append("	                     AND WARR_GUBUN IN ('1','4')	\n");
        			sqlstr.append("		\n");
        			sqlstr.append("	              UNION ALL	\n");
        			sqlstr.append("		\n");
        			sqlstr.append("	              SELECT '1' AS WARR_GUBUN	\n");
        			sqlstr.append("	                   , '계약이행보증' AS WARR_GUBUN_NM	\n");
        			sqlstr.append("	                   , MOD_NO	\n");
        			sqlstr.append("	                   , 1 AS WARR_SEQ	\n");
        			sqlstr.append("	                   , 0 AS WARR_WAMT	\n");
        			sqlstr.append("	                   , 'CONT' AS VIEW_DIV	\n");
        			sqlstr.append("	                   , F_GET_CODE_CHGCODE1('MOD_GB',MOD_GB)  AS CAUSECODE	\n");
        			sqlstr.append("	                   , F_GET_CODE_NAME('CAUSECODE',F_GET_CODE_CHGCODE1('MOD_GB',MOD_GB)) AS CAUSECODE_NM	\n");
        			sqlstr.append("	                   , '' AS GUAR_ORGAN_CODE	\n");
        			sqlstr.append("	                   , '' AS WARR_GOFFICE_ID	\n");
        			sqlstr.append("	                   , '' AS WARR_GOFFICE	\n");
        			sqlstr.append("	                   , '' AS GUAR_STATUS	\n");
        			sqlstr.append("	                   , '' AS GUAR_STATUS_NM	\n");
        			sqlstr.append("	                   , '' AS PAPERDATE	\n");
        			sqlstr.append("	                   , '' AS WARR_WGNO	\n");
        			sqlstr.append("	                   , '' AS WARR_SDATE	\n");
        			sqlstr.append("	                   , '' AS WARR_EDATE 	\n");
        			sqlstr.append("	                   , '' AS GUAR_ONOFF_NM 	\n");
        			sqlstr.append("	                   , '' AS GUAR_ONOFF_YN 	\n");
        			sqlstr.append("	                   , '' AS GRTREQNO 	\n");
        			sqlstr.append("	                FROM DUAL A, SUB2000T B  	\n");
        			sqlstr.append("	               WHERE SUB_CONT_MOD_ID = '"+ param.get("SUB_CONT_MOD_ID") +"' 	\n");
        			sqlstr.append("	                     AND B.CON_EST_GUAR_AMT > 0	\n");
        			sqlstr.append("	                     AND B.MOD_GB NOT IN ('99', '00', '98')	\n"); //2019.10.18 타절계약 추가
        			sqlstr.append("	              UNION ALL	\n");
        			sqlstr.append("		\n");
        			sqlstr.append("	              SELECT '4' AS WARR_GUBUN	\n");
        			sqlstr.append("	                   , '근로자재해보증' AS WARR_GUBUN_NM	\n");
        			sqlstr.append("	                   , MOD_NO	\n");
        			sqlstr.append("	                   , 3 AS WARR_SEQ	\n");
        			sqlstr.append("	                   , 0 AS WARR_WAMT	\n");
        			sqlstr.append("	                   , 'CONT' AS VIEW_DIV	\n");
        			sqlstr.append("	                   , DECODE(MOD_GB,'01','03','11','04','12','06','10','02','21','05','22','07','20','08','02','09') AS CAUSECODE	\n");
        			sqlstr.append("	                   , F_GET_CODE_NAME('CAUSECODE',DECODE(MOD_GB,'01','03','11','04','12','06','10','02','21','05','22','07','20','08','02','09')) AS CAUSECODE_NM	\n");
        			sqlstr.append("	                   , '' AS GUAR_ORGAN_CODE	\n");
        			sqlstr.append("	                   , '' AS WARR_GOFFICE_ID	\n");
        			sqlstr.append("	                   , '' AS WARR_GOFFICE	\n");
        			sqlstr.append("	                   , '' AS GUAR_STATUS	\n");
        			sqlstr.append("	                   , '' AS GUAR_STATUS_NM	\n");
        			sqlstr.append("	                   , '' AS PAPERDATE	\n");
        			sqlstr.append("	                   , '' AS WARR_WGNO	\n");
        			sqlstr.append("	                   , '' AS WARR_SDATE	\n");
        			sqlstr.append("	                   , '' AS WARR_EDATE 	\n");
        			sqlstr.append("	                   , '' AS GUAR_ONOFF_NM 	\n");
        			sqlstr.append("	                   , '' AS GUAR_ONOFF_YN 	\n");
        			sqlstr.append("	                   , '' AS GRTREQNO 	\n");
        			sqlstr.append("	                FROM DUAL A, SUB2000T B  	\n");
        			sqlstr.append("	               WHERE SUB_CONT_MOD_ID = '"+ param.get("SUB_CONT_MOD_ID") +"' 	\n");
        			sqlstr.append("	                     AND B.LABOR_AMT > 0 AND MOD_GB NOT IN ('99', '98')	\n"); //2019.10.18 타절계약 추가
        			
        			sqlstr.append("	     )	\n");
        			sqlstr.append("	GROUP BY  WARR_GUBUN, WARR_GUBUN_NM, WARR_SEQ, CAUSECODE, CAUSECODE_NM	\n");
        			sqlstr.append("	ORDER BY  WARR_GUBUN	\n");
        			sqlstr.append("	--, WARR_SEQ, WARR_WAMT, VIEW_DIV, CAUSECODE, WARR_GOFFICE, GUAR_STATUS, PAPERDATE, WARR_WGNO, WARR_SDATE, WARR_EDATE 	\n");        		
        		}
        	}
        	//System.out.println("### MOD_NO : " + param.get("MOD_NO"));

			search.setStatement(sqlstr.toString());
            rowSet = search.execute();
        }
        catch (WAFSQLException se) {
            super.doException(se);
            this.storage.setSuccess(false);  
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
            //System.out.println("### WAFSQLException : " + se.getMessage());
        }
        finally {    
            if(rowSet == null){
            	rowSet = new RowSetImpl();
            }
        }
        //System.out.println("### rowSet size : " + rowSet.size());
        return rowSet;
	}
	
	
	/**
	 * 보증완료 목록 조회
	 * @param Params
	 * @return
	 */
	private RowSet getWarrCount(ValueObject param) {

		Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        
     //   String sqlstr = "";
        /*
		보증서 종류
		  002 : 계약이행
		  003 : 하자
		  004 : 선금
		  005 : 근로자재해
		  39 : 하도급대금지급         * 
         * */
        StrBuffer sqlstr = new StrBuffer();
        try{
        	sqlstr.append("	              SELECT WARR_GUBUN	\n");
        	sqlstr.append("	                   , F_GET_CODE_NAME('GAUR_KIND',WARR_GUBUN) AS WARR_GUBUN_NM	\n");
        	sqlstr.append("	                   , WARR_SEQ	\n");
        	sqlstr.append("	                   , WARR_WAMT	\n");
        	sqlstr.append("	                   , VIEW_DIV	\n");
        	sqlstr.append("	                   , CAUSECODE	\n");
        	sqlstr.append("	                   , F_GET_CODE_NAME('MOD_GB',CAUSECODE) AS CAUSECODE_NM	\n");
        	sqlstr.append("	                   , WARR_GOFFICE	\n");
        	sqlstr.append("	                   , GUAR_STATUS	\n");
        	sqlstr.append("	                   , F_GET_CODE_NAME('GUAR_STATUS',GUAR_STATUS) AS GUAR_STATUS_NM	\n");
        	sqlstr.append("	                   , PAPERDATE	\n");
        	sqlstr.append("	                   , WARR_WGNO	\n");
        	sqlstr.append("	                   , WARR_SDATE	\n");
        	sqlstr.append("	                   , WARR_EDATE 	\n");
        	sqlstr.append("	                FROM CONT_OUT_WARR 	\n");
        	sqlstr.append("	               WHERE SUB_CONT_MOD_ID = '"+ param.get("SUB_CONT_MOD_ID") +"' 	\n");
        	sqlstr.append("	                     AND WARR_GUBUN IN ('1','4')	\n");
        	sqlstr.append("	                     AND GUAR_STATUS IN ('09')	\n");

			search.setStatement(sqlstr.toString());
            rowSet = search.execute();
        }
        catch (WAFSQLException se) {
            super.doException(se);
            this.storage.setSuccess(false);  
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
            //System.out.println("### WAFSQLException : " + se.getMessage());
        }
        finally {    
            if(rowSet == null){
            	rowSet = new RowSetImpl();
            }
        }
        //System.out.println("### rowSet size : " + rowSet.size());
        return rowSet;
	}
		
	
	/**
     * 계약 상태 변경
	 * @param connection
	 * @param valueObject
	 * @throws Exception
	 */
	public boolean ContStatusUp(Connection connection, ValueObject valueObject) throws Exception {

        Persistent persistent = new PersistentImpl(connection);
        StrBuffer sqlstr = new StrBuffer();
        try {
        	sqlstr.append("UPDATE SUB2000T SET  	\n");
        	sqlstr.append(" STATUS_CD = ?					\n");
        	if (!valueObject.get("MODI_REQ_REASON").equals(null)){
	        	sqlstr.append(" , MODI_REQ_REASON = '"+ valueObject.get("MODI_REQ_REASON") +"' 	\n");
	        	sqlstr.append(" , MODI_REQ_DT = SYSDATE			\n");
        	}        	
        	sqlstr.append("WHERE SUB_CONT_MOD_ID = ?						\n");
            persistent.setStatement(sqlstr.toString());
            persistent.addParameter(valueObject.get("pStatusCD"));
            persistent.addParameter(valueObject.get("SUB_CONT_MOD_ID"));
            persistent.execute();

            return true;
        }
        catch(Exception e) {
            WAFLogger.error(this.getClass().getName() + " --> updUser() : " + e.getMessage());
            WAFLogger.error("SQL : " + sqlstr);
            WAFLogger.error(e);
            //System.out.println("Exception : " + e.getMessage());
            throw e;
        }
    }	
	
	/**
     * 을) 서명 저장
	 * @param connection
	 * @param valueObject
	 * @throws Exception
	 */
	public boolean CONT_SignOk(Connection connection, ValueObject valueObject) throws Exception {

        Persistent persistent = new PersistentImpl(connection);
        StrBuffer sqlstr = new StrBuffer();
        try {
        	sqlstr.append("UPDATE CONT_OUT_SUPP SET  	\n");
        	sqlstr.append(" SIGN_DATE = SYSDATE					\n");
        	sqlstr.append(" ,SIGN_DN = ?					\n");
        	sqlstr.append(" ,SIGN_DATA = ?					\n");
        	sqlstr.append("WHERE SUB_CONT_MOD_ID = ?						\n");
        	sqlstr.append(" 	AND SIGN_SEQ=2						\n");
            persistent.setStatement(sqlstr.toString());
            persistent.addParameter(valueObject.get("CONT_SIGNDN"));
            persistent.addParameter(valueObject.get("CONT_SIGNDATA"));
            persistent.addParameter(valueObject.get("SUB_CONT_MOD_ID"));
            persistent.execute();
            
            return true;
        }
        catch(Exception e) {
            WAFLogger.error(this.getClass().getName() + " --> updUser() : " + e.getMessage());
            WAFLogger.error("SQL : " + sqlstr);
            WAFLogger.error(e);
            //System.out.println("Exception : " + e.getMessage());
            throw e;
        }
    }	
	
	/**
     * 이메일 SMS 전송
	 * @param connection
	 * @param valueObject
	 * @throws Exception
	 */
	public void Send(ValueObject params, String event) throws Exception {
		MessageSend messageSend = new MessageSend(storage);
		
		ValueObject contSendInfo = new ValueObject();
		contSendInfo = getContRequestValueObject(params.get("SUB_CONT_MOD_ID"));
		
 		//System.out.println("담당자 O_EMAIL : " + contSendInfo.get("O_EMAIL"));
		if(!contSendInfo.get("O_EMAIL").isEmpty()){
			boolean email = false;
	 		StringBuffer mailtitle = new StringBuffer();
	 		StringBuffer mailtitlein = new StringBuffer();
	        StringBuffer mailContent = new StringBuffer();
	        if("EDIT_CALL".equals(event)){//수정요청
	        	mailtitle.append("* 계약내용 수정요청 메일입니다.");
	            mailtitlein.append("* 계약내용 수정요청 메일입니다.");
	         	mailContent.append(contSendInfo.get("C_MEMBER_NAME")+"님이 계약내용 수정을 요청하였습니다.<br>전자조달 시스템에서 계약내용 수정사유를 확인하시고 재 수정 바랍니다.<br>");
	         	mailContent.append("<font style='width:auto; font-size:12px; line-height:18px; padding:5px; text-align:left;'>");
	         	mailContent.append("<br>");
	         	mailContent.append("1.프로젝트 : " + contSendInfo.get("DEPT_NAME") + "<br>");
	         	mailContent.append("2.계약번호 : " + contSendInfo.get("CON_DOC_NO") + "<br>");
	         	mailContent.append("3.계약명 : " + contSendInfo.get("BUILD_NAME") + "<br>");
	         	mailContent.append("4.수정요청사유 : " + params.get("MODI_REQ_REASON") + "<br>");
	         	mailContent.append("5.협력사 담당자 : " + contSendInfo.get("C_USER_NAME") +" (연락처 : " + contSendInfo.get("C_TEL_NUM") + ")<br>");
	         	mailContent.append("</font>");
	        	email = true;	
	        }else if("SIGN_OK".equals(event)){//서명완료 갑 서명 요청
	        	mailtitle.append("* 계약서 서명요청 메일입니다.");
	            mailtitlein.append("* 계약서 서명요청 메일입니다.");
	         	mailContent.append(contSendInfo.get("C_MEMBER_NAME")+"님이 계약서에 서명하였습니다.<br>업체 서명 정보 확인후 계약서에 서명하시기 바랍니다.<br>");
	         	mailContent.append("<font style='width:auto; font-size:12px; line-height:18px; padding:5px; text-align:left;'>");
	         	mailContent.append("<br>");
	         	mailContent.append("1.프로젝트 : " + contSendInfo.get("DEPT_NAME") + "<br>");
	         	mailContent.append("2.계약번호 : " + contSendInfo.get("CON_DOC_NO") + "<br>");
	         	mailContent.append("3.계약명 : " + contSendInfo.get("BUILD_NAME") + "<br>");
	         	mailContent.append("4.협력사 담당자 : " + contSendInfo.get("C_USER_NAME") +" (연락처 : " + contSendInfo.get("C_TEL_NUM") + ")<br>");
	         	mailContent.append("</font>");
	        	email = true;		        	
	 		}
	        if(email){	//contSendInfo.get("O_EMAIL")
	        	messageSend.sendEmail(contSendInfo.get("O_EMAIL"), "partner@sgc.co.kr", mailtitle.toString(), mailtitlein.toString(), mailContent,"Y");
	        }
		}
 		//System.out.println("담당자 C_HP : " + params.get("C_HP"));
		if(!contSendInfo.get("O_HP").isEmpty()){
	 		//System.out.println("C_HP : "+contSendInfo.get("O_HP"));
	 		String smsContent = "";
	 		if("EDIT_CALL".equals(event)){//수정요청
	 			smsContent = WAFMessages.getMessage("Contract.Information.Request");
	 		}else if("SIGN_OK".equals(event)){//서명완료 갑 서명 요청
	 			smsContent = WAFMessages.getMessage("Contract.Signing.Request");
	 		}
	 		
	        String se_phon_no = "024899000"; //보내는사람 2015.9.21 contSendInfo.get("C_HP").replace("-", "")
	        String re_phon_no = contSendInfo.get("O_HP").replace("-", ""); //받는사람
	        if(!smsContent.isEmpty()){
	        	messageSend.sendSMS(re_phon_no, se_phon_no, storage.getUser().get("ACCT_ID"), smsContent); //2015.9.21 업체->당사 SMS. 대표번호 
	        }
		}
	}
	
	/**
     * 인지세 List
	 * @param connection
	 * @param valueObject
	 * @throws Exception
	 */
	private RowSet getStampList(ValueObject param) {

		Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        
        StrBuffer sqlstr = new StrBuffer();
        
        try{

			sqlstr.append("   SELECT                                                                                      \n");                  
			sqlstr.append("   	    STAMP_DUTY_ID                                                                         \n");
			sqlstr.append("   	   ,STAMP_DUTY_ISSUE_GB                                                                   \n");                  
			sqlstr.append("   	   ,STAMP_DUTY_NO                                                                         \n");                  
			sqlstr.append("   	   ,STAMP_DUTY_TAX                                                                        \n");                  
			sqlstr.append("   	   ,STAMP_DUTY_DATE                                                                       \n");                  
			sqlstr.append("   	   ,REMARK                                                                                \n");
			sqlstr.append("   	   ,(SELECT DECODE(MAX(AA.FILE_ID), NULL, '파일첨부', '1') FROM PUB0510T AA, PUB0500T BB  \n");
			sqlstr.append("   			   WHERE AA.FILE_ID = BB.FILE_ID AND FILE_GB = 'SUB_STAMP_DUTY'                   \n");
			sqlstr.append("   			   AND ID = B.STAMP_DUTY_ID) AS FILE_YN                                           \n");
//			sqlstr.append("   	   ,'1' AS FILE_YN                                                                        \n");
			sqlstr.append("   	   , (SELECT MAX(AA.FILE_ID) FROM PUB0510T AA, PUB0500T BB                                \n");
			sqlstr.append("   			   WHERE AA.FILE_ID = BB.FILE_ID AND FILE_GB = 'SUB_STAMP_DUTY'                   \n");
			sqlstr.append("   			   AND ID = B.STAMP_DUTY_ID) AS FILE_ID                                           \n");                                                   
			sqlstr.append("   FROM SUB2000T  A,                                                                           \n");                  
			sqlstr.append("        STAMP_DUTY B                                                                           \n");                 
			sqlstr.append("   WHERE A.SUB_CONT_MOD_ID = B.CONT_MOD_ID                                                     \n");                  
			sqlstr.append("   AND   B.STAMP_DUTY_TYPE(+) = '20'                                                           \n");                 
			sqlstr.append("   AND   A.SUB_CONT_MOD_ID = '"+params.get("SUB_CONT_MOD_ID")+"'                               \n");
			sqlstr.append("   ORDER BY STAMP_DUTY_ID DESC								                                  \n");
			
        	search.setStatement(sqlstr.toString());
            rowSet = search.execute();
        }
        catch (WAFSQLException se) {
            super.doException(se);
            this.storage.setSuccess(false);  
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
            WAFLogger.error("### WAFSQLException : " + se.getMessage());
        }
        finally {    
            if(rowSet == null){
            	rowSet = new RowSetImpl();
            }
        }
        return rowSet;
	}
	
	/*
	 * 원계약건이 전문건설인지 서울보증인지 확인 
	 * */
	public String getWarrGubun(String subContModId) {
	 	
	 	Search search = new SearchImpl(); 
	 	RowSet rowSet = new RowSetImpl();
	 	StringBuffer sqlstr = new StringBuffer();
	 	String rtnStr = "K";
	 	try {
	 		
	 		sqlstr.append("				SELECT DECODE(GUAR_ORGAN_CODE , '2', 'S','K') AS WARRGUBUN																			\n");
	 		sqlstr.append("				     , WARR_GOFFICE                 																								\n");
	 		sqlstr.append("				FROM CONT_OUT_WARR                        																							\n");
	 		sqlstr.append("				WHERE SUB_CONT_MOD_ID = (                 																							\n");
	 		sqlstr.append("											SELECT SUB_CONT_MOD_ID                    																\n");
	 		sqlstr.append("											FROM SUB2000T                             																\n");
	 		sqlstr.append("											WHERE MOD_NO = 0                          																\n");
	 		sqlstr.append("											AND SUB_CONT_ID = (SELECT MIN(SUB_CONT_ID) FROM SUB2000T WHERE SUB_CONT_MOD_ID = '"+subContModId+"')    \n");
	 		sqlstr.append("										)																											\n");
	 		sqlstr.append("				AND WARR_GUBUN = '1'                      																							\n");
	 		sqlstr.append("				AND VIEW_DIV = 'CONT'                     																							\n");
	 		
	 		search.setStatement(sqlstr);
	 		rowSet = search.execute();
	 		if(rowSet != null && rowSet.size() > 0 ) {
	 			rtnStr = rowSet.getRow(0).get("WARRGUBUN");
	 		}
	 	}
	 	catch (Exception e) {
	         super.doException(e);
	         this.storage.setSuccess(false);
	         this.storage.setMessage(e.getMessage());
	         storage.setDetailMessage(e);
	 	}
	 	return rtnStr;
	 }
	
	/**
	 * 을) 인지세 저장
	 * @param connection
	 * @param valueObject
	 * @throws Exception
	 */
	/*public boolean updateStampDuty(Connection connection, ValueObject valueObject) throws Exception {
		
		Persistent persistent = new PersistentImpl(connection);
		StrBuffer sqlstr = new StrBuffer();
		try {
			
			sqlstr.append("UPDATE	STAMP_DUTY SET			\n");
			sqlstr.append("			STAMP_DUTY_NO = ?		\n");
			sqlstr.append("        ,STAMP_DUTY_TAX = ?		\n");
			sqlstr.append("        ,STAMP_DUTY_DATE = ?		\n");
			sqlstr.append("        ,REMARK = ?				\n");
			sqlstr.append("WHERE	CONT_MOD_ID = ?			\n");
			sqlstr.append("AND		STAMP_DUTY_TYPE = '20'	\n");
	
			persistent.setStatement(sqlstr.toString());
			persistent.addParameter(valueObject.get("stamp_duty_no"));
			persistent.addParameter(valueObject.get("stamp_duty_tax").replaceAll(",", ""));
			persistent.addParameter(valueObject.get("stamp_duty_date").replaceAll("-", ""));
			persistent.addParameter(valueObject.get("remark"));
			persistent.addParameter(valueObject.get("SUB_CONT_MOD_ID"));
			persistent.execute();
			
			return true;
		}
		catch(Exception e) {
			WAFLogger.error(this.getClass().getName() + " --> updateStampDuty() : " + e.getMessage());
			WAFLogger.error("SQL : " + sqlstr);
			WAFLogger.error(e);
			//System.out.println("Exception : " + e.getMessage());
			throw e;
		}
	}*/
}