Xiaopeng Zhang 3 månader sedan
förälder
incheckning
2a6ac14daa
2 ändrade filer med 151 tillägg och 132 borttagningar
  1. 12 12
      main.py
  2. 139 120
      subdir/db.py

+ 12 - 12
main.py

@@ -158,14 +158,14 @@ class Zjcs(BaseModel):
 @app.post("/outline2")
 async def read_root2(info: Info, user=Depends(manager)):
     
-    return await db.getOutline(client, info.name)
+    return await db.getOutline(client, info.name, user)
 
 
 
 @app.post("/detail2")
 async def read_detail2(info: Info, user=Depends(manager)):
     
-    return await db.getDetail(client, info.name)
+    return await db.getDetail(client, info.name, user)
 
 
 
@@ -306,12 +306,12 @@ async def read_djcs(item : Zjcs, user=Depends(manager)):
 
 @app.post("/files2/")
 async def read_files2(user=Depends(manager)):
-    result = await db.list_files(client)
+    result = await db.list_files(client, user)
     return result
 
 @app.post("/deleteFile/")
 async def delete(r: Info, user=Depends(manager)):
-    result = await db.delete_files(client, r.name)
+    result = await db.delete_files(client, r.name, user)
     return result
 
 @app.get("/qingdanshu/{zhuanye}")
@@ -540,7 +540,7 @@ async def cankao():
 
 @app.post("/qufei/")
 async def read_qufei(r: Info, user=Depends(manager)):
-    return await db.getQufei(client, r.name)
+    return await db.getQufei(client, r.name, user)
 
 @app.post("/jiagongcai/")
 async def read_jiagongcai(r: Info, user=Depends(manager)):
@@ -915,13 +915,13 @@ async def save(r: Info, user=Depends(manager)):
 async def statistics(r: Info, user=Depends(manager)):
     
     ##print(data)
-    return await db.statistics(client, r.name)
+    return await db.statistics(client, r.name, user)
 
 @app.post("/zujia/")
 async def zujia(r: Info, user=Depends(manager)):
     
     ##print(data)
-    return await db.zujia(client, r.name)
+    return await db.zujia(client, r.name, user)
 
 @app.post("/tuijian/")
 async def tuijian(r: Info, user=Depends(manager)):
@@ -934,7 +934,7 @@ async def tuijian(r: Info, user=Depends(manager)):
 async def frequency(r: InfoWithID, user=Depends(manager)):
     
     ##print(data)
-    return await db.frequency(client, r.name, r.id)
+    return await db.frequency(client, r.name, r.id, user)
 
 
 @app.post("/savedjcs/")
@@ -984,7 +984,7 @@ async def upload(file: Annotated[UploadFile, File()], token: Annotated[str, Form
     if file.filename.endswith('13jz') or file.filename.endswith("13jt"):
         content = await file.read()
         string = content.decode('utf-8')
-        await resolve(string)
+        await resolve(string, user)
         return [file.filename]
     elif file.filename.endswith("jszf"):
         content = await file.read()
@@ -1007,7 +1007,7 @@ async def upload(file: Annotated[UploadFile, File()], token: Annotated[str, Form
         for entry in dir_list:
             if entry.endswith("13jz"):
                 with open(os.path.join("tmp", tmp, entry), 'r') as f:
-                    await resolve(f.read()) 
+                    await resolve(f.read(), user) 
 
         return [file.filename]
     else:
@@ -1045,8 +1045,8 @@ async def download_file(item_id, user=Depends(manager)):
 
 
 
-async def resolve(data):
-    await db.resolve(data, client)##manager.send_personal_message(f"You wrote: {data}", websocket)
+async def resolve(data, user):
+    await db.resolve(data, user, client)##manager.send_personal_message(f"You wrote: {data}", websocket)
 
 
 ##@app.websocket("/ws")

+ 139 - 120
subdir/db.py

@@ -5,7 +5,7 @@ import uuid
 from datetime import datetime
 import numpy as np
 import re
-
+from fastapi import HTTPException, status
 
 ###############helper##################
 
@@ -438,13 +438,14 @@ def getRcjbc(rcj):
 
 
 ######################end of helper ########################
-async def resolve(data, client):
+async def resolve(data, user, client):
     
     root = ET.fromstring(data)
     ##print(root)
 
     Dwgcbh = []
     jingjibiao = {}
+    jingjibiao['user'] = user
     jingjibiao['visible'] = False
     jingjibiao['created'] = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
     jingjibiao["BiaoDuanNO"] = root.attrib["BiaoDuanNO"]
@@ -583,7 +584,7 @@ async def resolve(data, client):
                         
                             
                         child['azfytag'] = []###常规定额
-                            
+                qd['user'] = user          
                 await collection.insert_one(qd)
             
 
@@ -598,7 +599,7 @@ async def resolve(data, client):
             children.append({"名称" : dwgc['Dwgcmc'], "工程类型":"",  "工程类别": "", "管理费(%)": "", "利润(%)": "","备注":"", "key" : dwgc['Dwgcbh']})
         newone["children"] = children
         result.append(newone)
-    await collection.insert_one({"biao_id": biao_id, "qufei": [{
+    await collection.insert_one({"biao_id": biao_id, "user": user, "qufei": [{
         "名称" : document['Xmmc'], "工程类型":"", "工程类别": "", "管理费(%)": "", "利润(%)": "","备注":"", "key" : str(uuid.uuid4()), "children" : result
     }]})
 
@@ -1070,20 +1071,20 @@ async def build(client, root, id):
 
 ############################end of build xml file#################################
 
-async def delete_files(client, id):
+async def delete_files(client, id, user):
     db = client["baojia"]
     collection = db["jingjibiao"]
     result = []
-    await collection.update_one({'_id': ObjectId(id)}, {'$set': {'visible': False}})
+    await collection.update_one({'_id': ObjectId(id), 'user': user}, {'$set': {'visible': False}})
     return result
 
 
 
-async def list_files(client):
+async def list_files(client, user):
     db = client["baojia"]
     collection = db["jingjibiao"]
     result = []
-    async for post in collection.find({"visible": True}):
+    async for post in collection.find({"visible": True, 'user': user}):
         result.append([str(post['_id']), post["Xmmc"], post['created'] if 'created' in post else ""])
     return result
 
@@ -1123,12 +1124,18 @@ def getDwgc(id, Zylb):
     return result
 
 
-async def getOutline(client, id):
+async def getOutline(client, id, user):
 
 
     db = client["baojia"]
     collection = db["jingjibiao"]
     document = await collection.find_one({'_id': ObjectId(id)})
+    if document['user'] != user:
+        raise HTTPException(
+           status_code=status.HTTP_401_UNAUTHORIZED,
+           detail="Invalid credentials",
+           headers={"WWW-Authenticate": "Basic"},
+        )
     result = []
     if 'TouBiaoXx' in document:
         result.append({"id" : "TouBiaoXx", "label" : "投标信息" })
@@ -1142,12 +1149,18 @@ async def getOutline(client, id):
             result.append({"id" : dxgc['Dxgcbh'], "label" : dxgc['Dxgcmc'], "children" : result2})
     return result
         
-async def getDetail(client, id):
+async def getDetail(client, id, user):
 
 
     db = client["baojia"]
     collection = db["jingjibiao"]
     document = await collection.find_one({'_id': ObjectId(id)})
+    if document['user'] != user:
+        raise HTTPException(
+           status_code=status.HTTP_401_UNAUTHORIZED,
+           detail="Invalid credentials",
+           headers={"WWW-Authenticate": "Basic"},
+        )
     result = []
     ##result.append(["名称", "金额", "暂估价", "安全文明施工费", "规费"])
     if 'TouBiaoXx' in document:
@@ -1358,10 +1371,16 @@ async def getDingercj(client, name, bh, bt, qdbm, debm):
 
 
 
-async def getQufei(client, id):
+async def getQufei(client, id, user):
     db = client["baojia"]
     collection = db["qufei"]
     document = await collection.find_one({'biao_id': id})
+    if document['user'] != user:
+        raise HTTPException(
+           status_code=status.HTTP_401_UNAUTHORIZED,
+           detail="Invalid credentials",
+           headers={"WWW-Authenticate": "Basic"},
+        )
     return document['qufei']
 
 async def searchde(client, zhuanye, text):
@@ -2504,12 +2523,12 @@ async def tuijian(client, query):##default return 10 neighbors
 
 
 
-async def zujia(client, query):
+async def zujia(client, query, user):
     db = client["baojia"]
     collection = db["qdxm"]
     regex_pattern1 = re.compile("^"+query, re.IGNORECASE)
     result = {}
-    async for post in collection.find({'清单编码': {"$regex" : regex_pattern1}, "__children.0": {"$exists" : 1} }):
+    async for post in collection.find({'清单编码': {"$regex" : regex_pattern1}, "user": user, "__children.0": {"$exists" : 1} }):
         t = []
         name = []
         for entry in post["__children"]:
@@ -2525,7 +2544,7 @@ async def zujia(client, query):
             result[key] = {"count": 1, "name" : names, "unit" : post["单位"], "price" : post["综合单价"]}
     return [{"id" : x, "组价定额" : x[0:x.rfind("@")], "数量" : result[x]["count"], "定额名称" : result[x]["name"], "单位" : result[x]['unit'], "综合单价" : result[x]['price']} for x in result.keys()]
 
-async def statistics(client, query):
+async def statistics(client, query, user):
     
     db = client["baojia"]
     collection = db["qdxm"]
@@ -2541,11 +2560,11 @@ async def statistics(client, query):
         regex_pattern4 = re.compile("^04", re.IGNORECASE)
         regex_pattern5 = re.compile("^05", re.IGNORECASE)
 
-        tj = await collection.count_documents({'清单编码': regex_pattern1})
-        fg = await collection.count_documents({'清单编码': regex_pattern2})
-        az = await collection.count_documents({'清单编码': regex_pattern3})
-        sz = await collection.count_documents({'清单编码': regex_pattern4})
-        yl = await collection.count_documents({'清单编码': regex_pattern5})
+        tj = await collection.count_documents({'清单编码': regex_pattern1, "user" : user})
+        fg = await collection.count_documents({'清单编码': regex_pattern2, "user" : user})
+        az = await collection.count_documents({'清单编码': regex_pattern3, "user" : user})
+        sz = await collection.count_documents({'清单编码': regex_pattern4, "user" : user})
+        yl = await collection.count_documents({'清单编码': regex_pattern5, "user" : user})
     
         return [["工程类别", "清单数"],
     ["建筑与装饰工程", tj],
@@ -2582,18 +2601,18 @@ async def statistics(client, query):
         regex_pattern12 = re.compile("^0114", re.IGNORECASE)
         
 
-        total = await collection.count_documents({'清单编码': regex_pattern1})
-        tsf = await collection.count_documents({'清单编码': regex_pattern2})
-        ldm = await collection.count_documents({'清单编码': regex_pattern3})
-        zj = await collection.count_documents({'清单编码': regex_pattern4})
-        qz = await collection.count_documents({'清单编码': regex_pattern5})
-        hnt = await collection.count_documents({'清单编码': regex_pattern6})
-        js = await collection.count_documents({'清单编码': regex_pattern7})
-        qzm = await collection.count_documents({'清单编码': regex_pattern8})
-        mc = await collection.count_documents({'清单编码': regex_pattern9})
-        wm = await collection.count_documents({'清单编码': regex_pattern10})
-        tp = await collection.count_documents({'清单编码': regex_pattern11})
-        yq = await collection.count_documents({'清单编码': regex_pattern12})
+        total = await collection.count_documents({'清单编码': regex_pattern1, "user" : user})
+        tsf = await collection.count_documents({'清单编码': regex_pattern2, "user" : user})
+        ldm = await collection.count_documents({'清单编码': regex_pattern3, "user" : user})
+        zj = await collection.count_documents({'清单编码': regex_pattern4, "user" : user})
+        qz = await collection.count_documents({'清单编码': regex_pattern5, "user" : user})
+        hnt = await collection.count_documents({'清单编码': regex_pattern6, "user" : user})
+        js = await collection.count_documents({'清单编码': regex_pattern7, "user" : user})
+        qzm = await collection.count_documents({'清单编码': regex_pattern8, "user" : user})
+        mc = await collection.count_documents({'清单编码': regex_pattern9, "user" : user})
+        wm = await collection.count_documents({'清单编码': regex_pattern10, "user" : user})
+        tp = await collection.count_documents({'清单编码': regex_pattern11, "user" : user})
+        yq = await collection.count_documents({'清单编码': regex_pattern12, "user" : user})
         
     
         return [
@@ -2643,19 +2662,19 @@ async def statistics(client, query):
 
         
 
-        total = await collection.count_documents({'清单编码': regex_pattern1})
-        jx = await collection.count_documents({'清单编码': regex_pattern2})
-        rl = await collection.count_documents({'清单编码': regex_pattern3})
-        jz = await collection.count_documents({'清单编码': regex_pattern4})
-        dq = await collection.count_documents({'清单编码': regex_pattern5})
-        znh = await collection.count_documents({'清单编码': regex_pattern6})
-        yb = await collection.count_documents({'清单编码': regex_pattern7})
-        tf = await collection.count_documents({'清单编码': regex_pattern8})
-        gd = await collection.count_documents({'清单编码': regex_pattern9})
-        xf = await collection.count_documents({'清单编码': regex_pattern10})
-        jps = await collection.count_documents({'清单编码': regex_pattern11})
-        tx = await collection.count_documents({'清单编码': regex_pattern12})
-        sy = await collection.count_documents({'清单编码': regex_pattern13})
+        total = await collection.count_documents({'清单编码': regex_pattern1, "user" : user})
+        jx = await collection.count_documents({'清单编码': regex_pattern2, "user" : user})
+        rl = await collection.count_documents({'清单编码': regex_pattern3, "user" : user})
+        jz = await collection.count_documents({'清单编码': regex_pattern4, "user" : user})
+        dq = await collection.count_documents({'清单编码': regex_pattern5, "user" : user})
+        znh = await collection.count_documents({'清单编码': regex_pattern6, "user" : user})
+        yb = await collection.count_documents({'清单编码': regex_pattern7, "user" : user})
+        tf = await collection.count_documents({'清单编码': regex_pattern8, "user" : user})
+        gd = await collection.count_documents({'清单编码': regex_pattern9, "user" : user})
+        xf = await collection.count_documents({'清单编码': regex_pattern10, "user" : user})
+        jps = await collection.count_documents({'清单编码': regex_pattern11, "user" : user})
+        tx = await collection.count_documents({'清单编码': regex_pattern12, "user" : user})
+        sy = await collection.count_documents({'清单编码': regex_pattern13, "user" : user})
     
         return [
           ["工程类别", "清单数"],
@@ -2702,17 +2721,17 @@ async def statistics(client, query):
 
         
 
-        total = await collection.count_documents({'清单编码': regex_pattern1})
-        tsf = await collection.count_documents({'清单编码': regex_pattern2})
-        dl = await collection.count_documents({'清单编码': regex_pattern3})
-        qh = await collection.count_documents({'清单编码': regex_pattern4})
-        sd = await collection.count_documents({'清单编码': regex_pattern5})
-        gw = await collection.count_documents({'清单编码': regex_pattern6})
-        scl = await collection.count_documents({'清单编码': regex_pattern7})
-        lj = await collection.count_documents({'清单编码': regex_pattern8})
-        ld = await collection.count_documents({'清单编码': regex_pattern9})
-        gj = await collection.count_documents({'清单编码': regex_pattern10})
-        cc = await collection.count_documents({'清单编码': regex_pattern11})
+        total = await collection.count_documents({'清单编码': regex_pattern1, "user" : user})
+        tsf = await collection.count_documents({'清单编码': regex_pattern2, "user" : user})
+        dl = await collection.count_documents({'清单编码': regex_pattern3, "user" : user})
+        qh = await collection.count_documents({'清单编码': regex_pattern4, "user" : user})
+        sd = await collection.count_documents({'清单编码': regex_pattern5, "user" : user})
+        gw = await collection.count_documents({'清单编码': regex_pattern6, "user" : user})
+        scl = await collection.count_documents({'清单编码': regex_pattern7, "user" : user})
+        lj = await collection.count_documents({'清单编码': regex_pattern8, "user" : user})
+        ld = await collection.count_documents({'清单编码': regex_pattern9, "user" : user})
+        gj = await collection.count_documents({'清单编码': regex_pattern10, "user" : user})
+        cc = await collection.count_documents({'清单编码': regex_pattern11, "user" : user})
       
         return [
           ["工程类别", "清单数"],
@@ -2745,10 +2764,10 @@ async def statistics(client, query):
 
         
 
-        total = await collection.count_documents({'清单编码': regex_pattern1})
-        lh = await collection.count_documents({'清单编码': regex_pattern2})
-        yl = await collection.count_documents({'清单编码': regex_pattern3})
-        jg = await collection.count_documents({'清单编码': regex_pattern4})
+        total = await collection.count_documents({'清单编码': regex_pattern1, "user" : user})
+        lh = await collection.count_documents({'清单编码': regex_pattern2, "user" : user})
+        yl = await collection.count_documents({'清单编码': regex_pattern3, "user" : user})
+        jg = await collection.count_documents({'清单编码': regex_pattern4, "user" : user})
        
       
         return [
@@ -2788,16 +2807,16 @@ async def statistics(client, query):
 
         
 
-        total = await collection.count_documents({'清单编码': regex_pattern1})
-        zz = await collection.count_documents({'清单编码': regex_pattern2})
-        sz = await collection.count_documents({'清单编码': regex_pattern3})
-        ll = await collection.count_documents({'清单编码': regex_pattern4})
-        hnt = await collection.count_documents({'清单编码': regex_pattern5})
-        mz = await collection.count_documents({'清单编码': regex_pattern6})
-        wm = await collection.count_documents({'清单编码': regex_pattern7})
-        dm = await collection.count_documents({'清单编码': regex_pattern8})
-        mh = await collection.count_documents({'清单编码': regex_pattern9})
-        yq = await collection.count_documents({'清单编码': regex_pattern10})
+        total = await collection.count_documents({'清单编码': regex_pattern1, "user" : user})
+        zz = await collection.count_documents({'清单编码': regex_pattern2, "user" : user})
+        sz = await collection.count_documents({'清单编码': regex_pattern3, "user" : user})
+        ll = await collection.count_documents({'清单编码': regex_pattern4, "user" : user})
+        hnt = await collection.count_documents({'清单编码': regex_pattern5, "user" : user})
+        mz = await collection.count_documents({'清单编码': regex_pattern6, "user" : user})
+        wm = await collection.count_documents({'清单编码': regex_pattern7, "user" : user})
+        dm = await collection.count_documents({'清单编码': regex_pattern8, "user" : user })
+        mh = await collection.count_documents({'清单编码': regex_pattern9, "user" : user})
+        yq = await collection.count_documents({'清单编码': regex_pattern10, "user" : user})
        
       
         return [
@@ -2816,7 +2835,7 @@ async def statistics(client, query):
           ['其他', total - zz - sz - ll - hnt - mz - wm - dm - mh - yq ],
           ]
 
-async def frequency(client, type, query):
+async def frequency(client, type, query, user):
     db = client["baojia"]
     collection = db["qdxm"]
     output = []
@@ -2824,7 +2843,7 @@ async def frequency(client, type, query):
         if query == "电气设备":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0304", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0304", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -2847,7 +2866,7 @@ async def frequency(client, type, query):
         elif query == "机械设备":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0301", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0301", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -2870,7 +2889,7 @@ async def frequency(client, type, query):
         elif query == "热力设备":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0302", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0302", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -2893,7 +2912,7 @@ async def frequency(client, type, query):
         elif query == "静置设备、金属结构":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0303", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0303", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -2916,7 +2935,7 @@ async def frequency(client, type, query):
         elif query == "智能化":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0305", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0305", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -2939,7 +2958,7 @@ async def frequency(client, type, query):
         elif query == "仪表安装":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0306", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0306", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -2962,7 +2981,7 @@ async def frequency(client, type, query):
         elif query == "通风空调":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0307", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0307", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -2985,7 +3004,7 @@ async def frequency(client, type, query):
         elif query == "工业管道":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0308", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0308", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3008,7 +3027,7 @@ async def frequency(client, type, query):
         elif query == "消防工程":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0309", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0309", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3031,7 +3050,7 @@ async def frequency(client, type, query):
         elif query == "给排水、采暖、燃气":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0310", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0310", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3054,7 +3073,7 @@ async def frequency(client, type, query):
         elif query == "通信设备":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0311", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0311", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3077,7 +3096,7 @@ async def frequency(client, type, query):
         elif query == "刷油、防腐蚀、绝热":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0312", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0312", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3100,7 +3119,7 @@ async def frequency(client, type, query):
         elif query == "其他":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0313", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0313", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3127,7 +3146,7 @@ async def frequency(client, type, query):
         if query == "(钢筋)混凝土":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0105", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0105", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3149,7 +3168,7 @@ async def frequency(client, type, query):
         elif query == "金属结构":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0106", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0106", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3171,7 +3190,7 @@ async def frequency(client, type, query):
         elif query == "土石方工程":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0101", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0101", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3193,7 +3212,7 @@ async def frequency(client, type, query):
         elif query == "桩基工程":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0103", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0103", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3215,7 +3234,7 @@ async def frequency(client, type, query):
         elif query == "砌筑工程":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0104", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0104", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3237,7 +3256,7 @@ async def frequency(client, type, query):
         elif query == "门窗工程":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0108", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0108", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3259,7 +3278,7 @@ async def frequency(client, type, query):
         elif query == "屋面及防水工程":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0109", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0109", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3281,7 +3300,7 @@ async def frequency(client, type, query):
         elif query == "楼地面":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0110", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0110", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3303,7 +3322,7 @@ async def frequency(client, type, query):
         elif query == "墙、柱面":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0112", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0112", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3325,7 +3344,7 @@ async def frequency(client, type, query):
         elif query == "天棚工程":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0113", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0113", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3347,7 +3366,7 @@ async def frequency(client, type, query):
         elif query == "油漆、涂料、裱糊":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0114", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0114", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3369,7 +3388,7 @@ async def frequency(client, type, query):
         elif query == "其他":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^(0102|0107|0110|0115|0116|0117|0118)", re.IGNORECASE)},
+                    {"清单编码": re.compile("^(0102|0107|0110|0115|0116|0117|0118)", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3393,7 +3412,7 @@ async def frequency(client, type, query):
         if query == "管网工程":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0405", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0405", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3415,7 +3434,7 @@ async def frequency(client, type, query):
         elif query == "道路工程":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0402", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0402", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3437,7 +3456,7 @@ async def frequency(client, type, query):
         elif query == "土石方":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0401", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0401", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3459,7 +3478,7 @@ async def frequency(client, type, query):
         elif query == "路灯工程":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0408", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0408", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3481,7 +3500,7 @@ async def frequency(client, type, query):
         elif query == "拆除工程":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0410", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0410", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3503,7 +3522,7 @@ async def frequency(client, type, query):
         elif query == "桥涵工程":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0403", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0403", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3525,7 +3544,7 @@ async def frequency(client, type, query):
         elif query == "隧道工程":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0404", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0404", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3547,7 +3566,7 @@ async def frequency(client, type, query):
         elif query == "水处理":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0406", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0406", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3569,7 +3588,7 @@ async def frequency(client, type, query):
         elif query == "垃圾处理":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0407", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0407", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3591,7 +3610,7 @@ async def frequency(client, type, query):
         elif query == "钢筋工程":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0409", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0409", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3613,7 +3632,7 @@ async def frequency(client, type, query):
         elif query == "其他":
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^(0411|0413)", re.IGNORECASE)},
+                    {"清单编码": re.compile("^(0411|0413)", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3637,7 +3656,7 @@ async def frequency(client, type, query):
         if query == '绿化工程':
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0501", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0501", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3659,7 +3678,7 @@ async def frequency(client, type, query):
         elif query == '园路、园桥':
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0502", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0502", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3681,7 +3700,7 @@ async def frequency(client, type, query):
         elif query == '园林景观':
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0503", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0503", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3703,7 +3722,7 @@ async def frequency(client, type, query):
         elif query == '其他':
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0504", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0504", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3727,7 +3746,7 @@ async def frequency(client, type, query):
         if query == '砖作工程':
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0201", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0201", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3749,7 +3768,7 @@ async def frequency(client, type, query):
         elif query == '石作工程':
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0202", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0202", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3771,7 +3790,7 @@ async def frequency(client, type, query):
         elif query == '琉璃砌筑':
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0203", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0203", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3793,7 +3812,7 @@ async def frequency(client, type, query):
         elif query == '(钢筋)混凝土':
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0204", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0204", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3815,7 +3834,7 @@ async def frequency(client, type, query):
         elif query == '木作工程':
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0205", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0205", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3837,7 +3856,7 @@ async def frequency(client, type, query):
         elif query == '屋面工程':
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0206", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0206", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3859,7 +3878,7 @@ async def frequency(client, type, query):
         elif query == '地面工程':
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0207", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0207", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3881,7 +3900,7 @@ async def frequency(client, type, query):
         elif query == '抹灰工程':
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0208", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0208", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3903,7 +3922,7 @@ async def frequency(client, type, query):
         elif query == '油漆彩画':
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0209", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0209", re.IGNORECASE), "user" : user},
                   
                     
                 },
@@ -3925,7 +3944,7 @@ async def frequency(client, type, query):
         elif query == '其他':
             pipeline = [
                 {"$match":
-                    {"清单编码": re.compile("^0210", re.IGNORECASE)},
+                    {"清单编码": re.compile("^0210", re.IGNORECASE), "user" : user},
                   
                     
                 },