3c2353cd
杜方
1、畅游通核销app源码提交;
|
1
2
3
4
5
6
|
package com.ectrip.trips.net;
import java.util.HashMap;
import java.util.List;
import android.content.Context;
|
efb28bd0
杜方
1、畅游通核销app:增加不同查询...
|
7
|
import android.text.TextUtils;
|
3c2353cd
杜方
1、畅游通核销app源码提交;
|
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import android.widget.Toast;
import com.ectrip.cyt.base.DataTrans;
import com.ectrip.cyt.callback.HttpCallback;
import com.ectrip.cyt.config.DevicTool;
import com.ectrip.cyt.config.MyApp;
import com.ectrip.cyt.constant.LogoType;
import com.ectrip.cyt.constant.constant;
import com.ectrip.cyt.request.ConsumeOrderRequest;
import com.ectrip.cyt.request.DetectVersionRequest;
import com.ectrip.cyt.request.LoginRequest;
import com.ectrip.cyt.request.ProductOfConsumeOrder;
import com.ectrip.cyt.request.QueryConsumedDetailRequest;
import com.ectrip.cyt.request.QueryOrderRequest;
import com.ectrip.cyt.request.ReprintVoucherRequest;
import com.ectrip.cyt.request.StatisticOrderRequest;
import com.ectrip.cyt.ui.BaseActivity;
import com.ectrip.cyt.utils.LogUtil;
import com.ectrip.cyt.utils.SharedPreferences2Obj;
/**
* @author jigo 网络访问工具类
*/
public class HttpHelper extends HttpHelperCore {
|
72876d86
杜方
畅游通核销app: 1.增加550...
|
32
|
public static final String TAG="HttpHelper";
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
33
34
|
private Context mContext;
public static HttpHelper helper = null;
|
3c2353cd
杜方
1、畅游通核销app源码提交;
|
35
|
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
36
37
38
39
40
41
|
private String devType = "MDEV"; // 移动终端:MDEV 售票窗口:WDEV
private static Boolean testMOdel = null;
private Integer type;
private static BaseActivity activity;
// public static final String action="/service/terminal-2.action";
public final String action = "/service/terminal-3.do";
|
3c2353cd
杜方
1、畅游通核销app源码提交;
|
42
|
|
3c2353cd
杜方
1、畅游通核销app源码提交;
|
43
|
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
44
45
46
47
48
49
50
|
public static HttpHelper getInstance(Context mContext) {
if (helper == null) {
helper = new HttpHelper(mContext);
}
activity = (BaseActivity) mContext;
return helper;
}
|
3c2353cd
杜方
1、畅游通核销app源码提交;
|
51
|
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
52
53
54
55
56
57
58
|
private HttpHelper(Context mContext) {
this.mContext = mContext;
testMOdel = SharedPreferences2Obj.getInstance(mContext)
.setName("config").getObject("testMOdel", Boolean.class);
type = SharedPreferences2Obj.getInstance(mContext)
.setName("MachineType").getObject("type", Integer.class);
}
|
3c2353cd
杜方
1、畅游通核销app源码提交;
|
59
|
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
60
61
62
63
64
65
66
67
68
69
70
|
/**
* 获取终端获取订单信息
*
* @param method 验证码: CODE 手机号码: PHONE 证件号码: ID 订单号码: ORDER
* @param code
*/
QueryOrderRequest orderRequest;
public void queryOrder(String method, String code, String phone,
String credentials, String orderId, String startDate,
String endDate, String pageSize, String count, HttpCallback<DataTrans> httpCallback) {
|
efb28bd0
杜方
1、畅游通核销app:增加不同查询...
|
71
|
if (!TextUtils.isEmpty(orderId) && (orderId.startsWith("TY_") || (orderId.startsWith("PMS_")))) {
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
String voucher = orderId;
orderRequest = new QueryOrderRequest(method, code,
phone, credentials, "", startDate, endDate, pageSize, count, voucher);
} else {
orderRequest = new QueryOrderRequest(method, code,
phone, credentials, orderId, startDate, endDate, pageSize, count, "");
}
orderRequest.setVer(MyApp.getInstance().getVer());
orderRequest.setVerType(MyApp.getInstance().getVerType());
orderRequest.setDevId(DevicTool.getInstance().getDevId());
orderRequest.setDevType(devType);
HashMap<String, String> map = new HashMap<String, String>();
map.put("method", "queryOrder");
String requestParam = DataTool.envelopeData(orderRequest, MyApp
.getInstance().getSignkey(), MyApp.getInstance().getIdentity());
map.put("requestParam", requestParam);
|
72876d86
杜方
畅游通核销app: 1.增加550...
|
88
|
LogUtil.i(TAG,requestParam + "requestParam");
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
89
90
91
|
executeHttpPost(
"http://" + MyApp.getInstance().getServiceIp() + action, "",
map, httpCallback, "data", DataTrans.class);
|
72876d86
杜方
畅游通核销app: 1.增加550...
|
92
|
LogUtil.i(TAG,"url = " + "http://" + MyApp.getInstance().getServiceIp() + action);
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
if (testMOdel != null && testMOdel) { // 这个是调试弹框
if (type == null) {
return;
}
if (activity == null) {
return;
}
activity.MToast(mContext, "服务地址:"
+ MyApp.getInstance().getServiceIp() + ";" + "机器码:"
+ DevicTool.getInstance().getDevId() + ";" + credentials + ";"
+ phone + ";", Toast.LENGTH_LONG);
}
}
/**
* @param orderId 订单 ID
* @param count 消费数量
* @param password 订单密码
* @param verifyPassword 是否验证密码 是: TRUE 否: FALSE
* @param httpCallback 回调
*/
public void consumeOrder(String orderId, String count, String password,
String verifyPassword, String consumedSeq, List<ProductOfConsumeOrder> products, HttpCallback<DataTrans> httpCallback) {
Long accountId = MyApp.getInstance().getAccountId();
ConsumeOrderRequest consumeCount = new ConsumeOrderRequest(orderId,
count, password, verifyPassword, consumedSeq, products);
consumeCount.setVer(MyApp.getInstance().getVer());
consumeCount.setVerType(MyApp.getInstance().getVerType());
consumeCount.setDevId(DevicTool.getInstance().getDevId());
consumeCount.setAccountId(accountId);
consumeCount.setDevType(devType);
HashMap<String, String> map = new HashMap<String, String>();
map.put("method", "consumeOrder");
String requestParam = DataTool.envelopeData(consumeCount, MyApp
.getInstance().getSignkey(), MyApp.getInstance().getIdentity());
map.put("requestParam", requestParam);
|
72876d86
杜方
畅游通核销app: 1.增加550...
|
130
|
LogUtil.i(TAG,"requestParam" + requestParam);
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
131
132
133
|
executeHttpPost(
"http://" + MyApp.getInstance().getServiceIp() + action, "",
map, httpCallback, "data", DataTrans.class);
|
3c2353cd
杜方
1、畅游通核销app源码提交;
|
134
|
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
135
136
137
138
139
140
141
142
143
144
145
146
147
|
if (testMOdel != null && testMOdel) { // 这个是调试弹框
if (type == null) {
return;
}
if (activity == null) {
return;
}
activity.MToast(mContext, "服务地址:"
+ MyApp.getInstance().getServiceIp() + ";" + "机器码:"
+ DevicTool.getInstance().getDevId() + ";" + "订单号:" + orderId
+ ";", Toast.LENGTH_LONG);
}
}
|
3c2353cd
杜方
1、畅游通核销app源码提交;
|
148
|
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
public void consumeOrderPart(String orderId, String count, String password,
String verifyPassword, String consumedSeq, List<ProductOfConsumeOrder> products, String id, boolean isId, HttpCallback<DataTrans> httpCallback) {
Long accountId = MyApp.getInstance().getAccountId();
ConsumeOrderRequest consumeCount = new ConsumeOrderRequest(orderId,
count, password, verifyPassword, consumedSeq, products);
consumeCount.setVer(MyApp.getInstance().getVer());
consumeCount.setVerType(MyApp.getInstance().getVerType());
consumeCount.setDevId(DevicTool.getInstance().getDevId());
consumeCount.setAccountId(accountId);
consumeCount.setDevType(devType);
if (isId) {
consumeCount.setCredentials(id);
} else {
consumeCount.setVoucher(id);
}
|
3c2353cd
杜方
1、畅游通核销app源码提交;
|
164
|
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
165
166
167
168
169
|
HashMap<String, String> map = new HashMap<String, String>();
map.put("method", "consumeOrder");
String requestParam = DataTool.envelopeData(consumeCount, MyApp
.getInstance().getSignkey(), MyApp.getInstance().getIdentity());
map.put("requestParam", requestParam);
|
72876d86
杜方
畅游通核销app: 1.增加550...
|
170
|
LogUtil.i(TAG,"requestParam" + requestParam);
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
171
172
173
|
executeHttpPost(
"http://" + MyApp.getInstance().getServiceIp() + action, "",
map, httpCallback, "data", DataTrans.class);
|
3c2353cd
杜方
1、畅游通核销app源码提交;
|
174
|
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
175
176
177
178
179
180
181
182
183
184
185
186
187
|
if (testMOdel != null && testMOdel) { // 这个是调试弹框
if (type == null) {
return;
}
if (activity == null) {
return;
}
activity.MToast(mContext, "服务地址:"
+ MyApp.getInstance().getServiceIp() + ";" + "机器码:"
+ DevicTool.getInstance().getDevId() + ";" + "订单号:" + orderId
+ ";", Toast.LENGTH_LONG);
}
}
|
3c2353cd
杜方
1、畅游通核销app源码提交;
|
188
|
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
/**
* @param startdate
* @param enddate
* @param month
* @param httpCallback
* @param method DAY MON 统计订单
*/
public void statisticsOrder(String method, String startdate,
String enddate, String month, HttpCallback<DataTrans> httpCallback) {
StatisticOrderRequest consumeCount = new StatisticOrderRequest(method,
startdate, enddate, month);
consumeCount.setVer(MyApp.getInstance().getVer());
consumeCount.setVerType(MyApp.getInstance().getVerType());
consumeCount.setDevId(DevicTool.getInstance().getDevId());
consumeCount.setDevType(devType);
HashMap<String, String> map = new HashMap<String, String>();
map.put("method", "consumeSummary");
String requestParam = DataTool.envelopeData(consumeCount, MyApp
.getInstance().getSignkey(), MyApp.getInstance().getIdentity());
map.put("requestParam", requestParam);
|
72876d86
杜方
畅游通核销app: 1.增加550...
|
209
|
LogUtil.i(TAG,"requestParam" + requestParam);
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
executeHttpPost(
"http://" + MyApp.getInstance().getServiceIp() + action, "",
map, httpCallback, "data", DataTrans.class);
if (testMOdel != null && testMOdel) { // 这个是调试弹框
if (type == null) {
return;
}
if (activity == null) {
return;
}
activity.MToast(mContext, "服务地址:"
+ MyApp.getInstance().getServiceIp() + ";" + "机器码:"
+ DevicTool.getInstance().getDevId() + ";" + "开始时间:"
+ startdate + ";" + "结束:" + enddate + ";" + "月份:" + month,
Toast.LENGTH_LONG);
}
}
|
3c2353cd
杜方
1、畅游通核销app源码提交;
|
227
|
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
/**
* @param orderId 订单号
* @param httpCallback 不打小票列表
*/
public void queryConsumedDetail(String orderId,
HttpCallback<DataTrans> httpCallback) {
QueryConsumedDetailRequest reprintVoucherRequest = new QueryConsumedDetailRequest();
reprintVoucherRequest.setOrderId(orderId);
reprintVoucherRequest.setVer(MyApp.getInstance().getVer());
reprintVoucherRequest.setVerType(MyApp.getInstance().getVerType());
reprintVoucherRequest.setDevId(DevicTool.getInstance().getDevId());
reprintVoucherRequest.setDevType(devType);
HashMap<String, String> map = new HashMap<String, String>();
map.put("method", "consumeHistoryQuery");
String requestParam = DataTool.envelopeData(reprintVoucherRequest,
MyApp.getInstance().getSignkey(), MyApp.getInstance()
.getIdentity());
map.put("requestParam", requestParam);
|
72876d86
杜方
畅游通核销app: 1.增加550...
|
246
|
LogUtil.i(TAG,"requestParam" + requestParam);
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
|
executeHttpPost(
"http://" + MyApp.getInstance().getServiceIp() + action, "",
map, httpCallback, "data", DataTrans.class);
if (testMOdel != null && testMOdel) { // 这个是调试弹框
if (type == null) {
return;
}
if (activity == null) {
return;
}
activity.MToast(mContext, "服务地址:"
+ MyApp.getInstance().getServiceIp() + ";" + "机器码:"
+ DevicTool.getInstance().getDevId() + ";" + "补打订单:" + orderId,
Toast.LENGTH_LONG);
}
}
|
3c2353cd
杜方
1、畅游通核销app源码提交;
|
263
|
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
|
/**
* @param orderId 订单号
* @param httpCallback 补打小票信息
*/
public void reprintVoucher(String orderId, List<String> orderDetailIds,
HttpCallback<DataTrans> httpCallback) {
ReprintVoucherRequest reprintVoucherRequest = new ReprintVoucherRequest();
reprintVoucherRequest.setOrderId(orderId);
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < orderDetailIds.size(); i++) {
if (i != orderDetailIds.size() - 1) {
buffer.append(orderDetailIds.get(i) + ",");
} else {
buffer.append(orderDetailIds.get(i));
}
}
reprintVoucherRequest.setOrderDetailIds(buffer.toString());
reprintVoucherRequest.setVer(MyApp.getInstance().getVer());
reprintVoucherRequest.setVerType(MyApp.getInstance().getVerType());
reprintVoucherRequest.setDevId(DevicTool.getInstance().getDevId());
reprintVoucherRequest.setDevType(devType);
HashMap<String, String> map = new HashMap<String, String>();
map.put("method", "reprintVoucher");
String requestParam = DataTool.envelopeData(reprintVoucherRequest,
MyApp.getInstance().getSignkey(), MyApp.getInstance()
.getIdentity());
map.put("requestParam", requestParam);
|
72876d86
杜方
畅游通核销app: 1.增加550...
|
291
|
LogUtil.i(TAG,"requestParam" + requestParam);
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
|
executeHttpPost(
"http://" + MyApp.getInstance().getServiceIp() + action, "",
map, httpCallback, "data", DataTrans.class);
if (testMOdel != null && testMOdel) { // 这个是调试弹框
if (type == null) {
return;
}
if (activity == null) {
return;
}
activity.MToast(mContext, "服务地址:"
+ MyApp.getInstance().getServiceIp() + ";" + "机器码:"
+ DevicTool.getInstance().getDevId() + ";" + "补打订单:" + orderId,
Toast.LENGTH_LONG);
}
}
|
3c2353cd
杜方
1、畅游通核销app源码提交;
|
308
|
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
309
310
311
312
313
314
315
|
/**
* 在线升级
*
* @param curVersionName
* @param signkey 标识
* @param identity 编码
* @param url ip或者域名
|
3c2353cd
杜方
1、畅游通核销app源码提交;
|
316
|
*/
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
|
public void versionUpdate(String curVersionName, String signkey,
String identity, String url, HttpCallback<DataTrans> httpCallback) {
DetectVersionRequest detectVersionRequest = new DetectVersionRequest();
detectVersionRequest.setDevId(DevicTool.getInstance().getDevId());
detectVersionRequest.setDevType("MDEV");
detectVersionRequest.setVer(curVersionName);
if (constant.logoMark == LogoType.CYT.getValue() || constant.logoMark == LogoType.EMC.getValue()) {
detectVersionRequest.setVerType("CT");
} else if (constant.logoMark == LogoType.QNE.getValue()) {
detectVersionRequest.setVerType("QT");
}
HashMap<String, String> map = new HashMap<String, String>();
map.put("method", "detectVersion");
String requestParam = DataTool.envelopeData(detectVersionRequest,
signkey, identity);
map.put("requestParam", requestParam);
|
72876d86
杜方
畅游通核销app: 1.增加550...
|
333
|
LogUtil.i(TAG,"requestParam" + requestParam);
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
334
335
336
|
executeHttpPost("http://" + url + action, "", map, httpCallback,
"data", DataTrans.class);
}
|
3c2353cd
杜方
1、畅游通核销app源码提交;
|
337
|
|
3c2353cd
杜方
1、畅游通核销app源码提交;
|
338
|
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
|
/**
* 操作员登录
*
* @param username
* @param password
* @param httpCallback
*/
public void login(String username, String password, HttpCallback<DataTrans> httpCallback) {
LoginRequest loginRequest = new LoginRequest();
loginRequest.setAccountName(username);
loginRequest.setPassword(password);
loginRequest.setVer(MyApp.getInstance().getVer());
loginRequest.setVerType(MyApp.getInstance().getVerType());
loginRequest.setDevId(DevicTool.getInstance().getDevId());
loginRequest.setDevType(devType);
HashMap<String, String> map = new HashMap<String, String>();
map.put("method", "login");
String requestParam = DataTool.envelopeData(loginRequest,
MyApp.getInstance().getSignkey(), MyApp.getInstance()
.getIdentity());
map.put("requestParam", requestParam);
|
72876d86
杜方
畅游通核销app: 1.增加550...
|
361
|
LogUtil.i(TAG,"requestParam" + requestParam);
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
362
363
364
|
executeHttpPost(
"http://" + MyApp.getInstance().getServiceIp() + action, "",
map, httpCallback, "data", DataTrans.class);
|
3c2353cd
杜方
1、畅游通核销app源码提交;
|
365
366
|
|
2707d233
杜方
1、畅游通核销app;修改扫二维码...
|
367
|
}
|
3c2353cd
杜方
1、畅游通核销app源码提交;
|
368
|
}
|