# Business Logic — FUW02001SFLogic.chkPayKoteiTanka() [42 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW02001SF.FUW02001SFLogic` |
| Layer | Web Application (Service / Logic Layer) |
| Module | `FUW02001SF` (Package: `eo.web.webview.FUW02001SF`) |

## 1. Role

### FUW02001SFLogic.chkPayKoteiTanka()

This method performs a **paid-flag determination for fixed unit prices** (有料フラグ判定（固定単価）) in the context of a web-based telecom service order and contract system. Its primary responsibility is to inspect the payment plan pricing details contained within a session-output map and determine whether any line item carries a fixed unit price (固定単価) exceeding zero — effectively answering the business question: "Does this service order include chargeable fixed-price items?"

The method implements a **hierarchical data extraction pattern**: it navigates a nested `HashMap` structure by first locating a specific child map keyed by service title (`SC_TITLE_FUSV005503`), then retrieving a list of child pricing entries (`EKK0601B001_LIST`), and finally iterating over those entries to evaluate each item's fixed amount (`PPLAN_KOTEI_AMNT`). This reflects a standard multi-layer data model where aggregate responses from service components are deserialized into nested maps for screen-level processing.

As a **shared utility method** (private, called by multiple sibling logic classes), `chkPayKoteiTanka` serves as a cross-cutting fee assessment function used across numerous FUW-xxx service framework screens. When any calling method needs to know whether a service line carries a non-zero fixed charge — such as during payment flag determination in `setPayFlg` — this method provides the authoritative yes/no answer. If at least one pricing child entry has a fixed amount strictly greater than 0, the method returns `true` (有料 — chargeable); otherwise it returns `false` (無料 — free/no charge).

The method iterates over all child items and returns the result of the **last evaluated item** — meaning that if multiple line items exist, the determination is driven solely by the pricing of the final item in the list. This design implies that the list order has business significance (e.g., primary service items follow secondary ones), or that the caller processes this result in the context of a single active item.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["chkPayKoteiTanka(outputMap)"])
    INIT["Set res = false; parentMap = null"]
    CHECK_OUTPUT["outputMap contains SC_TITLE_FUSV005503?"]
    GET_PARENT["parentMap = outputMap.get(FUSV005503SC)"]
    CHECK_PARENT["parentMap != null and parentMap contains EKK0601B001_LIST?"]
    GET_CHILD["childList = parentMap.get(EKK0601B001CBSMsg1List)"]
    CHECK_CHILD["childList != null and childList.size > 0?"]
    FOR_LOOP["for i = 0 to childList.size"]
    GET_CHILD_MAP["childmap = childList.get(i)"]
    GET_KOTEI_AMNT["koteiAmnt = childmap.get(pplan_kotei_amnt)"]
    CHECK_AMOUNT["Integer.parseInt(koteiAmnt) > 0?"]
    RES_TRUE["res = true - Fixed unit price >= 0 yen (有料)"]
    RES_FALSE["res = false - Fixed unit price = 0 yen (無料)"]
    ELSE_EMPTY["childList is empty or null"]
    RES_EMPTY["res = false - No fixed unit price (固定単価がない場合)"]
    RETURN["Return res"]

    START --> INIT
    INIT --> CHECK_OUTPUT
    CHECK_OUTPUT -->|true| GET_PARENT
    CHECK_OUTPUT -->|false| CHECK_PARENT
    GET_PARENT --> CHECK_PARENT
    CHECK_PARENT -->|true| GET_CHILD
    CHECK_PARENT -->|false| ELSE_EMPTY
    GET_CHILD --> CHECK_CHILD
    CHECK_CHILD -->|true| FOR_LOOP
    CHECK_CHILD -->|false| ELSE_EMPTY
    FOR_LOOP --> GET_CHILD_MAP
    GET_CHILD_MAP --> CHECK_AMOUNT
    CHECK_AMOUNT -->|> 0| RES_TRUE
    CHECK_AMOUNT -->|<= 0| RES_FALSE
    RES_FALSE --> FOR_END["End for loop"]
    RES_TRUE --> FOR_END
    FOR_END --> RETURN
    ELSE_EMPTY --> RETURN
```

**Constant Resolution:**

| Constant | Resolved Value | Business Meaning |
|----------|---------------|------------------|
| `SC_TITLE_FUSV005503` | `"FUSV005503SC"` | Price plan fixed unit price (application fee) list meeting key — identifies the nested map containing pricing details from the FUSV005503 service component |
| `EKK0601B001_LIST` | `"EKK0601B001CBSMsg1List"` | CBS message 1 list — the key for the ArrayList of child pricing entries retrieved from the parent map |
| `PPLAN_KOTEI_AMNT` | `"pplan_kotei_amnt"` | Price plan fixed amount — the field within each child map holding the monetary value of the fixed unit price as a string |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `outputMap` | `HashMap` | The session-output map populated by the service framework after invoking upstream service components and CBS. It contains pricing information for the current service order, including nested structures for payment plan details. The key `SC_TITLE_FUSV005503` (resolved to `"FUSV005503SC"`) is used to extract the pricing detail child map, which itself contains a list of individual price plan line items under the key `EKK0601B001_LIST` (resolved to `"EKK0601B001CBSMsg1List"`). |

**Instance Fields / External State:**
| No | Field/Constant | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `SC_TITLE_FUSV005503` | `private static final String` | Resolved to `"FUSV005503SC"` — key for extracting the price plan fixed unit price (application fee) section from the output map |

## 4. CRUD Operations / Called Services

This method performs **no database or service component calls**. It operates exclusively on in-memory Java data structures (`HashMap`, `ArrayList`) that were pre-populated by upstream screen logic and CBS invocations. All data extraction is done via `Map.get()`, `Map.containsKey()`, `List.get()`, and `List.size()` operations, followed by a type cast and `Integer.parseInt()`.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| *(none)* | *(in-memory only)* | — | — | This method does not invoke any SC, CBS, DAO, or database layer. It reads pre-populated session data (`outputMap`) to determine payment status based on fixed unit price values. |

## 5. Dependency Trace

This method is a private utility called by the `setPayFlg` method within the same class. Across the broader codebase, multiple FUW-xxx screen logic classes define their own `chkPayKoteiTanka` method with the same signature and logic, indicating this is a replicated pattern across the service framework.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Class: `FUW02001SFLogic` | `FUW02001SFLogic.setPayFlg()` -> `FUW02001SFLogic.chkPayKoteiTanka()` | *(none — in-memory only)* |

**Cross-class callers (same method name in other FUW-xxx logic classes):**

| # | Caller (Screen/Batch) | Call Chain | Terminal |
|---|----------------------|------------|----------|
| 2 | Class: `FUW10721SFLogic` | `FUW10721SFLogic` (own `chkPayKoteiTanka(X31SDataBeanAccess)`) | *(none — in-memory only)* |
| 3 | Class: `FUW03701SFLogic` | `FUW03701SFLogic` (own `chkPayKoteiTanka(HashMap)`) | *(none — in-memory only)* |
| 4 | Class: `FUW03501SFLogic` | `FUW03501SFLogic` (own `chkPayKoteiTanka(HashMap)`) | *(none — in-memory only)* |
| 5 | Class: `FUW01901SFLogic` | `FUW01901SFLogic` (own `chkPayKoteiTanka(HashMap)`) | *(none — in-memory only)* |
| 6 | Class: `FUW02501SFLogic` | `FUW02501SFLogic` (own `chkPayKoteiTanka(HashMap)`) | *(none — in-memory only)* |
| 7 | Class: `FUW02101SFLogic` | `FUW02101SFLogic` (own `chkPayKoteiTanka(X31SDataBeanAccess)`) | *(none — in-memory only)* |
| 8 | Class: `FUW03801SFLogic` | `FUW03801SFLogic.chkPayKoteiTanka(HashMap)` -> via `bean.sendMessageBoolean(PAY_FLG, ...)` | *(none — in-memory only)* |
| 9 | Class: `FUW10101SFLogic` | `FUW10101SFLogic` (own `chkPayKoteiTanka(HashMap)`) | *(none — in-memory only)* |
| 10 | Class: `FUW10701SFLogic` | `FUW10701SFLogic` (own `chkPayKoteiTanka(X31SDataBeanAccess)`) | *(none — in-memory only)* |

> Note: Most FUW-xxx screen classes contain their own independent copy of `chkPayKoteiTanka`, reflecting a code-clone pattern rather than shared inheritance. The FUW02001SFLogic version specifically receives a `HashMap` (not a data bean), while others like FUW10721SFLogic receive `X31SDataBeanAccess` with different traversal logic.

## 6. Per-Branch Detail Blocks

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

Initialize local variables before any conditional checks.

| # | Type | Code |
|---|------|------|
| 1 | SET | `res = false;` // Default result: no chargeable fixed unit price |
| 2 | SET | `parentMap = null;` // Will hold the pricing section map extracted from outputMap |

**Block 2** — [IF] `(outputMap.containsKey(SC_TITLE_FUSV005503))` — `[SC_TITLE_FUSV005503 = "FUSV005503SC"]` (L877)

Check whether the output map contains the pricing detail section populated by the `FUSV005503SC` service component. If present, extract it; if absent, proceed with `parentMap` remaining `null`.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `outputMap.containsKey(SC_TITLE_FUSV005503)` // Check if pricing section exists [-> `SC_TITLE_FUSV005503 = "FUSV005503SC"`] |
| 2 | SET | `parentMap = (HashMap) outputMap.get(SC_TITLE_FUSV005503);` // Extract pricing section map from output map [-> `"FUSV005503SC"`] |

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

Verify that the parent pricing section exists and contains the child list of price plan line items. This is the primary entry point to iterating over fixed unit price data.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `null != parentMap` // Check parentMap is not null (Block 2 was taken) |
| 2 | EXEC | `parentMap.containsKey(EKK0601B001_LIST)` // Check child list exists [-> `EKK0601B001_LIST = "EKK0601B001CBSMsg1List"`] |

**Block 3.1** — [ELSE] — No child list present (implicit)

When `parentMap` is `null` or does not contain the child list, the method skips iteration entirely and returns the default `false`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `res = false;` // 固定単価がない場合 — No fixed unit price found (free) |

**Block 3.2** — [THEN] — Child list exists, enter iteration (L885–909)

Retrieve the child list and iterate through each pricing entry to evaluate the fixed unit amount.

| # | Type | Code |
|---|------|------|
| 1 | SET | `childList = (ArrayList) parentMap.get(EKK0601B001_LIST);` // Extract pricing line items list [-> `"EKK0601B001CBSMsg1List"`] |
| 2 | EXEC | `(childList != null && childList.size() > 0)` // Guard against empty list |

**Block 3.2.1** — [FOR LOOP] `(i = 0; i < childList.size())` (L889)

Iterate through each child pricing entry. The loop processes every item and updates `res` on each iteration, with the final value of `res` reflecting the last item evaluated.

| # | Type | Code |
|---|------|------|
| 1 | SET | `childmap = (HashMap) childList.get(i);` // Cast list element to HashMap |
| 2 | SET | `koteiAmntStr = (String) childmap.get(PPLAN_KOTEI_AMNT);` // Retrieve fixed amount string [-> `PPLAN_KOTEI_AMNT = "pplan_kotei_amnt"` — 料金プラン固定金額] |
| 3 | EXEC | `Integer.parseInt(koteiAmntStr) > 0` // Parse and compare to 0 |

**Block 3.2.1.1** — [IF] `(Integer.parseInt((String)childmap.get(PPLAN_KOTEI_AMNT)) > 0)` — `[PPLAN_KOTEI_AMNT = "pplan_kotei_amnt"]` (L892)

The fixed unit price for this line item is greater than zero. The item is chargeable.

| # | Type | Code |
|---|------|------|
| 1 | SET | `res = true;` // 固定単価が0円以上の場合 — Fixed unit price is 0 yen or above (chargeable) |

**Block 3.2.1.2** — [ELSE] — Fixed unit price is 0 or below (L897)

The fixed unit price for this line item is zero. The item is not chargeable.

| # | Type | Code |
|---|------|------|
| 1 | SET | `res = false;` // 固定単価が0円の場合 — Fixed unit price is 0 yen (free) |

**Block 3.2.2** — [ELSE] — Child list is empty or null (L904)

No pricing line items exist in the list. The method returns `false` indicating no chargeable fixed unit price.

| # | Type | Code |
|---|------|------|
| 1 | SET | `res = false;` // 固定単価がない場合 — No fixed unit price found (free) |

**Block 4** — [RETURN] (L912)

Return the accumulated result. Note: the final value of `res` reflects the result of processing the last child item in the list (or the default `false` if no items were processed).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return res;` // true: fixed unit price exists (chargeable) / false: no fixed unit price (free) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `pplan_kotei_amnt` | Field | Price plan fixed amount — the fixed unit price (固定単価) for a service line item, expressed in yen as a string. If greater than 0, the item is chargeable. |
| `FUSV005503SC` | Service Component | Price plan fixed unit price (application fee) list meeting — a service component that populates pricing detail data into the output map, used for fee determination. |
| `EKK0601B001CBSMsg1List` | Map Key | CBS message 1 list — the map key under which the ArrayList of child pricing entries is stored in the parent pricing section map. |
| `SC_TITLE_FUSV005503` | Constant | Key name `"FUSV005503SC"` used to extract the pricing detail section from the session output map. |
| 固定単価 (Kotei Tango) | Japanese term | Fixed unit price — a fixed, non-variable charge per service line item (as opposed to usage-based or variable pricing). |
| 有料フラグ (Yuryo Flag) | Japanese term | Paid flag — a boolean indicator set on data beans to signal whether a service line item incurs a charge. |
| 無料 (Muryou) | Japanese term | Free / no charge — indicates the service item has zero cost. |
| outputMap | Field | Session output map — a HashMap populated by the screen framework containing data from invoked service components and CBS, used to pass pricing and other details between logic methods. |
| parentMap | Local variable | The extracted pricing section HashMap obtained from `outputMap` under the `SC_TITLE_FUSV005503` key. |
| childList | Local variable | The ArrayList of pricing line item maps retrieved from `parentMap` under the `EKK0601B001_LIST` key. Each entry represents a distinct price plan item with its own fixed unit price. |
| FUW02001SF | Module | A web service framework module handling telecom service order and contract operations. |
| setPayFlg | Method | A sibling method in `FUW02001SFLogic` that combines the result of `chkPayKoteiTanka` with a free-item count (`muryoCnt`) to determine the overall payment flag. |
