Пример #1
0
 def get_nameList(self, StartTime=nowtime, EndTime=nowtime, Name=None, IDCardNum=None, Mobile=None, Gender=None,
                  InterviewStatus=9999, RecordSize=10, RecordIndex=0,
                  FromBindStatus=-9999, SpEntName=None, RcrtTyp=-9999, agentname=None, ScannerMobile=None,
                  ScannerUserID=None, CheckType=None):
     """
     # 获取派遣端实接记录列表
     :param starttime: 面试日期前区间,可选,默认为当天日期
     :param endtime: 面试日期后区间,可选,默认为当天日期
     :param name: 会员名称,可选,默认为None
     :param idcardnum: 身份证号,可选,默认为None
     :param mobile: 手机号码,可选,默认为None
     :param Gender: 性别,可选,1 男,2 女,默认为None
     :param InterviewStatus:面试状态,可选,0:未处理,1:未面试,2:面试通过,3:面试不通过,4:放弃
     :param FromBindStatus:绑单状态,可选,1 未绑, 2 已绑
     :param SpEntName:企业名称,可选
     :param RcrtTyp:企业类型,可选,1 预支,2 返费
     :param agentname:来源名称,可选
     :param ScannerMobile:扫描人手机号码,可选
     :param ScannerUserID:扫描人guid,可选
     :return:
     """
     if agentname == None:
         FromSpId = None
     else:
         FromSpId = self.get_source(FromSpName=agentname)
     # 调用获取派遣端实接记录列表接口
     res = self.login.create_api(GetNameList,
                                 StartTime=StartTime,
                                 EndTime=EndTime,
                                 Name=Name,
                                 IDCardNum=IDCardNum,
                                 InterviewStatus=InterviewStatus,
                                 Gender=Gender,
                                 Mobile=Mobile,
                                 RcrtTyp=RcrtTyp,
                                 FromBindStatus=-FromBindStatus,
                                 ScannerMobile=ScannerMobile,
                                 ScannerUserID=ScannerUserID,
                                 CheckType=CheckType,
                                 RecordIndex=RecordIndex,
                                 RecordSize=RecordSize,
                                 SpEntName=SpEntName,
                                 FromSpId=FromSpId,
                                 SpIDs=[22699])
     res = res.json()
     self.getnamelists = res['Data']['RecordList']
     self.getnameidlist = get_api_result(res, 'NameID')
     self.getMobilelist = get_api_result(res, 'Mobile')
     self.getidcardlist = get_api_result(res, 'IDCardNum')
     self.getrealnamelist = get_api_result(res, 'Name')
     self.getentlist = get_api_result(res, 'EntShortName')
     # 打印日志
     # logger.info('查询名单,查询结果:{}'.format(res.json()))
     return res
    def get_bankcardlist(self,
                         auditsts=-9999,
                         idcardnum='',
                         phone='',
                         name='',
                         UploadTimeBegin=None,
                         UploadTimeEnd=None):
        """
        获取银行卡审核列表
        :param auditsts:审核状态,可选,默认全部,1 未审核,2 通过,3 未通过
        :param idcardnum:会员身份证号码,可选,默认空
        :param phone:会员手机号码,可选,默认空
        :param name:会员姓名,可选,默认空
        :return:        返回示例:
        {'Code': 0,
             'Data': {'NeedDesen': 0,
                      'RecordCount': 1,
                      'RecordList': [{'AliBucket': 'woda-app-private-test',
                                      'AreaName': '',
                                      'AuditBy': '',
                                      'AuditRemark': '',
                                      'AuditSts': 1,
                                      'AuditTm': '0000-00-00 00:00:00',
                                      'BankCardNum': '',
                                      'BankCardUrl': 'zxx/BankCard/tmp_u=108706899,646491533&fm=26&gp=0.jpg',
                                      'BankName': '',
                                      'CityName': '',
                                      'IdCardAuditSts': 2,
                                      'IdCardNum': '521953667811287984',
                                      'IdcardFrontUrl': '',
                                      'Mobile': '18654445366',
                                      'ProvinceName': '',
                                      'RealName': '同工',
                                      'UploadTime': '2020-04-06 14:20:39.519822',
                                      'UserBankCardAuditId': 5710,
                                      'UserIdcardAuditId': 0}],
                      'UnAuditRecordCount': 62},
             'Desc': '成功'}

        """
        # 调用获取银行卡审核列表接口
        res = self.login.create_api(BankCardInfoList_Api,
                                    SequenceUploadTime=1,
                                    RecordIndex=0,
                                    RecordSize=999,
                                    AuditSts=auditsts,
                                    IsUserDelete=-9999,
                                    Bank3keyAvlSts=-9999,
                                    Bank3keyCheckResult=-9999,
                                    IdCardNum=idcardnum,
                                    Mobile=phone,
                                    UploadTimeBegin=UploadTimeBegin,
                                    UploadTimeEnd=UploadTimeEnd,
                                    RealName=name)
        response = res.json()
        self.UserBankCardAuditId = get_api_result(response,
                                                  'UserBankCardAuditId')
        # pprint.pprint(response)
        # 返回response
        return response
Пример #3
0
    def compareResult(self, reality, expect):
        """比较测试结果"""
        # 初始化flag为None
        flag = None
        # 获取预期结果的key列表
        ex_keys = list(expect.keys())
        # 从ex_kyes遍历取值去res中查找实际结果
        result = []
        print("-" * 30 + "结果比较" + "-" * 30)

        for ex_key in ex_keys:
            # 获取实际结果
            real_value = get_api_result(reality, ex_key)
            # 判断预期结果值是否为列表,如果是,且实际结果返回值是列表,将实际结果值从列表中取出
            if not isinstance(expect[ex_key], list) and isinstance(
                    real_value, list):
                real_value = real_value[0]
            # 如果查询的实际结果和预期结果值相等,将flag置为true
            flag = real_value == expect[ex_key]

            print(
                f'    实际结果{ex_key}:{real_value}和预期结果{ex_key}:{expect[ex_key]}进行判断,结果为{flag}'
            )

            result.append(flag)
        print("-" * 30 + "结果比较" + "-" * 30)
        if False not in result:
            return True
        else:
            return False
Пример #4
0
 def get_labor(self, url, LaborName=None):
     """
     # 获取招聘、派遣端录名单时需要的去向
     :param url: 调用获取去向劳务的接口地址,必填
     :param LaborName: 去向劳务,可选,默认为空
     :return:
     """
     res = self.login.create_api(url).json()
     if url == get_labor:
         self.TargetSpId = int(get_api_result(res, 'SpId')[0])
         self.SpName = get_api_result(res, 'SpShortName')[0]
     else:
         # 企业不为空,获取企业列表
         laborlist = res['Data']['RecordList']
         # 遍历列表寻找指定名称的id,找到id后赋值给SpEntID,没找到传入的名称抛出异常
         for labor in laborlist:
             if labor['SpShortName'] == LaborName:
                 self.TargetSpId = labor['SpId']
                 self.SpName = LaborName
                 break
     return res
 def get_workcardlist(self,
                      auditsts=-9999,
                      idcardnum='',
                      phone='',
                      name='',
                      UploadTimeBegin=None,
                      UploadTimeEnd=None,
                      RecordSize=10,
                      RecordIndex=0):
     """
     返回值示例:
     {'Code': 0,
      'Data': {'NeedDesen': 0,
               'RecordCount': 5,
               'RecordList': [{'AuditBy': '张四风',
                               'AuditRemark': '',
                               'AuditSts': 2,
                               'AuditTm': '2020-04-02 17:21:51',
                               'EntFullName': '神达电脑科技有限公司',
                               'EntId': 476,
                               'EntShortName': '昆山昆达电脑',
                               'IdCardNum': '521953667811287984',
                               'IneterviewDate': '2020-03-25',
                               'InterViewEntId': 10082,
                               'InterViewEntShortNme': '岱哥标准',
                               'InterviewEntFullName': '贾岱的标准企业',
                               'Mobile': '18654445366',
                               'RealName': '同工',
                               'UploadTime': '2020-04-02 16:50:57.735982',
                               'UserWorkCardAuditId': 84128,
                               'WorkCardNo': '22',
                               'WorkCardUrl': 'zhjz/WorkCard/tmp_u=165670367,2479347840&fm=26&gp=0.jpg'}],
               'UnAuditRecordcount': 5},
      'Desc': '成功'}
     """
     # 调用获取工牌列表接口
     res = self.login.create_api(WorkCardInfoList_Api,
                                 SequenceUploadTime=2,
                                 RecordIndex=RecordIndex,
                                 RecordSize=RecordSize,
                                 EntId=-9999,
                                 AuditSts=auditsts,
                                 IdCardNum=idcardnum,
                                 Mobile=phone,
                                 UploadTimeBegin=UploadTimeBegin,
                                 UploadTimeEnd=UploadTimeEnd,
                                 RealName=name)
     response = res.json()
     self.UserWorkCardAuditId = get_api_result(response,
                                               'UserWorkCardAuditId')
     # pprint.pprint(response)
     # 返回response
     return response
 def get_idcardlist(self,
                    auditsts=-9999,
                    phone='',
                    name='',
                    IdCardNum=None,
                    RegTimeBegin=None,
                    RegTimeEnd=None):
     """
     获取身份证审核列表
     :param auditsts:审核状态,可选,默认全部,1 未审核,2 通过,3 未通过
     :param phone:会员手机号码,可选,默认空
     :param name:会员姓名,可选,默认空
     :return: 函数返回示例:
     {'Code': 0,
          'Data': {'NeedDesen': 0,
                   'RecordCount': 1,
                   'RecordList': [{'AuditBy': '',
                                   'AuditRemark': '',
                                   'AuditSts': 1,
                                   'AuditTm': '',
                                   'BankCardAuditSts': 0,
                                   'CreditScore': '',
                                   'Guid': 313721,
                                   'IdCardNum': '',
                                   'IdcardFrontUrl': 'zhjz/IDCard/tmp_idcard.jpg',
                                   'Mobile': '17256282601',
                                   'RealName': '',
                                   'RegTime': '2020-04-06 14:59:40.920248',
                                   'UserIdcardAuditId': 6027}],
                   'UnAuditRecordCount': 234},
          'Desc': '成功'}
     """
     # 调用获取身份证审核列表接口
     res = self.login.create_api(IDCardInfoList_Api,
                                 SequenceUploadTime=2,
                                 RecordIndex=0,
                                 RecordSize=999,
                                 AuditSts=auditsts,
                                 Mobile=phone,
                                 IdCardNum=IdCardNum,
                                 RegTimeBegin=RegTimeBegin,
                                 RegTimeEnd=RegTimeEnd,
                                 RealName=name)
     response = res.json()
     self.UserIdcardAuditId = get_api_result(response, 'UserIdcardAuditId')
     # pprint.pprint(res)
     # 返回response
     return response
Пример #7
0
    def month_import(self,
                     entname,
                     monthdate,
                     names,
                     idcadnums,
                     workcards,
                     realpay,
                     work_entry_date,
                     workhour,
                     workstatedate=None,
                     workstatus='在职',
                     remark=None,
                     salarytype=1):
        """
        # 月薪导入
        :param entname: 标准企业名称 必填
        :param monthdate: 所属月份,必填
        :param salarytype: 月薪导入类型,必填
        :param name: 会员名称,必填
        :param idcadnum: 会员身份证号码,必填
        :param workcard: 会员工牌,必填
        :param realpay: 实发工资,必填
        :param workdate: 会员入职日期,必填
        :param workstatus: 会员在职状态,选填,默认在职
        :param workhour: 出勤小时数,必填
        :return:
        """

        self.monthdate = monthdate
        # self.phone = send_user
        # 编辑可预支导入模板
        edit_exctwo(names=names,
                    idcards=idcadnums,
                    workcards=workcards,
                    realpay=realpay,
                    work_entry_date=work_entry_date,
                    workstatus=workstatus,
                    workhours=workhour,
                    workstatedate=workstatedate,
                    remark=remark)
        # 将目标导入阿里云
        alimport = AlImport(login=self.login)
        alimport.ali_import(myLocalFile=myLocalFile_month,
                            myObjectName=myObjectName_month,
                            bucketname='woda-app-public-test')
        # 获取标准企业id
        self.get_ent(entname=entname)
        # 导入预览
        req = self.login.create_api(MonthBillGen_ImportCheck,
                                    SheetName='Sheet1',
                                    BucketKey='woda-app-public-test',
                                    EnterpriseID=self.entid,
                                    FileName=myObjectName_month,
                                    Month=monthdate,
                                    SalaryType=1)

        BizID = req.json()['Data']['BizID']
        # 等待预览加载完毕
        while True:
            req = self.login.create_api(MonthBillGen_GetImportCheckResult,
                                        BizID=BizID,
                                        EnterpriseID=self.entid)
            time.sleep(2)
            if req.json()['Data']['State'] == 2:
                json_url = req.json()['Data']['ResultUrl']
                break
        json_res = requests.get(json_url)
        print('json_res', json_res)
        print(json_res.json())
        fileMd5 = json_res.json()['Data']['FileMd5']
        fileName = json_res.json()['Data']['FileName']

        # 获取来源id
        advance = AdvanceManage(self.login)
        res = advance.zxx_getNameList(StartDate=work_entry_date,
                                      EndDate=work_entry_date,
                                      IdCardNum=idcadnums[0])
        agentid = get_api_result(res, 'SrceSpId')[0]
        print('agentid', agentid)
        # 下载json

        # 提交保存
        req = self.login.create_api(MonthBillGen_GenerateBatchByBizID,
                                    ImportBizID=BizID,
                                    AgentID=agentid,
                                    EnterpriseID=self.entid,
                                    FileMd5=fileMd5,
                                    FileName=fileName,
                                    OPType=1,
                                    Month=self.monthdate,
                                    SalaryType=salarytype,
                                    GeneratePayroll=2,
                                    BucketKey='woda-app-public-test')
        bizid = req.json()['Data']['BizID']
        # 等待保存完毕
        while True:
            req = self.login.create_api(MonthBillGen_GetGenerateBatchResult,
                                        BizID=bizid,
                                        EnterpriseID=self.entid)
            time.sleep(2)
            if req.json()['Data']['State'] == 2:
                break
Пример #8
0
 def create_order_pq(self,
                     entbrorrowname,
                     ReceiverType=1,
                     SettlementTyp=None,
                     OrderTyp=2,
                     OrderChargeTyp=6,
                     OrderDt=nowtime,
                     BeginDt=nowtime,
                     EndDt='',
                     PriceUnit=None):
     """
     派遣端创建订单
     :param entbrorrowname: 企业,必选
     :param ReceiverType:订单发单类型,1 门店订单,2 供应商订单
     :param OrderTyp:订单类型 1 返费订单,2 周薪订单
     :param SettlementTyp: 订单结算方式 1:ZX结算方式 2:Z结算方式 3:ZA结算方式 4:ZX-A
     :param OrderChargeTyp:订单类型 默认6  5 一周收费5天 6 一周收费6天
     :param OrderDt:订单时间(报价日期)
     :param BeginDt:订单有效期限开始日期
     :param EndDt:订单有效期限结束日期
     :param PriceUnit:供应商订单参数,1 按天算服务费,2 按小时算服务费
     :return:
     """
     # 加载企业
     self.get_entbrorrow(entbrorrowname)
     if SettlementTyp:
         self.SettlementTyp = SettlementTyp
     # 会员相关费用
     OrderWeekFeeList = [{
         "BeginDt": BeginDt,
         'EndDt': EndDt,
         'TerminateTyp': 2,
         'AdvancePayAmt': 10000,
         'Remark': '工资说明',
         'AcpHourlyWorkAmt': 2000,
         'AcpLeavedHourlyWorkAmt': 2000,
         'HourlyWorkAmt': 2000,
         'LeavedHourlyWorkAmt': 2000
     }]
     # 中介费
     if PriceUnit == 2:  # 供应商政策按小时结算
         OrderAgencyFee = [{
             'AgentFee': 1000,
             'TerminateTyp': 2,
             'BeginDt': BeginDt,
             'EndDt': ''
         }]
     else:
         OrderAgencyFee = [{
             'MinDays': 1,
             'MaxDays': 0,
             'AgentFee': 1000,
             'TerminateTyp': 2,
             'BeginDt': BeginDt,
             'EndDt': ''
         }, {
             'DaysNoMoney': 7,
             'TerminateTyp': 2,
             'BeginDt': BeginDt,
             'EndDt': ''
         }]
     # 服务费
     OrderServiceFee = [{
         'PlatformSrvcFee': 0,
         'TerminateTyp': 2,
         'BeginDt': BeginDt,
         'EndDt': ''
     }]
     # 返费
     OrderReturnFee = [{
         'Days': 10,
         'FeeTyp': 3,
         'ReturnTyp': 2,
         'ReturnFee': 5000
     }, {
         'Days': 20,
         'FeeTyp': 3,
         'ReturnTyp': 1,
         'ReturnFee': 1000
     }]
     # 获取劳务ID、name
     res = self.login.create_api(get_vlabor).json()
     TargetSpId = int(get_api_result(res, 'SpId')[0])
     SpName = get_api_result(res, 'SpShortName')[0]
     # 调用接口创建订单
     res = self.login.create_api(CreateZXXNewOrder,
                                 OrderTyp=OrderTyp,
                                 HasReturnFee=0,
                                 SettlementTyp=SettlementTyp,
                                 EmploymentTyp=1,
                                 ReceiverType=ReceiverType,
                                 SpQuota=20,
                                 InsideRemark='企业政策',
                                 OrderDt=OrderDt,
                                 EntId=self.entbrorrowid,
                                 SpEntName=entbrorrowname,
                                 TrgtSpId=TargetSpId,
                                 TrgtSpName=SpName,
                                 OrderChargeTyp=OrderChargeTyp,
                                 OrderWeekFeeList=OrderWeekFeeList,
                                 OrderAgencyFee=OrderAgencyFee,
                                 OrderServiceFee=OrderServiceFee,
                                 OrderReturnFee=OrderReturnFee,
                                 Remark='供应商备注',
                                 PriceUnit=PriceUnit)
     self.orderid = res.json()['Data']
     return res.json()
Пример #9
0
    def create_order_pq_mult(self,
                             entbrorrowname,
                             HasReturnFee=0,
                             ReceiverType=2,
                             EmploymentTyp=1,
                             SettlementTyp=2,
                             OrderTyp=2,
                             OrderChargeTyp=None,
                             OrderDt=nowtime,
                             BeginDt=nowtime,
                             HasDiffPrice=0,
                             DiffPriceIssueDt=None,
                             AdditionalSubsidy=0,
                             SubsidyMoney=None,
                             EnjoyStart=None,
                             EnjoyEnd=None,
                             InWorkDay=None,
                             IssueDay=None,
                             EndDt='',
                             PriceUnit=None):
        """
        派遣端创建多模式订单
        :param entbrorrowname: 企业,必选
        :param HasReturnFee:是否有会员返费,0 无返费,1 劳务返费,2 平台返费
        :param ReceiverType:订单发单类型,1 门店订单,2 供应商订单
        :param EmploymentTyp: 用工方式,1 劳务用工,2 灵活用工
        :param OrderTyp:订单类型 1 返费订单,2 周薪订单
        :param SettlementTyp: 订单结算方式 1:ZX结算方式 2:Z结算方式 3:ZA结算方式 4:ZX-A
        :param OrderChargeTyp:订单类型 默认6  5 一周收费5天 6 一周收费6天
        :param OrderDt:订单时间(报价日期)
        :param BeginDt:订单有效期限开始日期
        :param EndDt:订单有效期限结束日期
        :param HasDiffPrice:是否有差价,1 无差价,2 有差价
        :param DiffPriceIssueDt:差价发放日期,限制整形
        :param AdditionalSubsidy:是否有补贴,0 无补贴,1 有补贴
        :param SubsidyMoney:补贴金额(元/小时) 限制整形
        :param EnjoyStart:享受周期开始时间
        :param EnjoyEnd:享受周期结束时间
        :param IssueDay:补贴发放会员的日期
        :param InWorkDay:补贴发放要求会员在职日期
        :param PriceUnit:供应商订单参数,1 按天算服务费,2 按小时算服务费
        :return:
        """
        # 加载企业
        self.get_entbrorrow(entbrorrowname)
        # 周薪天数
        orderChargeTyp = 6 if SettlementTyp in (1, 2) else OrderChargeTyp

        # 会员相关费用
        if SettlementTyp in (1, 2):
            OrderWeekFeeList = [{
                "BeginDt": BeginDt,
                'EndDt': EndDt,
                'TerminateTyp': 2,
                'AdvancePayAmt': 10000,
                'Remark': '工资说明',
                'AcpHourlyWorkAmt': 2000,
                'AcpLeavedHourlyWorkAmt': 2000,
                'HourlyWorkAmt': 2000,
                'LeavedHourlyWorkAmt': 2000
            }]
        elif SettlementTyp in (3, 6):
            OrderWeekFeeList = [{
                "BeginDt": BeginDt,
                'EndDt': EndDt,
                'TerminateTyp': 2,
                'Remark': '工资说明',
                'AcpHourlyWorkAmt': 2000,
                'AcpLeavedHourlyWorkAmt': 2000,
                'HourlyWorkAmt': 2000,
                'LeavedHourlyWorkAmt': 2000
            }]
        # 中介费
        if PriceUnit == 2:  # 供应商政策按小时结算
            OrderAgencyFee = [{
                'AgentFee': 1000,
                'TerminateTyp': 2,
                'BeginDt': BeginDt,
                'EndDt': ''
            }]
        else:
            OrderAgencyFee = [{
                'MinDays': 1,
                'MaxDays': 0,
                'AgentFee': 1000,
                'TerminateTyp': 2,
                'BeginDt': BeginDt,
                'EndDt': ''
            }, {
                'DaysNoMoney': 7,
                'TerminateTyp': 2,
                'BeginDt': BeginDt,
                'EndDt': ''
            }]
        # 服务费
        OrderServiceFee = [{
            'PlatformSrvcFee': 0,
            'TerminateTyp': 2,
            'BeginDt': BeginDt,
            'EndDt': ''
        }]
        # 返费
        if HasReturnFee:  # 有会员返费
            OrderReturnFee = [{
                'Days': 10,
                'FeeTyp': 3,
                'ReturnTyp': 2,
                'ReturnFee': 5000
            }, {
                'Days': 20,
                'FeeTyp': 3,
                'ReturnTyp': 1,
                'ReturnFee': 10000
            }, {
                'Days': 30,
                'FeeTyp': 3,
                'ReturnTyp': 3,
                'ReturnFee': 10000
            }]
        else:  # 无会员返费,只有供应商返费
            OrderReturnFee = [{
                'Days': 30,
                'FeeTyp': 3,
                'ReturnTyp': 3,
                'ReturnFee': 10000
            }]
        # 获取劳务ID、name
        res = self.login.create_api(get_vlabor).json()
        TargetSpId = int(get_api_result(res, 'SpId')[0])
        SpName = get_api_result(res, 'SpShortName')[0]
        # 调用接口创建订单
        res = self.login.create_api(add_order_mult,
                                    OrderTyp=OrderTyp,
                                    HasReturnFee=HasReturnFee,
                                    SettlementTyp=SettlementTyp,
                                    EmploymentTyp=EmploymentTyp,
                                    ReceiverType=ReceiverType,
                                    SpQuota=20,
                                    InsideRemark='企业政策',
                                    OrderDt=OrderDt,
                                    EntId=self.entbrorrowid,
                                    HasDiffPrice=HasDiffPrice,
                                    DiffPriceIssueDt=DiffPriceIssueDt,
                                    AdditionalSubsidy=AdditionalSubsidy,
                                    SubsidyMoney=SubsidyMoney,
                                    EnjoyStart=EnjoyStart,
                                    EnjoyEnd=EnjoyEnd,
                                    InWorkDay=InWorkDay,
                                    IssueDay=IssueDay,
                                    SpEntName=entbrorrowname,
                                    TrgtSpId=TargetSpId,
                                    TrgtSpName=SpName,
                                    OrderChargeTyp=orderChargeTyp,
                                    OrderWeekFeeList=OrderWeekFeeList,
                                    OrderAgencyFee=OrderAgencyFee,
                                    OrderServiceFee=OrderServiceFee,
                                    OrderReturnFee=OrderReturnFee,
                                    Remark='供应商备注',
                                    PriceUnit=PriceUnit)
        self.orderid = res.json()['Data']
        return res.json()