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
d28fc2cc
Commit
d28fc2cc
authored
Feb 26, 2018
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 1:修复编译出错问题
parent
2a952a5e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
71 deletions
+73
-71
src/JsonModule.cpp
+0
-0
src/JsonModule.h
+73
-71
No files found.
src/JsonModule.cpp
View file @
d28fc2cc
This diff is collapsed.
Click to expand it.
src/JsonModule.h
View file @
d28fc2cc
#ifndef JSON_MODULE_H
#define JSON_MODULE_H
#include "../base/CommonStruct.h"
#include "../base/BaseDefine.h"
//std::string GetTestJson(const int statuscode,const char* msg,const char* orderid);
//void parseJson(const char* json);
class
JsonModule
{
public
:
JsonModule
();
~
JsonModule
();
bool
getPushOrders
(
IN
const
char
*
json
,
OUT
orderObj
&
order
);
/* 功能:判断是否是初始化数据
* 参数:[1]待判断数据
* 返回:...
* */
bool
isInitData
(
IN
const
std
::
string
&
data
);
/* 功能:检查初始化数据是否可用
* 参数:[1]待检查数据[2]POS监听端口
* 返回:是否正确格式
* */
bool
checkInitData
(
IN
const
std
::
string
&
data
,
OUT
int
&
posListenPort
);
/* 功能:获取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
);
/* 功能:获取ODS推送的返回数据
* 参数:[1]状态码[2]消息[3]转换后数据
* 重载:[1]POS返回数据[2]订单数据[3]转换后数据
* 返回:是否转换成功
* */
bool
getOdsResponseData
(
IN
int
status_code
,
IN
const
std
::
string
&
msg
,
OUT
std
::
string
&
result
);
bool
getOdsResponseData
(
IN
const
std
::
string
&
posResponse
,
IN
const
std
::
string
&
orderData
,
OUT
std
::
string
&
result
);
/* 功能:转换POS数据格式到中台数据格式
* 参数:[1]POS数据格式[2]转换后数据
* 返回:是否转换成功
* */
bool
convertDataPos2Ods
(
IN
const
std
::
string
&
data
,
OUT
std
::
string
&
result
);
/* 功能:转换中台数据格式到POS数据格式
* 参数:[1]中台数据格式[2]转换后数据
* 返回:是否转换成功
* */
bool
convertDataOds2Pos
(
IN
const
std
::
string
&
data
,
OUT
std
::
string
&
result
);
private
:
std
::
string
_getDeliveryTypeString
(
int
type
);
//订单状态转换(转换为POS对应的状态)
int
_getPOSOrderStatus
(
int
status
);
void
_getStatusObj
(
IN
orderObj
&
order_obj
,
OUT
orderStatusObj
&
status_obj
);
void
_getRefundObj
(
IN
orderObj
&
order_obj
,
OUT
refundObj
&
refund_obj
);
std
::
string
_convertToNewOrderJson
(
orderObj
&
obj
);
std
::
string
_convertToOrderStatusJson
(
orderStatusObj
&
obj
);
std
::
string
_convertToRefundJson
(
refundObj
&
obj
);
std
::
string
_convertToStockWarnJson
(
stockWarnObj
&
obj
);
};
#endif
#ifndef JSON_MODULE_H
#define JSON_MODULE_H
#include <stdlib.h>
#include <stdio.h>
#include "../base/CommonStruct.h"
#include "../base/BaseDefine.h"
//std::string GetTestJson(const int statuscode,const char* msg,const char* orderid);
//void parseJson(const char* json);
class
JsonModule
{
public
:
JsonModule
();
~
JsonModule
();
bool
getPushOrders
(
IN
const
char
*
json
,
OUT
orderObj
&
order
);
/* 功能:判断是否是初始化数据
* 参数:[1]待判断数据
* 返回:...
* */
bool
isInitData
(
IN
const
std
::
string
&
data
);
/* 功能:检查初始化数据是否可用
* 参数:[1]待检查数据[2]POS监听端口
* 返回:是否正确格式
* */
bool
checkInitData
(
IN
const
std
::
string
&
data
,
OUT
int
&
posListenPort
);
/* 功能:获取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
);
/* 功能:获取ODS推送的返回数据
* 参数:[1]状态码[2]消息[3]转换后数据
* 重载:[1]POS返回数据[2]订单数据[3]转换后数据
* 返回:是否转换成功
* */
bool
getOdsResponseData
(
IN
int
status_code
,
IN
const
std
::
string
&
msg
,
OUT
std
::
string
&
result
);
bool
getOdsResponseData
(
IN
const
std
::
string
&
posResponse
,
IN
const
std
::
string
&
orderData
,
OUT
std
::
string
&
result
);
/* 功能:转换POS数据格式到中台数据格式
* 参数:[1]POS数据格式[2]转换后数据
* 返回:是否转换成功
* */
bool
convertDataPos2Ods
(
IN
const
std
::
string
&
data
,
OUT
std
::
string
&
result
);
/* 功能:转换中台数据格式到POS数据格式
* 参数:[1]中台数据格式[2]转换后数据
* 返回:是否转换成功
* */
bool
convertDataOds2Pos
(
IN
const
std
::
string
&
data
,
OUT
std
::
string
&
result
);
private
:
std
::
string
_getDeliveryTypeString
(
int
type
);
//订单状态转换(转换为POS对应的状态)
int
_getPOSOrderStatus
(
int
status
);
void
_getStatusObj
(
IN
orderObj
&
order_obj
,
OUT
orderStatusObj
&
status_obj
);
void
_getRefundObj
(
IN
orderObj
&
order_obj
,
OUT
refundObj
&
refund_obj
);
std
::
string
_convertToNewOrderJson
(
orderObj
&
obj
);
std
::
string
_convertToOrderStatusJson
(
orderStatusObj
&
obj
);
std
::
string
_convertToRefundJson
(
refundObj
&
obj
);
std
::
string
_convertToStockWarnJson
(
stockWarnObj
&
obj
);
};
#endif
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