---
# Business Logic — JKKCourseRkRtrNsIdChgCC.execChgRouterNinshoId() [58 LOC]

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

## 1. Role

### JKKCourseRkRtrNsIdChgCC.execChgRouterNinshoId()

This method orchestrates the **Router Approval (NINSHO) ID change process** for a K-Opticom fiber-optic (FTTH) service contract. It is the central workflow handler for changing the router identification number associated with a customer's service line, which is a prerequisite step in router exchange or equipment change procedures.

The method performs a strictly sequential, three-step operation chain: first, it queries the **same processing number** (same transaction ID used to correlate multi-step business processes) by calling `EKK1081C011`. Second, it registers the **order issuance conditions** (order generation criteria) by calling `EKK1081D010`, passing the same processing number from step one along with service contract details, device model code, and device serial number. Third, and only when the `funcCode` equals `"1"` (Check & Update mode), it creates the **order information work record** by calling `EKK1551D010`, using the order issuance condition number returned from step two.

This method implements a **sequential composition pattern** — each step's output feeds directly into the next step's input (especially the same processing number and order issuance condition number). It acts as an **orchestrator** within the larger router ID change screen flow, delegating actual data operations to CBS (Common Business Services) layer while managing the inter-step data correlation. It is a shared utility method called by `JKKCourseRkRtrNsIdChgCC.execute()`, used whenever the system needs to process a router NINSHO ID change for FTTH service contracts.

When `funcCode = "1"` (Check & Update — チェック＆更新), all three steps execute in sequence. When `funcCode` differs (e.g., "2" for check-only or "3"), only the first two steps (same processing number retrieval and order issuance condition registration) execute, and the order information work registration step is skipped.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execChgRouterNinshoId(params)"])
    START --> GET_ROUTER_ID["Get Router NINSHO ID via EKK1081C011SC"]
    GET_ROUTER_ID --> CALL_1081C["callSC EKK1081C011CBSMsg"]
    CALL_1081C --> EXTRACT_TRN["Extract SAME_TRN_NO from outMsg"]
    EXTRACT_TRN --> BUILD_1081D["Build EKK1081D010 input with funcCode, svcKeiNo, svcKeiUcwkNo, kktkSvcKeiNo, taknKikiMdCd, kikiSeizoNo, sameTrnNo"]
    BUILD_1081D --> CALL_1081D["callSC EKK1081D010CBSMsg"]
    CALL_1081D --> EXTRACT_JOKEN["Extract ODR_HAKKO_JOKEN_NO from outMsg"]
    EXTRACT_JOKEN --> CHECK_FUNCCODE{funcCode equals FUNC_CODE 1}
    CHECK_FUNCCODE -->|Yes| BUILD_1551D["Build EKK1551D010 input with funcCode, odrHakkoJokenNo, svcKeiNo, dates, svcKeiUcwkNo, kktkSvcKeiNo"]
    BUILD_1551D --> CALL_1551D["callSC EKK1551D010CBSMsg"]
    CALL_1551D --> END_NODE(["Return Next"])
    CHECK_FUNCCODE -->|No| END_NODE
```

**Processing flow summary:**

1. **Same Processing Number Retrieval (Line 413-416):** The method calls `editInMsgEKK1081C011()` to build the input message for the same processing number search CBS, then invokes `callSC()` to execute the service component. The response contains the `SAME_TRN_NO` (same transaction number).

2. **Order Issuance Condition Registration (Line 420-431):** Builds the input message for `EKK1081D010` passing service contract number, work number, K-KTokyo service contract number, device model code, device serial number (added in v7.00.00), and the `SAME_TRN_NO` extracted from the previous step. Sets hardcoded constants: `ORDER_SBT_CD_NET="1"` (Network), `SVC_ORDER_CD_ROUTER="0A"` (Router Information), `YOKYU_SBT_CD_CHG="04"` (Change), `ODR_HAKKO_JOKEN_CD_SOKJI_HAKKO="01"` (Immediate Issuance). Then calls `callSC()`.

3. **Conditional Order Information Work Registration (Line 433-449):** If `funcCode` equals `"1"` (Check & Update), builds the input message for `EKK1551D010` using the `ODR_HAKKO_JOKEN_NO` (order issuance condition number) from the step 2 response, along with all dates, service numbers, and sets `ODR_NAIYO_CD_163="163"` (Router Connection Info Change). Executes via `callSC()`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle for the current transaction context. Provides the persistence session used to execute CBS calls and manage transaction boundaries. |
| 2 | `scCall` | `ServiceComponentRequestInvoker` | Service Component call invoker — the runtime dispatcher that routes CBS (Common Business Service) invocations to the appropriate backend service implementation. |
| 3 | `param` | `IRequestParameterReadWrite` | Request parameter read/write interface — carries request-scoped parameters and data between the screen layer and the business logic layer. |
| 4 | `fixedText` | `String` | Fixed text key (dataMapKey) used to identify the CBS template and message mapping configuration during service component calls. |
| 5 | `funcCode` | `String` | Function code that determines the operation mode. `"1"` = Check & Update (チェック＆更新 — performs full processing), `"2"` = Check Only (チェックのみ), `"3"` = other mode. Controls whether the third step (order information work registration) executes. |
| 6 | `params` | `String[]` | Array of business data parameters passed from the calling screen. Contains 8 indexed values: `[0]` = service contract number (svcKeiNo), `[1]` = service creation date-time (kk0081GeneAddDtm), `[2]` = service detail work number (svcKeiUcwkNo), `[3]` = service detail work date-time (kk0161GeneAddDtm), `[4]` = K-KTokyo service contract number (kktkSvcKeiNo), `[5]` = K-KTokyo reservation registration date-time (kk0341RsvGeneAddDtm), `[6]` = equipment provider model code (taknKikiMdCd), `[7]` = equipment serial number (kikiSeizoNo). These are primarily extracted during v7.00.00 for device-specific registration. |

**Instance fields read:**
- None directly — this method is self-contained and passes all required data through parameters and the `callSC`/`editInMsg*` method chain.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `callSC` (EKK1081C011CBSMsg) | EKK1081C011SC | Same processing number data | Calls `callSC` to retrieve the same transaction number (SAME_TRN_NO) for correlating multi-step router ID change processing. Maps template `EKK1081C011` with funcCode `"1"`. |
| R/U | `callSC` (EKK1081D010CBSMsg) | EKK1081D010SC | Order issuance condition table | Calls `callSC` to register order issuance conditions. Sets order type to Network (`"1"`), service order to Router Info (`"0A"`), request type to Change (`"04"`), issuance criteria to Immediate Issuance (`"01"`). Includes device model code and serial number. |
| R/U | `callSC` (EKK1551D010CBSMsg) | EKK1551D010SC | Order information work table | Conditionally called when `funcCode = "1"`. Creates order information work record with order issuance condition number, order content type Router Connection Info Change (`"163"`), and all relevant date-time fields for service and K-KTokyo contracts. |

### Detail Analysis:

**R — EKK1081C011SC (Same Processing Number Search / 同一処理番号採番)**
- **SC Code:** `EKK1081C011SC`
- **Template ID:** `EKK1081C011`
- **Operation:** Read — Retrieves the next available same processing number (transaction correlation ID) that links all steps of the router ID change workflow together.
- **Input:** Template ID, funcCode `"1"`
- **Output:** `SAME_TRN_NO` — a unique transaction number used across all three CBS calls for process correlation.

**R/U — EKK1081D010SC (Order Issuance Condition Registration / オーダー発行条件登録)**
- **SC Code:** `EKK1081D010SC`
- **Template ID:** `EKK1081D010`
- **Operation:** Register (Create/Update) — Registers the conditions under which an order will be issued for the router ID change. This includes the service contract number, work number, device information, and business classification codes.
- **Input:** funcCode, service contract number, work number, K-KTokyo contract number, device model code (v7+), device serial number (v7+), same transaction number, order sub-type `"1"` (Network), service order code `"0A"` (Router), request type `"04"` (Change), order issuance criteria `"01"` (Immediate).
- **Output:** `ODR_HAKKO_JOKEN_NO` — the order issuance condition number, used as input to the next step.

**R/U — EKK1551D010SC (Order Information Creation Work Registration / オーダー情報作成ワーク登録)**
- **SC Code:** `EKK1551D010SC`
- **Template ID:** `EKK1551D010`
- **Operation:** Register (Create/Update) — Conditionally executed only when `funcCode = "1"`. Creates the order information work record that documents the router connection information change request, including all temporal markers for service contracts and K-KTokyo contracts.
- **Input:** funcCode, order issuance condition number (from EKK1081D010 response), service contract number, service creation date-time, work number, work date-time, K-KTokyo contract number, K-KTokyo reservation date-time, order content code `"163"` (Router Connection Info Change).
- **Output:** None (void call — fire-and-forget work registration).

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `callSC` [R], `editInMsgEKK1551D010` [U], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `callSC` [R], `editInMsgEKK1081D010` [U], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `callSC` [R], `editInMsgEKK1081C011` [U]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CC: JKKCourseRkRtrNsIdChgCC | `JKKCourseRkRtrNsIdChgCC.execute()` -> `execChgRouterNinshoId()` | `EKK1081C011SC [R] Same Trans No`, `EKK1081D010SC [R/U] Order Issuance Condition`, `EKK1551D010SC [R/U] Order Info Work` |

**Notes:**
- This method is a **private utility method** called exclusively by `JKKCourseRkRtrNsIdChgCC.execute()` within the same class.
- The broader entry point would be a screen (likely `KKSV0004`-class screen) that invokes `execute()`, but the call chain from screen to `execute()` is not directly traced within 8 hops.
- This class's purpose (per header comment): **「コース変更予約取消の共通コンポーネント（ルーター認証ID変更）」** — Common component for course change reservation cancellation (Router Authentication ID Change).

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Build EKK1081C011 input and execute (L413-L416)

> Retrieves the same processing number (同一処理番号採番). Prepares the input message by calling `editInMsgEKK1081C011()` which sets template ID `EKK1081C011` and funcCode `"1"` (Check & Update), then executes the service component.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `ekk1081c011InMsg = editInMsgEKK1081C011()` // Returns `Object[][]` with TEMPLATEID=`"EKK1081C011"`, FUNC_CODE=`FUNC_CODE_1="1"` |
| 2 | CALL | `ekk1081c011OutMsg = callSC(handle, scCall, param, fixedText, ekk1081c011InMsg)` // Executes same processing number search; returns CAANMsg |

**Block 2** — [SET] Build EKK1081D010 input and execute (L420-L431)

> Registers order issuance conditions (オーダー発行条件登録). Builds the input message with service contract details, device model and serial number (added in v7.00.00), and the same transaction number from Block 1. Sets multiple hardcoded classification constants.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `ekk1081d010InMsg = editInMsgEKK1081D010(funcCode, params[0], params[2], params[4], params[6], params[7], ekk1081c011OutMsg.getString(SAME_TRN_NO))` // Passes 7 parameters: funcCode, svcKeiNo, svcKeiUcwkNo, kktkSvcKeiNo, taknKikiMdCd, kikiSeizoNo, sameTrnNo |
| 2 | SET | Inside editInMsgEKK1081D010: TEMPLATEID = `TEMPLATE_ID_EKK1081D010="EKK1081D010"` |
| 3 | SET | FUNC_CODE = `funcCode` (passed in) |
| 4 | SET | SVC_KEI_NO = `params[0]` (service contract number) |
| 5 | SET | SVC_KEI_UCWK_NO = `params[2]` (service detail work number) |
| 6 | SET | KKTK_SVC_KEI_NO = `params[4]` (K-KTokyo service contract number) |
| 7 | SET | TAKNKIKI_MODEL_CD = `params[6]` (equipment provider model code) [v7.00.00+] |
| 8 | SET | KIKI_SEIZO_NO = `params[7]` (equipment serial number) [v7.00.00+] |
| 9 | SET | ORDER_SBT_CD = `ORDER_SBT_CD_NET="1"` [-> Network / ネット] |
| 10 | SET | SVC_ORDER_CD = `SVC_ORDER_CD_ROUTER="0A"` [-> Router Information / ルーター向け情報] |
| 11 | SET | YOKYU_SBT_CD = `YOKYU_SBT_CD_CHG="04"` [-> Change / 変更] |
| 12 | SET | ODR_HAKKO_JOKEN_CD = `ODR_HAKKO_JOKEN_CD_SOKJI_HAKKO="01"` [-> Immediate Issuance / 即時発行] |
| 13 | SET | SAME_TRN_NO = from step 1 output |
| 14 | CALL | `ekk1081d010OutMsg = callSC(handle, scCall, param, fixedText, ekk1081d010InMsg)` // Executes order issuance condition registration |

**Block 3** — [IF] funcCode check for order information work registration (L433-L449)

> Conditional block: only when `funcCode = "1"` (Check & Update — チェック＆更新), the method proceeds to create the order information work record. When funcCode is `"2"` (check only) or `"3"`, this entire block is skipped.

**Block 3.1** — [nested SET] Build EKK1551D010 input and execute (L440-L449)

> Creates the order information work (オーダー情報作成ワーク登録). Uses the order issuance condition number from Block 2's output, along with all date-time fields from the params array.

| # | Type | Code |
|---|------|------|
| 1 | SET | `funcCode` = `"1"` (condition evaluated true) |
| 2 | CALL | `ekk1051d010InMsg = editInMsgEKK1551D010(funcCode, ekk1081d010OutMsg.getString(ODR_HAKKO_JOKEN_NO), params[0], params[1], params[2], params[3], params[4], params[5])` // 8 parameters: funcCode, odrHakkoJokenNo, svcKeiNo, kk0081GeneAddDtm, svcKeiUcwkNo, kk0161GeneAddDtm, kktkSvcKeiNo, kk0341RsvGeneAddDtm |
| 3 | SET | Inside editInMsgEKK1551D010: TEMPLATEID = `TEMPLATE_ID_EKK1551D010="EKK1551D010"` |
| 4 | SET | FUNC_CODE = `funcCode="1"` |
| 5 | SET | ODR_HAKKO_JOKEN_NO = from EKK1081D010 response |
| 6 | SET | ODR_NAIYO_CD = `ODR_NAIYO_CD_163="163"` [-> Router Connection Info Change / ルーター向け接続情報・変更] |
| 7 | SET | SVC_KEI_NO = `params[0]` (service contract number) |
| 8 | SET | SVKEI_GADTM = `params[1]` (service creation date-time) |
| 9 | SET | SVC_KEI_UCWK_NO = `params[2]` (service detail work number) |
| 10 | SET | SVKEIUW_GADTM = `params[3]` (service detail work date-time) |
| 11 | SET | KKTK_SVC_KEI_NO = `params[4]` (K-KTokyo service contract number) |
| 12 | SET | KKTSVKEI_GADTM = `params[5]` (K-KTokyo reservation date-time) |
| 13 | CALL | `callSC(handle, scCall, param, fixedText, ekk1051d010InMsg)` // Executes order information work registration |

**Block 3.2** — [ELSE-IF/ELSE implicit] funcCode != "1"

> When funcCode is not `"1"`, no further processing occurs. The method returns void and control passes back to the caller (`execute()`).

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svcKeiNo` | Field | Service contract number — unique identifier for the customer's service contract line |
| `svcKeiUcwkNo` | Field | Service detail work number — internal tracking ID for service contract line item work orders |
| `kktkSvcKeiNo` | Field | K-KTokyo service contract number — service contract number assigned by K-KTokyo (reseller/partner) |
| `kk0081GeneAddDtm` | Field | Service creation date-time — timestamp when the service contract was originally created (K-Opticom database table key) |
| `kk0161GeneAddDtm` | Field | Service detail work date-time — timestamp for the service detail work creation record |
| `kk0341RsvGeneAddDtm` | Field | K-KTokyo reservation registration date-time — timestamp for the K-KTokyo reservation data creation |
| `taknKikiMdCd` | Field | Equipment provider model code — identifies the model of network equipment (router) provided to the customer |
| `kikiSeizoNo` | Field | Equipment serial number — unique serial number of the physical network device |
| `sameTrnNo` | Field | Same processing number — transaction correlation ID used to link all steps of the multi-step router ID change workflow |
| `odrHakkoJokenNo` | Field | Order issuance condition number — unique ID for the registered order issuance condition |
| ODR_NAIYO_CD | Field | Order content code — classifies the type of order (163 = Router Connection Info Change) |
| ORDER_SBT_CD | Field | Order sub-type code — identifies the order category (`"1"` = Network / ネット) |
| SVC_ORDER_CD | Field | Service order code — identifies the type of service order (`"0A"` = Router Information / ルーター向け情報) |
| YOKYU_SBT_CD | Field | Request sub-type code — identifies the type of service request (`"04"` = Change / 変更) |
| ODR_HAKKO_JOKEN_CD | Field | Order issuance criteria code — specifies how/when the order is issued (`"01"` = Immediate Issuance / 即時発行) |
| FUNC_CODE | Field | Function code — determines the operation mode (`"1"` = Check & Update, `"2"` = Check Only, `"3"` = Other) |
| NINSHO ID | Business term | Approval ID (承認ID) — router authentication/approval identifier in the K-Opticom system |
| CC | Technical | Common Component — a shared business logic component extending AbstractCommonComponent |
| CBS | Technical | Common Business Service — backend service component that handles data operations |
| SC | Technical | Service Component — the service layer invoked via the invoker pattern |
| CAANMsg | Technical | Fujurity message container — standard messaging object used to carry request/response data between layers |
| FTTH | Business term | Fiber To The Home — K-Opticom's fiber-optic broadband internet service |
| K-Opticom | Business term | Japanese telecommunications provider; this system manages their customer service contract management |
| K-KTokyo | Business term | K-Kokusai Communication (K-KTokyo) — a reseller/partner whose services are integrated into the K-Opticom system |
| チェック＆更新 | Japanese | Check & Update — operation mode that validates data and performs actual updates |
| チェックのみ | Japanese | Check only — operation mode that validates data without making changes |
| 同一処理番号採番 | Japanese | Same processing number allocation/search — retrieves the transaction correlation ID |
| オーダー発行条件登録 | Japanese | Order issuance condition registration — registers the conditions under which an order will be generated |
| オーダー情報作成ワーク登録 | Japanese | Order information creation work registration — creates a work record for the order information processing |
| ルーター認証ID変更 | Japanese | Router authentication ID change — the business process this class implements |
| コース変更予約取消 | Japanese | Course change reservation cancellation — the broader business context this method operates within |