diff --git a/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/car_dealer_util.vcxproj b/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/car_dealer_util.vcxproj
index b19789d..078ba36 100644
--- a/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/car_dealer_util.vcxproj
+++ b/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/car_dealer_util.vcxproj
@@ -21,6 +21,7 @@
+
@@ -40,6 +41,7 @@
+
diff --git a/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/car_dealer_util.vcxproj.filters b/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/car_dealer_util.vcxproj.filters
index 8b33381..6e1549b 100644
--- a/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/car_dealer_util.vcxproj.filters
+++ b/代码/cpp/car_dealer_util/proj/vs2019/car_dealer_util/car_dealer_util.vcxproj.filters
@@ -56,6 +56,9 @@
{61d5dd61-6b1f-4507-bb22-4ce463ad5b85}
+
+ {985188c7-d233-46c8-bc1f-f7079c27bb2e}
+
@@ -82,6 +85,9 @@
excel
+
+ 数据\数据结构\送返修工单
+
@@ -127,5 +133,8 @@
excel
+
+ 数据\数据结构\送返修工单
+
\ No newline at end of file
diff --git a/代码/cpp/car_dealer_util/source/Data/DataManipulation/Excel/LoadFromExcel.cpp b/代码/cpp/car_dealer_util/source/Data/DataManipulation/Excel/LoadFromExcel.cpp
index 3bea9bc..5740ab5 100644
--- a/代码/cpp/car_dealer_util/source/Data/DataManipulation/Excel/LoadFromExcel.cpp
+++ b/代码/cpp/car_dealer_util/source/Data/DataManipulation/Excel/LoadFromExcel.cpp
@@ -66,6 +66,14 @@ void LoadCarDealerSchemeFromXlsx( const wstring & filePath,
const wstring && scheme = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex + 7, true );
const wstring && isQualified = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex + 8, true );
+ //空行跳过
+ if (carDealerCode.empty() == true)
+ {
+ rowIndex++;
+
+ continue;
+ }
+
CarDealerScheme carDealerScheme( theYear,
theMonth,
carDealerCode,
@@ -82,3 +90,182 @@ void LoadCarDealerSchemeFromXlsx( const wstring & filePath,
pBook->release();
}
+
+void LoadCarDealerAchievementFromXlsx( const std::wstring & filePath,
+ unsigned sheetIndex,
+ unsigned startRowIndex,
+ std::vector & achievementVector )
+{
+ Book * pBook = xlCreateXMLBookW();
+ Sheet * pSheet = nullptr;
+
+ if ( pBook == nullptr )
+ {
+ throw runtime_error( "libxl库加载失败!" );
+ }
+
+ setKey( pBook );
+
+ if ( pBook->load( filePath.c_str() ) != true )
+ {
+ string errorMessage = "打开文件失败!";
+ errorMessage.append( pBook->errorMessage() );
+
+ throw runtime_error( errorMessage );
+ }
+
+ pSheet = pBook->getSheet( sheetIndex );
+
+ if ( pSheet == nullptr )
+ {
+ string errorMessage = "读取sheet失败!";
+ errorMessage.append( pBook->errorMessage() );
+
+ pBook->release();
+
+ throw runtime_error( errorMessage );
+ }
+
+ int lastRowIndex = pSheet->lastRow();
+ int firstRowIndex = pSheet->firstRow();
+ int firstColumnIndex = pSheet->firstCol();
+ int rowIndex = firstRowIndex + startRowIndex;
+
+ while ( rowIndex <= lastRowIndex )
+ {
+ int colunmIndex = firstRowIndex;
+
+ const wstring && theYear = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex, true );
+ const wstring && theMonth = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex + 1, true );
+ const wstring && carDealerCode = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex + 2, true );
+ const wstring && carDealerName = ReadCellStringFromXlsx( pBook, sheetIndex, rowIndex, colunmIndex + 3, true );
+ long double checkedAchievement = 0;
+ int policyAmount = 0;
+ int cpicAmount = 0;
+ int piccAmount = 0;
+ int pinganAmount = 0;
+ int othersAmount = 0;
+
+ //空行跳过
+ if ( carDealerCode.empty() == true )
+ {
+ rowIndex++;
+
+ continue;
+ }
+
+ //每个字段都要先判断数据类型再读写,防止填写表格的人填错内容。
+ CellType type = pSheet->cellType( rowIndex, firstColumnIndex + 4 );
+ char errorMessage[1000];
+
+ //产值
+ if ( type == CELLTYPE_NUMBER )
+ {
+ checkedAchievement = pSheet->readNum( rowIndex, firstColumnIndex + 4 );
+ }
+ else
+ {
+ pBook->release();
+
+ sprintf( errorMessage, "第%d行第%d列,格式错误,不是数字类型!", rowIndex, firstColumnIndex + 4 );
+
+ throw runtime_error( errorMessage );
+ }
+
+ //签单数量
+ type = pSheet->cellType( rowIndex, firstColumnIndex + 5 );
+
+ if ( type == CELLTYPE_NUMBER )
+ {
+ policyAmount = static_cast(pSheet->readNum( rowIndex, firstColumnIndex + 5 ));
+ }
+ else
+ {
+ pBook->release();
+
+ sprintf( errorMessage, "第%d行第%d列,格式错误,不是数字类型!", rowIndex, firstColumnIndex + 5 );
+
+ throw runtime_error( errorMessage );
+ }
+
+ //太平洋保险新车签单台次
+ type = pSheet->cellType( rowIndex, firstColumnIndex + 6 );
+
+ if ( type == CELLTYPE_NUMBER )
+ {
+ cpicAmount = static_cast(pSheet->readNum( rowIndex, firstColumnIndex + 6 ));
+ }
+ else
+ {
+ pBook->release();
+
+ sprintf( errorMessage, "第%d行第%d列,格式错误,不是数字类型!", rowIndex, firstColumnIndex + 6 );
+
+ throw runtime_error( errorMessage );
+ }
+
+ //中国人保新车签单台次
+ type = pSheet->cellType( rowIndex, firstColumnIndex + 7 );
+
+ if ( type == CELLTYPE_NUMBER )
+ {
+ piccAmount = static_cast(pSheet->readNum( rowIndex, firstColumnIndex + 7 ));
+ }
+ else
+ {
+ pBook->release();
+
+ sprintf( errorMessage, "第%d行第%d列,格式错误,不是数字类型!", rowIndex, firstColumnIndex + 7 );
+
+ throw runtime_error( errorMessage );
+ }
+
+ //中国平安新车签单台次
+ type = pSheet->cellType( rowIndex, firstColumnIndex + 8 );
+
+ if ( type == CELLTYPE_NUMBER )
+ {
+ pinganAmount = static_cast(pSheet->readNum( rowIndex, firstColumnIndex + 8 ));
+ }
+ else
+ {
+ pBook->release();
+
+ sprintf( errorMessage, "第%d行第%d列,格式错误,不是数字类型!", rowIndex, firstColumnIndex + 8 );
+
+ throw runtime_error( errorMessage );
+ }
+
+ //其他保险公司新车签单台次
+ type = pSheet->cellType( rowIndex, firstColumnIndex + 9 );
+
+ if ( type == CELLTYPE_NUMBER )
+ {
+ othersAmount = static_cast(pSheet->readNum( rowIndex, firstColumnIndex + 9 ));
+ }
+ else
+ {
+ pBook->release();
+
+ sprintf( errorMessage, "第%d行第%d列,格式错误,不是数字类型!", rowIndex, firstColumnIndex + 9 );
+
+ throw runtime_error( errorMessage );
+ }
+
+ CarDealerAchievement achievement( theYear,
+ theMonth,
+ carDealerCode,
+ checkedAchievement,
+ policyAmount,
+ cpicAmount,
+ piccAmount,
+ pinganAmount,
+ othersAmount );
+
+ achievementVector.push_back( achievement );
+
+ rowIndex++;
+ }
+
+ pBook->release();
+}
diff --git a/代码/cpp/car_dealer_util/source/Data/DataManipulation/Excel/LoadFromExcel.h b/代码/cpp/car_dealer_util/source/Data/DataManipulation/Excel/LoadFromExcel.h
index 9d69edb..1da6718 100644
--- a/代码/cpp/car_dealer_util/source/Data/DataManipulation/Excel/LoadFromExcel.h
+++ b/代码/cpp/car_dealer_util/source/Data/DataManipulation/Excel/LoadFromExcel.h
@@ -9,3 +9,10 @@ void LoadCarDealerSchemeFromXlsx( const std::wstring & filePath,
unsigned int sheetIndex,
unsigned int startRowIndex,
std::vector & schemeVector );
+
+void LoadCarDealerAchievementFromXlsx( const std::wstring & filePath,
+ unsigned int sheetIndex,
+ unsigned int startRowIndex,
+ std::vector & achievementVector );
+
+//void LoadRepairOrderFromXlsx();
diff --git a/代码/cpp/car_dealer_util/source/data/Datastructure/RepairOrder/RepairOrder.cpp b/代码/cpp/car_dealer_util/source/data/Datastructure/RepairOrder/RepairOrder.cpp
new file mode 100644
index 0000000..ce24cd5
--- /dev/null
+++ b/代码/cpp/car_dealer_util/source/data/Datastructure/RepairOrder/RepairOrder.cpp
@@ -0,0 +1,2 @@
+
+#include "RepairOrder.h"
\ No newline at end of file
diff --git a/代码/cpp/car_dealer_util/source/data/Datastructure/RepairOrder/RepairOrder.h b/代码/cpp/car_dealer_util/source/data/Datastructure/RepairOrder/RepairOrder.h
new file mode 100644
index 0000000..d236ef6
--- /dev/null
+++ b/代码/cpp/car_dealer_util/source/data/Datastructure/RepairOrder/RepairOrder.h
@@ -0,0 +1,11 @@
+
+#pragma once
+
+#include
+
+class RepairOrder
+{
+
+private:
+
+};
\ No newline at end of file
diff --git a/代码/cpp/car_dealer_util/source/data/Datastructure/RepairOrder/送返修工单.txt b/代码/cpp/car_dealer_util/source/data/Datastructure/RepairOrder/送返修工单.txt
new file mode 100644
index 0000000..e69de29
diff --git a/代码/cpp/car_dealer_util/source/data/excel/excel.h b/代码/cpp/car_dealer_util/source/data/excel/excel.h
index 43738c7..cd3d4bb 100644
--- a/代码/cpp/car_dealer_util/source/data/excel/excel.h
+++ b/代码/cpp/car_dealer_util/source/data/excel/excel.h
@@ -4,6 +4,10 @@
#include
+/************************************************
+* \brief 注册libxl产品
+* \param pBook
+************************************************/
void setKey( libxl::Book * pBook );
/************************************************
@@ -12,6 +16,7 @@ void setKey( libxl::Book * pBook );
* \param sheetIndex sheet的索引值
* \param rowIndex 行号
* \param colIndex 列号
+* \param isInteger 单元格为数字类型时,选择是输出整形还是浮点型字符串
* \return 返回的字符串
************************************************/
std::wstring ReadCellStringFromXlsx( libxl::IBookT * pBook,
diff --git a/代码/cpp/car_dealer_util/source/test/test.cpp b/代码/cpp/car_dealer_util/source/test/test.cpp
index 66abe0f..1587d61 100644
--- a/代码/cpp/car_dealer_util/source/test/test.cpp
+++ b/代码/cpp/car_dealer_util/source/test/test.cpp
@@ -1,5 +1,4 @@
-
-#include
+#include
#include
#include "test.h"
#include "../data/DataManipulation/Excel/LoadFromExcel.h"
@@ -15,10 +14,13 @@ void test()
void excelTest()
{
- vector schemeVector;
- wstring filePath = L"D:/develop/projects_win/2019/car_dealer_util/数据/PC端导入模板(管理员版).xlsx";
+ vector schemeVector;
+ vector achievementsVector;
- LoadCarDealerSchemeFromXlsx(filePath, 0, 1, schemeVector);
+ wstring filePath = L"D:/develop/projects_win/2019/car_dealer_util/数据/PC端导入模板(客户经理版).xlsx";
+
+ //LoadCarDealerSchemeFromXlsx(filePath, 0, 1, schemeVector);
+ LoadCarDealerAchievementFromXlsx( filePath, 0, 1, achievementsVector );
return;
-}
\ No newline at end of file
+}
diff --git a/代码/数据库/建表/车商业绩表.sql b/代码/数据库/建表/车商业绩表.sql
new file mode 100644
index 0000000..7a4dd4a
--- /dev/null
+++ b/代码/数据库/建表/车商业绩表.sql
@@ -0,0 +1,42 @@
+DROP TABLE CAR_DEALER_ACHIEVEMENT;
+-- Create table
+create table CAR_DEALER_ACHIEVEMENT
+(
+ the_year VARCHAR2(4),
+ the_month VARCHAR2(2),
+ car_dealer_code VARCHAR2(20),
+ checked_achievement NUMBER(16,2),
+ policy_amount INTEGER,
+ cpic_amount INTEGER,
+ picc_amount INTEGER,
+ pingan_amount INTEGER,
+ others_amount INTEGER
+)
+tablespace CAR_DEALER;
+-- Add comments to the table
+comment on table CAR_DEALER_ACHIEVEMENT
+ is 'ҵ';
+-- Add comments to the columns
+comment on column CAR_DEALER_ACHIEVEMENT.the_year
+ is 'ͳ';
+comment on column CAR_DEALER_ACHIEVEMENT.the_month
+ is 'ͳ·';
+comment on column CAR_DEALER_ACHIEVEMENT.car_dealer_code
+ is '̴';
+comment on column CAR_DEALER_ACHIEVEMENT.checked_achievement
+ is '˫ǩֵ';
+comment on column CAR_DEALER_ACHIEVEMENT.policy_amount
+ is '³Ʊ';
+comment on column CAR_DEALER_ACHIEVEMENT.cpic_amount
+ is '̫ƽ³ǩ̨';
+comment on column CAR_DEALER_ACHIEVEMENT.picc_amount
+ is 'й˱³ǩ̨';
+comment on column CAR_DEALER_ACHIEVEMENT.pingan_amount
+ is 'йƽ³ǩ̨';
+comment on column CAR_DEALER_ACHIEVEMENT.others_amount
+ is 'չ˾³ǩ̨';
+-- Create/Recreate indexes
+create index CAR_DEALER_ACHIEVEMENT_IDX01 on CAR_DEALER_ACHIEVEMENT (THE_YEAR, THE_MONTH, CAR_DEALER_CODE)
+ tablespace CAR_DEALER_IDX;
+-- Grant/Revoke object privileges
+grant select on CAR_DEALER_ACHIEVEMENT to DATACENTER;
diff --git a/代码/数据库/建表/车商方案表.sql b/代码/数据库/建表/车商方案表.sql
new file mode 100644
index 0000000..24225ae
--- /dev/null
+++ b/代码/数据库/建表/车商方案表.sql
@@ -0,0 +1,59 @@
+--DROP TABLE CAR_DEALER_SCHEME;
+-- Create table
+create table CAR_DEALER_SCHEME
+(
+ the_year VARCHAR2(4),
+ the_month VARCHAR2(2),
+ car_dealer_code VARCHAR2(20),
+ man_hour_price VARCHAR2(200 CHAR),
+ part_price VARCHAR2(200 CHAR),
+ claim_support VARCHAR2(200 CHAR),
+ scheme VARCHAR2(1000 CHAR),
+ is_qualified CHAR(2)
+)
+tablespace CAR_DEALER
+ pctfree 10
+ initrans 1
+ maxtrans 255
+ storage
+ (
+ initial 64K
+ next 1M
+ minextents 1
+ maxextents unlimited
+ );
+-- Add comments to the table
+comment on table CAR_DEALER_SCHEME
+ is '̷';
+-- Add comments to the columns
+comment on column CAR_DEALER_SCHEME.the_year
+ is '';
+comment on column CAR_DEALER_SCHEME.the_month
+ is '·';
+comment on column CAR_DEALER_SCHEME.car_dealer_code
+ is '̴';
+comment on column CAR_DEALER_SCHEME.man_hour_price
+ is 'ʱ';
+comment on column CAR_DEALER_SCHEME.part_price
+ is '۸';
+comment on column CAR_DEALER_SCHEME.claim_support
+ is '֧';
+comment on column CAR_DEALER_SCHEME.scheme
+ is 'Ӫ';
+comment on column CAR_DEALER_SCHEME.is_qualified
+ is 'ǷԤ';
+-- Create/Recreate indexes
+create index CAR_DEALER_SCHEME_IDX on CAR_DEALER_SCHEME (THE_YEAR, THE_MONTH, CAR_DEALER_CODE)
+ tablespace CAR_DEALER_IDX
+ pctfree 10
+ initrans 2
+ maxtrans 255
+ storage
+ (
+ initial 64K
+ next 1M
+ minextents 1
+ maxextents unlimited
+ );
+-- Grant/Revoke object privileges
+grant select on CAR_DEALER_SCHEME to DATACENTER;
diff --git a/数据/测试数据.rar b/数据/测试数据.rar
index d702f45..4266e8d 100644
Binary files a/数据/测试数据.rar and b/数据/测试数据.rar differ