Method and system for peer monitoring based on full-quantity lens
By building a distributed processing platform based on Spring Boot, Hikari, MyBatis, and MySQL, and utilizing Redis cluster caching and computation, the problems of high computational resource consumption and slow speed in existing peer monitoring methods have been solved, achieving efficient peer monitoring.
Patent Information
- Application Number
- CN202111564327.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-20
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2041-12-20
AI Technical Summary
Existing methods for monitoring vehicle traffic consume large amounts of computer resources, have slow computing speeds, and incur significant data loading overhead, which can easily lead to data congestion.
The development framework is SpringBoot+Hikari+MyBatis+MySQL. A distributed processing platform with Redis cluster as cache is built. By periodically scanning the task status table of the MySQL database, tasks to be processed are extracted from the Redis cache queue, vehicle checkpoint data is queried and the results are calculated. The Redis cluster is used for caching and calculation.
It enables faster peer monitoring, reduces computer resource consumption, increases computing speed, avoids data congestion, and improves data processing efficiency.
Smart Images

Figure CN114461179B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of same-line monitoring, and in particular to a same-line monitoring method and system based on full-volume junctions. BACKGROUND
[0002] The existing vehicle same-line monitoring method generally stores vehicle passing data in a data warehouse, loads the data in batches into memory or writes files in a vehicle same-line analysis manner through an open-source analysis engine. This manner splits the overall architecture into more detailed parts when constructing a processing platform, and each link service is separately deployed and requires certain hardware resource support. In addition, this manner also has the problems of large data loading overhead and easy data congestion. SUMMARY
[0003] The present application provides a same-line monitoring method and system based on full-volume junctions, which is used to solve the technical problems of large computer resource consumption and slow calculation speed of the existing same-line monitoring method.
[0004] To solve the above technical problems, the technical solution provided by the present application is as follows:
[0005] A same-line monitoring method based on full-volume junctions, comprising:
[0006] A distributed processing platform is built with SpringBoot+Hikari+MyBatis+MySQL as the development framework and redis cluster as the cache.
[0007] A task state table of the MySQL database of the distributed processing platform is scanned, and pending tasks are extracted from the task state table and stored in the redis cache queue of the redis cluster of the distributed processing platform.
[0008] The pending tasks in the redis cache queue are scanned, the license plate numbers corresponding to the vehicles related to the pending tasks and passing through all junctions on the day are queried from the associated junction table of the MySQL database, and the license plate numbers are written into the redis cache num queue of the redis cluster after deduplication.
[0009] The same-line calculation rules are queried from the MySQL database, the junction names and passing-through junction times of the vehicles corresponding to each license plate number in the redis cache num queue are queried from the vehicle junction table of the MySQL database, and the same-line results of the vehicles corresponding to each license plate number are calculated according to the same-line calculation rules and the junction names and passing-through junction times of the vehicles corresponding to each license plate number.
[0010] Preferably, the pending tasks are extracted from the task state table each time, and the first pending task is sorted in ascending order by date.
[0011] Preferably, after calculating the same trip result of each vehicle corresponding to the license plate number, the following steps are further included:
[0012] According to the same trip result of each vehicle corresponding to the license plate number, the same trip detail record of each same trip vehicle is queried from the MySQL database, the same trip result and the same trip detail record are written into the redis queue of the redis cluster, and the completion date of the to-be-processed task is recorded in the completion date queue of the redis cluster;
[0013] The completion date queue of the redis cluster is polled to check whether there is data, if there is, the same trip result and the same trip detail record of the redis queue are obtained according to the date of the completion date queue, and are written into the same trip result table and the same trip detail record table of the database table respectively.
[0014] Preferably, the task state table is used to record the date of each day and the state of the task of each day, and the state of the task includes: to-be-processed, calculating same trip, completing processing, storing data, and completing storage.
[0015] When the license plate number is written into the redis cache num queue of the redis cluster after being de-duplicated, the state of the license plate on the task state table is modified to “calculating same trip”.
[0016] When the same trip result and the same trip detail record are written into the redis queue of the redis cluster after being calculated according to the same trip calculation rule and the same trip result of each vehicle corresponding to the license plate number passing through the name of the toll gate and the time of passing through the toll gate, the state of each license plate number on the task state table is modified to “completing processing”.
[0017] When the same trip result and the same trip detail record are written into the redis queue of the redis cluster, the state of each license plate number on the task state table is modified to “storing data”.
[0018] When the same trip result and the same trip detail record of the redis queue are written into the same trip result table and the same trip detail record table of the database table according to the date of the completion date queue, the state of each license plate number on the task state table is modified to “completing storage”.
[0019] Preferably, the to-be-processed task is extracted, and the task generation time thereof is used as a suffix as a key, and the value is marked as to-be-processed.
[0020] When the license plate number is written into the redis cache num queue of the redis cluster after being de-duplicated, the value of the to-be-processed task of the redis cache queue is marked as “processing completed”.
[0021] Preferably, after the license plate number is written into the redis cache num queue of the redis cluster after deduplication, the processing date of the cached license plate is recorded in the creating queue of the redis cluster; whether the processing date of the cached license plate exists in the creating queue is scanned, if the processing date of the cached license plate exists, whether the redis cache num queue exists is detected, if the redis cache num queue exists, the same-line calculation rule is queried from the MySQL database, and the vehicle passing through the name of the pass-through mouth and the pass-through mouth time corresponding to each license plate number in the redis cache num queue are queried from the vehicle pass-through mouth table of the MySQL database.
[0022] Preferably, the same-line result of each license plate number corresponding vehicle is calculated according to the same-line calculation rule and the vehicle passing through the name of the pass-through mouth and the pass-through mouth time corresponding to each license plate number by a plurality of application servers.
[0023] A computer system comprises a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0024] The present application has the following beneficial effects:
[0025] 1、The same-line monitoring method and system based on full-quantity pass-through mouths in the application, by building a distributed processing platform taking redis cluster as cache and taking SpringBoot+Hikari+MyBatis+MySQL as development framework, extracting the to-be-processed tasks from the task state table of the MySQL database and storing them into the redis cache queue of the redis cluster of the distributed processing platform, scanning the to-be-processed tasks in the redis cache queue, querying the license plate numbers corresponding to the vehicles related to the to-be-processed tasks from the associated pass-through mouth table of the MySQL database after deduplication and writing them into the redis cache num queue of the redis cluster, and querying the vehicle passing through the name of the pass-through mouth and the pass-through mouth time corresponding to each license plate number in the redis cache num queue from the vehicle pass-through mouth table of the MySQL database to calculate the same-line result of each license plate number corresponding vehicle. The distributed processing platform taking redis cluster as cache and taking SpringBoot+Hikari+MyBatis+MySQL as development framework built by the application can quickly realize the screening of the accompanying vehicles meeting various conditions from the level of big data screening.
[0026] In addition to the purposes, features and advantages described above, the present application has other purposes, features and advantages. The present application will be further described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS
[0027] The accompanying drawings, which form a part of this application, are intended to provide further understanding of the application and are incorporated herein in their entirety, and together with the general description of the application and explained embodiments thereof and specifically the detailed description thereof, contribute to the understanding of the application. In the drawings:
[0028] Figure 1 is a flow chart of the full-quantity-cassette-based co-monitoring method in the preferred embodiment of the present application;
[0029] Figure 2 is a structure diagram of the distributed processing platform built by the full-quantity-cassette-based co-monitoring method in the preferred embodiment of the present application. DETAILED DESCRIPTION
[0030] The embodiments of the present application are described in detail below with reference to the accompanying drawings, but the present application can be implemented in various different ways as limited and covered by the claims.
[0031] In the present application, the abbreviations and key terms are defined as follows:
[0032] SpringBoot: a rapid development framework that packages the most mainstream frameworks now, which can help us quickly integrate and automatically configure according to the written code. With this framework, a program can be quickly developed and quickly deployed, which is a lightweight application framework based on spring;
[0033] Hikari: a database connection pool, which is also the default database connection pool used by SpringBoot2.0 and above;
[0034] Redis: a log-based, Key-Value database based on memory and also persistent;
[0035] parallelStream: a parallel execution stream that is a new feature of Java 8.
[0036] Embodiment one:
[0037] The present embodiment discloses a full-quantity-cassette-based co-monitoring method, comprising:
[0038] A distributed processing platform is built with SpringBoot+Hikari+MyBatis+MySQL as the development framework and redis cluster as the cache.
[0039] The task state table of the MySQL database of the distributed processing platform is scanned regularly, the to-be-processed tasks are extracted from the task state table, and the extracted to-be-processed tasks are stored in the redis cache queue of the redis cluster of the distributed processing platform;
[0040] Scan the pending task in the redis cache queue, query the license plate number corresponding to the vehicle passing through the card mouth name and the card mouth time of each license plate number in the redis cache num queue from the vehicle card mouth table of the MySQL database, and calculate the same row result of each license plate number corresponding vehicle according to the same row calculation rule and the license plate number corresponding vehicle passing through the card mouth name and the card mouth time.
[0041] Scan the pending task in the redis cache queue, query the license plate number corresponding to the vehicle passing through the card mouth name and the card mouth time of each license plate number in the redis cache num queue from the vehicle card mouth table of the MySQL database, and calculate the same row result of each license plate number corresponding vehicle according to the same row calculation rule and the license plate number corresponding vehicle passing through the card mouth name and the card mouth time.
[0042] In addition, in the embodiment, a computer system is also disclosed, which comprises a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor implements the steps of the above method when executing the computer program.
[0043] The same row monitoring method and system based on full-quantity card mouths in the application, by building a distributed processing platform taking redis cluster as cache and taking SpringBoot+Hikari+MyBatis+MySQL as development framework, extracts the pending task from the task state table of the MySQL database and stores it in the redis cache queue of the distributed processing platform; scans the pending task in the redis cache queue, queries the license plate number corresponding to the vehicle passing through the card mouth name and the card mouth time of each license plate number in the redis cache num queue from the vehicle card mouth table of the MySQL database, and calculates the same row result of each license plate number corresponding vehicle according to the same row calculation rule and the license plate number corresponding vehicle passing through the card mouth name and the card mouth time. The distributed processing platform taking redis cluster as cache and taking SpringBoot+Hikari+MyBatis+MySQL as development framework built by the application can quickly realize the screening of the accompanying vehicles meeting various conditions from the big data screening level.
[0044] Embodiment two:
[0045] Embodiment two is a preferred embodiment of embodiment one, which is different from embodiment one in that the specific steps of the same row monitoring method based on full-quantity card mouths are introduced:
[0046] As shown in Figure 1 In the embodiment, a same row monitoring method based on full-quantity card mouths is disclosed, which comprises the following steps:
[0047] Step 1, build a distributed processing platform with SpringBoot+Hikari+MyBatis+MySQL as the development framework, and redis cluster as the cache.
[0048] As shown in Figure 2 The distributed processing platform is realized by combining SpringBoot microservices, MySQL database and redis cluster multi-project technologies, including redis cluster, MySQL database and service layer; wherein the MySQL database is used to store vehicle information table, card slot table, vehicle card slot record table, task status table, output same row result table, output same row detailed record table; the service layer includes timing scanning task service, license plate cache service HistoryCarNumScheduleRedis, same row monitoring calculation service HistoryScheduleRedis, data result warehousing service;
[0049] Step 2, configure the dependencies in pom.xml file.
[0050] Step 3, configure the application.properties file, and point to dev (application-dev.propertie) during development and prod (application-prod.propertie) during deployment to formal environment.
[0051] Step 4, write the timing scanning task service. Scan the task status table every minute for tasks with status "2" to be processed and no ongoing calculation of same row status, execute the same row status of all-quantity card slot vehicles per day, and write the minimum date of each polling to the redis cache queue as the key with the date as the suffix and mark the value as 1. The task status table mainly records the date and status of each day, and the status includes: 2 to be processed, 3 to be calculated, 4 to be processed, 5 to be warehoused, and 6 to be completed. The status of the to-be-processed task redis cache queue includes: 1 to be processed, 2 to be processed, and the date key cache time of this queue is one week.
[0052] In step 4, since there are about 300W vehicles per day, the write cache adopts the JAVA8 List stream processing method parallelStream parallel processing mechanism, and writes in batches through redisUtils.getListOperations().leftPush into the redis cache queue. This method is used to prepare for the same line monitoring service, and to reduce the storage pressure of redis by reducing one for each consumption when obtaining the license plate cache. It can also be executed in parallel with the same line monitoring service to improve efficiency.
[0053] Step 5, write HistoryCarNumScheduleRedis license plate cache service. This service scans the redis cache queue in real time for tasks with a state of "1" in the queue. After scanning the task, it associates the card slot table to write the corresponding license plate numbers of all card slots that passed through the card slot on that day to the redis cache num queue after deduplication. When this service is running, no new tasks are allowed to enter, indicating that it is executing. After the license plate is written, the database task table corresponding to the date is modified to "3" and the redis corresponding date key is modified to "2", and the creating queue of the redis cluster records which day the current cache license plate belongs to. This step is to prepare for the same line monitoring according to the license plate slice.
[0054] Step 6, write the HistoryScheduleRedis same trip monitoring service for same trip monitoring for each vehicle, and output the same trip result and the output result to the redis cache service. This HistoryScheduleRedis same trip monitoring service scans the creating queue in the redis queue in real time to determine whether there is a date that needs to be processed, and if so, detects whether the num queue in the redis cache exists. 100 license plates are consumed from the num queue each time, and then same trip calculation is performed for each vehicle. Dynamic calculation condition parameters such as: full-amount of the camera, before and after same trip time, same trip duration, same trip distance, etc. (these parameters are saved in the database and can be dynamically modified rules to allow customers to dynamically modify rules) are obtained. The same trip times, same trip total duration, same trip maximum distance, and distance between each camera of the vehicle and other vehicles are queried from the vehicle camera table. The output result is batch cached to the redis queue, and the current statistical result is written to a LinkedBlockingQueue queue. Then, same trip detail record output and writing to the redis queue can be performed simultaneously (note: same trip detail record is a detailed record of A and B same trip N times, including the result parameters of the same trip statistics and the distance calculation between each card point). This service supports multiple application service deployment, and multiple services can consume the license plate queue simultaneously to perform same trip monitoring calculation. The service.num parameter in the propertie is configured to be the number of application services. The number of services that have been completed is recorded in the redis according to the number of application services. The number of completed services is compared with the number of parameters in the configuration file. If the numbers are equal, it means that the task has been executed. Then, the state of the corresponding date in the database task table is modified to 4, and the date is recorded in the completed date queue in the redis. For multiple application services, a HistoryScheduleRedis service application is separately deployed on each server to achieve license plate slicing (license plate slicing: multiple applications consume the redis license plate queue simultaneously), which greatly improves the efficiency of full-amount of the camera same trip monitoring result output.
[0055] Step 7, write the same trip data warehousing service. Each sub-polling scans whether there is data in the redis completed day queue. If there is, the same trip result and same trip detailed record in the redis queue are written to the database table according to the date of the queue. The same trip detailed record is recorded in the data table by day. Before execution, the data table task state is modified to 5 to control that there is a task running. After writing is completed, the data table task state is modified to 6. This service is separately deployed on a server to improve data writing efficiency. At this point, the same trip monitoring entire process has been completed.
[0056] To sum up, the same row monitoring method and system based on the total amount of the card hole in the application, through the establishment of a redis cluster to do the cache, with SpringBoot+Hikari+MyBatis+MySQL as the development framework of the distributed processing platform;From the task state table of the MySQL database, the task to be processed is extracted and stored in the redis cache queue of the redis cluster of the distributed processing platform;Scan the redis cache queue of the task to be processed, query the corresponding license plate number of the vehicle related to the task to be processed from the associated card hole table of the MySQL database, and write it to the redis cache num queue of the redis cluster after de-duplication;And query the card hole name and the card hole time of each vehicle license plate number corresponding vehicle from the vehicle card hole table of the MySQL database to calculate the same row result of each vehicle license plate number corresponding vehicle.The application can quickly filter out the accompanying vehicles meeting various conditions from the big data filtering level by building a distributed processing platform with a redis cluster to do the cache, with SpringBoot+Hikari+MyBatis+MySQL as the development framework.
[0057] The above only describes the preferred embodiments of the present application and is not intended to limit the present application. Those skilled in the art can make various modifications and changes to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A full-quantity bayonet-based peer monitoring method, characterized in that, The application relates to a distributed processing platform which comprises the following steps: a distributed processing platform is built by taking SpringBoot+Hikari+MyBatis+MySQL as a development framework and taking a redis cluster as a cache; a task state table of a MySQL database of the distributed processing platform is scanned at a fixed time, a to-be-processed task is extracted from the task state table, and the to-be-processed task is stored in a redis cache queue of the redis cluster of the distributed processing platform; a to-be-processed task in the redis cache queue is scanned, a license plate number corresponding to a vehicle of a to-be-processed task is queried from an associated card slot table of the MySQL database, and the license plate number is written into a redis cache num queue of the redis cluster after being deduplicated; a same-trip calculation rule is queried from the MySQL database, a card slot name and a card slot time of a vehicle corresponding to each license plate number in the redis cache num queue are queried from a vehicle card slot table of the MySQL database, and a same-trip result of the vehicle corresponding to each license plate number is calculated according to the same-trip calculation rule and the card slot name and the card slot time of the vehicle corresponding to each license plate number; a to-be-processed task is extracted from the task state table every time, and a first to-be-processed task is sorted in ascending order according to a date.
2. The full-volume based same-side monitoring method according to claim 1, wherein, after the same-trip result of the vehicle corresponding to each license plate number is calculated, the following steps are further included: a same-trip detail record of each same-trip vehicle is queried from the MySQL database according to the same-trip result of the vehicle corresponding to each license plate number, the same-trip result and the same-trip detail record are written into a redis queue of the redis cluster, and a completion date of the to-be-processed task is recorded in a completion date queue of the redis cluster; whether data exists in the completion date queue of the redis cluster is polled and scanned, if yes, the same-trip result and the same-trip detail record of the redis queue are written into a same-trip result table and a same-trip detail record table of a database table according to the date of the completion date queue.
3. The full volume bay-based co-monitoring method of claim 2, wherein, the task state table is used for recording a date of each day and a state of a task of each day, and the state of the task includes: to-be-processed, to-be-calculated for same-trip, to-be-completed, to-be-stored in a database and to-be-completed for storage; after the license plate number is written into the redis cache num queue of the redis cluster after being deduplicated, a state of the license plate on the task state table is modified as "to-be-calculated for same-trip"; after the same-trip result and the same-trip detail record are written into the redis queue of the redis cluster, states of the license plate numbers on the task state table are modified as "to-be-stored in a database"; after the same-trip result and the same-trip detail record are written into the redis queue of the redis cluster, states of the license plate numbers on the task state table are modified as "to-be-stored in a database"; When the same-line results and the same-line detailed records of the redis queue according to the date of the completion date queue are written into the same-line result table and the same-line detailed record table of the database table respectively, the state of each license plate number on the task state table is modified to "completed and stored".
4. The full-volume bay-based co-monitoring method of claim 3, wherein, The extracted to-be-processed task is taken as a key with its task generation time as a suffix, and the value is marked as to-be-processed. When the license plate numbers are written into the redis cache num queue of the redis cluster after being de-duplicated, the value of the to-be-processed task of the redis cache queue is marked as "processed".
5. The full volume bay-based co-monitoring method of claim 1, wherein, After the license plate numbers are written into the redis cache num queue of the redis cluster after being de-duplicated, the processing date of the current cache license plate is recorded in the creating queue of the redis cluster; whether the processing date of the cache license plate exists in the creating queue is scanned, if the processing date of the cache license plate exists, whether the redis cache num queue exists is detected, if the redis cache num queue exists, the same-line calculation rule is queried from the MySQL database, and the vehicle passing through the name of the pass-through portal and the time of passing through the pass-through portal corresponding to each license plate number in the redis cache num queue are queried from the vehicle pass-through portal table of the MySQL database.
6. The full-volume based booth monitoring method of claim 1, wherein, The same-line results of the vehicles corresponding to each license plate number are calculated according to the same-line calculation rule and the vehicle passing through the name of the pass-through portal and the time of passing through the pass-through portal corresponding to each license plate number, and the calculation is realized by a plurality of application servers.
7. A computer system comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor realizes the steps of the method of any one of claims 1 to 6 when the computer program is executed.
Citation Information
Patent Citations
Similar trajectory mining method and device on basis of massive license plate identification data
CN104778245A
Method and device for determining companion vehicle
CN108932839A