Merge branch 'feature/pg' of gitee.com:beijing_hongye_huicheng/lilishop into feature/pg

This commit is contained in:
paulGao 2021-05-20 15:29:27 +08:00
commit e5783fcd67
14 changed files with 25 additions and 317 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

@ -1,166 +0,0 @@
package cn.lili.common.enums;
/**
* @author Chopper
* @version v4.1
* @Description: 错误码 5位
* 第一位 1:商品2:会员3:订单,4:店铺,5:页面,6:其他
* @since 2020/11/17 4:44 下午
*/
public enum MessageCode {
E401("认证过期"),
E10001("商品ID不存在"),
E10002("商品名称不正确名称应为2-50字符"),
E10003("此规格已绑定分类不允许删除"),
E10004("该分类名称已存在"),
E10005("父分类不存在"),
E10006("最多为三级分类,添加失败"),
E10007("此类别下存在子类别不能删除"),
E10008("此类别下存在商品不能删除"),
E10009("通过categoryId获取分类失败"),
E10010("不能重复添加分销商品"),
E10011("无法将此商品放入回收站"),
E10012("无法彻底删除从此商品"),
E10013("无法下架此商品"),
E10014("无法还原此商品"),
E20001("用户名密码不能为空"),
E20002("该用户名已被注册"),
E20003("该手机号已被注册"),
E20004("用户不存在"),
E20005("修改资料成功"),
E20006("修改资料失败"),
E20007("手机号不存在"),
E20008("重置密码成功"),
E20009("修改手机号成功"),
E20010("旧密码不正确"),
E20011("修改密码成功"),
E20012("用户未登录"),
E20013("发布评价成功"),
E20014("领取优惠券成功"),
E20015("分销商不存在"),
E20016("分销商已申请,无需重复提交"),
E20017("密码错误"),
E20018("分销商清退失败"),
E20019("审核分销商失败"),
E20020("用户名或密码错误"),
E20021("订单状态不允许申请售后,请联系平台或商家"),
E20022("无权操作此数据!"),
E20023("此用户已禁用!"),
E20024("未对当前用户做手机号码校验!"),
E20025("可提现金额不足!"),
E20026("零钱提现失败!"),
E20027("请填写审核备注!"),
E20028("请勿重复签到"),
E20029("分销商不存在或已被清退"),
E20030("分销商提现记录不存在"),
E20031("分销商提现状态不正确,无法提现"),
E20032("余额账户不存在,无法操作"),
E20033("验证码错误,请重新输入"),
E20034("最多可以设置10个角色"),
E20035("订单已支付,请勿反复支付"),
E20036("该订单已部分支付,请前往订单中心进行支付"),
E20037("余额充值已支付成功,请勿重复支付"),
E20038("余额不足以支付订单,请充值"),
E20039("支付业务异常,请稍后重试"),
E20040("当前订单不需要付款,请返回订单列表重新操作"),
E20041("非当前用户的手机号"),
E20101("联合第三方登录,未绑定会员"),
E20102("联合第三方登录,授权信息错误"),
E20103("会员发票信息重复"),
E20104("会员发票信息不存在"),
E20105("权限不足"),
E30001("购物车添加成功"),
E30002("购物车数量更新成功"),
E30003("购物车选中更新成功"),
E30004("清空购物车成功"),
E30005("删除购物车中的一个或多个产品成功"),
E30006("读取结算页的购物车异常"),
E30007("创建订单异常,请稍后重试"),
E30008("订单状态错误,无法进行确认收货"),
E30009("订单确定收货成功"),
E30010("订单不存在"),
E30011("已支付的订单不能修改金额"),
E30013("物流错误"),
E30014("当前订单不能发货"),
E30015("非当前会员的订单"),
E30016("无法重复提交评价"),
E30017("付款金额和应付金额不一致"),
E30018("售后已审核,无法重复操作"),
E30019("物流公司错误,请重新选择"),
E30020("请选择要投诉的商品"),
E30021("当前订单无法核销"),
E30022("当前售后单无法取消"),
E30023("当前订单未支付,不能申请售后"),
E30024("订单已支付,不能再次进行支付"),
E30025("收银台信息获取错误"),
E30026("积分不足,不能兑换"),
E30027("优惠券已使用/已过期,不能使用"),
E30028("投诉异常,请稍后重试"),
E40001("非当前店铺数据,无法操作"),
E40002("此店铺不存在"),
E40003("店铺名称已存在!"),
E40004("参数有误!"),
E40005("已有店铺,无需重复申请"),
E40006("只有已出账结算单可以核对"),
E40007("只有已核对结算单可以审核"),
E40008("只有已审核结算单可以支付"),
E40009("只有商家可以操作结算单核对"),
E40010("只有管理可以操作结算单核对"),
E40011("存在不属于此店铺的商品"),
E50001("该分类名称已存在"),
E50002("父分类不存在"),
E50003("最多为三级分类,添加失败"),
E50004("最多为三级分类,修改失败"),
E50005("文章分类名称重复,修改失败"),
E50006("该文章分类下存在子分类,不能删除"),
E50007("专题自动发布,无需操作发布"),
E50008("当前页面为开启状态,无法删除"),
E50009("当前页面为唯一页面,无法删除"),
E50010("页面已发布,无需重复提交"),
E50011("需传入查询ID"),
E50012("当前消息模板不存在"),
E50013("短信签名已存在"),
E50014("该文章分类下存在文章,不能删除"),
E60000("请先登录再访问此接口"),
E60001("操作失败"),
E60002("非法请求"),
E60003("请求正在处理,请稍后再试"),
E60004("验证码为空或已过期,请重新获取"),
E60005("验证失败"),
E60007("OSS未配置"),
E60008("支付暂不支持"),
E60009("错误的客户端"),
E60010("角色已绑定部门,请逐个删除"),
E60011("角色已绑定管理员,请逐个删除"),
E60012("菜单已绑定角色,请先删除或编辑角色"),
E60013("部门已经绑定管理员,请先删除或编辑管理员"),
S21001("分销商清退成功"),
S21002("审核分销商成功"),
S44000("操作成功"),
S50001("删除文章分类成功");
private final String value;
MessageCode(String value) {
this.value = value;
}
public Integer getCode() {
return Integer.parseInt(this.name().replace("E", "").replace("S", ""));
}
public String getValue() {
return value;
}
}

View File

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

View File

@ -4,6 +4,8 @@ package cn.lili.common.enums;
import cn.lili.common.vo.ResultMessage;
/**
* 返回结果工具类
*
* @author lili
*/
public class ResultUtil<T> {
@ -74,17 +76,21 @@ public class ResultUtil<T> {
public static <T> ResultMessage<T> success() {
return new ResultUtil<T>().setSuccessMsg(ResultCode.SUCCESS);
}
/**
* 返回失败
*
* @param resultCode 返回状态码
*/
public static <T> ResultMessage<T> error(ResultCode resultCode) {
return new ResultUtil<T>().setErrorMsg(resultCode);
}
/**
* 返回失败
*
* @param code 状态码
* @param msg 返回消息
* @param msg 返回消息
*/
public static <T> ResultMessage<T> error(Integer code, String msg) {
return new ResultUtil<T>().setErrorMsg(code, msg);
@ -104,8 +110,9 @@ public class ResultUtil<T> {
/**
* 服务器异常 追加状态码
*
* @param code 状态码
* @param msg 返回消息
* @param msg 返回消息
*/
public ResultMessage<T> setErrorMsg(Integer code, String msg) {
this.resultMessage.setSuccess(false);

View File

@ -1,129 +0,0 @@
package cn.lili.common.enums;
/**
* 日志枚举
*
* @author Chopper
*/
public enum StoreLogType {
/**
* 默认0操作
*/
OPERATION,
/**
* 1登录
*/
LOGIN,
/**
* 商品
*/
//商品上架
//商品下架
//发布商品
//修改商品
//删除商品
//添加商品模板
//编辑商品库存
//增加店铺商品分类
//编辑店铺商品分类
/**
* 订单
*/
//发货
//修改收件信息
/**
* 售后
*/
//审核退货单
//确定收货
//拒绝收货
//退款
//拒绝退款
/**
* 营销
*/
//添加分销商品
//下架分销商品
//编辑分销商品
//创建满减活动
//编辑满减活动
//下架满减活动
//上架满减活动
//删除满减活动
//添加优惠券
//编辑优惠券
//关闭优惠券
//参与秒杀活动
//编辑秒杀活动
//下架秒杀活动
//上架秒杀活动
//删除秒杀活动
/**
* 设置
*/
//选择物流公司
//取消物流公司
//添加运费模板
//编辑运费模板
//删除运费模板
//设置店铺信息
//修改店铺退货地址
//新增自提点
//编辑自提点
//删除自提点
//发布店铺首页
}

View File

@ -1,7 +1,6 @@
package cn.lili.common.security.context;
import cn.lili.common.cache.Cache;
import cn.lili.common.enums.MessageCode;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.AuthUser;

View File

@ -1,6 +1,5 @@
package cn.lili.common.utils;
import cn.lili.common.enums.MessageCode;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.AuthUser;

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

@ -236,6 +236,9 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
@Override
public Integer goodsNum(GoodsStatusEnum goodsStatusEnum, GoodsAuthEnum goodsAuthEnum) {
LambdaQueryWrapper<Goods> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(Goods::getDeleteFlag,false);
if (goodsStatusEnum != null) {
queryWrapper.eq(Goods::getMarketEnable, goodsStatusEnum.name());
}

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

@ -260,7 +260,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);

View File

@ -2,7 +2,6 @@ package cn.lili.modules.payment.kit.plugin.alipay;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONUtil;
import cn.lili.common.enums.MessageCode;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.utils.SpringContextUtil;

View File

@ -1,6 +1,5 @@
package cn.lili.modules.permission.serviceimpl;
import cn.lili.common.enums.MessageCode;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.AuthUser;