Authored by wangnan

使用BeanUtils.copyProperties 先改回来

... ... @@ -3,7 +3,6 @@ package com.yoho.search.consumer.service.logic;
import com.yoho.search.consumer.service.bo.ProductIBO;
import com.yoho.search.consumer.service.bo.ProductIndexBO;
import com.yoho.search.consumer.service.logic.productIndex.ProductILogicService;
import com.yoho.search.consumer.service.logic.productIndex.viewBuilder.GeneralDataBuilder;
import com.yoho.search.consumer.service.logic.productIndex.viewBuilder.ViewBuilder;
import com.yoho.search.dal.BrandMapper;
import com.yoho.search.dal.ProductMapper;
... ... @@ -14,6 +13,7 @@ import com.yoho.search.dal.model.ProductSort;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
... ... @@ -37,8 +37,6 @@ public class ProductIndexLogicService implements ApplicationContextAware {
@Autowired
private ProductILogicService productILogicService;
@Autowired
private GeneralDataBuilder generalDataBuilder;
@Autowired
private ProductMapper productMapper;
@Autowired
private ProductSortMapper productSortMapper;
... ... @@ -131,7 +129,11 @@ public class ProductIndexLogicService implements ApplicationContextAware {
List<ProductIndexBO> productIndexBOs = new ArrayList<>();
List<Integer> ids = productIBOs.stream().map(ProductIBO::getId).collect(Collectors.toList());
List<Integer> skns = productIBOs.stream().map(ProductIBO::getProductSkn).collect(Collectors.toList());
generalDataBuilder.buildDataFromProductI(productIndexBOs, productIBOs);
for (ProductIBO productIBO : productIBOs) {
ProductIndexBO productIndexBO = new ProductIndexBO();
BeanUtils.copyProperties(productIBO, productIndexBO);
productIndexBOs.add(productIndexBO);
}
viewBuilderList.stream().forEach(viewBuilder -> {
viewBuilder.build(productIndexBOs, ids, skns);
});
... ...
package com.yoho.search.consumer.service.logic.productIndex.viewBuilder;
import com.yoho.search.consumer.service.bo.ProductIBO;
import com.yoho.search.consumer.service.bo.ProductIndexBO;
import com.yoho.search.consumer.service.logic.ProductIndexLogicService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* Created by wangnan on 2017/1/6.
*/
@Component
public class GeneralDataBuilder {
private final Logger logger = LoggerFactory.getLogger(ProductIndexLogicService.class);
/**
* 拼装来自ProductI的数据
*/
public void buildDataFromProductI(List<ProductIndexBO> productIndexBOs, List<ProductIBO> productIBOs) {
for (ProductIBO productIBO : productIBOs) {
ProductIndexBO productIndexBO = new ProductIndexBO();
BeanUtils.copyProperties(productIBO, productIndexBO);
productIndexBOs.add(productIndexBO);
}
}
// productIndexBO.setId(p.getId());
// productIndexBO.setProductId(p.getProductId());
// productIndexBO.setProductSkn(p.getProductSkn());
// productIndexBO.setShopId(p.getShopId());
// productIndexBO.setProductName(p.getProductName());
// productIndexBO.setCnAlphabet(p.getCnAlphabet());
// productIndexBO.setSalesPhrase(p.getSalesPhrase());
// productIndexBO.setBrandId(p.getBrandId());
// productIndexBO.setMaxSortId(p.getMaxSortId());
// productIndexBO.setMiddleSortId(p.getMiddleSortId());
// productIndexBO.setSmallSortId(p.getSmallSortId());
// productIndexBO.setSeriesId(p.getSeriesId());
// productIndexBO.setGender(p.getGender());
// productIndexBO.setGenderS(p.getGenderS());
// productIndexBO.setStyle(p.getStyle());
// productIndexBO.setIslimited(p.getIslimited());
// productIndexBO.setIshot(p.getIshot());
// productIndexBO.setIsHot(p.getIsHot());
// productIndexBO.setIsspecial(p.getIsspecial());
// productIndexBO.setIsSpecial(p.getIsSpecial());
// productIndexBO.setIssales(p.getIssales());
// productIndexBO.setIsSales(p.getIsSales());
// productIndexBO.setIsadvance(p.getIsadvance());
// productIndexBO.setIsAdvance(p.getIsAdvance());
// productIndexBO.setIsDepositAdvance(p.getIsDepositAdvance());
// productIndexBO.setIsLimitbuy(p.getIsLimitbuy());
// productIndexBO.setIsauditing(p.getIsauditing());
// productIndexBO.setIsAuditing(p.getIsAuditing());
// productIndexBO.setIsrecommend(p.getIsrecommend());
// productIndexBO.setIspromotion(p.getIspromotion());
// productIndexBO.setAttribute(p.getAttribute());
// productIndexBO.setSeasons(p.getSeasons());
// productIndexBO.setSeasonsS(p.getSeasonsS());
// productIndexBO.setFirstShelveTime(p.getFirstShelveTime());
// productIndexBO.setShelveTime(p.getShelveTime());
// productIndexBO.setShelveDay(p.getShelveDay());
// productIndexBO.setEditTime(p.getEditTime());
// productIndexBO.setIsdown(p.getIsdown());
// productIndexBO.setIsDown(p.getIsDown());
// productIndexBO.setStatus(p.getStatus());
// productIndexBO.setIsOutlets(p.getIsOutlets());
// productIndexBO.setFolderId(p.getFolderId());
// productIndexBO.setSellChannels(p.getSellChannels());
// productIndexBO.setAgeLevel(p.getAgeLevel());
// productIndexBO.setIsSeckill(p.getIsSeckill());
// productIndexBO.setBrandNameCn(p.getBrandNameCn());
// productIndexBO.setBrandNameEn(p.getBrandNameEn());
// productIndexBO.setBrandKeyword(p.getBrandKeyword());
// productIndexBO.setHotKeyword(p.getHotKeyword());
// productIndexBO.setBrandName(p.getBrandName());
// productIndexBO.setBrandDomain(p.getBrandDomain());
// productIndexBO.setBrandAlif(p.getBrandAlif());
// productIndexBO.setMaxSort(p.getMaxSort());
// productIndexBO.setMaxSortName(p.getMaxSortName());
// productIndexBO.setMiddleSort(p.getMiddleSort());
// productIndexBO.setMiddleSortName(p.getMiddleSortName());
// productIndexBO.setSmallSort(p.getSmallSort());
// productIndexBO.setSmallSortName(p.getSmallSortName());
// productIndexBO.setMarketPhrase(p.getMarketPhrase());
// // blk 全量要增加
// productIndexBO.setAppType(p.getAppType());
// // 产地 全量要增加
// productIndexBO.setCountryId(p.getCountryId());
// // 是否分期全量要增加
// productIndexBO.setIsInstalment(p.getIsInstalment());
// // 一级销售分类
// productIndexBO.setPhysicalChannels(p.getPhysicalChannels());
// // 设置bundle_type
// productIndexBO.setBundleType(p.getBundleType());
// // 设置style和phrase
// productIndexBO.setPattern(p.getPattern());
// productIndexBO.setPhrase(p.getPhrase());
// productIndexBO.setIsPhraseExist(p.getIsPhraseExist());
}