A method for pushing charging gun data, a terminal and a storage medium
Patent Information
- Application Number
- CN202610470202.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-10
- Publication Date
- 2026-08-18
AI Technical Summary
在数据量较大时,频繁的单条读取和单条写入容易增加缓存数据库的交互负担,影响整体数据处理性能
[0008]本发明的有益效果在于:提供一种充电枪数据的推送方法、终端及存储介质,通过控制消息中间件按照预设时间窗口批量获取充电枪的当前状态数据,并结合缓存数据库中的缓存状态数据进行对比,仅将状态发生变化的充电枪确定为目标充电枪,再对目标充电枪执行缓存覆盖和目标平台推送操作,使得本方案并非对全部上报数据进行无差别处理,而是围绕状态变化的数据进行选择性更新和推送。相较于现有技术中消息中间件一次仅拉取一条充电枪状态数据、并逐条进行缓存读取、状态判断和推送的处理方式,上述方法通过控制消息中间件按照预设时间窗口批量获取充电枪的当前状态数据,再结合缓存数据库中的缓存状态数据进行对比,仅对状态发生变化的充电枪执行缓存覆盖和目标平台推送。由此,使数据处理对象从单条消息扩展为一批消息,能够减少消息逐条处理造成的消费阻塞风险,并降低无变化状态数据带来的冗余缓存更新和冗余平台推送,从而在充电枪数量较多、上报频率较高的场景下,提高整体数据处理效率和状态推送效率。
Smart Images

Figure CN122601754A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of Internet of Things (IoT) technology, and in particular to a method, terminal, and storage medium for pushing data from a charging gun. Background Technology
[0002] In existing technologies, charging gun status data is typically reported periodically by the device to a message middleware. The backend system then obtains the status data of each charging gun by listening to the message middleware and judges the status changes by combining it with historical status data in a cached database. When a status change is detected, the corresponding status data is written to the cached database and pushed to a third-party platform. This processing method can achieve the collection and synchronization of charging gun status data to a certain extent, meeting the data processing needs of typical-sized charging stations.
[0003] However, with the increase in the number of charging guns and the higher frequency of status reporting, existing technologies have gradually revealed their insufficient processing efficiency. Firstly, in existing solutions, message middleware typically processes charging gun status data by fetching one message at a time. When a large number of charging guns in a facility report data simultaneously, the backend system needs to complete message retrieval, status judgment, and subsequent processing one message at a time, which can easily lead to congestion in the message consumption chain, thus increasing the risk of consumption blockage caused by processing messages one by one. Secondly, regarding caching, existing solutions typically access the cache database separately for each charging gun status data, first reading the corresponding cached status, and then performing a cache update when the status changes. This means that the same processing flow often requires multiple interactions with the cache database. When the data volume is large, frequent single-read and single-write operations can easily increase the interaction burden on the cache database, affecting overall data processing performance. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a method, terminal and storage medium for pushing charging gun data, which can reduce the risk of consumption blockage caused by processing messages one by one.
[0005] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows: A method for pushing charging gun data, comprising the following steps: The control message middleware acquires the current status data of the charging gun in batches according to a preset time window; Read the cached status data corresponding to the charging gun from the cache database; Compare the current status data and cached status data of the charging gun, and mark the charging guns whose current status data and cached status data are different as target charging guns; The current status data of the target charging gun is overwritten with the corresponding cached status data in the cache database, and the current status data of the target charging gun is sent to the target platform.
[0006] To solve the above-mentioned technical problems, the present invention adopts other technical solutions as follows: A charging gun data push terminal includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the steps in the charging gun data push method.
[0007] A storage medium storing a computer program, which, when executed by a processor, implements the steps in the method for pushing data from a charging gun.
[0008] The beneficial effects of this invention are as follows: It provides a method, terminal, and storage medium for pushing charging gun data. By controlling a message middleware to batch obtain the current status data of charging guns according to a preset time window, and comparing it with cached status data in a cache database, only charging guns whose status has changed are identified as target charging guns. Then, cache overwriting and target platform push operations are performed on the target charging guns. This solution does not process all reported data indiscriminately, but selectively updates and pushes data based on status changes. Compared with the existing technology where the message middleware pulls only one charging gun status data at a time and performs cache reading, status judgment, and push on each data item, the above method, by controlling the message middleware to batch obtain the current status data of charging guns according to a preset time window, and comparing it with cached status data in a cache database, only performs cache overwriting and target platform push on charging guns whose status has changed. This expands the data processing object from a single message to a batch of messages, reducing the consumption blocking risk caused by processing messages one by one, and reducing redundant cache updates and redundant platform pushes caused by unchanged status data. Therefore, in scenarios with a large number of charging guns and a high reporting frequency, the overall data processing efficiency and status push efficiency are improved. Attached Figure Description
[0009] Figure 1 This is a flowchart of a charging gun data push method according to an embodiment of the present invention; Figure 2 This is a schematic diagram of a charging gun data push terminal according to an embodiment of the present invention; Label Explanation: 1. A data push terminal for a charging gun; 2. A memory; 3. A processor. Detailed Implementation
[0010] To explain in detail the technical content, objectives, and effects of the present invention, the following description is provided in conjunction with the embodiments and accompanying drawings.
[0011] In existing technologies, with the rapid popularization of new energy vehicles, the number of charging stations, especially integrated photovoltaic-storage-charging stations, is constantly increasing. These stations typically have multiple charging piles and charging guns to meet the charging needs of different vehicles. During actual operation, each charging gun continuously reports its operating status data, such as offline, idle, charging, plugged in, abnormal, and disabled status information. The backend platform needs to use this status data to perform equipment monitoring, operation management, anomaly alarms, and data synchronization with third-party platforms. In existing technologies, a message middleware typically receives the charging gun status data reported by the device side. The backend system then retrieves each message individually and compares it with the corresponding historical status from the cache database. Only after detecting a status change does it perform cache updates and platform pushes. While this method can achieve basic status acquisition and synchronization functions, in scenarios with a large number of charging guns and a high frequency of status reporting, it is prone to problems such as low efficiency in processing messages one by one, frequent cache interactions, and repeated pushes of unchanged data, thus affecting overall data processing performance and platform response efficiency.
[0012] To at least solve the above problems, please refer to Figure 1 This invention provides a method for pushing charging gun data, including the following steps: The control message middleware acquires the current status data of the charging gun in batches according to a preset time window; Read the cached status data corresponding to the charging gun from the cache database; Compare the current status data and cached status data of the charging gun, and mark the charging guns whose current status data and cached status data are different as target charging guns; The current status data of the target charging gun is overwritten with the corresponding cached status data in the cache database, and the current status data of the target charging gun is sent to the target platform.
[0013] As can be seen from the above description, the beneficial effects of the present invention are as follows: by controlling the message middleware to obtain the current status data of the charging gun in batches according to a preset time window, and comparing it with the cached status data in the cache database, only the charging guns whose status has changed are identified as target charging guns, and then the cache overwrite and target platform push operations are performed on the target charging guns. This makes the present solution not to process all reported data indiscriminately, but to selectively update and push data based on the status changes.
[0014] Compared to existing technologies where the message middleware retrieves only one charging gun status data entry at a time and performs cache reading, status judgment, and push on each entry sequentially, the above method controls the message middleware to retrieve the current status data of charging guns in batches according to a preset time window. This data is then compared with cached status data in a cache database. Only charging guns whose status has changed are subject to cache overwriting and target platform push. This expands the data processing object from single messages to batches of messages, reducing the consumption blocking risk caused by processing messages one by one, and minimizing redundant cache updates and redundant platform pushes caused by unchanged status data. Therefore, in scenarios with a large number of charging guns and a high reporting frequency, this method improves overall data processing efficiency and status push efficiency.
[0015] In some implementations, reading the cached state data corresponding to the charging gun from the cache database specifically includes: The control message middleware obtains the identification data of the charging gun, and based on the identification data, reads the cached state data corresponding to the charging gun from the cache database.
[0016] As described above, by acquiring the charging gun's identification data and retrieving the corresponding cached state data from the cache database based on this identification data, each current state data entry can be located in the cache database to pinpoint its corresponding historical state. This establishes a clear data mapping relationship between the current state and the cached state, facilitating rapid state reading and comparison in batch processing scenarios. It reduces state judgment errors caused by inaccurate data location, thereby improving the accuracy of cache reading and the reliability of state comparison.
[0017] In some implementations, the step of generating the identification data includes: Obtain the station number, pile number, and gun number of the location of the charging gun, and generate unique identification data for the corresponding charging gun based on the station number, the pile number, and the gun number.
[0018] As described above, by obtaining the site number, charging pile number, and charging gun number, and generating unique identification data for each charging gun based on these three, the charging gun status data has a unique index in the cache database. This method not only facilitates rapid location of target data when batch reading cached statuses, but also helps to accurately update the corresponding cached content after status changes, avoiding data confusion between different charging guns, thereby improving the data organization capabilities of the entire status collection, comparison, update, and push process.
[0019] In some implementations, reading the cached state data corresponding to the charging gun from the cache database further includes the step of: When the cached status data corresponding to the charging gun cannot be read from the cache database, the current status data of the corresponding charging gun is cached in the cache database, and the corresponding charging gun is marked as the target charging gun.
[0020] As described above, when the corresponding cached state data cannot be read from the cache database, the current state data of the charging gun is directly cached and marked as the target charging gun. This allows charging guns that are connecting to the system for the first time, charging guns that are reporting their status for the first time, or charging guns whose cache has been lost, to establish a cache baseline in a timely manner and synchronize it to the target platform. This avoids data omissions due to the lack of historical states and improves the completeness of the system's processing of initial state data.
[0021] In some implementations, before comparing the current state data and cache state data of the charging gun, the method further includes: Obtain the current reporting time corresponding to the current status data and the historical reporting time corresponding to the cached status data; When the current reporting time is later than the historical reporting time, the current status data of the charging gun and the cache status data are compared.
[0022] As described above, even with improved batch processing efficiency, existing technologies may still overwrite new data if the message arrival order is not further considered, affecting the accuracy of status judgment. The method described above addresses this by obtaining the current reporting time and historical reporting time before comparing the current and cached status data. Status comparison is only performed when the current reporting time is later than the historical reporting time, ensuring the data entering subsequent judgment processes has time validity. This reduces the risk of invalid comparisons due to message delays, duplicate reporting, or out-of-order transmission, prevents expired states from interfering with the cache database and target platform, and thus improves the timeliness and reliability of status update results.
[0023] In some implementations, marking a charging gun whose current state data differs from the cached state data as a target charging gun further includes: When the current status data belongs to a preset abnormal status set, the corresponding charging gun is marked as the target charging gun; the preset abnormal status set includes at least one of offline, abnormal and disabled.
[0024] As described above, by directly marking the corresponding charging gun as the target charging gun when the current state data belongs to a preset set of abnormal states, the system can prioritize triggering subsequent processing for critical abnormal states. This ensures that even when a large amount of ordinary state data arrives simultaneously, abnormal states can enter the cache update and platform push process more quickly, allowing the target platform to promptly learn about abnormal charging gun operation, thereby enhancing the system's responsiveness to abnormal states and its operational support capabilities.
[0025] In some implementations, marking a charging gun whose current state data differs from the cached state data as a target charging gun further includes: When the charging gun status in the current status data is the same as the cache gun status in the cache status data, and the current status data of the corresponding charging gun exceeds a preset number of times, the corresponding charging gun is marked as the target charging gun.
[0026] As described above, by ensuring that the charging gun status in the current status data is the same as the cached gun status, and the current status data continues for more than a preset number of times, the corresponding charging gun is still marked as the target charging gun. This allows the system to re-identify and push data on persistent statuses. This avoids the target platform mistakenly believing that the device status information has expired due to the status remaining unchanged for a long time. It is especially suitable for scenarios that require continuous monitoring, such as offline or abnormal situations, thereby improving the continuity of status monitoring and information confirmation capabilities. Alternatively, when the charging gun status is detected to remain unchanged multiple times, it is possible that the charging gun is reporting incorrect data, has been operating for a long time, or has been out of service for a long time, requiring maintenance of the charging gun. Therefore, it is marked as the target charging gun for data push.
[0027] In some implementations, sending the current status data of the target charging gun to the target platform specifically includes: A preset push strategy is matched based on the type of the current status data of the target charging gun, and the current status data of the target charging gun is sent to the target platform according to the preset push strategy.
[0028] If all status data are pushed using the same method, it can easily lead to a lack of differentiation in push resource consumption between important and ordinary states, which is detrimental to overall push efficiency optimization. This method matches a preset push strategy based on the type of the target charging gun's current status data and sends the data to the target platform according to the preset strategy. This allows different types of states to use appropriate push methods according to their business importance. This not only improves the timeliness of push notifications for critical states but also reduces the consumption of communication links and platform processing resources for ordinary states, thereby further improving push performance and enhancing the overall system operating efficiency based on existing technologies.
[0029] Please refer to Figure 2 A charging gun data push terminal 1 includes a memory 2, a processor 3, and a computer program stored on the memory 2 and running on the processor 3. When the processor 3 executes the computer program, it implements the steps in a charging gun data push method.
[0030] A storage medium storing a computer program, which, when executed by a processor, implements the steps of a method for pushing data from a charging gun.
[0031] Please refer to Figure 1 Embodiment 1 of the present invention is as follows: A method for pushing charging gun data is provided, applied to a data processing system for a photovoltaic, energy storage, and charging station. The data processing system may include a message middleware, a cache database, a data processing module, and a target platform. The message middleware receives current status data reported by multiple charging guns. The cache database stores cached status data corresponding to each charging gun. The data processing module identifies, compares, and filters the current status data and the cached status data. The target platform receives the current status data of the target charging gun, enabling remote monitoring, business linkage, or operation and maintenance management of the charging gun status.
[0032] In this embodiment, the current status data reported by the charging gun may include at least the site number, pile number, gun number, current reporting time, and charging gun status. The charging gun status may include at least one of offline, idle, charging, plugged in, abnormal, and disabled. Since a photovoltaic-storage-charging station typically has multiple sites, multiple charging piles, and multiple charging guns, different charging guns will continuously generate status reporting data during operation. If the existing processing method of pulling messages one by one from the message middleware, reading the cache one by one, judging status changes one by one, and pushing one by one to a third-party platform is still used, message processing congestion, excessive cache database interactions, and excessive redundant data pushes can easily occur when the reporting frequency is high or the number of charging guns is large. Therefore, this embodiment improves data processing efficiency through batch acquisition, status filtering, and differentiated push.
[0033] Specifically, the data processing module first controls the message middleware to acquire the current status data of the charging guns in batches according to a preset time window. The preset time window can be 1 second, or it can be configured according to the scale of the site, the number of devices, the data reporting frequency, and the platform performance. By acquiring the current status data reported by multiple charging guns at once within each preset time window, the data processing module can obtain a batch of data to be processed within a single processing cycle, thereby reducing the consumption blocking risk caused by the message middleware pulling data one by one.
[0034] After acquiring a batch of current status data, the data processing module can extract the corresponding charging gun's identification data from each current status data entry. In this embodiment, the identification data can be generated by combining the station number, pile number, and gun number. Since the station number is used to characterize the location of the charging gun at the charging station, the pile number is used to characterize the charging pile it belongs to, and the gun number is used to characterize the specific charging port, unique identification data for the corresponding charging gun can be generated using the station number, pile number, and gun number. The data processing module can then read the corresponding cached status data from the cache database based on this identification data. This ensures that each current status data entry can be mapped to its corresponding historical status record, guaranteeing the accuracy of subsequent status comparisons.
[0035] In some cases, the data processing module may not be able to read the cached status data for a particular charging gun from the cache database. For example, this could be because the charging gun is being connected to the system for the first time, is reporting its status for the first time, or the relevant records in the cache database are missing due to faults, cleanup, or anomalies. In such cases, the data processing module can directly write the charging gun's current status data into the cache database to establish the corresponding cached status data. Simultaneously, it can mark the charging gun as a target charging gun and send its current status data to the target platform. This method ensures that the status of a charging gun appearing for the first time or with missing cache data is not missed in the processing flow, allowing the target platform to promptly establish awareness of the charging gun's status.
[0036] For charging guns whose cached status data is successfully read from the cache database, the data processing module can further perform validity checks and status comparisons between the current status data and the cached status data. Specifically, the data processing module can first obtain the current reporting time corresponding to the current status data and the historical reporting time corresponding to the cached status data. Only when the current reporting time is later than the historical reporting time will the current status data and the cached status data be compared. This avoids situations where old data arrives late due to message transmission delays, duplicate reporting, or network link jitter, and prevents historical status data from negatively influencing the latest current status, thereby improving the timing accuracy of the entire status judgment process.
[0037] After confirming the time validity of the current status data, the data processing module compares the charging gun status in the current status data with the cached charging gun status in the cached status data. If the current status data differs from the cached status data, it indicates that the status of the corresponding charging gun has changed, and the data processing module marks this charging gun as the target charging gun. Subsequently, the current status data of the target charging gun is written to the corresponding cached status data in the cache database, and the current status data of the target charging gun is sent to the target platform. By performing cache updates and data pushes only on charging guns whose status has changed, duplicate writing and sending of unchanged statuses can be avoided, thereby reducing the interaction pressure on the cache database and the redundant data receiving pressure on the target platform.
[0038] Furthermore, in this embodiment, to improve the ability to identify and handle critical states, the data processing module can pre-set a set of abnormal states. The set of abnormal states may include at least one of offline, abnormal, and disabled states. When the current state data of a charging gun is detected to belong to the preset set of abnormal states, even if this state occurs infrequently in the overall dataset, the data processing module can still prioritize marking this charging gun as the target charging gun. This allows critical abnormal states to be prioritized in the cache update and data push process, facilitating the target platform to more quickly perceive abnormal charging gun operation, thereby supporting maintenance alarms, anomaly investigation, and equipment scheduling.
[0039] In other scenarios, although the charging gun status in the current status data is the same as the cached charging gun status in the cached status data, if this identical status persists for a preset number of times, the data processing module can still mark the corresponding charging gun as the target charging gun. For example, when a charging gun continuously reports an offline status, abnormal status, or disabled status multiple times, it indicates that the status may have not been resolved for a long time, and the target platform needs to obtain the status information again to avoid mistakenly believing that the charging gun has returned to normal. As another example, when a charging gun continuously maintains the same abnormal status multiple times, it may also reflect situations such as abnormal reporting, long-term continuous operation, or long-term shutdown. The target platform or maintenance side can further determine whether the charging gun needs to be inspected, patrolled, or manually checked based on this repeated reporting information. Therefore, in this embodiment, even if the status value does not change, as long as the status persists for a preset number of times, it can be considered data with push value.
[0040] Once the target charging gun is identified, the data processing module matches a preset push strategy based on the current status data type of the target charging gun and sends the corresponding data to the target platform according to the matched preset push strategy. The preset push strategy can be differentiated according to different status types. For example, for statuses affecting normal device operation, such as offline, abnormal, and disabled, a higher-priority push method can be used to improve the timeliness of critical status transmission; for normal operating statuses such as idle, plugged in, or charging, a relatively conventional push method can be used to reduce the occupation of communication links and platform processing resources. By configuring corresponding push strategies according to status types, data of different service importance can be processed differently, thereby balancing push efficiency and system load balance.
[0041] In practical applications, the data processing module can cyclically execute the above steps according to a preset time window. Specifically, within each time window, it batches current status data, reads cached status data based on the identifier data, initializes the cache and pushes data for charging guns appearing for the first time or with missing cache entries, compares the time-valid current status data with the cached status data, and marks charging guns whose status has changed, belong to an abnormal status set, or have continuously reached a preset number of occurrences as target charging guns. Then, it performs cache overwriting and policy-based pushes for the target charging guns. This approach improves the processing efficiency of charging gun status data and the platform's push efficiency while ensuring the accuracy of status identification.
[0042] In summary, this embodiment constructs the charging gun status data processing flow into a complete chain, which includes batch acquisition, unique identifier location, time validity verification, status difference identification, priority handling of abnormal status, re-identification of persistent status, and type-based push. Compared with the existing technology's method of pulling, reading cache, judging, and pushing data one by one, this embodiment can reduce message processing blockage, reduce the number of cache database interactions, reduce invalid pushes, and improve the ability to identify abnormal and persistent statuses. Therefore, it is more suitable for data processing scenarios with multiple charging guns and high-frequency reporting in photovoltaic-storage-charging stations.
[0043] Please refer to Figure 2 Embodiment two of the present invention is as follows: A charging gun data push terminal 1 includes a memory 2, a processor 3, and a computer program stored in the memory 2 and running on the processor 3. When the processor 3 executes the computer program, it implements the steps in a charging gun data push method.
[0044] Embodiment 3 of the present invention is as follows: A storage medium storing a computer program, which, when executed by a processor, implements the steps of a method for pushing data from a charging gun.
[0045] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent modifications made based on the content of the present invention specification and drawings, or direct or indirect applications in related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A method for pushing charging gun data, characterized in that, Including the following steps: The control message middleware acquires the current status data of the charging gun in batches according to a preset time window; Read the cached status data corresponding to the charging gun from the cache database; Compare the current status data and cached status data of the charging gun, and mark the charging guns whose current status data and cached status data are different as target charging guns; The current status data of the target charging gun is overwritten with the corresponding cached status data in the cache database, and the current status data of the target charging gun is sent to the target platform.
2. The method for pushing charging gun data according to claim 1, characterized in that, The step of reading the cached state data corresponding to the charging gun from the cache database specifically includes: The control message middleware obtains the identification data of the charging gun, and based on the identification data, reads the cached state data corresponding to the charging gun from the cache database.
3. The method for pushing charging gun data according to claim 2, characterized in that, The steps for generating the identification data include: Obtain the station number, pile number, and gun number of the location of the charging gun, and generate unique identification data for the corresponding charging gun based on the station number, the pile number, and the gun number.
4. The method for pushing charging gun data according to claim 1, characterized in that, The process of reading the cached state data corresponding to the charging gun from the cache database also includes the following steps: When the cached status data corresponding to the charging gun cannot be read from the cache database, the current status data of the corresponding charging gun is cached in the cache database, and the corresponding charging gun is marked as the target charging gun.
5. The method for pushing charging gun data according to claim 1, characterized in that, Before comparing the current state data and cache state data of the charging gun, the process also includes: Obtain the current reporting time corresponding to the current status data and the historical reporting time corresponding to the cached status data; When the current reporting time is later than the historical reporting time, the current status data of the charging gun and the cache status data are compared.
6. The method for pushing charging gun data according to claim 1, characterized in that, Marking a charging gun whose current state data and cached state data differ as a target charging gun further includes: When the current status data belongs to a preset abnormal status set, the corresponding charging gun is marked as the target charging gun; the preset abnormal status set includes at least one of offline, abnormal and disabled.
7. The method for pushing charging gun data according to claim 1, characterized in that, Marking a charging gun whose current state data and cached state data differ as a target charging gun further includes: When the charging gun status in the current status data is the same as the cache gun status in the cache status data, and the current status data of the corresponding charging gun exceeds a preset number of times, the corresponding charging gun is marked as the target charging gun.
8. The method for pushing charging gun data according to claim 1, characterized in that, Sending the current status data of the target charging gun to the target platform specifically includes: A preset push strategy is matched based on the type of the current status data of the target charging gun, and the current status data of the target charging gun is sent to the target platform according to the preset push strategy.
9. A charging gun data push terminal, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the steps in the charging gun data push method according to any one of claims 1-8.
10. A storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the steps in the charging gun data push method according to any one of claims 1-8.