# Business Logic — FUW02301SFLogic.chkPayInitialCost() [28 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW02301SF.FUW02301SFLogic` |
| Layer | Service (Webview Logic Layer) |
| Module | `FUW02301SF` (Package: `eo.web.webview.FUW02301SF`) |

## 1. Role

### FUW02301SFLogic.chkPayInitialCost()

This method performs a **paid flag determination for initial fees** (有料フラグ判定（初期費用）処理). Its sole responsibility is to inspect the incoming `outputMap` — a data structure carrying processed screen output data — and determine whether an **initial cost (初期費用)** is present for the current service contract.

Specifically, the method navigates a two-level nested structure inside `outputMap`: it first checks for a parent entry identified by the key `"FUSV006401CC"`, then inspects the child list stored under the key `"EKK0721A010CBSMsg1List"`. If this child list is non-null and contains at least one entry, the method concludes that an initial fee applies and returns `true`; otherwise, it returns `false`.

This method follows a **data-inspection / delegation pattern** — it does not perform any database reads or service component calls. Instead, it operates purely on in-memory data structures that were previously populated by CBS (Call Back Service) layers or screen mappers. It serves as a **shared utility** within the `FUW02301SF` module, called by internal methods that need to branch processing based on whether initial costs are involved.

The conditional branching in calling methods determines downstream behavior: if an initial cost exists, the system may apply mansion-specific division logic (for fiber-optic subscription type "04" with unified account payment method "003") or set a free-flag to `false` (indicating the service is paid, not free).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["chkPayInitialCost(outputMap)"])
    CHECK_TITLE["Check: outputMap contains CC_TITLE_FUSV006401"]
    GET_PARENT["Get parentMap from outputMap[CC_TITLE_FUSV006401]"]
    CHECK_PARENT["Check: parentMap != null AND parentMap contains EKK0721A010_LIST"]
    GET_LIST["Get childList from parentMap[EKK0721A010_LIST]"]
    CHECK_CHILD["Check: childList != null AND childList.size() > 0"]
    HAS_COST["Set res = true"]
    NO_COST["Set res = false"]
    RETURN(["Return res"])

    START --> CHECK_TITLE
    CHECK_TITLE -->|true| GET_PARENT
    CHECK_TITLE -->|false| NO_COST
    GET_PARENT --> CHECK_PARENT
    CHECK_PARENT -->|true| GET_LIST
    CHECK_PARENT -->|false| NO_COST
    GET_LIST --> CHECK_CHILD
    CHECK_CHILD -->|true| HAS_COST
    CHECK_CHILD -->|false| NO_COST
    HAS_COST --> RETURN
    NO_COST --> RETURN
```

**CRITICAL — Constant Resolution:**

| Constant Key | Resolved Value | Business Meaning |
|-------------|---------------|------------------|
| `CC_TITLE_FUSV006401` | `"FUSV006401CC"` | Parent information area key — identifies the section in `outputMap` that holds initial cost detail data, originally populated by FUSV0064 CBS mapper |
| `EKK0721A010_LIST` | `"EKK0721A010CBSMsg1List"` | Child list key — the list of initial cost detail records stored under the parent area; a non-empty list means initial fees are charged |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `outputMap` | `HashMap` | The screen output data map carrying processed business data from prior CBS/mapper execution. It contains nested entry structures keyed by constant identifiers (e.g., `"FUSV006401CC"` for parent area, `"EKK0721A010CBSMsg1List"` for child cost detail list). This method reads from the map but never writes to it. |

**Instance fields / external state read:**
- None. This method is stateless — it reads only the `outputMap` parameter and local variables.

## 4. CRUD Operations / Called Services

This method performs **no CRUD operations**. It is a pure in-memory data inspection routine that navigates nested `HashMap` and `ArrayList` structures without calling any service component (SC), call-back service (CBS), or database access method.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| *(none)* | — | — | — | This method is a pure data inspection utility with no database or service calls. It reads from in-memory `outputMap` structures previously populated by CBS/mapper layers. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Method: `getMansionDiv()` (FUW02301SFLogic) | `getMansionDiv()` -> `chkPayInitialCost(outputMap)` | *(none — pure data inspection)* |
| 2 | Method: `setFreeFlg()` (FUW02301SFLogic) | `setFreeFlg(bean, outputMap)` -> `chkPayInitialCost(outputMap)` | *(none — pure data inspection)* |

**Call chain details:**

- **Caller 1 — `getMansionDiv()`:** At line 1098, this method is called as part of a compound condition: if the process group code equals `"04"` (eo Hikari Net Mansion type) AND the reception contract payment method code equals `"003"` (all-account unified payment method) AND `chkPayInitialCost` returns `true`, then `mansionDiv` is set to `true`. This flag controls mansion-specific division logic for fiber-optic service contracts.

- **Caller 2 — `setFreeFlg()`:** At line 1117, this method is called to determine whether the service should be flagged as free. If `chkPayInitialCost` returns `true`, the method sets `res = false` (meaning the service is paid, not free). This controls billing-free status for the user interface.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] *(Initialization)* (L1133-L1134)

> Initialize local variables. Result defaults to `false` (no initial cost) and parent map is null.

| # | Type | Code |
|---|------|------|
| 1 | SET | `res = false` // Default: no initial fee exists |
| 2 | SET | `parentMap = null` // Parent area map to be populated |

**Block 2** — [IF] `(outputMap.containsKey(CC_TITLE_FUSV006401))` (L1136)

> Check whether the output map contains the parent information area entry. Constant `CC_TITLE_FUSV006401 = "FUSV006401CC"` identifies the section for initial cost detail data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `parentMap = (HashMap) outputMap.get(CC_TITLE_FUSV006401)` // Extract parent map -> `[-> CC_TITLE_FUSV006401="FUSV006401CC"]` |

**Block 3** — [IF] `(null != parentMap && parentMap.containsKey(EKK0721A010_LIST))` (L1141)

> Check that the parent map is non-null and contains the child list entry. Constant `EKK0721A010_LIST = "EKK0721A010CBSMsg1List"` identifies the list of initial cost detail records.

| # | Type | Code |
|---|------|------|
| 1 | SET | `childList = (ArrayList) parentMap.get(EKK0721A010_LIST)` // Retrieve child cost detail list -> `[-> EKK0721A010_LIST="EKK0721A010CBSMsg1List"]` |

**Block 4** — [IF] `(childList != null && childList.size() > 0)` (L1145)

> Check that the child list exists and contains at least one element. If so, an initial cost is present.

| # | Type | Code |
|---|------|------|
| 1 | SET | `res = true` // 初期費用がある場合 (Initial cost exists) [L1146] |

**Block 4.M** — [ELSE] — *(childList is null or empty)* (L1148)

> The child list is absent or empty, meaning no initial cost records are present.

| # | Type | Code |
|---|------|------|
| 1 | SET | `res = false` // 初期費用がない場合 (No initial cost) [L1149] |

**Block 5** — [RETURN] (L1153)

> Return the computed result to the caller.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return res;` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `chkPayInitialCost` | Method | Paid initial fee determination — checks whether an initial cost (initial fee for service enrollment) is associated with the current contract |
| `outputMap` | Field | Screen output data map — HashMap carrying all processed business data from CBS/mapper layers, organized by keyed entry areas |
| `parentMap` | Field | Parent information area — nested HashMap within `outputMap` that holds grouped cost detail records |
| `childList` | Field | Child cost detail list — ArrayList within `parentMap` containing individual initial cost line items |
| `res` | Field | Result boolean — `true` indicates initial fees apply, `false` indicates no initial fees |
| `CC_TITLE_FUSV006401` | Constant | Key `"FUSV006401CC"` — identifies the parent information area in `outputMap` for initial cost data, originally set by FUSV0064 CBS mapper |
| `EKK0721A010_LIST` | Constant | Key `"EKK0721A010CBSMsg1List"` — identifies the child list within the parent area that holds initial cost detail records |
| 初期費用 (Shoki Hiyo) | Japanese term | Initial fee / initial cost — one-time charge applied when enrolling in a telecommunications service |
| 有料フラグ (Yuryou Flag) | Japanese term | Paid flag — boolean indicator of whether a cost applies (as opposed to free) |
| mansionDiv | Field | Mansion division flag — set to `true` when the service is an eo Hikari Net Mansion type (process group "04") with unified payment (method "003") and initial costs exist |
| eo 光ネットマンションタイプ | Japanese business term | eo Hikari Net Mansion type — fiber-optic internet service bundled for multi-dwelling units, process group code "04" |
| 全戸一括 (Zenko Ichidoku) | Japanese business term | All-account unified payment method — a single payment method covering all units in a mansion, payment method code "003" |
