commit
cf7b333662
@ -1,13 +1,13 @@
|
||||
package cn.lili.modules.member.serviceimpl;
|
||||
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.modules.goods.entity.dos.GoodsSku;
|
||||
import cn.lili.modules.goods.service.GoodsSkuService;
|
||||
import cn.lili.modules.member.entity.dos.FootPrint;
|
||||
import cn.lili.modules.member.entity.dto.FootPrintQueryParams;
|
||||
import cn.lili.modules.member.mapper.FootprintMapper;
|
||||
import cn.lili.modules.member.service.FootprintService;
|
||||
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
||||
import cn.lili.modules.search.service.EsGoodsSearchService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -18,9 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -34,7 +32,7 @@ public class FootprintServiceImpl extends ServiceImpl<FootprintMapper, FootPrint
|
||||
|
||||
|
||||
@Autowired
|
||||
private EsGoodsSearchService esGoodsSearchService;
|
||||
private GoodsSkuService goodsSkuService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ -74,23 +72,25 @@ public class FootprintServiceImpl extends ServiceImpl<FootprintMapper, FootPrint
|
||||
|
||||
@Override
|
||||
public IPage<EsGoodsIndex> footPrintPage(FootPrintQueryParams params) {
|
||||
IPage<FootPrint> footPrintPages = this.page(PageUtil.initPage(params), params.queryWrapper());
|
||||
params.setSort("createTime");
|
||||
Page<FootPrint> footPrintPages = this.page(PageUtil.initPage(params), params.queryWrapper());
|
||||
//定义结果
|
||||
IPage<EsGoodsIndex> esGoodsIndexIPage = new Page<>();
|
||||
|
||||
if (footPrintPages.getRecords() == null || footPrintPages.getRecords().isEmpty()) {
|
||||
return esGoodsIndexIPage;
|
||||
} else {
|
||||
List<EsGoodsIndex> list = esGoodsSearchService.getEsGoodsBySkuIds(
|
||||
footPrintPages.getRecords().stream().map(FootPrint::getSkuId).collect(Collectors.toList()), params);
|
||||
Page<EsGoodsIndex> esGoodsIndexIPage = new Page<>();
|
||||
|
||||
if (footPrintPages.getRecords() != null && !footPrintPages.getRecords().isEmpty()) {
|
||||
List<String> skuIds = footPrintPages.getRecords().stream().map(FootPrint::getSkuId).collect(Collectors.toList());
|
||||
List<GoodsSku> goodsSkuByIdFromCache = goodsSkuService.getGoodsSkuByIdFromCache(skuIds);
|
||||
esGoodsIndexIPage.setPages(footPrintPages.getPages());
|
||||
esGoodsIndexIPage.setRecords(list);
|
||||
esGoodsIndexIPage.setRecords(goodsSkuByIdFromCache.stream().map(i -> {
|
||||
Optional<FootPrint> first = footPrintPages.getRecords().stream().filter(j -> j.getSkuId().equals(i.getId())).findFirst();
|
||||
return first.map(footPrint -> new EsGoodsIndex(i, footPrint.getCreateTime())).orElseGet(() -> new EsGoodsIndex(i));
|
||||
}).sorted(Comparator.comparingLong(EsGoodsIndex::getReleaseTime).reversed()).collect(Collectors.toList()));
|
||||
esGoodsIndexIPage.setTotal(footPrintPages.getTotal());
|
||||
esGoodsIndexIPage.setSize(footPrintPages.getSize());
|
||||
esGoodsIndexIPage.setCurrent(footPrintPages.getCurrent());
|
||||
return esGoodsIndexIPage;
|
||||
}
|
||||
return esGoodsIndexIPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,5 @@
|
||||
package cn.lili.modules.member.serviceimpl;
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.properties.RocketmqCustomProperties;
|
||||
@ -8,7 +7,6 @@ import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.CurrencyUtil;
|
||||
import cn.lili.common.utils.DateUtil;
|
||||
import cn.lili.modules.goods.entity.dos.Specification;
|
||||
import cn.lili.modules.member.entity.dos.MemberSign;
|
||||
import cn.lili.modules.member.entity.enums.PointTypeEnum;
|
||||
import cn.lili.modules.member.mapper.MemberSignMapper;
|
||||
@ -21,10 +19,7 @@ import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
import cn.lili.rocketmq.RocketmqSendCallbackBuilder;
|
||||
import cn.lili.rocketmq.tags.MemberTagsEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.gson.Gson;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
@ -73,7 +68,7 @@ public class MemberSignServiceImpl extends ServiceImpl<MemberSignMapper, MemberS
|
||||
LambdaQueryWrapper<MemberSign> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(MemberSign::getMemberId, authUser.getId());
|
||||
List<MemberSign> signSize = this.baseMapper.getTodayMemberSign(queryWrapper);
|
||||
if (signSize.isEmpty()) {
|
||||
if (!signSize.isEmpty()) {
|
||||
throw new ServiceException(ResultCode.MEMBER_SIGN_REPEAT);
|
||||
}
|
||||
//当前签到天数的前一天日期
|
||||
|
@ -102,6 +102,9 @@ public class CartSkuVO extends CartBase implements Serializable {
|
||||
*/
|
||||
public CartSkuVO(GoodsSku goodsSku) {
|
||||
this.goodsSku = goodsSku;
|
||||
if (goodsSku.getUpdateTime() == null) {
|
||||
this.goodsSku.setUpdateTime(goodsSku.getCreateTime());
|
||||
}
|
||||
this.checked = true;
|
||||
this.invalid = false;
|
||||
//默认时间为0,让系统为此商品更新缓存
|
||||
|
@ -112,6 +112,7 @@ public abstract class AbstractPromotionsServiceImpl<M extends BaseMapper<T>, T e
|
||||
List<T> promotionsList = this.list(new QueryWrapper<T>().in("id", ids));
|
||||
for (T t : promotionsList) {
|
||||
if (startTime != null && endTime != null) {
|
||||
this.checkPromotions(t);
|
||||
t.setStartTime(new Date(startTime));
|
||||
t.setEndTime(new Date(endTime));
|
||||
} else {
|
||||
|
@ -350,6 +350,11 @@ public class EsGoodsIndex implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public EsGoodsIndex(GoodsSku sku, Date createDate) {
|
||||
this(sku);
|
||||
this.releaseTime = createDate.getTime();
|
||||
}
|
||||
|
||||
public void setGoodsSku(GoodsSku sku) {
|
||||
if (sku != null) {
|
||||
this.id = sku.getId();
|
||||
|
Loading…
x
Reference in New Issue
Block a user