优化
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 c1ed619..737ddc3 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 @@
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 @@
}.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)
+ }.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}>")
}
- TradeDict.FEETYPE_CONSUME_DISCOUNT -> {
- consumeDiscount(param, builder, it, account, shopacc)
- }
- 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()