Commit 2707d233d7daef35d3d4dad5bee2987f089d4bc6

Authored by 杜方
1 parent 3c2353cd

1、畅游通核销app;修改扫二维码,身份证部分检票改为检本票,手机号和订单号检票取消部分检票

res/layout-land/app_idcard_temple.xml
... ... @@ -158,7 +158,7 @@
158 158 <TextView
159 159 android:id="@+id/X_btn"
160 160 style="@style/btn_num_land"
161   - android:text="x" />
  161 + android:text="X" />
162 162 </FrameLayout>
163 163  
164 164 <FrameLayout
... ...
res/layout/app_idcard_temple.xml
... ... @@ -165,7 +165,7 @@
165 165 <TextView
166 166 android:id="@+id/X_btn"
167 167 style="@style/btn_num"
168   - android:text="x" />
  168 + android:text="X" />
169 169 </FrameLayout>
170 170  
171 171 <FrameLayout
... ...
res/layout/group_list_item2.xml
... ... @@ -3,7 +3,8 @@
3 3 android:layout_width="match_parent"
4 4 android:layout_height="wrap_content"
5 5 android:background="#ffffff"
6   - android:orientation="vertical" >
  6 + android:orientation="vertical">
  7 +
7 8 <View
8 9 android:id="@+id/line"
9 10 android:layout_width="fill_parent"
... ... @@ -14,8 +15,7 @@
14 15 android:layout_width="wrap_content"
15 16 android:layout_height="wrap_content"
16 17 android:layout_marginLeft="10dp"
17   - android:layout_marginTop="10dp"
18   - >
  18 + android:layout_marginTop="10dp">
19 19  
20 20 <TextView
21 21 android:id="@+id/order_name"
... ... @@ -30,59 +30,58 @@
30 30 android:id="@+id/dd_id"
31 31 android:layout_width="wrap_content"
32 32 android:layout_height="wrap_content"
33   - android:layout_toRightOf="@id/order_name"
34 33 android:layout_marginLeft="5dp"
35   - android:textColor="#ff9900"
  34 + android:layout_toRightOf="@id/order_name"
36 35 android:text=""
  36 + android:textColor="#ff9900"
37 37 android:textSize="18sp" />
38 38  
39   - <TextView
40   - android:id="@+id/style_item"
41   - android:layout_below="@id/order_name"
42   - android:layout_width="wrap_content"
43   - android:layout_height="wrap_content"
44   - android:layout_marginTop="10dp"
45   - android:layout_marginLeft="10dp"
46   - android:textColor="#ff9900"
47   - android:text=""
48   - android:textSize="20sp" />
  39 + <TextView
  40 + android:id="@+id/style_item"
  41 + android:layout_width="wrap_content"
  42 + android:layout_height="wrap_content"
  43 + android:layout_below="@id/order_name"
  44 + android:layout_marginLeft="10dp"
  45 + android:layout_marginTop="10dp"
  46 + android:text=""
  47 + android:textColor="#ff9900"
  48 + android:textSize="20sp" />
49 49  
50 50  
51 51 <TextView
52 52 android:id="@+id/totalNum"
53 53 android:layout_width="wrap_content"
54 54 android:layout_height="wrap_content"
55   - android:layout_alignParentRight="true"
56 55 android:layout_below="@id/order_name"
  56 + android:layout_alignParentRight="true"
57 57 android:layout_marginTop="10dp"
58 58 android:layout_marginRight="20dp"
59   - android:textColor="#333333"
60   - android:textSize="20sp"
61 59 android:text=""
62   - />
  60 + android:textColor="#333333"
  61 + android:textSize="20sp" />
63 62  
64 63 <TextView
65 64 android:id="@+id/time_item"
66 65 android:layout_width="wrap_content"
67 66 android:layout_height="wrap_content"
68 67 android:layout_below="@id/totalNum"
69   - android:layout_marginTop="10dp"
70 68 android:layout_marginLeft="10dp"
  69 + android:layout_marginTop="10dp"
  70 + android:text=" |"
71 71 android:textColor="#333333"
72   - android:textSize="18sp"
73   - android:text=" |"/>
  72 + android:textSize="18sp" />
74 73  
75 74 <TextView
76 75 android:id="@+id/id_number"
77 76 android:layout_width="wrap_content"
78 77 android:layout_height="wrap_content"
79   - android:layout_marginTop="10dp"
80   - android:layout_marginLeft="5dp"
81 78 android:layout_below="@id/totalNum"
  79 + android:layout_marginLeft="5dp"
  80 + android:layout_marginTop="10dp"
82 81 android:layout_toRightOf="@id/time_item"
  82 + android:text=""
83 83 android:textColor="#333333"
84   - android:textSize="18sp"
85   - android:text=""/>
  84 + android:textSize="18sp" />
86 85  
87 86  
88 87 </RelativeLayout>
... ... @@ -91,39 +90,40 @@
91 90 <LinearLayout
92 91 android:layout_width="match_parent"
93 92 android:layout_height="wrap_content"
  93 + android:layout_centerHorizontal="true"
94 94 android:layout_marginLeft="20dp"
95   - android:layout_marginRight="20dp"
96 95 android:layout_marginTop="10dp"
  96 + android:layout_marginRight="20dp"
97 97 android:gravity="center"
98   - android:layout_centerHorizontal="true"
99   - android:orientation="horizontal"
100   - >
101   - <Button
102   - android:id="@+id/ticketPrint"
103   - android:layout_width="wrap_content"
104   - android:layout_height="wrap_content"
105   - android:paddingTop="10dp"
106   - android:paddingBottom="10dp"
107   - android:paddingLeft="40dp"
108   - android:paddingRight="40dp"
109   - android:background="@drawable/btn_all_shape"
110   - android:text="@string/print"
111   - android:textSize="22sp"
112   - android:textColor="#ffffff"/>
113   - <Button
114   - android:id="@+id/part"
115   - android:layout_width="wrap_content"
116   - android:layout_height="wrap_content"
117   - android:layout_marginLeft="20dp"
118   - android:paddingTop="10dp"
119   - android:paddingBottom="10dp"
120   - android:paddingLeft="20dp"
121   - android:paddingRight="20dp"
122   - android:background="@drawable/btn_part_shape"
123   - android:text="@string/part_print"
124   - android:textSize="22sp"
125   - android:visibility="gone"
126   - android:textColor="#ffffff"/>
  98 + android:orientation="horizontal">
  99 +
  100 + <Button
  101 + android:id="@+id/ticketPrint"
  102 + android:layout_width="wrap_content"
  103 + android:layout_height="wrap_content"
  104 + android:background="@drawable/btn_all_shape"
  105 + android:paddingLeft="40dp"
  106 + android:paddingTop="10dp"
  107 + android:paddingRight="40dp"
  108 + android:paddingBottom="10dp"
  109 + android:text="@string/print"
  110 + android:textColor="#ffffff"
  111 + android:textSize="22sp" />
  112 +
  113 + <Button
  114 + android:id="@+id/part"
  115 + android:layout_width="wrap_content"
  116 + android:layout_height="wrap_content"
  117 + android:layout_marginLeft="20dp"
  118 + android:background="@drawable/btn_part_shape"
  119 + android:paddingLeft="40dp"
  120 + android:paddingTop="10dp"
  121 + android:paddingRight="40dp"
  122 + android:paddingBottom="10dp"
  123 + android:text="@string/part_print"
  124 + android:textColor="#ffffff"
  125 + android:textSize="22sp"
  126 + android:visibility="gone"/>
127 127 </LinearLayout>
128 128  
129 129  
... ...
res/layout/group_list_item2_ldip.xml
... ... @@ -121,8 +121,8 @@
121 121 android:layout_marginLeft="20dp"
122 122 android:paddingTop="10dp"
123 123 android:paddingBottom="10dp"
124   - android:paddingLeft="3dp"
125   - android:paddingRight="3dp"
  124 + android:paddingLeft="10dp"
  125 + android:paddingRight="10dp"
126 126 android:background="@drawable/btn_part_shape"
127 127 android:text="@string/part_print"
128 128 android:textSize="22sp"
... ...
res/values/strings.xml
... ... @@ -227,7 +227,7 @@
227 227 <string name="consum_amount">消费金额:</string>
228 228 <string name="serial_number">流水号:</string>
229 229 <string name="print">打票</string>
230   - <string name="part_print">部分检票</string>
  230 + <string name="part_print">检本票</string>
231 231 <string name="notice1">1)必须打开蓝牙功能,才能连接打印机,才能打印小票。</string>
232 232 <string name="notice2">2)看“已匹配设备”列表,是否存在你已经匹配的设备,选择设备打印;如果匹配列表中不存在您需要的设备,则“扫描设备”,从中获取您需要的设备进行匹配。</string>
233 233 <string name="notice3">3)打印机的名称为“EZTPrinter。”</string>
... ...
src/com/ectrip/cyt/adapter/ReportExpandableListAdapter.java
... ... @@ -30,6 +30,7 @@ import com.ectrip.cyt.response.LoginResponse;
30 30 import com.ectrip.cyt.response.ProductInfoQuery;
31 31 import com.ectrip.cyt.ui.BaseActivity;
32 32 import com.ectrip.cyt.utils.DenstityUtils;
  33 +import com.ectrip.cyt.utils.LogUtil;
33 34 import com.ectrip.cyt.utils.SharedPreferences2Obj;
34 35 import com.ectrip.trips.check.R;
35 36 import com.ectrip.trips.net.HttpHelper;
... ... @@ -60,11 +61,13 @@ public class ReportExpandableListAdapter extends AnimatedExpandableListView.Anim
60 61 private static final int VALUE_NOT_PART = 0;// 2种不同的布局
61 62 private static final int VALUE_PART = 1;
62 63 private final int screenWidth;
  64 + private int type;
63 65  
64   - public ReportExpandableListAdapter(ListOnclickCallback callback, Context context, List<OrderInfo> orderInfos) {
  66 + public ReportExpandableListAdapter(ListOnclickCallback callback, Context context, List<OrderInfo> orderInfos,int type) {
65 67 this.callback = callback;
66 68 this.context = context;
67 69 this.orderInfos = orderInfos;
  70 + this.type = type;
68 71 li = LayoutInflater.from(context);
69 72 Select = SharedPreferences2Obj.getInstance(context)
70 73 .setName("SelectAction").getObject("Select", Integer.class);
... ... @@ -75,6 +78,7 @@ public class ReportExpandableListAdapter extends AnimatedExpandableListView.Anim
75 78 screenWidth = display.getWidth();
76 79 devtype = SharedPreferences2Obj.getInstance(context)
77 80 .setName("MachineType").getObject("type", Integer.class);
  81 + LogUtil.d("ReportExpandableListAdapter","Select = "+Select);
78 82 }
79 83  
80 84 /**
... ... @@ -260,8 +264,9 @@ public class ReportExpandableListAdapter extends AnimatedExpandableListView.Anim
260 264 holder = (GroupViewHolderNotPard) convertView.getTag();
261 265 }
262 266  
263   - int type = getItemViewType(groupPosition);
  267 +// int type = getItemViewType(groupPosition);
264 268 holder.ticket_print.setTag("" + groupPosition);
  269 + LogUtil.d("ReportExpandableListAdapter","type = "+type);
265 270 switch (type) {
266 271 case VALUE_NOT_PART: // 这种情况下是没有部分检票的
267 272 holder.part.setVisibility(View.GONE);
... ... @@ -285,6 +290,7 @@ public class ReportExpandableListAdapter extends AnimatedExpandableListView.Anim
285 290 default:
286 291 break;
287 292 }
  293 +
288 294 setConvertContent(holder, groupPosition);
289 295  
290 296 if (groupPosition == 0) {
... ... @@ -451,7 +457,7 @@ public class ReportExpandableListAdapter extends AnimatedExpandableListView.Anim
451 457 while (it.hasNext()) {
452 458 OrderInfo info = it.next();
453 459 if (info != null) {
454   - String count = info.getOrderAmount();
  460 + String count = String.valueOf(info.getOrderAmount());
455 461 if (count != null) {
456 462 int consumeCount = Integer.parseInt(count);
457 463 if (consumeCount > 0) {
... ...
src/com/ectrip/cyt/base/OrderInfo.java
... ... @@ -3,117 +3,236 @@ package com.ectrip.cyt.base;
3 3 import com.ectrip.cyt.response.ProductInfoQuery;
4 4  
5 5 import java.util.List;
6   -import java.util.Map;
7 6  
8 7 public class OrderInfo {
  8 + /**
  9 + * code : 1000
  10 + * describe : 成功
  11 + * orderInfos : [{"contactorName":"111","distributorName":"li分销商","isRealNameOrder":0,"orderAmount":4,"orderId":"57230630999000032","orderStatus":"PRINTSUCCESS","paymentWay":"预付","products":[{"baseQuantity":1,"consumedQuantity":1,"endDate":"2023-08-31","name":"九寨沟_非实名测试0411","orderPassengers":[{"encryptTicketNum":"http://218.17.50.143:18253/tdos/qrcode.do?ticketNum=TY_8BAF91AD91032B9927FBED3DF832ED62","id":24910,"orderId":23249,"otoName":"LHJGYS","person":{"contactTicket":false,"credentialsType":"NOTHING","id":"24910","isDiscountObj":0},"status":5,"ticketNum":"TY_8BAF91AD91032B9927FBED3DF832ED62","unifiedUseCode":"TY_8BAF91AD91032B9927FBED3DF832ED62","updateTime":1688107002000},{"encryptTicketNum":"http://218.17.50.143:18253/tdos/qrcode.do?ticketNum=TY_F9685424CDF207BAC75F5D80A32C8A95","id":24911,"orderId":23249,"otoName":"LHJGYS","person":{"contactTicket":false,"credentialsType":"NOTHING","id":"24911","isDiscountObj":0},"status":4,"ticketNum":"TY_F9685424CDF207BAC75F5D80A32C8A95","unifiedUseCode":"TY_F9685424CDF207BAC75F5D80A32C8A95","updateTime":1688105298000},{"encryptTicketNum":"http://218.17.50.143:18253/tdos/qrcode.do?ticketNum=TY_274C2780861BE5686A469EE238297E5E","id":24912,"orderId":23249,"otoName":"LHJGYS","person":{"contactTicket":false,"credentialsType":"NOTHING","id":"24912","isDiscountObj":0},"status":4,"ticketNum":"TY_274C2780861BE5686A469EE238297E5E","unifiedUseCode":"TY_274C2780861BE5686A469EE238297E5E","updateTime":1688105298000},{"encryptTicketNum":"http://218.17.50.143:18253/tdos/qrcode.do?ticketNum=TY_A8B464B44AB6B0DF15E85844AA8AA095","id":24913,"orderId":23249,"otoName":"LHJGYS","person":{"contactTicket":false,"credentialsType":"NOTHING","id":"24913","isDiscountObj":0},"status":4,"ticketNum":"TY_A8B464B44AB6B0DF15E85844AA8AA095","unifiedUseCode":"TY_A8B464B44AB6B0DF15E85844AA8AA095","updateTime":1688105298000},{"encryptTicketNum":"http://218.17.50.143:18253/tdos/qrcode.do?ticketNum=TY_80A9E68D8CE3575BA181AB7E17948EBD","id":24914,"orderId":23249,"otoName":"LHJGYS","person":{"contactTicket":false,"credentialsType":"NOTHING","id":"24914","isDiscountObj":0},"status":4,"ticketNum":"TY_80A9E68D8CE3575BA181AB7E17948EBD","unifiedUseCode":"TY_80A9E68D8CE3575BA181AB7E17948EBD","updateTime":1688105298000}],"productId":"744","quantity":4,"startDate":"2023-06-30","totalQuantity":5}],"verifyPart":"true"},{"contactorName":"666","distributorName":"li分销商","isRealNameOrder":0,"orderAmount":2,"orderId":"57230630999000030","orderStatus":"PRINTSUCCESS","paymentWay":"预付","products":[{"baseQuantity":1,"consumedQuantity":0,"endDate":"2023-08-31","name":"九寨沟_非实名测试0411","orderPassengers":[{"encryptTicketNum":"http://218.17.50.143:18253/tdos/qrcode.do?ticketNum=TY_4E16A165C6EBA560E037C139D06D0EEE","id":24908,"orderId":23248,"otoName":"LHJGYS","person":{"contactTicket":false,"credentialsType":"NOTHING","id":"24908","isDiscountObj":0},"status":4,"ticketNum":"TY_4E16A165C6EBA560E037C139D06D0EEE","unifiedUseCode":"TY_4E16A165C6EBA560E037C139D06D0EEE","updateTime":1688105251000},{"encryptTicketNum":"http://218.17.50.143:18253/tdos/qrcode.do?ticketNum=TY_07CF8B0762B992FFDDF14847D098823E","id":24909,"orderId":23248,"otoName":"LHJGYS","person":{"contactTicket":false,"credentialsType":"NOTHING","id":"24909","isDiscountObj":0},"status":4,"ticketNum":"TY_07CF8B0762B992FFDDF14847D098823E","unifiedUseCode":"TY_07CF8B0762B992FFDDF14847D098823E","updateTime":1688105251000}],"productId":"744","quantity":2,"startDate":"2023-06-30","totalQuantity":2}],"verifyPart":"true"}]
  12 + */
  13 + /**
  14 + * contactorName : 111
  15 + * distributorName : li分销商
  16 + * isRealNameOrder : 0
  17 + * orderAmount : 4
  18 + * orderId : 57230630999000032
  19 + * orderStatus : PRINTSUCCESS
  20 + * paymentWay : 预付
  21 + * products : [{"baseQuantity":1,"consumedQuantity":1,"endDate":"2023-08-31","name":"九寨沟_非实名测试0411","orderPassengers":[{"encryptTicketNum":"http://218.17.50.143:18253/tdos/qrcode.do?ticketNum=TY_8BAF91AD91032B9927FBED3DF832ED62","id":24910,"orderId":23249,"otoName":"LHJGYS","person":{"contactTicket":false,"credentialsType":"NOTHING","id":"24910","isDiscountObj":0},"status":5,"ticketNum":"TY_8BAF91AD91032B9927FBED3DF832ED62","unifiedUseCode":"TY_8BAF91AD91032B9927FBED3DF832ED62","updateTime":1688107002000},{"encryptTicketNum":"http://218.17.50.143:18253/tdos/qrcode.do?ticketNum=TY_F9685424CDF207BAC75F5D80A32C8A95","id":24911,"orderId":23249,"otoName":"LHJGYS","person":{"contactTicket":false,"credentialsType":"NOTHING","id":"24911","isDiscountObj":0},"status":4,"ticketNum":"TY_F9685424CDF207BAC75F5D80A32C8A95","unifiedUseCode":"TY_F9685424CDF207BAC75F5D80A32C8A95","updateTime":1688105298000},{"encryptTicketNum":"http://218.17.50.143:18253/tdos/qrcode.do?ticketNum=TY_274C2780861BE5686A469EE238297E5E","id":24912,"orderId":23249,"otoName":"LHJGYS","person":{"contactTicket":false,"credentialsType":"NOTHING","id":"24912","isDiscountObj":0},"status":4,"ticketNum":"TY_274C2780861BE5686A469EE238297E5E","unifiedUseCode":"TY_274C2780861BE5686A469EE238297E5E","updateTime":1688105298000},{"encryptTicketNum":"http://218.17.50.143:18253/tdos/qrcode.do?ticketNum=TY_A8B464B44AB6B0DF15E85844AA8AA095","id":24913,"orderId":23249,"otoName":"LHJGYS","person":{"contactTicket":false,"credentialsType":"NOTHING","id":"24913","isDiscountObj":0},"status":4,"ticketNum":"TY_A8B464B44AB6B0DF15E85844AA8AA095","unifiedUseCode":"TY_A8B464B44AB6B0DF15E85844AA8AA095","updateTime":1688105298000},{"encryptTicketNum":"http://218.17.50.143:18253/tdos/qrcode.do?ticketNum=TY_80A9E68D8CE3575BA181AB7E17948EBD","id":24914,"orderId":23249,"otoName":"LHJGYS","person":{"contactTicket":false,"credentialsType":"NOTHING","id":"24914","isDiscountObj":0},"status":4,"ticketNum":"TY_80A9E68D8CE3575BA181AB7E17948EBD","unifiedUseCode":"TY_80A9E68D8CE3575BA181AB7E17948EBD","updateTime":1688105298000}],"productId":"744","quantity":4,"startDate":"2023-06-30","totalQuantity":5}]
  22 + * verifyPart : true
  23 + */
9 24  
10   -
11   - private String orderId;// 订单号
  25 + private String contactorName;// 取票人姓名
  26 + private String credentials;//证件号码
12 27 private String distributorName;// 分销商名称
  28 + private int isRealNameOrder;
  29 + private String orderAmount;// 订单份数
  30 + private String orderId;// 订单号
13 31 private String orderStatus;// 订单状态
14   - private String contactorName;// 取票人姓名
15   - private String credentials;// 证件号码
16   - private String verifyPart;// 是否部分检票
17 32 private String paymentWay; //支付类型[PRE_PAY, CASH_PAY]
18   - private String orderAmount;// 订单份数
19   -
  33 + private String verifyPart;// 是否部分检票
20 34 private List<ProductInfoQuery> products;
21 35  
22   - public OrderInfo(String orderId, String distributorName, String orderStatus, String contactorName, String credentials, String verifyPart, String orderAmount, List<ProductInfoQuery> products,String paymentWay) {
  36 + public OrderInfo(String orderId, String credentials, String distributorName, String orderStatus, String contactorName, int isRealNameOrder, String verifyPart, String orderAmount, List<ProductInfoQuery> products,String paymentWay) {
23 37 this.orderId = orderId;
  38 + this.credentials = credentials;
24 39 this.distributorName = distributorName;
25 40 this.orderStatus = orderStatus;
26 41 this.contactorName = contactorName;
27   - this.credentials = credentials;
  42 + this.isRealNameOrder = isRealNameOrder;
28 43 this.verifyPart = verifyPart;
29 44 this.orderAmount = orderAmount;
30 45 this.products = products;
31 46 this.paymentWay = paymentWay;
32 47 }
33 48  
34   - public String getPaymentWay() {
35   - return paymentWay;
  49 + public String getContactorName() {
  50 + return contactorName;
36 51 }
37 52  
38   - public void setPaymentWay(String paymentWay) {
39   - this.paymentWay = paymentWay;
  53 + public void setContactorName(String contactorName) {
  54 + this.contactorName = contactorName;
40 55 }
41 56  
42   - public String getOrderId() {
43   - return orderId;
  57 + public String getCredentials() {
  58 + return credentials;
44 59 }
45 60  
46   - public String getDistributorName() {
47   - return distributorName;
  61 + public void setCredentials(String credentials) {
  62 + this.credentials = credentials;
48 63 }
49 64  
50   - public String getOrderStatus() {
51   - return orderStatus;
  65 + public String getDistributorName() {
  66 + return distributorName;
52 67 }
53 68  
54   - public String getContactorName() {
55   - return contactorName;
  69 + public void setDistributorName(String distributorName) {
  70 + this.distributorName = distributorName;
56 71 }
57 72  
58   - public String getCredentials() {
59   - return credentials;
  73 + public int getIsRealNameOrder() {
  74 + return isRealNameOrder;
60 75 }
61 76  
62   - public String getVerifyPart() {
63   - return verifyPart;
  77 + public void setIsRealNameOrder(int isRealNameOrder) {
  78 + this.isRealNameOrder = isRealNameOrder;
64 79 }
65 80  
66 81 public String getOrderAmount() {
67 82 return orderAmount;
68 83 }
69 84  
70   - public List<ProductInfoQuery> getProducts() {
71   - return products;
  85 + public void setOrderAmount(String orderAmount) {
  86 + this.orderAmount = orderAmount;
  87 + }
  88 +
  89 + public String getOrderId() {
  90 + return orderId;
72 91 }
73 92  
74 93 public void setOrderId(String orderId) {
75 94 this.orderId = orderId;
76 95 }
77 96  
78   - public void setDistributorName(String distributorName) {
79   - this.distributorName = distributorName;
  97 + public String getOrderStatus() {
  98 + return orderStatus;
80 99 }
81 100  
82 101 public void setOrderStatus(String orderStatus) {
83 102 this.orderStatus = orderStatus;
84 103 }
85 104  
86   - public void setContactorName(String contactorName) {
87   - this.contactorName = contactorName;
  105 + public String getPaymentWay() {
  106 + return paymentWay;
88 107 }
89 108  
90   - public void setCredentials(String credentials) {
91   - this.credentials = credentials;
  109 + public void setPaymentWay(String paymentWay) {
  110 + this.paymentWay = paymentWay;
  111 + }
  112 +
  113 + public String getVerifyPart() {
  114 + return verifyPart;
92 115 }
93 116  
94 117 public void setVerifyPart(String verifyPart) {
95 118 this.verifyPart = verifyPart;
96 119 }
97 120  
98   - public void setOrderAmount(String orderAmount) {
99   - this.orderAmount = orderAmount;
  121 + public List<ProductInfoQuery> getProducts() {
  122 + return products;
100 123 }
101 124  
102 125 public void setProducts(List<ProductInfoQuery> products) {
103 126 this.products = products;
104 127 }
105 128  
106   - @Override
107   - public String toString() {
108   - return "OrderInfo{" +
109   - "id='" + orderId + '\'' +
110   - ", distributorName='" + distributorName + '\'' +
111   - ", orderStatus='" + orderStatus + '\'' +
112   - ", contactorName='" + contactorName + '\'' +
113   - ", credentials='" + credentials + '\'' +
114   - ", verifyPart='" + verifyPart + '\'' +
115   - ", orderAmount=" + orderAmount +
116   - ", products=" + products +
117   - '}';
118   - }
  129 +
  130 +// private String orderId;// 订单号
  131 +// private String distributorName;// 分销商名称
  132 +// private String orderStatus;// 订单状态
  133 +// private String contactorName;// 取票人姓名
  134 +// private String credentials;// 证件号码
  135 +// private String verifyPart;// 是否部分检票
  136 +// private String paymentWay; //支付类型[PRE_PAY, CASH_PAY]
  137 +// private String orderAmount;// 订单份数
  138 +//
  139 +// private List<ProductInfoQuery> products;
  140 +
  141 +// public OrderInfo(String orderId, String distributorName, String orderStatus, String contactorName, String credentials, String verifyPart, String orderAmount, List<ProductInfoQuery> products,String paymentWay) {
  142 +// this.orderId = orderId;
  143 +// this.distributorName = distributorName;
  144 +// this.orderStatus = orderStatus;
  145 +// this.contactorName = contactorName;
  146 +// this.credentials = credentials;
  147 +// this.verifyPart = verifyPart;
  148 +// this.orderAmount = orderAmount;
  149 +// this.products = products;
  150 +// this.paymentWay = paymentWay;
  151 +// }
  152 +//
  153 +// public String getPaymentWay() {
  154 +// return paymentWay;
  155 +// }
  156 +//
  157 +// public void setPaymentWay(String paymentWay) {
  158 +// this.paymentWay = paymentWay;
  159 +// }
  160 +//
  161 +// public String getOrderId() {
  162 +// return orderId;
  163 +// }
  164 +//
  165 +// public String getDistributorName() {
  166 +// return distributorName;
  167 +// }
  168 +//
  169 +// public String getOrderStatus() {
  170 +// return orderStatus;
  171 +// }
  172 +//
  173 +// public String getContactorName() {
  174 +// return contactorName;
  175 +// }
  176 +//
  177 +// public String getCredentials() {
  178 +// return credentials;
  179 +// }
  180 +//
  181 +// public String getVerifyPart() {
  182 +// return verifyPart;
  183 +// }
  184 +//
  185 +// public String getOrderAmount() {
  186 +// return orderAmount;
  187 +// }
  188 +//
  189 +// public List<ProductInfoQuery> getProducts() {
  190 +// return products;
  191 +// }
  192 +//
  193 +// public void setOrderId(String orderId) {
  194 +// this.orderId = orderId;
  195 +// }
  196 +//
  197 +// public void setDistributorName(String distributorName) {
  198 +// this.distributorName = distributorName;
  199 +// }
  200 +//
  201 +// public void setOrderStatus(String orderStatus) {
  202 +// this.orderStatus = orderStatus;
  203 +// }
  204 +//
  205 +// public void setContactorName(String contactorName) {
  206 +// this.contactorName = contactorName;
  207 +// }
  208 +//
  209 +// public void setCredentials(String credentials) {
  210 +// this.credentials = credentials;
  211 +// }
  212 +//
  213 +// public void setVerifyPart(String verifyPart) {
  214 +// this.verifyPart = verifyPart;
  215 +// }
  216 +//
  217 +// public void setOrderAmount(String orderAmount) {
  218 +// this.orderAmount = orderAmount;
  219 +// }
  220 +//
  221 +// public void setProducts(List<ProductInfoQuery> products) {
  222 +// this.products = products;
  223 +// }
  224 +//
  225 +// @Override
  226 +// public String toString() {
  227 +// return "OrderInfo{" +
  228 +// "id='" + orderId + '\'' +
  229 +// ", distributorName='" + distributorName + '\'' +
  230 +// ", orderStatus='" + orderStatus + '\'' +
  231 +// ", contactorName='" + contactorName + '\'' +
  232 +// ", credentials='" + credentials + '\'' +
  233 +// ", verifyPart='" + verifyPart + '\'' +
  234 +// ", orderAmount=" + orderAmount +
  235 +// ", products=" + products +
  236 +// '}';
  237 +// }
119 238 }
... ...
src/com/ectrip/cyt/center/CenterHandle.java
... ... @@ -8,6 +8,7 @@ import android.app.ProgressDialog;
8 8 import android.content.Context;
9 9 import android.content.DialogInterface;
10 10 import android.content.res.Resources;
  11 +import android.text.TextUtils;
11 12 import android.view.LayoutInflater;
12 13 import android.view.View;
13 14 import android.view.View.OnClickListener;
... ... @@ -31,6 +32,7 @@ import com.ectrip.cyt.response.ConsumeOrderResponse;
31 32 import com.ectrip.cyt.response.ProductInfoQuery;
32 33 import com.ectrip.cyt.spinnerwheel.adapters.NumericWheelAdapter;
33 34 import com.ectrip.cyt.ui.BaseActivity;
  35 +import com.ectrip.cyt.utils.LogUtil;
34 36 import com.ectrip.cyt.utils.SharedPreferences2Obj;
35 37 import com.ectrip.cyt.utils.SoundUtil;
36 38 import com.ectrip.trips.check.R;
... ... @@ -50,6 +52,7 @@ import antistatic.spinnerwheel.AbstractWheel;
50 52 * @author jigo 部分检票和全部检票处理
51 53 */
52 54 public class CenterHandle {
  55 + public final String TAG = "CenterHandle";
53 56 private Context context;
54 57 private AlertDialog dialog; // 部分检票弹框
55 58 ProgressDialog dialog2 = null;
... ... @@ -68,7 +71,8 @@ public class CenterHandle {
68 71 private Integer type;
69 72 private int times = 0;
70 73 private boolean isAll;
71   -
  74 + private String idStr;
  75 + private boolean isRealId;
72 76 public CenterHandle(Context context, List<OrderInfo> orderInfos,
73 77 String password, String verifyPassword,
74 78 ListOnclickCallback onclickCallback) {
... ... @@ -130,6 +134,34 @@ public class CenterHandle {
130 134 }
131 135  
132 136 /**
  137 + * 部分检票
  138 + *
  139 + * @param position
  140 + * @param pwd
  141 + * @param verifyPassword
  142 + */
  143 + public void partTicket(int position, String pwd, String verifyPassword,String id,boolean isId) {
  144 + isAll = false;
  145 + idStr = id;
  146 + isRealId = isId;
  147 + getConsumedSeq(position);
  148 + products = orderInfos.get(position).getProducts();
  149 + Integer totle = new Integer(orderInfos.get(position).getOrderAmount());
  150 + productOfConsumeOrders = new ArrayList<>();
  151 + for (int i = 0; i < products.size(); i++) {
  152 + ProductOfConsumeOrder consumeOrder = new ProductOfConsumeOrder(products.get(i).getProductId(), 1);
  153 + productOfConsumeOrders.add(consumeOrder);
  154 + }
  155 +
  156 + HttpHelper.getInstance(context).consumeOrderPart(
  157 + orderInfos.get(position).getOrderId(),
  158 + orderInfos.get(position).getOrderAmount(), pwd, verifyPassword,
  159 + consumedSeq, productOfConsumeOrders,id,isId,
  160 + new CenterConsumeCallback(position, false, 1));
  161 + }
  162 +
  163 +
  164 + /**
133 165 * 部分检票弹窗
134 166 */
135 167 LayoutInflater inflater;
... ... @@ -194,7 +226,46 @@ public class CenterHandle {
194 226 e.printStackTrace();
195 227 }
196 228 }
197   -
  229 + int position = 0;//表示单选列表中默认选择的位置为0
  230 +
  231 + public void showDialog(final String str[]) {
  232 + position = 0;
  233 + AlertDialog dialog;
  234 + AlertDialog.Builder builder = new AlertDialog.Builder(context)
  235 + .setTitle("请选择票码")
  236 + .setCancelable(false)
  237 + .setSingleChoiceItems(str, position, new DialogInterface.OnClickListener() {
  238 + @Override
  239 + public void onClick(DialogInterface dialog, int which) {
  240 + position = which;//得到被点击的序号which
  241 + LogUtil.d(TAG, "position = " + position);
  242 + }
  243 + })
  244 + .setPositiveButton("确定", new DialogInterface.OnClickListener() {//添加“确定”按钮
  245 + @Override
  246 + public void onClick(DialogInterface dialog, int which) {
  247 + LogUtil.d(TAG, "选择的票码 = " + str[position] + "\n" + "位置 = " + position);
  248 + dialog.dismiss();
  249 + String titcketCode = str[position];
  250 + if (!TextUtils.isEmpty(titcketCode)) {
  251 + isAll = false;
  252 + HttpHelper.getInstance(context).consumeOrder(
  253 + orderInfos.get(position).getOrderId(),
  254 + "1",
  255 + password, verifyPassword, consumedSeq, productOfConsumeOrders,
  256 + new CenterConsumeCallback(position, false, 1));
  257 + }
  258 + }
  259 + })
  260 + .setNegativeButton("取消", new DialogInterface.OnClickListener() {
  261 + @Override
  262 + public void onClick(DialogInterface dialog, int which) {
  263 + dialog.dismiss();
  264 + }
  265 + });
  266 + dialog = builder.create();
  267 + dialog.show();
  268 + }
198 269 private void initWheel(View view, int id, final int num) {
199 270 wheel = (AbstractWheel) view.findViewById(id);
200 271 wheel.setViewAdapter(new NumericWheelAdapter(context, 1, num));
... ... @@ -302,11 +373,16 @@ public class CenterHandle {
302 373 consumedSeq, productOfConsumeOrders,
303 374 new CenterConsumeCallback(position, true, 0));
304 375 } else {
305   - HttpHelper.getInstance(context).consumeOrder(
  376 +// HttpHelper.getInstance(context).consumeOrder(
  377 +// orderInfos.get(position).getOrderId(),
  378 +// (wheel.getCurrentItem() + 1) + "",
  379 +// password, verifyPassword, consumedSeq, productOfConsumeOrders,
  380 +// new CenterConsumeCallback(position, false, wheel.getCurrentItem() + 1));
  381 + HttpHelper.getInstance(context).consumeOrderPart(
306 382 orderInfos.get(position).getOrderId(),
307   - (wheel.getCurrentItem() + 1) + "",
308   - password, verifyPassword, consumedSeq, productOfConsumeOrders,
309   - new CenterConsumeCallback(position, false, wheel.getCurrentItem() + 1));
  383 + "1",
  384 + password, verifyPassword, consumedSeq, productOfConsumeOrders,idStr,isRealId,
  385 + new CenterConsumeCallback(position, false, 1));
310 386 }
311 387 } else {
312 388 MyApp.getInstance().setPid(null);
... ... @@ -360,11 +436,16 @@ public class CenterHandle {
360 436 consumedSeq, productOfConsumeOrders,
361 437 new CenterConsumeCallback(position, true, 0));
362 438 } else {
  439 +// HttpHelper.getInstance(context).consumeOrder(
  440 +// orderInfos.get(position).getOrderId(),
  441 +// (wheel.getCurrentItem() + 1) + "",
  442 +// password, verifyPassword, consumedSeq, productOfConsumeOrders,
  443 +// new CenterConsumeCallback(position, false, wheel.getCurrentItem() + 1));
363 444 HttpHelper.getInstance(context).consumeOrder(
364 445 orderInfos.get(position).getOrderId(),
365   - (wheel.getCurrentItem() + 1) + "",
  446 + "1",
366 447 password, verifyPassword, consumedSeq, productOfConsumeOrders,
367   - new CenterConsumeCallback(position, false, wheel.getCurrentItem() + 1));
  448 + new CenterConsumeCallback(position, false, 1));
368 449 }
369 450 } else {
370 451 ((Activity) context).finish();
... ...
src/com/ectrip/cyt/request/ConsumeOrderRequest.java
... ... @@ -11,8 +11,11 @@ public class ConsumeOrderRequest extends Request {
11 11 public String verifyPassword;// 验证密码
12 12 private Long accountId; //操作员ID
13 13 public List<ProductOfConsumeOrder> products;//产品信息
  14 + private String voucher;
14 15  
15 16 public String consumedSeq;//流水号
  17 + public String code;
  18 + public String credentials;
16 19 public String note2;//
17 20 public String note3;//
18 21 public String note4;//
... ... @@ -22,7 +25,7 @@ public class ConsumeOrderRequest extends Request {
22 25 public String note8;//
23 26  
24 27 public ConsumeOrderRequest(String orderId, String consumeCount,
25   - String password, String verifyPassword,String consumedSeq,List<ProductOfConsumeOrder>products) {
  28 + String password, String verifyPassword,String consumedSeq,List<ProductOfConsumeOrder> products) {
26 29 super();
27 30 this.orderId = orderId;
28 31 this.consumedAmount = consumeCount;
... ... @@ -30,6 +33,7 @@ public class ConsumeOrderRequest extends Request {
30 33 this.verifyPassword = verifyPassword;
31 34 this.products = products;
32 35 this.consumedSeq = consumedSeq;
  36 +
33 37 }
34 38  
35 39 public void setOrderId(String orderId) {
... ... @@ -154,4 +158,28 @@ public class ConsumeOrderRequest extends Request {
154 158 public void setNote8(String note8) {
155 159 this.note8 = note8;
156 160 }
  161 +
  162 + public String getCode() {
  163 + return code;
  164 + }
  165 +
  166 + public void setCode(String code) {
  167 + this.code = code;
  168 + }
  169 +
  170 + public String getCredentials() {
  171 + return credentials;
  172 + }
  173 +
  174 + public void setCredentials(String credentials) {
  175 + this.credentials = credentials;
  176 + }
  177 +
  178 + public String getVoucher() {
  179 + return voucher;
  180 + }
  181 +
  182 + public void setVoucher(String voucher) {
  183 + this.voucher = voucher;
  184 + }
157 185 }
... ...
src/com/ectrip/cyt/request/QueryOrderRequest.java
... ... @@ -12,11 +12,12 @@ public class QueryOrderRequest extends Request {
12 12 private String endDate;// 截止日期
13 13 private String pageSize;// 分页大小
14 14 private String pageNo;// 页数
  15 + private String voucher;
15 16  
16 17 public QueryOrderRequest() {
17 18 }
18 19  
19   - public QueryOrderRequest( String method, String verifyCode, String phone, String credentials, String orderId, String startDate, String endDate,String pageSize,String pageNo) {
  20 + public QueryOrderRequest( String method, String verifyCode, String phone, String credentials, String orderId, String startDate, String endDate,String pageSize,String pageNo,String voucher) {
20 21 this.method = method;
21 22 this.orderId = orderId;
22 23 this.verifyCode = verifyCode;
... ... @@ -26,6 +27,7 @@ public class QueryOrderRequest extends Request {
26 27 this.endDate = endDate;
27 28 this.pageSize = pageSize;
28 29 this.pageNo = pageNo;
  30 + this.voucher = voucher;
29 31 }
30 32  
31 33 public void setMethod(String method) {
... ... @@ -99,4 +101,12 @@ public class QueryOrderRequest extends Request {
99 101 public String getPageNo() {
100 102 return pageNo;
101 103 }
  104 +
  105 + public String getVoucher() {
  106 + return voucher;
  107 + }
  108 +
  109 + public void setVoucher(String voucher) {
  110 + this.voucher = voucher;
  111 + }
102 112 }
... ...
src/com/ectrip/cyt/response/ProductInfoQuery.java
1 1 package com.ectrip.cyt.response;
2 2  
  3 +import com.ectrip.cyt.base.OrderInfo;
  4 +
  5 +import java.util.List;
  6 +
3 7 /**
4 8 * This is
5 9 *
6 10 * @author Jiehao Ling, 5:28 PM,9/6/16
7 11 */
8 12 public class ProductInfoQuery {
9   - private String productId;// 原始产品ID
10   - private String name;// 产品名称
11   - private String totalQuantity;// 总数量
12   - private String consumedQuantity;// 已消费数量
13   - private String quantity;// 订单剩余数量
14   - private String baseQuantity;// 基数
15   - private String startDate;// 开始日期(yyyy;//MM;//dd)
16   - private String endDate;// 截止日期(yyyy;//MM;//dd)
17   - private String price;// 单价
18   - private String money;// 金额
19   - private String paymentType;// 支付类型(预付、到付)
20   - private String pmsProductId;// 线下产品ID(窗口设备使用)
21   -
22   - public ProductInfoQuery() {
23   - }
24   -
25   - public ProductInfoQuery(String productId, String name, String totalQuantity, String consumedQuantity, String quantity, String baseQuantity, String startDate, String endDate, String price, String money, String paymentType, String pmsProductId) {
  13 +
  14 + private String baseQuantity;
  15 + private String consumedQuantity;
  16 + private String endDate;
  17 + private String name;
  18 + private String productId;
  19 + private String quantity;
  20 + private String startDate;
  21 + private String totalQuantity;
  22 +// private List<OrderPassengersBean> orderPassengers;
  23 + private List<PassengerInfosBean> passengerInfos;
  24 + public ProductInfoQuery(String productId, String name, String totalQuantity, String consumedQuantity, String quantity, String baseQuantity, String startDate, String endDate, List<PassengerInfosBean> passengerInfos) {
26 25 this.productId = productId;
27 26 this.name = name;
28 27 this.totalQuantity = totalQuantity;
... ... @@ -31,34 +30,15 @@ public class ProductInfoQuery {
31 30 this.baseQuantity = baseQuantity;
32 31 this.startDate = startDate;
33 32 this.endDate = endDate;
34   - this.price = price;
35   - this.money = money;
36   - this.paymentType = paymentType;
37   - this.pmsProductId = pmsProductId;
38   - }
39   -
40   - public String getProductId() {
41   - return productId;
42   - }
43   -
44   - public void setProductId(String productId) {
45   - this.productId = productId;
  33 + this.passengerInfos = passengerInfos;
46 34 }
47 35  
48   - public String getName() {
49   - return name;
50   - }
51   -
52   - public void setName(String name) {
53   - this.name = name;
54   - }
55   -
56   - public String getTotalQuantity() {
57   - return totalQuantity;
  36 + public String getBaseQuantity() {
  37 + return baseQuantity;
58 38 }
59 39  
60   - public void setTotalQuantity(String totalQuantity) {
61   - this.totalQuantity = totalQuantity;
  40 + public void setBaseQuantity(String baseQuantity) {
  41 + this.baseQuantity = baseQuantity;
62 42 }
63 43  
64 44 public String getConsumedQuantity() {
... ... @@ -69,67 +49,195 @@ public class ProductInfoQuery {
69 49 this.consumedQuantity = consumedQuantity;
70 50 }
71 51  
72   - public String getQuantity() {
73   - return quantity;
  52 + public String getEndDate() {
  53 + return endDate;
74 54 }
75 55  
76   - public void setQuantity(String quantity) {
77   - this.quantity = quantity;
  56 + public void setEndDate(String endDate) {
  57 + this.endDate = endDate;
78 58 }
79 59  
80   - public String getBaseQuantity() {
81   - return baseQuantity;
  60 + public String getName() {
  61 + return name;
82 62 }
83 63  
84   - public void setBaseQuantity(String baseQuantity) {
85   - this.baseQuantity = baseQuantity;
  64 + public void setName(String name) {
  65 + this.name = name;
86 66 }
87 67  
88   - public String getStartDate() {
89   - return startDate;
  68 + public String getProductId() {
  69 + return productId;
90 70 }
91 71  
92   - public void setStartDate(String startDate) {
93   - this.startDate = startDate;
  72 + public void setProductId(String productId) {
  73 + this.productId = productId;
94 74 }
95 75  
96   - public String getEndDate() {
97   - return endDate;
  76 + public String getQuantity() {
  77 + return quantity;
98 78 }
99 79  
100   - public void setEndDate(String endDate) {
101   - this.endDate = endDate;
  80 + public void setQuantity(String quantity) {
  81 + this.quantity = quantity;
102 82 }
103 83  
104   - public String getPrice() {
105   - return price;
  84 + public String getStartDate() {
  85 + return startDate;
106 86 }
107 87  
108   - public void setPrice(String price) {
109   - this.price = price;
  88 + public void setStartDate(String startDate) {
  89 + this.startDate = startDate;
110 90 }
111 91  
112   - public String getMoney() {
113   - return money;
  92 + public String getTotalQuantity() {
  93 + return totalQuantity;
114 94 }
115 95  
116   - public void setMoney(String money) {
117   - this.money = money;
  96 + public void setTotalQuantity(String totalQuantity) {
  97 + this.totalQuantity = totalQuantity;
118 98 }
119 99  
120   - public String getPaymentType() {
121   - return paymentType;
122   - }
  100 +// public List<OrderPassengersBean> getOrderPassengers() {
  101 +// return orderPassengers;
  102 +// }
  103 +//
  104 +// public void setOrderPassengers(List<OrderPassengersBean> orderPassengers) {
  105 +// this.orderPassengers = orderPassengers;
123 106  
124   - public void setPaymentType(String paymentType) {
125   - this.paymentType = paymentType;
126   - }
127 107  
128   - public String getPmsProductId() {
129   - return pmsProductId;
  108 + public List<PassengerInfosBean> getPassengerInfos() {
  109 + return passengerInfos;
130 110 }
131 111  
132   - public void setPmsProductId(String pmsProductId) {
133   - this.pmsProductId = pmsProductId;
  112 + public void setPassengerInfos(List<PassengerInfosBean> passengerInfos) {
  113 + this.passengerInfos = passengerInfos;
134 114 }
135 115 }
  116 +
  117 +// private String productId;// 原始产品ID
  118 +// private String name;// 产品名称
  119 +// private String totalQuantity;// 总数量
  120 +// private String consumedQuantity;// 已消费数量
  121 +// private String quantity;// 订单剩余数量
  122 +// private String baseQuantity;// 基数
  123 +// private String startDate;// 开始日期(yyyy;//MM;//dd)
  124 +// private String endDate;// 截止日期(yyyy;//MM;//dd)
  125 +// private String price;// 单价
  126 +// private String money;// 金额
  127 +// private String paymentType;// 支付类型(预付、到付)
  128 +// private String pmsProductId;// 线下产品ID(窗口设备使用)
  129 +
  130 +// public ProductInfoQuery() {
  131 +// }
  132 +
  133 +// public ProductInfoQuery(String productId, String name, String totalQuantity, String consumedQuantity, String quantity, String baseQuantity, String startDate, String endDate, String price, String money, String paymentType, String pmsProductId) {
  134 +// this.productId = productId;
  135 +// this.name = name;
  136 +// this.totalQuantity = totalQuantity;
  137 +// this.consumedQuantity = consumedQuantity;
  138 +// this.quantity = quantity;
  139 +// this.baseQuantity = baseQuantity;
  140 +// this.startDate = startDate;
  141 +// this.endDate = endDate;
  142 +// this.price = price;
  143 +// this.money = money;
  144 +// this.paymentType = paymentType;
  145 +// this.pmsProductId = pmsProductId;
  146 +// }
  147 +
  148 +// public String getProductId() {
  149 +// return productId;
  150 +// }
  151 +//
  152 +// public void setProductId(String productId) {
  153 +// this.productId = productId;
  154 +// }
  155 +//
  156 +// public String getName() {
  157 +// return name;
  158 +// }
  159 +//
  160 +// public void setName(String name) {
  161 +// this.name = name;
  162 +// }
  163 +//
  164 +// public String getTotalQuantity() {
  165 +// return totalQuantity;
  166 +// }
  167 +//
  168 +// public void setTotalQuantity(String totalQuantity) {
  169 +// this.totalQuantity = totalQuantity;
  170 +// }
  171 +//
  172 +// public String getConsumedQuantity() {
  173 +// return consumedQuantity;
  174 +// }
  175 +//
  176 +// public void setConsumedQuantity(String consumedQuantity) {
  177 +// this.consumedQuantity = consumedQuantity;
  178 +// }
  179 +//
  180 +// public String getQuantity() {
  181 +// return quantity;
  182 +// }
  183 +//
  184 +// public void setQuantity(String quantity) {
  185 +// this.quantity = quantity;
  186 +// }
  187 +//
  188 +// public String getBaseQuantity() {
  189 +// return baseQuantity;
  190 +// }
  191 +//
  192 +// public void setBaseQuantity(String baseQuantity) {
  193 +// this.baseQuantity = baseQuantity;
  194 +// }
  195 +//
  196 +// public String getStartDate() {
  197 +// return startDate;
  198 +// }
  199 +//
  200 +// public void setStartDate(String startDate) {
  201 +// this.startDate = startDate;
  202 +// }
  203 +//
  204 +// public String getEndDate() {
  205 +// return endDate;
  206 +// }
  207 +//
  208 +// public void setEndDate(String endDate) {
  209 +// this.endDate = endDate;
  210 +// }
  211 +//
  212 +// public String getPrice() {
  213 +// return price;
  214 +// }
  215 +//
  216 +// public void setPrice(String price) {
  217 +// this.price = price;
  218 +// }
  219 +//
  220 +// public String getMoney() {
  221 +// return money;
  222 +// }
  223 +//
  224 +// public void setMoney(String money) {
  225 +// this.money = money;
  226 +// }
  227 +//
  228 +// public String getPaymentType() {
  229 +// return paymentType;
  230 +// }
  231 +//
  232 +// public void setPaymentType(String paymentType) {
  233 +// this.paymentType = paymentType;
  234 +// }
  235 +//
  236 +// public String getPmsProductId() {
  237 +// return pmsProductId;
  238 +// }
  239 +//
  240 +// public void setPmsProductId(String pmsProductId) {
  241 +// this.pmsProductId = pmsProductId;
  242 +// }
  243 +//}
... ...
src/com/ectrip/cyt/ui/CodeOrderListActivity.java
... ... @@ -205,7 +205,7 @@ public class CodeOrderListActivity extends BaseActivity implements
205 205 if (orderInfos != null) {
206 206 adapter = new ReportExpandableListAdapter(
207 207 CodeOrderListActivity.this,
208   - CodeOrderListActivity.this, orderInfos);
  208 + CodeOrderListActivity.this, orderInfos,0);
209 209 orderList.setAdapter(adapter);
210 210  
211 211 //取消分割线
... ...
src/com/ectrip/cyt/ui/IDOrderListActivity.java
... ... @@ -35,7 +35,9 @@ import com.ectrip.cyt.config.MyApp;
35 35 import com.ectrip.cyt.constant.DeviceType;
36 36 import com.ectrip.cyt.constant.OrderCode;
37 37 import com.ectrip.cyt.constant.SelectAction;
  38 +import com.ectrip.cyt.response.PassengerInfosBean;
38 39 import com.ectrip.cyt.response.QueryOrderResponse;
  40 +import com.ectrip.cyt.utils.LogUtil;
39 41 import com.ectrip.cyt.utils.SharedPreferences2Obj;
40 42 import com.ectrip.cyt.utils.SoundUtil;
41 43 import com.ectrip.trips.check.R;
... ... @@ -66,7 +68,7 @@ public class IDOrderListActivity extends BaseActivity implements
66 68 private ProgressBar load_progress;
67 69 private boolean isUpMove = false;
68 70 private int allItem;
69   -
  71 + List<String> list = new ArrayList<>();
70 72 @Override
71 73 protected void onCreate(Bundle savedInstanceState) {
72 74 super.onCreate(savedInstanceState);
... ... @@ -289,6 +291,7 @@ public class IDOrderListActivity extends BaseActivity implements
289 291  
290 292 @Override
291 293 public void afterCompletedCallback(DataTrans result) {
  294 + LogUtil.d("IDOrderListActivity","result_data = "+result.getData());
292 295 if (result != null) {
293 296 signed = result.getSigned();
294 297 data = result.getData();
... ... @@ -352,7 +355,7 @@ public class IDOrderListActivity extends BaseActivity implements
352 355 if (adapter==null){
353 356 adapter = new ReportExpandableListAdapter(
354 357 IDOrderListActivity.this,
355   - IDOrderListActivity.this, orderInfos);
  358 + IDOrderListActivity.this, orderInfos,1);
356 359 orderList.setAdapter(adapter);
357 360 }else {
358 361 adapter.notifyDataSetChanged();
... ... @@ -422,8 +425,36 @@ public class IDOrderListActivity extends BaseActivity implements
422 425 centerHandle = new CenterHandle(IDOrderListActivity.this,
423 426 orderInfos, pwd, "TRUE", IDOrderListActivity.this);
424 427 }
425   - centerHandle.dialog(Integer.parseInt(orderInfos.get(position)
426   - .getOrderAmount()), position);
  428 +// centerHandle.dialog(Integer.parseInt(orderInfos.get(position)
  429 +// .getOrderAmount()), position);
  430 +
  431 +// list.clear();
  432 +// List<PassengerInfosBean> passengerInfosBeans = orderInfos.get(position).getProducts().get(position).getPassengerInfos();
  433 +// for (PassengerInfosBean bean : passengerInfosBeans){
  434 +// if("ID_CARD".equals(bean.getCredentialsType())){
  435 +// list.add(bean.getCredentials());
  436 +// }else{
  437 +// list.add(bean.getVoucher());
  438 +// }
  439 +// }
  440 +// // List集合转成数组
  441 +// String[] str = list.toArray(new String[0]);
  442 +// centerHandle.showDialog(str);
  443 + LogUtil.d("IDOrderListActivity","idcardNumber = "+idcardNumber);
  444 + List<PassengerInfosBean> passengerInfosBeans = orderInfos.get(position).getProducts().get(position).getPassengerInfos();
  445 + for (PassengerInfosBean bean : passengerInfosBeans){
  446 + if(idcardNumber.equals(bean.getCredentials())){
  447 + LogUtil.d("IDOrderListActivity","getCredentials1 = "+bean.getCredentials());
  448 + if("ID_CARD".equals(bean.getCredentialsType())){
  449 + LogUtil.d("IDOrderListActivity","getCredentialsType = "+bean.getCredentialsType());
  450 + centerHandle.partTicket(position, pwd, "TRUE",bean.getCredentials(),true);
  451 + }else{
  452 + centerHandle.partTicket(position, pwd, "TRUE",bean.getVoucher(),false);
  453 + }
  454 +
  455 + }
  456 + }
  457 +
427 458 } catch (NumberFormatException e) {
428 459 e.printStackTrace();
429 460 }
... ...
src/com/ectrip/cyt/ui/InputOrderListActivity.java
... ... @@ -211,7 +211,7 @@ public class InputOrderListActivity extends BaseActivity implements
211 211 if (orderInfos != null) {
212 212 adapter = new ReportExpandableListAdapter(
213 213 InputOrderListActivity.this,
214   - InputOrderListActivity.this, orderInfos);
  214 + InputOrderListActivity.this, orderInfos,0);
215 215 orderList.setAdapter(adapter);
216 216  
217 217 //取消分割线
... ...
src/com/ectrip/cyt/ui/MainActivity.java
... ... @@ -268,12 +268,12 @@ public class MainActivity extends BaseActivity implements OnItemClickListener, V
268 268 String ec_signkey = AESEncryptor.decrypt(constant.decrypt,
269 269 listConfig.get(0).getEc_signkey());
270 270 MyApp.getInstance().setSignkey(ec_signkey);
271   - LogUtil.i("MainActivity", ec_signkey);
  271 + LogUtil.i("MainActivity","ec_signkey = "+ ec_signkey);
272 272 } catch (Exception e) {
273 273 e.printStackTrace();
274 274 }
275 275 MyApp.getInstance().setIdentity(listConfig.get(0).getEc_identity());
276   - LogUtil.i("MainActivity", listConfig.get(0).getEc_identity());
  276 + LogUtil.i("MainActivity", "getEc_identity = "+listConfig.get(0).getEc_identity());
277 277 LogUtil.d(TAG, getString(R.string.current_ip)
278 278 + MyApp.getInstance().getServiceIp());
279 279 return true;
... ...
src/com/ectrip/cyt/ui/NewHandleScanerActivity.java
... ... @@ -20,6 +20,7 @@ import android.view.View;
20 20 import android.widget.Button;
21 21 import android.widget.TextView;
22 22 import android.widget.Toast;
  23 +
23 24 import android_serialport_api.SerialPortNewHandset;
24 25  
25 26 import com.ectrip.cyt.bean.ConfigBean;
... ... @@ -29,6 +30,7 @@ import com.ectrip.cyt.constant.constant;
29 30 import com.ectrip.cyt.db.DbManager;
30 31 import com.ectrip.cyt.shield_home.LockLayer.MToast;
31 32 import com.ectrip.cyt.utils.AESEncryptor;
  33 +import com.ectrip.cyt.utils.Base64;
32 34 import com.ectrip.cyt.utils.DesUtil;
33 35 import com.ectrip.trips.check.R;
34 36  
... ... @@ -36,259 +38,270 @@ import com.ectrip.trips.check.R;
36 38 * @author jigo 新的手持机二维码扫描
37 39 */
38 40 public class NewHandleScanerActivity extends BaseActivity {
39   - private final String TAG = "qrcode";
40   - protected MyApp mApplication;
41   - protected SerialPortNewHandset mSerialPort;
42   - protected OutputStream mOutputStream;
43   - private InputStream mInputStream;
44   - private ReadThread mReadThread;
45   - private String titleName;
  41 + private final String TAG = "qrcode";
  42 + protected MyApp mApplication;
  43 + protected SerialPortNewHandset mSerialPort;
  44 + protected OutputStream mOutputStream;
  45 + private InputStream mInputStream;
  46 + private ReadThread mReadThread;
  47 + private String titleName;
46 48  
47   - private Button scanerBtn;
48   - private View topBack;
49   - private TextView title;
  49 + private Button scanerBtn;
  50 + private View topBack;
  51 + private TextView title;
50 52  
51   - private AtomicBoolean isStop = new AtomicBoolean(false);
  53 + private AtomicBoolean isStop = new AtomicBoolean(false);
52 54  
53   - @Override
54   - protected void onCreate(Bundle savedInstanceState) {
55   - super.onCreate(savedInstanceState);
56   - setContentView(R.layout.activity_newhandle_scaner);
  55 + @Override
  56 + protected void onCreate(Bundle savedInstanceState) {
  57 + super.onCreate(savedInstanceState);
  58 + setContentView(R.layout.activity_newhandle_scaner);
57 59  
58   - initView();
59   - init();
  60 + initView();
  61 + init();
60 62  
61   - setpower("/sys/class/gpio/gpio28/value", false); // 给二代证下电
62   - try {
63   - Thread.sleep(1000);
64   - } catch (InterruptedException e) {
65   - }
66   - setpower("/sys/class/gpio/gpio114/value", true);
  63 + setpower("/sys/class/gpio/gpio28/value", false); // 给二代证下电
  64 + try {
  65 + Thread.sleep(1000);
  66 + } catch (InterruptedException e) {
  67 + }
  68 + setpower("/sys/class/gpio/gpio114/value", true);
67 69  
68   - // setTitle("Loopback test");
69   - scanerBtn = (Button) findViewById(R.id.scanerBtn);
70   - scanerBtn.setOnClickListener(new View.OnClickListener() {
71   - public void onClick(View paramAnonymousView) {
72   - byte[] arrayOfByte = { 0x1b, 0x31 };
73   - try {
74   - NewHandleScanerActivity.this.mOutputStream
75   - .write(arrayOfByte);
76   - return;
77   - } catch (IOException localIOException) {
78   - localIOException.printStackTrace();
79   - }
80   - }
81   - });
82   - }
  70 + // setTitle("Loopback test");
  71 + scanerBtn = (Button) findViewById(R.id.scanerBtn);
  72 + scanerBtn.setOnClickListener(new View.OnClickListener() {
  73 + public void onClick(View paramAnonymousView) {
  74 + byte[] arrayOfByte = {0x1b, 0x31};
  75 + try {
  76 + NewHandleScanerActivity.this.mOutputStream
  77 + .write(arrayOfByte);
  78 + return;
  79 + } catch (IOException localIOException) {
  80 + localIOException.printStackTrace();
  81 + }
  82 + }
  83 + });
  84 + }
83 85  
84   - private void initView() {
85   - title = (TextView) findViewById(R.id.title);
86   - topBack = findViewById(R.id.topBack);
87   - topBack.setOnClickListener(new View.OnClickListener() {
88   - @Override
89   - public void onClick(View v) {
90   - close();
91   - finish();
92   - }
93   - });
94   - }
  86 + private void initView() {
  87 + title = (TextView) findViewById(R.id.title);
  88 + topBack = findViewById(R.id.topBack);
  89 + topBack.setOnClickListener(new View.OnClickListener() {
  90 + @Override
  91 + public void onClick(View v) {
  92 + close();
  93 + finish();
  94 + }
  95 + });
  96 + }
95 97  
96   - private void init() {
97   - mApplication = (MyApp) getApplication();
98   - titleName = getIntent().getStringExtra("titleName");
99   - title.setVisibility(View.VISIBLE);
100   - if (titleName != null) {
101   - title.setText(titleName);
102   - } else {
103   - title.setText(R.string.qr_code);
104   - }
  98 + private void init() {
  99 + mApplication = (MyApp) getApplication();
  100 + titleName = getIntent().getStringExtra("titleName");
  101 + title.setVisibility(View.VISIBLE);
  102 + if (titleName != null) {
  103 + title.setText(titleName);
  104 + } else {
  105 + title.setText(R.string.qr_code);
  106 + }
105 107  
106   - try {
107   - mSerialPort = DevicTool.getInstance().getSerialPortNewHandset();
108   - mOutputStream = mSerialPort.getOutputStream();
109   - mInputStream = mSerialPort.getInputStream();
  108 + try {
  109 + mSerialPort = DevicTool.getInstance().getSerialPortNewHandset();
  110 + mOutputStream = mSerialPort.getOutputStream();
  111 + mInputStream = mSerialPort.getInputStream();
110 112  
111   - /* Create a receiving thread */
112   - mReadThread = new ReadThread();
113   - mReadThread.start();
114   - } catch (SecurityException e) {
115   - DisplayError(R.string.error_security);
116   - } catch (IOException e) {
117   - DisplayError(R.string.error_unknown);
118   - } catch (InvalidParameterException e) {
119   - DisplayError(R.string.error_configuration);
120   - }
121   - }
  113 + /* Create a receiving thread */
  114 + mReadThread = new ReadThread();
  115 + mReadThread.start();
  116 + } catch (SecurityException e) {
  117 + DisplayError(R.string.error_security);
  118 + } catch (IOException e) {
  119 + DisplayError(R.string.error_unknown);
  120 + } catch (InvalidParameterException e) {
  121 + DisplayError(R.string.error_configuration);
  122 + }
  123 + }
122 124  
123   - public void delay(int i) {
124   - for (int j = 0; j < 1000; j++)
125   - for (; i < 0; i--)
126   - ;
127   - }
  125 + public void delay(int i) {
  126 + for (int j = 0; j < 1000; j++)
  127 + for (; i < 0; i--)
  128 + ;
  129 + }
128 130  
129   - protected void onDataReceived(final byte[] buffer, final int size) {
130   - runOnUiThread(new Runnable() {
131   - public void run() {
  131 + protected void onDataReceived(final byte[] buffer, final int size) {
  132 + runOnUiThread(new Runnable() {
  133 + public void run() {
132 134  
133   - try {
134   - String tempstr = new String(buffer, 0, size);
135   - handleDecode(new String(tempstr.getBytes("GBK"), "GBK"));
136   - } catch (UnsupportedEncodingException e) {
137   - e.printStackTrace();
138   - } catch (Exception e) {
139   - e.printStackTrace();
140   - }
141   - // mReception.append(new String(buffer, 0, size));
142   - }
143   - });
144   - }
  135 + try {
  136 + String tempstr = new String(buffer, 0, size);
  137 + handleDecode(new String(tempstr.getBytes("GBK"), "GBK"));
  138 + } catch (UnsupportedEncodingException e) {
  139 + e.printStackTrace();
  140 + } catch (Exception e) {
  141 + e.printStackTrace();
  142 + }
  143 + // mReception.append(new String(buffer, 0, size));
  144 + }
  145 + });
  146 + }
145 147  
146   - /**
147   - * 处理扫描结果
148   - *
149   - * @param result
150   - * @param barcode
151   - */
152   - public void handleDecode(String result) {
153   - if (result.equals("")) {
154   - MToast(NewHandleScanerActivity.this, getString(R.string.scan_fail),
155   - MToast.LENGTH_SHORT);
156   - } else {
157   - try {
158   - result = result.substring(result.indexOf("_") + 1,
159   - result.indexOf(","));
160   - ArrayList<ConfigBean> beans = DbManager.GetConfigs();
161   - // 畅游通生成的订单ID:
162   - String ec_name = beans.get(0).getEc_signkey();
163   - ec_name = AESEncryptor.decrypt(constant.decrypt, ec_name);
164   - result = DesUtil.decrypt(result, ec_name);
165   - } catch (Exception e) {
166   - e.printStackTrace();
167   - MToast(NewHandleScanerActivity.this,
168   - getString(R.string.order_id_incorrect),
169   - MToast.LENGTH_SHORT);
170   - }
  148 + /**
  149 + * 处理扫描结果
  150 + *
  151 + * @param result
  152 + * @param
  153 + */
  154 + public void handleDecode(String result) {
  155 + if (result.equals("")) {
  156 + MToast(NewHandleScanerActivity.this, getString(R.string.scan_fail),
  157 + MToast.LENGTH_SHORT);
  158 + } else {
  159 + try {
  160 + if (result.startsWith("CYT_")) {
  161 + result = result.substring(result.indexOf("_") + 1,
  162 + result.indexOf(","));
  163 + ArrayList<ConfigBean> beans = DbManager.GetConfigs();
  164 + // 畅游通生成的订单ID:
  165 + String ec_name = beans.get(0).getEc_signkey();
  166 + ec_name = AESEncryptor.decrypt(constant.decrypt, ec_name);
  167 + result = DesUtil.decrypt(result, ec_name);
  168 + } else if (result.startsWith("TDOS_")) {
  169 + result = result.substring(
  170 + result.indexOf("_") + 1,
  171 + result.indexOf(","));
  172 + result = new String(Base64.decode(result), "utf-8");
  173 + } else if ((result.startsWith("TY_") || (result.startsWith("PMS_")))) {
  174 + result = result;
  175 + } else {
  176 + result = result;
  177 + }
  178 + } catch (Exception e) {
  179 + e.printStackTrace();
  180 + MToast(NewHandleScanerActivity.this,
  181 + getString(R.string.order_id_incorrect),
  182 + MToast.LENGTH_SHORT);
  183 + }
171 184  
172   - Intent intent = new Intent(NewHandleScanerActivity.this,
173   - QRCodeOrderListActivity.class);
174   - intent.putExtra("mode", 1);
175   - intent.putExtra("input_orid", result);
176   - if (result != null) {
177   - MToast(NewHandleScanerActivity.this, result, Toast.LENGTH_SHORT);
178   - }
179   - intent.putExtra("titleName",getString(R.string.show_result));
180   - startActivity(intent);
181   - finish();
182   - }
183   - finish();
184   - }
  185 + Intent intent = new Intent(NewHandleScanerActivity.this,
  186 + QRCodeOrderListActivity.class);
  187 + intent.putExtra("mode", 1);
  188 + intent.putExtra("input_orid", result);
  189 + if (result != null) {
  190 + MToast(NewHandleScanerActivity.this, result, Toast.LENGTH_SHORT);
  191 + }
  192 + intent.putExtra("titleName", getString(R.string.show_result));
  193 + startActivity(intent);
  194 + finish();
  195 + }
  196 + finish();
  197 + }
185 198  
186   - private void setpower(String path, boolean on) {
187   - File file;
188   - FileWriter fr;
189   - try {
190   - file = new File(path);
191   - fr = new FileWriter(file);
192   - if (on)
193   - fr.write("1");
194   - else
195   - fr.write("0");
196   - fr.close();
197   - } catch (IOException e) {
198   - Log.e(TAG, e.toString());
199   - }
200   - }
  199 + private void setpower(String path, boolean on) {
  200 + File file;
  201 + FileWriter fr;
  202 + try {
  203 + file = new File(path);
  204 + fr = new FileWriter(file);
  205 + if (on)
  206 + fr.write("1");
  207 + else
  208 + fr.write("0");
  209 + fr.close();
  210 + } catch (IOException e) {
  211 + Log.e(TAG, e.toString());
  212 + }
  213 + }
201 214  
202   - @Override
203   - public void onBackPressed() {
204   - super.onBackPressed();
205   - close();
206   - this.finish();
207   - }
  215 + @Override
  216 + public void onBackPressed() {
  217 + super.onBackPressed();
  218 + close();
  219 + this.finish();
  220 + }
208 221  
209   - @Override
210   - protected void onResume() {
211   - super.onResume();
212   - setpower("/sys/class/gpio/gpio114/value", true);
213   - }
  222 + @Override
  223 + protected void onResume() {
  224 + super.onResume();
  225 + setpower("/sys/class/gpio/gpio114/value", true);
  226 + }
214 227  
215   - private class ReadThread extends Thread {
  228 + private class ReadThread extends Thread {
216 229  
217   - @Override
218   - public void run() {
219   - super.run();
220   - while (!isInterrupted() && !isStop.get()) {
221   - int size;
222   - try {
223   - byte[] buffer = new byte[64];
224   - if (mInputStream == null)
225   - return;
226   - size = mInputStream.read(buffer);
227   - if (size > 0) {
228   - onDataReceived(buffer, size);
229   - }
230   - } catch (IOException e) {
231   - e.printStackTrace();
232   - return;
233   - }
234   - }
235   - }
236   - }
  230 + @Override
  231 + public void run() {
  232 + super.run();
  233 + while (!isInterrupted() && !isStop.get()) {
  234 + int size;
  235 + try {
  236 + byte[] buffer = new byte[64];
  237 + if (mInputStream == null)
  238 + return;
  239 + size = mInputStream.read(buffer);
  240 + if (size > 0) {
  241 + onDataReceived(buffer, size);
  242 + }
  243 + } catch (IOException e) {
  244 + e.printStackTrace();
  245 + return;
  246 + }
  247 + }
  248 + }
  249 + }
237 250  
238   - @Override
239   - public void onPause() {
240   - // bContinue = false;
241   - try {
242   - Thread.sleep(600);
243   - } catch (InterruptedException e) {
244   - }
245   - // closeDrive();
246   - super.onPause();
247   - setpower("/sys/class/gpio/gpio114/value", false);
  251 + @Override
  252 + public void onPause() {
  253 + // bContinue = false;
  254 + try {
  255 + Thread.sleep(600);
  256 + } catch (InterruptedException e) {
  257 + }
  258 + // closeDrive();
  259 + super.onPause();
  260 + setpower("/sys/class/gpio/gpio114/value", false);
248 261  
249   - }
  262 + }
250 263  
251   - private void close() {
252   - isStop.set(true);
253   - if (mOutputStream != null) {
254   - try {
255   - mOutputStream.close();
256   - } catch (IOException e) {
257   - // TODO Auto-generated catch block
258   - e.printStackTrace();
259   - }
260   - }
261   - if (mOutputStream != null) {
262   - try {
263   - mOutputStream.close();
264   - } catch (IOException e) {
265   - e.printStackTrace();
266   - }
267   - }
268   - if (mSerialPort != null) {
269   - mSerialPort.close();
270   - }
271   - if (mReadThread != null)
272   - mReadThread.interrupt();
273   - DevicTool.getInstance().closeSerialPortNewHandset();
274   - mSerialPort = null;
275   - }
  264 + private void close() {
  265 + isStop.set(true);
  266 + if (mOutputStream != null) {
  267 + try {
  268 + mOutputStream.close();
  269 + } catch (IOException e) {
  270 + // TODO Auto-generated catch block
  271 + e.printStackTrace();
  272 + }
  273 + }
  274 + if (mOutputStream != null) {
  275 + try {
  276 + mOutputStream.close();
  277 + } catch (IOException e) {
  278 + e.printStackTrace();
  279 + }
  280 + }
  281 + if (mSerialPort != null) {
  282 + mSerialPort.close();
  283 + }
  284 + if (mReadThread != null)
  285 + mReadThread.interrupt();
  286 + DevicTool.getInstance().closeSerialPortNewHandset();
  287 + mSerialPort = null;
  288 + }
276 289  
277   - @Override
278   - protected void onDestroy() {
279   - close();
280   - super.onDestroy();
281   - }
  290 + @Override
  291 + protected void onDestroy() {
  292 + close();
  293 + super.onDestroy();
  294 + }
282 295  
283   - private void DisplayError(int resourceId) {
284   - AlertDialog.Builder b = new AlertDialog.Builder(this);
285   - b.setTitle("Error");
286   - b.setMessage(resourceId);
287   - b.setPositiveButton("OK", new OnClickListener() {
288   - public void onClick(DialogInterface dialog, int which) {
289   - finish();
290   - }
291   - });
292   - b.show();
293   - }
  296 + private void DisplayError(int resourceId) {
  297 + AlertDialog.Builder b = new AlertDialog.Builder(this);
  298 + b.setTitle("Error");
  299 + b.setMessage(resourceId);
  300 + b.setPositiveButton("OK", new OnClickListener() {
  301 + public void onClick(DialogInterface dialog, int which) {
  302 + finish();
  303 + }
  304 + });
  305 + b.show();
  306 + }
294 307 }
... ...
src/com/ectrip/cyt/ui/PhomeScanerOrderActivity.java
... ... @@ -151,6 +151,10 @@ public class PhomeScanerOrderActivity extends BaseActivity implements Callback {
151 151 resultString.indexOf("_") + 1,
152 152 resultString.indexOf(","));
153 153 resultString = new String(Base64.decode(resultString), "utf-8");
  154 + }else if((resultString.startsWith("TY_") || (resultString.startsWith("PMS_")))){
  155 + resultString = resultString;
  156 + }else{
  157 + resultString = resultString;
154 158 }
155 159 } catch (Exception e) {
156 160 e.printStackTrace();
... ...
src/com/ectrip/cyt/ui/PhoneOrderListActivity.java
... ... @@ -38,6 +38,7 @@ import com.ectrip.cyt.constant.DeviceType;
38 38 import com.ectrip.cyt.constant.OrderCode;
39 39 import com.ectrip.cyt.constant.SelectAction;
40 40 import com.ectrip.cyt.response.QueryOrderResponse;
  41 +import com.ectrip.cyt.utils.LogUtil;
41 42 import com.ectrip.cyt.utils.SharedPreferences2Obj;
42 43 import com.ectrip.cyt.utils.SoundUtil;
43 44 import com.ectrip.trips.check.R;
... ... @@ -281,6 +282,7 @@ public class PhoneOrderListActivity extends BaseActivity implements
281 282  
282 283 @Override
283 284 public void afterCompletedCallback(DataTrans result) {
  285 + LogUtil.d("PhoneOrderListActivity","result_data = "+result.getData());
284 286 if (result != null) {
285 287 signed = result.getSigned();
286 288 data = result.getData();
... ... @@ -344,7 +346,7 @@ public class PhoneOrderListActivity extends BaseActivity implements
344 346 if (adapter==null){
345 347 adapter = new ReportExpandableListAdapter(
346 348 PhoneOrderListActivity.this,
347   - PhoneOrderListActivity.this, orderInfos);
  349 + PhoneOrderListActivity.this, orderInfos,0);
348 350 orderList.setAdapter(adapter);
349 351  
350 352 }else {
... ...
src/com/ectrip/cyt/ui/QRCodeOrderListActivity.java
... ... @@ -28,7 +28,9 @@ import com.ectrip.cyt.config.MyApp;
28 28 import com.ectrip.cyt.constant.DeviceType;
29 29 import com.ectrip.cyt.constant.OrderCode;
30 30 import com.ectrip.cyt.constant.SelectAction;
  31 +import com.ectrip.cyt.response.PassengerInfosBean;
31 32 import com.ectrip.cyt.response.QueryOrderResponse;
  33 +import com.ectrip.cyt.utils.LogUtil;
32 34 import com.ectrip.cyt.utils.SharedPreferences2Obj;
33 35 import com.ectrip.cyt.utils.SoundUtil;
34 36 import com.ectrip.trips.check.R;
... ... @@ -39,287 +41,293 @@ import com.ectrip.trips.view.AnimatedExpandableListView;
39 41 /**
40 42 * 二维码列表
41 43 */
42   -public class QRCodeOrderListActivity extends BaseActivity implements
43   - ListOnclickCallback {
  44 +public class QRCodeOrderListActivity extends BaseActivity implements ListOnclickCallback {
  45 + private String TAG = "QRCodeOrderListActivity";
  46 + private AnimatedExpandableListView orderList;
  47 + private ReportExpandableListAdapter adapter;
  48 + private String orid;
  49 + private List<OrderInfo> orderInfos;
  50 + private Integer type;
  51 + private View errorLayout;
  52 + private TextView errorInfo;
  53 + private Integer Select;
44 54  
45   - private AnimatedExpandableListView orderList;
46   - private ReportExpandableListAdapter adapter;
47   - private String orid;
48   - private List<OrderInfo> orderInfos;
49   - private Integer type;
50   - private View errorLayout;
51   - private TextView errorInfo;
52   - private Integer Select;
  55 + @Override
  56 + protected void onCreate(Bundle savedInstanceState) {
  57 + super.onCreate(savedInstanceState);
  58 + setContentView(R.layout.id_order_list_activity);
  59 + initView();
  60 + init();
  61 + }
53 62  
54   - @Override
55   - protected void onCreate(Bundle savedInstanceState) {
56   - super.onCreate(savedInstanceState);
57   - setContentView(R.layout.id_order_list_activity);
58   - initView();
59   - init();
60   - }
  63 + private void initView() {
  64 + Select = SharedPreferences2Obj
  65 + .getInstance(QRCodeOrderListActivity.this)
  66 + .setName("SelectAction").getObject("Select", Integer.class);
  67 + if (Select != null) {
  68 + if (Select == SelectAction.Check.getValue()) {
  69 + ((TextView) findViewById(R.id.title))
  70 + .setText(getString(R.string.order_list_check));
  71 + } else if (Select == SelectAction.Reprint.getValue()) {
  72 + ((TextView) findViewById(R.id.title))
  73 + .setText(getString(R.string.order_list_reprint));
  74 + } else if (Select == SelectAction.Query.getValue()) {
  75 + ((TextView) findViewById(R.id.title))
  76 + .setText(getString(R.string.order_list_query));
  77 + }
  78 + } else {
  79 + ((TextView) findViewById(R.id.title))
  80 + .setText(getString(R.string.order_list));
  81 + }
  82 + errorLayout = findViewById(R.id.errorLayout);
  83 + errorInfo = (TextView) errorLayout.findViewById(R.id.errorInfo);
  84 + ((TextView) findViewById(R.id.title)).setVisibility(View.VISIBLE);
  85 + orderList = (AnimatedExpandableListView) findViewById(R.id.orderList);
  86 + orderList.setGroupIndicator(null);
  87 + findViewById(R.id.topBack).setOnClickListener(new OnClickListener() {
  88 + @Override
  89 + public void onClick(View v) {
  90 + finish();
  91 + }
  92 + });
  93 + }
61 94  
62   - private void initView() {
63   - Select = SharedPreferences2Obj
64   - .getInstance(QRCodeOrderListActivity.this)
65   - .setName("SelectAction").getObject("Select", Integer.class);
66   - if (Select != null) {
67   - if (Select == SelectAction.Check.getValue()) {
68   - ((TextView) findViewById(R.id.title))
69   - .setText(getString(R.string.order_list_check));
70   - } else if (Select == SelectAction.Reprint.getValue()) {
71   - ((TextView) findViewById(R.id.title))
72   - .setText(getString(R.string.order_list_reprint));
73   - } else if (Select == SelectAction.Query.getValue()) {
74   - ((TextView) findViewById(R.id.title))
75   - .setText(getString(R.string.order_list_query));
76   - }
77   - } else {
78   - ((TextView) findViewById(R.id.title))
79   - .setText(getString(R.string.order_list));
80   - }
81   - errorLayout = findViewById(R.id.errorLayout);
82   - errorInfo = (TextView) errorLayout.findViewById(R.id.errorInfo);
83   - ((TextView) findViewById(R.id.title)).setVisibility(View.VISIBLE);
84   - orderList = (AnimatedExpandableListView) findViewById(R.id.orderList);
85   - orderList.setGroupIndicator(null);
86   - findViewById(R.id.topBack).setOnClickListener(new OnClickListener() {
87   - @Override
88   - public void onClick(View v) {
89   - finish();
90   - }
91   - });
92   - }
  95 + private void init() {
  96 + type = SharedPreferences2Obj.getInstance(QRCodeOrderListActivity.this)
  97 + .setName("MachineType").getObject("type", Integer.class);
  98 + orid = getIntent().getStringExtra("input_orid");
  99 + LogUtil.d(TAG, "orid = " + orid);
  100 + HttpHelper.getInstance(QRCodeOrderListActivity.this).queryOrder(
  101 + "QRCODE", null, null, null, orid, null, null, "15", "1",
  102 + new MyHttpCallback());
  103 + }
93 104  
94   - private void init() {
95   - type = SharedPreferences2Obj.getInstance(QRCodeOrderListActivity.this)
96   - .setName("MachineType").getObject("type", Integer.class);
97   - orid = getIntent().getStringExtra("input_orid");
98   - HttpHelper.getInstance(QRCodeOrderListActivity.this).queryOrder(
99   - "QRCODE", null, null, null, orid, null, null, "15","1",
100   - new MyHttpCallback());
101   - }
  105 + public class MyHttpCallback extends HttpCallback<DataTrans> {
  106 + ProgressDialog dialog = null;
  107 + private String signed;
  108 + private String data;
102 109  
103   - public class MyHttpCallback extends HttpCallback<DataTrans> {
104   - ProgressDialog dialog = null;
105   - private String signed;
106   - private String data;
  110 + @Override
  111 + public void onStopCallback() {
107 112  
108   - @Override
109   - public void onStopCallback() {
  113 + }
110 114  
111   - }
  115 + @Override
  116 + public void onPreCallback() {
  117 + if (dialog == null) {
  118 + // 显示ProgressDialog
  119 + dialog = new ProgressDialog(QRCodeOrderListActivity.this);
  120 + dialog.setMessage(getString(R.string.get_order));
  121 + dialog.setCanceledOnTouchOutside(true);
  122 + dialog.setCancelable(true);
  123 + if (type == DeviceType.HANDSET.getValue()) {
  124 + dialog.getWindow().setType(
  125 + WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
  126 + }
  127 + try {
  128 + if (dialog != null && !dialog.isShowing()) {
  129 + dialog.show();
  130 + }
  131 + } catch (Exception e) {
  132 + e.printStackTrace();
  133 + }
  134 + } else {
  135 + dialog.setMessage(getString(R.string.get_order));
  136 + }
  137 + }
112 138  
113   - @Override
114   - public void onPreCallback() {
115   - if (dialog == null) {
116   - // 显示ProgressDialog
117   - dialog = new ProgressDialog(QRCodeOrderListActivity.this);
118   - dialog.setMessage(getString(R.string.get_order));
119   - dialog.setCanceledOnTouchOutside(true);
120   - dialog.setCancelable(true);
121   - if (type == DeviceType.HANDSET.getValue()) {
122   - dialog.getWindow().setType(
123   - WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
124   - }
125   - try {
126   - if (dialog != null && !dialog.isShowing()) {
127   - dialog.show();
128   - }
129   - } catch (Exception e) {
130   - e.printStackTrace();
131   - }
132   - } else {
133   - dialog.setMessage(getString(R.string.get_order));
134   - }
135   - }
  139 + @Override
  140 + public void onFailureCallback(String FailureStr) {
  141 + orderList.setEmptyView(errorLayout);
  142 + errorLayout.setVisibility(View.VISIBLE); // 错误信息提示
  143 + if (dialog != null && dialog.isShowing()) {
  144 + try {
  145 + dialog.dismiss();
  146 + } catch (Exception e) {
  147 + e.printStackTrace();
  148 + } catch (Throwable e) {
  149 + e.printStackTrace();
  150 + }
  151 + }
  152 + //播放语音
  153 + SoundUtil.getInstents(QRCodeOrderListActivity.this).playWavSound(R.raw.wuxiaopiao);
  154 + if (FailureStr != null) {
  155 + errorInfo.setText(FailureStr);
  156 + MToast(QRCodeOrderListActivity.this, FailureStr,
  157 + Toast.LENGTH_LONG);
  158 + }
  159 + }
136 160  
137   - @Override
138   - public void onFailureCallback(String FailureStr) {
139   - orderList.setEmptyView(errorLayout);
140   - errorLayout.setVisibility(View.VISIBLE); // 错误信息提示
141   - if (dialog != null && dialog.isShowing()) {
142   - try {
143   - dialog.dismiss();
144   - } catch (Exception e) {
145   - e.printStackTrace();
146   - } catch (Throwable e) {
147   - e.printStackTrace();
148   - }
149   - }
150   - //播放语音
151   - SoundUtil.getInstents(QRCodeOrderListActivity.this).playWavSound(R.raw.wuxiaopiao);
152   - if (FailureStr != null) {
153   - errorInfo.setText(FailureStr);
154   - MToast(QRCodeOrderListActivity.this, FailureStr,
155   - Toast.LENGTH_LONG);
156   - }
157   - }
  161 + @Override
  162 + public void onCompletedCallback(DataTrans result) {
158 163  
159   - @Override
160   - public void onCompletedCallback(DataTrans result) {
  164 + }
161 165  
162   - }
  166 + @Override
  167 + public void afterCompletedCallback(DataTrans result) {
  168 + LogUtil.d("QRCodeOrderListActivity", "result_data = " + result.getData());
  169 + if (result != null) {
  170 + signed = result.getSigned();
  171 + data = result.getData();
  172 + parse2(result.getData(), QueryOrderResponse.class,
  173 + QRCodeOrderListActivity.this);
  174 + } else {
  175 + if (dialog != null && dialog.isShowing()) {
  176 + try {
  177 + dialog.dismiss();
  178 + } catch (Exception e) {
  179 + e.printStackTrace();
  180 + } catch (Throwable e) {
  181 + e.printStackTrace();
  182 + }
  183 + }
  184 + //播放语音
  185 + SoundUtil.getInstents(QRCodeOrderListActivity.this).playWavSound(R.raw.qingchongxinyanpiao);
  186 + MToast(QRCodeOrderListActivity.this,
  187 + getString(R.string.get_order_error), Toast.LENGTH_LONG);
  188 + }
  189 + }
163 190  
164   - @Override
165   - public void afterCompletedCallback(DataTrans result) {
166   - if (result != null) {
167   - signed = result.getSigned();
168   - data = result.getData();
169   - parse2(result.getData(), QueryOrderResponse.class,
170   - QRCodeOrderListActivity.this);
171   - } else {
172   - if (dialog != null && dialog.isShowing()) {
173   - try {
174   - dialog.dismiss();
175   - } catch (Exception e) {
176   - e.printStackTrace();
177   - } catch (Throwable e) {
178   - e.printStackTrace();
179   - }
180   - }
181   - //播放语音
182   - SoundUtil.getInstents(QRCodeOrderListActivity.this).playWavSound(R.raw.qingchongxinyanpiao);
183   - MToast(QRCodeOrderListActivity.this,
184   - getString(R.string.get_order_error), Toast.LENGTH_LONG);
185   - }
186   - }
  191 + @Override
  192 + public void onAgainParseCallback(Object parse) {
  193 + if (dialog != null && dialog.isShowing()) {
  194 + try {
  195 + dialog.dismiss();
  196 + } catch (Exception e) {
  197 + e.printStackTrace();
  198 + } catch (Throwable e) {
  199 + e.printStackTrace();
  200 + }
  201 + }
  202 + if (parse != null) {
  203 + QueryOrderResponse orderResponse = (QueryOrderResponse) parse;
  204 + String code = orderResponse.getCode();
  205 + if (code != null && OrderCode.SUCESS.getValue().equals(code)) {
  206 + if (signed == null
  207 + || signed.equals(DataTool.getSign(MyApp
  208 + .getInstance().getSignkey(), data))) {
  209 + orderInfos = orderResponse.getOrderInfos();
  210 + if (orderInfos != null) {
  211 + adapter = new ReportExpandableListAdapter(
  212 + QRCodeOrderListActivity.this,
  213 + QRCodeOrderListActivity.this, orderInfos, 1);
  214 + orderList.setAdapter(adapter);
187 215  
188   - @Override
189   - public void onAgainParseCallback(Object parse) {
190   - if (dialog != null && dialog.isShowing()) {
191   - try {
192   - dialog.dismiss();
193   - } catch (Exception e) {
194   - e.printStackTrace();
195   - } catch (Throwable e) {
196   - e.printStackTrace();
197   - }
198   - }
199   - if (parse != null) {
200   - QueryOrderResponse orderResponse = (QueryOrderResponse) parse;
201   - String code = orderResponse.getCode();
202   - if (code != null && OrderCode.SUCESS.getValue().equals(code)) {
203   - if (signed == null
204   - || signed.equals(DataTool.getSign(MyApp
205   - .getInstance().getSignkey(), data))) {
206   - orderInfos = orderResponse.getOrderInfos();
207   - if (orderInfos != null) {
208   - adapter = new ReportExpandableListAdapter(
209   - QRCodeOrderListActivity.this,
210   - QRCodeOrderListActivity.this, orderInfos);
211   - orderList.setAdapter(adapter);
  216 + //取消分割线
  217 + orderList.setDivider(null);
  218 + //默认展开
  219 + for (int i = 0; i < orderInfos.size(); i++) {
  220 + orderList.expandGroup(i);
  221 + }
212 222  
213   - //取消分割线
214   - orderList.setDivider(null);
215   - //默认展开
216   - for (int i = 0; i < orderInfos.size(); i++) {
217   - orderList.expandGroup(i);
218   - }
  223 + //点击不可收缩
  224 + orderList.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
219 225  
220   - //点击不可收缩
221   - orderList.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
  226 + @Override
  227 + public boolean onGroupClick(ExpandableListView parent, View v,
  228 + int groupPosition, long id) {
  229 + return true;
  230 + }
  231 + });
222 232  
223   - @Override
224   - public boolean onGroupClick(ExpandableListView parent, View v,
225   - int groupPosition, long id) {
226   - return true;
227   - }
228   - });
  233 + } else {
  234 + //播放语音
  235 + SoundUtil.getInstents(QRCodeOrderListActivity.this).playWavSound(R.raw.qingchongxinyanpiao);
  236 + MToast(QRCodeOrderListActivity.this,
  237 + getString(R.string.get_order_error),
  238 + Toast.LENGTH_LONG);
  239 + }
  240 + } else {
  241 + //播放语音
  242 + SoundUtil.getInstents(QRCodeOrderListActivity.this).playWavSound(R.raw.qingchongxinyanpiao);
  243 + onFailureCallback(getString(R.string.sign_not_pass));
  244 + MToast(QRCodeOrderListActivity.this,
  245 + getString(R.string.sign_not_pass),
  246 + Toast.LENGTH_LONG);
  247 + }
  248 + } else {
  249 + onFailureCallback(orderResponse.getDescribe());
  250 + MToast(QRCodeOrderListActivity.this,
  251 + orderResponse.getDescribe(), Toast.LENGTH_LONG);
  252 + }
  253 + }
  254 + }
  255 + }
229 256  
230   - } else {
231   - //播放语音
232   - SoundUtil.getInstents(QRCodeOrderListActivity.this).playWavSound(R.raw.qingchongxinyanpiao);
233   - MToast(QRCodeOrderListActivity.this,
234   - getString(R.string.get_order_error),
235   - Toast.LENGTH_LONG);
236   - }
237   - } else {
238   - //播放语音
239   - SoundUtil.getInstents(QRCodeOrderListActivity.this).playWavSound(R.raw.qingchongxinyanpiao);
240   - onFailureCallback(getString(R.string.sign_not_pass));
241   - MToast(QRCodeOrderListActivity.this,
242   - getString(R.string.sign_not_pass),
243   - Toast.LENGTH_LONG);
244   - }
245   - } else {
246   - onFailureCallback(orderResponse.getDescribe());
247   - MToast(QRCodeOrderListActivity.this,
248   - orderResponse.getDescribe(), Toast.LENGTH_LONG);
249   - }
250   - }
251   - }
252   - }
  257 + CenterHandle centerHandle;
253 258  
254   - CenterHandle centerHandle;
255   -
256   - @Override
257   - public void onclickCallback(View view, int position) {
258   - if (view.getId() == R.id.ticketPrint) {
259   - if (centerHandle == null) {
260   - centerHandle = new CenterHandle(QRCodeOrderListActivity.this,
261   - orderInfos, "", "FALSE", QRCodeOrderListActivity.this);
262   - }
263   - centerHandle.allTicket(position, "", "FALSE");
264   - } else if (view.getId() == R.id.part) {
265   - try {
  259 + @Override
  260 + public void onclickCallback(View view, int position) {
  261 + if (view.getId() == R.id.ticketPrint) {
  262 + if (centerHandle == null) {
  263 + centerHandle = new CenterHandle(QRCodeOrderListActivity.this,
  264 + orderInfos, "", "FALSE", QRCodeOrderListActivity.this);
  265 + }
  266 + centerHandle.allTicket(position, "", "FALSE");
  267 + } else if (view.getId() == R.id.part) {
  268 + try {
266 269 // String pwd = orderInfos.get(position).getCredentials();
267 270 // pwd = pwd.substring(6, 14);
268   - if (centerHandle == null) {
269   - centerHandle = new CenterHandle(
270   - QRCodeOrderListActivity.this, orderInfos, "",
271   - "FALSE", QRCodeOrderListActivity.this);
272   - }
273   - centerHandle.dialog(
274   - Integer.parseInt(orderInfos.get(position).getOrderAmount()),
275   - position);
276   - } catch (NumberFormatException e) {
277   - e.printStackTrace();
278   - }
279   - }
280   - }
  271 + if (centerHandle == null) {
  272 + centerHandle = new CenterHandle(
  273 + QRCodeOrderListActivity.this, orderInfos, "",
  274 + "FALSE", QRCodeOrderListActivity.this);
  275 + }
  276 +// centerHandle.dialog(Integer.parseInt(orderInfos.get(position).getOrderAmount()), position);
  277 + List<PassengerInfosBean> passengerInfosBeans = orderInfos.get(position).getProducts().get(position).getPassengerInfos();
  278 + for (PassengerInfosBean bean : passengerInfosBeans) {
  279 + if (orid.equals(bean.getVoucher())) {
  280 + LogUtil.d("IDOrderListActivity", "getVoucher = " + bean.getVoucher());
  281 + centerHandle.partTicket(position, "", "TRUE", bean.getVoucher(), false);
  282 + }
  283 + }
  284 + } catch (NumberFormatException e) {
  285 + e.printStackTrace();
  286 + }
  287 + }
  288 + }
281 289  
282   - @Override
283   - public void onCenterCallback() {
284   - adapter.notifyDataSetChanged();
285   - centerHandle = null;
286   - }
  290 + @Override
  291 + public void onCenterCallback() {
  292 + adapter.notifyDataSetChanged();
  293 + centerHandle = null;
  294 + }
287 295  
288   - AtomicBoolean isonKey = new AtomicBoolean(false);
  296 + AtomicBoolean isonKey = new AtomicBoolean(false);
289 297  
290   - @Override
291   - public void onPrintInfosCallback(String Infos) {
292   - PrintHandle.getInstance().print(Infos, QRCodeOrderListActivity.this);
293   - }
  298 + @Override
  299 + public void onPrintInfosCallback(String Infos) {
  300 + PrintHandle.getInstance().print(Infos, QRCodeOrderListActivity.this);
  301 + }
294 302  
295   - @Override
296   - public boolean onKeyDown(int keyCode, KeyEvent event) {
297   - if (keyCode == KeyEvent.KEYCODE_BACK && isonKey.get()) {
298   - return true;
299   - }
300   - return super.onKeyDown(keyCode, event);
301   - }
  303 + @Override
  304 + public boolean onKeyDown(int keyCode, KeyEvent event) {
  305 + if (keyCode == KeyEvent.KEYCODE_BACK && isonKey.get()) {
  306 + return true;
  307 + }
  308 + return super.onKeyDown(keyCode, event);
  309 + }
302 310  
303   - @Override
304   - public void onProgress() {
305   - isonKey.set(true);
306   - TimerTask task = new TimerTask() {
307   - public void run() {
308   - try {
309   - isonKey.set(false);
310   - } catch (Exception e) {
311   - e.printStackTrace();
312   - }
313   - }
314   - };
315   - Timer timer = new Timer();
316   - timer.schedule(task, 3000);
317   - }
  311 + @Override
  312 + public void onProgress() {
  313 + isonKey.set(true);
  314 + TimerTask task = new TimerTask() {
  315 + public void run() {
  316 + try {
  317 + isonKey.set(false);
  318 + } catch (Exception e) {
  319 + e.printStackTrace();
  320 + }
  321 + }
  322 + };
  323 + Timer timer = new Timer();
  324 + timer.schedule(task, 3000);
  325 + }
318 326  
319   - @Override
320   - protected void onDestroy() {
321   - PrintHandle.getInstance().printClose();
322   - super.onDestroy();
323   - }
  327 + @Override
  328 + protected void onDestroy() {
  329 + PrintHandle.getInstance().printClose();
  330 + super.onDestroy();
  331 + }
324 332  
325 333 }
... ...
src/com/ectrip/cyt/ui/ScanerOrderActivity.java
... ... @@ -29,6 +29,7 @@ import com.ectrip.cyt.db.DbManager;
29 29 import com.ectrip.cyt.shield_home.LockLayer.MToast;
30 30 import com.ectrip.cyt.utils.AESEncryptor;
31 31 import com.ectrip.cyt.utils.ActivitiesManager;
  32 +import com.ectrip.cyt.utils.Base64;
32 33 import com.ectrip.cyt.utils.CommetryUtils;
33 34 import com.ectrip.cyt.utils.DesUtil;
34 35 import com.ectrip.cyt.utils.LogUtil;
... ... @@ -50,363 +51,375 @@ import java.util.ArrayList;
50 51 */
51 52 public class ScanerOrderActivity extends BaseActivity {
52 53  
53   - public final String TAG = "ScanerOrderActivity";
54   -
55   - static {
56   - try {
57   - System.loadLibrary("iconv");
58   - } catch (Exception e) {
59   - e.printStackTrace();
60   - } catch (Throwable e) {
61   - e.printStackTrace();
62   - }
63   - }
64   - private String titleName;
65   -
66   - private final float BEEP_VOLUME = 0.10f;
67   - private final long VIBRATE_DURATION = 200L;
68   -
69   - @SuppressWarnings("deprecation")
70   - private Camera mCamera;
71   - private CameraPreview mPreview;
72   - @SuppressWarnings("deprecation")
73   - Parameters mParameters;
74   - MediaPlayer player;
75   - private MediaPlayer mediaPlayer;
76   - ImageScanner scanner;
77   -
78   - private boolean playBeep = true;
79   -
80   - private String scannerResult = "";
81   -
82   - private Integer Select; // 选择模式 检票 补票 查票
83   -
84   - private WifiManager wifi;
85   - private boolean isConnected;
86   -
87   - private MyHandler handler;
88   -
89   - @Override
90   - protected void onCreate(Bundle savedInstanceState) {
91   - super.onCreate(savedInstanceState);
92   - setContentView(R.layout.app_ord_scanner);
93   - ActivitiesManager.getInstance().pushActivity(this);
94   -
95   - ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
96   - NetworkInfo mWifi = connManager
97   - .getNetworkInfo(ConnectivityManager.TYPE_WIFI);
98   -
99   - if (mWifi.isConnected()) {
100   - isConnected = true;
101   - } else {
102   - wifi = (WifiManager) getApplicationContext().getSystemService(ScanerOrderActivity.WIFI_SERVICE);
103   - if (wifi.isWifiEnabled()) {
104   - } else {
105   - wifi.setWifiEnabled(true);
106   - }
107   - }
108   -
109   - initConfig();
110   - initView();
111   - }
112   -
113   - private void initConfig() {
114   - findViewById(R.id.topBack).setOnClickListener(new OnClickListener() {
115   -
116   - @Override
117   - public void onClick(View arg0) {
118   - finish();
119   - }
120   - });
121   - }
122   -
123   - @SuppressWarnings("deprecation")
124   - private void initView() {
125   - try {
126   - SharedPreferences2Obj.getInstance(ScanerOrderActivity.this)
127   - .setName("SelectAction").setObject("isStatistic", "0"); // 非统计
128   - } catch (Exception e1) {
129   - e1.printStackTrace();
130   - }
131   - try {
132   - titleName = getIntent().getStringExtra("titleName");
133   - if (titleName != null) {
134   - ((TextView) findViewById(R.id.title)).setText(titleName);
135   - } else {
136   - ((TextView) findViewById(R.id.title))
137   - .setText(R.string.scan_qr_code);
138   - }
139   - ((TextView) findViewById(R.id.title)).setVisibility(View.VISIBLE);
140   - FrameLayout preview = (FrameLayout) findViewById(R.id.cameraPreview);
141   -
142   - handler = new MyHandler();
143   - mCamera = getCameraInstance();
144   - mPreview = new CameraPreview(ScanerOrderActivity.this, mCamera,
145   - previewCb);
146   - preview.addView(mPreview);
147   - mCamera.setPreviewCallbackWithBuffer(previewCb);
148   - mCamera.startPreview();
149   -
150   - if (isConnected == false && wifi != null && wifi.isWifiEnabled()) {
151   - wifi.setWifiEnabled(false);
152   - }
153   - } catch (Exception e1) {
154   - e1.printStackTrace();
155   - }
156   -
157   - new Thread(new Runnable() {
158   -
159   - @Override
160   - public void run() {
161   - try {
162   - player = MediaPlayer.create(ScanerOrderActivity.this,
163   - R.raw.bad);
164   -
165   - /* Instance barcode scanner */
166   - scanner = new ImageScanner();
167   - scanner.setConfig(0, Config.POSITION, 3);
168   - scanner.setConfig(0, Config.POSITION, 3);
169   -
170   - // 初始化声音和震动
171   - AudioManager audioService = (AudioManager) getSystemService(AUDIO_SERVICE);
172   - // 如果手机是震动模式就震动
173   - if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
174   - playBeep = false;
175   - }
176   - // 初始化声音
177   - initBeepSound();
178   - } catch (Exception e) {
179   - e.printStackTrace();
180   - }
181   - }
182   - }).start();
183   - }
184   -
185   - @SuppressWarnings("deprecation")
186   - PreviewCallback previewCb = new PreviewCallback() {
187   - @Override
188   - public void onPreviewFrame(byte[] data, Camera camera) {
189   - Camera.Parameters parameters = camera.getParameters();
190   - Size size = parameters.getPreviewSize();
191   -
192   - Image barcode = new Image(size.width, size.height, "NV21");
193   - barcode.setData(data);
194   - barcode = barcode.convert("Y800");
195   - int result = scanner.scanImage(barcode);
196   - // Toast.makeText(CameraTestActivity.this, result+"",
197   - // Toast.LENGTH_SHORT).show();
198   - if (result != 0) {
199   - mCamera.setPreviewCallback(null);
200   - mCamera.stopPreview();
201   -
202   - SymbolSet syms = scanner.getResults();
203   -
204   - playBeepSoundAndVibrate();// 播放声音和振动代表成功获取二维码
205   -
206   - for (Symbol sym : syms) {
207   -
208   - try {
209   -
210   - scannerResult = sym.getData();
211   - LogUtil.i(TAG, getString(R.string.scan_result)
212   - + scannerResult);
213   - scannerResult = scannerResult.substring(
214   - scannerResult.indexOf("_") + 1,
215   - scannerResult.indexOf(","));
216   - ArrayList<ConfigBean> beans = DbManager.GetConfigs();
217   - // 畅游通生成的订单ID:
218   - String ec_name = beans.get(0).getEc_signkey();
219   - ec_name = AESEncryptor.decrypt(constant.decrypt,
220   - ec_name);
221   - scannerResult = DesUtil.decrypt(scannerResult, ec_name);
222   - LogUtil.i(TAG, getString(R.string.scan_result)
223   - + scannerResult);
224   - Message msg = new Message();
225   - msg.what = 0;
226   - msg.obj = scannerResult;
227   - handler.handleMessage(msg);
228   - } catch (Exception e) {
229   - // player.start();
230   - try {
231   - scannerResult = "";
232   - e.printStackTrace();
233   - MToast(ScanerOrderActivity.this,
234   - getString(R.string.setting_is_correct),
235   - MToast.LENGTH_LONG);
236   - errorGoon();// 播放错误信息
237   - } catch (Exception e1) {
238   - e1.printStackTrace();
239   - }
240   - }
241   - }
242   -
243   - }
244   - }
245   - };
246   -
247   - @Override
248   - public void onPause() {
249   - super.onPause();
250   - releaseCamera();
251   - }
252   -
253   - @SuppressWarnings("deprecation")
254   - public static Camera getCameraInstance() {
255   - Camera c = null;
256   - try {
257   - c = Camera.open();
258   -
259   - } catch (Exception e) {
260   - }
261   - return c;
262   - }
263   -
264   - @SuppressWarnings("deprecation")
265   - private void releaseCamera() {
266   - try {
267   - if (mCamera != null) {
268   - mCamera.setPreviewCallback(null);
269   - mCamera.stopPreview();
270   - mCamera.release();
271   -
272   - mCamera = null;
273   - }
274   - } catch (Exception e) {
275   - e.printStackTrace();
276   - }
277   - }
278   -
279   - @SuppressWarnings("deprecation")
280   - public void errorGoon() {
281   - player.start();
282   - mCamera.setPreviewCallback(previewCb);
283   - sleep(3000);
284   - mCamera.startPreview();
285   - }
286   -
287   - private void sleep(int ms) {
288   -
289   - try {
290   - java.lang.Thread.sleep(ms);
291   - } catch (Exception e) {
292   - e.printStackTrace();
293   - }
294   - }
295   -
296   - /**
297   - * 初始化声音
298   - */
299   - private void initBeepSound() {
300   - if (playBeep && mediaPlayer == null) {
301   - setVolumeControlStream(AudioManager.STREAM_MUSIC);
302   - mediaPlayer = new MediaPlayer();
303   - mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
304   - mediaPlayer.setOnCompletionListener(beepListener);
305   - AssetFileDescriptor file = getResources().openRawResourceFd(
306   - R.raw.beep);
307   - try {
308   - mediaPlayer.setDataSource(file.getFileDescriptor(),
309   - file.getStartOffset(), file.getLength());
310   - file.close();
311   - mediaPlayer.setVolume(BEEP_VOLUME, BEEP_VOLUME);
312   - mediaPlayer.prepare();
313   - } catch (IOException e) {
314   - mediaPlayer = null;
315   - }
316   - }
317   - }
318   -
319   - /**
320   - * 播放声音和震动
321   - */
322   - private void playBeepSoundAndVibrate() {
323   - if (playBeep && mediaPlayer != null) {
324   - mediaPlayer.start();
325   - }
326   - // 打开震动
327   - Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
328   - vibrator.vibrate(VIBRATE_DURATION);
329   - }
330   -
331   - private final OnCompletionListener beepListener = new OnCompletionListener() {
332   - @Override
333   - public void onCompletion(MediaPlayer mediaPlayer) {
334   - mediaPlayer.seekTo(0);
335   - }
336   - };
337   -
338   - @Override
339   - public boolean onKeyDown(int keyCode, KeyEvent event) {
340   - if (keyCode == KeyEvent.KEYCODE_BACK) {
341   - try {
342   - CommetryUtils.releaseCommery(this);
343   - } catch (Exception e) {
344   - e.printStackTrace();
345   - }
346   - finish();
347   - }
348   - return false;
349   -
350   - };
351   -
352   - @SuppressLint("HandlerLeak")
353   - private class MyHandler extends Handler {
354   - @Override
355   - public void handleMessage(Message msg) {
356   - if (Select == null) {
357   - try {
358   - Select = SharedPreferences2Obj
359   - .getInstance(ScanerOrderActivity.this)
360   - .setName("SelectAction")
361   - .getObject("Select", Integer.class);
362   - LogUtil.i(TAG, "====tempMode===" + Select + "");
363   - } catch (Exception e) {
364   - e.printStackTrace();
365   - }
366   - }
367   - switch (msg.what) {
368   - case 0:
369   - Intent intent = new Intent(ScanerOrderActivity.this,
370   - QRCodeOrderListActivity.class);
371   - intent.putExtra("mode", 1);
372   - intent.putExtra("input_orid", msg.obj.toString());
373   - intent.putExtra("titleName",getString(R.string.show_result));
374   - startActivity(intent);
375   - finish();
376   - break;
377   - }
378   - }
379   - }
380   -
381   - @Override
382   - protected void onActivityResult(int requestCode, int resultCode, Intent data) {
383   -
384   - if (data == null) {
385   - return;
386   - }
387   -
388   - if (requestCode == 2 && resultCode == 2) {
389   - // initConfig();
390   - // initView();
391   - }
392   -
393   - }
394   -
395   - @Override
396   - protected void onDestroy() {
397   - if (isConnected == false && wifi != null && wifi.isWifiEnabled()) {
398   - try {
399   - wifi.setWifiEnabled(false);
400   - } catch (Exception e) {
401   - e.printStackTrace();
402   - }
403   - }
404   - super.onDestroy();
405   - try {
406   - CommetryUtils.releaseCommery(this);
407   - } catch (Exception e) {
408   - e.printStackTrace();
409   - }
410   - }
  54 + public final String TAG = "ScanerOrderActivity";
  55 +
  56 + static {
  57 + try {
  58 + System.loadLibrary("iconv");
  59 + } catch (Exception e) {
  60 + e.printStackTrace();
  61 + } catch (Throwable e) {
  62 + e.printStackTrace();
  63 + }
  64 + }
  65 +
  66 + private String titleName;
  67 +
  68 + private final float BEEP_VOLUME = 0.10f;
  69 + private final long VIBRATE_DURATION = 200L;
  70 +
  71 + @SuppressWarnings("deprecation")
  72 + private Camera mCamera;
  73 + private CameraPreview mPreview;
  74 + @SuppressWarnings("deprecation")
  75 + Parameters mParameters;
  76 + MediaPlayer player;
  77 + private MediaPlayer mediaPlayer;
  78 + ImageScanner scanner;
  79 +
  80 + private boolean playBeep = true;
  81 +
  82 + private String scannerResult = "";
  83 +
  84 + private Integer Select; // 选择模式 检票 补票 查票
  85 +
  86 + private WifiManager wifi;
  87 + private boolean isConnected;
  88 +
  89 + private MyHandler handler;
  90 +
  91 + @Override
  92 + protected void onCreate(Bundle savedInstanceState) {
  93 + super.onCreate(savedInstanceState);
  94 + setContentView(R.layout.app_ord_scanner);
  95 + ActivitiesManager.getInstance().pushActivity(this);
  96 +
  97 + ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
  98 + NetworkInfo mWifi = connManager
  99 + .getNetworkInfo(ConnectivityManager.TYPE_WIFI);
  100 +
  101 + if (mWifi.isConnected()) {
  102 + isConnected = true;
  103 + } else {
  104 + wifi = (WifiManager) getApplicationContext().getSystemService(ScanerOrderActivity.WIFI_SERVICE);
  105 + if (wifi.isWifiEnabled()) {
  106 + } else {
  107 + wifi.setWifiEnabled(true);
  108 + }
  109 + }
  110 +
  111 + initConfig();
  112 + initView();
  113 + }
  114 +
  115 + private void initConfig() {
  116 + findViewById(R.id.topBack).setOnClickListener(new OnClickListener() {
  117 +
  118 + @Override
  119 + public void onClick(View arg0) {
  120 + finish();
  121 + }
  122 + });
  123 + }
  124 +
  125 + @SuppressWarnings("deprecation")
  126 + private void initView() {
  127 + try {
  128 + SharedPreferences2Obj.getInstance(ScanerOrderActivity.this)
  129 + .setName("SelectAction").setObject("isStatistic", "0"); // 非统计
  130 + } catch (Exception e1) {
  131 + e1.printStackTrace();
  132 + }
  133 + try {
  134 + titleName = getIntent().getStringExtra("titleName");
  135 + if (titleName != null) {
  136 + ((TextView) findViewById(R.id.title)).setText(titleName);
  137 + } else {
  138 + ((TextView) findViewById(R.id.title))
  139 + .setText(R.string.scan_qr_code);
  140 + }
  141 + ((TextView) findViewById(R.id.title)).setVisibility(View.VISIBLE);
  142 + FrameLayout preview = (FrameLayout) findViewById(R.id.cameraPreview);
  143 +
  144 + handler = new MyHandler();
  145 + mCamera = getCameraInstance();
  146 + mPreview = new CameraPreview(ScanerOrderActivity.this, mCamera,
  147 + previewCb);
  148 + preview.addView(mPreview);
  149 + mCamera.setPreviewCallbackWithBuffer(previewCb);
  150 + mCamera.startPreview();
  151 +
  152 + if (isConnected == false && wifi != null && wifi.isWifiEnabled()) {
  153 + wifi.setWifiEnabled(false);
  154 + }
  155 + } catch (Exception e1) {
  156 + e1.printStackTrace();
  157 + }
  158 +
  159 + new Thread(new Runnable() {
  160 +
  161 + @Override
  162 + public void run() {
  163 + try {
  164 + player = MediaPlayer.create(ScanerOrderActivity.this,
  165 + R.raw.bad);
  166 +
  167 + /* Instance barcode scanner */
  168 + scanner = new ImageScanner();
  169 + scanner.setConfig(0, Config.POSITION, 3);
  170 + scanner.setConfig(0, Config.POSITION, 3);
  171 +
  172 + // 初始化声音和震动
  173 + AudioManager audioService = (AudioManager) getSystemService(AUDIO_SERVICE);
  174 + // 如果手机是震动模式就震动
  175 + if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
  176 + playBeep = false;
  177 + }
  178 + // 初始化声音
  179 + initBeepSound();
  180 + } catch (Exception e) {
  181 + e.printStackTrace();
  182 + }
  183 + }
  184 + }).start();
  185 + }
  186 +
  187 + @SuppressWarnings("deprecation")
  188 + PreviewCallback previewCb = new PreviewCallback() {
  189 + @Override
  190 + public void onPreviewFrame(byte[] data, Camera camera) {
  191 + Camera.Parameters parameters = camera.getParameters();
  192 + Size size = parameters.getPreviewSize();
  193 +
  194 + Image barcode = new Image(size.width, size.height, "NV21");
  195 + barcode.setData(data);
  196 + barcode = barcode.convert("Y800");
  197 + int result = scanner.scanImage(barcode);
  198 + // Toast.makeText(CameraTestActivity.this, result+"",
  199 + // Toast.LENGTH_SHORT).show();
  200 + if (result != 0) {
  201 + mCamera.setPreviewCallback(null);
  202 + mCamera.stopPreview();
  203 +
  204 + SymbolSet syms = scanner.getResults();
  205 +
  206 + playBeepSoundAndVibrate();// 播放声音和振动代表成功获取二维码
  207 +
  208 + for (Symbol sym : syms) {
  209 +
  210 + try {
  211 +
  212 + scannerResult = sym.getData();
  213 + LogUtil.i(TAG, getString(R.string.scan_result)
  214 + + " = " + scannerResult);
  215 + if (scannerResult.startsWith("CYT_")) {
  216 + scannerResult = scannerResult.substring(
  217 + scannerResult.indexOf("_") + 1,
  218 + scannerResult.indexOf(","));
  219 + ArrayList<ConfigBean> beans = DbManager.GetConfigs();
  220 + // 畅游通生成的订单ID:
  221 + String ec_name = beans.get(0).getEc_signkey();
  222 + ec_name = AESEncryptor.decrypt(constant.decrypt,
  223 + ec_name);
  224 + scannerResult = DesUtil.decrypt(scannerResult, ec_name);
  225 + } else if (scannerResult.startsWith("TDOS_")) {
  226 + scannerResult = scannerResult.substring(
  227 + scannerResult.indexOf("_") + 1,
  228 + scannerResult.indexOf(","));
  229 + scannerResult = new String(Base64.decode(scannerResult), "utf-8");
  230 + } else if ((scannerResult.startsWith("TY_") || (scannerResult.startsWith("PMS_")))) {
  231 + scannerResult = scannerResult;
  232 + } else {
  233 + scannerResult = scannerResult;
  234 + }
  235 + Message msg = new Message();
  236 + msg.what = 0;
  237 + msg.obj = scannerResult;
  238 + handler.handleMessage(msg);
  239 + } catch (Exception e) {
  240 + // player.start();
  241 + try {
  242 + scannerResult = "";
  243 + e.printStackTrace();
  244 + MToast(ScanerOrderActivity.this,
  245 + getString(R.string.setting_is_correct),
  246 + MToast.LENGTH_LONG);
  247 + errorGoon();// 播放错误信息
  248 + } catch (Exception e1) {
  249 + e1.printStackTrace();
  250 + }
  251 + }
  252 + }
  253 +
  254 + }
  255 + }
  256 + };
  257 +
  258 + @Override
  259 + public void onPause() {
  260 + super.onPause();
  261 + releaseCamera();
  262 + }
  263 +
  264 + @SuppressWarnings("deprecation")
  265 + public static Camera getCameraInstance() {
  266 + Camera c = null;
  267 + try {
  268 + c = Camera.open();
  269 +
  270 + } catch (Exception e) {
  271 + }
  272 + return c;
  273 + }
  274 +
  275 + @SuppressWarnings("deprecation")
  276 + private void releaseCamera() {
  277 + try {
  278 + if (mCamera != null) {
  279 + mCamera.setPreviewCallback(null);
  280 + mCamera.stopPreview();
  281 + mCamera.release();
  282 +
  283 + mCamera = null;
  284 + }
  285 + } catch (Exception e) {
  286 + e.printStackTrace();
  287 + }
  288 + }
  289 +
  290 + @SuppressWarnings("deprecation")
  291 + public void errorGoon() {
  292 + player.start();
  293 + mCamera.setPreviewCallback(previewCb);
  294 + sleep(3000);
  295 + mCamera.startPreview();
  296 + }
  297 +
  298 + private void sleep(int ms) {
  299 +
  300 + try {
  301 + java.lang.Thread.sleep(ms);
  302 + } catch (Exception e) {
  303 + e.printStackTrace();
  304 + }
  305 + }
  306 +
  307 + /**
  308 + * 初始化声音
  309 + */
  310 + private void initBeepSound() {
  311 + if (playBeep && mediaPlayer == null) {
  312 + setVolumeControlStream(AudioManager.STREAM_MUSIC);
  313 + mediaPlayer = new MediaPlayer();
  314 + mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
  315 + mediaPlayer.setOnCompletionListener(beepListener);
  316 + AssetFileDescriptor file = getResources().openRawResourceFd(
  317 + R.raw.beep);
  318 + try {
  319 + mediaPlayer.setDataSource(file.getFileDescriptor(),
  320 + file.getStartOffset(), file.getLength());
  321 + file.close();
  322 + mediaPlayer.setVolume(BEEP_VOLUME, BEEP_VOLUME);
  323 + mediaPlayer.prepare();
  324 + } catch (IOException e) {
  325 + mediaPlayer = null;
  326 + }
  327 + }
  328 + }
  329 +
  330 + /**
  331 + * 播放声音和震动
  332 + */
  333 + private void playBeepSoundAndVibrate() {
  334 + if (playBeep && mediaPlayer != null) {
  335 + mediaPlayer.start();
  336 + }
  337 + // 打开震动
  338 + Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
  339 + vibrator.vibrate(VIBRATE_DURATION);
  340 + }
  341 +
  342 + private final OnCompletionListener beepListener = new OnCompletionListener() {
  343 + @Override
  344 + public void onCompletion(MediaPlayer mediaPlayer) {
  345 + mediaPlayer.seekTo(0);
  346 + }
  347 + };
  348 +
  349 + @Override
  350 + public boolean onKeyDown(int keyCode, KeyEvent event) {
  351 + if (keyCode == KeyEvent.KEYCODE_BACK) {
  352 + try {
  353 + CommetryUtils.releaseCommery(this);
  354 + } catch (Exception e) {
  355 + e.printStackTrace();
  356 + }
  357 + finish();
  358 + }
  359 + return false;
  360 +
  361 + }
  362 +
  363 + ;
  364 +
  365 + @SuppressLint("HandlerLeak")
  366 + private class MyHandler extends Handler {
  367 + @Override
  368 + public void handleMessage(Message msg) {
  369 + if (Select == null) {
  370 + try {
  371 + Select = SharedPreferences2Obj
  372 + .getInstance(ScanerOrderActivity.this)
  373 + .setName("SelectAction")
  374 + .getObject("Select", Integer.class);
  375 + LogUtil.i(TAG, "====tempMode===" + Select + "");
  376 + } catch (Exception e) {
  377 + e.printStackTrace();
  378 + }
  379 + }
  380 + switch (msg.what) {
  381 + case 0:
  382 + Intent intent = new Intent(ScanerOrderActivity.this,
  383 + QRCodeOrderListActivity.class);
  384 + intent.putExtra("mode", 1);
  385 + intent.putExtra("input_orid", msg.obj.toString());
  386 + intent.putExtra("titleName", getString(R.string.show_result));
  387 + startActivity(intent);
  388 + finish();
  389 + break;
  390 + }
  391 + }
  392 + }
  393 +
  394 + @Override
  395 + protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  396 +
  397 + if (data == null) {
  398 + return;
  399 + }
  400 +
  401 + if (requestCode == 2 && resultCode == 2) {
  402 + // initConfig();
  403 + // initView();
  404 + }
  405 +
  406 + }
  407 +
  408 + @Override
  409 + protected void onDestroy() {
  410 + if (isConnected == false && wifi != null && wifi.isWifiEnabled()) {
  411 + try {
  412 + wifi.setWifiEnabled(false);
  413 + } catch (Exception e) {
  414 + e.printStackTrace();
  415 + }
  416 + }
  417 + super.onDestroy();
  418 + try {
  419 + CommetryUtils.releaseCommery(this);
  420 + } catch (Exception e) {
  421 + e.printStackTrace();
  422 + }
  423 + }
411 424  
412 425 }
... ...
src/com/ectrip/trips/net/HttpHelper.java
... ... @@ -29,303 +29,339 @@ import com.ectrip.cyt.utils.SharedPreferences2Obj;
29 29 */
30 30 public class HttpHelper extends HttpHelperCore {
31 31  
32   - private Context mContext;
33   - public static HttpHelper helper = null;
  32 + private Context mContext;
  33 + public static HttpHelper helper = null;
34 34  
35   - private String devType = "MDEV"; // 移动终端:MDEV 售票窗口:WDEV
36   - private static Boolean testMOdel = null;
37   - private Integer type;
38   - private static BaseActivity activity;
39   - // public static final String action="/service/terminal-2.action";
40   - public final String action = "/service/terminal-3.do";
  35 + private String devType = "MDEV"; // 移动终端:MDEV 售票窗口:WDEV
  36 + private static Boolean testMOdel = null;
  37 + private Integer type;
  38 + private static BaseActivity activity;
  39 + // public static final String action="/service/terminal-2.action";
  40 + public final String action = "/service/terminal-3.do";
41 41  
42   - public static HttpHelper getInstance(Context mContext) {
43   - if (helper == null) {
44   - helper = new HttpHelper(mContext);
45   - }
46   - activity = (BaseActivity) mContext;
47   - return helper;
48   - }
49 42  
50   - private HttpHelper(Context mContext) {
51   - this.mContext = mContext;
52   - testMOdel = SharedPreferences2Obj.getInstance(mContext)
53   - .setName("config").getObject("testMOdel", Boolean.class);
54   - type = SharedPreferences2Obj.getInstance(mContext)
55   - .setName("MachineType").getObject("type", Integer.class);
56   - }
  43 + public static HttpHelper getInstance(Context mContext) {
  44 + if (helper == null) {
  45 + helper = new HttpHelper(mContext);
  46 + }
  47 + activity = (BaseActivity) mContext;
  48 + return helper;
  49 + }
57 50  
58   - /**
59   - * 获取终端获取订单信息
60   - *
61   - * @param method
62   - * 验证码: CODE 手机号码: PHONE 证件号码: ID 订单号码: ORDER
63   - * @param code
64   - */
65   - public void queryOrder(String method, String code, String phone,
66   - String credentials, String orderId, String startDate,
67   - String endDate, String pageSize, String count, HttpCallback<DataTrans> httpCallback) {
68   - QueryOrderRequest orderRequest = new QueryOrderRequest(method, code,
69   - phone, credentials, orderId, startDate, endDate, pageSize,count);
70   - orderRequest.setVer(MyApp.getInstance().getVer());
71   - orderRequest.setVerType(MyApp.getInstance().getVerType());
72   - orderRequest.setDevId(DevicTool.getInstance().getDevId());
73   - orderRequest.setDevType(devType);
74   - HashMap<String, String> map = new HashMap<String, String>();
75   - map.put("method", "queryOrder");
76   - String requestParam = DataTool.envelopeData(orderRequest, MyApp
77   - .getInstance().getSignkey(), MyApp.getInstance().getIdentity());
78   - map.put("requestParam", requestParam);
79   - LogUtil.i(requestParam + "requestParam");
80   - executeHttpPost(
81   - "http://" + MyApp.getInstance().getServiceIp() + action, "",
82   - map, httpCallback, "data", DataTrans.class);
  51 + private HttpHelper(Context mContext) {
  52 + this.mContext = mContext;
  53 + testMOdel = SharedPreferences2Obj.getInstance(mContext)
  54 + .setName("config").getObject("testMOdel", Boolean.class);
  55 + type = SharedPreferences2Obj.getInstance(mContext)
  56 + .setName("MachineType").getObject("type", Integer.class);
  57 + }
83 58  
84   - if (testMOdel != null && testMOdel) { // 这个是调试弹框
85   - if (type == null) {
86   - return;
87   - }
88   - if(activity==null){
89   - return;
90   - }
91   - activity.MToast(mContext, "服务地址:"
92   - + MyApp.getInstance().getServiceIp() + ";" + "机器码:"
93   - + DevicTool.getInstance().getDevId() + ";" + credentials + ";"
94   - + phone + ";", Toast.LENGTH_LONG);
95   - }
96   - }
  59 + /**
  60 + * 获取终端获取订单信息
  61 + *
  62 + * @param method 验证码: CODE 手机号码: PHONE 证件号码: ID 订单号码: ORDER
  63 + * @param code
  64 + */
  65 + QueryOrderRequest orderRequest;
  66 +
  67 + public void queryOrder(String method, String code, String phone,
  68 + String credentials, String orderId, String startDate,
  69 + String endDate, String pageSize, String count, HttpCallback<DataTrans> httpCallback) {
  70 + if ((orderId.startsWith("TY_") || (orderId.startsWith("PMS_")))) {
  71 + String voucher = orderId;
  72 + orderRequest = new QueryOrderRequest(method, code,
  73 + phone, credentials, "", startDate, endDate, pageSize, count, voucher);
  74 + } else {
  75 + orderRequest = new QueryOrderRequest(method, code,
  76 + phone, credentials, orderId, startDate, endDate, pageSize, count, "");
  77 + }
  78 + orderRequest.setVer(MyApp.getInstance().getVer());
  79 + orderRequest.setVerType(MyApp.getInstance().getVerType());
  80 + orderRequest.setDevId(DevicTool.getInstance().getDevId());
  81 + orderRequest.setDevType(devType);
  82 + HashMap<String, String> map = new HashMap<String, String>();
  83 + map.put("method", "queryOrder");
  84 + String requestParam = DataTool.envelopeData(orderRequest, MyApp
  85 + .getInstance().getSignkey(), MyApp.getInstance().getIdentity());
  86 + map.put("requestParam", requestParam);
  87 + LogUtil.i(requestParam + "requestParam");
  88 + executeHttpPost(
  89 + "http://" + MyApp.getInstance().getServiceIp() + action, "",
  90 + map, httpCallback, "data", DataTrans.class);
  91 + LogUtil.i("url = " + "http://" + MyApp.getInstance().getServiceIp() + action);
  92 + if (testMOdel != null && testMOdel) { // 这个是调试弹框
  93 + if (type == null) {
  94 + return;
  95 + }
  96 + if (activity == null) {
  97 + return;
  98 + }
  99 + activity.MToast(mContext, "服务地址:"
  100 + + MyApp.getInstance().getServiceIp() + ";" + "机器码:"
  101 + + DevicTool.getInstance().getDevId() + ";" + credentials + ";"
  102 + + phone + ";", Toast.LENGTH_LONG);
  103 + }
  104 + }
  105 +
  106 + /**
  107 + * @param orderId 订单 ID
  108 + * @param count 消费数量
  109 + * @param password 订单密码
  110 + * @param verifyPassword 是否验证密码 是: TRUE 否: FALSE
  111 + * @param httpCallback 回调
  112 + */
  113 + public void consumeOrder(String orderId, String count, String password,
  114 + String verifyPassword, String consumedSeq, List<ProductOfConsumeOrder> products, HttpCallback<DataTrans> httpCallback) {
  115 + Long accountId = MyApp.getInstance().getAccountId();
  116 + ConsumeOrderRequest consumeCount = new ConsumeOrderRequest(orderId,
  117 + count, password, verifyPassword, consumedSeq, products);
  118 + consumeCount.setVer(MyApp.getInstance().getVer());
  119 + consumeCount.setVerType(MyApp.getInstance().getVerType());
  120 + consumeCount.setDevId(DevicTool.getInstance().getDevId());
  121 + consumeCount.setAccountId(accountId);
  122 + consumeCount.setDevType(devType);
  123 +
  124 + HashMap<String, String> map = new HashMap<String, String>();
  125 + map.put("method", "consumeOrder");
  126 + String requestParam = DataTool.envelopeData(consumeCount, MyApp
  127 + .getInstance().getSignkey(), MyApp.getInstance().getIdentity());
  128 + map.put("requestParam", requestParam);
  129 + LogUtil.i("requestParam" + requestParam);
  130 + executeHttpPost(
  131 + "http://" + MyApp.getInstance().getServiceIp() + action, "",
  132 + map, httpCallback, "data", DataTrans.class);
97 133  
98   - /**
99   - * @param orderId
100   - * 订单 ID
101   - * @param count
102   - * 消费数量
103   - * @param password
104   - * 订单密码
105   - * @param verifyPassword
106   - * 是否验证密码 是: TRUE 否: FALSE
107   - * @param httpCallback
108   - * 回调
109   - */
110   - public void consumeOrder(String orderId, String count, String password,
111   - String verifyPassword, String consumedSeq, List<ProductOfConsumeOrder> products, HttpCallback<DataTrans> httpCallback) {
112   - Long accountId=MyApp.getInstance().getAccountId();
113   - ConsumeOrderRequest consumeCount = new ConsumeOrderRequest(orderId,
114   - count, password, verifyPassword,consumedSeq,products);
115   - consumeCount.setVer(MyApp.getInstance().getVer());
116   - consumeCount.setVerType(MyApp.getInstance().getVerType());
117   - consumeCount.setDevId(DevicTool.getInstance().getDevId());
118   - consumeCount.setAccountId(accountId);
119   - consumeCount.setDevType(devType);
120   - HashMap<String, String> map = new HashMap<String, String>();
121   - map.put("method", "consumeOrder");
122   - String requestParam = DataTool.envelopeData(consumeCount, MyApp
123   - .getInstance().getSignkey(), MyApp.getInstance().getIdentity());
124   - map.put("requestParam", requestParam);
125   - LogUtil.i("requestParam" + requestParam);
126   - executeHttpPost(
127   - "http://" + MyApp.getInstance().getServiceIp() + action, "",
128   - map, httpCallback, "data", DataTrans.class);
  134 + if (testMOdel != null && testMOdel) { // 这个是调试弹框
  135 + if (type == null) {
  136 + return;
  137 + }
  138 + if (activity == null) {
  139 + return;
  140 + }
  141 + activity.MToast(mContext, "服务地址:"
  142 + + MyApp.getInstance().getServiceIp() + ";" + "机器码:"
  143 + + DevicTool.getInstance().getDevId() + ";" + "订单号:" + orderId
  144 + + ";", Toast.LENGTH_LONG);
  145 + }
  146 + }
129 147  
130   - if (testMOdel != null && testMOdel) { // 这个是调试弹框
131   - if (type == null) {
132   - return;
133   - }
134   - if(activity==null){
135   - return;
136   - }
137   - activity.MToast(mContext, "服务地址:"
138   - + MyApp.getInstance().getServiceIp() + ";" + "机器码:"
139   - + DevicTool.getInstance().getDevId() + ";" + "订单号:" + orderId
140   - + ";", Toast.LENGTH_LONG);
141   - }
142   - }
  148 + public void consumeOrderPart(String orderId, String count, String password,
  149 + String verifyPassword, String consumedSeq, List<ProductOfConsumeOrder> products, String id, boolean isId, HttpCallback<DataTrans> httpCallback) {
  150 + Long accountId = MyApp.getInstance().getAccountId();
  151 + ConsumeOrderRequest consumeCount = new ConsumeOrderRequest(orderId,
  152 + count, password, verifyPassword, consumedSeq, products);
  153 + consumeCount.setVer(MyApp.getInstance().getVer());
  154 + consumeCount.setVerType(MyApp.getInstance().getVerType());
  155 + consumeCount.setDevId(DevicTool.getInstance().getDevId());
  156 + consumeCount.setAccountId(accountId);
  157 + consumeCount.setDevType(devType);
  158 + if (isId) {
  159 + consumeCount.setCredentials(id);
  160 + } else {
  161 + consumeCount.setVoucher(id);
  162 + }
143 163  
144   - /**
145   - * @param startdate
146   - * @param enddate
147   - * @param month
148   - * @param httpCallback
149   - * @param method
150   - * DAY MON 统计订单
151   - */
152   - public void statisticsOrder(String method, String startdate,
153   - String enddate, String month, HttpCallback<DataTrans> httpCallback) {
154   - StatisticOrderRequest consumeCount = new StatisticOrderRequest(method,
155   - startdate, enddate, month);
156   - consumeCount.setVer(MyApp.getInstance().getVer());
157   - consumeCount.setVerType(MyApp.getInstance().getVerType());
158   - consumeCount.setDevId(DevicTool.getInstance().getDevId());
159   - consumeCount.setDevType(devType);
160   - HashMap<String, String> map = new HashMap<String, String>();
161   - map.put("method", "consumeSummary");
162   - String requestParam = DataTool.envelopeData(consumeCount, MyApp
163   - .getInstance().getSignkey(), MyApp.getInstance().getIdentity());
164   - map.put("requestParam", requestParam);
165   - LogUtil.i("requestParam" + requestParam);
166   - executeHttpPost(
167   - "http://" + MyApp.getInstance().getServiceIp() + action, "",
168   - map, httpCallback, "data", DataTrans.class);
169   - if (testMOdel != null && testMOdel) { // 这个是调试弹框
170   - if (type == null) {
171   - return;
172   - }
173   - if(activity==null){
174   - return;
175   - }
176   - activity.MToast(mContext, "服务地址:"
177   - + MyApp.getInstance().getServiceIp() + ";" + "机器码:"
178   - + DevicTool.getInstance().getDevId() + ";" + "开始时间:"
179   - + startdate + ";" + "结束:" + enddate + ";" + "月份:" + month,
180   - Toast.LENGTH_LONG);
181   - }
182   - }
  164 + HashMap<String, String> map = new HashMap<String, String>();
  165 + map.put("method", "consumeOrder");
  166 + String requestParam = DataTool.envelopeData(consumeCount, MyApp
  167 + .getInstance().getSignkey(), MyApp.getInstance().getIdentity());
  168 + map.put("requestParam", requestParam);
  169 + LogUtil.i("requestParam" + requestParam);
  170 + executeHttpPost(
  171 + "http://" + MyApp.getInstance().getServiceIp() + action, "",
  172 + map, httpCallback, "data", DataTrans.class);
183 173  
184   - /**
185   - * @param orderId
186   - * 订单号
187   - * @param httpCallback
188   - * 不打小票列表
189   - */
190   - public void queryConsumedDetail(String orderId,
191   - HttpCallback<DataTrans> httpCallback) {
192   - QueryConsumedDetailRequest reprintVoucherRequest = new QueryConsumedDetailRequest();
193   - reprintVoucherRequest.setOrderId(orderId);
194   - reprintVoucherRequest.setVer(MyApp.getInstance().getVer());
195   - reprintVoucherRequest.setVerType(MyApp.getInstance().getVerType());
196   - reprintVoucherRequest.setDevId(DevicTool.getInstance().getDevId());
197   - reprintVoucherRequest.setDevType(devType);
198   - HashMap<String, String> map = new HashMap<String, String>();
199   - map.put("method", "consumeHistoryQuery");
200   - String requestParam = DataTool.envelopeData(reprintVoucherRequest,
201   - MyApp.getInstance().getSignkey(), MyApp.getInstance()
202   - .getIdentity());
203   - map.put("requestParam", requestParam);
204   - LogUtil.i("requestParam" + requestParam);
205   - executeHttpPost(
206   - "http://" + MyApp.getInstance().getServiceIp() + action, "",
207   - map, httpCallback, "data", DataTrans.class);
208   - if (testMOdel != null && testMOdel) { // 这个是调试弹框
209   - if (type == null) {
210   - return;
211   - }
212   - if(activity==null){
213   - return;
214   - }
215   - activity.MToast(mContext, "服务地址:"
216   - + MyApp.getInstance().getServiceIp() + ";" + "机器码:"
217   - + DevicTool.getInstance().getDevId() + ";" + "补打订单:" + orderId,
218   - Toast.LENGTH_LONG);
219   - }
220   - }
  174 + if (testMOdel != null && testMOdel) { // 这个是调试弹框
  175 + if (type == null) {
  176 + return;
  177 + }
  178 + if (activity == null) {
  179 + return;
  180 + }
  181 + activity.MToast(mContext, "服务地址:"
  182 + + MyApp.getInstance().getServiceIp() + ";" + "机器码:"
  183 + + DevicTool.getInstance().getDevId() + ";" + "订单号:" + orderId
  184 + + ";", Toast.LENGTH_LONG);
  185 + }
  186 + }
221 187  
222   - /**
223   - * @param orderId
224   - * 订单号
225   - * @param httpCallback
226   - * 补打小票信息
227   - */
228   - public void reprintVoucher(String orderId, List<String> orderDetailIds,
229   - HttpCallback<DataTrans> httpCallback) {
230   - ReprintVoucherRequest reprintVoucherRequest = new ReprintVoucherRequest();
231   - reprintVoucherRequest.setOrderId(orderId);
232   - StringBuffer buffer = new StringBuffer();
233   - for (int i = 0;i<orderDetailIds.size();i++){
234   - if (i!=orderDetailIds.size()-1){
235   - buffer.append(orderDetailIds.get(i)+",");
236   - }else {
237   - buffer.append(orderDetailIds.get(i));
238   - }
239   - }
240   - reprintVoucherRequest.setOrderDetailIds(buffer.toString());
241   - reprintVoucherRequest.setVer(MyApp.getInstance().getVer());
242   - reprintVoucherRequest.setVerType(MyApp.getInstance().getVerType());
243   - reprintVoucherRequest.setDevId(DevicTool.getInstance().getDevId());
244   - reprintVoucherRequest.setDevType(devType);
245   - HashMap<String, String> map = new HashMap<String, String>();
246   - map.put("method", "reprintVoucher");
247   - String requestParam = DataTool.envelopeData(reprintVoucherRequest,
248   - MyApp.getInstance().getSignkey(), MyApp.getInstance()
249   - .getIdentity());
250   - map.put("requestParam", requestParam);
251   - LogUtil.i("requestParam" + requestParam);
252   - executeHttpPost(
253   - "http://" + MyApp.getInstance().getServiceIp() + action, "",
254   - map, httpCallback, "data", DataTrans.class);
255   - if (testMOdel != null && testMOdel) { // 这个是调试弹框
256   - if (type == null) {
257   - return;
258   - }
259   - if(activity==null){
260   - return;
261   - }
262   - activity.MToast(mContext, "服务地址:"
263   - + MyApp.getInstance().getServiceIp() + ";" + "机器码:"
264   - + DevicTool.getInstance().getDevId() + ";" + "补打订单:" + orderId,
265   - Toast.LENGTH_LONG);
266   - }
267   - }
  188 + /**
  189 + * @param startdate
  190 + * @param enddate
  191 + * @param month
  192 + * @param httpCallback
  193 + * @param method DAY MON 统计订单
  194 + */
  195 + public void statisticsOrder(String method, String startdate,
  196 + String enddate, String month, HttpCallback<DataTrans> httpCallback) {
  197 + StatisticOrderRequest consumeCount = new StatisticOrderRequest(method,
  198 + startdate, enddate, month);
  199 + consumeCount.setVer(MyApp.getInstance().getVer());
  200 + consumeCount.setVerType(MyApp.getInstance().getVerType());
  201 + consumeCount.setDevId(DevicTool.getInstance().getDevId());
  202 + consumeCount.setDevType(devType);
  203 + HashMap<String, String> map = new HashMap<String, String>();
  204 + map.put("method", "consumeSummary");
  205 + String requestParam = DataTool.envelopeData(consumeCount, MyApp
  206 + .getInstance().getSignkey(), MyApp.getInstance().getIdentity());
  207 + map.put("requestParam", requestParam);
  208 + LogUtil.i("requestParam" + requestParam);
  209 + executeHttpPost(
  210 + "http://" + MyApp.getInstance().getServiceIp() + action, "",
  211 + map, httpCallback, "data", DataTrans.class);
  212 + if (testMOdel != null && testMOdel) { // 这个是调试弹框
  213 + if (type == null) {
  214 + return;
  215 + }
  216 + if (activity == null) {
  217 + return;
  218 + }
  219 + activity.MToast(mContext, "服务地址:"
  220 + + MyApp.getInstance().getServiceIp() + ";" + "机器码:"
  221 + + DevicTool.getInstance().getDevId() + ";" + "开始时间:"
  222 + + startdate + ";" + "结束:" + enddate + ";" + "月份:" + month,
  223 + Toast.LENGTH_LONG);
  224 + }
  225 + }
268 226  
269   - /**
270   - * 在线升级
271   - *
272   - * @param curVersionName
273   - * @param signkey
274   - * 标识
275   - * @param identity
276   - * 编码
277   - * @param url
278   - * ip或者域名
279   - */
280   - public void versionUpdate(String curVersionName, String signkey,
281   - String identity, String url, HttpCallback<DataTrans> httpCallback) {
282   - DetectVersionRequest detectVersionRequest = new DetectVersionRequest();
283   - detectVersionRequest.setDevId(DevicTool.getInstance().getDevId());
284   - detectVersionRequest.setDevType("MDEV");
285   - detectVersionRequest.setVer(curVersionName);
286   - if (constant.logoMark == LogoType.CYT.getValue()||constant.logoMark == LogoType.EMC.getValue()) {
287   - detectVersionRequest.setVerType("CT");
288   - } else if (constant.logoMark == LogoType.QNE.getValue()) {
289   - detectVersionRequest.setVerType("QT");
290   - }
291   - HashMap<String, String> map = new HashMap<String, String>();
292   - map.put("method", "detectVersion");
293   - String requestParam = DataTool.envelopeData(detectVersionRequest,
294   - signkey, identity);
295   - map.put("requestParam", requestParam);
296   - LogUtil.i("requestParam" + requestParam);
297   - executeHttpPost("http://" + url + action, "", map, httpCallback,
298   - "data", DataTrans.class);
299   - }
  227 + /**
  228 + * @param orderId 订单号
  229 + * @param httpCallback 不打小票列表
  230 + */
  231 + public void queryConsumedDetail(String orderId,
  232 + HttpCallback<DataTrans> httpCallback) {
  233 + QueryConsumedDetailRequest reprintVoucherRequest = new QueryConsumedDetailRequest();
  234 + reprintVoucherRequest.setOrderId(orderId);
  235 + reprintVoucherRequest.setVer(MyApp.getInstance().getVer());
  236 + reprintVoucherRequest.setVerType(MyApp.getInstance().getVerType());
  237 + reprintVoucherRequest.setDevId(DevicTool.getInstance().getDevId());
  238 + reprintVoucherRequest.setDevType(devType);
  239 + HashMap<String, String> map = new HashMap<String, String>();
  240 + map.put("method", "consumeHistoryQuery");
  241 + String requestParam = DataTool.envelopeData(reprintVoucherRequest,
  242 + MyApp.getInstance().getSignkey(), MyApp.getInstance()
  243 + .getIdentity());
  244 + map.put("requestParam", requestParam);
  245 + LogUtil.i("requestParam" + requestParam);
  246 + executeHttpPost(
  247 + "http://" + MyApp.getInstance().getServiceIp() + action, "",
  248 + map, httpCallback, "data", DataTrans.class);
  249 + if (testMOdel != null && testMOdel) { // 这个是调试弹框
  250 + if (type == null) {
  251 + return;
  252 + }
  253 + if (activity == null) {
  254 + return;
  255 + }
  256 + activity.MToast(mContext, "服务地址:"
  257 + + MyApp.getInstance().getServiceIp() + ";" + "机器码:"
  258 + + DevicTool.getInstance().getDevId() + ";" + "补打订单:" + orderId,
  259 + Toast.LENGTH_LONG);
  260 + }
  261 + }
300 262  
  263 + /**
  264 + * @param orderId 订单号
  265 + * @param httpCallback 补打小票信息
  266 + */
  267 + public void reprintVoucher(String orderId, List<String> orderDetailIds,
  268 + HttpCallback<DataTrans> httpCallback) {
  269 + ReprintVoucherRequest reprintVoucherRequest = new ReprintVoucherRequest();
  270 + reprintVoucherRequest.setOrderId(orderId);
  271 + StringBuffer buffer = new StringBuffer();
  272 + for (int i = 0; i < orderDetailIds.size(); i++) {
  273 + if (i != orderDetailIds.size() - 1) {
  274 + buffer.append(orderDetailIds.get(i) + ",");
  275 + } else {
  276 + buffer.append(orderDetailIds.get(i));
  277 + }
  278 + }
  279 + reprintVoucherRequest.setOrderDetailIds(buffer.toString());
  280 + reprintVoucherRequest.setVer(MyApp.getInstance().getVer());
  281 + reprintVoucherRequest.setVerType(MyApp.getInstance().getVerType());
  282 + reprintVoucherRequest.setDevId(DevicTool.getInstance().getDevId());
  283 + reprintVoucherRequest.setDevType(devType);
  284 + HashMap<String, String> map = new HashMap<String, String>();
  285 + map.put("method", "reprintVoucher");
  286 + String requestParam = DataTool.envelopeData(reprintVoucherRequest,
  287 + MyApp.getInstance().getSignkey(), MyApp.getInstance()
  288 + .getIdentity());
  289 + map.put("requestParam", requestParam);
  290 + LogUtil.i("requestParam" + requestParam);
  291 + executeHttpPost(
  292 + "http://" + MyApp.getInstance().getServiceIp() + action, "",
  293 + map, httpCallback, "data", DataTrans.class);
  294 + if (testMOdel != null && testMOdel) { // 这个是调试弹框
  295 + if (type == null) {
  296 + return;
  297 + }
  298 + if (activity == null) {
  299 + return;
  300 + }
  301 + activity.MToast(mContext, "服务地址:"
  302 + + MyApp.getInstance().getServiceIp() + ";" + "机器码:"
  303 + + DevicTool.getInstance().getDevId() + ";" + "补打订单:" + orderId,
  304 + Toast.LENGTH_LONG);
  305 + }
  306 + }
301 307  
302   - /**
303   - * 操作员登录
304   - * @param username
305   - * @param password
306   - * @param httpCallback
  308 + /**
  309 + * 在线升级
  310 + *
  311 + * @param curVersionName
  312 + * @param signkey 标识
  313 + * @param identity 编码
  314 + * @param url ip或者域名
307 315 */
308   - public void login (String username, String password, HttpCallback<DataTrans> httpCallback) {
309   - LoginRequest loginRequest = new LoginRequest();
310   - loginRequest.setAccountName(username);
311   - loginRequest.setPassword(password);
312   - loginRequest.setVer(MyApp.getInstance().getVer());
313   - loginRequest.setVerType(MyApp.getInstance().getVerType());
314   - loginRequest.setDevId(DevicTool.getInstance().getDevId());
315   - loginRequest.setDevType(devType);
  316 + public void versionUpdate(String curVersionName, String signkey,
  317 + String identity, String url, HttpCallback<DataTrans> httpCallback) {
  318 + DetectVersionRequest detectVersionRequest = new DetectVersionRequest();
  319 + detectVersionRequest.setDevId(DevicTool.getInstance().getDevId());
  320 + detectVersionRequest.setDevType("MDEV");
  321 + detectVersionRequest.setVer(curVersionName);
  322 + if (constant.logoMark == LogoType.CYT.getValue() || constant.logoMark == LogoType.EMC.getValue()) {
  323 + detectVersionRequest.setVerType("CT");
  324 + } else if (constant.logoMark == LogoType.QNE.getValue()) {
  325 + detectVersionRequest.setVerType("QT");
  326 + }
  327 + HashMap<String, String> map = new HashMap<String, String>();
  328 + map.put("method", "detectVersion");
  329 + String requestParam = DataTool.envelopeData(detectVersionRequest,
  330 + signkey, identity);
  331 + map.put("requestParam", requestParam);
  332 + LogUtil.i("requestParam" + requestParam);
  333 + executeHttpPost("http://" + url + action, "", map, httpCallback,
  334 + "data", DataTrans.class);
  335 + }
316 336  
317   - HashMap<String, String> map = new HashMap<String, String>();
318   - map.put("method", "login");
319   - String requestParam = DataTool.envelopeData(loginRequest,
320   - MyApp.getInstance().getSignkey(), MyApp.getInstance()
321   - .getIdentity());
322   - map.put("requestParam", requestParam);
323   - LogUtil.i("requestParam" + requestParam);
324   - executeHttpPost(
325   - "http://" + MyApp.getInstance().getServiceIp() + action, "",
326   - map, httpCallback, "data", DataTrans.class);
327 337  
  338 + /**
  339 + * 操作员登录
  340 + *
  341 + * @param username
  342 + * @param password
  343 + * @param httpCallback
  344 + */
  345 + public void login(String username, String password, HttpCallback<DataTrans> httpCallback) {
  346 + LoginRequest loginRequest = new LoginRequest();
  347 + loginRequest.setAccountName(username);
  348 + loginRequest.setPassword(password);
  349 + loginRequest.setVer(MyApp.getInstance().getVer());
  350 + loginRequest.setVerType(MyApp.getInstance().getVerType());
  351 + loginRequest.setDevId(DevicTool.getInstance().getDevId());
  352 + loginRequest.setDevType(devType);
  353 +
  354 + HashMap<String, String> map = new HashMap<String, String>();
  355 + map.put("method", "login");
  356 + String requestParam = DataTool.envelopeData(loginRequest,
  357 + MyApp.getInstance().getSignkey(), MyApp.getInstance()
  358 + .getIdentity());
  359 + map.put("requestParam", requestParam);
  360 + LogUtil.i("requestParam" + requestParam);
  361 + executeHttpPost(
  362 + "http://" + MyApp.getInstance().getServiceIp() + action, "",
  363 + map, httpCallback, "data", DataTrans.class);
328 364  
329 365  
330   - }
  366 + }
331 367 }
... ...