master:营销推广优化;
parent
97de62da54
commit
455c9f6107
|
|
@ -33,10 +33,6 @@ public class SysProductCategoryController extends XktBaseController {
|
|||
|
||||
final ISysProductCategoryService prodCateService;
|
||||
|
||||
/**
|
||||
* 新增商品分类
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:category:add')")
|
||||
@ApiOperation(value = "新增商品分类", httpMethod = "POST", response = R.class)
|
||||
@Log(title = "新增商品分类", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
|
|
@ -44,10 +40,6 @@ public class SysProductCategoryController extends XktBaseController {
|
|||
return R.ok(prodCateService.create(BeanUtil.toBean(prodCateVO, ProdCateDTO.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品分类
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:category:edit')")
|
||||
@ApiOperation(value = "修改商品分类", httpMethod = "PUT", response = R.class)
|
||||
@Log(title = "修改商品分类", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
|
|
@ -55,10 +47,6 @@ public class SysProductCategoryController extends XktBaseController {
|
|||
return R.ok(prodCateService.update(BeanUtil.toBean(prodCateVO, ProdCateDTO.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品分类
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:category:remove')")
|
||||
@ApiOperation(value = "删除商品分类", httpMethod = "DELETE", response = R.class)
|
||||
@Log(title = "删除商品分类", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{prodCateId}")
|
||||
|
|
@ -67,69 +55,40 @@ public class SysProductCategoryController extends XktBaseController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询商品分类详细
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:category:query')")
|
||||
@ApiOperation(value = "查询商品分类详细", httpMethod = "GET", response = R.class)
|
||||
@GetMapping(value = "/{prodCateId}")
|
||||
public R<ProdCateVO> getInfo(@PathVariable Long prodCateId) {
|
||||
return R.ok(BeanUtil.toBean(prodCateService.selectById(prodCateId), ProdCateVO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品分类列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:category:list')")
|
||||
@ApiOperation(value = "获取商品分类列表", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("/list")
|
||||
public R<List<ProdCateListResVO>> list(@RequestBody ProdCateListVO listVO) {
|
||||
return R.ok(BeanUtil.copyToList(prodCateService.selectList(BeanUtil.toBean(listVO, ProdCateListDTO.class)), ProdCateListResVO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据1级分类获取二级分类列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:category:list')")
|
||||
@ApiOperation(value = "根据1级分类获取二级分类列表", httpMethod = "GET", response = R.class)
|
||||
@GetMapping("/sub/{parCateId}")
|
||||
public R<List<ProdCateVO>> getSubListByParCateId(@PathVariable Long parCateId) {
|
||||
return R.ok(BeanUtil.copyToList(prodCateService.getSubListByParCateId(parCateId), ProdCateVO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有的二级分类
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:category:list')")
|
||||
@ApiOperation(value = "获取所有的二级分类", httpMethod = "GET", response = R.class)
|
||||
@GetMapping("/subs")
|
||||
public R<List<ProdCateVO>> getAllSubList() {
|
||||
return R.ok(BeanUtil.copyToList(prodCateService.getAllSubList(), ProdCateVO.class));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* APP首页获取商品分类
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:category:list')")
|
||||
@ApiOperation(value = "APP首页获取商品分类", httpMethod = "GET", response = R.class)
|
||||
@GetMapping("/app/home/list")
|
||||
public R<List<AppHomeProdCateListResVO>> appHomeCate() {
|
||||
return R.ok(BeanUtil.copyToList(prodCateService.selectAppHomeCate(), AppHomeProdCateListResVO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* APP分类页
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:category:list')")
|
||||
@ApiOperation(value = "APP分类页", httpMethod = "GET", response = R.class)
|
||||
@GetMapping("/app/list")
|
||||
public R<List<AppHomeProdCateListResVO>> appCate() {
|
||||
return R.ok(BeanUtil.copyToList(prodCateService.appCate(), AppHomeProdCateListResVO.class));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,11 @@ package com.ruoyi.web.controller.xkt;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.ruoyi.common.core.controller.XktBaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.domain.vo.productCategory.ProdCateListResVO;
|
||||
import com.ruoyi.common.core.domain.vo.productCategory.ProdCateListVO;
|
||||
import com.ruoyi.common.core.page.Page;
|
||||
import com.ruoyi.system.domain.dto.productCategory.ProdCateListDTO;
|
||||
import com.ruoyi.system.service.ISysProductCategoryService;
|
||||
import com.ruoyi.web.controller.xkt.vo.advertRound.app.category.APPCateVO;
|
||||
import com.ruoyi.web.controller.xkt.vo.advertRound.app.index.APPIndexHotSaleRightFixVO;
|
||||
import com.ruoyi.web.controller.xkt.vo.advertRound.app.index.APPIndexMidBrandVO;
|
||||
|
|
@ -50,7 +54,6 @@ public class WebsiteController extends XktBaseController {
|
|||
|
||||
final IWebsitePCService websitePCService;
|
||||
final IWebsiteAPPService websiteAPPService;
|
||||
|
||||
@ApiOperation(value = "PC 首页 为你推荐", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("/pc/index/recommend")
|
||||
public R<Page<PCIndexRecommendDTO>> pcIndexRecommendPage(@Validated @RequestBody IndexSearchVO searchVO) throws IOException {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ public class APPOwnGuessLikeVO {
|
|||
private BigDecimal price;
|
||||
@ApiModelProperty(value = "商品第一张主图路径")
|
||||
private String mainPicUrl;
|
||||
@ApiModelProperty(value = "是否有视频")
|
||||
private Boolean hasVideo;
|
||||
@ApiModelProperty(value = "标签列表")
|
||||
private List<String> tagList;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModel;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
|
|
@ -18,6 +20,7 @@ public class ProdCateVO {
|
|||
@ApiModelProperty(value = "商品分类主键, 新增不传 编辑必传")
|
||||
private Long prodCateId;
|
||||
@ApiModelProperty(value = "分类名称")
|
||||
@NotBlank(message = "分类名称不能为空")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "分类名称")
|
||||
private Long parentId;
|
||||
|
|
|
|||
|
|
@ -119,8 +119,10 @@ public class SecurityConfig
|
|||
.antMatchers("/rest/v1/alipay-callback/**").permitAll()
|
||||
//物流回调
|
||||
.antMatchers("/rest/v1/express-callback/**").permitAll()
|
||||
// 系统广告及首页
|
||||
// 系统广告及首页
|
||||
.antMatchers("/rest/v1/website/**").permitAll()
|
||||
// 系统分类
|
||||
.antMatchers("/rest/v1/sys/prod-cate/**").permitAll()
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
.anyRequest().authenticated();
|
||||
})
|
||||
|
|
|
|||
|
|
@ -489,6 +489,25 @@ public class XktTask {
|
|||
advertRoundService.initAdvertLockMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* 每个小时执行一次,发布商品
|
||||
*/
|
||||
@Transactional
|
||||
public void hourPublicStoreProduct(){
|
||||
|
||||
// TODO 定时任务发布商品,同步到ES中
|
||||
// TODO 定时任务发布商品,同步到ES中
|
||||
// TODO 定时任务发布商品,同步到ES中
|
||||
|
||||
// 向ES索引: product_info 创建文档
|
||||
// this.createESDoc(storeProd, storeProdDTO);
|
||||
// 搜图服务同步
|
||||
// sync2ImgSearchServer(storeProd.getId(), storeProdDTO.getFileList());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 自动关闭超时订单
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.domain.entity.SysProductCategory;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.system.domain.dto.productCategory.AppHomeProdCateListResDTO;
|
||||
import com.ruoyi.system.domain.dto.productCategory.ProdCateDTO;
|
||||
import com.ruoyi.system.domain.dto.productCategory.ProdCateListDTO;
|
||||
|
|
@ -77,6 +79,12 @@ public class SysProductCategoryServiceImpl implements ISysProductCategoryService
|
|||
@Override
|
||||
@Transactional
|
||||
public Integer delete(Long prodCateId) {
|
||||
|
||||
// TODO 是否为超级管理员
|
||||
// TODO 是否为超级管理员
|
||||
// TODO 是否为超级管理员
|
||||
this.isSuperAdmin();
|
||||
|
||||
SysProductCategory prodCate = Optional.ofNullable(this.prodCateMapper.selectOne(new LambdaQueryWrapper<SysProductCategory>()
|
||||
.eq(SysProductCategory::getId, prodCateId).eq(SysProductCategory::getDelFlag, Constants.UNDELETED)))
|
||||
.orElseThrow(() -> new ServiceException("商品分类不存在!", HttpStatus.ERROR));
|
||||
|
|
@ -259,4 +267,20 @@ public class SysProductCategoryServiceImpl implements ISysProductCategoryService
|
|||
return getChildList(list, cate).size() > 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验当前是否是超级管理员操作
|
||||
*/
|
||||
private void isSuperAdmin() {
|
||||
// 获取当前登录用户
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtils.isEmpty(loginUser)) {
|
||||
throw new ServiceException("当前用户不存在!", HttpStatus.ERROR);
|
||||
}
|
||||
if (!SecurityUtils.isAdmin(loginUser.getUserId())) {
|
||||
throw new ServiceException("当前用户不是超级管理员,不可操作!", HttpStatus.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ public class APPIndexHotSaleDTO {
|
|||
private String prodPrice;
|
||||
@ApiModelProperty(value = "是否广告")
|
||||
private Boolean advert;
|
||||
@ApiModelProperty(value = "是否有视频")
|
||||
private Boolean hasVideo;
|
||||
@ApiModelProperty(value = "标签")
|
||||
private List<String> tags;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ public class APPIndexNewProdDTO {
|
|||
private String prodPrice;
|
||||
@ApiModelProperty(value = "是否广告")
|
||||
private Boolean advert;
|
||||
@ApiModelProperty(value = "是否有视频")
|
||||
private Boolean hasVideo;
|
||||
@ApiModelProperty(value = "标签")
|
||||
private List<String> tags;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ public class APPIndexPopularSaleDTO {
|
|||
private String prodPrice;
|
||||
@ApiModelProperty(value = "是否广告")
|
||||
private Boolean advert;
|
||||
@ApiModelProperty(value = "是否有视频")
|
||||
private Boolean hasVideo;
|
||||
@ApiModelProperty(value = "标签")
|
||||
private List<String> tags;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ public class APPSearchDTO {
|
|||
private String prodPrice;
|
||||
@ApiModelProperty(value = "是否广告")
|
||||
private Boolean advert;
|
||||
@ApiModelProperty(value = "是否有视频")
|
||||
private Boolean hasVideo;
|
||||
@ApiModelProperty(value = "标签")
|
||||
private List<String> tags;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ public class APPOwnGuessLikeDTO {
|
|||
private String prodArtNum;
|
||||
@ApiModelProperty(value = "商品第一张主图路径")
|
||||
private String mainPicUrl;
|
||||
@ApiModelProperty(value = "是否有视频")
|
||||
private Boolean hasVideo;
|
||||
@ApiModelProperty(value = "标签列表")
|
||||
private List<String> tags;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ public class PCSearchDTO {
|
|||
private String prodPrice;
|
||||
@ApiModelProperty(value = "是否广告")
|
||||
private Boolean advert;
|
||||
@ApiModelProperty(value = "是否有视频")
|
||||
private Boolean hasVideo;
|
||||
@ApiModelProperty(value = "标签")
|
||||
private List<String> tags;
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ public class PCIndexRecommendDTO {
|
|||
private String prodPrice;
|
||||
@ApiModelProperty(value = "是否广告")
|
||||
private Boolean advert;
|
||||
@ApiModelProperty(value = "是否有视频")
|
||||
private Boolean hasVideo;
|
||||
@ApiModelProperty(value = "标签")
|
||||
private List<String> tags;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.ruoyi.xkt.dto.advertRound.pc.newProd;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
|
@ -36,6 +35,8 @@ public class PCNewRecommendDTO {
|
|||
private String prodPrice;
|
||||
@ApiModelProperty(value = "是否广告")
|
||||
private Boolean advert;
|
||||
@ApiModelProperty(value = "是否有视频")
|
||||
private Boolean hasVideo;
|
||||
@ApiModelProperty(value = "标签")
|
||||
private List<String> tags;
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ public class ESProductDTO {
|
|||
private String storeName;
|
||||
@ApiModelProperty(value = "风格")
|
||||
private String style;
|
||||
@ApiModelProperty(value = "是否有视频")
|
||||
private Boolean hasVideo;
|
||||
@ApiModelProperty(value = "标签")
|
||||
private List<String> tags;
|
||||
@ApiModelProperty(value = "标题")
|
||||
|
|
|
|||
|
|
@ -38,5 +38,7 @@ public class StoreProdPriceAndMainPicAndTagDTO {
|
|||
private String mainPicUrl;
|
||||
@ApiModelProperty(value = "商品标题")
|
||||
private String prodTitle;
|
||||
@ApiModelProperty(value = "是否有主图视频")
|
||||
private Boolean hasVideo;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import com.ruoyi.xkt.dto.storeProductFile.StoreProdFileResDTO;
|
|||
import com.ruoyi.xkt.dto.storeProductFile.StoreProdMainPicDTO;
|
||||
import com.ruoyi.xkt.enums.EProductStatus;
|
||||
import com.ruoyi.xkt.enums.FileType;
|
||||
import com.ruoyi.xkt.enums.ListingType;
|
||||
import com.ruoyi.xkt.enums.ProductSizeStatus;
|
||||
import com.ruoyi.xkt.mapper.*;
|
||||
import com.ruoyi.xkt.service.IPictureService;
|
||||
|
|
@ -222,10 +223,13 @@ public class StoreProductServiceImpl implements IStoreProductService {
|
|||
this.handleStoreProdColorSizeList(storeProdDTO.getSizeList(), storeProd.getId(), Boolean.TRUE);
|
||||
// 处理StoreProduct其它属性
|
||||
this.handleStoreProdProperties(storeProd, storeProdDTO);
|
||||
// 向ES索引: product_info 创建文档
|
||||
this.createESDoc(storeProd, storeProdDTO);
|
||||
// 搜图服务同步
|
||||
sync2ImgSearchServer(storeProd.getId(), storeProdDTO.getFileList());
|
||||
// 立即发布 将商品同步到 ES 商品文档,并将商品主图同步到 以图搜款服务中
|
||||
if (Objects.equals(storeProd.getListingWay(), ListingType.RIGHT_NOW.getValue())) {
|
||||
// 向ES索引: product_info 创建文档
|
||||
this.createESDoc(storeProd, storeProdDTO);
|
||||
// 搜图服务同步
|
||||
sync2ImgSearchServer(storeProd.getId(), storeProdDTO.getFileList());
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
|
@ -758,6 +762,8 @@ public class StoreProductServiceImpl implements IStoreProductService {
|
|||
String firstMainPic = storeProdDTO.getFileList().stream().filter(x -> Objects.equals(x.getFileType(), FileType.MAIN_PIC.getValue()))
|
||||
.min(Comparator.comparing(StoreProdFileDTO::getOrderNum)).map(StoreProdFileDTO::getFileUrl)
|
||||
.orElseThrow(() -> new ServiceException("商品主图不存在!", HttpStatus.ERROR));
|
||||
// 是否有主图视频
|
||||
boolean hasVideo = storeProdDTO.getFileList().stream().anyMatch(x -> Objects.equals(x.getFileType(), FileType.MAIN_PIC_VIDEO.getValue()));
|
||||
// 获取上一级分类的分类ID 及 分类名称
|
||||
ProdCateDTO parCate = this.prodCateMapper.getParentCate(storeProdDTO.getProdCateId());
|
||||
// 获取当前商品的最低价格
|
||||
|
|
@ -767,7 +773,7 @@ public class StoreProductServiceImpl implements IStoreProductService {
|
|||
String season = storeProdDTO.getCateAttr().getSuitableSeason();
|
||||
// 获取风格
|
||||
String style = storeProdDTO.getCateAttr().getStyle();
|
||||
return BeanUtil.toBean(storeProd, ESProductDTO.class)
|
||||
return BeanUtil.toBean(storeProd, ESProductDTO.class).setHasVideo(hasVideo)
|
||||
.setProdCateName(storeProdDTO.getProdCateName()).setSaleWeight("0").setRecommendWeight("0").setPopularityWeight("0")
|
||||
.setCreateTime(DateUtils.getTime()).setStoreName(storeProdDTO.getStoreName()).setMainPic(firstMainPic)
|
||||
.setParCateId(parCate.getProdCateId().toString()).setParCateName(parCate.getName()).setProdPrice(minPrice.toString())
|
||||
|
|
@ -869,4 +875,5 @@ public class StoreProductServiceImpl implements IStoreProductService {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
|
|||
return new Page<>(page.getPageNum(), page.getPageSize(), page.getPages(), page.getTotal(), realDataList);
|
||||
}
|
||||
// 从redis中获取广告
|
||||
List<APPIndexHotSaleDTO> redisList = this.redisCache.getCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_INDEX_HOT_SALE_ADVERT);
|
||||
List<APPIndexHotSaleDTO> redisList = this.redisCache.getCacheObject(CacheConstants.APP_INDEX_HOT_SALE_ADVERT);
|
||||
if (CollectionUtils.isNotEmpty(redisList)) {
|
||||
// 添加广告的数据
|
||||
return new Page<>(page.getPageNum(), page.getPageSize(), page.getPages(), page.getTotal(), insertAdvertsIntoList(realDataList, redisList, Constants.insertPositions));
|
||||
|
|
@ -105,6 +105,7 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
|
|||
List<APPIndexHotSaleDTO> hotSaleList = advertRoundList.stream().filter(x -> StringUtils.isNotBlank(x.getProdIdStr())).map(x -> {
|
||||
StoreProdPriceAndMainPicAndTagDTO attrDto = attrMap.get(Long.parseLong(x.getProdIdStr()));
|
||||
return new APPIndexHotSaleDTO().setAdvert(Boolean.TRUE).setStoreId(x.getStoreId().toString()).setStoreProdId(x.getProdIdStr())
|
||||
.setHasVideo(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getHasVideo() : Boolean.FALSE)
|
||||
.setTags(StringUtils.isNotBlank(attrDto.getTagStr()) ? StrUtil.split(attrDto.getTagStr(), ",") : null)
|
||||
.setStoreName(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getStoreName() : "")
|
||||
.setProdPrice(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getMinPrice().toString() : null)
|
||||
|
|
@ -112,7 +113,7 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
|
|||
.setMainPic(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getMainPicUrl() : "");
|
||||
}).collect(Collectors.toList());
|
||||
// 放到redis中 有效期1天
|
||||
this.redisCache.setCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_INDEX_HOT_SALE_ADVERT, hotSaleList, 1, TimeUnit.DAYS);
|
||||
this.redisCache.setCacheObject(CacheConstants.APP_INDEX_HOT_SALE_ADVERT, hotSaleList, 1, TimeUnit.DAYS);
|
||||
// 添加了广告的数据
|
||||
return new Page<>(page.getPageNum(), page.getPageSize(), page.getPages(), page.getTotal(), insertAdvertsIntoList(realDataList, hotSaleList, Constants.insertPositions));
|
||||
}
|
||||
|
|
@ -138,7 +139,7 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
|
|||
return new Page<>(page.getPageNum(), page.getPageSize(), page.getPages(), page.getTotal(), realDataList);
|
||||
}
|
||||
// 从redis中获取数据
|
||||
List<APPIndexPopularSaleDTO> redisList = this.redisCache.getCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_INDEX_POPULAR_SALE_ADVERT);
|
||||
List<APPIndexPopularSaleDTO> redisList = this.redisCache.getCacheObject(CacheConstants.APP_INDEX_POPULAR_SALE_ADVERT);
|
||||
if (CollectionUtils.isNotEmpty(redisList)) {
|
||||
// 添加广告的数据
|
||||
return new Page<>(page.getPageNum(), page.getPageSize(), page.getPages(), page.getTotal(), insertAdvertsIntoList(realDataList, redisList, Constants.insertPositions));
|
||||
|
|
@ -157,6 +158,7 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
|
|||
List<APPIndexPopularSaleDTO> popularSaleList = advertRoundList.stream().filter(x -> StringUtils.isNotBlank(x.getProdIdStr())).map(x -> {
|
||||
StoreProdPriceAndMainPicAndTagDTO attrDto = attrMap.get(Long.parseLong(x.getProdIdStr()));
|
||||
return new APPIndexPopularSaleDTO().setAdvert(Boolean.TRUE).setStoreId(x.getStoreId().toString()).setStoreProdId(x.getProdIdStr())
|
||||
.setHasVideo(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getHasVideo() : Boolean.FALSE)
|
||||
.setTags(StringUtils.isNotBlank(attrDto.getTagStr()) ? StrUtil.split(attrDto.getTagStr(), ",") : null)
|
||||
.setStoreName(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getStoreName() : "")
|
||||
.setProdPrice(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getMinPrice().toString() : null)
|
||||
|
|
@ -164,7 +166,7 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
|
|||
.setMainPic(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getMainPicUrl() : "");
|
||||
}).collect(Collectors.toList());
|
||||
// 放到redis中 有效期1天
|
||||
this.redisCache.setCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_INDEX_POPULAR_SALE_ADVERT, popularSaleList, 1, TimeUnit.DAYS);
|
||||
this.redisCache.setCacheObject( CacheConstants.APP_INDEX_POPULAR_SALE_ADVERT, popularSaleList, 1, TimeUnit.DAYS);
|
||||
// 添加了广告的数据
|
||||
return new Page<>(page.getPageNum(), page.getPageSize(), page.getPages(), page.getTotal(), insertAdvertsIntoList(realDataList, popularSaleList, Constants.insertPositions));
|
||||
}
|
||||
|
|
@ -190,7 +192,7 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
|
|||
return new Page<>(page.getPageNum(), page.getPageSize(), page.getPages(), page.getTotal(), realDataList);
|
||||
}
|
||||
// 从redis中获取数据
|
||||
List<APPIndexNewProdDTO> redisList = this.redisCache.getCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_INDEX_NEW_PROD);
|
||||
List<APPIndexNewProdDTO> redisList = this.redisCache.getCacheObject(CacheConstants.APP_INDEX_NEW_PROD);
|
||||
if (CollectionUtils.isNotEmpty(redisList)) {
|
||||
// 添加广告的数据
|
||||
return new Page<>(page.getPageNum(), page.getPageSize(), page.getPages(), page.getTotal(), insertAdvertsIntoList(realDataList, redisList, Constants.insertPositions));
|
||||
|
|
@ -209,6 +211,7 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
|
|||
List<APPIndexNewProdDTO> newProdList = advertRoundList.stream().filter(x -> StringUtils.isNotBlank(x.getProdIdStr())).map(x -> {
|
||||
StoreProdPriceAndMainPicAndTagDTO attrDto = attrMap.get(Long.parseLong(x.getProdIdStr()));
|
||||
return new APPIndexNewProdDTO().setAdvert(Boolean.TRUE).setStoreId(x.getStoreId().toString()).setStoreProdId(x.getProdIdStr())
|
||||
.setHasVideo(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getHasVideo() : Boolean.FALSE)
|
||||
.setTags(StringUtils.isNotBlank(attrDto.getTagStr()) ? StrUtil.split(attrDto.getTagStr(), ",") : null)
|
||||
.setStoreName(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getStoreName() : "")
|
||||
.setProdPrice(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getMinPrice().toString() : null)
|
||||
|
|
@ -216,7 +219,7 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
|
|||
.setMainPic(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getMainPicUrl() : "");
|
||||
}).collect(Collectors.toList());
|
||||
// 放到redis中 有效期1天
|
||||
this.redisCache.setCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_INDEX_NEW_PROD, newProdList, 1, TimeUnit.DAYS);
|
||||
this.redisCache.setCacheObject(CacheConstants.APP_INDEX_NEW_PROD, newProdList, 1, TimeUnit.DAYS);
|
||||
// 添加了广告的数据
|
||||
return new Page<>(page.getPageNum(), page.getPageSize(), page.getPages(), page.getTotal(), insertAdvertsIntoList(realDataList, newProdList, Constants.insertPositions));
|
||||
}
|
||||
|
|
@ -242,7 +245,7 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
|
|||
return new Page<>(page.getPageNum(), page.getPageSize(), page.getPages(), page.getTotal(), realDataList);
|
||||
}
|
||||
// 从redis中获取数据
|
||||
List<APPSearchDTO> redisList = this.redisCache.getCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_SEARCH);
|
||||
List<APPSearchDTO> redisList = this.redisCache.getCacheObject(CacheConstants.APP_SEARCH);
|
||||
if (CollectionUtils.isNotEmpty(redisList)) {
|
||||
// 添加广告的数据
|
||||
return new Page<>(page.getPageNum(), page.getPageSize(), page.getPages(), page.getTotal(), insertAdvertsIntoList(realDataList, redisList, Constants.insertPositions));
|
||||
|
|
@ -261,6 +264,7 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
|
|||
List<APPSearchDTO> newProdList = advertRoundList.stream().filter(x -> StringUtils.isNotBlank(x.getProdIdStr())).map(x -> {
|
||||
StoreProdPriceAndMainPicAndTagDTO attrDto = attrMap.get(Long.parseLong(x.getProdIdStr()));
|
||||
return new APPSearchDTO().setAdvert(Boolean.TRUE).setStoreId(x.getStoreId().toString()).setStoreProdId(x.getProdIdStr())
|
||||
.setHasVideo(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getHasVideo() : Boolean.FALSE)
|
||||
.setTags(StringUtils.isNotBlank(attrDto.getTagStr()) ? StrUtil.split(attrDto.getTagStr(), ",") : null)
|
||||
.setStoreName(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getStoreName() : "")
|
||||
.setProdPrice(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getMinPrice().toString() : null)
|
||||
|
|
@ -268,7 +272,7 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
|
|||
.setMainPic(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getMainPicUrl() : "");
|
||||
}).collect(Collectors.toList());
|
||||
// 放到redis中 有效期1天
|
||||
this.redisCache.setCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_SEARCH, newProdList, 1, TimeUnit.DAYS);
|
||||
this.redisCache.setCacheObject(CacheConstants.APP_SEARCH, newProdList, 1, TimeUnit.DAYS);
|
||||
// 添加了广告的数据
|
||||
return new Page<>(page.getPageNum(), page.getPageSize(), page.getPages(), page.getTotal(), insertAdvertsIntoList(realDataList, newProdList, Constants.insertPositions));
|
||||
}
|
||||
|
|
@ -380,7 +384,8 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
|
|||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<APPIndexHotSaleRightFixDTO> getAppIndexHotSaleRightFix() {
|
||||
// 从redis中获取数据
|
||||
return null;
|
||||
/*// 从redis中获取数据
|
||||
List<APPIndexHotSaleRightFixDTO> appIndexHotSaleRightFixList;
|
||||
// 从redis 中获取数据
|
||||
List<APPIndexHotSaleRightFixDTO> redisList = redisCache.getCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_INDEX_HOT_SALE_RIGHT_FIX);
|
||||
|
|
@ -418,7 +423,7 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
|
|||
}
|
||||
// 放到redis中,有效期1天
|
||||
redisCache.setCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_INDEX_HOT_SALE_RIGHT_FIX, appIndexHotSaleRightFixList, 1, TimeUnit.DAYS);
|
||||
return appIndexHotSaleRightFixList;
|
||||
return appIndexHotSaleRightFixList;*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -498,6 +503,7 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
|
|||
final Long storeProdId = Long.parseLong(x.getProdIdStr());
|
||||
StoreProdPriceAndMainPicAndTagDTO dto = attrMap.get(storeProdId);
|
||||
return new APPOwnGuessLikeDTO().setDisplayType(AdDisplayType.PRODUCT.getValue()).setStoreProdId(storeProdId)
|
||||
.setHasVideo(ObjectUtils.isNotEmpty(dto) ? dto.getHasVideo() : Boolean.FALSE)
|
||||
.setTags(ObjectUtils.isNotEmpty(dto) ? dto.getTags() : null)
|
||||
.setPrice(ObjectUtils.isNotEmpty(dto) ? dto.getMinPrice() : null)
|
||||
.setProdArtNum(ObjectUtils.isNotEmpty(dto) ? dto.getProdArtNum() : "")
|
||||
|
|
@ -510,7 +516,9 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
|
|||
appOwnGuessLikeList = launchingList.stream().filter(x -> StringUtils.isNotBlank(x.getProdIdStr())).map(x -> {
|
||||
final Long storeProdId = Long.parseLong(x.getProdIdStr());
|
||||
StoreProdPriceAndMainPicAndTagDTO dto = attrMap.get(storeProdId);
|
||||
return new APPOwnGuessLikeDTO().setDisplayType(AdDisplayType.PRODUCT.getValue()).setStoreProdId(storeProdId).setOrderNum(this.positionToNumber(x.getPosition()))
|
||||
return new APPOwnGuessLikeDTO().setDisplayType(AdDisplayType.PRODUCT.getValue()).setStoreProdId(storeProdId)
|
||||
.setOrderNum(this.positionToNumber(x.getPosition()))
|
||||
.setHasVideo(ObjectUtils.isNotEmpty(dto) ? dto.getHasVideo() : Boolean.FALSE)
|
||||
.setTags(ObjectUtils.isNotEmpty(dto) ? dto.getTags() : null)
|
||||
.setPrice(ObjectUtils.isNotEmpty(dto) ? dto.getMinPrice() : null)
|
||||
.setProdArtNum(ObjectUtils.isNotEmpty(dto) ? dto.getProdArtNum() : "")
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public class WebsitePCServiceImpl implements IWebsitePCService {
|
|||
return new Page<>(page.getPageNum(), page.getPageSize(), page.getPages(), page.getTotal(), realDataList);
|
||||
}
|
||||
// 从redis中获取数据
|
||||
List<PCIndexRecommendDTO> redisList = this.redisCache.getCacheObject(CacheConstants.PC_ADVERT + CacheConstants.PC_INDEX_RECOMMEND);
|
||||
List<PCIndexRecommendDTO> redisList = this.redisCache.getCacheObject(CacheConstants.PC_INDEX_RECOMMEND);
|
||||
if (CollectionUtils.isNotEmpty(redisList)) {
|
||||
redisList = redisList.stream()
|
||||
.filter(x -> CollectionUtils.isEmpty(searchDTO.getParCateIdList()) || searchDTO.getParCateIdList().contains(x.getParCateId().toString()))
|
||||
|
|
@ -128,6 +128,7 @@ public class WebsitePCServiceImpl implements IWebsitePCService {
|
|||
prodIdList.forEach(storeProdId -> {
|
||||
StoreProdPriceAndMainPicAndTagDTO attrDto = attrMap.get(storeProdId);
|
||||
indexRecommendList.add(new PCIndexRecommendDTO().setAdvert(Boolean.TRUE).setStoreId(x.getStoreId().toString())
|
||||
.setHasVideo(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getHasVideo() : Boolean.FALSE)
|
||||
.setParCateId(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getParCateId() : null)
|
||||
.setProdCateId(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getProdCateId() : null)
|
||||
.setStoreProdId(storeProdId.toString()).setTags(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getTags() : null)
|
||||
|
|
@ -141,7 +142,7 @@ public class WebsitePCServiceImpl implements IWebsitePCService {
|
|||
// 将indexRecommendList 顺序打乱,不然一个档口的数据在同一地方展示
|
||||
Collections.shuffle(indexRecommendList);
|
||||
// 放到redis中 有效期1天
|
||||
this.redisCache.setCacheObject(CacheConstants.PC_ADVERT + CacheConstants.PC_INDEX_RECOMMEND, indexRecommendList, 1, TimeUnit.DAYS);
|
||||
this.redisCache.setCacheObject(CacheConstants.PC_INDEX_RECOMMEND, indexRecommendList, 1, TimeUnit.DAYS);
|
||||
List<PCIndexRecommendDTO> tempList = indexRecommendList.stream()
|
||||
.filter(x -> CollectionUtils.isEmpty(searchDTO.getParCateIdList()) || searchDTO.getParCateIdList().contains(x.getParCateId().toString()))
|
||||
.filter(x -> CollectionUtils.isEmpty(searchDTO.getProdCateIdList()) || searchDTO.getProdCateIdList().contains(x.getProdCateId().toString()))
|
||||
|
|
@ -171,7 +172,7 @@ public class WebsitePCServiceImpl implements IWebsitePCService {
|
|||
return new Page<>(page.getPageNum(), page.getPageSize(), page.getPages(), page.getTotal(), realDataList);
|
||||
}
|
||||
// 从redis中获取数据
|
||||
List<PCNewRecommendDTO> redisList = this.redisCache.getCacheObject(CacheConstants.PC_ADVERT + CacheConstants.PC_NEW_RECOMMEND);
|
||||
List<PCNewRecommendDTO> redisList = this.redisCache.getCacheObject(CacheConstants.PC_NEW_RECOMMEND);
|
||||
if (CollectionUtils.isNotEmpty(redisList)) {
|
||||
redisList = redisList.stream()
|
||||
.filter(x -> CollectionUtils.isEmpty(searchDTO.getParCateIdList()) || searchDTO.getParCateIdList().contains(x.getParCateId().toString()))
|
||||
|
|
@ -200,6 +201,7 @@ public class WebsitePCServiceImpl implements IWebsitePCService {
|
|||
prodIdList.forEach(storeProdId -> {
|
||||
StoreProdPriceAndMainPicAndTagDTO attrDto = attrMap.get(storeProdId);
|
||||
newRecommendList.add(new PCNewRecommendDTO().setAdvert(Boolean.TRUE).setStoreId(x.getStoreId().toString())
|
||||
.setHasVideo(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getHasVideo() : Boolean.FALSE)
|
||||
.setParCateId(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getParCateId() : null)
|
||||
.setProdCateId(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getProdCateId() : null)
|
||||
.setStoreProdId(storeProdId.toString()).setTags(ObjectUtils.isNotEmpty(attrDto) ? attrDto.getTags() : null)
|
||||
|
|
@ -213,7 +215,7 @@ public class WebsitePCServiceImpl implements IWebsitePCService {
|
|||
// newRecommendList 顺序打乱,不然一个档口的数据在同一地方展示
|
||||
Collections.shuffle(newRecommendList);
|
||||
// 放到redis中 有效期1天
|
||||
this.redisCache.setCacheObject(CacheConstants.PC_ADVERT + CacheConstants.PC_NEW_RECOMMEND, newRecommendList, 1, TimeUnit.DAYS);
|
||||
this.redisCache.setCacheObject(CacheConstants.PC_NEW_RECOMMEND, newRecommendList, 1, TimeUnit.DAYS);
|
||||
List<PCNewRecommendDTO> tempList = newRecommendList.stream()
|
||||
.filter(x -> CollectionUtils.isEmpty(searchDTO.getParCateIdList()) || searchDTO.getParCateIdList().contains(x.getParCateId().toString()))
|
||||
.filter(x -> CollectionUtils.isEmpty(searchDTO.getProdCateIdList()) || searchDTO.getProdCateIdList().contains(x.getProdCateId().toString()))
|
||||
|
|
|
|||
|
|
@ -130,19 +130,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
MIN( spcp.price ) AS minPrice,
|
||||
sp.store_id,
|
||||
s.store_name,
|
||||
GROUP_CONCAT( DISTINCT dpt.tag ORDER BY dpt.type ASC ) AS tagStr
|
||||
GROUP_CONCAT( DISTINCT dpt.tag ORDER BY dpt.type ASC ) AS tagStr,
|
||||
EXISTS( SELECT 1 FROM store_product_file spf2 WHERE spf2.store_prod_id = sp.id AND spf2.del_flag = 0 AND spf2.file_type = 2 LIMIT 1 ) AS hasVideo
|
||||
FROM
|
||||
store_product sp
|
||||
LEFT JOIN store_product_color_price spcp ON sp.id = spcp.store_prod_id
|
||||
LEFT JOIN store_product_file spf ON sp.id = spf.store_prod_id AND spf.del_flag = 0
|
||||
LEFT JOIN store_product_file spf ON sp.id = spf.store_prod_id AND spf.del_flag = 0 AND spf.file_type = 1 AND spf.order_num = 1
|
||||
LEFT JOIN sys_file sf ON spf.file_id = sf.id
|
||||
LEFT JOIN store s ON sp.store_id = s.id
|
||||
LEFT JOIN daily_prod_tag dpt ON sp.id = dpt.store_prod_id AND dpt.del_flag = 0
|
||||
LEFT JOIN sys_product_category spc ON sp.prod_cate_id = spc.id
|
||||
WHERE
|
||||
sp.del_flag = 0
|
||||
AND spf.file_type = 1
|
||||
AND spf.order_num = 1
|
||||
AND sp.id IN
|
||||
<foreach item="id" collection="storeProdIdList" open="(" separator="," close=")">
|
||||
#{id}
|
||||
|
|
|
|||
Loading…
Reference in New Issue