# Business Logic — JKKCancelSvcKeiCC.callCancelKktkSvcKei() [292 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKCancelSvcKeiCC` |
| Layer | CC / Common Component |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKCancelSvcKeiCC.callCancelKktkSvcKei()

This method orchestrates the cancellation (キャンセル) and rescission (解約) of equipment-provided service contracts (機器提供サービス契約) for K-Opticom telecom subscribers. It iterates over a list of equipment service contract records provided in the `workField` map and applies the appropriate cancellation or rescission workflow depending on the subscriber's service type (Network, Telephone, or TV) and the current status of each equipment service record.

The method handles four service type categories: **Network** (`SVC_CD_NET = "01"`), **Telephone** (`SVC_CD_TEL = "02"`), and **TV** (`SVC_CD_TV = "03"`). For each equipment record, it first determines whether the device should be excluded from cancellation (V-ONU for Network/Telephone, ONU/HGW for TV), then dispatches to the appropriate branch: multi-function router self-routing processing (C024/C025), work order agreement processing for residence change scenarios (TV + work order), standard cancellation, or standard rescission.

The method implements a **routing/dispatch design pattern** with nested conditional branches that route based on service code and device type. It also implements a **delegation pattern**, calling out to specialized CC classes (`JKKKkopSvcUseKeiUpdCC` for router contract updates, `JKKAdchgCancelHaisoCC` for delivery cancellation) and a suite of service component SC methods to perform the actual contract lifecycle operations.

As a shared utility component called from the main `kkCancelKtjCC` method (a screen CBS entry point), this method serves as the central coordination point for all equipment-provided service contract cancellations during the contract cancellation screen flow.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["callCancelKktkSvcKei entry"])
    START --> INIT["Set statusCode=0
Get inHashlist and svcKeiMap from workField"]
    INIT --> LOOP["For each record in inHashlist"]
    LOOP --> GEN["Extract tmpSvcKeiStat, tmpTaknkikiSbtCd, tgKKtkSvcKeiNo
Set isKktkSvcCancel=false"]
    GEN --> SVCNETTEL{"svcCd is 01 or 02?"}
    SVCNETTEL -->|Yes| VONUCHK{"tmpTaknkikiSbtCd is C013?"}
    VONUCHK -->|Yes| SKIPVONU["continue (skip V-ONU)"]
    VONUCHK -->|No| NETTELPROC["Proceed to equipment handling"]
    SVCNETTEL -->|No| SVCTVCHK{"svcCd is 03?"}
    SVCTVCHK -->|Yes| TVDEVCHK{"tmpTaknkikiSbtCd is C012 or C025?"}
    TVDEVCHK -->|Yes| SKIPTVDEV["continue (skip ONU/HGW)"]
    TVDEVCHK -->|No| ROUTERCHK{"tmpTaknkikiSbtCd is C024 or C025?"}
    SVCTVCHK -->|No| ROUTERCHK
    ROUTERCHK -->|Yes| MULTIROUTER["Call createUserData
Call editMapKKkopSvcUseKeiUpd
Instantiate JKKKkopSvcUseKeiUpdCC
Call updateKkopSvcKeiTran"]
    MULTIROUTER --> UPDDTMCHK{"kktk_up_dtm not null and not empty?"}
    UPDDTMCHK -->|Yes| SETUPDT["cancelSvcKeiMapper.setSvcKeiUpdDtm"]
    UPDDTMCHK -->|No| CALLEKK0341A
    SETUPDT --> CALLEKK0341A["Call callEKK0341A010SC"]
    CALLEKK0341A --> EKK0341ARESULTCHK{"eKK0341A010Result exists
And kktkSvcKeiStat is not 910 and not 920?"}
    EKK0341ARESULTCHK -->|Yes| ADDKOJIAK["Add eKK0341A010Result to KKTK_SVC_KEI_KOJIAK"]
    EKK0341ARESULTCHK -->|No| SETFLG
    ADDKOJIAK --> SETFLG["Set kikiRntaiKeiKkopSvcDslCnslFlg
Update KKSV019601CC data"]
    SETFLG --> ELSEBRANCH
    SKIPVONU --> ELSEBRANCH
    SKIPTVDEV --> ELSEBRANCH
    ELSEBRANCH{"tmpTaknkikiSbtCd not C024/C025?"}
    ELSEBRANCH -->|Yes - else| ANKCHK{"TV and SVC_KEI_CHU
And kojiakNo set?"}
    ANKCHK -->|Yes| KOKICALL["Call callEKU0011A010SC"]
    KOKICALL --> ADCHGCHK{"kojiUkOptntyIdoDiv is 00019?"}
    ADCHGCHK -->|Yes| SVCLISTCALL["Call callEKK0341B002SC"]
    SVCLISTCALL --> RSVCHK{"Any KEI_CHG_CHU=110 record?"}
    RSVCHK -->|Yes| HAISOPREP["Build haisoCancelKikiList
Call kikiHaisoCancel
Call callEKK0341C540SC or callEKK0341C170SC"]
    RSVCHK -->|No| MAINSTATCHK
    HAISOPREP --> MAINSTATCHK
    ANKCHK -->|No| MAINSTATCHK
    MAINSTATCHK{"tmpSvcKeiStat is 010 or 020?"}
    MAINSTATCHK -->|Yes| CALCC["Call callEKK0341C330SC
Set isKktkSvcCancel=true"]
    MAINSTATCHK -->|No| MAINSTATCHK2{"tmpSvcKeiStat is 030 or 100 or 210 or 220?"}
    MAINSTATCHK2 -->|Yes| CALRES["Call callEKK0771A010SC
callEKK0341C340SC
callEKK0341C350SC
Set isKktkSvcCancel=true"]
    MAINSTATCHK2 -->|No| ALREADYCHK{"tmpSvcKeiStat is 920 or 910?"}
    ALREADYCHK -->|Yes| SKIPALREADY["continue (already cancelled or rescinded)"]
    ALREADYCHK -->|No| NEXTREC
    CALCC --> KKTCHK
    CALRES --> KKTCHK{"isKktkSvcCancel=true?"}
    KKTCHK -->|Yes| RECURSIVE["callCancelKktkSvcKei with kktkSvcKeiNo"]
    KKTCHK -->|No| TABLETCHK
    RECURSIVE --> TABLETCHK{"tmpTaknkikiSbtCd is C021 or C022?"}
    TABLETCHK -->|Yes| KAPPU["Call kappu_cancel"]
    TABLETCHK -->|No| NEXTREC
    KAPPU --> KAPPUCHK{"statusCode not 0?"}
    KAPPUCHK -->|Yes| EARLYRET["return statusCode"]
    KAPPUCHK -->|No| NEXTREC
    NEXTREC["Next loop iteration"]
    SKIPALREADY --> NEXTREC
    NEXTREC --> LOOPEND{"End of list?"}
    LOOPEND -->|No| LOOP
    LOOPEND -->|Yes| HYBRIDCHK{"pcrsCd is A60?"}
    HYBRIDCHK -->|Yes| UPDTBLT["Call updateTbltKei"]
    HYBRIDCHK -->|No| FINALRET["return statusCode"]
    UPDTBLT --> FINALRET
    NETTELPROC --> ELSEBRANCH
    SKIPVONU --> END(["Return"])
    SKIPTVDEV --> END
    EARLYRET --> END
    FINALRET --> END
```

**Processing overview by branch:**

1. **Initialization**: Sets `statusCode` to `STAT_NORMAL` (0). Retrieves the equipment service contract list (`KKTK_SVC_KEI`) and service contract info map (`SVC_KEI`) from `workField`. Extracts the service code (`svcCd`) and target service contract number (`tgSvckeiNo`).

2. **Per-record loop**: Iterates over each equipment service record. Determines device exclusions: V-ONU devices for Network/Telephone services, and ONU/HGW devices for TV services are skipped (they do not need explicit cancellation/rescission).

3. **Multi-function router branch (C024/C025)**: For Takino Router (C024) and Home Gateway (C025), calls the router contract update CC (`JKKKkopSvcUseKeiUpdCC`) to perform self-routing operations. Then queries the device service contract status and optionally adds results to the work order list.

4. **Work order agreement branch (TV + residence change)**: For TV services in "service contract in progress" status with a work order number, calls the work order agreement SC (`callEKU0011A010SC`). If the work order is a residence change/registration (`IDO_KBN_ADCHGADD = "00019"`), it checks for pending contract change orders and calls delivery cancellation if needed, followed by either equipment change processing (`callEKK0341C540SC`) or rate change cancellation (`callEKK0341C170SC`).

5. **Cancellation branch**: For records with status "cancelled" (`STAT_UK_ZUMI = "010"`) or "investigation complete" (`STAT_SHOSA_ZUMI = "020"`), calls the equipment service cancellation SC (`callEKK0341C330SC`).

6. **Rescission branch**: For records with status "cancellation completed" (`STAT_CNC_ZUMI = "030"`), "service contract in progress" (`STAT_SVCTK_CHU = "100"`), "pause stop in progress" (`STAT_PAUSE_STP_CHU = "210"`), or "stop in progress" (`STAT_STP_CHU = "220"`), calls the agreement SC (`callEKK0771A010SC`), rescission SC (`callEKK0341C340SC`), and rescission confirmation SC (`callEKK0341C350SC`).

7. **Already-cancelled branch**: For records already in "cancel completed" (`STAT_CNCL_ZUMI = "920"`) or "DSL completed" (`STAT_DSL_ZUMI = "910"`) status, skips processing via `continue`.

8. **Recursive device cancellation**: If a device was cancelled/rescinded (`isKktkSvcCancel = true`), recursively calls the overloaded `callCancelKktkSvcKei` with the device's service contract number to cancel associated equipment operation service contracts.

9. **Tablet/cradle cancellation**: For tablet (C021) and cradle (C022) devices, calls `kappu_cancel` for pro-ration contract cancellation.

10. **Hybrid tablet update**: After the loop, if the subscriber is on a hybrid plan (`PCRS_CD_3G_42M_HYBRID = "A60"`), calls `updateTbltKei` to update tablet-related service contract info.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | Request parameter container holding all input/output data for the service cancellation flow. Used to read work order info (`kojiak_no`), set delivery cancellation parameters, and store router processing results. |
| 2 | `handle` | `SessionHandle` | Database session handle used to execute service component SC calls and perform database transactions for contract cancellation/rescission. |
| 3 | `trgt_data` | `HashMap<String, Object>` | Application-specific input parameters containing business data such as the work order number (`kojiak_no`) and process status (`ido_div`). The `kojiak_no` is used to query work order agreement information for residence change scenarios. |
| 4 | `workField` | `HashMap<String, Object>` | Result retrieval area containing the equipment service contract list (`KKTK_SVC_KEI` — key for the ArrayList of equipment service records), service contract details (`SVC_KEI`), and work order equipment info (`KKTK_SVC_KEI_KOJIAK`). This drives the main iteration loop. |

**Instance fields / external state read:**

| Field | Business Description |
|-------|---------------------|
| `cancelSvcKeiMapper` | Mapper component used to call `setSvcKeiUpdDtm()` to persist the service contract update datetime |
| `svcKeiUpdDtm` | Instance field storing the last update datetime for service contract records |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `callEKK0341C330SC` | EKK0341C330SC | KK_T_KKTK_SVC_KEI (Equipment Service Contract) | Equipment service contract cancellation — transitions contract status to cancelled/investigation-complete |
| R | `callEKK0771A010SC` | EKK0771A010SC | KK_T_SVC_KEI_AGREEMENT | Equipment service agreement call — retrieves or confirms service contract agreement data |
| C | `callEKK0341C340SC` | EKK0341C340SC | KK_T_SVC_KEI (Service Contract) | Equipment service contract rescission — initiates the rescission process on the service contract |
| C | `callEKK0341C350SC` | EKK0341C350SC | KK_T_SVC_KEI (Service Contract) | Equipment service contract rescission confirmation — confirms and finalizes the rescission |
| R | `callEKK0341A010SC` | EKK0341A010SC | KK_T_KKOP_SVC_KEI (Equipment Operation Service Contract) | Equipment operation service contract status query — checks if the device service contract is in a cancelable/rescission-eligible state |
| R | `callEKK0341B002SC` | EKK0341B002SC | KK_T_KKTK_SVC_KEI (Equipment Service Contract) | Equipment service contract list query (with service contract number) — retrieves pending contract change orders for the device |
| C | `callEKK0341C170SC` | EKK0341C170SC | KK_T_PCRS (Rate Plan) | Equipment service service rate change cancellation — cancels a pending rate plan change |
| C | `callEKK0341C540SC` | EKK0341C540SC | KK_T_KKTK_SVC_KEI_CHG (Equipment Service Contract Change) | Equipment service contract equipment change processing cancellation — cancels a pending device change |
| R | `callEKU0011A010SC` | EKU0011A010SC | KK_T_KOJI_AGREEMENT (Work Order Agreement) | Work order agreement call — retrieves work order information including move classification type |
| C | `kikiHaisoCancel` | JKKAdchgCancelHaisoCC | Delivery records | Delivery cancellation CC call — cancels scheduled deliveries for devices when contract change is being cancelled |
| C | `kappu_cancel` | JKKCancelSvcKeiCC | Pro-ration contract records | Pro-ration contract cancellation — handles tablet/cradle device pro-ration fee cancellation |
| C | `updateTbltKei` | JKKCancelSvcKeiCC | KK_T_TBLT_SVC_KEI (Tablet Service Contract) | Tablet service contract update — updates tablet-related service contract info for hybrid plan subscribers |
| - | `JKKKkopSvcUseKeiUpdCC.updateKkopSvcKeiTran` | JKKKkopSvcUseKeiUpdCC | KK_T_KKOP_SVC_KEI (Equipment Operation Service Contract) | Equipment operation service contract update CC main processing — updates router contract details including self-routing |
| - | `editMapKKkopSvcUseKeiUpd` | cancelSvcKeiMapper | - | Edit mapping for router contract update — prepares the input data map for the router update CC |
| - | `createUserData` | JKKCancelSvcKeiCC | - | Create user data — initializes the router update processing data structure in param |
| - | `cancelSvcKeiMapper.setSvcKeiUpdDtm` | cancelSvcKeiMapper | - | Sets the service contract update datetime for consistency across related records |
| - | `JBSbatAKKshkmRsltInfoTukiawsday.setData` | JBSbatAKKshkmRsltInfoTukiawsday | - | Sets billing-sync result data for service-contract-tuition-day-association |
| - | `JBSbatAKKshkmRsltInfoTukiaws.setData` | JBSbatAKKshkmRsltInfoTukiaws | - | Sets billing-sync result data for service-contract-tuition-association |
| - | `JBSbatAKKshkmRsltInfoTukiawsRealSkh.setData` | JBSbatAKKshkmRsltInfoTukiawsRealSkh | - | Sets billing-sync result data for service-contract-tuition-real-schedule |
| - | `JBSbatAKKshkmRsltInfTkCvsNCnsl.setData` | JBSbatAKKshkmRsltInfTkCvsNCnsl | - | Sets billing-sync result data for service-contract-tuition-cvs-cancel-association |
| R | `JBSbatDKNyukaFinAdd.getData` | JBSbatDKNyukaFinAdd | - | Gets billing entry completion-addition data |
| R | `JBSbatFUCaseFileRnkData.getString` | JBSbatFUCaseFileRnkData | - | Gets field-string data from follow-up case file rank data |
| R | `JBSbatFUMoveNaviData.getString` | JBSbatFUMoveNaviData | - | Gets field-string data from follow-up move navigation data |
| R | `JBSbatZMAdDataSet.getString` | JBSbatZMAdDataSet | - | Gets field-string data from ZM address data set |
| R | `JFUeoTelOpTransferCC.getData` | JFUeoTelOpTransferCC | - | Gets data for EO telephone operation transfer |
| R | `JFUTransferCC.getData` | JFUTransferCC | - | Gets data for transfer operations |
| R | `JFUTransferListToListCC.getData` | JFUTransferListToListCC | - | Gets data for transfer-list-to-list operations |
| - | `JKKAddSjishoCC.isNullEmpty` | JKKAddSjishoCC | - | Utility check: null/empty string validation |
| - | `JKKAddSjishoCCMapper.isNullEmpty` | JKKAddSjishoCCMapper | - | Utility check: null/empty string validation (mapper variant) |
| - | `callCancelKktkSvcKei` (5-param overload) | JKKCancelSvcKeiCC | KK_T_KKOP_SVC_KEI | Recursive device service contract cancellation — cascades cancellation to associated equipment operation service contracts |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 2 methods.
Terminal operations from this method: `updateTbltKei` [C], `kappu_cancel` [C], `callCancelKktkSvcKei` [R], `callCancelKktkSvcKei` [R], `callEKK0341C350SC` [C], `callEKK0341C340SC` [C], `callEKK0771A010SC` [R], `callEKK0341C330SC` [C], `callEKK0341C170SC` [C], `callEKK0341C540SC` [C], `kikiHaisoCancel` [-], `setData` [-], `setData` [-], `setData` [-], `setData` [-], `callEKK0341B002SC` [R], `callEKK0341B002SC` [R], `getString` [R], `getString` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: kkCancelKtjCC (Line ~1360) | `kkCancelKtjCC.process` → `callCancelSvKeiKaisenUw` → `callCancelKktkSvcKei` | `callEKK0341C330SC [C] KK_T_KKTK_SVC_KEI`, `callEKK0341C340SC [C] KK_T_SVC_KEI`, `callEKK0341C350SC [C] KK_T_SVC_KEI`, `callEKK0341A010SC [R] KK_T_KKOP_SVC_KEI`, `callEKK0341B002SC [R] KK_T_KKTK_SVC_KEI`, `callEKK0341C170SC [C] KK_T_PCRS`, `callEKK0341C540SC [C] KK_T_KKTK_SVC_KEI_CHG`, `kikiHaisoCancel [-] Delivery`, `kappu_cancel [C] Pro-ration`, `updateTbltKei [C] KK_T_TBLT_SVC_KEI` |
| 2 | Internal recursion (Line ~3746) | `callCancelKktkSvcKei` (5-param overload) → `callEKK2811B010SC` → `callEKK2811A010SC` → `callEKK2811C110SC` / `callEKK2811C140SC` / `callEKK2811C150SC` | `callEKK2811B010SC [R] KK_T_KKOP_SVC_KEI`, `callEKK2811A010SC [R] KK_T_KKOP_SVC_KEI`, `callEKK2811C110SC [C] KK_T_KKOP_SVC_KEI`, `callEKK2811C140SC [C] KK_T_KKOP_SVC_KEI`, `callEKK2811C150SC [C] KK_T_KKOP_SVC_KEI` |

## 6. Per-Branch Detail Blocks

**Block 1** — INITIALIZATION (lines 3494–3514)

> Sets up processing state and extracts the equipment service contract list from workField.

| # | Type | Code |
|---|------|------|
| 1 | SET | `statusCode = STAT_NORMAL` [-> `STAT_NORMAL = 0`] // Status code initialization |
| 2 | EXEC | `workField.get(KKTK_SVC_KEI)` [-> `"kktk_svc_kei"`] // Get equipment service contract list |
| 3 | EXEC | `workField.get(SVC_KEI)` [-> `"svc_kei"`] // Get service contract info map |
| 4 | EXEC | `svcKeiMap.get(EKK0081A010CBSMsg1List.SVC_CD)` // Extract service code |
| 5 | SET | `tgSvckeiNo = svcKeiMap.get(EKK0081A010CBSMsg1List.SVC_KEI_NO)` // Target service contract number |

**Block 2** — FOR LOOP (lines 3516–3781)

> Iterates over all equipment service contract records.

| # | Type | Code |
|---|------|------|
| 1 | SET | `isKktkSvcCancel = false` // Flag to track whether cancel/rescission was performed |
| 2 | SET | `resultHash = new HashMap` // Result data container |
| 3 | SET | `resultHashFix = new HashMap` // Fixed result data container |
| 4 | EXEC | `inHashlist.get(i).get(EKK0341A010CBSMsg1List.KKTK_SVC_KEI_STAT)` // Status code |
| 5 | EXEC | `inHashlist.get(i).get(EKK0341A010CBSMsg1List.KKTK_SVC_CD)` // Equipment service code |
| 6 | EXEC | `inHashlist.get(i).get(EKK0341A010CBSMsg1List.KKTK_SVC_KEI_NO)` // Device service contract number |

**Block 3** — SERVICE CODE CHECK: Network/Telephone (lines 3529–3533) [CONSTANT `SVC_CD_NET="01"`, `SVC_CD_TEL="02"`] (L3529)

> Determines if the subscriber's main service is Network (01) or Telephone (02). If so, checks for V-ONU exclusion.

| # | Type | Code |
|---|------|------|
| 1 | IF | `SVC_CD_NET.equals(svcCd) || SVC_CD_TEL.equals(svcCd)` [-> `"01" or "02"`] // Network or Telephone service |

**Block 3.1** — V-ONU EXCLUSION (lines 3532–3533) [CONSTANT `KKTK_SVC_CD_VONU="C013"`] (L3532)

> V-ONU devices do not need explicit cancellation or rescission.

| # | Type | Code |
|---|------|------|
| 1 | IF | `JKKSvcConst.KKTK_SVC_CD_VONU.equals(tmpTaknkikiSbtCd)` [-> `"C013"`] // V-ONU check |
| 2 | RETURN | `continue` // Skip V-ONU device record |

**Block 4** — SERVICE CODE CHECK: TV (lines 3535–3545) [CONSTANT `SVC_CD_TV="03"`] (L3535)

> Determines if the subscriber's main service is TV (03). If so, checks for ONU/HGW exclusion.

| # | Type | Code |
|---|------|------|
| 1 | ELSE_IF | `SVC_CD_TV.equals(svcCd)` [-> `"03"`] // TV service check |

**Block 4.1** — ONU/HGW EXCLUSION (lines 3539–3544) [CONSTANTS `KKTK_SVC_CD_ONU="C012"`, `KKTK_SVC_CD_HGW="C025"`] (L3539)

> ONU and Home Gateway devices do not need explicit cancellation or rescission.

| # | Type | Code |
|---|------|------|
| 1 | IF | `KKTK_SVC_CD_ONU.equals(tmpTaknkikiSbtCd) || KKTK_SVC_CD_HGW.equals(tmpTaknkikiSbtCd)` [-> `"C012" or "C025"`] // ONU or HGW check |
| 2 | RETURN | `continue` // Skip ONU/HGW device record |

**Block 5** — MULTI-FUNCTION ROUTER PROCESSING (lines 3550–3621) [CONSTANTS `"C024"`, `"C025"`] (L3550)

> For Takino Router (C024) and Home Gateway (C025) devices, performs self-routing contract update processing.

| # | Type | Code |
|---|------|------|
| 1 | IF | `"C024".equals(tmpTaknkikiSbtCd) || "C025".equals(tmpTaknkikiSbtCd)` // Router device check |
| 2 | SET | `workKKkopSvcUseKeiUpdDataKey = "KKkopSvcUseKeiUpdCC"` |
| 3 | CALL | `createUserData(param, workKKkopSvcUseKeiUpdDataKey)` |
| 4 | SET | `kkopSvcUseKeiUpdCC = new JKKKkopSvcUseKeiUpdCC()` |
| 5 | CALL | `cancelSvcKeiMapper.editMapKKkopSvcUseKeiUpd(param, inHashlist.get(i), workKKkopSvcUseKeiUpdDataKey, tgSvckeiNo, workField, tgKKtkSvcKeiNo, svcKeiUpdDtm, resultHash)` |
| 6 | CALL | `kkopSvcUseKeiUpdCC.updateKkopSvcKeiTran(handle, param, workKKkopSvcUseKeiUpdDataKey)` |
| 7 | EXEC | `param.getData(workKKkopSvcUseKeiUpdDataKey)` // Get update result |
| 8 | EXEC | `workOutMap.get("trgt_data_list")` // Get target data list |
| 9 | EXEC | `workArray.get(0)` // Get first element |
| 10 | SET | `kktk_up_dtm = workKktkCoshjMap.get(kkopSvcUseKeiUpdCC.KEY_UPD_DTM)` // Equipment update datetime |
| 11 | SET | `svcKeiNoPair = workKktkCoshjMap.get(kkopSvcUseKeiUpdCC.KEY_SVC_KEI_NO_PAIR)` // Paired service contract number |
| 12 | SET | `updDtmPair = workKktkCoshjMap.get(kkopSvcUseKeiUpdCC.KEY_UPD_DTM_PAIR)` // Paired update datetime |

**Block 5.1** — UPDATE DATETIME PROPAGATION (lines 3623–3624) (L3623)

> If the equipment update datetime is not empty, propagate it to the service contract mapper for consistency.

| # | Type | Code |
|---|------|------|
| 1 | IF | `kktk_up_dtm != null && !"".equals(kktk_up_dtm)` // Check update datetime is set |
| 2 | CALL | `cancelSvcKeiMapper.setSvcKeiUpdDtm(kktk_up_dtm)` // Propagate update datetime |

**Block 5.2** — DEVICE SERVICE CONTRACT STATUS QUERY (lines 3629–3646) (L3629)

> Queries the device service contract status after router update. If the status is not already DSL-complete (910) or cancel-complete (920), adds the result to the work order list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0341A010Result = new HashMap` |
| 2 | CALL | `callEKK0341A010SC(param, handle, SVC_KEI, tgKKtkSvcKeiNo, eKK0341A010Result)` |
| 3 | IF | `eKK0341A010Result != null` // Check result exists |
| 4 | EXEC | `eKK0341A010Result.get(EKK0341A010CBSMsg1List.KKTK_SVC_KEI_STAT)` |
| 5 | IF | `!STAT_DSL_ZUMI.equals(kktkSvcKeiStat) && !STAT_CNCL_ZUMI.equals(kktkSvcKeiStat)` [-> `not "910"` and not `"920"`] // Not already completed |
| 6 | EXEC | `workField.get(KKTK_SVC_KEI_KOJIAK)` [-> `"kktk_svc_kei_kojiak"`] |
| 7 | EXEC | `eKK0341A010HashListKojiak.add(eKK0341A010Result)` // Add to work order list |

**Block 5.3** — DEVICE LINK FLAG UPDATE (lines 3648–3654) (L3648)

> Updates the device-link router DSL cancellation flag in the KKSV019601CC data map for message output during device-linked contract changes.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `workOutMap.get("kiki_rntai_kei_kkop_svc_dsl_cnsl_Flg")` // Get cancellation flag |
| 2 | IF | `JKKStringUtil.isNullEmpty(kikiRntaiKeiKkopSvcDslCnslFlg)` // Check if null/empty |
| 3 | SET | `kikiRntaiKeiKkopSvcDslCnslFlg = "0"` // Default to "0" |
| 4 | EXEC | `param.getData(KKSV019601CC)` [-> `"TRGT_DATA"`] |
| 5 | EXEC | `inMap.put("kiki_rntai_kei_kkop_svc_dsl_cnsl_Flg", kikiRntaiKeiKkopSvcDslCnslFlg)` // Set flag |

**Block 6** — ELSE BRANCH: Work Order Agreement Processing (lines 3660–3723)

> For non-router devices (else branch of Block 5), handles TV service work order agreement scenarios.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kojiakNo = trgt_data.get(JKKCancelSvcKeiCC.REQ_PARAM_KOJIAK_NO)` [-> `"kojiak_no"`] // (Input) Work order number |

**Block 6.1** — RESIDENCE CHANGE WORK ORDER CHECK (lines 3663–3664) (L3663)

> Checks if this is a TV service in "service contract in progress" status with a valid work order number.

| # | Type | Code |
|---|------|------|
| 1 | IF | `SVC_CD_TV.equals(svcCd) && tmpSvcKeiStat.equals(STAT_SVCTK_CHU) && !isNull(kojiakNo) && !"".equals(kojiakNo)` [-> TV="03", STAT_SVCTK_CHU="100", work order set] // TV service, in-progress, work order set |
| 2 | CALL | `callEKU0011A010SC(param, handle, kojiakNo)` // Work order agreement SC |
| 3 | EXEC | `eku0011a010Msg.getCAANMsgList(...)` // Extract message list |
| 4 | EXEC | `eku0011a010ListMsg.getString(EKU0011A010CBSMsg1List.KOJI_UK_OPTNTY_IDO_DIV)` // Move classification type |

**Block 6.2** — RESIDENCE CHANGE + REGISTRATION CHECK (CONSTANT `IDO_KBN_ADCHGADD="00019"`) (L3667)

> If the work order is a residence change/registration, processes pending contract changes.

| # | Type | Code |
|---|------|------|
| 1 | IF | `IDO_KBN_ADCHGADD.equals(kojiUkOptntyIdoDiv)` [-> `"00019"`] // Residence change + registration |
| 2 | SET | `resultKK0341B002List = new ArrayList` |
| 3 | CALL | `callEKK0341B002SC(param, handle, FUNC_CODE_12, tgSvckeiNo, tmpTaknkikiSbtCd, tgKKtkSvcKeiNo, sortKbn, resultKK0341B002List)` [-> `FUNC_CODE_12 = "12"`] // Service contract list query |
| 4 | SET | `rsvGeneAddDtm = ""` // (Reservation) Generation registration datetime |
| 5 | SET | `rsvPcrsCd = ""` // (Reservation) Rate code code |
| 6 | SET | `rsvKikiChgNo = ""` // (Reservation) Device change number |
| 7 | SET | `rsvLastUpdDtm = ""` // (Reservation) Last update datetime |

**Block 6.3** — PENDING CONTRACT CHANGE DETECTION (lines 3684–3697) (L3684)

> Iterates through the service contract list results to find records with "contract change in progress" status (CD00056_STAT_KEI_CHG_CHU = "110").

| # | Type | Code |
|---|------|------|
| 1 | IF | `resultKK0341B002List != null && resultKK0341B002List.size() > 0` // Results exist |
| 2 | FOR | `j = 0 to resultKK0341B002List.size()` |
| 3 | EXEC | `resultKK0341B002List.get(j).get(EKK0341B002CBSMsg1List.KKTK_SVC_KEI_STAT)` |
| 4 | IF | `JKKStrConst.CD00056_STAT_KEI_CHG_CHU.equals(kktkSvcKeiStat)` [-> `"110"`] // Contract change in progress |
| 5 | SET | `rsvGeneAddDtm = resultKK0341B002List.get(j).get(EKK0341B002CBSMsg1List.GENE_ADD_DTM)` |
| 6 | SET | `rsvPcrsCd = resultKK0341B002List.get(j).get(EKK0341B002CBSMsg1List.PCRS_CD)` |
| 7 | SET | `rsvKikiChgNo = resultKK0341B002List.get(j).get(EKK0341B002CBSMsg1List.KIKI_CHG_NO)` |
| 8 | SET | `rsvLastUpdDtm = resultKK0341B002List.get(j).get(EKK0341B002CBSMsg1List.LAST_UPD_DTM)` |
| 9 | EXEC | `break` // Found pending change, exit loop |

**Block 6.4** — DELIVERY CANCELLATION AND CHANGE CANCELLATION (lines 3699–3723) (L3699)

> If reservation data exists, performs delivery cancellation and then cancels either the equipment change or the rate change based on rate code matching.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `inHashlist.get(i).get(EKK0341A010CBSMsg1List.PCRS_CD)` // Current rate code |
| 2 | IF | `!rsvGeneAddDtm.isEmpty() && !rsvPcrsCd.isEmpty() && !rsvKikiChgNo.isEmpty() && !rsvLastUpdDtm.isEmpty()` // Reservation data exists |
| 3 | SET | `haisoCancelKikiList = new ArrayList` |
| 4 | SET | `haisoCancelKiki = new HashMap` |
| 5 | EXEC | `haisoCancelKiki.put("kktkSvcKeiNo", tgKKtkSvcKeiNo)` |
| 6 | EXEC | `haisoCancelKiki.put("kkChgNo", rsvKikiChgNo)` |
| 7 | EXEC | `haisoCancelKiki.put("kikiChgNo", rsvKikiChgNo)` |
| 8 | EXEC | `haisoCancelKiki.put("svcKeiNo", tgSvckeiNo)` |
| 9 | EXEC | `haisoCancelKikiList.add(haisoCancelKiki)` |
| 10 | SET | `haisoCancelParam = new HashMap` |
| 11 | EXEC | `haisoCancelParam.put("haiso_cancel_kiki_list", haisoCancelKikiList)` |
| 12 | EXEC | `param.setData("JKKAdchgCancelHaisoCC", haisoCancelParam)` |
| 13 | SET | `haisoCancelCc = new JKKAdchgCancelHaisoCC()` |
| 14 | CALL | `haisoCancelCc.kikiHaisoCancel(handle, param, fixedText)` // Delivery cancellation |
| 15 | IF | `rsvPcrsCd.equals(pcrsCd)` // Rate codes match |
| 16 | SET | `eKK0341C540Hash = new HashMap` |
| 17 | CALL | `callEKK0341C540SC(param, handle, FUNC_CODE_ONE, tgKKtkSvcKeiNo, rsvGeneAddDtm, rsvLastUpdDtm, eKK0341C540Hash)` [-> `FUNC_CODE_ONE = JPCModelConstant.FUNC_CD_1`] // Equipment change cancellation |
| 18 | ELSE | // Rate codes differ |
| 19 | SET | `eKK0341C170Hash = new HashMap` |
| 20 | CALL | `callEKK0341C170SC(param, handle, FUNC_CODE_ONE, tgKKtkSvcKeiNo, rsvGeneAddDtm, rsvLastUpdDtm, eKK0341C170Hash)` // Rate change cancellation |

**Block 7** — CANCELLATION STATUS CHECK (lines 3727–3730) [CONSTANTS `STAT_UK_ZUMI="010"`, `STAT_SHOSA_ZUMI="020"`] (L3727)

> If the status is "cancelled" or "investigation complete", performs the equipment service contract cancellation.

| # | Type | Code |
|---|------|------|
| 1 | IF | `tmpSvcKeiStat.equals(STAT_UK_ZUMI) || tmpSvcKeiStat.equals(STAT_SHOSA_ZUMI)` [-> `"010" or "020"`] // Cancelled or investigation complete |
| 2 | CALL | `callEKK0341C330SC(param, handle, trgt_data, inHashlist.get(i), workField, resultHash)` |
| 3 | SET | `isKktkSvcCancel = true` // Flag cancel was performed |

**Block 8** — RESCISSION STATUS CHECK (lines 3732–3743) [CONSTANTS `STAT_CNC_ZUMI="030"`, `STAT_SVCTK_CHU="100"`, `STAT_PAUSE_STP_CHU="210"`, `STAT_STP_CHU="220"`] (L3732)

> If the status is "cancellation completed", "service contract in progress", "pause stop in progress", or "stop in progress", performs the full rescission flow.

| # | Type | Code |
|---|------|------|
| 1 | ELSE_IF | `tmpSvcKeiStat.equals(STAT_CNC_ZUMI) || tmpSvcKeiStat.equals(STAT_SVCTK_CHU) || tmpSvcKeiStat.equals(STAT_PAUSE_STP_CHU) || tmpSvcKeiStat.equals(STAT_STP_CHU)` [-> `"030" or "100" or "210" or "220"`] |
| 2 | CALL | `callEKK0771A010SC(param, handle, inHashlist.get(i), resultHash)` // Agreement call |
| 3 | CALL | `callEKK0341C340SC(param, handle, trgt_data, inHashlist.get(i), workField, resultHash)` // Rescission |
| 4 | CALL | `callEKK0341C350SC(param, handle, resultHash, resultHashFix)` // Rescission confirmation |
| 5 | SET | `isKktkSvcCancel = true` |

**Block 9** — ALREADY CANCELLED/RESCINDED CHECK (lines 3745–3755) [CONSTANTS `STAT_CNCL_ZUMI="920"`, `STAT_DSL_ZUMI="910"`] (L3745)

> If the status is already "cancel completed" or "DSL completed", skip processing via `continue` (previously would have broken out of the loop entirely).

| # | Type | Code |
|---|------|------|
| 1 | ELSE_IF | `tmpSvcKeiStat.equals(STAT_CNCL_ZUMI) || tmpSvcKeiStat.equals(STAT_DSL_ZUMI)` [-> `"920" or "910"`] |
| 2 | RETURN | `continue` // Skip this record (OM-2014-0001860 fix: was `break`, changed to `continue`) |

**Block 10** — RECURSIVE DEVICE CANCELLATION (lines 3759–3761) (L3759)

> If the device was cancelled/rescinded in the current iteration, recursively calls the overloaded 5-parameter `callCancelKktkSvcKei` to cancel associated equipment operation service contracts.

| # | Type | Code |
|---|------|------|
| 1 | IF | `isKktkSvcCancel` // Device was cancelled or rescinded |
| 2 | CALL | `callCancelKktkSvcKei(param, handle, trgt_data, workField, tgKKtkSvcKeiNo)` // Recursive device cancellation |

**Block 11** — TABLET/CRADLE PRO-RATION CANCELLATION (lines 3766–3775) [CONSTANTS `KKTK_SVC_CD_TABLET="C021"`, `KKTK_SVC_CD_CRADLE="C022"`] (L3766)

> For tablet (C021) and tablet cradle (C022) devices, performs pro-ration contract cancellation.

| # | Type | Code |
|---|------|------|
| 1 | IF | `JKKSvcConst.KKTK_SVC_CD_TABLET.equals(tmpTaknkikiSbtCd) || JKKSvcConst.KKTK_SVC_CD_CRADLE.equals(tmpTaknkikiSbtCd)` [-> `"C021" or "C022"`] |
| 2 | SET | `statusCode = kappu_cancel(handle, param, inHashlist.get(i), resultHash)` // Pro-ration cancellation |
| 3 | IF | `statusCode != 0` // Check for error |
| 4 | RETURN | `return statusCode` // Early return on error |

**Block 12** — HYBRID TABLET SERVICE UPDATE (lines 3779–3786) [CONSTANT `PCRS_CD_3G_42M_HYBRID="A60"`] (L3779)

> After processing all equipment records, if the subscriber is on a hybrid plan (3G 4.2M Hybrid), updates tablet service contract info.

| # | Type | Code |
|---|------|------|
| 1 | SET | `pcrsCd = svcKeiMap.get(EKK0081A010CBSMsg1List.PCRS_CD)` |
| 2 | IF | `JKKSvcConst.PCRS_CD_3G_42M_HYBRID.equals(pcrsCd)` [-> `"A60"`] // Hybrid plan check |
| 3 | CALL | `updateTbltKei(handle, param, sysid, trgt_data.get(REQ_PARAM_IDO_DIV), tgSvckeiNo, pcrsCd)` |

**Block 13** — RETURN (line 3781) (L3781)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return statusCode` // Return processing status code |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `kktk_svc_kei` | Field | Equipment-provided service contract info — container key in workField for the ArrayList of equipment service contract records |
| `svc_kei` | Field | Service contract info — container key in workField for the service contract details map |
| `svc_kei_ucwk` | Field | Service contract detail info — internal work number container |
| `KKTK_SVC_KEI_KOJIAK` | Field | Equipment-provided service contract info (work order) — container for work order-related equipment service records |
| `kojiak_no` | Field | Work order number — input parameter identifying a work order case for residence change processing |
| `ido_div` | Field | Move classification — distinguishes the type of move/cancellation scenario |
| `svcCd` | Field | Service code — identifies the subscriber's main service type: Network (01), Telephone (02), or TV (03) |
| `tmpSvcKeiStat` | Field | Temporary service contract status — status code of the current equipment service record |
| `tmpTaknkikiSbtCd` | Field | Temporary equipment type sub-code — identifies the type of equipment device (ONU, V-ONU, HGW, Router, Tablet, etc.) |
| `tgKKtkSvcKeiNo` | Field | Target equipment-provided service contract number — the device's service contract number |
| `tgSvckeiNo` | Field | Target service contract number — the main subscriber service contract number |
| STAT_UK_ZUMI | Constant | Cancel completed — status "010", contract has been cancelled (キャンセル完了) |
| STAT_SHOSA_ZUMI | Constant | Investigation completed — status "020", investigation phase complete (調査完了) |
| STAT_CNC_ZUMI | Constant | Cancellation completed — status "030", cancellation process done (取消完了) |
| STAT_SVCTK_CHU | Constant | Service contract in progress — status "100", contract is currently active (契約中) |
| STAT_PAUSE_STP_CHU | Constant | Pause stop in progress — status "210", service is paused/stopped (一時停止中) |
| STAT_STP_CHU | Constant | Stop in progress — status "220", service is stopped (停止中) |
| STAT_DSL_ZUMI | Constant | DSL completed — status "910", DSL termination is complete (DSL完了) |
| STAT_CNCL_ZUMI | Constant | Cancel completed — status "920", cancellation is fully complete (キャンセル完了) |
| STAT_NORMAL | Constant | Normal termination — value 0, indicates successful processing |
| IDO_KBN_ADCHGADD | Constant | Residence change/registration classification — value "00019", indicates a work order for residence change or registration |
| CD00056_STAT_KEI_CHG_CHU | Constant | Contract change in progress — value "110", indicates a pending contract change order |
| KKTK_SVC_CD_ONU | Constant | ONU equipment code — value "C012", Optical Network Unit |
| KKTK_SVC_CD_VONU | Constant | V-ONU equipment code — value "C013", Virtual Optical Network Unit |
| KKTK_SVC_CD_HGW | Constant | Home Gateway equipment code — value "C025", eo Home Gateway |
| KKTK_SVC_CD_TABLET | Constant | Tablet equipment code — value "C021", tablet device |
| KKTK_SVC_CD_CRADLE | Constant | Tablet cradle equipment code — value "C022", tablet cradle accessory |
| KKTK_SVC_CD_TAKINO / "C024" | Constant | Takino Router equipment code — multi-function router for self-routing |
| PCRS_CD_3G_42M_HYBRID | Constant | Hybrid plan code — value "A60", 3G 4.2M hybrid service plan |
| FUNC_CODE_ONE | Constant | Function code 1 — value from JPCModelConstant.FUNC_CD_1, used as SC function code |
| FUNC_CODE_12 | Constant | Function code 12 — value "12", used for service contract list query in work order scenarios |
| SVC_CD_NET | Constant | Network service code — value "01", eo Hikari Network |
| SVC_CD_TEL | Constant | Telephone service code — value "02", eo Hikari Telephone |
| SVC_CD_TV | Constant | TV service code — value "03", eo Hikari TV |
| kappu_cancel | Method | Pro-ration contract cancellation — handles fee pro-ration for tablet/cradle devices |
| updateTbltKei | Method | Tablet service contract update — updates tablet-related service contract info for hybrid plan |
| kikiHaisoCancel | Method | Device delivery cancellation — cancels scheduled deliveries for devices when contract change is cancelled |
| callEKK0341C330SC | SC | Equipment service contract cancellation SC — performs the cancellation on the service contract |
| callEKK0341C340SC | SC | Equipment service contract rescission SC — performs the rescission (解約) on the service contract |
| callEKK0341C350SC | SC | Equipment service contract rescission confirmation SC — confirms and finalizes the rescission |
| callEKK0771A010SC | SC | Equipment service agreement call SC — retrieves/confirms service contract agreement data |
| callEKK0341A010SC | SC | Equipment operation service contract status query SC — queries device service contract status |
| callEKK0341B002SC | SC | Equipment service contract list query SC — retrieves service contract list with contract number |
| callEKK0341C170SC | SC | Service rate change cancellation SC — cancels pending rate plan changes |
| callEKK0341C540SC | SC | Equipment change processing cancellation SC — cancels pending device change operations |
| callEKU0011A010SC | SC | Work order agreement call SC — retrieves work order agreement information |
| editMapKKkopSvcUseKeiUpd | Method | Router contract update mapping — prepares data map for multi-function router contract updates |
| updateKkopSvcKeiTran | Method | Equipment operation service contract update main processing — performs the actual router contract update |
| キャンセル (Kyanseru) | Business term | Cancellation — contract termination initiated before service starts or during investigation |
| 解約 (Kaiyaku) | Business term | Rescission — contract termination for active/substantially completed contracts |
| 機器提供サービス | Business term | Equipment-provided service — service where K-Opticom provides customer-owned equipment (routers, ONUs, tablets) |
| 工事案件 | Business term | Work order case — field work order for installation, move, or cancellation |
| 住所変更・登録 | Business term | Residence change/registration — work order type for moving to a new address |
| 割契 | Business term | Pro-ration contract — contract handling fee prorated based on remaining service period |
| ホームゲートウェイ | Business term | Home Gateway — K-Opticom's branded home router device (eo Home Gateway) |
| タブレット | Business term | Tablet — tablet device provided as part of equipment-provided services |
