|
|
package com.yoho.search.consumer.service.logic.productIndex;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.HashSet;
|
...
|
...
|
@@ -148,13 +149,23 @@ public class ProductSizesLogicService { |
|
|
return results.toString().replaceFirst(",", "");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 保留两位小数
|
|
|
*
|
|
|
* @param validStatusSizeCount
|
|
|
* @param hasStorageSizeCount
|
|
|
* @return
|
|
|
*/
|
|
|
private double getBreakSizePercent(Integer validStatusSizeCount, Integer hasStorageSizeCount) {
|
|
|
if (validStatusSizeCount == null || validStatusSizeCount<=0) {
|
|
|
if (validStatusSizeCount == null || validStatusSizeCount <= 0) {
|
|
|
return 100d;
|
|
|
}
|
|
|
if (hasStorageSizeCount == null || hasStorageSizeCount<=0) {
|
|
|
if (hasStorageSizeCount == null || hasStorageSizeCount <= 0) {
|
|
|
return 100d;
|
|
|
}
|
|
|
return 100d * (validStatusSizeCount - hasStorageSizeCount) / validStatusSizeCount;
|
|
|
double breakSizePercent = 100d * (validStatusSizeCount - hasStorageSizeCount) / validStatusSizeCount;
|
|
|
BigDecimal bg = new BigDecimal(breakSizePercent);
|
|
|
double result = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
return result;
|
|
|
}
|
|
|
} |
...
|
...
|
|