From c3e89bfad76ceffbec81a9c72bb6ca577dc023c6 Mon Sep 17 00:00:00 2001 From: Tang Cheng Date: Sat, 15 Jun 2019 16:56:41 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../api/controller/consume_api_controller.kt | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt b/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt index c1ed619c..737ddc3d 100644 --- a/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt +++ b/src/main/kotlin/com/supwisdom/dlpay/api/controller/consume_api_controller.kt @@ -148,7 +148,7 @@ class ConsumeAPIController { val account = accountUtilServcie.readAccount(person.userid) val shopacc = accountUtilServcie.readShopbyShopaccno(param.shopaccno) - val builder = TransactionBuilder().apply { + val dtl = TransactionBuilder().apply { setTransInfo(param.transdate, param.transtime, TradeCode.TRANSCODE_BALANCE_PAY, TradeDict.PAYTYPE_BALANCE) @@ -162,22 +162,21 @@ class ConsumeAPIController { }.and().shop(shopacc).apply { setAmount(param.amount / 100.0, TradeDict.TRADE_FLAG_IN) opposite = AccountProxy(account) - }.and() - - param.feelist?.forEach { - when (it.feetype) { - TradeDict.FEETYPE_CONSUME_MEALER -> { - consumeMealer(param, builder, it, account, shopacc) - } - TradeDict.FEETYPE_CONSUME_DISCOUNT -> { - consumeDiscount(param, builder, it, account, shopacc) + }.and().also {builder -> + param.feelist?.forEach { + when (it.feetype) { + TradeDict.FEETYPE_CONSUME_MEALER -> { + consumeMealer(param, builder, it, account, shopacc) + } + TradeDict.FEETYPE_CONSUME_DISCOUNT -> { + consumeDiscount(param, builder, it, account, shopacc) + } + else -> throw TransactionCheckException(TradeErrorCode.INPUT_DATA_ERROR, + "支付费率清单不支持feetype<${it.feetype}>") } - else -> throw TransactionCheckException(TradeErrorCode.INPUT_DATA_ERROR, - "支付费率清单不支持feetype<${it.feetype}>") } - } + }.init(transactionService) - val dtl = builder.init(transactionService) transactionService.success(dtl.refno) return ResponseEntity.ok(ResponseBodyBuilder.create() -- 2.17.1