/*********************************************************************
*  All Rights reserved,Copyright (c) K-Opticom
**********************************************************************
*＜プログラム内容＞
*	システム名			：eo顧客基幹システム
*	モジュール名		：JBSbatAKFtthTushinPrcKensho
*	ソースファイル名	：JBSbatAKFtthTushinPrcKensho.java
*	作成者				：富士通　
*	作成日				：2012年07月26日
*＜機能概要＞
*　ＦＴＴＨ通信料検証部品です。
*＜修正履歴＞
*	バージョン	修正日		修正者		修正内容
*	v3.00.00	2012/07/27   FJ）冨井	新規作成
*	v8.00.00	2014/01/16   FJ）高橋	【ANK-1584-00-00】L2-MVNO対応 マッチングキーの条件修正
*********************************************************************/
package eo.business.service;

import java.math.BigDecimal;
import java.util.HashMap;
import eo.business.common.JACbatDebugLogUtil;
import eo.business.common.JACbatParamUtil;
import eo.business.common.JBSbatBusinessService;
import eo.framework.item.JBSbatCommonItem;
import eo.framework.item.JBSbatServiceInterfaceMap;
import eo.framework.item.JBSbatOutputItem;
import eo.framework.item.JBSbatCommonDBInterface;
import eo.framework.db.JBSbatSQLAccess;
import eo.business.common.JBSbatMatchServiceInterface;
import eo.business.util.file.JBSbatAKIFM006;
import eo.business.util.file.JBSbatAKIFM011;
import eo.business.util.file.JBSbatAKIFM016;
import eo.business.util.table.JBSbatAK_M_SOTEI_PRC;
import eo.common.constant.JACStrConst;
import eo.common.constant.JPCBatchMessageConstant;

/**
* (クラスの機能概要) <p>
*<BR>
* @author 富士通
*/
public class JBSbatAKFtthTushinPrcKensho extends JBSbatBusinessService implements JBSbatMatchServiceInterface
{
	/**▼▼▼▼▼▼ツールから生成した宣言です 開始▼▼▼▼▼▼*/
	/** テーブル(想定料金)*/
	private static final String D_TBL_NAME_AK_M_SOTEI_PRC = "AK_M_SOTEI_PRC";

	/** SQL定義キー(AK_SELECT_003)*/
	private static final String AK_M_SOTEI_PRC_AK_SELECT_003 = "AK_SELECT_003";

	/** テーブルアクセスクラス(想定料金)*/
	private JBSbatSQLAccess db_AK_M_SOTEI_PRC = null;

	/** キーマッチ処理フラグ*/
	private boolean matchProcFlg;

	/** マスタファイル処理フラグ*/
	private boolean mastProcFlg;

	/** トランファイル処理フラグ*/
	private boolean tranProcFlg;
	/**▲▲▲▲▲▲ツールから生成した宣言です 終了▲▲▲▲▲▲*/
	
	/** 退避．想定料金マップ */
	private HashMap<String, BigDecimal> tmpSoteiPrcMap = null;
	
	/** 退避．調査検証結果補足（マッチ） */
	private String tmpChosaknsRtHkMatch = null;
	
	/** 退避．調査検証結果補足（マスタのみ） */
	private String tmpChosaknsRtHkMst = null;
	
	/** 退避．調査検証結果（ＦＴＴＨ通信料） */
	private String tmpChoknsRtFtthTsprc = null;
	
	/** 退避．調査検証結果補足 */
	private String tmpChoknsRtHsk = null;
	
	/**
	 * 初期処理
	 * @param JBSbatCommonItem commonItem　バッチ共通パラメータ電文
	 * @throws Exception
	 */
	public void initial(JBSbatCommonItem commonItem) throws Exception
	{
	/**▼▼▼▼▼▼業務サービスの初期処理を記述してください。▼▼▼▼▼▼*/
		/**▼▼▼▼▼▼ツールから生成した初期化のソースです 開始▼▼▼▼▼▼*/
		// 共通パラメータを設定します
		super.setCommonInfo(commonItem);

		// DBアクセスクラスを生成します
		db_AK_M_SOTEI_PRC = new JBSbatSQLAccess(commonItem, D_TBL_NAME_AK_M_SOTEI_PRC);
		/**▲▲▲▲▲▲ツールから生成した初期化のソースです 終了▲▲▲▲▲▲*/

		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][initial]");
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][initial][opeDate=" + super.opeDate + "]");
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][initial][freeItem=" + super.freeItem + "]");
		
		// 想定料金マップ作成
		this.makeSoteiPrcMap();
		
		// 業務パラメータを取得する。
		this.getWorkPara();
		
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][initial]");
	/**▲▲▲▲▲▲業務サービスの初期処理を記述してください。▲▲▲▲▲▲*/
	}

	/**
	 * 主処理
	 * @param mastMap　入力電文
	 * @param tranMap　入力電文
	 * @param outputInItem  入力情報
	 * @return JBSbatOutputItem 出力情報
	 * @throws Exception
	 */
	public JBSbatOutputItem execute(JBSbatServiceInterfaceMap mastMap, JBSbatServiceInterfaceMap tranMap, JBSbatOutputItem outputInItem) throws Exception
	{
	/**▼▼▼▼▼▼業務サービスの主処理を記述してください。▼▼▼▼▼▼*/
		// 入力Ｍのみ存在する
		if (mastMap != null && tranMap == null)
		{
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][execute][入力Ｍのみ存在する]");
			//  ＦＴＴＨ通信料検証処理（マスタのみ）
			this.setChosaknsRsltMstInfo(mastMap);
			// 検証結果情報出力処理
			this.makeOutputInfo(mastMap, outputInItem);
			// マスタフラグ ← True（入力Ｍ読み込み）
			this.setMastProcFlg(true);
		}
		// 入力Ｔのみ存在する
		else if (mastMap == null && tranMap != null)
		{
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][execute][入力Ｔのみ存在する]");
			//  トランフラグ ← True（入力Ｔ読み込み）
			this.setTranProcFlg(true);
		}
		// 入力Ｍ、入力Ｔともに存在する
		else
		{
			// マッチングキー取得
			String mastKey 	= this.makeMatchingKey(mastMap);	// マスタキー
			String trnKey 	= this.makeMatchingKey(tranMap);	// トランキー
			
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][execute][mastKey=" + mastKey + "]") ;
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][execute][trnKey=" + trnKey + "]") ;
			
			// 入力Ｍ＝入力Ｔ（マッチ）
			if (mastKey.compareTo(trnKey) == 0)
			{
				assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][execute][入力Ｍ、入力Ｔともに存在する][入力Ｍ＝入力Ｔ（マッチ）]");
				//  ＦＴＴＨ通信料検証処理（マッチ）
				this.setChosaknsRsltMatchInfo(mastMap, tranMap);
				// 検証結果情報出力処理
				this.makeOutputInfo(mastMap, outputInItem);
				// マスタフラグ ← true （マスタだけを進める）
				// トランフラグ ← true （トランだけを進める）
				this.setMastProcFlg(true);
				this.setTranProcFlg(true);
			}
			// 入力Ｍ＜入力Ｔ
			else if (mastKey.compareTo(trnKey) < 0)
			{
				assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][execute][入力Ｍ、入力Ｔともに存在する][入力Ｍ＜入力Ｔ]");
				//  ＦＴＴＨ通信料検証処理（マスタのみ）
				this.setChosaknsRsltMstInfo(mastMap);
				// 検証結果情報出力処理
				this.makeOutputInfo(mastMap, outputInItem);
				// マスタフラグ ← True（入力Ｍ読み込み）
				this.setMastProcFlg(true);
			}
			// 入力Ｍ＞入力Ｔ
			else
			{
				assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][execute][入力Ｍ、入力Ｔともに存在する][入力Ｍ＞入力Ｔ]");
				//  トランフラグ ← True（入力Ｔ読み込み）
				this.setTranProcFlg(true);
			}
		}
		
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][execute]");
		return outputInItem;
	/**▲▲▲▲▲▲業務サービスの主処理を記述してください。▲▲▲▲▲▲*/
	}

	/**
	 * 業務サービス終了処理
	 * @throws Exception
	 */
	public void terminal() throws Exception
	{
	/**▼▼▼▼▼▼業務サービスの終了処理を記述してください。▼▼▼▼▼▼*/
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][terminal]");
		/**▼▼▼▼▼▼ツールから生成した終了処理のソースです 開始▼▼▼▼▼▼*/
		// DBアクセスクラスをクローズします
		db_AK_M_SOTEI_PRC.close();
		/**▲▲▲▲▲▲ツールから生成した終了処理のソースです 終了▲▲▲▲▲▲*/
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][terminal]");
	/**▲▲▲▲▲▲業務サービスの終了処理を記述してください。▲▲▲▲▲▲*/
	}

	/**▼▼▼▼▼▼ツールから生成したメソッドです 開始▼▼▼▼▼▼*/
	
	/**
	 * @return mastProcFlg を戻します。
	 */
	public boolean isMastProcFlg()
	{
		return mastProcFlg;
	}

	/**
	 * @return matchProcFlg を戻します。
	 */
	public boolean isMatchProcFlg()
	{
		return matchProcFlg;
	}

	/**
	 * @return tranProcFlg を戻します。
	 */
	public boolean isTranProcFlg()
	{
		return tranProcFlg;
	}

	/**
	 * @param mast_ProcFlg 設定する mastProcFlg。
	 */
	public void setMastProcFlg(boolean mast_ProcFlg)
	{
		this.mastProcFlg = mast_ProcFlg;
	}

	/**
	 * @param match_ProcFlg 設定する matchProcFlg。
	 */
	public void setMatchProcFlg(boolean match_ProcFlg)
	{
		this.matchProcFlg = match_ProcFlg;
	}

	/**
	 * @param tran_ProcFlg 設定する tranProcFlg。
	 */
	public void setTranProcFlg(boolean tran_ProcFlg)
	{
		this.tranProcFlg = tran_ProcFlg;
	}

	/**
	 * SQLKEY(AK_SELECT_003)でDBアクセスを行います。<br>
	 * <p>
	 * <b>処理フロー</b><br>
	 * <pre>
	 * 1.引数でバイント変数を設定します。<br>
	 *
	 * 2.DBアクセスを実行します。<br>
	 * 
	 * 3.メソッドの呼び出し方です。<br>
	 *		引数:
	 *		param:順にバイント変数の値をparam配列に入れます。バイント変数は以下に説明します。
	 *		 	想定料金適用開始年月日
	 *		 	想定料金適用終了年月日
	 * </pre>
	 * <p>
	 * @param param バイント変数の値配列。
	 * @throws Exception 業務サービス内で発生した例外全般。
	 */
	private void executeAK_M_SOTEI_PRC_AK_SELECT_003(Object[] param) throws Exception
	{
		// バイント変数のリストを生成します
		JBSbatCommonDBInterface paramList = new JBSbatCommonDBInterface();
		paramList.setValue(param[0].toString());
		paramList.setValue(param[1].toString());

		// DBアクセスを実行します
		db_AK_M_SOTEI_PRC.selectBySqlDefine(paramList, AK_M_SOTEI_PRC_AK_SELECT_003);
	}
	/**▲▲▲▲▲▲ツールから生成したメソッドです 終了▲▲▲▲▲▲*/

	/**
	 * 文字を連結します
	 * @param  string 文字
	 * @return strBuf 連結した文字列
	 */
	private String makeStr(String ...string)
	{
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][makeStr]");
		
		StringBuffer strBuf = new StringBuffer();
		for(String str:string)
		{
			if(str == null)
			{
				strBuf.append(JACStrConst.KARA_MOJI);
			}
			else
			{
				strBuf.append(str);
			}
		}
		
		assert strBuf != null ? JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][strBuf][strBuf = " + strBuf.toString() + "]") : true;
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][makeStr]");
		
		return strBuf.toString();
	}
	
	/**
	 * 想定料金マスタを検索して、
	 * 想定料金を検索して、料金コースコード・料金サービスコード・料金項目コード毎に想定料金マップを作成する。
	 * @throws Exception 業務サービス内で発生した例外全般
	 */
	private void makeSoteiPrcMap() throws Exception
	{
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][makeSoteiPrcMap]");

		JBSbatCommonDBInterface paramList = new JBSbatCommonDBInterface();
	
		// 想定料金適用開始年月日
		paramList.setValue(super.opeDate);
		// 想定料金適用終了年月日
		paramList.setValue(super.opeDate);

		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][makeSoteiPrcMap][paramList=" + paramList.getList().toString() + "]");

		// SQL実行
		executeAK_M_SOTEI_PRC_AK_SELECT_003(paramList.getList().toArray());
		JBSbatCommonDBInterface dbMap = db_AK_M_SOTEI_PRC.selectNext();
		
		this.tmpSoteiPrcMap = new HashMap<String, BigDecimal>();
		
		// 取得件数分処理を繰り返す
		while(dbMap != null)
		{
			// KEY：料金コースコード＋料金サービスコード＋料金項目コード VALUE：下限値
			String key = makeStr(dbMap.getString(JBSbatAK_M_SOTEI_PRC.PCRS_CD), dbMap.getString(JBSbatAK_M_SOTEI_PRC.PRC_SVC_CD)
								, dbMap.getString(JBSbatAK_M_SOTEI_PRC.PRC_KMK_CD));
			// マップに設定
			this.tmpSoteiPrcMap.put(key, dbMap.getBigDecimal(JBSbatAK_M_SOTEI_PRC.LOWL_VALUE));
			// 次レコード取得
			dbMap = db_AK_M_SOTEI_PRC.selectNext(); 
		}
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][makeSoteiPrcMap]");
		return;
	}
	
	/**
	 * 業務パラメータ管理から値を取得します。
	 * @throws Exception 業務サービス内で発生した例外全般。
	 */
	private void getWorkPara() throws Exception
	{
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][getWorkPara]");
		
		// 業務パラメータ取得
		JACbatParamUtil paramUtil = new JACbatParamUtil(commonItem);
		try
		{
			// 退避．調査検証結果補足（マッチ） ← パケット通信料下限額確認
			this.tmpChosaknsRtHkMatch 	= paramUtil.getGyoumuParameter(JACStrConst.WKPAR_AK_CS_KNS_RT_HSK_009);
			// 退避．調査検証結果補足（マスタのみ） ← パケット通信情報なし
			this.tmpChosaknsRtHkMst 	= paramUtil.getGyoumuParameter(JACStrConst.WKPAR_AK_CS_KNS_RT_HSK_010);
		}
		finally
		{
			paramUtil.close();
		}
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][getWorkPara][退避．調査検証結果補足（マッチ） = " + this.tmpChosaknsRtHkMatch  + "]");
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][getWorkPara][退避．調査検証結果補足（マスタのみ） = " + this.tmpChosaknsRtHkMst + "]");
		
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][getWorkPara]");
		return;
	}
	
	/**
	 * 引数で渡された情報をもとにマッチング用のキーを作成し、返却します。
	 * @param trgMap 対象情報
	 * @return String マッチングキー（請求契約番号 ＋ サービス契約番号 ＋ 料金コースコード ＋ 料金サービスコード）
	 * @throws Exception 業務サービス内で発生した例外全般
	 */
	private String makeMatchingKey(JBSbatServiceInterfaceMap trgMap) throws Exception
	{
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][makeMatchingKey]");
		
		// 請求契約番号 ＋ サービス契約番号 ＋ 料金コースコード ＋ 料金サービスコード
		String matchingKey = this.makeStr(trgMap.getString(JBSbatAKIFM006.SEIKY_KEI_NO), trgMap.getString(JBSbatAKIFM006.SVC_KEI_NO), 
								trgMap.getString(JBSbatAKIFM006.PCRS_CD), trgMap.getString(JBSbatAKIFM006.PRC_SVC_CD));
		
		
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][makeMatchingKey]");
		return matchingKey;
	}
	
	/**
	 * ＦＴＴＨ通信料検証処理を行い、退避．調査検証結果（ＦＴＴＨ通信料）、退避．調査検証結果補足を設定します。（マッチ）
	 * @param mastMap　入力電文
	 * @param tranMap　入力電文
	 * @throws Exception 業務サービス内で発生した例外全般。
	 */
	private void setChosaknsRsltMatchInfo(JBSbatServiceInterfaceMap mastMap, JBSbatServiceInterfaceMap tranMap) throws Exception
	{
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][setChosaknsRsltMatchInfo]");
		
		// (1) 入力Ｍ．金額チェック結果コード ≠ "0"（OK） の場合
		// 判定条件取得
		String amntChkRsltCd = mastMap.getString(JBSbatAKIFM006.AMNT_CHK_RSLT_CD);// 金額チェック結果コード
		if(!JACStrConst.KNSHO_RSLT_OK.equals(amntChkRsltCd))
		{
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][setChosaknsRsltMatchInfo][入力Ｍ．金額チェック結果コード ＝ 0（OK） の場合]");
			// 退避．調査検証結果（ＦＴＴＨ通信料） ← ""（空）
			// 退避．調査検証結果補足               ← ""（空）
			this.tmpChoknsRtFtthTsprc	= JACStrConst.KARA_MOJI;
			this.tmpChoknsRtHsk			= JACStrConst.KARA_MOJI;
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint,
					"[E][setChosaknsRsltMatchInfo][退避．調査検証結果（ＦＴＴＨ通信料） = " + this.tmpChoknsRtFtthTsprc  + "]");
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][setChosaknsRsltMatchInfo][退避．調査検証結果補足 = " + this.tmpChoknsRtHsk	  + "]");
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][setChosaknsRsltMatchInfo]");
			// 処理を抜ける
			return;
		}
		// (2) (1)以外の場合
		else
		{
			// (a) 下限値取得
			// 判定条件取得（入力Ｍ．料金コースコード ＋ 入力Ｍ．料金サービスコード ＋ 入力Ｔ．料金項目コード）
			String serchKey = this.makeStr(mastMap.getString(JBSbatAKIFM006.PCRS_CD), mastMap.getString(JBSbatAKIFM006.PRC_SVC_CD)
												, tranMap.getString(JBSbatAKIFM016.PRC_KMK_CD));
			// 退避．想定料金マップの存在チェック
			if(!this.tmpSoteiPrcMap.containsKey(serchKey))
			{
				assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][setChosaknsRsltMatchInfo][退避．想定料金マップなし]");
				// 取得できなかった場合
				// DB異常のメッセージ（【警告】ＤＢ未存在エラー）をLOGに出力する。
				String[] outCntMsg = {JBSbatAK_M_SOTEI_PRC.TABLE_NAME, serchKey};
				super.logPrint.printBusinessErrorLog(JPCBatchMessageConstant.EAKB0180CW, outCntMsg);
				// 退避．調査検証結果（ＦＴＴＨ通信料） ← ""（空）
				// 退避．調査検証結果補足               ← ""（空）
				this.tmpChoknsRtFtthTsprc	= JACStrConst.KARA_MOJI;
				this.tmpChoknsRtHsk			= JACStrConst.KARA_MOJI;
				assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][setChosaknsRsltMatchInfo][退避．調査検証結果（ＦＴＴＨ通信料） = " + this.tmpChoknsRtFtthTsprc  + "]");
				assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][setChosaknsRsltMatchInfo][退避．調査検証結果補足 = " + this.tmpChoknsRtHsk	  + "]");
				assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][setChosaknsRsltMatchInfo]");
				// 処理を抜ける
				return;
			}
			
			// 取得できた場合
			// 退避．下限値 ← 取得した退避．想定料金マップの下限値
			BigDecimal lowlValue = this.tmpSoteiPrcMap.get(serchKey);
			// 判定条件取得
			// 入力Ｔ．利用通信量合計 ＋ 入力Ｔ．補正通信量合計
			BigDecimal gkAmnt = tranMap.getBigDecimal(JBSbatAKIFM016.USE_TSRYO_GK).add(tranMap.getBigDecimal(JBSbatAKIFM016.HOSEI_TSRYO_GK));
			// 入力Ｍ．金額
			BigDecimal amnt = mastMap.getBigDecimal(JBSbatAKIFM006.AMNT);
			
			// (b) 入力Ｍ．金額 ＝ 0 の場合
			if(BigDecimal.ZERO.compareTo(amnt) == 0)
			{
				assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][setChosaknsRsltMatchInfo][(b) 入力Ｍ．金額 ＝ 0 の場合]");
				// @ 退避．下限値 ≧ （入力Ｔ．利用通信量合計 ＋ 入力Ｔ．補正通信量合計） の場合
				if(lowlValue.compareTo(gkAmnt) >= 0)
				{
					assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][setChosaknsRsltMatchInfo][@ 退避．下限値 ≧ （入力Ｔ．利用通信量合計 ＋ 入力Ｔ．補正通信量合計） の場合]");
					// 退避．調査検証結果（ＦＴＴＨ通信料） ← "0"（ＯＫ）
					this.tmpChoknsRtFtthTsprc = JACStrConst.KNSHO_RSLT_OK;
				}
				// A @以外の場合
				else
				{
					assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][setChosaknsRsltMatchInfo][A @以外の場合]");
					// 退避．調査検証結果（ＦＴＴＨ通信料）←"1"（ワーニング）
					this.tmpChoknsRtFtthTsprc = JACStrConst.KNSHO_RSLT_WRN;
				}
			}
			// (c) 入力Ｍ．金額 ≠ 0 の場合
			else
			{
				assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][setChosaknsRsltMatchInfo][(c) 入力Ｍ．金額 ≠ 0 の場合]");
				// @ 退避．下限値 ≧ （入力Ｔ．利用通信量合計 ＋ 入力Ｔ．補正通信量合計） の場合
				if(lowlValue.compareTo(gkAmnt) >= 0)
				{
					assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][setChosaknsRsltMatchInfo][@ 退避．下限値 ≧ （入力Ｔ．利用通信量合計 ＋ 入力Ｔ．補正通信量合計） の場合]");
					// 退避．調査検証結果（ＦＴＴＨ通信料） ← "1"（ワーニング）
					this.tmpChoknsRtFtthTsprc = JACStrConst.KNSHO_RSLT_WRN;
				}
				// A @以外の場合
				else
				{
					assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][setChosaknsRsltMatchInfo][A @以外の場合]");
					// 退避．調査検証結果（ＦＴＴＨ通信料） ← "0"（ＯＫ）
					this.tmpChoknsRtFtthTsprc = JACStrConst.KNSHO_RSLT_OK;
				}
			}
			// (d) 調査検証結果補足設定
			// @ 退避．調査検証結果（ＦＴＴＨ通信料） ＝ "1"（ワーニング） の場合
			if(JACStrConst.KNSHO_RSLT_WRN.equals(this.tmpChoknsRtFtthTsprc))
			{
				assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][setChosaknsRsltMatchInfo][@ 退避．調査検証結果（ＦＴＴＨ通信料） ＝ 1（ワーニング） の場合]");
				// 退避．調査検証結果補足 ← 退避．調査検証結果補足（マッチ）
				this.tmpChoknsRtHsk			= this.tmpChosaknsRtHkMatch;
			}
			// A @以外の場合
			else
			{
				assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][setChosaknsRsltMatchInfo][A @以外の場合]");
				// 退避．調査検証結果補足 ← ""（空）
				this.tmpChoknsRtHsk			= JACStrConst.KARA_MOJI;
			}
			
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][setChosaknsRsltMatchInfo][退避．調査検証結果（ＦＴＴＨ通信料） = " + this.tmpChoknsRtFtthTsprc  + "]");
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][setChosaknsRsltMatchInfo][退避．調査検証結果補足 = " + this.tmpChoknsRtHsk	  + "]");
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][setChosaknsRsltMatchInfo]");
			return;
		}
	}
	

	/**
	 * ＦＴＴＨ通信料検証処理を行い、退避．調査検証結果（ＦＴＴＨ通信料）、退避．調査検証結果補足を設定します。（マスタのみ）
	 * @param mastMap　入力電文
	 * @throws Exception 業務サービス内で発生した例外全般。
	 */
	private void setChosaknsRsltMstInfo(JBSbatServiceInterfaceMap mastMap) throws Exception
	{
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][setChosaknsRsltMstInfo]");
		
		// (1) 入力Ｍ．存在チェック結果コード ＝ "0"（ＯＫ） の場合
		// 判定条件取得
		String sonzaiChkRsltCd = mastMap.getString(JBSbatAKIFM006.SONZAI_CHK_RSLT_CD);// 存在チェック結果コード
		if(JACStrConst.KNSHO_RSLT_OK.equals(sonzaiChkRsltCd))
		{
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][setChosaknsRsltMatchInfo][(1) 入力Ｍ．存在チェック結果コード ＝ 0（ＯＫ） の場合]");
			// (a) 入力Ｍ．金額チェック結果コード ＝ "1"（ワーニング）
			//     かつ 入力Ｍ．金額 ＝ 0 の場合
			// 判定条件取得
			BigDecimal amnt 		= mastMap.getBigDecimal(JBSbatAKIFM006.AMNT);
			if(BigDecimal.ZERO.compareTo(amnt) == 0)
			{
				assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][setChosaknsRsltMatchInfo][(a) 入力Ｍ．金額チェック結果コード ＝ 1（ワーニング）かつ 入力Ｍ．金額 ＝ 0 の場合]");
				// 退避．調査検証結果（ＦＴＴＨ通信料） ← "0"（ＯＫ）
				this.tmpChoknsRtFtthTsprc = JACStrConst.KNSHO_RSLT_OK;
			}
			// (b) (a)以外の場合
			else
			{
				assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][setChosaknsRsltMatchInfo][(b) (a)以外の場合]");
				// 退避．調査検証結果（ＦＴＴＨ通信料） ← "1"（ワーニング）
				this.tmpChoknsRtFtthTsprc = JACStrConst.KNSHO_RSLT_WRN;
			}
		}
		// 入力Ｍ．存在チェック結果コード ＝ "1"（ワーニング） 
		// または 入力Ｍ．存在チェック結果コード ＝ "2"（NG） の場合
		else if(JACStrConst.KNSHO_RSLT_WRN.equals(sonzaiChkRsltCd)
					|| JACStrConst.KNSHO_RSLT_NG.equals(sonzaiChkRsltCd))
		{
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][setChosaknsRsltMatchInfo][入力Ｍ．存在チェック結果コード ＝ 1（ワーニング）または 入力Ｍ．存在チェック結果コード ＝ 2（NG） の場合 ]");
			// 退避．調査検証結果（ＦＴＴＨ通信料） ← "0"（ＯＫ）
			this.tmpChoknsRtFtthTsprc = JACStrConst.KNSHO_RSLT_OK;
		}
		
		// 調査検証結果補足設定
		// 退避．調査検証結果補足 ← 退避．調査検証結果補足（マスタのみ）
		this.tmpChoknsRtHsk			= this.tmpChosaknsRtHkMst;
		
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint,
				"[E][setChosaknsRsltMstInfo][退避．調査検証結果（ＦＴＴＨ通信料） = " + this.tmpChoknsRtFtthTsprc  + "]");
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][setChosaknsRsltMstInfo][退避．調査検証結果補足 = " + this.tmpChoknsRtHsk	  + "]");
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][setChosaknsRsltMstInfo]");
		return;
	}
	
	/**
	 * 検検証結果情報出力処理を行います。
	 * @param mastMap　入力電文
	 * @param outputInItem　出力情報
	 * @throws Exception 業務サービス内で発生した例外全般。
	 */
	private void makeOutputInfo(JBSbatServiceInterfaceMap mastMap, JBSbatOutputItem outputInItem) throws Exception
	{
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][makeOutputInfo]");
		
		JBSbatServiceInterfaceMap outMap = new JBSbatServiceInterfaceMap();
		
		// 退避．請求パターン検証エラーレベル  ← 入力Ｍ．存在チェック結果 ＋ 入力Ｍ．金額チェック結果 ＋ 退避．調査検証結果（ＦＴＴＨ通信料）
		String seikyPtnKnshoErrLvCd = this.makeStr(mastMap.getString(JBSbatAKIFM006.SONZAI_CHK_RSLT_CD), mastMap.getString(JBSbatAKIFM006.AMNT_CHK_RSLT_CD)
										, this.tmpChoknsRtFtthTsprc);
		
		// 入力電文コピー
		outMap.setMap(mastMap.getMap());
		// 差分設定
		// 検証年月日
		outMap.set(JBSbatAKIFM011.KNSHO_YMD, 					super.opeDate);
		// 調査検証合計金額
		outMap.set(JBSbatAKIFM011.CHOSAKNS_GOKEI_AMNT, 			BigDecimal.ZERO);
		// 調査検証結果（１Ｎ割引適用対象）
		outMap.set(JBSbatAKIFM011.CHOSAKNS_RSLT_1N_WRBAPL_TG, 	JACStrConst.KARA_MOJI);
		// 調査検証結果（請求書発行手数料）
		outMap.set(JBSbatAKIFM011.CHOSAKNS_RSLT_SKS_HAK_CMS, 	JACStrConst.KARA_MOJI);
		// 調査検証結果（外部料金ＰＴ外）
		outMap.set(JBSbatAKIFM011.CHOSAKNS_RSLT_OUTPRCPTNOT, 	JACStrConst.KARA_MOJI);
		// 調査検証結果（外部料金ＰＴ内）
		outMap.set(JBSbatAKIFM011.CHOSAKNS_RSLT_OUTPRCPTNIN, 	JACStrConst.KARA_MOJI);
		// 調査検証結果（通話料金）
		outMap.set(JBSbatAKIFM011.CHOSAKNS_RSLT_TUWA_PRC, 		JACStrConst.KARA_MOJI);
		// 調査検証結果（パケット料金）
		outMap.set(JBSbatAKIFM011.CHOSAKNS_RSLT_PCT_PRC, 		JACStrConst.KARA_MOJI);
		// 調査検証結果（ＦＴＴＨ通信料金）
		outMap.set(JBSbatAKIFM011.CHOSAKNS_RSLT_FTTH_TSPRC, 	this.tmpChoknsRtFtthTsprc);
		// 調査検証結果（投入一時金）
		outMap.set(JBSbatAKIFM011.CHOSAKNS_RSLT_TONYU_ICJKN, 	JACStrConst.KARA_MOJI);
		// 調査検証結果（調整金）
		outMap.set(JBSbatAKIFM011.CHOSAKNS_RSLT_ADJ_PRC, 		JACStrConst.KARA_MOJI);
		// 調査検証結果補足	
		outMap.set(JBSbatAKIFM011.CHOSAKNS_RSLT_HSK, 			this.tmpChoknsRtHsk);
		// 請求ＰＴ検証エラーレベルコード
		outMap.set(JBSbatAKIFM011.SEIKY_PTN_KNSHO_ERR_LV_CD, 	seikyPtnKnshoErrLvCd);
		
		// 出力フラグ設定
		outMap.setOutFlg(true);
		
		outputInItem.addOutMapList(outMap);

		assert outMap != null ? JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][makeOutputInfo][outMap = " + outMap.getMap().toString() + "]") : true;
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][makeOutputInfo]");

		return;
	}
}
