Authored by hugufei

be empty CtrValueBuilder

package com.yoho.search.consumer.service.logicService.productIndex;
import com.yoho.search.consumer.service.logicService.productIndex.IndexFieldBuilder;
import com.yoho.search.consumer.service.bo.ProductIndexBO;
import com.yoho.search.dal.SknCtrValueMapper;
import com.yoho.search.dal.model.SknCtrValue;
... ... @@ -26,22 +25,22 @@ public class CtrValueBuilder implements IndexFieldBuilder {
@Override
public void build(List<ProductIndexBO> productIndexBOs, List<Integer> idList, List<Integer> sknList) {
if (dateId == null) {
dateId = sknCtrValueMapper.selectLatestDateId();
}
if (dateId == null) {
return;
}
List<SknCtrValue> sknCtrValueList = sknCtrValueMapper.selectLatestDateBySkn(sknList, dateId);
if (CollectionUtils.isEmpty(sknCtrValueList)) {
return;
}
Map<Integer, BigDecimal> ctrValueMap = sknCtrValueList.stream().collect(Collectors.toMap(SknCtrValue::getProductSkn, SknCtrValue::getCtrValue));
productIndexBOs.stream().forEach(p -> {
if (ctrValueMap.containsKey(p.getProductSkn())) {
p.setCtrValue(ctrValueMap.get(p.getProductSkn()));
}
});
// if (dateId == null) {
// dateId = sknCtrValueMapper.selectLatestDateId();
// }
// if (dateId == null) {
// return;
// }
// List<SknCtrValue> sknCtrValueList = sknCtrValueMapper.selectLatestDateBySkn(sknList, dateId);
// if (CollectionUtils.isEmpty(sknCtrValueList)) {
// return;
// }
// Map<Integer, BigDecimal> ctrValueMap = sknCtrValueList.stream().collect(Collectors.toMap(SknCtrValue::getProductSkn, SknCtrValue::getCtrValue));
// productIndexBOs.stream().forEach(p -> {
// if (ctrValueMap.containsKey(p.getProductSkn())) {
// p.setCtrValue(ctrValueMap.get(p.getProductSkn()));
// }
// });
}
@Override
... ...