예제 #1
0
 def add_cars(self):
     header = HeaderDict().wuliuyun_header()
     url_add_cars = 'https://{0}/api/tms/car/createCar'.format(self.config['tms_api_host'])
     # photos = self.upload_photo()
     body_dict = {
         "carNo": self.config['CompanyCarNo'],  # 车牌号
         "carModel": self.config['CompanyCarModel'],  # 车型
         "carLength": self.config['CompanyCarLength'],  # 车长
         "carLoad": 8,  # 装载吨位
         "carAge": '',  # 车龄
         "photoDriverCard": '',  # 行驶证照片
         "photoCar": '',  # 车辆照片
         "buycarTime": '',  # 购车时间
         "carBrand": '',  # 车辆品牌,
         "partnerNo": self.config['partnerNo'],  # 物流公司标示,
         "accesCarMobile": ''  # 随车电话
     }
     try:
         response = HttpClient().post_json(url=url_add_cars, header_dict=header, body_dict=body_dict)
         self.logger.info('#####  请求header:{0}  #####'.format(response.request.headers))
         self.logger.info('#####  请求body:{0}  #####'.format(response.request.body))
         self.logger.info('#####  请求body:{0}  #####'.format(response.json()))
         return response
     except Exception as error:
         self.logger.info('####  发生错误:{0}  ####\t\t####  返回None  ####'.format(error))
         return None
예제 #2
0
 def upload_receipt(self):
     # 对运单进行回单上传操作
     waybillId = self.arrive_confirm()
     waybillId = str(waybillId)
     abnormal = 'Y'  # 是否有异常 Y:是、N:是
     damaged = 'Y'  # 是否有破损 Y:是、N:是
     losted = 'Y'  # 是否丢失 Y:是、N:是
     memo = '自动化测试--回单上传'  # 备注
     receipt_img = FileUtil.getProjectObsPath(
     ) + os.sep + 'config' + os.sep + 'image' + os.sep + 'receipt0.png'
     # receipt0 = PhotoFileFormat().format_photo(receipt_img)
     files = {
         "id": (None, waybillId),  # 运单id
         "abnormal": (None, abnormal),  # 是否有异常 Y:是、N:是
         "damaged": (None, damaged),  # 是否有破损 Y:是、N:是
         "losted": (None, losted),  # 是否丢失 Y:是、N:是
         "memo": (None, memo),  # 备注
         "type": (None, "S"),  # S:货主、C:司机
         "receipt_0": ("receipt.png", open(receipt_img,
                                           'rb'), 'image/png')  # 回单图片文件
     }
     self.head_dict.pop('content-type')
     response = HttpClient().post_multipart(url=self.url_upload_receipt,
                                            header_dict=self.head_dict,
                                            files=files)
     self.logger.info('回单上传请求: {0}'.format(response.request.headers))
     self.logger.info('回单上传返回结果: {0}'.format(response.json()))
예제 #3
0
 def arrive_confirm(self):
     # 对运单进行到达确认操作
     waybillId = self.confirmWayBill()
     body_dict = {
         'billId': waybillId  # 运单ID
     }
     response = HttpClient().post_json(url=self.url_arrive_waybill,
                                       body_dict=body_dict,
                                       header_dict=self.head_dict)
     self.logger.info('到达确认返回结果:{0}'.format(response.json()))
     return waybillId
예제 #4
0
 def confirmWayBill(self):
     # 创建运单并确认发车
     waybillId = self.saveWayBill().json()['content']['billId']
     body_dict = {
         'billId': waybillId  # 运单ID
     }
     response = HttpClient().post_json(url=self.url_confirm_waybill,
                                       body_dict=body_dict,
                                       header_dict=self.head_dict)
     self.logger.info('确认发车返回结果:{0}'.format(response.json()))
     return waybillId
예제 #5
0
 def cost_settings_select(self,
                          currentPage='1',
                          rows='1000',
                          sendCity='',
                          arriveCity='',
                          carType='',
                          carLength='',
                          carModel='',
                          projectId=''):
     '''收入成本参数配置列表查询'''
     try:
         payload = {
             'currentPage': currentPage,
             'rows': rows,
             'sendCity': sendCity,
             'arriveCity': arriveCity,
             'carType': carType,
             'carLength': carLength,
             'carModel': carModel,
             'projectId': projectId,
         }
         response = HttpClient().post_json(self.__costSettingsSelectApiUrl,
                                           payload, self.__head_dict)
         return response
     except Exception as e:
         Log().error('收入成本参数配置列表查询发生异常:{0}'.format(e))
         return None
 def payment_export(self, currentPage='', rows='', searchMode='', globalCondition='', sendCity='',
                     arriveCity='', carNo='', driverName='', applyDateFirst='1', applyDateLast='', carType='',
                     amountType='', approveDateFirst='', approveDateLast='', paySchedule='', isLoan=''):
     ''' 支付列表导出 '''
     try:
         payload = {
             'searchMode': searchMode,  # global:全部字段模糊查询 general:普通条件查询
             'currentPage': currentPage,  # 当前页
             'rows': rows,  # 行数
             'globalCondition': globalCondition,  # 全部字段模糊查询条件
             'sendCity': sendCity,  # 出发城市
             'arriveCity': arriveCity,  # 到达城市
             'carNo': carNo,  # 车牌号
             'driverName': driverName,  # 司机姓名
             'applyDateFirst': applyDateFirst,  # 用车日期查询开始
             'applyDateLast': applyDateLast,  # 用车日期查询截止
             'carType': carType,  # 用车性质
             'amountType': amountType,  # 运费类型,cash - 预付款、oilFee - 油卡金额、destAmt - 到付款、retAmt - 尾款
             'approveDateFirst': approveDateFirst,  # 支付审批日期开始
             'approveDateLast': approveDateLast,  # 支付审批日期截止
             'paySchedule': paySchedule,  # 支付进度,UNPAID - 未支付、SUCCESS - 已支付、PAYING - 支付中、FAIL - 支付失败
             'isLoan': isLoan  # 是否贷款,1 - 是,0 - 否
         }
         response = HttpClient().post_json(self.__paymentExportApiUrl,
                                           header_dict=self.__head_dict, param_dict=payload)
         return response
     except Exception as e:
         Log().error('支付列表导出接口调用异常:{0}'.format(e))
         return None
예제 #7
0
 def loan_create(self,
                 loanAmount='',
                 recipientName='',
                 recipientAccount='',
                 depositBank='',
                 remarks='',
                 demandLoanDate=''):
     '''创建大额贷款记录'''
     try:
         payload = {
             'loanAmount': loanAmount,  # 贷款金额,
             'loanCustomer': self.partnerNo,  # 贷款客户,
             'recipientName': recipientName,  # 收款户名,
             'recipientAccount': recipientAccount,  # 收款账号,
             'depositBank': depositBank,  # 开户行,
             'remarks': remarks,  # 备注信息,
             'partnerNo': self.partnerNo,  # 物流公司标识,
             'demandLoanDate': demandLoanDate,  # 需求放款日期,
         }
         response = HttpClient().post_json(self.__loanCreateApiUrl, payload,
                                           self.__head_dict)
         return response
     except Exception as e:
         Log().error('创建大额贷款记录发生异常:{0}'.format(e))
         return None
 def profit_report_select(self,
                          currentPage='1',
                          rows='10',
                          vagueSearch='',
                          carType='',
                          carLength='',
                          carModel='',
                          projectId='',
                          sendDateStart='',
                          sendDateEnd='',
                          sendCity='',
                          arriveCity=''):
     '''利润报表信息列表查询'''
     try:
         payload = {
             'currentPage': currentPage,
             'rows': rows,
             'vagueSearch': vagueSearch,  # 模糊查询
             'carType': carType,
             'carLength': carLength,
             'carModel': carModel,
             'projectId': projectId,
             'sendDateStart': sendDateStart,
             'sendDateEnd': sendDateEnd,
             'sendCity': sendCity,
             'arriveCity': arriveCity,
         }
         response = HttpClient().post_json(self.__profitReportSelectApiUrl,
                                           payload, self.__head_dict)
         return response
     except Exception:
         return None
예제 #9
0
    def user_update(self,
                    userId='',
                    roleId='',
                    name='',
                    userName='',
                    mobile='',
                    isLoginApp='',
                    projectId='',
                    carType=''):
        '''修改账号'''
        try:
            dataAuth = "{{'tableAuthList':[{{'name':'AppTransportCashModel','propAuthList':[{{'name':'projectId'," \
                       "'values':'{0}'}},{{'name':'carType','values':'{1}'}}]}},{{'name':'TmsProjectModel','propAuthList'" \
                       ":[{{'name':'projectId','values':'{1}'}}]}}]}}".format(projectId, carType)
            payload = {
                'partnerNo': self.partnerNo,
                'loginId': userId,
                'role': roleId,
                'name': name,
                'userName': userName,
                'mobile': mobile,
                'isLoginApp': isLoginApp,
                'dataAuth': dataAuth,
            }

            response = HttpClient().post_json(self.__userUpdateApiUrl, payload,
                                              self.__head_dict, payload)
            return response
        except Exception as e:
            Log().error('修改账号发生异常:{0}'.format(e))
            return None
예제 #10
0
 def my_driver_update(self,
                      driverId='',
                      mobile='',
                      name='',
                      idNo='',
                      photoDriverCard='',
                      frontIdCard='',
                      backIdCard=''):
     '''新增自有司机'''
     try:
         payload = {
             'driverId': driverId,
             'mobile': mobile,
             'name': name,
             'idNo': idNo,
             'photoDriverCard': photoDriverCard,
             'frontIdCard': frontIdCard,
             'backIdCard': backIdCard,
             'partnerNo': self.partnerNo,
         }
         response = HttpClient().post_json(self.__myDriverUpdateApiUrl,
                                           payload, self.__head_dict)
         return response
     except Exception as e:
         Log().error('新增自有司机发生异常:{0}'.format(e))
         return None
예제 #11
0
 def payment_single(self,
                    wayBillId,
                    paymentMethod=None,
                    amountType=None,
                    amount='',
                    password='',
                    verifiCode=''):
     try:
         payload = {
             'wayBillId': wayBillId,  # 运单ID,String,必填
             'paymentMethod':
             paymentMethod,  # 支付方式,int【贷款付商户=3】、【余额付司机=2】、【白条付司机=1】、【线下支付=4】
             'amountType': amountType,  # 预付款1,油卡2,到付款3,尾款4,总运费9
             'amount': amount,  # 实际支付金额,double
             'password': password,  # 使用线下支付时必填,其他不填;
             'verifiCode': verifiCode,  # 可能会有,非必填
         }
         response = HttpClient().post_json(self.__paymentSingleApiUrl,
                                           header_dict=self.__head_dict,
                                           body_dict=payload,
                                           param_dict=payload)
         return response
     except Exception as e:
         Log().error('单条支付接口调用异常:{0}'.format(e))
         return None
예제 #12
0
 def statement_export(self,
                      billType='',
                      applyDateFirst='',
                      applyDateLast='',
                      verificDateStart='',
                      verificDateEnd='',
                      sendCity='',
                      arriveCity='',
                      driver='',
                      project='',
                      supplier='',
                      verificStatus=''):
     '''客户/供应商对账单导出'''
     try:
         payload = {
             'billType': billType,  # 对账单类型,1-客户对账单;2-供应商对账单
             'applyDateFirst': applyDateFirst,
             'applyDateLast': applyDateLast,
             'verificDateStart': verificDateStart,
             'verificDateEnd': verificDateEnd,
             'sendCity': sendCity,
             'arriveCity': arriveCity,
             'driver': driver,
             'project': project,
             'supplier': supplier,
             'verificStatus': verificStatus,  #核销状态,非必填。0:未核销,1:已核销;非必填
         }
         response = HttpClient().post_form(self.__statementExportApiUrl,
                                           payload, self.__head_dict)
         return response
     except Exception as e:
         Log().error('客户/供应商对账单导出发生异常:{0}'.format(e))
         return None
예제 #13
0
 def driver_select_api(self,
                       currentPage='1',
                       rows='10',
                       mobile='',
                       name='',
                       carNo='',
                       recentLineStart='',
                       recentLineEnd=''):
     '''查询已关联的外请车'''
     self.logger.info('#####  {0}  #####'.format(__name__))
     try:
         payload = {
             'currentPage': currentPage,
             'rows': rows,
             'partnerNo': self.partnerNo,
             'name': name,
             'mobile': mobile,
             'carNo': carNo,
             'recentLineStart': recentLineStart,
             'recentLineEnd': recentLineEnd
         }
         response = HttpClient().get(self.__driverSelectApiUrl,
                                     self.__head_dict, payload)
         return response
     except Exception as e:
         Log().error('查询已关联的外请车发生异常:{0}'.format(e))
         return None
예제 #14
0
 def supplier_update(self,
                     supplierId,
                     name='',
                     type='',
                     contactPersonName='',
                     contactPersonMobile='',
                     contactPersonIdNo='',
                     contactPersonIdCardPhoto='',
                     businessLicencePhoto='',
                     businessPermitPhoto='',
                     taxRegistrationCertificatePhoto='',
                     contractPhoto=''):
     '''修改供应商信息'''
     try:
         payload = {
             'supplierId': supplierId,
             'name': name,
             'type': type,
             'contactPersonName': contactPersonName,
             'contactPersonMobile': contactPersonMobile,
             'contactPersonIdNo': contactPersonIdNo,
             'contactPersonIdCardPhoto': contactPersonIdCardPhoto,
             'businessLicencePhoto': businessLicencePhoto,
             'businessPermitPhoto': businessPermitPhoto,
             'taxRegistrationCertificatePhoto':
             taxRegistrationCertificatePhoto,
             'contractPhoto': contractPhoto,
         }
         response = HttpClient().post_json(self.__supplierUpdateApiUrl,
                                           payload, self.__head_dict)
         return response
     except Exception as e:
         Log().error('修改供应商信息发生异常:{0}'.format(e))
         return None
예제 #15
0
 def driver_confirm_api(self,
                        billId='',
                        totalAmt='',
                        preAmt='',
                        oilAmt='',
                        destAmt='',
                        lastAmt='',
                        receiverId=''):
     """ 司机确认发车 """
     self.logger.info('#####  {0}  #####'.format(__name__))
     try:
         receipt_0 = FileUtil.getProjectObsPath(
         ) + os.path.sep + 'image' + os.path.sep + 'logo.png'
         receipt_name_0 = os.path.basename(receipt_0)
         with open(receipt_0, 'rb') as receipt_0:
             photoAirWay = (receipt_name_0, receipt_0.read())
         payload = {
             'id': (None, str(billId)),
             'partnerNo': (None, str(self.partnerNo)),
             'totalAmt': (None, str(totalAmt)),
             'preAmt': (None, str(preAmt)),
             'oilAmt': (None, str(oilAmt)),
             'destAmt': (None, str(destAmt)),
             'lastAmt': (None, str(lastAmt)),
             'receiverId': (None, str(receiverId)),
             'photoAirWay': photoAirWay
         }
         response = HttpClient().post_multipart(
             url=self.__driverConfirmApiUrl,
             files=payload,
             header_dict=self.__head_dict)
         return response
     except Exception as e:
         self.logger.error('司机确认发车发生异常:{0}'.format(e))
         return None
예제 #16
0
 def count_amt_get(self,
                   countName,
                   applyDateFirst='',
                   applyDateLast='',
                   sendCity='',
                   arriveCity='',
                   carNo='',
                   driverName='',
                   isCanLoan='',
                   globalCondition='',
                   searchMode='searchMode:general'):
     try:
         payload = {
             'countName':
             countName,  # 需统计的金额:amtFee 总运费,cash 预付款,oilFee 油卡,destAmtConfirm 到付金额,retAmtConfirm 尾款金额
             'applyDateFirst': applyDateFirst,  # 用车日期查询开始
             'applyDateLast': applyDateLast,  # 用车日期查询截止
             'sendCity': sendCity,  # 出发城市
             'arriveCity': arriveCity,  # 到达城市
             'carNo': carNo,  # 车牌号
             'driverName': driverName,  # 司机姓名
             'isCanLoan': isCanLoan,  # 是否可贷款,1:可贷款,0:不可贷款
             'globalCondition': globalCondition,
             'searchMode': searchMode,
         }
         response = HttpClient().get(self.__countAmtGetApiUrl,
                                     self.__head_dict, payload)
         return response
     except Exception as e:
         Log().error('待支付合计金额统计值获取接口调用异常:{0}'.format(e))
         return None
예제 #17
0
 def outCar_price_report_export(self,
                                startDate='',
                                endDate='',
                                sendCity='',
                                arriveCity='',
                                carType='',
                                carLength='',
                                dataType=''):
     '''外请车价监控报表导出'''
     try:
         payload = {
             'startDate': startDate,
             'endDate': endDate,
             'sendCity': sendCity,
             'arriveCity': arriveCity,
             'carType': carType,
             'carLength': carLength,
             'dataType': dataType,
         }
         response = HttpClient().post_form(
             self.__outCarPriceReportExportApiUrl, payload,
             self.__head_dict)
         return response
     except Exception:
         return None
 def waybill_tracking_trajectory_export(self,
                                        normalCondition='',
                                        billStatus='',
                                        carNo='',
                                        sendCity='',
                                        arriveCity='',
                                        sendDateFirst='',
                                        sendDateLast=''):
     '''运单跟踪定位信息批量导出'''
     try:
         payload = {
             'normalCondition': normalCondition,
             'billStatus': billStatus,
             'carNo': carNo,
             'sendCity': sendCity,
             'arriveCity': arriveCity,
             'sendDateFirst': sendDateFirst,
             'sendDateLast': sendDateLast,
         }
         response = HttpClient().post_json(
             self.__wayBillTrackingTrajectoryCreateApiUrl, None,
             self.__head_dict, payload)
         return response
     except Exception as e:
         Log().error('添加跟踪备注信息发生异常:{0}'.format(e))
         return None
 def payment_receipt_select(self,
                            currentPage='1',
                            rows='10',
                            applyDateFirst='',
                            applyDateLast='',
                            sendCity='',
                            arriveCity='',
                            carNo='',
                            driverName='',
                            isCanLoan='',
                            globalCondition='',
                            searchMode='general'):
     try:
         payload = {
             'currentPage': currentPage,  # 当前页
             'rows': rows,  # 行数
             'applyDateFirst': applyDateFirst,  # 用车日期查询开始
             'applyDateLast': applyDateLast,  # 用车日期查询截止
             'sendCity': sendCity,  # 出发城市
             'arriveCity': arriveCity,  # 到达城市
             'carNo': carNo,  # 车牌号
             'driverName': driverName,  # 司机姓名
             'isCanLoan': isCanLoan,  # 是否可贷款,1:可贷款,0:不可贷款
             'globalCondition': globalCondition,  # 普通的查询条件
             'searchMode': searchMode,  # 查询方式,高级查询general,普通查询global
         }
         response = HttpClient().get(self.__paymentReceiptSelectApiUrl,
                                     self.__head_dict, payload)
         return response
     except Exception as e:
         Log().error('回单支付列表查询接口调用异常:{0}'.format(e))
         return None
 def outCar_price_report_select(self,
                                currentPage='1',
                                rows='10',
                                startDate='',
                                endDate='',
                                sendCity='',
                                arriveCity='',
                                carLength='',
                                dataType=''):
     '''外请车价监控报表查询'''
     try:
         payload = {
             'currentPage': currentPage,
             'rows': rows,
             'startDate': startDate,
             'endDate': endDate,
             'sendCity': sendCity,
             'arriveCity': arriveCity,
             'carLength': carLength,
             'dataType': dataType,
         }
         response = HttpClient().get(self.__outCarPriceReportSelectApiUrl,
                                     self.__head_dict, payload)
         return response
     except Exception:
         return None
예제 #21
0
 def line_update(self,
                 id='',
                 sendProvince='',
                 sendCity='',
                 arriveProvince='',
                 arriveCity='',
                 mileage='',
                 arriveTime='',
                 projectId=''):
     '''根据ID修改线路'''
     try:
         payload = {
             'id': id,
             'sendProvince': sendProvince,
             'sendCity': sendCity,
             'arriveProvince': arriveProvince,
             'arriveCity': arriveCity,
             'mileage': mileage,
             'arriveTime': arriveTime,
             'projectId': projectId,
         }
         response = HttpClient().post_json(self.__lineUpdateApiUrl, payload,
                                           self.__head_dict)
         return response
     except Exception as e:
         Log().error('根据ID修改线路发生异常:{0}'.format(e))
         return None
예제 #22
0
 def loan_amt_get(self):
      '''可借款金额统计'''
      try:
          response = HttpClient().get(self.__loanAmtGetApiUrl,self.__head_dict)
          return response
      except Exception as e:
          Log().error('可借款金额统计接口调用异常:{0}'.format(e))
          return None
 def wallet_withdraw_status_get(self):
     '''获取钱包提现状态'''
     try:
         response = HttpClient().get(self.__walletWithdrawApiUrl,
                                     self.__head_dict)
         return response
     except Exception:
         return None
 def approval_credit_total_amt_get(self):
     try:
         response = HttpClient().get(self.__approvalCreditTotalAmtGetApiUrl,
                                     self.__head_dict)
         return response
     except Exception as e:
         Log().error('获取今日授信中系统的金额接口调用异常:{0}'.format(e))
         return None
예제 #25
0
 def select_driver(self):
     header = HeaderDict().wuliuyun_header()
     url_select_driver = 'https://{0}/api/tms/driver/listDrivers'.format(self.config['tms_api_host'])
     param_dict = {
         'currentPage': 1,
         'rows': 10
     }
     try:
         response = HttpClient().get(url=url_select_driver, header_dict=header, param_dict=param_dict)
         self.logger.info('#####  请求header:{0}  #####'.format(response.request.headers))
         self.logger.info('#####  请求body:{0}  #####'.format(response.request.body))
         self.logger.info('#####  请求body:{0}  #####'.format(response.json()))
         driver_list = response.json()['content']['dataList']
         return driver_list
     except Exception as error:
         self.logger.info('####  发生错误:{0}  ####\t\t####  返回None  ####'.format(error))
         return None
 def approval_total_amt_get(self):
     try:
         response = HttpClient().get(self.__approvalTotalAmtGetApiUrl,
                                     self.__head_dict)
         return response
     except Exception as e:
         Log().error('到达支付列表接口调用异常:{0}'.format(e))
         return None
예제 #27
0
 def SMS_settings_get(self):
     '''获取短信设置'''
     try:
         response = HttpClient().get(self.__SMSSettingsGetApiUrl,
                                     self.__head_dict)
         return response
     except Exception as e:
         Log().error('获取短信设置发生异常:{0}'.format(e))
         return None
예제 #28
0
 def waybill_temp_template_download(self):
      '''下载批量开单excel模板'''
      try:
          payload = {}
          response = HttpClient().post_form(self.__wayBillTempTemplateDownloadApiUrl,payload,self.__head_dict)
          return response
      except Exception as e:
          Log().error('下载批量开单excel模板发生异常:{0}'.format(e))
          return None
예제 #29
0
 def menu_refresh(self):
     '''刷新全局菜单缓存'''
     try:
         response = HttpClient().get(self.__menuRefreshApiUrl,
                                     self.__head_dict)
         return response
     except Exception as e:
         Log().error('刷新全局菜单缓存发生异常:{0}'.format(e))
         return None
예제 #30
0
 def driver_select(self):
     '''用于录单时查询外请车'''
     try:
         response = HttpClient().get(self.__driverSelectApiUrl,
                                     self.__head_dict)
         return response
     except Exception as e:
         Log().error('用于录单时查询获所有外请车发生异常:{0}'.format(e))
         return None