Merge branch 'master' into Bulbasaur

This commit is contained in:
lifenlong 2021-05-20 11:36:09 +08:00
commit 2326a5963f
7 changed files with 18 additions and 23 deletions

View File

@ -3,14 +3,12 @@ package cn.lili.listener;
import cn.hutool.json.JSONUtil;
import cn.lili.common.rocketmq.tags.GoodsTagsEnum;
import cn.lili.event.GoodsCommentCompleteEvent;
import cn.lili.event.MemberRegisterEvent;
import cn.lili.modules.goods.entity.dos.Goods;
import cn.lili.modules.goods.entity.dos.GoodsSku;
import cn.lili.modules.goods.entity.dto.GoodsCompleteMessage;
import cn.lili.modules.goods.service.GoodsService;
import cn.lili.modules.goods.service.GoodsSkuService;
import cn.lili.modules.member.entity.dos.FootPrint;
import cn.lili.modules.member.entity.dos.Member;
import cn.lili.modules.member.entity.dos.MemberEvaluation;
import cn.lili.modules.member.service.FootprintService;
import cn.lili.modules.member.service.GoodsCollectionService;
@ -18,7 +16,6 @@ import cn.lili.modules.search.entity.dos.EsGoodsIndex;
import cn.lili.modules.search.service.EsGoodsIndexService;
import cn.lili.modules.store.service.StoreService;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
@ -96,9 +93,9 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
break;
//商品评价
case GOODS_COMMENT_COMPLETE:
MemberEvaluation memberEvaluation = JSONUtil.toBean(new String(messageExt.getBody()), MemberEvaluation.class);
for (GoodsCommentCompleteEvent goodsCommentCompleteEvent : goodsCommentCompleteEvents) {
try {
MemberEvaluation memberEvaluation = JSONUtil.toBean(new String(messageExt.getBody()), MemberEvaluation.class);
goodsCommentCompleteEvent.goodsComment(memberEvaluation);
} catch (Exception e) {
log.error("评价{},在{}业务中,状态修改事件执行异常",

View File

@ -125,8 +125,7 @@ public enum ResultCode {
* 购物车
*/
CART_ERROR(30001, "读取结算页的购物车异常"),
GOODS_NOT_SUPPORT(30002, "以下商品不支持当前收货地址:"),
SHIPPING_NOT_APPLY(30005, "当前选择地址暂不支持配送!"),
SHIPPING_NOT_APPLY(30005, "购物商品不支持当前收货地址配送"),
/**
* 订单
*/

View File

@ -34,13 +34,8 @@ public class Parameters extends BaseEntity {
@Length(max = 50, message = "参数名称不能超过50字")
private String paramName;
@ApiModelProperty(value = "参数类型1 输入项 2 选择项", required = true)
@NotNull(message = "参数类型必选")
@Min(value = 1, message = "参数类型传值不正确")
@Max(value = 2, message = "参数类型传值不正确")
private Integer paramType;
@ApiModelProperty(value = "选择值当参数类型是选择项2时必填逗号分隔")
@ApiModelProperty(value = "选择值")
private String options;
@ApiModelProperty(value = "是否可索引0 不显示 1 显示", required = true)

View File

@ -233,13 +233,11 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
@Override
public Integer goodsNum(GoodsStatusEnum goodsStatusEnum, GoodsAuthEnum goodsAuthEnum) {
LambdaQueryWrapper<Goods> queryWrapper = Wrappers.lambdaQuery();
if (goodsStatusEnum != null) {
queryWrapper.eq(Goods::getMarketEnable, goodsStatusEnum.name());
}
if (goodsAuthEnum != null) {
queryWrapper.eq(Goods::getIsAuth, goodsAuthEnum.name());
}
queryWrapper.eq(StringUtils.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.STORE.name()),
queryWrapper.eq(Goods::getDeleteFlag,false)
.eq(goodsStatusEnum != null,Goods::getMarketEnable, goodsStatusEnum.name())
.eq(goodsAuthEnum != null,Goods::getIsAuth, goodsAuthEnum.name())
.eq(StringUtils.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.STORE.name()),
Goods::getStoreId, UserContext.getCurrentUser().getStoreId());
return this.count(queryWrapper);

View File

@ -407,10 +407,10 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
goodEvaluationQueryWrapper.eq(MemberEvaluation::getGrade, EvaluationGradeEnum.GOOD.name());
// 好评数量
double highPraiseNum = memberEvaluationService.count(goodEvaluationQueryWrapper);
int highPraiseNum = memberEvaluationService.count(goodEvaluationQueryWrapper);
// 更新商品评价数量
goodsSku.setCommentNum(goodsSku.getCommentNum() + 1);
goodsSku.setCommentNum(goodsSku.getCommentNum() != null ? goodsSku.getCommentNum() + 1 : 1);
// 好评率
double grade = NumberUtil.div(highPraiseNum, goodsSku.getCommentNum().doubleValue(), 2) * 100;
@ -419,6 +419,12 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
this.update(goodsSku);
//修改规格索引
goodsIndexService.updateIndexCommentNum(goodsSku.getId(), goodsSku.getCommentNum(), (int) highPraiseNum, grade);
//修改商品评价数量
Goods goods = goodsService.getById(goodsSku.getGoodsId());
goods.setCommentNum(goods.getCommentNum() + 1);
goodsService.updateById(goods);
}
/**

View File

@ -528,7 +528,7 @@ public class CartServiceImpl implements CartService {
break forTemplates;
}
}
throw new ServiceException(ResultCode.GOODS_NOT_SUPPORT, cartSkuVO.getGoodsSku().getGoodsName());
throw new ServiceException(ResultCode.SHIPPING_NOT_APPLY, cartSkuVO.getGoodsSku().getGoodsName());
}
}

View File

@ -258,7 +258,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
this.sendUpdateStatusMessage(orderMessage);
String message = "订单付款,付款方式[" + PaymentMethodEnum.valueOf(paymentMethod).paymentName() + "]";
OrderLog orderLog = new OrderLog(orderSn, "-1", UserEnums.SYSTEM.name(), "系统操作", message);
OrderLog orderLog = new OrderLog(orderSn, "-1", UserEnums.SYSTEM.getRole(), "系统操作", message);
orderLogService.save(orderLog);