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
151657fa
Commit
151657fa
authored
Mar 24, 2018
by
guanghui.cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pos操作ods返回处理
parent
5184cd29
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
6 deletions
+15
-6
src/JsonModule.cpp
+0
-0
src/JsonModule.h
+11
-3
src/main.cpp
+4
-3
No files found.
src/JsonModule.cpp
View file @
151657fa
This diff is collapsed.
Click to expand it.
src/JsonModule.h
View file @
151657fa
...
...
@@ -40,13 +40,19 @@ public:
* */
bool
checkInitData
(
IN
const
std
::
string
&
data
,
OUT
int
&
posListenPort
);
/* 功能:转换POS初始化数据格式到中台数据格式
* 参数:[1]POS数据格式[2]转换后数据
* 返回:是否转换成功
* */
bool
convertInitDataPos2Ods
(
IN
const
std
::
string
&
data
,
OUT
std
::
string
&
result
);
/* 功能:获取POS请求的返回数据
* 参数:[1]状态码[2]消息[3]转换后数据
* 重载:[1]ODS返回数据[2]转换后数据
* 返回:是否转换成功
* */
bool
getPosResponseData
(
IN
int
status
,
IN
const
std
::
string
&
msg
,
OUT
std
::
string
&
result
);
bool
getPosResponseData
(
IN
const
std
::
string
&
odsResponse
,
OUT
std
::
string
&
result
);
bool
getPosResponseData
(
IN
const
std
::
string
&
odsResponse
,
IN
const
std
::
string
&
posReq
,
OUT
std
::
string
&
result
);
/* 功能:获取ODS推送的返回数据
* 参数:[1]状态码[2]消息[3]转换后数据
...
...
@@ -100,14 +106,16 @@ private:
std
::
string
_convertPosOperationToOdsJson
(
orderOperationObj
&
operation_obj
);
//服务器返回值(针对pos操作订单请求)
bool
_getServerResponseData
(
IN
const
char
*
json
,
OUT
serverResponseOperationObj
&
obj
);
std
::
string
_convertServerResponseToJson
(
serverResponseOperationObj
&
operation_obj
);
//
bool _getServerResponseData(IN const char* json,OUT serverResponseOperationObj &obj);
//
std::string _convertServerResponseToJson(serverResponseOperationObj &operation_obj);
std
::
string
_convertToNewOrderJson
(
orderObj
&
obj
);
std
::
string
_convertToOrderStatusJson
(
orderStatusObj
&
obj
);
std
::
string
_convertToRefundJson
(
refundObj
&
obj
);
std
::
string
_convertToStockWarnJson
(
stockWarnObj
&
obj
);
std
::
string
_convertToCommonWarnJson
(
IN
const
char
*
json
);
std
::
string
_convertToOrderOperationReponseJson
(
IN
const
char
*
json
);
bool
_convertPOSReqPriorityJson
(
IN
const
std
::
string
&
posReq
,
OUT
const
std
::
string
&
odsJson
);
bool
_getOrderResponseJson
(
IN
const
std
::
string
&
posResponse
,
IN
const
std
::
string
&
orderData
,
OUT
std
::
string
&
result
);
bool
_getStockWarnResponseJson
(
IN
const
std
::
string
&
posResponse
,
IN
const
std
::
string
&
orderData
,
IN
const
std
::
string
&
odsData
,
OUT
std
::
string
&
result
);
...
...
src/main.cpp
View file @
151657fa
...
...
@@ -77,8 +77,9 @@ void* listen_pos_func(void* arg)
bInitDone
=
false
;
if
(
jsonTool
.
checkInitData
(
posRequestData
,
pos_listen_port
)
)
{
g_init_data
=
posRequestData
;
jsonTool
.
getPosResponseData
(
100
,
"successful!"
,
responseData
);
//g_init_data = posRequestData;
jsonTool
.
convertInitDataPos2Ods
(
posRequestData
,
g_init_data
);
//jsonTool.getPosResponseData(100, "successful!", responseData);
LOG
(
INFO
)
<<
"POS init data:"
<<
g_init_data
.
c_str
();
//等待ods返回初始化结果
while
(
true
){
...
...
@@ -111,7 +112,7 @@ void* listen_pos_func(void* arg)
std
::
string
tmp
;
if
(
ods
.
receive
(
tmp
)
)
{
jsonTool
.
getPosResponseData
(
tmp
,
responseData
);
jsonTool
.
getPosResponseData
(
tmp
,
posRequestData
,
responseData
);
}
else
{
jsonTool
.
getPosResponseData
(
101
,
"receive data from [ODS] failed!"
,
responseData
);
...
...
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