Authored by chenchao

Merge branch 'dev_order' into test6.8.2

... ... @@ -83,10 +83,6 @@ public class OrderDetailInfo {
*/
private Integer isPaid;
/**
* 发货剩余时间
*/
private Long deliverLeftTime;
@Builder
@Data
... ...
... ... @@ -3,6 +3,7 @@ package com.yohoufo.order.service.impl;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;
import com.yohobuy.ufo.model.order.common.SkupStatus;
import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
import com.yohoufo.common.helper.ImageUrlAssist;
import com.yohoufo.common.utils.DateUtil;
... ... @@ -28,7 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
/**
* Created by chenchao on 2018/9/20.
*/
public abstract class AbsOrderDetailService implements IOrderDetailService{
public abstract class AbsOrderDetailService extends AbsOrderViewService implements IOrderDetailService{
private final Logger logger = LoggerFactory.getLogger(getClass());
... ... @@ -53,13 +54,8 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{
abstract AddressInfo getHiddenAddressInfo(int uid, long orderCode, int skup);
Long getDeliverLeftTime(int buyerUid, long orderCode, Integer orderStatus){
if (OrderStatus.HAS_PAYED.getCode() == orderStatus){
return ordersPayService.getDeliverLeftTime(buyerUid, orderCode);
}else{
return null;
}
}
/**
* 获取订单详情
* @param orderRequest
... ... @@ -181,7 +177,7 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{
//只有卖家在查看买家的订单时才有
assembleSoldPrdCompute(orderDetailInfo, buyerOrder.getSellerUid(), buyerOrderGoods.getSkup());
orderDetailInfo.setDeliverLeftTime(getDeliverLeftTime(buyerUid, orderCode, buyerOrder.getStatus()));
//orderDetailInfo.setDeliverLeftTime(getDeliverLeftTime(buyerUid, orderCode, buyerOrder.getStatus()));
return orderDetailInfo;
}
... ... @@ -208,9 +204,7 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{
protected abstract OrderDetailInfo.StatusDetail getStatusDetail(BuyerOrder buyerOrder,OrderStatus orderStatus, TabType tabType) ;
protected int calLeftTime(int creatTime){
return OrderInfo.PAY_TIME_SECOND -(DateUtil.getCurrentTimeSecond() - creatTime);
}
/**
* 用于从cache中获取数据后,重置动态数据
... ...
... ... @@ -26,13 +26,10 @@ import java.util.stream.Collectors;
/**
* Created by chenchao on 2018/9/19.
*/
public abstract class AbsOrderListService implements IOrderListService{
public abstract class AbsOrderListService extends AbsOrderViewService implements IOrderListService{
private final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private OrdersPayService ordersPayService;
abstract List<Integer> initOrderListRequest(OrderListRequest request);
abstract int getTotal(int uid, List<Integer> statusQuery);
... ... @@ -43,13 +40,7 @@ public abstract class AbsOrderListService implements IOrderListService{
abstract List<SellerOrderGoods> getBaseOrderGoodsList(List<Integer> skups);
Long getDeliverLeftTime(int buyerUid, long orderCode, Integer orderStatus){
if (OrderStatus.HAS_PAYED.getCode() == orderStatus){
return ordersPayService.getDeliverLeftTime(buyerUid, orderCode);
}else{
return null;
}
}
/**
* 订单列表
* @param request
... ... @@ -102,9 +93,7 @@ public abstract class AbsOrderListService implements IOrderListService{
}
protected int calLeftTime(int creatTime){
return OrderInfo.PAY_TIME_SECOND - (DateUtil.getCurrentTimeSecond() - creatTime);
}
/**
* 获取返回结果
* @param buyerOrderGoodsMap
... ... @@ -123,8 +112,10 @@ public abstract class AbsOrderListService implements IOrderListService{
* 3.查询 seller_order_goods
*/
OrderListInfo orderListInfo = new OrderListInfo();
orderListInfo.setUid(buyerOrder.getUid());
orderListInfo.setOrderCode(buyerOrder.getOrderCode());
Integer buyerUid;
Long orderCode;
orderListInfo.setUid(buyerUid=buyerOrder.getUid());
orderListInfo.setOrderCode(orderCode=buyerOrder.getOrderCode());
orderListInfo.setRealPrice(buyerOrder.getAmount() == null ? "" : buyerOrder.getAmount().toPlainString());
// 订单中状态显示
orderListInfo.setStatus(buyerOrder.getStatus() == null ? -1 : buyerOrder.getStatus());
... ... @@ -132,7 +123,7 @@ public abstract class AbsOrderListService implements IOrderListService{
if (orderStatus == null){
logger.warn("getOrderList orderStatus not exist, uid is {}, orderCode is {}, status is {}",
buyerOrder.getUid(), orderListInfo.getOrderCode(), buyerOrder.getStatus());
buyerUid,orderCode, buyerOrder.getStatus());
return null;
}
... ... @@ -142,10 +133,8 @@ public abstract class AbsOrderListService implements IOrderListService{
orderListInfo.setButtons(orderStatus.getListButtons(tabType));
// 当订单状态是待付款, 显示leftTime
if (orderListInfo.getStatus() == OrderStatus.WAITING_PAY.getCode()){
orderListInfo.setLeftTime(calLeftTime(buyerOrder.getCreateTime()));
}
Integer leftTime = getLeftTime(tabType, buyerUid, orderCode, buyerOrder.getStatus(), buyerOrder.getCreateTime());
orderListInfo.setLeftTime(leftTime);
BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMap.get(buyerOrder.getOrderCode());
if (buyerOrderGoods == null){
logger.warn("getOrderList buyer goods not exist, uid is {}, orderCode is {}",
... ... @@ -173,9 +162,6 @@ public abstract class AbsOrderListService implements IOrderListService{
orderListInfo.setGoodsInfo(goodsInfo);
orderListInfo.setSecendLevelCreateTime(buyerOrder.getCreateTime());
orderListInfo.setCreateTime(DateUtil.formatDate(buyerOrder.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
//
orderListInfo.setDeliverLeftTime(getDeliverLeftTime(buyerOrder.getUid(), buyerOrder.getOrderCode(),
buyerOrder.getStatus()));
return orderListInfo;
}
... ...
package com.yohoufo.order.service.impl;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.common.SkupStatus;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohoufo.common.utils.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
/**
* Created by chao.chen on 2018/11/26.
*/
public abstract class AbsOrderViewService {
@Autowired
private OrdersPayService ordersPayService;
Integer getLeftTime(TabType actor, Integer uid, Long orderCode, Integer orderStatus, Integer createTime){
Integer leftTime =null;
Integer payLeftTime = getPayLeftTime(actor, orderStatus,
createTime);
Integer deliverLeftTime = null;
if (uid != null && orderCode != null && orderStatus!= null){
deliverLeftTime = getDeliverLeftTime(uid, orderCode,
orderStatus);
}
if (payLeftTime != null){
leftTime = payLeftTime;
}
if (deliverLeftTime !=null ){
leftTime = deliverLeftTime;
}
return leftTime;
}
Integer getPayLeftTime(TabType actor, Integer orderStatus, int createTime){
boolean isBuyer = actor.equals(TabType.BUY);
boolean isSeller = actor.equals(TabType.SELL);
Integer leftTime = null;
boolean isFiredCal = (isBuyer && orderStatus == OrderStatus.WAITING_PAY.getCode())
|| (isSeller && orderStatus == SkupStatus.CAN_NOT_SELL.getCode());
if(isFiredCal){
leftTime = calLeftTime(createTime);
}
return leftTime;
}
Integer getDeliverLeftTime(int buyerUid, long orderCode, Integer orderStatus){
Integer leftTime = null;
if (OrderStatus.HAS_PAYED.getCode() == orderStatus){
leftTime = ordersPayService.getDeliverLeftTime(buyerUid, orderCode);
}
return leftTime;
}
protected int calLeftTime(int creatTime){
return OrderInfo.PAY_TIME_SECOND - (DateUtil.getCurrentTimeSecond() - creatTime);
}
}
... ...
... ... @@ -177,6 +177,8 @@ public class BuyerOrderCancelService {
//(退费)退保证金给卖家
logger.info("in BuyerCancelAfterProcessTask call buyerUid {}, orderCode {}, skup {}, transferCase {}, compensate {}",
buyerUid, orderCode, skup, transferCase, compensate);
PayRefundBo prb = null;
try {
SellerOrder sellerOrder = sellerOrderMapper.selectByOrderCode(orderCode);
int sellerUid = sellerOrder.getUid();
long sellerOrderCode = sellerOrder.getOrderCode();
... ... @@ -188,7 +190,7 @@ public class BuyerOrderCancelService {
.buyerUid(buyerUid).sellerUid(sellerUid).orderCode(sellerOrder.getOrderCode())
.payType(sellerOrder.getPayment()).refundCase(RefundCase.SELLER_EARNEST_MONEY)
.skup(skup);
PayRefundBo prb = payRefundService.refund(req, bleb);
prb = payRefundService.refund(req, bleb);
//(转账)瓜分指定赔偿款给卖家和平台
... ... @@ -212,7 +214,12 @@ public class BuyerOrderCancelService {
payRefundService.refund(rprOfBuyer, blebOfBuyer);
logger.info("out BuyerCancelAfterProcessTask call buyerUid {}, orderCode {}, skup {}, transferCase {}, compensate {}",
buyerUid, orderCode, skup, transferCase, compensate);
}catch (Exception ex){
logger.info("occur error BuyerCancelAfterProcessTask call buyerUid {}, orderCode {}, skup {}, transferCase {}, compensate {}",
buyerUid, orderCode, skup, transferCase, compensate, ex);
}
return prb;
}
}
... ...
... ... @@ -129,10 +129,8 @@ public class BuyerOrderDetailService extends AbsOrderDetailService implements IO
.build();
// 待付款时,剩余时间
if (orderStatus.getCode() == OrderStatus.WAITING_PAY.getCode()){
int leftTime = calLeftTime(buyerOrder.getCreateTime());
int leftTime = getLeftTime(tabType,buyerOrder.getUid(), buyerOrder.getOrderCode(), orderStatus.getCode(), buyerOrder.getCreateTime());
statusDetail.setLeftTime(leftTime);
}
boolean isShowWaitingTime = OrderStatus.WAITING_RECEIVE.getCode() == orderStatus.getCode();
if(isShowWaitingTime){
int leftSeconds = BuyerConfirmHandler.DELAY_MINUTES_7_DAYS*60 - (DateUtil.getCurrentTimeSecond()-buyerOrder.getUpdateTime());
... ... @@ -147,12 +145,14 @@ public class BuyerOrderDetailService extends AbsOrderDetailService implements IO
@Override
protected void resetDynamicProporties(OrderDetailInfo orderDetailInfo) {
if (orderDetailInfo.getStatusDetail().getStatus() == OrderStatus.WAITING_PAY.getCode()){
int leftTime = calLeftTime(orderDetailInfo.getSecendLevelCreateTime());
Integer leftTime = getLeftTime(TabType.BUY, orderDetailInfo.getUid(), orderDetailInfo.getOrderCode(),
orderDetailInfo.getStatusDetail().getStatus(), orderDetailInfo.getSecendLevelCreateTime());
orderDetailInfo.getStatusDetail().setLeftTime(leftTime);
orderDetailInfo.setDeliverLeftTime(getDeliverLeftTime(orderDetailInfo.getUid(),
orderDetailInfo.getOrderCode(), orderDetailInfo.getStatusDetail().getStatus()));
}
}
}
... ...
... ... @@ -3,6 +3,7 @@ package com.yohoufo.order.service.impl;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
import com.yohobuy.ufo.model.order.common.OrderListType;
import com.yohoufo.common.helper.ImageUrlAssist;
... ... @@ -92,11 +93,9 @@ public class BuyerOrderListServiceImpl extends AbsOrderListService implements IO
protected void resetDynamicProporties(List<OrderListInfo> list) {
if(CollectionUtils.isNotEmpty(list)){
list.forEach(oli -> {
if (oli.getStatus() == OrderStatus.WAITING_PAY.getCode()){
oli.setLeftTime(calLeftTime(oli.getSecendLevelCreateTime()));
}
oli.setDeliverLeftTime(getDeliverLeftTime(oli.getUid(), oli.getOrderCode(), oli.getStatus()));
Integer leftTime = getLeftTime(TabType.BUY, oli.getUid(), oli.getOrderCode(), oli.getStatus(),
oli.getSecendLevelCreateTime());
oli.setLeftTime(leftTime);
});
}
}
... ...
... ... @@ -16,11 +16,11 @@ public class OrdersPayService {
@Autowired
private OrdersPayMapper ordersPayMapper;
public Long getDeliverLeftTime(int buyerUid, long orderCode){
public Integer getDeliverLeftTime(int buyerUid, long orderCode){
OrdersPay ordersPay = ordersPayMapper.selectOrdersPay(orderCode, buyerUid);
if (ordersPay == null){
return null;
}
return (long)DelayTime.MINUTES_36_HOURS * 60 - (DateUtil.getCurrentTimeSecond()-ordersPay.getCreateTime());
return DelayTime.MINUTES_36_HOURS * 60 - (DateUtil.getCurrentTimeSecond()-ordersPay.getCreateTime());
}
}
... ...
... ... @@ -285,11 +285,10 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
.paymentTips(skupStatus.getPaymentTips())
.build();
// 待付款时,剩余时间
if (skupStatus.getCode() == SkupStatus.CAN_NOT_SELL.getCode()){
int leftTime = calLeftTime(order.getCreateTime());
// 待付款时 或待发货,剩余时间
int leftTime = getPayLeftTime(TabType.SELL, skupStatus.getCode(), order.getCreateTime());
statusDetail.setLeftTime(leftTime);
}
return statusDetail;
}
... ... @@ -375,7 +374,10 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
.statuStr(orderStatus.getStatusStr(tabType))
.detailDesc(orderStatus.getDetailDesc(tabType))
.build();
Integer deliverLeftTime = getDeliverLeftTime(buyerOrder.getUid(), buyerOrder.getOrderCode(), buyerOrder.getStatus());
if (deliverLeftTime != null){
statusDetail.setLeftTime(deliverLeftTime);
}
if(sellerViewExpressStatus.contains(orderStatus.getCode())){
statusDetail.setExpressShow(true);
}
... ... @@ -384,16 +386,10 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
@Override
protected void resetDynamicProporties(OrderDetailInfo orderDetailInfo) {
if (orderDetailInfo.getStatusDetail().getStatus() == SkupStatus.CAN_NOT_SELL.getCode()){
int leftTime = calLeftTime(orderDetailInfo.getSecendLevelCreateTime());
Integer leftTime = getLeftTime(TabType.SELL, orderDetailInfo.getUid(), orderDetailInfo.getOrderCode(),
orderDetailInfo.getStatusDetail().getStatus(), orderDetailInfo.getSecendLevelCreateTime());
orderDetailInfo.getStatusDetail().setLeftTime(leftTime);
}
List<BuyerOrderGoods> bogList = buyerOrderGoodsMapper.selectBySkups(Arrays.asList(orderDetailInfo.getGoodsInfo().getSkup()));
if (CollectionUtils.isNotEmpty(bogList)){
//存在时说明已经有买家下单 当前状态来自于买家订单
BuyerOrderGoods bog = bogList.get(0);
int status = orderDetailInfo.getStatusDetail().getStatus();
orderDetailInfo.setDeliverLeftTime(getDeliverLeftTime(bog.getUid(), bog.getOrderCode(), status));
}
}
}
... ...
... ... @@ -142,7 +142,10 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
//存在时说明已经有买家下单 当前状态来自于买家订单
BuyerOrderGoods bog = bogList.get(0);
int status = oli.getStatus();
oli.setDeliverLeftTime(getDeliverLeftTime(bog.getUid(), bog.getOrderCode(), status));
Integer leftTime = getDeliverLeftTime(bog.getUid(), bog.getOrderCode(), status);
if (leftTime != null) {
oli.setLeftTime(leftTime);
}
}
});
... ...