In order to enable those skilled in the art to better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
 The method for obtaining numbers based on the label system described in the embodiment of the present application is mainly aimed at the customer label system of the power grid. The power grid customer labeling system is mainly based on business expansion, copy verification and collection, customer service, power outage, metering, usage inspection, demand side and other related businesses, sort out the main business and data objects, and screen out the typical business related to users Processes and data, thus formulating reasonable and scientific labels and labeling rules, and then calculating the label value according to the labeling rules, and organizing the labels according to the hierarchical relationship and association relationship, and finally forming a relatively complete and comprehensive labeling system. like figure 1 As shown in the label catalog diagram, the label system set up for each customer in the power grid can be divided into three categories of first-level labels, namely basic labels, behavior labels and prediction labels, and each type of first-level labels can include several second-level labels , For example, the basic label includes 7 secondary labels such as basic attributes, customer labels, and metering labels, and each secondary label includes several labels. For example, the basic attributes include 27 labels. The basic label is the attribute that the user presents objectively, rather than the internal attribute of the user. It can include 53 labels, such as user category, electricity consumption category, industry attribute, number of power outages, number of arrears, etc.; behavior label is based on the user's basic attributes Describe the user's historical status and characterize the user's behavior, which can include 50 tags, such as channel preferences, electricity time preferences, complaint preferences, etc.; prediction tags are attributes that predict future user characteristics based on basic attributes and behavior attributes, which can include 5 Labels, such as credit rating, value rating, credit risk, etc. It should be understood that this application is not limited to figure 1 The creation schema for the tags directory is shown. This embodiment only briefly introduces the grid customer labeling system, and the detailed construction method of the grid customer labeling system can refer to the associated patent filed on the same day as this application. It should be noted that the method for obtaining numbers described in this application can also be applied to other types of labeling systems, and is not limited to the grid customer labeling system described here.
 Table 1 is a detailed list of tags in the power grid customer tagging system. The first-level classification in the table is "behavior tags", and several second-level classifications are included in the "behavior tags", such as the "arrears behavior" shown in Table 1. ; Under "Arrears Behavior", several labels are included, such as "Arrears Frequency", "Arrears Amount", "Payment Timeliness" and "Collection Status". Each label corresponds to several label rules. For example, under the label rule of "the ratio of the number of arrears of this user to the number of receivable electricity charges in the past two years" is greater than 60%, the label value of "Arrears Frequency" is "High frequency type", that is, each label rule corresponds to a label value. The label type is a calculated label, and a calculated label is a label obtained by performing a relatively complex statistical analysis on the data. Table 1 is just an example of the grid customer labeling system, in which information such as classification, labeling, labeling rules, and labeling values at all levels can be formulated according to different practical applications, so it should not be limited to that shown in Table 1.
 Table 1
 like figure 2 As shown, the embodiment of the present application provides a method for obtaining numbers based on the tag system, the method comprising:
 Step S101, acquiring tag information. Tag information includes tags, tag rules, and tag logical relationships.
Taking the grid customer labeling system as an example, assuming that the label information is ((the user type is a residential user) and (zero electricity for three consecutive months) and (meter reading occurs (default) or (removal of meter) or (box rotten) or (sundries Blockage))). Among them, if the user type is a label, then the resident user is the label value of "user type", "zero battery for three consecutive months" is the label rule, "breach of contract", "removal of the meter", "rotten box" and "blocked by debris" It is the tag value under the meter reading tag. "AND", "OR" and/or "NOT" can be used to express the logical relationship between each label, label value and/or label rule. Since each tag rule corresponds to a tag value, the tag value can be used directly in the tag information, or the tag rule can be used, or the two forms can be used in combination. The specific tag information construction form can be determined according to the actual data retrieval requirements. This implementation Examples are not limited.
 Step S102, converting the label information into a simulated query statement, and generating a query request.
 Using the label information, first generate a simulated query statement, the simulated query statement TQL is presented in a form similar to SQL (Structured Query Language, Structured Query Language), but does not represent a specific SQL language. This method can not only quickly convert the simulated query language into a query statement that matches the database, but also solve the problem that the query calculation process is complicated due to the depth of grammatical rules in the query statement bound to a single database. For the label information shown in step S101, this embodiment provides an exemplary simulated query statement, as follows: SELECT yhhxbq.yhbh AS yhbh, yhhxbq.yhmc AS yhmc, yhhxbq.yddz AS yddz, yhhxbq.jcsx_lxdhas lxdh ,yhhxbq.jcsx_yhlb AS jcsx_yhlb,yhhxbq.jcsx_ydlb AS jcsx_ydlb,yhhxbq.jcsx_dydj AS jcsx_dydj,yhhxbq.jcsx_jlfs AS jcsx_jlfs,yhhxbq.jcsx_htrlAS jcsx_htrl,yhhxbq.jcsx_fhdj AS jcsx_fhdj,yhhxbq.jcsx_ghnfl AS jcsx_ghnfl,yhhxbq.jcsx_zglx AS jcsx_zglx,yhhxbq. jcsx_dqbm AS jcsx_dqbm,yhhxbq.jcsx_dylxAS jcsx_dylx,yhhxbq.jcsx_cxbz AS jcsx_cxbz,yhhxbq.jcsx_khfq AS jcsx_khfq,yhhxbq.jcsx_jtlx AS jcsx_jtlx,yhhxbq.jcsx_schyhbz AS jcsx_schyhbz,yhhxbq.jcsx_gddwbm AS jcsx_gddwbm,yhhxbq.jcsx_gddw AS jcsx_gddw,yhhxbq.jcsx_dyijfl AS jcsx_dyijfl ,yhhxbq.jcsx_derjfl AS jcsx_derjfl,yhhxbq.jcsx_dsajfl ASjcsx_dsajfl,yhhxbq.jcsx_dsijfl ASjcsx_dsijfl,yhhxbq.jcsx_yxrl AS jcsx_yxrl,yhhxbq.jcsx_lsydbz AS jcsx_lsydbz,yhhxbq.jcsx_glyskh AS jcsx_glyskh,yhhxbq.jcsx_zbdy AS jcsx_zbdy,yhhxbq.jcsx_xbyh AS jcsx_xbyh,yhhxbq.jcsx_gkkyhAS jcsx_gkkyh,yhhxbq.jcsx_cjbyh AS jcsx_cjbyh,yhhxbq.jcsx_yfflx AS jcs x_yfflx,yhhxbq.jcsx_htsx AS jcsx_htsx,yhhxbq.jcsx_zjlx AS jcsx_zjlx,yhhxbq.jcsx_hyfl AS jcsx_hyfl,yhhxbq.jcsx_fsjfbz AS jcsx_fsjfbz,yhhxbq.jcsx_fkjfbz AS jcsx_fkjfbz,yhhxbq.chs_jfdl AS chs_jfdl,yhhxbq.chs_jfrl AS chs_jfrl,yhhxbq.chs_jfxl AS chs_jfxl, yhhxbq.chs_ysdf AS chs_ysdf,yhhxbq.chs_sjllAS chs_sjll,yhhxbq.chs_ssdf AS chs_ssdf,yhhxbq.chs_daxgcs AS chs_daxgcs,yhhxbq.chs_bmxgcs AS chs_bmxgcs,yhhxbq.chs_cbzqxgcs AS chs_cbzqxgcs,yhhxbq.chs_xsxgcs AS chs_xsxgcs,yhhxbq.chs_cbzfcs AS chs_cbzfcs,yhhxbq.chs_jbfxgcs AS chs_jbfxgcs,yhhxbq.chs_ynsljj AS chs_ynsljj,yhhxbq.yek_ptgc ASyek_ptgc,yhhxbq.yek_khgc AS yek_khgc,yhhxbq.yek_gclx AS yek_gclx,yhhxbq.yek_ybgc AS yek_ybgc,yhhxbq.yek_bzsxyy AS yek_bzsxyy,yhhxbq.kef_zjkfgdlx AS kef_zjkfgdlx,yhhxbq.kef_jyykfcs AS kef_jyykfcs, yhhxbq.kef_zjychwqd AS kef_zjychwqd,yhhxbq.tid_zjtdsj AS tid_zjtdsj,yhhxbq.tid_zjtdyy AS tid_zjtdyy,yhhxbq.tid_jqtdsj AS tid_jqtdsj,yhhxbq.jil_dnb AS jil_dnb,yhhxbq.jil_jlzdhzdAS jil_jlzdhzd,yhhxbq.jil_fy AS jil_fy,yhhxbq.ji l_jlg AS jil_jlg,yhhxbq.jil_jlbx AS jil_jlbx,yhhxbq.jil_hgq AS jil_hgq,yhhxbq.jil_lhcs AS jil_lhcs,yhhxbq.jil_cjcs AS jil_cjcs,yhhxbq.jil_ljcs AS jil_ljcs,yhhxbq.jil_gzclcs ASjil_gzclcs,yhhxbq.jil_zjxcjy AS jil_zjxcjy,yhhxbq.jil_zjyxjy AS jil_zjyxjy ,yhhxbq.yoj_bgddj AS yoj_bgddj,yhhxbq.yoj_ydaqdj AS yoj_ydaqdj,yhhxbq.yoj_zjyjsj AS yoj_zjyjsj,yhhxbq.yoj_hhbz AS yoj_hhbzFROM yhhxbq WHERE 1=1ANDyhhxbq.jcsx_ydlb='居民生活'AND yhhxbq.ydxw_cbycpfx in('箱烂','违约' ,'Dismantling the watch','The road is blocked by sundries') AND(yhhxbq.ydxw_ldl LIKE'% zero battery for 3 consecutive months%').
 In this embodiment, the query request includes header information and body information, the header information includes database identifiers, data entity identifiers, and target query range information, and the body information is the simulated query statement. Further, the header information also includes data authority level, organization code and response time limit; the target query range information includes query quantity and query page number. Wherein, the response time limit is used to indicate that when the response time of the query request exceeds the response time limit, the request timeout information is fed back, and the request timeout information is used to indicate that the query request is re-initiated, that is, when the response time limit is exceeded , Need to feed back the request timeout information. After the client receives the request timeout information, it will not wait aimlessly, but will re-initiate a query request, or report the request timeout to the user, so that the user can understand the response status of the query request. The following will give an example of the header information of the query request:
 In the example of the above header information, "schemaCode": "ads" represents the database ID; "entity": "yhhxbq" represents the data entity ID; "pageNo":100 represents the query page number; "pageSize":15 represents the number of queries; "timeout": 45000 represents the response time limit; "access": "1" represents the data permission level; "administration": "0501" represents the organization code; the tql statement is the simulated query statement.
 Step S103, determining a target database matching the query request.
 After responding to the query request, it is necessary to determine the target database matching the query request. Specifically, according to the database identifier and the data entity identifier indicated by the header information of the query request, the target database matching the query request is determined. After the target database is determined, the query statement type corresponding to the target database can be determined, so as to determine how to compile the simulated query statement.
 Step S104, compiling the simulated query statement into a target query statement corresponding to the target database according to the instruction of the query request.
 Optionally, according to the data authority level and organization code indicated by the header information of the query request, the data range allowed to be queried is determined, and the data range allowed to be queried is the maximum data range that the user can query within the authority. Among them, the data permission level includes: all data, data of the company and below, data of the company, data of the department and below, department data, personal data only, and detailed settings; Into the target query statement, so that the target database obtains the data matching the label information from the data range allowed to be queried. In this embodiment, data security access control is performed through permissions, which can control users' access to tag data resources and ensure safe data access.
 In the header information of the query request, the target query range information includes the query quantity and the query page number, and the query quantity is the number of data pieces contained in each page of the data table in the target database, then the method also includes: combining the query quantity and the query page number Perform multiplication to obtain the initial number of records, and the target database uses the initial number of records as the query starting point to obtain data corresponding to the query quantity. The following will show the partial content in the target query statement:
 dwyhhxmx_ads_db.yhhxmxgj_yhhx_jcbq_tenant_10001_13_18_dtboost_yhhxbq.jcsx_ydlb='residential life' AND
dwyhhxmx_ads_db.yhhxmxgj_yhhx_xwbq_tenant_10001_13_18_dtboost_yhhxbq.ydxw_cbycpfx IN('Bad box','Breach of contract','Removal of table','Debris blocking the road')
 AND(dwyhhxmx_ads_db.yhhxmxgj_yhhx_xwbq_tenant_10001_13_18_dtboost_yhhxbq.ydxw_ldl LIKE'%连续3月零电量%'))yhhxbq WHERE 1=1AND yhhxbq.yhhxbq_jcsx_ydlb='居民生活'AND yhhxbq.yhhxbq_ydxw_cbycpfx IN('箱烂','违约','拆表 ','Debris blocked the road') AND(yhhxbq.yhhxbq_ydxw_ldl LIKE'% zero battery for 3 consecutive months%') limit 1500,15
 Among them, "pageNo":100 indicates that the query page number is the 100th page, "pageSize":15 indicates that the number of queries is 15, then the initial number of items is 100×15=1500, then in the target query statement, limit 1500,15 Indicates that starting from the 1500th item in the data table of the target database, a total of 15 items of data are queried. When generating the target query statement, it is necessary to recompile the simulated query statement, convert it into a language structure and type that matches the target database, and write the header information of the query request, the data range allowed to be queried, and the number of initial records. into the target query statement. In this embodiment, the label information is converted into a simulated query statement. After the target database is determined, the simulated query statement is compiled into a corresponding target query statement, so that the application system is decoupled from the database, and the business end and the data end are not bound together. No matter how close it is, the complexity of fetching data is reduced, and it is convenient to maintain the application later.
 Step S105, transmitting the target query statement to the target database, and acquiring data matching the label information through the target database.
 As an optimization solution of this embodiment, the target database may include two types, the first type is a relational database, and the second type is an analytical database of an MPP (Massively Parallel Processing, massively parallel processing) architecture. The relational database is used to store and calculate label data with low possibility of change, such as user electricity category data in basic labels. The analytical database of the MPP architecture is used to store and calculate highly variable label data, such as the arrears behavior data in the behavior label. As time goes by, the user's arrears behavior data is constantly updated and changed, so it needs Real-time calculation and analysis. For the tag data with large variability, some of the data calculations take a long time and need to be stored in the offline analysis database after calculation, and the other part does not require a long calculation time and requires high real-time data. The database of the MPP architecture performs calculations. Therefore, the analytical database of the MPP architecture is a comprehensive database that integrates the functions of the MPP architecture database and the offline analysis database. Data fetching calculations based on the above two types of databases can effectively improve the speed and efficiency of data fetching.
 After the target database query calculation is completed, the query results of the target database are integrated, that is, the query results of the relational database and the query results of the analytical database of the MPP architecture are integrated to obtain complete data that matches the label information. The data matching the label information includes: a customer information table matching the label information and customer data corresponding to each item of customer information in the customer information table. The customer information table includes multiple pieces of customer information, and each piece of customer information corresponds to a customer involved in the labeling system, that is, the customer information is used to identify the customer, and multiple pieces of customer information are summarized in the form of a list. Each item of customer information has corresponding customer data, where customer data includes basic information, historical behavior data, and tag values of tags created for customers. For the grid customer labeling system, historical behavior data includes but is not limited to payment behavior, channel preference, customer service and electricity consumption; basic information includes user name, user number, electricity address, contact information and other information. In order to facilitate the user's query and browsing, in this embodiment, optionally, the data matching the tag information is displayed in a visual interface.
 In a specific implementation, the data retrieval method provided by the present application can be divided into three layers for execution, which are respectively a data layer, a service layer and a presentation layer. like image 3 As shown, first, in the display layer: the user obtains tag information from the tag system on the visual application interface of the display layer according to his/her own data access requirements; converts the tag information into a simulated query statement, and generates a query request; Call the query interface of the service layer and send the query request to the service layer.
 Second, in the service layer: according to the data authority level and organization code indicated by the query request, determine the data range allowed to be queried; determine the target database matching the query request; compile the simulated query statement into a target query corresponding to the target database statement, and transfer the target query statement to the target database.
 Thirdly, in the data layer: the target database uses the target query statement to perform calculations, and sends the query result of the target database to the service layer.
 Fourth, in the service layer, the query results of the target database are integrated to obtain the data matching the tag information, and the data matching the tag information is sent to the display layer.
 Fifth, in the display layer: display the data matching the tag information to the user. Since the customer information table lists multiple customer information matching the label information, the user can select any item of customer information in the table as needed when fetching the data, and the information corresponding to the customer information will be automatically displayed in the display layer. Corresponding customer data. For example, for the grid customer labeling system, Figure 4 An example of displaying customer data in the display layer is given. Several panels can be set in the visual interface of the display layer. For example, the user details panel displays the "label value of the label created for the customer" in the customer data, and the basic information panel displays the customer. The "basic information" in the data, the historical behavior data display section is used to respectively display the data corresponding to "payment behavior", "channel preference", "customer service" and "power consumption". In this way, the query results can be displayed to the user in a more orderly and clear manner, which is convenient for the user to query and browse. It should be noted that the display setting of the display layer for the data matching the label information is not limited to this embodiment and Figure 4 As shown, those skilled in the art can plan and set according to actual application requirements.
 It can be seen from the above technical solutions that the method for obtaining data based on the label system provided by this application can be carried out on the basis of a relatively complete, comprehensive and continuously dynamically updated grid customer label system. The key business is built, so the accuracy of data extraction is high. The target databases used in the data retrieval process include relational databases and analytical databases with MPP architecture. The advantages of all major databases are integrated to speed up the operation speed and data retrieval. efficiency. Convert the label information into a simulated query statement. After the target database is determined, the simulated query statement is compiled into the corresponding target query statement, so that the application system is decoupled from the database, and the business end and the data end are no longer bound so tightly, reducing the It reduces the complexity of fetching numbers and facilitates later maintenance of the application. In addition, this embodiment also provides data security access control at the service layer, and provides data security protection by controlling user access to tag data resources. Moreover, in the display layer, the data matching the tag information is visually displayed, and corresponding display panels are set up, which can facilitate user query and reading.
 Those skilled in the art can clearly understand that the technologies in the embodiments of the present application can be implemented by means of software plus a necessary general-purpose hardware platform. In a specific implementation, the present application also provides a computer storage medium, wherein the computer storage medium can store a program, and when the program is executed, it can include part or all of the embodiment of the tag system-based number retrieval method provided by the present application. step. The computer storage medium may be a magnetic disk, an optical disk, a read-only memory (English: read-only memory, ROM for short), or a random access memory (English: random access memory, RAM for short), and the like.
 Other embodiments of the invention will be readily apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present invention, these modifications, uses or adaptations follow the general principles of the present invention and include common knowledge or conventional technical means in the technical field not disclosed in the present invention . The specification and examples are considered to be exemplary only, and do not constitute a limitation to the protection scope of the present invention. The true scope and spirit of the invention is indicated by the appended claims.