def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) if df is not None and len(df) > 0: name_pos = list(np.where(df.iloc[0, :].str.contains('法人股东名称'))[0]) unit_owner_pos = list( np.where(df.iloc[0, :].str.contains('法定代表人'))[0]) date_of_establish_pos = list( np.where(df.iloc[0, :].str.contains('成立日期'))[0]) main_busines_pos = list( np.where(df.iloc[0, :].str.contains('主要经营业务或管理活动'))[0]) regist_capit_pos = list( np.where(df.iloc[0, :].str.contains('注册资本'))[0]) names = list(df.iloc[:, name_pos[0]]) unit_owners = list(df.iloc[:, unit_owner_pos[0]]) date_of_establishs = list(df.iloc[:, date_of_establish_pos[0]]) main_busineses = list(df.iloc[:, main_busines_pos[0]]) regist_capits = list(df.iloc[:, regist_capit_pos[0]]) for (name,unit_owner,date_of_establish,main_busines,regist_capit) in\ zip(names,unit_owners,date_of_establishs,main_busineses,regist_capits): value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, type='os', name=name, unit_owner=unit_owner, date_of_establish=date_of_establish, main_busines=main_busines, regist_capit=regist_capit, ) create_and_update('ShareholdCorpor', **value_dict) else: pass
def save(self): df,unti,instructi = recognize_df_and_instucti(self.indexcontent) if df is not None: account_firm_name = df.iloc[list(np.where((df.iloc[:, 0].str.contains("会计师事务所")) & (df.iloc[:, 1].str.match("名称")))[0]), 2].values[0] account_offic_addres = df.iloc[list(np.where((df.iloc[:, 0].str.contains("会计师事务所")) & (df.iloc[:, 1].str.match("办公地址")))[0]), 2].values[0] sign_accountant_nam = df.iloc[list(np.where((df.iloc[:, 0].str.contains("会计师事务所")) & (df.iloc[:, 1].str.match("签字会计师姓名")))[0]), 2].values[0] sponsor_name = df.iloc[list(np.where((df.iloc[:, 0].str.contains("保荐机构")) & (df.iloc[:, 1].str.match("名称")))[0]), 2].values[0] sponsor_addres = df.iloc[list(np.where((df.iloc[:, 0].str.contains("保荐机构")) & (df.iloc[:, 1].str.match("办公地址")))[0]), 2].values[0] sponsor_repr = df.iloc[list(np.where((df.iloc[:, 0].str.contains("保荐机构")) & (df.iloc[:, 1].str.contains("保荐代表人")))[0]), 2].values[0] continu_supervis_per = df.iloc[list(np.where((df.iloc[:, 0].str.contains("保荐机构")) & (df.iloc[:, 1].str.contains("持续督导的期间")))[0]), 2].values[0] value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, account_firm_name=account_firm_name, account_offic_addres=account_offic_addres, sign_accountant_nam=sign_accountant_nam, sponsor_name=sponsor_name, sponsor_addres=sponsor_addres, sponsor_repr=sponsor_repr, continu_supervis_per=continu_supervis_per ) create_and_update('CompaniProfil',**value_dict) else: pass
def save(self): df,unit,instructi = recognize_df_and_instucti(self.indexcontent) if df is not None: chines_name = df.iloc[list(np.where(df.iloc[:,0] == '公司的中文名称')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '公司的中文名称')[0]))==1 else '' chines_abbrevi = df.iloc[list(np.where(df.iloc[:, 0] == '公司的中文简称')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '公司的中文简称')[0]))==1 else '' foreign_name = df.iloc[list(np.where(df.iloc[:, 0] == '公司的外文名称(如有)')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '公司的外文名称(如有)')[0]))==1 else '' foreign_abbrevi = df.iloc[list(np.where(df.iloc[:, 0] == '公司的外文名称缩写(如有)')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '公司的外文名称缩写(如有)')[0]))==1 else '' legal_repres = df.iloc[list(np.where(df.iloc[:, 0] == '公司的法定代表人')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '公司的法定代表人')[0]))==1 else '' compani_regist_addre = df.iloc[list(np.where(df.iloc[:, 0] == '注册地址')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '注册地址')[0]))==1 else '' postal_regist = df.iloc[list(np.where(df.iloc[:, 0] == '注册地址的邮政编码')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '注册地址的邮政编码')[0]))==1 else '' compani_offic_addres = df.iloc[list(np.where(df.iloc[:, 0] == '办公地址')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '办公地址')[0]))==1 else '' postal_offic = df.iloc[list(np.where(df.iloc[:, 0] == '办公地址的邮政编码')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '办公地址的邮政编码')[0]))==1 else '' compani_websit = df.iloc[list(np.where(df.iloc[:, 0].str.contains('网址'))[0]), 1].values[0] if len(list(np.where(df.iloc[:, 0].str.contains('网址'))[0]))==1 else '' compani_email = df.iloc[list(np.where(df.iloc[:, 0] == '电子信箱')[0]), 1].values[0] if len(list(np.where(df.iloc[:,0] == '电子信箱')[0]))==1 else '' value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, chines_name=chines_name, chines_abbrevi=chines_abbrevi, foreign_name=foreign_name, foreign_abbrevi=foreign_abbrevi, legal_repres=legal_repres, postal_regist=postal_regist, compani_regist_addre=compani_regist_addre, compani_offic_addres=compani_offic_addres, postal_offic=postal_offic, compani_websit=compani_websit, compani_email=compani_email, ) create_and_update('CompaniProfil',**value_dict) else: pass
def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) if df is not None and len(df) > 1: df = df.drop([0]) major_assets = list(df.iloc[:, 0]) change_reasons = list(df.iloc[:, len(df.columns) - 1]) for major_asset, change_reason in zip(major_assets, change_reasons): value_dict = dict(stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, major_asset=major_asset, change_reason=change_reason) create_and_update('CompaniBusiOverview', **value_dict) # if models.CompaniBusiOverview.objects.filter(stk_cd_id=self.stk_cd_id, acc_per=self.acc_per): # obj = models.CompaniBusiOverview.objects.get(stk_cd_id=self.stk_cd_id, acc_per=self.acc_per) # obj.major_asset = major_asset # obj.change_reason = change_reason # obj.save() # else: # models.CompaniBusiOverview.objects.create( # stk_cd_id=self.stk_cd_id, # acc_per=self.acc_per, # major_asset=major_asset, # change_reason=change_reason # ) else: pass save_instructi(instructi, models.CompaniBusiOverview, self.stk_cd_id, self.acc_per, 'major_chang_in_major_asset')
def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) if df is not None and len(df) > 0: unit_change = { '元': 1, '千元': 1000, '万元': 10000, '百万元': 1000000, '亿元': 100000000 } bond_name_pos = list( np.where(df.iloc[0, :].str.contains('债券名称'))[0]) abbrevi_pos = list(np.where(df.iloc[0, :].str.contains('简称'))[0]) code_pos = list(np.where(df.iloc[0, :].str.contains('代码'))[0]) releas_date_pos = list( np.where(df.iloc[0, :].str.contains('发行日'))[0]) expiri_date_pos = list( np.where(df.iloc[0, :].str.contains('到期日'))[0]) bond_balanc_pos = list( np.where(df.iloc[0, :].str.contains('债券余额'))[0]) interest_rate_pos = list( np.where(df.iloc[0, :].str.contains('利率'))[0]) debt_servic_pos = list( np.where(df.iloc[0, :].str.contains('还本付息方式'))[0]) trade_place_pos = list( np.where(df.iloc[0, :].str.contains('交易场所'))[0]) df = df.drop([0]) bond_names = list(df.iloc[:, bond_name_pos[0]]) abbrevis = list(df.iloc[:, abbrevi_pos[0]]) codes = list(df.iloc[:, code_pos[0]]) releas_dates = list(df.iloc[:, releas_date_pos[0]]) expiri_dates = list(df.iloc[:, expiri_date_pos[0]]) bond_balancs = list(df.iloc[:, bond_balanc_pos[0]]) interest_rates = list(df.iloc[:, interest_rate_pos[0]]) debt_servics = list(df.iloc[:, debt_servic_pos[0]]) trade_places = list(df.iloc[:, trade_place_pos[0]]) for (bond_name, abbrevi,code,releas_date,expiri_date,bond_balanc, \ interest_rate,debt_servic,trade_place) \ in zip(bond_names, abbrevis,codes,releas_dates,expiri_dates,bond_balancs, \ interest_rates,debt_servics,trade_places): value_dict = dict(stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, bond_name=bond_name, abbrevi=abbrevi, code=code, releas_date=releas_date, expiri_date=expiri_date, bond_balanc=num_to_decimal( bond_balanc, unit), interest_rate=num_to_decimal(interest_rate), debt_servic=debt_servic, trade_place=trade_place) create_and_update('BasicCorporBond', **value_dict)
def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) if df is not None and len(df) > 0: bond_man_name_pos = list( np.where((df.iloc[:, 0].str.contains('债券受托管理人')) & (df.iloc[:, 1].str.contains('名称')))[0]) bond_man_addr_pos = list( np.where((df.iloc[:, 0].str.contains('债券受托管理人')) & (df.iloc[:, 1].str.contains('办公地址')))[0]) bond_man_contact_person_pos = list( np.where((df.iloc[:, 0].str.contains('债券受托管理人')) & (df.iloc[:, 1].str.contains('联系人')))[0]) bond_man_contact_tel_pos = list( np.where((df.iloc[:, 0].str.contains('债券受托管理人')) & (df.iloc[:, 1].str.contains('联系电话')))[0]) credit_name_pos = list( np.where((df.iloc[:, 0].str.contains('资信评级机构')) & (df.iloc[:, 1].str.contains('名称')))[0]) credit_addr_pos = list( np.where((df.iloc[:, 0].str.contains('资信评级机构')) & (df.iloc[:, 1].str.contains('办公地址')))[0]) bond_man_names = list(df.iloc[bond_man_name_pos, 2]) bond_man_addrs = list(df.iloc[bond_man_addr_pos, 2]) bond_man_contact_persons = list( df.iloc[bond_man_contact_person_pos, 2]) bond_man_contact_tels = list(df.iloc[bond_man_contact_tel_pos, 2]) credit_names = list(df.iloc[credit_name_pos, 2]) credit_addrs = list(df.iloc[credit_addr_pos, 2]) for (credit_name,credit_addr) \ in zip(credit_names,credit_addrs): value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, institut_categori='credit', name=credit_name, addr=credit_addr, ) create_and_update('BondManagAndCreditRateAgenc', **value_dict) for (bond_man_name,bond_man_addr,bond_man_contact_person,bond_man_contact_tel) \ in zip(bond_man_names,bond_man_addrs,bond_man_contact_persons,bond_man_contact_tels): value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, institut_categori='manager', name=bond_man_name, addr=bond_man_addr, contact_person=bond_man_contact_person, contact_tel=bond_man_contact_tel, ) create_and_update('BondManagAndCreditRateAgenc', **value_dict)
def save(self): df,unit,instructi = recognize_df_and_instucti(self.indexcontent) if df is not None: organ_code = df.iloc[list(np.where(df.iloc[:, 0] == '组织机构代码')[0]), 1].values[0] chang_in_main_busi = df.iloc[list(np.where(df.iloc[:, 0] == '公司上市以来主营业务的变化情况(如有)')[0]), 1].values[0] chang_in_control_sha = df.iloc[list(np.where(df.iloc[:, 0] == '历次控股股东的变更情况(如有)')[0]), 1].values[0] value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, organ_code=organ_code, chang_in_main_busi=chang_in_main_busi, chang_in_control_sha=chang_in_control_sha ) create_and_update('CompaniProfil',**value_dict) else: pass
def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) # print(dfs) if df is not None and len(df) > 0: name_pos = list(np.where(df.iloc[:, 0].str.contains('名称'))[0]) # unit_owner_pos = list(np.where(df.iloc[:, 0].str.contains('单位负责人或法定代表人'))[0]) # date_of_establish_pos = list(np.where(df.iloc[:, 0].str.contains('成立日期'))[0]) # main_busines_pos = list(np.where(df.iloc[:, 0].str.contains('主要经营业务'))[0]) # contor_other_list_com_pos = list(np.where(df.iloc[:, 0].str.contains('报告期内控股和参股的其他境内外上市公司的股权情况'))[0]) # other_desc_pos = list(np.where(df.iloc[:, 0].str.contains('其他情况说明'))[0]) # df = df.drop([0, 1]) name = df.iloc[name_pos[0], 1] # unit_owner = df.iloc[unit_owner_pos[0], 1] # date_of_establish = df.iloc[date_of_establish_pos[0], 1] # main_busines = df.iloc[main_busines_pos[0], 1] # contor_other_list_com = df.iloc[contor_other_list_com_pos[0], 1] # other_desc = df.iloc[other_desc_pos[0], 1] if models.ShareholdCorpor.objects.filter(stk_cd_id=self.stk_cd_id, acc_per=self.acc_per): obj = models.ShareholdCorpor.objects.get( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per) obj.type = 'ac' obj.name = name # obj.unit_owner = unit_owner # obj.date_of_establish = date_of_establish # obj.main_busines = main_busines # obj.contor_other_list_com = contor_other_list_com # obj.other_desc = other_desc obj.save() else: models.ShareholdCorpor.objects.create( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, type='ac', name=name, # unit_owner=unit_owner, # date_of_establish=date_of_establish, # main_busines=main_busines, # contor_other_list_com=contor_other_list_com, # other_desc=other_desc, ) else: pass
def save(self): df,unit,instructi = recognize_df_and_instucti(self.indexcontent) if df is not None: board_secretary_nam = df.iloc[list(np.where(df.iloc[:, 0] == '姓名')[0]), 1].values[0] board_secretary_addr = df.iloc[list(np.where(df.iloc[:, 0] == '联系地址')[0]), 1].values[0] board_secretary_tel = df.iloc[list(np.where(df.iloc[:, 0] == '电话')[0]), 1].values[0] board_secretary_fax = df.iloc[list(np.where(df.iloc[:, 0] == '传真')[0]), 1].values[0] board_secretary_email = df.iloc[list(np.where(df.iloc[:, 0] == '电子信箱')[0]), 1].values[0] value_dict = dict(stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, board_secretary_nam=board_secretary_nam, board_secretary_addr=board_secretary_addr, board_secretary_tel=board_secretary_tel, board_secretary_fax=board_secretary_fax, board_secretary_email=board_secretary_email) create_and_update('CompaniProfil',**value_dict) else: pass
def save(self): df,unit,instructi = recognize_df_and_instucti(self.indexcontent) if df is not None: chines_name = df.iloc[list(np.where(df.iloc[:,0] == '公司的中文名称')[0]), 1].values[0] chines_abbrevi = df.iloc[list(np.where(df.iloc[:, 0] == '公司的中文简称')[0]), 1].values[0] foreign_name = df.iloc[list(np.where(df.iloc[:, 0] == '公司的外文名称')[0]), 1].values[0] foreign_abbrevi = df.iloc[list(np.where(df.iloc[:, 0] == '公司的外文名称缩写')[0]), 1].values[0] legal_repres = df.iloc[list(np.where(df.iloc[:, 0] == '公司的法定代表人')[0]), 1].values[0] value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, chines_name=chines_name, chines_abbrevi=chines_abbrevi, foreign_name=foreign_name, foreign_abbrevi=foreign_abbrevi, legal_repres=legal_repres) create_and_update('CompaniProfil',**value_dict) else: pass
def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) if df is not None and len(df) > 0: sharehold_name_pos = list( np.where(df.iloc[0, :].str.contains('股东名称'))[0]) begin_pos = list(np.where(df.iloc[0, :].str.contains('初限售股数'))[0]) releas_pos = list( np.where(df.iloc[0, :].str.contains('解除限售股数'))[0]) increas_pos = list( np.where(df.iloc[0, :].str.contains('增加限售股数'))[0]) end_pos = list(np.where(df.iloc[0, :].str.contains('末限售股数'))[0]) reason_pos = list(np.where(df.iloc[0, :].str.contains('限售原因'))[0]) restrict_sale_date_pos = list( np.where(df.iloc[0, :].str.contains('解除限售日期'))[0]) df = df.drop([0, len(df) - 1]) sharehold_names = list(df.iloc[:, sharehold_name_pos[0]]) begins = list(df.iloc[:, begin_pos[0]]) releases = list(df.iloc[:, releas_pos[0]]) increases = list(df.iloc[:, increas_pos[0]]) ends = list(df.iloc[:, end_pos[0]]) reasons = list(df.iloc[:, reason_pos[0]]) restrict_sale_dates = list(df.iloc[:, restrict_sale_date_pos[0]]) for (sharehold_name,begin,releas,increas,end, reason,restrict_sale_date) \ in zip(sharehold_names,begins,releases,increases,ends, reasons,restrict_sale_dates): value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, sharehold_name=sharehold_name, begin=begin if begin != 'nan' else 0, releas=releas if releas != 'nan' else 0, increas=increas if increas != 'nan' else 0, end=end if end != 'nan' else 0, reason=reason, restrict_sale_date=restrict_sale_date, ) create_and_update('ChangInRestrictSaleOfShare', **value_dict) else: pass
def save(self): df,unit,instructi = recognize_df_and_instucti(self.indexcontent) if df is not None: compani_regist_addre = df.iloc[list(np.where(df.iloc[:, 0] == '公司注册地址')[0]), 1].values[0] postal_regist = df.iloc[list(np.where(df.iloc[:, 0] == '公司注册地址的邮政编码')[0]), 1].values[0] compani_offic_addres = df.iloc[list(np.where(df.iloc[:, 0] == '公司办公地址')[0]), 1].values[0] postal_offic = df.iloc[list(np.where(df.iloc[:, 0] == '公司办公地址的邮政编码')[0]), 1].values[0] compani_websit = df.iloc[list(np.where(df.iloc[:, 0] == '公司网址')[0]), 1].values[0] compani_email = df.iloc[list(np.where(df.iloc[:, 0] == '电子信箱')[0]), 1].values[0] value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, compani_regist_addre=compani_regist_addre, postal_regist=postal_regist, compani_offic_addres=compani_offic_addres, postal_offic=postal_offic, compani_websit=compani_websit, compani_email=compani_email ) create_and_update('CompaniProfil',**value_dict) else: pass
def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) if df is not None and len(df) > 0: name_pos = list(np.where(df.iloc[:, 0].str.contains('名称'))[0]) unit_owner_pos = list( np.where(df.iloc[:, 0].str.contains('单位负责人或法定代表人'))[0]) date_of_establish_pos = list( np.where(df.iloc[:, 0].str.contains('成立日期'))[0]) main_busines_pos = list( np.where(df.iloc[:, 0].str.contains('主要经营业务'))[0]) contor_other_list_com_pos = list( np.where( df.iloc[:, 0].str.contains('报告期内控股和参股的其他境内外上市公司的股权情况'))[0]) other_desc_pos = list( np.where(df.iloc[:, 0].str.contains('其他情况说明'))[0]) # df = df.drop([0, 1]) name = df.iloc[name_pos[0], 1] unit_owner = df.iloc[unit_owner_pos[0], 1] date_of_establish = df.iloc[date_of_establish_pos[0], 1] main_busines = df.iloc[main_busines_pos[0], 1] contor_other_list_com = df.iloc[contor_other_list_com_pos[0], 1] other_desc = df.iloc[other_desc_pos[0], 1] value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, type='cs', name=name, unit_owner=unit_owner, date_of_establish=date_of_establish, main_busines=main_busines, control_other_list_com=contor_other_list_com, other_desc=other_desc, ) create_and_update('ShareholdCorpor', **value_dict) else: pass
def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) if df is not None and len(df) > 0: report_end_sharehold_num_pos = list( np.where(df.iloc[:, 0].str.contains('截止报告期末普通股股东总数'))[0]) disclos_last_month_sharehold_num_pos = list( np.where(df.iloc[:, 0].str.contains('披露日前上一月末的普通股股东总数'))[0]) report_end_sharehold_num = df.iloc[report_end_sharehold_num_pos[0], 1] disclos_last_month_sharehold_num = df.iloc[ disclos_last_month_sharehold_num_pos[0], 1] value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, report_end_sharehold_num=report_end_sharehold_num, disclos_last_month_sharehold_num= disclos_last_month_sharehold_num, ) create_and_update('ChangInShareAndSharehold', **value_dict) else: pass
def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) if df is not None: asset_contentss = list( chain.from_iterable( df.iloc[:, list(np.where( df.iloc[0, :] == '资产的具体内容')[0])].values)) caus_of_formats = list( chain.from_iterable( df.iloc[:, list(np.where( df.iloc[0, :] == '形成原因')[0])].values)) asset_sizes = list( chain.from_iterable( df.iloc[:, list(np.where( df.iloc[0, :] == '资产规模')[0])].values)) locats = list( chain.from_iterable( df.iloc[:, list(np.where(df.iloc[0, :] == '所在地')[0])].values)) oper_modes = list( chain.from_iterable( df.iloc[:, list(np.where( df.iloc[0, :] == '运营模式')[0])].values)) control_measurs = list( chain.from_iterable( df.iloc[:, list(np.where( df.iloc[0, :] == '保障资产安全性的控制措施')[0])].values)) revenu_status = list( chain.from_iterable( df.iloc[:, list(np.where( df.iloc[0, :] == '收益状况')[0])].values)) proport_of_overseas = list( chain.from_iterable( df. iloc[:, list(np.where( df.iloc[0, :] == '境外资产占公司净资产的比重')[0])].values)) impair_risks = list( chain.from_iterable( df.iloc[:, list(np.where( df.iloc[0, :] == '是否存在重大减值风险')[0])].values)) for asset_contents,caus_of_format,asset_size,locat,oper_mode,control_measur,revenu_statu, \ proport_of_oversea,impair_risk in zip(asset_contentss,caus_of_formats,asset_sizes,locats, oper_modes,control_measurs,revenu_status,proport_of_overseas,impair_risks): if asset_contents == '资产的具体内容': continue value_dict = dict(stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, asset_contents=asset_contents, caus_of_format=caus_of_format, asset_size=asset_size, locat=locat, oper_mode=oper_mode, control_measur=control_measur, revenu_statu=revenu_statu, proport_of_oversea=proport_of_oversea, impair_risk=impair_risk) create_and_update('MajorOverseaAsset', **value_dict) # if models.MajorOverseaAsset.objects.filter(stk_cd_id=self.stk_cd_id, acc_per=self.acc_per): # obj = models.MajorOverseaAsset.objects.get(stk_cd_id=self.stk_cd_id, acc_per=self.acc_per) # obj.asset_contents = asset_contents # obj.caus_of_format = caus_of_format # obj.asset_size = asset_size # obj.locat = locat # obj.oper_mode = oper_mode # obj.control_measur = control_measur # obj.revenu_statu = revenu_statu # obj.proport_of_oversea = proport_of_oversea # obj.impair_risk = impair_risk # obj.save() # else: # models.MajorOverseaAsset.objects.create( # stk_cd_id=self.stk_cd_id, # acc_per=self.acc_per, # asset_contents=asset_contents, # caus_of_format=caus_of_format, # asset_size=asset_size, # locat=locat, # oper_mode=oper_mode, # control_measur=control_measur, # revenu_statu=revenu_statu, # proport_of_oversea=proport_of_oversea, # impair_risk=impair_risk # # ) else: pass
def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) if df is not None and len(df) > 0: quantiti_befor_chang_pos = list( np.where((df.iloc[0, :].str.contains('本次变动前')) & (df.iloc[1, :].str.contains('数量')))[0]) issu_new_share_pos = list( np.where(df.iloc[1, :].str.contains('发行新股'))[0]) give_share_pos = list( np.where(df.iloc[1, :].str.contains('送股'))[0]) turnov_from_cpf_pos = list( np.where(df.iloc[1, :].str.contains('公积金转股'))[0]) other_pos = list(np.where(df.iloc[1, :].str.contains('其他'))[0]) subtot_chang_pos = list( np.where(df.iloc[1, :].str.contains('小计'))[0]) quantiti_after_chang_pos = list( np.where((df.iloc[0, :].str.contains('本次变动后')) & (df.iloc[1, :].str.contains('数量')))[0]) choice_dict = { '一、有限售条件股份': 'restrict_sale', '1、国家持股': 'state_hold', '2、国有法人持股': 'state_own_legal_pers', '3、其他内资持股': 'other_domest_capit', '其中:境内非国有法人持股': 'domest_non_state_own', '境内自然人持股': 'domest_natur_person', '4、外资持股': 'foreign_hold', '其中:境外法人持股': 'oversea_legal_person', '境外自然人持股': 'oversea_natur_person', '二、无限售条件流通股份': 'unlimit_sale', '1、人民币普通股': 'rmb_ordinari_share', '2、境内上市的外资股': 'domest_list_foreign', '3、境外上市的外资股': 'overseas_list_foreig', '4、其他': 'others', '三、普通股股份总数': 'total_number', } df = df.drop([0, 1]) projects = [] for item in df.iloc[:, 0]: for key in choice_dict.keys(): if similar(str(item), str(key)): projects.append(choice_dict[key]) quantiti_befor_changs = list(df.iloc[:, quantiti_befor_chang_pos[0]]) issu_new_shares = list(df.iloc[:, issu_new_share_pos[0]]) give_shares = list(df.iloc[:, give_share_pos[0]]) turnov_from_cpfs = list(df.iloc[:, turnov_from_cpf_pos[0]]) others = list(df.iloc[:, other_pos[0]]) subtot_changs = list(df.iloc[:, subtot_chang_pos[0]]) quantiti_after_changs = list(df.iloc[:, quantiti_after_chang_pos[0]]) for (project,quantiti_befor_chang,issu_new_share,give_share,turnov_from_cpf, other,subtot_chang ,quantiti_after_chang) \ in zip(projects,quantiti_befor_changs,issu_new_shares,give_shares,turnov_from_cpfs, others,subtot_changs ,quantiti_after_changs): value_dict = dict( stk_cd_id=self.stk_cd_id, acc_per=self.acc_per, name=project, quantiti_befor_chang=quantiti_befor_chang if quantiti_befor_chang != 'nan' else 0, issu_new_share=issu_new_share if issu_new_share != 'nan' else 0, give_share=give_share if give_share != 'nan' else 0, turnov_from_cpf=turnov_from_cpf if turnov_from_cpf != 'nan' else 0, other=other if other != 'nan' else 0, subtot_chang=subtot_chang if subtot_chang != 'nan' else 0, quantiti_after_chang=quantiti_after_chang if quantiti_after_chang != 'nan' else 0, ) create_and_update('ChangInOrdinariShare', **value_dict) else: pass save_instructi(instructi, models.ChangInShareAndSharehold, self.stk_cd_id, self.acc_per, 'change_desc')
def save(self): df, unit, instructi = recognize_df_and_instucti(self.indexcontent) save_instructi(instructi, models.BondDesc, self.stk_cd_id, self.acc_per, 'use_of_rais_fund')