Law enforcement document automatic generation method

By using software robots to automatically process law enforcement document data and generate documents, the problems of slow and erroneous document production in monopoly cases have been solved, and efficient and accurate automatic document generation has been achieved.

CN120688466APending Publication Date: 2025-09-23HENAN TOBACCO CO ZHENGZHOU CO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510793903.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-13
Publication Date
2025-09-23

AI Technical Summary

Technical Problem

The production of existing law enforcement documents for monopoly cases is slow, inefficient and prone to errors, which affects the fairness of the documents.

Method used

Through software robots, we can capture law enforcement document configuration files and data files, use Pandas to associate and match item data, calculate the case value, determine legal provisions and discretionary standards, use the Jinja2 engine to fill in templates to generate documents, and optimize the sorting process.

Benefits of technology

It has greatly improved the timeliness and accuracy of the production of law enforcement documents for monopoly cases, provided efficient and reliable tool support, reduced the production time to 4.6 minutes per copy, and increased efficiency by 8794.34%.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120688466A_ABST
    Figure CN120688466A_ABST
Patent Text Reader

Abstract

The invention discloses a law enforcement document automatic generation method, and relates to the technical field of document making. The method comprises the following steps of: capturing a law enforcement document configuration file, a monopoly item data file, a case basic information file and a case-related item data file from an item monopoly supervision system through a software robot, associating matched case-related items and monopoly items, and automatically calculating to obtain a case value based on a matching result; then, according to the case data, the case value amount, the judgment of applicable legal provisions and the judgment of applicable tailoring standards, calling a law enforcement document template library by utilizing a Jinja2 engine, carrying out field information automatic filling on law enforcement document templates in the library so as to render and generate a plurality of different law enforcement documents, and finally, according to the document sorting configuration information, setting the law enforcement documents according to the document sorting configuration information. According to the method, the plurality of different law enforcement documents are sorted, and the document sorting results are combined to obtain the law enforcement document data packet associated with the file number, so that the timeliness and the accuracy of handling an article monopoly administrative penalty case can be greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of document production, and specifically relates to a method for automatically generating law enforcement documents. Background Art

[0002] In the management of monopoly of commodities such as tobacco and salt, dozens of different monopoly case law enforcement documents need to be issued according to management requirements, such as administrative penalty decisions, case filing report forms, lists of sampled evidence items and case investigation completion reports.

[0003] At present, the existing method of producing law enforcement documents for monopoly cases is mainly manual entry. Not only does it have the problems of slow production speed, long time required (according to statistics, the production of law enforcement documents for monopoly cases with different causes takes 405 minutes per case) and low efficiency, but it is also easy to cause errors in content due to human negligence, affecting the fairness of the law enforcement documents.

[0004] Therefore, under the technical background of being guided by the strategy of strengthening enterprises with digital technology and requiring the active promotion of innovative applications of digital integration, how to quickly and automatically generate law enforcement documents for monopoly cases in order to improve the timeliness and accuracy of handling administrative penalty cases for commodity monopolies, and provide more efficient and reliable tool support for monopoly managers, thereby achieving a higher level of digital development goals, is a topic that technical personnel in this field urgently need to study. Summary of the Invention

[0005] The purpose of the present invention is to provide a method, device, computer equipment, computer-readable storage medium and computer program product for automatically generating law enforcement documents, so as to solve the problems of slow production speed, long time required, low efficiency and easy human error in the existing method of producing law enforcement documents for monopoly cases.

[0006] In order to achieve the above object, the present invention adopts the following technical solutions:

[0007] In a first aspect, a method for automatically generating law enforcement documents is provided, comprising:

[0008] Capturing law enforcement document configuration files, monopoly item data files, case basic information files, and case-related item data files from the monopoly item supervision system using a software robot, wherein the monopoly item data files include the product name, barcode, wholesale price, and suggested retail price of each monopoly item; the case basic information files include law enforcement officer data, party data, and case data associated with the case file number; and the case-related item data files include the product name, barcode, and quantity of each case-related item associated with the case file number;

[0009] For each of the items involved in the case, based on the corresponding product name and barcode and the product name and barcode of each of the monopoly items, use the open source data analysis library Pandas' data structure Dataframe to associate the monopoly items in the monopoly item data file that match the corresponding item;

[0010] Calculate the case value using a calculation function that is pre-built based on the Decimal data type and is used to calculate the case value based on the quantity of each item involved in the case and the wholesale price and suggested retail price of the corresponding matching monopoly items;

[0011] Based on the case data, use conditional logic to determine the applicable legal provisions from the legal document database;

[0012] Based on the amount of the case, the applicable discretionary standard is determined from the discretionary standard database using rule selection;

[0013] Using the Jinja2 engine to call the law enforcement document template library, and based on the law enforcement officer data, the party data, the case data, the case item data, the applicable legal provisions, and the applicable discretionary standards, automatically filling in the field information of the law enforcement document templates in the library, so as to render and generate multiple different law enforcement documents;

[0014] According to the document sorting configuration information in the law enforcement document configuration file, the multiple different law enforcement documents are sorted, and the document sorting results are merged to obtain the law enforcement document data package associated with the case file number.

[0015] Based on the above invention content, a fully automatic generation solution for monopoly law enforcement documents is provided, namely, first, a software robot is used to capture the law enforcement document configuration file, monopoly item data file, case basic information file and case-related item data file from the goods monopoly supervision system, and then the matched case-related items and monopoly items are associated, and the case value amount is automatically calculated based on the matching result, and then the applicable legal provisions and applicable discretionary standards are determined according to the case data and the case value amount, and then the Jinja2 engine is used to call the law enforcement document template library, and the field information of the law enforcement document template in the library is automatically filled in, so as to render and generate multiple different law enforcement documents, and finally, according to the document sorting configuration information, the multiple different law enforcement documents are sorted, and the document sorting results are merged to obtain the law enforcement document data package associated with the case file number, thereby greatly improving the timeliness and accuracy of the handling of administrative penalty cases for goods monopoly, and thus providing more efficient and reliable tool support for monopoly personnel, which is convenient for practical application and promotion.

[0016] In one possible design, when no proprietary item is found in the proprietary item data file and matches an item involved in the case in the item data file, the method further includes the following steps S201 to S202:

[0017] S201. Using the Python-based HTTP library Requests, an HTTP request is sent to the internet to search for a specific item matching the item in question, and a response HTML document is received. Then, step S202 is executed, wherein the HTTP request includes the product name and barcode of the item in question.

[0018] S202 uses the Python library BeautifulSoup to parse the HTML document and determine whether the product name, barcode, wholesale price and suggested retail price of a certain monopoly item exist in the parsed result. If so, execute step S203; otherwise, return to step S201;

[0019] S203. Add the product name, barcode, wholesale price and suggested retail price of a certain monopoly item to the monopoly item data file, and then execute step S204;

[0020] S204. For the item involved in the case, based on the corresponding product name and barcode and the product names and barcodes of each monopoly item in the monopoly item data file, use the data structure Dataframe to re-associate the monopoly items in the monopoly item data file that match the corresponding item, and then execute step S205.

[0021] S205. If no monopoly item is found in the monopoly item data file and matches an item involved in the case in the item data file, the process returns to step S201.

[0022] In one possible design, when the number of times step S201 is performed on the item involved in the case exceeds a preset number threshold, the method further includes:

[0023] Sending a request message to the goods monopoly management terminal for applying for approval of the wholesale price and the suggested retail price of the goods involved in the case, and receiving the approval result fed back by the goods monopoly management terminal;

[0024] Adding the product name and barcode of the item involved in the case, as well as the wholesale price and suggested retail price extracted from the verification result, to the proprietary goods data file;

[0025] For the item involved in the case, based on the corresponding product name and barcode and the product name and barcode of each monopoly item in the monopoly item data file, the data structure Dataframe is used to again associate the monopoly items in the monopoly item data file that match the corresponding item.

[0026] In one possible design, sorting the multiple different law enforcement documents according to the document sorting configuration information in the law enforcement document configuration file includes:

[0027] According to the document sorting configuration information in the law enforcement document configuration file, the multiple different law enforcement documents are sorted, and the ECRS analysis method is used to optimize the process during the sorting process to reduce the number of document movements. The multiple different law enforcement documents include law enforcement documents generated according to the case filing stage, investigation and evidence collection stage, trial and decision stage, and case closing and archiving stage.

[0028] In one possible design, rule selection is used to determine applicable discretionary standards from a discretionary standards database, including:

[0029] Using rule selection to determine the initial applicable discretionary standards from the discretionary standards database;

[0030] According to the discretionary configuration information in the law enforcement document configuration file, the initial applicable discretionary standard is adjusted to obtain the final applicable discretionary standard, wherein the discretionary configuration information includes an indication value for indicating whether a heavier penalty, a medium penalty, a lighter penalty or a default penalty is to be imposed.

[0031] In one possible design, rule selection is used to determine applicable discretionary standards from a discretionary standards database, including:

[0032] Using rule selection to determine the initial applicable discretionary standards from the discretionary standards database;

[0033] Extracting the reporting time, the crime time, the crime location, the suspected cause of the case, and the case classification from the case data, and combining the extraction results with the case value into a first vector;

[0034] Performing an ANN vector search on a vector library based on the first vector to obtain at least one second vector that is similar to the first vector and whose similarity exceeds a preset similarity threshold, wherein the second vector is pre-derived based on a combination of the reporting time, the crime time, the crime location, the suspected cause of the case, the case characterization, and the case value in a historically generated law enforcement document data packet and pre-added to the vector library;

[0035] If the total number of the at least one second vector is lower than a first preset number threshold, adjusting the initial applicable discretionary standard to a lighter penalty to obtain a final applicable discretionary standard;

[0036] If the total number of the at least one second vector is greater than a second preset number threshold, adjusting the initial applicable discretion standard to a heavier penalty to obtain a final applicable discretion standard, wherein the second preset number threshold is greater than the first preset number threshold;

[0037] If the total number of vectors of the at least one second vector is greater than or equal to the first preset number threshold and less than or equal to the second preset number threshold, the initial applicable discretion standard is adjusted to a medium / default penalty to obtain a final applicable discretion standard.

[0038] In a second aspect, a device for automatically generating law enforcement documents is provided, comprising an active file capture unit, an item association matching unit, a case value calculation unit, an applicable law provision determination unit, an applicable discretion determination unit, a law enforcement document generation unit, and a law enforcement document sorting unit;

[0039] The source file capture unit is used to capture law enforcement document configuration files, monopoly item data files, case basic information files, and case-related item data files from the monopoly item supervision system through a software robot, wherein the monopoly item data files contain the product name, barcode, wholesale price, and suggested retail price of each monopoly item; the case basic information files contain law enforcement officer data, party data, and case data associated with the case file number; and the case-related item data files contain the product name, barcode, and quantity of each case-related item associated with the case file number;

[0040] The item association and matching unit is communicatively connected to the source file capture unit and is configured to associate, for each item involved in the case, the monopoly items in the monopoly item data file that match the corresponding item based on the corresponding product name and barcode and the product name and barcode of each monopoly item using the data structure Dataframe of the open source data analysis library Pandas;

[0041] The case value calculation unit is communicatively connected to the item association matching unit and is configured to calculate the case value using a calculation function pre-established based on the Decimal data type and configured to calculate the case value based on the quantity of each item involved in the case and the wholesale price and suggested retail price of the corresponding matching monopoly item;

[0042] The applicable law determination unit is communicatively connected to the source file capture unit and is used to determine the applicable law from the legal document database based on the case data using conditional logic;

[0043] The applicable discretion determination unit is communicatively connected to the case value calculation unit and is configured to determine the applicable discretion standard from the discretion standard database using rule selection based on the case value;

[0044] The law enforcement document generation unit is communicatively connected to the source file capture unit, the applicable law provision determination unit, and the applicable discretion determination unit, and is configured to use the Jinja2 engine to call the law enforcement document template library, and automatically fill in the field information of the law enforcement document templates in the library based on the law enforcement personnel data, the party data, the case data, the case item data, the applicable law provision, and the applicable discretion standard, so as to render and generate a plurality of different law enforcement documents;

[0045] The law enforcement document sorting unit is communicatively connected to the source file capture unit and the law enforcement document generation unit, respectively, and is used to sort the multiple different law enforcement documents according to the document sorting configuration information in the law enforcement document configuration file, and merge the document sorting results to obtain the law enforcement document data packet associated with the case file number.

[0046] In a third aspect, the present invention provides a computer device comprising a memory, a processor and a transceiver which are communicatively connected in sequence, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the method for automatically generating law enforcement documents as described in the first aspect or any possible design of the first aspect.

[0047] In a fourth aspect, the present invention provides a computer-readable storage medium having instructions stored thereon. When the instructions are run on a computer, the method for automatically generating law enforcement documents as described in the first aspect or any possible design of the first aspect is executed.

[0048] In a fifth aspect, the present invention provides a computer program product, comprising a computer program or instructions, which, when executed by a computer, implements the method for automatically generating law enforcement documents as described in the first aspect or any possible design of the first aspect.

[0049] Beneficial effects of the above scheme:

[0050] (1) The present invention creatively provides a fully automatic generation scheme for monopoly law enforcement documents, namely, firstly, a software robot is used to capture the law enforcement document configuration file, the monopoly goods data file, the case basic information file and the data file of the goods involved in the case from the goods monopoly supervision system, then the matched goods involved in the case and the monopoly goods are associated, and the case value amount is automatically calculated based on the matching result, and then the applicable legal provisions and the applicable discretionary standards are determined according to the case data and the case value amount, and then the Jinja2 engine is used to call the law enforcement document template library, and the field information of the law enforcement document template in the library is automatically filled in so as to render and generate multiple different law enforcement documents, and finally, the multiple different law enforcement documents are sorted according to the document sorting configuration information, and the document sorting results are merged to obtain the law enforcement document data package associated with the case file number, thereby greatly improving the timeliness and accuracy of the handling of administrative penalty cases for goods monopoly, and thus providing more efficient and reliable tool support for monopoly personnel, which is convenient for practical application and promotion. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0052] Figure 1 A flowchart of the method for automatically generating law enforcement documents provided in an embodiment of the present application.

[0053] Figure 2 An example diagram of the activity results of the automatic generation method of law enforcement documents provided in an embodiment of the present application before and after implementation.

[0054] Figure 3 A schematic diagram of the structure of the automatic law enforcement document generation device provided in an embodiment of the present application.

[0055] Figure 4 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0056] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the present invention will be briefly introduced below in conjunction with the drawings and the description of the embodiments or the prior art. Obviously, the following description of the structures of the drawings is only some embodiments of the present invention. For those skilled in the art, other embodiments can be obtained based on these embodiments without creative work. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention.

[0057] It should be understood that although the terms first, second, etc. may be used herein to describe various objects, these objects should not be limited by these terms. These terms are merely used to distinguish one object from another. For example, a first object can be referred to as a second object, and similarly, a second object can be referred to as a first object without departing from the scope of the exemplary embodiments of the present invention.

[0058] It should be understood that the term "and / or" that may appear in this document is merely a description of the association relationship between associated objects, indicating that there may be three relationships. For example, A and / or B can indicate three situations: A exists alone, B exists alone, or A and B exist at the same time. For another example, A, B and / or C can indicate the existence of any one of A, B and C or any combination of them. The term " / and" that may appear in this document describes another type of association object relationship, indicating that there may be two relationships. For example, A / and B can indicate two situations: A exists alone or A and B exist at the same time. In addition, the character " / " that may appear in this document generally indicates that the previous and next associated objects are in an "or" relationship.

[0059] Example

[0060] like Figure 1 As shown, the method for automatically generating law enforcement documents provided in the first aspect of this embodiment can be, but is not limited to, executed by a computer device with certain computing resources, such as a cloud server, a personal computer (PC, a multi-purpose computer with a size, price, and performance suitable for personal use; desktops, laptops, small laptops, tablets, and ultrabooks are all personal computers), a smart phone, a personal digital assistant (PDA), or a wearable device. Figure 1 As shown, the method for automatically generating law enforcement documents may include, but is not limited to, the following steps S1 to S7.

[0061] S1. Capture law enforcement document configuration files, monopoly item data files, case basic information files, and case-related item data files from the monopoly item supervision system through software robots, wherein the monopoly item data files include but are not limited to the product name, barcode, wholesale price, and suggested retail price of each monopoly item; the case basic information files include but are not limited to the law enforcement personnel data, party data, and case data associated with the case file number; the case-related item data files include but are not limited to the product name, barcode, and quantity of each case-related item associated with the case file number.

[0062] In the step S1, the article monopoly supervision system can specifically be, but not limited to, a tobacco or salt monopoly supervision system, such as the Henan Province Tobacco Monopoly Supervision Subsystem, which supports functions such as retailer management and case handling of tobacco monopoly administrative penalty cases. The software robot is an existing RPA (Robotic Process Automation) data acquisition technology that automatically captures, cleans and integrates data from multiple sources such as web pages, systems or files by simulating manual operations. It has the advantages of high efficiency, accuracy and low cost, and is widely used in e-commerce, finance and manufacturing and other fields. Therefore, after inputting the target case file number, the software robot can routinely capture, but not limited to, the law enforcement document configuration file, the monopoly article data file, the case basic information file and the case-related article data file from the article monopoly supervision system. Specifically, the law enforcement document configuration file is used to record user configuration information such as document sorting configuration information and discretionary configuration information; the law enforcement officer data contains content such as the name of the department to which the relevant law enforcement officer belongs, the abbreviation / unique identifier of the department to which he belongs, his name and law enforcement certificate number; the party data contains content such as the name, gender, place of residence, ID number and contact information of the party involved in the case; the case data contains content such as the time of reporting, time of occurrence, address of occurrence, suspected cause of action (for example, causes such as not being in the local area, unlicensed transportation, illegal production and unlicensed operation) and case characterization. In addition, since the barcode of the monopoly item is mainly used to identify the identity information, production date and retail source of the corresponding product, for example, the tobacco barcode is usually a 32-bit inkjet code, which contains information such as the sorting date, region code and retail license number, it also needs to be recorded in the monopoly item data file and the case item data file.

[0063] S2. For each of the items involved in the case, based on the corresponding product name and barcode as well as the product name and barcode of each of the monopoly items, use the data structure Dataframe of the open source data analysis library Pandas to associate the monopoly items in the monopoly item data file that match the corresponding item.

[0064] In step S2, Pandas is a powerful open-source data analysis library in Python (a high-level assembly language) specifically designed for efficiently processing structured data (such as tabular data and time series), providing functions such as data cleaning, conversion, statistical analysis, and visualization. DataFrame is a core data structure in Pandas, similar to a two-dimensional table or data table in a database. Therefore, the data structure Dataframe of the open-source data analysis library Pandas can be used to associate the items involved in the case with the monopoly items, which can not only improve the data matching accuracy (according to experimental statistics, the data matching accuracy rate reaches 100%), but also shorten the time required for data matching (according to experimental statistics, the average matching time is ≤0.1 minutes). Considering that the monopoly item data file may contain incomplete monopoly item data, in order to ensure successful matching and enrich the monopoly item data file, preferably, when there is no monopoly item associated with the monopoly item data file and matching with a certain item involved in the case in the monopoly item data file, the method further includes but is not limited to the following steps S201 to S205.

[0065] S201. Using the Python-based HTTP library Requests, send an HTTP request to the Internet for searching for exclusive items that match the item involved in the case, receive a feedback HTML document, and then execute step S202, wherein the HTTP request includes but is not limited to the product name and barcode of the item involved in the case.

[0066] In step S201, Requests is a simple and intuitive API (Application Programming Interface) designed specifically for humans, making it easy to send HTTP (Hypertext Transfer Protocol) requests. Furthermore, HTML (Hypertext Markup Language) documents can be routinely queried and returned.

[0067] S202. Use the Python library BeautifulSoup to parse the HTML document and determine whether the product name, barcode, wholesale price and suggested retail price of a certain monopoly item are present in the parsed result. If so, execute step S203; otherwise, return to execute step S201.

[0068] In step S202, BeautifulSoup is a Python library for parsing HTML and XML (Extensible Markup Language) documents, and is often used to extract data from HTML.

[0069] S203. Add the product name, barcode, wholesale price and suggested retail price of the certain monopoly item to the monopoly item data file, and then execute step S204.

[0070] S204. For the item involved in the case, based on the corresponding product name and barcode and the product name and barcode of each monopoly item in the monopoly item data file, use the data structure Dataframe to again associate the monopoly items in the monopoly item data file that match the corresponding item, and then execute step S205.

[0071] S205. If no monopoly item is found in the monopoly item data file and matches an item involved in the case in the item data file, the process returns to step S201.

[0072] Based on the above steps S201 to S205, the missing data of the exclusive items can be supplemented by accessing the Internet. However, considering that the missing data cannot be supplemented after multiple visits, in order to avoid frequent access to the Internet, it is further preferred that when the number of times step S201 is executed for the item involved exceeds a preset number threshold (for example, 9 times), the method also includes but is not limited to the following steps S21 to S23.

[0073] S21. Sending a request message to the goods monopoly management terminal for applying for approval of the wholesale price and suggested retail price of the certain goods involved in the case, and receiving the approval result fed back by the goods monopoly management terminal.

[0074] In step S21, the monopoly management terminal is an electronic device, such as a mobile phone or tablet, held by a monopoly administrator (e.g., a provincial or municipal bureau official responsible for tobacco monopoly supervision). The verification result includes the wholesale price and suggested retail price determined by the monopoly administrator for the item in question. Furthermore, the request message also includes, but is not limited to, the product name and barcode of the item in question.

[0075] S22. Add the product name and barcode of the item involved in the case, as well as the wholesale price and suggested retail price extracted from the verification result, to the exclusive item data file.

[0076] S23. For the item involved in the case, based on the corresponding product name and barcode and the product name and barcode of each monopoly item in the monopoly item data file, use the data structure Dataframe to again associate the monopoly items in the monopoly item data file that match the corresponding item.

[0077] S3. Calculate the case value using a calculation function that is pre-built based on the data type Decimal and is used to calculate the case value based on the quantity of each item involved in the case and the wholesale price and suggested retail price of the corresponding matching monopoly items.

[0078] In step S3, the Decimal type is a data type used to represent high-precision decimal numbers, suitable for scenarios requiring high-precision calculations. Based on the calculation function (the specific formula can be designed based on actual circumstances), a high-precision case value can be calculated. Furthermore, the case value specifically includes, but is not limited to, the amount of illegal operations and illegal income. After obtaining the case value, it is also necessary to convert it from Arabic numerals to uppercase numerals.

[0079] S4. Based on the case data, use conditional logic to determine the applicable legal provisions from the legal document database.

[0080] In step S4, since the case data contains information such as the time of reporting, the time of occurrence, the location of occurrence, the suspected cause of action (e.g., causes such as not being in the local area, unlicensed transportation, illegal production and unlicensed operation), and the nature of the case, it is possible to routinely determine whether the logical conditions of a certain legal provision are met based on this data. If so, the legal provision is used as the applicable legal provision. In addition, the legal document database can be conventionally constructed in advance based on legal and regulatory provisions such as the Tobacco Monopoly Law and the Regulations for the Implementation of the Tobacco Monopoly Law.

[0081] S5. Based on the case value, use the rules to select and determine the applicable discretionary standards from the discretionary standards database.

[0082] In step S5, the applicable discretionary standard is the specific penalty ratio and / or specific penalty level determined based on information such as the case value. The discretionary standard database can be pre-established based on documents such as the "Henan Province Tobacco Monopoly Administrative Discretion Standards." Considering that law enforcement officers have a certain degree of discretion, in order to achieve the goal of customizing discretionary benchmarks, it is preferred to use rule selection to determine the applicable discretionary standard from the discretionary standard database, including but not limited to the following steps S511-S512.

[0083] S511. Use rule selection to determine the initial applicable discretionary standard from the discretionary standard database.

[0084] S512. According to the discretionary configuration information in the law enforcement document configuration file, the initial applicable discretionary standard is adjusted to obtain the final applicable discretionary standard, wherein the discretionary configuration information includes but is not limited to an indication value for indicating whether a heavier penalty, a medium penalty, a lighter penalty or a default penalty is imposed.

[0085] In step S512, for example, if the indicator value indicates a heavier penalty, the initial applicable discretionary standard is adjusted to a heavier penalty, such as increasing the penalty ratio or increasing the degree of penalty; and if the indicator value indicates a lighter penalty, the initial applicable discretionary standard is adjusted to a lighter penalty, such as reducing the penalty ratio or reducing the degree of penalty.

[0086] In step S5, in order to make the final applicable discretionary standard adaptive to the current case handling environment (for example, if a large number of cases of a certain cause occur in a short period of time, it is necessary to impose a heavier penalty to curb them, and if a small number of cases of a certain cause occur in a short period of time, it is necessary to impose a lighter penalty to show leniency), preferably, the applicable discretionary standard is determined from the discretionary standard database using rule selection, including but not limited to the following steps S521 to S526.

[0087] S521. Use rule selection to determine the initial applicable discretionary standard from the discretionary standard database.

[0088] S522. Extract the reporting time, crime time, crime location, suspected cause of the case and case characterization from the case data, and combine the extraction results with the case value into a first vector.

[0089] S523. Perform an ANN vector search on the vector library based on the first vector to obtain at least one second vector that is similar to the first vector and whose similarity exceeds a preset similarity threshold, wherein the second vector is pre-derived based on a combination of the reporting time, crime time, crime address, suspected cause of the case, case characterization, and case value in a historically generated law enforcement document data packet, and is pre-added to the vector library.

[0090] In step S523, the ANN (Approximate Nearest Neighbor) vector search is an existing technology for similarity searches in large datasets. It is primarily used to quickly find data items similar to the query object in large datasets. This technology has applications in many fields, including vector databases, search enhancement generation, large-scale information retrieval, recommender systems, drug discovery, and image search. The core of ANN vector search lies in using efficient indexing and search algorithms to approximately find the nearest neighbors in a dataset (note, it does not accurately find the nearest neighbors). This approximate method allows for a certain degree of error while ensuring search efficiency, thereby significantly improving search speed when processing large datasets. In general, ANN vector retrieval technology uses efficient indexing and search algorithms, as well as specific graph methods such as HNSW (Hierarchical Navigable Small World Graph, a graph method for vector retrieval that is based on the idea of ​​skip lists and achieves efficient approximate nearest neighbor search by constructing a navigable small world graph. It organizes data using a navigable small world graph at each layer to form a hierarchical structure, allowing the retrieval process to gradually approach the target vector space from top to bottom, thereby improving search efficiency. During the graph construction process, HNSW can ensure the connectivity of the graph by trimming edges, ensuring the smooth progress of the search process). This can significantly improve the efficiency of similarity searches in large-scale datasets while ensuring a certain degree of accuracy in the retrieval results. Therefore, by performing ANN vector retrieval on the vector library based on the first vector, accurate and efficient retrieval results can be obtained.

[0091] S524. If the total number of the at least one second vector is lower than a first preset number threshold, a lighter penalty adjustment is performed on the initial applicable discretionary standard to obtain a final applicable discretionary standard.

[0092] In step S524, the total number of vectors reflects the number of similar cases. Furthermore, the magnitude of the lighter penalty adjustment may be positively correlated with the difference between the first predetermined number threshold and the total number of vectors: a larger difference indicates a greater magnitude of the lighter penalty (e.g., a lower penalty ratio).

[0093] S525. If the total number of vectors of the at least one second vector is higher than a second preset number threshold, a heavier penalty adjustment is made to the initial applicable discretion standard to obtain a final applicable discretion standard, wherein the second preset number threshold is higher than the first preset number threshold.

[0094] In step S525, the increase in the heavier penalty adjustment may be positively correlated with the difference between the total number of vectors and the second preset number threshold: the larger the difference, the greater the increase (eg, the higher the penalty ratio).

[0095] S526. If the total number of vectors of the at least one second vector is greater than or equal to the first preset number threshold and less than or equal to the second preset number threshold, the initial applicable discretion standard is adjusted to a medium / default penalty to obtain a final applicable discretion standard.

[0096] S6. Use the Jinja2 engine to call the law enforcement document template library, and automatically fill in the field information of the law enforcement document template in the library based on the law enforcement personnel data, the party data, the case data, the data of the items involved in the case, the applicable legal provisions and the applicable discretionary standards, so as to render and generate multiple different law enforcement documents.

[0097] In step S6, the Jinja2 engine is a template engine based on Python, and its functions are similar to PHP's smarty or J2ee's Freemarker and velocity. In this way, the Jinja2 engine is used to call the law enforcement document template library and automatically fill in the field information of the law enforcement document templates in the library. This can not only ensure the accuracy of the document (according to experimental statistics, the accuracy of the document can reach 100%), but also effectively shorten the time consumed in document generation (according to experimental statistics, the average time consumed in document generation for each case is ≤0.1min), and achieve the purpose of document modification. Specifically, the multiple different law enforcement documents include but are not limited to law enforcement documents generated according to the case filing stage, investigation and evidence collection stage, trial and decision stage, and case closing and archiving stage. In addition, the law enforcement document templates in the law enforcement document template library can be obtained by pre-designing Word documents using OCR (Optical Character Recognition) technology, and the law enforcement document template library can be edited based on the Jinja2 engine.

[0098] S7. Sort the multiple different law enforcement documents according to the document sorting configuration information in the law enforcement document configuration file, and merge the document sorting results to obtain the law enforcement document data package associated with the case file number.

[0099] In step S7, considering that different case values ​​will correspond to different numbers of law enforcement documents and document sorting, when the law enforcement document configuration file records multiple different document sorting configuration information corresponding to multiple different case value ranges, it is necessary to first determine the range from the multiple different case value ranges according to the case value, and then sort the multiple different law enforcement documents according to the document sorting configuration information corresponding to the range. In order to optimize the sorting algorithm to reduce the sorting error rate, the average number of document movements per case, and the sorting time, preferably, the multiple different law enforcement documents are sorted according to the document sorting configuration information in the law enforcement document configuration file, including but not limited to: sorting the multiple different law enforcement documents according to the document sorting configuration information in the law enforcement document configuration file, and using the ECRS analysis method to optimize the process during the sorting process to reduce the number of document movements, wherein the multiple different law enforcement documents include but are not limited to law enforcement documents generated according to the case filing stage, the investigation and evidence collection stage, the trial and decision stage, and the case closing and archiving stage. The aforementioned ECRS analysis method is one of the four major principles used for process optimization in industrial engineering. It consists of Eliminate, Combine, Rearrange, and Simplify. It aims to improve production or management efficiency through system analysis. Therefore, by applying this embodiment across different fields, the aforementioned optimization goals can be achieved (according to experimental statistics, the sorting error rate is 0%, the average number of document movements in each case is ≤70, and the sorting time is ≤0.1min). In addition, the generation log of the law enforcement document data packet can be recorded, and a download link for the law enforcement document data packet can be provided. The law enforcement documents can also be divided into ordinary documents and multi-copy documents. The generated ordinary documents can be printed directly, while the multi-copy documents can be printed using a dot matrix printer.

[0100] Based on the automatic generation method of law enforcement documents described in steps S1 to S7 above, in order to further investigate the effectiveness of activities after the results are released, the applicant also conducted experimental statistics on the time consumed in generating law enforcement documents from January to March 2025. The specific statistical data are shown in Tables 1 and Figure 2 As shown:

[0101] Table 1. Activity results survey based on the automatic generation method of law enforcement documents described in this embodiment

[0102]

[0103] Based on the above Table 1 and Figure 2It can be seen that according to the statistical data after the activity, the time required for preparing monopoly law enforcement documents was shortened to 4.6 minutes, and according to the statistical data during the tracking period, the time required for preparing monopoly law enforcement documents was shortened to 4.5 minutes. That is, through this embodiment, the average time required for preparing law enforcement documents can be reduced from 405 minutes / copy to about 4.6 minutes / copy, and the efficiency is improved by 8794.34%, which greatly improves the timeliness and accuracy of handling administrative penalty cases for commodity monopolies, and can provide more efficient and reliable tool support for monopoly personnel.

[0104] Therefore, based on the automatic generation method of law enforcement documents described in the above steps S1 to S7, a fully automatic generation solution for monopoly law enforcement documents is provided, that is, first, the law enforcement document configuration file, monopoly item data file, case basic information file and case-related item data file are captured from the goods monopoly supervision system by a software robot, and then the matched case-related items and monopoly items are associated, and the case value amount is automatically calculated based on the matching results, and then the applicable legal provisions and applicable discretionary standards are determined according to the case data and the case value amount, and then the Jinja2 engine is used to call the law enforcement document template library, and the field information of the law enforcement document template in the library is automatically filled in to render and generate multiple different law enforcement documents, and finally, according to the document sorting configuration information, the multiple different law enforcement documents are sorted, and the document sorting results are merged to obtain the law enforcement document data package associated with the case file number, which can greatly improve the timeliness and accuracy of the handling of administrative penalty cases for goods monopoly, and thus provide more efficient and reliable tool support for monopoly personnel, which is convenient for practical application and promotion.

[0105] like Figure 3 As shown, the second aspect of this embodiment provides a virtual device for implementing the method for automatically generating law enforcement documents described in the first aspect, comprising an active file capture unit, an item association matching unit, a case value calculation unit, an applicable law determination unit, an applicable discretion determination unit, a law enforcement document generation unit, and a law enforcement document sorting unit;

[0106] The source file capture unit is used to capture law enforcement document configuration files, monopoly item data files, case basic information files, and case-related item data files from the monopoly item supervision system through a software robot, wherein the monopoly item data files contain the product name, barcode, wholesale price, and suggested retail price of each monopoly item; the case basic information files contain law enforcement officer data, party data, and case data associated with the case file number; and the case-related item data files contain the product name, barcode, and quantity of each case-related item associated with the case file number;

[0107] The item association and matching unit is communicatively connected to the source file capture unit and is configured to associate, for each item involved in the case, the monopoly items in the monopoly item data file that match the corresponding item based on the corresponding product name and barcode and the product name and barcode of each monopoly item using the data structure Dataframe of the open source data analysis library Pandas;

[0108] The case value calculation unit is communicatively connected to the item association matching unit and is configured to calculate the case value using a calculation function pre-established based on the Decimal data type and configured to calculate the case value based on the quantity of each item involved in the case and the wholesale price and suggested retail price of the corresponding matching monopoly item;

[0109] The applicable law determination unit is communicatively connected to the source file capture unit and is used to determine the applicable law from the legal document database based on the case data using conditional logic;

[0110] The applicable discretion determination unit is communicatively connected to the case value calculation unit and is configured to determine the applicable discretion standard from the discretion standard database using rule selection based on the case value;

[0111] The law enforcement document generation unit is communicatively connected to the source file capture unit, the applicable law provision determination unit, and the applicable discretion determination unit, and is configured to use the Jinja2 engine to call the law enforcement document template library, and automatically fill in the field information of the law enforcement document templates in the library based on the law enforcement personnel data, the party data, the case data, the case item data, the applicable law provision, and the applicable discretion standard, so as to render and generate a plurality of different law enforcement documents;

[0112] The law enforcement document sorting unit is communicatively connected to the source file capture unit and the law enforcement document generation unit, respectively, and is used to sort the multiple different law enforcement documents according to the document sorting configuration information in the law enforcement document configuration file, and merge the document sorting results to obtain the law enforcement document data packet associated with the case file number.

[0113] The working process, working details and technical effects of the aforementioned device provided in the second aspect of this embodiment can be found in the method for automatically generating law enforcement documents described in the first aspect, and will not be repeated here.

[0114] like Figure 4As shown, the third aspect of this embodiment provides a computer device for executing the method for automatically generating law enforcement documents as described in the first aspect, including a memory, a processor and a transceiver that are sequentially connected in communication, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program to execute the method for automatically generating law enforcement documents as described in the first aspect or the possible design one. For example, the memory may include, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a flash memory, a first-in-first-out memory (FIFO) and / or a first-in-last-out memory (FILO), etc.; the processor may include, but is not limited to, a microprocessor of the STM32F105 series. In addition, the computer device may also include, but is not limited to, a power module, a display screen and other necessary components.

[0115] The working process, working details and technical effects of the aforementioned computer equipment provided in the third aspect of this embodiment can be found in the method for automatically generating law enforcement documents described in the first aspect, and will not be repeated here.

[0116] A fourth aspect of this embodiment provides a computer-readable storage medium storing instructions including the method for automatically generating law enforcement documents as described in the first aspect. Specifically, the computer-readable storage medium stores instructions that, when executed on a computer, execute the method for automatically generating law enforcement documents as described in the first aspect. The computer-readable storage medium refers to a data storage medium, which may include, but is not limited to, a floppy disk, an optical disk, a hard disk, a flash memory, a USB flash drive, and / or a memory stick. The computer may be a general-purpose computer, a dedicated computer, a computer network, or other programmable device.

[0117] The working process, working details and technical effects of the aforementioned computer-readable storage medium provided in the fourth aspect of this embodiment can be referred to the method for automatically generating law enforcement documents as described in the first aspect, and will not be repeated here.

[0118] A fifth aspect of this embodiment provides a computer program product, including a computer program or instructions, which, when executed by a computer, implements the method for automatically generating law enforcement documents as described in the first aspect. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.

[0119] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention shall be included in the scope of protection of the present invention.

Claims

1. A method for automatically generating law enforcement documents, characterized in that: include: Capturing law enforcement document configuration files, monopoly item data files, case basic information files, and case-related item data files from the monopoly item supervision system using a software robot, wherein the monopoly item data files include the product name, barcode, wholesale price, and suggested retail price of each monopoly item; the case basic information files include law enforcement officer data, party data, and case data associated with the case file number; and the case-related item data files include the product name, barcode, and quantity of each case-related item associated with the case file number; For each of the items involved in the case, based on the corresponding product name and barcode and the product name and barcode of each of the monopoly items, use the open source data analysis library Pandas' data structure Dataframe to associate the monopoly items in the monopoly item data file that match the corresponding item; Calculate the case value using a calculation function that is pre-built based on the Decimal data type and is used to calculate the case value based on the quantity of each item involved in the case and the wholesale price and suggested retail price of the corresponding matching monopoly items; Based on the case data, use conditional logic to determine the applicable legal provisions from the legal document database; Based on the amount of the case, the applicable discretionary standard is determined from the discretionary standard database using rule selection; Using the Jinja2 engine to call the law enforcement document template library, and based on the law enforcement officer data, the party data, the case data, the case item data, the applicable legal provisions, and the applicable discretionary standards, automatically filling in the field information of the law enforcement document templates in the library, so as to render and generate multiple different law enforcement documents; According to the document sorting configuration information in the law enforcement document configuration file, the multiple different law enforcement documents are sorted, and the document sorting results are merged to obtain the law enforcement document data package associated with the case file number.

2. The method for automatically generating law enforcement documents according to claim 1, characterized in that: When there is no monopoly item associated with the monopoly item data file and matching an item involved in the case in the item data file, the method further includes the following steps S201 to S202: S201. Using the Python-based HTTP library Requests, an HTTP request is sent to the internet to search for a specific item matching the item in question, and a response HTML document is received. Then, step S202 is executed, wherein the HTTP request includes the product name and barcode of the item in question. S202 uses the Python library BeautifulSoup to parse the HTML document and determine whether the product name, barcode, wholesale price and suggested retail price of a certain monopoly item exist in the parsed result. If so, execute step S203; otherwise, return to step S201; S203. Add the product name, barcode, wholesale price and suggested retail price of a certain monopoly item to the monopoly item data file, and then execute step S204; S204. For the item involved in the case, based on the corresponding product name and barcode and the product names and barcodes of each monopoly item in the monopoly item data file, use the data structure Dataframe to re-associate the monopoly items in the monopoly item data file that match the corresponding item, and then execute step S205. S205. If no monopoly item is found in the monopoly item data file and matches an item involved in the case in the item data file, the process returns to step S201.

3. The method for automatically generating law enforcement documents according to claim 2, characterized in that: When the number of times step S201 is executed for the item involved in the case exceeds a preset number threshold, the method further includes: Sending a request message to the goods monopoly management terminal for applying for approval of the wholesale price and the suggested retail price of the goods involved in the case, and receiving the approval result fed back by the goods monopoly management terminal; Adding the product name and barcode of the item involved in the case, as well as the wholesale price and suggested retail price extracted from the verification result, to the proprietary goods data file; For the item involved in the case, based on the corresponding product name and barcode and the product name and barcode of each monopoly item in the monopoly item data file, the data structure Dataframe is used to again associate the monopoly items in the monopoly item data file that match the corresponding item.

4. The method for automatically generating law enforcement documents according to claim 1, characterized in that: Sorting the plurality of different law enforcement documents according to the document sorting configuration information in the law enforcement document configuration file includes: According to the document sorting configuration information in the law enforcement document configuration file, the multiple different law enforcement documents are sorted, and the ECRS analysis method is used to optimize the process during the sorting process to reduce the number of document movements. The multiple different law enforcement documents include law enforcement documents generated according to the case filing stage, investigation and evidence collection stage, trial and decision stage, and case closing and archiving stage.

5. The method for automatically generating law enforcement documents according to claim 1, characterized in that: Use rule selection to determine applicable discretionary standards from the discretionary standards database, including: Using rule selection to determine the initial applicable discretionary standards from the discretionary standards database; According to the discretionary configuration information in the law enforcement document configuration file, the initial applicable discretionary standard is adjusted to obtain the final applicable discretionary standard, wherein the discretionary configuration information includes an indication value for indicating whether a heavier penalty, a medium penalty, a lighter penalty or a default penalty is to be imposed.

6. The method for automatically generating law enforcement documents according to claim 1, characterized in that: Use rule selection to determine applicable discretionary standards from the discretionary standards database, including: Using rule selection to determine the initial applicable discretionary standards from the discretionary standards database; Extracting the reporting time, the crime time, the crime location, the suspected cause of the case, and the case classification from the case data, and combining the extraction results with the case value into a first vector; Performing an ANN vector search on a vector library based on the first vector to obtain at least one second vector that is similar to the first vector and whose similarity exceeds a preset similarity threshold, wherein the second vector is pre-derived based on a combination of the reporting time, the crime time, the crime location, the suspected cause of the case, the case characterization, and the case value in a historically generated law enforcement document data packet and pre-added to the vector library; If the total number of the at least one second vector is lower than a first preset number threshold, adjusting the initial applicable discretionary standard to a lighter penalty to obtain a final applicable discretionary standard; If the total number of the at least one second vector is greater than a second preset number threshold, adjusting the initial applicable discretion standard to a heavier penalty to obtain a final applicable discretion standard, wherein the second preset number threshold is greater than the first preset number threshold; If the total number of vectors of the at least one second vector is greater than or equal to the first preset number threshold and less than or equal to the second preset number threshold, the initial applicable discretion standard is adjusted to a medium / default penalty to obtain a final applicable discretion standard.

7. A device for automatically generating law enforcement documents, characterized in that: It includes an active file capture unit, an item association matching unit, a case value calculation unit, an applicable law provision determination unit, an applicable discretion determination unit, an enforcement document generation unit, and an enforcement document sorting unit; The source file capture unit is used to capture law enforcement document configuration files, monopoly item data files, case basic information files, and case-related item data files from the monopoly item supervision system through a software robot, wherein the monopoly item data files contain the product name, barcode, wholesale price, and suggested retail price of each monopoly item; the case basic information files contain law enforcement officer data, party data, and case data associated with the case file number; and the case-related item data files contain the product name, barcode, and quantity of each case-related item associated with the case file number; The item association and matching unit is communicatively connected to the source file capture unit and is configured to associate, for each item involved in the case, the monopoly items in the monopoly item data file that match the corresponding item based on the corresponding product name and barcode and the product name and barcode of each monopoly item using the data structure Dataframe of the open source data analysis library Pandas; The case value calculation unit is communicatively connected to the item association matching unit and is configured to calculate the case value using a calculation function pre-established based on the Decimal data type and configured to calculate the case value based on the quantity of each item involved in the case and the wholesale price and suggested retail price of the corresponding matching monopoly item; The applicable law determination unit is communicatively connected to the source file capture unit and is used to determine the applicable law from the legal document database based on the case data using conditional logic; The applicable discretion determination unit is communicatively connected to the case value calculation unit and is configured to determine the applicable discretion standard from the discretion standard database using rule selection based on the case value; The law enforcement document generation unit is communicatively connected to the source file capture unit, the applicable law provision determination unit, and the applicable discretion determination unit, and is configured to use the Jinja2 engine to call the law enforcement document template library, and automatically fill in the field information of the law enforcement document templates in the library based on the law enforcement personnel data, the party data, the case data, the case item data, the applicable law provision, and the applicable discretion standard, so as to render and generate a plurality of different law enforcement documents; The law enforcement document sorting unit is communicatively connected to the source file capture unit and the law enforcement document generation unit, respectively, and is used to sort the multiple different law enforcement documents according to the document sorting configuration information in the law enforcement document configuration file, and merge the document sorting results to obtain the law enforcement document data packet associated with the case file number.

8. A computer device, characterized in that: It includes a memory, a processor and a transceiver that are communicatively connected in sequence, wherein the memory is used to store computer programs, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the method for automatically generating law enforcement documents as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are run on a computer, the method for automatically generating law enforcement documents as described in any one of claims 1 to 6 is executed.

10. A computer program product comprising a computer program or instructions, characterized in that When executed by a computer, the computer program or the instruction implements the method for automatically generating law enforcement documents as described in any one of claims 1 to 6.