Merge branch 'hotfix/1.0.9'
diff --git a/Makefile b/Makefile
index 83637bb..12ce435 100644
--- a/Makefile
+++ b/Makefile
@@ -2,20 +2,32 @@
APPPATH=./app/build/outputs/apk/release
BUILDAPK=app-release.apk
-SIGNAPK=app_sign.apk
+SIGNAPK=posa711dali.apk
+GRADLE=./gradlew
+ZIP=zip
+SALT_KEY=.sign_salt
+SIGN_FILE=hash256.sign
+
+OS=$(shell uname)
+
+ifneq (,$(findstring MINGW,$(OS)))
+GRADLE=gradlew.bat
+else
+GRADLE=./gradlew
+endif
+
+VERSION=$(shell git describe --abbrev=4 --dirty --always --tags)
apk:
@echo "build app apk!"
- gradlew app:assembleRelease
+ $(GRADLE) app:assembleRelease
@echo "build android sign apk"
- java -jar signapk.jar platform.x509.pem platform.pk8 $(APPPATH)/$(BUILDAPK) $(APPPATH)/$(SIGNAPK)
- @echo "build upgrade zip"
- python upgrade.py $(APPPATH)/$(SIGNAPK)
+ java -jar signapk.jar platform.x509.pem platform.pk8 $(APPPATH)/$(BUILDAPK) $(APPPATH)/$(SIGNAPK)
+ @echo "build upgrade app zip"
+ cat $(APPPATH)/$(SIGNAPK) $(SALT_KEY) | sha256sum - | cut -d' ' -f 1 | tr -d '\n' > $(APPPATH)/$(SIGN_FILE)
+ cd $(APPPATH) && $(ZIP) posa711-$(VERSION).zip $(SIGN_FILE) $(SIGNAPK)
+
clean:
@echo "remove build cache apk!"
- rm -rf $(APPPATH)/$(BUILDAPK)
- rm -rf $(APPPATH)/$(SIGNAPK)
- rm -rf $(APPPATH)/hash256.sign
- rm -rf $(APPPATH)/output.json
+ cd $(APPPATH) && rm -rf *.apk *.json *.sign
@echo "remove build cache file success"
-
diff --git a/app/src/main/java/com/supwisdom/service/EpayApiImpl.kt b/app/src/main/java/com/supwisdom/service/EpayApiImpl.kt
index 06e9154..190773a 100644
--- a/app/src/main/java/com/supwisdom/service/EpayApiImpl.kt
+++ b/app/src/main/java/com/supwisdom/service/EpayApiImpl.kt
@@ -1,275 +1,276 @@
-package com.supwisdom.service
-
-import com.supwisdom.activities.SPApplication
-import com.supwisdom.activities.YktSession
-import com.supwisdom.bean.HeartBeatRetBean
-import com.supwisdom.bean.SystemParaRetBean
-import com.supwisdom.bean.TransdtlRetBean
-import com.supwisdom.bean.WhiteListRetBean
-import com.supwisdom.entity.*
-import com.supwisdom.exception.HeartBeatError
-import com.supwisdom.exception.SysParaError
-import com.supwisdom.exception.TransdtlUploadError
-import com.supwisdom.exception.WhiteListError
-import com.supwisdom.okhttp.WebParams
-import com.supwisdom.utils.DateUtil
-import com.supwisdom.utils.GsonUtil
-import com.supwisdom.utils.PublicDef
-import org.apache.http.HttpStatus
-
-/**
- ** create by zzq on 2019/7/23
- ** @desc
- **/
-class EpayApiImpl : APIInterface {
- private val pos = SPApplication.getInstance().getPos()
-
- @Throws(HeartBeatError::class)
- override fun heartBeat() {
- val dyRecord = pos.getDynamicPara()
- val cardverno = dyRecord!!.cardverno ?: "0"
- val params = WebParams()
- params.setParameter("devphyid", pos.getConfigPara()!!.devphyid)
- .setParameter("termdate", DateUtil.getNowDateNoFormat())
- .setParameter("termtime", DateUtil.getNowTimeNoFormat())
- .setParameter("paragroupid", dyRecord.paragroupid)
- .setParameter("cardverno", cardverno)
-
- val resp = YktSession.getInstance().sendYktRequestPost("/api/pos/heartbeat", "", params)
- ?: throw HeartBeatError("请求超时")
- if (resp.retcode != HttpStatus.SC_OK) {
- if (resp.retcode == HttpStatus.SC_UNAUTHORIZED) {
- /**防止后台重启,终端需要及时更新JWT**/
- dyRecord.jwt = null
- pos.replaceDynamicPara(dyRecord)
- }
- throw HeartBeatError("错误码=${resp.retcode}")
- }
- val retBean = try {
- GsonUtil.GsonToBean(resp.retjson!!, HeartBeatRetBean::class.java)
- } catch (ex: Exception) {
- throw HeartBeatError("json异常:${ex.message}")
- }
- if (retBean.retcode != PublicDef.SUCCESS) {
- throw HeartBeatError(retBean.getErrorMsg())
- }
- if (dyRecord.paraverno != retBean.paraverno) {
- try {
- downloadSyspara(retBean.paragroupid, retBean.paraverno)
- } catch (ex: SysParaError) {
- throw HeartBeatError(ex.message ?: "null")
- }
- }
- if (dyRecord.whitelistid != retBean.whitelistid ||
- cardverno < retBean.cardverno!!
- ) {
- try {
- downloadWhitelist(retBean.whitelistid, retBean.cardverno!!)
- } catch (ex: WhiteListError) {
- throw HeartBeatError(ex.message ?: "null")
- }
- }
- /**
- * 时钟校准
- */
- NtpClient().startCalibrateTime(retBean.systime!!)
- }
-
- @Throws(HeartBeatError::class)
- override fun linkCheck() {
- heartBeat()
- }
-
- @Throws(SysParaError::class)
- override fun downloadSyspara(paragroupid: Int, paraverno: Int) {
- val params = WebParams()
- params.setParameter("devphyid", pos.getConfigPara()!!.devphyid)
- .setParameter("termdate", DateUtil.getNowDateNoFormat())
- .setParameter("termtime", DateUtil.getNowTimeNoFormat())
- .setParameter("paragroupid", paragroupid)
-
- val resp = YktSession.getInstance().sendYktRequestPost("/api/pos/systempara", "", params)
- ?: throw SysParaError("请求超时")
- if (resp.retcode != HttpStatus.SC_OK) {
- throw SysParaError("错误码=${resp.retcode}")
- }
- val retBean = try {
- GsonUtil.GsonToBean(resp.retjson!!, SystemParaRetBean::class.java)
- } catch (ex: Exception) {
- throw SysParaError("json异常:${ex.message}")
- }
- if (retBean.retcode != PublicDef.SUCCESS) {
- throw SysParaError(retBean.getErrorMsg())
- }
- val record = pos.getSysPara() ?: SysParaRecord()
- retBean.syspara?.forEach {
- when {
- it.paraname == "heat_beat" -> record.heatBeat = it.paraval!!.toInt()
- it.paraname == "return_flag" -> record.returnFlag = it.paraval!!.toInt()
- it.paraname == "consume_show_time" -> record.sucShowtime = it.paraval!!.toInt()
- it.paraname == "consume_fail_show_time" -> record.failShowtime = it.paraval!!.toInt()
- it.paraname == "fixpay_consume_gap" -> record.fixpayGap = it.paraval!!.toInt()
- it.paraname == "manage_passwd" -> record.mngPasswd = it.paraval
- it.paraname == "offline_flag" -> record.offlineEnable = it.paraval == "1"
- it.paraname == "max_offline_days" -> record.maxOfflineDays = it.paraval!!.toInt()
- it.paraname == "max_day_offline_amt" -> record.maxDayOfflineAmt = it.paraval!!.toInt()
- it.paraname == "communicate_time" -> record.commTime = it.paraval!!.toInt()
- }
- }
- if (record.heatBeat == 0) {
- record.heatBeat = 60
- }
- if (record.sucShowtime == 0) {
- record.sucShowtime = 2
- }
- if (record.failShowtime == 0) {
- record.failShowtime = 3
- }
- if (record.commTime == 0) {
- record.commTime = 3
- }
- if (record.maxOfflineDays == 0) {
- record.maxOfflineDays = 7
- }
- if (record.maxDayOfflineAmt == 0) {
- record.maxDayOfflineAmt = 10000
- }
- if (!pos.replaceSysPara(record)) {
- throw SysParaError("保存参数失败")
- }
- val dyRecord = pos.getDynamicPara()
- dyRecord!!.paraverno = paraverno
- dyRecord.paragroupid = paragroupid
- if (!pos.replaceDynamicPara(dyRecord)) {
- throw SysParaError("保存参数失败")
- }
- }
-
- @Throws(WhiteListError::class)
- override fun downloadWhitelist(whitelistid: Int, maxCardverno: String) {
- var dyRecord = pos.getDynamicPara()
- /**
- * 白名单组ID变化清空本地白名单重新下载
- */
- if (dyRecord!!.whitelistid != whitelistid) {
- if (!pos.clearWhiteList()) {
- throw WhiteListError("清空白名单失败")
- }
- dyRecord.cardverno = "0"
- dyRecord.whitelistid = whitelistid
- if (!pos.replaceDynamicPara(dyRecord)) {
- throw WhiteListError("保存参数失败")
- }
- }
- val maxcount = 20
- do {
- val params = WebParams()
- params.setParameter("devphyid", pos.getConfigPara()!!.devphyid)
- .setParameter("cardverno", pos.getDynamicPara()!!.cardverno)
- .setParameter("maxcount", maxcount)
-
- val resp = YktSession.getInstance().sendYktRequestPost("/api/pos/whitelist", "", params)
- ?: throw WhiteListError("请求超时")
- if (resp.retcode != HttpStatus.SC_OK) {
- throw WhiteListError("错误码=${resp.retcode}")
- }
- val retBean = try {
- GsonUtil.GsonToBean(resp.retjson!!, WhiteListRetBean::class.java)
- } catch (ex: Exception) {
- throw WhiteListError("json异常:${ex.message}")
- }
- if (retBean.retcode != PublicDef.SUCCESS) {
- throw WhiteListError(retBean.getErrorMsg())
- }
- if (retBean.count != retBean.whitelist?.size) {
- throw WhiteListError("白名单数量不对[${retBean.count},${retBean.whitelist?.size}]")
- }
- val list = ArrayList<WhiteListRecord>()
- retBean.whitelist?.forEach {
- val record = WhiteListRecord()
- record.cardphyid = it.cardphyid
- record.cardno = it.cardno
- record.status = it.status
- list.add(record)
- }
- if (!pos.saveWhiteList(list)) {
- throw WhiteListError("保存白名单失败")
- }
- dyRecord = pos.getDynamicPara()
- dyRecord!!.cardverno = retBean.cardverno
- if (!pos.replaceDynamicPara(dyRecord)) {
- throw WhiteListError("保存参数失败")
- }
- } while (retBean.count == maxcount)
- }
-
- @Throws(TransdtlUploadError::class)
- override fun uploadTransdtl(record: TransdtlOnlineRecord) {
- val params = WebParams()
- params.setParameter("devphyid", record.devphyid)
- .setParameter("transdate", record.transdate)
- .setParameter("transtime", record.transtime)
- .setParameter("termseqno", record.devseqno)
- .setParameter("reversalbillno", record.reversalbillno)
- .setParameter("reversalflag", record.reversalflag.toString())
- .setParameter("status", record.status.toString())
- val resp = YktSession.getInstance().sendYktRequestPost("/api/pos/paycancel", "", params)
- ?: throw TransdtlUploadError("请求超时")
- if (resp.retcode != HttpStatus.SC_OK) {
- throw TransdtlUploadError("错误码=${resp.retcode}")
- }
- val retBean = try {
- GsonUtil.GsonToBean(resp.retjson!!, TransdtlRetBean::class.java)
- } catch (ex: Exception) {
- throw TransdtlUploadError("json异常:${ex.message}")
- }
- if (retBean.retcode != PublicDef.SUCCESS) {
- throw TransdtlUploadError(retBean.getErrorMsg())
- }
- if (retBean.termseqno != record.devseqno) {
- throw TransdtlUploadError("返回流水号不一致")
- }
- }
-
- @Throws(TransdtlUploadError::class)
- override fun uploadTransdtl(record: TransdtlOfflineRecord) {
- val params = WebParams()
- var reversalflag = "false"
- if (record.reversalflag == ReversalFlag.AUTO ||
- record.reversalflag == ReversalFlag.MANUAL
- ) {
- reversalflag = "true"
- }
- params.setParameter("devphyid", record.devphyid)
- .setParameter("termseqno", record.devseqno)
- .setParameter("transdate", record.transdate)
- .setParameter("transtime", record.transtime)
- .setParameter("cardno", record.cardno)
- .setParameter("cardphyid", record.cardphyid)
- .setParameter("amount", record.payamt)
- .setParameter("extraamt", record.extraamt)
- .setParameter("managefeetype", record.managefeetype)
- .setParameter("reversalflag", reversalflag)
- .setParameter("reversaltermseqno", record.reversalseqno)
- .setParameter("reversaltransdate", record.reversaltransdate)
- .setParameter("reversaltransdate", record.reversaltranstime)
- .setParameter("status", record.status.toString())
-
- val resp = YktSession.getInstance().sendYktRequestPost("/api/pos/offlinetransdtl", "", params)
- ?: throw TransdtlUploadError("请求超时")
- if (resp.retcode != HttpStatus.SC_OK) {
- throw TransdtlUploadError("错误码=${resp.retcode}")
- }
- val retBean = try {
- GsonUtil.GsonToBean(resp.retjson!!, TransdtlRetBean::class.java)
- } catch (ex: Exception) {
- throw TransdtlUploadError("json异常:${ex.message}")
- }
- if (retBean.retcode != PublicDef.SUCCESS) {
- throw TransdtlUploadError(retBean.getErrorMsg())
- }
- if (retBean.termseqno != record.devseqno) {
- throw TransdtlUploadError("返回流水号不一致")
- }
- }
+package com.supwisdom.service
+
+import com.supwisdom.activities.SPApplication
+import com.supwisdom.activities.YktSession
+import com.supwisdom.bean.HeartBeatRetBean
+import com.supwisdom.bean.SystemParaRetBean
+import com.supwisdom.bean.TransdtlRetBean
+import com.supwisdom.bean.WhiteListRetBean
+import com.supwisdom.entity.*
+import com.supwisdom.exception.HeartBeatError
+import com.supwisdom.exception.SysParaError
+import com.supwisdom.exception.TransdtlUploadError
+import com.supwisdom.exception.WhiteListError
+import com.supwisdom.okhttp.WebParams
+import com.supwisdom.utils.DateUtil
+import com.supwisdom.utils.GsonUtil
+import com.supwisdom.utils.PublicDef
+import org.apache.http.HttpStatus
+
+/**
+ ** create by zzq on 2019/7/23
+ ** @desc
+ **/
+class EpayApiImpl : APIInterface {
+ private val pos = SPApplication.getInstance().getPos()
+
+ @Throws(HeartBeatError::class)
+ override fun heartBeat() {
+ val dyRecord = pos.getDynamicPara()
+ val cardverno = dyRecord!!.cardverno ?: "0"
+ val params = WebParams()
+ params.setParameter("devphyid", pos.getConfigPara()!!.devphyid)
+ .setParameter("termdate", DateUtil.getNowDateNoFormat())
+ .setParameter("termtime", DateUtil.getNowTimeNoFormat())
+ .setParameter("paragroupid", dyRecord.paragroupid)
+ .setParameter("cardverno", cardverno)
+
+ val resp = YktSession.getInstance().sendYktRequestPost("/api/pos/heartbeat", "", params)
+ ?: throw HeartBeatError("请求超时")
+ if (resp.retcode != HttpStatus.SC_OK) {
+ if (resp.retcode == HttpStatus.SC_UNAUTHORIZED) {
+ /**防止后台重启,终端需要及时更新JWT**/
+ dyRecord.jwt = null
+ pos.replaceDynamicPara(dyRecord)
+ }
+ throw HeartBeatError("错误码=${resp.retcode}")
+ }
+ val retBean = try {
+ GsonUtil.GsonToBean(resp.retjson!!, HeartBeatRetBean::class.java)
+ } catch (ex: Exception) {
+ throw HeartBeatError("json异常:${ex.message}")
+ }
+ if (retBean.retcode != PublicDef.SUCCESS) {
+ throw HeartBeatError(retBean.getErrorMsg())
+ }
+ if (dyRecord.paraverno != retBean.paraverno) {
+ try {
+ downloadSyspara(retBean.paragroupid, retBean.paraverno)
+ } catch (ex: SysParaError) {
+ throw HeartBeatError(ex.message ?: "null")
+ }
+ }
+ if (dyRecord.whitelistid != retBean.whitelistid ||
+ cardverno < retBean.cardverno!!
+ ) {
+ try {
+ downloadWhitelist(retBean.whitelistid, retBean.cardverno!!)
+ } catch (ex: WhiteListError) {
+ throw HeartBeatError(ex.message ?: "null")
+ }
+ }
+ /**
+ * 时钟校准
+ */
+ NtpClient().startCalibrateTime(retBean.systime!!)
+ }
+
+ @Throws(HeartBeatError::class)
+ override fun linkCheck() {
+ heartBeat()
+ }
+
+ @Throws(SysParaError::class)
+ override fun downloadSyspara(paragroupid: Int, paraverno: Int) {
+ val params = WebParams()
+ params.setParameter("devphyid", pos.getConfigPara()!!.devphyid)
+ .setParameter("termdate", DateUtil.getNowDateNoFormat())
+ .setParameter("termtime", DateUtil.getNowTimeNoFormat())
+ .setParameter("paragroupid", paragroupid)
+
+ val resp = YktSession.getInstance().sendYktRequestPost("/api/pos/systempara", "", params)
+ ?: throw SysParaError("请求超时")
+ if (resp.retcode != HttpStatus.SC_OK) {
+ throw SysParaError("错误码=${resp.retcode}")
+ }
+ val retBean = try {
+ GsonUtil.GsonToBean(resp.retjson!!, SystemParaRetBean::class.java)
+ } catch (ex: Exception) {
+ throw SysParaError("json异常:${ex.message}")
+ }
+ if (retBean.retcode != PublicDef.SUCCESS) {
+ throw SysParaError(retBean.getErrorMsg())
+ }
+ val record = pos.getSysPara() ?: SysParaRecord()
+ retBean.syspara?.forEach {
+ when (it.paraname) {
+ "heat_beat" -> record.heatBeat = it.paraval!!.toInt()
+ "return_flag" -> record.returnFlag = it.paraval!!.toInt()
+ "consume_show_time" -> record.sucShowtime = it.paraval!!.toInt()
+ "consume_fail_show_time" -> record.failShowtime = it.paraval!!.toInt()
+ "fixpay_consume_gap" -> record.fixpayGap = it.paraval!!.toInt()
+ "manage_passwd" -> record.mngPasswd = it.paraval
+ "offline_flag" -> record.offlineEnable = it.paraval == "1"
+ "max_offline_days" -> record.maxOfflineDays = it.paraval!!.toInt()
+ "max_day_offline_amt" -> record.maxDayOfflineAmt = it.paraval!!.toInt()
+ "communicate_time" -> record.commTime = it.paraval!!.toInt()
+ }
+ }
+ if (record.heatBeat == 0) {
+ record.heatBeat = 60
+ }
+ if (record.sucShowtime == 0) {
+ record.sucShowtime = 2
+ }
+ if (record.failShowtime == 0) {
+ record.failShowtime = 3
+ }
+ if (record.commTime == 0) {
+ record.commTime = 3
+ }
+ if (record.maxOfflineDays == 0) {
+ record.maxOfflineDays = 7
+ }
+ if (record.maxDayOfflineAmt == 0) {
+ record.maxDayOfflineAmt = 10000
+ }
+ if (!pos.replaceSysPara(record)) {
+ throw SysParaError("保存参数失败")
+ }
+ val dyRecord = pos.getDynamicPara()
+ dyRecord!!.paraverno = paraverno
+ dyRecord.paragroupid = paragroupid
+ if (!pos.replaceDynamicPara(dyRecord)) {
+ throw SysParaError("保存参数失败")
+ }
+ }
+
+ @Throws(WhiteListError::class)
+ override fun downloadWhitelist(whitelistid: Int, maxCardverno: String) {
+ var dyRecord = pos.getDynamicPara()
+ /**
+ * 白名单组ID变化清空本地白名单重新下载
+ */
+ if (dyRecord!!.whitelistid != whitelistid) {
+ if (!pos.clearWhiteList()) {
+ throw WhiteListError("清空白名单失败")
+ }
+ dyRecord.cardverno = "0"
+ dyRecord.whitelistid = whitelistid
+ if (!pos.replaceDynamicPara(dyRecord)) {
+ throw WhiteListError("保存参数失败")
+ }
+ }
+ val maxcount = 20
+ do {
+ val params = WebParams()
+ params.setParameter("devphyid", pos.getConfigPara()!!.devphyid)
+ .setParameter("cardverno", pos.getDynamicPara()!!.cardverno)
+ .setParameter("maxcount", maxcount)
+
+ val resp = YktSession.getInstance().sendYktRequestPost("/api/pos/whitelist", "", params)
+ ?: throw WhiteListError("请求超时")
+ if (resp.retcode != HttpStatus.SC_OK) {
+ throw WhiteListError("错误码=${resp.retcode}")
+ }
+ val retBean = try {
+ GsonUtil.GsonToBean(resp.retjson!!, WhiteListRetBean::class.java)
+ } catch (ex: Exception) {
+ throw WhiteListError("json异常:${ex.message}")
+ }
+ if (retBean.retcode != PublicDef.SUCCESS) {
+ throw WhiteListError(retBean.getErrorMsg())
+ }
+ if (retBean.count != retBean.whitelist?.size) {
+ throw WhiteListError("白名单数量不对[${retBean.count},${retBean.whitelist?.size}]")
+ }
+ val list = ArrayList<WhiteListRecord>()
+ retBean.whitelist?.forEach {
+ val record = WhiteListRecord()
+ record.cardphyid = it.cardphyid
+ record.cardno = it.cardno
+ record.status = it.status
+ list.add(record)
+ }
+ if (!pos.saveWhiteList(list)) {
+ throw WhiteListError("保存白名单失败")
+ }
+ dyRecord = pos.getDynamicPara()
+ dyRecord!!.cardverno = retBean.cardverno
+ if (!pos.replaceDynamicPara(dyRecord)) {
+ throw WhiteListError("保存参数失败")
+ }
+ } while (retBean.count == maxcount)
+ }
+
+ @Throws(TransdtlUploadError::class)
+ override fun uploadTransdtl(record: TransdtlOnlineRecord) {
+ val params = WebParams()
+ params.setParameter("devphyid", record.devphyid)
+ .setParameter("transdate", record.transdate)
+ .setParameter("transtime", record.transtime)
+ .setParameter("termseqno", record.devseqno)
+ .setParameter("reversalbillno", record.reversalbillno)
+ .setParameter("reversalflag", record.reversalflag.toString())
+ .setParameter("status", record.status.toString())
+ val resp = YktSession.getInstance().sendYktRequestPost("/api/pos/paycancel", "", params)
+ ?: throw TransdtlUploadError("请求超时")
+ if (resp.retcode != HttpStatus.SC_OK) {
+ throw TransdtlUploadError("错误码=${resp.retcode}")
+ }
+ val retBean = try {
+ GsonUtil.GsonToBean(resp.retjson!!, TransdtlRetBean::class.java)
+ } catch (ex: Exception) {
+ throw TransdtlUploadError("json异常:${ex.message}")
+ }
+ if (retBean.retcode != PublicDef.SUCCESS) {
+ throw TransdtlUploadError(retBean.getErrorMsg())
+ }
+ if (retBean.termseqno != record.devseqno) {
+ throw TransdtlUploadError("返回流水号不一致")
+ }
+ }
+
+ @Throws(TransdtlUploadError::class)
+ override fun uploadTransdtl(record: TransdtlOfflineRecord) {
+ val params = WebParams()
+ var reversalflag = "false"
+ if (record.reversalflag == ReversalFlag.AUTO ||
+ record.reversalflag == ReversalFlag.MANUAL
+ ) {
+ reversalflag = "true"
+ }
+ params.setParameter("devphyid", record.devphyid)
+ .setParameter("termseqno", record.devseqno)
+ .setParameter("transdate", record.transdate)
+ .setParameter("transtime", record.transtime)
+ .setParameter("cardno", record.cardno)
+ .setParameter("cardphyid", record.cardphyid)
+ .setParameter("amount", record.payamt)
+ .setParameter("extraamt", record.extraamt)
+ .setParameter("managefeetype", record.managefeetype)
+ .setParameter("reversalflag", reversalflag)
+ .setParameter("reversaltermseqno", record.reversalseqno)
+ .setParameter("reversaltransdate", record.reversaltransdate)
+ .setParameter("reversaltransdate", record.reversaltranstime)
+ .setParameter("status", record.status.toString())
+
+ val resp =
+ YktSession.getInstance().sendYktRequestPost("/api/pos/offlinetransdtl", "", params)
+ ?: throw TransdtlUploadError("请求超时")
+ if (resp.retcode != HttpStatus.SC_OK) {
+ throw TransdtlUploadError("错误码=${resp.retcode}")
+ }
+ val retBean = try {
+ GsonUtil.GsonToBean(resp.retjson!!, TransdtlRetBean::class.java)
+ } catch (ex: Exception) {
+ throw TransdtlUploadError("json异常:${ex.message}")
+ }
+ if (retBean.retcode != PublicDef.SUCCESS) {
+ throw TransdtlUploadError(retBean.getErrorMsg())
+ }
+ if (retBean.termseqno != record.devseqno) {
+ throw TransdtlUploadError("返回流水号不一致")
+ }
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/supwisdom/view/DialogPurchase.kt b/app/src/main/java/com/supwisdom/view/DialogPurchase.kt
index d368f60..7b27ee8 100644
--- a/app/src/main/java/com/supwisdom/view/DialogPurchase.kt
+++ b/app/src/main/java/com/supwisdom/view/DialogPurchase.kt
@@ -31,6 +31,8 @@
private var vUsername: TextView
private var posDec: PosDecoder? = null
private var lastFixpayDecoderOpenTime: Long = 0
+ private var lastCode: String = ""
+ private var lastCodeTime: Long = 0
private val waitTime = 60
private var payQueryConfirm = false
var codePayingNoCancelEnable = false
@@ -56,10 +58,17 @@
}
- override fun onDecoded(result: Result?) {
- val rawSize = result?.rawBytes?.size ?: 0
+ override fun onDecoded(result: Result) {
+ val rawSize = result.rawBytes?.size ?: 0
if (rawSize > 0) {
- callBack.callback(result!!.text)
+ if (result.text == lastCode &&
+ result.timestamp - lastCodeTime < 5000
+ ) {
+ return
+ }
+ lastCode = result.text
+ lastCodeTime = result.timestamp
+ callBack.callback(result.text)
}
}
diff --git a/upgrade.py b/upgrade.py
deleted file mode 100644
index 957fed9..0000000
--- a/upgrade.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#coding=utf-8
-#使用python做升级文件打包
-
-import hashlib
-import sys
-import zipfile
-from os import path
-import subprocess
-
-hashFileName = 'hash256.sign'
-
-
-def sha256_checknum(apk):
- hash256 = hashlib.sha256()
- srcFile = open(apk,'rb')
- with srcFile as f:
- for block in iter(lambda:f.read(4096),b''):
- hash256.update(block);
- srcFile.close()
- hash256.update(b'nzoqPYMIu91VViA/mEIG5FtJXi8=')
-
- hashFile = path.dirname(apk)+'/'+hashFileName
- print('hashFile = '+hashFile)
- destFile = open(hashFile,'w+')
- destFile.write(hash256.hexdigest())
- destFile.close()
-
-def zip_file(apk):
- fileDir = path.dirname(apk)
- version = subprocess.check_output(['git', 'describe', '--abbrev=4','--dirty','--always','--tags']).strip().decode('utf-8')
- zipFile = fileDir+'/posa711dali'+'-'+version+'.zip'
- print('zipFile = '+zipFile)
-
- zf = zipfile.ZipFile(zipFile,'w',zipfile.ZIP_DEFLATED)
- zf.write(fileDir+'/'+hashFileName,hashFileName)
- zf.write(apk,'posa711dali.apk')
- zf.close()
-
-if __name__ == '__main__':
- if len(sys.argv) < 2:
- print('miss parameter:app path!!!')
- exit(1)
- appFile = sys.argv[1]
- print('appFile = ' + appFile)
-
- if not path.exists(appFile):
- print(appFile +' is not exist')
- exit()
- sha256_checknum(appFile)
- zip_file(appFile)
- print('build upgrade zip success!')
\ No newline at end of file