# Business Logic — JBSbatKKSyuKeiStabunKikiStaAdd.execute() [321 LOC]

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

## 1. Role

### JBSbatKKSyuKeiStabunKikiStaAdd.execute()

This method is the main processing entry point for the **Device Start Registration** batch workflow, which handles the post-delivery registration of device-related business events following customer premises equipment delivery. Specifically, it manages the lifecycle of devices provided as part of service contracts (machine-provided service contracts), processing the completion of device start registration, device changes, and option setup events.

The method implements a **delegation pattern** — it constructs input data, invokes a centralized Common Component (CC) service via `JCCBatchEsbInterface.invokeService` with the use-case ID `KKSV0758`, and then processes the returned data. The CC (`KKSV075801CC`) performs the core business validation and returns commitment contract information (`KAP_KEI_INF`) and progress registration data (`PRG_DATA`).

After receiving the CC response, the method branches into two major processing paths. If a commitment contract (discount contract) is in status `030` (signed/committed) without a billing start date set, it performs a primary key lookup on the commitment contract table (`KK_T_KAP_KEI`), and if a billing standard date exists, creates a new commitment contract record with the adjusted billing start month (one month ahead of the standard date). It then iterates over the returned progress registration list (`PRG_DATA.PRG_LIST`), mapping each `UPDATE_TYPE` value to a corresponding `prg_stat` code (progress status code), and inserts progress records via `insertPrg`.

The method is called by `JBSbatKKAdChgCstScreenKidou`, which orchestrates the entire address-change-related delayed batch processing pipeline.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execute_START"])
    START --> SETUP["Setup inputMaps and lists"]
    SETUP --> GET_INPUT["Get input fields from inMap"]
    GET_INPUT --> BUILD_MAP["Build syuKeiStabunKikiStaAddMap"]
    BUILD_MAP --> ADD_LIST["Add map to shkaFinJiKikiStaAddList"]
    ADD_LIST --> PUT_INPUT["Put data into inputMap"]
    PUT_INPUT --> PUT_OPEN["Put into inputMapOpn with KKSV075801CC key"]
    PUT_OPEN --> PARMAP["Build paramMap0665 with usecase and operation IDs"]
    PARMAP --> INVOKE["invokeService common call"]
    INVOKE --> CHECK_RETURN{Return code equals 0000?}
    CHECK_RETURN -- No --> ERROR["Log error and throw JBSbatBusinessError"]
    ERROR --> THROW(["throw JBSbatBusinessError"])
    CHECK_RETURN -- Yes --> GET_KAP["Get KAP_KEI_INF from output"]
    GET_KAP --> CHECK_KAP{KAP_KEI_INF not null?}
    CHECK_KAP -- No --> GET_PRG["Get PRG_DATA from output"]
    CHECK_KAP -- Yes --> GET_KAP_STAT["Get kap_kei_stat and kap_kei_chrg_staymd"]
    GET_KAP_STAT --> CHECK_TIKT{kap_kei_stat equals 030 AND kap_kei_chrg_staymd empty?}
    CHECK_TIKT -- No --> GET_PRG
    CHECK_TIKT -- Yes --> SELECT_PK["executeKK_T_KAP_KEI_PKSELECT"]
    SELECT_PK --> CHECK_DB{DB result not null?}
    CHECK_DB -- No --> GET_PRG
    CHECK_DB -- Yes --> GET_SYS["Get system date stamp"]
    GET_SYS --> GET_CHRG["Get kap_kei_chrg_stdrd_ymd from DB"]
    GET_CHRG --> CHECK_STD{chrg_stdrd_ymd empty?}
    CHECK_STD -- Yes --> GET_CC_STD["Get chrg_stdrd_ymd from CC response"]
    GET_CC_STD --> CHECK_STD2{chrg_stdrd_ymd not empty?}
    CHECK_STD -- No --> CHECK_STD2
    CHECK_STD2 -- No --> GET_PRG
    CHECK_STD2 -- Yes --> ADJUST["Adjust month by +1"]
    ADJUST --> BUILD_SET["Build 38-element setParam array"]
    BUILD_SET --> INSERT["executeKK_T_KAP_KEI_PKINSERT"]
    INSERT --> GET_PRG
    GET_PRG --> CHECK_PRG{prgDataMap null or empty?}
    CHECK_PRG -- Yes --> END_NIL(["return null"])
    CHECK_PRG -- No --> CHECK_PRG_LIST{prgList null or empty?}
    CHECK_PRG_LIST -- Yes --> END_NIL
    CHECK_PRG_LIST -- No --> LOOP_START["For each prgMap in prgList"]
    LOOP_START --> GET_UPDATE["Get update_type"]
    GET_UPDATE --> CHECK_TYPE{update_type valid?}
    CHECK_TYPE -- No --> LOOP_END{More items?}
    CHECK_TYPE -- Yes --> IF_11{update_type equals 11?}
    IF_11 -- Yes --> SET_3301["prg_stat = 3301"]
    IF_11 -- No --> IF_12{update_type equals 12 or 13?}
    IF_12 -- Yes --> SET_3302["prg_stat = 3302"]
    IF_12 -- No --> IF_90{update_type equals 90?}
    IF_90 -- Yes --> SET_5102["prg_stat = 5102"]
    SET_5102 --> GET_KIKI["Get kikiMsg and minKikiMsg"]
    GET_KIKI --> CALL_INSERT["insertPrg with 4 args"]
    CALL_INSERT --> SET_G001["prg_stat = G001"]
    SET_G001 --> CALL_INSERT2["insertPrg with 4 args again"]
    IF_90 -- No --> IF_130{update_type equals 130?}
    IF_130 -- Yes --> SET_5102B["prg_stat = 5102"]
    IF_130 -- No --> IF_140{update_type equals 140?}
    IF_140 -- Yes --> SET_H001["prg_stat = H001"]
    IF_140 -- No --> IF_150{update_type equals 150?}
    IF_150 -- Yes --> SET_3200["prg_stat = 3200"]
    IF_150 -- No --> IF_150_KKOP{update_type equals 150_KKOP?}
    IF_150_KKOP -- Yes --> SET_H001B["prg_stat = H001"]
    IF_150_KKOP -- No --> IF_150_TKNRT{update_type equals 150_TKNRT?}
    IF_150_TKNRT -- Yes --> SET_3200B["prg_stat = 3200"]
    IF_150_TKNRT -- No --> ELSE_UNKNOWN["return null"]
    SET_3301 --> GET_KIKI
    SET_3302 --> GET_KIKI
    SET_3200 --> GET_KIKI
    SET_3200B --> GET_KIKI
    SET_H001 --> GET_KIKI
    SET_H001B --> GET_KIKI
    SET_5102B --> GET_KIKI
    ELSE_UNKNOWN --> LOOP_END
    LOOP_END -- Yes --> LOOP_START
    LOOP_END -- No --> DEBUG_END["Print execute_END"]
    DEBUG_END --> RETURN_NULL(["return null"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatServiceInterfaceMap` | Input message carrying device start registration data. Contains the delivery number (`HAISO_NO`), machine-provided service contract number (`KKTK_SVC_KEI_NO`), device change number (`KIKI_CHG_NO`), indoor device model code (`TAKNKIKI_MODEL_CD`), and device serial number (`KIKI_SEIZO_NO`). These values uniquely identify a delivery event and the associated device hardware for the customer's service contract. |

**Instance fields / external state read:**

| # | Field | Source | Business Description |
|---|-------|--------|---------------------|
| 1 | `super.logPrint` | `JBSbatBusinessService` base class | Debug and business error logging utility used throughout processing |
| 2 | `super.commonItem` | `JBSbatBusinessService` base class | Common batch item context including job ID, user info, and batch configuration |
| 3 | `this` (executeKK_T_KAP_KEI_PKSELECT / executeKK_T_KAP_KEI_PKINSERT / insertPrg) | Same class | Calls internal DB operations on `KK_T_KAP_KEI` (commitment contract) and PRG (progress registration) tables |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JACBatCommon.printDebugLog` | JACBatCommon | - | Calls `printDebugLog` in `JACBatCommon` for debug logging |
| R | `JACbatDebugLogUtil.printDebugLog` | JACbatDebugLog | - | Calls `printDebugLog` in `JACbatDebugLogUtil` for debug logging |
| - | `JBSbatInterface.adjustMonth` | JBSbatInterface | - | Calls `adjustMonth` in `JBSbatInterface` to add one month to a date string |
| R | `JBSbatInterface.getSystemDateTimeStamp` | JBSbatInterface | - | Calls `getSystemDateTimeStamp` in `JBSbatInterface` to get current system timestamp |
| - | `JBSbatInterface.Rtrim` | JBSbatInterface | - | Calls `Rtrim` in `JBSbatInterface` for string right-trimming |
| - | `JCCBatchEsbInterface.invokeService` | JCCBatchEsb | - | Invokes the CC service `KKSV075801CC` with use-case `KKSV0758` and operation `KKSV0758OP` |
| - | `JCKLcsRenkeiUtil.printDebugLog` | JCKLcsRenkei | - | Calls `printDebugLog` in `JCKLcsRenkeiUtil` for debug logging |
| - | `JKKBatOneTimeLogWriter.printBusinessErrorLog` | JKKBatOneTimeLogWriter | - | Calls `printBusinessErrorLog` in `JKKBatOneTimeLogWriter` |
| - | `JKKHttpCommunicator.printBusinessErrorLog` | JKKHttpCommunicator | - | Calls `printBusinessErrorLog` in `JKKHttpCommunicator` |
| - | `JKKHttpCommunicator.printDebugLog` | JKKHttpCommunicator | - | Calls `printDebugLog` in `JKKHttpCommunicator` |
| R | `JBSbatFUCaseFileRnkData.getString` | JBSbatFUCaseFileRnkData | - | Calls `getString` in `JBSbatFUCaseFileRnkData` |
| R | `JBSbatFUMoveNaviData.getString` | JBSbatFUMoveNaviData | - | Calls `getString` in `JBSbatFUMoveNaviData` |
| - | `JBSbatKKCashPostAddMail.printDebugLog` | JBSbatKKCashPostAddMail | - | Calls `printDebugLog` in `JBSbatKKCashPostAddMail` |
| - | `JBSBatKKCrsChgIktAdd.invokeService` | JBSBatKKCrsChgIktAdd | - | Calls `invokeService` in `JBSBatKKCrsChgIktAdd` |
| - | `JBSbatKKCrsChgSmtVLAdd.invokeService` | JBSbatKKCrsChgSmtVLAdd | - | Calls `invokeService` in `JBSbatKKCrsChgSmtVLAdd` |
| - | `JBSbatKKCrsChgWribSette.invokeService` | JBSbatKKCrsChgWribSette | - | Calls `invokeService` in `JBSbatKKCrsChgWribSette` |
| - | `JBSbatKKEMoneyTktnIraiRnk.printBusinessErrorLog` | JBSbatKKEMoneyTktnIraiRnk | - | Calls `printBusinessErrorLog` in `JBSbatKKEMoneyTktnIraiRnk` |
| - | `JBSbatKKEMoneyTktnTkyoTchMailSksi.printBusinessErrorLog` | JBSbatKKEMoneyTktnTkyoTchMailSksi | - | Calls `printBusinessErrorLog` in `JBSbatKKEMoneyTktnTkyoTchMailSksi` |
| - | `JBSbatKKEponSwchKjInfSksi.invokeService` | JBSbatKKEponSwchKjInfSksi | - | Calls `invokeService` in `JBSbatKKEponSwchKjInfSksi` |
| - | `JBSbatKKKjFinDataInTrn.adjustMonth` | JBSbatKKKjFinDataInTrn | - | Calls `adjustMonth` in `JBSbatKKKjFinDataInTrn` |
| R | `JBSbatKK_T_KAP_KEI.getString` | JBSbatKK_T_KAP_KEI | KK_T_KAP_KEI | Calls `getString` on the commitment contract DB interface to retrieve KAP_KEI_NO and GENE_ADD_DTM |
| C | `JBSbatKKSyuKeiStabunKikiStaAdd.executeKK_T_KAP_KEI_PKINSERT` | JBSbatKKSyuKeiStabunKikiStaAdd | KK_T_KAP_KEI | Calls `executeKK_T_KAP_KEI_PKINSERT` to insert a new commitment contract record with 38 fields (V22.00.00 change: invalid flag set to `MK_FLG_YK = "0"`) |
| R | `JBSbatKKSyuKeiStabunKikiStaAdd.executeKK_T_KAP_KEI_PKSELECT` | JBSbatKKSyuKeiStabunKikiStaAdd | KK_T_KAP_KEI | Calls `executeKK_T_KAP_KEI_PKSELECT` to search commitment contract by primary key (KAP_KEI_NO, GENE_ADD_DTM) |
| C | `JBSbatKKSyuKeiStabunKikiStaAdd.insertPrg` | JBSbatKKSyuKeiStabunKikiStaAdd | PRG (progress registration) | Calls `insertPrg` with `kikiMsg`, `minKikiMsg`, `prg_stat`, and `update_type` parameters (v7.00.02 change: 4-arg overload) |
| - | `JBSbatKKTgOpSvcKeiUpdBase.adjustMonth` | JBSbatKKTgOpSvcKeiUpdBase | - | Calls `adjustMonth` in `JBSbatKKTgOpSvcKeiUpdBase` |
| - | `JBSbatKKTgOpSvcKeiUpd.adjustMonth` | JBSbatKKTgOpSvcKeiUpd | - | Calls `adjustMonth` in `JBSbatKKTgOpSvcKeiUpd` |
| - | `JBSbatKKTmcpSvcKeiStaAdd.adjustMonth` | JBSbatKKTmcpSvcKeiStaAdd | - | Calls `adjustMonth` in `JBSbatKKTmcpSvcKeiStaAdd` |
| R | `JBSbatZMAdDataSet.getString` | JBSbatZMAdDataSet | - | Calls `getString` in `JBSbatZMAdDataSet` |
| - | `JKKAdEditCC.substring` | JKKAdEditCC | - | Calls `substring` in `JKKAdEditCC` |
| - | `JKKAdEdit.substring` | JKKAdEdit | - | Calls `substring` in `JKKAdEdit` |
| - | `JKKTelnoInfoAddMapperCC.substring` | JKKTelnoInfoAddMapperCC | - | Calls `substring` in `JKKTelnoInfoAddMapperCC` |

**CRUD Summary:**
- **Create (2):** `executeKK_T_KAP_KEI_PKINSERT` — inserts a new commitment contract record; `insertPrg` — inserts progress registration records.
- **Read (3):** `executeKK_T_KAP_KEI_PKSELECT` — selects commitment contract by primary key; `JBSbatDateUtil.getSystemDateTimeStamp` — gets system timestamp; `JBSbatStringUtil.Rtrim` / `getString` — extracts data from DB/CC results.
- **No Update or Delete operations** directly performed in this method.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKAdChgCstScreenKidou | `JBSbatKKAdChgCstScreenKidou.execute` → creates `JBSbatKKSyuKeiStabunKikiStaAdd` instance → calls `JBSbatKKSyuKeiStabunKikiStaAdd.execute(inMap)` | `invokeService [R] KKSV075801CC`; `executeKK_T_KAP_KEI_PKSELECT [R] KK_T_KAP_KEI`; `executeKK_T_KAP_KEI_PKINSERT [C] KK_T_KAP_KEI`; `insertPrg [C] PRG` |

**Caller Details:**
- **JBSbatKKAdChgCstScreenKidou** — This is the Address Change Customer Move Mobile batch service. It orchestrates multiple sub-processes during address change processing, including this device start registration service. The instance is created in `initial()` and invoked within the main `execute()` loop that processes each address change record (`KK_T_ADCHG`).

## 6. Per-Branch Detail Blocks

**Block 1** — [INITIALIZATION] (L152)

> Initialize debug logging, input maps, and lists for processing device start registration.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inputMap = new HashMap<String, Object>()` // Map to pass data to CC |
| 2 | SET | `inputMapOpn = new HashMap<String, Object>()` // Map to call CC with CC title as key |
| 3 | SET | `shkaFinJiKikiStaAddList = new ArrayList<HashMap<String, Object>>()` // Device start detail info list |
| 4 | SET | `syuKeiStabunKikiStaAddMap = new HashMap<String, Object>()` // Device start map constructed as HashMap |
| 5 | EXEC | `super.logPrint.printDebugLog("execute_START")` // Debug log start marker |

**Block 2** — [IF] `(super.logPrint.chkLogLevel(JBSbatLogUtil.MODE_DEBUG))` (L174)

> Debug logging: logs key input fields for traceability — delivery number, service contract number, device change number, device model code, and device serial number.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `super.logPrint.printDebugLog("Main contract start device start info: delivery number[" + inMap.getString(JBSbatKKIFM216.HAISO_NO) + "]")` |
| 2 | EXEC | `super.logPrint.printDebugLog("Main contract start device start info: machine-provided service contract number[" + inMap.getString(JBSbatKKIFM216.KKTK_SVC_KEI_NO) + "]")` |
| 3 | EXEC | `super.logPrint.printDebugLog("Main contract start device start info: device change number[" + inMap.getString(JBSbatKKIFM216.KIKI_CHG_NO) + "]")` |
| 4 | EXEC | `super.logPrint.printDebugLog("Main contract start device start info: indoor device model code[" + inMap.getString(JBSbatKKIFM216.TAKNKIKI_MODEL_CD) + "]")` |
| 5 | EXEC | `super.logPrint.printDebugLog("Main contract start device start info: device serial number[" + inMap.getString(JBSbatKKIFM216.KIKI_SEIZO_NO) + "]")` |

**Block 3** — [SET] (L181-L197)

> Extract input values and build the device start map to be passed to the CC.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kktkSvcKeiNo = inMap.getString(JBSbatKKIFM216.KKTK_SVC_KEI_NO)` // Machine-provided service contract number |
| 2 | SET | `syuKeiStabunKikiStaAddMap.put("key_haiso_no", inMap.getString(JBSbatKKIFM216.HAISO_NO))` // Delivery number |
| 3 | SET | `syuKeiStabunKikiStaAddMap.put("kktk_svc_kei_no", kktkSvcKeiNo)` // Machine-provided service contract number |
| 4 | SET | `syuKeiStabunKikiStaAddMap.put("kiki_chg_no", inMap.getString(JBSbatKKIFM216.KIKI_CHG_NO))` // Device change number |
| 5 | SET | `syuKeiStabunKikiStaAddMap.put("taknkiki_model_cd", inMap.getString(JBSbatKKIFM216.TAKNKIKI_MODEL_CD))` // Indoor device model code |
| 6 | SET | `syuKeiStabunKikiStaAddMap.put("kiki_seizo_no", inMap.getString(JBSbatKKIFM216.KIKI_SEIZO_NO))` // Device serial number |
| 7 | EXEC | `shkaFinJiKikiStaAddList.add(syuKeiStabunKikiStaAddMap)` // Set device start map to delivery completion device start detail list |
| 8 | SET | `inputMap.put("syuKeiStabunJiKikiStaAddList", shkaFinJiKikiStaAddList)` // Set data into inputMap with list name as key |
| 9 | SET | `inputMapOpn.put("KKSV075801CC", inputMap)` // Set data into inputMapOpn with calling CC title name as key |

**Block 4** — [SET] (L201-L205)

> Build the parameter map for the service invocation, specifying use-case and operation IDs.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outputMapOpn = new HashMap<Object, Object>()` // Map to hold service processing results |
| 2 | SET | `paramMap0665 = new HashMap<String, Object>()` // Map to hold user case ID |
| 3 | SET | `paramMap0665.put(JCCBatchEsbInterface.TELEGRAM_INFO_USECASE_ID, "KKSV0758")` // Use-case ID |
| 4 | SET | `paramMap0665.put(JCCBatchEsbInterface.TELEGRAM_INFO_OPERATION_ID, "KKSV0758OP")` // Operation ID |

**Block 5** — [CALL] `JCCBatchEsbInterface.invokeService()` (L208)

> Invoke the Common Component CC for main contract start device start registration processing.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCBatchEsbInterface.invokeService(super.commonItem, paramMap0665, inputMapOpn, outputMapOpn)` // Service invocation |
| 2 | EXEC | `super.logPrint.printDebugLog("After service call (RETURN_CODE):" + outputMapOpn.get("RETURN_CODE"))` // Debug log |

**Block 6** — [IF] `(NOT "0000".equals(outputMapOpn.get("RETURN_CODE")))` (L211)

> Handle non-zero return code from the CC service — log a business error and throw an exception.

| # | Type | Code |
|---|------|------|
| 1 | SET | `returnCode = (String)outputMapOpn.get("RETURN_CODE")` // Extract return code |
| 2 | SET | `sb.append("Machine-provided service contract number:" + kktkSvcKeiNo)` // Build error message |
| 3 | SET | `sb.append(", delivery number:" + inMap.getString(JBSbatKKIFM216.HAISO_NO))` // Append delivery number |
| 4 | EXEC | `super.logPrint.printBusinessErrorLog(JPCBatchMessageConstant.EKKB0010CW, new String[]{"Main contract start device start registration CC error occurred (return code):" + returnCode + sb.toString()})` // Log business error |
| 5 | RETURN | `throw new JBSbatBusinessError()` // Throw business error exception |

**Block 7** — [ELSE] (L232)

> Normal completion path — process the commitment contract (discount contract) data and progress registration data returned by the CC.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kap_kei_Map = (HashMap<Object, Object>)outputMapOpn.get("KAP_KEI_INF")` // Get commitment contract info from CC response |

**Block 7.1** — [IF] `(null != kap_kei_Map)` (L235)

> Commitment contract info is present — process discount contract status and billing start date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kap_kei_stat = JBSbatStringUtil.Rtrim((String)kap_kei_Map.get("KAP_KEI_STAT"))` // Commitment contract status |
| 2 | SET | `kap_kei_chrg_staymd = JBSbatStringUtil.Rtrim((String)kap_kei_Map.get("KAP_KEI_CHRG_STAYMD"))` // Commitment contract billing start YMD |
| 3 | EXEC | `super.logPrint.printDebugLog("Block commitment contract status:" + kap_kei_stat)` // Debug log |
| 4 | EXEC | `super.logPrint.printDebugLog("Block commitment contract billing start YMD:" + kap_kei_chrg_staymd)` // Debug log |

**Block 7.1.1** — [IF] `(kap_kei_stat equals KAP_KEI_STAT_TIKT="030" AND kap_kei_chrg_staymd empty)` (L243)

> Commitment contract is in status "030" (Signed) but no billing start date is set. This is the v22.00.00 change — uses constant `KAP_KEI_STAT_TIKT` instead of hardcoded "030". Perform a PK lookup on the commitment contract table to check if a record already exists.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param = {Rtrim(kap_kei_Map.get("KAP_KEI_NO")), Rtrim(kap_kei_Map.get("GENE_ADD_DTM"))}` // PK search param: commitment contract number + generation add DTM |
| 2 | CALL | `kapKeiDBMap = this.executeKK_T_KAP_KEI_PKSELECT(param)` // PK search on KK_T_KAP_KEI |

**Block 7.1.1.1** — [IF] `(null != kapKeiDBMap)` (L247)

> DB search returned a result — check if billing standard YMD is set, and if so, create a new commitment contract.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sysdate = JBSbatDateUtil.getSystemDateTimeStamp()` // Get system date/time stamp |
| 2 | SET | `kap_kei_chrg_stdrd_ymd = Rtrim(kapKeiDBMap.getString(KAP_KEI_CHRG_STDARD_YMD))` // Commitment contract billing standard YMD |

**Block 7.1.1.1.1** — [IF v7.00.03] `("")` (L258)

> Billing standard YMD is not set in DB — use the value returned from CC as fallback.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kap_kei_chrg_stdrd_ymd = Rtrim((String)kap_kei_Map.get("KAP_KEI_CHRG_STDARD_YMD"))` // Use value from CC response |
| 2 | EXEC | `super.logPrint.printDebugLog("Block CC return commitment contract billing standard YMD:" + kap_kei_chrg_stdrd_ymd)` // Debug log |

**Block 7.1.1.1.2** — [IF v7.00.03] `(!("".equals(kap_kei_chrg_stdrd_ymd)))` (L267)

> Billing standard YMD is set (from DB or CC) — create a new commitment contract record.

| # | Type | Code |
|---|------|------|
| 1 | SET | `date = JBSbatDateUtil.adjustMonth(kap_kei_chrg_stdrd_ymd, 1)` // Billing start YMD → 1st day of the month after billing standard YMD |
| 2 | SET | `setParam[0] = Rtrim(kapKeiDBMap.getString(KAP_KEI_NO))` // Commitment contract number |
| 3 | SET | `setParam[1] = sysdate` // Generation registration YMD time stamp |
| 4 | SET | `setParam[2] = Rtrim(kapKeiDBMap.getString(KAP_KEI_STAT))` // Commitment contract status |
| 5 | SET | `setParam[3] = Rtrim(kapKeiDBMap.getString(KAP_PLAN_CD))` // Discount plan code |
| 6 | SET | `setParam[4] = Rtrim(kapKeiDBMap.getString(KKTK_SVC_KEI_NO))` // Machine-provided service contract number |
| 7 | SET | `setParam[5] = Rtrim(kapKeiDBMap.getString(ADD_JI_KIKI_CHG_NO))` // Registration-time device change number |
| 8 | SET | `setParam[6] = Rtrim(kapKeiDBMap.getString(MSKM_DTL_NO))` // Application detail number |
| 9 | SET | `setParam[7] = Rtrim(kapKeiDBMap.getString(IDO_DIV))` // Movement division (new contract, service addition, etc.) |
| 10 | SET | `setParam[8] = Rtrim(kapKeiDBMap.getString(RSV_APLY_YMD))` // Reservation application YMD |
| 11 | SET | `setParam[9] = Rtrim(kapKeiDBMap.getString(RSV_CL_YMD))` // Reservation cancellation YMD |
| 12 | SET | `setParam[10] = Rtrim(kapKeiDBMap.getString(RSV_APLY_CD))` // Reservation application code |
| 13 | SET | `setParam[11] = Rtrim(kapKeiDBMap.getString(KAP_IKT_SIKY_SWCH_YM))` // Discount unified billing switch YMD |
| 14 | SET | `setParam[12] = Rtrim(kapKeiDBMap.getString(KAP_KEI_CNC_YMD))` // Commitment contract joining YMD |
| 15 | SET | `setParam[13] = Rtrim(kapKeiDBMap.getString(KAP_SEIKY_ENDYMD))` // Discount billing end YMD |
| 16 | SET | `setParam[14] = Rtrim(kapKeiDBMap.getString(KAP_KEI_DSL_YMD))` // Commitment contract cancellation YMD |
| 17 | SET | `setParam[15] = Rtrim(kapKeiDBMap.getString(PNLTY_HASSEI_CD))` // Penalty occurrence code |
| 18 | SET | `setParam[16] = Rtrim(kapKeiDBMap.getString(KAP_KEI_CANCEL_YMD))` // Commitment contract cancel YMD |
| 19 | SET | `setParam[17] = kap_kei_chrg_stdrd_ymd` // Commitment contract billing standard YMD (v7.00.03 fix: was reading from DB) |
| 20 | SET | `setParam[18] = date.substring(0, 6) + "01"` // Commitment contract billing start YMD → 1st of month |
| 21 | SET | `setParam[19] = Rtrim(kapKeiDBMap.getString(KAP_SEIKY_STA_YM))` // Discount billing start YMD |
| 22 | SET | `setParam[20] = Rtrim(kapKeiDBMap.getString(KAP_PAY_ZAN_CNT))` // Discount payment remaining count |
| 23 | SET | `setParam[21] = Rtrim(kapKeiDBMap.getString(KAP_SEIKY_ZUMI_CNT))` // Discount billing done count |
| 24 | SET | `setParam[22] = Rtrim(kapKeiDBMap.getString(KAP_SEIKY_ZUMI_AMNT))` // Discount billing done amount |
| 25 | SET | `setParam[23] = Rtrim(kapKeiDBMap.getString(TNMT_BUY_TCHISHO_OPUT_SKCD))` // Terminal purchase notification document output ID code |
| 26 | SET | `setParam[24] = Rtrim(kapKeiDBMap.getString(TNMT_BUY_UK_TNTSHA_NM))` // Terminal purchase receipt responsible party name |
| 27 | SET | `setParam[25] = Rtrim(kapKeiDBMap.getString(PRMOP_REKEIJI_WRBHIAPL_FLG))` // Premium option renewal discount non-application flag |
| 28 | SET | `setParam[26] = Rtrim(kapKeiDBMap.getString(HKTGI_MOTO_KAP_KEI_NO))` // Inheritance source discount contract number |
| 29 | SET | `setParam[27] = sysdate` // Registration YMD time stamp |
| 30 | SET | `setParam[28] = super.batchUserId` // Registration operator account |
| 31 | SET | `setParam[29] = sysdate` // Update YMD time stamp |
| 32 | SET | `setParam[30] = super.batchUserId` // Update operator account |
| 33 | SET | `setParam[31] = ""` // Delete YMD time stamp (empty) |
| 34 | SET | `setParam[32] = ""` // Delete operator account (empty) |
| 35 | SET | `setParam[33] = JBSbatKKConst.MK_FLG_YK` // Invalid flag (v22.00.00 change: was hardcoded "0", now uses constant MK_FLG_YK = "0") |
| 36 | SET | `setParam[34] = ""` // Registration operation YMD (empty) |
| 37 | SET | `setParam[35] = ""` // Registration process ID (empty) |
| 38 | SET | `setParam[36] = ""` // Update operation YMD (empty) |
| 39 | SET | `setParam[37] = ""` // Update process ID (empty) |
| 40 | SET | `setParam[38] = ""` // Delete operation YMD (empty) |
| 41 | SET | `setParam[39] = ""` // Delete process ID (empty) |
| 42 | CALL | `this.executeKK_T_KAP_KEI_PKINSERT(setParam)` // Commitment contract registration (Create KK_T_KAP_KEI) |

**Block 8** — [SET] (L284)

> After commitment contract processing, get progress registration data from the CC response.

| # | Type | Code |
|---|------|------|
| 1 | SET | `prgDataMap = (HashMap)outputMapOpn.get("PRG_DATA")` // Get progress registration data |
| 2 | EXEC | `super.logPrint.printDebugLog("Block prgDataMap:" + prgDataMap)` // Debug log |

**Block 8.1** — [IF] `(prgDataMap == null || prgDataMap.size() == 0)` (L286)

> No progress data returned from CC — early return.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null` // No progress data to process |

**Block 8.2** — [IF] `(prgList == null || prgList.size() == 0)` (L294)

> Progress list is empty — early return.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null` // Empty progress list |

**Block 9** — [FOR LOOP] `(i=0; i < prgList.size())` (L301)

> Iterate over each progress registration item, determining the update type and processing accordingly.

| # | Type | Code |
|---|------|------|
| 1 | SET | `prgMap = new HashMap<Object, Object>()` // Progress map |
| 2 | SET | `kikiMsg = new HashMap<Object, Object>()` // Machine-provided service contract info (max generation add DTM) |
| 3 | SET | `minKikiMsg = new HashMap<Object, Object>()` // Machine-provided service contract info (min generation add DTM) |
| 4 | SET | `prgMap = prgList.get(i)` // Get current progress item |
| 5 | SET | `update_type = (String)prgMap.get("UPDATE_TYPE")` // Get update type |

**Block 9.1** — [IF] `(update_type != null && !"".equals(update_type))` (L310)

> Update type is valid — determine the progress status based on update type value.

| # | Type | Code |
|---|------|------|
| 1 | SET | `prg_stat = ""` // Progress status (initialized) |

**Block 9.1.1** — [IF] `("11".equals(update_type))` — Connecting device new installation completed (L313)

| # | Type | Code |
|---|------|------|
| 1 | SET | `prg_stat = JBSbatKKConst.CD00647_PRG_STAT_3301` // Progress status = 3301 (Connecting device new installation completion, v22.00.00 change from hardcoded `CONNECT_KIKI_NEW_IFN`) |

**Block 9.1.2** — [ELSE IF] `("12".equals(update_type) || "13".equals(update_type))` — Connecting device change completed (L318)

| # | Type | Code |
|---|------|------|
| 1 | SET | `prg_stat = JBSbatKKConst.CD00647_PRG_STAT_3302` // Progress status = 3302 (Connecting device change completion, v22.00.00 change) |

**Block 9.1.3** — [ELSE IF] `("90".equals(update_type))` — Option setting completed + Discount registration completed (L323)

| # | Type | Code |
|---|------|------|
| 1 | SET | `prg_stat = JBSbatKKConst.CD00647_PRG_STAT_5102` // Progress status = 5102 (Option setting completion, v22.00.00 change) |
| 2 | SET | `kikiMsg = (HashMap<Object, Object>)prgMap.get("KIKIMSG")` // Get device info map |
| 3 | SET | `minKikiMsg = (HashMap<Object, Object>)prgMap.get("MINKIKIMSG")` // Get device info map (min) |
| 4 | CALL | `insertPrg(kikiMsg, minKikiMsg, prg_stat, update_type)` // Insert progress (v7.00.02: 4-arg overload) |
| 5 | SET | `prg_stat = JBSbatKKConst.CD00647_PRG_STAT_G001` // Progress status = G001 (Discount registration completion, v22.00.00 change) |
| 6 | CALL | `insertPrg(kikiMsg, minKikiMsg, prg_stat, update_type)` // Insert discount registration progress |

**Block 9.1.4** — [ELSE IF] `("130".equals(update_type))` — (L337)

| # | Type | Code |
|---|------|------|
| 1 | SET | `prg_stat = JBSbatKKConst.CD00647_PRG_STAT_5102` // Progress status = 5102 (Option setting completion, v22.00.00 change) |

**Block 9.1.5** — [ELSE IF] `("140".equals(update_type))` — Device option setting completed (L343)

| # | Type | Code |
|---|------|------|
| 1 | SET | `prg_stat = JBSbatKKConst.CD00647_PRG_STAT_H001` // Progress status = H001 (Device option setting completion, v22.00.00 change) |

**Block 9.1.6** — [ELSE IF] `("150".equals(update_type))` — Rental cancellation completed (L349)

| # | Type | Code |
|---|------|------|
| 1 | SET | `prg_stat = JBSbatKKConst.CD00647_PRG_STAT_3200` // Progress status = 3200 (Rental cancellation completion, v22.00.00 change) |

**Block 9.1.7** — [ELSE IF] `("150_KKOP".equals(update_type))` — Device option (ANK-4315対応) (L356)

| # | Type | Code |
|---|------|------|
| 1 | SET | `prg_stat = JBSbatKKConst.CD00647_PRG_STAT_H001` // Progress status = H001 (Device option setting completion) |

**Block 9.1.8** — [ELSE IF] `("150_TKNRT".equals(update_type))` — Multi-function router (ANK-4315対応) (L361)

| # | Type | Code |
|---|------|------|
| 1 | SET | `prg_stat = JBSbatKKConst.CD00647_PRG_STAT_3200` // Progress status = 3200 (Rental cancellation completion) |

**Block 9.1.9** — [ELSE] (L366)

> Unknown update type — return null for this iteration.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null` // Unknown update type, abort processing |

**Block 9.2** — [SET] (L369-L376)

> For valid update types 11, 12, 13, 130, 140, 150, 150_KKOP, 150_TKNRT — get device info maps and insert progress. Note: for types other than 90, `insertPrg` is called once with the derived `prg_stat` (v7.00.02: 4-arg overload).

| # | Type | Code |
|---|------|------|
| 1 | SET | `kikiMsg = (HashMap<Object, Object>)prgMap.get("KIKIMSG")` // Get device info |
| 2 | SET | `minKikiMsg = (HashMap<Object, Object>)prgMap.get("MINKIKIMSG")` // Get device info (min) |
| 3 | CALL | `insertPrg(kikiMsg, minKikiMsg, prg_stat, update_type)` // Insert progress registration (v7.00.02 fix: 4-arg overload) |

**Block 10** — [END] (L379-L383)

> Final debug logging and return.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `super.logPrint.printDebugLog("execute_END")` // Debug log end marker |
| 2 | RETURN | `return null` // Processing complete |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `haiso_no` | Field | Delivery number — unique identifier for a delivery event/shipment |
| `kktk_svc_kei_no` | Field | Machine-provided service contract number — the contract number for services where equipment is provided by the carrier (Ku-tei-Ku-ta Service Keiyaku Number) |
| `kiki_chg_no` | Field | Device change number — identifier for a device change event |
| `taknkiki_model_cd` | Field | Indoor device model code — the model code of the customer premises equipment (TA-kin-Kiki) |
| `kiki_seizo_no` | Field | Device serial number — unique serial number of the provided device |
| `syuKeiStabun` | Field | Commitment/discount split — relates to commitment contract (Syu-Kei) and discount allocation (Ta-bun) |
| `kiki_sta` | Field | Device start — registration/initiation of a provided device's service activation |
| `shka_fin_ji` | Field | Delivery completion time — the timestamp/record associated with completed delivery |
| `kap_kei_stat` | Field | Commitment contract status — status code of the discount/commitment contract (Katsu-Kei Status) |
| `kap_kei_chrg_staymd` | Field | Commitment contract billing start YMD — the year/month/day when billing starts for the commitment contract |
| `kap_kei_chrg_stdrd_ymd` | Field | Commitment contract billing standard YMD — the reference date for billing calculations |
| `kap_kei_no` | Field | Commitment contract number — unique identifier for a commitment (discount) contract |
| `update_type` | Field | Update type — classification code for the type of progress update (e.g., 11=device new, 12/13=device change, 90=option, 150=rental cancel) |
| `prg_stat` | Field | Progress status — a status code describing the current state of a progress registration record |
| `MK_FLG_YK` | Constant | Invalid flag — marks a record as valid (value "0" means not invalid; v22.00.00 change from hardcoded "0") |
| `KAP_KEI_STAT_TIKT` | Constant | Commitment contract signed status — value "030" means the commitment contract is signed/committed |
| CD00647_PRG_STAT_3301 | Constant | Progress status: Connecting device new installation completion (value "3301") |
| CD00647_PRG_STAT_3302 | Constant | Progress status: Connecting device change completion (value "3302") |
| CD00647_PRG_STAT_5102 | Constant | Progress status: Option setting completion (value "5102") |
| CD00647_PRG_STAT_3200 | Constant | Progress status: Rental cancellation completion (value "3200") |
| CD00647_PRG_STAT_G001 | Constant | Progress status: Discount registration completion (value "G001") |
| CD00647_PRG_STAT_H001 | Constant | Progress status: Device option setting completion (value "H001") |
| KK_T_KAP_KEI | Table | Commitment Contract Table — stores commitment (discount) contract records including billing, penalty, and cancellation data |
| KKSV0758 | Use-case | Service use-case ID for main contract start device start registration processing |
| KKSV075801CC | CC Title | Common Component module handling device start registration business logic |
| KKSV0758OP | Operation | Service operation ID for the device start registration operation |
| JCCBatchEsbInterface | Component | Batch ESB interface — the central service invocation gateway for batch CC calls |
| KKSV0758 | Screen ID | Address change device start registration screen/use-case identifier |
| SYU-KEI (保証契約) | Domain term | Commitment/Guarantee contract — a discount arrangement where the customer commits to a service period in exchange for discounted pricing |
| TIKT (締結) | Domain term | Signed/Contracted — the status of a commitment contract being formally executed |
| ANK-4315 | Ticket ID | JIRA ticket for device option/multi-function router update type extension (2023-03-07) |
| v22.00.00 | Version | Version tag for the constant refactoring change — moved hardcoded strings to JBSbatKKConst |
| v7.00.02 | Version | Version tag for the insertPrg 4-arg overload change |
| v7.00.03 | Version | Version tag for the billing standard YMD fallback logic from CC response |
