Commit 10f6860604d1fdd92516e3d02f3473d67e38a009

Authored by liuye
1 parent 6d918b59

feat<central_clearing_system>:新增下单流程超时处理

下单超时调用登录界面,重新登录继续之前操作,失败退出系统。
central_clearing_system/Config/url_cfg.json
1 { 1 {
2 "protocol": "http", 2 "protocol": "http",
3 "host": "xtrade.esc.diligrp.com", 3 "host": "xtrade.esc.diligrp.com",
4 - "port": 8082, 4 + "port": 8080,
5 "main_path": "/iset/oauth/clientInitMain.iset", 5 "main_path": "/iset/oauth/clientInitMain.iset",
6 "login_path": "/iset/oauth/login.auth", 6 "login_path": "/iset/oauth/login.auth",
7 "logout_path": "/iset/oauth/logout.auth", 7 "logout_path": "/iset/oauth/logout.auth",
central_clearing_system/ETradeClient.rc
@@ -146,15 +146,14 @@ END @@ -146,15 +146,14 @@ END
146 146
147 IDR_ACCELERATOR_ORDER ACCELERATORS 147 IDR_ACCELERATOR_ORDER ACCELERATORS
148 BEGIN 148 BEGIN
  149 + "A", ID_ACCELERATOR_A, VIRTKEY, NOINVERT
149 VK_DOWN, ID_ACCELERATOR_DOWN, VIRTKEY, NOINVERT 150 VK_DOWN, ID_ACCELERATOR_DOWN, VIRTKEY, NOINVERT
150 VK_RETURN, ID_ACCELERATOR_ENTER, VIRTKEY, NOINVERT 151 VK_RETURN, ID_ACCELERATOR_ENTER, VIRTKEY, NOINVERT
  152 + "F", ID_ACCELERATOR_F, VIRTKEY, NOINVERT
151 VK_F11, ID_ACCELERATOR_F11, VIRTKEY, NOINVERT 153 VK_F11, ID_ACCELERATOR_F11, VIRTKEY, NOINVERT
  154 + "S", ID_ACCELERATOR_S, VIRTKEY, NOINVERT
152 VK_TAB, ID_ACCELERATOR_TAB, VIRTKEY, NOINVERT 155 VK_TAB, ID_ACCELERATOR_TAB, VIRTKEY, NOINVERT
153 VK_UP, ID_ACCELERATOR_UP, VIRTKEY, NOINVERT 156 VK_UP, ID_ACCELERATOR_UP, VIRTKEY, NOINVERT
154 - "S", ID_ACCELERATOR_S, VIRTKEY, NOINVERT  
155 - "S", ID_ACCELERATOR_ALT_S, VIRTKEY, ALT, NOINVERT  
156 - "A", ID_ACCELERATOR_A, VIRTKEY, NOINVERT  
157 - "F", ID_ACCELERATOR_F, VIRTKEY, NOINVERT  
158 "X", ID_ACCELERATOR_X, VIRTKEY, NOINVERT 157 "X", ID_ACCELERATOR_X, VIRTKEY, NOINVERT
159 END 158 END
160 159
@@ -226,7 +225,7 @@ BEGIN @@ -226,7 +225,7 @@ BEGIN
226 END 225 END
227 226
228 IDD_DIALOG_PLACE_ORDER DIALOGEX 0, 0, 342, 238 227 IDD_DIALOG_PLACE_ORDER DIALOGEX 0, 0, 342, 238
229 -STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU 228 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
230 CAPTION "结算下单" 229 CAPTION "结算下单"
231 FONT 12, "微软雅黑", 400, 0, 0x86 230 FONT 12, "微软雅黑", 400, 0, 0x86
232 BEGIN 231 BEGIN
@@ -278,8 +277,8 @@ END @@ -278,8 +277,8 @@ END
278 // 277 //
279 278
280 VS_VERSION_INFO VERSIONINFO 279 VS_VERSION_INFO VERSIONINFO
281 - FILEVERSION 1,0,0,1  
282 - PRODUCTVERSION 1,0,0,1 280 + FILEVERSION 2,0,0,1
  281 + PRODUCTVERSION 2,0,0,1
283 FILEFLAGSMASK 0x3fL 282 FILEFLAGSMASK 0x3fL
284 #ifdef _DEBUG 283 #ifdef _DEBUG
285 FILEFLAGS 0x1L 284 FILEFLAGS 0x1L
@@ -295,13 +294,13 @@ BEGIN @@ -295,13 +294,13 @@ BEGIN
295 BLOCK "080404b0" 294 BLOCK "080404b0"
296 BEGIN 295 BEGIN
297 VALUE "CompanyName", "地利集团【DILI GROUP】" 296 VALUE "CompanyName", "地利集团【DILI GROUP】"
298 - VALUE "FileDescription", "电子交易结算柜员系统【ETradeClient】"  
299 - VALUE "FileVersion", "1.0.0.1" 297 + VALUE "FileDescription", "电子交易结算综合业务系统"
  298 + VALUE "FileVersion", "2.0.0.1"
300 VALUE "InternalName", "ETradeClient.exe" 299 VALUE "InternalName", "ETradeClient.exe"
301 VALUE "LegalCopyright", "(C) 地利集团。 保留所有权利。" 300 VALUE "LegalCopyright", "(C) 地利集团。 保留所有权利。"
302 VALUE "OriginalFilename", "ETradeClient.exe" 301 VALUE "OriginalFilename", "ETradeClient.exe"
303 - VALUE "ProductName", "电子交易结算柜员系统"  
304 - VALUE "ProductVersion", "1.0.0.1" 302 + VALUE "ProductName", "Central-Clearing-System_2.0.1.181019_beta"
  303 + VALUE "ProductVersion", "2.0.0.1"
305 END 304 END
306 END 305 END
307 BLOCK "VarFileInfo" 306 BLOCK "VarFileInfo"
central_clearing_system/ETradeClient.vcxproj
@@ -45,6 +45,7 @@ @@ -45,6 +45,7 @@
45 <PropertyGroup Label="UserMacros" /> 45 <PropertyGroup Label="UserMacros" />
46 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> 46 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
47 <LinkIncremental>true</LinkIncremental> 47 <LinkIncremental>true</LinkIncremental>
  48 + <TargetName>综合业务系统_beta</TargetName>
48 </PropertyGroup> 49 </PropertyGroup>
49 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> 50 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
50 <LinkIncremental>false</LinkIncremental> 51 <LinkIncremental>false</LinkIncremental>
central_clearing_system/ETradeClient/browser/async_js_callback_handler.cpp
@@ -70,7 +70,21 @@ namespace HW @@ -70,7 +70,21 @@ namespace HW
70 PT::read_json(ss, ptree); 70 PT::read_json(ss, ptree);
71 std::string cmd = ptree.get<std::string>(JSON_TAG_CMD); 71 std::string cmd = ptree.get<std::string>(JSON_TAG_CMD);
72 std::string file_id = ptree.get<std::string>(JSON_TAG_FILEID); 72 std::string file_id = ptree.get<std::string>(JSON_TAG_FILEID);
73 - std::string data = ptree.get<std::string>(JSON_TAG_DATA); 73 +
  74 + std::string data;
  75 + if (cmd.compare(JSON_VAL_CMD_PRINT) == 0 && file_id.compare(JSON_VAL_FILEID_ORDER) == 0)
  76 + {
  77 + PT::ptree data_child = ptree.get_child(JSON_TAG_DATA);
  78 + std::ostringstream os;
  79 + PT::write_json(os, data_child);
  80 + CString data_t = str_2_wstr(std::string(os.str())).c_str();
  81 + data = CT2A(data_t);
  82 + }
  83 + else
  84 + {
  85 + data = ptree.get<std::string>(JSON_TAG_DATA);
  86 + }
  87 +
74 std::string seq = ptree.get<std::string>(JSON_TAG_SEQ); 88 std::string seq = ptree.get<std::string>(JSON_TAG_SEQ);
75 return{ cmd, file_id, data, seq }; 89 return{ cmd, file_id, data, seq };
76 } 90 }
central_clearing_system/ETradeClient/browser/main_view_browser_handler.cpp
@@ -407,7 +407,7 @@ bool MainViewBrowserHandler::OnResourceResponse(CefRefPtr&lt;CefBrowser&gt; browser, C @@ -407,7 +407,7 @@ bool MainViewBrowserHandler::OnResourceResponse(CefRefPtr&lt;CefBrowser&gt; browser, C
407 CEF_REQUIRE_IO_THREAD(); 407 CEF_REQUIRE_IO_THREAD();
408 408
409 const CefString kTimeoutHeader("sessionStatus"); 409 const CefString kTimeoutHeader("sessionStatus");
410 - const CefString kTimeout("expired"); 410 + const CefString kTimeout("0"); //³¬Ê±Îª0£¬Õý³£Îª1
411 411
412 auto& url = request->GetURL(); 412 auto& url = request->GetURL();
413 CefRequest::HeaderMap headerMap; 413 CefRequest::HeaderMap headerMap;
central_clearing_system/ETradeClient/browser/popup_browser_handler.cpp
@@ -63,7 +63,7 @@ bool PopupBrowserHandler::OnResourceResponse(CefRefPtr&lt;CefBrowser&gt; browser, CefR @@ -63,7 +63,7 @@ bool PopupBrowserHandler::OnResourceResponse(CefRefPtr&lt;CefBrowser&gt; browser, CefR
63 CEF_REQUIRE_IO_THREAD(); 63 CEF_REQUIRE_IO_THREAD();
64 64
65 const CefString kTimeoutHeader("sessionStatus"); 65 const CefString kTimeoutHeader("sessionStatus");
66 - const CefString kTimeout("expired"); 66 + const CefString kTimeout("0");
67 67
68 auto& url = request->GetURL(); 68 auto& url = request->GetURL();
69 CefRequest::HeaderMap headerMap; 69 CefRequest::HeaderMap headerMap;
central_clearing_system/ETradeClient/mfc_ui/MainFrm.cpp
@@ -102,7 +102,8 @@ CMainFrame::CMainFrame() : m_is_view_closing(false), m_msg_count(0) @@ -102,7 +102,8 @@ CMainFrame::CMainFrame() : m_is_view_closing(false), m_msg_count(0)
102 {} 102 {}
103 103
104 CMainFrame::~CMainFrame() 104 CMainFrame::~CMainFrame()
105 -{} 105 +{
  106 +}
106 107
107 bool CMainFrame::Launch() 108 bool CMainFrame::Launch()
108 { 109 {
@@ -171,8 +172,8 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) @@ -171,8 +172,8 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
171 { 172 {
172 do 173 do
173 { 174 {
174 - if (CFrameWnd::OnCreate(lpCreateStruct) == -1)  
175 - break; 175 + /*if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  176 + break;*/
176 if (!m_menu_res_auth_manager.UpdateAuth()) 177 if (!m_menu_res_auth_manager.UpdateAuth())
177 break; 178 break;
178 if (!FilterMenuBar()) 179 if (!FilterMenuBar())
@@ -183,6 +184,9 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) @@ -183,6 +184,9 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
183 break; 184 break;
184 return 0; // Return 0 if all succeed. 185 return 0; // Return 0 if all succeed.
185 } while (0); 186 } while (0);
  187 +
  188 +
  189 +
186 return -1; // Return -1 to indicate error happens. 190 return -1; // Return -1 to indicate error happens.
187 } 191 }
188 192
central_clearing_system/ETradeClient/mfc_ui/MainFrm.h
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 11
12 #include "etradeclient/browser/user_msg_monitor.h" 12 #include "etradeclient/browser/user_msg_monitor.h"
13 #include "etradeclient/utility/menu_res_auth_mgr.h" 13 #include "etradeclient/utility/menu_res_auth_mgr.h"
  14 +#include "place_order_dlg.h"
14 15
15 class CMainFrame : public CFrameWnd 16 class CMainFrame : public CFrameWnd
16 { 17 {
central_clearing_system/ETradeClient/mfc_ui/pay_dlg.cpp
@@ -19,6 +19,7 @@ @@ -19,6 +19,7 @@
19 #include "etradeclient/hardware/hardware_cmd.h" 19 #include "etradeclient/hardware/hardware_cmd.h"
20 #include "ETradeClient/utility/logging.h" 20 #include "ETradeClient/utility/logging.h"
21 #include <sstream> 21 #include <sstream>
  22 +#include "LoginDialog.h"
22 23
23 24
24 // PayDlg 对话框 25 // PayDlg 对话框
@@ -59,6 +60,7 @@ BEGIN_MESSAGE_MAP(PayDlg, CDialogEx) @@ -59,6 +60,7 @@ BEGIN_MESSAGE_MAP(PayDlg, CDialogEx)
59 ON_COMMAND(ID_ACCELERATOR_A, &PayDlg::OnBnClickedPayButtonPassword) 60 ON_COMMAND(ID_ACCELERATOR_A, &PayDlg::OnBnClickedPayButtonPassword)
60 ON_COMMAND(ID_ACCELERATOR_F, &PayDlg::OnBnClickedPayButtonPay) 61 ON_COMMAND(ID_ACCELERATOR_F, &PayDlg::OnBnClickedPayButtonPay)
61 ON_COMMAND(ID_ACCELERATOR_X, &PayDlg::OnBnClickedPayButtonClose) 62 ON_COMMAND(ID_ACCELERATOR_X, &PayDlg::OnBnClickedPayButtonClose)
  63 + ON_MESSAGE(WM_CEF_SESSION_EXPIRED, &PayDlg::OnSessionExpired)
62 END_MESSAGE_MAP() 64 END_MESSAGE_MAP()
63 65
64 66
@@ -162,6 +164,9 @@ void PayDlg::OnBnClickedPayButtonClose() @@ -162,6 +164,9 @@ void PayDlg::OnBnClickedPayButtonClose()
162 164
163 void PayDlg::OnBnClickedPayButtonPay() 165 void PayDlg::OnBnClickedPayButtonPay()
164 { 166 {
  167 + //for test
  168 + //OnSessionExpired(NULL, NULL);
  169 + //
165 LOG_TRACE(L"支付订单"); 170 LOG_TRACE(L"支付订单");
166 CString error_msg; 171 CString error_msg;
167 172
@@ -211,6 +216,7 @@ void PayDlg::OnBnClickedPayButtonPay() @@ -211,6 +216,7 @@ void PayDlg::OnBnClickedPayButtonPay()
211 error_msg = err_msg.c_str(); 216 error_msg = err_msg.c_str();
212 break; 217 break;
213 } 218 }
  219 + std::string response_header = request.ReadResponseHeader();
214 std::string response_body = request.ReadResponseBody(); 220 std::string response_body = request.ReadResponseBody();
215 if (response_body.empty()) 221 if (response_body.empty())
216 { 222 {
@@ -223,6 +229,20 @@ void PayDlg::OnBnClickedPayButtonPay() @@ -223,6 +229,20 @@ void PayDlg::OnBnClickedPayButtonPay()
223 bool card_res = false; 229 bool card_res = false;
224 try //Parse the configuration file 230 try //Parse the configuration file
225 { 231 {
  232 + int status_index = response_header.find("sessionStatus");
  233 + if (std::string::npos == status_index)
  234 + {
  235 + LOG_ERROR(L"解析服务器返回的登录结果信息时出错!请确认返回数据不为空,返回的数据格式为正确的Json格式!");
  236 + error_msg = CString(L"解析服务器返回的登录结果信息时出错!请确认返回数据不为空,返回的数据格式为正确的Json格式!");
  237 + break;
  238 + }
  239 + std::string status = response_header.substr(status_index + 15, 1);
  240 + if (status.compare("0") == 0)
  241 + {
  242 + SendMessage(WM_CEF_SESSION_EXPIRED);
  243 + break;
  244 + }
  245 +
226 PT::ptree ptree; 246 PT::ptree ptree;
227 std::stringstream ss; 247 std::stringstream ss;
228 ss << response_body; 248 ss << response_body;
@@ -345,3 +365,14 @@ BOOL PayDlg::PreTranslateMessage(MSG* pMsg) @@ -345,3 +365,14 @@ BOOL PayDlg::PreTranslateMessage(MSG* pMsg)
345 365
346 return CDialogEx::PreTranslateMessage(pMsg); 366 return CDialogEx::PreTranslateMessage(pMsg);
347 } 367 }
  368 +
  369 +LRESULT PayDlg::OnSessionExpired(WPARAM wParam, LPARAM lParam)
  370 +{
  371 + if (!CLoginDialog(L"当前连接已过期,请重新登录!", this).Launch())
  372 + {
  373 + AfxGetMainWnd()->PostMessage(WM_CLOSE);
  374 + return 0;
  375 + }
  376 + Session::Instance().OnValid(); // If login succeeded, recover the session state to be "not expired".
  377 + return 0;
  378 +}
central_clearing_system/ETradeClient/mfc_ui/pay_dlg.h
@@ -25,6 +25,9 @@ public: @@ -25,6 +25,9 @@ public:
25 afx_msg void OnBnClickedPayButtonClose(); 25 afx_msg void OnBnClickedPayButtonClose();
26 afx_msg void OnBnClickedPayButtonPay(); 26 afx_msg void OnBnClickedPayButtonPay();
27 afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); 27 afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  28 + afx_msg LRESULT OnSessionExpired(WPARAM wParam, LPARAM lParam);
  29 + afx_msg void OnBnClickedPayButtonPassword();
  30 + virtual BOOL PreTranslateMessage(MSG* pMsg);
28 31
29 private: 32 private:
30 void SetCtrlPos(); 33 void SetCtrlPos();
@@ -45,7 +48,4 @@ private: @@ -45,7 +48,4 @@ private:
45 int card_type_; 48 int card_type_;
46 49
47 HACCEL acce_; 50 HACCEL acce_;
48 -public:  
49 - afx_msg void OnBnClickedPayButtonPassword();  
50 - virtual BOOL PreTranslateMessage(MSG* pMsg);  
51 }; 51 };
central_clearing_system/ETradeClient/mfc_ui/place_order_dlg.cpp
@@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
16 #include "pay_dlg.h" 16 #include "pay_dlg.h"
17 #include "etradeclient/hardware/hardware_cmd.h" 17 #include "etradeclient/hardware/hardware_cmd.h"
18 #include "etradeclient/boost_patch/property_tree/json_parser.hpp" 18 #include "etradeclient/boost_patch/property_tree/json_parser.hpp"
  19 +#include "LoginDialog.h"
19 20
20 21
21 // PlaceOrderDlg 对话框 22 // PlaceOrderDlg 对话框
@@ -81,6 +82,7 @@ BEGIN_MESSAGE_MAP(PlaceOrderDlg, CDialogEx) @@ -81,6 +82,7 @@ BEGIN_MESSAGE_MAP(PlaceOrderDlg, CDialogEx)
81 ON_WM_SETFOCUS() 82 ON_WM_SETFOCUS()
82 ON_BN_CLICKED(IDC_BUTTON_SWIP_CARD, &PlaceOrderDlg::OnBnClickedButtonSwipCard) 83 ON_BN_CLICKED(IDC_BUTTON_SWIP_CARD, &PlaceOrderDlg::OnBnClickedButtonSwipCard)
83 ON_MESSAGE(WM_ORDER_DELETE_ORDER, &PlaceOrderDlg::DeleteComm) 84 ON_MESSAGE(WM_ORDER_DELETE_ORDER, &PlaceOrderDlg::DeleteComm)
  85 + ON_MESSAGE(WM_CEF_SESSION_EXPIRED, &PlaceOrderDlg::OnSessionExpired)
84 END_MESSAGE_MAP() 86 END_MESSAGE_MAP()
85 87
86 88
@@ -453,6 +455,7 @@ void PlaceOrderDlg::OnBnClickedButtonPay() @@ -453,6 +455,7 @@ void PlaceOrderDlg::OnBnClickedButtonPay()
453 error_msg = err_msg.c_str(); 455 error_msg = err_msg.c_str();
454 break; 456 break;
455 } 457 }
  458 + std::string response_header = request.ReadResponseHeader();
456 std::string response_body = request.ReadResponseBody(); 459 std::string response_body = request.ReadResponseBody();
457 if (response_body.empty()) 460 if (response_body.empty())
458 { 461 {
@@ -465,6 +468,20 @@ void PlaceOrderDlg::OnBnClickedButtonPay() @@ -465,6 +468,20 @@ void PlaceOrderDlg::OnBnClickedButtonPay()
465 bool card_res = false; 468 bool card_res = false;
466 try //Parse the configuration file 469 try //Parse the configuration file
467 { 470 {
  471 + int status_index = response_header.find("sessionStatus");
  472 + if (std::string::npos == status_index)
  473 + {
  474 + LOG_ERROR(L"解析服务器返回的登录结果信息时出错!请确认返回数据不为空,返回的数据格式为正确的Json格式!");
  475 + error_msg = CString(L"解析服务器返回的登录结果信息时出错!请确认返回数据不为空,返回的数据格式为正确的Json格式!");
  476 + break;
  477 + }
  478 + std::string status = response_header.substr(status_index + 15, 1);
  479 + if (status.compare("0") == 0)
  480 + {
  481 + SendMessage(WM_CEF_SESSION_EXPIRED);
  482 + break;
  483 + }
  484 +
468 PT::ptree ptree; 485 PT::ptree ptree;
469 std::stringstream ss; 486 std::stringstream ss;
470 ss << response_body; 487 ss << response_body;
@@ -858,8 +875,9 @@ bool PlaceOrderDlg::GetCardName(CString &amp;num, CString &amp;name, int type) @@ -858,8 +875,9 @@ bool PlaceOrderDlg::GetCardName(CString &amp;num, CString &amp;name, int type)
858 result = false; 875 result = false;
859 break; 876 break;
860 } 877 }
  878 + std::string response_header = request.ReadResponseHeader();
861 std::string response_body = request.ReadResponseBody(); 879 std::string response_body = request.ReadResponseBody();
862 - if (response_body.empty()) 880 + if (response_body.empty() || response_header.empty())
863 { 881 {
864 LOG_ERROR(L"获取服务器响应数据失败,请确保网络连接正常!"); 882 LOG_ERROR(L"获取服务器响应数据失败,请确保网络连接正常!");
865 name = CString(L"获取服务器响应数据失败,请确保网络连接正常!"); 883 name = CString(L"获取服务器响应数据失败,请确保网络连接正常!");
@@ -871,6 +889,22 @@ bool PlaceOrderDlg::GetCardName(CString &amp;num, CString &amp;name, int type) @@ -871,6 +889,22 @@ bool PlaceOrderDlg::GetCardName(CString &amp;num, CString &amp;name, int type)
871 bool card_res = false; 889 bool card_res = false;
872 try //Parse the configuration file 890 try //Parse the configuration file
873 { 891 {
  892 + int status_index = response_header.find("sessionStatus");
  893 + if (std::string::npos == status_index)
  894 + {
  895 + LOG_ERROR(L"解析服务器返回的登录结果信息时出错!请确认返回数据不为空,返回的数据格式为正确的Json格式!");
  896 + name = CString(L"解析服务器返回的登录结果信息时出错!请确认返回数据不为空,返回的数据格式为正确的Json格式!");
  897 + result = false;
  898 + break;
  899 + }
  900 + std::string status = response_header.substr(status_index + 15, 1);
  901 + if (status.compare("0") == 0)
  902 + {
  903 + SendMessage(WM_CEF_SESSION_EXPIRED);
  904 + result = false;
  905 + break;
  906 + }
  907 +
874 PT::ptree ptree; 908 PT::ptree ptree;
875 std::stringstream ss; 909 std::stringstream ss;
876 ss << response_body; 910 ss << response_body;
@@ -935,6 +969,8 @@ bool PlaceOrderDlg::GetCommName(CString &amp;num, CString&amp; card, CString &amp;name, long @@ -935,6 +969,8 @@ bool PlaceOrderDlg::GetCommName(CString &amp;num, CString&amp; card, CString &amp;name, long
935 result = false; 969 result = false;
936 break; 970 break;
937 } 971 }
  972 +
  973 + std::string response_header = request.ReadResponseHeader();
938 std::string response_body = request.ReadResponseBody(); 974 std::string response_body = request.ReadResponseBody();
939 975
940 if (response_body.empty()) 976 if (response_body.empty())
@@ -949,6 +985,22 @@ bool PlaceOrderDlg::GetCommName(CString &amp;num, CString&amp; card, CString &amp;name, long @@ -949,6 +985,22 @@ bool PlaceOrderDlg::GetCommName(CString &amp;num, CString&amp; card, CString &amp;name, long
949 bool card_res = false; 985 bool card_res = false;
950 try //Parse the configuration file 986 try //Parse the configuration file
951 { 987 {
  988 + int status_index = response_header.find("sessionStatus");
  989 + if (std::string::npos == status_index)
  990 + {
  991 + LOG_ERROR(L"解析服务器返回的登录结果信息时出错!请确认返回数据不为空,返回的数据格式为正确的Json格式!");
  992 + name = CString(L"解析服务器返回的登录结果信息时出错!请确认返回数据不为空,返回的数据格式为正确的Json格式!");
  993 + result = false;
  994 + break;
  995 + }
  996 + std::string status = response_header.substr(status_index + 15, 1);
  997 + if (status.compare("0") == 0)
  998 + {
  999 + SendMessage(WM_CEF_SESSION_EXPIRED);
  1000 + result = false;
  1001 + break;
  1002 + }
  1003 +
952 PT::ptree ptree; 1004 PT::ptree ptree;
953 std::stringstream ss; 1005 std::stringstream ss;
954 ss << response_body; 1006 ss << response_body;
@@ -1159,6 +1211,9 @@ void PlaceOrderDlg::EmptyCtrl(bool is_empty_buyer) @@ -1159,6 +1211,9 @@ void PlaceOrderDlg::EmptyCtrl(bool is_empty_buyer)
1159 1211
1160 void PlaceOrderDlg::OnBnClickedButtonSwipCard() 1212 void PlaceOrderDlg::OnBnClickedButtonSwipCard()
1161 { 1213 {
  1214 + //for test
  1215 + //OnSessionExpired(NULL, NULL);
  1216 + //
1162 SetErrorMsg(CString(L"")); 1217 SetErrorMsg(CString(L""));
1163 EmptyCtrl(true); 1218 EmptyCtrl(true);
1164 InitList(); 1219 InitList();
@@ -1316,3 +1371,15 @@ afx_msg LRESULT PlaceOrderDlg::DeleteComm(WPARAM wParam, LPARAM lParam) @@ -1316,3 +1371,15 @@ afx_msg LRESULT PlaceOrderDlg::DeleteComm(WPARAM wParam, LPARAM lParam)
1316 product_list_.Invalidate(TRUE); 1371 product_list_.Invalidate(TRUE);
1317 return 0; 1372 return 0;
1318 } 1373 }
  1374 +
  1375 +LRESULT PlaceOrderDlg::OnSessionExpired(WPARAM wParam, LPARAM lParam)
  1376 +{
  1377 + if (!CLoginDialog(L"当前连接已过期,请重新登录!", this).Launch())
  1378 + {
  1379 + AfxGetMainWnd()->PostMessage(WM_CLOSE);
  1380 + return 0;
  1381 + }
  1382 + Session::Instance().OnValid(); // If login succeeded, recover the session state to be "not expired".
  1383 + //m_user_msg_monitor.Start(); // Start again after relogged in.
  1384 + return 0;
  1385 +}
central_clearing_system/ETradeClient/mfc_ui/place_order_dlg.h
@@ -59,6 +59,7 @@ public: @@ -59,6 +59,7 @@ public:
59 afx_msg void OnSetFocus(CWnd* pOldWnd); 59 afx_msg void OnSetFocus(CWnd* pOldWnd);
60 afx_msg void OnBnClickedButtonSwipCard(); 60 afx_msg void OnBnClickedButtonSwipCard();
61 afx_msg LRESULT DeleteComm(WPARAM wParam, LPARAM lParam); 61 afx_msg LRESULT DeleteComm(WPARAM wParam, LPARAM lParam);
  62 + afx_msg LRESULT OnSessionExpired(WPARAM wParam, LPARAM lParam);
62 63
63 // ¶Ô»°¿òÊý¾Ý 64 // ¶Ô»°¿òÊý¾Ý
64 enum { IDD = IDD_DIALOG_PLACE_ORDER }; 65 enum { IDD = IDD_DIALOG_PLACE_ORDER };
central_clearing_system/out/Win32/综合业务系统.zip deleted 100644 → 0
No preview for this file type
etrade_card_client/Resource/Menu/Menu.lnk deleted 100644 → 0
No preview for this file type