# Business Logic — FUW01901SFLogic.chkPayKoteiTanka() [41 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW01901SF.FUW01901SFLogic` |
| Layer | Service (WebLogic layer — business logic for web screens) |
| Module | `FUW01901SF` (Package: `eo.web.webview.FUW01901SF`) |

## 1. Role

### FUW01901SFLogic.chkPayKoteiTanka()

This method performs a **paid-flag determination based on fixed unit price (kotei tanka)** — it answers the business question: "Does this customer's service contract include at least one line item with a non-zero fixed price?" In the broader subscription and contract management domain, fixed prices represent recurring or one-time charges that are set in advance (as opposed to variable usage-based pricing). The method is called by `setPayFlg()`, which in turn sets the `PAY_FLG` (payment flag) on the service form bean for the **FUW01901SF** screen — a screen responsible for displaying subscription service contracts, pricing plans, and related billing information to the customer.

The design pattern used here is **nested data inspection with early bailout** — the method traverses a nested Map structure (outputMap → parentMap → childList → childmap) and checks a single numeric field (`pplan_kotei_amnt`) across all child items. If ANY child item has a fixed amount greater than zero, the method immediately sets the result to `true` and continues iterating (overwriting on each iteration, since in this codebase the last item determines the final value — a potential logical issue if multiple items exist with mixed amounts). The method plays a **shared utility role** within the FUW01901SFLogic class, acting as a pricing indicator helper rather than an entry point.

The method handles a single service category: the **pricing plan fixed price** branch. When `pplan_kotei_amnt > 0`, it indicates a chargeable fixed unit price exists. When `pplan_kotei_amnt <= 0`, it indicates no charge. If the data structure is absent or empty, the method defaults to `false` (no charge).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["chkPayKoteiTanka(outputMap)"])
    CHECK_KEY["Check outputMap contains FUSV005303SC"]
    GET_PARENT["Get parentMap from outputMap[FUSV005303SC]"]
    CHECK_PARENT["Check parentMap != null and contains EKK0601B001CBSMsg1List"]
    GET_LIST["Get childList from parentMap[EKK0601B001CBSMsg1List]"]
    CHECK_LIST["Check childList != null and size > 0"]
    LOOP_START["For each childmap in childList"]
    GET_AMNT["Get pplan_kotei_amnt from childmap"]
    PARSE_INT["Parse pplan_kotei_amnt to Integer"]
    CHECK_AMNT["pplan_kotei_amnt > 0"]
    RES_TRUE["res = true"]
    RES_FALSE_AMNT["res = false"]
    RES_FALSE_LIST["res = false"]
    RETURN_RES["Return res"]
    RETURN_DEFAULT["Return false (default)"]

    START --> CHECK_KEY
    CHECK_KEY -- Yes --> GET_PARENT
    CHECK_KEY -- No --> RETURN_DEFAULT
    GET_PARENT --> CHECK_PARENT
    CHECK_PARENT -- Yes --> GET_LIST
    CHECK_PARENT -- No --> RETURN_DEFAULT
    GET_LIST --> CHECK_LIST
    CHECK_LIST -- Yes --> LOOP_START
    CHECK_LIST -- No --> RES_FALSE_LIST
    LOOP_START --> GET_AMNT
    GET_AMNT --> PARSE_INT
    PARSE_INT --> CHECK_AMNT
    CHECK_AMNT -- Yes --> RES_TRUE
    CHECK_AMNT -- No --> RES_FALSE_AMNT
    RES_TRUE --> RETURN_RES
    RES_FALSE_AMNT --> RETURN_RES
    RES_FALSE_LIST --> RETURN_RES
    RETURN_DEFAULT --> END(["End"])
    RETURN_RES --> END
```

**Constant Resolution:**

| Constant | Resolved Value | Business Meaning |
|----------|---------------|------------------|
| `FUSV005303SC` | `"FUSV005303SC"` | Output map key for the pricing plan fixed unit price (option application pricing) service call result — contains a HashMap of plan pricing data |
| `EKK0601B001CBSMSG1LIST` | `"EKK0601B001CBSMsg1List"` | Key for the child list containing individual pricing plan line items (returned from CBS) |
| `PPLAN_KOTEI_AMNT` | `"pplan_kotei_amnt"` | Pricing plan fixed amount — the fixed price in yen for a plan line item. Japanese comment: 料金プラン固定金額 (pricing plan fixed amount) |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `outputMap` | `HashMap` | The output data map populated by the screen's service invocation. It contains keys mapped from Service Component (SC) calls, including `FUSV005303SC` which holds the pricing plan fixed unit price data returned from the CBS (center business system). This map is the result of the `invokeService()` call in `init()`, which queries the backend for pricing plan details including fixed charges. |

## 4. CRUD Operations / Called Services

This method performs **no CRUD operations or external service calls**. It is a pure data inspection method that navigates within the `outputMap` structure to read a price value. All data was previously fetched by the screen's `init()` method via the `FUSV0053_FUSV0053OPDBMapper.setFUSV005303SC()` call, which invokes Service Component `FUSV005303SC` (Pricing Plan Fixed Unit Price — Option Application Pricing List Inquiry SC) to query the backend.

## 5. Dependency Trace

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

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Class: `FUW01901SFLogic` | `FUW01901SFLogic.setPayFlg(bean, outputMap)` → `FUW01901SFLogic.chkPayKoteiTanka(outputMap)` | `chkPayKoteiTanka` [no external CRUD — reads from outputMap] |

**Detailed chain:** `setPayFlg()` (L787) → `chkPayKoteiTanka(outputMap)` (L804). The `setPayFlg()` method is itself called from `init()` (L232) via `bean.sendMessageBoolean(FUW01901SFConst.PAY_FLG, ..., setPayFlg(bean, outputMap))` to set the payment flag on the service form bean.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `outputMap.containsKey(FUSV005303SC)` `"FUSV005303SC"` (L838)

> Check if the pricing plan fixed unit price data exists in the output map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `res = false;` // initialize default result [-> `FUSV005303SC` = "FUSV005303SC"] |
| 2 | SET | `HashMap parentMap = null;` // variable to hold pricing plan data |
| 3 | SET | `parentMap = (HashMap)outputMap.get(FUSV005303SC);` // extract pricing plan map [-> `FUSV005303SC` = "FUSV005303SC"] |

**Block 2** — [IF] `null != parentMap && parentMap.containsKey(EKK0601B001CBSMSG1LIST)` `"EKK0601B001CBSMsg1List"` (L843)

> Verify the parent map is not null and contains the child list of pricing plan line items.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ArrayList childList = (ArrayList)parentMap.get(EKK0601B001CBSMSG1LIST);` // retrieve child list [-> `EKK0601B001CBSMSG1LIST` = "EKK0601B001CBSMsg1List"] |
| 2 | JUMP | Goto Block 3 (nested IF on childList) |

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

> Verify the child list is not null and contains at least one pricing plan line item.

| # | Type | Code |
|---|------|------|
| 1 | JUMP | Goto Block 2.2 (FOR loop) |

**Block 2.2** — [FOR] `i` from 0 to `childList.size()` (L848)

> Iterate over each pricing plan line item to check its fixed amount.

| # | Type | Code |
|---|------|------|
| 1 | SET | `HashMap childmap = (HashMap)childList.get(i);` // get current line item map |
| 2 | JUMP | Goto Block 2.3 (nested IF on amount) |

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

> **Constant:** `PPLAN_KOTEI_AMNT = "pplan_kotei_amnt"` (料金プラン固定金額 — pricing plan fixed amount)

> Check if the current line item's fixed price is greater than zero yen. Japanese comment: 固定単価が0円以上の場合 (when fixed unit price is 0 yen or more).

| # | Type | Code |
|---|------|------|
| 1 | SET | `res = true;` // fixed unit price exists — set paid flag [-> `PPLAN_KOTEI_AMNT` = "pplan_kotei_amnt"] |

**Block 2.2.2** — [ELSE] (L854)

> The fixed price is zero or less. Japanese comment: 固定単価が0円の場合 (when fixed unit price is 0 yen).

| # | Type | Code |
|---|------|------|
| 1 | SET | `res = false;` // no fixed charge for this item |

**Block 2.3** — [ELSE] (L860)

> The child list is empty or null — no pricing plan line items exist. Japanese comment: 固定単価がない場合 (when there is no fixed unit price).

| # | Type | Code |
|---|------|------|
| 1 | SET | `res = false;` // no items to check — default to free |

**Block 3** — [ELSE] (implicit, when `parentMap` is null or does not contain the key) (L843 condition fails)

> The pricing plan data is absent from the output map entirely.

| # | Type | Code |
|---|------|------|
| 1 | SET | `res` remains `false` (initialized at L836) — return default |

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

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return res;` // true if any line item has pplan_kotei_amnt > 0, false otherwise |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `chkPayKoteiTanka` | Method | Check paid fixed unit price — determines if any service line item has a non-zero fixed charge |
| `FUSV005303SC` | Constant / SC Key | Output map key for Pricing Plan Fixed Unit Price (Option Application Pricing) Service Component result |
| `EKK0601B001CBSMsg1List` | Constant / CBS Key | Output map key for the child list of pricing plan line items returned from the Center Business System (CBS) |
| `pplan_kotei_amnt` | Field | Pricing plan fixed amount — the fixed price in yen for a pricing plan line item. Japanese: 料金プラン固定金額 (pricing plan fixed amount) |
| `parentMap` | Variable | HashMap containing the pricing plan data for the service, keyed by FUSV005303SC |
| `childList` | Variable | ArrayList of individual pricing plan line item HashMaps |
| `childmap` | Variable | HashMap representing a single pricing plan line item within the child list |
| `res` | Variable | Result boolean — true means a fixed price exists (paid), false means no fixed price (free) |
| `PAY_FLG` | Constant | Payment flag — indicates whether the overall service is chargeable (true) or free (false). Japanese: 有料フラグ (paid flag) |
| `setPayFlg` | Method | Sets the payment flag on the service form bean by combining multiple charge determination checks (fixed price, initial fees, etc.) |
| `FUW01901SF` | Screen Module | Subscription service contract and pricing display screen — shows contracted services, pricing plans, and billing information to the customer |
| `init()` | Method | Screen initialization method — calls all SCs to populate the outputMap, then determines and sets the payment flag |
| CBS | Acronym | Center Business System — the backend enterprise system that processes service orders and pricing |
| SC | Acronym | Service Component — a backend service layer component that interfaces with the CBS for data operations |
| 有料 | Business term | Paid / chargeable — indicates a service or fee is not free |
| 無料 | Business term | Free / no charge — indicates a service or fee has zero cost |
| 固定単価 | Business term | Fixed unit price — a predetermined, non-variable price set for a service line item, as opposed to usage-based or variable pricing |
