|
|
|
@ -29,12 +29,10 @@ import co.yixiang.event.TemplateListenEnum;
|
|
|
|
|
import co.yixiang.exception.BadRequestException; |
|
|
|
|
import co.yixiang.exception.EntityExistException; |
|
|
|
|
import co.yixiang.exception.ErrorRequestException; |
|
|
|
|
import co.yixiang.modules.activity.domain.YxStoreCombination; |
|
|
|
|
import co.yixiang.modules.activity.domain.YxStoreCouponUser; |
|
|
|
|
import co.yixiang.modules.activity.domain.YxStorePink; |
|
|
|
|
import co.yixiang.modules.activity.service.YxStoreBargainService; |
|
|
|
|
import co.yixiang.modules.activity.service.YxStoreBargainUserService; |
|
|
|
|
import co.yixiang.modules.activity.service.YxStoreCouponUserService; |
|
|
|
|
import co.yixiang.modules.activity.service.YxStorePinkService; |
|
|
|
|
import co.yixiang.modules.activity.service.*; |
|
|
|
|
import co.yixiang.modules.activity.vo.StoreCouponUserVo; |
|
|
|
|
import co.yixiang.modules.cart.domain.YxStoreBrandCart; |
|
|
|
|
import co.yixiang.modules.cart.domain.YxStoreCart; |
|
|
|
@ -180,6 +178,8 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
private StoreOrderMapper yxStoreOrderMapper; |
|
|
|
|
@Autowired |
|
|
|
|
private StoreCartMapper storeCartMapper; |
|
|
|
|
@Autowired |
|
|
|
|
private YxStoreCombinationService yxStoreCombinationService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@ -576,12 +576,30 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
OrderLogEnum.CREATE_ORDER.getDesc()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//加入redis,30分钟自动取消
|
|
|
|
|
// 加入redis,30分钟自动取消
|
|
|
|
|
String redisKey = String.valueOf(StrUtil.format("{}{}", |
|
|
|
|
ShopConstants.REDIS_ORDER_OUTTIME_UNPAY, storeOrder.getId())); |
|
|
|
|
stringRedisTemplate.opsForValue().set(redisKey, storeOrder.getOrderId(), |
|
|
|
|
ShopConstants.ORDER_OUTTIME_UNPAY, TimeUnit.MINUTES); |
|
|
|
|
// 这里对拼团订单进行特殊处理(拼团订单不固定为30分钟)
|
|
|
|
|
if (combinationId != null && combinationId > 0){ //判断为拼团订单
|
|
|
|
|
YxStoreCombination yxStoreCombination=yxStoreCombinationService.getById(combinationId); |
|
|
|
|
// long nd = 1000 * 24 * 60 * 60;
|
|
|
|
|
// long nh = 1000 * 60 * 60;
|
|
|
|
|
long nm = 1000 * 60; |
|
|
|
|
long outTime=ShopConstants.ORDER_OUTTIME_UNPAY*2*yxStoreCombination.getEffectiveTime();//拼团订单时间
|
|
|
|
|
long endTime=yxStoreCombination.getStopTime().getTime()-new Date().getTime(); |
|
|
|
|
long endTimeMin=endTime % nm; |
|
|
|
|
if (outTime<endTimeMin){ //开团的时效小于拼团的截至时间
|
|
|
|
|
stringRedisTemplate.opsForValue().set(redisKey, storeOrder.getOrderId(), |
|
|
|
|
outTime,TimeUnit.MINUTES); |
|
|
|
|
}else { |
|
|
|
|
stringRedisTemplate.opsForValue().set(redisKey, storeOrder.getOrderId(), |
|
|
|
|
endTimeMin,TimeUnit.MINUTES); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}else { |
|
|
|
|
stringRedisTemplate.opsForValue().set(redisKey, storeOrder.getOrderId(), |
|
|
|
|
ShopConstants.ORDER_OUTTIME_UNPAY, TimeUnit.MINUTES); |
|
|
|
|
} |
|
|
|
|
//使用MQ延时消息
|
|
|
|
|
// TemplateBean templateBean = TemplateBean.builder()
|
|
|
|
|
// .orderId(storeOrder.getId()+"")
|
|
|
|
@ -1179,7 +1197,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
.eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()) |
|
|
|
|
.eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_0.getValue()); |
|
|
|
|
break; |
|
|
|
|
case STATUS_8: |
|
|
|
|
case STATUS_8://已取消订单
|
|
|
|
|
wrapper.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_0.getValue()) |
|
|
|
|
.eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()) |
|
|
|
|
.eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_8.getValue()); |
|
|
|
@ -1188,7 +1206,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
case STATUS_1: |
|
|
|
|
wrapper.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) |
|
|
|
|
.eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()) |
|
|
|
|
.eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_0.getValue()); |
|
|
|
|
.between(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_0.getValue(),OrderInfoEnum.STATUS_5.getValue()); //待审核/代发货都为代发货
|
|
|
|
|
break; |
|
|
|
|
//待收货
|
|
|
|
|
case STATUS_2: |
|
|
|
@ -1402,7 +1420,8 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
} |
|
|
|
|
wrapperThree.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) |
|
|
|
|
.eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()) |
|
|
|
|
.eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_0.getValue()); |
|
|
|
|
.between(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_0.getValue(),OrderInfoEnum.STATUS_5.getValue()); |
|
|
|
|
// .eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_0.getValue());
|
|
|
|
|
Long unshippedCount = yxStoreOrderMapper.selectCount(wrapperThree); |
|
|
|
|
|
|
|
|
|
//订单待收货 数量
|
|
|
|
@ -1483,8 +1502,23 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
|
|
|
|
|
StatusDto statusDTO = new StatusDto(); |
|
|
|
|
if (OrderStatusEnum.STATUS_0.getValue().equals(order.getPaid())) { |
|
|
|
|
//计算未支付到自动取消订 时间
|
|
|
|
|
int offset = Integer.valueOf(String.valueOf(ShopConstants.ORDER_OUTTIME_UNPAY)); |
|
|
|
|
//计算未支付到自动取消订单时间
|
|
|
|
|
int offset; |
|
|
|
|
if (order.getCombinationId() != null && order.getCombinationId() > 0){ //判断为拼团订单
|
|
|
|
|
YxStoreCombination yxStoreCombination=yxStoreCombinationService.getById(order.getCombinationId()); |
|
|
|
|
long nm = 1000 * 60; |
|
|
|
|
long outTime=ShopConstants.ORDER_OUTTIME_UNPAY*2*yxStoreCombination.getEffectiveTime();//拼团的团的成团时效
|
|
|
|
|
long endTime=yxStoreCombination.getStopTime().getTime()-order.getCreateTime().getTime(); |
|
|
|
|
long endTimeMin=endTime % nm; |
|
|
|
|
if (outTime<endTimeMin){ //开团的时效小于拼团的截至时间
|
|
|
|
|
offset=Integer.valueOf(String.valueOf(outTime)); |
|
|
|
|
}else { |
|
|
|
|
offset=Integer.valueOf(String.valueOf(endTimeMin)); |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
offset = Integer.valueOf(String.valueOf(ShopConstants.ORDER_OUTTIME_UNPAY));//普通订单30分钟
|
|
|
|
|
} |
|
|
|
|
// int offset = Integer.valueOf(String.valueOf(ShopConstants.ORDER_OUTTIME_UNPAY));
|
|
|
|
|
Date time = DateUtil.offsetMinute(order.getCreateTime(), offset); |
|
|
|
|
statusDTO.set_class("nobuy"); |
|
|
|
|
statusDTO.set_msg(StrUtil.format("请在{}前完成支付", DateUtil.formatDateTime(time))); |
|
|
|
@ -1500,7 +1534,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
statusDTO.set_msg("已为您退款,感谢您的支持"); |
|
|
|
|
statusDTO.set_type("-2"); |
|
|
|
|
statusDTO.set_title("已退款"); |
|
|
|
|
} else if (OrderInfoEnum.STATUS_0.getValue().equals(order.getStatus())) { |
|
|
|
|
} else if (OrderInfoEnum.STATUS_0.getValue().equals(order.getStatus())|OrderInfoEnum.STATUS_5.getValue().equals(order.getStatus())) { |
|
|
|
|
// 拼团
|
|
|
|
|
if (order.getPinkId() > 0) { |
|
|
|
|
if (pinkService.pinkIngCount(order.getPinkId()) > 0) { |
|
|
|
|