Commit df6821929522261770e02ef15120c92b71225138
1 parent
7d3f774c
畅游通核销app: 1.优化扫CYT码不同类型数据的判断
Showing
4 changed files
with
55 additions
and
26 deletions
src/com/ectrip/cyt/ui/NewHandleScanerActivity.java
| ... | ... | @@ -50,7 +50,7 @@ public class NewHandleScanerActivity extends BaseActivity { |
| 50 | 50 | private Button scanerBtn; |
| 51 | 51 | private View topBack; |
| 52 | 52 | private TextView title; |
| 53 | - | |
| 53 | + private int typeScan; | |
| 54 | 54 | private AtomicBoolean isStop = new AtomicBoolean(false); |
| 55 | 55 | |
| 56 | 56 | @Override |
| ... | ... | @@ -160,22 +160,29 @@ public class NewHandleScanerActivity extends BaseActivity { |
| 160 | 160 | try { |
| 161 | 161 | if (result.startsWith("CYT_")) { |
| 162 | 162 | LogUtil.i("result = " + result); |
| 163 | -// result = result.substring(result.indexOf("_") + 1,result.indexOf(",")); | |
| 164 | - result = result.substring(result.indexOf("_") + 1, result.length()); | |
| 165 | - LogUtil.i("result1 = " + result); | |
| 163 | + typeScan = 0; | |
| 164 | + if (result.contains(",")) { | |
| 165 | + result = result.substring(result.indexOf("_") + 1, result.indexOf(",")); | |
| 166 | + LogUtil.i(TAG, "resultString = " + result); | |
| 167 | + } else { | |
| 168 | + result = result.substring(result.indexOf("_") + 1, result.length()); | |
| 169 | + LogUtil.i(TAG, "resultString1 = " + result); | |
| 170 | + } | |
| 166 | 171 | ArrayList<ConfigBean> beans = DbManager.GetConfigs(); |
| 167 | 172 | // 畅游通生成的订单ID: |
| 168 | 173 | String ec_name = beans.get(0).getEc_signkey(); |
| 169 | 174 | ec_name = AESEncryptor.decrypt(constant.decrypt, ec_name); |
| 170 | 175 | result = DesUtil.decrypt(result, ec_name); |
| 171 | 176 | } else if (result.startsWith("TDOS_")) { |
| 172 | - result = result.substring( | |
| 173 | - result.indexOf("_") + 1, | |
| 174 | - result.indexOf(",")); | |
| 177 | + typeScan = 0; | |
| 178 | +// result = result.substring(result.indexOf("_") + 1,result.indexOf(",")); | |
| 179 | + result = result.substring(result.indexOf("_") + 1, result.length()); | |
| 175 | 180 | result = new String(Base64.decode(result), "utf-8"); |
| 176 | 181 | } else if ((result.startsWith("TY_") || (result.startsWith("PMS_")))) { |
| 182 | + typeScan = 1; | |
| 177 | 183 | result = result; |
| 178 | 184 | } else { |
| 185 | + typeScan = 1; | |
| 179 | 186 | result = result; |
| 180 | 187 | } |
| 181 | 188 | } catch (Exception e) { |
| ... | ... | @@ -193,6 +200,7 @@ public class NewHandleScanerActivity extends BaseActivity { |
| 193 | 200 | MToast(NewHandleScanerActivity.this, result, Toast.LENGTH_SHORT); |
| 194 | 201 | } |
| 195 | 202 | intent.putExtra("titleName", getString(R.string.show_result)); |
| 203 | + intent.putExtra("typeScan", typeScan); | |
| 196 | 204 | startActivity(intent); |
| 197 | 205 | finish(); |
| 198 | 206 | } | ... | ... |
src/com/ectrip/cyt/ui/PhomeScanerOrderActivity.java
| 1 | 1 | package com.ectrip.cyt.ui; |
| 2 | + | |
| 2 | 3 | import java.io.IOException; |
| 3 | 4 | import java.util.ArrayList; |
| 4 | 5 | import java.util.Vector; |
| ... | ... | @@ -41,7 +42,7 @@ import com.google.zxing.Result; |
| 41 | 42 | * 手机版扫描二维码 |
| 42 | 43 | */ |
| 43 | 44 | public class PhomeScanerOrderActivity extends BaseActivity implements Callback { |
| 44 | - | |
| 45 | + public final String TAG = "PhomeScanerOrderActivity"; | |
| 45 | 46 | private CaptureActivityHandler handler; |
| 46 | 47 | private ViewfinderView viewfinderView; |
| 47 | 48 | private boolean hasSurface; |
| ... | ... | @@ -53,6 +54,7 @@ public class PhomeScanerOrderActivity extends BaseActivity implements Callback { |
| 53 | 54 | private final float BEEP_VOLUME = 0.10f; |
| 54 | 55 | private boolean vibrate; |
| 55 | 56 | private String titleName; |
| 57 | + private int typeScan; | |
| 56 | 58 | |
| 57 | 59 | /** |
| 58 | 60 | * Called when the activity is first created. |
| ... | ... | @@ -127,33 +129,40 @@ public class PhomeScanerOrderActivity extends BaseActivity implements Callback { |
| 127 | 129 | inactivityTimer.onActivity(); |
| 128 | 130 | playBeepSoundAndVibrate(); |
| 129 | 131 | String resultString = result.getText().trim(); |
| 130 | - LogUtil.i("扫码数据 = " + resultString); | |
| 132 | + LogUtil.i(TAG, "扫码数据 = " + resultString); | |
| 131 | 133 | if (resultString.equals("")) { |
| 132 | 134 | MToast(PhomeScanerOrderActivity.this, |
| 133 | 135 | getString(R.string.scan_fail), MToast.LENGTH_SHORT); |
| 134 | 136 | } else { |
| 135 | 137 | try { |
| 136 | 138 | if (resultString.startsWith("CYT_")) { |
| 137 | -// resultString = resultString.substring(resultString.indexOf("_") + 1,resultString.indexOf(",")); | |
| 138 | - resultString = resultString.substring(resultString.indexOf("_") + 1, resultString.length()); | |
| 139 | - LogUtil.i("resultString = " + resultString); | |
| 139 | + typeScan = 0; | |
| 140 | + if (resultString.contains(",")) { | |
| 141 | + resultString = resultString.substring(resultString.indexOf("_") + 1, resultString.indexOf(",")); | |
| 142 | + LogUtil.i(TAG, "resultString = " + resultString); | |
| 143 | + } else { | |
| 144 | + resultString = resultString.substring(resultString.indexOf("_") + 1, resultString.length()); | |
| 145 | + LogUtil.i(TAG, "resultString1 = " + resultString); | |
| 146 | + } | |
| 140 | 147 | ArrayList<ConfigBean> beans = DbManager.GetConfigs(); |
| 141 | 148 | // 畅游通生成的订单ID: |
| 142 | 149 | String ec_name = beans.get(0).getEc_signkey(); |
| 143 | - LogUtil.i("ec_name = " + ec_name); | |
| 150 | + LogUtil.i(TAG, "ec_name = " + ec_name); | |
| 144 | 151 | ec_name = AESEncryptor.decrypt(constant.decrypt, ec_name); |
| 145 | - LogUtil.i("ec_name1 = " + ec_name); | |
| 146 | - LogUtil.i("resultString1 = " + resultString); | |
| 152 | + LogUtil.i(TAG, "ec_name1 = " + ec_name); | |
| 147 | 153 | resultString = DesUtil.decrypt(resultString, ec_name); |
| 148 | 154 | |
| 149 | 155 | } else if (resultString.startsWith("TDOS_")) { |
| 150 | - resultString = resultString.substring( | |
| 151 | - resultString.indexOf("_") + 1, | |
| 152 | - resultString.indexOf(",")); | |
| 156 | + typeScan = 0; | |
| 157 | +// resultString = resultString.substring(resultString.indexOf("_") + 1, resultString.indexOf(",")); | |
| 158 | + resultString = resultString.substring(resultString.indexOf("_") + 1, resultString.length()); | |
| 159 | + LogUtil.i(TAG, "resultString = " + resultString); | |
| 153 | 160 | resultString = new String(Base64.decode(resultString), "utf-8"); |
| 154 | 161 | } else if ((resultString.startsWith("TY_") || (resultString.startsWith("PMS_")))) { |
| 162 | + typeScan = 1; | |
| 155 | 163 | resultString = resultString; |
| 156 | 164 | } else { |
| 165 | + typeScan = 1; | |
| 157 | 166 | resultString = resultString; |
| 158 | 167 | } |
| 159 | 168 | } catch (Exception e) { |
| ... | ... | @@ -166,6 +175,7 @@ public class PhomeScanerOrderActivity extends BaseActivity implements Callback { |
| 166 | 175 | intent.putExtra("input_orid", resultString); |
| 167 | 176 | LogUtil.i(getString(R.string.scan_result) + resultString); |
| 168 | 177 | intent.putExtra("titleName", getString(R.string.show_result)); |
| 178 | + intent.putExtra("typeScan", typeScan); | |
| 169 | 179 | startActivity(intent); |
| 170 | 180 | } |
| 171 | 181 | Boolean scanBack = SharedPreferences2Obj.getInstance(this).setName("config").getObject("scanBack", Boolean.class); | ... | ... |
src/com/ectrip/cyt/ui/QRCodeOrderListActivity.java
| ... | ... | @@ -52,7 +52,7 @@ public class QRCodeOrderListActivity extends BaseActivity implements ListOnclick |
| 52 | 52 | private View errorLayout; |
| 53 | 53 | private TextView errorInfo; |
| 54 | 54 | private Integer Select; |
| 55 | - | |
| 55 | + private int typeScan; | |
| 56 | 56 | @Override |
| 57 | 57 | protected void onCreate(Bundle savedInstanceState) { |
| 58 | 58 | super.onCreate(savedInstanceState); |
| ... | ... | @@ -98,6 +98,8 @@ public class QRCodeOrderListActivity extends BaseActivity implements ListOnclick |
| 98 | 98 | .setName("MachineType").getObject("type", Integer.class); |
| 99 | 99 | orid = getIntent().getStringExtra("input_orid"); |
| 100 | 100 | LogUtil.d(TAG, "orid = " + orid); |
| 101 | + typeScan = getIntent().getIntExtra("typeScan",0); | |
| 102 | + LogUtil.d(TAG, "typeScan = " + typeScan); | |
| 101 | 103 | HttpHelper.getInstance(QRCodeOrderListActivity.this).queryOrder( |
| 102 | 104 | "QRCODE", null, null, null, orid, null, null, "15", "1", |
| 103 | 105 | new MyHttpCallback()); |
| ... | ... | @@ -211,7 +213,7 @@ public class QRCodeOrderListActivity extends BaseActivity implements ListOnclick |
| 211 | 213 | if (orderInfos != null) { |
| 212 | 214 | adapter = new ReportExpandableListAdapter( |
| 213 | 215 | QRCodeOrderListActivity.this, |
| 214 | - QRCodeOrderListActivity.this, orderInfos, 1); | |
| 216 | + QRCodeOrderListActivity.this, orderInfos, typeScan); | |
| 215 | 217 | orderList.setAdapter(adapter); |
| 216 | 218 | |
| 217 | 219 | //取消分割线 | ... | ... |
src/com/ectrip/cyt/ui/ScanerOrderActivity.java
| ... | ... | @@ -85,7 +85,7 @@ public class ScanerOrderActivity extends BaseActivity { |
| 85 | 85 | |
| 86 | 86 | private WifiManager wifi; |
| 87 | 87 | private boolean isConnected; |
| 88 | - | |
| 88 | + private int typeScan; | |
| 89 | 89 | private MyHandler handler; |
| 90 | 90 | |
| 91 | 91 | @Override |
| ... | ... | @@ -213,8 +213,14 @@ public class ScanerOrderActivity extends BaseActivity { |
| 213 | 213 | LogUtil.i(TAG, getString(R.string.scan_result) |
| 214 | 214 | + " = " + scannerResult); |
| 215 | 215 | if (scannerResult.startsWith("CYT_")) { |
| 216 | -// scannerResult = scannerResult.substring(scannerResult.indexOf("_") + 1,scannerResult.indexOf(",")); | |
| 217 | - scannerResult = scannerResult.substring(scannerResult.indexOf("_") + 1, scannerResult.length()); | |
| 216 | + typeScan = 0; | |
| 217 | + if (scannerResult.contains(",")) { | |
| 218 | + scannerResult = scannerResult.substring(scannerResult.indexOf("_") + 1, scannerResult.indexOf(",")); | |
| 219 | + LogUtil.i(TAG, "resultString = " + scannerResult); | |
| 220 | + } else { | |
| 221 | + scannerResult = scannerResult.substring(scannerResult.indexOf("_") + 1, scannerResult.length()); | |
| 222 | + LogUtil.i(TAG, "resultString1 = " + scannerResult); | |
| 223 | + } | |
| 218 | 224 | ArrayList<ConfigBean> beans = DbManager.GetConfigs(); |
| 219 | 225 | // 畅游通生成的订单ID: |
| 220 | 226 | String ec_name = beans.get(0).getEc_signkey(); |
| ... | ... | @@ -222,13 +228,15 @@ public class ScanerOrderActivity extends BaseActivity { |
| 222 | 228 | ec_name); |
| 223 | 229 | scannerResult = DesUtil.decrypt(scannerResult, ec_name); |
| 224 | 230 | } else if (scannerResult.startsWith("TDOS_")) { |
| 225 | - scannerResult = scannerResult.substring( | |
| 226 | - scannerResult.indexOf("_") + 1, | |
| 227 | - scannerResult.indexOf(",")); | |
| 231 | + typeScan = 0; | |
| 232 | +// scannerResult = scannerResult.substring(scannerResult.indexOf("_") + 1,scannerResult.indexOf(",")); | |
| 233 | + scannerResult = scannerResult.substring(scannerResult.indexOf("_") + 1, scannerResult.length()); | |
| 228 | 234 | scannerResult = new String(Base64.decode(scannerResult), "utf-8"); |
| 229 | 235 | } else if ((scannerResult.startsWith("TY_") || (scannerResult.startsWith("PMS_")))) { |
| 236 | + typeScan = 1; | |
| 230 | 237 | scannerResult = scannerResult; |
| 231 | 238 | } else { |
| 239 | + typeScan = 1; | |
| 232 | 240 | scannerResult = scannerResult; |
| 233 | 241 | } |
| 234 | 242 | Message msg = new Message(); |
| ... | ... | @@ -383,6 +391,7 @@ public class ScanerOrderActivity extends BaseActivity { |
| 383 | 391 | intent.putExtra("mode", 1); |
| 384 | 392 | intent.putExtra("input_orid", msg.obj.toString()); |
| 385 | 393 | intent.putExtra("titleName", getString(R.string.show_result)); |
| 394 | + intent.putExtra("typeScan", typeScan); | |
| 386 | 395 | startActivity(intent); |
| 387 | 396 | finish(); |
| 388 | 397 | break; | ... | ... |