Commit 11a1872a912e169958382126f032411ac102d1c7
1 parent
3e2f9301
畅游通标准:新增动态二维码检票
Showing
9 changed files
with
109 additions
and
6 deletions
AndroidManifest.xml
| ... | ... | @@ -2,8 +2,8 @@ |
| 2 | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | 3 | xmlns:tool="http://schemas.android.com/tools" |
| 4 | 4 | package="com.ectrip.trips.check" |
| 5 | - android:versionCode="27" | |
| 6 | - android:versionName="4.24" | |
| 5 | + android:versionCode="28" | |
| 6 | + android:versionName="4.25" | |
| 7 | 7 | tool:ignore="LockedOrientationActivity"> |
| 8 | 8 | |
| 9 | 9 | <!-- 各个类型的大小布局声明 --> | ... | ... |
build.gradle
| ... | ... | @@ -30,7 +30,7 @@ dependencies { |
| 30 | 30 | implementation files('libs/fastjson-1.2.3.jar') |
| 31 | 31 | implementation files('libs/sunjce_provider.jar') |
| 32 | 32 | implementation files('libs/zbar.jar') |
| 33 | - implementation files('libs/zxing.jar') | |
| 33 | +// implementation files('libs/zxing.jar') | |
| 34 | 34 | implementation files('libs/gson-2.6.2.jar') |
| 35 | 35 | implementation files('libs\\rskapi.jar') |
| 36 | 36 | implementation files('libs\\zkandroidcore.jar') |
| ... | ... | @@ -42,6 +42,8 @@ dependencies { |
| 42 | 42 | implementation files('libs\\zypos1.8.jar') |
| 43 | 43 | implementation files('libs\\jsch-0.1.54.jar') |
| 44 | 44 | implementation 'org.jetbrains:annotations-java5:15.0' |
| 45 | + implementation files('libs\\cyt-common-dynamic-code-3.6.4.jar') | |
| 46 | + implementation files('libs\\zxingcore-2.3.0.jar') | |
| 45 | 47 | compileOnly files('external_libs/classes_2.1.11_20160907.jar') |
| 46 | 48 | compileOnly files('external_libs/bw_odm_20160526.jar') |
| 47 | 49 | implementation files('libs/bw_pos_sdk2.0.18.jar') |
| ... | ... | @@ -83,6 +85,11 @@ android { |
| 83 | 85 | } |
| 84 | 86 | } |
| 85 | 87 | |
| 88 | + compileOptions { | |
| 89 | + sourceCompatibility JavaVersion.VERSION_1_8 | |
| 90 | + targetCompatibility JavaVersion.VERSION_1_8 | |
| 91 | + } | |
| 92 | + | |
| 86 | 93 | //在apk文件后边生成版本号信息 |
| 87 | 94 | android.applicationVariants.all { |
| 88 | 95 | variant -> |
| ... | ... | @@ -119,7 +126,7 @@ android { |
| 119 | 126 | defaultConfig { |
| 120 | 127 | minSdkVersion 14 |
| 121 | 128 | targetSdkVersion 21 |
| 122 | - vectorDrawables.useSupportLibrary =true | |
| 129 | + vectorDrawables.useSupportLibrary = true | |
| 123 | 130 | |
| 124 | 131 | ndk { |
| 125 | 132 | abiFilters "armeabi", "armeabi-v7a"//可以适当补填其他 |
| ... | ... | @@ -144,6 +151,7 @@ android { |
| 144 | 151 | // } |
| 145 | 152 | |
| 146 | 153 | } |
| 154 | + | |
| 147 | 155 | def releaseTime() { |
| 148 | 156 | return new SimpleDateFormat("yyyyMMddHHmm").format(new Date()) |
| 149 | 157 | } | ... | ... |
libs/cyt-common-dynamic-code-3.6.4.jar
0 → 100644
No preview for this file type
libs/zxingcore-2.3.0.jar
0 → 100644
No preview for this file type
src/com/ectrip/cyt/ui/NewHandleScanerActivity.java
| ... | ... | @@ -8,6 +8,7 @@ import java.io.OutputStream; |
| 8 | 8 | import java.io.UnsupportedEncodingException; |
| 9 | 9 | import java.security.InvalidParameterException; |
| 10 | 10 | import java.util.ArrayList; |
| 11 | +import java.util.Date; | |
| 11 | 12 | import java.util.concurrent.atomic.AtomicBoolean; |
| 12 | 13 | |
| 13 | 14 | import android.app.AlertDialog; |
| ... | ... | @@ -23,6 +24,9 @@ import android.widget.Toast; |
| 23 | 24 | |
| 24 | 25 | import android_serialport_api.SerialPortNewHandset; |
| 25 | 26 | |
| 27 | +import com.ectrip.common.dynamic.code.core.DynamicVerifyCodeTool; | |
| 28 | +import com.ectrip.common.dynamic.code.exception.DynamicVerifyCodeException; | |
| 29 | +import com.ectrip.common.dynamic.code.model.DynamicVerifyCodeDecodeResult; | |
| 26 | 30 | import com.ectrip.cyt.bean.ConfigBean; |
| 27 | 31 | import com.ectrip.cyt.config.DevicTool; |
| 28 | 32 | import com.ectrip.cyt.config.MyApp; |
| ... | ... | @@ -159,7 +163,7 @@ public class NewHandleScanerActivity extends BaseActivity { |
| 159 | 163 | } else { |
| 160 | 164 | try { |
| 161 | 165 | if (result.startsWith("CYT_")) { |
| 162 | - LogUtil.i(TAG,"result = " + result); | |
| 166 | + LogUtil.i(TAG, "result = " + result); | |
| 163 | 167 | typeScan = 0; |
| 164 | 168 | if (result.contains(",")) { |
| 165 | 169 | result = result.substring(result.indexOf("_") + 1, result.indexOf(",")); |
| ... | ... | @@ -186,6 +190,31 @@ public class NewHandleScanerActivity extends BaseActivity { |
| 186 | 190 | } else if ((result.startsWith("TY_") || (result.startsWith("PMS_")))) { |
| 187 | 191 | typeScan = 1; |
| 188 | 192 | result = result; |
| 193 | + } else if (result.startsWith("OCP_")) { | |
| 194 | + typeScan = 0; | |
| 195 | + result = result; | |
| 196 | + } else if (result.startsWith("DYV_")) { | |
| 197 | + try { | |
| 198 | + DynamicVerifyCodeDecodeResult decodeResult = DynamicVerifyCodeTool.decodeDynamicCode(result); | |
| 199 | + boolean expired = decodeResult.getExpired(); | |
| 200 | + String staticCode = decodeResult.getStaticCode(); | |
| 201 | + Date expireTime = decodeResult.getExpireTime(); | |
| 202 | + LogUtil.d(TAG, "expired = " + expired); | |
| 203 | + LogUtil.d(TAG, "staticCode = " + staticCode); | |
| 204 | + LogUtil.d(TAG, "expireTime = " + expireTime); | |
| 205 | + if (!expired) { | |
| 206 | + typeScan = 1; | |
| 207 | + result = staticCode; | |
| 208 | + } else { | |
| 209 | + typeScan = 2; | |
| 210 | + result = "动态二维码已过有效期"; | |
| 211 | + } | |
| 212 | + } catch (DynamicVerifyCodeException e) { | |
| 213 | + typeScan = 2; | |
| 214 | + LogUtil.d(TAG, "动态核销码异常:" + e.getMessage()); | |
| 215 | + result = e.getMessage(); | |
| 216 | + e.printStackTrace(); | |
| 217 | + } | |
| 189 | 218 | } else { |
| 190 | 219 | typeScan = 1; |
| 191 | 220 | result = result; | ... | ... |
src/com/ectrip/cyt/ui/PhomeScanerOrderActivity.java
| ... | ... | @@ -2,6 +2,7 @@ package com.ectrip.cyt.ui; |
| 2 | 2 | |
| 3 | 3 | import java.io.IOException; |
| 4 | 4 | import java.util.ArrayList; |
| 5 | +import java.util.Date; | |
| 5 | 6 | import java.util.Vector; |
| 6 | 7 | |
| 7 | 8 | import android.content.Intent; |
| ... | ... | @@ -22,6 +23,9 @@ import android.view.WindowManager; |
| 22 | 23 | import android.widget.TextView; |
| 23 | 24 | import android.widget.Toast; |
| 24 | 25 | |
| 26 | +import com.ectrip.common.dynamic.code.core.DynamicVerifyCodeTool; | |
| 27 | +import com.ectrip.common.dynamic.code.exception.DynamicVerifyCodeException; | |
| 28 | +import com.ectrip.common.dynamic.code.model.DynamicVerifyCodeDecodeResult; | |
| 25 | 29 | import com.ectrip.cyt.bean.ConfigBean; |
| 26 | 30 | import com.ectrip.cyt.config.DevicTool; |
| 27 | 31 | import com.ectrip.cyt.constant.constant; |
| ... | ... | @@ -174,6 +178,29 @@ public class PhomeScanerOrderActivity extends BaseActivity implements Callback { |
| 174 | 178 | } else if (resultString.startsWith("OCP_")) { |
| 175 | 179 | typeScan = 0; |
| 176 | 180 | resultString = resultString; |
| 181 | + } else if (resultString.startsWith("DYV_")) { | |
| 182 | + try { | |
| 183 | + DynamicVerifyCodeDecodeResult decodeResult = DynamicVerifyCodeTool.decodeDynamicCode(resultString); | |
| 184 | + boolean expired = decodeResult.getExpired(); | |
| 185 | + String staticCode = decodeResult.getStaticCode(); | |
| 186 | + Date expireTime = decodeResult.getExpireTime(); | |
| 187 | + LogUtil.d(TAG, "expired = " + expired); | |
| 188 | + LogUtil.d(TAG, "staticCode = " + staticCode); | |
| 189 | + LogUtil.d(TAG, "expireTime = " + expireTime); | |
| 190 | + if (!expired) { | |
| 191 | + typeScan = 1; | |
| 192 | + resultString = staticCode; | |
| 193 | + } else { | |
| 194 | + typeScan = 2; | |
| 195 | + resultString = "动态二维码已过有效期"; | |
| 196 | + } | |
| 197 | + } catch (DynamicVerifyCodeException e) { | |
| 198 | + typeScan = 2; | |
| 199 | + LogUtil.d(TAG, "动态核销码异常:" + e.getMessage()); | |
| 200 | + resultString = e.getMessage(); | |
| 201 | + e.printStackTrace(); | |
| 202 | + } | |
| 203 | + | |
| 177 | 204 | } else { |
| 178 | 205 | typeScan = 1; |
| 179 | 206 | resultString = resultString; | ... | ... |
src/com/ectrip/cyt/ui/QRCodeOrderListActivity.java
| ... | ... | @@ -103,6 +103,12 @@ public class QRCodeOrderListActivity extends BaseActivity implements ListOnclick |
| 103 | 103 | LogUtil.d(TAG, "orid = " + orid); |
| 104 | 104 | typeScan = getIntent().getIntExtra("typeScan", 0); |
| 105 | 105 | LogUtil.d(TAG, "typeScan = " + typeScan); |
| 106 | + if (typeScan == 2) { | |
| 107 | + orderList.setEmptyView(errorLayout); | |
| 108 | + errorLayout.setVisibility(View.VISIBLE); | |
| 109 | + errorInfo.setText(orid); | |
| 110 | + return; | |
| 111 | + } | |
| 106 | 112 | if (orid.startsWith("OCP_")) { |
| 107 | 113 | ArrayList<ProductOfConsumeOrder> productOfConsumeOrders = new ArrayList<>(); |
| 108 | 114 | ProductOfConsumeOrder productOfConsumeOrder = new ProductOfConsumeOrder(); | ... | ... |
src/com/ectrip/cyt/ui/ScanerOrderActivity.java
| ... | ... | @@ -3,6 +3,7 @@ package com.ectrip.cyt.ui; |
| 3 | 3 | import android.annotation.SuppressLint; |
| 4 | 4 | import android.content.Intent; |
| 5 | 5 | import android.content.res.AssetFileDescriptor; |
| 6 | +import android.graphics.Color; | |
| 6 | 7 | import android.hardware.Camera; |
| 7 | 8 | import android.hardware.Camera.Parameters; |
| 8 | 9 | import android.hardware.Camera.PreviewCallback; |
| ... | ... | @@ -17,12 +18,18 @@ import android.os.Bundle; |
| 17 | 18 | import android.os.Handler; |
| 18 | 19 | import android.os.Message; |
| 19 | 20 | import android.os.Vibrator; |
| 21 | +import android.text.SpannableStringBuilder; | |
| 22 | +import android.text.TextUtils; | |
| 23 | +import android.text.style.ForegroundColorSpan; | |
| 20 | 24 | import android.view.KeyEvent; |
| 21 | 25 | import android.view.View; |
| 22 | 26 | import android.view.View.OnClickListener; |
| 23 | 27 | import android.widget.FrameLayout; |
| 24 | 28 | import android.widget.TextView; |
| 25 | 29 | |
| 30 | +import com.ectrip.common.dynamic.code.core.DynamicVerifyCodeTool; | |
| 31 | +import com.ectrip.common.dynamic.code.exception.DynamicVerifyCodeException; | |
| 32 | +import com.ectrip.common.dynamic.code.model.DynamicVerifyCodeDecodeResult; | |
| 26 | 33 | import com.ectrip.cyt.bean.ConfigBean; |
| 27 | 34 | import com.ectrip.cyt.constant.constant; |
| 28 | 35 | import com.ectrip.cyt.db.DbManager; |
| ... | ... | @@ -45,6 +52,7 @@ import net.sourceforge.zbar.SymbolSet; |
| 45 | 52 | |
| 46 | 53 | import java.io.IOException; |
| 47 | 54 | import java.util.ArrayList; |
| 55 | +import java.util.Date; | |
| 48 | 56 | |
| 49 | 57 | /** |
| 50 | 58 | * 二维码pos版扫描 |
| ... | ... | @@ -240,6 +248,31 @@ public class ScanerOrderActivity extends BaseActivity { |
| 240 | 248 | } else if ((scannerResult.startsWith("TY_") || (scannerResult.startsWith("PMS_")))) { |
| 241 | 249 | typeScan = 1; |
| 242 | 250 | scannerResult = scannerResult; |
| 251 | + } else if (scannerResult.startsWith("DYV_")) { | |
| 252 | + try { | |
| 253 | + DynamicVerifyCodeDecodeResult decodeResult = DynamicVerifyCodeTool.decodeDynamicCode(scannerResult); | |
| 254 | + boolean expired = decodeResult.getExpired(); | |
| 255 | + String staticCode = decodeResult.getStaticCode(); | |
| 256 | + Date expireTime = decodeResult.getExpireTime(); | |
| 257 | + LogUtil.d(TAG, "expired = " + expired); | |
| 258 | + LogUtil.d(TAG, "staticCode = " + staticCode); | |
| 259 | + LogUtil.d(TAG, "expireTime = " + expireTime); | |
| 260 | + if (!expired) { | |
| 261 | + typeScan = 1; | |
| 262 | + scannerResult = staticCode; | |
| 263 | + } else { | |
| 264 | + typeScan = 2; | |
| 265 | + scannerResult = "动态二维码已过有效期"; | |
| 266 | + } | |
| 267 | + } catch (DynamicVerifyCodeException e) { | |
| 268 | + String errorMsg = e.getMessage(); | |
| 269 | + LogUtil.d(TAG, "动态核销码异常:" + errorMsg); | |
| 270 | + typeScan = 2; | |
| 271 | + scannerResult = errorMsg; | |
| 272 | + e.printStackTrace(); | |
| 273 | + return; | |
| 274 | + } | |
| 275 | + | |
| 243 | 276 | } else { |
| 244 | 277 | typeScan = 1; |
| 245 | 278 | scannerResult = scannerResult; | ... | ... |
src/com/ectrip/cyt/zxing/decoding/DecodeFormatManager.java
| ... | ... | @@ -39,7 +39,7 @@ final class DecodeFormatManager { |
| 39 | 39 | PRODUCT_FORMATS.add(BarcodeFormat.UPC_E); |
| 40 | 40 | PRODUCT_FORMATS.add(BarcodeFormat.EAN_13); |
| 41 | 41 | PRODUCT_FORMATS.add(BarcodeFormat.EAN_8); |
| 42 | - PRODUCT_FORMATS.add(BarcodeFormat.RSS14); | |
| 42 | + PRODUCT_FORMATS.add(BarcodeFormat.RSS_14); | |
| 43 | 43 | ONE_D_FORMATS = new Vector<BarcodeFormat>(PRODUCT_FORMATS.size() + 4); |
| 44 | 44 | ONE_D_FORMATS.addAll(PRODUCT_FORMATS); |
| 45 | 45 | ONE_D_FORMATS.add(BarcodeFormat.CODE_39); | ... | ... |