Authored by chenchao

optimized code

@@ -162,13 +162,7 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen @@ -162,13 +162,7 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
162 .build(); 162 .build();
163 orderDetailInfo.setPriceInfo(priceInfo); 163 orderDetailInfo.setPriceInfo(priceInfo);
164 // 支付状态 164 // 支付状态
165 - if (buyerOrder.getPayment() != null){  
166 - Payment payment = Payment.getPayment(buyerOrder.getPayment());  
167 - if (payment != null){  
168 - orderDetailInfo.setPaymentStr(payment.getDesc());  
169 - orderDetailInfo.setPayment(buyerOrder.getPayment());  
170 - }  
171 - } 165 + setPayment(orderDetailInfo, buyerOrder.getPayment());
172 orderDetailInfo.setCreateTime(DateUtil.formatDate(buyerOrder.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS)); 166 orderDetailInfo.setCreateTime(DateUtil.formatDate(buyerOrder.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
173 orderDetailInfo.setSecendLevelCreateTime(buyerOrder.getCreateTime()); 167 orderDetailInfo.setSecendLevelCreateTime(buyerOrder.getCreateTime());
174 // 需要查询 时间点 and 物流定位 168 // 需要查询 时间点 and 物流定位
@@ -6,6 +6,8 @@ import com.yohobuy.ufo.model.order.common.OrderStatus; @@ -6,6 +6,8 @@ import com.yohobuy.ufo.model.order.common.OrderStatus;
6 import com.yohobuy.ufo.model.order.common.SkupStatus; 6 import com.yohobuy.ufo.model.order.common.SkupStatus;
7 import com.yohobuy.ufo.model.order.common.TabType; 7 import com.yohobuy.ufo.model.order.common.TabType;
8 import com.yohoufo.common.utils.DateUtil; 8 import com.yohoufo.common.utils.DateUtil;
  9 +import com.yohoufo.order.common.Payment;
  10 +import com.yohoufo.order.model.response.OrderDetailInfo;
9 import org.apache.commons.collections.CollectionUtils; 11 import org.apache.commons.collections.CollectionUtils;
10 import org.slf4j.helpers.MessageFormatter; 12 import org.slf4j.helpers.MessageFormatter;
11 import org.springframework.beans.factory.annotation.Autowired; 13 import org.springframework.beans.factory.annotation.Autowired;
@@ -114,4 +116,14 @@ public abstract class AbsOrderViewService { @@ -114,4 +116,14 @@ public abstract class AbsOrderViewService {
114 protected int calLeftTime(int creatTime){ 116 protected int calLeftTime(int creatTime){
115 return OrderInfo.PAY_TIME_SECOND - (DateUtil.getCurrentTimeSecond() - creatTime); 117 return OrderInfo.PAY_TIME_SECOND - (DateUtil.getCurrentTimeSecond() - creatTime);
116 } 118 }
  119 +
  120 + protected void setPayment(OrderDetailInfo orderDetailInfo, Integer paymentCode){
  121 + if (paymentCode != null){
  122 + Payment payment = Payment.getPayment(paymentCode);
  123 + if (payment != null){
  124 + orderDetailInfo.setPaymentStr(payment.getDesc());
  125 + orderDetailInfo.setPayment(paymentCode);
  126 + }
  127 + }
  128 + }
117 } 129 }
@@ -7,6 +7,7 @@ import com.yohobuy.ufo.model.order.common.SkupStatus; @@ -7,6 +7,7 @@ import com.yohobuy.ufo.model.order.common.SkupStatus;
7 import com.yohoufo.order.common.Payment; 7 import com.yohoufo.order.common.Payment;
8 import com.yohoufo.order.service.proxy.ProductProxyService; 8 import com.yohoufo.order.service.proxy.ProductProxyService;
9 import com.yohoufo.product.response.StorageDataResp; 9 import com.yohoufo.product.response.StorageDataResp;
  10 +import org.slf4j.Logger;
10 11
11 import java.util.Arrays; 12 import java.util.Arrays;
12 import java.util.List; 13 import java.util.List;
@@ -15,6 +16,7 @@ import java.util.List; @@ -15,6 +16,7 @@ import java.util.List;
15 * Created by chao.chen on 2018/11/26. 16 * Created by chao.chen on 2018/11/26.
16 */ 17 */
17 public interface AbsSellerOrderViewService { 18 public interface AbsSellerOrderViewService {
  19 + Logger getLogger();
18 enum ViewType{ 20 enum ViewType{
19 DETAIL, LIST 21 DETAIL, LIST
20 } 22 }
@@ -69,6 +71,7 @@ public interface AbsSellerOrderViewService { @@ -69,6 +71,7 @@ public interface AbsSellerOrderViewService {
69 prdPrice.setLeastPrice(storage.getLeastPrice()); 71 prdPrice.setLeastPrice(storage.getLeastPrice());
70 }catch (Exception ex){ 72 }catch (Exception ex){
71 prdPrice = new ProductProxyService.PrdPrice(); 73 prdPrice = new ProductProxyService.PrdPrice();
  74 + getLogger().warn("in getPrdPrice fail, storageId {}", storageId);
72 } 75 }
73 76
74 return prdPrice; 77 return prdPrice;
@@ -10,11 +10,11 @@ import com.yohobuy.ufo.model.order.constants.OrderConstant; @@ -10,11 +10,11 @@ import com.yohobuy.ufo.model.order.constants.OrderConstant;
10 import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail; 10 import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
11 import com.yohobuy.ufo.model.order.resp.ExpressInfoRespBo; 11 import com.yohobuy.ufo.model.order.resp.ExpressInfoRespBo;
12 import com.yohoufo.common.constant.ExpressInfoConstant; 12 import com.yohoufo.common.constant.ExpressInfoConstant;
13 -import com.yohoufo.common.helper.ImageUrlAssist;  
14 import com.yohoufo.common.utils.DateUtil; 13 import com.yohoufo.common.utils.DateUtil;
15 import com.yohoufo.dal.order.*; 14 import com.yohoufo.dal.order.*;
16 import com.yohoufo.dal.order.model.*; 15 import com.yohoufo.dal.order.model.*;
17 -import com.yohoufo.order.common.*; 16 +import com.yohoufo.order.common.ActionStatusHold;
  17 +import com.yohoufo.order.common.Payment;
18 import com.yohoufo.order.constants.MetaKey; 18 import com.yohoufo.order.constants.MetaKey;
19 import com.yohoufo.order.convert.GoodsInfoConvertor; 19 import com.yohoufo.order.convert.GoodsInfoConvertor;
20 import com.yohoufo.order.convert.SellerOrderConvertor; 20 import com.yohoufo.order.convert.SellerOrderConvertor;
@@ -30,12 +30,9 @@ import com.yohoufo.order.service.proxy.ProductProxyService; @@ -30,12 +30,9 @@ import com.yohoufo.order.service.proxy.ProductProxyService;
30 import com.yohoufo.order.service.proxy.UserProxyService; 30 import com.yohoufo.order.service.proxy.UserProxyService;
31 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; 31 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
32 import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta; 32 import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
33 -  
34 import com.yohoufo.order.utils.LoggerUtils; 33 import com.yohoufo.order.utils.LoggerUtils;
35 -import org.apache.commons.collections.CollectionUtils;  
36 import org.apache.commons.lang3.StringUtils; 34 import org.apache.commons.lang3.StringUtils;
37 import org.slf4j.Logger; 35 import org.slf4j.Logger;
38 -import org.slf4j.LoggerFactory;  
39 import org.springframework.beans.factory.annotation.Autowired; 36 import org.springframework.beans.factory.annotation.Autowired;
40 import org.springframework.stereotype.Service; 37 import org.springframework.stereotype.Service;
41 38
@@ -95,8 +92,6 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -95,8 +92,6 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
95 private static final List<Long> SELLER_TYPES = Arrays.asList(OrderCodeType.SELLER_TYPE.getType()); 92 private static final List<Long> SELLER_TYPES = Arrays.asList(OrderCodeType.SELLER_TYPE.getType());
96 93
97 94
98 -  
99 -  
100 @Override 95 @Override
101 public OrderDetailInfo getOrderDetail(OrderRequest orderRequest) { 96 public OrderDetailInfo getOrderDetail(OrderRequest orderRequest) {
102 int uid; 97 int uid;
@@ -361,13 +356,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -361,13 +356,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
361 orderDetailInfo.setGoodsInfo(goodsInfo); 356 orderDetailInfo.setGoodsInfo(goodsInfo);
362 357
363 // 支付状态 358 // 支付状态
364 - if (order.getPayment() != null){  
365 - Payment payment = Payment.getPayment(order.getPayment());  
366 - if (payment != null){  
367 - orderDetailInfo.setPaymentStr(payment.getDesc());  
368 - orderDetailInfo.setPayment(order.getPayment());  
369 - }  
370 - } 359 + setPayment(orderDetailInfo, order.getPayment());
371 // 360 //
372 orderDetailInfo.setIsPaid(getIsPaid(skupStatus)); 361 orderDetailInfo.setIsPaid(getIsPaid(skupStatus));
373 orderDetailInfo.setSecendLevelCreateTime(order.getCreateTime()); 362 orderDetailInfo.setSecendLevelCreateTime(order.getCreateTime());
@@ -412,6 +401,11 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -412,6 +401,11 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
412 } 401 }
413 402
414 @Override 403 @Override
  404 + public Logger getLogger() {
  405 + return logger;
  406 + }
  407 +
  408 + @Override
415 public ProductProxyService getProductProxyService() { 409 public ProductProxyService getProductProxyService() {
416 return productProxyService; 410 return productProxyService;
417 } 411 }
@@ -28,6 +28,7 @@ import com.yohoufo.order.service.proxy.UserProxyService; @@ -28,6 +28,7 @@ import com.yohoufo.order.service.proxy.UserProxyService;
28 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; 28 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
29 import lombok.extern.slf4j.Slf4j; 29 import lombok.extern.slf4j.Slf4j;
30 import org.apache.commons.collections.CollectionUtils; 30 import org.apache.commons.collections.CollectionUtils;
  31 +import org.slf4j.Logger;
31 import org.springframework.beans.factory.annotation.Autowired; 32 import org.springframework.beans.factory.annotation.Autowired;
32 import org.springframework.stereotype.Service; 33 import org.springframework.stereotype.Service;
33 34
@@ -299,6 +300,11 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde @@ -299,6 +300,11 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
299 } 300 }
300 301
301 @Override 302 @Override
  303 + public Logger getLogger() {
  304 + return log;
  305 + }
  306 +
  307 + @Override
302 public ProductProxyService getProductProxyService() { 308 public ProductProxyService getProductProxyService() {
303 return productProxyService; 309 return productProxyService;
304 } 310 }