...
|
...
|
@@ -11,12 +11,8 @@ import com.yohoufo.dal.order.SellerOrderGoodsMapper; |
|
|
import com.yohoufo.dal.order.model.BuyerOrder;
|
|
|
import com.yohoufo.dal.order.model.BuyerOrderGoods;
|
|
|
import com.yohoufo.dal.order.model.SellerOrderGoods;
|
|
|
import com.yohoufo.dal.product.BrandMapper;
|
|
|
import com.yohoufo.dal.product.ProductMapper;
|
|
|
import com.yohoufo.dal.product.ProductSortMapper;
|
|
|
import com.yohoufo.dal.product.model.Brand;
|
|
|
import com.yohoufo.dal.product.model.Product;
|
|
|
import com.yohoufo.dal.product.model.ProductSort;
|
|
|
import com.yohoufo.dal.product.*;
|
|
|
import com.yohoufo.dal.product.model.*;
|
|
|
import com.yohoufo.order.constants.MetaKey;
|
|
|
import com.yohoufo.order.model.bo.BuyerRefundOrder;
|
|
|
import com.yohoufo.order.service.support.BuyerOrderMetaMapperSupport;
|
...
|
...
|
@@ -43,6 +39,8 @@ public class BuyerRefundOrderBuilder { |
|
|
@Autowired
|
|
|
private ProductMapper productMapper;
|
|
|
@Autowired
|
|
|
private ProductColorMapper productColorMapper;
|
|
|
@Autowired
|
|
|
private ProductSortMapper productSortMapper;
|
|
|
@Autowired
|
|
|
private BrandMapper brandMapper;
|
...
|
...
|
@@ -62,6 +60,8 @@ public class BuyerRefundOrderBuilder { |
|
|
throwServiceExceptionIf(Objects.isNull(sellerOrderGoods), "卖家订单商品不存在");
|
|
|
Product product = productMapper.selectByPrimaryKey(sellerOrderGoods.getProductId());
|
|
|
throwServiceExceptionIf(Objects.isNull(sellerOrderGoods), "商品不存在");
|
|
|
ProductColor productColor = productColorMapper.selectByPrimaryKey(sellerOrderGoods.getColorId());
|
|
|
throwServiceExceptionIf(Objects.isNull(sellerOrderGoods), "商品颜色不存在");
|
|
|
List<Integer> sortIds = new ArrayList<>();
|
|
|
CollectionUtils.addIgnoreNull(sortIds, product.getMaxSortId());
|
|
|
CollectionUtils.addIgnoreNull(sortIds, product.getMidSortId());
|
...
|
...
|
@@ -69,13 +69,14 @@ public class BuyerRefundOrderBuilder { |
|
|
: productSortMapper.selectByIds(sortIds).stream()
|
|
|
.collect(Collectors.toMap(ProductSort::getId, ProductSort::getSortName, (a, b) -> a));
|
|
|
Brand brand = Optional.ofNullable(product.getBrandId()).map(brandMapper::selectByPrimaryKey).orElse(null);
|
|
|
return build(buyerOrder, sellerOrderGoods, buyerAddress, product, sort, brand);
|
|
|
return build(buyerOrder, sellerOrderGoods, buyerAddress, product, productColor, sort, brand);
|
|
|
}
|
|
|
|
|
|
private BuyerRefundOrder build(BuyerOrder buyerOrder,
|
|
|
SellerOrderGoods sellerOrderGoods,
|
|
|
AddressInfo buyerAddress,
|
|
|
Product product,
|
|
|
ProductColor productColor,
|
|
|
Map<Integer, String> sort,
|
|
|
Brand brand) {
|
|
|
BuyerRefundOrder refund = new BuyerRefundOrder();
|
...
|
...
|
@@ -97,6 +98,8 @@ public class BuyerRefundOrderBuilder { |
|
|
refund.setGenderName(getGenderName(product.getGender()));
|
|
|
refund.setSaleTime(product.getSaleTime());
|
|
|
refund.setOfferPrice(product.getOfferPrice());
|
|
|
// copy from product color
|
|
|
refund.setColorSystemName(productColor.getColorName());
|
|
|
// copy from product sort
|
|
|
refund.setSortName(Joiner.on("|").skipNulls()
|
|
|
.join(sort.get(product.getMaxSortId()), sort.get(product.getMidSortId())));
|
...
|
...
|
|