# -*- coding: utf-8 -*- import psycopg2 import pandas as pd # 获得连接 conn = psycopg2.connect(database="f6_bi", user="BASIC$ro_caowei", password="!ro_caowei123", host="hgprecn-cn-nif1vnv0y002-cn-shanghai.hologres.aliyuncs.com", port="80") # 获得游标对象,一个游标对象可以对数据库进行执行操作 cursor = conn.cursor() import datetime now_time = datetime.datetime.now() yes_time = now_time + datetime.timedelta(days=-1) yes_time_nyr = int(yes_time.strftime('%Y%m%d'))# 获取前一天日期 # sql语句 建表 sql =f"""SELECT * FROM "public"."holo_ads_report_saas_profile_ngv_detail_d" WHERE "date_id" = '{yes_time_nyr}';""" # 执行语句 cursor.execute(sql) # 获取结果集的每一行 rows = cursor.fetchall() # 获取所有字段名 all_fields = cursor.description #执行结果转化为dataframe col = [] for i in all_fields: col.append(i[0]) data_NGV_new = pd.DataFrame(list(rows),columns=col) # data_NGV.to_excel(r'C:\Users\admin\Desktop\NGV明细.xlsx') # 关闭数据库连接 cursor.close() conn.close() # 基础函数配置 import pandas as pd import pandas as pd import requests from pathlib import Path from urllib.parse import quote import json import numpy as np import time ROOT = Path('.').absolute() # 当前工作目录 def generateToken() -> str: """ 生成 token """ token_api = 'https://api.dingtalk.com/v1.0/oauth2/accessToken' # 该信息在钉钉开放应用中 data = { "appKey": "ding5kqocon5s9oph5uq", "appSecret": 'HL1jgsIIfLAC0eTH0A1m4mwxUDqbgsiPeCCGGE3ocM6qJBTIW7Ivt9drxF_Z4Kb_' } res = requests.post(token_api, json=data) token = res.json()['accessToken'] return token def read_instances_put(token, formInstanceId,data_new): """ 函数功能:读取普通表单的所有数据 """ api = f'https://api.dingtalk.com//v1.0/yida/forms/instances' headers = { "Content-Type": "application/json", "x-acs-dingtalk-access-token": token } formData = { "appType" : "APP_UYZ0KG6L0CCNV80GZ66O", "systemToken" : "XA966F81JAJOFCVVVKO64E9MIIZV1EWE5SFMKJ2", "userId" : "2268275546837446", # 曹伟 id "language" : "zh_CN", "useLatestVersion" : "false", "formInstanceId" : formInstanceId, "updateFormDataJson" : json.dumps(data_new, cls=NpEncoder) } res = requests.put(api, headers=headers, json=formData) return res.json() def read_instances(token, formUuid, page, n): """ 函数功能:读取普通表单的所有数据 """ api = f'https://api.dingtalk.com//v1.0/yida/forms/instances/search' headers = { "Content-Type": "application/json", "x-acs-dingtalk-access-token": token } formData = { "appType" : "APP_UYZ0KG6L0CCNV80GZ66O", "systemToken" : "XA966F81JAJOFCVVVKO64E9MIIZV1EWE5SFMKJ2", "userId" : "yida_pub_account", "language" : "zh_CN", "formUuid" : formUuid, "currentPage" : page, "pageSize" : n } res = requests.post(api, headers=headers, json=formData) return res.json() def read_delete(token, formInstanceId): """ 函数功能:调用本接口删除表单数据。 """ api = f'https://api.dingtalk.com//v1.0/yida/forms/instances' headers = { "Content-Type": "application/json", "x-acs-dingtalk-access-token": token } formData = { "appType" : "APP_UYZ0KG6L0CCNV80GZ66O", "systemToken" : "XA966F81JAJOFCVVVKO64E9MIIZV1EWE5SFMKJ2", "userId" : "yida_pub_account", "language" : "zh_CN", "formInstanceId" : formInstanceId } res = requests.delete(api, headers=headers, json=formData) return res.json() def read_new(FORMID,formData): """ 通过实例id 获取表单内容 """ api = f'https://api.dingtalk.com/v1.0/yida/forms/instances' headers = { "Content-Type": "application/json", "x-acs-dingtalk-access-token": TOKEN } payload = { "formUuid" : FORMID, "appType" : "APP_UYZ0KG6L0CCNV80GZ66O", "formDataJson" : json.dumps(formData, cls=NpEncoder), "systemToken" : "XA966F81JAJOFCVVVKO64E9MIIZV1EWE5SFMKJ2", "language" : "zh_CN", "userId" : "yida_pub_account" } res = requests.post(api, headers=headers, json=payload) print(res.json()) return res.json() def component(FORMID,TOKEN): """ 获取组件信息 """ api = f'https://api.dingtalk.com//v1.0/yida/forms/formFields' headers = { "Content-Type": "application/json", "x-acs-dingtalk-access-token": TOKEN } payload = { "formUuid" : FORMID, "appType" : "APP_UYZ0KG6L0CCNV80GZ66O", # "formDataJson" : json.dumps(formData, cls=NpEncoder), "systemToken" : "XA966F81JAJOFCVVVKO64E9MIIZV1EWE5SFMKJ2", # "language" : "zh_CN", "userId" : "yida_pub_account" } res = requests.get(api, headers=headers, json=payload) return res.json() def Batch_creation(FORMID,TOKEN,ALL_formData): """ 获取组件信息 """ api = f'https://api.dingtalk.com//v1.0/yida/forms/instances/batchSave' headers = { "Content-Type": "application/json", "x-acs-dingtalk-access-token": TOKEN } payload = { # "formDataJson" : json.dumps(formData, cls=NpEncoder), "noExecuteExpression" : "true", "formUuid" : FORMID, "appType" : "APP_UYZ0KG6L0CCNV80GZ66O", "asynchronousExecution" : "false", "systemToken" : "XA966F81JAJOFCVVVKO64E9MIIZV1EWE5SFMKJ2", "keepRunningAfterException" : "true", "userId" : "yida_pub_account", "formDataJsonList" : json.dumps(ALL_formData, cls=NpEncoder), } res = requests.post(api, headers=headers, json=payload) return res.json() def delete_in_batches(FORMID,TOKEN,ALL_DATA_instance): """ 批量删除表单实例 """ api = f'https://api.dingtalk.com//v1.0/yida/forms/instances/batchRemove' headers = { "Content-Type": "application/json", "x-acs-dingtalk-access-token": TOKEN } payload = { "formUuid" : FORMID, "appType" : "APP_UYZ0KG6L0CCNV80GZ66O", "asynchronousExecution" : "false", "systemToken" : "XA966F81JAJOFCVVVKO64E9MIIZV1EWE5SFMKJ2", "formInstanceIdList" : json.dumps(ALL_DATA_instance, cls=NpEncoder), "userId" : "yida_pub_account", "executeExpression" : "false" # 不触发 } res = requests.post(api, headers=headers, json=payload) return res.json() def delete_in(TOKEN,formInstanceIdList): """ 逐条删除表单实例 """ api = f'https://api.dingtalk.com//v1.0/yida/forms/instances?appType=APP_UYZ0KG6L0CCNV80GZ66O&systemToken=XA966F81JAJOFCVVVKO64E9MIIZV1EWE5SFMKJ2&userId=yida_pub_account&language=zh_CN&formInstanceId={formInstanceIdList}' headers = { "Content-Type": "application/json", "x-acs-dingtalk-access-token": TOKEN } res = requests.delete(api, headers=headers) return res.json() def read_form_instances(token, formUuid, page=1, n=100, searchField={},createFromTimeGMT='',createToTimeGMT=''): """ 函数功能:读取普通表单的所有数据 -- 应用:F6客户服务 """ api = f'https://api.dingtalk.com/v1.0/yida/forms/instances/search' headers = { "Content-Type": "application/json", "x-acs-dingtalk-access-token": token } formData = { 'currentPage': page, 'pageSize': n, "appType": "APP_UYZ0KG6L0CCNV80GZ66O", "systemToken": "XA966F81JAJOFCVVVKO64E9MIIZV1EWE5SFMKJ2", "userId": "yida_pub_account", "language": "zh_CN", "formUuid": formUuid, 'createFromTimeGMT':createFromTimeGMT, 'createToTimeGMT':createToTimeGMT, "searchFieldJson": json.dumps(searchField) } res = requests.post(api, headers=headers, json=formData) return res.json() def create_form_instances(token, formUuid, formData={}): """ 函数功能:创建普通表单实例 -- 应用:F6客户服务 """ api = 'https://api.dingtalk.com/v1.0/yida/forms/instances' headers = { "Content-Type": "application/json", "x-acs-dingtalk-access-token": token } payload = { "appType": "APP_UYZ0KG6L0CCNV80GZ66O", "systemToken": "XA966F81JAJOFCVVVKO64E9MIIZV1EWE5SFMKJ2", "userId": "yida_pub_account", "language": "zh_CN", "formUuid": formUuid, "formDataJson": json.dumps(formData) } res = requests.post(api, headers=headers, json=payload) return res def read_instances_1108(token, formUuid, page, n,formatted_today,formatted_today_two): """ 函数功能:读取普通表单的所有数据 """ api = f'https://api.dingtalk.com//v1.0/yida/forms/instances/search' headers = { "Content-Type": "application/json", "x-acs-dingtalk-access-token": token } formData = { "appType" : "APP_UYZ0KG6L0CCNV80GZ66O", "systemToken" : "XA966F81JAJOFCVVVKO64E9MIIZV1EWE5SFMKJ2", "userId" : "yida_pub_account", "language" : "zh_CN", "formUuid" : formUuid, "createFromTimeGMT" : formatted_today, "createToTimeGMT" : formatted_today_two, "currentPage" : page, "pageSize" : n } res = requests.post(api, headers=headers, json=formData) return res.json() class NpEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, np.integer): return int(obj) elif isinstance(obj, np.floating): return float(obj) elif isinstance(obj, np.ndarray): return obj.tolist() else: return super(NpEncoder, self).default(obj) TOKEN = generateToken() '''读取员工对应关系:宜搭员工-ID对应表 ''' FORMID = "FORM-EA866E715PF9YA7ECCAGSABX91Q72PVA3WRFL6" # 宜搭员工-ID对应表 FORM-EA866E715PF9YA7ECCAGSABX91Q72PVA3WRFL6 # 读取流程表单数据 form_data = read_instances(token=TOKEN, formUuid=FORMID, page=1, n=100) PAGES = form_data.get('totalCount')//100 + 1 ALL_DATA_staff = {} """ 获取全量数据 """ for i in range(1, PAGES+1): # form_data = read_processes_instances(token=TOKEN, formUuid=FORMID, createFromTimeGMT=CREATE_FROM, createToTimeGMT=CREATE_TO, page=i, n=100, searchField={'textField_l7if5ff9': '否'}) form_data = read_instances(token=TOKEN, formUuid=FORMID, page=i, n=100) for data in form_data.get('data'): ALL_DATA_staff[data['formData']['textField_lfrw3u58']]=data['formData']['textField_lfrw3u59'] '''获取表内控件信息 ''' # FORMID = "FORM-ZK866D91O9LA4NIHCARG2DPIPCXF3Z087PPHL91" # component_list = component(FORMID,TOKEN) # for i in range(len(component_list['result'])): # componentName = component_list['result'][i]['componentName'] # name_value = component_list['result'][i]['label']['value'] # fieldId = component_list['result'][i]['fieldId'] # print("'",fieldId,"':","data_NGV[",name_value,"][i],") '''读取市-技术专家id ''' FORMID = "FORM-A8666NA1FJDEVPBB6VVTOCMP47UP2J2L6SPML2" #市-技术专家id # 读取流程表单数据 form_data = read_instances(token=TOKEN, formUuid=FORMID, page=1, n=100) PAGES = form_data.get('totalCount')//100 + 1 textField_lmps6q39 = {} """ 获取全量数据 """ for i in range(1, PAGES+1): # form_data = read_processes_instances(token=TOKEN, formUuid=FORMID, createFromTimeGMT=CREATE_FROM, createToTimeGMT=CREATE_TO, page=i, n=100, searchField={'textField_l7if5ff9': '否'}) form_data = read_instances(token=TOKEN, formUuid=FORMID, page=i, n=100) for data in form_data.get('data'): textField_lmps6q39[data['formData']['textField_lmps6q38']]=data['formData']['textField_lmps6q39'] #技术专家id print(f'读取到市-技术专家id表单中 {len(textField_lmps6q39)} 条数据!') import datetime now_time = datetime.datetime.now() yes_time = now_time + datetime.timedelta(days=-2) yes_time_nyr = int(yes_time.strftime('%Y%m%d'))# 获取前2天日期 searchField={'textField_nnyw1ge':str(yes_time_nyr)} # 'textField_nnyw1ge':str(yes_time_nyr) res = read_form_instances(token=TOKEN, formUuid='FORM-ZK866D91O9LA4NIHCARG2DPIPCXF3Z087PPHL91',searchField=searchField) data_NGV_new = data_NGV_new.astype('string') data_NGV_new = data_NGV_new.fillna('',inplace=False) for i in range(0,len(res['data'])): res['data'][i]['formData']['textField_nnyw1ge'] index = "" index = len(data_NGV_new[data_NGV_new['org_code'] == res['data'][i]['formData']['textField_zc1iowp']]) # 门店编码 print(i,":",index,res['data'][i]['formData']['textField_zc1iowp']) if index > 0: # 更新 try: formData = { 'textField_nnyw1ge': data_NGV_new["date_id"][index], 'dateField_e9jt02o': int(time.mktime(time.strptime(data_NGV_new["date_fmt"][index], "%Y-%m-%d"))*1000) if data_NGV_new["date_fmt"][index] !='' else '', 'textField_ek9jnne': data_NGV_new["id_own_group"][index], 'textField_35i6110': data_NGV_new["group_name"][index], 'textField_l8nc9f2': data_NGV_new["id_own_org"][index], 'textField_tdn6hsy': data_NGV_new["org_name"][index], 'textField_zc1iowp': data_NGV_new["org_code"][index], 'textField_2rulk5e': data_NGV_new["group_grade"][index], 'textField_c54tztg': data_NGV_new["org_type"][index], 'textField_qrtnel7': data_NGV_new["org_status"][index], 'textField_7xgxe9g': data_NGV_new["saas_version"][index], 'textField_pnig1i1': data_NGV_new["is_wechat"][index], 'textField_qiovtdj': data_NGV_new["is_mini_app"][index], 'textField_i0h0iqa': data_NGV_new["is_wx_shop"][index], 'textField_qczj9vq': data_NGV_new["is_camera_service"][index], 'textField_jouovty': data_NGV_new["is_maintenance_service"][index], 'dateField_o1v1emn': int(time.mktime(time.strptime(data_NGV_new["saas_create_time"][index], "%Y-%m-%d %H:%M:%S"))*1000) if data_NGV_new["saas_create_time"][index] !='' else '', 'dateField_6zdcfnf': int(time.mktime(time.strptime(data_NGV_new["expiry_time"][index], "%Y-%m-%d %H:%M:%S"))*1000) if data_NGV_new["expiry_time"][index] !='' else '', 'textField_8uae70x': data_NGV_new["saas_use_days"][index], 'textField_cjkvqpn': data_NGV_new["saas_use_year"][index], 'textField_yhtmsxx': data_NGV_new["is_main_org"][index], 'textField_gfigtpn': data_NGV_new["license_code"][index], 'textField_662foev': data_NGV_new["license_name"][index], 'textField_lco27te': data_NGV_new["org_crm_id"][index], 'textField_1tygbmq': data_NGV_new["province_id"][index], 'textField_z2rntja': data_NGV_new["city_id"][index], 'textField_ohybc2g': data_NGV_new["city_name"][index], 'textField_9oupoal': data_NGV_new["area_id"][index], 'textField_m0rzgwb': data_NGV_new["area_name"][index], 'textField_69po7o9': data_NGV_new["region_name"][index], 'textField_vqxr0d9': data_NGV_new["region_short_name"][index], 'textField_5wr3tj9': data_NGV_new["branch_name"][index], 'textField_6hz7i81': data_NGV_new["carzone_store_id"][index], 'textField_86wu9qm': data_NGV_new["carzone_store_name"][index], 'textField_129quhy': data_NGV_new["customer_carzone_id"][index], 'textField_j7i4mhn': data_NGV_new["salesmen"][index], 'textField_qms107e': data_NGV_new["area_manager"][index], 'textField_qc3blb5': data_NGV_new["service_salesmen"][index], 'textField_vk0hf2u': data_NGV_new["impl_principal"][index], 'textField_3lfom9a': data_NGV_new["service_impl_principal"][index], 'textField_1ud1o2l': data_NGV_new["active_user_count"][index], 'textField_kpdh7qc': data_NGV_new["active_user_type"][index], 'textField_n2y4bmf': data_NGV_new["limit_user_count"][index], 'textField_k5o5u2d': data_NGV_new["limit_user_type"][index], 'textField_729y7jp': data_NGV_new["is_n"][index], 'textField_six7heq': data_NGV_new["is_g"][index], 'textField_tipmhx4': data_NGV_new["is_v"][index], 'textField_qclt1dm': data_NGV_new["is_visited"][index], 'textField_0sk94f9': data_NGV_new["is_active"][index], 'textField_bzszf71': data_NGV_new["active_status_fmt"][index], 'textField_c061ojt': data_NGV_new["bill_count_last_30_day"][index], 'textField_07zkoii': data_NGV_new["bill_day_count_last_30_day"][index], 'textField_3vnzvsx': data_NGV_new["bill_day_count_this_month"][index], 'textField_3mxwdc4': data_NGV_new["bill_count_last_7_day"][index], 'textField_4q3bh5w': data_NGV_new["bill_day_count_last_7_day"][index], 'textField_u0rgodd': data_NGV_new["pv_count"][index], 'textField_eau5xx6': data_NGV_new["uv_count"][index], 'textField_tayz1vv': data_NGV_new["bill_count_1d"][index], 'textField_k4b1a7x': data_NGV_new["bill_count_2d"][index], 'textField_7lfqnm3': data_NGV_new["bill_count_3d"][index], 'textField_g24x9fv': data_NGV_new["bill_count_4d"][index], 'textField_0v3pm0r': data_NGV_new["bill_count_5d"][index], 'textField_1nxvats': data_NGV_new["bill_count_6d"][index], 'textField_vylq7uh': data_NGV_new["bill_count_7d"][index], 'textField_0n1zd7o': data_NGV_new["bill_count_8d"][index], 'textField_uuatjx7': data_NGV_new["bill_count_9d"][index], 'textField_e16m62c': data_NGV_new["bill_count_10d"][index], 'textField_anv4rco': data_NGV_new["bill_count_11d"][index], 'textField_pz5cg65': data_NGV_new["bill_count_12d"][index], 'textField_hamkvor': data_NGV_new["bill_count_13d"][index], 'textField_kw9nvef': data_NGV_new["bill_count_14d"][index], 'textField_ujbyern': data_NGV_new["bill_count_15d"][index], 'textField_uqp3072': data_NGV_new["bill_count_16d"][index], 'textField_2qsei19': data_NGV_new["bill_count_17d"][index], 'textField_p5x4u8t': data_NGV_new["bill_count_18d"][index], 'textField_2lv8ksl': data_NGV_new["bill_count_19d"][index], 'textField_unl61g8': data_NGV_new["bill_count_20d"][index], 'textField_cvtamin': data_NGV_new["bill_count_21d"][index], 'textField_z0hs1c4': data_NGV_new["bill_count_22d"][index], 'textField_9jln7lp': data_NGV_new["bill_count_23d"][index], 'textField_jlst4j8': data_NGV_new["bill_count_24d"][index], 'textField_ct6z2pu': data_NGV_new["bill_count_25d"][index], 'textField_6s2qy9p': data_NGV_new["bill_count_26d"][index], 'textField_l9lyxnr': data_NGV_new["bill_count_27d"][index], 'textField_sz5xht3': data_NGV_new["bill_count_28d"][index], 'textField_ccodrkd': data_NGV_new["bill_count_29d"][index], 'textField_dy7c14l': data_NGV_new["bill_count_30d"][index], 'textField_delij7o': data_NGV_new["bill_count_31d"][index], 'dateField_4vp44kc': int(time.mktime(time.strptime(data_NGV_new["etl_time"][index], "%Y-%m-%d %H:%M:%S"))*1000) if data_NGV_new["etl_time"][index] !='' else '', 'textField_0d97bpy': data_NGV_new["maintain_bill_count_last_30_day"][index], 'textField_3nbi33y': data_NGV_new["washing_bill_count_last_30_day"][index], 'textField_17yhr79': data_NGV_new["maintain_bill_day_count_last_30_day"][index], 'textField_e1mrwvb': data_NGV_new["washing_bill_day_count_last_30_day"][index], 'textField_8s47o64': data_NGV_new["retail_bill_count_last_30_day"][index], 'textField_jr9otam': data_NGV_new["retail_bill_day_count_last_30_day"][index], 'textField_mtg1zn1': data_NGV_new["purchase_bill_count_last_30_day"][index], 'textField_96ggfjo': data_NGV_new["purchase_bill_day_count_last_30_day"][index], 'textField_hk7pe9z': data_NGV_new["card_bill_count_last_30_day"][index], 'textField_yj3vbwq': data_NGV_new["card_bill_day_count_last_30_day"][index], 'textField_n2hdr45': data_NGV_new["gd_sales_bill_count_last_30_day"][index], 'textField_p7xgdah': data_NGV_new["gd_sales_bill_day_count_last_30_day"][index], 'textField_7xr2ar8': data_NGV_new["g_change_flag"][index], 'textField_gpzxxmk': data_NGV_new["saas_package"][index], 'textField_tq9g8in': data_NGV_new["manage_model"][index], 'textField_zzchgop': data_NGV_new["contacts"][index], 'textField_a2znmfb': data_NGV_new["contact_number"][index], 'textField_0sadows': data_NGV_new["contact_mobile"][index], 'textField_hz3ujlo': data_NGV_new["g_month_count"][index], 'textField_m1gdeaa': data_NGV_new["g_month_percentage"][index], 'textField_y7ds4oo': data_NGV_new["is_install_service"][index], 'dateField_hiuaj0y': int(time.mktime(time.strptime(data_NGV_new["install_create_time"][index], "%Y-%m-%d %H:%M:%S"))*1000) if data_NGV_new["install_create_time"][index] !='' else '', 'dateField_yubgpmy': int(time.mktime(time.strptime(data_NGV_new["last_end_date"][index], "%Y-%m-%d"))*1000) if data_NGV_new["last_end_date"][index] !='' else '', 'dateField_8st5q1a': int(time.mktime(time.strptime(data_NGV_new["renew_date"][index], "%Y-%m-%d"))*1000) if data_NGV_new["renew_date"][index] !=''else '', 'textField_u8h91r2': data_NGV_new["is_chain_owner"][index], 'textField_qzzz8ux': data_NGV_new["group_org_count"][index], 'textField_qzjf8mc': data_NGV_new["recent_bill_warning_days"][index], 'textField_lvyu7z2': data_NGV_new["g_change_flag_d"][index], 'textField_d72wy3d': data_NGV_new["g_lost_warning_days"][index], 'textField_11ebiwp': data_NGV_new["saas_edition_fmt"][index], 'textField_4yu5vlq': data_NGV_new["g_flag_1m"][index], 'textField_8ydk27g': data_NGV_new["g_flag_2m"][index], 'textField_ysoij3v': data_NGV_new["g_flag_3m"][index], 'textField_a4t6iwp': data_NGV_new["g_flag_4m"][index], 'textField_z1xfteb': data_NGV_new["g_flag_5m"][index], 'textField_56x8u44': data_NGV_new["g_flag_6m"][index], 'textField_zscafbj': data_NGV_new["g_flag_day_count"][index], 'textField_4c0rpdd': data_NGV_new["add_org_flag"][index], 'textField_14we48g': data_NGV_new["pt"][index], 'textField_gukslqe': data_NGV_new["org_size"][index], 'textField_y0tw39j': data_NGV_new["qualification_type_fmt"][index], 'textField_3euralk': data_NGV_new["business_scope_fmt"][index], 'textField_4jji26g': data_NGV_new["store_type_fmt"][index], 'textField_z2mrvyk': data_NGV_new["area"][index], 'textField_e7qmeix': data_NGV_new["station_number"][index], 'textField_x9q5k8p': data_NGV_new["header_type_fmt"][index], 'textField_h423ob8': data_NGV_new["org_stage"][index], 'textField_w6dk6au': data_NGV_new["g_count_this_month"][index], 'textField_67sllhy': data_NGV_new["saas_customer_type"][index] } try: if data_NGV_new["province_name"][index]=="": formData['textField_1q6dt9a'] = "无" else: formData['textField_1q6dt9a'] = data_NGV_new["province_name"][index] except: formData['textField_1q6dt9a'] = "无" try: formData['employeeField_llc00m15'] = ALL_DATA_staff[data_NGV_new["service_impl_principal"][index]] # 运营负责人_成员字段 except: formData['employeeField_llc00m15'] = "" try: formData['employeeField_llc00m16'] = ALL_DATA_staff[data_NGV_new["area_manager"][index]] # 区域经理_成员字段 except: formData['employeeField_llc00m16'] = "" try: formData['employeeField_lmpsfc04'] = textField_lmps6q39[data_NGV_new["city_name"][index]] # 技术专家_成员字段 except: formData['employeeField_lmpsfc04'] = "" read_instances_put(TOKEN, res['data'][i]['formInstanceId'],formData) print("更新",res['data'][i]['formInstanceId'],res['data'][i]['formData']['textField_zc1iowp']) except: pass else: # 删除这条数据 try: read_delete(TOKEN, res['data'][i]['formInstanceId']) print("删除",res['data'][i]['formInstanceId'],res['data'][i]['formData']['textField_zc1iowp']) except: pass