...
|
...
|
@@ -5,6 +5,7 @@ import com.yoho.search.recall.beans.strategy.SortBrandType; |
|
|
import com.yoho.search.recall.beans.strategy.StrategyEnum;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import sun.applet.Main;
|
|
|
|
|
|
@Service
|
|
|
public class RecallConfigService {
|
...
|
...
|
@@ -13,7 +14,7 @@ public class RecallConfigService { |
|
|
@Autowired
|
|
|
private RecallConfigServiceCommon recallConfigServiceCommon;
|
|
|
|
|
|
private int legallValue(int value, int min, int max) {
|
|
|
private static int legallValue(int value, int min, int max) {
|
|
|
value = Math.min(value, max);
|
|
|
value = Math.max(value, min);
|
|
|
return value;
|
...
|
...
|
@@ -106,7 +107,17 @@ public class RecallConfigService { |
|
|
*/
|
|
|
public RecallSknCount queryRecallSknCount(int pageId, SortBrandType sortBrandType, SortBrand sortBrand) {
|
|
|
String sortBrandTypeKey = this.getStrategyConfiKey(sortBrandType);
|
|
|
return recallConfigServiceProduct.queryRecallSknCount(pageId, sortBrandTypeKey, sortBrand);
|
|
|
RecallSknCount recallSknCount = recallConfigServiceProduct.queryRecallSknCount(pageId, sortBrandTypeKey, sortBrand);
|
|
|
if (recallSknCount == null) {
|
|
|
return null;
|
|
|
}
|
|
|
recallSknCount.setNewShelve(this.legallValue(recallSknCount.getNewShelve(), 0, 20));
|
|
|
recallSknCount.setPromotion(this.legallValue(recallSknCount.getPromotion(), 0, 20));
|
|
|
recallSknCount.setCtrValue(this.legallValue(recallSknCount.getCtrValue(), 0, 20));
|
|
|
recallSknCount.setHeatValue(this.legallValue(recallSknCount.getHeatValue(), 0, 20));
|
|
|
recallSknCount.setReducePrice(this.legallValue(recallSknCount.getReducePrice(), 0, 20));
|
|
|
recallSknCount.setRandom(this.legallValue(recallSknCount.getRandom(), 0, 20));
|
|
|
return recallSknCount;
|
|
|
}
|
|
|
|
|
|
private String getStrategyConfiKey(SortBrandType sortBrandType) {
|
...
|
...
|
@@ -122,4 +133,9 @@ public class RecallConfigService { |
|
|
return null;
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
System.out.println(legallValue(-1,0,30));
|
|
|
}
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|