Commit 10f6860604d1fdd92516e3d02f3473d67e38a009
1 parent
6d918b59
feat<central_clearing_system>:新增下单流程超时处理
下单超时调用登录界面,重新登录继续之前操作,失败退出系统。
Showing
14 changed files
with
140 additions
and
22 deletions
central_clearing_system/Config/url_cfg.json
central_clearing_system/ETradeClient.rc
... | ... | @@ -146,15 +146,14 @@ END |
146 | 146 | |
147 | 147 | IDR_ACCELERATOR_ORDER ACCELERATORS |
148 | 148 | BEGIN |
149 | + "A", ID_ACCELERATOR_A, VIRTKEY, NOINVERT | |
149 | 150 | VK_DOWN, ID_ACCELERATOR_DOWN, VIRTKEY, NOINVERT |
150 | 151 | VK_RETURN, ID_ACCELERATOR_ENTER, VIRTKEY, NOINVERT |
152 | + "F", ID_ACCELERATOR_F, VIRTKEY, NOINVERT | |
151 | 153 | VK_F11, ID_ACCELERATOR_F11, VIRTKEY, NOINVERT |
154 | + "S", ID_ACCELERATOR_S, VIRTKEY, NOINVERT | |
152 | 155 | VK_TAB, ID_ACCELERATOR_TAB, VIRTKEY, NOINVERT |
153 | 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 | 157 | "X", ID_ACCELERATOR_X, VIRTKEY, NOINVERT |
159 | 158 | END |
160 | 159 | |
... | ... | @@ -226,7 +225,7 @@ BEGIN |
226 | 225 | END |
227 | 226 | |
228 | 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 | 229 | CAPTION "结算下单" |
231 | 230 | FONT 12, "微软雅黑", 400, 0, 0x86 |
232 | 231 | BEGIN |
... | ... | @@ -278,8 +277,8 @@ END |
278 | 277 | // |
279 | 278 | |
280 | 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 | 282 | FILEFLAGSMASK 0x3fL |
284 | 283 | #ifdef _DEBUG |
285 | 284 | FILEFLAGS 0x1L |
... | ... | @@ -295,13 +294,13 @@ BEGIN |
295 | 294 | BLOCK "080404b0" |
296 | 295 | BEGIN |
297 | 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 | 299 | VALUE "InternalName", "ETradeClient.exe" |
301 | 300 | VALUE "LegalCopyright", "(C) 地利集团。 保留所有权利。" |
302 | 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 | 304 | END |
306 | 305 | END |
307 | 306 | BLOCK "VarFileInfo" | ... | ... |
central_clearing_system/ETradeClient.vcxproj
... | ... | @@ -45,6 +45,7 @@ |
45 | 45 | <PropertyGroup Label="UserMacros" /> |
46 | 46 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
47 | 47 | <LinkIncremental>true</LinkIncremental> |
48 | + <TargetName>综合业务系统_beta</TargetName> | |
48 | 49 | </PropertyGroup> |
49 | 50 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
50 | 51 | <LinkIncremental>false</LinkIncremental> | ... | ... |
central_clearing_system/ETradeClient/browser/async_js_callback_handler.cpp
... | ... | @@ -70,7 +70,21 @@ namespace HW |
70 | 70 | PT::read_json(ss, ptree); |
71 | 71 | std::string cmd = ptree.get<std::string>(JSON_TAG_CMD); |
72 | 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 | 88 | std::string seq = ptree.get<std::string>(JSON_TAG_SEQ); |
75 | 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<CefBrowser> browser, C |
407 | 407 | CEF_REQUIRE_IO_THREAD(); |
408 | 408 | |
409 | 409 | const CefString kTimeoutHeader("sessionStatus"); |
410 | - const CefString kTimeout("expired"); | |
410 | + const CefString kTimeout("0"); //³¬Ê±Îª0£¬Õý³£Îª1 | |
411 | 411 | |
412 | 412 | auto& url = request->GetURL(); |
413 | 413 | CefRequest::HeaderMap headerMap; | ... | ... |
central_clearing_system/ETradeClient/browser/popup_browser_handler.cpp
... | ... | @@ -63,7 +63,7 @@ bool PopupBrowserHandler::OnResourceResponse(CefRefPtr<CefBrowser> browser, CefR |
63 | 63 | CEF_REQUIRE_IO_THREAD(); |
64 | 64 | |
65 | 65 | const CefString kTimeoutHeader("sessionStatus"); |
66 | - const CefString kTimeout("expired"); | |
66 | + const CefString kTimeout("0"); | |
67 | 67 | |
68 | 68 | auto& url = request->GetURL(); |
69 | 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 | 102 | {} |
103 | 103 | |
104 | 104 | CMainFrame::~CMainFrame() |
105 | -{} | |
105 | +{ | |
106 | +} | |
106 | 107 | |
107 | 108 | bool CMainFrame::Launch() |
108 | 109 | { |
... | ... | @@ -171,8 +172,8 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) |
171 | 172 | { |
172 | 173 | do |
173 | 174 | { |
174 | - if (CFrameWnd::OnCreate(lpCreateStruct) == -1) | |
175 | - break; | |
175 | + /*if (CFrameWnd::OnCreate(lpCreateStruct) == -1) | |
176 | + break;*/ | |
176 | 177 | if (!m_menu_res_auth_manager.UpdateAuth()) |
177 | 178 | break; |
178 | 179 | if (!FilterMenuBar()) |
... | ... | @@ -183,6 +184,9 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) |
183 | 184 | break; |
184 | 185 | return 0; // Return 0 if all succeed. |
185 | 186 | } while (0); |
187 | + | |
188 | + | |
189 | + | |
186 | 190 | return -1; // Return -1 to indicate error happens. |
187 | 191 | } |
188 | 192 | ... | ... |
central_clearing_system/ETradeClient/mfc_ui/MainFrm.h
central_clearing_system/ETradeClient/mfc_ui/pay_dlg.cpp
... | ... | @@ -19,6 +19,7 @@ |
19 | 19 | #include "etradeclient/hardware/hardware_cmd.h" |
20 | 20 | #include "ETradeClient/utility/logging.h" |
21 | 21 | #include <sstream> |
22 | +#include "LoginDialog.h" | |
22 | 23 | |
23 | 24 | |
24 | 25 | // PayDlg 对话框 |
... | ... | @@ -59,6 +60,7 @@ BEGIN_MESSAGE_MAP(PayDlg, CDialogEx) |
59 | 60 | ON_COMMAND(ID_ACCELERATOR_A, &PayDlg::OnBnClickedPayButtonPassword) |
60 | 61 | ON_COMMAND(ID_ACCELERATOR_F, &PayDlg::OnBnClickedPayButtonPay) |
61 | 62 | ON_COMMAND(ID_ACCELERATOR_X, &PayDlg::OnBnClickedPayButtonClose) |
63 | + ON_MESSAGE(WM_CEF_SESSION_EXPIRED, &PayDlg::OnSessionExpired) | |
62 | 64 | END_MESSAGE_MAP() |
63 | 65 | |
64 | 66 | |
... | ... | @@ -162,6 +164,9 @@ void PayDlg::OnBnClickedPayButtonClose() |
162 | 164 | |
163 | 165 | void PayDlg::OnBnClickedPayButtonPay() |
164 | 166 | { |
167 | + //for test | |
168 | + //OnSessionExpired(NULL, NULL); | |
169 | + // | |
165 | 170 | LOG_TRACE(L"支付订单"); |
166 | 171 | CString error_msg; |
167 | 172 | |
... | ... | @@ -211,6 +216,7 @@ void PayDlg::OnBnClickedPayButtonPay() |
211 | 216 | error_msg = err_msg.c_str(); |
212 | 217 | break; |
213 | 218 | } |
219 | + std::string response_header = request.ReadResponseHeader(); | |
214 | 220 | std::string response_body = request.ReadResponseBody(); |
215 | 221 | if (response_body.empty()) |
216 | 222 | { |
... | ... | @@ -223,6 +229,20 @@ void PayDlg::OnBnClickedPayButtonPay() |
223 | 229 | bool card_res = false; |
224 | 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 | 246 | PT::ptree ptree; |
227 | 247 | std::stringstream ss; |
228 | 248 | ss << response_body; |
... | ... | @@ -345,3 +365,14 @@ BOOL PayDlg::PreTranslateMessage(MSG* pMsg) |
345 | 365 | |
346 | 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 | 25 | afx_msg void OnBnClickedPayButtonClose(); |
26 | 26 | afx_msg void OnBnClickedPayButtonPay(); |
27 | 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 | 32 | private: |
30 | 33 | void SetCtrlPos(); |
... | ... | @@ -45,7 +48,4 @@ private: |
45 | 48 | int card_type_; |
46 | 49 | |
47 | 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 | 16 | #include "pay_dlg.h" |
17 | 17 | #include "etradeclient/hardware/hardware_cmd.h" |
18 | 18 | #include "etradeclient/boost_patch/property_tree/json_parser.hpp" |
19 | +#include "LoginDialog.h" | |
19 | 20 | |
20 | 21 | |
21 | 22 | // PlaceOrderDlg 对话框 |
... | ... | @@ -81,6 +82,7 @@ BEGIN_MESSAGE_MAP(PlaceOrderDlg, CDialogEx) |
81 | 82 | ON_WM_SETFOCUS() |
82 | 83 | ON_BN_CLICKED(IDC_BUTTON_SWIP_CARD, &PlaceOrderDlg::OnBnClickedButtonSwipCard) |
83 | 84 | ON_MESSAGE(WM_ORDER_DELETE_ORDER, &PlaceOrderDlg::DeleteComm) |
85 | + ON_MESSAGE(WM_CEF_SESSION_EXPIRED, &PlaceOrderDlg::OnSessionExpired) | |
84 | 86 | END_MESSAGE_MAP() |
85 | 87 | |
86 | 88 | |
... | ... | @@ -453,6 +455,7 @@ void PlaceOrderDlg::OnBnClickedButtonPay() |
453 | 455 | error_msg = err_msg.c_str(); |
454 | 456 | break; |
455 | 457 | } |
458 | + std::string response_header = request.ReadResponseHeader(); | |
456 | 459 | std::string response_body = request.ReadResponseBody(); |
457 | 460 | if (response_body.empty()) |
458 | 461 | { |
... | ... | @@ -465,6 +468,20 @@ void PlaceOrderDlg::OnBnClickedButtonPay() |
465 | 468 | bool card_res = false; |
466 | 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 | 485 | PT::ptree ptree; |
469 | 486 | std::stringstream ss; |
470 | 487 | ss << response_body; |
... | ... | @@ -858,8 +875,9 @@ bool PlaceOrderDlg::GetCardName(CString &num, CString &name, int type) |
858 | 875 | result = false; |
859 | 876 | break; |
860 | 877 | } |
878 | + std::string response_header = request.ReadResponseHeader(); | |
861 | 879 | std::string response_body = request.ReadResponseBody(); |
862 | - if (response_body.empty()) | |
880 | + if (response_body.empty() || response_header.empty()) | |
863 | 881 | { |
864 | 882 | LOG_ERROR(L"获取服务器响应数据失败,请确保网络连接正常!"); |
865 | 883 | name = CString(L"获取服务器响应数据失败,请确保网络连接正常!"); |
... | ... | @@ -871,6 +889,22 @@ bool PlaceOrderDlg::GetCardName(CString &num, CString &name, int type) |
871 | 889 | bool card_res = false; |
872 | 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 | 908 | PT::ptree ptree; |
875 | 909 | std::stringstream ss; |
876 | 910 | ss << response_body; |
... | ... | @@ -935,6 +969,8 @@ bool PlaceOrderDlg::GetCommName(CString &num, CString& card, CString &name, long |
935 | 969 | result = false; |
936 | 970 | break; |
937 | 971 | } |
972 | + | |
973 | + std::string response_header = request.ReadResponseHeader(); | |
938 | 974 | std::string response_body = request.ReadResponseBody(); |
939 | 975 | |
940 | 976 | if (response_body.empty()) |
... | ... | @@ -949,6 +985,22 @@ bool PlaceOrderDlg::GetCommName(CString &num, CString& card, CString &name, long |
949 | 985 | bool card_res = false; |
950 | 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 | 1004 | PT::ptree ptree; |
953 | 1005 | std::stringstream ss; |
954 | 1006 | ss << response_body; |
... | ... | @@ -1159,6 +1211,9 @@ void PlaceOrderDlg::EmptyCtrl(bool is_empty_buyer) |
1159 | 1211 | |
1160 | 1212 | void PlaceOrderDlg::OnBnClickedButtonSwipCard() |
1161 | 1213 | { |
1214 | + //for test | |
1215 | + //OnSessionExpired(NULL, NULL); | |
1216 | + // | |
1162 | 1217 | SetErrorMsg(CString(L"")); |
1163 | 1218 | EmptyCtrl(true); |
1164 | 1219 | InitList(); |
... | ... | @@ -1316,3 +1371,15 @@ afx_msg LRESULT PlaceOrderDlg::DeleteComm(WPARAM wParam, LPARAM lParam) |
1316 | 1371 | product_list_.Invalidate(TRUE); |
1317 | 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 | 59 | afx_msg void OnSetFocus(CWnd* pOldWnd); |
60 | 60 | afx_msg void OnBnClickedButtonSwipCard(); |
61 | 61 | afx_msg LRESULT DeleteComm(WPARAM wParam, LPARAM lParam); |
62 | + afx_msg LRESULT OnSessionExpired(WPARAM wParam, LPARAM lParam); | |
62 | 63 | |
63 | 64 | // ¶Ô»°¿òÊý¾Ý |
64 | 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