mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-11 02:40:15 +08:00
update 解析扣款记录bug
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.pile.service.orderlogic;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
@@ -414,9 +415,13 @@ public abstract class AbstractOrderLogic implements InitializingBean {
|
||||
|
||||
BigDecimal tempAmount = new BigDecimal(orderAmount.toString()); // 临时金额
|
||||
for (OrderPayRecord record : payRecordList) {
|
||||
JSONObject jsonObject = JSON.parseObject(record.getDeductionRecord());
|
||||
String paymentId = jsonObject.getString("paymentId");
|
||||
BigDecimal payAmount = record.getPayAmount(); // 此交易单支付的金额
|
||||
// String deductionRecord = record.getDeductionRecord();
|
||||
// JSONObject jsonObject = JSON.parseObject(deductionRecord);
|
||||
|
||||
List<JSONObject> jsonObjects = parseDeductionRecord(record.getDeductionRecord());
|
||||
for (JSONObject object : jsonObjects) {
|
||||
String paymentId = object.getString("paymentId");
|
||||
BigDecimal payAmount = object.getBigDecimal("amount"); // 此交易单支付的金额
|
||||
// 该笔支付扣除金额
|
||||
BigDecimal deductionAmount;
|
||||
// 该笔支付解冻金额
|
||||
@@ -442,6 +447,28 @@ public abstract class AbstractOrderLogic implements InitializingBean {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析deductionRecord
|
||||
* 【公共方法】
|
||||
*/
|
||||
protected List<JSONObject> parseDeductionRecord(String deductionRecord) {
|
||||
List<JSONObject> resultList = Lists.newArrayList();
|
||||
if (StringUtils.isBlank(deductionRecord)) {
|
||||
return resultList;
|
||||
}
|
||||
Object object = JSON.parse(deductionRecord);
|
||||
|
||||
// 都放入list里
|
||||
if (object instanceof JSONArray) {
|
||||
resultList.addAll(((JSONArray) object).toList(JSONObject.class));
|
||||
} else {
|
||||
resultList.add((JSONObject) object);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
|
||||
@@ -280,16 +280,18 @@ public class DelayMerchantOrderLogic extends AbstractOrderLogic {
|
||||
|
||||
// 把消费金额冻结
|
||||
for (OrderPayRecord record : payRecordList) {
|
||||
String deductionRecord = record.getDeductionRecord();
|
||||
Object object = JSON.parse(deductionRecord);
|
||||
// String deductionRecord = record.getDeductionRecord();
|
||||
// Object object = JSON.parse(deductionRecord);
|
||||
//
|
||||
// // 都放入list里
|
||||
// List<JSONObject> arr = Lists.newArrayList();
|
||||
// if (object instanceof JSONArray) {
|
||||
// arr.addAll(((JSONArray) object).toList(JSONObject.class));
|
||||
// } else {
|
||||
// arr.add((JSONObject) object);
|
||||
// }
|
||||
|
||||
// 都放入list里
|
||||
List<JSONObject> arr = Lists.newArrayList();
|
||||
if (object instanceof JSONArray) {
|
||||
arr.addAll(((JSONArray) object).toList(JSONObject.class));
|
||||
} else {
|
||||
arr.add((JSONObject) object);
|
||||
}
|
||||
List<JSONObject> arr = parseDeductionRecord(record.getDeductionRecord());
|
||||
|
||||
// 循环冻结金额
|
||||
for (JSONObject jsonObject : arr) {
|
||||
|
||||
Reference in New Issue
Block a user