Merge branch 'master' into Bulbasaur

This commit is contained in:
lifenlong
2021-06-23 15:38:43 +08:00
45 changed files with 566 additions and 249 deletions

View File

@@ -5,10 +5,8 @@ import cn.lili.common.exception.ServiceException;
import com.google.common.collect.ImmutableList;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
@@ -18,7 +16,6 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;
import java.lang.reflect.Method;
/**
* 流量拦截
@@ -43,40 +40,34 @@ public class LimitInterceptor {
this.limitScript = limitScript;
}
@Around("execution(public * *(..)) && @annotation(cn.lili.common.aop.limiter.annotation.LimitPoint)")
public Object interceptor(ProceedingJoinPoint pjp) throws Throwable {
MethodSignature signature = (MethodSignature) pjp.getSignature();
Method method = signature.getMethod();
LimitPoint limitPointAnnotation = method.getAnnotation(LimitPoint.class);
@Before("@annotation(limitPointAnnotation)")
public void interceptor(LimitPoint limitPointAnnotation) {
LimitType limitType = limitPointAnnotation.limitType();
String name = limitPointAnnotation.name();
String key;
int limitPeriod = limitPointAnnotation.period();
int limitCount = limitPointAnnotation.limit();
switch (limitType) {
case IP:
key = limitPointAnnotation.key() + getIpAddress();
break;
case CUSTOMER:
key = limitPointAnnotation.key();
break;
default:
key = StringUtils.upperCase(method.getName());
key = limitPointAnnotation.key() + getIpAddress();
}
ImmutableList<String> keys = ImmutableList.of(StringUtils.join(limitPointAnnotation.prefix(), key));
try {
Number count = redisTemplate.execute(limitScript, keys, limitCount, limitPeriod);
log.info("Access try count is {} for name={} and key = {}", count, name, key);
log.info("限制请求{}, 当前请求{},缓存key{}", limitCount, count.intValue(), key);
//如果缓存里没有值,或者他的值小于限制频率
if (count.intValue() <= limitCount) {
return pjp.proceed();
} else {
if (count.intValue() >= limitCount) {
throw new ServiceException("访问过于频繁,请稍后再试");
}
}
//如果从redis中执行都值判定为空则这里跳过
catch (NullPointerException e) {
return pjp.proceed();
return;
} catch (ServiceException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException("服务器异常,请稍后再试");
}

View File

@@ -17,7 +17,7 @@ public enum ResultCode {
/**
* 失败返回码
*/
ERROR(400, "失败"),
ERROR(400, "服务器繁忙,请稍后重试"),
/**
* 失败返回码
@@ -34,6 +34,7 @@ public enum ResultCode {
*/
WECHAT_CONNECT_NOT_EXIST(1001, "微信联合登录未配置"),
VERIFICATION_EXIST(1002, "验证码服务异常"),
/**
* 分类
*/
@@ -50,83 +51,126 @@ public enum ResultCode {
/**
* 商品
*/
GOODS_ERROR(11010, "读取商品异常"),
GOODS_NOT_EXIST(11001, "商品已下架"),
GOODS_NAME_ERROR(11002, "商品名称不正确名称应为2-50字符"),
GOODS_UNDER_ERROR(11003, "商品下架失败"),
GOODS_UPPER_ERROR(11004, "商品上架失败"),
GOODS_AUTH_ERROR(11005, "商品审核失败"),
POINT_GOODS_ERROR(11006, "积分商品业务异常,请稍后重试"),
GOODS_SKU_SN_ERROR(11007, "商品SKU编号不能为空"),
GOODS_SKU_PRICE_ERROR(11008, "商品SKU价格不能小于等于0"),
GOODS_SKU_COST_ERROR(11009, "商品SKU成本价不能小于等于0"),
GOODS_SKU_WEIGHT_ERROR(11010, "商品重量不能为负数"),
GOODS_SKU_QUANTITY_ERROR(11011, "商品库存数量不能为负数"),
/**
* 参数
*/
PARAMETER_SAVE_ERROR(12001, "参数添加失败"),
PARAMETER_UPDATE_ERROR(12002, "参数编辑失败"),
/**
* 规格
*/
SPEC_SAVE_ERROR(13001, "规格修改失败"),
SPEC_UPDATE_ERROR(13002, "规格修改失败"),
SPEC_DELETE_ERROR(13003, "此规格已绑定分类不允许删除"),
/**
* 品牌
*/
BRAND_SAVE_ERROR(14001, "品牌添加失败"),
BRAND_UPDATE_ERROR(14002, "品牌修改失败"),
BRAND_DISABLE_ERROR(14003, "品牌禁用失败"),
BRAND_DELETE_ERROR(14004, "品牌删除失败"),
/**
* 用户
*/
USER_EDIT_SUCCESS(20001, "用户修改成功"),
USER_NOT_EXIST(20002, "用户不存在"),
USER_NOT_LOGIN(20003, "用户未登录"),
USER_AUTH_EXPIRED(20004, "用户已退出,请重新登录"),
USER_AUTHORITY_ERROR(20005, "权限不足"),
USER_CONNECT_LOGIN_ERROR(20006, "未找到登录信息"),
USER_NAME_EXIST(20007, "该用户名已被注册"),
USER_PHONE_EXIST(20008, "该手机号已被注册"),
USER_PHONE_NOT_EXIST(20009, "手机号不存在"),
USER_PASSWORD_ERROR(20010, "密码不正确"),
USER_NOT_PHONE(20011, "非当前用户的手机号"),
USER_CONNECT_ERROR(20012, "联合第三方登录,授权信息错误"),
USER_RECEIPT_REPEAT_ERROR(20013, "会员发票信息重复"),
USER_RECEIPT_NOT_EXIST(20014, "会员发票信息不存在"),
USER_EDIT_ERROR(20015, "用户修改失败"),
USER_OLD_PASSWORD_ERROR(20016, "旧密码不正确"),
USER_COLLECTION_EXIST(20017, "无法重复收藏"),
USER_GRADE_IS_DEFAULT(20018, "会员等级为默认会员等级"),
DELETE_EXIST(2001, "无法重复收藏"),
/**
* 权限
*/
PERMISSION_DEPARTMENT_ROLE_ERROR(21001, "角色已绑定部门,请逐个删除"),
PERMISSION_USER_ROLE_ERROR(21002, "角色已绑定管理员,请逐个删除"),
PERMISSION_MENU_ROLE_ERROR(21003, "菜单已绑定角色,请先删除或编辑角色"),
PERMISSION_DEPARTMENT_DELETE_ERROR(21004, "部门已经绑定管理员,请先删除或编辑管理员"),
PERMISSION_BEYOND_TEN(21005, "最多可以设置10个角色"),
/**
* 分销
*/
DISTRIBUTION_CLOSE(22000, "分销功能关闭"),
DISTRIBUTION_NOT_EXIST(22001, "分销员不存在"),
DISTRIBUTION_IS_APPLY(22002, "分销员已申请,无需重复提交"),
DISTRIBUTION_AUDIT_ERROR(22003, "审核分销员失败"),
DISTRIBUTION_RETREAT_ERROR(22004, "分销员清退失败"),
DISTRIBUTION_CASH_NOT_EXIST(22005, "分销员提现记录不存在"),
DISTRIBUTION_GOODS_DOUBLE(22006, "不能重复添加分销商品"),
/**
* 购物车
*/
CART_ERROR(30001, "读取结算页的购物车异常"),
CART_PINTUAN_NOT_EXIST_ERROR(30002, "拼团活动不存在错误"),
CART_PINTUAN_LIMIT_ERROR(30003, "购买数量超过拼团活动限制数量"),
SHIPPING_NOT_APPLY(30005, "购物商品不支持当前收货地址配送"),
/**

View File

@@ -87,6 +87,9 @@ public class DateUtil {
* @return
*/
public static Date endOfDate(Date date) {
if (date == null) {
date = new Date();
}
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.HOUR_OF_DAY, 23);
@@ -194,21 +197,23 @@ public class DateUtil {
/**
* 把日期转换成字符串型
*
* @param date 日期
* @param date 日期
* @return
*/
public static String toString(Date date) {
return toString(date,STANDARD_FORMAT);
return toString(date, STANDARD_FORMAT);
}
/**
* 把日期转换成字符串型
*
* @param Long 日期
* @param Long 日期
* @return
*/
public static String toString(Long date) {
return toString(date,STANDARD_FORMAT);
return toString(date, STANDARD_FORMAT);
}
/**
* 把日期转换成字符串型
*

View File

@@ -2,11 +2,14 @@ package cn.lili.modules.goods.entity.dos;
import cn.hutool.json.JSONUtil;
import cn.lili.base.BaseEntity;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.modules.goods.entity.dto.GoodsOperationDTO;
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.xkcoding.http.util.StringUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -16,6 +19,7 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.Max;
import java.util.Map;
/**
* 商品
@@ -222,6 +226,30 @@ public class Goods extends BaseEntity {
}
//如果立即上架则
this.marketEnable = goodsOperationDTO.isRelease() ? GoodsStatusEnum.UPPER.name() : GoodsStatusEnum.DOWN.name();
this.goodsType=goodsOperationDTO.getGoodsType();
this.goodsType = goodsOperationDTO.getGoodsType();
//循环sku判定sku是否有效
for (Map<String, Object> sku : goodsOperationDTO.getSkuList()) {
//判定参数不能为空
if (sku.get("sn") == null) {
throw new ServiceException(ResultCode.GOODS_SKU_SN_ERROR);
}
if (StringUtil.isEmpty(sku.get("price").toString()) || Integer.parseInt( sku.get("price").toString()) <= 0) {
throw new ServiceException(ResultCode.GOODS_SKU_PRICE_ERROR);
}
if (StringUtil.isEmpty(sku.get("cost").toString()) || Integer.parseInt( sku.get("cost").toString()) <= 0) {
throw new ServiceException(ResultCode.GOODS_SKU_COST_ERROR);
}
//虚拟商品没有重量字段
if(sku.containsKey("weight")) {
if (StringUtil.isEmpty(sku.get("weight").toString()) || Integer.parseInt(sku.get("weight").toString()) < 0) {
throw new ServiceException(ResultCode.GOODS_SKU_WEIGHT_ERROR);
}
}
if (StringUtil.isEmpty(sku.get("quantity").toString()) || Integer.parseInt( sku.get("quantity").toString()) < 0) {
throw new ServiceException(ResultCode.GOODS_SKU_QUANTITY_ERROR);
}
}
}
}

View File

@@ -6,10 +6,14 @@ import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* 商品关联参数
@@ -17,6 +21,7 @@ import javax.persistence.Table;
* @author pikachu
* @date 2020-02-23 9:14:33
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@Table(name = "li_goods_params")
@@ -52,4 +57,11 @@ public class GoodsParams extends BaseEntity {
@Length(max = 100, message = "参数值字符不能大于120")
private String paramValue;
@TableField(value = "is_index")
@ApiModelProperty(value = "是否可索引0 不显示 1 显示", required = true)
@NotNull(message = "是否可索引必选")
@Min(value = 0, message = "是否可索引传值不正确")
@Max(value = 1, message = "是否可索引传值不正确")
private Integer isIndex = 0;
}

View File

@@ -164,6 +164,13 @@ public class GoodsSku extends BaseEntity {
@ApiModelProperty(value = "商品类型", required = true)
private String goodsType;
public Double getWeight() {
if (weight == null) {
return 0d;
}
return weight;
}
@Override
public Date getUpdateTime() {
if (super.getUpdateTime() == null) {

View File

@@ -15,8 +15,8 @@ import lombok.Data;
public class SpecificationSearchParams {
@ApiModelProperty(value = "规格")
private String specName;
@ApiModelProperty(value = "规格id")
private String specId;
@ApiModelProperty(value = "绑定分类")
private String categoryPath;
@@ -26,7 +26,7 @@ public class SpecificationSearchParams {
public <T> QueryWrapper<T> queryWrapper() {
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
queryWrapper.like(StringUtils.isNotEmpty(specName), "spec_name", specName);
queryWrapper.eq(StringUtils.isNotEmpty(specId), "spec_id", specId);
queryWrapper.eq(deleteFlag != null, "delete_flag", deleteFlag);
return queryWrapper;
}

View File

@@ -94,6 +94,14 @@ public interface GoodsSkuService extends IService<GoodsSku> {
*/
List<GoodsSkuVO> getGoodsListByGoodsId(String goodsId);
/**
* 获取goodsId下所有的goodsSku
*
* @param goodsId 商品id
* @return goodsSku列表
*/
List<GoodsSku> getGoodsSkuListByGoodsId(String goodsId);
/**
* 根据goodsSku组装goodsSkuVO
*

View File

@@ -2,11 +2,13 @@ package cn.lili.modules.goods.serviceimpl;
import cn.lili.modules.goods.entity.dos.CategoryParameterGroup;
import cn.lili.modules.goods.entity.dos.GoodsParams;
import cn.lili.modules.goods.entity.dos.Parameters;
import cn.lili.modules.goods.entity.vos.GoodsParamsGroupVO;
import cn.lili.modules.goods.entity.vos.GoodsParamsVO;
import cn.lili.modules.goods.mapper.GoodsParamsMapper;
import cn.lili.modules.goods.service.CategoryParameterGroupService;
import cn.lili.modules.goods.service.GoodsParamsService;
import cn.lili.modules.goods.service.ParametersService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -36,6 +38,9 @@ public class GoodsParamsServiceImpl extends ServiceImpl<GoodsParamsMapper, Goods
@Autowired
private CategoryParameterGroupService categoryParameterGroupService;
@Autowired
private ParametersService parametersService;
@Override
public void addParams(List<GoodsParams> paramList, String goodsId) {
//先删除现有商品参数
@@ -43,10 +48,12 @@ public class GoodsParamsServiceImpl extends ServiceImpl<GoodsParamsMapper, Goods
//循环添加参数
if (paramList != null) {
for (GoodsParams param : paramList) {
Parameters parameters = parametersService.getById(param.getParamId());
GoodsParams goodsParams = new GoodsParams();
goodsParams.setGoodsId(goodsId);
goodsParams.setParamName(param.getParamName());
goodsParams.setParamValue(param.getParamValue());
goodsParams.setIsIndex(parameters.getIsIndex());
goodsParams.setParamId(param.getId());
this.save(goodsParams);
}

View File

@@ -5,6 +5,7 @@ import cn.hutool.core.util.NumberUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.lili.common.cache.Cache;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.rocketmq.RocketmqSendCallbackBuilder;
import cn.lili.common.rocketmq.tags.GoodsTagsEnum;
@@ -88,13 +89,12 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
@Override
public void add(List<Map<String, Object>> skuList, Goods goods) {
//检查是否需要生成索引
boolean needIndex = checkNeedIndex(goods);
// 检查是否需要生成索引
List<GoodsSku> newSkuList;
//如果有规格
if (skuList != null && !skuList.isEmpty()) {
//添加商品sku
newSkuList = this.addGoodsSku(skuList, goods, needIndex);
// 添加商品sku
newSkuList = this.addGoodsSku(skuList, goods);
} else {
throw new ServiceException("规格必须要有一个!");
}
@@ -103,24 +103,9 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
generateEsCheck(goods);
}
private boolean checkNeedIndex(Goods goods) {
if (goods.getParams() != null && !goods.getParams().isEmpty()) {
List<GoodsParams> goodsParams = JSONUtil.toList(goods.getParams(), GoodsParams.class);
for (GoodsParams goodsParam : goodsParams) {
Parameters parameters = parametersService.getById(goodsParam.getParamId());
if (parameters.getIsIndex() == 1) {
return true;
}
}
}
return false;
}
@Override
public void update(List<Map<String, Object>> skuList, Goods goods, Boolean regeneratorSkuFlag) {
//检查是否需要生成索引
boolean needIndex = checkNeedIndex(goods);
//是否存在规格
// 是否存在规格
if (skuList == null || skuList.isEmpty()) {
throw new ServiceException("规格必须要有一个!");
}
@@ -138,8 +123,8 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
this.removeByIds(oldSkuIds);
//删除sku相册
goodsGalleryService.removeByIds(oldSkuIds);
//添加商品sku
newSkuList = this.addGoodsSku(skuList, goods, needIndex);
// 添加商品sku
newSkuList = this.addGoodsSku(skuList, goods);
//发送mq消息
String destination = rocketmqCustomProperties.getGoodsTopic() + ":" + GoodsTagsEnum.SKU_DELETE.name();
@@ -161,9 +146,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
this.updateBatchById(newSkuList);
}
this.updateStock(newSkuList);
if (Boolean.TRUE.equals(needIndex)) {
generateEsCheck(goods);
}
generateEsCheck(goods);
}
/**
@@ -206,21 +189,22 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
Map<String, Object> map = new HashMap<>();
GoodsSku goodsSku = this.getGoodsSkuByIdFromCache(skuId);
GoodsVO goodsVO = goodsService.getGoodsVO(goodsId);
//如果规格为空则使用商品ID进行查询
if (goodsSku == null) {
GoodsVO goodsVO = goodsService.getGoodsVO(goodsId);
skuId = goodsVO.getSkuList().get(0).getId();
goodsSku = this.getGoodsSkuByIdFromCache(skuId);
//如果使用商品ID无法查询SKU则返回错误
if (goodsSku == null) {
throw new ServiceException("商品已下架");
throw new ServiceException(ResultCode.GOODS_NOT_EXIST);
}
} else if (!goodsSku.getMarketEnable().equals(GoodsStatusEnum.UPPER.name()) || !goodsVO.getIsAuth().equals(GoodsAuthEnum.PASS.name()) || Boolean.TRUE.equals(goodsSku.getDeleteFlag())) {
throw new ServiceException(ResultCode.GOODS_NOT_EXIST);
}
//获取当前商品的索引信息
EsGoodsIndex goodsIndex = goodsIndexService.findById(skuId);
if (goodsIndex == null) {
goodsIndex = new EsGoodsIndex(goodsSku);
goodsIndex.setPromotionMap(promotionService.getGoodsCurrentPromotionMap(goodsIndex));
goodsIndex = goodsIndexService.resetEsGoodsIndex(goodsSku, goodsVO.getGoodsParamsList());
}
//商品规格
GoodsSkuVO goodsSkuDetail = this.getGoodsSkuVO(goodsSku);
@@ -273,8 +257,16 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
updateWrapper.eq(GoodsSku::getGoodsId, goods.getId());
updateWrapper.set(GoodsSku::getMarketEnable, goods.getMarketEnable());
updateWrapper.set(GoodsSku::getIsAuth, goods.getIsAuth());
this.update(updateWrapper);
generateEsCheck(goods);
updateWrapper.set(GoodsSku::getDeleteFlag, goods.getDeleteFlag());
boolean update = this.update(updateWrapper);
if (Boolean.TRUE.equals(update)) {
List<GoodsSku> goodsSkus = this.getGoodsSkuListByGoodsId(goods.getId());
for (GoodsSku sku : goodsSkus) {
cache.remove(GoodsSkuService.getCacheKeys(sku.getId()));
cache.put(GoodsSkuService.getCacheKeys(sku.getId()), sku);
}
generateEsCheck(goods);
}
}
@Override
@@ -301,6 +293,17 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
return this.getGoodsSkuVOList(list);
}
/**
* 获取goodsId下所有的goodsSku
*
* @param goodsId 商品id
* @return goodsSku列表
*/
@Override
public List<GoodsSku> getGoodsSkuListByGoodsId(String goodsId) {
return this.list(new LambdaQueryWrapper<GoodsSku>().eq(GoodsSku::getGoodsId, goodsId));
}
@Override
public List<GoodsSkuVO> getGoodsSkuVOList(List<GoodsSku> list) {
List<GoodsSkuVO> goodsSkuVOS = new ArrayList<>();
@@ -451,24 +454,31 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
*/
private void generateEsCheck(Goods goods) {
//如果商品通过审核&&并且已上架
if (goods.getIsAuth().equals(GoodsAuthEnum.PASS.name()) && goods.getMarketEnable().equals(GoodsStatusEnum.UPPER.name())) {
List<GoodsSku> goodsSkuList = this.list(new LambdaQueryWrapper<GoodsSku>().eq(GoodsSku::getGoodsId, goods.getId()));
List<GoodsSku> goodsSkuList = this.list(new LambdaQueryWrapper<GoodsSku>().eq(GoodsSku::getGoodsId, goods.getId()));
if (goods.getIsAuth().equals(GoodsAuthEnum.PASS.name()) && goods.getMarketEnable().equals(GoodsStatusEnum.UPPER.name()) && Boolean.FALSE.equals(goods.getDeleteFlag())) {
List<EsGoodsIndex> goodsIndices = new ArrayList<>();
for (GoodsSku goodsSku : goodsSkuList) {
EsGoodsIndex esGoodsOld = goodsIndexService.findById(goodsSku.getId());
EsGoodsIndex goodsIndex = new EsGoodsIndex(goodsSku);
if (goods.getParams() != null && !goods.getParams().isEmpty()) {
List<GoodsParams> goodsParams = JSONUtil.toList(goods.getParams(), GoodsParams.class);
goodsIndex = new EsGoodsIndex(goodsSku, goodsParams);
}
//如果商品库存不为0并且es中有数据
if (goodsSku.getQuantity() > 0 && esGoodsOld == null) {
goodsIndexService.addIndex(goodsIndex);
goodsIndices.add(goodsIndex);
} else if (goodsSku.getQuantity() > 0 && esGoodsOld != null) {
goodsIndexService.updateIndex(goodsIndex);
}
//删除sku缓存
cache.remove(GoodsSkuService.getCacheKeys(goodsSku.getId()));
}
if (!goodsIndices.isEmpty()) {
String destination = rocketmqCustomProperties.getGoodsTopic() + ":" + GoodsTagsEnum.GENERATOR_GOODS_INDEX.name();
//发送mq消息
rocketMQTemplate.asyncSend(destination, JSONUtil.toJsonStr(goodsIndices), RocketmqSendCallbackBuilder.commonCallback());
}
}
//如果商品状态值不支持es搜索那么将商品信息做下架处理
else {
List<GoodsSku> goodsSkuList = this.list(new LambdaQueryWrapper<GoodsSku>().eq(GoodsSku::getGoodsId, goods.getId()));
for (GoodsSku goodsSku : goodsSkuList) {
EsGoodsIndex esGoodsOld = goodsIndexService.findById(goodsSku.getId());
if (esGoodsOld != null) {
@@ -501,9 +511,8 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
* @param skuList sku列表
* @param goods 商品信息
*/
private List<GoodsSku> addGoodsSku(List<Map<String, Object>> skuList, Goods goods, Boolean needIndex) {
private List<GoodsSku> addGoodsSku(List<Map<String, Object>> skuList, Goods goods) {
List<GoodsSku> skus = new ArrayList<>();
List<EsGoodsIndex> goodsIndices = new ArrayList<>();
for (Map<String, Object> skuVO : skuList) {
Map<String, Object> resultMap = this.add(skuVO, goods);
GoodsSku goodsSku = (GoodsSku) resultMap.get("goodsSku");
@@ -511,17 +520,10 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
goodsSku.setSelfOperated(goods.getSelfOperated());
}
goodsSku.setGoodsType(goods.getGoodsType());
EsGoodsIndex goodsIndex = (EsGoodsIndex) resultMap.get("goodsIndex");
skus.add(goodsSku);
goodsIndices.add(goodsIndex);
stringRedisTemplate.opsForValue().set(GoodsSkuService.getStockCacheKey(goodsSku.getId()), goodsSku.getQuantity().toString());
}
this.saveBatch(skus);
if (Boolean.TRUE.equals(needIndex)) {
String destination = rocketmqCustomProperties.getGoodsTopic() + ":" + GoodsTagsEnum.GENERATOR_GOODS_INDEX.name();
//发送mq消息
rocketMQTemplate.asyncSend(destination, JSONUtil.toJsonStr(goodsIndices), RocketmqSendCallbackBuilder.commonCallback());
}
return skus;
}
@@ -656,7 +658,6 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
}
}
@Autowired
public void setGoodsService(GoodsService goodsService) {
this.goodsService = goodsService;

View File

@@ -50,12 +50,11 @@ public class SpecificationServiceImpl extends ServiceImpl<SpecificationMapper, S
private SpecValuesService specValuesService;
@Override
public List<SpecificationVO> getSpecList(String specName) {
public List<SpecificationVO> getSpecList(String specId) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq(StringUtils.isNotEmpty(specName), "s.spec_name", specName);
queryWrapper.eq(StringUtils.isNotEmpty(specId), "s.spec_id", specId);
queryWrapper.orderByDesc("s.create_time");
queryWrapper.groupBy("s.id");
return this.baseMapper.findSpecList(queryWrapper);
}
@@ -103,7 +102,7 @@ public class SpecificationServiceImpl extends ServiceImpl<SpecificationMapper, S
@Override
public IPage<SpecificationVO> getSpecificationPage(SpecificationSearchParams searchParams, PageVO pageVo) {
List<SpecificationVO> specList = this.getSpecList(searchParams.getSpecName());
List<SpecificationVO> specList = this.getSpecList(searchParams.getSpecId());
IPage<SpecificationVO> page = new Page<>(pageVo.getPageNumber(), pageVo.getPageSize(), specList.size());
page.setRecords(PageUtil.listToPage(pageVo, specList));
return page;

View File

@@ -557,9 +557,9 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
queryWrapper.like(StringUtils.isNotBlank(memberSearchVO.getUsername()), "username", memberSearchVO.getUsername());
//按照电话号码查询
queryWrapper.like(StringUtils.isNotBlank(memberSearchVO.getMobile()), "mobile", memberSearchVO.getMobile());
//按照电话号码查询
queryWrapper.like(StringUtils.isNotBlank(memberSearchVO.getDisabled()), "disabled", memberSearchVO.getDisabled());
queryWrapper.orderByDesc("create_time");
//按照状态查询
queryWrapper.eq(StringUtils.isNotBlank(memberSearchVO.getDisabled()), "disabled",
memberSearchVO.getDisabled().equals(SwitchEnum.OPEN.name()) ? 1 : 0); queryWrapper.orderByDesc("create_time");
return this.count(queryWrapper);
}

View File

@@ -1,4 +1,4 @@
package cn.lili.modules.member.entity.dos;
package cn.lili.modules.message.entity.dos;
import cn.lili.base.BaseEntity;
import cn.lili.modules.message.entity.enums.MessageStatusEnum;
@@ -11,7 +11,7 @@ import javax.persistence.Entity;
import javax.persistence.Table;
/**
* 会员消息
* 会员接受消息对象
*
* @author Chopper
* @date 2020-02-25 14:10:16
@@ -37,6 +37,9 @@ public class MemberMessage extends BaseEntity {
@ApiModelProperty(value = "消息内容")
private String content;
@ApiModelProperty(value = "关联消息id")
private String messageId;
/**
* @see MessageStatusEnum
*/

View File

@@ -2,6 +2,7 @@ package cn.lili.modules.message.entity.dos;
import cn.lili.base.BaseEntity;
import cn.lili.modules.message.entity.enums.RangeEnum;
import cn.lili.modules.message.entity.enums.MessageSendClient;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
@@ -13,6 +14,8 @@ import javax.persistence.Table;
import javax.persistence.Transient;
/**
* 管理段发送消息对象
*
* @author lili
*/
@@ -37,7 +40,10 @@ public class Message extends BaseEntity {
@ApiModelProperty(value = "发送范围")
private String messageRange;
@ApiModelProperty(value = "发送客户端 商家和会员")
/**
* @see MessageSendClient
*/
@ApiModelProperty(value = "发送客户端 商家或者会员")
private String messageClient;
@Transient

View File

@@ -10,7 +10,7 @@ import javax.persistence.Entity;
import javax.persistence.Table;
/**
* 站内消息模板设置
* 通知类站内信模版对象
*
* @author Bulbasaur
* @version v4.1
@@ -20,7 +20,7 @@ import javax.persistence.Table;
@Entity
@Table(name = "li_notice_message")
@TableName("li_notice_message")
@ApiModel(value = "站内消息模板")
@ApiModel(value = "通知类消息模板")
public class NoticeMessage extends BaseEntity {
private static final long serialVersionUID = 1L;

View File

@@ -17,7 +17,7 @@ import javax.persistence.*;
import java.util.Date;
/**
* 店铺消息
* 店铺接收消息对象
* @author Chopper
* @date 2021/1/30 4:13 下午
*/

View File

@@ -0,0 +1,27 @@
package cn.lili.modules.message.entity.enums;
/**
* 消息发送客户端
*
* @author pikachu
* @date 2020/12/8 9:46
*/
public enum MessageSendClient {
//全部用户
MEMBER("会员"),
//指定用户
STORE("店铺");
private final String description;
MessageSendClient(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
}

View File

@@ -1,17 +1,19 @@
package cn.lili.modules.member.entity.vo;
package cn.lili.modules.message.entity.vos;
import cn.lili.modules.message.entity.enums.MessageStatusEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 会员消息查询
* 会员接收消息查询vo
*
* @author Chopper
* @date 2020-02-25 14:10:16
* @date 2020/12/2 17:50
*/
@Data
@ApiModel(value = "会员接收消息查询vo")
public class MemberMessageQueryVO {
private static final long serialVersionUID = 1L;
@@ -22,6 +24,9 @@ public class MemberMessageQueryVO {
@ApiModelProperty(value = "状态")
private String status;
@ApiModelProperty(value = "消息id")
private String messageId;
@ApiModelProperty(value = "消息标题")
private String title;

View File

@@ -1,12 +1,12 @@
package cn.lili.modules.member.mapper;
package cn.lili.modules.message.mapper;
import cn.lili.modules.member.entity.dos.MemberMessage;
import cn.lili.modules.message.entity.dos.MemberMessage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 会员消息数据处理层
* 会员接收到消息数据处理层
*
* @author lili
* @date 2020-02-25 14:10:16

View File

@@ -4,7 +4,7 @@ import cn.lili.modules.message.entity.dos.Message;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 消息内容数据处理层
* 管理端发送消息内容数据处理层
* @author Chopper
* @date 2020/12/2 17:50
*/

View File

@@ -4,7 +4,7 @@ import cn.lili.modules.message.entity.dos.NoticeMessage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 消息模板数据处理层
* 通知类消息模板数据处理层
*
* @author Bulbasaur
* @date 2020/12/8 9:46

View File

@@ -9,7 +9,7 @@ import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
* 消息发送数据处理层
* 店铺接收到消息发送数据处理层
*
* @author Chopper
* @date 2021/1/30 4:17 下午

View File

@@ -1,13 +1,15 @@
package cn.lili.modules.member.service;
package cn.lili.modules.message.service;
import cn.lili.common.vo.PageVO;
import cn.lili.modules.member.entity.dos.MemberMessage;
import cn.lili.modules.member.entity.vo.MemberMessageQueryVO;
import cn.lili.modules.message.entity.dos.MemberMessage;
import cn.lili.modules.message.entity.vos.MemberMessageQueryVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* 消息发送业务层
* 会员消息发送业务层
*
* @author Chopper
* @date 2020/11/17 3:44 下午
@@ -41,4 +43,13 @@ public interface MemberMessageService extends IService<MemberMessage> {
Boolean deleteMessage(String messageId);
/**
* 保存消息信息
*
* @param messages 消息
* @return
*/
boolean save(List<MemberMessage> messages);
}

View File

@@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 消息内容业务层
* 管理端发送消息内容业务层
*
* @author Chopper
* @date 2020/11/17 3:44 下午

View File

@@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 消息模板业务层
* 通知类消息模板业务层
*
* @author Bulbasaur
* @date 2020/12/8 9:47

View File

@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* 消息发送业务层
* 店铺接收消息业务层
*
* @author Chopper
* @date 2020/11/17 3:44 下午
@@ -34,7 +34,7 @@ public interface StoreMessageService extends IService<StoreMessage> {
IPage<StoreMessage> getPage(StoreMessageQueryVO storeMessageQueryVO, PageVO pageVO);
/**
* 保存消息信息
* 保存店铺消息信息
*
* @param messages 消息
* @return

View File

@@ -1,21 +1,23 @@
package cn.lili.modules.member.serviceimpl;
package cn.lili.modules.message.serviceimpl;
import cn.lili.common.utils.PageUtil;
import cn.lili.common.utils.StringUtils;
import cn.lili.common.vo.PageVO;
import cn.lili.modules.member.entity.dos.MemberMessage;
import cn.lili.modules.member.entity.vo.MemberMessageQueryVO;
import cn.lili.modules.member.mapper.MemberMessageMapper;
import cn.lili.modules.member.service.MemberMessageService;
import cn.lili.modules.message.entity.dos.MemberMessage;
import cn.lili.modules.message.mapper.MemberMessageMapper;
import cn.lili.modules.message.service.MemberMessageService;
import cn.lili.modules.message.entity.vos.MemberMessageQueryVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 会员消息业务层实现
* 会员接收消息业务层实现
*
* @author Chopper
* @date 2020/11/17 3:48 下午
@@ -28,6 +30,8 @@ public class MemberMessageServiceImpl extends ServiceImpl<MemberMessageMapper, M
@Override
public IPage<MemberMessage> getPage(MemberMessageQueryVO memberMessageQueryVO, PageVO pageVO) {
QueryWrapper<MemberMessage> queryWrapper = new QueryWrapper<>();
//消息id
queryWrapper.like(StringUtils.isNotEmpty(memberMessageQueryVO.getMessageId()), "message_id", memberMessageQueryVO.getMessageId());
//消息标题
queryWrapper.like(StringUtils.isNotEmpty(memberMessageQueryVO.getTitle()), "title", memberMessageQueryVO.getTitle());
//会员id
@@ -61,4 +65,9 @@ public class MemberMessageServiceImpl extends ServiceImpl<MemberMessageMapper, M
}
return false;
}
@Override
public boolean save(List<MemberMessage> messages) {
return saveBatch(messages);
}
}

View File

@@ -17,7 +17,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 消息内容业务层实现
* 管理端发送消息内容业务层实现
*
* @author Chopper
* @date 2020/11/17 3:48 下午

View File

@@ -22,7 +22,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Map;
/**
* 消息模板业务层实现
* 通知类消息模板业务层实现
*
* @author Bulbasaur
* @date 2020/12/8 9:48

View File

@@ -150,7 +150,7 @@ public class CartServiceImpl implements CartService {
tradeDTO.setPlatformCoupon(null);
this.resetTradeDTO(tradeDTO);
} catch (ServiceException se) {
throw se;
throw se;
} catch (Exception e) {
log.error("购物车渲染异常", e);
throw new ServiceException(errorMessage);
@@ -510,6 +510,10 @@ public class CartServiceImpl implements CartService {
tradeDTO.setClientType(tradeParams.getClient());
tradeDTO.setStoreRemark(tradeParams.getRemark());
tradeDTO.setParentOrderSn(tradeParams.getParentOrderSn());
//订单无收货地址校验
if (tradeDTO.getMemberAddress() == null) {
throw new ServiceException(ResultCode.MEMBER_ADDRESS_NOT_EXIST);
}
//将购物车信息写入缓存,后续逻辑调用校验
this.resetTradeDTO(tradeDTO);
//构建交易

View File

@@ -69,7 +69,7 @@ public class OrderSearchParams extends PageVO {
* @see OrderTypeEnum
* @see cn.lili.modules.order.order.entity.enums.OrderPromotionTypeEnum
*/
@ApiModelProperty(value = "订单类型",allowableValues = "NORMAL,VIRTUAL,GIFT,PINTUAN,POINT" )
@ApiModelProperty(value = "订单类型", allowableValues = "NORMAL,VIRTUAL,GIFT,PINTUAN,POINT")
private String orderType;
@ApiModelProperty(value = "支付方式")
@@ -98,53 +98,60 @@ public class OrderSearchParams extends PageVO {
//关键字查询
if (StringUtils.isNotEmpty(keywords)) {
wrapper.like("o.sn", keywords);
wrapper.like("oi.goods_name", keywords);
wrapper.and(queryWrapper -> wrapper.like("o.sn", keywords).or().
like("oi.goods_name", keywords));
}
//按卖家查询
if (StringUtils.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.STORE.name())) {
wrapper.eq("o.store_id", UserContext.getCurrentUser().getStoreId());
}
if (StringUtils.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.MANAGER.name())
&& StringUtils.isNotEmpty(storeId)) {
wrapper.eq("o.store_id", storeId);
}
wrapper.eq(StringUtils.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.STORE.name()), "o.store_id", UserContext.getCurrentUser().getStoreId());
//店铺查询
wrapper.eq(StringUtils.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.MANAGER.name())
&& StringUtils.isNotEmpty(storeId), "o.store_id", storeId);
//按买家查询
if (StringUtils.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.MEMBER.name())) {
wrapper.eq("o.member_id", UserContext.getCurrentUser().getId());
}
wrapper.eq(StringUtils.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.MEMBER.name()), "o.member_id", UserContext.getCurrentUser().getId());
//按照买家查询
if (StringUtils.isNotEmpty(memberId)) {
wrapper.like("o.member_id", memberId);
}
wrapper.like(StringUtils.isNotEmpty(memberId), "o.member_id", memberId);
//按订单编号查询
if (StringUtils.isNotEmpty(orderSn)) {
wrapper.like("o.sn", orderSn);
}
wrapper.like(StringUtils.isNotEmpty(orderSn), "o.sn", orderSn);
//按时间查询
if (startDate != null) {
wrapper.ge("o.create_time", startDate);
}
if (endDate != null) {
wrapper.le("o.create_time", DateUtil.endOfDate(endDate));
}
wrapper.ge(startDate != null, "o.create_time", startDate);
wrapper.le(endDate != null, "o.create_time", DateUtil.endOfDate(endDate));
//按购买人用户名
if (StringUtils.isNotEmpty(buyerName)) {
wrapper.like("o.member_name", buyerName);
}
wrapper.like(StringUtils.isNotEmpty(buyerName), "o.member_name", buyerName);
//按订单类型
if (StringUtils.isNotEmpty(orderType)) {
wrapper.eq("o.order_type", orderType)
.or().eq("o.order_promotion_type", orderType);
wrapper.and(queryWrapper-> queryWrapper.eq("o.order_type", orderType).or()
.eq("o.order_promotion_type", orderType));
}
//物流查询
wrapper.like(StringUtils.isNotEmpty(shipName), "o.ship_name", shipName);
//按商品名称查询
wrapper.like(StringUtils.isNotEmpty(goodsName), "oi.goods_name", goodsName);
//付款方式
wrapper.like(StringUtils.isNotEmpty(paymentType), "o.payment_type", paymentType);
//按支付方式
if (StringUtils.isNotEmpty(paymentMethod)) {
wrapper.eq("o.payment_method", paymentMethod);
}
wrapper.eq(StringUtils.isNotEmpty(paymentMethod), "o.payment_method", paymentMethod);
//订单状态
wrapper.eq(StringUtils.isNotEmpty(orderStatus), "o.order_status", orderStatus);
//付款状态
wrapper.eq(StringUtils.isNotEmpty(payStatus), "o.pay_status", payStatus);
//订单来源
wrapper.like(StringUtils.isNotEmpty(clientType), "o.client_type", clientType);
//按标签查询
if (StringUtils.isNotEmpty(tag)) {
@@ -176,33 +183,7 @@ public class OrderSearchParams extends PageVO {
}
}
if (StringUtils.isNotEmpty(shipName)) {
wrapper.like("o.ship_name", shipName);
}
//按商品名称查询
if (StringUtils.isNotEmpty(goodsName)) {
wrapper.like("oi.goods_name", goodsName);
}
//付款方式
if (StringUtils.isNotEmpty(paymentType)) {
wrapper.like("o.payment_type", paymentType);
}
//订单状态
if (StringUtils.isNotEmpty(orderStatus)) {
wrapper.eq("o.order_status", orderStatus);
}
//付款状态
if (StringUtils.isNotEmpty(payStatus)) {
wrapper.eq("o.pay_status", payStatus);
}
//订单来源
if (StringUtils.isNotEmpty(clientType)) {
wrapper.like("o.client_type", clientType);
}
wrapper.eq("o.delete_flag", false);
return wrapper;
}

View File

@@ -1,9 +1,7 @@
package cn.lili.modules.search.entity.dos;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.lili.common.elasticsearch.EsSuffix;
import cn.lili.common.utils.StringUtils;
import cn.lili.modules.goods.entity.dos.GoodsParams;
import cn.lili.modules.goods.entity.dos.GoodsSku;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
@@ -275,22 +273,38 @@ public class EsGoodsIndex implements Serializable {
this.intro = sku.getIntro();
this.grade = sku.getGrade();
this.releaseTime = new Date();
if (StringUtils.isNotEmpty(sku.getSpecs())) {
List<EsGoodsAttribute> attributes = new ArrayList<>();
JSONObject jsonObject = JSONUtil.parseObj(sku.getSpecs());
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
if (!entry.getKey().equals("images")) {
EsGoodsAttribute attribute = new EsGoodsAttribute();
attribute.setType(0);
attribute.setName(entry.getKey());
attribute.setValue(entry.getValue().toString());
attributes.add(attribute);
}
}
this.attrList = attributes;
}
// if (CharSequenceUtil.isNotEmpty(sku.getSpecs())) {
// List<EsGoodsAttribute> attributes = new ArrayList<>();
// JSONObject jsonObject = JSONUtil.parseObj(sku.getSpecs());
// for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
// if (!entry.getKey().equals("images")) {
// EsGoodsAttribute attribute = new EsGoodsAttribute();
// attribute.setType(1);
// attribute.setName(entry.getKey());
// attribute.setValue(entry.getValue().toString());
// attributes.add(attribute);
// }
// }
// this.attrList = attributes;
// }
}
}
public EsGoodsIndex(GoodsSku sku, List<GoodsParams> goodsParams) {
this(sku);
if (goodsParams != null && !goodsParams.isEmpty()) {
List<EsGoodsAttribute> attributes = new ArrayList<>();
for (GoodsParams goodsParam : goodsParams) {
EsGoodsAttribute attribute = new EsGoodsAttribute();
if (goodsParam.getIsIndex() != null && goodsParam.getIsIndex() == 1) {
attribute.setType(1);
attribute.setName(goodsParam.getParamName());
attribute.setValue(goodsParam.getParamValue());
attributes.add(attribute);
}
}
this.attrList = attributes;
}
}
public void setGoodsSku(GoodsSku sku) {

View File

@@ -1,5 +1,6 @@
package cn.lili.modules.search.service;
import cn.lili.modules.goods.entity.dos.GoodsParams;
import cn.lili.modules.goods.entity.dos.GoodsSku;
import cn.lili.modules.promotion.entity.dos.PromotionGoods;
import cn.lili.modules.promotion.entity.dto.BasePromotion;
@@ -145,7 +146,8 @@ public interface EsGoodsIndexService {
* 重置当前商品索引
*
* @param goodsSku 商品sku信息
* @param goodsParams 商品参数
* @return 商品索引
*/
EsGoodsIndex resetEsGoodsIndex(GoodsSku goodsSku);
EsGoodsIndex resetEsGoodsIndex(GoodsSku goodsSku, List<GoodsParams> goodsParams);
}

View File

@@ -8,6 +8,7 @@ import cn.hutool.extra.pinyin.PinyinUtil;
import cn.lili.common.elasticsearch.BaseElasticsearchService;
import cn.lili.common.elasticsearch.EsSuffix;
import cn.lili.config.elasticsearch.ElasticsearchProperties;
import cn.lili.modules.goods.entity.dos.GoodsParams;
import cn.lili.modules.goods.entity.dos.GoodsSku;
import cn.lili.modules.goods.entity.dos.GoodsWords;
import cn.lili.modules.goods.entity.enums.GoodsWordsTypeEnum;
@@ -367,11 +368,12 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
* 重置当前商品索引
*
* @param goodsSku 商品sku信息
* @param goodsParams 商品参数
* @return 商品索引
*/
@Override
public EsGoodsIndex resetEsGoodsIndex(GoodsSku goodsSku) {
EsGoodsIndex index = new EsGoodsIndex(goodsSku);
public EsGoodsIndex resetEsGoodsIndex(GoodsSku goodsSku, List<GoodsParams> goodsParams) {
EsGoodsIndex index = new EsGoodsIndex(goodsSku, goodsParams);
//获取活动信息
Map<String, Object> goodsCurrentPromotionMap = promotionService.getGoodsCurrentPromotionMap(index);
//写入促销信息