# Business Logic — JBSbatKKCampaignIktAdd.setMskmDtlParam() [84 LOC]

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

## 1. Role

### JBSbatKKCampaignIktAdd.setMskmDtlParam()

This method is a **parameter assembler** (also known as a builder/adapter pattern) that maps a business-keyed `HashMap<String, String>` into a positionally-indexed `Object[]` array representing a complete row of data for the subscription detail table (`KK_T_MSKM_DTL`). It serves as the **data transformation layer** between the caller's semantic key-value map and the persistence layer's positional column order.

The subscription detail entity (`KK_T_MSKM_DTL`) tracks individual subscription line items within the K-Opticom customer base system. Each subscription detail record stores the core identifying fields (subscription detail number, subscription number, status), operational metadata (registration/update timestamps and operators), and a large set of optional fields for contact preferences, work appointment scheduling, campaign/cancellation information, and various operational flags.

This method implements a **positional mapping design pattern**: every field extracted from `paramMap` is placed at a specific array index that corresponds to the column order of the `KK_T_MSKM_DTL` database table. Most fields are populated from the input `paramMap`, while system-managed fields (timestamps, operator IDs, operation dates) are synthesized at call time using instance fields (`super.batchUserId`, `super.opeDate`) and the `JCCBatCommon.getSysDateTimeStamp()` utility. Many optional columns receive `null` as placeholders since the caller does not supply values for them in the standard registration flow.

The method has **no conditional branches** — it is a linear, deterministic assembly operation. Every invocation produces a 60-element `Object[]` regardless of input content. It is called by `insertMskmDtl()`, which first populates `paramMap` with the necessary subscription detail data, then invokes this method to produce the parameter array passed to the persistence call `executeKK_T_MSKM_DTL_PKINSERT`.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setMskmDtlParam(paramMap)"])
    STEP1["Extract 13 fields from paramMap by table column key"]
    STEP2["Initialize Object[] with 60 elements"]
    STEP3["Populate positional mapping: fields from paramMap"]
    STEP4["Populate system fields: getSysDateTimeStamp()"]
    STEP5["Populate instance fields: batchUserId, opeDate"]
    STEP6["Populate constant: JKKBatConst.S_MK_FLG = \\\"0\\\""]
    STEP7["Fill remaining with null for unused optional columns"]
    STEP8["Return Object[] as setParam"]

    START --> STEP1
    STEP1 --> STEP2
    STEP2 --> STEP3
    STEP3 --> STEP4
    STEP4 --> STEP5
    STEP5 --> STEP6
    STEP6 --> STEP7
    STEP7 --> STEP8
    STEP8 --> END(["Return setParam"])
```

**Constant Resolution:**
- `JKKBatConst.S_MK_FLG = "0"` — Invalid Flag (無効フラグ), a default deactivation flag for records, set to "0" (invalid/disabled) by default.

**Processing summary:**
1. The method iterates through the input `paramMap` 13 times to extract values by their table column key (e.g., `MSKM_DTL_NO`, `GENE_ADD_DTM`).
2. It constructs a 60-element `Object[]` array where each position corresponds to a column in the `KK_T_MSKM_DTL` table.
3. System-managed fields (registration timestamp, update timestamp) are obtained via `JCCBatCommon.getSysDateTimeStamp()`.
4. Instance fields (`super.batchUserId`, `super.opeDate`) provide the batch operator ID and operation date.
5. The invalid flag is set to `S_MK_FLG = "0"` (disabled/invalid by default).
6. All remaining optional columns (44 out of 60) are filled with `null` placeholders.
7. The fully assembled array is returned to the caller for persistence.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `paramMap` | `HashMap<String, String>` | Input message carrying the business data for a subscription detail record. Keys are table column identifiers (e.g., `MSKM_DTL_NO`, `GENE_ADD_DTM`, `MSKM_DTL_STAT`). The caller (`insertMskmDtl`) populates this map with values such as the subscription detail number, registration timestamp, subscription status code, subscription number, operation date, SYSID, and timestamp/date fields for follow-up tasks. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `super.batchUserId` | `String` | Batch process operator/user ID — identifies which batch job or operator performed the registration |
| `super.opeDate` | `String` | Operation date (YYYYMMDD format) — the business date for registration and update operations |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCBatCommon.getSysDateTimeStamp` | JCCBatCommon | - | Reads system date/time stamp as current server timestamp |


### Additional analysis of called methods within this method:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCBatCommon.getSysDateTimeStamp` | JCCBatCommon | - | Reads system date/time stamp (called twice: for registration timestamp and update timestamp columns) |

**Notes:** This method performs **no database operations directly**. It only reads data from the input `paramMap` (a HashMap in memory), reads system timestamps via `JCCBatCommon.getSysDateTimeStamp()`, and reads instance fields from the superclass. All actual persistence (INSERT) is performed by the caller `insertMskmDtl()` which invokes `executeKK_T_MSKM_DTL_PKINSERT(setMskmDtlParam(paramMap))`.

## 5. Dependency Trace

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

Direct callers found: 1 method.
Terminal operations from this method: `getSysDateTimeStamp` [R], `getSysDateTimeStamp` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKCampaignIktAdd | `insertMskmDtl(svcKeiMap, mskmNo, mskmDtlNo)` → `setMskmDtlParam(paramMap)` | `getSysDateTimeStamp` [R] - System timestamp |

**Call chain details:**
1. The batch processing service `JBSbatKKCampaignIktAdd.insertMskmDtl()` populates a `HashMap` with subscription detail business data (detail number, registration timestamp, status code, subscription number, operation date, SYSID), then calls `setMskmDtlParam(paramMap)` to assemble the positional array, which is then passed to `executeKK_T_MSKM_DTL_PKINSERT()` for persistence into the `KK_T_MSKM_DTL` table.

## 6. Per-Branch Detail Blocks

This method contains **no conditional branches** (no if/else, switch/case, loops). It is a single linear block that assembles a 60-element array.

---

**Block 1** — [LINEAR] `(paramMap → Object[] assembly)` (L2576)

> Extracts 13 business fields from the input map, fills system-managed fields (timestamps, operator ID, operation date), sets the default invalid flag, and fills 44 remaining optional columns with `null` placeholders.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `paramMap.get(JBSbatKK_T_MSKM_DTL.MSKM_DTL_NO)` → Array[0] // Subscription Detail Number (申込明細番号) |
| 2 | CALL | `paramMap.get(JBSbatKK_T_MSKM_DTL.GENE_ADD_DTM)` → Array[1] // Registration Timestamp (世代登録年月日時分秒) |
| 3 | CALL | `paramMap.get(JBSbatKK_T_MSKM_DTL.MSKM_DTL_STAT)` → Array[2] // Subscription Detail Status (申込明細ステータス) |
| 4 | CALL | `paramMap.get(JBSbatKK_T_MSKM_DTL.MSKM_NO)` → Array[3] // Subscription Number (申込番号) |
| 5 | SET | `null` → Array[4] // Order Document Number (申込書番号) — optional placeholder |
| 6 | SET | `null` → Array[5] // Order Detail Number (申込書明細番号) — optional placeholder |
| 7 | CALL | `paramMap.get(JBSbatKK_T_MSKM_DTL.MSKM_YMD)` → Array[6] // Subscription Date (申込年月日) |
| 8 | CALL | `paramMap.get(JBSbatKK_T_MSKM_DTL.SYSID)` → Array[7] // SYSID |
| 9 | SET | `null` → Array[8] // Web Acceptance Number (WEB受付番号) — optional placeholder |
| 10 | SET | `null` → Array[9] // Subscription Form Code (申込形態コード) — optional placeholder |
| 11 | SET | `null` → Array[10] // Subscription Detail Type Code (申込明細種別コード) — optional placeholder |
| 12 | SET | `null` → Array[11] // Contact Mobile Phone Number (連絡先携帯電話番号) — optional placeholder |
| 13 | SET | `null` → Array[12] // Contact Office Name (連絡先勤務先名) — optional placeholder |
| 14 | SET | `null` → Array[13] // Daytime Contact Phone Number (昼間連絡先電話番号) — optional placeholder |
| 15 | SET | `null` → Array[14] // New Subscription Type Code (新規種別コード) — optional placeholder |
| 16 | SET | `null` → Array[15] // Subscription Contract Code (申込契約コード) — optional placeholder |
| 17 | SET | `null` → Array[16] // Home Survey Request Period End Date (宅内調査希望アポ期限年月日) — optional placeholder |
| 18 | SET | `null` → Array[17] // Work Appointment Contact Designation Code (工事アポ連絡先指定コード) — optional placeholder |
| 19 | SET | `null` → Array[18] // Work Appointment Contact Phone Number (工事アポ連絡先電話番号) — optional placeholder |
| 20 | CALL | `paramMap.get(JBSbatKK_T_MSKM_DTL.RRK_JIKO_ADD_DTM)` → Array[19] // Contact Item Registration Timestamp (連絡事項登録年月日時分秒) |
| 21 | CALL | `paramMap.get(JBSbatKK_T_MSKM_DTL.MSKM_DTL_SHOSA_DTM)` → Array[20] // Subscription Detail Review Timestamp (申込明細照会年月日時分秒) |
| 22 | SET | `null` → Array[21] // Subscription Detail Review Cancellation Date (申込明細照会取消年月日) — optional placeholder |
| 23 | CALL | `paramMap.get(JBSbatKK_T_MSKM_DTL.KZKWRK_REQYMD)` → Array[22] // Follow-up Task Request Date (後続業務依頼年月日) |
| 24 | SET | `null` → Array[23] // Subscription Detail Cancel Date (申込明細キャンセル年月日) — optional placeholder |
| 25 | SET | `null` → Array[24] // Subscription Detail Cancel Reason Code (申込明細キャンセル理由コード) — optional placeholder |
| 26 | SET | `null` → Array[25] // Subscription Detail Cancel Reason Memo (申込明細キャンセル理由メモ) — optional placeholder |
| 27 | SET | `null` → Array[26] // Subscription Detail Cancel Completion Date (申込明細キャンセル取消年月日) — optional placeholder |
| 28 | SET | `null` → Array[27] // Contact Email Address (申込連絡先メールアドレス) — optional placeholder |
| 29 | SET | `null` → Array[28] // Work Progress Notification Email Address (工事進捗通知メールアドレス) — optional placeholder |
| 30 | CALL | `paramMap.get(JBSbatKK_T_MSKM_DTL.RRK_JIKO)` → Array[29] // Contact Item (連絡事項) |
| 31 | SET | `null` → Array[30] // Latest Consultation Date (最新照会年月日) — optional placeholder |
| 32 | SET | `null` → Array[31] // Web Consultation Count (WEB照会回数) — optional placeholder |
| 33 | SET | `null` → Array[32] // PC Consultation Count (PC照会回数) — optional placeholder |
| 34 | SET | `null` → Array[33] // Mobile Consultation Count (携帯電話照会回数) — optional placeholder |
| 35 | SET | `null` → Array[34] // Work Progress Notification Mobile Email Address (工事進捗通知携帯電話メールアドレス) — optional placeholder |
| 36 | SET | `null` → Array[35] // Work Progress Notification PC Email Address Change Date (工事進捗通知PCメールアドレス変更年月日) — optional placeholder |
| 37 | SET | `null` → Array[36] // Work Progress Notification Mobile Email Address Change Date (工事進捗通知携帯電話メールアドレス変更年月日) — optional placeholder |
| 38 | SET | `null` → Array[37] // Progress Email Last Send Timestamp (進捗メール最終送信年月日時分秒) — optional placeholder |
| 39 | SET | `null` → Array[38] // Email Send Exclusion Flag (メール送信除外フラグ) — optional placeholder |
| 40 | SET | `null` → Array[39] // Email Send Exclusion Reason Memo (メール送信除外理由メモ) — optional placeholder |
| 41 | SET | `null` → Array[40] // Fan-po Subscription Contact Phone Number (番po申込連絡先電話番号) — optional placeholder |
| 42 | SET | `null` → Array[41] // Option Service Continuation Flag (オプションサービス引継有無) — optional placeholder |
| 43 | SET | `null` → Array[42] // Contract Document Dispatch Request Flag (解約書類送付希望有無) — optional placeholder |
| 44 | SET | `null` → Array[43] // Contact Method Supplementary Note (連絡手段補記) — optional placeholder |
| 45 | SET | `null` → Array[44] // New Building Code (新築物件コード) — optional placeholder |
| 46 | SET | `null` → Array[45] // Reactivation Case Flag (復活案件フラグ) — optional placeholder |
| 47 | SET | `null` → Array[46] // Same Equipment Re-Subscription Code (同一設備再申込コード) — optional placeholder |
| 48 | SET | `null` → Array[47] // Identity Confirmation Document Type Code (本人確認書類種別コード) — optional placeholder |
| 49 | SET | `null` → Array[48] // Identity Confirmation Document Name (本人確認書類名) — optional placeholder |
| 50 | SET | `null` → Array[49] // Order Document Type Code (申込書種別コード) — optional placeholder |
| 51 | SET | `null` → Array[50] // Contract Add-on Code (契約付加コード) — optional placeholder |
| 52 | SET | `null` → Array[51] // Map Attachment Flag (地図添付有無) — optional placeholder |
| 53 | SET | `null` → Array[52] // KCNSTB Subscription Count (KCNSTB申込台数) — optional placeholder |
| 54 | SET | `null` → Array[53] // KCNSTB Type Code (KCNSTB種類コード) — optional placeholder |
| 55 | SET | `null` → Array[54] // Mansion Facility System Link Remarks (マンション設備システム連携用備考欄) — optional placeholder |
| 56 | SET | `null` → Array[55] // Mansion ID (マンションID) — optional placeholder |
| 57 | SET | `null` → Array[56] // CAT-ID — optional placeholder |
| 58 | SET | `null` → Array[57] // Subscription Acceptance Type Code (申込受付種別コード) — optional placeholder |
| 59 | SET | `null` → Array[58] // Order Document Handling Info Responsible Person Name (申込書取扱事情担当者名) — optional placeholder |
| 60 | SET | `null` → Array[59] // Order Document Handling Info Phone Number (申込書取扱事情電話番号) — optional placeholder |
| 61 | CALL | `JCCBatCommon.getSysDateTimeStamp()` → Array[60] // Registration Timestamp (登録年月日時分秒) |
| 62 | CALL | `super.batchUserId` → Array[61] // Registration Operator Account (登録オペレーターアカウント) |
| 63 | CALL | `JCCBatCommon.getSysDateTimeStamp()` → Array[62] // Update Timestamp (更新年月日時分秒) |
| 64 | CALL | `super.batchUserId` → Array[63] // Update Operator Account (更新オペレーターアカウント) |
| 65 | SET | `null` → Array[64] // Deletion Timestamp (削除年月日時分秒) — optional placeholder |
| 66 | SET | `null` → Array[65] // Deletion Operator Account (削除オペレーターアカウント) — optional placeholder |
| 67 | CALL | `JKKBatConst.S_MK_FLG` (resolved: `"0"`) → Array[66] // Invalid Flag (無効フラグ) — default disabled |
| 68 | CALL | `super.opeDate` → Array[67] // Registration Operation Date (登録運用年月日) |
| 69 | CALL | `super.batchUserId` → Array[68] // Registration Process ID (登録処理ID) |
| 70 | CALL | `super.opeDate` → Array[69] // Update Operation Date (更新運用年月日) |
| 71 | CALL | `super.batchUserId` → Array[70] // Update Process ID (更新処理ID) |
| 72 | SET | `null` → Array[71] // Deletion Operation Date (削除運用年月日) — optional placeholder |
| 73 | RETURN | `return setParam;` // Return Object[] (マルチ機能ルート交換希望有無 placeholder at index 72) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `MSKM_DTL_NO` | Field | Subscription Detail Number — unique identifier for a subscription detail line item |
| `GENE_ADD_DTM` | Field | Registration Timestamp (Generation Registration Date/Time) — when this detail record was first created |
| `MSKM_DTL_STAT` | Field | Subscription Detail Status — current state of the subscription detail (e.g., "booking complete", "engineering dispatched", "follow-up task requested") |
| `MSKM_NO` | Field | Subscription Number — parent subscription record identifier |
| `MSKM_YMD` | Field | Subscription Date — the date of the subscription (YYYYMMDD format) |
| `SYSID` | Field | System ID — identifier for the system source of the subscription data |
| `RRK_JIKO_ADD_DTM` | Field | Contact Item Registration Timestamp — when contact-related notes were last added |
| `RRK_JIKO` | Field | Contact Item — notes or remarks about customer contact for this subscription |
| `MSKM_DTL_SHOSA_DTM` | Field | Subscription Detail Review Timestamp — when this detail was last reviewed/accessed |
| `KZKWRK_REQYMD` | Field | Follow-up Task Request Date — date a follow-up task was requested for this subscription |
| `S_MK_FLG` | Field | Invalid Flag — deactivation flag; `"0"` means disabled/invalid (default). Controlled by `JKKBatConst.S_MK_FLG` |
| `batchUserId` | Field | Batch Operator User ID — the user/account ID that executed this batch operation |
| `opeDate` | Field | Operation Date — the business date of the operation in YYYYMMDD format |
| KK_T_MSKM_DTL | Table | Subscription Detail Table — database table storing individual subscription line item records |
| 申込明細 | Business term | Subscription Detail — a detailed line item within a customer subscription, tracking its status, dates, and contact information |
| 申込 | Business term | Subscription / Order — customer service subscription in the K-Opticom system |
| 世代登録 | Business term | Generation Registration — first-time creation/insertion of a record in the system |
| 照会 | Business term | Review / Inquiry — access or review of a subscription record by staff |
| 後続業務依頼 | Business term | Follow-up Task Request — request for subsequent business processing after initial registration |
| 連絡事項 | Business term | Contact Item — notes or details about customer contact interactions |
| 無効フラグ | Business term | Invalid Flag — boolean flag indicating whether a record is active or deactivated |
| 登録 | Business term | Registration — create/insert operation for a record |
| 更新 | Business term | Update — modify operation for an existing record |
| 削除 | Business term | Delete — soft-delete or removal operation for a record |
| JCCBatCommon | Class | Common batch utility class providing system timestamp and batch processing utilities |
| JBSbatKKCampaignIktAdd | Class | Campaign inbound addition service — batch service for processing campaign-related subscription additions |
| insertMskmDtl | Method | Insert Subscription Detail — caller method that populates paramMap and invokes setMskmDtlParam for persistence |
| executeKK_T_MSKM_DTL_PKINSERT | Method | Primary Key Insert — persistence method that inserts a row into KK_T_MSKM_DTL table using the positional parameter array |
