.....
This commit is contained in:
parent
5b19ff7aba
commit
4c5b5ee863
|
@ -7,20 +7,11 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ocilib;
|
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 ImportCarDealerAchievementToOracleCpp( std::string userName,
|
||||||
void ImportCarDealerAchievementToOracle( std::string userName,
|
std::string password,
|
||||||
std::string password,
|
std::string tnsName,
|
||||||
std::string tnsName,
|
std::vector<CarDealerAchievement> & achievementVector )
|
||||||
std::vector<CarDealerAchievement> & achievementVector )
|
|
||||||
{
|
{
|
||||||
ostring sqlImport =
|
ostring sqlImport =
|
||||||
"BEGIN "
|
"BEGIN "
|
||||||
|
@ -83,15 +74,15 @@ void ImportCarDealerAchievementToOracle( std::string use
|
||||||
string pinganAmount = QString( "%1" ).arg( iter->getPinganAmount() ).toStdString();
|
string pinganAmount = QString( "%1" ).arg( iter->getPinganAmount() ).toStdString();
|
||||||
string othersAmount = QString( "%1" ).arg( iter->getOthersAmount() ).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, int>( ostring( ":a_the_year" ), ostring( QString::fromStdWString( iter->getTheYear() ).toStdString().c_str() ), 0, BindInfo::BindDirectionValues::In );
|
||||||
pStmt->Bind<ostring>(ostring(":a_the_month"), ostring(QString::fromStdWString( iter->getTheMonth() ).toStdString().c_str()), 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>(ostring(":a_car_dealer_code"), ostring(QString::fromStdWString( iter->getCarDealerCode() ).toStdString().c_str()), 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>(ostring(":a_checked_achievement"), ostring(checkedAchievement.c_str()), BindInfo::BindDirectionValues::In );
|
pStmt->Bind<ostring, int>( ostring( ":a_checked_achievement" ), ostring( checkedAchievement.c_str() ), 0, BindInfo::BindDirectionValues::In );
|
||||||
pStmt->Bind<ostring>(ostring(":a_policy_amount"), ostring(policyAmount.c_str()), BindInfo::BindDirectionValues::In );
|
pStmt->Bind<ostring, int>( ostring( ":a_policy_amount" ), ostring( policyAmount.c_str() ), 0, BindInfo::BindDirectionValues::In );
|
||||||
pStmt->Bind<ostring>(ostring(":a_cpic_amount"), ostring(cpicAmount), BindInfo::BindDirectionValues::In );
|
pStmt->Bind<ostring, int>( ostring( ":a_cpic_amount" ), ostring( cpicAmount ), 0, BindInfo::BindDirectionValues::In );
|
||||||
pStmt->Bind<ostring>(ostring(":a_picc_amount"), ostring(piccAmount), BindInfo::BindDirectionValues::In );
|
pStmt->Bind<ostring, int>( ostring( ":a_picc_amount" ), ostring( piccAmount ), 0, BindInfo::BindDirectionValues::In );
|
||||||
pStmt->Bind<ostring>(ostring(":a_pingan_amount"), ostring(pinganAmount), BindInfo::BindDirectionValues::In );
|
pStmt->Bind<ostring, int>( ostring( ":a_pingan_amount" ), ostring( pinganAmount ), 0, BindInfo::BindDirectionValues::In );
|
||||||
pStmt->Bind<ostring>(ostring(":a_others_amount"), ostring(othersAmount), BindInfo::BindDirectionValues::In );
|
pStmt->Bind<ostring, int>( ostring( ":a_others_amount" ), ostring( othersAmount ), 0, BindInfo::BindDirectionValues::In );
|
||||||
|
|
||||||
pStmt->ExecutePrepared();
|
pStmt->ExecutePrepared();
|
||||||
}
|
}
|
||||||
|
@ -108,8 +99,15 @@ void ImportCarDealerAchievementToOracle( std::string use
|
||||||
|
|
||||||
Environment::Cleanup();
|
Environment::Cleanup();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************
|
||||||
|
* \brief 向oracle数据库写入车商业绩表
|
||||||
|
* \param userName oracle数据库用户名
|
||||||
|
* \param password oracle数据库密码
|
||||||
|
* \param tnsName oracle TNS名称
|
||||||
|
* \param orderVector 车商业绩表数据
|
||||||
|
************************************************/
|
||||||
void ImportCarDealerAchievementToOracle( std::string userName,
|
void ImportCarDealerAchievementToOracle( std::string userName,
|
||||||
std::string password,
|
std::string password,
|
||||||
std::string tnsName,
|
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,
|
void ImportRepairOrderToOracle( const std::string & userName,
|
||||||
const std::string & password,
|
const std::string & password,
|
||||||
const std::string & tnsName,
|
const std::string & tnsName,
|
||||||
|
@ -193,7 +281,6 @@ void ImportRepairOrderToOracle( const std::string & userName,
|
||||||
" :a_is_success,\n"
|
" :a_is_success,\n"
|
||||||
" :a_recommend_dealer_code,\n"
|
" :a_recommend_dealer_code,\n"
|
||||||
" :a_recommend_dealer_name,\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_notify,\n"
|
||||||
" :a_recomm_dealer_name_in_survey,\n"
|
" :a_recomm_dealer_name_in_survey,\n"
|
||||||
" :a_agent_name,\n"
|
" :a_agent_name,\n"
|
||||||
|
@ -242,22 +329,21 @@ void ImportRepairOrderToOracle( const std::string & userName,
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string branchName = QString::fromStdWString( iterOrder->getBranchName() ).toLocal8Bit();
|
string branchName = QString::fromStdWString( iterOrder->getBranchName() ).toLocal8Bit();
|
||||||
string orderNo = QString::fromStdWString( iterOrder->getOrderNo() ).toLocal8Bit();
|
string orderNo = QString::fromStdWString( iterOrder->getOrderNo() ).toLocal8Bit();
|
||||||
string orderType = QString::fromStdWString( iterOrder->getOrderType() ).toLocal8Bit();
|
string orderType = QString::fromStdWString( iterOrder->getOrderType() ).toLocal8Bit();
|
||||||
string notifyNo = QString::fromStdWString( iterOrder->getNotifyNo() ).toLocal8Bit();
|
string notifyNo = QString::fromStdWString( iterOrder->getNotifyNo() ).toLocal8Bit();
|
||||||
string damageArea = QString::fromStdWString( iterOrder->getDamageArea() ).toLocal8Bit();
|
string damageArea = QString::fromStdWString( iterOrder->getDamageArea() ).toLocal8Bit();
|
||||||
string damageDate = QString::fromStdWString( iterOrder->getDamageDate() ).toLocal8Bit();
|
string damageDate = QString::fromStdWString( iterOrder->getDamageDate() ).toLocal8Bit();
|
||||||
string genDate = QString::fromStdWString( iterOrder->getGeneratingDate() ).toLocal8Bit();
|
string genDate = QString::fromStdWString( iterOrder->getGeneratingDate() ).toLocal8Bit();
|
||||||
string policyNo = QString::fromStdWString( iterOrder->getPolicyNo() ).toLocal8Bit();
|
string policyNo = QString::fromStdWString( iterOrder->getPolicyNo() ).toLocal8Bit();
|
||||||
string policyNoJQX = QString::fromStdWString( iterOrder->getPolicyNoJqx() ).toLocal8Bit();
|
string policyNoJQX = QString::fromStdWString( iterOrder->getPolicyNoJqx() ).toLocal8Bit();
|
||||||
string plateNumber = QString::fromStdWString( iterOrder->getPlateNumber() ).toLocal8Bit();;
|
string plateNumber = QString::fromStdWString( iterOrder->getPlateNumber() ).toLocal8Bit();;
|
||||||
string brandName = QString::fromStdWString( iterOrder->getBrandName() ).toLocal8Bit();;
|
string brandName = QString::fromStdWString( iterOrder->getBrandName() ).toLocal8Bit();;
|
||||||
string isInsuranceObject = QString::fromStdWString( iterOrder->getIsInsuranceObject() ).toLocal8Bit();
|
string isInsuranceObject = QString::fromStdWString( iterOrder->getIsInsuranceObject() ).toLocal8Bit();
|
||||||
string isSuccess = QString::fromStdWString( iterOrder->getIsSuccess() ).toLocal8Bit();
|
string isSuccess = QString::fromStdWString( iterOrder->getIsSuccess() ).toLocal8Bit();
|
||||||
string recommandDealerCode = QString::fromStdWString( iterOrder->getRecommandDealerCode() ).toLocal8Bit();
|
string recommandDealerCode = QString::fromStdWString( iterOrder->getRecommandDealerCode() ).toLocal8Bit();
|
||||||
string recommandDealerName = QString::fromStdWString( iterOrder->getRecommandDealerName() ).toLocal8Bit();
|
string recommandDealerName = QString::fromStdWString( iterOrder->getRecommandDealerName() ).toLocal8Bit();
|
||||||
//string recommandDealerCodeInNotify = QString::fromStdWString( iterOrder->getRecommandDealerCodeInNotify() ).toLocal8Bit();
|
|
||||||
string recommandDealerCodeInNameInNotify = QString::fromStdWString( iterOrder->getRecommandDealerNameInNotify() ).toLocal8Bit();
|
string recommandDealerCodeInNameInNotify = QString::fromStdWString( iterOrder->getRecommandDealerNameInNotify() ).toLocal8Bit();
|
||||||
string recommandDealerCodeInSurvy = QString::fromStdWString( iterOrder->getRecommandDealerNameInSurvey() ).toLocal8Bit();
|
string recommandDealerCodeInSurvy = QString::fromStdWString( iterOrder->getRecommandDealerNameInSurvey() ).toLocal8Bit();
|
||||||
string agentName = QString::fromStdWString( iterOrder->getAgentName() ).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_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_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_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_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_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 );
|
OCI_BindString( pStmt, ":a_agent_name", const_cast<otext*>(agentName.c_str()), 0 );
|
||||||
|
|
|
@ -3,20 +3,42 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "../../Datastructure/CarDealerAchievement/CarDealerAchievement.h"
|
#include "../../Datastructure/CarDealerAchievement/CarDealerAchievement.h"
|
||||||
|
#include "../../Datastructure/CarDealerScheme/CarDealerScheme.h"
|
||||||
#include "../../Datastructure/RepairOrder/RepairOrder.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,
|
void ImportCarDealerAchievementToOracle( std::string userName,
|
||||||
std::string password,
|
std::string password,
|
||||||
std::string tnsName,
|
std::string tnsName,
|
||||||
std::vector<CarDealerAchievement> & achievementVector );
|
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,
|
void ImportRepairOrderToOracle( const std::string & userName,
|
||||||
const std::string & password,
|
const std::string & password,
|
||||||
const std::string & tnsName,
|
const std::string & tnsName,
|
||||||
const std::vector<RepairOrder> & orderVector );
|
const std::vector<RepairOrder> & orderVector );
|
||||||
|
|
||||||
// void ImportRepairOrderToOracle( std::string userName,
|
|
||||||
// std::string password,
|
|
||||||
// std::string tnsName,
|
|
||||||
// std::vector<>)
|
|
||||||
|
|
Loading…
Reference in New Issue