Data management method and device, equipment, storage medium and program product
By allowing third-party objects to customize the configuration of third-party interfaces, the problem of insufficient support for external user data access is solved, personalized data query for different needs is realized, and user experience and business expansion capabilities are improved.
Patent Information
- Application Number
- CN202411896701.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-04-25
AI Technical Summary
The existing energy management system does not support data access to external users, and third-party partners or customers with data access needs cannot directly access the system or obtain system data through standard means.
Provides a data management method, allowing third-party objects to customize the configuration of third-party interfaces, obtain data in the energy management system and feed it back to third-party objects based on the received interface configuration requests and call requests.
It realizes the query of data from third-party objects on the energy management system, meets the personalized data query needs of different third-party objects, improves user experience, and is conducive to expanding business.
Smart Images

Figure CN119884220A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of data management technology, and in particular, relates to a data management method, a data management device, a computer device, a computer-readable storage medium, and a computer program product. Background Art
[0002] At present, the Energy Management System (EMS) has made significant progress in the use of internal users. Internal users can directly use the system functions to obtain various data indicators, which is crucial for the operation and management of the platform. However, there is a clear lack of support for external users. External users cannot directly access the system, nor can they obtain system data through standard means. This is a major pain point for third-party partners or customers with data access needs. Summary of the invention
[0003] The present application aims to solve at least one of the technical problems existing in the prior art. To this end, the present application proposes a data management method, a data management device, a computer device, a computer-readable storage medium, and a computer program product, which can customize a third-party interface based on the needs of a third-party object to meet the customized data query needs of the third-party object.
[0004] In a first aspect, the present application provides a data management method, comprising receiving an interface configuration request sent by a third-party object, the interface configuration request including configuration information input by the third-party object; configuring a third-party interface corresponding to the third-party object based on the configuration information; and upon receiving an interface call request from the third-party object, obtaining corresponding data in the energy management system based on the called third-party interface, and feeding back the data to the third-party object.
[0005] In some embodiments, the third-party interface includes a real-time data query interface for a device, the configuration information includes a target device and a target data point, the target device includes an energy storage device connected to the energy management system, the target data point includes one or more of the data points preset by the energy management system, and the third-party interface based on the call obtains the corresponding data in the energy management system and feeds it back to the third-party object, including:
[0006] Acquire target real-time data corresponding to the target data point, and feed back the target real-time data to the third-party object.
[0007] In some embodiments, the third-party interface includes a device historical trend data query interface, the configuration information includes a target period, a target device, and a target data point, and the third-party interface based on the call obtains the corresponding data in the energy management system and feeds it back to the third-party object, including:
[0008] Target historical data corresponding to the target data point and collected during the target period is acquired, and the target historical data is fed back to the third-party object.
[0009] In some embodiments, the third-party interface includes a message subscription interface, the configuration information includes an update frequency, a target data point, and a server address, and the method further includes forwarding the data of the target data point to the server address of the third-party object based on the update frequency.
[0010] In some embodiments, the method also includes monitoring the number of interface requests of the third-party object; when the number of interface requests within the current monitoring window reaches a first preset number, stopping responding to the interface call request of the third-party object within the current monitoring window, and the current monitoring window is any one of a plurality of monitoring windows obtained by dividing based on a preset time length.
[0011] In some embodiments, the method also includes monitoring the number of calls made by the target object to the target interface, the target object being any of the third-party objects, and the target interface being any of the third-party interfaces; when the number of calls within a current monitoring window reaches a second preset number, stopping responding to the interface call request made by the target object to the target interface within the current monitoring window, and the current monitoring window being any of a plurality of monitoring windows obtained by dividing based on a preset time length.
[0012] In some embodiments, the method further includes storing at least one of the configuration information of the third-party interface, the interface call request, the number of interface requests of the third-party object, and the number of calls of the third-party interface in the memory database and / or the local database.
[0013] In some embodiments, the method further includes synchronizing the data of the memory database and the local database based on a preset period; or updating the memory database and the local database based on the changed configuration information of the third-party interface when the third-party interface of the third-party object changes.
[0014] In some embodiments, the method further includes setting a data expiration period of the memory database; and deleting stored data in the memory database that has not been called within the data expiration period.
[0015] In some embodiments, the interface call request includes a token, and the token is used for identity authentication. When the interface call request of the third-party object is received, the corresponding data in the energy management system is obtained based on the called third-party interface, and fed back to the third-party object, including:
[0016] When receiving an interface call request from the third-party object, performing identity authentication based on the token;
[0017] After the identity authentication is passed, the corresponding data in the energy management system is obtained based on the called third-party interface and fed back to the third-party object.
[0018] In some embodiments, the method further includes issuing identification information and key information to the third-party object when receiving an interface configuration request sent by the third-party object, and the token is generated based on the identification information and key information.
[0019] In some embodiments, the method also includes configuring access rights to the internal interface, the access rights including the third-party object corresponding to the internal interface; upon receiving an interface call request from the third-party object to call an internal interface allowed within the access rights, the corresponding data in the energy management system is obtained based on the called internal interface and fed back to the third-party object.
[0020] In some embodiments, the method further includes performing anomaly detection on the interface call request of the third-party object, and storing the anomaly information in a system log when an anomaly occurs.
[0021] In a second aspect, the present application provides a data management device, comprising:
[0022] A receiving module, configured to receive an interface configuration request sent by a third-party object, wherein the interface configuration request includes configuration information input by the third-party object;
[0023] A configuration module, configured to configure a third-party interface corresponding to the third-party object based on the configuration information;
[0024] The feedback module is used to obtain corresponding data in the energy management system based on the called third-party interface when receiving an interface call request from the third-party object, and feed back the data to the third-party object.
[0025] In a third aspect, the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned data management method when executing the program.
[0026] In a fourth aspect, the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, which implements the above-mentioned data management method when executed by a processor.
[0027] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the above-mentioned data management method when executed by a processor.
[0028] The data management method, data management device, computer equipment, computer-readable storage medium and computer program product provided by the embodiments of the present application, a third-party object (such as a third-party application or platform) can customize input configuration information (such as the equipment and data to be queried), and send the configuration information to the current system (such as the energy management system of the energy storage system) in the form of an interface configuration request. The current system can generate one or more third-party interfaces corresponding to the third-party object based on the configuration information. When the third-party object needs to query data later, it only needs to send an interface call request to call the corresponding third-party interface, so as to obtain the data corresponding to the third-party interface fed back by the current system. In this way, not only can the third-party object query the data of the current system, but the third-party interface can be customized to meet the personalized data query needs of different third-party objects, and the user experience is good, which is conducive to expanding business. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0030] Figure 1 It is an application scenario diagram of the data management method provided by some embodiments of the present application;
[0031] Figure 2 is a first flow chart of a data management method provided by certain embodiments of the present application;
[0032] Figure 3 is a second flow chart of the data management method provided by certain embodiments of the present application;
[0033] Figure 4 is a third flow chart of a data management method provided in certain embodiments of the present application;
[0034] Figure 5 is a fourth flow chart of a data management method provided in certain embodiments of the present application;
[0035] Figure 6 is a fifth flow chart of a data management method provided in certain embodiments of the present application;
[0036] Figure 7is a sixth flow chart of a data management method provided in certain embodiments of the present application;
[0037] Figure 8 is a seventh flow chart of a data management method provided in certain embodiments of the present application;
[0038] Fig. 9 is a schematic diagram of a module of a data management device provided in some embodiments of the present application; and
[0039] Fig.10 It is a schematic diagram of the structure of a computer device provided in some embodiments of the present application. DETAILED DESCRIPTION
[0040] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be understood as limiting the present application.
[0041] For ease of understanding, the technical background and application scenarios of this application are first introduced below:
[0042] Energy Management System (EMS) is a comprehensive system for monitoring, controlling and optimizing energy usage. EMS is used to manage energy storage systems.
[0043] It integrates advanced information technology, automation technology and energy-related expertise, aiming to help various organizations (such as industrial enterprises, commercial buildings, public institutions, etc.) achieve efficient energy management, thereby reducing energy consumption, improving energy utilization efficiency, reducing energy costs, and promoting sustainable development.
[0044] The energy management system mainly includes perception layer, network layer, platform layer and application layer.
[0045] Perception layer: mainly composed of various sensors and intelligent meters, responsible for the collection and preliminary processing of energy data, and is the data source for the entire energy management system. Taking a power station as an example, the perception layer may include temperature sensors that sense the temperature of energy storage equipment, electrical parameter collectors that collect voltage and current of energy storage equipment, and other sensors that collect operating data of energy storage equipment.
[0046] Network layer: responsible for transmitting the data collected by the perception layer to the data center or monitoring platform. Data transmission can be achieved using wired network (such as Ethernet) or wireless network (such as Wi-Fi, ZigBee, LoRa, etc.) technology.
[0047] Platform layer: It is the core of the energy management system, including functional modules such as data storage, data analysis, and control strategy formulation. Here, the collected data is centrally stored and managed, and in-depth analysis is performed through the data analysis module, and corresponding control strategies are formulated based on the analysis results.
[0048] Application layer: Provides various application functions for different types of users (such as managers, operation and maintenance personnel, energy engineers, etc.), such as energy monitoring report generation, energy control operation interface, energy analysis report viewing, etc., to meet the different needs of users in energy management.
[0049] At present, the application layer is used for internal users, who can easily obtain and analyze various data indicators of power plants and equipment through the standard interface within the energy management system. However, for external users (such as third-party partners), they may have connected power plants and equipment to the energy management system, but they cannot directly access the data they need. They can only obtain it through internal users (such as the legal person object to which the energy management system belongs or the internal employees of the legal person object, etc.) and then forward it, which is not only time-consuming and labor-intensive, but also has a poor user experience. This limitation hinders the ability of external users to obtain real-time operating data and historical data, limiting market expansion and the growth of the customer base.
[0050] To this end, the data management method provided in this application provides a solution for third-party objects (i.e., external users) to customize the configuration of third-party interfaces, so that third-party objects can implement data query by calling third-party interfaces, thereby meeting the personalized data query needs of third-party objects, providing a better user experience and facilitating market expansion and growth of customer base.
[0051] See also Figure 1 , Figure 1 1 is an application scenario diagram of a data management method provided in an embodiment of the present application. The application scenario provided in the present application includes a power station 103, a terminal 101 and a server 102, and the data management method can be executed by at least one of the terminal 101 and the server 102.
[0052] Optionally, the perception layer of the energy management system can be implemented through an Internet of Things device, and the platform layer and the application layer can be set in at least one of the terminal 101 and the server 102.
[0053] The power station 103 is an enterprise unit that uses power generation equipment to convert other forms of energy into electrical energy and uses energy storage equipment to store electrical energy, such as a hydroelectric power station, a thermal power station, a photovoltaic power station, a pumped storage power station, etc.
[0054] The power station 103 includes an energy storage device 1031. The energy storage device 1031 refers to a device that can store energy and release the stored energy for use when needed. For example, the energy storage device 1031 may be an energy storage cabinet. An Internet of Things device is provided in the energy storage cabinet to realize the perception of relevant information of the energy storage device.
[0055] Among them, IoT devices (mainly used in the perception layer):
[0056] Smart meters, robots, sensor devices (such as temperature sensors, humidity sensors, light sensors, etc.), actuator devices (smart light bulbs, smart sockets, electronic locks, etc.), embedded devices (smart TVs, smart speakers, smart refrigerators, etc.), etc., are not limited to this embodiment of the present application.
[0057] The terminal 101 (which can be used in the platform layer and the application layer) may include but is not limited to:
[0058] Smart phones (such as Android phones, IOS phones, etc.), tablet computers, laptop computers, desktop computers, mobile Internet devices (Mobile Internet Devices, referred to as MID), etc., are not limited to this embodiment of the present application.
[0059] In some embodiments, the power station further includes a gateway 1032. The gateway 1032 can be used to implement communication between the terminal 101 and the server 102, and between the energy storage device 1031 and the server 102.
[0060] A gateway 1032 is a network device or software application that acts as a connection point and converter between different networks. The main function of a gateway is to enable different types of networks to communicate with each other. For example, it can connect a local area network (LAN) to the Internet, or connect two networks using different protocols.
[0061] The terminal 101 may be integrated with a client, which may be a client having the function of displaying data information such as text, images, audio, and video, such as a client for implementing control of the energy storage device 1031, which is not limited here.
[0062] Server 102 can be an independent physical server 102, or a server 102 cluster or distributed system composed of multiple physical servers 102, or a cloud server 102 that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms, but the embodiments of the present application do not limit this.
[0063] It should be noted that Figure 1 The number of terminals 101, servers 102, and power stations 103 is only used as an example, and the number of terminals 101, servers 102, and power stations 103 can also be more or less, which is not limited here. The terminal 101, server 102, and power station 106 can be directly or indirectly connected through wired (such as the connection between a local server and the power station 106) or wireless communication (such as the connection between a cloud server and the power station 106), which is not limited in this application.
[0064] The data management method involved in this application can be implemented based on cloud technology.
[0065] Among them, cloud technology refers to a hosting technology that unifies hardware, software, network and other resources within a wide area network or local area network to achieve data calculation, storage, processing and sharing.
[0066] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool, which can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The backend services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites. With the rapid development and application of the Internet industry, in the future, each item may have its own identification mark, which needs to be transmitted to the backend system for logical processing. Data of different levels will be processed separately. All kinds of industry data need strong system backing support, which can only be achieved through cloud computing.
[0067] The data management method of the present application can be implemented based on cloud computing. Cloud computing is a computing model that distributes computing tasks on a resource pool composed of a large number of computers, so that various application systems can obtain computing power, storage space and information services as needed. The network that provides resources is called a "cloud". The resources in the "cloud" are infinitely expandable in the eyes of users, and can be obtained at any time, used on demand, expanded at any time, and paid for by use.
[0068] As a provider of basic cloud computing capabilities, a cloud computing resource pool (referred to as a cloud platform, generally referred to as an IaaS (Infrastructure as a Service) platform) will be established, and various types of virtual resources will be deployed in the resource pool for external customers to choose to use. The cloud computing resource pool mainly includes: computing devices (virtualized machines, including operating systems), storage devices, and network devices.
[0069] The data management method in the embodiment of the present application can be executed by a computer device, which may include at least one of a server 102 and a terminal 101, that is, the method can be executed by the server 102 or the terminal 101 alone, or by the server 102 and the terminal 101 together. Therefore, the execution subject of each step will not be repeatedly described below.
[0070] It should be noted that in the example of the data management method below, the server 102 executing the data management method is used as an example for explanation. Those skilled in the art, based on their understanding of the following text, may apply the data management method provided in the embodiment of the present application to other types of scenarios (such as the terminal 101 executing the data management method, or the terminal 101 cooperating with the server 102 to jointly execute the data management method).
[0071] Based on the introduction of the above-mentioned related scenarios, the embodiment of the present application provides a data management method, which is described in detail below:
[0072] See also Figure 2 A data management method provided in an embodiment of the present application is implemented by steps 011 to 013, which are described in detail below.
[0073] Step 011: receiving an interface configuration request sent by a third-party object, where the interface configuration request includes configuration information input by the third-party object.
[0074] Among them, third-party objects refer to external users other than internal users of the energy management system (such as third-party partners or customers who have not purchased the system). Compared with internal users who can directly call the standard interface of the energy management system to query various data, third-party objects do not have a directly callable interface to query data.
[0075] In order to meet the data query needs of third-party objects, the function of third-party objects to configure third-party interfaces can be provided. For example, the data platform of the energy management system can provide the configuration function of third-party interfaces. Third-party objects can log in to the data platform through their own third-party applications, and configure the third-party interfaces of the third-party objects in the interface configuration interface of the data platform, thereby obtaining the configuration information input by the third-party objects through the interface configuration interface.
[0076] After the third-party object configuration is completed (such as the third-party object clicks the configuration button in the interface configuration interface), an interface configuration request will be received. The interface configuration request includes the configuration information entered by the third-party object to facilitate the data platform to subsequently configure the third-party interface based on the interface configuration request.
[0077] Step 012: Based on the configuration information, configure the third-party interface corresponding to the third-party object.
[0078] Among them, the configuration information may include the equipment, data, etc. that the third-party object wants to query. The configuration information can be specifically configured based on the needs of the third-party object. For example, the third-party object can perform a selection operation in the interface configuration interface to select the required data points from all the data points of the energy management system that can be queried to determine the target data that the third-party object wants to query; or, the third-party object can perform a selection operation in the interface configuration interface to select the equipment to be queried from all the available devices (such as energy storage devices, which are generally devices connected to the energy management system by the third-party object) to determine the target device that the third-party object wants to query.
[0079] It can be understood that the target device may include one or more energy storage devices, such as the target device includes one or more energy storage devices in any power station, or multiple energy storage devices in multiple power stations, which is not limited here.
[0080] The data points of EMS (Energy Management System) refer to specific locations in the energy management system that are used to collect and monitor various energy-related data. These locations can be sensor installation points on physical equipment or logical nodes related to data collection in the software system.
[0081] For example, the preset data points of the energy management system include voltage data points, current data points, power data points, electric energy data points, temperature data points, etc. The target data points can be selected from one or more preset data points based on the actual needs of the third-party object, such as selecting voltage data points, current data points, power data points and temperature data points as the target data points of the third-party object.
[0082] When receiving an interface configuration request sent by a third-party object, the data platform obtains the configuration information input by the third-party object by parsing the interface configuration request. Based on the configuration information, the data platform can quickly configure a third-party interface that meets the needs of the third-party object.
[0083] Optionally, the third-party interface can be a RESTful API (Representational State Transfer API) interface, which uses a standardized RESTful API design and is an architectural style for building network applications based on a set of conventions and principles that enable applications to communicate using HTTP requests. RESTful APIs typically return data in JSON or XML format and can be used for data transmission between various platforms.
[0084] For example, through a third-party interface, the target data point configured by the third-party interface can be exposed to a third-party object, so that the third-party object can query and obtain the data of the target data point.
[0085] Step 013: upon receiving an interface call request from a third-party object, corresponding data in the energy management system is obtained based on the called third-party interface, and fed back to the third-party object.
[0086] Specifically, after the third-party interface of the third-party object is configured, the third-party object can obtain required data by calling the third-party interface.
[0087] When receiving an interface call request from a third-party object, the data platform can obtain the data of the target device and target data point corresponding to the third-party interface based on the called third-party interface, and then feed it back to the third-party object.
[0088] In one example, when a third-party user accesses a configured third-party interface, the process is as follows:
[0089] First, the third-party user sends an interface call request, which will carry a unique method identifier corresponding to the third-party interface to be called.
[0090] The data platform will then query the interface configuration database based on this identifier. If the method exists in the configuration, it means that the interface has been configured. The system will extract the input and output parameters from the configuration information and perform parameter verification, expiration time check (third-party interface configuration generally has an expiration time (such as can be determined based on the agreed cooperation time with the third-party object), determine whether the called third-party interface has expired) and interface blacklist (used to determine whether it is a blacklist user) verification.
[0091] After all checks are passed, the system will retrieve the permission configuration to determine whether the user has the permission to access the interface. For example, each interface can be configured to allow third-party objects to access it. After the permission verification is passed, data can be obtained based on the called interface and fed back to the third-party object.
[0092] In addition, each interface call will be recorded in the log to facilitate the location and maintenance of exception information.
[0093] See also Figure 3 Optionally, the third-party interface includes a device real-time data query interface, and the configuration information includes a target device and a target data point. Step 013 includes:
[0094] Step 0131: Acquire target real-time data corresponding to the target data point, and feed back the target real-time data to a third-party object.
[0095] The real-time data of the target device includes the real-time data related to the target device in all data points, and the target real-time data of the target data point is the real-time data of the target data point selected from the real-time data of all data points.
[0096] Third-party objects can configure the device real-time data query interface to query the real-time data of the device, which improves the flexibility and efficiency of data acquisition, reduces dependence on internal development resources, and speeds up the response time to user data needs.
[0097] When the data platform receives an interface call request from a third-party object, it can query the target devices and target data points configured in the device real-time data interface, obtain the real-time data of the target data points of each target device, and then feed it back to the third-party object.
[0098] Please continue reading Figure 3 Optionally, the third-party interface includes a device historical trend data query interface, and the configuration information includes a target period, a target device, and a target data point. Step 013 includes:
[0099] Step 0132: Acquire target historical data corresponding to the target data point and collected during the target period, and feed back the target historical data to a third-party object.
[0100] Among them, the historical data of the target device includes the historical data related to the target device in all data points. The target historical data corresponding to the target data point and whose collection period is in the target period can be selected from the historical data of all data points. First, the historical data of each data point in the target period is obtained, and then the historical data of the target data point is selected from the historical data of the target period.
[0101] Third-party objects can configure the device historical trend data query interface to query the device's historical data, thereby obtaining the device's historical trend of data, facilitating trend analysis, helping them understand the device's operating status and efficiency changes, and supporting decision-making and predictive maintenance.
[0102] When the data platform receives an interface call request from a third-party object, it can query the target time period, target device and target data point configured in the interface based on the device historical trend data, obtain the historical data of the target data point of each target device within the target time period, and then feed it back to the third-party object to facilitate the third-party object to perform data trend analysis within the target time period.
[0103] See also Figure 4 Optionally, the third-party interface includes a message subscription interface, the configuration information includes an update frequency, a target data point and a server address, and the method further includes:
[0104] Step 014: Based on the update frequency, forward the data of the target data point to the server address of the third party object.
[0105] In addition to the third-party interface based on calling feedback data to realize on-demand data query of third-party objects, there is also a message subscription interface for active message forwarding by the data platform. Third-party users can passively receive subscription data forwarded by the data platform without active query.
[0106] After configuring the good news subscription interface, the data platform can feed back the data of the subscribed target data point to the configured server address based on the configured update frequency (such as 1 time / second (i.e. data is fed back once per second), 1 time / minute, etc.).
[0107] Customize the frequency of message forwarding through third-party objects to achieve automatic data query and acquisition. When the customized frequency is high, it can reduce data update delay and improve system response speed and real-time performance.
[0108] In the data management method of the present application, a third-party object (such as a third-party application or platform) can customize input configuration information (such as the equipment and data to be queried), and send the configuration information to the current system (such as the energy management system of the energy storage device) through an interface configuration request. The current system can generate one or more third-party interfaces corresponding to the third-party object based on the configuration information. When the third-party object needs to query data later, it only needs to send an interface call request to call the corresponding third-party interface to obtain the data corresponding to the third-party interface fed back by the current system. In this way, not only can the third-party object query the data of the current system, but the third-party interface can be customized to meet the personalized data query needs of different third-party objects, and the user experience is better, which is conducive to expanding business.
[0109] See also Figure 5 In some embodiments, the data management method further includes:
[0110] Step 015: Monitor the number of interface requests of the third-party object;
[0111] Step 016: When the number of interface requests in the current monitoring window reaches a first preset number, stop responding to the interface call request of the third-party object in the current monitoring window, where the current monitoring window is any one of the multiple monitoring windows obtained by dividing based on the preset time length.
[0112] Specifically, in order to prevent external users from accessing the interface too frequently and avoid system performance degradation, the number of interface call requests initiated by third-party objects can be monitored, and the number of interface requests of third-party objects can be counted, so as to limit the flow of interface requests of third-party objects.
[0113] For example, the time can be divided into multiple continuous monitoring windows based on a preset duration (such as 1 minute is divided into a monitoring window), and then the maximum number of requests allowed in each monitoring window is set to limit the flow. In the current monitoring window, if the number of interface requests of the third-party object reaches the first preset number (i.e., the corresponding maximum number of requests), the subsequent interface call requests of the third-party object in the current monitoring window will be stopped. After entering the next monitoring window, the interface call request of the third-party object will be responded to. In this way, it can be ensured that the number of interface call requests of the third-party object in each monitoring window will not be too large, which can prevent external users from accessing the interface too frequently and avoid system performance degradation.
[0114] See also Figure 6 In some embodiments, the data management method further includes:
[0115] Step 017: Monitor the number of calls from the target object to the target interface, where the target object is any third-party object and the target interface is any third-party interface;
[0116] Step 018: When the number of calls in the current monitoring window reaches a second preset number, stop responding to the interface call request of the target object to the target interface in the current monitoring window, and the current monitoring window is any one of the multiple monitoring windows obtained by dividing based on the preset time length.
[0117] Specifically, in order to prevent external users from excessively frequent access to a certain interface and avoid system performance degradation, the number of calls made by each third-party object to each third-party interface can also be counted to limit the flow.
[0118] For example, the time can be divided into multiple continuous monitoring windows based on a preset duration (such as 1 minute is divided into a monitoring window), and then the maximum number of calls allowed in each monitoring window is set to limit the flow. In the current monitoring window, if the number of calls made by the target object to the target interface reaches the second preset number (i.e., the corresponding maximum number of calls), the subsequent interface call requests of the target object to the target interface in the current monitoring window will be stopped. After entering the next monitoring window, the interface call request of the target object to the target interface will be responded to. In this way, it can be ensured that the number of calls made by a third-party object to a third-party interface in each monitoring window will not be too large, which can prevent external users from accessing a certain interface too frequently and avoid system performance degradation.
[0119] Optionally, the current limiting threshold can be adjusted dynamically. For example, the first preset number and the third preset number can be adjusted based on the number of current limits in multiple consecutive monitoring windows. Taking the second preset number as an example, if in multiple consecutive monitoring windows, the number of requests that stop responding in the interface call requests of the third-party object to the third-party interface reaches a preset ratio, the second preset number is increased based on the preset ratio (such as positively correlated with the preset ratio). In this way, the data query requirements of the third-party object can be met as much as possible while achieving current limiting, and a balance between performance and user experience can be achieved.
[0120] Optionally, the data platform may store at least one of the configuration information of the third-party interface, the interface call request, the number of interface requests of the third-party object, and the number of calls of the third-party interface in the memory database and / or the local database.
[0121] In the process of processing the configuration of third-party interfaces, it was found that each time a third-party object accessed the interface, it was necessary to query the database to obtain configuration information, resulting in low system efficiency. In order to improve system performance, especially to reduce the number of database accesses, we need to design a solution to cache the configuration information of third-party interfaces, thereby speeding up access and reducing database pressure.
[0122] Optionally, the memory database can be a Redis database. The Redis database is a high-performance key-value storage database, which is particularly suitable for caching and real-time data processing. In this solution, the characteristics of the Redis database are used to store the configuration information of the third-party interface, the number of interface requests and calls, and the user's interface call request.
[0123] This can improve system performance and response speed: reduce the number of database accesses in each request, thereby reducing system response time. It can also reduce database load: by caching interface configuration data, reduce database reading pressure and avoid frequent database query operations.
[0124] When caching to an in-memory database, the cache key can be designed to use the interface name or the unique identifier of the interface as the cache key to ensure uniqueness and easy management; the content of the cache value can be the configuration information of the storage interface, such as the request address, request method, parameters, etc., to ensure consistency with the data in the database.
[0125] Optionally, use Redis's String type to store counting information (such as the number of interface requests, the number of calls, etc.). For example, for each third-party object or each interface, you can use a key like "interface name: object ID" to store the number of calls made by any third-party object to any third-party interface.
[0126] Optionally, the number of interface requests and calls can be counted through Redis atomic operations (such as INCR commands), ensuring that the count increase operation is concurrently safe and that counting errors will not occur.
[0127] Optionally, when the amount of data requested by the interface call is small, the in-memory database may not be used, and the local database may be used directly, thereby saving costs.
[0128] In some embodiments, the data management method may also synchronize the data of the memory database and the local database based on a preset period; or when the third-party interface of the third-party object changes, update the memory database and the local database based on the configuration information of the changed third-party interface.
[0129] Specifically, when using an in-memory database, it is critical to ensure that the data in the cache (ie, the in-memory database) is synchronized with the data in the local database to avoid failure to query the configuration information of the called third-party interface when querying the configuration information using the in-memory database.
[0130] The synchronization mode may include timed synchronization or incremental synchronization.
[0131] Among them, the timing can also be based on a preset period to synchronize the data of the memory database and the local database; for example, a scheduled task is designed to regularly read the configuration information of the third-party interface from the local database and update it to the cache. The preset period can be set according to the actual situation, and the preset period can be hourly, daily, etc.
[0132] Incremental synchronization can be used to update the memory database and local database based on the configuration information of the changed third-party interface when the third-party interface of the third-party object changes. For example, when a new third-party interface is configured for a third-party object or the configuration information of the originally configured third-party interface is changed (modified, deleted, etc.), the third-party interface in the local database changes. At this time, the local database can synchronize the configuration information of the changed third-party interface to the memory database. In this way, only the changed third-party interface is synchronized to avoid repeated transmission and processing of the full amount of data.
[0133] In some embodiments, the data management method may also set a data expiration period for the memory database; and delete the stored data in the memory database that has not been called within the data expiration period.
[0134] In other words, in order to prevent the configuration information, interface request times and call times of unused or invalid third-party interfaces from occupying the memory database for a long time, which will cause the memory database space to become smaller, an expiration time can be set for each stored data. When the storage time reaches the corresponding data expiration time, the expired data in the memory database will be deleted.
[0135] Among them, the data expiration period of stored data can be determined by a specific period of time, or the agreed cooperation period of the third-party object corresponding to the stored data. The data expiration period is relatively reasonable, and invalid stored data is avoided from occupying memory while ensuring the validity of the stored data.
[0136] In this way, combined with the aforementioned current limiting solution based on the monitoring window, malicious users can be prevented from attacking through a large number of requests, thus protecting the security and stability of the system.
[0137] See also Figure 7 In some embodiments, the interface call request includes a token, and the token is used for identity authentication. Step 13: upon receiving the interface call request from a third-party object, obtaining corresponding data based on the called third-party interface and feeding it back to the third-party object includes:
[0138] Step 0134: upon receiving an interface call request from a third-party object, identity authentication is performed based on the token;
[0139] Step 0135: After the identity authentication is passed, the corresponding data is obtained based on the called third-party interface and fed back to the third-party object.
[0140] Specifically, in order to ensure the security of interface calls, when making interface calls, it is necessary to authenticate the identity of the third-party object to ensure that only the third-party object that passes the identity authentication can call the third-party interface.
[0141] When a third-party object is configuring a third-party interface, the data platform will issue a token to the third-party object. Based on the token, the third-party object can pass identity authentication before calling the third-party interface.
[0142] Optionally, in case of receiving an interface configuration request sent by a third-party object, identification information and key information are issued to the third-party object, and a token is generated based on the identification information and key information.
[0143] For example, the issued identification information and key information are AppId and AppSecret respectively. Identity authentication can be quickly achieved through AppId and AppSecret. When calling a third-party interface, the third-party object (such as a third-party application) first generates a token based on AppId and AppSecret. The token has a validity period. The third-party object can perform identity authentication based on the token within the validity period.
[0144] See also Figure 8 In some embodiments, the data management method further includes:
[0145] Step 020: Configure the access rights of the internal interface, including the third-party objects corresponding to the internal interface;
[0146] Step 021: upon receiving an interface call request from a third-party object to call an internal interface permitted within the access rights, a corresponding operation is performed based on the called internal interface, and the operation result is fed back to the third-party object.
[0147] Specifically, although the use of a token can effectively access a third-party interface, it cannot be used to access the system's internal interface (such as an alarm management interface, a device control interface, etc.). Therefore, in order to allow a third-party object to call an internal interface, the access rights to the internal interface can be configured. For example, a list of third-party objects corresponding to each internal interface can be configured, and the third-party objects in the list all have the right to call the internal interface, thereby implementing the call to the internal interface, thereby controlling the energy management system to perform corresponding operations by calling the internal interface, such as controlling the charging or discharging of the energy storage device, and after the operation is completed, the operation result (operation completed, operation failed, etc.) is fed back to the third-party object.
[0148] In this way, the access rights of the internal interface are strictly dependent on the access rights settings of the internal interface. This design effectively implements strict permission control of the internal interface. The permission control strategy for interface access can be adjusted according to actual conditions to ensure the system supports different business scenarios.
[0149] Similarly, third-party interfaces can also be set with access permissions to meet permission management and control requirements for specific third-party interfaces.
[0150] In some embodiments, the data management method may perform anomaly detection on the interface call request of the third-party object, and if an anomaly occurs, store the anomaly information in the system log.
[0151] In this way, by performing anomaly detection on interface call requests, the security and traceability of interface calls can be guaranteed, and abnormal problems and security vulnerabilities can be discovered in a timely manner.
[0152] In summary, the system can effectively implement permission control for third-party interfaces and internal interfaces. The use of AppId and AppSecret authentication combined with flexible management of interface configuration not only ensures the security and stability of the system, but also provides good support for future system expansion and changes in business requirements. This design not only meets current business needs, but also lays a solid foundation for the long-term development of the system.
[0153] According to the method described in the above embodiment, the present application embodiment also provides a data management device 400 for executing the steps in the above data management method. Fig. 9 , Fig. 9 4 is a schematic diagram of a module of a data management device 400 provided in an embodiment of the present application. The data management device 400 includes:
[0154] The receiving module 401 is used to receive an interface configuration request sent by a third-party object, where the interface configuration request includes configuration information input by the third-party object;
[0155] Configuration module 402, configured to configure a third-party interface corresponding to the third-party object based on the configuration information;
[0156] The feedback module 403 is used to obtain corresponding data in the energy management system based on the called third-party interface when receiving an interface call request from a third-party object, and feed back the data to the third-party object.
[0157] It should be noted that the specific details of each module unit in the above-mentioned data management device have been described in detail in the embodiment of the above-mentioned data management method, and will not be repeated here.
[0158] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0159] In some embodiments, the data management device in the embodiments of the present application can be implemented in hardware, such as a server, or a component in a server, such as an integrated circuit or a chip; the data management method can also be implemented in software, such as as an application installed in a server.
[0160] See also Fig.10The computer device 500 of the embodiment of the present application includes a processor 501 and a memory 502. The memory 502 stores a computer program 503 that can be run on the processor 501. When the program 503 is executed by the processor 501, each process of the embodiment of the above data management method is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0161] An embodiment of the present application also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the embodiment of the above-mentioned data management method are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0162] The processor may be the processor in the energy storage system in the above embodiment. The computer readable storage medium may be a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0163] Computer readable media may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), flash memory or other solid-state storage technologies, CD-ROM, Digital Versatile Disc (DVD) or other optical storage, cassettes, magnetic tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will know that computer storage media are not limited to the above.
[0164] The embodiment of the present application also provides a computer program product, including a computer program, which implements the above-mentioned data management method when executed by a processor. The processor may be a processor in the energy storage system in the above-mentioned embodiment. When the computer program is executed by the processor, each process of the embodiment of the above-mentioned data management method is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0165] It is understandable that in the specific implementation of this application, data related to user identity or characteristics is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0166] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present application, and that the scope of the present application is defined by the claims and their equivalents.
Claims
1. A data management method, characterized in that: Applied to an energy management system, the method comprises: Receiving an interface configuration request sent by a third-party object, wherein the interface configuration request includes configuration information input by the third-party object; Based on the configuration information, configure a third-party interface corresponding to the third-party object; When an interface call request from the third-party object is received, corresponding data in the energy management system is acquired based on the called third-party interface, and fed back to the third-party object.
2. The data management method according to claim 1, characterized in that: The third-party interface includes a real-time data query interface for the device, the configuration information includes a target device and a target data point, the target device includes an energy storage device connected to the energy management system, the target data point includes one or more of the data points preset by the energy management system, and the third-party interface based on the call obtains the corresponding data in the energy management system and feeds it back to the third-party object, including: Acquire target real-time data corresponding to the target data point, and feed back the target real-time data to the third-party object.
3. The data management method according to claim 1, characterized in that: The third-party interface includes a device historical trend data query interface, the configuration information includes a target period, a target device, and a target data point, and the third-party interface based on the call obtains the corresponding data in the energy management system and feeds it back to the third-party object, including: Target historical data corresponding to the target data point and collected during the target period is acquired, and the target historical data is fed back to the third-party object.
4. The data management method according to claim 1, characterized in that: The third-party interface includes a message subscription interface, the configuration information includes an update frequency, a target data point, and a server address, and the method further includes: Based on the update frequency, the data of the target data point is forwarded to the server address of the third-party object.
5. The data management method according to any one of claims 1 to 4, characterized in that: Also includes: Monitoring the number of interface requests of the third-party object; When the number of interface requests in the current monitoring window reaches a first preset number, stop responding to the interface call request of the third-party object in the current monitoring window, and the current monitoring window is any one of the multiple monitoring windows obtained by dividing based on the preset time length.
6. The data management method according to any one of claims 1 to 4, characterized in that: Also includes: Monitoring the number of calls made by a target object to a target interface, wherein the target object is any of the third-party objects, and the target interface is any of the third-party interfaces; When the number of calls within the current monitoring window reaches a second preset number, stop responding to the interface call request of the target object to the target interface within the current monitoring window, and the current monitoring window is any one of the multiple monitoring windows obtained by dividing based on the preset time length.
7. The data management method according to claim 1, characterized in that: Also includes: At least one of the configuration information of the third-party interface, the interface call request, the number of interface requests of the third-party object, and the number of calls of the third-party interface is stored in a memory database and / or a local database.
8. The data management method according to claim 7, characterized in that: Also includes: Based on a preset period, synchronizing the data of the memory database and the local database; or When the third-party interface of the third-party object changes, the memory database and the local database are updated based on the changed configuration information of the third-party interface.
9. The data management method according to claim 7, characterized in that: Also includes: Set the data expiration time of the memory database; Delete the stored data in the memory database that has not been called within the data expiration period.
10. The data management method according to claim 1, characterized in that: The interface call request includes a token, and the token is used for identity authentication. When the interface call request of the third-party object is received, the corresponding data in the energy management system is obtained based on the called third-party interface, and fed back to the third-party object, including: When receiving an interface call request from the third-party object, performing identity authentication based on the token; After the identity authentication is passed, the corresponding data in the energy management system is obtained based on the called third-party interface and fed back to the third-party object.
11. The data management method according to claim 10, characterized in that: The method further comprises: In case of receiving an interface configuration request sent by a third-party object, identification information and key information are issued to the third-party object, and the token is generated based on the identification information and key information.
12. The data management method according to claim 1, characterized in that: Also includes: Configure access rights for the internal interface, the access rights including the third-party object corresponding to the internal interface; When receiving an interface call request from the third-party object to call an internal interface allowed within the access rights, a corresponding operation is performed based on the called internal interface, and the operation result is fed back to the third-party object.
13. The data management method according to claim 1, characterized in that: Also includes: An exception detection is performed on the interface call request of the third-party object, and in the event of an exception, the exception information is stored in the system log.
14. A data management device, characterized in that: Applications in energy management systems, including: A receiving module, configured to receive an interface configuration request sent by a third-party object, wherein the interface configuration request includes configuration information input by the third-party object; A configuration module, configured to configure a third-party interface corresponding to the third-party object based on the configuration information; The feedback module is used to obtain corresponding data in the energy management system based on the called third-party interface when receiving an interface call request from the third-party object, and feed back the data to the third-party object.
15. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the data management method according to any one of claims 1 to 13 is implemented.
16. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data management method according to any one of claims 1 to 13 is implemented.
17. A computer program product, characterized in that The method comprises a computer program, which, when executed by a processor, implements the data management method according to any one of claims 1 to 13.