...
|
...
|
@@ -264,10 +264,10 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService, |
|
|
|
|
|
Storage storage = new Storage();
|
|
|
storage.setId(csc.getSku());
|
|
|
BigDecimal suggestLowPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).subtract(csc.getLowRate())).setScale(0, BigDecimal.ROUND_DOWN);;
|
|
|
BigDecimal suggestLowPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).subtract(csc.getLowRate())).setScale(0, BigDecimal.ROUND_DOWN);
|
|
|
BigDecimal suggestHighPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).add(csc.getHighRate())).setScale(0, BigDecimal.ROUND_DOWN);
|
|
|
storage.setSuggestLowPrice(suggestLowPrice);
|
|
|
storage.setSuggestHighPrice(suggestHighPrice);
|
|
|
storage.setSuggestLowPrice(changeToNineEnd(suggestLowPrice, 1));
|
|
|
storage.setSuggestHighPrice(changeToNineEnd(suggestHighPrice, 2));
|
|
|
normalIdList.add(csc.getId());
|
|
|
storageList.add(storage);
|
|
|
}
|
...
|
...
|
@@ -282,6 +282,32 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService, |
|
|
channelSkuCompareMapper.updateStatusByIds(normalIdList, CHANNEL_SKU_COMPARE_NORMAL, 0);//uid=0表示系统操作
|
|
|
storageMapper.updateBatchSuggestPrice(storageList);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @param old
|
|
|
* @param type 1:low 2:high
|
|
|
* @return
|
|
|
*/
|
|
|
private static BigDecimal changeToNineEnd(BigDecimal old, int type) {
|
|
|
String oldStr = old.toString();
|
|
|
if(oldStr.endsWith("9")) {
|
|
|
return old;
|
|
|
}
|
|
|
|
|
|
String newStr = oldStr.substring(0, oldStr.length()-1) + "9";
|
|
|
BigDecimal result = BigDecimal.valueOf(0);
|
|
|
if(type == 1) {//low
|
|
|
result = new BigDecimal(newStr).subtract(BigDecimal.valueOf(10));
|
|
|
if(result.compareTo(BigDecimal.valueOf(0)) < 0) {
|
|
|
return old;
|
|
|
}
|
|
|
}else if(type == 2) {//high
|
|
|
result = new BigDecimal(newStr);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
...
|
...
|
|