Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
package cn.lili.modules.distribution.entity.dto;
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 分销员商品查询条件
|
||||
@@ -13,15 +15,25 @@ import lombok.Data;
|
||||
* @author pikachu
|
||||
* @since 2020-03-14 23:04:56
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class DistributionGoodsSearchParams extends PageVO {
|
||||
|
||||
@ApiModelProperty(value = "商品ID")
|
||||
private String goodsId;
|
||||
|
||||
@ApiModelProperty(value = "商品名称")
|
||||
private String goodsName;
|
||||
|
||||
@ApiModelProperty(value = "是否已选择")
|
||||
private boolean isChecked;
|
||||
|
||||
public <T> QueryWrapper<T> queryWrapper() {
|
||||
QueryWrapper<T> queryWrapper = this.distributionQueryWrapper();
|
||||
queryWrapper.eq(CharSequenceUtil.isNotEmpty(goodsId), "goods_id", goodsId);
|
||||
queryWrapper.eq(CharSequenceUtil.isNotEmpty(goodsName), "goods_name", goodsId);
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
public <T> QueryWrapper<T> storeQueryWrapper() {
|
||||
QueryWrapper<T> queryWrapper = this.distributionQueryWrapper();
|
||||
|
||||
@@ -21,10 +21,34 @@ public interface DistributionGoodsService extends IService<DistributionGoods> {
|
||||
* 根据条件分页查询分销商品信息
|
||||
*
|
||||
* @param distributionGoodsSearchParams 商品条件
|
||||
* @return
|
||||
* @return 分页分销商品信息
|
||||
*/
|
||||
IPage<DistributionGoodsVO> goodsPage(DistributionGoodsSearchParams distributionGoodsSearchParams);
|
||||
|
||||
|
||||
/**
|
||||
* 根据条件查询分销商品信息列表
|
||||
*
|
||||
* @param distributionGoodsSearchParams 条件
|
||||
* @return 分销商品信息列表
|
||||
*/
|
||||
List<DistributionGoods> getDistributionGoodsList(DistributionGoodsSearchParams distributionGoodsSearchParams);
|
||||
|
||||
/**
|
||||
* 根据条件查询分销商品信息
|
||||
*
|
||||
* @param distributionGoodsSearchParams 条件
|
||||
* @return 分销商品信息
|
||||
*/
|
||||
DistributionGoods getDistributionGoods(DistributionGoodsSearchParams distributionGoodsSearchParams);
|
||||
|
||||
/**
|
||||
* 根据条件删除分销商品
|
||||
*
|
||||
* @param distributionGoodsSearchParams 条件
|
||||
*/
|
||||
boolean deleteDistributionGoods(DistributionGoodsSearchParams distributionGoodsSearchParams);
|
||||
|
||||
/**
|
||||
* 获取分销商品
|
||||
*
|
||||
|
||||
@@ -23,4 +23,11 @@ public interface DistributionSelectedGoodsService extends IService<DistributionS
|
||||
* @return
|
||||
*/
|
||||
boolean delete(String distributionGoodsId);
|
||||
|
||||
/**
|
||||
* 分销员添加分销商品
|
||||
* @param distributionGoodsId 分销商品ID
|
||||
* @return
|
||||
*/
|
||||
boolean deleteByDistributionGoodsId(String distributionGoodsId);
|
||||
}
|
||||
|
||||
@@ -70,6 +70,38 @@ public class DistributionGoodsServiceImpl extends ServiceImpl<DistributionGoodsM
|
||||
return this.baseMapper.getDistributionGoodsVO(PageUtil.initPage(searchParams), searchParams.distributionQueryWrapper());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询分销商品信息列表
|
||||
*
|
||||
* @param distributionGoodsSearchParams 商品条件
|
||||
* @return 分销商品信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<DistributionGoods> getDistributionGoodsList(DistributionGoodsSearchParams distributionGoodsSearchParams) {
|
||||
return this.list(distributionGoodsSearchParams.queryWrapper());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询分销商品信息
|
||||
*
|
||||
* @param distributionGoodsSearchParams 条件
|
||||
* @return 分销商品信息
|
||||
*/
|
||||
@Override
|
||||
public DistributionGoods getDistributionGoods(DistributionGoodsSearchParams distributionGoodsSearchParams) {
|
||||
return this.getOne(distributionGoodsSearchParams.queryWrapper(), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件删除分销商品
|
||||
*
|
||||
* @param distributionGoodsSearchParams 条件
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteDistributionGoods(DistributionGoodsSearchParams distributionGoodsSearchParams) {
|
||||
return this.remove(distributionGoodsSearchParams.queryWrapper());
|
||||
}
|
||||
|
||||
@Override
|
||||
public DistributionGoods distributionGoodsVO(String id) {
|
||||
|
||||
|
||||
@@ -46,4 +46,16 @@ public class DistributionSelectedGoodsServiceImpl extends ServiceImpl<Distributi
|
||||
.eq(DistributionSelectedGoods::getDistributionGoodsId, distributionGoodsId)
|
||||
.eq(DistributionSelectedGoods::getDistributionId, distributionId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分销员添加分销商品
|
||||
*
|
||||
* @param distributionGoodsId 商品ID
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteByDistributionGoodsId(String distributionGoodsId) {
|
||||
return this.remove(new LambdaQueryWrapper<DistributionSelectedGoods>()
|
||||
.eq(DistributionSelectedGoods::getDistributionGoodsId, distributionGoodsId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,10 @@ public class GoodsSearchParams extends PageVO {
|
||||
private String authFlag;
|
||||
|
||||
@ApiModelProperty(value = "库存数量")
|
||||
private Integer quantity;
|
||||
private Integer leQuantity;
|
||||
|
||||
@ApiModelProperty(value = "库存数量")
|
||||
private Integer geQuantity;
|
||||
|
||||
@ApiModelProperty(value = "是否为推荐商品")
|
||||
private Boolean recommend;
|
||||
@@ -106,8 +109,11 @@ public class GoodsSearchParams extends PageVO {
|
||||
if (CharSequenceUtil.isNotEmpty(authFlag)) {
|
||||
queryWrapper.eq("auth_flag", authFlag);
|
||||
}
|
||||
if (quantity != null) {
|
||||
queryWrapper.le("quantity", quantity);
|
||||
if (leQuantity != null) {
|
||||
queryWrapper.le("quantity", leQuantity);
|
||||
}
|
||||
if (geQuantity != null) {
|
||||
queryWrapper.ge("quantity", geQuantity);
|
||||
}
|
||||
if (recommend != null) {
|
||||
queryWrapper.le("recommend", recommend);
|
||||
|
||||
@@ -147,12 +147,20 @@ public interface GoodsService extends IService<Goods> {
|
||||
void updateStock(String goodsId, Integer quantity);
|
||||
|
||||
/**
|
||||
* 更新SKU评价数量
|
||||
* 更新商品评价数量
|
||||
*
|
||||
* @param goodsId 商品ID
|
||||
*/
|
||||
void updateGoodsCommentNum(String goodsId);
|
||||
|
||||
/**
|
||||
* 更新商品的购买数量
|
||||
*
|
||||
* @param goodsId 商品ID
|
||||
* @param buyCount 购买数量
|
||||
*/
|
||||
void updateGoodsBuyCount(String goodsId, int buyCount);
|
||||
|
||||
/**
|
||||
* 批量更新商品的店铺信息
|
||||
* @param store
|
||||
|
||||
@@ -406,6 +406,19 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
this.updateById(goods);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新商品的购买数量
|
||||
*
|
||||
* @param goodsId 商品ID
|
||||
* @param buyCount 购买数量
|
||||
*/
|
||||
@Override
|
||||
public void updateGoodsBuyCount(String goodsId, int buyCount) {
|
||||
this.update(new LambdaUpdateWrapper<Goods>()
|
||||
.eq(Goods::getId, goodsId)
|
||||
.set(Goods::getBuyCount, buyCount));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStoreDetail(Store store) {
|
||||
UpdateWrapper updateWrapper = new UpdateWrapper<>()
|
||||
|
||||
@@ -2,6 +2,7 @@ package cn.lili.modules.goods.serviceimpl;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
@@ -538,9 +539,18 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
||||
*/
|
||||
@Override
|
||||
public void generateEs(Goods goods) {
|
||||
String destination = rocketmqCustomProperties.getGoodsTopic() + ":" + GoodsTagsEnum.GENERATOR_GOODS_INDEX.name();
|
||||
//发送mq消息
|
||||
rocketMQTemplate.asyncSend(destination, goods.getId(), RocketmqSendCallbackBuilder.commonCallback());
|
||||
ThreadUtil.execAsync(() -> {
|
||||
try {
|
||||
// 延时执行,防止商品未保存完成就去生成商品索引导致生成索引时找不到商品问题
|
||||
Thread.sleep(2000);
|
||||
String destination = rocketmqCustomProperties.getGoodsTopic() + ":" + GoodsTagsEnum.GENERATOR_GOODS_INDEX.name();
|
||||
//发送mq消息
|
||||
rocketMQTemplate.asyncSend(destination, goods.getId(), RocketmqSendCallbackBuilder.commonCallback());
|
||||
} catch (InterruptedException e) {
|
||||
log.error("发送商品索引信息失败!", e);
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,6 +41,13 @@ public interface EsGoodsSearchService {
|
||||
*/
|
||||
void setHotWords(HotWordsDTO hotWords);
|
||||
|
||||
/**
|
||||
* 删除热门关键词
|
||||
*
|
||||
* @param keywords 热词
|
||||
*/
|
||||
void deleteHotWords(String keywords);
|
||||
|
||||
/**
|
||||
* 获取筛选器
|
||||
*
|
||||
|
||||
@@ -115,6 +115,16 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
cache.incrementScore(CachePrefix.HOT_WORD.getPrefix(), hotWords.getKeywords(), hotWords.getPoint());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除热门关键词
|
||||
*
|
||||
* @param keywords 热词
|
||||
*/
|
||||
@Override
|
||||
public void deleteHotWords(String keywords) {
|
||||
cache.zRemove(CachePrefix.HOT_WORD.getPrefix(), keywords);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EsGoodsRelatedInfo getSelector(EsGoodsSearchDTO goodsSearch, PageVO pageVo) {
|
||||
NativeSearchQueryBuilder builder = createSearchQueryBuilder(goodsSearch, null);
|
||||
|
||||
@@ -92,7 +92,6 @@ public class StoreDetail extends BaseIdEntity {
|
||||
@ApiModelProperty(value = "营业执照号")
|
||||
private String licenseNum;
|
||||
|
||||
@Size(min = 1, max = 200, message = "法定经营范围长度为1-200位字符")
|
||||
@ApiModelProperty(value = "法定经营范围")
|
||||
private String scope;
|
||||
|
||||
|
||||
@@ -99,7 +99,6 @@ public class AdminStoreApplyDTO {
|
||||
@ApiModelProperty(value = "营业执照号")
|
||||
private String licenseNum;
|
||||
|
||||
@Size(min = 1, max = 200, message = "法定经营范围长度为1-200位字符")
|
||||
@ApiModelProperty(value = "法定经营范围")
|
||||
private String scope;
|
||||
|
||||
|
||||
@@ -78,7 +78,6 @@ public class StoreEditDTO {
|
||||
@ApiModelProperty(value = "营业执照号")
|
||||
private String licenseNum;
|
||||
|
||||
@Size(min = 1, max = 200, message = "法定经营范围长度为1-200位字符")
|
||||
@ApiModelProperty(value = "法定经营范围")
|
||||
private String scope;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user