Authored by chenchao

add goods head flag

@@ -10,6 +10,7 @@ import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo; @@ -10,6 +10,7 @@ import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;
10 import com.yohobuy.ufo.model.order.common.ButtonShow; 10 import com.yohobuy.ufo.model.order.common.ButtonShow;
11 import com.yohobuy.ufo.model.order.common.OrderStatus; 11 import com.yohobuy.ufo.model.order.common.OrderStatus;
12 import com.yohobuy.ufo.model.order.common.TabType; 12 import com.yohobuy.ufo.model.order.common.TabType;
  13 +import com.yohobuy.ufo.model.order.constants.SkupType;
13 import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail; 14 import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
14 import com.yohobuy.ufo.model.order.vo.AddressInfo; 15 import com.yohobuy.ufo.model.order.vo.AddressInfo;
15 import com.yohoufo.common.utils.DateUtil; 16 import com.yohoufo.common.utils.DateUtil;
@@ -26,6 +27,7 @@ import com.yohoufo.order.service.IExpressInfoService; @@ -26,6 +27,7 @@ import com.yohoufo.order.service.IExpressInfoService;
26 import com.yohoufo.order.service.IOrderDetailService; 27 import com.yohoufo.order.service.IOrderDetailService;
27 import com.yohoufo.order.utils.BuyerOrderUtils; 28 import com.yohoufo.order.utils.BuyerOrderUtils;
28 import com.yohoufo.order.utils.OrderAssist; 29 import com.yohoufo.order.utils.OrderAssist;
  30 +import com.yohoufo.order.utils.SellerGoodsHelper;
29 import com.yohoufo.order.utils.TimeUtils; 31 import com.yohoufo.order.utils.TimeUtils;
30 import lombok.experimental.Builder; 32 import lombok.experimental.Builder;
31 import org.slf4j.Logger; 33 import org.slf4j.Logger;
@@ -183,6 +185,8 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen @@ -183,6 +185,8 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
183 185
184 //good info 186 //good info
185 GoodsInfo goodsInfo = getGoodsInfo(sellerOrderGoods); 187 GoodsInfo goodsInfo = getGoodsInfo(sellerOrderGoods);
  188 + SkupType skupType = SkupType.getSkupType(sellerOrderGoods.getAttributes());
  189 + goodsInfo.setProductName(SellerGoodsHelper.addFlag2GoodsNameHead(goodsInfo.getProductName(), skupType));
186 if(isOffline) { 190 if(isOffline) {
187 goodsInfo.setProductName("【门店订单】" + goodsInfo.getProductName()); 191 goodsInfo.setProductName("【门店订单】" + goodsInfo.getProductName());
188 } 192 }
1 package com.yohoufo.order.service.impl; 1 package com.yohoufo.order.service.impl;
2 2
3 -import com.google.common.collect.Lists;  
4 import com.google.common.collect.Maps; 3 import com.google.common.collect.Maps;
5 import com.yoho.error.ServiceError; 4 import com.yoho.error.ServiceError;
6 import com.yoho.error.exception.ServiceException; 5 import com.yoho.error.exception.ServiceException;
@@ -17,7 +16,10 @@ import com.yohoufo.dal.order.BuyerOrderGoodsMapper; @@ -17,7 +16,10 @@ import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
17 import com.yohoufo.dal.order.BuyerOrderMapper; 16 import com.yohoufo.dal.order.BuyerOrderMapper;
18 import com.yohoufo.dal.order.SellerOrderGoodsMapper; 17 import com.yohoufo.dal.order.SellerOrderGoodsMapper;
19 import com.yohoufo.dal.order.SellerOrderMapper; 18 import com.yohoufo.dal.order.SellerOrderMapper;
20 -import com.yohoufo.dal.order.model.*; 19 +import com.yohoufo.dal.order.model.BuyerOrder;
  20 +import com.yohoufo.dal.order.model.BuyerOrderGoods;
  21 +import com.yohoufo.dal.order.model.SellerOrder;
  22 +import com.yohoufo.dal.order.model.SellerOrderGoods;
21 import com.yohoufo.order.constants.ViewType; 23 import com.yohoufo.order.constants.ViewType;
22 import com.yohoufo.order.model.request.OrderListRequest; 24 import com.yohoufo.order.model.request.OrderListRequest;
23 import com.yohoufo.order.service.IOrderListService; 25 import com.yohoufo.order.service.IOrderListService;
@@ -30,6 +32,7 @@ import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta; @@ -30,6 +32,7 @@ import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
30 import com.yohoufo.order.service.wrapper.SellerOrderTimeoutWrapper; 32 import com.yohoufo.order.service.wrapper.SellerOrderTimeoutWrapper;
31 import com.yohoufo.order.utils.LoggerUtils; 33 import com.yohoufo.order.utils.LoggerUtils;
32 import com.yohoufo.order.utils.OrderAssist; 34 import com.yohoufo.order.utils.OrderAssist;
  35 +import com.yohoufo.order.utils.SellerGoodsHelper;
33 import com.yohoufo.order.utils.TimeUtils; 36 import com.yohoufo.order.utils.TimeUtils;
34 import org.apache.commons.collections.CollectionUtils; 37 import org.apache.commons.collections.CollectionUtils;
35 import org.apache.commons.lang3.StringUtils; 38 import org.apache.commons.lang3.StringUtils;
@@ -300,9 +303,10 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde @@ -300,9 +303,10 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
300 orderListInfo.setEarnestMoney(sellerOrder.getEarnestMoney()); 303 orderListInfo.setEarnestMoney(sellerOrder.getEarnestMoney());
301 304
302 // 305 //
  306 +
303 GoodsInfo goodsInfo = new GoodsInfo(); 307 GoodsInfo goodsInfo = new GoodsInfo();
304 goodsInfo.setColorName(sellerOrderGoods.getColorName()); 308 goodsInfo.setColorName(sellerOrderGoods.getColorName());
305 - goodsInfo.setProductName(sellerOrderGoods.getProductName()); 309 + goodsInfo.setProductName(SellerGoodsHelper.addFlag2GoodsNameHead(sellerOrderGoods.getProductName(), skupType));
306 goodsInfo.setGoodImg(ImageUrlAssist.getAllProductPicUrl(sellerOrderGoods.getImageUrl(), "goodsimg", "center", "d2hpdGU=")); 310 goodsInfo.setGoodImg(ImageUrlAssist.getAllProductPicUrl(sellerOrderGoods.getImageUrl(), "goodsimg", "center", "d2hpdGU="));
307 goodsInfo.setSizeName(sellerOrderGoods.getSizeName()); 311 goodsInfo.setSizeName(sellerOrderGoods.getSizeName());
308 goodsInfo.setProductId(sellerOrderGoods.getProductId()); 312 goodsInfo.setProductId(sellerOrderGoods.getProductId());
@@ -344,41 +348,6 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde @@ -344,41 +348,6 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
344 } 348 }
345 349
346 350
347 -  
348 - OrderListInfo convertOrderInfo(SellerOrderInfo sellerOrderInfo, Map<Integer, Long> buyerOrderMap) {  
349 -  
350 - OrderListInfo orderListInfo = new OrderListInfo();  
351 - orderListInfo.setUid(sellerOrderInfo.getUid());  
352 - orderListInfo.setOrderCode(sellerOrderInfo.getOrderCode());  
353 - orderListInfo.setRealPrice(sellerOrderInfo.getGoodsPrice().toPlainString());  
354 -  
355 - // 订单中状态显示  
356 - SkupStatus skupStatus = SkupStatus.getSkupStatus(sellerOrderInfo.getStatus().intValue());  
357 - if (skupStatus != null){  
358 - orderListInfo.setStatus(skupStatus.getCode());  
359 - orderListInfo.setStatuStr(skupStatus.getDesc());  
360 - }  
361 -  
362 - orderListInfo.setSkup(sellerOrderInfo.getSkup());  
363 -  
364 - GoodsInfo goodsInfo = new GoodsInfo();  
365 - goodsInfo.setColorName(sellerOrderInfo.getColorName());  
366 - goodsInfo.setProductName(sellerOrderInfo.getProductName());  
367 - goodsInfo.setGoodImg(ImageUrlAssist.getAllProductPicUrl(sellerOrderInfo.getImageUrl(), "goodsimg", "center", "d2hpdGU="));  
368 - goodsInfo.setSizeName(sellerOrderInfo.getSizeName());  
369 - goodsInfo.setProductId(sellerOrderInfo.getProductId());  
370 - goodsInfo.setGoodPrice(sellerOrderInfo.getGoodsPrice().toPlainString());  
371 - orderListInfo.setGoodsInfo(goodsInfo);  
372 -  
373 - orderListInfo.setCreateTime(DateUtil.formatDate(sellerOrderInfo.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));  
374 -  
375 - // 查询skup的买家订单号  
376 - orderListInfo.setBuyerOrderCode(buyerOrderMap.get(sellerOrderInfo.getSkup()));  
377 -  
378 - return orderListInfo;  
379 - }  
380 -  
381 -  
382 @Override 351 @Override
383 protected List<Integer> initOrderListRequest(OrderListRequest request) { 352 protected List<Integer> initOrderListRequest(OrderListRequest request) {
384 if (request.getUid() < 0){ 353 if (request.getUid() < 0){
@@ -483,10 +483,11 @@ public class SkupListService { @@ -483,10 +483,11 @@ public class SkupListService {
483 // 按钮显示 483 // 按钮显示
484 List<ButtonShowBo> buttons = Arrays.asList(ButtonShow.STORAGE_MANAGE.getBo()); 484 List<ButtonShowBo> buttons = Arrays.asList(ButtonShow.STORAGE_MANAGE.getBo());
485 orderListInfo.setButtons(buttons == null ? new ArrayList<>(): new ArrayList<>(buttons)); 485 orderListInfo.setButtons(buttons == null ? new ArrayList<>(): new ArrayList<>(buttons));
  486 + SkupType skupType = SkupType.getSkupType(sellerOrderGoods.getAttributes());
486 // 487 //
487 GoodsInfo productInfo = new GoodsInfo(); 488 GoodsInfo productInfo = new GoodsInfo();
488 productInfo.setColorName(sellerOrderGoods.getColorName()); 489 productInfo.setColorName(sellerOrderGoods.getColorName());
489 - productInfo.setProductName(sellerOrderGoods.getProductName()); 490 + productInfo.setProductName(SellerGoodsHelper.addFlag2GoodsNameHead(sellerOrderGoods.getProductName(), skupType));
490 String imageUrl = ImageUrlAssist.getAllProductPicUrl(sellerOrderGoods.getImageUrl(), "goodsimg", "center", "d2hpdGU="); 491 String imageUrl = ImageUrlAssist.getAllProductPicUrl(sellerOrderGoods.getImageUrl(), "goodsimg", "center", "d2hpdGU=");
491 productInfo.setImageUrl(imageUrl); 492 productInfo.setImageUrl(imageUrl);
492 Integer productId; 493 Integer productId;
@@ -544,7 +545,7 @@ public class SkupListService { @@ -544,7 +545,7 @@ public class SkupListService {
544 productInfo.setSizeId(sellerOrderGoods.getSizeId()); 545 productInfo.setSizeId(sellerOrderGoods.getSizeId());
545 productInfo.setSizeName(sellerOrderGoods.getSizeName()); 546 productInfo.setSizeName(sellerOrderGoods.getSizeName());
546 productInfo.setColorName(sellerOrderGoods.getColorName()); 547 productInfo.setColorName(sellerOrderGoods.getColorName());
547 - productInfo.setProductName(sellerOrderGoods.getProductName()); 548 + productInfo.setProductName(SellerGoodsHelper.addFlag2GoodsNameHead(sellerOrderGoods.getProductName(), skupType));
548 String imageUrl = ImageUrlAssist.getAllProductPicUrl(sellerOrderGoods.getImageUrl(), "goodsimg", "center", "d2hpdGU="); 549 String imageUrl = ImageUrlAssist.getAllProductPicUrl(sellerOrderGoods.getImageUrl(), "goodsimg", "center", "d2hpdGU=");
549 productInfo.setGoodImg(imageUrl); 550 productInfo.setGoodImg(imageUrl);
550 Integer productId; 551 Integer productId;
1 package com.yohoufo.order.utils; 1 package com.yohoufo.order.utils;
2 2
3 import com.yohobuy.ufo.model.order.constants.SkupType; 3 import com.yohobuy.ufo.model.order.constants.SkupType;
  4 +import org.apache.commons.lang3.StringUtils;
4 5
5 import java.math.BigDecimal; 6 import java.math.BigDecimal;
6 import java.util.Objects; 7 import java.util.Objects;
@@ -18,4 +19,15 @@ public final class SellerGoodsHelper { @@ -18,4 +19,15 @@ public final class SellerGoodsHelper {
18 return skupType!=null 19 return skupType!=null
19 && (SkupType.FLAW.equals(skupType) || SkupType.SECOND_HAND.equals(skupType)); 20 && (SkupType.FLAW.equals(skupType) || SkupType.SECOND_HAND.equals(skupType));
20 } 21 }
  22 +
  23 +
  24 + public static String buildGoodsFlag(SkupType skupType){
  25 + String attrName = skupType.attrName();
  26 + return attrName == null ? null : String.format("【%s】",attrName);
  27 + }
  28 +
  29 + public static String addFlag2GoodsNameHead(String prdName, SkupType skupType){
  30 + String goodsFlag = buildGoodsFlag(skupType);
  31 + return StringUtils.isNoneBlank(goodsFlag)? goodsFlag+prdName: prdName;
  32 + }
21 } 33 }