/*********************************************************************
*  All Rights reserved,Copyright (c) K-Opticom
**********************************************************************
*＜プログラム内容＞
*	システム名			：eo顧客基幹システム
*	モジュール名		：JBSbatACTushinInfChk
*	ソースファイル名	：JBSbatACTushinInfChk.java
*	作成者				：富士通　
*	作成日				：2012年03月06日
*＜機能概要＞
*　通信情報チェック部品です。
*＜修正履歴＞
*	バージョン	修正日		修正者		修正内容
*	v1.00.00	2012/03/06   富士通		新規作成
*	v3.00.00	2012/08/14   FJ)岡田	【ST2-2012-0001537】認証IDのチェック仕様変更
*	v3.01.00	2012/08/29   FJ)冨井	【ST2-2012-0001602】サービス契約内訳＜ｅｏ光ネット＞抽出条件変更
*	v3.02.00	2012/09/02   FJ)成田	【TG1-2012-0000145】パラメータ取得部品の共通化、それに伴う不要な初期化削除、クローズ処理を追加。
*															料金スケジュール定義アクセス部品の初期化処理を初期処理に変更、クローズ処理を追加。
*	v4.00		2012/09/22   FJ)冨井	【ANK-1212-00-00】通信量情報（法人分）CLARIS送信ファイル出力追加
*	v4.01		2012/10/12   FJ)岡田	【ST2-2012-0001780】請求年月の取得条件変更
*	v4.02		2013/01/23   FJ)小柴	【内部管理番号-0000661】FTTH通信明細に登録されず、FTTH通信量エラーに登録された
*	v4.03		2013/02/12   FJ)高田	【ST4-2013-0000109】性能改善　アンロード化
*	v4.04		2013/02/27   FJ)狭間	【ST4-2013-0000109】性能改善　処理を大幅に見直し
*	v4.05		2013/03/08   FJ)浜口	【TG1-2013-0000044】従量制契約者のみ再計算対象と*する対応
*	v4.06		2013/04/01   FJ)浜口	認証ＩＤが紐づかない場合エラー出力する
*	v4.07		2013/04/05   FJ)小柴	【IKK-2013-0000783】文字化け対策のため、エンコード形式の変更
*	v4.08		2013/04/11   FJ)浜口	【残課題一覧No.5】ファイル生成制御上書き対応
*	v4.09		2013/04/12   FJ)浜口	法人分連携時は認証ＩＤマッチングを行わない
*	v4.10		2013/06/13   FJ)狭間	【KT1-2013-0000670】通信量情報件数（工事遅延分）の改行コードを後続処理に合わせる修正
*	v4.11		2013/06/24   FJ)狭間	【TG1-2013-0000657】通信料情報にフェムトセルのレコードがあった場合、アンマッチでワーニングが出る不具合を修正
*	v5.00		2013/07/08   FJ)前田	【IT1-2013-0001420】警告メッセージを出力
*	v5.01		2013/07/09   FJ)大戸	【TG1-2013-0000662】マスタ参照基準日対応
*	v5.02		2013/09/09   FJ)伊藤	【OM-2013-0001847】初回処理のレコードに対し、バッチ運用日から取得した請求年月との比較処理を追加
*	v5.03		2013/09/10   FJ)伊藤	【OM-2013-0001847】再処理レコードの工事完了分に対しても、バッチ運用日から取得した請求年月との比較処理を追加
*	v5.04		2013/10/17   FJ)伊藤	【ANK-1639-00-00】通信量数値チェックを、整数のみ許可に変更（マイナスをエラーにする）
*	v7.00		2014/02/21   FJ)垣内	【OM-2014-0000480】プラン課金開始年月日、プラン課金終了年月日を出力条件に追加
*	v7.01		2014/03/14   FJ)垣内	【OM-2014-0001040】認証IDの契約情報が存在するにも関わらずエラー出力される
*	v8.00		2014/06/10   FJ)安井	【OM-2014-0001886】契約最新世代が課金中でない場合に過去履歴の課金中レコードからプラン情報を取得するよう修正
*	v25.00		2015/05/30   FJ)山裾	【OM-2016-0001231】FTTH通信料エラーファイル件数が１件以上の場合のメッセージをワーニングからインフォメーションに変更
*********************************************************************/
package eo.business.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;

import eo.business.common.JACBatCommon;
import eo.business.common.JACbatDebugLogUtil;
import eo.business.common.JACbatParamUtil;
import eo.business.common.JACbatSchdlUtil;
import eo.business.common.JBSbatBusinessService;
import eo.business.common.JBSbatMatchServiceInterface;
import eo.business.common.JCCBatCommon;
import eo.business.util.file.JBSbatACIFM121;
import eo.business.util.file.JBSbatACIFM124;
import eo.business.util.file.JBSbatACIFM190;
import eo.business.util.table.JBSbatAC_M_JURYOPRC;
import eo.business.util.table.JBSbatKK_T_SVC_KEI;
import eo.business.util.table.JBSbatKK_T_SVKEIUW_EOH_NET;
import eo.common.constant.JACStrConst;
import eo.common.constant.JPCBatchMessageConstant;
import eo.common.util.JPCUtilCommon;
import eo.framework.application.JBSbatBusinessException;
import eo.framework.db.JBSbatSQLAccess;
import eo.framework.file.JBSbatDefFileUtil;
import eo.framework.file.JBSbatInputFileUtil;
import eo.framework.file.JBSbatOutputFileUtil;
import eo.framework.item.JBSbatCommonDBInterface;
import eo.framework.item.JBSbatCommonItem;
import eo.framework.item.JBSbatOutputItem;
import eo.framework.item.JBSbatServiceInterfaceMap;
import eo.framework.util.JBSbatAplConst;
import eo.framework.util.JBSbatBusinessFileUtil;
import eo.framework.util.JBSbatCheckUtil;
import eo.framework.util.JBSbatDateUtil;
import eo.framework.util.JBSbatStringUtil;

/**
* (クラスの機能概要) <p>
*<BR>
* @author 富士通
*/
public class JBSbatACTushinInfChk extends JBSbatBusinessService implements JBSbatMatchServiceInterface
{
	/**▼▼▼▼▼▼ツールから生成した宣言です 開始▼▼▼▼▼▼*/
	/** テーブル(従量料金)*/
	private static final String D_TBL_NAME_AC_M_JURYOPRC = "AC_M_JURYOPRC";

	/** テーブル(サービス契約)*/
	private static final String D_TBL_NAME_KK_T_SVC_KEI = "KK_T_SVC_KEI";

	/** SQL定義キー(AC_SELECT_001)*/
	private static final String AC_M_JURYOPRC_AC_SELECT_001 = "AC_SELECT_001";

	/** SQL定義キー(AC_SELECT_036)*/
	private static final String KK_T_SVC_KEI_AC_SELECT_036 = "AC_SELECT_036";

	/** テーブルアクセスクラス(従量料金)*/
	private JBSbatSQLAccess db_AC_M_JURYOPRC = null;

	/** テーブルアクセスクラス(サービス契約)*/
	private JBSbatSQLAccess db_KK_T_SVC_KEI = null;
	
	/** キーマッチ処理フラグ*/
	private boolean matchProcFlg = false;
	
	/** マスタファイル処理フラグ*/
	private boolean mastProcFlg = false;
	
	/** トランファイル処理フラグ*/
	private boolean tranProcFlg = false;
	/**▲▲▲▲▲▲ツールから生成した宣言です 終了▲▲▲▲▲▲*/
	
	/** 出力ファイル定義 */
	private static final String 		PRM_OTD 	= "OTD";
	
	/** 認証ID区分（フェムトセル） */
	private static final String 		NINSHO_ID_DIV_FEMTO_CELL 	= "3";
	
	/** 出力用エラー内容マップ */
	private HashMap<String, String> 	outErrMap 			= null;
	
	/** 出力ファイル用配列 */
	private String[] 					outFileArray 		= null;
	
	/** FTTH通信量エラーファイル */
	private JBSbatBusinessFileUtil 	ftthTushinErrFile 	= null;
	
	/** FTTH通信量エラーファイルパス */
	private String 					ftthTushinPath 		= null;
	
	/** FTTH通信量エラーファイルID */
	private String 					ftthFileID			= null;
	
	/** 再投入可能期間 */
	private static final int 		RE_TONYU			= 1;
	
	/** 通信量情報(翌日取込分)ファイル */
	private JBSbatBusinessFileUtil 	tushinInfoFile 		= null;
	
	/** 通信量情報件数(翌日取込分)ファイル */
	private JBSbatBusinessFileUtil 	tushinInfoCntFile 	= null;
	
	/** 通信量情報（工事遅延）ファイル */
	private JBSbatBusinessFileUtil 	tushinInfoChienFile 	= null;
	
	/** 通信量情報（法人分）CLARIS送信ファイル */
	private JBSbatBusinessFileUtil 	tushinInfoHojinFile = null;
	
	/** 請求先番号ファイル */
	private JBSbatBusinessFileUtil 	seikyNoFile = null;
	
	/** 請求先番号（工事遅延）ファイル */
	private JBSbatBusinessFileUtil 	seikyNoChienFile = null;
	
	/** 再計算向請求先番号ファイル */
	private JBSbatBusinessFileUtil 	seikyNoReCalFile = null;
	
	/** 再計算向請求先番号（工事遅延）ファイル */
	private JBSbatBusinessFileUtil 	seikyNoReCalCenFile = null;
	
	/** 通信量情報マージ済件数 */
	private String 	tushinInfoMergeCnt 	= null;
	
	/** データ取得年月日上2桁 */
	private String 	dateStkuYY 			= null;
	
	/** 認証ID先頭1桁P */
	private String 	nisyidPrefixP 		= null;
	
	/** 認証ID先頭1桁R */
	private String 	nisyidPrefixR 		= null;
	
	/** 法人用認証ID先頭1桁 */
	private String 	nisyidPrefixHjn 	= null;
	
	/** FTTH通信量エラーファイル件数 */
	private int 	ftthTushinErrCnt 	= 0;
	
	/** 通信量情報件数(翌日取込分)ファイル件数 */
	private int 	tushinInfoCntCnt 	= 0;
	
	/** 通信量情報(翌日取込分)ファイル件数 */
	private int 	tushinInfoCnt 		= 0;
	
	/** 通信量情報（法人分）CLARIS送信ファイル件数 */
	private int 	tushinInfoHojinCnt 		= 0;
	
	/** 通信量情報（工事遅延）ファイル件数 */
	private int 	tushinInfoChienCnt 		= 0;
	
	/** 請求先番号ファイル件数 */
	private int 	seikyNoCnt 		= 0;
	
	/** 請求先番号（工事遅延）ファイル件数 */
	private int 	seikyNoChienCnt 		= 0;
	
	/** 再計算向請求先番号ファイル件数 */
	private int 	seikyNoReCalCnt 		= 0;
	
	/** 再計算向請求先番号（工事遅延）ファイル件数 */
	private int 	seikyNoReCalChienCnt 		= 0;
	
	/** 前回重複チェックデータ */
	private String prevCheckDate 		= null;
	
	/** 料金スケジュール定義アクセス部品 */
	private JACbatSchdlUtil schdlUtil 	= null;

	/** 請求先番号（FTTH） */
	private HashSet<String> seikyNoMap = null;
	
	/** 請求先番号（FTTH・工事遅延） */
	private HashSet<String> seikyNoChienMap = null;
	
	/** 再計算向請求先番号（FTTH） */
	private HashSet<String> seikyNoReCalMap = null;
	
	/** 再計算向請求先番号（FTTH・工事遅延） */
	private HashSet<String> seikyNoReCalChienMap = null;
	
	/** 請求年月 */
	private String seikyYm 		= null;
	
	/** 認証ID */
	private String wkNinshoId 		= null;
	
	/** データ取得日時(YYMMDDHHmmss) */
	private String wkDateStkuDate 	= null;
	
	/** 通信量 */
	private String wkTushinryo 	= null;
	
	/** 運用日 */
	private String wkOpd 			= null;
	
	/** データ取得年月日 */
	private String dateYmd 		= null; 
	
	/** データ取得時分秒 */
	private String dateHms 		= null; 
	
	/** サービス契約番号 */
	private String wkSvcKeiNo		= null;
	
	/** サービス課金開始年月日 */
	private String wkSvcChrgStaYmd = null;
	
	/** 料金コースコード */
	private String wkPcrsCd 		= null;
	
	/** 料金プランコード */
	private String wkPplanCd 		= null;
	
	/** 請求契約番号 */
	private String wkSeikyKeiNo	= null;
	
	/** エラーフラグ */
	private boolean errFlg 		= false;
	
	/** パラメータ取得部品 */
	private JACbatParamUtil paramUtil = null;
	
	/** レコード件数 */
	private String recCnt = "";
	
	/** 従量料金情報マップ*/
	private HashSet<String> juryoPrcMap = null;
	
	/** サービス契約内訳＜eo光ネット＞情報 <br>
	[0]:サービス契約番号
	[1]:料金コースコード
	[2]:料金プランコード
	[3]:請求契約番号
	 */
	private String[] svkeiuwEohNetInfo = new String[]{
			JACStrConst.KARA_MOJI
			, JACStrConst.KARA_MOJI
			, JACStrConst.KARA_MOJI
			, JACStrConst.KARA_MOJI
		};
	
	/** マスタキー */
	private String mastKey = "";
//20130709 追加　FJ)OHTO　START
	/** 請求年月 */
	private String wk_SkyuYM 	= null;

	/** 請求年月初日 */
	private String wk_Str 	= null;

	/** 請求年月末日 */
	private String wk_End 	= null;
//20130709 追加　FJ)OHTO　END
	
	/** 有効範囲内チェック部品引数（3:文字列（年月日）） */
	private static final String RNG_CHCK_FLG_YMD = "3";
	
	/** 退避契約ＤＢキー */
	private String bkTranKey 	= null;
	
	/** 退避契約ＤＢリスト */
	private ArrayList<JBSbatServiceInterfaceMap> bkTranList = new ArrayList<JBSbatServiceInterfaceMap>();
	
	/**
	 * 初期処理
	 * @param JBSbatCommonItem commonItem バッチ共通パラメータ電文
	 * @throws Exception                  業務サービス内で発生した例外全般。
	 */
	public void initial(JBSbatCommonItem commonItem) throws Exception
	{
	/**▼▼▼▼▼▼業務サービスの初期処理を記述してください。▼▼▼▼▼▼*/
		/**▼▼▼▼▼▼ツールから生成した初期化のソースです 開始▼▼▼▼▼▼*/
		// 共通パラメータを設定します
		super.setCommonInfo(commonItem);

		// DBアクセスクラスを生成します
		db_AC_M_JURYOPRC = new JBSbatSQLAccess(commonItem, D_TBL_NAME_AC_M_JURYOPRC);
		db_KK_T_SVC_KEI = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_SVC_KEI);
		/**▲▲▲▲▲▲ツールから生成した初期化のソースです 終了▲▲▲▲▲▲*/
		
		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.paramUtil = new JACbatParamUtil(commonItem);
		
		// エラー内容マップ設定
		this.outErrMap = new HashMap<String, String>();
		setErrMap();
		
		// 業務パラメータ取得
		this.dateStkuYY 		= this.paramUtil.getGyoumuParameter(JACStrConst.WKPARA_AC_DATA_STKU_YY); 		// データ取得年月日上2桁
		this.nisyidPrefixP 		= this.paramUtil.getGyoumuParameter(JACStrConst.WKPARA_AC_NISYID_PREFIX_P); 	// 認証ID先頭1桁P
		this.nisyidPrefixR 		= this.paramUtil.getGyoumuParameter(JACStrConst.WKPARA_AC_NISYID_PREFIX_R); 	// 認証ID先頭1桁R
		this.nisyidPrefixHjn 	= this.paramUtil.getGyoumuParameter(JACStrConst.WKPARA_AC_NISYID_PREFIX_HJN); 	// 法人用認証ID先頭1桁
		this.ftthFileID 		= this.paramUtil.getGyoumuParameter(JACStrConst.WKPARA_AC_FTTH_TUSN_ERR_FID); 	// FTTH通信量エラー		
		
		// 料金スケジュール定義アクセス部品初期処理
		this.schdlUtil 		= new JACbatSchdlUtil(commonItem);
		
		// 外部パラメータを分割します。
		String[] freeItems = super.freeItem.split(JACStrConst.SEMI_COLON);
		
		// 通信量情報マージ済件数格納
		this.tushinInfoMergeCnt = freeItems[0];
		
		// 出力ファイル用配列
		this.outFileArray = new String[17];
		
		System.arraycopy(freeItems, 1, this.outFileArray, 0, 17);
		
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][initial][freeItems=" + freeItems.toString() +  "]");
		
		// ファイル生成します。
		// 通信量情報(翌日取込分)
		this.tushinInfoFile 		= createFile(this.outFileArray[1], this.outFileArray[0], JACBatCommon.chgKaigyo(JACStrConst.LINE_CRLF));
		
		// 通信量情報件数(翌日取込分)
		this.tushinInfoCntFile 		= createFile(this.outFileArray[3], this.outFileArray[2], JACBatCommon.chgKaigyo(JACStrConst.LINE_CRLF));
		
		// 通信量情報（工事遅延）
		this.tushinInfoChienFile 		= createFile(this.outFileArray[5], this.outFileArray[4], JACBatCommon.chgKaigyo(JACStrConst.LINE_LF));
		
		// 通信量情報（法人分）CLARIS送信ファイル
		this.tushinInfoHojinFile	= createFile(this.outFileArray[7], this.outFileArray[6], JACBatCommon.chgKaigyo(JACStrConst.LINE_LF));
		
		// 請求先番号ファイル
		this.seikyNoFile	= createFile(this.outFileArray[9], this.outFileArray[8], JACBatCommon.chgKaigyo(JACStrConst.LINE_CRLF));
		
		// 請求先番号（工事遅延）ファイル
		this.seikyNoChienFile	= createFile(this.outFileArray[11], this.outFileArray[10], JACBatCommon.chgKaigyo(JACStrConst.LINE_CRLF));
		
		// 再計算向請求先番号ファイル
		this.seikyNoReCalFile	= createFile(this.outFileArray[14], this.outFileArray[13], JACBatCommon.chgKaigyo(JACStrConst.LINE_CRLF));
		
		// 再計算向請求先番号（工事遅延）ファイル
		this.seikyNoReCalCenFile	= createFile(this.outFileArray[16], this.outFileArray[15], JACBatCommon.chgKaigyo(JACStrConst.LINE_CRLF));
		
		// FTTH通信量エラーファイル生成
		// ファイル用年月日時分秒作成
		String fileYmd = super.opeDate.concat(JCCBatCommon.getSysDateTimeStamp().substring(8, 17));
		
		// （引数：バッチ共通パラメータ, ファイルID, ファイル分割有無, ファイル連番, 請求年月, 自由設定, 文字コード, 変換前改行コード）
		ArrayList<Object> fileInf = JACBatCommon.geneFile(commonItem
														, this.ftthFileID
														, JACStrConst.FILE_DIV_SKBT_CD_ARI
														, JACStrConst.TRIPLE_O, JACStrConst.KARA_MOJI
														, fileYmd
														, JACStrConst.KARA_MOJI
														, JACStrConst.KARA_MOJI
														, JACStrConst.LINE_CRLF);
		
		this.ftthTushinPath 		= (String)fileInf.get(0);					// ファイル名（フルパス）
		this.ftthTushinErrFile 		= (JBSbatBusinessFileUtil)fileInf.get(2);	// ファイルインスタンス
		
		// ファイル読み込み
		JBSbatInputFileUtil inFileObj = new JBSbatInputFileUtil(this.outFileArray[12]);	//ACIFM122
		inFileObj.setEncode(JACStrConst.ENCODE_MS932);
		inFileObj.createReader();
		while (inFileObj.ready())
		{
			// レコード件数取得
			this.recCnt = inFileObj.readLine();
		}
		
		// 一時ファイルを閉じる
		if (inFileObj != null)
		{
			inFileObj.close();
			
		}

		// 請求先番号格納用リストの初期化
		this.seikyNoMap = new HashSet<String>();
		
		// 請求先番号（工事遅延）格納用リストの初期化
		this.seikyNoChienMap = new HashSet<String>();
		
		// 再計算向請求先番号格納用リストの初期化
		this.seikyNoReCalMap = new HashSet<String>();
		
		// 再計算向請求先番号（工事遅延）格納用リストの初期化
		this.seikyNoReCalChienMap = new HashSet<String>();
//20130709 追加　FJ)OHTO　START
		// 請求年月取得
		JACbatSchdlUtil schdUtil = new JACbatSchdlUtil(commonItem);
		try
		{
			// 料金スケジュール定義アクセス部品を使用する。
			this.wk_SkyuYM = schdUtil.getBillDate(super.opeDate, JACStrConst.EVENT_CD_RYOKIN_KEISAN_YMD);
			
			// 月初日、締め日　←　JACbatSchdlUtil.getUseStrEnd(請求年月, イベントコード("01"（利用開始日））, イベントコード（"02"（利用終了日））)
			String[] rtn = schdUtil.getUseStrEnd(this.wk_SkyuYM, JACStrConst.EVENT_CD_USE_STAYMD, JACStrConst.EVENT_CD_USE_ENDYMD);
			this.wk_Str = rtn[0];
			this.wk_End = rtn[1];
			
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "バッチ運用日から取得した請求年月：" + this.wk_SkyuYM);
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "月初日：" + this.wk_Str);
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "月〆日：" + this.wk_End);
		}
		finally
		{
			// クローズ
			schdUtil.close();
		}
//20130709 追加　FJ)OHTO　END

		// 従量料金の取得
		makeJuryoPrcInfoMap();
		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
	{
	/**▼▼▼▼▼▼業務サービスの主処理を記述してください。▼▼▼▼▼▼*/
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][execute]");
		assert 	mastMap != null ? JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][execute][mastMap=" + mastMap.getMap().toString() + "]") : true;
		assert 	tranMap != null ? JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][execute][tranMap=" + tranMap.getMap().toString() + "]") : true;
		
		boolean checkFlg = false;
		
		// ファイル作成要フラグ
		boolean makeFileFlg = false;
		
		// 検索対象一致フラグ
		boolean matchFlg = false;
		
		// サービス契約番号
		this.wkSvcKeiNo 		= null;
		
		// サービス課金開始年月日
		this.wkSvcChrgStaYmd	= null;
		
		// 料金コースコード
		this.wkPcrsCd 			= null;
		
		// 料金プランコード
		this.wkPplanCd			= null;
		
		// 請求契約番号
		this.wkSeikyKeiNo		= null;
	
		JBSbatServiceInterfaceMap wkTranMap = null;
		
		// 通信料情報（マスタマップ）にデータがある場合
		if(mastMap != null)
		{
			// 入力T.件数≠退避.通信量情報マージ済件数
			if(!this.tushinInfoMergeCnt.equals(this.recCnt))
			{
				// エラーフラグがfalseの場合
				if(!this.errFlg)
				{
					// データレコード件数不一致
					String[] msgParam = new String[]
					{this.tushinInfoMergeCnt, this.recCnt};
					super.logPrint.printBusinessErrorLog(JPCBatchMessageConstant.EACB0770NW, msgParam);
					
					// エラーフラグをtrueにする
					this.errFlg = true;
				}
				else
				{
					this.setMastProcFlg(true);
				}
			}
			else
			{
				// 法人の場合、契約ＤＢデータが存在しないので無条件にマッチ時の処理を行う
				if(mastMap.getString(JBSbatACIFM121.NINSHO_ID).startsWith(this.nisyidPrefixHjn))
				{
					assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][execute][法人の場合、契約ＤＢデータが存在しない]");
					makeFileFlg = true;
					matchFlg = true;
					
					// 通信料情報次行読み込み
					this.setMastProcFlg(true);
				}
				else
				{
					// 契約ＤＢデータ（トランマップ）にデータがある場合
					if(tranMap != null)
					{
						// キー項目の取得
						this.mastKey = mastMap.getString(JBSbatACIFM121.NINSHO_ID);
						String tranKey = tranMap.getString(JBSbatACIFM190.ISP_NINSHO_ID);
						
						// 契約ＤＢデータをListにためる
						if(bkTranKey == null || bkTranKey.equals(tranKey))
						{
							// 退避契約ＤＢキーにセット
							bkTranKey = tranKey;
							
							// 退避契約ＤＢリストにためる
							bkTranList.add(tranMap);
							
							// 契約ＤＢデータ次行読み込み
							this.setTranProcFlg(true);
						}
						else
						{
							// 通信料情報キー ＝ 契約ＤＢデータキー
							if(mastKey.equals(bkTranKey))
							{
								// 契約ＤＢの世代最大レコード
								wkTranMap = bkTranList.get(0);
								
								// マッチングした契約ＤＢデータがフェムトセル以外ならデータ出力
								String ninshoIdDiv = wkTranMap.getString(JBSbatACIFM190.NINSHO_ID_DIV);
								if(!NINSHO_ID_DIV_FEMTO_CELL.equals(ninshoIdDiv))
								{
									// キー一致処理
									makeFileFlg = true;
									
									// サービス契約番号
									this.wkSvcKeiNo 		= wkTranMap.getString(JBSbatACIFM190.SVC_KEI_NO);
									
									// サービス課金開始年月日
									this.wkSvcChrgStaYmd	= wkTranMap.getString(JBSbatACIFM190.SVC_CHRG_STAYMD);
									
									// 料金コースコード
									this.wkPcrsCd			= wkTranMap.getString(JBSbatACIFM190.PCRS_CD);
									
									// 料金プランコード
									this.wkPplanCd			= wkTranMap.getString(JBSbatACIFM190.PPLAN_CD);
									
									// 請求契約番号
									this.wkSeikyKeiNo		= wkTranMap.getString(JBSbatACIFM190.SEIKY_KEI_NO);
									
									matchFlg = true;
								}

								// 通信料情報次行読み込み
								this.setMastProcFlg(true);
							}
							// 通信料情報キー ＜ 契約ＤＢデータキー
							else if(mastKey.compareTo(bkTranKey) < 0)
							{
								// 検索対象一致なしエラー処理
								makeFileFlg = true;
	
								// 通信料情報次行読み込み
								this.setMastProcFlg(true);
							}
							// 通信料情報キー ＞ 契約ＤＢデータキー
							else
							{
								// 退避契約ＤＢキー初期化
								bkTranKey = null;
								
								// 退避契約ＤＢリスト初期化
								bkTranList = new ArrayList<JBSbatServiceInterfaceMap>();;
							}
						}
					}
					else
					{
						this.mastKey = mastMap.getString(JBSbatACIFM121.NINSHO_ID);

						// 通信料情報キー ＝ 契約ＤＢデータキー
						if(mastKey.equals(bkTranKey))
						{
							// 契約ＤＢの世代最大の値を退避
							wkTranMap = bkTranList.get(0);
							
							// マッチングした契約ＤＢデータがフェムトセル以外ならデータ出力
							String ninshoIdDiv = wkTranMap.getString(JBSbatACIFM190.NINSHO_ID_DIV);
							if(!NINSHO_ID_DIV_FEMTO_CELL.equals(ninshoIdDiv))
							{
								// キー一致処理
								makeFileFlg = true;
								
								// サービス契約番号
								this.wkSvcKeiNo 		= wkTranMap.getString(JBSbatACIFM190.SVC_KEI_NO);
								
								// サービス課金開始年月日
								this.wkSvcChrgStaYmd	= wkTranMap.getString(JBSbatACIFM190.SVC_CHRG_STAYMD);
								
								// 料金コースコード
								this.wkPcrsCd			= wkTranMap.getString(JBSbatACIFM190.PCRS_CD);
								
								// 料金プランコード
								this.wkPplanCd			= wkTranMap.getString(JBSbatACIFM190.PPLAN_CD);
								
								// 請求契約番号
								this.wkSeikyKeiNo		= wkTranMap.getString(JBSbatACIFM190.SEIKY_KEI_NO);
								
								matchFlg = true;
							}
							
							// 通信料情報次行読み込み
							this.setMastProcFlg(true);
						}
						else
						{
							// 検索対象一致なしエラー処理
							makeFileFlg = true;

							// 通信料情報次行読み込み
							this.setMastProcFlg(true);
						}
					}
				}
			}
		}
		else
		{
			// 処理正常終了なので終わるまで契約ＤＢデータを読み進める
			// 契約ＤＢデータ次行読み込み
			this.setTranProcFlg(true);
		}
		
		if(makeFileFlg)	
		{	
			// 認証ID一致ありの場合
			if(matchFlg)
			{
				// チェック用項目設定
				// wkNinshoId、wkDateStkuDate、wkTushinryo、wkOpd、dateYmd、dateHmsを通信料情報からセット
				this.setCheckDate(mastMap);
				
				// 通信料情報．運用日が設定されていないか、法人分のレコード
				if(JACStrConst.KARA_MOJI.equals(this.wkOpd) || this.wkNinshoId.startsWith(this.nisyidPrefixHjn))
				{
					// 入力データチェック処理
					checkFlg = this.checkValidate(mastMap, outputInItem);
					
					if(checkFlg)
					{
						//バッチ運用日を引数に料金計算日で取得した請求年月≦データ取得年月日を引数にして月末締めで取得した請求年月
						if(this.outpuFtthJudge())
						{
							// チェックフラグ初期化
							boolean checkTranFlg = true;

							// 契約ＤＢデータリスト
							for(int i = 0; i < bkTranList.size(); i++)
							{
								wkTranMap = bkTranList.get(i);
								
								String planChrgStaYmd = (String)wkTranMap.get(JBSbatACIFM190.PLAN_CHRG_STAYMD);
								String planChrgEndYmd = (String)wkTranMap.get(JBSbatACIFM190.PLAN_CHRG_ENDYMD);

								// プラン課金開始年月日、プラン課金終了年月日が空の場合は対象外
								if(planChrgStaYmd != null && planChrgEndYmd != null && 
									!JACStrConst.KARA_MOJI.equals(planChrgStaYmd) && !JACStrConst.KARA_MOJI.equals(planChrgEndYmd))
								{
									// プラン課金開始年月日 ≦ データ取得年月日 ≦ プラン課金終了年月日の場合のみ出力
									if(planChrgStaYmd.compareTo(planChrgEndYmd) <= 0 && 
										JBSbatStringUtil.rangeCheck(planChrgEndYmd, planChrgStaYmd, dateYmd, RNG_CHCK_FLG_YMD))
									{
										// FTTH通信量ファイル出力処理
										outputInItem.addOutMapList(this.makeFtthTushinPlan(mastMap, wkTranMap, JACStrConst.CHRG_KH_PSB));
										
										// 再計算向請求先番号ファイル出力
										outpuseikyNoReCalc(wkTranMap);
										
										// プラン期間内の契約ＤＢデータありでフラグをOFFにする
										checkTranFlg = false;
										
										break;
									}
								}
							}
//OM-2014-0001886 ADD STA
							if(checkTranFlg)
							{
								// 契約ＤＢデータリスト
								for(int i = 0; i < bkTranList.size(); i++)
								{
									wkTranMap = getSvcKeiRrk(bkTranList.get(i), dateYmd);
									
									if(wkTranMap != null)
									{
										// FTTH通信量ファイル出力処理
										outputInItem.addOutMapList(this.makeFtthTushinPlan(mastMap, wkTranMap, JACStrConst.CHRG_KH_PSB));
										
										// 再計算向請求先番号ファイル出力
										outpuseikyNoReCalc(wkTranMap);
										
										// プラン期間内の契約ＤＢデータありでフラグをOFFにする
										checkTranFlg = false;
										
										break;
									}
								}
							}
//OM-2014-0001886 ADD END
							if(checkTranFlg)
							{
								outputInItem.addOutMapList(this.makeFtthTushinPlan(mastMap, bkTranList.get(0), JACStrConst.CHRG_KH_FAIL));
								
								// 再計算向請求先番号ファイル出力
								outpuseikyNoReCalc(bkTranList.get(0));
							}
						}
						//バッチ運用日を引数に料金計算日で取得した請求年月＞データ取得年月日を引数にして月末締めで取得した請求年月
						else
						{
							// FTTH通信量（工事完了遅延）出力処理
							outputInItem.addOutMapList_2(this.makeFtthTushin(mastMap));
						}
					}
				}
				// 通信料情報．運用日が設定されているレコードは、再処理分とし、工事完了遅延に対する処理のみ行う。
				else
				{
					//再処理分の場合
					
					//工事完了の判別を行う。
					if(!this.checkKojiChien())
					{
						// 工事完了の場合
						// 請求年月を取得する（02：利用終了日）
						this.seikyYm 		= schdlUtil.getBillDate(this.dateYmd, JACStrConst.EVENT_CD_USE_ENDYMD);
						assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "データ取得年月日から取得した請求年月：" + this.seikyYm);
						
						//バッチ運用日を引数に料金計算日で取得した請求年月≦データ取得年月日を引数にして月末締めで取得した請求年月
						if(this.outpuFtthJudge())
						{
							// FTTH通信量ファイル出力処理
							outputInItem.addOutMapList(this.makeFtthTushin(mastMap));
							
							// 再計算向請求先番号ファイル出力
							outpuseikyNoReCalc(bkTranList.get(0));
						}
						//バッチ運用日を引数に料金計算日で取得した請求年月＞データ取得年月日を引数にして月末締めで取得した請求年月
						else
						{
							// FTTH通信量（工事完了遅延）出力処理
							outputInItem.addOutMapList_2(this.makeFtthTushin(mastMap));
						}
					}
					else
					{
						// 工事未完了の場合
						
						// 再処理可否判定
						
						// 初期値に最大値設定
						String rimitDay = "99999999";
						if(this.wkOpd.length() >= 6)
						{
							String chkLastYm = JCCBatCommon.addMonth(this.wkOpd, RE_TONYU).substring(0, 6);
							String chkLastDay = JCCBatCommon.getEndOfMonth(chkLastYm);
							rimitDay = chkLastYm + chkLastDay;
						}
						
						// オンライン運用日-1　≦　通信量情報マージ済・運用日の翌月末日の場合
						if (rimitDay.compareTo(JPCUtilCommon.addDay(super.onlineOpeDate, -1)) >= 0)
						{
							//再処理可能
							assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][execute]再処理可能");
							
							// 通信量情報(工事完了遅延)ファイル書き込み
							JCCBatCommon.printBusinessFileUtil(this.tushinInfoChienFile, this.maketushinInfoChienData(mastMap, mastMap.getString(JBSbatACIFM121.OPD)));
							
							// 通信量情報(工事完了遅延)ファイル件数カウントアップ
							this.tushinInfoChienCnt++;
						}
						else
						{
							//再処理不可能
							assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][execute]再処理不可");
							
							// エラー設定値
							String[] msgParam = new String[]{"再処理不可:" + this.wkNinshoId };
							
							// 妥当性チェックエラー処理(エラーコード：AC_MSG_ACIFE051_E009)
							this.valiDateErr(mastMap, JACStrConst.WKPARA_AC_MSG_ACIFE051_E009, JPCBatchMessageConstant.EACB0340CW, msgParam);
						}
						
					}
				}
			}
			
			// 認証ID一致なしの場合、認証ID存在チェックエラー出力
			else
			{
				// エラー設定値
				String[] msgParam = new String[]{JBSbatKK_T_SVKEIUW_EOH_NET.TABLE_NAME, mastKey};
				
				// 妥当性チェックエラー処理(エラーコード：AC_MSG_ACIFE051_E007)
				this.valiDateErr(mastMap, JACStrConst.WKPARA_AC_MSG_ACIFE051_E007, JPCBatchMessageConstant.EACB0240CW, msgParam);
				assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][execute][ＤＢ未存在エラー：認証ＩＤ]");
			}

		}
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][execute]");
		return outputInItem;
	/**▲▲▲▲▲▲業務サービスの主処理を記述してください。▲▲▲▲▲▲*/
	}

	/**
	 * 業務サービス終了処理
	 * @throws Exception 業務サービス内で発生した例外全般。
	 */
	public void terminal() throws Exception
	{
	/**▼▼▼▼▼▼業務サービスの終了処理を記述してください。▼▼▼▼▼▼*/
		/**▼▼▼▼▼▼ツールから生成した終了処理のソースです 開始▼▼▼▼▼▼*/
		db_AC_M_JURYOPRC.close();
		db_KK_T_SVC_KEI.close();
		/**▲▲▲▲▲▲ツールから生成した終了処理のソースです 終了▲▲▲▲▲▲*/
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][terminal]");
		
		// 通信量情報件数(翌日取込分)ファイル書き込み
		JCCBatCommon.printBusinessFileUtil(this.tushinInfoCntFile, makeTushinCnt());
		
		// 通信量情報件数(翌日取込分)ファイル件数カウントアップ
		this.tushinInfoCntCnt++;
		
		// 請求先番号（FTTH）ファイル書き込み
		createOutputFile(this.seikyNoFile , this.seikyNoMap);

		// 請求先番号（FTTH・工事遅延）ファイル書き込み
		createOutputFile(this.seikyNoChienFile , this.seikyNoChienMap);

		// 再計算向請求先番号（FTTH）ファイル書き込み
		createOutputFile(this.seikyNoReCalFile , this.seikyNoReCalMap);

		// 再計算向請求先番号（FTTH・工事遅延）ファイル書き込み
		createOutputFile(this.seikyNoReCalCenFile , this.seikyNoReCalChienMap);

		// パラメータ取得部品クローズ
		this.paramUtil.close();
		
		// 料金スケジュール定義アクセス部品クローズ
		this.schdlUtil.close();
		
		// FTTH通信量エラーファイルクローズ
		JCCBatCommon.closeBusinessFileUtil(this.ftthTushinErrFile);
		
		// 通信量情報(翌日取込分)ファイルクローズ
		JCCBatCommon.closeBusinessFileUtil(this.tushinInfoFile);
		
		// 通信量情報件数(翌日取込分)ファイルクローズ
		JCCBatCommon.closeBusinessFileUtil(this.tushinInfoCntFile);
		
		// 通信量情報（法人分）CLARIS送信ファイルクローズ
		JCCBatCommon.closeBusinessFileUtil(this.tushinInfoHojinFile);
		
		// 通信量情報（工事遅延）ファイルクローズ
		JCCBatCommon.closeBusinessFileUtil(this.tushinInfoChienFile);
		
		// 請求先番号ファイルクローズ
		JCCBatCommon.closeBusinessFileUtil(this.seikyNoFile);
		
		// 請求先番号（工事遅延）ファイルクローズ
		JCCBatCommon.closeBusinessFileUtil(this.seikyNoChienFile);
		
		// 再計算向請求先番号ファイルクローズ
		JCCBatCommon.closeBusinessFileUtil(this.seikyNoReCalFile);
		
		// 再計算向請求先番号（工事遅延）ファイルクローズ
		JCCBatCommon.closeBusinessFileUtil(this.seikyNoReCalCenFile);
		
		// 出力件数ログ出力
		String[] msgParam = new String[]{"FTTH通信量エラーファイル：" + this.ftthTushinPath, Integer.toString(this.ftthTushinErrCnt)};
		super.logPrint.printBusinessErrorLog(JPCBatchMessageConstant.EACB0780AI, msgParam);
		
		msgParam = new String[]{"通信量情報(翌日取込分)ファイル：" + this.outFileArray[1], Integer.toString(this.tushinInfoCnt)};
		super.logPrint.printBusinessErrorLog(JPCBatchMessageConstant.EACB0780AI, msgParam);
		
		msgParam = new String[]{"通信量情報件数(翌日取込分)ファイル：" + this.outFileArray[3], Integer.toString(this.tushinInfoCntCnt)};
		super.logPrint.printBusinessErrorLog(JPCBatchMessageConstant.EACB0780AI, msgParam);
		
		msgParam = new String[]{"通信量情報(法人分)CLARIS送信ファイル：" + this.outFileArray[7], Integer.toString(this.tushinInfoHojinCnt)};
		super.logPrint.printBusinessErrorLog(JPCBatchMessageConstant.EACB0780AI, msgParam);

		msgParam = new String[]{"通信量情報（工事遅延）ファイル：" + this.outFileArray[5], Integer.toString(this.tushinInfoChienCnt)};
		super.logPrint.printBusinessErrorLog(JPCBatchMessageConstant.EACB0780AI, msgParam);

		msgParam = new String[]{"請求先番号ファイル：" + this.outFileArray[9], Integer.toString(this.seikyNoCnt)};
		super.logPrint.printBusinessErrorLog(JPCBatchMessageConstant.EACB0780AI, msgParam);

		msgParam = new String[]{"請求先番号（工事遅延）ファイル：" + this.outFileArray[11], Integer.toString(this.seikyNoChienCnt)};
		super.logPrint.printBusinessErrorLog(JPCBatchMessageConstant.EACB0780AI, msgParam);

		msgParam = new String[]{"再計算向請求先番号ファイル：" + this.outFileArray[14], Integer.toString(this.seikyNoReCalCnt)};
		super.logPrint.printBusinessErrorLog(JPCBatchMessageConstant.EACB0780AI, msgParam);

		msgParam = new String[]{"再計算向請求先番号（工事遅延）ファイル：" + this.outFileArray[16], Integer.toString(this.seikyNoReCalChienCnt)};
		super.logPrint.printBusinessErrorLog(JPCBatchMessageConstant.EACB0780AI, msgParam);

		if (ftthTushinErrCnt != 0)	
		{	
			// 2016/05/30 OM-2016-0001231 Mod Start
			// インフォメーションフラグをtrueに設定
			commonItem.setInformationFlg(true);
			// 警告終了 「【警告】エラー対象レコード＝（%1%）」
//			super.logPrint.printBusinessErrorLog(JPCBatchMessageConstant.EACB0340CW, new String[] { Integer.toString(ftthTushinErrCnt) });
			super.logPrint.printBusinessErrorLog(JPCBatchMessageConstant.EACB1010CI, new String[] { Integer.toString(ftthTushinErrCnt) });
			// 2016/05/30 OM-2016-0001231 Mod End
		}	
			
		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(AC_SELECT_001)でDBアクセスを行います。<br>
	 * <p>
	 * <b>処理フロー</b><br>
	 * <pre>
	 * 1.引数でバイント変数を設定します。<br>
	 *
	 * 2.DBアクセスを実行します。<br>
	 * 
	 * 3.メソッドの呼び出し方です。<br>
	 *		引数:
	 *		param:順にバイント変数の値をparam配列に入れます。バイント変数は以下に説明します。
	 *		 	システムコード
	 *		 	従量料金適用開始年月日
	 *		 	従量料金適用終了年月日
	 * </pre>
	 * <p>
	 * @param param バイント変数の値配列。
	 * @throws Exception 業務サービス内で発生した例外全般。
	 */
	private void executeAC_M_JURYOPRC_AC_SELECT_001(Object[] param) throws Exception
	{
		// バイント変数のリストを生成します
		JBSbatCommonDBInterface paramList = new JBSbatCommonDBInterface();
		paramList.setValue(param[0].toString());
		paramList.setValue(param[1].toString());
		paramList.setValue(param[2].toString());

		// DBアクセスを実行します
		db_AC_M_JURYOPRC.selectBySqlDefine(paramList, AC_M_JURYOPRC_AC_SELECT_001);
	}

	/**
	 * SQLKEY(AC_SELECT_036)でDBアクセスを行います。<br>
	 * <p>
	 * <b>処理フロー</b><br>
	 * <pre>
	 * 1.引数でバイント変数を設定します。<br>
	 *
	 * 2.DBアクセスを実行します。<br>
	 * 
	 * 3.メソッドの呼び出し方です。<br>
	 *		引数:
	 *		param:順にバイント変数の値をparam配列に入れます。バイント変数は以下に説明します。
	 *		 	サービス契約番号
	 *		 	予約適用年月日
	 *		 	プラン課金開始年月日
	 *		 	プラン課金終了年月日
	 * </pre>
	 * <p>
	 * @param param バイント変数の値配列。
	 * @throws Exception 業務サービス内で発生した例外全般。
	 */
	private void executeKK_T_SVC_KEI_AC_SELECT_036(Object[] param) throws Exception
	{
		// バイント変数のリストを生成します
		JBSbatCommonDBInterface paramList = new JBSbatCommonDBInterface();
		paramList.setValue(param[0].toString());
		paramList.setValue(param[1].toString());
		paramList.setValue(param[2].toString());
		paramList.setValue(param[3].toString());

		// DBアクセスを実行します
		db_KK_T_SVC_KEI.selectBySqlDefine(paramList, KK_T_SVC_KEI_AC_SELECT_036);
	}
	/**▲▲▲▲▲▲ツールから生成したメソッドです 終了▲▲▲▲▲▲*/
	
	/**
	 * エラー内容マップ設定
	 * @throws Exception 業務サービス内で発生した例外全般。
	 */
	private void setErrMap() throws Exception
	{
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][setErrMap]");
		
		// エラー内容マップ作成
		// 必須項目エラー
		this.outErrMap.put(JACStrConst.WKPARA_AC_MSG_ACIFE051_E001, paramUtil.getGyoumuParameter(JACStrConst.WKPARA_AC_MSG_ACIFE051_E001));
		
		// データ取得日時エラー
		this.outErrMap.put(JACStrConst.WKPARA_AC_MSG_ACIFE051_E002, paramUtil.getGyoumuParameter(JACStrConst.WKPARA_AC_MSG_ACIFE051_E002));
		
		// 通信量数値エラー
		this.outErrMap.put(JACStrConst.WKPARA_AC_MSG_ACIFE051_E003, paramUtil.getGyoumuParameter(JACStrConst.WKPARA_AC_MSG_ACIFE051_E003));
		
		// IO-IPVPN
		this.outErrMap.put(JACStrConst.WKPARA_AC_MSG_ACIFE051_E004, paramUtil.getGyoumuParameter(JACStrConst.WKPARA_AC_MSG_ACIFE051_E004));
		
		// 翌日連携対象
		this.outErrMap.put(JACStrConst.WKPARA_AC_MSG_ACIFE051_E005, paramUtil.getGyoumuParameter(JACStrConst.WKPARA_AC_MSG_ACIFE051_E005));
		
		// ファイル内重複エラー
		this.outErrMap.put(JACStrConst.WKPARA_AC_MSG_ACIFE051_E006, paramUtil.getGyoumuParameter(JACStrConst.WKPARA_AC_MSG_ACIFE051_E006));
		
		// サービス契約番号取得エラー
		this.outErrMap.put(JACStrConst.WKPARA_AC_MSG_ACIFE051_E007, paramUtil.getGyoumuParameter(JACStrConst.WKPARA_AC_MSG_ACIFE051_E007));
		
		// 月次課金集計済エラー
		this.outErrMap.put(JACStrConst.WKPARA_AC_MSG_ACIFE051_E008, paramUtil.getGyoumuParameter(JACStrConst.WKPARA_AC_MSG_ACIFE051_E008));
		
		// 再処理不可
		this.outErrMap.put(JACStrConst.WKPARA_AC_MSG_ACIFE051_E009, paramUtil.getGyoumuParameter(JACStrConst.WKPARA_AC_MSG_ACIFE051_E009));
		
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][setErrMap]");
	}
	
	/**
	 * ファイル出力
	 * 
	 * @param  filePath  ファイルパス
	 * @param  fileDef   ファイル定義
	 * @param  linefeed  改行コード
	 * @return fileUtil  ファイルインスタンス
	 * @throws Exception 業務サービス内で発生した例外全般。
	 */
	private JBSbatBusinessFileUtil createFile(String filePath, String fileDef, String linefeed) throws Exception 
	{
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][createFile]");
		JBSbatOutputFileUtil trailerFile 	= new JBSbatOutputFileUtil(filePath);
		String tempFileDefName 				= JBSbatAplConst.getAplConstValue(PRM_OTD) + fileDef;
		JBSbatDefFileUtil trailerFileDef 	= new JBSbatDefFileUtil(tempFileDefName, trailerFile);
		
		// ファイルの生成
		JBSbatBusinessFileUtil fileUtil = JCCBatCommon.createBusinessFileUtil(filePath
																			, JACStrConst.KARA_MOJI
																			, linefeed
																			, trailerFileDef.getDelimiter());
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][createFile]");
		return fileUtil;
	}
	
	/**
	 * チェック用項目設定
	 * @param mastMap
	 * @throws Exception    業務サービス内で発生した例外全般。
	 */
	private void setCheckDate(JBSbatServiceInterfaceMap mastMap) throws Exception
	{
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][setCheckDate]");
		
		int dateLength 			= 12; 		// データ取得日時サイズ
		
		this.wkNinshoId 		= mastMap.getString(JBSbatACIFM121.NINSHO_ID); 		// 認証ID
		this.wkDateStkuDate 	= mastMap.getString(JBSbatACIFM121.DATA_STKU_DATE);	// データ取得日時(YYMMDDHHmmss)
		this.wkTushinryo 		= mastMap.getString(JBSbatACIFM121.TUSHINRYO); 		// 通信量
		this.wkOpd 				= mastMap.getString(JBSbatACIFM121.OPD); 			// 運用日
		
		// データ取得日時のサイズが12桁の場合
		if(dateLength == mastMap.getString(JBSbatACIFM121.DATA_STKU_DATE).length())
		{
			StringBuffer tempYmd = new StringBuffer();
			tempYmd.append(this.dateStkuYY); // 年月日上2桁
			tempYmd.append(mastMap.getString(JBSbatACIFM121.DATA_STKU_DATE).substring(0, 6));
			this.dateYmd = tempYmd.toString(); // データ取得年月日(YYYYMMDD)
			this.dateHms = mastMap.getString(JBSbatACIFM121.DATA_STKU_DATE).substring(6, 12); // データ取得時分秒(HHmmss)
		}
		else
		{
			this.dateYmd = mastMap.getString(JBSbatACIFM121.DATA_STKU_DATE);
			this.dateHms = mastMap.getString(JBSbatACIFM121.DATA_STKU_DATE);
		}
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][setCheckDate]");
	}
	
	/**
	 * 入力データチェック処理
	 * @param  mastMap      通信量情報
	 * @param  tranMap      契約ＤＢデータ
	 * @param  matchFlg     契約ＤＢ一致フラグ
	 * @param  outputInItem 入力情報
	 * @return checkFlg     データチェックフラグ
	 * @throws Exception    業務サービス内で発生した例外全般。
	 */
	private boolean checkValidate(JBSbatServiceInterfaceMap mastMap, JBSbatOutputItem outputInItem) throws Exception
	{
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][checkValidate]");

		// 法人用認証ＩＤチェック
		if(this.wkNinshoId.startsWith(this.nisyidPrefixHjn))
		{
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][checkValidate][法人用認証ＩＤチェック対象：認証ID]");
			
			// 通信量情報（法人分）CLARIS送信ファイル書き込み
			JCCBatCommon.printBusinessFileUtil(this.tushinInfoHojinFile, this.maketushinInfoData(mastMap));
			
			// 通信量情報（法人分）CLARIS送信ファイル件数カウントアップ
			this.tushinInfoHojinCnt++;
			
			// 妥当性チェック終了
			return false;
		}
		
		// 必須項目チェック
		if(JACStrConst.KARA_MOJI.equals(this.wkNinshoId))
		{
			// エラー設定値
			String[] msgParam = new String[]{"認証ID"};
			
			// 妥当性チェックエラー処理(エラーコード：AC_MSG_ACIFE051_E001)
			this.valiDateErr(mastMap, JACStrConst.WKPARA_AC_MSG_ACIFE051_E001, JPCBatchMessageConstant.EACB0010TW, msgParam);
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][checkValidate][必須チェックエラー：認証ID]");
			return false;
		}
		if(JACStrConst.KARA_MOJI.equals(this.wkDateStkuDate))
		{
			// エラー設定値
			String[] msgParam = new String[]{"データ取得日時"};
			
			// 妥当性チェックエラー処理(エラーコード：AC_MSG_ACIFE051_E001)
			this.valiDateErr(mastMap, JACStrConst.WKPARA_AC_MSG_ACIFE051_E001, JPCBatchMessageConstant.EACB0010TW, msgParam);
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][checkValidate][必須チェックエラー：データ取得日時]");
			return false;
		}
		if(JACStrConst.KARA_MOJI.equals(this.changeNull2Value(this.wkTushinryo).trim()))
		{
			// エラー設定値
			String[] msgParam = new String[]{"通信量"};
			
			// 妥当性チェックエラー処理(エラーコード：AC_MSG_ACIFE051_E001)
			this.valiDateErr(mastMap, JACStrConst.WKPARA_AC_MSG_ACIFE051_E001, JPCBatchMessageConstant.EACB0010TW, msgParam);
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][checkValidate][必須チェックエラー：通信量]");
			return false;
		}
		
		// データ取得年月日の妥当性チェック
		if(!JBSbatDateUtil.checkDate(dateYmd, 8))
		{
			// エラー設定値
			String[] msgParam = new String[]{"データ取得年月日", dateYmd};
			
			// 妥当性チェックエラー処理(エラーコード：AC_MSG_ACIFE051_E002)
			this.valiDateErr(mastMap, JACStrConst.WKPARA_AC_MSG_ACIFE051_E002, JPCBatchMessageConstant.EACB0090TW, msgParam);
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][checkValidate][日付チェックエラー：年月日]");
			return false;
		}
		
		// データ取得時分秒の妥当性チェック
		if(!JBSbatDateUtil.checkTime(this.dateHms + "000", 9))
		{
			// エラー設定値
			String[] msgParam = new String[]{"データ取得時間", dateHms};
			
			// 妥当性チェックエラー処理(エラーコード：AC_MSG_ACIFE051_E002)
			this.valiDateErr(mastMap, JACStrConst.WKPARA_AC_MSG_ACIFE051_E002, JPCBatchMessageConstant.EACB0070TW, msgParam);
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][checkValidate][日付チェックエラー：時分秒]");
			return false;
		}
		
		// 翌日連携対象チェック
		if(this.dateYmd.compareTo(super.onlineOpeDate) >= 0)
		{
			// エラー設定値
			String[] msgParam = new String[]{"データ取得年月日", dateYmd};
			
			// 妥当性チェックエラー処理(エラーコード：AC_MSG_ACIFE051_E005)
			this.valiDateErr(mastMap, JACStrConst.WKPARA_AC_MSG_ACIFE051_E005, JPCBatchMessageConstant.EACB0750NW, msgParam);
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][checkValidate]翌日連携対象チェックエラー：データ取得年月日]");
			
			// 通信量情報(翌日取込分)ファイル書き込み
			JCCBatCommon.printBusinessFileUtil(this.tushinInfoFile, this.maketushinInfoData(mastMap));
			
			// 通信量情報(翌日取込分)ファイル件数カウントアップ
			this.tushinInfoCnt++;
			
			// 妥当性チェック終了
			return false;
		}
		
		// 数値チェック(整数チェック)
		if(!JBSbatCheckUtil.invoke(this.wkTushinryo, new String[]{"hannkakusuuji1"}))
		{
			// エラー設定値
			String[] msgParam = new String[]{"通信量", wkTushinryo};
			
			// 妥当性チェックエラー処理(エラーコード：AC_MSG_ACIFE051_E003)
			this.valiDateErr(mastMap, JACStrConst.WKPARA_AC_MSG_ACIFE051_E003, JPCBatchMessageConstant.EACB0120TW, msgParam);
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][checkValidate][数値チェックエラー：通信量]");
			return false;
		}

		// 重複チェック
		// 入力チェックデータ
		StringBuffer inCheckdate = new StringBuffer();
		inCheckdate.append(this.wkNinshoId); 		// 認証ID
		inCheckdate.append(this.wkDateStkuDate); 	// データ取得日時
		
		// 入力チェック項目＝前回重複チェックデータの場合
		if(inCheckdate.toString().equals(this.prevCheckDate))
		{
			// エラー設定値
			String[] msgParam = new String[]{"認証ID＋データ取得日時", inCheckdate.toString()};
			
			// 妥当性チェックエラー処理(エラーコード：AC_MSG_ACIFE051_E006)
			valiDateErr(mastMap, JACStrConst.WKPARA_AC_MSG_ACIFE051_E006, JPCBatchMessageConstant.EACB0760NW, msgParam);
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][checkValidate]重複チェック：認証ID＋データ取得日時]");
			
			// 入力チェックデータを前回重複チェックデータに退避
			this.prevCheckDate = inCheckdate.toString();
			return false;
		}
		
		// 入力チェックデータを前回重複チェックデータに退避
		this.prevCheckDate = inCheckdate.toString();

		// 月次課金集計済チェック
		// データ取得年月日より請求年月を取得する（02：利用終了日）
		this.seikyYm 		= schdlUtil.getBillDate(this.dateYmd, JACStrConst.EVENT_CD_USE_ENDYMD);
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "データ取得年月日から取得した請求年月：" + this.seikyYm);
		
		// オンライン運用日より請求年月を取得する（03：料金計算日）
		String prvSeikyYm 		= schdlUtil.getBillDate(JPCUtilCommon.addDay(super.onlineOpeDate, -1), JACStrConst.EVENT_CD_RYOKIN_KEISAN_YMD);
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "オンライン運用日から取得した請求年月：" + prvSeikyYm);
		
		// オンライン運用日より請求年月　＞　データ取得年月日より請求年月
		if(this.seikyYm.compareTo(prvSeikyYm) < 0)
		{
			// エラー設定値
			String[] msgParam = new String[]{"月次課金集計済:" + this.wkNinshoId };
			
			// 妥当性チェックエラー処理(エラーコード：AC_FTTH_TUSHIN_E0008)
			this.valiDateErr(mastMap, JACStrConst.WKPARA_AC_MSG_ACIFE051_E008, JPCBatchMessageConstant.EACB0340CW, msgParam);
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][checkValidate][月次課金集計済チェックエラー：認証ID]");
			return false;
		}
		
		// 認証IDチェック
		if(this.wkNinshoId.startsWith(this.nisyidPrefixP) || this.wkNinshoId.startsWith(this.nisyidPrefixR))
		{
			// 認証IDがPまたはr始まりであった場合、エラーとする
			// エラー設定値
			String[] msgParam = new String[]{wkNinshoId};
			
			// 妥当性チェックエラー処理(エラーコード：AC_FTTH_TUSHIN_E0004)
			this.valiDateErr(mastMap, JACStrConst.WKPARA_AC_MSG_ACIFE051_E004, JPCBatchMessageConstant.EACB0740TW, msgParam);
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][checkValidate][認証IDチェックエラー：認証ID]");
			return false;
		}

		//工事遅延チェック
		if(this.checkKojiChien())
		{
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][checkValidate]工事遅延チェック");

			// 通信量情報(工事完了遅延)ファイル書き込み
			JCCBatCommon.printBusinessFileUtil(this.tushinInfoChienFile, this.maketushinInfoChienData(mastMap, JPCUtilCommon.addDay(super.onlineOpeDate, -1)));
			
			// 通信量情報(工事完了遅延)ファイル件数カウントアップ
			this.tushinInfoChienCnt++;
			return false;
		}

		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][checkValidate]");
		return true;
	}

	/**
	 * 妥当性チェックエラー処理
	 * @param  mastMap   入力電文
	 * @param  errCd     エラーコード
	 * @param  msgCd     メッセージコード
	 * @param  msgParam  エラーメッセージ設定値
	 * @throws Exception 業務サービス内で発生した例外全般。
	 */
	private void valiDateErr(JBSbatServiceInterfaceMap mastMap, String errCd, String msgCd, String[] msgParam) throws Exception
	{
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][valiDateErr]");
		
		// ファイル書き込み
		JCCBatCommon.printBusinessFileUtil(ftthTushinErrFile, makeErrData(mastMap, errCd));
		
		// エラーログ出力
		super.logPrint.printBusinessErrorLog(msgCd, msgParam);
		
		// FTTH通信量エラーファイル出力カウントアップ
		this.ftthTushinErrCnt++;
		
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][valiDateErr]");
	}

	/**
	 * FTTH通信量エラーファイル作成
	 * @param  mastMap     入力電文
	 * @param  errCd       エラーコード
	 * @return errDateList FTTH通信量エラー情報
	 * @throws Exception   業務サービス内で発生した例外全般。
	 */
	private ArrayList<Object> makeErrData(JBSbatServiceInterfaceMap mastMap, String errCd) throws Exception
	{
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][makeErrData]");
		
		// FTTH通信量エラー情報の生成
		ArrayList<Object> errDateList = new ArrayList<Object>();
		
		// FTTH通信量エラー情報に値を設定
		errDateList.add(makeStr(JACStrConst.DOUBLE_QUOTE, mastMap.getString(JBSbatACIFM121.NINSHO_ID), JACStrConst.DOUBLE_QUOTE)); 		// 認証ID
		errDateList.add(makeStr(JACStrConst.DOUBLE_QUOTE, mastMap.getString(JBSbatACIFM121.DATA_STKU_DATE), JACStrConst.DOUBLE_QUOTE)); // データ取得日時
		errDateList.add(makeStr(JACStrConst.DOUBLE_QUOTE, mastMap.getString(JBSbatACIFM121.TUSHINRYO), JACStrConst.DOUBLE_QUOTE)); 		// 通信量
		errDateList.add(makeStr(JACStrConst.DOUBLE_QUOTE, this.outErrMap.get(errCd), JACStrConst.DOUBLE_QUOTE)); 						// エラーコード
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][makeErrData]");

		return errDateList;
	}
	
	/**
	 * 文字を連結します
	 * @param string　文字
	 * @return strBuf　連結した文字列
	 */
	private String makeStr(String ...string)
	{
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][makeStr]");
		
		StringBuffer strBuf = new StringBuffer();
		for(String str:string)
		{
			strBuf.append(str);
		}
		assert strBuf != null ? JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][makeStr][strBuf = " + strBuf.toString() + "]") : true;
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][makeStr]");
		
		return strBuf.toString();
	}

	/**
	 * 通信量情報(翌日取込・法人分)ファイル作成
	 * @param  mastMap        入力電文
	 * @return tushinInfoList 通信量情報(翌日取込分)
	 * @throws Exception      業務サービス内で発生した例外全般。
	 */
	private ArrayList<Object> maketushinInfoData(JBSbatServiceInterfaceMap mastMap) throws Exception
	{
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][maketushinInfoData]");
		
		// 通信量情報(翌日取込・法人分)の生成
		ArrayList<Object> tushinInfoList = new ArrayList<Object>();
		
		// 通信量情報(翌日取込分)に値を設定
		tushinInfoList.add(mastMap.getString(JBSbatACIFM121.NINSHO_ID)); 		// 認証ID
		tushinInfoList.add(mastMap.getString(JBSbatACIFM121.DATA_STKU_DATE)); 	// データ取得日時
		tushinInfoList.add(mastMap.getString(JBSbatACIFM121.TUSHINRYO)); 		// 通信量

		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][maketushinInfoData]");
		return tushinInfoList;
	}

	/**
	 * 通信量情報（工事完了遅延）ファイル作成
	 * @param  mastMap        入力電文
	 * @param  opd            運用日
	 * @return tushinInfoList 通信量情報(工事完了遅延)
	 * @throws Exception      業務サービス内で発生した例外全般。
	 */
	private ArrayList<Object> maketushinInfoChienData(JBSbatServiceInterfaceMap mastMap, String opd) throws Exception
	{
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][maketushinInfoDataChien]");
		
		// 通信量情報(工事完了遅延)の生成
		ArrayList<Object> tushinInfoChienList = new ArrayList<Object>();
		
		// 通信量情報(工事完了遅延)に値を設定
		tushinInfoChienList.add(mastMap.getString(JBSbatACIFM121.NINSHO_ID)); 		// 認証ID
		tushinInfoChienList.add(mastMap.getString(JBSbatACIFM121.DATA_STKU_DATE)); 	// データ取得日時
		tushinInfoChienList.add(mastMap.getString(JBSbatACIFM121.TUSHINRYO)); 		// 通信量
		tushinInfoChienList.add(opd); 												// 運用日
		
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][maketushinInfoDataChien]");
		
		return tushinInfoChienList;
	}

	/**
	 * 通信量情報件数(翌日取込分)ファイル作成
	 * @return tushinCntList 通信量情報件数(翌日取込分)
	 * @throws Exception     業務サービス内で発生した例外全般。
	 */
	private ArrayList<Object> makeTushinCnt() throws Exception
	{
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][makeTushinCnt]");
		
		// 通信量情報件数(翌日取込分)の生成
		ArrayList<Object> tushinCntList = new ArrayList<Object>();
		
		// 通信量情報件数(翌日取込分)に値を設定
		tushinCntList.add(this.tushinInfoCnt); 	// 件数

		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][makeTushinCnt]");
		return tushinCntList;
	}
	
	/**
	 * FTTH通信量ファイル出力処理
	 * @param  dbMap      DB取得結果
	 * @param  mastMap    入力電文
	 * @param  dateYmd    データ取得年月日
	 * @return outInfoMap 集計対象請求年月情報
	 * @throws Exception  業務サービス内で発生した例外全般。
	 */
	private JBSbatServiceInterfaceMap makeFtthTushin(JBSbatServiceInterfaceMap mastMap) throws Exception
	{
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][makeFtthTushin]");
		
		JBSbatServiceInterfaceMap outInfoMap = new JBSbatServiceInterfaceMap();
		outInfoMap.set(JBSbatACIFM124.SVKEI_NO, 		this.svkeiuwEohNetInfo[0]); 				// サービス契約番号
		outInfoMap.set(JBSbatACIFM124.PCRS_CD, 			this.svkeiuwEohNetInfo[1]); 				// 料金コースコード
		outInfoMap.set(JBSbatACIFM124.PRC_SVC_CD, 		this.svkeiuwEohNetInfo[2]); 				// 料金サービスコード
		outInfoMap.set(JBSbatACIFM124.SEIKY_KEI_NO, 	this.svkeiuwEohNetInfo[3]); 				// 請求契約番号
		outInfoMap.set(JBSbatACIFM124.SEIKY_YM, 		this.seikyYm); 								// 請求年月
		outInfoMap.set(JBSbatACIFM124.NINSHO_ID, 		mastMap.get(JBSbatACIFM121.NINSHO_ID)); 	// 認証ID
		outInfoMap.set(JBSbatACIFM124.RIYOU_YM, 		this.dateYmd.substring(0, 6)); 				// 利用年月
		outInfoMap.set(JBSbatACIFM124.DATA_STKU_YMD, 	this.dateYmd); 								// データ取得年月日
		outInfoMap.set(JBSbatACIFM124.TUSHINRYO, 		mastMap.get(JBSbatACIFM121.TUSHINRYO)); 	// 利用通信量
		outInfoMap.set(JBSbatACIFM124.HOSEI_TUSHINRYO, 	JACStrConst.HOSEI_TUSHIN_ZERO); 			// 補正通信量
		outInfoMap.set(JBSbatACIFM124.CHRG_KH, 			JACStrConst.KAKIN_KA); 						// 課金可否
		outInfoMap.setOutFlg(true);
		
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][makeFtthTushin]");
		return outInfoMap;
	}
	
	/**
	 * FTTH通信量ファイル出力（プラン期間）処理
	 * @param  dbMap      DB取得結果
	 * @param  mastMap    入力電文
	 * @param  dateYmd    データ取得年月日
	 * @return outInfoMap 集計対象請求年月情報
	 * @throws Exception  業務サービス内で発生した例外全般。
	 */
	private JBSbatServiceInterfaceMap makeFtthTushinPlan(JBSbatServiceInterfaceMap mastMap, JBSbatServiceInterfaceMap tranMap, String chrgKh) throws Exception
	{
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][makeFtthTushinPlan]");
		
		JBSbatServiceInterfaceMap outInfoMap = new JBSbatServiceInterfaceMap();
		outInfoMap.set(JBSbatACIFM124.SVKEI_NO, 		tranMap.get(JBSbatACIFM190.SVC_KEI_NO)); 	// サービス契約番号
		outInfoMap.set(JBSbatACIFM124.PCRS_CD, 			tranMap.get(JBSbatACIFM190.PCRS_CD)); 		// 料金コースコード
		outInfoMap.set(JBSbatACIFM124.PRC_SVC_CD, 		tranMap.get(JBSbatACIFM190.PPLAN_CD)); 		// 料金サービスコード
		outInfoMap.set(JBSbatACIFM124.SEIKY_KEI_NO, 	tranMap.get(JBSbatACIFM190.SEIKY_KEI_NO)); 	// 請求契約番号
		outInfoMap.set(JBSbatACIFM124.SEIKY_YM, 		this.seikyYm); 								// 請求年月
		outInfoMap.set(JBSbatACIFM124.NINSHO_ID, 		mastMap.get(JBSbatACIFM121.NINSHO_ID)); 	// 認証ID
		outInfoMap.set(JBSbatACIFM124.RIYOU_YM, 		this.dateYmd.substring(0, 6)); 				// 利用年月
		outInfoMap.set(JBSbatACIFM124.DATA_STKU_YMD, 	this.dateYmd); 								// データ取得年月日
		outInfoMap.set(JBSbatACIFM124.TUSHINRYO, 		mastMap.get(JBSbatACIFM121.TUSHINRYO)); 	// 利用通信量
		outInfoMap.set(JBSbatACIFM124.HOSEI_TUSHINRYO, 	JACStrConst.HOSEI_TUSHIN_ZERO); 			// 補正通信量
		outInfoMap.set(JBSbatACIFM124.CHRG_KH, 			chrgKh); 									// 課金可否
		outInfoMap.setOutFlg(true);
		
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][makeFtthTushinPlan]");
		return outInfoMap;
	}
	
	/**
	 * サービス契約内訳＜eo光ネット＞検索
	 * @return boolean    処理結果
	 * @throws Exception  業務サービス内で発生した例外全般
	 */
	private boolean checkKojiChien() throws Exception
	{
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][checkKojiChien]");
		
		// サービス課金開始年月日が設定されている場合、工事完了とする
		if(!JACStrConst.KARA_MOJI.equals(this.wkSvcChrgStaYmd))
		{
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][checkKojiChien]工事完了]");
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][checkKojiChien]");

			return false;
		}
		else
		{
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][checkKojiChien]工事完了遅延]");
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][checkKojiChien]");

			return true;
		}
	}
	
	/**
	 * ファイル出力
	 * 
	 * @param fileUtil 出力ファイル
	 * @param hashSet 出力ファイル項目値
	 * @throws Exception
	 */
	private void createOutputFile(JBSbatBusinessFileUtil fileUtil , HashSet<String> hashSet) throws Exception 
	{
		Iterator<String> it = hashSet.iterator();
		
		// データ数分繰り返し
		while(it.hasNext())
		{
			// データを取得
			String data = it.next().toString() + ",,";
			
			// ファイルに書き込み
			JCCBatCommon.printBusinessFileUtil(fileUtil, data);
		}
		
		// ファイルを閉じる
		JCCBatCommon.closeBusinessFileUtil(fileUtil);
	}

	/**
	 * 請求先番号ファイル作成
	 * 
	 * @param outMap 編集元請求先番号ファイル
	 * @param argSeikyYm 請求年月
	 * @param seikyKeiNo 請求契約番号
	 * @param svcKeiNo サービス契約番号
	 * @return HashSet<String>    処理結果
	 * @throws Exception
	 */
	private HashSet<String> makeSeikyNoMap(HashSet<String> outMap, String argSeikyYm , String seikyKeiNo , String svcKeiNo) throws Exception 
	{

			
		// キーを作成（重複除外用）
		String tmpKey = makeStr(argSeikyYm, ",",
								seikyKeiNo, ",",
								svcKeiNo);
		
		outMap.add(tmpKey);
		
		return outMap;
	}

	/**
	 * 従量料金情報検索（従量料金の取得）
	 * 検索結果でマップを作成する。
	 * @throws Exception
	 */
	private void makeJuryoPrcInfoMap() throws Exception
	{
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][makeJuryoPrcInfoMap]");
		
		JBSbatCommonDBInterface paramList = new JBSbatCommonDBInterface();
		
		paramList.setValue(super.systemCode);	// システムコード
//20130709 追加　FJ)OHTO　START
		paramList.setValue(this.wk_End);		// 請求年月末日
		paramList.setValue(this.wk_End);		// 請求年月末日

		//paramList.setValue(JPCUtilCommon.addDay(super.onlineOpeDate, -1));		// 従量料金適用開始年月日
		//paramList.setValue(JPCUtilCommon.addDay(super.onlineOpeDate, -1));		// 従量料金適用終了年月日
//20130709 追加　FJ)OHTO　END

		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][makeJuryoPrcInfoMap][paramList=" + paramList.getList().toString() + "]");
		
		// SQL実行
		executeAC_M_JURYOPRC_AC_SELECT_001(paramList.getList().toArray());
		
		// 取得結果取得
		JBSbatCommonDBInterface dbMap = db_AC_M_JURYOPRC.selectNext();
		juryoPrcMap = new HashSet<String>();
		if(dbMap == null)
		{
			// 取得できない場合はエラーとする
			throw new JBSbatBusinessException(JPCBatchMessageConstant.EACB0440CE,
					new String[] { JBSbatAC_M_JURYOPRC.TABLE_NAME });
		}
		while(dbMap != null)
		{
			// キー作成
			// 料金コースコード＋料金サービスコード
			String key = makeStr(dbMap.getString(JBSbatAC_M_JURYOPRC.PCRS_CD), 
					dbMap.getString(JBSbatAC_M_JURYOPRC.PRC_SVC_CD));
			
			// キー・取得した情報をマップに
			juryoPrcMap.add(key);

			// 次レコード取得
			dbMap = db_AC_M_JURYOPRC.selectNext(); 
		}
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][makeJuryoPrcInfoMap] 従量料金取得件数：" + juryoPrcMap.size());
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][makeJuryoPrcInfoMap]");
		return;
	}
	
	/**
	 * 引数の値がNULLの場合に空文字を返す。
	 * 
	 * @param value 変換対象文字列
	 * @return String 変換後文字列
	 * @throws Exception 業務サービス内で発生した例外全般
	 */
	private String changeNull2Value(String value) throws Exception 
	{
		if(value == null)
		{
			return(JACStrConst.KARA_MOJI);
		}
		
		return(value);
	}
	
	/**
	 * FTTH通信料の出力先を判断する。
	 * @return true：通常　false：工事遅延
	 * @throws Exception
	 */
	private boolean outpuFtthJudge() throws Exception
	{
		// サービス契約内訳＜eo光ネット＞取得
		//[0]:サービス契約番号
		//[1]:料金コースコード
		//[2]:料金プランコード
		//[3]:請求契約番号
		this.svkeiuwEohNetInfo = new String[]{
								this.wkSvcKeiNo
								, this.wkPcrsCd
								, this.wkPplanCd
								, this.wkSeikyKeiNo
								};

		//バッチ運用日を引数に料金計算日で取得した請求年月≦データ取得年月日を引数にして月末締めで取得した請求年月
		if(this.wk_SkyuYM.compareTo(this.seikyYm) <= 0)
		{
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][execute][出力先：FTTH通信量]");
			
			// 対象請求契約番号情報(FTTH)ファイル
			this.seikyNoMap = makeSeikyNoMap(this.seikyNoMap,
												this.seikyYm,
												this.svkeiuwEohNetInfo[3],
												this.svkeiuwEohNetInfo[0]);
			
			// 対象請求契約番号情報(FTTH)ファイル件数カウントアップ
			this.seikyNoCnt++;
			
			return true;
		}
		//バッチ運用日を引数に料金計算日で取得した請求年月＞データ取得年月日を引数にして月末締めで取得した請求年月
		else
		{
			assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][execute][出力先：FTTH通信量（工事完了遅延）]");

			// サービス契約内訳＜eo光ネット＞取得
			//[0]:サービス契約番号
			//[1]:料金コースコード
			//[2]:料金プランコード
			//[3]:請求契約番号
			this.svkeiuwEohNetInfo = new String[]{
									this.wkSvcKeiNo
									, this.wkPcrsCd
									, this.wkPplanCd
									, this.wkSeikyKeiNo
									};
			
			// 対象請求契約番号情報（FTTH・工事遅延）ファイル
			this.seikyNoChienMap = makeSeikyNoMap(this.seikyNoChienMap,
													this.seikyYm,
													this.svkeiuwEohNetInfo[3],
													this.svkeiuwEohNetInfo[0]);	
			
			// 対象請求契約番号情報(FTTH)ファイル件数カウントアップ
			this.seikyNoChienCnt++;
			
			String key = makeStr(this.svkeiuwEohNetInfo[1], JPCUtilCommon.fillHalfSpace(this.svkeiuwEohNetInfo[2], JACStrConst.PRC_SVC_CD_LENGTH, true));
			if (this.juryoPrcMap.contains(key))
			{
				// 再計算向請求先番号情報（FTTH・工事遅延）ファイル
				this.seikyNoReCalChienMap = makeSeikyNoMap(this.seikyNoReCalChienMap,
														this.seikyYm,
														this.svkeiuwEohNetInfo[3],
														this.svkeiuwEohNetInfo[0]);	
				
				// 再計算向請求先番号情報(FTTH)ファイル件数カウントアップ
				this.seikyNoReCalChienCnt++;
			}
			
			return false;
		}
	}

	/**
	 * 再計算向請求先番号ファイル対象の場合、出力する。
	 * @param pcrsCd 料金コースコード
	 * @param pcrsCd 料金プランコード
	 * @throws Exception
	 */
	private void outpuseikyNoReCalc(JBSbatServiceInterfaceMap tranMap) throws Exception
	{
		// 料金コースコード
		String pcrsCd = tranMap.getString(JBSbatACIFM190.PCRS_CD);
		// 料金コード
		String pplanCd = tranMap.getString(JBSbatACIFM190.PPLAN_CD);
		
		String key = makeStr(pcrsCd, JPCUtilCommon.fillHalfSpace(pplanCd, JACStrConst.PRC_SVC_CD_LENGTH, true));
		if (this.juryoPrcMap.contains(key))
		{
			// 再計算向請求先番号ファイル
			this.seikyNoReCalMap = makeSeikyNoMap(this.seikyNoReCalMap,
													this.seikyYm,
													this.svkeiuwEohNetInfo[3],
													this.svkeiuwEohNetInfo[0]);
			
			// 再計算向請求先番号ファイル件数カウントアップ
			this.seikyNoReCalCnt++;
		}
	}

//OM-2014-0001886 ADD STA
	/**
	 * サービス契約の過去履歴から課金期間に応じて料金プランを一意に特定する。
	 * @param inMap 入力map
	 * @param dateYmd データ取得年月日
	 * @return JBSbatServiceInterfaceMap 取得結果
	 * @throws Exception
	 */
	private JBSbatServiceInterfaceMap getSvcKeiRrk(JBSbatServiceInterfaceMap inMap, String dateYmd) throws Exception
	{
		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[S][getSvcKeiRrk]");
		
		JBSbatServiceInterfaceMap rtnMap = null;
		
		JBSbatCommonDBInterface paramList = new JBSbatCommonDBInterface();
		
		paramList.setValue(inMap.get(JBSbatACIFM190.SVC_KEI_NO));	// サービス契約番号
		paramList.setValue(super.opeDate);							// バッチ運用日
		paramList.setValue(dateYmd);								// データ取得年月日
		paramList.setValue(dateYmd);								// データ取得年月日

		assert JACbatDebugLogUtil.printDebugLog(super.logPrint, "[L][getSvcKeiRrk][paramList=" + paramList.getList().toString() + "]");
		
		// SQL実行
		executeKK_T_SVC_KEI_AC_SELECT_036(paramList.getList().toArray());
		
		// 取得結果取得
		JBSbatCommonDBInterface dbMap = db_KK_T_SVC_KEI.selectNext();
		
		if(dbMap != null)
		{
			rtnMap = new JBSbatServiceInterfaceMap();
			rtnMap.set(JBSbatACIFM190.SVC_KEI_NO, dbMap.getString(JBSbatKK_T_SVC_KEI.SVC_KEI_NO));
			rtnMap.set(JBSbatACIFM190.PCRS_CD, dbMap.getString(JBSbatKK_T_SVC_KEI.PCRS_CD));
			rtnMap.set(JBSbatACIFM190.PPLAN_CD, dbMap.getString(JBSbatKK_T_SVC_KEI.PPLAN_CD));
			rtnMap.set(JBSbatACIFM190.SEIKY_KEI_NO, inMap.get(JBSbatACIFM190.SEIKY_KEI_NO));
		}
		
		assert 	JACbatDebugLogUtil.printDebugLog(super.logPrint, "[E][getSvcKeiRrk]");
		return rtnMap;
	}
//OM-2014-0001886 ADD END
}
