10.py 8.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #coding:UTF8
  2. import logging
  3. import json
  4. import time,re
  5. time_pattern = "\d{4}\-\d{2}\-\d{2}.*"
  6. logging.basicConfig(level = logging.INFO,format = '%(asctime)s - %(name)s - %(levelname)s - %(message)s')
  7. def process(extractjson,otherjson):
  8. if extractjson is not None:
  9. _extract = json.loads(extractjson)
  10. else:
  11. _extract = {}
  12. if otherjson is not None:
  13. _other = json.loads(otherjson)
  14. else:
  15. _other = {}
  16. project_code = ""
  17. project_name = ""
  18. tenderee = ""
  19. agency = ""
  20. win_tenderer = ""
  21. bidding_budget = ""
  22. win_bid_price = ""
  23. page_time_stamp = 0
  24. docchannel = 0
  25. extract_count = 0
  26. page_time = _other.get("pageTime",time.strftime('%Y-%m-%d',time.localtime()))
  27. doctitle = _other.get("doctitle","")
  28. doctitle_refine = re.sub(r'工程|服务|询价|比价|谈判|竞争性|磋商|结果|中标|招标|采购|的|公示|公开|成交|公告|评标|候选人|交易|通知|废标|流标|终止|中止|一笔|预告|单一来源|询价|竞价|合同', '', doctitle)
  29. area = _other.get("area","")
  30. province = _other.get("province","")
  31. city = _other.get("city","")
  32. district = _other.get("district","")
  33. web_source_no = _other.get("webSourceNo","")
  34. docchannel = _other.get("docchannel",0)
  35. if re.search(time_pattern,page_time) is not None:
  36. timeArray = time.strptime(page_time[:11], "%Y-%m-%d")
  37. page_time_stamp = int(time.mktime(timeArray))
  38. list_code = _extract.get("code",[])
  39. if len(list_code)>0:
  40. project_code = list_code[0]
  41. project_name = _extract.get("name","")
  42. dict_pack = _extract.get("prem",{})
  43. logging.info(dict_pack)
  44. for _key in dict_pack.keys():
  45. if dict_pack[_key]["tendereeMoney"]!='' and float(dict_pack[_key]["tendereeMoney"])>0:
  46. extract_count += 1
  47. if bidding_budget=="":
  48. bidding_budget = str(float(dict_pack[_key]["tendereeMoney"]))
  49. for _role in dict_pack[_key]["roleList"]:
  50. extract_count += 1
  51. if _role[2]!='' and float(_role[2])>0:
  52. extract_count += 1
  53. if _role[0]=="tenderee":
  54. tenderee = _role[1]
  55. if _role[0]=="win_tenderer":
  56. if win_tenderer=="":
  57. win_tenderer = _role[1]
  58. if _role[2]!='' and float(_role[2])>0:
  59. if win_bid_price=="":
  60. win_bid_price = str(float(_role[2]))
  61. if _role[0]=="agency":
  62. agency = _role[1]
  63. if project_code!="":
  64. extract_count += 1
  65. if project_name!="":
  66. extract_count += 1
  67. logging.info('page_time=%s,doctitle=%s,doctitle_refine=%s,area=%s,province=%s,city=%s,'
  68. 'district=%s,web_source_no=%s,project_code=%s,project_name=%s,tenderee=%s,agency=%s,win_tenderer=%s,bidding_budget=%s,win_bid_price=%s'%(page_time,doctitle,doctitle_refine,area,province,city,
  69. district,web_source_no,project_code,project_name,tenderee,agency,win_tenderer,bidding_budget,win_bid_price))
  70. if __name__=="__main__":
  71. extractjson = '''
  72. { "bidway": "竞争性谈判", "code": [ "SDGP370883202102000014" ], "cost_time": { "attrs": 0.012673616409301758, "codename": 0.17389655113220215, "nerToken": 0.47509217262268066, "person": 0.015163421630859375, "prem": 0.026870250701904297, "preprocess": 0.5857865810394287, "product": 0.19810962677001953, "punish": 0.16147398948669434, "rule": 0.004196882247924805, "tableToText": 0.06637310981750488, "time": 0.0062367916107177734 }, "docid": "", "moneysource": "", "name": "邹城市葛山摩崖石刻本体保护工程", "person_review": [], "prem": { "A": { "code": "", "roleList": [ [ "win_tenderer", "成都市屹华建筑工程公司", "2063787.0000", [ [ "袁华阳", "" ] ] ] ], "tendereeMoney": 0 }, "Project": { "code": "", "roleList": [ [ "tenderee", "邹城市文化和旅游局", 0, [ [ "王主任", "18653740099" ], [ "解华英", "" ] ] ], [ "agency", "山东省建设工程招标中心有限公司", 0, [ [ "张旋", "18653791560" ] ] ], [ "win_tenderer", "甘肃中铁建设工程有限公司", 2063787.0, [] ] ], "tendereeMoney": 0 } }, "product": [ "摩崖石刻本体保护工程", "石刻本体保护工程" ], "punish": {}, "serviceTime": "", "success": true, "time_bidclose": "", "time_bidopen": "", "time_release": "2021-02-01" }
  73. '''
  74. otherjson = '''
  75. {"city":"济南","pageTme":"2021-02-19","industry":"通用设备","uuid":"68c90d8b-7287-11eb-b5b7-c81f66ef0810","crtime":"2021-02-19 15:52:27","infoType":"机械设备","province":"山东","cruser":"superbxkcadmin","webSourceNo":"00049-1","docstatus":20,"area":"华东","webSourceName":"山东省政府采购信息公开平台","doccontent":"邹城市葛山摩崖石刻本体保护工程中标公告 邹城市葛山摩崖石刻本体保护工程中标公告 详细信息 邹城市葛山摩崖石刻本体保护工程成交公告 一、采购人:邹城市文化和旅游局 地址:邹城市太平东路2669号(邹城市文化和旅游局) 联系方式:3235508(邹城市文化和旅游局) 采购代理机构:山东省建设工程招标中心有限公司 地址:山东省济南市市中区县(区)经六路小纬四路46-1号 联系方式:0537-523","docid":134554287,"opertime":"2021-02-19 15:53:08","doctitle":"邹城市葛山摩崖石刻本体保护工程中标公告","infoSource":"政府采购","dockeywords":"邹城市:0.2218,葛山:0.1629,摩崖:0.1340,石刻:0.1287,本体:0.0945,较低:0.0931,得分:0.0917,屹:0.0863,占优势:0.0839,巴人:0.0817,偏低:0.0662,工程公司:0.0640,旅游局:0.0628,成都市:0.0543,保护:0.0526","partitionkey":288,"district":"市中","docchannel":101,"publishtime":"2021-02-19 15:53:08","status":8}
  76. '''
  77. process(extractjson,otherjson)
  78. extractjson = '''
  79. { "bidway": "磋商", "code": [ "SDGP370883202102000014" ], "cost_time": { "attrs": 0.010054588317871094, "codename": 0.07792425155639648, "nerToken": 0.14783811569213867, "person": 0.01098489761352539, "prem": 0.027380943298339844, "preprocess": 0.21127796173095703, "product": 0.08798742294311523, "punish": 0.0709075927734375, "rule": 0.0015246868133544922, "tableToText": 0.05526423454284668, "time": 0.0064449310302734375 }, "docid": "", "moneysource": "", "name": "邹城市葛山摩崖石刻本体保护工程", "person_review": [], "prem": { "A": { "code": "ZRGC20150476", "roleList": [ [ "win_tenderer", "成都市屹华建筑工程公司", "2063787", [ [ "袁华阳", "" ] ] ] ], "tendereeMoney": 0 }, "Project": { "code": "", "roleList": [ [ "tenderee", "邹城市文化和旅游局", 0, [ [ "王主任", "18653740099" ] ] ], [ "agency", "山东省建设工程招标中心有限公司", 0, [ [ "张旋", "18653791560" ] ] ] ], "tendereeMoney": 0 } }, "product": [ "石刻本体保护工程" ], "punish": {}, "serviceTime": "180日历天", "success": true, "time_bidclose": "", "time_bidopen": "", "time_release": "" }
  80. '''
  81. otherjson = '''
  82. {"city":"济南","pageTime":"2021-02-19","industry":"通用设备","uuid":"03d1a62d-7285-11eb-b5b7-c81f66ef0810","crtime":"2021-02-19 15:35:18","infoType":"机械设备","province":"山东","cruser":"superbxkcadmin","webSourceNo":"03758-2","docstatus":20,"area":"华东","webSourceName":"山东省公共资源交易信息网","doccontent":"邹城市葛山摩崖石刻本体保护工程成交公告 邹城市葛山摩崖石刻本体保护工程成交公告 一、采购项目名称:邹城市葛山摩崖石刻本体保护工程 二、采购项目编号:SDGP370883202102000014 三、公告发布日期:2021年2月1日 四、成交日期:2021年2月19日 五、采购方式:竞争性谈判( ),竞争性磋商(√),询价( ),单一来源( )。 六、成交情况: 包 号 预中标供应商名称 工期 质量","docid":134551869,"opertime":"2021-02-19 15:36:06","doctitle":"邹城市葛山摩崖石刻本体保护工程成交公告","infoSource":"政府采购","dockeywords":"邹城市:0.1956,葛山:0.1437,得分:0.1213,摩崖:0.1182,石刻:0.1135,较低:0.0958,占优势:0.0863,巴人:0.0841,本体:0.0834,屹:0.0710,偏低:0.0681,成交:0.0545,文物:0.0535,工程公司:0.0527,旅游局:0.0517","partitionkey":370,"district":"市中","docchannel":101,"publishtime":"2021-02-19 15:36:06","status":8}
  83. '''
  84. process(extractjson,otherjson)
  85. print(899463/8491933)