|
@@ -10,6 +10,7 @@ import com.caimei365.commodity.components.PriceUtilService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
@@ -42,6 +43,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
* @param source 请求来源:www,crm
|
|
|
*/
|
|
|
@Override
|
|
|
+ @Cacheable(value = "getClassify", key = "#typeSort +'-'+ #source", unless = "#result == null")
|
|
|
public ResponseJson<List<BigTypeVo>> getClassify(String typeSort, String source) {
|
|
|
List<BigTypeVo> bigTypeList = productMapper.getBigTypeList(typeSort,source);
|
|
|
bigTypeList.forEach(bigType -> {
|
|
@@ -76,6 +78,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
* @param source 来源:1网站,2小程序
|
|
|
*/
|
|
|
@Override
|
|
|
+ @Cacheable(value = "instrumentData", key = "#pageId+'-'+#userId+'-'+#source", unless = "#result == null")
|
|
|
public ResponseJson<Map<String, Object>> getClassifyData(Integer pageId, Integer userId, Integer source) {
|
|
|
source = source == null ? 1 : source;
|
|
|
Map<String, Object> map = new HashMap<>(3);
|
|
@@ -96,6 +99,53 @@ public class ProductServiceImpl implements ProductService {
|
|
|
return ResponseJson.success(map);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 首页楼层数据
|
|
|
+ *
|
|
|
+ * @param userId 用户id
|
|
|
+ * @param source 来源:1网站,2小程序
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson<Map<String, Object>> getHomeData(Integer userId, Integer source) {
|
|
|
+ Map<String, Object> map = new HashMap<>(2);
|
|
|
+ //楼层管理
|
|
|
+ source = source == null ? 1 : source;
|
|
|
+ List<PageFloorVo> homePageFloor = productMapper.getHomePageFloor(source);
|
|
|
+ Iterator<PageFloorVo> floorIterator = homePageFloor.iterator();
|
|
|
+ while (floorIterator.hasNext()) {
|
|
|
+ PageFloorVo floor = floorIterator.next();
|
|
|
+ FloorContentVo floorContent = productMapper.getFloorContentById(floor.getId());
|
|
|
+ setFloorLinkType(floorContent);
|
|
|
+ floor.setFloorContent(floorContent);
|
|
|
+ List<FloorImageVo> floorImageList = productMapper.getFloorImageById(floor.getId(), source);
|
|
|
+ if (floorImageList == null || floorImageList.size() == 0) {
|
|
|
+ floorIterator.remove();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ setFloorImageProduct(userId, floorImageList);
|
|
|
+ floor.setFloorImageList(floorImageList);
|
|
|
+ }
|
|
|
+ map.put("homePageFloor", homePageFloor);
|
|
|
+ // 优质供应商
|
|
|
+ ShopFloorVo supplierImage = productMapper.getSupplierFloorImage();
|
|
|
+ List<ShopImageVo> supplierList = productMapper.getSupplierImage(source);
|
|
|
+ supplierList.forEach(supplier -> {
|
|
|
+ Integer linkType = AppletsLinkUtil.getLinkType(supplier.getLink());
|
|
|
+ supplier.setLinkType(linkType);
|
|
|
+ supplier.setLinkParam(AppletsLinkUtil.getLinkParam(linkType, supplier.getLink()));
|
|
|
+ });
|
|
|
+ if (supplierImage != null) {
|
|
|
+ supplierImage.setQualitySupplierList(supplierList);
|
|
|
+ if (StringUtils.isNotBlank(supplierImage.getWwwLink())) {
|
|
|
+ Integer linkType = AppletsLinkUtil.getLinkType(supplierImage.getWwwLink());
|
|
|
+ supplierImage.setLinkType(linkType);
|
|
|
+ supplierImage.setLinkParam(AppletsLinkUtil.getLinkParam(linkType, supplierImage.getWwwLink()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put("supplierImage", supplierImage);
|
|
|
+ return ResponseJson.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 设置跳转参数
|
|
|
* @param floorContent FloorContentVo
|