Exemplo n.º 1
0
def test():
    apartmentId = 'HZGS1607300454'
    customer = createCustomer()  # 创建租客,出租合同
    contract_num_sign = u'WFL'  # 合同标识
    contract_num = '%s%s-%s' % (contract_num_sign, time.strftime('%m%d%H%M'),
                                get_randomString(2))
    # contract_num = 'WFL08280959-1r'
    sign_date = addDays(5, addMonths(-11, today()))
    sign_date = today()
    rent_price = 2030
    rent_start_date = addDays(1, sign_date)
    rent_end_date = addDays(-1, addMonths(12, rent_start_date))
    payment_cycle = 'HALF_YEAR'
    sign_phone = '18815286582'
    sign_name = '王方龙'
    sign_id_type = 'IDNO'
    sign_id_no = '330381199203025315'
    # sign_id_no = '111111111111111111'
    contract = Apartment(apartmentId).createApartmentContract(
        customerInfo=customer,
        rent_price=rent_price,
        sign_date=sign_date,
        rent_start_date=rent_start_date,
        rent_end_date=rent_end_date,
        payment_cycle=payment_cycle,
        contract_num=contract_num,
        sign_phone=sign_phone,
        sign_id_no=sign_id_no,
        sign_name=sign_name,
        sign_id_type=sign_id_type)
    print(contract.apartment_contract_id)
Exemplo n.º 2
0
 def receiptAndAudit(self):
     """
     出租合同实收及实收的审核
     :return: 完成所有实收和审核
     """
     url = 'isz_finance/ApartmentContractReceiptsController/saveOrUpdateNewReceipts.action'
     receivables = self.receivables()
     i = 0
     consoleLog("共有%s条应收待实收" % len(receivables))
     for receivable in receivables:
         i = i + 1
         data = {
             'alipay_card': '0011',  # 支付宝账号
             'company': self.sign_body,  # 收款公司
             'contract_id': self.apartment_contract_id,
             'operation_total': receivable.receivable_money,  # 转账总金额
             'receipts_date': datetimes.today(),  # 收款日期
             'receipts_type': 'ALIPAY',  # 收款方式:支付宝转账
             'receipts_money': receivable.receivable_money,  # 收款金额
             'receivable_id': receivable.receivable_id  # 应收ID
         }
         # 实收
         result = myRequest(url, data)
         if result:
             # 审核
             consoleLog("实收第%s条完成" % i)
             myRequest(
                 url=
                 'isz_finance/ApartmentContractReceiptsController/endReceivable.action',
                 data={'receivable_id': receivable.receivable_id})
             consoleLog("审核第%s条完成" % i)
         else:
             break
Exemplo n.º 3
0
def createHouseContract(houseInfo):
    """新签委托合同"""
    house = House(houseInfo[0])
    consoleLog('签约房源:%s, %s, %s' % (house.house_id, house.house_code, house.property_name))
    # 委托合同参数
    contract_num_sign = u'WFL-2.0'  # 合同标识
    apartment_type = 'BRAND'
    entrust_type = 'ENTIRE'
    contract_num = '%s%s%s%s-%s' % (contract_num_sign, apartment_type[0], entrust_type[0], time.strftime('%m%d%H%M'), get_randomString(2))
    sign_date = addMonths(-2, today())
    # sign_date = addDays(-20, today())
    owner_sign_date = addDays(1, sign_date)
    fitment_start_date = addDays(3, sign_date)
    fitment_end_date = addMonths(1, sign_date)
    entrust_start_date = addDays(1, fitment_end_date)
    entrust_year = 3
    rent = 1234.34
    parking = 123
    # try:
    contract = house.createHouseContract(contract_num=contract_num, apartment_type=apartment_type,
                                         entrust_type=entrust_type, sign_date=sign_date,
                                         owner_sign_date=owner_sign_date, fitment_start_date=fitment_start_date, fitment_end_date=fitment_end_date,
                                         entrust_start_date=entrust_start_date, entrust_year=entrust_year, rent=rent,
                                         parking=parking)
    # contract.audit('fushen')
    decoration = Decoration(contract.house_contract_id)
Exemplo n.º 4
0
 def receipt(self, receivable_id):
     """实收"""
     url = 'isz_finance/ApartmentContractReceiptsController/saveOrUpdateNewReceipts.action'
     receivables = self.receivables()
     for receivable in receivables:
         data = {
             'alipay_card': '0011',  # 支付宝账号
             'company': self.sign_body,  # 收款公司
             'contract_id': self.apartment_contract_id,
             'operation_total': receivable.receivable_money,  # 转账总金额
             'receipts_date': datetimes.today(),  # 收款日期
             'receipts_type': 'ALIPAY',  # 收款方式:支付宝转账
             'receipts_money': receivable.receivable_money,  # 收款金额
             'receivable_id': receivable.receivable_id  # 应收ID
         }
         # 实收
         result = myRequest(url, data)
Exemplo n.º 5
0
    def resign(
        self,
        contract_num=None,
        sign_date=None,
        rent_end_date=None,
        money_cycle=None,
        payment_date=None,
    ):
        """续签"""

        # self.receiptAndAudit()
        contract_num = 'RS-%s' % self.apartment_contract_num if not contract_num else contract_num
        sign_date = today() if not sign_date else sign_date
        rent_start_date = addDays(1, self.rent_end_date)
        rent_end_date = addMonths(
            12, self.rent_end_date) if not rent_end_date else rent_end_date
        start_date = rent_start_date
        end_date = rent_end_date
        money = self.rental_price if not self.rental_price == 'None' else 2030
        deposit = self.deposit
        month_server_fee = self.month_server_fee
        payment_date = rent_start_date if not payment_date else payment_date
        money_cycle = self.payment_cycle if not money_cycle else money_cycle
        data = {
            "apartmentContractRentInfoList": [{
                "firstRow":
                True,
                "money":
                money,
                "start_date":
                start_date,
                "rowIndex":
                0,
                "end_date":
                end_date,
                "money_cycle":
                money_cycle,
                "payment_date":
                payment_date,
                "deposit":
                deposit,
                "agencyFeeMoney":
                "0.00",
                "money_type":
                "RENT",
                "rent_start_date":
                rent_start_date,
                "rent_end_date":
                rent_end_date,
                "sign_date":
                sign_date,
                "month_server_fee":
                month_server_fee
            }],
            "apartment_id":
            self.apartment_id,
            "apartment_rent_price":
            money,
            "sign_date":
            sign_date,
            "rent_end_date":
            rent_end_date,
            "payment_date":
            payment_date,
            "deposit_type":
            "ONE",
            "payment_type":
            "NORMAL",
            "payment_cycle":
            money_cycle,
            "cash_rent":
            str(float(money) * 0.1),
            "deposit":
            deposit,
            "agency_fee":
            "0.00",
            "month_server_fee":
            month_server_fee,
            "month_server_fee_discount":
            "100%",
            "dispostIn":
            1,
            "contract_num":
            contract_num,
            "person": {},
            "model":
            "4"
        }
        url = 'isz_contract/ApartmentContractController/searchApartmentContractDetail.action'
        requestPayload = {
            "parent_id": self.apartment_contract_id,
            "contract_type": "RENEWSIGN"
        }
        result = myRequest(url, requestPayload)
        if result:
            apartmentContract = delNull(result['obj']['apartmentContract'])
            for x, y in apartmentContract.items():
                data[x] = y

            customerPerson = delNull(result['obj']['customerPerson'])
            for x, y in customerPerson.items():
                data['person'][x] = y

        data['receivables'] = self.createReceivables(
            data['apartmentContractRentInfoList'])

        hosueInfo = {
            "rent_start_date": rent_start_date,
            "rent_end_date": rent_end_date,
            "houseId": self.house_id,
            "apartment_id": self.apartment_id,
            "room_id": self.room_id
        }
        data['houseContractList'] = self.gethouseContractList(
            self.entrust_type, hosueInfo)
        contract_id = self.createApartmentContract(data)
        return ApartmentContract(contract_id)
Exemplo n.º 6
0
    def end(self, end_date=today(), end_type=None):
        """终止结算"""
        self.audit()

        endImg = upLoadPhoto(url=self.uploadPhotoURL,
                             filename='idCardPhotos.png',
                             filepath=r"C:\Users\user\Desktop\Image\\")
        url = '/isz_contract/ContractEndController/saveOrUpdateApartmentContractEnd'
        endInfo = self.getEndInfo()
        endInfo['apartmentContractEndReceivableList'] = [{
            "balance_amount":
            0,
            "create_time":
            None,
            "create_uid":
            None,
            "deleted":
            None,
            "end_amount":
            0,
            "end_id":
            None,
            "receipts_amount":
            0,
            "receivable_amount":
            self.deposit,
            "receivable_id":
            None,
            "receivable_type":
            "DEPOSIT",
            "receivable_type_cn":
            "押金",
            "should_amount":
            0,
            "update_time":
            None,
            "update_uid":
            None
        }, {
            "balance_amount": 0,
            "create_time": None,
            "create_uid": None,
            "deleted": None,
            "end_amount": 0,
            "end_id": None,
            "receipts_amount": 0,
            "receivable_amount": 0,
            "receivable_id": None,
            "receivable_type": "RENT",
            "receivable_type_cn": "租金",
            "should_amount": 0,
            "update_time": None,
            "update_uid": None
        }, {
            "balance_amount": 0,
            "create_time": None,
            "create_uid": None,
            "deleted": None,
            "end_amount": 140,
            "end_id": None,
            "receipts_amount": 0,
            "receivable_amount": 1680,
            "receivable_id": None,
            "receivable_type": "MANAGE_SERVER_FEE",
            "receivable_type_cn": "管家服务费",
            "should_amount": 140,
            "update_time": None,
            "update_uid": None
        }, {
            "balance_amount": 0,
            "create_time": None,
            "create_uid": None,
            "deleted": None,
            "end_amount": 0,
            "end_id": None,
            "receipts_amount": 0,
            "receivable_amount": 0,
            "receivable_id": None,
            "receivable_type": "ADVANCE",
            "receivable_type_cn": "代垫费用",
            "should_amount": 0,
            "update_time": None,
            "update_uid": None
        }, {
            "balance_amount": 0,
            "create_time": None,
            "create_uid": None,
            "deleted": None,
            "end_amount": 0,
            "end_id": None,
            "receipts_amount": 0,
            "receivable_amount": 0,
            "receivable_id": None,
            "receivable_type": "LOAN_RENT",
            "receivable_type_cn": "分期租金",
            "should_amount": 0,
            "update_time": None,
            "update_uid": None
        }, {
            "balance_amount": 0,
            "create_time": None,
            "create_uid": None,
            "deleted": None,
            "end_amount": 0,
            "end_id": None,
            "receipts_amount": 0,
            "receivable_amount": 0,
            "receivable_id": None,
            "receivable_type": "LOAN_SERVER",
            "receivable_type_cn": "分期管家服务费",
            "should_amount": 0,
            "update_time": None,
            "update_uid": None
        }, {
            "balance_amount": 0,
            "create_time": None,
            "create_uid": None,
            "deleted": None,
            "end_amount": 0,
            "end_id": None,
            "receipts_amount": 0,
            "receivable_amount": 0,
            "receivable_id": None,
            "receivable_type": "LOAN_LIQUIDATED",
            "receivable_type_cn": "分期违约金",
            "should_amount": 0,
            "update_time": None,
            "update_uid": None
        }, {
            "balance_amount": 0,
            "create_time": None,
            "create_uid": None,
            "deleted": None,
            "end_amount": 0,
            "end_id": None,
            "receipts_amount": 0,
            "receivable_amount": 0,
            "receivable_id": None,
            "receivable_type": "LATE_FEE",
            "receivable_type_cn": "逾期费用",
            "should_amount": 0,
            "update_time": None,
            "update_uid": None
        }, {
            "balance_amount": 0,
            "create_time": None,
            "create_uid": None,
            "deleted": None,
            "end_amount": 0,
            "end_id": None,
            "receipts_amount": 0,
            "receivable_amount": 0,
            "receivable_id": None,
            "receivable_type": "CASH_RENT",
            "receivable_type_cn": "保证金",
            "should_amount": 0,
            "update_time": None,
            "update_uid": None
        }]
        endInfo['endBasicInfo']['contract_id'] = self.apartment_contract_id
        endInfo['endBasicInfo'][
            'end_contract_num'] = 'End-%s' % self.apartment_contract_num
        endInfo['endBasicInfo']['end_date'] = end_date
        endInfo['endBasicInfo']['end_reason'] = "HOUSE_PROBLEM"
        endInfo['endBasicInfo'][
            'end_type'] = "OWNER_DEFAULT" if not end_type else end_type
        endInfo['endBasicInfo']['end_type_detail'] = "CUSTOMER_BREAK_CONTRACT"
        endInfo['endBasicInfo']['house_contract_num'] = HouseContractInfo(
            self.house_contract_id).house_contract_num
        endInfo['endBasicInfo']['is_old_data'] = "N"
        endInfo['endBasicInfo']['payable_totle'] = 0
        endInfo['endBasicInfo']['receivable_date'] = time.strftime(
            '%Y-%m-%d %H:%M:%S')
        endInfo['imgList'] = [{
            "attachment_type": None,
            "img_id": endImg.id,
            "src": endImg.url
        }]
        receivable = 0
        for i in endInfo['apartmentContractEndReceivableList']:
            receivable = receivable + float(i['receivable_amount'])
        for j in endInfo['detailList']:
            receivable = receivable + float(
                j['payable_money'] if j['payable_money'] else 0)
        endInfo['liquidatedOrTurnFee'] = {
            "liquidated_receivable": receivable,
            "discount_liquidated_receivable": receivable,
            "liquidated_discount_scale": "100.00%",
            "turn_receivable": 0,
            "discount_turn_receivable": 0,
            "turn_discount_scale": 0,
            "liquidated_return": 0,
            "fileList": [],
            "discount_img_id": None,
            "discountImgList": [],
            "discount_img_src": None
        }
        endInfo['endBasicInfo']['receivable_total'] = str(receivable)
        endInfo['receiverInfo'] = {
            "contractEndPayerAgintType": "PAYER",
            "receipt_name": self.sign_name,
            "pay_object": "PERSONAL",
            "receipt_bank_no": "123456123465",
            "bank": "未知发卡银行",
            "receipt_bank_location": "海创支行"
        }
        if myRequest(url, endInfo):
            consoleLog('出租终止新增成功')
Exemplo n.º 7
0
    def resign(self, contract_num, apartment_type=None, entrust_type=None, sign_date=today(), owner_sign_date=today(),
               entrust_start_date=None, entrust_year=None, payment_cycle=None, fitment_start_date=None,
               fitment_end_date=None,
               rent_money=None):
        """续签"""

        def getcontractInfo():
            """获取合同续签信息"""
            url = "http://erp.ishangzu.com/isz_housecontract/houseContractController/searchHouseContractInfoBase?contract_type=RENEWSIGN&house_id=%s&parent_id=%s" % (
                self.house_id, self.house_contract_id)
            return myRequest(url, method='get')['obj']

        # 基础字段
        contract_type = 'RENEWSIGN'
        apartment_type = apartment_type if apartment_type else self.apartment_type  # 默认原合同的公寓类型
        entrust_type = entrust_type if entrust_type else self.entrust_type  # 默认原合同的出租方式
        # 品牌公寓的装修开始和结束都默认在原合同之后一天,服务公寓没有装修期
        # if apartment_type == 'BRAND':
        #     fitment_start_date = fitment_start_date if fitment_start_date else addDays(1, self.entrust_end_date)
        #     fitment_end_date = fitment_end_date if fitment_end_date else fitment_start_date
        # else:
        fitment_start_date = None
        fitment_end_date = None
        #  续签默认没有装修期
        entrust_start_date = entrust_start_date if entrust_start_date else (
            addDays(1, fitment_end_date) if fitment_end_date else addDays(1,
                                                                          self.entrust_end_date))  # 续签开始日期默认为装修期结束日后一天,没有装修期的话就是原合同到期日的后一天
        entrust_year = entrust_year if entrust_year else (
            self.entrust_year if self.entrust_year else 3)  # 委托年限默认原合同年限,原合同没有的话3年
        sign_date = addDays(-1, entrust_start_date)
        owner_sign_date = sign_date
        payment_cycle = payment_cycle if payment_cycle else self.payment_cycle  # 付款周期默认与原合同相同
        entrust_year_after = addDays(-1, addMonths(12 * int(entrust_year), entrust_start_date))
        entrust_end_date = addDays(free_date_par[payment_cycle] * int(entrust_year), entrust_year_after)  # 委托到期日
        rent_money = rent_money if rent_money else self.rental_price  # 委托金额默认与原合同相同
        first_pay_date = addMonthExDay(30, months=0, date=entrust_start_date)  # 付款日 默认委托下个月30号为第一次
        second_pay_date = addMonthExDay(30, months=2, date=entrust_start_date)  # 目前不影响第二次应付的时间,实际为第一次付款日加付款周期后的时间
        contractInfo = getcontractInfo()
        landlordInfo = self.landlord()
        contractPhotos = self.contractPhotos()
        houseContractFirst = contractInfo['houseContractFrist']  # 房源信息
        houseContractSecond = {
            'agreedRentOriginalStatements': [],
            'any_agent': '0',  # 有无代理人 (默认无代理人)
            'assetsOfLessor': [{
                'landlord_name': landlordInfo.landlord_name,
                'phone': landlordInfo.phone,
                'email': landlordInfo.email,
                'mailing_address': landlordInfo.mailing_address
            }],  # 资产出租人
            'contract_id': None,
            'houseContractSign': {
                'address': '',
                'agent_type': '',
                'attachments': [],
                'card_type': '',
                'email': '',
                'id_card': '',
                'phone': '',
                'sign_name': ''
            },
            'is_new_data': None,
            'originalAgentDataRelations': [],
            'originalLessorHasDied': []
        }  # 出租人
        houseContractThird = {
            'account_bank': self.account_bank,  # 收款行支行(默认)
            'account_name': self.account_name,  # 收款人姓名
            'account_num': self.account_num,  # 收款账号 (默认)
            'bank': self.bank,  # 收款银行 (默认)
            'contract_id': None,
            'is_new_data': None,
            'notPropertyOwnerGrantReceipts': [],
            'pay_object': self.pay_object,  # 收款账号类型 (默认个人)
            'payeeIdPhotos': [{
                'src': 'http://img.ishangzu.com/' + str(contractPhotos['payeeIdPhotos']['src']),  # 默认
                'url': 'http://img.ishangzu.com/' + str(contractPhotos['payeeIdPhotos']['src']),  # 默认
                'remark': '',
                'img_id': contractPhotos['payeeIdPhotos']['img_id']  # 默认
            }],  # 证件照片
            'payee_card_type': self.payee_card_type,  # 证件类型
            'payee_card_type_cn': '',
            'payee_emergency_name': landlordInfo.emergency_name,  # 紧急人姓名(默认)
            'payee_emergency_phone': landlordInfo.emergency_phone,  # 紧急人手机号码(默认)
            'payee_id_card': self.payee_id_card,  # 证件号
            'payee_type': self.payee_type,  # 收款人类型 (默认产权人)
            'payee_type_cn': ''
        }  # 收款人&紧急联系人
        rentStrategysData = {
            "apartment_type": apartment_type,
            "contract_type": contract_type,
            "entrust_start_date": entrust_start_date,
            "entrust_end_date": entrust_end_date,
            "free_end_date": "",
            "free_start_date": "",
            "parking": "",
            "payment_cycle": payment_cycle,
            "rent_money": str(rent_money),
            "sign_date": sign_date,
            "city_code": self.city_code,
            "entrust_year": entrust_year,
            "free_days": free_date_par[payment_cycle],
            "version": "V_TWO"}  # 传到合同信息中
        rentStrategys = self.getRentStrategys(rentStrategysData)  # 租金策略
        houseContractFour = {
            'apartment_type': apartment_type,  # 公寓类型
            'apartment_type_cn': '',
            'area_code': self.area_code,  # 城区
            'audit_status': None,
            'audit_time': None,
            'audit_uid': None,
            'building_id': self.building_id,
            'city_code': self.city_code,  # 城市
            'contractAttachments': [{
                "src": 'http://img.ishangzu.com/' + str(contractPhotos['contractAttachments']['src']),
                "url": 'http://img.ishangzu.com/' + str(contractPhotos['contractAttachments']['src']),
                "img_id": contractPhotos['contractAttachments']['img_id']
            }],
            'contract_id': None,
            'contract_num': contract_num,
            'contract_status': None,
            'contract_type': contract_type,
            'contract_type_cn': u'新签' if contract_type == 'NEWSIGN' else u'续签',
            'delay_date': None,  # 延长到期日
            "free_days": free_date_par[payment_cycle],
            'electron_file_src': None,
            'energy_company': None,
            "entrust_year": entrust_year,
            "entrust_year_cn": "",
            'energy_fee': None,
            'entrust_end_date': entrust_end_date,  # 委托到期日
            'entrust_start_date': entrust_start_date,  # 委托开始日期
            'entrust_type': entrust_type,  # 合同类型
            'entrust_type_cn': '',
            'first_pay_date': first_pay_date,  # 首次付款日
            'fitment_end_date': fitment_end_date,  # 装修到期日
            'fitment_start_date': fitment_start_date,  # 装修起算日
            'freeType_cn': '',
            'have_parking': 'Y',  # 是否有停车位 (默认有)
            'house_id': self.house_id,
            'housekeep_mange_dep': None,
            'housekeep_mange_dep_user': '******',
            'housekeep_mange_did': None,
            'housekeep_mange_uid': None,
            'housekeep_mange_user_name': None,
            'is_electron': None,
            'is_new_data': None,
            'owner_sign_date': owner_sign_date,  # 签约日期
            'parent_id': self.house_contract_id,
            'parking': "",  # 车位费(默认)
            'payment_cycle': payment_cycle,  # 付款方式
            'payment_cycle_cn': '',
            'property': None,
            'property_company': None,
            'reform_way': 'OLDRESTYLE' if apartment_type == 'BRAND' else 'UNRRESTYLE',  # 改造方式
            'reform_way_cn': '',
            'remark': None,
            'rentMoney': str(rent_money),  # 租金
            'rentStrategys': rentStrategys,
            'rental_price': str(float(rent_money)),  # 总租金
            'reset_finance': 'false',
            'residential_id': self.residential_id,
            'second_pay_date': second_pay_date,  # 第二次付款日
            'server_manage_dep_user': '',
            'server_manage_did': None,
            'server_manage_did_name': None,
            'server_manage_uid': None,
            'server_manage_uid_name': None,
            'service_fee_factor': 0.01,  # 年服务费 (默认)
            'sign_body': 'ISZPRO',  # 签约公司 (默认)
            'sign_date': sign_date,
            'sign_dep_name': userInfo['dep_name'],  # 签约部门
            'sign_did': userInfo['did'],
            'sign_uid': userInfo['uid'],
            'sign_user_name': userInfo['user_name'],  # 签约人
            'year_service_fee': None
        }  # 合同信息
        rentStrategysData = {
            "apartment_type": apartment_type,
            "contract_type": contract_type,
            "entrust_start_date": entrust_start_date,
            "entrust_end_date": entrust_end_date,
            "free_end_date": None,
            "free_start_date": None,
            "parking": None,
            "payment_cycle": payment_cycle,
            "rent_money": rent_money,
            "property": None,
            "energy_fee": None,
            "sign_date": sign_date,
            "city_code": self.city_code,
            "entrust_year": entrust_year,
            "free_days": free_date_par[payment_cycle],
            "version": "V_TWO"
        }
        rentStrategys = self.getRentStrategys(rentStrategysData)
        contractPayableData = {
            'contractId': None,
            'firstPayDate': first_pay_date,
            'secondPayDate': second_pay_date,
            'rentInfoList': rentStrategys,
            'version': 'V_TWO'
        }
        houseContractFive = self.createContractPayable(contractPayableData)
        houseContract = {
            'houseContractFrist': houseContractFirst,
            'houseContractSecond': houseContractSecond,
            'houseContractThird': houseContractThird,
            'houseContractFour': houseContractFour,
            'houseContractFive': houseContractFive
        }
        result = self.saveHouseContract(houseContract)
        if result:
            houseContractInfo = sqlbase.serach(
                "select contract_id from house_contract where house_id = '%s' and deleted = 0 and contract_type='RENEWSIGN' and contract_num='%s' order by create_time desc limit 1" %
                (self.house_id, contract_num))
            consoleLog('委托续签合同成功!')
            consoleLog('合同编号 : %s 合同ID : %s' % (contract_num, str(houseContractInfo[0])))
            return houseContractInfo[0]
def test_1070():
    """检测出租合同正常续签"""
    with Base() as base:
        apartment = interface.addHouseContractAndFitment(
            apartment_type='MANAGE',
            entrust_type='ENTIRE',
            sign_date=today(),
            owner_sign_date=today(),
            entrust_start_date=today(),
            entrust_end_date=addMonths(24),
            delay_date=addMonths(27),
            free_start_date=today(),
            free_end_date=addMonths(1),
            first_pay_date=today(),
            second_pay_date=addMonths(1),
            rent=2800,
            parking=120,
            year_service_fee=180,
            payment_cycle='MONTH')
        customer = interface.createCustomer()
        contractInfo = interface.createApartmentContract(
            apartement_id=apartment,
            customerInfo=customer,
            rent_price=5500,
            sign_date=today(),
            rent_start_date=today(),
            rent_end_date=addMonths(12),
            deposit=2500,
            payment_cycle='MONTH')
        base.open(
            page.apartmentContractPage,
            apartmentContractPage.searchContractMould['contract_num_loc'])
        base.click(
            apartmentContractPage.searchContractMould['entire_tab_button'])
        base.input_text(
            apartmentContractPage.searchContractMould['contract_num_loc'],
            contractInfo['contractNum'],
            index=1)
        base.click(apartmentContractPage.
                   searchContractMould['entire_search_button_loc'])
        base.staleness_of(
            apartmentContractPage.searchContractMould['entire_tr_contract'])
        interface.receipt('apartmentContract', contractInfo['contractID'])
        base.click(apartmentContractPage.searchContractMould['resign_loc'],
                   index=1)
        base.click(
            apartmentContractPage.addApartmentContractMould['deposit_manage'],
            index=0)
        contractNum = contractInfo['contractNum'] + 'xu'
        base.input_text(
            apartmentContractPage.
            addApartmentContractMould['contract_num_loc'], contractNum)
        base.type_date(apartmentContractPage.typeMould['sign_date'], today())
        base.type_date(apartmentContractPage.typeMould['rent_end_date2'],
                       addDays(-1, addMonths(24)))
        base.input_text(
            apartmentContractPage.addApartmentContractMould['deposit_loc'],
            2000)
        base.type_select(apartmentContractPage.typeMould['payment_type'],
                         'NORMAL')
        base.type_select(apartmentContractPage.typeMould['payment_cycle'],
                         'TOW_MONTH')
        base.script(
            "$('#contract_strategy_table > table > tbody > tr > td:nth-child(8) > input').click()"
        )
        base.type_date(
            apartmentContractPage.
            addApartmentContractMould['rent_strategy1_end_loc'],
            addDays(-1, addMonths(24)))
        base.click(
            apartmentContractPage.addApartmentContractMould['next_loc_1'])
        base.click(
            apartmentContractPage.addApartmentContractMould['next_loc_2'])
        base.click(
            apartmentContractPage.addApartmentContractMould['submit_loc'])
        base.check_submit()
        consoleLog(u'已成功续签承租合同 %s' % contractNum)
        time.sleep(10)
        achievementCount = sqlbase.get_count(
            "SELECT * from apartment_contract_achievement where contract_id = "
            "(SELECT contract_id from apartment_contract where contract_num = '%s' and deleted = 0)"
            % contractNum)
        receiptsCount = sqlbase.get_count(
            "SELECT * from apartment_contract_receipts where contract_id = "
            "(SELECT contract_id from apartment_contract where contract_num = '%s' and deleted = 0)"
            % contractNum)
        base.diffAssert(lambda t: asserts(achievementCount).is_not_zero(),
                        1070, u'续签后,没有生成出单业绩')
        base.diffAssert(lambda t: asserts(receiptsCount).is_not_zero(), 1070,
                        u'续签后,原合同押金没有转入新合同中')
def test_1070():
    """检测出租合同续签超过可续签日期"""
    with Base() as base:
        apartment = interface.addHouseContractAndFitment(
            apartment_type='MANAGE',
            entrust_type='ENTIRE',
            sign_date=today(),
            owner_sign_date=today(),
            entrust_start_date=today(),
            entrust_end_date=addMonths(24),
            delay_date=addMonths(27),
            free_start_date=today(),
            free_end_date=addMonths(1),
            first_pay_date=today(),
            second_pay_date=addMonths(1),
            rent=2800,
            parking=120,
            year_service_fee=180,
            payment_cycle='MONTH')
        customer = interface.createCustomer()
        contractInfo = interface.createApartmentContract(
            apartement_id=apartment,
            customerInfo=customer,
            rent_price=5500,
            sign_date=today(),
            rent_start_date=today(),
            rent_end_date=addMonths(12),
            deposit=2500,
            payment_cycle='MONTH')
        base.open(
            page.apartmentContractPage,
            apartmentContractPage.searchContractMould['contract_num_loc'])
        base.click(
            apartmentContractPage.searchContractMould['entire_tab_button'])
        base.input_text(
            apartmentContractPage.searchContractMould['contract_num_loc'],
            contractInfo['contractNum'],
            index=1)
        base.click(apartmentContractPage.
                   searchContractMould['entire_search_button_loc'])
        base.staleness_of(
            apartmentContractPage.searchContractMould['entire_tr_contract'])
        interface.receipt('apartmentContract', contractInfo['contractID'])
        base.click(apartmentContractPage.searchContractMould['resign_loc'],
                   index=1)
        base.click(
            apartmentContractPage.addApartmentContractMould['deposit_manage'],
            index=0)
        contractNum = contractInfo['contractNum'] + 'xu'
        base.input_text(
            apartmentContractPage.
            addApartmentContractMould['contract_num_loc'], contractNum)
        base.type_date(apartmentContractPage.typeMould['sign_date'], today())
        base.type_date(apartmentContractPage.typeMould['rent_end_date2'],
                       addDays(1, addMonths(27)))
        try:
            base.wait_element(apartmentContractPage.alertInfo)
        except TimeoutException:
            consoleLog(
                u'出租合同 %s 新签成功,续签承租到期日为 %s' %
                (contractInfo['contractNum'], addDays(1, addMonths(27))))
            base.diffAssert(lambda t: asserts('a').ends_with('b'), 1071,
                            u'续签出租合同,承租到期日超过委托合同实际到期日时,没有弹出超过时间的提示')