|
@@ -1,9 +1,9 @@
|
|
package com.caimei365.commodity.service.impl;
|
|
package com.caimei365.commodity.service.impl;
|
|
|
|
|
|
-import com.caimei365.commodity.mapper.ProductMapper;
|
|
|
|
|
|
+import com.caimei365.commodity.mapper.PageMapper;
|
|
import com.caimei365.commodity.model.ResponseJson;
|
|
import com.caimei365.commodity.model.ResponseJson;
|
|
import com.caimei365.commodity.model.vo.*;
|
|
import com.caimei365.commodity.model.vo.*;
|
|
-import com.caimei365.commodity.service.ProductService;
|
|
|
|
|
|
+import com.caimei365.commodity.service.PageService;
|
|
import com.caimei365.commodity.utils.AppletsLinkUtil;
|
|
import com.caimei365.commodity.utils.AppletsLinkUtil;
|
|
import com.caimei365.commodity.utils.ImageUtils;
|
|
import com.caimei365.commodity.utils.ImageUtils;
|
|
import com.caimei365.commodity.components.PriceUtilService;
|
|
import com.caimei365.commodity.components.PriceUtilService;
|
|
@@ -28,11 +28,11 @@ import java.util.Map;
|
|
*/
|
|
*/
|
|
@Slf4j
|
|
@Slf4j
|
|
@Service
|
|
@Service
|
|
-public class ProductServiceImpl implements ProductService {
|
|
|
|
|
|
+public class PageServiceImpl implements PageService {
|
|
@Value("${caimei.wwwDomain}")
|
|
@Value("${caimei.wwwDomain}")
|
|
private String domain;
|
|
private String domain;
|
|
@Resource
|
|
@Resource
|
|
- private ProductMapper productMapper;
|
|
|
|
|
|
+ private PageMapper pageMapper;
|
|
@Resource
|
|
@Resource
|
|
private PriceUtilService priceUtilService;
|
|
private PriceUtilService priceUtilService;
|
|
|
|
|
|
@@ -45,17 +45,17 @@ public class ProductServiceImpl implements ProductService {
|
|
@Override
|
|
@Override
|
|
@Cacheable(value = "getClassify", key = "#typeSort +'-'+ #source", unless = "#result == null")
|
|
@Cacheable(value = "getClassify", key = "#typeSort +'-'+ #source", unless = "#result == null")
|
|
public ResponseJson<List<BigTypeVo>> getClassify(String typeSort, String source) {
|
|
public ResponseJson<List<BigTypeVo>> getClassify(String typeSort, String source) {
|
|
- List<BigTypeVo> bigTypeList = productMapper.getBigTypeList(typeSort,source);
|
|
|
|
|
|
+ List<BigTypeVo> bigTypeList = pageMapper.getBigTypeList(typeSort,source);
|
|
bigTypeList.forEach(bigType -> {
|
|
bigTypeList.forEach(bigType -> {
|
|
String caiMeiImage = ImageUtils.getImageURL("caiMeiImage", null, 0, domain);
|
|
String caiMeiImage = ImageUtils.getImageURL("caiMeiImage", null, 0, domain);
|
|
bigType.setWwwIcon(StringUtils.isEmpty(bigType.getWwwIcon())?caiMeiImage:bigType.getWwwIcon());
|
|
bigType.setWwwIcon(StringUtils.isEmpty(bigType.getWwwIcon())?caiMeiImage:bigType.getWwwIcon());
|
|
bigType.setCrmIcon(StringUtils.isEmpty(bigType.getCrmIcon())?caiMeiImage:bigType.getCrmIcon());
|
|
bigType.setCrmIcon(StringUtils.isEmpty(bigType.getCrmIcon())?caiMeiImage:bigType.getCrmIcon());
|
|
- List<SmallTypeVo> smallTypeList = productMapper.getSmallTypeList(bigType.getBigTypeId(), source);
|
|
|
|
|
|
+ List<SmallTypeVo> smallTypeList = pageMapper.getSmallTypeList(bigType.getBigTypeId(), source);
|
|
if (!CollectionUtils.isEmpty(smallTypeList)) {
|
|
if (!CollectionUtils.isEmpty(smallTypeList)) {
|
|
smallTypeList.forEach(smallType -> {
|
|
smallTypeList.forEach(smallType -> {
|
|
smallType.setWwwIcon(StringUtils.isEmpty(smallType.getWwwIcon())?caiMeiImage:smallType.getWwwIcon());
|
|
smallType.setWwwIcon(StringUtils.isEmpty(smallType.getWwwIcon())?caiMeiImage:smallType.getWwwIcon());
|
|
smallType.setCrmIcon(StringUtils.isEmpty(smallType.getCrmIcon())?caiMeiImage:smallType.getCrmIcon());
|
|
smallType.setCrmIcon(StringUtils.isEmpty(smallType.getCrmIcon())?caiMeiImage:smallType.getCrmIcon());
|
|
- List<TinyTypeVo> tinyTypeList = productMapper.getTinyTypeList(smallType.getSmallTypeId(), source);
|
|
|
|
|
|
+ List<TinyTypeVo> tinyTypeList = pageMapper.getTinyTypeList(smallType.getSmallTypeId(), source);
|
|
if (!CollectionUtils.isEmpty(tinyTypeList)) {
|
|
if (!CollectionUtils.isEmpty(tinyTypeList)) {
|
|
tinyTypeList.forEach(tinyType -> {
|
|
tinyTypeList.forEach(tinyType -> {
|
|
tinyType.setWwwIcon(StringUtils.isEmpty(tinyType.getWwwIcon())?caiMeiImage:tinyType.getWwwIcon());
|
|
tinyType.setWwwIcon(StringUtils.isEmpty(tinyType.getWwwIcon())?caiMeiImage:tinyType.getWwwIcon());
|
|
@@ -82,14 +82,14 @@ public class ProductServiceImpl implements ProductService {
|
|
public ResponseJson<Map<String, Object>> getClassifyData(Integer pageId, Integer userId, Integer source) {
|
|
public ResponseJson<Map<String, Object>> getClassifyData(Integer pageId, Integer userId, Integer source) {
|
|
source = source == null ? 1 : source;
|
|
source = source == null ? 1 : source;
|
|
Map<String, Object> map = new HashMap<>(3);
|
|
Map<String, Object> map = new HashMap<>(3);
|
|
- Integer typeSort = productMapper.getPageTypeSort(pageId);
|
|
|
|
- List<HotSearchVo> hotSearchList = productMapper.getHotSearchByPageId(pageId, source);
|
|
|
|
- List<PageFloorVo> floorList = productMapper.getFloorByPageId(pageId, source);
|
|
|
|
|
|
+ Integer typeSort = pageMapper.getPageTypeSort(pageId);
|
|
|
|
+ List<HotSearchVo> hotSearchList = pageMapper.getHotSearchByPageId(pageId, source);
|
|
|
|
+ List<PageFloorVo> floorList = pageMapper.getFloorByPageId(pageId, source);
|
|
for (PageFloorVo floor : floorList) {
|
|
for (PageFloorVo floor : floorList) {
|
|
- FloorContentVo floorContent = productMapper.getFloorContentById(floor.getId());
|
|
|
|
|
|
+ FloorContentVo floorContent = pageMapper.getFloorContentById(floor.getId());
|
|
setFloorLinkType(floorContent);
|
|
setFloorLinkType(floorContent);
|
|
floor.setFloorContent(floorContent);
|
|
floor.setFloorContent(floorContent);
|
|
- List<FloorImageVo> floorImageList = productMapper.getFloorImageById(floor.getId(), source);
|
|
|
|
|
|
+ List<FloorImageVo> floorImageList = pageMapper.getFloorImageById(floor.getId(), source);
|
|
setFloorImageProduct(userId, floorImageList);
|
|
setFloorImageProduct(userId, floorImageList);
|
|
floor.setFloorImageList(floorImageList);
|
|
floor.setFloorImageList(floorImageList);
|
|
}
|
|
}
|
|
@@ -110,14 +110,14 @@ public class ProductServiceImpl implements ProductService {
|
|
Map<String, Object> map = new HashMap<>(2);
|
|
Map<String, Object> map = new HashMap<>(2);
|
|
//楼层管理
|
|
//楼层管理
|
|
source = source == null ? 1 : source;
|
|
source = source == null ? 1 : source;
|
|
- List<PageFloorVo> homePageFloor = productMapper.getHomePageFloor(source);
|
|
|
|
|
|
+ List<PageFloorVo> homePageFloor = pageMapper.getHomePageFloor(source);
|
|
Iterator<PageFloorVo> floorIterator = homePageFloor.iterator();
|
|
Iterator<PageFloorVo> floorIterator = homePageFloor.iterator();
|
|
while (floorIterator.hasNext()) {
|
|
while (floorIterator.hasNext()) {
|
|
PageFloorVo floor = floorIterator.next();
|
|
PageFloorVo floor = floorIterator.next();
|
|
- FloorContentVo floorContent = productMapper.getFloorContentById(floor.getId());
|
|
|
|
|
|
+ FloorContentVo floorContent = pageMapper.getFloorContentById(floor.getId());
|
|
setFloorLinkType(floorContent);
|
|
setFloorLinkType(floorContent);
|
|
floor.setFloorContent(floorContent);
|
|
floor.setFloorContent(floorContent);
|
|
- List<FloorImageVo> floorImageList = productMapper.getFloorImageById(floor.getId(), source);
|
|
|
|
|
|
+ List<FloorImageVo> floorImageList = pageMapper.getFloorImageById(floor.getId(), source);
|
|
if (floorImageList == null || floorImageList.size() == 0) {
|
|
if (floorImageList == null || floorImageList.size() == 0) {
|
|
floorIterator.remove();
|
|
floorIterator.remove();
|
|
continue;
|
|
continue;
|
|
@@ -127,8 +127,8 @@ public class ProductServiceImpl implements ProductService {
|
|
}
|
|
}
|
|
map.put("homePageFloor", homePageFloor);
|
|
map.put("homePageFloor", homePageFloor);
|
|
// 优质供应商
|
|
// 优质供应商
|
|
- ShopFloorVo supplierImage = productMapper.getSupplierFloorImage();
|
|
|
|
- List<ShopImageVo> supplierList = productMapper.getSupplierImage(source);
|
|
|
|
|
|
+ ShopFloorVo supplierImage = pageMapper.getSupplierFloorImage();
|
|
|
|
+ List<ShopImageVo> supplierList = pageMapper.getSupplierImage(source);
|
|
supplierList.forEach(supplier -> {
|
|
supplierList.forEach(supplier -> {
|
|
Integer linkType = AppletsLinkUtil.getLinkType(supplier.getLink());
|
|
Integer linkType = AppletsLinkUtil.getLinkType(supplier.getLink());
|
|
supplier.setLinkType(linkType);
|
|
supplier.setLinkType(linkType);
|
|
@@ -146,6 +146,19 @@ public class ProductServiceImpl implements ProductService {
|
|
return ResponseJson.success(map);
|
|
return ResponseJson.success(map);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 商品品牌列表
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseJson<List<BrandVo>> getBrandList() {
|
|
|
|
+ List<BrandVo> brandList = pageMapper.getBrandList();
|
|
|
|
+ BrandVo other = new BrandVo();
|
|
|
|
+ other.setId(161);
|
|
|
|
+ other.setName("其他");
|
|
|
|
+ brandList.add(other);
|
|
|
|
+ return ResponseJson.success(brandList);
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 设置跳转参数
|
|
* 设置跳转参数
|
|
* @param floorContent FloorContentVo
|
|
* @param floorContent FloorContentVo
|
|
@@ -183,7 +196,7 @@ public class ProductServiceImpl implements ProductService {
|
|
image.setLinkParam(linkParam);
|
|
image.setLinkParam(linkParam);
|
|
if (image.getProductId() != null) {
|
|
if (image.getProductId() != null) {
|
|
// 获取商品及价格
|
|
// 获取商品及价格
|
|
- ProductItemVo product = productMapper.getProductItemById(image.getProductId());
|
|
|
|
|
|
+ ProductItemVo product = pageMapper.getProductItemById(image.getProductId());
|
|
if (product != null) {
|
|
if (product != null) {
|
|
image.setListType(1);
|
|
image.setListType(1);
|
|
image.setName(product.getName());
|
|
image.setName(product.getName());
|