.....
This commit is contained in:
		@@ -7,17 +7,8 @@
 | 
			
		||||
using namespace std;
 | 
			
		||||
using namespace ocilib;
 | 
			
		||||
 | 
			
		||||
// void l_error_handler( OCI_Error * pError )
 | 
			
		||||
// {
 | 
			
		||||
// 	string errorString = OCI_ErrorGetString( pError );
 | 
			
		||||
//
 | 
			
		||||
// 	std::runtime_error error( OCI_ErrorGetString( pError ) );
 | 
			
		||||
//
 | 
			
		||||
// 	throw error;
 | 
			
		||||
// }
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
void ImportCarDealerAchievementToOracle( std::string                         userName,
 | 
			
		||||
void ImportCarDealerAchievementToOracleCpp( std::string                         userName,
 | 
			
		||||
                                            std::string                         password,
 | 
			
		||||
                                            std::string                         tnsName,
 | 
			
		||||
                                            std::vector<CarDealerAchievement> & achievementVector )
 | 
			
		||||
@@ -83,15 +74,15 @@ void ImportCarDealerAchievementToOracle( std::string                         use
 | 
			
		||||
			string pinganAmount       = QString( "%1" ).arg( iter->getPinganAmount() ).toStdString();
 | 
			
		||||
			string othersAmount       = QString( "%1" ).arg( iter->getOthersAmount() ).toStdString();
 | 
			
		||||
 | 
			
		||||
			pStmt->Bind<ostring>( ostring(":a_the_year"), ostring(QString::fromStdWString( iter->getTheYear() ).toStdString().c_str()), BindInfo::BindDirectionValues::In );
 | 
			
		||||
			pStmt->Bind<ostring>(ostring(":a_the_month"), ostring(QString::fromStdWString( iter->getTheMonth() ).toStdString().c_str()), BindInfo::BindDirectionValues::In );
 | 
			
		||||
			pStmt->Bind<ostring>(ostring(":a_car_dealer_code"), ostring(QString::fromStdWString( iter->getCarDealerCode() ).toStdString().c_str()), BindInfo::BindDirectionValues::In );
 | 
			
		||||
			pStmt->Bind<ostring>(ostring(":a_checked_achievement"), ostring(checkedAchievement.c_str()), BindInfo::BindDirectionValues::In );
 | 
			
		||||
			pStmt->Bind<ostring>(ostring(":a_policy_amount"), ostring(policyAmount.c_str()), BindInfo::BindDirectionValues::In );
 | 
			
		||||
			pStmt->Bind<ostring>(ostring(":a_cpic_amount"), ostring(cpicAmount), BindInfo::BindDirectionValues::In );
 | 
			
		||||
			pStmt->Bind<ostring>(ostring(":a_picc_amount"), ostring(piccAmount), BindInfo::BindDirectionValues::In );
 | 
			
		||||
			pStmt->Bind<ostring>(ostring(":a_pingan_amount"), ostring(pinganAmount), BindInfo::BindDirectionValues::In );
 | 
			
		||||
			pStmt->Bind<ostring>(ostring(":a_others_amount"), ostring(othersAmount), BindInfo::BindDirectionValues::In );
 | 
			
		||||
			pStmt->Bind<ostring, int>( ostring( ":a_the_year" ), ostring( QString::fromStdWString( iter->getTheYear() ).toStdString().c_str() ), 0, BindInfo::BindDirectionValues::In );
 | 
			
		||||
			pStmt->Bind<ostring, int>( ostring( ":a_the_month" ), ostring( QString::fromStdWString( iter->getTheMonth() ).toStdString().c_str() ), 0, BindInfo::BindDirectionValues::In );
 | 
			
		||||
			pStmt->Bind<ostring, int>( ostring( ":a_car_dealer_code" ), ostring( QString::fromStdWString( iter->getCarDealerCode() ).toStdString().c_str() ), 0, BindInfo::BindDirectionValues::In );
 | 
			
		||||
			pStmt->Bind<ostring, int>( ostring( ":a_checked_achievement" ), ostring( checkedAchievement.c_str() ), 0, BindInfo::BindDirectionValues::In );
 | 
			
		||||
			pStmt->Bind<ostring, int>( ostring( ":a_policy_amount" ), ostring( policyAmount.c_str() ), 0, BindInfo::BindDirectionValues::In );
 | 
			
		||||
			pStmt->Bind<ostring, int>( ostring( ":a_cpic_amount" ), ostring( cpicAmount ), 0, BindInfo::BindDirectionValues::In );
 | 
			
		||||
			pStmt->Bind<ostring, int>( ostring( ":a_picc_amount" ), ostring( piccAmount ), 0, BindInfo::BindDirectionValues::In );
 | 
			
		||||
			pStmt->Bind<ostring, int>( ostring( ":a_pingan_amount" ), ostring( pinganAmount ), 0, BindInfo::BindDirectionValues::In );
 | 
			
		||||
			pStmt->Bind<ostring, int>( ostring( ":a_others_amount" ), ostring( othersAmount ), 0, BindInfo::BindDirectionValues::In );
 | 
			
		||||
 | 
			
		||||
			pStmt->ExecutePrepared();
 | 
			
		||||
		}
 | 
			
		||||
@@ -108,8 +99,15 @@ void ImportCarDealerAchievementToOracle( std::string                         use
 | 
			
		||||
 | 
			
		||||
	Environment::Cleanup();
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/************************************************
 | 
			
		||||
* \brief 向oracle数据库写入车商业绩表
 | 
			
		||||
* \param userName oracle数据库用户名
 | 
			
		||||
* \param password oracle数据库密码
 | 
			
		||||
* \param tnsName oracle TNS名称
 | 
			
		||||
* \param orderVector 车商业绩表数据
 | 
			
		||||
************************************************/
 | 
			
		||||
void ImportCarDealerAchievementToOracle( std::string                         userName,
 | 
			
		||||
                                         std::string                         password,
 | 
			
		||||
                                         std::string                         tnsName,
 | 
			
		||||
@@ -166,7 +164,97 @@ void ImportCarDealerAchievementToOracle( std::string                         use
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/************************************************
 | 
			
		||||
* \brief 向oracle数据库写入车商方案表
 | 
			
		||||
* \param userName oracle数据库用户名
 | 
			
		||||
* \param password oracle数据库密码
 | 
			
		||||
* \param tnsName oracle TNS名称
 | 
			
		||||
* \param orderVector 车商方案表数据
 | 
			
		||||
************************************************/
 | 
			
		||||
void ImportCarDealerSchemeToOracle( std::string                    userName,
 | 
			
		||||
                                    std::string                    password,
 | 
			
		||||
                                    std::string                    tnsName,
 | 
			
		||||
                                    std::vector<CarDealerScheme> & schemeVector )
 | 
			
		||||
{
 | 
			
		||||
	//防御性验证
 | 
			
		||||
	if ( userName.empty() == true ||
 | 
			
		||||
	     password.empty() == true ||
 | 
			
		||||
	     tnsName.empty() == true ||
 | 
			
		||||
	     schemeVector.empty() == true )
 | 
			
		||||
	{
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	Connection * pConnection = nullptr;
 | 
			
		||||
	Statement *  pStatement  = nullptr;
 | 
			
		||||
 | 
			
		||||
	ostring sqlInsertScheme =
 | 
			
		||||
			"";
 | 
			
		||||
 | 
			
		||||
	//初始化
 | 
			
		||||
	try
 | 
			
		||||
	{
 | 
			
		||||
		Environment::Initialize();
 | 
			
		||||
	}
 | 
			
		||||
	catch ( exception & error )
 | 
			
		||||
	{
 | 
			
		||||
		QString errorMessage = "初始化ocilib失败!";
 | 
			
		||||
		errorMessage.append( QString::fromLocal8Bit( error.what() ) );
 | 
			
		||||
 | 
			
		||||
		throw runtime_error( errorMessage.toLocal8Bit() );
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	//
 | 
			
		||||
	try
 | 
			
		||||
	{
 | 
			
		||||
		pConnection = new Connection( tnsName, userName, password );
 | 
			
		||||
	}
 | 
			
		||||
	catch ( exception & error )
 | 
			
		||||
	{
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	//准备语句
 | 
			
		||||
	try
 | 
			
		||||
	{
 | 
			
		||||
		pStatement = new Statement( *pConnection );
 | 
			
		||||
 | 
			
		||||
		pStatement->Prepare( sqlInsertScheme );
 | 
			
		||||
		pStatement->AllowRebinding( true );
 | 
			
		||||
 | 
			
		||||
		for ( auto iterScheme = schemeVector.begin();
 | 
			
		||||
		      iterScheme != schemeVector.end();
 | 
			
		||||
		      ++iterScheme )
 | 
			
		||||
		{
 | 
			
		||||
			string theYear       = QString::fromStdWString( iterScheme->getTheYear() ).toLocal8Bit();
 | 
			
		||||
			string theMonth      = QString::fromStdWString( iterScheme->getTheMonth() ).toLocal8Bit();
 | 
			
		||||
			string carDealerCode = QString::fromStdWString( iterScheme->getCarDealerCode() ).toLocal8Bit();
 | 
			
		||||
			string manHourPrice  = QString::fromStdWString( iterScheme->getManHourPrice() ).toLocal8Bit();
 | 
			
		||||
			string partPrice     = QString::fromStdWString( iterScheme->getPartPrice() ).toLocal8Bit();
 | 
			
		||||
			string claimSupport  = QString::fromStdWString( iterScheme->getCarDealerCode() ).toLocal8Bit();
 | 
			
		||||
			string scheme        = QString::fromStdWString( iterScheme->getScheme() ).toLocal8Bit();
 | 
			
		||||
			string isQualified   = QString::fromStdWString( iterScheme->getIsQualified() ).toLocal8Bit();
 | 
			
		||||
 | 
			
		||||
			try
 | 
			
		||||
			{
 | 
			
		||||
			}
 | 
			
		||||
			catch ( exception & error )
 | 
			
		||||
			{
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	catch ( exception & erro )
 | 
			
		||||
	{
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/************************************************
 | 
			
		||||
* \brief 向oracle数据库写入送返修工单信息
 | 
			
		||||
* \param userName oracle数据库用户名
 | 
			
		||||
* \param password oracle数据库密码
 | 
			
		||||
* \param tnsName oracle TNS名称
 | 
			
		||||
* \param orderVector 送返修工单数据
 | 
			
		||||
************************************************/
 | 
			
		||||
void ImportRepairOrderToOracle( const std::string &              userName,
 | 
			
		||||
                                const std::string &              password,
 | 
			
		||||
                                const std::string &              tnsName,
 | 
			
		||||
@@ -193,7 +281,6 @@ void ImportRepairOrderToOracle( const std::string &              userName,
 | 
			
		||||
			"                                                          :a_is_success,\n"
 | 
			
		||||
			"                                                          :a_recommend_dealer_code,\n"
 | 
			
		||||
			"                                                          :a_recommend_dealer_name,\n"
 | 
			
		||||
			//"                                                          :a_recomm_dealer_code_in_notify,\n"
 | 
			
		||||
			"                                                          :a_recomm_dealer_name_in_notify,\n"
 | 
			
		||||
			"                                                          :a_recomm_dealer_name_in_survey,\n"
 | 
			
		||||
			"                                                          :a_agent_name,\n"
 | 
			
		||||
@@ -257,7 +344,6 @@ void ImportRepairOrderToOracle( const std::string &              userName,
 | 
			
		||||
			string isSuccess                         = QString::fromStdWString( iterOrder->getIsSuccess() ).toLocal8Bit();
 | 
			
		||||
			string recommandDealerCode               = QString::fromStdWString( iterOrder->getRecommandDealerCode() ).toLocal8Bit();
 | 
			
		||||
			string recommandDealerName               = QString::fromStdWString( iterOrder->getRecommandDealerName() ).toLocal8Bit();
 | 
			
		||||
			//string recommandDealerCodeInNotify       = QString::fromStdWString( iterOrder->getRecommandDealerCodeInNotify() ).toLocal8Bit();
 | 
			
		||||
			string recommandDealerCodeInNameInNotify = QString::fromStdWString( iterOrder->getRecommandDealerNameInNotify() ).toLocal8Bit();
 | 
			
		||||
			string recommandDealerCodeInSurvy        = QString::fromStdWString( iterOrder->getRecommandDealerNameInSurvey() ).toLocal8Bit();
 | 
			
		||||
			string agentName                         = QString::fromStdWString( iterOrder->getAgentName() ).toLocal8Bit();
 | 
			
		||||
@@ -282,7 +368,6 @@ void ImportRepairOrderToOracle( const std::string &              userName,
 | 
			
		||||
			OCI_BindString( pStmt, ":a_is_success", const_cast<otext*>(isSuccess.c_str()), 0 );
 | 
			
		||||
			OCI_BindString( pStmt, ":a_recommend_dealer_code", const_cast<otext*>(recommandDealerCode.c_str()), 0 );
 | 
			
		||||
			OCI_BindString( pStmt, ":a_recommend_dealer_name", const_cast<otext*>(recommandDealerName.c_str()), 0 );
 | 
			
		||||
			//OCI_BindString( pStmt, ":a_recomm_dealer_code_in_notify", const_cast<otext*>(recommandDealerCodeInNotify.c_str()), 0 );
 | 
			
		||||
			OCI_BindString( pStmt, ":a_recomm_dealer_name_in_notify", const_cast<otext*>(recommandDealerCodeInNameInNotify.c_str()), 0 );
 | 
			
		||||
			OCI_BindString( pStmt, ":a_recomm_dealer_name_in_survey", const_cast<otext*>(recommandDealerCodeInSurvy.c_str()), 0 );
 | 
			
		||||
			OCI_BindString( pStmt, ":a_agent_name", const_cast<otext*>(agentName.c_str()), 0 );
 | 
			
		||||
 
 | 
			
		||||
@@ -3,20 +3,42 @@
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <vector>
 | 
			
		||||
#include "../../Datastructure/CarDealerAchievement/CarDealerAchievement.h"
 | 
			
		||||
#include "../../Datastructure/CarDealerScheme/CarDealerScheme.h"
 | 
			
		||||
#include "../../Datastructure/RepairOrder/RepairOrder.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/************************************************
 | 
			
		||||
* \brief 向oracle数据库写入车商业绩表
 | 
			
		||||
* \param userName oracle数据库用户名
 | 
			
		||||
* \param password oracle数据库密码
 | 
			
		||||
* \param tnsName oracle TNS名称
 | 
			
		||||
* \param orderVector 车商业绩表数据
 | 
			
		||||
************************************************/
 | 
			
		||||
void ImportCarDealerAchievementToOracle( std::string                         userName,
 | 
			
		||||
                                         std::string                         password,
 | 
			
		||||
                                         std::string                         tnsName,
 | 
			
		||||
                                         std::vector<CarDealerAchievement> & achievementVector );
 | 
			
		||||
 | 
			
		||||
/************************************************
 | 
			
		||||
* \brief 向oracle数据库写入车商方案表
 | 
			
		||||
* \param userName oracle数据库用户名
 | 
			
		||||
* \param password oracle数据库密码
 | 
			
		||||
* \param tnsName oracle TNS名称
 | 
			
		||||
* \param orderVector 车商方案表数据
 | 
			
		||||
************************************************/
 | 
			
		||||
void ImportCarDealerSchemeToOracle( std::string                         userName,
 | 
			
		||||
                                    std::string                         password,
 | 
			
		||||
                                    std::string                         tnsName,
 | 
			
		||||
                                    std::vector<CarDealerScheme> & achievementVector );
 | 
			
		||||
 | 
			
		||||
/************************************************
 | 
			
		||||
* \brief 向oracle数据库写入送返修工单信息
 | 
			
		||||
* \param userName oracle数据库用户名  
 | 
			
		||||
* \param password oracle数据库密码
 | 
			
		||||
* \param tnsName oracle TNS名称
 | 
			
		||||
* \param orderVector 送返修工单数据
 | 
			
		||||
************************************************/
 | 
			
		||||
void ImportRepairOrderToOracle( const std::string &              userName,
 | 
			
		||||
                                const std::string &              password,
 | 
			
		||||
                                const std::string &              tnsName,
 | 
			
		||||
                                const std::vector<RepairOrder> & orderVector );
 | 
			
		||||
 | 
			
		||||
// void ImportRepairOrderToOracle( std::string userName,
 | 
			
		||||
//     std::string password,
 | 
			
		||||
//     std::string tnsName,
 | 
			
		||||
//     std::vector<>)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user