Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
familyMart_takeaway
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guanghui.cui
familyMart_takeaway
Commits
fbf9f931
Commit
fbf9f931
authored
Jun 11, 2018
by
guanghui.cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加订单状态查询接口(POS发起)
parent
1138ac5a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
16 deletions
+47
-16
base/BaseDefine.h
+1
-0
familyMart_takeaway/familyMart_takeaway.vcxproj
+0
-1
familyMart_takeaway/familyMart_takeaway.vcxproj.filters
+0
-3
src/JsonModule.cpp
+39
-10
src/JsonModule.h
+1
-0
src/main.cpp
+6
-2
No files found.
base/BaseDefine.h
View file @
fbf9f931
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#define REQUEST_TYPE_POS_PRIORITY 1005 //设置POS优先级
#define REQUEST_TYPE_POS_PRIORITY 1005 //设置POS优先级
#define REQUEST_TYPE_STOCK_WARN 1006 //库存预警通知
#define REQUEST_TYPE_STOCK_WARN 1006 //库存预警通知
#define REQUEST_TYPE_COMMON_WARN 1007 //通用预警通知
#define REQUEST_TYPE_COMMON_WARN 1007 //通用预警通知
#define REQUEST_TYPE_QUERY_ORDER_STAUS 1020 //订单状态查询
//配送类型对照表
//配送类型对照表
#define DELIVERY_TYPE_SELF "self" //自配送
#define DELIVERY_TYPE_SELF "self" //自配送
...
...
familyMart_takeaway/familyMart_takeaway.vcxproj
View file @
fbf9f931
...
@@ -152,7 +152,6 @@
...
@@ -152,7 +152,6 @@
</ItemDefinitionGroup>
</ItemDefinitionGroup>
<ItemGroup>
<ItemGroup>
<ClInclude Include="..\3rdParty\easylogging\easylogging++.h" />
<ClInclude Include="..\3rdParty\easylogging\easylogging++.h" />
<ClInclude Include="..\3rdParty\sqlite3.h" />
<ClInclude Include="..\base\BaseDefine.h" />
<ClInclude Include="..\base\BaseDefine.h" />
<ClInclude Include="..\base\CommonStruct.h" />
<ClInclude Include="..\base\CommonStruct.h" />
<ClInclude Include="..\src\JsonModule.h" />
<ClInclude Include="..\src\JsonModule.h" />
...
...
familyMart_takeaway/familyMart_takeaway.vcxproj.filters
View file @
fbf9f931
...
@@ -30,9 +30,6 @@
...
@@ -30,9 +30,6 @@
</Filter>
</Filter>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<ClInclude Include="..\3rdParty\sqlite3.h">
<Filter>3rdParty</Filter>
</ClInclude>
<ClInclude Include="..\3rdParty\easylogging\easylogging++.h">
<ClInclude Include="..\3rdParty\easylogging\easylogging++.h">
<Filter>3rdParty\easylogging</Filter>
<Filter>3rdParty\easylogging</Filter>
</ClInclude>
</ClInclude>
...
...
src/JsonModule.cpp
View file @
fbf9f931
...
@@ -665,19 +665,14 @@ bool JsonModule::getPosResponseData(const std::string &odsResponse,IN const std:
...
@@ -665,19 +665,14 @@ bool JsonModule::getPosResponseData(const std::string &odsResponse,IN const std:
if
(
fm_cmd
==
OPERATION_POS_CONFIRM
if
(
fm_cmd
==
OPERATION_POS_CONFIRM
||
fm_cmd
==
OPERATION_POS_CANCEL
||
fm_cmd
==
OPERATION_POS_CANCEL
||
fm_cmd
==
OPERATION_POS_REFUND_AGREE
||
fm_cmd
==
OPERATION_POS_REFUND_AGREE
||
fm_cmd
==
OPERATION_POS_REFUND_DISAGREE
)
||
fm_cmd
==
OPERATION_POS_REFUND_DISAGREE
||
fm_cmd
==
REQUEST_TYPE_QUERY_ORDER_STAUS
)
{
{
result
=
_convertToOrderOperationReponseJson
(
odsResponse
.
data
());
result
=
_convertToOrderOperationReponseJson
(
odsResponse
.
data
());
rlt
=
true
;
rlt
=
true
;
}
}
// serverResponseOperationObj obj;
// if(_getServerResponseData(odsResponse.data(),obj)){
// result=_convertServerResponseToJson(obj);
// return true;
// }
return
rlt
;
return
rlt
;
//result = "{\"status_code\":100, \"msg\":\"\"}";
}
}
std
::
string
JsonModule
::
_convertToOrderOperationReponseJson
(
IN
const
char
*
json
)
std
::
string
JsonModule
::
_convertToOrderOperationReponseJson
(
IN
const
char
*
json
)
...
@@ -704,7 +699,7 @@ std::string JsonModule::_convertToOrderOperationReponseJson(IN const char* json)
...
@@ -704,7 +699,7 @@ std::string JsonModule::_convertToOrderOperationReponseJson(IN const char* json)
{
{
int
iStatus
=
atoi
(
GetJsonStringSafe
(
result_obj
,
"status"
));
int
iStatus
=
atoi
(
GetJsonStringSafe
(
result_obj
,
"status"
));
status
=
_getPOSOrderStatus
(
iStatus
);
status
=
_getPOSOrderStatus
(
iStatus
);
status_desc
=
GetJsonStringSafe
(
result_obj
,
"status
_d
esc"
);
status_desc
=
GetJsonStringSafe
(
result_obj
,
"status
D
esc"
);
}
}
}
}
...
@@ -841,8 +836,9 @@ bool JsonModule::convertDataPos2Ods(const std::string &data, std::string &result
...
@@ -841,8 +836,9 @@ bool JsonModule::convertDataPos2Ods(const std::string &data, std::string &result
rlt
=
true
;
rlt
=
true
;
}
}
}
}
else
if
(
fm_cmd
==
REQUEST_TYPE_GOODS_CHANGE
){
else
if
(
fm_cmd
==
REQUEST_TYPE_QUERY_ORDER_STAUS
){
result
=
_convertToQueryOrderStatusJson
(
data
.
data
());
rlt
=
true
;
}
}
...
@@ -1842,6 +1838,39 @@ std::string JsonModule::_convertToCommonWarnJson(IN const char* json)
...
@@ -1842,6 +1838,39 @@ std::string JsonModule::_convertToCommonWarnJson(IN const char* json)
return
buffer
.
GetString
();
return
buffer
.
GetString
();
}
}
std
::
string
JsonModule
::
_convertToQueryOrderStatusJson
(
IN
const
char
*
json
)
{
std
::
string
order_id
,
channel
;
rapidjson
::
Document
document
;
// 定义一个Document对象
document
.
Parse
(
json
);
// 解析,Parse()无返回值,也不会抛异常
if
(
document
.
HasParseError
())
// 通过HasParseError()来判断解析是否成功
{
LOG
(
ERROR
)
<<
"JSON parse error:"
<<
document
.
GetParseError
()
<<
":"
<<
document
.
GetErrorOffset
();
return
""
;
}
channel
=
GetJsonStringSafe
(
document
,
"channel"
);
order_id
=
GetJsonStringSafe
(
document
,
"order_id"
);
rapidjson
::
StringBuffer
buffer
;
rapidjson
::
Writer
<
rapidjson
::
StringBuffer
>
writer
(
buffer
);
writer
.
StartObject
();
writer
.
Key
(
"fm_cmd"
);
writer
.
Int
(
REQUEST_TYPE_QUERY_ORDER_STAUS
);
writer
.
Key
(
"channel"
);
writer
.
String
(
channel
.
c_str
());
writer
.
Key
(
"orderId"
);
writer
.
String
(
order_id
.
c_str
());
writer
.
EndObject
();
return
buffer
.
GetString
();
}
bool
JsonModule
::
_getCommonWarnResponseJson
(
IN
const
std
::
string
&
posResponse
,
IN
const
std
::
string
&
orderData
,
IN
const
std
::
string
&
odsData
,
OUT
std
::
string
&
result
)
bool
JsonModule
::
_getCommonWarnResponseJson
(
IN
const
std
::
string
&
posResponse
,
IN
const
std
::
string
&
orderData
,
IN
const
std
::
string
&
odsData
,
OUT
std
::
string
&
result
)
{
{
std
::
string
notifyDate
,
rackNo
,
storeId
,
terminalNo
;
std
::
string
notifyDate
,
rackNo
,
storeId
,
terminalNo
;
...
...
src/JsonModule.h
View file @
fbf9f931
...
@@ -132,6 +132,7 @@ private:
...
@@ -132,6 +132,7 @@ private:
std
::
string
_convertToRefundJson
(
refundObj
&
obj
);
std
::
string
_convertToRefundJson
(
refundObj
&
obj
);
std
::
string
_convertToStockWarnJson
(
stockWarnObj
&
obj
);
std
::
string
_convertToStockWarnJson
(
stockWarnObj
&
obj
);
std
::
string
_convertToCommonWarnJson
(
IN
const
char
*
json
);
std
::
string
_convertToCommonWarnJson
(
IN
const
char
*
json
);
std
::
string
_convertToQueryOrderStatusJson
(
IN
const
char
*
json
);
std
::
string
_convertToOrderOperationReponseJson
(
IN
const
char
*
json
);
std
::
string
_convertToOrderOperationReponseJson
(
IN
const
char
*
json
);
bool
_convertPOSReqPriorityJson
(
IN
const
std
::
string
&
posReq
,
OUT
const
std
::
string
&
odsJson
);
bool
_convertPOSReqPriorityJson
(
IN
const
std
::
string
&
posReq
,
OUT
const
std
::
string
&
odsJson
);
...
...
src/main.cpp
View file @
fbf9f931
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
INITIALIZE_EASYLOGGINGPP
INITIALIZE_EASYLOGGINGPP
#define VERSION "1.0.5" //版本号
#define VERSION "1.0.5
Beta1
" //版本号
std
::
string
g_init_data
;
std
::
string
g_init_data
;
std
::
string
g_init_data_ods_back
;
std
::
string
g_init_data_ods_back
;
...
@@ -143,7 +143,11 @@ void* listen_pos_func(void* arg)
...
@@ -143,7 +143,11 @@ void* listen_pos_func(void* arg)
LOG
(
INFO
)
<<
"POS send goods change data:"
<<
posReq
.
data
();
LOG
(
INFO
)
<<
"POS send goods change data:"
<<
posReq
.
data
();
jsonTool
.
getPosResponseData
(
100
,
"success"
,
responseData
);
jsonTool
.
getPosResponseData
(
100
,
"success"
,
responseData
);
}
}
else
if
(
OPERATION_POS_CONFIRM
==
reqType
||
OPERATION_POS_CANCEL
==
reqType
||
OPERATION_POS_REFUND_AGREE
==
reqType
||
OPERATION_POS_REFUND_DISAGREE
==
reqType
)
else
if
(
OPERATION_POS_CONFIRM
==
reqType
||
OPERATION_POS_CANCEL
==
reqType
||
OPERATION_POS_REFUND_AGREE
==
reqType
||
OPERATION_POS_REFUND_DISAGREE
==
reqType
||
REQUEST_TYPE_QUERY_ORDER_STAUS
==
reqType
)
{
{
LOG
(
INFO
)
<<
"REQ POS ===>> PLUGIN:"
<<
posRequestData
.
data
();
LOG
(
INFO
)
<<
"REQ POS ===>> PLUGIN:"
<<
posRequestData
.
data
();
// 将POS请求数据转换为中台可接受数据格式
// 将POS请求数据转换为中台可接受数据格式
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment