def test_1037(): """出租合同承租周期小于一年""" # describe: 出租合同承租周期小于一年,生成一条业绩单 # data:1、房源已定价2、设计工程已交房;3、有装修成本;4、房源类型为合租;5、出租合同承租周期不大于1年; # result:生成一条业绩单,审核状态为待审核,核发月份为空 fileName = 'apartmentAchievement_1037' randomApartment = "SELECT a.apartment_code,a.apartment_id,hc.contract_num,hc.contract_id FROM apartment a INNER JOIN house_contract hc " \ "ON hc.contract_id = a.house_contract_id AND hc.is_active = 'Y' AND hc.deleted = 0 AND hc.audit_status='APPROVED' AND hc.contract_status = 'EFFECTIVE' " \ "INNER JOIN fitment_house fh on fh.house_id=hc.house_id AND fh.fitment_status='HANDOVER' WHERE a.deleted = 0 " \ "AND a.rent_price > 0 AND a.city_code = 330100 AND hc.entrust_type = 'SHARE' AND a.rent_status='WAITING_RENT'" \ "AND hc.real_due_date>date_add(date(sysdate()), interval 1 YEAR) ORDER BY RAND() LIMIT 1" if sqlbase.get_count(randomApartment) == 0: consoleLog(u'%s:SQL查无数据!' % fileName, 'w') consoleLog(u'执行SQL:%s' % randomApartment) return info = sqlbase.serach(randomApartment) apartmentCode = info[0] apartmentId = info[1] consoleLog(u'%s:使用房源 %s 签约出租合同' % (fileName,apartmentCode)) dateInfo = sqlbase.serach( "SELECT entrust_start_date,entrust_end_date,date(sysdate()),date_add(date(sysdate()), interval 1 DAY),date_add(date(sysdate()), interval 6 month) " "from house_contract where contract_num = '%s'" % info[2]) # 获取时间元素 with Base() as base: # 创建出租合同 customer = createCustomer() apartmentContractInfo = createApartmentContract(apartement_id=apartmentId, customerInfo=customer, rent_price=5500, sign_date=dateInfo[2], rent_start_date=dateInfo[3], rent_end_date=dateInfo[4], deposit=2000, payment_cycle='TOW_MONTH') apartmentContractNum = apartmentContractInfo['contractNum'] # 出租合同检查 contractAdd = "select * from apartment a,apartment_contract ac ,apartment_contract_relation acr where a.apartment_id=acr.apartment_id and acr.contract_id=ac.contract_id " \ "and a.apartment_code='%s'AND ac.contract_num = '%s'AND ac.audit_status='AUDIT' and ac.contract_type = 'NEWSIGN' AND ac.entrust_type='SHARE' " \ "AND ac.is_active='Y' " % (apartmentCode, apartmentContractNum) base.diffAssert(lambda test: asserts(sqlbase.waitData(contractAdd,1)).is_true(),1037, u'%s:出租合同 %s 新增失败,执行SQL:%s' % (fileName, apartmentContractNum, contractAdd)) # 业绩检查 achievementsqla = "select aca.is_active,aca.audit_status,aca.accounting_time from apartment_contract_achievement aca inner join apartment a on a.apartment_code=aca.house_code " \ "where contract_num='%s' and a.apartment_code='%s'and aca.deleted=0 " % (apartmentContractNum, apartmentCode) if sqlbase.waitData(achievementsqla, 1): achievementinfo = sqlbase.serach(achievementsqla) base.diffAssert(lambda test:asserts(achievementinfo[0]).is_equal_to('N'), 1037, u'%s:合同 %s 对应业绩生效状态异常,期望值 N 实际值 %s' % (fileName, apartmentContractNum, achievementinfo[0])) base.diffAssert(lambda test: asserts(achievementinfo[1]).is_equal_to('AUDIT'), 1037, u'%s:合同 %s 对应业绩审核状态异常, 期望值 AUDIT 实际值 %s' % (fileName, apartmentContractNum, achievementinfo[1])) base.diffAssert(lambda test: asserts(achievementinfo[2]).is_equal_to('None'), 1037, u'%s:合同 %s 对应业绩审核发月份异常, 期望值 None 实际值 %s' % (fileName, apartmentContractNum, achievementinfo[2])) else: consoleLog( u'%s:合同 %s 对应业绩生成异常' % (fileName, apartmentContractNum),'e') consoleLog(u'执行SQL:%s' % achievementsqla)
def test_1038(): """承租周期大于一年且小于18个月生成一条业绩""" # describe: 出租合同承租周期小于一年,生成一条业绩单 # data:1、房源类型为服务整租;2、出租合同承租周期为16个月;3、承租到期日等于委托延长期到期日; # result:生成一条业绩单,审核状态为待审核,核发月份为空 fileName = 'apartmentAchievement_1038' with Base() as base: # 创建房源,委托合同 dateSql = "select date(sysdate()),date_add(date(sysdate()),INTERVAL 1 day),date_add(date(sysdate()),interval 13 month),date_add(date(sysdate()),interval 16 month)," \ "date_add(date(sysdate()),INTERVAL 1 month) from dual" dateInfo = sqlbase.serach(dateSql) apartmentId = addHouseContractAndFitment(apartment_type='MANAGE', entrust_type='ENTIRE', sign_date=dateInfo[0], owner_sign_date=dateInfo[0], entrust_start_date=dateInfo[0], entrust_end_date=dateInfo[2], delay_date=dateInfo[3], free_start_date=dateInfo[0], free_end_date=dateInfo[4], first_pay_date=dateInfo[0], second_pay_date=dateInfo[4], rent=1234, parking=123, year_service_fee=321, payment_cycle='MONTH', fitment_start_date=dateInfo[0], fitment_end_date=dateInfo[4], rooms=3, fitmentCost=88888) # 创建租客,出租合同 customer = createCustomer() apartmentContractInfo = createApartmentContract(apartement_id=apartmentId, customerInfo=customer, rent_price=5500, sign_date=dateInfo[0], rent_start_date=dateInfo[1], rent_end_date=dateInfo[3], deposit=2000, payment_cycle='MONTH') apartmentContractNum = apartmentContractInfo['contractNum'] # 出租合同检查 contractAdd = "select * from apartment a,apartment_contract ac ,apartment_contract_relation acr where a.apartment_id=acr.apartment_id and acr.contract_id=ac.contract_id " \ "and a.apartment_id='%s'AND ac.contract_num = '%s'AND ac.audit_status='AUDIT' and ac.contract_type = 'NEWSIGN' AND ac.entrust_type='ENTIRE' " \ "AND ac.is_active='Y' " % (apartmentId, apartmentContractNum) base.diffAssert(lambda test: asserts(sqlbase.waitData(contractAdd, 1)).is_true(), 1038, u'%s:出租合同 %s 新增失败,执行SQL:%s' % (fileName, apartmentContractNum, contractAdd)) # 业绩检查 achievementsqla = "select FLOOR(ABS(DATEDIFF(aca.start_time,aca.end_time)/30)),aca.audit_status,aca.is_active from apartment_contract_achievement aca inner join apartment a " \ "on a.apartment_code=aca.house_code and a.apartment_id='%s' where aca.contract_num='%s' and aca.deleted=0" % (apartmentId, apartmentContractNum) if sqlbase.waitData(achievementsqla, 1): achievementinfo = sqlbase.serach(achievementsqla) base.diffAssert(lambda test: asserts(achievementinfo[0]).is_equal_to(16), 1038, u'%s:合同 %s 对应业绩周期异常,期望值 16 实际值 %s' % (fileName, apartmentContractNum, achievementinfo[0])) base.diffAssert(lambda test: asserts(achievementinfo[1]).is_equal_to('AUDIT'), 1038, u'%s:合同 %s 对应业绩审核状态异常, 期望值 AUDIT 实际值 %s' % (fileName, apartmentContractNum, achievementinfo[1])) base.diffAssert(lambda test: asserts(achievementinfo[2]).is_equal_to('N'), 1038, u'%s:合同 %s 对应业绩生效状态异常, 期望值 N 实际值 %s' % (fileName, apartmentContractNum, achievementinfo[2])) else: consoleLog(u'%s:合同 %s 对应业绩生成异常' % (fileName, apartmentContractNum),'e') consoleLog(u'执行SQL:%s'% achievementsqla)
def test_1123(): """正退不生成扣回业绩""" # describe:出租合同正退终止结算生成扣回业绩,记录同步到预估业绩排行榜 # data:1、出租合同状态为有效;2、出租合同审核状态为已复审;3、应收扣回金大于0;4、应收转租费大于0 # result:1、合同状态变为正退;2、不生成扣回业绩; fileName = 'apartmentAchievement_1123' contractSql = "SELECT contract_num,rent_end_date,date(sysdate()) from apartment_contract where deleted = 0 and city_code = 330100 and audit_status = 'APPROVED' and contract_status = 'EFFECTIVE' " \ "and contract_type = 'NEWSIGN' and entrust_type = 'SHARE' and payment_type<>'NETWORKBANK' and rent_end_date>DATE_ADD(date(SYSDATE()),INTERVAL 1 MONTH)order by rand() limit 1" if sqlbase.get_count(contractSql) == 0: consoleLog(u'%s:SQL查无数据!' % fileName, 'w') consoleLog(u'执行SQL:%s' % contractSql) return info = sqlbase.serach(contractSql) contractNum = info[0] consoleLog(u'%s:取随机出租合同 %s 做正退终止' % (fileName, contractNum)) with Base() as base: breach_money = '888.88' # 应收违约金 zhuanzu_money = '666.66' # 转租费 base.open(page.apartmentContractPage, apartmentContractEndPage.addContractEndMould['tr_contract']) base.input_text(apartmentContractEndPage.addContractEndMould['contract_num_loc'], contractNum) # 输入合同编 base.click(apartmentContractEndPage.addContractEndMould['search_button_loc']) # 搜索 base.staleness_of(apartmentContractEndPage.addContractEndMould['tr_contract']) # 等待列表刷新 base.context_click(apartmentContractEndPage.addContractEndMould['tr_contract']) # 右击第一条数据 base.click(apartmentContractEndPage.addContractEndMould['end_button_loc'], index=1) # 终止结算 base.click(apartmentContractEndPage.addContractEndMould['now_end_loc']) # 立即终止 endNum = 'AutoACE' + '-' + time.strftime('%m%d%H%M') base.input_text(apartmentContractEndPage.addContractEndMould['end_num_loc'], endNum) # 终止协议号 base.type_date(apartmentContractEndPage.typeMould['end_date'], info[1]) # 终止日期:承租到期日 base.type_select(apartmentContractEndPage.typeMould['end_type'], 'RETREATING') # 正退 base.input_text(apartmentContractEndPage.addContractEndMould['end_reason_loc'], u'承租周期已完') # 终止原因 base.type_select(apartmentContractEndPage.typeMould['receipt_type_loc'], 'PAYER') # 承租人 base.type_select(apartmentContractEndPage.typeMould['pay_type_loc'], 'PERSONAL') # 个人 base.input_text(apartmentContractEndPage.addContractEndMould['receipt_num_loc'], '123456789') # 收款卡号 base.send_keys(apartmentContractEndPage.addContractEndMould['receipt_num_loc'], Keys.ENTER) base.click(apartmentContractEndPage.addContractEndMould['cardconfirm_close_loc']) # 银行卡确认无误 base.dblclick(apartmentContractEndPage.addContractEndMould['weiyuejin_loc'], index=12) # 违约金 base.input_text(apartmentContractEndPage.addContractEndMould['receivable_money_loc'], breach_money) # 应收违约金 base.dblclick(apartmentContractEndPage.addContractEndMould['weiyuejin_loc'], index=21) # 转租费 base.input_text(apartmentContractEndPage.addContractEndMould['zhuanzu_money_loc'], zhuanzu_money) # 应收转租金 base.input_text(apartmentContractEndPage.addContractEndMould['remark_loc'], 'AutoTest') # 备注 base.click(apartmentContractEndPage.addContractEndMould['submit_button']) # 提交 base.check_submit() # 等待提交完成 contractEndAdd = "SELECT ace.end_contract_num FROM apartment_contract ac,apartment_contract_end ace WHERE ac.contract_id = ace.contract_id " \ "and ace.audit_status='NO_AUDIT' AND ace.end_type='RETREATING'and ace.deleted=0 and ac.contract_num='%s'" % contractNum base.diffAssert(lambda test: asserts(sqlbase.waitData(contractEndAdd, 1)).is_true(), 1123, u'%s:出租合同 %s 终止结算新增异常,执行SQL:%s' % (fileName, contractNum, contractEndAdd)) # 合同状态检查 contractStatus = sqlbase.serach( "select contract_status from apartment_contract where deleted = 0 and contract_num='%s' " % contractNum)[0] base.diffAssert(lambda test: asserts(contractStatus).is_equal_to('RETREATING'), 1123, u'%s:出租合同 %s 终止结算后状态异常异常,期望值 RETREATING 实际值 %s' % (fileName, contractNum, contractStatus)) # 扣回业绩检查 time.sleep(10) # 业绩生成有时间延迟,这里等待10秒 backAchievementSql = "select is_active,achieve_id,accounting_time from back_achievement where contract_num='%s' and deleted=0 " % contractNum base.diffAssert(lambda test: asserts(sqlbase.get_count(backAchievementSql)).is_equal_to(0), 1123, u'%s:出租合同 %s 正退终止有扣回业绩生成,业务异常' % (fileName, contractNum))
def test_1036(): """到期委托合同正常删除""" # describe:到期委托合同可以正常删除成功 # data:1、委托合同状态为到期;2.名下无出租合同 # result:委托合同删除成功; fileName = 'houseContract_1036' dateSql = "select date_sub(date(sysdate()),INTERVAL 24 month),date_add(date(sysdate()),INTERVAL 1 day),date_sub(date(sysdate()),interval 5 month)," \ "date_sub(date(sysdate()),interval 2 month),date_sub(date(sysdate()),INTERVAL 23 month) from dual" # 时间元素 dateInfo = sqlbase.serach(dateSql) houseSql = sqlbase.serach( "select house_id,residential_id,building_id,house_code from house where deleted=0 and city_code=330100 order by rand() limit 1") houseInfo = {'houseID': houseSql[0], 'residentialID': houseSql[1], 'buildingID': houseSql[2],'houseCode': houseSql[3]} # 开发房源信息 with Base() as base: #创建到期委托合同 apartmentId = addHouseContractAndFitment(apartment_type='BRAND', entrust_type='ENTIRE', sign_date=dateInfo[0], owner_sign_date=dateInfo[0], entrust_start_date=dateInfo[0], entrust_end_date=dateInfo[2], delay_date=dateInfo[3], free_start_date=dateInfo[0], free_end_date=dateInfo[4], first_pay_date=dateInfo[0], second_pay_date=dateInfo[4], rent=1234, parking=123, year_service_fee=321, payment_cycle='MONTH', fitment_start_date=dateInfo[0], fitment_end_date=dateInfo[4], rooms=3, fitmentCost=88888, houseInfo=houseInfo) contractSql = "select hc.contract_num,a.apartment_code from house_contract hc INNER JOIN apartment a on a.house_contract_id=hc.contract_id and a.apartment_id='%s'" % apartmentId contractInfo = sqlbase.serach(contractSql) contractNum = contractInfo[0] contractStatusSql = "select * from house_contract where contract_num='%s' and contract_status='EXPIRE'" % contractNum base.diffAssert(lambda test: asserts(sqlbase.waitData(contractStatusSql,1)).is_true(),1036, u'%s:已到期合同 %s 生成异常,执行SQL:%s"' % (fileName, contractNum, contractStatusSql)) base.open(page.entrustContractPage, houseContractPage.contractSearchMould['tr_contract']) base.input_text(houseContractPage.contractSearchMould['residential_name_loc'], contractInfo[1]) base.input_text(houseContractPage.contractSearchMould['contract_num_loc'], contractNum) base.click(houseContractPage.contractSearchMould['search_button_loc']) base.staleness_of(houseContractPage.contractSearchMould['tr_contract']) base.click(houseContractPage.addHouseContractMould['delete_button']) base.click(houseContractPage.addHouseContractMould['delete_button_confirm']) base.check_submit() # 合同状态检查 contractSqlb = "select * from house_contract where deleted=1 and contract_num='%s'" % contractNum base.diffAssert(lambda test: asserts(sqlbase.get_count(contractSqlb)).is_equal_to(1),1036, u'%s:已到期委托合同 %s 删除异常,执行SQL:%s"' % (fileName, contractNum, contractSqlb))
def test_1034(): """有效委托合同正常删除""" # describe:有效合同正常删除 # data:1、委托合同状态为有效;2、委托合同下没有有效状态的出租合同; # result:委托合同删除成功; fileName = 'houseContract_1034' # contractSql = "select hc.contract_num,h.house_code from house_contract hc inner join house h on h.house_id=hc.house_id where not EXISTS (select * from apartment_contract ac " \ # "where hc.house_id=ac.house_id) and hc.is_active='Y' and hc.deleted=0 and hc.city_code=330100 order by rand() limit 1" contractSql = "select hc.contract_num,h.house_code from house_contract hc inner join house h on h.house_id=hc.house_id where not EXISTS (select * from house_contract_pay hcp " \ "where hc.contract_id=hcp.contract_id and hcp.deleted=0) and not EXISTS (select * from apartment_contract ac where hc.house_id=ac.house_id)and hc.is_active='Y' " \ "and hc.deleted=0 and hc.city_code=330100" if sqlbase.get_count(contractSql) == 0: consoleLog(u'%s:SQL查无数据!' % fileName, 'w') consoleLog(u'执行SQL:%s' % contractSql) return contractInfo = sqlbase.serach(contractSql) contractNum = contractInfo[0] consoleLog(u'%s:取委托合同 %s 做删除' % (fileName, contractNum)) with Base() as base: base.open(page.entrustContractPage, houseContractPage.contractSearchMould['tr_contract']) base.input_text( houseContractPage.contractSearchMould['residential_name_loc'], contractInfo[1]) base.input_text( houseContractPage.contractSearchMould['contract_num_loc'], contractNum) base.click(houseContractPage.contractSearchMould['search_button_loc']) base.staleness_of(houseContractPage.contractSearchMould['tr_contract']) base.click(houseContractPage.addHouseContractMould['delete_button']) base.click( houseContractPage.addHouseContractMould['delete_button_confirm']) base.check_submit() # 合同状态检查 contractSqlb = "select * from house_contract where deleted=1 and contract_num='%s'" % contractNum base.diffAssert( lambda test: asserts(sqlbase.waitData(contractSqlb, 1)).is_true(), 1034, u'%s:委托合同 %s 删除异常,执行SQL:%s"' % (fileName, contractNum, contractSqlb))
def test_1014(): """正常出租合同删除""" # describe:正常出租合同删除 # data:出租合同状态有效且没有实收 # result:删除成功 fileName = 'apartmentContract_1014' contractSql = "select ac.contract_num from apartment_contract ac where not EXISTS (select * from apartment_contract_receipts acr where ac.contract_id=acr.contract_id) " \ "and ac.deleted=0 and ac.is_active='Y' and ac.city_code=330100 and ac.entrust_type='SHARE' and ac.contract_status='EFFECTIVE' ORDER BY RAND() LIMIT 1" if sqlbase.get_count(contractSql) == 0: consoleLog(u'%s:SQL查无数据!' % fileName, 'w') consoleLog(u'执行SQL:%s' % contractSql) return info = sqlbase.serach(contractSql) contractNum = info[0] consoleLog(u'%s:取随机有效出租合同 %s 做合同删除' % (fileName, contractNum)) with Base() as base: base.open(page.apartmentContractPage, apartmentContractPage.searchContractMould['tr_contract']) base.input_text( apartmentContractPage.searchContractMould['contract_num_loc'], contractNum) # 输入合同编号 base.click( apartmentContractPage.searchContractMould['search_button_loc']) base.staleness_of( apartmentContractPage.searchContractMould['tr_contract']) base.context_click( apartmentContractPage.searchContractMould['tr_contract']) base.click(apartmentContractPage.searchContractMould['delete_loc']) base.click(apartmentContractPage. addApartmentContractMould['delete_button_confirm']) base.check_submit() # 合同检查 contractStatusSql = "select * from apartment_contract where deleted=1 and contract_num='%s' " % contractNum base.diffAssert( lambda test: asserts(sqlbase.waitData(contractStatusSql, 1)). is_true(), 1014, u'%s:出租合同 %s 删除异常,执行SQL:%s' % (fileName, contractNum, contractStatusSql))
def test_1085(): """委托违约业绩失效""" # describe:违约业绩生效审核后删除终止结算,业绩变失效 # data:1、业绩已审核;2、终止结算未复审; # result:1、业绩变成已失效;2、状态同步到预估业绩排行榜; fileName = 'apartmentAchievement_1085' contractSql = "select contract_num,entrust_end_date,date(sysdate()) from house_contract where contract_id not in (select house_contract.contract_id from apartment ,apartment_contract ,house_contract " \ "where house_contract.contract_id=apartment.house_contract_id and apartment.house_id=apartment_contract.house_id and apartment_contract.real_due_date>NOW()) " \ "and city_code = 330100 and audit_status = 'APPROVED'and contract_status = 'EFFECTIVE' and deleted = 0 and entrust_end_date>NOW() order by rand() limit 1" if sqlbase.get_count(contractSql) == 0: consoleLog(u'%s:SQL查无数据!' % fileName, 'w') consoleLog(u'执行SQL:%s' % contractSql) return info = sqlbase.serach(contractSql) contractNum = info[0] consoleLog(u'%s:取随机委托合同 %s 做业主违约终止' % (fileName, contractNum)) with Base() as base: base.open(page.entrustContractPage, houseContractEndPage.addContractEndMould['tr_contract']) base.input_text(houseContractEndPage.searchMould['contract_num_loc'], contractNum) # 输入合同号 base.click(houseContractEndPage.searchMould['contract_search_button_loc']) # 搜索 base.staleness_of(houseContractEndPage.addContractEndMould['tr_contract']) # 等待数据刷新 base.context_click(houseContractEndPage.addContractEndMould['tr_contract']) # 右击第一条数据 base.click(houseContractEndPage.addContractEndMould['end_button_loc'], index=1) # 终止结算 base.wait_element(houseContractEndPage.addContractEndMould['penalty_loc']) # 等待页面出现 base.type_select(houseContractEndPage.typeMould['end_type'], 'OWNER_DEFAULT') # 结算类型-业主违约 endNum = 'AutoHCE' + '-' + time.strftime('%m%d%H%M') base.input_text(houseContractEndPage.addContractEndMould['end_num_loc'],endNum) base.type_date(houseContractEndPage.typeMould['end_date'], contractSql[2]) # 终止日期:当天 # 结算扣款 base.input_text(houseContractEndPage.addContractEndMould['penalty_loc'], 2000) # 违约金陪入 base.input_text(houseContractEndPage.addContractEndMould['penalty_remark_loc'], u'违约金陪入') # 备注 base.input_text(houseContractEndPage.addContractEndMould['return_rent_loc'], 5000) # 返还房租 base.input_text(houseContractEndPage.addContractEndMould['return_rent_remark_loc'], u'返还房租') # 备注 base.type_date(houseContractEndPage.typeMould['receivable_date'], contractSql[2]) # 应收日期 # 打款信息 base.type_select(houseContractEndPage.typeMould['pay_type'], 'OWNER') # 打款类别-业主收款 base.input_text(houseContractEndPage.addContractEndMould['pay_name_loc'], 'AutoTest') # 姓名 base.type_select(houseContractEndPage.typeMould['pay_object_loc'],'BUSINESS') # 公司 base.input_text(houseContractEndPage.addContractEndMould['pay_bank_loc'], u'中国银行') # 收款银行 base.input_text(houseContractEndPage.addContractEndMould['pay_bank_no_loc'], '12345678910') # 银行卡号 base.upload_file(houseContractEndPage.addContractEndMould['add_end_image_loc'], 'C:\Users\Public\Pictures\Sample Pictures\jsp.jpg') # 传图 base.wait_element(houseContractEndPage.addContractEndMould['end_image_loc']) base.click(houseContractEndPage.addContractEndMould['submit_loc']) # 提交 base.check_submit() # 等待提交完成 # 终止结算复审 contractEndAdd = "select hce.end_id from house_contract hc,house_contract_end hce where hc.contract_id=hce.contract_id and hc.contract_num='%s' and hce.deleted=0 " \ "and hce.audit_status='NO_AUDIT' and hce.end_type='OWNER_DEFAULT'" % contractNum base.diffAssert(lambda test: asserts(sqlbase.waitData(contractEndAdd, 1)).is_true(), 1085, u'%s:委托合同 %s 终止结算新增异常,执行SQL:%s' % (fileName, contractNum, contractEndAdd)) houseContractEndId = sqlbase.serach(contractEndAdd)[0] audit(houseContractEndId, auditType.houseContractEnd, auditStatus.chuShen, auditStatus.fuShen) # 违约业绩生效 breachAchievementSql = "select is_active,accounting_money,achieve_id from breach_achievement where breach_num='%s' and deleted=0 and breach_type='HOUSE_OWNER_DEFAULT_BREACH' " \ "and is_active='Y'" % contractNum base.diffAssert(lambda test: asserts(sqlbase.waitData(breachAchievementSql, 1)).is_true(), 1085, u'%s:委托合同 %s 业主违约生效异常,执行SQL:%s' % (fileName, contractNum, breachAchievementSql)) #业绩审核 base.open(page.defaultAchievementPage, apartmentAchievementPage.searchContractMould['tr_contract']) base.click(apartmentAchievementPage.searchContractMould['reset_button_loc']) # 重置 time.sleep(10) base.input_text(apartmentAchievementPage.searchContractMould['breach_num_loc'], contractNum) # 输入合同号 base.click(apartmentAchievementPage.searchContractMould['search_button_loc']) # 查找 base.staleness_of(apartmentAchievementPage.searchContractMould['tr_contract']) # 等待第一条数据刷新 base.dblclick(apartmentAchievementPage.searchContractMould['tr_contract'], checkLoc=apartmentAchievementPage.detailAchievementMoudle['breach_num_loc']) # 点击第一条数据等待详情页面完全显示 base.click(apartmentAchievementPage.detailAchievementMoudle['audit_button_loc']) base.input_text(apartmentAchievementPage.detailAchievementMoudle['contract_audit_content'], 'ok') base.click(apartmentAchievementPage.detailAchievementMoudle['contract_audit_confirm']) base.check_submit() # 终止结算反审后删除 audit(houseContractEndId, auditType.houseContractEnd, auditStatus.fanShen) base.open(page.contractEndPage, houseContractEndPage.searchMould['contract_search_button_loc']) base.click(houseContractEndPage.addContractEndMould['tab_info'], index=1) base.input_text(houseContractEndPage.searchMould['end_contract_num_loc'], contractNum) base.click(houseContractEndPage.searchMould['end_search_button_loc']) # 搜索 base.staleness_of(houseContractEndPage.searchMould['tr_contract_end']) # 等待数据刷新 base.click(houseContractEndPage.addContractEndMould['delete_button']) base.click(houseContractEndPage.addContractEndMould['delete_button_confirm']) base.check_submit() # 删除委托后业绩状态 breachAchievementNewSql = "select is_active,accounting_money,achieve_id from breach_achievement where breach_num='%s' and deleted=0 and breach_type='HOUSE_OWNER_DEFAULT_BREACH' " \ "and is_active='INVALID'" % contractNum base.diffAssert(lambda test: asserts(sqlbase.waitData(breachAchievementNewSql,1)).is_true(), 1085, u'%s:委托合同 %s 违约业绩生效审核后删除委托合同,业绩异常,执行SQL:%s' % (fileName, contractNum, breachAchievementNewSql)) # 预估排行榜业绩 breahAchievementDetailSql = "select ca.receivable,ca.is_active from contract_achievement ca inner join contract_achievement_detail cad on ca.achieve_id=cad.achieve_id inner " \ "join breach_achievement ba on ba.achieve_id=ca.achieve_id and ba.breach_type='HOUSE_OWNER_DEFAULT_BREACH' and ba.deleted=0 and ba.breach_num='%s' " \ "where ca.contract_category='HOUSE_OWNER_DEFAULT_BREACH' and ca.deleted=0" % contractNum breachAchievementStatus = sqlbase.serach(breahAchievementDetailSql)[1] base.diffAssert(lambda test: asserts(breachAchievementStatus).is_equal_to('INVALID'), 1085, u'%s:委托合同 %s 违约业绩生效审核后删除委托合同,业绩分成明细业绩状态异常,期望值 INVALID 实际值 %s' % (fileName, contractNum, breachAchievementStatus))
def test_1138(): """扣回业绩失效""" # describe:已生效且已审核的扣回业绩删除终止结算后业绩失效 # data:1、业绩已审核;2、终止结算未复审; # result:1、业绩变成已失效;2、状态同步到预估业绩排行榜; fileName = 'apartmentAchievement_1138' with Base() as base: # 创建委托合同和出租合同 houseSql = sqlbase.serach( "select house_id,residential_id,building_id,house_code from house where deleted=0 and city_code=330100 order by rand() limit 1" ) # 获取随机开发房源 houseInfo = { 'houseID': houseSql[0], 'residentialID': houseSql[1], 'buildingID': houseSql[2], 'houseCode': houseSql[3] } dateInfo = sqlbase.serach( "select date(sysdate()),date_add(date(sysdate()),INTERVAL 1 day),date_add(date(sysdate()),interval 2 year),date_add(date(sysdate()),interval 27 month)," "date_add(date(sysdate()),INTERVAL 1 month),date_add(date(sysdate()),INTERVAL 6 month),date_add(date(sysdate()),INTERVAL 3 month) from dual" ) # 日期元素 apartmentId = addHouseContractAndFitment( apartment_type='MANAGE', entrust_type='SHARE', sign_date=dateInfo[0], owner_sign_date=dateInfo[0], entrust_start_date=dateInfo[0], entrust_end_date=dateInfo[2], delay_date=dateInfo[3], free_start_date=dateInfo[0], free_end_date=dateInfo[4], first_pay_date=dateInfo[0], second_pay_date=dateInfo[4], rent=3000, parking=100, year_service_fee=500, payment_cycle='MONTH', fitment_start_date=dateInfo[0], fitment_end_date=dateInfo[4], rooms=3, fitmentCost=88888, houseInfo=houseInfo) houseContractInfo = sqlbase.serach( "select hc.contract_num,hc.contract_id from house_contract hc inner join apartment a on a.house_id = hc.house_id and a.apartment_id='%s' " "where hc.audit_status='AUDIT' " % apartmentId) houseContractId = houseContractInfo[1] rentPriceInfo = sqlbase.serach( "select rent_price,date(sysdate()) from apartment where apartment_id='%s'" % apartmentId) rentPrice = float(rentPriceInfo[0]) customer = createCustomer() apartmentContractInfo = createApartmentContract( apartement_id=apartmentId, customerInfo=customer, rent_price=rentPrice, sign_date=dateInfo[0], rent_start_date=dateInfo[1], rent_end_date=dateInfo[5], # 承租6个月 deposit=rentPrice, payment_cycle='MONTH') apartmentContractNum = apartmentContractInfo['contractNum'] apartmentContractId = apartmentContractInfo['contractID'] # 委托合同审核 audit(houseContractId, auditType.houseContract, auditStatus.chuShen, auditStatus.fuShen) # 出租合同审核 audit(apartmentContractId, auditType.apartmentContract, auditStatus.chuShen, auditStatus.fuShen) # 出租合同应收 base.open( page.apartmentContractPayPage, apartmentContractReceivablePage.searchMould['tr_receviable_loc']) base.click(apartmentContractReceivablePage.searchMould['reset_button']) base.staleness_of( apartmentContractReceivablePage.searchMould['tr_receviable_loc']) base.input_text( apartmentContractReceivablePage.searchMould['contractNum_loc'], apartmentContractNum) base.click( apartmentContractReceivablePage.searchMould['search_button']) base.staleness_of( apartmentContractReceivablePage.searchMould['tr_receviable_loc']) moneyType = { u'首期管家服务费': int(0.07 * rentPrice), u'中介服务费': 1000, u'首期租金': int(rentPrice), u'押金': int(rentPrice) } for i in range(3): moneyType_row = base.script( "var a = $('[datagrid-row-index=\"%s\"] > [field=\"money_type\"] > div').text();return a" % i, True) base.click( apartmentContractReceivablePage.searchMould['receviabl_button'] [i]) base.input_text( apartmentContractReceivablePage. detailMould['receipts_money_loc'], moneyType[moneyType_row]) base.click( apartmentContractReceivablePage.detailMould['receipts_type']) base.type_date( apartmentContractReceivablePage. detailMould['receipts_date_loc'], rentPriceInfo[1]) base.input_text( apartmentContractReceivablePage.detailMould['alipay_card_loc'], '13676595110') base.input_text( apartmentContractReceivablePage. detailMould['operation_total_loc'], moneyType[moneyType_row]) base.click( apartmentContractReceivablePage.detailMould['save_button']) base.check_submit() base.click( apartmentContractReceivablePage.detailMould['print_btn_close']) time.sleep(1) # 出单业绩生效检查 achievementsql = "select aca.is_active,aca.audit_status,aca.contract_audit_status from apartment_contract_achievement aca inner join apartment a " \ "on a.apartment_code=aca.house_code and a.apartment_id='%s' where aca.contract_num='%s' and aca.deleted=0 and aca.is_active='Y'" \ "and aca.accounting_time is not null" % (apartmentId, apartmentContractNum) base.diffAssert( lambda test: asserts(sqlbase.waitData(achievementsql, 1)).is_true( ), 1138, u'%s:出租合同 %s 业绩生效异常,执行SQL:%s' % (fileName, apartmentContractNum, achievementsql)) # 终止结算 deposit_money = '888.88' # 应付押金 breach_money = '666.66' # 转租费 base.open(page.apartmentContractPage, apartmentContractEndPage.addContractEndMould['tr_contract']) base.input_text( apartmentContractEndPage.addContractEndMould['contract_num_loc'], apartmentContractNum) # 输入合同编 base.click(apartmentContractEndPage. addContractEndMould['search_button_loc']) # 搜索 base.staleness_of(apartmentContractEndPage. addContractEndMould['tr_contract']) # 等待列表刷新 base.context_click(apartmentContractEndPage. addContractEndMould['tr_contract']) # 右击第一条数据 base.click( apartmentContractEndPage.addContractEndMould['end_button_loc'], index=1) # 终止结算 base.click(apartmentContractEndPage.addContractEndMould['now_end_loc'] ) # 立即终止 base.input_text( apartmentContractEndPage.addContractEndMould['end_reason_loc'], u'退租') # 终止原因 endNum = 'AutoACE' + '-' + time.strftime('%m%d%H%M') base.type_date(apartmentContractEndPage.typeMould['end_date'], dateInfo[0]) # 终止日期:当天 base.type_select(apartmentContractEndPage.typeMould['end_type'], 'OWNER_DEFAULT') # 退租 base.input_text( apartmentContractEndPage.addContractEndMould['end_num_loc'], endNum) # 终止协议号 base.type_select( apartmentContractEndPage.typeMould['receipt_type_loc'], 'PAYER') # 承租人 base.type_select(apartmentContractEndPage.typeMould['pay_type_loc'], 'PERSONAL') # 个人 base.input_text( apartmentContractEndPage.addContractEndMould['receipt_num_loc'], '123456789') # 收款卡号 base.send_keys( apartmentContractEndPage.addContractEndMould['receipt_num_loc'], Keys.ENTER) base.click(apartmentContractEndPage. addContractEndMould['cardconfirm_close_loc']) # 银行卡确认无误 base.dblclick( apartmentContractEndPage.addContractEndMould['project_type_loc'], index=1) # 租金 base.input_text(apartmentContractEndPage. addContractEndMould['payable_deposit_loc'], deposit_money) # 应退押金:终止收支类型为收入才能删除 base.dblclick( apartmentContractEndPage.addContractEndMould['project_type_loc'], index=12) # 违约金 base.input_text(apartmentContractEndPage. addContractEndMould['receivable_money_loc'], breach_money) # 应收违约金 base.upload_file( apartmentContractEndPage.addContractEndMould['add_end_image_loc'], 'C:\Users\Public\Pictures\Sample Pictures\jsp.jpg') # 传图 base.wait_element( apartmentContractEndPage.addContractEndMould['end_image_loc']) base.input_text( apartmentContractEndPage.addContractEndMould['remark_loc'], 'AutoTest') # 备注 base.click(apartmentContractEndPage. addContractEndMould['submit_button']) # 提交 base.check_submit() # 等待提交完成 # 终止结算审核 contractEndAdd="SELECT ace.end_id FROM apartment_contract ac,apartment_contract_end ace WHERE ac.contract_id = ace.contract_id and ace.audit_status='NO_AUDIT' " \ "AND ace.end_type='OWNER_DEFAULT'and ace.deleted=0 and ace.end_contract_num='%s'" % endNum apartmentContractEndId = sqlbase.serach(contractEndAdd)[0] audit(apartmentContractEndId, auditType.apartmentContractEnd, auditStatus.chuShen, auditStatus.fuShen) # 扣回业绩检查 backAchievementSql = "select is_active,achieve_id,accounting_time from back_achievement where contract_num='%s' and deleted=0 and contract_end_type='OWNER_DEFAULT' " \ "and is_active='Y'" % apartmentContractNum base.diffAssert( lambda test: asserts(sqlbase.waitData(backAchievementSql, 1)). is_true(), 1138, u'%s:出租合同 %s 扣回业绩生效异常,执行SQL:%s' % (fileName, apartmentContractNum, backAchievementSql)) # 业绩审核 base.open(page.backAchievementPage, apartmentAchievementPage.searchContractMould['tr_contract']) base.click(apartmentAchievementPage. searchContractMould['reset_button_loc']) # 重置 time.sleep(10) # 等待重新核算更新数据 base.input_text( apartmentAchievementPage.searchContractMould['contract_num_loc'], apartmentContractNum) # 输入合同号 base.click(apartmentAchievementPage. searchContractMould['search_button_loc']) # 查找 base.staleness_of(apartmentAchievementPage. searchContractMould['tr_contract']) # 等待第一条数据刷新 base.dblclick( apartmentAchievementPage.searchContractMould['tr_contract'], checkLoc=apartmentAchievementPage. detailAchievementMoudle['contract_num_loc']) # 点击第一条数据等待详情页面完全显示 base.click(apartmentAchievementPage. detailAchievementMoudle['audit_button_loc']) base.input_text( apartmentAchievementPage. detailAchievementMoudle['contract_audit_content'], 'ok') base.click(apartmentAchievementPage. detailAchievementMoudle['contract_audit_confirm']) base.check_submit() # 删除终止结算 audit(apartmentContractEndId, auditType.apartmentContractEnd, auditStatus.fanShen) base.open(page.contractEndPage, apartmentContractEndPage.searchMould['tr_contract_end']) base.input_text( apartmentContractEndPage.searchMould['contract_num_loc'], apartmentContractNum) # 输入合同号 base.click( apartmentContractEndPage.searchMould['search_button_loc']) # 搜索 base.staleness_of( apartmentContractEndPage.searchMould['tr_contract_end']) # 等待列表刷新 base.click( apartmentContractEndPage.addContractEndMould['delete_button']) base.click(apartmentContractEndPage. addContractEndMould['delete_button_confirm']) base.check_submit() # 终止结算删除后 backAchievementDelSql = "select is_active,achieve_id,accounting_time from back_achievement where contract_num='%s' and deleted=0 and contract_end_type='OWNER_DEFAULT' " \ "and is_active='INVALID'" % apartmentContractNum base.diffAssert( lambda test: asserts(sqlbase.waitData(backAchievementDelSql, 1)). is_true(), 1138, u'%s:出租合同 %s 扣回业绩审核删除终止结算后业绩异常,执行SQL:%s' % (fileName, apartmentContractNum, backAchievementDelSql)) # 业绩分成明细表(预估业绩排行榜数据取值表,检查扣回业绩同步更新到预估业绩排行榜) breahAchievementDetailSql = "select ca.receivable,ca.is_active from contract_achievement ca inner join contract_achievement_detail cad on ca.achieve_id=cad.achieve_id inner " \ "join back_achievement ba on ba.achieve_id=ca.achieve_id and ba.contract_end_type='OWNER_DEFAULT' and ba.deleted=0 and ba.contract_num='%s' " \ "where ca.contract_category='OWNER_DEFAULT_BACK' and ca.deleted=0" % apartmentContractNum breachAchievementStatus = sqlbase.serach(breahAchievementDetailSql)[1] base.diffAssert( lambda test: asserts(breachAchievementStatus).is_equal_to('INVALID' ), 1138, u'%s:出租合同 %s 退租扣回业绩审核删除终止结算后,业绩分成明细业绩状态异常,期望值 INVALID 实际值 %s' % (fileName, apartmentContractNum, breachAchievementStatus))
def test_1040(): """出租和委托复审后业绩生效""" # describe: 无前合同,出租和委托复审后业绩生效 # data:1、出租合同无前合同;2、出租合同未复审;3、委托合同未复审;4、业绩状态为未生效; # result:1、未生效业绩变为生效;2、业绩中的合同复审状态变为已复审;3、未起算的业绩状态不变; fileName = 'apartmentAchievement_1040' with Base() as base: # 创建房源,委托合同 dateSql = "select date(sysdate()),date_add(date(sysdate()),INTERVAL 1 day),date_add(date(sysdate()),interval 1 year),date_add(date(sysdate()),interval 3 year)," \ "date_add(date(sysdate()),INTERVAL 1 month) from dual" dateInfo = sqlbase.serach(dateSql) apartmentId = addHouseContractAndFitment( apartment_type='MANAGE', entrust_type='SHARE', sign_date=dateInfo[0], owner_sign_date=dateInfo[0], entrust_start_date=dateInfo[0], entrust_end_date=dateInfo[3], delay_date=dateInfo[3], free_start_date=dateInfo[0], free_end_date=dateInfo[4], first_pay_date=dateInfo[0], second_pay_date=dateInfo[4], rent=1234, parking=123, year_service_fee=321, payment_cycle='MONTH', fitment_start_date=dateInfo[0], fitment_end_date=dateInfo[4], rooms=3, fitmentCost=88888) houseContractInfo = sqlbase.serach( "select hc.contract_num,hc.contract_id from house_contract hc inner join apartment a on a.house_id = hc.house_id " "and a.apartment_id='%s' where hc.audit_status='AUDIT' " % apartmentId) houseContractId = houseContractInfo[1] # 创建租客,出租合同 customer = createCustomer() apartmentContractInfo = createApartmentContract( apartement_id=apartmentId, customerInfo=customer, rent_price=5500, sign_date=dateInfo[0], rent_start_date=dateInfo[1], rent_end_date=dateInfo[2], deposit=2000, payment_cycle='MONTH') apartmentContractNum = apartmentContractInfo['contractNum'] apartmentContractId = apartmentContractInfo['contractID'] # 出租合同检查 contractAdd = "select * from apartment a,apartment_contract ac ,apartment_contract_relation acr where a.apartment_id=acr.apartment_id and acr.contract_id=ac.contract_id " \ "and a.apartment_id='%s'AND ac.contract_num = '%s'AND ac.audit_status='AUDIT' and ac.contract_type = 'NEWSIGN' AND ac.entrust_type='SHARE' " \ "AND ac.is_active='Y' " % (apartmentId, apartmentContractNum) base.diffAssert( lambda test: asserts(sqlbase.waitData(contractAdd, 1)).is_true(), 1040, u'%s:出租合同 %s 新增失败,执行SQL:%s' % (fileName, apartmentContractNum, contractAdd)) # 业绩检查 achievementsqla = "select aca.is_active,aca.audit_status,aca.accounting_time from apartment_contract_achievement aca inner join apartment a on a.apartment_code=aca.house_code " \ "and a.apartment_id='%s' where aca.contract_num='%s' and aca.deleted=0" % (apartmentId,apartmentContractNum) if sqlbase.waitData(achievementsqla, 1): achievementinfo = sqlbase.serach(achievementsqla) base.diffAssert( lambda test: asserts(achievementinfo[0]).is_equal_to('N'), 1040, u'%s:合同 %s 对应业绩生效状态异常,期望值 N 实际值 %s' % (fileName, apartmentContractNum, achievementinfo[0])) base.diffAssert( lambda test: asserts(achievementinfo[1]).is_equal_to('AUDIT'), 1040, u'%s:合同 %s 对应业绩审核状态异常, 期望值 AUDIT 实际值 %s' % (fileName, apartmentContractNum, achievementinfo[1])) else: consoleLog( u'%s:出租合同 %s 对应业绩生成异常' % (fileName, apartmentContractNum), 'e') consoleLog(u'执行SQL:%s' % achievementsqla) # 委托合同复审 audit(houseContractId, auditType.houseContract, auditStatus.chuShen, auditStatus.fuShen) # 出租合同复审 audit(apartmentContractId, auditType.apartmentContract, auditStatus.chuShen, auditStatus.fuShen) # 业绩状态检查 achievementsqlb = "select aca.is_active,aca.audit_status,aca.contract_audit_status from apartment_contract_achievement aca inner join apartment a on a.apartment_code=aca.house_code " \ "and a.apartment_id='%s' where aca.contract_num='%s' and aca.contract_audit_status='APPROVED' and aca.deleted=0" % (apartmentId, apartmentContractNum) if sqlbase.waitData(achievementsqlb, 1): achievementinfob = sqlbase.serach(achievementsqlb) base.diffAssert( lambda test: asserts(achievementinfob[0]).is_equal_to('Y'), 1040, u'%s:合同 %s 对应业绩生效状态异常,期望值 Y 实际值 %s' % (fileName, apartmentContractNum, achievementinfob[0])) base.diffAssert( lambda test: asserts(achievementinfob[1]).is_equal_to('AUDIT'), 1040, u'%s:合同 %s 对应业绩审核状态异常, 期望值 AUDIT 实际值 %s' % (fileName, apartmentContractNum, achievementinfob[1])) else: consoleLog(u'%s:合同 %s 对应业绩状态错误' % (fileName, apartmentContractNum), 'e') consoleLog(u'执行SQL:%s' % achievementsqlb)
def test_1051(): """业绩审核""" # describe:业绩审核后重新核算功能不可用 # data:1、出单业绩状态为生效;2、出单业绩审核状态为待审核 # result:1、业绩审核状态变为已审核;2、预估业绩排行榜中对应审核状态同步变为已审核;3、重新核算功能不可用; fileName = 'apartmentAchievement_1051' achievementSql = "select contract_num,house_code from apartment_contract_achievement where is_active='Y' and audit_status='AUDIT' AND deleted=0 and accounting_num=1 and city_code=330100 order by rand() limit 1" if sqlbase.get_count(achievementSql) == 0: consoleLog(u'%s:SQL查无数据!' % fileName, 'w') consoleLog(u'执行SQL:%s' % achievementSql) return info = sqlbase.serach(achievementSql) apartmentContractNum = info[0] consoleLog(u'%s:使用出租合同 %s 出单业绩做审核' % (fileName, apartmentContractNum)) with Base() as base: base.open(page.apartmentAchievementPage, apartmentAchievementPage.searchContractMould['tr_contract']) base.click(apartmentAchievementPage. searchContractMould['reset_button_loc']) # 重置 base.input_text( apartmentAchievementPage.searchContractMould['contract_num_loc'], apartmentContractNum) # 输入合同号 base.input_text( apartmentAchievementPage.searchContractMould['search_address_loc'], info[1]) # 房源编号 base.type_select( apartmentAchievementPage.searchContractMould['contract_type_loc'], 'NEWSIGN') # 承租类型 base.click(apartmentAchievementPage. searchContractMould['search_button_loc']) # 查找 base.staleness_of(apartmentAchievementPage. searchContractMould['tr_contract']) # 等待第一条数据刷新 base.dblclick( apartmentAchievementPage.searchContractMould['tr_contract'], checkLoc=apartmentAchievementPage. detailAchievementMoudle['contract_num_loc']) # 点击第一条数据等待详情页面完全显示 base.click(apartmentAchievementPage. detailAchievementMoudle['audit_button_loc']) base.input_text( apartmentAchievementPage. detailAchievementMoudle['contract_audit_content'], 'ok') base.click(apartmentAchievementPage. detailAchievementMoudle['contract_audit_confirm']) base.check_submit() achievementStatus = "select * from apartment_contract_achievement where is_active='Y' and audit_status='APPROVED' AND deleted=0 and accounting_num=1 " \ "and city_code=330100 and contract_num='%s'" % apartmentContractNum base.diffAssert( lambda test: asserts(sqlbase.waitData(achievementStatus, 1) ).is_true(), 1051, u'%s:出租合同 %s 业绩审核异常' % (fileName, apartmentContractNum)) base.dblclick( apartmentAchievementPage.searchContractMould['tr_contract'], checkLoc=apartmentAchievementPage. detailAchievementMoudle['contract_num_loc']) # 点击第一条数据等待详情页面完全显示 try: base.click( apartmentAchievementPage.detailAchievementMoudle['resave_loc']) except: consoleLog(u'已审核业绩无法重新核算') # 预发排行榜业绩 base.open(page.achievementListPrePage, apartmentAchievementPage.searchContractMould['tr_contract']) base.click(apartmentAchievementPage. searchContractMould['reset_button_loc']) # 重置 base.staleness_of( apartmentAchievementPage.searchContractMould['tr_contract']) base.input_text(apartmentAchievementPage. searchContractMould['contract_num_hefa_loc'], apartmentContractNum) # 输入合同号 base.input_text( apartmentAchievementPage.searchContractMould['search_address_loc'], info[1]) # 输入房源 base.type_select( apartmentAchievementPage.searchContractMould['contract_type_loc'], 'NORMAL') # 业绩类型 base.type_select( apartmentAchievementPage.searchContractMould['rent_type_loc'], 'NEWSIGN') base.click(apartmentAchievementPage. searchContractMould['search_button_loc']) # 查找 base.staleness_of(apartmentAchievementPage. searchContractMould['tr_contract']) # 等待第一条数据刷新 achievementDetailCount = sqlbase.get_count( "select * from contract_achievement_detail acd inner join apartment_contract_achievement aca " "on aca.achievement_id=acd.achieve_id and aca.contract_num='%s' where acd.deleted=0" % apartmentContractNum) for i in range(achievementDetailCount): achievement_audit_status = base.script( "var a = $('[datagrid-row-index=\"%s\"] > [field=\"audit_status\"] > div').text();return a" % i, True) audit_status = u'已审核' base.diffAssert( lambda test: asserts(achievement_audit_status).is_equal_to( audit_status), 1051, u'%s:出租合同 %s 对应预估业绩排行榜页面第 %s 条状态异常,期望值 %s 实际值 %s' % (fileName, apartmentContractNum, i + 1, audit_status, achievement_audit_status))
def test_1048(): """修改前合同终止结算日期""" # describe:修改前合同终止结算日期 # data:1、业绩审核状态为待审核;2、业绩对应的合同有前合同,且前合同有终止结算;3、前合同终止日期之后无资源划转;4、记录原业绩中的委托核算周期和差价业绩;5、终止结算日期不在委托合同免租期内; # result:1、新业绩中委托核算周期比原来多1天;2、新的差价业绩与原来的值不同; fileName = 'apartmentAchievement_1048' with Base() as base: # 创建委托合同和出租合同 houseSql = sqlbase.serach( "select house_id,residential_id,building_id,house_code from house where deleted=0 and city_code=330100 order by rand() limit 1" ) # 获取随机开发房源 houseInfo = { 'houseID': houseSql[0], 'residentialID': houseSql[1], 'buildingID': houseSql[2], 'houseCode': houseSql[3] } dateInfo = sqlbase.serach( "select date(sysdate()),DATE_SUB(date(sysdate()),INTERVAL 1 year) ,DATE_SUB(date(sysdate()),INTERVAL 11 MONTH) ,DATE_ADD(date(sysdate()),INTERVAL 1 YEAR) ," "DATE_ADD(date(sysdate()),INTERVAL 15 MONTH) ,DATE_SUB(date(sysdate()),INTERVAL 1 MONTH),DATE_SUB(date(sysdate()),INTERVAL 20 DAY)," "DATE_SUB(date(DATE_ADD(date(sysdate()),INTERVAL 1 YEAR)),INTERVAL 1 DAY ) from dual " ) # 日期元素 apartmentId = addHouseContractAndFitment( apartment_type='MANAGE', entrust_type='SHARE', sign_date=dateInfo[1], owner_sign_date=dateInfo[1], entrust_start_date=dateInfo[1], entrust_end_date=dateInfo[7], delay_date=dateInfo[4], free_start_date=dateInfo[1], free_end_date=dateInfo[2], first_pay_date=dateInfo[1], second_pay_date=dateInfo[2], rent=3000, parking=100, year_service_fee=500, payment_cycle='MONTH', fitment_start_date=dateInfo[1], fitment_end_date=dateInfo[2], rooms=3, fitmentCost=88888, houseInfo=houseInfo) rentPriceInfo = sqlbase.serach( "select rent_price,date(sysdate()) from apartment where apartment_id='%s'" % apartmentId) rentPrice = float(rentPriceInfo[0]) customer = createCustomer() apartmentContractInfoF = createApartmentContract( apartement_id=apartmentId, customerInfo=customer, rent_price=rentPrice, sign_date=dateInfo[2], rent_start_date=dateInfo[2], rent_end_date=dateInfo[7], deposit=rentPrice, payment_cycle='MONTH') apartmentContractNumF = apartmentContractInfoF['contractNum'] apartmentContractIdF = apartmentContractInfoF['contractID'] # 第一份合同审核 audit(apartmentContractIdF, auditType.apartmentContract, auditStatus.chuShen, auditStatus.fuShen) # base.open(page.apartmentContractPage, apartmentContractPage.searchContractMould['tr_contract']) # base.input_text(apartmentContractPage.searchContractMould['contract_num_loc'], apartmentContractNumF) # 输入合同编号 # base.click(apartmentContractPage.searchContractMould['search_button_loc']) # base.staleness_of(apartmentContractPage.searchContractMould['tr_contract']) # base.dblclick(apartmentContractPage.searchContractMould['tr_contract']) # 双击第一条数据 # # 打开详情页需要加载,但DOM其实已经加载完仍旧无法点击,此处加5秒等待 # for i in range(5): # try: # base.click(apartmentContractPage.addApartmentContractMould['tab_info_loc'], index=4) # 租客详情 # break # except: # time.sleep(1) # # 初审 # base.click(apartmentContractPage.addApartmentContractMould['chushen_loc']) # 初审 # base.click(apartmentContractPage.addApartmentContractMould['contract_audit_confirm']) # 确定 # base.staleness_of(apartmentContractPage.searchContractMould['tr_contract']) # 等待列表刷新 # base.dblclick(apartmentContractPage.searchContractMould['tr_contract']) # 双击第一条数据 # for i in range(5): # try: # base.click(apartmentContractPage.addApartmentContractMould['tab_info_loc'], index=4) # 租客详情 # break # except: # time.sleep(1) # # 复审 # base.click(apartmentContractPage.addApartmentContractMould['fushen_loc']) # 复审 # base.click(apartmentContractPage.addApartmentContractMould['contract_audit_confirm']) # 确定 # base.staleness_of(apartmentContractPage.searchContractMould['tr_contract']) # 等待列表刷新 #终止结算 base.open(page.apartmentContractPage, apartmentContractEndPage.addContractEndMould['tr_contract']) base.input_text( apartmentContractEndPage.addContractEndMould['contract_num_loc'], apartmentContractNumF) # 输入合同编 base.click(apartmentContractEndPage. addContractEndMould['search_button_loc']) # 搜索 base.staleness_of(apartmentContractEndPage. addContractEndMould['tr_contract']) # 等待列表刷新 base.context_click(apartmentContractEndPage. addContractEndMould['tr_contract']) # 右击第一条数据 base.click( apartmentContractEndPage.addContractEndMould['end_button_loc'], index=1) # 终止结算 base.click(apartmentContractEndPage.addContractEndMould['now_end_loc'] ) # 立即终止 base.input_text( apartmentContractEndPage.addContractEndMould['end_reason_loc'], u'承租周期已完') # 终止原因 endNum = 'AutoACE' + '-' + time.strftime('%m%d%H%M') base.type_date(apartmentContractEndPage.typeMould['end_date'], dateInfo[5]) # 终止日期:合同到期日 base.type_select(apartmentContractEndPage.typeMould['end_type'], 'OWNER_DEFAULT') # 退租 base.input_text( apartmentContractEndPage.addContractEndMould['end_num_loc'], endNum) # 终止协议号 base.type_select( apartmentContractEndPage.typeMould['receipt_type_loc'], 'PAYER') # 承租人 base.type_select(apartmentContractEndPage.typeMould['pay_type_loc'], 'PERSONAL') # 个人 base.input_text( apartmentContractEndPage.addContractEndMould['receipt_num_loc'], '123456789') # 收款卡号 base.send_keys( apartmentContractEndPage.addContractEndMould['receipt_num_loc'], Keys.ENTER) base.click( houseContractPage.addHouseContractMould['close_loc']) # 确认无误 base.dblclick( apartmentContractEndPage.addContractEndMould['weiyuejin_loc'], index=12) # 违约金 base.input_text(apartmentContractEndPage. addContractEndMould['receivable_money_loc'], '888.88') # 应收违约金 base.input_text( apartmentContractEndPage.addContractEndMould['payable_money_loc'], '666.66') # 应退违约金 base.upload_file( apartmentContractEndPage.addContractEndMould['add_end_image_loc'], 'C:\Users\Public\Pictures\Sample Pictures\jsp.jpg') # 传图 base.wait_element( apartmentContractEndPage.addContractEndMould['end_image_loc']) base.input_text( apartmentContractEndPage.addContractEndMould['remark_loc'], 'AutoTest') # 备注 base.click(apartmentContractEndPage. addContractEndMould['submit_button']) # 提交 base.check_submit() # 等待提交完成 apartmentStatusSql = "select * from apartment where rent_status='WAITING_RENT' and apartment_id='%s' " % apartmentId base.diffAssert( lambda test: asserts(sqlbase.waitData(apartmentStatusSql, 1)). is_true(), 1048, u'%s:房源ID %s 未释放' % (fileName, apartmentId)) # 第二份出租合同 customer = createCustomer() apartmentContractInfoS = createApartmentContract( apartement_id=apartmentId, customerInfo=customer, rent_price=rentPrice, sign_date=dateInfo[0], rent_start_date=dateInfo[0], rent_end_date=dateInfo[7], deposit=rentPrice, payment_cycle='MONTH') apartmentContractNumS = apartmentContractInfoS['contractNum'] achievementSql = "select profits_fee from apartment_contract_achievement where contract_num='%s' and deleted=0 and accounting_num=1" % apartmentContractNumS base.diffAssert( lambda test: asserts(sqlbase.waitData(achievementSql, 1)).is_true( ), 1048, u'%s:出租合同 %s 业绩生成异常' % (fileName, apartmentContractNumS)) # 获取当前的核算收进价和差价业绩 base.open(page.apartmentAchievementPage, apartmentAchievementPage.searchContractMould['tr_contract']) base.click(apartmentAchievementPage. searchContractMould['reset_button_loc']) # 重置 base.input_text( apartmentAchievementPage.searchContractMould['contract_num_loc'], apartmentContractNumS) # 输入合同号 base.click(apartmentAchievementPage. searchContractMould['search_button_loc']) # 查找 base.staleness_of(apartmentAchievementPage. searchContractMould['tr_contract']) # 等待第一条数据刷新 base.dblclick( apartmentAchievementPage.searchContractMould['tr_contract'], checkLoc=apartmentAchievementPage. detailAchievementMoudle['contract_num_loc']) # 点击第一条数据等待详情页面完全显示 accountingmonthOld = base.script( "var a = $('#house_contract_table tbody > tr >td:nth-child(9)').text();return a", True) profits_fee_old = sqlbase.serach(achievementSql)[0] # 修改前合同终止结算日期 base.open(page.contractEndPage, apartmentContractEndPage.searchMould['tr_contract_end']) base.input_text( apartmentContractEndPage.searchMould['contract_num_loc'], apartmentContractNumF) base.click(apartmentContractEndPage.searchMould['search_button_loc']) base.staleness_of( apartmentContractEndPage.searchMould['tr_contract_end']) base.dblclick(apartmentContractEndPage.searchMould['tr_contract_end'], checkLoc=apartmentContractEndPage. addContractEndMould['apartment_num_loc']) time.sleep(3) base.type_date(apartmentContractEndPage.typeMould['end_date'], dateInfo[6]) # 终止日期:合同到期日 base.click( apartmentContractEndPage.addContractEndMould['save_button']) # 保存 base.check_submit() # 获取最新的核算收进价和差价业绩 base.open(page.apartmentAchievementPage, apartmentAchievementPage.searchContractMould['tr_contract']) base.click(apartmentAchievementPage. searchContractMould['reset_button_loc']) # 重置 time.sleep(10) base.input_text( apartmentAchievementPage.searchContractMould['contract_num_loc'], apartmentContractNumS) # 输入合同号 base.click(apartmentAchievementPage. searchContractMould['search_button_loc']) # 查找 base.staleness_of(apartmentAchievementPage. searchContractMould['tr_contract']) # 等待第一条数据刷新 base.dblclick( apartmentAchievementPage.searchContractMould['tr_contract'], checkLoc=apartmentAchievementPage. detailAchievementMoudle['contract_num_loc']) # 点击第一条数据等待详情页面完全显示 accountingmonthNew = base.script( "var a = $('#house_contract_table tbody > tr >td:nth-child(9)').text();return a", True) profits_fee_new = sqlbase.serach(achievementSql)[0] base.diffAssert( lambda test: asserts(accountingmonthNew).is_not_equal_to( accountingmonthOld), 1048, u'%s:出租合同 %s 对应前合同终止日期修改后业绩中核算收进价异常,修改前 %s 修改后 %s' % (fileName, apartmentContractNumS, accountingmonthOld, accountingmonthNew)) base.diffAssert( lambda test: asserts(profits_fee_new).is_not_equal_to( profits_fee_old), 1048, u'%s:出租合同 %s 对应委托成本修改后业绩中差价业绩异常,修改前 %s 修改后 %s' % (fileName, apartmentContractNumS, profits_fee_old, profits_fee_new))
def test_1016(): """出租合同正退终止结算""" # describe:检测合同终止为正退,初审复审反审驳回删除 # data:1.合同已复审2.合同不是已续 # result:终止结算提交成功,驳回初审复审反审删除成功 fileName = 'apartmentContract_1016' contractSql = "SELECT contract_num,rent_end_date from apartment_contract where deleted = 0 and city_code = 330100 and audit_status = 'APPROVED' and contract_status = 'EFFECTIVE' " \ "and contract_type = 'NEWSIGN' and entrust_type = 'SHARE' and payment_type<>'NETWORKBANK' order by rand() limit 1" if sqlbase.get_count(contractSql) == 0: consoleLog(u'%s:SQL查无数据!' % fileName, 'w') consoleLog(u'执行SQL:%s' % contractSql) return info = sqlbase.serach(contractSql) contractNum = info[0] consoleLog(u'%s:取随机出租合同 %s 做正退终止' % (fileName, contractNum)) with Base() as base: base.open(page.apartmentContractPage, apartmentContractEndPage.addContractEndMould['tr_contract']) base.input_text( apartmentContractEndPage.addContractEndMould['contract_num_loc'], contractNum) # 输入合同编 base.click(apartmentContractEndPage. addContractEndMould['search_button_loc']) # 搜索 base.staleness_of(apartmentContractEndPage. addContractEndMould['tr_contract']) # 等待列表刷新 base.context_click(apartmentContractEndPage. addContractEndMould['tr_contract']) # 右击第一条数据 base.click( apartmentContractEndPage.addContractEndMould['end_button_loc'], index=1) # 终止结算 base.click(apartmentContractEndPage.addContractEndMould['now_end_loc'] ) # 立即终止 base.input_text( apartmentContractEndPage.addContractEndMould['end_reason_loc'], u'承租周期已完') # 终止原因 endNum = 'AutoACE' + '-' + time.strftime('%m%d%H%M') base.type_date(apartmentContractEndPage.typeMould['end_date'], info[1]) # 终止日期:承租到期日 base.type_select(apartmentContractEndPage.typeMould['end_type'], 'RETREATING') # 正退租 base.type_select( apartmentContractEndPage.typeMould['receipt_type_loc'], 'PAYER') # 承租人 base.type_select(apartmentContractEndPage.typeMould['pay_type_loc'], 'PERSONAL') # 个人 base.input_text( apartmentContractEndPage.addContractEndMould['receipt_num_loc'], '123456789') # 收款卡号 base.send_keys( apartmentContractEndPage.addContractEndMould['receipt_num_loc'], Keys.ENTER) base.click(apartmentContractEndPage. addContractEndMould['cardconfirm_close_loc']) # 银行卡确认无误 base.dblclick( apartmentContractEndPage.addContractEndMould['weiyuejin_loc'], index=12) # 违约金 base.input_text(apartmentContractEndPage. addContractEndMould['receivable_money_loc'], '888.88') # 应收违约金 base.input_text( apartmentContractEndPage.addContractEndMould['payable_money_loc'], '999.99') # 应退违约金 base.input_text( apartmentContractEndPage.addContractEndMould['remark_loc'], 'AutoTest') # 备注 base.click(apartmentContractEndPage. addContractEndMould['submit_button']) # 提交 base.check_submit() # 等待提交完成 contractEndAdd = "SELECT ace.end_contract_num FROM apartment_contract ac,apartment_contract_end ace WHERE ac.contract_id = ace.contract_id " \ "and ace.audit_status='NO_AUDIT' AND ace.end_type='RETREATING'and ace.deleted=0 and ac.contract_num='%s'" % contractNum base.diffAssert( lambda test: asserts(sqlbase.waitData(contractEndAdd, 1)).is_true( ), 1016, u'%s:出租合同 %s 终止结算新增异常,执行SQL:%s' % (fileName, contractNum, contractEndAdd)) base.open(page.contractEndPage, apartmentContractEndPage.searchMould['tr_contract_end'], havaFrame=False) base.input_text( apartmentContractEndPage.searchMould['contract_num_loc'], contractNum) # 输入合同号 base.click( apartmentContractEndPage.searchMould['search_button_loc']) # 搜索 base.staleness_of( apartmentContractEndPage.searchMould['tr_contract_end']) # 等待列表刷新 base.dblclick( apartmentContractEndPage.searchMould['tr_contract_end']) # 双击第一条数据 # 驳回 base.click( apartmentContractEndPage.addContractEndMould['bohui_loc']) # 驳回 base.input_text(apartmentContractEndPage. addContractEndMould['contract_audit_content'], u'AutoTest') #驳回意见 base.click(apartmentContractEndPage. addContractEndMould['contract_audit_confirm']) # 确定 base.check_submit() base.dblclick( apartmentContractEndPage.searchMould['tr_contract_end']) # 双击第一条数据 # 初审 base.click( apartmentContractEndPage.addContractEndMould['chushen_loc']) # 初审 base.click(apartmentContractEndPage. addContractEndMould['contract_audit_confirm']) # 确定 base.check_submit() base.dblclick( apartmentContractEndPage.searchMould['tr_contract_end']) # 双击第一条数据 # 复审 base.click( apartmentContractEndPage.addContractEndMould['fushen_loc']) # 复审 base.click(apartmentContractEndPage. addContractEndMould['contract_audit_confirm']) # 确定 base.check_submit() contractEndAud = "SELECT ace.audit_status FROM apartment_contract ac,apartment_contract_end ace WHERE ac.contract_id = ace.contract_id " \ "AND ace.end_type='RETREATING'and ace.deleted=0 and ac.contract_num='%s'" % contractNum contractEndStatus = sqlbase.serach(contractEndAud)[0] base.diffAssert( lambda test: asserts(contractEndStatus).is_equal_to('REVIEW'), 1016, u'%s:出租合同 %s 终止结算状态异常,期望值 REVIEW 实际值 %s' % (fileName, contractNum, contractEndStatus)) # 反审 base.dblclick( apartmentContractEndPage.searchMould['tr_contract_end']) # 双击第一条数据 base.click( apartmentContractEndPage.addContractEndMould['fanshen_loc']) # 反审 base.input_text(apartmentContractEndPage. addContractEndMould['contract_audit_content'], u'AutoTest') # 反审意见 base.click(apartmentContractEndPage. addContractEndMould['contract_audit_confirm']) # 确定 base.check_submit() contractEndRaud = "SELECT ace.audit_status FROM apartment_contract ac,apartment_contract_end ace WHERE ac.contract_id = ace.contract_id " \ "AND ace.end_type='RETREATING' and ace.deleted=0 and ac.contract_num='%s'" % contractNum contractEndRaudStatus = sqlbase.serach(contractEndRaud)[0] base.diffAssert( lambda test: asserts(contractEndRaudStatus).is_equal_to( 'NO_AUDIT'), 1016, u'%s:出租合同 %s 终止结算状态异常,期望值 NO_AUDIT 实际值 %s' % (fileName, contractNum, contractEndRaudStatus)) base.click( apartmentContractEndPage.addContractEndMould['delete_button']) base.click(apartmentContractEndPage. addContractEndMould['delete_button_confirm']) base.check_submit() # 终止结算检查 contractEndDeSql = "select * from apartment_contract_end ace inner join apartment_contract ac on ace.contract_id=ac.contract_id and ac.contract_num='%s' where ace.deleted=1 and " \ "ace.end_type='RETREATING'" % contractNum base.diffAssert( lambda test: asserts(sqlbase.waitData(contractEndDeSql, 1)). is_true(), 1016, u'%s:出租合同 %s 终止结算删除异常,执行SQL:%s' % (fileName, contractNum, contractEndDeSql))
def test_1008(): """客户转租房源签约""" # describe:不续可看的房源可以签约成功 # data:1.房源为客户转租; # result:签约成功3.租前客户变为已签约 fileName = 'apartmentContract_1008' apartmentSql = "select a.apartment_code,ac.contract_num,ac.real_due_date from apartment a inner join apartment_contract_relation acr " \ "on a.apartment_id=acr.apartment_id inner join apartment_contract ac on ac.contract_id = acr.contract_id and ac.is_active='Y' and ac.deleted=0 and ac.city_code=330100 " \ "and ac.contract_status ='EFFECTIVE' and ac.entrust_type='SHARE' and a.fitment_type is not Null inner join house_contract hc on hc.house_id=a.house_id " \ "and hc.entrust_end_date >DATE_ADD(ac.rent_end_date ,INTERVAL 2 month) and a.category='CUSTOM_RELET' ORDER BY RAND() LIMIT 1" if sqlbase.get_count(apartmentSql) == 0: consoleLog(u'%s:SQL查无数据!' % fileName, 'w') consoleLog(u'执行SQL:%s' % apartmentSql) return apartmentinfo = sqlbase.serach(apartmentSql) apartmentCode = apartmentinfo[0] consoleLog(u'%s:取随机转租房源 %s 做新签' % (fileName, apartmentCode)) with Base() as base: # 签约 base.open(page.customerListPage, customerPage.listMould['tr_customer']) try: base.find_element(By.ID, 'search_btn').click() base.staleness_of( customerPage.listMould['tr_customer']) # 搜索等待列表刷新 except: base.click((By.CSS_SELECTOR, '.panel.window > div:nth-child(1) > div.panel-tool > a' )) # 可能会有分配租客的弹窗出现,此为关闭 base.type_select(customerPage.listMould['customer_status_loc'], 'EFFECTIVE') base.click(customerPage.listMould['search_button']) base.staleness_of(customerPage.listMould['tr_customer']) # 搜索等待列表刷新 customerCode = base.script( "var a = $('[datagrid-row-index=\"0\"] > [field=\"customer_num\"] > div > font').text();return a", True).decode('utf-8') # 获取第一条数据编号 base.input_text(customerPage.listMould['customer_name_search'], customerCode) base.click(customerPage.listMould['search_button']) base.staleness_of(customerPage.listMould['tr_customer']) # 搜索等待列表刷新 base.script("$('button#edit_btn')[2].click()") # 点击列表页第一行的签约 base.click(apartmentContractPage.customerSignMould['share']) # 点合租 base.input_text( apartmentContractPage.customerSignMould['search_apartment_loc'], apartmentCode) # 房源编号 base.click(apartmentContractPage.customerSignMould['house_search_btn']) base.staleness_of( apartmentContractPage.customerSignMould['apartment_loc']) base.dblclick(apartmentContractPage.customerSignMould['apartment_loc']) base.click(apartmentContractPage. customerSignMould['newsign_button_loc']) # 新签 # 获取时间元素 randomHouseContract = sqlbase.serach( "SELECT date(sysdate()),date_add(date('%s'), interval 1 DAY),date_add(date('%s'), interval 2 month) from dual" % (apartmentinfo[2], apartmentinfo[2])) contractNum = 'AutoTest' + '-' + time.strftime('%m%d%H%M%S') base.input_text(apartmentContractPage. addApartmentContractMould['contract_num_loc'], contractNum) # 合同编号 base.type_date(apartmentContractPage.typeMould['sign_date'], randomHouseContract[0]) # 签约日期 base.type_date(apartmentContractPage.typeMould['rent_end_date'], randomHouseContract[2]) # 承租到期日 base.input_text( apartmentContractPage.addApartmentContractMould['deposit_loc'], 1234) # 押金 base.type_select(apartmentContractPage.typeMould['payment_type'], 'NORMAL') # 正常付款 base.type_select(apartmentContractPage.typeMould['payment_cycle'], 'ALL') # 一次性付款 js = "$('#contract_strategy_table > table > tbody > tr > td:nth-child(8) > input').val('%s')" % \ randomHouseContract[2] base.script(js) base.click( apartmentContractPage. addApartmentContractMould['rent_strategy_contain_loc']) # 月租金包含按钮 base.type_select(apartmentContractPage.typeMould['contain_fee_type'], 'PARKING') # 包含车位费 base.input_text( apartmentContractPage.addApartmentContractMould['contain_fee_loc'], 123) # 车位费 base.click(apartmentContractPage. addApartmentContractMould['contain_fee_save_loc']) # 保存包含 base.input_text( apartmentContractPage.addApartmentContractMould['agent_fee_loc'], 234) # 中介服务费 base.input_text( apartmentContractPage.addApartmentContractMould['remark_loc'], 'this is autotest date') # 备注 base.click(apartmentContractPage. addApartmentContractMould['next_loc_1']) # 第一页下一步 base.click(apartmentContractPage. addApartmentContractMould['next_loc_2']) # 第二页下一步 # 租客详情 base.input_text( apartmentContractPage.addApartmentContractMould['sign_name_loc'], u'AutoTest') # 签约人姓名 base.type_select(apartmentContractPage.typeMould['sign_id_type'], 'IDNO') # 证件类型 base.input_text( apartmentContractPage.addApartmentContractMould['sign_id_no_loc'], '42062119910828541X') # 身份证 base.input_text( apartmentContractPage.addApartmentContractMould['sign_phone_loc'], '15168368432') # 手机号 base.input_text(apartmentContractPage. addApartmentContractMould['sign_address_loc'], u'浙江省杭州市滨江区六和路368号海创基地南楼三层') # 地址 base.type_select(apartmentContractPage.typeMould['sign_is_customer'], 'Y') # 为承租人 base.input_text(apartmentContractPage. addApartmentContractMould['urgent_customer_name_loc'], 'AutoTest') # 紧急联系人 base.input_text(apartmentContractPage. addApartmentContractMould['urgent_phone_loc'], '13666666666') # 紧急联系人号码 base.type_select(apartmentContractPage.typeMould['urgent_card_type'], 'IDNO') # 紧急联系人证件类型 base.input_text(apartmentContractPage. addApartmentContractMould['urgent_id_card_loc'], '42062119910828541X') # 紧急联系人证件号码 base.input_text(apartmentContractPage. addApartmentContractMould['urgent_postal_address_loc'], u'浙江省杭州市滨江区六和路368号海创基地南楼三层') # 紧急联系人地址 base.type_select(apartmentContractPage.typeMould['customer_type'], 'EMPLOYEE') # 租客类型 base.type_select(apartmentContractPage.typeMould['gender'], 'MALE') # 租客性别 base.type_select(apartmentContractPage.typeMould['education'], 'BACHELOR') # 学历 base.input_text( apartmentContractPage.addApartmentContractMould['trade_loc'], u'计算机软件') # 行业 base.input_text( apartmentContractPage.addApartmentContractMould['email_loc'], '*****@*****.**') # 邮件 base.type_select(apartmentContractPage.typeMould['yesNo'], 'Y') # 是否入住 base.click(apartmentContractPage. addApartmentContractMould['add_person_loc']) # 新增入住人 base.input_text( apartmentContractPage.addApartmentContractMould['person_name_loc'], 'test') # 入住人姓名 base.type_select(apartmentContractPage.typeMould['cardType'], 'PASSPORT') # 证件类型 base.input_text(apartmentContractPage. addApartmentContractMould['person_cardType_loc'], 'abcdefghijk') # 证件号 base.type_select(apartmentContractPage.typeMould['sex'], 'MALE') # 性别 base.input_text(apartmentContractPage. addApartmentContractMould['person_phone_loc'], '13777777777') # 号码 base.type_date(apartmentContractPage.typeMould['staydate'], randomHouseContract[1]) # 入住日期 base.click(apartmentContractPage. addApartmentContractMould['submit_loc']) # 提交 base.check_submit() # 等待提交完成 # 合同检查 contractAdd = "select * from apartment a,apartment_contract ac ,apartment_contract_relation acr where a.apartment_id=acr.apartment_id and acr.contract_id=ac.contract_id " \ "and a.apartment_code='%s'AND ac.contract_num = '%s'AND ac.audit_status='AUDIT' and ac.contract_type = 'NEWSIGN' AND ac.entrust_type='SHARE' " \ "AND ac.is_active='Y' " % (apartmentCode, contractNum) base.diffAssert( lambda test: asserts(sqlbase.waitData(contractAdd, 1)).is_true(), 1008, u'%s:出租合同 %s 新增失败,执行SQL:%s' % (fileName, contractNum, contractAdd)) # 租前客户状态检查 customerstatusSql = "select customer_status from customer where customer_num='%s'" % customerCode customerStatus = sqlbase.serach(customerstatusSql)[0] base.diffAssert( lambda test: asserts(customerStatus).is_equal_to('SIGNED'), 1008, u'%s:租前客户 %s 状态异常,期望值 SIGNED 实际值 %s' % (fileName, customerCode, customerStatus))
def test_1067(): """出租违约业绩由未生效变成生效""" # describe: 核发月份条件满足后生成核发月份 # data:1、业绩违约类别为退租、换租、收房、转租;2、业绩状态为未生效且未审核;3、正常出房业绩条件全部达成;4、出租终止结算未复审; # result:1、业绩状态变为生效;2、业绩产生核发月份;3、业绩状态和核发月份同步更新到预估业绩排行榜;4、生效业绩加入核发业绩排行榜; fileName = 'apartmentAchievement_1067' randomApartment = "SELECT a.apartment_code,a.apartment_id,hc.contract_num,hc.contract_id FROM apartment a INNER JOIN house_contract hc " \ "ON hc.contract_id = a.house_contract_id AND hc.is_active = 'Y' AND hc.deleted = 0 AND hc.audit_status='APPROVED' AND hc.contract_status = 'EFFECTIVE' " \ "INNER JOIN fitment_house fh on fh.house_id=hc.house_id AND fh.fitment_status='HANDOVER' WHERE a.deleted = 0 " \ "AND a.rent_price > 0 AND a.city_code = 330100 AND hc.entrust_type = 'SHARE' AND a.rent_status='WAITING_RENT'" \ "AND hc.real_due_date>date_add(date(sysdate()), interval 1 YEAR) ORDER BY RAND() LIMIT 1" if sqlbase.get_count(randomApartment) == 0: consoleLog(u'%s:SQL查无数据!' % fileName, 'w') consoleLog(u'执行SQL:%s' % randomApartment) return info = sqlbase.serach(randomApartment) apartmentCode = info[0] apartmentId = info[1] consoleLog(u'%s:使用房源 %s 签约出租合同做退租违约' % (fileName, apartmentCode)) dateInfo = sqlbase.serach( "SELECT entrust_start_date,entrust_end_date,date(sysdate()),date_add(date(sysdate()), interval 1 DAY),date_add(date(sysdate()), interval 6 month) " "from house_contract where contract_num = '%s'" % info[2]) # 获取时间元素 with Base() as base: customer = createCustomer() rentPriceInfo = sqlbase.serach( "select rent_price,date(sysdate()) from apartment where apartment_id='%s'" % apartmentId) rentPrice = float(rentPriceInfo[0]) apartmentContractInfo = createApartmentContract( apartement_id=apartmentId, customerInfo=customer, rent_price=rentPrice, sign_date=dateInfo[2], rent_start_date=dateInfo[3], rent_end_date=dateInfo[4], deposit=rentPrice, payment_cycle='MONTH') apartmentContractNum = apartmentContractInfo['contractNum'] apartmentContractId = apartmentContractInfo['contractID'] # 出租合同审核 audit(apartmentContractId, auditType.apartmentContract, auditStatus.chuShen, auditStatus.fuShen) # 出租合同应收 base.open( page.apartmentContractPayPage, apartmentContractReceivablePage.searchMould['tr_receviable_loc']) base.click(apartmentContractReceivablePage.searchMould['reset_button']) base.staleness_of( apartmentContractReceivablePage.searchMould['tr_receviable_loc']) base.input_text( apartmentContractReceivablePage.searchMould['contractNum_loc'], apartmentContractNum) base.click( apartmentContractReceivablePage.searchMould['search_button']) base.staleness_of( apartmentContractReceivablePage.searchMould['tr_receviable_loc']) moneyType = { u'首期管家服务费': int(0.07 * rentPrice), u'中介服务费': 1000, u'首期租金': int(rentPrice), u'押金': int(rentPrice) } for i in range(3): moneyType_row = base.script( "var a = $('[datagrid-row-index=\"%s\"] > [field=\"money_type\"] > div').text();return a" % i, True) base.click( apartmentContractReceivablePage.searchMould['receviabl_button'] [i]) base.input_text( apartmentContractReceivablePage. detailMould['receipts_money_loc'], moneyType[moneyType_row]) base.click( apartmentContractReceivablePage.detailMould['receipts_type']) base.type_date( apartmentContractReceivablePage. detailMould['receipts_date_loc'], rentPriceInfo[1]) base.input_text( apartmentContractReceivablePage.detailMould['alipay_card_loc'], '13676595110') base.input_text( apartmentContractReceivablePage. detailMould['operation_total_loc'], moneyType[moneyType_row]) base.click( apartmentContractReceivablePage.detailMould['save_button']) base.check_submit() base.click( apartmentContractReceivablePage.detailMould['print_btn_close']) time.sleep(1) # 出房业绩达成检查 achievementsql = "select aca.is_active,aca.audit_status,aca.accounting_time,aca.achievement_id from apartment_contract_achievement aca inner join apartment a " \ "on a.apartment_code=aca.house_code where contract_num='%s' and a.apartment_code='%s'and aca.deleted=0 and aca.is_active='Y' and aca.accounting_time " \ "is not null" % (apartmentContractNum, apartmentCode) base.diffAssert( lambda test: asserts(sqlbase.waitData(achievementsql, 1)).is_true( ), 1067, u'%s:出租合同 %s 出房业绩生效异常,执行SQL:%s' % (fileName, apartmentContractNum, achievementsql)) # 出租合同终止结算 breach_money = '888.88' # 应收违约金 zhuanzu_money = '666.66' # 转租费 base.open(page.apartmentContractPage, apartmentContractEndPage.addContractEndMould['tr_contract']) base.input_text( apartmentContractEndPage.addContractEndMould['contract_num_loc'], apartmentContractNum) # 输入合同编 base.click(apartmentContractEndPage. addContractEndMould['search_button_loc']) # 搜索 base.staleness_of(apartmentContractEndPage. addContractEndMould['tr_contract']) # 等待列表刷新 base.context_click(apartmentContractEndPage. addContractEndMould['tr_contract']) # 右击第一条数据 base.click( apartmentContractEndPage.addContractEndMould['end_button_loc'], index=1) # 终止结算 base.click(apartmentContractEndPage.addContractEndMould['now_end_loc'] ) # 立即终止 base.input_text( apartmentContractEndPage.addContractEndMould['end_reason_loc'], u'退租') # 终止原因 endNum = 'AutoACE' + '-' + time.strftime('%m%d%H%M') base.type_date(apartmentContractEndPage.typeMould['end_date'], info[2]) # 终止日期:当天 base.type_select(apartmentContractEndPage.typeMould['end_type'], 'OWNER_DEFAULT') # 退租 base.input_text( apartmentContractEndPage.addContractEndMould['end_num_loc'], endNum) # 终止协议号 base.type_select( apartmentContractEndPage.typeMould['receipt_type_loc'], 'PAYER') # 承租人 base.type_select(apartmentContractEndPage.typeMould['pay_type_loc'], 'PERSONAL') # 个人 base.input_text( apartmentContractEndPage.addContractEndMould['receipt_num_loc'], '123456789') # 收款卡号 base.send_keys( apartmentContractEndPage.addContractEndMould['receipt_num_loc'], Keys.ENTER) base.click(apartmentContractEndPage. addContractEndMould['cardconfirm_close_loc']) # 银行卡确认无误 base.dblclick( apartmentContractEndPage.addContractEndMould['weiyuejin_loc'], index=12) # 违约金 base.input_text(apartmentContractEndPage. addContractEndMould['receivable_money_loc'], breach_money) # 应收违约金 base.dblclick( apartmentContractEndPage.addContractEndMould['weiyuejin_loc'], index=21) # 转租费 base.input_text( apartmentContractEndPage.addContractEndMould['zhuanzu_money_loc'], zhuanzu_money) # 应收转租金 base.upload_file( apartmentContractEndPage.addContractEndMould['add_end_image_loc'], 'C:\Users\Public\Pictures\Sample Pictures\jsp.jpg') # 传图 base.wait_element( apartmentContractEndPage.addContractEndMould['end_image_loc']) base.input_text( apartmentContractEndPage.addContractEndMould['remark_loc'], 'AutoTest') # 备注 base.click(apartmentContractEndPage. addContractEndMould['submit_button']) # 提交 base.check_submit() # 等待提交完成 contractEndAdd = "SELECT ace.end_contract_num,ace.end_id FROM apartment_contract ac,apartment_contract_end ace WHERE ac.contract_id = ace.contract_id " \ "and ace.audit_status='NO_AUDIT' AND ace.end_type='OWNER_DEFAULT'and ace.deleted=0 and ac.contract_num='%s'" % apartmentContractNum base.diffAssert( lambda test: asserts(sqlbase.waitData(contractEndAdd, 1)).is_true( ), 1067, u'%s:出租合同 %s 终止结算新增异常,执行SQL:%s' % (fileName, apartmentContractNum, contractEndAdd)) apartmentContractEndId = sqlbase.serach(contractEndAdd)[1] audit(apartmentContractEndId, auditType.apartmentContractEnd, auditStatus.chuShen, auditStatus.fuShen) # 终止结算审核 # 违约业绩检查 breachAchievementSql = "select is_active,accounting_money,achieve_id,accounting_time from breach_achievement where breach_num='%s' and deleted=0 and is_active='Y' " \ "and breach_type='OWNER_DEFAULT_BREACH'" % apartmentContractNum if sqlbase.waitData(breachAchievementSql, 1): breachAchievementInfo = sqlbase.serach(breachAchievementSql) base.diffAssert( lambda test: asserts(breachAchievementInfo[3]).is_not_empty(), 1067, u'%s:出租合同 %s 退租违约业生效核发月份生成异常' % (fileName, apartmentContractNum)) # 核发业绩排行榜取值处 else: consoleLog(u'%s:出租合同 %s 退租终止生成违约业绩异常,执行SQL:%s' % (fileName, apartmentContractNum, breachAchievementSql)) # 业绩分成明细表(预估业绩排行榜数据取值表,检查违约业绩同步更新到预估业绩排行榜) breahAchievementDetailSql = "select * from contract_achievement ca inner join contract_achievement_detail cad on ca.achieve_id=cad.achieve_id where ca.contract_category='OWNER_DEFAULT_BREACH' " \ "and ca.deleted=0 and ca.achieve_id='%s'and ca.achievement_month='%s'" % (breachAchievementInfo[2], breachAchievementInfo[3]) achievementDetialConunt = sqlbase.get_count(breahAchievementDetailSql) base.diffAssert( lambda test: asserts(achievementDetialConunt).is_not_equal_to(0), 1067, u'%s:出租合同 %s 退租终止违约业绩分成明细异常' % (fileName, apartmentContractNum)) # 核发业绩排行榜检查 base.open(page.achievementListPage, apartmentAchievementPage.searchContractMould['tr_contract']) base.click(apartmentAchievementPage. searchContractMould['reset_button_loc']) # 重置 base.staleness_of( apartmentAchievementPage.searchContractMould['tr_contract']) base.input_text(apartmentAchievementPage. searchContractMould['contract_num_hefa_loc'], apartmentContractNum) # 输入合同号 base.type_select( apartmentAchievementPage.searchContractMould['category_loc'], 'OWNER_DEFAULT_BREACH') # 分类:客户退租 base.click(apartmentAchievementPage. searchContractMould['search_button_loc']) # 查找 base.staleness_of(apartmentAchievementPage. searchContractMould['tr_contract']) # 等待第一条数据刷新 for i in range(achievementDetialConunt): achievement_month = base.script( "var a = $('[datagrid-row-index=\"%s\"] > [field=\"achievement_month\"] > div').text();return a" % i, True) base.diffAssert( lambda test: asserts(achievement_month).is_equal_to( breachAchievementInfo[3]), 1067, u'%s:出租合同 %s 对应退租终止违约业绩有核发月份的同步到核发业绩排行榜异常' % (fileName, apartmentContractNum))
def test_1109(): """委托终止结算审核流程""" # describe:委托终止结算审核流程 # data:1、委托终止结算待审核 # result:1、驳回,初审,复审,反审成功 fileName = 'apartmentContract_1109' contractSql = "select contract_num,entrust_end_date,date(sysdate()) from house_contract where contract_id not in (select house_contract.contract_id from apartment ,apartment_contract ,house_contract " \ "where house_contract.contract_id=apartment.house_contract_id and apartment.house_id=apartment_contract.house_id and apartment_contract.real_due_date>NOW()) " \ "and city_code = 330100 and audit_status = 'APPROVED'and contract_status = 'EFFECTIVE' and deleted = 0 and entrust_end_date>NOW() order by rand() limit 1" if sqlbase.get_count(contractSql) == 0: consoleLog(u'%s:SQL查无数据!' % fileName, 'w') consoleLog(u'执行SQL:%s' % contractSql) return info = sqlbase.serach(contractSql) contractNum = info[0] consoleLog(u'%s:取合同 %s 终止结算做审核' % (fileName, contractNum)) with Base() as base: base.open(page.entrustContractPage, houseContractEndPage.addContractEndMould['tr_contract']) base.input_text(houseContractEndPage.searchMould['contract_num_loc'], contractNum) # 输入合同号 base.click(houseContractEndPage. searchMould['contract_search_button_loc']) # 搜索 base.staleness_of( houseContractEndPage.addContractEndMould['tr_contract']) # 等待数据刷新 base.context_click( houseContractEndPage.addContractEndMould['tr_contract']) # 右击第一条数据 base.click(houseContractEndPage.addContractEndMould['end_button_loc'], index=1) # 终止结算 base.wait_element( houseContractEndPage.addContractEndMould['penalty_loc']) # 等待页面出现 base.type_select(houseContractEndPage.typeMould['end_type'], 'OWNER_DEFAULT') # 结算类型-业主违约 base.type_date(houseContractEndPage.typeMould['end_date'], contractSql[1]) # 终止日期:当天 endNum = 'AutoHCE' + '-' + time.strftime('%m%d%H%M') base.input_text( houseContractEndPage.addContractEndMould['end_num_loc'], endNum) # 结算扣款 base.input_text( houseContractEndPage.addContractEndMould['penalty_loc'], 2000) # 违约金陪入 base.input_text( houseContractEndPage.addContractEndMould['penalty_remark_loc'], u'违约金陪入') # 备注 base.input_text( houseContractEndPage.addContractEndMould['return_rent_loc'], 5000) # 返还房租 base.input_text( houseContractEndPage.addContractEndMould['return_rent_remark_loc'], u'返还房租') # 备注 base.type_date(houseContractEndPage.typeMould['receivable_date'], contractSql[2]) # 应收日期 # 打款信息 base.type_select(houseContractEndPage.typeMould['pay_type'], 'OWNER') # 打款类别-业主收款 base.input_text( houseContractEndPage.addContractEndMould['pay_name_loc'], 'AutoTest') # 姓名 base.type_select(houseContractEndPage.typeMould['pay_object_loc'], 'BUSINESS') # 公司 base.input_text( houseContractEndPage.addContractEndMould['pay_bank_loc'], u'中国银行') # 收款银行 base.input_text( houseContractEndPage.addContractEndMould['pay_bank_no_loc'], '12345678910') # 银行卡号 base.upload_file( houseContractEndPage.addContractEndMould['add_end_image_loc'], 'd:\jsp.png') # 传图 base.wait_element( houseContractEndPage.addContractEndMould['end_image_loc']) base.click( houseContractEndPage.addContractEndMould['submit_loc']) # 提交 base.check_submit() # 等待提交完成 # 终止结算新增检查 contractEndAdd = "select hce.end_id from house_contract hc,house_contract_end hce where hc.contract_id=hce.contract_id and hc.contract_num='%s' and hce.deleted=0 " \ "and hce.audit_status='NO_AUDIT' and hce.end_type='OWNER_DEFAULT'" % contractNum base.diffAssert( lambda test: asserts(sqlbase.waitData(contractEndAdd, 1)).is_true( ), 1109, u'%s:委托合同 %s 正退终止结算新增异常,执行SQL:%s' % (fileName, contractNum, contractEndAdd)) base.open( page.contractEndPage, houseContractEndPage.searchMould['contract_search_button_loc']) base.click(houseContractEndPage.addContractEndMould['tab_info'], index=1) base.input_text( houseContractEndPage.searchMould['end_contract_num_loc'], contractNum) base.click(houseContractEndPage.searchMould['end_search_button_loc']) base.staleness_of(houseContractEndPage.searchMould['tr_contract_end']) for i in range(5): #核算业绩金额生成需要一定时间,这里最多等待50秒 base.dblclick( houseContractEndPage.searchMould['tr_contract_end'], checkLoc=houseContractEndPage.addContractEndMould['check_loc']) time.sleep(2) accountingMoney = base.script( "var a = $('#financial_provide_money+span>input+input').val();return a", True) if accountingMoney == '': base.click(houseContractEndPage. addContractEndMould['close_detail_loc']) time.sleep(8) continue else: break # 驳回 # base.dblclick(houseContractEndPage.searchMould['tr_contract_end'], # checkLoc=houseContractEndPage.addContractEndMould['check_loc']) base.input_text(houseContractEndPage.addContractEndMould['remark_loc'], u'驳回') base.type_select(houseContractEndPage.typeMould['pay_object_loc'], 'BUSINESS') # 公司 base.input_text( houseContractEndPage.addContractEndMould['pay_bank_loc'], u'中国银行') # 收款银行 base.input_text( houseContractEndPage.addContractEndMould['pay_bank_no_loc'], '12345678910') # 银行卡号 base.click(houseContractEndPage.addContractEndMould['bohui_loc']) base.input_text( houseContractEndPage.addContractEndMould['contract_audit_content'], u'自动化测试审核数据') base.click( houseContractEndPage.addContractEndMould['contract_audit_confirm']) base.check_submit() base.dblclick( houseContractEndPage.searchMould['tr_contract_end'], checkLoc=houseContractEndPage.addContractEndMould['check_loc']) # 初审 base.click(houseContractEndPage.addContractEndMould['chushen_loc']) base.click( houseContractEndPage.addContractEndMould['contract_audit_confirm']) base.check_submit() base.dblclick( houseContractEndPage.searchMould['tr_contract_end'], checkLoc=houseContractEndPage.addContractEndMould['check_loc']) # 复审 base.click(houseContractEndPage.addContractEndMould['fushen_loc']) base.click( houseContractEndPage.addContractEndMould['contract_audit_confirm']) base.check_submit() base.dblclick( houseContractEndPage.searchMould['tr_contract_end'], checkLoc=houseContractEndPage.addContractEndMould['check_loc']) # 反审 base.click(houseContractEndPage.addContractEndMould['fanshen_loc']) base.input_text( houseContractEndPage.addContractEndMould['contract_audit_content'], u'自动化测试审核数据') base.click( houseContractEndPage.addContractEndMould['contract_audit_confirm']) base.check_submit() # 删除终止结算 base.click(houseContractEndPage.addContractEndMould['delete_button']) base.click( houseContractEndPage.addContractEndMould['delete_button_confirm']) base.check_submit() houseContractEndDelSql = "select * from house_contract_end where end_contract_num='%s' and deleted=0" % endNum base.diffAssert( lambda test: asserts(sqlbase.get_count(houseContractEndDelSql)). is_not_equal_to(1), 1109, u'%s:委托合同 %s 终止结算删除异常,执行SQL:%s' % (fileName, contractNum, houseContractEndDelSql))
def test_1046(): """修改免租期""" # describe:在委托合同详情中,修改业绩核算周期对应时间段的委托合同租金策略中的免租期; # data:1、业绩审核状态为待审核;2、委托合同状态为待审核或者已初审;3、提前记录原业绩中的核算收进价和差价业绩; # result:1、新产生的业绩中核算收进价与原记录不同;2、新的差价业绩与原来的值不同; fileName = 'apartmentAchievement_1046' with Base() as base: # 创建委托合同和出租合同 houseSql = sqlbase.serach( "select house_id,residential_id,building_id,house_code from house where deleted=0 and city_code=330100 order by rand() limit 1" ) # 获取随机开发房源 houseInfo = { 'houseID': houseSql[0], 'residentialID': houseSql[1], 'buildingID': houseSql[2], 'houseCode': houseSql[3] } dateInfo = sqlbase.serach( "select date(sysdate()),date_add(date(sysdate()),INTERVAL 1 day),date_add(date(sysdate()),interval 2 year),date_add(date(sysdate()),interval 27 month)," "date_add(date(sysdate()),INTERVAL 1 month),date_add(date(sysdate()),INTERVAL 6 month),date_add(date(sysdate()),INTERVAL 10 day) from dual" ) # 日期元素 apartmentId = addHouseContractAndFitment( apartment_type='MANAGE', entrust_type='SHARE', sign_date=dateInfo[0], owner_sign_date=dateInfo[0], entrust_start_date=dateInfo[0], entrust_end_date=dateInfo[2], delay_date=dateInfo[3], free_start_date=dateInfo[0], free_end_date=dateInfo[4], first_pay_date=dateInfo[0], second_pay_date=dateInfo[4], rent=3000, parking=100, year_service_fee=500, payment_cycle='MONTH', fitment_start_date=dateInfo[0], fitment_end_date=dateInfo[4], rooms=3, fitmentCost=88888, houseInfo=houseInfo) rentPriceInfo = sqlbase.serach( "select rent_price,date(sysdate()) from apartment where apartment_id='%s'" % apartmentId) rentPrice = float(rentPriceInfo[0]) customer = createCustomer() apartmentContractInfo = createApartmentContract( apartement_id=apartmentId, customerInfo=customer, rent_price=rentPrice, sign_date=dateInfo[0], rent_start_date=dateInfo[1], rent_end_date=dateInfo[5], # 承租6个月 deposit=rentPrice, payment_cycle='MONTH') apartmentContractNum = apartmentContractInfo['contractNum'] # 业绩检查 achievementSql = "select substring_index(aca.house_code,'-',1),aca.is_active,aca.audit_status,aca.contract_audit_status,aca.profits_fee,aca.rent_cost from apartment_contract_achievement aca " \ "inner join apartment a on a.apartment_code=aca.house_code and a.apartment_id='%s' where aca.contract_num='%s' and aca.deleted=0" % (apartmentId, apartmentContractNum) base.diffAssert( lambda test: asserts(sqlbase.waitData(achievementSql, 1)).is_true( ), 1046, u'%s:合同 %s 业绩生成异常' % (fileName, apartmentContractNum)) achievementInfo = sqlbase.serach(achievementSql) profits_fee_old = achievementInfo[4] # 差价业绩 rent_cost_old = achievementInfo[5] # 核算收进价 houseCode = achievementInfo[0] # 修改租金策略并且复审 base.open(page.entrustContractPage, houseContractPage.contractSearchMould['tr_contract']) base.input_text( houseContractPage.contractSearchMould['residential_name_loc'], houseCode) base.click( houseContractPage.contractSearchMould['search_button_loc']) # 搜索 base.staleness_of( houseContractPage.contractSearchMould['tr_contract']) # 等待列表刷新 base.dblclick(houseContractPage.contractSearchMould['tr_contract'], checkLoc=houseContractPage. addHouseContractMould['contract_num_loc']) # 双击第一条数据 time.sleep(3) base.script( "$('#contract_strategy_table0 tr>td:nth-child(11)>input').click()") base.script( "$('#contract_strategy_table0 tr>td:nth-child(11)>input').datebox('setValue','%s')" % dateInfo[6]) base.click( houseContractPage.addHouseContractMould['page1_save_button']) # 保存 try: base.check_submit() except: message = base.script( "var a=$('.panel.window.messager-window>div:nth-child(2)>div:nth-child(2)').text();return a", True) messagehope = u'用户数据已经被其他用户更新' if messagehope in message: base.click(houseContractPage. addHouseContractMould['message_close_loc']) # 关闭提示 base.click(houseContractPage. addHouseContractMould['page1_save_button']) # 保存 base.check_submit() # 委托合同复审 base.click(houseContractPage.addHouseContractMould['tab_info_loc'], index=1) # 租金页面 base.click(houseContractPage. addHouseContractMould['rent_detail_selectAll']) # 全选 base.click( houseContractPage.addHouseContractMould['rent_audit_loc']) # 审核 base.click( houseContractPage.addHouseContractMould['audit_pass_loc']) # 通过 base.click(houseContractPage. addHouseContractMould['rent_audit_confirm']) # 确认 # 初审 base.click(houseContractPage.addHouseContractMould['tab_info_loc'], index=3) # 最后一页 time.sleep(2) base.script('$("button[status=\'PASS\']")[2].click()') # 初审 base.click(houseContractPage. addHouseContractMould['contract_audit_confirm']) # 确认 for i in range(3): try: base.staleness_of(houseContractPage. contractSearchMould['tr_contract']) # 等待数据刷新 break except: message = base.script( "var a=$('.panel.window.messager-window>div:nth-child(2)>div:nth-child(2)').text();return a", True) messagehope = u'用户数据已经被其他用户更新' if messagehope in message: base.click( houseContractPage. addHouseContractMould['message_close_loc']) # 关闭提示 base.click( houseContractPage. addHouseContractMould['contract_audit_confirm']) # 确认 base.staleness_of( houseContractPage.contractSearchMould['tr_contract'] ) # 等待数据刷新 # 复审 base.dblclick(houseContractPage.contractSearchMould['tr_contract'], checkLoc=houseContractPage. addHouseContractMould['contract_num_loc']) # 双击第一条数据 base.click(houseContractPage.addHouseContractMould['tab_info_loc'], index=3) # 最后一页 time.sleep(2) base.script('$("button[status=\'APPROVED\']")[1].click()') # 复审 base.click(houseContractPage. addHouseContractMould['rentdif_cofirm_loc']) # 租金策略不同提示确定 base.click(houseContractPage. addHouseContractMould['contract_audit_confirm']) # 确认 base.check_submit() # 获取最新的核算收进价和差价业绩 time.sleep(10) profits_fee_new = sqlbase.serach(achievementSql)[4] rent_cost_new = sqlbase.serach(achievementSql)[5] base.diffAssert( lambda test: asserts(rent_cost_new).is_not_equal_to(rent_cost_old), 1046, u'%s:出租合同 %s 对应委托免租期修改后业绩中核算收进价异常,修改前 %s 修改后 %s' % (fileName, apartmentContractNum, rent_cost_old, rent_cost_new)) base.diffAssert( lambda test: asserts(profits_fee_new).is_not_equal_to( profits_fee_old), 1046, u'%s:出租合同 %s 对应委托成本修改后业绩中差价业绩异常,修改前 %s 修改后 %s' % (fileName, apartmentContractNum, profits_fee_old, profits_fee_new))
def test_1009(): """下定后合同签约""" # describe:下定后房源签约 # data:房源下定完,定金收款确认后未超时 # result:1.签约成功2.下定页面状态变为已签约3.房源状态从已预订变为已签约 fileName = 'apartmentContract_1009' apartmentSql = "SELECT a.apartment_code,a.apartment_id,hc.contract_num,hc.contract_id,a.rent_price FROM apartment a INNER JOIN house_contract hc " \ "ON hc.contract_id = a.house_contract_id AND hc.is_active = 'Y' AND hc.deleted = 0 AND hc.audit_status='APPROVED' AND hc.contract_status = 'EFFECTIVE' " \ "INNER JOIN fitment_house fh on fh.house_id=hc.house_id AND fh.fitment_status='HANDOVER' WHERE a.deleted = 0 " \ "AND a.rent_price > 0 AND a.city_code = 330100 AND hc.entrust_type = 'SHARE' AND a.rent_status='WAITING_RENT' AND hc.apartment_type='BRAND' " \ "AND hc.real_due_date>date_add(date(sysdate()), interval 2 YEAR) ORDER BY RAND() LIMIT 1" if sqlbase.get_count(apartmentSql) == 0: consoleLog(u'%s:SQL查无数据!' % fileName, 'w') consoleLog(u'执行SQL:%s' % apartmentSql) return apartmentinfo = sqlbase.serach(apartmentSql) apartmentCode = apartmentinfo[0] consoleLog(u'%s:取随机转租房源 %s 做下定' % (fileName, apartmentCode)) with Base() as base: # 下定 base.open(page.customerListPage, customerPage.listMould['tr_customer']) try: base.find_element(By.ID, 'search_btn').click() base.staleness_of( customerPage.listMould['tr_customer']) # 搜索等待列表刷新 except: base.click((By.CSS_SELECTOR, '.panel.window > div:nth-child(1) > div.panel-tool > a' )) # 可能会有分配租客的弹窗出现,此为关闭 base.type_select(customerPage.listMould['customer_status_loc'], 'EFFECTIVE') base.click(customerPage.listMould['search_button']) base.staleness_of(customerPage.listMould['tr_customer']) # 搜索等待列表刷新 customerCode = base.script( "var a = $('[datagrid-row-index=\"0\"] > [field=\"customer_num\"] > div > font').text();return a", True).decode('utf-8') # 获取第一条数据编号 base.input_text(customerPage.listMould['customer_name_search'], customerCode) base.click(customerPage.listMould['search_button']) base.staleness_of(customerPage.listMould['tr_customer']) # 搜索等待列表刷新 base.click(customerPage.listMould['book_loc']) # 下定 base.input_text(customerPage.listMould['earnest_money_loc'], apartmentinfo[4]) # 定金 base.click(customerPage.listMould['property_address']) #选择房源 base.click(apartmentContractPage.customerSignMould['share']) # 点合租 base.input_text( apartmentContractPage.customerSignMould['search_apartment_loc'], apartmentCode) # 房源编号 base.click( apartmentContractPage.customerSignMould['house_search_btn']) # 搜索 base.staleness_of( apartmentContractPage.customerSignMould['apartment_loc']) base.dblclick( apartmentContractPage.customerSignMould['apartment_loc']) # 选择房源 base.upload_file( apartmentContractPage.customerSignMould['add_image_loc'], 'C:\Users\Public\Pictures\Sample Pictures\jsp.jpg') # 传图 base.wait_element(apartmentContractPage.customerSignMould['image_loc']) base.click(customerPage.listMould['submit_button']) # 提交 base.check_submit() #房源状态检查 apartmentStatusSql = "select rent_status from apartment where apartment_code='%s' and deleted=0" % apartmentCode apartmentStatus = sqlbase.serach(apartmentStatusSql)[0] base.diffAssert( lambda test: asserts(apartmentStatus).is_equal_to('BOOKED'), 1009, u'%s:房源 %s 状态异常,期望值 BOOKED 实际值 %s' % (fileName, customerCode, apartmentStatus)) base.open(page.earnestPage, earnestPage.searchMouid['tr_contract']) base.input_text(earnestPage.searchMouid['apartment_code_loc'], apartmentCode) # 输入房源编号 base.click(earnestPage.searchMouid['search_button_loc']) # 搜索 base.staleness_of(earnestPage.searchMouid['tr_contract']) # 等待列表刷新 base.click(earnestPage.searchMouid['confirm_button_loc']) #确认 base.input_text(earnestPage.confirmMould['earnest_money_loc'], apartmentinfo[4]) #输入金额 base.type_select(earnestPage.confirmMould['payway'], 'ALIPAY') #收款方式 base.input_text(earnestPage.confirmMould['name_loc'], 'Autotest') #收据名字 base.type_select(earnestPage.confirmMould['company'], 'ISZTECH') #收款公司 base.type_date(earnestPage.confirmMould['receipt_date'], datetime.date.today()) #收款日期 base.click(earnestPage.confirmMould['submit_loc']) #提交 base.check_submit() base.click(earnestPage.searchMouid['sign_loc']) # 点击签约 try: base.wait_element(apartmentContractPage. addApartmentContractMould['contract_num_loc']) except: base.click(apartmentContractPage. customerSignMould['newsign_button_loc']) # 新签 # 签约 randomHouseContract = sqlbase.serach( "SELECT date(sysdate()),date_add(date(sysdate()), interval 1 DAY),date_add(date(sysdate()), interval 2 month) from dual" ) contractNum = 'AutoTest' + '-' + time.strftime('%m%d%H%M%S') base.input_text(apartmentContractPage. addApartmentContractMould['contract_num_loc'], contractNum) # 合同编号 base.type_date(apartmentContractPage.typeMould['sign_date'], randomHouseContract[0]) # 签约日期 base.type_date(apartmentContractPage.typeMould['rent_start_date'], randomHouseContract[1]) # 承租起算日 base.type_date(apartmentContractPage.typeMould['rent_end_date'], randomHouseContract[2]) # 承租到期日 base.input_text( apartmentContractPage.addApartmentContractMould['deposit_loc'], 1234) # 押金 base.type_select(apartmentContractPage.typeMould['payment_type'], 'NORMAL') # 正常付款 base.type_select(apartmentContractPage.typeMould['payment_cycle'], 'ALL') # 一次性付款 js = "$('#contract_strategy_table > table > tbody > tr > td:nth-child(8) > input').val('%s')" % \ randomHouseContract[2] base.script(js) base.click( apartmentContractPage. addApartmentContractMould['rent_strategy_contain_loc']) # 月租金包含按钮 base.type_select(apartmentContractPage.typeMould['contain_fee_type'], 'PARKING') # 包含车位费 base.input_text( apartmentContractPage.addApartmentContractMould['contain_fee_loc'], 123) # 车位费 base.click(apartmentContractPage. addApartmentContractMould['contain_fee_save_loc']) # 保存包含 base.input_text( apartmentContractPage.addApartmentContractMould['agent_fee_loc'], 234) # 中介服务费 base.input_text( apartmentContractPage.addApartmentContractMould['remark_loc'], 'this is autotest date') # 备注 base.click(apartmentContractPage. addApartmentContractMould['next_loc_1']) # 第一页下一步 base.click(apartmentContractPage. addApartmentContractMould['next_loc_2']) # 第二页下一步 # 租客详情 base.input_text( apartmentContractPage.addApartmentContractMould['sign_name_loc'], u'AutoTest') # 签约人姓名 base.type_select(apartmentContractPage.typeMould['sign_id_type'], 'IDNO') # 证件类型 base.input_text( apartmentContractPage.addApartmentContractMould['sign_id_no_loc'], '42062119910828541X') # 身份证 base.input_text( apartmentContractPage.addApartmentContractMould['sign_phone_loc'], '15168368432') # 手机号 base.input_text(apartmentContractPage. addApartmentContractMould['sign_address_loc'], u'浙江省杭州市滨江区六和路368号海创基地南楼三层') # 地址 base.type_select(apartmentContractPage.typeMould['sign_is_customer'], 'Y') # 为承租人 base.input_text(apartmentContractPage. addApartmentContractMould['urgent_customer_name_loc'], 'AutoTest') # 紧急联系人 base.input_text(apartmentContractPage. addApartmentContractMould['urgent_phone_loc'], '13666666666') # 紧急联系人号码 base.type_select(apartmentContractPage.typeMould['urgent_card_type'], 'IDNO') # 紧急联系人证件类型 base.input_text(apartmentContractPage. addApartmentContractMould['urgent_id_card_loc'], '42062119910828541X') # 紧急联系人证件号码 base.input_text(apartmentContractPage. addApartmentContractMould['urgent_postal_address_loc'], u'浙江省杭州市滨江区六和路368号海创基地南楼三层') # 紧急联系人地址 base.type_select(apartmentContractPage.typeMould['customer_type'], 'EMPLOYEE') # 租客类型 base.type_select(apartmentContractPage.typeMould['gender'], 'MALE') # 租客性别 base.type_select(apartmentContractPage.typeMould['education'], 'BACHELOR') # 学历 base.input_text( apartmentContractPage.addApartmentContractMould['trade_loc'], u'计算机软件') # 行业 base.input_text( apartmentContractPage.addApartmentContractMould['email_loc'], '*****@*****.**') # 邮件 base.type_select(apartmentContractPage.typeMould['yesNo'], 'Y') # 是否入住 base.click(apartmentContractPage. addApartmentContractMould['add_person_loc']) # 新增入住人 base.input_text( apartmentContractPage.addApartmentContractMould['person_name_loc'], 'test') # 入住人姓名 base.type_select(apartmentContractPage.typeMould['cardType'], 'PASSPORT') # 证件类型 base.input_text(apartmentContractPage. addApartmentContractMould['person_cardType_loc'], 'abcdefghijk') # 证件号 base.type_select(apartmentContractPage.typeMould['sex'], 'MALE') # 性别 base.input_text(apartmentContractPage. addApartmentContractMould['person_phone_loc'], '13777777777') # 号码 base.type_date(apartmentContractPage.typeMould['staydate'], randomHouseContract[1]) # 入住日期 base.click(apartmentContractPage. addApartmentContractMould['submit_loc']) # 提交 base.check_submit() # 等待提交完成 # 合同检查 contractAdd = "select * from apartment a,apartment_contract ac ,apartment_contract_relation acr where a.apartment_id=acr.apartment_id and acr.contract_id=ac.contract_id " \ "and a.apartment_code='%s'AND ac.contract_num = '%s'AND ac.audit_status='AUDIT' and ac.contract_type = 'NEWSIGN' AND ac.entrust_type='SHARE' " \ "AND ac.is_active='Y' " % (apartmentCode, contractNum) base.diffAssert( lambda test: asserts(sqlbase.waitData(contractAdd, 1)).is_true(), 1009, u'%s:出租合同 %s 新增失败,执行SQL:%s' % (fileName, contractNum, contractAdd)) # 房源状态检查 apartmentStatusSqlb = "select rent_status from apartment where apartment_code='%s'" % apartmentCode apartmentStatusb = sqlbase.serach(apartmentStatusSqlb)[0] base.diffAssert( lambda test: asserts(apartmentStatusb).is_equal_to('RENTED'), 1009, u'%s:房源 %s 状态异常,期望值 RENTED 实际值 %s' % (fileName, customerCode, apartmentStatusb)) # 下定状态检查 earnestStatusSql = "select sign_status from earnest where object_id='%s' and receipt_name='Autotest'" % apartmentinfo[ 1] earnestStatus = sqlbase.serach(earnestStatusSql)[0] base.diffAssert( lambda test: asserts(earnestStatus).is_equal_to('SIGNED'), 1009, u'%s:房源 %s 下定状态异常,期望值 SIGNED 实际值 %s' % (fileName, customerCode, earnestStatus))
def test_1057(): """已审核的业绩修改出租合同租金价格""" # describe:在委托合同详情中,修改业绩核算周期对应时间段的出租合同租金价格,已审核的业绩数据不变 # data:1、业绩审核状态为待审核;1、业绩状态为已审核;3、提前记录原业绩中的核算出租和差价业绩; # result:1、业绩中所有字段都不发生变化; fileName = 'apartmentAchievement_1057' with Base() as base: # 创建委托合同和出租合同 houseSql = sqlbase.serach( "select house_id,residential_id,building_id,house_code from house where deleted=0 and city_code=330100 order by rand() limit 1" ) # 获取随机开发房源 houseInfo = { 'houseID': houseSql[0], 'residentialID': houseSql[1], 'buildingID': houseSql[2], 'houseCode': houseSql[3] } dateInfo = sqlbase.serach( "select date(sysdate()),date_add(date(sysdate()),INTERVAL 1 day),date_add(date(sysdate()),interval 2 year),date_add(date(sysdate()),interval 27 month)," "date_add(date(sysdate()),INTERVAL 1 month),date_add(date(sysdate()),INTERVAL 6 month),date_add(date(sysdate()),INTERVAL 3 month) from dual" ) # 日期元素 apartmentId = addHouseContractAndFitment( apartment_type='MANAGE', entrust_type='SHARE', sign_date=dateInfo[0], owner_sign_date=dateInfo[0], entrust_start_date=dateInfo[0], entrust_end_date=dateInfo[2], delay_date=dateInfo[3], free_start_date=dateInfo[0], free_end_date=dateInfo[4], first_pay_date=dateInfo[0], second_pay_date=dateInfo[4], rent=3000, parking=100, year_service_fee=500, payment_cycle='MONTH', fitment_start_date=dateInfo[0], fitment_end_date=dateInfo[4], rooms=3, fitmentCost=88888, houseInfo=houseInfo) houseContractInfo = sqlbase.serach( "select hc.contract_num,hc.contract_id from house_contract hc inner join apartment a on a.house_id = hc.house_id and a.apartment_id='%s' where hc.audit_status='AUDIT' " % apartmentId) houseContractId = houseContractInfo[1] rentPriceInfo = sqlbase.serach( "select rent_price,date(sysdate()) from apartment where apartment_id='%s'" % apartmentId) rentPrice = float(rentPriceInfo[0]) customer = createCustomer() apartmentContractInfo = createApartmentContract( apartement_id=apartmentId, customerInfo=customer, rent_price=rentPrice, sign_date=dateInfo[0], rent_start_date=dateInfo[1], rent_end_date=dateInfo[5], #承租6个月 deposit=rentPrice, payment_cycle='MONTH') apartmentContractNum = apartmentContractInfo['contractNum'] apartmentContractId = apartmentContractInfo['contractID'] achievementSql = "select substring_index(house_code,'-',1) from apartment_contract_achievement where contract_num='%s'and deleted=0" % apartmentContractNum base.diffAssert( lambda test: asserts(sqlbase.waitData(achievementSql, 1)).is_true( ), 1057, u'%s:合同 %s 对应业绩生成异常' % (fileName, apartmentContractNum)) # 委托合同审核 audit(houseContractId, auditType.houseContract, auditStatus.chuShen, auditStatus.fuShen) # 出租合同审核 audit(apartmentContractId, auditType.apartmentContract, auditStatus.chuShen, auditStatus.fuShen) # 业绩检查 achievementsqlb = "select aca.is_active,aca.audit_status,aca.contract_audit_status,aca.profits_fee,aca.achievementRent from apartment_contract_achievement aca " \ "inner join apartment a on a.apartment_code=aca.house_code and a.apartment_id='%s' where aca.contract_num='%s' and aca.deleted=0 and aca.is_active='Y'" % (apartmentId, apartmentContractNum) base.diffAssert( lambda test: asserts(sqlbase.waitData(achievementsqlb, 1)).is_true( ), 1057, u'%s:合同 %s 对应业绩生效异常' % (fileName, apartmentContractNum)) profits_feeOld = sqlbase.serach(achievementsqlb)[3] # 差价业绩 achievementRentOld = sqlbase.serach(achievementsqlb)[4] # 核算出租价 # 获取当前的核算收进价和差价业绩并审核 base.open(page.apartmentAchievementPage, apartmentAchievementPage.searchContractMould['tr_contract']) base.click(apartmentAchievementPage. searchContractMould['reset_button_loc']) # 重置 base.input_text( apartmentAchievementPage.searchContractMould['contract_num_loc'], apartmentContractNum) # 输入合同号 base.click(apartmentAchievementPage. searchContractMould['search_button_loc']) # 查找 base.staleness_of(apartmentAchievementPage. searchContractMould['tr_contract']) # 等待第一条数据刷新 base.dblclick( apartmentAchievementPage.searchContractMould['tr_contract'], checkLoc=apartmentAchievementPage. detailAchievementMoudle['contract_num_loc']) # 点击第一条数据等待详情页面完全显示 base.click(apartmentAchievementPage. detailAchievementMoudle['audit_button_loc']) base.input_text( apartmentAchievementPage. detailAchievementMoudle['contract_audit_content'], 'ok') base.click(apartmentAchievementPage. detailAchievementMoudle['contract_audit_confirm']) base.check_submit() # 反审出租合同并修改租金 audit(apartmentContractId, auditType.apartmentContract, auditStatus.fanShen) base.open(page.apartmentContractPage, apartmentContractPage.searchContractMould['tr_contract']) base.input_text( apartmentContractPage.searchContractMould['contract_num_loc'], apartmentContractNum) # 输入合同编号 base.click( apartmentContractPage.searchContractMould['search_button_loc']) base.staleness_of( apartmentContractPage.searchContractMould['tr_contract']) base.dblclick(apartmentContractPage.searchContractMould['tr_contract'], checkLoc=apartmentContractPage. addApartmentContractMould['contract_num_loc']) # 双击第一条数据 # base.click(apartmentContractPage.addApartmentContractMould['rent_strategy1_end_loc']) base.script( "$('#contract_strategy_table > table > tbody > tr > td:nth-child(8) > input').click()" ) base.type_date( apartmentContractPage. addApartmentContractMould['rent_strategy1_end_loc'], dateInfo[6]) base.click(apartmentContractPage. addApartmentContractMould['rent_strategy_menu_loc']) base.input_text( apartmentContractPage. addApartmentContractMould['rent_strategy2_money_loc'], 3000) base.type_date( apartmentContractPage. addApartmentContractMould['rent_strategy2_end_loc'], dateInfo[5]) base.click( apartmentContractPage.addApartmentContractMould['save_button']) base.check_submit() # 数据库获取最新的核算收进价和差价业绩 time.sleep(10) achievementInfoSql = "select profits_fee,rent_cost,end_time,achievementRent from apartment_contract_achievement where contract_num='%s' and deleted=0" % apartmentContractNum achievementInfo = sqlbase.serach(achievementInfoSql) achievementRent = achievementInfo[3] # 核算出租价 profits_fee = achievementInfo[0] # 差价业绩 base.diffAssert( lambda test: asserts(achievementRent).is_equal_to( achievementRentOld), 1057, u'%s:出租合同 %s 业绩对应委托成本修改后已审核业绩中核算收进价异常,修改前 %s 修改后 %s' % (fileName, apartmentContractNum, achievementRentOld, achievementRent)) base.diffAssert( lambda test: asserts(profits_fee).is_equal_to(profits_feeOld), 1057, u'%s:出租合同 %s 业绩对应委托成本修改后已审核业绩中差价业绩异常,修改前 %s 修改后 %s' % (fileName, apartmentContractNum, profits_feeOld, profits_fee))
def test_1006(): """出租合同审核""" # describe:合同正常初审、复审 # data:未初审的合同 # result:1、初审后可以修改详情2、复审后不可以修改详情3、复审通过 fileName = 'apartmentContract_1006' contractSql = "SELECT ac.contract_num,cp.urgent_customer_name,cp.customer_name from apartment_contract ac inner join customer_person cp on ac.person_id=cp.person_id " \ "inner join query_apartment_contract qac on ac.contract_num=qac.contract_num where ac.deleted = 0 and ac.city_code = '330100' and ac.entrust_type='SHARE' " \ "and ac.audit_status = 'AUDIT' and ac.contract_status = 'EFFECTIVE' and ac.deleted=0 and ac.payment_type='NORMAL' ORDER BY RAND() LIMIT 1" if sqlbase.get_count(contractSql) == 0: consoleLog(u'%s:SQL查无数据!' % fileName, 'w') consoleLog(u'执行SQL:%s' % contractSql) return info = sqlbase.serach(contractSql) contractNum = info[0] consoleLog(u'%s:取随机合同 %s 做合同审核' % (fileName, contractNum)) with Base() as base: base.open(page.apartmentContractPage, apartmentContractPage.searchContractMould['tr_contract']) base.input_text( apartmentContractPage.searchContractMould['contract_num_loc'], contractNum) # 输入合同编号 base.click( apartmentContractPage.searchContractMould['search_button_loc']) base.staleness_of( apartmentContractPage.searchContractMould['tr_contract']) base.dblclick(apartmentContractPage.searchContractMould['tr_contract'] ) # 双击第一条数据 # 打开详情页需要加载,但DOM其实已经加载完仍旧无法点击,此处加5秒等待 for i in range(5): try: base.click(apartmentContractPage. addApartmentContractMould['tab_info_loc'], index=4) # 租客详情 break except: time.sleep(1) # 初审 base.click(apartmentContractPage. addApartmentContractMould['chushen_loc']) # 初审 base.click(apartmentContractPage. addApartmentContractMould['contract_audit_confirm']) # 确定 base.staleness_of( apartmentContractPage.searchContractMould['tr_contract']) # 等待列表刷新 base.dblclick(apartmentContractPage.searchContractMould['tr_contract'] ) # 双击第一条数据 for i in range(5): try: base.click(apartmentContractPage. addApartmentContractMould['tab_info_loc'], index=4) # 租客详情 break except: time.sleep(1) # 复审 newUrgentName = u'NewUrgent' base.input_text(apartmentContractPage. addApartmentContractMould['urgent_customer_name_loc'], newUrgentName) # 修改联系人 base.click(apartmentContractPage. addApartmentContractMould['fushen_loc']) # 复审 base.click(apartmentContractPage. addApartmentContractMould['contract_audit_confirm']) # 确定 base.staleness_of( apartmentContractPage.searchContractMould['tr_contract']) # 等待列表刷新 # 审核状态检查 contractAudit = "select ac.contract_num,cp.urgent_customer_name from apartment_contract ac ,customer_person cp where ac.person_id=cp.person_id AND ac.contract_num = '%s'AND ac.audit_status='APPROVED' " \ "and ac.is_active='Y' " % (contractNum) base.diffAssert( lambda test: asserts(sqlbase.waitData(contractAudit, 1)).is_true(), 1006, u'%s:出租合同 %s 审核异常,执行SQL:%s' % (fileName, contractNum, contractAudit)) # 紧急联系人检查 realUrgentName = sqlbase.serach(contractAudit)[1] base.diffAssert( lambda test: asserts(realUrgentName).is_equal_to(newUrgentName), 1006, u'%s:出租合同 %s 紧急联系人修改异常,期望值 %s 实际值 %s' % (fileName, contractNum, newUrgentName, realUrgentName)) base.dblclick(apartmentContractPage.searchContractMould['tr_contract'] ) # 双击第一条数据 for i in range(5): try: base.click(apartmentContractPage. addApartmentContractMould['tab_info_loc'], index=4) # 租客详情 break except: time.sleep(1) try: base.input_text( apartmentContractPage. addApartmentContractMould['urgent_customer_name_loc'], 'AutoTest') # 修改联系人 except InvalidElementStateException: consoleLog(u'复审状态的合同紧急联系人无法编辑')
def test_1047(): """修改装修成本""" # describe:在设计工程中修改房源的装修成本,对应业绩装修成本改变 # data:1、业绩审核状态为待审核;2、委托合同状态为待审核或者已初审;3、提前记录原业绩中的核算收进价和差价业绩; # result:1、新产生的业绩中核算收进价与原记录不同;2、新的差价业绩与原来的值不同; fileName = 'apartmentAchievement_1047' with Base() as base: # 创建委托合同和出租合同 houseSql = sqlbase.serach( "select house_id,residential_id,building_id,house_code from house where deleted=0 and city_code=330100 order by rand() limit 1" ) # 获取随机开发房源 houseInfo = { 'houseID': houseSql[0], 'residentialID': houseSql[1], 'buildingID': houseSql[2], 'houseCode': houseSql[3] } dateInfo = sqlbase.serach( "select date(sysdate()),date_add(date(sysdate()),INTERVAL 1 day),date_add(date(sysdate()),interval 2 year),date_add(date(sysdate()),interval 27 month)," "date_add(date(sysdate()),INTERVAL 1 month),date_add(date(sysdate()),INTERVAL 6 month),date_add(date(sysdate()),INTERVAL 10 day) from dual" ) # 日期元素 apartmentId = addHouseContractAndFitment( apartment_type='MANAGE', entrust_type='SHARE', sign_date=dateInfo[0], owner_sign_date=dateInfo[0], entrust_start_date=dateInfo[0], entrust_end_date=dateInfo[2], delay_date=dateInfo[3], free_start_date=dateInfo[0], free_end_date=dateInfo[4], first_pay_date=dateInfo[0], second_pay_date=dateInfo[4], rent=3000, parking=100, year_service_fee=500, payment_cycle='MONTH', fitment_start_date=dateInfo[0], fitment_end_date=dateInfo[4], rooms=3, fitmentCost=88888, houseInfo=houseInfo) rentPriceInfo = sqlbase.serach( "select rent_price,date(sysdate()) from apartment where apartment_id='%s'" % apartmentId) rentPrice = float(rentPriceInfo[0]) customer = createCustomer() apartmentContractInfo = createApartmentContract( apartement_id=apartmentId, customerInfo=customer, rent_price=rentPrice, sign_date=dateInfo[0], rent_start_date=dateInfo[1], rent_end_date=dateInfo[5], # 承租6个月 deposit=rentPrice, payment_cycle='MONTH') apartmentContractNum = apartmentContractInfo['contractNum'] # 业绩检查 achievementSql = "select substring_index(aca.house_code,'-',1),aca.is_active,aca.audit_status,aca.contract_audit_status,aca.profits_fee,aca.decorate_cost from apartment_contract_achievement aca " \ "inner join apartment a on a.apartment_code=aca.house_code and a.apartment_id='%s' where aca.contract_num='%s' and aca.deleted=0" % ( apartmentId, apartmentContractNum) base.diffAssert( lambda test: asserts(sqlbase.waitData(achievementSql, 1)).is_true( ), 1047, u'%s:合同 %s 业绩生成异常' % (fileName, apartmentContractNum)) achievementInfo = sqlbase.serach(achievementSql) profits_fee_old = achievementInfo[4] # 差价业绩 decorate_cost_old = achievementInfo[5] # 装修成本 houseCode = achievementInfo[0] # 修改装修成本 base.open(page.designManageSharePage, designSharePage.searchMould['tr_contract']) base.input_text(designSharePage.searchMould['residential_name_loc'], houseCode) base.click(designSharePage.searchMould['search_btn_loc']) base.staleness_of(designSharePage.searchMould['tr_contract']) base.context_click(designSharePage.searchMould['tr_contract']) base.click(designSharePage.designShareMould['design_btn_2'], index=0) time.sleep(2) base.input_text(designSharePage.designShareMould['total_cost'], '68888.00') base.click(designSharePage.designShareMould['save_btn_2']) base.check_submit() # 获取最新的核算收进价和差价业绩 time.sleep(10) achievementInfoNew = sqlbase.serach(achievementSql) profits_fee_new = achievementInfoNew[4] # 差价业绩 decorate_cost_new = achievementInfoNew[5] # 装修成本 base.diffAssert( lambda test: asserts(decorate_cost_new).is_not_equal_to( decorate_cost_old), 1047, u'%s:出租合同 %s 对应装修成功修改后业绩中核算收进价异常,修改前 %s 修改后 %s' % (fileName, apartmentContractNum, decorate_cost_old, decorate_cost_new)) base.diffAssert( lambda test: asserts(profits_fee_new).is_not_equal_to( profits_fee_old), 1047, u'%s:出租合同 %s 对应委托成本修改后业绩中差价业绩异常,修改前 %s 修改后 %s' % (fileName, apartmentContractNum, profits_fee_old, profits_fee_new))
def test_1096(): """下定违约业绩审核后修改违约金额""" # describe:下定违约业绩审核后修改违约金额 # data:1、违约金列表中记录未审核;2、业绩状态已审核; # result:1、业绩不发生变化 fileName = 'apartmentAchievement_1096' apartmentSql = "SELECT a.apartment_code,a.apartment_id,hc.contract_num,hc.contract_id,a.rent_price FROM apartment a INNER JOIN house_contract hc " \ "ON hc.contract_id = a.house_contract_id AND hc.is_active = 'Y' AND hc.deleted = 0 AND hc.audit_status='APPROVED' AND hc.contract_status = 'EFFECTIVE' " \ "INNER JOIN fitment_house fh on fh.house_id=hc.house_id AND fh.fitment_status='HANDOVER' WHERE a.deleted = 0 " \ "AND a.rent_price > 0 AND a.city_code = 330100 AND hc.entrust_type = 'SHARE' AND a.rent_status='WAITING_RENT' AND hc.apartment_type='BRAND' " \ "AND hc.real_due_date>date_add(date(sysdate()), interval 2 YEAR) ORDER BY RAND() LIMIT 1" if sqlbase.get_count(apartmentSql) == 0: consoleLog(u'%s:SQL查无数据!' % fileName, 'w') consoleLog(u'执行SQL:%s' % apartmentSql) return apartmentinfo = sqlbase.serach(apartmentSql) apartmentCode = apartmentinfo[0] earnestMoney = apartmentinfo[4] if float( apartmentinfo[4]) > 1000.00 else '1000.00' consoleLog(u'%s:取随机转租房源 %s 做下定' % (fileName, apartmentCode)) with Base() as base: # 下定 base.open(page.customerListPage, customerPage.listMould['tr_customer']) try: base.find_element(By.ID, 'search_btn').click() base.staleness_of( customerPage.listMould['tr_customer']) # 搜索等待列表刷新 except: base.click((By.CSS_SELECTOR, '.panel.window > div:nth-child(1) > div.panel-tool > a' )) # 可能会有分配租客的弹窗出现,此为关闭 base.type_select(customerPage.listMould['customer_status_loc'], 'EFFECTIVE') base.click(customerPage.listMould['search_button']) base.staleness_of(customerPage.listMould['tr_customer']) # 搜索等待列表刷新 customerCode = base.script( "var a = $('[datagrid-row-index=\"0\"] > [field=\"customer_num\"] > div > font').text();return a", True) # 获取第一条数据编号 base.input_text(customerPage.listMould['customer_name_search'], customerCode) base.click(customerPage.listMould['search_button']) base.staleness_of(customerPage.listMould['tr_customer']) # 搜索等待列表刷新 base.click(customerPage.listMould['book_loc']) # 下定 base.input_text(customerPage.listMould['earnest_money_loc'], earnestMoney) # 定金 base.click(customerPage.listMould['property_address']) # 选择房源 base.click(apartmentContractPage.customerSignMould['share']) # 点合租 base.input_text( apartmentContractPage.customerSignMould['search_apartment_loc'], apartmentCode) # 房源编号 base.click( apartmentContractPage.customerSignMould['house_search_btn']) # 搜索 base.staleness_of( apartmentContractPage.customerSignMould['apartment_loc']) base.dblclick( apartmentContractPage.customerSignMould['apartment_loc']) # 选择房源 base.upload_file( apartmentContractPage.customerSignMould['add_image_loc'], 'C:\Users\Public\Pictures\Sample Pictures\jsp.jpg') # 传图 base.wait_element(apartmentContractPage.customerSignMould['image_loc']) base.click(customerPage.listMould['submit_button']) # 提交 base.check_submit() #定金确认 base.open(page.earnestPage, earnestPage.searchMouid['tr_contract']) base.input_text(earnestPage.searchMouid['apartment_code_loc'], apartmentCode) # 输入房源编号 base.click(earnestPage.searchMouid['search_button_loc']) # 搜索 base.staleness_of(earnestPage.searchMouid['tr_contract']) # 等待列表刷新 base.click(earnestPage.searchMouid['confirm_button_loc']) # 确认 base.input_text(earnestPage.confirmMould['earnest_money_loc'], earnestMoney) # 输入金额 base.type_select(earnestPage.confirmMould['payway'], 'ALIPAY') # 收款方式 base.input_text(earnestPage.confirmMould['name_loc'], 'Autotest') # 收据名字 base.type_select(earnestPage.confirmMould['company'], 'ISZTECH') # 收款公司 base.type_date(earnestPage.confirmMould['receipt_date'], datetime.date.today()) # 收款日期 base.click(earnestPage.confirmMould['submit_loc']) # 提交 base.check_submit() # 违约提交 base.click(earnestPage.searchMouid['breach_loc']) # 点击违约 base.input_text(earnestPage.confirmMould['breach_reason_loc'], u'autotest') # 输入原因 base.input_text(earnestPage.confirmMould['breach_money_loc'], earnestMoney) # 输入违约金额 base.click(earnestPage.confirmMould['submit_loc']) # 提交 base.check_submit() # 定金转入违约金审核 base.open(page.depositToBreachPage, earnestPage.depositToBreachMould['tr_earnest']) base.input_text(earnestPage.depositToBreachMould['address_search_loc'], apartmentCode) base.click(earnestPage.depositToBreachMould['search_button']) base.staleness_of(earnestPage.depositToBreachMould['tr_earnest']) base.click(earnestPage.depositToBreachMould['audit_button']) base.input_text(earnestPage.depositToBreachMould['earnest_money_loc'], earnestMoney) base.click(earnestPage.depositToBreachMould['payment_way_loc']) base.type_date(earnestPage.depositToBreachMould['receipt_date_loc'], datetime.date.today()) base.type_select(earnestPage.depositToBreachMould['company_loc'], 'ISZTECH') base.input_text(earnestPage.depositToBreachMould['alipay_card_loc'], '13676595110') base.input_text( earnestPage.depositToBreachMould['operation_total_loc'], earnestMoney) base.input_text(earnestPage.depositToBreachMould['remark_loc'], 'AutoTest') base.click(earnestPage.depositToBreachMould['shenhe_loc']) base.check_submit() # 业绩生效并产生核发月份检查 breachAchievementActiveSql = "select accounting_time,achieve_id from breach_achievement where apartment_code='%s' and deleted=0 and breach_type='EARNEST_BREACH' " \ "and is_active='Y'" % apartmentCode if sqlbase.waitData(breachAchievementActiveSql, 1): breachAchievementInfo = sqlbase.serach(breachAchievementActiveSql) base.diffAssert( lambda test: asserts(breachAchievementInfo[0]).is_not_empty(), 1096, u'%s:房源 %s 下定违约违约业绩生效核发月份生成异常' % (fileName, apartmentCode)) else: consoleLog(u'%s:房源 %s 下定违约违约违约业绩生效异常' % (fileName, apartmentCode), 'e') # 业绩审核 base.open(page.defaultAchievementPage, apartmentAchievementPage.searchContractMould['tr_contract']) base.click(apartmentAchievementPage. searchContractMould['reset_button_loc']) # 重置 time.sleep(10) # 等待重新核算更新数据 base.input_text( apartmentAchievementPage.searchContractMould['search_address_loc'], apartmentCode) # 输入房源编号 base.type_select( apartmentAchievementPage.searchContractMould['breach_type_loc'], 'EARNEST_BREACH') # 下定违约 base.click(apartmentAchievementPage. searchContractMould['search_button_loc']) # 查找 base.staleness_of(apartmentAchievementPage. searchContractMould['tr_contract']) # 等待第一条数据刷新 base.dblclick( apartmentAchievementPage.searchContractMould['tr_contract'], checkLoc=apartmentAchievementPage. detailAchievementMoudle['breach_num_loc']) # 点击第一条数据等待详情页面完全显示 base.click(apartmentAchievementPage. detailAchievementMoudle['audit_button_loc']) base.input_text( apartmentAchievementPage. detailAchievementMoudle['contract_audit_content'], 'ok') base.click(apartmentAchievementPage. detailAchievementMoudle['contract_audit_confirm']) base.check_submit() # 违约金审核重置 base.open(page.depositToBreachPage, earnestPage.depositToBreachMould['tr_earnest']) base.input_text(earnestPage.depositToBreachMould['address_search_loc'], apartmentCode) base.click(earnestPage.depositToBreachMould['search_button']) base.staleness_of(earnestPage.depositToBreachMould['tr_earnest']) base.click(earnestPage.depositToBreachMould['reset_loc']) # 重置 base.click(earnestPage.depositToBreachMould['confirm_loc']) # 确定 base.check_submit() # 修改违约金额 base.open(page.earnestBreachPage, earnestPage.searchMouid['tr_contract']) base.input_text(earnestPage.searchMouid['apartment_code_loc'], apartmentCode) # 输入房源编号 base.click(earnestPage.searchMouid['search_button_loc']) # 搜索 base.staleness_of(earnestPage.searchMouid['tr_contract']) # 等待列表刷新 base.dblclick(earnestPage.searchMouid['tr_contract']) time.sleep(2) base.input_text(earnestPage.confirmMould['breach_reason_loc'], u'修改违约金额') earnestMoneyNew = str(float(earnestMoney) + 100) base.input_text(earnestPage.confirmMould['breach_money_loc'], earnestMoneyNew) base.click(earnestPage.confirmMould['submit_loc']) base.check_submit() # 修改违约金后业绩信息检查 time.sleep(10) breachAchievementSql = "select is_active,achieve_id,accounting_money from breach_achievement where object_type='EARNEST_BREACH' and apartment_code='%s' and deleted=0 " \ "and is_active='Y'" % apartmentCode breachAchievementInfoNew = sqlbase.serach(breachAchievementSql) base.diffAssert( lambda test: asserts(breachAchievementInfoNew[2]).is_equal_to( earnestMoney), 1096, u'%s:房源 %s 下定违约修改后违约业绩金额异常,期望值 %s 实际值 %s' % (fileName, apartmentCode, earnestMoney, breachAchievementInfoNew[2])) # 业绩分成明细表(预估业绩排行榜数据取值表,检查违约业绩更新到预估业绩排行榜) breahAchievementDetailSql = "select ca.share_achieve from contract_achievement ca inner join contract_achievement_detail cad on ca.achieve_id=cad.achieve_id where " \ "ca.contract_category='EARNEST_BREACH' and ca.deleted=0 and ca.achieve_id='%s'" % breachAchievementInfoNew[1] achievementDetialInfo = sqlbase.serach(breahAchievementDetailSql) base.diffAssert( lambda test: asserts(achievementDetialInfo[0]).is_equal_to( earnestMoney), 1096, u'%s:房源 %s 下定违约违约业绩分成明细异常,期望值 %s 实际值 %s' % (fileName, apartmentCode, earnestMoney, achievementDetialInfo[0]))
def test_1089(): """出租违约业绩删除""" # describe:出租违约业绩生成后删除终止结算,未审核的违约业绩会删除,同步到预估业绩排行榜 # data:1、业绩状态未审核;2、终止结算未复审; # result:1、违约业绩删除;2、预估业绩排行榜中业绩删除; fileName = 'apartmentAchievement_1089' contractSql = "SELECT contract_num,rent_end_date,date(sysdate()) from apartment_contract where deleted = 0 and city_code = 330100 and audit_status = 'APPROVED' and contract_status = 'EFFECTIVE' " \ "and contract_type = 'NEWSIGN' and entrust_type = 'SHARE' and payment_type<>'NETWORKBANK' and rent_end_date>DATE_ADD(date(SYSDATE()),INTERVAL 1 MONTH)order by rand() limit 1" if sqlbase.get_count(contractSql) == 0: consoleLog(u'%s:SQL查无数据!' % fileName, 'w') consoleLog(u'执行SQL:%s' % contractSql) return info = sqlbase.serach(contractSql) contractNum = info[0] consoleLog(u'%s:取随机出租合同 %s 做退租终止' % (fileName, contractNum)) with Base() as base: breach_money = '888.88' # 应收违约金 zhuanzu_money = '999.99' # 转租费 base.open(page.apartmentContractPage, apartmentContractEndPage.addContractEndMould['tr_contract']) base.input_text( apartmentContractEndPage.addContractEndMould['contract_num_loc'], contractNum) # 输入合同编 base.click(apartmentContractEndPage. addContractEndMould['search_button_loc']) # 搜索 base.staleness_of(apartmentContractEndPage. addContractEndMould['tr_contract']) # 等待列表刷新 base.context_click(apartmentContractEndPage. addContractEndMould['tr_contract']) # 右击第一条数据 base.click( apartmentContractEndPage.addContractEndMould['end_button_loc'], index=1) # 终止结算 base.click(apartmentContractEndPage.addContractEndMould['now_end_loc'] ) # 立即终止 base.input_text( apartmentContractEndPage.addContractEndMould['end_reason_loc'], u'退租') # 终止原因 endNum = 'AutoACE' + '-' + time.strftime('%m%d%H%M') base.type_date(apartmentContractEndPage.typeMould['end_date'], info[2]) # 终止日期:当天 base.type_select(apartmentContractEndPage.typeMould['end_type'], 'OWNER_DEFAULT') # 退租 base.input_text( apartmentContractEndPage.addContractEndMould['end_num_loc'], endNum) # 终止协议号 base.type_select( apartmentContractEndPage.typeMould['receipt_type_loc'], 'PAYER') # 承租人 base.type_select(apartmentContractEndPage.typeMould['pay_type_loc'], 'PERSONAL') # 个人 base.input_text( apartmentContractEndPage.addContractEndMould['receipt_num_loc'], '123456789') # 收款卡号 base.send_keys( apartmentContractEndPage.addContractEndMould['receipt_num_loc'], Keys.ENTER) base.click(apartmentContractEndPage. addContractEndMould['cardconfirm_close_loc']) # 银行卡确认无误 base.dblclick( apartmentContractEndPage.addContractEndMould['project_type_loc'], index=1) # 租金 base.input_text(apartmentContractEndPage. addContractEndMould['payable_deposit_loc'], '2000.00') # 应退押金 终止收支类型为收入才能删除 base.dblclick( apartmentContractEndPage.addContractEndMould['project_type_loc'], index=12) # 违约金 base.input_text(apartmentContractEndPage. addContractEndMould['receivable_money_loc'], breach_money) # 应收违约金 base.dblclick( apartmentContractEndPage.addContractEndMould['project_type_loc'], index=21) # 转租费 base.input_text( apartmentContractEndPage.addContractEndMould['zhuanzu_money_loc'], zhuanzu_money) # 应收转租金 base.upload_file( apartmentContractEndPage.addContractEndMould['add_end_image_loc'], 'C:\Users\Public\Pictures\Sample Pictures\jsp.jpg') # 传图 base.wait_element( apartmentContractEndPage.addContractEndMould['end_image_loc']) base.input_text( apartmentContractEndPage.addContractEndMould['remark_loc'], 'AutoTest') # 备注 base.click(apartmentContractEndPage. addContractEndMould['submit_button']) # 提交 base.check_submit() # 等待提交完成 # 违约业绩检查 breachAchievementSql = "select is_active,accounting_money,achieve_id from breach_achievement where breach_num='%s' and deleted=0 and breach_type='OWNER_DEFAULT_BREACH'" % contractNum if sqlbase.waitData(breachAchievementSql, 1): breachAchievementInfo = sqlbase.serach(breachAchievementSql) else: consoleLog(u'%s:出租合同 %s 退租终止生成违约业绩异常,执行SQL:%s' % (fileName, contractNum, breachAchievementSql)) # 删除终止结算 base.open(page.contractEndPage, apartmentContractEndPage.searchMould['tr_contract_end']) base.input_text( apartmentContractEndPage.searchMould['contract_num_loc'], contractNum) base.click(apartmentContractEndPage.searchMould['search_button_loc']) base.staleness_of( apartmentContractEndPage.searchMould['tr_contract_end']) base.click( apartmentContractEndPage.addContractEndMould['delete_button']) base.click(apartmentContractEndPage. addContractEndMould['delete_button_confirm']) base.check_submit() # 检查业绩删除 breachAchievementDelSql = "select is_active,accounting_money,achieve_id from breach_achievement where achieve_id='%s' and deleted=0 and breach_type='OWNER_DEFAULT_BREACH'" % breachAchievementInfo[ 2] achievementDelConunt = sqlbase.get_count(breachAchievementDelSql) base.diffAssert( lambda test: asserts(achievementDelConunt).is_equal_to(0), 1089, u'%s:出租合同 %s 违约业绩删除异常,执行SQL:%s' % (fileName, contractNum, breachAchievementDelSql)) # 业绩分成明细表(预估业绩排行榜数据取值表,检查违约业绩同步更新到预估业绩排行榜) breahAchievementDetailSql = "select * from contract_achievement_detail where achieve_id='%s' and deleted=0" % breachAchievementInfo[ 2] achievementDetialDelConunt = sqlbase.get_count( breahAchievementDetailSql) base.diffAssert( lambda test: asserts(achievementDetialDelConunt).is_equal_to(0), 1089, u'%s:出租合同 %s 违约业绩分成明细删除异常' % (fileName, contractNum))
def test_1055(): """已审核的业绩修改委托合同租金""" # describe:在委托合同详情中,修改业绩核算周期对应时间段的委托合同租金策略中的租金,已审核的业绩数据不变 # data:1、业绩审核状态为待审核;1、业绩状态为已审核;3、提前记录原业绩中的核算收进价和差价业绩; # result:1、业绩中所有字段都不发生变化; fileName = 'apartmentAchievement_1055' with Base() as base: #创建委托合同和出租合同 houseSql = sqlbase.serach( "select house_id,residential_id,building_id,house_code from house where deleted=0 and city_code=330100 order by rand() limit 1" ) # 获取随机开发房源 houseInfo = { 'houseID': houseSql[0], 'residentialID': houseSql[1], 'buildingID': houseSql[2], 'houseCode': houseSql[3] } dateInfo = sqlbase.serach( "select date(sysdate()),date_add(date(sysdate()),INTERVAL 1 day),date_add(date(sysdate()),interval 2 year),date_add(date(sysdate()),interval 27 month)," "date_add(date(sysdate()),INTERVAL 1 month),date_add(date(sysdate()),INTERVAL 6 month) from dual" ) # 日期元素 apartmentId = addHouseContractAndFitment( apartment_type='MANAGE', entrust_type='SHARE', sign_date=dateInfo[0], owner_sign_date=dateInfo[0], entrust_start_date=dateInfo[0], entrust_end_date=dateInfo[2], delay_date=dateInfo[3], free_start_date=dateInfo[0], free_end_date=dateInfo[4], first_pay_date=dateInfo[0], second_pay_date=dateInfo[4], rent=3000, parking=100, year_service_fee=500, payment_cycle='MONTH', fitment_start_date=dateInfo[0], fitment_end_date=dateInfo[4], rooms=3, fitmentCost=88888, houseInfo=houseInfo) houseContractInfo = sqlbase.serach( "select hc.contract_num,hc.contract_id from house_contract hc inner join apartment a on a.house_id = hc.house_id and a.apartment_id='%s' where hc.audit_status='AUDIT' " % apartmentId) houseContractId = houseContractInfo[1] rentPriceInfo = sqlbase.serach( "select rent_price,date(sysdate()) from apartment where apartment_id='%s'" % apartmentId) rentPrice = float(rentPriceInfo[0]) customer = createCustomer() apartmentContractInfo = createApartmentContract( apartement_id=apartmentId, customerInfo=customer, rent_price=rentPrice, sign_date=dateInfo[0], rent_start_date=dateInfo[1], rent_end_date=dateInfo[5], #承租6个月 deposit=rentPrice, payment_cycle='MONTH') apartmentContractNum = apartmentContractInfo['contractNum'] apartmentContractId = apartmentContractInfo['contractID'] achievementSql = "select substring_index(house_code,'-',1) from apartment_contract_achievement where contract_num='%s'and deleted=0" % apartmentContractNum base.diffAssert( lambda test: asserts(sqlbase.waitData(achievementSql, 1)).is_true( ), 1055, u'%s:合同 %s 对应业绩生成异常' % (fileName, apartmentContractNum)) houseCode = sqlbase.serach(achievementSql)[0] # 委托合同审核 audit(houseContractId, auditType.houseContract, auditStatus.chuShen, auditStatus.fuShen) # 出租合同审核 audit(apartmentContractId, auditType.apartmentContract, auditStatus.chuShen, auditStatus.fuShen) # 业绩检查 achievementsqlb = "select aca.is_active,aca.audit_status,aca.contract_audit_status,aca.profits_fee,aca.rent_cost from apartment_contract_achievement aca " \ "inner join apartment a on a.apartment_code=aca.house_code and a.apartment_id='%s' where aca.contract_num='%s' and aca.deleted=0 and aca.is_active='Y'" % (apartmentId, apartmentContractNum) base.diffAssert( lambda test: asserts(sqlbase.waitData(achievementsqlb, 1)).is_true( ), 1055, u'%s:合同 %s 对应业绩生效异常' % (fileName, apartmentContractNum)) profits_feeOld = sqlbase.serach(achievementsqlb)[3] # 差价业绩 accountingCostOld = sqlbase.serach(achievementsqlb)[4] # 核算收进价 # 获取当前的核算收进价和差价业绩并审核 base.open(page.apartmentAchievementPage, apartmentAchievementPage.searchContractMould['tr_contract']) base.click(apartmentAchievementPage. searchContractMould['reset_button_loc']) # 重置 base.input_text( apartmentAchievementPage.searchContractMould['contract_num_loc'], apartmentContractNum) # 输入合同号 base.click(apartmentAchievementPage. searchContractMould['search_button_loc']) # 查找 base.staleness_of(apartmentAchievementPage. searchContractMould['tr_contract']) # 等待第一条数据刷新 base.dblclick( apartmentAchievementPage.searchContractMould['tr_contract'], checkLoc=apartmentAchievementPage. detailAchievementMoudle['contract_num_loc']) # 点击第一条数据等待详情页面完全显示 base.click(apartmentAchievementPage. detailAchievementMoudle['audit_button_loc']) base.input_text( apartmentAchievementPage. detailAchievementMoudle['contract_audit_content'], 'ok') base.click(apartmentAchievementPage. detailAchievementMoudle['contract_audit_confirm']) base.check_submit() # 反审后修改租金策略并且复审 audit(houseContractId, auditType.houseContract, auditStatus.fanShen) base.open(page.entrustContractPage, houseContractPage.contractSearchMould['tr_contract']) base.input_text( houseContractPage.contractSearchMould['residential_name_loc'], houseCode) base.click( houseContractPage.contractSearchMould['search_button_loc']) # 搜索 base.staleness_of( houseContractPage.contractSearchMould['tr_contract']) # 等待列表刷新 base.dblclick(houseContractPage.contractSearchMould['tr_contract'], checkLoc=houseContractPage. addHouseContractMould['contract_num_loc']) # 双击第一条数据 base.click(houseContractPage. addHouseContractMould['contract_strategy1.1_loc']) base.input_text( houseContractPage.addHouseContractMould['contract_strategy1_loc'], 4000) # 第二年租金策略 base.click( houseContractPage.addHouseContractMould['page1_save_button']) # 保存 base.check_submit() # 委托合同审核 audit(houseContractId, auditType.houseContract, auditStatus.chuShen, auditStatus.fuShen) # for i in range(3): # try: # base.check_submit() # break # except: # message = base.script( # "var a=$('.panel.window.messager-window>div:nth-child(2)>div:nth-child(2)').text();return a", True) # messagehope = u'用户数据已经被其他用户更新' # if messagehope in message: # base.click(houseContractPage.addHouseContractMould['message_close_loc']) # 关闭提示 # base.click(houseContractPage.addHouseContractMould['rent_save_button']) # 保存 # base.check_submit() # # 委托合同复审 # base.click(houseContractPage.addHouseContractMould['tab_info_loc'], index=1) # 租金页面 # base.click(houseContractPage.addHouseContractMould['rent_detail_selectAll']) # 全选 # base.click(houseContractPage.addHouseContractMould['rent_audit_loc']) # 审核 # base.click(houseContractPage.addHouseContractMould['audit_pass_loc']) # 通过 # base.click(houseContractPage.addHouseContractMould['rent_audit_confirm']) # 确认 # # 初审 # base.click(houseContractPage.addHouseContractMould['tab_info_loc'], index=3) # 最后一页 # time.sleep(2) # base.script('$("button[status=\'PASS\']")[2].click()') # 初审 # base.click(houseContractPage.addHouseContractMould['contract_audit_confirm']) # 确认 # for i in range(3): # try: # base.staleness_of(houseContractPage.contractSearchMould['tr_contract']) # 等待数据刷新 # break # except: # message = base.script( # "var a=$('.panel.window.messager-window>div:nth-child(2)>div:nth-child(2)').text();return a", True) # messagehope = u'用户数据已经被其他用户更新' # if messagehope in message: # base.click(houseContractPage.addHouseContractMould['message_close_loc']) # 关闭提示 # base.click(houseContractPage.addHouseContractMould['contract_audit_confirm']) # 确认 # base.staleness_of(houseContractPage.contractSearchMould['tr_contract']) # 等待数据刷新 # # 复审 # base.dblclick(houseContractPage.contractSearchMould['tr_contract'], # checkLoc=houseContractPage.addHouseContractMould['contract_num_loc']) # 双击第一条数据 # base.click(houseContractPage.addHouseContractMould['tab_info_loc'], index=3) # 最后一页 # time.sleep(2) # base.script('$("button[status=\'APPROVED\']")[1].click()') # 复审 # base.click(houseContractPage.addHouseContractMould['rentdif_cofirm_loc']) # 租金策略不同提示确定 # base.click(houseContractPage.addHouseContractMould['contract_audit_confirm']) # 确认 # for i in range(3): # try: # base.check_submit() # break # except: # message = base.script( # "var a=$('.panel.window.messager-window>div:nth-child(2)>div:nth-child(2)').text();return a", True) # messagehope = u'用户数据已经被其他用户更新' # if messagehope in message: # base.click(houseContractPage.addHouseContractMould['message_close_loc']) # 关闭提示 # base.click(houseContractPage.addHouseContractMould['contract_audit_confirm']) # 确认 # base.check_submit() # 数据库获取最新的核算收进价和差价业绩 time.sleep(10) achievementInfoSql = "select profits_fee,rent_cost,end_time,achievementRent from apartment_contract_achievement where contract_num='%s' and deleted=0" % apartmentContractNum achievementInfo = sqlbase.serach(achievementInfoSql) rent_cost = achievementInfo[1] # 核算收进价 profits_fee = achievementInfo[0] # 差价业绩 base.diffAssert( lambda test: asserts(rent_cost).is_equal_to(accountingCostOld), 1055, u'%s:出租合同 %s 业绩对应委托成本修改后已审核业绩中核算收进价异常,修改前 %s 修改后 %s' % (fileName, apartmentContractNum, accountingCostOld, rent_cost)) base.diffAssert( lambda test: asserts(profits_fee).is_equal_to(profits_feeOld), 1055, u'%s:出租合同 %s 业绩对应委托成本修改后已审核业绩中差价业绩异常,修改前 %s 修改后 %s' % (fileName, apartmentContractNum, profits_feeOld, profits_fee))
def test_1063(): """委托公司违约生成违约业绩""" # describe:委托合同终止结算,结算类型为公司违约,生成违约业绩 # data:1、委托合同已复审;2、合同状态为有效;3、委托合同下无有效的出租合同; # result:1、合同状态变为公司违约;2、终止结算详情中核算业绩金额字段有数值;3、生成一条违约业绩,状态为未生效;4、违约业绩金额等于核算业绩金额的值;5、违约业绩分成记录插入到预估业绩排行榜; fileName = 'apartmentAchievement_1063' contractSql = "select contract_num,entrust_end_date,date(sysdate()) from house_contract where contract_id not in (select house_contract.contract_id from apartment ,apartment_contract ,house_contract " \ "where house_contract.contract_id=apartment.house_contract_id and apartment.house_id=apartment_contract.house_id and apartment_contract.real_due_date>NOW()) " \ "and city_code = 330100 and audit_status = 'APPROVED'and contract_status = 'EFFECTIVE' and deleted = 0 and entrust_end_date>NOW() order by rand() limit 1" if sqlbase.get_count(contractSql) == 0: consoleLog(u'%s:SQL查无数据!' % fileName, 'w') consoleLog(u'执行SQL:%s' % contractSql) return info = sqlbase.serach(contractSql) contractNum = info[0] consoleLog(u'%s:取随机委托合同 %s 做公司违约终止' % (fileName, contractNum)) with Base() as base: base.open(page.entrustContractPage, houseContractEndPage.addContractEndMould['tr_contract']) base.input_text(houseContractEndPage.searchMould['contract_num_loc'], contractNum) # 输入合同号 base.click(houseContractEndPage. searchMould['contract_search_button_loc']) # 搜索 base.staleness_of( houseContractEndPage.addContractEndMould['tr_contract']) # 等待数据刷新 base.context_click( houseContractEndPage.addContractEndMould['tr_contract']) # 右击第一条数据 base.click(houseContractEndPage.addContractEndMould['end_button_loc'], index=1) # 终止结算 base.wait_element( houseContractEndPage.addContractEndMould['penalty_loc']) # 等待页面出现 base.type_select(houseContractEndPage.typeMould['end_type'], 'CORPORATE_DEFAULT') # 结算类型-公司违约 endNum = 'AutoHCE' + '-' + time.strftime('%m%d%H%M') base.input_text( houseContractEndPage.addContractEndMould['end_num_loc'], endNum) base.type_date(houseContractEndPage.typeMould['end_date'], contractSql[2]) # 终止日期:当天 # 结算扣款 base.input_text( houseContractEndPage.addContractEndMould['return_rent_loc'], 5000) # 返还房租 base.input_text( houseContractEndPage.addContractEndMould['return_rent_remark_loc'], u'返还房租') # 备注 # 代垫费用 base.click(houseContractEndPage.addContractEndMould['tool_bar'], index=0) # 新增代垫 base.type_select(houseContractEndPage.typeMould['return_type_loc'], 'LIQUIDATED') # 退款项目:违约金赔出 base.input_text( houseContractEndPage.addContractEndMould['return_money_loc'], 2000) # 退款金额 base.type_select(houseContractEndPage.typeMould['bear_type_loc'], 'COMPANY') # 承担方-公司 base.type_select(houseContractEndPage.typeMould['bear_name'], 'ISZTECH') # 承担方姓名 base.type_date(houseContractEndPage.typeMould['money_start_date'], contractSql[2]) # 费用开始时间 base.type_date(houseContractEndPage.typeMould['money_end_date'], contractSql[2]) # 费用结束时间 base.type_select(houseContractEndPage.typeMould['explain'], 'VACANCY') # 情况说明-空置期 # base.type_select(houseContractEndPage.typeMould['dispute'], 'N') # 是否纠纷 base.type_date(houseContractEndPage.typeMould['receivable_date'], contractSql[2]) # 应收日期 # 打款信息 base.type_select(houseContractEndPage.typeMould['pay_type'], 'OWNER') # 打款类别-业主收款 base.input_text( houseContractEndPage.addContractEndMould['pay_name_loc'], 'AutoTest') # 姓名 base.type_select(houseContractEndPage.typeMould['pay_object_loc'], 'BUSINESS') # 公司 base.input_text( houseContractEndPage.addContractEndMould['pay_bank_loc'], u'中国银行') # 收款银行 base.input_text( houseContractEndPage.addContractEndMould['pay_bank_no_loc'], '12345678910') # 银行卡号 base.upload_file( houseContractEndPage.addContractEndMould['add_end_image_loc'], 'C:\Users\Public\Pictures\Sample Pictures\jsp.jpg') # 传图 base.wait_element( houseContractEndPage.addContractEndMould['end_image_loc']) base.click( houseContractEndPage.addContractEndMould['submit_loc']) # 提交 base.check_submit() # 等待提交完成 # 终止结算新增检查 contractEndAdd = "select * from house_contract hc,house_contract_end hce where hc.contract_id=hce.contract_id and hc.contract_num='%s' and hce.deleted=0 " \ "and hce.audit_status='NO_AUDIT' and hce.end_type='CORPORATE_DEFAULT'" % contractNum base.diffAssert( lambda test: asserts(sqlbase.waitData(contractEndAdd, 1)).is_true( ), 1063, u'%s:委托合同 %s 终止结算新增异常,执行SQL:%s' % (fileName, contractNum, contractEndAdd)) # 合同状态检查 contractStatus = sqlbase.serach( "select contract_status from house_contract where deleted = 0 and contract_num='%s' " % contractNum)[0] base.diffAssert( lambda test: asserts(contractStatus).is_equal_to( 'CORPORATE_DEFAULT'), 1063, u'%s:委托合同 %s 终止结算后状态异常,期望值 CORPORATE_DEFAULT 实际值 %s' % (fileName, contractNum, contractStatus)) # 检查违约核算业绩金额 base.open( page.contractEndPage, houseContractEndPage.searchMould['contract_search_button_loc']) base.click(houseContractEndPage.addContractEndMould['tab_info'], index=1) base.input_text( houseContractEndPage.searchMould['end_contract_num_loc'], contractNum) base.click( houseContractEndPage.searchMould['end_search_button_loc']) # 搜索 base.staleness_of( houseContractEndPage.searchMould['tr_contract_end']) # 等待数据刷新 for i in range(5): # 核算业绩金额生成需要一定时间,这里最多等待30秒 base.dblclick( houseContractEndPage.searchMould['tr_contract_end'], checkLoc=houseContractEndPage.addContractEndMould['check_loc']) time.sleep(2) accountingMoney = base.script( "var a = $('#financial_provide_money+span>input+input').val();return a", True) if accountingMoney == '': base.click(houseContractEndPage. addContractEndMould['close_detail_loc']) time.sleep(8) continue else: break # 违约业绩检查 breachAchievementSql = "select is_active,accounting_money,achieve_id from breach_achievement where breach_num='%s' and deleted=0 and breach_type='CORPORATE_DEFAULT_BREACH'" % contractNum if sqlbase.waitData(breachAchievementSql, 1): breachAchievementInfo = sqlbase.serach(breachAchievementSql) base.diffAssert( lambda test: asserts(breachAchievementInfo[0]).is_equal_to( 'N'), 1063, u'%s:委托合同 %s 公司违约业绩状态异常,期望值 N 实际值 %s' % (fileName, contractNum, breachAchievementInfo[0])) base.diffAssert( lambda test: asserts(breachAchievementInfo[1]).is_equal_to( accountingMoney), 1063, u'%s:委托合同 %s 公司违约业绩金额异常,期望值 %s 实际值 %s' % (fileName, contractNum, accountingMoney, breachAchievementInfo[1])) else: consoleLog(u'%s:委托合同 %s 公司违约生成违约业绩异常,执行SQL:%s' % (fileName, contractNum, breachAchievementSql)) # 业绩分成明细表(预估业绩排行榜数据取值表,检查违约业绩同步更新到预估业绩排行榜) breahAchievementDetailSql = "select * from contract_achievement ca inner join contract_achievement_detail cad on ca.achieve_id=cad.achieve_id where ca.contract_category='CORPORATE_DEFAULT_BREACH' " \ "and ca.deleted=0 and ca.achieve_id='%s'" % breachAchievementInfo[2] achievementDetialConunt = sqlbase.get_count(breahAchievementDetailSql) base.diffAssert( lambda test: asserts(achievementDetialConunt).is_not_equal_to(0), 1063, u'%s:委托合同 %s 公司违约违约业绩分成明细异常' % (fileName, contractNum))
def test_1120(): """退租生成扣回业绩""" # describe:出租合同退租终止结算生成扣回业绩,记录同步到预估业绩排行榜 # data:1、出租合同状态为有效;2、出租合同审核状态为已复审; # result:1、合同状态变为退租;2、生成一条扣回业绩,状态为未生效;3、扣回业绩分成记录插入到预估业绩排行榜; fileName = 'apartmentAchievement_1120' contractSql = "SELECT contract_num,rent_end_date,date(sysdate()) from apartment_contract where deleted = 0 and city_code = 330100 and audit_status = 'APPROVED' and contract_status = 'EFFECTIVE' " \ "and contract_type = 'NEWSIGN' and entrust_type = 'SHARE' and payment_type<>'NETWORKBANK' and rent_end_date>DATE_ADD(date(SYSDATE()),INTERVAL 1 MONTH)order by rand() limit 1" if sqlbase.get_count(contractSql) == 0: consoleLog(u'%s:SQL查无数据!' % fileName, 'w') consoleLog(u'执行SQL:%s' % contractSql) return info = sqlbase.serach(contractSql) contractNum = info[0] consoleLog(u'%s:取随机出租合同 %s 做退租终止' % (fileName, contractNum)) with Base() as base: breach_money = '888.88' # 应收违约金 zhuanzu_money = '666.66' # 转租费 base.open(page.apartmentContractPage, apartmentContractEndPage.addContractEndMould['tr_contract']) base.input_text( apartmentContractEndPage.addContractEndMould['contract_num_loc'], contractNum) # 输入合同编 base.click(apartmentContractEndPage. addContractEndMould['search_button_loc']) # 搜索 base.staleness_of(apartmentContractEndPage. addContractEndMould['tr_contract']) # 等待列表刷新 base.context_click(apartmentContractEndPage. addContractEndMould['tr_contract']) # 右击第一条数据 base.click( apartmentContractEndPage.addContractEndMould['end_button_loc'], index=1) # 终止结算 base.click(apartmentContractEndPage.addContractEndMould['now_end_loc'] ) # 立即终止 base.input_text( apartmentContractEndPage.addContractEndMould['end_reason_loc'], u'退租') # 终止原因 endNum = 'AutoACE' + '-' + time.strftime('%m%d%H%M') base.type_date(apartmentContractEndPage.typeMould['end_date'], info[2]) # 终止日期:当天 base.type_select(apartmentContractEndPage.typeMould['end_type'], 'OWNER_DEFAULT') # 退租 base.input_text( apartmentContractEndPage.addContractEndMould['end_num_loc'], endNum) # 终止协议号 base.type_select( apartmentContractEndPage.typeMould['receipt_type_loc'], 'PAYER') # 承租人 base.type_select(apartmentContractEndPage.typeMould['pay_type_loc'], 'PERSONAL') # 个人 base.input_text( apartmentContractEndPage.addContractEndMould['receipt_num_loc'], '123456789') # 收款卡号 base.send_keys( apartmentContractEndPage.addContractEndMould['receipt_num_loc'], Keys.ENTER) base.click(apartmentContractEndPage. addContractEndMould['cardconfirm_close_loc']) # 银行卡确认无误 base.dblclick( apartmentContractEndPage.addContractEndMould['weiyuejin_loc'], index=12) # 违约金 base.input_text(apartmentContractEndPage. addContractEndMould['receivable_money_loc'], breach_money) # 应收违约金 base.dblclick( apartmentContractEndPage.addContractEndMould['weiyuejin_loc'], index=21) # 转租费 base.input_text( apartmentContractEndPage.addContractEndMould['zhuanzu_money_loc'], zhuanzu_money) # 应收转租金 base.upload_file( apartmentContractEndPage.addContractEndMould['add_end_image_loc'], 'C:\Users\Public\Pictures\Sample Pictures\jsp.jpg') # 传图 base.wait_element( apartmentContractEndPage.addContractEndMould['end_image_loc']) base.input_text( apartmentContractEndPage.addContractEndMould['remark_loc'], 'AutoTest') # 备注 base.click(apartmentContractEndPage. addContractEndMould['submit_button']) # 提交 base.check_submit() # 等待提交完成 contractEndAdd = "SELECT ace.end_contract_num FROM apartment_contract ac,apartment_contract_end ace WHERE ac.contract_id = ace.contract_id " \ "and ace.audit_status='NO_AUDIT' AND ace.end_type='OWNER_DEFAULT'and ace.deleted=0 and ac.contract_num='%s'" % contractNum base.diffAssert( lambda test: asserts(sqlbase.waitData(contractEndAdd, 1)).is_true( ), 1120, u'%s:出租合同 %s 终止结算新增异常,执行SQL:%s' % (fileName, contractNum, contractEndAdd)) #合同状态检查 contractStatus = sqlbase.serach( "select contract_status from apartment_contract where deleted = 0 and contract_num='%s' " % contractNum)[0] base.diffAssert( lambda test: asserts(contractStatus).is_equal_to('OWNER_DEFAULT'), 1120, u'%s:出租合同 %s 终止结算后状态异常异常,期望值 OWNER_DEFAULT 实际值 %s' % (fileName, contractNum, contractStatus)) #扣回业绩检查 backAchievementSql = "select is_active,achieve_id,accounting_time from back_achievement where contract_num='%s' and deleted=0 and contract_end_type='OWNER_DEFAULT' " % contractNum if sqlbase.waitData(backAchievementSql, 1): backAchievementInfo = sqlbase.serach(backAchievementSql) base.diffAssert( lambda test: asserts(backAchievementInfo[0]).is_equal_to('N'), 1120, u'%s:出租合同 %s 退租扣回业绩状态异常,期望值 N 实际值 %s' % (fileName, contractNum, backAchievementInfo[0])) # base.diffAssert(lambda test: asserts(breachAchievementInfo[1]).is_equal_to(breach_money), 1120, # u'%s:出租合同 %s 退租扣回业绩金额异常,期望值 %s 实际值 %s' % (fileName, contractNum, breach_money, breachAchievementInfo[1])) else: consoleLog(u'%s:出租合同 %s 退租终止生成扣回业绩异常,执行SQL:%s' % (fileName, contractNum, backAchievementSql)) # 业绩分成明细表(预估业绩排行榜数据取值表,检查扣回业绩同步更新到预估业绩排行榜) backAchievementDetailSql = "select * from contract_achievement ca inner join apartment_contract ac on ac.contract_id=ca.contract_id and ca.achieve_id='%s' where ca.deleted=0 " \ "and ca.contract_category='OWNER_DEFAULT_BACK'" % backAchievementInfo[1] achievementDetialConunt = sqlbase.get_count(backAchievementDetailSql) base.diffAssert( lambda test: asserts(achievementDetialConunt).is_not_equal_to(0), 1120, u'%s:出租合同 %s 退租终止扣回业绩分成明细异常' % (fileName, contractNum))
def test_1095(): """业绩审核后修改出租终止转租费""" # describe:违约业绩审核后修改应终止结算转租费+100,原业绩不变 # data:1、出租终止类型为转租;2、出租终止结算未复审;3、业绩状态已审核; # result:1、业绩不变 fileName = 'apartmentAchievement_1095' with Base() as base: # 创建委托合同和出租合同 houseSql = sqlbase.serach( "select house_id,residential_id,building_id,house_code from house where deleted=0 and city_code=330100 order by rand() limit 1") # 获取随机开发房源 houseInfo = {'houseID': houseSql[0], 'residentialID': houseSql[1], 'buildingID': houseSql[2],'houseCode': houseSql[3]} dateInfo = sqlbase.serach("select date(sysdate()),date_add(date(sysdate()),INTERVAL 1 day),date_add(date(sysdate()),interval 2 year),date_add(date(sysdate()),interval 27 month)," "date_add(date(sysdate()),INTERVAL 1 month),date_add(date(sysdate()),INTERVAL 6 month),date_add(date(sysdate()),INTERVAL 3 month) from dual") # 日期元素 apartmentId = addHouseContractAndFitment(apartment_type='MANAGE', entrust_type='SHARE', sign_date=dateInfo[0], owner_sign_date=dateInfo[0], entrust_start_date=dateInfo[0], entrust_end_date=dateInfo[2], delay_date=dateInfo[3], free_start_date=dateInfo[0], free_end_date=dateInfo[4], first_pay_date=dateInfo[0], second_pay_date=dateInfo[4], rent=3000, parking=100, year_service_fee=500, payment_cycle='MONTH', fitment_start_date=dateInfo[0], fitment_end_date=dateInfo[4], rooms=3, fitmentCost=88888,houseInfo=houseInfo) houseContractInfo = sqlbase.serach("select hc.contract_num,hc.contract_id from house_contract hc inner join apartment a on a.house_id = hc.house_id and a.apartment_id='%s' where hc.audit_status='AUDIT' " % apartmentId) houseContractId = houseContractInfo[1] rentPriceInfo = sqlbase.serach("select rent_price,date(sysdate()) from apartment where apartment_id='%s'" % apartmentId) rentPrice = float(rentPriceInfo[0]) customer = createCustomer() apartmentContractInfo = createApartmentContract(apartement_id=apartmentId, customerInfo=customer, rent_price=rentPrice, sign_date=dateInfo[0], rent_start_date=dateInfo[1], rent_end_date=dateInfo[5],#承租6个月 deposit=rentPrice, payment_cycle='MONTH') apartmentContractNum = apartmentContractInfo['contractNum'] apartmentContractId = apartmentContractInfo['contractID'] achievementSql = "select substring_index(house_code,'-',1) from apartment_contract_achievement where contract_num='%s'and deleted=0" % apartmentContractNum if not sqlbase.waitData(achievementSql, 1): consoleLog(u'%s:合同 %s 对应业绩生成异常'%(fileName, apartmentContractNum),'e') # 委托合同审核 audit(houseContractId,auditType.houseContract,auditStatus.chuShen,auditStatus.fuShen) # 出租合同审核 audit(apartmentContractId,auditType.apartmentContract,auditStatus.chuShen,auditStatus.fuShen) # 出租合同应收 base.open(page.apartmentContractPayPage, apartmentContractReceivablePage.searchMould['tr_receviable_loc']) base.click(apartmentContractReceivablePage.searchMould['reset_button']) base.staleness_of(apartmentContractReceivablePage.searchMould['tr_receviable_loc']) base.input_text(apartmentContractReceivablePage.searchMould['contractNum_loc'],apartmentContractNum) base.click(apartmentContractReceivablePage.searchMould['search_button']) base.staleness_of(apartmentContractReceivablePage.searchMould['tr_receviable_loc']) moneyType = {u'首期管家服务费':int(0.07*rentPrice) , u'中介服务费':1000 , u'首期租金':int(rentPrice) , u'押金':int(rentPrice)} for i in range(3): moneyType_row = base.script("var a = $('[datagrid-row-index=\"%s\"] > [field=\"money_type\"] > div').text();return a" % i, True) base.click(apartmentContractReceivablePage.searchMould['receviabl_button'][i]) base.input_text(apartmentContractReceivablePage.detailMould['receipts_money_loc'], moneyType[moneyType_row]) base.click(apartmentContractReceivablePage.detailMould['receipts_type']) base.type_date(apartmentContractReceivablePage.detailMould['receipts_date_loc'], rentPriceInfo[1]) base.input_text(apartmentContractReceivablePage.detailMould['alipay_card_loc'], '13676595110') base.input_text(apartmentContractReceivablePage.detailMould['operation_total_loc'], moneyType[moneyType_row]) base.click(apartmentContractReceivablePage.detailMould['save_button']) base.check_submit() base.click(apartmentContractReceivablePage.detailMould['print_btn_close']) time.sleep(1) # 业绩生效检查 achievementsql = "select aca.is_active,aca.audit_status,aca.contract_audit_status from apartment_contract_achievement aca " \ "inner join apartment a on a.apartment_code=aca.house_code and a.apartment_id='%s' where aca.contract_num='%s' and aca.deleted=0 and aca.is_active='Y'and aca.accounting_time is not null" % (apartmentId, apartmentContractNum) base.diffAssert(lambda test: asserts(sqlbase.waitData(achievementsql,1)).is_true(), 1095, u'%s:出租合同 %s 业绩生效异常,执行SQL:%s' % (fileName, apartmentContractNum, achievementsql)) # 终止结算 breach_money = '888.88' # 应收违约金 zhuanzu_money = '666.66' # 转租费 base.open(page.apartmentContractPage, apartmentContractEndPage.addContractEndMould['tr_contract']) base.input_text(apartmentContractEndPage.addContractEndMould['contract_num_loc'], apartmentContractNum) # 输入合同编 base.click(apartmentContractEndPage.addContractEndMould['search_button_loc']) # 搜索 base.staleness_of(apartmentContractEndPage.addContractEndMould['tr_contract']) # 等待列表刷新 base.context_click(apartmentContractEndPage.addContractEndMould['tr_contract']) # 右击第一条数据 base.click(apartmentContractEndPage.addContractEndMould['end_button_loc'], index=1) # 终止结算 base.click(apartmentContractEndPage.addContractEndMould['now_end_loc']) # 立即终止 base.input_text(apartmentContractEndPage.addContractEndMould['end_reason_loc'], u'转租') # 终止原因 endNum = 'AutoACE' + '-' + time.strftime('%m%d%H%M') base.type_date(apartmentContractEndPage.typeMould['end_date'], dateInfo[0]) # 终止日期:当天 base.type_select(apartmentContractEndPage.typeMould['end_type'], 'CORPORATE_DEFAULT') # 转租 base.input_text(apartmentContractEndPage.addContractEndMould['end_num_loc'], endNum) # 终止协议号 base.type_select(apartmentContractEndPage.typeMould['receipt_type_loc'], 'PAYER') # 承租人 base.type_select(apartmentContractEndPage.typeMould['pay_type_loc'], 'PERSONAL') # 个人 base.input_text(apartmentContractEndPage.addContractEndMould['receipt_num_loc'], '123456789') # 收款卡号 base.send_keys(apartmentContractEndPage.addContractEndMould['receipt_num_loc'], Keys.ENTER) base.click(apartmentContractEndPage.addContractEndMould['cardconfirm_close_loc']) # 银行卡确认无误 base.dblclick(apartmentContractEndPage.addContractEndMould['weiyuejin_loc'], index=12) # 违约金 base.input_text(apartmentContractEndPage.addContractEndMould['receivable_money_loc'], breach_money) # 应收违约金 base.dblclick(apartmentContractEndPage.addContractEndMould['weiyuejin_loc'], index=21) # 转租费 base.input_text(apartmentContractEndPage.addContractEndMould['zhuanzu_money_loc'], zhuanzu_money) # 应收转租金 base.upload_file(apartmentContractEndPage.addContractEndMould['add_end_image_loc'], 'C:\Users\Public\Pictures\Sample Pictures\jsp.jpg') # 传图 base.wait_element(apartmentContractEndPage.addContractEndMould['end_image_loc']) base.input_text(apartmentContractEndPage.addContractEndMould['remark_loc'], 'AutoTest') # 备注 base.click(apartmentContractEndPage.addContractEndMould['submit_button']) # 提交 base.check_submit() # 等待提交完成 # 终止结算审核 contractEndAdd="SELECT ace.end_id FROM apartment_contract ac,apartment_contract_end ace WHERE ac.contract_id = ace.contract_id and ace.audit_status='NO_AUDIT' " \ "AND ace.end_type='CORPORATE_DEFAULT'and ace.deleted=0 and ace.end_contract_num='%s'" % endNum apartmentContractEndId = sqlbase.serach(contractEndAdd)[0] audit(apartmentContractEndId, auditType.apartmentContractEnd, auditStatus.chuShen, auditStatus.fuShen) # 违约业绩检查 breachAchievementSql = "select is_active,accounting_money,achieve_id from breach_achievement where breach_num='%s' and deleted=0 and breach_type='CUSTOMER_SUBLET' " \ "and is_active='Y'" % apartmentContractNum if sqlbase.waitData(breachAchievementSql, 1): breachAchievementInfo = sqlbase.serach(breachAchievementSql) base.diffAssert(lambda test: asserts(breachAchievementInfo[1]).is_equal_to(zhuanzu_money), 1095, u'%s:出租合同 %s 转租违约业绩金额异常,期望值 %s 实际值 %s' % ( fileName, apartmentContractNum, zhuanzu_money, breachAchievementInfo[1])) else: consoleLog(u'%s:出租合同 %s 转租终止生成违约业绩异常,执行SQL:%s' % (fileName, apartmentContractNum, breachAchievementSql)) # 业绩审核 base.open(page.defaultAchievementPage, apartmentAchievementPage.searchContractMould['tr_contract']) base.click(apartmentAchievementPage.searchContractMould['reset_button_loc']) # 重置 time.sleep(10) # 等待重新核算更新数据 base.input_text(apartmentAchievementPage.searchContractMould['breach_num_loc'], apartmentContractNum) # 输入合同号 base.click(apartmentAchievementPage.searchContractMould['search_button_loc']) # 查找 base.staleness_of(apartmentAchievementPage.searchContractMould['tr_contract']) # 等待第一条数据刷新 base.dblclick(apartmentAchievementPage.searchContractMould['tr_contract'], checkLoc=apartmentAchievementPage.detailAchievementMoudle['breach_num_loc']) # 点击第一条数据等待详情页面完全显示 base.click(apartmentAchievementPage.detailAchievementMoudle['audit_button_loc']) base.input_text(apartmentAchievementPage.detailAchievementMoudle['contract_audit_content'], 'ok') base.click(apartmentAchievementPage.detailAchievementMoudle['contract_audit_confirm']) base.check_submit() # 修改终止结算类型和转租费 audit(apartmentContractEndId, auditType.apartmentContractEnd, auditStatus.fanShen) base.open(page.contractEndPage, apartmentContractEndPage.searchMould['tr_contract_end']) base.input_text(apartmentContractEndPage.searchMould['contract_num_loc'], apartmentContractNum) # 输入合同号 base.click(apartmentContractEndPage.searchMould['search_button_loc']) # 搜索 base.staleness_of(apartmentContractEndPage.searchMould['tr_contract_end']) # 等待列表刷新 base.dblclick(apartmentContractEndPage.searchMould['tr_contract_end']) # 双击第一条数据 zhuanzu_money_new = str(float(zhuanzu_money)+100) base.input_text(apartmentContractEndPage.addContractEndMould['remark_loc'], 'AutoTest2') # 备注 base.dblclick(apartmentContractEndPage.addContractEndMould['weiyuejin_loc'], index=21) # 转租费 base.input_text(apartmentContractEndPage.addContractEndMould['zhuanzu_money_loc'], zhuanzu_money_new) # 应收转租金 base.click(apartmentContractEndPage.addContractEndMould['save_button']) # 保存 base.check_submit() # 获取修改后业绩数据 time.sleep(10) breachAchievementNewSql = "select is_active,accounting_money,achieve_id from breach_achievement where breach_num='%s' and deleted=0 and breach_type='CUSTOMER_SUBLET'" % apartmentContractNum breachAchievementNewInfo = sqlbase.serach(breachAchievementNewSql) base.diffAssert(lambda test: asserts(breachAchievementNewInfo[1]).is_equal_to(zhuanzu_money), 1095, u'%s:出租合同 %s 转租终止违约修改转租费后业绩金额异常,期望值 %s 实际值 %s' % (fileName, apartmentContractNum, zhuanzu_money, breachAchievementNewInfo[1])) # 业绩分成明细表(预估业绩排行榜数据取值表,检查违约业绩同步更新到预估业绩排行榜) breahAchievementDetailSql = "select ca.receivable from contract_achievement ca inner join contract_achievement_detail cad on ca.achieve_id=cad.achieve_id inner join breach_achievement ba " \ "on ba.achieve_id=ca.achieve_id and ba.breach_type='CUSTOMER_SUBLET' and ba.deleted=0 and ba.breach_num='%s' where ca.contract_category='CUSTOMER_SUBLET' " \ "and ca.deleted=0 " % apartmentContractNum prebreachAchievement = sqlbase.serach(breahAchievementDetailSql)[0] base.diffAssert(lambda test: asserts(prebreachAchievement).is_equal_to(zhuanzu_money), 1095, u'%s:出租合同 %s 转租终止违约修改转租费后,业绩分成明细业绩金额异常,实际值 %s 期望值 %s' % ( fileName, apartmentContractNum, prebreachAchievement, breach_money))
def test_1049(): """修改出租合同承租到期日-1""" # describe:在出租合同详情中,修改出租合同承租到期日减1天;业绩发生变化 # data:1、业绩审核状态为待审核;2、合同只生成1条业绩;3、记录原业绩中出租和委托核算周期及差价业绩; # result:1、业绩中出租和委托核算周期都减1天;2、差价业绩变化; fileName = 'apartmentAchievement_1049' with Base() as base: # 创建委托合同和出租合同 houseSql = sqlbase.serach( "select house_id,residential_id,building_id,house_code from house where deleted=0 and city_code=330100 order by rand() limit 1" ) # 获取随机开发房源 houseInfo = { 'houseID': houseSql[0], 'residentialID': houseSql[1], 'buildingID': houseSql[2], 'houseCode': houseSql[3] } dateInfo = sqlbase.serach( "select date(sysdate()),date_add(date(sysdate()),INTERVAL 1 day),date_add(date(sysdate()),interval 2 year),date_add(date(sysdate()),interval 27 month)," "date_add(date(sysdate()),INTERVAL 1 month),date_add(date(sysdate()),INTERVAL 6 month),date_add(date(sysdate()),INTERVAL 3 month)," "DATE_SUB(date_add(date(sysdate()),INTERVAL 6 month),INTERVAL 1 DAY) from dual" ) # 日期元素 apartmentId = addHouseContractAndFitment( apartment_type='MANAGE', entrust_type='SHARE', sign_date=dateInfo[0], owner_sign_date=dateInfo[0], entrust_start_date=dateInfo[0], entrust_end_date=dateInfo[2], delay_date=dateInfo[3], free_start_date=dateInfo[0], free_end_date=dateInfo[4], first_pay_date=dateInfo[0], second_pay_date=dateInfo[4], rent=3000, parking=100, year_service_fee=500, payment_cycle='MONTH', fitment_start_date=dateInfo[0], fitment_end_date=dateInfo[4], rooms=3, fitmentCost=88888, houseInfo=houseInfo) rentPriceInfo = sqlbase.serach( "select rent_price,date(sysdate()) from apartment where apartment_id='%s'" % apartmentId) rentPrice = float(rentPriceInfo[0]) customer = createCustomer() apartmentContractInfo = createApartmentContract( apartement_id=apartmentId, customerInfo=customer, rent_price=rentPrice, sign_date=dateInfo[0], rent_start_date=dateInfo[1], rent_end_date=dateInfo[5], # 承租6个月 deposit=rentPrice, payment_cycle='MONTH') apartmentContractNum = apartmentContractInfo['contractNum'] achievementSql = "select substring_index(house_code,'-',1) from apartment_contract_achievement where contract_num='%s' and deleted=0" % apartmentContractNum base.diffAssert( lambda test: asserts(sqlbase.waitData(achievementSql, 1)).is_true( ), 1049, u'%s:业绩生成异常' % fileName) # 获取当前的核算收进价和差价业绩 achievement1Sql = "select start_time,end_time,profits_fee from apartment_contract_achievement where contract_num='%s' and deleted=0 and accounting_num=1" % apartmentContractNum achievement1Info = sqlbase.serach(achievement1Sql) accountingEndTime1_old = achievement1Info[1] profits_fee1_old = achievement1Info[2] base.open(page.apartmentContractPage, apartmentContractPage.searchContractMould['tr_contract']) base.input_text( apartmentContractPage.searchContractMould['contract_num_loc'], apartmentContractNum) # 输入合同编号 base.click( apartmentContractPage.searchContractMould['search_button_loc']) base.staleness_of( apartmentContractPage.searchContractMould['tr_contract']) base.dblclick(apartmentContractPage.searchContractMould['tr_contract'], checkLoc=apartmentContractPage. addApartmentContractMould['contract_num_loc']) # 双击第一条数据 base.type_date(apartmentContractPage.typeMould['rent_end_date2'], dateInfo[7]) # 承租到期日 base.type_select(apartmentContractPage.typeMould['payment_type'], 'NORMAL') # 正常付款 base.type_select(apartmentContractPage.typeMould['payment_cycle'], 'MONTH') # 一次性付款 base.script( "$('#contract_strategy_table > table > tbody > tr > td:nth-child(8) > input').click()" ) base.type_date( apartmentContractPage. addApartmentContractMould['rent_strategy1_end_loc'], dateInfo[7]) base.click( apartmentContractPage.addApartmentContractMould['save_button']) base.check_submit() # 获取最新的核算收进价和差价业绩 time.sleep(10) achievement1InfoNew = sqlbase.serach(achievement1Sql) accountingEndTime1_new = achievement1InfoNew[1] profits_fee1_new = achievement1InfoNew[2] base.diffAssert( lambda test: asserts(accountingEndTime1_new).is_not_equal_to( accountingEndTime1_old), 1049, u'%s:出租合同 %s 对应承租期修改后业绩中核算周期异常,修改前 %s 修改后 %s' % (fileName, apartmentContractNum, accountingEndTime1_old, accountingEndTime1_new)) base.diffAssert( lambda test: asserts(profits_fee1_new).is_not_equal_to( profits_fee1_old), 1049, u'%s:出租合同 %s 对应委托成本修改后业绩中差价业绩异常,修改前 %s 修改后 %s' % (fileName, apartmentContractNum, profits_fee1_old, profits_fee1_new))
def test_1083(): """违约业绩审核""" # describe:违约业绩审核后同步到预估业绩排行榜,重新核算不可用 # data:1、违约业绩状态为生效;2、违约业绩审核状态为待审核 # result:1、业绩审核状态变为已审核;2、预估业绩排行榜中对应审核状态同步变为已审核;3、重新核算功能不可用; fileName = 'apartmentAchievement_1083' achievementSql = "select ba.breach_num,ba.apartment_code,ba.breach_type,ba.achieve_id from breach_achievement ba inner join apartment a on a.apartment_code=ba.apartment_code " \ "and city_code=330100 where ba.is_active='Y' and ba.audit_status='AUDIT' AND ba.deleted=0 order by rand() limit 1" if sqlbase.get_count(achievementSql) == 0: consoleLog(u'%s:SQL查无数据!' % fileName, 'w') consoleLog(u'执行SQL:%s' % achievementSql) return info = sqlbase.serach(achievementSql) breachNum = info[0] consoleLog(u'%s:使用合同 %s 违约业绩做审核' % (fileName, breachNum)) with Base() as base: base.open(page.defaultAchievementPage, apartmentAchievementPage.searchContractMould['tr_contract']) base.click(apartmentAchievementPage. searchContractMould['reset_button_loc']) # 重置 base.input_text( apartmentAchievementPage.searchContractMould['breach_num_loc'], breachNum) # 输入合同号 base.input_text( apartmentAchievementPage.searchContractMould['search_address_loc'], info[1]) # 房源编号 base.click(apartmentAchievementPage. searchContractMould['search_button_loc']) # 查找 base.staleness_of(apartmentAchievementPage. searchContractMould['tr_contract']) # 等待第一条数据刷新 base.dblclick( apartmentAchievementPage.searchContractMould['tr_contract'], checkLoc=apartmentAchievementPage. detailAchievementMoudle['breach_num_loc']) # 点击第一条数据等待详情页面完全显示 base.click(apartmentAchievementPage. detailAchievementMoudle['audit_button_loc']) base.input_text( apartmentAchievementPage. detailAchievementMoudle['contract_audit_content'], 'ok') base.click(apartmentAchievementPage. detailAchievementMoudle['contract_audit_confirm']) base.check_submit() achievementStatus = "select * from breach_achievement where is_active='Y' and audit_status='APPROVED' AND deleted=0 " \ "and achieve_id='%s'" % info[3] if not sqlbase.waitData(achievementStatus, 1): consoleLog(u'%s:出租合同 %s 业绩审核异常' % (fileName, breachNum), 'e') base.dblclick( apartmentAchievementPage.searchContractMould['tr_contract'], checkLoc=apartmentAchievementPage. detailAchievementMoudle['breach_num_loc']) # 点击第一条数据等待详情页面完全显示 try: base.click( apartmentAchievementPage.detailAchievementMoudle['resave_loc']) except: consoleLog(u'已审核业绩无法重新核算') # 预估排行榜业绩 base.open(page.achievementListPrePage, apartmentAchievementPage.searchContractMould['tr_contract']) base.click(apartmentAchievementPage. searchContractMould['reset_button_loc']) # 重置 base.staleness_of( apartmentAchievementPage.searchContractMould['tr_contract']) base.input_text(apartmentAchievementPage. searchContractMould['contract_num_hefa_loc'], breachNum) # 输入合同号 base.input_text( apartmentAchievementPage.searchContractMould['search_address_loc'], info[1]) # 输入房源 base.type_select( apartmentAchievementPage.searchContractMould['category_loc'], info[2]) # 分类 base.click(apartmentAchievementPage. searchContractMould['search_button_loc']) # 查找 base.staleness_of(apartmentAchievementPage. searchContractMould['tr_contract']) # 等待第一条数据刷新 achievementDetailCount = sqlbase.get_count( "select * from contract_achievement_detail where deleted=0 and achieve_id='%s'" % info[3]) for i in range(achievementDetailCount): achievement_audit_status = base.script( "var a = $('[datagrid-row-index=\"%s\"] > [field=\"audit_status\"] > div').text();return a" % i, True) audit_status = u'已审核' base.diffAssert( lambda test: asserts(achievement_audit_status).is_equal_to( audit_status), 1083, u'%s:合同 %s 违约业绩第 %s 条状态异常,期望值 %s 实际值 %s' % (fileName, breachNum, i, audit_status, achievement_audit_status))
def test_1088(): """委托违约业绩删除""" # describe:委托违约业绩删除,预估业绩排行榜中同步删除 # data:1、业绩状态未审核;2、终止结算未复审; # result:1、违约业绩删除;2、预估业绩排行榜中业绩删除; fileName = 'apartmentAchievement_1088' contractSql = "select contract_num,entrust_end_date,date(sysdate()) from house_contract where contract_id not in (select house_contract.contract_id from apartment ,apartment_contract ,house_contract " \ "where house_contract.contract_id=apartment.house_contract_id and apartment.house_id=apartment_contract.house_id and apartment_contract.real_due_date>NOW()) " \ "and city_code = 330100 and audit_status = 'APPROVED'and contract_status = 'EFFECTIVE' and deleted = 0 and entrust_end_date>NOW() order by rand() limit 1" if sqlbase.get_count(contractSql) == 0: consoleLog(u'%s:SQL查无数据!' % fileName, 'w') consoleLog(u'执行SQL:%s' % contractSql) return info = sqlbase.serach(contractSql) contractNum = info[0] consoleLog(u'%s:取随机委托合同 %s 做业主违约终止' % (fileName, contractNum)) with Base() as base: base.open(page.entrustContractPage, houseContractEndPage.addContractEndMould['tr_contract']) base.input_text(houseContractEndPage.searchMould['contract_num_loc'], contractNum) # 输入合同号 base.click(houseContractEndPage. searchMould['contract_search_button_loc']) # 搜索 base.staleness_of( houseContractEndPage.addContractEndMould['tr_contract']) # 等待数据刷新 base.context_click( houseContractEndPage.addContractEndMould['tr_contract']) # 右击第一条数据 base.click(houseContractEndPage.addContractEndMould['end_button_loc'], index=1) # 终止结算 base.wait_element( houseContractEndPage.addContractEndMould['penalty_loc']) # 等待页面出现 base.type_select(houseContractEndPage.typeMould['end_type'], 'OWNER_DEFAULT') # 结算类型-业主违约 endNum = 'AutoHCE' + '-' + time.strftime('%m%d%H%M') base.input_text( houseContractEndPage.addContractEndMould['end_num_loc'], endNum) base.type_date(houseContractEndPage.typeMould['end_date'], contractSql[2]) # 终止日期:当天 # 结算扣款 base.input_text( houseContractEndPage.addContractEndMould['penalty_loc'], 2000) # 违约金陪入 base.input_text( houseContractEndPage.addContractEndMould['penalty_remark_loc'], u'违约金陪入') # 备注 base.input_text( houseContractEndPage.addContractEndMould['return_rent_loc'], 5000) # 返还房租 base.input_text( houseContractEndPage.addContractEndMould['return_rent_remark_loc'], u'返还房租') # 备注 base.type_date(houseContractEndPage.typeMould['receivable_date'], contractSql[2]) # 应收日期 # 打款信息 base.type_select(houseContractEndPage.typeMould['pay_type'], 'OWNER') # 打款类别-业主收款 base.input_text( houseContractEndPage.addContractEndMould['pay_name_loc'], 'AutoTest') # 姓名 base.type_select(houseContractEndPage.typeMould['pay_object_loc'], 'BUSINESS') # 公司 base.input_text( houseContractEndPage.addContractEndMould['pay_bank_loc'], u'中国银行') # 收款银行 base.input_text( houseContractEndPage.addContractEndMould['pay_bank_no_loc'], '12345678910') # 银行卡号 base.upload_file( houseContractEndPage.addContractEndMould['add_end_image_loc'], 'C:\Users\Public\Pictures\Sample Pictures\jsp.jpg') # 传图 base.wait_element( houseContractEndPage.addContractEndMould['end_image_loc']) base.click( houseContractEndPage.addContractEndMould['submit_loc']) # 提交 base.check_submit() # 等待提交完成 # 违约业绩检查 breachAchievementSql = "select is_active,accounting_money,achieve_id from breach_achievement where breach_num='%s' and deleted=0 and breach_type='HOUSE_OWNER_DEFAULT_BREACH'" % contractNum if sqlbase.waitData(breachAchievementSql, 1): breachAchievementInfo = sqlbase.serach(breachAchievementSql) else: consoleLog(u'%s:委托合同 %s 业主违约生成违约业绩异常,执行SQL:%s' % (fileName, contractNum, breachAchievementSql)) # 删除终止结算 base.open( page.contractEndPage, houseContractEndPage.searchMould['contract_search_button_loc']) base.click(houseContractEndPage.addContractEndMould['tab_info'], index=1) base.input_text( houseContractEndPage.searchMould['end_contract_num_loc'], contractNum) base.click( houseContractEndPage.searchMould['end_search_button_loc']) # 搜索 base.staleness_of( houseContractEndPage.searchMould['tr_contract_end']) # 等待数据刷新 base.click(houseContractEndPage.addContractEndMould['delete_button']) base.click( houseContractEndPage.addContractEndMould['delete_button_confirm']) base.check_submit() breachAchievementDelSql = "select is_active,accounting_money,achieve_id from breach_achievement where achieve_id='%s' and deleted=1 and breach_type='HOUSE_OWNER_DEFAULT_BREACH'" % breachAchievementInfo[ 2] base.diffAssert( lambda test: asserts(sqlbase.waitData(breachAchievementDelSql, 1)). is_true(), 1088, u'%s:委托合同 %s 违约业绩删除异常,执行SQL:%s' % (fileName, contractNum, breachAchievementSql)) # 业绩分成明细表(预估业绩排行榜数据取值表,检查违约业绩同步更新到预估业绩排行榜) breahAchievementDetailSql = "select * from contract_achievement_detail where achieve_id='%s' and deleted=0" % breachAchievementInfo[ 2] achievementDetialConunt = sqlbase.get_count(breahAchievementDetailSql) base.diffAssert( lambda test: asserts(achievementDetialConunt).is_equal_to(0), 1088, u'%s:委托合同 %s 违约业绩明细删除异常' % (fileName, contractNum))
def test_1074(): """修改委托终止赔入违约金""" # describe:修改委托终止结算赔入违约金金额+100,违约业绩同步+100 # data:1、委托终止结算未复审;2、委托终止类型为业主违约;3、业绩状态未审核; # result:1、违约业绩比之前多100;2、分成人业绩同步变化;3、预估业绩排行榜同步更新; fileName = 'apartmentAchievement_1074' contractSql = "select contract_num,entrust_end_date,date(sysdate()) from house_contract where contract_id not in (select house_contract.contract_id from apartment ,apartment_contract ,house_contract " \ "where house_contract.contract_id=apartment.house_contract_id and apartment.house_id=apartment_contract.house_id and apartment_contract.real_due_date>NOW()) " \ "and city_code = 330100 and audit_status = 'APPROVED'and contract_status = 'EFFECTIVE' and deleted = 0 and entrust_end_date>NOW() order by rand() limit 1" if sqlbase.get_count(contractSql) == 0: consoleLog(u'%s:SQL查无数据!' % fileName, 'w') consoleLog(u'执行SQL:%s' % contractSql) return info = sqlbase.serach(contractSql) contractNum = info[0] consoleLog(u'%s:取随机委托合同 %s 做业主违约终止' % (fileName, contractNum)) with Base() as base: base.open(page.entrustContractPage, houseContractEndPage.addContractEndMould['tr_contract']) base.input_text(houseContractEndPage.searchMould['contract_num_loc'], contractNum) # 输入合同号 base.click(houseContractEndPage. searchMould['contract_search_button_loc']) # 搜索 base.staleness_of( houseContractEndPage.addContractEndMould['tr_contract']) # 等待数据刷新 base.context_click( houseContractEndPage.addContractEndMould['tr_contract']) # 右击第一条数据 base.click(houseContractEndPage.addContractEndMould['end_button_loc'], index=1) # 终止结算 base.wait_element( houseContractEndPage.addContractEndMould['penalty_loc']) # 等待页面出现 base.type_select(houseContractEndPage.typeMould['end_type'], 'OWNER_DEFAULT') # 结算类型-业主违约 endNum = 'AutoHCE' + '-' + time.strftime('%m%d%H%M') base.input_text( houseContractEndPage.addContractEndMould['end_num_loc'], endNum) base.type_date(houseContractEndPage.typeMould['end_date'], contractSql[2]) # 终止日期:当天 # 结算扣款 base.input_text( houseContractEndPage.addContractEndMould['penalty_loc'], 2000) # 违约金陪入 base.input_text( houseContractEndPage.addContractEndMould['penalty_remark_loc'], u'违约金陪入') # 备注 base.input_text( houseContractEndPage.addContractEndMould['return_rent_loc'], 5000) # 返还房租 base.input_text( houseContractEndPage.addContractEndMould['return_rent_remark_loc'], u'返还房租') # 备注 base.type_date(houseContractEndPage.typeMould['receivable_date'], contractSql[2]) # 应收日期 # 打款信息 base.type_select(houseContractEndPage.typeMould['pay_type'], 'OWNER') # 打款类别-业主收款 base.input_text( houseContractEndPage.addContractEndMould['pay_name_loc'], 'AutoTest') # 姓名 base.type_select(houseContractEndPage.typeMould['pay_object_loc'], 'BUSINESS') # 公司 base.input_text( houseContractEndPage.addContractEndMould['pay_bank_loc'], u'中国银行') # 收款银行 base.input_text( houseContractEndPage.addContractEndMould['pay_bank_no_loc'], '12345678910') # 银行卡号 base.upload_file( houseContractEndPage.addContractEndMould['add_end_image_loc'], 'C:\Users\Public\Pictures\Sample Pictures\jsp.jpg') # 传图 base.wait_element( houseContractEndPage.addContractEndMould['end_image_loc']) base.click( houseContractEndPage.addContractEndMould['submit_loc']) # 提交 base.check_submit() # 等待提交完成 # 终止结算新增检查 contractEndAdd = "select hce.end_id from house_contract hc,house_contract_end hce where hc.contract_id=hce.contract_id and hc.contract_num='%s' and hce.deleted=0 " \ "and hce.audit_status='NO_AUDIT' and hce.end_type='OWNER_DEFAULT'" % contractNum base.diffAssert( lambda test: asserts(sqlbase.waitData(contractEndAdd, 1)).is_true( ), 1074, u'%s:委托合同 %s 终止结算新增异常,执行SQL:%s' % (fileName, contractNum, contractEndAdd)) # 违约业绩检查 breachAchievementSql = "select is_active,accounting_money,achieve_id from breach_achievement where breach_num='%s' and deleted=0 and breach_type='HOUSE_OWNER_DEFAULT_BREACH'" % contractNum base.diffAssert( lambda test: asserts(sqlbase.waitData(breachAchievementSql, 1)). is_true(), 1074, u'%s:委托合同 %s 业主违约生成违约业绩异常,执行SQL:%s' % (fileName, contractNum, breachAchievementSql)) breachAchievementInfo = sqlbase.serach(breachAchievementSql) # 终止结算初审后修改违约核算金额 houseContractEndId = sqlbase.serach(contractEndAdd)[0] audit(houseContractEndId, auditType.houseContractEnd, auditStatus.chuShen) base.open( page.contractEndPage, houseContractEndPage.searchMould['contract_search_button_loc']) base.click(houseContractEndPage.addContractEndMould['tab_info'], index=1) base.input_text( houseContractEndPage.searchMould['end_contract_num_loc'], contractNum) base.click( houseContractEndPage.searchMould['end_search_button_loc']) # 搜索 base.staleness_of( houseContractEndPage.searchMould['tr_contract_end']) # 等待数据刷新 base.dblclick( houseContractEndPage.searchMould['tr_contract_end'], checkLoc=houseContractEndPage.addContractEndMould['check_loc']) time.sleep(2) financial_money_new = str(float(breachAchievementInfo[1]) + 100) # base.script("$('#financial_provide_money+span>input').val('%s')" % financial_money_new) base.input_text( houseContractEndPage.addContractEndMould['financial_money_loc'], financial_money_new) base.type_select(houseContractEndPage.typeMould['pay_object_loc'], 'BUSINESS') # 公司 base.input_text( houseContractEndPage.addContractEndMould['pay_bank_loc'], u'中国银行') # 收款银行 base.input_text( houseContractEndPage.addContractEndMould['pay_bank_no_loc'], '12345678910') # 银行卡号 base.click(houseContractEndPage.addContractEndMould['save_loc']) # 保存 base.check_submit() # 获取修改后业绩数据 time.sleep(10) breachAchievementSql = "select is_active,accounting_money,achieve_id from breach_achievement where breach_num='%s' and deleted=0 and breach_type='HOUSE_OWNER_DEFAULT_BREACH'" % contractNum breachAchievementInfo = sqlbase.serach(breachAchievementSql) base.diffAssert( lambda test: asserts(breachAchievementInfo[1]).is_equal_to( financial_money_new), 1074, u'%s:委托合同 %s 违约业绩金额异常,期望值 %s 实际值 %s' % (fileName, contractNum, financial_money_new, breachAchievementInfo[1])) # base.diffAssert(lambda test: asserts(personAchievementNew).is_not_equal_to(personAchievementOld), 1074, # u'%s:委托合同 %s 业主违约修改终止合同核算业绩金额后,违约业绩分成明细异常,期望值不为 %s 实际值 %s' % (fileName, contractNum, personAchievementOld, personAchievementNew)) # 业绩分成明细表(预估业绩排行榜数据取值表,检查违约业绩同步更新到预估业绩排行榜) breahAchievementDetailSql = "select ca.receivable from contract_achievement ca inner join contract_achievement_detail cad on ca.achieve_id=cad.achieve_id inner join breach_achievement ba " \ "on ba.achieve_id=ca.achieve_id and ba.breach_type='HOUSE_OWNER_DEFAULT_BREACH' and ba.deleted=0 and ba.breach_num='%s' " \ "where ca.contract_category='HOUSE_OWNER_DEFAULT_BREACH' and ca.deleted=0 " % contractNum prebreachAchievement = sqlbase.serach(breahAchievementDetailSql)[0] base.diffAssert( lambda test: asserts(prebreachAchievement).is_equal_to( financial_money_new), 1074, u'%s:委托合同 %s 业主违约修改终止合同核算业绩金额后,业绩分成明细业绩金额异常,实际值 %s 期望值 %s' % (fileName, contractNum, prebreachAchievement, financial_money_new))