# Business Logic — FUW02401SFLogic.setShokiSettei() [95 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW02401SF.FUW02401SFLogic` |
| Layer | Service / Logic (Webview tier — business logic component within the `eo.web.webview` package) |
| Module | `FUW02401SF` (Package: `eo.web.webview.FUW02401SF`) |

## 1. Role

### FUW02401SFLogic.setShokiSettei()

This method performs **initial display configuration** for the Home Page URL name acquisition screen (ホームページURL名取得申請, `FUW02401SF`). It is responsible for preparing the initial pricing data, determining whether the current customer is a mansion (apartment-style) contract requiring special display, setting the paid/fee flag, configuring the free pricing area for display, and resetting the contract terms agreement checkbox to its default unchecked state.

The method retrieves two key pieces of service contract metadata — the pricing group code (`prcGrpCd`) and the contract payment method code (`kanyuKeiPayHoshikiCd`) — from the `svcKeiInfoBean` to determine the customer's contract type. It then iterates over pre-populated pricing data stored in `outputMap`, extracting the fixed monthly price (`kihonPrc`) and the initial fee amount (`shokiPrc`) from structured parent/child map hierarchies.

Based on the contract type, it applies conditional logic for mansion-specific display partitioning and sets the paid flag to indicate whether the customer owes any charges. If the basic monthly price is zero (a free optional service), it also initializes the free pricing information map for UI rendering. Finally, it resets the contract terms agreement checkbox to false, ensuring a fresh state on each initial load.

The method follows a **delegation pattern** — it does not perform data access or database operations directly. Instead, it retrieves data from beans and maps passed in from the caller (`init()`), configures display-relevant flags through the bean's `sendMessageBoolean` API, and delegates pricing UI preparation to `JFUWebCommon.setFreePrcInfoMap()`. It has no CRUD operations of its own; it is purely a data-configuration and display-preparation method.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setShokiSettei"])

    START --> S1["Get service contract info"]
    S1 --> S1A["Get PRC_GRP_CD from svcKeiInfoBean"]
    S1 --> S1B["Get KANYU_KEI_PAY_HOSHIKI_CD from svcKeiInfoBean"]

    S1B --> S2["Prepare pricing key arrays"]
    S2 --> S3["Initialize loop variables"]
    S3 --> FOR1["Loop over keyNmList"]

    FOR1 --> FOR_BODY["Get parentMap from outputMap"]
    FOR_BODY --> CHECK_PARENT{Check parentMap}

    CHECK_PARENT -->|Yes| GET_CHILD["Get childList from parentMap"]
    GET_CHILD --> CHECK_CHILD{childList.size > 0?}

    CHECK_CHILD -->|Yes| FOR_CHILD["Loop over childList"]
    CHECK_CHILD -->|No| FOR_NEXT["Next iteration"]

    FOR_CHILD --> KIHON_CHECK{prcFlag == KIHON_PRC?}

    KIHON_CHECK -->|Yes = 基本料金| SET_KIHON["kihonPrc = pplan_kotei_amnt"]
    KIHON_CHECK -->|No| SHOKI_CHECK{prcFlag == SHOKI_PRC?}

    SHOKI_CHECK -->|Yes = 初期費用| SET_SHOKI["shokiPrc = tmp_pay_prc_amnt"]
    SHOKI_CHECK -->|No| FOR_CHILD_NEXT["Next child iteration"]
    SET_KIHON --> FOR_CHILD_NEXT
    SET_SHOKI --> FOR_CHILD_NEXT
    FOR_CHILD_NEXT --> FOR_CHILD

    FOR_CHILD --> FOR_NEXT
    FOR_NEXT --> FOR_END{More iterations?}
    FOR_END -->|Yes| FOR_BODY
    FOR_END -->|No| MANSION_CHECK{Mansion contract?}

    MANSION_CHECK -->|Yes| PAY_CHECK{mryoZanNum == 0 AND 0 < kihonPrc?}

    PAY_CHECK -->|Yes| SET_MANSION_1["Set MANSION_DIV = true"]
    PAY_CHECK -->|No| SHOKI_NULL{shokiPrc != null?}

    SHOKI_NULL -->|Yes| SET_MANSION_2["Set MANSION_DIV = true"]
    SHOKI_NULL -->|No| FOR_NEXT2["Next iteration"]
    SET_MANSION_1 --> FOR_NEXT2
    SET_MANSION_2 --> FOR_NEXT2
    FOR_NEXT2 --> FOR_END2{More iterations?}
    FOR_END2 -->|Yes| FOR_BODY
    FOR_END2 -->|No| ELSE_MANSION["Set MANSION_DIV = false"]

    MANSION_CHECK -->|No| ELSE_MANSION

    ELSE_MANSION --> PAY_FLG_CHECK{mryoZanNum == 0 AND 0 < kihonPrc?}

    PAY_FLG_CHECK -->|Yes| SET_PAY_TRUE["Set PAY_FLG = true"]
    PAY_FLG_CHECK -->|No| SET_PAY_FALSE["Set PAY_FLG = false"]

    SET_PAY_TRUE --> FREE_PRICE_CHECK{kihonPrc == 0?}
    SET_PAY_FALSE --> FREE_PRICE_CHECK

    FREE_PRICE_CHECK -->|Yes| SET_FREE["Call setFreePrcInfoMap"]
    FREE_PRICE_CHECK -->|No| SET_CONTRACT["Set KEIYAKU_YAKKAN_DOI = false"]

    SET_FREE --> SET_CONTRACT

    SET_CONTRACT --> END(["Return"])
```

**Constant Resolution:**

| Constant | Resolved Value | Business Meaning |
|----------|---------------|-----------------|
| `JFUStrConst.CD00133_04` | `"04"` | Pricing group code — eo Light Net Maison type (mansion/property contract tier) |
| `JFUStrConst.CD01216_003` | `"003"` | Contract payment method code — All-units unified (全戸一括) for apartment-style billing |
| `KIHON_PRC` | `"基本料金"` | String label — Basic monthly fee |
| `SHOKI_PRC` | `"初期費用"` | String label — Initial one-time fee |
| `YUURYOU_JUDGE_ZERO` | `0` | Threshold value — zero used as the "free" indicator for remaining quantity check |
| `MAPKEY_FUSV002404SC` | `"FUSV002404SC"` | Map key referencing the pricing SC (Service Component) output |
| `MAPKEY_FUSV002401CC` | `"FUSV002401CC"` | Map key referencing the Common Component (CC) output |
| `PPLAN_KOTEI_AMNT` | `"pplan_kotei_amnt"` | Map field for fixed plan amount (monthly base price) |
| `TMP_PAY_PRC_AMNT` | `"tmp_pay_prc_amnt"` | Map field for temporary payment price (initial fee amount) |
| `SC_TITLE_FUSV002404` | `"FUSV002404SC"` | SC title string for pricing information area |
| `FUW02401SFConst.MANSION_DIV` | `"マンション区分"` | Display flag key — Mansion division indicator |
| `FUW02401SFConst.PAY_FLG` | `"有料フラグ"` | Display flag key — Paid flag indicator |
| `FUW02401SFConst.KEIYAKU_YAKKAN_DOI` | `"契約約款同意"` | Display flag key — Contract terms agreement checkbox |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `bean` | `X31SDataBeanAccess` | The service form bean used to write display values back to the screen. Used to set boolean flags (`MANSION_DIV`, `PAY_FLG`, `KEIYAKU_YAKKAN_DOI`) via `sendMessageBoolean` so the UI layer can render the initial state of mansion partitioning, paid status, and terms agreement checkbox. |
| 2 | `svcKeiInfoBean` | `X31SDataBeanAccess` | Service contract information bean containing the customer's current subscription metadata. Specifically provides the pricing group code (e.g., mansion tier) and the contract payment method code (e.g., all-units unified billing for apartment-style contracts) via `sendMessageString` calls. |
| 3 | `outputMap` | `HashMap<String, Object>` | The output map populated by upstream SC/CC processing. Contains nested structures keyed by `MAPKEY_FUSV002404SC` (pricing SC data) and `MAPKEY_FUSV002401CC` (CC data). Each key maps to a parent HashMap containing a child list (`EKK0601B001CBSMSG1LIST` or `EKK0721A010CBSMSG1LIST`) of item maps with pricing details (basic monthly fee, initial fee). |
| 4 | `mryoZanNum` | `int` | Remaining quantity indicator — the number of remaining services/items. When equal to `YUURYOU_JUDGE_ZERO` (0), it indicates no remaining balance, which is used as a criterion to determine if the basic monthly price is greater than zero, thus establishing paid vs. free status for the current display. |

**Instance fields read:** None. This method uses only local variables and parameters. All constants are class-level static final fields defined within `FUW02401SFLogic`.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `svcKeiInfoBean.sendMessageString(CommonInfoCFConst.PRC_GRP_CD_23, ...)` | CommonInfoCF | Customer service contract info | Reads the pricing group code from the service contract info data bean. |
| R | `svcKeiInfoBean.sendMessageString(CommonInfoCFConst.KANYU_KEI_PAY_HOSHIKI_CD_23, ...)` | CommonInfoCF | Customer service contract info | Reads the contract payment method code (all-units unified vs. per-unit) from the service contract info data bean. |
| R | `outputMap.get(keyNmList[i])` | - | - | Retrieves the pricing data parent map (SC or CC) from the output map by key. |
| R | `parentMap.get(keyMsNmList[i])` | - | - | Retrieves the child item list (pricing details list) from the parent map. |
| R | `childMap.get(PPLAN_KOTEI_AMNT)` | - | - | Reads the fixed monthly price (基本料金) from a pricing detail item map. |
| R | `childMap.get(TMP_PAY_PRC_AMNT)` | - | - | Reads the temporary payment price (初期費用) from a pricing detail item map. |
| U | `bean.sendMessageBoolean(FUW02401SFConst.MANSION_DIV, ...)` | - | - | Writes the mansion division flag to the service form bean for UI display. |
| U | `bean.sendMessageBoolean(FUW02401SFConst.PAY_FLG, ...)` | - | - | Writes the paid flag to the service form bean for UI display. |
| U | `JFUWebCommon.setFreePrcInfoMap(outputMap, SC_TITLE_FUSV002404)` | JFUWebCommon / JFUFrontKhrkInfoAreaUtil | - | Configures the free pricing information map in outputMap for UI rendering of free pricing areas (delegates to `JFUFrontKhrkInfoAreaUtil.setFreePrcInfoMap`). |
| U | `bean.sendMessageBoolean(FUW02401SFConst.KEIYAKU_YAKKAN_DOI, ...)` | - | - | Writes the contract terms agreement checkbox state (false) to the service form bean. |

**Classification rationale:** This method performs no direct database or entity operations. It is a presentation-layer configuration method that reads data from beans and maps, and writes display flags back to beans. All operations are either reads (R) from input data structures or updates (U) to output display state.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0004 (inferred) | `FUW02401SFLogic.init()` -> `setShokiSettei(bean, svcKeiInfoBean, outputMap, mryoZanNum)` | `setFreePrcInfoMap [-]`, `sendMessageBoolean [-]`, `sendMessageString [-]` |

**Caller analysis:** The method is private (`private void`) and called only from `FUW02401SFLogic.init()`, which is the entry point for the Home Page URL name acquisition screen (`FUW02401`). The `init()` method performs device checking, retrieves common form beans, SSO info, general customer info, service contract info, and option service contract info, then calls `setShokiSettei()` to prepare initial display state. The terminal operations propagate through `setFreePrcInfoMap` (which delegates to `JFUFrontKhrkInfoAreaUtil.setFreePrcInfoMap`) and various `sendMessageBoolean`/`sendMessageString` calls on the bean.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Service contract info retrieval (L673–677)

> Retrieves the pricing group code and contract payment method code from the service contract information bean.

| # | Type | Code |
|---|------|------|
| 1 | SET | `prcGrpCd = svcKeiInfoBean.sendMessageString(CommonInfoCFConst.PRC_GRP_CD_23, X31CWebConst.DATABEAN_GET_VALUE)` // Pricing group code — identifies the contract's pricing tier |
| 2 | SET | `kanyuKeiPayHoshikiCd = svcKeiInfoBean.sendMessageString(CommonInfoCFConst.KANYU_KEI_PAY_HOSHIKI_CD_23, X31CWebConst.DATABEAN_GET_VALUE)` // Contract payment method code — all-units unified or per-unit |

**Block 2** — [SET] Pricing data key array preparation (L680–686)

> Sets up the arrays that define which SC/CC output keys to search, which child list keys to extract, and which pricing type flag to check.

| # | Type | Code |
|---|------|------|
| 1 | SET | `keyNmList = { MAPKEY_FUSV002404SC, MAPKEY_FUSV002401CC }` // ["FUSV002404SC", "FUSV002401CC"] — output map keys for SC and CC data |
| 2 | SET | `keyMsNmList = { MAPKEY_EKK0601B001CBSMSG1LIST, MAPKEY_EKK0721A010CBSMSG1LIST }` // Child list keys for the respective parent maps |
| 3 | SET | `prcFlag = { KIHON_PRC, SHOKI_PRC }` // ["基本料金", "初期費用"] — pricing type labels for each iteration |
| 4 | SET | `kihonPrc = 0` // Default basic monthly price (int) |
| 5 | SET | `shokiPrc = null` // Default initial fee (String, null = not yet set) |
| 6 | SET | `parentMap = null` // Parent map reference, resolved per iteration |

**Block 3** — [FOR] Outer loop over pricing data sources (L688–692)

> Iterates over the two pricing data sources (SC and CC) to find the one that exists in `outputMap`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `for (int i = 0; i < keyNmList.length; i++)` // Loop: i = 0 (SC), i = 1 (CC) |
| 2 | IF | `if (outputMap.containsKey(keyNmList[i]))` // [MAPKEY_FUSV002404SC or MAPKEY_FUSV002401CC] |
| 2.1 | SET | `parentMap = (HashMap)outputMap.get(keyNmList[i])` // [-> MAPKEY_FUSV002404SC="FUSV002404SC" or MAPKEY_FUSV002401CC="FUSV002401CC"] |

**Block 4** — [IF] Child list retrieval (L692–709)

> Checks if the parent map contains the child detail list and iterates over pricing items.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (null != parentMap && parentMap.containsKey(keyMsNmList[i]))` // Check parentMap exists and contains child list key |
| 1.1 | SET | `childList = (ArrayList)parentMap.get(keyMsNmList[i])` // [-> keyMsNmList[0]="EKK0601B001CBSMsg1List" or keyMsNmList[1]="EKK0721A010CBSMsg1List"] |
| 2 | IF | `if (0 != childList.size())` // Check child list is non-empty |
| 2.1 | FOR | `for (int j = 0; j < childList.size(); j++)` // Iterate over each pricing detail item |
| 2.1.1 | SET | `childMap = (HashMap)childList.get(j)` // Item map from child list |
| 2.1.2 | IF | `if (KIHON_PRC.equals(prcFlag[i]))` // [-> KIHON_PRC="基本料金" (Basic monthly fee)] |
| 2.1.2.1 | SET | `kihonPrc = Integer.parseInt((String)childMap.get(PPLAN_KOTEI_AMNT))` // [-> PPLAN_KOTEI_AMNT="pplan_kotei_amnt"] Parse fixed monthly plan amount as int |
| 2.1.3 | ELSE-IF | `else if (SHOKI_PRC.equals(prcFlag[i]))` // [-> SHOKI_PRC="初期費用" (Initial fee)] |
| 2.1.3.1 | SET | `shokiPrc = (String)childMap.get(TMP_PAY_PRC_AMNT)` // [-> TMP_PAY_PRC_AMNT="tmp_pay_prc_amnt"] Get temporary payment price as String |

**Block 5** — [IF] Mansion division setting (L712–741)

> Determines whether to show the mansion-specific display partition based on pricing group code and payment method code.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (JFUStrConst.CD00133_04.equals(prcGrpCd) && JFUStrConst.CD01216_003.equals(kanyuKeiPayHoshikiCd))` // [-> CD00133_04="04" (eo Light Net Maison type) AND CD01216_003="003" (All-units unified payment)] — Mansion contract detection |
| 1.1 | IF | `if (YUURYOU_JUDGE_ZERO == mryoZanNum && YUURYOU_JUDGE_ZERO < kihonPrc)` // [-> YUURYOU_JUDGE_ZERO=0] Check: remaining quantity is 0 AND basic price is greater than 0 |
| 1.1.1 | EXEC | `bean.sendMessageBoolean(FUW02401SFConst.MANSION_DIV, X31CWebConst.DATABEAN_SET_VALUE, true)` // [-> MANSION_DIV="マンション区分"] Set mansion division flag to true — show mansion-specific display |
| 1.2 | ELSE-IF | `else if (shokiPrc != null)` // Initial fee is present (even if basic price is 0, initial fee indicates paid contract) |
| 1.2.1 | EXEC | `bean.sendMessageBoolean(FUW02401SFConst.MANSION_DIV, X31CWebConst.DATABEAN_SET_VALUE, true)` // Set mansion division flag to true |
| 1.3 | ELSE | (No action — mansion division stays at default false for this contract) |
| 2 | ELSE | (prcGrpCd != "04" OR kanyuKeiPayHoshikiCd != "003" — not a mansion contract) |
| 2.1 | EXEC | `bean.sendMessageBoolean(FUW02401SFConst.MANSION_DIV, X31CWebConst.DATABEAN_SET_VALUE, false)` // [-> MANSION_DIV="マンション区分"] Set mansion division flag to false |

**Block 6** — [IF] Paid flag setting (L713–723, lines 725–734)

> Sets the paid flag (有料フラグ) based on whether the remaining quantity is zero and basic monthly price is positive. This block is OUTSIDE the mansion-branch and applies to all contract types.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (YUURYOU_JUDGE_ZERO == mryoZanNum && YUURYOU_JUDGE_ZERO < kihonPrc)` // [-> YUURYOU_JUDGE_ZERO=0] Check: no remaining balance AND basic price > 0 |
| 1.1 | EXEC | `bean.sendMessageBoolean(FUW02401SFConst.PAY_FLG, X31CWebConst.DATABEAN_SET_VALUE, true)` // [-> PAY_FLG="有料フラグ"] Set paid flag to true — customer has charges |
| 2 | ELSE | (remaining balance is non-zero OR basic price is 0) |
| 2.1 | EXEC | `bean.sendMessageBoolean(FUW02401SFConst.PAY_FLG, X31CWebConst.DATABEAN_SET_VALUE, false)` // Set paid flag to false — no charges or balance not cleared |

**Block 7** — [IF] Free pricing map setup (L724–730, lines 736–740)

> When the basic monthly price is exactly zero (free service), initialize the free pricing information area map for UI rendering.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (YUURYOU_JUDGE_ZERO == kihonPrc)` // [-> YUURYOU_JUDGE_ZERO=0] Check: basic monthly price is zero (free service) |
| 1.1 | CALL | `JFUWebCommon.setFreePrcInfoMap(outputMap, SC_TITLE_FUSV002404)` // [-> SC_TITLE_FUSV002404="FUSV002404SC"] Delegates to `JFUFrontKhrkInfoAreaUtil.setFreePrcInfoMap` to populate free pricing info in outputMap |

**Block 8** — [SET] Contract terms agreement reset (L732–733, lines 743–744)

> Resets the contract terms agreement checkbox to unchecked (false) for a fresh initial display state.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `bean.sendMessageBoolean(FUW02401SFConst.KEIYAKU_YAKKAN_DOI, X31CWebConst.DATABEAN_SET_VALUE, false)` // [-> KEIYAKU_YAKKAN_DOI="契約約款同意"] Reset terms agreement to false |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `prcGrpCd` | Field | Pricing group code — classifies the customer's pricing tier (e.g., standard, mansion/property). "04" indicates eo Light Net Maison type. |
| `kanyuKeiPayHoshikiCd` | Field | Contract payment method code — determines how billing is structured. "003" means all-units unified (全戸一括) for apartment/mansion-style contracts. |
| `kihonPrc` | Field | Basic monthly fee (基本料金) — the fixed recurring monthly charge extracted from the pricing detail item maps. |
| `shokiPrc` | Field | Initial fee (初期費用) — the one-time setup charge extracted from pricing detail item maps. Null when no initial fee exists. |
| `mryoZanNum` | Field | Remaining quantity (残り件数) — number of remaining services/items. Zero indicates no outstanding balance or remaining count. |
| `MANSION_DIV` | Field | Mansion division flag (マンション区分) — boolean UI flag indicating whether the mansion-specific display partition should be shown. |
| `PAY_FLG` | Field | Paid flag (有料フラグ) — boolean UI flag indicating whether the customer has charges (true) or not (false). |
| `KEIYAKU_YAKKAN_DOI` | Field | Contract terms agreement (契約約款同意) — boolean UI flag for the terms agreement checkbox, reset to false on initial display. |
| `EKK0601B001CBSMSG1LIST` | Map key | Child list key for CBS message type 1 list — pricing detail items from CBS component. |
| `EKK0721A010CBSMSG1LIST` | Map key | Child list key for CBS message type 1 list — pricing detail items from CBS component. |
| `pplan_kotei_amnt` | Field | Fixed plan amount (固定金額) — the monthly base price field within a pricing detail item map. |
| `tmp_pay_prc_amnt` | Field | Temporary payment price (一時払い金額) — the initial fee amount field within a pricing detail item map. |
| `FUSV002404SC` | SC Code | Pricing SC (Service Component) — handles pricing data retrieval for the FUW02401 screen. |
| `FUSV002401CC` | CC Code | Pricing CC (Common Component) — shared pricing data component for the FUW02401 screen. |
| CD00133_04 | Constant | Pricing group code "04" — eo Light Net Maison type (マンション向け料金プラン). |
| CD01216_003 | Constant | Contract payment method code "003" — all-units unified billing (全戸一括請求). |
| `YUURYOU_JUDGE_ZERO` | Constant | Paid judgment zero threshold (有料判定用基準値) — the value 0 used as the reference for zero-remaining checks. |
| `X31SDataBeanAccess` | Class | Service data bean access class — provides `sendMessageString` and `sendMessageBoolean` for reading/writing bean data values. |
| SSO | Acronym | Single Sign-On — authentication mechanism for web service access. |
| SC | Acronym | Service Component — tiered service layer component for data/business operations. |
| CC | Acronym | Common Component — shared utility component across screens. |
| CBS | Acronym | Common Business Service — reusable business service component. |
| eo Webview | Module | Fujitsu's enterprise web view framework tier (`eo.web.webview`) where screen logic components reside. |
| `FUW02401SF` | Screen module | Home Page URL name acquisition screen (ホームページURL名取得申請) — FUW02401SFLogic handles the screen's business logic. |
| `init()` | Method | Screen initialization method that calls `setShokiSettei()` after retrieving customer and contract data. |
