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
87e41dfc
Commit
87e41dfc
authored
Sep 10, 2018
by
guanghui.cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、设置主pos立即关闭当前长连接,发送请求 2、点取分离和扫码购 状态码与ods对接
parent
5f2c1796
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
12 deletions
+54
-12
base/BaseDefine.h
+10
-2
src/JsonModule.cpp
+32
-6
src/JsonModule.h
+2
-0
src/SocketModule.cpp
+4
-1
src/main.cpp
+6
-3
No files found.
base/BaseDefine.h
View file @
87e41dfc
...
...
@@ -31,7 +31,15 @@
#define REQUEST_TYPE_POS_PRIORITY 1005 //设置POS优先级
#define REQUEST_TYPE_STOCK_WARN 1006 //库存预警通知
#define REQUEST_TYPE_COMMON_WARN 1007 //通用预警通知
#define REQUEST_TYPE_QUERY_ORDER_STAUS 1020 //订单状态查询
#define REQUEST_TYPE_QUERY_ORDER_STAUS 1060 //订单状态查询
//点取分离和扫码购 插件向ods请求码
#define PLUGIN_TO_ODS_APPOINTMENT_MAKINGDONE 1020 //制作完成(点取分离)
#define PLUGIN_TO_ODS_APPOINTMENT_DONE 1021 //已完成(点取分离)
#define PLUGIN_TO_ODS_APPOINTMENT_REFUND 1022 //pos退款(点取分离)
#define PLUGIN_TO_ODS_APPOINTMENT_CONFIRM 1023 //确认接单(点取分离)
#define PLUGIN_TO_ODS_SCANCODE_DONE 1024 //已完成(扫码购)
#define PLUGIN_TO_ODS_SCANCODE_REFUND 1025 //pos退款(扫码购)
//配送类型对照表
#define DELIVERY_TYPE_SELF "self" //自配送
...
...
@@ -69,7 +77,7 @@
#define OPERATION_POS_CANCEL 1012 //拒绝接单(外卖)
#define OPERATION_POS_REFUND_AGREE 1013 //同意退款(外卖)
#define OPERATION_POS_REFUND_DISAGREE 1014 //拒绝退款(外卖)
#define OPERATION_POS_APPOINTMENT_MAKEING 1015 //制作中(点取分离)
//
#define OPERATION_POS_APPOINTMENT_MAKEING 1015 //制作中(点取分离)
#define OPERATION_POS_APPOINTMENT_MAKEING_DONE 1016 //制作完成(点取分离)
#define OPERATION_POS_APPOINTMENT_DONE 1017 //已完成(点取分离)
#define OPERATION_POS_APPOINTMENT_REFUND 1018 //pos退款(点取分离)
...
...
src/JsonModule.cpp
View file @
87e41dfc
...
...
@@ -881,8 +881,7 @@ bool JsonModule::convertDataPos2Ods(const std::string &data, std::string &result
result
=
_convertToQueryOrderStatusJson
(
data
.
data
());
rlt
=
true
;
}
else
if
(
fm_cmd
==
OPERATION_POS_APPOINTMENT_MAKEING
||
fm_cmd
==
OPERATION_POS_APPOINTMENT_MAKEING_DONE
else
if
(
fm_cmd
==
OPERATION_POS_APPOINTMENT_MAKEING_DONE
||
fm_cmd
==
OPERATION_POS_APPOINTMENT_DONE
||
fm_cmd
==
OPERATION_POS_APPOINTMENT_REFUND
||
fm_cmd
==
OPERATION_POS_APPOINTMENT_CONFIRM
...
...
@@ -1968,7 +1967,7 @@ std::string JsonModule::_convertToAppointmentAndScancodeReqJson(IN const char* j
writer
.
StartObject
();
writer
.
Key
(
"fm_cmd"
);
writer
.
Int
(
REQUEST_TYPE_QUERY_ORDER_STAUS
);
writer
.
Int
(
_getReqCodeByPOSReq
(
reqType
)
);
writer
.
Key
(
"channel"
);
writer
.
String
(
channel
.
c_str
());
...
...
@@ -2085,9 +2084,6 @@ std::string JsonModule::_getODSTypeByPOSReq(int type)
std
::
string
rlt
=
0
;
switch
(
type
)
{
case
OPERATION_POS_APPOINTMENT_MAKEING
:
rlt
=
"20007"
;
break
;
case
OPERATION_POS_APPOINTMENT_MAKEING_DONE
:
rlt
=
"20008"
;
break
;
...
...
@@ -2256,4 +2252,33 @@ std::string JsonModule::_getCommonWarnStringByCode(int type)
rlt
=
charset_g2u
(
rlt
);
#endif // WIN32
return
rlt
;
}
int
JsonModule
::
_getReqCodeByPOSReq
(
int
fm_cmd
)
{
int
rlt
=
0
;
switch
(
fm_cmd
)
{
case
OPERATION_POS_APPOINTMENT_MAKEING_DONE
:
rlt
=
PLUGIN_TO_ODS_APPOINTMENT_MAKINGDONE
;
break
;
case
OPERATION_POS_APPOINTMENT_DONE
:
rlt
=
PLUGIN_TO_ODS_APPOINTMENT_DONE
;
break
;
case
OPERATION_POS_APPOINTMENT_REFUND
:
rlt
=
PLUGIN_TO_ODS_APPOINTMENT_REFUND
;
break
;
case
OPERATION_POS_APPOINTMENT_CONFIRM
:
rlt
=
PLUGIN_TO_ODS_APPOINTMENT_CONFIRM
;
break
;
case
OPERATION_POS_SCANCODE_DONE
:
rlt
=
PLUGIN_TO_ODS_SCANCODE_DONE
;
break
;
case
OPERATION_POS_SCANCODE_REFUND
:
rlt
=
PLUGIN_TO_ODS_SCANCODE_REFUND
;
break
;
default
:
break
;
}
return
rlt
;
}
\ No newline at end of file
src/JsonModule.h
View file @
87e41dfc
...
...
@@ -116,6 +116,8 @@ private:
int
_getPOSOrderStatus
(
int
status
);
//POS请求类型转换为ODS需要类型
int
_getODSStatusByPOSReq
(
int
fm_cmd
);
//获取点取分离和扫码购请求码
int
_getReqCodeByPOSReq
(
int
fm_cmd
);
//POS请求操作类型转换为中台需要类型
std
::
string
_getODSTypeByPOSReq
(
int
type
);
...
...
src/SocketModule.cpp
View file @
87e41dfc
...
...
@@ -141,9 +141,12 @@ bool TCPSocket::close()
{
if
(
m_sockfd
==
-
1
)
return
false
;
#ifdef WIN32
#ifdef WIN32
shutdown
(
m_sockfd
,
SD_BOTH
);
closesocket
(
m_sockfd
);
#else
shutdown
(
m_sockfd
,
SHUT_RDWR
);
::
close
(
m_sockfd
);
#endif
m_sockfd
=
-
1
;
...
...
src/main.cpp
View file @
87e41dfc
...
...
@@ -19,7 +19,7 @@
INITIALIZE_EASYLOGGINGPP
#define VERSION "1.0.6 beta
5
" //版本号
#define VERSION "1.0.6 beta
7
" //版本号
std
::
string
g_init_data
;
std
::
string
g_init_data_ods_back
;
...
...
@@ -92,6 +92,11 @@ void* listen_pos_func(void* arg)
LOG
(
INFO
)
<<
"pos reqType:"
<<
reqType
;
if
(
reqType
==
REQUEST_TYPE_INIT
)
{
if
(
bInitDone
)
{
LOG
(
INFO
)
<<
"set timeout 1"
;
longConnectionOds
.
setSocketTimeout
(
1
);
longConnectionOds
.
close
();
//关闭长连接,等待重连
}
bInitDone
=
false
;
if
(
jsonTool
.
checkInitData
(
posRequestData
,
pos_listen_port
)
)
{
...
...
@@ -101,7 +106,6 @@ void* listen_pos_func(void* arg)
jsonTool
.
convertInitDataPos2Ods
(
posRequestData
,
g_init_data
);
//jsonTool.getPosResponseData(100, "successful!", responseData);
LOG
(
INFO
)
<<
"INIT PLUGIN ===>> ODS:"
<<
g_init_data
.
c_str
();
longConnectionOds
.
close
();
//关闭长连接,等待重连
//等待ods返回初始化结果
while
(
true
){
if
(
!
g_init_data_ods_back
.
empty
()){
...
...
@@ -150,7 +154,6 @@ void* listen_pos_func(void* arg)
||
OPERATION_POS_CANCEL
==
reqType
||
OPERATION_POS_REFUND_AGREE
==
reqType
||
OPERATION_POS_REFUND_DISAGREE
==
reqType
||
OPERATION_POS_APPOINTMENT_MAKEING
==
reqType
||
OPERATION_POS_APPOINTMENT_MAKEING_DONE
==
reqType
||
OPERATION_POS_APPOINTMENT_DONE
==
reqType
||
OPERATION_POS_APPOINTMENT_REFUND
==
reqType
...
...
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