A method and system for customer credit evaluation and credit management based on multi-level classification and dynamic constraints

By implementing multi-level credit classification, differentiated contract access, real-time credit limit calculation, and unified auditing, the existing technologies for customer credit management have been improved, addressing issues such as coarse-grained management, rigid credit limits, and fragmented data. This has enabled refined risk management and a systematic credit assessment.

CN123180748APending Publication Date: 2026-11-27SHANXI PINGYANG HEAVY IND COAL MASCH FITTINGS SALES
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611413400.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-11
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing technologies for customer credit management suffer from problems such as coarse credit classification granularity, static and rigid credit limits, single constraint strategies, lack of systematic management of temporary credit enhancement, scattered audit data, and incomplete contract access verification, making it difficult to meet the needs of manufacturing enterprises for refined management of customer credit throughout the entire process.

Method used

A multi-level credit classification system is adopted, differentiated contract access constraints are implemented, available credit limits are calculated in real time, temporary credit is managed systematically, and audit traceability is unified. By constructing a five-level credit rating code, the credit limit is dynamically adjusted, risk exposure is calculated in real time, and credit rating changes and temporary credit approval records are integrated into a unified audit timeline to achieve triple pre-verification.

Benefits of technology

It has achieved refined risk management, dynamically reflected the true risk situation, differentiatedly controlled risk and business balance, systematically managed temporary credit, provided a complete credit profile, ensured complete control over contract access, and improved the efficiency and accuracy of credit management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123180748A_ABST
    Figure CN123180748A_ABST
Patent Text Reader

Abstract

The application provides a customer credit evaluation and credit management method and system based on multi-level classification and dynamic constraints, belonging to the field of enterprise information management; the method comprises the following steps: constructing a multi-level credit rating classification system; implementing differentiated contract access constraints for different credit levels; real-time aggregation of three elements of basic quota, approved temporary credit total and current risk exposure to calculate available credit; automatically collecting risk exposure snapshots when temporary credit applications are created; fusing credit rating change logs and temporary credit approval records into a unified audit timeline according to timestamps; sequentially performing three pre-checks of rating existence, timeliness and quota sufficiency in the contract creation link. The application realizes fine risk management through multi-level classification and differentiated constraints, realizes dynamic quota determination through a three-element aggregation model, eliminates offline approval blind spots through systematic management of the whole process of temporary credit, and provides a complete customer credit profile through dual-source fusion audit.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of enterprise information management technology, and in particular to a customer credit assessment and credit management method and system based on multi-level classification and dynamic constraints. Background Technology

[0002] In the operation and management of manufacturing enterprises, customer credit management is the first line of defense connecting sales access and financial risk control. Before signing a contract with a customer, the enterprise needs to assess the customer's creditworthiness, determine the credit limit that can be granted, and verify whether the limit is sufficient when the contract is created. When the limit is insufficient, a controlled temporary credit enhancement channel needs to be provided.

[0003] After in-depth analysis of the existing workflows and system functions, the existing technology has the following six core defects: (i) The credit classification is coarse-grained and lacks multi-level risk assessment capabilities. Traditional credit management typically uses a binary classification method (such as "pass / fail" or "excellent / average"), which fails to reflect the subtle differences in risk levels among different customers. Giving all customers with a "pass" rating the same credit treatment ignores the essential differences in risk tolerance and cooperation value between strategic and ordinary customers. The rating system and credit limit standards are usually hard-coded into the program; when a company needs to adjust its credit policy according to its business strategy, it must modify the code and redeploy the system.

[0004] (ii) Static and rigid credit limits fail to reflect real-time risk exposure. In traditional systems, a customer's credit limit is a static figure that does not dynamically change with the number and amount of contracts currently being executed. A customer may simultaneously sign multiple large contracts, and their actual risk exposure may far exceed their credit limit, but the system cannot detect or issue warnings in real time. This management model of "only looking at the limit, not the exposure" renders the credit limit meaningless in terms of risk control.

[0005] (iii) A uniform constraint strategy is applied to all customers, lacking differentiated management. Different management strategies should be applied to customers with different credit ratings—high-risk customers require stricter access restrictions, while strategic customers require a more flexible credit limit matching mechanism. However, the current technology uses the same verification logic for all customers, which either leads to uncontrolled high-risk exposure due to overly loose restrictions, or to the loss of high-quality business due to overly tight restrictions.

[0006] (iv) The temporary credit enhancement process relies on offline operations and lacks systematic management. When a customer's fixed credit limit is insufficient, marketing personnel need to apply for a temporary credit enhancement from management via telephone, email, or paper approval forms. This offline model has three problems: the approval process is not recorded in the system, the approval status cannot be tracked in real time, and the approval result cannot be automatically linked to subsequent credit limit calculations. When the approver makes a decision, they may see outdated customer risk data.

[0007] (v) Credit change history and approval records are stored in a scattered manner, lacking a unified audit view. Customer credit-related change data is scattered across at least two heterogeneous tables—credit rating modification records and temporary credit approval records. When auditors need to understand "the complete evolution of a customer's credit status from registration to the present," they must query multiple tables separately, export the data, and then manually sort and merge it. This scattered audit model is inefficient and prone to missing key information.

[0008] (vi) Incomplete credit verification during contract creation. When creating a contract, three basic conditions should be checked: whether the customer's credit rating exists, whether it has expired, and whether the credit limit is sufficient. However, in existing technical solutions, these checkpoints are scattered across different modules or even different systems, often resulting in omissions such as only checking whether the rating exists but not whether it has expired, or only checking the basic credit limit but not including the used exposure.

[0009] In summary, existing technologies are insufficient to meet the needs of manufacturing enterprises for refined management of customer credit throughout the entire process. There is an urgent need for a technical solution that can realize multi-level credit classification, differentiated constraint strategies, real-time exposure calculation, systematic management of temporary credit granting, and unified audit traceability. Summary of the Invention

[0010] To address the problems in existing technologies such as coarse credit classification granularity, static and rigid credit limits, single constraint strategies, lack of systematic management of temporary credit enhancement, scattered audit data, and incomplete contract access verification, this application proposes a customer credit assessment and credit management method and system based on multi-level classification and dynamic constraints.

[0011] The technical solution adopted in this application is: a customer credit assessment and credit management method based on multi-level classification and dynamic constraints, including the following steps: Step S1: Construct a multi-level credit classification system, defining customer credit rating codes with at least five progressive levels—Key Category A, Key Category B, Excellent Category, General Category A, and General Category B; each credit rating is associated with credit limit attributes and rating year attributes; Step S2: Implement differentiated contract access constraints based on credit rating—For general Class B customers, no fixed upper limit is set for the credit limit, but a "first contract only" constraint is implemented, meaning that once the customer has any valid contract in the system, they are prohibited from creating any new contracts; For key Class A customers, a dynamic credit limit adjustment mechanism is implemented. When it is detected that the customer's current risk exposure is lower than both its basic credit limit and the amount of the new contract to be created, the available credit limit used for this verification is automatically adjusted to max(basic credit limit, new contract amount). Step S3: Calculate the available credit limit for each customer in real time. Available credit limit = basic credit limit + total amount of temporary credit approved in the current year - current risk exposure, where the current risk exposure is the sum of new accounts receivable and new contract assets of all valid contracts; and when the contract is created, perform a pre-credit limit verification, compare the sum of the new contract amount and the current risk exposure with the available credit limit, and if they do not meet the requirements, return detailed credit limit gap information. Step S4: Multi-role lifecycle management of temporary credit approval—When a marketing role creates an application, the system automatically captures the customer's current accounts receivable balance, contract asset balance, and original credit limit as a snapshot of the application; the application record flows according to a state machine model of "pending review → approved → cleared" or "pending review → rejected"; only the finance role or the administrator role can perform the approval operation; the record after approval enters an immutable state; at the end of the year, the administrator role performs a batch clearing operation to uniformly change all approved temporary credit applications for the year to the cleared state; Step S5: Integrate the two heterogeneous data sources, credit rating change logs and temporary credit approval records, into a unified audit timeline; Step S6: In the contract creation process, perform a credit assessment-driven triple pre-verification: the first verification is the existence of the customer's credit rating, the second verification is the timeliness of the rating, and the third verification is the adequacy of the available credit limit.

[0012] Furthermore, key Category A customers are core clients with long-term strategic partnerships with the company, and their associated fixed credit limits are the highest, supporting a dynamic credit limit adjustment mechanism; Key Category B customers are important clients with stable cooperative relationships with the company, and their associated fixed credit limit is lower than that of Key Category A customers; Premium customers are ordinary customers with good credit records, and their associated fixed credit limit is lower than that of key B customers. General Category A customers are ordinary customers with average credit records, and their associated fixed credit limit is lower than that of premium category customers. Generally, Category B customers are marginal customers with limited credit history or certain risk signals. They are not associated with a fixed credit limit and are subject to the restriction that the number of contracts is limited to the first contract. Furthermore, the mapping relationship between credit rating codes and credit limit values ​​is stored in the database system configuration table in JSON format.

[0013] Furthermore, the steps of the dynamic credit limit increase mechanism for key Category A customers include: Step (2a): Calculate the current risk exposure of the customer through aggregate query; Step (2b): Read the basic credit limit from the customer's credit rating record; Step (2c): Obtain the contract amount for the proposed new contract; Step (2d): Perform a dual-condition judgment - if the current risk exposure does not exceed the basic limit and the current risk exposure is lower than the new contract amount, then it is determined that the customer's current available space is insufficient but the overall risk is within a controllable range. Step (2e): Under this condition, set the available credit limit used for this contract creation verification to max(base credit limit, new contract amount) so that the new contract amount can be covered by a sufficiently large verification credit limit value, thereby passing the credit limit verification. Step (2f): The adjusted credit limit value is only used as a temporary variable in the calculation process of this verification. It does not modify the credit limit field that is persistently stored in the database for the customer, does not change its credit rating record, and does not create a credit limit amplification effect on other concurrent contract creation requests.

[0014] Furthermore, the specific steps for calculating the available credit limit include: Step (3a) Read the credit rating code and basic credit limit field value of the customer from the customer credit rating table. If the rating is general category B, the basic credit limit is considered empty. Step (3b) calls the temporary credit aggregation function to query all records in the temporary credit approval table whose status is "approved" and whose application year is equal to the current year, using the customer name and the current year as the filter conditions. The application amount fields are summed to obtain the total approved temporary credit amount. Step (3c) calculates the customer's current risk exposure through aggregated query, iterates through the new accounts receivable and new contract asset fields of all its valid contracts and sums them; Step (3d) Calculate the available credit limit = base credit limit + total approved temporary credit limit - current risk exposure; if the base credit limit is empty, the current risk exposure value will be used as the dynamic credit limit for this customer. In step (3e), during the pre-contract creation verification, it is determined whether the condition “new contract amount + current risk exposure ≤ basic credit limit + approved temporary credit limit total amount” is true. If not true, a structured credit limit shortage information is returned to the caller, which includes at least five data items: basic credit limit, total temporary credit limit, used exposure, available balance and credit limit gap amount.

[0015] Furthermore, the steps to integrate the two heterogeneous data sources—credit rating change logs and temporary credit approval records—into a unified audit timeline include: The first step is to query the primary data source: using the customer's name as the condition, query all rating change records of that customer from the credit rating change log table, and sort them by the change time; The second step is to query the second data source: using the customer's name as the condition, query all temporary credit records of the customer from the temporary credit approval record table, and sort them by creation time / approval time. The third step is to format the first data source: traverse the result set from the first step, convert each record into a uniform timeline entry format, with each entry containing at least three common fields: timestamp of the change time field, event type of the rating change, concatenated rating, and event summary describing the changes in credit limit and year; and assign a globally unique composite key to each entry, in the format of "credit_" plus the primary key ID of that record; Step 4, second data source formatting: Traverse the result set of step 2, convert each record into a uniform timeline entry format, and each entry should contain at least three common fields: timestamp of approval time or creation time field, event type of temporary credit approval, event summary of application amount and approval status description, and assign a globally unique composite key to each entry, in the format of "temp_" plus the primary key ID of the record; Step 5, Merge and sort: Merge the two sets of entries generated in steps 3 and 4 into a single list, sorted in descending order by the value of the timestamp field; Step 6: Filtering support; provides optional filtering parameters by year and event type, with the filtering logic executed at the database query level.

[0016] Furthermore, the specific implementation steps of the credit assessment-driven triple pre-verification include: The first layer—a hard-line interception of the credit rating existence check: Before the contract save request enters the business processing logic, the credit rating table is queried based on the customer's name; if no rating record is found, the processing flow is terminated and an error response is returned to the caller. If this re-check fails, the following steps are not allowed to continue. The second layer—a rating timeliness check as a soft warning: read the rating year field in the customer's credit rating record and compare it with the current date year; if the two are inconsistent, return a warning-level response to the caller, but do not prevent the contract saving process from continuing, and the user confirms whether to continue; The third layer—a hard-line interception of credit adequacy verification: The available credit limit calculation method in step S3 is invoked, and the sum of the new contract amount and the current risk exposure is compared with the total available credit limit; if the former is greater than the latter, the processing flow is terminated, and detailed structured information on insufficient credit limit is returned to the caller, including at least: basic credit limit, total temporary credit limit, current used exposure, current contract amount, available balance, and credit limit shortfall amount; The triple checks are performed in the order described above. Each check proceeds only after the previous check passes. If any hard-block check fails, the process is terminated immediately and an error is returned.

[0017] Furthermore, the method also includes the following credit assessment data maintenance mechanism: (a) The creation, modification and deletion of each credit rating record triggers field-level audit log recording. The log is generated using a four-step method of "snapshot before change → snapshot after change → field-by-field comparison → difference writing". The log structure includes at least the changed table name, changed record ID, changed field name, old value, new value, change type, operator and operation time. (b) When credit rating data changes, a rating year verification interface is provided to the contract management module. This rating year verification interface returns whether the rating of the specified customer belongs to the current year, which can be called by the contract creation and editing process. (c) Through the comprehensive credit query interface for customers, return comprehensive information for each customer, including credit rating code, basic credit limit, total approved temporary credit limit, total available credit limit, current risk exposure, whether the rating has expired, and whether a contract can be created, for use by the customer selector and contract list page in the contract creation process.

[0018] A customer credit assessment and credit granting management system based on multi-level classification and dynamic constraints includes: The credit rating classification module is used to maintain credit rating codes of at least five progressive levels and their associated credit limit attributes, and realizes dynamic configurability of credit rating and credit limit through a mapping relationship driven by database configuration tables. The differentiated constraint enforcement module is used to implement differentiated contract access constraints for customers with different credit ratings—for general Class B customers, a quantity constraint of "limited to the first contract only" is enforced, and for key Class A customers, a dynamic limit increase is enforced based on the comparison between the current risk exposure and the amount of the new contract. The real-time credit limit assessment module aggregates three elements: the basic credit limit, the total approved temporary credit limit, and the current risk exposure. It calculates the available credit limit for each customer in real time and performs pre-credit limit verification when the contract is created. The temporary credit approval module is used to manage the entire lifecycle of temporary credit applications from creation and approval to annual batch clearing, and to implement operational permission isolation between marketing roles and finance / administrator roles; The dual-source audit fusion module is used to convert two heterogeneous data sources, credit rating change logs and temporary credit approval records, into a unified format and merge them into a single audit timeline sorted by time. The contract access verification module is used to perform three pre-checks in the contract creation process: rating existence verification, rating timeliness verification, and credit adequacy verification.

[0019] A computer device includes a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method.

[0020] A computer-readable storage medium having a computer program / instructions stored thereon, which, when executed by a processor, implement the steps of the method.

[0021] The advantages of this application over the prior art are as follows: (1) Multi-level classification enables refined risk management: The five-level credit classification system provides a more refined risk differentiation capability than the traditional binary classification method. Different levels correspond to different credit limit strategies and constraint rules—strategic customers enjoy the flexibility of dynamic credit limit increases, while high-risk customers are subject to the rigid constraint of "limited to the first contract only". The mapping relationship between level and credit limit is driven by database configuration, and enterprises can adjust it at any time according to their business strategies without modifying the code or redeploying.

[0022] (2) Dynamic credit limit assessment reflects the true risk situation: Through the three-element aggregation model of "basic credit limit + temporary credit line - risk exposure", the system can accurately reflect the true available credit limit of each customer at any time. The creation of new contracts, the entry of payments, the approval of temporary credit lines - any operation that affects the risk exposure or available credit limit will be reflected in the subsequent credit limit query in real time, fundamentally eliminating the management blind spot of "only looking at the fixed credit limit and ignoring the actual exposure".

[0023] (3) Differentiated constraints achieve a balance between risk and business: different contract access strategies are implemented for customers with different credit ratings. GENERAL_B’s “no fixed limit but only one contract” uses quantity constraints instead of amount constraints, simplifying management while controlling risk; KEY_A’s dynamic limit increase can flexibly adapt to large contracts under the premise of controllable risk exposure, avoiding the loss of business opportunities from strategic customers due to rigid limit numbers.

[0024] (4) Systematic management of the entire temporary credit line process: The traditional offline email / telephone approval model is transformed into a closed-loop management system. When applying for marketing, a snapshot of risk exposure is automatically collected. The approver makes decisions based on real data. The approval result is automatically included in the credit limit assessment. The credit limit is cleared in batches at the end of the year to prevent the credit limit from accumulating across years. The permissions of the applicant and the approver are completely isolated. The record after the approval is completed cannot be modified, ensuring the seriousness and traceability of the approval process.

[0025] (5) Dual-source fusion audit provides a complete credit profile: It integrates two completely different data sources, credit rating changes and temporary credit approvals, into a unified timeline, solving the pain point that auditors need to query multiple tables separately and manually merge and sort them. The composite key mechanism with source prefixes ensures the global uniqueness of each entry in the entire timeline, while supporting flexible filtering by year and event type.

[0026] (6) Triple pre-verification achieves complete control over contract access: In the contract creation stage, the existence of credit rating (hard interception), the timeliness of credit rating (soft warning) and the adequacy of credit limit (hard interception) are checked in sequence to form three progressive lines of defense. The combination of hard interception and soft warning reflects the differentiated treatment of different risk levels - the existence and adequacy of credit is an uncompromising bottom line, while timeliness is a risk that can be accepted by human judgment. Attached Figure Description

[0027] The following description, in conjunction with the accompanying drawings, further illustrates this application: Figure 1 This is a flowchart illustrating the overall processing method of this application; Figure 2 This is intended to represent the mapping between a five-level credit classification system and configurable ratings. Figure 3 A decision-making flowchart for a differentiated contract access constraint mechanism; Figure 4 Data flow diagram for the real-time risk exposure calculation and credit limit dynamic determination model; Figure 5 A state machine diagram of the four-stage lifecycle for temporary credit approval; Figure 6 Flowchart of automatic snapshot capture during the creation of a temporary credit grant application; Figure 7 The flowchart shows the processing flow of the timeline fusion algorithm for dual-source heterogeneous audit data; Figure 8 A flowchart of a credit assessment-driven triple pre-verification process for contract access; Figure 9 This is a diagram showing the deployment of the system's three-tier B / S architecture. Detailed Implementation

[0028] like Figures 1 to 9As shown, this application provides a customer credit assessment and credit management method and system capable of implementing a multi-level credit classification and configurable rating system, implementing differentiated contract access constraints based on risk levels, real-time aggregation of three elements—basic credit limit, temporary credit, and risk exposure—to determine available credit limits, implementing multi-role lifecycle management for temporary credit, merging heterogeneous audit data of credit changes and credit approval into a unified timeline, and automatically executing triple pre-verification during contract creation. It is implemented based on a B / S (browser / server) architecture, including a front-end interaction layer, a back-end business logic layer, and a data persistence layer. The technical solution of this application is described in detail below.

[0029] (I) System Overall Architecture The system adopts a three-tier B / S architecture with a front-end and back-end separation. The front-end interaction layer is a single-page application (SPA) built on the Vue 3 framework and Ant Design Vue component library, communicating with the back-end via HTTP / HTTPS protocols. The back-end business logic layer is a RESTful API service built on the Python FastAPI framework, including core modules such as credit rating services, temporary credit approval services, exposure calculation services, and audit integration services. The data persistence layer is based on a relational database, used to store customer credit rating tables, credit change log tables, temporary credit approval tables, system configuration tables, and master contract tables, etc. Figure 9 As shown in the diagram, the network topology is shown as follows: browser (user's PC) → front-end SPA application → back-end API service cluster → database server. The diagram also shows five core data tables labeled in the database layer: credit rating table, credit change log table, temporary credit approval table, system configuration table, and contract master table.

[0030] The system achieves full automation of customer credit assessment and credit management through the coordinated operation of the following six core modules.

[0031] (II) Module 1: Credit Rating Classification Module. This module constructs a multi-level credit classification and configurable rating system to maintain at least five progressive levels of credit rating codes and their associated credit limit attributes. Dynamic configuration of ratings and limits is achieved through a database configuration table-driven mapping relationship. This rating system includes: 1. Five-level credit classification system The system defines customer credit ratings as five progressive levels, each with different risk characteristics and credit limit strategies: (1) Key Category A (KEY_A): Applicable to core customers with long-term strategic partnerships with the enterprise. It is associated with a fixed high limit (e.g., RMB 100 million) and supports a dynamic limit adjustment mechanism—when the customer's risk exposure is lower than the basic limit but the new contract amount exceeds the current available space, the system automatically uses the larger value of the basic limit and the new contract amount as the limit benchmark for this verification.

[0032] (2) Key Category B (KEY_B): Applicable to important clients with stable cooperative relationships with the enterprise. It is associated with a fixed credit limit (e.g., 80 million yuan), uses standard credit limit verification logic, and does not support dynamic increases.

[0033] (3) Quality Category: Applicable to ordinary customers with good credit records. Associated with a fixed credit limit (e.g., 50 million yuan) and uses standard credit limit verification logic.

[0034] (4) General Category A: Applicable to ordinary customers with average credit history. Associated with a fixed credit limit (e.g., 20 million yuan) and uses standard credit limit verification logic.

[0035] (5) General Category B: Applicable to marginal customers with limited credit history or certain risk signals. It is not associated with a fixed credit limit value (the CREDIT_LIMIT field is null), and its real-time available credit limit is dynamically replaced by the customer's current accounts receivable balance. It is also subject to a special quantity constraint of "first contract only" - once the customer has any valid contract in the system, he / she is prohibited from creating any new contracts.

[0036] 2. Database configuration-driven rating mapping table The mapping between credit rating codes and credit limit values ​​is not hardcoded in the program code, but stored in the database system configuration table (REVENUE_CONFIG) in JSON format, with the configuration key CREDIT_RATING_CONFIG. An example of the storage format is as follows: { "KEY_A": {"limit": 100000000, "label": "Key Class A"}, "KEY_B": {"limit": 80000000, "label": "Key Class B"}, "QUALITY": {"limit": 50000000, "label": "Premium Category"}, "GENERAL_A": {"limit": 20000000, "label": "General Class A"}, "GENERAL_B": {"limit": null, "label": "General Class B"} } The system uses the `load_credit_ratings_from_config()` function to read and parse the JSON data from the configuration table at runtime, constructing a memory-mapped dictionary that maps credit rating codes to credit limit values ​​and display labels. When an administrator needs to adjust the credit limit for a certain level (e.g., adjusting the credit limit for KEY_A from 100 million to 120 million due to a change in corporate credit policy), they only need to modify the JSON value of the corresponding key in the configuration table through the configuration management interface. The system will automatically take effect the next time it reads the configuration (usually in the next API request), without requiring any modification to program code, a service restart, or redeployment.

[0037] like Figure 2 As shown, the diagram displays the codes, names, credit limit policies, and differentiated constraint rules for the five credit levels (KEY_A, KEY_B, QUALITY, GENERAL_A, GENERAL_B) in tabular form, as well as the level-credit limit mapping relationship stored in the system configuration table in JSON format.

[0038] 3. Rating timeliness management Each credit rating record includes a rating year field (RATING_YEAR). The system provides a calculated attribute `is_expired` for this record, automatically marking it as expired when the current date year does not match the RATING_YEAR. Expired ratings trigger a second layer of pre-verification (timeliness warning) during the contract creation process and are highlighted as expired in the customer credit comprehensive query results.

[0039] (III) Module Two: Differentiated Constraint Execution Module. This module has a built-in differentiated contract constraint mechanism based on risk level, used to implement differentiated contract access constraints for customers with different credit ratings—for general Category B customers, a quantity constraint of "limited to the first contract only" is applied; for key Category A customers, a dynamic limit increase is applied based on the comparison between the current risk exposure and the new contract amount. This mainly includes: 1. The hard constraint of GENERAL_B: "First contract only" Generally, Class B customers belong to a higher-risk, borderline customer category. The system implements a unique pre-constraint on this type of customer—no fixed credit limit is set, but they are strictly limited to signing only one contract. This constraint is enforced both on the front end and back end. Front-end level: In the customer dropdown selection box on the contract editing page, the system obtains the `can_create_contract` attribute of each customer through the credit enhancement interface. For customers that return false, their dropdown options are grayed out (unselectable), and a reason explanation is displayed after the option label (such as "This customer's credit rating is general class B, and only one contract can be created").

[0040] At the backend level: In the contract preservation service, the system counts the number of contract records for a given customer in the main contract table (REVENUE_CONTRACT) that have not been soft-deleted (IS_DELETED=0). If the count is greater than or equal to 1, the preservation process is terminated, the transaction is rolled back, and a structured error response containing "can_create": false and a reason explanation is returned. This backend validation ensures that even if an attacker bypasses the frontend and directly calls the API, they cannot create a second contract for a typical customer (Class B).

[0041] The advantage of this constraint mechanism is that it simultaneously applies two seemingly independent but complementary restrictions to the same credit rating: "no fixed limit" and "strict limit of 1 contract number." The former reduces management complexity (there is no need to set and maintain a fixed limit number for this type of customer), while the latter rigidly limits the size of risk exposure from a quantitative perspective.

[0042] 2. KEY_A Dynamic Credit Limit Increase Mechanism Key Category A customers are strategic partners of the enterprise. The system employs a differentiated processing logic for them, unlike the fixed credit limit tier—when specific conditions are met, the available credit limit used for this verification is automatically increased. The specific execution steps are as follows: Step (2a): Calculate the customer's current risk exposure current_exposure = Σ(NEW_AR of new accounts receivable under all valid contracts of the customer) + Σ(NEW_CA of new contract assets under all valid contracts of the customer) through aggregate query.

[0043] Step (2b): Read the base limit from the customer's credit rating record.

[0044] Step (2c): Obtain the contract amount (contract_amount) for the proposed new contract.

[0045] Step (2d): Perform a dual-condition judgment — if current_exposure < base_limit (the current exposure does not exceed the base limit) and current_exposure < contract_amount (the current exposure is lower than the new contract amount), it is determined that the customer's current available space is insufficient but the overall risk is within a controllable range.

[0046] Step (2e): Under this condition, set the available limit used for this contract creation verification to max(base_limit, contract_amount), so that the new contract amount can be covered by a sufficiently large verification limit value, thereby passing the limit verification.

[0047] Step (2f): The adjusted limit value is only used as a temporary variable in the calculation process of this verification, and does not modify the credit limit field persistently stored in the database for this customer, nor does it change its credit rating record, nor does it create a limit amplification effect on other concurrent contract creation requests.

[0048] The advantage of this mechanism is that: taking the current actual exposure as the factual basis, the new contract amount as the trigger variable, and the base limit as the safety floor, the limit value used for this verification is dynamically decided after comparing the three — it not only ensures that large contracts of strategic customers are not blocked by rigid fixed limits, but also retains the floor protection to prevent further limit amplification when the exposure is already high.

[0049] As shown in Figure 3 , this figure shows two branch paths after judging the customer's credit level — the logic of "query contract quantity → intercept if ≥1" for the GENERAL_B path, and the logic of "calculate exposure → dual-condition judgment → dynamically adjust verification limit" for the KEY_A path.

[0050] (IV) Module 3: Real-time limit approval module, which is used to aggregate the three elements of base limit, total approved temporary credit, and current exposure, calculate the available credit limit of each customer in real time, and perform pre-contract limit verification when creating a contract, specifically including: 1. Three-element aggregation model of available credit limit The system calculates the available credit limit for each customer in real time, and constructs a three-element aggregation model of "base limit + temporary credit enhancement - used exposure = available balance": Element 1 (base limit): comes from the CREDIT_LIMIT field value of this customer in the credit rating table. For the GENERAL_B level, the value of this field is null, the system does not set a fixed upper limit, and uses the current exposure value as its dynamic limit display.

[0051] Element Two (Total Approved Temporary Credit Line): Calculated using the temporary credit line aggregation function `_get_temp_credit_map()`. This function uses both the customer name and the current year as dual filtering conditions, iterates through all records in the temporary credit line approval table where "Application Year = Current Year" and "Status = Approved", and sums up their application amount (REQUEST_AMOUNT) field to obtain the effective temporary credit line increase for the current year. Temporary credit lines from different years are strictly isolated—approved credit lines from the previous year are not included in the available credit line for the current year.

[0052] Element 3 (Current Risk Exposure): The sum of the NEW_AR (New Accounts Receivable) field and the sum of the NEW_CA (New Contract Asset) field of all valid contracts (IS_DELETED=0) of this customer are calculated by aggregate query, and the sum of the two is obtained to obtain the current risk exposure.

[0053] 2. Pre-contract credit limit verification process In the contract storage service, the system calls the credit limit verification function before performing the actual data persistence operation: (1) Obtain the credit rating record of the customer and extract the basic credit limit and credit rating code; (2) If the credit rating is KEY_A, first execute the dynamic credit limit increase judgment described in Module 2 to determine the effective basic credit limit value used in this verification; (3) Call the temporary credit aggregation function to obtain the total approved temporary credit limit for the current year; (4) Calculate total_available = effective basic credit limit + total temporary credit limit; (5) Query the customer's current risk exposure current_exposure; (6) Calculate the expected total exposure after the signing of the new contract = current_exposure + new contract amount; (7) If the expected total exposure > total_available, the verification fails and a structured credit limit shortage information is returned, which includes at least: base limit, temporary credit limit total, current exposure, contract amount, available balance = total_available - current_exposure, and credit limit shortfall = expected total exposure - total_available. (8) After receiving the response that the credit limit is insufficient, the front end displays the various credit limit data in a prominent manner and renders the quick operation entry of "Apply for temporary credit" to guide marketing personnel to the temporary credit application page.

[0054] like Figure 4 As shown in the figure, the data flow from three data sources—basic credit limit (from the credit rating table), total temporary credit limit (from the temporary credit approval table aggregated by year), and current risk exposure (from the main contract table aggregated by customer)—to the available credit limit calculation formula, as well as the consumption relationship of the available credit limit output to the contract access verification and customer selector credit enhancement interface.

[0055] (V) Module Four: Temporary Credit Approval Module, used to manage the entire lifecycle of temporary credit applications from creation (including automatic snapshot collection), approval (approval / rejection) to annual batch clearing, and to implement operational permission isolation between marketing roles and finance / administrator roles, mainly including: 1. Application for creation and automatic snapshot collection When a marketer initiates a temporary credit line application, the system automatically performs three snapshot collection operations before creating the database record, ensuring that the approver sees the actual data status at the time of application, rather than data that may have changed by the time of approval: -Accounts Receivable Snapshot: Query the sum of new accounts receivable (NEW_AR) for all valid contracts of this customer and write it into the CURRENT_AR field of the application; -Contract Asset Snapshot: Query the sum of new contract assets (NEW_CA) for all valid contracts of this customer and write it into the CURRENT_CA field of the application; -Original credit limit snapshot: Read the CREDIT_LIMIT field value from the customer's current credit rating record and write it into the ORIGINAL_LIMIT field of the application.

[0056] At the same time, the system sets the application year (APPLY_YEAR) to the current year and initializes the application status (STATUS) to "pending review". After the application record is saved, a field-level audit log is triggered.

[0057] 2. Role-based access control The system implements strict dual-role access control for temporary credit requests: Marketing Role: Has only the authority to create applications (CREATE) and delete applications created by themselves that are in the "Pending Review" status (DELETE). Does not have approval authority—marketers cannot approve applications they themselves created, nor can they approve applications created by others.

[0058] Finance and Administrator roles: These roles only have approval permissions—they can view details of all pending applications (including snapshot data) and execute approval or rejection actions. They do not have permissions to create applications or modify application content.

[0059] Immutable status protection: Once the status of an application record changes to "Approved" or "Rejected" (i.e., the approver has made a decision), no role (including administrators) can modify any field of the record or delete the record. The approval decision is final and irrevocable.

[0060] The advantage of this permission model is that the operational permissions of the applicant (marketing) and the approver (finance / management) are completely mutually exclusive and symmetrical—neither party can simultaneously have the ability to approve its own application, and neither party can modify the results of the other's completed operations.

[0061] 3. Annual batch reset mechanism The system provides the `batch_clear(year)` method for centralized clearing of temporary credit lines for a specified fiscal year at the end of the fiscal year (or a time specified by the administrator). Operation permissions: Only administrators can execute this command. Scope of processing: Query all temporary credit granting application records with a status of "approved" within a specified year (APPLY_YEAR=year); Batch update: Update the status field of all retrieved records to "cleared"; Transaction guarantee: All update operations are executed atomically within a single database transaction—either all succeed or all are rolled back; Subsequent impact: Records with a status of "cleared" will be automatically excluded from the next year's temporary credit aggregate query (the `_get_temp_credit_map()` function) (because the query conditions require the status to be "approved"), thus ensuring that temporary credit limits will not accumulate across years without approval.

[0062] Figure 5 This is a state machine diagram of the four-stage lifecycle of temporary credit approval. The diagram uses a state machine model to show four states: "Pending Review", "Approved", "Rejected", and "Cleared". It marks the transition conditions between states (Marketing Creation → Pending Review, Financial / Management Approval → Approved / Rejected, Year-End Batch Operation → Cleared) and the allowed operation roles in each state.

[0063] Figure 6This is a flowchart of the automatic snapshot collection process when a temporary credit line application is created. The diagram shows the three snapshot operations that the system automatically performs after the marketer submits the application and before the database record is created: query NEW_AR and write it to CURRENT_AR, query NEW_CA and write it to CURRENT_CA, and read CREDIT_LIMIT and write it to ORIGINAL_LIMIT.

[0064] (vi) Module 5: Dual-Source Audit Fusion Module, used to convert two heterogeneous data sources, credit rating change logs and temporary credit approval records, into a unified format and merge them into a single audit timeline sorted by time, including: 1. Problem Model Customer credit management involves two completely different types of data sources for change: Data Source A (Credit Rating Change Log - CustomerCreditLog table): Records every modification to the credit rating level, credit limit, and annually. Fields include: Customer Name, Change Time, Old / New Rating Value, Old / New Credit Limit Value, Old / New Annual Value, and Operator.

[0065] Data source B (Temporary Credit Approval Records – TempCreditApproval table): Records the application, approval, and clearing process of temporary credit. Fields include: Customer Name, Application Time, Approval Time, Application Amount, Approval Status, and Reviewer.

[0066] In an auditing scenario, the question that needs to be answered is "What is the complete evolution of the customer's credit status from registration to the present?" This requires merging the two types of records with different sources and structures into a unified timeline.

[0067] 2. Fusion Algorithm The system uses the `get_credit_logs()` method to automatically fuse heterogeneous data from two sources. The specific steps are as follows: Step 1 (First Data Source Query): Using the customer's name as the condition, query all rating change records of that customer from the CustomerCreditLog table, and sort them by the change time.

[0068] Step 2 (Second Data Source Query): Using the customer's name as the condition, query all temporary credit records of that customer from the TempCreditApproval table, and sort them by creation time / approval time.

[0069] Step 3 (First Data Source Formatting): Iterate through the result set from Step 1, converting each record into a uniform timeline entry format. Each entry must contain at least three common fields: timestamp (either `recording_time` or `change_time`), event type (set to "Rating Change"), and event summary (generated by concatenation, e.g., "Credit rating changed from 'General A' to 'Premium', credit limit changed from 20 million to 50 million"). Assign a globally unique composite key `_key` to each entry, in the format `"credit_" + record primary key ID`, ensuring accurate identification and deduplication across the entire timeline.

[0070] Step 4 (Second Data Source Formatting): Iterate through the result set from Step 2, converting each record into a uniform timeline entry format. Each entry must contain at least three common fields: timestamp (either the approval time `review_time` or the application time `create_time`), event type (set to "Temporary Credit Approval"), and event summary (generated by concatenation, e.g., "Application for Temporary Credit of 5 Million Yuan - Approved"). Assign a globally unique composite key `_key` to each entry, in the format `"temp_" + record primary key ID`.

[0071] Step 5 (Merging and Sorting): Merge the two sets of entries generated in Step 3 and Step 4 into a single list, sort them in descending order by the timestamp field value (the newest record is at the top), and return the list to the front end to be rendered as a unified audit timeline view.

[0072] Step 6 (Filtering Support): Provides optional year-based filtering parameters and event-type filtering parameters. Year-based filtering applies conditions to the year fields of both tables at the database query level (SQL WHERE clause). Event-type filtering determines whether to query only data source A, only data source B, or both. The filtering logic executes at the database level, not the application level, ensuring that only records meeting the conditions are returned in scenarios with large datasets.

[0073] Figure 7 This is a flowchart of the timeline fusion algorithm for dual-source heterogeneous audit data. The diagram shows the complete process of two parallel data acquisition paths (CustomerCreditLog query and TempCreditApproval query) → converting each into timeline entries in a unified format (including timestamp, event type, event summary, and composite key) → merging the lists → sorting by timestamp in descending order → outputting a unified timeline.

[0074] The technical significance of the composite key design in this application is that assigning a composite key with a source prefix ("credit_xxx" and "temp_xxx") to each entry solves the following technical problems: ① The primary key IDs of two data sources may overlap (for example, each table has a record with ID=100), and a pure numeric key cannot uniquely identify an entry across the entire timeline; ② The prefix directly carries the source information, and the front end can determine the entry type and render different icons and styles based on the prefix without the need for an additional type field; ③ It supports subsequent expansion—when a third type of data source is added, only a new prefix needs to be defined (such as "contract_xxx"), without affecting the existing logic.

[0075] (vii) Module Six: Contract Access Verification Module, used to perform a triple pre-check process during contract creation, including rating existence verification (hard interception), rating timeliness verification (soft warning), and credit limit adequacy verification (hard interception). Specifically, it includes: 1. Enhanced credit information for customer selectors In the customer dropdown selection box on the contract editing page, the system does not directly use the original customer reference table data. Instead, it calls the credit enhancement interface `get_customers_with_rating()`. This interface, based on the customer reference table, queries the credit rating information and current risk exposure of each customer, and adds the credit-related attributes shown in Table 1 below: Table 1. Credit-related attributes table;

[0076] The front-end controls the option status based on the `can_create_contract` field—customers that cannot be selected are displayed in gray in the drop-down list, with a reason text appended after the option label. Selectable customers are sorted by credit rating (highest rating first), and the rating labels are distinguished by different colors (KEY_A gold, KEY_B blue, QUALITY green, etc.).

[0077] 2. Triple pre-verification when storing contracts When a marketer submits a contract save request, the backend performs a triple check before entering the database transaction: The first layer—credit rating existence verification (hard interception): This query searches the credit rating table using the customer's name as the condition. If no rating record is found (i.e., the customer has not yet established a credit profile), the process immediately terminates, and an HTTP 400 error response is returned to the caller with the error message "This customer has no credit rating record. Please contact the administrator to establish a credit profile." This verification is a hard interception—failure to pass prevents further processing, and subsequent verifications will not be executed.

[0078] The second layer—Rating Expiration Verification (Soft Warning): The RATING_YEAR field in the customer's credit rating record is read and compared with the year portion of the current system date. If they do not match (e.g., the rating year is 2025 while the current year is 2026), the system does not block the processing flow, but adds a warning marker (containing an expiration message and rating year information) to the response data. Upon receiving the warning, the front-end displays a modal confirmation dialog box ("The customer's credit rating (year XXXX) has expired. Do you wish to continue creating the contract?"), requiring manual confirmation from the user to continue. This verification is a soft warning—indicating risk but not forcibly blocking the process.

[0079] The third layer—credit adequacy verification (hard interception): This involves calling the `check_credit_available()` method described in Module 3 to perform a complete credit limit assessment. If the sum of the new contract amount and the current risk exposure exceeds the total available credit limit, the processing flow is immediately terminated, and an HTTP 400 error response is returned to the caller. The response body contains structured credit limit details: base limit, temporary credit limit total, current exposure, contract amount, available balance, and shortfall. Upon receiving this response, the front-end displays the various credit limit data and the shortfall amount as highlighted cards and renders the "Apply for Temporary Credit" button—clicking it redirects to the temporary credit application page, automatically pre-filling the customer's name and the shortfall amount. This verification is a hard interception—failure to pass will prevent further progress.

[0080] The triple verification is performed in the order described above, with subsequent verifications only proceeding after the preceding verification is passed. The design principle of the triple verification is as follows: existence (first level) and sufficiency (third level) are hard interceptions, as these two are directly related to the company's financial risk; timeliness (second level) is a soft warning, because an expired rating does not necessarily mean credit deterioration, but it is necessary to remind operators to pay attention.

[0081] Figure 8 This is a flowchart of a credit assessment-driven, three-tiered pre-verification process for contract access. The flowchart illustrates the three lines of defense after a contract saving request is received: the first tier is a rating existence verification (failure → rejection), the second tier is a rating timeliness verification (failure → warning but allowed to continue), and the third tier is a credit limit adequacy verification (failure → rejection and return of credit limit details), and after passing all verifications, the normal contract saving process begins.

[0082] Based on the above system, this application also proposes a method for customer credit assessment and credit limit management based on multi-level classification and dynamic constraints, such as... Figure 1 As shown in the diagram, this diagram illustrates the complete processing flow from credit rating system construction and configuration loading → customer credit rating maintenance → triple access verification during contract creation → differential constraint rule determination (GENERAL_B constraint / KEY_A dynamic adjustment) → real-time risk exposure calculation and limit approval → temporary credit application creation (including snapshot collection) → approval status machine flow → annual batch clearing → fusion of dual-source audit timelines.

[0083] The specific process of this method is as follows: Step S1: The system constructs a multi-level credit classification system, defining credit rating codes with at least five progressive levels—Key Class A (KEY_A), Key Class B (KEY_B), Quality Class (QUALITY), General Class A (GENERAL_A), and General Class B (GENERAL_B). Each credit rating is associated with a credit limit attribute and a rating year attribute. The mapping relationship between credit rating and credit limit is stored in the system configuration table in a structured data format. During system runtime, the mapping relationship is dynamically parsed through a configuration loading function, supporting the adjustment of the credit limit limit for each level without modifying the code or restarting the service. Step S2: The system implements differentiated contract access constraints based on credit rating. For general B customers, no fixed credit limit is set, but a "first contract only" constraint is implemented. That is, once a customer has any valid contract in the system, they are prohibited from creating any new contracts. For key A customers, a dynamic credit limit adjustment mechanism is implemented. When it is detected that the customer's current risk exposure is lower than both their basic credit limit and the amount of the new contract to be created, the available credit limit used for this verification is automatically adjusted to max(basic credit limit, new contract amount). Step S3: The system calculates the available credit limit for each customer in real time. The formula is: Available credit limit = Basic credit limit + Total amount of temporary credit approved in the current year - Current risk exposure (the sum of new accounts receivable and new contract assets of all valid contracts). When a contract is created, the system performs a pre-qualification check, comparing the sum of the new contract amount and the current risk exposure with the available credit limit. If the conditions are not met, detailed credit limit gap information is returned. Step S4: The system implements multi-role lifecycle management for temporary credit approval—when a marketing role creates an application, the system automatically captures the customer's current accounts receivable balance, contract asset balance, and original credit limit as an application snapshot; the application record flows according to a state machine model of "pending review → approved → cleared" or "pending review → rejected"; only the finance role or administrator role can perform the approval operation; the record after approval enters an immutable state; at the end of the year, the administrator role performs a batch clearing operation to uniformly change all approved temporary credit applications for the year to the cleared state; Step S5: The system merges two heterogeneous data sources, credit rating change logs and temporary credit approval records, into a unified audit timeline. This involves querying the data from both tables, converting each record into a timeline entry in a unified format (each entry must contain at least three common fields: timestamp, event type, and event summary), assigning a globally unique composite key with a source prefix to each entry, and merging them into a single list in descending order of timestamp. Multi-dimensional filtering by year and event type is also supported. Step S6: In the contract creation process, the system performs a credit assessment-driven triple pre-verification: the first verification is the existence of the customer's credit rating (if there is no rating, creation is rejected); the second verification is the timeliness of the rating (if the rating year is not the current year, a warning is issued but the process is allowed to continue); and the third verification is the sufficiency of the available credit limit (if the credit limit is insufficient, creation is rejected and the credit limit details and the shortfall amount are returned). Example 1

[0084] This embodiment uses the actual business scenario of a coal mining equipment manufacturing enterprise as an example to illustrate the specific implementation of this application.

[0085] 1. System Deployment and Technology Stack The system is deployed in an enterprise intranet environment based on a B / S architecture. The backend uses Python programming language combined with the FastAPI web framework to build RESTful API services, interacting with the database through the SQLAlchemy ORM framework. The frontend uses the Vue 3 framework combined with the Ant Design Vue 4.x component library to build a single-page application (SPA), with Pinia for state management. Authentication uses the JWT (JSON Web Token) scheme, and user passwords are processed and stored using the BCrypt one-way encryption algorithm. The frontend application is deployed on a web server (default port 80), the backend API service is deployed on an application server (default port 9000), and the database is deployed on a separate database server.

[0086] 2. Initial configuration of the credit rating system (a) Rating mapping table settings in the system configuration table Before the system goes live, the system administrator can enter the value of the CREDIT_RATING_CONFIG key into the REVENUE_CONFIG system configuration table via the configuration management interface or directly from the database. This value is a JSON object that defines five credit ratings and their corresponding credit limits. { "KEY_A": {"limit": 100000000, "label": "Key Class A"}, "KEY_B": {"limit": 80000000, "label": "Key Class B"}, "QUALITY": {"limit": 50000000, "label": "Premium Category"}, "GENERAL_A": {"limit": 20000000, "label": "General Class A"}, "GENERAL_B": {"limit": null, "label": "General Class B"} } After the system starts up, when the first request triggers the credit assessment function, the `load_credit_ratings_from_config()` function reads the JSON string from the REVENUE_CONFIG table, calls the JSON parser to convert it into a Python dictionary object, and caches it in memory for use by subsequent requests.

[0087] When enterprise management decides to adjust its credit policy—for example, increasing the limit for KEY_A from 100 million to 120 million—the administrator only needs to update the JSON value of the corresponding key in the configuration table (changing "limit": 100000000 to "limit":120000000). The system rereads the configuration in the next API request, and the new limit value takes effect immediately. The entire process requires no code modification, no service restart, and no redeployment.

[0088] (ii) Customer credit rating entry The system administrator accesses the Customer Credit Rating Management Page (CustomerCreditView), which contains two main areas: a credit rating table and a rating editing drawer. The rating table displays all rated customers, with each row showing: customer name, credit rating (presented with color labels—KEY_A gold, KEY_B blue, QUALITY green, GENERAL_A gray, GENERAL_B red), credit limit (numerical formatted display; GENERAL_B displays "No upper limit (first contract only)"), rating year, and whether it has expired (expired is marked with a red warning label).

[0089] After the administrator clicks "Add Rating" or the "Edit" button for a row, an editing drawer slides out on the right. The drawer contains: a customer name dropdown selection box (filtering already rated customers to avoid duplicates), a credit rating dropdown selection box (five options), and a rating year selector. When the administrator selects a credit rating, the credit limit input box automatically fills in the default value according to the mapping relationship in the configuration table—selecting KEY_A automatically fills in 100 million, while selecting GENERAL_B grays out the limit box and displays the message "No fixed limit set, only for the first contract." The administrator can manually modify the automatically filled limit value (for special cases) or retain the default value.

[0090] When saving rating records, the system triggers field-level audit log recording—using a four-step method of "snapshot before change → snapshot after change → field-by-field comparison → difference writing" to completely record each change in rating level, amount, and year in the CustomerCreditLog table.

[0091] 3. Credit access verification during contract creation (complete process example) The following example, using a specific contract creation scenario, demonstrates the complete credit access verification process for this application.

[0092] Scene setting: -Marketing staff member "Zhang San" (role: marketing) is preparing to create a contract for a client "a mining group"; - Contract amount: 60 million yuan; - This customer's credit rating: QUALITY, basic credit limit of 50 million yuan, rating year 2026; - This customer currently has one contract in progress: the contract amount is 30 million yuan, NEW_AR is 27 million yuan, and NEW_CA is 300,000 yuan; - Current risk exposure = 27 million + 300,000 = 27.3 million yuan; - This customer has no approved temporary credit line for the current year.

[0093] Verification process: Step 1 (Customer Selection Stage – Enhanced Front-End Credit Information): Marketing personnel "Zhang San" clicks the customer dropdown selection box on the contract editing page. The front end calls the ` / api / customers / with-rating` interface, and the back end executes the `get_customers_with_rating()` method to attach credit information for each customer before returning the result.

[0094] The data returned by "a certain mining group" includes: - credit_rating: "QUALITY"; - credit_limit: 50000000; - total_credit_amount: 50,000,000 (base 50 million + temporary 0 = 50 million); - current_exposure: 27300000; - can_create_contract: true; - is_expired: false.

[0095] Because can_create_contract is true, this customer is selectable in the drop-down list, and their credit rating is displayed in green with the label "Premium".

[0096] Step Two (Contract Preservation Stage – First Verification: Existence Rating): After Zhang San filled in the basic contract information (contract amount 60 million yuan) and payment terms, he clicked "Save". Before entering the database transaction, the backend first queried the credit rating table using the customer name "a certain mining group". One rating record was found – the first layer of verification passed.

[0097] Step 3 (Second Verification: Rating Timeliness): The RATING_YEAR field value of the rating record is 2026. The current system date is 2026, and the year matches—the second verification passes, and no warning needs to be displayed.

[0098] Step Four (Third Verification: Credit Limit Adequacy): The system performs a quota verification: 1. The credit rating is QUALITY (not KEY_A), which does not trigger dynamic credit limit increase logic, and the effective basic credit limit is 50 million.

[0099] 2. Calling `_get_temp_credit_map()` to query the temporary credit lines approved in the current year (2026) returns an empty result, with the total temporary credit limit being 0.

[0100] 3. total_available = 50 million + 0 = 50 million.

[0101] 4. Current risk exposure = 27.3 million.

[0102] 5. The expected total exposure after the signing of the new contract = 27.3 million + 60 million = 87.3 million.

[0103] 6. 87.3 million > 50 million — Third verification failed.

[0104] The backend returned an HTTP 400 error, and the response body contained: { "detail": "Insufficient available credit", "base_limit": 50000000, "temp_credit_total": 0, "current_exposure": 27300000, "contract_amount": 60000000, "available_balance": 22700000, "shortfall": 37300000 } After receiving this response, the front-end will display a "limit insufficient" message card in a visual manner. - Total available quota: 50 million yuan; - Current open interest: RMB 27.3 million; - Available balance: 22.7 million yuan; - Contract amount: 60 million yuan; - **Quota shortfall: 37.3 million yuan**.

[0105] The bottom of the card displays a "Apply for Temporary Credit" button. When "Zhang San" clicks this button, the system redirects to the temporary credit application page, which automatically pre-fills the client's name "a certain mining group" and the application amount "37,300,000" (the shortfall amount).

[0106] 4. Example of the complete lifecycle of temporary credit approval 4.1 Marketing personnel apply for temporary credit lines On the temporary credit application page, "Zhang San" confirmed the automatically pre-filled customer name and application amount (37.3 million yuan), added the reason for the application: "This customer is a key customer to be developed this year. The existing contract is being executed well. A new contract needs to be signed, but the fixed amount is insufficient," and clicked submit.

[0107] After receiving the request, the backend service performs the following snapshot collection operations: - Query the sum of NEW_AR of all valid contracts of "a certain mining group" → 27 million yuan, and write it into the CURRENT_AR field; - Query the sum of NEW_CA of all valid contracts of "a certain mining group" → 300,000 yuan, and write it into the CURRENT_CA field; - Read the CREDIT_LIMIT from the credit rating record of "a certain mining group" to 50 million yuan and write it into the ORIGINAL_LIMIT field; - Set APPLY_YEAR=2026, STATUS="Pending review".

[0108] After the application record is successfully saved, a new record will be added to the "Pending Review" list on the system's front-end temporary credit approval page (TempCreditApprovalView).

[0109] 4.2 Approval by finance personnel The finance staff member "Li Si" (role: finance) logs into the system and enters the temporary credit approval page. On the "Pending Review" tab, he sees Zhang San's application and clicks to view details.

[0110] Details panel display: - Customer Name: A mining group; - Credit rating: QUALITY (Excellent); - Initial credit line: 50 million yuan; - **Snapshot data at the time of application**: Current AR balance: 27 million yuan; Current CA balance: 300,000 yuan; - Requested amount: 37.3 million yuan; - Reason for application: (Explanation text filled in by Zhang San); - Quota Gap Analysis: Contracts of 60 million + Existing exposure of 27.3 million - Basic quota of 50 million = Gap of 37.3 million.

[0111] After reviewing the application, "Li Si" determined that the client's cooperation was indeed good and the risks were controllable, and clicked the "Approved" button. The system updated the application status to "Approved" and recorded REVIEWER="Li Si", REVIEW_TIME=current time, and REVIEW_REMARK="Agreed, the client's cooperation is good".

[0112] At this time, the customer's available credit limit changes dynamically: - Basic credit limit: 50 million; - Approved temporary credit line: 37.3 million (including this newly approved application); - Total amount: 87.3 million; - Current exposure: 27.3 million; - Available balance: 60 million; - New contract amount of 60 million - Credit limit verification passed! 4.3, "Zhang San" resubmits the contract. After "Zhang San"'s temporary credit application was approved, he returned to the contract editing page and clicked save again. In this third level of credit limit verification, total_available = 50 million + 37.3 million = 87.3 million, expected total exposure = 27.3 million + 60 million = 87.3 million, 87.3 million ≤ 87.3 million - verification passed. The contract was saved successfully.

[0113] 4.4 Year-end batch reset After the end of fiscal year 2026, the administrator will execute the `batch_clear(2026)` operation in January 2027. The system will query all temporary credit records with APPLY_YEAR=2026 and STATUS="approved" (including the 37.3 million yuan approved by Li Si for a certain mining group) and update their status to "cleared".

[0114] Upon entering 2027, when the system recalculates the available credit limit for "a certain mining group," the `_get_temp_credit_map()` function queries with APPLY_YEAR=2027 and STATUS="approved" as conditions. The 37.3 million record from 2026, which had been cleared, will not be included—the client's temporary credit limit will be reset to zero, and the total limit will revert to the basic limit of 50 million yuan. If the client has new large-scale contract needs in 2027, they will need to reapply for temporary credit.

[0115] 5. Specific examples of differentiated constraint mechanisms Example 1: GENERAL_B customer's "First Contract Only" constraint The credit rating of the customer, "a small trading company", is GENERAL_B (general category B), with a rating year of 2026.

[0116] Marketing staff member "Wang Wu" attempted to create a new contract for the client. In the client dropdown menu, the option "A Small Trading Company" was grayed out, with a note next to it stating "First contract only (1 contract already exists)," making it unselectable.

[0117] If "Wang Wu" submits a contract saving request with "a small trading company" as the customer through other means (such as directly calling the API), the backend performs constraint verification in the contract saving service: query records in the REVENUE_CONTRACT table where CUSTOMER_NAME = "a small trading company" and IS_DELETED = 0, and 1 record is returned. The verification result is can_create = false, the backend rejects the saving, and returns an error "The credit rating of this customer is general class B, only one contract is allowed to be created".

[0118] Example 2: Dynamic credit limit increase for KEY_A customer The credit rating of the customer "a large mining group" is KEY_A (key class A), with a base credit limit of 100 million yuan.

[0119] Current status: - There is already one contract under execution, NEW_AR = 30 million yuan, NEW_CA = 300,000 yuan; - Current risk exposure = 30.3 million yuan; The marketing personnel intends to create a new contract with a contract amount of 80 million yuan.

[0120] The system judges during credit limit verification: - current_exposure (30.3 million) < base_limit (100 million) —— Condition 1 is satisfied; - current_exposure (30.3 million) < contract_amount (80 million) —— Condition 2 is satisfied; - Trigger dynamic increase: effective verification credit limit = max (100 million, 80 million) = 100 million; Expected total exposure of the new contract = 30.3 million + 80 million = 110.3 million.

[0121] If following the original logic of fixed credit limit: the expected total exposure of 110.3 million > the base credit limit of 100 million, the verification fails. But under the dynamic increase logic, the effective verification credit limit is set to 100 million. Here, the system judges that — although the expected total exposure slightly exceeds the base credit limit, the excess is not large (exceeding 10.3 million), and the customer's current risk exposure is far lower than the base credit limit, which is normal business fluctuation for strategic customers, so the contract is allowed to be created.

[0122] 6. Practical example of dual-source audit timeline fusion Auditors need to review the complete credit evolution history of the customer "a mining group". The system calls the `get_credit_logs("a mining group")` method, which internally performs the following operations: Two rating change records were found in the CustomerCreditLog table: 2025-03-15: Initial rating - GENERAL_A, credit limit 20 million, year 2025 (operator: administrator); 2026-01-10: Rating upgrade - QUALITY, credit limit 50 million, annual period 2026 (operator: administrator); A temporary credit record was found in the TempCreditApproval table: 2026-06-22: Application for 37.3 million yuan – Approved (Reviewer: Li Si) The fusion algorithm converts the above three records into a unified format as shown in Table 2 below: Table 2. Record formatting guidelines;

[0123] After being sorted in descending order by timestamp, the front end renders a unified timeline view, with the three records arranged vertically in a timeline format. Different event types are distinguished by different colored icons (rating changes are represented by blue dots, and temporary credit lines by orange diamonds). Auditors can obtain a complete timeline of the customer's credit status evolution within seconds.

[0124] 7. Verification of the beneficial effects of this embodiment In this embodiment, the system has been running stably in an enterprise intranet environment. Actual usage has verified the following beneficial effects: Regarding credit access verification: Previously, when contracts were created, credit rating notes in the customer list were manually checked, which could easily lead to overlooking cases of insufficient credit limits or expired ratings; after using this system, triple pre-verification is automatically executed when the contract is saved, and existence and credit limit verification are rigidly intercepted, eliminating the risk of over-limit and over-level contract signing from a technical perspective.

[0125] For temporary credit approval: Previously, it usually took 1-3 business days from when the marketing staff discovered the insufficient credit limit, wrote an email application, and received approval from the leader to final confirmation; after using this system, the average time from application submission to approval completion is no more than 2 hours, and the approver can see the risk exposure snapshot data at the time of application at the same time, making the decision-making basis fully transparent.

[0126] Regarding audit traceability: Previously, auditors needed to check Excel ledgers (credit rating) and email archives (temporary credit approval) separately, and it usually took half a day to integrate a complete picture of a customer's credit. After using this system, a complete credit evolution record can be obtained in 1 minute through a unified timeline view.

[0127] Regarding differentiated constraints: GENERAL_B's "first contract only" mechanism successfully blocked multiple operations that repeatedly created contracts for high-risk customers after the system went live; KEY_A's dynamic limit adjustment mechanism provided flexible limit adaptation space for large contracts of strategic customers, avoiding the loss of business opportunities due to insufficient fixed limits.

[0128] This application utilizes technologies such as a multi-level credit classification and configurable rating system, risk-level-based differentiated contract access constraints, real-time risk exposure calculation and dynamic credit limit determination, multi-role lifecycle management of temporary credit approval, timeline fusion of dual-source heterogeneous audit data, and credit assessment-driven pre-entry verification of contracts to achieve full-process automation, refinement, and traceability of customer credit management for manufacturing enterprises. This customer credit management encompasses credit rating assessment, dynamic credit limit determination, temporary credit approval, risk exposure monitoring, and credit change auditing.

[0129] A specific embodiment of this application provides a computer device comprising: a memory and a processor, wherein the memory stores instructions executable on the processor. When the processor executes the instructions, it implements the methods described in the above embodiments. The number of memories and processors can be one or more. This computer device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The computer device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown in this application, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application as described and / or claimed herein.

[0130] The computer device may also include a communication interface for communicating with external devices and exchanging data. The devices are interconnected using different buses and can be mounted on a common motherboard or otherwise installed as needed. The processor processes instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as a display device coupled to the interface). In other embodiments, multiple processors and / or multiple buses can be used with multiple memories, if desired. Similarly, multiple electronic devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). The bus can be divided into address buses, data buses, control buses, etc.

[0131] Optionally, in a specific implementation, if the memory, processor, and communication interface are integrated on a single chip, then the memory, processor, and communication interface can communicate with each other through an internal interface.

[0132] It should be understood that the aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. General-purpose processors can be microprocessors or any conventional processor. It is worth noting that the processor can be a processor supporting advanced RISC machines (ARM) architecture.

[0133] This application provides a computer-readable storage medium (such as the memory described above) that stores computer instructions, which, when executed by a processor, implement the method provided in this application.

[0134] Optionally, the memory may include a stored program area and a stored data area, wherein the stored program area may store the operating system and application programs required for at least one function; the stored data area may store data created based on the use of the computer device for mapping. Furthermore, the memory may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory may optionally include memory remotely located relative to the processor, which can be connected to the computer device for mapping via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0135] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A customer credit assessment and credit management method based on multi-level classification and dynamic constraints, characterized in that: Includes the following steps: Step S1: Construct a multi-level credit classification system, defining customer credit rating codes with at least five progressive levels—Key Category A, Key Category B, Excellent Category, General Category A, and General Category B; each credit rating is associated with credit limit attributes and rating year attributes; Step S2: Implement differentiated contract access constraints based on credit rating—For general Class B customers, no fixed upper limit is set for the credit limit, but a "first contract only" constraint is implemented, meaning that once the customer has any valid contract in the system, they are prohibited from creating any new contracts; For key Class A customers, a dynamic credit limit adjustment mechanism is implemented. When it is detected that the customer's current risk exposure is lower than both their basic credit limit and the amount of the new contract to be created, the available credit limit used for this verification is automatically adjusted to max(basic credit limit, new contract amount). Step S3: Calculate the available credit line for each customer in real time. Available credit line = basic credit line + total amount of temporary credit lines approved in the current year - current risk exposure, where the current risk exposure is the sum of new accounts receivable and new contract assets of all valid contracts. When the contract is created, a pre-approval limit check is performed, comparing the sum of the new contract amount and the current risk exposure with the available credit limit. If the conditions are not met, detailed information on the credit limit gap is returned. Step S4: Multi-role lifecycle management of temporary credit approval—When a marketing role creates an application, the system automatically captures the customer's current accounts receivable balance, contract asset balance, and original credit limit as a snapshot of the application; the application record flows according to a state machine model of "pending review → approved → cleared" or "pending review → rejected"; only the finance role or the administrator role can perform the approval operation; the record after approval enters an immutable state; at the end of the year, the administrator role performs a batch clearing operation to uniformly change all approved temporary credit applications of the year to the cleared state; Step S5: Integrate the two heterogeneous data sources, credit rating change logs and temporary credit approval records, into a unified audit timeline; Step S6: In the contract creation process, perform a credit assessment-driven triple pre-verification: the first verifies the existence of the customer's credit rating, the second verifies the timeliness of the rating, and the third verifies the adequacy of the available credit limit.

2. The customer credit assessment and credit management method based on multi-level classification and dynamic constraints according to claim 1, characterized in that: Key Category A customers are core clients with long-term strategic partnerships with the company. They have the highest associated fixed credit limits and support a dynamic credit limit adjustment mechanism. Key Category B customers are important clients with stable cooperative relationships with the company, and their associated fixed credit limit is lower than that of Key Category A customers; Premium customers are ordinary customers with good credit records, and their associated fixed credit limit is lower than that of key B customers. General Category A customers are ordinary customers with average credit records, and their associated fixed credit limit is lower than that of premium category customers. Generally, Category B customers are marginal customers with limited credit history or certain risk signals. They are not associated with a fixed credit limit and are subject to the restriction that the number of contracts is limited to the first contract. Furthermore, the mapping relationship between credit rating codes and credit limit values ​​is stored in the database system configuration table in JSON format.

3. A customer credit assessment and credit management method based on multi-level classification and dynamic constraints according to claim 1 or 2, characterized in that: The steps of the dynamic credit limit increase mechanism for key Category A customers include: Step (2a): Calculate the current risk exposure of the customer through aggregate query; Step (2b): Read the basic credit limit from the customer's credit rating record; Step (2c): Obtain the contract amount for the proposed new contract; Step (2d): Perform a dual-condition judgment - if the current risk exposure does not exceed the basic limit and the current risk exposure is lower than the new contract amount, then it is determined that the customer's current available space is insufficient but the overall risk is within a controllable range. Step (2e): Under this condition, set the available credit limit used for this contract creation verification to max(base credit limit, new contract amount) so that the new contract amount can be covered by a sufficiently large verification credit limit value, thereby passing the credit limit verification. Step (2f): The adjusted credit limit value is only used as a temporary variable in the calculation process of this verification. It does not modify the credit limit field that is persistently stored in the database for the customer, does not change its credit rating record, and does not create a credit limit amplification effect on other concurrent contract creation requests.

4. The customer credit assessment and credit management method based on multi-level classification and dynamic constraints according to claim 1, characterized in that: The specific steps for calculating the available credit limit include: Step (3a) Read the credit rating code and basic credit limit field value of the customer from the customer credit rating table. If the rating is general category B, the basic credit limit is considered empty. Step (3b) calls the temporary credit aggregation function to query all records in the temporary credit approval table whose status is "approved" and whose application year is equal to the current year, using the customer name and the current year as the filter conditions. The application amount fields are summed to obtain the total approved temporary credit amount. Step (3c) calculates the customer's current risk exposure through aggregated query, iterates through the new accounts receivable and new contract asset fields of all its valid contracts and sums them; Step (3d) Calculate the available credit limit = base credit limit + total approved temporary credit limit - current risk exposure; if the base credit limit is empty, the current risk exposure value will be used as the dynamic credit limit for this customer. In step (3e), during the pre-contract creation verification, it is determined whether the condition "new contract amount + current risk exposure ≤ basic credit limit + approved temporary credit limit total amount" is true. If not true, a structured credit limit shortage information is returned to the caller, which includes at least five data items: basic credit limit, total temporary credit limit, used exposure, available balance and credit limit gap amount.

5. The customer credit assessment and credit management method based on multi-level classification and dynamic constraints according to claim 1, characterized in that: The steps to integrate two heterogeneous data sources, credit rating change logs and temporary credit approval records, into a unified audit timeline include: The first step is to query the primary data source: using the customer's name as the condition, query all rating change records of that customer from the credit rating change log table, and sort them by the change time; The second step is to query the second data source: using the customer's name as the condition, query all temporary credit records of the customer from the temporary credit approval record table, and sort them by creation time / approval time. The third step is to format the first data source: traverse the result set from the first step, convert each record into a uniform timeline entry format, with each entry containing at least three common fields: timestamp of the change time field, event type of the rating change, concatenated rating, and event summary describing the changes in credit limit and year; and assign a globally unique composite key to each entry, in the format of "credit_" plus the primary key ID of that record; Step 4, second data source formatting: Traverse the result set of step 2, convert each record into a uniform timeline entry format, and each entry should contain at least three common fields: timestamp of approval time or creation time field, event type of temporary credit approval, event summary of application amount and approval status description, and assign a globally unique composite key to each entry, in the format of "temp_" plus the primary key ID of the record; Step 5, Merge and sort: Merge the two sets of entries generated in steps 3 and 4 into a single list, sorted in descending order by the value of the timestamp field; Step 6: Filtering support; provides optional filtering parameters by year and event type, with the filtering logic executed at the database query level.

6. The customer credit assessment and credit management method based on multi-level classification and dynamic constraints according to claim 1, characterized in that: The specific implementation steps of the credit assessment-driven triple pre-verification include: The first layer—a hard-line interception of the credit rating existence check: Before the contract save request enters the business processing logic, the credit rating table is queried based on the customer's name; if no rating record is found, the processing flow is terminated and an error response is returned to the caller. If this re-check fails, the following steps are not allowed to continue. The second layer—a rating timeliness check as a soft warning: read the rating year field in the customer's credit rating record and compare it with the current date year; if the two are inconsistent, return a warning-level response to the caller, but do not prevent the contract saving process from continuing, and the user confirms whether to continue; The third layer—a hard-line interception of credit adequacy verification: The available credit limit calculation method in step S3 is invoked, and the sum of the new contract amount and the current risk exposure is compared with the total available credit limit; if the former is greater than the latter, the processing flow is terminated, and detailed structured information on insufficient credit limit is returned to the caller, including at least: basic credit limit, total temporary credit limit, current used exposure, current contract amount, available balance, and credit limit shortfall amount; The triple checks are performed in the order described above. Each check proceeds only after the previous check passes. If any hard-block check fails, the process is terminated immediately and an error is returned.

7. The customer credit assessment and credit management method based on multi-level classification and dynamic constraints according to claim 1, characterized in that: The method also includes the following credit assessment data maintenance mechanism: (a) The creation, modification and deletion of each credit rating record triggers field-level audit log recording. The log is generated using a four-step method: "snapshot before change → snapshot after change → field-by-field comparison → difference writing". The log structure includes at least the changed table name, changed record ID, changed field name, old value, new value, change type, operator and operation time. (b) When credit rating data changes, a rating year verification interface is provided to the contract management module. This rating year verification interface returns whether the rating of the specified customer belongs to the current year, which can be called by the contract creation and editing process. (c) Through the comprehensive credit query interface for customers, return comprehensive information for each customer, including credit rating code, basic credit limit, total approved temporary credit limit, total available credit limit, current risk exposure, whether the rating has expired, and whether a contract can be created, for use by the customer selector and contract list page in the contract creation process.

8. A customer credit assessment and credit granting management system based on multi-level classification and dynamic constraints, characterized in that: include: The credit rating classification module is used to maintain credit rating codes of at least five progressive levels and their associated credit limit attributes, and realizes dynamic configurability of credit rating and credit limit through a mapping relationship driven by database configuration tables. The differentiated constraint enforcement module is used to implement differentiated contract access constraints for customers with different credit ratings—for general Class B customers, a quantity constraint of "limited to the first contract only" is enforced, and for key Class A customers, a dynamic limit increase is enforced based on the comparison between the current risk exposure and the amount of the new contract. The real-time credit limit assessment module aggregates three elements: the basic credit limit, the total approved temporary credit limit, and the current risk exposure. It calculates the available credit limit for each customer in real time and performs pre-credit limit verification when the contract is created. The temporary credit approval module is used to manage the entire lifecycle of temporary credit applications from creation and approval to annual batch clearing, and to implement operational permission isolation between marketing roles and finance / administrator roles; The dual-source audit fusion module is used to convert two heterogeneous data sources, credit rating change logs and temporary credit approval records, into a unified format and merge them into a single audit timeline sorted by time. The contract access verification module is used to perform three pre-checks in the contract creation process: rating existence verification, rating timeliness verification, and credit adequacy verification.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1-7.

10. A computer-readable storage medium having a computer program / instructions stored thereon, characterized in that: When the computer program / instructions are executed by the processor, they implement the steps of the method according to any one of claims 1-7.