...
|
...
|
@@ -4,6 +4,7 @@ import com.yohobuy.ufo.model.order.bo.TimeoutBo; |
|
|
import com.yohobuy.ufo.model.order.constants.TimeoutCase;
|
|
|
import com.yohoufo.common.utils.DateUtil;
|
|
|
import com.yohoufo.dal.order.OrdersPayMapper;
|
|
|
import com.yohoufo.dal.order.model.OrderOverTime;
|
|
|
import com.yohoufo.dal.order.model.OrdersPay;
|
|
|
import com.yohoufo.order.mq.DelayTime;
|
|
|
import com.yohoufo.order.service.proxy.DeliveryMinutesService;
|
...
|
...
|
@@ -12,6 +13,9 @@ import org.slf4j.LoggerFactory; |
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Objects;
|
|
|
import java.util.Optional;
|
|
|
|
|
|
/**
|
|
|
* Created by chao.chen on 2018/11/23.
|
|
|
*/
|
...
|
...
|
@@ -24,8 +28,15 @@ public class OrdersPayService { |
|
|
@Autowired
|
|
|
private DeliveryMinutesService deliveryMinutesService;
|
|
|
|
|
|
@Autowired
|
|
|
private OrderOverTimeService orderOverTimeService;
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 需要根据配置进行算配置时间点之前的剩余时长
|
|
|
* @param buyerUid
|
|
|
* @param orderCode
|
|
|
* @return
|
|
|
*/
|
|
|
public TimeoutBo getDeliverLeftTime(int buyerUid, long orderCode){
|
|
|
OrdersPay ordersPay = ordersPayMapper.selectOrdersPay(orderCode, buyerUid);
|
|
|
if (ordersPay == null){
|
...
|
...
|
@@ -34,18 +45,26 @@ public class OrdersPayService { |
|
|
|
|
|
Integer createTime = ordersPay.getCreateTime();
|
|
|
|
|
|
OrderOverTime orderOverTime = Optional.ofNullable(orderCode).map(orderOverTimeService::selectByOrderCode).orElse(null);
|
|
|
//Integer deliverMinute = Optional.ofNullable(orderOverTime).map(OrderOverTime::getDeliveryMinutes).orElse(null); // 对于老订单来说,超时表记录无数据,则默认120小时
|
|
|
Integer deliverMinute = Optional.ofNullable(orderOverTime).map(OrderOverTime::getDeliveryMinutes).orElse(DelayTime.MINUTES_120_HOURS * 60); // 对于老订单来说,超时表记录无数据,则默认120小时
|
|
|
//把分钟转为秒
|
|
|
int timelimit = deliverMinute * 60;
|
|
|
/**
|
|
|
//订单的支付时间如果大于上线时间,则120小时算,否则还是36小时
|
|
|
int timelimit;
|
|
|
int onLineTime = deliveryMinutesService.getOnlineTime();
|
|
|
if(createTime.intValue()>=onLineTime){
|
|
|
int onLineTime = deliveryMinutesService.getOnlineTime(); //
|
|
|
if(Objects.isNull(deliverMinute)){
|
|
|
logger.info("OrdersPayService createTime bigger than online time ,set 120 hours ,orderCode {},createTime {} ,onLineTime {}",orderCode,createTime,onLineTime);
|
|
|
timelimit = deliveryMinutesService.getDeliverMinutesThird()* 60;
|
|
|
timelimit = DelayTime.MINUTES_120_HOURS * 60;
|
|
|
}else{
|
|
|
logger.info("OrdersPayService createTime smaller than online time ,set 36 hours ,orderCode {},createTime {} ,onLineTime {}",orderCode,createTime,onLineTime);
|
|
|
timelimit = DelayTime.MINUTES_36_HOURS * 60;
|
|
|
//timelimit = deliveryMinutesService.getDeliverMinutesThird()* 60;
|
|
|
timelimit = deliverMinute;
|
|
|
}
|
|
|
//int timelimit = DelayTime.MINUTES_36_HOURS * 60;
|
|
|
//int timelimit = deliveryMinutesService.getDeliverMinutesThird()* 60;
|
|
|
*/
|
|
|
|
|
|
int left = timelimit - (DateUtil.getCurrentTimeSecond()-createTime);
|
|
|
TimeoutBo timeoutBo = new TimeoutBo();
|
...
|
...
|
|