Authored by mali

香港直邮

package com.yoho.order.model;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
@ToString
@Data
public class SellerOrderGoods implements Serializable {
/**
... ... @@ -38,6 +43,10 @@ public class SellerOrderGoods implements Serializable {
private String imageUrl;
private Integer region;
public Integer getId() {
return id;
}
... ...
... ... @@ -16,11 +16,12 @@
<result column="status" property="status" jdbcType="TINYINT" />
<result column="image_id" property="imageId" jdbcType="INTEGER" />
<result column="image_url" property="imageUrl" jdbcType="VARCHAR" />
<result column="region" property="region" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
id, uid, product_id, product_name, storage_id, depot_no, size_id, size_name, color_id,
color_name, goods_price, status, image_id, image_url
color_name, goods_price, status, image_id, image_url, region
</sql>
<select id="selectByIds" resultMap="BaseResultMap">
... ...
... ... @@ -2,6 +2,7 @@ package com.yoho.ufo.order.constant;
import com.yoho.core.config.ConfigReader;
import com.yohobuy.ufo.model.order.common.OrderAttributes;
import com.yohobuy.ufo.model.order.constants.RegionEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -13,15 +14,26 @@ import java.util.Map;
*/
@Service
public class OrderConfigConstant {
private static Map<Integer, String> orderAttributeMap = new HashMap<>();
private static Map<Integer, Map<Integer, String>> orderRegionAttributeMap = new HashMap<>();
static {
Map<Integer, String> orderAttributeMap = new HashMap<>();
orderAttributeMap.put(OrderAttributes.ADVANCE_SALE.getCode(), "预售");
orderAttributeMap.put(OrderAttributes.OFFLINE.getCode(), "线下店");
orderAttributeMap.put(OrderAttributes.SECOND_HAND.getCode(), "二手");
orderAttributeMap.put(OrderAttributes.FLAW.getCode(), "全新瑕疵");
orderAttributeMap.put(OrderAttributes.COMMON_IN_STOCK.getCode(), "现货");
orderAttributeMap.put(OrderAttributes.QUICK_DELIVER.getCode(), "急速发货");
orderRegionAttributeMap.put(RegionEnum.MAINLAND.getCode(), orderAttributeMap);
Map<Integer, String> hkAttributeMap = new HashMap<>();
orderAttributeMap.put(OrderAttributes.COMMON_IN_STOCK.getCode(), "海外现货");
orderRegionAttributeMap.put(RegionEnum.HONGKONG.getCode(), hkAttributeMap);
}
@Autowired
... ... @@ -32,12 +44,11 @@ public class OrderConfigConstant {
return configReader.getBoolean("ufo.Vedio.Config", true);
}
public static Map<Integer, String> getOrderAttributeMap() {
return orderAttributeMap;
public static Map<Integer, Map<Integer, String>> getOrderAttributeMap() {
return orderRegionAttributeMap;
}
public static String getOrderAttributeStr(Integer attribute) {
String attributeStr = orderAttributeMap.get(attribute);
return null == attributeStr ? "" : attributeStr;
public static String getOrderAttributeStr(Integer attribute, int region) {
return orderRegionAttributeMap.get(region).get(attribute);
}
}
... ...
... ... @@ -15,6 +15,7 @@ import java.util.stream.Collectors;
import javax.annotation.Resource;
import com.yohobuy.ufo.model.order.constants.RegionEnum;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.common.collect.Lists;
... ... @@ -1749,7 +1750,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
resp.setStatusStr(Constant.convertOrderStatusStr(buyerOrder.getStatus()));
resp.setCreateTimeStr(DateUtil.int2DateStr(buyerOrder.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
resp.setAttributes(buyerOrder.getAttributes());
resp.setAttributesStr(OrderConfigConstant.getOrderAttributeStr(buyerOrder.getAttributes()));
//检查买家是否是线下店的用户
resp.setInnerBuyerType("0");
... ... @@ -1808,6 +1809,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
queryProductLimitInfo(resp, sellerGoods.getProductId(), buyerOrder.getSellerUid()); // 独家标识
resp.setAttributesStr(OrderConfigConstant.getOrderAttributeStr(buyerOrder.getAttributes(), sellerGoods.getRegion()));
return resp;
}
... ... @@ -2556,7 +2559,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
resp.setStatusStr(Constant.convertOrderStatusStr(item.getStatus()));
resp.setChannel(Objects.equals(item.getAttributes(), 2) ? 2 : 1); //1,线上订单; 2,门店订单
resp.setProductNum(1);//目前固定为1
resp.setAttributesStr(OrderConfigConstant.getOrderAttributeStr(item.getAttributes()));
resp.setActivityType(item.getActivityType());
if(null==sellerGoodsMap.get(skup)){
LOGGER.warn("convertToResp not correct data,sellerGoodsMap get sku p {} is empty ,buyer order {}",skup,item);
... ... @@ -2566,6 +2569,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
resp.setProductName(sellerGoodsMap.get(skup).getProductName());
resp.setColorName(sellerGoodsMap.get(skup).getColorName());
resp.setSizeName(sellerGoodsMap.get(skup).getSizeName());
resp.setAttributesStr(OrderConfigConstant.getOrderAttributeStr(item.getAttributes(), sellerGoodsMap.get(skup).getRegion()));
}
resp.setSkup(skup);
... ... @@ -2687,8 +2692,10 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
resp.setGoodsPrice(String.format("%.2f", buyerGoodsMap.get(item.getOrderCode()).getGoodsPrice().doubleValue()));
resp.setStatusStr(Constant.convertOrderStatusStr(item.getStatus()));
resp.setStatus(item.getStatus());
resp.setRegion(sellerGoodsMap.get(skup).getRegion());
resp.setAttributes(item.getAttributes());
resp.setAttributesStr(OrderConfigConstant.getOrderAttributeStr(item.getAttributes()));
resp.setAttributesStr(OrderConfigConstant.getOrderAttributeStr(item.getAttributes(), sellerGoodsMap.get(skup).getRegion()));
respList.add(resp);
}
... ...