Method and device for self-service handling of China Railway Silver Card cancellation based on multi-system cooperation

CN122989109APending Publication Date: 2026-10-27CHINA ACADEMY OF RAILWAY SCI CORP LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611061640.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-16
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

面对跨越多个时间区间的海量扣费记录,直接相加方式难以建立时间跨度与扣费数值之间的连续映射关系,容易在时间区间边界处产生核算遗漏或精度衰减,造成最终退款金额的计算偏差

Benefits of technology

通过对进出站时间戳序列中位于同一交易周期的相邻时间戳进行运算,求解各个相邻进出站时间戳差值的相邻交易周期时间间隔变化量,该操作能够精准刻画进出站时间间隔在连续交易周期内的瞬时波动特征,有效识别因单边账或异常挂账引起的时间差突变,提高了退卡初审阶段对异常交易状态的识别准确率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122989109A_ABST
    Figure CN122989109A_ABST
Patent Text Reader

Abstract

The application provides a method and device for self-service handling of China Railway Silver Card refund based on multi-system cooperation, and relates to the technical field of data processing. The method comprises the following steps: comparing the accumulated total amount of annual fees to be deducted with the current available balance of the China Railway Silver Card point by point, calculating the numerical difference between the two, and generating account fund deduction difference data for indicating the final refund amount; generating a card refund clearing instruction according to the account fund deduction difference data, pushing the card refund clearing instruction to a third-party payment platform asynchronously, and generating a card refund execution receipt file containing specific refund execution state information; receiving the card refund execution receipt file, updating the card state of the China Railway Silver Card according to the specific refund execution state, and generating a card refund completion voucher file containing the final processing result and clearing details. The application improves the identification accuracy of abnormal transaction states in the card refund preliminary examination stage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a self-service method and device for refunding China Railway UnionPay cards based on multi-system collaboration. Background Technology

[0002] The China Railway UnionPay Card, railway station entrances and exits, and third-party payment platforms constitute the three core entities for the China Railway UnionPay Card refund service. The China Railway UnionPay Card generates transaction timestamp records at railway station entrances and exits; upon refund, the historical transaction status needs to be calculated and funds cleared with the third-party payment platform.

[0003] During actual operation, the following shortcomings were found: When verifying the historical transaction status of China Railway UnionPay cards, some existing technologies use fixed time intervals to perform discrete status comparisons on entry and exit records. This discrete comparison method cannot capture the instantaneous fluctuation characteristics of the difference between adjacent entry and exit timestamps within a continuous transaction cycle, resulting in a lag in the identification of abnormal transactions that cause sudden changes in time difference, such as one-sided accounts or abnormal outstanding accounts, which increases the risk of missed judgments in the initial review stage of card return.

[0004] When calculating the historical deduction amount of China Railway UnionPay cards, existing technologies mostly use the direct addition of discrete values. Faced with massive deduction records spanning multiple time intervals, the direct addition method is difficult to establish a continuous mapping relationship between the time span and the deduction value. It is easy to cause calculation omissions or accuracy decay at the boundaries of time intervals, resulting in the calculation deviation of the final refund amount. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to provide a self-service method and device for refunding China Railway UnionPay cards based on multi-system collaboration. It can accurately depict the instantaneous fluctuation characteristics of the time interval between entering and leaving the station within a continuous transaction cycle, effectively identify sudden changes in time difference caused by unilateral accounts or abnormal outstanding accounts, and improve the accuracy of identifying abnormal transaction status in the initial review stage of card refund.

[0006] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows: Firstly, a self-service method for refunding China Railway UnionPay cards based on multi-system collaboration, the method comprising: Step 1: Obtain the historical transaction record set of China Railway UnionPay Card, extract the entry and exit timestamps from each transaction, and generate the original timestamp; Step 2: Arrange the data in chronological order to generate an entry and exit timestamp sequence containing entry and exit time information for each station; Step 3: Perform calculations on adjacent timestamps in the same transaction period in the entry and exit timestamp sequence to solve the change in the time interval between adjacent transaction periods of each adjacent entry and exit timestamp difference, and generate a set of transaction time sequence changes containing information on the change in the time interval between adjacent transaction periods of each transaction node. Step 4: Perform cumulative calculation on the deduction records in the normal time interval of the transaction time sequence change set, and accumulate the deduction values ​​in each time interval segment by segment to generate the total amount of cumulative annual fees to be deducted, which reflects the historical deduction accumulation status. Step 5: Compare the total accumulated annual fee deduction with the current available balance of the China Railway Yintong Card account point by point, calculate the difference between the two values, and generate account fund deduction difference data to indicate the final refund amount; Step 6: Generate a refund settlement instruction based on the account fund deduction difference data, and asynchronously push the refund settlement instruction to the third-party payment platform to generate a refund execution receipt file containing specific refund execution status information; Step 7: Receive the card refund execution receipt file, update the card status of the China Railway Yintong Card according to the specific refund execution status, and generate a card refund completion certificate file containing the final processing result and settlement details.

[0007] Secondly, the self-service card refund device for China Railway UnionPay Card based on multi-system collaboration includes: The acquisition module is used to acquire the historical transaction record set of China Railway Yintong Card, extract the entry and exit timestamps of each transaction, generate the original timestamps, and arrange them in chronological order to generate an entry and exit timestamp sequence containing the entry and exit time node information of each station. The solution module is used to perform calculations on adjacent timestamps in the same transaction period in the entry and exit timestamp sequence, solve for the change in the time interval between adjacent transaction periods of each adjacent entry and exit timestamp difference, and generate a set of transaction time series change quantities containing information on the change in the time interval between adjacent transaction periods of each transaction node. The accumulation module is used to perform accumulation calculations on the deduction records in the normal time interval of the transaction time sequence change set, accumulate the deduction values ​​in each time interval segment by segment, and generate the total amount of cumulative annual fees to be deducted that reflects the historical deduction accumulation status. The calculation module is used to compare the total amount of accumulated annual fees to be deducted with the current available balance of the China Railway Yintong Card account point by point, calculate the difference between the two values, and generate account fund deduction difference data to indicate the final refund amount. The push module is used to generate a card refund settlement instruction based on the account fund deduction difference data, asynchronously push the card refund settlement instruction to the third-party payment platform, generate a card refund execution receipt file containing specific refund execution status information; receive the card refund execution receipt file, update the card status of the China Railway Yintong Card according to the specific refund execution status, and generate a card refund completion certificate file containing the final processing result and settlement details.

[0008] The above-described solution of the present invention has at least the following beneficial effects: By performing calculations on adjacent timestamps within the same transaction cycle in the entry and exit timestamp sequence, the change in the time interval between adjacent transaction cycles of the difference between each adjacent entry and exit timestamp can be solved. This operation can accurately characterize the instantaneous fluctuation characteristics of the entry and exit time interval within a continuous transaction cycle, effectively identify sudden changes in time difference caused by unilateral accounts or abnormal outstanding accounts, and improve the accuracy of identifying abnormal transaction status in the initial review stage of card refund.

[0009] The system performs cumulative calculations on deduction records within the normal time interval, accumulating the deduction values ​​in each time interval segment by segment. This operation establishes a continuous mapping relationship between the time span and the deduction value, enabling high-precision accumulation of deduction records spanning multiple time intervals. This avoids calculation omissions at interval boundaries and ensures the accuracy of the final refund amount calculation.

[0010] By generating a card refund settlement instruction and asynchronously pushing it to a third-party payment platform, and updating the card status in conjunction with the received card refund execution receipt file, this operation achieves asynchronous decoupling of the card refund settlement process and cross-system status synchronization, improving the efficiency of card refund business processing and the security of fund transfer in a multi-system collaborative environment. Attached Figure Description

[0011] Figure 1 This is a flowchart illustrating the self-service method for refunding China Railway UnionPay Cards based on multi-system collaboration, provided by an embodiment of the present invention. Figure 2 This is a schematic diagram of a self-service card refund device for China Railway UnionPay Card based on multi-system collaboration, provided by an embodiment of the present invention; Figure 3 This is a schematic diagram of the process for generating a set of transaction time series changes that includes information on the change in time intervals between adjacent transaction cycles for each transaction node, provided by an embodiment of the present invention. Detailed Implementation

[0012] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0013] This embodiment uses the railway passenger ticketing system (hereinafter referred to as the Railway 12306 system) as the implementation platform and the self-service refund of China Railway Yintong Card as the specific implementation scenario. China Railway Yintong Card is a real-name prepaid card jointly issued by China Railway Corporation and UnionPay. Cardholders can use the card at entrance and exit gates of railway passenger stations nationwide. The system automatically records the timestamp information of each entry and exit and automatically deducts the corresponding fare based on the travel distance. The refund service of China Railway Yintong Card involves three core entities: the China Railway Yintong Card (including user real-name information, account balance, annual fee status, card status, etc. stored in the card), railway entrance and exit stations (entry and exit gates of railway passenger stations nationwide, where cardholders generate transaction records with entry or exit timestamps when swiping the card), and a third-party payment platform (used to perform the refund settlement operation for the remaining balance after card refund, transferring the refund amount to the user's designated receiving account).

[0014] In this embodiment, the backend of the 12306 railway system is deployed on a distributed service cluster uniformly managed by the railway information center. This service cluster achieves real-time data interaction with the China Railway UnionPay Card core system, the railway entry and exit abnormal transaction system, the UnionPay data system, and third-party payment platforms through the railway unified distributed service bus. The railway unified distributed service bus adopts a publish-subscribe messaging model, with each business system acting as a message producer or consumer and accessing the service bus to achieve cross-system data flow and instruction synchronization through standardized interface protocols.

[0015] This example uses a user holding a China Railway Yintong Card as the subject of description. This user's China Railway Yintong Card has been activated and used normally for a full year, generating historical travel records spanning multiple transaction periods, involving six stations: A South Station, B Station, C South Station, D Station, E East Station, and F North Station. During this travel history, there were instances of mismatched entry and exit records (i.e., an entry record existed but no corresponding exit record was found, or an exit record existed but no corresponding entry record was found). Such mismatched records are collectively referred to as one-sided accounts in railway operations. Simultaneously, the user's card has not yet paid its annual fee for the current year, and there is still a certain balance in the account. The user initiated a card cancellation application through the China Railway 12306 client, requesting the cancellation of the card and the refund of the account balance to their linked bank account.

[0016] like Figure 1As shown, in step 1, obtain the historical transaction record set of the China Railway UnionPay Card, extract the entry and exit timestamps from each transaction, and generate the original timestamps: When a user logs into the China Railway 12306 client, enters the China Railway UnionPay Card section, and selects the card refund application function, the card refund service (hereinafter referred to as the refund service) in the backend of the China Railway 12306 system is triggered and started. The refund service sends a data query request to the China Railway UnionPay Card core system through the railway unified distributed service bus. This data query request carries the user's railway-exclusive user identifier (hereinafter referred to as UID). This UID is a unique identifier uniformly assigned by the railway's internal user center after the user completes real-name authentication in the China Railway 12306 system, and is used to associate all of the user's railway business data across systems.

[0017] After receiving a data query request, the China Railway Yintong Card core system retrieves the card number linked to the user based on the UID carried in the request, and then uses this card number as the primary key to query all historical transaction records of the card since its activation. Each historical transaction record contains the following fields: transaction serial number, transaction type identifier (inbound or outbound transaction), timestamp of the transaction (accurate to milliseconds), station code of the transaction, station name, transaction amount, card balance after the transaction, and transaction pairing status identifier (paired or unpaired). The China Railway Yintong Card core system arranges all the retrieved historical transaction records in chronological order of the transaction occurrence time, packages them into a historical transaction dataset, and returns it to the card return service through the railway unified distributed service bus.

[0018] After receiving the historical transaction dataset, the card refund service extracts the timestamp field of each transaction record, along with the transaction type identifier field. Based on the transaction type identifier, the service labels the extracted timestamps as either inbound or outbound timestamps: timestamps indicating inbound transactions are labeled as inbound timestamps, and timestamps indicating outbound transactions are labeled as outbound timestamps. Each transaction's timestamp is stored in a raw timestamp record, containing three attributes: the timestamp value (Unix timestamp in milliseconds), the corresponding transaction type (inbound or outbound), and the site code where the transaction occurred. The service then aggregates all extracted raw timestamp records to generate a raw timestamp database (i.e., the unsorted and unorganized raw collection of historical transaction timestamps).

[0019] Taking the specific scenario of this embodiment as an example, some records in the user's historical transaction dataset are as follows: The first record is an inbound transaction that occurred at Station A South on March 15, 2025 at 08:15:32.456, with an inbound timestamp of 1742021732456, a transaction type of inbound transaction, and a station code of BJP; the second record is an outbound transaction that occurred at Station B on March 15, 2025 at 10:47:18.102, with an outbound timestamp of 1742030838102, a transaction type of outbound transaction, and a station code of SHH; the third record is an inbound transaction that occurred at Station C South on March 22, 2025 at 14:30:05.789, but no corresponding outbound transaction record was found in the historical transaction dataset for this inbound transaction (i.e., an unmatched inbound record in the one-sided ledger). The card refund service extracts the timestamps of these records one by one and labels the transaction type to obtain the original timestamps containing all historical transaction time node information.

[0020] Step 2: Arrange the timestamps in chronological order to generate a sequence of entry and exit timestamps containing entry and exit time information for each station, including: After obtaining the original timestamps, the card refund service sorts all the original timestamp records in ascending order of their timestamp values. The specific sorting process is as follows: the card refund service iterates through all the original timestamp records, reads the Unix millisecond value of the timestamp in each record, and uses this value as the sorting comparison key. After sorting, the card refund service obtains a list of timestamp records arranged from earliest to latest transaction time. The first record in this list corresponds to the earliest transaction time, and the last record corresponds to the latest transaction time.

[0021] After sorting the records chronologically, the card refund service serializes and stores the sorted timestamp record list according to the original record format, retaining three attributes for each record (timestamp value, transaction type, and station code), and naming the serialized result an "entry / exit timestamp sequence." This entry / exit timestamp sequence fully reflects the user's China Railway UnionPay card's swipe time trajectory at all railway entry and exit stations since the card was activated. Each record corresponds to one actual entry or exit swipe operation, and the order of the records represents the actual time sequence of the user's travel journey.

[0022] Taking this embodiment as an example, the first 10 records of the sorted entry and exit timestamp sequence are as follows: (1) January 5, 2025, 07:20:15.321, entered the station, A South Station; (2) January 5, 2025, 09:05:42.678, exit station, G station; (3) January 12, 2025, 16:30:08.901, entered the station, Bilibili; (4) January 12, 2025, 18:55:33.210, exit the station, H East Station; (5) February 8, 2025, 06:45:22.567, entered the station, C South Station; (6) February 8, 2025, 09:30:18.890, exit the station, K North Station; (7) March 1, 2025, 13:10:05.432, entered the station, station D; (8) March 1, 2025, 15:25:40.123, exit the station, L South Station; (9) March 15, 2025, 08:15:32.456, entered the station, A South Station; (10) March 15, 2025, 10:47:18.102, exited the station, Bilibili.

[0023] The sequence of timestamps for entering and leaving the station serves as the data foundation for extracting transaction change characteristics and calculating historical deduction amounts in subsequent steps.

[0024] like Figure 3 As shown, step 3 involves calculating the change in time interval between adjacent timestamps within the same transaction period in the entry and exit timestamp sequence, generating a set of transaction time series changes, including: After obtaining the entry and exit timestamp sequence, the card return service performs a calculation of the change in the time interval between adjacent transaction periods to obtain the instantaneous change characteristics of the entry and exit time interval within each transaction period.

[0025] Step 31, adjacent timestamp pairing processing at the site level, includes: The card refund service pairs entry and exit timestamps within the same transaction cycle in the entry and exit timestamp sequence. A transaction cycle refers to the complete travel process from when a user swipes their card to enter at one station to when they swipe their card to exit at another station.

[0026] The specific pairing process is as follows: The card refund service scans sequentially from the first record in the inbound / outbound timestamp sequence. When a record of inbound transaction type is scanned, it is marked as the starting record of the current transaction period. The scan continues, and when a record of outbound transaction type is scanned immediately after it, and there are no other inbound records between the outbound record and the aforementioned inbound record, the outbound record is marked as the ending record of the current transaction period. During pairing, the outbound record with the closest time difference to the inbound timestamp to the historical average travel time between the stations is selected first. If no historical data is available for reference, the outbound record with the smallest time difference is selected. The card refund service combines the marked starting record (inbound timestamp) and ending record (outbound timestamp) into an adjacent timestamp pair and assigns a unique transaction period number to the adjacent timestamp pair.

[0027] For unpaired records in the entry and exit timestamp sequences (e.g., only an entry timestamp without a corresponding exit timestamp, or only an exit timestamp without a corresponding entry timestamp), the card refund service marks these unpaired records as one-sided records. These are not included in the scope of adjacent timestamp pairs but are stored separately in a one-sided record set for subsequent anomaly detection steps. After pairing, the card refund service obtains several sets of adjacent timestamp pairs containing both entry and exit timestamps. Each of these pairs contains two attributes: an entry timestamp (containing the station code and timestamp value for the entry operation) and an exit timestamp (containing the station code and timestamp value for the exit operation). The card refund service then aggregates all successfully paired adjacent timestamp pairs to obtain a set of adjacent timestamp pairs containing entry and exit time node information for each station.

[0028] Taking this embodiment as an example, after pairing, a total of 42 adjacent timestamp pairs are generated, covering 42 complete ride trips since the user activated the card.

[0029] For example, the 9th adjacent timestamp pair is: Entry timestamp = 1742021732456 (March 15, 2025, 08:15:32.456, South Station A); Departure timestamp = 1742030838102 (March 15, 2025, 10:47:18.102, Bilibili). Meanwhile, the card refund service identified two unmatched entry records: one at C South Station on March 22, 2025, at 14:30:05.789, and the other at F North Station on April 10, 2025, at 17:20:33.456, also an unmatched exit record.

[0030] Step 32, solving for the change in the time interval between adjacent transaction periods for each adjacent timestamp pair, including: The card refund service performs a calculation on the change in time interval between adjacent transaction periods for each adjacent timestamp pair in the set of adjacent timestamp pairs, in order to obtain the instantaneous change in the time interval between entry and exit within the transaction period.

[0031] Step 321, extract the target timestamp pair: The card refund service retrieves one adjacent timestamp pair from the set of adjacent timestamp pairs in ascending order of transaction period number as the current processing object. For the currently retrieved adjacent timestamp pair, the card refund service extracts the entry and exit timestamps within the same transaction period, and uses these two timestamps as the target timestamp pair for the current transaction period. In the target timestamp pair, the entry timestamp represents the moment the user swipes their card to enter the paid area at the departure station within the transaction period, and the exit timestamp represents the moment the user swipes their card to leave the paid area at the arrival station within the transaction period. The time span between these two moments is the actual travel time of the trip.

[0032] Taking the 9th transaction cycle in this embodiment as an example, the target timestamp pair extracted by the card refund service is: The entry timestamp Tin9 = 1742021732456 (March 15, 2025, 08:15:32.456); The exit timestamp Tout9 = 1742030838102 (March 15, 2025, 10:47:18.102).

[0033] Step 322, calculate the time interval between adjacent entry and exit points, including: The card return service performs a difference calculation on the departure timestamp and arrival timestamp values ​​in the target timestamp pair. Specifically, the card return service takes the departure time corresponding to the departure timestamp (i.e., the precise time when the card was swiped at the departure point) and the arrival time corresponding to the arrival timestamp (i.e., the precise time when the card was swiped at the arrival point), and calculates the time difference between the two times.

[0034] The time difference is calculated as follows: subtract the Unix millisecond value of the entry timestamp from the exit timestamp's Unix millisecond value. The resulting difference is the time interval between adjacent entry and exit timestamps. This value is in milliseconds and represents the total time elapsed for the user from swiping their card at the entry station to swiping their card at the exit station within this transaction cycle.

[0035] The card refund service performs the above difference calculation on each adjacent timestamp pair in the set of adjacent timestamp pairs to obtain the adjacent entry and exit time interval values ​​corresponding to each transaction cycle. These time interval values ​​collectively reflect the distribution of the user's actual travel time in different trips.

[0036] Taking this embodiment as an example, the adjacent entry and exit time interval value △t9 of the 9th transaction cycle is 1742030838102-1742021732456=9105646 milliseconds, which is about 2 hours, 31 minutes and 45.646 seconds. This value corresponds to the actual travel time from South Station A to Station B.

[0037] The value of the adjacent entry and exit time interval Δt in the 10th trading cycle 10 =1742118030234-1742094021789=24008445 milliseconds, or about 6 hours, 40 minutes and 8.445 seconds. This value corresponds to a relatively long cross-regional travel.

[0038] The value of the adjacent entry and exit time interval Δt in the 11th trading cycle 11 =1742185634012-1742172033876=13600136 milliseconds, or approximately 3 hours, 46 minutes, and 40.136 seconds.

[0039] The card refund service aggregates the adjacent entry and exit time intervals of all 42 transaction cycles into a time interval sequence, denoted as sequence △T={△t1,△t2,...,△t 42}

[0040] Step 323, calculate the change in the time difference between adjacent trading periods, including: The card refund service uses the time interval values ​​of all transaction cycles obtained in step 322 as a basis to calculate the change in time difference between adjacent transaction cycles within a continuous transaction cycle. The purpose of this operation is to quantify the steepness of the change in entry and exit time intervals between adjacent transaction cycles, thereby capturing the characteristics of abrupt changes in travel time caused by abnormal transactions such as one-sided billing or abnormal outstanding billing.

[0041] Step 3231, constructing discrete change mapping relationships and performing discretization processing, including: The card return service is based on the adjacent entry and exit time interval value △t obtained in step 322. k (where k is the trading cycle number, k = 1, 2, ..., 42), calculate the change in time interval between each trading cycle and the previous trading cycle.

[0042] Specifically, for the k-th transaction period (k≥2), the card refund service will set the time interval value Δt of the current transaction period. k Subtract the time interval value △t from the previous trading period k-1 The change in time interval D(k) between two adjacent transaction periods is obtained. For the first transaction period (k=1), since there is no previous transaction period for comparison, the card refund service sets its time interval change to a null value.

[0043] The card refund service uses the natural sequence number of the transaction period as the independent reference time span, defining the reference time span as a discretized sequence of numbers {1, 2, 3, ..., 42}, where each number corresponds to an independent transaction period. The service associates the time interval change D(k) of each transaction period with its position k in the sequence number, constructing a discrete change mapping relationship that reflects how the time interval change varies with the transaction period number. This discrete change mapping relationship constitutes a discrete mapping structure with the transaction period number as the discrete independent node and the time interval change as the corresponding value. Using this discrete mapping structure, the card refund service transforms the originally continuous time-distributed travel events into a discrete node sequence that is easier to analyze for change characteristics through the discretization of transaction periods.

[0044] Discrete change mapping relationship formula: D(k)=△t k -△t k−1 Where k = 2, 3, ..., K; Where D(k) represents the change in the time interval between adjacent entry and exit points in the k-th trading period relative to the (k-1)-th trading period, in milliseconds. A positive D(k) indicates an increase in travel time in the current trading period compared to the previous trading period; a negative D(k) indicates a decrease. The absolute value of this change reflects the magnitude of the change in travel time between two adjacent trading periods; Δt k Δt represents the time interval between adjacent inbound and outbound transactions corresponding to the k-th transaction period. It is obtained by subtracting the inbound timestamp from the outbound timestamp of that transaction period, and the unit is milliseconds. k−1 The value represents the time interval between adjacent entry and exit points corresponding to the (k-1)th transaction period, obtained by subtracting the entry timestamp from the exit timestamp of the previous transaction period, in milliseconds; k represents the natural sequence number of the transaction period in all historical transaction periods, k = 2, 3, ..., K, dimensionless. k starts from 2 because when k = 1, there is no previous transaction period (k-1 = 0), so the change cannot be calculated; K represents the total number of valid transaction periods with completed entry and exit pairings in all historical transaction periods of this China Railway UnionPay card, dimensionless. The value of K is equal to the number of adjacent timestamp pairs contained in the adjacent timestamp pair set generated in step 31, in this embodiment K = 42.

[0045] Taking a portion of the continuous trading cycle in this embodiment as an example: The calculation for the card refund service yields D(10)=△t 10-Δt9 = 24008445 - 9105646 = 14902799 milliseconds, which means that from the 9th short trip to the 10th long trip, the time interval between adjacent arrivals and departures increased sharply by about 14.9 million milliseconds; D(11)=△t 11 -△t 10 =13600136-24008445=-10408309 milliseconds, indicating that from the 10th long-distance trip to the 11th medium-distance trip, the time interval between adjacent arrivals and departures decreased sharply by approximately 10.41 million milliseconds. The positive and negative directions and absolute values ​​of each change reflect the direction and magnitude of the user's travel pattern changes across different transaction cycles.

[0046] Step 3232, extract the independent variable benchmark node to locate the current trading period, including: For each transaction period whose change in the time interval between adjacent transaction periods needs to be determined, the card refund service needs to determine the position of that transaction period in the discrete mapping structure. The card refund service extracts the transaction period number (i.e., the reference time span) corresponding to the current transaction period as the independent variable node, and uses the position of this independent variable node in the discrete mapping structure as the independent variable reference node. The role of this independent variable reference node is to locate the starting position and contextual relationship of the current transaction period in the time reference sequence composed of all transaction periods.

[0047] Taking the 10th transaction cycle (k=10) currently being processed in this embodiment as an example, the independent variable reference node extracted by the card refund service is index 10. The position of this node in the discrete mapping structure determines that the card refund service will obtain the time interval values ​​corresponding to index 9 (the previous transaction cycle) and index 10 (the current transaction cycle) in the discrete mapping structure with index 10 as the center, so as to support the solution of the change in time interval of subsequent adjacent transaction cycles.

[0048] Step 3233, extract the baseline node of the dependent variable, including: The card refund service, based on a defined independent variable reference node (i.e., the transaction cycle number), queries the value of the dependent variable node corresponding to that reference node in the constructed discrete mapping structure. This dependent variable node value represents the fluctuation of the entry / exit time interval within the current transaction cycle, which is numerically equal to the adjacent entry / exit time interval value Δt calculated in step 322. k The card refund service uses this dependent variable node as the baseline node for calculating the change in time interval between subsequent adjacent transaction periods.

[0049] At the same time, the card refund service also extracts the value Δt of the dependent variable node corresponding to the previous adjacent node of the independent variable benchmark node (i.e., transaction cycle number k-1). k-1 The values ​​of these two dependent variable nodes (Δt)k-1 and △t k These describe the travel time in the previous and current trading periods, respectively, and the difference between the two is the time interval change that needs to be quantified.

[0050] Taking the 10th transaction cycle in this embodiment as an example, the dependent variable benchmark node extracted by the card refund service is Δt. 10 =24008445 milliseconds, the dependent variable value of the previous adjacent node is Δt9 = 9105646 milliseconds.

[0051] Step 3234, calculate the time difference between the current trading period and the change in the time interval between adjacent trading periods, including: The card refund service uses the independent variable reference node (transaction cycle number k) determined in step 3232 and the dependent variable reference node Δt extracted in step 3233. k The dependent variable value Δt of the node and its preceding neighbor. k-1 Based on this, the change in time interval corresponding to the current trading cycle is directly read from the discrete change mapping relationship D(k) constructed in step 3231. Since the increment of the independent variable (i.e., the difference between the serial numbers of adjacent trading cycles k - (k - 1)) is always 1, this change in time interval is numerically equivalent to the time difference between the current trading cycle and the change in time interval between adjacent trading cycles. v k =D(k)=△t k -△t k-1 Where k = 2, 3, ..., K; Among them, v k The time difference value for the k-th trading period represents the change in the time interval between adjacent trading periods, taken from the discrete change mapping relationship D(k) constructed in step 3231, with units of milliseconds per trading period; Δt k and △t k-1 The meaning is the same as in step 3231.

[0052] The change in the time interval between adjacent trading periods reflects the instantaneous magnitude and direction of change in travel time between two adjacent trading weeks: v k A positive value indicates that the travel time in the current trading period has increased compared to the previous trading period; v k A negative value indicates a decrease; v k The larger the absolute value, the more drastic the change in travel time.

[0053] Taking this embodiment as an example: the time difference of the 10th trading period and the change in the time interval between adjacent trading periods, v. 10=D(10) = 14902799 (milliseconds / transaction cycle), a positive value with a very large absolute value, indicating that the travel time increased significantly from the 9th to the 10th transaction cycle. In the railway travel scenario, this usually means that the user has switched from short-distance commuting to long-distance cross-regional travel; the time difference in the 11th transaction cycle is the change in the time interval between adjacent transaction cycles, v. 11 =D(11) = -10408309 (milliseconds / trading cycle), which is negative and has a very large absolute value, indicating that the travel time was drastically shortened from the 10th to the 11th trading cycle.

[0054] The card refund service performs the aforementioned operation of reading the change in time interval between adjacent transaction periods for all transaction cycles (from k=2 to k=42). It sequentially retrieves the change corresponding to each transaction cycle from D(k) as the value of the change in time interval between adjacent transaction periods for each cycle, resulting in 41 values. For each value, the card refund service associates it with the corresponding transaction cycle number, forming a node representing the change in time interval between adjacent transaction periods. Each node contains two information dimensions: a time node identifier (i.e., the transaction cycle number k) and the corresponding value v representing the change in time interval between adjacent transaction periods. k .

[0055] Step 33, extract the time identifier of the node representing the change in time interval between adjacent transaction cycles, including: The card refund service extracts the corresponding time node identifier (i.e., transaction cycle number) from each generated node representing the change in time interval between adjacent transaction cycles. The service then recombines the extracted time node identifier and the corresponding value representing the change in time interval between adjacent transaction cycles into a new data structure. In this structure, the time node identifier locates the occurrence time of the change in time interval between adjacent transaction cycles within the time sequence of all transaction cycles, while the value represents the degree of drastic change in the entry / exit time interval at that time position. Finally, the service aggregates all nodes representing the change in time interval between adjacent transaction cycles marked with time identifiers, resulting in a set of nodes representing the change in time interval between adjacent transaction cycles that includes the time identifier.

[0056] Step 34: Arrange the data point by point to generate a set of transaction time series changes, including: The card refund service will sort all nodes in the set of nodes containing time-identified changes in the time interval between adjacent transaction periods, according to the chronological order of the transaction periods (i.e., in ascending order of transaction period numbers). After sorting, the card refund service will encapsulate the sorted result into an ordered set and assign a name to this set: the Transaction Time-Sequence Change Set.

[0057] Each element in this set of transaction time-series changes corresponds to a transaction cycle (from the second to the last transaction cycle), and the order of the elements strictly follows the chronological order of the user's actual travel itinerary. This set fully records the instantaneous changes in the time intervals between entry and exit points for users throughout all consecutive transaction cycles: for normal transaction cycles with stable travel patterns, the changes in the time intervals between adjacent transaction cycles are usually within a reasonable fluctuation range; while for abnormal transaction cycles (such as abnormally long or short travel times caused by the inability to match one-sided accounts), the changes in the time intervals between adjacent transaction cycles show significant abrupt spikes.

[0058] Taking this embodiment as an example, some typical values ​​in the transaction time series change set are: v5 = +3204567 (moderately positive value, indicating a slight increase in travel time, which is within normal fluctuations), v6 = -2876341 (moderately negative value, indicating a slight decrease in travel time, which is within normal fluctuations), and v9 = +14902799 (extremely positive value, indicating a drastic change in travel patterns, which may indicate the impact of one-sided billing). After obtaining the transaction time series change set, the card refund service can preliminarily determine which transaction periods have abnormal transaction risks based on the absolute magnitude and abrupt change pattern of the change in the time interval between adjacent transaction periods of each node in the set.

[0059] Step 4: Accumulate the deducted amounts within the normal time interval segment by segment to generate the total accumulated annual fee deductible, including: After obtaining the set of transaction time-series changes, the card refund service distinguishes the deduction records that are in the normal time interval (i.e., deduction records that do not belong to the abnormal transaction cycle) from the set, and performs a segment-by-segment cumulative calculation operation on these normal deduction records to obtain the total amount of cumulative annual fees that should be deducted, which reflects the historical deduction accumulation status.

[0060] Step 41, extract the deduction records within the normal time period, including: The card refund service determines whether each transaction cycle falls within a normal timeframe based on the generated set of transaction time-series changes. The criteria for this determination are: For each node in the set of changes in the time interval between adjacent transaction cycles in the transaction time series, the card refund service compares the absolute value of the change in the time interval between adjacent transaction cycles with a preset anomaly detection threshold.

[0061] The method for determining this anomaly detection threshold is as follows: The card refund service analyzes the absolute value distribution of the time interval changes between all adjacent transaction periods in the statistical transaction time series change set. It calculates the mean and standard deviation of these absolute values, and adds three times the standard deviation to the mean as the anomaly detection threshold. If the absolute value of the time interval change between adjacent transaction periods exceeds this threshold, the card refund service determines the corresponding transaction period as an abnormal transaction period (potentially indicating one-sided billing or abnormal outstanding billing), and the deduction records within this period are marked as abnormal deduction records and excluded from subsequent normal accounting. If the absolute value of the time interval change between adjacent transaction periods does not exceed the threshold, the card refund service determines the corresponding transaction period as a normal transaction period, and the deduction records within this period are marked as normal deduction records.

[0062] The card refund service retrieves the deduction amount for each transaction cycle from the historical transaction dataset returned by the China Railway UnionPay Card core system. For each cycle determined to be a normal transaction cycle, the refund service extracts the corresponding deduction amount and associates and stores this amount with the transaction cycle number, start and end time information, travel interval information, and the change in time interval between adjacent transaction cycles. The refund service then aggregates the deduction records corresponding to all normal transaction cycles to obtain a set of deduction records for normal time intervals.

[0063] Taking this embodiment as an example, in all 42 transaction cycles, the card refund service determines the 9th transaction cycle (change in time interval between adjacent transaction cycles v9 = 14902799) and the 10th transaction cycle (change in time interval between adjacent transaction cycles v9 = 14902799). 10 =-10408309) is an abnormal transaction period (because the absolute value of the change in the time interval between these two adjacent transaction periods significantly exceeds the anomaly judgment threshold), and its corresponding deduction record is marked as an abnormal deduction record. The absolute value of the change in the time interval between adjacent transaction periods for the remaining 40 transaction periods is within the normal fluctuation range, and their corresponding deduction records are included in the normal time interval deduction record set. Examples of deduction amounts for each normal transaction period are as follows: Transaction period 1 deduction: 54.50 yuan; Transaction period 2 deduction: 73.00 yuan; Transaction period 3 deduction: 48.50 yuan; Transaction period 4 deduction: 62.00 yuan; ...; Transaction period 42 deduction: 56.50 yuan.

[0064] Step 42: Divide the normal time interval into multiple consecutive time sub-intervals, including: The card refund service divides the entire normal time period into multiple consecutive time sub-periods based on the time information corresponding to each deduction record in the normal time period deduction record set, according to chronological order. The division method is as follows: The card refund service obtains the annual fee billing cycle information of the China Railway Yintong Card. The annual fee of the China Railway Yintong Card is calculated from the card activation date, with each full 12 calendar months constituting an annual fee billing cycle. The card refund service uses the start and end dates of this annual fee billing cycle as boundaries to group the deduction records in the normal time period deduction record set according to their respective annual fee billing cycles: deduction records belonging to the first annual fee billing cycle are assigned to the first time sub-period, deduction records belonging to the second annual fee billing cycle are assigned to the second time sub-period, and so on.

[0065] In this embodiment, the user's China Railway UnionPay card was activated on June 10, 2023. Therefore, the annual fee billing cycle runs from June 10th of each year to June 9th of the following year. The current card cancellation application date is May 20, 2025, which falls within the second annual fee billing cycle (June 10, 2024 to June 9, 2025). The card cancellation service divides the records in the normal time interval deduction record set into two time sub-intervals according to the above division method: the first time sub-interval covers the time span from June 10, 2023 to June 9, 2024, and the deduction records in this sub-interval correspond to all travel deductions in the first annual fee billing cycle; the second time sub-interval covers the time span from June 10, 2024 to May 20, 2025 (the portion of the current annual fee billing cycle that has already occurred), and the deduction records in this sub-interval correspond to all travel deductions in the second annual fee billing cycle up to the card cancellation application date. Two time sub-intervals are arranged in chronological order of their start times to form a time sub-interval sequence.

[0066] Step 43, extract the set of deduction values ​​corresponding to each time sub-interval, including: The card refund service extracts the deduction amount values ​​corresponding to all deduction records belonging to that time sub-interval from the normal time interval deduction record set for each time sub-interval in the time sub-interval sequence. For the first time sub-interval, the card refund service extracts the deduction amount field of each deduction record and summarizes all deduction amounts into a set of deduction values ​​corresponding to that time sub-interval. For the second time sub-interval, the card refund service performs the same extraction and summarization operations. After this step, the card refund service obtains the set of deduction values ​​corresponding to each time sub-interval.

[0067] Taking this embodiment as an example, the first time sub-interval (June 10, 2023 to June 9, 2024) contains 28 normal deduction records, with the corresponding deduction value set as: {54.50, 73.00, 48.50, 62.00, 55.00, 81.50, ..., 67.50}, totaling 28 deduction amount values. The second time sub-interval (June 10, 2024 to May 20, 2025) contains 12 normal deduction records (two deduction records from abnormal transaction periods are excluded), with the corresponding deduction value set as: {58.00, 72.50, 45.00, 63.50, ..., 54.00}, totaling 12 deduction amount values.

[0068] Step 44: Accumulate the deduction values ​​segment by segment to obtain the total annual fee to be deducted, including: The card refund service uses the time span of each sub-interval in the time sub-interval sequence as the accumulation variable, and performs a segment-by-segment accumulation calculation operation on the set of deduction values ​​corresponding to each time sub-interval.

[0069] Step 441, construct the continuous-time accumulation domain, including: The card refund service expands the time span of each sub-interval in the time sub-interval sequence on a continuous time axis to construct a coherent continuous time reference domain.

[0070] Specifically, the card refund service takes the start time of the first time sub-interval and the end time of the last time sub-interval, and treats all the time between these two times as a continuous total time domain.

[0071] The card refund service divides the continuous time domain into multiple consecutive time intervals, each with its own time boundary, according to the time boundaries of the sub-intervals in the time interval sequence. Each consecutive time interval corresponds to a time sub-interval, and the intervals are seamlessly connected on the time axis. The end time of the previous interval is the start time of the next interval. The card refund service refers to the complete time domain, which is composed of multiple consecutive time intervals, as the continuous time accumulation domain.

[0072] The purpose of constructing this continuous time accumulation field is to provide a continuous time reference framework for subsequent segmented accumulation calculation operations, so that the accumulation of deduction amount can be carried out under a unified time coordinate system, avoiding calculation omissions due to gaps at the boundaries of time intervals.

[0073] Step 442, construct the discrete deduction distribution sequence, including: The card refund service maps the deduction amount data in the deduction value set corresponding to each time sub-interval to the corresponding time interval in the continuous time accumulation field according to the time sub-interval to which it belongs.

[0074] The mapping operation works as follows: For each time sub-interval, the card refund service distributes all deduction amounts from the set of deduction values ​​corresponding to that sub-interval, according to the specific time of each deduction record (i.e., the actual date of the ride transaction), into the time interval segment corresponding to that time sub-interval in the continuous time accumulation domain. After the distribution is completed, each deduction amount occupies a specific time position within that time interval segment, which is determined by the projection of the actual transaction date of that deduction record onto the time axis.

[0075] The card refund service arranges the distributed deduction amount data according to their chronological order on the timeline, resulting in a discrete deduction distribution sequence. Each element in this sequence contains two information dimensions: the time of deduction (its specific position on the timeline) and the deduction amount (the actual deduction amount for the ride transaction). This discrete deduction distribution sequence fully describes the distribution of deduction amounts over time for this user's China Railway Pass card throughout all normal transaction cycles.

[0076] Taking this embodiment as an example, the first few elements of the discrete fare deduction distribution sequence are: (July 15, 2023, 54.50 yuan), (August 2, 2023, 73.00 yuan), (September 10, 2023, 48.50 yuan), ..., each element corresponds to a real ride fare deduction event.

[0077] Step 443, calculate the local cumulative deduction value for each time interval, including: Within the continuous time accumulation domain, the card refund service performs continuous accumulation calculation on the deduction amount data in the discrete deduction distribution sequence according to time intervals to obtain the local deduction accumulation value for each time sub-interval.

[0078] Step 4431, extract the base amount to be accumulated for deductions, including: For the current time interval (e.g., the first time interval, corresponding to the first time sub-interval) in the continuous time accumulation domain, the card refund service extracts all deduction amounts belonging to this time interval from the discrete deduction distribution sequence. The card refund service arranges these deduction amounts in chronological order of their occurrence and uses the first deduction amount in that order as the base for accumulation. This base is the initial deduction amount within this time interval; subsequent accumulation calculations will use this base as a starting point to progressively incorporate the remaining deduction amounts within this interval.

[0079] Taking the first time interval in this embodiment as an example, the base amount for the card refund service to be accumulated is the amount of 54.50 yuan corresponding to the first normal deduction record in that interval.

[0080] Steps 4432 and 4433 extract the start and end points of the time, including: The card refund service retrieves the start and end times for the current time interval. The start time is the left boundary of this time interval within the continuous time accumulation field, i.e., the start date of this sub-interval (e.g., June 10, 2023, 00:00:00). The end time is the right boundary of this time interval within the continuous time accumulation field, i.e., the end date of this sub-interval (e.g., June 9, 2024, 23:59:59). The card refund service uses the start time as the time starting point and the end time as the time ending point to define the accumulation calculation range for this time interval.

[0081] Step 4434, determine the continuous accumulation time domain, including: The card refund service uses the start time as the left endpoint and the end time as the right endpoint, defining the entire time interval on the time axis between these two endpoints as the corresponding continuous cumulative time domain. This continuous cumulative time domain is a closed time interval, the length of which is equal to the time span of the sub-interval (for example, for the first time interval, the length of this continuous cumulative time domain is one year, or 365 days). Within this continuous cumulative time domain, the card refund service will perform cumulative calculations on all deduction amounts belonging to this time domain in the discrete deduction distribution sequence.

[0082] Step 4435, perform continuous accumulation operation, including: The card refund service performs a continuous accumulation operation on all deduction amounts within the discrete deduction distribution sequence belonging to that time domain, within the continuous accumulation time domain. The specific method of the accumulation operation is as follows: The card refund service uses a predetermined base for accumulating charges (i.e., the first charge amount within the given time period) as the initial accumulation value. Following the chronological order of each charge record, it sequentially adds the value of each subsequent charge to the current accumulation value to form an updated accumulation. After each charge is accumulated, the service records the accumulation result and the corresponding accumulation time (i.e., the time of the charge record plus a small offset to avoid time conflicts when multiple charges occur simultaneously). Once all charges within the consecutive accumulation time period have been included, the final accumulation value represents the total accumulated charges for that time interval after experiencing all charge events within that time period.

[0083] The accumulation operation means that each deduction for train travel within the annual billing cycle is collected and accumulated sequentially according to its occurrence time to obtain the user's total travel consumption within the annual billing cycle. Since the accumulation operation proceeds sequentially along a continuous time axis, it establishes a continuous mapping relationship between the time span and the accumulated deduction value: at any intermediate moment in the time domain, the current accumulated value is the total consumption amount up to that moment. This continuous mapping relationship effectively avoids the calculation omissions or accuracy losses that may occur at the boundaries of time intervals in traditional discrete direct addition methods.

[0084] Taking the first time interval in this embodiment as an example, the cumulative calculation process performed by the card refund service is as follows: The initial accumulated value was 54.50 yuan (first deduction). After adding the second deduction of 73.00 yuan, the accumulated value was 127.50 yuan. After adding the third deduction of 48.50 yuan, the accumulated value was 176.00 yuan. After adding the fourth deduction of 62.00 yuan, the accumulated value was 238.00 yuan, and so on. After adding all 28 deductions within this period, the final accumulated total deduction was 1723.50 yuan. This value represents the user's total accumulated travel expenses during the first annual fee billing cycle (June 10, 2023 to June 9, 2024).

[0085] Step 4436: Obtain the local cumulative deduction value for each time sub-interval, including: The card refund service uses the calculated cumulative deduction amount as the calculation result for the current time interval and assigns it a local deduction accumulation value identifier. The card refund service associates and stores this local deduction accumulation value with the start and end time information of the corresponding time interval. The card refund service sequentially performs the complete accumulation calculation operation from steps 4431 to 4435 on all time intervals in the continuous time accumulation domain (two time intervals in this embodiment) to obtain the local deduction accumulation value corresponding to each time sub-interval.

[0086] Step 444: Generate the total cumulative annual fee deductible data by overlaying the segments, including: The card refund service accumulates the partial deductions for all time sub-intervals, sequentially adding them up according to the chronological order of the time sub-intervals. Specifically, the service retrieves the partial deduction accumulation value from the first time sub-interval as the current accumulation result; then it retrieves the partial deduction accumulation value from the second time sub-interval, adds it to the current accumulation result, and updates the current accumulation result. Since there are only two time sub-intervals in this embodiment, the segmented accumulation operation ends after the accumulation of the second sub-interval is completed. The card refund service uses the final accumulation result as the total accumulated annual fee data reflecting the historical deduction accumulation status.

[0087] Taking this embodiment as an example, the cumulative partial deduction value for the first time sub-interval is 1723.50 yuan, and the cumulative partial deduction value for the second time sub-interval is 672.00 yuan. The card refund service adds the two cumulative partial values ​​together segment by segment: 1723.50 + 672.00 = 2395.50 yuan. Therefore, the total annual fee payable for this user's China Railway UnionPay card is 2395.50 yuan; this data accurately reflects the total amount of ticket fees deducted from the user for train travel during all normal transaction cycles since the card was activated.

[0088] Step 5: Compare the total accumulated annual fees due with the current available account balance point by point to generate account fund deduction difference data, including: After obtaining the total amount of annual fees due, the card refund service compares this data point by point with the current available balance of the China Railway UnionPay card account to generate account fund deduction difference data that indicates the final refund amount.

[0089] The card refund service queries the China Railway Yintong Card core system for the current account's available balance via the railway's unified distributed service bus. Upon receiving the query request, the China Railway Yintong Card core system reads the card's current account balance field (this field reflects the remaining amount after deducting all completed paired and settled travel expenses) and returns the balance data to the card refund service. In this embodiment, the user's current available account balance for the China Railway Yintong Card is 2850.00 yuan.

[0090] After obtaining the current available account balance, the card refund service performs the following comparison and calculation logic: The card refund service checks if there are any unpaid annual fees. The annual fee for the China Railway UnionPay Card is RMB 10.00 per year, automatically deducted from the account balance on each annual fee anniversary date after card activation. The card refund service checks the card's most recent annual fee deduction record and finds that the annual fee for June 10, 2024 (the start date of the second annual fee billing cycle) was not successfully deducted (possibly due to insufficient account balance or system deduction failure). Therefore, there is currently an unpaid annual fee of RMB 10.00 for this card.

[0091] The card refund service does not compare the unpaid annual fee (10.00 yuan) with the total accumulated annual fee (2395.50 yuan), as these are different types of fees: the former is a periodic fixed service fee, while the latter is a per-trip accumulated service fee. Instead, the card refund service performs the following point-by-point comparison: it compares the current available account balance (2850.00 yuan) with the total accumulated annual fee (2395.50 yuan). The comparison result shows that 2850.00 > 2395.50, meaning the current available account balance is sufficient to cover the total accumulated annual fee. The card refund service further calculates: current available account balance minus total accumulated annual fee minus unpaid annual fee = 2850.00 - 2395.50 - 10.00 = 444.50 yuan. This difference of 444.50 yuan is the actual amount that can be refunded to the user after settling all outstanding fees. The card refund service will package the difference value together with the corresponding fee details (including the total annual fee of RMB 2,395.50, the unpaid annual fee of RMB 10.00, and the current available account balance of RMB 2,850.00) to generate account fund deduction difference data.

[0092] The account's refund amount data includes the following core fields: final refund amount (444.50 yuan), total annual fee due (2395.50 yuan), unpaid annual fee (10.00 yuan), current available account balance (2850.00 yuan), and a refund settlement flag (indicating that the refund application has undergone fee calculation and can enter the settlement stage). The refund service passes this account's refund amount data to the subsequent settlement instruction generation step.

[0093] Step 6: Generate a refund settlement instruction and asynchronously push it to the third-party payment platform, generating a refund execution receipt file, including: Based on the account fund deduction difference data generated in step 5, the card refund service generates a card refund settlement instruction and pushes the instruction to the third-party payment platform through an asynchronous message queue to execute the refund operation. Finally, it receives the refund processing result and forms a card refund execution receipt file.

[0094] Step 61, extract the basic parameters for card refund settlement, including: The card refund service extracts essential parameters for the refund settlement operation from the account balance deduction data. These parameters include: user identifier (i.e., railway UID, used to uniquely identify the refunding user during cross-system settlement), China Railway UnionPay card number (used by the UnionPay data system to identify the corresponding card account), refund amount (i.e., the final refundable amount of 444.50 yuan), total accumulated annual fees (2395.50 yuan, used for reconciliation), unpaid annual fees (10.00 yuan, used to indicate that they have been deducted from the refund), and current available account balance (2850.00 yuan, used to record the card status before the refund). The card refund service then aggregates these extracted parameters to form a set of basic parameters for card refund settlement.

[0095] Step 62, encapsulate and generate a card refund and settlement instruction, including: The card refund service encapsulates the core business fields according to the settlement message format based on the basic parameters set for card refund settlement, and generates card refund settlement instructions.

[0096] Step 621, extract the core business fields to be encapsulated, including: The refund service filters out the core business fields necessary for the third-party payment platform to execute the refund operation from the basic parameter set for refund settlement. These core business fields include: User ID (UID), Bank Card Number (the receiving bank account number bound to the user in the Railway 12306 client), Refund Amount (444.50 yuan), Refund Currency Code (CNY), Refund Request Identifier (the globally unique refund request ID generated in step 3), and Settlement Timestamp (the time when the refund settlement instruction was generated). The refund service extracts the above core business fields to form the core business fields to be encapsulated.

[0097] Step 622, Match the settlement message template, including: The refund service retrieves a suitable settlement message template from its internally maintained settlement message template library, based on the target payment channel for this settlement (in this example, the refund interface of third-party payment platform A). This settlement message template is a message structure framework based on JSON data format, which predefines all field names, field data types, and nesting hierarchy relationships required for the refund request. The message structure framework reserves corresponding field mapping positions for each field (i.e., the path and key name of the field in the JSON message). By reading this message structure framework, the refund service can determine which business fields need to be filled into which positions within the message.

[0098] Step 623, fill in the settlement message data: The refund service extracts the core business fields to be encapsulated in step 621 and fills them one by one into the corresponding field mapping positions in the matching settlement message template in step 622. After filling, the refund service obtains a JSON structure containing complete refund request information. The refund service checks whether all required fields in this JSON structure have been filled and whether the data type is consistent with the template requirements. If the check passes, the JSON structure is recorded as the filled settlement message data.

[0099] Step 624, protocol format conversion, including: The card refund service performs a protocol format conversion operation on the populated settlement message data, transforming it from the internally used JSON data format to the communication protocol format required by the third-party payment platform. In this embodiment, the refund interface of the third-party payment platform A uses a RESTful API based on the HTTP / 2 protocol, with a message body content type of application / json and a request method of POST. The card refund service encapsulates the populated settlement message data into an HTTP POST request body according to this protocol specification and sets the necessary HTTP request header fields (including Content-Type, Authorization, X-Request-ID, etc.) for this request. The request message generated after the protocol format conversion is the card refund settlement instruction.

[0100] Step 63: Write the card refund settlement instruction to the asynchronous message queue, including: After generating a card refund settlement instruction, the card refund service does not directly send the instruction to the third-party payment platform. Instead, it writes the instruction to an asynchronous message queue for buffering and delivery. In this embodiment, the asynchronous message queue used is Apache RocketMQ. The card refund service calls the message sending interface of the RocketMQ producer to write the card refund settlement instruction as a message into a pre-created message queue in RocketMQ with the topic "TCardRefundClearing". After receiving the message, RocketMQ assigns a unique message identifier (MessageID) to the message and returns the message identifier to the card refund service. The card refund service associates the message identifier with this card refund settlement operation and stores it to obtain a settlement delivery record containing the message identifier. The message identifier is used to subsequently track the delivery status and processing progress of the settlement instruction.

[0101] Step 64: Asynchronously push the card refund settlement instruction to the third-party payment platform, including: The RocketMQ message queue's background consumer service continuously listens to the TCardRefundClearing topic. When a new card refund clearing instruction message enters the queue, the consumer service immediately pulls the message. The consumer service parses the card refund clearing instruction encapsulated in the message body, extracting the target URL address (i.e., the refund interface address of third-party payment platform A) and the HTTP request content. The consumer service then sends a POST request to the target URL via an HTTP client, sending the refund request data from the card refund clearing instruction to third-party payment platform A.

[0102] After receiving a refund request, third-party payment platform A executes the following processing procedure: The system verifies the legality and completeness of the request (including signature verification, request ID deduplication verification, and user identifier validity verification); it transfers the corresponding amount from the platform's reserve fund account to the user's designated bank account based on the refund amount; after the bank's core system completes the fund transfer, it returns a transaction success confirmation. Third-party payment platform A encapsulates the refund processing result into a JSON format response message and returns it to the consumer service via HTTP. This refund processing result includes the following key information: refund execution status identifier (e.g., SUCCESS indicates successful refund, FAIL indicates failed refund, PENDING indicates refund in progress), fund transfer serial number (a unique serial number assigned to this refund transaction by the bank's core system), refund amount, refund completion timestamp, and failure reason code (provided when the refund fails).

[0103] Step 65: Generate a card return execution receipt file, including: After receiving the refund processing result from third-party payment platform A, the consumer service extracts the refund execution status identifier and fund transfer serial number from the result, and also associates them with information such as the card refund request identifier (globally unique card refund request ID), the refund amount, and the refund completion timestamp. The consumer service assembles all the above information into a structured card refund execution receipt file. This card refund execution receipt file is a JSON format data file containing the following standard fields: receipt file version number, card refund request identifier, refund execution status identifier, fund transfer serial number, refund amount, refund currency, refund completion timestamp, anonymized receiving account information (only the bank name and the last four digits of the card number are retained), and settlement completion identifier. The consumer service sends this card refund execution receipt file to the card refund service through a message queue receipt topic. After receiving the receipt file, the card refund service persists it to the database.

[0104] Step 7: Receive the card refund execution receipt file and update the China Railway UnionPay Card status, generating a card refund completion certificate file, including: After receiving the refund execution receipt file pushed by the consumer service via a message queue receipt topic, the refund service reads the refund execution status identifier field from the receipt file. If the refund execution status identifier is SUCCESS (refund successful), the refund service performs the following operations: To update the card status of the China Railway Yintong Card, the card refund service sends a card status change instruction to the China Railway Yintong Card core system via the railway unified distributed service bus. This instruction carries the China Railway Yintong Card number and the target status indicator "cancelled." Upon receiving the instruction, the China Railway Yintong Card core system changes the card status field from "normal" to "cancelled," records the card's cancellation timestamp as the current system time, and records the cancellation reason as "user self-service card refund." After the card status change is completed, the China Railway Yintong Card core system returns a confirmation of successful status change to the card refund service.

[0105] A refund completion certificate file is generated. The refund service summarizes and encapsulates all processing information and the final result of this refund transaction into a single refund completion certificate file. This refund completion certificate file contains the following information: refund request identifier, user identifier, China Railway Yintong Card number (anonymized), refund application submission time, refund completion time, final refund amount (444.50 yuan), fund transfer serial number, total annual fee due (2395.50 yuan), unpaid annual fee amount (10.00 yuan), available account balance before refund (2850.00 yuan), refund execution status identifier (SUCCESS), card cancellation status (cancelled), and settlement details (listing the deduction amount and time for each transaction cycle).

[0106] The card refund service stores the refund completion certificate file in the database and simultaneously sends a refund completion notification to the user's Railway 12306 client via the railway 12306 system's message push service. The user can view a summary of the refund completion certificate file in the client, including the final refund amount, the bank account to which the refund was credited, and the refund completion time. At this point, the entire process of self-service refund for the China Railway UnionPay Card is complete.

[0107] If the refund execution status is marked as FAIL (refund failed), the card refund service reads the failure reason code from the receipt file and matches the corresponding exception handling strategy based on the failure reason code. For example, if the failure reason is incorrect account information, the card refund service pushes an account information correction prompt to the user through the Railway 12306 client, guiding the user to update the account information and automatically re-initiating the refund; if the failure reason is network timeout or temporary payment channel failure, the card refund service uses the delayed message mechanism of the RocketMQ message queue to automatically retry pushing the card refund settlement instruction after a preset delay (such as 30 seconds, 60 seconds, 120 seconds in increments). The detailed mechanism of exception handling is not within the core description scope of this embodiment and will not be elaborated further.

[0108] like Figure 2 As shown, this embodiment also provides a self-service system for refunding China Railway Yintong Cards based on multi-system collaboration. This system is deployed on the backend distributed service cluster of the Railway 12306 system and is used to implement the self-service refund method for China Railway Yintong Cards described in the above embodiments. The system includes the following functional units: The timestamp acquisition unit is used to obtain the historical transaction record set of China Railway Yintong Card, extract the entry and exit timestamps from each transaction, generate the original timestamps, and arrange them in chronological order to generate an entry and exit timestamp sequence containing the entry and exit time node information of each station. This timestamp acquisition unit is connected to the China Railway Yintong Card core system through the railway unified distributed service bus, sending data query requests to the China Railway Yintong Card core system and receiving the returned historical transaction dataset.

[0109] An adjacent transaction cycle time interval change calculation unit, connected to the output of the timestamp acquisition unit, receives the entry and exit timestamp sequence, performs an adjacent transaction cycle time interval change calculation operation on adjacent timestamps within the same transaction cycle in the sequence, calculates the adjacent transaction cycle time interval change of the difference between each adjacent entry and exit timestamp, and generates a transaction time series change set containing information on the adjacent transaction cycle time interval change of each transaction node. This adjacent transaction cycle time interval change calculation unit internally includes: a timestamp pairing subunit, used to perform site-level pairing processing on the entry and exit timestamp sequences to obtain a set of adjacent timestamp pairs; a change calculation subunit, used to calculate the adjacent entry and exit time interval values ​​for each adjacent timestamp pair and calculate the adjacent transaction cycle time interval change of the time difference; and a set generation subunit, used to arrange the adjacent transaction cycle time interval change nodes point by point according to the chronological order of the transaction cycles to generate a transaction time series change set.

[0110] The fee accumulation calculation unit, connected to the output of the adjacent transaction cycle time interval change calculation unit, receives the transaction time series change set, performs segmented accumulation calculation on the fee records in the set that are within the normal time interval, accumulates the fee values ​​in each time interval segment by segment, and generates the total cumulative annual fee data reflecting the historical fee accumulation status. This fee accumulation calculation unit includes: a record filtering subunit, used to distinguish fee records in the normal time interval from the transaction time series change set; an interval division subunit, used to divide the normal time interval into multiple consecutive time sub-intervals and extract the corresponding fee value set for each sub-interval; and a segmented accumulation subunit, used to perform continuous accumulation of the fee values ​​in each time sub-interval within a continuous time reference domain to generate the total cumulative annual fee data.

[0111] The funds comparison unit, connected to the fee deduction accumulation calculation unit and the China Railway Yintong Card core system, is used to receive the total amount of accumulated annual fees to be deducted and the current available balance of the China Railway Yintong Card account, compare the two point by point and calculate the numerical difference, and generate account funds deduction difference data to indicate the final refund amount.

[0112] The clearing instruction generation and push unit, connected to the output of the funds comparison unit, receives the account funds deduction difference data, generates a card refund clearing instruction based on this data, writes the card refund clearing instruction to an asynchronous message queue and pushes it asynchronously to the third-party payment platform through the message queue, receives the refund processing result returned by the third-party payment platform, and generates a card refund execution receipt file containing specific refund execution status information. This clearing instruction generation and push unit achieves asynchronous communication with the refund interface of the third-party payment platform through a RocketMQ message queue.

[0113] The receipt processing and status update unit is connected to the output end of the clearing instruction generation and push unit and the core system of China Railway Yintong Card. It is used to receive the card refund execution receipt file, update the card status of China Railway Yintong Card according to the refund execution status in the receipt file, and generate a card refund completion certificate file containing the final processing result and clearing details.

[0114] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A self-service method for refunding China Railway UnionPay cards based on multi-system collaboration, characterized in that: The method includes: Obtain the historical transaction records of China Railway UnionPay Card, extract the entry and exit timestamps from each transaction, and generate the original timestamps. Arrange them in chronological order to generate a sequence of entry and exit timestamps containing entry and exit time information for each station; The adjacent timestamps in the same transaction period in the entry and exit timestamp sequence are calculated to solve the change in the time interval between adjacent transaction periods of the difference between each adjacent entry and exit timestamp, and a set of transaction time sequence changes is generated. The deduction records in the normal time interval of the transaction time sequence change set are accumulated, and the deduction values ​​in each time interval are accumulated segment by segment to generate the total amount of cumulative annual fees that should be deducted, which reflects the historical deduction accumulation status. The total accumulated annual fee deductible is compared point by point with the current available balance of the China Railway Yintong Card account, and the difference between the two is calculated to generate account fund deduction difference data to indicate the final refund amount. Based on the account funds deduction difference data, a refund settlement instruction is generated, and the refund settlement instruction is asynchronously pushed to a third-party payment platform to generate a refund execution receipt file containing specific refund execution status information; Receive the card refund execution receipt file, update the card status of the China Railway Yintong Card according to the specific refund execution status, and generate a card refund completion certificate file containing the final processing result and settlement details.

2. The self-service method for refunding China Railway UnionPay cards based on multi-system collaboration as described in claim 1, characterized in that, The system performs calculations on adjacent timestamps within the same transaction period in the inbound and outbound timestamp sequence to calculate the change in the time interval between adjacent transaction periods for each adjacent inbound and outbound timestamp difference, generating a set of transaction time series changes, including: Based on the entry and exit timestamp sequence, the entry timestamps and exit timestamps in the same transaction period are paired at the station level to obtain a set of adjacent timestamp pairs containing entry and exit time node information for each station. For each adjacent timestamp pair in the set of adjacent timestamp pairs, the difference between the outbound timestamp and the inbound timestamp is calculated to obtain the change value of the adjacent transaction cycle time interval for each transaction node. Based on the change value of the time interval between adjacent trading cycles corresponding to each trading node, extract the time node identifier corresponding to each change value of the time interval between adjacent trading cycles to obtain a set of nodes containing the time identifier of the change value of the time interval between adjacent trading cycles. Based on the set of nodes containing time identifiers of changes in the time interval between adjacent transaction periods, these nodes are arranged point by point according to the chronological order of the transaction periods to obtain a set of transaction time sequence changes containing information on the changes in the time interval between adjacent transaction periods for each transaction node.

3. The self-service method for refunding China Railway UnionPay cards based on multi-system collaboration as described in claim 2, characterized in that, For each adjacent timestamp pair in the set of adjacent timestamp pairs, the difference between the outbound timestamp and the inbound timestamp is calculated to obtain the change in the time interval between adjacent transaction cycles for each transaction node, including: Based on the set of adjacent timestamp pairs, extract the inbound and outbound timestamps within the same transaction period to obtain the target timestamp pair for the current transaction period. Based on the target timestamp pair, calculate the time difference between the departure time corresponding to the departure timestamp and the arrival time corresponding to the arrival timestamp to obtain the value of the adjacent entry and exit time interval. Based on the value of the adjacent entry and exit time interval, the changing trend of the value of the adjacent entry and exit time interval within the continuous trading cycle is calculated to obtain the time difference of the current trading cycle and the change in the time interval between adjacent trading cycles. Based on the time difference of the current transaction period and the change in the time interval between adjacent transaction periods, the changes of all timestamp pairs in the set of adjacent timestamp pairs are summarized to obtain the value of the change in the time interval between adjacent transaction periods for each transaction node.

4. The self-service method for refunding China Railway UnionPay cards based on multi-system collaboration as described in claim 3, characterized in that, Based on the value of the adjacent entry and exit time interval, the changing trend of the value of the adjacent entry and exit time interval within a continuous trading cycle is calculated to obtain the time difference value of the current trading cycle and the change in the time interval between adjacent trading cycles, including: Based on the change in the time interval, a discrete change mapping relationship is constructed with the reference time span as the independent variable. The continuous time is discretized to divide it into multiple transaction cycle nodes, and a discrete mapping function is obtained. Based on the discrete mapping function, extract the independent variable nodes corresponding to the reference time span, locate the starting position of the current trading cycle on the time axis, and obtain the independent variable benchmark node; Based on the independent variable benchmark node, the corresponding dependent variable node is queried in the discrete mapping function, and the fluctuation value of the entry and exit time interval within the current trading cycle is extracted to obtain the dependent variable benchmark node. Based on the dependent variable reference node, the independent variable reference node is extracted as the independent variable reference. The dependent variable reference node is calculated relative to the independent variable reference node, and the quotient obtained by dividing the dependent variable increment by the independent variable increment is calculated to obtain the time difference of the current trading cycle and the change in the time interval between adjacent trading cycles.

5. The self-service method for refunding China Railway UnionPay cards based on multi-system collaboration as described in claim 4, characterized in that, The deduction records within the normal time interval of the transaction time series change set are accumulated, and the deduction values ​​within each time interval are accumulated segment by segment to generate the total cumulative annual fee data reflecting the historical deduction accumulation status, including: Based on the set of transaction time-series changes, extract the deduction records that fall within the normal time interval to obtain the set of deduction records for the normal time interval; Based on the set of deduction records for the normal time interval, the normal time interval is divided into multiple consecutive time sub-intervals according to the chronological order, resulting in a time sub-interval sequence. Based on the time sub-interval sequence, extract the deduction value corresponding to each time sub-interval to obtain the set of deduction values ​​corresponding to each time sub-interval. Based on the set of deduction values ​​corresponding to each time sub-interval, and using the time span of the time sub-interval sequence as the accumulation variable, the set of deduction values ​​is accumulated. The deduction values ​​in each time sub-interval are accumulated segment by segment to obtain the total amount of annual fees to be deducted, which reflects the historical deduction accumulation status.

6. The self-service method for refunding China Railway UnionPay cards based on multi-system collaboration as described in claim 5, characterized in that, Based on the set of deduction values ​​corresponding to each time sub-interval, and using the time span of the time sub-interval sequence as the accumulation variable, the set of deduction values ​​is accumulated. The deduction values ​​within each time sub-interval are accumulated segment by segment to obtain the total accumulated annual fee data reflecting the historical deduction accumulation status, including: Based on the set of deduction values ​​corresponding to each time sub-interval and the time span of the time sub-interval sequence, the time span is mapped to a continuous time interval to obtain a continuous time accumulation field. Based on the continuous time accumulation domain, the deduction values ​​corresponding to each time sub-interval are mapped to the corresponding time interval to obtain a discrete deduction distribution sequence; Based on the discrete deduction distribution sequence, an accumulation operation is performed in the continuous time accumulation domain to solve the cumulative amount of deduction values ​​over time in each time interval, thereby obtaining the local deduction accumulation value of each time sub-interval. Based on the local deduction accumulation values ​​of each time sub-interval, the data is superimposed segment by segment according to the chronological order of the time sub-interval sequence to obtain the total amount of annual fees to be deducted, reflecting the historical deduction accumulation status.

7. The self-service method for refunding China Railway UnionPay cards based on multi-system collaboration as described in claim 6, characterized in that, Based on the discrete deduction distribution sequence, an accumulation operation is performed within the continuous time accumulation domain to solve for the cumulative amount of deductions over time in each time interval, obtaining the local deduction accumulation value for each time sub-interval, including: Based on the discrete deduction distribution sequence, the initial deduction value corresponding to the current time interval is extracted to obtain the deduction base to be accumulated; Extract the starting time corresponding to the current time interval to obtain the time starting point; Extract the end time corresponding to the current time interval to obtain the time endpoint; Based on the time starting point, determine the time transition interval from the time starting point to the time ending point to obtain the continuously accumulated time domain; Based on the continuous accumulation time domain, the deduction base to be accumulated is continuously accumulated within the continuous accumulation time domain to obtain the total accumulated deduction amount over time. Based on the total accumulated deduction, the total accumulated deduction is used as the calculation result for the current time interval to obtain the local accumulated deduction value for each time sub-interval.

8. The self-service method for refunding China Railway UnionPay cards based on multi-system collaboration as described in claim 7, characterized in that, Based on the account fund deduction difference data, a refund settlement instruction is generated, and the refund settlement instruction is asynchronously pushed to a third-party payment platform to generate a refund execution receipt file containing specific refund execution status information, including: Based on the account fund deduction difference data, extract the user identifier and refund amount corresponding to the China Railway Yintong Card to obtain the basic parameter set for card refund settlement; Based on the set of basic parameters for card refund settlement, the user identifier and the refund amount are encapsulated according to the settlement message format to obtain a card refund settlement instruction. According to the card refund settlement instruction, the card refund settlement instruction is written into the asynchronous message queue to obtain a settlement delivery record containing a message identifier; Based on the clearing delivery record containing the message identifier, the card refund clearing instruction is pushed to the third-party payment platform through the asynchronous message queue, and the refund processing result returned by the third-party payment platform is obtained; Based on the refund processing result, the refund execution status identifier and fund transfer serial number are extracted to obtain a card refund execution receipt file containing specific refund execution status information.

9. The self-service method for refunding China Railway UnionPay cards based on multi-system collaboration as described in claim 8, characterized in that, Based on the aforementioned card refund settlement basic parameter set, the user identifier and the refund amount are encapsulated according to the settlement message format to obtain a card refund settlement instruction, including: Based on the set of basic parameters for card refund settlement, the user identifier and the refund amount are extracted to obtain the core business fields to be encapsulated. Based on the core business fields to be encapsulated, a preset clearing message template is matched to obtain a message structure framework containing field mapping location information; Based on the message structure framework, the core business fields to be encapsulated are filled into the corresponding field mapping positions to obtain the filled settlement message data; Based on the filled-in clearing message data, the protocol format of the filled-in clearing message data is converted to obtain the card refund clearing instruction.

10. A self-service card refund device for China Railway UnionPay Card based on multi-system collaboration, wherein the device implements the method as described in any one of claims 1 to 9, characterized in that, include: The acquisition module is used to acquire the historical transaction record set of China Railway Yintong Card, extract the entry and exit timestamps of each transaction, and generate the original timestamp; Arrange them in chronological order to generate a sequence of entry and exit timestamps containing entry and exit time information for each station; The solution module is used to perform calculations on adjacent timestamps in the same transaction period in the entry and exit timestamp sequence, solve for the change in the time interval between adjacent transaction periods of each adjacent entry and exit timestamp difference, and generate a set of transaction time series change quantities containing information on the change in the time interval between adjacent transaction periods of each transaction node. The accumulation module is used to perform accumulation calculations on the deduction records in the normal time interval of the transaction time sequence change set, accumulate the deduction values ​​in each time interval segment by segment, and generate the total amount of cumulative annual fees to be deducted that reflects the historical deduction accumulation status. The calculation module is used to compare the total amount of accumulated annual fees to be deducted with the current available balance of the China Railway Yintong Card account point by point, calculate the difference between the two values, and generate account fund deduction difference data to indicate the final refund amount. The push module is used to generate a refund settlement instruction based on the account fund deduction difference data, asynchronously push the refund settlement instruction to the third-party payment platform, and generate a refund execution receipt file containing specific refund execution status information; Receive the card refund execution receipt file, update the card status of the China Railway Yintong Card according to the specific refund execution status, and generate a card refund completion certificate file containing the final processing result and settlement details.