# Business Logic — JKKOrsjgsUseStpRunCC.orsjgsUseStpKanrencheck() [103 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKOrsjgsUseStpRunCC` |
| Layer | CC / Common Component (Shared Business Logic) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKOrsjgsUseStpRunCC.orsjgsUseStpKanrencheck()

This method performs a comprehensive pre-execution validation check before running a provider (orsjgs) use suspension process. Its business purpose is to verify that all preconditions for suspending a service contract related to a specific provider are satisfied. Specifically, it executes a four-layer sequential gate check: (1) Contract Existence Check — confirms a valid service contract record exists for the given contract number; (2) Provider Identity Check — retrieves customer agreement data and cross-validates the provider code, then optionally validates the provider's active date range if agreement information is found; (3) Contract Status Check — ensures the service contract status is "100" (Service Active / サービス提供中), meaning the contract is currently in an active state and eligible for suspension processing; (4) Contract Service Type Check — confirms the contracted service is one of the supported types: code "01" (FTTH / Fiber To The Home), "02" (Tel / Telephone), or "03" (TV / Television). The method acts as a shared utility gatekeeper called by the main provider use suspension orchestration method (`orsjgsRunUseStp`) when the service ID matches `wsale021`. It implements a **sequential guard pattern** where each check independently short-circuits with a distinct error code, allowing the caller to diagnose which specific precondition failed. All three layers of service communication (EKK0081A010, ECK0011A010, ECH0911A010) are read-only queries.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["orsjgsUseStpKanrencheck(handle, param, fixedText)"])

    START --> Init["Initialize: ccMsg, scCall, svcKeiNo, orsjgsCd, unyoYMD"]

    Init --> CallEKK0081["callSC: EKK0081A010 - Service Contract Agreement Info"]

    CallEKK0081 --> ContractCheck{Contract exists?
ekk0081a010Out.length == 0}

    ContractCheck --> |No| Return1100["Set returnCode=1100, returnMessage=Contract Check Error"]
    ContractCheck --> |Yes| GetSysid["Extract sysid from EKK0081A010 result"]

    Return1100 --> ReturnEnd1(["Return 1100"])

    GetSysid --> CallECK0011["callSC: ECK0011A010 - Customer Agreement Info"]

    CallECK0011 --> CustomerResult{eck0011a010Out
exists and not
empty?}

    CustomerResult --> |No| CheckSvcKeiStat["Extract svcKeiStat from EKK0081"]
    CustomerResult --> |Yes| GetOrsjgsCd["Extract orsjgsCd from ECK0011"]

    GetOrsjgsCd --> OrsjgsNull{orsjgsCdEk0011a010
is null or blank?}

    OrsjgsNull --> |Yes| Return1101a["Set returnCode=1101, returnMessage=Provider Check Error"]
    OrsjgsNull --> |No| OrsjgsMatch{orsjgsCd equals
orsjgsCdEk0011a010?}

    OrsjgsMatch --> |No| Return1101a
    OrsjgsMatch --> |Yes| CallECH0911["callSC: ECH0911A010 - Provider Agreement Info"]

    Return1101a --> ReturnEnd2(["Return 1101"])

    CallECH0911 --> ECH0911Result{ech0911a010Out
exists and not
empty?}

    ECH0911Result --> |No| CheckSvcKeiStat
    ECH0911Result --> |Yes| DateRangeCheck{tstay <= unyoYMD <= tend?
Date range valid?}

    DateRangeCheck --> |No| Return1101b["Set returnCode=1101, returnMessage=Provider Check Error"]
    DateRangeCheck --> |Yes| CheckSvcKeiStat

    Return1101b --> ReturnEnd2

    CheckSvcKeiStat --> SvcKeiStatCheck{svcKeiStat equals
100?}

    SvcKeiStatCheck --> |No| Return1102["Set returnCode=1102, returnMessage=Contract Status Error"]
    SvcKeiStatCheck --> |Yes| GetSvcCd["Extract svcCd from EKK0081"]

    Return1102 --> ReturnEnd3(["Return 1102"])

    GetSvcCd --> SvcCdCheck{svcCd in 01 or 02 or 03?
(FTTH or Tel or TV)}

    SvcCdCheck --> |No| Return1103["Set returnCode=1103, returnMessage=Contract Service Error"]
    SvcCdCheck --> |Yes| ReturnOk(["Return CHECK_OK 0000"])

    Return1103 --> ReturnEnd4(["Return 1103"])
```

### Sequence Diagram — Service Communication

```mermaid
sequenceDiagram
    participant MCC as JKKOrsjgsUseStpRunCC
    participant SC as ServiceComponentRequestInvoker
    participant EKK as EKK0081A010 CBS
    participant ECK as ECK0011A010 CBS
    participant ECH as ECH0911A010 CBS

    MCC->>MCC: Extract svcKeiNo, orsjgsCd, unyoYMD
    MCC->>SC: editInMsgEKK0081A010(svcKeiNo, unyoYMD)
    SC->>MCC: Return Object[][] input
    MCC->>EKK: callSC(EKK0081A010 input)
    EKK-->>MCC: CAANMsg[] EKK0081A010 result
    alt Contract not found (empty)
        MCC->>MCC: Set returnCode=1100
        MCC-->>Caller: Return 1100
    else Contract found
        MCC->>MCC: Extract sysid
        MCC->>SC: editInMsgECK0011A010(sysid, unyoYMD)
        SC->>MCC: Return Object[][] input
        MCC->>ECK: callSC(ECK0011A010 input)
        ECK-->>MCC: CAANMsg[] ECK0011A010 result
        opt Result not empty
            MCC->>MCC: Validate orsjgsCd matches
            opt Mismatch or null
                MCC->>MCC: Set returnCode=1101
                MCC-->>Caller: Return 1101
            end
            MCC->>SC: editInMsgECH0911A010(orsjgsCd, unyoYMD)
            SC->>MCC: Return Object[][] input
            MCC->>ECH: callSC(ECH0911A010 input)
            ECH-->>MCC: CAANMsg[] ECH0911A010 result
            opt Result not empty
                MCC->>MCC: Validate date range
                opt Date range invalid
                    MCC->>MCC: Set returnCode=1101
                    MCC-->>Caller: Return 1101
                end
            end
        end
        MCC->>MCC: Check svcKeiStat == 100
        alt Status != 100
            MCC->>MCC: Set returnCode=1102
            MCC-->>Caller: Return 1102
        else Status == 100
            MCC->>MCC: Check svcCd in 01/02/03
            alt svcCd invalid
                MCC->>MCC: Set returnCode=1103
                MCC-->>Caller: Return 1103
            else svcCd valid
                MCC-->>Caller: Return 0000 (CHECK_OK)
            end
        end
    end
```

**Block 0** — Initialization `(L5385)`

> Extract business context from parameter map, initialize SC invoker, and compute the operational date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ccMsg = (HashMap)param.getData(fixedText)` // Extract CC message map [-> `fixedText` is the parameter key] |
| 2 | SET | `scCall = new ServiceComponentRequestInvoker()` // Create SC call instance [Comment: Creates instance with log-output class name; empty string means no log output] |
| 3 | SET | `svcKeiNo = (String)ccMsg.get(JKKStrConst.SVC_KEI_NO)` // Get service contract number [-> `SVC_KEI_NO = "svc_kei_no"` (JKKStrConst.java:5545)] |
| 4 | SET | `orsjgsCd = (String)ccMsg.get(JKKStrConst.IRAIMOTO_KBN)` // Get provider code from request channel [-> `IRAIMOTO_KBN = "channel"` (JKKStrConst.java:5539)] |
| 5 | SET | `unyoYMD = JPCBPCommon.getOpeDate(null)` // Get operational date [Comment: Get operational year-month-day] |

**Block 1** — IF (Contract Existence Check) `(ekk0081a010Out.length == 0)` (L5402)

> **Related Contract**: EKK0081A010 — Service Contract Agreement Information retrieval. Query the service contract agreement detail using the service contract number and reservation application date. If no contract record is found, the process cannot proceed.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0081a010 = editInMsgEKK0081A010(svcKeiNo, unyoYMD)` // Build input message for EKK0081A010 [Template: `TEMPLATE_ID_EKK0081A010 = "EKK0081A010"` (JKKHakkoSODConstCC.java:638)] |
| 2 | SET | `ekk0081a010Out = callSC(handle, scCall, param, fixedText, ekk0081a010).getCAANMsgList(EKK0081A010CBSMsg.EKK0081A010CBSMSG1LIST)` // Execute SC call and extract result list |
| 3 | IF | `ekk0081a010Out.length == 0` |
| 4 | SET | `ccMsg.put(JKKStrConst.RETURN_CODE, JKKStrConst.RETURN_CD_1100)` // Set return code [-> `RETURN_CODE = "returnCode"` (JKKStrConst.java:5548), `RETURN_CD_1100 = "1100"` (JKKStrConst.java:5510)] |
| 5 | SET | `ccMsg.put(JKKStrConst.RETURN_MESSAGE, JKKStrConst.RETURN_MESSAGE_KEI_EXISTS_CHECK_ERROR)` // Set error message [-> `RETURN_MESSAGE = "returnMessage"` (JKKStrConst.java:5551), `RETURN_MESSAGE_KEI_EXISTS_CHECK_ERROR = "契約存在チェックエラー"` (JKKStrConst.java:5590)] |
| 6 | EXEC | `param.setData(fixedText, ccMsg)` // Write result back to param |
| 7 | RETURN | `return JKKStrConst.RETURN_CD_1100` // Return 1100 — contract not found |

**Block 2** — Provider Identity Check `(eck0011a010Out != null && eck0011a010Out.length > 0)` (L5416)

> **Related Contract**: ECK0011A010 — Customer Agreement Information retrieval. Extract the SYSID from the contract record and query customer agreement data. Then cross-validate that the provider code from the request matches the provider code stored in customer agreement data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sysid = ekk0081a010Out[0].getString(EKK0081A010CBSMsg1List.SYSID)` // Get SYSID [Field: `SYSID` (EKK0081A010CBSMsg1List.java:29, "SYSID")] |
| 2 | SET | `eck0011a010In = editInMsgECK0011A010(sysid, unyoYMD)` // Build input for ECK0011A010 [Template: `TEMPLATE_ID_ECK0011A010 = "ECK0011A010"` (JFUBackyardMappingConstCC.java:101)] |
| 3 | SET | `eck0011a010Out = callSC(handle, scCall, param, fixedText, eck0011a010In).getCAANMsgList(ECK0011A010CBSMsg.ECK0011A010CBSMSG1LIST)` // Execute SC call |
| 4 | IF | `eck0011a010Out != null && eck0011a010Out.length > 0` |

**Block 2.1** — Nested IF (Provider Code Validation) `(JKKStringUtil.isNullBlank(orsjgsCdEk0011a010) \|\| !orsjgsCd.equals(orsjgsCdEk0011a010))` (L5424)

> Check if the provider code extracted from customer agreement data is null/blank or differs from the request's provider code. A mismatch indicates the request originates from a different provider than the one recorded in customer agreement.

| # | Type | Code |
|---|------|------|
| 1 | SET | `orsjgsCdEk0011a010 = eck0011a010Out[0].getString(ECK0011A010CBSMsg1List.ORSJGS_CD)` // Get provider code [Field: `ORSJGS_CD = "orsjgs_cd"` (ECK0011A010CBSMsg1List.java:164, "卸先事業者コード"; line 1505)] |
| 2 | IF | `JKKStringUtil.isNullBlank(orsjgsCdEk0011a010) \|\| !orsjgsCd.equals(orsjgsCdEk0011a010)` [Comment: 依頼元区分－卸先事業者コードが一致しない / Request source and provider code do not match] |
| 3 | SET | `ccMsg.put(JKKStrConst.RETURN_CODE, JKKStrConst.RETURN_CD_1101)` // Set return code [-> `RETURN_CD_1101 = "1101"` (JKKStrConst.java:5513)] |
| 4 | SET | `ccMsg.put(JKKStrConst.RETURN_MESSAGE, JKKStrConst.RETURN_MESSAGE_ORSJIGS_CHECK_ERROR)` // Set error message [-> `RETURN_MESSAGE_ORSJIGS_CHECK_ERROR = "卸先事業者チェックエラー"` (JKKStrConst.java:5593)] |
| 5 | EXEC | `param.setData(fixedText, ccMsg)` |
| 6 | RETURN | `return JKKStrConst.RETURN_CD_1101` |

**Block 2.2** — Nested Block (Provider Agreement Date Range Check) (L5434)

> **Related Contract**: ECH0911A010 — Provider Agreement Information retrieval. Query provider agreement data using the provider code. Validate that the operational date falls within the provider's active period (application start date to end date).

| # | Type | Code |
|---|------|------|
| 1 | SET | `ech0911a010In = editInMsgECH0911A010(orsjgsCdEk0011a010, unyoYMD)` // Build input [Template: `TEMPLATE_ID_ECH0911A010 = "ECH0911A010"` (JKKOrsjgsUseStpRunCC.java:161)] |
| 2 | SET | `ech0911a010Out = callSC(handle, scCall, param, fixedText, ech0911a010In).getCAANMsgList(ECH0911A010CBSMsg.ECH0911A010CBSMSG1LIST)` // Execute SC call |
| 3 | IF | `ech0911a010Out != null && ech0911a010Out.length > 0` |

**Block 2.2.1** — Nested IF (Date Range Validation) `(tstay <= unyoYMD \|\| unyoYMD <= tend)` (L5437)

> Verify the operational date is within the provider's valid application period. `tstay` = provider application start date, `tend` = provider application end date.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!(ech0911a010Out[0].getString(ECH0911A010CBSMsg1List.ORSJGS_TSTAYMD).compareTo(unyoYMD) <= 0 && ech0911a010Out[0].getString(ECH0911A010CBSMsg1List.ORSJGS_TENDYMD).compareTo(unyoYMD) >= 0)` |
| 2 | SET | `ccMsg.put(JKKStrConst.RETURN_CODE, JKKStrConst.RETURN_CD_1101)` |
| 3 | SET | `ccMsg.put(JKKStrConst.RETURN_MESSAGE, JKKStrConst.RETURN_MESSAGE_ORSJIGS_CHECK_ERROR)` |
| 4 | EXEC | `param.setData(fixedText, ccMsg)` |
| 5 | RETURN | `return JKKStrConst.RETURN_CD_1101` |

Field references:
- `ORSJGS_TSTAYMD = "orsjgs_tstaymd"` (ECH0911A010CBSMsg1List.java:31, "卸先事業者適用開始年月日" / Provider application start date-month-day, line 176)
- `ORSJGS_TENDYMD = "orsjgs_tendymd"` (ECH0911A010CBSMsg1List.java:32, "卸先事業者適用終了年月日" / Provider application end date-month-day, line 177)

**Block 3** — Contract Status Check `(svcKeiStat != "100")` (L5450)

> The service contract status must be "100" (Service Active / サービス提供中). If the status is any other value, the contract is not eligible for suspension processing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiStat = ekk0081a010Out[0].getString(EKK0081A010CBSMsg1List.SVC_KEI_STAT)` // Get service contract status [Field: `SVC_KEI_STAT = "svc_kei_stat"` (EKK0081A010CBSMsg1List.java:28, "サービス契約ステータス" / Service contract status)] |
| 2 | IF | `!JKKStrConst.CD00037_SVCTK_CHU.equals(svcKeiStat)` [-> `CD00037_SVCTK_CHU = "100"` (JKKStrConst.java:2698)] [Comment: サービス契約ステータスが100_サービス提供中外の場合 / If service contract status is not 100_Service Active] |
| 3 | SET | `ccMsg.put(JKKStrConst.RETURN_CODE, JKKStrConst.RETURN_CD_1102)` // Set return code [-> `RETURN_CD_1102 = "1102"` (JKKStrConst.java:5516)] |
| 4 | SET | `ccMsg.put(JKKStrConst.RETURN_MESSAGE, JKKStrConst.RETURN_MESSAGE_KEI_STAT_CHECK_ERROR)` // Set error message [-> `RETURN_MESSAGE_KEI_STAT_CHECK_ERROR = "契約状態チェックエラー"` (JKKStrConst.java:5596)] |
| 5 | EXEC | `param.setData(fixedText, ccMsg)` |
| 6 | RETURN | `return JKKStrConst.RETURN_CD_1102` |

**Block 4** — Contract Service Type Check `(!svcCd in 01, 02, 03)` (L5461)

> The contracted service must be one of: "01" (FTTH / Fiber To The Home), "02" (Tel / Telephone), or "03" (TV / Television). Services outside these types (e.g., hosting, other) are not eligible for this provider use suspension processing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcCd = ekk0081a010Out[0].getString(EKK0081A010CBSMsg1List.SVC_CD)` // Get service code [Field: `SVC_CD = "svc_cd"` (EKK0081A010CBSMsg1List.java:37, "サービスコード" / Service code)] |
| 2 | IF | `!(JKKStrConst.CD00130_01.equals(svcCd) \|\| JKKStrConst.CD00130_02.equals(svcCd) \|\| JKKStrConst.CD00130_03.equals(svcCd))` |
| 3 | SET | `ccMsg.put(JKKStrConst.RETURN_CODE, JKKStrConst.RETURN_CD_1103)` // Set return code [-> `RETURN_CD_1103 = "1103"` (JKKStrConst.java:5519)] |
| 4 | SET | `ccMsg.put(JKKStrConst.RETURN_MESSAGE, JKKStrConst.RETURN_MESSAGE_KEI_SVC_CHECK_ERROR)` // Set error message [-> `RETURN_MESSAGE_KEI_SVC_CHECK_ERROR = "契約サービスチェックエラー"` (JKKStrConst.java:5599)] |
| 5 | EXEC | `param.setData(fixedText, ccMsg)` |
| 6 | RETURN | `return JKKStrConst.RETURN_CD_1103` |

**Block 5** — Success Return (L5472)

> All checks passed. The method returns the check success constant.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return JKKStrConst.CHECK_OK` [-> `CHECK_OK = "0000"` (JKKStrConst.java:5533)] |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle used for executing service component (SC) calls. Provides the transaction and database connection context for CBS queries (EKK0081A010, ECK0011A010, ECH0911A010). |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object carrying bidirectional data exchange between the calling method and this check. Used to read the CC message map (via `getData(fixedText)`) and write back return codes and messages (via `setData(fixedText, ccMsg)`). |
| 3 | `fixedText` | `String` | A key string used to identify the CC message data block within `param`. Acts as the map key for storing and retrieving the `ccMsg` HashMap that carries return codes, return messages, and other inter-method data. |

**Extracted fields from ccMsg:**

| Field Constant | Key | Business Meaning |
|---------------|-----|------------------|
| `SVC_KEI_NO` | `"svc_kei_no"` | Service contract number — unique identifier for the service contract being checked |
| `IRAIMOTO_KBN` | `"channel"` | Request source classification — provider code from the originating request |

**Constants resolved within the method:**

| Constant | Resolved Value | Source Location |
|----------|---------------|-----------------|
| `CD00037_SVCTK_CHU` | `"100"` | JKKStrConst.java:2698 |
| `CD00130_01` | `"01"` | JKKStrConst.java:347 |
| `CD00130_02` | `"02"` | JKKStrConst.java:350 |
| `CD00130_03` | `"03"` | JKKStrConst.java:353 |
| `CHECK_OK` | `"0000"` | JKKStrConst.java:5533 |
| `RETURN_CD_1100` | `"1100"` | JKKStrConst.java:5510 |
| `RETURN_CD_1101` | `"1101"` | JKKStrConst.java:5513 |
| `RETURN_CD_1102` | `"1102"` | JKKStrConst.java:5516 |
| `RETURN_CD_1103` | `"1103"` | JKKStrConst.java:5519 |
| `TEMPLATE_ID_EKK0081A010` | `"EKK0081A010"` | JKKHakkoSODConstCC.java:638 |
| `TEMPLATE_ID_ECK0011A010` | `"ECK0011A010"` | JFUBackyardMappingConstCC.java:101 |
| `TEMPLATE_ID_ECH0911A010` | `"ECH0911A010"` | JKKOrsjgsUseStpRunCC.java:161 |
| `STRING_2` | `"2"` | JKKOrsjgsUseStpRunCC.java:237 |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `editInMsgEKK0081A010` | EKK0081A010 | KK_T_SVC_KEI (Service Contract) | Builds input message for Service Contract Agreement Information retrieval query by service contract number and reservation application date |
| R | `callSC` (EKK0081A010) | EKK0081A010SC | KK_T_SVC_KEI | Queries service contract agreement detail including status, system ID, and service code |
| R | `editInMsgECK0011A010` | ECK0011A010 | KK_T_CUSTOMER_AGREEMENT | Builds input message for Customer Agreement Information retrieval query by SYSID and reservation application date |
| R | `callSC` (ECK0011A010) | ECK0011A010SC | KK_T_CUSTOMER_AGREEMENT | Queries customer agreement data including provider code |
| R | `editInMsgECH0911A010` | ECH0911A010 | KK_T_PROVIDER_AGREEMENT | Builds input message for Provider Agreement Information retrieval query by provider code |
| R | `callSC` (ECH0911A010) | ECH0911A010SC | KK_T_PROVIDER_AGREEMENT | Queries provider agreement data including application start/end dates for suspension validity |
| - | `callSC` (generic dispatcher) | - | - | Internal method that routes input messages to the appropriate SC and processes CBS responses |
| - | `editInMsgEKK0081A010` | - | - | Local helper that constructs Object[][] input arrays for EKK0081A010 CBS |
| - | `editInMsgECK0011A010` | - | - | Local helper that constructs Object[][] input arrays for ECK0011A010 CBS |
| - | `editInMsgECH0911A010` | - | - | Local helper that constructs Object[][] input arrays for ECH0911A010 CBS |
| U | `param.setData` | - | - | Writes result HashMap (return code and message) back to request parameter object |
| R | `JPCBPCommon.getOpeDate` | - | - | Retrieves operational date (application date) for use in SC query parameters |
| R | `JKKStringUtil.isNullBlank` | - | - | Utility check for null or blank string values |

**Entity/DB Table inference:**
- **KK_T_SVC_KEI** (Service Contract Table) — referenced by EKK0081A010 which retrieves service contract agreement details (contract number, status, SYSID, service code). The CBS name pattern `EKK0081A010` maps to SC code `EKK0081A010SC`.
- **KK_T_CUSTOMER_AGREEMENT** (Customer Agreement Table) — referenced by ECK0011A010 which retrieves customer agreement data keyed by SYSID, returning provider code. CBS name pattern `ECK0011A010` maps to SC code `ECK0011A010SC`.
- **KK_T_PROVIDER_AGREEMENT** (Provider Agreement Table) — referenced by ECH0911A010 which retrieves provider agreement data including valid date range (tstay/tend). CBS name pattern `ECH0911A010` maps to SC code `ECH0911A010SC`.

All operations are **Read (R)** — this method performs validation checks only and does not modify any data.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: JKKOrsjgsUseStpRunCC.orsjgsRunUseStp | `JKKOrsjgsUseStpRunCC.orsjgsRunUseStp` -> `JKKOrsjgsUseStpRunCC.orsjgsUseStpKanrencheck` | `callSC(EKK0081A010) [R] KK_T_SVC_KEI`, `callSC(ECK0011A010) [R] KK_T_CUSTOMER_AGREEMENT`, `callSC(ECH0911A010) [R] KK_T_PROVIDER_AGREEMENT` |

**Call chain detail:**
- The method `orsjgsRunUseStp()` (within `JKKOrsjgsUseStpRunCC`) is the direct caller.
- It is invoked when the service ID in `use_stp_map` equals `wsale021` (Service ID for provider use suspension linkage).
- The call is guarded by: `if (use_stp_map.containsKey(SERVICE_ID) && SERVICE_ID_WSALE021.equals(use_stp_map.get(SERVICE_ID)))`
- If the check fails (returns non-`CHECK_OK`), `orsjgsRunUseStp` returns early without proceeding to the actual suspension processing.
- If the check passes (`CHECK_OK = "0000"`), processing continues to `runUseStpProc()`.

## 6. Per-Branch Detail Blocks

**Block 0** — Initialization (L5385–5398)

> Initialize the method by extracting business context from the parameter map, creating a service component invoker, and computing the operational date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ccMsg = (HashMap)param.getData(fixedText)` // Extract CC message map |
| 2 | SET | `scCall = new ServiceComponentRequestInvoker()` // SC call instance [Comment: Creates instance; log class name passed as param, empty string suppresses logging] |
| 3 | SET | `svcKeiNo = (String)ccMsg.get(JKKStrConst.SVC_KEI_NO)` // Get service contract number [-> `SVC_KEI_NO = "svc_kei_no"` (JKKStrConst.java:5545)] |
| 4 | SET | `orsjgsCd = (String)ccMsg.get(JKKStrConst.IRAIMOTO_KBN)` // Get provider code [-> `IRAIMOTO_KBN = "channel"` (JKKStrConst.java:5539)] |
| 5 | SET | `unyoYMD = JPCBPCommon.getOpeDate(null)` // Get operational date |

**Block 1** — IF (Contract Existence Check) `(L5402–5410)` [Condition: `ekk0081a010Out.length == 0`]

> Query service contract agreement data using the service contract number. If no contract exists, short-circuit with error 1100 (Contract Check Error).

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0081a010 = editInMsgEKK0081A010(svcKeiNo, unyoYMD)` // Input: template=EKK0081A010, func_code=2, svc_kei_no, rsv_apl_ymd [-> `TEMPLATE_ID_EKK0081A010 = "EKK0081A010"` (JKKHakkoSODConstCC.java:638)] |
| 2 | CALL | `ekk0081a010Out = callSC(handle, scCall, param, fixedText, ekk0081a010).getCAANMsgList(EKK0081A010CBSMsg.EKK0081A010CBSMSG1LIST)` |
| 3 | IF | `ekk0081a010Out.length == 0` [-> `RETURN_CD_1100 = "1100"` (JKKStrConst.java:5510)] |
| 4 | SET | `ccMsg.put(RETURN_CODE, RETURN_CD_1100)` [-> `RETURN_CODE = "returnCode"` (JKKStrConst.java:5548)] |
| 5 | SET | `ccMsg.put(RETURN_MESSAGE, RETURN_MESSAGE_KEI_EXISTS_CHECK_ERROR)` [-> `"契約存在チェックエラー"` (JKKStrConst.java:5590)] |
| 6 | EXEC | `param.setData(fixedText, ccMsg)` |
| 7 | RETURN | `return RETURN_CD_1100` |

**Block 2** — IF (Provider Code Extraction) `(L5413–5458)` [Condition: `eck0011a010Out != null && eck0011a010Out.length > 0`]

> Query customer agreement data using the SYSID extracted from the contract record. If customer agreement data exists, validate the provider code.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sysid = ekk0081a010Out[0].getString(EKK0081A010CBSMsg1List.SYSID)` |
| 2 | SET | `eck0011a010In = editInMsgECK0011A010(sysid, unyoYMD)` // Input: template=ECK0011A010, func_code=2, sysid, rsv_apl_ymd [-> `TEMPLATE_ID_ECK0011A010 = "ECK0011A010"` (JFUBackyardMappingConstCC.java:101)] |
| 3 | CALL | `eck0011a010Out = callSC(handle, scCall, param, fixedText, eck0011a010In).getCAANMsgList(ECK0011A010CBSMsg.ECK0011A010CBSMSG1LIST)` |
| 4 | IF | `eck0011a010Out != null && eck0011a010Out.length > 0` |

**Block 2.1** — IF (Provider Code Null/Mismatch) `(L5424–5432)` [Condition: `isNullBlank(orsjgsCdEk0011a010) \|\| !orsjgsCd.equals(orsjgsCdEk0011a010)`]

> If the provider code from customer agreement is null/blank or does not match the request's provider code, reject with error 1101.

| # | Type | Code |
|---|------|------|
| 1 | SET | `orsjgsCdEk0011a010 = eck0011a010Out[0].getString(ECK0011A010CBSMsg1List.ORSJGS_CD)` [Field: `ORSJGS_CD = "orsjgs_cd"` (ECK0011A010CBSMsg1List.java:164/1505)] |
| 2 | IF | `JKKStringUtil.isNullBlank(orsjgsCdEk0011a010) \|\| !orsjgsCd.equals(orsjgsCdEk0011a010)` |
| 3 | SET | `ccMsg.put(RETURN_CODE, RETURN_CD_1101)` [-> `RETURN_CD_1101 = "1101"` (JKKStrConst.java:5513)] |
| 4 | SET | `ccMsg.put(RETURN_MESSAGE, RETURN_MESSAGE_ORSJIGS_CHECK_ERROR)` [-> `"卸先事業者チェックエラー"` (JKKStrConst.java:5593)] |
| 5 | EXEC | `param.setData(fixedText, ccMsg)` |
| 6 | RETURN | `return RETURN_CD_1101` |

**Block 2.2** — Nested Block (Provider Agreement Query) `(L5434–5457)`

> Query provider agreement data and validate date range if results exist.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ech0911a010In = editInMsgECH0911A010(orsjgsCdEk0011a010, unyoYMD)` // Input: template=ECH0911A010, func_code=2, orsjgs_cd [-> `TEMPLATE_ID_ECH0911A010 = "ECH0911A010"` (JKKOrsjgsUseStpRunCC.java:161)] |
| 2 | CALL | `ech0911a010Out = callSC(handle, scCall, param, fixedText, ech0911a010In).getCAANMsgList(ECH0911A010CBSMsg.ECH0911A010CBSMSG1LIST)` |
| 3 | IF | `ech0911a010Out != null && ech0911a010Out.length > 0` |

**Block 2.2.1** — IF (Date Range Validation) `(L5437–5446)` [Condition: `!(tstay <= unyoYMD <= tend)`]

> Verify the operational date falls within the provider's valid application period. If the provider's suspension period does not cover the current operational date, reject.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!(ech0911a010Out[0].getString(ORSJGS_TSTAYMD).compareTo(unyoYMD) <= 0 && ech0911a010Out[0].getString(ORSJGS_TENDYMD).compareTo(unyoYMD) >= 0)` |
| 2 | SET | `ccMsg.put(RETURN_CODE, RETURN_CD_1101)` |
| 3 | SET | `ccMsg.put(RETURN_MESSAGE, RETURN_MESSAGE_ORSJIGS_CHECK_ERROR)` |
| 4 | EXEC | `param.setData(fixedText, ccMsg)` |
| 5 | RETURN | `return RETURN_CD_1101` |

Field: `ORSJGS_TSTAYMD = "orsjgs_tstaymd"` (ECH0911A010CBSMsg1List.java:31/176, "卸先事業者適用開始年月日"), `ORSJGS_TENDYMD = "orsjgs_tendymd"` (ECH0911A010CBSMsg1List.java:32/177, "卸先事業者適用終了年月日")

**Block 3** — IF (Contract Status Check) `(L5450–5459)` [Condition: `!svcKeiStat.equals("100")`]

> Validate the service contract status is "100" (Service Active). If not active, reject with error 1102 (Contract Status Check Error).

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiStat = ekk0081a010Out[0].getString(EKK0081A010CBSMsg1List.SVC_KEI_STAT)` [Field: `SVC_KEI_STAT = "svc_kei_stat"` (EKK0081A010CBSMsg1List.java:28, "サービス契約ステータス")] |
| 2 | IF | `!CD00037_SVCTK_CHU.equals(svcKeiStat)` [-> `CD00037_SVCTK_CHU = "100"` (JKKStrConst.java:2698)] |
| 3 | SET | `ccMsg.put(RETURN_CODE, RETURN_CD_1102)` [-> `RETURN_CD_1102 = "1102"` (JKKStrConst.java:5516)] |
| 4 | SET | `ccMsg.put(RETURN_MESSAGE, RETURN_MESSAGE_KEI_STAT_CHECK_ERROR)` [-> `"契約状態チェックエラー"` (JKKStrConst.java:5596)] |
| 5 | EXEC | `param.setData(fixedText, ccMsg)` |
| 6 | RETURN | `return RETURN_CD_1102` |

**Block 4** — IF (Contract Service Type Check) `(L5461–5472)` [Condition: `svcCd NOT IN ("01", "02", "03")`]

> Validate the contracted service type is FTTH, Telephone, or Television. Services outside this set (e.g., hosting, other telecom services) are not covered by this suspension process. Reject with error 1103.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcCd = ekk0081a010Out[0].getString(EKK0081A010CBSMsg1List.SVC_CD)` [Field: `SVC_CD = "svc_cd"` (EKK0081A010CBSMsg1List.java:37, "サービスコード")] |
| 2 | IF | `!(CD00130_01.equals(svcCd) \|\| CD00130_02.equals(svcCd) \|\| CD00130_03.equals(svcCd))` [-> `CD00130_01 = "01"` (JKKStrConst.java:347), `CD00130_02 = "02"` (JKKStrConst.java:350), `CD00130_03 = "03"` (JKKStrConst.java:353)] |
| 3 | SET | `ccMsg.put(RETURN_CODE, RETURN_CD_1103)` [-> `RETURN_CD_1103 = "1103"` (JKKStrConst.java:5519)] |
| 4 | SET | `ccMsg.put(RETURN_MESSAGE, RETURN_MESSAGE_KEI_SVC_CHECK_ERROR)` [-> `"契約サービスチェックエラー"` (JKKStrConst.java:5599)] |
| 5 | EXEC | `param.setData(fixedText, ccMsg)` |
| 6 | RETURN | `return RETURN_CD_1103` |

**Block 5** — RETURN (L5472)

> All validation checks passed. Return success.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return CHECK_OK` [-> `CHECK_OK = "0000"` (JKKStrConst.java:5533)] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — unique identifier for a service contract record in the telecom system |
| `svc_kei_stat` | Field | Service contract status — indicates current state of the contract; "100" means service is active (サービス提供中) |
| `svc_cd` | Field | Service code — classifies the type of service (01=FTTH, 02=Telephone, 03=TV, 04=Hosting, etc.) |
| `orsjgs_cd` | Field | Provider code (卸先事業者コード) — identifies the service provider/wholesaler in the business relationship |
| `orsjgs_tstaymd` | Field | Provider application start date-month-day (卸先事業者適用開始年月日) — date when provider agreement becomes effective |
| `orsjgs_tendymd` | Field | Provider application end date-month-day (卸先事業者適用終了年月日) — date when provider agreement expires |
| `channel` | Field | Request source classification — indicates the originating channel/provider of the request |
| `sysid` | Field | System ID — unique internal identifier for a customer agreement record |
| `unyo_ymd` | Field | Operational date-month-day (運用年月日) — the business date used for querying data with temporal validity |
| `rsv_apl_ymd` | Field | Reservation application date — date used for temporal contract queries |
| CD00037_SVCTK_CHU | Constant | Contract status code "100" — represents "Service Active / サービス提供中" state |
| CD00130_01 | Constant | Service code "01" — FTTH (Fiber To The Home) broadband internet service |
| CD00130_02 | Constant | Service code "02" — Telephone (TEL) service |
| CD00130_03 | Constant | Service code "03" — Television (TV) service |
| CD00130_04 | Constant | Service code "04" — Hosting service |
| RETURN_CD_1100 | Constant | Error code "1100" — Contract existence check failure (契約存在チェックエラー) |
| RETURN_CD_1101 | Constant | Error code "1101" — Provider identity check failure (卸先事業者チェックエラー) |
| RETURN_CD_1102 | Constant | Error code "1102" — Contract status check failure (契約状態チェックエラー) |
| RETURN_CD_1103 | Constant | Error code "1103" — Contract service type check failure (契約サービスチェックエラー) |
| CHECK_OK | Constant | Success code "0000" — all validation checks passed |
| EKK0081A010 | SC Code | Service Contract Agreement Information retrieval SC — queries KK_T_SVC_KEI for contract detail |
| ECK0011A010 | SC Code | Customer Agreement Information retrieval SC — queries KK_T_CUSTOMER_AGREEMENT for customer-provider relationship |
| ECH0911A010 | SC Code | Provider Agreement Information retrieval SC — queries KK_T_PROVIDER_AGREEMENT for provider suspension period validity |
| WSALE021 | Constant | Service ID for provider use suspension linkage (利用停止連携－卸先事業者) — triggers this check in the main process |
| WSALE020 | Constant | Service ID for provider use suspension release linkage (利用停止解除連携－卸先事業者) |
| SERVICE_ID | Constant | Key for service ID in the use suspension map |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband internet service delivered directly to premises |
| SC | Acronym | Service Component — a microservice/CBS layer component that handles database queries and business logic |
| CBS | Acronym | Common Business Service — the service layer component that interfaces with the database |
| SYSID | Acronym | System ID — internal unique identifier for customer/agreement records |
| CAANMsg | Class | Common Application Anotation Network Message — the message container used for CBS input/output data exchange |
| JPCBPCommon | Class | Common PC business processing utility — provides shared methods like getOpeDate for operational date retrieval |
| 卸先事業者 (orsjgs) | Japanese term | Provider / Wholesaler — the service provider entity in the B2B relationship |
| 利用停止 (riyou teishi) | Japanese term | Service suspension / Use stop — the business operation of suspending a provider's service access |
| サービス提供中 (svctk_chu) | Japanese term | Service Active — the contract status indicating the service is currently being provided |
| 契約存在チェック (kei_zenzai) | Japanese term | Contract existence check — validation that a service contract record exists for the given contract number |
| 契約状態チェック (kei_joutai) | Japanese term | Contract status check — validation that the contract is in an active state |
| 契約サービスチェック (kei_svc) | Japanese term | Contract service check — validation that the contracted service type is within the supported set |
| 依頼元区分 (iraimoto_kbn) | Japanese term | Request source classification — identifies the origin/channel of the request, here mapped to provider code |
| 適用開始 (tekiyou kaishi) | Japanese term | Application start — the date from which provider agreement terms take effect |
| 適用終了 (tekiyou shuryou) | Japanese term | Application end — the date when provider agreement terms expire |
