This commit is contained in:
Kane Wang 2018-06-04 20:54:29 +08:00
parent 054ef9e65a
commit f137e7b19e
4 changed files with 286 additions and 241 deletions

View File

@ -167,9 +167,11 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<LibraryPath>D:\develop\sdk\cpp\Qt\qt_5.10.1\5.10.1\msvc2017_64\lib;$(LibraryPath)</LibraryPath> <LibraryPath>D:\develop\sdk\cpp\Qt\qt_5.10.1\5.10.1\msvc2017_64\lib;$(LibraryPath)</LibraryPath>
<IncludePath>$(QTDIR)\include;$(QTDIR)\include\QtCore;$(IncludePath)</IncludePath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IncludePath>$(QTDIR)\include;$(QTDIR)\include\QtCore;$(IncludePath)</IncludePath>
</PropertyGroup> </PropertyGroup>
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')"> <Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." /> <Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />

View File

@ -1,4 +1,3 @@
#include <SQLAPI.h> #include <SQLAPI.h>
#include <string> #include <string>
#include <sstream> #include <sstream>
@ -10,17 +9,17 @@
#include "StringCodeConverter.h" #include "StringCodeConverter.h"
#pragma comment( lib, "user32.lib") //#pragma comment( lib, "user32.lib")
#pragma comment( lib, "version.lib") //#pragma comment( lib, "version.lib")
#pragma comment( lib, "oleaut32.lib") //#pragma comment( lib, "oleaut32.lib")
#pragma comment( lib, "ole32.lib") //#pragma comment( lib, "ole32.lib")
#pragma comment( lib, "libxl.lib") //#pragma comment( lib, "libxl.lib")
#ifdef _DEBUG // #ifdef _DEBUG
#pragma comment( lib, "sqlapisd.lib") // #pragma comment( lib, "sqlapisd.lib")
#else // #else
#pragma comment( lib, "sqlapis.lib") // #pragma comment( lib, "sqlapis.lib")
#endif // #endif
const char g_cszConnectStringIDS6[] = const char g_cszConnectStringIDS6[] =
"DRIVER={};" "DRIVER={};"
@ -46,62 +45,61 @@ const static char g_cszConnstringYwgl[] =
const static char g_cszUserNameYwgl[] = "ccx99"; const static char g_cszUserNameYwgl[] = "ccx99";
const static char g_cszPasswordYwgl[] = "c92IT09"; const static char g_cszPasswordYwgl[] = "c92IT09";
void queryTelsalePolicyGifts( vector<TelSalePolicyGift> &giftList ) void queryTelsalePolicyGifts(vector<TelSalePolicyGift>& giftList)
{ {
SAConnection connection; SAConnection connection;
SACommand command; SACommand command;
string strSQL = "select id, trim(name), default_price from w_dx_gifts"; string strSQL = "select id, trim(name), default_price from w_dx_gifts";
command.setConnection( &connection ); command.setConnection(&connection);
command.setCommandText( strSQL.c_str() ); command.setCommandText(strSQL.c_str());
try try
{ {
connection.Connect( connection.Connect(g_cszConnstringYwgl,
g_cszConnstringYwgl,
g_cszUserNameYwgl, g_cszUserNameYwgl,
g_cszPasswordYwgl, g_cszPasswordYwgl,
SA_Informix_Client ); SA_Informix_Client);
command.Execute(); command.Execute();
} }
catch ( SAException &error ) catch (SAException& error)
{ {
throw runtime_error( error.ErrText() ); throw runtime_error(error.ErrText());
} }
while ( command.FetchNext() ) while (command.FetchNext())
{ {
TelSalePolicyGift gift; TelSalePolicyGift gift;
gift.Id( command.Field(1).asLong() ); gift.Id(command.Field(1).asLong());
gift.GiftName( (const char *)(command.Field(2).asString()) ); gift.GiftName((const char *)(command.Field(2).asString()));
gift.GiftDefaultPrice( (const char *)(command.Field(3).asString()) ); gift.GiftDefaultPrice((const char *)(command.Field(3).asString()));
giftList.push_back( gift ); giftList.push_back(gift);
} }
connection.Disconnect(); connection.Disconnect();
} }
void SaveTelSalePolicyInfo(const SPolicyRecord & policy, const vector<TelSalePolicyGift> & giftList) void SaveTelSalePolicyInfo(const SPolicyRecord& policy, const vector<TelSalePolicyGift>& giftList)
{ {
if ( policy.strPolicySerial.empty() == true ) if (policy.strPolicySerial.empty() == true)
{ {
throw invalid_argument( "保单号为空!" ); throw invalid_argument("保单号为空!");
} }
if ( policy.strSalerCode.empty() == true ) if (policy.strSalerCode.empty() == true)
{ {
throw invalid_argument( "保单号为空!" ); throw invalid_argument("保单号为空!");
} }
ostringstream ostrCommand; ostringstream ostrCommand;
string strAutotraderCall; string strAutotraderCall;
//车店联呼 //车店联呼
if ( policy.bIsAutotraderCall == true ) if (policy.bIsAutotraderCall == true)
{ {
strAutotraderCall = "1"; strAutotraderCall = "1";
} }
@ -110,7 +108,8 @@ void SaveTelSalePolicyInfo(const SPolicyRecord & policy, const vector<TelSalePol
strAutotraderCall = "0"; strAutotraderCall = "0";
} }
ostrCommand << "insert into w_dxbd_i ( jjbj, khjl, khjllx, bdh, zhjywy, zhjywymc, zhjywybm, zhjywybmm, kshdm, kshmc, czydm, czrq , chdlh, chshdm, chshmc, khmc, chph, chjh, fdjh ) " ostrCommand <<
"insert into w_dxbd_i ( jjbj, khjl, khjllx, bdh, zhjywy, zhjywymc, zhjywybm, zhjywybmm, kshdm, kshmc, czydm, czrq , chdlh, chshdm, chshmc, khmc, chph, chjh, fdjh ) "
"values( 1, 0, 0, " "values( 1, 0, 0, "
<< "trim('" << policy.strPolicySerial << "'), " << "trim('" << policy.strPolicySerial << "'), "
<< "trim('" << policy.strSalerCode << "'), " << "trim('" << policy.strSalerCode << "'), "
@ -123,7 +122,7 @@ void SaveTelSalePolicyInfo(const SPolicyRecord & policy, const vector<TelSalePol
<< "today, " << "today, "
<< "'" << strAutotraderCall << "'"; << "'" << strAutotraderCall << "'";
if ( policy.strAutoTraderCode.empty() == false ) if (policy.strAutoTraderCode.empty() == false)
{ {
ostrCommand << ", '" << policy.strAutoTraderCode << "'"; ostrCommand << ", '" << policy.strAutoTraderCode << "'";
ostrCommand << ", '" << policy.strAutoTraderName << "'"; ostrCommand << ", '" << policy.strAutoTraderName << "'";
@ -133,7 +132,7 @@ void SaveTelSalePolicyInfo(const SPolicyRecord & policy, const vector<TelSalePol
ostrCommand << ", NULL, NULL"; ostrCommand << ", NULL, NULL";
} }
if ( policy.strCustomerName.empty() == false ) if (policy.strCustomerName.empty() == false)
{ {
ostrCommand << ", '" << policy.strCustomerName << "'"; ostrCommand << ", '" << policy.strCustomerName << "'";
} }
@ -142,7 +141,7 @@ void SaveTelSalePolicyInfo(const SPolicyRecord & policy, const vector<TelSalePol
ostrCommand << ", NULL"; ostrCommand << ", NULL";
} }
if ( policy.strPlateSerial.empty() == false ) if (policy.strPlateSerial.empty() == false)
{ {
ostrCommand << ", '" << policy.strPlateSerial << "'"; ostrCommand << ", '" << policy.strPlateSerial << "'";
} }
@ -151,7 +150,7 @@ void SaveTelSalePolicyInfo(const SPolicyRecord & policy, const vector<TelSalePol
ostrCommand << ", NULL"; ostrCommand << ", NULL";
} }
if ( policy.strFrameSerial.empty() == false ) if (policy.strFrameSerial.empty() == false)
{ {
ostrCommand << ", '" << policy.strFrameSerial << "'"; ostrCommand << ", '" << policy.strFrameSerial << "'";
} }
@ -160,7 +159,7 @@ void SaveTelSalePolicyInfo(const SPolicyRecord & policy, const vector<TelSalePol
ostrCommand << ", NULL"; ostrCommand << ", NULL";
} }
if ( policy.strEngineSerial.empty() == false ) if (policy.strEngineSerial.empty() == false)
{ {
ostrCommand << ", '" << policy.strEngineSerial << "'"; ostrCommand << ", '" << policy.strEngineSerial << "'";
} }
@ -176,8 +175,8 @@ void SaveTelSalePolicyInfo(const SPolicyRecord & policy, const vector<TelSalePol
SAConnection conn; SAConnection conn;
SACommand command; SACommand command;
command.setConnection( &conn ); command.setConnection(&conn);
command.setCommandText( strCommand.c_str() ); command.setCommandText(strCommand.c_str());
try try
{ {
@ -185,46 +184,46 @@ void SaveTelSalePolicyInfo(const SPolicyRecord & policy, const vector<TelSalePol
g_cszConnstringYwgl, g_cszConnstringYwgl,
g_cszUserNameYwgl, g_cszUserNameYwgl,
g_cszPasswordYwgl, g_cszPasswordYwgl,
SA_Informix_Client ); SA_Informix_Client);
//conn.setAutoCommit( SA_AutoCommitOff ); //导致锁表 //conn.setAutoCommit( SA_AutoCommitOff ); //导致锁表
//保存保单 //保存保单
command.Execute(); command.Execute();
//保存礼品列表,先删除旧数据 //保存礼品列表,先删除旧数据
command.setCommandText( "delete w_dxbd_gift_i where bdh = :1 " ); command.setCommandText("delete w_dxbd_gift_i where bdh = :1 ");
command.Param( 1 ).setAsString() = policy.strPolicySerial.c_str(); command.Param(1).setAsString() = policy.strPolicySerial.c_str();
command.Execute(); command.Execute();
command.setCommandText( "insert into w_dxbd_gift_i ( bdh, gift_name, gift_price ) values ( :1, :2, :3 )" ); command.setCommandText("insert into w_dxbd_gift_i ( bdh, gift_name, gift_price ) values ( :1, :2, :3 )");
for ( vector<TelSalePolicyGift>::const_iterator iter = giftList.begin(); iter != giftList.end(); ++iter ) for (vector<TelSalePolicyGift>::const_iterator iter = giftList.begin(); iter != giftList.end(); ++iter)
{ {
command.Param( 1 ).setAsString() = policy.strPolicySerial.c_str(); command.Param(1).setAsString() = policy.strPolicySerial.c_str();
command.Param( 2 ).setAsString() = iter->GiftName().c_str(); command.Param(2).setAsString() = iter->GiftName().c_str();
command.Param( 3 ).setAsString() = iter->GiftDefaultPrice().c_str(); command.Param(3).setAsString() = iter->GiftDefaultPrice().c_str();
command.Execute(); command.Execute();
} }
conn.Commit(); conn.Commit();
} }
catch ( SAException &error ) catch (SAException& error)
{ {
conn.Rollback(); conn.Rollback();
conn.Disconnect(); conn.Disconnect();
throw runtime_error( error.ErrText() ); throw runtime_error(error.ErrText());
} }
conn.Disconnect(); conn.Disconnect();
} }
void QueryTelSalePolicyInfo( const string & strPolicyNo, void QueryTelSalePolicyInfo(const string& strPolicyNo,
const string & strOperatorCode, const string& strOperatorCode,
const string & strStartDate, const string& strStartDate,
const string & strEndDate, const string& strEndDate,
vector<SPolicyQuery> & vPolicyInfo ) vector<SPolicyQuery>& vPolicyInfo)
{ {
SACommand command; SACommand command;
SAConnection connection; SAConnection connection;
@ -235,48 +234,48 @@ void QueryTelSalePolicyInfo( const string & strPolicyNo,
" from w_dxbd_i " " from w_dxbd_i "
" where 1=1 "; " where 1=1 ";
if ( !strPolicyNo.empty() ) if (!strPolicyNo.empty())
{ {
strSQL.append( "and bdh = '" ); strSQL.append("and bdh = '");
strSQL.append( strPolicyNo ); strSQL.append(strPolicyNo);
strSQL.append( "' " ); strSQL.append("' ");
} }
if ( !strOperatorCode.empty() ) if (!strOperatorCode.empty())
{ {
strSQL.append( "and czydm = '" ); strSQL.append("and czydm = '");
strSQL.append( strOperatorCode ); strSQL.append(strOperatorCode);
strSQL.append( "' " ); strSQL.append("' ");
} }
if ( !strStartDate.empty() ) if (!strStartDate.empty())
{ {
strSQL.append( "and czrq >= '" ); strSQL.append("and czrq >= '");
strSQL.append( strStartDate ); strSQL.append(strStartDate);
strSQL.append( "' " ); strSQL.append("' ");
} }
if ( !strEndDate.empty() ) if (!strEndDate.empty())
{ {
strSQL.append( "and czrq <= '" ); strSQL.append("and czrq <= '");
strSQL.append( strEndDate ); strSQL.append(strEndDate);
strSQL.append( "' " ); strSQL.append("' ");
} }
try try
{ {
command.setCommandText( strSQL.c_str() ); command.setCommandText(strSQL.c_str());
command.setConnection( &connection ); command.setConnection(&connection);
connection.Connect( connection.Connect(
g_cszConnstringYwgl, g_cszConnstringYwgl,
g_cszUserNameYwgl, g_cszUserNameYwgl,
g_cszPasswordYwgl, g_cszPasswordYwgl,
SA_Informix_Client ); SA_Informix_Client);
command.Execute(); command.Execute();
while ( command.FetchNext() ) while (command.FetchNext())
{ {
policy.strPolicySerial = command.Field("bdh").asString(); policy.strPolicySerial = command.Field("bdh").asString();
policy.strSalerCode = command.Field("zhjywy").asString(); policy.strSalerCode = command.Field("zhjywy").asString();
@ -287,20 +286,20 @@ void QueryTelSalePolicyInfo( const string & strPolicyNo,
policy.strInputDate = command.Field("czrq").asString(); policy.strInputDate = command.Field("czrq").asString();
policy.strCDLH = command.Field("chdlh").asString(); policy.strCDLH = command.Field("chdlh").asString();
QueryPolicyGifts( policy.strPolicySerial, policy.strGifts, policy.dGiftPriceSum ); QueryPolicyGifts(policy.strPolicySerial, policy.strGifts, policy.dGiftPriceSum);
vPolicyInfo.push_back( policy ); vPolicyInfo.push_back(policy);
} }
connection.Disconnect(); connection.Disconnect();
} }
catch ( SAException & error ) catch (SAException& error)
{ {
throw runtime_error( error.ErrText() ); throw runtime_error(error.ErrText());
} }
} }
void QueryPolicyGifts(const string & strPolicyNo, string & strGifts, double dGiftPriceSum ) void QueryPolicyGifts(const string& strPolicyNo, string& strGifts, double dGiftPriceSum)
{ {
SAConnection connection; SAConnection connection;
SACommand command; SACommand command;
@ -317,30 +316,30 @@ void QueryPolicyGifts(const string & strPolicyNo, string & strGifts, double dGif
try try
{ {
command.setConnection( &connection ); command.setConnection(&connection);
command.setCommandText( strSQL.c_str() ); command.setCommandText(strSQL.c_str());
connection.Connect( g_cszConnstringYwgl, connection.Connect(g_cszConnstringYwgl,
g_cszUserNameYwgl, g_cszUserNameYwgl,
g_cszPasswordYwgl, g_cszPasswordYwgl,
SA_Informix_Client ); SA_Informix_Client);
command.Execute(); command.Execute();
strGifts.clear(); strGifts.clear();
dGiftPriceSum = 0.0; dGiftPriceSum = 0.0;
while ( command.FetchNext() ) while (command.FetchNext())
{ {
if ( !strGifts.empty() ) if (!strGifts.empty())
{ {
strGifts.append( "; " ); strGifts.append("; ");
} }
strGifts.append( command.Field("gift_name").asString() ); strGifts.append(command.Field("gift_name").asString());
strGifts.append( " " ); strGifts.append(" ");
strGifts.append( command.Field("gift_price").asString() ); strGifts.append(command.Field("gift_price").asString());
strGifts.append( "" ); strGifts.append("");
dGiftPriceSum += command.Field("gift_price").asDouble(); dGiftPriceSum += command.Field("gift_price").asDouble();
} }
@ -355,9 +354,9 @@ void QueryPolicyGifts(const string & strPolicyNo, string & strGifts, double dGif
connection.Disconnect(); connection.Disconnect();
} }
catch ( SAException & error ) catch (SAException& error)
{ {
throw runtime_error( error.ErrText() ); throw runtime_error(error.ErrText());
} }
} }
@ -451,29 +450,29 @@ void QueryPolicyGifts(const string & strPolicyNo, string & strGifts, double dGif
pBook->release(); pBook->release();
}*/ }*/
string readXlsCell(ISheetT<char> * pSheet, int iRowIndex, int iColIndex) string readXlsCell(ISheetT<char>* pSheet, int iRowIndex, int iColIndex)
{ {
string strCell; string strCell;
char szNum[40]; char szNum[40];
int iCell; int iCell;
if ( pSheet == NULL ) if (pSheet == NULL)
{ {
throw string(""); throw string("");
} }
CellType cellType = pSheet->cellType( iRowIndex, iColIndex ); CellType cellType = pSheet->cellType(iRowIndex, iColIndex);
switch( cellType ) switch (cellType)
{ {
case libxl::CELLTYPE_STRING: case libxl::CELLTYPE_STRING:
strCell = pSheet->readStr( iRowIndex, iColIndex ); strCell = pSheet->readStr(iRowIndex, iColIndex);
break; break;
case libxl::CELLTYPE_NUMBER: case libxl::CELLTYPE_NUMBER:
memset( szNum, NULL, 40 ); memset(szNum, NULL, 40);
iCell = pSheet->readNum( iRowIndex, iColIndex ); iCell = pSheet->readNum(iRowIndex, iColIndex);
sprintf( szNum, "%d", iCell ); sprintf_s(szNum, "%d", iCell);
strCell = szNum; strCell = szNum;
break; break;
@ -484,7 +483,7 @@ string readXlsCell(ISheetT<char> * pSheet, int iRowIndex, int iColIndex)
return strCell; return strCell;
} }
string readXlsxCell(ISheetT<wchar_t> * pSheet, int iRowIndex, int iColIndex) string readXlsxCell(ISheetT<wchar_t>* pSheet, int iRowIndex, int iColIndex)
{ {
wstring strCell; wstring strCell;
string strReturn; string strReturn;
@ -492,23 +491,23 @@ string readXlsxCell(ISheetT<wchar_t> * pSheet, int iRowIndex, int iColIndex)
char szNum[40]; char szNum[40];
int iCell; int iCell;
if ( pSheet == NULL ) if (pSheet == NULL)
{ {
throw string(""); throw string("");
} }
CellType cellType = pSheet->cellType( iRowIndex, iColIndex ); CellType cellType = pSheet->cellType(iRowIndex, iColIndex);
switch( cellType ) switch (cellType)
{ {
case libxl::CELLTYPE_STRING: case libxl::CELLTYPE_STRING:
strCell = pSheet->readStr( iRowIndex, iColIndex ); strCell = pSheet->readStr(iRowIndex, iColIndex);
break; break;
case libxl::CELLTYPE_NUMBER: case libxl::CELLTYPE_NUMBER:
memset( szNum, NULL, 40 ); memset(szNum, NULL, 40);
iCell = pSheet->readNum( iRowIndex, iColIndex ); iCell = pSheet->readNum(iRowIndex, iColIndex);
sprintf( szNum, "%d", iCell ); sprintf_s(szNum, "%d", iCell);
strReturn = szNum; strReturn = szNum;
break; break;
@ -516,15 +515,15 @@ string readXlsxCell(ISheetT<wchar_t> * pSheet, int iRowIndex, int iColIndex)
strReturn = ""; strReturn = "";
} }
StringCodeConverter::unicode2mbs( strCell, strReturn ); StringCodeConverter::unicode2mbs(strCell, strReturn);
return strReturn; return strReturn;
} }
void readTelsaleXlsxFile( const wstring & filePath, vector<SPolicyRecord> & listPolicy, bool hasTitle) void readTelsaleXlsxFile(const wstring& filePath, vector<SPolicyRecord>& listPolicy, bool hasTitle)
{ {
IBookT<wchar_t> * pBook = NULL; IBookT<wchar_t>* pBook = NULL;
ISheetT<wchar_t> * pSheet = NULL; ISheetT<wchar_t>* pSheet = NULL;
int iRowCount = 0; int iRowCount = 0;
int iRowIndex = 0; int iRowIndex = 0;
@ -532,51 +531,51 @@ void readTelsaleXlsxFile( const wstring & filePath, vector<SPolicyRecord> & list
pBook = xlCreateXMLBookW(); pBook = xlCreateXMLBookW();
if ( pBook == NULL ) if (pBook == NULL)
{ {
throw string(""); throw string("");
} }
if ( pBook->load( filePath.data() ) == false ) if (pBook->load(filePath.data()) == false)
{ {
throw string("打开文件失败!" ); throw string("打开文件失败!");
} }
pSheet = pBook->getSheet( 0 ); pSheet = pBook->getSheet(0);
if ( pSheet == NULL ) if (pSheet == NULL)
{ {
throw string( "读取sheet失败" ); throw string("读取sheet失败");
} }
iRowCount = pSheet->lastRow(); iRowCount = pSheet->lastRow();
if ( hasTitle == true ) if (hasTitle == true)
{ {
iRowIndex = 1; iRowIndex = 1;
} }
//读取数据 //读取数据
while ( iRowIndex < iRowCount ) while (iRowIndex < iRowCount)
{ {
SPolicyRecord policy; SPolicyRecord policy;
CellType type = pSheet->cellType( iRowIndex, 4 ); CellType type = pSheet->cellType(iRowIndex, 4);
policy.strSignDate = readXlsxCell( pSheet, iRowIndex, 0 ); policy.strSignDate = readXlsxCell(pSheet, iRowIndex, 0);
policy.strPolicySerial = readXlsxCell( pSheet, iRowIndex, 1 ); policy.strPolicySerial = readXlsxCell(pSheet, iRowIndex, 1);
policy.strPlateSerial = readXlsxCell( pSheet, iRowIndex, 2 ); policy.strPlateSerial = readXlsxCell(pSheet, iRowIndex, 2);
policy.strCustomerName = readXlsxCell( pSheet, iRowIndex, 3 ); policy.strCustomerName = readXlsxCell(pSheet, iRowIndex, 3);
policy.strSalerCode = readXlsxCell( pSheet, iRowIndex, 4 ); policy.strSalerCode = readXlsxCell(pSheet, iRowIndex, 4);
policy.strAutoTraderName = readXlsxCell( pSheet, iRowIndex, 6 ); policy.strAutoTraderName = readXlsxCell(pSheet, iRowIndex, 6);
//补齐工号 //补齐工号
if ( policy.strSalerCode.length() == 1 ) if (policy.strSalerCode.length() == 1)
{ {
policy.strSalerCode = string("00") + policy.strSalerCode; policy.strSalerCode = string("00") + policy.strSalerCode;
} }
if ( policy.strSalerCode.length() == 2 ) if (policy.strSalerCode.length() == 2)
{ {
policy.strSalerCode = string("0") + policy.strSalerCode; policy.strSalerCode = string("0") + policy.strSalerCode;
} }
@ -589,14 +588,12 @@ void readTelsaleXlsxFile( const wstring & filePath, vector<SPolicyRecord> & list
policy.strSalerDeptCode, policy.strSalerDeptCode,
policy.strSalerDeptName, policy.strSalerDeptName,
policy.strSalerOfficeCode, policy.strSalerOfficeCode,
policy.strSalerOfficeName ); policy.strSalerOfficeName);
listPolicy.push_back( policy ); listPolicy.push_back(policy);
iRowIndex++; iRowIndex++;
} }
pBook->release(); pBook->release();
} }

View File

@ -17,6 +17,7 @@
#include <libxl.h> #include <libxl.h>
#include <string> #include <string>
#include <QtCore/QString>
#include <vector> #include <vector>
#include <unordered_map> #include <unordered_map>
#include "SystemData.h" #include "SystemData.h"
@ -24,6 +25,7 @@
using namespace std; using namespace std;
using namespace libxl; using namespace libxl;
//准备废弃
typedef struct typedef struct
{ {
string strPolicySerial; string strPolicySerial;
@ -45,6 +47,29 @@ typedef struct
bool bIsAutotraderCall; bool bIsAutotraderCall;
} SPolicyRecord; } SPolicyRecord;
class PolicyRecord
{
private:
QString policySerial;
QString signDate;
QString salerCode;
QString salerName;
QString salerDeptCode;
QString salerDeptName;
QString salerOfficeCode;
QString salerOfficeName;
QString autoTraderCode;
QString autoTraderName;
QString customerName;
QString plateSerial;
QString frameSerial;
QString engineSerial;
QString operatorDate;
QString operatorCode;
bool isAutotraderCall;
};
//准备废弃
typedef struct typedef struct
{ {
string strPolicySerial; string strPolicySerial;
@ -62,8 +87,15 @@ typedef struct
class TelSalePolicyGift class TelSalePolicyGift
{ {
public: public:
TelSalePolicyGift() {}; TelSalePolicyGift()
TelSalePolicyGift( int id, string & name, string & defaultPrice ) : m_id( id ), m_giftName( name ), m_giftDefaultPrice( defaultPrice ) {} {
};
TelSalePolicyGift(int id, const string & name, const string & defaultPrice) : m_id(id),
m_giftName(name),
m_giftDefaultPrice(defaultPrice)
{
}
inline int Id() const { return m_id; } inline int Id() const { return m_id; }
void Id(int val) { m_id = val; } void Id(int val) { m_id = val; }
@ -81,7 +113,6 @@ private:
}; };
//************************************ //************************************
// Method: queryTelsalePolicyGifts // Method: queryTelsalePolicyGifts
// FullName: queryTelsalePolicyGifts // FullName: queryTelsalePolicyGifts
@ -90,7 +121,7 @@ private:
// Qualifier: 查询礼品信息 // Qualifier: 查询礼品信息
// Parameter: vector<TelSalePolicyGift> & giftList 礼品列表 // Parameter: vector<TelSalePolicyGift> & giftList 礼品列表
//************************************ //************************************
void queryTelsalePolicyGifts( vector<TelSalePolicyGift> &giftList ); void queryTelsalePolicyGifts(vector<TelSalePolicyGift> & giftList);
//************************************ //************************************
// Method: SaveTelSalePolicyInfo // Method: SaveTelSalePolicyInfo
@ -101,7 +132,7 @@ void queryTelsalePolicyGifts( vector<TelSalePolicyGift> &giftList );
// Parameter: const SPolicyRecord & policy // Parameter: const SPolicyRecord & policy
// Parameter: const vector<TelSalePolicyGift> & giftList // Parameter: const vector<TelSalePolicyGift> & giftList
//************************************ //************************************
void SaveTelSalePolicyInfo( const SPolicyRecord & policy, const vector<TelSalePolicyGift> & giftList ); void SaveTelSalePolicyInfo(const SPolicyRecord & policy, const vector<TelSalePolicyGift> & giftList);
//************************************ //************************************
// Method: QueryTelSalePolicyInfo // Method: QueryTelSalePolicyInfo
@ -115,11 +146,11 @@ void SaveTelSalePolicyInfo( const SPolicyRecord & policy, const vector<TelSalePo
// Parameter: const string & strEndDate // Parameter: const string & strEndDate
// Parameter: vector<SPolicyQuery> & vPolicyInfo // Parameter: vector<SPolicyQuery> & vPolicyInfo
//************************************ //************************************
void QueryTelSalePolicyInfo( const string & strPolicyNo, void QueryTelSalePolicyInfo(const string & strPolicyNo,
const string & strOperatorCode, const string & strOperatorCode,
const string & strStartDate, const string & strStartDate,
const string & strEndDate, const string & strEndDate,
vector<SPolicyQuery> & vPolicyInfo ); vector<SPolicyQuery> & vPolicyInfo);
//************************************ //************************************
// Method: QueryPolicyGifts // Method: QueryPolicyGifts
@ -130,15 +161,30 @@ void QueryTelSalePolicyInfo( const string & strPolicyNo,
// Parameter: const string & strPolicyNo // Parameter: const string & strPolicyNo
// Parameter: string & strGifts // Parameter: string & strGifts
//************************************ //************************************
void QueryPolicyGifts( const string & strPolicyNo, void QueryPolicyGifts(const string & strPolicyNo,
string & strGifts, string & strGifts,
double dGiftPriceSum ); double dGiftPriceSum);
//void readTelsaleXlsFile( const string & strFilePath, vector<SPolicyRecord> & listPolicy, bool hasTitle, bool isXML ); //void readTelsaleXlsFile( const string & strFilePath, vector<SPolicyRecord> & listPolicy, bool hasTitle, bool isXML );
void readTelsaleXlsxFile( const wstring & filePath, vector<SPolicyRecord> & listPolicy, bool hasTitle ); void readTelsaleXlsxFile(const wstring & filePath, vector<SPolicyRecord> & listPolicy, bool hasTitle);
string readXlsCell( ISheetT<char> * pSheet, int iRowIndex, int iColIndex ); /************************************************
string readXlsxCell( ISheetT<wchar_t> * pSheet, int iRowIndex, int iColIndex); * \brief xls文件的单元格内容std::string
* \param pSheet xls文件的sheet对象指针
* \param iRowIndex
* \param iColIndex
* \return std::string为载体
************************************************/
string readXlsCell(ISheetT<char> * pSheet, int iRowIndex, int iColIndex);
/************************************************
* \brief xlsx文件的单元格内容std::string
* \param pSheet xlsx文件的sheet对象指针
* \param iRowIndex
* \param iColIndex
* \return std::string为载体
************************************************/
string readXlsxCell(ISheetT<wchar_t> * pSheet, int iRowIndex, int iColIndex);
#endif // DataManipulation_h__ #endif // DataManipulation_h__