# Business Logic — JKKCancelSvcKeiCC.executeKojiakCC() [355 LOC]

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

## 1. Role

### JKKCancelSvcKeiCC.executeKojiakCC()

This method performs the **construction case coordination processing (工事CC実行処理)** within the service contract cancellation (サービス契約キャンセル) workflow of the K-Opticom customer core system. It is responsible for identifying which construction cases (工事案件) require coordination when a service contract is being cancelled, and then invoking the appropriate downstream processing to update construction-related records.

The method implements a **dual-loop filtering and dispatch pattern**. The first loop evaluates construction cases for **multi-change coordination (諸変更連携)** — when existing service modifications need to be synchronized with the cancellation. The second loop evaluates the same cases for **cancellation coordination (取消連携)** — when the cancellation itself must be propagated to construction records. Between the two loops, if the first loop finds a qualifying record, it immediately calls `executeKojiakCCKkifChg` for multi-change processing.

The method acts as a **shared utility** called from the `ctlCancelData` method within the same class. It serves as the bridge between the service contract cancellation logic and the construction management subsystem, ensuring that construction case statuses are properly updated or reconciled when a customer's service subscription is terminated.

The method iterates over a list of construction case data retrieved from `workField` under the `SVCKEI_KOJIAK` key. For each construction case, it calls a service component to retrieve the latest status and applies a complex set of rules based on: construction case status (KOJIAK_STAT), mansion construction case status code (MANS_KOJIAK_STAT_CD), construction case type code (KOJIAK_SBT_CD), whether it is the latest basic construction (RCNT_KIHON_KOJI_FLG), and whether a specific construction case number was provided in the request. Based on these criteria, the method selects a target construction case record, maps the data through `mappingKojiCC`, and triggers `executeKojiAnken` to finalize the construction case processing.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeKojiakCC"])
    END_NODE(["Return / Next"])

    START --> GetWorkField["Get workField maps SVC_KEI, MSKM_DTL, SVCKEI_KOJIAK"]
    GetWorkField --> CheckEmpty{eKU0081B010Hash
null or empty?}
    CheckEmpty -->|Yes| EARLY_RETURN1["Return early"]
    CheckEmpty -->|No| Loop1Start["Loop through inHashlist"]
    EARLY_RETURN1 --> END_NODE
    Loop1Start --> CallEKU0011A010SC["Call callEKU0011A010SC"]
    CallEKU0011A010SC --> GetStatus["Get KOJIAK_STAT, MANS_KOJIAK_STAT_CD, KOJIAK_SBT_CD"]
    GetStatus --> CheckReqKojiakNo{Is KOJIAK_NO set?}
    CheckReqKojiakNo -->|Yes| CheckRejectType{SBT is TK_DSL or AD_CHG_TEKKYO?}
    CheckRejectType -->|Yes| Continue1["continue"]
    CheckRejectType -->|No| CheckStat{Is STP or WK_FIN?}
    CheckReqKojiakNo -->|No| CheckStat
    CheckStat -->|Yes| Continue2["continue"]
    CheckStat -->|No| CheckStatFin{Is KOJIAK_STAT FIN 200?}
    CheckStatFin -->|Yes| CheckRcntKihon["Get RCNT_KIHON_KOJI_FLG, SBT_CD, AD_CHG_FIX_DTM"]
    CheckStatFin -->|No| CheckStatAdd{Is KOJIAK_STAT ADD 120?}
    CheckRcntKihon --> CheckRcnt0{RCNT_KIHON equals 0?}
    CheckRcnt0 -->|Yes| CheckRcnt0Sub{SBT equals 003 and no AD_CHG_FIX_DTM?}
    CheckRcnt0Sub -->|Yes| FoundCandidate1["Set eKU0081B010HashNew, break"]
    CheckRcnt0Sub -->|No| Continue3["continue"]
    CheckRcnt0 -->|No| CheckRcnt1{RCNT_KIHON equals 1?}
    CheckRcnt1 -->|Yes| FoundCandidate2["Set eKU0081B010HashNew, break"]
    CheckRcnt1 -->|No| Continue4["continue"]
    CheckStatAdd -->|Yes| CheckMansStat{MANS_KOJIAK_STAT_CD is UKTZ or IRIZ or KJCOMPFIX or KJFIN?}
    CheckMansStat -->|Yes| FoundCandidate3["Set eKU0081B010HashNew, break"]
    CheckMansStat -->|No| Continue5["continue"]
    CheckStatAdd -->|No| CheckOtherStat{KOJIAK_STAT is 130 to 180?}
    CheckOtherStat -->|Yes| FoundCandidate4["Set eKU0081B010HashNew, break"]
    CheckOtherStat -->|No| Continue6["continue"]
    Continue1 --> Loop1Next["Next iteration"]
    Continue2 --> Loop1Next
    Continue3 --> Loop1Next
    Continue4 --> Loop1Next
    Continue5 --> Loop1Next
    Continue6 --> Loop1Next
    Loop1Next --> Loop1Check{i less than size}
    Loop1Check -->|Yes| CallEKU0011A010SC
    Loop1Check -->|No| CheckHashNew{eKU0081B010HashNew not null?}
    FoundCandidate1 --> Loop1Next
    FoundCandidate2 --> Loop1Next
    FoundCandidate3 --> Loop1Next
    FoundCandidate4 --> Loop1Next
    CheckHashNew -->|Yes| CallKkifChg["Call executeKojiakCCKkifChg"]
    CheckHashNew -->|No| Loop2Start["Start second loop cancel flow"]
    CallKkifChg --> Loop2Start
    Loop2Start --> CallEKU0011A010SC2["Call callEKU0011A010SC"]
    CallEKU0011A010SC2 --> GetStatus2["Get KOJIAK_STAT, MANS_KOJIAK_STAT_CD, KOJIAK_SBT_CD"]
    GetStatus2 --> CheckReqKojiakNo2{Is KOJIAK_NO set?}
    CheckReqKojiakNo2 -->|Yes| CheckRejectType2{SBT is TK_DSL or AD_CHG_TEKKYO?}
    CheckRejectType2 -->|Yes| Continue7["continue"]
    CheckRejectType2 -->|No| CheckStat2{Is STP?}
    CheckReqKojiakNo2 -->|No| CheckStat2
    CheckStat2 -->|Yes| Continue8["continue"]
    CheckStat2 -->|No| CheckStatFin2{Is KOJIAK_STAT FIN 200?}
    CheckStatFin2 -->|Yes| CheckRcnt2["Get RCNT_KIHON, SBT_CD, AD_CHG_FIX_DTM"]
    CheckStatFin2 -->|No| CheckStatAdd2{Is KOJIAK_STAT ADD 120?}
    CheckRcnt2 --> CheckRcnt0_2{RCNT_KIHON equals 0?}
    CheckRcnt0_2 -->|Yes| CheckRcnt0Sub2{SBT equals 003 and no AD_CHG_FIX_DTM?}
    CheckRcnt0Sub2 -->|Yes| FoundCandidate5["Set eKU0081B010HashNew, break"]
    CheckRcnt0Sub2 -->|No| Continue9["continue"]
    CheckRcnt0_2 -->|No| CheckRcnt1_2{RCNT_KIHON equals 1?}
    CheckRcnt1_2 -->|Yes| FoundCandidate6["Set eKU0081B010HashNew, break"]
    CheckRcnt1_2 -->|No| Continue10["continue"]
    CheckStatAdd2 -->|Yes| CheckMansStat2{MANS_KOJIAK_STAT_CD is UKTZ or IRIZ or KJCOMPFIX?}
    CheckMansStat2 -->|Yes| FoundCandidate7["Set eKU0081B010HashNew, break"]
    CheckMansStat2 -->|No| Continue11["continue"]
    CheckStatAdd2 -->|No| CheckOtherStat2{KOJIAK_STAT is 130 to 190?}
    CheckOtherStat2 -->|Yes| FoundCandidate8["Set eKU0081B010HashNew, break"]
    CheckOtherStat2 -->|No| Continue12["continue"]
    Continue7 --> Loop2Next["Next iteration"]
    Continue8 --> Loop2Next
    Continue9 --> Loop2Next
    Continue10 --> Loop2Next
    Continue11 --> Loop2Next
    Continue12 --> Loop2Next
    Loop2Next --> Loop2Check{i less than size}
    Loop2Check -->|Yes| CallEKU0011A010SC2
    Loop2Check -->|No| CheckHashNew2{eKU0081B010HashNew not null?}
    FoundCandidate5 --> Loop2Next
    FoundCandidate6 --> Loop2Next
    FoundCandidate7 --> Loop2Next
    FoundCandidate8 --> Loop2Next
    CheckHashNew2 -->|No| Return1["Return"]
    CheckHashNew2 -->|Yes| Mapping["Call mappingKojiCC"]
    Mapping --> SetParam["param.setData workFixedText targetMap"]
    SetParam --> CallKojiAnken["kojiCC.executeKojiAnken"]
    CallKojiAnken --> END_NODE
```

### Flow Description

The method follows two sequential loop phases:

**Phase 1 — Multi-Change Coordination Filter (L6370–L6550):** Iterates over all construction case records from `workField`. For each record, it queries the latest construction case consent result via `callEKU0011A010SC`, then applies filtering rules. If a construction case type is "cancellation (termination)" or "address change (reservation)", it is skipped. If the status is "stopped" or "on-site work completed", it is skipped. For "completed" cases, it checks whether it is the latest basic construction. For "registered" (ADD) cases, it checks mansion-specific status codes. For intermediate statuses (130–180), it directly qualifies. The first matching record sets `eKU0081B010HashNew` and breaks.

**Multi-change callback (L6542–L6550):** If a candidate was found, `executeKojiakCCKkifChg` is invoked for multi-change processing (equipment info changes, construction cost issuance).

**Phase 2 — Cancellation Coordination Filter (L6560–L6680):** A second loop with similar but not identical filtering rules. The key differences: STP check also includes `mansKojiakStatCd` (but no `WK_FIN`), the ADD(120) mansion status check excludes `KJFIN`, and the intermediate status range is wider (130–190 instead of 130–180). This is the cancellation coordination branch.

**Phase 3 — Mapping and Dispatch (L6690–L6698):** If a target record was identified, `mappingKojiCC` maps the target data and the result is set into `param`. Finally, `executeKojiAnken` is called to process the construction case.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | Request parameter object carrying the model group, control map, and cancellation request context. Used to store mapped output data via `setData()`. |
| 2 | `handle` | `SessionHandle` | Session management handle containing context such as database connections, transaction boundaries, and security credentials. Passed through to service calls and downstream constructors. |
| 3 | `trgt_data` | `HashMap<String, Object>` | Target data map containing the cancellation request payload, including the input construction case number (`REQ_PARAM_KOJIAK_NO` / `"kojiak_no"`). Used to filter construction cases by a specific case number when set. |
| 4 | `workField` | `HashMap<String, Object>` | Work area map shared across the cancellation workflow. Contains pre-populated service contract consent data (`SVC_KEI`), order detail consent data (`MSKM_DTL`), and construction case list data (`SVCKEI_KOJIAK` as `ArrayList<HashMap<String, Object>>`). |

**Instance fields / external state:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `cancelSvcKeiMapper` | `JKKCancelSvcKeiMapperCC` | Mapper component instance (inherited from parent `AbstractCommonComponent`) used to map target data for construction case processing |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKCancelSvcKeiCC.callEKU0011A010SC` | EKU0011A010SC | Construction case consent table | Calls `callEKU0011A010SC` to retrieve construction case consent data (status, type codes, mansion status) for a given construction case number. Executed twice per record — once in multi-change loop, once in cancel loop. |
| - | `JKKCancelSvcKeiCC.executeKojiakCCKkifChg` | - | - | Calls `executeKojiakCCKkifChg` to process multi-change coordination for equipment information changes. Invoked only when Phase 1 finds a qualifying construction case. |
| - | `JKKCancelSvcKeiCC.isNull` | - | - | Utility method for null/empty string checking on construction case number input validation. |
| - | `JKKCancelSvcKeiMapperCC.mappingKojiCC` | - | - | Calls `mappingKojiCC` to map and transform cancellation request data (target data, work field, service contract data, order detail data, construction case list) into the format expected by the construction case processor. |
| - | `JKKKojiAnkenCC.executeKojiAnken` | - | - | Calls `executeKojiAnken` on a new `JKKKojiAnkenCC` instance to finalize the construction case processing, receiving the mapped target data and a fixed text key `"KojiakCC"`. |
| R | `JKKStrConst.CD01651_UKTZ.getString` | - | - | Constant reference: mansion construction case status "under modification" (変更中). |
| R | `JKKStrConst.CD01651_IRIZ.getString` | - | - | Constant reference: mansion construction case status "irregular" ( irregular /  irregular). |
| R | `JKKStrConst.CD01651_KJCOMPFIX.getString` | - | - | Constant reference: mansion construction case status "construction completed-fixing" (工事完成-fix). |
| R | `JKKStrConst.CD01651_KJFIN.getString` | - | - | Constant reference: mansion construction case status "construction completed" (工事完了). |
| R | `JKKStrConst.CD00474_130` through `CD00474_190` | - | - | Constant references: construction case status codes 130 (modification) through 190 (on-site work completed). |
| - | `JBSbatAKKshkmRsltInfoTukiawsday.setData` | JBSbatAKKshkmRsltInfoTukiawsday | - | Called within `executeKojiakCCKkifChg` (delegated call). |
| - | `JBSbatAKKshkmRsltInfoTukiaws.setData` | JBSbatAKKshkmRsltInfoTukiaws | - | Called within `executeKojiakCCKkifChg` (delegated call). |
| - | `JBSbatAKKshkmRsltInfoTukiawsRealSkh.setData` | JBSbatAKKshkmRsltInfoTukiawsRealSkh | - | Called within `executeKojiakCCKkifChg` (delegated call). |
| - | `JBSbatAKKshkmRsltInfTkCvsNCnsl.setData` | JBSbatAKKshkmRsltInfTkCvsNCnsl | - | Called within `executeKojiakCCKkifChg` (delegated call). |
| R | `JBSbatFUCaseFileRnkData.getString` | JBSbatFUCaseFileRnkData | - | Called within `executeKojiakCCKkifChg` (delegated call). |
| R | `JBSbatFUMoveNaviData.getString` | JBSbatFUMoveNaviData | - | Called within `executeKojiakCCKkifChg` (delegated call). |
| - | `JBSbatKKGetCTITelno.setData` | JBSbatKKGetCTITelno | - | Called within `executeKojiakCCKkifChg` (delegated call). |
| R | `JBSbatZMAdDataSet.getString` | JBSbatZMAdDataSet | - | Called within `executeKojiakCCKkifChg` (delegated call). |
| R | `JESC0101B010TPMA.getString` | JESC0101B010TPMA | - | Called within `executeKojiakCCKkifChg` (delegated call). |
| R | `JESC0101B020TPMA.getString` | JESC0101B020TPMA | - | Called within `executeKojiakCCKkifChg` (delegated call). |

## 5. Dependency Trace

### Caller

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Class: `JKKCancelSvcKeiCC.ctlCancelData` | `ctlCancelData` -> `executeKojiakCC` | `callEKU0011A010SC [R]`, `executeKojiakCCKkifChg [-]`, `mappingKojiCC [-]`, `executeKojiAnken [-]` |

**How it fits in the larger flow:** `ctlCancelData` is the data cancellation execution control method within `JKKCancelSvcKeiCC`. It orchestrates the full service contract cancellation process — including equipment cancellation, opt-in mail cancellation, call-cancel detail cancellation, and then invokes `executeKojiakCC` to handle the construction case coordination aspect of the cancellation.

### Terminal operations reached from this method

| Terminal | Type | Description |
|----------|------|-------------|
| `callEKU0011A010SC` | R | Reads construction case consent data for each case in the list |
| `executeKojiakCCKkifChg` | - | Multi-change processing for equipment information (when Phase 1 finds a candidate) |
| `mappingKojiCC` | - | Maps cancellation target data for construction case processing |
| `executeKojiAnken` | - | Finalizes construction case processing |

## 6. Per-Branch Detail Blocks

### Block 1 — Initialization (L6353–L6376)

> Initialize local variables and retrieve pre-populated data from the work field.

| # | Type | Code |
|---|------|------|
| 1 | SET | `targetMap = new HashMap<String, Object>()` // Local target map for mapping output |
| 2 | SET | `eKK0081A010Hash = (HashMap) workField.get(SVC_KEI)` // Service contract consent result [-> SVC_KEI="svc_kei"] |
| 3 | SET | `eKK0021A010Hash = (HashMap) workField.get(MSKM_DTL)` // Order detail consent result [-> MSKM_DTL="mskm_dtl"] |
| 4 | SET | `eKU0081B010Hash = (ArrayList) workField.get(SVCKEI_KOJIAK)` // Service contract + construction case list [-> SVCKEI_KOJIAK="svckei_kojiak"] |
| 5 | SET | `kojiCC = new JKKKojiAnkenCC()` // Construction case processor instance |
| 6 | SET | `workFixedText = "KojiakCC"` // Fixed text key for data identification |

### Block 2 — Empty Construction Case Check (L6380–L6388)

> **IF** construction case list is null or empty, return early. This was changed from checking a single HashMap to checking an ArrayList size (LT-2013-0000380).

| # | Type | Code |
|---|------|------|
| 1 | IF | `null == eKU0081B010Hash || 1 > eKU0081B010Hash.size()` |
| 2 | RETURN | `return` // No construction case records to process |

### Block 3 — Phase 1: Multi-Change Coordination Loop (L6390–L6550)

> First loop: evaluate construction cases for multi-change coordination eligibility.

#### Block 3.1 — Loop Entry and Service Call (L6392–L6411)

> For each construction case in `inHashlist`, call the EKU0011A010SC service to get the latest consent data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inHashlist = (ArrayList) workField.get(SVCKEI_KOJIAK)` // Re-assign for loop iteration |
| 2 | FOR | `for(int i = 0; i < inHashlist.size(); i++)` |
| 3 | CALL | `callEKU0011A010SC(param, handle, kojiakNo)` // Get construction case consent |
| 4 | SET | `eku0011a010ListMsg = eku0011a010Msg.getCAANMsgList(...)[0]` // Extract first list message |
| 5 | SET | `kojiakStat = eku0011a010ListMsg.getString(KOJIAK_STAT)` // Construction case status |
| 6 | SET | `mansKojiakStatCd = eku0011a010ListMsg.getString(MANS_KOJIAK_STAT_CD)` // Mansion construction case status code |
| 7 | SET | `kojiakSbt = eku0011a010ListMsg.getString(KOJIAK_SBT_CD)` // Construction case type code |
| 8 | SET | `kojiakNo = (String) trgt_data.get(REQ_PARAM_KOJIAK_NO)` // Input construction case number [-> REQ_PARAM_KOJIAK_NO="kojiak_no"] |

#### Block 3.2 — Reject Type Skip Check (L6415–L6424) [CONSTANTS: `KOJIAK_SBT_TK_DSL = JKKStrConst.CD00577_TK_DSL` (cancellation/termination), `KOJIAK_SBT_AD_CHG_TEKKYO = JKKStrConst.CD00577_ADCHG_TK` (address change reservation)]

> **IF** the input construction case number is set and the type is "cancellation (termination)" or "address change (reservation)", skip this construction case.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!isNull(kojiakNo) && !"".equals(kojiakNo)` |
| 2.1 | IF | `KOJIAK_SBT_TK_DSL.equals(kojiakSbt) || KOJIAK_SBT_AD_CHG_TEKKYO.equals(kojiakSbt)` [-> CD00577_TK_DSL="cancellation/termination" OR CD00577_ADCHG_TK="address change reservation"] |
| 2.2 | EXEC | `continue` // Skip CC call for these rejection types |

#### Block 3.3 — Status Skip: Stopped or On-site Work Completed (L6427–L6434) [CONSTANTS: `KOJIAK_STAT_STP = "900"` (stopped), `KOJIAK_STAT_WK_FIN = "190"` (on-site work completed)]

> **IF** status is "stopped" or "on-site work completed" (or mansion status is stopped), skip.

| # | Type | Code |
|---|------|------|
| 1 | IF | `KOJIAK_STAT_STP.equals(kojiakStat) \|\| KOJIAK_STAT_WK_FIN.equals(kojiakStat) \|\| KOJIAK_STAT_STP.equals(mansKojiakStatCd)` [-> STP="900" OR WK_FIN="190"] |
| 2 | EXEC | `continue` // Skip CC call for these statuses |

#### Block 3.4 — Status FIN Branch: Completed Cases (L6437–L6490) [CONSTANTS: `KOJIAK_STAT_FIN = "200"` (completed)]

> **IF** status is "completed" (200), evaluate latest basic construction flag and address change details.

| # | Type | Code |
|---|------|------|
| 1 | IF | `KOJIAK_STAT_FIN.equals(kojiakStat) \|\| KOJIAK_STAT_FIN.equals(mansKojiakStatCd)` [-> FIN="200"] |
| 2 | SET | `rcntKihonKojiFlg = eku0011a010ListMsg.getString(RCNT_KIHON_KOJI_FLG)` // Latest basic construction flag |
| 3 | SET | `kojiakSbtCd = eku0011a010ListMsg.getString(KOJIAK_SBT_CD)` // Construction case type code |
| 4 | SET | `adChgFixDtm = eku0011a010ListMsg.getString(AD_CHG_FIX_DTM)` // Address change confirmation date/time |
| 5 | IF | `"0".equals(rcntKihonKojiFlg)` (OM-2017-0001289: fixed from `==` to `.equals`) |
| 5.1 | IF | `KOJIAK_SBT_AD_CHG_NEW.equals(kojiakSbtCd) && ("".equals(adChgFixDtm) \|\| isNull(adChgFixDtm))` [-> AD_CHG_NEW="003"] |
| 5.2 | SET | `eKU0081B010HashNew = inHashlist.get(i)` // Qualifies as target |
| 5.3 | EXEC | `break` // Found candidate, exit loop |
| 5.4 | ELSE | `continue` // Not address change new or already confirmed |
| 6 | IF | `"1".equals(rcntKihonKojiFlg)` |
| 6.1 | SET | `eKU0081B010HashNew = inHashlist.get(i)` // Latest basic construction, always qualifies |
| 6.2 | EXEC | `break` |
| 7 | ELSE | `continue` // Unhandled flag value |

#### Block 3.5 — Status ADD Branch: Registered Cases (L6493–L6535) [CONSTANTS: `KOJIAK_STAT_ADD = "120"` (registered)]

> **IF** status is "registered" (120), check mansion-specific status codes.

| # | Type | Code |
|---|------|------|
| 1 | IF | `KOJIAK_STAT_ADD.equals(kojiakStat)` [-> ADD="120"] |
| 2.1 | IF | `mansKojiakStatCd` is UKTZ or IRIZ or KJCOMPFIX or KJFIN |
| 2.1.1 | SET | `eKU0081B010HashNew = inHashlist.get(i)` // Qualifies as target |
| 2.1.2 | EXEC | `break` |
| 2.2 | ELSE | `continue` |
| 3 | ELSE IF | `kojiakStat` is 130 to 180 |
| 3.1 | SET | `eKU0081B010HashNew = inHashlist.get(i)` // Intermediate statuses qualify |
| 3.2 | EXEC | `break` |
| 4 | ELSE | `continue` |

#### Block 3.6 — Multi-change Callback Decision (L6538–L6550)

> After Phase 1 loop, check if a candidate was found.

| # | Type | Code |
|---|------|------|
| 1 | IF | `eKU0081B010HashNew == null` |
| 1.1 | EXEC | (empty — continue to Phase 2, processing interrupted will be skipped per OM-2014-0003101) |
| 2 | ELSE | `executeKojiakCCKkifChg(param, handle, trgt_data, workField, eKU0081B010HashNew)` // Invoke multi-change CC |

### Block 4 — Phase 2: Cancellation Coordination Loop (L6560–L6680)

> Second loop: evaluate construction cases for cancellation coordination eligibility. The conditions are slightly different from Phase 1.

#### Block 4.1 — Loop Entry and Service Call (L6561–L6582)

| # | Type | Code |
|---|------|------|
| 1 | FOR | `for(int i = 0; i < inHashlist.size(); i++)` |
| 2 | CALL | `callEKU0011A010SC(param, handle, kojiakNo)` // Same service call as Phase 1 |
| 3 | SET | `kojiakStat = eku0011a010ListMsg.getString(KOJIAK_STAT)` |
| 4 | SET | `mansKojiakStatCd = eku0011a010ListMsg.getString(MANS_KOJIAK_STAT_CD)` |
| 5 | SET | `kojiakSbt = eku0011a010ListMsg.getString(KOJIAK_SBT_CD)` |
| 6 | SET | `kojiakNo = (String) trgt_data.get(REQ_PARAM_KOJIAK_NO)` |

#### Block 4.2 — Reject Type Skip Check (L6583–L6592)

> Same reject type check as Block 3.2: skip cancellation/termination and address change reservation types.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!isNull(kojiakNo) && !"".equals(kojiakNo)` |
| 2 | IF | `KOJIAK_SBT_TK_DSL.equals(kojiakSbt) \|\| KOJIAK_SBT_AD_CHG_TEKKYO.equals(kojiakSbt)` |
| 2.1 | EXEC | `continue` |

#### Block 4.3 — Status STP Skip (L6592–L6595)

> Note: Only checks STP on both `kojiakStat` and `mansKojiakStatCd`. Does NOT check `WK_FIN` (unlike Phase 1).

| # | Type | Code |
|---|------|------|
| 1 | IF | `KOJIAK_STAT_STP.equals(kojiakStat) \|\| KOJIAK_STAT_STP.equals(mansKojiakStatCd)` [-> STP="900"] |
| 2 | EXEC | `continue` |

#### Block 4.4 — Status FIN Branch (L6596–L6647) [CONSTANTS: `KOJIAK_STAT_FIN = "200"`]

> Similar to Block 3.4 but without mansion status check on FIN comparison.

| # | Type | Code |
|---|------|------|
| 1 | IF | `KOJIAK_STAT_FIN.equals(kojiakStat) \|\| KOJIAK_STAT_FIN.equals(mansKojiakStatCd)` |
| 2 | SET | `rcntKihonKojiFlg`, `kojiakSbtCd`, `adChgFixDtm` |
| 3 | IF | `"0".equals(rcntKihonKojiFlg)` |
| 3.1 | IF | `KOJIAK_SBT_AD_CHG_NEW.equals(kojiakSbtCd) && ("".equals(adChgFixDtm) \|\| isNull(adChgFixDtm))` |
| 3.2 | SET | `eKU0081B010HashNew = inHashlist.get(i)` |
| 3.3 | EXEC | `break` |
| 4 | IF | `"1".equals(rcntKihonKojiFlg)` |
| 4.1 | SET | `eKU0081B010HashNew = inHashlist.get(i)` |
| 4.2 | EXEC | `break` |

#### Block 4.5 — Status ADD Branch (Cancellation-specific) (L6654–L6680)

> Similar to Block 3.5 but with different mansion status codes (no KJFIN) and wider intermediate range (130–190 vs 130–180).

| # | Type | Code |
|---|------|------|
| 1 | IF | `KOJIAK_STAT_ADD.equals(kojiakStat)` [-> ADD="120"] |
| 2.1 | IF | `mansKojiakStatCd` is UKTZ or IRIZ or KJCOMPFIX (no KJFIN) |
| 2.1.1 | SET | `eKU0081B010HashNew = inHashlist.get(i)` |
| 2.1.2 | EXEC | `break` |
| 3 | ELSE IF | `kojiakStat` is 130 to 190 (includes 190, unlike Phase 1) |
| 3.1 | SET | `eKU0081B010HashNew = inHashlist.get(i)` |
| 3.2 | EXEC | `break` |
| 4 | ELSE | `continue` |

#### Block 4.6 — Phase 2 Result Decision (L6683–L6691)

> After Phase 2 loop, check if a candidate was found. If not, return early. If yes, proceed to mapping.

| # | Type | Code |
|---|------|------|
| 1 | IF | `eKU0081B010HashNew == null` |
| 1.1 | RETURN | `return` // No target found for cancellation coordination |
| 2 | ELSE | (empty block — fall through to mapping) |

### Block 5 — Mapping and Dispatch (L6693–L6700)

> Map the target data and dispatch to the construction case processor.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `targetMap = cancelSvcKeiMapper.mappingKojiCC(trgt_data, workField, eKK0021A010Hash, eKK0081A010Hash, eKU0081B010HashNew)` // Map data using the Phase 2-found candidate |
| 2 | EXEC | `param.setData(workFixedText, targetMap)` // Store mapped result into param with key "KojiakCC" |
| 3 | CALL | `kojiCC.executeKojiAnken(handle, param, workFixedText)` // Execute construction case processing |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `kojiakCC` | Method | Construction case coordination processing — coordinates construction case records when service contracts are cancelled |
| `kojiakStat` | Field | Construction case status code — indicates the current state of a construction case in the workflow |
| `kojiakSbt` / `kojiakSbtCd` | Field | Construction case type code — classifies the kind of construction (e.g., new setup, address change, cancellation) |
| `kojiakNo` | Field | Construction case number — unique identifier for a construction case record |
| `kojiakStat_FIN` | Constant | Status "200" — Construction completed |
| `kojiakStat_STP` | Constant | Status "900" — Construction stopped/interrupted |
| `kojiakStat_ADD` | Constant | Status "120" — Construction case registered (pending processing) |
| `kojiakStat_WK_FIN` | Constant | Status "190" — On-site work completed |
| `mansKojiakStatCd` | Field | Mansion construction case status code — mansion-specific construction status (e.g., under modification, irregular, completed-fixing) |
| `rcntKihonKojiFlg` | Field | Latest basic construction flag — indicates whether this construction case is the latest basic/primary construction (0 = older, 1 = latest) |
| `adChgFixDtm` | Field | Address change confirmation date/time — timestamp when an address change was confirmed/finalized |
| `SVC_KEI` | Constant | Key `"svc_kei"` in workField — service contract consent data HashMap |
| `MSKM_DTL` | Constant | Key `"mskm_dtl"` in workField — order detail consent data HashMap |
| `SVCKEI_KOJIAK` | Constant | Key `"svckei_kojiak"` in workField — construction case list (ArrayList of HashMap) |
| `REQ_PARAM_KOJIAK_NO` | Constant | Key `"kojiak_no"` in target_data — input construction case number from cancellation request |
| `KOJIAK_SBT_TK_DSL` | Constant | Construction case type code for cancellation (termination) — from JKKStrConst.CD00577_TK_DSL |
| `KOJIAK_SBT_AD_CHG_TEKKYO` | Constant | Construction case type code for address change (reservation) — from JKKStrConst.CD00577_ADCHG_TK |
| `KOJIAK_SBT_AD_CHG_NEW` | Constant | `"003"` — Construction case type for address change (new setup) |
| `EKU0011A010SC` | SC Code | Service component for retrieving construction case consent data |
| `callEKU0011A010SC` | Method | Calls EKU0011A010SC to get construction case status and detail data |
| `executeKojiakCCKkifChg` | Method | Multi-change coordination processing for equipment information changes |
| `mappingKojiCC` | Method | Maps cancellation target data for construction case processing |
| `executeKojiAnken` | Method | Finalizes and executes construction case processing |
| `JKKKojiAnkenCC` | Class | Construction case processing component — handles construction case creation/update |
| `JKKCancelSvcKeiMapperCC` | Class | Mapper component for mapping service cancellation data |
| `CAANMsg` | Class | Cancellation/Answer message wrapper — holds service response data including list elements |
| CD01651_UKTZ | Constant | Mansion construction case status: "under modification" (変更中) |
| CD01651_IRIZ | Constant | Mansion construction case status: "irregular/abnormal" ( irregular) |
| CD01651_KJCOMPFIX | Constant | Mansion construction case status: "construction completed-fixing" (工事完成-fix) |
| CD01651_KJFIN | Constant | Mansion construction case status: "construction completed" (工事完了) |
| CD00474_130 through CD00474_190 | Constants | Construction case status codes: 130 (modification) → 190 (on-site work completed) |
| 工事CC | Japanese term | Construction Case Coordination — the process of coordinating construction records during service changes or cancellations |
| 工事案件 | Japanese term | Construction case — a record representing physical installation/maintenance work for a service contract |
| 諸変更 | Japanese term | Multi-change / various modifications — service contract changes that are neither new setup nor cancellation |
| 取消 | Japanese term | Cancellation — service contract termination processing |
| 工事完了 | Japanese term | Construction completed — status code 200 indicating all construction work is finished |
| 工事中止 | Japanese term | Construction stopped — status code 900 indicating construction was halted |
| 現場作業完了 | Japanese term | On-site work completed — status code 190 indicating physical on-site work is done |