|
@@ -9,11 +9,13 @@ import com.caimei365.commodity.model.ResponseJson;
|
|
import com.caimei365.commodity.model.po.ProductDetailInfoPo;
|
|
import com.caimei365.commodity.model.po.ProductDetailInfoPo;
|
|
import com.caimei365.commodity.model.po.ProductImagePo;
|
|
import com.caimei365.commodity.model.po.ProductImagePo;
|
|
import com.caimei365.commodity.model.po.ProductParameterPo;
|
|
import com.caimei365.commodity.model.po.ProductParameterPo;
|
|
|
|
+import com.caimei365.commodity.model.vo.ProductRepairVo;
|
|
import com.caimei365.commodity.model.search.ProductListVo;
|
|
import com.caimei365.commodity.model.search.ProductListVo;
|
|
import com.caimei365.commodity.model.vo.*;
|
|
import com.caimei365.commodity.model.vo.*;
|
|
import com.caimei365.commodity.service.PageService;
|
|
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.utils.MathUtil;
|
|
import com.caimei365.commodity.utils.MathUtil;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -24,6 +26,8 @@ import org.springframework.stereotype.Service;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.text.ParseException;
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -216,6 +220,7 @@ public class PageServiceImpl implements PageService {
|
|
* @param userId 用户id
|
|
* @param userId 用户id
|
|
* @param source 来源 : 1 网站 ; 2 小程序
|
|
* @param source 来源 : 1 网站 ; 2 小程序
|
|
*/
|
|
*/
|
|
|
|
+ @Cacheable(value = "getPageFloorData", key = "#userId +'-'+ #pageId +'-'+ #source", unless = "#result == null")
|
|
@Override
|
|
@Override
|
|
public ResponseJson<Map<String, Object>> getPageData(Integer pageId, Integer userId, Integer source) {
|
|
public ResponseJson<Map<String, Object>> getPageData(Integer pageId, Integer userId, Integer source) {
|
|
if (pageId == null) {
|
|
if (pageId == null) {
|
|
@@ -231,13 +236,51 @@ public class PageServiceImpl implements PageService {
|
|
page.setLinkParam(AppletsLinkUtil.getLinkParam(linkType, page.getHeadLink()));
|
|
page.setLinkParam(AppletsLinkUtil.getLinkParam(linkType, page.getHeadLink()));
|
|
}
|
|
}
|
|
List<PageFloorVo> floorList = pageMapper.getFloorByPageId(pageId, source);
|
|
List<PageFloorVo> floorList = pageMapper.getFloorByPageId(pageId, source);
|
|
- for (PageFloorVo floor : floorList) {
|
|
|
|
|
|
+ ListIterator<PageFloorVo> iterator = floorList.listIterator();
|
|
|
|
+ while (iterator.hasNext()) {
|
|
|
|
+ PageFloorVo floor = iterator.next();
|
|
FloorContentVo floorContent = pageMapper.getFloorContentByCentreId(floor.getId());
|
|
FloorContentVo floorContent = pageMapper.getFloorContentByCentreId(floor.getId());
|
|
- setFloorLinkType(floorContent);
|
|
|
|
- floor.setFloorContent(floorContent);
|
|
|
|
- List<FloorImageVo> floorImageList = pageMapper.getFloorImageByCentreId(floor.getId(), source);
|
|
|
|
- setFloorImageProduct(userId, floorImageList, source);
|
|
|
|
- floor.setFloorImageList(floorImageList);
|
|
|
|
|
|
+ if (null == floorContent) {
|
|
|
|
+ iterator.remove();
|
|
|
|
+ } else {
|
|
|
|
+ setFloorLinkType(floorContent);
|
|
|
|
+ List<FloorImageVo> floorImageList = pageMapper.getFloorImageByCentreId(floor.getId(), source);
|
|
|
|
+ setFloorImageProduct(userId, floorImageList, source);
|
|
|
|
+ floor.setFloorImageList(floorImageList);
|
|
|
|
+ String templateTypeStr = floorContent.getTemplateType();
|
|
|
|
+ if (StringUtils.isNotEmpty(templateTypeStr)) {
|
|
|
|
+ int templateType = Integer.parseInt(floorContent.getTemplateType());
|
|
|
|
+ // 日期切换模板处理
|
|
|
|
+ if (templateType == 1 || templateType == 2 || (templateType >= 7 && templateType <= 10)) {
|
|
|
|
+ floorContent.setTemplateClassify(1);
|
|
|
|
+ } else if (templateType >= 3 && templateType <= 6) {
|
|
|
|
+ floorContent.setTemplateClassify(2);
|
|
|
|
+ } else if (templateType >= 11 && templateType <= 21) {
|
|
|
|
+ floorContent.setTemplateClassify(3);
|
|
|
|
+ } else if (templateType >= 22 && templateType <= 25) {
|
|
|
|
+ floorContent.setTemplateClassify(1);
|
|
|
|
+ List<FloorImageVo> floorImageList1 = new ArrayList<>();
|
|
|
|
+ List<FloorImageVo> floorImageList2 = new ArrayList<>();
|
|
|
|
+ List<FloorImageVo> floorImageList3 = new ArrayList<>();
|
|
|
|
+ floorImageList.forEach(image -> {
|
|
|
|
+ // 根据展示日期排序分割进3个列表中
|
|
|
|
+ if (1 == image.getDisplaySort()) {
|
|
|
|
+ floorImageList1.add(image);
|
|
|
|
+ } else if (2 == image.getDisplaySort()) {
|
|
|
|
+ floorImageList2.add(image);
|
|
|
|
+ } else if (3 == image.getDisplaySort()) {
|
|
|
|
+ floorImageList3.add(image);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ floor.setFloorImageList(floorImageList1);
|
|
|
|
+ floor.setFloorImageList2(floorImageList2);
|
|
|
|
+ floor.setFloorImageList3(floorImageList3);
|
|
|
|
+ } else if (templateType >= 26 && templateType <= 29) {
|
|
|
|
+ floorContent.setTemplateClassify(4);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ floor.setFloorContent(floorContent);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
Map<String, Object> map = new HashMap<>(2);
|
|
Map<String, Object> map = new HashMap<>(2);
|
|
map.put("page", page);
|
|
map.put("page", page);
|
|
@@ -281,6 +324,22 @@ public class PageServiceImpl implements PageService {
|
|
}
|
|
}
|
|
FloorContentVo floorContent = pageMapper.getFloorContentByCentreId(centreId);
|
|
FloorContentVo floorContent = pageMapper.getFloorContentByCentreId(centreId);
|
|
setFloorLinkType(floorContent);
|
|
setFloorLinkType(floorContent);
|
|
|
|
+ String templateTypeStr = floorContent.getTemplateType();
|
|
|
|
+ if (StringUtils.isNotEmpty(templateTypeStr)) {
|
|
|
|
+ int templateType = Integer.parseInt(floorContent.getTemplateType());
|
|
|
|
+ // 日期切换模板处理
|
|
|
|
+ if (templateType == 1 || templateType == 2 || (templateType >= 7 && templateType <= 10)) {
|
|
|
|
+ floorContent.setTemplateClassify(1);
|
|
|
|
+ } else if (templateType >= 3 && templateType <= 6) {
|
|
|
|
+ floorContent.setTemplateClassify(2);
|
|
|
|
+ } else if (templateType >= 11 && templateType <= 21) {
|
|
|
|
+ floorContent.setTemplateClassify(3);
|
|
|
|
+ } else if (templateType >= 22 && templateType <= 25) {
|
|
|
|
+ floorContent.setTemplateClassify(1);
|
|
|
|
+ } else if (templateType >= 26 && templateType <= 29) {
|
|
|
|
+ floorContent.setTemplateClassify(4);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
List<FloorImageVo> floorImageList = pageMapper.getFloorImageByCentreId(centreId, source);
|
|
List<FloorImageVo> floorImageList = pageMapper.getFloorImageByCentreId(centreId, source);
|
|
setFloorImageProduct(userId, floorImageList, source);
|
|
setFloorImageProduct(userId, floorImageList, source);
|
|
Map<String, Object> map = new HashMap<>(2);
|
|
Map<String, Object> map = new HashMap<>(2);
|
|
@@ -350,6 +409,11 @@ public class PageServiceImpl implements PageService {
|
|
product.setTinyTypeName(list.size() > 2 ? list.get(2) : null);
|
|
product.setTinyTypeName(list.size() > 2 ? list.get(2) : null);
|
|
//价格等级
|
|
//价格等级
|
|
product.setPriceGrade(priceUtilService.getPriceGrade(product.getPrice()));
|
|
product.setPriceGrade(priceUtilService.getPriceGrade(product.getPrice()));
|
|
|
|
+ // 商品云上美博会活动状态
|
|
|
|
+ Integer pcBeautyStatus = shopMapper.getPcBeautyStatusById(product.getProductId());
|
|
|
|
+ Integer appletsBeautyStatus = shopMapper.getAppletsBeautyStatusById(product.getProductId());
|
|
|
|
+ product.setPcActType(null != pcBeautyStatus ? 1 : 0);
|
|
|
|
+ product.setAppletsActType(null != appletsBeautyStatus ? 1 : 0);
|
|
//供应商信息
|
|
//供应商信息
|
|
ShopVo shop = shopMapper.getProductShopById(product.getShopId());
|
|
ShopVo shop = shopMapper.getProductShopById(product.getShopId());
|
|
if (null != shop) {
|
|
if (null != shop) {
|
|
@@ -649,6 +713,7 @@ public class PageServiceImpl implements PageService {
|
|
/**
|
|
/**
|
|
* 设置跳转参数
|
|
* 设置跳转参数
|
|
*
|
|
*
|
|
|
|
+ *
|
|
* @param floorContent FloorContentVo
|
|
* @param floorContent FloorContentVo
|
|
*/
|
|
*/
|
|
private void setFloorLinkType(FloorContentVo floorContent) {
|
|
private void setFloorLinkType(FloorContentVo floorContent) {
|
|
@@ -668,6 +733,16 @@ public class PageServiceImpl implements PageService {
|
|
floorContent.setLinkType3(linkType3);
|
|
floorContent.setLinkType3(linkType3);
|
|
floorContent.setLinkParam3(AppletsLinkUtil.getLinkParam(linkType3, floorContent.getAdsLink3()));
|
|
floorContent.setLinkParam3(AppletsLinkUtil.getLinkParam(linkType3, floorContent.getAdsLink3()));
|
|
}
|
|
}
|
|
|
|
+ if (StringUtils.isNotBlank(floorContent.getAdsLink4())) {
|
|
|
|
+ Integer linkType4 = AppletsLinkUtil.getLinkType(floorContent.getAdsLink4());
|
|
|
|
+ floorContent.setLinkType4(linkType4);
|
|
|
|
+ floorContent.setLinkParam4(AppletsLinkUtil.getLinkParam(linkType4, floorContent.getAdsLink4()));
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(floorContent.getAdsLink5())) {
|
|
|
|
+ Integer linkType3 = AppletsLinkUtil.getLinkType(floorContent.getAdsLink3());
|
|
|
|
+ floorContent.setLinkType3(linkType3);
|
|
|
|
+ floorContent.setLinkParam3(AppletsLinkUtil.getLinkParam(linkType3, floorContent.getAdsLink3()));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|