|
|
package com.yoho.search.consumer.service.logic.tbl;
|
|
|
|
|
|
import com.yoho.search.consumer.service.base.TblBrandService;
|
|
|
import com.yoho.search.dal.model.Brand;
|
|
|
import com.yoho.search.consumer.service.bo.BrandBO;
|
|
|
import com.yoho.search.dal.model.TblBrand;
|
|
|
import com.yoho.search.dal.model.TblBrandRelation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
...
|
...
|
@@ -24,7 +24,7 @@ public class TblBrandLogicService { |
|
|
/**
|
|
|
* 增量
|
|
|
*/
|
|
|
public List<Brand> getBrand(List<Integer> ids) {
|
|
|
public List<BrandBO> getBrand(List<Integer> ids) {
|
|
|
List<TblBrand> tblBrands = tblBrandService.selectByIds(ids);
|
|
|
return generateBrand(tblBrands);
|
|
|
}
|
...
|
...
|
@@ -32,7 +32,7 @@ public class TblBrandLogicService { |
|
|
/**
|
|
|
* 全量
|
|
|
*/
|
|
|
public List<Brand> getBrand(int start, int limit) {
|
|
|
public List<BrandBO> getBrand(int start, int limit) {
|
|
|
List<TblBrand> tblBrands = tblBrandService.selectBrandPageList(start, limit);
|
|
|
return generateBrand(tblBrands);
|
|
|
}
|
...
|
...
|
@@ -40,39 +40,39 @@ public class TblBrandLogicService { |
|
|
/**
|
|
|
* 生成BO
|
|
|
*/
|
|
|
private List<Brand> generateBrand(List<TblBrand> tblBrands) {
|
|
|
private List<BrandBO> generateBrand(List<TblBrand> tblBrands) {
|
|
|
Map<Integer, TblBrandRelation> tblBrandRelationMap = tblBrandRelationLogicService.getTblBrandRelationMap();
|
|
|
List<Brand> brands = new ArrayList<>();
|
|
|
List<BrandBO> brandBOList = new ArrayList<>();
|
|
|
for (TblBrand tblBrand : tblBrands) {
|
|
|
Brand brand = new Brand();
|
|
|
brand.setId(tblBrand.getBrandId() * (-1));
|
|
|
BrandBO brandBO = new BrandBO();
|
|
|
brandBO.setId(tblBrand.getBrandId() * (-1));
|
|
|
String brandAlif = tblBrand.getBrandNameEn().substring(0, 1).toUpperCase();
|
|
|
brand.setBrandAlif(brandAlif);
|
|
|
brand.setBrandName(tblBrand.getBrandNameEn());
|
|
|
brand.setBrandNameEn(tblBrand.getBrandNameEn());
|
|
|
brand.setBrandNameCn(tblBrand.getBrandNameCn());
|
|
|
brandBO.setBrandAlif(brandAlif);
|
|
|
brandBO.setBrandName(tblBrand.getBrandNameEn());
|
|
|
brandBO.setBrandNameEn(tblBrand.getBrandNameEn());
|
|
|
brandBO.setBrandNameCn(tblBrand.getBrandNameCn());
|
|
|
//如果全球购和有货之间存在映射
|
|
|
if (tblBrandRelationMap.containsKey(tblBrand.getBrandId())) {
|
|
|
TblBrandRelation tblBrandRelation = tblBrandRelationMap.get(tblBrand.getBrandId());
|
|
|
brand.setYohoBrandId(tblBrandRelation.getYohoBrandId());
|
|
|
brandBO.setYohoBrandId(tblBrandRelation.getYohoBrandId());
|
|
|
}
|
|
|
if (tblBrand.getHot().equals("1")) {
|
|
|
brand.setIsHot("N");
|
|
|
brandBO.setIsHot("N");
|
|
|
} else {
|
|
|
brand.setIsHot("Y");
|
|
|
brandBO.setIsHot("Y");
|
|
|
}
|
|
|
if (tblBrand.getStatus().equals("1")) {
|
|
|
brand.setStatus(0);
|
|
|
brandBO.setStatus(0);
|
|
|
} else {
|
|
|
brand.setStatus(1);
|
|
|
brandBO.setStatus(1);
|
|
|
}
|
|
|
brand.setIsGlobal("Y");
|
|
|
brand.setBrandIco(tblBrand.getLogo());
|
|
|
brand.setBrandDomain(null);
|
|
|
brand.setBrandKeyword(null);
|
|
|
brand.setHotKeyword(null);
|
|
|
brands.add(brand);
|
|
|
brandBO.setIsGlobal("Y");
|
|
|
brandBO.setBrandIco(tblBrand.getLogo());
|
|
|
brandBO.setBrandDomain(null);
|
|
|
brandBO.setBrandKeyword(null);
|
|
|
brandBO.setHotKeyword(null);
|
|
|
brandBOList.add(brandBO);
|
|
|
}
|
|
|
return brands;
|
|
|
return brandBOList;
|
|
|
}
|
|
|
} |
...
|
...
|
|