记得上下班打卡 | git大法好,push需谨慎

Commit e38d2dcd authored by 胡佳晨's avatar 胡佳晨

用券逻辑修改

parent f3394ddb
...@@ -508,12 +508,21 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -508,12 +508,21 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
List<GoblinOrderSkuVo> skuVoList = ObjectUtil.getGoblinOrderSkuVoArrayList(); List<GoblinOrderSkuVo> skuVoList = ObjectUtil.getGoblinOrderSkuVoArrayList();
for (GoblinOrderSqlParam item : sqlParams) { for (GoblinOrderSqlParam item : sqlParams) {
List<String> goblinOrderSkuIdList = CollectionUtil.linkedListString(); List<String> goblinOrderSkuIdList = CollectionUtil.linkedListString();
BigDecimal restVoucherPrice = item.getStoreOrder().getPriceVoucher();
for (int i = 0; i < item.getOrderSkuList().size(); i++) { for (int i = 0; i < item.getOrderSkuList().size(); i++) {
GoblinOrderSku orderSku = item.getOrderSkuList().get(i); GoblinOrderSku orderSku = item.getOrderSkuList().get(i);
if (item.getStoreOrder().getPriceVoucher().compareTo(BigDecimal.ZERO) > 0 && i == 0) { if (item.getStoreOrder().getPriceVoucher().compareTo(BigDecimal.ZERO) > 0) {
orderSku.setPriceVoucher(item.getStoreOrder().getPriceVoucher()); restVoucherPrice = restVoucherPrice.subtract(orderSku.getSkuPrice());
BigDecimal skuPriceActual = orderSku.getSkuPrice().subtract(item.getStoreOrder().getPriceVoucher()); if (restVoucherPrice.compareTo(BigDecimal.ZERO) > 0) {
orderSku.setSkuPriceActual(skuPriceActual.compareTo(BigDecimal.ZERO) > 0 ? skuPriceActual : BigDecimal.ZERO); orderSku.setPriceVoucher(orderSku.getSkuPrice());
BigDecimal skuPriceActual = orderSku.getSkuPrice().subtract(orderSku.getSkuPrice());
orderSku.setSkuPriceActual(skuPriceActual.compareTo(BigDecimal.ZERO) > 0 ? skuPriceActual : BigDecimal.ZERO);
} else {
orderSku.setPriceVoucher(restVoucherPrice.add(orderSku.getSkuPrice()));
BigDecimal skuPriceActual = orderSku.getSkuPrice().subtract(orderSku.getPriceVoucher());
orderSku.setSkuPriceActual(skuPriceActual.compareTo(BigDecimal.ZERO) > 0 ? skuPriceActual : BigDecimal.ZERO);
}
} }
sqlDataSku.add(new Object[]{ sqlDataSku.add(new Object[]{
orderSku.getOrderSkuId(), orderSku.getOrderId(), orderSku.getSpuId(), orderSku.getSpuName(), orderSku.getSpuPic(), orderSku.getSkuId(), orderSku.getNum(), orderSku.getSkuPrice(), orderSku.getSkuPriceActual(), orderSku.getSkuName(), orderSku.getOrderSkuId(), orderSku.getOrderId(), orderSku.getSpuId(), orderSku.getSpuName(), orderSku.getSpuPic(), orderSku.getSkuId(), orderSku.getNum(), orderSku.getSkuPrice(), orderSku.getSkuPriceActual(), orderSku.getSkuName(),
...@@ -724,7 +733,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -724,7 +733,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
if (orderVo.getStatus() == GoblinStatusConst.Status.ORDER_STATUS_5.getValue() && syncOrderParam.getStatus().equals(1)) { if (orderVo.getStatus() == GoblinStatusConst.Status.ORDER_STATUS_5.getValue() && syncOrderParam.getStatus().equals(1)) {
log.error("订单号为 {} 的订单超时支付", syncOrderParam.getOrderCode()); log.error("订单号为 {} 的订单超时支付", syncOrderParam.getOrderCode());
// 商铺退款逻辑 // 商铺退款逻辑
orderUtils.refundOrderSku(orderId,syncOrderParam.getPaymentId(),syncOrderParam.getPaymentType()); orderUtils.refundOrderSku(orderId, syncOrderParam.getPaymentId(), syncOrderParam.getPaymentType());
// orderVo.setStatus(GoblinStatusConst.OrderStatus.ORDER_STATUS_61.getValue()); // orderVo.setStatus(GoblinStatusConst.OrderStatus.ORDER_STATUS_61.getValue());
// redisUtils.setGoblinOrder(orderVo.getOrderId(),orderVo); // redisUtils.setGoblinOrder(orderVo.getOrderId(),orderVo);
} else if ((orderVo.getStatus() == GoblinStatusConst.Status.ORDER_STATUS_6.getValue() || orderVo.getStatus() == GoblinStatusConst.Status.ORDER_STATUS_7.getValue()) && syncOrderParam.getStatus().equals(1)) { } else if ((orderVo.getStatus() == GoblinStatusConst.Status.ORDER_STATUS_6.getValue() || orderVo.getStatus() == GoblinStatusConst.Status.ORDER_STATUS_7.getValue()) && syncOrderParam.getStatus().equals(1)) {
...@@ -903,7 +912,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -903,7 +912,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
String orderId = backOrderVo.getOrderId(); String orderId = backOrderVo.getOrderId();
List<GoblinBackOrderSkuVo> backOrderSkuVos = backOrderVo.getBackOrderSkuVos(); List<GoblinBackOrderSkuVo> backOrderSkuVos = backOrderVo.getBackOrderSkuVos();
GoblinStoreOrderVo orderVo = redisUtils.getGoblinOrder(orderId); GoblinStoreOrderVo orderVo = redisUtils.getGoblinOrder(orderId);
orderVo.setPriceRefund(orderVo.getPriceRefund()==null?BigDecimal.ZERO:orderVo.getPriceRefund().add(refundCallbackParam.getRefundPrice())); orderVo.setPriceRefund(orderVo.getPriceRefund() == null ? BigDecimal.ZERO : orderVo.getPriceRefund().add(refundCallbackParam.getRefundPrice()));
if (orderVo.getPriceRefund().compareTo(orderVo.getPriceActual()) >= 0) { if (orderVo.getPriceRefund().compareTo(orderVo.getPriceActual()) >= 0) {
//整单退款 退券 //整单退款 退券
orderVo.setStatus(GoblinStatusConst.Status.ORDER_STATUS_6.getValue()); orderVo.setStatus(GoblinStatusConst.Status.ORDER_STATUS_6.getValue());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment