From cdfdf483d6840c692e6ff8cd710fe2ac6656b1c9 Mon Sep 17 00:00:00 2001 From: Chopper Date: Fri, 27 Aug 2021 16:25:37 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=97=B6=EF=BC=8C=E7=AE=A1=E7=90=86=E5=91=98=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E6=B2=A1=E6=9C=89=E5=90=8C=E6=AD=A5=E5=88=A0=E9=99=A4?= =?UTF-8?q?=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 --- framework/src/main/java/cn/lili/common/enums/ResultCode.java | 2 +- .../modules/permission/serviceimpl/AdminUserServiceImpl.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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 8ee1d411..c7384ecd 100644 --- a/framework/src/main/java/cn/lili/common/enums/ResultCode.java +++ b/framework/src/main/java/cn/lili/common/enums/ResultCode.java @@ -17,7 +17,7 @@ public enum ResultCode { /** * 失败返回码 */ - ERROR(400, "业务异常,请核对问题后进行重试"), + ERROR(400, "服务器繁忙,请稍后重试"), /** * 失败返回码 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 c6361bb2..25e9d426 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 @@ -236,6 +236,11 @@ public class AdminUserServiceImpl extends ServiceImpl roles) { + + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("user_id", userId); + userRoleService.remove(queryWrapper); + if (roles.isEmpty() || roles == null) { return; } From 20f1d58386f74f7f8fb14c797c6133c4c18fab62 Mon Sep 17 00:00:00 2001 From: Chopper Date: Fri, 27 Aug 2021 17:12:09 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=A7=92=E8=89=B2=E5=88=A0=E9=99=A4?= =?UTF-8?q?=EF=BC=8C=E8=8F=9C=E5=8D=95=E8=A7=92=E8=89=B2=E5=85=B3=E7=B3=BB?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=AD=A3=E7=A1=AE=E7=9A=84=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../permission/serviceimpl/AdminUserServiceImpl.java | 1 - .../modules/permission/serviceimpl/RoleServiceImpl.java | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) 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 25e9d426..6667985a 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 @@ -226,7 +226,6 @@ public class AdminUserServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.in("user_id", ids); userRoleService.remove(queryWrapper); - } /** diff --git a/framework/src/main/java/cn/lili/modules/permission/serviceimpl/RoleServiceImpl.java b/framework/src/main/java/cn/lili/modules/permission/serviceimpl/RoleServiceImpl.java index 09b4da2d..3a2093aa 100644 --- a/framework/src/main/java/cn/lili/modules/permission/serviceimpl/RoleServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/permission/serviceimpl/RoleServiceImpl.java @@ -5,6 +5,7 @@ import cn.lili.common.exception.ServiceException; import cn.lili.modules.permission.entity.dos.Role; import cn.lili.modules.permission.mapper.RoleMapper; import cn.lili.modules.permission.service.DepartmentRoleService; +import cn.lili.modules.permission.service.RoleMenuService; import cn.lili.modules.permission.service.RoleService; import cn.lili.modules.permission.service.UserRoleService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -36,6 +37,9 @@ public class RoleServiceImpl extends ServiceImpl implements Ro @Autowired private UserRoleService userRoleService; + @Autowired + private RoleMenuService roleMenuService; + @Override public List findByDefaultRole(Boolean defaultRole) { QueryWrapper queryWrapper = new QueryWrapper<>(); @@ -56,6 +60,6 @@ public class RoleServiceImpl extends ServiceImpl implements Ro //删除角色 this.removeByIds(roleIds); //删除角色与菜单关联 - userRoleService.remove(queryWrapper); + roleMenuService.remove(queryWrapper); } } From 07fae7a5316303b3803d6798d839974e2ca4e67c Mon Sep 17 00:00:00 2001 From: Chopper Date: Sat, 28 Aug 2021 03:42:06 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=95=86=E5=93=81=E4=BB=B7=E6=A0=BCDTO?= =?UTF-8?q?=E5=8F=82=E4=B8=8E=E6=B4=BB=E5=8A=A8=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 --- .../order/cart/entity/vo/CartSkuVO.java | 6 ++-- .../cart/render/impl/SkuPromotionRender.java | 19 ++++++++++-- .../order/cart/service/CartServiceImpl.java | 2 ++ .../order/order/entity/dos/OrderItem.java | 14 ++++----- .../order/entity/dto/PriceDetailDTO.java | 4 +-- .../promotion/entity/vos/PromotionSkuVO.java | 31 +++++++++++++++++++ 6 files changed, 61 insertions(+), 15 deletions(-) create mode 100644 framework/src/main/java/cn/lili/modules/promotion/entity/vos/PromotionSkuVO.java diff --git a/framework/src/main/java/cn/lili/modules/order/cart/entity/vo/CartSkuVO.java b/framework/src/main/java/cn/lili/modules/order/cart/entity/vo/CartSkuVO.java index 9900612a..f7fcd45c 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/entity/vo/CartSkuVO.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/entity/vo/CartSkuVO.java @@ -57,9 +57,6 @@ public class CartSkuVO extends CartBase implements Serializable { @ApiModelProperty(value = "是否免运费") private Boolean isFreeFreight; - @ApiModelProperty(value = "积分购买 积分数量") - private Long point; - @ApiModelProperty(value = "是否失效 ") private Boolean invalid; @@ -79,6 +76,9 @@ public class CartSkuVO extends CartBase implements Serializable { @ApiModelProperty(value = "积分兑换ID") private String pointsId; + @ApiModelProperty(value = "积分购买 积分数量") + private Long point; + @ApiModelProperty(value = "可参与的单品活动") private List promotions; diff --git a/framework/src/main/java/cn/lili/modules/order/cart/render/impl/SkuPromotionRender.java b/framework/src/main/java/cn/lili/modules/order/cart/render/impl/SkuPromotionRender.java index 96e243e0..0122712a 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/render/impl/SkuPromotionRender.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/render/impl/SkuPromotionRender.java @@ -1,5 +1,6 @@ package cn.lili.modules.order.cart.render.impl; +import cn.lili.common.enums.PromotionTypeEnum; import cn.lili.common.security.context.UserContext; import cn.lili.common.utils.CurrencyUtil; import cn.lili.modules.order.cart.entity.dto.TradeDTO; @@ -9,6 +10,7 @@ import cn.lili.modules.order.cart.entity.vo.CartVO; import cn.lili.modules.order.cart.render.CartRenderStep; import cn.lili.modules.order.order.entity.dto.PriceDetailDTO; import cn.lili.modules.promotion.entity.enums.KanJiaStatusEnum; +import cn.lili.modules.promotion.entity.vos.PromotionSkuVO; import cn.lili.modules.promotion.entity.vos.kanjia.KanjiaActivitySearchParams; import cn.lili.modules.promotion.entity.vos.kanjia.KanjiaActivityVO; import cn.lili.modules.promotion.service.KanjiaActivityService; @@ -76,16 +78,18 @@ public class SkuPromotionRender implements CartRenderStep { switch (tradeDTO.getCartTypeEnum()) { + + //这里是双重循环,但是实际积分购买或者是砍价购买时,购物车只有一个商品,所以没有循环操作数据库或者其他的问题 case POINTS: //处理积分商品购买 for (CartVO cartVO : tradeDTO.getCartList()) { for (CartSkuVO cartSkuVO : cartVO.getSkuList()) { cartSkuVO.getPriceDetailDTO().setPayPoint(cartSkuVO.getPoint()); + PromotionSkuVO promotionSkuVO = new PromotionSkuVO(PromotionTypeEnum.PINTUAN.name(), cartSkuVO.getPointsId()); + cartSkuVO.getPriceDetailDTO().getJoinPromotion().add(promotionSkuVO); } } return; - - case KANJIA: for (CartVO cartVO : tradeDTO.getCartList()) { for (CartSkuVO cartSkuVO : cartVO.getSkuList()) { @@ -101,11 +105,20 @@ public class SkuPromotionRender implements CartRenderStep { cartSkuVO.setSubTotal(kanjiaActivityVO.getPurchasePrice()); cartSkuVO.getPriceDetailDTO().setGoodsPrice(kanjiaActivityVO.getPurchasePrice()); } + + PromotionSkuVO promotionSkuVO = new PromotionSkuVO(PromotionTypeEnum.KANJIA.name(), cartSkuVO.getKanjiaId()); + cartSkuVO.getPriceDetailDTO().getJoinPromotion().add(promotionSkuVO); } } return; - case PINTUAN: + for (CartVO cartVO : tradeDTO.getCartList()) { + for (CartSkuVO cartSkuVO : cartVO.getSkuList()) { + PromotionSkuVO promotionSkuVO = new PromotionSkuVO(PromotionTypeEnum.PINTUAN.name(), cartSkuVO.getPintuanId()); + cartSkuVO.getPriceDetailDTO().getJoinPromotion().add(promotionSkuVO); + } + } + return; case CART: case BUY_NOW: case VIRTUAL: diff --git a/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java index 023bcfa4..ae42c72c 100644 --- a/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/cart/service/CartServiceImpl.java @@ -730,6 +730,7 @@ public class CartServiceImpl implements CartService { throw new ServiceException(ResultCode.KANJIA_ACTIVITY_NOT_PASS_ERROR); } //砍价商品默认一件货物 + cartSkuVO.setKanjiaId(kanjiaActivity.getId()); cartSkuVO.setNum(1); } @@ -745,6 +746,7 @@ public class CartServiceImpl implements CartService { if (pointsGoodsVO != null) { cartSkuVO.setPoint(pointsGoodsVO.getPoints()); cartSkuVO.setPurchasePrice(0D); + cartSkuVO.setPointsId(pointsGoodsVO.getId()); } } } diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/dos/OrderItem.java b/framework/src/main/java/cn/lili/modules/order/order/entity/dos/OrderItem.java index b2ab11dd..06d95d24 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/dos/OrderItem.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/dos/OrderItem.java @@ -2,17 +2,17 @@ package cn.lili.modules.order.order.entity.dos; import cn.hutool.core.collection.CollUtil; import cn.hutool.json.JSONUtil; -import cn.lili.mybatis.BaseEntity; import cn.lili.common.utils.BeanUtil; import cn.lili.common.utils.SnowFlake; +import cn.lili.modules.order.cart.entity.dto.TradeDTO; +import cn.lili.modules.order.cart.entity.vo.CartSkuVO; +import cn.lili.modules.order.cart.entity.vo.CartVO; import cn.lili.modules.order.order.entity.dto.PriceDetailDTO; import cn.lili.modules.order.order.entity.enums.CommentStatusEnum; import cn.lili.modules.order.order.entity.enums.OrderComplaintStatusEnum; import cn.lili.modules.order.order.entity.enums.OrderItemAfterSaleStatusEnum; -import cn.lili.modules.promotion.entity.dto.BasePromotion; -import cn.lili.modules.order.cart.entity.dto.TradeDTO; -import cn.lili.modules.order.cart.entity.vo.CartSkuVO; -import cn.lili.modules.order.cart.entity.vo.CartVO; +import cn.lili.modules.promotion.entity.vos.PromotionSkuVO; +import cn.lili.mybatis.BaseEntity; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -126,8 +126,8 @@ public class OrderItem extends BaseEntity { BeanUtil.copyProperties(cartSkuVO, this); this.setId(oldId); if (cartSkuVO.getPriceDetailDTO().getJoinPromotion() != null && !cartSkuVO.getPriceDetailDTO().getJoinPromotion().isEmpty()) { - this.setPromotionType(CollUtil.join(cartSkuVO.getPriceDetailDTO().getJoinPromotion().stream().map(BasePromotion::getPromotionName).collect(Collectors.toList()), ",")); - this.setPromotionId(CollUtil.join(cartSkuVO.getPriceDetailDTO().getJoinPromotion().stream().map(BasePromotion::getId).collect(Collectors.toList()), ",")); + this.setPromotionType(CollUtil.join(cartSkuVO.getPriceDetailDTO().getJoinPromotion().stream().map(PromotionSkuVO::getPromotionType).collect(Collectors.toList()), ",")); + this.setPromotionId(CollUtil.join(cartSkuVO.getPriceDetailDTO().getJoinPromotion().stream().map(PromotionSkuVO::getActivityId).collect(Collectors.toList()), ",")); } this.setAfterSaleStatus(OrderItemAfterSaleStatusEnum.NEW.name()); this.setCommentStatus(CommentStatusEnum.NEW.name()); diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/dto/PriceDetailDTO.java b/framework/src/main/java/cn/lili/modules/order/order/entity/dto/PriceDetailDTO.java index 5e44ff10..b03e1a51 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/dto/PriceDetailDTO.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/dto/PriceDetailDTO.java @@ -2,7 +2,7 @@ package cn.lili.modules.order.order.entity.dto; import cn.lili.common.utils.CurrencyUtil; -import cn.lili.modules.promotion.entity.dto.BasePromotion; +import cn.lili.modules.promotion.entity.vos.PromotionSkuVO; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -95,7 +95,7 @@ public class PriceDetailDTO implements Serializable { * 参与的促销活动 */ @ApiModelProperty(value = "参与的促销活动") - private List joinPromotion; + private List joinPromotion; public Double getOriginalPrice() { diff --git a/framework/src/main/java/cn/lili/modules/promotion/entity/vos/PromotionSkuVO.java b/framework/src/main/java/cn/lili/modules/promotion/entity/vos/PromotionSkuVO.java new file mode 100644 index 00000000..57c54dad --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/promotion/entity/vos/PromotionSkuVO.java @@ -0,0 +1,31 @@ +package cn.lili.modules.promotion.entity.vos; + +import cn.lili.common.enums.PromotionTypeEnum; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 促销skuVO + * + * @author Chopper + * @version v1.0 + * 2021-08-28 03:24 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PromotionSkuVO { + + /** + * 促销类型 + * @see PromotionTypeEnum + */ + private String promotionType; + + /** + * 促销活动 + */ + private String activityId; + +}