This commit is contained in:
2023-08-31 16:06:49 +08:00
parent f8e2ee3c65
commit 16fa707f32

View File

@@ -18,7 +18,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
@Service @Service
@@ -88,16 +87,19 @@ public class OrderPayRecordServiceImpl implements OrderPayRecordService {
List<OrderDetailInfoVO.PayRecord> payRecordList = Lists.newArrayList(); List<OrderDetailInfoVO.PayRecord> payRecordList = Lists.newArrayList();
for (OrderPayRecord orderPayRecord : orderPayRecordList) { for (OrderPayRecord orderPayRecord : orderPayRecordList) {
OrderDetailInfoVO.PayRecord payInfo = new OrderDetailInfoVO.PayRecord(); OrderDetailInfoVO.PayRecord payInfo = new OrderDetailInfoVO.PayRecord();
// 余额支付如果是由本金和赠送一起支付的,合并为一个 // 余额支付如果是由本金和赠送一起支付的,合并为一个
BigDecimal bigDecimal = orderPayRecordList.stream() // BigDecimal bigDecimal = orderPayRecordList.stream()
.map(OrderPayRecord::getPayAmount) // .map(OrderPayRecord::getPayAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add); // .reduce(BigDecimal.ZERO, BigDecimal::add);
payInfo.setPayAmount(bigDecimal.toString()); // payInfo.setPayAmount(bigDecimal.toString());
payInfo.setPayAmount(orderPayRecord.getPayAmount().toString());
payInfo.setPayStatus(orderBasicInfo.getPayStatus()); payInfo.setPayStatus(orderBasicInfo.getPayStatus());
payInfo.setPayTime(DateUtils.formatDateTime(orderBasicInfo.getPayTime())); payInfo.setPayTime(DateUtils.formatDateTime(orderBasicInfo.getPayTime()));
if (orderBasicInfo.getRefundAmount() != null) { // if (orderBasicInfo.getRefundAmount() != null) {
payInfo.setRefundAmount(orderBasicInfo.getRefundAmount().toString()); // payInfo.setRefundAmount(orderBasicInfo.getRefundAmount().toString());
} // }
String payMode = orderPayRecord.getPayMode(); String payMode = orderPayRecord.getPayMode();
if (StringUtils.equals(payMode, OrderPayRecordEnum.PRINCIPAL_BALANCE_PAYMENT.getValue()) if (StringUtils.equals(payMode, OrderPayRecordEnum.PRINCIPAL_BALANCE_PAYMENT.getValue())
|| StringUtils.equals(payMode, OrderPayRecordEnum.GIFT_BALANCE_PAYMENT.getValue())) { || StringUtils.equals(payMode, OrderPayRecordEnum.GIFT_BALANCE_PAYMENT.getValue())) {