...
|
...
|
@@ -18,10 +18,12 @@ import com.alibaba.fastjson.JSONObject; |
|
|
import com.yoho.core.common.utils.DateUtil;
|
|
|
import com.yoho.error.exception.ServiceException;
|
|
|
import com.yoho.ufo.dal.ChannelSkuCompareMapper;
|
|
|
import com.yoho.ufo.dal.GoodsMapper;
|
|
|
import com.yoho.ufo.dal.ProductMapper;
|
|
|
import com.yoho.ufo.dal.StorageMapper;
|
|
|
import com.yoho.ufo.dal.StoragePriceMapper;
|
|
|
import com.yoho.ufo.dal.UfoSizeMapper;
|
|
|
import com.yoho.ufo.dal.model.Goods;
|
|
|
import com.yoho.ufo.dal.model.Product;
|
|
|
import com.yoho.ufo.dal.model.Storage;
|
|
|
import com.yoho.ufo.dal.model.StoragePrice;
|
...
|
...
|
@@ -32,6 +34,9 @@ import com.yoho.ufo.model.commoditybasicrole.size.Size; |
|
|
import com.yoho.ufo.service.IBusinessExportService;
|
|
|
import com.yoho.ufo.service.IChannelSkuCompareService;
|
|
|
import com.yoho.ufo.service.model.PageResponseBO;
|
|
|
import com.yoho.ufo.util.CollectionUtil;
|
|
|
import com.yoho.ufo.util.ImagesConstant;
|
|
|
import com.yoho.ufo.util.ImagesHelper;
|
|
|
|
|
|
/**
|
|
|
* @author caoyan
|
...
|
...
|
@@ -55,6 +60,9 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService, |
|
|
|
|
|
@Autowired
|
|
|
private StoragePriceMapper storagePriceMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private GoodsMapper goodsMapper;
|
|
|
|
|
|
@Override
|
|
|
public PageResponseBO<ChannelSkuCompareRspBo> queryList(ChannelSkuCompareReq req) {
|
...
|
...
|
@@ -90,11 +98,16 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService, |
|
|
List<Storage> storageList = storageMapper.selectByIds(skuList);
|
|
|
Map<Integer, Storage> storageMap = storageList.stream().collect(Collectors.toMap(Storage::getId, s->s));
|
|
|
|
|
|
//查询商品图片
|
|
|
List<Integer> goodsIdList = CollectionUtil.map(storageList, Storage::getGoodsId);
|
|
|
List<Goods> goodsList = goodsMapper.selectByIds(goodsIdList);
|
|
|
Map<Integer, String> goodsIdImageMap = goodsList.stream().collect(Collectors.toMap(Goods::getId, Goods::getColorImage));
|
|
|
|
|
|
//计算UFO当前价,可售sku最低价
|
|
|
List<StoragePrice> storagePriceList = storagePriceMapper.selectMinPriceByStorageIdList(skuList);
|
|
|
Map<Integer, BigDecimal> storageMinPriceMap = storagePriceList.stream().collect(Collectors.toMap(StoragePrice::getStorageId, StoragePrice::getPrice));
|
|
|
|
|
|
List<ChannelSkuCompareRspBo> respList = convertToResp(cscList, productMap, sizeIdNameMap, storageMap, storageMinPriceMap);
|
|
|
List<ChannelSkuCompareRspBo> respList = convertToResp(cscList, productMap, sizeIdNameMap, storageMap, storageMinPriceMap, goodsIdImageMap);
|
|
|
|
|
|
PageResponseBO<ChannelSkuCompareRspBo> result=new PageResponseBO<>();
|
|
|
result.setList(respList);
|
...
|
...
|
@@ -183,7 +196,8 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService, |
|
|
|
|
|
|
|
|
private List<ChannelSkuCompareRspBo> convertToResp(List<ChannelSkuCompare> cscList, Map<Integer, Product> productMap,
|
|
|
Map<Integer, String> sizeIdNameMap, Map<Integer, Storage> storageMap, Map<Integer, BigDecimal> storageMinPriceMap){
|
|
|
Map<Integer, String> sizeIdNameMap, Map<Integer, Storage> storageMap, Map<Integer, BigDecimal> storageMinPriceMap,
|
|
|
Map<Integer, String> goodsIdImageMap){
|
|
|
List<ChannelSkuCompareRspBo> boList = Lists.newArrayList();
|
|
|
for(ChannelSkuCompare csc : cscList) {
|
|
|
ChannelSkuCompareRspBo bo = new ChannelSkuCompareRspBo();
|
...
|
...
|
@@ -210,6 +224,8 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService, |
|
|
}
|
|
|
bo.setStatus(csc.getStatus());
|
|
|
bo.setStatusStr(bo.getStatus().intValue()==0 ? "正常" : "异常");
|
|
|
String imageUrl = goodsIdImageMap.get(storageMap.get(csc.getSku()).getGoodsId());
|
|
|
bo.setImageUrl(ImagesHelper.getImageAbsoluteUrl(imageUrl, ImagesConstant.BUCKET_GOODS_IMG));
|
|
|
boList.add(bo);
|
|
|
}
|
|
|
|
...
|
...
|
|