# Business Logic — JBSbatKKCampaignIktAdd.setMskmParam() [66 LOC]

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

## 1. Role

### JBSbatKKCampaignIktAdd.setMskmParam()

The `setMskmParam` method constructs the complete parameter array for registering an application record into the `KK_T_MSKM` (Application Master) table within the K-Opticom customer base system. This is a batch-side service method responsible for assembling a fixed-layout 51-field `Object[]` that maps directly to the columns of the application master entity. The method acts as a **parameter builder** (following the builder pattern) — it does not contain any conditional branching, loops, or business-rule enforcement. Instead, it populates each position of the output array with either the caller-supplied application number (`mskmNo`), a system/operation timestamp, a constant code value, a value looked up from the service contract map (`svcKeiMap`), a superclass-inherited field, or `null` for fields not yet populated at registration time.

This method is called by `JBSbatKKCampaignIktAdd.execute()` (line 831), which passes the result directly into `executeKK_T_MSKM_PKINSERT` for persistence. Its role in the larger system is to serve as the data-mapping bridge between the in-memory service contract context and the physical application master table, ensuring every column position is correctly set before the CRUD insert executes. The Javadoc states: "申込-schema用のパラメータを設定します" (Sets parameters for application-schema registration).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setMskmParam(svcKeiMap, mskmNo)"])

    step1["Build setParam Object[]"]
    step2["F[0]: mskmNo - Application number"]
    step3["F[1]: JCCBatCommon.getSysDateTimeStamp() - Registration date/time"]
    step4["F[2]: JKKStrConst.CD00060_130 = \"130\" - Application status"]
    step5["F[3]: svcKeiMap.getString(SYSID) - SYSID"]
    step6["F[4]: JKKStrConst.MSKM_SBT_CD_WARIB_MSKM = \"00029\" - Application type code"]
    step7["F[5]: null - Application submission date"]
    step8["F[6]: JKKBatCommon.getOpeDateTimeStamp(commonItem) - Acceptance date/time"]
    step9["F[7]: null - Acceptance assigned user ID"]
    step10["F[8]: super.opeDate - Application date"]
    step11["F[9-22]: null - Various optional fields"]
    step12["F[23]: JKKStrConst.CD00760_04 = \"04\" - Consultation business application status ID"]
    step13["F[24-42]: null - Additional optional fields"]
    step14["F[43]: JCCBatCommon.getSysDateTimeStamp() - Registered date/time"]
    step15["F[44]: super.batchUserId - Registered operator account"]
    step16["F[45]: JCCBatCommon.getSysDateTimeStamp() - Updated date/time"]
    step17["F[46]: super.batchUserId - Updated operator account"]
    step18["F[47-49]: null - Delete date/time and operator"]
    step19["F[50]: JKBatConst.S_MK_FLG = \"0\" - Invalid flag"]
    step20["F[51-53]: super.opeDate, super.batchUserId - Registration operation fields"]
    step21["F[54-55]: null - Delete operation fields"]
    step22["Return setParam Object[]"]

    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 --> step19
    step19 --> step20
    step20 --> step21
    step21 --> step22
```

**Key constant values resolved:**

| Constant | Value | Business Meaning |
|----------|-------|-----------------|
| `JKKStrConst.CD00060_130` | `"130"` | Application status code |
| `JKKStrConst.MSKM_SBT_CD_WARIB_MSKM` | `"00029"` | Application type code — subcontracted application |
| `JKKStrConst.CD00760_04` | `"04"` | Consultation business application status ID |
| `JKKBatConst.S_MK_FLG` | `"0"` | Invalid flag — indicates active/valid record |

The method performs a **single linear pass** — every field of the 51-element `Object[]` is set exactly once with no conditional logic. This is a pure data-mapping operation.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `svcKeiMap` | `JBSbatCommonDBInterface` | Service contract data map — carries the service contract context, including the SYSID (system ID) used to link the application to its parent service contract record. This map is obtained from the parent service contract record queried before calling `setMskmParam`. |
| 2 | `mskmNo` | `String` | Application number — the unique identifier for the application master record being registered. This is the primary key value assigned to the `KK_T_MSKM` row. |

**Inherited instance fields read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `super.opeDate` | `String` | Operation date — inherited from the superclass, representing the current business processing date in `yyyyMMdd` format. Used for application date and registration/operation dates. |
| `super.batchUserId` | `String` | Batch user ID — inherited from the superclass, representing the batch job operator account ID. Used as the registered and updated operator account in audit fields. |
| `commonItem` | `JBSbatCommonItem` | Batch common item — inherited via `setCommonInfo()`, carries batch execution metadata including the operation datetime used for acceptance date/time stamping. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCBatCommon.getSysDateTimeStamp` | - | - | Calls `getSysDateTimeStamp()` to obtain the current system date/time stamp (used for registration date, update date, and registered date fields). Called 3 times. |
| R | `JKKBatCommon.getOpeDateTimeStamp` | - | - | Calls `getOpeDateTimeStamp(commonItem)` to obtain the operation date/time stamp from the batch common item (used for acceptance date/time field). |
| R | `JBSbatCommonDBInterface.getString` | - | - | Calls `svcKeiMap.getString(SYSID)` to retrieve the SYSID value from the service contract data map. SYSID = `"SYSID"` (from `JBSbatKK_T_SVC_KEI.SYSID`). |

**Note:** This method performs no direct Create/Read/Update/Delete database operations itself. It is a pure parameter-assembly method. The actual database insert is performed by the caller via `executeKK_T_MSKM_PKINSERT(setMskmParam(...))` which writes to the `KK_T_MSKM` (Application Master) table.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKCampaignIktAdd | `JBSbatKKCampaignIktAdd.execute()` -> `setMskmParam(svcKeiInfo, mskmNo)` -> `executeKK_T_MSKM_PKINSERT(setParam)` | `executeKK_T_MSKM_PKINSERT [C] KK_T_MSKM` |

**Call chain detail:**
- `JBSbatKKCampaignIktAdd.execute()` (line 831) calls `setMskmParam(svcKeiInfo, mskmNo)`, passing the service contract info map and application number.
- `setMskmParam` builds and returns the `Object[]` parameter array.
- The result is passed directly as the argument to `executeKK_T_MSKM_PKINSERT()`, which performs the actual database insert (Create) into the `KK_T_MSKM` (Application Master) table.

**Terminal operations from this method (read-only — no DB writes):**
- `JCCBatCommon.getSysDateTimeStamp` [R] — system date/time (3 calls)
- `JKKBatCommon.getOpeDateTimeStamp` [R] — operation date/time (1 call)
- `svcKeiMap.getString(SYSID)` [R] — SYSID lookup (1 call)

## 6. Per-Branch Detail Blocks

> This method contains **no conditional branches** (no if/else, switch, loops, or try/catch). It is a single linear block that constructs and returns an array.

**Block 1** — [PROCESS] `(Linear array construction)` (L2454)

> Build the 51-element `Object[]` parameter array for application master registration. Each position maps to a column in the `KK_T_MSKM` entity.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `mskmNo` | F[0] — Application number |
| 2 | CALL | `JCCBatCommon.getSysDateTimeStamp()` | F[1] — System date/time for registration timestamp [-> timestamp] |
| 3 | SET | `JKKStrConst.CD00060_130` | F[2] — Application status [-> CONSTANT: CD00060_130 = "130"] |
| 4 | CALL | `svcKeiMap.getString(JBSbatKK_T_SVC_KEI.SYSID)` | F[3] — SYSID from service contract map [-> "SYSID"] |
| 5 | SET | `JKKStrConst.MSKM_SBT_CD_WARIB_MSKM` | F[4] — Application type code [-> CONSTANT: MSKM_SBT_CD_WARIB_MSKM = "00029"] |
| 6 | SET | `null` | F[5] — Application submission date (not yet populated) |
| 7 | CALL | `JKKBatCommon.getOpeDateTimeStamp(commonItem)` | F[6] — Operation date/time for acceptance timestamp [-> from commonItem] |
| 8 | SET | `null` | F[7] — Acceptance assigned user ID |
| 9 | SET | `super.opeDate` | F[8] — Application date (inherited operation date) |
| 10 | SET | `null` | F[9] — Total business center acceptance number |
| 11 | SET | `null` | F[10] — Total business application contract code |
| 12 | SET | `null` | F[11] — Application contact phone number |
| 13 | SET | `null` | F[12] — Application executor type code |
| 14 | SET | `null` | F[13] — Customer request items |
| 15 | SET | `null` | F[14] — Phone contact preferred day-of-week code |
| 16 | SET | `null` | F[15] — Phone contact preferred time slot code |
| 17 | SET | `null` | F[16] — Home survey preferred day-of-week code |
| 18 | SET | `null` | F[17] — Home survey preferred time slot code |
| 19 | SET | `null` | F[18] — Application reservation date/time |
| 20 | SET | `null` | F[19] — Application reservation reason code |
| 21 | SET | `null` | F[20] — Application reservation cancellation date |
| 22 | SET | `null` | F[21] — Application return date |
| 23 | SET | `null` | F[22] — Application return reason code |
| 24 | SET | `null` | F[23] — Provisional application flag |
| 25 | SET | `null` | F[24] — Application content confirmation completion date |
| 26 | SET | `null` | F[25] — Application cancellation date |
| 27 | SET | `null` | F[26] — Application cancellation reason code |
| 28 | SET | `null` | F[27] — Application cancellation date |
| 29 | SET | `null` | F[28] — Referrer |
| 30 | SET | `null` | F[29] — Last screen ID |
| 31 | SET | `null` | F[30] — Application content approval application date |
| 32 | SET | `null` | F[31] — Application content approval date |
| 33 | SET | `null` | F[32] — Kansai Electric customer information consent flag |
| 34 | SET | `null` | F[33] — Agency store billing item code |
| 35 | SET | `null` | F[34] — Pre-survey contact items required |
| 36 | SET | `null` | F[35] — Pre-survey contact items |
| 37 | SET | `null` | F[36] — Service continuation type code |
| 38 | SET | `null` | F[37] — Antenna relay terminal optional flag |
| 39 | SET | `null` | F[38] — Return-in-progress application cancellation date/time |
| 40 | SET | `JKKStrConst.CD00760_04` | F[39] — Consultation business application status ID [-> CONSTANT: CD00760_04 = "04"] |
| 41 | SET | `null` | F[40] — Acceptance assigned person ID |
| 42 | SET | `null` | F[41] — Work request items linked |
| 43 | SET | `null` | F[42] — Application channel ID |
| 44 | SET | `null` | F[43] — Agency store application next available |
| 45 | CALL | `JCCBatCommon.getSysDateTimeStamp()` | F[44] — Registered date/time [-> timestamp] |
| 46 | SET | `super.batchUserId` | F[45] — Registered operator account (inherited batch user) |
| 47 | CALL | `JCCBatCommon.getSysDateTimeStamp()` | F[46] — Updated date/time [-> timestamp] |
| 48 | SET | `super.batchUserId` | F[47] — Updated operator account (inherited batch user) |
| 49 | SET | `null` | F[48] — Delete date/time |
| 50 | SET | `null` | F[49] — Delete operator account |
| 51 | SET | `JKKBatConst.S_MK_FLG` | F[50] — Invalid flag [-> CONSTANT: S_MK_FLG = "0"] |
| 52 | SET | `super.opeDate` | F[51] — Registration operation date (inherited operation date) |
| 53 | SET | `super.batchUserId` | F[52] — Registration processing ID (batch user) |
| 54 | SET | `super.opeDate` | F[53] — Update operation date (inherited operation date) |
| 55 | SET | `super.batchUserId` | F[54] — Update processing ID (batch user) |
| 56 | SET | `null` | F[55] — Delete operation date |
| 57 | SET | `null` | F[56] — Delete processing ID |
| 58 | RETURN | `return setParam;` | Return the 51-field parameter array to caller |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|-----------------|
| `mskmNo` | Field | Application number — unique identifier for a record in the application master table (KK_T_MSKM) |
| `svcKeiMap` | Field | Service contract data map — carries the service contract context information including SYSID, used to link the application to its parent service contract |
| SYSID | Field | System ID — internal unique identifier for a service contract record in the KK_T_SVC_KEI table |
| `KK_T_MSKM` | Table | Application Master table — stores the main application/registration records for service contracts in the K-Opticom system |
| `KK_T_SVC_KEI` | Table | Service Contract table — stores service contract header records; SYSID links applications to their service contract |
| CD00060_130 | Constant | Application status code = "130" — represents a specific status in the application lifecycle |
| MSKM_SBT_CD_WARIB_MSKM | Constant | Application type code = "00029" — indicates a subcontracted application type |
| CD00760_04 | Constant | Consultation business application status ID = "04" — identifies the status of a consultation business application |
| S_MK_FLG | Constant | Invalid flag = "0" — "0" means the record is valid/active; used for logical delete tracking |
| `commonItem` | Field | Batch common item — carries batch execution metadata including operation date/time |
| `super.opeDate` | Field | Operation date — inherited from superclass, current business date in yyyyMMdd format |
| `super.batchUserId` | Field | Batch user ID — inherited from superclass, identifies the batch job operator account for audit trail |
| JCCBatCommon | Class | Common batch utility class — provides system date/time stamp service (`getSysDateTimeStamp`) |
| JKKBatCommon | Class | K-Opticom batch common utility class — provides operation date/time stamp service (`getOpeDateTimeStamp`) |
| JBSbatKKCampaignIktAdd | Class | Campaign addition service — batch service for registering new campaign-related service contracts (Ikt = "contract" / 契約) |
| Object[] | Return type | Parameter array — fixed-layout array where each index maps to a column position in the KK_T_MSKM entity |
| executeKK_T_MSKM_PKINSERT | Method | Database insert method — performs the actual Create operation on the KK_T_MSKM table with the provided parameters |
| 申込 | Japanese | Application/Registration — refers to a customer service application or registration request |
| 電文 | Japanese | Message/报文 — data packet or parameter set in batch processing context |
| 受付 | Japanese | Acceptance — the receipt of an application by the business system |
| 登録 | Japanese | Registration — the act of inserting a record into a database table |
