mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-26 14:05:04 +08:00
记录退款金额到订单支付记录
This commit is contained in:
@@ -1299,11 +1299,10 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
// List<String> collect = list.stream().map(BalanceDeductionAmountVO::getPaymentId).collect(Collectors.toList());
|
||||
|
||||
List<OrderPayRecord> orderPayRecordList = orderPayRecordService.getOrderPayRecordList(orderBasicInfo.getOrderCode());
|
||||
AbstractProgramLogic orderLogic = new DelayMerchantProgramLogic();
|
||||
List<PaymentInfo> paymentInfos = Lists.newArrayList();
|
||||
for (OrderPayRecord orderPayRecord : orderPayRecordList) {
|
||||
String deductionRecord = orderPayRecord.getDeductionRecord();
|
||||
paymentInfos.addAll(orderLogic.parseDeductionRecord(deductionRecord));
|
||||
paymentInfos.addAll(orderPayRecordService.parseDeductionRecord(deductionRecord));
|
||||
}
|
||||
List<String> collect = paymentInfos.stream().map(PaymentInfo::getPaymentId).collect(Collectors.toList());
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.jsowell.pile.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.jsowell.adapay.vo.PaymentInfo;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.enums.ykc.ActionTypeEnum;
|
||||
@@ -18,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -155,6 +159,44 @@ public class OrderPayRecordServiceImpl implements OrderPayRecordService {
|
||||
return payRecordList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析deductionRecord
|
||||
* 【公共方法】
|
||||
*/
|
||||
@Override
|
||||
public List<PaymentInfo> parseDeductionRecord(String deductionRecord) {
|
||||
List<PaymentInfo> resultList = Lists.newArrayList();
|
||||
if (StringUtils.isBlank(deductionRecord)) {
|
||||
return resultList;
|
||||
}
|
||||
Object object = JSON.parse(deductionRecord);
|
||||
|
||||
// 都放入list里
|
||||
String s = JSON.toJSONString(object);
|
||||
if (object instanceof JSONArray) {
|
||||
List<PaymentInfo> paymentInfos = JSON.parseArray(s, PaymentInfo.class);
|
||||
resultList.addAll(paymentInfos);
|
||||
} else {
|
||||
PaymentInfo paymentInfo = JSON.parseObject(s, PaymentInfo.class);
|
||||
resultList.add(paymentInfo);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRefundAmount(String orderCode, String paymentId, BigDecimal refundAmt) {
|
||||
List<OrderPayRecord> orderPayRecordList = getOrderPayRecordList(orderCode);
|
||||
for (OrderPayRecord orderPayRecord : orderPayRecordList) {
|
||||
List<PaymentInfo> paymentInfos = parseDeductionRecord(orderPayRecord.getDeductionRecord());
|
||||
for (PaymentInfo paymentInfo : paymentInfos) {
|
||||
if (StringUtils.equals(paymentId, paymentInfo.getPaymentId())) {
|
||||
orderPayRecord.setRefundAmount(refundAmt);
|
||||
updateByPrimaryKeySelective(orderPayRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertSelective(OrderPayRecord record) {
|
||||
return orderPayRecordMapper.insertSelective(record);
|
||||
|
||||
Reference in New Issue
Block a user