From fcfa140a0ab47d8d3335109014422668276c08f3 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Tue, 29 Jun 2021 09:23:22 +0800 Subject: [PATCH 01/23] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/StudioServiceImpl.java | 6 +- .../order/cart/render/TradeBuilder.java | 6 + .../order/cart/service/CartService.java | 7 + .../order/order/service/OrderService.java | 4 +- .../order/order/service/TradeService.java | 7 + .../order/serviceimpl/TradeServiceImpl.java | 192 +----------------- 6 files changed, 27 insertions(+), 195 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java b/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java index 990dd0cd..b48a6047 100644 --- a/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java @@ -62,9 +62,9 @@ public class StudioServiceImpl extends ServiceImpl impleme public Boolean create(Studio studio) { try { //创建小程序直播 -// Map roomMap = wechatLivePlayerUtil.create(studio); -// studio.setRoomId(Integer.parseInt(roomMap.get("roomId"))); -// studio.setQrCodeUrl(roomMap.get("qrcodeUrl")); + Map roomMap = wechatLivePlayerUtil.create(studio); + studio.setRoomId(Integer.parseInt(roomMap.get("roomId"))); + studio.setQrCodeUrl(roomMap.get("qrcodeUrl")); studio.setStoreId(UserContext.getCurrentUser().getStoreId()); studio.setStatus(StudioStatusEnum.NEW.name()); //直播间添加成功发送直播间开启、关闭延时任务 diff --git a/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java b/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java index 9a69a2a7..4454c8f9 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java @@ -80,6 +80,10 @@ public class TradeBuilder { /** * 构造一笔交易 + * 1.从缓存中读取交易数据 + * 2.从购物车列表中筛选出已选择的SKU列表存入交易中 + * 3.渲染整个交易(0-> 校验商品 1-》 满优惠渲染 2->渲染优惠 3->优惠券渲染 4->计算运费 5->计算价格 6->分销渲染 7->其他渲染) + * 4.将已选择的购物车列表存入交易中 * * @param checkedWay 购物车类型 * @return 购物车展示信息 @@ -114,6 +118,8 @@ public class TradeBuilder { /** * 创建一笔交易 + * 1.构造交易 + * 2.创建交易 * * @param checkedWay 购物车类型 * @return 交易信息 diff --git a/framework/src/main/java/cn/lili/modules/order/cart/service/CartService.java b/framework/src/main/java/cn/lili/modules/order/cart/service/CartService.java index 2d997b3f..c47b37e9 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/service/CartService.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/service/CartService.java @@ -162,6 +162,13 @@ public interface CartService { /** * 创建交易 + * 1.获取购物车类型,不同的购物车类型有不同的订单逻辑 + * 购物车类型:购物车、立即购买、虚拟商品、拼团、积分 + * 2.校验用户的收件人信息 + * 3.设置交易的基础参数 + * 4.交易信息存储到缓存中 + * 5.创建交易 + * 6.清除购物车选择数据 * * @param tradeParams 创建交易参数 * @return 交易信息 diff --git a/framework/src/main/java/cn/lili/modules/order/order/service/OrderService.java b/framework/src/main/java/cn/lili/modules/order/order/service/OrderService.java index a44078ff..fbc45510 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/service/OrderService.java +++ b/framework/src/main/java/cn/lili/modules/order/order/service/OrderService.java @@ -70,7 +70,9 @@ public interface OrderService extends IService { OrderDetailVO queryDetail(String orderSn); /** - * 创建交易 + * 创建订单 + * 1.检查交易信息 + * 2.循环交易购物车列表,创建订单以及相关信息 * * @param tradeDTO 交易DTO */ diff --git a/framework/src/main/java/cn/lili/modules/order/order/service/TradeService.java b/framework/src/main/java/cn/lili/modules/order/order/service/TradeService.java index 91457521..21fcfe5b 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/service/TradeService.java +++ b/framework/src/main/java/cn/lili/modules/order/order/service/TradeService.java @@ -14,6 +14,13 @@ public interface TradeService extends IService { /** * 创建交易 + * 1.订单数据校验 + * 2.积分预处理 + * 3.优惠券预处理 + * 4.添加交易 + * 5.添加订单 + * 6.将交易写入缓存供消费者调用 + * 7.发送交易创建消息 * * @param tradeDTO 购物车视图 * @return 交易 diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/TradeServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/TradeServiceImpl.java index ed5d50b3..f1b66b6e 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/TradeServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/TradeServiceImpl.java @@ -1,191 +1 @@ -package cn.lili.modules.order.order.serviceimpl; - -import cn.lili.common.cache.Cache; -import cn.lili.common.cache.CachePrefix; -import cn.lili.common.enums.ResultCode; -import cn.lili.common.exception.ServiceException; -import cn.lili.common.rocketmq.RocketmqSendCallbackBuilder; -import cn.lili.common.rocketmq.tags.MqOrderTagsEnum; -import cn.lili.config.rocketmq.RocketmqCustomProperties; -import cn.lili.modules.member.entity.dos.Member; -import cn.lili.modules.member.entity.dos.MemberAddress; -import cn.lili.modules.member.service.MemberService; -import cn.lili.modules.order.cart.entity.dto.MemberCouponDTO; -import cn.lili.modules.order.cart.entity.dto.TradeDTO; -import cn.lili.modules.order.cart.entity.vo.CartVO; -import cn.lili.modules.order.order.entity.dos.Order; -import cn.lili.modules.order.order.entity.dos.Trade; -import cn.lili.modules.order.order.entity.enums.PayStatusEnum; -import cn.lili.modules.order.order.mapper.TradeMapper; -import cn.lili.modules.order.order.service.OrderService; -import cn.lili.modules.order.order.service.TradeService; -import cn.lili.modules.promotion.service.CouponService; -import cn.lili.modules.promotion.service.MemberCouponService; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.apache.rocketmq.spring.core.RocketMQTemplate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - -/** - * 交易业务层实现 - * - * @author Chopper - * @date 2020/11/17 7:39 下午 - */ -@Service -@Transactional -public class TradeServiceImpl extends ServiceImpl implements TradeService { - - //缓存 - @Autowired - private Cache cache; - //订单 - @Autowired - private OrderService orderService; - //会员 - @Autowired - private MemberService memberService; - //优惠券 - @Autowired - private CouponService couponService; - //会员优惠券 - @Autowired - private MemberCouponService memberCouponService; - //RocketMQ - @Autowired - private RocketMQTemplate rocketMQTemplate; - //RocketMQ 配置 - @Autowired - private RocketmqCustomProperties rocketmqCustomProperties; - - - @Override - @Transactional(rollbackFor = Exception.class) - public Trade createTrade(TradeDTO tradeDTO) { - - //创建订单预校验 - createTradeCheck(tradeDTO); - - - Trade trade = new Trade(tradeDTO); - String key = CachePrefix.TRADE.getPrefix() + trade.getSn(); - //积分预处理 - pointPretreatment(tradeDTO); - //优惠券预处理 - couponPretreatment(tradeDTO); - //添加交易 - this.save(trade); - //添加订单 - orderService.intoDB(tradeDTO); - //写入缓存,给消费者调用 - cache.put(key, tradeDTO); - //构建订单创建消息 - String destination = rocketmqCustomProperties.getOrderTopic() + ":" + MqOrderTagsEnum.ORDER_CREATE.name(); - //发送订单创建消息 - rocketMQTemplate.asyncSend(destination, key, RocketmqSendCallbackBuilder.commonCallback()); - return trade; - } - - /** - * 创建订单最后一步校验 - * - * @param tradeDTO - */ - private void createTradeCheck(TradeDTO tradeDTO) { - - //创建订单如果没有收获地址, - MemberAddress memberAddress = tradeDTO.getMemberAddress(); - if (memberAddress == null) { - throw new ServiceException(ResultCode.MEMBER_ADDRESS_NOT_EXIST); - } - - /** - * 订单配送区域校验 - */ - if (tradeDTO.getNotSupportFreight() != null && tradeDTO.getNotSupportFreight().size() > 0) { - StringBuilder stringBuilder = new StringBuilder("包含商品有-"); - tradeDTO.getNotSupportFreight().forEach(sku -> { - stringBuilder.append(sku.getGoodsSku().getGoodsName()); - }); - throw new ServiceException(ResultCode.ORDER_NOT_SUPPORT_DISTRIBUTION, stringBuilder.toString()); - } - } - - @Override - public Trade getBySn(String sn) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(Trade::getSn, sn); - return this.getOne(queryWrapper); - } - - - @Override - public void payTrade(String tradeSn, String paymentName, String receivableNo) { - LambdaQueryWrapper orderQueryWrapper = new LambdaQueryWrapper<>(); - orderQueryWrapper.eq(Order::getTradeSn, tradeSn); - List orders = orderService.list(orderQueryWrapper); - for (Order order : orders) { - orderService.payOrder(order.getSn(), paymentName, receivableNo); - } - Trade trade = this.getBySn(tradeSn); - trade.setPayStatus(PayStatusEnum.PAID.name()); - this.saveOrUpdate(trade); - } - - /** - * 积分预处理 - * 下单同时,使用积分 - * - * @param tradeDTO - */ - private void pointPretreatment(TradeDTO tradeDTO) { - StringBuilder orderSns = new StringBuilder(); - for (CartVO item : tradeDTO.getCartList()) { - orderSns.append(item.getSn()).append(","); - } - if (tradeDTO.getPriceDetailDTO() != null && tradeDTO.getPriceDetailDTO().getPayPoint() != null && tradeDTO.getPriceDetailDTO().getPayPoint() > 0) { - Member userInfo = memberService.getUserInfo(); - if (userInfo.getPoint() < tradeDTO.getPriceDetailDTO().getPayPoint()) { - throw new ServiceException(ResultCode.PAY_POINT_ENOUGH); - } - boolean result = memberService.updateMemberPoint(tradeDTO.getPriceDetailDTO(). - getPayPoint().longValue(), false, tradeDTO.getMemberId(), - "订单【" + orderSns + "】创建,积分扣减"); - - if (!result) { - throw new ServiceException(ResultCode.PAY_POINT_ENOUGH); - } - } - } - - - /** - * 优惠券预处理 - * 下单同时,扣除优惠券 - * - * @param tradeDTO - */ - private void couponPretreatment(TradeDTO tradeDTO) { - List memberCouponDTOList = new ArrayList<>(); - if (null != tradeDTO.getPlatformCoupon()) { - memberCouponDTOList.add(tradeDTO.getPlatformCoupon()); - } - Collection storeCoupons = tradeDTO.getStoreCoupons().values(); - if (!storeCoupons.isEmpty()) { - memberCouponDTOList.addAll(storeCoupons); - } - List ids = memberCouponDTOList.stream().map(e -> e.getMemberCoupon().getId()).collect(Collectors.toList()); - memberCouponService.used(ids); - memberCouponDTOList.forEach(e -> couponService.usedCoupon(e.getMemberCoupon().getCouponId(), 1)); - - } - - -} \ No newline at end of file +package cn.lili.modules.order.order.serviceimpl; import cn.lili.common.cache.Cache; import cn.lili.common.cache.CachePrefix; import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.common.rocketmq.RocketmqSendCallbackBuilder; import cn.lili.common.rocketmq.tags.MqOrderTagsEnum; import cn.lili.config.rocketmq.RocketmqCustomProperties; import cn.lili.modules.member.entity.dos.Member; import cn.lili.modules.member.entity.dos.MemberAddress; import cn.lili.modules.member.service.MemberService; import cn.lili.modules.order.cart.entity.dto.MemberCouponDTO; import cn.lili.modules.order.cart.entity.dto.TradeDTO; import cn.lili.modules.order.cart.entity.vo.CartVO; import cn.lili.modules.order.order.entity.dos.Order; import cn.lili.modules.order.order.entity.dos.Trade; import cn.lili.modules.order.order.entity.enums.PayStatusEnum; import cn.lili.modules.order.order.mapper.TradeMapper; import cn.lili.modules.order.order.service.OrderService; import cn.lili.modules.order.order.service.TradeService; import cn.lili.modules.promotion.service.CouponService; import cn.lili.modules.promotion.service.MemberCouponService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.stream.Collectors; /** * 交易业务层实现 * * @author Chopper * @date 2020/11/17 7:39 下午 */ @Service @Transactional public class TradeServiceImpl extends ServiceImpl implements TradeService { //缓存 @Autowired private Cache cache; //订单 @Autowired private OrderService orderService; //会员 @Autowired private MemberService memberService; //优惠券 @Autowired private CouponService couponService; //会员优惠券 @Autowired private MemberCouponService memberCouponService; //RocketMQ @Autowired private RocketMQTemplate rocketMQTemplate; //RocketMQ 配置 @Autowired private RocketmqCustomProperties rocketmqCustomProperties; @Override @Transactional(rollbackFor = Exception.class) public Trade createTrade(TradeDTO tradeDTO) { //创建订单预校验 createTradeCheck(tradeDTO); Trade trade = new Trade(tradeDTO); String key = CachePrefix.TRADE.getPrefix() + trade.getSn(); //积分预处理 pointPretreatment(tradeDTO); //优惠券预处理 couponPretreatment(tradeDTO); //添加交易 this.save(trade); //添加订单 orderService.intoDB(tradeDTO); //写入缓存,给消费者调用 cache.put(key, tradeDTO); //构建订单创建消息 String destination = rocketmqCustomProperties.getOrderTopic() + ":" + MqOrderTagsEnum.ORDER_CREATE.name(); //发送订单创建消息 rocketMQTemplate.asyncSend(destination, key, RocketmqSendCallbackBuilder.commonCallback()); return trade; } /** * 创建订单最后一步校验 * * @param tradeDTO */ private void createTradeCheck(TradeDTO tradeDTO) { //创建订单如果没有收获地址, MemberAddress memberAddress = tradeDTO.getMemberAddress(); if (memberAddress == null) { throw new ServiceException(ResultCode.MEMBER_ADDRESS_NOT_EXIST); } /** * 订单配送区域校验 */ if (tradeDTO.getNotSupportFreight() != null && tradeDTO.getNotSupportFreight().size() > 0) { StringBuilder stringBuilder = new StringBuilder("包含商品有-"); tradeDTO.getNotSupportFreight().forEach(sku -> { stringBuilder.append(sku.getGoodsSku().getGoodsName()); }); throw new ServiceException(ResultCode.ORDER_NOT_SUPPORT_DISTRIBUTION, stringBuilder.toString()); } } @Override public Trade getBySn(String sn) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(Trade::getSn, sn); return this.getOne(queryWrapper); } @Override public void payTrade(String tradeSn, String paymentName, String receivableNo) { LambdaQueryWrapper orderQueryWrapper = new LambdaQueryWrapper<>(); orderQueryWrapper.eq(Order::getTradeSn, tradeSn); List orders = orderService.list(orderQueryWrapper); for (Order order : orders) { orderService.payOrder(order.getSn(), paymentName, receivableNo); } Trade trade = this.getBySn(tradeSn); trade.setPayStatus(PayStatusEnum.PAID.name()); this.saveOrUpdate(trade); } /** * 积分预处理 * 下单同时,使用积分 * * @param tradeDTO */ private void pointPretreatment(TradeDTO tradeDTO) { StringBuilder orderSns = new StringBuilder(); for (CartVO item : tradeDTO.getCartList()) { orderSns.append(item.getSn()).append(","); } if (tradeDTO.getPriceDetailDTO() != null && tradeDTO.getPriceDetailDTO().getPayPoint() != null && tradeDTO.getPriceDetailDTO().getPayPoint() > 0) { Member userInfo = memberService.getUserInfo(); if (userInfo.getPoint() < tradeDTO.getPriceDetailDTO().getPayPoint()) { throw new ServiceException(ResultCode.PAY_POINT_ENOUGH); } boolean result = memberService.updateMemberPoint(tradeDTO.getPriceDetailDTO(). getPayPoint().longValue(), false, tradeDTO.getMemberId(), "订单【" + orderSns + "】创建,积分扣减"); if (!result) { throw new ServiceException(ResultCode.PAY_POINT_ENOUGH); } } } /** * 优惠券预处理 * 下单同时,扣除优惠券 * * @param tradeDTO */ private void couponPretreatment(TradeDTO tradeDTO) { List memberCouponDTOList = new ArrayList<>(); if (null != tradeDTO.getPlatformCoupon()) { memberCouponDTOList.add(tradeDTO.getPlatformCoupon()); } Collection storeCoupons = tradeDTO.getStoreCoupons().values(); if (!storeCoupons.isEmpty()) { memberCouponDTOList.addAll(storeCoupons); } List ids = memberCouponDTOList.stream().map(e -> e.getMemberCoupon().getId()).collect(Collectors.toList()); memberCouponService.used(ids); memberCouponDTOList.forEach(e -> couponService.usedCoupon(e.getMemberCoupon().getCouponId(), 1)); } } \ No newline at end of file From d96d5edcd523a5ce66deca8768083b4c7ff708ff Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 29 Jun 2021 10:13:18 +0800 Subject: [PATCH 02/23] =?UTF-8?q?=E4=BC=9A=E5=91=98=E6=8F=90=E7=8E=B0api?= =?UTF-8?q?=E6=B3=A8=E8=A7=A3=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/member/MemberWithdrawApplyManagerController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manager-api/src/main/java/cn/lili/controller/member/MemberWithdrawApplyManagerController.java b/manager-api/src/main/java/cn/lili/controller/member/MemberWithdrawApplyManagerController.java index eff087ba..57f2112d 100644 --- a/manager-api/src/main/java/cn/lili/controller/member/MemberWithdrawApplyManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/member/MemberWithdrawApplyManagerController.java @@ -47,7 +47,7 @@ public class MemberWithdrawApplyManagerController { @ApiOperation(value = "提现申请审核") @PostMapping @ApiImplicitParams({ - @ApiImplicitParam(name = "apply_id", value = "审核记录id", required = true, paramType = "query"), + @ApiImplicitParam(name = "applyId", value = "审核记录id", required = true, paramType = "query"), @ApiImplicitParam(name = "result", value = "审核结果", required = true, paramType = "query", dataType = "boolean"), @ApiImplicitParam(name = "remark", value = "审核备注", paramType = "query") }) From 5a415ffc7779e5d546ea3d52de8638d88a7c6850 Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 29 Jun 2021 10:25:45 +0800 Subject: [PATCH 03/23] =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E5=88=A4=E5=AE=9A?= =?UTF-8?q?=E8=AF=AD=E5=8F=A5=E9=A1=BA=E5=BA=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/lili/event/impl/NoticeMessageExecute.java | 4 ++-- .../modules/order/order/serviceimpl/OrderServiceImpl.java | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/consumer/src/main/java/cn/lili/event/impl/NoticeMessageExecute.java b/consumer/src/main/java/cn/lili/event/impl/NoticeMessageExecute.java index 3b63bdd8..5a038765 100644 --- a/consumer/src/main/java/cn/lili/event/impl/NoticeMessageExecute.java +++ b/consumer/src/main/java/cn/lili/event/impl/NoticeMessageExecute.java @@ -59,7 +59,7 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent, //如果订单状态不为空 if (orderDetailVO != null) { Map params = new HashMap<>(); - switch (orderMessage.getNewStatus()){ + switch (orderMessage.getNewStatus()) { //如果订单新的状态为已取消 则发送取消订单站内信 case CANCELLED: params.put(NoticeMessageParameterEnum.CANCEL_REASON.getType(), orderDetailVO.getOrder().getCancelReason()); @@ -82,7 +82,7 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent, break; //如果是拼团订单,发送拼团成功消息 case UNDELIVERED: - if(orderDetailVO.getOrder().getOrderPromotionType().equals(OrderPromotionTypeEnum.PINTUAN.name())){ + if (OrderPromotionTypeEnum.PINTUAN.name().equals(orderDetailVO.getOrder().getOrderPromotionType())) { //拼团成功消息 noticeMessageDTO.setNoticeMessageNodeEnum(NoticeMessageNodeEnum.PINTUAN_SUCCESS); } diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java index c0b02ebc..f423e6ea 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java @@ -203,8 +203,7 @@ public class OrderServiceImpl extends ServiceImpl implements public Order cancel(String orderSn, String reason) { Order order = OperationalJudgment.judgment(this.getBySn(orderSn)); //如果订单促销类型不为空&&订单是拼团订单,并且订单未成团,则抛出异常 - if (StringUtils.isNotEmpty(order.getOrderPromotionType()) - && order.getOrderPromotionType().equals(OrderPromotionTypeEnum.PINTUAN.name()) + if (OrderPromotionTypeEnum.PINTUAN.name().equals(order.getOrderPromotionType()) && !order.getOrderStatus().equals(OrderStatusEnum.UNDELIVERED.name())) { throw new ServiceException(ResultCode.ORDER_CAN_NOT_CANCEL); } @@ -286,7 +285,7 @@ public class OrderServiceImpl extends ServiceImpl implements Order order = this.getBySn(orderSn); //判断是否为拼团订单,进行特殊处理 //判断订单类型进行不同的订单确认操作 - if (order.getOrderPromotionType() != null && order.getOrderPromotionType().equals(OrderPromotionTypeEnum.PINTUAN.name())) { + if (OrderPromotionTypeEnum.PINTUAN.name().equals(order.getOrderPromotionType())) { this.checkPintuanOrder(order.getPromotionId(), order.getParentOrderSn()); } else { //判断订单类型 From 39e851ee789c714900cdb59e4d45de6aac5ec75f Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 29 Jun 2021 11:15:27 +0800 Subject: [PATCH 04/23] =?UTF-8?q?aop=E7=A7=AF=E5=88=86=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=85=BC=E5=AE=B9=E9=97=AE=E9=A2=98=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/lili/event/impl/NoticeMessageExecute.java | 5 ++++- .../entity/aop/interceptor/PointLogInterceptor.java | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/consumer/src/main/java/cn/lili/event/impl/NoticeMessageExecute.java b/consumer/src/main/java/cn/lili/event/impl/NoticeMessageExecute.java index 5a038765..e3346136 100644 --- a/consumer/src/main/java/cn/lili/event/impl/NoticeMessageExecute.java +++ b/consumer/src/main/java/cn/lili/event/impl/NoticeMessageExecute.java @@ -148,11 +148,14 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent, @Override public void memberPointChange(MemberPointMessage memberPointMessage) { + if (memberPointMessage == null) { + return; + } //组织站内信参数 NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO(); noticeMessageDTO.setMemberId(memberPointMessage.getMemberId()); Map params = new HashMap<>(); - if (memberPointMessage.getType().equals(1)) { + if (memberPointMessage.getType()) { params.put("expenditure_points", "0"); params.put("income_points", memberPointMessage.getPoint().toString()); } else { diff --git a/framework/src/main/java/cn/lili/modules/member/entity/aop/interceptor/PointLogInterceptor.java b/framework/src/main/java/cn/lili/modules/member/entity/aop/interceptor/PointLogInterceptor.java index 7d6708ab..425fcb72 100644 --- a/framework/src/main/java/cn/lili/modules/member/entity/aop/interceptor/PointLogInterceptor.java +++ b/framework/src/main/java/cn/lili/modules/member/entity/aop/interceptor/PointLogInterceptor.java @@ -40,9 +40,9 @@ public class PointLogInterceptor { point = Long.valueOf(obj[0].toString()); } //变动类型 - Integer type = 0; + Boolean type = false; if (obj[1] != null) { - type = Integer.valueOf(obj[1].toString()); + type = Boolean.valueOf(obj[1].toString()); } //会员ID String memberId = ""; @@ -55,7 +55,7 @@ public class PointLogInterceptor { MemberPointsHistory memberPointsHistory = new MemberPointsHistory(); memberPointsHistory.setMemberId(member.getId()); memberPointsHistory.setMemberName(member.getUsername()); - memberPointsHistory.setPointType(type); + memberPointsHistory.setPointType(type ? 1 : 0); memberPointsHistory.setVariablePoint(point); memberPointsHistory.setBeforePoint(new Double(CurrencyUtil.sub(member.getPoint(), point)).longValue()); memberPointsHistory.setPoint(member.getPoint()); @@ -64,7 +64,7 @@ public class PointLogInterceptor { memberPointsHistoryService.save(memberPointsHistory); } } catch (Exception e) { - log.error("积分操作错误",e); + log.error("积分操作错误", e); } From 50f96727b3c77eb197392d053604635a4ff109dc Mon Sep 17 00:00:00 2001 From: lifenlong Date: Tue, 29 Jun 2021 11:24:53 +0800 Subject: [PATCH 05/23] =?UTF-8?q?=E5=88=86=E9=94=80=E5=95=86=E5=93=81VO?= =?UTF-8?q?=E8=BF=94=E5=9B=9EGoodsId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/distribution/entity/vos/DistributionGoodsVO.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/framework/src/main/java/cn/lili/modules/distribution/entity/vos/DistributionGoodsVO.java b/framework/src/main/java/cn/lili/modules/distribution/entity/vos/DistributionGoodsVO.java index 73a075d9..07d266d1 100644 --- a/framework/src/main/java/cn/lili/modules/distribution/entity/vos/DistributionGoodsVO.java +++ b/framework/src/main/java/cn/lili/modules/distribution/entity/vos/DistributionGoodsVO.java @@ -39,6 +39,9 @@ public class DistributionGoodsVO { @ApiModelProperty(value = "商品编号") private String sn; + @ApiModelProperty(value = "商品ID") + private String goodsId; + @ApiModelProperty(value = "规格ID") private String skuId; From 5e54b2f179b171ce177b06f412350d4a682625d1 Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 29 Jun 2021 11:56:40 +0800 Subject: [PATCH 06/23] =?UTF-8?q?=E8=A7=84=E6=A0=BC=E5=80=BC=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- update-sql/version4.0to4.1.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/update-sql/version4.0to4.1.sql b/update-sql/version4.0to4.1.sql index a9a48e72..8570eda7 100644 --- a/update-sql/version4.0to4.1.sql +++ b/update-sql/version4.0to4.1.sql @@ -10,6 +10,7 @@ ALTER TABLE li_goods DROP COLUMN freight_payer; /**添加商品类型**/ ALTER TABLE li_goods ADD goods_type VARCHAR ( 32 ); ALTER TABLE li_goods_sku ADD goods_type VARCHAR ( 32 ); +ALTER TABLE li_specification ADD spec_value text; UPDATE li_goods SET goods_type = "PHYSICAL_GOODS"; UPDATE li_goods_sku SET goods_type = "PHYSICAL_GOODS"; /**增加优惠券有效期类型**/ From 3ee3e49d0b46f8ef42662548f50c0506f5c11072 Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 29 Jun 2021 15:40:37 +0800 Subject: [PATCH 07/23] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=9C=A8=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E7=9B=B4=E6=92=AD=E6=97=B6=E6=B2=A1=E6=9C=89=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=8A=9B=E5=87=BA=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=A4=84=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lili/modules/broadcast/serviceimpl/StudioServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java b/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java index b48a6047..ce2823ce 100644 --- a/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java @@ -200,7 +200,7 @@ public class StudioServiceImpl extends ServiceImpl impleme .eq(recommend != null, "recommend", true) .eq(status != null, "status", status) .orderByDesc("create_time"); - if (UserContext.getCurrentUser().getRole().equals(UserEnums.STORE)) { + if (UserContext.getCurrentUser()!=null&&UserContext.getCurrentUser().getRole().equals(UserEnums.STORE)) { queryWrapper.eq("store_id", UserContext.getCurrentUser().getStoreId()); } return this.page(PageUtil.initPage(pageVO), queryWrapper); From c1b9f287c7c8d764a0fd2e2089d31418a562daab Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 29 Jun 2021 16:26:52 +0800 Subject: [PATCH 08/23] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E5=8D=B3=E8=B5=8B=E4=BA=88=E6=9D=83=E9=99=90=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E7=94=9F=E6=95=88=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= =?UTF-8?q?=E3=80=82=E7=9B=B4=E6=92=AD=E9=97=B4=E6=9C=AA=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/broadcast/serviceimpl/StudioServiceImpl.java | 2 +- .../permission/serviceimpl/AdminUserServiceImpl.java | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java b/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java index ce2823ce..bc677669 100644 --- a/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java @@ -200,7 +200,7 @@ public class StudioServiceImpl extends ServiceImpl impleme .eq(recommend != null, "recommend", true) .eq(status != null, "status", status) .orderByDesc("create_time"); - if (UserContext.getCurrentUser()!=null&&UserContext.getCurrentUser().getRole().equals(UserEnums.STORE)) { + if (UserContext.getCurrentUser() != null && UserContext.getCurrentUser().getRole().equals(UserEnums.STORE)) { queryWrapper.eq("store_id", UserContext.getCurrentUser().getStoreId()); } return this.page(PageUtil.initPage(pageVO), queryWrapper); diff --git a/framework/src/main/java/cn/lili/modules/permission/serviceimpl/AdminUserServiceImpl.java b/framework/src/main/java/cn/lili/modules/permission/serviceimpl/AdminUserServiceImpl.java index d28b664e..831aec4b 100644 --- a/framework/src/main/java/cn/lili/modules/permission/serviceimpl/AdminUserServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/permission/serviceimpl/AdminUserServiceImpl.java @@ -199,13 +199,12 @@ public class AdminUserServiceImpl extends ServiceImpl 10) { throw new ServiceException(ResultCode.PERMISSION_BEYOND_TEN); } - if (roles != null && roles.size() > 0) { + if (roles.size() > 0) { dbUser.setRoleIds(StringUtils.join(",", roles)); } - - this.save(dbUser); - updateRole(adminUser.getId(), roles); + dbUser = this.findByUsername(dbUser.getUsername()); + updateRole(dbUser.getId(), roles); } From f509b8745d90b9f5b284d7eef388b09e31f43275 Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 29 Jun 2021 16:43:38 +0800 Subject: [PATCH 09/23] =?UTF-8?q?token=E7=94=9F=E6=88=90=E6=97=B6=E6=9D=83?= =?UTF-8?q?=E9=99=90=E8=BF=87=E6=BB=A4=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lili/common/token/base/generate/ManagerTokenGenerate.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/main/java/cn/lili/common/token/base/generate/ManagerTokenGenerate.java b/framework/src/main/java/cn/lili/common/token/base/generate/ManagerTokenGenerate.java index a58d1aa6..5b4d6e70 100644 --- a/framework/src/main/java/cn/lili/common/token/base/generate/ManagerTokenGenerate.java +++ b/framework/src/main/java/cn/lili/common/token/base/generate/ManagerTokenGenerate.java @@ -84,7 +84,7 @@ public class ManagerTokenGenerate extends AbstractTokenGenerate { //for循环路径集合 for (String path : paths) { //如果是超级权限 则计入超级权限 - if (menu.getIsSupper()) { + if (menu.getIsSupper() != null && menu.getIsSupper()) { //如果已有超级权限,则这里就不做权限的累加 if (!superPermissions.contains(path)) { superPermissions.add(path); From 1431d990f97c60e72f58e8fe5386e70dae842412 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Tue, 29 Jun 2021 16:58:54 +0800 Subject: [PATCH 10/23] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=9B=B4=E6=92=AD?= =?UTF-8?q?=E9=97=B4=E6=97=B6=E9=97=B4=E4=B8=8D=E6=AD=A3=E7=A1=AE=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../broadcast/serviceimpl/StudioServiceImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java b/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java index b48a6047..4ef48de1 100644 --- a/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/StudioServiceImpl.java @@ -72,7 +72,7 @@ public class StudioServiceImpl extends ServiceImpl impleme //直播开启延时任务 BroadcastMessage broadcastMessage = new BroadcastMessage(studio.getId(), StudioStatusEnum.START.name()); TimeTriggerMsg timeTriggerMsg = new TimeTriggerMsg(TimeExecuteConstant.BROADCAST_EXECUTOR, - Long.parseLong(studio.getStartTime()), + Long.parseLong(studio.getStartTime()) * 1000L, broadcastMessage, DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.BROADCAST, studio.getId()), rocketmqCustomProperties.getPromotionTopic()); @@ -83,7 +83,7 @@ public class StudioServiceImpl extends ServiceImpl impleme //直播结束延时任务 broadcastMessage = new BroadcastMessage(studio.getId(), StudioStatusEnum.END.name()); timeTriggerMsg = new TimeTriggerMsg(TimeExecuteConstant.BROADCAST_EXECUTOR, - Long.parseLong(studio.getEndTime()), broadcastMessage, + Long.parseLong(studio.getEndTime()) * 1000L, broadcastMessage, DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.BROADCAST, studio.getId()), rocketmqCustomProperties.getPromotionTopic()); //发送促销活动开始的延时任务 @@ -108,8 +108,8 @@ public class StudioServiceImpl extends ServiceImpl impleme this.timeTrigger.edit( TimeExecuteConstant.BROADCAST_EXECUTOR, broadcastMessage, - Long.parseLong(oldStudio.getStartTime()), - Long.parseLong(studio.getStartTime()), + Long.parseLong(oldStudio.getStartTime()) * 1000L, + Long.parseLong(studio.getStartTime()) * 1000L, DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.BROADCAST, studio.getId()), DateUtil.getDelayTime(Long.parseLong(studio.getStartTime())), rocketmqCustomProperties.getPromotionTopic()); @@ -119,8 +119,8 @@ public class StudioServiceImpl extends ServiceImpl impleme this.timeTrigger.edit( TimeExecuteConstant.BROADCAST_EXECUTOR, broadcastMessage, - Long.parseLong(oldStudio.getEndTime()), - Long.parseLong(studio.getEndTime()), + Long.parseLong(oldStudio.getEndTime()) * 1000L, + Long.parseLong(studio.getEndTime()) * 1000L, DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.BROADCAST, studio.getId()), DateUtil.getDelayTime(Long.parseLong(studio.getEndTime())), rocketmqCustomProperties.getPromotionTopic()); From a60a535708db8a8dead6cd8dcbb8ed7adc570203 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Wed, 30 Jun 2021 08:41:04 +0800 Subject: [PATCH 11/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E9=94=80?= =?UTF-8?q?=E5=8F=AF=E6=8F=90=E7=8E=B0=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../other/distribution/DistributionBuyerController.java | 2 +- .../entity/vos/DistributionOrderSearchParams.java | 4 ++-- .../lili/modules/distribution/mapper/DistributionMapper.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionBuyerController.java b/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionBuyerController.java index 410601c2..fd9bbe3a 100644 --- a/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionBuyerController.java +++ b/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionBuyerController.java @@ -53,7 +53,7 @@ public class DistributionBuyerController { @ApiOperation(value = "获取分销员分页订单列表") @GetMapping("/distributionOrder") public ResultMessage> distributionOrderPage(DistributionOrderSearchParams distributionOrderSearchParams) { - distributionOrderSearchParams.setDistributionId(UserContext.getCurrentUser().getId()); + distributionOrderSearchParams.setDistributionId(distributionService.getDistribution().getId()); return ResultUtil.data(distributionOrderService.getDistributionOrderPage(distributionOrderSearchParams)); } diff --git a/framework/src/main/java/cn/lili/modules/distribution/entity/vos/DistributionOrderSearchParams.java b/framework/src/main/java/cn/lili/modules/distribution/entity/vos/DistributionOrderSearchParams.java index 9a4512e6..befe4480 100644 --- a/framework/src/main/java/cn/lili/modules/distribution/entity/vos/DistributionOrderSearchParams.java +++ b/framework/src/main/java/cn/lili/modules/distribution/entity/vos/DistributionOrderSearchParams.java @@ -55,8 +55,8 @@ public class DistributionOrderSearchParams extends PageVO { queryWrapper.like(StringUtils.isNotBlank(distributionName), "distribution_name", distributionName); queryWrapper.eq(StringUtils.isNotBlank(distributionOrderStatus), "distribution_order_status", distributionOrderStatus); queryWrapper.eq(StringUtils.isNotBlank(orderSn), "order_sn", orderSn); - queryWrapper.eq(StringUtils.isNotBlank(StringUtils.toString(distributionId)), "distribution_id", distributionId); - queryWrapper.eq(StringUtils.isNotBlank(StringUtils.toString(storeId)), "store_id", storeId); + queryWrapper.eq(StringUtils.isNotBlank(distributionId), "distribution_id", distributionId); + queryWrapper.eq(StringUtils.isNotBlank(storeId), "store_id", storeId); if (endTime != null && startTime != null) { queryWrapper.between("create_time", startTime, endTime); } diff --git a/framework/src/main/java/cn/lili/modules/distribution/mapper/DistributionMapper.java b/framework/src/main/java/cn/lili/modules/distribution/mapper/DistributionMapper.java index 4a43c512..cd32c80b 100644 --- a/framework/src/main/java/cn/lili/modules/distribution/mapper/DistributionMapper.java +++ b/framework/src/main/java/cn/lili/modules/distribution/mapper/DistributionMapper.java @@ -16,6 +16,6 @@ public interface DistributionMapper extends BaseMapper { @Update("UPDATE li_distribution set can_rebate = can_rebate+#{canRebate} WHERE id = #{distributionId}") void subCanRebate(Double canRebate,String distributionId); - @Update("UPDATE li_distribution set can_rebate = (can_rebate+#{canRebate}) AND rebate_total=(rebate_total+#{canRebate}) AND distribution_order_count=(distribution_order_count+1) WHERE id = #{distributionId}") + @Update("UPDATE li_distribution set can_rebate = (can_rebate+#{canRebate}) , rebate_total=(rebate_total+#{canRebate}) , distribution_order_count=(distribution_order_count+1) WHERE id = #{distributionId}") void addCanRebate(Double canRebate,String distributionId); } \ No newline at end of file From 46f216c19165f2bd73819090938fe027827e7b40 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Wed, 30 Jun 2021 10:26:32 +0800 Subject: [PATCH 12/23] =?UTF-8?q?1.=E5=BA=97=E9=93=BA=E5=85=B3=E9=97=AD?= =?UTF-8?q?=EF=BC=8C=E6=89=B9=E9=87=8F=E4=B8=8B=E6=9E=B6=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E5=95=86=E5=93=81=E9=97=AE=E9=A2=98=E3=80=82=202.=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E5=AE=9E=E7=89=A9/=E8=99=9A=E6=8B=9F=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=8F=91=E8=B4=A7=E9=80=BB=E8=BE=91=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/goods/mapper/GoodsMapper.java | 10 ++++---- .../goods/serviceimpl/GoodsServiceImpl.java | 5 +++- .../modules/order/order/entity/dos/Order.java | 24 +++++++++---------- .../order/entity/enums/OrderTypeEnum.java | 11 +-------- .../order/order/entity/vo/AllowOperation.java | 7 +++--- 5 files changed, 26 insertions(+), 31 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/goods/mapper/GoodsMapper.java b/framework/src/main/java/cn/lili/modules/goods/mapper/GoodsMapper.java index 928248c7..cea5e6a8 100644 --- a/framework/src/main/java/cn/lili/modules/goods/mapper/GoodsMapper.java +++ b/framework/src/main/java/cn/lili/modules/goods/mapper/GoodsMapper.java @@ -10,6 +10,8 @@ import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; +import java.util.List; + /** * 规格项数据处理层 * @@ -19,12 +21,12 @@ import org.apache.ibatis.annotations.Update; public interface GoodsMapper extends BaseMapper { /** - * 下架所有商家商品 + * 根据店铺ID获取商品ID列表 * - * @param storeId + * @param storeId 店铺ID */ - @Update("update li_goods set market_enable = 0 WHERE store_id = #{storeId}") - void underStoreGoods(String storeId); + @Select("SELECT id FROM li_goods WHERE store_id = #{storeId}") + List getGoodsIdByStoreId(String storeId); @Update("UPDATE li_goods SET comment_num = comment_num + #{commentNum} WHERE id = #{goodsId}") void addGoodsCommentNum(Integer commentNum, String goodsId); diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java index a2560973..b9167c90 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java @@ -93,7 +93,10 @@ public class GoodsServiceImpl extends ServiceImpl implements @Override public void underStoreGoods(String storeId) { - this.baseMapper.underStoreGoods(storeId); + //获取商品ID列表 + List list= this.baseMapper.getGoodsIdByStoreId(storeId); + //下架店铺下的商品 + updateGoodsMarketAble(list,GoodsStatusEnum.DOWN,"店铺关闭"); } @Override diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java b/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java index 09903e68..daafdca9 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java @@ -219,27 +219,25 @@ public class Order extends BaseEntity { BeanUtil.copyProperties(tradeDTO, this); BeanUtil.copyProperties(cartVO.getPriceDetailDTO(), this); BeanUtil.copyProperties(cartVO, this); - //订单类型判断--普通订单,活动订单。 + //订单类型判断--普通订单,虚拟订单。 if (tradeDTO.getCartTypeEnum().equals(CartTypeEnum.CART) || tradeDTO.getCartTypeEnum().equals(CartTypeEnum.BUY_NOW)) { this.setOrderType(OrderTypeEnum.NORMAL.name()); } else if (tradeDTO.getCartTypeEnum().equals(CartTypeEnum.VIRTUAL)) { this.setOrderType(tradeDTO.getCartTypeEnum().name()); - } else { - this.setOrderType(OrderTypeEnum.NORMAL.name()); } this.setId(oldId); //促销信息填充 - if (cartVO.getSkuList().get(0).getPromotions() != null && tradeDTO.getCartTypeEnum().equals(CartTypeEnum.PINTUAN)) { - Optional pintuanId = cartVO.getSkuList().get(0).getPromotions().stream().filter(i -> i.getPromotionType().equals(PromotionTypeEnum.PINTUAN.name())).map(PromotionGoods::getPromotionId).findFirst(); - if (pintuanId.isPresent()) { - promotionId = pintuanId.get(); - this.setOrderType(OrderTypeEnum.PINTUAN.name()); - if (tradeDTO.getParentOrderSn() == null) { - this.setParentOrderSn(""); - } - } - } +// if (cartVO.getSkuList().get(0).getPromotions() != null && tradeDTO.getCartTypeEnum().equals(CartTypeEnum.PINTUAN)) { +// Optional pintuanId = cartVO.getSkuList().get(0).getPromotions().stream().filter(i -> i.getPromotionType().equals(PromotionTypeEnum.PINTUAN.name())).map(PromotionGoods::getPromotionId).findFirst(); +// if (pintuanId.isPresent()) { +// promotionId = pintuanId.get(); +// this.setOrderType(OrderTypeEnum.PINTUAN.name()); +// if (tradeDTO.getParentOrderSn() == null) { +// this.setParentOrderSn(""); +// } +// } +// } //设置默认支付状态 this.setOrderStatus(OrderStatusEnum.UNPAID.name()); diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/enums/OrderTypeEnum.java b/framework/src/main/java/cn/lili/modules/order/order/entity/enums/OrderTypeEnum.java index e670e523..8fba1a49 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/enums/OrderTypeEnum.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/enums/OrderTypeEnum.java @@ -13,17 +13,8 @@ public enum OrderTypeEnum { */ NORMAL, - /** - * 赠品订单 - */ - GIFT, - /** * 虚拟订单 */ - VIRTUAL, - /** - * 拼团订单 - */ - PINTUAN + VIRTUAL } diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AllowOperation.java b/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AllowOperation.java index 29a956e5..2e39d768 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AllowOperation.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/vo/AllowOperation.java @@ -69,9 +69,10 @@ public class AllowOperation implements Serializable { //新订单,允许支付 this.pay = status.equals(OrderStatusEnum.UNPAID.name()) && payStatus.equals(PayStatusEnum.UNPAID.name()); - //订单未发货,就可以编辑收货人信息(实物订单) - this.editConsignee = order.getOrderType().equals(OrderTypeEnum.VIRTUAL.name()) && - order.getDeliverStatus().equals(DeliverStatusEnum.UNDELIVERED.name()) && !status.equals(OrderStatusEnum.CANCELLED.name()); + //可编辑订单收件人信息=实物订单 && 订单未发货 && 订单未取消 + this.editConsignee = order.getOrderType().equals(OrderTypeEnum.NORMAL.name()) + && order.getDeliverStatus().equals(DeliverStatusEnum.UNDELIVERED.name()) + && !status.equals(OrderStatusEnum.CANCELLED.name()); //是否允许被发货 this.ship = editConsignee && status.equals(OrderStatusEnum.UNDELIVERED.name()); From 800437473d6a99b11cadb3ae75ef6cb6d597f48e Mon Sep 17 00:00:00 2001 From: lifenlong Date: Wed, 30 Jun 2021 12:02:35 +0800 Subject: [PATCH 13/23] =?UTF-8?q?1.=E5=88=86=E9=94=80=E5=91=98=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=BB=93=E7=AE=97=E9=93=B6=E8=A1=8C=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=202.=E7=94=B5=E8=AF=9D=E6=A0=A1=E9=AA=8C=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DistributionBuyerController.java | 9 ++--- .../validation/impl/MobileValidator.java | 24 ++++++----- .../distribution/entity/dos/Distribution.java | 24 +++++++++-- .../entity/dto/DistributionApplyDTO.java | 40 +++++++++++++++++++ .../service/DistributionService.java | 3 +- .../serviceimpl/DistributionServiceImpl.java | 9 +++-- update-sql/version4.1to4.2.sql | 4 ++ 7 files changed, 89 insertions(+), 24 deletions(-) create mode 100644 framework/src/main/java/cn/lili/modules/distribution/entity/dto/DistributionApplyDTO.java create mode 100644 update-sql/version4.1to4.2.sql diff --git a/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionBuyerController.java b/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionBuyerController.java index fd9bbe3a..b8c97954 100644 --- a/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionBuyerController.java +++ b/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionBuyerController.java @@ -5,6 +5,7 @@ import cn.lili.common.security.context.UserContext; import cn.lili.common.vo.ResultMessage; import cn.lili.modules.distribution.entity.dos.Distribution; import cn.lili.modules.distribution.entity.dos.DistributionOrder; +import cn.lili.modules.distribution.entity.dto.DistributionApplyDTO; import cn.lili.modules.distribution.entity.vos.DistributionOrderSearchParams; import cn.lili.modules.distribution.service.DistributionOrderService; import cn.lili.modules.distribution.service.DistributionService; @@ -41,13 +42,9 @@ public class DistributionBuyerController { //申请分销员 @ApiOperation(value = "申请分销员") - @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "姓名", required = true, paramType = "query", dataType = "String"), - @ApiImplicitParam(name = "idNumber", value = "身份证号", required = true, paramType = "query", dataType = "String") - }) @PostMapping - public ResultMessage applyDistribution(@RequestParam String name, @RequestParam String idNumber) { - return ResultUtil.data(distributionService.applyDistribution(name, idNumber)); + public ResultMessage applyDistribution(DistributionApplyDTO distributionApplyDTO) { + return ResultUtil.data(distributionService.applyDistribution(distributionApplyDTO)); } @ApiOperation(value = "获取分销员分页订单列表") diff --git a/framework/src/main/java/cn/lili/common/validation/impl/MobileValidator.java b/framework/src/main/java/cn/lili/common/validation/impl/MobileValidator.java index 2b21b32c..bdcc2d70 100644 --- a/framework/src/main/java/cn/lili/common/validation/impl/MobileValidator.java +++ b/framework/src/main/java/cn/lili/common/validation/impl/MobileValidator.java @@ -8,26 +8,30 @@ import javax.validation.ConstraintValidatorContext; import java.util.regex.Matcher; import java.util.regex.Pattern; - +/** + * 电话校验 + * 支持手机号+电话同时校验 + */ public class MobileValidator implements ConstraintValidator { @Override public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) { - Pattern p1 = null,p2 = null; + Pattern p1 = null, p2 = null, p3 = null; Matcher m = null; - boolean b = false; - p1 = Pattern.compile("^[0][1-9]{2,3}-[0-9]{5,10}$"); // 验证带区号的 + p1 = Pattern.compile("0\\d{2,3}[-]?\\d{7,8}|0\\d{2,3}\\s?\\d{7,8}|13[0-9]\\d{8}|15[1089]\\d{8}"); // 验证带区号的 p2 = Pattern.compile("^[1-9]{1}[0-9]{5,8}$"); // 验证没有区号的 - if(value.length() >9) - { m = p1.matcher(value); - b = m.matches(); - }else{ + p3 = Pattern.compile("^0?(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])[0-9]{8}$");// 验证手机号 + if (value.length() == 11) { + m = p3.matcher(value); + } else if (value.length() > 9) { + m = p1.matcher(value); + } else { m = p2.matcher(value); - b = m.matches(); } - return b; + return m.matches(); } + @Override public void initialize(Mobile constraintAnnotation) { diff --git a/framework/src/main/java/cn/lili/modules/distribution/entity/dos/Distribution.java b/framework/src/main/java/cn/lili/modules/distribution/entity/dos/Distribution.java index ce31ee33..7615e194 100644 --- a/framework/src/main/java/cn/lili/modules/distribution/entity/dos/Distribution.java +++ b/framework/src/main/java/cn/lili/modules/distribution/entity/dos/Distribution.java @@ -1,6 +1,8 @@ package cn.lili.modules.distribution.entity.dos; import cn.lili.base.BaseEntity; +import cn.lili.common.utils.BeanUtil; +import cn.lili.modules.distribution.entity.dto.DistributionApplyDTO; import cn.lili.modules.distribution.entity.enums.DistributionStatusEnum; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; @@ -10,6 +12,8 @@ import lombok.NoArgsConstructor; import javax.persistence.Entity; import javax.persistence.Table; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; /** * 分销员对象 @@ -28,13 +32,12 @@ public class Distribution extends BaseEntity { private static final long serialVersionUID = -4878132663540847325L; - public Distribution(String memberId, String memberName, String name, String idNumber) { + public Distribution(String memberId, String memberName, DistributionApplyDTO distributionApplyDTO) { this.memberId = memberId; this.memberName = memberName; - this.name = name; - this.idNumber = idNumber; distributionOrderCount=0; this.distributionStatus = DistributionStatusEnum.APPLY.name(); + BeanUtil.copyProperties(distributionApplyDTO, this); } @ApiModelProperty(value = "会员id") @@ -67,4 +70,19 @@ public class Distribution extends BaseEntity { @ApiModelProperty(value = "分销员状态", required = true) private String distributionStatus; + @Size(min = 1, max = 200, message = "结算银行开户行名称长度为1-200位") + @NotBlank(message = "结算银行开户行名称不能为空") + @ApiModelProperty(value = "结算银行开户行名称") + private String settlementBankAccountName; + + @Size(min = 1, max = 200, message = "结算银行开户账号长度为1-200位") + @NotBlank(message = "结算银行开户账号不能为空") + @ApiModelProperty(value = "结算银行开户账号") + private String settlementBankAccountNum; + + @Size(min = 1, max = 200, message = "结算银行开户支行名称长度为1-200位") + @NotBlank(message = "结算银行开户支行名称不能为空") + @ApiModelProperty(value = "结算银行开户支行名称") + private String settlementBankBranchName; + } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/distribution/entity/dto/DistributionApplyDTO.java b/framework/src/main/java/cn/lili/modules/distribution/entity/dto/DistributionApplyDTO.java new file mode 100644 index 00000000..b98026de --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/distribution/entity/dto/DistributionApplyDTO.java @@ -0,0 +1,40 @@ +package cn.lili.modules.distribution.entity.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; + +/** + * 分销员申请DTO + * @author Bulbasaur + * @date: 2021/6/30 11:07 上午 + * + */ +@Data +public class DistributionApplyDTO { + + @NotBlank(message = "姓名不能为空") + @ApiModelProperty(value = "会员姓名") + private String name; + + @NotBlank(message = "身份证号不能为空") + @ApiModelProperty(value = "身份证号") + private String idNumber; + + @Size(min = 1, max = 200, message = "结算银行开户行名称长度为1-200位") + @NotBlank(message = "结算银行开户行名称不能为空") + @ApiModelProperty(value = "结算银行开户行名称") + private String settlementBankAccountName; + + @Size(min = 1, max = 200, message = "结算银行开户账号长度为1-200位") + @NotBlank(message = "结算银行开户账号不能为空") + @ApiModelProperty(value = "结算银行开户账号") + private String settlementBankAccountNum; + + @Size(min = 1, max = 200, message = "结算银行开户支行名称长度为1-200位") + @NotBlank(message = "结算银行开户支行名称不能为空") + @ApiModelProperty(value = "结算银行开户支行名称") + private String settlementBankBranchName; +} diff --git a/framework/src/main/java/cn/lili/modules/distribution/service/DistributionService.java b/framework/src/main/java/cn/lili/modules/distribution/service/DistributionService.java index 536617ae..cbb91aa9 100644 --- a/framework/src/main/java/cn/lili/modules/distribution/service/DistributionService.java +++ b/framework/src/main/java/cn/lili/modules/distribution/service/DistributionService.java @@ -2,6 +2,7 @@ package cn.lili.modules.distribution.service; import cn.lili.common.vo.PageVO; import cn.lili.modules.distribution.entity.dos.Distribution; +import cn.lili.modules.distribution.entity.dto.DistributionApplyDTO; import cn.lili.modules.distribution.entity.dto.DistributionSearchParams; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; @@ -36,7 +37,7 @@ public interface DistributionService extends IService { * * @return */ - Distribution applyDistribution(String name, String idNumber); + Distribution applyDistribution(DistributionApplyDTO distributionApplyDTO); /** * 审核分销申请 diff --git a/framework/src/main/java/cn/lili/modules/distribution/serviceimpl/DistributionServiceImpl.java b/framework/src/main/java/cn/lili/modules/distribution/serviceimpl/DistributionServiceImpl.java index 70d60870..f3c329ee 100644 --- a/framework/src/main/java/cn/lili/modules/distribution/serviceimpl/DistributionServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/distribution/serviceimpl/DistributionServiceImpl.java @@ -6,9 +6,11 @@ import cn.lili.common.cache.CachePrefix; import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.common.security.context.UserContext; +import cn.lili.common.utils.BeanUtil; import cn.lili.common.utils.PageUtil; import cn.lili.common.vo.PageVO; import cn.lili.modules.distribution.entity.dos.Distribution; +import cn.lili.modules.distribution.entity.dto.DistributionApplyDTO; import cn.lili.modules.distribution.entity.dto.DistributionSearchParams; import cn.lili.modules.distribution.entity.enums.DistributionStatusEnum; import cn.lili.modules.distribution.mapper.DistributionMapper; @@ -64,7 +66,7 @@ public class DistributionServiceImpl extends ServiceImpl Date: Wed, 30 Jun 2021 14:53:26 +0800 Subject: [PATCH 14/23] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/pom.xml | 2 +- buyer-api/pom.xml | 2 +- common-api/pom.xml | 2 +- config/application.yml | 8 ++++---- consumer/pom.xml | 2 +- framework/pom.xml | 2 +- manager-api/pom.xml | 2 +- pom.xml | 4 ++-- seller-api/pom.xml | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/admin/pom.xml b/admin/pom.xml index e188f455..e2b538db 100644 --- a/admin/pom.xml +++ b/admin/pom.xml @@ -6,7 +6,7 @@ cn.lili lili-shop-parent - 1.0.1 + 4.2.0 admin diff --git a/buyer-api/pom.xml b/buyer-api/pom.xml index 7499e497..59b2d693 100644 --- a/buyer-api/pom.xml +++ b/buyer-api/pom.xml @@ -10,7 +10,7 @@ cn.lili lili-shop-parent - 1.0.1 + 4.2.0 diff --git a/common-api/pom.xml b/common-api/pom.xml index 4e5c7d8d..510c6865 100644 --- a/common-api/pom.xml +++ b/common-api/pom.xml @@ -7,7 +7,7 @@ cn.lili lili-shop-parent - 1.0.1 + 4.2.0 cn.lili diff --git a/config/application.yml b/config/application.yml index 5a9316c8..0e645d6b 100644 --- a/config/application.yml +++ b/config/application.yml @@ -77,7 +77,7 @@ spring: default-datasource: type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://192.168.0.116:3306/Bulbasaur?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai + url: jdbc:mysql://192.168.0.116:3306/lilishop?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai username: root password: lilishop maxActive: 20 @@ -194,9 +194,9 @@ logging: # 输出级别 level: cn.lili: info - # org.hibernate: debug - # org.springframework: debug - # org.springframework.data.mongodb.core: debug + org.hibernate: debug + org.springframework: debug + org.springframework.data.mongodb.core: debug file: # 指定路径 path: lili-logs diff --git a/consumer/pom.xml b/consumer/pom.xml index dd25a81b..da93e1f6 100644 --- a/consumer/pom.xml +++ b/consumer/pom.xml @@ -8,7 +8,7 @@ cn.lili lili-shop-parent - 1.0.1 + 4.2.0 diff --git a/framework/pom.xml b/framework/pom.xml index 4873ab05..ba3991db 100644 --- a/framework/pom.xml +++ b/framework/pom.xml @@ -7,7 +7,7 @@ cn.lili lili-shop-parent - 1.0.1 + 4.2.0 framework diff --git a/manager-api/pom.xml b/manager-api/pom.xml index bf583500..6aefa5f4 100644 --- a/manager-api/pom.xml +++ b/manager-api/pom.xml @@ -8,7 +8,7 @@ cn.lili lili-shop-parent - 1.0.1 + 4.2.0 diff --git a/pom.xml b/pom.xml index 44ab8a88..c40ec9a4 100644 --- a/pom.xml +++ b/pom.xml @@ -12,11 +12,11 @@ cn.lili lili-shop-parent - 1.0.1 + 4.2.0 registry.cn-beijing.aliyuncs.com/lili-images - 0.0.5 + 0.0.1 framework diff --git a/seller-api/pom.xml b/seller-api/pom.xml index 934079d4..946b6eb2 100644 --- a/seller-api/pom.xml +++ b/seller-api/pom.xml @@ -8,7 +8,7 @@ cn.lili lili-shop-parent - 1.0.1 + 4.2.0 From 346465630ccb49a8be798e2df3782784cc85b417 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Wed, 30 Jun 2021 15:45:33 +0800 Subject: [PATCH 15/23] =?UTF-8?q?=E6=B7=BB=E5=8A=A0ResultCode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../passport/MemberBuyerController.java | 2 +- .../impl/order/OrderEveryDayTaskExecute.java | 3 +- .../java/cn/lili/common/enums/ResultCode.java | 52 ++++++++++++++++++- .../sms/impl/SmsUtilAliImplService.java | 5 +- .../base/generate/StoreTokenGenerate.java | 4 +- .../serviceimpl/ConnectServiceImpl.java | 4 +- .../goods/serviceimpl/BrandServiceImpl.java | 9 ++-- .../serviceimpl/GoodsSkuServiceImpl.java | 4 +- .../message/util/WechatAccessTokenUtil.java | 3 +- .../order/serviceimpl/OrderServiceImpl.java | 6 +-- .../modules/payment/kit/CashierSupport.java | 2 +- .../kit/plugin/alipay/AliPayPlugin.java | 2 +- .../kit/plugin/wechat/WechatPlugin.java | 2 +- .../CouponActivityServiceImpl.java | 3 +- .../serviceimpl/FullDiscountServiceImpl.java | 3 +- .../serviceimpl/MemberCouponServiceImpl.java | 6 +-- .../serviceimpl/SeckillApplyServiceImpl.java | 3 +- .../serviceimpl/LogisticsServiceImpl.java | 3 +- 18 files changed, 87 insertions(+), 29 deletions(-) diff --git a/buyer-api/src/main/java/cn/lili/controller/passport/MemberBuyerController.java b/buyer-api/src/main/java/cn/lili/controller/passport/MemberBuyerController.java index a9981b3d..aeae60d6 100644 --- a/buyer-api/src/main/java/cn/lili/controller/passport/MemberBuyerController.java +++ b/buyer-api/src/main/java/cn/lili/controller/passport/MemberBuyerController.java @@ -66,7 +66,7 @@ public class MemberBuyerController { if (smsUtil.verifyCode(mobile, VerificationEnums.LOGIN, uuid, code)) { return ResultUtil.data(memberService.mobilePhoneLogin(mobile)); } else { - throw new ServiceException("验证码错误"); + throw new ServiceException(ResultCode.VERIFICATION_SMS_ERROR); } } diff --git a/consumer/src/main/java/cn/lili/timetask/handler/impl/order/OrderEveryDayTaskExecute.java b/consumer/src/main/java/cn/lili/timetask/handler/impl/order/OrderEveryDayTaskExecute.java index 223489e3..84c0cabc 100644 --- a/consumer/src/main/java/cn/lili/timetask/handler/impl/order/OrderEveryDayTaskExecute.java +++ b/consumer/src/main/java/cn/lili/timetask/handler/impl/order/OrderEveryDayTaskExecute.java @@ -3,6 +3,7 @@ package cn.lili.timetask.handler.impl.order; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; import cn.hutool.json.JSONUtil; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.modules.member.entity.dto.MemberEvaluationDTO; import cn.lili.modules.member.entity.enums.EvaluationGradeEnum; @@ -58,7 +59,7 @@ public class OrderEveryDayTaskExecute implements EveryDayExecute { //自动确认收货 OrderSetting orderSetting = JSONUtil.toBean(setting.getSettingValue(), OrderSetting.class); if (orderSetting == null) { - throw new ServiceException("系统配置异常"); + throw new ServiceException(ResultCode.ORDER_SETTING_ERROR); } //自动确认收货 diff --git a/framework/src/main/java/cn/lili/common/enums/ResultCode.java b/framework/src/main/java/cn/lili/common/enums/ResultCode.java index 26490d88..d0dec479 100644 --- a/framework/src/main/java/cn/lili/common/enums/ResultCode.java +++ b/framework/src/main/java/cn/lili/common/enums/ResultCode.java @@ -64,6 +64,7 @@ public enum ResultCode { GOODS_SKU_WEIGHT_ERROR(11010, "商品重量不能为负数"), GOODS_SKU_QUANTITY_ERROR(11011, "商品库存数量不能为负数"), GOODS_SKU_QUANTITY_NOT_ENOUGH(11011, "商品库存不足"), + MUST_HAVE_GOODS_SKU(11012,"规格必须要有一个!"), /** * 参数 @@ -92,6 +93,12 @@ public enum ResultCode { BRAND_DELETE_ERROR(14004, "品牌删除失败"), + BRAND_NAME_EXIST_ERROR(20002, "品牌名称重复!"), + + BRAND_USE_DISABLE_ERROR(20003, "当前品牌下存在分类不可禁用"), + + BRAND_NOT_EXIST(20004, "品牌不存在"), + /** * 用户 */ @@ -131,7 +138,9 @@ public enum ResultCode { USER_GRADE_IS_DEFAULT(20018, "会员等级为默认会员等级"), - DELETE_EXIST(2001, "无法重复收藏"), + DELETE_EXIST(20019, "无法重复收藏"), + + NOT_BINDING_USER(20020,"未绑定用户"), /** * 权限 @@ -201,6 +210,9 @@ public enum ResultCode { ORDER_CAN_NOT_CANCEL(31012, "当前订单状态不可取消"), + BATCH_DELIVER_ERROR(31013, "批量发货,文件读取失败"), + + /** * 支付 */ @@ -230,6 +242,7 @@ public enum ResultCode { CAN_NOT_RECHARGE_WALLET(32012, "不能使用余额进行充值"), + /** * 售后 */ @@ -290,6 +303,12 @@ public enum ResultCode { COUPON_EDIT_STATUS_ERROR(41004, "优惠券修改状态失败!"), + COUPON_RECEIVE_ERROR(41005, "当前优惠券状态不可领取"), + + COUPON_NUM_INSUFFICIENT_ERROR(41006, "优惠券剩余领取数量不足"), + + COUPON_NOT_EXIST(41007, "当前优惠券不存在"), + /** * 拼团 */ @@ -313,6 +332,10 @@ public enum ResultCode { PINTUAN_DELETE_ERROR(42010, "删除拼团活动失败"), + PINTUAN_JOIN_ERROR(42011, "不能参与自己发起的拼团活动!"), + + PINTUAN_LIMIT_NUM_ERROR(42012, "购买数量超过拼团活动限制数量!"), + /** * 满额活动 */ @@ -320,20 +343,35 @@ public enum ResultCode { FULL_DISCOUNT_EDIT_DELETE(43002, "删除满优惠活动成功"), + FULL_DISCOUNT_MODIFY_ERROR(43003,"当前编辑的满优惠活动已经开始或者已经结束,无法修改"), + /** * 直播 */ STODIO_GOODS_EXIST_ERROR(44001,"直播商品已存在"), + /** + * 秒杀 + */ + SECKILL_NOT_EXIST(45001,"当前参与的秒杀活动不存在!"), + + /** + * 优惠券活动 + */ + COUPON_ACTIVITY_START_TIME_ERROR(46001,"活动时间小于当前时间,不能进行编辑删除操作"), + /** * 店铺 */ + STORE_NOT_EXIST(50001, "此店铺不存在"), STORE_NAME_EXIST_ERROR(50002, "店铺名称已存在!"), STORE_APPLY_DOUBLE_ERROR(50003, "已有店铺,无需重复申请!"), + STORE_NOT_OPEN(50004, "该会员未开通店铺"), + /** * 结算单 */ @@ -380,6 +418,7 @@ public enum ResultCode { */ SMS_SIGN_EXIST_ERROR(80001, "短信签名已存在"), + /** * 站内信 */ @@ -414,6 +453,13 @@ public enum ResultCode { ALIPAY_PARAMS_EXCEPTION(80403, "支付宝参数异常"), + LOGISTICS_NOT_SETTING(80404,"您还未配置快递查询"), + + ORDER_SETTING_ERROR(80405,"系统订单配置异常"), + + ALI_SMS_SETTING_ERROR(80406,"您还未配置阿里云短信"), + + /** * 微信相关异常 */ @@ -425,6 +471,10 @@ public enum ResultCode { WECHAT_MP_MESSAGE_ERROR(80503, "微信小程序小消息订阅异常"), + WECHAT_JSAPI_SIGN_ERROR(80504,"微信JsApi签名异常"), + + WECHAT_CERT_ERROR(80505,"证书获取失败"), + APP_VERSION_EXIST(80600, "APP版本已存在"); private final Integer code; diff --git a/framework/src/main/java/cn/lili/common/sms/impl/SmsUtilAliImplService.java b/framework/src/main/java/cn/lili/common/sms/impl/SmsUtilAliImplService.java index 70bef42a..2b9bf7d1 100644 --- a/framework/src/main/java/cn/lili/common/sms/impl/SmsUtilAliImplService.java +++ b/framework/src/main/java/cn/lili/common/sms/impl/SmsUtilAliImplService.java @@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import cn.lili.common.cache.Cache; import cn.lili.common.cache.CachePrefix; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.common.security.context.UserContext; import cn.lili.common.sms.AliSmsUtil; @@ -64,7 +65,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil { //获取短信配置 Setting setting = settingService.get(SettingEnum.SMS_SETTING.name()); if (StrUtil.isBlank(setting.getSettingValue())) { - throw new ServiceException("您还未配置阿里云短信"); + throw new ServiceException(ResultCode.ALI_SMS_SETTING_ERROR); } SmsSetting smsSetting = new Gson().fromJson(setting.getSettingValue(), SmsSetting.class); @@ -351,7 +352,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil { try { Setting setting = settingService.get(SettingEnum.SMS_SETTING.name()); if (StrUtil.isBlank(setting.getSettingValue())) { - throw new ServiceException("您还未配置阿里云短信"); + throw new ServiceException(ResultCode.ALI_SMS_SETTING_ERROR); } SmsSetting smsSetting = new Gson().fromJson(setting.getSettingValue(), SmsSetting.class); diff --git a/framework/src/main/java/cn/lili/common/token/base/generate/StoreTokenGenerate.java b/framework/src/main/java/cn/lili/common/token/base/generate/StoreTokenGenerate.java index cf1a45f6..28b94c86 100644 --- a/framework/src/main/java/cn/lili/common/token/base/generate/StoreTokenGenerate.java +++ b/framework/src/main/java/cn/lili/common/token/base/generate/StoreTokenGenerate.java @@ -1,5 +1,6 @@ package cn.lili.common.token.base.generate; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.common.security.AuthUser; import cn.lili.common.security.enums.UserEnums; @@ -19,7 +20,6 @@ import org.springframework.stereotype.Component; * * @author Chopper * @version v4.0 - * @Description: * @since 2020/11/16 10:51 */ @Component @@ -36,7 +36,7 @@ public class StoreTokenGenerate extends AbstractTokenGenerate { //生成token Member member = memberService.findByUsername(username); if (!member.getHaveStore()) { - throw new ServiceException("该会员未开通店铺"); + throw new ServiceException(ResultCode.STORE_NOT_OPEN); } AuthUser user = new AuthUser(member.getUsername(), member.getId(), member.getNickName(), UserEnums.STORE); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); diff --git a/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java b/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java index e56dae7a..4976dafe 100644 --- a/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java @@ -108,11 +108,11 @@ public class ConnectServiceImpl extends ServiceImpl impl CookieUtil.addCookie(CONNECT_TYPE, type, 1800, ThreadContextHolder.getHttpResponse()); //自动登录失败,则把信息缓存起来 cache.put(ConnectService.cacheKey(type, uuid), authUser, 30L, TimeUnit.MINUTES); - throw new ServiceException("未绑定用户"); + throw new ServiceException(ResultCode.NOT_BINDING_USER); } } catch (Exception e) { log.error("联合登陆异常:", e); - throw new ServiceException("未知错误,请稍后重试"); + throw new ServiceException(ResultCode.ERROR); } return token; } diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/BrandServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/BrandServiceImpl.java index ebff552a..0a6f394a 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/BrandServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/BrandServiceImpl.java @@ -1,5 +1,6 @@ package cn.lili.modules.goods.serviceimpl; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.common.utils.PageUtil; import cn.lili.modules.goods.entity.dos.Brand; @@ -62,7 +63,7 @@ public class BrandServiceImpl extends ServiceImpl implements public boolean addBrand(BrandVO brandVO) { if (getOne(new LambdaQueryWrapper().eq(Brand::getName, brandVO.getName())) != null) { - throw new ServiceException("品牌名称重复!"); + throw new ServiceException(ResultCode.BRAND_NAME_EXIST_ERROR); } return this.save(brandVO); } @@ -71,7 +72,7 @@ public class BrandServiceImpl extends ServiceImpl implements public boolean updateBrand(BrandVO brandVO) { this.checkExist(brandVO.getId()); if (getOne(new LambdaQueryWrapper().eq(Brand::getName, brandVO.getName()).ne(Brand::getId, brandVO.getId())) != null) { - throw new ServiceException("品牌名称重复!"); + throw new ServiceException(ResultCode.BRAND_NAME_EXIST_ERROR); } return this.updateById(brandVO); } @@ -80,7 +81,7 @@ public class BrandServiceImpl extends ServiceImpl implements public boolean brandDisable(String brandId, boolean disable) { Brand brand = this.checkExist(brandId); if (Boolean.TRUE.equals(disable) && !categoryBrandService.getCategoryBrandListByBrandId(brandId).isEmpty()) { - throw new ServiceException("当前品牌下存在分类不可禁用"); + throw new ServiceException(ResultCode.BRAND_USE_DISABLE_ERROR); } brand.setDeleteFlag(disable); return updateById(brand); @@ -90,7 +91,7 @@ public class BrandServiceImpl extends ServiceImpl implements Brand brand = getById(brandId); if (brand == null) { log.error("品牌ID为" + brandId + "的品牌不存在"); - throw new ServiceException(); + throw new ServiceException(ResultCode.BRAND_NOT_EXIST); } return brand; } diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java index adfcb2c9..78ee307f 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java @@ -96,7 +96,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl i // 添加商品sku newSkuList = this.addGoodsSku(skuList, goods); } else { - throw new ServiceException("规格必须要有一个!"); + throw new ServiceException(ResultCode.MUST_HAVE_GOODS_SKU); } this.updateStock(newSkuList); @@ -107,7 +107,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl i public void update(List> skuList, Goods goods, Boolean regeneratorSkuFlag) { // 是否存在规格 if (skuList == null || skuList.isEmpty()) { - throw new ServiceException("规格必须要有一个!"); + throw new ServiceException(ResultCode.MUST_HAVE_GOODS_SKU); } List newSkuList; //删除旧的sku信息 diff --git a/framework/src/main/java/cn/lili/modules/message/util/WechatAccessTokenUtil.java b/framework/src/main/java/cn/lili/modules/message/util/WechatAccessTokenUtil.java index 0ec1b8e5..36fa901d 100644 --- a/framework/src/main/java/cn/lili/modules/message/util/WechatAccessTokenUtil.java +++ b/framework/src/main/java/cn/lili/modules/message/util/WechatAccessTokenUtil.java @@ -4,6 +4,7 @@ import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONObject; import cn.lili.common.cache.Cache; import cn.lili.common.cache.CachePrefix; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.modules.base.entity.enums.ClientTypeEnum; import cn.lili.modules.connect.util.HttpUtils; @@ -105,7 +106,7 @@ public class WechatAccessTokenUtil { return ticket; } catch (Exception e) { log.error("微信JsApi签名异常", e); - throw new ServiceException("微信JsApi签名异常"); + throw new ServiceException(ResultCode.WECHAT_JSAPI_SIGN_ERROR); } } diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java index f423e6ea..729f3e8f 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java @@ -544,7 +544,7 @@ public class OrderServiceImpl extends ServiceImpl implements orderBatchDeliverDTOList.add(orderBatchDeliverDTO); } } catch (Exception e) { - throw new ServiceException("文件读取失败"); + throw new ServiceException(ResultCode.BATCH_DELIVER_ERROR); } //循环检查是否符合规范 checkBatchDeliver(orderBatchDeliverDTOList); @@ -778,7 +778,7 @@ public class OrderServiceImpl extends ServiceImpl implements //判断用户不能参与自己发起的拼团活动 Order parentOrder = this.getBySn(tradeDTO.getParentOrderSn()); if (parentOrder.getMemberId().equals(UserContext.getCurrentUser().getId())) { - throw new ServiceException("不能参与自己发起的拼团活动!"); + throw new ServiceException(ResultCode.PINTUAN_JOIN_ERROR); } } } @@ -794,7 +794,7 @@ public class OrderServiceImpl extends ServiceImpl implements Pintuan pintuan = pintuanService.getPintuanById(order.getPromotionId()); Integer limitNum = pintuan.getLimitNum(); if (limitNum != 0 && order.getGoodsNum() > limitNum) { - throw new ServiceException("购买数量超过拼团活动限制数量"); + throw new ServiceException(ResultCode.PINTUAN_LIMIT_NUM_ERROR); } } } diff --git a/framework/src/main/java/cn/lili/modules/payment/kit/CashierSupport.java b/framework/src/main/java/cn/lili/modules/payment/kit/CashierSupport.java index 062ff3ed..0bb79bb7 100644 --- a/framework/src/main/java/cn/lili/modules/payment/kit/CashierSupport.java +++ b/framework/src/main/java/cn/lili/modules/payment/kit/CashierSupport.java @@ -57,7 +57,7 @@ public class CashierSupport { HttpServletRequest request, HttpServletResponse response, PayParam payParam) { if (paymentClientEnum == null || paymentMethodEnum == null) { - throw new ServiceException("未知的支付方式"); + throw new ServiceException(ResultCode.PAY_NOT_SUPPORT); } //获取支付插件 Payment payment = (Payment) SpringContextUtil.getBean(paymentMethodEnum.getPlugin()); diff --git a/framework/src/main/java/cn/lili/modules/payment/kit/plugin/alipay/AliPayPlugin.java b/framework/src/main/java/cn/lili/modules/payment/kit/plugin/alipay/AliPayPlugin.java index 75df6f37..b40406b8 100644 --- a/framework/src/main/java/cn/lili/modules/payment/kit/plugin/alipay/AliPayPlugin.java +++ b/framework/src/main/java/cn/lili/modules/payment/kit/plugin/alipay/AliPayPlugin.java @@ -95,7 +95,7 @@ public class AliPayPlugin implements Payment { @Override public ResultMessage JSApiPay(HttpServletRequest request, PayParam payParam) { - throw new ServiceException("当前支付通道暂不支持"); + throw new ServiceException(ResultCode.PAY_NOT_SUPPORT); } @Override diff --git a/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/WechatPlugin.java b/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/WechatPlugin.java index 5dc658ec..efad42a2 100644 --- a/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/WechatPlugin.java +++ b/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/WechatPlugin.java @@ -620,7 +620,7 @@ public class WechatPlugin implements Payment { cache.put(CachePrefix.WECHAT_PLAT_FORM_CERT.getPrefix(), publicCert, second); } else { log.error("证书获取失败:{}" + body); - throw new ServiceException("证书获取失败:" + body); + throw new ServiceException(ResultCode.WECHAT_CERT_ERROR); } return PayKit.getCertificate(publicCert); } catch (Exception e) { diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponActivityServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponActivityServiceImpl.java index 9fbd6e88..3f14f82c 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponActivityServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponActivityServiceImpl.java @@ -1,6 +1,7 @@ package cn.lili.modules.promotion.serviceimpl; import cn.hutool.json.JSONUtil; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.common.trigger.enums.DelayTypeEnums; import cn.lili.common.trigger.interfaces.TimeTrigger; @@ -208,7 +209,7 @@ public class CouponActivityServiceImpl extends ServiceImpl nowTime) { - throw new ServiceException("活动时间小于当前时间,不能进行编辑删除操作"); + throw new ServiceException(ResultCode.COUPON_ACTIVITY_START_TIME_ERROR); } //活动时间需超过当前时间 PromotionTools.checkPromotionTime(couponActivity.getStartTime().getTime(), couponActivity.getEndTime().getTime()); diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/FullDiscountServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/FullDiscountServiceImpl.java index ff22d6f9..f60682df 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/FullDiscountServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/FullDiscountServiceImpl.java @@ -1,5 +1,6 @@ package cn.lili.modules.promotion.serviceimpl; +import cn.lili.common.enums.ResultCode; import cn.lili.common.trigger.util.DelayQueueTools; import cn.lili.common.trigger.enums.DelayTypeEnums; import cn.lili.common.trigger.message.PromotionMessage; @@ -135,7 +136,7 @@ public class FullDiscountServiceImpl extends ServiceImpl= coupon.getPublishNum()) { - throw new ServiceException("优惠券剩余领取数量不足"); + throw new ServiceException(ResultCode.COUPON_NUM_INSUFFICIENT_ERROR); } if (haveCoupons >= coupon.getCouponLimitNum()) { throw new ServiceException("此优惠券最多领取" + coupon.getCouponLimitNum() + "张"); @@ -76,7 +76,7 @@ public class MemberCouponServiceImpl extends ServiceImpl seckillApplyList) { SeckillVO seckill = mongoTemplate.findById(seckillId, SeckillVO.class); if (seckill == null) { - throw new ServiceException("当前参与的秒杀活动不存在!"); + throw new ServiceException(ResultCode.SECKILL_NOT_EXIST); } //检查秒杀活动申请是否合法 checkSeckillApplyList(seckill.getHours(), seckillApplyList, storeId); diff --git a/framework/src/main/java/cn/lili/modules/system/serviceimpl/LogisticsServiceImpl.java b/framework/src/main/java/cn/lili/modules/system/serviceimpl/LogisticsServiceImpl.java index 62af53e7..7c33e996 100644 --- a/framework/src/main/java/cn/lili/modules/system/serviceimpl/LogisticsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/system/serviceimpl/LogisticsServiceImpl.java @@ -1,6 +1,7 @@ package cn.lili.modules.system.serviceimpl; import cn.hutool.core.util.StrUtil; +import cn.lili.common.enums.ResultCode; import cn.lili.common.enums.SwitchEnum; import cn.lili.common.exception.ServiceException; import cn.lili.modules.system.entity.dos.Logistics; @@ -72,7 +73,7 @@ public class LogisticsServiceImpl extends ServiceImpl Date: Wed, 30 Jun 2021 15:46:52 +0800 Subject: [PATCH 16/23] =?UTF-8?q?=E5=95=86=E5=93=81=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/lili/modules/goods/entity/dos/Goods.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java index e4f8eefa..efa1b8af 100644 --- a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java +++ b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java @@ -234,15 +234,15 @@ public class Goods extends BaseEntity { 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) { + if (StringUtil.isEmpty(sku.get("price").toString()) || Double.parseDouble( 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) { + if (StringUtil.isEmpty(sku.get("cost").toString()) || Double.parseDouble( 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) { + if (StringUtil.isEmpty(sku.get("weight").toString()) || Double.parseDouble(sku.get("weight").toString()) < 0) { throw new ServiceException(ResultCode.GOODS_SKU_WEIGHT_ERROR); } } From d7ce709ce6120ed877910843453e84b80f8d58d6 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Wed, 30 Jun 2021 16:29:19 +0800 Subject: [PATCH 17/23] =?UTF-8?q?=E4=BD=BF=E7=94=A8hutool=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E6=A0=BC=E5=BC=8F=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/lili/modules/goods/entity/dos/Goods.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java index efa1b8af..142c2298 100644 --- a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java +++ b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java @@ -1,5 +1,6 @@ package cn.lili.modules.goods.entity.dos; +import cn.hutool.core.convert.Convert; import cn.hutool.json.JSONUtil; import cn.lili.base.BaseEntity; import cn.lili.common.enums.ResultCode; @@ -234,19 +235,19 @@ public class Goods extends BaseEntity { if (sku.get("sn") == null) { throw new ServiceException(ResultCode.GOODS_SKU_SN_ERROR); } - if (StringUtil.isEmpty(sku.get("price").toString()) || Double.parseDouble( sku.get("price").toString()) <= 0) { + if (StringUtil.isEmpty(sku.get("price").toString()) || Convert.toDouble(sku.get("price")) <= 0) { throw new ServiceException(ResultCode.GOODS_SKU_PRICE_ERROR); } - if (StringUtil.isEmpty(sku.get("cost").toString()) || Double.parseDouble( sku.get("cost").toString()) <= 0) { + if (StringUtil.isEmpty(sku.get("cost").toString()) || Convert.toDouble(sku.get("cost")) <= 0) { throw new ServiceException(ResultCode.GOODS_SKU_COST_ERROR); } //虚拟商品没有重量字段 - if(sku.containsKey("weight")) { - if (StringUtil.isEmpty(sku.get("weight").toString()) || Double.parseDouble(sku.get("weight").toString()) < 0) { + if (sku.containsKey("weight")) { + if (StringUtil.isEmpty(sku.get("weight").toString()) || Convert.toDouble(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) { + if (StringUtil.isEmpty(sku.get("quantity").toString()) || Convert.toInt(sku.get("quantity").toString()) < 0) { throw new ServiceException(ResultCode.GOODS_SKU_QUANTITY_ERROR); } From 079437100d440ac3e2b0dd68704067c6c0dc4a90 Mon Sep 17 00:00:00 2001 From: Chopper Date: Wed, 30 Jun 2021 19:59:36 +0800 Subject: [PATCH 18/23] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=A5=BD=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buyer-api/pom.xml | 2 +- common-api/pom.xml | 2 +- consumer/pom.xml | 2 +- manager-api/pom.xml | 2 +- seller-api/pom.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/buyer-api/pom.xml b/buyer-api/pom.xml index 59b2d693..22afda90 100644 --- a/buyer-api/pom.xml +++ b/buyer-api/pom.xml @@ -17,7 +17,7 @@ cn.lili framework - 1.0.1 + 4.2.0 diff --git a/common-api/pom.xml b/common-api/pom.xml index 510c6865..fe5a4ae7 100644 --- a/common-api/pom.xml +++ b/common-api/pom.xml @@ -17,7 +17,7 @@ cn.lili framework - 1.0.1 + 4.2.0 diff --git a/consumer/pom.xml b/consumer/pom.xml index da93e1f6..b9b34c24 100644 --- a/consumer/pom.xml +++ b/consumer/pom.xml @@ -15,7 +15,7 @@ cn.lili framework - 1.0.1 + 4.2.0 diff --git a/manager-api/pom.xml b/manager-api/pom.xml index 6aefa5f4..f896a62f 100644 --- a/manager-api/pom.xml +++ b/manager-api/pom.xml @@ -15,7 +15,7 @@ cn.lili framework - 1.0.1 + 4.2.0 diff --git a/seller-api/pom.xml b/seller-api/pom.xml index 946b6eb2..9efa6d45 100644 --- a/seller-api/pom.xml +++ b/seller-api/pom.xml @@ -15,7 +15,7 @@ cn.lili framework - 1.0.1 + 4.2.0 From f6706d63949e8794ebdd4b82b17a67b14b6d0862 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Thu, 1 Jul 2021 08:33:19 +0800 Subject: [PATCH 19/23] =?UTF-8?q?1.=E4=BD=BF=E7=94=A8hutool=E8=BF=9B?= =?UTF-8?q?=E8=A1=8CObject=20to=20Int=E6=A0=BC=E5=BC=8F=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=202.=E6=B7=BB=E5=8A=A0=E9=83=A8=E5=88=86resultCode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lili/event/impl/StockUpdateExecute.java | 7 +- .../handler/impl/goods/GoodsExecute.java | 3 +- .../impl/view/PageViewStatisticsExecute.java | 9 +- .../common/aop/limiter/LimitInterceptor.java | 3 +- .../java/cn/lili/common/enums/ResultCode.java | 90 +++++++++++-------- .../cn/lili/common/utils/StringUtils.java | 3 +- .../service/impl/VerificationServiceImpl.java | 3 +- .../elasticsearch/ElasticsearchConfig.java | 3 +- .../CreateTimeShardingTableAlgorithm.java | 9 +- .../serviceimpl/CommodityServiceImpl.java | 4 +- .../serviceimpl/StudioServiceImpl.java | 3 +- .../connect/request/AuthAlipayRequest.java | 5 +- .../connect/request/AuthQQRequest.java | 3 +- .../modules/connect/util/ConnectUtil.java | 2 +- .../lili/modules/goods/entity/dos/Goods.java | 9 +- .../goods/serviceimpl/GoodsServiceImpl.java | 4 +- .../serviceimpl/GoodsSkuServiceImpl.java | 6 +- .../member/serviceimpl/MemberServiceImpl.java | 3 +- .../entity/vos/PointsGoodsSearchParams.java | 5 +- .../CouponActivityServiceImpl.java | 10 ++- .../PromotionGoodsServiceImpl.java | 5 +- .../serviceimpl/SeckillApplyServiceImpl.java | 13 +-- .../serviceimpl/CustomWordsServiceImpl.java | 7 +- .../IndexStatisticsServiceImpl.java | 3 +- 24 files changed, 127 insertions(+), 85 deletions(-) diff --git a/consumer/src/main/java/cn/lili/event/impl/StockUpdateExecute.java b/consumer/src/main/java/cn/lili/event/impl/StockUpdateExecute.java index 7c54b374..216b4331 100644 --- a/consumer/src/main/java/cn/lili/event/impl/StockUpdateExecute.java +++ b/consumer/src/main/java/cn/lili/event/impl/StockUpdateExecute.java @@ -1,5 +1,6 @@ package cn.lili.event.impl; +import cn.hutool.core.convert.Convert; import cn.lili.common.cache.Cache; import cn.lili.event.OrderStatusChangeEvent; import cn.lili.modules.goods.entity.dos.GoodsSku; @@ -188,7 +189,7 @@ public class StockUpdateExecute implements OrderStatusChangeEvent { List skuStocks = cache.multiGet(skuKeys); //循环写入商品库存 for (int i = 0; i < skuStocks.size(); i++) { - goodsSkus.get(i).setQuantity(Integer.parseInt(skuStocks.get(i).toString())); + goodsSkus.get(i).setQuantity(Convert.toInt(skuStocks.get(i).toString())); } //批量修改商品库存 goodsSkuService.updateBatchById(goodsSkus); @@ -197,7 +198,7 @@ public class StockUpdateExecute implements OrderStatusChangeEvent { if (!promotionKey.isEmpty()) { List promotionStocks = cache.multiGet(promotionKey); for (int i = 0; i < promotionKey.size(); i++) { - promotionGoods.get(i).setQuantity(Integer.parseInt(promotionStocks.get(i).toString())); + promotionGoods.get(i).setQuantity(Convert.toInt(promotionStocks.get(i).toString())); Integer num = promotionGoods.get(i).getNum(); promotionGoods.get(i).setNum((num != null ? num : 0) + order.getOrder().getGoodsNum()); } @@ -232,7 +233,7 @@ public class StockUpdateExecute implements OrderStatusChangeEvent { List skuStocks = cache.multiGet(skuKeys); //循环写入商品SKU库存 for (int i = 0; i < skuStocks.size(); i++) { - goodsSkus.get(i).setQuantity(Integer.parseInt(skuStocks.get(i).toString())); + goodsSkus.get(i).setQuantity(Convert.toInt(skuStocks.get(i).toString())); } log.info("订单取消,库存还原:{}", goodsSkus); //批量修改商品库存 diff --git a/consumer/src/main/java/cn/lili/timetask/handler/impl/goods/GoodsExecute.java b/consumer/src/main/java/cn/lili/timetask/handler/impl/goods/GoodsExecute.java index 3bcdbf1e..f9d92ea6 100644 --- a/consumer/src/main/java/cn/lili/timetask/handler/impl/goods/GoodsExecute.java +++ b/consumer/src/main/java/cn/lili/timetask/handler/impl/goods/GoodsExecute.java @@ -1,5 +1,6 @@ package cn.lili.timetask.handler.impl.goods; +import cn.hutool.core.convert.Convert; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; import cn.lili.modules.goods.mapper.GoodsMapper; @@ -40,7 +41,7 @@ public class GoodsExecute implements EveryDayExecute { .between("create_time", DateUtil.yesterday(), new DateTime())); for (Map map : list) { - goodsMapper.addGoodsCommentNum(Integer.parseInt(map.get("num").toString()), map.get("goods_id").toString()); + goodsMapper.addGoodsCommentNum(Convert.toInt(map.get("num").toString()), map.get("goods_id").toString()); } } diff --git a/consumer/src/main/java/cn/lili/timetask/handler/impl/view/PageViewStatisticsExecute.java b/consumer/src/main/java/cn/lili/timetask/handler/impl/view/PageViewStatisticsExecute.java index 22c0a9f4..2daf4256 100644 --- a/consumer/src/main/java/cn/lili/timetask/handler/impl/view/PageViewStatisticsExecute.java +++ b/consumer/src/main/java/cn/lili/timetask/handler/impl/view/PageViewStatisticsExecute.java @@ -1,5 +1,6 @@ package cn.lili.timetask.handler.impl.view; +import cn.hutool.core.convert.Convert; import cn.lili.common.cache.Cache; import cn.lili.common.cache.CachePrefix; import cn.lili.common.utils.BeanUtil; @@ -167,15 +168,15 @@ class PageViewStatistics { //将字符串解析成需要的对象 str = str.substring(str.indexOf("}") + 2); String[] dateStr = str.split("-"); - Integer year = Integer.parseInt(dateStr[0]); - Integer month = Integer.parseInt(dateStr[1]); + Integer year = Convert.toInt(dateStr[0]); + Integer month = Convert.toInt(dateStr[1]); Integer day; //是否有店铺id if (dateStr.length > 3) { - day = Integer.parseInt(dateStr[2]); + day = Convert.toInt(dateStr[2]); this.storeId = dateStr[3]; } else { - day = Integer.parseInt(dateStr[2]); + day = Convert.toInt(dateStr[2]); } Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); diff --git a/framework/src/main/java/cn/lili/common/aop/limiter/LimitInterceptor.java b/framework/src/main/java/cn/lili/common/aop/limiter/LimitInterceptor.java index ff0b5210..2e625ef9 100644 --- a/framework/src/main/java/cn/lili/common/aop/limiter/LimitInterceptor.java +++ b/framework/src/main/java/cn/lili/common/aop/limiter/LimitInterceptor.java @@ -1,6 +1,7 @@ package cn.lili.common.aop.limiter; import cn.lili.common.aop.limiter.annotation.LimitPoint; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import com.google.common.collect.ImmutableList; import lombok.extern.slf4j.Slf4j; @@ -60,7 +61,7 @@ public class LimitInterceptor { log.info("限制请求{}, 当前请求{},缓存key{}", limitCount, count.intValue(), key); //如果缓存里没有值,或者他的值小于限制频率 if (count.intValue() >= limitCount) { - throw new ServiceException("访问过于频繁,请稍后再试"); + throw new ServiceException(ResultCode.LIMIT_ERROR); } } //如果从redis中执行都值判定为空,则这里跳过 diff --git a/framework/src/main/java/cn/lili/common/enums/ResultCode.java b/framework/src/main/java/cn/lili/common/enums/ResultCode.java index d0dec479..d1b6598e 100644 --- a/framework/src/main/java/cn/lili/common/enums/ResultCode.java +++ b/framework/src/main/java/cn/lili/common/enums/ResultCode.java @@ -27,6 +27,17 @@ public enum ResultCode { * 参数异常 */ PARAMS_ERROR(4002, "参数异常"), + /** + * 非法请求 + */ + ILLEGAL_REQUEST_ERROR(4003, "非法请求,请重新刷新页面操作"), + + /** + * 高频访问错误 + */ + LIMIT_ERROR(4004,"访问过于频繁,请稍后再试"), + + /** @@ -65,6 +76,7 @@ public enum ResultCode { GOODS_SKU_QUANTITY_ERROR(11011, "商品库存数量不能为负数"), GOODS_SKU_QUANTITY_NOT_ENOUGH(11011, "商品库存不足"), MUST_HAVE_GOODS_SKU(11012,"规格必须要有一个!"), + GOODS_PARAMS_ERROR(11013,"商品参数错误,刷新后重试"), /** * 参数 @@ -349,16 +361,25 @@ public enum ResultCode { * 直播 */ STODIO_GOODS_EXIST_ERROR(44001,"直播商品已存在"), + COMMODITY_ERROR(44002,"添加直播商品失败"), /** * 秒杀 */ - SECKILL_NOT_EXIST(45001,"当前参与的秒杀活动不存在!"), + SECKILL_NOT_EXIST_ERROR(45001,"当前参与的秒杀活动不存在!"), + SECKILL_UPDATE_ERROR(45002,"当前秒杀活动活动已经开始,无法修改!"), + SECKILL_PRICE_ERROR(45003,"活动价格不能大于商品原价"), + SECKILL_TIME_ERROR(45004,"时刻参数异常"), + /** * 优惠券活动 */ COUPON_ACTIVITY_START_TIME_ERROR(46001,"活动时间小于当前时间,不能进行编辑删除操作"), + COUPON_ACTIVITY_MEMBER_ERROR(46002,"指定精准发券则必须指定会员,会员不可以为空"), + COUPON_ACTIVITY_ITEM_ERROR(46003,"优惠券活动必须指定优惠券,不能为空"), + COUPON_ACTIVITY_ITEM_MUST_NUM_ERROR(46004,"优惠券活动最多指定10个优惠券"), + COUPON_ACTIVITY_ITEM_NUM_ERROR(46005,"赠券数量必须大于0"), /** * 店铺 @@ -413,69 +434,68 @@ public enum ResultCode { */ SETTING_NOT_TO_SET(70001, "该参数不需要设置"), - /** - * 短信 - */ - SMS_SIGN_EXIST_ERROR(80001, "短信签名已存在"), + ALIPAY_NOT_SETTING(70002, "支付宝支付未配置"), + ALIPAY_EXCEPTION(70003, "支付宝支付错误,请稍后重试"), + + ALIPAY_PARAMS_EXCEPTION(70004, "支付宝参数异常"), + + LOGISTICS_NOT_SETTING(70005,"您还未配置快递查询"), + + ORDER_SETTING_ERROR(70006,"系统订单配置异常"), + + ALI_SMS_SETTING_ERROR(70007,"您还未配置阿里云短信"), + + SMS_SIGN_EXIST_ERROR(70008, "短信签名已存在"), /** * 站内信 */ - NOTICE_NOT_EXIST(80101, "当前消息模板不存在"), + NOTICE_NOT_EXIST(80001, "当前消息模板不存在"), - NOTICE_ERROR(80102, "修改站内信异常,请稍后重试"), + NOTICE_ERROR(80002, "修改站内信异常,请稍后重试"), /** * OSS */ - OSS_NOT_EXIST(80201, "OSS未配置"), + OSS_NOT_EXIST(80101, "OSS未配置"), - OSS_EXCEPTION(80202, "文件上传失败,请稍后重试"), + OSS_EXCEPTION(80102, "文件上传失败,请稍后重试"), /** * 验证码 */ - VERIFICATION_SEND_SUCCESS(80301, "短信验证码,发送成功"), + VERIFICATION_SEND_SUCCESS(80201, "短信验证码,发送成功"), - VERIFICATION_ERROR(80302, "验证失败"), + VERIFICATION_ERROR(80202, "验证失败"), - VERIFICATION_SMS_ERROR(80303, "短信验证码错误,请重新校验"), - - VERIFICATION_SMS_EXPIRED_ERROR(80304, "验证码已失效,请重新校验"), - - /** - * 配置错误 - */ - ALIPAY_NOT_SETTING(80401, "支付宝支付未配置"), - - ALIPAY_EXCEPTION(80402, "支付宝支付错误,请稍后重试"), - - ALIPAY_PARAMS_EXCEPTION(80403, "支付宝参数异常"), - - LOGISTICS_NOT_SETTING(80404,"您还未配置快递查询"), - - ORDER_SETTING_ERROR(80405,"系统订单配置异常"), - - ALI_SMS_SETTING_ERROR(80406,"您还未配置阿里云短信"), + VERIFICATION_SMS_ERROR(80203, "短信验证码错误,请重新校验"), + VERIFICATION_SMS_EXPIRED_ERROR(80204, "验证码已失效,请重新校验"), /** * 微信相关异常 */ - WECHAT_CONNECT_NOT_SETTING(80500, "微信联合登陆信息未配置"), + WECHAT_CONNECT_NOT_SETTING(80300, "微信联合登陆信息未配置"), - WECHAT_PAYMENT_NOT_SETTING(80501, "微信支付信息未配置"), + WECHAT_PAYMENT_NOT_SETTING(80301, "微信支付信息未配置"), - WECHAT_QRCODE_ERROR(80502, "微信二维码生成异常"), + WECHAT_QRCODE_ERROR(80302, "微信二维码生成异常"), - WECHAT_MP_MESSAGE_ERROR(80503, "微信小程序小消息订阅异常"), + WECHAT_MP_MESSAGE_ERROR(80303, "微信小程序小消息订阅异常"), - WECHAT_JSAPI_SIGN_ERROR(80504,"微信JsApi签名异常"), + WECHAT_JSAPI_SIGN_ERROR(80304,"微信JsApi签名异常"), WECHAT_CERT_ERROR(80505,"证书获取失败"), - APP_VERSION_EXIST(80600, "APP版本已存在"); + APP_VERSION_EXIST(80600, "APP版本已存在"), + + CUSTOM_WORDS_EXIST_ERROR(90000, "当前自定义分词已存在!"), + CUSTOM_WORDS_NOT_EXIST_ERROR(90000, "当前自定义分词不存在!"), + CONNECT_NOT_EXIST(90000,"登录方式不存在"), + + + ; private final Integer code; private final String message; diff --git a/framework/src/main/java/cn/lili/common/utils/StringUtils.java b/framework/src/main/java/cn/lili/common/utils/StringUtils.java index e97c61c4..b8e29aa7 100644 --- a/framework/src/main/java/cn/lili/common/utils/StringUtils.java +++ b/framework/src/main/java/cn/lili/common/utils/StringUtils.java @@ -1,5 +1,6 @@ package cn.lili.common.utils; +import cn.hutool.core.convert.Convert; import cn.hutool.core.util.StrUtil; import java.beans.BeanInfo; @@ -61,7 +62,7 @@ public class StringUtils extends StrUtil { return 0; } try { - value = Integer.parseInt(obj.toString()); + value = Convert.toInt(obj.toString()); } catch (Exception ex) { if (checked) { throw new RuntimeException("整型数字格式不正确"); diff --git a/framework/src/main/java/cn/lili/common/verification/service/impl/VerificationServiceImpl.java b/framework/src/main/java/cn/lili/common/verification/service/impl/VerificationServiceImpl.java index 6321b365..53a87813 100644 --- a/framework/src/main/java/cn/lili/common/verification/service/impl/VerificationServiceImpl.java +++ b/framework/src/main/java/cn/lili/common/verification/service/impl/VerificationServiceImpl.java @@ -2,6 +2,7 @@ package cn.lili.common.verification.service.impl; import cn.lili.common.cache.Cache; import cn.lili.common.cache.CachePrefix; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.common.utils.StringUtils; import cn.lili.common.verification.SliderImageUtil; @@ -47,7 +48,7 @@ public class VerificationServiceImpl implements VerificationService { public Map createVerification(VerificationEnums verificationEnums, String uuid) throws IOException { if (uuid == null) { - throw new ServiceException("非法请求,请重新刷新页面操作"); + throw new ServiceException(ResultCode.ILLEGAL_REQUEST_ERROR); } //获取验证码配置 diff --git a/framework/src/main/java/cn/lili/config/elasticsearch/ElasticsearchConfig.java b/framework/src/main/java/cn/lili/config/elasticsearch/ElasticsearchConfig.java index 989220f8..e25bb9d7 100644 --- a/framework/src/main/java/cn/lili/config/elasticsearch/ElasticsearchConfig.java +++ b/framework/src/main/java/cn/lili/config/elasticsearch/ElasticsearchConfig.java @@ -1,5 +1,6 @@ package cn.lili.config.elasticsearch; +import cn.hutool.core.convert.Convert; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.http.HttpHost; @@ -75,7 +76,7 @@ public class ElasticsearchConfig extends AbstractElasticsearchConfiguration { HttpHost[] httpHosts = new HttpHost[clusterNodes.size()]; for (int i = 0; i < clusterNodes.size(); i++) { String[] node = clusterNodes.get(i).split(":"); - httpHosts[i] = new HttpHost(node[0], Integer.parseInt(node[1]), elasticsearchProperties.getSchema()); + httpHosts[i] = new HttpHost(node[0], Convert.toInt(node[1]), elasticsearchProperties.getSchema()); } return httpHosts; } diff --git a/framework/src/main/java/cn/lili/config/sharding/CreateTimeShardingTableAlgorithm.java b/framework/src/main/java/cn/lili/config/sharding/CreateTimeShardingTableAlgorithm.java index e640e877..ab83fc26 100644 --- a/framework/src/main/java/cn/lili/config/sharding/CreateTimeShardingTableAlgorithm.java +++ b/framework/src/main/java/cn/lili/config/sharding/CreateTimeShardingTableAlgorithm.java @@ -1,5 +1,6 @@ package cn.lili.config.sharding; +import cn.hutool.core.convert.Convert; import cn.lili.common.utils.DateUtil; import com.google.common.collect.Range; import org.apache.shardingsphere.api.sharding.standard.PreciseShardingAlgorithm; @@ -34,10 +35,10 @@ public class CreateTimeShardingTableAlgorithm implements PreciseShardingAlgorith Collection collect = new ArrayList<>(); Range valueRange = rangeShardingValue.getValueRange(); - Integer startMonth = Integer.parseInt(DateUtil.toString(valueRange.lowerEndpoint().longValue(), "MM")); - Integer endMonth = Integer.parseInt(DateUtil.toString(valueRange.upperEndpoint().longValue(), "MM")); - Integer startYear = Integer.parseInt(DateUtil.toString(valueRange.lowerEndpoint().longValue(), "yyyy")); - Integer endYear = Integer.parseInt(DateUtil.toString(valueRange.upperEndpoint().longValue(), "yyyy")); + Integer startMonth = Convert.toInt(DateUtil.toString(valueRange.lowerEndpoint().longValue(), "MM")); + Integer endMonth = Convert.toInt(DateUtil.toString(valueRange.upperEndpoint().longValue(), "MM")); + Integer startYear = Convert.toInt(DateUtil.toString(valueRange.lowerEndpoint().longValue(), "yyyy")); + Integer endYear = Convert.toInt(DateUtil.toString(valueRange.upperEndpoint().longValue(), "yyyy")); //如果是同一年查询 //2020-1~2020-2 diff --git a/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/CommodityServiceImpl.java b/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/CommodityServiceImpl.java index beabdc2e..65608071 100644 --- a/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/CommodityServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/broadcast/serviceimpl/CommodityServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.core.convert.Convert; import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.common.security.context.UserContext; import cn.lili.common.security.enums.UserEnums; @@ -50,7 +51,8 @@ public class CommodityServiceImpl extends ServiceImpl impleme try { //创建小程序直播 Map roomMap = wechatLivePlayerUtil.create(studio); - studio.setRoomId(Integer.parseInt(roomMap.get("roomId"))); + studio.setRoomId(Convert.toInt(roomMap.get("roomId"))); studio.setQrCodeUrl(roomMap.get("qrcodeUrl")); studio.setStoreId(UserContext.getCurrentUser().getStoreId()); studio.setStatus(StudioStatusEnum.NEW.name()); diff --git a/framework/src/main/java/cn/lili/modules/connect/request/AuthAlipayRequest.java b/framework/src/main/java/cn/lili/modules/connect/request/AuthAlipayRequest.java index b51f3d2d..89bb41d3 100644 --- a/framework/src/main/java/cn/lili/modules/connect/request/AuthAlipayRequest.java +++ b/framework/src/main/java/cn/lili/modules/connect/request/AuthAlipayRequest.java @@ -1,5 +1,6 @@ package cn.lili.modules.connect.request; +import cn.hutool.core.convert.Convert; import cn.lili.common.cache.Cache; import cn.lili.common.utils.StringUtils; import cn.lili.common.utils.UrlBuilder; @@ -56,7 +57,7 @@ public class AuthAlipayRequest extends AuthDefaultRequest { return AuthToken.builder() .accessToken(response.getAccessToken()) .uid(response.getUserId()) - .expireIn(Integer.parseInt(response.getExpiresIn())) + .expireIn(Convert.toInt(response.getExpiresIn())) .refreshToken(response.getRefreshToken()) .build(); } @@ -86,7 +87,7 @@ public class AuthAlipayRequest extends AuthDefaultRequest { .data(AuthToken.builder() .accessToken(response.getAccessToken()) .uid(response.getUserId()) - .expireIn(Integer.parseInt(response.getExpiresIn())) + .expireIn(Convert.toInt(response.getExpiresIn())) .refreshToken(response.getRefreshToken()) .build()) .build(); diff --git a/framework/src/main/java/cn/lili/modules/connect/request/AuthQQRequest.java b/framework/src/main/java/cn/lili/modules/connect/request/AuthQQRequest.java index 164ec3a1..15299731 100644 --- a/framework/src/main/java/cn/lili/modules/connect/request/AuthQQRequest.java +++ b/framework/src/main/java/cn/lili/modules/connect/request/AuthQQRequest.java @@ -1,5 +1,6 @@ package cn.lili.modules.connect.request; +import cn.hutool.core.convert.Convert; import cn.lili.common.cache.Cache; import cn.lili.common.utils.StringUtils; import cn.lili.common.utils.UrlBuilder; @@ -118,7 +119,7 @@ public class AuthQQRequest extends AuthDefaultRequest { } return AuthToken.builder() .accessToken(accessTokenObject.get("access_token")) - .expireIn(Integer.parseInt(accessTokenObject.getOrDefault("expires_in", "0"))) + .expireIn(Convert.toInt(accessTokenObject.getOrDefault("expires_in", "0"))) .refreshToken(accessTokenObject.get("refresh_token")) .build(); } diff --git a/framework/src/main/java/cn/lili/modules/connect/util/ConnectUtil.java b/framework/src/main/java/cn/lili/modules/connect/util/ConnectUtil.java index acf388a3..4dd3c02d 100644 --- a/framework/src/main/java/cn/lili/modules/connect/util/ConnectUtil.java +++ b/framework/src/main/java/cn/lili/modules/connect/util/ConnectUtil.java @@ -137,7 +137,7 @@ public class ConnectUtil { public AuthRequest getAuthRequest(String type) { ConnectAuthEnum authInterface = ConnectAuthEnum.valueOf(type); if (authInterface == null) { - throw new ServiceException("错误的登录方式"); + throw new ServiceException(ResultCode.CONNECT_NOT_EXIST); } AuthRequest authRequest = null; switch (authInterface) { diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java index e4f8eefa..8c7c43c0 100644 --- a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java +++ b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java @@ -1,5 +1,6 @@ package cn.lili.modules.goods.entity.dos; +import cn.hutool.core.convert.Convert; import cn.hutool.json.JSONUtil; import cn.lili.base.BaseEntity; import cn.lili.common.enums.ResultCode; @@ -234,19 +235,19 @@ public class Goods extends BaseEntity { 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) { + if (StringUtil.isEmpty(sku.get("price").toString()) || Convert.toDouble( 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) { + if (StringUtil.isEmpty(sku.get("cost").toString()) || Convert.toDouble( 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) { + if (StringUtil.isEmpty(sku.get("weight").toString()) || Convert.toDouble(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) { + if (StringUtil.isEmpty(sku.get("quantity").toString()) || Convert.toInt( sku.get("quantity").toString()) < 0) { throw new ServiceException(ResultCode.GOODS_SKU_QUANTITY_ERROR); } diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java index b9167c90..10bf49bf 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java @@ -367,11 +367,11 @@ public class GoodsServiceImpl extends ServiceImpl implements if(parameters.getId().equals(goodsParamsItemDTO.getParamId())){ //校验是否可以索引参数是否正确 if(!parameters.getIsIndex().equals(goodsParamsItemDTO.getIsIndex())){ - throw new ServiceException("商品参数错误,刷新后重试"); + throw new ServiceException(ResultCode.GOODS_PARAMS_ERROR); } //校验是否必填参数是否正确 if(!parameters.getRequired().equals(goodsParamsItemDTO.getRequired())){ - throw new ServiceException("商品参数错误,刷新后重试"); + throw new ServiceException(ResultCode.GOODS_PARAMS_ERROR); } } } diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java index 78ee307f..3ecdba7d 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java @@ -173,8 +173,8 @@ public class GoodsSkuServiceImpl extends ServiceImpl i } String quantity = stringRedisTemplate.opsForValue().get(GoodsSkuService.getStockCacheKey(id)); if (quantity != null) { - if (goodsSku.getQuantity() != Integer.parseInt(quantity)) { - goodsSku.setQuantity(Integer.parseInt(quantity)); + if (goodsSku.getQuantity() != Convert.toInt(quantity)) { + goodsSku.setQuantity(Convert.toInt(quantity)); this.updateById(goodsSku); } } else { @@ -381,7 +381,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl i String cacheKeys = GoodsSkuService.getStockCacheKey(skuId); String stockStr = stringRedisTemplate.opsForValue().get(cacheKeys); if (stockStr != null) { - return Integer.parseInt(stockStr); + return Convert.toInt(stockStr); } else { GoodsSku goodsSku = getGoodsSkuByIdFromCache(skuId); stringRedisTemplate.opsForValue().set(cacheKeys, goodsSku.getQuantity().toString()); diff --git a/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java b/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java index 7b4d531c..fec2fba2 100644 --- a/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java @@ -1,6 +1,7 @@ package cn.lili.modules.member.serviceimpl; +import cn.hutool.core.convert.Convert; import cn.lili.common.cache.Cache; import cn.lili.common.cache.CachePrefix; import cn.lili.common.enums.ResultCode; @@ -177,7 +178,7 @@ public class MemberServiceImpl extends ServiceImpl impleme try { String username = UuidUtils.getUUID(); Member member = new Member(username, UuidUtils.getUUID(), authUser.getAvatar(), authUser.getNickname(), - authUser.getGender() != null ? Integer.parseInt(authUser.getGender().getCode()) : 0); + authUser.getGender() != null ? Convert.toInt(authUser.getGender().getCode()) : 0); //保存会员 this.save(member); Member loadMember = this.findByUsername(username); diff --git a/framework/src/main/java/cn/lili/modules/promotion/entity/vos/PointsGoodsSearchParams.java b/framework/src/main/java/cn/lili/modules/promotion/entity/vos/PointsGoodsSearchParams.java index 1b37c5d3..af2b717c 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/entity/vos/PointsGoodsSearchParams.java +++ b/framework/src/main/java/cn/lili/modules/promotion/entity/vos/PointsGoodsSearchParams.java @@ -1,5 +1,6 @@ package cn.lili.modules.promotion.entity.vos; +import cn.hutool.core.convert.Convert; import cn.hutool.core.text.CharSequenceUtil; import cn.lili.modules.promotion.entity.enums.PromotionStatusEnum; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -85,9 +86,9 @@ public class PointsGoodsSearchParams { if (CharSequenceUtil.isNotEmpty(points)) { String[] s = points.split("_"); if (s.length > 1) { - query.addCriteria(Criteria.where("points").gte(Integer.parseInt(s[0])).lte(Integer.parseInt(s[1]))); + query.addCriteria(Criteria.where("points").gte(Convert.toInt(s[0])).lte(Convert.toInt(s[1]))); } else { - query.addCriteria(Criteria.where("points").gte(Integer.parseInt(s[0]))); + query.addCriteria(Criteria.where("points").gte(Convert.toInt(s[0]))); } } if (recommend != null) { diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponActivityServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponActivityServiceImpl.java index 3f14f82c..a8aa97c0 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponActivityServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponActivityServiceImpl.java @@ -35,6 +35,8 @@ import org.springframework.stereotype.Service; import java.util.*; +import static cn.lili.common.enums.ResultCode.COUPON_ACTIVITY_ITEM_ERROR; + /** * 优惠券活动业务层实现 * @@ -216,18 +218,18 @@ public class CouponActivityServiceImpl extends ServiceImpl 10) { - throw new ServiceException("优惠券活动最多指定10个优惠券"); + throw new ServiceException(ResultCode.COUPON_ACTIVITY_ITEM_MUST_NUM_ERROR); } else { for (CouponActivityItem item : couponActivity.getCouponActivityItems()) { if (item.getNum() == null || item.getNum() <= 0) { - throw new ServiceException("赠券数量必须大于0"); + throw new ServiceException(ResultCode.COUPON_ACTIVITY_ITEM_NUM_ERROR); } } } diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java index c15773bd..2590e8e2 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java @@ -1,5 +1,6 @@ package cn.lili.modules.promotion.serviceimpl; +import cn.hutool.core.convert.Convert; import cn.hutool.core.text.CharSequenceUtil; import cn.lili.common.exception.ServiceException; import cn.lili.common.utils.BeanUtil; @@ -271,8 +272,8 @@ public class PromotionGoodsServiceImpl extends ServiceImpl entry : cacheSeckill.entrySet()) { - Integer timelineKey = Integer.parseInt(entry.getKey().toString()); + Integer timelineKey = Convert.toInt(entry.getKey().toString()); if (timelineKey.equals(timeline)) { seckillGoodsVoS = (List) entry.getValue(); } @@ -146,7 +147,7 @@ public class SeckillApplyServiceImpl extends ServiceImpl seckillApplyList) { SeckillVO seckill = mongoTemplate.findById(seckillId, SeckillVO.class); if (seckill == null) { - throw new ServiceException(ResultCode.SECKILL_NOT_EXIST); + throw new ServiceException(ResultCode.SECKILL_NOT_EXIST_ERROR); } //检查秒杀活动申请是否合法 checkSeckillApplyList(seckill.getHours(), seckillApplyList, storeId); @@ -200,10 +201,10 @@ public class SeckillApplyServiceImpl extends ServiceImpl ids) { SeckillVO seckillVO = this.mongoTemplate.findById(seckillId, SeckillVO.class); if (seckillVO == null) { - throw new ServiceException("当前秒杀活动活动不存在!"); + throw new ServiceException(ResultCode.SECKILL_NOT_EXIST_ERROR); } if (seckillVO.getPromotionStatus().equals(PromotionStatusEnum.START.name())) { - throw new ServiceException("当前秒杀活动活动已经开始,无法修改!"); + throw new ServiceException(ResultCode.SECKILL_UPDATE_ERROR); } seckillVO.getSeckillApplyList().removeIf(seckillApply -> ids.contains(seckillApply.getId())); this.mongoTemplate.save(seckillVO); @@ -222,13 +223,13 @@ public class SeckillApplyServiceImpl extends ServiceImpl seckillApply.getOriginalPrice()) { - throw new ServiceException("活动价格不能大于商品原价"); + throw new ServiceException(ResultCode.SECKILL_PRICE_ERROR); } //检查秒杀活动申请的时刻,是否存在在秒杀活动的时间段内 String[] rangeHours = hours.split(","); boolean containsSame = Arrays.stream(rangeHours).anyMatch(i -> i.equals(seckillApply.getTimeLine().toString())); if (!containsSame) { - throw new ServiceException("时刻参数异常"); + throw new ServiceException(ResultCode.SECKILL_TIME_ERROR); } //检查商品是否参加多个时间段的活动 if (existSku.contains(seckillApply.getSkuId())) { diff --git a/framework/src/main/java/cn/lili/modules/search/serviceimpl/CustomWordsServiceImpl.java b/framework/src/main/java/cn/lili/modules/search/serviceimpl/CustomWordsServiceImpl.java index 4eb7ea7a..4797774e 100644 --- a/framework/src/main/java/cn/lili/modules/search/serviceimpl/CustomWordsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/search/serviceimpl/CustomWordsServiceImpl.java @@ -1,5 +1,6 @@ package cn.lili.modules.search.serviceimpl; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.common.utils.PageUtil; import cn.lili.common.vo.PageVO; @@ -63,7 +64,7 @@ public class CustomWordsServiceImpl extends ServiceImpl map = orderStatisticsDataService.getStoreOrderStatisticsPrice(); - storeIndexStatisticsVO.setOrderNum(Integer.parseInt(map.get("num").toString())); + storeIndexStatisticsVO.setOrderNum(Convert.toInt(map.get("num").toString())); storeIndexStatisticsVO.setOrderPrice(map.get("price") != null ? Double.parseDouble(map.get("price").toString()) : 0.0); //访问量 From d25ba76094ab8bf8679808ccd2b53f5233866070 Mon Sep 17 00:00:00 2001 From: paulGao Date: Thu, 1 Jul 2021 10:12:33 +0800 Subject: [PATCH 20/23] fix https://gitee.com/beijing_hongye_huicheng/lilishop/issues/I3YFU4 --- .../modules/goods/serviceimpl/GoodsSkuServiceImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java index 99f46de6..9f8e0f68 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java @@ -191,6 +191,11 @@ public class GoodsSkuServiceImpl extends ServiceImpl i GoodsSku goodsSku = this.getGoodsSkuByIdFromCache(skuId); GoodsVO goodsVO = goodsService.getGoodsVO(goodsId); + if (goodsVO == null || !goodsVO.getMarketEnable().equals(GoodsStatusEnum.UPPER.name()) + || !goodsVO.getIsAuth().equals(GoodsAuthEnum.PASS.name()) + || Boolean.TRUE.equals(goodsVO.getDeleteFlag())) { + throw new ServiceException(ResultCode.GOODS_NOT_EXIST); + } //如果规格为空则使用商品ID进行查询 if (goodsSku == null) { skuId = goodsVO.getSkuList().get(0).getId(); @@ -199,8 +204,6 @@ public class GoodsSkuServiceImpl extends ServiceImpl i if (goodsSku == null) { 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); From 931276f72b04e81336f0612f1f20f388e5f50551 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Thu, 1 Jul 2021 11:17:18 +0800 Subject: [PATCH 21/23] =?UTF-8?q?=E6=B7=BB=E5=8A=A0ResultCode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DistributionGoodsBuyerController.java | 23 +- .../controller/common/UploadController.java | 2 +- .../java/cn/lili/common/enums/ResultCode.java | 214 ++++++------------ .../serviceimpl/ConnectServiceImpl.java | 2 +- .../DistributionSelectedGoodsService.java | 7 + .../DistributionSelectedGoodsServiceImpl.java | 12 + .../plugin/impl/AliFileManagerPlugin.java | 15 +- .../serviceimpl/CategoryServiceImpl.java | 3 +- .../goods/serviceimpl/GoodsServiceImpl.java | 8 +- .../MemberNoticeSenterServiceImpl.java | 3 +- .../member/serviceimpl/MemberServiceImpl.java | 8 +- .../WechatMPMessageServiceImpl.java | 3 +- .../serviceimpl/WechatMessageServiceImpl.java | 3 +- .../message/util/WechatMessageUtil.java | 6 +- .../cart/render/impl/CheckDataRender.java | 3 +- .../cart/render/impl/SkuPromotionRender.java | 3 +- .../serviceimpl/AfterSaleServiceImpl.java | 2 +- .../OrderComplaintServiceImpl.java | 6 +- .../serviceimpl/OrderItemServiceImpl.java | 3 +- .../order/serviceimpl/OrderServiceImpl.java | 2 +- .../page/entity/vos/ArticleCategoryVO.java | 1 + .../serviceimpl/CouponServiceImpl.java | 29 ++- .../serviceimpl/FullDiscountServiceImpl.java | 20 +- .../serviceimpl/MemberCouponServiceImpl.java | 4 +- .../serviceimpl/PintuanServiceImpl.java | 13 +- .../serviceimpl/PointsGoodsServiceImpl.java | 5 +- .../PromotionGoodsServiceImpl.java | 5 +- .../serviceimpl/PromotionServiceImpl.java | 3 +- .../serviceimpl/SeckillServiceImpl.java | 9 +- .../promotion/tools/PromotionTools.java | 7 +- .../other/CustomWordsController.java | 3 +- .../promotion/CouponManagerController.java | 2 +- 32 files changed, 198 insertions(+), 231 deletions(-) diff --git a/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionGoodsBuyerController.java b/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionGoodsBuyerController.java index 088e5143..2a97f34b 100644 --- a/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionGoodsBuyerController.java +++ b/buyer-api/src/main/java/cn/lili/controller/other/distribution/DistributionGoodsBuyerController.java @@ -11,6 +11,7 @@ import cn.lili.modules.distribution.service.DistributionSelectedGoodsService; import com.baomidou.mybatisplus.core.metadata.IPage; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -50,13 +51,25 @@ public class DistributionGoodsBuyerController { } @ApiOperation(value = "选择分销商品") - @ApiImplicitParam(name = "distributionGoodsId", value = "分销ID", required = true, dataType = "String", paramType = "path") + @ApiImplicitParams({ + @ApiImplicitParam(name = "distributionGoodsId", value = "分销ID", required = true, dataType = "String", paramType = "path"), + @ApiImplicitParam(name = "checked", value = "是否选择", required = true, dataType = "boolean", paramType = "query") + }) @GetMapping(value = "/checked/{distributionGoodsId}") public ResultMessage distributionCheckGoods( - @NotNull(message = "分销商品不能为空") @PathVariable("distributionGoodsId") String distributionGoodsId) { - if(distributionSelectedGoodsService.add(distributionGoodsId)){ - return ResultUtil.success(); + @NotNull(message = "分销商品不能为空") @PathVariable("distributionGoodsId") String distributionGoodsId,Boolean checked) { + Boolean result=false; + if(checked){ + result=distributionSelectedGoodsService.add(distributionGoodsId); + }else { + result=distributionSelectedGoodsService.delete(distributionGoodsId); } - throw new ServiceException(ResultCode.ERROR); + //判断操作结果 + if(result){ + return ResultUtil.success(ResultCode.SUCCESS); + }else{ + throw new ServiceException(ResultCode.ERROR); + } + } } diff --git a/common-api/src/main/java/cn/lili/controller/common/UploadController.java b/common-api/src/main/java/cn/lili/controller/common/UploadController.java index d2e84495..d4f5cdfd 100644 --- a/common-api/src/main/java/cn/lili/controller/common/UploadController.java +++ b/common-api/src/main/java/cn/lili/controller/common/UploadController.java @@ -100,7 +100,7 @@ public class UploadController { fileService.save(newFile); } catch (Exception e) { log.error("文件上传失败", e); - throw new ServiceException(ResultCode.OSS_EXCEPTION); + throw new ServiceException(ResultCode.OSS_EXCEPTION_ERROR); } return ResultUtil.data(result); } diff --git a/framework/src/main/java/cn/lili/common/enums/ResultCode.java b/framework/src/main/java/cn/lili/common/enums/ResultCode.java index d1b6598e..bd499283 100644 --- a/framework/src/main/java/cn/lili/common/enums/ResultCode.java +++ b/framework/src/main/java/cn/lili/common/enums/ResultCode.java @@ -27,25 +27,15 @@ public enum ResultCode { * 参数异常 */ PARAMS_ERROR(4002, "参数异常"), - /** - * 非法请求 - */ - ILLEGAL_REQUEST_ERROR(4003, "非法请求,请重新刷新页面操作"), - - /** - * 高频访问错误 - */ - LIMIT_ERROR(4004,"访问过于频繁,请稍后再试"), - - /** * 系统异常 */ - WECHAT_CONNECT_NOT_EXIST(1001, "微信联合登录未配置"), VERIFICATION_EXIST(1002, "验证码服务异常"), + LIMIT_ERROR(1003,"访问过于频繁,请稍后再试"), + ILLEGAL_REQUEST_ERROR(1004, "非法请求,请重新刷新页面操作"), /** * 分类 */ @@ -58,6 +48,7 @@ public enum ResultCode { CATEGORY_SAVE_ERROR(10007, "此类别下存在商品不能删除"), CATEGORY_PARAMETER_SAVE_ERROR(10008, "分类绑定参数组添加失败"), CATEGORY_PARAMETER_UPDATE_ERROR(10009, "分类绑定参数组添加失败"), + CATEGORY_DELETE_FLAG_ERROR(10010, "子类状态不能与父类不一致!"), /** * 商品 @@ -77,181 +68,124 @@ public enum ResultCode { GOODS_SKU_QUANTITY_NOT_ENOUGH(11011, "商品库存不足"), MUST_HAVE_GOODS_SKU(11012,"规格必须要有一个!"), GOODS_PARAMS_ERROR(11013,"商品参数错误,刷新后重试"), + PHYSICAL_GOODS_NEED_TEMP(11014,"实物商品需选择配送模板"), + VIRTUAL_GOODS_NOT_NEED_TEMP(11015,"实物商品需选择配送模板"), + GOODS_TYPE_ERROR(11016, "需选择商品类型"), /** * 参数 */ 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, "品牌删除失败"), - BRAND_NAME_EXIST_ERROR(20002, "品牌名称重复!"), - BRAND_USE_DISABLE_ERROR(20003, "当前品牌下存在分类不可禁用"), - BRAND_NOT_EXIST(20004, "品牌不存在"), /** * 用户 */ 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(20019, "无法重复收藏"), - - NOT_BINDING_USER(20020,"未绑定用户"), + USER_NOT_BINDING(20020,"未绑定用户"), + USER_AUTO_REGISTER_ERROR(20021,"自动注册失败,请稍后重试"), + USER_OVERDUE_CONNECT_ERROR(20022,"授权信息已过期,请重新授权/登录"), + USER_CONNECT_BANDING_ERROR(20023,"当前联合登陆方式,已绑定其他账号,需进行解绑操作"), + USER_CONNECT_NOT_EXIST_ERROR(20024, "暂无联合登陆信息,无法实现一键注册功能,请点击第三方登录进行授权"), /** * 权限 */ 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, "购物商品不支持当前收货地址配送"), /** * 订单 */ ORDER_ERROR(31001, "创建订单异常,请稍后重试"), - ORDER_NOT_EXIST(31002, "订单不存在"), - ORDER_DELIVERED_ERROR(31003, "订单状态错误,无法进行确认收货"), - ORDER_UPDATE_PRICE_ERROR(31004, "已支付的订单不能修改金额"), - ORDER_LOGISTICS_ERROR(31005, "物流错误"), - ORDER_DELIVER_ERROR(31006, "物流错误"), - ORDER_NOT_USER(31007, "非当前会员的订单"), - ORDER_TAKE_ERROR(31008, "当前订单无法核销"), - MEMBER_ADDRESS_NOT_EXIST(31009, "订单无收货地址,请先配置收货地址"), - ORDER_DELIVER_NUM_ERROR(31010, "没有待发货的订单"), - ORDER_NOT_SUPPORT_DISTRIBUTION(31011, "购物车中包含不支持配送的商品,请重新选择收货地址,或者重新选择商品"), - ORDER_CAN_NOT_CANCEL(31012, "当前订单状态不可取消"), - - BATCH_DELIVER_ERROR(31013, "批量发货,文件读取失败"), + ORDER_BATCH_DELIVER_ERROR(31013, "批量发货,文件读取失败"), + ORDER_ITEM_NOT_EXIST(31014, "当前订单项不存在!"), /** * 支付 */ PAY_UN_WANTED(32000, "当前订单不需要付款,返回订单列表等待系统订单出库即可"), - PAY_SUCCESS(32001, "支付成功"), - PAY_INCONSISTENT_ERROR(32002, "付款金额和应付金额不一致"), - PAY_DOUBLE_ERROR(32003, "订单已支付,不能再次进行支付"), - PAY_CASHIER_ERROR(32004, "收银台信息获取错误"), - PAY_ERROR(32005, "支付业务异常,请稍后重试"), - PAY_BAN(32006, "当前订单不需要付款,请返回订单列表重新操作"), - PAY_PARTIAL_ERROR(32007, "该订单已部分支付,请前往订单中心进行支付"), - PAY_NOT_SUPPORT(32008, "支付暂不支持"), - PAY_CLIENT_TYPE_ERROR(32009, "错误的客户端"), - PAY_POINT_ENOUGH(32010, "积分不足,不能兑换"), - PAY_NOT_EXIST_ORDER(32011, "支付订单不存在"), - CAN_NOT_RECHARGE_WALLET(32012, "不能使用余额进行充值"), @@ -259,39 +193,32 @@ public enum ResultCode { * 售后 */ AFTER_SALES_NOT_PAY_ERROR(33001, "当前订单未支付,不能申请售后"), - AFTER_SALES_CANCEL_ERROR(33002, "当前售后单无法取消"), - AFTER_SALES_BAN(33003, "订单状态不允许申请售后,请联系平台或商家"), - AFTER_SALES_DOUBLE_ERROR(33004, "售后已审核,无法重复操作"), - AFTER_SALES_LOGISTICS_ERROR(33005, "物流公司错误,请重新选择"), - AFTER_STATUS_ERROR(33006, "售后状态错误,请刷新页面"), + RETURN_MONEY_OFFLINE_BANK_ERROR(33007, "当账号类型为银行转账时,银行信息不能为空"), /** * 投诉 */ COMPLAINT_ORDER_ITEM_EMPTY_ERROR(33100, "订单不存在"), - COMPLAINT_SKU_EMPTY_ERROR(33101, "商品已下架,如需投诉请联系平台客服"), - COMPLAINT_ERROR(33102, "投诉异常,请稍后重试"), + COMPLAINT_NOT_EXIT(33103, "当前投诉记录不存在"), + COMPLAINT_ARBITRATION_RESULT_ERROR(33104, "结束订单投诉时,仲裁结果不能为空"), + COMPLAINT_APPEAL_CONTENT_ERROR(33105, "商家申诉时,申诉内容不能为空"), + /** * 余额 */ WALLET_NOT_EXIT_ERROR(34000, "钱包不存在,请联系管理员"), - WALLET_INSUFFICIENT(34001, "余额不足以支付订单,请充值!"), - WALLET_WITHDRAWAL_INSUFFICIENT(34002, "可提现金额不足!"), - WALLET_ERROR_INSUFFICIENT(34003, "零钱提现失败!"), - WALLET_REMARK_ERROR(34004, "请填写审核备注!"), - WALLET_APPLY_ERROR(34005, "提现申请异常!"), /** @@ -300,62 +227,68 @@ public enum ResultCode { EVALUATION_DOUBLE_ERROR(35001, "无法重复提交评价"), /** - * 签到 + * 活动 */ - MEMBER_SIGN_REPEAT(40001, "请勿重复签到"), + PROMOTION_GOODS_NOT_EXIT(40001, "当前促销商品不存在!"), + PROMOTION_SAME_ACTIVE_EXIST(40002,"当前时间内已存在同类活动"), + PROMOTION_START_TIME_ERROR(40003,"活动起始时间不能大于活动结束时间"), + PROMOTION_TIME_ERROR(40004,"活动起始时间必须大于当前时间"), + PROMOTION_SAME_ERROR(40005,"当前时间段已存在相同活动!"), + PROMOTION_GOODS_ERROR(40006,"请选择要参与活动的商品"), + PROMOTION_STATUS_END(40007,"当前活动已停止"), + PROMOTION_UPDATE_ERROR(40008,"当前活动已开始/结束,无法编辑!"), /** * 优惠券 */ COUPON_EDIT_STATUS_SUCCESS(41001, "修改状态成功!"), - COUPON_CANCELLATION_SUCCESS(41002, "会员优惠券作废成功"), - COUPON_EXPIRED(41003, "优惠券已使用/已过期,不能使用"), - COUPON_EDIT_STATUS_ERROR(41004, "优惠券修改状态失败!"), - COUPON_RECEIVE_ERROR(41005, "当前优惠券状态不可领取"), - COUPON_NUM_INSUFFICIENT_ERROR(41006, "优惠券剩余领取数量不足"), - COUPON_NOT_EXIST(41007, "当前优惠券不存在"), + COUPON_LIMIT_NUM_LESS_THAN_0(41008, "领取限制数量不能为负数"), + COUPON_LIMIT_GREATER_THAN_PUBLISH(41009, "领取限制数量超出发行数量"), + COUPON_DISCOUNT_ERROR(41010, "优惠券折扣必须小于10且大于0"), + COUPON_SCOPE_TYPE_GOODS_ERROR(41011, "当前关联范围类型为指定商品时,商品列表不能为空"), + COUPON_SCOPE_TYPE_CATEGORY_ERROR(41012, "当前关联范围类型为部分商品分类时,范围关联的id不能为空"), + COUPON_SCOPE_TYPE_STORE_ERROR(41013, "当前关联范围类型为部分店铺分类时,范围关联的id不能为空"), + COUPON_SCOPE_ERROR(41014, "指定商品范围关联id无效!"), + COUPON_MEMBER_NOT_EXIST(41015, "没有当前会员优惠券"), + COUPON_MEMBER_STATUS_ERROR(41016, "当前会员优惠券已过期/作废无法变更状态!"), + /** * 拼团 */ PINTUAN_MANUAL_OPEN_SUCCESS(42001, "手动开启拼团活动成功"), - PINTUAN_MANUAL_CLOSE_SUCCESS(42002, "手动关闭拼团活动成功"), - PINTUAN_ADD_SUCCESS(42003, "添加拼团活动成功"), - PINTUAN_EDIT_SUCCESS(42004, "修改拼团活动成功"), - PINTUAN_DELETE_SUCCESS(42005, "删除拼团活动成功"), - PINTUAN_MANUAL_OPEN_ERROR(42006, "手动开启拼团活动失败"), - PINTUAN_MANUAL_CLOSE_ERROR(42007, "手动关闭拼团活动失败"), - PINTUAN_ADD_ERROR(42008, "添加拼团活动失败"), - PINTUAN_EDIT_ERROR(42009, "修改拼团活动失败"), - PINTUAN_DELETE_ERROR(42010, "删除拼团活动失败"), - PINTUAN_JOIN_ERROR(42011, "不能参与自己发起的拼团活动!"), - PINTUAN_LIMIT_NUM_ERROR(42012, "购买数量超过拼团活动限制数量!"), + PINTUAN_NOT_EXIST_ERROR(42013,"当前拼团商品不存在!"), /** * 满额活动 */ FULL_DISCOUNT_EDIT_SUCCESS(43001, "修改满优惠活动成功"), - FULL_DISCOUNT_EDIT_DELETE(43002, "删除满优惠活动成功"), - FULL_DISCOUNT_MODIFY_ERROR(43003,"当前编辑的满优惠活动已经开始或者已经结束,无法修改"), + FULL_DISCOUNT_NOT_EXIST_ERROR(43004,"当前要操作的满优惠活动不存在!"), + FULL_DISCOUNT_WAY_ERROR(43005,"请选择一种优惠方式!"), + FULL_DISCOUNT_GIFT_ERROR(43006,"请选择赠品!"), + FULL_DISCOUNT_COUPON_TIME_ERROR(43007,"赠送的优惠券有效时间必须大于活动时间"), + FULL_DISCOUNT_MONEY_ERROR(43008,"请填写满减金额"), + FULL_DISCOUNT_MONEY_GREATER_THAN_MINUS(43009,"满减金额不能大于优惠门槛"), + FULL_RATE_NUM_ERROR(43010,"请填写打折数值"), /** * 直播 @@ -370,6 +303,8 @@ public enum ResultCode { SECKILL_UPDATE_ERROR(45002,"当前秒杀活动活动已经开始,无法修改!"), SECKILL_PRICE_ERROR(45003,"活动价格不能大于商品原价"), SECKILL_TIME_ERROR(45004,"时刻参数异常"), + SECKILL_DELETE_ERROR(45005,"该秒杀活动活动的状态不能删除"), + SECKILL_CLOSE_ERROR(45006,"该秒杀活动活动的状态不能关闭"), /** @@ -381,40 +316,36 @@ public enum ResultCode { COUPON_ACTIVITY_ITEM_MUST_NUM_ERROR(46004,"优惠券活动最多指定10个优惠券"), COUPON_ACTIVITY_ITEM_NUM_ERROR(46005,"赠券数量必须大于0"), + /** + * 其他促销 + */ + MEMBER_SIGN_REPEAT(47001, "请勿重复签到"), + POINT_GOODS_ACTIVE_STOCK_ERROR(47002, "活动库存数量不能高于商品库存"), /** * 店铺 */ STORE_NOT_EXIST(50001, "此店铺不存在"), - STORE_NAME_EXIST_ERROR(50002, "店铺名称已存在!"), - STORE_APPLY_DOUBLE_ERROR(50003, "已有店铺,无需重复申请!"), - STORE_NOT_OPEN(50004, "该会员未开通店铺"), + STORE_NOT_LOGIN_ERROR(50005, "未登录店铺"), /** * 结算单 */ BILL_CHECK_ERROR(51001, "只有已出账结算单可以核对"), - BILL_COMPLETE_ERROR(51002, "只有已审核结算单可以支付"), /** * 文章 */ ARTICLE_CATEGORY_NAME_EXIST(60001, "文章分类名称已存在"), - ARTICLE_CATEGORY_PARENT_NOT_EXIST(60002, "文章分类父分类不存在"), - ARTICLE_CATEGORY_BEYOND_TWO(60003, "最多为二级分类,操作失败"), - ARTICLE_CATEGORY_DELETE_ERROR(60004, "该文章分类下存在子分类,不能删除"), - ARTICLE_CATEGORY_HAS_ARTICLE(60005, "该文章分类下存在文章,不能删除"), - ARTICLE_CATEGORY_NO_DELETION(60007, "默认文章分类不能进行删除"), - ARTICLE_NO_DELETION(60008, "默认文章不能进行删除"), @@ -422,79 +353,66 @@ public enum ResultCode { * 页面 */ PAGE_NOT_EXIST(61001, "页面不存在"), - PAGE_OPEN_DELETE_ERROR(61002, "当前页面为开启状态,无法删除"), - PAGE_DELETE_ERROR(61003, "当前页面为唯一页面,无法删除"), - PAGE_RELEASE_ERROR(61004, "页面已发布,无需重复提交"), /** * 设置 */ SETTING_NOT_TO_SET(70001, "该参数不需要设置"), - ALIPAY_NOT_SETTING(70002, "支付宝支付未配置"), - ALIPAY_EXCEPTION(70003, "支付宝支付错误,请稍后重试"), - ALIPAY_PARAMS_EXCEPTION(70004, "支付宝参数异常"), - LOGISTICS_NOT_SETTING(70005,"您还未配置快递查询"), - ORDER_SETTING_ERROR(70006,"系统订单配置异常"), - ALI_SMS_SETTING_ERROR(70007,"您还未配置阿里云短信"), - SMS_SIGN_EXIST_ERROR(70008, "短信签名已存在"), /** * 站内信 */ NOTICE_NOT_EXIST(80001, "当前消息模板不存在"), - NOTICE_ERROR(80002, "修改站内信异常,请稍后重试"), + NOTICE_SEND_ERROR(80003, "发送站内信异常,请检查系统日志"), + /** * OSS */ OSS_NOT_EXIST(80101, "OSS未配置"), - - OSS_EXCEPTION(80102, "文件上传失败,请稍后重试"), + OSS_EXCEPTION_ERROR(80102, "文件上传失败,请稍后重试"), + OSS_DELETE_ERROR(80102, "图片删除失败"), /** * 验证码 */ VERIFICATION_SEND_SUCCESS(80201, "短信验证码,发送成功"), - VERIFICATION_ERROR(80202, "验证失败"), - VERIFICATION_SMS_ERROR(80203, "短信验证码错误,请重新校验"), - VERIFICATION_SMS_EXPIRED_ERROR(80204, "验证码已失效,请重新校验"), /** * 微信相关异常 */ WECHAT_CONNECT_NOT_SETTING(80300, "微信联合登陆信息未配置"), - WECHAT_PAYMENT_NOT_SETTING(80301, "微信支付信息未配置"), - WECHAT_QRCODE_ERROR(80302, "微信二维码生成异常"), - WECHAT_MP_MESSAGE_ERROR(80303, "微信小程序小消息订阅异常"), - WECHAT_JSAPI_SIGN_ERROR(80304,"微信JsApi签名异常"), + WECHAT_CERT_ERROR(80305,"证书获取失败"), + WECHAT_MP_MESSAGE_TMPL_ERROR(80306,"未能获取到微信模版消息id"), + WECHAT_ERROR(80307,"微信接口异常"), + APP_VERSION_EXIST(80307, "APP版本已存在"), - WECHAT_CERT_ERROR(80505,"证书获取失败"), - - APP_VERSION_EXIST(80600, "APP版本已存在"), - + /** + * 其他 + */ CUSTOM_WORDS_EXIST_ERROR(90000, "当前自定义分词已存在!"), - CUSTOM_WORDS_NOT_EXIST_ERROR(90000, "当前自定义分词不存在!"), + CUSTOM_WORDS_NOT_EXIST_ERROR(90001, "当前自定义分词不存在!"), + CUSTOM_WORDS_SECRET_KEY_ERROR(90002, "秘钥验证失败!"), CONNECT_NOT_EXIST(90000,"登录方式不存在"), - ; private final Integer code; diff --git a/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java b/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java index 4976dafe..e9aa36f5 100644 --- a/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java @@ -108,7 +108,7 @@ public class ConnectServiceImpl extends ServiceImpl impl CookieUtil.addCookie(CONNECT_TYPE, type, 1800, ThreadContextHolder.getHttpResponse()); //自动登录失败,则把信息缓存起来 cache.put(ConnectService.cacheKey(type, uuid), authUser, 30L, TimeUnit.MINUTES); - throw new ServiceException(ResultCode.NOT_BINDING_USER); + throw new ServiceException(ResultCode.USER_NOT_BINDING); } } catch (Exception e) { log.error("联合登陆异常:", e); diff --git a/framework/src/main/java/cn/lili/modules/distribution/service/DistributionSelectedGoodsService.java b/framework/src/main/java/cn/lili/modules/distribution/service/DistributionSelectedGoodsService.java index 3912291d..994d5d8a 100644 --- a/framework/src/main/java/cn/lili/modules/distribution/service/DistributionSelectedGoodsService.java +++ b/framework/src/main/java/cn/lili/modules/distribution/service/DistributionSelectedGoodsService.java @@ -16,4 +16,11 @@ public interface DistributionSelectedGoodsService extends IService() + .eq(DistributionSelectedGoods::getDistributionGoodsId,distributionGoodsId) + .eq(DistributionSelectedGoods::getDistributionId,distributionId)); + } } diff --git a/framework/src/main/java/cn/lili/modules/file/plugin/impl/AliFileManagerPlugin.java b/framework/src/main/java/cn/lili/modules/file/plugin/impl/AliFileManagerPlugin.java index cbcfba6a..a189b8f2 100644 --- a/framework/src/main/java/cn/lili/modules/file/plugin/impl/AliFileManagerPlugin.java +++ b/framework/src/main/java/cn/lili/modules/file/plugin/impl/AliFileManagerPlugin.java @@ -1,6 +1,7 @@ package cn.lili.modules.file.plugin.impl; import cn.hutool.core.util.StrUtil; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.modules.file.plugin.FileManagerPlugin; import cn.lili.modules.system.entity.dos.Setting; @@ -76,7 +77,7 @@ public class AliFileManagerPlugin implements FileManagerPlugin { if (ossSetting == null || nextInitSetting == null || nextInitSetting < System.currentTimeMillis()) { Setting setting = settingService.get(SettingEnum.OSS_SETTING.name()); if (setting == null || StrUtil.isBlank(setting.getSettingValue())) { - throw new ServiceException("您还未配置阿里云OSS存储"); + throw new ServiceException(ResultCode.OSS_NOT_EXIST); } nextInitSetting = System.currentTimeMillis() + interval; ossSetting = new Gson().fromJson(setting.getSettingValue(), OssSetting.class); @@ -107,13 +108,13 @@ public class AliFileManagerPlugin implements FileManagerPlugin { log.error("Error Code: " + oe.getErrorCode()); log.error("Request ID: " + oe.getRequestId()); log.error("Host ID: " + oe.getHostId()); - throw new ServiceException("图片上传失败" + oe.getErrorMessage()); + throw new ServiceException(ResultCode.OSS_EXCEPTION_ERROR); } catch (ClientException ce) { log.error("Caught an ClientException, which means the client encountered " + "a serious internal problem while trying to communicate with OSS, " + "such as not being able to access the network."); log.error("Error Message: " + ce.getMessage()); - throw new ServiceException("图片上传失败" + ce.getErrorMessage()); + throw new ServiceException(ResultCode.OSS_EXCEPTION_ERROR); } finally { /* * Do not forget to shut down the client finally to release all allocated resources. @@ -138,13 +139,13 @@ public class AliFileManagerPlugin implements FileManagerPlugin { log.error("Error Code: " + oe.getErrorCode()); log.error("Request ID: " + oe.getRequestId()); log.error("Host ID: " + oe.getHostId()); - throw new ServiceException("图片上传失败" + oe.getErrorMessage()); + throw new ServiceException(ResultCode.OSS_EXCEPTION_ERROR); } catch (ClientException ce) { log.error("Caught an ClientException, which means the client encountered " + "a serious internal problem while trying to communicate with OSS, " + "such as not being able to access the network."); log.error("Error Message: " + ce.getMessage()); - throw new ServiceException("图片上传失败" + ce.getErrorMessage()); + throw new ServiceException(ResultCode.OSS_EXCEPTION_ERROR); } finally { /* * Do not forget to shut down the client finally to release all allocated resources. @@ -169,13 +170,13 @@ public class AliFileManagerPlugin implements FileManagerPlugin { log.error("Error Code: " + oe.getErrorCode()); log.error("Request ID: " + oe.getRequestId()); log.error("Host ID: " + oe.getHostId()); - throw new ServiceException("图片删除失败" + oe.getErrorMessage()); + throw new ServiceException(ResultCode.OSS_DELETE_ERROR); } catch (ClientException ce) { log.error("Caught an ClientException, which means the client encountered " + "a serious internal problem while trying to communicate with OSS, " + "such as not being able to access the network."); log.error("Error Message: " + ce.getMessage()); - throw new ServiceException("图片删除失败" + ce.getErrorMessage()); + throw new ServiceException(ResultCode.OSS_DELETE_ERROR); } finally { /* * Do not forget to shut down the client finally to release all allocated resources. diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java index 6f350d1c..37907ce9 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/CategoryServiceImpl.java @@ -3,6 +3,7 @@ package cn.lili.modules.goods.serviceimpl; import cn.hutool.core.util.StrUtil; import cn.lili.common.cache.Cache; import cn.lili.common.cache.CachePrefix; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.modules.goods.entity.dos.Category; import cn.lili.modules.goods.entity.dos.CategoryParameterGroup; @@ -174,7 +175,7 @@ public class CategoryServiceImpl extends ServiceImpl i if (category.getParentId() != null && !category.getParentId().equals("0")) { Category parentCategory = this.getById(category.getParentId()); if (!parentCategory.getDeleteFlag().equals(category.getDeleteFlag())) { - throw new ServiceException("子类状态不能与父类不一致!"); + throw new ServiceException(ResultCode.CATEGORY_DELETE_FLAG_ERROR); } } UpdateWrapper updateWrapper = new UpdateWrapper<>(); diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java index 10bf49bf..86023b2b 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java @@ -395,16 +395,16 @@ public class GoodsServiceImpl extends ServiceImpl implements switch (goods.getGoodsType()) { case "PHYSICAL_GOODS": if (goods.getTemplateId().equals("0")) { - throw new ServiceException("实物商品需选择配送模板"); + throw new ServiceException(ResultCode.PHYSICAL_GOODS_NEED_TEMP); } break; case "VIRTUAL_GOODS": if (!goods.getTemplateId().equals("0")) { - throw new ServiceException("虚拟商品不需要选择配送模板"); + throw new ServiceException(ResultCode.VIRTUAL_GOODS_NOT_NEED_TEMP); } break; default: - throw new ServiceException("需选择商品类型"); + throw new ServiceException(ResultCode.GOODS_TYPE_ERROR); } //检查商品是否存在--修改商品时使用 if (goods.getId() != null) { @@ -435,7 +435,7 @@ public class GoodsServiceImpl extends ServiceImpl implements goods.setStoreName(storeDetail.getStoreName()); goods.setSelfOperated(storeDetail.getSelfOperated()); } else { - throw new ServiceException("当前未登录店铺"); + throw new ServiceException(ResultCode.STORE_NOT_LOGIN_ERROR); } } diff --git a/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberNoticeSenterServiceImpl.java b/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberNoticeSenterServiceImpl.java index 1b752381..3026fba6 100644 --- a/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberNoticeSenterServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberNoticeSenterServiceImpl.java @@ -1,5 +1,6 @@ package cn.lili.modules.member.serviceimpl; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.common.utils.StringUtils; import cn.lili.modules.member.entity.dos.MemberNoticeSenter; @@ -78,7 +79,7 @@ public class MemberNoticeSenterServiceImpl extends ServiceImpl impleme throw e; } catch (Exception e) { log.error("自动注册异常:", e); - throw new ServiceException("自动注册失败,请稍后重试"); + throw new ServiceException(ResultCode.USER_AUTO_REGISTER_ERROR); } } @@ -529,7 +529,7 @@ public class MemberServiceImpl extends ServiceImpl impleme ConnectAuthUser connectAuthUser = getConnectAuthUser(uuid, connectType); if (connectAuthUser == null) { - throw new ServiceException("授权信息已过期,请从新授权/登录"); + throw new ServiceException(ResultCode.USER_OVERDUE_CONNECT_ERROR); } //检测是否已经绑定过用户 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); @@ -541,13 +541,13 @@ public class MemberServiceImpl extends ServiceImpl impleme connectAuthUser.setConnectEnum(authInterface); return connectAuthUser; } else { - throw new ServiceException("当前联合登陆方式,已绑定其他账号,需进行解绑操作"); + throw new ServiceException(ResultCode.USER_CONNECT_BANDING_ERROR); } } catch (Exception e) { throw e; } } else { - throw new ServiceException("暂无联合登陆信息,无法实现一键注册功能,请点击第三方登录进行授权"); + throw new ServiceException(ResultCode.USER_CONNECT_NOT_EXIST_ERROR); } } diff --git a/framework/src/main/java/cn/lili/modules/message/serviceimpl/WechatMPMessageServiceImpl.java b/framework/src/main/java/cn/lili/modules/message/serviceimpl/WechatMPMessageServiceImpl.java index 9a37909a..f8fcd822 100644 --- a/framework/src/main/java/cn/lili/modules/message/serviceimpl/WechatMPMessageServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/message/serviceimpl/WechatMPMessageServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.modules.base.entity.enums.ClientTypeEnum; import cn.lili.modules.message.entity.dos.WechatMPMessage; @@ -114,7 +115,7 @@ public class WechatMPMessageServiceImpl extends ServiceImpl limitNum) { - throw new ServiceException("购买数量超过拼团活动限制数量"); + throw new ServiceException(ResultCode.PINTUAN_LIMIT_NUM_ERROR); } } } diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/AfterSaleServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/AfterSaleServiceImpl.java index 4c4e44a5..f9eb6744 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/AfterSaleServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/AfterSaleServiceImpl.java @@ -473,7 +473,7 @@ public class AfterSaleServiceImpl extends ServiceImpl implements orderBatchDeliverDTOList.add(orderBatchDeliverDTO); } } catch (Exception e) { - throw new ServiceException(ResultCode.BATCH_DELIVER_ERROR); + throw new ServiceException(ResultCode.ORDER_BATCH_DELIVER_ERROR); } //循环检查是否符合规范 checkBatchDeliver(orderBatchDeliverDTOList); diff --git a/framework/src/main/java/cn/lili/modules/page/entity/vos/ArticleCategoryVO.java b/framework/src/main/java/cn/lili/modules/page/entity/vos/ArticleCategoryVO.java index 9ca34f72..f6f0f901 100644 --- a/framework/src/main/java/cn/lili/modules/page/entity/vos/ArticleCategoryVO.java +++ b/framework/src/main/java/cn/lili/modules/page/entity/vos/ArticleCategoryVO.java @@ -34,6 +34,7 @@ public class ArticleCategoryVO extends ArticleCategory { children.sort(new Comparator() { @Override public int compare(ArticleCategoryVO o1, ArticleCategoryVO o2) { + System.out.println(o1.getArticleCategoryName()+":"+o2.getArticleCategoryName()); return o1.getSort().compareTo(o2.getSort()); } }); diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java index 14444691..1fd5bee2 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java @@ -1,6 +1,7 @@ package cn.lili.modules.promotion.serviceimpl; import cn.hutool.core.text.CharSequenceUtil; +import cn.lili.common.enums.ResultCode; import cn.lili.common.trigger.util.DelayQueueTools; import cn.lili.common.trigger.enums.DelayTypeEnums; import cn.lili.common.trigger.message.PromotionMessage; @@ -130,7 +131,7 @@ public class CouponServiceImpl extends ServiceImpl impleme List couponVOS = this.mongoTemplate.find(query, CouponVO.class); couponVOS = couponVOS.parallelStream().filter(i -> Boolean.FALSE.equals(i.getDeleteFlag())).collect(Collectors.toList()); if (couponVOS.isEmpty()) { - throw new ServiceException("优惠券不存在"); + throw new ServiceException(ResultCode.COUPON_NOT_EXIST); } for (CouponVO couponVO : couponVOS) { if (promotionStatus.name().equals(PromotionStatusEnum.START.name())) { @@ -282,23 +283,21 @@ public class CouponServiceImpl extends ServiceImpl impleme private void checkParam(CouponVO coupon) { if (coupon.getCouponLimitNum() < 0) { - throw new ServiceException("领取限制数量不能为负数"); + throw new ServiceException(ResultCode.COUPON_LIMIT_NUM_LESS_THAN_0); } //如果发行数量是0则判断领取限制数量 if (coupon.getPublishNum() != 0 && coupon.getCouponLimitNum() > coupon.getPublishNum()) { - throw new ServiceException("领取限制数量超出发行数量"); + throw new ServiceException(ResultCode.COUPON_LIMIT_GREATER_THAN_PUBLISH); } - if (coupon.getCouponType().equals(CouponTypeEnum.PRICE.name()) && coupon.getPrice() > coupon.getConsumeThreshold()) { - throw new ServiceException("优惠券面额必须小于优惠券消费限额"); - } else if (coupon.getCouponType().equals(CouponTypeEnum.DISCOUNT.name()) && (coupon.getCouponDiscount() < 0 && coupon.getCouponDiscount() > 10)) { - throw new ServiceException("优惠券折扣必须小于10且大于0"); + if (coupon.getCouponType().equals(CouponTypeEnum.DISCOUNT.name()) && (coupon.getCouponDiscount() < 0 && coupon.getCouponDiscount() > 10)) { + throw new ServiceException(ResultCode.COUPON_DISCOUNT_ERROR); } if (coupon.getRangeDayType() != null && coupon.getRangeDayType().equals(CouponRangeDayEnum.FIXEDTIME.name())) { long nowTime = DateUtil.getDateline() * 1000; if (coupon.getStartTime().getTime() < nowTime && coupon.getEndTime().getTime() > nowTime) { - throw new ServiceException("活动时间小于当前时间,不能进行编辑删除操作"); + throw new ServiceException(ResultCode.PROMOTION_TIME_ERROR); } PromotionTools.checkPromotionTime(coupon.getStartTime().getTime(), coupon.getEndTime().getTime()); @@ -316,24 +315,24 @@ public class CouponServiceImpl extends ServiceImpl impleme */ private void checkCouponScope(CouponVO coupon) { if (coupon.getScopeType().equals(CouponScopeTypeEnum.PORTION_GOODS.name()) && (coupon.getPromotionGoodsList() == null || coupon.getPromotionGoodsList().isEmpty())) { - throw new ServiceException("当前关联范围类型为指定商品时,商品列表不能为空"); + throw new ServiceException(ResultCode.COUPON_SCOPE_TYPE_GOODS_ERROR); } else if (coupon.getScopeType().equals(CouponScopeTypeEnum.PORTION_GOODS.name()) && CharSequenceUtil.isEmpty(coupon.getScopeId())) { - throw new ServiceException("当前关联范围类型为指定商品时,范围关联的id不能为空"); + throw new ServiceException(ResultCode.COUPON_SCOPE_TYPE_GOODS_ERROR); } else if (coupon.getScopeType().equals(CouponScopeTypeEnum.PORTION_GOODS_CATEGORY.name()) && CharSequenceUtil.isEmpty(coupon.getScopeId())) { - throw new ServiceException("当前关联范围类型为部分商品分类时,范围关联的id不能为空"); + throw new ServiceException(ResultCode.COUPON_SCOPE_TYPE_CATEGORY_ERROR); } else if (coupon.getScopeType().equals(CouponScopeTypeEnum.PORTION_SHOP_CATEGORY.name()) && CharSequenceUtil.isEmpty(coupon.getScopeId())) { - throw new ServiceException("当前关联范围类型为部分店铺分类时,范围关联的id不能为空"); + throw new ServiceException(ResultCode.COUPON_SCOPE_TYPE_STORE_ERROR); } if (coupon.getScopeType().equals(CouponScopeTypeEnum.PORTION_GOODS.name())) { String[] split = coupon.getScopeId().split(","); if (split.length <= 0) { - throw new ServiceException("指定商品范围关联id无效!"); + throw new ServiceException(ResultCode.COUPON_SCOPE_ERROR); } for (String id : split) { GoodsSku goodsSku = goodsSkuService.getGoodsSkuByIdFromCache(id); if (goodsSku == null) { - throw new ServiceException("商品已下架"); + throw new ServiceException(ResultCode.GOODS_NOT_EXIST); } } } @@ -375,7 +374,7 @@ public class CouponServiceImpl extends ServiceImpl impleme private CouponVO checkStatus(String id) { CouponVO coupon = this.mongoTemplate.findById(id, CouponVO.class); if (coupon == null) { - throw new ServiceException("当前优惠券活动不存在"); + throw new ServiceException(ResultCode.COUPON_NOT_EXIST); } LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(FullDiscount::getIsCoupon, true).eq(FullDiscount::getCouponId, id); FullDiscount fullDiscount = fullDiscountService.getOne(queryWrapper); diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/FullDiscountServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/FullDiscountServiceImpl.java index f60682df..404afe4a 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/FullDiscountServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/FullDiscountServiceImpl.java @@ -201,7 +201,7 @@ public class FullDiscountServiceImpl extends ServiceImpl queryWrapper = PromotionTools.checkActiveTime(statTime, endTime, PromotionTypeEnum.FULL_DISCOUNT, storeId, id); Integer sameNum = this.count(queryWrapper); if (sameNum > 0) { - throw new ServiceException("当前时间内已存在同类活动"); + throw new ServiceException(ResultCode.PROMOTION_SAME_ACTIVE_EXIST); } } @@ -267,11 +267,11 @@ public class FullDiscountServiceImpl extends ServiceImpl fullMoney) { - throw new ServiceException("满减金额不能大于优惠门槛"); + throw new ServiceException(ResultCode.FULL_DISCOUNT_MONEY_GREATER_THAN_MINUS); } } @@ -301,11 +301,11 @@ public class FullDiscountServiceImpl extends ServiceImpl= rateLimit || fullRate <= 0) { - throw new ServiceException("请填写打折数值"); + throw new ServiceException(ResultCode.FULL_RATE_NUM_ERROR); } } diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java index dbd32e5b..410caf25 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java @@ -164,7 +164,7 @@ public class MemberCouponServiceImpl extends ServiceImpl impl PintuanVO pintuanVO = mongoTemplate.findById(id, PintuanVO.class); if (pintuanVO == null) { log.error("拼团活动id[" + id + "]的拼团活动不存在!"); - throw new ServiceException("网络出现异常!"); + throw new ServiceException(ResultCode.ERROR); } return pintuanVO; } @@ -170,7 +171,7 @@ public class PintuanServiceImpl extends ServiceImpl impl Pintuan pintuan = this.getById(id); if (pintuan == null) { log.error("拼团活动id[" + id + "]的拼团活动不存在!"); - throw new ServiceException("网络出现异常!"); + throw new ServiceException(ResultCode.ERROR); } return pintuan; } @@ -204,7 +205,7 @@ public class PintuanServiceImpl extends ServiceImpl impl public boolean modifyPintuan(PintuanVO pintuan) { PintuanVO pintuanVO = this.checkExist(pintuan.getId()); if (!pintuan.getPromotionStatus().equals(PromotionStatusEnum.NEW.name())) { - throw new ServiceException("只有活动状态为新活动时(活动未开始)才可编辑!"); + throw new ServiceException(ResultCode.PINTUAN_EDIT_ERROR); } //检查促销时间 PromotionTools.checkPromotionTime(pintuan.getStartTime().getTime(), pintuan.getEndTime().getTime()); @@ -358,7 +359,7 @@ public class PintuanServiceImpl extends ServiceImpl impl memberVO.setOrderSn(""); PromotionGoods promotionGoods = promotionGoodsService.getPromotionGoods(PromotionTypeEnum.PINTUAN, order.getPromotionId(), skuId); if (promotionGoods == null) { - throw new ServiceException("当前拼团商品不存在!"); + throw new ServiceException(ResultCode.PINTUAN_NOT_EXIST_ERROR); } pintuanShareVO.setPromotionGoods(promotionGoods); Pintuan pintuanById = this.getPintuanById(order.getPromotionId()); @@ -381,7 +382,7 @@ public class PintuanServiceImpl extends ServiceImpl impl QueryWrapper queryWrapper = PromotionTools.checkActiveTime(startTime, endTime, PromotionTypeEnum.PINTUAN, storeId, pintuanId); List list = this.list(queryWrapper); if (!list.isEmpty()) { - throw new ServiceException("当前时间段已存在相同活动!"); + throw new ServiceException(ResultCode.PROMOTION_SAME_ERROR); } } @@ -484,7 +485,7 @@ public class PintuanServiceImpl extends ServiceImpl impl private PintuanVO checkExist(String pintuanId) { PintuanVO pintuan = mongoTemplate.findById(pintuanId, PintuanVO.class); if (pintuan == null) { - throw new ServiceException("当前拼团活动不存在!"); + throw new ServiceException(ResultCode.PINTUAN_NOT_EXIST_ERROR); } return pintuan; } diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PointsGoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PointsGoodsServiceImpl.java index cd7273eb..042213c3 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PointsGoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PointsGoodsServiceImpl.java @@ -1,6 +1,7 @@ package cn.lili.modules.promotion.serviceimpl; import cn.hutool.core.util.StrUtil; +import cn.lili.common.enums.ResultCode; import cn.lili.common.trigger.util.DelayQueueTools; import cn.lili.common.trigger.enums.DelayTypeEnums; import cn.lili.common.trigger.message.PromotionMessage; @@ -108,7 +109,7 @@ public class PointsGoodsServiceImpl extends ServiceImpl goodsSku.getQuantity()) { - throw new ServiceException("活动库存数量不能高于商品库存"); + throw new ServiceException(ResultCode.POINT_GOODS_ACTIVE_STOCK_ERROR); } } } diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java index 2590e8e2..b9993dda 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionGoodsServiceImpl.java @@ -2,6 +2,7 @@ package cn.lili.modules.promotion.serviceimpl; import cn.hutool.core.convert.Convert; import cn.hutool.core.text.CharSequenceUtil; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.common.utils.BeanUtil; import cn.lili.common.utils.DateUtil; @@ -270,7 +271,7 @@ public class PromotionGoodsServiceImpl extends ServiceImpl updateWrapper = new LambdaUpdateWrapper<>(); updateWrapper.eq(SeckillApply::getSeckillId, promotionId).eq(SeckillApply::getSkuId, skuId); diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionServiceImpl.java index 4335286d..1a3aeedb 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionServiceImpl.java @@ -3,6 +3,7 @@ package cn.lili.modules.promotion.serviceimpl; import cn.hutool.core.date.DateTime; import cn.hutool.core.util.ObjectUtil; import cn.hutool.json.JSONUtil; +import cn.lili.common.enums.ResultCode; import cn.lili.common.trigger.message.PromotionMessage; import cn.lili.common.exception.ServiceException; import cn.lili.common.utils.DateUtil; @@ -452,6 +453,6 @@ public class PromotionServiceImpl implements PromotionService { */ private void throwPromotionException(PromotionTypeEnum type, String id, String status) { log.error("当前" + type.name() + "活动ID为[" + id + "] 不存在,更改活动状态至[ " + status + " ]失败!"); - throw new ServiceException("当前活动已停止"); + throw new ServiceException(ResultCode.PROMOTION_STATUS_END); } } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillServiceImpl.java index 1a602c84..6faa260d 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillServiceImpl.java @@ -1,5 +1,6 @@ package cn.lili.modules.promotion.serviceimpl; +import cn.lili.common.enums.ResultCode; import cn.lili.common.trigger.util.DelayQueueTools; import cn.lili.common.trigger.enums.DelayTypeEnums; import cn.lili.common.trigger.message.PromotionMessage; @@ -153,7 +154,7 @@ public class SeckillServiceImpl extends ServiceImpl impl //检查该秒杀活动是否存在 SeckillVO seckill = checkSeckillExist(seckillVO.getId()); if (PromotionStatusEnum.START.name().equals(seckillVO.getPromotionStatus())) { - throw new ServiceException("活动已经开始,不能进行编辑删除操作"); + throw new ServiceException(ResultCode.PROMOTION_UPDATE_ERROR); } //检查秒杀活动参数 this.checkSeckillParam(seckillVO, seckillVO.getStoreId()); @@ -193,7 +194,7 @@ public class SeckillServiceImpl extends ServiceImpl impl DelayQueueTools.wrapperUniqueKey(DelayTypeEnums.PROMOTION, (PromotionTypeEnum.SECKILL.name() + seckill.getId())), rocketmqCustomProperties.getPromotionTopic()); } else { - throw new ServiceException("该秒杀活动活动的状态不能删除"); + throw new ServiceException(ResultCode.SECKILL_DELETE_ERROR); } } @@ -237,7 +238,7 @@ public class SeckillServiceImpl extends ServiceImpl impl rocketmqCustomProperties.getPromotionTopic()); } } else { - throw new ServiceException("该秒杀活动活动的状态不能关闭"); + throw new ServiceException(ResultCode.SECKILL_CLOSE_ERROR); } } @@ -279,7 +280,7 @@ public class SeckillServiceImpl extends ServiceImpl impl private SeckillVO checkSeckillExist(String id) { SeckillVO seckill = this.mongoTemplate.findById(id, SeckillVO.class); if (seckill == null) { - throw new ServiceException("当前秒杀活动活动不存在"); + throw new ServiceException(ResultCode.SECKILL_NOT_EXIST_ERROR); } return seckill; } diff --git a/framework/src/main/java/cn/lili/modules/promotion/tools/PromotionTools.java b/framework/src/main/java/cn/lili/modules/promotion/tools/PromotionTools.java index 713eec95..d9d9f27e 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/tools/PromotionTools.java +++ b/framework/src/main/java/cn/lili/modules/promotion/tools/PromotionTools.java @@ -1,6 +1,7 @@ package cn.lili.modules.promotion.tools; import cn.hutool.core.text.CharSequenceUtil; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.common.utils.DateUtil; import cn.lili.common.vo.PageVO; @@ -41,7 +42,7 @@ public class PromotionTools { //如果促销活动选择的是部分商品参加活动 if (num != -1 && goodsList == null) { - throw new ServiceException("请选择要参与活动的商品"); + throw new ServiceException(ResultCode.PROMOTION_GOODS_ERROR); } } @@ -59,12 +60,12 @@ public class PromotionTools { //如果活动起始时间小于现在时间 if (startTime < nowTime) { - throw new ServiceException("活动起始时间必须大于当前时间"); + throw new ServiceException(ResultCode.PROMOTION_START_TIME_ERROR); } //开始时间不能大于结束时间 if (startTime > endTime) { - throw new ServiceException("活动起始时间不能大于活动结束时间"); + throw new ServiceException(ResultCode.PROMOTION_TIME_ERROR); } } diff --git a/manager-api/src/main/java/cn/lili/controller/other/CustomWordsController.java b/manager-api/src/main/java/cn/lili/controller/other/CustomWordsController.java index aa300078..7c439a15 100644 --- a/manager-api/src/main/java/cn/lili/controller/other/CustomWordsController.java +++ b/manager-api/src/main/java/cn/lili/controller/other/CustomWordsController.java @@ -1,5 +1,6 @@ package cn.lili.controller.other; +import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.common.utils.StringUtils; import cn.lili.modules.permission.SettingKeys; @@ -49,7 +50,7 @@ public class CustomWordsController { } if (!setting.getSettingValue().equals(secretKey)) { - throw new ServiceException("秘钥验证失败!"); + throw new ServiceException(ResultCode.CUSTOM_WORDS_SECRET_KEY_ERROR); } String res = customWordsService.deploy(); diff --git a/manager-api/src/main/java/cn/lili/controller/promotion/CouponManagerController.java b/manager-api/src/main/java/cn/lili/controller/promotion/CouponManagerController.java index cdc4ec46..69ac05ba 100644 --- a/manager-api/src/main/java/cn/lili/controller/promotion/CouponManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/promotion/CouponManagerController.java @@ -112,7 +112,7 @@ public class CouponManagerController { private void setStoreInfo(CouponVO couponVO) { AuthUser currentUser = UserContext.getCurrentUser(); if (currentUser == null) { - throw new ServiceException("获取当前用户信息不存在"); + throw new ServiceException(ResultCode.USER_NOT_EXIST); } couponVO.setStoreId("platform"); couponVO.setStoreName("platform"); From 92c3c21e32f14819cc919b9961a0b02a8cbd8ba1 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Thu, 1 Jul 2021 14:31:33 +0800 Subject: [PATCH 22/23] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=A0=E9=99=A4?= =?UTF-8?q?=EF=BC=8C=E5=88=A0=E9=99=A4=E5=88=86=E9=94=80=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lili/listener/GoodsMessageListener.java | 112 +++++++++++++----- .../entity/dos/DistributionSelectedGoods.java | 2 +- .../goods/serviceimpl/GoodsServiceImpl.java | 2 +- .../serviceimpl/GoodsSkuServiceImpl.java | 4 +- update-sql/version4.1to4.2.sql | 3 + 5 files changed, 88 insertions(+), 35 deletions(-) diff --git a/consumer/src/main/java/cn/lili/listener/GoodsMessageListener.java b/consumer/src/main/java/cn/lili/listener/GoodsMessageListener.java index fa4132d0..16dd44dc 100644 --- a/consumer/src/main/java/cn/lili/listener/GoodsMessageListener.java +++ b/consumer/src/main/java/cn/lili/listener/GoodsMessageListener.java @@ -3,6 +3,10 @@ package cn.lili.listener; import cn.hutool.json.JSONUtil; import cn.lili.common.rocketmq.tags.GoodsTagsEnum; import cn.lili.event.GoodsCommentCompleteEvent; +import cn.lili.modules.distribution.entity.dos.DistributionGoods; +import cn.lili.modules.distribution.entity.dos.DistributionSelectedGoods; +import cn.lili.modules.distribution.service.DistributionGoodsService; +import cn.lili.modules.distribution.service.DistributionSelectedGoodsService; import cn.lili.modules.goods.entity.dos.Goods; import cn.lili.modules.goods.entity.dos.GoodsSku; import cn.lili.modules.goods.entity.dto.GoodsCompleteMessage; @@ -15,6 +19,8 @@ import cn.lili.modules.member.service.GoodsCollectionService; 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.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import lombok.extern.slf4j.Slf4j; import org.apache.rocketmq.common.message.MessageExt; @@ -57,6 +63,13 @@ public class GoodsMessageListener implements RocketMQListener { //商品评价 @Autowired private List goodsCommentCompleteEvents; + //分销商品 + @Autowired + private DistributionGoodsService distributionGoodsService; + //分销员-商品关联表 + @Autowired + private DistributionSelectedGoodsService distributionSelectedGoodsService; + @Override public void onMessage(MessageExt messageExt) { @@ -77,9 +90,10 @@ public class GoodsMessageListener implements RocketMQListener { break; //审核商品 case GOODS_AUDIT: + break; //删除商品 case GOODS_DELETE: - storeService.updateStoreGoodsNum(new String(messageExt.getBody())); + deleteGoods(messageExt); break; //规格删除 case SKU_DELETE: @@ -107,38 +121,72 @@ public class GoodsMessageListener implements RocketMQListener { break; //购买商品完成 case BUY_GOODS_COMPLETE: - String goodsCompleteMessageStr = new String(messageExt.getBody()); - List goodsCompleteMessageList = JSONUtil.toList(JSONUtil.parseArray(goodsCompleteMessageStr), GoodsCompleteMessage.class); - for (GoodsCompleteMessage goodsCompleteMessage : goodsCompleteMessageList) { - Goods goods = goodsService.getById(goodsCompleteMessage.getGoodsId()); - if (goods != null) { - //更新商品购买数量 - if (goods.getBuyCount() == null) { - goods.setBuyCount(0); - } - int buyCount = goods.getBuyCount() + goodsCompleteMessage.getBuyNum(); - LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.eq(Goods::getId, goodsCompleteMessage.getGoodsId()); - updateWrapper.set(Goods::getBuyCount, buyCount); - goodsService.update(updateWrapper); - } else { - log.error("商品Id为[" + goodsCompleteMessage.getGoodsId() + "的商品不存在,更新商品失败!"); - } - GoodsSku goodsSku = goodsSkuService.getById(goodsCompleteMessage.getSkuId()); - if (goodsSku != null) { - //更新商品购买数量 - if (goodsSku.getBuyCount() == null) { - goodsSku.setBuyCount(0); - } - int buyCount = goodsSku.getBuyCount() + goodsCompleteMessage.getBuyNum(); - goodsSku.setBuyCount(buyCount); - goodsSkuService.update(goodsSku); - goodsIndexService.updateIndexBuyNum(goodsCompleteMessage.getSkuId(), buyCount); - } else { - log.error("商品SkuId为[" + goodsCompleteMessage.getGoodsId() + "的商品不存在,更新商品失败!"); - } - } + this.goodsBuyComplete(messageExt); break; } } + + /** + * 删除商品 + * 1.更新店铺的商品数量 + * 2.删除分销员-分销商品绑定关系 + * 3.删除分销商品 + * @param messageExt 消息 + */ + private void deleteGoods(MessageExt messageExt){ + Goods goods=JSONUtil.toBean(new String(messageExt.getBody()),Goods.class); + //更新店铺商品数量 + storeService.updateStoreGoodsNum(goods.getStoreId()); + + //删除获取分销商品 + DistributionGoods distributionGoods=distributionGoodsService.getOne(new LambdaQueryWrapper() + .eq(DistributionGoods::getGoodsId,goods.getId())); + + //删除分销商品绑定关系 + distributionSelectedGoodsService.remove(new LambdaQueryWrapper() + .eq(DistributionSelectedGoods::getDistributionGoodsId,distributionGoods.getId())); + + //删除分销商品 + distributionGoodsService.removeById(distributionGoods.getId()); + } + + /** + * 商品购买完成 + * 1.更新商品购买数量 + * 2.更新SKU购买数量 + * 3.更新索引购买数量 + * @param messageExt + */ + private void goodsBuyComplete(MessageExt messageExt){ + String goodsCompleteMessageStr = new String(messageExt.getBody()); + List goodsCompleteMessageList = JSONUtil.toList(JSONUtil.parseArray(goodsCompleteMessageStr), GoodsCompleteMessage.class); + for (GoodsCompleteMessage goodsCompleteMessage : goodsCompleteMessageList) { + Goods goods = goodsService.getById(goodsCompleteMessage.getGoodsId()); + if (goods != null) { + //更新商品购买数量 + if (goods.getBuyCount() == null) { + goods.setBuyCount(0); + } + int buyCount = goods.getBuyCount() + goodsCompleteMessage.getBuyNum(); + goodsService.update(new LambdaUpdateWrapper() + .eq(Goods::getId, goodsCompleteMessage.getGoodsId()) + .set(Goods::getBuyCount, buyCount)); + } else { + log.error("商品Id为[" + goodsCompleteMessage.getGoodsId() + "的商品不存在,更新商品失败!"); + } + GoodsSku goodsSku = goodsSkuService.getById(goodsCompleteMessage.getSkuId()); + if (goodsSku != null) { + //更新商品购买数量 + if (goodsSku.getBuyCount() == null) { + goodsSku.setBuyCount(0); + } + int buyCount = goodsSku.getBuyCount() + goodsCompleteMessage.getBuyNum(); + goodsSku.setBuyCount(buyCount); + goodsSkuService.update(goodsSku); + goodsIndexService.updateIndexBuyNum(goodsCompleteMessage.getSkuId(), buyCount); + } else { + log.error("商品SkuId为[" + goodsCompleteMessage.getGoodsId() + "的商品不存在,更新商品失败!"); + } + } + } } diff --git a/framework/src/main/java/cn/lili/modules/distribution/entity/dos/DistributionSelectedGoods.java b/framework/src/main/java/cn/lili/modules/distribution/entity/dos/DistributionSelectedGoods.java index 5174ad08..620f6e90 100644 --- a/framework/src/main/java/cn/lili/modules/distribution/entity/dos/DistributionSelectedGoods.java +++ b/framework/src/main/java/cn/lili/modules/distribution/entity/dos/DistributionSelectedGoods.java @@ -38,7 +38,7 @@ public class DistributionSelectedGoods { @ApiModelProperty(value = "分销员ID") private String distributionId; - @ApiModelProperty(value = "分销员品ID") + @ApiModelProperty(value = "分销商品ID") private String distributionGoodsId; public DistributionSelectedGoods(String distributionId, String distributionGoodsId) { diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java index 86023b2b..9b15e69d 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java @@ -279,7 +279,7 @@ public class GoodsServiceImpl extends ServiceImpl implements //商品删除消息 String destination = rocketmqCustomProperties.getGoodsTopic() + ":" + GoodsTagsEnum.GOODS_DELETE.name(); //发送mq消息 - rocketMQTemplate.asyncSend(destination, JSONUtil.toJsonStr(goods.getStoreId()), RocketmqSendCallbackBuilder.commonCallback()); + rocketMQTemplate.asyncSend(destination, JSONUtil.toJsonStr(goods), RocketmqSendCallbackBuilder.commonCallback()); } return true; diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java index 153dba54..cd9dabe1 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java @@ -455,7 +455,9 @@ public class GoodsSkuServiceImpl extends ServiceImpl i private void generateEsCheck(Goods goods) { //如果商品通过审核&&并且已上架 List goodsSkuList = this.list(new LambdaQueryWrapper().eq(GoodsSku::getGoodsId, goods.getId())); - if (goods.getIsAuth().equals(GoodsAuthEnum.PASS.name()) && goods.getMarketEnable().equals(GoodsStatusEnum.UPPER.name()) && Boolean.FALSE.equals(goods.getDeleteFlag())) { + if (goods.getIsAuth().equals(GoodsAuthEnum.PASS.name()) + && goods.getMarketEnable().equals(GoodsStatusEnum.UPPER.name()) + && Boolean.FALSE.equals(goods.getDeleteFlag())) { List goodsIndices = new ArrayList<>(); for (GoodsSku goodsSku : goodsSkuList) { EsGoodsIndex esGoodsOld = goodsIndexService.findById(goodsSku.getId()); diff --git a/update-sql/version4.1to4.2.sql b/update-sql/version4.1to4.2.sql index f5f7ae33..40296ccc 100644 --- a/update-sql/version4.1to4.2.sql +++ b/update-sql/version4.1to4.2.sql @@ -2,3 +2,6 @@ ALTER TABLE li_distribution ADD settlement_bank_account_name varchar ( 200 ); ALTER TABLE li_distribution ADD settlement_bank_account_num varchar ( 200 ); ALTER TABLE li_distribution ADD settlement_bank_branch_name varchar ( 200 ); + +/** 文章分类添加默认值**/ +ALTER TABLE li_article_category alter column sort set default 0; \ No newline at end of file From eedea676aa3eff5c861e2dd72b984e2f1850fa8f Mon Sep 17 00:00:00 2001 From: lifenlong Date: Thu, 1 Jul 2021 17:06:13 +0800 Subject: [PATCH 23/23] =?UTF-8?q?=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java index cd9dabe1..e6361cd3 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java @@ -226,6 +226,11 @@ public class GoodsSkuServiceImpl extends ServiceImpl i map.put("specs", this.groupBySkuAndSpec(goodsSkuDetail.getGoodsId())); map.put("promotionMap", goodsIndex.getPromotionMap()); + //获取参数信息 + if(goodsVO.getGoodsParamsDTOList().size()>0){ + map.put("goodsParamsDTOList",goodsVO.getGoodsParamsDTOList()); + } + //记录用户足迹 if (UserContext.getCurrentUser() != null) { FootPrint footPrint = new FootPrint(UserContext.getCurrentUser().getId(), goodsId, skuId);