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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW01901SF.FUW01901SFLogic` |
| Layer | Controller (webview) |
| Module | `FUW01901SF` (Package: `eo.web.webview.FUW01901SF`) |

## 1. Role

### FUW01901SFLogic.chkPayInitialCost()

This method performs a **paid flag determination for initial fees** (有料フラグ判定（初期費用）), which is a boolean check that answers a single business question: "Does this service order line item have an associated initial cost charge?" In the context of telecom service contracts (Mansion/Building contracts managed by the FUW01901SF screen), initial fees represent one-time installation charges such as construction fees, wiring costs, or setup expenses that are levied at the start of a service. The method is designed as a **delegation pattern** — it does not directly query a database or service component. Instead, it inspects the output map that has been pre-populated by a prior price matching process (`JFUWebCommon.setPrcInfoArea` with SC `FUSV005303SC`), extracting a nested child list that holds temporary payment line items (一時支払金額明細 — temporary payment price details). If the child list is non-null and contains at least one entry, the method concludes that an initial cost is present and returns `true`. Otherwise, it returns `false`. This makes `chkPayInitialCost` a **conditional guard** that controls downstream UI branching and processing decisions (e.g., whether to display initial cost fields on the screen).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["chkPayInitialCost(outputMap)"])
    COND_FUSV{outputMap contains FUSV005301CC?}
    GET_PARENT[Get parentMap from outputMap]
    COND_PARENT{parentMap valid AND contains EKK0721A010CBSMsg1List?}
    GET_CHILD[Get childList from parentMap]
    COND_CHILD{childList != null AND size > 0?}
    RET_TRUE[Set res = true - Initial cost exists]
    RET_FALSE[Set res = false - No initial cost]
    RETURN[Return res]

    START --> COND_FUSV
    COND_FUSV --> GET_PARENT
    GET_PARENT --> COND_PARENT
    COND_PARENT --> GET_CHILD
    GET_CHILD --> COND_CHILD
    COND_CHILD --> RET_TRUE
    COND_CHILD --> RET_FALSE
    RET_TRUE --> RETURN
    RET_FALSE --> RETURN
    COND_FUSV --> RET_DEFAULT[Set res = false]
    RET_DEFAULT --> RETURN
    COND_PARENT --> RET_DEFAULT
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `outputMap` | `HashMap` | A request-scoped output map that carries structured data for the FUW01901SF screen. It is pre-populated by prior processing (e.g., `JFUWebCommon.setPrcInfoArea`) and contains nested maps keyed by constant strings. The method inspects two nested levels: the top-level `FUSV005301CC` key (which maps to a parent context/price information map) and a second-level `EKK0721A010CBSMsg1List` key within that parent map (which holds the list of temporary payment line items). If either level is missing, the method safely returns `false` without errors. |

Instance fields read by this method:
- `FUSV005301CC` — A private static final String constant with value `"FUSV005301CC"`. Serves as the map key for the parent price info context.

## 4. CRUD Operations / Called Services

This method performs **no database operations or external service calls**. It only performs in-memory map lookups (`containsKey`, `get`) on the `outputMap` parameter and the nested `parentMap`. The data it inspects was previously populated by:

- `JFUWebCommon.setPrcInfoArea(bean, outputMap, FUSV005303SC, FUSV005301CC, JFUScreenConst.SCREEN_ID_FUW01901)` — Called elsewhere in this logic class (line 258) to populate the `outputMap` with price information via SC `FUSV005303SC`.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| (none) | — | — | — | No direct CRUD in this method; pure in-memory inspection. |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 method.
Terminal operations from this method: -

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | FUW01901SFLogic.getMansionDiv() | `FUW01901SFLogic.getMansionDiv()` -> `FUW01901SFLogic.chkPayInitialCost` | None (in-memory only) |

## 6. Per-Branch Detail Blocks

**Block 1** — INIT (L881-L884)

> Initialize local variables with default values.

| # | Type | Code |
|---|------|------|
| 1 | SET | `boolean res = false` // Default return value — no initial cost assumed |
| 2 | SET | `HashMap parentMap = null` // Will hold the nested map under FUSV005301CC |

**Block 2** — IF `(outputMap.containsKey(FUSV005301CC))` (L885-L888)
> Check if the output map contains the FUSV005301CC key, which represents the parent price information context. [FUSV005301CC = "FUSV005301CC"]

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `outputMap.containsKey(FUSV005301CC)` |
| 2 | SET | `parentMap = (HashMap)outputMap.get(FUSV005301CC)` // Retrieve the nested map keyed by FUSV005301CC |

**Block 3** — IF `(null != parentMap && parentMap.containsKey(EKK0721A010CBSMSG1LIST))` (L890-L892)
> Double-check that parentMap is not null AND that it contains the key for the temporary payment details list. [EKK0721A010CBSMSG1LIST = "EKK0721A010CBSMsg1List" —一時支払金額明細 (temporary payment price details)]

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `parentMap.containsKey(EKK0721A010CBSMSG1LIST)` |
| 2 | SET | `ArrayList childList = (ArrayList)parentMap.get(EKK0721A010CBSMSG1LIST)` // Extract the list of temporary payment line items |

**Block 4** — IF `(childList != null && childList.size() > 0)` (L894-L896)
> Verify that the child list of temporary payment items is both non-null and has at least one entry. If so, this means there IS an initial cost. [一時費用がある場合 (When initial cost exists)]

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `childList != null && childList.size() > 0` |
| 2 | SET | `res = true` // Initial cost is present |

**Block 5** — ELSE (L897-L899)
> The child list either does not exist or is empty — no initial cost. [一時費用がない場合 (When no initial cost exists)]

| # | Type | Code |
|---|------|------|
| 1 | SET | `res = false` // No initial cost detected |

**Block 6** — RETURN (L901)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return res` // true = initial cost exists, false = no initial cost |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `chkPayInitialCost` | Method | Paid flag determination for initial fees — checks whether a service order line item has an associated one-time installation/initial cost charge |
| `FUSV005301CC` | Constant | Key string ("FUSV005301CC") used in outputMap to store the parent price information context map; maps to price details populated by SC FUSV005303SC |
| `EKK0721A010CBSMSG1LIST` | Constant | Key string ("EKK0721A010CBSMsg1List") representing the temporary payment price details list (一時支払金額明細) — a list of child payment line items within the parent map |
|一時支払金額明細 | Field (Japanese) | Temporary payment price details — list of provisional payment items stored within the parent context; presence of entries indicates an initial cost charge |
| `FUSV005303SC` | SC Code | Service Component for fetching price information — used by `JFUWebCommon.setPrcInfoArea` to populate the outputMap with price data for screen FUW01901 |
| `parentMap` | Variable | Nested HashMap extracted from outputMap containing price context and child payment lists |
| `childList` | Variable | ArrayList of temporary payment line items; non-empty list signals the presence of an initial cost |
| `res` | Variable | Return flag — true means initial cost exists (有料), false means no initial cost (無料) |
| FUW01901SF | Screen/Module | Mansion (building) service contract screen — manages service order lines for multi-unit residential buildings |
| 初期費用 | Japanese term | Initial cost — one-time installation/setup/charges levied at service commencement (e.g., wiring, construction) |
| 有料フラグ判定 | Javadoc | Paid flag determination — the business purpose of this method, determining if charges apply |
