Authored by chenchao

optimized code

... ... @@ -162,13 +162,7 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
.build();
orderDetailInfo.setPriceInfo(priceInfo);
// 支付状态
if (buyerOrder.getPayment() != null){
Payment payment = Payment.getPayment(buyerOrder.getPayment());
if (payment != null){
orderDetailInfo.setPaymentStr(payment.getDesc());
orderDetailInfo.setPayment(buyerOrder.getPayment());
}
}
setPayment(orderDetailInfo, buyerOrder.getPayment());
orderDetailInfo.setCreateTime(DateUtil.formatDate(buyerOrder.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
orderDetailInfo.setSecendLevelCreateTime(buyerOrder.getCreateTime());
// 需要查询 时间点 and 物流定位
... ...
... ... @@ -6,6 +6,8 @@ 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 com.yohoufo.order.common.Payment;
import com.yohoufo.order.model.response.OrderDetailInfo;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.helpers.MessageFormatter;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -114,4 +116,14 @@ public abstract class AbsOrderViewService {
protected int calLeftTime(int creatTime){
return OrderInfo.PAY_TIME_SECOND - (DateUtil.getCurrentTimeSecond() - creatTime);
}
protected void setPayment(OrderDetailInfo orderDetailInfo, Integer paymentCode){
if (paymentCode != null){
Payment payment = Payment.getPayment(paymentCode);
if (payment != null){
orderDetailInfo.setPaymentStr(payment.getDesc());
orderDetailInfo.setPayment(paymentCode);
}
}
}
}
... ...
... ... @@ -7,6 +7,7 @@ import com.yohobuy.ufo.model.order.common.SkupStatus;
import com.yohoufo.order.common.Payment;
import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.product.response.StorageDataResp;
import org.slf4j.Logger;
import java.util.Arrays;
import java.util.List;
... ... @@ -15,6 +16,7 @@ import java.util.List;
* Created by chao.chen on 2018/11/26.
*/
public interface AbsSellerOrderViewService {
Logger getLogger();
enum ViewType{
DETAIL, LIST
}
... ... @@ -69,6 +71,7 @@ public interface AbsSellerOrderViewService {
prdPrice.setLeastPrice(storage.getLeastPrice());
}catch (Exception ex){
prdPrice = new ProductProxyService.PrdPrice();
getLogger().warn("in getPrdPrice fail, storageId {}", storageId);
}
return prdPrice;
... ...
... ... @@ -10,11 +10,11 @@ import com.yohobuy.ufo.model.order.constants.OrderConstant;
import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
import com.yohobuy.ufo.model.order.resp.ExpressInfoRespBo;
import com.yohoufo.common.constant.ExpressInfoConstant;
import com.yohoufo.common.helper.ImageUrlAssist;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.*;
import com.yohoufo.dal.order.model.*;
import com.yohoufo.order.common.*;
import com.yohoufo.order.common.ActionStatusHold;
import com.yohoufo.order.common.Payment;
import com.yohoufo.order.constants.MetaKey;
import com.yohoufo.order.convert.GoodsInfoConvertor;
import com.yohoufo.order.convert.SellerOrderConvertor;
... ... @@ -30,12 +30,9 @@ import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.order.service.proxy.UserProxyService;
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
import com.yohoufo.order.utils.LoggerUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -95,8 +92,6 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
private static final List<Long> SELLER_TYPES = Arrays.asList(OrderCodeType.SELLER_TYPE.getType());
@Override
public OrderDetailInfo getOrderDetail(OrderRequest orderRequest) {
int uid;
... ... @@ -361,13 +356,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
orderDetailInfo.setGoodsInfo(goodsInfo);
// 支付状态
if (order.getPayment() != null){
Payment payment = Payment.getPayment(order.getPayment());
if (payment != null){
orderDetailInfo.setPaymentStr(payment.getDesc());
orderDetailInfo.setPayment(order.getPayment());
}
}
setPayment(orderDetailInfo, order.getPayment());
//
orderDetailInfo.setIsPaid(getIsPaid(skupStatus));
orderDetailInfo.setSecendLevelCreateTime(order.getCreateTime());
... ... @@ -412,6 +401,11 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
}
@Override
public Logger getLogger() {
return logger;
}
@Override
public ProductProxyService getProductProxyService() {
return productProxyService;
}
... ...
... ... @@ -28,6 +28,7 @@ import com.yohoufo.order.service.proxy.UserProxyService;
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -299,6 +300,11 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
}
@Override
public Logger getLogger() {
return log;
}
@Override
public ProductProxyService getProductProxyService() {
return productProxyService;
}
... ...