|
@@ -25,6 +25,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;
|
|
|
|
|
|
@@ -213,8 +215,9 @@ 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) {
|
|
return ResponseJson.error("参数异常: 页面id不能为空!", null);
|
|
return ResponseJson.error("参数异常: 页面id不能为空!", null);
|
|
}
|
|
}
|
|
@@ -228,13 +231,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);
|
|
|
|
- floor.setFloorImageList(floorImageList);
|
|
|
|
|
|
+ if (null == floorContent) {
|
|
|
|
+ iterator.remove();
|
|
|
|
+ } else {
|
|
|
|
+ setFloorLinkType(floorContent);
|
|
|
|
+ List<FloorImageVo> floorImageList = pageMapper.getFloorImageByCentreId(floor.getId(), source);
|
|
|
|
+ setFloorImageProduct(userId, floorImageList);
|
|
|
|
+ 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);
|
|
@@ -278,6 +319,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);
|
|
setFloorImageProduct(userId, floorImageList);
|
|
Map<String, Object> map = new HashMap<>(2);
|
|
Map<String, Object> map = new HashMap<>(2);
|
|
@@ -347,6 +404,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) {
|
|
@@ -659,6 +721,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()));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|