修复订单原商品价格的错误
This commit is contained in:
parent
e8c964ddcb
commit
23a3b1c659
@ -6610,7 +6610,8 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
|||||||
order_payment_amount = NumberUtil.max(order_payment_amount, BigDecimal.valueOf(0));
|
order_payment_amount = NumberUtil.max(order_payment_amount, BigDecimal.valueOf(0));
|
||||||
|
|
||||||
// 订单原价商品金额
|
// 订单原价商品金额
|
||||||
BigDecimal order_product_amount = Convert.toBigDecimal(store_item.get("productMoney"));
|
BigDecimal order_product_amount = Convert.toBigDecimal(store_item.get("productMoneyOriginGoods"));
|
||||||
|
// log.info("订单原价商品金额计算:{}", order_payment_amount);
|
||||||
base_row.put("order_product_amount", order_product_amount);
|
base_row.put("order_product_amount", order_product_amount);
|
||||||
|
|
||||||
//【重要】应付款金额计算
|
//【重要】应付款金额计算
|
||||||
@ -6651,6 +6652,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
|||||||
base_row.put("buyer_user_name", buyer_user_name);
|
base_row.put("buyer_user_name", buyer_user_name);
|
||||||
|
|
||||||
ShopOrderBase baseRow = Convert.convert(ShopOrderBase.class, base_row);
|
ShopOrderBase baseRow = Convert.convert(ShopOrderBase.class, base_row);
|
||||||
|
// logger.info("【重要】订单基础信息保存:{}", base_row);
|
||||||
// (重要)订单基础信息保存
|
// (重要)订单基础信息保存
|
||||||
boolean flag = saveOrUpdate(baseRow);
|
boolean flag = saveOrUpdate(baseRow);
|
||||||
|
|
||||||
|
|||||||
@ -2487,20 +2487,20 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
|||||||
public boolean ifDenyReturn(ShopOrderInfo shopOrderInfo, ShopOrderItem shopOrderItem, ShopProductIndex shopProductIndex) {
|
public boolean ifDenyReturn(ShopOrderInfo shopOrderInfo, ShopOrderItem shopOrderItem, ShopProductIndex shopProductIndex) {
|
||||||
// 1. 参数校验
|
// 1. 参数校验
|
||||||
if (shopOrderInfo == null) {
|
if (shopOrderInfo == null) {
|
||||||
log.debug("[是否禁止退货] 订单信息为空,禁止退货");
|
log.info("[是否禁止退货] 订单信息为空,禁止退货");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String orderId = shopOrderInfo.getOrder_id();
|
String orderId = shopOrderInfo.getOrder_id();
|
||||||
Integer orderStateId = shopOrderInfo.getOrder_state_id();
|
Integer orderStateId = shopOrderInfo.getOrder_state_id();
|
||||||
if (StrUtil.isBlank(orderId) || CheckUtil.isEmpty(orderStateId)) {
|
if (StrUtil.isBlank(orderId) || CheckUtil.isEmpty(orderStateId)) {
|
||||||
log.debug("[是否禁止退货] 订单ID或订单状态为空,禁止退货");
|
log.info("[是否禁止退货] 订单ID或订单状态为空,禁止退货");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (orderStateId.intValue() == StateCode.ORDER_STATE_CANCEL ||
|
if (orderStateId.intValue() == StateCode.ORDER_STATE_CANCEL ||
|
||||||
orderStateId.intValue() == StateCode.ORDER_STATE_WAIT_PAY) {
|
orderStateId.intValue() == StateCode.ORDER_STATE_WAIT_PAY) {
|
||||||
log.debug("[是否禁止退货] 订单状态为已取消或未支付,禁止退货,order_id: {}, orderStateId: {}", orderId, orderStateId);
|
log.info("[是否禁止退货] 订单状态为已取消或未支付,禁止退货,order_id: {}, orderStateId: {}", orderId, orderStateId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2515,12 +2515,12 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
|||||||
|
|
||||||
// 检查是否超过退货期限
|
// 检查是否超过退货期限
|
||||||
if (orderDealTime != null && withdrawTime.compareTo(orderDealTime) > 0) {
|
if (orderDealTime != null && withdrawTime.compareTo(orderDealTime) > 0) {
|
||||||
log.debug("[是否禁止退货] 订单已超过退货期限,禁止退货,order_id: {}, orderDealTime: {}, withdrawTime: {}",
|
log.info("[是否禁止退货] 订单已超过退货期限,禁止退货,order_id: {}, orderDealTime: {}, withdrawTime: {}",
|
||||||
orderId, orderDealTime, withdrawTime);
|
orderId, orderDealTime, withdrawTime);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("[是否禁止退货] 检查订单退货期限时发生异常,禁止退货,order_id: {}", orderId, e);
|
log.info("[是否禁止退货] 检查订单退货期限时发生异常,禁止退货,order_id: {}", orderId, e);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2533,19 +2533,19 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
|||||||
boolean isLklProcessed = isSeparated && isDrawn;
|
boolean isLklProcessed = isSeparated && isDrawn;
|
||||||
|
|
||||||
if (isLklProcessed) {
|
if (isLklProcessed) {
|
||||||
log.debug("[是否禁止退货] 拉卡拉分账订单已提现,禁止退货,order_id: {}, separated: {}, drawed: {}",
|
log.info("[是否禁止退货] 拉卡拉分账订单已提现,禁止退货,order_id: {}, separated: {}, drawed: {}",
|
||||||
orderId, isSeparated, isDrawn);
|
orderId, isSeparated, isDrawn);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("[是否禁止退货] 检查拉卡拉分账状态时发生异常,禁止退货,order_id: {}", orderId, e);
|
log.error("[是否禁止退货] 检查拉卡拉分账状态时发生异常,禁止退货,order_id: {}", orderId, e);
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果没有商品相关信息,则只检查订单级别
|
// 如果没有商品相关信息,则只检查订单级别
|
||||||
if (shopOrderItem == null && shopProductIndex == null) {
|
if (shopOrderItem == null && shopProductIndex == null) {
|
||||||
log.debug("[是否禁止退货] 无商品信息,仅检查订单级别,允许退货,order_id: {}", orderId);
|
log.info("[是否禁止退货] 无商品信息,仅检查订单级别,允许退货,order_id: {}", orderId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2562,7 +2562,7 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (productIndex == null) {
|
if (productIndex == null) {
|
||||||
log.debug("[是否禁止退货] 商品索引信息不存在,允许退货,order_id: {}", orderId);
|
log.info("[是否禁止退货] 商品索引信息不存在,允许退货,order_id: {}", orderId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2572,7 +2572,7 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
|||||||
try {
|
try {
|
||||||
List<Integer> contractTypeIds = Convert.toList(Integer.class, contractTypeIdsStr);
|
List<Integer> contractTypeIds = Convert.toList(Integer.class, contractTypeIdsStr);
|
||||||
if (contractTypeIds != null && contractTypeIds.contains(StateCode.CONTRACT_TYPE_DENY_RETURN)) {
|
if (contractTypeIds != null && contractTypeIds.contains(StateCode.CONTRACT_TYPE_DENY_RETURN)) {
|
||||||
log.debug("[是否禁止退货] 商品设置了禁止退货标识,禁止退货,order_id: {}, product_id: {}", orderId, productIndex.getProduct_id());
|
log.info("[是否禁止退货] 商品设置了禁止退货标识,禁止退货,order_id: {}, product_id: {}", orderId, productIndex.getProduct_id());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -2581,13 +2581,13 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shopOrderItem != null && CheckUtil.isNotEmpty(shopOrderItem.getOrder_item_id())) {
|
if (shopOrderItem != null && CheckUtil.isNotEmpty(shopOrderItem.getOrder_item_id()) && !ifCanReturnOrderItem(shopOrderItem)) {
|
||||||
// 3.2 检查商品退款详情里是否已经提交过退款申请, 且数量大于订单数量,或金额大于订单金额
|
// 3.2 检查商品退款详情里是否已经提交过退款申请, 且数量大于订单数量,或金额大于订单金额
|
||||||
return ifCanReturnOrderItem(shopOrderItem);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 默认允许退货
|
// 默认允许退货
|
||||||
log.debug("[是否禁止退货] 商品允许退货,order_id: {}, product_id: {}", orderId, productIndex.getProduct_id());
|
log.info("[是否禁止退货] 商品允许退货,order_id: {}, product_id: {}", orderId, productIndex.getProduct_id());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3359,6 +3359,7 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
|||||||
private boolean ifCanReturnOrderItem(ShopOrderItem orderItem) {
|
private boolean ifCanReturnOrderItem(ShopOrderItem orderItem) {
|
||||||
// 如果订单子项不存在,不能退款
|
// 如果订单子项不存在,不能退款
|
||||||
if (orderItem == null) {
|
if (orderItem == null) {
|
||||||
|
log.info("订单子项为空,无法退款");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3368,11 +3369,19 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
|||||||
BigDecimal orderItemAmount = ObjectUtil.defaultIfNull(orderItem.getOrder_item_amount(), BigDecimal.ZERO);
|
BigDecimal orderItemAmount = ObjectUtil.defaultIfNull(orderItem.getOrder_item_amount(), BigDecimal.ZERO);
|
||||||
BigDecimal orderItemReturnAgreeAmount = ObjectUtil.defaultIfNull(orderItem.getOrder_item_return_agree_amount(), BigDecimal.ZERO);
|
BigDecimal orderItemReturnAgreeAmount = ObjectUtil.defaultIfNull(orderItem.getOrder_item_return_agree_amount(), BigDecimal.ZERO);
|
||||||
|
|
||||||
|
// 记录调试信息
|
||||||
|
log.info("订单子项退款检查 - 商品ID: {}, 订单数量: {}, 已退数量: {}, 商品金额: {}, 已同意退款金额: {}",
|
||||||
|
orderItem.getProduct_id(), orderItemQuantity, orderItemReturnNum, orderItemAmount, orderItemReturnAgreeAmount);
|
||||||
|
|
||||||
// 判断是否可以退款:
|
// 判断是否可以退款:
|
||||||
// 1. 可退数量 > 0
|
// 1. 可退数量 > 0 (订单商品数量 > 已退货数量)
|
||||||
// 2. 可退金额 > 0
|
boolean canReturnQuantity = orderItemQuantity > orderItemReturnNum;
|
||||||
return orderItemQuantity > orderItemReturnNum
|
// 2. 可退金额 > 0 (订单商品金额 > 已同意退款金额)
|
||||||
&& orderItemAmount.compareTo(orderItemReturnAgreeAmount) > 0;
|
boolean canReturnAmount = orderItemAmount.compareTo(orderItemReturnAgreeAmount) > 0;
|
||||||
|
|
||||||
|
log.info("退款条件检查结果 - 可退数量: {}, 可退金额: {}", canReturnQuantity, canReturnAmount);
|
||||||
|
|
||||||
|
return canReturnQuantity && canReturnAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user