Exemple #1
0
	def executeSql(self,sql,file):
		try:
		   # 执行sql语句
		   sql = sql.replace("\\","")
		   self.cursor.execute(sql)
		   # 提交到数据库执行
		   id = int(self.db.insert_id()) 
		   self.db.commit()
		   return id
		except Exception,ex: 
		   # Rollback in case there is any error
		   loginfo = "%s-%s-%s" % (file.decode("gbk"),ex,sql)
		   logger.info(loginfo)
		   self.db.rollback()
		   return -1
Exemple #2
0
	def yidaitong(self):
		try:
			#上一个月的第一天
			lst_fist = datetime.date(datetime.datetime.now().year,datetime.datetime.now().month-1,1)
			#上一个月的最后一天
		 	lst_last = datetime.date(datetime.datetime.now().year,datetime.datetime.now().month,1)-datetime.timedelta(1)
			#获取所有上月存在利润贷款
			lst = str(lst_fist) + " 00:00:00"
			last = str(lst_last) + " 23:59:59"
			sql = "loan_due_date > '" + lst + "'"
			sc_bank_loans_main= SC_Bank_Loans_Main.query.filter(sql).all()
			logger.info("=======模拟利润更新========")
			for obj in sc_bank_loans_main:
				sc_loan_apply = SC_Loan_Apply.query.filter_by(id=obj.loan_apply_id).first()
				logger.info(sc_loan_apply.loan_type)
				if sc_loan_apply:
					if sc_loan_apply.loan_type=='2':
						#接口--模拟利润
						server = SOAPpy.SOAPProxy(WEBSERVICE_URL) 
						dd = server.mnlr(obj.loan_account,lst_last.strftime("%Y%m%d"))
						logger.info("sc_loan_apply:"+str(sc_loan_apply.id))
						data = json.loads(dd)
						self.return_examp(obj.loan_apply_id,data[0]["BYMNLR"])
		except:
			logger.exception('exception')