调整sql语句,预约下单的
This commit is contained in:
parent
20fe8535d0
commit
ea7af33acb
@ -102,7 +102,7 @@ public class RedisKeyExpiredListener implements MessageListener {
|
||||
}
|
||||
|
||||
// 重要:预约订单向顺丰同城下单
|
||||
Pair<Boolean, String> result = shopOrderInfoService.runBookingOrder2CreateSfExpressOrder(orderId);
|
||||
Pair<Boolean, String> result = shopOrderInfoService.runBookingOrder2SfExpressOrder(orderId);
|
||||
if (result == null || !result.getFirst()) {
|
||||
log.error("[预约订单顺丰同城下单Redis过期监听] 顺丰同城下单失败:{}, 订单号: {}", result != null ? result.getSecond() : "", orderId);
|
||||
} else {
|
||||
|
||||
@ -132,5 +132,5 @@ public interface ShopOrderInfoService extends IBaseService<ShopOrderInfo> {
|
||||
* @param orderId 订单ID
|
||||
* @return
|
||||
*/
|
||||
Pair<Boolean, String> runBookingOrder2CreateSfExpressOrder(String orderId);
|
||||
Pair<Boolean, String> runBookingOrder2SfExpressOrder(String orderId);
|
||||
}
|
||||
|
||||
@ -940,7 +940,7 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl<ShopOrderInfoMappe
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public Pair<Boolean, String> runBookingOrder2CreateSfExpressOrder(String orderId) {
|
||||
public Pair<Boolean, String> runBookingOrder2SfExpressOrder(String orderId) {
|
||||
// 参数校验
|
||||
if (StrUtil.isBlank(orderId)) {
|
||||
logger.warn("[预约订单顺丰下单] 订单ID为空");
|
||||
@ -964,6 +964,14 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl<ShopOrderInfoMappe
|
||||
return Pair.of(false, "订单不是预约订单或者状态不正确");
|
||||
}
|
||||
|
||||
// 检查顺丰同城订单是否已经存在?
|
||||
String sfOrderId = shopStoreSfOrderService.getSfOrderIdByShopOrderId(orderId);
|
||||
if (StrUtil.isNotBlank(sfOrderId)) {
|
||||
logger.warn("[预约订单顺丰下单] 预约订单已下过单: orderId: {}, sfOrderId: {}", orderId, sfOrderId);
|
||||
return Pair.of(false, "预约订单已下过单,请勿重复操作");
|
||||
}
|
||||
|
||||
|
||||
// 调用顺丰接口创建订单
|
||||
Pair<Boolean, String> sfResult = sfExpressApiService.innerCreateSfExpressOrder(orderId, 0L);
|
||||
if (sfResult == null) {
|
||||
|
||||
@ -1470,7 +1470,7 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
||||
shopOrderReturn.setReturn_state_id(return_next_state_id);
|
||||
|
||||
//商家 收货确认0,增加库存?todo 流程已改,商家接单或者商家发货都是出库扣减库存的,审核也需要加回来库存
|
||||
if (ObjectUtil.equal(return_state_id, StateCode.RETURN_PROCESS_RECEIVED)||ObjectUtil.equal(return_state_id, StateCode.RETURN_PROCESS_CHECK)) {
|
||||
if (ObjectUtil.equal(return_state_id, StateCode.RETURN_PROCESS_RECEIVED) || ObjectUtil.equal(return_state_id, StateCode.RETURN_PROCESS_CHECK)) {
|
||||
//查询订单退货详情表,得到退货商品数量
|
||||
QueryWrapper<ShopOrderReturnItem> returnItemQueryWrapper = new QueryWrapper<>();
|
||||
returnItemQueryWrapper.in("return_id", return_ids);
|
||||
@ -1508,7 +1508,7 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
||||
// 增加库存
|
||||
Integer returnNum = returnItem.getReturn_item_num();
|
||||
if (returnNum != null) {
|
||||
Integer lestFrozenQuantity= productItem.getItem_quantity_frozen()-returnNum;//增加了退回的库存,也要释放锁定的库存
|
||||
Integer lestFrozenQuantity = productItem.getItem_quantity_frozen() - returnNum;//增加了退回的库存,也要释放锁定的库存
|
||||
if (lestFrozenQuantity.compareTo(0) < 0) {
|
||||
lestFrozenQuantity = 0;
|
||||
}
|
||||
@ -2117,25 +2117,25 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
||||
public boolean ifDenyReturn(ShopOrderInfo shopOrderInfo, ShopOrderItem shopOrderItem, ShopProductIndex shopProductIndex) {
|
||||
// 1. 参数校验
|
||||
if (shopOrderItem == null) {
|
||||
log.debug("[是否禁止退货] 订单商品数据为空 true");
|
||||
log.debug("[是否禁止退货] 订单商品数据为空,不允许退货");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (shopOrderInfo == null) {
|
||||
log.debug("[是否禁止退货] 订单信息为空 true");
|
||||
log.debug("[是否禁止退货] 订单信息为空,不允许退货");
|
||||
return true;
|
||||
}
|
||||
|
||||
String orderId = shopOrderInfo.getOrder_id();
|
||||
Integer orderStateId = shopOrderInfo.getOrder_state_id();
|
||||
if (StrUtil.isBlank(orderId) || CheckUtil.isEmpty(orderStateId)) {
|
||||
log.debug("[是否禁止退货] 订单ID或订单状态为空 true");
|
||||
log.debug("[是否禁止退货] 订单ID或订单状态为空,不允许退货");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (orderStateId.intValue() == StateCode.ORDER_STATE_CANCEL ||
|
||||
orderStateId.intValue() == StateCode.ORDER_STATE_WAIT_PAY) {
|
||||
log.debug("[是否禁止退货] 订单已取消或未支付,true order_id: {}", orderId);
|
||||
log.debug("[是否禁止退货] 订单已取消或未支付,不允许退货 order_id: {}", orderId);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2150,11 +2150,11 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
||||
|
||||
// 检查是否超过退货期限
|
||||
if (orderDealTime != null && withdrawTime.compareTo(orderDealTime) > 0) {
|
||||
log.debug("[是否禁止退货] 订单已超过退货期限 true,order_id: {}", orderId);
|
||||
log.debug("[是否禁止退货] 订单已超过退货期限,不允许退货,order_id: {}", orderId);
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("[是否禁止退货] 检查订单退货期限时发生异常 true,order_id: {}", orderId, e);
|
||||
log.error("[是否禁止退货] 检查订单退货期限时发生异常,不允许退货,order_id: {}", orderId, e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2165,17 +2165,17 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
||||
boolean isDrawn = lklOrderDrawService.isOrderDrawed(orderId);
|
||||
|
||||
if (isSeparated && isDrawn) {
|
||||
log.debug("[是否禁止退货] 拉卡拉分账订单已提现,不允许退货 true,order_id: {}", orderId);
|
||||
log.debug("[是否禁止退货] 拉卡拉分账订单已提现,不允许退货,order_id: {}", orderId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("[是否禁止退货] 检查拉卡拉分账状态时发生异常,order_id: {}", orderId, e);
|
||||
log.error("[是否禁止退货] 检查拉卡拉分账状态时发生异常,不允许退货,order_id: {}", orderId, e);
|
||||
}
|
||||
|
||||
Long productId = shopOrderItem.getProduct_id();
|
||||
if (CheckUtil.isEmpty(productId)) {
|
||||
log.debug("[是否禁止退货] 商品ID为空 true");
|
||||
log.debug("[是否禁止退货] 商品ID为空,不允许退货");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2187,7 +2187,7 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
||||
}
|
||||
|
||||
if (productIndex == null) {
|
||||
log.debug("[是否禁止退货] 商品索引信息不存在 true,product_id: {}", productId);
|
||||
log.debug("[是否禁止退货] 商品索引信息不存在,不允许退货,product_id: {}", productId);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2197,16 +2197,17 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
||||
try {
|
||||
List<Integer> contractTypeIds = Convert.toList(Integer.class, contractTypeIdsStr);
|
||||
if (contractTypeIds != null && contractTypeIds.contains(StateCode.CONTRACT_TYPE_DENY_RETURN)) {
|
||||
log.debug("[是否禁止退货] 商品设置了禁止退货标识 true,order_id: {}, product_id: {}", orderId, productId);
|
||||
log.debug("[是否禁止退货] 商品设置了禁止退货标识,不允许退货,order_id: {}, product_id: {}", orderId, productId);
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("[是否禁止退货] 解析商品保障类型失败 true,order_id: {}, product_id: {}", orderId, productId, e);
|
||||
log.error("[是否禁止退货] 解析商品保障类型失败,不允许退货,order_id: {}, product_id: {}", orderId, productId, e);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 默认允许退货
|
||||
log.debug("[是否禁止退货] false}");
|
||||
log.debug("[是否禁止退货] 允许退货}");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2243,7 +2244,7 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
||||
public boolean isOrderDenyReturn(String orderId) {
|
||||
// 参数校验
|
||||
if (StrUtil.isBlank(orderId)) {
|
||||
log.warn("[订单是否禁止退货] 订单ID为空,无法判断退货状态");
|
||||
log.warn("[订单是否禁止退货] 订单ID为空,不允许退货,无法判断退货状态");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2251,20 +2252,20 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
||||
// 获取订单信息
|
||||
ShopOrderInfo shopOrderInfo = shopOrderInfoService.get(orderId);
|
||||
if (shopOrderInfo == null) {
|
||||
log.error("[订单是否禁止退货] 订单信息不存在,订单ID: {}", orderId);
|
||||
log.error("[订单是否禁止退货] 订单信息不存在,不允许退货,订单ID: {}", orderId);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 检查订单状态是否已收货或已完成
|
||||
Integer orderStateId = shopOrderInfo.getOrder_state_id();
|
||||
if (CheckUtil.isEmpty(orderStateId)) {
|
||||
log.warn("[订单是否禁止退货] 订单状态为空");
|
||||
log.warn("[订单是否禁止退货] 订单状态为空,不允许退货");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (orderStateId.intValue() == StateCode.ORDER_STATE_CANCEL ||
|
||||
orderStateId.intValue() == StateCode.ORDER_STATE_WAIT_PAY) {
|
||||
log.debug("[是否禁止退货] 订单已取消或未支付,order_id: {}", orderId);
|
||||
log.debug("[是否禁止退货] 订单已取消或未支付,不允许退货, order_id: {}", orderId);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2294,7 +2295,7 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
||||
return false;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("[订单是否禁止退货] 查询订单{}退货状态异常", orderId, e);
|
||||
log.error("[订单是否禁止退货] 查询订单{}退货状态异常,不允许退货", orderId, e);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,15 +10,18 @@
|
||||
SELECT a.*
|
||||
FROM shop_order_booking a
|
||||
JOIN shop_order_info b ON a.order_id = b.order_id
|
||||
LEFT JOIN shop_store_sf_order c ON a.order_id = c.shop_order_id
|
||||
WHERE a.status = 1
|
||||
AND a.run_at > UNIX_TIMESTAMP()
|
||||
AND b.booking_state = 2
|
||||
AND b.booking_begin_time is not null
|
||||
AND b.booking_begin_time IS NOT NULL
|
||||
AND b.order_state_id < 2040
|
||||
AND c.shop_order_id IS NULL
|
||||
ORDER BY a.run_at ASC
|
||||
|
||||
<if test="limit_count != null and limit_count>0">
|
||||
LIMIT #{limit_count}
|
||||
</if>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user