# Business Logic — JBSbatKKCampaignIktAdd.setWribSvcKeiParam() [74 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKCampaignIktAdd` |
| Layer | Service (Batch) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKCampaignIktAdd.setWribSvcKeiParam()

This method constructs and returns a parameter array for registering a **discount service contract record** (割引サービス契約) into the billing/discount service schema table `KK_T_SVC_KEI`. It is a **parametric builder** — it receives pre-populated source maps and scalar values, then assembles a fixed-layout `Object[]` containing 53 fields in the exact order expected by the downstream CBS/SC layer that performs the INSERT into the discount service contract table.

The method handles a single service type: **discount service contracts** (wrink-svc-kei). It implements a **delegation pattern** — extracting data from incoming parameter maps (`cpIktAddMap`, `wrisvcTgSvcMap`, `svcKeiMap`), hard-coding several business constants (status, application code, instant-application flag, difference classification, registration timing), reading system timestamps, and pulling the batch operator user ID from the superclass. Most fields are set to `null` as placeholders for optional/deferred values that will be populated by later processing steps.

Within the larger batch processing flow, this method is called by `JBSbatKKCampaignIktAdd.execute()` and serves as a shared utility within the batch campaign processing module. It is invoked during campaign campaign-eligible customer extraction, producing the parameter set needed to register discount service contracts in the contract management system.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setWribSvcKeiParam(params)"])
    STEP1["Prepare Object[] setParam"]
    STEP2["Extract wribSvcKeiNo from parameter"]
    STEP3["Extract geneAddDtm from parameter"]
    STEP4["Set WRIB_SVC_KEI_STAT_UKETSUKE_ZUMI = 010"]
    STEP5["Extract SYSID from svcKeiMap"]
    STEP6["Extract WRIB_SVC_CD from wrisvcTgSvcMap"]
    STEP7["Set many null placeholder fields"]
    STEP8["Extract mskmDtlNo from parameter"]
    STEP9["Set super.opeDate for reservation effective date"]
    STEP10["Set RSV_APLY_CD_RSV_FIX = 2"]
    STEP11["Set IS_NOT_SOKUJI = 0"]
    STEP12["Extract APLY_MON from cpIktAddMap"]
    STEP13["Set super.opeDate for discount registration date"]
    STEP14["Call JCCBatCommon.getSysDateTimeStamp()"]
    STEP15["Set super.batchUserId as registration operator"]
    STEP16["Call JCCBatCommon.getSysDateTimeStamp() for update datetime"]
    STEP17["Set S_MK_FLG = 0 for invalid flag"]
    STEP18["Build complete Object[] with all 53 fields"]
    END_NODE(["Return Object[] setParam"])

    START --> STEP1
    STEP1 --> STEP2
    STEP2 --> STEP3
    STEP3 --> STEP4
    STEP4 --> STEP5
    STEP5 --> STEP6
    STEP6 --> STEP7
    STEP7 --> STEP8
    STEP8 --> STEP9
    STEP9 --> STEP10
    STEP10 --> STEP11
    STEP11 --> STEP12
    STEP12 --> STEP13
    STEP13 --> STEP14
    STEP14 --> STEP15
    STEP15 --> STEP16
    STEP16 --> STEP17
    STEP17 --> STEP18
    STEP18 --> END_NODE
```

This method has no conditional branches (no if/else, no switch/case). It performs a single sequential path: extracting values from input maps and parameters, inserting hardcoded constant values and null placeholders at specific positions, invoking system timestamp retrieval, and returning the fully assembled parameter array.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `cpIktAddMap` | `JBSbatServiceInterfaceMap` | Campaign input/electronic message map — contains campaign-specific input data including the discount charge start month specification code (`APLY_MON`) |
| 2 | `wrisvcTgSvcMap` | `JBSbatCommonDBInterface` | Discount service target service map — carries the discount service code (`WRIB_SVC_CD`) extracted from the contract management system |
| 3 | `svcKeiMap` | `JBSbatCommonDBInterface` | Service contract detail map — carries the system ID (`SYSID`) of the service contract line item being registered |
| 4 | `wribSvcKeiNo` | `String` | Discount service contract number — the unique identifier for the discount service contract record being registered |
| 5 | `mskmDtlNo` | `String` | Application detail number — the internal tracking ID for service contract line item applications (申請明細番号) |
| 6 | `geneAddDtm` | `String` | Generation registration date/time stamp — the timestamp when the parent record was originally created (世代登録年月日時分秒) |

**Instance fields read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `super.opeDate` | `String` | Operation date — the batch processing date used for reservation effective date, discount registration date, registration operation date, and update operation date fields |
| `super.batchUserId` | `String` | Batch operator user ID — identifies the batch process user for registration/processing ID and update processing ID audit fields |

## 4. CRUD Operations / Called Services

### Pre-computed evidence from code analysis graph:

| # | CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|---|------|----------|---------|-------------|----------------------|
| 1 | R | `JCCBatCommon.getSysDateTimeStamp` | JCCBatCommon | - | Retrieves the current system date/time stamp for the registration date/time field (7th element in array, 「登録年月日時分秒」) |
| 2 | R | `JCCBatCommon.getSysDateTimeStamp` | JCCBatCommon | - | Retrieves the current system date/time stamp for the update date/time field (7th from last, 「更新年月日時分秒」) |
| 3 | R | `svcKeiMap.getString(JBSbatKK_T_SVC_KEI.SYSID)` | - | - | Reads the SYSID from the service contract detail map — an internal system identifier for the service contract record |
| 4 | R | `wrisvcTgSvcMap.getString(JBSbatKK_M_WRIB_SVC.WRIB_SVC_CD)` | - | - | Reads the discount service code from the target service map — identifies which discount service type this contract belongs to |
| 5 | R | `cpIktAddMap.getString(JBSbatKKIFM579.APLY_MON)` | - | - | Reads the discount charge start month specification code from the campaign input map — specifies which month the discount charges should begin |

### Entity/Table Analysis:

The returned `Object[]` is designed for insertion into the **`KK_T_SVC_KEI`** table (discount service contract table). The field layout corresponds to the columns of this table, which tracks discount service contract records. This method is the **parameter preparation step** before the actual DB INSERT performed by the downstream CBS/SC.

| # | CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|---|------|----------|---------|-------------|----------------------|
| 1 | R | `JCCBatCommon.getSysDateTimeStamp` | JCCBatCommon | System timestamp | Called twice — once for registration date/time, once for update date/time — to populate audit columns in KK_T_SVC_KEI |

## 5. Dependency Trace

### Pre-computed evidence from code analysis graph:

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `getSysDateTimeStamp` [R], `getSysDateTimeStamp` [R], `getString` [R], `getString` [R], `getString` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKCampaignIktAdd | `execute()` → `setWribSvcKeiParam(cpIktAddMap, wrisvcTgSvcMap, svcKeiMap, wribSvcKeiNo, mskmDtlNo, geneAddDtm)` | `getSysDateTimeStamp [R] System`, `getString [R] JBSbatKK_T_SVC_KEI`, `getString [R] JBSbatKK_M_WRIB_SVC`, `getString [R] JBSbatKKIFM579` |

**Notes:**
- The caller `JBSbatKKCampaignIktAdd.execute()` is a batch processing method that orchestrates campaign-based contract additions.
- This method is a pure data builder with no side effects — it does not perform any writes itself. The resulting `Object[]` is consumed by the caller to invoke a CBS/SC that performs the actual database INSERT into `KK_T_SVC_KEI`.
- Terminal operations are all reads: system timestamp retrieval and string extraction from parameter maps.

## 6. Per-Branch Detail Blocks

> This method has no conditional branching — it is a single sequential processing path that assembles a fixed-layout parameter array.

**Block 1** — [ARRAY_INIT] (L2670)

> Creates the `Object[] setParam` array that holds all 53 fields for the discount service contract registration. Each element is extracted from parameters, hard-coded constants, or null placeholders.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[0] = wribSvcKeiNo` — Discount service contract number (割引サービス契約番号) |
| 2 | SET | `setParam[1] = geneAddDtm` — Generation registration date/time (世代登録年月日時分秒) |
| 3 | SET | `setParam[2] = JKKBatConst.WRIB_SVC_KEI_STAT_UKETSUKE_ZUMI` [-> "010"] — Discount service contract status: Order Received (割引サービス契約ステータス: 受注済) |
| 4 | SET | `setParam[3] = svcKeiMap.getString(JBSbatKK_T_SVC_KEI.SYSID)` — SYSID from service contract detail map |
| 5 | SET | `setParam[4] = wrisvcTgSvcMap.getString(JBSbatKK_M_WRIB_SVC.WRIB_SVC_CD)` — Discount service code (割引サービスコード) |
| 6 | SET | `setParam[5] = null` — Price code cost code (料金コストコード) |
| 7 | SET | `setParam[6] = null` — Price plan code (料金プランコード) |
| 8 | SET | `setParam[7] = null` — Service usage start desired date (サービス利用開始希望年月日) |
| 9 | SET | `setParam[8] = null` — Reservation effective start desired date (予約適用開始希望年月日) |
| 10 | SET | `setParam[9] = mskmDtlNo` — Application detail number (申請明細番号) |
| 11 | SET | `setParam[10] = null` — Reference date (参照年月日) |
| 12 | SET | `setParam[11] = null` — Reference cancellation date (参照取消年月日) |
| 13 | SET | `setParam[12] = super.opeDate` — Reservation effective date (予約適用年月日) |
| 14 | SET | `setParam[13] = null` — Reservation cancellation date (予約取消年月日) |
| 15 | SET | `setParam[14] = JKKBatConst.RSV_APLY_CD_RSV_FIX` [-> "2"] — Application code: Reservation Fixed (予約適用コード: 予約確定) |
| 16 | SET | `setParam[15] = JKKBatConst.IS_NOT_SOKUJI` [-> "0"] — Instant application flag: No (即時適用フラグ: なし) |
| 17 | SET | `setParam[16] = null` — Plan start date (プラン開始年月日) |
| 18 | SET | `setParam[17] = null` — Plan end date (プラン終了年月日) |
| 19 | SET | `setParam[18] = null` — Plan charge start date (プラン課金開始年月日) |
| 20 | SET | `setParam[19] = null` — Plan charge end date (プラン課金終了年月日) |
| 21 | SET | `setParam[20] = null` — Plan end type code (プラン終了種類コード) |
| 22 | SET | `setParam[21] = null` — Service cancel date (サービスキャンセル年月日) |
| 23 | SET | `setParam[22] = null` — Service cancel reason code (サービスキャンセル理由コード) |
| 24 | SET | `setParam[23] = null` — Service cancel reason memo (サービスキャンセル理由メモ) |
| 25 | SET | `setParam[24] = null` — Service cancel procedure completion flag (サービス取消手続き完了フラグ) |
| 26 | SET | `setParam[25] = null` — Restoration date (恢复年月日) |
| 27 | SET | `setParam[26] = null` — Service cancel withdrawal date (サービスキャンセル取消年月日) |
| 28 | SET | `setParam[27] = null` — Service cancel date (サービス解約年月日) |
| 29 | SET | `setParam[28] = null` — Charge start date correction existence (課金開始年月日修正有無) |
| 30 | SET | `setParam[29] = null` — Review result transmission code (審査結果送信コード) |
| 31 | SET | `setParam[30] = null` — Penalty occurrence code (違約金発生コード) |
| 32 | SET | `setParam[31] = JKKStrConst.CD00576_WRIB_INF_ADD` [-> "00049"] — Difference classification: Discount info addition (異動区分: 割引情報追加) |
| 33 | SET | `setParam[32] = null` — Reference cancel completion code (参照解約完了コード) |
| 34 | SET | `setParam[33] = null` — Contract conclusion date (契約締結年月日) |
| 35 | SET | `setParam[34] = null` — Group code (グループコード) |
| 36 | SET | `setParam[35] = null` — Introduction code (紹介コード) |
| 37 | SET | `setParam[36] = super.opeDate` — Application calculation date (申請計算年月日) |
| 38 | SET | `setParam[37] = JKKStrConst.CD00874_MAN_SET` [-> "2"] — Discount registration timing: Manual (割引登録時期コード: 手動設定) |
| 39 | SET | `setParam[38] = null` — Discount cancel timing code (割引解約時期タイミングコード) |
| 40 | SET | `setParam[39] = null` — Discount service contract auto-continue identification code (割引サービス契約自動継続識別コード) |
| 41 | SET | `setParam[40] = null` — Discount amount calculation base date (割引額算出基準年月日) |
| 42 | SET | `setParam[41] = cpIktAddMap.getString(JBSbatKKIFM579.APLY_MON)` — Discount charge start month specification code (割引課金開始月指定コード) |
| 43 | SET | `setParam[42] = super.opeDate` — Discount registration date (割引登録年月日) |
| 44 | SET | `setParam[43] = null` — Discount target contract service suspension date (割引対象契約サービス休止年月日) |
| 45 | SET | `setParam[44] = null` — Discount target contract service suspension removal date (割引対象契約サービス休止解除年月日) |
| 46 | SET | `setParam[45] = JCCBatCommon.getSysDateTimeStamp()` — Registration date/time stamp (登録年月日時分秒) |
| 47 | SET | `setParam[46] = super.batchUserId` — Registration operator account (登録オペレーターアカウント) |
| 48 | SET | `setParam[47] = JCCBatCommon.getSysDateTimeStamp()` — Update date/time stamp (更新年月日時分秒) |
| 49 | SET | `setParam[48] = super.batchUserId` — Update operator account (更新オペレーターアカウント) |
| 50 | SET | `setParam[49] = null` — Delete date/time stamp (削除年月日時分秒) |
| 51 | SET | `setParam[50] = null` — Delete operator account (削除オペレーターアカウント) |
| 52 | SET | `setParam[51] = JKKBatConst.S_MK_FLG` [-> "0"] — Invalid flag (無効フラグ) |
| 53 | SET | `setParam[52] = super.opeDate` — Registration operation date (登録運用年月日) |
| 54 | SET | `setParam[53] = super.batchUserId` — Registration processing ID (登録処理ID) |
| 55 | SET | `setParam[54] = super.opeDate` — Update operation date (更新運用年月日) |
| 56 | SET | `setParam[55] = super.batchUserId` — Update processing ID (更新処理ID) |
| 57 | SET | `setParam[56] = null` — Delete operation date (削除運用年月日) |
| 58 | SET | `setParam[57] = null` — Delete processing ID (削除処理ID) |

**Block 2** — [RETURN] (L2741)

> Returns the fully assembled parameter array to the caller for subsequent processing.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return setParam;` — Returns the 58-element Object[] for discount service contract registration |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `wribSvcKeiNo` | Field | Discount service contract number — unique identifier for a discount service contract line item |
| `geneAddDtm` | Field | Generation registration date/time stamp — when the parent record was originally created |
| `mskmDtlNo` | Field | Application detail number — internal tracking ID for service contract line item applications |
| `APLY_MON` | Field | Discount charge start month specification code — specifies which month discount charges should begin |
| `SYSID` | Field | System ID — internal system identifier for a service contract record in `KK_T_SVC_KEI` |
| `WRIB_SVC_CD` | Field | Discount service code — identifies the type of discount service associated with this contract |
| WRIB_SVC_KEI_STAT_UKETSUKE_ZUMI | Constant | Discount service contract status: Order Received (受注済) — value "010" |
| RSV_APLY_CD_RSV_FIX | Constant | Reservation application code: Reservation Fixed (予約確定) — value "2" |
| IS_NOT_SOKUJI | Constant | Instant application flag: No (即時適用フラグ) — value "0" means not instant application |
| CD00576_WRIB_INF_ADD | Constant | Difference classification: Discount info addition (異動区分: 割引情報追加) — value "00049" |
| CD00874_MAN_SET | Constant | Discount registration timing: Manual (割引登録時期コード: 手動設定) — value "2" |
| S_MK_FLG | Constant | Invalid flag (無効フラグ) — value "0" means the record is valid/active |
| KK_T_SVC_KEI | Table | Discount service contract table — stores discount service contract records |
| 割引サービス契約 | Business term | Discount service contract — a service contract line that includes a discount arrangement |
| 受注済 | Business term | Order received — initial status of a discount service contract after being ordered but not yet activated |
| 予約確定 | Business term | Reservation fixed — indicates the reservation has been confirmed/fixed for application |
| 即時適用 | Business term | Instant application — whether the discount applies immediately vs. at a future date |
| 異動区分 | Business term | Difference classification — categorizes the type of service change/registration (e.g., discount info addition) |
| 手動設定 | Business term | Manual setting — indicates the discount was manually registered vs. automatically |
| JBSbatKKCampaignIktAdd | Class | Campaign added service contract batch process — batch class handling campaign-based contract additions |
| JBSbatServiceInterfaceMap | Type | Service interface map — map-based data transfer object for campaign input messages |
| JBSbatCommonDBInterface | Type | Common database interface — interface for accessing database record data as key-value pairs |
