...
|
...
|
@@ -204,9 +204,11 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService, |
|
|
List<Product> productList = productMapper.selectProductListByIds(productIdList);
|
|
|
Map<Integer, BigDecimal> productIdMinPriceMap = productList.stream().collect(Collectors.toMap(Product::getId, Product::getMinPrice));
|
|
|
List<Integer> abnormalIdList = Lists.newArrayList();
|
|
|
List<Integer> normalIdList = Lists.newArrayList();
|
|
|
List<Storage> storageList = Lists.newArrayList();
|
|
|
for(ChannelSkuCompare csc : cscList) {
|
|
|
if(csc.getChannelPrice().compareTo(productIdMinPriceMap.get(csc.getProductId())) < 0) {//毒价小于平台最低价为异常
|
|
|
if((null != productIdMinPriceMap.get(csc.getProductId()) && csc.getChannelPrice().compareTo(productIdMinPriceMap.get(csc.getProductId()))< 0)
|
|
|
|| (csc.getChannelAveragePrice().compareTo(BigDecimal.valueOf(0)) != 0 && csc.getChannelPrice().compareTo(csc.getChannelAveragePrice()) < 0)) {//毒价小于平台最低价或毒价小于毒前24小时平均价为异常
|
|
|
abnormalIdList.add(csc.getId());
|
|
|
continue;
|
|
|
}
|
...
|
...
|
@@ -217,14 +219,18 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService, |
|
|
BigDecimal suggestHighPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).add(csc.getHighRate())).setScale(0, BigDecimal.ROUND_DOWN);
|
|
|
storage.setSuggestLowPrice(suggestLowPrice);
|
|
|
storage.setSuggestHighPrice(suggestHighPrice);
|
|
|
normalIdList.add(csc.getId());
|
|
|
storageList.add(storage);
|
|
|
}
|
|
|
|
|
|
//更新异常数据状态
|
|
|
channelSkuCompareMapper.updateStatusByIds(abnormalIdList, CHANNEL_SKU_COMPARE_ABNORMAL, 0);//uid=0表示系统操作
|
|
|
if(CollectionUtils.isNotEmpty(abnormalIdList)) {
|
|
|
channelSkuCompareMapper.updateStatusByIds(abnormalIdList, CHANNEL_SKU_COMPARE_ABNORMAL, 0);//uid=0表示系统操作
|
|
|
}
|
|
|
|
|
|
//更新正常数据的建议价到storage表
|
|
|
if(CollectionUtils.isEmpty(storageList)){
|
|
|
if(CollectionUtils.isNotEmpty(storageList)){
|
|
|
channelSkuCompareMapper.updateStatusByIds(normalIdList, CHANNEL_SKU_COMPARE_NORMAL, 0);//uid=0表示系统操作
|
|
|
storageMapper.updateBatchSuggestPrice(storageList);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -280,6 +286,7 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService, |
|
|
bo.setUfoCurrentPrice(getFormatPrice(storageMinPriceMap.get(csc.getSku())));
|
|
|
BigDecimal ufoMinPrice = null == productMap.get(csc.getProductId()) ? null : productMap.get(csc.getProductId()).getMinPrice();
|
|
|
bo.setUfoMinPrice(getFormatPrice(ufoMinPrice));
|
|
|
bo.setChannelAveragePrice(null == csc.getChannelAveragePrice() ? "" : getIntFormatPrice(csc.getChannelAveragePrice()));
|
|
|
//毒当前价低于UFO价格红线则为异常,那么显示上回的建议价
|
|
|
BigDecimal suggestLowPrice = null == storageMap.get(csc.getSku()) ? null : storageMap.get(csc.getSku()).getSuggestLowPrice();
|
|
|
BigDecimal suggestHighPrice = null == storageMap.get(csc.getSku()) ? null : storageMap.get(csc.getSku()).getSuggestHighPrice();
|
...
|
...
|
|