/*********************************************************************
 *	All Rights reserved,Copyright (c) K-Opticom
 **********************************************************************
 *＜プログラム内容＞
 *   システム名      ：eo顧客基幹システム
 *   モジュール名    ：JCHNyukinClMappingCC
 *   ソースファイル名：JCHNyukinClMappingCC.java
 *   作成者          ：富士通
 *   日付            ：2012年03月07日
 *＜機能概要＞
 *   入金取消マッピングCC部品です。
 *＜修正履歴＞
 *	バージョン	修正日		修正者		修正内容
 *	v1.00.00	2012/03/07	富士通		新規作成
 *	v5.00.00	2014/08/13	富士通		【TG-2013-0000806】入金取消時の金庫登録処理を修正
 *	v5.00.01	2013/09/27	FJ) 林      【OM-2013-0002054/2457】入金登録リスト作成用に電子ファイル管理登録をするよう対応
 *	v5.00.02	2013/09/28	FJ)小野		【OM-2013-0002342】請求処理日を過ぎた場合、未納分に対する入金で請求内訳に対し入金分の減算や削除処理が実行されない。
 *	v6.00.00	2013/11/24	FJ)小野		【OM-2013-0003532】入金取消時の債権、債権内訳、請求テーブルの更新処理変更。
 *	v9.00.00	2014/09/08	FJ)古田		【OM-2013-0001880】入金取消時の充当情報取り消し判断データ（充当種別コード）取得
 *	v12.00.00	2015/03/04	FJ)桑島		【OM-2014-0003792】料金対応記録設定対応
 *	v12.00.01	2015/03/20	FJ)桑島		【OM-2014-0003792】料金対応記録設定対応　料金履歴表示対応
 *	v27.00.00	2016/10/14	FJ)岡田		【OM-2016-0002053】
 *	v68.00.00	2023/12/04  FJ)謝		【ANK-4475-00-00】インボイス対応 STEP2
 **********************************************************************/
package com.fujitsu.futurity.bp.custom.common;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;

import com.fujitsu.futurity.bp.custom.constant.JCHNyukinClMappingConstCC;
import com.fujitsu.futurity.bp.x21.bpm.db.SessionHandle;
import com.fujitsu.futurity.bp.x21.bpm.parameter.IRequestParameterReadWrite;
import com.fujitsu.futurity.bp.x21.cc.AbstractCommonComponent;

import eo.common.constant.JACStrConst;

/**
 * 入金取消より呼び出される入金取消マッピングCC部品です。
 * <p>
 * <BR>
 * 
 * @author 富士通
 */
public class JCHNyukinClMappingCC extends AbstractCommonComponent
{

	/**
	 * 充当一覧照会マップに指定されたリストを基に入金取消実行マップ形成を行います。 <br>
	 * 
	 * @param handle セッションハンドル
	 * @param param リクエストパラメータ
	 * @param fixedText サービスメッセージ
	 * @return リクエストパラメータ
	 * @throws Exception 例外が発生した場合
	 */
	@SuppressWarnings("unchecked")
	public IRequestParameterReadWrite nyukinClRunMapping(SessionHandle handle, IRequestParameterReadWrite param, String fixedText) throws Exception
	{
		ArrayList<HashMap<String, Object>> nyukinClList = new ArrayList<HashMap<String, Object>>();
		ArrayList<HashMap<String, Object>> jutoIcrnList = null;
		ArrayList<HashMap<String, Object>> ECH0201B010CBSMsg1List = null;
		HashMap<String, Object> parentMap = new HashMap<String, Object>();
		HashMap<String, Object> jutoInfo = new HashMap<String, Object>();
		HashMap<String, Object> cbsMsgList = new HashMap<String, Object>();

		// 充当一覧照会マップから充当一覧明細リスト取得
		HashMap<String, Object> inMap = (HashMap<String, Object>) param.getData(JCHNyukinClMappingConstCC.MAP_CC_ID_JUTO_ICRN);
		jutoIcrnList = (ArrayList<HashMap<String, Object>>) inMap.get(JCHNyukinClMappingConstCC.MAP_KEY_JUTO_ICRN_LIST);

		// 共通情報のマッピング詰め替え
		parentMap.put(JCHNyukinClMappingConstCC.MAP_KEY_FUNC_CD, inMap.get(JCHNyukinClMappingConstCC.MAP_KEY_NYUKIN_FUNC_CD));

		if (jutoIcrnList != null && jutoIcrnList.size() > 0)
		{
			// 消込額合計（消込額の総合計）
			BigDecimal kshkmAmntSum = BigDecimal.ZERO;

			for (int i = 0; i < jutoIcrnList.size(); i++)
			{
				jutoInfo = (HashMap<String, Object>) jutoIcrnList.get(i);
				HashMap<String, Object> childMap = null;

				if (nyukinClList.size() - 1 >= i)
				{
					childMap = (HashMap<String, Object>) nyukinClList.get(i);
				}
				else
				{
					childMap = new HashMap<String, Object>();
				}
				// 共通情報のマッピング詰め替え
				childMap.put(JCHNyukinClMappingConstCC.MAP_KEY_FUNC_CD, inMap.get(JCHNyukinClMappingConstCC.MAP_KEY_NYUKIN_FUNC_CD));

				// 充当一覧明細リスト.請求契約番号 → 入金取消実行マップ.請求契約番号
				if (jutoInfo != null)
				{
					childMap.put(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_KEI_NO, jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_KEI_NO));
				}
				// 充当一覧明細リスト.債権番号 → 入金取消実行マップ.債権番号
				if (jutoInfo != null)
				{
					childMap.put(JCHNyukinClMappingConstCC.MAP_KEY_SAIKEN_NO, jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_SAIKEN_NO));
				}
				// 充当一覧明細リスト.請求種別コード → 入金取消実行マップ.請求種別コード
				if (jutoInfo != null)
				{
					childMap.put(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_SBT_CD, jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_SBT_CD));
				}
				// 充当一覧明細リスト.債権ステータス → 入金取消実行マップ.債権ステータス
				if (jutoInfo != null)
				{
					childMap.put(JCHNyukinClMappingConstCC.MAP_KEY_SAIKEN_STAT, jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_SAIKEN_STAT));
				}
				// 充当一覧明細リスト.請求年月 → 入金取消実行マップ.請求年月
				if (jutoInfo != null)
				{
					childMap.put(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_YM, jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_YM));
				}
				// 充当一覧明細リスト.充当額 → 入金取消実行マップ.充当額
				if (jutoInfo != null)
				{
					childMap.put(JCHNyukinClMappingConstCC.MAP_KEY_JUTO_AMNT, jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_JUTO_AMNT));
				}
				// 充当一覧明細リスト.更新前債権更新年月日時分秒 → 入金取消実行マップ.更新前債権更新年月日時分秒
				if (jutoInfo != null)
				{
					childMap.put(JCHNyukinClMappingConstCC.MAP_KEY_SAIKEN_UPD_DTM, jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_SAIKEN_UPD_DTM));
				}
				// 充当一覧明細リスト.請求番号 → 入金取消実行マップ.請求番号
				if (jutoInfo != null)
				{
					childMap.put(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_NO, jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_NO));
				}

				//充当一覧明細リスト形成
				ECH0201B010CBSMsg1List = (ArrayList<HashMap<String, Object>>) jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_ECH0201B010CBSMSGLIST);
				if (ECH0201B010CBSMsg1List != null && ECH0201B010CBSMsg1List.size() > 0)
				{
					ArrayList<HashMap<String, Object>> jutoDtlList = new ArrayList<HashMap<String, Object>>();

					// 債権消込額合計（債権番号ごとの消込額の合計）
					BigDecimal kshkmAmntSaikenSum = BigDecimal.ZERO;

					for (int j = 0; j < ECH0201B010CBSMsg1List.size(); j++)
					{
						cbsMsgList = (HashMap<String, Object>) ECH0201B010CBSMsg1List.get(j);
						HashMap<String, Object> tmpMap = new HashMap<String, Object>();

						// 充当一覧明細リスト.充当番号 → 入金取消実行リスト.充当一覧明細リスト.充当番号
						if (cbsMsgList != null)
						{
							tmpMap.put(JCHNyukinClMappingConstCC.MAP_KEY_JUTO_NO, cbsMsgList.get(JCHNyukinClMappingConstCC.MAP_KEY_JUTO_NO));
						}
						// 充当一覧明細リスト.更新前入金更新年月日時分秒 → 入金取消実行リスト.充当一覧明細リスト.更新前入金更新年月日時分秒
						if (cbsMsgList != null)
						{
							tmpMap.put(JCHNyukinClMappingConstCC.MAP_KEY_NYUKIN_UPD_DTM, cbsMsgList.get(JCHNyukinClMappingConstCC.MAP_KEY_NYUKIN_UPD_DTM));
						}
						// 充当一覧明細リスト.入金番号 → 入金取消実行リスト.充当一覧明細リスト.入金番号
						if (cbsMsgList != null)
						{
							tmpMap.put(JCHNyukinClMappingConstCC.MAP_KEY_NYUKIN_NO, cbsMsgList.get(JCHNyukinClMappingConstCC.MAP_KEY_NYUKIN_NO));
						}
						// 充当一覧明細リスト.消込額 → 入金取消実行リスト.充当一覧明細リスト.消込額
						if (cbsMsgList != null)
						{
							String kshkmAmnt = (String)cbsMsgList.get(JCHNyukinClMappingConstCC.MAP_KEY_KSHKM_AMNT);
							tmpMap.put(JCHNyukinClMappingConstCC.MAP_KEY_KSHKM_AMNT, kshkmAmnt);

							// 債権消込額合計（債権番号ごとの消込額の合計）に加算
							kshkmAmntSaikenSum = kshkmAmntSaikenSum.add(new BigDecimal(kshkmAmnt));
						}
						// 充当一覧明細リスト.更新前充当更新年月日時分秒 → 入金取消実行リスト.充当一覧明細リスト.更新前充当更新年月日時分秒
						if (cbsMsgList != null)
						{
							tmpMap.put(JCHNyukinClMappingConstCC.MAP_KEY_JUTO_UPD_DTM, cbsMsgList.get(JCHNyukinClMappingConstCC.MAP_KEY_JUTO_UPD_DTM));
						}
						// 充当一覧明細リスト.金庫番号 → 入金取消実行リスト.充当一覧明細リスト.金庫番号
						if (cbsMsgList != null)
						{
							tmpMap.put(JCHNyukinClMappingConstCC.MAP_KEY_KNK_NO, cbsMsgList.get(JCHNyukinClMappingConstCC.MAP_KEY_KNK_NO));
						}
						
						// 充当一覧明細リスト.充当種別コード
						if (cbsMsgList != null)
						{
							tmpMap.put(JCHNyukinClMappingConstCC.MAP_KEY_JUTO_SBT_CD, cbsMsgList.get(JCHNyukinClMappingConstCC.MAP_KEY_JUTO_SBT_CD));
						}

						jutoDtlList.add(tmpMap);
					}

					childMap.put(JCHNyukinClMappingConstCC.MAP_KEY_ECH0201B010CBSMSGLIST, jutoDtlList);

					// 債権消込額合計（債権番号ごとの消込額の合計）をセット
					childMap.put(JCHNyukinClMappingConstCC.MAP_KEY_KSHKM_AMNT_SAIKEN_SUM, kshkmAmntSaikenSum.toString());

					// 消込額合計に加算
					kshkmAmntSum = kshkmAmntSum.add(kshkmAmntSaikenSum);
				}

				nyukinClList.add(childMap);
			}

			// 消込額合計をセット
			parentMap.put(JCHNyukinClMappingConstCC.MAP_KEY_KSHKM_AMNT_SUM, kshkmAmntSum.toString());
		}

		// 入金取消実行リスト格納
		parentMap.put(JCHNyukinClMappingConstCC.MAP_KEY_NYUKIN_CL_RUN_LIST, nyukinClList);

		param.setData(JCHNyukinClMappingConstCC.MAP_CC_ID_NYUKIN_CL_RUN, parentMap);

		return param;
	}

	/**
	 * 入金取消処理にて登録が必要な料金対応履歴のマップ形成を行います。 <br>
	 * 
	 * @param handle セッションハンドル
	 * @param param リクエストパラメータ
	 * @param fixedText サービスメッセージ
	 * @return リクエストパラメータ
	 * @throws Exception 例外が発生した場合
	 */
	@SuppressWarnings("unchecked")
	public IRequestParameterReadWrite prcTaioRirekiMapping(SessionHandle handle, IRequestParameterReadWrite param, String fixedText) throws Exception
	{
		HashMap<String, Object> prcTaioKirokTmpMap = (HashMap<String, Object>) param.getData(JCHNyukinClMappingConstCC.MAP_CC_ID_PRC_TAIO_KIROK_TMP);
		HashMap<String, Object> jutoIcrnMap = (HashMap<String, Object>) param.getData(JCHNyukinClMappingConstCC.MAP_CC_ID_JUTO_ICRN);
		ArrayList<HashMap<String, Object>> jutoIcrnList = (ArrayList<HashMap<String, Object>>) jutoIcrnMap.get(JCHNyukinClMappingConstCC.MAP_KEY_JUTO_ICRN_LIST);
		HashMap<String, Object> parentMap = new HashMap<String, Object>();
		ArrayList<HashMap<String, Object>> prcTaioList = new ArrayList<HashMap<String, Object>>();
		String tokusokuNo = (String) prcTaioKirokTmpMap.get(JCHNyukinClMappingConstCC.MAP_KEY_TOKUSOKU_NO);

		// 共通情報のマッピング詰め替え
		parentMap.put(JCHNyukinClMappingConstCC.MAP_KEY_FUNC_CD, prcTaioKirokTmpMap.get(JCHNyukinClMappingConstCC.MAP_KEY_FUNC_CD));

		// 充当一覧明細リストに応じた料金対応記録登録リスト形成
		prcTaioList = this.createPrcTaioListNyukinCl(prcTaioKirokTmpMap, jutoIcrnList, prcTaioList);

		if (tokusokuNo != null)
		{
			// 督促ステータス変更に伴う料金対応記録登録リスト形成
			prcTaioList = this.createPrcTaioListTokusokuHenko(prcTaioKirokTmpMap, prcTaioList);
		}

		// 料金対応記録登録リスト格納
		parentMap.put(JCHNyukinClMappingConstCC.MAP_KEY_PRC_TAIO_KIROK_LIST, prcTaioList);

		param.setData(JCHNyukinClMappingConstCC.MAP_CC_ID_PRC_TAIO_KIROK_ADD_RUN, parentMap);

		return param;
	}

	/**
	 * 充当一覧明細リストより料金対応履歴登録リストを作成し返却する。 <br>
	 * 
	 * @param prcTaioKirokTmpMap 料金対応履歴一時マップ
	 * @param jutoIcrnMap 充当一覧照会マップ
	 * @param prcTaioList 料金対応履歴登録リスト
	 * @return 料金対応履歴登録リスト
	 * @throws Exception 例外が発生した場合
	 */
	@SuppressWarnings("unchecked")
	private ArrayList<HashMap<String, Object>> createPrcTaioListNyukinCl(HashMap<String, Object> prcTaioKirokTmpMap,
			ArrayList<HashMap<String, Object>> jutoIcrnList, ArrayList<HashMap<String, Object>> prcTaioList) throws Exception
	{
		HashMap<String, Object> childMap_zuiji = new HashMap<String, Object>();
		HashMap<String, Object> childMap_zuijiigai = new HashMap<String, Object>();
		ArrayList<HashMap<String, Object>> ECH0201B010CBSMsg1List = null;
		HashMap<String, Object> jutoInfo = new HashMap<String, Object>();
		HashMap<String, Object> cbsMsgList = new HashMap<String, Object>();
		int kshkmAmntTotal = 0;
		String seikyYM = "";
		
		
		if (jutoIcrnList != null && jutoIcrnList.size() > 0)
		{
			//OM-2014-0003792 ADD START
			
			//随時入金の入金取消
			
			
			for (int i = 0; i < jutoIcrnList.size(); i++)
			{
				jutoInfo = (HashMap<String, Object>) jutoIcrnList.get(i);
				if((String)jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_SBT_CD) != null 
						&& JACStrConst.SIKYSHBTS_JUIJ_JNYUKIN.equals((String)jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_SBT_CD)))
				{	
					// 最新の請求年月の取得
					if (seikyYM.compareTo((String)jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_YM)) < 0 )
					{
						seikyYM =(String)jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_YM);
					}
				}

				// 入金取消金額の取得
				ECH0201B010CBSMsg1List = (ArrayList<HashMap<String, Object>>) jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_ECH0201B010CBSMSGLIST);
				for (int j = 0; j < ECH0201B010CBSMsg1List.size(); j++)
				{
					cbsMsgList = (HashMap<String, Object>) ECH0201B010CBSMsg1List.get(j);

					if (cbsMsgList != null)
					{

						String seikySbtCd = (String) cbsMsgList.get(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_SBT_CD);
						
						if(JACStrConst.SIKYSHBTS_JUIJ_JNYUKIN.equals(seikySbtCd))
						{
							if ((String) cbsMsgList.get(JCHNyukinClMappingConstCC.MAP_KEY_KSHKM_AMNT) != null
									&& !JACStrConst.KARA_MOJI.equals((String) cbsMsgList.get(JCHNyukinClMappingConstCC.MAP_KEY_KSHKM_AMNT)))
							{
								kshkmAmntTotal += Integer.parseInt((String) cbsMsgList.get(JCHNyukinClMappingConstCC.MAP_KEY_KSHKM_AMNT));
							}
						}
					}
				}
			}
			
			if(kshkmAmntTotal > 0)
			{
				// 料金対応ユーザＩＤ → 料金対応記録明細リスト.料金対応ユーザＩＤ
				childMap_zuiji.put("prc_taio_user_id", (String) prcTaioKirokTmpMap.get("prc_taio_user_id"));
				// 請求契約番号 → 料金対応記録明細リスト.請求契約番号
				childMap_zuiji.put("seiky_kei_no", (String) prcTaioKirokTmpMap.get("seiky_kei_no"));
				// 料金対応記録種別コード（：入金取消） → 料金対応記録明細リスト.料金対応記録種別コード
				childMap_zuiji.put("prc_taio_kirok_sbt_cd", JACStrConst.TKRK_SBT_NYUKIN_CL);
				// 料金対応記録種別詳細コード（：入金取消） → 料金対応記録明細リスト.料金対応記録種別詳細コード
				childMap_zuiji.put("prc_taio_kirok_sbt_dtl_cd", JACStrConst.TKRK_SBTD_ZUIJI_NYUKIN_CL);
				// タイトル → 料金対応記録明細リスト.タイトル
				childMap_zuiji.put("title", JACStrConst.ZUIJI_NYUKIN_CL);
				// 記事 → 料金対応記録明細リスト.記事
				childMap_zuiji.put("kiji", (String) prcTaioKirokTmpMap.get("kiji"));
				
				//OM-2014-0003792 ADD START 20150320
				// 空文字 → 料金対応記録明細リスト.記録対象年月
				//childMap_zuiji.put("kirok_tg_ym", seikyYM);
				childMap_zuiji.put("kirok_tg_ym", JACStrConst.KARA_MOJI);
				//OM-2014-0003792 ADD END 20150320
				// 対応履歴表示連動対象フラグ → 料金対応記録明細リスト.対応履歴表示連動対象フラグ
				childMap_zuiji.put("taiorrki_rendo_tg_flg", (String) prcTaioKirokTmpMap.get("taiorrki_rendo_tg_flg"));
				// 消込額合計 → 料金対応記録明細リスト.変更前金額
				childMap_zuiji.put("chg_bf_amnt", String.valueOf(kshkmAmntTotal));

				// 料金対応記録明細リストに追加
				prcTaioList.add(childMap_zuiji);
			}
			
			//随時入金以外の入金取消
			
			kshkmAmntTotal = 0;
			seikyYM = "";
			
			for (int i = 0; i < jutoIcrnList.size(); i++)
			{
				jutoInfo = (HashMap<String, Object>) jutoIcrnList.get(i);
				if((String)jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_SBT_CD) != null 
						&& !JACStrConst.SIKYSHBTS_JUIJ_JNYUKIN.equals((String)jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_SBT_CD)))
				{	
					// 最新の請求年月の取得
					if (seikyYM.compareTo((String)jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_YM)) < 0 )
					{
						seikyYM =(String)jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_YM);
					}
				}

				// 入金取消金額の取得
				ECH0201B010CBSMsg1List = (ArrayList<HashMap<String, Object>>) jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_ECH0201B010CBSMSGLIST);
				for (int j = 0; j < ECH0201B010CBSMsg1List.size(); j++)
				{
					cbsMsgList = (HashMap<String, Object>) ECH0201B010CBSMsg1List.get(j);

					if (cbsMsgList != null)
					{
						String seikySbtCd = (String) cbsMsgList.get(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_SBT_CD);
						
						if(!JACStrConst.SIKYSHBTS_JUIJ_JNYUKIN.equals(seikySbtCd))
						{
							if ((String) cbsMsgList.get(JCHNyukinClMappingConstCC.MAP_KEY_KSHKM_AMNT) != null
									&& !JACStrConst.KARA_MOJI.equals((String) cbsMsgList.get(JCHNyukinClMappingConstCC.MAP_KEY_KSHKM_AMNT)))
							{
								kshkmAmntTotal += Integer.parseInt((String) cbsMsgList.get(JCHNyukinClMappingConstCC.MAP_KEY_KSHKM_AMNT));
							}
						}
					}
				}
			}
			
			// v27.00.00 MOD START
			// if(kshkmAmntTotal > 0)
			if(kshkmAmntTotal >= 0)
			// v27.00.00 MOD END
			{
				// 料金対応ユーザＩＤ → 料金対応記録明細リスト.料金対応ユーザＩＤ
				childMap_zuijiigai.put("prc_taio_user_id", (String) prcTaioKirokTmpMap.get("prc_taio_user_id"));
				// 請求契約番号 → 料金対応記録明細リスト.請求契約番号
				childMap_zuijiigai.put("seiky_kei_no", (String) prcTaioKirokTmpMap.get("seiky_kei_no"));
				// 料金対応記録種別コード（：入金取消） → 料金対応記録明細リスト.料金対応記録種別コード
				childMap_zuijiigai.put("prc_taio_kirok_sbt_cd", JACStrConst.TKRK_SBT_NYUKIN_CL);
// ANK-4475-00-00 MOD START
//				// 料金対応記録種別詳細コード（：入金取消） → 料金対応記録明細リスト.料金対応記録種別詳細コード
//				childMap_zuijiigai.put("prc_taio_kirok_sbt_dtl_cd", JACStrConst.TKRK_SBTD_NYUKIN_CL);
				// 一括入金取消の場合
				if (JACStrConst.TKRK_SBTD_IKT_NYUKIN_CL.equals((String) prcTaioKirokTmpMap.get("prc_taio_kirok_dtl_bunrui_cd")))
				{
					// 料金対応記録種別詳細コード（：一括入金取消） → 料金対応記録明細リスト.料金対応記録種別詳細コード
					childMap_zuijiigai.put("prc_taio_kirok_sbt_dtl_cd", (String) prcTaioKirokTmpMap.get("prc_taio_kirok_dtl_bunrui_cd"));
				}
				else
				{
					// 料金対応記録種別詳細コード（：入金取消） → 料金対応記録明細リスト.料金対応記録種別詳細コード
					childMap_zuijiigai.put("prc_taio_kirok_sbt_dtl_cd", JACStrConst.TKRK_SBTD_NYUKIN_CL);
				}
// ANK-4475-00-00 MOD END
				// タイトル → 料金対応記録明細リスト.タイトル
				childMap_zuijiigai.put("title", (String) prcTaioKirokTmpMap.get("title"));
				// 記事 → 料金対応記録明細リスト.記事
				childMap_zuijiigai.put("kiji", (String) prcTaioKirokTmpMap.get("kiji"));
				// 空文字 → 料金対応記録明細リスト.記録対象年月
				childMap_zuijiigai.put("kirok_tg_ym", seikyYM);
				// 対応履歴表示連動対象フラグ → 料金対応記録明細リスト.対応履歴表示連動対象フラグ
				childMap_zuijiigai.put("taiorrki_rendo_tg_flg", (String) prcTaioKirokTmpMap.get("taiorrki_rendo_tg_flg"));
				// 消込額合計 → 料金対応記録明細リスト.変更前金額
				childMap_zuijiigai.put("chg_bf_amnt", String.valueOf(kshkmAmntTotal));
	
				// 料金対応記録明細リストに追加
				prcTaioList.add(childMap_zuijiigai);
				
			}
			
			
//			for (int i = 0; i < jutoIcrnList.size(); i++)
//			{
//				jutoInfo = (HashMap<String, Object>) jutoIcrnList.get(i);
//
//				// 最新の請求年月の取得
//				if (seikyYM.compareTo((String)jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_YM)) < 0 )
//				{
//					seikyYM =(String)jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_SEIKY_YM);
//				}
//
//				// 入金取消金額の取得
//				ECH0201B010CBSMsg1List = (ArrayList<HashMap<String, Object>>) jutoInfo.get(JCHNyukinClMappingConstCC.MAP_KEY_ECH0201B010CBSMSGLIST);
//				for (int j = 0; j < ECH0201B010CBSMsg1List.size(); j++)
//				{
//					cbsMsgList = (HashMap<String, Object>) ECH0201B010CBSMsg1List.get(j);
//
//					if (cbsMsgList != null)
//					{
//						if ((String) cbsMsgList.get(JCHNyukinClMappingConstCC.MAP_KEY_KSHKM_AMNT) != null
//								&& !JACStrConst.KARA_MOJI.equals((String) cbsMsgList.get(JCHNyukinClMappingConstCC.MAP_KEY_KSHKM_AMNT)))
//						{
//							kshkmAmntTotal += Integer.parseInt((String) cbsMsgList.get(JCHNyukinClMappingConstCC.MAP_KEY_KSHKM_AMNT));
//						}
//					}
//				}
//			}
//
//			// 料金対応ユーザＩＤ → 料金対応記録明細リスト.料金対応ユーザＩＤ
//			childMap.put("prc_taio_user_id", (String) prcTaioKirokTmpMap.get("prc_taio_user_id"));
//			// 請求契約番号 → 料金対応記録明細リスト.請求契約番号
//			childMap.put("seiky_kei_no", (String) prcTaioKirokTmpMap.get("seiky_kei_no"));
//			// 料金対応記録種別コード（：入金取消） → 料金対応記録明細リスト.料金対応記録種別コード
//			childMap.put("prc_taio_kirok_sbt_cd", JACStrConst.TKRK_SBT_NYUKIN_CL);
//			// 料金対応記録種別詳細コード（：入金取消） → 料金対応記録明細リスト.料金対応記録種別詳細コード
//			childMap.put("prc_taio_kirok_sbt_dtl_cd", JACStrConst.TKRK_SBTD_NYUKIN_CL);
//			// タイトル → 料金対応記録明細リスト.タイトル
//			childMap.put("title", (String) prcTaioKirokTmpMap.get("title"));
//			// 記事 → 料金対応記録明細リスト.記事
//			childMap.put("kiji", (String) prcTaioKirokTmpMap.get("kiji"));
//			// 空文字 → 料金対応記録明細リスト.記録対象年月
//			childMap.put("kirok_tg_ym", seikyYM);
//			// 対応履歴表示連動対象フラグ → 料金対応記録明細リスト.対応履歴表示連動対象フラグ
//			childMap.put("taiorrki_rendo_tg_flg", (String) prcTaioKirokTmpMap.get("taiorrki_rendo_tg_flg"));
//			// 消込額合計 → 料金対応記録明細リスト.変更前金額
//			childMap.put("chg_bf_amnt", String.valueOf(kshkmAmntTotal));
//
//			// 料金対応記録明細リストに追加
//			prcTaioList.add(childMap);
			
			//OM-2014-0003792 ADD END
			
		}
		
		return prcTaioList;
	}

	/**
	 * 督促ステータス変更に伴う料金対応履歴登録リストに追加して返却する。 <br>
	 * 
	 * @param taioKirokTmpMap 料金対応履歴一時マップ
	 * @param prcTaioList 料金対応履歴登録リスト
	 * @return 料金対応履歴登録リスト
	 * @throws Exception 例外が発生した場合
	 */
	private ArrayList<HashMap<String, Object>> createPrcTaioListTokusokuHenko(HashMap<String, Object> taioKirokTmpMap,
			ArrayList<HashMap<String, Object>> prcTaioList) throws Exception
	{
		HashMap<String, Object> childMap = new HashMap<String, Object>();

		// 料金対応ユーザＩＤ → 料金対応記録明細リスト.料金対応ユーザＩＤ
		childMap.put("prc_taio_user_id", (String) taioKirokTmpMap.get("prc_taio_user_id"));
		// 請求契約番号 → 料金対応記録明細リスト.請求契約番号
		childMap.put("seiky_kei_no", (String) taioKirokTmpMap.get("seiky_kei_no"));
		// 料金対応記録種別コード（：入金取消） → 料金対応記録明細リスト.料金対応記録種別コード
		childMap.put("prc_taio_kirok_sbt_cd", JACStrConst.TKRK_SBT_NYUKIN_CL);
		// 料金対応記録種別詳細コード（：督促ステータス変更） → 料金対応記録明細リスト.料金対応記録種別詳細コード
		childMap.put("prc_taio_kirok_sbt_dtl_cd", JACStrConst.TKRK_SBTD_TOKUSOKU_ST_CHG);
		// タイトル → 料金対応記録明細リスト.タイトル
		childMap.put("title", (String) taioKirokTmpMap.get("title"));
		// 記事 → 料金対応記録明細リスト.記事
		childMap.put("kiji", (String) taioKirokTmpMap.get("kiji"));
		// 空文字 → 料金対応記録明細リスト.記録対象年月
		childMap.put("kirok_tg_ym", JACStrConst.KARA_MOJI);
		// 督促番号 → 料金対応記録明細リスト.督促番号
		childMap.put("tokusoku_no", (String) taioKirokTmpMap.get("tokusoku_no"));
		// 対応履歴表示連動対象フラグ → 料金対応記録明細リスト.対応履歴表示連動対象フラグ
		childMap.put("taiorrki_rendo_tg_flg", (String) taioKirokTmpMap.get("taiorrki_rendo_tg_flg"));
		// 変更前コード種別コード → 料金対応記録明細リスト.変更前コード種別コード
		childMap.put("chg_bf_cd_sbt_cd", "CD00184");
		// 変更前コード区分 → 料金対応記録明細リスト.変更前コード区分
		childMap.put("chg_bf_cd_div", (String) taioKirokTmpMap.get("tokusoku_stat"));
		// 変更後コード種別コード → 料金対応記録明細リスト.変更後コード種別コード
		childMap.put("chg_af_cd_sbt_cd", "CD00184");
		// 督促ステータス（：督促保留） → 料金対応記録明細リスト.変更後コード区分
		childMap.put("chg_af_cd_div", JACStrConst.TOKUSOKU_STAT_BOGO);

		// 料金対応記録明細リストに追加
		prcTaioList.add(childMap);

		return prcTaioList;
	}
}
