diff --git a/src/main/java/com/gxwebsoft/glt/service/GltTicketOrderService.java b/src/main/java/com/gxwebsoft/glt/service/GltTicketOrderService.java index 3a34fe9..48cdf5c 100644 --- a/src/main/java/com/gxwebsoft/glt/service/GltTicketOrderService.java +++ b/src/main/java/com/gxwebsoft/glt/service/GltTicketOrderService.java @@ -17,10 +17,10 @@ import java.time.LocalDateTime; */ public interface GltTicketOrderService extends IService { - int DELIVERY_STATUS_WAITING = 10; - int DELIVERY_STATUS_DELIVERING = 20; - int DELIVERY_STATUS_WAIT_CONFIRM = 30; - int DELIVERY_STATUS_FINISHED = 40; + int DELIVERY_STATUS_WAITING = 10; //待配送 + int DELIVERY_STATUS_DELIVERING = 20; //配送中 + int DELIVERY_STATUS_WAIT_CONFIRM = 30; //等待收货 + int DELIVERY_STATUS_FINISHED = 40; //收货完成 int RECEIVE_CONFIRM_TYPE_MANUAL = 10; int RECEIVE_CONFIRM_TYPE_PHOTO = 20; diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopFlashSaleActivityServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopFlashSaleActivityServiceImpl.java index 8f6e461..c75dc9f 100644 --- a/src/main/java/com/gxwebsoft/shop/service/impl/ShopFlashSaleActivityServiceImpl.java +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopFlashSaleActivityServiceImpl.java @@ -141,39 +141,38 @@ public class ShopFlashSaleActivityServiceImpl extends ServiceImpl goodsIdList = resultVOList.stream().map(ShopFlashSaleActivityVO::getGoodsId).distinct().collect(Collectors.toList()); List shopGoods = shopGoodsMapper.selectBatchIds(goodsIdList); - - Map finalActivityMap = activityMap; - Boolean finalNewUser = newUser; - resultVOList.forEach(activity -> { - //5.1 判断新老用户商品购买能力、超买能力 - if(finalNewUser){ - if(activity.getDisplayType() == 2){ - activity.setEnable(false); + for(ShopFlashSaleActivityVO activityVO : resultVOList){ + if(newUser){ + if(activityVO.getDisplayType() == 2){ + activityVO.setEnable(false); + activityVO.setEnableMsg("当前商品仅限老用户购买!"); } }else { - if(activity.getDisplayType() == 1){ - activity.setEnable(false); + if(activityVO.getDisplayType() == 1){ + activityVO.setEnable(false); + activityVO.setEnableMsg("当前商品仅限新用户购买!"); } - if(activity.getEnable()){ + if(activityVO.getEnable()){ //超下单数量活动不可选 - Integer orderTotalNum = finalActivityMap.get(activity.getId()); - if(orderTotalNum != null && orderTotalNum >= activity.getSaleLimit()){ - activity.setEnable(false); + Integer orderTotalNum = activityMap.get(activityVO.getId()); + if(orderTotalNum != null && orderTotalNum >= activityVO.getSaleLimit()){ + activityVO.setEnable(false); + activityVO.setEnableMsg("当前商品您购买次数已达上限!"); } } } //5.2 回显商品信息 - ShopGoods shopGood = shopGoods.stream().filter(goods -> activity.getGoodsId().equals(goods.getGoodsId())).findFirst().orElse(null); + ShopGoods shopGood = shopGoods.stream().filter(goods -> activityVO.getGoodsId().equals(goods.getGoodsId())).findFirst().orElse(null); if(shopGood != null){ - activity.setGoodsPrice(shopGood.getPrice()); - activity.setGoodsTotalPrice(shopGood.getPrice().multiply(new BigDecimal(activity.getNum()))); - activity.setGoodsName(shopGood.getName()); - activity.setImage(shopGood.getImage()); - activity.setUnitName(shopGood.getUnitName()); + activityVO.setGoodsPrice(shopGood.getPrice()); + activityVO.setGoodsTotalPrice(shopGood.getPrice().multiply(new BigDecimal(activityVO.getNum()))); + activityVO.setGoodsName(shopGood.getName()); + activityVO.setImage(shopGood.getImage()); + activityVO.setUnitName(shopGood.getUnitName()); } - }); + } } return resultVOList; } diff --git a/src/main/java/com/gxwebsoft/shop/vo/ShopFlashSaleActivityVO.java b/src/main/java/com/gxwebsoft/shop/vo/ShopFlashSaleActivityVO.java index e142d82..1381025 100644 --- a/src/main/java/com/gxwebsoft/shop/vo/ShopFlashSaleActivityVO.java +++ b/src/main/java/com/gxwebsoft/shop/vo/ShopFlashSaleActivityVO.java @@ -65,7 +65,7 @@ public class ShopFlashSaleActivityVO implements Serializable { @Schema(description = "库存") private Integer stock; - @Schema(description = "展示类型,0:普通用户,1:新用户 2:老用户") + @Schema(description = "展示类型,0:普通用户,1:新用户 2:老用户") private Integer displayType; @Schema(description = "备注") @@ -77,12 +77,15 @@ public class ShopFlashSaleActivityVO implements Serializable { @Schema(description = "是否弹窗 0-否 1-是") private Integer popFlag; - @Schema(description = "租户id") - private Integer tenantId; - @Schema(description = "是否可选") private Boolean enable = true; + @Schema(description = "不可购买原因!") + private String enableMsg; + + @Schema(description = "租户id") + private Integer tenantId; + @Schema(description = "创建者") private String creator;